@tanstack/svelte-table 8.0.0-alpha.83 → 8.0.0-alpha.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/svelte-table/src/index.js +2 -1
- package/build/cjs/svelte-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +719 -838
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +719 -839
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +38 -38
- package/build/umd/index.development.js +717 -832
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
|
@@ -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
|
-
|
|
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
|
-
|
|
109
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
|
|
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: '
|
|
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.
|
|
275
|
+
return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
|
|
220
276
|
}
|
|
221
277
|
}),
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
278
|
+
// Footer Groups
|
|
279
|
+
getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
|
|
280
|
+
return [...headerGroups].reverse();
|
|
226
281
|
}, {
|
|
227
|
-
key: '
|
|
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.
|
|
286
|
+
return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
|
|
232
287
|
}
|
|
233
288
|
}),
|
|
234
|
-
|
|
235
|
-
return
|
|
236
|
-
acc[column.id] = column;
|
|
237
|
-
return acc;
|
|
238
|
-
}, {});
|
|
289
|
+
getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
|
|
290
|
+
return [...headerGroups].reverse();
|
|
239
291
|
}, {
|
|
240
|
-
key: '
|
|
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.
|
|
296
|
+
return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
|
|
245
297
|
}
|
|
246
298
|
}),
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return orderColumns(leafColumns);
|
|
299
|
+
getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
|
|
300
|
+
return [...headerGroups].reverse();
|
|
250
301
|
}, {
|
|
251
|
-
key: '
|
|
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.
|
|
306
|
+
return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
|
|
256
307
|
}
|
|
257
308
|
}),
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
-
|
|
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
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
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
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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: '
|
|
404
|
+
key: 'getRightLeafHeaders',
|
|
359
405
|
debug: () => {
|
|
360
|
-
var _instance$options$
|
|
406
|
+
var _instance$options$deb15;
|
|
361
407
|
|
|
362
|
-
return (_instance$options$
|
|
408
|
+
return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
|
|
363
409
|
}
|
|
364
410
|
}),
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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:
|
|
418
|
+
key: 'getLeafHeaders',
|
|
372
419
|
debug: () => {
|
|
373
|
-
var _instance$options$
|
|
420
|
+
var _instance$options$deb16;
|
|
374
421
|
|
|
375
|
-
return (_instance$options$
|
|
422
|
+
return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
|
|
376
423
|
}
|
|
377
424
|
})
|
|
378
425
|
};
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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
|
-
|
|
400
|
-
|
|
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
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
438
|
+
const findMaxDepth = function (columns, depth) {
|
|
439
|
+
if (depth === void 0) {
|
|
440
|
+
depth = 1;
|
|
441
|
+
}
|
|
407
442
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
443
|
+
maxDepth = Math.max(maxDepth, depth);
|
|
444
|
+
columns.filter(column => column.getIsVisible()).forEach(column => {
|
|
445
|
+
var _column$columns;
|
|
446
|
+
|
|
447
|
+
if ((_column$columns = column.columns) != null && _column$columns.length) {
|
|
448
|
+
findMaxDepth(column.columns, depth + 1);
|
|
449
|
+
}
|
|
450
|
+
}, 0);
|
|
451
|
+
};
|
|
413
452
|
|
|
414
|
-
|
|
453
|
+
findMaxDepth(allColumns);
|
|
454
|
+
let headerGroups = [];
|
|
415
455
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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;
|
|
421
472
|
|
|
422
|
-
|
|
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 = {
|
|
@@ -701,7 +829,6 @@
|
|
|
701
829
|
return {
|
|
702
830
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
703
831
|
autoResetExpanded: true,
|
|
704
|
-
expandSubRows: true,
|
|
705
832
|
paginateExpandedRows: true
|
|
706
833
|
};
|
|
707
834
|
},
|
|
@@ -970,7 +1097,7 @@
|
|
|
970
1097
|
getColumnCanGlobalFilter: column => {
|
|
971
1098
|
var _instance$getCoreRowM, _instance$getCoreRowM2;
|
|
972
1099
|
|
|
973
|
-
const value = (_instance$getCoreRowM = instance.getCoreRowModel().flatRows[0]) == null ? void 0 : (_instance$getCoreRowM2 = _instance$getCoreRowM.
|
|
1100
|
+
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
1101
|
return typeof value === 'string';
|
|
975
1102
|
}
|
|
976
1103
|
};
|
|
@@ -1098,8 +1225,7 @@
|
|
|
1098
1225
|
createRow: (row, instance) => {
|
|
1099
1226
|
return {
|
|
1100
1227
|
columnFilters: {},
|
|
1101
|
-
columnFiltersMeta: {}
|
|
1102
|
-
subRowsByFacetId: {}
|
|
1228
|
+
columnFiltersMeta: {}
|
|
1103
1229
|
};
|
|
1104
1230
|
},
|
|
1105
1231
|
createInstance: instance => {
|
|
@@ -1190,53 +1316,42 @@
|
|
|
1190
1316
|
return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;
|
|
1191
1317
|
}
|
|
1192
1318
|
|
|
1193
|
-
const
|
|
1194
|
-
sum,
|
|
1195
|
-
min,
|
|
1196
|
-
max,
|
|
1197
|
-
extent,
|
|
1198
|
-
mean,
|
|
1199
|
-
median,
|
|
1200
|
-
unique,
|
|
1201
|
-
uniqueCount,
|
|
1202
|
-
count
|
|
1203
|
-
};
|
|
1204
|
-
|
|
1205
|
-
function sum(_getLeafValues, getChildValues) {
|
|
1319
|
+
const sum = (columnId, _leafRows, childRows) => {
|
|
1206
1320
|
// It's faster to just add the aggregations together instead of
|
|
1207
1321
|
// process leaf nodes individually
|
|
1208
|
-
return
|
|
1209
|
-
}
|
|
1322
|
+
return childRows.reduce((sum, next) => sum + (typeof next === 'number' ? next : 0), 0);
|
|
1323
|
+
};
|
|
1210
1324
|
|
|
1211
|
-
|
|
1325
|
+
const min = (columnId, _leafRows, childRows) => {
|
|
1212
1326
|
let min;
|
|
1327
|
+
childRows.forEach(row => {
|
|
1328
|
+
const value = row.getValue(columnId);
|
|
1213
1329
|
|
|
1214
|
-
for (const value of getChildValues()) {
|
|
1215
1330
|
if (value != null && (min > value || min === undefined && value >= value)) {
|
|
1216
1331
|
min = value;
|
|
1217
1332
|
}
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1333
|
+
});
|
|
1220
1334
|
return min;
|
|
1221
|
-
}
|
|
1335
|
+
};
|
|
1222
1336
|
|
|
1223
|
-
|
|
1337
|
+
const max = (columnId, _leafRows, childRows) => {
|
|
1224
1338
|
let max;
|
|
1339
|
+
childRows.forEach(row => {
|
|
1340
|
+
const value = row.getValue(columnId);
|
|
1225
1341
|
|
|
1226
|
-
for (const value of getChildValues()) {
|
|
1227
1342
|
if (value != null && (max < value || max === undefined && value >= value)) {
|
|
1228
1343
|
max = value;
|
|
1229
1344
|
}
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1345
|
+
});
|
|
1232
1346
|
return max;
|
|
1233
|
-
}
|
|
1347
|
+
};
|
|
1234
1348
|
|
|
1235
|
-
|
|
1349
|
+
const extent = (columnId, _leafRows, childRows) => {
|
|
1236
1350
|
let min;
|
|
1237
1351
|
let max;
|
|
1352
|
+
childRows.forEach(row => {
|
|
1353
|
+
const value = row.getValue(columnId);
|
|
1238
1354
|
|
|
1239
|
-
for (const value of getChildValues()) {
|
|
1240
1355
|
if (value != null) {
|
|
1241
1356
|
if (min === undefined) {
|
|
1242
1357
|
if (value >= value) min = max = value;
|
|
@@ -1245,54 +1360,65 @@
|
|
|
1245
1360
|
if (max < value) max = value;
|
|
1246
1361
|
}
|
|
1247
1362
|
}
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1363
|
+
});
|
|
1250
1364
|
return [min, max];
|
|
1251
|
-
}
|
|
1365
|
+
};
|
|
1252
1366
|
|
|
1253
|
-
|
|
1367
|
+
const mean = (columnId, leafRows) => {
|
|
1254
1368
|
let count = 0;
|
|
1255
1369
|
let sum = 0;
|
|
1370
|
+
leafRows.forEach(row => {
|
|
1371
|
+
let value = row.getValue(columnId);
|
|
1256
1372
|
|
|
1257
|
-
for (let value of getLeafValues()) {
|
|
1258
1373
|
if (value != null && (value = +value) >= value) {
|
|
1259
1374
|
++count, sum += value;
|
|
1260
1375
|
}
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1376
|
+
});
|
|
1263
1377
|
if (count) return sum / count;
|
|
1264
1378
|
return;
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
function median(getLeafValues) {
|
|
1268
|
-
const leafValues = getLeafValues();
|
|
1379
|
+
};
|
|
1269
1380
|
|
|
1270
|
-
|
|
1381
|
+
const median = (columnId, leafRows) => {
|
|
1382
|
+
if (!leafRows.length) {
|
|
1271
1383
|
return;
|
|
1272
1384
|
}
|
|
1273
1385
|
|
|
1274
1386
|
let min = 0;
|
|
1275
1387
|
let max = 0;
|
|
1276
|
-
|
|
1388
|
+
leafRows.forEach(row => {
|
|
1389
|
+
let value = row.getValue(columnId);
|
|
1390
|
+
|
|
1277
1391
|
if (typeof value === 'number') {
|
|
1278
1392
|
min = Math.min(min, value);
|
|
1279
1393
|
max = Math.max(max, value);
|
|
1280
1394
|
}
|
|
1281
1395
|
});
|
|
1282
1396
|
return (min + max) / 2;
|
|
1283
|
-
}
|
|
1397
|
+
};
|
|
1284
1398
|
|
|
1285
|
-
|
|
1286
|
-
return Array.from(new Set(
|
|
1287
|
-
}
|
|
1399
|
+
const unique = (columnId, leafRows) => {
|
|
1400
|
+
return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
|
|
1401
|
+
};
|
|
1288
1402
|
|
|
1289
|
-
|
|
1290
|
-
return new Set(
|
|
1291
|
-
}
|
|
1403
|
+
const uniqueCount = (columnId, leafRows) => {
|
|
1404
|
+
return new Set(leafRows.map(d => d.getValue(columnId))).size;
|
|
1405
|
+
};
|
|
1292
1406
|
|
|
1293
|
-
|
|
1294
|
-
return
|
|
1295
|
-
}
|
|
1407
|
+
const count = (_columnId, leafRows) => {
|
|
1408
|
+
return leafRows.length;
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
const aggregationFns = {
|
|
1412
|
+
sum,
|
|
1413
|
+
min,
|
|
1414
|
+
max,
|
|
1415
|
+
extent,
|
|
1416
|
+
mean,
|
|
1417
|
+
median,
|
|
1418
|
+
unique,
|
|
1419
|
+
uniqueCount,
|
|
1420
|
+
count
|
|
1421
|
+
};
|
|
1296
1422
|
|
|
1297
1423
|
//
|
|
1298
1424
|
const Grouping = {
|
|
@@ -1347,7 +1473,7 @@
|
|
|
1347
1473
|
column.toggleGrouping();
|
|
1348
1474
|
};
|
|
1349
1475
|
},
|
|
1350
|
-
|
|
1476
|
+
getAutoAggregationFn: () => {
|
|
1351
1477
|
const firstRow = instance.getCoreRowModel().flatRows[0];
|
|
1352
1478
|
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
1353
1479
|
|
|
@@ -1361,7 +1487,7 @@
|
|
|
1361
1487
|
|
|
1362
1488
|
return aggregationFns.count;
|
|
1363
1489
|
},
|
|
1364
|
-
|
|
1490
|
+
getAggregationFn: () => {
|
|
1365
1491
|
var _ref4;
|
|
1366
1492
|
|
|
1367
1493
|
const userAggregationFns = instance.options.aggregationFns;
|
|
@@ -1370,7 +1496,7 @@
|
|
|
1370
1496
|
throw new Error();
|
|
1371
1497
|
}
|
|
1372
1498
|
|
|
1373
|
-
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? column.
|
|
1499
|
+
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_ref4 = userAggregationFns == null ? void 0 : userAggregationFns[column.aggregationFn]) != null ? _ref4 : aggregationFns[column.aggregationFn];
|
|
1374
1500
|
}
|
|
1375
1501
|
};
|
|
1376
1502
|
},
|
|
@@ -1396,10 +1522,10 @@
|
|
|
1396
1522
|
}
|
|
1397
1523
|
};
|
|
1398
1524
|
},
|
|
1399
|
-
createRow:
|
|
1525
|
+
createRow: row => {
|
|
1400
1526
|
return {
|
|
1401
1527
|
getIsGrouped: () => !!row.groupingColumnId,
|
|
1402
|
-
|
|
1528
|
+
_groupingValuesCache: {}
|
|
1403
1529
|
};
|
|
1404
1530
|
},
|
|
1405
1531
|
createCell: (cell, column, row, instance) => {
|
|
@@ -1748,7 +1874,7 @@
|
|
|
1748
1874
|
return {
|
|
1749
1875
|
getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allCells, left, right) => {
|
|
1750
1876
|
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
1751
|
-
return allCells.filter(d => !leftAndRight.includes(d.
|
|
1877
|
+
return allCells.filter(d => !leftAndRight.includes(d.column.id));
|
|
1752
1878
|
}, {
|
|
1753
1879
|
key: "development" === 'production' ,
|
|
1754
1880
|
debug: () => {
|
|
@@ -1758,7 +1884,7 @@
|
|
|
1758
1884
|
}
|
|
1759
1885
|
}),
|
|
1760
1886
|
getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left,,], (allCells, left) => {
|
|
1761
|
-
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.
|
|
1887
|
+
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
|
|
1762
1888
|
position: 'left'
|
|
1763
1889
|
}));
|
|
1764
1890
|
return cells;
|
|
@@ -1771,7 +1897,7 @@
|
|
|
1771
1897
|
}
|
|
1772
1898
|
}),
|
|
1773
1899
|
getRightVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.right], (allCells, right) => {
|
|
1774
|
-
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.
|
|
1900
|
+
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
|
|
1775
1901
|
position: 'left'
|
|
1776
1902
|
}));
|
|
1777
1903
|
return cells;
|
|
@@ -2544,11 +2670,6 @@
|
|
|
2544
2670
|
onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
|
|
2545
2671
|
};
|
|
2546
2672
|
},
|
|
2547
|
-
getDefaultColumnDef: () => {
|
|
2548
|
-
return {
|
|
2549
|
-
defaultIsVisible: true
|
|
2550
|
-
};
|
|
2551
|
-
},
|
|
2552
2673
|
createColumn: (column, instance) => {
|
|
2553
2674
|
return {
|
|
2554
2675
|
toggleVisibility: value => {
|
|
@@ -2580,477 +2701,72 @@
|
|
|
2580
2701
|
_getAllVisibleCells: memo(() => [row.getAllCells().filter(cell => cell.column.getIsVisible()).map(d => d.id).join('_')], _ => {
|
|
2581
2702
|
return row.getAllCells().filter(cell => cell.column.getIsVisible());
|
|
2582
2703
|
}, {
|
|
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
|
-
});
|
|
2877
|
-
}, {
|
|
2878
|
-
key: 'getRightLeafHeaders',
|
|
2704
|
+
key: "development" === 'production' ,
|
|
2879
2705
|
debug: () => {
|
|
2880
|
-
var _instance$options$
|
|
2706
|
+
var _instance$options$deb;
|
|
2881
2707
|
|
|
2882
|
-
return (_instance$options$
|
|
2708
|
+
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
|
|
2883
2709
|
}
|
|
2884
2710
|
}),
|
|
2885
|
-
|
|
2886
|
-
|
|
2711
|
+
getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
|
|
2712
|
+
key: 'row.getVisibleCells',
|
|
2713
|
+
debug: () => {
|
|
2714
|
+
var _instance$options$deb2;
|
|
2887
2715
|
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2716
|
+
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
|
|
2717
|
+
}
|
|
2718
|
+
})
|
|
2719
|
+
};
|
|
2720
|
+
},
|
|
2721
|
+
createInstance: instance => {
|
|
2722
|
+
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
2723
|
+
return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
|
|
2724
|
+
return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
2891
2725
|
}, {
|
|
2892
|
-
key
|
|
2726
|
+
key,
|
|
2893
2727
|
debug: () => {
|
|
2894
|
-
var _instance$options$
|
|
2728
|
+
var _instance$options$deb3;
|
|
2895
2729
|
|
|
2896
|
-
return (_instance$options$
|
|
2730
|
+
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
|
|
2897
2731
|
}
|
|
2898
|
-
})
|
|
2899
|
-
|
|
2900
|
-
const header = [...instance.getFlatHeaders(), ...instance.getCenterFlatHeaders(), ...instance.getLeftFlatHeaders(), ...instance.getRightFlatHeaders()].find(d => d.id === id);
|
|
2732
|
+
});
|
|
2733
|
+
};
|
|
2901
2734
|
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2735
|
+
return {
|
|
2736
|
+
getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
|
|
2737
|
+
getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
|
|
2738
|
+
getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
|
|
2739
|
+
getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
|
|
2740
|
+
getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
|
|
2741
|
+
setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
|
|
2742
|
+
resetColumnVisibility: defaultState => {
|
|
2743
|
+
var _instance$initialStat;
|
|
2906
2744
|
|
|
2907
|
-
|
|
2908
|
-
|
|
2745
|
+
instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
|
|
2746
|
+
},
|
|
2747
|
+
toggleAllColumnsVisible: value => {
|
|
2748
|
+
var _value;
|
|
2749
|
+
|
|
2750
|
+
value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
|
|
2751
|
+
instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
|
|
2752
|
+
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
|
|
2753
|
+
}), {}));
|
|
2754
|
+
},
|
|
2755
|
+
getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
|
|
2756
|
+
getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
|
|
2757
|
+
getToggleAllColumnsVisibilityHandler: () => {
|
|
2758
|
+
return e => {
|
|
2759
|
+
var _target;
|
|
2909
2760
|
|
|
2910
|
-
|
|
2761
|
+
instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
|
|
2762
|
+
};
|
|
2911
2763
|
}
|
|
2912
2764
|
};
|
|
2913
2765
|
}
|
|
2914
2766
|
};
|
|
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
2767
|
|
|
3039
|
-
|
|
3040
|
-
return headerGroups;
|
|
3041
|
-
}
|
|
2768
|
+
const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
|
|
3042
2769
|
|
|
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
2770
|
function createTableInstance$1(options) {
|
|
3055
2771
|
var _options$initialState;
|
|
3056
2772
|
|
|
@@ -3059,7 +2775,7 @@
|
|
|
3059
2775
|
}
|
|
3060
2776
|
|
|
3061
2777
|
let instance = {
|
|
3062
|
-
_features:
|
|
2778
|
+
_features: features
|
|
3063
2779
|
};
|
|
3064
2780
|
|
|
3065
2781
|
const defaultOptions = instance._features.reduce((obj, feature) => {
|
|
@@ -3076,8 +2792,7 @@
|
|
|
3076
2792
|
};
|
|
3077
2793
|
};
|
|
3078
2794
|
|
|
3079
|
-
const coreInitialState = {
|
|
3080
|
-
};
|
|
2795
|
+
const coreInitialState = {};
|
|
3081
2796
|
let initialState = { ...coreInitialState,
|
|
3082
2797
|
...((_options$initialState = options.initialState) != null ? _options$initialState : {})
|
|
3083
2798
|
};
|
|
@@ -3090,16 +2805,8 @@
|
|
|
3090
2805
|
|
|
3091
2806
|
const queued = [];
|
|
3092
2807
|
let queuedTimeout = false;
|
|
3093
|
-
const
|
|
3094
|
-
|
|
3095
|
-
// startWork()
|
|
3096
|
-
// },
|
|
3097
|
-
// willUpdate: () => {
|
|
3098
|
-
// startWork()
|
|
3099
|
-
// },
|
|
3100
|
-
// destroy: () => {
|
|
3101
|
-
// stopWork()
|
|
3102
|
-
// },
|
|
2808
|
+
const coreInstance = {
|
|
2809
|
+
_features: features,
|
|
3103
2810
|
options: { ...defaultOptions,
|
|
3104
2811
|
...options
|
|
3105
2812
|
},
|
|
@@ -3145,29 +2852,134 @@
|
|
|
3145
2852
|
},
|
|
3146
2853
|
setState: updater => {
|
|
3147
2854
|
instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
|
|
3148
|
-
}
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
//
|
|
3162
|
-
//
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
2855
|
+
},
|
|
2856
|
+
_getRowId: (row, index, parent) => {
|
|
2857
|
+
var _instance$options$get;
|
|
2858
|
+
|
|
2859
|
+
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);
|
|
2860
|
+
},
|
|
2861
|
+
getCoreRowModel: () => {
|
|
2862
|
+
if (!instance._getCoreRowModel) {
|
|
2863
|
+
instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
return instance._getCoreRowModel();
|
|
2867
|
+
},
|
|
2868
|
+
// The final calls start at the bottom of the model,
|
|
2869
|
+
// expanded rows, which then work their way up
|
|
2870
|
+
getRowModel: () => {
|
|
2871
|
+
return instance.getPaginationRowModel();
|
|
2872
|
+
},
|
|
2873
|
+
getRow: id => {
|
|
2874
|
+
const row = instance.getRowModel().rowsById[id];
|
|
3168
2875
|
|
|
2876
|
+
if (!row) {
|
|
2877
|
+
{
|
|
2878
|
+
throw new Error("getRow expected an ID, but got " + id);
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
return row;
|
|
2883
|
+
},
|
|
2884
|
+
_getDefaultColumnDef: memo(() => [instance.options.defaultColumn], defaultColumn => {
|
|
2885
|
+
var _defaultColumn;
|
|
2886
|
+
|
|
2887
|
+
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
2888
|
+
return {
|
|
2889
|
+
header: props => props.header.column.id,
|
|
2890
|
+
footer: props => props.header.column.id,
|
|
2891
|
+
cell: props => {
|
|
2892
|
+
var _props$getValue$toStr, _props$getValue$toStr2, _props$getValue;
|
|
2893
|
+
|
|
2894
|
+
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;
|
|
2895
|
+
},
|
|
2896
|
+
...instance._features.reduce((obj, feature) => {
|
|
2897
|
+
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
2898
|
+
}, {}),
|
|
2899
|
+
...defaultColumn
|
|
2900
|
+
};
|
|
2901
|
+
}, {
|
|
2902
|
+
debug: () => {
|
|
2903
|
+
var _instance$options$deb;
|
|
2904
|
+
|
|
2905
|
+
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
|
|
2906
|
+
},
|
|
2907
|
+
key: 'getDefaultColumnDef'
|
|
2908
|
+
}),
|
|
2909
|
+
_getColumnDefs: () => instance.options.columns,
|
|
2910
|
+
getAllColumns: memo(() => [instance._getColumnDefs()], columnDefs => {
|
|
2911
|
+
const recurseColumns = function (columnDefs, parent, depth) {
|
|
2912
|
+
if (depth === void 0) {
|
|
2913
|
+
depth = 0;
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
return columnDefs.map(columnDef => {
|
|
2917
|
+
const column = createColumn(instance, columnDef, depth, parent);
|
|
2918
|
+
column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
|
|
2919
|
+
return column;
|
|
2920
|
+
});
|
|
2921
|
+
};
|
|
2922
|
+
|
|
2923
|
+
return recurseColumns(columnDefs);
|
|
2924
|
+
}, {
|
|
2925
|
+
key: 'getAllColumns',
|
|
2926
|
+
debug: () => {
|
|
2927
|
+
var _instance$options$deb2;
|
|
2928
|
+
|
|
2929
|
+
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
|
|
2930
|
+
}
|
|
2931
|
+
}),
|
|
2932
|
+
getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
|
|
2933
|
+
return allColumns.flatMap(column => {
|
|
2934
|
+
return column.getFlatColumns();
|
|
2935
|
+
});
|
|
2936
|
+
}, {
|
|
2937
|
+
key: 'getAllFlatColumns',
|
|
2938
|
+
debug: () => {
|
|
2939
|
+
var _instance$options$deb3;
|
|
2940
|
+
|
|
2941
|
+
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
|
|
2942
|
+
}
|
|
2943
|
+
}),
|
|
2944
|
+
_getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
|
|
2945
|
+
return flatColumns.reduce((acc, column) => {
|
|
2946
|
+
acc[column.id] = column;
|
|
2947
|
+
return acc;
|
|
2948
|
+
}, {});
|
|
2949
|
+
}, {
|
|
2950
|
+
key: 'getAllFlatColumnsById',
|
|
2951
|
+
debug: () => {
|
|
2952
|
+
var _instance$options$deb4;
|
|
2953
|
+
|
|
2954
|
+
return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
|
|
2955
|
+
}
|
|
2956
|
+
}),
|
|
2957
|
+
getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
|
|
2958
|
+
let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
|
|
2959
|
+
return orderColumns(leafColumns);
|
|
2960
|
+
}, {
|
|
2961
|
+
key: 'getAllLeafColumns',
|
|
2962
|
+
debug: () => {
|
|
2963
|
+
var _instance$options$deb5;
|
|
2964
|
+
|
|
2965
|
+
return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
|
|
2966
|
+
}
|
|
2967
|
+
}),
|
|
2968
|
+
getColumn: columnId => {
|
|
2969
|
+
const column = instance._getAllFlatColumnsById()[columnId];
|
|
2970
|
+
|
|
2971
|
+
if (!column) {
|
|
2972
|
+
{
|
|
2973
|
+
console.warn("[Table] Column with id " + columnId + " does not exist.");
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
throw new Error();
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
return column;
|
|
2980
|
+
}
|
|
3169
2981
|
};
|
|
3170
|
-
|
|
2982
|
+
Object.assign(instance, coreInstance);
|
|
3171
2983
|
|
|
3172
2984
|
instance._features.forEach(feature => {
|
|
3173
2985
|
return Object.assign(instance, feature.createInstance == null ? void 0 : feature.createInstance(instance));
|
|
@@ -3232,6 +3044,86 @@
|
|
|
3232
3044
|
return table;
|
|
3233
3045
|
}
|
|
3234
3046
|
|
|
3047
|
+
function createCell(instance, row, column, columnId) {
|
|
3048
|
+
const cell = {
|
|
3049
|
+
id: row.id + "_" + column.id,
|
|
3050
|
+
row,
|
|
3051
|
+
column,
|
|
3052
|
+
getValue: () => row.getValue(columnId),
|
|
3053
|
+
renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
|
|
3054
|
+
instance,
|
|
3055
|
+
column,
|
|
3056
|
+
row,
|
|
3057
|
+
cell: cell,
|
|
3058
|
+
getValue: cell.getValue
|
|
3059
|
+
}) : null
|
|
3060
|
+
};
|
|
3061
|
+
|
|
3062
|
+
instance._features.forEach(feature => {
|
|
3063
|
+
Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
|
|
3064
|
+
}, {});
|
|
3065
|
+
|
|
3066
|
+
return cell;
|
|
3067
|
+
}
|
|
3068
|
+
|
|
3069
|
+
const createRow = (instance, id, original, rowIndex, depth, subRows) => {
|
|
3070
|
+
let row = {
|
|
3071
|
+
id,
|
|
3072
|
+
index: rowIndex,
|
|
3073
|
+
original,
|
|
3074
|
+
depth,
|
|
3075
|
+
_valuesCache: {},
|
|
3076
|
+
getValue: columnId => {
|
|
3077
|
+
if (row._valuesCache.hasOwnProperty(columnId)) {
|
|
3078
|
+
return row._valuesCache[columnId];
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
const column = instance.getColumn(columnId);
|
|
3082
|
+
|
|
3083
|
+
if (!column.accessorFn) {
|
|
3084
|
+
return undefined;
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
3088
|
+
return row._valuesCache[columnId];
|
|
3089
|
+
},
|
|
3090
|
+
subRows: subRows != null ? subRows : [],
|
|
3091
|
+
getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
|
|
3092
|
+
getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
|
|
3093
|
+
return leafColumns.map(column => {
|
|
3094
|
+
return createCell(instance, row, column, column.id);
|
|
3095
|
+
});
|
|
3096
|
+
}, {
|
|
3097
|
+
key: 'row.getAllCells',
|
|
3098
|
+
debug: () => {
|
|
3099
|
+
var _instance$options$deb;
|
|
3100
|
+
|
|
3101
|
+
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
|
|
3102
|
+
}
|
|
3103
|
+
}),
|
|
3104
|
+
_getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
|
|
3105
|
+
return allCells.reduce((acc, cell) => {
|
|
3106
|
+
acc[cell.column.id] = cell;
|
|
3107
|
+
return acc;
|
|
3108
|
+
}, {});
|
|
3109
|
+
}, {
|
|
3110
|
+
key: "development" === 'production' ,
|
|
3111
|
+
debug: () => {
|
|
3112
|
+
var _instance$options$deb2;
|
|
3113
|
+
|
|
3114
|
+
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
|
|
3115
|
+
}
|
|
3116
|
+
})
|
|
3117
|
+
};
|
|
3118
|
+
|
|
3119
|
+
for (let i = 0; i < instance._features.length; i++) {
|
|
3120
|
+
const feature = instance._features[i];
|
|
3121
|
+
Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
return row;
|
|
3125
|
+
};
|
|
3126
|
+
|
|
3235
3127
|
function getCoreRowModel() {
|
|
3236
3128
|
return instance => memo(() => [instance.options.data], data => {
|
|
3237
3129
|
const rowModel = {
|
|
@@ -3259,7 +3151,7 @@
|
|
|
3259
3151
|
// }
|
|
3260
3152
|
// Make the row
|
|
3261
3153
|
|
|
3262
|
-
row =
|
|
3154
|
+
row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
|
|
3263
3155
|
|
|
3264
3156
|
rowModel.flatRows.push(row); // Also keep track of every row by its ID
|
|
3265
3157
|
|
|
@@ -3322,7 +3214,7 @@
|
|
|
3322
3214
|
row = rowsToFilter[i];
|
|
3323
3215
|
|
|
3324
3216
|
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
3325
|
-
newRow =
|
|
3217
|
+
newRow = createRow(instance, row.id, row.original, row.index, row.depth);
|
|
3326
3218
|
newRow.columnFilters = row.columnFilters;
|
|
3327
3219
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3328
3220
|
|
|
@@ -3372,7 +3264,7 @@
|
|
|
3372
3264
|
var _row$subRows2;
|
|
3373
3265
|
|
|
3374
3266
|
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
|
|
3375
|
-
newRow =
|
|
3267
|
+
newRow = createRow(instance, row.id, row.original, row.index, row.depth);
|
|
3376
3268
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3377
3269
|
row = newRow;
|
|
3378
3270
|
}
|
|
@@ -3739,7 +3631,7 @@
|
|
|
3739
3631
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
|
|
3740
3632
|
|
|
3741
3633
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|
|
3742
|
-
const row =
|
|
3634
|
+
const row = createRow(instance, id, undefined, index, depth);
|
|
3743
3635
|
Object.assign(row, {
|
|
3744
3636
|
groupingColumnId: columnId,
|
|
3745
3637
|
groupingValue,
|
|
@@ -3748,38 +3640,30 @@
|
|
|
3748
3640
|
getValue: columnId => {
|
|
3749
3641
|
// Don't aggregate columns that are in the grouping
|
|
3750
3642
|
if (existingGrouping.includes(columnId)) {
|
|
3751
|
-
if (row.
|
|
3752
|
-
return row.
|
|
3643
|
+
if (row._valuesCache.hasOwnProperty(columnId)) {
|
|
3644
|
+
return row._valuesCache[columnId];
|
|
3753
3645
|
}
|
|
3754
3646
|
|
|
3755
3647
|
if (groupedRows[0]) {
|
|
3756
3648
|
var _groupedRows$0$getVal;
|
|
3757
3649
|
|
|
3758
|
-
row.
|
|
3650
|
+
row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
|
|
3759
3651
|
}
|
|
3760
3652
|
|
|
3761
|
-
return row.
|
|
3653
|
+
return row._valuesCache[columnId];
|
|
3762
3654
|
}
|
|
3763
3655
|
|
|
3764
|
-
if (row.
|
|
3765
|
-
return row.
|
|
3656
|
+
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
|
|
3657
|
+
return row._groupingValuesCache[columnId];
|
|
3766
3658
|
} // Aggregate the values
|
|
3767
3659
|
|
|
3768
3660
|
|
|
3769
3661
|
const column = instance.getColumn(columnId);
|
|
3770
|
-
const aggregateFn = column.
|
|
3662
|
+
const aggregateFn = column.getAggregationFn();
|
|
3771
3663
|
|
|
3772
3664
|
if (aggregateFn) {
|
|
3773
|
-
row.
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
if (!depth && column.columnDef.aggregateValue) {
|
|
3777
|
-
columnValue = column.columnDef.aggregateValue(columnValue);
|
|
3778
|
-
}
|
|
3779
|
-
|
|
3780
|
-
return columnValue;
|
|
3781
|
-
}), () => groupedRows.map(row => row.getValue(columnId)));
|
|
3782
|
-
return row.groupingValuesCache[columnId];
|
|
3665
|
+
row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
|
|
3666
|
+
return row._groupingValuesCache[columnId];
|
|
3783
3667
|
} else if (column.aggregationFn) {
|
|
3784
3668
|
console.info({
|
|
3785
3669
|
column
|
|
@@ -3859,7 +3743,7 @@
|
|
|
3859
3743
|
return rowModel;
|
|
3860
3744
|
}
|
|
3861
3745
|
|
|
3862
|
-
return expandRows(rowModel
|
|
3746
|
+
return expandRows(rowModel);
|
|
3863
3747
|
}, {
|
|
3864
3748
|
key: 'getExpandedRowModel',
|
|
3865
3749
|
debug: () => {
|
|
@@ -3877,7 +3761,7 @@
|
|
|
3877
3761
|
|
|
3878
3762
|
expandedRows.push(row);
|
|
3879
3763
|
|
|
3880
|
-
if (
|
|
3764
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
|
|
3881
3765
|
row.subRows.forEach(handleRow);
|
|
3882
3766
|
}
|
|
3883
3767
|
};
|
|
@@ -3914,7 +3798,7 @@
|
|
|
3914
3798
|
rows,
|
|
3915
3799
|
flatRows,
|
|
3916
3800
|
rowsById
|
|
3917
|
-
}
|
|
3801
|
+
});
|
|
3918
3802
|
}
|
|
3919
3803
|
|
|
3920
3804
|
return {
|
|
@@ -4141,6 +4025,8 @@
|
|
|
4141
4025
|
exports.Visibility = Visibility;
|
|
4142
4026
|
exports.aggregationFns = aggregationFns;
|
|
4143
4027
|
exports.buildHeaderGroups = buildHeaderGroups;
|
|
4028
|
+
exports.createColumn = createColumn;
|
|
4029
|
+
exports.createRow = createRow;
|
|
4144
4030
|
exports.createTable = createTable;
|
|
4145
4031
|
exports.createTableFactory = createTableFactory;
|
|
4146
4032
|
exports.createTableInstance = createTableInstance;
|
|
@@ -4161,7 +4047,6 @@
|
|
|
4161
4047
|
exports.isFunction = isFunction;
|
|
4162
4048
|
exports.isRowSelected = isRowSelected;
|
|
4163
4049
|
exports.makeStateUpdater = makeStateUpdater;
|
|
4164
|
-
exports.mean = mean;
|
|
4165
4050
|
exports.memo = memo;
|
|
4166
4051
|
exports.noop = noop;
|
|
4167
4052
|
exports.orderColumns = orderColumns;
|