@react-stately/virtualizer 3.5.3-nightly.3964 → 3.5.3-nightly.3966
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/import.mjs +75 -78
- package/dist/main.js +75 -81
- package/dist/main.js.map +1 -1
- package/dist/module.js +75 -78
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/import.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {useState as $8D3nr$useState, useMemo as $8D3nr$useMemo, useEffect as $8D3nr$useEffect, useCallback as $8D3nr$useCallback} from "react";
|
|
2
2
|
import {useLayoutEffect as $8D3nr$useLayoutEffect} from "@react-aria/utils";
|
|
3
|
-
import $8D3nr$swchelperssrc_define_propertymjs from "@swc/helpers/src/_define_property.mjs";
|
|
4
3
|
|
|
5
4
|
/*
|
|
6
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -473,15 +472,14 @@ function $fc36f9a046a9ce79$export$a8d0d0c8d1c5df64(a, b) {
|
|
|
473
472
|
* governing permissions and limitations under the License.
|
|
474
473
|
*/
|
|
475
474
|
|
|
476
|
-
|
|
477
475
|
class $364191b3decf3697$var$RollingAverage {
|
|
478
476
|
addSample(sample) {
|
|
479
477
|
this.count++;
|
|
480
478
|
this.value += (sample - this.value) / this.count;
|
|
481
479
|
}
|
|
482
480
|
constructor(){
|
|
483
|
-
|
|
484
|
-
|
|
481
|
+
this.count = 0;
|
|
482
|
+
this.value = 0;
|
|
485
483
|
}
|
|
486
484
|
}
|
|
487
485
|
class $364191b3decf3697$export$4455ee6afb38dcbb {
|
|
@@ -503,8 +501,8 @@ class $364191b3decf3697$export$4455ee6afb38dcbb {
|
|
|
503
501
|
this.overscanY.addSample(o);
|
|
504
502
|
}
|
|
505
503
|
if (this.visibleRect.width > 0) {
|
|
506
|
-
let
|
|
507
|
-
this.overscanX.addSample(
|
|
504
|
+
let o = Math.abs(this.velocity.x * (this.averageTime.value + this.averagePerf.value));
|
|
505
|
+
this.overscanX.addSample(o);
|
|
508
506
|
}
|
|
509
507
|
}
|
|
510
508
|
getOverscannedRect() {
|
|
@@ -528,13 +526,13 @@ class $364191b3decf3697$export$4455ee6afb38dcbb {
|
|
|
528
526
|
return overscanned;
|
|
529
527
|
}
|
|
530
528
|
constructor(){
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
529
|
+
this.startTime = 0;
|
|
530
|
+
this.averagePerf = new $364191b3decf3697$var$RollingAverage();
|
|
531
|
+
this.averageTime = new $364191b3decf3697$var$RollingAverage();
|
|
532
|
+
this.velocity = new (0, $3041db3296945e6e$export$baf26146a414f24a)(5, 5);
|
|
533
|
+
this.overscanX = new $364191b3decf3697$var$RollingAverage();
|
|
534
|
+
this.overscanY = new $364191b3decf3697$var$RollingAverage();
|
|
535
|
+
this.visibleRect = new (0, $60423f92c7f9ad87$export$c79fc6492f3af13d)();
|
|
538
536
|
}
|
|
539
537
|
}
|
|
540
538
|
|
|
@@ -553,18 +551,17 @@ class $364191b3decf3697$export$4455ee6afb38dcbb {
|
|
|
553
551
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
554
552
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
555
553
|
* governing permissions and limitations under the License.
|
|
556
|
-
*/
|
|
557
|
-
class $8e135e531d8dcb66$export$febc5573c75cefb0 {
|
|
554
|
+
*/ class $8e135e531d8dcb66$export$febc5573c75cefb0 {
|
|
558
555
|
constructor(){
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
556
|
+
this.level = 0;
|
|
557
|
+
this.actions = [];
|
|
558
|
+
this.animated = true;
|
|
559
|
+
this.initialMap = new Map();
|
|
560
|
+
this.finalMap = new Map();
|
|
561
|
+
this.initialLayoutInfo = new Map();
|
|
562
|
+
this.finalLayoutInfo = new Map();
|
|
563
|
+
this.removed = new Map();
|
|
564
|
+
this.toRemove = new Map();
|
|
568
565
|
}
|
|
569
566
|
}
|
|
570
567
|
|
|
@@ -888,10 +885,10 @@ class $38b9490c1cca8fc4$export$89be5a243e59c4b2 {
|
|
|
888
885
|
let layoutInfo = this.layout.getLayoutInfo(key);
|
|
889
886
|
let corner = layoutInfo.rect.getCornerInRect(visibleRect);
|
|
890
887
|
if (corner) {
|
|
891
|
-
let
|
|
888
|
+
let key = layoutInfo.key;
|
|
892
889
|
let offset = layoutInfo.rect[corner].y - visibleRect.y;
|
|
893
890
|
return {
|
|
894
|
-
key:
|
|
891
|
+
key: key,
|
|
895
892
|
layoutInfo: layoutInfo,
|
|
896
893
|
corner: corner,
|
|
897
894
|
offset: offset
|
|
@@ -903,17 +900,17 @@ class $38b9490c1cca8fc4$export$89be5a243e59c4b2 {
|
|
|
903
900
|
if (visibleRect.y === 0 && !this.anchorScrollPositionAtTop) return null;
|
|
904
901
|
// Find a view with a visible corner that has the smallest distance to the top of the collection view
|
|
905
902
|
let cornerAnchor = null;
|
|
906
|
-
for (let [
|
|
907
|
-
let
|
|
908
|
-
if (
|
|
909
|
-
let
|
|
910
|
-
if (
|
|
911
|
-
let
|
|
912
|
-
if (!cornerAnchor ||
|
|
913
|
-
key:
|
|
914
|
-
layoutInfo:
|
|
915
|
-
corner:
|
|
916
|
-
offset:
|
|
903
|
+
for (let [key, view] of this._visibleViews){
|
|
904
|
+
let layoutInfo = view.layoutInfo;
|
|
905
|
+
if (layoutInfo && layoutInfo.rect.area > 0) {
|
|
906
|
+
let corner = layoutInfo.rect.getCornerInRect(visibleRect);
|
|
907
|
+
if (corner) {
|
|
908
|
+
let offset = layoutInfo.rect[corner].y - visibleRect.y;
|
|
909
|
+
if (!cornerAnchor || offset < cornerAnchor.offset) cornerAnchor = {
|
|
910
|
+
key: key,
|
|
911
|
+
layoutInfo: layoutInfo,
|
|
912
|
+
corner: corner,
|
|
913
|
+
offset: offset
|
|
917
914
|
};
|
|
918
915
|
}
|
|
919
916
|
}
|
|
@@ -990,47 +987,47 @@ class $38b9490c1cca8fc4$export$89be5a243e59c4b2 {
|
|
|
990
987
|
// the DOM immediately, since we may reuse and need to re-insert
|
|
991
988
|
// them back into the DOM anyway.
|
|
992
989
|
let removed = new Set();
|
|
993
|
-
for (let
|
|
994
|
-
let
|
|
995
|
-
if (
|
|
996
|
-
removed.add(
|
|
997
|
-
this._visibleViews.delete(
|
|
990
|
+
for (let key of toRemove.keys()){
|
|
991
|
+
let view = this._visibleViews.get(key);
|
|
992
|
+
if (view) {
|
|
993
|
+
removed.add(view);
|
|
994
|
+
this._visibleViews.delete(key);
|
|
998
995
|
// If we are in the middle of a transaction, wait until the end
|
|
999
996
|
// of the animations to remove the views from the DOM. Also means
|
|
1000
997
|
// we can't reuse those views immediately.
|
|
1001
|
-
if (this._transaction) this._transaction.toRemove.set(
|
|
1002
|
-
else this.reuseView(
|
|
998
|
+
if (this._transaction) this._transaction.toRemove.set(key, view);
|
|
999
|
+
else this.reuseView(view);
|
|
1003
1000
|
}
|
|
1004
1001
|
}
|
|
1005
|
-
for (let
|
|
1006
|
-
let layoutInfo = visibleLayoutInfos.get(
|
|
1007
|
-
let
|
|
1002
|
+
for (let key of toAdd.keys()){
|
|
1003
|
+
let layoutInfo = visibleLayoutInfos.get(key);
|
|
1004
|
+
let view;
|
|
1008
1005
|
// If we're in a transaction, and a layout change happens
|
|
1009
1006
|
// during the animations such that a view that was going
|
|
1010
1007
|
// to be removed is now not, we don't create a new view
|
|
1011
1008
|
// since the old one is still in the DOM, marked as toRemove.
|
|
1012
1009
|
if (this._transaction) {
|
|
1013
1010
|
// if transaction, get initial layout attributes for the animation
|
|
1014
|
-
if (this._transaction.initialLayoutInfo.has(
|
|
1015
|
-
|
|
1016
|
-
if (
|
|
1017
|
-
this._transaction.toRemove.delete(
|
|
1018
|
-
this._applyLayoutInfo(
|
|
1011
|
+
if (this._transaction.initialLayoutInfo.has(key)) layoutInfo = this._transaction.initialLayoutInfo.get(key);
|
|
1012
|
+
view = this._transaction.toRemove.get(key);
|
|
1013
|
+
if (view) {
|
|
1014
|
+
this._transaction.toRemove.delete(key);
|
|
1015
|
+
this._applyLayoutInfo(view, layoutInfo);
|
|
1019
1016
|
}
|
|
1020
1017
|
}
|
|
1021
|
-
if (!
|
|
1018
|
+
if (!view) {
|
|
1022
1019
|
// Create or reuse a view for this row
|
|
1023
|
-
|
|
1020
|
+
view = this.getReusableView(layoutInfo);
|
|
1024
1021
|
// Add the view to the DOM if needed
|
|
1025
|
-
if (!removed.has(
|
|
1022
|
+
if (!removed.has(view)) this._children.add(view);
|
|
1026
1023
|
}
|
|
1027
|
-
this._visibleViews.set(
|
|
1028
|
-
removed.delete(
|
|
1024
|
+
this._visibleViews.set(key, view);
|
|
1025
|
+
removed.delete(view);
|
|
1029
1026
|
}
|
|
1030
|
-
for (let
|
|
1031
|
-
let
|
|
1032
|
-
this._renderedContent.delete(
|
|
1033
|
-
this._renderView(
|
|
1027
|
+
for (let key of toUpdate){
|
|
1028
|
+
let view = currentlyVisible.get(key);
|
|
1029
|
+
this._renderedContent.delete(key);
|
|
1030
|
+
this._renderView(view);
|
|
1034
1031
|
}
|
|
1035
1032
|
// Remove the remaining rows to delete from the DOM
|
|
1036
1033
|
if (!this._transaction) this.removeViews(removed);
|
|
@@ -1090,18 +1087,18 @@ class $38b9490c1cca8fc4$export$89be5a243e59c4b2 {
|
|
|
1090
1087
|
}
|
|
1091
1088
|
// Apply final layout infos for views that will be removed
|
|
1092
1089
|
if (this._transaction) {
|
|
1093
|
-
for (let
|
|
1094
|
-
let
|
|
1095
|
-
if ((
|
|
1096
|
-
let
|
|
1097
|
-
if (this._applyLayoutInfo(
|
|
1090
|
+
for (let view of this._transaction.toRemove.values()){
|
|
1091
|
+
let cur = view.layoutInfo;
|
|
1092
|
+
if ((cur === null || cur === void 0 ? void 0 : cur.key) != null) {
|
|
1093
|
+
let layoutInfo = this.layout.getLayoutInfo(cur.key);
|
|
1094
|
+
if (this._applyLayoutInfo(view, layoutInfo)) updated = true;
|
|
1098
1095
|
}
|
|
1099
1096
|
}
|
|
1100
|
-
for (let
|
|
1101
|
-
let
|
|
1102
|
-
let
|
|
1103
|
-
|
|
1104
|
-
if (this._applyLayoutInfo(
|
|
1097
|
+
for (let view of this._transaction.removed.values()){
|
|
1098
|
+
let cur = view.layoutInfo;
|
|
1099
|
+
let layoutInfo = this._transaction.finalLayoutInfo.get(cur.key) || cur;
|
|
1100
|
+
layoutInfo = this.layout.getFinalLayoutInfo(layoutInfo.copy());
|
|
1101
|
+
if (this._applyLayoutInfo(view, layoutInfo)) updated = true;
|
|
1105
1102
|
}
|
|
1106
1103
|
}
|
|
1107
1104
|
if (updated) this._flushVisibleViews();
|
|
@@ -1291,17 +1288,17 @@ class $38b9490c1cca8fc4$export$89be5a243e59c4b2 {
|
|
|
1291
1288
|
// in Layout#getFinalLayoutInfo during animations.
|
|
1292
1289
|
transaction.finalLayoutInfo.set(layoutInfo.key, layoutInfo);
|
|
1293
1290
|
// Get initial layout infos for views that were added
|
|
1294
|
-
for (let [
|
|
1295
|
-
let initialLayoutInfo = this.layout.getInitialLayoutInfo(
|
|
1296
|
-
transaction.initialLayoutInfo.set(
|
|
1291
|
+
for (let [key, layoutInfo] of finalMap)if (!initialMap.has(key)) {
|
|
1292
|
+
let initialLayoutInfo = this.layout.getInitialLayoutInfo(layoutInfo.copy());
|
|
1293
|
+
transaction.initialLayoutInfo.set(key, initialLayoutInfo);
|
|
1297
1294
|
}
|
|
1298
1295
|
// Figure out which views were removed.
|
|
1299
|
-
for (let [
|
|
1296
|
+
for (let [key, view] of this._visibleViews)// If an item has a width of 0, there is no need to remove it from the _visibleViews.
|
|
1300
1297
|
// Removing an item with width of 0 can cause a loop where the item gets added, removed,
|
|
1301
1298
|
// added, removed... etc in a loop.
|
|
1302
|
-
if (!finalMap.has(
|
|
1303
|
-
transaction.removed.set(
|
|
1304
|
-
this._visibleViews.delete(
|
|
1299
|
+
if (!finalMap.has(key) && view.layoutInfo.rect.width > 0) {
|
|
1300
|
+
transaction.removed.set(key, view);
|
|
1301
|
+
this._visibleViews.delete(key);
|
|
1305
1302
|
// In case something weird happened, where we have a view but no
|
|
1306
1303
|
// initial layout info, use the one attached to the view.
|
|
1307
1304
|
if (view.layoutInfo) {
|
package/dist/main.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
var $aEpNF$react = require("react");
|
|
2
2
|
var $aEpNF$reactariautils = require("@react-aria/utils");
|
|
3
|
-
var $aEpNF$swchelperslib_define_propertyjs = require("@swc/helpers/lib/_define_property.js");
|
|
4
3
|
|
|
5
4
|
function $parcel$export(e, n, v, s) {
|
|
6
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
6
|
}
|
|
8
|
-
function $parcel$interopDefault(a) {
|
|
9
|
-
return a && a.__esModule ? a.default : a;
|
|
10
|
-
}
|
|
11
7
|
|
|
12
8
|
$parcel$export(module.exports, "Layout", () => $ac14d65a0ec196dd$export$c84671f46d6a1ca);
|
|
13
9
|
$parcel$export(module.exports, "LayoutInfo", () => $8a899922c0a55745$export$7e0eeb9da702a085);
|
|
@@ -487,15 +483,14 @@ function $abed55ea619a7a17$export$a8d0d0c8d1c5df64(a, b) {
|
|
|
487
483
|
* governing permissions and limitations under the License.
|
|
488
484
|
*/
|
|
489
485
|
|
|
490
|
-
|
|
491
486
|
class $191a033606d4fda1$var$RollingAverage {
|
|
492
487
|
addSample(sample) {
|
|
493
488
|
this.count++;
|
|
494
489
|
this.value += (sample - this.value) / this.count;
|
|
495
490
|
}
|
|
496
491
|
constructor(){
|
|
497
|
-
|
|
498
|
-
|
|
492
|
+
this.count = 0;
|
|
493
|
+
this.value = 0;
|
|
499
494
|
}
|
|
500
495
|
}
|
|
501
496
|
class $191a033606d4fda1$export$4455ee6afb38dcbb {
|
|
@@ -517,8 +512,8 @@ class $191a033606d4fda1$export$4455ee6afb38dcbb {
|
|
|
517
512
|
this.overscanY.addSample(o);
|
|
518
513
|
}
|
|
519
514
|
if (this.visibleRect.width > 0) {
|
|
520
|
-
let
|
|
521
|
-
this.overscanX.addSample(
|
|
515
|
+
let o = Math.abs(this.velocity.x * (this.averageTime.value + this.averagePerf.value));
|
|
516
|
+
this.overscanX.addSample(o);
|
|
522
517
|
}
|
|
523
518
|
}
|
|
524
519
|
getOverscannedRect() {
|
|
@@ -542,13 +537,13 @@ class $191a033606d4fda1$export$4455ee6afb38dcbb {
|
|
|
542
537
|
return overscanned;
|
|
543
538
|
}
|
|
544
539
|
constructor(){
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
540
|
+
this.startTime = 0;
|
|
541
|
+
this.averagePerf = new $191a033606d4fda1$var$RollingAverage();
|
|
542
|
+
this.averageTime = new $191a033606d4fda1$var$RollingAverage();
|
|
543
|
+
this.velocity = new (0, $f89f15d7f52bce29$export$baf26146a414f24a)(5, 5);
|
|
544
|
+
this.overscanX = new $191a033606d4fda1$var$RollingAverage();
|
|
545
|
+
this.overscanY = new $191a033606d4fda1$var$RollingAverage();
|
|
546
|
+
this.visibleRect = new (0, $41b7691783731623$export$c79fc6492f3af13d)();
|
|
552
547
|
}
|
|
553
548
|
}
|
|
554
549
|
|
|
@@ -567,18 +562,17 @@ class $191a033606d4fda1$export$4455ee6afb38dcbb {
|
|
|
567
562
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
568
563
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
569
564
|
* governing permissions and limitations under the License.
|
|
570
|
-
*/
|
|
571
|
-
class $d288159e8347722a$export$febc5573c75cefb0 {
|
|
565
|
+
*/ class $d288159e8347722a$export$febc5573c75cefb0 {
|
|
572
566
|
constructor(){
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
567
|
+
this.level = 0;
|
|
568
|
+
this.actions = [];
|
|
569
|
+
this.animated = true;
|
|
570
|
+
this.initialMap = new Map();
|
|
571
|
+
this.finalMap = new Map();
|
|
572
|
+
this.initialLayoutInfo = new Map();
|
|
573
|
+
this.finalLayoutInfo = new Map();
|
|
574
|
+
this.removed = new Map();
|
|
575
|
+
this.toRemove = new Map();
|
|
582
576
|
}
|
|
583
577
|
}
|
|
584
578
|
|
|
@@ -902,10 +896,10 @@ class $e1bc15d49d21df0e$export$89be5a243e59c4b2 {
|
|
|
902
896
|
let layoutInfo = this.layout.getLayoutInfo(key);
|
|
903
897
|
let corner = layoutInfo.rect.getCornerInRect(visibleRect);
|
|
904
898
|
if (corner) {
|
|
905
|
-
let
|
|
899
|
+
let key = layoutInfo.key;
|
|
906
900
|
let offset = layoutInfo.rect[corner].y - visibleRect.y;
|
|
907
901
|
return {
|
|
908
|
-
key:
|
|
902
|
+
key: key,
|
|
909
903
|
layoutInfo: layoutInfo,
|
|
910
904
|
corner: corner,
|
|
911
905
|
offset: offset
|
|
@@ -917,17 +911,17 @@ class $e1bc15d49d21df0e$export$89be5a243e59c4b2 {
|
|
|
917
911
|
if (visibleRect.y === 0 && !this.anchorScrollPositionAtTop) return null;
|
|
918
912
|
// Find a view with a visible corner that has the smallest distance to the top of the collection view
|
|
919
913
|
let cornerAnchor = null;
|
|
920
|
-
for (let [
|
|
921
|
-
let
|
|
922
|
-
if (
|
|
923
|
-
let
|
|
924
|
-
if (
|
|
925
|
-
let
|
|
926
|
-
if (!cornerAnchor ||
|
|
927
|
-
key:
|
|
928
|
-
layoutInfo:
|
|
929
|
-
corner:
|
|
930
|
-
offset:
|
|
914
|
+
for (let [key, view] of this._visibleViews){
|
|
915
|
+
let layoutInfo = view.layoutInfo;
|
|
916
|
+
if (layoutInfo && layoutInfo.rect.area > 0) {
|
|
917
|
+
let corner = layoutInfo.rect.getCornerInRect(visibleRect);
|
|
918
|
+
if (corner) {
|
|
919
|
+
let offset = layoutInfo.rect[corner].y - visibleRect.y;
|
|
920
|
+
if (!cornerAnchor || offset < cornerAnchor.offset) cornerAnchor = {
|
|
921
|
+
key: key,
|
|
922
|
+
layoutInfo: layoutInfo,
|
|
923
|
+
corner: corner,
|
|
924
|
+
offset: offset
|
|
931
925
|
};
|
|
932
926
|
}
|
|
933
927
|
}
|
|
@@ -1004,47 +998,47 @@ class $e1bc15d49d21df0e$export$89be5a243e59c4b2 {
|
|
|
1004
998
|
// the DOM immediately, since we may reuse and need to re-insert
|
|
1005
999
|
// them back into the DOM anyway.
|
|
1006
1000
|
let removed = new Set();
|
|
1007
|
-
for (let
|
|
1008
|
-
let
|
|
1009
|
-
if (
|
|
1010
|
-
removed.add(
|
|
1011
|
-
this._visibleViews.delete(
|
|
1001
|
+
for (let key of toRemove.keys()){
|
|
1002
|
+
let view = this._visibleViews.get(key);
|
|
1003
|
+
if (view) {
|
|
1004
|
+
removed.add(view);
|
|
1005
|
+
this._visibleViews.delete(key);
|
|
1012
1006
|
// If we are in the middle of a transaction, wait until the end
|
|
1013
1007
|
// of the animations to remove the views from the DOM. Also means
|
|
1014
1008
|
// we can't reuse those views immediately.
|
|
1015
|
-
if (this._transaction) this._transaction.toRemove.set(
|
|
1016
|
-
else this.reuseView(
|
|
1009
|
+
if (this._transaction) this._transaction.toRemove.set(key, view);
|
|
1010
|
+
else this.reuseView(view);
|
|
1017
1011
|
}
|
|
1018
1012
|
}
|
|
1019
|
-
for (let
|
|
1020
|
-
let layoutInfo = visibleLayoutInfos.get(
|
|
1021
|
-
let
|
|
1013
|
+
for (let key of toAdd.keys()){
|
|
1014
|
+
let layoutInfo = visibleLayoutInfos.get(key);
|
|
1015
|
+
let view;
|
|
1022
1016
|
// If we're in a transaction, and a layout change happens
|
|
1023
1017
|
// during the animations such that a view that was going
|
|
1024
1018
|
// to be removed is now not, we don't create a new view
|
|
1025
1019
|
// since the old one is still in the DOM, marked as toRemove.
|
|
1026
1020
|
if (this._transaction) {
|
|
1027
1021
|
// if transaction, get initial layout attributes for the animation
|
|
1028
|
-
if (this._transaction.initialLayoutInfo.has(
|
|
1029
|
-
|
|
1030
|
-
if (
|
|
1031
|
-
this._transaction.toRemove.delete(
|
|
1032
|
-
this._applyLayoutInfo(
|
|
1022
|
+
if (this._transaction.initialLayoutInfo.has(key)) layoutInfo = this._transaction.initialLayoutInfo.get(key);
|
|
1023
|
+
view = this._transaction.toRemove.get(key);
|
|
1024
|
+
if (view) {
|
|
1025
|
+
this._transaction.toRemove.delete(key);
|
|
1026
|
+
this._applyLayoutInfo(view, layoutInfo);
|
|
1033
1027
|
}
|
|
1034
1028
|
}
|
|
1035
|
-
if (!
|
|
1029
|
+
if (!view) {
|
|
1036
1030
|
// Create or reuse a view for this row
|
|
1037
|
-
|
|
1031
|
+
view = this.getReusableView(layoutInfo);
|
|
1038
1032
|
// Add the view to the DOM if needed
|
|
1039
|
-
if (!removed.has(
|
|
1033
|
+
if (!removed.has(view)) this._children.add(view);
|
|
1040
1034
|
}
|
|
1041
|
-
this._visibleViews.set(
|
|
1042
|
-
removed.delete(
|
|
1035
|
+
this._visibleViews.set(key, view);
|
|
1036
|
+
removed.delete(view);
|
|
1043
1037
|
}
|
|
1044
|
-
for (let
|
|
1045
|
-
let
|
|
1046
|
-
this._renderedContent.delete(
|
|
1047
|
-
this._renderView(
|
|
1038
|
+
for (let key of toUpdate){
|
|
1039
|
+
let view = currentlyVisible.get(key);
|
|
1040
|
+
this._renderedContent.delete(key);
|
|
1041
|
+
this._renderView(view);
|
|
1048
1042
|
}
|
|
1049
1043
|
// Remove the remaining rows to delete from the DOM
|
|
1050
1044
|
if (!this._transaction) this.removeViews(removed);
|
|
@@ -1104,18 +1098,18 @@ class $e1bc15d49d21df0e$export$89be5a243e59c4b2 {
|
|
|
1104
1098
|
}
|
|
1105
1099
|
// Apply final layout infos for views that will be removed
|
|
1106
1100
|
if (this._transaction) {
|
|
1107
|
-
for (let
|
|
1108
|
-
let
|
|
1109
|
-
if ((
|
|
1110
|
-
let
|
|
1111
|
-
if (this._applyLayoutInfo(
|
|
1101
|
+
for (let view of this._transaction.toRemove.values()){
|
|
1102
|
+
let cur = view.layoutInfo;
|
|
1103
|
+
if ((cur === null || cur === void 0 ? void 0 : cur.key) != null) {
|
|
1104
|
+
let layoutInfo = this.layout.getLayoutInfo(cur.key);
|
|
1105
|
+
if (this._applyLayoutInfo(view, layoutInfo)) updated = true;
|
|
1112
1106
|
}
|
|
1113
1107
|
}
|
|
1114
|
-
for (let
|
|
1115
|
-
let
|
|
1116
|
-
let
|
|
1117
|
-
|
|
1118
|
-
if (this._applyLayoutInfo(
|
|
1108
|
+
for (let view of this._transaction.removed.values()){
|
|
1109
|
+
let cur = view.layoutInfo;
|
|
1110
|
+
let layoutInfo = this._transaction.finalLayoutInfo.get(cur.key) || cur;
|
|
1111
|
+
layoutInfo = this.layout.getFinalLayoutInfo(layoutInfo.copy());
|
|
1112
|
+
if (this._applyLayoutInfo(view, layoutInfo)) updated = true;
|
|
1119
1113
|
}
|
|
1120
1114
|
}
|
|
1121
1115
|
if (updated) this._flushVisibleViews();
|
|
@@ -1305,17 +1299,17 @@ class $e1bc15d49d21df0e$export$89be5a243e59c4b2 {
|
|
|
1305
1299
|
// in Layout#getFinalLayoutInfo during animations.
|
|
1306
1300
|
transaction.finalLayoutInfo.set(layoutInfo.key, layoutInfo);
|
|
1307
1301
|
// Get initial layout infos for views that were added
|
|
1308
|
-
for (let [
|
|
1309
|
-
let initialLayoutInfo = this.layout.getInitialLayoutInfo(
|
|
1310
|
-
transaction.initialLayoutInfo.set(
|
|
1302
|
+
for (let [key, layoutInfo] of finalMap)if (!initialMap.has(key)) {
|
|
1303
|
+
let initialLayoutInfo = this.layout.getInitialLayoutInfo(layoutInfo.copy());
|
|
1304
|
+
transaction.initialLayoutInfo.set(key, initialLayoutInfo);
|
|
1311
1305
|
}
|
|
1312
1306
|
// Figure out which views were removed.
|
|
1313
|
-
for (let [
|
|
1307
|
+
for (let [key, view] of this._visibleViews)// If an item has a width of 0, there is no need to remove it from the _visibleViews.
|
|
1314
1308
|
// Removing an item with width of 0 can cause a loop where the item gets added, removed,
|
|
1315
1309
|
// added, removed... etc in a loop.
|
|
1316
|
-
if (!finalMap.has(
|
|
1317
|
-
transaction.removed.set(
|
|
1318
|
-
this._visibleViews.delete(
|
|
1310
|
+
if (!finalMap.has(key) && view.layoutInfo.rect.width > 0) {
|
|
1311
|
+
transaction.removed.set(key, view);
|
|
1312
|
+
this._visibleViews.delete(key);
|
|
1319
1313
|
// In case something weird happened, where we have a view but no
|
|
1320
1314
|
// initial layout info, use the one attached to the view.
|
|
1321
1315
|
if (view.layoutInfo) {
|