@react-stately/layout 3.13.9-nightly.4624 → 3.13.10-nightly.4629
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/ListLayout.main.js +27 -27
- package/dist/ListLayout.mjs +27 -27
- package/dist/ListLayout.module.js +27 -27
- package/dist/TableLayout.main.js +50 -50
- package/dist/TableLayout.mjs +50 -50
- package/dist/TableLayout.module.js +50 -50
- package/package.json +8 -8
|
@@ -69,7 +69,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
69
69
|
// Track whether we were previously loading. This is used to adjust the animations of async loading vs inserts.
|
|
70
70
|
let loadingState = this.collection.body.props.loadingState;
|
|
71
71
|
this.wasLoading = this.isLoading;
|
|
72
|
-
this.isLoading = loadingState ===
|
|
72
|
+
this.isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
73
73
|
this.stickyColumnIndices = [];
|
|
74
74
|
for (let column of this.collection.columns)// The selection cell and any other sticky columns always need to be visible.
|
|
75
75
|
// In addition, row headers need to be in the DOM for accessibility labeling.
|
|
@@ -91,13 +91,13 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
91
91
|
}
|
|
92
92
|
buildHeader() {
|
|
93
93
|
let rect = new (0, $bmsJv$Rect)(0, 0, 0, 0);
|
|
94
|
-
let layoutInfo = new (0, $bmsJv$LayoutInfo)(
|
|
94
|
+
let layoutInfo = new (0, $bmsJv$LayoutInfo)('header', 'header', rect);
|
|
95
95
|
let y = 0;
|
|
96
96
|
let width = 0;
|
|
97
97
|
let children = [];
|
|
98
98
|
for (let headerRow of this.collection.headerRows){
|
|
99
99
|
let layoutNode = this.buildChild(headerRow, 0, y);
|
|
100
|
-
layoutNode.layoutInfo.parentKey =
|
|
100
|
+
layoutNode.layoutInfo.parentKey = 'header';
|
|
101
101
|
y = layoutNode.layoutInfo.rect.maxY;
|
|
102
102
|
width = Math.max(width, layoutNode.layoutInfo.rect.width);
|
|
103
103
|
layoutNode.index = children.length;
|
|
@@ -105,7 +105,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
105
105
|
}
|
|
106
106
|
rect.width = width;
|
|
107
107
|
rect.height = y;
|
|
108
|
-
this.layoutInfos.set(
|
|
108
|
+
this.layoutInfos.set('header', layoutInfo);
|
|
109
109
|
return {
|
|
110
110
|
layoutInfo: layoutInfo,
|
|
111
111
|
children: children,
|
|
@@ -114,7 +114,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
114
114
|
}
|
|
115
115
|
buildHeaderRow(headerRow, x, y) {
|
|
116
116
|
let rect = new (0, $bmsJv$Rect)(0, y, 0, 0);
|
|
117
|
-
let row = new (0, $bmsJv$LayoutInfo)(
|
|
117
|
+
let row = new (0, $bmsJv$LayoutInfo)('headerrow', headerRow.key, rect);
|
|
118
118
|
let height = 0;
|
|
119
119
|
let columns = [];
|
|
120
120
|
for (let cell of (0, $bmsJv$getChildNodes)(headerRow, this.collection)){
|
|
@@ -193,7 +193,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
193
193
|
}
|
|
194
194
|
buildBody(y) {
|
|
195
195
|
let rect = new (0, $bmsJv$Rect)(0, y, 0, 0);
|
|
196
|
-
let layoutInfo = new (0, $bmsJv$LayoutInfo)(
|
|
196
|
+
let layoutInfo = new (0, $bmsJv$LayoutInfo)('rowgroup', 'body', rect);
|
|
197
197
|
let startY = y;
|
|
198
198
|
let skipped = 0;
|
|
199
199
|
let width = 0;
|
|
@@ -210,7 +210,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
210
210
|
continue;
|
|
211
211
|
}
|
|
212
212
|
let layoutNode = this.buildChild(node, 0, y);
|
|
213
|
-
layoutNode.layoutInfo.parentKey =
|
|
213
|
+
layoutNode.layoutInfo.parentKey = 'body';
|
|
214
214
|
layoutNode.index = i;
|
|
215
215
|
y = layoutNode.layoutInfo.rect.maxY;
|
|
216
216
|
width = Math.max(width, layoutNode.layoutInfo.rect.width);
|
|
@@ -224,10 +224,10 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
224
224
|
if (this.isLoading) {
|
|
225
225
|
// Add some margin around the loader to ensure that scrollbars don't flicker in and out.
|
|
226
226
|
let rect = new (0, $bmsJv$Rect)(40, Math.max(y, 40), (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);
|
|
227
|
-
let loader = new (0, $bmsJv$LayoutInfo)(
|
|
228
|
-
loader.parentKey =
|
|
227
|
+
let loader = new (0, $bmsJv$LayoutInfo)('loader', 'loader', rect);
|
|
228
|
+
loader.parentKey = 'body';
|
|
229
229
|
loader.isSticky = !this.disableSticky && children.length === 0;
|
|
230
|
-
this.layoutInfos.set(
|
|
230
|
+
this.layoutInfos.set('loader', loader);
|
|
231
231
|
children.push({
|
|
232
232
|
layoutInfo: loader,
|
|
233
233
|
validRect: loader.rect
|
|
@@ -236,10 +236,10 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
236
236
|
width = Math.max(width, rect.width);
|
|
237
237
|
} else if (children.length === 0) {
|
|
238
238
|
let rect = new (0, $bmsJv$Rect)(40, Math.max(y, 40), this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);
|
|
239
|
-
let empty = new (0, $bmsJv$LayoutInfo)(
|
|
240
|
-
empty.parentKey =
|
|
239
|
+
let empty = new (0, $bmsJv$LayoutInfo)('empty', 'empty', rect);
|
|
240
|
+
empty.parentKey = 'body';
|
|
241
241
|
empty.isSticky = !this.disableSticky;
|
|
242
|
-
this.layoutInfos.set(
|
|
242
|
+
this.layoutInfos.set('empty', empty);
|
|
243
243
|
children.push({
|
|
244
244
|
layoutInfo: empty,
|
|
245
245
|
validRect: empty.rect
|
|
@@ -249,7 +249,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
249
249
|
}
|
|
250
250
|
rect.width = width;
|
|
251
251
|
rect.height = y - startY;
|
|
252
|
-
this.layoutInfos.set(
|
|
252
|
+
this.layoutInfos.set('body', layoutInfo);
|
|
253
253
|
return {
|
|
254
254
|
layoutInfo: layoutInfo,
|
|
255
255
|
children: children,
|
|
@@ -258,27 +258,27 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
258
258
|
}
|
|
259
259
|
buildNode(node, x, y) {
|
|
260
260
|
switch(node.type){
|
|
261
|
-
case
|
|
261
|
+
case 'headerrow':
|
|
262
262
|
return this.buildHeaderRow(node, x, y);
|
|
263
|
-
case
|
|
263
|
+
case 'item':
|
|
264
264
|
return this.buildRow(node, x, y);
|
|
265
|
-
case
|
|
266
|
-
case
|
|
265
|
+
case 'column':
|
|
266
|
+
case 'placeholder':
|
|
267
267
|
return this.buildColumn(node, x, y);
|
|
268
|
-
case
|
|
268
|
+
case 'cell':
|
|
269
269
|
return this.buildCell(node, x, y);
|
|
270
270
|
default:
|
|
271
|
-
throw new Error(
|
|
271
|
+
throw new Error('Unknown node type ' + node.type);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
buildRow(node, x, y) {
|
|
275
275
|
let rect = new (0, $bmsJv$Rect)(x, y, 0, 0);
|
|
276
|
-
let layoutInfo = new (0, $bmsJv$LayoutInfo)(
|
|
276
|
+
let layoutInfo = new (0, $bmsJv$LayoutInfo)('row', node.key, rect);
|
|
277
277
|
let children = [];
|
|
278
278
|
let height = 0;
|
|
279
279
|
for (let [i, child] of [
|
|
280
280
|
...(0, $bmsJv$getChildNodes)(node, this.collection)
|
|
281
|
-
].entries())if (child.type ===
|
|
281
|
+
].entries())if (child.type === 'cell') {
|
|
282
282
|
if (x > this.validRect.maxX) {
|
|
283
283
|
// Adjust existing cached layoutInfo to ensure that it is out of view.
|
|
284
284
|
// This can happen due to column resizing.
|
|
@@ -296,7 +296,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
this.setChildHeights(children, height);
|
|
299
|
-
rect.width = this.layoutInfos.get(
|
|
299
|
+
rect.width = this.layoutInfos.get('header').rect.width;
|
|
300
300
|
rect.height = height + 1; // +1 for bottom border
|
|
301
301
|
return {
|
|
302
302
|
layoutInfo: layoutInfo,
|
|
@@ -337,16 +337,16 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
337
337
|
addVisibleLayoutInfos(res, node, rect) {
|
|
338
338
|
if (!node.children || node.children.length === 0) return;
|
|
339
339
|
switch(node.layoutInfo.type){
|
|
340
|
-
case
|
|
340
|
+
case 'header':
|
|
341
341
|
for (let child of node.children){
|
|
342
342
|
res.push(child.layoutInfo);
|
|
343
343
|
this.addVisibleLayoutInfos(res, child, rect);
|
|
344
344
|
}
|
|
345
345
|
break;
|
|
346
|
-
case
|
|
346
|
+
case 'rowgroup':
|
|
347
347
|
{
|
|
348
|
-
let firstVisibleRow = this.binarySearch(node.children, rect.topLeft,
|
|
349
|
-
let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight,
|
|
348
|
+
let firstVisibleRow = this.binarySearch(node.children, rect.topLeft, 'y');
|
|
349
|
+
let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight, 'y');
|
|
350
350
|
// Add persisted rows before the visible rows.
|
|
351
351
|
let persistedRowIndices = this.persistedIndices.get(node.layoutInfo.key);
|
|
352
352
|
let persistIndex = 0;
|
|
@@ -371,11 +371,11 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
371
371
|
}
|
|
372
372
|
break;
|
|
373
373
|
}
|
|
374
|
-
case
|
|
375
|
-
case
|
|
374
|
+
case 'headerrow':
|
|
375
|
+
case 'row':
|
|
376
376
|
{
|
|
377
|
-
let firstVisibleCell = this.binarySearch(node.children, rect.topLeft,
|
|
378
|
-
let lastVisibleCell = this.binarySearch(node.children, rect.topRight,
|
|
377
|
+
let firstVisibleCell = this.binarySearch(node.children, rect.topLeft, 'x');
|
|
378
|
+
let lastVisibleCell = this.binarySearch(node.children, rect.topRight, 'x');
|
|
379
379
|
let stickyIndex = 0;
|
|
380
380
|
// Add persisted/sticky cells before the visible cells.
|
|
381
381
|
let persistedCellIndices = this.persistedIndices.get(node.layoutInfo.key) || this.stickyColumnIndices;
|
|
@@ -397,7 +397,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
397
397
|
break;
|
|
398
398
|
}
|
|
399
399
|
default:
|
|
400
|
-
throw new Error(
|
|
400
|
+
throw new Error('Unknown node type ' + node.layoutInfo.type);
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
binarySearch(items, point, axis) {
|
|
@@ -406,8 +406,8 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
406
406
|
while(low <= high){
|
|
407
407
|
let mid = low + high >> 1;
|
|
408
408
|
let item = items[mid];
|
|
409
|
-
if (axis ===
|
|
410
|
-
else if (axis ===
|
|
409
|
+
if (axis === 'x' && item.layoutInfo.rect.maxX < point.x || axis === 'y' && item.layoutInfo.rect.maxY < point.y) low = mid + 1;
|
|
410
|
+
else if (axis === 'x' && item.layoutInfo.rect.x > point.x || axis === 'y' && item.layoutInfo.rect.y > point.y) high = mid - 1;
|
|
411
411
|
else return mid;
|
|
412
412
|
}
|
|
413
413
|
return Math.max(0, Math.min(items.length - 1, low));
|
|
@@ -425,7 +425,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
425
425
|
let indices = this.persistedIndices.get(layoutInfo.parentKey);
|
|
426
426
|
if (!indices) {
|
|
427
427
|
// stickyColumnIndices are always persisted along with any cells from persistedKeys.
|
|
428
|
-
indices = collectionNode.type ===
|
|
428
|
+
indices = collectionNode.type === 'cell' || collectionNode.type === 'column' ? [
|
|
429
429
|
...this.stickyColumnIndices
|
|
430
430
|
] : [];
|
|
431
431
|
this.persistedIndices.set(layoutInfo.parentKey, indices);
|
|
@@ -450,9 +450,9 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
450
450
|
// Checks if Chrome version is 105 or greater
|
|
451
451
|
checkChrome105() {
|
|
452
452
|
var _window_navigator_userAgentData;
|
|
453
|
-
if (typeof window ===
|
|
453
|
+
if (typeof window === 'undefined' || window.navigator == null) return false;
|
|
454
454
|
let isChrome105;
|
|
455
|
-
if (window.navigator[
|
|
455
|
+
if (window.navigator['userAgentData']) isChrome105 = (_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((b)=>b.brand === 'Chromium' && Number(b.version) === 105);
|
|
456
456
|
else {
|
|
457
457
|
let regex = /Chrome\/(\d+)/;
|
|
458
458
|
let matches = regex.exec(window.navigator.userAgent);
|
|
@@ -465,24 +465,24 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
465
465
|
x += this.virtualizer.visibleRect.x;
|
|
466
466
|
y += this.virtualizer.visibleRect.y;
|
|
467
467
|
// Offset for height of header row
|
|
468
|
-
y -= (_this_virtualizer_layout_getVisibleLayoutInfos_find = this.virtualizer.layout.getVisibleLayoutInfos(new (0, $bmsJv$Rect)(x, y, 1, 1)).find((info)=>info.type ===
|
|
468
|
+
y -= (_this_virtualizer_layout_getVisibleLayoutInfos_find = this.virtualizer.layout.getVisibleLayoutInfos(new (0, $bmsJv$Rect)(x, y, 1, 1)).find((info)=>info.type === 'headerrow')) === null || _this_virtualizer_layout_getVisibleLayoutInfos_find === void 0 ? void 0 : _this_virtualizer_layout_getVisibleLayoutInfos_find.rect.height;
|
|
469
469
|
// Custom variation of this.virtualizer.keyAtPoint that ignores body
|
|
470
470
|
let key;
|
|
471
471
|
let point = new (0, $bmsJv$Point)(x, y);
|
|
472
472
|
let rectAtPoint = new (0, $bmsJv$Rect)(point.x, point.y, 1, 1);
|
|
473
|
-
let layoutInfos = this.virtualizer.layout.getVisibleLayoutInfos(rectAtPoint).filter((info)=>info.type ===
|
|
473
|
+
let layoutInfos = this.virtualizer.layout.getVisibleLayoutInfos(rectAtPoint).filter((info)=>info.type === 'row');
|
|
474
474
|
// Layout may return multiple layout infos in the case of
|
|
475
475
|
// persisted keys, so find the first one that actually intersects.
|
|
476
476
|
for (let layoutInfo of layoutInfos)if (layoutInfo.rect.intersects(rectAtPoint)) key = layoutInfo.key;
|
|
477
477
|
if (key == null || this.collection.size === 0) return {
|
|
478
|
-
type:
|
|
478
|
+
type: 'root'
|
|
479
479
|
};
|
|
480
480
|
let layoutInfo = this.getLayoutInfo(key);
|
|
481
481
|
let rect = layoutInfo.rect;
|
|
482
482
|
let target = {
|
|
483
|
-
type:
|
|
483
|
+
type: 'item',
|
|
484
484
|
key: layoutInfo.key,
|
|
485
|
-
dropPosition:
|
|
485
|
+
dropPosition: 'on'
|
|
486
486
|
};
|
|
487
487
|
// If dropping on the item isn't accepted, try the target before or after depending on the y position.
|
|
488
488
|
// Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px
|
|
@@ -490,20 +490,20 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
490
490
|
if (!isValidDropTarget(target)) {
|
|
491
491
|
if (y <= rect.y + rect.height / 2 && isValidDropTarget({
|
|
492
492
|
...target,
|
|
493
|
-
dropPosition:
|
|
494
|
-
})) target.dropPosition =
|
|
493
|
+
dropPosition: 'before'
|
|
494
|
+
})) target.dropPosition = 'before';
|
|
495
495
|
else if (isValidDropTarget({
|
|
496
496
|
...target,
|
|
497
|
-
dropPosition:
|
|
498
|
-
})) target.dropPosition =
|
|
497
|
+
dropPosition: 'after'
|
|
498
|
+
})) target.dropPosition = 'after';
|
|
499
499
|
} else if (y <= rect.y + 10 && isValidDropTarget({
|
|
500
500
|
...target,
|
|
501
|
-
dropPosition:
|
|
502
|
-
})) target.dropPosition =
|
|
501
|
+
dropPosition: 'before'
|
|
502
|
+
})) target.dropPosition = 'before';
|
|
503
503
|
else if (y >= rect.maxY - 10 && isValidDropTarget({
|
|
504
504
|
...target,
|
|
505
|
-
dropPosition:
|
|
506
|
-
})) target.dropPosition =
|
|
505
|
+
dropPosition: 'after'
|
|
506
|
+
})) target.dropPosition = 'after';
|
|
507
507
|
return target;
|
|
508
508
|
}
|
|
509
509
|
constructor(options){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/layout",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.10-nightly.4629+c34886769",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-stately/collections": "3.0.0-nightly.
|
|
26
|
-
"@react-stately/table": "3.11.
|
|
27
|
-
"@react-stately/virtualizer": "3.7.
|
|
28
|
-
"@react-types/grid": "3.2.
|
|
29
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
30
|
-
"@react-types/table": "3.9.
|
|
25
|
+
"@react-stately/collections": "3.0.0-nightly.2917+c34886769",
|
|
26
|
+
"@react-stately/table": "3.11.9-nightly.4629+c34886769",
|
|
27
|
+
"@react-stately/virtualizer": "3.7.2-nightly.4629+c34886769",
|
|
28
|
+
"@react-types/grid": "3.2.7-nightly.4629+c34886769",
|
|
29
|
+
"@react-types/shared": "3.0.0-nightly.2917+c34886769",
|
|
30
|
+
"@react-types/table": "3.9.6-nightly.4629+c34886769",
|
|
31
31
|
"@swc/helpers": "^0.5.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "c34886769d3e69bb56553a02eead6a0fd877e754"
|
|
40
40
|
}
|