@tanstack/table-core 9.0.0-alpha.52 → 9.0.0-alpha.54

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 (86) hide show
  1. package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
  2. package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
  3. package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
  4. package/dist/core/headers/buildHeaderGroups.js.map +1 -1
  5. package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
  6. package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
  7. package/dist/core/reactivity/coreReactivityFeature.types.d.cts +7 -1
  8. package/dist/core/reactivity/coreReactivityFeature.types.d.ts +7 -1
  9. package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
  10. package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
  11. package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
  12. package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
  13. package/dist/core/table/constructTable.cjs +17 -0
  14. package/dist/core/table/constructTable.cjs.map +1 -1
  15. package/dist/core/table/constructTable.js +17 -0
  16. package/dist/core/table/constructTable.js.map +1 -1
  17. package/dist/core/table/coreTablesFeature.utils.cjs +8 -1
  18. package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
  19. package/dist/core/table/coreTablesFeature.utils.js +8 -1
  20. package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
  21. package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
  22. package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
  23. package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
  24. package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
  25. package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
  26. package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
  27. package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
  28. package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
  29. package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
  30. package/dist/features/column-faceting/createFacetedUniqueValues.js.map +1 -1
  31. package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
  32. package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
  33. package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
  34. package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
  35. package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
  36. package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
  37. package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
  38. package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
  39. package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
  40. package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
  41. package/dist/features/column-pinning/columnPinningFeature.cjs +27 -12
  42. package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
  43. package/dist/features/column-pinning/columnPinningFeature.js +27 -12
  44. package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
  45. package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
  46. package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
  47. package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
  48. package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
  49. package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
  50. package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
  51. package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
  52. package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
  53. package/dist/features/global-filtering/globalFilteringFeature.cjs.map +1 -1
  54. package/dist/features/global-filtering/globalFilteringFeature.js.map +1 -1
  55. package/dist/features/row-expanding/createExpandedRowModel.cjs.map +1 -1
  56. package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
  57. package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
  58. package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
  59. package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
  60. package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
  61. package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
  62. package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
  63. package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
  64. package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
  65. package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
  66. package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
  67. package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
  68. package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
  69. package/dist/fns/aggregationFns.cjs.map +1 -1
  70. package/dist/fns/aggregationFns.js.map +1 -1
  71. package/dist/fns/filterFns.cjs.map +1 -1
  72. package/dist/fns/filterFns.js.map +1 -1
  73. package/dist/fns/sortFns.cjs.map +1 -1
  74. package/dist/fns/sortFns.js.map +1 -1
  75. package/dist/store-reactivity-bindings.cjs +7 -0
  76. package/dist/store-reactivity-bindings.cjs.map +1 -1
  77. package/dist/store-reactivity-bindings.js +7 -0
  78. package/dist/store-reactivity-bindings.js.map +1 -1
  79. package/dist/utils.cjs.map +1 -1
  80. package/dist/utils.js.map +1 -1
  81. package/package.json +1 -1
  82. package/src/core/reactivity/coreReactivityFeature.types.ts +12 -1
  83. package/src/core/table/constructTable.ts +24 -1
  84. package/src/core/table/coreTablesFeature.utils.ts +11 -1
  85. package/src/features/column-pinning/columnPinningFeature.ts +6 -0
  86. package/src/store-reactivity-bindings.ts +11 -0
@@ -1 +1 @@
1
- {"version":3,"file":"constructTable.cjs","names":["cloneState","coreFeatures","atomToStore"],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions._features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions._features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature<{}>> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState<TFeatures>\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n // create writable base atom\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtom = table.options.atoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key].get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures>\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n snapshot[key] = table.atoms[key].get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options._rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,qBACd,UACA,eAA2D,CAAC,GACrC;CACvB,OAAO,OAAO,QAAQ,EAAE,SAA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E,WAAW,eAAe,MAAM,CACpC;CACF;CAEA,mEAAmC,KAAK;CAExC,MAAM,QAAQC,gDACZ,YAAY,yBACJ;EACJ,MAAM,WAAW,CAAC;EAClB,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;GACzC,MAAM,MAAM,UAAU;GACtB,SAAS,OAAO,MAAM,MAAM,KAAK,IAAI;EACvC;EACA,OAAO;CACT,GACA,EAAE,WAAW,cAAc,CAC7B,CACF;CAEA,IACE,QAAQ,IAAI,aAAa,kBACxB,aAAa,YAAY,aAAa,aACvC;EACA,MAAM,WAAW,OAAO,KAAK,MAAM,SAAS;EAC5C,MAAM,YAAY,OAAO,KAAK,MAAM,QAAQ,cAAc,CAAC,CAAC;EAC5D,MAAM,SAAS,OAAO,KAAK,MAAM,YAAY;EAE7C,QAAQ,IACN;;gBAEU,SAAS,KAAK,kBAAkB,EAAE;;gBAElC,UAAU,SAAS,UAAU,KAAK,kBAAkB,IAAI,SAAS;;gBAEjE,OAAO,KAAK,kBAAkB,EAAE,KAC1C,EAAE,MAAM,CACV;CACF;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;;EAC5C,4CAAa,IAAI,iGAAqB,KAAK;CAC7C;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"constructTable.cjs","names":["cloneState","coreFeatures","atomToStore"],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions._features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions._features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature<{}>> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState<TFeatures>\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtom = table.options.atoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key].get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures>\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n snapshot[key] = table.atoms[key].get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options._rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,qBACd,UACA,eAA2D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ACV;CACF;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;;EAC5C,4CAAa,IAAI,iGAAqB,KAAK;CAC7C;CAEA,OAAO;AACT"}
@@ -42,6 +42,23 @@ function constructTable(tableOptions) {
42
42
  }, {}),
43
43
  ...tableOptions
44
44
  };
45
+ if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {
46
+ const atom = _atom;
47
+ const wrappedAtom = _reactivity.createWritableAtom(atom.get(), { debugName: `externalAtom/${atomKey}` });
48
+ mergedOptions.atoms[atomKey] = wrappedAtom;
49
+ let syncExternal = false;
50
+ const syncAtomToWrappedSub = atom.subscribe((value) => {
51
+ if (syncExternal) return;
52
+ wrappedAtom.set(value);
53
+ });
54
+ const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {
55
+ syncExternal = true;
56
+ atom.set(value);
57
+ syncExternal = false;
58
+ });
59
+ _reactivity.addSubscription(syncAtomToWrappedSub);
60
+ _reactivity.addSubscription(syncWrappedToAtomSub);
61
+ }
45
62
  if (_reactivity.createOptionsStore) {
46
63
  table.optionsStore = _reactivity.createWritableAtom(mergedOptions, { debugName: "table/optionsStore" });
47
64
  Object.defineProperty(table, "options", {
@@ -1 +1 @@
1
- {"version":3,"file":"constructTable.js","names":[],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions._features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions._features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature<{}>> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState<TFeatures>\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n // create writable base atom\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtom = table.options.atoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key].get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures>\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n snapshot[key] = table.atoms[key].get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options._rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,qBACd,UACA,eAA2D,CAAC,GACrC;CACvB,OAAO,OAAO,QAAQ,EAAE,SAAS,YAAY;;EAC3C,yCAAe,QAAQ,6GAAkB,YAAY,MAAK;CAC5D,CAAC;CACD,OAAO,WAAW,YAAY;AAChC;;;;;;AAOA,SAAgB,eAGd,cAAuE;CACvE,MAAM,cAAc,aAAa,UAAU;CAE3C,MAAM,QAAQ;EACZ;EACA,WAAW;GAAE,GAAG;GAAc,GAAG,aAAa;EAAU;EACxD,YAAY,CAAC;EACb,cAAc,CAAC;EACf,WAAW,CAAC;EACZ,OAAO,CAAC;CACV;CAEA,MAAM,eAAwC,OAAO,OAAO,MAAM,SAAS;CAM3E,MAAM,gBAAgB;EAAE,GAJD,aAAa,QAAQ,KAAK,YAAY;;GAC3D,OAAO,OAAO,OAAO,8BAAK,QAAQ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,CAAC;EAC5D,MAAM,SAAS,OAAO,KAAK,MAAM,YAAY;EAE7C,QAAQ,IACN;;gBAEU,SAAS,KAAK,kBAAkB,EAAE;;gBAElC,UAAU,SAAS,UAAU,KAAK,kBAAkB,IAAI,SAAS;;gBAEjE,OAAO,KAAK,kBAAkB,EAAE,KAC1C,EAAE,MAAM,CACV;CACF;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;;EAC5C,4CAAa,IAAI,iGAAqB,KAAK;CAC7C;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"constructTable.js","names":[],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions._features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions._features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature<{}>> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState<TFeatures>\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtom = table.options.atoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key].get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures>\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n snapshot[key] = table.atoms[key].get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.keys(table.options._rowModels || {})\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,qBACd,UACA,eAA2D,CAAC,GACrC;CACvB,OAAO,OAAO,QAAQ,CAAC,CAAC,SAAS,YAAY;;EAC3C,yCAAe,QAAQ,6GAAkB,YAAY,MAAK;CAC5D,CAAC;CACD,OAAO,WAAW,YAAY;AAChC;;;;;;AAOA,SAAgB,eAGd,cAAuE;CACvE,MAAM,cAAc,aAAa,UAAU;CAE3C,MAAM,QAAQ;EACZ;EACA,WAAW;GAAE,GAAG;GAAc,GAAG,aAAa;EAAU;EACxD,YAAY,CAAC;EACb,cAAc,CAAC;EACf,WAAW,CAAC;EACZ,OAAO,CAAC;CACV;CAEA,MAAM,eAAwC,OAAO,OAAO,MAAM,SAAS;CAM3E,MAAM,gBAAgB;EAAE,GAJD,aAAa,QAAQ,KAAK,YAAY;;GAC3D,OAAO,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,cACF,OAAO,aAAa,IAAI;GAE1B,OAAO,MAAM,UAAU,IAAI,CAAC,IAAI;EAClC,GACA,EAAE,WAAW,eAAe,MAAM,CACpC;CACF;CAEA,mCAAmC,KAAK;CAExC,MAAM,QAAQ,YACZ,YAAY,yBACJ;EACJ,MAAM,WAAW,CAAC;EAClB,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;GACzC,MAAM,MAAM,UAAU;GACtB,SAAS,OAAO,MAAM,MAAM,IAAI,CAAC,IAAI;EACvC;EACA,OAAO;CACT,GACA,EAAE,WAAW,cAAc,CAC7B,CACF;CAEA,IACE,QAAQ,IAAI,aAAa,kBACxB,aAAa,YAAY,aAAa,aACvC;EACA,MAAM,WAAW,OAAO,KAAK,MAAM,SAAS;EAC5C,MAAM,YAAY,OAAO,KAAK,MAAM,QAAQ,cAAc,CAAC,CAAC;EAC5D,MAAM,SAAS,OAAO,KAAK,MAAM,YAAY;EAE7C,QAAQ,IACN;;gBAEU,SAAS,KAAK,kBAAkB,EAAE;;gBAElC,UAAU,SAAS,UAAU,KAAK,kBAAkB,IAAI,SAAS;;gBAEjE,OAAO,KAAK,kBAAkB,EAAE,KAC1C,EAAE,MAAM,CACV;CACF;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;;EAC5C,4CAAa,IAAI,iGAAqB,KAAK;CAC7C;CAEA,OAAO;AACT"}
@@ -75,7 +75,14 @@ function table_mergeOptions(table, newOptions) {
75
75
  * ```
76
76
  */
77
77
  function table_setOptions(table, updater) {
78
- const mergedOptions = table_mergeOptions(table, require_utils.functionalUpdate(updater, table.options));
78
+ const newOptions = require_utils.functionalUpdate(updater, table.options);
79
+ const { _rowModels, _features, atoms, initialState } = table.options;
80
+ const mergedOptions = Object.assign(table_mergeOptions(table, newOptions), {
81
+ _rowModels,
82
+ _features,
83
+ atoms,
84
+ initialState
85
+ });
79
86
  if (table.optionsStore) table.optionsStore.set(() => mergedOptions);
80
87
  else table.options = mergedOptions;
81
88
  table_syncExternalStateToBaseAtoms(table);
@@ -1 +1 @@
1
- {"version":3,"file":"coreTablesFeature.utils.cjs","names":["cloneState","functionalUpdate"],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\n/**\n * Synchronizes externally controlled state slices into the table's base atoms.\n *\n * This keeps legacy `options.state` values reflected in the atom graph so\n * derived atoms, stores, and table APIs read a consistent snapshot.\n *\n * @example\n * ```ts\n * table_syncExternalStateToBaseAtoms(table)\n * ```\n */\nexport function table_syncExternalStateToBaseAtoms<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const state = table.options.state\n if (!state) {\n return\n }\n\n table._reactivity.batch(() => {\n for (const key in state) {\n const baseAtom = (table.baseAtoms as Record<string, any>)[key]\n if (!baseAtom) {\n continue\n }\n\n const externalState = state[key as keyof typeof state]\n if (externalState !== baseAtom.get()) {\n baseAtom.set(() => externalState)\n }\n }\n })\n}\n\n/**\n * Resets all internal table base atoms to `table.initialState`.\n *\n * This resets internally owned state slices in a single reactivity batch. Use\n * feature-specific reset APIs when a slice may be externally owned.\n *\n * @example\n * ```ts\n * table_reset(table)\n * ```\n */\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const snap = cloneState(table.initialState)\n table._reactivity.batch(() => {\n const keys = Object.keys(snap) as Array<keyof typeof snap>\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n ;(table.baseAtoms as any)[key].set(snap[key] as any)\n }\n })\n}\n\n/**\n * Merges new table options with the current resolved options.\n *\n * If `options.mergeOptions` is provided, it owns the merge behavior; otherwise\n * options are shallow-merged.\n *\n * @example\n * ```ts\n * const options = table_mergeOptions(table, nextOptions)\n * ```\n */\nexport function table_mergeOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n newOptions: TableOptions<TFeatures, TData>,\n) {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(table.options, newOptions)\n }\n\n return {\n ...table.options,\n ...newOptions,\n }\n}\n\n/**\n * Updates the table options object.\n *\n * The updater receives the current resolved options and the merged result is\n * immediately assigned to the table instance.\n *\n * @example\n * ```ts\n * table_setOptions(table, (old) => old)\n * ```\n */\nexport function table_setOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<TableOptions<TFeatures, TData>>,\n): void {\n const newOptions = functionalUpdate(updater, table.options)\n const mergedOptions = table_mergeOptions(table, newOptions)\n if (table.optionsStore) {\n table.optionsStore.set(() => mergedOptions)\n } else {\n table.options = mergedOptions\n }\n table_syncExternalStateToBaseAtoms(table)\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,mCAGd,OAA+C;CAC/C,MAAM,QAAQ,MAAM,QAAQ;CAC5B,IAAI,CAAC,OACH;CAGF,MAAM,YAAY,YAAY;EAC5B,KAAK,MAAM,OAAO,OAAO;GACvB,MAAM,WAAY,MAAM,UAAkC;GAC1D,IAAI,CAAC,UACH;GAGF,MAAM,gBAAgB,MAAM;GAC5B,IAAI,kBAAkB,SAAS,IAAI,GACjC,SAAS,UAAU,aAAa;EAEpC;CACF,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,YAGd,OAA+C;CAC/C,MAAM,OAAOA,yBAAW,MAAM,YAAY;CAC1C,MAAM,YAAY,YAAY;EAC5B,MAAM,OAAO,OAAO,KAAK,IAAI;EAC7B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,MAAM,KAAK;GAChB,AAAC,MAAM,UAAkB,KAAK,IAAI,KAAK,IAAW;EACrD;CACF,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,mBAId,OACA,YACA;CACA,IAAI,MAAM,QAAQ,cAChB,OAAO,MAAM,QAAQ,aAAa,MAAM,SAAS,UAAU;CAG7D,OAAO;EACL,GAAG,MAAM;EACT,GAAG;CACL;AACF;;;;;;;;;;;;AAaA,SAAgB,iBAId,OACA,SACM;CAEN,MAAM,gBAAgB,mBAAmB,OADtBC,+BAAiB,SAAS,MAAM,OACM,CAAC;CAC1D,IAAI,MAAM,cACR,MAAM,aAAa,UAAU,aAAa;MAE1C,MAAM,UAAU;CAElB,mCAAmC,KAAK;AAC1C"}
1
+ {"version":3,"file":"coreTablesFeature.utils.cjs","names":["cloneState","functionalUpdate"],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\n/**\n * Synchronizes externally controlled state slices into the table's base atoms.\n *\n * This keeps legacy `options.state` values reflected in the atom graph so\n * derived atoms, stores, and table APIs read a consistent snapshot.\n *\n * @example\n * ```ts\n * table_syncExternalStateToBaseAtoms(table)\n * ```\n */\nexport function table_syncExternalStateToBaseAtoms<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const state = table.options.state\n if (!state) {\n return\n }\n\n table._reactivity.batch(() => {\n for (const key in state) {\n const baseAtom = (table.baseAtoms as Record<string, any>)[key]\n if (!baseAtom) {\n continue\n }\n\n const externalState = state[key as keyof typeof state]\n if (externalState !== baseAtom.get()) {\n baseAtom.set(() => externalState)\n }\n }\n })\n}\n\n/**\n * Resets all internal table base atoms to `table.initialState`.\n *\n * This resets internally owned state slices in a single reactivity batch. Use\n * feature-specific reset APIs when a slice may be externally owned.\n *\n * @example\n * ```ts\n * table_reset(table)\n * ```\n */\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const snap = cloneState(table.initialState)\n table._reactivity.batch(() => {\n const keys = Object.keys(snap) as Array<keyof typeof snap>\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n ;(table.baseAtoms as any)[key].set(snap[key] as any)\n }\n })\n}\n\n/**\n * Merges new table options with the current resolved options.\n *\n * If `options.mergeOptions` is provided, it owns the merge behavior; otherwise\n * options are shallow-merged.\n *\n * @example\n * ```ts\n * const options = table_mergeOptions(table, nextOptions)\n * ```\n */\nexport function table_mergeOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n newOptions: TableOptions<TFeatures, TData>,\n) {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(table.options, newOptions)\n }\n\n return {\n ...table.options,\n ...newOptions,\n }\n}\n\n/**\n * Updates the table options object.\n *\n * The updater receives the current resolved options and the merged result is\n * immediately assigned to the table instance.\n *\n * @example\n * ```ts\n * table_setOptions(table, (old) => old)\n * ```\n */\nexport function table_setOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<TableOptions<TFeatures, TData>>,\n): void {\n const newOptions = functionalUpdate(updater, table.options)\n // table static options that should never change after initialization\n const { _rowModels, _features, atoms, initialState } = table.options\n const mergedOptions = Object.assign(table_mergeOptions(table, newOptions), {\n // Once the table instance is created those properties should never change after initialization,\n // so we assign them back preserving the `table_mergeOptions` object reference\n _rowModels,\n _features,\n atoms,\n initialState,\n })\n\n if (table.optionsStore) {\n table.optionsStore.set(() => mergedOptions)\n } else {\n table.options = mergedOptions\n }\n table_syncExternalStateToBaseAtoms(table)\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,mCAGd,OAA+C;CAC/C,MAAM,QAAQ,MAAM,QAAQ;CAC5B,IAAI,CAAC,OACH;CAGF,MAAM,YAAY,YAAY;EAC5B,KAAK,MAAM,OAAO,OAAO;GACvB,MAAM,WAAY,MAAM,UAAkC;GAC1D,IAAI,CAAC,UACH;GAGF,MAAM,gBAAgB,MAAM;GAC5B,IAAI,kBAAkB,SAAS,IAAI,GACjC,SAAS,UAAU,aAAa;EAEpC;CACF,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,YAGd,OAA+C;CAC/C,MAAM,OAAOA,yBAAW,MAAM,YAAY;CAC1C,MAAM,YAAY,YAAY;EAC5B,MAAM,OAAO,OAAO,KAAK,IAAI;EAC7B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,MAAM,KAAK;GAChB,AAAC,MAAM,UAAkB,IAAI,CAAC,IAAI,KAAK,IAAW;EACrD;CACF,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,mBAId,OACA,YACA;CACA,IAAI,MAAM,QAAQ,cAChB,OAAO,MAAM,QAAQ,aAAa,MAAM,SAAS,UAAU;CAG7D,OAAO;EACL,GAAG,MAAM;EACT,GAAG;CACL;AACF;;;;;;;;;;;;AAaA,SAAgB,iBAId,OACA,SACM;CACN,MAAM,aAAaC,+BAAiB,SAAS,MAAM,OAAO;CAE1D,MAAM,EAAE,YAAY,WAAW,OAAO,iBAAiB,MAAM;CAC7D,MAAM,gBAAgB,OAAO,OAAO,mBAAmB,OAAO,UAAU,GAAG;EAGzE;EACA;EACA;EACA;CACF,CAAC;CAED,IAAI,MAAM,cACR,MAAM,aAAa,UAAU,aAAa;MAE1C,MAAM,UAAU;CAElB,mCAAmC,KAAK;AAC1C"}
@@ -75,7 +75,14 @@ function table_mergeOptions(table, newOptions) {
75
75
  * ```
76
76
  */
77
77
  function table_setOptions(table, updater) {
78
- const mergedOptions = table_mergeOptions(table, functionalUpdate(updater, table.options));
78
+ const newOptions = functionalUpdate(updater, table.options);
79
+ const { _rowModels, _features, atoms, initialState } = table.options;
80
+ const mergedOptions = Object.assign(table_mergeOptions(table, newOptions), {
81
+ _rowModels,
82
+ _features,
83
+ atoms,
84
+ initialState
85
+ });
79
86
  if (table.optionsStore) table.optionsStore.set(() => mergedOptions);
80
87
  else table.options = mergedOptions;
81
88
  table_syncExternalStateToBaseAtoms(table);
@@ -1 +1 @@
1
- {"version":3,"file":"coreTablesFeature.utils.js","names":[],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\n/**\n * Synchronizes externally controlled state slices into the table's base atoms.\n *\n * This keeps legacy `options.state` values reflected in the atom graph so\n * derived atoms, stores, and table APIs read a consistent snapshot.\n *\n * @example\n * ```ts\n * table_syncExternalStateToBaseAtoms(table)\n * ```\n */\nexport function table_syncExternalStateToBaseAtoms<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const state = table.options.state\n if (!state) {\n return\n }\n\n table._reactivity.batch(() => {\n for (const key in state) {\n const baseAtom = (table.baseAtoms as Record<string, any>)[key]\n if (!baseAtom) {\n continue\n }\n\n const externalState = state[key as keyof typeof state]\n if (externalState !== baseAtom.get()) {\n baseAtom.set(() => externalState)\n }\n }\n })\n}\n\n/**\n * Resets all internal table base atoms to `table.initialState`.\n *\n * This resets internally owned state slices in a single reactivity batch. Use\n * feature-specific reset APIs when a slice may be externally owned.\n *\n * @example\n * ```ts\n * table_reset(table)\n * ```\n */\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const snap = cloneState(table.initialState)\n table._reactivity.batch(() => {\n const keys = Object.keys(snap) as Array<keyof typeof snap>\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n ;(table.baseAtoms as any)[key].set(snap[key] as any)\n }\n })\n}\n\n/**\n * Merges new table options with the current resolved options.\n *\n * If `options.mergeOptions` is provided, it owns the merge behavior; otherwise\n * options are shallow-merged.\n *\n * @example\n * ```ts\n * const options = table_mergeOptions(table, nextOptions)\n * ```\n */\nexport function table_mergeOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n newOptions: TableOptions<TFeatures, TData>,\n) {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(table.options, newOptions)\n }\n\n return {\n ...table.options,\n ...newOptions,\n }\n}\n\n/**\n * Updates the table options object.\n *\n * The updater receives the current resolved options and the merged result is\n * immediately assigned to the table instance.\n *\n * @example\n * ```ts\n * table_setOptions(table, (old) => old)\n * ```\n */\nexport function table_setOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<TableOptions<TFeatures, TData>>,\n): void {\n const newOptions = functionalUpdate(updater, table.options)\n const mergedOptions = table_mergeOptions(table, newOptions)\n if (table.optionsStore) {\n table.optionsStore.set(() => mergedOptions)\n } else {\n table.options = mergedOptions\n }\n table_syncExternalStateToBaseAtoms(table)\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,mCAGd,OAA+C;CAC/C,MAAM,QAAQ,MAAM,QAAQ;CAC5B,IAAI,CAAC,OACH;CAGF,MAAM,YAAY,YAAY;EAC5B,KAAK,MAAM,OAAO,OAAO;GACvB,MAAM,WAAY,MAAM,UAAkC;GAC1D,IAAI,CAAC,UACH;GAGF,MAAM,gBAAgB,MAAM;GAC5B,IAAI,kBAAkB,SAAS,IAAI,GACjC,SAAS,UAAU,aAAa;EAEpC;CACF,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,YAGd,OAA+C;CAC/C,MAAM,OAAO,WAAW,MAAM,YAAY;CAC1C,MAAM,YAAY,YAAY;EAC5B,MAAM,OAAO,OAAO,KAAK,IAAI;EAC7B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,MAAM,KAAK;GAChB,AAAC,MAAM,UAAkB,KAAK,IAAI,KAAK,IAAW;EACrD;CACF,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,mBAId,OACA,YACA;CACA,IAAI,MAAM,QAAQ,cAChB,OAAO,MAAM,QAAQ,aAAa,MAAM,SAAS,UAAU;CAG7D,OAAO;EACL,GAAG,MAAM;EACT,GAAG;CACL;AACF;;;;;;;;;;;;AAaA,SAAgB,iBAId,OACA,SACM;CAEN,MAAM,gBAAgB,mBAAmB,OADtB,iBAAiB,SAAS,MAAM,OACM,CAAC;CAC1D,IAAI,MAAM,cACR,MAAM,aAAa,UAAU,aAAa;MAE1C,MAAM,UAAU;CAElB,mCAAmC,KAAK;AAC1C"}
1
+ {"version":3,"file":"coreTablesFeature.utils.js","names":[],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\n/**\n * Synchronizes externally controlled state slices into the table's base atoms.\n *\n * This keeps legacy `options.state` values reflected in the atom graph so\n * derived atoms, stores, and table APIs read a consistent snapshot.\n *\n * @example\n * ```ts\n * table_syncExternalStateToBaseAtoms(table)\n * ```\n */\nexport function table_syncExternalStateToBaseAtoms<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const state = table.options.state\n if (!state) {\n return\n }\n\n table._reactivity.batch(() => {\n for (const key in state) {\n const baseAtom = (table.baseAtoms as Record<string, any>)[key]\n if (!baseAtom) {\n continue\n }\n\n const externalState = state[key as keyof typeof state]\n if (externalState !== baseAtom.get()) {\n baseAtom.set(() => externalState)\n }\n }\n })\n}\n\n/**\n * Resets all internal table base atoms to `table.initialState`.\n *\n * This resets internally owned state slices in a single reactivity batch. Use\n * feature-specific reset APIs when a slice may be externally owned.\n *\n * @example\n * ```ts\n * table_reset(table)\n * ```\n */\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const snap = cloneState(table.initialState)\n table._reactivity.batch(() => {\n const keys = Object.keys(snap) as Array<keyof typeof snap>\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n ;(table.baseAtoms as any)[key].set(snap[key] as any)\n }\n })\n}\n\n/**\n * Merges new table options with the current resolved options.\n *\n * If `options.mergeOptions` is provided, it owns the merge behavior; otherwise\n * options are shallow-merged.\n *\n * @example\n * ```ts\n * const options = table_mergeOptions(table, nextOptions)\n * ```\n */\nexport function table_mergeOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n newOptions: TableOptions<TFeatures, TData>,\n) {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(table.options, newOptions)\n }\n\n return {\n ...table.options,\n ...newOptions,\n }\n}\n\n/**\n * Updates the table options object.\n *\n * The updater receives the current resolved options and the merged result is\n * immediately assigned to the table instance.\n *\n * @example\n * ```ts\n * table_setOptions(table, (old) => old)\n * ```\n */\nexport function table_setOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<TableOptions<TFeatures, TData>>,\n): void {\n const newOptions = functionalUpdate(updater, table.options)\n // table static options that should never change after initialization\n const { _rowModels, _features, atoms, initialState } = table.options\n const mergedOptions = Object.assign(table_mergeOptions(table, newOptions), {\n // Once the table instance is created those properties should never change after initialization,\n // so we assign them back preserving the `table_mergeOptions` object reference\n _rowModels,\n _features,\n atoms,\n initialState,\n })\n\n if (table.optionsStore) {\n table.optionsStore.set(() => mergedOptions)\n } else {\n table.options = mergedOptions\n }\n table_syncExternalStateToBaseAtoms(table)\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,mCAGd,OAA+C;CAC/C,MAAM,QAAQ,MAAM,QAAQ;CAC5B,IAAI,CAAC,OACH;CAGF,MAAM,YAAY,YAAY;EAC5B,KAAK,MAAM,OAAO,OAAO;GACvB,MAAM,WAAY,MAAM,UAAkC;GAC1D,IAAI,CAAC,UACH;GAGF,MAAM,gBAAgB,MAAM;GAC5B,IAAI,kBAAkB,SAAS,IAAI,GACjC,SAAS,UAAU,aAAa;EAEpC;CACF,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,YAGd,OAA+C;CAC/C,MAAM,OAAO,WAAW,MAAM,YAAY;CAC1C,MAAM,YAAY,YAAY;EAC5B,MAAM,OAAO,OAAO,KAAK,IAAI;EAC7B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,MAAM,KAAK;GAChB,AAAC,MAAM,UAAkB,IAAI,CAAC,IAAI,KAAK,IAAW;EACrD;CACF,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,mBAId,OACA,YACA;CACA,IAAI,MAAM,QAAQ,cAChB,OAAO,MAAM,QAAQ,aAAa,MAAM,SAAS,UAAU;CAG7D,OAAO;EACL,GAAG,MAAM;EACT,GAAG;CACL;AACF;;;;;;;;;;;;AAaA,SAAgB,iBAId,OACA,SACM;CACN,MAAM,aAAa,iBAAiB,SAAS,MAAM,OAAO;CAE1D,MAAM,EAAE,YAAY,WAAW,OAAO,iBAAiB,MAAM;CAC7D,MAAM,gBAAgB,OAAO,OAAO,mBAAmB,OAAO,UAAU,GAAG;EAGzE;EACA;EACA;EACA;CACF,CAAC;CAED,IAAI,MAAM,cACR,MAAM,aAAa,UAAU,aAAa;MAE1C,MAAM,UAAU;CAElB,mCAAmC,KAAK;AAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"columnFacetingFeature.cjs","names":["column_getFacetedRowModel","callMemoOrStaticFn","column_getFacetedMinMaxValues","column_getFacetedUniqueValues","table_getGlobalFacetedRowModel","table_getGlobalFacetedMinMaxValues","table_getGlobalFacetedUniqueValues"],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Column_Internal } from '../../types/Column'\n// import type {\n// CachedRowModel_Faceted,\n// Column_ColumnFaceting,\n// CreateRowModel_Faceted,\n// } from './columnFacetingFeature.types'\n\nexport interface ColumnFacetingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Faceted<TFeatures, TData>\n // Column: Column_ColumnFaceting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Faceted<TFeatures, TData>\n}\n\n/**\n * Creates the stock column faceting feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructColumnFacetingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<ColumnFacetingFeatureConstructors<TFeatures, TData>> {\n return {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n }\n}\n\n/**\n * The stock column faceting feature.\n *\n * Register this feature to add faceted row model, unique value, and min/max\n * helpers for column and global filter UIs.\n */\nexport const columnFacetingFeature = constructColumnFacetingFeature()\n"],"mappings":";;;;;;;;;AAoCA,SAAgB,iCAGuD;CACrE,OAAO;EACL,wBAAwB,WAAW,UAAU;GAC3C,kCAAoB,yBAAyB,WAAW,OAAO;IAC7D,2BAA2B;KACzB,gBAAgB;;;OACd,MAAM,uBAAuB,EAAE;gCAC/B,MAAM,MAAM,6FAAe,IAAI;gCAC/B,MAAM,MAAM,4FAAc,IAAI;OAC9B,MAAM,oBAAoB,EAAE;MAC9B;;KACA,KAAK,WAAWA,8DAA0B,QAAQ,OAAO,KAAK;IAChE;IACA,+BAA+B;KAC7B,WAAW,WAA8C,CACvDC,iCACE,QACA,sBACAD,+DACA,OAAO,KACT,EAAE,QACJ;KACA,KAAK,WAAWE,kEAA8B,QAAQ,OAAO,KAAK;IACpE;IACA,+BAA+B;KAC7B,WAAW,WAA8C,CACvDD,iCACE,QACA,sBACAD,+DACA,OAAO,KACT,EAAE,QACJ;KACA,KAAK,WAAWG,kEAA8B,QAAQ,OAAO,KAAK;IACpE;GACF,CAAC;EACH;EAEA,qBAAqB,UAAU;GAC7B,8BAAgB,yBAAyB,OAAO;IAC9C,gCAAgC;KAC9B,gBAAgB;;;OACd,MAAM,uBAAuB,EAAE;iCAC/B,MAAM,MAAM,+FAAe,IAAI;iCAC/B,MAAM,MAAM,8FAAc,IAAI;OAC9B,MAAM,oBAAoB,EAAE;MAC9B;;KACA,UAAUC,mEAA+B,KAAK;IAChD;IACA,oCAAoC;KAClC,gBAAgB,CACdH,iCACE,OACA,4BACAG,kEACF,EAAE,QACJ;KACA,UAAUC,uEAAmC,KAAK;IACpD;IACA,oCAAoC;KAClC,gBAAgB,CACdJ,iCACE,OACA,4BACAG,kEACF,EAAE,QACJ;KACA,UAAUE,uEAAmC,KAAK;IACpD;GACF,CAAC;EACH;CACF;AACF;;;;;;;AAQA,MAAa,wBAAwB,+BAA+B"}
1
+ {"version":3,"file":"columnFacetingFeature.cjs","names":["column_getFacetedRowModel","callMemoOrStaticFn","column_getFacetedMinMaxValues","column_getFacetedUniqueValues","table_getGlobalFacetedRowModel","table_getGlobalFacetedMinMaxValues","table_getGlobalFacetedUniqueValues"],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Column_Internal } from '../../types/Column'\n// import type {\n// CachedRowModel_Faceted,\n// Column_ColumnFaceting,\n// CreateRowModel_Faceted,\n// } from './columnFacetingFeature.types'\n\nexport interface ColumnFacetingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Faceted<TFeatures, TData>\n // Column: Column_ColumnFaceting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Faceted<TFeatures, TData>\n}\n\n/**\n * Creates the stock column faceting feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructColumnFacetingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<ColumnFacetingFeatureConstructors<TFeatures, TData>> {\n return {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n }\n}\n\n/**\n * The stock column faceting feature.\n *\n * Register this feature to add faceted row model, unique value, and min/max\n * helpers for column and global filter UIs.\n */\nexport const columnFacetingFeature = constructColumnFacetingFeature()\n"],"mappings":";;;;;;;;;AAoCA,SAAgB,iCAGuD;CACrE,OAAO;EACL,wBAAwB,WAAW,UAAU;GAC3C,kCAAoB,yBAAyB,WAAW,OAAO;IAC7D,2BAA2B;KACzB,gBAAgB;;;OACd,MAAM,uBAAuB,CAAC,CAAC;gCAC/B,MAAM,MAAM,6FAAe,IAAI;gCAC/B,MAAM,MAAM,4FAAc,IAAI;OAC9B,MAAM,oBAAoB,CAAC,CAAC;MAC9B;;KACA,KAAK,WAAWA,8DAA0B,QAAQ,OAAO,KAAK;IAChE;IACA,+BAA+B;KAC7B,WAAW,WAA8C,CACvDC,iCACE,QACA,sBACAD,+DACA,OAAO,KACT,CAAC,CAAC,QACJ;KACA,KAAK,WAAWE,kEAA8B,QAAQ,OAAO,KAAK;IACpE;IACA,+BAA+B;KAC7B,WAAW,WAA8C,CACvDD,iCACE,QACA,sBACAD,+DACA,OAAO,KACT,CAAC,CAAC,QACJ;KACA,KAAK,WAAWG,kEAA8B,QAAQ,OAAO,KAAK;IACpE;GACF,CAAC;EACH;EAEA,qBAAqB,UAAU;GAC7B,8BAAgB,yBAAyB,OAAO;IAC9C,gCAAgC;KAC9B,gBAAgB;;;OACd,MAAM,uBAAuB,CAAC,CAAC;iCAC/B,MAAM,MAAM,+FAAe,IAAI;iCAC/B,MAAM,MAAM,8FAAc,IAAI;OAC9B,MAAM,oBAAoB,CAAC,CAAC;MAC9B;;KACA,UAAUC,mEAA+B,KAAK;IAChD;IACA,oCAAoC;KAClC,gBAAgB,CACdH,iCACE,OACA,4BACAG,kEACF,CAAC,CAAC,QACJ;KACA,UAAUC,uEAAmC,KAAK;IACpD;IACA,oCAAoC;KAClC,gBAAgB,CACdJ,iCACE,OACA,4BACAG,kEACF,CAAC,CAAC,QACJ;KACA,UAAUE,uEAAmC,KAAK;IACpD;GACF,CAAC;EACH;CACF;AACF;;;;;;;AAQA,MAAa,wBAAwB,+BAA+B"}
@@ -1 +1 @@
1
- {"version":3,"file":"columnFacetingFeature.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Column_Internal } from '../../types/Column'\n// import type {\n// CachedRowModel_Faceted,\n// Column_ColumnFaceting,\n// CreateRowModel_Faceted,\n// } from './columnFacetingFeature.types'\n\nexport interface ColumnFacetingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Faceted<TFeatures, TData>\n // Column: Column_ColumnFaceting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Faceted<TFeatures, TData>\n}\n\n/**\n * Creates the stock column faceting feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructColumnFacetingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<ColumnFacetingFeatureConstructors<TFeatures, TData>> {\n return {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n }\n}\n\n/**\n * The stock column faceting feature.\n *\n * Register this feature to add faceted row model, unique value, and min/max\n * helpers for column and global filter UIs.\n */\nexport const columnFacetingFeature = constructColumnFacetingFeature()\n"],"mappings":";;;;;;;;;AAoCA,SAAgB,iCAGuD;CACrE,OAAO;EACL,wBAAwB,WAAW,UAAU;GAC3C,oBAAoB,yBAAyB,WAAW,OAAO;IAC7D,2BAA2B;KACzB,gBAAgB;;;OACd,MAAM,uBAAuB,EAAE;gCAC/B,MAAM,MAAM,6FAAe,IAAI;gCAC/B,MAAM,MAAM,4FAAc,IAAI;OAC9B,MAAM,oBAAoB,EAAE;MAC9B;;KACA,KAAK,WAAW,0BAA0B,QAAQ,OAAO,KAAK;IAChE;IACA,+BAA+B;KAC7B,WAAW,WAA8C,CACvD,mBACE,QACA,sBACA,2BACA,OAAO,KACT,EAAE,QACJ;KACA,KAAK,WAAW,8BAA8B,QAAQ,OAAO,KAAK;IACpE;IACA,+BAA+B;KAC7B,WAAW,WAA8C,CACvD,mBACE,QACA,sBACA,2BACA,OAAO,KACT,EAAE,QACJ;KACA,KAAK,WAAW,8BAA8B,QAAQ,OAAO,KAAK;IACpE;GACF,CAAC;EACH;EAEA,qBAAqB,UAAU;GAC7B,gBAAgB,yBAAyB,OAAO;IAC9C,gCAAgC;KAC9B,gBAAgB;;;OACd,MAAM,uBAAuB,EAAE;iCAC/B,MAAM,MAAM,+FAAe,IAAI;iCAC/B,MAAM,MAAM,8FAAc,IAAI;OAC9B,MAAM,oBAAoB,EAAE;MAC9B;;KACA,UAAU,+BAA+B,KAAK;IAChD;IACA,oCAAoC;KAClC,gBAAgB,CACd,mBACE,OACA,4BACA,8BACF,EAAE,QACJ;KACA,UAAU,mCAAmC,KAAK;IACpD;IACA,oCAAoC;KAClC,gBAAgB,CACd,mBACE,OACA,4BACA,8BACF,EAAE,QACJ;KACA,UAAU,mCAAmC,KAAK;IACpD;GACF,CAAC;EACH;CACF;AACF;;;;;;;AAQA,MAAa,wBAAwB,+BAA+B"}
1
+ {"version":3,"file":"columnFacetingFeature.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Column_Internal } from '../../types/Column'\n// import type {\n// CachedRowModel_Faceted,\n// Column_ColumnFaceting,\n// CreateRowModel_Faceted,\n// } from './columnFacetingFeature.types'\n\nexport interface ColumnFacetingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Faceted<TFeatures, TData>\n // Column: Column_ColumnFaceting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Faceted<TFeatures, TData>\n}\n\n/**\n * Creates the stock column faceting feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructColumnFacetingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<ColumnFacetingFeatureConstructors<TFeatures, TData>> {\n return {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n }\n}\n\n/**\n * The stock column faceting feature.\n *\n * Register this feature to add faceted row model, unique value, and min/max\n * helpers for column and global filter UIs.\n */\nexport const columnFacetingFeature = constructColumnFacetingFeature()\n"],"mappings":";;;;;;;;;AAoCA,SAAgB,iCAGuD;CACrE,OAAO;EACL,wBAAwB,WAAW,UAAU;GAC3C,oBAAoB,yBAAyB,WAAW,OAAO;IAC7D,2BAA2B;KACzB,gBAAgB;;;OACd,MAAM,uBAAuB,CAAC,CAAC;gCAC/B,MAAM,MAAM,6FAAe,IAAI;gCAC/B,MAAM,MAAM,4FAAc,IAAI;OAC9B,MAAM,oBAAoB,CAAC,CAAC;MAC9B;;KACA,KAAK,WAAW,0BAA0B,QAAQ,OAAO,KAAK;IAChE;IACA,+BAA+B;KAC7B,WAAW,WAA8C,CACvD,mBACE,QACA,sBACA,2BACA,OAAO,KACT,CAAC,CAAC,QACJ;KACA,KAAK,WAAW,8BAA8B,QAAQ,OAAO,KAAK;IACpE;IACA,+BAA+B;KAC7B,WAAW,WAA8C,CACvD,mBACE,QACA,sBACA,2BACA,OAAO,KACT,CAAC,CAAC,QACJ;KACA,KAAK,WAAW,8BAA8B,QAAQ,OAAO,KAAK;IACpE;GACF,CAAC;EACH;EAEA,qBAAqB,UAAU;GAC7B,gBAAgB,yBAAyB,OAAO;IAC9C,gCAAgC;KAC9B,gBAAgB;;;OACd,MAAM,uBAAuB,CAAC,CAAC;iCAC/B,MAAM,MAAM,+FAAe,IAAI;iCAC/B,MAAM,MAAM,8FAAc,IAAI;OAC9B,MAAM,oBAAoB,CAAC,CAAC;MAC9B;;KACA,UAAU,+BAA+B,KAAK;IAChD;IACA,oCAAoC;KAClC,gBAAgB,CACd,mBACE,OACA,4BACA,8BACF,CAAC,CAAC,QACJ;KACA,UAAU,mCAAmC,KAAK;IACpD;IACA,oCAAoC;KAClC,gBAAgB,CACd,mBACE,OACA,4BACA,8BACF,CAAC,CAAC,QACJ;KACA,UAAU,mCAAmC,KAAK;IACpD;GACF,CAAC;EACH;CACF;AACF;;;;;;;AAQA,MAAa,wBAAwB,+BAA+B"}
@@ -1 +1 @@
1
- {"version":3,"file":"columnFacetingFeature.utils.cjs","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.utils.ts"],"sourcesContent":["import type { CellData, RowData } 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 { Column_Internal } from '../../types/Column'\n\n/**\n * Computes min and max numeric facet values for one column.\n *\n * The configured `facetedMinMaxValues` row-model factory owns the calculation.\n * If no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = column_getFacetedMinMaxValues(column, table)\n * ```\n */\nexport function column_getFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): [number, number] | undefined {\n const facetedMinMaxValuesFn =\n table.options._rowModels?.facetedMinMaxValues?.(table, column.id) ??\n (() => undefined)\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive one column's facet values.\n *\n * The faceted row model normally applies every other active filter while\n * excluding this column's own filter. If no factory is registered, the\n * pre-filtered row model is returned.\n *\n * @example\n * ```ts\n * const rows = column_getFacetedRowModel(column, table)\n * ```\n */\nexport function column_getFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue> | undefined,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const facetedRowModelFn =\n table.options._rowModels?.facetedRowModel?.(table, column?.id ?? '') ??\n (() => table.getPreFilteredRowModel())\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique facet values and their occurrence counts for one column.\n *\n * The configured `facetedUniqueValues` row-model factory owns the calculation.\n * If no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = column_getFacetedUniqueValues(column, table)\n * ```\n */\nexport function column_getFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): Map<any, number> {\n const facetedUniqueValuesFn =\n table.options._rowModels?.facetedUniqueValues?.(table, column.id) ??\n (() => new Map<any, number>())\n return facetedUniqueValuesFn()\n}\n\n/**\n * Computes min and max numeric facet values for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = table_getGlobalFacetedMinMaxValues(table)\n * ```\n */\nexport function table_getGlobalFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): undefined | [number, number] {\n const facetedMinMaxValuesFn =\n table.options._rowModels?.facetedMinMaxValues?.(table, '__global__') ??\n (() => undefined)\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive global facet values.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no faceted row-model factory is registered, the pre-filtered row model is\n * returned.\n *\n * @example\n * ```ts\n * const rows = table_getGlobalFacetedRowModel(table)\n * ```\n */\nexport function table_getGlobalFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const facetedRowModelFn =\n table.options._rowModels?.facetedRowModel?.(table, '__global__') ??\n (() => table.getPreFilteredRowModel())\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique values and occurrence counts for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = table_getGlobalFacetedUniqueValues(table)\n * ```\n */\nexport function table_getGlobalFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Map<any, number> {\n const facetedUniqueValuesFn =\n table.options._rowModels?.facetedUniqueValues?.(table, '__global__') ??\n (() => new Map())\n return facetedUniqueValuesFn()\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAgB,8BAKd,QACA,OAC8B;;CAI9B,kCAFE,MAAM,QAAQ,4GAAY,iIAAsB,OAAO,OAAO,EAAE,aACzD,SACoB;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,0BAKd,QACA,OAC4B;;CAI5B,mCAFE,MAAM,QAAQ,8GAAY,8HAAkB,wDAAO,OAAQ,OAAM,EAAE,aAC5D,MAAM,uBAAuB,IACb;AAC3B;;;;;;;;;;;;AAaA,SAAgB,8BAKd,QACA,OACkB;;CAIlB,mCAFE,MAAM,QAAQ,8GAAY,kIAAsB,OAAO,OAAO,EAAE,6BACzD,IAAI,IAAiB,IACD;AAC/B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAAuE;;CAIvE,mCAFE,MAAM,QAAQ,8GAAY,kIAAsB,OAAO,YAAY,aAC5D,SACoB;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,+BAGd,OAAqE;;CAIrE,mCAFE,MAAM,QAAQ,+GAAY,gIAAkB,OAAO,YAAY,aACxD,MAAM,uBAAuB,IACb;AAC3B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAA2D;;CAI3D,oCAFE,MAAM,QAAQ,iHAAY,qIAAsB,OAAO,YAAY,6BAC5D,IAAI,IAAI,IACY;AAC/B"}
1
+ {"version":3,"file":"columnFacetingFeature.utils.cjs","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.utils.ts"],"sourcesContent":["import type { CellData, RowData } 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 { Column_Internal } from '../../types/Column'\n\n/**\n * Computes min and max numeric facet values for one column.\n *\n * The configured `facetedMinMaxValues` row-model factory owns the calculation.\n * If no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = column_getFacetedMinMaxValues(column, table)\n * ```\n */\nexport function column_getFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): [number, number] | undefined {\n const facetedMinMaxValuesFn =\n table.options._rowModels?.facetedMinMaxValues?.(table, column.id) ??\n (() => undefined)\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive one column's facet values.\n *\n * The faceted row model normally applies every other active filter while\n * excluding this column's own filter. If no factory is registered, the\n * pre-filtered row model is returned.\n *\n * @example\n * ```ts\n * const rows = column_getFacetedRowModel(column, table)\n * ```\n */\nexport function column_getFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue> | undefined,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const facetedRowModelFn =\n table.options._rowModels?.facetedRowModel?.(table, column?.id ?? '') ??\n (() => table.getPreFilteredRowModel())\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique facet values and their occurrence counts for one column.\n *\n * The configured `facetedUniqueValues` row-model factory owns the calculation.\n * If no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = column_getFacetedUniqueValues(column, table)\n * ```\n */\nexport function column_getFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): Map<any, number> {\n const facetedUniqueValuesFn =\n table.options._rowModels?.facetedUniqueValues?.(table, column.id) ??\n (() => new Map<any, number>())\n return facetedUniqueValuesFn()\n}\n\n/**\n * Computes min and max numeric facet values for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = table_getGlobalFacetedMinMaxValues(table)\n * ```\n */\nexport function table_getGlobalFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): undefined | [number, number] {\n const facetedMinMaxValuesFn =\n table.options._rowModels?.facetedMinMaxValues?.(table, '__global__') ??\n (() => undefined)\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive global facet values.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no faceted row-model factory is registered, the pre-filtered row model is\n * returned.\n *\n * @example\n * ```ts\n * const rows = table_getGlobalFacetedRowModel(table)\n * ```\n */\nexport function table_getGlobalFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const facetedRowModelFn =\n table.options._rowModels?.facetedRowModel?.(table, '__global__') ??\n (() => table.getPreFilteredRowModel())\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique values and occurrence counts for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = table_getGlobalFacetedUniqueValues(table)\n * ```\n */\nexport function table_getGlobalFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Map<any, number> {\n const facetedUniqueValuesFn =\n table.options._rowModels?.facetedUniqueValues?.(table, '__global__') ??\n (() => new Map())\n return facetedUniqueValuesFn()\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAgB,8BAKd,QACA,OAC8B;;CAI9B,kCAFE,MAAM,QAAQ,4GAAY,iIAAsB,OAAO,OAAO,EAAE,aACzD,QACmB,CAAC;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,0BAKd,QACA,OAC4B;;CAI5B,mCAFE,MAAM,QAAQ,8GAAY,8HAAkB,wDAAO,OAAQ,OAAM,EAAE,aAC5D,MAAM,uBAAuB,GACd,CAAC;AAC3B;;;;;;;;;;;;AAaA,SAAgB,8BAKd,QACA,OACkB;;CAIlB,mCAFE,MAAM,QAAQ,8GAAY,kIAAsB,OAAO,OAAO,EAAE,6BACzD,IAAI,IAAiB,GACF,CAAC;AAC/B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAAuE;;CAIvE,mCAFE,MAAM,QAAQ,8GAAY,kIAAsB,OAAO,YAAY,aAC5D,QACmB,CAAC;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,+BAGd,OAAqE;;CAIrE,mCAFE,MAAM,QAAQ,+GAAY,gIAAkB,OAAO,YAAY,aACxD,MAAM,uBAAuB,GACd,CAAC;AAC3B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAA2D;;CAI3D,oCAFE,MAAM,QAAQ,iHAAY,qIAAsB,OAAO,YAAY,6BAC5D,IAAI,IAAI,GACW,CAAC;AAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"columnFacetingFeature.utils.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.utils.ts"],"sourcesContent":["import type { CellData, RowData } 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 { Column_Internal } from '../../types/Column'\n\n/**\n * Computes min and max numeric facet values for one column.\n *\n * The configured `facetedMinMaxValues` row-model factory owns the calculation.\n * If no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = column_getFacetedMinMaxValues(column, table)\n * ```\n */\nexport function column_getFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): [number, number] | undefined {\n const facetedMinMaxValuesFn =\n table.options._rowModels?.facetedMinMaxValues?.(table, column.id) ??\n (() => undefined)\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive one column's facet values.\n *\n * The faceted row model normally applies every other active filter while\n * excluding this column's own filter. If no factory is registered, the\n * pre-filtered row model is returned.\n *\n * @example\n * ```ts\n * const rows = column_getFacetedRowModel(column, table)\n * ```\n */\nexport function column_getFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue> | undefined,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const facetedRowModelFn =\n table.options._rowModels?.facetedRowModel?.(table, column?.id ?? '') ??\n (() => table.getPreFilteredRowModel())\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique facet values and their occurrence counts for one column.\n *\n * The configured `facetedUniqueValues` row-model factory owns the calculation.\n * If no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = column_getFacetedUniqueValues(column, table)\n * ```\n */\nexport function column_getFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): Map<any, number> {\n const facetedUniqueValuesFn =\n table.options._rowModels?.facetedUniqueValues?.(table, column.id) ??\n (() => new Map<any, number>())\n return facetedUniqueValuesFn()\n}\n\n/**\n * Computes min and max numeric facet values for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = table_getGlobalFacetedMinMaxValues(table)\n * ```\n */\nexport function table_getGlobalFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): undefined | [number, number] {\n const facetedMinMaxValuesFn =\n table.options._rowModels?.facetedMinMaxValues?.(table, '__global__') ??\n (() => undefined)\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive global facet values.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no faceted row-model factory is registered, the pre-filtered row model is\n * returned.\n *\n * @example\n * ```ts\n * const rows = table_getGlobalFacetedRowModel(table)\n * ```\n */\nexport function table_getGlobalFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const facetedRowModelFn =\n table.options._rowModels?.facetedRowModel?.(table, '__global__') ??\n (() => table.getPreFilteredRowModel())\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique values and occurrence counts for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = table_getGlobalFacetedUniqueValues(table)\n * ```\n */\nexport function table_getGlobalFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Map<any, number> {\n const facetedUniqueValuesFn =\n table.options._rowModels?.facetedUniqueValues?.(table, '__global__') ??\n (() => new Map())\n return facetedUniqueValuesFn()\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,SAAgB,8BAKd,QACA,OAC8B;;CAI9B,kCAFE,MAAM,QAAQ,4GAAY,iIAAsB,OAAO,OAAO,EAAE,aACzD,SACoB;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,0BAKd,QACA,OAC4B;;CAI5B,mCAFE,MAAM,QAAQ,8GAAY,8HAAkB,wDAAO,OAAQ,OAAM,EAAE,aAC5D,MAAM,uBAAuB,IACb;AAC3B;;;;;;;;;;;;AAaA,SAAgB,8BAKd,QACA,OACkB;;CAIlB,mCAFE,MAAM,QAAQ,8GAAY,kIAAsB,OAAO,OAAO,EAAE,6BACzD,IAAI,IAAiB,IACD;AAC/B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAAuE;;CAIvE,mCAFE,MAAM,QAAQ,8GAAY,kIAAsB,OAAO,YAAY,aAC5D,SACoB;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,+BAGd,OAAqE;;CAIrE,mCAFE,MAAM,QAAQ,+GAAY,gIAAkB,OAAO,YAAY,aACxD,MAAM,uBAAuB,IACb;AAC3B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAA2D;;CAI3D,oCAFE,MAAM,QAAQ,iHAAY,qIAAsB,OAAO,YAAY,6BAC5D,IAAI,IAAI,IACY;AAC/B"}
1
+ {"version":3,"file":"columnFacetingFeature.utils.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.utils.ts"],"sourcesContent":["import type { CellData, RowData } 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 { Column_Internal } from '../../types/Column'\n\n/**\n * Computes min and max numeric facet values for one column.\n *\n * The configured `facetedMinMaxValues` row-model factory owns the calculation.\n * If no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = column_getFacetedMinMaxValues(column, table)\n * ```\n */\nexport function column_getFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): [number, number] | undefined {\n const facetedMinMaxValuesFn =\n table.options._rowModels?.facetedMinMaxValues?.(table, column.id) ??\n (() => undefined)\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive one column's facet values.\n *\n * The faceted row model normally applies every other active filter while\n * excluding this column's own filter. If no factory is registered, the\n * pre-filtered row model is returned.\n *\n * @example\n * ```ts\n * const rows = column_getFacetedRowModel(column, table)\n * ```\n */\nexport function column_getFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue> | undefined,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const facetedRowModelFn =\n table.options._rowModels?.facetedRowModel?.(table, column?.id ?? '') ??\n (() => table.getPreFilteredRowModel())\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique facet values and their occurrence counts for one column.\n *\n * The configured `facetedUniqueValues` row-model factory owns the calculation.\n * If no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = column_getFacetedUniqueValues(column, table)\n * ```\n */\nexport function column_getFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): Map<any, number> {\n const facetedUniqueValuesFn =\n table.options._rowModels?.facetedUniqueValues?.(table, column.id) ??\n (() => new Map<any, number>())\n return facetedUniqueValuesFn()\n}\n\n/**\n * Computes min and max numeric facet values for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = table_getGlobalFacetedMinMaxValues(table)\n * ```\n */\nexport function table_getGlobalFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): undefined | [number, number] {\n const facetedMinMaxValuesFn =\n table.options._rowModels?.facetedMinMaxValues?.(table, '__global__') ??\n (() => undefined)\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive global facet values.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no faceted row-model factory is registered, the pre-filtered row model is\n * returned.\n *\n * @example\n * ```ts\n * const rows = table_getGlobalFacetedRowModel(table)\n * ```\n */\nexport function table_getGlobalFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const facetedRowModelFn =\n table.options._rowModels?.facetedRowModel?.(table, '__global__') ??\n (() => table.getPreFilteredRowModel())\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique values and occurrence counts for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = table_getGlobalFacetedUniqueValues(table)\n * ```\n */\nexport function table_getGlobalFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Map<any, number> {\n const facetedUniqueValuesFn =\n table.options._rowModels?.facetedUniqueValues?.(table, '__global__') ??\n (() => new Map())\n return facetedUniqueValuesFn()\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,SAAgB,8BAKd,QACA,OAC8B;;CAI9B,kCAFE,MAAM,QAAQ,4GAAY,iIAAsB,OAAO,OAAO,EAAE,aACzD,QACmB,CAAC;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,0BAKd,QACA,OAC4B;;CAI5B,mCAFE,MAAM,QAAQ,8GAAY,8HAAkB,wDAAO,OAAQ,OAAM,EAAE,aAC5D,MAAM,uBAAuB,GACd,CAAC;AAC3B;;;;;;;;;;;;AAaA,SAAgB,8BAKd,QACA,OACkB;;CAIlB,mCAFE,MAAM,QAAQ,8GAAY,kIAAsB,OAAO,OAAO,EAAE,6BACzD,IAAI,IAAiB,GACF,CAAC;AAC/B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAAuE;;CAIvE,mCAFE,MAAM,QAAQ,8GAAY,kIAAsB,OAAO,YAAY,aAC5D,QACmB,CAAC;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,+BAGd,OAAqE;;CAIrE,mCAFE,MAAM,QAAQ,+GAAY,gIAAkB,OAAO,YAAY,aACxD,MAAM,uBAAuB,GACd,CAAC;AAC3B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAA2D;;CAI3D,oCAFE,MAAM,QAAQ,iHAAY,qIAAsB,OAAO,YAAY,6BAC5D,IAAI,IAAI,GACW,CAAC;AAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"createFacetedMinMaxValues.cjs","names":["tableMemo","callMemoOrStaticFn","column_getFacetedRowModel"],"sources":["../../../src/features/column-faceting/createFacetedMinMaxValues.ts"],"sourcesContent":["import { callMemoOrStaticFn, tableMemo } from '../../utils'\nimport { column_getFacetedRowModel } from './columnFacetingFeature.utils'\nimport type { Row } from '../../types/Row'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted min max values helper for faceted filtering.\n *\n * The returned function derives facet data from the table row model and relevant filter state so filter UIs can display available values.\n */\nexport function createFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number] {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n fn: (flatRows) => _createFacetedMinMaxValues(columnId, flatRows),\n fnName: 'table.getFacetedMinMaxValues',\n memoDeps: () => {\n const column = table.getColumn(columnId)\n if (!column) return [table.getPreFilteredRowModel().flatRows]\n return [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n table,\n ).flatRows,\n ]\n },\n table,\n })\n }\n}\n\nfunction _createFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n columnId: string,\n flatRows: Array<Row<TFeatures, TData>>,\n): undefined | [number, number] {\n if (!flatRows.length) return undefined\n\n let facetedMinValue = Number.POSITIVE_INFINITY\n let facetedMaxValue = Number.NEGATIVE_INFINITY\n let foundAny = false\n\n for (let i = 0; i < flatRows.length; i++) {\n const value = Number(flatRows[i]!.getValue(columnId))\n if (Number.isNaN(value)) continue\n foundAny = true\n if (value < facetedMinValue) facetedMinValue = value\n if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n if (!foundAny) return undefined\n return [facetedMinValue, facetedMaxValue]\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,4BAMwB;CACtC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAOA,wBAAU;GACf,SAAS;GACT,KAAK,aAAa,2BAA2B,UAAU,QAAQ;GAC/D,QAAQ;GACR,gBAAgB;IACd,MAAM,SAAS,MAAM,UAAU,QAAQ;IACvC,IAAI,CAAC,QAAQ,OAAO,CAAC,MAAM,uBAAuB,EAAE,QAAQ;IAC5D,OAAO,CACLC,iCACE,QACA,sBACAC,+DACA,KACF,EAAE,QACJ;GACF;GACA;EACF,CAAC;CACH;AACF;AAEA,SAAS,2BAIP,UACA,UAC8B;CAC9B,IAAI,CAAC,SAAS,QAAQ,OAAO;CAE7B,IAAI,kBAAkB,OAAO;CAC7B,IAAI,kBAAkB,OAAO;CAC7B,IAAI,WAAW;CAEf,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;EACxC,MAAM,QAAQ,OAAO,SAAS,GAAI,SAAS,QAAQ,CAAC;EACpD,IAAI,OAAO,MAAM,KAAK,GAAG;EACzB,WAAW;EACX,IAAI,QAAQ,iBAAiB,kBAAkB;EAC/C,IAAI,QAAQ,iBAAiB,kBAAkB;CACjD;CAEA,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,CAAC,iBAAiB,eAAe;AAC1C"}
1
+ {"version":3,"file":"createFacetedMinMaxValues.cjs","names":["tableMemo","callMemoOrStaticFn","column_getFacetedRowModel"],"sources":["../../../src/features/column-faceting/createFacetedMinMaxValues.ts"],"sourcesContent":["import { callMemoOrStaticFn, tableMemo } from '../../utils'\nimport { column_getFacetedRowModel } from './columnFacetingFeature.utils'\nimport type { Row } from '../../types/Row'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted min max values helper for faceted filtering.\n *\n * The returned function derives facet data from the table row model and relevant filter state so filter UIs can display available values.\n */\nexport function createFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number] {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n fn: (flatRows) => _createFacetedMinMaxValues(columnId, flatRows),\n fnName: 'table.getFacetedMinMaxValues',\n memoDeps: () => {\n const column = table.getColumn(columnId)\n if (!column) return [table.getPreFilteredRowModel().flatRows]\n return [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n table,\n ).flatRows,\n ]\n },\n table,\n })\n }\n}\n\nfunction _createFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n columnId: string,\n flatRows: Array<Row<TFeatures, TData>>,\n): undefined | [number, number] {\n if (!flatRows.length) return undefined\n\n let facetedMinValue = Number.POSITIVE_INFINITY\n let facetedMaxValue = Number.NEGATIVE_INFINITY\n let foundAny = false\n\n for (let i = 0; i < flatRows.length; i++) {\n const value = Number(flatRows[i]!.getValue(columnId))\n if (Number.isNaN(value)) continue\n foundAny = true\n if (value < facetedMinValue) facetedMinValue = value\n if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n if (!foundAny) return undefined\n return [facetedMinValue, facetedMaxValue]\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,4BAMwB;CACtC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAOA,wBAAU;GACf,SAAS;GACT,KAAK,aAAa,2BAA2B,UAAU,QAAQ;GAC/D,QAAQ;GACR,gBAAgB;IACd,MAAM,SAAS,MAAM,UAAU,QAAQ;IACvC,IAAI,CAAC,QAAQ,OAAO,CAAC,MAAM,uBAAuB,CAAC,CAAC,QAAQ;IAC5D,OAAO,CACLC,iCACE,QACA,sBACAC,+DACA,KACF,CAAC,CAAC,QACJ;GACF;GACA;EACF,CAAC;CACH;AACF;AAEA,SAAS,2BAIP,UACA,UAC8B;CAC9B,IAAI,CAAC,SAAS,QAAQ,OAAO;CAE7B,IAAI,kBAAkB,OAAO;CAC7B,IAAI,kBAAkB,OAAO;CAC7B,IAAI,WAAW;CAEf,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;EACxC,MAAM,QAAQ,OAAO,SAAS,EAAE,CAAE,SAAS,QAAQ,CAAC;EACpD,IAAI,OAAO,MAAM,KAAK,GAAG;EACzB,WAAW;EACX,IAAI,QAAQ,iBAAiB,kBAAkB;EAC/C,IAAI,QAAQ,iBAAiB,kBAAkB;CACjD;CAEA,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,CAAC,iBAAiB,eAAe;AAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"createFacetedMinMaxValues.js","names":[],"sources":["../../../src/features/column-faceting/createFacetedMinMaxValues.ts"],"sourcesContent":["import { callMemoOrStaticFn, tableMemo } from '../../utils'\nimport { column_getFacetedRowModel } from './columnFacetingFeature.utils'\nimport type { Row } from '../../types/Row'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted min max values helper for faceted filtering.\n *\n * The returned function derives facet data from the table row model and relevant filter state so filter UIs can display available values.\n */\nexport function createFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number] {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n fn: (flatRows) => _createFacetedMinMaxValues(columnId, flatRows),\n fnName: 'table.getFacetedMinMaxValues',\n memoDeps: () => {\n const column = table.getColumn(columnId)\n if (!column) return [table.getPreFilteredRowModel().flatRows]\n return [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n table,\n ).flatRows,\n ]\n },\n table,\n })\n }\n}\n\nfunction _createFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n columnId: string,\n flatRows: Array<Row<TFeatures, TData>>,\n): undefined | [number, number] {\n if (!flatRows.length) return undefined\n\n let facetedMinValue = Number.POSITIVE_INFINITY\n let facetedMaxValue = Number.NEGATIVE_INFINITY\n let foundAny = false\n\n for (let i = 0; i < flatRows.length; i++) {\n const value = Number(flatRows[i]!.getValue(columnId))\n if (Number.isNaN(value)) continue\n foundAny = true\n if (value < facetedMinValue) facetedMinValue = value\n if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n if (!foundAny) return undefined\n return [facetedMinValue, facetedMaxValue]\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,4BAMwB;CACtC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAO,UAAU;GACf,SAAS;GACT,KAAK,aAAa,2BAA2B,UAAU,QAAQ;GAC/D,QAAQ;GACR,gBAAgB;IACd,MAAM,SAAS,MAAM,UAAU,QAAQ;IACvC,IAAI,CAAC,QAAQ,OAAO,CAAC,MAAM,uBAAuB,EAAE,QAAQ;IAC5D,OAAO,CACL,mBACE,QACA,sBACA,2BACA,KACF,EAAE,QACJ;GACF;GACA;EACF,CAAC;CACH;AACF;AAEA,SAAS,2BAIP,UACA,UAC8B;CAC9B,IAAI,CAAC,SAAS,QAAQ,OAAO;CAE7B,IAAI,kBAAkB,OAAO;CAC7B,IAAI,kBAAkB,OAAO;CAC7B,IAAI,WAAW;CAEf,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;EACxC,MAAM,QAAQ,OAAO,SAAS,GAAI,SAAS,QAAQ,CAAC;EACpD,IAAI,OAAO,MAAM,KAAK,GAAG;EACzB,WAAW;EACX,IAAI,QAAQ,iBAAiB,kBAAkB;EAC/C,IAAI,QAAQ,iBAAiB,kBAAkB;CACjD;CAEA,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,CAAC,iBAAiB,eAAe;AAC1C"}
1
+ {"version":3,"file":"createFacetedMinMaxValues.js","names":[],"sources":["../../../src/features/column-faceting/createFacetedMinMaxValues.ts"],"sourcesContent":["import { callMemoOrStaticFn, tableMemo } from '../../utils'\nimport { column_getFacetedRowModel } from './columnFacetingFeature.utils'\nimport type { Row } from '../../types/Row'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted min max values helper for faceted filtering.\n *\n * The returned function derives facet data from the table row model and relevant filter state so filter UIs can display available values.\n */\nexport function createFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => undefined | [number, number] {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n fn: (flatRows) => _createFacetedMinMaxValues(columnId, flatRows),\n fnName: 'table.getFacetedMinMaxValues',\n memoDeps: () => {\n const column = table.getColumn(columnId)\n if (!column) return [table.getPreFilteredRowModel().flatRows]\n return [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n table,\n ).flatRows,\n ]\n },\n table,\n })\n }\n}\n\nfunction _createFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n columnId: string,\n flatRows: Array<Row<TFeatures, TData>>,\n): undefined | [number, number] {\n if (!flatRows.length) return undefined\n\n let facetedMinValue = Number.POSITIVE_INFINITY\n let facetedMaxValue = Number.NEGATIVE_INFINITY\n let foundAny = false\n\n for (let i = 0; i < flatRows.length; i++) {\n const value = Number(flatRows[i]!.getValue(columnId))\n if (Number.isNaN(value)) continue\n foundAny = true\n if (value < facetedMinValue) facetedMinValue = value\n if (value > facetedMaxValue) facetedMaxValue = value\n }\n\n if (!foundAny) return undefined\n return [facetedMinValue, facetedMaxValue]\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,4BAMwB;CACtC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAO,UAAU;GACf,SAAS;GACT,KAAK,aAAa,2BAA2B,UAAU,QAAQ;GAC/D,QAAQ;GACR,gBAAgB;IACd,MAAM,SAAS,MAAM,UAAU,QAAQ;IACvC,IAAI,CAAC,QAAQ,OAAO,CAAC,MAAM,uBAAuB,CAAC,CAAC,QAAQ;IAC5D,OAAO,CACL,mBACE,QACA,sBACA,2BACA,KACF,CAAC,CAAC,QACJ;GACF;GACA;EACF,CAAC;CACH;AACF;AAEA,SAAS,2BAIP,UACA,UAC8B;CAC9B,IAAI,CAAC,SAAS,QAAQ,OAAO;CAE7B,IAAI,kBAAkB,OAAO;CAC7B,IAAI,kBAAkB,OAAO;CAC7B,IAAI,WAAW;CAEf,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;EACxC,MAAM,QAAQ,OAAO,SAAS,EAAE,CAAE,SAAS,QAAQ,CAAC;EACpD,IAAI,OAAO,MAAM,KAAK,GAAG;EACzB,WAAW;EACX,IAAI,QAAQ,iBAAiB,kBAAkB;EAC/C,IAAI,QAAQ,iBAAiB,kBAAkB;CACjD;CAEA,IAAI,CAAC,UAAU,OAAO;CACtB,OAAO,CAAC,iBAAiB,eAAe;AAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"createFacetedRowModel.cjs","names":["tableMemo","filterRows"],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel(),\n ],\n fn: (preRowModel, columnFilters, globalFilter) =>\n _createFacetedRowModel(\n table,\n columnId,\n preRowModel,\n columnFilters,\n globalFilter,\n ),\n })\n }\n}\n\nfunction _createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n preRowModel: RowModel<TFeatures, TData>,\n columnFilters?: ColumnFiltersState,\n globalFilter?: string,\n) {\n if (!preRowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n return preRowModel\n }\n\n const filterableIds: Array<string> = []\n if (columnFilters) {\n for (let i = 0; i < columnFilters.length; i++) {\n const id = columnFilters[i]!.id\n if (id !== columnId) filterableIds.push(id)\n }\n }\n if (globalFilter) filterableIds.push('__global__')\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>,\n ) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters?.[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,wBAMsB;CACpC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,uBAAuB;8BAC7B,MAAM,MAAM,6FAAe,IAAI;8BAC/B,MAAM,MAAM,4FAAc,IAAI;KAC9B,MAAM,oBAAoB;IAC5B;;GACA,KAAK,aAAa,eAAe,iBAC/B,uBACE,OACA,UACA,aACA,eACA,YACF;EACJ,CAAC;CACH;AACF;AAEA,SAAS,uBAIP,OACA,UACA,aACA,eACA,cACA;CACA,IAAI,CAAC,YAAY,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,cAC1D,OAAO;CAGT,MAAM,gBAA+B,CAAC;CACtC,IAAI,eACF,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;EAC7C,MAAM,KAAK,cAAc,GAAI;EAC7B,IAAI,OAAO,UAAU,cAAc,KAAK,EAAE;CAC5C;CAEF,IAAI,cAAc,cAAc,KAAK,YAAY;CAEjD,MAAM,kBACJ,QACG;EAEH,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;;GAC7C,2BAAI,IAAI,uFAAgB,cAAc,SAAS,OAC7C,OAAO;EAEX;EACA,OAAO;CACT;CAEA,OAAOC,mCAAW,YAAY,MAAM,gBAAgB,KAAK;AAC3D"}
1
+ {"version":3,"file":"createFacetedRowModel.cjs","names":["tableMemo","filterRows"],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel(),\n ],\n fn: (preRowModel, columnFilters, globalFilter) =>\n _createFacetedRowModel(\n table,\n columnId,\n preRowModel,\n columnFilters,\n globalFilter,\n ),\n })\n }\n}\n\nfunction _createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n preRowModel: RowModel<TFeatures, TData>,\n columnFilters?: ColumnFiltersState,\n globalFilter?: string,\n) {\n if (!preRowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n return preRowModel\n }\n\n const filterableIds: Array<string> = []\n if (columnFilters) {\n for (let i = 0; i < columnFilters.length; i++) {\n const id = columnFilters[i]!.id\n if (id !== columnId) filterableIds.push(id)\n }\n }\n if (globalFilter) filterableIds.push('__global__')\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>,\n ) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters?.[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,wBAMsB;CACpC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,uBAAuB;8BAC7B,MAAM,MAAM,6FAAe,IAAI;8BAC/B,MAAM,MAAM,4FAAc,IAAI;KAC9B,MAAM,oBAAoB;IAC5B;;GACA,KAAK,aAAa,eAAe,iBAC/B,uBACE,OACA,UACA,aACA,eACA,YACF;EACJ,CAAC;CACH;AACF;AAEA,SAAS,uBAIP,OACA,UACA,aACA,eACA,cACA;CACA,IAAI,CAAC,YAAY,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,cAC1D,OAAO;CAGT,MAAM,gBAA+B,CAAC;CACtC,IAAI,eACF,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;EAC7C,MAAM,KAAK,cAAc,EAAE,CAAE;EAC7B,IAAI,OAAO,UAAU,cAAc,KAAK,EAAE;CAC5C;CAEF,IAAI,cAAc,cAAc,KAAK,YAAY;CAEjD,MAAM,kBACJ,QACG;EAEH,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;;GAC7C,2BAAI,IAAI,uFAAgB,cAAc,SAAS,OAC7C,OAAO;EAEX;EACA,OAAO;CACT;CAEA,OAAOC,mCAAW,YAAY,MAAM,gBAAgB,KAAK;AAC3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"createFacetedRowModel.js","names":[],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel(),\n ],\n fn: (preRowModel, columnFilters, globalFilter) =>\n _createFacetedRowModel(\n table,\n columnId,\n preRowModel,\n columnFilters,\n globalFilter,\n ),\n })\n }\n}\n\nfunction _createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n preRowModel: RowModel<TFeatures, TData>,\n columnFilters?: ColumnFiltersState,\n globalFilter?: string,\n) {\n if (!preRowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n return preRowModel\n }\n\n const filterableIds: Array<string> = []\n if (columnFilters) {\n for (let i = 0; i < columnFilters.length; i++) {\n const id = columnFilters[i]!.id\n if (id !== columnId) filterableIds.push(id)\n }\n }\n if (globalFilter) filterableIds.push('__global__')\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>,\n ) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters?.[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,wBAMsB;CACpC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,uBAAuB;8BAC7B,MAAM,MAAM,6FAAe,IAAI;8BAC/B,MAAM,MAAM,4FAAc,IAAI;KAC9B,MAAM,oBAAoB;IAC5B;;GACA,KAAK,aAAa,eAAe,iBAC/B,uBACE,OACA,UACA,aACA,eACA,YACF;EACJ,CAAC;CACH;AACF;AAEA,SAAS,uBAIP,OACA,UACA,aACA,eACA,cACA;CACA,IAAI,CAAC,YAAY,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,cAC1D,OAAO;CAGT,MAAM,gBAA+B,CAAC;CACtC,IAAI,eACF,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;EAC7C,MAAM,KAAK,cAAc,GAAI;EAC7B,IAAI,OAAO,UAAU,cAAc,KAAK,EAAE;CAC5C;CAEF,IAAI,cAAc,cAAc,KAAK,YAAY;CAEjD,MAAM,kBACJ,QACG;EAEH,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;;GAC7C,2BAAI,IAAI,uFAAgB,cAAc,SAAS,OAC7C,OAAO;EAEX;EACA,OAAO;CACT;CAEA,OAAO,WAAW,YAAY,MAAM,gBAAgB,KAAK;AAC3D"}
1
+ {"version":3,"file":"createFacetedRowModel.js","names":[],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel(),\n ],\n fn: (preRowModel, columnFilters, globalFilter) =>\n _createFacetedRowModel(\n table,\n columnId,\n preRowModel,\n columnFilters,\n globalFilter,\n ),\n })\n }\n}\n\nfunction _createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n preRowModel: RowModel<TFeatures, TData>,\n columnFilters?: ColumnFiltersState,\n globalFilter?: string,\n) {\n if (!preRowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n return preRowModel\n }\n\n const filterableIds: Array<string> = []\n if (columnFilters) {\n for (let i = 0; i < columnFilters.length; i++) {\n const id = columnFilters[i]!.id\n if (id !== columnId) filterableIds.push(id)\n }\n }\n if (globalFilter) filterableIds.push('__global__')\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>,\n ) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters?.[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,wBAMsB;CACpC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,uBAAuB;8BAC7B,MAAM,MAAM,6FAAe,IAAI;8BAC/B,MAAM,MAAM,4FAAc,IAAI;KAC9B,MAAM,oBAAoB;IAC5B;;GACA,KAAK,aAAa,eAAe,iBAC/B,uBACE,OACA,UACA,aACA,eACA,YACF;EACJ,CAAC;CACH;AACF;AAEA,SAAS,uBAIP,OACA,UACA,aACA,eACA,cACA;CACA,IAAI,CAAC,YAAY,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,cAC1D,OAAO;CAGT,MAAM,gBAA+B,CAAC;CACtC,IAAI,eACF,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;EAC7C,MAAM,KAAK,cAAc,EAAE,CAAE;EAC7B,IAAI,OAAO,UAAU,cAAc,KAAK,EAAE;CAC5C;CAEF,IAAI,cAAc,cAAc,KAAK,YAAY;CAEjD,MAAM,kBACJ,QACG;EAEH,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;;GAC7C,2BAAI,IAAI,uFAAgB,cAAc,SAAS,OAC7C,OAAO;EAEX;EACA,OAAO;CACT;CAEA,OAAO,WAAW,YAAY,MAAM,gBAAgB,KAAK;AAC3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"createFacetedUniqueValues.cjs","names":["tableMemo","callMemoOrStaticFn","column_getFacetedRowModel"],"sources":["../../../src/features/column-faceting/createFacetedUniqueValues.ts"],"sourcesContent":["import { callMemoOrStaticFn, tableMemo } from '../../utils'\nimport { column_getFacetedRowModel } from './columnFacetingFeature.utils'\nimport type { Row } from '../../types/Row'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted unique values helper for faceted filtering.\n *\n * The returned function derives facet data from the table row model and relevant filter state so filter UIs can display available values.\n */\nexport function createFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => Map<any, number> {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'table.getFacetedUniqueValues',\n memoDeps: () => {\n const column = table.getColumn(columnId)\n if (!column) return [table.getPreFilteredRowModel().flatRows]\n return [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n table,\n ).flatRows,\n ]\n },\n fn: (flatRows) => _createFacetedUniqueValues(columnId, flatRows),\n })\n }\n}\n\nfunction _createFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(columnId: string, flatRows: Array<Row<TFeatures, TData>>): Map<any, number> {\n const facetedUniqueValues = new Map<any, number>()\n\n for (let i = 0; i < flatRows.length; i++) {\n const values = flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1,\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,4BAMY;CAC1B,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;IACd,MAAM,SAAS,MAAM,UAAU,QAAQ;IACvC,IAAI,CAAC,QAAQ,OAAO,CAAC,MAAM,uBAAuB,EAAE,QAAQ;IAC5D,OAAO,CACLC,iCACE,QACA,sBACAC,+DACA,KACF,EAAE,QACJ;GACF;GACA,KAAK,aAAa,2BAA2B,UAAU,QAAQ;EACjE,CAAC;CACH;AACF;AAEA,SAAS,2BAGP,UAAkB,UAA0D;CAC5E,MAAM,sCAAsB,IAAI,IAAiB;CAEjD,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;EACxC,MAAM,SAAS,SAAS,GAAI,gBAAgB,QAAQ;EAEpD,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,QAAQ,OAAO;GACrB,IAAI,oBAAoB,IAAI,KAAK,GAC/B,oBAAoB,IAClB,QACC,oBAAoB,IAAI,KAAK,KAAK,KAAK,CAC1C;QAEA,oBAAoB,IAAI,OAAO,CAAC;EAEpC;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"createFacetedUniqueValues.cjs","names":["tableMemo","callMemoOrStaticFn","column_getFacetedRowModel"],"sources":["../../../src/features/column-faceting/createFacetedUniqueValues.ts"],"sourcesContent":["import { callMemoOrStaticFn, tableMemo } from '../../utils'\nimport { column_getFacetedRowModel } from './columnFacetingFeature.utils'\nimport type { Row } from '../../types/Row'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted unique values helper for faceted filtering.\n *\n * The returned function derives facet data from the table row model and relevant filter state so filter UIs can display available values.\n */\nexport function createFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => Map<any, number> {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'table.getFacetedUniqueValues',\n memoDeps: () => {\n const column = table.getColumn(columnId)\n if (!column) return [table.getPreFilteredRowModel().flatRows]\n return [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n table,\n ).flatRows,\n ]\n },\n fn: (flatRows) => _createFacetedUniqueValues(columnId, flatRows),\n })\n }\n}\n\nfunction _createFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(columnId: string, flatRows: Array<Row<TFeatures, TData>>): Map<any, number> {\n const facetedUniqueValues = new Map<any, number>()\n\n for (let i = 0; i < flatRows.length; i++) {\n const values = flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1,\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,4BAMY;CAC1B,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;IACd,MAAM,SAAS,MAAM,UAAU,QAAQ;IACvC,IAAI,CAAC,QAAQ,OAAO,CAAC,MAAM,uBAAuB,CAAC,CAAC,QAAQ;IAC5D,OAAO,CACLC,iCACE,QACA,sBACAC,+DACA,KACF,CAAC,CAAC,QACJ;GACF;GACA,KAAK,aAAa,2BAA2B,UAAU,QAAQ;EACjE,CAAC;CACH;AACF;AAEA,SAAS,2BAGP,UAAkB,UAA0D;CAC5E,MAAM,sCAAsB,IAAI,IAAiB;CAEjD,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;EACxC,MAAM,SAAS,SAAS,EAAE,CAAE,gBAAgB,QAAQ;EAEpD,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,QAAQ,OAAO;GACrB,IAAI,oBAAoB,IAAI,KAAK,GAC/B,oBAAoB,IAClB,QACC,oBAAoB,IAAI,KAAK,KAAK,KAAK,CAC1C;QAEA,oBAAoB,IAAI,OAAO,CAAC;EAEpC;CACF;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"createFacetedUniqueValues.js","names":[],"sources":["../../../src/features/column-faceting/createFacetedUniqueValues.ts"],"sourcesContent":["import { callMemoOrStaticFn, tableMemo } from '../../utils'\nimport { column_getFacetedRowModel } from './columnFacetingFeature.utils'\nimport type { Row } from '../../types/Row'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted unique values helper for faceted filtering.\n *\n * The returned function derives facet data from the table row model and relevant filter state so filter UIs can display available values.\n */\nexport function createFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => Map<any, number> {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'table.getFacetedUniqueValues',\n memoDeps: () => {\n const column = table.getColumn(columnId)\n if (!column) return [table.getPreFilteredRowModel().flatRows]\n return [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n table,\n ).flatRows,\n ]\n },\n fn: (flatRows) => _createFacetedUniqueValues(columnId, flatRows),\n })\n }\n}\n\nfunction _createFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(columnId: string, flatRows: Array<Row<TFeatures, TData>>): Map<any, number> {\n const facetedUniqueValues = new Map<any, number>()\n\n for (let i = 0; i < flatRows.length; i++) {\n const values = flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1,\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,4BAMY;CAC1B,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;IACd,MAAM,SAAS,MAAM,UAAU,QAAQ;IACvC,IAAI,CAAC,QAAQ,OAAO,CAAC,MAAM,uBAAuB,EAAE,QAAQ;IAC5D,OAAO,CACL,mBACE,QACA,sBACA,2BACA,KACF,EAAE,QACJ;GACF;GACA,KAAK,aAAa,2BAA2B,UAAU,QAAQ;EACjE,CAAC;CACH;AACF;AAEA,SAAS,2BAGP,UAAkB,UAA0D;CAC5E,MAAM,sCAAsB,IAAI,IAAiB;CAEjD,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;EACxC,MAAM,SAAS,SAAS,GAAI,gBAAgB,QAAQ;EAEpD,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,QAAQ,OAAO;GACrB,IAAI,oBAAoB,IAAI,KAAK,GAC/B,oBAAoB,IAClB,QACC,oBAAoB,IAAI,KAAK,KAAK,KAAK,CAC1C;QAEA,oBAAoB,IAAI,OAAO,CAAC;EAEpC;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"createFacetedUniqueValues.js","names":[],"sources":["../../../src/features/column-faceting/createFacetedUniqueValues.ts"],"sourcesContent":["import { callMemoOrStaticFn, tableMemo } from '../../utils'\nimport { column_getFacetedRowModel } from './columnFacetingFeature.utils'\nimport type { Row } from '../../types/Row'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted unique values helper for faceted filtering.\n *\n * The returned function derives facet data from the table row model and relevant filter state so filter UIs can display available values.\n */\nexport function createFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => Map<any, number> {\n return (_table, columnId) => {\n const table: Table_Internal<TFeatures, TData> = _table\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'table.getFacetedUniqueValues',\n memoDeps: () => {\n const column = table.getColumn(columnId)\n if (!column) return [table.getPreFilteredRowModel().flatRows]\n return [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n table,\n ).flatRows,\n ]\n },\n fn: (flatRows) => _createFacetedUniqueValues(columnId, flatRows),\n })\n }\n}\n\nfunction _createFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(columnId: string, flatRows: Array<Row<TFeatures, TData>>): Map<any, number> {\n const facetedUniqueValues = new Map<any, number>()\n\n for (let i = 0; i < flatRows.length; i++) {\n const values = flatRows[i]!.getUniqueValues(columnId)\n\n for (let j = 0; j < values.length; j++) {\n const value = values[j]\n if (facetedUniqueValues.has(value)) {\n facetedUniqueValues.set(\n value,\n (facetedUniqueValues.get(value) ?? 0) + 1,\n )\n } else {\n facetedUniqueValues.set(value, 1)\n }\n }\n }\n\n return facetedUniqueValues\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,4BAMY;CAC1B,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAA0C;EAChD,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;IACd,MAAM,SAAS,MAAM,UAAU,QAAQ;IACvC,IAAI,CAAC,QAAQ,OAAO,CAAC,MAAM,uBAAuB,CAAC,CAAC,QAAQ;IAC5D,OAAO,CACL,mBACE,QACA,sBACA,2BACA,KACF,CAAC,CAAC,QACJ;GACF;GACA,KAAK,aAAa,2BAA2B,UAAU,QAAQ;EACjE,CAAC;CACH;AACF;AAEA,SAAS,2BAGP,UAAkB,UAA0D;CAC5E,MAAM,sCAAsB,IAAI,IAAiB;CAEjD,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;EACxC,MAAM,SAAS,SAAS,EAAE,CAAE,gBAAgB,QAAQ;EAEpD,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,QAAQ,OAAO;GACrB,IAAI,oBAAoB,IAAI,KAAK,GAC/B,oBAAoB,IAClB,QACC,oBAAoB,IAAI,KAAK,KAAK,KAAK,CAC1C;QAEA,oBAAoB,IAAI,OAAO,CAAC;EAEpC;CACF;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"columnFilteringFeature.utils.cjs","names":["isFunction","functionalUpdate","cloneState"],"sources":["../../../src/features/column-filtering/columnFilteringFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate, isFunction } from '../../utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\nimport type {\n ColumnFiltersState,\n FilterFn,\n} from './columnFilteringFeature.types'\n\n/**\n * Creates the default column filter state.\n *\n * The feature default is an empty array, meaning no column filters are active.\n * Reset APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const filters = getDefaultColumnFiltersState()\n * ```\n */\nexport function getDefaultColumnFiltersState(): ColumnFiltersState {\n return []\n}\n\n/**\n * Chooses a built-in filter function from the column's first core row value.\n *\n * Strings use `includesString`, numbers use `inNumberRange`, booleans and\n * objects use `equals`, arrays use `arrIncludes`, and unknown values fall back\n * to `weakEquals`.\n *\n * @example\n * ```ts\n * const filterFn = column_getAutoFilterFn(column)\n * ```\n */\nexport function column_getAutoFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const filterFns: Record<string, FilterFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.filterFns\n\n const firstRow = column.table.getCoreRowModel().flatRows[0]\n\n const value = firstRow ? firstRow.getValue(column.id) : undefined\n\n if (typeof value === 'string') {\n return filterFns?.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns?.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns?.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns?.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns?.arrIncludes\n }\n\n return filterFns?.weakEquals\n}\n\n/**\n * Resolves the filter function configured for a column.\n *\n * Function-valued `columnDef.filterFn` is returned directly, `'auto'` delegates\n * to `column_getAutoFilterFn`, and string values are looked up in the table's\n * filter function registry.\n *\n * @example\n * ```ts\n * const filterFn = column_getFilterFn(column)\n * ```\n */\nexport function column_getFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n): FilterFn<TFeatures, TData> | undefined {\n let filterFn = null\n const filterFns: Record<string, FilterFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.filterFns\n filterFn = isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column_getAutoFilterFn(column)\n : filterFns?.[column.columnDef.filterFn as string]\n\n if (process.env.NODE_ENV === 'development' && !filterFn) {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`,\n )\n }\n\n return filterFn\n}\n\n/**\n * Checks whether column filtering is enabled for this accessor column.\n *\n * The column must have an accessor and filtering must be enabled by the column\n * definition, `enableColumnFilters`, and the table-wide `enableFilters` option.\n *\n * @example\n * ```ts\n * const canFilter = column_getCanFilter(column)\n * ```\n */\nexport function column_getCanFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (column.table.options.enableColumnFilters ?? true) &&\n (column.table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n}\n\n/**\n * Checks whether this column currently has an entry in `state.columnFilters`.\n *\n * This only reflects filter state presence; it does not indicate whether the\n * filter removes any rows.\n *\n * @example\n * ```ts\n * const isFiltered = column_getIsFiltered(column)\n * ```\n */\nexport function column_getIsFiltered<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column_getFilterIndex(column) > -1\n}\n\n/**\n * Reads this column's current filter value from `state.columnFilters`.\n *\n * Missing filter entries return `undefined`.\n *\n * @example\n * ```ts\n * const value = column_getFilterValue(column)\n * ```\n */\nexport function column_getFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column.table.atoms.columnFilters\n ?.get()\n ?.find((d) => d.id === column.id)?.value\n}\n\n/**\n * Finds this column's position in the ordered `state.columnFilters` array.\n *\n * The result is `-1` when the column has no active filter.\n *\n * @example\n * ```ts\n * const index = column_getFilterIndex(column)\n * ```\n */\nexport function column_getFilterIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return (\n column.table.atoms.columnFilters\n ?.get()\n ?.findIndex((d) => d.id === column.id) ?? -1\n )\n}\n\n/**\n * Adds, updates, or removes this column's filter value.\n *\n * The incoming value may be an updater. After resolution, `autoRemove` rules\n * decide whether the filter should be removed instead of stored.\n *\n * @example\n * ```ts\n * column_setFilterValue(column, (old) => String(old ?? '').trim())\n * ```\n */\nexport function column_setFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, value: any) {\n table_setColumnFilters(column.table, (old) => {\n const filterFn = column_getFilterFn(column)\n const previousFilter = old.find((d) => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined,\n )\n\n if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {\n return old.filter((d) => d.id !== column.id)\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return old.map((d) => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n })\n }\n\n if (old.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n}\n\n/**\n * Routes a column filter updater through the table's filter change handler.\n *\n * The resolved filters are cleaned before they are emitted: filters for known\n * columns are removed when their filter function says the value should be\n * auto-removed.\n *\n * @example\n * ```ts\n * table_setColumnFilters(table, (old) => old.filter((filter) => filter.id !== 'age'))\n * ```\n */\nexport function table_setColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnFiltersState>,\n) {\n const leafColumnsById = table.getAllLeafColumnsById()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old).filter((filter) => {\n const column = leafColumnsById[filter.id]\n\n if (column) {\n const filterFn = column_getFilterFn(column)\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n}\n\n/**\n * Resets `columnFilters` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.columnFilters` when it\n * exists. Passing `true` ignores initial state and resets to `[]`.\n *\n * @example\n * ```ts\n * table_resetColumnFilters(table)\n * table_resetColumnFilters(table, true)\n * ```\n */\nexport function table_resetColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnFilters(\n table,\n defaultState ? [] : cloneState(table.initialState.columnFilters ?? []),\n )\n}\n\n/**\n * Returns whether a filter value should be removed from filter state.\n *\n * This checks the filter function's `autoRemove` hook and built-in empty-value rules.\n *\n * @example\n * ```ts\n * const removeFilter = shouldAutoRemoveFilter(filterFn, value, column)\n * ```\n */\nexport function shouldAutoRemoveFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n filterFn?: FilterFn<TFeatures, TData>,\n value?: any,\n column?: Column_Internal<TFeatures, TData, TValue>,\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value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AAC,CAAC,CACvE;AACF;;;;;;;;;;;AAYA,SAAgB,uBAKd,UACA,OACA,QACA;CACA,QACG,YAAY,SAAS,aAClB,SAAS,WAAW,OAAO,MAAM,IACjC,UACJ,OAAO,UAAU,eAChB,OAAO,UAAU,YAAY,CAAC;AAEnC"}
1
+ {"version":3,"file":"columnFilteringFeature.utils.cjs","names":["isFunction","functionalUpdate","cloneState"],"sources":["../../../src/features/column-filtering/columnFilteringFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate, isFunction } from '../../utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\nimport type {\n ColumnFiltersState,\n FilterFn,\n} from './columnFilteringFeature.types'\n\n/**\n * Creates the default column filter state.\n *\n * The feature default is an empty array, meaning no column filters are active.\n * Reset APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const filters = getDefaultColumnFiltersState()\n * ```\n */\nexport function getDefaultColumnFiltersState(): ColumnFiltersState {\n return []\n}\n\n/**\n * Chooses a built-in filter function from the column's first core row value.\n *\n * Strings use `includesString`, numbers use `inNumberRange`, booleans and\n * objects use `equals`, arrays use `arrIncludes`, and unknown values fall back\n * to `weakEquals`.\n *\n * @example\n * ```ts\n * const filterFn = column_getAutoFilterFn(column)\n * ```\n */\nexport function column_getAutoFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const filterFns: Record<string, FilterFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.filterFns\n\n const firstRow = column.table.getCoreRowModel().flatRows[0]\n\n const value = firstRow ? firstRow.getValue(column.id) : undefined\n\n if (typeof value === 'string') {\n return filterFns?.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns?.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns?.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns?.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns?.arrIncludes\n }\n\n return filterFns?.weakEquals\n}\n\n/**\n * Resolves the filter function configured for a column.\n *\n * Function-valued `columnDef.filterFn` is returned directly, `'auto'` delegates\n * to `column_getAutoFilterFn`, and string values are looked up in the table's\n * filter function registry.\n *\n * @example\n * ```ts\n * const filterFn = column_getFilterFn(column)\n * ```\n */\nexport function column_getFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n): FilterFn<TFeatures, TData> | undefined {\n let filterFn = null\n const filterFns: Record<string, FilterFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.filterFns\n filterFn = isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column_getAutoFilterFn(column)\n : filterFns?.[column.columnDef.filterFn as string]\n\n if (process.env.NODE_ENV === 'development' && !filterFn) {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`,\n )\n }\n\n return filterFn\n}\n\n/**\n * Checks whether column filtering is enabled for this accessor column.\n *\n * The column must have an accessor and filtering must be enabled by the column\n * definition, `enableColumnFilters`, and the table-wide `enableFilters` option.\n *\n * @example\n * ```ts\n * const canFilter = column_getCanFilter(column)\n * ```\n */\nexport function column_getCanFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (column.table.options.enableColumnFilters ?? true) &&\n (column.table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n}\n\n/**\n * Checks whether this column currently has an entry in `state.columnFilters`.\n *\n * This only reflects filter state presence; it does not indicate whether the\n * filter removes any rows.\n *\n * @example\n * ```ts\n * const isFiltered = column_getIsFiltered(column)\n * ```\n */\nexport function column_getIsFiltered<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column_getFilterIndex(column) > -1\n}\n\n/**\n * Reads this column's current filter value from `state.columnFilters`.\n *\n * Missing filter entries return `undefined`.\n *\n * @example\n * ```ts\n * const value = column_getFilterValue(column)\n * ```\n */\nexport function column_getFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column.table.atoms.columnFilters\n ?.get()\n ?.find((d) => d.id === column.id)?.value\n}\n\n/**\n * Finds this column's position in the ordered `state.columnFilters` array.\n *\n * The result is `-1` when the column has no active filter.\n *\n * @example\n * ```ts\n * const index = column_getFilterIndex(column)\n * ```\n */\nexport function column_getFilterIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return (\n column.table.atoms.columnFilters\n ?.get()\n ?.findIndex((d) => d.id === column.id) ?? -1\n )\n}\n\n/**\n * Adds, updates, or removes this column's filter value.\n *\n * The incoming value may be an updater. After resolution, `autoRemove` rules\n * decide whether the filter should be removed instead of stored.\n *\n * @example\n * ```ts\n * column_setFilterValue(column, (old) => String(old ?? '').trim())\n * ```\n */\nexport function column_setFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, value: any) {\n table_setColumnFilters(column.table, (old) => {\n const filterFn = column_getFilterFn(column)\n const previousFilter = old.find((d) => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined,\n )\n\n if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {\n return old.filter((d) => d.id !== column.id)\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return old.map((d) => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n })\n }\n\n if (old.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n}\n\n/**\n * Routes a column filter updater through the table's filter change handler.\n *\n * The resolved filters are cleaned before they are emitted: filters for known\n * columns are removed when their filter function says the value should be\n * auto-removed.\n *\n * @example\n * ```ts\n * table_setColumnFilters(table, (old) => old.filter((filter) => filter.id !== 'age'))\n * ```\n */\nexport function table_setColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnFiltersState>,\n) {\n const leafColumnsById = table.getAllLeafColumnsById()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old).filter((filter) => {\n const column = leafColumnsById[filter.id]\n\n if (column) {\n const filterFn = column_getFilterFn(column)\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n}\n\n/**\n * Resets `columnFilters` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.columnFilters` when it\n * exists. Passing `true` ignores initial state and resets to `[]`.\n *\n * @example\n * ```ts\n * table_resetColumnFilters(table)\n * table_resetColumnFilters(table, true)\n * ```\n */\nexport function table_resetColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnFilters(\n table,\n defaultState ? [] : cloneState(table.initialState.columnFilters ?? []),\n )\n}\n\n/**\n * Returns whether a filter value should be removed from filter state.\n *\n * This checks the filter function's `autoRemove` hook and built-in empty-value rules.\n *\n * @example\n * ```ts\n * const removeFilter = shouldAutoRemoveFilter(filterFn, value, column)\n * ```\n */\nexport function shouldAutoRemoveFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n filterFn?: FilterFn<TFeatures, TData>,\n value?: any,\n column?: Column_Internal<TFeatures, TData, TValue>,\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value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A,eAAe,CAAC,IAAIC,yBAAW,MAAM,aAAa,iBAAiB,CAAC,CAAC,CACvE;AACF;;;;;;;;;;;AAYA,SAAgB,uBAKd,UACA,OACA,QACA;CACA,QACG,YAAY,SAAS,aAClB,SAAS,WAAW,OAAO,MAAM,IACjC,UACJ,OAAO,UAAU,eAChB,OAAO,UAAU,YAAY,CAAC;AAEnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"columnFilteringFeature.utils.js","names":[],"sources":["../../../src/features/column-filtering/columnFilteringFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate, isFunction } from '../../utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\nimport type {\n ColumnFiltersState,\n FilterFn,\n} from './columnFilteringFeature.types'\n\n/**\n * Creates the default column filter state.\n *\n * The feature default is an empty array, meaning no column filters are active.\n * Reset APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const filters = getDefaultColumnFiltersState()\n * ```\n */\nexport function getDefaultColumnFiltersState(): ColumnFiltersState {\n return []\n}\n\n/**\n * Chooses a built-in filter function from the column's first core row value.\n *\n * Strings use `includesString`, numbers use `inNumberRange`, booleans and\n * objects use `equals`, arrays use `arrIncludes`, and unknown values fall back\n * to `weakEquals`.\n *\n * @example\n * ```ts\n * const filterFn = column_getAutoFilterFn(column)\n * ```\n */\nexport function column_getAutoFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const filterFns: Record<string, FilterFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.filterFns\n\n const firstRow = column.table.getCoreRowModel().flatRows[0]\n\n const value = firstRow ? firstRow.getValue(column.id) : undefined\n\n if (typeof value === 'string') {\n return filterFns?.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns?.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns?.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns?.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns?.arrIncludes\n }\n\n return filterFns?.weakEquals\n}\n\n/**\n * Resolves the filter function configured for a column.\n *\n * Function-valued `columnDef.filterFn` is returned directly, `'auto'` delegates\n * to `column_getAutoFilterFn`, and string values are looked up in the table's\n * filter function registry.\n *\n * @example\n * ```ts\n * const filterFn = column_getFilterFn(column)\n * ```\n */\nexport function column_getFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n): FilterFn<TFeatures, TData> | undefined {\n let filterFn = null\n const filterFns: Record<string, FilterFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.filterFns\n filterFn = isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column_getAutoFilterFn(column)\n : filterFns?.[column.columnDef.filterFn as string]\n\n if (process.env.NODE_ENV === 'development' && !filterFn) {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`,\n )\n }\n\n return filterFn\n}\n\n/**\n * Checks whether column filtering is enabled for this accessor column.\n *\n * The column must have an accessor and filtering must be enabled by the column\n * definition, `enableColumnFilters`, and the table-wide `enableFilters` option.\n *\n * @example\n * ```ts\n * const canFilter = column_getCanFilter(column)\n * ```\n */\nexport function column_getCanFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (column.table.options.enableColumnFilters ?? true) &&\n (column.table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n}\n\n/**\n * Checks whether this column currently has an entry in `state.columnFilters`.\n *\n * This only reflects filter state presence; it does not indicate whether the\n * filter removes any rows.\n *\n * @example\n * ```ts\n * const isFiltered = column_getIsFiltered(column)\n * ```\n */\nexport function column_getIsFiltered<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column_getFilterIndex(column) > -1\n}\n\n/**\n * Reads this column's current filter value from `state.columnFilters`.\n *\n * Missing filter entries return `undefined`.\n *\n * @example\n * ```ts\n * const value = column_getFilterValue(column)\n * ```\n */\nexport function column_getFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column.table.atoms.columnFilters\n ?.get()\n ?.find((d) => d.id === column.id)?.value\n}\n\n/**\n * Finds this column's position in the ordered `state.columnFilters` array.\n *\n * The result is `-1` when the column has no active filter.\n *\n * @example\n * ```ts\n * const index = column_getFilterIndex(column)\n * ```\n */\nexport function column_getFilterIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return (\n column.table.atoms.columnFilters\n ?.get()\n ?.findIndex((d) => d.id === column.id) ?? -1\n )\n}\n\n/**\n * Adds, updates, or removes this column's filter value.\n *\n * The incoming value may be an updater. After resolution, `autoRemove` rules\n * decide whether the filter should be removed instead of stored.\n *\n * @example\n * ```ts\n * column_setFilterValue(column, (old) => String(old ?? '').trim())\n * ```\n */\nexport function column_setFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, value: any) {\n table_setColumnFilters(column.table, (old) => {\n const filterFn = column_getFilterFn(column)\n const previousFilter = old.find((d) => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined,\n )\n\n if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {\n return old.filter((d) => d.id !== column.id)\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return old.map((d) => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n })\n }\n\n if (old.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n}\n\n/**\n * Routes a column filter updater through the table's filter change handler.\n *\n * The resolved filters are cleaned before they are emitted: filters for known\n * columns are removed when their filter function says the value should be\n * auto-removed.\n *\n * @example\n * ```ts\n * table_setColumnFilters(table, (old) => old.filter((filter) => filter.id !== 'age'))\n * ```\n */\nexport function table_setColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnFiltersState>,\n) {\n const leafColumnsById = table.getAllLeafColumnsById()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old).filter((filter) => {\n const column = leafColumnsById[filter.id]\n\n if (column) {\n const filterFn = column_getFilterFn(column)\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n}\n\n/**\n * Resets `columnFilters` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.columnFilters` when it\n * exists. Passing `true` ignores initial state and resets to `[]`.\n *\n * @example\n * ```ts\n * table_resetColumnFilters(table)\n * table_resetColumnFilters(table, true)\n * ```\n */\nexport function table_resetColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnFilters(\n table,\n defaultState ? [] : cloneState(table.initialState.columnFilters ?? []),\n )\n}\n\n/**\n * Returns whether a filter value should be removed from filter state.\n *\n * This checks the filter function's `autoRemove` hook and built-in empty-value rules.\n *\n * @example\n * ```ts\n * const removeFilter = shouldAutoRemoveFilter(filterFn, value, column)\n * ```\n */\nexport function shouldAutoRemoveFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n filterFn?: FilterFn<TFeatures, TData>,\n value?: any,\n column?: Column_Internal<TFeatures, TData, TValue>,\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,+BAAmD;CACjE,OAAO,CAAC;AACV;;;;;;;;;;;;;AAcA,SAAgB,uBAId,QAAmD;CACnD,MAAM,YACJ,OAAO,MAAM,aAAa;CAE5B,MAAM,WAAW,OAAO,MAAM,gBAAgB,EAAE,SAAS;CAEzD,MAAM,QAAQ,WAAW,SAAS,SAAS,OAAO,EAAE,IAAI;CAExD,IAAI,OAAO,UAAU,UACnB,6DAAO,UAAW;CAGpB,IAAI,OAAO,UAAU,UACnB,6DAAO,UAAW;CAGpB,IAAI,OAAO,UAAU,WACnB,6DAAO,UAAW;CAGpB,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,6DAAO,UAAW;CAGpB,IAAI,MAAM,QAAQ,KAAK,GACrB,6DAAO,UAAW;CAGpB,6DAAO,UAAW;AACpB;;;;;;;;;;;;;AAcA,SAAgB,mBAKd,QACwC;CACxC,IAAI,WAAW;CACf,MAAM,YACJ,OAAO,MAAM,aAAa;CAC5B,WAAW,WAAW,OAAO,UAAU,QAAQ,IAC3C,OAAO,UAAU,WACjB,OAAO,UAAU,aAAa,SAC5B,uBAAuB,MAAM,0DAC7B,UAAY,OAAO,UAAU;CAEnC,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,UAC7C,QAAQ,KACN,oEAAoE,OAAO,GAAG,EAChF;CAGF,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,oBAId,QAAmD;CACnD,QACG,OAAO,UAAU,sBAAsB,UACvC,OAAO,MAAM,QAAQ,uBAAuB,UAC5C,OAAO,MAAM,QAAQ,iBAAiB,SACvC,CAAC,CAAC,OAAO;AAEb;;;;;;;;;;;;AAaA,SAAgB,qBAId,QAAmD;CACnD,OAAO,sBAAsB,MAAM,IAAI;AACzC;;;;;;;;;;;AAYA,SAAgB,sB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,cAAwB;CACjE,uBACE,OACA,eAAe,CAAC,IAAI,WAAW,MAAM,aAAa,iBAAiB,CAAC,CAAC,CACvE;AACF;;;;;;;;;;;AAYA,SAAgB,uBAKd,UACA,OACA,QACA;CACA,QACG,YAAY,SAAS,aAClB,SAAS,WAAW,OAAO,MAAM,IACjC,UACJ,OAAO,UAAU,eAChB,OAAO,UAAU,YAAY,CAAC;AAEnC"}
1
+ {"version":3,"file":"columnFilteringFeature.utils.js","names":[],"sources":["../../../src/features/column-filtering/columnFilteringFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate, isFunction } from '../../utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\nimport type {\n ColumnFiltersState,\n FilterFn,\n} from './columnFilteringFeature.types'\n\n/**\n * Creates the default column filter state.\n *\n * The feature default is an empty array, meaning no column filters are active.\n * Reset APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const filters = getDefaultColumnFiltersState()\n * ```\n */\nexport function getDefaultColumnFiltersState(): ColumnFiltersState {\n return []\n}\n\n/**\n * Chooses a built-in filter function from the column's first core row value.\n *\n * Strings use `includesString`, numbers use `inNumberRange`, booleans and\n * objects use `equals`, arrays use `arrIncludes`, and unknown values fall back\n * to `weakEquals`.\n *\n * @example\n * ```ts\n * const filterFn = column_getAutoFilterFn(column)\n * ```\n */\nexport function column_getAutoFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const filterFns: Record<string, FilterFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.filterFns\n\n const firstRow = column.table.getCoreRowModel().flatRows[0]\n\n const value = firstRow ? firstRow.getValue(column.id) : undefined\n\n if (typeof value === 'string') {\n return filterFns?.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns?.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns?.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns?.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns?.arrIncludes\n }\n\n return filterFns?.weakEquals\n}\n\n/**\n * Resolves the filter function configured for a column.\n *\n * Function-valued `columnDef.filterFn` is returned directly, `'auto'` delegates\n * to `column_getAutoFilterFn`, and string values are looked up in the table's\n * filter function registry.\n *\n * @example\n * ```ts\n * const filterFn = column_getFilterFn(column)\n * ```\n */\nexport function column_getFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n): FilterFn<TFeatures, TData> | undefined {\n let filterFn = null\n const filterFns: Record<string, FilterFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.filterFns\n filterFn = isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column_getAutoFilterFn(column)\n : filterFns?.[column.columnDef.filterFn as string]\n\n if (process.env.NODE_ENV === 'development' && !filterFn) {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`,\n )\n }\n\n return filterFn\n}\n\n/**\n * Checks whether column filtering is enabled for this accessor column.\n *\n * The column must have an accessor and filtering must be enabled by the column\n * definition, `enableColumnFilters`, and the table-wide `enableFilters` option.\n *\n * @example\n * ```ts\n * const canFilter = column_getCanFilter(column)\n * ```\n */\nexport function column_getCanFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (column.table.options.enableColumnFilters ?? true) &&\n (column.table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n}\n\n/**\n * Checks whether this column currently has an entry in `state.columnFilters`.\n *\n * This only reflects filter state presence; it does not indicate whether the\n * filter removes any rows.\n *\n * @example\n * ```ts\n * const isFiltered = column_getIsFiltered(column)\n * ```\n */\nexport function column_getIsFiltered<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column_getFilterIndex(column) > -1\n}\n\n/**\n * Reads this column's current filter value from `state.columnFilters`.\n *\n * Missing filter entries return `undefined`.\n *\n * @example\n * ```ts\n * const value = column_getFilterValue(column)\n * ```\n */\nexport function column_getFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column.table.atoms.columnFilters\n ?.get()\n ?.find((d) => d.id === column.id)?.value\n}\n\n/**\n * Finds this column's position in the ordered `state.columnFilters` array.\n *\n * The result is `-1` when the column has no active filter.\n *\n * @example\n * ```ts\n * const index = column_getFilterIndex(column)\n * ```\n */\nexport function column_getFilterIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return (\n column.table.atoms.columnFilters\n ?.get()\n ?.findIndex((d) => d.id === column.id) ?? -1\n )\n}\n\n/**\n * Adds, updates, or removes this column's filter value.\n *\n * The incoming value may be an updater. After resolution, `autoRemove` rules\n * decide whether the filter should be removed instead of stored.\n *\n * @example\n * ```ts\n * column_setFilterValue(column, (old) => String(old ?? '').trim())\n * ```\n */\nexport function column_setFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, value: any) {\n table_setColumnFilters(column.table, (old) => {\n const filterFn = column_getFilterFn(column)\n const previousFilter = old.find((d) => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined,\n )\n\n if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {\n return old.filter((d) => d.id !== column.id)\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return old.map((d) => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n })\n }\n\n if (old.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n}\n\n/**\n * Routes a column filter updater through the table's filter change handler.\n *\n * The resolved filters are cleaned before they are emitted: filters for known\n * columns are removed when their filter function says the value should be\n * auto-removed.\n *\n * @example\n * ```ts\n * table_setColumnFilters(table, (old) => old.filter((filter) => filter.id !== 'age'))\n * ```\n */\nexport function table_setColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnFiltersState>,\n) {\n const leafColumnsById = table.getAllLeafColumnsById()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old).filter((filter) => {\n const column = leafColumnsById[filter.id]\n\n if (column) {\n const filterFn = column_getFilterFn(column)\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n}\n\n/**\n * Resets `columnFilters` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.columnFilters` when it\n * exists. Passing `true` ignores initial state and resets to `[]`.\n *\n * @example\n * ```ts\n * table_resetColumnFilters(table)\n * table_resetColumnFilters(table, true)\n * ```\n */\nexport function table_resetColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnFilters(\n table,\n defaultState ? [] : cloneState(table.initialState.columnFilters ?? []),\n )\n}\n\n/**\n * Returns whether a filter value should be removed from filter state.\n *\n * This checks the filter function's `autoRemove` hook and built-in empty-value rules.\n *\n * @example\n * ```ts\n * const removeFilter = shouldAutoRemoveFilter(filterFn, value, column)\n * ```\n */\nexport function shouldAutoRemoveFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n filterFn?: FilterFn<TFeatures, TData>,\n value?: any,\n column?: Column_Internal<TFeatures, TData, TValue>,\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(value, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,+BAAmD;CACjE,OAAO,CAAC;AACV;;;;;;;;;;;;;AAcA,SAAgB,uBAId,QAAmD;CACnD,MAAM,YACJ,OAAO,MAAM,aAAa;CAE5B,MAAM,WAAW,OAAO,MAAM,gBAAgB,CAAC,CAAC,SAAS;CAEzD,MAAM,QAAQ,WAAW,SAAS,SAAS,OAAO,EAAE,IAAI;CAExD,IAAI,OAAO,UAAU,UACnB,6DAAO,UAAW;CAGpB,IAAI,OAAO,UAAU,UACnB,6DAAO,UAAW;CAGpB,IAAI,OAAO,UAAU,WACnB,6DAAO,UAAW;CAGpB,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,6DAAO,UAAW;CAGpB,IAAI,MAAM,QAAQ,KAAK,GACrB,6DAAO,UAAW;CAGpB,6DAAO,UAAW;AACpB;;;;;;;;;;;;;AAcA,SAAgB,mBAKd,QACwC;CACxC,IAAI,WAAW;CACf,MAAM,YACJ,OAAO,MAAM,aAAa;CAC5B,WAAW,WAAW,OAAO,UAAU,QAAQ,IAC3C,OAAO,UAAU,WACjB,OAAO,UAAU,aAAa,SAC5B,uBAAuB,MAAM,0DAC7B,UAAY,OAAO,UAAU;CAEnC,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,UAC7C,QAAQ,KACN,oEAAoE,OAAO,GAAG,EAChF;CAGF,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,oBAId,QAAmD;CACnD,QACG,OAAO,UAAU,sBAAsB,UACvC,OAAO,MAAM,QAAQ,uBAAuB,UAC5C,OAAO,MAAM,QAAQ,iBAAiB,SACvC,CAAC,CAAC,OAAO;AAEb;;;;;;;;;;;;AAaA,SAAgB,qBAId,QAAmD;CACnD,OAAO,sBAAsB,MAAM,IAAI;AACzC;;;;;;;;;;;AA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