@tanstack/table-core 8.0.0-alpha.79 → 8.0.0-alpha.83

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 (71) hide show
  1. package/build/cjs/core.js.map +1 -1
  2. package/build/cjs/createTable.js +4 -2
  3. package/build/cjs/createTable.js.map +1 -1
  4. package/build/cjs/features/Cells.js +1 -1
  5. package/build/cjs/features/Cells.js.map +1 -1
  6. package/build/cjs/features/ColumnSizing.js +5 -5
  7. package/build/cjs/features/ColumnSizing.js.map +1 -1
  8. package/build/cjs/features/Columns.js +8 -6
  9. package/build/cjs/features/Columns.js.map +1 -1
  10. package/build/cjs/features/Filters.js +11 -6
  11. package/build/cjs/features/Filters.js.map +1 -1
  12. package/build/cjs/features/Grouping.js +5 -5
  13. package/build/cjs/features/Grouping.js.map +1 -1
  14. package/build/cjs/features/Headers.js +2 -2
  15. package/build/cjs/features/Headers.js.map +1 -1
  16. package/build/cjs/features/Pinning.js +14 -8
  17. package/build/cjs/features/Pinning.js.map +1 -1
  18. package/build/cjs/features/Rows.js +1 -1
  19. package/build/cjs/features/Rows.js.map +1 -1
  20. package/build/cjs/features/Sorting.js +9 -9
  21. package/build/cjs/features/Sorting.js.map +1 -1
  22. package/build/cjs/features/Visibility.js +3 -3
  23. package/build/cjs/features/Visibility.js.map +1 -1
  24. package/build/cjs/index.js +8 -0
  25. package/build/cjs/index.js.map +1 -1
  26. package/build/cjs/utils/filterRowsUtils.js +1 -1
  27. package/build/cjs/utils/filterRowsUtils.js.map +1 -1
  28. package/build/cjs/utils/getFacetedRowModel.js +1 -1
  29. package/build/cjs/utils/getFacetedRowModel.js.map +1 -1
  30. package/build/cjs/utils/getFilteredRowModel.js +20 -9
  31. package/build/cjs/utils/getFilteredRowModel.js.map +1 -1
  32. package/build/cjs/utils/getGroupedRowModel.js +2 -2
  33. package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
  34. package/build/cjs/utils/getSortedRowModel.js +2 -2
  35. package/build/cjs/utils/getSortedRowModel.js.map +1 -1
  36. package/build/esm/index.js +90 -64
  37. package/build/esm/index.js.map +1 -1
  38. package/build/stats-html.html +1 -1
  39. package/build/stats-react.json +344 -326
  40. package/build/types/core.d.ts +4 -4
  41. package/build/types/createTable.d.ts +8 -5
  42. package/build/types/features/Columns.d.ts +2 -2
  43. package/build/types/features/Filters.d.ts +3 -2
  44. package/build/types/features/Grouping.d.ts +1 -1
  45. package/build/types/features/Pinning.d.ts +1 -1
  46. package/build/types/index.d.ts +3 -0
  47. package/build/types/types.d.ts +6 -3
  48. package/build/umd/index.development.js +94 -63
  49. package/build/umd/index.development.js.map +1 -1
  50. package/build/umd/index.production.js +1 -1
  51. package/build/umd/index.production.js.map +1 -1
  52. package/package.json +1 -1
  53. package/src/core.ts +6 -6
  54. package/src/createTable.ts +14 -7
  55. package/src/features/Cells.ts +2 -2
  56. package/src/features/ColumnSizing.ts +5 -5
  57. package/src/features/Columns.ts +12 -8
  58. package/src/features/Filters.ts +18 -6
  59. package/src/features/Grouping.ts +6 -5
  60. package/src/features/Headers.ts +4 -4
  61. package/src/features/Pinning.ts +10 -5
  62. package/src/features/Rows.ts +5 -1
  63. package/src/features/Sorting.ts +10 -10
  64. package/src/features/Visibility.ts +2 -2
  65. package/src/index.ts +3 -0
  66. package/src/types.ts +10 -5
  67. package/src/utils/filterRowsUtils.ts +1 -1
  68. package/src/utils/getFacetedRowModel.ts +1 -1
  69. package/src/utils/getFilteredRowModel.ts +24 -13
  70. package/src/utils/getGroupedRowModel.ts +3 -2
  71. package/src/utils/getSortedRowModel.ts +2 -2
@@ -1,5 +1,5 @@
1
1
  import { RequiredKeys } from './utils';
2
- import { Updater, TableOptions, TableState, TableInstance, Renderable, TableFeature, TableGenerics, InitialTableState } from './types';
2
+ import { Updater, TableOptionsResolved, TableState, TableInstance, Renderable, TableFeature, TableGenerics, InitialTableState } from './types';
3
3
  export declare type CoreTableState = {};
4
4
  export declare type CoreOptions<TGenerics extends TableGenerics> = {
5
5
  data: TGenerics['Row'][];
@@ -19,12 +19,12 @@ export declare type CoreOptions<TGenerics extends TableGenerics> = {
19
19
  export declare type CoreInstance<TGenerics extends TableGenerics> = {
20
20
  initialState: TableState;
21
21
  reset: () => void;
22
- options: RequiredKeys<TableOptions<TGenerics>, 'state'>;
23
- setOptions: (newOptions: Updater<TableOptions<TGenerics>>) => void;
22
+ options: RequiredKeys<TableOptionsResolved<TGenerics>, 'state'>;
23
+ setOptions: (newOptions: Updater<TableOptionsResolved<TGenerics>>) => void;
24
24
  getState: () => TableState;
25
25
  setState: (updater: Updater<TableState>) => void;
26
26
  _queue: (cb: () => void) => void;
27
27
  _render: <TProps>(template: Renderable<TGenerics, TProps>, props: TProps) => string | null | TGenerics['Rendered'];
28
28
  _features: readonly TableFeature[];
29
29
  };
30
- export declare function createTableInstance<TGenerics extends TableGenerics>(options: TableOptions<TGenerics>): TableInstance<TGenerics>;
30
+ export declare function createTableInstance<TGenerics extends TableGenerics>(options: TableOptionsResolved<TGenerics>): TableInstance<TGenerics>;
@@ -1,7 +1,7 @@
1
1
  import { CustomFilterFns, FilterFn } from './features/Filters';
2
2
  import { AggregationFn, CustomAggregationFns } from './features/Grouping';
3
3
  import { CustomSortingFns, SortingFn } from './features/Sorting';
4
- import { ColumnDef, AccessorFn, AnyRender, TableGenerics, TableOptions } from './types';
4
+ import { ColumnDef, AccessorFn, AnyRender, TableGenerics, TableOptionsResolved, TableOptions } from './types';
5
5
  import { IfDefined, Overwrite } from './utils';
6
6
  export declare type TableFactory<TGenerics extends TableGenerics> = () => Table<TGenerics>;
7
7
  export declare type CreateTableOptions<TRender extends AnyRender, TFilterFns extends CustomFilterFns<any>, TSortingFns extends CustomSortingFns<any>, TAggregationFns extends CustomAggregationFns<any>, TGenerics extends TableGenerics> = Partial<{
@@ -9,11 +9,10 @@ export declare type CreateTableOptions<TRender extends AnyRender, TFilterFns ext
9
9
  filterFns?: TFilterFns;
10
10
  sortingFns?: TSortingFns;
11
11
  aggregationFns?: TAggregationFns;
12
- } & Omit<TableOptions<TGenerics>, 'filterFns' | 'sortingFns' | 'aggregationFns'>>;
12
+ } & Omit<TableOptionsResolved<TGenerics>, 'filterFns' | 'sortingFns' | 'aggregationFns'>>;
13
13
  export declare type Table<TGenerics extends TableGenerics> = {
14
14
  generics: TGenerics;
15
- options: Partial<TableOptions<TGenerics>>;
16
- setGenerics: <T extends TableGenerics>() => Table<T>;
15
+ options: Partial<TableOptionsResolved<TGenerics>>;
17
16
  setRowType: <TRow>() => Table<Overwrite<TGenerics, {
18
17
  Row: TRow;
19
18
  }>>;
@@ -23,7 +22,10 @@ export declare type Table<TGenerics extends TableGenerics> = {
23
22
  setColumnMetaType: <TColumnMeta>() => Table<Overwrite<TGenerics, {
24
23
  ColumnMeta: TColumnMeta;
25
24
  }>>;
26
- setOptions: <TFilterFns extends Record<string, FilterFn<any>>, TSortingFns extends Record<string, SortingFn<any>>, TAggregationFns extends Record<string, AggregationFn<any>>>(options: CreateTableOptions<any, TFilterFns, TSortingFns, TAggregationFns, TGenerics>) => Table<Overwrite<TGenerics, {
25
+ setFilterMetaType: <TFilterMeta>() => Table<Overwrite<TGenerics, {
26
+ FilterMeta: TFilterMeta;
27
+ }>>;
28
+ setOptions: <TFilterFns extends Record<string, FilterFn<TGenerics>>, TSortingFns extends Record<string, SortingFn<TGenerics>>, TAggregationFns extends Record<string, AggregationFn<TGenerics>>>(options: CreateTableOptions<any, TFilterFns, TSortingFns, TAggregationFns, TGenerics>) => Table<Overwrite<TGenerics, {
27
29
  FilterFns: IfDefined<TFilterFns, TGenerics['FilterFns']>;
28
30
  SortingFns: IfDefined<TSortingFns, TGenerics['SortingFns']>;
29
31
  AggregationFns: IfDefined<TAggregationFns, TGenerics['AggregationFns']>;
@@ -51,6 +53,7 @@ export declare type Table<TGenerics extends TableGenerics> = {
51
53
  accessorKey?: never;
52
54
  columns?: ColumnDef<any>[];
53
55
  }>) => ColumnDef<TGenerics>;
56
+ createOptions: (options: TableOptions<TGenerics>) => TableOptions<TGenerics>;
54
57
  };
55
58
  export declare function createTableFactory<TRenderer extends AnyRender>(opts: {
56
59
  render: TRenderer;
@@ -37,10 +37,10 @@ export declare type CoreColumn<TGenerics extends TableGenerics> = {
37
37
  };
38
38
  export declare type ColumnsOptions<TGenerics extends TableGenerics> = {
39
39
  columns: ColumnDef<TGenerics>[];
40
- defaultColumn?: Partial<ColumnDef<TGenerics>>;
40
+ defaultColumnDef?: Partial<ColumnDef<TGenerics>>;
41
41
  };
42
42
  export declare type ColumnsInstance<TGenerics extends TableGenerics> = {
43
- getDefaultColumn: () => Partial<ColumnDef<TGenerics>>;
43
+ getDefaultColumnDef: () => Partial<ColumnDef<TGenerics>>;
44
44
  getColumnDefs: () => ColumnDef<TGenerics>[];
45
45
  createColumn: (columnDef: ColumnDef<TGenerics>, depth: number, parent?: Column<TGenerics>) => Column<TGenerics>;
46
46
  getAllColumns: () => Column<TGenerics>[];
@@ -17,7 +17,7 @@ export declare type ResolvedColumnFilter<TGenerics extends TableGenerics> = {
17
17
  filterFn: FilterFn<TGenerics>;
18
18
  };
19
19
  export declare type FilterFn<TGenerics extends TableGenerics> = {
20
- (row: Row<TGenerics>, columnId: string, filterValue: any): boolean;
20
+ (row: Row<TGenerics>, columnId: string, filterValue: any, addMeta: (meta: TGenerics['FilterMeta']) => void): boolean;
21
21
  resolveFilterValue?: TransformFilterValueFn<TGenerics>;
22
22
  autoRemove?: ColumnFilterAutoRemoveTestFn<TGenerics>;
23
23
  };
@@ -53,7 +53,8 @@ export declare type FiltersColumn<TGenerics extends TableGenerics> = {
53
53
  _getFacetedMinMaxValues?: () => undefined | [number, number];
54
54
  };
55
55
  export declare type FiltersRow<TGenerics extends TableGenerics> = {
56
- columnFilterMap: Record<string, boolean>;
56
+ columnFilters: Record<string, boolean>;
57
+ columnFiltersMeta: Record<string, TGenerics['FilterMeta']>;
57
58
  subRowsByFacetId: Record<string, Row<TGenerics>[]>;
58
59
  };
59
60
  export declare type FiltersOptions<TGenerics extends TableGenerics> = {
@@ -3,7 +3,7 @@ import { BuiltInAggregationFn } from '../aggregationFns';
3
3
  import { Cell, Column, OnChangeFn, TableInstance, Row, Updater, Renderable, TableGenerics, TableFeature } from '../types';
4
4
  import { Overwrite } from '../utils';
5
5
  export declare type GroupingState = string[];
6
- export declare type AggregationFn<TGenerics extends TableGenerics> = (getLeafValues: () => TGenerics['Row'][], getChildValues: () => TGenerics['Row'][]) => any;
6
+ export declare type AggregationFn<TGenerics extends TableGenerics> = (getLeafValues: () => TGenerics['Value'][], getChildValues: () => TGenerics['Value'][]) => any;
7
7
  export declare type CustomAggregationFns<TGenerics extends TableGenerics> = Record<string, AggregationFn<TGenerics>>;
8
8
  export declare type AggregationFnOption<TGenerics extends TableGenerics> = 'auto' | BuiltInAggregationFn | keyof TGenerics['AggregationFns'] | AggregationFn<TGenerics>;
9
9
  export declare type GroupingTableState = {
@@ -31,7 +31,7 @@ export declare type ColumnPinningRow<TGenerics extends TableGenerics> = {
31
31
  export declare type ColumnPinningInstance<TGenerics extends TableGenerics> = {
32
32
  setColumnPinning: (updater: Updater<ColumnPinningState>) => void;
33
33
  resetColumnPinning: (defaultState?: boolean) => void;
34
- getIsSomeColumnsPinned: () => boolean;
34
+ getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean;
35
35
  getLeftLeafColumns: () => Column<TGenerics>[];
36
36
  getRightLeafColumns: () => Column<TGenerics>[];
37
37
  getCenterLeafColumns: () => Column<TGenerics>[];
@@ -14,6 +14,9 @@ export * from './features/RowSelection';
14
14
  export * from './features/Sorting';
15
15
  export * from './features/Visibility';
16
16
  export * from './features/Expanding';
17
+ export * from './filterFns';
18
+ export * from './sortingFns';
19
+ export * from './aggregationFns';
17
20
  export * from './utils';
18
21
  export * from './utils/getCoreRowModel';
19
22
  export * from './utils/getFilteredRowModel';
@@ -8,6 +8,7 @@ import { FiltersColumn, FiltersColumnDef, FiltersInstance, FiltersOptions, Filte
8
8
  import { SortingColumn, SortingColumnDef, SortingInstance, SortingOptions, SortingTableState } from './features/Sorting';
9
9
  import { GroupingCell, GroupingColumn, GroupingColumnDef, GroupingInstance, GroupingOptions, GroupingRow, GroupingTableState } from './features/Grouping';
10
10
  import { ExpandedInstance, ExpandedOptions, ExpandedTableState, ExpandedRow } from './features/Expanding';
11
+ import { PartialKeys } from './utils';
11
12
  import { ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingHeader, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingTableState } from './features/ColumnSizing';
12
13
  import { PaginationInitialTableState, PaginationInstance, PaginationOptions, PaginationTableState } from './features/Pagination';
13
14
  import { RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionTableState } from './features/RowSelection';
@@ -26,20 +27,22 @@ export declare type TableGenerics = {
26
27
  Rendered?: any;
27
28
  ColumnMeta?: any;
28
29
  TableMeta?: any;
30
+ FilterMeta?: any;
29
31
  };
30
32
  export declare type AnyRender = (Comp: any, props: any) => any;
31
33
  export declare type TableFeature = {
32
34
  getDefaultOptions?: (instance: any) => any;
33
35
  getInitialState?: (initialState?: InitialTableState) => any;
34
36
  createInstance?: (instance: any) => any;
35
- getDefaultColumn?: () => any;
37
+ getDefaultColumnDef?: () => any;
36
38
  createColumn?: (column: any, instance: any) => any;
37
39
  createHeader?: (column: any, instance: any) => any;
38
40
  createCell?: (cell: any, column: any, row: any, instance: any) => any;
39
41
  createRow?: (row: any, instance: any) => any;
40
42
  };
41
43
  export declare type TableInstance<TGenerics extends TableGenerics> = CoreInstance<TGenerics> & ColumnsInstance<TGenerics> & RowsInstance<TGenerics> & CellsInstance<TGenerics> & VisibilityInstance<TGenerics> & ColumnOrderInstance<TGenerics> & ColumnPinningInstance<TGenerics> & HeadersInstance<TGenerics> & FiltersInstance<TGenerics> & SortingInstance<TGenerics> & GroupingInstance<TGenerics> & ColumnSizingInstance<TGenerics> & ExpandedInstance<TGenerics> & PaginationInstance<TGenerics> & RowSelectionInstance<TGenerics>;
42
- export declare type TableOptions<TGenerics extends TableGenerics> = CoreOptions<TGenerics> & ColumnsOptions<TGenerics> & RowsOptions<TGenerics> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TGenerics> & SortingOptions<TGenerics> & GroupingOptions<TGenerics> & ExpandedOptions<TGenerics> & ColumnSizingOptions & PaginationOptions<TGenerics> & RowSelectionOptions<TGenerics>;
44
+ export declare type TableOptionsResolved<TGenerics extends TableGenerics> = CoreOptions<TGenerics> & ColumnsOptions<TGenerics> & RowsOptions<TGenerics> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TGenerics> & SortingOptions<TGenerics> & GroupingOptions<TGenerics> & ExpandedOptions<TGenerics> & ColumnSizingOptions & PaginationOptions<TGenerics> & RowSelectionOptions<TGenerics>;
45
+ export declare type TableOptions<TGenerics extends TableGenerics> = Omit<PartialKeys<TableOptionsResolved<TGenerics>, 'state' | 'onStateChange'>, 'render'>;
43
46
  export declare type TableState = CoreTableState & VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationTableState & RowSelectionTableState;
44
47
  export declare type InitialTableState = Partial<CoreTableState & VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationInitialTableState & RowSelectionTableState>;
45
48
  export declare type Row<TGenerics extends TableGenerics> = CoreRow<TGenerics> & CellsRow<TGenerics> & VisibilityRow<TGenerics> & ColumnPinningRow<TGenerics> & FiltersRow<TGenerics> & GroupingRow & RowSelectionRow & ExpandedRow;
@@ -54,7 +57,7 @@ export declare type RowModel<TGenerics extends TableGenerics> = {
54
57
  export declare type AccessorFn<TData> = (originalRow: TData, index: number) => any;
55
58
  export declare type Renderable<TGenerics extends TableGenerics, TProps> = string | ((props: TProps) => TGenerics['Rendered']);
56
59
  export declare type ColumnDef<TGenerics extends TableGenerics> = CoreColumnDef<TGenerics> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TGenerics> & SortingColumnDef<TGenerics> & GroupingColumnDef<TGenerics> & ColumnSizingColumnDef;
57
- export declare type Column<TGenerics extends TableGenerics> = ColumnDef<TGenerics> & CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
60
+ export declare type Column<TGenerics extends TableGenerics> = CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
58
61
  export declare type Cell<TGenerics extends TableGenerics> = CoreCell<TGenerics> & GroupingCell<TGenerics>;
59
62
  export declare type CoreCell<TGenerics extends TableGenerics> = {
60
63
  id: string;
@@ -95,7 +95,7 @@
95
95
  const Columns = {
96
96
  createInstance: instance => {
97
97
  return {
98
- getDefaultColumn: memo(() => [instance.options.defaultColumn], defaultColumn => {
98
+ getDefaultColumnDef: memo(() => [instance.options.defaultColumnDef], defaultColumn => {
99
99
  var _defaultColumn;
100
100
 
101
101
  defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
@@ -108,7 +108,7 @@
108
108
  return (_props$getValue$toStr = (_props$getValue$toStr2 = (_props$getValue = props.getValue()).toString) == null ? void 0 : _props$getValue$toStr2.call(_props$getValue)) != null ? _props$getValue$toStr : null;
109
109
  },
110
110
  ...instance._features.reduce((obj, feature) => {
111
- return Object.assign(obj, feature.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
111
+ return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
112
112
  }, {}),
113
113
  ...defaultColumn
114
114
  };
@@ -118,13 +118,16 @@
118
118
 
119
119
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
120
120
  },
121
- key: 'getDefaultColumn'
121
+ key: 'getDefaultColumnDef'
122
122
  }),
123
123
  getColumnDefs: () => instance.options.columns,
124
124
  createColumn: (columnDef, depth, parent) => {
125
125
  var _ref, _columnDef$id;
126
126
 
127
- const defaultColumn = instance.getDefaultColumn();
127
+ const defaultColumnDef = instance.getDefaultColumnDef();
128
+ columnDef = { ...defaultColumnDef,
129
+ ...columnDef
130
+ };
128
131
  let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
129
132
  let accessorFn;
130
133
 
@@ -140,8 +143,7 @@
140
143
  }
141
144
  }
142
145
 
143
- let column = { ...defaultColumn,
144
- ...columnDef,
146
+ let column = { ...columnDef,
145
147
  id: "" + id,
146
148
  accessorFn,
147
149
  parent: parent,
@@ -290,7 +292,7 @@
290
292
  const column = instance.getColumn(columnId);
291
293
 
292
294
  if (!column.accessorFn) {
293
- throw new Error();
295
+ return undefined;
294
296
  }
295
297
 
296
298
  row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
@@ -375,7 +377,7 @@
375
377
  row,
376
378
  column,
377
379
  getValue: () => row.getValue(columnId),
378
- renderCell: () => column.cell ? instance._render(column.cell, {
380
+ renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
379
381
  instance,
380
382
  column,
381
383
  row,
@@ -430,7 +432,7 @@
430
432
  });
431
433
 
432
434
  const ColumnSizing = {
433
- getDefaultColumn: () => {
435
+ getDefaultColumnDef: () => {
434
436
  return defaultColumnSizing;
435
437
  },
436
438
  getInitialState: state => {
@@ -450,10 +452,10 @@
450
452
  createColumn: (column, instance) => {
451
453
  return {
452
454
  getSize: () => {
453
- var _column$minSize, _ref, _column$maxSize;
455
+ var _column$columnDef$min, _ref, _column$columnDef$max;
454
456
 
455
457
  const columnSize = instance.getState().columnSizing[column.id];
456
- return Math.min(Math.max((_column$minSize = column.minSize) != null ? _column$minSize : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.size) != null ? _ref : defaultColumnSizing.size), (_column$maxSize = column.maxSize) != null ? _column$maxSize : defaultColumnSizing.maxSize);
458
+ return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
457
459
  },
458
460
  getStart: position => {
459
461
  const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
@@ -476,9 +478,9 @@
476
478
  });
477
479
  },
478
480
  getCanResize: () => {
479
- var _column$enableResizin, _instance$options$ena;
481
+ var _column$columnDef$ena, _instance$options$ena;
480
482
 
481
- return ((_column$enableResizin = column.enableResizing) != null ? _column$enableResizin : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
483
+ return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
482
484
  },
483
485
  getIsResizing: () => {
484
486
  return instance.getState().columnSizingInfo.isResizingColumn === column.id;
@@ -935,7 +937,7 @@
935
937
 
936
938
  //
937
939
  const Filters = {
938
- getDefaultColumn: () => {
940
+ getDefaultColumnDef: () => {
939
941
  return {
940
942
  filterFn: 'auto'
941
943
  };
@@ -978,6 +980,10 @@
978
980
  return filterFns.inNumberRange;
979
981
  }
980
982
 
983
+ if (typeof value === 'boolean') {
984
+ return filterFns.equals;
985
+ }
986
+
981
987
  if (value !== null && typeof value === 'object') {
982
988
  return filterFns.equals;
983
989
  }
@@ -995,14 +1001,14 @@
995
1001
  return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
996
1002
  },
997
1003
  getCanFilter: () => {
998
- var _column$enableColumnF, _instance$options$ena, _instance$options$ena2;
1004
+ var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
999
1005
 
1000
- return ((_column$enableColumnF = column.enableColumnFilter) != null ? _column$enableColumnF : true) && ((_instance$options$ena = instance.options.enableColumnFilters) != null ? _instance$options$ena : true) && ((_instance$options$ena2 = instance.options.enableFilters) != null ? _instance$options$ena2 : true) && !!column.accessorFn;
1006
+ return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnFilters) != null ? _instance$options$ena : true) && ((_instance$options$ena2 = instance.options.enableFilters) != null ? _instance$options$ena2 : true) && !!column.accessorFn;
1001
1007
  },
1002
1008
  getCanGlobalFilter: () => {
1003
- var _column$enableGlobalF, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1009
+ var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1004
1010
 
1005
- return ((_column$enableGlobalF = column.enableGlobalFilter) != null ? _column$enableGlobalF : true) && ((_instance$options$ena3 = instance.options.enableGlobalFilter) != null ? _instance$options$ena3 : true) && ((_instance$options$ena4 = instance.options.enableFilters) != null ? _instance$options$ena4 : true) && ((_instance$options$get = instance.options.getColumnCanGlobalFilter == null ? void 0 : instance.options.getColumnCanGlobalFilter(column)) != null ? _instance$options$get : true) && !!column.accessorFn;
1011
+ return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_instance$options$ena3 = instance.options.enableGlobalFilter) != null ? _instance$options$ena3 : true) && ((_instance$options$ena4 = instance.options.enableFilters) != null ? _instance$options$ena4 : true) && ((_instance$options$get = instance.options.getColumnCanGlobalFilter == null ? void 0 : instance.options.getColumnCanGlobalFilter(column)) != null ? _instance$options$get : true) && !!column.accessorFn;
1006
1012
  },
1007
1013
  getIsFiltered: () => column.getFilterIndex() > -1,
1008
1014
  getFilterValue: () => {
@@ -1081,7 +1087,8 @@
1081
1087
  },
1082
1088
  createRow: (row, instance) => {
1083
1089
  return {
1084
- columnFilterMap: {},
1090
+ columnFilters: {},
1091
+ columnFiltersMeta: {},
1085
1092
  subRowsByFacetId: {}
1086
1093
  };
1087
1094
  },
@@ -1279,7 +1286,7 @@
1279
1286
 
1280
1287
  //
1281
1288
  const Grouping = {
1282
- getDefaultColumn: () => {
1289
+ getDefaultColumnDef: () => {
1283
1290
  return {
1284
1291
  aggregationFn: 'auto'
1285
1292
  };
@@ -1309,9 +1316,9 @@
1309
1316
  });
1310
1317
  },
1311
1318
  getCanGroup: () => {
1312
- var _ref, _ref2, _ref3, _column$enableGroupin;
1319
+ var _ref, _ref2, _ref3, _column$columnDef$ena;
1313
1320
 
1314
- return (_ref = (_ref2 = (_ref3 = (_column$enableGroupin = column.enableGrouping) != null ? _column$enableGroupin : true) != null ? _ref3 : instance.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
1321
+ return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : instance.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
1315
1322
  },
1316
1323
  getIsGrouped: () => {
1317
1324
  var _instance$getState$gr;
@@ -1395,9 +1402,9 @@
1395
1402
  return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
1396
1403
  },
1397
1404
  renderAggregatedCell: () => {
1398
- var _column$aggregatedCel;
1405
+ var _column$columnDef$agg;
1399
1406
 
1400
- const template = (_column$aggregatedCel = column.aggregatedCell) != null ? _column$aggregatedCel : column.cell;
1407
+ const template = (_column$columnDef$agg = column.columnDef.aggregatedCell) != null ? _column$columnDef$agg : column.columnDef.cell;
1401
1408
  return template ? instance._render(template, {
1402
1409
  instance,
1403
1410
  column,
@@ -1704,9 +1711,9 @@
1704
1711
  getCanPin: () => {
1705
1712
  const leafColumns = column.getLeafColumns();
1706
1713
  return leafColumns.some(d => {
1707
- var _d$enablePinning, _instance$options$ena;
1714
+ var _d$columnDef$enablePi, _instance$options$ena;
1708
1715
 
1709
- return ((_d$enablePinning = d.enablePinning) != null ? _d$enablePinning : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1716
+ return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1710
1717
  });
1711
1718
  },
1712
1719
  getIsPinned: () => {
@@ -1776,12 +1783,18 @@
1776
1783
 
1777
1784
  return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
1778
1785
  },
1779
- getIsSomeColumnsPinned: () => {
1780
- const {
1781
- left,
1782
- right
1783
- } = instance.getState().columnPinning;
1784
- return Boolean((left == null ? void 0 : left.length) || (right == null ? void 0 : right.length));
1786
+ getIsSomeColumnsPinned: position => {
1787
+ var _pinningState$positio;
1788
+
1789
+ const pinningState = instance.getState().columnPinning;
1790
+
1791
+ if (!position) {
1792
+ var _pinningState$left, _pinningState$right;
1793
+
1794
+ return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
1795
+ }
1796
+
1797
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1785
1798
  },
1786
1799
  getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
1787
1800
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
@@ -2307,7 +2320,7 @@
2307
2320
  ...state
2308
2321
  };
2309
2322
  },
2310
- getDefaultColumn: () => {
2323
+ getDefaultColumnDef: () => {
2311
2324
  return {
2312
2325
  sortingFn: 'auto'
2313
2326
  };
@@ -2323,7 +2336,7 @@
2323
2336
  createColumn: (column, instance) => {
2324
2337
  return {
2325
2338
  getAutoSortingFn: () => {
2326
- const firstRows = instance.getFilteredRowModel().flatRows.slice(100);
2339
+ const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
2327
2340
  let isString = false;
2328
2341
 
2329
2342
  for (const row of firstRows) {
@@ -2367,7 +2380,7 @@
2367
2380
  throw new Error();
2368
2381
  }
2369
2382
 
2370
- return isFunction(column.sortingFn) ? column.sortingFn : column.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.sortingFn]) != null ? _ref : sortingFns[column.sortingFn];
2383
+ return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.columnDef.sortingFn]) != null ? _ref : sortingFns[column.columnDef.sortingFn];
2371
2384
  },
2372
2385
  toggleSorting: (desc, multi) => {
2373
2386
  // if (column.columns.length) {
@@ -2379,7 +2392,7 @@
2379
2392
  // return
2380
2393
  // }
2381
2394
  instance.setSorting(old => {
2382
- var _ref2, _column$sortDescFirst, _instance$options$ena, _instance$options$ena2;
2395
+ var _ref2, _column$columnDef$sor, _instance$options$ena, _instance$options$ena2;
2383
2396
 
2384
2397
  // Find any existing sorting for this column
2385
2398
  const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
@@ -2406,7 +2419,7 @@
2406
2419
  }
2407
2420
  }
2408
2421
 
2409
- const sortDescFirst = (_ref2 = (_column$sortDescFirst = column.sortDescFirst) != null ? _column$sortDescFirst : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc'; // Handle toggle states that will remove the sorting
2422
+ const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc'; // Handle toggle states that will remove the sorting
2410
2423
 
2411
2424
  if (sortAction === 'toggle' && ( // Must be toggling
2412
2425
  (_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
@@ -2450,14 +2463,14 @@
2450
2463
  });
2451
2464
  },
2452
2465
  getCanSort: () => {
2453
- var _column$enableSorting, _instance$options$ena3;
2466
+ var _column$columnDef$ena, _instance$options$ena3;
2454
2467
 
2455
- return ((_column$enableSorting = column.enableSorting) != null ? _column$enableSorting : true) && ((_instance$options$ena3 = instance.options.enableSorting) != null ? _instance$options$ena3 : true) && !!column.accessorFn;
2468
+ return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_instance$options$ena3 = instance.options.enableSorting) != null ? _instance$options$ena3 : true) && !!column.accessorFn;
2456
2469
  },
2457
2470
  getCanMultiSort: () => {
2458
- var _ref3, _column$enableMultiSo;
2471
+ var _ref3, _column$columnDef$ena2;
2459
2472
 
2460
- return (_ref3 = (_column$enableMultiSo = column.enableMultiSort) != null ? _column$enableMultiSo : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2473
+ return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2461
2474
  },
2462
2475
  getIsSorted: () => {
2463
2476
  var _instance$getState$so;
@@ -2521,7 +2534,7 @@
2521
2534
  onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
2522
2535
  };
2523
2536
  },
2524
- getDefaultColumn: () => {
2537
+ getDefaultColumnDef: () => {
2525
2538
  return {
2526
2539
  defaultIsVisible: true
2527
2540
  };
@@ -2541,9 +2554,9 @@
2541
2554
  return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
2542
2555
  },
2543
2556
  getCanHide: () => {
2544
- var _column$enableHiding, _instance$options$ena;
2557
+ var _column$columnDef$ena, _instance$options$ena;
2545
2558
 
2546
- return ((_column$enableHiding = column.enableHiding) != null ? _column$enableHiding : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2559
+ return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2547
2560
  },
2548
2561
  getToggleVisibilityHandler: () => {
2549
2562
  return e => {
@@ -2654,12 +2667,12 @@
2654
2667
  recurseHeader(header);
2655
2668
  return leafHeaders;
2656
2669
  },
2657
- renderHeader: () => column.header ? instance._render(column.header, {
2670
+ renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
2658
2671
  instance,
2659
2672
  header: header,
2660
2673
  column
2661
2674
  }) : null,
2662
- renderFooter: () => column.footer ? instance._render(column.footer, {
2675
+ renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
2663
2676
  instance,
2664
2677
  header: header,
2665
2678
  column
@@ -3167,10 +3180,11 @@
3167
3180
  throw new Error('');
3168
3181
  })()
3169
3182
  },
3170
- setGenerics: () => table,
3183
+ // setGenerics: () => table as any,
3171
3184
  setRowType: () => table,
3172
3185
  setTableMetaType: () => table,
3173
3186
  setColumnMetaType: () => table,
3187
+ setFilterMetaType: () => table,
3174
3188
  setOptions: newOptions => createTable(_, __, { ...options,
3175
3189
  ...newOptions
3176
3190
  }),
@@ -3202,7 +3216,8 @@
3202
3216
  }
3203
3217
 
3204
3218
  throw new Error('Invalid accessor');
3205
- }
3219
+ },
3220
+ createOptions: options => options
3206
3221
  };
3207
3222
  return table;
3208
3223
  }
@@ -3298,7 +3313,7 @@
3298
3313
 
3299
3314
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3300
3315
  newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3301
- newRow.columnFilterMap = row.columnFilterMap;
3316
+ newRow.columnFilters = row.columnFilters;
3302
3317
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3303
3318
 
3304
3319
  if (!newRow.subRows.length) {
@@ -3371,6 +3386,11 @@
3371
3386
  function getFilteredRowModel() {
3372
3387
  return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3373
3388
  if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3389
+ for (let i = 0; i < rowModel.flatRows.length; i++) {
3390
+ rowModel.flatRows[i].columnFilters = {};
3391
+ rowModel.flatRows[i].columnFiltersMeta = {};
3392
+ }
3393
+
3374
3394
  return rowModel;
3375
3395
  }
3376
3396
 
@@ -3425,28 +3445,34 @@
3425
3445
 
3426
3446
  for (let j = 0; j < rowModel.flatRows.length; j++) {
3427
3447
  const row = rowModel.flatRows[j];
3428
- row.columnFilterMap = {};
3448
+ row.columnFilters = {};
3429
3449
 
3430
3450
  if (resolvedColumnFilters.length) {
3431
3451
  for (let i = 0; i < resolvedColumnFilters.length; i++) {
3432
- currentColumnFilter = resolvedColumnFilters[i]; // Tag the row with the column filter state
3452
+ currentColumnFilter = resolvedColumnFilters[i];
3453
+ const id = currentColumnFilter.id; // Tag the row with the column filter state
3433
3454
 
3434
- row.columnFilterMap[currentColumnFilter.id] = currentColumnFilter.filterFn(row, currentColumnFilter.id, currentColumnFilter.resolvedValue);
3455
+ row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
3456
+ row.columnFiltersMeta[id] = filterMeta;
3457
+ });
3435
3458
  }
3436
3459
  }
3437
3460
 
3438
3461
  if (resolvedGlobalFilters.length) {
3439
3462
  for (let i = 0; i < resolvedGlobalFilters.length; i++) {
3440
- currentGlobalFilter = resolvedGlobalFilters[i]; // Tag the row with the first truthy global filter state
3463
+ currentGlobalFilter = resolvedGlobalFilters[i];
3464
+ const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
3441
3465
 
3442
- if (currentGlobalFilter.filterFn(row, currentGlobalFilter.id, currentGlobalFilter.resolvedValue)) {
3443
- row.columnFilterMap.__global__ = true;
3466
+ if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
3467
+ row.columnFiltersMeta[id] = filterMeta;
3468
+ })) {
3469
+ row.columnFilters.__global__ = true;
3444
3470
  break;
3445
3471
  }
3446
3472
  }
3447
3473
 
3448
- if (row.columnFilterMap.__global__ !== true) {
3449
- row.columnFilterMap.__global__ = false;
3474
+ if (row.columnFilters.__global__ !== true) {
3475
+ row.columnFilters.__global__ = false;
3450
3476
  }
3451
3477
  }
3452
3478
  }
@@ -3454,7 +3480,7 @@
3454
3480
  const filterRowsImpl = row => {
3455
3481
  // Horizontally filter rows through each column
3456
3482
  for (let i = 0; i < filterableIds.length; i++) {
3457
- if (row.columnFilterMap[filterableIds[i]] === false) {
3483
+ if (row.columnFilters[filterableIds[i]] === false) {
3458
3484
  return false;
3459
3485
  }
3460
3486
  }
@@ -3488,7 +3514,7 @@
3488
3514
  const filterRowsImpl = row => {
3489
3515
  // Horizontally filter rows through each column
3490
3516
  for (let i = 0; i < filterableIds.length; i++) {
3491
- if (row.columnFilterMap[filterableIds[i]] === false) {
3517
+ if (row.columnFilters[filterableIds[i]] === false) {
3492
3518
  return false;
3493
3519
  }
3494
3520
  }
@@ -3588,8 +3614,8 @@
3588
3614
  availableSorting.forEach(sortEntry => {
3589
3615
  const column = instance.getColumn(sortEntry.id);
3590
3616
  columnInfoById[sortEntry.id] = {
3591
- sortUndefined: column.sortUndefined,
3592
- invertSorting: column.invertSorting,
3617
+ sortUndefined: column.columnDef.sortUndefined,
3618
+ invertSorting: column.columnDef.invertSorting,
3593
3619
  sortingFn: column.getSortingFn()
3594
3620
  };
3595
3621
  });
@@ -3737,8 +3763,8 @@
3737
3763
  row.groupingValuesCache[columnId] = aggregateFn(() => leafRows.map(row => {
3738
3764
  let columnValue = row.getValue(columnId);
3739
3765
 
3740
- if (!depth && column.aggregateValue) {
3741
- columnValue = column.aggregateValue(columnValue);
3766
+ if (!depth && column.columnDef.aggregateValue) {
3767
+ columnValue = column.columnDef.aggregateValue(columnValue);
3742
3768
  }
3743
3769
 
3744
3770
  return columnValue;
@@ -3907,11 +3933,13 @@
3907
3933
  exports.RowSelection = RowSelection;
3908
3934
  exports.Sorting = Sorting;
3909
3935
  exports.Visibility = Visibility;
3936
+ exports.aggregationFns = aggregationFns;
3910
3937
  exports.buildHeaderGroups = buildHeaderGroups;
3911
3938
  exports.createTableFactory = createTableFactory;
3912
3939
  exports.createTableInstance = createTableInstance;
3913
3940
  exports.defaultColumnSizing = defaultColumnSizing;
3914
3941
  exports.expandRows = expandRows;
3942
+ exports.filterFns = filterFns;
3915
3943
  exports.flattenBy = flattenBy;
3916
3944
  exports.functionalUpdate = functionalUpdate;
3917
3945
  exports.getCoreRowModel = getCoreRowModel;
@@ -3926,12 +3954,15 @@
3926
3954
  exports.isFunction = isFunction;
3927
3955
  exports.isRowSelected = isRowSelected;
3928
3956
  exports.makeStateUpdater = makeStateUpdater;
3957
+ exports.mean = mean;
3929
3958
  exports.memo = memo;
3930
3959
  exports.noop = noop;
3931
3960
  exports.orderColumns = orderColumns;
3932
3961
  exports.passiveEventSupported = passiveEventSupported;
3962
+ exports.reSplitAlphaNumeric = reSplitAlphaNumeric;
3933
3963
  exports.selectRowsFn = selectRowsFn;
3934
3964
  exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter;
3965
+ exports.sortingFns = sortingFns;
3935
3966
 
3936
3967
  Object.defineProperty(exports, '__esModule', { value: true });
3937
3968