@react-stately/layout 3.13.10-nightly.4695 → 3.13.10-nightly.4700
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/GridLayout.main.js +2 -2
- package/dist/GridLayout.main.js.map +1 -1
- package/dist/GridLayout.mjs +2 -2
- package/dist/GridLayout.module.js +2 -2
- package/dist/GridLayout.module.js.map +1 -1
- package/dist/ListLayout.main.js +8 -4
- package/dist/ListLayout.main.js.map +1 -1
- package/dist/ListLayout.mjs +8 -4
- package/dist/ListLayout.module.js +8 -4
- package/dist/ListLayout.module.js.map +1 -1
- package/dist/TableLayout.main.js +6 -10
- package/dist/TableLayout.main.js.map +1 -1
- package/dist/TableLayout.mjs +6 -10
- package/dist/TableLayout.module.js +6 -10
- package/dist/TableLayout.module.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/GridLayout.ts +2 -2
- package/src/ListLayout.ts +8 -7
- package/src/TableLayout.ts +6 -6
package/src/GridLayout.ts
CHANGED
|
@@ -61,7 +61,7 @@ export class GridLayout<T, O = any> extends Layout<Node<T>, O> implements DropTa
|
|
|
61
61
|
this.dropIndicatorThickness = options.dropIndicatorThickness || 2;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
update(): void {
|
|
65
65
|
let visibleWidth = this.virtualizer.visibleRect.width;
|
|
66
66
|
|
|
67
67
|
// The max item width is always the entire viewport.
|
|
@@ -83,7 +83,7 @@ export class GridLayout<T, O = any> extends Layout<Node<T>, O> implements DropTa
|
|
|
83
83
|
itemWidth = Math.max(this.minItemSize.width, Math.min(maxItemWidth, itemWidth));
|
|
84
84
|
|
|
85
85
|
// Compute the item height, which is proportional to the item width
|
|
86
|
-
let t = ((itemWidth - this.minItemSize.width) / (maxItemWidth - this.minItemSize.width));
|
|
86
|
+
let t = ((itemWidth - this.minItemSize.width) / Math.max(1, maxItemWidth - this.minItemSize.width));
|
|
87
87
|
let itemHeight = this.minItemSize.height + Math.floor((maxItemHeight - this.minItemSize.height) * t);
|
|
88
88
|
itemHeight = Math.max(this.minItemSize.height, Math.min(maxItemHeight, itemHeight));
|
|
89
89
|
this.itemSize = new Size(itemWidth, itemHeight);
|
package/src/ListLayout.ts
CHANGED
|
@@ -128,12 +128,12 @@ export class ListLayout<T, O = any> extends Layout<Node<T>, O> implements DropTa
|
|
|
128
128
|
if (!this.requestedRect.containsRect(rect)) {
|
|
129
129
|
this.requestedRect = this.requestedRect.union(rect);
|
|
130
130
|
this.rootNodes = this.buildCollection();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Ensure all of the persisted keys are available.
|
|
134
|
+
for (let key of this.virtualizer.persistedKeys) {
|
|
135
|
+
if (this.ensureLayoutInfo(key)) {
|
|
136
|
+
return;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -162,7 +162,7 @@ export class ListLayout<T, O = any> extends Layout<Node<T>, O> implements DropTa
|
|
|
162
162
|
return invalidationContext.sizeChanged;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
update(invalidationContext: InvalidationContext<O>) {
|
|
166
166
|
this.collection = this.virtualizer.collection;
|
|
167
167
|
|
|
168
168
|
// Reset valid rect if we will have to invalidate everything.
|
|
@@ -170,6 +170,7 @@ export class ListLayout<T, O = any> extends Layout<Node<T>, O> implements DropTa
|
|
|
170
170
|
this.invalidateEverything = this.shouldInvalidateEverything(invalidationContext);
|
|
171
171
|
if (this.invalidateEverything) {
|
|
172
172
|
this.requestedRect = this.virtualizer.visibleRect.copy();
|
|
173
|
+
this.layoutNodes.clear();
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
this.rootNodes = this.buildCollection();
|
package/src/TableLayout.ts
CHANGED
|
@@ -46,7 +46,7 @@ export class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> exten
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
update(invalidationContext: InvalidationContext<O>): void {
|
|
50
50
|
let newCollection = this.virtualizer.collection as TableCollection<T>;
|
|
51
51
|
|
|
52
52
|
// If columnWidths were provided via layoutOptions, update those.
|
|
@@ -62,7 +62,7 @@ export class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> exten
|
|
|
62
62
|
invalidationContext.sizeChanged = true;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
super.
|
|
65
|
+
super.update(invalidationContext);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
protected buildCollection(): LayoutNode[] {
|
|
@@ -227,7 +227,7 @@ export class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> exten
|
|
|
227
227
|
let width = 0;
|
|
228
228
|
let children: LayoutNode[] = [];
|
|
229
229
|
let rowHeight = this.getEstimatedRowHeight();
|
|
230
|
-
for (let
|
|
230
|
+
for (let node of getChildNodes(this.collection.body, this.collection)) {
|
|
231
231
|
// Skip rows before the valid rectangle unless they are already cached.
|
|
232
232
|
if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {
|
|
233
233
|
y += rowHeight;
|
|
@@ -237,7 +237,7 @@ export class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> exten
|
|
|
237
237
|
|
|
238
238
|
let layoutNode = this.buildChild(node, 0, y, layoutInfo.key);
|
|
239
239
|
layoutNode.layoutInfo.parentKey = layoutInfo.key;
|
|
240
|
-
layoutNode.index =
|
|
240
|
+
layoutNode.index = children.length;
|
|
241
241
|
y = layoutNode.layoutInfo.rect.maxY;
|
|
242
242
|
width = Math.max(width, layoutNode.layoutInfo.rect.width);
|
|
243
243
|
children.push(layoutNode);
|
|
@@ -285,7 +285,7 @@ export class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> exten
|
|
|
285
285
|
|
|
286
286
|
let children: LayoutNode[] = [];
|
|
287
287
|
let height = 0;
|
|
288
|
-
for (let
|
|
288
|
+
for (let child of getChildNodes(node, this.collection)) {
|
|
289
289
|
if (child.type === 'cell') {
|
|
290
290
|
if (x > this.requestedRect.maxX) {
|
|
291
291
|
// Adjust existing cached layoutInfo to ensure that it is out of view.
|
|
@@ -299,7 +299,7 @@ export class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> exten
|
|
|
299
299
|
let layoutNode = this.buildChild(child, x, y, layoutInfo.key);
|
|
300
300
|
x = layoutNode.layoutInfo.rect.maxX;
|
|
301
301
|
height = Math.max(height, layoutNode.layoutInfo.rect.height);
|
|
302
|
-
layoutNode.index =
|
|
302
|
+
layoutNode.index = children.length;
|
|
303
303
|
children.push(layoutNode);
|
|
304
304
|
}
|
|
305
305
|
}
|