@tanstack/table-core 9.0.0-alpha.53 → 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.
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.cjs +27 -12
- package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.js +27 -12
- package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.js.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.cjs.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/fns/aggregationFns.cjs.map +1 -1
- package/dist/fns/aggregationFns.js.map +1 -1
- package/dist/fns/filterFns.cjs.map +1 -1
- package/dist/fns/filterFns.js.map +1 -1
- package/dist/fns/sortFns.cjs.map +1 -1
- package/dist/fns/sortFns.js.map +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/features/column-pinning/columnPinningFeature.ts +6 -0
|
@@ -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 // 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,
|
|
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"}
|
|
@@ -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 // 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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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 === 'string' && !value)\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,+BAAmD;CACjE,OAAO,CAAC;AACV;;;;;;;;;;;;;AA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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, column)\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,+B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Kd,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' &&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E;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' ||\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a,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":"createFilteredRowModel.cjs","names":["tableMemo","table_autoResetPageIndex","table_getColumn","column_getFilterFn","table_getGlobalFilterFn","column_getCanGlobalFilter","filterRows"],"sources":["../../../src/features/column-filtering/createFilteredRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'\nimport {\n column_getCanGlobalFilter,\n table_getGlobalFilterFn,\n} from '../global-filtering/globalFilteringFeature.utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport { filterRows } from './filterRowsUtils'\nimport { column_getFilterFn } from './columnFilteringFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type {\n FilterFn,\n FilterFns,\n ResolvedColumnFilter,\n Row_ColumnFiltering,\n} from './columnFilteringFeature.types'\n\n/**\n * Creates a memoized filtered 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 createFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n filterFns: Record<keyof FilterFns, FilterFn<TFeatures, TData>>,\n): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table: Table_Internal<TFeatures, TData> = _table\n if (!table._rowModelFns.filterFns) table._rowModelFns.filterFns = filterFns\n return tableMemo({\n feature: 'columnFilteringFeature',\n table,\n fnName: 'table.getFilteredRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n ],\n fn: () => _createFilteredRowModel(table),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const rowModel = table.getPreFilteredRowModel()\n const columnFilters = table.atoms.columnFilters?.get()\n const globalFilter = table.atoms.globalFilter?.get()\n\n if (!rowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n const flatRows = rowModel.flatRows as Array<\n Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>\n >\n for (let i = 0; i < flatRows.length; i++) {\n const row = flatRows[i]!\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: Array<ResolvedColumnFilter<TFeatures, TData>> =\n []\n const resolvedGlobalFilters: Array<ResolvedColumnFilter<TFeatures, TData>> =\n []\n\n columnFilters?.forEach((columnFilter) => {\n const column = table_getColumn(table, columnFilter.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column_getFilterFn(column)!\n\n resolvedColumnFilters.push({\n id: columnFilter.id,\n filterFn,\n resolvedValue:\n filterFn.resolveFilterValue?.(columnFilter.value) ?? columnFilter.value,\n })\n })\n\n const filterableIds = columnFilters?.map((d) => d.id) ?? []\n\n const globalFilterFn = table_getGlobalFilterFn(table)\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter((column) => column_getCanGlobalFilter(column))\n\n if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach((column) => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ?? globalFilter,\n })\n })\n }\n\n // Flag the pre-filtered row model with each filter state\n const flatRows = rowModel.flatRows as Array<\n Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>\n >\n for (let i = 0; i < flatRows.length; i++) {\n const row = flatRows[i]!\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let j = 0; j < resolvedColumnFilters.length; j++) {\n const currentColumnFilter = resolvedColumnFilters[j]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n (filterMeta) => {\n !row.columnFiltersMeta\n ? (row.columnFiltersMeta = {})\n : (row.columnFiltersMeta[id] = filterMeta)\n },\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let j = 0; j < resolvedGlobalFilters.length; j++) {\n const currentGlobalFilter = resolvedGlobalFilters[j]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n (filterMeta) => {\n !row.columnFiltersMeta\n ? (row.columnFiltersMeta = {})\n : (row.columnFiltersMeta[id] = filterMeta)\n },\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & 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 // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl as any, table)\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAgB,uBAId,WACsE;CACtE,QAAQ,WAAW;EACjB,MAAM,QAA0C;EAChD,IAAI,CAAC,MAAM,aAAa,WAAW,MAAM,aAAa,YAAY;EAClE,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,uBAAuB;8BAC7B,MAAM,MAAM,6FAAe,IAAI;8BAC/B,MAAM,MAAM,4FAAc,IAAI;IAChC;;GACA,UAAU,wBAAwB,KAAK;GACvC,qBAAqBC,4DAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,wBAGP,OAAqE;;CACrE,MAAM,WAAW,MAAM,uBAAuB;CAC9C,MAAM,0CAAgB,MAAM,MAAM,+FAAe,IAAI;CACrD,MAAM,yCAAe,MAAM,MAAM,8FAAc,IAAI;CAEnD,IAAI,CAAC,SAAS,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,cAAe;EACtE,MAAM,WAAW,SAAS;EAG1B,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;GACxC,MAAM,MAAM,SAAS;GACrB,IAAI,gBAAgB,CAAC;GACrB,IAAI,oBAAoB,CAAC;EAC3B;EACA,OAAO;CACT;CAEA,MAAM,wBACJ,CAAC;CACH,MAAM,wBACJ,CAAC;CAEH,oEAAe,SAAS,iBAAiB;;EACvC,MAAM,SAASC,iDAAgB,OAAO,aAAa,EAAE;EAErD,IAAI,CAAC,QACH;EAGF,MAAM,WAAWC,wDAAmB,MAAM;EAE1C,sBAAsB,KAAK;GACzB,IAAI,aAAa;GACjB;GACA,yCACE,SAAS,iHAAqB,aAAa,KAAK,MAAK,aAAa;EACtE,CAAC;CACH,CAAC;CAED,MAAM,+EAAgB,cAAe,KAAK,MAAM,EAAE,EAAE,MAAK,CAAC;CAE1D,MAAM,iBAAiBC,6DAAwB,KAAK;CAEpD,MAAM,4BAA4B,MAC/B,kBAAkB,
|
|
1
|
+
{"version":3,"file":"createFilteredRowModel.cjs","names":["tableMemo","table_autoResetPageIndex","table_getColumn","column_getFilterFn","table_getGlobalFilterFn","column_getCanGlobalFilter","filterRows"],"sources":["../../../src/features/column-filtering/createFilteredRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'\nimport {\n column_getCanGlobalFilter,\n table_getGlobalFilterFn,\n} from '../global-filtering/globalFilteringFeature.utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport { filterRows } from './filterRowsUtils'\nimport { column_getFilterFn } from './columnFilteringFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type {\n FilterFn,\n FilterFns,\n ResolvedColumnFilter,\n Row_ColumnFiltering,\n} from './columnFilteringFeature.types'\n\n/**\n * Creates a memoized filtered 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 createFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n filterFns: Record<keyof FilterFns, FilterFn<TFeatures, TData>>,\n): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table: Table_Internal<TFeatures, TData> = _table\n if (!table._rowModelFns.filterFns) table._rowModelFns.filterFns = filterFns\n return tableMemo({\n feature: 'columnFilteringFeature',\n table,\n fnName: 'table.getFilteredRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n ],\n fn: () => _createFilteredRowModel(table),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const rowModel = table.getPreFilteredRowModel()\n const columnFilters = table.atoms.columnFilters?.get()\n const globalFilter = table.atoms.globalFilter?.get()\n\n if (!rowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n const flatRows = rowModel.flatRows as Array<\n Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>\n >\n for (let i = 0; i < flatRows.length; i++) {\n const row = flatRows[i]!\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: Array<ResolvedColumnFilter<TFeatures, TData>> =\n []\n const resolvedGlobalFilters: Array<ResolvedColumnFilter<TFeatures, TData>> =\n []\n\n columnFilters?.forEach((columnFilter) => {\n const column = table_getColumn(table, columnFilter.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column_getFilterFn(column)!\n\n resolvedColumnFilters.push({\n id: columnFilter.id,\n filterFn,\n resolvedValue:\n filterFn.resolveFilterValue?.(columnFilter.value) ?? columnFilter.value,\n })\n })\n\n const filterableIds = columnFilters?.map((d) => d.id) ?? []\n\n const globalFilterFn = table_getGlobalFilterFn(table)\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter((column) => column_getCanGlobalFilter(column))\n\n if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach((column) => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ?? globalFilter,\n })\n })\n }\n\n // Flag the pre-filtered row model with each filter state\n const flatRows = rowModel.flatRows as Array<\n Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>\n >\n for (let i = 0; i < flatRows.length; i++) {\n const row = flatRows[i]!\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let j = 0; j < resolvedColumnFilters.length; j++) {\n const currentColumnFilter = resolvedColumnFilters[j]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n (filterMeta) => {\n !row.columnFiltersMeta\n ? (row.columnFiltersMeta = {})\n : (row.columnFiltersMeta[id] = filterMeta)\n },\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let j = 0; j < resolvedGlobalFilters.length; j++) {\n const currentGlobalFilter = resolvedGlobalFilters[j]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n (filterMeta) => {\n !row.columnFiltersMeta\n ? (row.columnFiltersMeta = {})\n : (row.columnFiltersMeta[id] = filterMeta)\n },\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & 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 // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl as any, table)\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAgB,uBAId,WACsE;CACtE,QAAQ,WAAW;EACjB,MAAM,QAA0C;EAChD,IAAI,CAAC,MAAM,aAAa,WAAW,MAAM,aAAa,YAAY;EAClE,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,uBAAuB;8BAC7B,MAAM,MAAM,6FAAe,IAAI;8BAC/B,MAAM,MAAM,4FAAc,IAAI;IAChC;;GACA,UAAU,wBAAwB,KAAK;GACvC,qBAAqBC,4DAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,wBAGP,OAAqE;;CACrE,MAAM,WAAW,MAAM,uBAAuB;CAC9C,MAAM,0CAAgB,MAAM,MAAM,+FAAe,IAAI;CACrD,MAAM,yCAAe,MAAM,MAAM,8FAAc,IAAI;CAEnD,IAAI,CAAC,SAAS,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,cAAe;EACtE,MAAM,WAAW,SAAS;EAG1B,KAAK,IAAI,IAAI,GAA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C,CACF;EACF;EAGF,IAAI,sBAAsB,QAAQ;GAChC,KAAK,IAAI,IAAI,GAAG,IAAI,sBAAsB,QAAQ,KAAK;IACrD,MAAM,sBAAsB,sBAAsB;IAClD,MAAM,KAAK,oBAAoB;IAE/B,IACE,oBAAoB,SAClB,KACA,IACA,oBAAoB,gBACnB,eAAe;KACd,CAAC,IAAI,oBACA,IAAI,oBAAoB,CAAC,IACzB,IAAI,kBAAkB,MAAM;IACnC,CACF,GACA;KACA,IAAI,cAAc,aAAa;KAC/B;IACF;GACF;GAEA,IAAI,IAAI,cAAc,eAAe,MACnC,IAAI,cAAc,aAAa;EAEnC;CACF;CAEA,MAAM,kBACJ,QACG;EAEH,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KACxC,IAAI,IAAI,cAAc,cAAc,QAAS,OAC3C,OAAO;EAGX,OAAO;CACT;CAGA,OAAOC,mCAAW,SAAS,MAAM,gBAAuB,KAAK;AAC/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFilteredRowModel.js","names":[],"sources":["../../../src/features/column-filtering/createFilteredRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'\nimport {\n column_getCanGlobalFilter,\n table_getGlobalFilterFn,\n} from '../global-filtering/globalFilteringFeature.utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport { filterRows } from './filterRowsUtils'\nimport { column_getFilterFn } from './columnFilteringFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type {\n FilterFn,\n FilterFns,\n ResolvedColumnFilter,\n Row_ColumnFiltering,\n} from './columnFilteringFeature.types'\n\n/**\n * Creates a memoized filtered 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 createFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n filterFns: Record<keyof FilterFns, FilterFn<TFeatures, TData>>,\n): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table: Table_Internal<TFeatures, TData> = _table\n if (!table._rowModelFns.filterFns) table._rowModelFns.filterFns = filterFns\n return tableMemo({\n feature: 'columnFilteringFeature',\n table,\n fnName: 'table.getFilteredRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n ],\n fn: () => _createFilteredRowModel(table),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const rowModel = table.getPreFilteredRowModel()\n const columnFilters = table.atoms.columnFilters?.get()\n const globalFilter = table.atoms.globalFilter?.get()\n\n if (!rowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n const flatRows = rowModel.flatRows as Array<\n Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>\n >\n for (let i = 0; i < flatRows.length; i++) {\n const row = flatRows[i]!\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: Array<ResolvedColumnFilter<TFeatures, TData>> =\n []\n const resolvedGlobalFilters: Array<ResolvedColumnFilter<TFeatures, TData>> =\n []\n\n columnFilters?.forEach((columnFilter) => {\n const column = table_getColumn(table, columnFilter.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column_getFilterFn(column)!\n\n resolvedColumnFilters.push({\n id: columnFilter.id,\n filterFn,\n resolvedValue:\n filterFn.resolveFilterValue?.(columnFilter.value) ?? columnFilter.value,\n })\n })\n\n const filterableIds = columnFilters?.map((d) => d.id) ?? []\n\n const globalFilterFn = table_getGlobalFilterFn(table)\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter((column) => column_getCanGlobalFilter(column))\n\n if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach((column) => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ?? globalFilter,\n })\n })\n }\n\n // Flag the pre-filtered row model with each filter state\n const flatRows = rowModel.flatRows as Array<\n Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>\n >\n for (let i = 0; i < flatRows.length; i++) {\n const row = flatRows[i]!\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let j = 0; j < resolvedColumnFilters.length; j++) {\n const currentColumnFilter = resolvedColumnFilters[j]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n (filterMeta) => {\n !row.columnFiltersMeta\n ? (row.columnFiltersMeta = {})\n : (row.columnFiltersMeta[id] = filterMeta)\n },\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let j = 0; j < resolvedGlobalFilters.length; j++) {\n const currentGlobalFilter = resolvedGlobalFilters[j]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n (filterMeta) => {\n !row.columnFiltersMeta\n ? (row.columnFiltersMeta = {})\n : (row.columnFiltersMeta[id] = filterMeta)\n },\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & 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 // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl as any, table)\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAgB,uBAId,WACsE;CACtE,QAAQ,WAAW;EACjB,MAAM,QAA0C;EAChD,IAAI,CAAC,MAAM,aAAa,WAAW,MAAM,aAAa,YAAY;EAClE,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,uBAAuB;8BAC7B,MAAM,MAAM,6FAAe,IAAI;8BAC/B,MAAM,MAAM,4FAAc,IAAI;IAChC;;GACA,UAAU,wBAAwB,KAAK;GACvC,qBAAqB,yBAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,wBAGP,OAAqE;;CACrE,MAAM,WAAW,MAAM,uBAAuB;CAC9C,MAAM,0CAAgB,MAAM,MAAM,+FAAe,IAAI;CACrD,MAAM,yCAAe,MAAM,MAAM,8FAAc,IAAI;CAEnD,IAAI,CAAC,SAAS,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,cAAe;EACtE,MAAM,WAAW,SAAS;EAG1B,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;GACxC,MAAM,MAAM,SAAS;GACrB,IAAI,gBAAgB,CAAC;GACrB,IAAI,oBAAoB,CAAC;EAC3B;EACA,OAAO;CACT;CAEA,MAAM,wBACJ,CAAC;CACH,MAAM,wBACJ,CAAC;CAEH,oEAAe,SAAS,iBAAiB;;EACvC,MAAM,SAAS,gBAAgB,OAAO,aAAa,EAAE;EAErD,IAAI,CAAC,QACH;EAGF,MAAM,WAAW,mBAAmB,MAAM;EAE1C,sBAAsB,KAAK;GACzB,IAAI,aAAa;GACjB;GACA,yCACE,SAAS,iHAAqB,aAAa,KAAK,MAAK,aAAa;EACtE,CAAC;CACH,CAAC;CAED,MAAM,+EAAgB,cAAe,KAAK,MAAM,EAAE,EAAE,MAAK,CAAC;CAE1D,MAAM,iBAAiB,wBAAwB,KAAK;CAEpD,MAAM,4BAA4B,MAC/B,kBAAkB,
|
|
1
|
+
{"version":3,"file":"createFilteredRowModel.js","names":[],"sources":["../../../src/features/column-filtering/createFilteredRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'\nimport {\n column_getCanGlobalFilter,\n table_getGlobalFilterFn,\n} from '../global-filtering/globalFilteringFeature.utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport { filterRows } from './filterRowsUtils'\nimport { column_getFilterFn } from './columnFilteringFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type {\n FilterFn,\n FilterFns,\n ResolvedColumnFilter,\n Row_ColumnFiltering,\n} from './columnFilteringFeature.types'\n\n/**\n * Creates a memoized filtered 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 createFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n filterFns: Record<keyof FilterFns, FilterFn<TFeatures, TData>>,\n): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table: Table_Internal<TFeatures, TData> = _table\n if (!table._rowModelFns.filterFns) table._rowModelFns.filterFns = filterFns\n return tableMemo({\n feature: 'columnFilteringFeature',\n table,\n fnName: 'table.getFilteredRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n ],\n fn: () => _createFilteredRowModel(table),\n onAfterUpdate: () => table_autoResetPageIndex(table),\n })\n }\n}\n\nfunction _createFilteredRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const rowModel = table.getPreFilteredRowModel()\n const columnFilters = table.atoms.columnFilters?.get()\n const globalFilter = table.atoms.globalFilter?.get()\n\n if (!rowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n const flatRows = rowModel.flatRows as Array<\n Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>\n >\n for (let i = 0; i < flatRows.length; i++) {\n const row = flatRows[i]!\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n }\n return rowModel\n }\n\n const resolvedColumnFilters: Array<ResolvedColumnFilter<TFeatures, TData>> =\n []\n const resolvedGlobalFilters: Array<ResolvedColumnFilter<TFeatures, TData>> =\n []\n\n columnFilters?.forEach((columnFilter) => {\n const column = table_getColumn(table, columnFilter.id)\n\n if (!column) {\n return\n }\n\n const filterFn = column_getFilterFn(column)!\n\n resolvedColumnFilters.push({\n id: columnFilter.id,\n filterFn,\n resolvedValue:\n filterFn.resolveFilterValue?.(columnFilter.value) ?? columnFilter.value,\n })\n })\n\n const filterableIds = columnFilters?.map((d) => d.id) ?? []\n\n const globalFilterFn = table_getGlobalFilterFn(table)\n\n const globallyFilterableColumns = table\n .getAllLeafColumns()\n .filter((column) => column_getCanGlobalFilter(column))\n\n if (globalFilter && globalFilterFn && globallyFilterableColumns.length) {\n filterableIds.push('__global__')\n\n globallyFilterableColumns.forEach((column) => {\n resolvedGlobalFilters.push({\n id: column.id,\n filterFn: globalFilterFn,\n resolvedValue:\n globalFilterFn.resolveFilterValue?.(globalFilter) ?? globalFilter,\n })\n })\n }\n\n // Flag the pre-filtered row model with each filter state\n const flatRows = rowModel.flatRows as Array<\n Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>\n >\n for (let i = 0; i < flatRows.length; i++) {\n const row = flatRows[i]!\n row.columnFilters = {}\n\n if (resolvedColumnFilters.length) {\n for (let j = 0; j < resolvedColumnFilters.length; j++) {\n const currentColumnFilter = resolvedColumnFilters[j]!\n const id = currentColumnFilter.id\n\n // Tag the row with the column filter state\n row.columnFilters[id] = currentColumnFilter.filterFn(\n row,\n id,\n currentColumnFilter.resolvedValue,\n (filterMeta) => {\n !row.columnFiltersMeta\n ? (row.columnFiltersMeta = {})\n : (row.columnFiltersMeta[id] = filterMeta)\n },\n )\n }\n }\n\n if (resolvedGlobalFilters.length) {\n for (let j = 0; j < resolvedGlobalFilters.length; j++) {\n const currentGlobalFilter = resolvedGlobalFilters[j]!\n const id = currentGlobalFilter.id\n // Tag the row with the first truthy global filter state\n if (\n currentGlobalFilter.filterFn(\n row,\n id,\n currentGlobalFilter.resolvedValue,\n (filterMeta) => {\n !row.columnFiltersMeta\n ? (row.columnFiltersMeta = {})\n : (row.columnFiltersMeta[id] = filterMeta)\n },\n )\n ) {\n row.columnFilters.__global__ = true\n break\n }\n }\n\n if (row.columnFilters.__global__ !== true) {\n row.columnFilters.__global__ = false\n }\n }\n }\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & 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 // Filter final rows using all of the active filters\n return filterRows(rowModel.rows, filterRowsImpl as any, table)\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAgB,uBAId,WACsE;CACtE,QAAQ,WAAW;EACjB,MAAM,QAA0C;EAChD,IAAI,CAAC,MAAM,aAAa,WAAW,MAAM,aAAa,YAAY;EAClE,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,uBAAuB;8BAC7B,MAAM,MAAM,6FAAe,IAAI;8BAC/B,MAAM,MAAM,4FAAc,IAAI;IAChC;;GACA,UAAU,wBAAwB,KAAK;GACvC,qBAAqB,yBAAyB,KAAK;EACrD,CAAC;CACH;AACF;AAEA,SAAS,wBAGP,OAAqE;;CACrE,MAAM,WA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AAI,sBAAsB,QAAQ,KAAK;GACrD,MAAM,sBAAsB,sBAAsB;GAClD,MAAM,KAAK,oBAAoB;GAG/B,IAAI,cAAc,MAAM,oBAAoB,SAC1C,KACA,IACA,oBAAoB,gBACnB,eAAe;IACd,CAAC,IAAI,oBACA,IAAI,oBAAoB,CAAC,IACzB,IAAI,kBAAkB,MAAM;GACnC,CACF;EACF;EAGF,IAAI,sBAAsB,QAAQ;GAChC,KAAK,IAAI,IAAI,GAAG,IAAI,sBAAsB,QAAQ,KAAK;IACrD,MAAM,sBAAsB,sBAAsB;IAClD,MAAM,KAAK,oBAAoB;IAE/B,IACE,oBAAoB,SAClB,KACA,IACA,oBAAoB,gBACnB,eAAe;KACd,CAAC,IAAI,oBACA,IAAI,oBAAoB,CAAC,IACzB,IAAI,kBAAkB,MAAM;IACnC,CACF,GACA;KACA,IAAI,cAAc,aAAa;KAC/B;IACF;GACF;GAEA,IAAI,IAAI,cAAc,eAAe,MACnC,IAAI,cAAc,aAAa;EAEnC;CACF;CAEA,MAAM,kBACJ,QACG;EAEH,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KACxC,IAAI,IAAI,cAAc,cAAc,QAAS,OAC3C,OAAO;EAGX,OAAO;CACT;CAGA,OAAO,WAAW,SAAS,MAAM,gBAAuB,KAAK;AAC/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnGroupingFeature.utils.cjs","names":["isFunction","cloneState"],"sources":["../../../src/features/column-grouping/columnGroupingFeature.utils.ts"],"sourcesContent":["import { cloneState, isFunction } from '../../utils'\nimport type { Column_Internal } from '../../types/Column'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\nimport type {\n AggregationFn,\n GroupingState,\n Row_ColumnGrouping,\n} from './columnGroupingFeature.types'\n\n/**\n * Creates the default grouping state.\n *\n * The feature default is an empty array, meaning no columns are grouped. Reset\n * APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const grouping = getDefaultGroupingState()\n * ```\n */\nexport function getDefaultGroupingState(): GroupingState {\n return []\n}\n\n/**\n * Adds or removes this column id from the grouping state.\n *\n * Existing grouped columns keep their order. A column already present in\n * `state.grouping` is removed; otherwise it is appended.\n *\n * @example\n * ```ts\n * column_toggleGrouping(column)\n * ```\n */\nexport function column_toggleGrouping<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n table_setGrouping(column.table, (old) => {\n // Find any existing grouping for this column\n if (old.includes(column.id)) {\n return old.filter((d) => d !== column.id)\n }\n\n return [...old, column.id]\n })\n}\n\n/**\n * Checks whether this column can be used for grouping.\n *\n * Grouping must be enabled at the column and table level, and the column must\n * either have an accessor or provide `getGroupingValue`.\n *\n * @example\n * ```ts\n * const canGroup = column_getCanGroup(column)\n * ```\n */\nexport function column_getCanGroup<\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.enableGrouping ?? true) &&\n (column.table.options.enableGrouping ?? true) &&\n (!!column.accessorFn || !!column.columnDef.getGroupingValue)\n )\n}\n\n/**\n * Checks whether this column id is present in `state.grouping`.\n *\n * The result only reflects grouping state, not whether the grouped row model has\n * been calculated yet.\n *\n * @example\n * ```ts\n * const isGrouped = column_getIsGrouped(column)\n * ```\n */\nexport function column_getIsGrouped<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): boolean {\n return !!column.table.atoms.grouping?.get()?.includes(column.id)\n}\n\n/**\n * Finds this column's position in the ordered grouping state.\n *\n * The result is `-1` when the column is not grouped.\n *\n * @example\n * ```ts\n * const index = column_getGroupedIndex(column)\n * ```\n */\nexport function column_getGroupedIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return column.table.atoms.grouping?.get()?.indexOf(column.id) ?? -1\n}\n\n/**\n * Creates a header/control handler that toggles grouping for this column.\n *\n * The handler is a no-op when `column_getCanGroup(column)` is false.\n *\n * @example\n * ```ts\n * const onClick = column_getToggleGroupingHandler(column)\n * ```\n */\nexport function column_getToggleGroupingHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const canGroup = column_getCanGroup(column)\n\n return () => {\n if (!canGroup) return\n column_toggleGrouping(column)\n }\n}\n\n/**\n * Chooses a built-in aggregation function from the first core row value.\n *\n * Numeric columns default to `sum`, date-like values default to `extent`, and\n * other value types leave aggregation unspecified.\n *\n * @example\n * ```ts\n * const aggregationFn = column_getAutoAggregationFn(column)\n * ```\n */\nexport function column_getAutoAggregationFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const aggregationFns:\n | Record<string, AggregationFn<TFeatures, TData>>\n | undefined = column.table._rowModelFns.aggregationFns\n\n const firstRow = column.table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'number') {\n return aggregationFns?.sum\n }\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns?.extent\n }\n}\n\n/**\n * Resolves the aggregation function configured for a column.\n *\n * Function-valued `columnDef.aggregationFn` is returned directly, `'auto'`\n * delegates to `column_getAutoAggregationFn`, and string values are looked up in\n * the table's aggregation function registry.\n *\n * @example\n * ```ts\n * const aggregationFn = column_getAggregationFn(column)\n * ```\n */\nexport function column_getAggregationFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const aggregationFns:\n | Record<string, AggregationFn<TFeatures, TData>>\n | undefined = column.table._rowModelFns.aggregationFns\n\n return isFunction(column.columnDef.aggregationFn)\n ? column.columnDef.aggregationFn\n : column.columnDef.aggregationFn === 'auto'\n ? column_getAutoAggregationFn(column)\n : aggregationFns?.[column.columnDef.aggregationFn as string]\n}\n\n/**\n * Routes a grouping updater through the table's grouping change handler.\n *\n * The updater may be a next `GroupingState` array or a function of the previous\n * grouping state, matching the instance `table.setGrouping` behavior.\n *\n * @example\n * ```ts\n * table_setGrouping(table, (old) => [...old, 'status'])\n * ```\n */\nexport function table_setGrouping<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<GroupingState>) {\n table.options.onGroupingChange?.(updater)\n}\n\n/**\n * Resets `grouping` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.grouping` when it\n * exists. Passing `true` ignores initial state and resets to `[]`.\n *\n * @example\n * ```ts\n * table_resetGrouping(table)\n * table_resetGrouping(table, true)\n * ```\n */\nexport function table_resetGrouping<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setGrouping(\n table,\n defaultState ? [] : cloneState(table.initialState.grouping ?? []),\n )\n}\n\n/**\n * Checks whether this row was created as a grouped row.\n *\n * Grouped rows carry a `groupingColumnId`; ordinary leaf rows do not.\n *\n * @example\n * ```ts\n * const isGrouped = row_getIsGrouped(row)\n * ```\n */\nexport function row_getIsGrouped<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData> & Partial<Row_ColumnGrouping>) {\n return !!row.groupingColumnId\n}\n\n/**\n * Reads and caches this row's grouping value for a column.\n *\n * `columnDef.getGroupingValue` wins when provided; otherwise the normal row\n * accessor value is used.\n *\n * @example\n * ```ts\n * const groupValue = row_getGroupingValue(row, 'status')\n * ```\n */\nexport function row_getGroupingValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData> & Partial<Row_ColumnGrouping>, columnId: string) {\n if (row._groupingValuesCache?.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId) as Column_Internal<\n TFeatures,\n TData\n >\n\n if (!column.columnDef.getGroupingValue) {\n return row.getValue(columnId)\n }\n\n if (row._groupingValuesCache) {\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(\n row.original,\n )\n }\n\n return row._groupingValuesCache?.[columnId]\n}\n\n/**\n * Checks whether this cell represents the grouped column for a grouped row.\n *\n * This is the cell that usually renders the grouped value and expansion control.\n *\n * @example\n * ```ts\n * const isGroupedCell = cell_getIsGrouped(cell)\n * ```\n */\nexport function cell_getIsGrouped<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(cell: Cell<TFeatures, TData, TValue>) {\n const row = cell.row as Row<TFeatures, TData> & Partial<Row_ColumnGrouping>\n return (\n column_getIsGrouped(cell.column) && cell.column.id === row.groupingColumnId\n )\n}\n\n/**\n * Checks whether this cell is a placeholder hidden by grouping.\n *\n * Placeholder cells belong to grouped columns other than the row's active\n * grouping column.\n *\n * @example\n * ```ts\n * const isPlaceholder = cell_getIsPlaceholder(cell)\n * ```\n */\nexport function cell_getIsPlaceholder<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(cell: Cell<TFeatures, TData, TValue>) {\n return !cell_getIsGrouped(cell) && column_getIsGrouped(cell.column)\n}\n\n/**\n * Checks whether this cell should render an aggregated value.\n *\n * Aggregated cells are non-placeholder, non-grouped cells on rows that have\n * subRows.\n *\n * @example\n * ```ts\n * const isAggregated = cell_getIsAggregated(cell)\n * ```\n */\nexport function cell_getIsAggregated<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(cell: Cell<TFeatures, TData, TValue>) {\n return (\n !cell_getIsGrouped(cell) &&\n !cell_getIsPlaceholder(cell) &&\n !!cell.row.subRows.length\n )\n}\n"],"mappings":";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A,yBAAW,OAAO,UAAU,aAAa,IAC5C,OAAO,UAAU,gBACjB,OAAO,UAAU,kBAAkB,SACjC,4BAA4B,MAAM,oEAClC,eAAiB,OAAO,UAAU;AAC1C;;;;;;;;;;;;AAaA,SAAgB,kBAGd,OAAyC,SAAiC;;CAC1E,iDAAM,SAAQ,6GAAmB,OAAO;AAC1C;;;;;;;;;;;;;AAcA,SAAgB,oBAGd,OAAyC,cAAwB;CACjE,kBACE,OACA,eAAe,CAAC,IAAIC,yBAAW,MAAM,aAAa,YAAY,CAAC,CAAC,CAClE;AACF;;;;;;;;;;;AAYA,SAAgB,iBAGd,KAA0D;CAC1D,OAAO,CAAC,CAAC,IAAI;AACf;;;;;;;;;;;;AAaA,SAAgB,qBAGd,KAA0D,UAAkB;;CAC5E,6BAAI,IAAI,oGAAsB,eAAe,QAAQ,GACnD,OAAO,IAAI,qBAAqB;CAGlC,MAAM,SAAS,IAAI,MAAM,UAAU,QAAQ;CAK3C,IAAI,CAAC,OAAO,UAAU,kBACpB,OAAO,IAAI,SAAS,QAAQ;CAG9B,IAAI,IAAI,sBACN,IAAI,qBAAqB,YAAY,OAAO,UAAU,iBACpD,IAAI,QACN;CAGF,iCAAO,IAAI,sGAAuB;AACpC;;;;;;;;;;;AAYA,SAAgB,kBAId,MAAsC;CACtC,MAAM,MAAM,KAAK;CACjB,OACE,oBAAoB,KAAK,MAAM,KAAK,KAAK,OAAO,OAAO,IAAI;AAE/D;;;;;;;;;;;;AAaA,SAAgB,sBAId,MAAsC;CACtC,OAAO,CAAC,kBAAkB,IAAI,KAAK,oBAAoB,KAAK,MAAM;AACpE;;;;;;;;;;;;AAaA,SAAgB,qBAId,MAAsC;CACtC,OACE,CAAC,kBAAkB,IAAI,KACvB,CAAC,sBAAsB,IAAI,KAC3B,CAAC,CAAC,KAAK,IAAI,QAAQ;AAEvB"}
|
|
1
|
+
{"version":3,"file":"columnGroupingFeature.utils.cjs","names":["isFunction","cloneState"],"sources":["../../../src/features/column-grouping/columnGroupingFeature.utils.ts"],"sourcesContent":["import { cloneState, isFunction } from '../../utils'\nimport type { Column_Internal } from '../../types/Column'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\nimport type {\n AggregationFn,\n GroupingState,\n Row_ColumnGrouping,\n} from './columnGroupingFeature.types'\n\n/**\n * Creates the default grouping state.\n *\n * The feature default is an empty array, meaning no columns are grouped. Reset\n * APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const grouping = getDefaultGroupingState()\n * ```\n */\nexport function getDefaultGroupingState(): GroupingState {\n return []\n}\n\n/**\n * Adds or removes this column id from the grouping state.\n *\n * Existing grouped columns keep their order. A column already present in\n * `state.grouping` is removed; otherwise it is appended.\n *\n * @example\n * ```ts\n * column_toggleGrouping(column)\n * ```\n */\nexport function column_toggleGrouping<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n table_setGrouping(column.table, (old) => {\n // Find any existing grouping for this column\n if (old.includes(column.id)) {\n return old.filter((d) => d !== column.id)\n }\n\n return [...old, column.id]\n })\n}\n\n/**\n * Checks whether this column can be used for grouping.\n *\n * Grouping must be enabled at the column and table level, and the column must\n * either have an accessor or provide `getGroupingValue`.\n *\n * @example\n * ```ts\n * const canGroup = column_getCanGroup(column)\n * ```\n */\nexport function column_getCanGroup<\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.enableGrouping ?? true) &&\n (column.table.options.enableGrouping ?? true) &&\n (!!column.accessorFn || !!column.columnDef.getGroupingValue)\n )\n}\n\n/**\n * Checks whether this column id is present in `state.grouping`.\n *\n * The result only reflects grouping state, not whether the grouped row model has\n * been calculated yet.\n *\n * @example\n * ```ts\n * const isGrouped = column_getIsGrouped(column)\n * ```\n */\nexport function column_getIsGrouped<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): boolean {\n return !!column.table.atoms.grouping?.get()?.includes(column.id)\n}\n\n/**\n * Finds this column's position in the ordered grouping state.\n *\n * The result is `-1` when the column is not grouped.\n *\n * @example\n * ```ts\n * const index = column_getGroupedIndex(column)\n * ```\n */\nexport function column_getGroupedIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return column.table.atoms.grouping?.get()?.indexOf(column.id) ?? -1\n}\n\n/**\n * Creates a header/control handler that toggles grouping for this column.\n *\n * The handler is a no-op when `column_getCanGroup(column)` is false.\n *\n * @example\n * ```ts\n * const onClick = column_getToggleGroupingHandler(column)\n * ```\n */\nexport function column_getToggleGroupingHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const canGroup = column_getCanGroup(column)\n\n return () => {\n if (!canGroup) return\n column_toggleGrouping(column)\n }\n}\n\n/**\n * Chooses a built-in aggregation function from the first core row value.\n *\n * Numeric columns default to `sum`, date-like values default to `extent`, and\n * other value types leave aggregation unspecified.\n *\n * @example\n * ```ts\n * const aggregationFn = column_getAutoAggregationFn(column)\n * ```\n */\nexport function column_getAutoAggregationFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const aggregationFns:\n | Record<string, AggregationFn<TFeatures, TData>>\n | undefined = column.table._rowModelFns.aggregationFns\n\n const firstRow = column.table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\n\n if (typeof value === 'number') {\n return aggregationFns?.sum\n }\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n return aggregationFns?.extent\n }\n}\n\n/**\n * Resolves the aggregation function configured for a column.\n *\n * Function-valued `columnDef.aggregationFn` is returned directly, `'auto'`\n * delegates to `column_getAutoAggregationFn`, and string values are looked up in\n * the table's aggregation function registry.\n *\n * @example\n * ```ts\n * const aggregationFn = column_getAggregationFn(column)\n * ```\n */\nexport function column_getAggregationFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const aggregationFns:\n | Record<string, AggregationFn<TFeatures, TData>>\n | undefined = column.table._rowModelFns.aggregationFns\n\n return isFunction(column.columnDef.aggregationFn)\n ? column.columnDef.aggregationFn\n : column.columnDef.aggregationFn === 'auto'\n ? column_getAutoAggregationFn(column)\n : aggregationFns?.[column.columnDef.aggregationFn as string]\n}\n\n/**\n * Routes a grouping updater through the table's grouping change handler.\n *\n * The updater may be a next `GroupingState` array or a function of the previous\n * grouping state, matching the instance `table.setGrouping` behavior.\n *\n * @example\n * ```ts\n * table_setGrouping(table, (old) => [...old, 'status'])\n * ```\n */\nexport function table_setGrouping<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<GroupingState>) {\n table.options.onGroupingChange?.(updater)\n}\n\n/**\n * Resets `grouping` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.grouping` when it\n * exists. Passing `true` ignores initial state and resets to `[]`.\n *\n * @example\n * ```ts\n * table_resetGrouping(table)\n * table_resetGrouping(table, true)\n * ```\n */\nexport function table_resetGrouping<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setGrouping(\n table,\n defaultState ? [] : cloneState(table.initialState.grouping ?? []),\n )\n}\n\n/**\n * Checks whether this row was created as a grouped row.\n *\n * Grouped rows carry a `groupingColumnId`; ordinary leaf rows do not.\n *\n * @example\n * ```ts\n * const isGrouped = row_getIsGrouped(row)\n * ```\n */\nexport function row_getIsGrouped<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData> & Partial<Row_ColumnGrouping>) {\n return !!row.groupingColumnId\n}\n\n/**\n * Reads and caches this row's grouping value for a column.\n *\n * `columnDef.getGroupingValue` wins when provided; otherwise the normal row\n * accessor value is used.\n *\n * @example\n * ```ts\n * const groupValue = row_getGroupingValue(row, 'status')\n * ```\n */\nexport function row_getGroupingValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData> & Partial<Row_ColumnGrouping>, columnId: string) {\n if (row._groupingValuesCache?.hasOwnProperty(columnId)) {\n return row._groupingValuesCache[columnId]\n }\n\n const column = row.table.getColumn(columnId) as Column_Internal<\n TFeatures,\n TData\n >\n\n if (!column.columnDef.getGroupingValue) {\n return row.getValue(columnId)\n }\n\n if (row._groupingValuesCache) {\n row._groupingValuesCache[columnId] = column.columnDef.getGroupingValue(\n row.original,\n )\n }\n\n return row._groupingValuesCache?.[columnId]\n}\n\n/**\n * Checks whether this cell represents the grouped column for a grouped row.\n *\n * This is the cell that usually renders the grouped value and expansion control.\n *\n * @example\n * ```ts\n * const isGroupedCell = cell_getIsGrouped(cell)\n * ```\n */\nexport function cell_getIsGrouped<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(cell: Cell<TFeatures, TData, TValue>) {\n const row = cell.row as Row<TFeatures, TData> & Partial<Row_ColumnGrouping>\n return (\n column_getIsGrouped(cell.column) && cell.column.id === row.groupingColumnId\n )\n}\n\n/**\n * Checks whether this cell is a placeholder hidden by grouping.\n *\n * Placeholder cells belong to grouped columns other than the row's active\n * grouping column.\n *\n * @example\n * ```ts\n * const isPlaceholder = cell_getIsPlaceholder(cell)\n * ```\n */\nexport function cell_getIsPlaceholder<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(cell: Cell<TFeatures, TData, TValue>) {\n return !cell_getIsGrouped(cell) && column_getIsGrouped(cell.column)\n}\n\n/**\n * Checks whether this cell should render an aggregated value.\n *\n * Aggregated cells are non-placeholder, non-grouped cells on rows that have\n * subRows.\n *\n * @example\n * ```ts\n * const isAggregated = cell_getIsAggregated(cell)\n * ```\n */\nexport function cell_getIsAggregated<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(cell: Cell<TFeatures, TData, TValue>) {\n return (\n !cell_getIsGrouped(cell) &&\n !cell_getIsPlaceholder(cell) &&\n !!cell.row.subRows.length\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAwBA,SAAgB,0BAAyC;CACvD,OAAO,CAAC;AACV;;;;;;;;;;;;AAaA,SAAgB,sBAId,QAAmD;CACnD,kBAAkB,OAAO,QAAQ,QAAQ;EAEvC,IAAI,IAAI,SAAS,OAAO,EAAE,GACxB,OAAO,IAAI,QAAQ,MAAM,MAAM,OAAO,EAAE;EAG1C,OAAO,CAAC,GAAG,KAAK,OAAO,EAAE;CAC3B,CAAC;AACH;;;;;;;;;;;;AAaA,SAAgB,mBAId,QAAmD;CACnD,QACG,OAAO,UAAU,kBAAkB,UACnC,OAAO,MAAM,QAAQ,kBAAkB,UACvC,CAAC,CAAC,OAAO,cAAc,CAAC,CAAC,OAAO,UAAU;AAE/C;;;;;;;;;;;;AAaA,SAAgB,oBAId,QAA4D;;CAC5D,OAAO,CAAC,2BAAC,OAAO,MAAM,MAAM,yGAAU,IAAI,iFAAG,SAAS,OAAO,EAAE;AACjE;;;;;;;;;;;AAYA,SAAgB,uBAId,QAA2D;;CAC3D,kCAAO,OAAO,MAAM,MAAM,4GAAU,IAAI,mFAAG,QAAQ,OAAO,EAAE,MAAK;AACnE;;;;;;;;;;;AAYA,SAAgB,gCAId,QAAmD;CACnD,MAAM,WAAW,mBAAmB,MAAM;CAE1C,aAAa;EACX,IAAI,CAAC,UAAU;EACf,sBAAsB,MAAM;CAC9B;AACF;;;;;;;;;;;;AAaA,SAAgB,4BAId,QAAmD;CACnD,MAAM,iBAEU,OAAO,MAAM,aAAa;CAE1C,MA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