@tanstack/react-table 8.0.0-alpha.9 → 8.0.0-beta.0
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/react-table/src/index.js +139 -0
- package/build/cjs/react-table/src/index.js.map +1 -0
- package/build/cjs/table-core/build/esm/index.js +3867 -0
- package/build/cjs/table-core/build/esm/index.js.map +1 -0
- package/build/esm/index.js +3196 -4117
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +24 -813
- package/build/types/index.d.ts +16 -9
- package/build/umd/index.development.js +3234 -4125
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +11 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +10 -6
- package/src/index.tsx +111 -9
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -112
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/aggregationTypes.js +0 -130
- package/build/cjs/aggregationTypes.js.map +0 -1
- package/build/cjs/core.js +0 -545
- package/build/cjs/core.js.map +0 -1
- package/build/cjs/createTable.js +0 -122
- package/build/cjs/createTable.js.map +0 -1
- package/build/cjs/features/ColumnSizing.js +0 -318
- package/build/cjs/features/ColumnSizing.js.map +0 -1
- package/build/cjs/features/Expanding.js +0 -239
- package/build/cjs/features/Expanding.js.map +0 -1
- package/build/cjs/features/Filters.js +0 -414
- package/build/cjs/features/Filters.js.map +0 -1
- package/build/cjs/features/Grouping.js +0 -232
- package/build/cjs/features/Grouping.js.map +0 -1
- package/build/cjs/features/Headers.js +0 -629
- package/build/cjs/features/Headers.js.map +0 -1
- package/build/cjs/features/Ordering.js +0 -86
- package/build/cjs/features/Ordering.js.map +0 -1
- package/build/cjs/features/Pagination.js +0 -193
- package/build/cjs/features/Pagination.js.map +0 -1
- package/build/cjs/features/Pinning.js +0 -149
- package/build/cjs/features/Pinning.js.map +0 -1
- package/build/cjs/features/RowSelection.js +0 -526
- package/build/cjs/features/RowSelection.js.map +0 -1
- package/build/cjs/features/Sorting.js +0 -315
- package/build/cjs/features/Sorting.js.map +0 -1
- package/build/cjs/features/Visibility.js +0 -174
- package/build/cjs/features/Visibility.js.map +0 -1
- package/build/cjs/filterTypes.js +0 -172
- package/build/cjs/filterTypes.js.map +0 -1
- package/build/cjs/index.js +0 -44
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/sortTypes.js +0 -122
- package/build/cjs/sortTypes.js.map +0 -1
- package/build/cjs/types.js +0 -22
- package/build/cjs/types.js.map +0 -1
- package/build/cjs/utils/columnFilterRowsFn.js +0 -131
- package/build/cjs/utils/columnFilterRowsFn.js.map +0 -1
- package/build/cjs/utils/expandRowsFn.js +0 -38
- package/build/cjs/utils/expandRowsFn.js.map +0 -1
- package/build/cjs/utils/globalFilterRowsFn.js +0 -101
- package/build/cjs/utils/globalFilterRowsFn.js.map +0 -1
- package/build/cjs/utils/groupRowsFn.js +0 -155
- package/build/cjs/utils/groupRowsFn.js.map +0 -1
- package/build/cjs/utils/paginateRowsFn.js +0 -44
- package/build/cjs/utils/paginateRowsFn.js.map +0 -1
- package/build/cjs/utils/sortRowsFn.js +0 -94
- package/build/cjs/utils/sortRowsFn.js.map +0 -1
- package/build/cjs/utils.js +0 -167
- package/build/cjs/utils.js.map +0 -1
- package/build/types/aggregationTypes.d.ts +0 -22
- package/build/types/core.d.ts +0 -105
- package/build/types/createTable.d.ts +0 -42
- package/build/types/features/ColumnSizing.d.ts +0 -73
- package/build/types/features/Expanding.d.ts +0 -48
- package/build/types/features/Filters.d.ts +0 -90
- package/build/types/features/Grouping.d.ts +0 -83
- package/build/types/features/Headers.d.ts +0 -41
- package/build/types/features/Ordering.d.ts +0 -19
- package/build/types/features/Pagination.d.ts +0 -39
- package/build/types/features/Pinning.d.ts +0 -39
- package/build/types/features/RowSelection.d.ts +0 -58
- package/build/types/features/Sorting.d.ts +0 -79
- package/build/types/features/Visibility.d.ts +0 -47
- package/build/types/filterTypes.d.ts +0 -50
- package/build/types/sortTypes.d.ts +0 -18
- package/build/types/types.d.ts +0 -138
- package/build/types/utils/columnFilterRowsFn.d.ts +0 -2
- package/build/types/utils/expandRowsFn.d.ts +0 -2
- package/build/types/utils/globalFilterRowsFn.d.ts +0 -2
- package/build/types/utils/groupRowsFn.d.ts +0 -2
- package/build/types/utils/paginateRowsFn.d.ts +0 -2
- package/build/types/utils/sortRowsFn.d.ts +0 -2
- package/build/types/utils.d.ts +0 -23
- package/src/aggregationTypes.ts +0 -115
- package/src/core.tsx +0 -763
- package/src/createTable.tsx +0 -186
- package/src/features/ColumnSizing.ts +0 -424
- package/src/features/Expanding.ts +0 -318
- package/src/features/Filters.ts +0 -560
- package/src/features/Grouping.ts +0 -361
- package/src/features/Headers.ts +0 -729
- package/src/features/Ordering.ts +0 -110
- package/src/features/Pagination.ts +0 -250
- package/src/features/Pinning.ts +0 -174
- package/src/features/RowSelection.ts +0 -651
- package/src/features/Sorting.ts +0 -453
- package/src/features/Visibility.ts +0 -238
- package/src/filterTypes.ts +0 -188
- package/src/sortTypes.ts +0 -147
- package/src/types.ts +0 -311
- package/src/utils/columnFilterRowsFn.ts +0 -113
- package/src/utils/expandRowsFn.ts +0 -30
- package/src/utils/globalFilterRowsFn.ts +0 -89
- package/src/utils/groupRowsFn.ts +0 -170
- package/src/utils/paginateRowsFn.ts +0 -28
- package/src/utils/sortRowsFn.ts +0 -95
- package/src/utils.tsx +0 -221
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-table
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
var utils = require('../utils.js');
|
|
16
|
-
var ColumnSizing = require('./ColumnSizing.js');
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
function createRow(row, instance) {
|
|
20
|
-
return {
|
|
21
|
-
_getAllVisibleCells: utils.memo(function () {
|
|
22
|
-
return [row.getAllCells().filter(function (cell) {
|
|
23
|
-
return cell.column.getIsVisible();
|
|
24
|
-
}).map(function (d) {
|
|
25
|
-
return d.id;
|
|
26
|
-
}).join('_')];
|
|
27
|
-
}, function (_) {
|
|
28
|
-
return row.getAllCells().filter(function (cell) {
|
|
29
|
-
return cell.column.getIsVisible();
|
|
30
|
-
});
|
|
31
|
-
}, {
|
|
32
|
-
key: 'row._getAllVisibleCells',
|
|
33
|
-
debug: function debug() {
|
|
34
|
-
var _instance$options$deb;
|
|
35
|
-
|
|
36
|
-
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugRows;
|
|
37
|
-
}
|
|
38
|
-
}),
|
|
39
|
-
getVisibleCells: utils.memo(function () {
|
|
40
|
-
return [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()];
|
|
41
|
-
}, function (left, center, right) {
|
|
42
|
-
return [].concat(left, center, right);
|
|
43
|
-
}, {
|
|
44
|
-
key: 'row.getVisibleCells',
|
|
45
|
-
debug: function debug() {
|
|
46
|
-
var _instance$options$deb2;
|
|
47
|
-
|
|
48
|
-
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugRows;
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
getCenterVisibleCells: utils.memo(function () {
|
|
52
|
-
return [row._getAllVisibleCells(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
|
|
53
|
-
}, function (allCells, left, right) {
|
|
54
|
-
var leftAndRight = [].concat(left != null ? left : [], right != null ? right : []);
|
|
55
|
-
return allCells.filter(function (d) {
|
|
56
|
-
return !leftAndRight.includes(d.columnId);
|
|
57
|
-
});
|
|
58
|
-
}, {
|
|
59
|
-
key: 'row.getCenterVisibleCells',
|
|
60
|
-
debug: function debug() {
|
|
61
|
-
var _instance$options$deb3;
|
|
62
|
-
|
|
63
|
-
return (_instance$options$deb3 = instance.options.debugAll) != null ? _instance$options$deb3 : instance.options.debugRows;
|
|
64
|
-
}
|
|
65
|
-
}),
|
|
66
|
-
getLeftVisibleCells: utils.memo(function () {
|
|
67
|
-
return [row._getAllVisibleCells(), instance.getState().columnPinning.left,,];
|
|
68
|
-
}, function (allCells, left) {
|
|
69
|
-
var cells = (left != null ? left : []).map(function (columnId) {
|
|
70
|
-
return allCells.find(function (cell) {
|
|
71
|
-
return cell.columnId === columnId;
|
|
72
|
-
});
|
|
73
|
-
}).filter(Boolean);
|
|
74
|
-
return cells;
|
|
75
|
-
}, {
|
|
76
|
-
key: 'row.getLeftVisibleCells',
|
|
77
|
-
debug: function debug() {
|
|
78
|
-
var _instance$options$deb4;
|
|
79
|
-
|
|
80
|
-
return (_instance$options$deb4 = instance.options.debugAll) != null ? _instance$options$deb4 : instance.options.debugRows;
|
|
81
|
-
}
|
|
82
|
-
}),
|
|
83
|
-
getRightVisibleCells: utils.memo(function () {
|
|
84
|
-
return [row._getAllVisibleCells(), instance.getState().columnPinning.right];
|
|
85
|
-
}, function (allCells, right) {
|
|
86
|
-
var cells = (right != null ? right : []).map(function (columnId) {
|
|
87
|
-
return allCells.find(function (cell) {
|
|
88
|
-
return cell.columnId === columnId;
|
|
89
|
-
});
|
|
90
|
-
}).filter(Boolean);
|
|
91
|
-
return cells;
|
|
92
|
-
}, {
|
|
93
|
-
key: 'row.getRightVisibleCells',
|
|
94
|
-
debug: function debug() {
|
|
95
|
-
var _instance$options$deb5;
|
|
96
|
-
|
|
97
|
-
return (_instance$options$deb5 = instance.options.debugAll) != null ? _instance$options$deb5 : instance.options.debugRows;
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function getInstance(instance) {
|
|
103
|
-
return {
|
|
104
|
-
createHeader: function createHeader(column, options) {
|
|
105
|
-
var _options$id;
|
|
106
|
-
|
|
107
|
-
var id = (_options$id = options.id) != null ? _options$id : column.id;
|
|
108
|
-
var header = {
|
|
109
|
-
id: id,
|
|
110
|
-
column: column,
|
|
111
|
-
isPlaceholder: options.isPlaceholder,
|
|
112
|
-
placeholderId: options.placeholderId,
|
|
113
|
-
depth: options.depth,
|
|
114
|
-
subHeaders: [],
|
|
115
|
-
colSpan: 0,
|
|
116
|
-
rowSpan: 0,
|
|
117
|
-
getWidth: function getWidth() {
|
|
118
|
-
var sum = 0;
|
|
119
|
-
|
|
120
|
-
var recurse = function recurse(header) {
|
|
121
|
-
if (header.subHeaders.length) {
|
|
122
|
-
header.subHeaders.forEach(recurse);
|
|
123
|
-
} else {
|
|
124
|
-
var _header$column$getWid;
|
|
125
|
-
|
|
126
|
-
sum += (_header$column$getWid = header.column.getWidth()) != null ? _header$column$getWid : 0;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
recurse(header);
|
|
131
|
-
return sum;
|
|
132
|
-
},
|
|
133
|
-
getLeafHeaders: function getLeafHeaders() {
|
|
134
|
-
var leafHeaders = [];
|
|
135
|
-
|
|
136
|
-
var recurseHeader = function recurseHeader(h) {
|
|
137
|
-
if (h.subHeaders && h.subHeaders.length) {
|
|
138
|
-
h.subHeaders.map(recurseHeader);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
leafHeaders.push(h);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
recurseHeader(header);
|
|
145
|
-
return leafHeaders;
|
|
146
|
-
},
|
|
147
|
-
getHeaderProps: function getHeaderProps(userProps) {
|
|
148
|
-
return instance.getHeaderProps(header.id, userProps);
|
|
149
|
-
},
|
|
150
|
-
getFooterProps: function getFooterProps(userProps) {
|
|
151
|
-
return instance.getFooterProps(header.id, userProps);
|
|
152
|
-
},
|
|
153
|
-
renderHeader: function renderHeader() {
|
|
154
|
-
return utils.flexRender(column.header, {
|
|
155
|
-
instance: instance,
|
|
156
|
-
header: header,
|
|
157
|
-
column: column
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
renderFooter: function renderFooter() {
|
|
161
|
-
return utils.flexRender(column.footer, {
|
|
162
|
-
instance: instance,
|
|
163
|
-
header: header,
|
|
164
|
-
column: column
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}; // Yes, we have to convert instance to unknown, because we know more than the compiler here.
|
|
168
|
-
|
|
169
|
-
return Object.assign(header, ColumnSizing.createHeader(header, instance));
|
|
170
|
-
},
|
|
171
|
-
// Header Groups
|
|
172
|
-
getHeaderGroups: utils.memo(function () {
|
|
173
|
-
return [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
|
|
174
|
-
}, function (allColumns, leafColumns, left, right) {
|
|
175
|
-
var leftColumns = leafColumns.filter(function (column) {
|
|
176
|
-
return left == null ? void 0 : left.includes(column.id);
|
|
177
|
-
});
|
|
178
|
-
var rightColumns = leafColumns.filter(function (column) {
|
|
179
|
-
return right == null ? void 0 : right.includes(column.id);
|
|
180
|
-
});
|
|
181
|
-
var centerColumns = leafColumns.filter(function (column) {
|
|
182
|
-
return !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id));
|
|
183
|
-
});
|
|
184
|
-
var headerGroups = buildHeaderGroups(allColumns, [].concat(leftColumns, centerColumns, rightColumns), instance);
|
|
185
|
-
return headerGroups;
|
|
186
|
-
}, {
|
|
187
|
-
key: 'getHeaderGroups',
|
|
188
|
-
debug: function debug() {
|
|
189
|
-
var _instance$options$deb6;
|
|
190
|
-
|
|
191
|
-
return (_instance$options$deb6 = instance.options.debugAll) != null ? _instance$options$deb6 : instance.options.debugHeaders;
|
|
192
|
-
}
|
|
193
|
-
}),
|
|
194
|
-
getCenterHeaderGroups: utils.memo(function () {
|
|
195
|
-
return [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left, instance.getState().columnPinning.right];
|
|
196
|
-
}, function (allColumns, leafColumns, left, right) {
|
|
197
|
-
leafColumns = leafColumns.filter(function (column) {
|
|
198
|
-
return !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id));
|
|
199
|
-
});
|
|
200
|
-
return buildHeaderGroups(allColumns, leafColumns, instance, 'center');
|
|
201
|
-
}, {
|
|
202
|
-
key: 'getCenterHeaderGroups',
|
|
203
|
-
debug: function debug() {
|
|
204
|
-
var _instance$options$deb7;
|
|
205
|
-
|
|
206
|
-
return (_instance$options$deb7 = instance.options.debugAll) != null ? _instance$options$deb7 : instance.options.debugHeaders;
|
|
207
|
-
}
|
|
208
|
-
}),
|
|
209
|
-
getLeftHeaderGroups: utils.memo(function () {
|
|
210
|
-
return [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.left];
|
|
211
|
-
}, function (allColumns, leafColumns, left) {
|
|
212
|
-
leafColumns = leafColumns.filter(function (column) {
|
|
213
|
-
return left == null ? void 0 : left.includes(column.id);
|
|
214
|
-
});
|
|
215
|
-
return buildHeaderGroups(allColumns, leafColumns, instance, 'left');
|
|
216
|
-
}, {
|
|
217
|
-
key: 'getLeftHeaderGroups',
|
|
218
|
-
debug: function debug() {
|
|
219
|
-
var _instance$options$deb8;
|
|
220
|
-
|
|
221
|
-
return (_instance$options$deb8 = instance.options.debugAll) != null ? _instance$options$deb8 : instance.options.debugHeaders;
|
|
222
|
-
}
|
|
223
|
-
}),
|
|
224
|
-
getRightHeaderGroups: utils.memo(function () {
|
|
225
|
-
return [instance.getAllColumns(), instance.getVisibleLeafColumns(), instance.getState().columnPinning.right];
|
|
226
|
-
}, function (allColumns, leafColumns, right) {
|
|
227
|
-
leafColumns = leafColumns.filter(function (column) {
|
|
228
|
-
return right == null ? void 0 : right.includes(column.id);
|
|
229
|
-
});
|
|
230
|
-
return buildHeaderGroups(allColumns, leafColumns, instance, 'right');
|
|
231
|
-
}, {
|
|
232
|
-
key: 'getRightHeaderGroups',
|
|
233
|
-
debug: function debug() {
|
|
234
|
-
var _instance$options$deb9;
|
|
235
|
-
|
|
236
|
-
return (_instance$options$deb9 = instance.options.debugAll) != null ? _instance$options$deb9 : instance.options.debugHeaders;
|
|
237
|
-
}
|
|
238
|
-
}),
|
|
239
|
-
// Footer Groups
|
|
240
|
-
getFooterGroups: utils.memo(function () {
|
|
241
|
-
return [instance.getHeaderGroups()];
|
|
242
|
-
}, function (headerGroups) {
|
|
243
|
-
return [].concat(headerGroups).reverse();
|
|
244
|
-
}, {
|
|
245
|
-
key: 'getFooterGroups',
|
|
246
|
-
debug: function debug() {
|
|
247
|
-
var _instance$options$deb10;
|
|
248
|
-
|
|
249
|
-
return (_instance$options$deb10 = instance.options.debugAll) != null ? _instance$options$deb10 : instance.options.debugHeaders;
|
|
250
|
-
}
|
|
251
|
-
}),
|
|
252
|
-
getLeftFooterGroups: utils.memo(function () {
|
|
253
|
-
return [instance.getLeftHeaderGroups()];
|
|
254
|
-
}, function (headerGroups) {
|
|
255
|
-
return [].concat(headerGroups).reverse();
|
|
256
|
-
}, {
|
|
257
|
-
key: 'getLeftFooterGroups',
|
|
258
|
-
debug: function debug() {
|
|
259
|
-
var _instance$options$deb11;
|
|
260
|
-
|
|
261
|
-
return (_instance$options$deb11 = instance.options.debugAll) != null ? _instance$options$deb11 : instance.options.debugHeaders;
|
|
262
|
-
}
|
|
263
|
-
}),
|
|
264
|
-
getCenterFooterGroups: utils.memo(function () {
|
|
265
|
-
return [instance.getCenterHeaderGroups()];
|
|
266
|
-
}, function (headerGroups) {
|
|
267
|
-
return [].concat(headerGroups).reverse();
|
|
268
|
-
}, {
|
|
269
|
-
key: 'getCenterFooterGroups',
|
|
270
|
-
debug: function debug() {
|
|
271
|
-
var _instance$options$deb12;
|
|
272
|
-
|
|
273
|
-
return (_instance$options$deb12 = instance.options.debugAll) != null ? _instance$options$deb12 : instance.options.debugHeaders;
|
|
274
|
-
}
|
|
275
|
-
}),
|
|
276
|
-
getRightFooterGroups: utils.memo(function () {
|
|
277
|
-
return [instance.getRightHeaderGroups()];
|
|
278
|
-
}, function (headerGroups) {
|
|
279
|
-
return [].concat(headerGroups).reverse();
|
|
280
|
-
}, {
|
|
281
|
-
key: 'getRightFooterGroups',
|
|
282
|
-
debug: function debug() {
|
|
283
|
-
var _instance$options$deb13;
|
|
284
|
-
|
|
285
|
-
return (_instance$options$deb13 = instance.options.debugAll) != null ? _instance$options$deb13 : instance.options.debugHeaders;
|
|
286
|
-
}
|
|
287
|
-
}),
|
|
288
|
-
// Flat Headers
|
|
289
|
-
getFlatHeaders: utils.memo(function () {
|
|
290
|
-
return [instance.getHeaderGroups()];
|
|
291
|
-
}, function (headerGroups) {
|
|
292
|
-
return headerGroups.map(function (headerGroup) {
|
|
293
|
-
return headerGroup.headers;
|
|
294
|
-
}).flat();
|
|
295
|
-
}, {
|
|
296
|
-
key: 'getFlatHeaders',
|
|
297
|
-
debug: function debug() {
|
|
298
|
-
var _instance$options$deb14;
|
|
299
|
-
|
|
300
|
-
return (_instance$options$deb14 = instance.options.debugAll) != null ? _instance$options$deb14 : instance.options.debugHeaders;
|
|
301
|
-
}
|
|
302
|
-
}),
|
|
303
|
-
getLeftFlatHeaders: utils.memo(function () {
|
|
304
|
-
return [instance.getLeftHeaderGroups()];
|
|
305
|
-
}, function (left) {
|
|
306
|
-
return left.map(function (headerGroup) {
|
|
307
|
-
return headerGroup.headers;
|
|
308
|
-
}).flat();
|
|
309
|
-
}, {
|
|
310
|
-
key: 'getLeftFlatHeaders',
|
|
311
|
-
debug: function debug() {
|
|
312
|
-
var _instance$options$deb15;
|
|
313
|
-
|
|
314
|
-
return (_instance$options$deb15 = instance.options.debugAll) != null ? _instance$options$deb15 : instance.options.debugHeaders;
|
|
315
|
-
}
|
|
316
|
-
}),
|
|
317
|
-
getCenterFlatHeaders: utils.memo(function () {
|
|
318
|
-
return [instance.getCenterHeaderGroups()];
|
|
319
|
-
}, function (left) {
|
|
320
|
-
return left.map(function (headerGroup) {
|
|
321
|
-
return headerGroup.headers;
|
|
322
|
-
}).flat();
|
|
323
|
-
}, {
|
|
324
|
-
key: 'getCenterFlatHeaders',
|
|
325
|
-
debug: function debug() {
|
|
326
|
-
var _instance$options$deb16;
|
|
327
|
-
|
|
328
|
-
return (_instance$options$deb16 = instance.options.debugAll) != null ? _instance$options$deb16 : instance.options.debugHeaders;
|
|
329
|
-
}
|
|
330
|
-
}),
|
|
331
|
-
getRightFlatHeaders: utils.memo(function () {
|
|
332
|
-
return [instance.getRightHeaderGroups()];
|
|
333
|
-
}, function (left) {
|
|
334
|
-
return left.map(function (headerGroup) {
|
|
335
|
-
return headerGroup.headers;
|
|
336
|
-
}).flat();
|
|
337
|
-
}, {
|
|
338
|
-
key: 'getRightFlatHeaders',
|
|
339
|
-
debug: function debug() {
|
|
340
|
-
var _instance$options$deb17;
|
|
341
|
-
|
|
342
|
-
return (_instance$options$deb17 = instance.options.debugAll) != null ? _instance$options$deb17 : instance.options.debugHeaders;
|
|
343
|
-
}
|
|
344
|
-
}),
|
|
345
|
-
// Leaf Headers
|
|
346
|
-
getCenterLeafHeaders: utils.memo(function () {
|
|
347
|
-
return [instance.getCenterFlatHeaders()];
|
|
348
|
-
}, function (flatHeaders) {
|
|
349
|
-
return flatHeaders.filter(function (header) {
|
|
350
|
-
var _header$subHeaders;
|
|
351
|
-
|
|
352
|
-
return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
|
|
353
|
-
});
|
|
354
|
-
}, {
|
|
355
|
-
key: 'getCenterLeafHeaders',
|
|
356
|
-
debug: function debug() {
|
|
357
|
-
var _instance$options$deb18;
|
|
358
|
-
|
|
359
|
-
return (_instance$options$deb18 = instance.options.debugAll) != null ? _instance$options$deb18 : instance.options.debugHeaders;
|
|
360
|
-
}
|
|
361
|
-
}),
|
|
362
|
-
getLeftLeafHeaders: utils.memo(function () {
|
|
363
|
-
return [instance.getLeftFlatHeaders()];
|
|
364
|
-
}, function (flatHeaders) {
|
|
365
|
-
return flatHeaders.filter(function (header) {
|
|
366
|
-
var _header$subHeaders2;
|
|
367
|
-
|
|
368
|
-
return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
|
|
369
|
-
});
|
|
370
|
-
}, {
|
|
371
|
-
key: 'getLeftLeafHeaders',
|
|
372
|
-
debug: function debug() {
|
|
373
|
-
var _instance$options$deb19;
|
|
374
|
-
|
|
375
|
-
return (_instance$options$deb19 = instance.options.debugAll) != null ? _instance$options$deb19 : instance.options.debugHeaders;
|
|
376
|
-
}
|
|
377
|
-
}),
|
|
378
|
-
getRightLeafHeaders: utils.memo(function () {
|
|
379
|
-
return [instance.getRightFlatHeaders()];
|
|
380
|
-
}, function (flatHeaders) {
|
|
381
|
-
return flatHeaders.filter(function (header) {
|
|
382
|
-
var _header$subHeaders3;
|
|
383
|
-
|
|
384
|
-
return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
|
|
385
|
-
});
|
|
386
|
-
}, {
|
|
387
|
-
key: 'getRightLeafHeaders',
|
|
388
|
-
debug: function debug() {
|
|
389
|
-
var _instance$options$deb20;
|
|
390
|
-
|
|
391
|
-
return (_instance$options$deb20 = instance.options.debugAll) != null ? _instance$options$deb20 : instance.options.debugHeaders;
|
|
392
|
-
}
|
|
393
|
-
}),
|
|
394
|
-
getLeafHeaders: utils.memo(function () {
|
|
395
|
-
return [instance.getLeftHeaderGroups(), instance.getCenterHeaderGroups(), instance.getRightHeaderGroups()];
|
|
396
|
-
}, function (left, center, right) {
|
|
397
|
-
var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
|
|
398
|
-
|
|
399
|
-
return [].concat((_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(function (header) {
|
|
400
|
-
return header.getLeafHeaders();
|
|
401
|
-
}).flat();
|
|
402
|
-
}, {
|
|
403
|
-
key: 'getLeafHeaders',
|
|
404
|
-
debug: function debug() {
|
|
405
|
-
var _instance$options$deb21;
|
|
406
|
-
|
|
407
|
-
return (_instance$options$deb21 = instance.options.debugAll) != null ? _instance$options$deb21 : instance.options.debugHeaders;
|
|
408
|
-
}
|
|
409
|
-
}),
|
|
410
|
-
getHeader: function getHeader(id) {
|
|
411
|
-
var header = [].concat(instance.getFlatHeaders(), instance.getCenterFlatHeaders(), instance.getLeftFlatHeaders(), instance.getRightFlatHeaders()).find(function (d) {
|
|
412
|
-
return d.id === id;
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
if (!header) {
|
|
416
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
417
|
-
console.warn("Could not find header with id: " + id);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
throw new Error();
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
return header;
|
|
424
|
-
},
|
|
425
|
-
getHeaderGroupProps: function getHeaderGroupProps(id, userProps) {
|
|
426
|
-
var headerGroup = instance.getHeaderGroups().find(function (d) {
|
|
427
|
-
return d.id === id;
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
if (!headerGroup) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
return utils.propGetter({
|
|
435
|
-
key: headerGroup.id,
|
|
436
|
-
role: 'row'
|
|
437
|
-
}, userProps);
|
|
438
|
-
},
|
|
439
|
-
getFooterGroupProps: function getFooterGroupProps(id, userProps) {
|
|
440
|
-
var headerGroup = instance.getFooterGroups().find(function (d) {
|
|
441
|
-
return d.id === id;
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
if (!headerGroup) {
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
var initialProps = {
|
|
449
|
-
key: headerGroup.id,
|
|
450
|
-
role: 'row'
|
|
451
|
-
};
|
|
452
|
-
return utils.propGetter(initialProps, userProps);
|
|
453
|
-
},
|
|
454
|
-
getHeaderProps: function getHeaderProps(id, userProps) {
|
|
455
|
-
var header = instance.getHeader(id);
|
|
456
|
-
|
|
457
|
-
if (!header) {
|
|
458
|
-
throw new Error();
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
var initialProps = {
|
|
462
|
-
key: header.id,
|
|
463
|
-
role: 'columnheader',
|
|
464
|
-
colSpan: header.colSpan,
|
|
465
|
-
rowSpan: header.rowSpan
|
|
466
|
-
};
|
|
467
|
-
return utils.propGetter(initialProps, userProps);
|
|
468
|
-
},
|
|
469
|
-
getFooterProps: function getFooterProps(id, userProps) {
|
|
470
|
-
var header = instance.getHeader(id);
|
|
471
|
-
var initialProps = {
|
|
472
|
-
key: header.id,
|
|
473
|
-
role: 'columnfooter',
|
|
474
|
-
colSpan: header.colSpan,
|
|
475
|
-
rowSpan: header.rowSpan
|
|
476
|
-
};
|
|
477
|
-
return utils.propGetter(initialProps, userProps);
|
|
478
|
-
},
|
|
479
|
-
getTotalWidth: function getTotalWidth() {
|
|
480
|
-
var width = 0;
|
|
481
|
-
instance.getVisibleLeafColumns().forEach(function (column) {
|
|
482
|
-
var _column$getWidth;
|
|
483
|
-
|
|
484
|
-
width += (_column$getWidth = column.getWidth()) != null ? _column$getWidth : 0;
|
|
485
|
-
});
|
|
486
|
-
return width;
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
function buildHeaderGroups(allColumns, columnsToGroup, instance, headerFamily) {
|
|
491
|
-
var _headerGroups$0$heade, _headerGroups$;
|
|
492
|
-
|
|
493
|
-
// Find the max depth of the columns:
|
|
494
|
-
// build the leaf column row
|
|
495
|
-
// build each buffer row going up
|
|
496
|
-
// placeholder for non-existent level
|
|
497
|
-
// real column for existing level
|
|
498
|
-
var maxDepth = 0;
|
|
499
|
-
|
|
500
|
-
var findMaxDepth = function findMaxDepth(columns, depth) {
|
|
501
|
-
if (depth === void 0) {
|
|
502
|
-
depth = 1;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
maxDepth = Math.max(maxDepth, depth);
|
|
506
|
-
columns.filter(function (column) {
|
|
507
|
-
return column.getIsVisible();
|
|
508
|
-
}).forEach(function (column) {
|
|
509
|
-
var _column$columns;
|
|
510
|
-
|
|
511
|
-
if ((_column$columns = column.columns) != null && _column$columns.length) {
|
|
512
|
-
findMaxDepth(column.columns, depth + 1);
|
|
513
|
-
}
|
|
514
|
-
}, 0);
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
findMaxDepth(allColumns);
|
|
518
|
-
var headerGroups = [];
|
|
519
|
-
|
|
520
|
-
var createHeaderGroup = function createHeaderGroup(headersToGroup, depth) {
|
|
521
|
-
// The header group we are creating
|
|
522
|
-
var headerGroup = {
|
|
523
|
-
depth: depth,
|
|
524
|
-
id: [headerFamily, "" + depth].filter(Boolean).join('_'),
|
|
525
|
-
headers: [],
|
|
526
|
-
getHeaderGroupProps: function getHeaderGroupProps(getterValue) {
|
|
527
|
-
return instance.getHeaderGroupProps("" + depth, getterValue);
|
|
528
|
-
},
|
|
529
|
-
getFooterGroupProps: function getFooterGroupProps(getterValue) {
|
|
530
|
-
return instance.getFooterGroupProps("" + depth, getterValue);
|
|
531
|
-
}
|
|
532
|
-
}; // The parent columns we're going to scan next
|
|
533
|
-
|
|
534
|
-
var parentHeaders = []; // Scan each column for parents
|
|
535
|
-
|
|
536
|
-
headersToGroup.forEach(function (headerToGroup) {
|
|
537
|
-
// What is the latest (last) parent column?
|
|
538
|
-
var latestParentHeader = [].concat(parentHeaders).reverse()[0];
|
|
539
|
-
var isLeafHeader = headerToGroup.column.depth === headerGroup.depth;
|
|
540
|
-
var column;
|
|
541
|
-
var isPlaceholder = false;
|
|
542
|
-
|
|
543
|
-
if (isLeafHeader && headerToGroup.column.parent) {
|
|
544
|
-
// The parent header is new
|
|
545
|
-
column = headerToGroup.column.parent;
|
|
546
|
-
} else {
|
|
547
|
-
// The parent header is repeated
|
|
548
|
-
column = headerToGroup.column;
|
|
549
|
-
isPlaceholder = true;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
var header = instance.createHeader(column, {
|
|
553
|
-
id: [headerFamily, depth, column.id, headerToGroup == null ? void 0 : headerToGroup.id].filter(Boolean).join('_'),
|
|
554
|
-
isPlaceholder: isPlaceholder,
|
|
555
|
-
placeholderId: isPlaceholder ? "" + parentHeaders.filter(function (d) {
|
|
556
|
-
return d.column === column;
|
|
557
|
-
}).length : undefined,
|
|
558
|
-
depth: depth
|
|
559
|
-
});
|
|
560
|
-
|
|
561
|
-
if (!latestParentHeader || latestParentHeader.column !== header.column) {
|
|
562
|
-
header.subHeaders.push(headerToGroup);
|
|
563
|
-
parentHeaders.push(header);
|
|
564
|
-
} else {
|
|
565
|
-
latestParentHeader.subHeaders.push(headerToGroup);
|
|
566
|
-
} // if (!headerToGroup.isPlaceholder) {
|
|
567
|
-
// headerToGroup.column.header = headerToGroup;
|
|
568
|
-
// }
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
headerGroup.headers.push(headerToGroup);
|
|
572
|
-
});
|
|
573
|
-
headerGroups.push(headerGroup);
|
|
574
|
-
|
|
575
|
-
if (depth > 0) {
|
|
576
|
-
createHeaderGroup(parentHeaders, depth - 1);
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
var bottomHeaders = columnsToGroup.map(function (column) {
|
|
581
|
-
return instance.createHeader(column, {
|
|
582
|
-
depth: maxDepth
|
|
583
|
-
});
|
|
584
|
-
});
|
|
585
|
-
createHeaderGroup(bottomHeaders, maxDepth - 1);
|
|
586
|
-
headerGroups.reverse(); // headerGroups = headerGroups.filter(headerGroup => {
|
|
587
|
-
// return !headerGroup.headers.every(header => header.isPlaceholder)
|
|
588
|
-
// })
|
|
589
|
-
|
|
590
|
-
var recurseHeadersForSpans = function recurseHeadersForSpans(headers) {
|
|
591
|
-
var filteredHeaders = headers.filter(function (header) {
|
|
592
|
-
return header.column.getIsVisible();
|
|
593
|
-
});
|
|
594
|
-
return filteredHeaders.map(function (header) {
|
|
595
|
-
var colSpan = 0;
|
|
596
|
-
var rowSpan = 0;
|
|
597
|
-
var childRowSpans = [0];
|
|
598
|
-
|
|
599
|
-
if (header.subHeaders && header.subHeaders.length) {
|
|
600
|
-
childRowSpans = [];
|
|
601
|
-
recurseHeadersForSpans(header.subHeaders).forEach(function (_ref) {
|
|
602
|
-
var childColSpan = _ref.colSpan,
|
|
603
|
-
childRowSpan = _ref.rowSpan;
|
|
604
|
-
colSpan += childColSpan;
|
|
605
|
-
childRowSpans.push(childRowSpan);
|
|
606
|
-
});
|
|
607
|
-
} else {
|
|
608
|
-
colSpan = 1;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
var minChildRowSpan = Math.min.apply(Math, childRowSpans);
|
|
612
|
-
rowSpan = rowSpan + minChildRowSpan;
|
|
613
|
-
header.colSpan = colSpan > 0 ? colSpan : undefined;
|
|
614
|
-
header.rowSpan = rowSpan > 0 ? rowSpan : undefined;
|
|
615
|
-
return {
|
|
616
|
-
colSpan: colSpan,
|
|
617
|
-
rowSpan: rowSpan
|
|
618
|
-
};
|
|
619
|
-
});
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
recurseHeadersForSpans((_headerGroups$0$heade = (_headerGroups$ = headerGroups[0]) == null ? void 0 : _headerGroups$.headers) != null ? _headerGroups$0$heade : []);
|
|
623
|
-
return headerGroups;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
exports.buildHeaderGroups = buildHeaderGroups;
|
|
627
|
-
exports.createRow = createRow;
|
|
628
|
-
exports.getInstance = getInstance;
|
|
629
|
-
//# sourceMappingURL=Headers.js.map
|