@tanstack/table-core 8.0.0-alpha.82 → 8.0.0-alpha.85
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/aggregationFns.js +50 -51
- package/build/cjs/aggregationFns.js.map +1 -1
- 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/createTable.js +3 -2
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js +5 -5
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +11 -8
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +10 -10
- 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 +17 -11
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Sorting.js +8 -8
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js +3 -3
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/index.js +9 -6
- 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 +13 -20
- package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
- package/build/cjs/utils/getSortedRowModel.js +2 -2
- package/build/cjs/utils/getSortedRowModel.js.map +1 -1
- package/build/esm/index.js +764 -865
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +404 -381
- package/build/types/aggregationFns.d.ts +10 -19
- 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/createTable.d.ts +4 -4
- 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 -3
- package/build/types/features/Grouping.d.ts +8 -9
- 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 +3 -2
- 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 +12 -53
- package/build/umd/index.development.js +767 -863
- 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/aggregationFns.ts +44 -40
- 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/createTable.ts +7 -4
- package/src/features/ColumnSizing.ts +6 -6
- package/src/features/Expanding.ts +1 -2
- package/src/features/Filters.ts +9 -10
- package/src/features/Grouping.ts +20 -22
- package/src/features/Ordering.ts +1 -1
- package/src/features/Pagination.ts +1 -1
- package/src/features/Pinning.ts +18 -9
- package/src/features/RowSelection.ts +1 -1
- package/src/features/Sorting.ts +10 -10
- package/src/features/Visibility.ts +3 -3
- package/src/index.ts +4 -8
- package/src/types.ts +16 -64
- package/src/utils/filterRowsUtils.ts +4 -2
- package/src/utils/getCoreRowModel.ts +4 -2
- package/src/utils/getGroupedRowModel.ts +14 -22
- package/src/utils/getSortedRowModel.ts +2 -2
- 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 -189
- 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 -289
- package/src/features/Rows.ts +0 -142
package/build/esm/index.js
CHANGED
|
@@ -85,335 +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.getDefaultColumn == null ? void 0 : feature.getDefaultColumn());
|
|
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' && 'getDefaultColumn'
|
|
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
|
-
|
|
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;
|
|
124
234
|
|
|
125
|
-
|
|
126
|
-
accessorFn = columnDef.accessorFn;
|
|
127
|
-
} else if (columnDef.accessorKey) {
|
|
128
|
-
accessorFn = originalRow => originalRow[columnDef.accessorKey];
|
|
235
|
+
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
|
|
129
236
|
}
|
|
237
|
+
}),
|
|
238
|
+
getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
239
|
+
var _left$map$filter2;
|
|
130
240
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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;
|
|
135
247
|
|
|
136
|
-
|
|
248
|
+
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
|
|
137
249
|
}
|
|
250
|
+
}),
|
|
251
|
+
getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
252
|
+
var _right$map$filter2;
|
|
138
253
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
id: "" + id,
|
|
142
|
-
accessorFn,
|
|
143
|
-
parent: parent,
|
|
144
|
-
depth,
|
|
145
|
-
columnDef,
|
|
146
|
-
columnDefType: columnDef.columnDefType,
|
|
147
|
-
columns: [],
|
|
148
|
-
getFlatColumns: memo(() => [true], () => {
|
|
149
|
-
var _column$columns;
|
|
150
|
-
|
|
151
|
-
return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
|
|
152
|
-
}, {
|
|
153
|
-
key: process.env.NODE_ENV === 'production' && 'column.getFlatColumns',
|
|
154
|
-
debug: () => {
|
|
155
|
-
var _instance$options$deb2;
|
|
156
|
-
|
|
157
|
-
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
|
|
158
|
-
}
|
|
159
|
-
}),
|
|
160
|
-
getLeafColumns: memo(() => [instance._getOrderColumnsFn()], orderColumns => {
|
|
161
|
-
var _column$columns2;
|
|
162
|
-
|
|
163
|
-
if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
|
|
164
|
-
let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
|
|
165
|
-
return orderColumns(leafColumns);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return [column];
|
|
169
|
-
}, {
|
|
170
|
-
key: process.env.NODE_ENV === 'production' && 'column.getLeafColumns',
|
|
171
|
-
debug: () => {
|
|
172
|
-
var _instance$options$deb3;
|
|
173
|
-
|
|
174
|
-
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
|
|
175
|
-
}
|
|
176
|
-
})
|
|
177
|
-
};
|
|
178
|
-
column = instance._features.reduce((obj, feature) => {
|
|
179
|
-
return Object.assign(obj, feature.createColumn == null ? void 0 : feature.createColumn(column, instance));
|
|
180
|
-
}, column); // Yes, we have to convert instance to uknown, because we know more than the compiler here.
|
|
181
|
-
|
|
182
|
-
return column;
|
|
183
|
-
},
|
|
184
|
-
getAllColumns: memo(() => [instance.getColumnDefs()], columnDefs => {
|
|
185
|
-
const recurseColumns = function (columnDefs, parent, depth) {
|
|
186
|
-
if (depth === void 0) {
|
|
187
|
-
depth = 0;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return columnDefs.map(columnDef => {
|
|
191
|
-
const column = instance.createColumn(columnDef, depth, parent);
|
|
192
|
-
column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
|
|
193
|
-
return column;
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
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');
|
|
198
256
|
}, {
|
|
199
|
-
key: process.env.NODE_ENV === 'development' && '
|
|
257
|
+
key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
|
|
200
258
|
debug: () => {
|
|
201
259
|
var _instance$options$deb4;
|
|
202
260
|
|
|
203
|
-
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;
|
|
204
262
|
}
|
|
205
263
|
}),
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
});
|
|
264
|
+
// Footer Groups
|
|
265
|
+
getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
|
|
266
|
+
return [...headerGroups].reverse();
|
|
210
267
|
}, {
|
|
211
|
-
key: process.env.NODE_ENV === 'development' && '
|
|
268
|
+
key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
|
|
212
269
|
debug: () => {
|
|
213
270
|
var _instance$options$deb5;
|
|
214
271
|
|
|
215
|
-
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;
|
|
216
273
|
}
|
|
217
274
|
}),
|
|
218
|
-
|
|
219
|
-
return
|
|
220
|
-
acc[column.id] = column;
|
|
221
|
-
return acc;
|
|
222
|
-
}, {});
|
|
275
|
+
getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
|
|
276
|
+
return [...headerGroups].reverse();
|
|
223
277
|
}, {
|
|
224
|
-
key: process.env.NODE_ENV === 'development' && '
|
|
278
|
+
key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
|
|
225
279
|
debug: () => {
|
|
226
280
|
var _instance$options$deb6;
|
|
227
281
|
|
|
228
|
-
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;
|
|
229
283
|
}
|
|
230
284
|
}),
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return orderColumns(leafColumns);
|
|
285
|
+
getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
|
|
286
|
+
return [...headerGroups].reverse();
|
|
234
287
|
}, {
|
|
235
|
-
key: process.env.NODE_ENV === 'development' && '
|
|
288
|
+
key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
|
|
236
289
|
debug: () => {
|
|
237
290
|
var _instance$options$deb7;
|
|
238
291
|
|
|
239
|
-
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;
|
|
240
293
|
}
|
|
241
294
|
}),
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
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;
|
|
249
301
|
|
|
250
|
-
|
|
302
|
+
return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
|
|
251
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;
|
|
252
314
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
// ): CellsRow<TGenerics> => {
|
|
265
|
-
// return {}
|
|
266
|
-
// },
|
|
267
|
-
createInstance: instance => {
|
|
268
|
-
return {
|
|
269
|
-
getRowId: (row, index, parent) => {
|
|
270
|
-
var _instance$options$get;
|
|
271
|
-
|
|
272
|
-
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);
|
|
273
|
-
},
|
|
274
|
-
createRow: (id, original, rowIndex, depth, subRows) => {
|
|
275
|
-
let row = {
|
|
276
|
-
id,
|
|
277
|
-
index: rowIndex,
|
|
278
|
-
original,
|
|
279
|
-
depth,
|
|
280
|
-
valuesCache: {},
|
|
281
|
-
getValue: columnId => {
|
|
282
|
-
if (row.valuesCache.hasOwnProperty(columnId)) {
|
|
283
|
-
return row.valuesCache[columnId];
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
const column = instance.getColumn(columnId);
|
|
287
|
-
|
|
288
|
-
if (!column.accessorFn) {
|
|
289
|
-
return undefined;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
row.valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
293
|
-
return row.valuesCache[columnId];
|
|
294
|
-
},
|
|
295
|
-
subRows: subRows != null ? subRows : [],
|
|
296
|
-
getLeafRows: () => flattenBy(row.subRows, d => d.subRows)
|
|
297
|
-
};
|
|
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;
|
|
298
326
|
|
|
299
|
-
|
|
300
|
-
const feature = instance._features[i];
|
|
301
|
-
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;
|
|
302
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;
|
|
303
338
|
|
|
304
|
-
|
|
305
|
-
},
|
|
306
|
-
getCoreRowModel: () => {
|
|
307
|
-
if (!instance._getCoreRowModel) {
|
|
308
|
-
instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
|
|
339
|
+
return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
|
|
309
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;
|
|
310
350
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
//
|
|
315
|
-
|
|
316
|
-
return
|
|
317
|
-
|
|
318
|
-
getRow: id => {
|
|
319
|
-
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;
|
|
320
358
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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;
|
|
325
365
|
|
|
326
|
-
|
|
366
|
+
return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
|
|
327
367
|
}
|
|
368
|
+
}),
|
|
369
|
+
getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
|
|
370
|
+
return flatHeaders.filter(header => {
|
|
371
|
+
var _header$subHeaders2;
|
|
328
372
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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;
|
|
334
379
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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);
|
|
342
388
|
});
|
|
343
389
|
}, {
|
|
344
|
-
key: process.env.NODE_ENV === 'development' && '
|
|
390
|
+
key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
|
|
345
391
|
debug: () => {
|
|
346
|
-
var _instance$options$
|
|
392
|
+
var _instance$options$deb15;
|
|
347
393
|
|
|
348
|
-
return (_instance$options$
|
|
394
|
+
return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
|
|
349
395
|
}
|
|
350
396
|
}),
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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();
|
|
356
403
|
}, {
|
|
357
|
-
key: process.env.NODE_ENV === '
|
|
404
|
+
key: process.env.NODE_ENV === 'development' && 'getLeafHeaders',
|
|
358
405
|
debug: () => {
|
|
359
|
-
var _instance$options$
|
|
406
|
+
var _instance$options$deb16;
|
|
360
407
|
|
|
361
|
-
return (_instance$options$
|
|
408
|
+
return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
|
|
362
409
|
}
|
|
363
410
|
})
|
|
364
411
|
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
const cell = {
|
|
370
|
-
id: row.id + "_" + column.id,
|
|
371
|
-
rowId: row.id,
|
|
372
|
-
columnId,
|
|
373
|
-
row,
|
|
374
|
-
column,
|
|
375
|
-
getValue: () => row.getValue(columnId),
|
|
376
|
-
renderCell: () => column.cell ? instance._render(column.cell, {
|
|
377
|
-
instance,
|
|
378
|
-
column,
|
|
379
|
-
row,
|
|
380
|
-
cell: cell,
|
|
381
|
-
getValue: cell.getValue
|
|
382
|
-
}) : null
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
instance._features.forEach(feature => {
|
|
386
|
-
Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
|
|
387
|
-
}, {});
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
|
|
415
|
+
var _headerGroups$0$heade, _headerGroups$;
|
|
388
416
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
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;
|
|
393
423
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
424
|
+
const findMaxDepth = function (columns, depth) {
|
|
425
|
+
if (depth === void 0) {
|
|
426
|
+
depth = 1;
|
|
427
|
+
}
|
|
398
428
|
|
|
399
|
-
|
|
400
|
-
|
|
429
|
+
maxDepth = Math.max(maxDepth, depth);
|
|
430
|
+
columns.filter(column => column.getIsVisible()).forEach(column => {
|
|
431
|
+
var _column$columns;
|
|
401
432
|
|
|
402
|
-
|
|
433
|
+
if ((_column$columns = column.columns) != null && _column$columns.length) {
|
|
434
|
+
findMaxDepth(column.columns, depth + 1);
|
|
435
|
+
}
|
|
436
|
+
}, 0);
|
|
437
|
+
};
|
|
403
438
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
throw new Error("[Table] could not find cell " + columnId + " in row " + rowId);
|
|
407
|
-
}
|
|
439
|
+
findMaxDepth(allColumns);
|
|
440
|
+
let headerGroups = [];
|
|
408
441
|
|
|
409
|
-
|
|
410
|
-
|
|
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
|
|
449
|
+
|
|
450
|
+
const pendingParentHeaders = []; // Scan each column for parents
|
|
451
|
+
|
|
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;
|
|
411
458
|
|
|
412
|
-
|
|
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;
|
|
413
466
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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
|
|
483
|
+
|
|
484
|
+
pendingParentHeaders.push(header);
|
|
485
|
+
}
|
|
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
|
+
}
|
|
417
541
|
|
|
418
542
|
//
|
|
419
543
|
const defaultColumnSizing = {
|
|
@@ -432,7 +556,7 @@ const getDefaultColumnSizingInfoState = () => ({
|
|
|
432
556
|
});
|
|
433
557
|
|
|
434
558
|
const ColumnSizing = {
|
|
435
|
-
|
|
559
|
+
getDefaultColumnDef: () => {
|
|
436
560
|
return defaultColumnSizing;
|
|
437
561
|
},
|
|
438
562
|
getInitialState: state => {
|
|
@@ -452,10 +576,10 @@ const ColumnSizing = {
|
|
|
452
576
|
createColumn: (column, instance) => {
|
|
453
577
|
return {
|
|
454
578
|
getSize: () => {
|
|
455
|
-
var _column$
|
|
579
|
+
var _column$columnDef$min, _ref, _column$columnDef$max;
|
|
456
580
|
|
|
457
581
|
const columnSize = instance.getState().columnSizing[column.id];
|
|
458
|
-
return Math.min(Math.max((_column$
|
|
582
|
+
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
|
|
459
583
|
},
|
|
460
584
|
getStart: position => {
|
|
461
585
|
const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
|
|
@@ -478,9 +602,9 @@ const ColumnSizing = {
|
|
|
478
602
|
});
|
|
479
603
|
},
|
|
480
604
|
getCanResize: () => {
|
|
481
|
-
var _column$
|
|
605
|
+
var _column$columnDef$ena, _instance$options$ena;
|
|
482
606
|
|
|
483
|
-
return ((_column$
|
|
607
|
+
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
|
|
484
608
|
},
|
|
485
609
|
getIsResizing: () => {
|
|
486
610
|
return instance.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
@@ -937,7 +1061,7 @@ function testFalsey(val) {
|
|
|
937
1061
|
|
|
938
1062
|
//
|
|
939
1063
|
const Filters = {
|
|
940
|
-
|
|
1064
|
+
getDefaultColumnDef: () => {
|
|
941
1065
|
return {
|
|
942
1066
|
filterFn: 'auto'
|
|
943
1067
|
};
|
|
@@ -960,7 +1084,7 @@ const Filters = {
|
|
|
960
1084
|
getColumnCanGlobalFilter: column => {
|
|
961
1085
|
var _instance$getCoreRowM, _instance$getCoreRowM2;
|
|
962
1086
|
|
|
963
|
-
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();
|
|
964
1088
|
return typeof value === 'string';
|
|
965
1089
|
}
|
|
966
1090
|
};
|
|
@@ -980,6 +1104,10 @@ const Filters = {
|
|
|
980
1104
|
return filterFns.inNumberRange;
|
|
981
1105
|
}
|
|
982
1106
|
|
|
1107
|
+
if (typeof value === 'boolean') {
|
|
1108
|
+
return filterFns.equals;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
983
1111
|
if (value !== null && typeof value === 'object') {
|
|
984
1112
|
return filterFns.equals;
|
|
985
1113
|
}
|
|
@@ -997,14 +1125,14 @@ const Filters = {
|
|
|
997
1125
|
return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
|
|
998
1126
|
},
|
|
999
1127
|
getCanFilter: () => {
|
|
1000
|
-
var _column$
|
|
1128
|
+
var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
|
|
1001
1129
|
|
|
1002
|
-
return ((_column$
|
|
1130
|
+
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnFilters) != null ? _instance$options$ena : true) && ((_instance$options$ena2 = instance.options.enableFilters) != null ? _instance$options$ena2 : true) && !!column.accessorFn;
|
|
1003
1131
|
},
|
|
1004
1132
|
getCanGlobalFilter: () => {
|
|
1005
|
-
var _column$
|
|
1133
|
+
var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
|
|
1006
1134
|
|
|
1007
|
-
return ((_column$
|
|
1135
|
+
return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_instance$options$ena3 = instance.options.enableGlobalFilter) != null ? _instance$options$ena3 : true) && ((_instance$options$ena4 = instance.options.enableFilters) != null ? _instance$options$ena4 : true) && ((_instance$options$get = instance.options.getColumnCanGlobalFilter == null ? void 0 : instance.options.getColumnCanGlobalFilter(column)) != null ? _instance$options$get : true) && !!column.accessorFn;
|
|
1008
1136
|
},
|
|
1009
1137
|
getIsFiltered: () => column.getFilterIndex() > -1,
|
|
1010
1138
|
getFilterValue: () => {
|
|
@@ -1084,8 +1212,7 @@ const Filters = {
|
|
|
1084
1212
|
createRow: (row, instance) => {
|
|
1085
1213
|
return {
|
|
1086
1214
|
columnFilters: {},
|
|
1087
|
-
columnFiltersMeta: {}
|
|
1088
|
-
subRowsByFacetId: {}
|
|
1215
|
+
columnFiltersMeta: {}
|
|
1089
1216
|
};
|
|
1090
1217
|
},
|
|
1091
1218
|
createInstance: instance => {
|
|
@@ -1176,53 +1303,42 @@ function shouldAutoRemoveFilter(filterFn, value, column) {
|
|
|
1176
1303
|
return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === 'undefined' || typeof value === 'string' && !value;
|
|
1177
1304
|
}
|
|
1178
1305
|
|
|
1179
|
-
const
|
|
1180
|
-
sum,
|
|
1181
|
-
min,
|
|
1182
|
-
max,
|
|
1183
|
-
extent,
|
|
1184
|
-
mean,
|
|
1185
|
-
median,
|
|
1186
|
-
unique,
|
|
1187
|
-
uniqueCount,
|
|
1188
|
-
count
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
function sum(_getLeafValues, getChildValues) {
|
|
1306
|
+
const sum = (columnId, _leafRows, childRows) => {
|
|
1192
1307
|
// It's faster to just add the aggregations together instead of
|
|
1193
1308
|
// process leaf nodes individually
|
|
1194
|
-
return
|
|
1195
|
-
}
|
|
1309
|
+
return childRows.reduce((sum, next) => sum + (typeof next === 'number' ? next : 0), 0);
|
|
1310
|
+
};
|
|
1196
1311
|
|
|
1197
|
-
|
|
1312
|
+
const min = (columnId, _leafRows, childRows) => {
|
|
1198
1313
|
let min;
|
|
1314
|
+
childRows.forEach(row => {
|
|
1315
|
+
const value = row.getValue(columnId);
|
|
1199
1316
|
|
|
1200
|
-
for (const value of getChildValues()) {
|
|
1201
1317
|
if (value != null && (min > value || min === undefined && value >= value)) {
|
|
1202
1318
|
min = value;
|
|
1203
1319
|
}
|
|
1204
|
-
}
|
|
1205
|
-
|
|
1320
|
+
});
|
|
1206
1321
|
return min;
|
|
1207
|
-
}
|
|
1322
|
+
};
|
|
1208
1323
|
|
|
1209
|
-
|
|
1324
|
+
const max = (columnId, _leafRows, childRows) => {
|
|
1210
1325
|
let max;
|
|
1326
|
+
childRows.forEach(row => {
|
|
1327
|
+
const value = row.getValue(columnId);
|
|
1211
1328
|
|
|
1212
|
-
for (const value of getChildValues()) {
|
|
1213
1329
|
if (value != null && (max < value || max === undefined && value >= value)) {
|
|
1214
1330
|
max = value;
|
|
1215
1331
|
}
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1332
|
+
});
|
|
1218
1333
|
return max;
|
|
1219
|
-
}
|
|
1334
|
+
};
|
|
1220
1335
|
|
|
1221
|
-
|
|
1336
|
+
const extent = (columnId, _leafRows, childRows) => {
|
|
1222
1337
|
let min;
|
|
1223
1338
|
let max;
|
|
1339
|
+
childRows.forEach(row => {
|
|
1340
|
+
const value = row.getValue(columnId);
|
|
1224
1341
|
|
|
1225
|
-
for (const value of getChildValues()) {
|
|
1226
1342
|
if (value != null) {
|
|
1227
1343
|
if (min === undefined) {
|
|
1228
1344
|
if (value >= value) min = max = value;
|
|
@@ -1231,58 +1347,69 @@ function extent(_getLeafValues, getChildValues) {
|
|
|
1231
1347
|
if (max < value) max = value;
|
|
1232
1348
|
}
|
|
1233
1349
|
}
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1350
|
+
});
|
|
1236
1351
|
return [min, max];
|
|
1237
|
-
}
|
|
1352
|
+
};
|
|
1238
1353
|
|
|
1239
|
-
|
|
1354
|
+
const mean = (columnId, leafRows) => {
|
|
1240
1355
|
let count = 0;
|
|
1241
1356
|
let sum = 0;
|
|
1357
|
+
leafRows.forEach(row => {
|
|
1358
|
+
let value = row.getValue(columnId);
|
|
1242
1359
|
|
|
1243
|
-
for (let value of getLeafValues()) {
|
|
1244
1360
|
if (value != null && (value = +value) >= value) {
|
|
1245
1361
|
++count, sum += value;
|
|
1246
1362
|
}
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1363
|
+
});
|
|
1249
1364
|
if (count) return sum / count;
|
|
1250
1365
|
return;
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
function median(getLeafValues) {
|
|
1254
|
-
const leafValues = getLeafValues();
|
|
1366
|
+
};
|
|
1255
1367
|
|
|
1256
|
-
|
|
1368
|
+
const median = (columnId, leafRows) => {
|
|
1369
|
+
if (!leafRows.length) {
|
|
1257
1370
|
return;
|
|
1258
1371
|
}
|
|
1259
1372
|
|
|
1260
1373
|
let min = 0;
|
|
1261
1374
|
let max = 0;
|
|
1262
|
-
|
|
1375
|
+
leafRows.forEach(row => {
|
|
1376
|
+
let value = row.getValue(columnId);
|
|
1377
|
+
|
|
1263
1378
|
if (typeof value === 'number') {
|
|
1264
1379
|
min = Math.min(min, value);
|
|
1265
1380
|
max = Math.max(max, value);
|
|
1266
1381
|
}
|
|
1267
1382
|
});
|
|
1268
1383
|
return (min + max) / 2;
|
|
1269
|
-
}
|
|
1384
|
+
};
|
|
1270
1385
|
|
|
1271
|
-
|
|
1272
|
-
return Array.from(new Set(
|
|
1273
|
-
}
|
|
1386
|
+
const unique = (columnId, leafRows) => {
|
|
1387
|
+
return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
|
|
1388
|
+
};
|
|
1274
1389
|
|
|
1275
|
-
|
|
1276
|
-
return new Set(
|
|
1277
|
-
}
|
|
1390
|
+
const uniqueCount = (columnId, leafRows) => {
|
|
1391
|
+
return new Set(leafRows.map(d => d.getValue(columnId))).size;
|
|
1392
|
+
};
|
|
1278
1393
|
|
|
1279
|
-
|
|
1280
|
-
return
|
|
1281
|
-
}
|
|
1394
|
+
const count = (_columnId, leafRows) => {
|
|
1395
|
+
return leafRows.length;
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
const aggregationFns = {
|
|
1399
|
+
sum,
|
|
1400
|
+
min,
|
|
1401
|
+
max,
|
|
1402
|
+
extent,
|
|
1403
|
+
mean,
|
|
1404
|
+
median,
|
|
1405
|
+
unique,
|
|
1406
|
+
uniqueCount,
|
|
1407
|
+
count
|
|
1408
|
+
};
|
|
1282
1409
|
|
|
1283
1410
|
//
|
|
1284
1411
|
const Grouping = {
|
|
1285
|
-
|
|
1412
|
+
getDefaultColumnDef: () => {
|
|
1286
1413
|
return {
|
|
1287
1414
|
aggregationFn: 'auto'
|
|
1288
1415
|
};
|
|
@@ -1312,9 +1439,9 @@ const Grouping = {
|
|
|
1312
1439
|
});
|
|
1313
1440
|
},
|
|
1314
1441
|
getCanGroup: () => {
|
|
1315
|
-
var _ref, _ref2, _ref3, _column$
|
|
1442
|
+
var _ref, _ref2, _ref3, _column$columnDef$ena;
|
|
1316
1443
|
|
|
1317
|
-
return (_ref = (_ref2 = (_ref3 = (_column$
|
|
1444
|
+
return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : instance.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
|
|
1318
1445
|
},
|
|
1319
1446
|
getIsGrouped: () => {
|
|
1320
1447
|
var _instance$getState$gr;
|
|
@@ -1333,7 +1460,7 @@ const Grouping = {
|
|
|
1333
1460
|
column.toggleGrouping();
|
|
1334
1461
|
};
|
|
1335
1462
|
},
|
|
1336
|
-
|
|
1463
|
+
getAutoAggregationFn: () => {
|
|
1337
1464
|
const firstRow = instance.getCoreRowModel().flatRows[0];
|
|
1338
1465
|
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
1339
1466
|
|
|
@@ -1347,7 +1474,7 @@ const Grouping = {
|
|
|
1347
1474
|
|
|
1348
1475
|
return aggregationFns.count;
|
|
1349
1476
|
},
|
|
1350
|
-
|
|
1477
|
+
getAggregationFn: () => {
|
|
1351
1478
|
var _ref4;
|
|
1352
1479
|
|
|
1353
1480
|
const userAggregationFns = instance.options.aggregationFns;
|
|
@@ -1356,7 +1483,7 @@ const Grouping = {
|
|
|
1356
1483
|
throw new Error();
|
|
1357
1484
|
}
|
|
1358
1485
|
|
|
1359
|
-
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? column.
|
|
1486
|
+
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_ref4 = userAggregationFns == null ? void 0 : userAggregationFns[column.aggregationFn]) != null ? _ref4 : aggregationFns[column.aggregationFn];
|
|
1360
1487
|
}
|
|
1361
1488
|
};
|
|
1362
1489
|
},
|
|
@@ -1382,10 +1509,10 @@ const Grouping = {
|
|
|
1382
1509
|
}
|
|
1383
1510
|
};
|
|
1384
1511
|
},
|
|
1385
|
-
createRow:
|
|
1512
|
+
createRow: row => {
|
|
1386
1513
|
return {
|
|
1387
1514
|
getIsGrouped: () => !!row.groupingColumnId,
|
|
1388
|
-
|
|
1515
|
+
_groupingValuesCache: {}
|
|
1389
1516
|
};
|
|
1390
1517
|
},
|
|
1391
1518
|
createCell: (cell, column, row, instance) => {
|
|
@@ -1398,9 +1525,9 @@ const Grouping = {
|
|
|
1398
1525
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
|
|
1399
1526
|
},
|
|
1400
1527
|
renderAggregatedCell: () => {
|
|
1401
|
-
var _column$
|
|
1528
|
+
var _column$columnDef$agg;
|
|
1402
1529
|
|
|
1403
|
-
const template = (_column$
|
|
1530
|
+
const template = (_column$columnDef$agg = column.columnDef.aggregatedCell) != null ? _column$columnDef$agg : column.columnDef.cell;
|
|
1404
1531
|
return template ? instance._render(template, {
|
|
1405
1532
|
instance,
|
|
1406
1533
|
column,
|
|
@@ -1707,9 +1834,9 @@ const Pinning = {
|
|
|
1707
1834
|
getCanPin: () => {
|
|
1708
1835
|
const leafColumns = column.getLeafColumns();
|
|
1709
1836
|
return leafColumns.some(d => {
|
|
1710
|
-
var _d$
|
|
1837
|
+
var _d$columnDef$enablePi, _instance$options$ena;
|
|
1711
1838
|
|
|
1712
|
-
return ((_d$
|
|
1839
|
+
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
|
|
1713
1840
|
});
|
|
1714
1841
|
},
|
|
1715
1842
|
getIsPinned: () => {
|
|
@@ -1734,7 +1861,7 @@ const Pinning = {
|
|
|
1734
1861
|
return {
|
|
1735
1862
|
getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allCells, left, right) => {
|
|
1736
1863
|
const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
|
|
1737
|
-
return allCells.filter(d => !leftAndRight.includes(d.
|
|
1864
|
+
return allCells.filter(d => !leftAndRight.includes(d.column.id));
|
|
1738
1865
|
}, {
|
|
1739
1866
|
key: process.env.NODE_ENV === 'production' && 'row.getCenterVisibleCells',
|
|
1740
1867
|
debug: () => {
|
|
@@ -1744,7 +1871,7 @@ const Pinning = {
|
|
|
1744
1871
|
}
|
|
1745
1872
|
}),
|
|
1746
1873
|
getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.left,,], (allCells, left) => {
|
|
1747
|
-
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.
|
|
1874
|
+
const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
|
|
1748
1875
|
position: 'left'
|
|
1749
1876
|
}));
|
|
1750
1877
|
return cells;
|
|
@@ -1757,7 +1884,7 @@ const Pinning = {
|
|
|
1757
1884
|
}
|
|
1758
1885
|
}),
|
|
1759
1886
|
getRightVisibleCells: memo(() => [row._getAllVisibleCells(), instance.getState().columnPinning.right], (allCells, right) => {
|
|
1760
|
-
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.
|
|
1887
|
+
const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({ ...d,
|
|
1761
1888
|
position: 'left'
|
|
1762
1889
|
}));
|
|
1763
1890
|
return cells;
|
|
@@ -1779,12 +1906,18 @@ const Pinning = {
|
|
|
1779
1906
|
|
|
1780
1907
|
return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
|
|
1781
1908
|
},
|
|
1782
|
-
getIsSomeColumnsPinned:
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1909
|
+
getIsSomeColumnsPinned: position => {
|
|
1910
|
+
var _pinningState$positio;
|
|
1911
|
+
|
|
1912
|
+
const pinningState = instance.getState().columnPinning;
|
|
1913
|
+
|
|
1914
|
+
if (!position) {
|
|
1915
|
+
var _pinningState$left, _pinningState$right;
|
|
1916
|
+
|
|
1917
|
+
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
1788
1921
|
},
|
|
1789
1922
|
getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
|
|
1790
1923
|
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
@@ -2310,7 +2443,7 @@ const Sorting = {
|
|
|
2310
2443
|
...state
|
|
2311
2444
|
};
|
|
2312
2445
|
},
|
|
2313
|
-
|
|
2446
|
+
getDefaultColumnDef: () => {
|
|
2314
2447
|
return {
|
|
2315
2448
|
sortingFn: 'auto'
|
|
2316
2449
|
};
|
|
@@ -2370,7 +2503,7 @@ const Sorting = {
|
|
|
2370
2503
|
throw new Error();
|
|
2371
2504
|
}
|
|
2372
2505
|
|
|
2373
|
-
return isFunction(column.sortingFn) ? column.sortingFn : column.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.sortingFn]) != null ? _ref : sortingFns[column.sortingFn];
|
|
2506
|
+
return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.columnDef.sortingFn]) != null ? _ref : sortingFns[column.columnDef.sortingFn];
|
|
2374
2507
|
},
|
|
2375
2508
|
toggleSorting: (desc, multi) => {
|
|
2376
2509
|
// if (column.columns.length) {
|
|
@@ -2382,7 +2515,7 @@ const Sorting = {
|
|
|
2382
2515
|
// return
|
|
2383
2516
|
// }
|
|
2384
2517
|
instance.setSorting(old => {
|
|
2385
|
-
var _ref2, _column$
|
|
2518
|
+
var _ref2, _column$columnDef$sor, _instance$options$ena, _instance$options$ena2;
|
|
2386
2519
|
|
|
2387
2520
|
// Find any existing sorting for this column
|
|
2388
2521
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2409,7 +2542,7 @@ const Sorting = {
|
|
|
2409
2542
|
}
|
|
2410
2543
|
}
|
|
2411
2544
|
|
|
2412
|
-
const sortDescFirst = (_ref2 = (_column$
|
|
2545
|
+
const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc'; // Handle toggle states that will remove the sorting
|
|
2413
2546
|
|
|
2414
2547
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2415
2548
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
@@ -2453,14 +2586,14 @@ const Sorting = {
|
|
|
2453
2586
|
});
|
|
2454
2587
|
},
|
|
2455
2588
|
getCanSort: () => {
|
|
2456
|
-
var _column$
|
|
2589
|
+
var _column$columnDef$ena, _instance$options$ena3;
|
|
2457
2590
|
|
|
2458
|
-
return ((_column$
|
|
2591
|
+
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_instance$options$ena3 = instance.options.enableSorting) != null ? _instance$options$ena3 : true) && !!column.accessorFn;
|
|
2459
2592
|
},
|
|
2460
2593
|
getCanMultiSort: () => {
|
|
2461
|
-
var _ref3, _column$
|
|
2594
|
+
var _ref3, _column$columnDef$ena2;
|
|
2462
2595
|
|
|
2463
|
-
return (_ref3 = (_column$
|
|
2596
|
+
return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
|
|
2464
2597
|
},
|
|
2465
2598
|
getIsSorted: () => {
|
|
2466
2599
|
var _instance$getState$so;
|
|
@@ -2524,7 +2657,7 @@ const Visibility = {
|
|
|
2524
2657
|
onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
|
|
2525
2658
|
};
|
|
2526
2659
|
},
|
|
2527
|
-
|
|
2660
|
+
getDefaultColumnDef: () => {
|
|
2528
2661
|
return {
|
|
2529
2662
|
defaultIsVisible: true
|
|
2530
2663
|
};
|
|
@@ -2544,9 +2677,9 @@ const Visibility = {
|
|
|
2544
2677
|
return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
|
|
2545
2678
|
},
|
|
2546
2679
|
getCanHide: () => {
|
|
2547
|
-
var _column$
|
|
2680
|
+
var _column$columnDef$ena, _instance$options$ena;
|
|
2548
2681
|
|
|
2549
|
-
return ((_column$
|
|
2682
|
+
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
|
|
2550
2683
|
},
|
|
2551
2684
|
getToggleVisibilityHandler: () => {
|
|
2552
2685
|
return e => {
|
|
@@ -2562,475 +2695,70 @@ const Visibility = {
|
|
|
2562
2695
|
}, {
|
|
2563
2696
|
key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
|
|
2564
2697
|
debug: () => {
|
|
2565
|
-
var _instance$options$deb;
|
|
2566
|
-
|
|
2567
|
-
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
|
|
2568
|
-
}
|
|
2569
|
-
}),
|
|
2570
|
-
getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
|
|
2571
|
-
key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
|
|
2572
|
-
debug: () => {
|
|
2573
|
-
var _instance$options$deb2;
|
|
2574
|
-
|
|
2575
|
-
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
|
|
2576
|
-
}
|
|
2577
|
-
})
|
|
2578
|
-
};
|
|
2579
|
-
},
|
|
2580
|
-
createInstance: instance => {
|
|
2581
|
-
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
2582
|
-
return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
|
|
2583
|
-
return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
2584
|
-
}, {
|
|
2585
|
-
key,
|
|
2586
|
-
debug: () => {
|
|
2587
|
-
var _instance$options$deb3;
|
|
2588
|
-
|
|
2589
|
-
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
|
|
2590
|
-
}
|
|
2591
|
-
});
|
|
2592
|
-
};
|
|
2593
|
-
|
|
2594
|
-
return {
|
|
2595
|
-
getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
|
|
2596
|
-
getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
|
|
2597
|
-
getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
|
|
2598
|
-
getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
|
|
2599
|
-
getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
|
|
2600
|
-
setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
|
|
2601
|
-
resetColumnVisibility: defaultState => {
|
|
2602
|
-
var _instance$initialStat;
|
|
2603
|
-
|
|
2604
|
-
instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
|
|
2605
|
-
},
|
|
2606
|
-
toggleAllColumnsVisible: value => {
|
|
2607
|
-
var _value;
|
|
2608
|
-
|
|
2609
|
-
value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
|
|
2610
|
-
instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
|
|
2611
|
-
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
|
|
2612
|
-
}), {}));
|
|
2613
|
-
},
|
|
2614
|
-
getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
|
|
2615
|
-
getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
|
|
2616
|
-
getToggleAllColumnsVisibilityHandler: () => {
|
|
2617
|
-
return e => {
|
|
2618
|
-
var _target;
|
|
2619
|
-
|
|
2620
|
-
instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
|
|
2621
|
-
};
|
|
2622
|
-
}
|
|
2623
|
-
};
|
|
2624
|
-
}
|
|
2625
|
-
};
|
|
2626
|
-
|
|
2627
|
-
//
|
|
2628
|
-
const Headers = {
|
|
2629
|
-
createInstance: instance => {
|
|
2630
|
-
return {
|
|
2631
|
-
createHeader: (column, options) => {
|
|
2632
|
-
var _options$id;
|
|
2633
|
-
|
|
2634
|
-
const id = (_options$id = options.id) != null ? _options$id : column.id;
|
|
2635
|
-
let header = {
|
|
2636
|
-
id,
|
|
2637
|
-
column,
|
|
2638
|
-
index: options.index,
|
|
2639
|
-
isPlaceholder: options.isPlaceholder,
|
|
2640
|
-
placeholderId: options.placeholderId,
|
|
2641
|
-
depth: options.depth,
|
|
2642
|
-
subHeaders: [],
|
|
2643
|
-
colSpan: 0,
|
|
2644
|
-
rowSpan: 0,
|
|
2645
|
-
headerGroup: null,
|
|
2646
|
-
getLeafHeaders: () => {
|
|
2647
|
-
const leafHeaders = [];
|
|
2648
|
-
|
|
2649
|
-
const recurseHeader = h => {
|
|
2650
|
-
if (h.subHeaders && h.subHeaders.length) {
|
|
2651
|
-
h.subHeaders.map(recurseHeader);
|
|
2652
|
-
}
|
|
2653
|
-
|
|
2654
|
-
leafHeaders.push(h);
|
|
2655
|
-
};
|
|
2656
|
-
|
|
2657
|
-
recurseHeader(header);
|
|
2658
|
-
return leafHeaders;
|
|
2659
|
-
},
|
|
2660
|
-
renderHeader: () => column.header ? instance._render(column.header, {
|
|
2661
|
-
instance,
|
|
2662
|
-
header: header,
|
|
2663
|
-
column
|
|
2664
|
-
}) : null,
|
|
2665
|
-
renderFooter: () => column.footer ? instance._render(column.footer, {
|
|
2666
|
-
instance,
|
|
2667
|
-
header: header,
|
|
2668
|
-
column
|
|
2669
|
-
}) : null
|
|
2670
|
-
};
|
|
2671
|
-
|
|
2672
|
-
instance._features.forEach(feature => {
|
|
2673
|
-
Object.assign(header, feature.createHeader == null ? void 0 : feature.createHeader(header, instance));
|
|
2674
|
-
});
|
|
2675
|
-
|
|
2676
|
-
return header;
|
|
2677
|
-
},
|
|
2678
|
-
// Header Groups
|
|
2679
|
-
getHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
2680
|
-
var _left$map$filter, _right$map$filter;
|
|
2681
|
-
|
|
2682
|
-
const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
|
|
2683
|
-
const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
|
|
2684
|
-
const centerColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
2685
|
-
const headerGroups = buildHeaderGroups(allColumns, [...leftColumns, ...centerColumns, ...rightColumns], instance);
|
|
2686
|
-
return headerGroups;
|
|
2687
|
-
}, {
|
|
2688
|
-
key: process.env.NODE_ENV === 'development' && 'getHeaderGroups',
|
|
2689
|
-
debug: () => {
|
|
2690
|
-
var _instance$options$deb;
|
|
2691
|
-
|
|
2692
|
-
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugHeaders;
|
|
2693
|
-
}
|
|
2694
|
-
}),
|
|
2695
|
-
getCenterHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
|
|
2696
|
-
leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
|
|
2697
|
-
return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
|
|
2698
|
-
}, {
|
|
2699
|
-
key: process.env.NODE_ENV === 'development' && 'getCenterHeaderGroups',
|
|
2700
|
-
debug: () => {
|
|
2701
|
-
var _instance$options$deb2;
|
|
2702
|
-
|
|
2703
|
-
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugHeaders;
|
|
2704
|
-
}
|
|
2705
|
-
}),
|
|
2706
|
-
getLeftHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left], (allColumns, leafColumns, left) => {
|
|
2707
|
-
var _left$map$filter2;
|
|
2708
|
-
|
|
2709
|
-
const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
|
|
2710
|
-
return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'left');
|
|
2711
|
-
}, {
|
|
2712
|
-
key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
|
|
2713
|
-
debug: () => {
|
|
2714
|
-
var _instance$options$deb3;
|
|
2715
|
-
|
|
2716
|
-
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugHeaders;
|
|
2717
|
-
}
|
|
2718
|
-
}),
|
|
2719
|
-
getRightHeaderGroups: memo(() => [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right], (allColumns, leafColumns, right) => {
|
|
2720
|
-
var _right$map$filter2;
|
|
2721
|
-
|
|
2722
|
-
const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
|
|
2723
|
-
return buildHeaderGroups(allColumns, orderedLeafColumns, instance, 'right');
|
|
2724
|
-
}, {
|
|
2725
|
-
key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',
|
|
2726
|
-
debug: () => {
|
|
2727
|
-
var _instance$options$deb4;
|
|
2728
|
-
|
|
2729
|
-
return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugHeaders;
|
|
2730
|
-
}
|
|
2731
|
-
}),
|
|
2732
|
-
// Footer Groups
|
|
2733
|
-
getFooterGroups: memo(() => [instance.getHeaderGroups()], headerGroups => {
|
|
2734
|
-
return [...headerGroups].reverse();
|
|
2735
|
-
}, {
|
|
2736
|
-
key: process.env.NODE_ENV === 'development' && 'getFooterGroups',
|
|
2737
|
-
debug: () => {
|
|
2738
|
-
var _instance$options$deb5;
|
|
2739
|
-
|
|
2740
|
-
return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugHeaders;
|
|
2741
|
-
}
|
|
2742
|
-
}),
|
|
2743
|
-
getLeftFooterGroups: memo(() => [instance.getLeftHeaderGroups()], headerGroups => {
|
|
2744
|
-
return [...headerGroups].reverse();
|
|
2745
|
-
}, {
|
|
2746
|
-
key: process.env.NODE_ENV === 'development' && 'getLeftFooterGroups',
|
|
2747
|
-
debug: () => {
|
|
2748
|
-
var _instance$options$deb6;
|
|
2749
|
-
|
|
2750
|
-
return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
|
|
2751
|
-
}
|
|
2752
|
-
}),
|
|
2753
|
-
getCenterFooterGroups: memo(() => [instance.getCenterHeaderGroups()], headerGroups => {
|
|
2754
|
-
return [...headerGroups].reverse();
|
|
2755
|
-
}, {
|
|
2756
|
-
key: process.env.NODE_ENV === 'development' && 'getCenterFooterGroups',
|
|
2757
|
-
debug: () => {
|
|
2758
|
-
var _instance$options$deb7;
|
|
2759
|
-
|
|
2760
|
-
return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
|
|
2761
|
-
}
|
|
2762
|
-
}),
|
|
2763
|
-
getRightFooterGroups: memo(() => [instance.getRightHeaderGroups()], headerGroups => {
|
|
2764
|
-
return [...headerGroups].reverse();
|
|
2765
|
-
}, {
|
|
2766
|
-
key: process.env.NODE_ENV === 'development' && 'getRightFooterGroups',
|
|
2767
|
-
debug: () => {
|
|
2768
|
-
var _instance$options$deb8;
|
|
2769
|
-
|
|
2770
|
-
return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
|
|
2771
|
-
}
|
|
2772
|
-
}),
|
|
2773
|
-
// Flat Headers
|
|
2774
|
-
getFlatHeaders: memo(() => [instance.getHeaderGroups()], headerGroups => {
|
|
2775
|
-
return headerGroups.map(headerGroup => {
|
|
2776
|
-
return headerGroup.headers;
|
|
2777
|
-
}).flat();
|
|
2778
|
-
}, {
|
|
2779
|
-
key: process.env.NODE_ENV === 'development' && 'getFlatHeaders',
|
|
2780
|
-
debug: () => {
|
|
2781
|
-
var _instance$options$deb9;
|
|
2782
|
-
|
|
2783
|
-
return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
|
|
2784
|
-
}
|
|
2785
|
-
}),
|
|
2786
|
-
getLeftFlatHeaders: memo(() => [instance.getLeftHeaderGroups()], left => {
|
|
2787
|
-
return left.map(headerGroup => {
|
|
2788
|
-
return headerGroup.headers;
|
|
2789
|
-
}).flat();
|
|
2790
|
-
}, {
|
|
2791
|
-
key: process.env.NODE_ENV === 'development' && 'getLeftFlatHeaders',
|
|
2792
|
-
debug: () => {
|
|
2793
|
-
var _instance$options$deb10;
|
|
2794
|
-
|
|
2795
|
-
return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
|
|
2796
|
-
}
|
|
2797
|
-
}),
|
|
2798
|
-
getCenterFlatHeaders: memo(() => [instance.getCenterHeaderGroups()], left => {
|
|
2799
|
-
return left.map(headerGroup => {
|
|
2800
|
-
return headerGroup.headers;
|
|
2801
|
-
}).flat();
|
|
2802
|
-
}, {
|
|
2803
|
-
key: process.env.NODE_ENV === 'development' && 'getCenterFlatHeaders',
|
|
2804
|
-
debug: () => {
|
|
2805
|
-
var _instance$options$deb11;
|
|
2806
|
-
|
|
2807
|
-
return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
|
|
2808
|
-
}
|
|
2809
|
-
}),
|
|
2810
|
-
getRightFlatHeaders: memo(() => [instance.getRightHeaderGroups()], left => {
|
|
2811
|
-
return left.map(headerGroup => {
|
|
2812
|
-
return headerGroup.headers;
|
|
2813
|
-
}).flat();
|
|
2814
|
-
}, {
|
|
2815
|
-
key: process.env.NODE_ENV === 'development' && 'getRightFlatHeaders',
|
|
2816
|
-
debug: () => {
|
|
2817
|
-
var _instance$options$deb12;
|
|
2818
|
-
|
|
2819
|
-
return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
|
|
2820
|
-
}
|
|
2821
|
-
}),
|
|
2822
|
-
// Leaf Headers
|
|
2823
|
-
getCenterLeafHeaders: memo(() => [instance.getCenterFlatHeaders()], flatHeaders => {
|
|
2824
|
-
return flatHeaders.filter(header => {
|
|
2825
|
-
var _header$subHeaders;
|
|
2826
|
-
|
|
2827
|
-
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
|
|
2828
|
-
});
|
|
2829
|
-
}, {
|
|
2830
|
-
key: process.env.NODE_ENV === 'development' && 'getCenterLeafHeaders',
|
|
2831
|
-
debug: () => {
|
|
2832
|
-
var _instance$options$deb13;
|
|
2833
|
-
|
|
2834
|
-
return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
|
|
2835
|
-
}
|
|
2836
|
-
}),
|
|
2837
|
-
getLeftLeafHeaders: memo(() => [instance.getLeftFlatHeaders()], flatHeaders => {
|
|
2838
|
-
return flatHeaders.filter(header => {
|
|
2839
|
-
var _header$subHeaders2;
|
|
2840
|
-
|
|
2841
|
-
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
|
|
2842
|
-
});
|
|
2843
|
-
}, {
|
|
2844
|
-
key: process.env.NODE_ENV === 'development' && 'getLeftLeafHeaders',
|
|
2845
|
-
debug: () => {
|
|
2846
|
-
var _instance$options$deb14;
|
|
2847
|
-
|
|
2848
|
-
return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
|
|
2849
|
-
}
|
|
2850
|
-
}),
|
|
2851
|
-
getRightLeafHeaders: memo(() => [instance.getRightFlatHeaders()], flatHeaders => {
|
|
2852
|
-
return flatHeaders.filter(header => {
|
|
2853
|
-
var _header$subHeaders3;
|
|
2854
|
-
|
|
2855
|
-
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
|
|
2856
|
-
});
|
|
2857
|
-
}, {
|
|
2858
|
-
key: process.env.NODE_ENV === 'development' && 'getRightLeafHeaders',
|
|
2859
|
-
debug: () => {
|
|
2860
|
-
var _instance$options$deb15;
|
|
2698
|
+
var _instance$options$deb;
|
|
2861
2699
|
|
|
2862
|
-
return (_instance$options$
|
|
2700
|
+
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
|
|
2863
2701
|
}
|
|
2864
2702
|
}),
|
|
2865
|
-
|
|
2866
|
-
|
|
2703
|
+
getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
|
|
2704
|
+
key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
|
|
2705
|
+
debug: () => {
|
|
2706
|
+
var _instance$options$deb2;
|
|
2867
2707
|
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2708
|
+
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
|
|
2709
|
+
}
|
|
2710
|
+
})
|
|
2711
|
+
};
|
|
2712
|
+
},
|
|
2713
|
+
createInstance: instance => {
|
|
2714
|
+
const makeVisibleColumnsMethod = (key, getColumns) => {
|
|
2715
|
+
return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
|
|
2716
|
+
return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
|
|
2871
2717
|
}, {
|
|
2872
|
-
key
|
|
2718
|
+
key,
|
|
2873
2719
|
debug: () => {
|
|
2874
|
-
var _instance$options$
|
|
2720
|
+
var _instance$options$deb3;
|
|
2875
2721
|
|
|
2876
|
-
return (_instance$options$
|
|
2722
|
+
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
|
|
2877
2723
|
}
|
|
2878
|
-
})
|
|
2879
|
-
|
|
2880
|
-
const header = [...instance.getFlatHeaders(), ...instance.getCenterFlatHeaders(), ...instance.getLeftFlatHeaders(), ...instance.getRightFlatHeaders()].find(d => d.id === id);
|
|
2724
|
+
});
|
|
2725
|
+
};
|
|
2881
2726
|
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2727
|
+
return {
|
|
2728
|
+
getVisibleFlatColumns: makeVisibleColumnsMethod('getVisibleFlatColumns', () => instance.getAllFlatColumns()),
|
|
2729
|
+
getVisibleLeafColumns: makeVisibleColumnsMethod('getVisibleLeafColumns', () => instance.getAllLeafColumns()),
|
|
2730
|
+
getLeftVisibleLeafColumns: makeVisibleColumnsMethod('getLeftVisibleLeafColumns', () => instance.getLeftLeafColumns()),
|
|
2731
|
+
getRightVisibleLeafColumns: makeVisibleColumnsMethod('getRightVisibleLeafColumns', () => instance.getRightLeafColumns()),
|
|
2732
|
+
getCenterVisibleLeafColumns: makeVisibleColumnsMethod('getCenterVisibleLeafColumns', () => instance.getCenterLeafColumns()),
|
|
2733
|
+
setColumnVisibility: updater => instance.options.onColumnVisibilityChange == null ? void 0 : instance.options.onColumnVisibilityChange(updater),
|
|
2734
|
+
resetColumnVisibility: defaultState => {
|
|
2735
|
+
var _instance$initialStat;
|
|
2886
2736
|
|
|
2887
|
-
|
|
2888
|
-
|
|
2737
|
+
instance.setColumnVisibility(defaultState ? {} : (_instance$initialStat = instance.initialState.columnVisibility) != null ? _instance$initialStat : {});
|
|
2738
|
+
},
|
|
2739
|
+
toggleAllColumnsVisible: value => {
|
|
2740
|
+
var _value;
|
|
2741
|
+
|
|
2742
|
+
value = (_value = value) != null ? _value : !instance.getIsAllColumnsVisible();
|
|
2743
|
+
instance.setColumnVisibility(instance.getAllLeafColumns().reduce((obj, column) => ({ ...obj,
|
|
2744
|
+
[column.id]: !value ? !(column.getCanHide != null && column.getCanHide()) : value
|
|
2745
|
+
}), {}));
|
|
2746
|
+
},
|
|
2747
|
+
getIsAllColumnsVisible: () => !instance.getAllLeafColumns().some(column => !(column.getIsVisible != null && column.getIsVisible())),
|
|
2748
|
+
getIsSomeColumnsVisible: () => instance.getAllLeafColumns().some(column => column.getIsVisible == null ? void 0 : column.getIsVisible()),
|
|
2749
|
+
getToggleAllColumnsVisibilityHandler: () => {
|
|
2750
|
+
return e => {
|
|
2751
|
+
var _target;
|
|
2889
2752
|
|
|
2890
|
-
|
|
2753
|
+
instance.toggleAllColumnsVisible((_target = e.target) == null ? void 0 : _target.checked);
|
|
2754
|
+
};
|
|
2891
2755
|
}
|
|
2892
2756
|
};
|
|
2893
2757
|
}
|
|
2894
2758
|
};
|
|
2895
|
-
function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
|
|
2896
|
-
var _headerGroups$0$heade, _headerGroups$;
|
|
2897
|
-
|
|
2898
|
-
// Find the max depth of the columns:
|
|
2899
|
-
// build the leaf column row
|
|
2900
|
-
// build each buffer row going up
|
|
2901
|
-
// placeholder for non-existent level
|
|
2902
|
-
// real column for existing level
|
|
2903
|
-
let maxDepth = 0;
|
|
2904
|
-
|
|
2905
|
-
const findMaxDepth = function (columns, depth) {
|
|
2906
|
-
if (depth === void 0) {
|
|
2907
|
-
depth = 1;
|
|
2908
|
-
}
|
|
2909
|
-
|
|
2910
|
-
maxDepth = Math.max(maxDepth, depth);
|
|
2911
|
-
columns.filter(column => column.getIsVisible()).forEach(column => {
|
|
2912
|
-
var _column$columns;
|
|
2913
|
-
|
|
2914
|
-
if ((_column$columns = column.columns) != null && _column$columns.length) {
|
|
2915
|
-
findMaxDepth(column.columns, depth + 1);
|
|
2916
|
-
}
|
|
2917
|
-
}, 0);
|
|
2918
|
-
};
|
|
2919
|
-
|
|
2920
|
-
findMaxDepth(allColumns);
|
|
2921
|
-
let headerGroups = [];
|
|
2922
|
-
|
|
2923
|
-
const createHeaderGroup = (headersToGroup, depth) => {
|
|
2924
|
-
// The header group we are creating
|
|
2925
|
-
const headerGroup = {
|
|
2926
|
-
depth,
|
|
2927
|
-
id: [headerFamily, "" + depth].filter(Boolean).join('_'),
|
|
2928
|
-
headers: []
|
|
2929
|
-
}; // The parent columns we're going to scan next
|
|
2930
|
-
|
|
2931
|
-
const pendingParentHeaders = []; // Scan each column for parents
|
|
2932
|
-
|
|
2933
|
-
headersToGroup.forEach(headerToGroup => {
|
|
2934
|
-
// What is the latest (last) parent column?
|
|
2935
|
-
const latestPendingParentHeader = [...pendingParentHeaders].reverse()[0];
|
|
2936
|
-
const isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
|
|
2937
|
-
let column;
|
|
2938
|
-
let isPlaceholder = false;
|
|
2939
|
-
|
|
2940
|
-
if (isLeafHeader && headerToGroup.column.parent) {
|
|
2941
|
-
// The parent header is new
|
|
2942
|
-
column = headerToGroup.column.parent;
|
|
2943
|
-
} else {
|
|
2944
|
-
// The parent header is repeated
|
|
2945
|
-
column = headerToGroup.column;
|
|
2946
|
-
isPlaceholder = true;
|
|
2947
|
-
}
|
|
2948
|
-
|
|
2949
|
-
if ((latestPendingParentHeader == null ? void 0 : latestPendingParentHeader.column) === column) {
|
|
2950
|
-
// This column is repeated. Add it as a sub header to the next batch
|
|
2951
|
-
latestPendingParentHeader.subHeaders.push(headerToGroup);
|
|
2952
|
-
} else {
|
|
2953
|
-
// This is a new header. Let's create it
|
|
2954
|
-
const header = instance.createHeader(column, {
|
|
2955
|
-
id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
|
|
2956
|
-
isPlaceholder,
|
|
2957
|
-
placeholderId: isPlaceholder ? "" + pendingParentHeaders.filter(d => d.column === column).length : undefined,
|
|
2958
|
-
depth,
|
|
2959
|
-
index: pendingParentHeaders.length
|
|
2960
|
-
}); // Add the headerToGroup as a subHeader of the new header
|
|
2961
|
-
|
|
2962
|
-
header.subHeaders.push(headerToGroup); // Add the new header to the pendingParentHeaders to get grouped
|
|
2963
|
-
// in the next batch
|
|
2964
2759
|
|
|
2965
|
-
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
headerGroup.headers.push(headerToGroup);
|
|
2969
|
-
headerToGroup.headerGroup = headerGroup;
|
|
2970
|
-
});
|
|
2971
|
-
headerGroups.push(headerGroup);
|
|
2972
|
-
|
|
2973
|
-
if (depth > 0) {
|
|
2974
|
-
createHeaderGroup(pendingParentHeaders, depth - 1);
|
|
2975
|
-
}
|
|
2976
|
-
};
|
|
2977
|
-
|
|
2978
|
-
const bottomHeaders = columnsToGroup.map((column, index) => instance.createHeader(column, {
|
|
2979
|
-
depth: maxDepth,
|
|
2980
|
-
index
|
|
2981
|
-
}));
|
|
2982
|
-
createHeaderGroup(bottomHeaders, maxDepth - 1);
|
|
2983
|
-
headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
|
|
2984
|
-
// return !headerGroup.headers.every(header => header.isPlaceholder)
|
|
2985
|
-
// })
|
|
2986
|
-
|
|
2987
|
-
const recurseHeadersForSpans = headers => {
|
|
2988
|
-
const filteredHeaders = headers.filter(header => header.column.getIsVisible());
|
|
2989
|
-
return filteredHeaders.map(header => {
|
|
2990
|
-
let colSpan = 0;
|
|
2991
|
-
let rowSpan = 0;
|
|
2992
|
-
let childRowSpans = [0];
|
|
2993
|
-
|
|
2994
|
-
if (header.subHeaders && header.subHeaders.length) {
|
|
2995
|
-
childRowSpans = [];
|
|
2996
|
-
recurseHeadersForSpans(header.subHeaders).forEach(_ref => {
|
|
2997
|
-
let {
|
|
2998
|
-
colSpan: childColSpan,
|
|
2999
|
-
rowSpan: childRowSpan
|
|
3000
|
-
} = _ref;
|
|
3001
|
-
colSpan += childColSpan;
|
|
3002
|
-
childRowSpans.push(childRowSpan);
|
|
3003
|
-
});
|
|
3004
|
-
} else {
|
|
3005
|
-
colSpan = 1;
|
|
3006
|
-
}
|
|
3007
|
-
|
|
3008
|
-
const minChildRowSpan = Math.min(...childRowSpans);
|
|
3009
|
-
rowSpan = rowSpan + minChildRowSpan;
|
|
3010
|
-
header.colSpan = colSpan > 0 ? colSpan : undefined;
|
|
3011
|
-
header.rowSpan = rowSpan > 0 ? rowSpan : undefined;
|
|
3012
|
-
return {
|
|
3013
|
-
colSpan,
|
|
3014
|
-
rowSpan
|
|
3015
|
-
};
|
|
3016
|
-
});
|
|
3017
|
-
};
|
|
3018
|
-
|
|
3019
|
-
recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
|
|
3020
|
-
return headerGroups;
|
|
3021
|
-
}
|
|
2760
|
+
const features = [Headers, Visibility, Ordering, Pinning, Filters, Sorting, Grouping, Expanding, Pagination, RowSelection, ColumnSizing]; //
|
|
3022
2761
|
|
|
3023
|
-
// export type Batch = {
|
|
3024
|
-
// id: number
|
|
3025
|
-
// priority: keyof CoreBatches
|
|
3026
|
-
// tasks: (() => void)[]
|
|
3027
|
-
// schedule: (cb: () => void) => void
|
|
3028
|
-
// cancel: () => void
|
|
3029
|
-
// }
|
|
3030
|
-
// type CoreBatches = {
|
|
3031
|
-
// data: Batch[]
|
|
3032
|
-
// facets: Batch[]
|
|
3033
|
-
// }
|
|
3034
2762
|
function createTableInstance(options) {
|
|
3035
2763
|
var _options$initialState;
|
|
3036
2764
|
|
|
@@ -3039,7 +2767,7 @@ function createTableInstance(options) {
|
|
|
3039
2767
|
}
|
|
3040
2768
|
|
|
3041
2769
|
let instance = {
|
|
3042
|
-
_features:
|
|
2770
|
+
_features: features
|
|
3043
2771
|
};
|
|
3044
2772
|
|
|
3045
2773
|
const defaultOptions = instance._features.reduce((obj, feature) => {
|
|
@@ -3056,8 +2784,7 @@ function createTableInstance(options) {
|
|
|
3056
2784
|
};
|
|
3057
2785
|
};
|
|
3058
2786
|
|
|
3059
|
-
const coreInitialState = {
|
|
3060
|
-
};
|
|
2787
|
+
const coreInitialState = {};
|
|
3061
2788
|
let initialState = { ...coreInitialState,
|
|
3062
2789
|
...((_options$initialState = options.initialState) != null ? _options$initialState : {})
|
|
3063
2790
|
};
|
|
@@ -3070,16 +2797,8 @@ function createTableInstance(options) {
|
|
|
3070
2797
|
|
|
3071
2798
|
const queued = [];
|
|
3072
2799
|
let queuedTimeout = false;
|
|
3073
|
-
const
|
|
3074
|
-
|
|
3075
|
-
// startWork()
|
|
3076
|
-
// },
|
|
3077
|
-
// willUpdate: () => {
|
|
3078
|
-
// startWork()
|
|
3079
|
-
// },
|
|
3080
|
-
// destroy: () => {
|
|
3081
|
-
// stopWork()
|
|
3082
|
-
// },
|
|
2800
|
+
const coreInstance = {
|
|
2801
|
+
_features: features,
|
|
3083
2802
|
options: { ...defaultOptions,
|
|
3084
2803
|
...options
|
|
3085
2804
|
},
|
|
@@ -3125,29 +2844,136 @@ function createTableInstance(options) {
|
|
|
3125
2844
|
},
|
|
3126
2845
|
setState: updater => {
|
|
3127
2846
|
instance.options.onStateChange == null ? void 0 : instance.options.onStateChange(updater);
|
|
3128
|
-
}
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
//
|
|
3142
|
-
//
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
2847
|
+
},
|
|
2848
|
+
_getRowId: (row, index, parent) => {
|
|
2849
|
+
var _instance$options$get;
|
|
2850
|
+
|
|
2851
|
+
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);
|
|
2852
|
+
},
|
|
2853
|
+
getCoreRowModel: () => {
|
|
2854
|
+
if (!instance._getCoreRowModel) {
|
|
2855
|
+
instance._getCoreRowModel = instance.options.getCoreRowModel(instance);
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
return instance._getCoreRowModel();
|
|
2859
|
+
},
|
|
2860
|
+
// The final calls start at the bottom of the model,
|
|
2861
|
+
// expanded rows, which then work their way up
|
|
2862
|
+
getRowModel: () => {
|
|
2863
|
+
return instance.getPaginationRowModel();
|
|
2864
|
+
},
|
|
2865
|
+
getRow: id => {
|
|
2866
|
+
const row = instance.getRowModel().rowsById[id];
|
|
2867
|
+
|
|
2868
|
+
if (!row) {
|
|
2869
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2870
|
+
throw new Error("getRow expected an ID, but got " + id);
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
throw new Error();
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
return row;
|
|
2877
|
+
},
|
|
2878
|
+
_getDefaultColumnDef: memo(() => [instance.options.defaultColumn], defaultColumn => {
|
|
2879
|
+
var _defaultColumn;
|
|
2880
|
+
|
|
2881
|
+
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
2882
|
+
return {
|
|
2883
|
+
header: props => props.header.column.id,
|
|
2884
|
+
footer: props => props.header.column.id,
|
|
2885
|
+
cell: props => {
|
|
2886
|
+
var _props$getValue$toStr, _props$getValue$toStr2, _props$getValue;
|
|
2887
|
+
|
|
2888
|
+
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;
|
|
2889
|
+
},
|
|
2890
|
+
...instance._features.reduce((obj, feature) => {
|
|
2891
|
+
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
2892
|
+
}, {}),
|
|
2893
|
+
...defaultColumn
|
|
2894
|
+
};
|
|
2895
|
+
}, {
|
|
2896
|
+
debug: () => {
|
|
2897
|
+
var _instance$options$deb;
|
|
2898
|
+
|
|
2899
|
+
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
|
|
2900
|
+
},
|
|
2901
|
+
key: process.env.NODE_ENV === 'development' && 'getDefaultColumnDef'
|
|
2902
|
+
}),
|
|
2903
|
+
_getColumnDefs: () => instance.options.columns,
|
|
2904
|
+
getAllColumns: memo(() => [instance._getColumnDefs()], columnDefs => {
|
|
2905
|
+
const recurseColumns = function (columnDefs, parent, depth) {
|
|
2906
|
+
if (depth === void 0) {
|
|
2907
|
+
depth = 0;
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2910
|
+
return columnDefs.map(columnDef => {
|
|
2911
|
+
const column = createColumn(instance, columnDef, depth, parent);
|
|
2912
|
+
column.columns = columnDef.columns ? recurseColumns(columnDef.columns, column, depth + 1) : [];
|
|
2913
|
+
return column;
|
|
2914
|
+
});
|
|
2915
|
+
};
|
|
2916
|
+
|
|
2917
|
+
return recurseColumns(columnDefs);
|
|
2918
|
+
}, {
|
|
2919
|
+
key: process.env.NODE_ENV === 'development' && 'getAllColumns',
|
|
2920
|
+
debug: () => {
|
|
2921
|
+
var _instance$options$deb2;
|
|
2922
|
+
|
|
2923
|
+
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugColumns;
|
|
2924
|
+
}
|
|
2925
|
+
}),
|
|
2926
|
+
getAllFlatColumns: memo(() => [instance.getAllColumns()], allColumns => {
|
|
2927
|
+
return allColumns.flatMap(column => {
|
|
2928
|
+
return column.getFlatColumns();
|
|
2929
|
+
});
|
|
2930
|
+
}, {
|
|
2931
|
+
key: process.env.NODE_ENV === 'development' && 'getAllFlatColumns',
|
|
2932
|
+
debug: () => {
|
|
2933
|
+
var _instance$options$deb3;
|
|
2934
|
+
|
|
2935
|
+
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugColumns;
|
|
2936
|
+
}
|
|
2937
|
+
}),
|
|
2938
|
+
_getAllFlatColumnsById: memo(() => [instance.getAllFlatColumns()], flatColumns => {
|
|
2939
|
+
return flatColumns.reduce((acc, column) => {
|
|
2940
|
+
acc[column.id] = column;
|
|
2941
|
+
return acc;
|
|
2942
|
+
}, {});
|
|
2943
|
+
}, {
|
|
2944
|
+
key: process.env.NODE_ENV === 'development' && 'getAllFlatColumnsById',
|
|
2945
|
+
debug: () => {
|
|
2946
|
+
var _instance$options$deb4;
|
|
2947
|
+
|
|
2948
|
+
return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugColumns;
|
|
2949
|
+
}
|
|
2950
|
+
}),
|
|
2951
|
+
getAllLeafColumns: memo(() => [instance.getAllColumns(), instance._getOrderColumnsFn()], (allColumns, orderColumns) => {
|
|
2952
|
+
let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
|
|
2953
|
+
return orderColumns(leafColumns);
|
|
2954
|
+
}, {
|
|
2955
|
+
key: process.env.NODE_ENV === 'development' && 'getAllLeafColumns',
|
|
2956
|
+
debug: () => {
|
|
2957
|
+
var _instance$options$deb5;
|
|
2958
|
+
|
|
2959
|
+
return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugColumns;
|
|
2960
|
+
}
|
|
2961
|
+
}),
|
|
2962
|
+
getColumn: columnId => {
|
|
2963
|
+
const column = instance._getAllFlatColumnsById()[columnId];
|
|
2964
|
+
|
|
2965
|
+
if (!column) {
|
|
2966
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2967
|
+
console.warn("[Table] Column with id " + columnId + " does not exist.");
|
|
2968
|
+
}
|
|
2969
|
+
|
|
2970
|
+
throw new Error();
|
|
2971
|
+
}
|
|
3148
2972
|
|
|
2973
|
+
return column;
|
|
2974
|
+
}
|
|
3149
2975
|
};
|
|
3150
|
-
|
|
2976
|
+
Object.assign(instance, coreInstance);
|
|
3151
2977
|
|
|
3152
2978
|
instance._features.forEach(feature => {
|
|
3153
2979
|
return Object.assign(instance, feature.createInstance == null ? void 0 : feature.createInstance(instance));
|
|
@@ -3170,7 +2996,7 @@ function createTable(_, __, options) {
|
|
|
3170
2996
|
throw new Error('');
|
|
3171
2997
|
})()
|
|
3172
2998
|
},
|
|
3173
|
-
setGenerics: () => table,
|
|
2999
|
+
// setGenerics: () => table as any,
|
|
3174
3000
|
setRowType: () => table,
|
|
3175
3001
|
setTableMetaType: () => table,
|
|
3176
3002
|
setColumnMetaType: () => table,
|
|
@@ -3206,11 +3032,92 @@ function createTable(_, __, options) {
|
|
|
3206
3032
|
}
|
|
3207
3033
|
|
|
3208
3034
|
throw new Error('Invalid accessor');
|
|
3209
|
-
}
|
|
3035
|
+
},
|
|
3036
|
+
createOptions: options => options
|
|
3210
3037
|
};
|
|
3211
3038
|
return table;
|
|
3212
3039
|
}
|
|
3213
3040
|
|
|
3041
|
+
function createCell(instance, row, column, columnId) {
|
|
3042
|
+
const cell = {
|
|
3043
|
+
id: row.id + "_" + column.id,
|
|
3044
|
+
row,
|
|
3045
|
+
column,
|
|
3046
|
+
getValue: () => row.getValue(columnId),
|
|
3047
|
+
renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
|
|
3048
|
+
instance,
|
|
3049
|
+
column,
|
|
3050
|
+
row,
|
|
3051
|
+
cell: cell,
|
|
3052
|
+
getValue: cell.getValue
|
|
3053
|
+
}) : null
|
|
3054
|
+
};
|
|
3055
|
+
|
|
3056
|
+
instance._features.forEach(feature => {
|
|
3057
|
+
Object.assign(cell, feature.createCell == null ? void 0 : feature.createCell(cell, column, row, instance));
|
|
3058
|
+
}, {});
|
|
3059
|
+
|
|
3060
|
+
return cell;
|
|
3061
|
+
}
|
|
3062
|
+
|
|
3063
|
+
const createRow = (instance, id, original, rowIndex, depth, subRows) => {
|
|
3064
|
+
let row = {
|
|
3065
|
+
id,
|
|
3066
|
+
index: rowIndex,
|
|
3067
|
+
original,
|
|
3068
|
+
depth,
|
|
3069
|
+
_valuesCache: {},
|
|
3070
|
+
getValue: columnId => {
|
|
3071
|
+
if (row._valuesCache.hasOwnProperty(columnId)) {
|
|
3072
|
+
return row._valuesCache[columnId];
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
const column = instance.getColumn(columnId);
|
|
3076
|
+
|
|
3077
|
+
if (!column.accessorFn) {
|
|
3078
|
+
return undefined;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
|
|
3082
|
+
return row._valuesCache[columnId];
|
|
3083
|
+
},
|
|
3084
|
+
subRows: subRows != null ? subRows : [],
|
|
3085
|
+
getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
|
|
3086
|
+
getAllCells: memo(() => [instance.getAllLeafColumns()], leafColumns => {
|
|
3087
|
+
return leafColumns.map(column => {
|
|
3088
|
+
return createCell(instance, row, column, column.id);
|
|
3089
|
+
});
|
|
3090
|
+
}, {
|
|
3091
|
+
key: process.env.NODE_ENV === 'development' && 'row.getAllCells',
|
|
3092
|
+
debug: () => {
|
|
3093
|
+
var _instance$options$deb;
|
|
3094
|
+
|
|
3095
|
+
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
|
|
3096
|
+
}
|
|
3097
|
+
}),
|
|
3098
|
+
_getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
|
|
3099
|
+
return allCells.reduce((acc, cell) => {
|
|
3100
|
+
acc[cell.column.id] = cell;
|
|
3101
|
+
return acc;
|
|
3102
|
+
}, {});
|
|
3103
|
+
}, {
|
|
3104
|
+
key: process.env.NODE_ENV === 'production' && 'row.getAllCellsByColumnId',
|
|
3105
|
+
debug: () => {
|
|
3106
|
+
var _instance$options$deb2;
|
|
3107
|
+
|
|
3108
|
+
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
|
|
3109
|
+
}
|
|
3110
|
+
})
|
|
3111
|
+
};
|
|
3112
|
+
|
|
3113
|
+
for (let i = 0; i < instance._features.length; i++) {
|
|
3114
|
+
const feature = instance._features[i];
|
|
3115
|
+
Object.assign(row, feature == null ? void 0 : feature.createRow == null ? void 0 : feature.createRow(row, instance));
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
return row;
|
|
3119
|
+
};
|
|
3120
|
+
|
|
3214
3121
|
function getCoreRowModel() {
|
|
3215
3122
|
return instance => memo(() => [instance.options.data], data => {
|
|
3216
3123
|
const rowModel = {
|
|
@@ -3238,7 +3145,7 @@ function getCoreRowModel() {
|
|
|
3238
3145
|
// }
|
|
3239
3146
|
// Make the row
|
|
3240
3147
|
|
|
3241
|
-
row =
|
|
3148
|
+
row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
|
|
3242
3149
|
|
|
3243
3150
|
rowModel.flatRows.push(row); // Also keep track of every row by its ID
|
|
3244
3151
|
|
|
@@ -3301,7 +3208,7 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
|
|
|
3301
3208
|
row = rowsToFilter[i];
|
|
3302
3209
|
|
|
3303
3210
|
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
3304
|
-
newRow =
|
|
3211
|
+
newRow = createRow(instance, row.id, row.original, row.index, row.depth);
|
|
3305
3212
|
newRow.columnFilters = row.columnFilters;
|
|
3306
3213
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3307
3214
|
|
|
@@ -3351,7 +3258,7 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
|
|
|
3351
3258
|
var _row$subRows2;
|
|
3352
3259
|
|
|
3353
3260
|
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
|
|
3354
|
-
newRow =
|
|
3261
|
+
newRow = createRow(instance, row.id, row.original, row.index, row.depth);
|
|
3355
3262
|
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
3356
3263
|
row = newRow;
|
|
3357
3264
|
}
|
|
@@ -3603,8 +3510,8 @@ function getSortedRowModel() {
|
|
|
3603
3510
|
availableSorting.forEach(sortEntry => {
|
|
3604
3511
|
const column = instance.getColumn(sortEntry.id);
|
|
3605
3512
|
columnInfoById[sortEntry.id] = {
|
|
3606
|
-
sortUndefined: column.sortUndefined,
|
|
3607
|
-
invertSorting: column.invertSorting,
|
|
3513
|
+
sortUndefined: column.columnDef.sortUndefined,
|
|
3514
|
+
invertSorting: column.columnDef.invertSorting,
|
|
3608
3515
|
sortingFn: column.getSortingFn()
|
|
3609
3516
|
};
|
|
3610
3517
|
});
|
|
@@ -3718,7 +3625,7 @@ function getGroupedRowModel() {
|
|
|
3718
3625
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
|
|
3719
3626
|
|
|
3720
3627
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|
|
3721
|
-
const row =
|
|
3628
|
+
const row = createRow(instance, id, undefined, index, depth);
|
|
3722
3629
|
Object.assign(row, {
|
|
3723
3630
|
groupingColumnId: columnId,
|
|
3724
3631
|
groupingValue,
|
|
@@ -3727,38 +3634,30 @@ function getGroupedRowModel() {
|
|
|
3727
3634
|
getValue: columnId => {
|
|
3728
3635
|
// Don't aggregate columns that are in the grouping
|
|
3729
3636
|
if (existingGrouping.includes(columnId)) {
|
|
3730
|
-
if (row.
|
|
3731
|
-
return row.
|
|
3637
|
+
if (row._valuesCache.hasOwnProperty(columnId)) {
|
|
3638
|
+
return row._valuesCache[columnId];
|
|
3732
3639
|
}
|
|
3733
3640
|
|
|
3734
3641
|
if (groupedRows[0]) {
|
|
3735
3642
|
var _groupedRows$0$getVal;
|
|
3736
3643
|
|
|
3737
|
-
row.
|
|
3644
|
+
row._valuesCache[columnId] = (_groupedRows$0$getVal = groupedRows[0].getValue(columnId)) != null ? _groupedRows$0$getVal : undefined;
|
|
3738
3645
|
}
|
|
3739
3646
|
|
|
3740
|
-
return row.
|
|
3647
|
+
return row._valuesCache[columnId];
|
|
3741
3648
|
}
|
|
3742
3649
|
|
|
3743
|
-
if (row.
|
|
3744
|
-
return row.
|
|
3650
|
+
if (row._groupingValuesCache.hasOwnProperty(columnId)) {
|
|
3651
|
+
return row._groupingValuesCache[columnId];
|
|
3745
3652
|
} // Aggregate the values
|
|
3746
3653
|
|
|
3747
3654
|
|
|
3748
3655
|
const column = instance.getColumn(columnId);
|
|
3749
|
-
const aggregateFn = column.
|
|
3656
|
+
const aggregateFn = column.getAggregationFn();
|
|
3750
3657
|
|
|
3751
3658
|
if (aggregateFn) {
|
|
3752
|
-
row.
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
if (!depth && column.aggregateValue) {
|
|
3756
|
-
columnValue = column.aggregateValue(columnValue);
|
|
3757
|
-
}
|
|
3758
|
-
|
|
3759
|
-
return columnValue;
|
|
3760
|
-
}), () => groupedRows.map(row => row.getValue(columnId)));
|
|
3761
|
-
return row.groupingValuesCache[columnId];
|
|
3659
|
+
row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
|
|
3660
|
+
return row._groupingValuesCache[columnId];
|
|
3762
3661
|
} else if (column.aggregationFn) {
|
|
3763
3662
|
console.info({
|
|
3764
3663
|
column
|
|
@@ -3911,5 +3810,5 @@ function getPaginationRowModel(opts) {
|
|
|
3911
3810
|
});
|
|
3912
3811
|
}
|
|
3913
3812
|
|
|
3914
|
-
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,
|
|
3813
|
+
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, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns };
|
|
3915
3814
|
//# sourceMappingURL=index.js.map
|