@tanstack/svelte-table 8.0.0-alpha.83 → 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.
@@ -101,329 +101,457 @@
101
101
  };
102
102
  }
103
103
 
104
+ function createColumn(instance, columnDef, depth, parent) {
105
+ var _ref, _columnDef$id;
106
+
107
+ const defaultColumn = instance._getDefaultColumnDef();
108
+
109
+ columnDef = { ...defaultColumn,
110
+ ...columnDef
111
+ };
112
+ let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
113
+ let accessorFn;
114
+
115
+ if (columnDef.accessorFn) {
116
+ accessorFn = columnDef.accessorFn;
117
+ } else if (columnDef.accessorKey) {
118
+ accessorFn = originalRow => originalRow[columnDef.accessorKey];
119
+ }
120
+
121
+ if (!id) {
122
+ {
123
+ throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
124
+ }
125
+ }
126
+
127
+ let column = { ...columnDef,
128
+ id: "" + id,
129
+ accessorFn,
130
+ parent: parent,
131
+ depth,
132
+ columnDef,
133
+ columnDefType: columnDef.columnDefType,
134
+ columns: [],
135
+ getFlatColumns: memo(() => [true], () => {
136
+ var _column$columns;
137
+
138
+ return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
139
+ }, {
140
+ key: "development" === 'production' ,
141
+ debug: () => {
142
+ var _instance$options$deb;
143
+
144
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
145
+ }
146
+ }),
147
+ getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
148
+ var _column$columns2;
149
+
150
+ if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
151
+ let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
152
+ return orderColumns(leafColumns);
153
+ }
154
+
155
+ return [column];
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
+ };
165
+ column = instance._features.reduce((obj, feature) => {
166
+ return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
167
+ }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
168
+
169
+ return column;
170
+ }
171
+
104
172
  //
105
- const Columns = {
173
+ function createHeader(instance, column, options) {
174
+ var _options$id;
175
+
176
+ const id = (_options$id = options.id) != null ? _options$id : column.id;
177
+ let header = {
178
+ id,
179
+ column,
180
+ index: options.index,
181
+ isPlaceholder: !!options.isPlaceholder,
182
+ placeholderId: options.placeholderId,
183
+ depth: options.depth,
184
+ subHeaders: [],
185
+ colSpan: 0,
186
+ rowSpan: 0,
187
+ headerGroup: null,
188
+ getLeafHeaders: () => {
189
+ const leafHeaders = [];
190
+
191
+ const recurseHeader = h => {
192
+ if (h.subHeaders && h.subHeaders.length) {
193
+ h.subHeaders.map(recurseHeader);
194
+ }
195
+
196
+ leafHeaders.push(h);
197
+ };
198
+
199
+ recurseHeader(header);
200
+ return leafHeaders;
201
+ },
202
+ renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
203
+ instance,
204
+ header: header,
205
+ column
206
+ }) : null,
207
+ renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
208
+ instance,
209
+ header: header,
210
+ column
211
+ }) : null
212
+ };
213
+
214
+ instance._features.forEach(feature => {
215
+ Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
216
+ });
217
+
218
+ return header;
219
+ }
220
+
221
+ const Headers = {
106
222
  createInstance: instance => {
107
223
  return {
108
- getDefaultColumnDef: memo(() => [instance.options.defaultColumnDef], defaultColumn => {
109
- var _defaultColumn;
110
-
111
- defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
112
- return {
113
- header: props => props.header.column.id,
114
- footer: props => props.header.column.id,
115
- cell: props => {
116
- var _props$getValue$toStr, _props$getValue$toStr2, _props$getValue;
224
+ // Header Groups
225
+ getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
226
+ var _left$map$filter, _right$map$filter;
117
227
 
118
- 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;
119
- },
120
- ...instance._features.reduce((obj, feature) => {
121
- return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
122
- }, {}),
123
- ...defaultColumn
124
- };
228
+ const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
229
+ const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
230
+ const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
231
+ const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
232
+ return headerGroups;
125
233
  }, {
234
+ key: 'getHeaderGroups',
126
235
  debug: () => {
127
236
  var _instance$options$deb;
128
237
 
129
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
130
- },
131
- key: 'getDefaultColumnDef'
132
- }),
133
- getColumnDefs: () => instance.options.columns,
134
- createColumn: (columnDef, depth, parent) => {
135
- var _ref, _columnDef$id;
136
-
137
- const defaultColumnDef = instance.getDefaultColumnDef();
138
- columnDef = { ...defaultColumnDef,
139
- ...columnDef
140
- };
141
- let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
142
- let accessorFn;
143
-
144
- if (columnDef.accessorFn) {
145
- accessorFn = columnDef.accessorFn;
146
- } else if (columnDef.accessorKey) {
147
- accessorFn = originalRow => originalRow[columnDef.accessorKey];
238
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
148
239
  }
240
+ }),
241
+ getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
242
+ leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
243
+ return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
244
+ }, {
245
+ key: 'getCenterHeaderGroups',
246
+ debug: () => {
247
+ var _instance$options$deb2;
149
248
 
150
- if (!id) {
151
- {
152
- throw new Error(columnDef.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header");
153
- }
249
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
154
250
  }
251
+ }),
252
+ getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
253
+ var _left$map$filter2;
155
254
 
156
- let column = { ...columnDef,
157
- id: "" + id,
158
- accessorFn,
159
- parent: parent,
160
- depth,
161
- columnDef,
162
- columnDefType: columnDef.columnDefType,
163
- columns: [],
164
- getFlatColumns: memo(() => [true], () => {
165
- var _column$columns;
166
-
167
- return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
168
- }, {
169
- key: "development" === 'production' ,
170
- debug: () => {
171
- var _instance$options$deb2;
172
-
173
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
174
- }
175
- }),
176
- getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
177
- var _column$columns2;
178
-
179
- if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
180
- let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
181
- return orderColumns(leafColumns);
182
- }
183
-
184
- return [column];
185
- }, {
186
- key: "development" === 'production' ,
187
- debug: () => {
188
- var _instance$options$deb3;
189
-
190
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
191
- }
192
- })
193
- };
194
- column = instance._features.reduce((obj, feature) => {
195
- return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
196
- }, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
197
-
198
- return column;
199
- },
200
- getAllColumns: memo(() => [instance.getColumnDefs()], columnDefs => {
201
- const recurseColumns = function (columnDefs, parent, depth) {
202
- if (depth === void 0) {
203
- depth = 0;
204
- }
255
+ const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
256
+ return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
257
+ }, {
258
+ key: 'getLeftHeaderGroups',
259
+ debug: () => {
260
+ var _instance$options$deb3;
205
261
 
206
- return columnDefs.map(columnDef => {
207
- const column = instance.createColumn(columnDef, depth, parent);
208
- column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
209
- return column;
210
- });
211
- };
262
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
263
+ }
264
+ }),
265
+ getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
266
+ var _right$map$filter2;
212
267
 
213
- return recurseColumns(columnDefs);
268
+ const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
269
+ return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
214
270
  }, {
215
- key: 'getAllColumns',
271
+ key: 'getRightHeaderGroups',
216
272
  debug: () => {
217
273
  var _instance$options$deb4;
218
274
 
219
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
275
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
220
276
  }
221
277
  }),
222
- getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
223
- return allColumns.flatMap(column => {
224
- return column.getFlatColumns();
225
- });
278
+ // Footer Groups
279
+ getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
280
+ return [...headerGroups].reverse();
226
281
  }, {
227
- key: 'getAllFlatColumns',
282
+ key: 'getFooterGroups',
228
283
  debug: () => {
229
284
  var _instance$options$deb5;
230
285
 
231
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
286
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
232
287
  }
233
288
  }),
234
- getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
235
- return flatColumns.reduce((acc, column) => {
236
- acc[column.id] = column;
237
- return acc;
238
- }, {});
289
+ getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
290
+ return [...headerGroups].reverse();
239
291
  }, {
240
- key: 'getAllFlatColumnsById',
292
+ key: 'getLeftFooterGroups',
241
293
  debug: () => {
242
294
  var _instance$options$deb6;
243
295
 
244
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugColumns;
296
+ return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
245
297
  }
246
298
  }),
247
- getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
248
- let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
249
- return orderColumns(leafColumns);
299
+ getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
300
+ return [...headerGroups].reverse();
250
301
  }, {
251
- key: 'getAllLeafColumns',
302
+ key: 'getCenterFooterGroups',
252
303
  debug: () => {
253
304
  var _instance$options$deb7;
254
305
 
255
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugColumns;
306
+ return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
256
307
  }
257
308
  }),
258
- getColumn: columnId => {
259
- const column = instance.getAllFlatColumnsById()[columnId];
260
-
261
- if (!column) {
262
- {
263
- console.warn("[Table] Column with id " + columnId + " does not exist.");
264
- }
309
+ getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
310
+ return [...headerGroups].reverse();
311
+ }, {
312
+ key: 'getRightFooterGroups',
313
+ debug: () => {
314
+ var _instance$options$deb8;
265
315
 
266
- throw new Error();
316
+ return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
267
317
  }
318
+ }),
319
+ // Flat Headers
320
+ getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
321
+ return headerGroups.map(headerGroup => {
322
+ return headerGroup.headers;
323
+ }).flat();
324
+ }, {
325
+ key: 'getFlatHeaders',
326
+ debug: () => {
327
+ var _instance$options$deb9;
268
328
 
269
- return column;
270
- }
271
- };
272
- }
273
- };
274
-
275
- //
276
- const Rows = {
277
- // createRow: <TGenerics extends TableGenerics>(
278
- // row: Row<TGenerics>,
279
- // instance: TableInstance<TGenerics>
280
- // ): CellsRow<TGenerics> => {
281
- // return {}
282
- // },
283
- createInstance: instance => {
284
- return {
285
- getRowId: (row, index, parent) => {
286
- var _instance$options$get;
287
-
288
- 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);
289
- },
290
- createRow: (id, original, rowIndex, depth, subRows) => {
291
- let row = {
292
- id,
293
- index: rowIndex,
294
- original,
295
- depth,
296
- valuesCache: {},
297
- getValue: columnId => {
298
- if (row.valuesCache.hasOwnProperty(columnId)) {
299
- return row.valuesCache[columnId];
300
- }
301
-
302
- const column = instance.getColumn(columnId);
303
-
304
- if (!column.accessorFn) {
305
- return undefined;
306
- }
329
+ return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
330
+ }
331
+ }),
332
+ getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
333
+ return left.map(headerGroup => {
334
+ return headerGroup.headers;
335
+ }).flat();
336
+ }, {
337
+ key: 'getLeftFlatHeaders',
338
+ debug: () => {
339
+ var _instance$options$deb10;
307
340
 
308
- row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
309
- return row.valuesCache[columnId];
310
- },
311
- subRows: subRows != null ? subRows : [],
312
- getLeafRows: () => flattenBy(row.subRows, d => d.subRows)
313
- };
341
+ return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
342
+ }
343
+ }),
344
+ getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
345
+ return left.map(headerGroup => {
346
+ return headerGroup.headers;
347
+ }).flat();
348
+ }, {
349
+ key: 'getCenterFlatHeaders',
350
+ debug: () => {
351
+ var _instance$options$deb11;
314
352
 
315
- for (let i = 0; i < instance._features.length; i++) {
316
- const feature = instance._features[i];
317
- Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
353
+ return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
318
354
  }
355
+ }),
356
+ getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
357
+ return left.map(headerGroup => {
358
+ return headerGroup.headers;
359
+ }).flat();
360
+ }, {
361
+ key: 'getRightFlatHeaders',
362
+ debug: () => {
363
+ var _instance$options$deb12;
319
364
 
320
- return row;
321
- },
322
- getCoreRowModel: () => {
323
- if (!instance._getCoreRowModel) {
324
- instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
365
+ return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
325
366
  }
367
+ }),
368
+ // Leaf Headers
369
+ getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
370
+ return flatHeaders.filter(header => {
371
+ var _header$subHeaders;
326
372
 
327
- return instance._getCoreRowModel();
328
- },
329
- // The final calls start at the bottom of the model,
330
- // expanded rows, which then work their way up
331
- getRowModel: () => {
332
- return instance.getPaginationRowModel();
333
- },
334
- getRow: id => {
335
- const row = instance.getRowModel().rowsById[id];
373
+ return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
374
+ });
375
+ }, {
376
+ key: 'getCenterLeafHeaders',
377
+ debug: () => {
378
+ var _instance$options$deb13;
336
379
 
337
- if (!row) {
338
- {
339
- throw new Error("getRow expected an ID, but got " + id);
340
- }
380
+ return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
341
381
  }
382
+ }),
383
+ getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
384
+ return flatHeaders.filter(header => {
385
+ var _header$subHeaders2;
342
386
 
343
- return row;
344
- }
345
- };
346
- }
347
- };
387
+ return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
388
+ });
389
+ }, {
390
+ key: 'getLeftLeafHeaders',
391
+ debug: () => {
392
+ var _instance$options$deb14;
348
393
 
349
- //
350
- const Cells = {
351
- createRow: (row, instance) => {
352
- return {
353
- getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
354
- return leafColumns.map(column => {
355
- return instance.createCell(row, column, column.id);
394
+ return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
395
+ }
396
+ }),
397
+ getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
398
+ return flatHeaders.filter(header => {
399
+ var _header$subHeaders3;
400
+
401
+ return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
356
402
  });
357
403
  }, {
358
- key: 'row.getAllCells',
404
+ key: 'getRightLeafHeaders',
359
405
  debug: () => {
360
- var _instance$options$deb;
406
+ var _instance$options$deb15;
361
407
 
362
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
408
+ return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
363
409
  }
364
410
  }),
365
- getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
366
- return allCells.reduce((acc, cell) => {
367
- acc[cell.columnId] = cell;
368
- return acc;
369
- }, {});
411
+ getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
412
+ var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
413
+
414
+ 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 => {
415
+ return header.getLeafHeaders();
416
+ }).flat();
370
417
  }, {
371
- key: "development" === 'production' ,
418
+ key: 'getLeafHeaders',
372
419
  debug: () => {
373
- var _instance$options$deb2;
420
+ var _instance$options$deb16;
374
421
 
375
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
422
+ return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
376
423
  }
377
424
  })
378
425
  };
379
- },
380
- createInstance: instance => {
381
- return {
382
- createCell: (row, column, columnId) => {
383
- const cell = {
384
- id: row.id + "_" + column.id,
385
- rowId: row.id,
386
- columnId,
387
- row,
388
- column,
389
- getValue: () => row.getValue(columnId),
390
- renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
391
- instance,
392
- column,
393
- row,
394
- cell: cell,
395
- getValue: cell.getValue
396
- }) : null
397
- };
426
+ }
427
+ };
428
+ function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
429
+ var _headerGroups$0$heade, _headerGroups$;
398
430
 
399
- instance._features.forEach(feature => {
400
- Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
401
- }, {});
431
+ // Find the max depth of the columns:
432
+ // build the leaf column row
433
+ // build each buffer row going up
434
+ // placeholder for non-existent level
435
+ // real column for existing level
436
+ let maxDepth = 0;
402
437
 
403
- return cell;
404
- },
405
- getCell: (rowId, columnId) => {
406
- const row = instance.getRow(rowId);
438
+ const findMaxDepth = function (columns, depth) {
439
+ if (depth === void 0) {
440
+ depth = 1;
441
+ }
407
442
 
408
- if (!row) {
409
- {
410
- throw new Error("[Table] could not find row with id " + rowId);
411
- }
412
- }
443
+ maxDepth = Math.max(maxDepth, depth);
444
+ columns.filter(column => column.getIsVisible()).forEach(column => {
445
+ var _column$columns;
413
446
 
414
- const cell = row.getAllCellsByColumnId()[columnId];
447
+ if ((_column$columns = column.columns) != null && _column$columns.length) {
448
+ findMaxDepth(column.columns, depth + 1);
449
+ }
450
+ }, 0);
451
+ };
415
452
 
416
- if (!cell) {
417
- {
418
- throw new Error("[Table] could not find cell " + columnId + " in row " + rowId);
419
- }
420
- }
453
+ findMaxDepth(allColumns);
454
+ let headerGroups = [];
421
455
 
422
- return cell;
456
+ const createHeaderGroup = (headersToGroup, depth) => {
457
+ // The header group we are creating
458
+ const headerGroup = {
459
+ depth,
460
+ id: [headerFamily, "" + depth].filter(Boolean).join('_'),
461
+ headers: []
462
+ }; // The parent columns we're going to scan next
463
+
464
+ const pendingParentHeaders = []; // Scan each column for parents
465
+
466
+ headersToGroup.forEach(headerToGroup => {
467
+ // What is the latest (last) parent column?
468
+ const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
469
+ const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
470
+ let column;
471
+ let isPlaceholder = false;
472
+
473
+ if (isLeafHeader && headerToGroup.column.parent) {
474
+ // The parent header is new
475
+ column = headerToGroup.column.parent;
476
+ } else {
477
+ // The parent header is repeated
478
+ column = headerToGroup.column;
479
+ isPlaceholder = true;
423
480
  }
424
- };
425
- }
426
- };
481
+
482
+ if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
483
+ // This column is repeated. Add it as a sub header to the next batch
484
+ latestPendingParentHeader.subHeaders.push(headerToGroup);
485
+ } else {
486
+ // This is a new header. Let's create it
487
+ const header = createHeader(instance, column, {
488
+ id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
489
+ isPlaceholder,
490
+ placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
491
+ depth,
492
+ index: pendingParentHeaders.length
493
+ }); // Add the headerToGroup as a subHeader of the new header
494
+
495
+ header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
496
+ // in the next batch
497
+
498
+ pendingParentHeaders.push(header);
499
+ }
500
+
501
+ headerGroup.headers.push(headerToGroup);
502
+ headerToGroup.headerGroup = headerGroup;
503
+ });
504
+ headerGroups.push(headerGroup);
505
+
506
+ if (depth > 0) {
507
+ createHeaderGroup(pendingParentHeaders, depth - 1);
508
+ }
509
+ };
510
+
511
+ const bottomHeaders = columnsToGroup.map((column, index) => createHeader(instance, column, {
512
+ depth: maxDepth,
513
+ index
514
+ }));
515
+ createHeaderGroup(bottomHeaders, maxDepth - 1);
516
+ headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
517
+ // return !headerGroup.headers.every(header => header.isPlaceholder)
518
+ // })
519
+
520
+ const recurseHeadersForSpans = headers => {
521
+ const filteredHeaders = headers.filter(header => header.column.getIsVisible());
522
+ return filteredHeaders.map(header => {
523
+ let colSpan = 0;
524
+ let rowSpan = 0;
525
+ let childRowSpans = [0];
526
+
527
+ if (header.subHeaders && header.subHeaders.length) {
528
+ childRowSpans = [];
529
+ recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
530
+ let {
531
+ colSpan: childColSpan,
532
+ rowSpan: childRowSpan
533
+ } = _ref;
534
+ colSpan += childColSpan;
535
+ childRowSpans.push(childRowSpan);
536
+ });
537
+ } else {
538
+ colSpan = 1;
539
+ }
540
+
541
+ const minChildRowSpan = Math.min(...childRowSpans);
542
+ rowSpan = rowSpan + minChildRowSpan;
543
+ header.colSpan = colSpan;
544
+ header.rowSpan = rowSpan;
545
+ return {
546
+ colSpan,
547
+ rowSpan
548
+ };
549
+ });
550
+ };
551
+
552
+ recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
553
+ return headerGroups;
554
+ }
427
555
 
428
556
  //
429
557
  const defaultColumnSizing = {
@@ -970,7 +1098,7 @@
970
1098
  getColumnCanGlobalFilter: column => {
971
1099
  var _instance$getCoreRowM, _instance$getCoreRowM2;
972
1100
 
973
- const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM.getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
1101
+ const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM._getAllCellsByColumnId()[column.id]) == null ? void 0 : _instance$getCoreRowM2.getValue();
974
1102
  return typeof value === 'string';
975
1103
  }
976
1104
  };
@@ -1748,7 +1876,7 @@
1748
1876
  return {
1749
1877
  getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allCells, left, right) => {
1750
1878
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
1751
- return allCells.filter(d => !leftAndRight.includes(d.columnId));
1879
+ return allCells.filter(d => !leftAndRight.includes(d.column.id));
1752
1880
  }, {
1753
1881
  key: "development" === 'production' ,
1754
1882
  debug: () => {
@@ -1758,7 +1886,7 @@
1758
1886
  }
1759
1887
  }),
1760
1888
  getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left,,], (allCells, left) => {
1761
- const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.columnId === columnId)).filter(Boolean).map(d => ({ ...d,
1889
+ const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1762
1890
  position: 'left'
1763
1891
  }));
1764
1892
  return cells;
@@ -1771,7 +1899,7 @@
1771
1899
  }
1772
1900
  }),
1773
1901
  getRightVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.right], (allCells, right) => {
1774
- const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.columnId === columnId)).filter(Boolean).map(d => ({ ...d,
1902
+ const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
1775
1903
  position: 'left'
1776
1904
  }));
1777
1905
  return cells;
@@ -2576,481 +2704,76 @@
2576
2704
  };
2577
2705
  },
2578
2706
  createRow: (row, instance) => {
2579
- return {
2580
- _getAllVisibleCells: memo(() => [row.getAllCells().filter(cell => cell.column.getIsVisible()).map(d => d.id).join('_')], _ => {
2581
- return row.getAllCells().filter(cell => cell.column.getIsVisible());
2582
- }, {
2583
- key: "development" === 'production' ,
2584
- debug: () => {
2585
- var _instance$options$deb;
2586
-
2587
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2588
- }
2589
- }),
2590
- getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2591
- key: 'row.getVisibleCells',
2592
- debug: () => {
2593
- var _instance$options$deb2;
2594
-
2595
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2596
- }
2597
- })
2598
- };
2599
- },
2600
- createInstance: instance => {
2601
- const makeVisibleColumnsMethod = (key, getColumns) => {
2602
- return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2603
- return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2604
- }, {
2605
- key,
2606
- debug: () => {
2607
- var _instance$options$deb3;
2608
-
2609
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2610
- }
2611
- });
2612
- };
2613
-
2614
- return {
2615
- getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2616
- getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2617
- getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2618
- getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2619
- getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2620
- setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2621
- resetColumnVisibility: defaultState => {
2622
- var _instance$initialStat;
2623
-
2624
- instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2625
- },
2626
- toggleAllColumnsVisible: value => {
2627
- var _value;
2628
-
2629
- value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2630
- instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2631
- [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2632
- }), {}));
2633
- },
2634
- getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2635
- getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2636
- getToggleAllColumnsVisibilityHandler: () => {
2637
- return e => {
2638
- var _target;
2639
-
2640
- instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2641
- };
2642
- }
2643
- };
2644
- }
2645
- };
2646
-
2647
- //
2648
- const Headers = {
2649
- createInstance: instance => {
2650
- return {
2651
- createHeader: (column, options) => {
2652
- var _options$id;
2653
-
2654
- const id = (_options$id = options.id) != null ? _options$id : column.id;
2655
- let header = {
2656
- id,
2657
- column,
2658
- index: options.index,
2659
- isPlaceholder: options.isPlaceholder,
2660
- placeholderId: options.placeholderId,
2661
- depth: options.depth,
2662
- subHeaders: [],
2663
- colSpan: 0,
2664
- rowSpan: 0,
2665
- headerGroup: null,
2666
- getLeafHeaders: () => {
2667
- const leafHeaders = [];
2668
-
2669
- const recurseHeader = h => {
2670
- if (h.subHeaders && h.subHeaders.length) {
2671
- h.subHeaders.map(recurseHeader);
2672
- }
2673
-
2674
- leafHeaders.push(h);
2675
- };
2676
-
2677
- recurseHeader(header);
2678
- return leafHeaders;
2679
- },
2680
- renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
2681
- instance,
2682
- header: header,
2683
- column
2684
- }) : null,
2685
- renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
2686
- instance,
2687
- header: header,
2688
- column
2689
- }) : null
2690
- };
2691
-
2692
- instance._features.forEach(feature => {
2693
- Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
2694
- });
2695
-
2696
- return header;
2697
- },
2698
- // Header Groups
2699
- getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
2700
- var _left$map$filter, _right$map$filter;
2701
-
2702
- const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
2703
- const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
2704
- const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
2705
- const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
2706
- return headerGroups;
2707
- }, {
2708
- key: 'getHeaderGroups',
2709
- debug: () => {
2710
- var _instance$options$deb;
2711
-
2712
- return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
2713
- }
2714
- }),
2715
- getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
2716
- leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
2717
- return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
2718
- }, {
2719
- key: 'getCenterHeaderGroups',
2720
- debug: () => {
2721
- var _instance$options$deb2;
2722
-
2723
- return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
2724
- }
2725
- }),
2726
- getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
2727
- var _left$map$filter2;
2728
-
2729
- const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
2730
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
2731
- }, {
2732
- key: 'getLeftHeaderGroups',
2733
- debug: () => {
2734
- var _instance$options$deb3;
2735
-
2736
- return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
2737
- }
2738
- }),
2739
- getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
2740
- var _right$map$filter2;
2741
-
2742
- const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
2743
- return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
2744
- }, {
2745
- key: 'getRightHeaderGroups',
2746
- debug: () => {
2747
- var _instance$options$deb4;
2748
-
2749
- return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
2750
- }
2751
- }),
2752
- // Footer Groups
2753
- getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
2754
- return [...headerGroups].reverse();
2755
- }, {
2756
- key: 'getFooterGroups',
2757
- debug: () => {
2758
- var _instance$options$deb5;
2759
-
2760
- return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
2761
- }
2762
- }),
2763
- getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
2764
- return [...headerGroups].reverse();
2765
- }, {
2766
- key: 'getLeftFooterGroups',
2767
- debug: () => {
2768
- var _instance$options$deb6;
2769
-
2770
- return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
2771
- }
2772
- }),
2773
- getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
2774
- return [...headerGroups].reverse();
2775
- }, {
2776
- key: 'getCenterFooterGroups',
2777
- debug: () => {
2778
- var _instance$options$deb7;
2779
-
2780
- return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
2781
- }
2782
- }),
2783
- getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
2784
- return [...headerGroups].reverse();
2785
- }, {
2786
- key: 'getRightFooterGroups',
2787
- debug: () => {
2788
- var _instance$options$deb8;
2789
-
2790
- return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
2791
- }
2792
- }),
2793
- // Flat Headers
2794
- getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
2795
- return headerGroups.map(headerGroup => {
2796
- return headerGroup.headers;
2797
- }).flat();
2798
- }, {
2799
- key: 'getFlatHeaders',
2800
- debug: () => {
2801
- var _instance$options$deb9;
2802
-
2803
- return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
2804
- }
2805
- }),
2806
- getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
2807
- return left.map(headerGroup => {
2808
- return headerGroup.headers;
2809
- }).flat();
2810
- }, {
2811
- key: 'getLeftFlatHeaders',
2812
- debug: () => {
2813
- var _instance$options$deb10;
2814
-
2815
- return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
2816
- }
2817
- }),
2818
- getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
2819
- return left.map(headerGroup => {
2820
- return headerGroup.headers;
2821
- }).flat();
2822
- }, {
2823
- key: 'getCenterFlatHeaders',
2824
- debug: () => {
2825
- var _instance$options$deb11;
2826
-
2827
- return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
2828
- }
2829
- }),
2830
- getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
2831
- return left.map(headerGroup => {
2832
- return headerGroup.headers;
2833
- }).flat();
2834
- }, {
2835
- key: 'getRightFlatHeaders',
2836
- debug: () => {
2837
- var _instance$options$deb12;
2838
-
2839
- return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
2840
- }
2841
- }),
2842
- // Leaf Headers
2843
- getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
2844
- return flatHeaders.filter(header => {
2845
- var _header$subHeaders;
2846
-
2847
- return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
2848
- });
2849
- }, {
2850
- key: 'getCenterLeafHeaders',
2851
- debug: () => {
2852
- var _instance$options$deb13;
2853
-
2854
- return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
2855
- }
2856
- }),
2857
- getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
2858
- return flatHeaders.filter(header => {
2859
- var _header$subHeaders2;
2860
-
2861
- return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
2862
- });
2863
- }, {
2864
- key: 'getLeftLeafHeaders',
2865
- debug: () => {
2866
- var _instance$options$deb14;
2867
-
2868
- return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
2869
- }
2870
- }),
2871
- getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
2872
- return flatHeaders.filter(header => {
2873
- var _header$subHeaders3;
2874
-
2875
- return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
2876
- });
2707
+ return {
2708
+ _getAllVisibleCells: memo(() => [row.getAllCells().filter(cell => cell.column.getIsVisible()).map(d => d.id).join('_')], _ => {
2709
+ return row.getAllCells().filter(cell => cell.column.getIsVisible());
2877
2710
  }, {
2878
- key: 'getRightLeafHeaders',
2711
+ key: "development" === 'production' ,
2879
2712
  debug: () => {
2880
- var _instance$options$deb15;
2713
+ var _instance$options$deb;
2881
2714
 
2882
- return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
2715
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
2883
2716
  }
2884
2717
  }),
2885
- getLeafHeaders: memo(() => [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()], (left, center, right) => {
2886
- var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
2718
+ getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
2719
+ key: 'row.getVisibleCells',
2720
+ debug: () => {
2721
+ var _instance$options$deb2;
2887
2722
 
2888
- 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 => {
2889
- return header.getLeafHeaders();
2890
- }).flat();
2723
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
2724
+ }
2725
+ })
2726
+ };
2727
+ },
2728
+ createInstance: instance => {
2729
+ const makeVisibleColumnsMethod = (key, getColumns) => {
2730
+ return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
2731
+ return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
2891
2732
  }, {
2892
- key: 'getLeafHeaders',
2733
+ key,
2893
2734
  debug: () => {
2894
- var _instance$options$deb16;
2735
+ var _instance$options$deb3;
2895
2736
 
2896
- return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
2737
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2897
2738
  }
2898
- }),
2899
- getHeader: id => {
2900
- const header = [...instance.getFlatHeaders(), ...instance.getCenterFlatHeaders(), ...instance.getLeftFlatHeaders(), ...instance.getRightFlatHeaders()].find(d => d.id === id);
2739
+ });
2740
+ };
2901
2741
 
2902
- if (!header) {
2903
- {
2904
- console.warn("Could not find header with id: " + id);
2905
- }
2742
+ return {
2743
+ getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
2744
+ getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
2745
+ getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
2746
+ getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
2747
+ getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
2748
+ setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
2749
+ resetColumnVisibility: defaultState => {
2750
+ var _instance$initialStat;
2906
2751
 
2907
- throw new Error();
2908
- }
2752
+ instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
2753
+ },
2754
+ toggleAllColumnsVisible: value => {
2755
+ var _value;
2756
+
2757
+ value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
2758
+ instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
2759
+ [column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
2760
+ }), {}));
2761
+ },
2762
+ getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
2763
+ getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
2764
+ getToggleAllColumnsVisibilityHandler: () => {
2765
+ return e => {
2766
+ var _target;
2909
2767
 
2910
- return header;
2768
+ instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
2769
+ };
2911
2770
  }
2912
2771
  };
2913
2772
  }
2914
2773
  };
2915
- function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
2916
- var _headerGroups$0$heade, _headerGroups$;
2917
-
2918
- // Find the max depth of the columns:
2919
- // build the leaf column row
2920
- // build each buffer row going up
2921
- // placeholder for non-existent level
2922
- // real column for existing level
2923
- let maxDepth = 0;
2924
-
2925
- const findMaxDepth = function (columns, depth) {
2926
- if (depth === void 0) {
2927
- depth = 1;
2928
- }
2929
-
2930
- maxDepth = Math.max(maxDepth, depth);
2931
- columns.filter(column => column.getIsVisible()).forEach(column => {
2932
- var _column$columns;
2933
-
2934
- if ((_column$columns = column.columns) != null && _column$columns.length) {
2935
- findMaxDepth(column.columns, depth + 1);
2936
- }
2937
- }, 0);
2938
- };
2939
-
2940
- findMaxDepth(allColumns);
2941
- let headerGroups = [];
2942
-
2943
- const createHeaderGroup = (headersToGroup, depth) => {
2944
- // The header group we are creating
2945
- const headerGroup = {
2946
- depth,
2947
- id: [headerFamily, "" + depth].filter(Boolean).join('_'),
2948
- headers: []
2949
- }; // The parent columns we're going to scan next
2950
-
2951
- const pendingParentHeaders = []; // Scan each column for parents
2952
-
2953
- headersToGroup.forEach(headerToGroup => {
2954
- // What is the latest (last) parent column?
2955
- const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
2956
- const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
2957
- let column;
2958
- let isPlaceholder = false;
2959
-
2960
- if (isLeafHeader && headerToGroup.column.parent) {
2961
- // The parent header is new
2962
- column = headerToGroup.column.parent;
2963
- } else {
2964
- // The parent header is repeated
2965
- column = headerToGroup.column;
2966
- isPlaceholder = true;
2967
- }
2968
-
2969
- if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
2970
- // This column is repeated. Add it as a sub header to the next batch
2971
- latestPendingParentHeader.subHeaders.push(headerToGroup);
2972
- } else {
2973
- // This is a new header. Let's create it
2974
- const header = instance.createHeader(column, {
2975
- id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
2976
- isPlaceholder,
2977
- placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
2978
- depth,
2979
- index: pendingParentHeaders.length
2980
- }); // Add the headerToGroup as a subHeader of the new header
2981
-
2982
- header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
2983
- // in the next batch
2984
-
2985
- pendingParentHeaders.push(header);
2986
- }
2987
-
2988
- headerGroup.headers.push(headerToGroup);
2989
- headerToGroup.headerGroup = headerGroup;
2990
- });
2991
- headerGroups.push(headerGroup);
2992
-
2993
- if (depth > 0) {
2994
- createHeaderGroup(pendingParentHeaders, depth - 1);
2995
- }
2996
- };
2997
-
2998
- const bottomHeaders = columnsToGroup.map((column, index) => instance.createHeader(column, {
2999
- depth: maxDepth,
3000
- index
3001
- }));
3002
- createHeaderGroup(bottomHeaders, maxDepth - 1);
3003
- headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
3004
- // return !headerGroup.headers.every(header => header.isPlaceholder)
3005
- // })
3006
-
3007
- const recurseHeadersForSpans = headers => {
3008
- const filteredHeaders = headers.filter(header => header.column.getIsVisible());
3009
- return filteredHeaders.map(header => {
3010
- let colSpan = 0;
3011
- let rowSpan = 0;
3012
- let childRowSpans = [0];
3013
-
3014
- if (header.subHeaders && header.subHeaders.length) {
3015
- childRowSpans = [];
3016
- recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
3017
- let {
3018
- colSpan: childColSpan,
3019
- rowSpan: childRowSpan
3020
- } = _ref;
3021
- colSpan += childColSpan;
3022
- childRowSpans.push(childRowSpan);
3023
- });
3024
- } else {
3025
- colSpan = 1;
3026
- }
3027
-
3028
- const minChildRowSpan = Math.min(...childRowSpans);
3029
- rowSpan = rowSpan + minChildRowSpan;
3030
- header.colSpan = colSpan > 0 ? colSpan : undefined;
3031
- header.rowSpan = rowSpan > 0 ? rowSpan : undefined;
3032
- return {
3033
- colSpan,
3034
- rowSpan
3035
- };
3036
- });
3037
- };
3038
2774
 
3039
- recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
3040
- return headerGroups;
3041
- }
2775
+ const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
3042
2776
 
3043
- // export type Batch = {
3044
- // id: number
3045
- // priority: keyof CoreBatches
3046
- // tasks: (() => void)[]
3047
- // schedule: (cb: () => void) => void
3048
- // cancel: () => void
3049
- // }
3050
- // type CoreBatches = {
3051
- // data: Batch[]
3052
- // facets: Batch[]
3053
- // }
3054
2777
  function createTableInstance$1(options) {
3055
2778
  var _options$initialState;
3056
2779
 
@@ -3059,7 +2782,7 @@
3059
2782
  }
3060
2783
 
3061
2784
  let instance = {
3062
- _features: [Columns, Rows, Cells, Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]
2785
+ _features: features
3063
2786
  };
3064
2787
 
3065
2788
  const defaultOptions = instance._features.reduce((obj, feature) => {
@@ -3076,8 +2799,7 @@
3076
2799
  };
3077
2800
  };
3078
2801
 
3079
- const coreInitialState = {// coreProgress: 1,
3080
- };
2802
+ const coreInitialState = {};
3081
2803
  let initialState = { ...coreInitialState,
3082
2804
  ...((_options$initialState = options.initialState) != null ? _options$initialState : {})
3083
2805
  };
@@ -3090,16 +2812,8 @@
3090
2812
 
3091
2813
  const queued = [];
3092
2814
  let queuedTimeout = false;
3093
- const midInstance = { ...instance,
3094
- // init: () => {
3095
- // startWork()
3096
- // },
3097
- // willUpdate: () => {
3098
- // startWork()
3099
- // },
3100
- // destroy: () => {
3101
- // stopWork()
3102
- // },
2815
+ const coreInstance = {
2816
+ _features: features,
3103
2817
  options: { ...defaultOptions,
3104
2818
  ...options
3105
2819
  },
@@ -3145,29 +2859,134 @@
3145
2859
  },
3146
2860
  setState: updater => {
3147
2861
  instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
3148
- } // getOverallProgress: () => {
3149
- // const { coreProgress, filtersProgress, facetProgress } =
3150
- // instance.getState()
3151
- // return mean(() =>
3152
- // [coreProgress, filtersProgress].filter(d => d < 1)
3153
- // ) as number
3154
- // },
3155
- // getProgressStage: () => {
3156
- // const { coreProgress, filtersProgress, facetProgress } =
3157
- // instance.getState()
3158
- // if (coreProgress < 1) {
3159
- // return 'coreRowModel'
3160
- // }
3161
- // if (filtersProgress < 1) {
3162
- // return 'filteredRowModel'
3163
- // }
3164
- // if (Object.values(facetProgress).some(d => d < 1)) {
3165
- // return 'facetedRowModel'
3166
- // }
3167
- // },
2862
+ },
2863
+ _getRowId: (row, index, parent) => {
2864
+ var _instance$options$get;
2865
+
2866
+ 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);
2867
+ },
2868
+ getCoreRowModel: () => {
2869
+ if (!instance._getCoreRowModel) {
2870
+ instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
2871
+ }
3168
2872
 
2873
+ return instance._getCoreRowModel();
2874
+ },
2875
+ // The final calls start at the bottom of the model,
2876
+ // expanded rows, which then work their way up
2877
+ getRowModel: () => {
2878
+ return instance.getPaginationRowModel();
2879
+ },
2880
+ getRow: id => {
2881
+ const row = instance.getRowModel().rowsById[id];
2882
+
2883
+ if (!row) {
2884
+ {
2885
+ throw new Error("getRow expected an ID, but got " + id);
2886
+ }
2887
+ }
2888
+
2889
+ return row;
2890
+ },
2891
+ _getDefaultColumnDef: memo(() => [instance.options.defaultColumn], defaultColumn => {
2892
+ var _defaultColumn;
2893
+
2894
+ defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
2895
+ return {
2896
+ header: props => props.header.column.id,
2897
+ footer: props => props.header.column.id,
2898
+ cell: props => {
2899
+ var _props$getValue$toStr, _props$getValue$toStr2, _props$getValue;
2900
+
2901
+ 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;
2902
+ },
2903
+ ...instance._features.reduce((obj, feature) => {
2904
+ return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
2905
+ }, {}),
2906
+ ...defaultColumn
2907
+ };
2908
+ }, {
2909
+ debug: () => {
2910
+ var _instance$options$deb;
2911
+
2912
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
2913
+ },
2914
+ key: 'getDefaultColumnDef'
2915
+ }),
2916
+ _getColumnDefs: () => instance.options.columns,
2917
+ getAllColumns: memo(() => [instance._getColumnDefs()], columnDefs => {
2918
+ const recurseColumns = function (columnDefs, parent, depth) {
2919
+ if (depth === void 0) {
2920
+ depth = 0;
2921
+ }
2922
+
2923
+ return columnDefs.map(columnDef => {
2924
+ const column = createColumn(instance, columnDef, depth, parent);
2925
+ column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
2926
+ return column;
2927
+ });
2928
+ };
2929
+
2930
+ return recurseColumns(columnDefs);
2931
+ }, {
2932
+ key: 'getAllColumns',
2933
+ debug: () => {
2934
+ var _instance$options$deb2;
2935
+
2936
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
2937
+ }
2938
+ }),
2939
+ getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
2940
+ return allColumns.flatMap(column => {
2941
+ return column.getFlatColumns();
2942
+ });
2943
+ }, {
2944
+ key: 'getAllFlatColumns',
2945
+ debug: () => {
2946
+ var _instance$options$deb3;
2947
+
2948
+ return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
2949
+ }
2950
+ }),
2951
+ _getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
2952
+ return flatColumns.reduce((acc, column) => {
2953
+ acc[column.id] = column;
2954
+ return acc;
2955
+ }, {});
2956
+ }, {
2957
+ key: 'getAllFlatColumnsById',
2958
+ debug: () => {
2959
+ var _instance$options$deb4;
2960
+
2961
+ return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
2962
+ }
2963
+ }),
2964
+ getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
2965
+ let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
2966
+ return orderColumns(leafColumns);
2967
+ }, {
2968
+ key: 'getAllLeafColumns',
2969
+ debug: () => {
2970
+ var _instance$options$deb5;
2971
+
2972
+ return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
2973
+ }
2974
+ }),
2975
+ getColumn: columnId => {
2976
+ const column = instance._getAllFlatColumnsById()[columnId];
2977
+
2978
+ if (!column) {
2979
+ {
2980
+ console.warn("[Table] Column with id " + columnId + " does not exist.");
2981
+ }
2982
+
2983
+ throw new Error();
2984
+ }
2985
+
2986
+ return column;
2987
+ }
3169
2988
  };
3170
- instance = Object.assign(instance, midInstance);
2989
+ Object.assign(instance, coreInstance);
3171
2990
 
3172
2991
  instance._features.forEach(feature => {
3173
2992
  return Object.assign(instance, feature.createInstance == null ? void 0 : feature.createInstance(instance));
@@ -3232,6 +3051,86 @@
3232
3051
  return table;
3233
3052
  }
3234
3053
 
3054
+ function createCell(instance, row, column, columnId) {
3055
+ const cell = {
3056
+ id: row.id + "_" + column.id,
3057
+ row,
3058
+ column,
3059
+ getValue: () => row.getValue(columnId),
3060
+ renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
3061
+ instance,
3062
+ column,
3063
+ row,
3064
+ cell: cell,
3065
+ getValue: cell.getValue
3066
+ }) : null
3067
+ };
3068
+
3069
+ instance._features.forEach(feature => {
3070
+ Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
3071
+ }, {});
3072
+
3073
+ return cell;
3074
+ }
3075
+
3076
+ const createRow = (instance, id, original, rowIndex, depth, subRows) => {
3077
+ let row = {
3078
+ id,
3079
+ index: rowIndex,
3080
+ original,
3081
+ depth,
3082
+ _valuesCache: {},
3083
+ getValue: columnId => {
3084
+ if (row._valuesCache.hasOwnProperty(columnId)) {
3085
+ return row._valuesCache[columnId];
3086
+ }
3087
+
3088
+ const column = instance.getColumn(columnId);
3089
+
3090
+ if (!column.accessorFn) {
3091
+ return undefined;
3092
+ }
3093
+
3094
+ row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
3095
+ return row._valuesCache[columnId];
3096
+ },
3097
+ subRows: subRows != null ? subRows : [],
3098
+ getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
3099
+ getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
3100
+ return leafColumns.map(column => {
3101
+ return createCell(instance, row, column, column.id);
3102
+ });
3103
+ }, {
3104
+ key: 'row.getAllCells',
3105
+ debug: () => {
3106
+ var _instance$options$deb;
3107
+
3108
+ return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
3109
+ }
3110
+ }),
3111
+ _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
3112
+ return allCells.reduce((acc, cell) => {
3113
+ acc[cell.column.id] = cell;
3114
+ return acc;
3115
+ }, {});
3116
+ }, {
3117
+ key: "development" === 'production' ,
3118
+ debug: () => {
3119
+ var _instance$options$deb2;
3120
+
3121
+ return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
3122
+ }
3123
+ })
3124
+ };
3125
+
3126
+ for (let i = 0; i < instance._features.length; i++) {
3127
+ const feature = instance._features[i];
3128
+ Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
3129
+ }
3130
+
3131
+ return row;
3132
+ };
3133
+
3235
3134
  function getCoreRowModel() {
3236
3135
  return instance => memo(() => [instance.options.data], data => {
3237
3136
  const rowModel = {
@@ -3259,7 +3158,7 @@
3259
3158
  // }
3260
3159
  // Make the row
3261
3160
 
3262
- row = instance.createRow(instance.getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3161
+ row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3263
3162
 
3264
3163
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3265
3164
 
@@ -3322,7 +3221,7 @@
3322
3221
  row = rowsToFilter[i];
3323
3222
 
3324
3223
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3325
- newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3224
+ newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3326
3225
  newRow.columnFilters = row.columnFilters;
3327
3226
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3328
3227
 
@@ -3372,7 +3271,7 @@
3372
3271
  var _row$subRows2;
3373
3272
 
3374
3273
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3375
- newRow = instance.createRow(row.id, row.original, row.index, row.depth);
3274
+ newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3376
3275
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3377
3276
  row = newRow;
3378
3277
  }
@@ -3739,7 +3638,7 @@
3739
3638
  const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
3740
3639
 
3741
3640
  const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
3742
- const row = instance.createRow(id, undefined, index, depth);
3641
+ const row = createRow(instance, id, undefined, index, depth);
3743
3642
  Object.assign(row, {
3744
3643
  groupingColumnId: columnId,
3745
3644
  groupingValue,
@@ -3748,17 +3647,17 @@
3748
3647
  getValue: columnId => {
3749
3648
  // Don't aggregate columns that are in the grouping
3750
3649
  if (existingGrouping.includes(columnId)) {
3751
- if (row.valuesCache.hasOwnProperty(columnId)) {
3752
- return row.valuesCache[columnId];
3650
+ if (row._valuesCache.hasOwnProperty(columnId)) {
3651
+ return row._valuesCache[columnId];
3753
3652
  }
3754
3653
 
3755
3654
  if (groupedRows[0]) {
3756
3655
  var _groupedRows$0$getVal;
3757
3656
 
3758
- row.valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
3657
+ row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
3759
3658
  }
3760
3659
 
3761
- return row.valuesCache[columnId];
3660
+ return row._valuesCache[columnId];
3762
3661
  }
3763
3662
 
3764
3663
  if (row.groupingValuesCache.hasOwnProperty(columnId)) {
@@ -4141,6 +4040,8 @@
4141
4040
  exports.Visibility = Visibility;
4142
4041
  exports.aggregationFns = aggregationFns;
4143
4042
  exports.buildHeaderGroups = buildHeaderGroups;
4043
+ exports.createColumn = createColumn;
4044
+ exports.createRow = createRow;
4144
4045
  exports.createTable = createTable;
4145
4046
  exports.createTableFactory = createTableFactory;
4146
4047
  exports.createTableInstance = createTableInstance;