@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
package/dist/TableLayout.main.js
CHANGED
|
@@ -75,7 +75,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
75
75
|
// Track whether we were previously loading. This is used to adjust the animations of async loading vs inserts.
|
|
76
76
|
let loadingState = this.collection.body.props.loadingState;
|
|
77
77
|
this.wasLoading = this.isLoading;
|
|
78
|
-
this.isLoading = loadingState ===
|
|
78
|
+
this.isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
79
79
|
this.stickyColumnIndices = [];
|
|
80
80
|
for (let column of this.collection.columns)// The selection cell and any other sticky columns always need to be visible.
|
|
81
81
|
// In addition, row headers need to be in the DOM for accessibility labeling.
|
|
@@ -97,13 +97,13 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
97
97
|
}
|
|
98
98
|
buildHeader() {
|
|
99
99
|
let rect = new (0, $9lycG$reactstatelyvirtualizer.Rect)(0, 0, 0, 0);
|
|
100
|
-
let layoutInfo = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)(
|
|
100
|
+
let layoutInfo = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)('header', 'header', rect);
|
|
101
101
|
let y = 0;
|
|
102
102
|
let width = 0;
|
|
103
103
|
let children = [];
|
|
104
104
|
for (let headerRow of this.collection.headerRows){
|
|
105
105
|
let layoutNode = this.buildChild(headerRow, 0, y);
|
|
106
|
-
layoutNode.layoutInfo.parentKey =
|
|
106
|
+
layoutNode.layoutInfo.parentKey = 'header';
|
|
107
107
|
y = layoutNode.layoutInfo.rect.maxY;
|
|
108
108
|
width = Math.max(width, layoutNode.layoutInfo.rect.width);
|
|
109
109
|
layoutNode.index = children.length;
|
|
@@ -111,7 +111,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
111
111
|
}
|
|
112
112
|
rect.width = width;
|
|
113
113
|
rect.height = y;
|
|
114
|
-
this.layoutInfos.set(
|
|
114
|
+
this.layoutInfos.set('header', layoutInfo);
|
|
115
115
|
return {
|
|
116
116
|
layoutInfo: layoutInfo,
|
|
117
117
|
children: children,
|
|
@@ -120,7 +120,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
120
120
|
}
|
|
121
121
|
buildHeaderRow(headerRow, x, y) {
|
|
122
122
|
let rect = new (0, $9lycG$reactstatelyvirtualizer.Rect)(0, y, 0, 0);
|
|
123
|
-
let row = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)(
|
|
123
|
+
let row = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)('headerrow', headerRow.key, rect);
|
|
124
124
|
let height = 0;
|
|
125
125
|
let columns = [];
|
|
126
126
|
for (let cell of (0, $9lycG$reactstatelycollections.getChildNodes)(headerRow, this.collection)){
|
|
@@ -199,7 +199,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
199
199
|
}
|
|
200
200
|
buildBody(y) {
|
|
201
201
|
let rect = new (0, $9lycG$reactstatelyvirtualizer.Rect)(0, y, 0, 0);
|
|
202
|
-
let layoutInfo = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)(
|
|
202
|
+
let layoutInfo = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)('rowgroup', 'body', rect);
|
|
203
203
|
let startY = y;
|
|
204
204
|
let skipped = 0;
|
|
205
205
|
let width = 0;
|
|
@@ -216,7 +216,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
216
216
|
continue;
|
|
217
217
|
}
|
|
218
218
|
let layoutNode = this.buildChild(node, 0, y);
|
|
219
|
-
layoutNode.layoutInfo.parentKey =
|
|
219
|
+
layoutNode.layoutInfo.parentKey = 'body';
|
|
220
220
|
layoutNode.index = i;
|
|
221
221
|
y = layoutNode.layoutInfo.rect.maxY;
|
|
222
222
|
width = Math.max(width, layoutNode.layoutInfo.rect.width);
|
|
@@ -230,10 +230,10 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
230
230
|
if (this.isLoading) {
|
|
231
231
|
// Add some margin around the loader to ensure that scrollbars don't flicker in and out.
|
|
232
232
|
let rect = new (0, $9lycG$reactstatelyvirtualizer.Rect)(40, Math.max(y, 40), (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);
|
|
233
|
-
let loader = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)(
|
|
234
|
-
loader.parentKey =
|
|
233
|
+
let loader = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)('loader', 'loader', rect);
|
|
234
|
+
loader.parentKey = 'body';
|
|
235
235
|
loader.isSticky = !this.disableSticky && children.length === 0;
|
|
236
|
-
this.layoutInfos.set(
|
|
236
|
+
this.layoutInfos.set('loader', loader);
|
|
237
237
|
children.push({
|
|
238
238
|
layoutInfo: loader,
|
|
239
239
|
validRect: loader.rect
|
|
@@ -242,10 +242,10 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
242
242
|
width = Math.max(width, rect.width);
|
|
243
243
|
} else if (children.length === 0) {
|
|
244
244
|
let rect = new (0, $9lycG$reactstatelyvirtualizer.Rect)(40, Math.max(y, 40), this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);
|
|
245
|
-
let empty = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)(
|
|
246
|
-
empty.parentKey =
|
|
245
|
+
let empty = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)('empty', 'empty', rect);
|
|
246
|
+
empty.parentKey = 'body';
|
|
247
247
|
empty.isSticky = !this.disableSticky;
|
|
248
|
-
this.layoutInfos.set(
|
|
248
|
+
this.layoutInfos.set('empty', empty);
|
|
249
249
|
children.push({
|
|
250
250
|
layoutInfo: empty,
|
|
251
251
|
validRect: empty.rect
|
|
@@ -255,7 +255,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
255
255
|
}
|
|
256
256
|
rect.width = width;
|
|
257
257
|
rect.height = y - startY;
|
|
258
|
-
this.layoutInfos.set(
|
|
258
|
+
this.layoutInfos.set('body', layoutInfo);
|
|
259
259
|
return {
|
|
260
260
|
layoutInfo: layoutInfo,
|
|
261
261
|
children: children,
|
|
@@ -264,27 +264,27 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
264
264
|
}
|
|
265
265
|
buildNode(node, x, y) {
|
|
266
266
|
switch(node.type){
|
|
267
|
-
case
|
|
267
|
+
case 'headerrow':
|
|
268
268
|
return this.buildHeaderRow(node, x, y);
|
|
269
|
-
case
|
|
269
|
+
case 'item':
|
|
270
270
|
return this.buildRow(node, x, y);
|
|
271
|
-
case
|
|
272
|
-
case
|
|
271
|
+
case 'column':
|
|
272
|
+
case 'placeholder':
|
|
273
273
|
return this.buildColumn(node, x, y);
|
|
274
|
-
case
|
|
274
|
+
case 'cell':
|
|
275
275
|
return this.buildCell(node, x, y);
|
|
276
276
|
default:
|
|
277
|
-
throw new Error(
|
|
277
|
+
throw new Error('Unknown node type ' + node.type);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
buildRow(node, x, y) {
|
|
281
281
|
let rect = new (0, $9lycG$reactstatelyvirtualizer.Rect)(x, y, 0, 0);
|
|
282
|
-
let layoutInfo = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)(
|
|
282
|
+
let layoutInfo = new (0, $9lycG$reactstatelyvirtualizer.LayoutInfo)('row', node.key, rect);
|
|
283
283
|
let children = [];
|
|
284
284
|
let height = 0;
|
|
285
285
|
for (let [i, child] of [
|
|
286
286
|
...(0, $9lycG$reactstatelycollections.getChildNodes)(node, this.collection)
|
|
287
|
-
].entries())if (child.type ===
|
|
287
|
+
].entries())if (child.type === 'cell') {
|
|
288
288
|
if (x > this.validRect.maxX) {
|
|
289
289
|
// Adjust existing cached layoutInfo to ensure that it is out of view.
|
|
290
290
|
// This can happen due to column resizing.
|
|
@@ -302,7 +302,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
this.setChildHeights(children, height);
|
|
305
|
-
rect.width = this.layoutInfos.get(
|
|
305
|
+
rect.width = this.layoutInfos.get('header').rect.width;
|
|
306
306
|
rect.height = height + 1; // +1 for bottom border
|
|
307
307
|
return {
|
|
308
308
|
layoutInfo: layoutInfo,
|
|
@@ -343,16 +343,16 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
343
343
|
addVisibleLayoutInfos(res, node, rect) {
|
|
344
344
|
if (!node.children || node.children.length === 0) return;
|
|
345
345
|
switch(node.layoutInfo.type){
|
|
346
|
-
case
|
|
346
|
+
case 'header':
|
|
347
347
|
for (let child of node.children){
|
|
348
348
|
res.push(child.layoutInfo);
|
|
349
349
|
this.addVisibleLayoutInfos(res, child, rect);
|
|
350
350
|
}
|
|
351
351
|
break;
|
|
352
|
-
case
|
|
352
|
+
case 'rowgroup':
|
|
353
353
|
{
|
|
354
|
-
let firstVisibleRow = this.binarySearch(node.children, rect.topLeft,
|
|
355
|
-
let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight,
|
|
354
|
+
let firstVisibleRow = this.binarySearch(node.children, rect.topLeft, 'y');
|
|
355
|
+
let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight, 'y');
|
|
356
356
|
// Add persisted rows before the visible rows.
|
|
357
357
|
let persistedRowIndices = this.persistedIndices.get(node.layoutInfo.key);
|
|
358
358
|
let persistIndex = 0;
|
|
@@ -377,11 +377,11 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
377
377
|
}
|
|
378
378
|
break;
|
|
379
379
|
}
|
|
380
|
-
case
|
|
381
|
-
case
|
|
380
|
+
case 'headerrow':
|
|
381
|
+
case 'row':
|
|
382
382
|
{
|
|
383
|
-
let firstVisibleCell = this.binarySearch(node.children, rect.topLeft,
|
|
384
|
-
let lastVisibleCell = this.binarySearch(node.children, rect.topRight,
|
|
383
|
+
let firstVisibleCell = this.binarySearch(node.children, rect.topLeft, 'x');
|
|
384
|
+
let lastVisibleCell = this.binarySearch(node.children, rect.topRight, 'x');
|
|
385
385
|
let stickyIndex = 0;
|
|
386
386
|
// Add persisted/sticky cells before the visible cells.
|
|
387
387
|
let persistedCellIndices = this.persistedIndices.get(node.layoutInfo.key) || this.stickyColumnIndices;
|
|
@@ -403,7 +403,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
403
403
|
break;
|
|
404
404
|
}
|
|
405
405
|
default:
|
|
406
|
-
throw new Error(
|
|
406
|
+
throw new Error('Unknown node type ' + node.layoutInfo.type);
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
binarySearch(items, point, axis) {
|
|
@@ -412,8 +412,8 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
412
412
|
while(low <= high){
|
|
413
413
|
let mid = low + high >> 1;
|
|
414
414
|
let item = items[mid];
|
|
415
|
-
if (axis ===
|
|
416
|
-
else if (axis ===
|
|
415
|
+
if (axis === 'x' && item.layoutInfo.rect.maxX < point.x || axis === 'y' && item.layoutInfo.rect.maxY < point.y) low = mid + 1;
|
|
416
|
+
else if (axis === 'x' && item.layoutInfo.rect.x > point.x || axis === 'y' && item.layoutInfo.rect.y > point.y) high = mid - 1;
|
|
417
417
|
else return mid;
|
|
418
418
|
}
|
|
419
419
|
return Math.max(0, Math.min(items.length - 1, low));
|
|
@@ -431,7 +431,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
431
431
|
let indices = this.persistedIndices.get(layoutInfo.parentKey);
|
|
432
432
|
if (!indices) {
|
|
433
433
|
// stickyColumnIndices are always persisted along with any cells from persistedKeys.
|
|
434
|
-
indices = collectionNode.type ===
|
|
434
|
+
indices = collectionNode.type === 'cell' || collectionNode.type === 'column' ? [
|
|
435
435
|
...this.stickyColumnIndices
|
|
436
436
|
] : [];
|
|
437
437
|
this.persistedIndices.set(layoutInfo.parentKey, indices);
|
|
@@ -456,9 +456,9 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
456
456
|
// Checks if Chrome version is 105 or greater
|
|
457
457
|
checkChrome105() {
|
|
458
458
|
var _window_navigator_userAgentData;
|
|
459
|
-
if (typeof window ===
|
|
459
|
+
if (typeof window === 'undefined' || window.navigator == null) return false;
|
|
460
460
|
let isChrome105;
|
|
461
|
-
if (window.navigator[
|
|
461
|
+
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);
|
|
462
462
|
else {
|
|
463
463
|
let regex = /Chrome\/(\d+)/;
|
|
464
464
|
let matches = regex.exec(window.navigator.userAgent);
|
|
@@ -471,24 +471,24 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
471
471
|
x += this.virtualizer.visibleRect.x;
|
|
472
472
|
y += this.virtualizer.visibleRect.y;
|
|
473
473
|
// Offset for height of header row
|
|
474
|
-
y -= (_this_virtualizer_layout_getVisibleLayoutInfos_find = this.virtualizer.layout.getVisibleLayoutInfos(new (0, $9lycG$reactstatelyvirtualizer.Rect)(x, y, 1, 1)).find((info)=>info.type ===
|
|
474
|
+
y -= (_this_virtualizer_layout_getVisibleLayoutInfos_find = this.virtualizer.layout.getVisibleLayoutInfos(new (0, $9lycG$reactstatelyvirtualizer.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;
|
|
475
475
|
// Custom variation of this.virtualizer.keyAtPoint that ignores body
|
|
476
476
|
let key;
|
|
477
477
|
let point = new (0, $9lycG$reactstatelyvirtualizer.Point)(x, y);
|
|
478
478
|
let rectAtPoint = new (0, $9lycG$reactstatelyvirtualizer.Rect)(point.x, point.y, 1, 1);
|
|
479
|
-
let layoutInfos = this.virtualizer.layout.getVisibleLayoutInfos(rectAtPoint).filter((info)=>info.type ===
|
|
479
|
+
let layoutInfos = this.virtualizer.layout.getVisibleLayoutInfos(rectAtPoint).filter((info)=>info.type === 'row');
|
|
480
480
|
// Layout may return multiple layout infos in the case of
|
|
481
481
|
// persisted keys, so find the first one that actually intersects.
|
|
482
482
|
for (let layoutInfo of layoutInfos)if (layoutInfo.rect.intersects(rectAtPoint)) key = layoutInfo.key;
|
|
483
483
|
if (key == null || this.collection.size === 0) return {
|
|
484
|
-
type:
|
|
484
|
+
type: 'root'
|
|
485
485
|
};
|
|
486
486
|
let layoutInfo = this.getLayoutInfo(key);
|
|
487
487
|
let rect = layoutInfo.rect;
|
|
488
488
|
let target = {
|
|
489
|
-
type:
|
|
489
|
+
type: 'item',
|
|
490
490
|
key: layoutInfo.key,
|
|
491
|
-
dropPosition:
|
|
491
|
+
dropPosition: 'on'
|
|
492
492
|
};
|
|
493
493
|
// If dropping on the item isn't accepted, try the target before or after depending on the y position.
|
|
494
494
|
// Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px
|
|
@@ -496,20 +496,20 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
|
|
|
496
496
|
if (!isValidDropTarget(target)) {
|
|
497
497
|
if (y <= rect.y + rect.height / 2 && isValidDropTarget({
|
|
498
498
|
...target,
|
|
499
|
-
dropPosition:
|
|
500
|
-
})) target.dropPosition =
|
|
499
|
+
dropPosition: 'before'
|
|
500
|
+
})) target.dropPosition = 'before';
|
|
501
501
|
else if (isValidDropTarget({
|
|
502
502
|
...target,
|
|
503
|
-
dropPosition:
|
|
504
|
-
})) target.dropPosition =
|
|
503
|
+
dropPosition: 'after'
|
|
504
|
+
})) target.dropPosition = 'after';
|
|
505
505
|
} else if (y <= rect.y + 10 && isValidDropTarget({
|
|
506
506
|
...target,
|
|
507
|
-
dropPosition:
|
|
508
|
-
})) target.dropPosition =
|
|
507
|
+
dropPosition: 'before'
|
|
508
|
+
})) target.dropPosition = 'before';
|
|
509
509
|
else if (y >= rect.maxY - 10 && isValidDropTarget({
|
|
510
510
|
...target,
|
|
511
|
-
dropPosition:
|
|
512
|
-
})) target.dropPosition =
|
|
511
|
+
dropPosition: 'after'
|
|
512
|
+
})) target.dropPosition = 'after';
|
|
513
513
|
return target;
|
|
514
514
|
}
|
|
515
515
|
constructor(options){
|
package/dist/TableLayout.mjs
CHANGED
|
@@ -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){
|