@react-stately/layout 4.0.3-nightly.5042 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,12 @@ import {TableColumnLayout as $bmsJv$TableColumnLayout} from "@react-stately/tabl
17
17
 
18
18
 
19
19
 
20
+ const $a152112e902709bf$var$DEFAULT_ROW_HEIGHT = 48;
20
21
  class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$export$cacbb3924155d68e) {
22
+ // Backward compatibility for subclassing.
23
+ get collection() {
24
+ return this.virtualizer.collection;
25
+ }
21
26
  columnsChanged(newCollection, oldCollection) {
22
27
  return !oldCollection || newCollection.columns !== oldCollection.columns && newCollection.columns.length !== oldCollection.columns.length || newCollection.columns.some((c, i)=>c.key !== oldCollection.columns[i].key || c.props.width !== oldCollection.columns[i].props.width || c.props.minWidth !== oldCollection.columns[i].props.minWidth || c.props.maxWidth !== oldCollection.columns[i].props.maxWidth);
23
28
  }
@@ -31,7 +36,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
31
36
  this.columnWidths = invalidationContext.layoutOptions.columnWidths;
32
37
  invalidationContext.sizeChanged = true;
33
38
  }
34
- } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.collection)) {
39
+ } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {
35
40
  let columnLayout = new (0, $bmsJv$TableColumnLayout)({});
36
41
  this.columnWidths = columnLayout.buildColumnWidths(this.virtualizer.visibleRect.width, newCollection, new Map());
37
42
  invalidationContext.sizeChanged = true;
@@ -40,9 +45,10 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
40
45
  }
41
46
  buildCollection() {
42
47
  this.stickyColumnIndices = [];
43
- for (let column of this.collection.columns)// The selection cell and any other sticky columns always need to be visible.
48
+ let collection = this.virtualizer.collection;
49
+ for (let column of collection.columns)// The selection cell and any other sticky columns always need to be visible.
44
50
  // In addition, row headers need to be in the DOM for accessibility labeling.
45
- if (this.isStickyColumn(column) || this.collection.rowHeaderColumnKeys.has(column.key)) this.stickyColumnIndices.push(column.index);
51
+ if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) this.stickyColumnIndices.push(column.index);
46
52
  let header = this.buildTableHeader();
47
53
  this.layoutNodes.set(header.layoutInfo.key, header);
48
54
  let body = this.buildBody(header.layoutInfo.rect.height);
@@ -55,16 +61,17 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
55
61
  ];
56
62
  }
57
63
  buildTableHeader() {
58
- var _this_collection_head;
64
+ var _collection_head;
65
+ let collection = this.virtualizer.collection;
59
66
  let rect = new (0, $bmsJv$Rect)(0, 0, 0, 0);
60
- var _this_collection_head_key;
61
- let layoutInfo = new (0, $bmsJv$LayoutInfo)('header', (_this_collection_head_key = (_this_collection_head = this.collection.head) === null || _this_collection_head === void 0 ? void 0 : _this_collection_head.key) !== null && _this_collection_head_key !== void 0 ? _this_collection_head_key : 'header', rect);
67
+ var _collection_head_key;
68
+ let layoutInfo = new (0, $bmsJv$LayoutInfo)('header', (_collection_head_key = (_collection_head = collection.head) === null || _collection_head === void 0 ? void 0 : _collection_head.key) !== null && _collection_head_key !== void 0 ? _collection_head_key : 'header', rect);
62
69
  layoutInfo.isSticky = true;
63
70
  layoutInfo.zIndex = 1;
64
71
  let y = 0;
65
72
  let width = 0;
66
73
  let children = [];
67
- for (let headerRow of this.collection.headerRows){
74
+ for (let headerRow of collection.headerRows){
68
75
  let layoutNode = this.buildChild(headerRow, 0, y, layoutInfo.key);
69
76
  layoutNode.layoutInfo.parentKey = layoutInfo.key;
70
77
  y = layoutNode.layoutInfo.rect.maxY;
@@ -78,7 +85,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
78
85
  layoutInfo: layoutInfo,
79
86
  children: children,
80
87
  validRect: layoutInfo.rect,
81
- node: this.collection.head
88
+ node: collection.head
82
89
  };
83
90
  }
84
91
  buildHeaderRow(headerRow, x, y) {
@@ -86,7 +93,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
86
93
  let row = new (0, $bmsJv$LayoutInfo)('headerrow', headerRow.key, rect);
87
94
  let height = 0;
88
95
  let columns = [];
89
- for (let cell of (0, $bmsJv$getChildNodes)(headerRow, this.collection)){
96
+ for (let cell of (0, $bmsJv$getChildNodes)(headerRow, this.virtualizer.collection)){
90
97
  let layoutNode = this.buildChild(cell, x, y, row.key);
91
98
  layoutNode.layoutInfo.parentKey = row.key;
92
99
  x = layoutNode.layoutInfo.rect.maxX;
@@ -114,14 +121,16 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
114
121
  }
115
122
  // used to get the column widths when rendering to the DOM
116
123
  getRenderedColumnWidth(node) {
124
+ let collection = this.virtualizer.collection;
117
125
  var _node_colspan;
118
126
  let colspan = (_node_colspan = node.colspan) !== null && _node_colspan !== void 0 ? _node_colspan : 1;
119
127
  var _node_colIndex;
120
128
  let colIndex = (_node_colIndex = node.colIndex) !== null && _node_colIndex !== void 0 ? _node_colIndex : node.index;
121
129
  let width = 0;
122
130
  for(let i = colIndex; i < colIndex + colspan; i++){
123
- let column = this.collection.columns[i];
124
- if ((column === null || column === void 0 ? void 0 : column.key) != null) width += this.columnWidths.get(column.key);
131
+ let column = collection.columns[i];
132
+ var _this_columnWidths_get;
133
+ if ((column === null || column === void 0 ? void 0 : column.key) != null) width += (_this_columnWidths_get = this.columnWidths.get(column.key)) !== null && _this_columnWidths_get !== void 0 ? _this_columnWidths_get : 0;
125
134
  }
126
135
  return width;
127
136
  }
@@ -137,7 +146,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
137
146
  height = previousLayoutNode.layoutInfo.rect.height;
138
147
  isEstimated = node !== previousLayoutNode.node || width !== previousLayoutNode.layoutInfo.rect.width || previousLayoutNode.layoutInfo.estimatedSize;
139
148
  } else {
140
- height = estimatedHeight;
149
+ height = estimatedHeight !== null && estimatedHeight !== void 0 ? estimatedHeight : $a152112e902709bf$var$DEFAULT_ROW_HEIGHT;
141
150
  isEstimated = true;
142
151
  }
143
152
  }
@@ -147,12 +156,13 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
147
156
  };
148
157
  }
149
158
  getEstimatedRowHeight() {
150
- var _this_rowHeight;
151
- return (_this_rowHeight = this.rowHeight) !== null && _this_rowHeight !== void 0 ? _this_rowHeight : this.estimatedRowHeight;
159
+ var _this_rowHeight, _ref;
160
+ return (_ref = (_this_rowHeight = this.rowHeight) !== null && _this_rowHeight !== void 0 ? _this_rowHeight : this.estimatedRowHeight) !== null && _ref !== void 0 ? _ref : $a152112e902709bf$var$DEFAULT_ROW_HEIGHT;
152
161
  }
153
162
  buildColumn(node, x, y) {
154
163
  let width = this.getRenderedColumnWidth(node);
155
- let { height: height, isEstimated: isEstimated } = this.getEstimatedHeight(node, width, this.headingHeight, this.estimatedHeadingHeight);
164
+ var _this_headingHeight, _this_estimatedHeadingHeight;
165
+ let { height: height, isEstimated: isEstimated } = this.getEstimatedHeight(node, width, (_this_headingHeight = this.headingHeight) !== null && _this_headingHeight !== void 0 ? _this_headingHeight : this.rowHeight, (_this_estimatedHeadingHeight = this.estimatedHeadingHeight) !== null && _this_estimatedHeadingHeight !== void 0 ? _this_estimatedHeadingHeight : this.estimatedRowHeight);
156
166
  let rect = new (0, $bmsJv$Rect)(x, y, width, height);
157
167
  let layoutInfo = new (0, $bmsJv$LayoutInfo)(node.type, node.key, rect);
158
168
  layoutInfo.isSticky = this.isStickyColumn(node);
@@ -171,14 +181,15 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
171
181
  return false;
172
182
  }
173
183
  buildBody(y) {
184
+ let collection = this.virtualizer.collection;
174
185
  let rect = new (0, $bmsJv$Rect)(0, y, 0, 0);
175
- let layoutInfo = new (0, $bmsJv$LayoutInfo)('rowgroup', this.collection.body.key, rect);
186
+ let layoutInfo = new (0, $bmsJv$LayoutInfo)('rowgroup', collection.body.key, rect);
176
187
  let startY = y;
177
188
  let skipped = 0;
178
189
  let width = 0;
179
190
  let children = [];
180
191
  let rowHeight = this.getEstimatedRowHeight();
181
- for (let node of (0, $bmsJv$getChildNodes)(this.collection.body, this.collection)){
192
+ for (let node of (0, $bmsJv$getChildNodes)(collection.body, collection)){
182
193
  // Skip rows before the valid rectangle unless they are already cached.
183
194
  if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {
184
195
  y += rowHeight;
@@ -193,7 +204,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
193
204
  children.push(layoutNode);
194
205
  if (y > this.requestedRect.maxY) {
195
206
  // Estimate the remaining height for rows that we don't need to layout right now.
196
- y += (this.collection.size - (skipped + children.length)) * rowHeight;
207
+ y += (collection.size - (skipped + children.length)) * rowHeight;
197
208
  break;
198
209
  }
199
210
  }
@@ -204,7 +215,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
204
215
  layoutInfo: layoutInfo,
205
216
  children: children,
206
217
  validRect: layoutInfo.rect.intersection(this.requestedRect),
207
- node: this.collection.body
218
+ node: collection.body
208
219
  };
209
220
  }
210
221
  buildNode(node, x, y) {
@@ -225,12 +236,13 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
225
236
  }
226
237
  }
227
238
  buildRow(node, x, y) {
228
- var _this_collection_head;
239
+ var _collection_head;
240
+ let collection = this.virtualizer.collection;
229
241
  let rect = new (0, $bmsJv$Rect)(x, y, 0, 0);
230
242
  let layoutInfo = new (0, $bmsJv$LayoutInfo)('row', node.key, rect);
231
243
  let children = [];
232
244
  let height = 0;
233
- for (let child of (0, $bmsJv$getChildNodes)(node, this.collection))if (child.type === 'cell') {
245
+ for (let child of (0, $bmsJv$getChildNodes)(node, collection))if (child.type === 'cell') {
234
246
  if (x > this.requestedRect.maxX) {
235
247
  // Adjust existing cached layoutInfo to ensure that it is out of view.
236
248
  // This can happen due to column resizing.
@@ -248,8 +260,8 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
248
260
  }
249
261
  }
250
262
  this.setChildHeights(children, height);
251
- var _this_collection_head_key;
252
- rect.width = this.layoutNodes.get((_this_collection_head_key = (_this_collection_head = this.collection.head) === null || _this_collection_head === void 0 ? void 0 : _this_collection_head.key) !== null && _this_collection_head_key !== void 0 ? _this_collection_head_key : 'header').layoutInfo.rect.width;
263
+ var _collection_head_key;
264
+ rect.width = this.layoutNodes.get((_collection_head_key = (_collection_head = collection.head) === null || _collection_head === void 0 ? void 0 : _collection_head.key) !== null && _collection_head_key !== void 0 ? _collection_head_key : 'header').layoutInfo.rect.width;
253
265
  rect.height = height;
254
266
  return {
255
267
  layoutInfo: layoutInfo,
@@ -383,8 +395,8 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
383
395
  let layoutInfo = (_this_layoutNodes_get = this.layoutNodes.get(key)) === null || _this_layoutNodes_get === void 0 ? void 0 : _this_layoutNodes_get.layoutInfo;
384
396
  // Walk up ancestors so parents are also persisted if children are.
385
397
  while(layoutInfo && layoutInfo.parentKey){
386
- var _this_layoutNodes_get1;
387
- let collectionNode = this.collection.getItem(layoutInfo.key);
398
+ var _this_layoutNodes_get1, _this_layoutNodes_get2;
399
+ let collectionNode = this.virtualizer.collection.getItem(layoutInfo.key);
388
400
  let indices = this.persistedIndices.get(layoutInfo.parentKey);
389
401
  if (!indices) {
390
402
  // stickyColumnIndices are always persisted along with any cells from persistedKeys.
@@ -393,9 +405,9 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
393
405
  ] : [];
394
406
  this.persistedIndices.set(layoutInfo.parentKey, indices);
395
407
  }
396
- let index = this.layoutNodes.get(layoutInfo.key).index;
397
- if (!indices.includes(index)) indices.push(index);
398
- layoutInfo = (_this_layoutNodes_get1 = this.layoutNodes.get(layoutInfo.parentKey)) === null || _this_layoutNodes_get1 === void 0 ? void 0 : _this_layoutNodes_get1.layoutInfo;
408
+ let index = (_this_layoutNodes_get1 = this.layoutNodes.get(layoutInfo.key)) === null || _this_layoutNodes_get1 === void 0 ? void 0 : _this_layoutNodes_get1.index;
409
+ if (index != null && !indices.includes(index)) indices.push(index);
410
+ layoutInfo = (_this_layoutNodes_get2 = this.layoutNodes.get(layoutInfo.parentKey)) === null || _this_layoutNodes_get2 === void 0 ? void 0 : _this_layoutNodes_get2.layoutInfo;
399
411
  }
400
412
  }
401
413
  for (let indices of this.persistedIndices.values())indices.sort((a, b)=>a - b);
@@ -404,17 +416,18 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
404
416
  x += this.virtualizer.visibleRect.x;
405
417
  y += this.virtualizer.visibleRect.y;
406
418
  // Custom variation of this.virtualizer.keyAtPoint that ignores body
407
- let key;
419
+ let key = null;
408
420
  let point = new (0, $bmsJv$Point)(x, y);
409
421
  let rectAtPoint = new (0, $bmsJv$Rect)(point.x, point.y, 1, 1);
410
422
  let layoutInfos = this.virtualizer.layout.getVisibleLayoutInfos(rectAtPoint).filter((info)=>info.type === 'row');
411
423
  // Layout may return multiple layout infos in the case of
412
424
  // persisted keys, so find the first one that actually intersects.
413
425
  for (let layoutInfo of layoutInfos)if (layoutInfo.rect.intersects(rectAtPoint)) key = layoutInfo.key;
414
- if (key == null || this.collection.size === 0) return {
426
+ if (key == null || this.virtualizer.collection.size === 0) return {
415
427
  type: 'root'
416
428
  };
417
429
  let layoutInfo = this.getLayoutInfo(key);
430
+ if (!layoutInfo) return null;
418
431
  let rect = layoutInfo.rect;
419
432
  let target = {
420
433
  type: 'item',
@@ -445,13 +458,11 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
445
458
  }
446
459
  getDropTargetLayoutInfo(target) {
447
460
  let layoutInfo = super.getDropTargetLayoutInfo(target);
448
- layoutInfo.parentKey = this.collection.body.key;
461
+ layoutInfo.parentKey = this.virtualizer.collection.body.key;
449
462
  return layoutInfo;
450
463
  }
451
464
  constructor(options){
452
- super(options);
453
- this.lastPersistedKeys = null;
454
- this.persistedIndices = new Map();
465
+ super(options), this.lastCollection = null, this.columnWidths = new Map(), this.lastPersistedKeys = null, this.persistedIndices = new Map();
455
466
  this.stickyColumnIndices = [];
456
467
  }
457
468
  }
@@ -17,7 +17,12 @@ import {TableColumnLayout as $bmsJv$TableColumnLayout} from "@react-stately/tabl
17
17
 
18
18
 
19
19
 
20
+ const $a152112e902709bf$var$DEFAULT_ROW_HEIGHT = 48;
20
21
  class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$export$cacbb3924155d68e) {
22
+ // Backward compatibility for subclassing.
23
+ get collection() {
24
+ return this.virtualizer.collection;
25
+ }
21
26
  columnsChanged(newCollection, oldCollection) {
22
27
  return !oldCollection || newCollection.columns !== oldCollection.columns && newCollection.columns.length !== oldCollection.columns.length || newCollection.columns.some((c, i)=>c.key !== oldCollection.columns[i].key || c.props.width !== oldCollection.columns[i].props.width || c.props.minWidth !== oldCollection.columns[i].props.minWidth || c.props.maxWidth !== oldCollection.columns[i].props.maxWidth);
23
28
  }
@@ -31,7 +36,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
31
36
  this.columnWidths = invalidationContext.layoutOptions.columnWidths;
32
37
  invalidationContext.sizeChanged = true;
33
38
  }
34
- } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.collection)) {
39
+ } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {
35
40
  let columnLayout = new (0, $bmsJv$TableColumnLayout)({});
36
41
  this.columnWidths = columnLayout.buildColumnWidths(this.virtualizer.visibleRect.width, newCollection, new Map());
37
42
  invalidationContext.sizeChanged = true;
@@ -40,9 +45,10 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
40
45
  }
41
46
  buildCollection() {
42
47
  this.stickyColumnIndices = [];
43
- for (let column of this.collection.columns)// The selection cell and any other sticky columns always need to be visible.
48
+ let collection = this.virtualizer.collection;
49
+ for (let column of collection.columns)// The selection cell and any other sticky columns always need to be visible.
44
50
  // In addition, row headers need to be in the DOM for accessibility labeling.
45
- if (this.isStickyColumn(column) || this.collection.rowHeaderColumnKeys.has(column.key)) this.stickyColumnIndices.push(column.index);
51
+ if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) this.stickyColumnIndices.push(column.index);
46
52
  let header = this.buildTableHeader();
47
53
  this.layoutNodes.set(header.layoutInfo.key, header);
48
54
  let body = this.buildBody(header.layoutInfo.rect.height);
@@ -55,16 +61,17 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
55
61
  ];
56
62
  }
57
63
  buildTableHeader() {
58
- var _this_collection_head;
64
+ var _collection_head;
65
+ let collection = this.virtualizer.collection;
59
66
  let rect = new (0, $bmsJv$Rect)(0, 0, 0, 0);
60
- var _this_collection_head_key;
61
- let layoutInfo = new (0, $bmsJv$LayoutInfo)('header', (_this_collection_head_key = (_this_collection_head = this.collection.head) === null || _this_collection_head === void 0 ? void 0 : _this_collection_head.key) !== null && _this_collection_head_key !== void 0 ? _this_collection_head_key : 'header', rect);
67
+ var _collection_head_key;
68
+ let layoutInfo = new (0, $bmsJv$LayoutInfo)('header', (_collection_head_key = (_collection_head = collection.head) === null || _collection_head === void 0 ? void 0 : _collection_head.key) !== null && _collection_head_key !== void 0 ? _collection_head_key : 'header', rect);
62
69
  layoutInfo.isSticky = true;
63
70
  layoutInfo.zIndex = 1;
64
71
  let y = 0;
65
72
  let width = 0;
66
73
  let children = [];
67
- for (let headerRow of this.collection.headerRows){
74
+ for (let headerRow of collection.headerRows){
68
75
  let layoutNode = this.buildChild(headerRow, 0, y, layoutInfo.key);
69
76
  layoutNode.layoutInfo.parentKey = layoutInfo.key;
70
77
  y = layoutNode.layoutInfo.rect.maxY;
@@ -78,7 +85,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
78
85
  layoutInfo: layoutInfo,
79
86
  children: children,
80
87
  validRect: layoutInfo.rect,
81
- node: this.collection.head
88
+ node: collection.head
82
89
  };
83
90
  }
84
91
  buildHeaderRow(headerRow, x, y) {
@@ -86,7 +93,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
86
93
  let row = new (0, $bmsJv$LayoutInfo)('headerrow', headerRow.key, rect);
87
94
  let height = 0;
88
95
  let columns = [];
89
- for (let cell of (0, $bmsJv$getChildNodes)(headerRow, this.collection)){
96
+ for (let cell of (0, $bmsJv$getChildNodes)(headerRow, this.virtualizer.collection)){
90
97
  let layoutNode = this.buildChild(cell, x, y, row.key);
91
98
  layoutNode.layoutInfo.parentKey = row.key;
92
99
  x = layoutNode.layoutInfo.rect.maxX;
@@ -114,14 +121,16 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
114
121
  }
115
122
  // used to get the column widths when rendering to the DOM
116
123
  getRenderedColumnWidth(node) {
124
+ let collection = this.virtualizer.collection;
117
125
  var _node_colspan;
118
126
  let colspan = (_node_colspan = node.colspan) !== null && _node_colspan !== void 0 ? _node_colspan : 1;
119
127
  var _node_colIndex;
120
128
  let colIndex = (_node_colIndex = node.colIndex) !== null && _node_colIndex !== void 0 ? _node_colIndex : node.index;
121
129
  let width = 0;
122
130
  for(let i = colIndex; i < colIndex + colspan; i++){
123
- let column = this.collection.columns[i];
124
- if ((column === null || column === void 0 ? void 0 : column.key) != null) width += this.columnWidths.get(column.key);
131
+ let column = collection.columns[i];
132
+ var _this_columnWidths_get;
133
+ if ((column === null || column === void 0 ? void 0 : column.key) != null) width += (_this_columnWidths_get = this.columnWidths.get(column.key)) !== null && _this_columnWidths_get !== void 0 ? _this_columnWidths_get : 0;
125
134
  }
126
135
  return width;
127
136
  }
@@ -137,7 +146,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
137
146
  height = previousLayoutNode.layoutInfo.rect.height;
138
147
  isEstimated = node !== previousLayoutNode.node || width !== previousLayoutNode.layoutInfo.rect.width || previousLayoutNode.layoutInfo.estimatedSize;
139
148
  } else {
140
- height = estimatedHeight;
149
+ height = estimatedHeight !== null && estimatedHeight !== void 0 ? estimatedHeight : $a152112e902709bf$var$DEFAULT_ROW_HEIGHT;
141
150
  isEstimated = true;
142
151
  }
143
152
  }
@@ -147,12 +156,13 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
147
156
  };
148
157
  }
149
158
  getEstimatedRowHeight() {
150
- var _this_rowHeight;
151
- return (_this_rowHeight = this.rowHeight) !== null && _this_rowHeight !== void 0 ? _this_rowHeight : this.estimatedRowHeight;
159
+ var _this_rowHeight, _ref;
160
+ return (_ref = (_this_rowHeight = this.rowHeight) !== null && _this_rowHeight !== void 0 ? _this_rowHeight : this.estimatedRowHeight) !== null && _ref !== void 0 ? _ref : $a152112e902709bf$var$DEFAULT_ROW_HEIGHT;
152
161
  }
153
162
  buildColumn(node, x, y) {
154
163
  let width = this.getRenderedColumnWidth(node);
155
- let { height: height, isEstimated: isEstimated } = this.getEstimatedHeight(node, width, this.headingHeight, this.estimatedHeadingHeight);
164
+ var _this_headingHeight, _this_estimatedHeadingHeight;
165
+ let { height: height, isEstimated: isEstimated } = this.getEstimatedHeight(node, width, (_this_headingHeight = this.headingHeight) !== null && _this_headingHeight !== void 0 ? _this_headingHeight : this.rowHeight, (_this_estimatedHeadingHeight = this.estimatedHeadingHeight) !== null && _this_estimatedHeadingHeight !== void 0 ? _this_estimatedHeadingHeight : this.estimatedRowHeight);
156
166
  let rect = new (0, $bmsJv$Rect)(x, y, width, height);
157
167
  let layoutInfo = new (0, $bmsJv$LayoutInfo)(node.type, node.key, rect);
158
168
  layoutInfo.isSticky = this.isStickyColumn(node);
@@ -171,14 +181,15 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
171
181
  return false;
172
182
  }
173
183
  buildBody(y) {
184
+ let collection = this.virtualizer.collection;
174
185
  let rect = new (0, $bmsJv$Rect)(0, y, 0, 0);
175
- let layoutInfo = new (0, $bmsJv$LayoutInfo)('rowgroup', this.collection.body.key, rect);
186
+ let layoutInfo = new (0, $bmsJv$LayoutInfo)('rowgroup', collection.body.key, rect);
176
187
  let startY = y;
177
188
  let skipped = 0;
178
189
  let width = 0;
179
190
  let children = [];
180
191
  let rowHeight = this.getEstimatedRowHeight();
181
- for (let node of (0, $bmsJv$getChildNodes)(this.collection.body, this.collection)){
192
+ for (let node of (0, $bmsJv$getChildNodes)(collection.body, collection)){
182
193
  // Skip rows before the valid rectangle unless they are already cached.
183
194
  if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {
184
195
  y += rowHeight;
@@ -193,7 +204,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
193
204
  children.push(layoutNode);
194
205
  if (y > this.requestedRect.maxY) {
195
206
  // Estimate the remaining height for rows that we don't need to layout right now.
196
- y += (this.collection.size - (skipped + children.length)) * rowHeight;
207
+ y += (collection.size - (skipped + children.length)) * rowHeight;
197
208
  break;
198
209
  }
199
210
  }
@@ -204,7 +215,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
204
215
  layoutInfo: layoutInfo,
205
216
  children: children,
206
217
  validRect: layoutInfo.rect.intersection(this.requestedRect),
207
- node: this.collection.body
218
+ node: collection.body
208
219
  };
209
220
  }
210
221
  buildNode(node, x, y) {
@@ -225,12 +236,13 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
225
236
  }
226
237
  }
227
238
  buildRow(node, x, y) {
228
- var _this_collection_head;
239
+ var _collection_head;
240
+ let collection = this.virtualizer.collection;
229
241
  let rect = new (0, $bmsJv$Rect)(x, y, 0, 0);
230
242
  let layoutInfo = new (0, $bmsJv$LayoutInfo)('row', node.key, rect);
231
243
  let children = [];
232
244
  let height = 0;
233
- for (let child of (0, $bmsJv$getChildNodes)(node, this.collection))if (child.type === 'cell') {
245
+ for (let child of (0, $bmsJv$getChildNodes)(node, collection))if (child.type === 'cell') {
234
246
  if (x > this.requestedRect.maxX) {
235
247
  // Adjust existing cached layoutInfo to ensure that it is out of view.
236
248
  // This can happen due to column resizing.
@@ -248,8 +260,8 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
248
260
  }
249
261
  }
250
262
  this.setChildHeights(children, height);
251
- var _this_collection_head_key;
252
- rect.width = this.layoutNodes.get((_this_collection_head_key = (_this_collection_head = this.collection.head) === null || _this_collection_head === void 0 ? void 0 : _this_collection_head.key) !== null && _this_collection_head_key !== void 0 ? _this_collection_head_key : 'header').layoutInfo.rect.width;
263
+ var _collection_head_key;
264
+ rect.width = this.layoutNodes.get((_collection_head_key = (_collection_head = collection.head) === null || _collection_head === void 0 ? void 0 : _collection_head.key) !== null && _collection_head_key !== void 0 ? _collection_head_key : 'header').layoutInfo.rect.width;
253
265
  rect.height = height;
254
266
  return {
255
267
  layoutInfo: layoutInfo,
@@ -383,8 +395,8 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
383
395
  let layoutInfo = (_this_layoutNodes_get = this.layoutNodes.get(key)) === null || _this_layoutNodes_get === void 0 ? void 0 : _this_layoutNodes_get.layoutInfo;
384
396
  // Walk up ancestors so parents are also persisted if children are.
385
397
  while(layoutInfo && layoutInfo.parentKey){
386
- var _this_layoutNodes_get1;
387
- let collectionNode = this.collection.getItem(layoutInfo.key);
398
+ var _this_layoutNodes_get1, _this_layoutNodes_get2;
399
+ let collectionNode = this.virtualizer.collection.getItem(layoutInfo.key);
388
400
  let indices = this.persistedIndices.get(layoutInfo.parentKey);
389
401
  if (!indices) {
390
402
  // stickyColumnIndices are always persisted along with any cells from persistedKeys.
@@ -393,9 +405,9 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
393
405
  ] : [];
394
406
  this.persistedIndices.set(layoutInfo.parentKey, indices);
395
407
  }
396
- let index = this.layoutNodes.get(layoutInfo.key).index;
397
- if (!indices.includes(index)) indices.push(index);
398
- layoutInfo = (_this_layoutNodes_get1 = this.layoutNodes.get(layoutInfo.parentKey)) === null || _this_layoutNodes_get1 === void 0 ? void 0 : _this_layoutNodes_get1.layoutInfo;
408
+ let index = (_this_layoutNodes_get1 = this.layoutNodes.get(layoutInfo.key)) === null || _this_layoutNodes_get1 === void 0 ? void 0 : _this_layoutNodes_get1.index;
409
+ if (index != null && !indices.includes(index)) indices.push(index);
410
+ layoutInfo = (_this_layoutNodes_get2 = this.layoutNodes.get(layoutInfo.parentKey)) === null || _this_layoutNodes_get2 === void 0 ? void 0 : _this_layoutNodes_get2.layoutInfo;
399
411
  }
400
412
  }
401
413
  for (let indices of this.persistedIndices.values())indices.sort((a, b)=>a - b);
@@ -404,17 +416,18 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
404
416
  x += this.virtualizer.visibleRect.x;
405
417
  y += this.virtualizer.visibleRect.y;
406
418
  // Custom variation of this.virtualizer.keyAtPoint that ignores body
407
- let key;
419
+ let key = null;
408
420
  let point = new (0, $bmsJv$Point)(x, y);
409
421
  let rectAtPoint = new (0, $bmsJv$Rect)(point.x, point.y, 1, 1);
410
422
  let layoutInfos = this.virtualizer.layout.getVisibleLayoutInfos(rectAtPoint).filter((info)=>info.type === 'row');
411
423
  // Layout may return multiple layout infos in the case of
412
424
  // persisted keys, so find the first one that actually intersects.
413
425
  for (let layoutInfo of layoutInfos)if (layoutInfo.rect.intersects(rectAtPoint)) key = layoutInfo.key;
414
- if (key == null || this.collection.size === 0) return {
426
+ if (key == null || this.virtualizer.collection.size === 0) return {
415
427
  type: 'root'
416
428
  };
417
429
  let layoutInfo = this.getLayoutInfo(key);
430
+ if (!layoutInfo) return null;
418
431
  let rect = layoutInfo.rect;
419
432
  let target = {
420
433
  type: 'item',
@@ -445,13 +458,11 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
445
458
  }
446
459
  getDropTargetLayoutInfo(target) {
447
460
  let layoutInfo = super.getDropTargetLayoutInfo(target);
448
- layoutInfo.parentKey = this.collection.body.key;
461
+ layoutInfo.parentKey = this.virtualizer.collection.body.key;
449
462
  return layoutInfo;
450
463
  }
451
464
  constructor(options){
452
- super(options);
453
- this.lastPersistedKeys = null;
454
- this.persistedIndices = new Map();
465
+ super(options), this.lastCollection = null, this.columnWidths = new Map(), this.lastPersistedKeys = null, this.persistedIndices = new Map();
455
466
  this.stickyColumnIndices = [];
456
467
  }
457
468
  }