@bmsuisse/datagrid 0.38.0 → 0.40.0
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 +64 -3
- package/dist/index.js +515 -267
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
|
@@ -121,6 +121,10 @@ interface FilterLabels {
|
|
|
121
121
|
clear: string;
|
|
122
122
|
/** NumberHistogramFilter's `loadValues` in-flight message. */
|
|
123
123
|
loading: string;
|
|
124
|
+
/** NumberHistogramFilter: `loadValues` rejected. */
|
|
125
|
+
loadFailed: string;
|
|
126
|
+
/** NumberHistogramFilter: retry action next to `loadFailed`. */
|
|
127
|
+
retry: string;
|
|
124
128
|
dateToday: string;
|
|
125
129
|
dateLast7Days: string;
|
|
126
130
|
dateThisMonth: string;
|
|
@@ -1483,6 +1487,28 @@ interface ActionsMenuProps<TRow> {
|
|
|
1483
1487
|
*/
|
|
1484
1488
|
declare function ActionsMenu<TRow>({ items, ctx, triggerLabel }: ActionsMenuProps<TRow>): ReactElement | null;
|
|
1485
1489
|
|
|
1490
|
+
/** Structured error shown by the grid's error states. Same shape as `@bmsuisse/ui`'s `ErrorInfo`. */
|
|
1491
|
+
interface ErrorInfo {
|
|
1492
|
+
title?: string;
|
|
1493
|
+
message?: string;
|
|
1494
|
+
/** Technical details (stack, response body) — shown behind a "Show details" toggle. */
|
|
1495
|
+
details?: string;
|
|
1496
|
+
}
|
|
1497
|
+
/** What the grids accept for `error` — pass a TanStack Query / SWR / `catch` error straight through. */
|
|
1498
|
+
type ErrorInput = ErrorInfo | Error | string | null | undefined | false;
|
|
1499
|
+
declare function toErrorInfo(error: unknown): ErrorInfo | undefined;
|
|
1500
|
+
/** User-facing strings of the grid's loading/error/empty states. Anything omitted keeps its English default. */
|
|
1501
|
+
interface GridStatusLabels {
|
|
1502
|
+
loading: string;
|
|
1503
|
+
noResults: string;
|
|
1504
|
+
errorTitle: string;
|
|
1505
|
+
retry: string;
|
|
1506
|
+
showDetails: string;
|
|
1507
|
+
/** TreeDataGrid: shown on a node whose lazy children failed to load. */
|
|
1508
|
+
nodeLoadFailed: string;
|
|
1509
|
+
}
|
|
1510
|
+
declare const defaultGridStatusLabels: GridStatusLabels;
|
|
1511
|
+
|
|
1486
1512
|
/**
|
|
1487
1513
|
* `"client"`: the grid owns filtering/sorting/pagination and evaluates them
|
|
1488
1514
|
* in-memory against the full `data` array (via `evaluateFilter`).
|
|
@@ -1537,6 +1563,17 @@ interface DataGridProps<TRow> {
|
|
|
1537
1563
|
* The two are OR'd together if both happen to be set. Defaults to `false`.
|
|
1538
1564
|
*/
|
|
1539
1565
|
loading?: boolean;
|
|
1566
|
+
/**
|
|
1567
|
+
* The data fetch failed. With no rows to show, the body is replaced by an error
|
|
1568
|
+
* state (title, message, collapsible details, Retry); with stale rows still shown,
|
|
1569
|
+
* they stay and a slim error banner appears above them. Accepts a string, an
|
|
1570
|
+
* `Error` (message + stack as details) or `{ title, message, details }`.
|
|
1571
|
+
*/
|
|
1572
|
+
error?: ErrorInput;
|
|
1573
|
+
/** Shows a Retry action in the error state/banner. */
|
|
1574
|
+
onRetry?: () => void;
|
|
1575
|
+
/** Overrides the grid's "Loading...", "No results." and error-state strings. */
|
|
1576
|
+
statusLabels?: Partial<GridStatusLabels>;
|
|
1540
1577
|
/** Per-row kebab menu. Evaluated with `ctx.row` set to that row. */
|
|
1541
1578
|
rowActions?: MenuItem<TRow>[];
|
|
1542
1579
|
/** Toolbar menu above the table. Evaluated with `ctx.selectedRows` set. */
|
|
@@ -1801,7 +1838,7 @@ interface DataGridProps<TRow> {
|
|
|
1801
1838
|
* (`"server"`). Column filter UI defaults to the type-appropriate widget
|
|
1802
1839
|
* from `src/filter` unless a column supplies its own `cell` renderer.
|
|
1803
1840
|
*/
|
|
1804
|
-
declare function DataGrid<TRow extends RowData>({ columns, dataSource, getRowId, rowActions, headerActions, enableMultiSort, initialState, columnVisibility, renderDetail, enableColumnResizing, columnResizeMode, columnSizing: controlledColumnSizing, onColumnSizingChange, virtualize, showPagination, getRowProps, getRowTestId, gridState, onGridStateChange, selectedIds: controlledSelectedIds, onSelectedIdsChange, testId, loading: loadingProp, groupBy, renderGroupHeader, defaultGroupsExpanded, expandedGroups: controlledExpandedGroups, onExpandedGroupsChange, zebra, showTotals, editing, cellEditing, filterLabels, }: DataGridProps<TRow>): ReactElement;
|
|
1841
|
+
declare function DataGrid<TRow extends RowData>({ columns, dataSource, getRowId, rowActions, headerActions, enableMultiSort, initialState, columnVisibility, renderDetail, enableColumnResizing, columnResizeMode, columnSizing: controlledColumnSizing, onColumnSizingChange, virtualize, showPagination, getRowProps, getRowTestId, gridState, onGridStateChange, selectedIds: controlledSelectedIds, onSelectedIdsChange, testId, loading: loadingProp, error, onRetry, statusLabels, groupBy, renderGroupHeader, defaultGroupsExpanded, expandedGroups: controlledExpandedGroups, onExpandedGroupsChange, zebra, showTotals, editing, cellEditing, filterLabels, }: DataGridProps<TRow>): ReactElement;
|
|
1805
1842
|
|
|
1806
1843
|
interface GridStateController {
|
|
1807
1844
|
state: GridState;
|
|
@@ -1985,6 +2022,16 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
|
|
|
1985
2022
|
* Defaults to `false`.
|
|
1986
2023
|
*/
|
|
1987
2024
|
loading?: boolean;
|
|
2025
|
+
/**
|
|
2026
|
+
* The root data fetch failed. With no rows, the body shows an error state (title,
|
|
2027
|
+
* message, collapsible details, Retry); with rows, they stay and a slim banner
|
|
2028
|
+
* appears above. Per-node lazy-load failures are handled separately (inline, per row).
|
|
2029
|
+
*/
|
|
2030
|
+
error?: ErrorInput;
|
|
2031
|
+
/** Shows a Retry action in the error state/banner. */
|
|
2032
|
+
onRetry?: () => void;
|
|
2033
|
+
/** Overrides the grid's "Loading...", "No results." and error-state strings. */
|
|
2034
|
+
statusLabels?: Partial<GridStatusLabels>;
|
|
1988
2035
|
/**
|
|
1989
2036
|
* The column whose cell gets the depth indentation + expand/collapse
|
|
1990
2037
|
* chevron prepended. Defaults to the first column in `columns`.
|
|
@@ -2188,6 +2235,20 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
|
|
|
2188
2235
|
* bottom) but neither requires the other. Defaults to false.
|
|
2189
2236
|
*/
|
|
2190
2237
|
showTotals?: boolean;
|
|
2238
|
+
/**
|
|
2239
|
+
* Opt-in: defaults to false. Gives every header a drag handle (and
|
|
2240
|
+
* ArrowLeft/ArrowRight keyboard resize) on its trailing edge, and switches
|
|
2241
|
+
* the table to `table-layout: fixed` so a dragged width is exactly the
|
|
2242
|
+
* rendered width. A column without an explicit `width` stays flexible and
|
|
2243
|
+
* absorbs the leftover space until it is resized itself.
|
|
2244
|
+
*/
|
|
2245
|
+
enableColumnResizing?: boolean;
|
|
2246
|
+
/**
|
|
2247
|
+
* Controlled column widths in px, keyed by column id. Both must be supplied
|
|
2248
|
+
* together to control it — omit both for `<TreeDataGrid>` to own the state.
|
|
2249
|
+
*/
|
|
2250
|
+
columnSizing?: ColumnSizingState;
|
|
2251
|
+
onColumnSizingChange?: (sizing: ColumnSizingState) => void;
|
|
2191
2252
|
/**
|
|
2192
2253
|
* Enables the same built-in inline-editing workflow `<DataGrid>` has:
|
|
2193
2254
|
* any column with `editable` set renders as an interactive editor
|
|
@@ -2216,7 +2277,7 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
|
|
|
2216
2277
|
* column's cell matches `treeColumnId` (defaults to `columns[0]`); every
|
|
2217
2278
|
* other column renders exactly like it would in `<DataGrid>`.
|
|
2218
2279
|
*/
|
|
2219
|
-
declare function TreeDataGrid<TRow>({ columns, data, loading, 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, showTotals, editing, }: TreeDataGridProps<TRow>): ReactElement;
|
|
2280
|
+
declare function TreeDataGrid<TRow>({ columns, data, loading, error, onRetry, statusLabels, 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, showTotals, editing, enableColumnResizing, columnSizing: controlledColumnSizing, onColumnSizingChange, }: TreeDataGridProps<TRow>): ReactElement;
|
|
2220
2281
|
|
|
2221
2282
|
interface FlatTreeRow<TRow> {
|
|
2222
2283
|
row: TRow;
|
|
@@ -2272,4 +2333,4 @@ interface UseTreeStateOptions<TRow> extends TreeAccessors<TRow> {
|
|
|
2272
2333
|
*/
|
|
2273
2334
|
declare function useTreeState<TRow>({ data, getRowId, getChildren, hasChildren, onLoadChildren, expanded: controlledExpanded, onExpandedChange, childrenMap: controlledChildrenMap, onChildrenMapChange, }: UseTreeStateOptions<TRow>): TreeStateController<TRow>;
|
|
2274
2335
|
|
|
2275
|
-
export { ActionsMenu, type BaseColumn, type BooleanColumn, BooleanEditor, BooleanFilter, type CellAddress, type CellChange, type CellEditingCellContext, type CellEditingOptions, type CellEditingState, type CellRange, type CellSelectionController, type CellSelectionOptions, type ClientProcessingResult, type ColumnAlign, type ColumnDef, type ColumnGroup, ColumnSelector, type ColumnSelectorProps, type ColumnVisibility, type CompositeFilterDescriptor, DataGrid, type DataGridProps, type DataSource, type DateColumn, DateEditor, DateRangeFilter, type DebouncedCallback, EditFieldError, type EditWidgetProps, type EditedRow, EditingBar, type EditingBarProps, type EditingCellContext, type EditingOptions, type EditingState, type EnumColumn, EnumEditor, EnumFilter, type EnumOption, type FilterDescriptor, type FilterLabels, FilterLabelsProvider, type FilterOperator, type FilterWidgetProps, type FlatTreeRow, type GridState, type GridStateController, type GroupExpansionController, type MenuItem, type MenuItemContext, MultilineStringEditor, type NavigationDirection, type NormalizedRange, type NumberColumn, NumberComparisonFilter, NumberEditor, NumberHistogramFilter, type NumberHistogramFilterProps, NumberRangeFilter, type PendingRowEdit, type ResolvedMenuItem, SelectionOverlay, type SortDescriptor, type StickyGroupHeaderTop, type StringColumn, StringEditor, StringFilter, type TreeAccessors, TreeDataGrid, type TreeDataGridProps, type TreeStateController, UNARY_OPERATORS, type UseTreeStateOptions, alignClassName, applyColumnOrder, buildIndexMap, canHideColumn, canHideGroup, cellsInRange, coerceValueForColumn, computeFillChanges, countVisible, defaultAlign, defaultFilterLabels, defaultFormat, editErrorId, evaluateFilter, extendRangeForFill, facetedNumberValues, fieldKey, flattenTree, getColumnValue, groupColumns, isCellInRange, isColumnVisible, isCompositeFilterDescriptor, isEditable, isFilterDescriptor, isFilterable, isSortable, mergeFilterLabels, moveColumnBefore, normalizeRange, orderStorageKeyFor, parseTsv, processClientData, rangeToTsv, renderCellModeCell, renderDefaultEditWidget, renderDefaultFilterWidget, renderEditableCell, resolveMenuItems, storageKeyFor, toDate, useCellEditingState, useCellSelection, useDebouncedCallback, useEditingState, useFilterLabels, useGridState, useGroupExpansion, useStickyGroupHeaderTop, useTreeState, useVisibleColumns };
|
|
2336
|
+
export { ActionsMenu, type BaseColumn, type BooleanColumn, BooleanEditor, BooleanFilter, type CellAddress, type CellChange, type CellEditingCellContext, type CellEditingOptions, type CellEditingState, type CellRange, type CellSelectionController, type CellSelectionOptions, type ClientProcessingResult, type ColumnAlign, type ColumnDef, type ColumnGroup, ColumnSelector, type ColumnSelectorProps, type ColumnVisibility, type CompositeFilterDescriptor, DataGrid, type DataGridProps, type DataSource, type DateColumn, DateEditor, DateRangeFilter, type DebouncedCallback, EditFieldError, type EditWidgetProps, type EditedRow, EditingBar, type EditingBarProps, type EditingCellContext, type EditingOptions, type EditingState, type EnumColumn, EnumEditor, EnumFilter, type EnumOption, type ErrorInfo, type ErrorInput, type FilterDescriptor, type FilterLabels, FilterLabelsProvider, type FilterOperator, type FilterWidgetProps, type FlatTreeRow, type GridState, type GridStateController, type GridStatusLabels, type GroupExpansionController, type MenuItem, type MenuItemContext, MultilineStringEditor, type NavigationDirection, type NormalizedRange, type NumberColumn, NumberComparisonFilter, NumberEditor, NumberHistogramFilter, type NumberHistogramFilterProps, NumberRangeFilter, type PendingRowEdit, type ResolvedMenuItem, SelectionOverlay, type SortDescriptor, type StickyGroupHeaderTop, type StringColumn, StringEditor, StringFilter, type TreeAccessors, TreeDataGrid, type TreeDataGridProps, type TreeStateController, UNARY_OPERATORS, type UseTreeStateOptions, alignClassName, applyColumnOrder, buildIndexMap, canHideColumn, canHideGroup, cellsInRange, coerceValueForColumn, computeFillChanges, countVisible, defaultAlign, defaultFilterLabels, defaultFormat, defaultGridStatusLabels, editErrorId, evaluateFilter, extendRangeForFill, facetedNumberValues, fieldKey, flattenTree, getColumnValue, groupColumns, isCellInRange, isColumnVisible, isCompositeFilterDescriptor, isEditable, isFilterDescriptor, isFilterable, isSortable, mergeFilterLabels, moveColumnBefore, normalizeRange, orderStorageKeyFor, parseTsv, processClientData, rangeToTsv, renderCellModeCell, renderDefaultEditWidget, renderDefaultFilterWidget, renderEditableCell, resolveMenuItems, storageKeyFor, toDate, toErrorInfo, useCellEditingState, useCellSelection, useDebouncedCallback, useEditingState, useFilterLabels, useGridState, useGroupExpansion, useStickyGroupHeaderTop, useTreeState, useVisibleColumns };
|