@tanstack/table-core 8.13.2 → 8.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/build/lib/aggregationFns.d.ts +1 -1
  2. package/build/lib/aggregationFns.js.map +1 -1
  3. package/build/lib/core/column.js +1 -1
  4. package/build/lib/core/column.js.map +1 -1
  5. package/build/lib/core/headers.d.ts +1 -2
  6. package/build/lib/core/headers.js.map +1 -1
  7. package/build/lib/core/row.js.map +1 -1
  8. package/build/lib/core/table.d.ts +7 -11
  9. package/build/lib/core/table.js +21 -13
  10. package/build/lib/core/table.js.map +1 -1
  11. package/build/lib/features/ColumnFaceting.d.ts +34 -0
  12. package/build/lib/features/ColumnFaceting.js +42 -0
  13. package/build/lib/features/ColumnFaceting.js.map +1 -0
  14. package/build/lib/features/{Filters.d.ts → ColumnFiltering.d.ts} +29 -132
  15. package/build/lib/features/{Filters.js → ColumnFiltering.js} +8 -83
  16. package/build/lib/features/ColumnFiltering.js.map +1 -0
  17. package/build/lib/features/{Grouping.d.ts → ColumnGrouping.d.ts} +2 -3
  18. package/build/lib/features/{Grouping.js → ColumnGrouping.js} +3 -3
  19. package/build/lib/features/ColumnGrouping.js.map +1 -0
  20. package/build/lib/features/{Ordering.d.ts → ColumnOrdering.d.ts} +2 -3
  21. package/build/lib/features/{Ordering.js → ColumnOrdering.js} +9 -9
  22. package/build/lib/features/ColumnOrdering.js.map +1 -0
  23. package/build/lib/features/ColumnPinning.d.ts +126 -0
  24. package/build/lib/features/{Pinning.js → ColumnPinning.js} +4 -115
  25. package/build/lib/features/ColumnPinning.js.map +1 -0
  26. package/build/lib/features/ColumnSizing.d.ts +2 -3
  27. package/build/lib/features/ColumnSizing.js +3 -3
  28. package/build/lib/features/ColumnSizing.js.map +1 -1
  29. package/build/lib/features/{Visibility.d.ts → ColumnVisibility.d.ts} +2 -3
  30. package/build/lib/features/{Visibility.js → ColumnVisibility.js} +3 -3
  31. package/build/lib/features/ColumnVisibility.js.map +1 -0
  32. package/build/lib/features/GlobalFiltering.d.ts +100 -0
  33. package/build/lib/features/GlobalFiltering.js +85 -0
  34. package/build/lib/features/GlobalFiltering.js.map +1 -0
  35. package/build/lib/features/{Expanding.d.ts → RowExpanding.d.ts} +2 -3
  36. package/build/lib/features/{Expanding.js → RowExpanding.js} +3 -3
  37. package/build/lib/features/RowExpanding.js.map +1 -0
  38. package/build/lib/features/{Pagination.d.ts → RowPagination.d.ts} +2 -3
  39. package/build/lib/features/{Pagination.js → RowPagination.js} +3 -3
  40. package/build/lib/features/RowPagination.js.map +1 -0
  41. package/build/lib/features/RowPinning.d.ts +98 -0
  42. package/build/lib/features/RowPinning.js +145 -0
  43. package/build/lib/features/RowPinning.js.map +1 -0
  44. package/build/lib/features/RowSelection.d.ts +1 -2
  45. package/build/lib/features/RowSelection.js.map +1 -1
  46. package/build/lib/features/{Sorting.d.ts → RowSorting.d.ts} +5 -3
  47. package/build/lib/features/{Sorting.js → RowSorting.js} +3 -3
  48. package/build/lib/features/RowSorting.js.map +1 -0
  49. package/build/lib/filterFns.d.ts +1 -1
  50. package/build/lib/filterFns.js.map +1 -1
  51. package/build/lib/index.d.ts +21 -18
  52. package/build/lib/index.esm.js +1490 -1446
  53. package/build/lib/index.esm.js.map +1 -1
  54. package/build/lib/index.js +47 -41
  55. package/build/lib/index.js.map +1 -1
  56. package/build/lib/index.mjs +1490 -1446
  57. package/build/lib/index.mjs.map +1 -1
  58. package/build/lib/sortingFns.d.ts +1 -1
  59. package/build/lib/sortingFns.js.map +1 -1
  60. package/build/lib/types.d.ts +30 -16
  61. package/build/lib/utils/getFilteredRowModel.js.map +1 -1
  62. package/build/lib/utils/getSortedRowModel.js.map +1 -1
  63. package/build/umd/index.development.js +1500 -1453
  64. package/build/umd/index.development.js.map +1 -1
  65. package/build/umd/index.production.js +1 -1
  66. package/build/umd/index.production.js.map +1 -1
  67. package/package.json +1 -1
  68. package/src/aggregationFns.ts +1 -1
  69. package/src/core/column.ts +2 -2
  70. package/src/core/headers.ts +9 -3
  71. package/src/core/row.ts +1 -1
  72. package/src/core/table.ts +40 -32
  73. package/src/features/ColumnFaceting.ts +84 -0
  74. package/src/features/{Filters.ts → ColumnFiltering.ts} +44 -279
  75. package/src/features/{Grouping.ts → ColumnGrouping.ts} +6 -6
  76. package/src/features/{Ordering.ts → ColumnOrdering.ts} +11 -5
  77. package/src/features/ColumnPinning.ts +336 -0
  78. package/src/features/ColumnSizing.ts +10 -3
  79. package/src/features/{Visibility.ts → ColumnVisibility.ts} +2 -2
  80. package/src/features/GlobalFiltering.ts +218 -0
  81. package/src/features/{Expanding.ts → RowExpanding.ts} +9 -3
  82. package/src/features/{Pagination.ts → RowPagination.ts} +9 -3
  83. package/src/features/RowPinning.ts +273 -0
  84. package/src/features/RowSelection.ts +9 -2
  85. package/src/features/{Sorting.ts → RowSorting.ts} +5 -2
  86. package/src/filterFns.ts +1 -1
  87. package/src/index.ts +30 -18
  88. package/src/sortingFns.ts +1 -1
  89. package/src/types.ts +60 -23
  90. package/src/utils/getFilteredRowModel.ts +1 -1
  91. package/src/utils/getSortedRowModel.ts +1 -1
  92. package/build/lib/features/Expanding.js.map +0 -1
  93. package/build/lib/features/Filters.js.map +0 -1
  94. package/build/lib/features/Grouping.js.map +0 -1
  95. package/build/lib/features/Ordering.js.map +0 -1
  96. package/build/lib/features/Pagination.js.map +0 -1
  97. package/build/lib/features/Pinning.d.ts +0 -222
  98. package/build/lib/features/Pinning.js.map +0 -1
  99. package/build/lib/features/Sorting.js.map +0 -1
  100. package/build/lib/features/Visibility.js.map +0 -1
  101. package/src/features/Pinning.ts +0 -573
@@ -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} from '../types'\n\n//\nimport { createColumn } from './column'\nimport { Headers } from './headers'\n//\n\nimport { ColumnSizing } from '../features/ColumnSizing'\nimport { Expanding } from '../features/Expanding'\nimport { Filters } from '../features/Filters'\nimport { Grouping } from '../features/Grouping'\nimport { Ordering } from '../features/Ordering'\nimport { Pagination } from '../features/Pagination'\nimport { Pinning } from '../features/Pinning'\nimport { RowSelection } from '../features/RowSelection'\nimport { Sorting } from '../features/Sorting'\nimport { Visibility } from '../features/Visibility'\n\nexport interface TableFeature {\n createCell?: (cell: any, column: any, row: any, table: any) => any\n createColumn?: (column: any, table: any) => any\n createHeader?: (column: any, table: any) => any\n createRow?: (row: any, table: any) => any\n createTable?: (table: any) => any\n getDefaultColumnDef?: () => any\n getDefaultOptions?: (table: any) => any\n getInitialState?: (initialState?: InitialTableState) => any\n}\n\nconst features = [\n Headers,\n Visibility,\n Ordering,\n Pinning,\n Filters,\n Sorting,\n Grouping,\n Expanding,\n Pagination,\n RowSelection,\n ColumnSizing,\n] as const\n\n//\n\nexport interface CoreTableState {}\n\nexport interface CoreOptions<TData extends RowData> {\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 (options.debugAll || options.debugTable) {\n console.info('Creating Table Instance...')\n }\n\n let table = { _features: 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) ?? initialState\n })\n\n const queued: (() => void)[] = []\n let queuedTimeout = false\n\n const coreInstance: CoreInstance<TData> = {\n _features: 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":["features","Headers","Visibility","Ordering","Pinning","Filters","Sorting","Grouping","Expanding","Pagination","RowSelection","ColumnSizing","createTable","options","_options$initialState","debugAll","debugTable","console","info","table","_features","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","process","env","NODE_ENV","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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAMA,QAAQ,GAAG,CACfC,eAAO,EACPC,qBAAU,EACVC,iBAAQ,EACRC,eAAO,EACPC,eAAO,EACPC,eAAO,EACPC,iBAAQ,EACRC,mBAAS,EACTC,qBAAU,EACVC,yBAAY,EACZC,yBAAY,CACJ,CAAA;;AAEV;;AA0NO,SAASC,WAAWA,CACzBC,OAAoC,EACtB;AAAA,EAAA,IAAAC,qBAAA,CAAA;AACd,EAAA,IAAID,OAAO,CAACE,QAAQ,IAAIF,OAAO,CAACG,UAAU,EAAE;AAC1CC,IAAAA,OAAO,CAACC,IAAI,CAAC,4BAA4B,CAAC,CAAA;AAC5C,GAAA;AAEA,EAAA,IAAIC,KAAK,GAAG;AAAEC,IAAAA,SAAS,EAAEpB,QAAAA;GAAqC,CAAA;AAE9D,EAAA,MAAMqB,cAAc,GAAGF,KAAK,CAACC,SAAS,CAACE,MAAM,CAAC,CAACC,GAAG,EAAEC,OAAO,KAAK;AAC9D,IAAA,OAAOC,MAAM,CAACC,MAAM,CAACH,GAAG,EAAEC,OAAO,CAACG,iBAAiB,IAAA,IAAA,GAAA,KAAA,CAAA,GAAzBH,OAAO,CAACG,iBAAiB,CAAGR,KAAK,CAAC,CAAC,CAAA;GAC9D,EAAE,EAAE,CAAgC,CAAA;EAErC,MAAMS,YAAY,GAAIf,OAAoC,IAAK;AAC7D,IAAA,IAAIM,KAAK,CAAC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IAApBY,OAAO,CAAEZ,WAAW,CAAGO,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 { 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,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,CAACC,OAAO,CAACtB,MAAM,IAAIA,MAAM,CAAC+B,cAAc,EAAE,CAAC,CAAA;MACvE,OAAOF,YAAY,CAACC,WAAW,CAAC,CAAA;KACjC,EACDpB,oBAAc,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;;;;"}
@@ -0,0 +1,34 @@
1
+ import { RowModel } from '..';
2
+ import { RowData, Table, TableFeature } from '../types';
3
+ export interface FacetedColumn<TData extends RowData> {
4
+ _getFacetedMinMaxValues?: () => undefined | [number, number];
5
+ _getFacetedRowModel?: () => RowModel<TData>;
6
+ _getFacetedUniqueValues?: () => Map<any, number>;
7
+ /**
8
+ * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.
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/filters#getfacetedminmaxvalues)
11
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
12
+ */
13
+ getFacetedMinMaxValues: () => undefined | [number, number];
14
+ /**
15
+ * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.
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/filters#getfacetedrowmodel)
18
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
19
+ */
20
+ getFacetedRowModel: () => RowModel<TData>;
21
+ /**
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
+ * > ⚠️ 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/filters#getfaceteduniquevalues)
25
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
26
+ */
27
+ getFacetedUniqueValues: () => Map<any, number>;
28
+ }
29
+ export interface FacetedOptions<TData extends RowData> {
30
+ getFacetedMinMaxValues?: (table: Table<TData>, columnId: string) => () => undefined | [number, number];
31
+ getFacetedRowModel?: (table: Table<TData>, columnId: string) => () => RowModel<TData>;
32
+ getFacetedUniqueValues?: (table: Table<TData>, columnId: string) => () => Map<any, number>;
33
+ }
34
+ export declare const ColumnFaceting: TableFeature;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * table-core
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ //
14
+
15
+ const ColumnFaceting = {
16
+ createColumn: (column, table) => {
17
+ column._getFacetedRowModel = table.options.getFacetedRowModel && table.options.getFacetedRowModel(table, column.id);
18
+ column.getFacetedRowModel = () => {
19
+ if (!column._getFacetedRowModel) {
20
+ return table.getPreFilteredRowModel();
21
+ }
22
+ return column._getFacetedRowModel();
23
+ };
24
+ column._getFacetedUniqueValues = table.options.getFacetedUniqueValues && table.options.getFacetedUniqueValues(table, column.id);
25
+ column.getFacetedUniqueValues = () => {
26
+ if (!column._getFacetedUniqueValues) {
27
+ return new Map();
28
+ }
29
+ return column._getFacetedUniqueValues();
30
+ };
31
+ column._getFacetedMinMaxValues = table.options.getFacetedMinMaxValues && table.options.getFacetedMinMaxValues(table, column.id);
32
+ column.getFacetedMinMaxValues = () => {
33
+ if (!column._getFacetedMinMaxValues) {
34
+ return undefined;
35
+ }
36
+ return column._getFacetedMinMaxValues();
37
+ };
38
+ }
39
+ };
40
+
41
+ exports.ColumnFaceting = ColumnFaceting;
42
+ //# sourceMappingURL=ColumnFaceting.js.map
@@ -0,0 +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/filters#getfacetedminmaxvalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\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/filters#getfacetedrowmodel)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\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/filters#getfaceteduniquevalues)\n * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)\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;;;;"}
@@ -1,10 +1,8 @@
1
1
  import { RowModel } from '..';
2
- import { TableFeature } from '../core/table';
3
2
  import { BuiltInFilterFn } from '../filterFns';
4
- import { Column, OnChangeFn, Table, Row, Updater, RowData, FilterMeta, FilterFns } from '../types';
5
- export interface FiltersTableState {
3
+ import { Column, FilterFns, FilterMeta, OnChangeFn, Row, RowData, Table, TableFeature, Updater } from '../types';
4
+ export interface ColumnFiltersTableState {
6
5
  columnFilters: ColumnFiltersState;
7
- globalFilter: any;
8
6
  }
9
7
  export type ColumnFiltersState = ColumnFilter[];
10
8
  export interface ColumnFilter {
@@ -12,26 +10,20 @@ export interface ColumnFilter {
12
10
  value: unknown;
13
11
  }
14
12
  export interface ResolvedColumnFilter<TData extends RowData> {
13
+ filterFn: FilterFn<TData>;
15
14
  id: string;
16
15
  resolvedValue: unknown;
17
- filterFn: FilterFn<TData>;
18
16
  }
19
17
  export interface FilterFn<TData extends RowData> {
20
18
  (row: Row<TData>, columnId: string, filterValue: any, addMeta: (meta: FilterMeta) => void): boolean;
21
- resolveFilterValue?: TransformFilterValueFn<TData>;
22
19
  autoRemove?: ColumnFilterAutoRemoveTestFn<TData>;
20
+ resolveFilterValue?: TransformFilterValueFn<TData>;
23
21
  }
24
22
  export type TransformFilterValueFn<TData extends RowData> = (value: any, column?: Column<TData, unknown>) => unknown;
25
23
  export type ColumnFilterAutoRemoveTestFn<TData extends RowData> = (value: any, column?: Column<TData, unknown>) => boolean;
26
24
  export type CustomFilterFns<TData extends RowData> = Record<string, FilterFn<TData>>;
27
25
  export type FilterFnOption<TData extends RowData> = 'auto' | BuiltInFilterFn | keyof FilterFns | FilterFn<TData>;
28
- export interface FiltersColumnDef<TData extends RowData> {
29
- /**
30
- * The filter function to use with this column. Can be the name of a built-in filter function or a custom filter function.
31
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#filterfn)
32
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
33
- */
34
- filterFn?: FilterFnOption<TData>;
26
+ export interface ColumnFiltersColumnDef<TData extends RowData> {
35
27
  /**
36
28
  * Enables/disables the **column** filter for this column.
37
29
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablecolumnfilter)
@@ -39,16 +31,13 @@ export interface FiltersColumnDef<TData extends RowData> {
39
31
  */
40
32
  enableColumnFilter?: boolean;
41
33
  /**
42
- * Enables/disables the **global** filter for this column.
43
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enableglobalfilter)
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/filters#filterfn)
44
36
  * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
45
37
  */
46
- enableGlobalFilter?: boolean;
38
+ filterFn?: FilterFnOption<TData>;
47
39
  }
48
- export interface FiltersColumn<TData extends RowData> {
49
- _getFacetedMinMaxValues?: () => undefined | [number, number];
50
- _getFacetedRowModel?: () => RowModel<TData>;
51
- _getFacetedUniqueValues?: () => Map<any, number>;
40
+ export interface ColumnFiltersColumn<TData extends RowData> {
52
41
  /**
53
42
  * Returns an automatically calculated filter function for the column based off of the columns first known value.
54
43
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getautofilterfn)
@@ -61,33 +50,6 @@ export interface FiltersColumn<TData extends RowData> {
61
50
  * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
62
51
  */
63
52
  getCanFilter: () => boolean;
64
- /**
65
- * Returns whether or not the column can be **globally** filtered. Set to `false` to disable a column from being scanned during global filtering.
66
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getcanglobalfilter)
67
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
68
- */
69
- getCanGlobalFilter: () => boolean;
70
- /**
71
- * A function that **computes and returns** a min/max tuple derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.
72
- * > ⚠️ Requires that you pass a valid `getFacetedMinMaxValues` function to `options.getFacetedMinMaxValues`. A default implementation is provided via the exported `getFacetedMinMaxValues` function.
73
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfacetedminmaxvalues)
74
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
75
- */
76
- getFacetedMinMaxValues: () => undefined | [number, number];
77
- /**
78
- * Returns the row model with all other column filters applied, excluding its own filter. Useful for displaying faceted result counts.
79
- * > ⚠️ Requires that you pass a valid `getFacetedRowModel` function to `options.facetedRowModel`. A default implementation is provided via the exported `getFacetedRowModel` function.
80
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfacetedrowmodel)
81
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
82
- */
83
- getFacetedRowModel: () => RowModel<TData>;
84
- /**
85
- * A function that **computes and returns** a `Map` of unique values and their occurrences derived from `column.getFacetedRowModel`. Useful for displaying faceted result values.
86
- * > ⚠️ Requires that you pass a valid `getFacetedUniqueValues` function to `options.getFacetedUniqueValues`. A default implementation is provided via the exported `getFacetedUniqueValues` function.
87
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfaceteduniquevalues)
88
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
89
- */
90
- getFacetedUniqueValues: () => Map<any, number>;
91
53
  /**
92
54
  * Returns the filter function (either user-defined or automatic, depending on configuration) for the columnId specified.
93
55
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getfilterfn)
@@ -119,7 +81,7 @@ export interface FiltersColumn<TData extends RowData> {
119
81
  */
120
82
  setFilterValue: (updater: Updater<any>) => void;
121
83
  }
122
- export interface FiltersRow<TData extends RowData> {
84
+ export interface ColumnFiltersRow<TData extends RowData> {
123
85
  /**
124
86
  * The column filters map for the row. This object tracks whether a row is passing/failing specific filters by their column ID.
125
87
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#columnfilters)
@@ -133,7 +95,13 @@ export interface FiltersRow<TData extends RowData> {
133
95
  */
134
96
  columnFiltersMeta: Record<string, FilterMeta>;
135
97
  }
136
- interface FiltersOptionsBase<TData extends RowData> {
98
+ interface ColumnFiltersOptionsBase<TData extends RowData> {
99
+ /**
100
+ * Enables/disables **column** filtering for all columns.
101
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablecolumnfilters)
102
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
103
+ */
104
+ enableColumnFilters?: boolean;
137
105
  /**
138
106
  * Enables/disables all filtering for the table.
139
107
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablefilters)
@@ -168,71 +136,21 @@ interface FiltersOptionsBase<TData extends RowData> {
168
136
  * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
169
137
  */
170
138
  maxLeafRowFilterDepth?: number;
171
- /**
172
- * Enables/disables **column** filtering for all columns.
173
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enablecolumnfilters)
174
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
175
- */
176
- enableColumnFilters?: boolean;
177
139
  /**
178
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.
179
141
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#oncolumnfilterschange)
180
142
  * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
181
143
  */
182
144
  onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>;
183
- /**
184
- * Enables/disables **global** filtering for all columns.
185
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#enableglobalfilter)
186
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
187
- */
188
- enableGlobalFilter?: boolean;
189
- /**
190
- * If provided, this function will be called with the column and should return `true` or `false` to indicate whether this column should be used for global filtering.
191
- *
192
- * This is useful if the column can contain data that is not `string` or `number` (i.e. `undefined`).
193
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getcolumncanglobalfilter)
194
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
195
- */
196
- getColumnCanGlobalFilter?: (column: Column<TData, unknown>) => boolean;
197
- /**
198
- * The filter function to use for global filtering.
199
- * - A `string` referencing a built-in filter function
200
- * - A `string` that references a custom filter functions provided via the `tableOptions.filterFns` option
201
- * - A custom filter function
202
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#globalfilterfn)
203
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
204
- */
205
- globalFilterFn?: FilterFnOption<TData>;
206
- /**
207
- * If provided, this function will be called with an `updaterFn` when `state.globalFilter` 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.
208
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#onglobalfilterchange)
209
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
210
- */
211
- onGlobalFilterChange?: OnChangeFn<any>;
212
- getFacetedRowModel?: (table: Table<TData>, columnId: string) => () => RowModel<TData>;
213
- getFacetedUniqueValues?: (table: Table<TData>, columnId: string) => () => Map<any, number>;
214
- getFacetedMinMaxValues?: (table: Table<TData>, columnId: string) => () => undefined | [number, number];
215
145
  }
216
146
  type ResolvedFilterFns = keyof FilterFns extends never ? {
217
147
  filterFns?: Record<string, FilterFn<any>>;
218
148
  } : {
219
149
  filterFns: Record<keyof FilterFns, FilterFn<any>>;
220
150
  };
221
- export interface FiltersOptions<TData extends RowData> extends FiltersOptionsBase<TData>, ResolvedFilterFns {
151
+ export interface ColumnFiltersOptions<TData extends RowData> extends ColumnFiltersOptionsBase<TData>, ResolvedFilterFns {
222
152
  }
223
- export interface FiltersInstance<TData extends RowData> {
224
- /**
225
- * Sets or updates the `state.columnFilters` state.
226
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setcolumnfilters)
227
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
228
- */
229
- setColumnFilters: (updater: Updater<ColumnFiltersState>) => void;
230
- /**
231
- * Resets the **columnFilters** state to `initialState.columnFilters`, or `true` can be passed to force a default blank state reset to `[]`.
232
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#resetcolumnfilters)
233
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
234
- */
235
- resetColumnFilters: (defaultState?: boolean) => void;
153
+ export interface ColumnFiltersInstance<TData extends RowData> {
236
154
  _getFilteredRowModel?: () => RowModel<TData>;
237
155
  /**
238
156
  * Returns the row model for the table after **column** filtering has been applied.
@@ -246,45 +164,24 @@ export interface FiltersInstance<TData extends RowData> {
246
164
  * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
247
165
  */
248
166
  getPreFilteredRowModel: () => RowModel<TData>;
249
- _getGlobalFacetedMinMaxValues?: () => undefined | [number, number];
250
- _getGlobalFacetedRowModel?: () => RowModel<TData>;
251
- _getGlobalFacetedUniqueValues?: () => Map<any, number>;
252
167
  /**
253
- * Currently, this function returns the built-in `includesString` filter function. In future releases, it may return more dynamic filter functions based on the nature of the data provided.
254
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalautofilterfn)
255
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
256
- */
257
- getGlobalAutoFilterFn: () => FilterFn<TData> | undefined;
258
- /**
259
- * Returns the faceted min and max values for the global filter.
260
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalfacetedminmaxvalues)
261
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
262
- */
263
- getGlobalFacetedMinMaxValues: () => undefined | [number, number];
264
- /**
265
- * Returns the row model for the table after **global** filtering has been applied.
266
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalfacetedrowmodel)
267
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
268
- */
269
- getGlobalFacetedRowModel: () => RowModel<TData>;
270
- /**
271
- * Returns the faceted unique values for the global filter.
272
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalfaceteduniquevalues)
273
- * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
274
- */
275
- getGlobalFacetedUniqueValues: () => Map<any, number>;
276
- /**
277
- * Returns the filter function (either user-defined or automatic, depending on configuration) for the global filter.
278
- * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#getglobalfilterfn)
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/filters#resetcolumnfilters)
279
170
  * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
280
171
  */
281
- getGlobalFilterFn: () => FilterFn<TData> | undefined;
172
+ resetColumnFilters: (defaultState?: boolean) => void;
282
173
  /**
283
174
  * Resets the **globalFilter** state to `initialState.globalFilter`, or `true` can be passed to force a default blank state reset to `undefined`.
284
175
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#resetglobalfilter)
285
176
  * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
286
177
  */
287
178
  resetGlobalFilter: (defaultState?: boolean) => void;
179
+ /**
180
+ * Sets or updates the `state.columnFilters` state.
181
+ * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setcolumnfilters)
182
+ * @link [Guide](https://tanstack.com/table/v8/docs/guide/filters)
183
+ */
184
+ setColumnFilters: (updater: Updater<ColumnFiltersState>) => void;
288
185
  /**
289
186
  * Sets or updates the `state.globalFilter` state.
290
187
  * @link [API Docs](https://tanstack.com/table/v8/docs/api/features/filters#setglobalfilter)
@@ -292,6 +189,6 @@ export interface FiltersInstance<TData extends RowData> {
292
189
  */
293
190
  setGlobalFilter: (updater: Updater<any>) => void;
294
191
  }
295
- export declare const Filters: TableFeature;
192
+ export declare const ColumnFiltering: TableFeature;
296
193
  export declare function shouldAutoRemoveFilter<TData extends RowData>(filterFn?: FilterFn<TData>, value?: any, column?: Column<TData, unknown>): boolean;
297
194
  export {};