@bmsuisse/datagrid 0.25.0 → 0.25.2
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 +27 -2
- package/dist/index.js +276 -236
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -935,6 +935,29 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
|
|
|
935
935
|
/** Controlled expanded state, keyed by node id. Omit for the grid to own this itself. */
|
|
936
936
|
expanded?: Record<string, boolean>;
|
|
937
937
|
onExpandedChange?: (expanded: Record<string, boolean>) => void;
|
|
938
|
+
/**
|
|
939
|
+
* Controlled lazy-children cache, keyed by node id — same
|
|
940
|
+
* controlled/uncontrolled convention as `expanded` above. Omit for the
|
|
941
|
+
* grid to own this itself (the common case, and the only way earlier
|
|
942
|
+
* versions of this component worked).
|
|
943
|
+
*
|
|
944
|
+
* Supply this when a caller needs to force a specific node's cached batch
|
|
945
|
+
* to be replaced with fresher data fetched *outside* the normal
|
|
946
|
+
* expand/collapse flow above (`onLoadChildren` only ever runs once per
|
|
947
|
+
* node id per the doc on it) — e.g. after an edit made to one of that
|
|
948
|
+
* node's children was saved, and the caller re-fetched that batch via its
|
|
949
|
+
* own `onLoadChildren` function to pick up the server's new state. Setting
|
|
950
|
+
* `childrenMap` to a new map containing that node's id (typically via
|
|
951
|
+
* `onChildrenMapChange`'s own setter, called by the caller's re-fetch
|
|
952
|
+
* logic) makes this component's flattened rows use the fresh batch on the
|
|
953
|
+
* very next render — without this, a caller's own separate copy of that
|
|
954
|
+
* data has nowhere to feed back into what actually gets rendered, no
|
|
955
|
+
* matter how it's refreshed, since only this component's internal cache
|
|
956
|
+
* (or an eager `getChildren(row)`) is ever consulted for a lazily-loaded
|
|
957
|
+
* node's children.
|
|
958
|
+
*/
|
|
959
|
+
childrenMap?: ReadonlyMap<string, TRow[]>;
|
|
960
|
+
onChildrenMapChange?: (childrenMap: ReadonlyMap<string, TRow[]>) => void;
|
|
938
961
|
/** Pixels of left padding added per depth level to the tree column's cell. Defaults to 20. */
|
|
939
962
|
indentSize?: number;
|
|
940
963
|
/**
|
|
@@ -1047,7 +1070,7 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
|
|
|
1047
1070
|
* column's cell matches `treeColumnId` (defaults to `columns[0]`); every
|
|
1048
1071
|
* other column renders exactly like it would in `<DataGrid>`.
|
|
1049
1072
|
*/
|
|
1050
|
-
declare function TreeDataGrid<TRow>({ columns, data, treeColumnId, getRowId, getChildren, hasChildren, onLoadChildren, initialExpandedLevel, expanded: controlledExpanded, onExpandedChange, indentSize, getRowProps, getRowTestId, rowActions, virtualizeThreshold, estimatedRowHeight, maxBodyHeight, selectedIds: controlledSelectedIds, onSelectedIdsChange, getRowSelectionState, isRowSelectionDisabled, zebra, }: TreeDataGridProps<TRow>): ReactElement;
|
|
1073
|
+
declare function TreeDataGrid<TRow>({ columns, data, treeColumnId, getRowId, getChildren, hasChildren, onLoadChildren, initialExpandedLevel, expanded: controlledExpanded, onExpandedChange, childrenMap: controlledChildrenMap, onChildrenMapChange, indentSize, getRowProps, getRowTestId, rowActions, virtualizeThreshold, estimatedRowHeight, maxBodyHeight, selectedIds: controlledSelectedIds, onSelectedIdsChange, getRowSelectionState, isRowSelectionDisabled, zebra, }: TreeDataGridProps<TRow>): ReactElement;
|
|
1051
1074
|
|
|
1052
1075
|
interface FlatTreeRow<TRow> {
|
|
1053
1076
|
row: TRow;
|
|
@@ -1085,6 +1108,8 @@ interface UseTreeStateOptions<TRow> extends TreeAccessors<TRow> {
|
|
|
1085
1108
|
onLoadChildren?: (row: TRow) => Promise<TRow[]>;
|
|
1086
1109
|
expanded?: Record<string, boolean>;
|
|
1087
1110
|
onExpandedChange?: (expanded: Record<string, boolean>) => void;
|
|
1111
|
+
childrenMap?: ReadonlyMap<string, TRow[]>;
|
|
1112
|
+
onChildrenMapChange?: (childrenMap: ReadonlyMap<string, TRow[]>) => void;
|
|
1088
1113
|
}
|
|
1089
1114
|
/**
|
|
1090
1115
|
* Owns everything `<TreeDataGrid>` needs beyond plain rendering: expand
|
|
@@ -1099,6 +1124,6 @@ interface UseTreeStateOptions<TRow> extends TreeAccessors<TRow> {
|
|
|
1099
1124
|
* reset (e.g. switching to a different root entity entirely) should remount
|
|
1100
1125
|
* `<TreeDataGrid>` via a `key` prop rather than rely on implicit magic here.
|
|
1101
1126
|
*/
|
|
1102
|
-
declare function useTreeState<TRow>({ data, getRowId, getChildren, hasChildren, onLoadChildren, expanded: controlledExpanded, onExpandedChange, }: UseTreeStateOptions<TRow>): TreeStateController<TRow>;
|
|
1127
|
+
declare function useTreeState<TRow>({ data, getRowId, getChildren, hasChildren, onLoadChildren, expanded: controlledExpanded, onExpandedChange, childrenMap: controlledChildrenMap, onChildrenMapChange, }: UseTreeStateOptions<TRow>): TreeStateController<TRow>;
|
|
1103
1128
|
|
|
1104
1129
|
export { ActionsMenu, type BaseColumn, type BooleanColumn, BooleanFilter, type ClientProcessingResult, type ColumnAlign, type ColumnDef, type ColumnGroup, ColumnSelector, type ColumnSelectorProps, type ColumnVisibility, type CompositeFilterDescriptor, DataGrid, type DataGridProps, type DataSource, type DateColumn, DateRangeFilter, type DebouncedCallback, type EnumColumn, EnumFilter, type EnumOption, type FilterDescriptor, type FilterOperator, type FilterWidgetProps, type FlatTreeRow, type GridState, type GridStateController, type MenuItem, type MenuItemContext, type NumberColumn, NumberComparisonFilter, NumberHistogramFilter, type NumberHistogramFilterProps, NumberRangeFilter, type ResolvedMenuItem, type SortDescriptor, type StringColumn, StringFilter, type TreeAccessors, TreeDataGrid, type TreeDataGridProps, type TreeStateController, UNARY_OPERATORS, type UseTreeStateOptions, alignClassName, canHideColumn, canHideGroup, countVisible, defaultAlign, defaultFormat, evaluateFilter, facetedNumberValues, fieldKey, flattenTree, getColumnValue, groupColumns, isColumnVisible, isCompositeFilterDescriptor, isFilterDescriptor, isFilterable, isSortable, processClientData, renderDefaultFilterWidget, resolveMenuItems, storageKeyFor, useDebouncedCallback, useGridState, useTreeState };
|