Skip to content

Commit

Permalink
add header disabled to row markers
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHung committed Jul 12, 2024
1 parent 5983dca commit 3875ab0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
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
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

0 comments on commit 3875ab0

Please sign in to comment.