@bmsuisse/datagrid 0.39.0 → 0.41.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 CHANGED
@@ -1687,6 +1687,23 @@ interface DataGridProps<TRow> {
1687
1687
  */
1688
1688
  selectedIds?: ReadonlySet<string>;
1689
1689
  onSelectedIdsChange?: (ids: ReadonlySet<string>) => void;
1690
+ /**
1691
+ * `"multiple"` (default) renders a checkbox per row plus a select-all in the
1692
+ * header. `"single"` renders a radio per row instead, selects exactly one
1693
+ * row (choosing another replaces it; a radio can't be cleared by clicking
1694
+ * it again), and leaves the header cell empty. Setting `"single"` shows the
1695
+ * selection column even when neither `selectedIds` nor `headerActions` is
1696
+ * supplied; the selection itself is still read through `selectedIds` /
1697
+ * `onSelectedIdsChange`, which hold at most one id in this mode.
1698
+ */
1699
+ selectionMode?: "multiple" | "single";
1700
+ /**
1701
+ * Caps the height of the scroll container (px number or any CSS length such
1702
+ * as `"65vh"`) without needing `virtualize` — the header stays sticky while
1703
+ * the rows scroll under it. Ignored when `virtualize` is active, which uses
1704
+ * `virtualize.maxBodyHeight` instead. Omit for a grid that grows with its rows.
1705
+ */
1706
+ maxHeight?: number | string;
1690
1707
  /**
1691
1708
  * Extra props (className, onClick, data-* attributes, etc.) spread onto a
1692
1709
  * row's own `<tr>`. Applied AFTER `<DataGrid>`'s own `data-testid`/
@@ -1838,7 +1855,7 @@ interface DataGridProps<TRow> {
1838
1855
  * (`"server"`). Column filter UI defaults to the type-appropriate widget
1839
1856
  * from `src/filter` unless a column supplies its own `cell` renderer.
1840
1857
  */
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;
1858
+ 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, selectionMode, maxHeight, testId, loading: loadingProp, error, onRetry, statusLabels, groupBy, renderGroupHeader, defaultGroupsExpanded, expandedGroups: controlledExpandedGroups, onExpandedGroupsChange, zebra, showTotals, editing, cellEditing, filterLabels, }: DataGridProps<TRow>): ReactElement;
1842
1859
 
1843
1860
  interface GridStateController {
1844
1861
  state: GridState;
@@ -2235,6 +2252,20 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
2235
2252
  * bottom) but neither requires the other. Defaults to false.
2236
2253
  */
2237
2254
  showTotals?: boolean;
2255
+ /**
2256
+ * Opt-in: defaults to false. Gives every header a drag handle (and
2257
+ * ArrowLeft/ArrowRight keyboard resize) on its trailing edge, and switches
2258
+ * the table to `table-layout: fixed` so a dragged width is exactly the
2259
+ * rendered width. A column without an explicit `width` stays flexible and
2260
+ * absorbs the leftover space until it is resized itself.
2261
+ */
2262
+ enableColumnResizing?: boolean;
2263
+ /**
2264
+ * Controlled column widths in px, keyed by column id. Both must be supplied
2265
+ * together to control it — omit both for `<TreeDataGrid>` to own the state.
2266
+ */
2267
+ columnSizing?: ColumnSizingState;
2268
+ onColumnSizingChange?: (sizing: ColumnSizingState) => void;
2238
2269
  /**
2239
2270
  * Enables the same built-in inline-editing workflow `<DataGrid>` has:
2240
2271
  * any column with `editable` set renders as an interactive editor
@@ -2263,7 +2294,7 @@ interface TreeDataGridProps<TRow> extends TreeAccessors<TRow> {
2263
2294
  * column's cell matches `treeColumnId` (defaults to `columns[0]`); every
2264
2295
  * other column renders exactly like it would in `<DataGrid>`.
2265
2296
  */
2266
- 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, }: TreeDataGridProps<TRow>): ReactElement;
2297
+ 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;
2267
2298
 
2268
2299
  interface FlatTreeRow<TRow> {
2269
2300
  row: TRow;