@react-stately/virtualizer 3.7.2-nightly.4649 → 3.7.2-nightly.4656
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/Layout.main.js +2 -41
- package/dist/Layout.main.js.map +1 -1
- package/dist/Layout.mjs +2 -41
- package/dist/Layout.module.js +2 -41
- package/dist/Layout.module.js.map +1 -1
- package/dist/LayoutInfo.main.js.map +1 -1
- package/dist/LayoutInfo.module.js.map +1 -1
- package/dist/OverscanManager.main.js +8 -43
- package/dist/OverscanManager.main.js.map +1 -1
- package/dist/OverscanManager.mjs +8 -43
- package/dist/OverscanManager.module.js +8 -43
- package/dist/OverscanManager.module.js.map +1 -1
- package/dist/ReusableView.main.js +23 -0
- package/dist/ReusableView.main.js.map +1 -1
- package/dist/ReusableView.mjs +23 -0
- package/dist/ReusableView.module.js +23 -0
- package/dist/ReusableView.module.js.map +1 -1
- package/dist/Virtualizer.main.js +123 -710
- package/dist/Virtualizer.main.js.map +1 -1
- package/dist/Virtualizer.mjs +124 -711
- package/dist/Virtualizer.module.js +124 -711
- package/dist/Virtualizer.module.js.map +1 -1
- package/dist/types.d.ts +64 -225
- package/dist/types.d.ts.map +1 -1
- package/dist/useVirtualizerState.main.js +39 -40
- package/dist/useVirtualizerState.main.js.map +1 -1
- package/dist/useVirtualizerState.mjs +40 -41
- package/dist/useVirtualizerState.module.js +40 -41
- package/dist/useVirtualizerState.module.js.map +1 -1
- package/dist/utils.main.js +1 -27
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +2 -26
- package/dist/utils.module.js +2 -26
- package/dist/utils.module.js.map +1 -1
- package/package.json +4 -4
- package/src/Layout.ts +10 -55
- package/src/LayoutInfo.ts +2 -2
- package/src/OverscanManager.ts +10 -47
- package/src/ReusableView.ts +36 -7
- package/src/Virtualizer.ts +163 -1058
- package/src/types.ts +16 -38
- package/src/useVirtualizerState.ts +40 -39
- package/src/utils.ts +0 -52
- package/dist/Transaction.main.js +0 -32
- package/dist/Transaction.main.js.map +0 -1
- package/dist/Transaction.mjs +0 -27
- package/dist/Transaction.module.js +0 -27
- package/dist/Transaction.module.js.map +0 -1
- package/dist/tween.main.js +0 -67
- package/dist/tween.main.js.map +0 -1
- package/dist/tween.mjs +0 -61
- package/dist/tween.module.js +0 -61
- package/dist/tween.module.js.map +0 -1
- package/src/Transaction.ts +0 -28
- package/src/tween.ts +0 -83
package/dist/ReusableView.mjs
CHANGED
|
@@ -17,9 +17,32 @@ class $ad1d98aa8f0c31b4$export$1a5223887c560441 {
|
|
|
17
17
|
this.rendered = null;
|
|
18
18
|
this.layoutInfo = null;
|
|
19
19
|
}
|
|
20
|
+
getReusableView(reuseType) {
|
|
21
|
+
// Reusable view queue should be FIFO so that DOM order remains consistent during scrolling.
|
|
22
|
+
// For example, cells within a row should remain in the same order even if the row changes contents.
|
|
23
|
+
// The cells within a row are removed from their parent in order. If the row is reused, the cells
|
|
24
|
+
// should be reused in the new row in the same order they were before.
|
|
25
|
+
let reusable = this.reusableViews.get(reuseType);
|
|
26
|
+
let view = (reusable === null || reusable === void 0 ? void 0 : reusable.length) > 0 ? reusable.shift() : new $ad1d98aa8f0c31b4$export$1a5223887c560441(this.virtualizer);
|
|
27
|
+
view.viewType = reuseType;
|
|
28
|
+
view.parent = this;
|
|
29
|
+
return view;
|
|
30
|
+
}
|
|
31
|
+
reuseChild(child) {
|
|
32
|
+
child.prepareForReuse();
|
|
33
|
+
let reusable = this.reusableViews.get(child.viewType);
|
|
34
|
+
if (!reusable) {
|
|
35
|
+
reusable = [];
|
|
36
|
+
this.reusableViews.set(child.viewType, reusable);
|
|
37
|
+
}
|
|
38
|
+
reusable.push(child);
|
|
39
|
+
}
|
|
20
40
|
constructor(virtualizer){
|
|
21
41
|
this.virtualizer = virtualizer;
|
|
22
42
|
this.key = ++$ad1d98aa8f0c31b4$var$KEY;
|
|
43
|
+
this.parent = null;
|
|
44
|
+
this.children = new Set();
|
|
45
|
+
this.reusableViews = new Map();
|
|
23
46
|
}
|
|
24
47
|
}
|
|
25
48
|
|
|
@@ -17,9 +17,32 @@ class $ad1d98aa8f0c31b4$export$1a5223887c560441 {
|
|
|
17
17
|
this.rendered = null;
|
|
18
18
|
this.layoutInfo = null;
|
|
19
19
|
}
|
|
20
|
+
getReusableView(reuseType) {
|
|
21
|
+
// Reusable view queue should be FIFO so that DOM order remains consistent during scrolling.
|
|
22
|
+
// For example, cells within a row should remain in the same order even if the row changes contents.
|
|
23
|
+
// The cells within a row are removed from their parent in order. If the row is reused, the cells
|
|
24
|
+
// should be reused in the new row in the same order they were before.
|
|
25
|
+
let reusable = this.reusableViews.get(reuseType);
|
|
26
|
+
let view = (reusable === null || reusable === void 0 ? void 0 : reusable.length) > 0 ? reusable.shift() : new $ad1d98aa8f0c31b4$export$1a5223887c560441(this.virtualizer);
|
|
27
|
+
view.viewType = reuseType;
|
|
28
|
+
view.parent = this;
|
|
29
|
+
return view;
|
|
30
|
+
}
|
|
31
|
+
reuseChild(child) {
|
|
32
|
+
child.prepareForReuse();
|
|
33
|
+
let reusable = this.reusableViews.get(child.viewType);
|
|
34
|
+
if (!reusable) {
|
|
35
|
+
reusable = [];
|
|
36
|
+
this.reusableViews.set(child.viewType, reusable);
|
|
37
|
+
}
|
|
38
|
+
reusable.push(child);
|
|
39
|
+
}
|
|
20
40
|
constructor(virtualizer){
|
|
21
41
|
this.virtualizer = virtualizer;
|
|
22
42
|
this.key = ++$ad1d98aa8f0c31b4$var$KEY;
|
|
43
|
+
this.parent = null;
|
|
44
|
+
this.children = new Set();
|
|
45
|
+
this.reusableViews = new Map();
|
|
23
46
|
}
|
|
24
47
|
}
|
|
25
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAMD,IAAI,4BAAM;
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAMD,IAAI,4BAAM;AAMH,MAAM;IA2BX;;GAEC,GACD,kBAAkB;QAChB,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,UAAU,GAAG;IACpB;IAEA,gBAAgB,SAAiB,EAAE;QACjC,4FAA4F;QAC5F,oGAAoG;QACpG,iGAAiG;QACjG,sEAAsE;QACtE,IAAI,WAAW,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;QACtC,IAAI,OAAO,CAAA,qBAAA,+BAAA,SAAU,MAAM,IAAG,IAC1B,SAAS,KAAK,KACd,IAAI,0CAAmB,IAAI,CAAC,WAAW;QAE3C,KAAK,QAAQ,GAAG;QAChB,KAAK,MAAM,GAAG,IAAI;QAClB,OAAO;IACT;IAEA,WAAW,KAAyB,EAAE;QACpC,MAAM,eAAe;QACrB,IAAI,WAAW,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,QAAQ;QACpD,IAAI,CAAC,UAAU;YACb,WAAW,EAAE;YACb,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,QAAQ,EAAE;QACzC;QACA,SAAS,IAAI,CAAC;IAChB;IAxCA,YAAY,WAAuC,CAAE;QACnD,IAAI,CAAC,WAAW,GAAG;QACnB,IAAI,CAAC,GAAG,GAAG,EAAE;QACb,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,QAAQ,GAAG,IAAI;QACpB,IAAI,CAAC,aAAa,GAAG,IAAI;IAC3B;AAmCF","sources":["packages/@react-stately/virtualizer/src/ReusableView.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Key} from '@react-types/shared';\nimport {LayoutInfo} from './LayoutInfo';\nimport {Virtualizer} from './Virtualizer';\n\nlet KEY = 0;\n\n/**\n * [Virtualizer]{@link Virtualizer} creates instances of the [ReusableView]{@link ReusableView} class to\n * represent views currently being displayed.\n */\nexport class ReusableView<T extends object, V> {\n /** The Virtualizer this view is a part of. */\n virtualizer: Virtualizer<T, V, unknown>;\n\n /** The LayoutInfo this view is currently representing. */\n layoutInfo: LayoutInfo | null;\n\n /** The content currently being displayed by this view, set by the virtualizer. */\n content: T;\n\n rendered: V;\n\n viewType: string;\n key: Key;\n\n parent: ReusableView<T, V> | null;\n children: Set<ReusableView<T, V>>;\n reusableViews: Map<string, ReusableView<T, V>[]>;\n\n constructor(virtualizer: Virtualizer<T, V, unknown>) {\n this.virtualizer = virtualizer;\n this.key = ++KEY;\n this.parent = null;\n this.children = new Set();\n this.reusableViews = new Map();\n }\n\n /**\n * Prepares the view for reuse. Called just before the view is removed from the DOM.\n */\n prepareForReuse() {\n this.content = null;\n this.rendered = null;\n this.layoutInfo = null;\n }\n\n getReusableView(reuseType: string) {\n // Reusable view queue should be FIFO so that DOM order remains consistent during scrolling.\n // For example, cells within a row should remain in the same order even if the row changes contents.\n // The cells within a row are removed from their parent in order. If the row is reused, the cells\n // should be reused in the new row in the same order they were before.\n let reusable = this.reusableViews.get(reuseType);\n let view = reusable?.length > 0\n ? reusable.shift()\n : new ReusableView<T, V>(this.virtualizer);\n\n view.viewType = reuseType;\n view.parent = this;\n return view;\n }\n\n reuseChild(child: ReusableView<T, V>) {\n child.prepareForReuse();\n let reusable = this.reusableViews.get(child.viewType);\n if (!reusable) {\n reusable = [];\n this.reusableViews.set(child.viewType, reusable);\n }\n reusable.push(child);\n }\n}\n"],"names":[],"version":3,"file":"ReusableView.module.js.map"}
|