@tanstack/table-core 8.0.0-alpha.80 → 8.0.0-alpha.84

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 (110) hide show
  1. package/build/cjs/core/cell.js +38 -0
  2. package/build/cjs/core/cell.js.map +1 -0
  3. package/build/cjs/core/column.js +88 -0
  4. package/build/cjs/core/column.js.map +1 -0
  5. package/build/cjs/{features/Headers.js → core/headers.js} +54 -66
  6. package/build/cjs/core/headers.js.map +1 -0
  7. package/build/cjs/core/instance.js +255 -0
  8. package/build/cjs/core/instance.js.map +1 -0
  9. package/build/cjs/core/row.js +77 -0
  10. package/build/cjs/core/row.js.map +1 -0
  11. package/build/cjs/createTable.js +4 -2
  12. package/build/cjs/createTable.js.map +1 -1
  13. package/build/cjs/features/ColumnSizing.js +5 -5
  14. package/build/cjs/features/ColumnSizing.js.map +1 -1
  15. package/build/cjs/features/Expanding.js.map +1 -1
  16. package/build/cjs/features/Filters.js +12 -7
  17. package/build/cjs/features/Filters.js.map +1 -1
  18. package/build/cjs/features/Grouping.js +5 -5
  19. package/build/cjs/features/Grouping.js.map +1 -1
  20. package/build/cjs/features/Ordering.js.map +1 -1
  21. package/build/cjs/features/Pagination.js.map +1 -1
  22. package/build/cjs/features/Pinning.js +17 -11
  23. package/build/cjs/features/Pinning.js.map +1 -1
  24. package/build/cjs/features/RowSelection.js.map +1 -1
  25. package/build/cjs/features/Sorting.js +9 -9
  26. package/build/cjs/features/Sorting.js.map +1 -1
  27. package/build/cjs/features/Visibility.js +3 -3
  28. package/build/cjs/features/Visibility.js.map +1 -1
  29. package/build/cjs/index.js +17 -5
  30. package/build/cjs/index.js.map +1 -1
  31. package/build/cjs/utils/filterRowsUtils.js +23 -21
  32. package/build/cjs/utils/filterRowsUtils.js.map +1 -1
  33. package/build/cjs/utils/getCoreRowModel.js +9 -8
  34. package/build/cjs/utils/getCoreRowModel.js.map +1 -1
  35. package/build/cjs/utils/getFacetedRowModel.js +1 -1
  36. package/build/cjs/utils/getFacetedRowModel.js.map +1 -1
  37. package/build/cjs/utils/getFilteredRowModel.js +20 -9
  38. package/build/cjs/utils/getFilteredRowModel.js.map +1 -1
  39. package/build/cjs/utils/getGroupedRowModel.js +14 -13
  40. package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
  41. package/build/cjs/utils/getSortedRowModel.js +2 -2
  42. package/build/cjs/utils/getSortedRowModel.js.map +1 -1
  43. package/build/esm/index.js +731 -810
  44. package/build/esm/index.js.map +1 -1
  45. package/build/stats-html.html +1 -1
  46. package/build/stats-react.json +418 -377
  47. package/build/types/core/cell.d.ts +9 -0
  48. package/build/types/{features/Columns.d.ts → core/column.d.ts} +3 -17
  49. package/build/types/{features/Headers.d.ts → core/headers.d.ts} +26 -11
  50. package/build/types/core/instance.d.ts +57 -0
  51. package/build/types/core/row.d.ts +15 -0
  52. package/build/types/createTable.d.ts +8 -5
  53. package/build/types/features/ColumnSizing.d.ts +2 -1
  54. package/build/types/features/Expanding.d.ts +2 -1
  55. package/build/types/features/Filters.d.ts +5 -3
  56. package/build/types/features/Grouping.d.ts +3 -2
  57. package/build/types/features/Ordering.d.ts +2 -1
  58. package/build/types/features/Pagination.d.ts +2 -1
  59. package/build/types/features/Pinning.d.ts +3 -2
  60. package/build/types/features/RowSelection.d.ts +2 -1
  61. package/build/types/features/Sorting.d.ts +2 -1
  62. package/build/types/features/Visibility.d.ts +2 -1
  63. package/build/types/index.d.ts +7 -2
  64. package/build/types/sortingFns.d.ts +4 -4
  65. package/build/types/types.d.ts +13 -53
  66. package/build/umd/index.development.js +738 -806
  67. package/build/umd/index.development.js.map +1 -1
  68. package/build/umd/index.production.js +1 -1
  69. package/build/umd/index.production.js.map +1 -1
  70. package/package.json +1 -1
  71. package/src/core/cell.ts +47 -0
  72. package/src/core/column.ts +148 -0
  73. package/src/{features/Headers.ts → core/headers.ts} +98 -99
  74. package/src/core/instance.ts +361 -0
  75. package/src/core/row.ts +85 -0
  76. package/src/createTable.ts +14 -7
  77. package/src/features/ColumnSizing.ts +6 -6
  78. package/src/features/Expanding.ts +1 -2
  79. package/src/features/Filters.ts +20 -8
  80. package/src/features/Grouping.ts +7 -6
  81. package/src/features/Ordering.ts +1 -1
  82. package/src/features/Pagination.ts +1 -1
  83. package/src/features/Pinning.ts +18 -9
  84. package/src/features/RowSelection.ts +1 -1
  85. package/src/features/Sorting.ts +11 -11
  86. package/src/features/Visibility.ts +3 -3
  87. package/src/index.ts +7 -8
  88. package/src/types.ts +17 -64
  89. package/src/utils/filterRowsUtils.ts +5 -3
  90. package/src/utils/getCoreRowModel.ts +4 -2
  91. package/src/utils/getFacetedRowModel.ts +1 -1
  92. package/src/utils/getFilteredRowModel.ts +24 -13
  93. package/src/utils/getGroupedRowModel.ts +9 -8
  94. package/src/utils/getSortedRowModel.ts +2 -2
  95. package/build/cjs/core.js +0 -168
  96. package/build/cjs/core.js.map +0 -1
  97. package/build/cjs/features/Cells.js +0 -101
  98. package/build/cjs/features/Cells.js.map +0 -1
  99. package/build/cjs/features/Columns.js +0 -189
  100. package/build/cjs/features/Columns.js.map +0 -1
  101. package/build/cjs/features/Headers.js.map +0 -1
  102. package/build/cjs/features/Rows.js +0 -94
  103. package/build/cjs/features/Rows.js.map +0 -1
  104. package/build/types/core.d.ts +0 -30
  105. package/build/types/features/Cells.d.ts +0 -13
  106. package/build/types/features/Rows.d.ts +0 -28
  107. package/src/core.ts +0 -246
  108. package/src/features/Cells.ts +0 -128
  109. package/src/features/Columns.ts +0 -289
  110. package/src/features/Rows.ts +0 -142
@@ -91,327 +91,457 @@
91
91
  };
92
92
  }
93
93
 
94
+ function createColumn(instance, columnDef, depth, parent) {
95
+ var _ref, _columnDef$id;
96
+
97
+ const defaultColumn = instance._getDefaultColumnDef();
98
+
99
+ columnDef = { ...defaultColumn,
100
+ ...columnDef
101
+ };
102
+ let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
103
+ let accessorFn;
104
+
105
+ if (columnDef.accessorFn) {
106
+ accessorFn = columnDef.accessorFn;
107
+ } else if (columnDef.accessorKey) {
108
+ accessorFn = originalRow => originalRow[columnDef.accessorKey];
109
+ }
110
+
111
+ if (!id) {
112
+ {
113
+ throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
114
+ }
115
+ }
116
+
117
+ let column = { ...columnDef,
118
+ id: "" + id,
119
+ accessorFn,
120
+ parent: parent,
121
+ depth,
122
+ columnDef,
123
+ columnDefType: columnDef.columnDefType,
124
+ columns: [],
125
+ getFlatColumns: memo(() => [true], () => {
126
+ var _column$columns;
127
+
128
+ return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
129
+ }, {
130
+ key: "development" === 'production' ,
131
+ debug: () => {
132
+ var _instance$options$deb;
133
+
134
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
135
+ }
136
+ }),
137
+ getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
138
+ var _column$columns2;
139
+
140
+ if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
141
+ let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
142
+ return orderColumns(leafColumns);
143
+ }
144
+
145
+ return [column];
146
+ }, {
147
+ key: "development" === 'production' ,
148
+ debug: () => {
149
+ var _instance$options$deb2;
150
+
151
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
152
+ }
153
+ })
154
+ };
155
+ column = instance._features.reduce((obj, feature) => {
156
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
157
+ }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
158
+
159
+ return column;
160
+ }
161
+
94
162
  //
95
- const Columns = {
163
+ function createHeader(instance, column, options) {
164
+ var _options$id;
165
+
166
+ const id = (_options$id = options.id) != null ? _options$id : column.id;
167
+ let header = {
168
+ id,
169
+ column,
170
+ index: options.index,
171
+ isPlaceholder: !!options.isPlaceholder,
172
+ placeholderId: options.placeholderId,
173
+ depth: options.depth,
174
+ subHeaders: [],
175
+ colSpan: 0,
176
+ rowSpan: 0,
177
+ headerGroup: null,
178
+ getLeafHeaders: () => {
179
+ const leafHeaders = [];
180
+
181
+ const recurseHeader = h => {
182
+ if (h.subHeaders && h.subHeaders.length) {
183
+ h.subHeaders.map(recurseHeader);
184
+ }
185
+
186
+ leafHeaders.push(h);
187
+ };
188
+
189
+ recurseHeader(header);
190
+ return leafHeaders;
191
+ },
192
+ renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
193
+ instance,
194
+ header: header,
195
+ column
196
+ }) : null,
197
+ renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
198
+ instance,
199
+ header: header,
200
+ column
201
+ }) : null
202
+ };
203
+
204
+ instance._features.forEach(feature => {
205
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
206
+ });
207
+
208
+ return header;
209
+ }
210
+
211
+ const Headers = {
96
212
  createInstance: instance => {
97
213
  return {
98
- getDefaultColumn: memo(() => [instance.options.defaultColumn], defaultColumn => {
99
- var _defaultColumn;
100
-
101
- defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
102
- return {
103
- header: props => props.header.column.id,
104
- footer: props => props.header.column.id,
105
- cell: props => {
106
- var _props$getValue$toStr, _props$getValue$toStr2, _props$getValue;
107
-
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
- },
110
- ...instance._features.reduce((obj, feature) => {
111
- return Object.assign(obj, feature.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
112
- }, {}),
113
- ...defaultColumn
114
- };
214
+ // Header Groups
215
+ getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
216
+ var _left$map$filter, _right$map$filter;
217
+
218
+ const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
219
+ const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
220
+ const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
221
+ const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
222
+ return headerGroups;
115
223
  }, {
224
+ key: 'getHeaderGroups',
116
225
  debug: () => {
117
226
  var _instance$options$deb;
118
227
 
119
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
120
- },
121
- key: 'getDefaultColumn'
122
- }),
123
- getColumnDefs: () => instance.options.columns,
124
- createColumn: (columnDef, depth, parent) => {
125
- var _ref, _columnDef$id;
126
-
127
- const defaultColumn = instance.getDefaultColumn();
128
- let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
129
- let accessorFn;
130
-
131
- if (columnDef.accessorFn) {
132
- accessorFn = columnDef.accessorFn;
133
- } else if (columnDef.accessorKey) {
134
- accessorFn = originalRow => originalRow[columnDef.accessorKey];
228
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
135
229
  }
230
+ }),
231
+ getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
232
+ leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
233
+ return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
234
+ }, {
235
+ key: 'getCenterHeaderGroups',
236
+ debug: () => {
237
+ var _instance$options$deb2;
136
238
 
137
- if (!id) {
138
- {
139
- throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
140
- }
239
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
141
240
  }
241
+ }),
242
+ getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
243
+ var _left$map$filter2;
142
244
 
143
- let column = { ...defaultColumn,
144
- ...columnDef,
145
- id: "" + id,
146
- accessorFn,
147
- parent: parent,
148
- depth,
149
- columnDef,
150
- columnDefType: columnDef.columnDefType,
151
- columns: [],
152
- getFlatColumns: memo(() => [true], () => {
153
- var _column$columns;
154
-
155
- return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
156
- }, {
157
- key: "development" === 'production' ,
158
- debug: () => {
159
- var _instance$options$deb2;
160
-
161
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
162
- }
163
- }),
164
- getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
165
- var _column$columns2;
166
-
167
- if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
168
- let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
169
- return orderColumns(leafColumns);
170
- }
171
-
172
- return [column];
173
- }, {
174
- key: "development" === 'production' ,
175
- debug: () => {
176
- var _instance$options$deb3;
177
-
178
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
179
- }
180
- })
181
- };
182
- column = instance._features.reduce((obj, feature) => {
183
- return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
184
- }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
185
-
186
- return column;
187
- },
188
- getAllColumns: memo(() => [instance.getColumnDefs()], columnDefs => {
189
- const recurseColumns = function (columnDefs, parent, depth) {
190
- if (depth === void 0) {
191
- depth = 0;
192
- }
245
+ const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
246
+ return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
247
+ }, {
248
+ key: 'getLeftHeaderGroups',
249
+ debug: () => {
250
+ var _instance$options$deb3;
193
251
 
194
- return columnDefs.map(columnDef => {
195
- const column = instance.createColumn(columnDef, depth, parent);
196
- column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
197
- return column;
198
- });
199
- };
252
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
253
+ }
254
+ }),
255
+ getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
256
+ var _right$map$filter2;
200
257
 
201
- return recurseColumns(columnDefs);
258
+ const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
259
+ return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
202
260
  }, {
203
- key: 'getAllColumns',
261
+ key: 'getRightHeaderGroups',
204
262
  debug: () => {
205
263
  var _instance$options$deb4;
206
264
 
207
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
265
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
208
266
  }
209
267
  }),
210
- getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
211
- return allColumns.flatMap(column => {
212
- return column.getFlatColumns();
213
- });
268
+ // Footer Groups
269
+ getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
270
+ return [...headerGroups].reverse();
214
271
  }, {
215
- key: 'getAllFlatColumns',
272
+ key: 'getFooterGroups',
216
273
  debug: () => {
217
274
  var _instance$options$deb5;
218
275
 
219
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
276
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
220
277
  }
221
278
  }),
222
- getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
223
- return flatColumns.reduce((acc, column) => {
224
- acc[column.id] = column;
225
- return acc;
226
- }, {});
279
+ getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
280
+ return [...headerGroups].reverse();
227
281
  }, {
228
- key: 'getAllFlatColumnsById',
282
+ key: 'getLeftFooterGroups',
229
283
  debug: () => {
230
284
  var _instance$options$deb6;
231
285
 
232
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
286
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
233
287
  }
234
288
  }),
235
- getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
236
- let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
237
- return orderColumns(leafColumns);
289
+ getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
290
+ return [...headerGroups].reverse();
238
291
  }, {
239
- key: 'getAllLeafColumns',
292
+ key: 'getCenterFooterGroups',
240
293
  debug: () => {
241
294
  var _instance$options$deb7;
242
295
 
243
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
296
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
244
297
  }
245
298
  }),
246
- getColumn: columnId => {
247
- const column = instance.getAllFlatColumnsById()[columnId];
248
-
249
- if (!column) {
250
- {
251
- console.warn("[Table] Column with id " + columnId + " does not exist.");
252
- }
299
+ getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
300
+ return [...headerGroups].reverse();
301
+ }, {
302
+ key: 'getRightFooterGroups',
303
+ debug: () => {
304
+ var _instance$options$deb8;
253
305
 
254
- throw new Error();
306
+ return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
255
307
  }
308
+ }),
309
+ // Flat Headers
310
+ getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
311
+ return headerGroups.map(headerGroup => {
312
+ return headerGroup.headers;
313
+ }).flat();
314
+ }, {
315
+ key: 'getFlatHeaders',
316
+ debug: () => {
317
+ var _instance$options$deb9;
256
318
 
257
- return column;
258
- }
259
- };
260
- }
261
- };
262
-
263
- //
264
- const Rows = {
265
- // createRow: <TGenerics extends TableGenerics>(
266
- // row: Row<TGenerics>,
267
- // instance: TableInstance<TGenerics>
268
- // ): CellsRow<TGenerics> => {
269
- // return {}
270
- // },
271
- createInstance: instance => {
272
- return {
273
- getRowId: (row, index, parent) => {
274
- var _instance$options$get;
275
-
276
- return (_instance$options$get = instance.options.getRowId == null ? void 0 : instance.options.getRowId(row, index, parent)) != null ? _instance$options$get : "" + (parent ? [parent.id, index].join('.') : index);
277
- },
278
- createRow: (id, original, rowIndex, depth, subRows) => {
279
- let row = {
280
- id,
281
- index: rowIndex,
282
- original,
283
- depth,
284
- valuesCache: {},
285
- getValue: columnId => {
286
- if (row.valuesCache.hasOwnProperty(columnId)) {
287
- return row.valuesCache[columnId];
288
- }
289
-
290
- const column = instance.getColumn(columnId);
291
-
292
- if (!column.accessorFn) {
293
- return undefined;
294
- }
295
-
296
- row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
297
- return row.valuesCache[columnId];
298
- },
299
- subRows: subRows != null ? subRows : [],
300
- getLeafRows: () => flattenBy(row.subRows, d => d.subRows)
301
- };
302
-
303
- for (let i = 0; i < instance._features.length; i++) {
304
- const feature = instance._features[i];
305
- Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
319
+ return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
306
320
  }
321
+ }),
322
+ getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
323
+ return left.map(headerGroup => {
324
+ return headerGroup.headers;
325
+ }).flat();
326
+ }, {
327
+ key: 'getLeftFlatHeaders',
328
+ debug: () => {
329
+ var _instance$options$deb10;
307
330
 
308
- return row;
309
- },
310
- getCoreRowModel: () => {
311
- if (!instance._getCoreRowModel) {
312
- instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
331
+ return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
313
332
  }
333
+ }),
334
+ getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
335
+ return left.map(headerGroup => {
336
+ return headerGroup.headers;
337
+ }).flat();
338
+ }, {
339
+ key: 'getCenterFlatHeaders',
340
+ debug: () => {
341
+ var _instance$options$deb11;
314
342
 
315
- return instance._getCoreRowModel();
316
- },
317
- // The final calls start at the bottom of the model,
318
- // expanded rows, which then work their way up
319
- getRowModel: () => {
320
- return instance.getPaginationRowModel();
321
- },
322
- getRow: id => {
323
- const row = instance.getRowModel().rowsById[id];
324
-
325
- if (!row) {
326
- {
327
- throw new Error("getRow expected an ID, but got " + id);
328
- }
343
+ return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
329
344
  }
345
+ }),
346
+ getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
347
+ return left.map(headerGroup => {
348
+ return headerGroup.headers;
349
+ }).flat();
350
+ }, {
351
+ key: 'getRightFlatHeaders',
352
+ debug: () => {
353
+ var _instance$options$deb12;
330
354
 
331
- return row;
332
- }
333
- };
334
- }
335
- };
355
+ return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
356
+ }
357
+ }),
358
+ // Leaf Headers
359
+ getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
360
+ return flatHeaders.filter(header => {
361
+ var _header$subHeaders;
336
362
 
337
- //
338
- const Cells = {
339
- createRow: (row, instance) => {
340
- return {
341
- getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
342
- return leafColumns.map(column => {
343
- return instance.createCell(row, column, column.id);
363
+ return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
344
364
  });
345
365
  }, {
346
- key: 'row.getAllCells',
366
+ key: 'getCenterLeafHeaders',
347
367
  debug: () => {
348
- var _instance$options$deb;
368
+ var _instance$options$deb13;
349
369
 
350
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
370
+ return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
351
371
  }
352
372
  }),
353
- getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
354
- return allCells.reduce((acc, cell) => {
355
- acc[cell.columnId] = cell;
356
- return acc;
357
- }, {});
373
+ getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
374
+ return flatHeaders.filter(header => {
375
+ var _header$subHeaders2;
376
+
377
+ return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
378
+ });
358
379
  }, {
359
- key: "development" === 'production' ,
380
+ key: 'getLeftLeafHeaders',
360
381
  debug: () => {
361
- var _instance$options$deb2;
382
+ var _instance$options$deb14;
362
383
 
363
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
384
+ return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
364
385
  }
365
- })
366
- };
367
- },
368
- createInstance: instance => {
369
- return {
370
- createCell: (row, column, columnId) => {
371
- const cell = {
372
- id: row.id + "_" + column.id,
373
- rowId: row.id,
374
- columnId,
375
- row,
376
- column,
377
- getValue: () => row.getValue(columnId),
378
- renderCell: () => column.cell ? instance._render(column.cell, {
379
- instance,
380
- column,
381
- row,
382
- cell: cell,
383
- getValue: cell.getValue
384
- }) : null
385
- };
386
-
387
- instance._features.forEach(feature => {
388
- Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
389
- }, {});
386
+ }),
387
+ getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
388
+ return flatHeaders.filter(header => {
389
+ var _header$subHeaders3;
390
390
 
391
- return cell;
392
- },
393
- getCell: (rowId, columnId) => {
394
- const row = instance.getRow(rowId);
391
+ return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
392
+ });
393
+ }, {
394
+ key: 'getRightLeafHeaders',
395
+ debug: () => {
396
+ var _instance$options$deb15;
395
397
 
396
- if (!row) {
397
- {
398
- throw new Error("[Table] could not find row with id " + rowId);
399
- }
398
+ return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
400
399
  }
400
+ }),
401
+ getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
402
+ var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
401
403
 
402
- const cell = row.getAllCellsByColumnId()[columnId];
404
+ return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
405
+ return header.getLeafHeaders();
406
+ }).flat();
407
+ }, {
408
+ key: 'getLeafHeaders',
409
+ debug: () => {
410
+ var _instance$options$deb16;
403
411
 
404
- if (!cell) {
405
- {
406
- throw new Error("[Table] could not find cell " + columnId + " in row " + rowId);
407
- }
412
+ return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
408
413
  }
409
-
410
- return cell;
411
- }
414
+ })
412
415
  };
413
416
  }
414
417
  };
418
+ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
419
+ var _headerGroups$0$heade, _headerGroups$;
420
+
421
+ // Find the max depth of the columns:
422
+ // build the leaf column row
423
+ // build each buffer row going up
424
+ // placeholder for non-existent level
425
+ // real column for existing level
426
+ let maxDepth = 0;
427
+
428
+ const findMaxDepth = function (columns, depth) {
429
+ if (depth === void 0) {
430
+ depth = 1;
431
+ }
432
+
433
+ maxDepth = Math.max(maxDepth, depth);
434
+ columns.filter(column => column.getIsVisible()).forEach(column => {
435
+ var _column$columns;
436
+
437
+ if ((_column$columns = column.columns) != null && _column$columns.length) {
438
+ findMaxDepth(column.columns, depth + 1);
439
+ }
440
+ }, 0);
441
+ };
442
+
443
+ findMaxDepth(allColumns);
444
+ let headerGroups = [];
445
+
446
+ const createHeaderGroup = (headersToGroup, depth) => {
447
+ // The header group we are creating
448
+ const headerGroup = {
449
+ depth,
450
+ id: [headerFamily, "" + depth].filter(Boolean).join('_'),
451
+ headers: []
452
+ }; // The parent columns we're going to scan next
453
+
454
+ const pendingParentHeaders = []; // Scan each column for parents
455
+
456
+ headersToGroup.forEach(headerToGroup => {
457
+ // What is the latest (last) parent column?
458
+ const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
459
+ const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
460
+ let column;
461
+ let isPlaceholder = false;
462
+
463
+ if (isLeafHeader && headerToGroup.column.parent) {
464
+ // The parent header is new
465
+ column = headerToGroup.column.parent;
466
+ } else {
467
+ // The parent header is repeated
468
+ column = headerToGroup.column;
469
+ isPlaceholder = true;
470
+ }
471
+
472
+ if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
473
+ // This column is repeated. Add it as a sub header to the next batch
474
+ latestPendingParentHeader.subHeaders.push(headerToGroup);
475
+ } else {
476
+ // This is a new header. Let's create it
477
+ const header = createHeader(instance, column, {
478
+ id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
479
+ isPlaceholder,
480
+ placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
481
+ depth,
482
+ index: pendingParentHeaders.length
483
+ }); // Add the headerToGroup as a subHeader of the new header
484
+
485
+ header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
486
+ // in the next batch
487
+
488
+ pendingParentHeaders.push(header);
489
+ }
490
+
491
+ headerGroup.headers.push(headerToGroup);
492
+ headerToGroup.headerGroup = headerGroup;
493
+ });
494
+ headerGroups.push(headerGroup);
495
+
496
+ if (depth > 0) {
497
+ createHeaderGroup(pendingParentHeaders, depth - 1);
498
+ }
499
+ };
500
+
501
+ const bottomHeaders = columnsToGroup.map((column, index) => createHeader(instance, column, {
502
+ depth: maxDepth,
503
+ index
504
+ }));
505
+ createHeaderGroup(bottomHeaders, maxDepth - 1);
506
+ headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
507
+ // return !headerGroup.headers.every(header => header.isPlaceholder)
508
+ // })
509
+
510
+ const recurseHeadersForSpans = headers => {
511
+ const filteredHeaders = headers.filter(header => header.column.getIsVisible());
512
+ return filteredHeaders.map(header => {
513
+ let colSpan = 0;
514
+ let rowSpan = 0;
515
+ let childRowSpans = [0];
516
+
517
+ if (header.subHeaders && header.subHeaders.length) {
518
+ childRowSpans = [];
519
+ recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
520
+ let {
521
+ colSpan: childColSpan,
522
+ rowSpan: childRowSpan
523
+ } = _ref;
524
+ colSpan += childColSpan;
525
+ childRowSpans.push(childRowSpan);
526
+ });
527
+ } else {
528
+ colSpan = 1;
529
+ }
530
+
531
+ const minChildRowSpan = Math.min(...childRowSpans);
532
+ rowSpan = rowSpan + minChildRowSpan;
533
+ header.colSpan = colSpan;
534
+ header.rowSpan = rowSpan;
535
+ return {
536
+ colSpan,
537
+ rowSpan
538
+ };
539
+ });
540
+ };
541
+
542
+ recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
543
+ return headerGroups;
544
+ }
415
545
 
416
546
  //
417
547
  const defaultColumnSizing = {
@@ -430,7 +560,7 @@
430
560
  });
431
561
 
432
562
  const ColumnSizing = {
433
- getDefaultColumn: () => {
563
+ getDefaultColumnDef: () => {
434
564
  return defaultColumnSizing;
435
565
  },
436
566
  getInitialState: state => {
@@ -450,10 +580,10 @@
450
580
  createColumn: (column, instance) => {
451
581
  return {
452
582
  getSize: () => {
453
- var _column$minSize, _ref, _column$maxSize;
583
+ var _column$columnDef$min, _ref, _column$columnDef$max;
454
584
 
455
585
  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);
586
+ 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
587
  },
458
588
  getStart: position => {
459
589
  const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
@@ -476,9 +606,9 @@
476
606
  });
477
607
  },
478
608
  getCanResize: () => {
479
- var _column$enableResizin, _instance$options$ena;
609
+ var _column$columnDef$ena, _instance$options$ena;
480
610
 
481
- return ((_column$enableResizin = column.enableResizing) != null ? _column$enableResizin : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
611
+ return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
482
612
  },
483
613
  getIsResizing: () => {
484
614
  return instance.getState().columnSizingInfo.isResizingColumn === column.id;
@@ -935,7 +1065,7 @@
935
1065
 
936
1066
  //
937
1067
  const Filters = {
938
- getDefaultColumn: () => {
1068
+ getDefaultColumnDef: () => {
939
1069
  return {
940
1070
  filterFn: 'auto'
941
1071
  };
@@ -958,7 +1088,7 @@
958
1088
  getColumnCanGlobalFilter: column => {
959
1089
  var _instance$getCoreRowM, _instance$getCoreRowM2;
960
1090
 
961
- const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM.getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
1091
+ const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM._getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
962
1092
  return typeof value === 'string';
963
1093
  }
964
1094
  };
@@ -978,6 +1108,10 @@
978
1108
  return filterFns.inNumberRange;
979
1109
  }
980
1110
 
1111
+ if (typeof value === 'boolean') {
1112
+ return filterFns.equals;
1113
+ }
1114
+
981
1115
  if (value !== null && typeof value === 'object') {
982
1116
  return filterFns.equals;
983
1117
  }
@@ -995,14 +1129,14 @@
995
1129
  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
1130
  },
997
1131
  getCanFilter: () => {
998
- var _column$enableColumnF, _instance$options$ena, _instance$options$ena2;
1132
+ var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
999
1133
 
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;
1134
+ 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
1135
  },
1002
1136
  getCanGlobalFilter: () => {
1003
- var _column$enableGlobalF, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1137
+ var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
1004
1138
 
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;
1139
+ 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
1140
  },
1007
1141
  getIsFiltered: () => column.getFilterIndex() > -1,
1008
1142
  getFilterValue: () => {
@@ -1081,7 +1215,8 @@
1081
1215
  },
1082
1216
  createRow: (row, instance) => {
1083
1217
  return {
1084
- columnFilterMap: {},
1218
+ columnFilters: {},
1219
+ columnFiltersMeta: {},
1085
1220
  subRowsByFacetId: {}
1086
1221
  };
1087
1222
  },
@@ -1279,7 +1414,7 @@
1279
1414
 
1280
1415
  //
1281
1416
  const Grouping = {
1282
- getDefaultColumn: () => {
1417
+ getDefaultColumnDef: () => {
1283
1418
  return {
1284
1419
  aggregationFn: 'auto'
1285
1420
  };
@@ -1309,9 +1444,9 @@
1309
1444
  });
1310
1445
  },
1311
1446
  getCanGroup: () => {
1312
- var _ref, _ref2, _ref3, _column$enableGroupin;
1447
+ var _ref, _ref2, _ref3, _column$columnDef$ena;
1313
1448
 
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;
1449
+ 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
1450
  },
1316
1451
  getIsGrouped: () => {
1317
1452
  var _instance$getState$gr;
@@ -1395,9 +1530,9 @@
1395
1530
  return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
1396
1531
  },
1397
1532
  renderAggregatedCell: () => {
1398
- var _column$aggregatedCel;
1533
+ var _column$columnDef$agg;
1399
1534
 
1400
- const template = (_column$aggregatedCel = column.aggregatedCell) != null ? _column$aggregatedCel : column.cell;
1535
+ const template = (_column$columnDef$agg = column.columnDef.aggregatedCell) != null ? _column$columnDef$agg : column.columnDef.cell;
1401
1536
  return template ? instance._render(template, {
1402
1537
  instance,
1403
1538
  column,
@@ -1704,9 +1839,9 @@
1704
1839
  getCanPin: () => {
1705
1840
  const leafColumns = column.getLeafColumns();
1706
1841
  return leafColumns.some(d => {
1707
- var _d$enablePinning, _instance$options$ena;
1842
+ var _d$columnDef$enablePi, _instance$options$ena;
1708
1843
 
1709
- return ((_d$enablePinning = d.enablePinning) != null ? _d$enablePinning : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1844
+ return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
1710
1845
  });
1711
1846
  },
1712
1847
  getIsPinned: () => {
@@ -1731,7 +1866,7 @@
1731
1866
  return {
1732
1867
  getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allCells, left, right) => {
1733
1868
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1734
- return allCells.filter(d => !leftAndRight.includes(d.columnId));
1869
+ return allCells.filter(d => !leftAndRight.includes(d.column.id));
1735
1870
  }, {
1736
1871
  key: "development" === 'production' ,
1737
1872
  debug: () => {
@@ -1741,7 +1876,7 @@
1741
1876
  }
1742
1877
  }),
1743
1878
  getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left,,], (allCells, left) => {
1744
- const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.columnId === columnId)).filter(Boolean).map(d => ({ ...d,
1879
+ const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1745
1880
  position: 'left'
1746
1881
  }));
1747
1882
  return cells;
@@ -1754,7 +1889,7 @@
1754
1889
  }
1755
1890
  }),
1756
1891
  getRightVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.right], (allCells, right) => {
1757
- const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.columnId === columnId)).filter(Boolean).map(d => ({ ...d,
1892
+ const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1758
1893
  position: 'left'
1759
1894
  }));
1760
1895
  return cells;
@@ -1776,12 +1911,18 @@
1776
1911
 
1777
1912
  return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
1778
1913
  },
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));
1914
+ getIsSomeColumnsPinned: position => {
1915
+ var _pinningState$positio;
1916
+
1917
+ const pinningState = instance.getState().columnPinning;
1918
+
1919
+ if (!position) {
1920
+ var _pinningState$left, _pinningState$right;
1921
+
1922
+ return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
1923
+ }
1924
+
1925
+ return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
1785
1926
  },
1786
1927
  getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
1787
1928
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
@@ -2307,7 +2448,7 @@
2307
2448
  ...state
2308
2449
  };
2309
2450
  },
2310
- getDefaultColumn: () => {
2451
+ getDefaultColumnDef: () => {
2311
2452
  return {
2312
2453
  sortingFn: 'auto'
2313
2454
  };
@@ -2323,7 +2464,7 @@
2323
2464
  createColumn: (column, instance) => {
2324
2465
  return {
2325
2466
  getAutoSortingFn: () => {
2326
- const firstRows = instance.getFilteredRowModel().flatRows.slice(100);
2467
+ const firstRows = instance.getFilteredRowModel().flatRows.slice(10);
2327
2468
  let isString = false;
2328
2469
 
2329
2470
  for (const row of firstRows) {
@@ -2367,7 +2508,7 @@
2367
2508
  throw new Error();
2368
2509
  }
2369
2510
 
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];
2511
+ 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
2512
  },
2372
2513
  toggleSorting: (desc, multi) => {
2373
2514
  // if (column.columns.length) {
@@ -2379,7 +2520,7 @@
2379
2520
  // return
2380
2521
  // }
2381
2522
  instance.setSorting(old => {
2382
- var _ref2, _column$sortDescFirst, _instance$options$ena, _instance$options$ena2;
2523
+ var _ref2, _column$columnDef$sor, _instance$options$ena, _instance$options$ena2;
2383
2524
 
2384
2525
  // Find any existing sorting for this column
2385
2526
  const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
@@ -2406,7 +2547,7 @@
2406
2547
  }
2407
2548
  }
2408
2549
 
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
2550
+ 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
2551
 
2411
2552
  if (sortAction === 'toggle' && ( // Must be toggling
2412
2553
  (_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
@@ -2450,14 +2591,14 @@
2450
2591
  });
2451
2592
  },
2452
2593
  getCanSort: () => {
2453
- var _column$enableSorting, _instance$options$ena3;
2594
+ var _column$columnDef$ena, _instance$options$ena3;
2454
2595
 
2455
- return ((_column$enableSorting = column.enableSorting) != null ? _column$enableSorting : true) && ((_instance$options$ena3 = instance.options.enableSorting) != null ? _instance$options$ena3 : true) && !!column.accessorFn;
2596
+ 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
2597
  },
2457
2598
  getCanMultiSort: () => {
2458
- var _ref3, _column$enableMultiSo;
2599
+ var _ref3, _column$columnDef$ena2;
2459
2600
 
2460
- return (_ref3 = (_column$enableMultiSo = column.enableMultiSort) != null ? _column$enableMultiSo : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2601
+ return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
2461
2602
  },
2462
2603
  getIsSorted: () => {
2463
2604
  var _instance$getState$so;
@@ -2521,7 +2662,7 @@
2521
2662
  onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
2522
2663
  };
2523
2664
  },
2524
- getDefaultColumn: () => {
2665
+ getDefaultColumnDef: () => {
2525
2666
  return {
2526
2667
  defaultIsVisible: true
2527
2668
  };
@@ -2541,9 +2682,9 @@
2541
2682
  return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
2542
2683
  },
2543
2684
  getCanHide: () => {
2544
- var _column$enableHiding, _instance$options$ena;
2685
+ var _column$columnDef$ena, _instance$options$ena;
2545
2686
 
2546
- return ((_column$enableHiding = column.enableHiding) != null ? _column$enableHiding : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2687
+ return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
2547
2688
  },
2548
2689
  getToggleVisibilityHandler: () => {
2549
2690
  return e => {
@@ -2559,475 +2700,70 @@
2559
2700
  }, {
2560
2701
  key: "development" === 'production' ,
2561
2702
  debug: () => {
2562
- var _instance$options$deb;
2563
-
2564
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2565
- }
2566
- }),
2567
- getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2568
- key: 'row.getVisibleCells',
2569
- debug: () => {
2570
- var _instance$options$deb2;
2571
-
2572
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2573
- }
2574
- })
2575
- };
2576
- },
2577
- createInstance: instance => {
2578
- const makeVisibleColumnsMethod = (key, getColumns) => {
2579
- return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2580
- return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2581
- }, {
2582
- key,
2583
- debug: () => {
2584
- var _instance$options$deb3;
2585
-
2586
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2587
- }
2588
- });
2589
- };
2590
-
2591
- return {
2592
- getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2593
- getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2594
- getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2595
- getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2596
- getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2597
- setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2598
- resetColumnVisibility: defaultState => {
2599
- var _instance$initialStat;
2600
-
2601
- instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2602
- },
2603
- toggleAllColumnsVisible: value => {
2604
- var _value;
2605
-
2606
- value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2607
- instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2608
- [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2609
- }), {}));
2610
- },
2611
- getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2612
- getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2613
- getToggleAllColumnsVisibilityHandler: () => {
2614
- return e => {
2615
- var _target;
2616
-
2617
- instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2618
- };
2619
- }
2620
- };
2621
- }
2622
- };
2623
-
2624
- //
2625
- const Headers = {
2626
- createInstance: instance => {
2627
- return {
2628
- createHeader: (column, options) => {
2629
- var _options$id;
2630
-
2631
- const id = (_options$id = options.id) != null ? _options$id : column.id;
2632
- let header = {
2633
- id,
2634
- column,
2635
- index: options.index,
2636
- isPlaceholder: options.isPlaceholder,
2637
- placeholderId: options.placeholderId,
2638
- depth: options.depth,
2639
- subHeaders: [],
2640
- colSpan: 0,
2641
- rowSpan: 0,
2642
- headerGroup: null,
2643
- getLeafHeaders: () => {
2644
- const leafHeaders = [];
2645
-
2646
- const recurseHeader = h => {
2647
- if (h.subHeaders && h.subHeaders.length) {
2648
- h.subHeaders.map(recurseHeader);
2649
- }
2650
-
2651
- leafHeaders.push(h);
2652
- };
2653
-
2654
- recurseHeader(header);
2655
- return leafHeaders;
2656
- },
2657
- renderHeader: () => column.header ? instance._render(column.header, {
2658
- instance,
2659
- header: header,
2660
- column
2661
- }) : null,
2662
- renderFooter: () => column.footer ? instance._render(column.footer, {
2663
- instance,
2664
- header: header,
2665
- column
2666
- }) : null
2667
- };
2668
-
2669
- instance._features.forEach(feature => {
2670
- Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
2671
- });
2672
-
2673
- return header;
2674
- },
2675
- // Header Groups
2676
- getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
2677
- var _left$map$filter, _right$map$filter;
2678
-
2679
- const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
2680
- const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
2681
- const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
2682
- const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
2683
- return headerGroups;
2684
- }, {
2685
- key: 'getHeaderGroups',
2686
- debug: () => {
2687
- var _instance$options$deb;
2688
-
2689
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
2690
- }
2691
- }),
2692
- getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
2693
- leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
2694
- return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
2695
- }, {
2696
- key: 'getCenterHeaderGroups',
2697
- debug: () => {
2698
- var _instance$options$deb2;
2699
-
2700
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
2701
- }
2702
- }),
2703
- getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
2704
- var _left$map$filter2;
2705
-
2706
- const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
2707
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
2708
- }, {
2709
- key: 'getLeftHeaderGroups',
2710
- debug: () => {
2711
- var _instance$options$deb3;
2712
-
2713
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
2714
- }
2715
- }),
2716
- getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
2717
- var _right$map$filter2;
2718
-
2719
- const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
2720
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
2721
- }, {
2722
- key: 'getRightHeaderGroups',
2723
- debug: () => {
2724
- var _instance$options$deb4;
2725
-
2726
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
2727
- }
2728
- }),
2729
- // Footer Groups
2730
- getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
2731
- return [...headerGroups].reverse();
2732
- }, {
2733
- key: 'getFooterGroups',
2734
- debug: () => {
2735
- var _instance$options$deb5;
2736
-
2737
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
2738
- }
2739
- }),
2740
- getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
2741
- return [...headerGroups].reverse();
2742
- }, {
2743
- key: 'getLeftFooterGroups',
2744
- debug: () => {
2745
- var _instance$options$deb6;
2746
-
2747
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
2748
- }
2749
- }),
2750
- getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
2751
- return [...headerGroups].reverse();
2752
- }, {
2753
- key: 'getCenterFooterGroups',
2754
- debug: () => {
2755
- var _instance$options$deb7;
2756
-
2757
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
2758
- }
2759
- }),
2760
- getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
2761
- return [...headerGroups].reverse();
2762
- }, {
2763
- key: 'getRightFooterGroups',
2764
- debug: () => {
2765
- var _instance$options$deb8;
2766
-
2767
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
2768
- }
2769
- }),
2770
- // Flat Headers
2771
- getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
2772
- return headerGroups.map(headerGroup => {
2773
- return headerGroup.headers;
2774
- }).flat();
2775
- }, {
2776
- key: 'getFlatHeaders',
2777
- debug: () => {
2778
- var _instance$options$deb9;
2779
-
2780
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
2781
- }
2782
- }),
2783
- getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
2784
- return left.map(headerGroup => {
2785
- return headerGroup.headers;
2786
- }).flat();
2787
- }, {
2788
- key: 'getLeftFlatHeaders',
2789
- debug: () => {
2790
- var _instance$options$deb10;
2791
-
2792
- return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
2793
- }
2794
- }),
2795
- getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
2796
- return left.map(headerGroup => {
2797
- return headerGroup.headers;
2798
- }).flat();
2799
- }, {
2800
- key: 'getCenterFlatHeaders',
2801
- debug: () => {
2802
- var _instance$options$deb11;
2803
-
2804
- return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
2805
- }
2806
- }),
2807
- getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
2808
- return left.map(headerGroup => {
2809
- return headerGroup.headers;
2810
- }).flat();
2811
- }, {
2812
- key: 'getRightFlatHeaders',
2813
- debug: () => {
2814
- var _instance$options$deb12;
2815
-
2816
- return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
2817
- }
2818
- }),
2819
- // Leaf Headers
2820
- getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
2821
- return flatHeaders.filter(header => {
2822
- var _header$subHeaders;
2823
-
2824
- return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
2825
- });
2826
- }, {
2827
- key: 'getCenterLeafHeaders',
2828
- debug: () => {
2829
- var _instance$options$deb13;
2830
-
2831
- return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
2832
- }
2833
- }),
2834
- getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
2835
- return flatHeaders.filter(header => {
2836
- var _header$subHeaders2;
2837
-
2838
- return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
2839
- });
2840
- }, {
2841
- key: 'getLeftLeafHeaders',
2842
- debug: () => {
2843
- var _instance$options$deb14;
2844
-
2845
- return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
2846
- }
2847
- }),
2848
- getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
2849
- return flatHeaders.filter(header => {
2850
- var _header$subHeaders3;
2851
-
2852
- return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
2853
- });
2854
- }, {
2855
- key: 'getRightLeafHeaders',
2856
- debug: () => {
2857
- var _instance$options$deb15;
2703
+ var _instance$options$deb;
2858
2704
 
2859
- return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
2705
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2860
2706
  }
2861
2707
  }),
2862
- getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
2863
- var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
2708
+ getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2709
+ key: 'row.getVisibleCells',
2710
+ debug: () => {
2711
+ var _instance$options$deb2;
2864
2712
 
2865
- return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
2866
- return header.getLeafHeaders();
2867
- }).flat();
2713
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2714
+ }
2715
+ })
2716
+ };
2717
+ },
2718
+ createInstance: instance => {
2719
+ const makeVisibleColumnsMethod = (key, getColumns) => {
2720
+ return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2721
+ return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2868
2722
  }, {
2869
- key: 'getLeafHeaders',
2723
+ key,
2870
2724
  debug: () => {
2871
- var _instance$options$deb16;
2725
+ var _instance$options$deb3;
2872
2726
 
2873
- return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
2727
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2874
2728
  }
2875
- }),
2876
- getHeader: id => {
2877
- const header = [...instance.getFlatHeaders(), ...instance.getCenterFlatHeaders(), ...instance.getLeftFlatHeaders(), ...instance.getRightFlatHeaders()].find(d => d.id === id);
2729
+ });
2730
+ };
2878
2731
 
2879
- if (!header) {
2880
- {
2881
- console.warn("Could not find header with id: " + id);
2882
- }
2732
+ return {
2733
+ getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2734
+ getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2735
+ getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2736
+ getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2737
+ getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2738
+ setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2739
+ resetColumnVisibility: defaultState => {
2740
+ var _instance$initialStat;
2883
2741
 
2884
- throw new Error();
2885
- }
2742
+ instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2743
+ },
2744
+ toggleAllColumnsVisible: value => {
2745
+ var _value;
2746
+
2747
+ value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2748
+ instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2749
+ [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2750
+ }), {}));
2751
+ },
2752
+ getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2753
+ getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2754
+ getToggleAllColumnsVisibilityHandler: () => {
2755
+ return e => {
2756
+ var _target;
2886
2757
 
2887
- return header;
2758
+ instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2759
+ };
2888
2760
  }
2889
2761
  };
2890
2762
  }
2891
2763
  };
2892
- function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
2893
- var _headerGroups$0$heade, _headerGroups$;
2894
-
2895
- // Find the max depth of the columns:
2896
- // build the leaf column row
2897
- // build each buffer row going up
2898
- // placeholder for non-existent level
2899
- // real column for existing level
2900
- let maxDepth = 0;
2901
-
2902
- const findMaxDepth = function (columns, depth) {
2903
- if (depth === void 0) {
2904
- depth = 1;
2905
- }
2906
-
2907
- maxDepth = Math.max(maxDepth, depth);
2908
- columns.filter(column => column.getIsVisible()).forEach(column => {
2909
- var _column$columns;
2910
-
2911
- if ((_column$columns = column.columns) != null && _column$columns.length) {
2912
- findMaxDepth(column.columns, depth + 1);
2913
- }
2914
- }, 0);
2915
- };
2916
-
2917
- findMaxDepth(allColumns);
2918
- let headerGroups = [];
2919
-
2920
- const createHeaderGroup = (headersToGroup, depth) => {
2921
- // The header group we are creating
2922
- const headerGroup = {
2923
- depth,
2924
- id: [headerFamily, "" + depth].filter(Boolean).join('_'),
2925
- headers: []
2926
- }; // The parent columns we're going to scan next
2927
-
2928
- const pendingParentHeaders = []; // Scan each column for parents
2929
-
2930
- headersToGroup.forEach(headerToGroup => {
2931
- // What is the latest (last) parent column?
2932
- const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
2933
- const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
2934
- let column;
2935
- let isPlaceholder = false;
2936
-
2937
- if (isLeafHeader && headerToGroup.column.parent) {
2938
- // The parent header is new
2939
- column = headerToGroup.column.parent;
2940
- } else {
2941
- // The parent header is repeated
2942
- column = headerToGroup.column;
2943
- isPlaceholder = true;
2944
- }
2945
-
2946
- if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
2947
- // This column is repeated. Add it as a sub header to the next batch
2948
- latestPendingParentHeader.subHeaders.push(headerToGroup);
2949
- } else {
2950
- // This is a new header. Let's create it
2951
- const header = instance.createHeader(column, {
2952
- id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
2953
- isPlaceholder,
2954
- placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
2955
- depth,
2956
- index: pendingParentHeaders.length
2957
- }); // Add the headerToGroup as a subHeader of the new header
2958
-
2959
- header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
2960
- // in the next batch
2961
2764
 
2962
- pendingParentHeaders.push(header);
2963
- }
2964
-
2965
- headerGroup.headers.push(headerToGroup);
2966
- headerToGroup.headerGroup = headerGroup;
2967
- });
2968
- headerGroups.push(headerGroup);
2969
-
2970
- if (depth > 0) {
2971
- createHeaderGroup(pendingParentHeaders, depth - 1);
2972
- }
2973
- };
2974
-
2975
- const bottomHeaders = columnsToGroup.map((column, index) => instance.createHeader(column, {
2976
- depth: maxDepth,
2977
- index
2978
- }));
2979
- createHeaderGroup(bottomHeaders, maxDepth - 1);
2980
- headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
2981
- // return !headerGroup.headers.every(header => header.isPlaceholder)
2982
- // })
2983
-
2984
- const recurseHeadersForSpans = headers => {
2985
- const filteredHeaders = headers.filter(header => header.column.getIsVisible());
2986
- return filteredHeaders.map(header => {
2987
- let colSpan = 0;
2988
- let rowSpan = 0;
2989
- let childRowSpans = [0];
2990
-
2991
- if (header.subHeaders && header.subHeaders.length) {
2992
- childRowSpans = [];
2993
- recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
2994
- let {
2995
- colSpan: childColSpan,
2996
- rowSpan: childRowSpan
2997
- } = _ref;
2998
- colSpan += childColSpan;
2999
- childRowSpans.push(childRowSpan);
3000
- });
3001
- } else {
3002
- colSpan = 1;
3003
- }
3004
-
3005
- const minChildRowSpan = Math.min(...childRowSpans);
3006
- rowSpan = rowSpan + minChildRowSpan;
3007
- header.colSpan = colSpan > 0 ? colSpan : undefined;
3008
- header.rowSpan = rowSpan > 0 ? rowSpan : undefined;
3009
- return {
3010
- colSpan,
3011
- rowSpan
3012
- };
3013
- });
3014
- };
3015
-
3016
- recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
3017
- return headerGroups;
3018
- }
2765
+ const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
3019
2766
 
3020
- // export type Batch = {
3021
- // id: number
3022
- // priority: keyof CoreBatches
3023
- // tasks: (() => void)[]
3024
- // schedule: (cb: () => void) => void
3025
- // cancel: () => void
3026
- // }
3027
- // type CoreBatches = {
3028
- // data: Batch[]
3029
- // facets: Batch[]
3030
- // }
3031
2767
  function createTableInstance(options) {
3032
2768
  var _options$initialState;
3033
2769
 
@@ -3036,7 +2772,7 @@
3036
2772
  }
3037
2773
 
3038
2774
  let instance = {
3039
- _features: [Columns, Rows, Cells, Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]
2775
+ _features: features
3040
2776
  };
3041
2777
 
3042
2778
  const defaultOptions = instance._features.reduce((obj, feature) => {
@@ -3053,8 +2789,7 @@
3053
2789
  };
3054
2790
  };
3055
2791
 
3056
- const coreInitialState = {// coreProgress: 1,
3057
- };
2792
+ const coreInitialState = {};
3058
2793
  let initialState = { ...coreInitialState,
3059
2794
  ...((_options$initialState = options.initialState) != null ? _options$initialState : {})
3060
2795
  };
@@ -3067,16 +2802,8 @@
3067
2802
 
3068
2803
  const queued = [];
3069
2804
  let queuedTimeout = false;
3070
- const midInstance = { ...instance,
3071
- // init: () => {
3072
- // startWork()
3073
- // },
3074
- // willUpdate: () => {
3075
- // startWork()
3076
- // },
3077
- // destroy: () => {
3078
- // stopWork()
3079
- // },
2805
+ const coreInstance = {
2806
+ _features: features,
3080
2807
  options: { ...defaultOptions,
3081
2808
  ...options
3082
2809
  },
@@ -3122,29 +2849,134 @@
3122
2849
  },
3123
2850
  setState: updater => {
3124
2851
  instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
3125
- } // getOverallProgress: () => {
3126
- // const { coreProgress, filtersProgress, facetProgress } =
3127
- // instance.getState()
3128
- // return mean(() =>
3129
- // [coreProgress, filtersProgress].filter(d => d < 1)
3130
- // ) as number
3131
- // },
3132
- // getProgressStage: () => {
3133
- // const { coreProgress, filtersProgress, facetProgress } =
3134
- // instance.getState()
3135
- // if (coreProgress < 1) {
3136
- // return 'coreRowModel'
3137
- // }
3138
- // if (filtersProgress < 1) {
3139
- // return 'filteredRowModel'
3140
- // }
3141
- // if (Object.values(facetProgress).some(d => d < 1)) {
3142
- // return 'facetedRowModel'
3143
- // }
3144
- // },
2852
+ },
2853
+ _getRowId: (row, index, parent) => {
2854
+ var _instance$options$get;
2855
+
2856
+ return (_instance$options$get = instance.options.getRowId == null ? void 0 : instance.options.getRowId(row, index, parent)) != null ? _instance$options$get : "" + (parent ? [parent.id, index].join('.') : index);
2857
+ },
2858
+ getCoreRowModel: () => {
2859
+ if (!instance._getCoreRowModel) {
2860
+ instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
2861
+ }
2862
+
2863
+ return instance._getCoreRowModel();
2864
+ },
2865
+ // The final calls start at the bottom of the model,
2866
+ // expanded rows, which then work their way up
2867
+ getRowModel: () => {
2868
+ return instance.getPaginationRowModel();
2869
+ },
2870
+ getRow: id => {
2871
+ const row = instance.getRowModel().rowsById[id];
2872
+
2873
+ if (!row) {
2874
+ {
2875
+ throw new Error("getRow expected an ID, but got " + id);
2876
+ }
2877
+ }
2878
+
2879
+ return row;
2880
+ },
2881
+ _getDefaultColumnDef: memo(() => [instance.options.defaultColumn], defaultColumn => {
2882
+ var _defaultColumn;
2883
+
2884
+ defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
2885
+ return {
2886
+ header: props => props.header.column.id,
2887
+ footer: props => props.header.column.id,
2888
+ cell: props => {
2889
+ var _props$getValue$toStr, _props$getValue$toStr2, _props$getValue;
2890
+
2891
+ 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;
2892
+ },
2893
+ ...instance._features.reduce((obj, feature) => {
2894
+ return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
2895
+ }, {}),
2896
+ ...defaultColumn
2897
+ };
2898
+ }, {
2899
+ debug: () => {
2900
+ var _instance$options$deb;
2901
+
2902
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
2903
+ },
2904
+ key: 'getDefaultColumnDef'
2905
+ }),
2906
+ _getColumnDefs: () => instance.options.columns,
2907
+ getAllColumns: memo(() => [instance._getColumnDefs()], columnDefs => {
2908
+ const recurseColumns = function (columnDefs, parent, depth) {
2909
+ if (depth === void 0) {
2910
+ depth = 0;
2911
+ }
2912
+
2913
+ return columnDefs.map(columnDef => {
2914
+ const column = createColumn(instance, columnDef, depth, parent);
2915
+ column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
2916
+ return column;
2917
+ });
2918
+ };
2919
+
2920
+ return recurseColumns(columnDefs);
2921
+ }, {
2922
+ key: 'getAllColumns',
2923
+ debug: () => {
2924
+ var _instance$options$deb2;
2925
+
2926
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
2927
+ }
2928
+ }),
2929
+ getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
2930
+ return allColumns.flatMap(column => {
2931
+ return column.getFlatColumns();
2932
+ });
2933
+ }, {
2934
+ key: 'getAllFlatColumns',
2935
+ debug: () => {
2936
+ var _instance$options$deb3;
2937
+
2938
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2939
+ }
2940
+ }),
2941
+ _getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
2942
+ return flatColumns.reduce((acc, column) => {
2943
+ acc[column.id] = column;
2944
+ return acc;
2945
+ }, {});
2946
+ }, {
2947
+ key: 'getAllFlatColumnsById',
2948
+ debug: () => {
2949
+ var _instance$options$deb4;
2950
+
2951
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
2952
+ }
2953
+ }),
2954
+ getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
2955
+ let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
2956
+ return orderColumns(leafColumns);
2957
+ }, {
2958
+ key: 'getAllLeafColumns',
2959
+ debug: () => {
2960
+ var _instance$options$deb5;
2961
+
2962
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
2963
+ }
2964
+ }),
2965
+ getColumn: columnId => {
2966
+ const column = instance._getAllFlatColumnsById()[columnId];
2967
+
2968
+ if (!column) {
2969
+ {
2970
+ console.warn("[Table] Column with id " + columnId + " does not exist.");
2971
+ }
3145
2972
 
2973
+ throw new Error();
2974
+ }
2975
+
2976
+ return column;
2977
+ }
3146
2978
  };
3147
- instance = Object.assign(instance, midInstance);
2979
+ Object.assign(instance, coreInstance);
3148
2980
 
3149
2981
  instance._features.forEach(feature => {
3150
2982
  return Object.assign(instance, feature.createInstance == null ? void 0 : feature.createInstance(instance));
@@ -3167,10 +2999,11 @@
3167
2999
  throw new Error('');
3168
3000
  })()
3169
3001
  },
3170
- setGenerics: () => table,
3002
+ // setGenerics: () => table as any,
3171
3003
  setRowType: () => table,
3172
3004
  setTableMetaType: () => table,
3173
3005
  setColumnMetaType: () => table,
3006
+ setFilterMetaType: () => table,
3174
3007
  setOptions: newOptions => createTable(_, __, { ...options,
3175
3008
  ...newOptions
3176
3009
  }),
@@ -3202,11 +3035,92 @@
3202
3035
  }
3203
3036
 
3204
3037
  throw new Error('Invalid accessor');
3205
- }
3038
+ },
3039
+ createOptions: options => options
3206
3040
  };
3207
3041
  return table;
3208
3042
  }
3209
3043
 
3044
+ function createCell(instance, row, column, columnId) {
3045
+ const cell = {
3046
+ id: row.id + "_" + column.id,
3047
+ row,
3048
+ column,
3049
+ getValue: () => row.getValue(columnId),
3050
+ renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
3051
+ instance,
3052
+ column,
3053
+ row,
3054
+ cell: cell,
3055
+ getValue: cell.getValue
3056
+ }) : null
3057
+ };
3058
+
3059
+ instance._features.forEach(feature => {
3060
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
3061
+ }, {});
3062
+
3063
+ return cell;
3064
+ }
3065
+
3066
+ const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3067
+ let row = {
3068
+ id,
3069
+ index: rowIndex,
3070
+ original,
3071
+ depth,
3072
+ _valuesCache: {},
3073
+ getValue: columnId => {
3074
+ if (row._valuesCache.hasOwnProperty(columnId)) {
3075
+ return row._valuesCache[columnId];
3076
+ }
3077
+
3078
+ const column = instance.getColumn(columnId);
3079
+
3080
+ if (!column.accessorFn) {
3081
+ return undefined;
3082
+ }
3083
+
3084
+ row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
3085
+ return row._valuesCache[columnId];
3086
+ },
3087
+ subRows: subRows != null ? subRows : [],
3088
+ getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
3089
+ getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
3090
+ return leafColumns.map(column => {
3091
+ return createCell(instance, row, column, column.id);
3092
+ });
3093
+ }, {
3094
+ key: 'row.getAllCells',
3095
+ debug: () => {
3096
+ var _instance$options$deb;
3097
+
3098
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3099
+ }
3100
+ }),
3101
+ _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
3102
+ return allCells.reduce((acc, cell) => {
3103
+ acc[cell.column.id] = cell;
3104
+ return acc;
3105
+ }, {});
3106
+ }, {
3107
+ key: "development" === 'production' ,
3108
+ debug: () => {
3109
+ var _instance$options$deb2;
3110
+
3111
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3112
+ }
3113
+ })
3114
+ };
3115
+
3116
+ for (let i = 0; i < instance._features.length; i++) {
3117
+ const feature = instance._features[i];
3118
+ Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
3119
+ }
3120
+
3121
+ return row;
3122
+ };
3123
+
3210
3124
  function getCoreRowModel() {
3211
3125
  return instance => memo(() => [instance.options.data], data => {
3212
3126
  const rowModel = {
@@ -3234,7 +3148,7 @@
3234
3148
  // }
3235
3149
  // Make the row
3236
3150
 
3237
- row = instance.createRow(instance.getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3151
+ row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3238
3152
 
3239
3153
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3240
3154
 
@@ -3297,8 +3211,8 @@
3297
3211
  row = rowsToFilter[i];
3298
3212
 
3299
3213
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3300
- newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3301
- newRow.columnFilterMap = row.columnFilterMap;
3214
+ newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3215
+ newRow.columnFilters = row.columnFilters;
3302
3216
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3303
3217
 
3304
3218
  if (!newRow.subRows.length) {
@@ -3347,7 +3261,7 @@
3347
3261
  var _row$subRows2;
3348
3262
 
3349
3263
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3350
- newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3264
+ newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3351
3265
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3352
3266
  row = newRow;
3353
3267
  }
@@ -3371,6 +3285,11 @@
3371
3285
  function getFilteredRowModel() {
3372
3286
  return instance => memo(() => [instance.getPreFilteredRowModel(), instance.getState().columnFilters, instance.getState().globalFilter], (rowModel, columnFilters, globalFilter) => {
3373
3287
  if (!rowModel.rows.length || !(columnFilters != null && columnFilters.length) && !globalFilter) {
3288
+ for (let i = 0; i < rowModel.flatRows.length; i++) {
3289
+ rowModel.flatRows[i].columnFilters = {};
3290
+ rowModel.flatRows[i].columnFiltersMeta = {};
3291
+ }
3292
+
3374
3293
  return rowModel;
3375
3294
  }
3376
3295
 
@@ -3425,28 +3344,34 @@
3425
3344
 
3426
3345
  for (let j = 0; j < rowModel.flatRows.length; j++) {
3427
3346
  const row = rowModel.flatRows[j];
3428
- row.columnFilterMap = {};
3347
+ row.columnFilters = {};
3429
3348
 
3430
3349
  if (resolvedColumnFilters.length) {
3431
3350
  for (let i = 0; i < resolvedColumnFilters.length; i++) {
3432
- currentColumnFilter = resolvedColumnFilters[i]; // Tag the row with the column filter state
3351
+ currentColumnFilter = resolvedColumnFilters[i];
3352
+ const id = currentColumnFilter.id; // Tag the row with the column filter state
3433
3353
 
3434
- row.columnFilterMap[currentColumnFilter.id] = currentColumnFilter.filterFn(row, currentColumnFilter.id, currentColumnFilter.resolvedValue);
3354
+ row.columnFilters[id] = currentColumnFilter.filterFn(row, id, currentColumnFilter.resolvedValue, filterMeta => {
3355
+ row.columnFiltersMeta[id] = filterMeta;
3356
+ });
3435
3357
  }
3436
3358
  }
3437
3359
 
3438
3360
  if (resolvedGlobalFilters.length) {
3439
3361
  for (let i = 0; i < resolvedGlobalFilters.length; i++) {
3440
- currentGlobalFilter = resolvedGlobalFilters[i]; // Tag the row with the first truthy global filter state
3362
+ currentGlobalFilter = resolvedGlobalFilters[i];
3363
+ const id = currentGlobalFilter.id; // Tag the row with the first truthy global filter state
3441
3364
 
3442
- if (currentGlobalFilter.filterFn(row, currentGlobalFilter.id, currentGlobalFilter.resolvedValue)) {
3443
- row.columnFilterMap.__global__ = true;
3365
+ if (currentGlobalFilter.filterFn(row, id, currentGlobalFilter.resolvedValue, filterMeta => {
3366
+ row.columnFiltersMeta[id] = filterMeta;
3367
+ })) {
3368
+ row.columnFilters.__global__ = true;
3444
3369
  break;
3445
3370
  }
3446
3371
  }
3447
3372
 
3448
- if (row.columnFilterMap.__global__ !== true) {
3449
- row.columnFilterMap.__global__ = false;
3373
+ if (row.columnFilters.__global__ !== true) {
3374
+ row.columnFilters.__global__ = false;
3450
3375
  }
3451
3376
  }
3452
3377
  }
@@ -3454,7 +3379,7 @@
3454
3379
  const filterRowsImpl = row => {
3455
3380
  // Horizontally filter rows through each column
3456
3381
  for (let i = 0; i < filterableIds.length; i++) {
3457
- if (row.columnFilterMap[filterableIds[i]] === false) {
3382
+ if (row.columnFilters[filterableIds[i]] === false) {
3458
3383
  return false;
3459
3384
  }
3460
3385
  }
@@ -3488,7 +3413,7 @@
3488
3413
  const filterRowsImpl = row => {
3489
3414
  // Horizontally filter rows through each column
3490
3415
  for (let i = 0; i < filterableIds.length; i++) {
3491
- if (row.columnFilterMap[filterableIds[i]] === false) {
3416
+ if (row.columnFilters[filterableIds[i]] === false) {
3492
3417
  return false;
3493
3418
  }
3494
3419
  }
@@ -3588,8 +3513,8 @@
3588
3513
  availableSorting.forEach(sortEntry => {
3589
3514
  const column = instance.getColumn(sortEntry.id);
3590
3515
  columnInfoById[sortEntry.id] = {
3591
- sortUndefined: column.sortUndefined,
3592
- invertSorting: column.invertSorting,
3516
+ sortUndefined: column.columnDef.sortUndefined,
3517
+ invertSorting: column.columnDef.invertSorting,
3593
3518
  sortingFn: column.getSortingFn()
3594
3519
  };
3595
3520
  });
@@ -3703,7 +3628,7 @@
3703
3628
  const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
3704
3629
 
3705
3630
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3706
- const row = instance.createRow(id, undefined, index, depth);
3631
+ const row = createRow(instance, id, undefined, index, depth);
3707
3632
  Object.assign(row, {
3708
3633
  groupingColumnId: columnId,
3709
3634
  groupingValue,
@@ -3712,17 +3637,17 @@
3712
3637
  getValue: columnId => {
3713
3638
  // Don't aggregate columns that are in the grouping
3714
3639
  if (existingGrouping.includes(columnId)) {
3715
- if (row.valuesCache.hasOwnProperty(columnId)) {
3716
- return row.valuesCache[columnId];
3640
+ if (row._valuesCache.hasOwnProperty(columnId)) {
3641
+ return row._valuesCache[columnId];
3717
3642
  }
3718
3643
 
3719
3644
  if (groupedRows[0]) {
3720
3645
  var _groupedRows$0$getVal;
3721
3646
 
3722
- row.valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
3647
+ row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
3723
3648
  }
3724
3649
 
3725
- return row.valuesCache[columnId];
3650
+ return row._valuesCache[columnId];
3726
3651
  }
3727
3652
 
3728
3653
  if (row.groupingValuesCache.hasOwnProperty(columnId)) {
@@ -3737,8 +3662,8 @@
3737
3662
  row.groupingValuesCache[columnId] = aggregateFn(() => leafRows.map(row => {
3738
3663
  let columnValue = row.getValue(columnId);
3739
3664
 
3740
- if (!depth && column.aggregateValue) {
3741
- columnValue = column.aggregateValue(columnValue);
3665
+ if (!depth && column.columnDef.aggregateValue) {
3666
+ columnValue = column.columnDef.aggregateValue(columnValue);
3742
3667
  }
3743
3668
 
3744
3669
  return columnValue;
@@ -3907,11 +3832,15 @@
3907
3832
  exports.RowSelection = RowSelection;
3908
3833
  exports.Sorting = Sorting;
3909
3834
  exports.Visibility = Visibility;
3835
+ exports.aggregationFns = aggregationFns;
3910
3836
  exports.buildHeaderGroups = buildHeaderGroups;
3837
+ exports.createColumn = createColumn;
3838
+ exports.createRow = createRow;
3911
3839
  exports.createTableFactory = createTableFactory;
3912
3840
  exports.createTableInstance = createTableInstance;
3913
3841
  exports.defaultColumnSizing = defaultColumnSizing;
3914
3842
  exports.expandRows = expandRows;
3843
+ exports.filterFns = filterFns;
3915
3844
  exports.flattenBy = flattenBy;
3916
3845
  exports.functionalUpdate = functionalUpdate;
3917
3846
  exports.getCoreRowModel = getCoreRowModel;
@@ -3926,12 +3855,15 @@
3926
3855
  exports.isFunction = isFunction;
3927
3856
  exports.isRowSelected = isRowSelected;
3928
3857
  exports.makeStateUpdater = makeStateUpdater;
3858
+ exports.mean = mean;
3929
3859
  exports.memo = memo;
3930
3860
  exports.noop = noop;
3931
3861
  exports.orderColumns = orderColumns;
3932
3862
  exports.passiveEventSupported = passiveEventSupported;
3863
+ exports.reSplitAlphaNumeric = reSplitAlphaNumeric;
3933
3864
  exports.selectRowsFn = selectRowsFn;
3934
3865
  exports.shouldAutoRemoveFilter = shouldAutoRemoveFilter;
3866
+ exports.sortingFns = sortingFns;
3935
3867
 
3936
3868
  Object.defineProperty(exports, '__esModule', { value: true });
3937
3869