@react-stately/table 3.0.0-beta.0 → 3.0.0-nightly-641446f65-240905
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/dist/Cell.main.js +38 -0
- package/dist/Cell.main.js.map +1 -0
- package/dist/Cell.mjs +33 -0
- package/dist/Cell.module.js +33 -0
- package/dist/Cell.module.js.map +1 -0
- package/dist/Column.main.js +75 -0
- package/dist/Column.main.js.map +1 -0
- package/dist/Column.mjs +66 -0
- package/dist/Column.module.js +66 -0
- package/dist/Column.module.js.map +1 -0
- package/dist/Row.main.js +97 -0
- package/dist/Row.main.js.map +1 -0
- package/dist/Row.mjs +88 -0
- package/dist/Row.module.js +88 -0
- package/dist/Row.module.js.map +1 -0
- package/dist/TableBody.main.js +61 -0
- package/dist/TableBody.main.js.map +1 -0
- package/dist/TableBody.mjs +52 -0
- package/dist/TableBody.module.js +52 -0
- package/dist/TableBody.module.js.map +1 -0
- package/dist/TableCollection.main.js +288 -0
- package/dist/TableCollection.main.js.map +1 -0
- package/dist/TableCollection.mjs +282 -0
- package/dist/TableCollection.module.js +282 -0
- package/dist/TableCollection.module.js.map +1 -0
- package/dist/TableColumnLayout.main.js +113 -0
- package/dist/TableColumnLayout.main.js.map +1 -0
- package/dist/TableColumnLayout.mjs +108 -0
- package/dist/TableColumnLayout.module.js +108 -0
- package/dist/TableColumnLayout.module.js.map +1 -0
- package/dist/TableHeader.main.js +56 -0
- package/dist/TableHeader.main.js.map +1 -0
- package/dist/TableHeader.mjs +47 -0
- package/dist/TableHeader.module.js +47 -0
- package/dist/TableHeader.module.js.map +1 -0
- package/dist/TableUtils.main.js +182 -0
- package/dist/TableUtils.main.js.map +1 -0
- package/dist/TableUtils.mjs +175 -0
- package/dist/TableUtils.module.js +175 -0
- package/dist/TableUtils.module.js.map +1 -0
- package/dist/import.mjs +37 -0
- package/dist/main.js +39 -593
- package/dist/main.js.map +1 -1
- package/dist/module.js +22 -564
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +163 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/useTableColumnResizeState.main.js +109 -0
- package/dist/useTableColumnResizeState.main.js.map +1 -0
- package/dist/useTableColumnResizeState.mjs +104 -0
- package/dist/useTableColumnResizeState.module.js +104 -0
- package/dist/useTableColumnResizeState.module.js.map +1 -0
- package/dist/useTableState.main.js +71 -0
- package/dist/useTableState.main.js.map +1 -0
- package/dist/useTableState.mjs +66 -0
- package/dist/useTableState.module.js +66 -0
- package/dist/useTableState.module.js.map +1 -0
- package/dist/useTreeGridState.main.js +207 -0
- package/dist/useTreeGridState.main.js.map +1 -0
- package/dist/useTreeGridState.mjs +202 -0
- package/dist/useTreeGridState.module.js +202 -0
- package/dist/useTreeGridState.module.js.map +1 -0
- package/package.json +18 -10
- package/src/Cell.ts +4 -1
- package/src/Column.ts +12 -2
- package/src/Row.ts +50 -10
- package/src/TableBody.ts +6 -2
- package/src/TableCollection.ts +99 -15
- package/src/TableColumnLayout.ts +127 -0
- package/src/TableHeader.ts +11 -2
- package/src/TableUtils.ts +253 -0
- package/src/index.ts +15 -6
- package/src/useTableColumnResizeState.ts +147 -0
- package/src/useTableState.ts +43 -16
- package/src/useTreeGridState.ts +277 -0
- package/LICENSE +0 -201
package/dist/main.js
CHANGED
|
@@ -1,575 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exports
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function $d9913277217ff808e9725ade85bf7$var$buildHeaderRows(keyMap, columnNodes) {
|
|
31
|
-
let columns = [];
|
|
32
|
-
let seen = new Map();
|
|
33
|
-
|
|
34
|
-
for (let column of columnNodes) {
|
|
35
|
-
let parentKey = column.parentKey;
|
|
36
|
-
let col = [column];
|
|
37
|
-
|
|
38
|
-
while (parentKey) {
|
|
39
|
-
let parent = keyMap.get(parentKey); // If we've already seen this parent, than it is shared
|
|
40
|
-
// with a previous column. If the current column is taller
|
|
41
|
-
// than the previous column, than we need to shift the parent
|
|
42
|
-
// in the previous column so it's level with the current column.
|
|
43
|
-
|
|
44
|
-
if (seen.has(parent)) {
|
|
45
|
-
parent.colspan++;
|
|
46
|
-
let {
|
|
47
|
-
column,
|
|
48
|
-
index
|
|
49
|
-
} = seen.get(parent);
|
|
50
|
-
|
|
51
|
-
if (index > col.length) {
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (let i = index; i < col.length; i++) {
|
|
56
|
-
column.splice(i, 0, null);
|
|
57
|
-
} // Adjust shifted indices
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
for (let i = col.length; i < column.length; i++) {
|
|
61
|
-
if (column[i] && seen.has(column[i])) {
|
|
62
|
-
seen.get(column[i]).index = i;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
parent.colspan = 1;
|
|
67
|
-
col.push(parent);
|
|
68
|
-
seen.set(parent, {
|
|
69
|
-
column: col,
|
|
70
|
-
index: col.length - 1
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
parentKey = parent.parentKey;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
columns.push(col);
|
|
78
|
-
column.index = columns.length - 1;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
let maxLength = Math.max(...columns.map(c => c.length));
|
|
82
|
-
let headerRows = Array(maxLength).fill(0).map(() => []); // Convert columns into rows.
|
|
83
|
-
|
|
84
|
-
let colIndex = 0;
|
|
85
|
-
|
|
86
|
-
for (let column of columns) {
|
|
87
|
-
let i = maxLength - 1;
|
|
88
|
-
|
|
89
|
-
for (let item of column) {
|
|
90
|
-
if (item) {
|
|
91
|
-
// Fill the space up until the current column with a placeholder
|
|
92
|
-
let row = headerRows[i];
|
|
93
|
-
let rowLength = row.reduce((p, c) => p + c.colspan, 0);
|
|
94
|
-
|
|
95
|
-
if (rowLength < colIndex) {
|
|
96
|
-
let placeholder = {
|
|
97
|
-
type: 'placeholder',
|
|
98
|
-
key: 'placeholder-' + item.key,
|
|
99
|
-
colspan: colIndex - rowLength,
|
|
100
|
-
index: rowLength,
|
|
101
|
-
value: null,
|
|
102
|
-
rendered: null,
|
|
103
|
-
level: i,
|
|
104
|
-
hasChildNodes: false,
|
|
105
|
-
childNodes: [],
|
|
106
|
-
textValue: null
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
if (row.length > 0) {
|
|
110
|
-
row[row.length - 1].nextKey = placeholder.key;
|
|
111
|
-
placeholder.prevKey = row[row.length - 1].key;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
row.push(placeholder);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (row.length > 0) {
|
|
118
|
-
row[row.length - 1].nextKey = item.key;
|
|
119
|
-
item.prevKey = row[row.length - 1].key;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
item.level = i;
|
|
123
|
-
item.index = colIndex;
|
|
124
|
-
row.push(item);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
i--;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
colIndex++;
|
|
131
|
-
} // Add placeholders at the end of each row that is shorter than the maximum
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
let i = 0;
|
|
135
|
-
|
|
136
|
-
for (let row of headerRows) {
|
|
137
|
-
let rowLength = row.reduce((p, c) => p + c.colspan, 0);
|
|
138
|
-
|
|
139
|
-
if (rowLength < columnNodes.length) {
|
|
140
|
-
let placeholder = {
|
|
141
|
-
type: 'placeholder',
|
|
142
|
-
key: 'placeholder-' + row[row.length - 1].key,
|
|
143
|
-
colspan: columnNodes.length - rowLength,
|
|
144
|
-
index: rowLength,
|
|
145
|
-
value: null,
|
|
146
|
-
rendered: null,
|
|
147
|
-
level: i,
|
|
148
|
-
hasChildNodes: false,
|
|
149
|
-
childNodes: [],
|
|
150
|
-
textValue: null,
|
|
151
|
-
prevKey: row[row.length - 1].key
|
|
152
|
-
};
|
|
153
|
-
row.push(placeholder);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
i++;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return headerRows.map((childNodes, index) => {
|
|
160
|
-
let row = {
|
|
161
|
-
type: 'headerrow',
|
|
162
|
-
key: 'headerrow-' + index,
|
|
163
|
-
index,
|
|
164
|
-
value: null,
|
|
165
|
-
rendered: null,
|
|
166
|
-
level: 0,
|
|
167
|
-
hasChildNodes: true,
|
|
168
|
-
childNodes,
|
|
169
|
-
textValue: null
|
|
170
|
-
};
|
|
171
|
-
return row;
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
$d9913277217ff808e9725ade85bf7$var$_Symbol$iterator = Symbol.iterator;
|
|
176
|
-
|
|
177
|
-
class $d9913277217ff808e9725ade85bf7$export$TableCollection extends GridCollection {
|
|
178
|
-
constructor(nodes, prev, opts) {
|
|
179
|
-
let rowHeaderColumnKeys = new Set();
|
|
180
|
-
let body;
|
|
181
|
-
let columns = []; // Add cell for selection checkboxes if needed.
|
|
182
|
-
|
|
183
|
-
if (opts != null && opts.showSelectionCheckboxes) {
|
|
184
|
-
let rowHeaderColumn = {
|
|
185
|
-
type: 'column',
|
|
186
|
-
key: $d9913277217ff808e9725ade85bf7$var$ROW_HEADER_COLUMN_KEY,
|
|
187
|
-
value: null,
|
|
188
|
-
textValue: '',
|
|
189
|
-
level: 0,
|
|
190
|
-
index: 0,
|
|
191
|
-
hasChildNodes: false,
|
|
192
|
-
rendered: null,
|
|
193
|
-
childNodes: [],
|
|
194
|
-
props: {
|
|
195
|
-
isSelectionCell: true
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
columns.unshift(rowHeaderColumn);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
let rows = [];
|
|
202
|
-
let columnKeyMap = new Map();
|
|
203
|
-
|
|
204
|
-
let visit = node => {
|
|
205
|
-
switch (node.type) {
|
|
206
|
-
case 'body':
|
|
207
|
-
body = node;
|
|
208
|
-
break;
|
|
209
|
-
|
|
210
|
-
case 'column':
|
|
211
|
-
columnKeyMap.set(node.key, node);
|
|
212
|
-
|
|
213
|
-
if (!node.hasChildNodes) {
|
|
214
|
-
columns.push(node);
|
|
215
|
-
|
|
216
|
-
if (node.props.isRowHeader) {
|
|
217
|
-
rowHeaderColumnKeys.add(node.key);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
break;
|
|
222
|
-
|
|
223
|
-
case 'item':
|
|
224
|
-
rows.push(node);
|
|
225
|
-
return;
|
|
226
|
-
// do not go into childNodes
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
for (let child of node.childNodes) {
|
|
230
|
-
visit(child);
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
for (let node of nodes) {
|
|
235
|
-
visit(node);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
let headerRows = $d9913277217ff808e9725ade85bf7$var$buildHeaderRows(columnKeyMap, columns);
|
|
239
|
-
headerRows.forEach((row, i) => rows.splice(i, 0, row));
|
|
240
|
-
super({
|
|
241
|
-
columnCount: columns.length,
|
|
242
|
-
items: rows,
|
|
243
|
-
visitNode: node => {
|
|
244
|
-
node.column = columns[node.index];
|
|
245
|
-
return node;
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
this.headerRows = void 0;
|
|
249
|
-
this.columns = void 0;
|
|
250
|
-
this.rowHeaderColumnKeys = void 0;
|
|
251
|
-
this.body = void 0;
|
|
252
|
-
this.columns = columns;
|
|
253
|
-
this.rowHeaderColumnKeys = rowHeaderColumnKeys;
|
|
254
|
-
this.body = body;
|
|
255
|
-
this.headerRows = headerRows; // Default row header column to the first one.
|
|
256
|
-
|
|
257
|
-
if (this.rowHeaderColumnKeys.size === 0) {
|
|
258
|
-
this.rowHeaderColumnKeys.add(this.columns[opts != null && opts.showSelectionCheckboxes ? 1 : 0].key);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
*[$d9913277217ff808e9725ade85bf7$var$_Symbol$iterator]() {
|
|
263
|
-
yield* this.body.childNodes;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
get size() {
|
|
267
|
-
return [...this.body.childNodes].length;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
getKeys() {
|
|
271
|
-
return this.keyMap.keys();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
getKeyBefore(key) {
|
|
275
|
-
let node = this.keyMap.get(key);
|
|
276
|
-
return node ? node.prevKey : null;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
getKeyAfter(key) {
|
|
280
|
-
let node = this.keyMap.get(key);
|
|
281
|
-
return node ? node.nextKey : null;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
getFirstKey() {
|
|
285
|
-
var _;
|
|
286
|
-
|
|
287
|
-
return (_ = [...this.body.childNodes][0]) == null ? void 0 : _.key;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
getLastKey() {
|
|
291
|
-
var _rows;
|
|
292
|
-
|
|
293
|
-
let rows = [...this.body.childNodes];
|
|
294
|
-
return (_rows = rows[rows.length - 1]) == null ? void 0 : _rows.key;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
getItem(key) {
|
|
298
|
-
return this.keyMap.get(key);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const $fa2b602e6c27f83e5a67fb320894ec22$var$OPPOSITE_SORT_DIRECTION = {
|
|
304
|
-
ascending: 'descending',
|
|
305
|
-
descending: 'ascending'
|
|
306
|
-
};
|
|
307
|
-
/**
|
|
308
|
-
* Provides state management for a table component. Handles building a collection
|
|
309
|
-
* of columns and rows from props. In addition, it tracks row selection and manages sort order changes.
|
|
310
|
-
*/
|
|
311
|
-
|
|
312
|
-
function useTableState(props) {
|
|
313
|
-
let {
|
|
314
|
-
selectionMode = 'none'
|
|
315
|
-
} = props;
|
|
316
|
-
let context = useMemo(() => ({
|
|
317
|
-
showSelectionCheckboxes: props.showSelectionCheckboxes && selectionMode !== 'none',
|
|
318
|
-
selectionMode,
|
|
319
|
-
columns: []
|
|
320
|
-
}), [props.children, props.showSelectionCheckboxes, selectionMode]);
|
|
321
|
-
let collection = useCollection(props, (nodes, prev) => new $d9913277217ff808e9725ade85bf7$export$TableCollection(nodes, prev, context), context);
|
|
322
|
-
let {
|
|
323
|
-
disabledKeys,
|
|
324
|
-
selectionManager
|
|
325
|
-
} = useGridState(_babelRuntimeHelpersExtends({}, props, {
|
|
326
|
-
collection
|
|
327
|
-
}));
|
|
328
|
-
return {
|
|
329
|
-
collection,
|
|
330
|
-
disabledKeys,
|
|
331
|
-
selectionManager,
|
|
332
|
-
showSelectionCheckboxes: props.showSelectionCheckboxes || false,
|
|
333
|
-
sortDescriptor: props.sortDescriptor,
|
|
334
|
-
|
|
335
|
-
sort(columnKey) {
|
|
336
|
-
var _props$sortDescriptor;
|
|
337
|
-
|
|
338
|
-
props.onSortChange({
|
|
339
|
-
column: columnKey,
|
|
340
|
-
direction: ((_props$sortDescriptor = props.sortDescriptor) == null ? void 0 : _props$sortDescriptor.column) === columnKey ? $fa2b602e6c27f83e5a67fb320894ec22$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : 'ascending'
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
exports.useTableState = useTableState;
|
|
348
|
-
|
|
349
|
-
function $ef783a8decb4b36dcc38cbf124dc6824$var$TableHeader(props) {
|
|
350
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
351
|
-
return null;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
$ef783a8decb4b36dcc38cbf124dc6824$var$TableHeader.getCollectionNode = function* getCollectionNode(props) {
|
|
355
|
-
let {
|
|
356
|
-
children,
|
|
357
|
-
columns
|
|
358
|
-
} = props;
|
|
359
|
-
|
|
360
|
-
if (typeof children === 'function') {
|
|
361
|
-
if (!columns) {
|
|
362
|
-
throw new Error('props.children was a function but props.columns is missing');
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
for (let column of columns) {
|
|
366
|
-
yield {
|
|
367
|
-
type: 'column',
|
|
368
|
-
value: column,
|
|
369
|
-
renderer: children
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
} else {
|
|
373
|
-
let columns = [];
|
|
374
|
-
|
|
375
|
-
_react.Children.forEach(children, column => {
|
|
376
|
-
columns.push({
|
|
377
|
-
type: 'column',
|
|
378
|
-
element: column
|
|
379
|
-
});
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
yield* columns;
|
|
383
|
-
}
|
|
384
|
-
}; // We don't want getCollectionNode to show up in the type definition
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
let TableHeader = $ef783a8decb4b36dcc38cbf124dc6824$var$TableHeader;
|
|
388
|
-
exports.TableHeader = TableHeader;
|
|
389
|
-
|
|
390
|
-
function $ce24f1f5e076734d069a0bfb95a30678$var$TableBody(props) {
|
|
391
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
392
|
-
return null;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
$ce24f1f5e076734d069a0bfb95a30678$var$TableBody.getCollectionNode = function* getCollectionNode(props) {
|
|
396
|
-
let {
|
|
397
|
-
children,
|
|
398
|
-
items
|
|
399
|
-
} = props;
|
|
400
|
-
yield {
|
|
401
|
-
type: 'body',
|
|
402
|
-
hasChildNodes: true,
|
|
403
|
-
props,
|
|
404
|
-
|
|
405
|
-
*childNodes() {
|
|
406
|
-
if (typeof children === 'function') {
|
|
407
|
-
if (!items) {
|
|
408
|
-
throw new Error('props.children was a function but props.items is missing');
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
for (let item of items) {
|
|
412
|
-
yield {
|
|
413
|
-
type: 'item',
|
|
414
|
-
value: item,
|
|
415
|
-
renderer: children
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
} else {
|
|
419
|
-
let items = [];
|
|
420
|
-
|
|
421
|
-
_react.Children.forEach(children, item => {
|
|
422
|
-
items.push({
|
|
423
|
-
type: 'item',
|
|
424
|
-
element: item
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
yield* items;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
};
|
|
433
|
-
}; // We don't want getCollectionNode to show up in the type definition
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
let TableBody = $ce24f1f5e076734d069a0bfb95a30678$var$TableBody;
|
|
437
|
-
exports.TableBody = TableBody;
|
|
438
|
-
|
|
439
|
-
function $a2ae87b235679ae1eb45693d2634$var$Column(props) {
|
|
440
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
441
|
-
return null;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
$a2ae87b235679ae1eb45693d2634$var$Column.getCollectionNode = function* getCollectionNode(props, context) {
|
|
445
|
-
let {
|
|
446
|
-
title,
|
|
447
|
-
children,
|
|
448
|
-
childColumns
|
|
449
|
-
} = props;
|
|
450
|
-
let fullNodes = yield {
|
|
451
|
-
type: 'column',
|
|
452
|
-
hasChildNodes: !!childColumns || title && _react.Children.count(children) > 0,
|
|
453
|
-
rendered: title || children,
|
|
454
|
-
props,
|
|
455
|
-
|
|
456
|
-
*childNodes() {
|
|
457
|
-
if (childColumns) {
|
|
458
|
-
for (let child of childColumns) {
|
|
459
|
-
yield {
|
|
460
|
-
type: 'column',
|
|
461
|
-
value: child
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
} else if (title) {
|
|
465
|
-
let childColumns = [];
|
|
466
|
-
|
|
467
|
-
_react.Children.forEach(children, child => {
|
|
468
|
-
childColumns.push({
|
|
469
|
-
type: 'column',
|
|
470
|
-
element: child
|
|
471
|
-
});
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
yield* childColumns;
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
|
|
478
|
-
shouldInvalidate(newContext) {
|
|
479
|
-
// This is a bit of a hack, but it works.
|
|
480
|
-
// If this method is called, then there's a cached version of this node available.
|
|
481
|
-
// But, we need to keep the list of columns in the new context up to date.
|
|
482
|
-
updateContext(newContext);
|
|
483
|
-
return false;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
let updateContext = context => {
|
|
489
|
-
// register leaf columns on the context so that <Row> can access them
|
|
490
|
-
for (let node of fullNodes) {
|
|
491
|
-
if (!node.hasChildNodes) {
|
|
492
|
-
context.columns.push(node);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
updateContext(context);
|
|
498
|
-
}; // We don't want getCollectionNode to show up in the type definition
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
let Column = $a2ae87b235679ae1eb45693d2634$var$Column;
|
|
502
|
-
exports.Column = Column;
|
|
503
|
-
|
|
504
|
-
function $f63d1c8574eae6d2444fdbb48df70076$var$Row(props) {
|
|
505
|
-
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
506
|
-
return null;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
$f63d1c8574eae6d2444fdbb48df70076$var$Row.getCollectionNode = function* getCollectionNode(props, context) {
|
|
510
|
-
let {
|
|
511
|
-
children,
|
|
512
|
-
textValue
|
|
513
|
-
} = props;
|
|
514
|
-
yield {
|
|
515
|
-
type: 'item',
|
|
516
|
-
props: props,
|
|
517
|
-
textValue,
|
|
518
|
-
'aria-label': props['aria-label'],
|
|
519
|
-
hasChildNodes: true,
|
|
520
|
-
|
|
521
|
-
*childNodes() {
|
|
522
|
-
// Process cells first
|
|
523
|
-
if (context.showSelectionCheckboxes && context.selectionMode !== 'none') {
|
|
524
|
-
yield {
|
|
525
|
-
type: 'cell',
|
|
526
|
-
key: 'header',
|
|
527
|
-
// this is combined with the row key by CollectionBuilder
|
|
528
|
-
props: {
|
|
529
|
-
isSelectionCell: true
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
if (typeof children === 'function') {
|
|
535
|
-
for (let column of context.columns) {
|
|
536
|
-
yield {
|
|
537
|
-
type: 'cell',
|
|
538
|
-
element: children(column.key),
|
|
539
|
-
key: column.key // this is combined with the row key by CollectionBuilder
|
|
540
|
-
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
} else {
|
|
544
|
-
let cells = [];
|
|
545
|
-
|
|
546
|
-
_react.Children.forEach(children, cell => {
|
|
547
|
-
cells.push({
|
|
548
|
-
type: 'cell',
|
|
549
|
-
element: cell
|
|
550
|
-
});
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
if (cells.length !== context.columns.length) {
|
|
554
|
-
throw new Error("Cell count must match column count. Found " + cells.length + " cells and " + context.columns.length + " columns.");
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
yield* cells;
|
|
558
|
-
}
|
|
559
|
-
},
|
|
560
|
-
|
|
561
|
-
shouldInvalidate(newContext) {
|
|
562
|
-
// Invalidate all rows if the columns changed.
|
|
563
|
-
return newContext.columns.length !== context.columns.length || newContext.columns.some((c, i) => c.key !== context.columns[i].key) || newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes || newContext.selectionMode !== context.selectionMode;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
};
|
|
567
|
-
}; // We don't want getCollectionNode to show up in the type definition
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
let Row = $f63d1c8574eae6d2444fdbb48df70076$var$Row;
|
|
571
|
-
exports.Row = Row;
|
|
572
|
-
|
|
1
|
+
var $7aa22d80cd4ca621$exports = require("./useTableColumnResizeState.main.js");
|
|
2
|
+
var $e3f7784147dde23d$exports = require("./useTableState.main.js");
|
|
3
|
+
var $f45775f5d6f744fa$exports = require("./TableHeader.main.js");
|
|
4
|
+
var $6ec527db6a3a5692$exports = require("./TableBody.main.js");
|
|
5
|
+
var $714483d9f6ca4c55$exports = require("./Column.main.js");
|
|
6
|
+
var $9ec6912e32cc0d81$exports = require("./Row.main.js");
|
|
7
|
+
var $ad4ab0a21c733e1f$exports = require("./Cell.main.js");
|
|
8
|
+
var $7f5a58334d8866a5$exports = require("./TableCollection.main.js");
|
|
9
|
+
var $2240a72410c17d51$exports = require("./TableColumnLayout.main.js");
|
|
10
|
+
var $ed4e0b68b470dcfd$exports = require("./useTreeGridState.main.js");
|
|
11
|
+
var $56JBj$reactstatelycollections = require("@react-stately/collections");
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
function $parcel$export(e, n, v, s) {
|
|
15
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
$parcel$export(module.exports, "useTableColumnResizeState", () => $7aa22d80cd4ca621$exports.useTableColumnResizeState);
|
|
19
|
+
$parcel$export(module.exports, "useTableState", () => $e3f7784147dde23d$exports.useTableState);
|
|
20
|
+
$parcel$export(module.exports, "TableHeader", () => $f45775f5d6f744fa$exports.TableHeader);
|
|
21
|
+
$parcel$export(module.exports, "TableBody", () => $6ec527db6a3a5692$exports.TableBody);
|
|
22
|
+
$parcel$export(module.exports, "Column", () => $714483d9f6ca4c55$exports.Column);
|
|
23
|
+
$parcel$export(module.exports, "Row", () => $9ec6912e32cc0d81$exports.Row);
|
|
24
|
+
$parcel$export(module.exports, "Cell", () => $ad4ab0a21c733e1f$exports.Cell);
|
|
25
|
+
$parcel$export(module.exports, "Section", () => $56JBj$reactstatelycollections.Section);
|
|
26
|
+
$parcel$export(module.exports, "TableCollection", () => $7f5a58334d8866a5$exports.TableCollection);
|
|
27
|
+
$parcel$export(module.exports, "buildHeaderRows", () => $7f5a58334d8866a5$exports.buildHeaderRows);
|
|
28
|
+
$parcel$export(module.exports, "TableColumnLayout", () => $2240a72410c17d51$exports.TableColumnLayout);
|
|
29
|
+
$parcel$export(module.exports, "UNSTABLE_useTreeGridState", () => $ed4e0b68b470dcfd$exports.UNSTABLE_useTreeGridState);
|
|
573
30
|
/*
|
|
574
31
|
* Copyright 2020 Adobe. All rights reserved.
|
|
575
32
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -580,28 +37,17 @@ exports.Row = Row;
|
|
|
580
37
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
581
38
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
582
39
|
* governing permissions and limitations under the License.
|
|
583
|
-
*/
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
588
50
|
|
|
589
|
-
$c30fc85b568b7ecc2de180515d25$var$Cell.getCollectionNode = function* getCollectionNode(props) {
|
|
590
|
-
let {
|
|
591
|
-
children
|
|
592
|
-
} = props;
|
|
593
|
-
let textValue = props.textValue || (typeof children === 'string' ? children : '') || props['aria-label'] || '';
|
|
594
|
-
yield {
|
|
595
|
-
type: 'cell',
|
|
596
|
-
props: props,
|
|
597
|
-
rendered: children,
|
|
598
|
-
textValue,
|
|
599
|
-
'aria-label': props['aria-label'],
|
|
600
|
-
hasChildNodes: false
|
|
601
|
-
};
|
|
602
|
-
}; // We don't want getCollectionNode to show up in the type definition
|
|
603
51
|
|
|
604
52
|
|
|
605
|
-
let Cell = $c30fc85b568b7ecc2de180515d25$var$Cell;
|
|
606
|
-
exports.Cell = Cell;
|
|
607
53
|
//# sourceMappingURL=main.js.map
|