-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable header row marker on single selection (#935)
* Disable header row marker on single selection * Add story * Use other defaults * Update text * Minor change
- Loading branch information
1 parent
3a97523
commit c21e6ca
Showing
6 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
packages/core/src/docs/examples/row-selections.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from "react"; | ||
import { DataEditorAll as DataEditor } from "../../data-editor-all.js"; | ||
import { type RowMarkerOptions } from "../../data-editor/data-editor.js"; | ||
import { | ||
BeautifulWrapper, | ||
Description, | ||
PropName, | ||
useMockDataGenerator, | ||
defaultProps, | ||
} from "../../data-editor/stories/utils.js"; | ||
import { SimpleThemeWrapper } from "../../stories/story-utils.js"; | ||
|
||
export default { | ||
title: "Glide-Data-Grid/DataEditor Demos", | ||
|
||
decorators: [ | ||
(Story: React.ComponentType) => ( | ||
<SimpleThemeWrapper> | ||
<BeautifulWrapper | ||
title="Row selections" | ||
description={ | ||
<Description> | ||
You can enable row selections by setting <PropName>rowSelect</PropName> prop to{" "} | ||
<PropName>multi</PropName> for multi-selection or <PropName>single</PropName> for | ||
single-selection. The row marker behavior and appearance can be controlled via the{" "} | ||
<PropName>rowMarkers</PropName> prop. | ||
</Description> | ||
}> | ||
<Story /> | ||
</BeautifulWrapper> | ||
</SimpleThemeWrapper> | ||
), | ||
], | ||
}; | ||
|
||
interface RowSelectionsProps { | ||
rowSelect: "none" | "single" | "multi"; | ||
rowSelectionMode: "auto" | "multi"; | ||
rowMarkersKind: RowMarkerOptions["kind"]; | ||
rowMarkersCheckboxStyle: RowMarkerOptions["checkboxStyle"]; | ||
} | ||
|
||
export const RowSelections: React.FC<RowSelectionsProps> = p => { | ||
const { cols, getCellContent } = useMockDataGenerator(30); | ||
|
||
return ( | ||
<DataEditor | ||
{...defaultProps} | ||
rowSelect={p.rowSelect} | ||
rowSelectionMode={p.rowSelectionMode} | ||
getCellContent={getCellContent} | ||
rowMarkers={{ | ||
kind: p.rowMarkersKind, | ||
checkboxStyle: p.rowMarkersCheckboxStyle, | ||
}} | ||
columns={cols} | ||
rows={400} | ||
/> | ||
); | ||
}; | ||
(RowSelections as any).args = { | ||
rowSelect: "single", | ||
rowSelectionMode: "auto", | ||
rowMarkersKind: "checkbox-visible", | ||
rowMarkersCheckboxStyle: "circle", | ||
}; | ||
(RowSelections as any).argTypes = { | ||
rowSelect: { | ||
control: { type: "select" }, | ||
options: ["none", "single", "multi"], | ||
}, | ||
rowSelectionMode: { | ||
control: { type: "select" }, | ||
options: ["auto", "multi"], | ||
}, | ||
rowMarkersKind: { | ||
control: { type: "select" }, | ||
options: ["both", "checkbox", "number", "none", "clickable-number", "checkbox-visible"], | ||
}, | ||
rowMarkersCheckboxStyle: { | ||
control: { type: "select" }, | ||
options: ["square", "circle"], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters