@tanstack/table-core 8.14.0 → 8.15.1
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/build/lib/core/row.d.ts +1 -1
- package/build/lib/core/table.js +5 -2
- package/build/lib/core/table.js.map +1 -1
- package/build/lib/features/ColumnFaceting.d.ts +6 -6
- package/build/lib/features/ColumnFaceting.js.map +1 -1
- package/build/lib/features/ColumnFiltering.d.ts +48 -48
- package/build/lib/features/ColumnFiltering.js.map +1 -1
- package/build/lib/features/GlobalFaceting.d.ts +26 -0
- package/build/lib/features/GlobalFaceting.js +42 -0
- package/build/lib/features/GlobalFaceting.js.map +1 -0
- package/build/lib/features/GlobalFiltering.d.ts +21 -42
- package/build/lib/features/GlobalFiltering.js +1 -23
- package/build/lib/features/GlobalFiltering.js.map +1 -1
- package/build/lib/index.d.ts +1 -0
- package/build/lib/index.esm.js +34 -26
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +2 -0
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +34 -26
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/types.d.ts +3 -2
- package/build/umd/index.development.js +34 -25
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/core/table.ts +3 -1
- package/src/features/ColumnFaceting.ts +6 -6
- package/src/features/ColumnFiltering.ts +48 -48
- package/src/features/GlobalFaceting.ts +66 -0
- package/src/features/GlobalFiltering.ts +22 -78
- package/src/index.ts +1 -0
- package/src/types.ts +6 -2
package/build/lib/core/row.d.ts
CHANGED
|
@@ -88,4 +88,4 @@ export interface CoreRow<TData extends RowData> {
|
|
|
88
88
|
*/
|
|
89
89
|
subRows: Row<TData>[];
|
|
90
90
|
}
|
|
91
|
-
export declare const createRow: <TData extends unknown>(table: Table<TData>, id: string, original: TData, rowIndex: number, depth: number, subRows?: Row<TData>[]
|
|
91
|
+
export declare const createRow: <TData extends unknown>(table: Table<TData>, id: string, original: TData, rowIndex: number, depth: number, subRows?: Row<TData>[], parentId?: string) => Row<TData>;
|
package/build/lib/core/table.js
CHANGED
|
@@ -20,6 +20,7 @@ var ColumnOrdering = require('../features/ColumnOrdering.js');
|
|
|
20
20
|
var ColumnPinning = require('../features/ColumnPinning.js');
|
|
21
21
|
var ColumnSizing = require('../features/ColumnSizing.js');
|
|
22
22
|
var ColumnVisibility = require('../features/ColumnVisibility.js');
|
|
23
|
+
var GlobalFaceting = require('../features/GlobalFaceting.js');
|
|
23
24
|
var GlobalFiltering = require('../features/GlobalFiltering.js');
|
|
24
25
|
var RowExpanding = require('../features/RowExpanding.js');
|
|
25
26
|
var RowPagination = require('../features/RowPagination.js');
|
|
@@ -27,8 +28,10 @@ var RowPinning = require('../features/RowPinning.js');
|
|
|
27
28
|
var RowSelection = require('../features/RowSelection.js');
|
|
28
29
|
var RowSorting = require('../features/RowSorting.js');
|
|
29
30
|
|
|
30
|
-
const builtInFeatures = [headers.Headers, ColumnVisibility.ColumnVisibility, ColumnOrdering.ColumnOrdering, ColumnPinning.ColumnPinning, ColumnFaceting.ColumnFaceting, ColumnFiltering.ColumnFiltering,
|
|
31
|
-
//depends on
|
|
31
|
+
const builtInFeatures = [headers.Headers, ColumnVisibility.ColumnVisibility, ColumnOrdering.ColumnOrdering, ColumnPinning.ColumnPinning, ColumnFaceting.ColumnFaceting, ColumnFiltering.ColumnFiltering, GlobalFaceting.GlobalFaceting,
|
|
32
|
+
//depends on ColumnFaceting
|
|
33
|
+
GlobalFiltering.GlobalFiltering,
|
|
34
|
+
//depends on ColumnFiltering
|
|
32
35
|
RowSorting.RowSorting, ColumnGrouping.ColumnGrouping,
|
|
33
36
|
//depends on RowSorting
|
|
34
37
|
RowExpanding.RowExpanding, RowPagination.RowPagination, RowPinning.RowPinning, RowSelection.RowSelection, ColumnSizing.ColumnSizing];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sources":["../../../src/core/table.ts"],"sourcesContent":["import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFiltering, //depends on ColumnFiltering and ColumnFaceting\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions<TData extends RowData> {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef<TData, any>[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial<ColumnDef<TData, unknown>>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table<any>) => () => RowModel<any>\n /**\n * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string\n /**\n * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions<TData>,\n options: Partial<TableOptions<TData>>\n ) => TableOptions<TData>\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta<TData>\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater<TableState>) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial<TableState>\n}\n\nexport interface CoreInstance<TData extends RowData> {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record<string, Column<TData, unknown>>\n _getColumnDefs: () => ColumnDef<TData, unknown>[]\n _getCoreRowModel?: () => RowModel<TData>\n _getDefaultColumnDef: () => Partial<ColumnDef<TData, unknown>>\n _getRowId: (_: TData, index: number, parent?: Row<TData>) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column<TData, unknown>[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column<TData, unknown>[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column<TData, unknown>[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column<TData, unknown> | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel<TData>\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row<TData>\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel<TData>\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys<TableOptionsResolved<TData>, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater<TableOptionsResolved<TData>>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater<TableState>) => void\n}\n\nexport function createTable<TData extends RowData>(\n options: TableOptionsResolved<TData>\n): Table<TData> {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table<TData>\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved<TData>\n\n const mergeOptions = (options: TableOptionsResolved<TData>) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance<TData> = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved<TData>,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater<TableState>) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row<TData>) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef<TData, unknown>\n >\n\n return {\n header: props => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n // footer: props => props.header.column.id,\n cell: props => props.renderValue<any>()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial<ColumnDef<TData, unknown>>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef<TData, unknown>[],\n parent?: Column<TData, unknown>,\n depth = 0\n ): Column<TData, unknown>[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record<string, Column<TData, unknown>>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n"],"names":["builtInFeatures","Headers","ColumnVisibility","ColumnOrdering","ColumnPinning","ColumnFaceting","ColumnFiltering","GlobalFiltering","RowSorting","ColumnGrouping","RowExpanding","RowPagination","RowPinning","RowSelection","ColumnSizing","createTable","options","_options$_features","_options$initialState","process","env","NODE_ENV","debugAll","debugTable","console","info","_features","table","defaultOptions","reduce","obj","feature","Object","assign","getDefaultOptions","mergeOptions","coreInitialState","initialState","forEach","_feature$getInitialSt","getInitialState","queued","queuedTimeout","coreInstance","_queue","cb","push","Promise","resolve","then","length","shift","catch","error","setTimeout","reset","setState","setOptions","updater","newOptions","functionalUpdate","getState","state","onStateChange","_getRowId","row","index","parent","_table$options$getRow","getRowId","id","join","getCoreRowModel","_getCoreRowModel","getRowModel","getPaginationRowModel","getRow","searchAll","getPrePaginationRowModel","rowsById","Error","_getDefaultColumnDef","memo","defaultColumn","_defaultColumn","header","props","resolvedColumnDef","column","columnDef","accessorKey","accessorFn","cell","_props$renderValue$to","_props$renderValue","renderValue","toString","getDefaultColumnDef","getMemoOptions","_getColumnDefs","columns","getAllColumns","columnDefs","recurseColumns","depth","map","createColumn","groupingColumnDef","getAllFlatColumns","allColumns","flatMap","getFlatColumns","_getAllFlatColumnsById","flatColumns","acc","getAllLeafColumns","_getOrderColumnsFn","orderColumns","leafColumns","getLeafColumns","getColumn","columnId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAMA,eAAe,GAAG,CACtBC,eAAO,EACPC,iCAAgB,EAChBC,6BAAc,EACdC,2BAAa,EACbC,6BAAc,EACdC,+BAAe,EACfC,+BAAe;AAAE;AACjBC,qBAAU,EACVC,6BAAc;AAAE;AAChBC,yBAAY,EACZC,2BAAa,EACbC,qBAAU,EACVC,yBAAY,EACZC,yBAAY,CACJ,CAAA;;AAEV;;AAgOO,SAASC,WAAWA,CACzBC,OAAoC,EACtB;EAAA,IAAAC,kBAAA,EAAAC,qBAAA,CAAA;AACd,EAAA,IACEC,O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c,CAAClF,OAAO,EAAE,cAAc,EAAE,mBAAmB,CAC7D,CAAC;IAEDwG,SAAS,EAAEC,QAAQ,IAAI;MACrB,MAAMjC,MAAM,GAAG7D,KAAK,CAACqF,sBAAsB,EAAE,CAACS,QAAQ,CAAC,CAAA;MAEvD,IAAItG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAI,CAACmE,MAAM,EAAE;AACpDhE,QAAAA,OAAO,CAAC6B,KAAK,CAAE,CAA0BoE,wBAAAA,EAAAA,QAAS,mBAAkB,CAAC,CAAA;AACvE,OAAA;AAEA,MAAA,OAAOjC,MAAM,CAAA;AACf,KAAA;GACD,CAAA;AAEDxD,EAAAA,MAAM,CAACC,MAAM,CAACN,KAAK,EAAEgB,YAAY,CAAC,CAAA;AAElC,EAAA,KAAK,IAAIuB,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGvC,KAAK,CAACD,SAAS,CAACwB,MAAM,EAAEgB,KAAK,EAAE,EAAE;AAC3D,IAAA,MAAMnC,OAAO,GAAGJ,KAAK,CAACD,SAAS,CAACwC,KAAK,CAAC,CAAA;IACtCnC,OAAO,IAAA,IAAA,IAAPA,OAAO,CAAEhB,WAAW,IAAA,IAAA,IAApBgB,OAAO,CAAEhB,WAAW,CAAGY,KAAK,CAAC,CAAA;AAC/B,GAAA;AAEA,EAAA,OAAOA,KAAK,CAAA;AACd;;;;"}
|
|
1
|
+
{"version":3,"file":"table.js","sources":["../../../src/core/table.ts"],"sourcesContent":["import { functionalUpdate, getMemoOptions, memo, RequiredKeys } from '../utils'\n\nimport {\n Updater,\n TableOptionsResolved,\n TableState,\n Table,\n InitialTableState,\n Row,\n Column,\n RowModel,\n ColumnDef,\n TableOptions,\n RowData,\n TableMeta,\n ColumnDefResolved,\n GroupColumnDef,\n TableFeature,\n} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnFaceting } from '../features/ColumnFaceting'\nimport { ColumnFiltering } from '../features/ColumnFiltering'\nimport { ColumnGrouping } from '../features/ColumnGrouping'\nimport { ColumnOrdering } from '../features/ColumnOrdering'\nimport { ColumnPinning } from '../features/ColumnPinning'\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { ColumnVisibility } from '../features/ColumnVisibility'\nimport { GlobalFaceting } from '../features/GlobalFaceting'\nimport { GlobalFiltering } from '../features/GlobalFiltering'\nimport { RowExpanding } from '../features/RowExpanding'\nimport { RowPagination } from '../features/RowPagination'\nimport { RowPinning } from '../features/RowPinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { RowSorting } from '../features/RowSorting'\n\nconst builtInFeatures = [\n Headers,\n ColumnVisibility,\n ColumnOrdering,\n ColumnPinning,\n ColumnFaceting,\n ColumnFiltering,\n GlobalFaceting, //depends on ColumnFaceting\n GlobalFiltering, //depends on ColumnFiltering\n RowSorting,\n ColumnGrouping, //depends on RowSorting\n RowExpanding,\n RowPagination,\n RowPinning,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions<TData extends RowData> {\n /**\n * An array of extra features that you can add to the table instance.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#_features)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n _features?: TableFeature[]\n /**\n * Set this option to override any of the `autoReset...` feature options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#autoresetall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n autoResetAll?: boolean\n /**\n * The array of column defs to use for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#columns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n columns: ColumnDef<TData, any>[]\n /**\n * The data for the table to display. This array should match the type you provided to `table.setRowType<...>`. Columns can access this data via string/index or a functional accessor. When the `data` option changes reference, the table will reprocess the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#data)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n data: TData[]\n /**\n * Set this option to `true` to output all debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugall)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugAll?: boolean\n /**\n * Set this option to `true` to output cell debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcells]\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugCells?: boolean\n /**\n * Set this option to `true` to output column debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugColumns?: boolean\n /**\n * Set this option to `true` to output header debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugheaders)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugHeaders?: boolean\n /**\n * Set this option to `true` to output row debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugRows?: boolean\n /**\n * Set this option to `true` to output table debugging information to the console.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#debugtable)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n debugTable?: boolean\n /**\n * Default column options to use for all column defs supplied to the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#defaultcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n defaultColumn?: Partial<ColumnDef<TData, unknown>>\n /**\n * This required option is a factory for a function that computes and returns the core row model for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: (table: Table<any>) => () => RowModel<any>\n /**\n * This optional function is used to derive a unique ID for any given row. If not provided the rows index is used (nested rows join together with `.` using their grandparents' index eg. `index.index.index`). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity eg. a userId, taskId, database ID field, etc.\n * @example getRowId: row => row.userId\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowid)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string\n /**\n * This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.\n * @example getSubRows: row => row.subRows\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getsubrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getSubRows?: (originalRow: TData, index: number) => undefined | TData[]\n /**\n * Use this option to optionally pass initial state to the table. This state will be used when resetting various table states either automatically by the table (eg. `options.autoResetPageIndex`) or via functions like `table.resetRowSelection()`. Most reset function allow you optionally pass a flag to reset to a blank/default state instead of the initial state.\n *\n * Table state will not be reset when this object changes, which also means that the initial state object does not need to be stable.\n *\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState?: InitialTableState\n /**\n * This option is used to optionally implement the merging of table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#mergeoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n mergeOptions?: (\n defaultOptions: TableOptions<TData>,\n options: Partial<TableOptions<TData>>\n ) => TableOptions<TData>\n /**\n * You can pass any object to `options.meta` and access it anywhere the `table` is available via `table.options.meta`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#meta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n meta?: TableMeta<TData>\n /**\n * The `onStateChange` option can be used to optionally listen to state changes within the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#onstatechange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n onStateChange: (updater: Updater<TableState>) => void\n /**\n * Value used when the desired value is not found in the data.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#renderfallbackvalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n renderFallbackValue: any\n /**\n * The `state` option can be used to optionally _control_ part or all of the table state. The state you pass here will merge with and overwrite the internal automatically-managed state to produce the final state for the table. You can also listen to state changes via the `onStateChange` option.\n * > Note: Any state passed in here will override both the internal state and any other `initialState` you provide.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#state)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n state: Partial<TableState>\n}\n\nexport interface CoreInstance<TData extends RowData> {\n _features: readonly TableFeature[]\n _getAllFlatColumnsById: () => Record<string, Column<TData, unknown>>\n _getColumnDefs: () => ColumnDef<TData, unknown>[]\n _getCoreRowModel?: () => RowModel<TData>\n _getDefaultColumnDef: () => Partial<ColumnDef<TData, unknown>>\n _getRowId: (_: TData, index: number, parent?: Row<TData>) => string\n _queue: (cb: () => void) => void\n /**\n * Returns all columns in the table in their normalized and nested hierarchy.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllColumns: () => Column<TData, unknown>[]\n /**\n * Returns all columns in the table flattened to a single level.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallflatcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllFlatColumns: () => Column<TData, unknown>[]\n /**\n * Returns all leaf-node columns in the table flattened to a single level. This does not include parent columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getallleafcolumns)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getAllLeafColumns: () => Column<TData, unknown>[]\n /**\n * Returns a single column by its ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcolumn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getColumn: (columnId: string) => Column<TData, unknown> | undefined\n /**\n * Returns the core row model before any processing has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getcorerowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getCoreRowModel: () => RowModel<TData>\n /**\n * Returns the row with the given ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrow)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRow: (id: string, searchAll?: boolean) => Row<TData>\n /**\n * Returns the final model after all processing from other used features has been applied. This is the row model that is most commonly used for rendering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getRowModel: () => RowModel<TData>\n /**\n * Call this function to get the table's current state. It's recommended to use this function and its state, especially when managing the table state manually. It is the exact same state used internally by the table for every feature and function it provides.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#getstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n getState: () => TableState\n /**\n * This is the resolved initial state of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n initialState: TableState\n /**\n * A read-only reference to the table's current options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#options)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n options: RequiredKeys<TableOptionsResolved<TData>, 'state'>\n /**\n * Call this function to reset the table state to the initial state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#reset)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n reset: () => void\n /**\n * This function can be used to update the table options.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setoptions)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setOptions: (newOptions: Updater<TableOptionsResolved<TData>>) => void\n /**\n * Call this function to update the table state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/core/table#setstate)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/tables)\n */\n setState: (updater: Updater<TableState>) => void\n}\n\nexport function createTable<TData extends RowData>(\n options: TableOptionsResolved<TData>\n): Table<TData> {\n if (\n process.env.NODE_ENV !== 'production' &&\n (options.debugAll || options.debugTable)\n ) {\n console.info('Creating Table Instance...')\n }\n\n const _features = [...builtInFeatures, ...(options._features ?? [])]\n\n let table = { _features } as unknown as Table<TData>\n\n const defaultOptions = table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultOptions?.(table))\n }, {}) as TableOptionsResolved<TData>\n\n const mergeOptions = (options: TableOptionsResolved<TData>) => {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(defaultOptions, options)\n }\n\n return {\n ...defaultOptions,\n ...options,\n }\n }\n\n const coreInitialState: CoreTableState = {}\n\n let initialState = {\n ...coreInitialState,\n ...(options.initialState ?? {}),\n } as TableState\n\n table._features.forEach(feature => {\n initialState = (feature.getInitialState?.(initialState) ??\n initialState) as TableState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance<TData> = {\n _features,\n options: {\n ...defaultOptions,\n ...options,\n },\n initialState,\n _queue: cb => {\n queued.push(cb)\n\n if (!queuedTimeout) {\n queuedTimeout = true\n\n // Schedule a microtask to run the queued callbacks after\n // the current call stack (render, etc) has finished.\n Promise.resolve()\n .then(() => {\n while (queued.length) {\n queued.shift()!()\n }\n queuedTimeout = false\n })\n .catch(error =>\n setTimeout(() => {\n throw error\n })\n )\n }\n },\n reset: () => {\n table.setState(table.initialState)\n },\n setOptions: updater => {\n const newOptions = functionalUpdate(updater, table.options)\n table.options = mergeOptions(newOptions) as RequiredKeys<\n TableOptionsResolved<TData>,\n 'state'\n >\n },\n\n getState: () => {\n return table.options.state as TableState\n },\n\n setState: (updater: Updater<TableState>) => {\n table.options.onStateChange?.(updater)\n },\n\n _getRowId: (row: TData, index: number, parent?: Row<TData>) =>\n table.options.getRowId?.(row, index, parent) ??\n `${parent ? [parent.id, index].join('.') : index}`,\n\n getCoreRowModel: () => {\n if (!table._getCoreRowModel) {\n table._getCoreRowModel = table.options.getCoreRowModel(table)\n }\n\n return table._getCoreRowModel!()\n },\n\n // The final calls start at the bottom of the model,\n // expanded rows, which then work their way up\n\n getRowModel: () => {\n return table.getPaginationRowModel()\n },\n //in next version, we should just pass in the row model as the optional 2nd arg\n getRow: (id: string, searchAll?: boolean) => {\n let row = (\n searchAll ? table.getPrePaginationRowModel() : table.getRowModel()\n ).rowsById[id]\n\n if (!row) {\n row = table.getCoreRowModel().rowsById[id]\n if (!row) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`getRow could not find row with ID: ${id}`)\n }\n throw new Error()\n }\n }\n\n return row\n },\n _getDefaultColumnDef: memo(\n () => [table.options.defaultColumn],\n defaultColumn => {\n defaultColumn = (defaultColumn ?? {}) as Partial<\n ColumnDef<TData, unknown>\n >\n\n return {\n header: props => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n // footer: props => props.header.column.id,\n cell: props => props.renderValue<any>()?.toString?.() ?? null,\n ...table._features.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...defaultColumn,\n } as Partial<ColumnDef<TData, unknown>>\n },\n getMemoOptions(options, 'debugColumns', '_getDefaultColumnDef')\n ),\n\n _getColumnDefs: () => table.options.columns,\n\n getAllColumns: memo(\n () => [table._getColumnDefs()],\n columnDefs => {\n const recurseColumns = (\n columnDefs: ColumnDef<TData, unknown>[],\n parent?: Column<TData, unknown>,\n depth = 0\n ): Column<TData, unknown>[] => {\n return columnDefs.map(columnDef => {\n const column = createColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(columnDefs)\n },\n getMemoOptions(options, 'debugColumns', 'getAllColumns')\n ),\n\n getAllFlatColumns: memo(\n () => [table.getAllColumns()],\n allColumns => {\n return allColumns.flatMap(column => {\n return column.getFlatColumns()\n })\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumns')\n ),\n\n _getAllFlatColumnsById: memo(\n () => [table.getAllFlatColumns()],\n flatColumns => {\n return flatColumns.reduce(\n (acc, column) => {\n acc[column.id] = column\n return acc\n },\n {} as Record<string, Column<TData, unknown>>\n )\n },\n getMemoOptions(options, 'debugColumns', 'getAllFlatColumnsById')\n ),\n\n getAllLeafColumns: memo(\n () => [table.getAllColumns(), table._getOrderColumnsFn()],\n (allColumns, orderColumns) => {\n let leafColumns = allColumns.flatMap(column => column.getLeafColumns())\n return orderColumns(leafColumns)\n },\n getMemoOptions(options, 'debugColumns', 'getAllLeafColumns')\n ),\n\n getColumn: columnId => {\n const column = table._getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV !== 'production' && !column) {\n console.error(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n },\n }\n\n Object.assign(table, coreInstance)\n\n for (let index = 0; index < table._features.length; index++) {\n const feature = table._features[index]\n feature?.createTable?.(table)\n }\n\n return table\n}\n"],"names":["builtInFeatures","Headers","ColumnVisibility","ColumnOrdering","ColumnPinning","ColumnFaceting","ColumnFiltering","GlobalFaceting","GlobalFiltering","RowSorting","ColumnGrouping","RowExpanding","RowPagination","RowPinning","RowSelection","ColumnSizing","createTable","options","_options$_features","_options$initialState","process","env","NODE_ENV","debugAll","debugTable","console","info","_features","table","defaultOptions","reduce","obj","feature","Object","assign","getDefaultOptions","mergeOptions","coreInitialState","initialState","forEach","_feature$getInitialSt","getInitialState","queued","queuedTimeout","coreInstance","_queue","cb","push","Promise","resolve","then","length","shift","catch","error","setTimeout","reset","setState","setOptions","updater","newOptions","functionalUpdate","getState","state","onStateChange","_getRowId","row","index","parent","_table$options$getRow","getRowId","id","join","getCoreRowModel","_getCoreRowModel","getRowModel","getPaginationRowModel","getRow","searchAll","getPrePaginationRowModel","rowsById","Error","_getDefaultColumnDef","memo","defaultColumn","_defaultColumn","header","props","resolvedColumnDef","column","columnDef","accessorKey","accessorFn","cell","_props$renderValue$to","_props$renderValue","renderValue","toString","getDefaultColumnDef","getMemoOptions","_getColumnDefs","columns","getAllColumns","columnDefs","recurseColumns","depth","map","createColumn","groupingColumnDef","getAllFlatColumns","allColumns","flatMap","getFlatColumns","_getAllFlatColumnsById","flatColumns","acc","getAllLeafColumns","_getOrderColumnsFn","orderColumns","leafColumns","getLeafColumns","getColumn","columnId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAMA,eAAe,GAAG,CACtBC,eAAO,EACPC,iCAAgB,EAChBC,6BAAc,EACdC,2BAAa,EACbC,6BAAc,EACdC,+BAAe,EACfC,6BAAc;AAAE;AAChBC,+BAAe;AAAE;AACjBC,qBAAU,EACVC,6BAAc;AAAE;AAChBC,yBAAY,EACZC,2BAAa,EACbC,qBAAU,EACVC,yBAAY,EACZC,yBAAY,CACJ,CAAA;;AAEV;;AAgOO,SAASC,WAAWA,CACzBC,OAAoC,EACtB;EAAA,IAAAC,kBAAA,EAAAC,qBAAA,CAAA;AACd,EAAA,IACEC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,KACpCL,OAAO,CAACM,QAAQ,IAAIN,OAAO,CAACO,UAAU,CAAC,EACxC;AACAC,IAAAA,OAAO,CAACC,IAAI,CAAC,4BAA4B,CAAC,CAAA;AAC5C,GAAA;AAEA,EAAA,MAAMC,SAAS,GAAG,CAAC,GAAG3B,eAAe,EAAE,IAAAkB,CAAAA,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AAE;AACpDhE,QAAAA,OAAO,CAAC6B,KAAK,CAAE,CAA0BoE,wBAAAA,EAAAA,QAAS,mBAAkB,CAAC,CAAA;AACvE,OAAA;AAEA,MAAA,OAAOjC,MAAM,CAAA;AACf,KAAA;GACD,CAAA;AAEDxD,EAAAA,MAAM,CAACC,MAAM,CAACN,KAAK,EAAEgB,YAAY,CAAC,CAAA;AAElC,EAAA,KAAK,IAAIuB,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGvC,KAAK,CAACD,SAAS,CAACwB,MAAM,EAAEgB,KAAK,EAAE,EAAE;AAC3D,IAAA,MAAMnC,OAAO,GAAGJ,KAAK,CAACD,SAAS,CAACwC,KAAK,CAAC,CAAA;IACtCnC,OAAO,IAAA,IAAA,IAAPA,OAAO,CAAEhB,WAAW,IAAA,IAAA,IAApBgB,OAAO,CAAEhB,WAAW,CAAGY,KAAK,CAAC,CAAA;AAC/B,GAAA;AAEA,EAAA,OAAOA,KAAK,CAAA;AACd;;;;"}
|
|
@@ -7,22 +7,22 @@ export interface FacetedColumn<TData extends RowData> {
|
|
|
7
7
|
/**
|
|
8
8
|
* A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.
|
|
9
9
|
* > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.
|
|
10
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
11
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
10
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues)
|
|
11
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)
|
|
12
12
|
*/
|
|
13
13
|
getFacetedMinMaxValues: () => undefined | [number, number];
|
|
14
14
|
/**
|
|
15
15
|
* Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.
|
|
16
16
|
* > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.
|
|
17
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
18
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
17
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel)
|
|
18
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)
|
|
19
19
|
*/
|
|
20
20
|
getFacetedRowModel: () => RowModel<TData>;
|
|
21
21
|
/**
|
|
22
22
|
* A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.
|
|
23
23
|
* > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.
|
|
24
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
25
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
24
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues)
|
|
25
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)
|
|
26
26
|
*/
|
|
27
27
|
getFacetedUniqueValues: () => Map<any, number>;
|
|
28
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnFaceting.js","sources":["../../../src/features/ColumnFaceting.ts"],"sourcesContent":["import { RowModel } from '..'\nimport { Column, RowData, Table, TableFeature } from '../types'\n\nexport interface FacetedColumn<TData extends RowData> {\n _getFacetedMinMaxValues?: () => undefined | [number, number]\n _getFacetedRowModel?: () => RowModel<TData>\n _getFacetedUniqueValues?: () => Map<any, number>\n /**\n * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
1
|
+
{"version":3,"file":"ColumnFaceting.js","sources":["../../../src/features/ColumnFaceting.ts"],"sourcesContent":["import { RowModel } from '..'\nimport { Column, RowData, Table, TableFeature } from '../types'\n\nexport interface FacetedColumn<TData extends RowData> {\n _getFacetedMinMaxValues?: () => undefined | [number, number]\n _getFacetedRowModel?: () => RowModel<TData>\n _getFacetedUniqueValues?: () => Map<any, number>\n /**\n * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedminmaxvalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedMinMaxValues: () => undefined | [number, number]\n /**\n * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.\n * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedRowModel: () => RowModel<TData>\n /**\n * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.\n * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-faceting#getfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-faceting)\n */\n getFacetedUniqueValues: () => Map<any, number>\n}\n\nexport interface FacetedOptions<TData extends RowData> {\n getFacetedMinMaxValues?: (\n table: Table<TData>,\n columnId: string\n ) => () => undefined | [number, number]\n getFacetedRowModel?: (\n table: Table<TData>,\n columnId: string\n ) => () => RowModel<TData>\n getFacetedUniqueValues?: (\n table: Table<TData>,\n columnId: string\n ) => () => Map<any, number>\n}\n\n//\n\nexport const ColumnFaceting: TableFeature = {\n createColumn: <TData extends RowData>(\n column: Column<TData, unknown>,\n table: Table<TData>\n ): void => {\n column._getFacetedRowModel =\n table.options.getFacetedRowModel &&\n table.options.getFacetedRowModel(table, column.id)\n column.getFacetedRowModel = () => {\n if (!column._getFacetedRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return column._getFacetedRowModel()\n }\n column._getFacetedUniqueValues =\n table.options.getFacetedUniqueValues &&\n table.options.getFacetedUniqueValues(table, column.id)\n column.getFacetedUniqueValues = () => {\n if (!column._getFacetedUniqueValues) {\n return new Map()\n }\n\n return column._getFacetedUniqueValues()\n }\n column._getFacetedMinMaxValues =\n table.options.getFacetedMinMaxValues &&\n table.options.getFacetedMinMaxValues(table, column.id)\n column.getFacetedMinMaxValues = () => {\n if (!column._getFacetedMinMaxValues) {\n return undefined\n }\n\n return column._getFacetedMinMaxValues()\n }\n },\n}\n"],"names":["ColumnFaceting","createColumn","column","table","_getFacetedRowModel","options","getFacetedRowModel","id","getPreFilteredRowModel","_getFacetedUniqueValues","getFacetedUniqueValues","Map","_getFacetedMinMaxValues","getFacetedMinMaxValues","undefined"],"mappings":";;;;;;;;;;;;AA6CA;;AAEO,MAAMA,cAA4B,GAAG;AAC1CC,EAAAA,YAAY,EAAEA,CACZC,MAA8B,EAC9BC,KAAmB,KACV;IACTD,MAAM,CAACE,mBAAmB,GACxBD,KAAK,CAACE,OAAO,CAACC,kBAAkB,IAChCH,KAAK,CAACE,OAAO,CAACC,kBAAkB,CAACH,KAAK,EAAED,MAAM,CAACK,EAAE,CAAC,CAAA;IACpDL,MAAM,CAACI,kBAAkB,GAAG,MAAM;AAChC,MAAA,IAAI,CAACJ,MAAM,CAACE,mBAAmB,EAAE;AAC/B,QAAA,OAAOD,KAAK,CAACK,sBAAsB,EAAE,CAAA;AACvC,OAAA;AAEA,MAAA,OAAON,MAAM,CAACE,mBAAmB,EAAE,CAAA;KACpC,CAAA;IACDF,MAAM,CAACO,uBAAuB,GAC5BN,KAAK,CAACE,OAAO,CAACK,sBAAsB,IACpCP,KAAK,CAACE,OAAO,CAACK,sBAAsB,CAACP,KAAK,EAAED,MAAM,CAACK,EAAE,CAAC,CAAA;IACxDL,MAAM,CAACQ,sBAAsB,GAAG,MAAM;AACpC,MAAA,IAAI,CAACR,MAAM,CAACO,uBAAuB,EAAE;QACnC,OAAO,IAAIE,GAAG,EAAE,CAAA;AAClB,OAAA;AAEA,MAAA,OAAOT,MAAM,CAACO,uBAAuB,EAAE,CAAA;KACxC,CAAA;IACDP,MAAM,CAACU,uBAAuB,GAC5BT,KAAK,CAACE,OAAO,CAACQ,sBAAsB,IACpCV,KAAK,CAACE,OAAO,CAACQ,sBAAsB,CAACV,KAAK,EAAED,MAAM,CAACK,EAAE,CAAC,CAAA;IACxDL,MAAM,CAACW,sBAAsB,GAAG,MAAM;AACpC,MAAA,IAAI,CAACX,MAAM,CAACU,uBAAuB,EAAE;AACnC,QAAA,OAAOE,SAAS,CAAA;AAClB,OAAA;AAEA,MAAA,OAAOZ,MAAM,CAACU,uBAAuB,EAAE,CAAA;KACxC,CAAA;AACH,GAAA;AACF;;;;"}
|
|
@@ -26,120 +26,120 @@ export type FilterFnOption<TData extends RowData> = 'auto' | BuiltInFilterFn | k
|
|
|
26
26
|
export interface ColumnFiltersColumnDef<TData extends RowData> {
|
|
27
27
|
/**
|
|
28
28
|
* Enables/disables the **column** filter for this column.
|
|
29
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
30
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
29
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter)
|
|
30
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
31
31
|
*/
|
|
32
32
|
enableColumnFilter?: boolean;
|
|
33
33
|
/**
|
|
34
34
|
* The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.
|
|
35
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
36
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
35
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn)
|
|
36
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
37
37
|
*/
|
|
38
38
|
filterFn?: FilterFnOption<TData>;
|
|
39
39
|
}
|
|
40
40
|
export interface ColumnFiltersColumn<TData extends RowData> {
|
|
41
41
|
/**
|
|
42
42
|
* Returns an automatically calculated filter function for the column based off of the columns first known value.
|
|
43
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
44
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
43
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn)
|
|
44
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
45
45
|
*/
|
|
46
46
|
getAutoFilterFn: () => FilterFn<TData> | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* Returns whether or not the column can be **column** filtered.
|
|
49
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
50
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
49
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter)
|
|
50
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
51
51
|
*/
|
|
52
52
|
getCanFilter: () => boolean;
|
|
53
53
|
/**
|
|
54
54
|
* Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.
|
|
55
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
56
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
55
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn)
|
|
56
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
57
57
|
*/
|
|
58
58
|
getFilterFn: () => FilterFn<TData> | undefined;
|
|
59
59
|
/**
|
|
60
60
|
* Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.
|
|
61
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
62
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
61
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex)
|
|
62
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
63
63
|
*/
|
|
64
64
|
getFilterIndex: () => number;
|
|
65
65
|
/**
|
|
66
66
|
* Returns the current filter value for the column.
|
|
67
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
68
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
67
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue)
|
|
68
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
69
69
|
*/
|
|
70
70
|
getFilterValue: () => unknown;
|
|
71
71
|
/**
|
|
72
72
|
* Returns whether or not the column is currently filtered.
|
|
73
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
74
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
73
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered)
|
|
74
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
75
75
|
*/
|
|
76
76
|
getIsFiltered: () => boolean;
|
|
77
77
|
/**
|
|
78
78
|
* A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.
|
|
79
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
80
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
79
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue)
|
|
80
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
81
81
|
*/
|
|
82
82
|
setFilterValue: (updater: Updater<any>) => void;
|
|
83
83
|
}
|
|
84
84
|
export interface ColumnFiltersRow<TData extends RowData> {
|
|
85
85
|
/**
|
|
86
86
|
* The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.
|
|
87
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
88
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
87
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters)
|
|
88
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
89
89
|
*/
|
|
90
90
|
columnFilters: Record<string, boolean>;
|
|
91
91
|
/**
|
|
92
92
|
* The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.
|
|
93
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
94
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
93
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta)
|
|
94
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
95
95
|
*/
|
|
96
96
|
columnFiltersMeta: Record<string, FilterMeta>;
|
|
97
97
|
}
|
|
98
98
|
interface ColumnFiltersOptionsBase<TData extends RowData> {
|
|
99
99
|
/**
|
|
100
100
|
* Enables/disables **column** filtering for all columns.
|
|
101
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
102
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
101
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters)
|
|
102
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
103
103
|
*/
|
|
104
104
|
enableColumnFilters?: boolean;
|
|
105
105
|
/**
|
|
106
106
|
* Enables/disables all filtering for the table.
|
|
107
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
108
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
107
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters)
|
|
108
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
109
109
|
*/
|
|
110
110
|
enableFilters?: boolean;
|
|
111
111
|
/**
|
|
112
112
|
* By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).
|
|
113
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
114
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
113
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows)
|
|
114
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
115
115
|
*/
|
|
116
116
|
filterFromLeafRows?: boolean;
|
|
117
117
|
/**
|
|
118
118
|
* If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.
|
|
119
119
|
* - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.
|
|
120
120
|
* - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.
|
|
121
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
122
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
121
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)
|
|
122
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
123
123
|
*/
|
|
124
124
|
getFilteredRowModel?: (table: Table<any>) => () => RowModel<any>;
|
|
125
125
|
/**
|
|
126
126
|
* Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.
|
|
127
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
128
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
127
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering)
|
|
128
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
129
129
|
*/
|
|
130
130
|
manualFiltering?: boolean;
|
|
131
131
|
/**
|
|
132
132
|
* By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.
|
|
133
133
|
|
|
134
134
|
* This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.
|
|
135
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
136
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
135
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth)
|
|
136
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
137
137
|
*/
|
|
138
138
|
maxLeafRowFilterDepth?: number;
|
|
139
139
|
/**
|
|
140
140
|
* If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.
|
|
141
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
142
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
141
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange)
|
|
142
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
143
143
|
*/
|
|
144
144
|
onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>;
|
|
145
145
|
}
|
|
@@ -154,38 +154,38 @@ export interface ColumnFiltersInstance<TData extends RowData> {
|
|
|
154
154
|
_getFilteredRowModel?: () => RowModel<TData>;
|
|
155
155
|
/**
|
|
156
156
|
* Returns the row model for the table after **column** filtering has been applied.
|
|
157
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
158
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
157
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)
|
|
158
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
159
159
|
*/
|
|
160
160
|
getFilteredRowModel: () => RowModel<TData>;
|
|
161
161
|
/**
|
|
162
162
|
* Returns the row model for the table before any **column** filtering has been applied.
|
|
163
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
164
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
163
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel)
|
|
164
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
165
165
|
*/
|
|
166
166
|
getPreFilteredRowModel: () => RowModel<TData>;
|
|
167
167
|
/**
|
|
168
168
|
* Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.
|
|
169
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
170
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
169
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters)
|
|
170
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
171
171
|
*/
|
|
172
172
|
resetColumnFilters: (defaultState?: boolean) => void;
|
|
173
173
|
/**
|
|
174
174
|
* Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.
|
|
175
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
176
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
175
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter)
|
|
176
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
177
177
|
*/
|
|
178
178
|
resetGlobalFilter: (defaultState?: boolean) => void;
|
|
179
179
|
/**
|
|
180
180
|
* Sets or updates the `state.columnFilters` state.
|
|
181
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
182
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
181
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters)
|
|
182
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
183
183
|
*/
|
|
184
184
|
setColumnFilters: (updater: Updater<ColumnFiltersState>) => void;
|
|
185
185
|
/**
|
|
186
186
|
* Sets or updates the `state.globalFilter` state.
|
|
187
|
-
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/
|
|
188
|
-
* @link [Guide](https://tanstack.com/table/v8/docs/guide/
|
|
187
|
+
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter)
|
|
188
|
+
* @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)
|
|
189
189
|
*/
|
|
190
190
|
setGlobalFilter: (updater: Updater<any>) => void;
|
|
191
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnFiltering.js","sources":["../../../src/features/ColumnFiltering.ts"],"sourcesContent":["import { RowModel } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n FilterFns,\n FilterMeta,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { functionalUpdate, isFunction, makeStateUpdater } from '../utils'\n\nexport interface ColumnFiltersTableState {\n columnFilters: ColumnFiltersState\n}\n\nexport type ColumnFiltersState = ColumnFilter[]\n\nexport interface ColumnFilter {\n id: string\n value: unknown\n}\n\nexport interface ResolvedColumnFilter<TData extends RowData> {\n filterFn: FilterFn<TData>\n id: string\n resolvedValue: unknown\n}\n\nexport interface FilterFn<TData extends RowData> {\n (\n row: Row<TData>,\n columnId: string,\n filterValue: any,\n addMeta: (meta: FilterMeta) => void\n ): boolean\n autoRemove?: ColumnFilterAutoRemoveTestFn<TData>\n resolveFilterValue?: TransformFilterValueFn<TData>\n}\n\nexport type TransformFilterValueFn<TData extends RowData> = (\n value: any,\n column?: Column<TData, unknown>\n) => unknown\n\nexport type ColumnFilterAutoRemoveTestFn<TData extends RowData> = (\n value: any,\n column?: Column<TData, unknown>\n) => boolean\n\nexport type CustomFilterFns<TData extends RowData> = Record<\n string,\n FilterFn<TData>\n>\n\nexport type FilterFnOption<TData extends RowData> =\n | 'auto'\n | BuiltInFilterFn\n | keyof FilterFns\n | FilterFn<TData>\n\nexport interface ColumnFiltersColumnDef<TData extends RowData> {\n /**\n * Enables/disables the **column** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablecolumnfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n enableColumnFilter?: boolean\n /**\n * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#filterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n filterFn?: FilterFnOption<TData>\n}\n\nexport interface ColumnFiltersColumn<TData extends RowData> {\n /**\n * Returns an automatically calculated filter function for the column based off of the columns first known value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getAutoFilterFn: () => FilterFn<TData> | undefined\n /**\n * Returns whether or not the column can be **column** filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getcanfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getCanFilter: () => boolean\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getFilterFn: () => FilterFn<TData> | undefined\n /**\n * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilterindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getFilterIndex: () => number\n /**\n * Returns the current filter value for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getFilterValue: () => unknown\n /**\n * Returns whether or not the column is currently filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getisfiltered)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getIsFiltered: () => boolean\n /**\n * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n setFilterValue: (updater: Updater<any>) => void\n}\n\nexport interface ColumnFiltersRow<TData extends RowData> {\n /**\n * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#columnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n columnFilters: Record<string, boolean>\n /**\n * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#columnfiltersmeta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n columnFiltersMeta: Record<string, FilterMeta>\n}\n\ninterface ColumnFiltersOptionsBase<TData extends RowData> {\n /**\n * Enables/disables **column** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablecolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n enableColumnFilters?: boolean\n /**\n * Enables/disables all filtering for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablefilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n enableFilters?: boolean\n /**\n * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#filterfromleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n filterFromLeafRows?: boolean\n /**\n * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.\n * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.\n * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getFilteredRowModel?: (table: Table<any>) => () => RowModel<any>\n /**\n * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#manualfiltering)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n manualFiltering?: boolean\n /**\n * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.\n\n * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#maxleafrowfilterdepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n maxLeafRowFilterDepth?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#oncolumnfilterschange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>\n}\n\ntype ResolvedFilterFns = keyof FilterFns extends never\n ? {\n filterFns?: Record<string, FilterFn<any>>\n }\n : {\n filterFns: Record<keyof FilterFns, FilterFn<any>>\n }\n\nexport interface ColumnFiltersOptions<TData extends RowData>\n extends ColumnFiltersOptionsBase<TData>,\n ResolvedFilterFns {}\n\nexport interface ColumnFiltersInstance<TData extends RowData> {\n _getFilteredRowModel?: () => RowModel<TData>\n /**\n * Returns the row model for the table after **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getFilteredRowModel: () => RowModel<TData>\n /**\n * Returns the row model for the table before any **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getprefilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n getPreFilteredRowModel: () => RowModel<TData>\n /**\n * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#resetcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n resetColumnFilters: (defaultState?: boolean) => void\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnFilters` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n setColumnFilters: (updater: Updater<ColumnFiltersState>) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\n */\n setGlobalFilter: (updater: Updater<any>) => void\n}\n\n//\n\nexport const ColumnFiltering: TableFeature = {\n getDefaultColumnDef: <\n TData extends RowData,\n >(): ColumnFiltersColumnDef<TData> => {\n return {\n filterFn: 'auto',\n }\n },\n\n getInitialState: (state): ColumnFiltersTableState => {\n return {\n columnFilters: [],\n ...state,\n }\n },\n\n getDefaultOptions: <TData extends RowData>(\n table: Table<TData>\n ): ColumnFiltersOptions<TData> => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100,\n } as ColumnFiltersOptions<TData>\n },\n\n createColumn: <TData extends RowData>(\n column: Column<TData, unknown>,\n table: Table<TData>\n ): void => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\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 column.getFilterFn = () => {\n return isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column.getAutoFilterFn()\n : // @ts-ignore\n table.options.filterFns?.[column.columnDef.filterFn as string] ??\n filterFns[column.columnDef.filterFn as BuiltInFilterFn]\n }\n column.getCanFilter = () => {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (table.options.enableColumnFilters ?? true) &&\n (table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getIsFiltered = () => column.getFilterIndex() > -1\n\n column.getFilterValue = () =>\n table.getState().columnFilters?.find(d => d.id === column.id)?.value\n\n column.getFilterIndex = () =>\n table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1\n\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn()\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 //\n if (\n shouldAutoRemoveFilter(filterFn as FilterFn<TData>, newFilter, column)\n ) {\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 (\n old?.map(d => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n }) ?? []\n )\n }\n\n if (old?.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n }\n },\n\n createRow: <TData extends RowData>(\n row: Row<TData>,\n _table: Table<TData>\n ): void => {\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n },\n\n createTable: <TData extends RowData>(table: Table<TData>): void => {\n table.setColumnFilters = (updater: Updater<ColumnFiltersState>) => {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old)?.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id)\n\n if (column) {\n const filterFn = column.getFilterFn()\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 table.resetColumnFilters = defaultState => {\n table.setColumnFilters(\n defaultState ? [] : table.initialState?.columnFilters ?? []\n )\n }\n\n table.getPreFilteredRowModel = () => table.getCoreRowModel()\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table)\n }\n\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getFilteredRowModel()\n }\n },\n}\n\nexport function shouldAutoRemoveFilter<TData extends RowData>(\n filterFn?: FilterFn<TData>,\n value?: any,\n column?: Column<TData, unknown>\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"],"names":["ColumnFiltering","getDefaultColumnDef","filterFn","getInitialState","state","columnFilters","getDefaultOptions","table","onColumnFiltersChange","makeStateUpdater","filterFromLeafRows","maxLeafRowFilterDepth","createColumn","column","getAutoFilterFn","firstRow","getCoreRowModel","flatRows","value","getValue","id","filterFns","includesString","inNumberRange","equals","Array","isArray","arrIncludes","weakEquals","getFilterFn","_table$options$filter","_table$options$filter2","isFunction","columnDef","options","getCanFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","enableColumnFilter","enableColumnFilters","enableFilters","accessorFn","getIsFiltered","getFilterIndex","getFilterValue","_table$getState$colum","getState","find","d","_table$getState$colum2","_table$getState$colum3","findIndex","setFilterValue","setColumnFilters","old","previousFilter","newFilter","functionalUpdate","undefined","shouldAutoRemoveFilter","_old$filter","filter","newFilterObj","_old$map","map","length","createRow","row","_table","columnFiltersMeta","createTable","updater","leafColumns","getAllLeafColumns","updateFn","_functionalUpdate","resetColumnFilters","defaultState","_table$initialState$c","_table$initialState","initialState","getPreFilteredRowModel","getFilteredRowModel","_getFilteredRowModel","manualFiltering","autoRemove"],"mappings":";;;;;;;;;;;;;;;AAgPA;;AAEO,MAAMA,eAA6B,GAAG;EAC3CC,mBAAmB,EAAEA,MAEiB;IACpC,OAAO;AACLC,MAAAA,QAAQ,EAAE,MAAA;KACX,CAAA;GACF;EAEDC,eAAe,EAAGC,KAAK,IAA8B;IACnD,OAAO;AACLC,MAAAA,aAAa,EAAE,EAAE;MACjB,GAAGD,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACa;IAChC,OAAO;AACLC,MAAAA,qBAAqB,EAAEC,sBAAgB,CAAC,eAAe,EAAEF,KAAK,CAAC;AAC/DG,MAAAA,kBAAkB,EAAE,KAAK;AACzBC,MAAAA,qBAAqB,EAAE,GAAA;KACxB,CAAA;GACF;AAEDC,EAAAA,YAAY,EAAEA,CACZC,MAA8B,EAC9BN,KAAmB,KACV;IACTM,MAAM,CAACC,eAAe,GAAG,MAAM;MAC7B,MAAMC,QAAQ,GAAGR,KAAK,CAACS,eAAe,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAAA;MAEpD,MAAMC,KAAK,GAAGH,QAAQ,IAARA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,QAAQ,CAAEI,QAAQ,CAACN,MAAM,CAACO,EAAE,CAAC,CAAA;AAE3C,MAAA,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAOG,mBAAS,CAACC,cAAc,CAAA;AACjC,OAAA;AAEA,MAAA,IAAI,OAAOJ,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAOG,mBAAS,CAACE,aAAa,CAAA;AAChC,OAAA;AAEA,MAAA,IAAI,OAAOL,KAAK,KAAK,SAAS,EAAE;QAC9B,OAAOG,mBAAS,CAACG,MAAM,CAAA;AACzB,OAAA;MAEA,IAAIN,K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Filtering.ts"],"sourcesContent":["import { RowModel } from '..'\nimport { BuiltInFilterFn, filterFns } from '../filterFns'\nimport {\n Column,\n FilterFns,\n FilterMeta,\n OnChangeFn,\n Row,\n RowData,\n Table,\n TableFeature,\n Updater,\n} from '../types'\nimport { functionalUpdate, isFunction, makeStateUpdater } from '../utils'\n\nexport interface ColumnFiltersTableState {\n columnFilters: ColumnFiltersState\n}\n\nexport type ColumnFiltersState = ColumnFilter[]\n\nexport interface ColumnFilter {\n id: string\n value: unknown\n}\n\nexport interface ResolvedColumnFilter<TData extends RowData> {\n filterFn: FilterFn<TData>\n id: string\n resolvedValue: unknown\n}\n\nexport interface FilterFn<TData extends RowData> {\n (\n row: Row<TData>,\n columnId: string,\n filterValue: any,\n addMeta: (meta: FilterMeta) => void\n ): boolean\n autoRemove?: ColumnFilterAutoRemoveTestFn<TData>\n resolveFilterValue?: TransformFilterValueFn<TData>\n}\n\nexport type TransformFilterValueFn<TData extends RowData> = (\n value: any,\n column?: Column<TData, unknown>\n) => unknown\n\nexport type ColumnFilterAutoRemoveTestFn<TData extends RowData> = (\n value: any,\n column?: Column<TData, unknown>\n) => boolean\n\nexport type CustomFilterFns<TData extends RowData> = Record<\n string,\n FilterFn<TData>\n>\n\nexport type FilterFnOption<TData extends RowData> =\n | 'auto'\n | BuiltInFilterFn\n | keyof FilterFns\n | FilterFn<TData>\n\nexport interface ColumnFiltersColumnDef<TData extends RowData> {\n /**\n * Enables/disables the **column** filter for this column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilter?: boolean\n /**\n * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFn?: FilterFnOption<TData>\n}\n\nexport interface ColumnFiltersColumn<TData extends RowData> {\n /**\n * Returns an automatically calculated filter function for the column based off of the columns first known value.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getautofilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getAutoFilterFn: () => FilterFn<TData> | undefined\n /**\n * Returns whether or not the column can be **column** filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getcanfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getCanFilter: () => boolean\n /**\n * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterfn)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterFn: () => FilterFn<TData> | undefined\n /**\n * Returns the index (including `-1`) of the column filter in the table's `state.columnFilters` array.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilterindex)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterIndex: () => number\n /**\n * Returns the current filter value for the column.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilterValue: () => unknown\n /**\n * Returns whether or not the column is currently filtered.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getisfiltered)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getIsFiltered: () => boolean\n /**\n * A function that sets the current filter value for the column. You can pass it a value or an updater function for immutability-safe operations on existing values.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setfiltervalue)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setFilterValue: (updater: Updater<any>) => void\n}\n\nexport interface ColumnFiltersRow<TData extends RowData> {\n /**\n * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFilters: Record<string, boolean>\n /**\n * The column filters meta map for the row. This object tracks any filter meta for a row as optionally provided during the filtering process.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#columnfiltersmeta)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n columnFiltersMeta: Record<string, FilterMeta>\n}\n\ninterface ColumnFiltersOptionsBase<TData extends RowData> {\n /**\n * Enables/disables **column** filtering for all columns.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablecolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableColumnFilters?: boolean\n /**\n * Enables/disables all filtering for the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#enablefilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n enableFilters?: boolean\n /**\n * By default, filtering is done from parent rows down (so if a parent row is filtered out, all of its children will be filtered out as well). Setting this option to `true` will cause filtering to be done from leaf rows up (which means parent rows will be included so long as one of their child or grand-child rows is also included).\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#filterfromleafrows)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n filterFromLeafRows?: boolean\n /**\n * If provided, this function is called **once** per table and should return a **new function** which will calculate and return the row model for the table when it's filtered.\n * - For server-side filtering, this function is unnecessary and can be ignored since the server should already return the filtered row model.\n * - For client-side filtering, this function is required. A default implementation is provided via any table adapter's `{ getFilteredRowModel }` export.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel?: (table: Table<any>) => () => RowModel<any>\n /**\n * Disables the `getFilteredRowModel` from being used to filter data. This may be useful if your table needs to dynamically support both client-side and server-side filtering.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#manualfiltering)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n manualFiltering?: boolean\n /**\n * By default, filtering is done for all rows (max depth of 100), no matter if they are root level parent rows or the child leaf rows of a parent row. Setting this option to `0` will cause filtering to only be applied to the root level parent rows, with all sub-rows remaining unfiltered. Similarly, setting this option to `1` will cause filtering to only be applied to child leaf rows 1 level deep, and so on.\n\n * This is useful for situations where you want a row's entire child hierarchy to be visible regardless of the applied filter.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#maxleafrowfilterdepth)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n maxLeafRowFilterDepth?: number\n /**\n * If provided, this function will be called with an `updaterFn` when `state.columnFilters` changes. This overrides the default internal state management, so you will need to persist the state change either fully or partially outside of the table.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#oncolumnfilterschange)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>\n}\n\ntype ResolvedFilterFns = keyof FilterFns extends never\n ? {\n filterFns?: Record<string, FilterFn<any>>\n }\n : {\n filterFns: Record<keyof FilterFns, FilterFn<any>>\n }\n\nexport interface ColumnFiltersOptions<TData extends RowData>\n extends ColumnFiltersOptionsBase<TData>,\n ResolvedFilterFns {}\n\nexport interface ColumnFiltersInstance<TData extends RowData> {\n _getFilteredRowModel?: () => RowModel<TData>\n /**\n * Returns the row model for the table after **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getfilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getFilteredRowModel: () => RowModel<TData>\n /**\n * Returns the row model for the table before any **column** filtering has been applied.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#getprefilteredrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n getPreFilteredRowModel: () => RowModel<TData>\n /**\n * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetColumnFilters: (defaultState?: boolean) => void\n /**\n * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#resetglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n resetGlobalFilter: (defaultState?: boolean) => void\n /**\n * Sets or updates the `state.columnFilters` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setcolumnfilters)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setColumnFilters: (updater: Updater<ColumnFiltersState>) => void\n /**\n * Sets or updates the `state.globalFilter` state.\n * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/column-filtering#setglobalfilter)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/column-filtering)\n */\n setGlobalFilter: (updater: Updater<any>) => void\n}\n\n//\n\nexport const ColumnFiltering: TableFeature = {\n getDefaultColumnDef: <\n TData extends RowData,\n >(): ColumnFiltersColumnDef<TData> => {\n return {\n filterFn: 'auto',\n }\n },\n\n getInitialState: (state): ColumnFiltersTableState => {\n return {\n columnFilters: [],\n ...state,\n }\n },\n\n getDefaultOptions: <TData extends RowData>(\n table: Table<TData>\n ): ColumnFiltersOptions<TData> => {\n return {\n onColumnFiltersChange: makeStateUpdater('columnFilters', table),\n filterFromLeafRows: false,\n maxLeafRowFilterDepth: 100,\n } as ColumnFiltersOptions<TData>\n },\n\n createColumn: <TData extends RowData>(\n column: Column<TData, unknown>,\n table: Table<TData>\n ): void => {\n column.getAutoFilterFn = () => {\n const firstRow = table.getCoreRowModel().flatRows[0]\n\n const value = firstRow?.getValue(column.id)\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 column.getFilterFn = () => {\n return isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column.getAutoFilterFn()\n : // @ts-ignore\n table.options.filterFns?.[column.columnDef.filterFn as string] ??\n filterFns[column.columnDef.filterFn as BuiltInFilterFn]\n }\n column.getCanFilter = () => {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (table.options.enableColumnFilters ?? true) &&\n (table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n }\n\n column.getIsFiltered = () => column.getFilterIndex() > -1\n\n column.getFilterValue = () =>\n table.getState().columnFilters?.find(d => d.id === column.id)?.value\n\n column.getFilterIndex = () =>\n table.getState().columnFilters?.findIndex(d => d.id === column.id) ?? -1\n\n column.setFilterValue = value => {\n table.setColumnFilters(old => {\n const filterFn = column.getFilterFn()\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 //\n if (\n shouldAutoRemoveFilter(filterFn as FilterFn<TData>, newFilter, column)\n ) {\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 (\n old?.map(d => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n }) ?? []\n )\n }\n\n if (old?.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n }\n },\n\n createRow: <TData extends RowData>(\n row: Row<TData>,\n _table: Table<TData>\n ): void => {\n row.columnFilters = {}\n row.columnFiltersMeta = {}\n },\n\n createTable: <TData extends RowData>(table: Table<TData>): void => {\n table.setColumnFilters = (updater: Updater<ColumnFiltersState>) => {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old)?.filter(filter => {\n const column = leafColumns.find(d => d.id === filter.id)\n\n if (column) {\n const filterFn = column.getFilterFn()\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 table.resetColumnFilters = defaultState => {\n table.setColumnFilters(\n defaultState ? [] : table.initialState?.columnFilters ?? []\n )\n }\n\n table.getPreFilteredRowModel = () => table.getCoreRowModel()\n table.getFilteredRowModel = () => {\n if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {\n table._getFilteredRowModel = table.options.getFilteredRowModel(table)\n }\n\n if (table.options.manualFiltering || !table._getFilteredRowModel) {\n return table.getPreFilteredRowModel()\n }\n\n return table._getFilteredRowModel()\n }\n },\n}\n\nexport function shouldAutoRemoveFilter<TData extends RowData>(\n filterFn?: FilterFn<TData>,\n value?: any,\n column?: Column<TData, unknown>\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"],"names":["ColumnFiltering","getDefaultColumnDef","filterFn","getInitialState","state","columnFilters","getDefaultOptions","table","onColumnFiltersChange","makeStateUpdater","filterFromLeafRows","maxLeafRowFilterDepth","createColumn","column","getAutoFilterFn","firstRow","getCoreRowModel","flatRows","value","getValue","id","filterFns","includesString","inNumberRange","equals","Array","isArray","arrIncludes","weakEquals","getFilterFn","_table$options$filter","_table$options$filter2","isFunction","columnDef","options","getCanFilter","_column$columnDef$ena","_table$options$enable","_table$options$enable2","enableColumnFilter","enableColumnFilters","enableFilters","accessorFn","getIsFiltered","getFilterIndex","getFilterValue","_table$getState$colum","getState","find","d","_table$getState$colum2","_table$getState$colum3","findIndex","setFilterValue","setColumnFilters","old","previousFilter","newFilter","functionalUpdate","undefined","shouldAutoRemoveFilter","_old$filter","filter","newFilterObj","_old$map","map","length","createRow","row","_table","columnFiltersMeta","createTable","updater","leafColumns","getAllLeafColumns","updateFn","_functionalUpdate","resetColumnFilters","defaultState","_table$initialState$c","_table$initialState","initialState","getPreFilteredRowModel","getFilteredRowModel","_getFilteredRowModel","manualFiltering","autoRemove"],"mappings":";;;;;;;;;;;;;;;AAgPA;;AAEO,MAAMA,eAA6B,GAAG;EAC3CC,mBAAmB,EAAEA,MAEiB;IACpC,OAAO;AACLC,MAAAA,QAAQ,EAAE,MAAA;KACX,CAAA;GACF;EAEDC,eAAe,EAAGC,KAAK,IAA8B;IACnD,OAAO;AACLC,MAAAA,aAAa,EAAE,EAAE;MACjB,GAAGD,KAAAA;KACJ,CAAA;GACF;EAEDE,iBAAiB,EACfC,KAAmB,IACa;IAChC,OAAO;AACLC,MAAAA,qBAAqB,EAAEC,sBAAgB,CAAC,eAAe,EAAEF,KAAK,CAAC;AAC/DG,MAAAA,kBAAkB,EAAE,KAAK;AACzBC,MAAAA,qBAAqB,EAAE,GAAA;KACxB,CAAA;GACF;AAEDC,EAAAA,YAAY,EAAEA,CACZC,MAA8B,EAC9BN,KAAmB,KACV;IACTM,MAAM,CAACC,eAAe,GAAG,MAAM;MAC7B,MAAMC,QAAQ,GAAGR,KAAK,CAACS,eAAe,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAC,CAAA;MAEpD,MAAMC,KAAK,GAAGH,QAAQ,IAARA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,QAAQ,CAAEI,QAAQ,CAACN,MAAM,CAACO,EAAE,CAAC,CAAA;AAE3C,MAAA,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAOG,mBAAS,CAACC,cAAc,CAAA;AACjC,OAAA;AAEA,MAAA,IAAI,OAAOJ,KAAK,KAAK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