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