@tanstack/table-core 9.0.0-beta.42 → 9.0.0-beta.44

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 (81) hide show
  1. package/dist/core/rows/constructRow.cjs +1 -0
  2. package/dist/core/rows/constructRow.cjs.map +1 -1
  3. package/dist/core/rows/constructRow.js +1 -0
  4. package/dist/core/rows/constructRow.js.map +1 -1
  5. package/dist/core/rows/coreRowsFeature.cjs +9 -0
  6. package/dist/core/rows/coreRowsFeature.cjs.map +1 -1
  7. package/dist/core/rows/coreRowsFeature.js +10 -1
  8. package/dist/core/rows/coreRowsFeature.js.map +1 -1
  9. package/dist/core/rows/coreRowsFeature.types.d.cts +24 -0
  10. package/dist/core/rows/coreRowsFeature.types.d.ts +24 -0
  11. package/dist/core/rows/coreRowsFeature.utils.cjs +34 -0
  12. package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
  13. package/dist/core/rows/coreRowsFeature.utils.d.cts +15 -1
  14. package/dist/core/rows/coreRowsFeature.utils.d.ts +15 -1
  15. package/dist/core/rows/coreRowsFeature.utils.js +33 -1
  16. package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
  17. package/dist/core/table/constructTable.cjs +1 -0
  18. package/dist/core/table/constructTable.cjs.map +1 -1
  19. package/dist/core/table/constructTable.js +1 -0
  20. package/dist/core/table/constructTable.js.map +1 -1
  21. package/dist/core/table/coreTablesFeature.types.d.cts +2 -1
  22. package/dist/core/table/coreTablesFeature.types.d.ts +2 -1
  23. package/dist/core/table/coreTablesFeature.utils.cjs +4 -1
  24. package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
  25. package/dist/core/table/coreTablesFeature.utils.d.cts +2 -1
  26. package/dist/core/table/coreTablesFeature.utils.d.ts +2 -1
  27. package/dist/core/table/coreTablesFeature.utils.js +4 -1
  28. package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
  29. package/dist/features/row-selection/rowSelectionFeature.cjs +13 -2
  30. package/dist/features/row-selection/rowSelectionFeature.cjs.map +1 -1
  31. package/dist/features/row-selection/rowSelectionFeature.js +13 -2
  32. package/dist/features/row-selection/rowSelectionFeature.js.map +1 -1
  33. package/dist/features/row-selection/rowSelectionFeature.types.d.cts +35 -5
  34. package/dist/features/row-selection/rowSelectionFeature.types.d.ts +35 -5
  35. package/dist/features/row-selection/rowSelectionFeature.utils.cjs +50 -3
  36. package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
  37. package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +8 -6
  38. package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +8 -6
  39. package/dist/features/row-selection/rowSelectionFeature.utils.js +50 -3
  40. package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
  41. package/dist/index.d.cts +2 -2
  42. package/dist/index.d.ts +2 -2
  43. package/dist/static-functions.cjs +2 -0
  44. package/dist/static-functions.d.cts +2 -2
  45. package/dist/static-functions.d.ts +2 -2
  46. package/dist/static-functions.js +2 -2
  47. package/dist/types/TableFeatures.d.cts +22 -2
  48. package/dist/types/TableFeatures.d.ts +22 -2
  49. package/package.json +1 -1
  50. package/skills/api-not-found/SKILL.md +1 -1
  51. package/skills/client-vs-server/SKILL.md +1 -1
  52. package/skills/column-faceting/SKILL.md +1 -1
  53. package/skills/column-filtering/SKILL.md +1 -1
  54. package/skills/column-ordering/SKILL.md +1 -1
  55. package/skills/column-pinning/SKILL.md +1 -1
  56. package/skills/column-resizing/SKILL.md +1 -1
  57. package/skills/column-sizing/SKILL.md +1 -1
  58. package/skills/column-visibility/SKILL.md +1 -1
  59. package/skills/core/SKILL.md +37 -2
  60. package/skills/custom-features/SKILL.md +30 -2
  61. package/skills/expanding/SKILL.md +1 -1
  62. package/skills/global-filtering/SKILL.md +1 -1
  63. package/skills/grouping/SKILL.md +1 -1
  64. package/skills/migrate-v8-to-v9/SKILL.md +1 -1
  65. package/skills/pagination/SKILL.md +1 -1
  66. package/skills/row-pinning/SKILL.md +1 -1
  67. package/skills/row-selection/SKILL.md +91 -3
  68. package/skills/sorting/SKILL.md +1 -1
  69. package/skills/table-features/SKILL.md +1 -1
  70. package/skills/typescript/SKILL.md +1 -1
  71. package/src/core/rows/constructRow.ts +1 -0
  72. package/src/core/rows/coreRowsFeature.ts +15 -0
  73. package/src/core/rows/coreRowsFeature.types.ts +24 -0
  74. package/src/core/rows/coreRowsFeature.utils.ts +58 -0
  75. package/src/core/table/constructTable.ts +4 -0
  76. package/src/core/table/coreTablesFeature.types.ts +2 -1
  77. package/src/core/table/coreTablesFeature.utils.ts +7 -1
  78. package/src/features/row-selection/rowSelectionFeature.ts +19 -1
  79. package/src/features/row-selection/rowSelectionFeature.types.ts +37 -3
  80. package/src/features/row-selection/rowSelectionFeature.utils.ts +114 -14
  81. package/src/types/TableFeatures.ts +32 -2
@@ -1 +1 @@
1
- {"version":3,"file":"rowSelectionFeature.utils.cjs","names":["makeObjectMap","cloneState","callMemoOrStaticFn","hasOwn"],"sources":["../../../src/features/row-selection/rowSelectionFeature.utils.ts"],"sourcesContent":["import {\n callMemoOrStaticFn,\n cloneState,\n copyInstancePropertiesWithoutMemos,\n hasOwn,\n makeObjectMap,\n} from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { RowSelectionState } from './rowSelectionFeature.types'\n\n// State APIs\n\n/**\n * Creates the default row selection state.\n *\n * The feature default is an empty map, meaning no rows are selected. Reset APIs\n * use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const selection = getDefaultRowSelectionState()\n * ```\n */\nexport function getDefaultRowSelectionState(): RowSelectionState {\n return makeObjectMap()\n}\n\n/**\n * Routes a row selection updater through the table's selection change handler.\n *\n * The updater may be a next selection map or a function of the previous map,\n * matching the instance `table.setRowSelection` behavior.\n *\n * @example\n * ```ts\n * table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))\n * ```\n */\nexport function table_setRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowSelectionState>,\n) {\n table.options.onRowSelectionChange?.(updater)\n}\n\n/**\n * Resets `rowSelection` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.rowSelection` when it\n * exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetRowSelection(table)\n * table_resetRowSelection(table, true)\n * ```\n */\nexport function table_resetRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setRowSelection(\n table,\n defaultState\n ? makeObjectMap()\n : Object.assign(\n makeObjectMap<true>(),\n cloneState(table.initialState.rowSelection ?? {}),\n ),\n )\n}\n\n// Table APIs\n\n/**\n * Selects or deselects every selectable row before grouping.\n *\n * Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.\n * Deselecting removes matching ids from the existing selection map.\n *\n * @example\n * ```ts\n * table_toggleAllRowsSelected(table)\n * ```\n */\nexport function table_toggleAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n value?: boolean,\n opts?: { deselectAll?: boolean },\n) {\n table_setRowSelection(table, (old) => {\n value =\n typeof value !== 'undefined'\n ? value\n : !callMemoOrStaticFn(\n table,\n 'getIsAllRowsSelected',\n table_getIsAllRowsSelected,\n )\n\n if (opts?.deselectAll && !value) {\n // deselectAll opt: clear the whole selection map instead of deleting ids one-by-one\n return makeObjectMap<true>()\n }\n\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach((row) => {\n if (row_getCanSelect(row)) {\n rowSelection[row.id] = true\n }\n })\n } else {\n preGroupedFlatRows.forEach((row) => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n}\n\n/**\n * Selects or deselects every selectable row on the current page.\n *\n * Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.\n * Child rows are included when sub-row selection allows it.\n *\n * @example\n * ```ts\n * table_toggleAllPageRowsSelected(table)\n * ```\n */\nexport function table_toggleAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n value?: boolean,\n opts?: { deselectAll?: boolean },\n) {\n table_setRowSelection(table, (old) => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !callMemoOrStaticFn(\n table,\n 'getIsAllPageRowsSelected',\n table_getIsAllPageRowsSelected,\n )\n\n if (opts?.deselectAll && !resolvedValue) {\n // deselectAll opt: clear the whole selection map instead of deleting ids one-by-one\n return makeObjectMap<true>()\n }\n\n const rowSelection: RowSelectionState = Object.assign(\n makeObjectMap<true>(),\n old,\n )\n\n table.getRowModel().rows.forEach((row) => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n}\n\n/**\n * Reads the row model before row selection is projected into selected rows.\n *\n * Selection does not alter the base row pipeline, so this returns the core row\n * model.\n *\n * @example\n * ```ts\n * const rowsBeforeSelection = table_getPreSelectedRowModel(table)\n * ```\n */\nexport function table_getPreSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getCoreRowModel()\n}\n\n/**\n * Builds a row model containing selected rows from the core row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getSelectedRowModel(table)\n * ```\n */\nexport function table_getSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Builds a row model containing selected rows from the filtered row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getFilteredSelectedRowModel(table)\n * ```\n */\nexport function table_getFilteredSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getFilteredRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Builds a row model containing selected rows from the grouped row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getGroupedSelectedRowModel(table)\n * ```\n */\nexport function table_getGroupedSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n // The sorted model falls back grouped -> filtered -> core when those\n // features are not registered, so selected group rows are always visible.\n const rowModel = table.getSortedRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Returns the ids of all selected rows.\n *\n * @example\n * ```ts\n * const selectedRowIds = table_getSelectedRowIds(table)\n * ```\n */\nexport function table_getSelectedRowIds<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<string> {\n return Object.keys(table.atoms.rowSelection?.get() ?? {})\n}\n\n/**\n * Checks whether every selectable filtered row is selected.\n *\n * The result is false when there are no filtered rows or when selection state is\n * empty.\n *\n * @example\n * ```ts\n * const allSelected = table_getIsAllRowsSelected(table)\n * ```\n */\nexport function table_getIsAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length,\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n (row) => row_getCanSelect(row) && !isRowSelected(row, rowSelection),\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n}\n\n/**\n * Checks whether every selectable row on the current page is selected.\n *\n * Non-selectable rows are ignored for this calculation.\n *\n * @example\n * ```ts\n * const allPageRowsSelected = table_getIsAllPageRowsSelected(table)\n * ```\n */\nexport function table_getIsAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some((row) => !isRowSelected(row, rowSelection))\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n}\n\n/**\n * Checks whether selection is partially applied across filtered rows.\n *\n * The result is true when at least one row id is selected\n *\n * @example\n * ```ts\n * const someRowsSelected = table_getIsSomeRowsSelected(table)\n * ```\n */\nexport function table_getIsSomeRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(table, 'getSelectedRowIds', table_getSelectedRowIds)\n .length > 0\n )\n}\n\n/**\n * Checks whether the current page has a partial selection.\n *\n * @example\n * ```ts\n * const somePageRowsSelected = table_getIsSomePageRowsSelected(table)\n * ```\n */\nexport function table_getIsSomePageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n .some(\n (row) =>\n row_getIsSelected(row) ||\n callMemoOrStaticFn(row, 'getIsSomeSelected', row_getIsSomeSelected),\n )\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects all rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects current page rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all page rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllPageRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllPageRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllPageRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n// Row APIs\n\n/**\n * Selects or deselects this row.\n *\n * Omitting `value` toggles the row. Child rows are selected recursively unless\n * `opts.selectChildren` is `false` or sub-row selection is disabled.\n *\n * @example\n * ```ts\n * row_toggleSelected(row)\n * row_toggleSelected(row, true)\n * row_toggleSelected(row, false)\n * row_toggleSelected(row, true, { selectChildren: false })\n * row_toggleSelected(row, false, { selectChildren: false })\n * ```\n */\nexport function row_toggleSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n row: Row<TFeatures, TData>,\n value?: boolean,\n opts?: {\n selectChildren?: boolean\n },\n) {\n const isSelected = row_getIsSelected(row)\n\n table_setRowSelection(row.table, (old) => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n\n mutateRowIsSelected(\n rowSelection,\n row.id,\n value,\n opts?.selectChildren ?? true,\n row.table,\n )\n\n return rowSelection\n })\n}\n\n/**\n * Checks whether this row id is selected in `state.rowSelection`.\n *\n * Missing row ids are treated as not selected.\n *\n * @example\n * ```ts\n * const selected = row_getIsSelected(row)\n * ```\n */\nexport function row_getIsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const rowSelection = row.table.atoms.rowSelection?.get() ?? {}\n return isRowSelected(row, rowSelection)\n}\n\n/**\n * Checks whether some, but not all, selectable descendants are selected.\n *\n * This supports indeterminate selection UI for parent rows.\n *\n * @example\n * ```ts\n * const partial = row_getIsSomeSelected(row)\n * ```\n */\nexport function row_getIsSomeSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'some'\n}\n\n/**\n * Checks whether all selectable descendants are selected.\n *\n * Rows without selectable descendants return false.\n *\n * @example\n * ```ts\n * const allChildrenSelected = row_getIsAllSubRowsSelected(row)\n * ```\n */\nexport function row_getIsAllSubRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'all'\n}\n\n/**\n * Checks whether this row can be selected.\n *\n * `options.enableRowSelection` may be a boolean or a row predicate; it defaults\n * to `true`.\n *\n * @example\n * ```ts\n * const canSelect = row_getCanSelect(row)\n * ```\n */\nexport function row_getCanSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableRowSelection === 'function') {\n return options.enableRowSelection(row)\n }\n\n return options.enableRowSelection ?? true\n}\n\n/**\n * Checks whether selecting this row should also select its subRows.\n *\n * `options.enableSubRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canSelectChildren = row_getCanSelectSubRows(row)\n * ```\n */\nexport function row_getCanSelectSubRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableSubRowSelection === 'function') {\n return options.enableSubRowSelection(row)\n }\n\n return options.enableSubRowSelection ?? true\n}\n\n/**\n * Checks whether this row can be selected alongside other rows.\n *\n * `options.enableMultiRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canMultiSelect = row_getCanMultiSelect(row)\n * ```\n */\nexport function row_getCanMultiSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableMultiRowSelection === 'function') {\n return options.enableMultiRowSelection(row)\n }\n\n return options.enableMultiRowSelection ?? true\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects this row.\n *\n * The handler is a no-op when the row cannot be selected and reads\n * `event.target.checked`.\n *\n * @example\n * ```ts\n * const onChange = row_getToggleSelectedHandler(row)\n * ```\n */\nexport function row_getToggleSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const canSelect = row_getCanSelect(row)\n\n return (e: unknown) => {\n if (!canSelect) return\n row_toggleSelected(\n row,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\nconst mutateRowIsSelected = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowSelection: RowSelectionState,\n rowId: string,\n value: boolean,\n includeChildren: boolean,\n table: Table_Internal<TFeatures, TData>,\n): void => {\n const row = table.getRow(rowId, true)\n\n if (value) {\n if (!row_getCanMultiSelect(row)) {\n Object.keys(rowSelection).forEach((key) => delete rowSelection[key])\n }\n if (row_getCanSelect(row)) {\n rowSelection[rowId] = true\n }\n } else {\n delete rowSelection[rowId]\n }\n\n if (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) {\n row.subRows.forEach((r) =>\n mutateRowIsSelected(rowSelection, r.id, value, includeChildren, table),\n )\n }\n}\n\n/**\n * Builds a row model containing rows selected by the current row selection state.\n *\n * The result is derived from the supplied row model, so selected ids absent from\n * that model are not materialized as rows.\n *\n * @example\n * ```ts\n * const selectedRows = selectRowsFn(rowModel)\n * ```\n */\nexport function selectRowsFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowModel: RowModel<TFeatures, TData>,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const newSelectedFlatRows: Array<Row<TFeatures, TData>> = []\n const newSelectedRowsById = makeObjectMap<Row<TFeatures, TData>>()\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n // Filters top level and nested rows.\n const recurseRows = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n ): Array<Row<TFeatures, TData>> => {\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i]!\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows.length) {\n // Always recurse — selected descendants of unselected parents must\n // still be collected into flatRows/rowsById.\n const newSubRows = recurseRows(row.subRows, depth + 1)\n\n if (isSelected) {\n // Preserve prototype chain so methods like getValue() remain accessible\n const cloned = Object.create(Object.getPrototypeOf(row))\n copyInstancePropertiesWithoutMemos(cloned, row)\n cloned.subRows = newSubRows\n result.push(cloned)\n }\n } else if (isSelected) {\n result.push(row)\n }\n }\n return result\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\n/**\n * Returns whether a row id is selected in the current row selection state.\n *\n * @example\n * ```ts\n * const selected = isRowSelected(row)\n * ```\n */\nexport function isRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, rowSelection: RowSelectionState): boolean {\n return !!(hasOwn(rowSelection, row.id) && rowSelection[row.id])\n}\n\n/**\n * Returns whether all, some, or none of a row's selectable descendants are selected.\n *\n * The result is used to drive indeterminate row selection UI.\n *\n * @example\n * ```ts\n * const selectedState = isSubRowSelected(row)\n * ```\n */\nexport function isSubRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean | 'some' | 'all' {\n if (!row.subRows.length) return false\n\n const rowSelection = row.table.atoms.rowSelection?.get() ?? {}\n\n let someSelected = false\n let allChildrenSelected = true\n\n for (let i = 0; i < row.subRows.length; i++) {\n const subRow = row.subRows[i]!\n\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n break\n }\n\n if (row_getCanSelect(subRow)) {\n if (isRowSelected(subRow, rowSelection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n }\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"mappings":";;;;;;;;;;;;;;AA2BA,SAAgB,8BAAiD;CAC/D,OAAOA,4BAAc;AACvB;;;;;;;;;;;;AAaA,SAAgB,sBAId,OACA,SACA;CACA,MAAM,QAAQ,uBAAuB,OAAO;AAC9C;;;;;;;;;;;;;AAcA,SAAgB,wBAGd,OAAyC,cAAwB;CACjE,sBACE,OACA,eACIA,4BAAc,IACd,OAAO,OACLA,4BAAoB,GACpBC,yBAAW,MAAM,aAAa,gBAAgB,CAAC,CAAC,CAClD,CACN;AACF;;;;;;;;;;;;AA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}
1
+ {"version":3,"file":"rowSelectionFeature.utils.cjs","names":["makeObjectMap","cloneState","callMemoOrStaticFn","hasOwn"],"sources":["../../../src/features/row-selection/rowSelectionFeature.utils.ts"],"sourcesContent":["import {\n callMemoOrStaticFn,\n cloneState,\n copyInstancePropertiesWithoutMemos,\n hasOwn,\n makeObjectMap,\n} from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type {\n RowSelectionState,\n ToggleSelectedOptions,\n} from './rowSelectionFeature.types'\n\n// State APIs\n\n/**\n * Creates the default row selection state.\n *\n * The feature default is an empty map, meaning no rows are selected. Reset APIs\n * use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const selection = getDefaultRowSelectionState()\n * ```\n */\nexport function getDefaultRowSelectionState(): RowSelectionState {\n return makeObjectMap()\n}\n\n/**\n * Routes a row selection updater through the table's selection change handler.\n *\n * The updater may be a next selection map or a function of the previous map,\n * matching the instance `table.setRowSelection` behavior.\n *\n * @example\n * ```ts\n * table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))\n * ```\n */\nexport function table_setRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowSelectionState>,\n) {\n table.options.onRowSelectionChange?.(updater)\n}\n\n/**\n * Resets `rowSelection` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.rowSelection` when it\n * exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetRowSelection(table)\n * table_resetRowSelection(table, true)\n * ```\n */\nexport function table_resetRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n table._lastSelectedRowId = null\n table_setRowSelection(\n table,\n defaultState\n ? makeObjectMap()\n : Object.assign(\n makeObjectMap<true>(),\n cloneState(table.initialState.rowSelection ?? {}),\n ),\n )\n}\n\n// Table APIs\n\n/**\n * Selects or deselects every selectable row before grouping.\n *\n * Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.\n * Deselecting removes matching ids from the existing selection map.\n *\n * @example\n * ```ts\n * table_toggleAllRowsSelected(table)\n * ```\n */\nexport function table_toggleAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n value?: boolean,\n opts?: { deselectAll?: boolean },\n) {\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n table._lastSelectedRowId = null\n table_setRowSelection(table, (old) => {\n value =\n typeof value !== 'undefined'\n ? value\n : !callMemoOrStaticFn(\n table,\n 'getIsAllRowsSelected',\n table_getIsAllRowsSelected,\n )\n\n if (opts?.deselectAll && !value) {\n // deselectAll opt: clear the whole selection map instead of deleting ids one-by-one\n return makeObjectMap<true>()\n }\n\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach((row) => {\n if (row_getCanSelect(row)) {\n rowSelection[row.id] = true\n }\n })\n } else {\n preGroupedFlatRows.forEach((row) => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n}\n\n/**\n * Selects or deselects every selectable row on the current page.\n *\n * Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.\n * Child rows are included when sub-row selection allows it.\n *\n * @example\n * ```ts\n * table_toggleAllPageRowsSelected(table)\n * ```\n */\nexport function table_toggleAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n value?: boolean,\n opts?: { deselectAll?: boolean },\n) {\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n table._lastSelectedRowId = null\n table_setRowSelection(table, (old) => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !callMemoOrStaticFn(\n table,\n 'getIsAllPageRowsSelected',\n table_getIsAllPageRowsSelected,\n )\n\n if (opts?.deselectAll && !resolvedValue) {\n // deselectAll opt: clear the whole selection map instead of deleting ids one-by-one\n return makeObjectMap<true>()\n }\n\n const rowSelection: RowSelectionState = Object.assign(\n makeObjectMap<true>(),\n old,\n )\n\n table.getRowModel().rows.forEach((row) => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n}\n\n/**\n * Reads the row model before row selection is projected into selected rows.\n *\n * Selection does not alter the base row pipeline, so this returns the core row\n * model.\n *\n * @example\n * ```ts\n * const rowsBeforeSelection = table_getPreSelectedRowModel(table)\n * ```\n */\nexport function table_getPreSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getCoreRowModel()\n}\n\n/**\n * Builds a row model containing selected rows from the core row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getSelectedRowModel(table)\n * ```\n */\nexport function table_getSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Builds a row model containing selected rows from the filtered row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getFilteredSelectedRowModel(table)\n * ```\n */\nexport function table_getFilteredSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getFilteredRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Builds a row model containing selected rows from the grouped row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getGroupedSelectedRowModel(table)\n * ```\n */\nexport function table_getGroupedSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n // The sorted model falls back grouped -> filtered -> core when those\n // features are not registered, so selected group rows are always visible.\n const rowModel = table.getSortedRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Returns the ids of all selected rows.\n *\n * @example\n * ```ts\n * const selectedRowIds = table_getSelectedRowIds(table)\n * ```\n */\nexport function table_getSelectedRowIds<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<string> {\n return Object.keys(table.atoms.rowSelection?.get() ?? {})\n}\n\n/**\n * Checks whether every selectable filtered row is selected.\n *\n * The result is false when there are no filtered rows or when selection state is\n * empty.\n *\n * @example\n * ```ts\n * const allSelected = table_getIsAllRowsSelected(table)\n * ```\n */\nexport function table_getIsAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length,\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n (row) => row_getCanSelect(row) && !isRowSelected(row, rowSelection),\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n}\n\n/**\n * Checks whether every selectable row on the current page is selected.\n *\n * Non-selectable rows are ignored for this calculation.\n *\n * @example\n * ```ts\n * const allPageRowsSelected = table_getIsAllPageRowsSelected(table)\n * ```\n */\nexport function table_getIsAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some((row) => !isRowSelected(row, rowSelection))\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n}\n\n/**\n * Checks whether selection is partially applied across filtered rows.\n *\n * The result is true when at least one row id is selected\n *\n * @example\n * ```ts\n * const someRowsSelected = table_getIsSomeRowsSelected(table)\n * ```\n */\nexport function table_getIsSomeRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(table, 'getSelectedRowIds', table_getSelectedRowIds)\n .length > 0\n )\n}\n\n/**\n * Checks whether the current page has a partial selection.\n *\n * @example\n * ```ts\n * const somePageRowsSelected = table_getIsSomePageRowsSelected(table)\n * ```\n */\nexport function table_getIsSomePageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n .some(\n (row) =>\n row_getIsSelected(row) ||\n callMemoOrStaticFn(row, 'getIsSomeSelected', row_getIsSomeSelected),\n )\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects all rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects current page rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all page rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllPageRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllPageRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllPageRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n// Row APIs\n\n/**\n * Selects or deselects this row.\n *\n * Omitting `value` toggles the row. Child rows are selected recursively unless\n * `opts.selectChildren` is `false` or sub-row selection is disabled.\n *\n * @example\n * ```ts\n * row_toggleSelected(row)\n * row_toggleSelected(row, true)\n * row_toggleSelected(row, false)\n * row_toggleSelected(row, true, { selectChildren: false })\n * row_toggleSelected(row, false, { selectChildren: false })\n * ```\n */\nexport function row_toggleSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, value?: boolean, opts?: ToggleSelectedOptions) {\n const isSelected = row_getIsSelected(row)\n\n table_setRowSelection(row.table, (old) => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n\n mutateRowIsSelected(\n rowSelection,\n row.id,\n value,\n opts?.selectChildren ?? true,\n row.table,\n )\n\n return rowSelection\n })\n}\n\n/**\n * Checks whether this row id is selected in `state.rowSelection`.\n *\n * Missing row ids are treated as not selected.\n *\n * @example\n * ```ts\n * const selected = row_getIsSelected(row)\n * ```\n */\nexport function row_getIsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const rowSelection = row.table.atoms.rowSelection?.get() ?? {}\n return isRowSelected(row, rowSelection)\n}\n\n/**\n * Checks whether some, but not all, selectable descendants are selected.\n *\n * This supports indeterminate selection UI for parent rows.\n *\n * @example\n * ```ts\n * const partial = row_getIsSomeSelected(row)\n * ```\n */\nexport function row_getIsSomeSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'some'\n}\n\n/**\n * Checks whether all selectable descendants are selected.\n *\n * Rows without selectable descendants return false.\n *\n * @example\n * ```ts\n * const allChildrenSelected = row_getIsAllSubRowsSelected(row)\n * ```\n */\nexport function row_getIsAllSubRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'all'\n}\n\n/**\n * Checks whether this row can be selected.\n *\n * `options.enableRowSelection` may be a boolean or a row predicate; it defaults\n * to `true`.\n *\n * @example\n * ```ts\n * const canSelect = row_getCanSelect(row)\n * ```\n */\nexport function row_getCanSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableRowSelection === 'function') {\n return options.enableRowSelection(row)\n }\n\n return options.enableRowSelection ?? true\n}\n\n/**\n * Checks whether selecting this row should also select its subRows.\n *\n * `options.enableSubRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canSelectChildren = row_getCanSelectSubRows(row)\n * ```\n */\nexport function row_getCanSelectSubRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableSubRowSelection === 'function') {\n return options.enableSubRowSelection(row)\n }\n\n return options.enableSubRowSelection ?? true\n}\n\n/**\n * Checks whether this row can be selected alongside other rows.\n *\n * `options.enableMultiRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canMultiSelect = row_getCanMultiSelect(row)\n * ```\n */\nexport function row_getCanMultiSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableMultiRowSelection === 'function') {\n return options.enableMultiRowSelection(row)\n }\n\n return options.enableMultiRowSelection ?? true\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects this row.\n *\n * The handler is a no-op when the row cannot be selected and reads\n * `event.target.checked`. Shift events select or deselect the inclusive range\n * from the most recent selectable row handled by this table. The event's\n * optional `persist()` method is called before it is read. Pass\n * `selectChildren: false` to limit changes to rows explicitly present in the\n * display-order interval.\n *\n * @example\n * ```ts\n * const onChange = row_getToggleSelectedHandler(row)\n * ```\n */\nexport function row_getToggleSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, opts?: ToggleSelectedOptions) {\n const canSelect = row_getCanSelect(row)\n\n return (e: unknown) => {\n if (!canSelect) return\n\n const event = e as {\n persist?: () => void\n target: { checked: boolean }\n }\n event.persist?.()\n\n const table = row.table\n const checked = event.target.checked\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n const anchorId = table._lastSelectedRowId\n const canSelectRange =\n table.options.enableRowRangeSelection !== false &&\n anchorId !== null &&\n row_getCanMultiSelect(row) &&\n (table.options.isRowRangeSelectionEvent?.(e) ?? false)\n\n if (\n !canSelectRange ||\n !selectRowRange(row, anchorId, checked, opts?.selectChildren ?? true)\n ) {\n row_toggleSelected(row, checked, opts)\n }\n\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n table._lastSelectedRowId = row.id\n }\n}\n\n/**\n * Resolves and mutates an inclusive interval in the table's latest logical\n * display order.\n *\n * The anchor is resolved without throwing from the pre-pagination row model,\n * then the core row model. Both endpoint display indexes must still identify\n * those rows in the current order and both endpoints must support\n * multi-selection. Eligible interval rows are applied through one row\n * selection updater; non-selectable and non-multi-selectable rows are skipped.\n * Returns `false` when the interaction should fall back to an ordinary toggle.\n */\nfunction selectRowRange<TFeatures extends TableFeatures, TData extends RowData>(\n row: Row<TFeatures, TData>,\n anchorId: string,\n value: boolean,\n includeChildren: boolean,\n): boolean {\n const table = row.table\n const rows = table.getRowsInDisplayOrder()\n const anchorRow =\n table.getPrePaginatedRowModel().rowsById[anchorId] ??\n table.getCoreRowModel().rowsById[anchorId]\n\n if (!anchorRow) {\n return false\n }\n\n const anchorIndex = anchorRow.getDisplayIndex()\n const rowIndex = row.getDisplayIndex()\n const anchorAtIndex = rows[anchorIndex]\n const rowAtIndex = rows[rowIndex]\n\n if (\n anchorIndex < 0 ||\n rowIndex < 0 ||\n anchorIndex >= rows.length ||\n rowIndex >= rows.length ||\n anchorAtIndex?.id !== anchorRow.id ||\n rowAtIndex?.id !== row.id ||\n !row_getCanMultiSelect(anchorRow) ||\n !row_getCanMultiSelect(row)\n ) {\n return false\n }\n\n const start = Math.min(anchorIndex, rowIndex)\n const end = Math.max(anchorIndex, rowIndex)\n\n table_setRowSelection(table, (old) => {\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n\n for (let index = start; index <= end; index++) {\n const rangeRow = rows[index]!\n if (!row_getCanSelect(rangeRow) || !row_getCanMultiSelect(rangeRow)) {\n continue\n }\n mutateRowIsSelected(\n rowSelection,\n rangeRow.id,\n value,\n includeChildren,\n table,\n )\n }\n\n return rowSelection\n })\n\n return true\n}\n\nconst mutateRowIsSelected = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowSelection: RowSelectionState,\n rowId: string,\n value: boolean,\n includeChildren: boolean,\n table: Table_Internal<TFeatures, TData>,\n): void => {\n const row = table.getRow(rowId, true)\n\n if (value) {\n if (!row_getCanMultiSelect(row)) {\n Object.keys(rowSelection).forEach((key) => delete rowSelection[key])\n }\n if (row_getCanSelect(row)) {\n rowSelection[rowId] = true\n }\n } else {\n delete rowSelection[rowId]\n }\n\n if (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) {\n row.subRows.forEach((r) =>\n mutateRowIsSelected(rowSelection, r.id, value, includeChildren, table),\n )\n }\n}\n\n/**\n * Builds a row model containing rows selected by the current row selection state.\n *\n * The result is derived from the supplied row model, so selected ids absent from\n * that model are not materialized as rows.\n *\n * @example\n * ```ts\n * const selectedRows = selectRowsFn(rowModel)\n * ```\n */\nexport function selectRowsFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowModel: RowModel<TFeatures, TData>,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const newSelectedFlatRows: Array<Row<TFeatures, TData>> = []\n const newSelectedRowsById = makeObjectMap<Row<TFeatures, TData>>()\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n // Filters top level and nested rows.\n const recurseRows = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n ): Array<Row<TFeatures, TData>> => {\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i]!\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows.length) {\n // Always recurse — selected descendants of unselected parents must\n // still be collected into flatRows/rowsById.\n const newSubRows = recurseRows(row.subRows, depth + 1)\n\n if (isSelected) {\n // Preserve prototype chain so methods like getValue() remain accessible\n const cloned = Object.create(Object.getPrototypeOf(row))\n copyInstancePropertiesWithoutMemos(cloned, row)\n cloned.subRows = newSubRows\n result.push(cloned)\n }\n } else if (isSelected) {\n result.push(row)\n }\n }\n return result\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\n/**\n * Returns whether a row id is selected in the current row selection state.\n *\n * @example\n * ```ts\n * const selected = isRowSelected(row)\n * ```\n */\nexport function isRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, rowSelection: RowSelectionState): boolean {\n return !!(hasOwn(rowSelection, row.id) && rowSelection[row.id])\n}\n\n/**\n * Returns whether all, some, or none of a row's selectable descendants are selected.\n *\n * The result is used to drive indeterminate row selection UI.\n *\n * @example\n * ```ts\n * const selectedState = isSubRowSelected(row)\n * ```\n */\nexport function isSubRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean | 'some' | 'all' {\n if (!row.subRows.length) return false\n\n const rowSelection = row.table.atoms.rowSelection?.get() ?? {}\n\n let someSelected = false\n let allChildrenSelected = true\n\n for (let i = 0; i < row.subRows.length; i++) {\n const subRow = row.subRows[i]!\n\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n break\n }\n\n if (row_getCanSelect(subRow)) {\n if (isRowSelected(subRow, rowSelection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n }\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"mappings":";;;;;;;;;;;;;;AA8BA,SAAgB,8BAAiD;CAC/D,OAAOA,4BAAc;AACvB;;;;;;;;;;;;AAaA,SAAgB,sBAId,OACA,SACA;CACA,MAAM,QAAQ,uBAAuB,OAAO;AAC9C;;;;;;;;;;;;;AAcA,SAAgB,wBAGd,OAAyC,cAAwB;CAEjE,MAAM,qBAAqB;CAC3B,sBACE,OACA,eACIA,4BAAc,IACd,OAAO,OACLA,4BAAoB,GACpBC,yBAAW,MAAM,aAAa,gBAAgB,CAAC,CAAC,CAClD,CACN;AACF;;;;;;;;;;;;AAeA,SAAgB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B;EAE1B;CACF;CAEA,OAAO,sBAAsB,QAAQ,eAAe,SAAS;AAC/D"}
@@ -1,5 +1,5 @@
1
1
  import { RowData, Updater } from "../../types/type-utils.cjs";
2
- import { RowSelectionState } from "./rowSelectionFeature.types.cjs";
2
+ import { RowSelectionState, ToggleSelectedOptions } from "./rowSelectionFeature.types.cjs";
3
3
  import { Row } from "../../types/Row.cjs";
4
4
  import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.cjs";
5
5
  import { Table } from "../../types/Table.cjs";
@@ -222,9 +222,7 @@ declare function table_getToggleAllPageRowsSelectedHandler<TFeatures extends Tab
222
222
  * row_toggleSelected(row, false, { selectChildren: false })
223
223
  * ```
224
224
  */
225
- declare function row_toggleSelected<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, value?: boolean, opts?: {
226
- selectChildren?: boolean;
227
- }): void;
225
+ declare function row_toggleSelected<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, value?: boolean, opts?: ToggleSelectedOptions): void;
228
226
  /**
229
227
  * Checks whether this row id is selected in `state.rowSelection`.
230
228
  *
@@ -298,14 +296,18 @@ declare function row_getCanMultiSelect<TFeatures extends TableFeatures, TData ex
298
296
  * Creates a checkbox-style handler that selects or deselects this row.
299
297
  *
300
298
  * The handler is a no-op when the row cannot be selected and reads
301
- * `event.target.checked`.
299
+ * `event.target.checked`. Shift events select or deselect the inclusive range
300
+ * from the most recent selectable row handled by this table. The event's
301
+ * optional `persist()` method is called before it is read. Pass
302
+ * `selectChildren: false` to limit changes to rows explicitly present in the
303
+ * display-order interval.
302
304
  *
303
305
  * @example
304
306
  * ```ts
305
307
  * const onChange = row_getToggleSelectedHandler(row)
306
308
  * ```
307
309
  */
308
- declare function row_getToggleSelectedHandler<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): (e: unknown) => void;
310
+ declare function row_getToggleSelectedHandler<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, opts?: ToggleSelectedOptions): (e: unknown) => void;
309
311
  /**
310
312
  * Builds a row model containing rows selected by the current row selection state.
311
313
  *
@@ -1,5 +1,5 @@
1
1
  import { RowData, Updater } from "../../types/type-utils.js";
2
- import { RowSelectionState } from "./rowSelectionFeature.types.js";
2
+ import { RowSelectionState, ToggleSelectedOptions } from "./rowSelectionFeature.types.js";
3
3
  import { Row } from "../../types/Row.js";
4
4
  import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
5
5
  import { Table } from "../../types/Table.js";
@@ -222,9 +222,7 @@ declare function table_getToggleAllPageRowsSelectedHandler<TFeatures extends Tab
222
222
  * row_toggleSelected(row, false, { selectChildren: false })
223
223
  * ```
224
224
  */
225
- declare function row_toggleSelected<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, value?: boolean, opts?: {
226
- selectChildren?: boolean;
227
- }): void;
225
+ declare function row_toggleSelected<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, value?: boolean, opts?: ToggleSelectedOptions): void;
228
226
  /**
229
227
  * Checks whether this row id is selected in `state.rowSelection`.
230
228
  *
@@ -298,14 +296,18 @@ declare function row_getCanMultiSelect<TFeatures extends TableFeatures, TData ex
298
296
  * Creates a checkbox-style handler that selects or deselects this row.
299
297
  *
300
298
  * The handler is a no-op when the row cannot be selected and reads
301
- * `event.target.checked`.
299
+ * `event.target.checked`. Shift events select or deselect the inclusive range
300
+ * from the most recent selectable row handled by this table. The event's
301
+ * optional `persist()` method is called before it is read. Pass
302
+ * `selectChildren: false` to limit changes to rows explicitly present in the
303
+ * display-order interval.
302
304
  *
303
305
  * @example
304
306
  * ```ts
305
307
  * const onChange = row_getToggleSelectedHandler(row)
306
308
  * ```
307
309
  */
308
- declare function row_getToggleSelectedHandler<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): (e: unknown) => void;
310
+ declare function row_getToggleSelectedHandler<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>, opts?: ToggleSelectedOptions): (e: unknown) => void;
309
311
  /**
310
312
  * Builds a row model containing rows selected by the current row selection state.
311
313
  *
@@ -42,6 +42,7 @@ function table_setRowSelection(table, updater) {
42
42
  * ```
43
43
  */
44
44
  function table_resetRowSelection(table, defaultState) {
45
+ table._lastSelectedRowId = null;
45
46
  table_setRowSelection(table, defaultState ? makeObjectMap() : Object.assign(makeObjectMap(), cloneState(table.initialState.rowSelection ?? {})));
46
47
  }
47
48
  /**
@@ -56,6 +57,7 @@ function table_resetRowSelection(table, defaultState) {
56
57
  * ```
57
58
  */
58
59
  function table_toggleAllRowsSelected(table, value, opts) {
60
+ table._lastSelectedRowId = null;
59
61
  table_setRowSelection(table, (old) => {
60
62
  value = typeof value !== "undefined" ? value : !callMemoOrStaticFn(table, "getIsAllRowsSelected", table_getIsAllRowsSelected);
61
63
  if (opts?.deselectAll && !value) return makeObjectMap();
@@ -82,6 +84,7 @@ function table_toggleAllRowsSelected(table, value, opts) {
82
84
  * ```
83
85
  */
84
86
  function table_toggleAllPageRowsSelected(table, value, opts) {
87
+ table._lastSelectedRowId = null;
85
88
  table_setRowSelection(table, (old) => {
86
89
  const resolvedValue = typeof value !== "undefined" ? value : !callMemoOrStaticFn(table, "getIsAllPageRowsSelected", table_getIsAllPageRowsSelected);
87
90
  if (opts?.deselectAll && !resolvedValue) return makeObjectMap();
@@ -385,20 +388,64 @@ function row_getCanMultiSelect(row) {
385
388
  * Creates a checkbox-style handler that selects or deselects this row.
386
389
  *
387
390
  * The handler is a no-op when the row cannot be selected and reads
388
- * `event.target.checked`.
391
+ * `event.target.checked`. Shift events select or deselect the inclusive range
392
+ * from the most recent selectable row handled by this table. The event's
393
+ * optional `persist()` method is called before it is read. Pass
394
+ * `selectChildren: false` to limit changes to rows explicitly present in the
395
+ * display-order interval.
389
396
  *
390
397
  * @example
391
398
  * ```ts
392
399
  * const onChange = row_getToggleSelectedHandler(row)
393
400
  * ```
394
401
  */
395
- function row_getToggleSelectedHandler(row) {
402
+ function row_getToggleSelectedHandler(row, opts) {
396
403
  const canSelect = row_getCanSelect(row);
397
404
  return (e) => {
398
405
  if (!canSelect) return;
399
- row_toggleSelected(row, e.target.checked);
406
+ const event = e;
407
+ event.persist?.();
408
+ const table = row.table;
409
+ const checked = event.target.checked;
410
+ const anchorId = table._lastSelectedRowId;
411
+ if (!(table.options.enableRowRangeSelection !== false && anchorId !== null && row_getCanMultiSelect(row) && (table.options.isRowRangeSelectionEvent?.(e) ?? false)) || !selectRowRange(row, anchorId, checked, opts?.selectChildren ?? true)) row_toggleSelected(row, checked, opts);
412
+ table._lastSelectedRowId = row.id;
400
413
  };
401
414
  }
415
+ /**
416
+ * Resolves and mutates an inclusive interval in the table's latest logical
417
+ * display order.
418
+ *
419
+ * The anchor is resolved without throwing from the pre-pagination row model,
420
+ * then the core row model. Both endpoint display indexes must still identify
421
+ * those rows in the current order and both endpoints must support
422
+ * multi-selection. Eligible interval rows are applied through one row
423
+ * selection updater; non-selectable and non-multi-selectable rows are skipped.
424
+ * Returns `false` when the interaction should fall back to an ordinary toggle.
425
+ */
426
+ function selectRowRange(row, anchorId, value, includeChildren) {
427
+ const table = row.table;
428
+ const rows = table.getRowsInDisplayOrder();
429
+ const anchorRow = table.getPrePaginatedRowModel().rowsById[anchorId] ?? table.getCoreRowModel().rowsById[anchorId];
430
+ if (!anchorRow) return false;
431
+ const anchorIndex = anchorRow.getDisplayIndex();
432
+ const rowIndex = row.getDisplayIndex();
433
+ const anchorAtIndex = rows[anchorIndex];
434
+ const rowAtIndex = rows[rowIndex];
435
+ if (anchorIndex < 0 || rowIndex < 0 || anchorIndex >= rows.length || rowIndex >= rows.length || anchorAtIndex?.id !== anchorRow.id || rowAtIndex?.id !== row.id || !row_getCanMultiSelect(anchorRow) || !row_getCanMultiSelect(row)) return false;
436
+ const start = Math.min(anchorIndex, rowIndex);
437
+ const end = Math.max(anchorIndex, rowIndex);
438
+ table_setRowSelection(table, (old) => {
439
+ const rowSelection = Object.assign(makeObjectMap(), old);
440
+ for (let index = start; index <= end; index++) {
441
+ const rangeRow = rows[index];
442
+ if (!row_getCanSelect(rangeRow) || !row_getCanMultiSelect(rangeRow)) continue;
443
+ mutateRowIsSelected(rowSelection, rangeRow.id, value, includeChildren, table);
444
+ }
445
+ return rowSelection;
446
+ });
447
+ return true;
448
+ }
402
449
  const mutateRowIsSelected = (rowSelection, rowId, value, includeChildren, table) => {
403
450
  const row = table.getRow(rowId, true);
404
451
  if (value) {
@@ -1 +1 @@
1
- {"version":3,"file":"rowSelectionFeature.utils.js","names":[],"sources":["../../../src/features/row-selection/rowSelectionFeature.utils.ts"],"sourcesContent":["import {\n callMemoOrStaticFn,\n cloneState,\n copyInstancePropertiesWithoutMemos,\n hasOwn,\n makeObjectMap,\n} from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { RowSelectionState } from './rowSelectionFeature.types'\n\n// State APIs\n\n/**\n * Creates the default row selection state.\n *\n * The feature default is an empty map, meaning no rows are selected. Reset APIs\n * use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const selection = getDefaultRowSelectionState()\n * ```\n */\nexport function getDefaultRowSelectionState(): RowSelectionState {\n return makeObjectMap()\n}\n\n/**\n * Routes a row selection updater through the table's selection change handler.\n *\n * The updater may be a next selection map or a function of the previous map,\n * matching the instance `table.setRowSelection` behavior.\n *\n * @example\n * ```ts\n * table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))\n * ```\n */\nexport function table_setRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowSelectionState>,\n) {\n table.options.onRowSelectionChange?.(updater)\n}\n\n/**\n * Resets `rowSelection` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.rowSelection` when it\n * exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetRowSelection(table)\n * table_resetRowSelection(table, true)\n * ```\n */\nexport function table_resetRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setRowSelection(\n table,\n defaultState\n ? makeObjectMap()\n : Object.assign(\n makeObjectMap<true>(),\n cloneState(table.initialState.rowSelection ?? {}),\n ),\n )\n}\n\n// Table APIs\n\n/**\n * Selects or deselects every selectable row before grouping.\n *\n * Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.\n * Deselecting removes matching ids from the existing selection map.\n *\n * @example\n * ```ts\n * table_toggleAllRowsSelected(table)\n * ```\n */\nexport function table_toggleAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n value?: boolean,\n opts?: { deselectAll?: boolean },\n) {\n table_setRowSelection(table, (old) => {\n value =\n typeof value !== 'undefined'\n ? value\n : !callMemoOrStaticFn(\n table,\n 'getIsAllRowsSelected',\n table_getIsAllRowsSelected,\n )\n\n if (opts?.deselectAll && !value) {\n // deselectAll opt: clear the whole selection map instead of deleting ids one-by-one\n return makeObjectMap<true>()\n }\n\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach((row) => {\n if (row_getCanSelect(row)) {\n rowSelection[row.id] = true\n }\n })\n } else {\n preGroupedFlatRows.forEach((row) => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n}\n\n/**\n * Selects or deselects every selectable row on the current page.\n *\n * Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.\n * Child rows are included when sub-row selection allows it.\n *\n * @example\n * ```ts\n * table_toggleAllPageRowsSelected(table)\n * ```\n */\nexport function table_toggleAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n value?: boolean,\n opts?: { deselectAll?: boolean },\n) {\n table_setRowSelection(table, (old) => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !callMemoOrStaticFn(\n table,\n 'getIsAllPageRowsSelected',\n table_getIsAllPageRowsSelected,\n )\n\n if (opts?.deselectAll && !resolvedValue) {\n // deselectAll opt: clear the whole selection map instead of deleting ids one-by-one\n return makeObjectMap<true>()\n }\n\n const rowSelection: RowSelectionState = Object.assign(\n makeObjectMap<true>(),\n old,\n )\n\n table.getRowModel().rows.forEach((row) => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n}\n\n/**\n * Reads the row model before row selection is projected into selected rows.\n *\n * Selection does not alter the base row pipeline, so this returns the core row\n * model.\n *\n * @example\n * ```ts\n * const rowsBeforeSelection = table_getPreSelectedRowModel(table)\n * ```\n */\nexport function table_getPreSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getCoreRowModel()\n}\n\n/**\n * Builds a row model containing selected rows from the core row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getSelectedRowModel(table)\n * ```\n */\nexport function table_getSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Builds a row model containing selected rows from the filtered row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getFilteredSelectedRowModel(table)\n * ```\n */\nexport function table_getFilteredSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getFilteredRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Builds a row model containing selected rows from the grouped row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getGroupedSelectedRowModel(table)\n * ```\n */\nexport function table_getGroupedSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n // The sorted model falls back grouped -> filtered -> core when those\n // features are not registered, so selected group rows are always visible.\n const rowModel = table.getSortedRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Returns the ids of all selected rows.\n *\n * @example\n * ```ts\n * const selectedRowIds = table_getSelectedRowIds(table)\n * ```\n */\nexport function table_getSelectedRowIds<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<string> {\n return Object.keys(table.atoms.rowSelection?.get() ?? {})\n}\n\n/**\n * Checks whether every selectable filtered row is selected.\n *\n * The result is false when there are no filtered rows or when selection state is\n * empty.\n *\n * @example\n * ```ts\n * const allSelected = table_getIsAllRowsSelected(table)\n * ```\n */\nexport function table_getIsAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length,\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n (row) => row_getCanSelect(row) && !isRowSelected(row, rowSelection),\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n}\n\n/**\n * Checks whether every selectable row on the current page is selected.\n *\n * Non-selectable rows are ignored for this calculation.\n *\n * @example\n * ```ts\n * const allPageRowsSelected = table_getIsAllPageRowsSelected(table)\n * ```\n */\nexport function table_getIsAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some((row) => !isRowSelected(row, rowSelection))\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n}\n\n/**\n * Checks whether selection is partially applied across filtered rows.\n *\n * The result is true when at least one row id is selected\n *\n * @example\n * ```ts\n * const someRowsSelected = table_getIsSomeRowsSelected(table)\n * ```\n */\nexport function table_getIsSomeRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(table, 'getSelectedRowIds', table_getSelectedRowIds)\n .length > 0\n )\n}\n\n/**\n * Checks whether the current page has a partial selection.\n *\n * @example\n * ```ts\n * const somePageRowsSelected = table_getIsSomePageRowsSelected(table)\n * ```\n */\nexport function table_getIsSomePageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n .some(\n (row) =>\n row_getIsSelected(row) ||\n callMemoOrStaticFn(row, 'getIsSomeSelected', row_getIsSomeSelected),\n )\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects all rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects current page rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all page rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllPageRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllPageRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllPageRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n// Row APIs\n\n/**\n * Selects or deselects this row.\n *\n * Omitting `value` toggles the row. Child rows are selected recursively unless\n * `opts.selectChildren` is `false` or sub-row selection is disabled.\n *\n * @example\n * ```ts\n * row_toggleSelected(row)\n * row_toggleSelected(row, true)\n * row_toggleSelected(row, false)\n * row_toggleSelected(row, true, { selectChildren: false })\n * row_toggleSelected(row, false, { selectChildren: false })\n * ```\n */\nexport function row_toggleSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n row: Row<TFeatures, TData>,\n value?: boolean,\n opts?: {\n selectChildren?: boolean\n },\n) {\n const isSelected = row_getIsSelected(row)\n\n table_setRowSelection(row.table, (old) => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n\n mutateRowIsSelected(\n rowSelection,\n row.id,\n value,\n opts?.selectChildren ?? true,\n row.table,\n )\n\n return rowSelection\n })\n}\n\n/**\n * Checks whether this row id is selected in `state.rowSelection`.\n *\n * Missing row ids are treated as not selected.\n *\n * @example\n * ```ts\n * const selected = row_getIsSelected(row)\n * ```\n */\nexport function row_getIsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const rowSelection = row.table.atoms.rowSelection?.get() ?? {}\n return isRowSelected(row, rowSelection)\n}\n\n/**\n * Checks whether some, but not all, selectable descendants are selected.\n *\n * This supports indeterminate selection UI for parent rows.\n *\n * @example\n * ```ts\n * const partial = row_getIsSomeSelected(row)\n * ```\n */\nexport function row_getIsSomeSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'some'\n}\n\n/**\n * Checks whether all selectable descendants are selected.\n *\n * Rows without selectable descendants return false.\n *\n * @example\n * ```ts\n * const allChildrenSelected = row_getIsAllSubRowsSelected(row)\n * ```\n */\nexport function row_getIsAllSubRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'all'\n}\n\n/**\n * Checks whether this row can be selected.\n *\n * `options.enableRowSelection` may be a boolean or a row predicate; it defaults\n * to `true`.\n *\n * @example\n * ```ts\n * const canSelect = row_getCanSelect(row)\n * ```\n */\nexport function row_getCanSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableRowSelection === 'function') {\n return options.enableRowSelection(row)\n }\n\n return options.enableRowSelection ?? true\n}\n\n/**\n * Checks whether selecting this row should also select its subRows.\n *\n * `options.enableSubRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canSelectChildren = row_getCanSelectSubRows(row)\n * ```\n */\nexport function row_getCanSelectSubRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableSubRowSelection === 'function') {\n return options.enableSubRowSelection(row)\n }\n\n return options.enableSubRowSelection ?? true\n}\n\n/**\n * Checks whether this row can be selected alongside other rows.\n *\n * `options.enableMultiRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canMultiSelect = row_getCanMultiSelect(row)\n * ```\n */\nexport function row_getCanMultiSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableMultiRowSelection === 'function') {\n return options.enableMultiRowSelection(row)\n }\n\n return options.enableMultiRowSelection ?? true\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects this row.\n *\n * The handler is a no-op when the row cannot be selected and reads\n * `event.target.checked`.\n *\n * @example\n * ```ts\n * const onChange = row_getToggleSelectedHandler(row)\n * ```\n */\nexport function row_getToggleSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const canSelect = row_getCanSelect(row)\n\n return (e: unknown) => {\n if (!canSelect) return\n row_toggleSelected(\n row,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\nconst mutateRowIsSelected = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowSelection: RowSelectionState,\n rowId: string,\n value: boolean,\n includeChildren: boolean,\n table: Table_Internal<TFeatures, TData>,\n): void => {\n const row = table.getRow(rowId, true)\n\n if (value) {\n if (!row_getCanMultiSelect(row)) {\n Object.keys(rowSelection).forEach((key) => delete rowSelection[key])\n }\n if (row_getCanSelect(row)) {\n rowSelection[rowId] = true\n }\n } else {\n delete rowSelection[rowId]\n }\n\n if (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) {\n row.subRows.forEach((r) =>\n mutateRowIsSelected(rowSelection, r.id, value, includeChildren, table),\n )\n }\n}\n\n/**\n * Builds a row model containing rows selected by the current row selection state.\n *\n * The result is derived from the supplied row model, so selected ids absent from\n * that model are not materialized as rows.\n *\n * @example\n * ```ts\n * const selectedRows = selectRowsFn(rowModel)\n * ```\n */\nexport function selectRowsFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowModel: RowModel<TFeatures, TData>,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const newSelectedFlatRows: Array<Row<TFeatures, TData>> = []\n const newSelectedRowsById = makeObjectMap<Row<TFeatures, TData>>()\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n // Filters top level and nested rows.\n const recurseRows = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n ): Array<Row<TFeatures, TData>> => {\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i]!\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows.length) {\n // Always recurse — selected descendants of unselected parents must\n // still be collected into flatRows/rowsById.\n const newSubRows = recurseRows(row.subRows, depth + 1)\n\n if (isSelected) {\n // Preserve prototype chain so methods like getValue() remain accessible\n const cloned = Object.create(Object.getPrototypeOf(row))\n copyInstancePropertiesWithoutMemos(cloned, row)\n cloned.subRows = newSubRows\n result.push(cloned)\n }\n } else if (isSelected) {\n result.push(row)\n }\n }\n return result\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\n/**\n * Returns whether a row id is selected in the current row selection state.\n *\n * @example\n * ```ts\n * const selected = isRowSelected(row)\n * ```\n */\nexport function isRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, rowSelection: RowSelectionState): boolean {\n return !!(hasOwn(rowSelection, row.id) && rowSelection[row.id])\n}\n\n/**\n * Returns whether all, some, or none of a row's selectable descendants are selected.\n *\n * The result is used to drive indeterminate row selection UI.\n *\n * @example\n * ```ts\n * const selectedState = isSubRowSelected(row)\n * ```\n */\nexport function isSubRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean | 'some' | 'all' {\n if (!row.subRows.length) return false\n\n const rowSelection = row.table.atoms.rowSelection?.get() ?? {}\n\n let someSelected = false\n let allChildrenSelected = true\n\n for (let i = 0; i < row.subRows.length; i++) {\n const subRow = row.subRows[i]!\n\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n break\n }\n\n if (row_getCanSelect(subRow)) {\n if (isRowSelected(subRow, rowSelection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n }\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"mappings":";;;;;;;;;;;;;;AA2BA,SAAgB,8BAAiD;CAC/D,OAAO,cAAc;AACvB;;;;;;;;;;;;AAaA,SAAgB,sBAId,OACA,SACA;CACA,MAAM,QAAQ,uBAAuB,OAAO;AAC9C;;;;;;;;;;;;;AAcA,SAAgB,wBAGd,OAAyC,cAAwB;CACjE,sBACE,OACA,eACI,cAAc,IACd,OAAO,OACL,cAAoB,GACpB,WAAW,MAAM,aAAa,gBAAgB,CAAC,CAAC,CAClD,CACN;AACF;;;;;;;;;;;;AAeA,SAAgB,4BAId,OACA,OACA,MACA;CACA,sBAAsB,QAAQ,QAAQ;EACpC,QACE,OAAO,UAAU,cACb,QACA,CAAC,mBACC,OACA,wBACA,0BACF;EAEN,IAAI,MAAM,eAAe,CAAC,OAExB,OAAO,cAAoB;EAG7B,MAAM,eAAe,OAAO,OAAO,cAAoB,GAAG,GAAG;EAC7D,MAAM,qBAAqB,MAAM,sBAAsB,CAAC,CAAC;EAIzD,IA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O,UAAU;KACjB,OAAO,KAAK,MAAM;IACpB;GACF,OAAO,IAAI,YACT,OAAO,KAAK,GAAG;EAEnB;EACA,OAAO;CACT;CAEA,OAAO;EACL,MAAM,YAAY,SAAS,IAAI;EAC/B,UAAU;EACV,UAAU;CACZ;AACF;;;;;;;;;AAUA,SAAgB,cAGd,KAA4B,cAA0C;CACtE,OAAO,CAAC,EAAE,OAAO,cAAc,IAAI,EAAE,KAAK,aAAa,IAAI;AAC7D;;;;;;;;;;;AAYA,SAAgB,iBAGd,KAAsD;CACtD,IAAI,CAAC,IAAI,QAAQ,QAAQ,OAAO;CAEhC,MAAM,eAAe,IAAI,MAAM,MAAM,cAAc,IAAI,KAAK,CAAC;CAE7D,IAAI,eAAe;CACnB,IAAI,sBAAsB;CAE1B,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,QAAQ,KAAK;EAC3C,MAAM,SAAS,IAAI,QAAQ;EAG3B,IAAI,gBAAgB,CAAC,qBACnB;EAGF,IAAI,iBAAiB,MAAM,GACzB,IAAI,cAAc,QAAQ,YAAY,GACpC,eAAe;OAEf,sBAAsB;EAK1B,IAAI,OAAO,QAAQ,QAAQ;GACzB,MAAM,yBAAyB,iBAAiB,MAAM;GACtD,IAAI,2BAA2B,OAC7B,eAAe;QACV,IAAI,2BAA2B,QAAQ;IAC5C,eAAe;IACf,sBAAsB;GACxB,OACE,sBAAsB;EAE1B;CACF;CAEA,OAAO,sBAAsB,QAAQ,eAAe,SAAS;AAC/D"}
1
+ {"version":3,"file":"rowSelectionFeature.utils.js","names":[],"sources":["../../../src/features/row-selection/rowSelectionFeature.utils.ts"],"sourcesContent":["import {\n callMemoOrStaticFn,\n cloneState,\n copyInstancePropertiesWithoutMemos,\n hasOwn,\n makeObjectMap,\n} from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type {\n RowSelectionState,\n ToggleSelectedOptions,\n} from './rowSelectionFeature.types'\n\n// State APIs\n\n/**\n * Creates the default row selection state.\n *\n * The feature default is an empty map, meaning no rows are selected. Reset APIs\n * use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const selection = getDefaultRowSelectionState()\n * ```\n */\nexport function getDefaultRowSelectionState(): RowSelectionState {\n return makeObjectMap()\n}\n\n/**\n * Routes a row selection updater through the table's selection change handler.\n *\n * The updater may be a next selection map or a function of the previous map,\n * matching the instance `table.setRowSelection` behavior.\n *\n * @example\n * ```ts\n * table_setRowSelection(table, (old) => ({ ...old, [rowId]: true }))\n * ```\n */\nexport function table_setRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowSelectionState>,\n) {\n table.options.onRowSelectionChange?.(updater)\n}\n\n/**\n * Resets `rowSelection` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.rowSelection` when it\n * exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetRowSelection(table)\n * table_resetRowSelection(table, true)\n * ```\n */\nexport function table_resetRowSelection<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n table._lastSelectedRowId = null\n table_setRowSelection(\n table,\n defaultState\n ? makeObjectMap()\n : Object.assign(\n makeObjectMap<true>(),\n cloneState(table.initialState.rowSelection ?? {}),\n ),\n )\n}\n\n// Table APIs\n\n/**\n * Selects or deselects every selectable row before grouping.\n *\n * Omitting `value` toggles based on `table_getIsAllRowsSelected(table)`.\n * Deselecting removes matching ids from the existing selection map.\n *\n * @example\n * ```ts\n * table_toggleAllRowsSelected(table)\n * ```\n */\nexport function table_toggleAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n value?: boolean,\n opts?: { deselectAll?: boolean },\n) {\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n table._lastSelectedRowId = null\n table_setRowSelection(table, (old) => {\n value =\n typeof value !== 'undefined'\n ? value\n : !callMemoOrStaticFn(\n table,\n 'getIsAllRowsSelected',\n table_getIsAllRowsSelected,\n )\n\n if (opts?.deselectAll && !value) {\n // deselectAll opt: clear the whole selection map instead of deleting ids one-by-one\n return makeObjectMap<true>()\n }\n\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows\n\n // We don't use `mutateRowIsSelected` here for performance reasons.\n // All of the rows are flat already, so it wouldn't be worth it\n if (value) {\n preGroupedFlatRows.forEach((row) => {\n if (row_getCanSelect(row)) {\n rowSelection[row.id] = true\n }\n })\n } else {\n preGroupedFlatRows.forEach((row) => {\n delete rowSelection[row.id]\n })\n }\n\n return rowSelection\n })\n}\n\n/**\n * Selects or deselects every selectable row on the current page.\n *\n * Omitting `value` toggles based on `table_getIsAllPageRowsSelected(table)`.\n * Child rows are included when sub-row selection allows it.\n *\n * @example\n * ```ts\n * table_toggleAllPageRowsSelected(table)\n * ```\n */\nexport function table_toggleAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n value?: boolean,\n opts?: { deselectAll?: boolean },\n) {\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n table._lastSelectedRowId = null\n table_setRowSelection(table, (old) => {\n const resolvedValue =\n typeof value !== 'undefined'\n ? value\n : !callMemoOrStaticFn(\n table,\n 'getIsAllPageRowsSelected',\n table_getIsAllPageRowsSelected,\n )\n\n if (opts?.deselectAll && !resolvedValue) {\n // deselectAll opt: clear the whole selection map instead of deleting ids one-by-one\n return makeObjectMap<true>()\n }\n\n const rowSelection: RowSelectionState = Object.assign(\n makeObjectMap<true>(),\n old,\n )\n\n table.getRowModel().rows.forEach((row) => {\n mutateRowIsSelected(rowSelection, row.id, resolvedValue, true, table)\n })\n\n return rowSelection\n })\n}\n\n/**\n * Reads the row model before row selection is projected into selected rows.\n *\n * Selection does not alter the base row pipeline, so this returns the core row\n * model.\n *\n * @example\n * ```ts\n * const rowsBeforeSelection = table_getPreSelectedRowModel(table)\n * ```\n */\nexport function table_getPreSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n return table.getCoreRowModel()\n}\n\n/**\n * Builds a row model containing selected rows from the core row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getSelectedRowModel(table)\n * ```\n */\nexport function table_getSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getCoreRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Builds a row model containing selected rows from the filtered row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getFilteredSelectedRowModel(table)\n * ```\n */\nexport function table_getFilteredSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const rowModel = table.getFilteredRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Builds a row model containing selected rows from the grouped row model.\n *\n * If no row ids are selected, an empty row model is returned without walking\n * the rows.\n *\n * @example\n * ```ts\n * const selectedRows = table_getGroupedSelectedRowModel(table)\n * ```\n */\nexport function table_getGroupedSelectedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n // The sorted model falls back grouped -> filtered -> core when those\n // features are not registered, so selected group rows are always visible.\n const rowModel = table.getSortedRowModel()\n\n if (\n !callMemoOrStaticFn(\n table,\n 'getIsSomeRowsSelected',\n table_getIsSomeRowsSelected,\n )\n ) {\n return {\n rows: [],\n flatRows: [],\n rowsById: makeObjectMap(),\n }\n }\n\n return selectRowsFn(rowModel, table)\n}\n\n/**\n * Returns the ids of all selected rows.\n *\n * @example\n * ```ts\n * const selectedRowIds = table_getSelectedRowIds(table)\n * ```\n */\nexport function table_getSelectedRowIds<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<string> {\n return Object.keys(table.atoms.rowSelection?.get() ?? {})\n}\n\n/**\n * Checks whether every selectable filtered row is selected.\n *\n * The result is false when there are no filtered rows or when selection state is\n * empty.\n *\n * @example\n * ```ts\n * const allSelected = table_getIsAllRowsSelected(table)\n * ```\n */\nexport function table_getIsAllRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const preGroupedFlatRows = table.getFilteredRowModel().flatRows\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n\n let isAllRowsSelected = Boolean(\n preGroupedFlatRows.length && Object.keys(rowSelection).length,\n )\n\n if (isAllRowsSelected) {\n if (\n preGroupedFlatRows.some(\n (row) => row_getCanSelect(row) && !isRowSelected(row, rowSelection),\n )\n ) {\n isAllRowsSelected = false\n }\n }\n\n return isAllRowsSelected\n}\n\n/**\n * Checks whether every selectable row on the current page is selected.\n *\n * Non-selectable rows are ignored for this calculation.\n *\n * @example\n * ```ts\n * const allPageRowsSelected = table_getIsAllPageRowsSelected(table)\n * ```\n */\nexport function table_getIsAllPageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const paginationFlatRows = table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n\n let isAllPageRowsSelected = !!paginationFlatRows.length\n\n if (\n isAllPageRowsSelected &&\n paginationFlatRows.some((row) => !isRowSelected(row, rowSelection))\n ) {\n isAllPageRowsSelected = false\n }\n\n return isAllPageRowsSelected\n}\n\n/**\n * Checks whether selection is partially applied across filtered rows.\n *\n * The result is true when at least one row id is selected\n *\n * @example\n * ```ts\n * const someRowsSelected = table_getIsSomeRowsSelected(table)\n * ```\n */\nexport function table_getIsSomeRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (\n callMemoOrStaticFn(table, 'getSelectedRowIds', table_getSelectedRowIds)\n .length > 0\n )\n}\n\n/**\n * Checks whether the current page has a partial selection.\n *\n * @example\n * ```ts\n * const somePageRowsSelected = table_getIsSomePageRowsSelected(table)\n * ```\n */\nexport function table_getIsSomePageRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getPaginatedRowModel()\n .flatRows.filter((row) => row_getCanSelect(row))\n .some(\n (row) =>\n row_getIsSelected(row) ||\n callMemoOrStaticFn(row, 'getIsSomeSelected', row_getIsSomeSelected),\n )\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects all rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects current page rows.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all page rows selected\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllPageRowsSelectedHandler(table)\n * ```\n */\nexport function table_getToggleAllPageRowsSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllPageRowsSelected(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n// Row APIs\n\n/**\n * Selects or deselects this row.\n *\n * Omitting `value` toggles the row. Child rows are selected recursively unless\n * `opts.selectChildren` is `false` or sub-row selection is disabled.\n *\n * @example\n * ```ts\n * row_toggleSelected(row)\n * row_toggleSelected(row, true)\n * row_toggleSelected(row, false)\n * row_toggleSelected(row, true, { selectChildren: false })\n * row_toggleSelected(row, false, { selectChildren: false })\n * ```\n */\nexport function row_toggleSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, value?: boolean, opts?: ToggleSelectedOptions) {\n const isSelected = row_getIsSelected(row)\n\n table_setRowSelection(row.table, (old) => {\n value = typeof value !== 'undefined' ? value : !isSelected\n\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n\n mutateRowIsSelected(\n rowSelection,\n row.id,\n value,\n opts?.selectChildren ?? true,\n row.table,\n )\n\n return rowSelection\n })\n}\n\n/**\n * Checks whether this row id is selected in `state.rowSelection`.\n *\n * Missing row ids are treated as not selected.\n *\n * @example\n * ```ts\n * const selected = row_getIsSelected(row)\n * ```\n */\nexport function row_getIsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const rowSelection = row.table.atoms.rowSelection?.get() ?? {}\n return isRowSelected(row, rowSelection)\n}\n\n/**\n * Checks whether some, but not all, selectable descendants are selected.\n *\n * This supports indeterminate selection UI for parent rows.\n *\n * @example\n * ```ts\n * const partial = row_getIsSomeSelected(row)\n * ```\n */\nexport function row_getIsSomeSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'some'\n}\n\n/**\n * Checks whether all selectable descendants are selected.\n *\n * Rows without selectable descendants return false.\n *\n * @example\n * ```ts\n * const allChildrenSelected = row_getIsAllSubRowsSelected(row)\n * ```\n */\nexport function row_getIsAllSubRowsSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n return isSubRowSelected(row) === 'all'\n}\n\n/**\n * Checks whether this row can be selected.\n *\n * `options.enableRowSelection` may be a boolean or a row predicate; it defaults\n * to `true`.\n *\n * @example\n * ```ts\n * const canSelect = row_getCanSelect(row)\n * ```\n */\nexport function row_getCanSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableRowSelection === 'function') {\n return options.enableRowSelection(row)\n }\n\n return options.enableRowSelection ?? true\n}\n\n/**\n * Checks whether selecting this row should also select its subRows.\n *\n * `options.enableSubRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canSelectChildren = row_getCanSelectSubRows(row)\n * ```\n */\nexport function row_getCanSelectSubRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableSubRowSelection === 'function') {\n return options.enableSubRowSelection(row)\n }\n\n return options.enableSubRowSelection ?? true\n}\n\n/**\n * Checks whether this row can be selected alongside other rows.\n *\n * `options.enableMultiRowSelection` may be a boolean or a row predicate; it\n * defaults to `true`.\n *\n * @example\n * ```ts\n * const canMultiSelect = row_getCanMultiSelect(row)\n * ```\n */\nexport function row_getCanMultiSelect<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>) {\n const options = row.table.options\n if (typeof options.enableMultiRowSelection === 'function') {\n return options.enableMultiRowSelection(row)\n }\n\n return options.enableMultiRowSelection ?? true\n}\n\n/**\n * Creates a checkbox-style handler that selects or deselects this row.\n *\n * The handler is a no-op when the row cannot be selected and reads\n * `event.target.checked`. Shift events select or deselect the inclusive range\n * from the most recent selectable row handled by this table. The event's\n * optional `persist()` method is called before it is read. Pass\n * `selectChildren: false` to limit changes to rows explicitly present in the\n * display-order interval.\n *\n * @example\n * ```ts\n * const onChange = row_getToggleSelectedHandler(row)\n * ```\n */\nexport function row_getToggleSelectedHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, opts?: ToggleSelectedOptions) {\n const canSelect = row_getCanSelect(row)\n\n return (e: unknown) => {\n if (!canSelect) return\n\n const event = e as {\n persist?: () => void\n target: { checked: boolean }\n }\n event.persist?.()\n\n const table = row.table\n const checked = event.target.checked\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n const anchorId = table._lastSelectedRowId\n const canSelectRange =\n table.options.enableRowRangeSelection !== false &&\n anchorId !== null &&\n row_getCanMultiSelect(row) &&\n (table.options.isRowRangeSelectionEvent?.(e) ?? false)\n\n if (\n !canSelectRange ||\n !selectRowRange(row, anchorId, checked, opts?.selectChildren ?? true)\n ) {\n row_toggleSelected(row, checked, opts)\n }\n\n // @ts-ignore - _lastSelectedRowId is part of the RowSelection feature\n table._lastSelectedRowId = row.id\n }\n}\n\n/**\n * Resolves and mutates an inclusive interval in the table's latest logical\n * display order.\n *\n * The anchor is resolved without throwing from the pre-pagination row model,\n * then the core row model. Both endpoint display indexes must still identify\n * those rows in the current order and both endpoints must support\n * multi-selection. Eligible interval rows are applied through one row\n * selection updater; non-selectable and non-multi-selectable rows are skipped.\n * Returns `false` when the interaction should fall back to an ordinary toggle.\n */\nfunction selectRowRange<TFeatures extends TableFeatures, TData extends RowData>(\n row: Row<TFeatures, TData>,\n anchorId: string,\n value: boolean,\n includeChildren: boolean,\n): boolean {\n const table = row.table\n const rows = table.getRowsInDisplayOrder()\n const anchorRow =\n table.getPrePaginatedRowModel().rowsById[anchorId] ??\n table.getCoreRowModel().rowsById[anchorId]\n\n if (!anchorRow) {\n return false\n }\n\n const anchorIndex = anchorRow.getDisplayIndex()\n const rowIndex = row.getDisplayIndex()\n const anchorAtIndex = rows[anchorIndex]\n const rowAtIndex = rows[rowIndex]\n\n if (\n anchorIndex < 0 ||\n rowIndex < 0 ||\n anchorIndex >= rows.length ||\n rowIndex >= rows.length ||\n anchorAtIndex?.id !== anchorRow.id ||\n rowAtIndex?.id !== row.id ||\n !row_getCanMultiSelect(anchorRow) ||\n !row_getCanMultiSelect(row)\n ) {\n return false\n }\n\n const start = Math.min(anchorIndex, rowIndex)\n const end = Math.max(anchorIndex, rowIndex)\n\n table_setRowSelection(table, (old) => {\n const rowSelection = Object.assign(makeObjectMap<true>(), old)\n\n for (let index = start; index <= end; index++) {\n const rangeRow = rows[index]!\n if (!row_getCanSelect(rangeRow) || !row_getCanMultiSelect(rangeRow)) {\n continue\n }\n mutateRowIsSelected(\n rowSelection,\n rangeRow.id,\n value,\n includeChildren,\n table,\n )\n }\n\n return rowSelection\n })\n\n return true\n}\n\nconst mutateRowIsSelected = <\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowSelection: RowSelectionState,\n rowId: string,\n value: boolean,\n includeChildren: boolean,\n table: Table_Internal<TFeatures, TData>,\n): void => {\n const row = table.getRow(rowId, true)\n\n if (value) {\n if (!row_getCanMultiSelect(row)) {\n Object.keys(rowSelection).forEach((key) => delete rowSelection[key])\n }\n if (row_getCanSelect(row)) {\n rowSelection[rowId] = true\n }\n } else {\n delete rowSelection[rowId]\n }\n\n if (includeChildren && row.subRows.length && row_getCanSelectSubRows(row)) {\n row.subRows.forEach((r) =>\n mutateRowIsSelected(rowSelection, r.id, value, includeChildren, table),\n )\n }\n}\n\n/**\n * Builds a row model containing rows selected by the current row selection state.\n *\n * The result is derived from the supplied row model, so selected ids absent from\n * that model are not materialized as rows.\n *\n * @example\n * ```ts\n * const selectedRows = selectRowsFn(rowModel)\n * ```\n */\nexport function selectRowsFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n rowModel: RowModel<TFeatures, TData>,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const newSelectedFlatRows: Array<Row<TFeatures, TData>> = []\n const newSelectedRowsById = makeObjectMap<Row<TFeatures, TData>>()\n const rowSelection = table.atoms.rowSelection?.get() ?? {}\n // Filters top level and nested rows.\n const recurseRows = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n ): Array<Row<TFeatures, TData>> => {\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i]!\n const isSelected = isRowSelected(row, rowSelection)\n\n if (isSelected) {\n newSelectedFlatRows.push(row)\n newSelectedRowsById[row.id] = row\n }\n\n if (row.subRows.length) {\n // Always recurse — selected descendants of unselected parents must\n // still be collected into flatRows/rowsById.\n const newSubRows = recurseRows(row.subRows, depth + 1)\n\n if (isSelected) {\n // Preserve prototype chain so methods like getValue() remain accessible\n const cloned = Object.create(Object.getPrototypeOf(row))\n copyInstancePropertiesWithoutMemos(cloned, row)\n cloned.subRows = newSubRows\n result.push(cloned)\n }\n } else if (isSelected) {\n result.push(row)\n }\n }\n return result\n }\n\n return {\n rows: recurseRows(rowModel.rows),\n flatRows: newSelectedFlatRows,\n rowsById: newSelectedRowsById,\n }\n}\n\n/**\n * Returns whether a row id is selected in the current row selection state.\n *\n * @example\n * ```ts\n * const selected = isRowSelected(row)\n * ```\n */\nexport function isRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>, rowSelection: RowSelectionState): boolean {\n return !!(hasOwn(rowSelection, row.id) && rowSelection[row.id])\n}\n\n/**\n * Returns whether all, some, or none of a row's selectable descendants are selected.\n *\n * The result is used to drive indeterminate row selection UI.\n *\n * @example\n * ```ts\n * const selectedState = isSubRowSelected(row)\n * ```\n */\nexport function isSubRowSelected<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean | 'some' | 'all' {\n if (!row.subRows.length) return false\n\n const rowSelection = row.table.atoms.rowSelection?.get() ?? {}\n\n let someSelected = false\n let allChildrenSelected = true\n\n for (let i = 0; i < row.subRows.length; i++) {\n const subRow = row.subRows[i]!\n\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n break\n }\n\n if (row_getCanSelect(subRow)) {\n if (isRowSelected(subRow, rowSelection)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n }\n\n // Check row selection of nested subrows\n if (subRow.subRows.length) {\n const subRowChildrenSelected = isSubRowSelected(subRow)\n if (subRowChildrenSelected === 'all') {\n someSelected = true\n } else if (subRowChildrenSelected === 'some') {\n someSelected = true\n allChildrenSelected = false\n } else {\n allChildrenSelected = false\n }\n }\n }\n\n return allChildrenSelected ? 'all' : someSelected ? 'some' : false\n}\n"],"mappings":";;;;;;;;;;;;;;AA8BA,SAAgB,8BAAiD;CAC/D,OAAO,cAAc;AACvB;;;;;;;;;;;;AAaA,SAAgB,sBAId,OACA,SACA;CACA,MAAM,QAAQ,uBAAuB,OAAO;AAC9C;;;;;;;;;;;;;AAcA,SAAgB,wBAGd,OAAyC,cAAwB;CAEjE,MAAM,qBAAqB;CAC3B,sBACE,OACA,eACI,cAAc,IACd,OAAO,OACL,cAAoB,GACpB,WAAW,MAAM,aAAa,gBAAgB,CAAC,CAAC,CAClD,CACN;AACF;;;;;;;;;;;;AAeA,SAAgB,4BAId,OACA,OACA,MACA;CAEA,MAAM,qBAAqB;CAC3B,sBAAsB,QAAQ,QAAQ;EACpC,QACE,OAAO,UAAU,cACb,QACA,CAAC,mBACC,OACA,wBACA,0BACF;EAEN,IAAI,MAAM,eAAe,CAAC,OAExB,OAAO,cAAoB;EAG7B,MAAM,eAAe,OAAO,OAAO,cAAoB,GAAG,GAAG;EAC7D,MAAM,qBAAqB,MAAM,sBAAsB,CAAC,CAAC;EAIzD,IAAI,OACF,mBAAmB,SAAS,QAAQ;GAClC,IAAI,iBAAiB,GAAG,GACtB,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AO,KAAK,MAAM;IACpB;GACF,OAAO,IAAI,YACT,OAAO,KAAK,GAAG;EAEnB;EACA,OAAO;CACT;CAEA,OAAO;EACL,MAAM,YAAY,SAAS,IAAI;EAC/B,UAAU;EACV,UAAU;CACZ;AACF;;;;;;;;;AAUA,SAAgB,cAGd,KAA4B,cAA0C;CACtE,OAAO,CAAC,EAAE,OAAO,cAAc,IAAI,EAAE,KAAK,aAAa,IAAI;AAC7D;;;;;;;;;;;AAYA,SAAgB,iBAGd,KAAsD;CACtD,IAAI,CAAC,IAAI,QAAQ,QAAQ,OAAO;CAEhC,MAAM,eAAe,IAAI,MAAM,MAAM,cAAc,IAAI,KAAK,CAAC;CAE7D,IAAI,eAAe;CACnB,IAAI,sBAAsB;CAE1B,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,QAAQ,KAAK;EAC3C,MAAM,SAAS,IAAI,QAAQ;EAG3B,IAAI,gBAAgB,CAAC,qBACnB;EAGF,IAAI,iBAAiB,MAAM,GACzB,IAAI,cAAc,QAAQ,YAAY,GACpC,eAAe;OAEf,sBAAsB;EAK1B,IAAI,OAAO,QAAQ,QAAQ;GACzB,MAAM,yBAAyB,iBAAiB,MAAM;GACtD,IAAI,2BAA2B,OAC7B,eAAe;QACV,IAAI,2BAA2B,QAAQ;IAC5C,eAAe;IACf,sBAAsB;GACxB,OACE,sBAAsB;EAE1B;CACF;CAEA,OAAO,sBAAsB,QAAQ,eAAe,SAAS;AAC/D"}
package/dist/index.d.cts CHANGED
@@ -23,7 +23,7 @@ import { Cell, Cell_Core, Cell_FeatureMap } from "./types/Cell.cjs";
23
23
  import { ColumnDef_ColumnVisibility, ColumnVisibilityState, Column_ColumnVisibility, Row_ColumnVisibility, TableOptions_ColumnVisibility, TableState_ColumnVisibility, Table_ColumnVisibility, VisibilityDefaultOptions } from "./features/column-visibility/columnVisibilityFeature.types.cjs";
24
24
  import { CachedRowModel_Expanded, ExpandedState, ExpandedStateList, Row_RowExpanding, TableOptions_RowExpanding, TableState_RowExpanding, Table_RowExpanding, Table_RowModels_Expanded } from "./features/row-expanding/rowExpandingFeature.types.cjs";
25
25
  import { RowPinningDefaultOptions, RowPinningPosition, RowPinningState, Row_RowPinning, TableOptions_RowPinning, TableState_RowPinning, Table_RowPinning } from "./features/row-pinning/rowPinningFeature.types.cjs";
26
- import { RowSelectionState, Row_RowSelection, TableOptions_RowSelection, TableState_RowSelection, Table_RowSelection } from "./features/row-selection/rowSelectionFeature.types.cjs";
26
+ import { RowSelectionState, Row_RowSelection, TableOptions_RowSelection, TableState_RowSelection, Table_RowSelection, ToggleSelectedOptions } from "./features/row-selection/rowSelectionFeature.types.cjs";
27
27
  import { Row_CoreProperties, Row_Row, TableOptions_Rows, Table_Rows } from "./core/rows/coreRowsFeature.types.cjs";
28
28
  import { Row, Row_Core, Row_FeatureMap } from "./types/Row.cjs";
29
29
  import { BuiltInFilterFn, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns } from "./fns/filterFns.cjs";
@@ -76,4 +76,4 @@ import { createGroupedRowModel } from "./features/column-grouping/createGroupedR
76
76
  import { createExpandedRowModel, expandRows } from "./features/row-expanding/createExpandedRowModel.cjs";
77
77
  import { createPaginatedRowModel } from "./features/row-pagination/createPaginatedRowModel.cjs";
78
78
  import { createSortedRowModel } from "./features/row-sorting/createSortedRowModel.cjs";
79
- export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationFn, AggregationFnOption, AggregationFns, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, Cell_Cell, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Column, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnIndexes, ColumnMeta, ColumnOffsets, ColumnOffsetsByPosition, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_RowSorting, CoreFeatures, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractAggregationFnKeys, ExtractColumnMeta, ExtractFeatureMapTypes, ExtractFilterFnKeys, ExtractFilterMeta, ExtractSortFnKeys, ExtractTableMeta, FeatureSlotPrereqs, FilterFn, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, IsAny, NoInfer, NonFeatureKeys, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_ColumnGrouping, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SortDirection, SortFn, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_GlobalFiltering, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, TransformFilterValueFn, UnionToIntersection, Updater, ValidateFeatureSlots, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, copyInstancePropertiesWithoutMemos, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
79
+ export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationFn, AggregationFnOption, AggregationFns, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, Cell_Cell, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Column, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnIndexes, ColumnMeta, ColumnOffsets, ColumnOffsetsByPosition, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_RowSorting, CoreFeatures, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractAggregationFnKeys, ExtractColumnMeta, ExtractFeatureMapTypes, ExtractFilterFnKeys, ExtractFilterMeta, ExtractSortFnKeys, ExtractTableMeta, FeatureSlotPrereqs, FilterFn, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, IsAny, NoInfer, NonFeatureKeys, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_ColumnGrouping, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SortDirection, SortFn, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_GlobalFiltering, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, ToggleSelectedOptions, TransformFilterValueFn, UnionToIntersection, Updater, ValidateFeatureSlots, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, copyInstancePropertiesWithoutMemos, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ import { Cell, Cell_Core, Cell_FeatureMap } from "./types/Cell.js";
23
23
  import { ColumnDef_ColumnVisibility, ColumnVisibilityState, Column_ColumnVisibility, Row_ColumnVisibility, TableOptions_ColumnVisibility, TableState_ColumnVisibility, Table_ColumnVisibility, VisibilityDefaultOptions } from "./features/column-visibility/columnVisibilityFeature.types.js";
24
24
  import { CachedRowModel_Expanded, ExpandedState, ExpandedStateList, Row_RowExpanding, TableOptions_RowExpanding, TableState_RowExpanding, Table_RowExpanding, Table_RowModels_Expanded } from "./features/row-expanding/rowExpandingFeature.types.js";
25
25
  import { RowPinningDefaultOptions, RowPinningPosition, RowPinningState, Row_RowPinning, TableOptions_RowPinning, TableState_RowPinning, Table_RowPinning } from "./features/row-pinning/rowPinningFeature.types.js";
26
- import { RowSelectionState, Row_RowSelection, TableOptions_RowSelection, TableState_RowSelection, Table_RowSelection } from "./features/row-selection/rowSelectionFeature.types.js";
26
+ import { RowSelectionState, Row_RowSelection, TableOptions_RowSelection, TableState_RowSelection, Table_RowSelection, ToggleSelectedOptions } from "./features/row-selection/rowSelectionFeature.types.js";
27
27
  import { Row_CoreProperties, Row_Row, TableOptions_Rows, Table_Rows } from "./core/rows/coreRowsFeature.types.js";
28
28
  import { Row, Row_Core, Row_FeatureMap } from "./types/Row.js";
29
29
  import { BuiltInFilterFn, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns } from "./fns/filterFns.js";
@@ -76,4 +76,4 @@ import { createGroupedRowModel } from "./features/column-grouping/createGroupedR
76
76
  import { createExpandedRowModel, expandRows } from "./features/row-expanding/createExpandedRowModel.js";
77
77
  import { createPaginatedRowModel } from "./features/row-pagination/createPaginatedRowModel.js";
78
78
  import { createSortedRowModel } from "./features/row-sorting/createSortedRowModel.js";
79
- export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationFn, AggregationFnOption, AggregationFns, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, Cell_Cell, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Column, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnIndexes, ColumnMeta, ColumnOffsets, ColumnOffsetsByPosition, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_RowSorting, CoreFeatures, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractAggregationFnKeys, ExtractColumnMeta, ExtractFeatureMapTypes, ExtractFilterFnKeys, ExtractFilterMeta, ExtractSortFnKeys, ExtractTableMeta, FeatureSlotPrereqs, FilterFn, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, IsAny, NoInfer, NonFeatureKeys, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_ColumnGrouping, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SortDirection, SortFn, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_GlobalFiltering, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, TransformFilterValueFn, UnionToIntersection, Updater, ValidateFeatureSlots, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, copyInstancePropertiesWithoutMemos, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
79
+ export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationFn, AggregationFnOption, AggregationFns, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, Cell_Cell, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Column, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnIndexes, ColumnMeta, ColumnOffsets, ColumnOffsetsByPosition, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_RowSorting, CoreFeatures, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractAggregationFnKeys, ExtractColumnMeta, ExtractFeatureMapTypes, ExtractFilterFnKeys, ExtractFilterMeta, ExtractSortFnKeys, ExtractTableMeta, FeatureSlotPrereqs, FilterFn, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, IsAny, NoInfer, NonFeatureKeys, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_ColumnGrouping, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SortDirection, SortFn, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_GlobalFiltering, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, ToggleSelectedOptions, TransformFilterValueFn, UnionToIntersection, Updater, ValidateFeatureSlots, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructCell, constructColumn, constructHeader, constructRow, constructTable, copyInstancePropertiesWithoutMemos, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
@@ -106,6 +106,7 @@ exports.row_getCanPin = require_rowPinningFeature_utils.row_getCanPin;
106
106
  exports.row_getCanSelect = require_rowSelectionFeature_utils.row_getCanSelect;
107
107
  exports.row_getCanSelectSubRows = require_rowSelectionFeature_utils.row_getCanSelectSubRows;
108
108
  exports.row_getCenterVisibleCells = require_columnPinningFeature_utils.row_getCenterVisibleCells;
109
+ exports.row_getDisplayIndex = require_coreRowsFeature_utils.row_getDisplayIndex;
109
110
  exports.row_getEndVisibleCells = require_columnPinningFeature_utils.row_getEndVisibleCells;
110
111
  exports.row_getGroupingValue = require_columnGroupingFeature_utils.row_getGroupingValue;
111
112
  exports.row_getIsAllParentsExpanded = require_rowExpandingFeature_utils.row_getIsAllParentsExpanded;
@@ -205,6 +206,7 @@ exports.table_getRow = require_coreRowsFeature_utils.table_getRow;
205
206
  exports.table_getRowCount = require_rowPaginationFeature_utils.table_getRowCount;
206
207
  exports.table_getRowId = require_coreRowsFeature_utils.table_getRowId;
207
208
  exports.table_getRowModel = require_coreRowModelsFeature_utils.table_getRowModel;
209
+ exports.table_getRowsInDisplayOrder = require_coreRowsFeature_utils.table_getRowsInDisplayOrder;
208
210
  exports.table_getSelectedRowIds = require_rowSelectionFeature_utils.table_getSelectedRowIds;
209
211
  exports.table_getSelectedRowModel = require_rowSelectionFeature_utils.table_getSelectedRowModel;
210
212
  exports.table_getSortedRowModel = require_coreRowModelsFeature_utils.table_getSortedRowModel;