Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add header disabled to row markers #981

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/core/src/data-editor/data-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export interface RowMarkerOptions {
theme?: Partial<Theme>;
headerTheme?: Partial<Theme>;
headerAlwaysVisible?: boolean;
headerDisabled?: boolean;
}

interface MouseState {
Expand Down Expand Up @@ -877,7 +878,7 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
const rowMarkerTheme = rowMarkersObj?.theme ?? p.rowMarkerTheme;
const headerRowMarkerTheme = rowMarkersObj?.headerTheme;
const headerRowMarkerAlwaysVisible = rowMarkersObj?.headerAlwaysVisible;
const headerRowMarkerDisabled = rowSelect !== "multi";
const headerRowMarkerDisabled = rowSelect !== "multi" || rowMarkersObj?.headerDisabled === true;
const rowMarkerCheckboxStyle = rowMarkersObj?.checkboxStyle ?? "square";

const minColumnWidth = Math.max(minColumnWidthIn, 20);
Expand Down Expand Up @@ -1899,7 +1900,7 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
if (hasRowMarkers && col === 0) {
lastSelectedRowRef.current = undefined;
lastSelectedColRef.current = undefined;
if (rowSelect === "multi") {
if (!headerRowMarkerDisabled && rowSelect === "multi") {
if (selectedRows.length !== rows) {
setSelectedRows(CompactSelection.fromSingleSelection([0, rows]), undefined, isMultiKey);
} else {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/internal/data-grid/data-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ const DataGrid: React.ForwardRefRenderFunction<DataGridRef, DataGridProps> = (p,
const [overFill, setOverFill] = React.useState(false);

const [hCol, hRow] = hoveredItem ?? [];
const headerHovered = hCol !== undefined && hRow === -1;
const headerHovered = hCol !== undefined && hRow === -1 && columns[hCol].headerRowMarkerDisabled !== true;
const groupHeaderHovered = hCol !== undefined && hRow === -2;
let clickableInnerCellHovered = false;
let editableBoolHovered = false;
Expand All @@ -940,6 +940,7 @@ const DataGrid: React.ForwardRefRenderFunction<DataGridRef, DataGridProps> = (p,
: headerHovered || clickableInnerCellHovered || editableBoolHovered || groupHeaderHovered
? "pointer"
: "default";
console.log("CURSOR", cursor, cursorOverride, headerHovered);
const style = React.useMemo(
() => ({
// width,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function drawGridHeaders(
ctx.font = theme.baseFontFull;
}
const selected = selection.columns.hasIndex(c.sourceIndex);
const noHover = dragAndDropState !== undefined || isResizing;
const noHover = dragAndDropState !== undefined || isResizing || c.headerRowMarkerDisabled === true;
const hoveredBoolean = !noHover && hRow === -1 && hCol === c.sourceIndex;
const hover = noHover
? 0
Expand Down
2 changes: 1 addition & 1 deletion setup-react-18-test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

npm i -D react@latest react-dom@latest @testing-library/react@latest @testing-library/react-hooks@latest @testing-library/[email protected] react-test-renderer@latest
npm i -D react@latest react-dom@latest @testing-library/react@latest @testing-library/react-hooks@latest @testing-library/[email protected] react-test-renderer@latest @testing-library/dom
Loading