@bmsuisse/datagrid 0.32.0 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +11 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1848,6 +1848,16 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
|
|
|
1848
1848
|
estimatedRowHeight?: number;
|
|
1849
1849
|
/** Max height of the scrollable table body in pixels. Required for virtualization to have a viewport to scroll within. Defaults to 480. */
|
|
1850
1850
|
maxBodyHeight?: number;
|
|
1851
|
+
/**
|
|
1852
|
+
* `data-testid` for the tree's own scrollable container — the element
|
|
1853
|
+
* `maxBodyHeight` actually applies to once virtualized. Omit for no
|
|
1854
|
+
* attribute at all. Useful for an e2e test that needs to scroll this
|
|
1855
|
+
* specific tree or assert on its scroll position; the outer
|
|
1856
|
+
* `data-testid="tree-datagrid"` wrapper isn't it, and isn't unique per
|
|
1857
|
+
* tree on a page with more than one — same convention as `<DataGrid>`'s
|
|
1858
|
+
* own `testId`.
|
|
1859
|
+
*/
|
|
1860
|
+
testId?: string;
|
|
1851
1861
|
/**
|
|
1852
1862
|
* Controlled row selection — same convention as `<DataGrid>`'s own
|
|
1853
1863
|
* `selectedIds`/`onSelectedIdsChange`. Both must be supplied together to
|
|
@@ -1949,7 +1959,7 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
|
|
|
1949
1959
|
* column's cell matches `treeColumnId` (defaults to `columns[0]`); every
|
|
1950
1960
|
* other column renders exactly like it would in `<DataGrid>`.
|
|
1951
1961
|
*/
|
|
1952
|
-
declare function TreeDataGrid<TRow>({ columns, data, treeColumnId, columnVisibility, getRowId, getChildren, hasChildren, onLoadChildren, initialExpandedLevel, expanded: controlledExpanded, onExpandedChange, childrenMap: controlledChildrenMap, onChildrenMapChange, indentSize, getRowProps, getRowTestId, rowActions, virtualizeThreshold, estimatedRowHeight, maxBodyHeight, selectedIds: controlledSelectedIds, onSelectedIdsChange, getRowSelectionState, isRowSelectionDisabled, groupBy, renderGroupHeader, defaultGroupsExpanded, expandedGroups: controlledExpandedGroups, onExpandedGroupsChange, zebra, editing, }: TreeDataGridProps<TRow>): ReactElement;
|
|
1962
|
+
declare function TreeDataGrid<TRow>({ columns, data, treeColumnId, columnVisibility, getRowId, getChildren, hasChildren, onLoadChildren, initialExpandedLevel, expanded: controlledExpanded, onExpandedChange, childrenMap: controlledChildrenMap, onChildrenMapChange, indentSize, getRowProps, getRowTestId, rowActions, virtualizeThreshold, estimatedRowHeight, maxBodyHeight, testId, selectedIds: controlledSelectedIds, onSelectedIdsChange, getRowSelectionState, isRowSelectionDisabled, groupBy, renderGroupHeader, defaultGroupsExpanded, expandedGroups: controlledExpandedGroups, onExpandedGroupsChange, zebra, editing, }: TreeDataGridProps<TRow>): ReactElement;
|
|
1953
1963
|
|
|
1954
1964
|
interface FlatTreeRow<TRow> {
|
|
1955
1965
|
row: TRow;
|
package/dist/index.js
CHANGED
|
@@ -4415,6 +4415,7 @@ function TreeDataGrid({
|
|
|
4415
4415
|
virtualizeThreshold = 100,
|
|
4416
4416
|
estimatedRowHeight = 40,
|
|
4417
4417
|
maxBodyHeight = 480,
|
|
4418
|
+
testId,
|
|
4418
4419
|
selectedIds: controlledSelectedIds,
|
|
4419
4420
|
onSelectedIdsChange,
|
|
4420
4421
|
getRowSelectionState,
|
|
@@ -4603,28 +4604,39 @@ function TreeDataGrid({
|
|
|
4603
4604
|
"div",
|
|
4604
4605
|
{
|
|
4605
4606
|
ref: scrollRef,
|
|
4607
|
+
"data-testid": testId,
|
|
4606
4608
|
className: shouldVirtualize ? "overflow-y-auto" : void 0,
|
|
4607
4609
|
style: shouldVirtualize ? { maxHeight: maxBodyHeight } : void 0,
|
|
4608
4610
|
children: /* @__PURE__ */ jsxs21("table", { className: "w-full border-collapse text-sm", children: [
|
|
4609
4611
|
/* @__PURE__ */ jsx34("thead", { ref: theadRef, children: /* @__PURE__ */ jsxs21("tr", { className: "divide-x divide-border", children: [
|
|
4610
|
-
showSelectionColumn && /* @__PURE__ */ jsx34(
|
|
4611
|
-
|
|
4612
|
+
showSelectionColumn && /* @__PURE__ */ jsx34(
|
|
4613
|
+
"th",
|
|
4612
4614
|
{
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4615
|
+
className: "sticky top-0 z-20 border-b border-border bg-muted p-1",
|
|
4616
|
+
style: { width: SELECTION_COLUMN_WIDTH },
|
|
4617
|
+
children: /* @__PURE__ */ jsx34(
|
|
4618
|
+
Checkbox,
|
|
4619
|
+
{
|
|
4620
|
+
"aria-label": "Select all visible rows",
|
|
4621
|
+
checked: allVisibleSelected,
|
|
4622
|
+
onCheckedChange: toggleAllVisibleSelected
|
|
4623
|
+
}
|
|
4624
|
+
)
|
|
4616
4625
|
}
|
|
4617
|
-
)
|
|
4626
|
+
),
|
|
4618
4627
|
visibleColumns.map((column) => /* @__PURE__ */ jsx34(
|
|
4619
4628
|
"th",
|
|
4620
4629
|
{
|
|
4621
4630
|
style: column.width ? { width: column.width } : void 0,
|
|
4622
|
-
className:
|
|
4631
|
+
className: cn(
|
|
4632
|
+
"sticky top-0 z-20 border-b border-border bg-muted p-2 font-medium",
|
|
4633
|
+
alignClassName(column)
|
|
4634
|
+
),
|
|
4623
4635
|
children: column.header
|
|
4624
4636
|
},
|
|
4625
4637
|
column.id
|
|
4626
4638
|
)),
|
|
4627
|
-
showRowActionsColumn && /* @__PURE__ */ jsx34("th", { className: "border-b border-border p-2", "aria-label": "Row actions" })
|
|
4639
|
+
showRowActionsColumn && /* @__PURE__ */ jsx34("th", { className: "sticky top-0 z-20 border-b border-border bg-muted p-2", "aria-label": "Row actions" })
|
|
4628
4640
|
] }) }),
|
|
4629
4641
|
/* @__PURE__ */ jsx34("tbody", { children: data.length === 0 ? /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34("td", { colSpan: totalColumnCount, className: "p-4 text-center text-muted-foreground", children: "No results." }) }) : groupedBuckets ? groupedBuckets.map((bucket) => {
|
|
4630
4642
|
const groupExpanded = isGroupExpanded(bucket.key);
|