@ai-matrx/design-system 0.38.1 → 0.39.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/data-table/copy-helpers.d.cts +2 -1
  3. package/dist/data-table/copy-helpers.d.ts +2 -1
  4. package/dist/data-table/filter-engine.d.cts +2 -1
  5. package/dist/data-table/filter-engine.d.ts +2 -1
  6. package/dist/data-table/host.d.cts +2 -1
  7. package/dist/data-table/host.d.ts +2 -1
  8. package/dist/data-table/index.cjs +39 -17
  9. package/dist/data-table/index.cjs.map +1 -1
  10. package/dist/data-table/index.d.cts +26 -3
  11. package/dist/data-table/index.d.ts +26 -3
  12. package/dist/data-table/index.js +39 -17
  13. package/dist/data-table/index.js.map +1 -1
  14. package/dist/data-table/infer-filter.d.cts +2 -1
  15. package/dist/data-table/infer-filter.d.ts +2 -1
  16. package/dist/data-table/layered-filters.d.cts +2 -1
  17. package/dist/data-table/layered-filters.d.ts +2 -1
  18. package/dist/data-table/query-control.d.cts +2 -1
  19. package/dist/data-table/query-control.d.ts +2 -1
  20. package/dist/data-table/table-style.cjs +332 -0
  21. package/dist/data-table/table-style.cjs.map +1 -0
  22. package/dist/data-table/table-style.d.cts +146 -0
  23. package/dist/data-table/table-style.d.ts +146 -0
  24. package/dist/data-table/table-style.js +312 -0
  25. package/dist/data-table/table-style.js.map +1 -0
  26. package/dist/data-table/types.d.cts +2 -1
  27. package/dist/data-table/types.d.ts +2 -1
  28. package/dist/data-table/url-state.d.cts +2 -1
  29. package/dist/data-table/url-state.d.ts +2 -1
  30. package/dist/data-table/xlsx.d.cts +2 -1
  31. package/dist/data-table/xlsx.d.ts +2 -1
  32. package/dist/{types-B8vwElPz.d.ts → types--rz-dVeQ.d.ts} +2 -146
  33. package/dist/{types-BuMHbFjs.d.cts → types-CZmM6ERA.d.cts} +2 -146
  34. package/package.json +11 -1
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { h as MatrxDataTableProps, i as TableViewSnapshot, d as MatrxDataTableRecordControls, j as ColumnMarker, M as MatrxColumnDef } from '../types-BuMHbFjs.cjs';
4
- export { A as AnyOfColumnSearch, B as BOOLEAN_TRUE_COLOR, k as CELL_TINT_CLASS, l as COLOR_RULE_OPS, m as COLOR_RULE_OP_LABELS, n as CellEditType, o as CellEditsMap, p as ChoiceColorLookup, q as ColorBy, r as ColorRule, s as ColorRuleOp, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, E as EMPTY_TABLE_STYLE, t as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, u as MatrxDataTableCoverageConfig, c as MatrxDataTableDensity, v as MatrxDataTableDetailConfig, w as MatrxDataTableEditConfig, x as MatrxDataTableEmptyState, y as MatrxDataTableExpandedDetailConfig, z as MatrxDataTableFacetsConfig, D as MatrxDataTableFilterUi, F as MatrxDataTableGroupingConfig, G as MatrxDataTableHierarchyConfig, H as MatrxDataTableHierarchyMove, I as MatrxDataTableMobileCardControls, J as MatrxDataTableMultiExpandedDetailConfig, K as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, N as MatrxDataTableSelectionConfig, O as MatrxDataTableSingleExpandedDetailConfig, P as MatrxDataTableSourceProcessing, Q as MatrxDataTableSpreadsheetConfig, R as MatrxDataTableStyleConfig, U as MatrxDataTableToolbar, V as MatrxDataTableUrlStateConfig, W as MatrxDataTableVirtualizeConfig, X as MatrxDataTableWindowConfig, Y as MatrxTablePagination, Z as OPS_WITH_VALUE, _ as ROW_TINT_CLASS, $ as STYLE_COLORS, a0 as STYLE_COLOR_LABELS, a1 as SWATCH_CLASS, a2 as SortDirection, S as SortState, a3 as StyleColor, a4 as StylePath, a5 as StyleTarget, a6 as TABLE_STYLE_METADATA_KEY, a7 as TABLE_STYLE_VERSION, a8 as TableRankedSearchOptions, b as TableSavedViewsProps, T as TableSearchMatchMode, a9 as TableSearchRole, aa as TableSearchScope, ab as TableStyle, ac as TableViewQuery, ad as TextFilterMode, ae as ToolbarFacet, af as applyStylePath, ag as colorForChoice, ah as evaluateRule, ai as inferTableSearchRole, aj as isStyleColor, ak as parseTableStyle, al as rankTableSearchRows, am as resolveCellColor, an as resolveRowColor, ao as resolveTableSearchScopes, ap as stylePath, aq as tableStyleFromMetadata, ar as tableStyleIsEmpty } from '../types-BuMHbFjs.cjs';
3
+ import { h as MatrxDataTableProps, i as TableViewSnapshot, d as MatrxDataTableRecordControls, j as ColumnMarker, M as MatrxColumnDef } from '../types-CZmM6ERA.cjs';
4
+ export { A as AnyOfColumnSearch, k as CellEditType, l as CellEditsMap, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, m as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, n as MatrxDataTableCoverageConfig, c as MatrxDataTableDensity, o as MatrxDataTableDetailConfig, p as MatrxDataTableEditConfig, q as MatrxDataTableEmptyState, r as MatrxDataTableExpandedDetailConfig, s as MatrxDataTableFacetsConfig, t as MatrxDataTableFilterUi, u as MatrxDataTableGroupingConfig, v as MatrxDataTableHierarchyConfig, w as MatrxDataTableHierarchyMove, x as MatrxDataTableMobileCardControls, y as MatrxDataTableMultiExpandedDetailConfig, z as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, B as MatrxDataTableSelectionConfig, D as MatrxDataTableSingleExpandedDetailConfig, E as MatrxDataTableSourceProcessing, F as MatrxDataTableSpreadsheetConfig, G as MatrxDataTableStyleConfig, H as MatrxDataTableToolbar, I as MatrxDataTableUrlStateConfig, J as MatrxDataTableVirtualizeConfig, K as MatrxDataTableWindowConfig, N as MatrxTablePagination, O as SortDirection, S as SortState, P as TableRankedSearchOptions, b as TableSavedViewsProps, T as TableSearchMatchMode, Q as TableSearchRole, R as TableSearchScope, U as TableViewQuery, V as TextFilterMode, W as ToolbarFacet, X as inferTableSearchRole, Y as rankTableSearchRows, Z as resolveTableSearchScopes } from '../types-CZmM6ERA.cjs';
5
5
  export { MatrxDataTableHost, MatrxDataTableProvider, MatrxTableRowAlchemy, TableDoors, TableEntityRefProps, TableLinkProps, TablePeekProps, TableSidePanelProps, TableToolbarActionProps, TableWindowPanelProps, useMatrxDataTableHost, useMatrxTableRowAlchemy } from './host.cjs';
6
6
  import { CopyControlProps } from './copy-types.cjs';
7
7
  export { AgentPayloadInput } from './copy-types.cjs';
@@ -15,6 +15,7 @@ export { ResolvedFilterKind, collectSelectOptions, filterKindLabel, resolveFilte
15
15
  export { DateColumnFilterValue, DateFilterBounds, TIME_RANGE_PRESETS, TIME_RANGE_PRESET_VALUES, TimeRangePreset, TimeRangePresetOption, dateFilterBounds } from './date-filter.cjs';
16
16
  export { ScrollPaginationContainer, UseScrollPaginationOptions, UseScrollPaginationResult, useScrollPagination } from './scroll-pagination.cjs';
17
17
  export { tableUrlParamPrefix, useTableUrlState } from './url-state.cjs';
18
+ export { BOOLEAN_TRUE_COLOR, CELL_TINT_CLASS, COLOR_RULE_OPS, COLOR_RULE_OP_LABELS, ChoiceColorLookup, ColorBy, ColorRule, ColorRuleOp, EMPTY_TABLE_STYLE, OPS_WITH_VALUE, ROW_TINT_CLASS, STYLE_COLORS, STYLE_COLOR_LABELS, SWATCH_CLASS, StyleColor, StylePath, StyleTarget, TABLE_STYLE_METADATA_KEY, TABLE_STYLE_VERSION, TableStyle, applyStylePath, colorForChoice, evaluateRule, isStyleColor, parseTableStyle, resolveCellColor, resolveRowColor, stylePath, tableStyleFromMetadata, tableStyleIsEmpty } from './table-style.cjs';
18
19
  import { c as FormatResult } from '../types-CJWU1Gae.cjs';
19
20
  export { EMPTY_GROUP_KEY, GroupAggregateColumn, GroupAggregateKind, GroupAggregateResult, GroupAggregateSpec, GroupOrder, GroupRowsOptions, GroupedRenderRow, TableGroup, coerceGroupNumber, flattenGroups, formatGroupNumber, groupKeyOf, groupRows, groupSummary, isBlankGroupValue, isGroupCollapsed, toggleGroupCollapsed } from './grouping.cjs';
20
21
  export { DEFAULT_OVERSCAN, ScrollToIndexInput, VariableWindowInput, WindowInput, WindowResult, computeVariableWindow, computeWindow, scrollOffsetForIndex } from './virtual-window.cjs';
@@ -202,4 +203,26 @@ declare function resolveFrozenColumns(ids: readonly string[], isFrozen: (id: str
202
203
  /** The numeric pixel width of a declared column width, when there is one. */
203
204
  declare function pixelWidth(width: string | number | undefined): number | undefined;
204
205
 
205
- export { ColumnMarker, FORMAT_MISMATCH_CLASS, FormattedCell, type FrozenColumns, MatrxColumnDef, MatrxDataTable, MatrxDataTableProps, MatrxDataTableRecordControls, MatrxTableRowAlchemyProvider, NO_FROZEN_COLUMNS, type ResolvedColumnMarker, SavedViewsControl, type SavedViewsControlProps, TableTitleRow, type TableTitleRowProps, TableViewSnapshot, type TableViewTab, TableViewTabs, type TableViewTabsProps, alignForFormat, formatColumnValue, parseTableViewSnapshot, pixelWidth, resolveColumnMarker, resolveFrozenColumns };
206
+ interface ToggleSelectionArgs<T> {
207
+ /** The items in the order a person sees them. */
208
+ order: readonly T[];
209
+ /** Their ids, as the selection holds them. */
210
+ idOf: (item: T) => string;
211
+ /** The selection now. */
212
+ selected: ReadonlySet<string>;
213
+ /** The index in `order` that was clicked. */
214
+ index: number;
215
+ /** The index touched last, or null when nothing has been touched since the selection was cleared. */
216
+ anchor: number | null;
217
+ /** Shift held: toggle the whole run between the anchor and `index`. */
218
+ shiftKey: boolean;
219
+ /** Whether an item may be selected at all. Default: every item. */
220
+ isSelectable?: ((item: T) => boolean) | undefined;
221
+ }
222
+ interface ToggleSelectionResult {
223
+ next: Set<string>;
224
+ anchor: number;
225
+ }
226
+ declare function toggleSelection<T>({ order, idOf, selected, index, anchor, shiftKey, isSelectable, }: ToggleSelectionArgs<T>): ToggleSelectionResult;
227
+
228
+ export { ColumnMarker, FORMAT_MISMATCH_CLASS, FormattedCell, type FrozenColumns, MatrxColumnDef, MatrxDataTable, MatrxDataTableProps, MatrxDataTableRecordControls, MatrxTableRowAlchemyProvider, NO_FROZEN_COLUMNS, type ResolvedColumnMarker, SavedViewsControl, type SavedViewsControlProps, TableTitleRow, type TableTitleRowProps, TableViewSnapshot, type TableViewTab, TableViewTabs, type TableViewTabsProps, type ToggleSelectionArgs, type ToggleSelectionResult, alignForFormat, formatColumnValue, parseTableViewSnapshot, pixelWidth, resolveColumnMarker, resolveFrozenColumns, toggleSelection };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { h as MatrxDataTableProps, i as TableViewSnapshot, d as MatrxDataTableRecordControls, j as ColumnMarker, M as MatrxColumnDef } from '../types-B8vwElPz.js';
4
- export { A as AnyOfColumnSearch, B as BOOLEAN_TRUE_COLOR, k as CELL_TINT_CLASS, l as COLOR_RULE_OPS, m as COLOR_RULE_OP_LABELS, n as CellEditType, o as CellEditsMap, p as ChoiceColorLookup, q as ColorBy, r as ColorRule, s as ColorRuleOp, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, E as EMPTY_TABLE_STYLE, t as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, u as MatrxDataTableCoverageConfig, c as MatrxDataTableDensity, v as MatrxDataTableDetailConfig, w as MatrxDataTableEditConfig, x as MatrxDataTableEmptyState, y as MatrxDataTableExpandedDetailConfig, z as MatrxDataTableFacetsConfig, D as MatrxDataTableFilterUi, F as MatrxDataTableGroupingConfig, G as MatrxDataTableHierarchyConfig, H as MatrxDataTableHierarchyMove, I as MatrxDataTableMobileCardControls, J as MatrxDataTableMultiExpandedDetailConfig, K as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, N as MatrxDataTableSelectionConfig, O as MatrxDataTableSingleExpandedDetailConfig, P as MatrxDataTableSourceProcessing, Q as MatrxDataTableSpreadsheetConfig, R as MatrxDataTableStyleConfig, U as MatrxDataTableToolbar, V as MatrxDataTableUrlStateConfig, W as MatrxDataTableVirtualizeConfig, X as MatrxDataTableWindowConfig, Y as MatrxTablePagination, Z as OPS_WITH_VALUE, _ as ROW_TINT_CLASS, $ as STYLE_COLORS, a0 as STYLE_COLOR_LABELS, a1 as SWATCH_CLASS, a2 as SortDirection, S as SortState, a3 as StyleColor, a4 as StylePath, a5 as StyleTarget, a6 as TABLE_STYLE_METADATA_KEY, a7 as TABLE_STYLE_VERSION, a8 as TableRankedSearchOptions, b as TableSavedViewsProps, T as TableSearchMatchMode, a9 as TableSearchRole, aa as TableSearchScope, ab as TableStyle, ac as TableViewQuery, ad as TextFilterMode, ae as ToolbarFacet, af as applyStylePath, ag as colorForChoice, ah as evaluateRule, ai as inferTableSearchRole, aj as isStyleColor, ak as parseTableStyle, al as rankTableSearchRows, am as resolveCellColor, an as resolveRowColor, ao as resolveTableSearchScopes, ap as stylePath, aq as tableStyleFromMetadata, ar as tableStyleIsEmpty } from '../types-B8vwElPz.js';
3
+ import { h as MatrxDataTableProps, i as TableViewSnapshot, d as MatrxDataTableRecordControls, j as ColumnMarker, M as MatrxColumnDef } from '../types--rz-dVeQ.js';
4
+ export { A as AnyOfColumnSearch, k as CellEditType, l as CellEditsMap, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, m as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, n as MatrxDataTableCoverageConfig, c as MatrxDataTableDensity, o as MatrxDataTableDetailConfig, p as MatrxDataTableEditConfig, q as MatrxDataTableEmptyState, r as MatrxDataTableExpandedDetailConfig, s as MatrxDataTableFacetsConfig, t as MatrxDataTableFilterUi, u as MatrxDataTableGroupingConfig, v as MatrxDataTableHierarchyConfig, w as MatrxDataTableHierarchyMove, x as MatrxDataTableMobileCardControls, y as MatrxDataTableMultiExpandedDetailConfig, z as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, B as MatrxDataTableSelectionConfig, D as MatrxDataTableSingleExpandedDetailConfig, E as MatrxDataTableSourceProcessing, F as MatrxDataTableSpreadsheetConfig, G as MatrxDataTableStyleConfig, H as MatrxDataTableToolbar, I as MatrxDataTableUrlStateConfig, J as MatrxDataTableVirtualizeConfig, K as MatrxDataTableWindowConfig, N as MatrxTablePagination, O as SortDirection, S as SortState, P as TableRankedSearchOptions, b as TableSavedViewsProps, T as TableSearchMatchMode, Q as TableSearchRole, R as TableSearchScope, U as TableViewQuery, V as TextFilterMode, W as ToolbarFacet, X as inferTableSearchRole, Y as rankTableSearchRows, Z as resolveTableSearchScopes } from '../types--rz-dVeQ.js';
5
5
  export { MatrxDataTableHost, MatrxDataTableProvider, MatrxTableRowAlchemy, TableDoors, TableEntityRefProps, TableLinkProps, TablePeekProps, TableSidePanelProps, TableToolbarActionProps, TableWindowPanelProps, useMatrxDataTableHost, useMatrxTableRowAlchemy } from './host.js';
6
6
  import { CopyControlProps } from './copy-types.js';
7
7
  export { AgentPayloadInput } from './copy-types.js';
@@ -15,6 +15,7 @@ export { ResolvedFilterKind, collectSelectOptions, filterKindLabel, resolveFilte
15
15
  export { DateColumnFilterValue, DateFilterBounds, TIME_RANGE_PRESETS, TIME_RANGE_PRESET_VALUES, TimeRangePreset, TimeRangePresetOption, dateFilterBounds } from './date-filter.js';
16
16
  export { ScrollPaginationContainer, UseScrollPaginationOptions, UseScrollPaginationResult, useScrollPagination } from './scroll-pagination.js';
17
17
  export { tableUrlParamPrefix, useTableUrlState } from './url-state.js';
18
+ export { BOOLEAN_TRUE_COLOR, CELL_TINT_CLASS, COLOR_RULE_OPS, COLOR_RULE_OP_LABELS, ChoiceColorLookup, ColorBy, ColorRule, ColorRuleOp, EMPTY_TABLE_STYLE, OPS_WITH_VALUE, ROW_TINT_CLASS, STYLE_COLORS, STYLE_COLOR_LABELS, SWATCH_CLASS, StyleColor, StylePath, StyleTarget, TABLE_STYLE_METADATA_KEY, TABLE_STYLE_VERSION, TableStyle, applyStylePath, colorForChoice, evaluateRule, isStyleColor, parseTableStyle, resolveCellColor, resolveRowColor, stylePath, tableStyleFromMetadata, tableStyleIsEmpty } from './table-style.js';
18
19
  import { c as FormatResult } from '../types-CJWU1Gae.js';
19
20
  export { EMPTY_GROUP_KEY, GroupAggregateColumn, GroupAggregateKind, GroupAggregateResult, GroupAggregateSpec, GroupOrder, GroupRowsOptions, GroupedRenderRow, TableGroup, coerceGroupNumber, flattenGroups, formatGroupNumber, groupKeyOf, groupRows, groupSummary, isBlankGroupValue, isGroupCollapsed, toggleGroupCollapsed } from './grouping.js';
20
21
  export { DEFAULT_OVERSCAN, ScrollToIndexInput, VariableWindowInput, WindowInput, WindowResult, computeVariableWindow, computeWindow, scrollOffsetForIndex } from './virtual-window.js';
@@ -202,4 +203,26 @@ declare function resolveFrozenColumns(ids: readonly string[], isFrozen: (id: str
202
203
  /** The numeric pixel width of a declared column width, when there is one. */
203
204
  declare function pixelWidth(width: string | number | undefined): number | undefined;
204
205
 
205
- export { ColumnMarker, FORMAT_MISMATCH_CLASS, FormattedCell, type FrozenColumns, MatrxColumnDef, MatrxDataTable, MatrxDataTableProps, MatrxDataTableRecordControls, MatrxTableRowAlchemyProvider, NO_FROZEN_COLUMNS, type ResolvedColumnMarker, SavedViewsControl, type SavedViewsControlProps, TableTitleRow, type TableTitleRowProps, TableViewSnapshot, type TableViewTab, TableViewTabs, type TableViewTabsProps, alignForFormat, formatColumnValue, parseTableViewSnapshot, pixelWidth, resolveColumnMarker, resolveFrozenColumns };
206
+ interface ToggleSelectionArgs<T> {
207
+ /** The items in the order a person sees them. */
208
+ order: readonly T[];
209
+ /** Their ids, as the selection holds them. */
210
+ idOf: (item: T) => string;
211
+ /** The selection now. */
212
+ selected: ReadonlySet<string>;
213
+ /** The index in `order` that was clicked. */
214
+ index: number;
215
+ /** The index touched last, or null when nothing has been touched since the selection was cleared. */
216
+ anchor: number | null;
217
+ /** Shift held: toggle the whole run between the anchor and `index`. */
218
+ shiftKey: boolean;
219
+ /** Whether an item may be selected at all. Default: every item. */
220
+ isSelectable?: ((item: T) => boolean) | undefined;
221
+ }
222
+ interface ToggleSelectionResult {
223
+ next: Set<string>;
224
+ anchor: number;
225
+ }
226
+ declare function toggleSelection<T>({ order, idOf, selected, index, anchor, shiftKey, isSelectable, }: ToggleSelectionArgs<T>): ToggleSelectionResult;
227
+
228
+ export { ColumnMarker, FORMAT_MISMATCH_CLASS, FormattedCell, type FrozenColumns, MatrxColumnDef, MatrxDataTable, MatrxDataTableProps, MatrxDataTableRecordControls, MatrxTableRowAlchemyProvider, NO_FROZEN_COLUMNS, type ResolvedColumnMarker, SavedViewsControl, type SavedViewsControlProps, TableTitleRow, type TableTitleRowProps, TableViewSnapshot, type TableViewTab, TableViewTabs, type TableViewTabsProps, type ToggleSelectionArgs, type ToggleSelectionResult, alignForFormat, formatColumnValue, parseTableViewSnapshot, pixelWidth, resolveColumnMarker, resolveFrozenColumns, toggleSelection };
@@ -11831,6 +11831,33 @@ function LayeredRuleRow({
11831
11831
  );
11832
11832
  }
11833
11833
 
11834
+ // src/data-table/row-selection.ts
11835
+ function toggleSelection({
11836
+ order,
11837
+ idOf,
11838
+ selected,
11839
+ index,
11840
+ anchor,
11841
+ shiftKey,
11842
+ isSelectable
11843
+ }) {
11844
+ const next = new Set(selected);
11845
+ const clicked = order[index];
11846
+ if (clicked === void 0) return { next, anchor: anchor ?? index };
11847
+ const turningOn = !next.has(idOf(clicked));
11848
+ const from = shiftKey && anchor !== null ? Math.min(anchor, index) : index;
11849
+ const to = shiftKey && anchor !== null ? Math.max(anchor, index) : index;
11850
+ for (let i = from; i <= to; i += 1) {
11851
+ const target = order[i];
11852
+ if (target === void 0) continue;
11853
+ if (!(isSelectable?.(target) ?? true)) continue;
11854
+ const id = idOf(target);
11855
+ if (turningOn) next.add(id);
11856
+ else next.delete(id);
11857
+ }
11858
+ return { next, anchor: index };
11859
+ }
11860
+
11834
11861
  // src/data-table/infer-filter.ts
11835
11862
  var SELECT_CARDINALITY_CAP = 24;
11836
11863
  function resolveFilterKind(col, sampleRows) {
@@ -13893,23 +13920,17 @@ function MatrxDataTableCore({
13893
13920
  const setSelectedIds = (next) => selection?.onSelectedIdsChange([...next]);
13894
13921
  const toggleRowSelected = (index, shiftKey) => {
13895
13922
  if (!selection) return;
13896
- const row = paginated[index];
13897
- if (!row) return;
13898
- const id = getRowId(row);
13899
- const next = new Set(selectedIdSet);
13900
- const turningOn = !next.has(id);
13901
- const anchor = lastToggledIndex.current;
13902
- const from = shiftKey && anchor !== null ? Math.min(anchor, index) : index;
13903
- const to = shiftKey && anchor !== null ? Math.max(anchor, index) : index;
13904
- for (let i = from; i <= to; i += 1) {
13905
- const target = paginated[i];
13906
- if (!target) continue;
13907
- if (!(selection.isRowSelectable?.(target) ?? true)) continue;
13908
- const targetId = getRowId(target);
13909
- if (turningOn) next.add(targetId);
13910
- else next.delete(targetId);
13911
- }
13912
- lastToggledIndex.current = index;
13923
+ if (!paginated[index]) return;
13924
+ const { next, anchor } = toggleSelection({
13925
+ order: paginated,
13926
+ idOf: getRowId,
13927
+ selected: selectedIdSet,
13928
+ index,
13929
+ anchor: lastToggledIndex.current,
13930
+ shiftKey,
13931
+ isSelectable: selection.isRowSelectable
13932
+ });
13933
+ lastToggledIndex.current = anchor;
13913
13934
  setSelectedIds(next);
13914
13935
  };
13915
13936
  const toggleAllOnPage = () => {
@@ -16539,6 +16560,7 @@ export {
16539
16560
  tableUrlParamPrefix,
16540
16561
  tileIndex,
16541
16562
  toggleGroupCollapsed,
16563
+ toggleSelection,
16542
16564
  undoEntryFor,
16543
16565
  useMatrxDataTableHost,
16544
16566
  useMatrxTableRowAlchemy,