@react-stately/table 3.6.1-nightly.3598 → 3.6.1-nightly.3600
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/main.js +238 -183
- package/dist/main.js.map +1 -1
- package/dist/module.mjs +238 -183
- package/dist/module.mjs.map +1 -1
- package/package.json +9 -9
package/dist/main.js
CHANGED
|
@@ -18,10 +18,18 @@ $parcel$export(module.exports, "Row", () => $9ec6912e32cc0d81$export$b59bdbef9ce
|
|
|
18
18
|
$parcel$export(module.exports, "Cell", () => $ad4ab0a21c733e1f$export$f6f0c3fe4ec306ea);
|
|
19
19
|
$parcel$export(module.exports, "Section", () => $56JBj$reactstatelycollections.Section);
|
|
20
20
|
$parcel$export(module.exports, "TableCollection", () => $7f5a58334d8866a5$export$596e1b2e2cf93690);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/*
|
|
22
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
23
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
25
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
+
*
|
|
27
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
28
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
29
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
30
|
+
* governing permissions and limitations under the License.
|
|
31
|
+
*/ function $3122b463430f41b1$export$f61abf052f87399f(widths) {
|
|
32
|
+
return Array.from(widths).map((e)=>e[1]).reduce((acc, cur)=>acc + cur, 0);
|
|
25
33
|
}
|
|
26
34
|
function $3122b463430f41b1$export$1994a077b98ee0d5(width) {
|
|
27
35
|
return width != null && (!isNaN(width) || String(width).match(/^(\d+)(?=%$)/) !== null);
|
|
@@ -31,15 +39,15 @@ function $3122b463430f41b1$var$parseFractionalUnit(width) {
|
|
|
31
39
|
let match = width.match(/^(\d+)(?=fr$)/);
|
|
32
40
|
// if width is the incorrect format, just deafult it to a 1fr
|
|
33
41
|
if (!match) {
|
|
34
|
-
console.warn(`width: ${width} is not a supported format, width should be a number (ex. 150), percentage (ex. '50%') or fr unit (ex. '2fr')`,
|
|
42
|
+
console.warn(`width: ${width} is not a supported format, width should be a number (ex. 150), percentage (ex. '50%') or fr unit (ex. '2fr')`, "defaulting to '1fr'");
|
|
35
43
|
return 1;
|
|
36
44
|
}
|
|
37
45
|
return parseInt(match[0], 10);
|
|
38
46
|
}
|
|
39
47
|
function $3122b463430f41b1$export$7bbad27896f7ae9f(width, tableWidth) {
|
|
40
|
-
if (typeof width ===
|
|
48
|
+
if (typeof width === "string") {
|
|
41
49
|
let match = width.match(/^(\d+)(?=%$)/);
|
|
42
|
-
if (!match) throw new Error(
|
|
50
|
+
if (!match) throw new Error("Only percentages or numbers are supported for static column widths");
|
|
43
51
|
return tableWidth * (parseInt(match[0], 10) / 100);
|
|
44
52
|
}
|
|
45
53
|
return width;
|
|
@@ -51,8 +59,7 @@ function $3122b463430f41b1$export$f556054ce4358701(minWidth, tableWidth) {
|
|
|
51
59
|
return minWidth != null ? $3122b463430f41b1$export$7bbad27896f7ae9f(minWidth, tableWidth) : 75;
|
|
52
60
|
}
|
|
53
61
|
function $3122b463430f41b1$var$mapDynamicColumns(dynamicColumns, availableSpace, tableWidth) {
|
|
54
|
-
let fractions = dynamicColumns.reduce((sum, column)=>sum + $3122b463430f41b1$var$parseFractionalUnit(column.props.defaultWidth)
|
|
55
|
-
, 0);
|
|
62
|
+
let fractions = dynamicColumns.reduce((sum, column)=>sum + $3122b463430f41b1$var$parseFractionalUnit(column.props.defaultWidth), 0);
|
|
56
63
|
let columns = dynamicColumns.map((column, index)=>{
|
|
57
64
|
const targetWidth = $3122b463430f41b1$var$parseFractionalUnit(column.props.defaultWidth) * availableSpace / fractions;
|
|
58
65
|
const delta = Math.max($3122b463430f41b1$export$f556054ce4358701(column.props.minWidth, tableWidth) - targetWidth, targetWidth - $3122b463430f41b1$export$59185c62a7544aa0(column.props.maxWidth, tableWidth));
|
|
@@ -65,8 +72,7 @@ function $3122b463430f41b1$var$mapDynamicColumns(dynamicColumns, availableSpace,
|
|
|
65
72
|
return columns;
|
|
66
73
|
}
|
|
67
74
|
function $3122b463430f41b1$var$findDynamicColumnWidths(dynamicColumns, availableSpace, tableWidth) {
|
|
68
|
-
let fractions = dynamicColumns.reduce((sum, col)=>sum + $3122b463430f41b1$var$parseFractionalUnit(col.props.defaultWidth)
|
|
69
|
-
, 0);
|
|
75
|
+
let fractions = dynamicColumns.reduce((sum, col)=>sum + $3122b463430f41b1$var$parseFractionalUnit(col.props.defaultWidth), 0);
|
|
70
76
|
const columns = dynamicColumns.map((column)=>{
|
|
71
77
|
const targetWidth = $3122b463430f41b1$var$parseFractionalUnit(column.props.defaultWidth) * availableSpace / fractions;
|
|
72
78
|
let width = Math.max($3122b463430f41b1$export$f556054ce4358701(column.props.minWidth, tableWidth), Math.min(Math.floor(targetWidth), $3122b463430f41b1$export$59185c62a7544aa0(column.props.maxWidth, tableWidth)));
|
|
@@ -79,11 +85,9 @@ function $3122b463430f41b1$var$findDynamicColumnWidths(dynamicColumns, available
|
|
|
79
85
|
}
|
|
80
86
|
function $3122b463430f41b1$export$a870e6692ac5ccb2(dynamicColumns, availableSpace, tableWidth) {
|
|
81
87
|
let columns = $3122b463430f41b1$var$mapDynamicColumns(dynamicColumns, availableSpace, tableWidth);
|
|
82
|
-
columns.sort((a, b)=>b.delta - a.delta
|
|
83
|
-
);
|
|
88
|
+
columns.sort((a, b)=>b.delta - a.delta);
|
|
84
89
|
columns = $3122b463430f41b1$var$findDynamicColumnWidths(columns, availableSpace, tableWidth);
|
|
85
|
-
columns.sort((a, b)=>a.index - b.index
|
|
86
|
-
);
|
|
90
|
+
columns.sort((a, b)=>a.index - b.index);
|
|
87
91
|
return columns;
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -91,21 +95,20 @@ function $3122b463430f41b1$export$a870e6692ac5ccb2(dynamicColumns, availableSpac
|
|
|
91
95
|
|
|
92
96
|
function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
|
|
93
97
|
const { getDefaultWidth: getDefaultWidth , tableWidth: defaultTableWidth = null } = props;
|
|
94
|
-
const { columns:
|
|
95
|
-
const columnsRef = $56JBj$react.useRef([]);
|
|
96
|
-
const tableWidth = $56JBj$react.useRef(defaultTableWidth);
|
|
97
|
-
const isResizing = $56JBj$react.useRef(null);
|
|
98
|
-
const startResizeContentWidth = $56JBj$react.useRef();
|
|
99
|
-
const [columnWidths, setColumnWidths] = $56JBj$react.useState(new Map(
|
|
98
|
+
const { columns: columns } = state;
|
|
99
|
+
const columnsRef = (0, $56JBj$react.useRef)([]);
|
|
100
|
+
const tableWidth = (0, $56JBj$react.useRef)(defaultTableWidth);
|
|
101
|
+
const isResizing = (0, $56JBj$react.useRef)(null);
|
|
102
|
+
const startResizeContentWidth = (0, $56JBj$react.useRef)();
|
|
103
|
+
const [columnWidths, setColumnWidths] = (0, $56JBj$react.useState)(new Map(columns.map((col)=>[
|
|
100
104
|
col.key,
|
|
101
105
|
0
|
|
102
|
-
]
|
|
103
|
-
))
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const [currentlyResizingColumn, setCurrentlyResizingColumn] = $56JBj$react.useState(null);
|
|
106
|
+
])));
|
|
107
|
+
const columnWidthsRef = (0, $56JBj$react.useRef)(columnWidths);
|
|
108
|
+
const affectedColumnWidthsRef = (0, $56JBj$react.useRef)([]);
|
|
109
|
+
const [resizedColumns, setResizedColumns] = (0, $56JBj$react.useState)(new Set());
|
|
110
|
+
const resizedColumnsRef = (0, $56JBj$react.useRef)(resizedColumns);
|
|
111
|
+
const [currentlyResizingColumn, setCurrentlyResizingColumn] = (0, $56JBj$react.useState)(null);
|
|
109
112
|
function setColumnWidthsForRef(newWidths) {
|
|
110
113
|
columnWidthsRef.current = newWidths;
|
|
111
114
|
// new map so that change detection is triggered
|
|
@@ -114,17 +117,17 @@ function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
|
|
|
114
117
|
/*
|
|
115
118
|
returns the resolved column width in this order:
|
|
116
119
|
previously calculated width -> controlled width prop -> uncontrolled defaultWidth prop -> dev assigned width -> default dynamic width
|
|
117
|
-
*/ let getResolvedColumnWidth = $56JBj$react.useCallback((column)=>{
|
|
120
|
+
*/ let getResolvedColumnWidth = (0, $56JBj$react.useCallback)((column)=>{
|
|
118
121
|
let columnProps = column.props;
|
|
119
122
|
var _width, ref, ref1;
|
|
120
|
-
return (resizedColumns === null || resizedColumns === void 0 ? void 0 : resizedColumns.has(column.key)) ? columnWidthsRef.current.get(column.key) : (ref1 = (ref = (_width = columnProps.width) !== null && _width !== void 0 ? _width : columnProps.defaultWidth) !== null && ref !== void 0 ? ref : getDefaultWidth === null || getDefaultWidth === void 0 ? void 0 : getDefaultWidth(column.props)) !== null && ref1 !== void 0 ? ref1 :
|
|
123
|
+
return (resizedColumns === null || resizedColumns === void 0 ? void 0 : resizedColumns.has(column.key)) ? columnWidthsRef.current.get(column.key) : (ref1 = (ref = (_width = columnProps.width) !== null && _width !== void 0 ? _width : columnProps.defaultWidth) !== null && ref !== void 0 ? ref : getDefaultWidth === null || getDefaultWidth === void 0 ? void 0 : getDefaultWidth(column.props)) !== null && ref1 !== void 0 ? ref1 : "1fr";
|
|
121
124
|
}, [
|
|
122
125
|
getDefaultWidth,
|
|
123
126
|
resizedColumns
|
|
124
127
|
]);
|
|
125
|
-
let getStaticAndDynamicColumns = $56JBj$react.useCallback((columns)=>columns.reduce((acc, column)=>{
|
|
128
|
+
let getStaticAndDynamicColumns = (0, $56JBj$react.useCallback)((columns)=>columns.reduce((acc, column)=>{
|
|
126
129
|
let width = getResolvedColumnWidth(column);
|
|
127
|
-
return $3122b463430f41b1$export$1994a077b98ee0d5(width) ? {
|
|
130
|
+
return (0, $3122b463430f41b1$export$1994a077b98ee0d5)(width) ? {
|
|
128
131
|
...acc,
|
|
129
132
|
staticColumns: [
|
|
130
133
|
...acc.staticColumns,
|
|
@@ -140,23 +143,22 @@ function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
|
|
|
140
143
|
}, {
|
|
141
144
|
staticColumns: [],
|
|
142
145
|
dynamicColumns: []
|
|
143
|
-
})
|
|
144
|
-
, [
|
|
146
|
+
}), [
|
|
145
147
|
getResolvedColumnWidth
|
|
146
148
|
]);
|
|
147
|
-
let buildColumnWidths = $56JBj$react.useCallback((affectedColumns, availableSpace)=>{
|
|
149
|
+
let buildColumnWidths = (0, $56JBj$react.useCallback)((affectedColumns, availableSpace)=>{
|
|
148
150
|
const widths = new Map();
|
|
149
151
|
let remainingSpace = availableSpace;
|
|
150
152
|
const { staticColumns: staticColumns , dynamicColumns: dynamicColumns } = getStaticAndDynamicColumns(affectedColumns);
|
|
151
153
|
staticColumns.forEach((column)=>{
|
|
152
154
|
let width = getResolvedColumnWidth(column);
|
|
153
|
-
let w = $3122b463430f41b1$export$7bbad27896f7ae9f(width, tableWidth.current);
|
|
155
|
+
let w = (0, $3122b463430f41b1$export$7bbad27896f7ae9f)(width, tableWidth.current);
|
|
154
156
|
widths.set(column.key, w);
|
|
155
157
|
remainingSpace -= w;
|
|
156
158
|
});
|
|
157
159
|
// dynamic columns
|
|
158
160
|
if (dynamicColumns.length > 0) {
|
|
159
|
-
const newColumnWidths = $3122b463430f41b1$export$a870e6692ac5ccb2(dynamicColumns, remainingSpace, tableWidth.current);
|
|
161
|
+
const newColumnWidths = (0, $3122b463430f41b1$export$a870e6692ac5ccb2)(dynamicColumns, remainingSpace, tableWidth.current);
|
|
160
162
|
for (let column of newColumnWidths)widths.set(column.key, column.calculatedWidth);
|
|
161
163
|
}
|
|
162
164
|
return widths;
|
|
@@ -164,22 +166,19 @@ function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
|
|
|
164
166
|
getStaticAndDynamicColumns,
|
|
165
167
|
getResolvedColumnWidth
|
|
166
168
|
]);
|
|
167
|
-
const prevColKeys = columnsRef.current.map((col)=>col.key
|
|
168
|
-
);
|
|
169
|
-
const colKeys = columns1.map((col)=>col.key
|
|
170
|
-
);
|
|
169
|
+
const prevColKeys = columnsRef.current.map((col)=>col.key);
|
|
170
|
+
const colKeys = columns.map((col)=>col.key);
|
|
171
171
|
// if the columns change, need to rebuild widths.
|
|
172
|
-
if (prevColKeys.length !== colKeys.length || !colKeys.every((col, i)=>col === prevColKeys[i]
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const widths = buildColumnWidths(columns1, tableWidth.current);
|
|
172
|
+
if (prevColKeys.length !== colKeys.length || !colKeys.every((col, i)=>col === prevColKeys[i])) {
|
|
173
|
+
columnsRef.current = columns;
|
|
174
|
+
const widths = buildColumnWidths(columns, tableWidth.current);
|
|
176
175
|
setColumnWidthsForRef(widths);
|
|
177
176
|
}
|
|
178
177
|
function setTableWidth(width) {
|
|
179
178
|
if (width && width !== tableWidth.current) {
|
|
180
179
|
tableWidth.current = width;
|
|
181
180
|
if (!isResizing.current) {
|
|
182
|
-
const widths = buildColumnWidths(
|
|
181
|
+
const widths = buildColumnWidths(columns, width);
|
|
183
182
|
setColumnWidthsForRef(widths);
|
|
184
183
|
}
|
|
185
184
|
}
|
|
@@ -187,7 +186,7 @@ function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
|
|
|
187
186
|
function onColumnResizeStart(column) {
|
|
188
187
|
setCurrentlyResizingColumn(column.key);
|
|
189
188
|
isResizing.current = true;
|
|
190
|
-
startResizeContentWidth.current = $3122b463430f41b1$export$f61abf052f87399f(columnWidthsRef.current);
|
|
189
|
+
startResizeContentWidth.current = (0, $3122b463430f41b1$export$f61abf052f87399f)(columnWidthsRef.current);
|
|
191
190
|
}
|
|
192
191
|
function onColumnResize(column, width) {
|
|
193
192
|
let widthsObj = resizeColumn(column, width);
|
|
@@ -203,23 +202,22 @@ function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
|
|
|
203
202
|
let widths = new Map(columnWidthsRef.current);
|
|
204
203
|
setColumnWidthsForRef(widths);
|
|
205
204
|
}
|
|
206
|
-
function resizeColumn(
|
|
207
|
-
let boundedWidth = Math.max($3122b463430f41b1$export$f556054ce4358701(
|
|
205
|
+
function resizeColumn(column, newWidth) {
|
|
206
|
+
let boundedWidth = Math.max((0, $3122b463430f41b1$export$f556054ce4358701)(column.props.minWidth, tableWidth.current), Math.min(Math.floor(newWidth), (0, $3122b463430f41b1$export$59185c62a7544aa0)(column.props.maxWidth, tableWidth.current)));
|
|
208
207
|
// copy the columnWidths map and set the new width for the column being resized
|
|
209
208
|
let widths = new Map(columnWidthsRef.current);
|
|
210
|
-
widths.set(
|
|
209
|
+
widths.set(column.key, boundedWidth);
|
|
211
210
|
// keep track of all columns that have been sized
|
|
212
|
-
resizedColumnsRef.current.add(
|
|
211
|
+
resizedColumnsRef.current.add(column.key);
|
|
213
212
|
setResizedColumns(resizedColumnsRef.current);
|
|
214
213
|
// get the columns affected by resize and remaining space
|
|
215
|
-
const resizeIndex = columnsRef.current.findIndex((col)=>col.key ===
|
|
216
|
-
);
|
|
214
|
+
const resizeIndex = columnsRef.current.findIndex((col)=>col.key === column.key);
|
|
217
215
|
let affectedColumns = columnsRef.current.slice(resizeIndex + 1);
|
|
218
216
|
// we only care about the columns that CAN be resized, we ignore static columns.
|
|
219
217
|
let { dynamicColumns: dynamicColumns } = getStaticAndDynamicColumns(affectedColumns);
|
|
220
218
|
// available space for affected columns
|
|
221
219
|
let availableSpace = columnsRef.current.reduce((acc, column, index)=>{
|
|
222
|
-
if (index <= resizeIndex || $3122b463430f41b1$export$1994a077b98ee0d5(getResolvedColumnWidth(column))) return acc - widths.get(column.key);
|
|
220
|
+
if (index <= resizeIndex || (0, $3122b463430f41b1$export$1994a077b98ee0d5)(getResolvedColumnWidth(column))) return acc - widths.get(column.key);
|
|
223
221
|
return acc;
|
|
224
222
|
}, tableWidth.current);
|
|
225
223
|
// merge the unaffected column widths and the recalculated column widths
|
|
@@ -234,39 +232,35 @@ function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
|
|
|
234
232
|
so we need to add it to the list of affected columns
|
|
235
233
|
*/ let allAffectedColumns = [
|
|
236
234
|
[
|
|
237
|
-
|
|
235
|
+
column.key,
|
|
238
236
|
boundedWidth
|
|
239
237
|
],
|
|
240
238
|
...recalculatedColumnWidths
|
|
241
239
|
].map(([key, width])=>({
|
|
242
240
|
key: key,
|
|
243
241
|
width: width
|
|
244
|
-
})
|
|
245
|
-
);
|
|
242
|
+
}));
|
|
246
243
|
return allAffectedColumns;
|
|
247
244
|
}
|
|
248
|
-
var
|
|
245
|
+
var ref;
|
|
249
246
|
// This function is regenerated whenever columnWidthsRef.current changes in order to get the new correct ref value.
|
|
250
247
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
251
|
-
let getColumnWidth = $56JBj$react.useCallback((key)=>(
|
|
252
|
-
, [
|
|
248
|
+
let getColumnWidth = (0, $56JBj$react.useCallback)((key)=>(ref = columnWidthsRef.current.get(key)) !== null && ref !== void 0 ? ref : 0, [
|
|
253
249
|
columnWidthsRef.current
|
|
254
250
|
]);
|
|
255
|
-
let getColumnMinWidth = $56JBj$react.useCallback((key)=>{
|
|
256
|
-
const columnIndex =
|
|
257
|
-
);
|
|
251
|
+
let getColumnMinWidth = (0, $56JBj$react.useCallback)((key)=>{
|
|
252
|
+
const columnIndex = columns.findIndex((col)=>col.key === key);
|
|
258
253
|
if (columnIndex === -1) return;
|
|
259
|
-
return $3122b463430f41b1$export$f556054ce4358701(
|
|
254
|
+
return (0, $3122b463430f41b1$export$f556054ce4358701)(columns[columnIndex].props.minWidth, tableWidth.current);
|
|
260
255
|
}, [
|
|
261
|
-
|
|
256
|
+
columns
|
|
262
257
|
]);
|
|
263
|
-
let getColumnMaxWidth = $56JBj$react.useCallback((key)=>{
|
|
264
|
-
const columnIndex =
|
|
265
|
-
);
|
|
258
|
+
let getColumnMaxWidth = (0, $56JBj$react.useCallback)((key)=>{
|
|
259
|
+
const columnIndex = columns.findIndex((col)=>col.key === key);
|
|
266
260
|
if (columnIndex === -1) return;
|
|
267
|
-
return $3122b463430f41b1$export$59185c62a7544aa0(
|
|
261
|
+
return (0, $3122b463430f41b1$export$59185c62a7544aa0)(columns[columnIndex].props.maxWidth, tableWidth.current);
|
|
268
262
|
}, [
|
|
269
|
-
|
|
263
|
+
columns
|
|
270
264
|
]);
|
|
271
265
|
return {
|
|
272
266
|
columnWidths: columnWidthsRef,
|
|
@@ -282,10 +276,30 @@ function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
|
|
|
282
276
|
}
|
|
283
277
|
|
|
284
278
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
279
|
+
/*
|
|
280
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
281
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
282
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
283
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
284
|
+
*
|
|
285
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
286
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
287
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
288
|
+
* governing permissions and limitations under the License.
|
|
289
|
+
*/
|
|
290
|
+
|
|
291
|
+
/*
|
|
292
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
293
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
294
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
295
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
296
|
+
*
|
|
297
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
298
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
299
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
300
|
+
* governing permissions and limitations under the License.
|
|
301
|
+
*/
|
|
302
|
+
const $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY = "row-header-column-" + Math.random().toString(36).slice(2);
|
|
289
303
|
function $7f5a58334d8866a5$var$buildHeaderRows(keyMap, columnNodes) {
|
|
290
304
|
let columns = [];
|
|
291
305
|
let seen = new Map();
|
|
@@ -302,12 +316,12 @@ function $7f5a58334d8866a5$var$buildHeaderRows(keyMap, columnNodes) {
|
|
|
302
316
|
// in the previous column so it's level with the current column.
|
|
303
317
|
if (seen.has(parent)) {
|
|
304
318
|
parent.colspan++;
|
|
305
|
-
let { column:
|
|
319
|
+
let { column: column1 , index: index } = seen.get(parent);
|
|
306
320
|
if (index > col.length) break;
|
|
307
|
-
for(let i = index; i < col.length; i++)
|
|
321
|
+
for(let i = index; i < col.length; i++)column1.splice(i, 0, null);
|
|
308
322
|
// Adjust shifted indices
|
|
309
|
-
for(let i1 = col.length; i1 <
|
|
310
|
-
if (
|
|
323
|
+
for(let i1 = col.length; i1 < column1.length; i1++)// eslint-disable-next-line max-depth
|
|
324
|
+
if (column1[i1] && seen.has(column1[i1])) seen.get(column1[i1]).index = i1;
|
|
311
325
|
} else {
|
|
312
326
|
parent.colspan = 1;
|
|
313
327
|
col.push(parent);
|
|
@@ -321,29 +335,26 @@ function $7f5a58334d8866a5$var$buildHeaderRows(keyMap, columnNodes) {
|
|
|
321
335
|
columns.push(col);
|
|
322
336
|
column.index = columns.length - 1;
|
|
323
337
|
}
|
|
324
|
-
let maxLength = Math.max(...columns.map((c)=>c.length
|
|
325
|
-
));
|
|
326
|
-
let headerRows = Array(maxLength).fill(0).map(()=>[]
|
|
327
|
-
);
|
|
338
|
+
let maxLength = Math.max(...columns.map((c)=>c.length));
|
|
339
|
+
let headerRows = Array(maxLength).fill(0).map(()=>[]);
|
|
328
340
|
// Convert columns into rows.
|
|
329
341
|
let colIndex = 0;
|
|
330
|
-
for (let
|
|
331
|
-
let
|
|
332
|
-
for (let item of
|
|
342
|
+
for (let column2 of columns){
|
|
343
|
+
let i2 = maxLength - 1;
|
|
344
|
+
for (let item of column2){
|
|
333
345
|
if (item) {
|
|
334
346
|
// Fill the space up until the current column with a placeholder
|
|
335
|
-
let row = headerRows[
|
|
336
|
-
let rowLength = row.reduce((p, c)=>p + c.colspan
|
|
337
|
-
, 0);
|
|
347
|
+
let row = headerRows[i2];
|
|
348
|
+
let rowLength = row.reduce((p, c)=>p + c.colspan, 0);
|
|
338
349
|
if (rowLength < colIndex) {
|
|
339
350
|
let placeholder = {
|
|
340
|
-
type:
|
|
341
|
-
key:
|
|
351
|
+
type: "placeholder",
|
|
352
|
+
key: "placeholder-" + item.key,
|
|
342
353
|
colspan: colIndex - rowLength,
|
|
343
354
|
index: rowLength,
|
|
344
355
|
value: null,
|
|
345
356
|
rendered: null,
|
|
346
|
-
level:
|
|
357
|
+
level: i2,
|
|
347
358
|
hasChildNodes: false,
|
|
348
359
|
childNodes: [],
|
|
349
360
|
textValue: null
|
|
@@ -359,41 +370,40 @@ function $7f5a58334d8866a5$var$buildHeaderRows(keyMap, columnNodes) {
|
|
|
359
370
|
row[row.length - 1].nextKey = item.key;
|
|
360
371
|
item.prevKey = row[row.length - 1].key;
|
|
361
372
|
}
|
|
362
|
-
item.level =
|
|
373
|
+
item.level = i2;
|
|
363
374
|
item.colIndex = colIndex;
|
|
364
375
|
row.push(item);
|
|
365
376
|
}
|
|
366
|
-
|
|
377
|
+
i2--;
|
|
367
378
|
}
|
|
368
379
|
colIndex++;
|
|
369
380
|
}
|
|
370
381
|
// Add placeholders at the end of each row that is shorter than the maximum
|
|
371
|
-
let
|
|
382
|
+
let i3 = 0;
|
|
372
383
|
for (let row1 of headerRows){
|
|
373
|
-
let
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
index: rowLength,
|
|
384
|
+
let rowLength1 = row1.reduce((p, c)=>p + c.colspan, 0);
|
|
385
|
+
if (rowLength1 < columnNodes.length) {
|
|
386
|
+
let placeholder1 = {
|
|
387
|
+
type: "placeholder",
|
|
388
|
+
key: "placeholder-" + row1[row1.length - 1].key,
|
|
389
|
+
colspan: columnNodes.length - rowLength1,
|
|
390
|
+
index: rowLength1,
|
|
381
391
|
value: null,
|
|
382
392
|
rendered: null,
|
|
383
|
-
level:
|
|
393
|
+
level: i3,
|
|
384
394
|
hasChildNodes: false,
|
|
385
395
|
childNodes: [],
|
|
386
396
|
textValue: null,
|
|
387
397
|
prevKey: row1[row1.length - 1].key
|
|
388
398
|
};
|
|
389
|
-
row1.push(
|
|
399
|
+
row1.push(placeholder1);
|
|
390
400
|
}
|
|
391
|
-
|
|
401
|
+
i3++;
|
|
392
402
|
}
|
|
393
403
|
return headerRows.map((childNodes, index)=>{
|
|
394
404
|
let row = {
|
|
395
|
-
type:
|
|
396
|
-
key:
|
|
405
|
+
type: "headerrow",
|
|
406
|
+
key: "headerrow-" + index,
|
|
397
407
|
index: index,
|
|
398
408
|
value: null,
|
|
399
409
|
rendered: null,
|
|
@@ -405,9 +415,8 @@ function $7f5a58334d8866a5$var$buildHeaderRows(keyMap, columnNodes) {
|
|
|
405
415
|
return row;
|
|
406
416
|
});
|
|
407
417
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
*[tmp]() {
|
|
418
|
+
class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends (0, $56JBj$reactstatelygrid.GridCollection) {
|
|
419
|
+
*[Symbol.iterator]() {
|
|
411
420
|
yield* this.body.childNodes;
|
|
412
421
|
}
|
|
413
422
|
get size() {
|
|
@@ -455,10 +464,10 @@ class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends $56JBj$reactstatelygrid.
|
|
|
455
464
|
// Add cell for selection checkboxes if needed.
|
|
456
465
|
if (opts === null || opts === void 0 ? void 0 : opts.showSelectionCheckboxes) {
|
|
457
466
|
let rowHeaderColumn = {
|
|
458
|
-
type:
|
|
467
|
+
type: "column",
|
|
459
468
|
key: $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY,
|
|
460
469
|
value: null,
|
|
461
|
-
textValue:
|
|
470
|
+
textValue: "",
|
|
462
471
|
level: 0,
|
|
463
472
|
index: 0,
|
|
464
473
|
hasChildNodes: false,
|
|
@@ -474,26 +483,25 @@ class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends $56JBj$reactstatelygrid.
|
|
|
474
483
|
let columnKeyMap = new Map();
|
|
475
484
|
let visit = (node)=>{
|
|
476
485
|
switch(node.type){
|
|
477
|
-
case
|
|
486
|
+
case "body":
|
|
478
487
|
body = node;
|
|
479
488
|
break;
|
|
480
|
-
case
|
|
489
|
+
case "column":
|
|
481
490
|
columnKeyMap.set(node.key, node);
|
|
482
491
|
if (!node.hasChildNodes) {
|
|
483
492
|
columns.push(node);
|
|
484
493
|
if (node.props.isRowHeader) rowHeaderColumnKeys.add(node.key);
|
|
485
494
|
}
|
|
486
495
|
break;
|
|
487
|
-
case
|
|
496
|
+
case "item":
|
|
488
497
|
rows.push(node);
|
|
489
498
|
return; // do not go into childNodes
|
|
490
499
|
}
|
|
491
500
|
for (let child of node.childNodes)visit(child);
|
|
492
501
|
};
|
|
493
|
-
for (let
|
|
502
|
+
for (let node of nodes)visit(node);
|
|
494
503
|
let headerRows = $7f5a58334d8866a5$var$buildHeaderRows(columnKeyMap, columns);
|
|
495
|
-
headerRows.forEach((row, i)=>rows.splice(i, 0, row)
|
|
496
|
-
);
|
|
504
|
+
headerRows.forEach((row, i)=>rows.splice(i, 0, row));
|
|
497
505
|
super({
|
|
498
506
|
columnCount: columns.length,
|
|
499
507
|
items: rows,
|
|
@@ -514,28 +522,26 @@ class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends $56JBj$reactstatelygrid.
|
|
|
514
522
|
|
|
515
523
|
|
|
516
524
|
const $e3f7784147dde23d$var$OPPOSITE_SORT_DIRECTION = {
|
|
517
|
-
ascending:
|
|
518
|
-
descending:
|
|
525
|
+
ascending: "descending",
|
|
526
|
+
descending: "ascending"
|
|
519
527
|
};
|
|
520
528
|
function $e3f7784147dde23d$export$907bcc6c48325fd6(props) {
|
|
521
|
-
let [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = $56JBj$react.useState(false);
|
|
522
|
-
let { selectionMode: selectionMode =
|
|
523
|
-
let context = $56JBj$react.useMemo(()=>({
|
|
524
|
-
showSelectionCheckboxes: props.showSelectionCheckboxes && selectionMode !==
|
|
529
|
+
let [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = (0, $56JBj$react.useState)(false);
|
|
530
|
+
let { selectionMode: selectionMode = "none" } = props;
|
|
531
|
+
let context = (0, $56JBj$react.useMemo)(()=>({
|
|
532
|
+
showSelectionCheckboxes: props.showSelectionCheckboxes && selectionMode !== "none",
|
|
525
533
|
selectionMode: selectionMode,
|
|
526
534
|
columns: []
|
|
527
|
-
})
|
|
528
|
-
, [
|
|
535
|
+
}), [
|
|
529
536
|
props.children,
|
|
530
537
|
props.showSelectionCheckboxes,
|
|
531
538
|
selectionMode
|
|
532
539
|
]);
|
|
533
|
-
let collection = $56JBj$reactstatelycollections.useCollection(props, (nodes, prev)=>new $7f5a58334d8866a5$export$596e1b2e2cf93690(nodes, prev, context)
|
|
534
|
-
,
|
|
535
|
-
let { disabledKeys: disabledKeys , selectionManager: selectionManager } = $56JBj$reactstatelygrid.useGridState({
|
|
540
|
+
let collection = (0, $56JBj$reactstatelycollections.useCollection)(props, (nodes, prev)=>new (0, $7f5a58334d8866a5$export$596e1b2e2cf93690)(nodes, prev, context), context);
|
|
541
|
+
let { disabledKeys: disabledKeys , selectionManager: selectionManager } = (0, $56JBj$reactstatelygrid.useGridState)({
|
|
536
542
|
...props,
|
|
537
543
|
collection: collection,
|
|
538
|
-
disabledBehavior:
|
|
544
|
+
disabledBehavior: "selection"
|
|
539
545
|
});
|
|
540
546
|
return {
|
|
541
547
|
collection: collection,
|
|
@@ -549,35 +555,45 @@ function $e3f7784147dde23d$export$907bcc6c48325fd6(props) {
|
|
|
549
555
|
var ref;
|
|
550
556
|
props.onSortChange({
|
|
551
557
|
column: columnKey,
|
|
552
|
-
direction: direction !== null && direction !== void 0 ? direction : ((ref = props.sortDescriptor) === null || ref === void 0 ? void 0 : ref.column) === columnKey ? $e3f7784147dde23d$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] :
|
|
558
|
+
direction: direction !== null && direction !== void 0 ? direction : ((ref = props.sortDescriptor) === null || ref === void 0 ? void 0 : ref.column) === columnKey ? $e3f7784147dde23d$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : "ascending"
|
|
553
559
|
});
|
|
554
560
|
}
|
|
555
561
|
};
|
|
556
562
|
}
|
|
557
563
|
|
|
558
564
|
|
|
559
|
-
|
|
565
|
+
/*
|
|
566
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
567
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
568
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
569
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
570
|
+
*
|
|
571
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
572
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
573
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
574
|
+
* governing permissions and limitations under the License.
|
|
575
|
+
*/
|
|
560
576
|
function $f45775f5d6f744fa$var$TableHeader(props) {
|
|
561
577
|
return null;
|
|
562
578
|
}
|
|
563
579
|
$f45775f5d6f744fa$var$TableHeader.getCollectionNode = function* getCollectionNode(props) {
|
|
564
580
|
let { children: children , columns: columns } = props;
|
|
565
|
-
if (typeof children ===
|
|
566
|
-
if (!columns) throw new Error(
|
|
581
|
+
if (typeof children === "function") {
|
|
582
|
+
if (!columns) throw new Error("props.children was a function but props.columns is missing");
|
|
567
583
|
for (let column of columns)yield {
|
|
568
|
-
type:
|
|
584
|
+
type: "column",
|
|
569
585
|
value: column,
|
|
570
586
|
renderer: children
|
|
571
587
|
};
|
|
572
588
|
} else {
|
|
573
|
-
let
|
|
574
|
-
($parcel$interopDefault($56JBj$react)).Children.forEach(children, (column)=>{
|
|
575
|
-
|
|
576
|
-
type:
|
|
589
|
+
let columns1 = [];
|
|
590
|
+
(0, ($parcel$interopDefault($56JBj$react))).Children.forEach(children, (column)=>{
|
|
591
|
+
columns1.push({
|
|
592
|
+
type: "column",
|
|
577
593
|
element: column
|
|
578
594
|
});
|
|
579
595
|
});
|
|
580
|
-
yield*
|
|
596
|
+
yield* columns1;
|
|
581
597
|
}
|
|
582
598
|
};
|
|
583
599
|
/**
|
|
@@ -587,33 +603,43 @@ $f45775f5d6f744fa$var$TableHeader.getCollectionNode = function* getCollectionNod
|
|
|
587
603
|
let $f45775f5d6f744fa$export$f850895b287ef28e = $f45775f5d6f744fa$var$TableHeader;
|
|
588
604
|
|
|
589
605
|
|
|
590
|
-
|
|
606
|
+
/*
|
|
607
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
608
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
609
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
610
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
611
|
+
*
|
|
612
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
613
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
614
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
615
|
+
* governing permissions and limitations under the License.
|
|
616
|
+
*/
|
|
591
617
|
function $6ec527db6a3a5692$var$TableBody(props) {
|
|
592
618
|
return null;
|
|
593
619
|
}
|
|
594
620
|
$6ec527db6a3a5692$var$TableBody.getCollectionNode = function* getCollectionNode(props) {
|
|
595
|
-
let { children: children , items:
|
|
621
|
+
let { children: children , items: items } = props;
|
|
596
622
|
yield {
|
|
597
|
-
type:
|
|
623
|
+
type: "body",
|
|
598
624
|
hasChildNodes: true,
|
|
599
625
|
props: props,
|
|
600
626
|
*childNodes () {
|
|
601
|
-
if (typeof children ===
|
|
602
|
-
if (!
|
|
603
|
-
for (let item of
|
|
604
|
-
type:
|
|
627
|
+
if (typeof children === "function") {
|
|
628
|
+
if (!items) throw new Error("props.children was a function but props.items is missing");
|
|
629
|
+
for (let item of items)yield {
|
|
630
|
+
type: "item",
|
|
605
631
|
value: item,
|
|
606
632
|
renderer: children
|
|
607
633
|
};
|
|
608
634
|
} else {
|
|
609
|
-
let
|
|
610
|
-
($parcel$interopDefault($56JBj$react)).Children.forEach(children, (item)=>{
|
|
611
|
-
|
|
612
|
-
type:
|
|
635
|
+
let items1 = [];
|
|
636
|
+
(0, ($parcel$interopDefault($56JBj$react))).Children.forEach(children, (item)=>{
|
|
637
|
+
items1.push({
|
|
638
|
+
type: "item",
|
|
613
639
|
element: item
|
|
614
640
|
});
|
|
615
641
|
});
|
|
616
|
-
yield*
|
|
642
|
+
yield* items1;
|
|
617
643
|
}
|
|
618
644
|
}
|
|
619
645
|
};
|
|
@@ -625,34 +651,44 @@ $6ec527db6a3a5692$var$TableBody.getCollectionNode = function* getCollectionNode(
|
|
|
625
651
|
let $6ec527db6a3a5692$export$76ccd210b9029917 = $6ec527db6a3a5692$var$TableBody;
|
|
626
652
|
|
|
627
653
|
|
|
628
|
-
|
|
654
|
+
/*
|
|
655
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
656
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
657
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
658
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
659
|
+
*
|
|
660
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
661
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
662
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
663
|
+
* governing permissions and limitations under the License.
|
|
664
|
+
*/
|
|
629
665
|
function $714483d9f6ca4c55$var$Column(props) {
|
|
630
666
|
return null;
|
|
631
667
|
}
|
|
632
|
-
$714483d9f6ca4c55$var$Column.getCollectionNode = function* getCollectionNode(props,
|
|
633
|
-
let { title: title , children: children , childColumns:
|
|
668
|
+
$714483d9f6ca4c55$var$Column.getCollectionNode = function* getCollectionNode(props, context) {
|
|
669
|
+
let { title: title , children: children , childColumns: childColumns } = props;
|
|
634
670
|
let rendered = title || children;
|
|
635
|
-
let textValue = props.textValue || (typeof rendered ===
|
|
671
|
+
let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"];
|
|
636
672
|
let fullNodes = yield {
|
|
637
|
-
type:
|
|
638
|
-
hasChildNodes: !!
|
|
673
|
+
type: "column",
|
|
674
|
+
hasChildNodes: !!childColumns || title && (0, ($parcel$interopDefault($56JBj$react))).Children.count(children) > 0,
|
|
639
675
|
rendered: rendered,
|
|
640
676
|
textValue: textValue,
|
|
641
677
|
props: props,
|
|
642
678
|
*childNodes () {
|
|
643
|
-
if (
|
|
644
|
-
type:
|
|
645
|
-
value:
|
|
679
|
+
if (childColumns) for (let child of childColumns)yield {
|
|
680
|
+
type: "column",
|
|
681
|
+
value: child
|
|
646
682
|
};
|
|
647
683
|
else if (title) {
|
|
648
|
-
let
|
|
649
|
-
($parcel$interopDefault($56JBj$react)).Children.forEach(children, (child)=>{
|
|
650
|
-
|
|
651
|
-
type:
|
|
684
|
+
let childColumns1 = [];
|
|
685
|
+
(0, ($parcel$interopDefault($56JBj$react))).Children.forEach(children, (child)=>{
|
|
686
|
+
childColumns1.push({
|
|
687
|
+
type: "column",
|
|
652
688
|
element: child
|
|
653
689
|
});
|
|
654
690
|
});
|
|
655
|
-
yield*
|
|
691
|
+
yield* childColumns1;
|
|
656
692
|
}
|
|
657
693
|
},
|
|
658
694
|
shouldInvalidate (newContext) {
|
|
@@ -667,7 +703,7 @@ $714483d9f6ca4c55$var$Column.getCollectionNode = function* getCollectionNode(pro
|
|
|
667
703
|
// register leaf columns on the context so that <Row> can access them
|
|
668
704
|
for (let node of fullNodes)if (!node.hasChildNodes) context.columns.push(node);
|
|
669
705
|
};
|
|
670
|
-
updateContext(
|
|
706
|
+
updateContext(context);
|
|
671
707
|
};
|
|
672
708
|
/**
|
|
673
709
|
* A Column represents a field of each item within a Table. Columns may also contain nested
|
|
@@ -677,37 +713,47 @@ $714483d9f6ca4c55$var$Column.getCollectionNode = function* getCollectionNode(pro
|
|
|
677
713
|
let $714483d9f6ca4c55$export$816b5d811295e6bc = $714483d9f6ca4c55$var$Column;
|
|
678
714
|
|
|
679
715
|
|
|
680
|
-
|
|
716
|
+
/*
|
|
717
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
718
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
719
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
720
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
721
|
+
*
|
|
722
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
723
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
724
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
725
|
+
* governing permissions and limitations under the License.
|
|
726
|
+
*/
|
|
681
727
|
function $9ec6912e32cc0d81$var$Row(props) {
|
|
682
728
|
return null;
|
|
683
729
|
}
|
|
684
730
|
$9ec6912e32cc0d81$var$Row.getCollectionNode = function* getCollectionNode(props, context) {
|
|
685
731
|
let { children: children , textValue: textValue } = props;
|
|
686
732
|
yield {
|
|
687
|
-
type:
|
|
733
|
+
type: "item",
|
|
688
734
|
props: props,
|
|
689
735
|
textValue: textValue,
|
|
690
|
-
|
|
736
|
+
"aria-label": props["aria-label"],
|
|
691
737
|
hasChildNodes: true,
|
|
692
738
|
*childNodes () {
|
|
693
739
|
// Process cells first
|
|
694
|
-
if (context.showSelectionCheckboxes && context.selectionMode !==
|
|
695
|
-
type:
|
|
696
|
-
key:
|
|
740
|
+
if (context.showSelectionCheckboxes && context.selectionMode !== "none") yield {
|
|
741
|
+
type: "cell",
|
|
742
|
+
key: "header",
|
|
697
743
|
props: {
|
|
698
744
|
isSelectionCell: true
|
|
699
745
|
}
|
|
700
746
|
};
|
|
701
|
-
if (typeof children ===
|
|
702
|
-
type:
|
|
747
|
+
if (typeof children === "function") for (let column of context.columns)yield {
|
|
748
|
+
type: "cell",
|
|
703
749
|
element: children(column.key),
|
|
704
750
|
key: column.key // this is combined with the row key by CollectionBuilder
|
|
705
751
|
};
|
|
706
752
|
else {
|
|
707
753
|
let cells = [];
|
|
708
|
-
($parcel$interopDefault($56JBj$react)).Children.forEach(children, (cell)=>{
|
|
754
|
+
(0, ($parcel$interopDefault($56JBj$react))).Children.forEach(children, (cell)=>{
|
|
709
755
|
cells.push({
|
|
710
|
-
type:
|
|
756
|
+
type: "cell",
|
|
711
757
|
element: cell
|
|
712
758
|
});
|
|
713
759
|
});
|
|
@@ -717,8 +763,7 @@ $9ec6912e32cc0d81$var$Row.getCollectionNode = function* getCollectionNode(props,
|
|
|
717
763
|
},
|
|
718
764
|
shouldInvalidate (newContext) {
|
|
719
765
|
// Invalidate all rows if the columns changed.
|
|
720
|
-
return newContext.columns.length !== context.columns.length || newContext.columns.some((c, i)=>c.key !== context.columns[i].key
|
|
721
|
-
) || newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes || newContext.selectionMode !== context.selectionMode;
|
|
766
|
+
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;
|
|
722
767
|
}
|
|
723
768
|
};
|
|
724
769
|
};
|
|
@@ -730,18 +775,28 @@ $9ec6912e32cc0d81$var$Row.getCollectionNode = function* getCollectionNode(props,
|
|
|
730
775
|
let $9ec6912e32cc0d81$export$b59bdbef9ce70de2 = $9ec6912e32cc0d81$var$Row;
|
|
731
776
|
|
|
732
777
|
|
|
733
|
-
|
|
778
|
+
/*
|
|
779
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
780
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
781
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
782
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
783
|
+
*
|
|
784
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
785
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
786
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
787
|
+
* governing permissions and limitations under the License.
|
|
788
|
+
*/ function $ad4ab0a21c733e1f$var$Cell(props) {
|
|
734
789
|
return null;
|
|
735
790
|
}
|
|
736
791
|
$ad4ab0a21c733e1f$var$Cell.getCollectionNode = function* getCollectionNode(props) {
|
|
737
792
|
let { children: children } = props;
|
|
738
|
-
let textValue = props.textValue || (typeof children ===
|
|
793
|
+
let textValue = props.textValue || (typeof children === "string" ? children : "") || props["aria-label"] || "";
|
|
739
794
|
yield {
|
|
740
|
-
type:
|
|
795
|
+
type: "cell",
|
|
741
796
|
props: props,
|
|
742
797
|
rendered: children,
|
|
743
798
|
textValue: textValue,
|
|
744
|
-
|
|
799
|
+
"aria-label": props["aria-label"],
|
|
745
800
|
hasChildNodes: false
|
|
746
801
|
};
|
|
747
802
|
};
|