virtual-scroller 1.7.9 → 1.9.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.
- package/.gitlab-ci.yml +1 -1
- package/CHANGELOG.md +71 -1
- package/README.md +434 -151
- package/bundle/index-bypass.html +1 -1
- package/bundle/index-dom.html +1 -1
- package/bundle/index-grid.html +1 -2
- package/bundle/index-scrollableContainer.html +1 -1
- package/bundle/index-tbody-scrollableContainer.html +2 -0
- package/bundle/index-tbody.html +2 -0
- package/bundle/virtual-scroller-dom.js +1 -1
- package/bundle/virtual-scroller-dom.js.map +1 -1
- package/bundle/virtual-scroller-react.js +1 -1
- package/bundle/virtual-scroller-react.js.map +1 -1
- package/bundle/virtual-scroller.js +1 -1
- package/bundle/virtual-scroller.js.map +1 -1
- package/commonjs/BeforeResize.js +315 -0
- package/commonjs/BeforeResize.js.map +1 -0
- package/commonjs/DOM/Engine.js +46 -0
- package/commonjs/DOM/Engine.js.map +1 -0
- package/commonjs/DOM/ItemsContainer.js +78 -0
- package/commonjs/DOM/ItemsContainer.js.map +1 -0
- package/commonjs/DOM/{WaitForStylesToLoad.js → ListTopOffsetWatcher.js} +71 -44
- package/commonjs/DOM/ListTopOffsetWatcher.js.map +1 -0
- package/commonjs/DOM/ScrollableContainer.js +69 -101
- package/commonjs/DOM/ScrollableContainer.js.map +1 -1
- package/commonjs/DOM/VirtualScroller.js +37 -29
- package/commonjs/DOM/VirtualScroller.js.map +1 -1
- package/commonjs/DOM/tbody.js +17 -11
- package/commonjs/DOM/tbody.js.map +1 -1
- package/commonjs/ItemHeights.js +33 -34
- package/commonjs/ItemHeights.js.map +1 -1
- package/commonjs/Layout.js +591 -216
- package/commonjs/Layout.js.map +1 -1
- package/commonjs/Layout.test.js +196 -0
- package/commonjs/Layout.test.js.map +1 -0
- package/commonjs/ListHeightMeasurement.js +124 -0
- package/commonjs/ListHeightMeasurement.js.map +1 -0
- package/commonjs/Resize.js +50 -39
- package/commonjs/Resize.js.map +1 -1
- package/commonjs/Scroll.js +139 -95
- package/commonjs/Scroll.js.map +1 -1
- package/commonjs/VirtualScroller.columns.js +43 -0
- package/commonjs/VirtualScroller.columns.js.map +1 -0
- package/commonjs/VirtualScroller.constructor.js +408 -0
- package/commonjs/VirtualScroller.constructor.js.map +1 -0
- package/commonjs/VirtualScroller.items.js +305 -0
- package/commonjs/VirtualScroller.items.js.map +1 -0
- package/commonjs/VirtualScroller.js +160 -1021
- package/commonjs/VirtualScroller.js.map +1 -1
- package/commonjs/VirtualScroller.layout.js +562 -0
- package/commonjs/VirtualScroller.layout.js.map +1 -0
- package/commonjs/VirtualScroller.onRender.js +357 -0
- package/commonjs/VirtualScroller.onRender.js.map +1 -0
- package/commonjs/VirtualScroller.resize.js +186 -0
- package/commonjs/VirtualScroller.resize.js.map +1 -0
- package/commonjs/VirtualScroller.state.js +301 -0
- package/commonjs/VirtualScroller.state.js.map +1 -0
- package/commonjs/VirtualScroller.verticalSpacing.js +65 -0
- package/commonjs/VirtualScroller.verticalSpacing.js.map +1 -0
- package/commonjs/getItemCoordinates.js.map +1 -1
- package/commonjs/getItemsDiff.js.map +1 -1
- package/commonjs/getVerticalSpacing.js +8 -8
- package/commonjs/getVerticalSpacing.js.map +1 -1
- package/commonjs/package.json +5 -0
- package/commonjs/react/VirtualScroller.js +182 -628
- package/commonjs/react/VirtualScroller.js.map +1 -1
- package/commonjs/react/useClassName.js +26 -0
- package/commonjs/react/useClassName.js.map +1 -0
- package/commonjs/react/useHandleItemsChange.js +116 -0
- package/commonjs/react/useHandleItemsChange.js.map +1 -0
- package/commonjs/react/useInstanceMethods.js +37 -0
- package/commonjs/react/useInstanceMethods.js.map +1 -0
- package/commonjs/react/useItemKeys.js +60 -0
- package/commonjs/react/useItemKeys.js.map +1 -0
- package/commonjs/react/useOnItemHeightChange.js +32 -0
- package/commonjs/react/useOnItemHeightChange.js.map +1 -0
- package/commonjs/react/useOnItemStateChange.js +32 -0
- package/commonjs/react/useOnItemStateChange.js.map +1 -0
- package/commonjs/react/useState.js +140 -0
- package/commonjs/react/useState.js.map +1 -0
- package/commonjs/react/useStyle.js +29 -0
- package/commonjs/react/useStyle.js.map +1 -0
- package/commonjs/react/useVirtualScroller.js +62 -0
- package/commonjs/react/useVirtualScroller.js.map +1 -0
- package/commonjs/react/useVirtualScrollerStartStop.js +20 -0
- package/commonjs/react/useVirtualScrollerStartStop.js.map +1 -0
- package/commonjs/test/Engine.js +23 -0
- package/commonjs/test/Engine.js.map +1 -0
- package/commonjs/test/ItemsContainer.js +127 -0
- package/commonjs/test/ItemsContainer.js.map +1 -0
- package/commonjs/test/ScrollableContainer.js +130 -0
- package/commonjs/test/ScrollableContainer.js.map +1 -0
- package/commonjs/test/VirtualScroller.js +281 -0
- package/commonjs/test/VirtualScroller.js.map +1 -0
- package/commonjs/utility/debounce.js +28 -6
- package/commonjs/utility/debounce.js.map +1 -1
- package/commonjs/utility/debug.js +51 -12
- package/commonjs/utility/debug.js.map +1 -1
- package/commonjs/utility/getStateSnapshot.js +50 -0
- package/commonjs/utility/getStateSnapshot.js.map +1 -0
- package/commonjs/utility/px.js +1 -1
- package/commonjs/utility/px.js.map +1 -1
- package/commonjs/utility/px.test.js +14 -0
- package/commonjs/utility/px.test.js.map +1 -0
- package/commonjs/utility/shallowEqual.js +1 -1
- package/commonjs/utility/shallowEqual.js.map +1 -1
- package/commonjs/utility/throttle.js.map +1 -1
- package/dom/index.cjs +4 -0
- package/dom/index.cjs.js +9 -0
- package/dom/index.d.ts +25 -0
- package/dom/index.js +1 -1
- package/dom/package.json +10 -4
- package/index.cjs +4 -0
- package/index.cjs.js +9 -0
- package/index.d.ts +99 -0
- package/index.js +1 -1
- package/modules/BeforeResize.js +305 -0
- package/modules/BeforeResize.js.map +1 -0
- package/modules/DOM/Engine.js +27 -0
- package/modules/DOM/Engine.js.map +1 -0
- package/modules/DOM/ItemsContainer.js +71 -0
- package/modules/DOM/ItemsContainer.js.map +1 -0
- package/modules/DOM/{WaitForStylesToLoad.js → ListTopOffsetWatcher.js} +72 -44
- package/modules/DOM/ListTopOffsetWatcher.js.map +1 -0
- package/modules/DOM/ScrollableContainer.js +68 -100
- package/modules/DOM/ScrollableContainer.js.map +1 -1
- package/modules/DOM/VirtualScroller.js +32 -28
- package/modules/DOM/VirtualScroller.js.map +1 -1
- package/modules/DOM/tbody.js +11 -9
- package/modules/DOM/tbody.js.map +1 -1
- package/modules/ItemHeights.js +28 -33
- package/modules/ItemHeights.js.map +1 -1
- package/modules/Layout.js +585 -214
- package/modules/Layout.js.map +1 -1
- package/modules/Layout.test.js +190 -0
- package/modules/Layout.test.js.map +1 -0
- package/modules/ListHeightMeasurement.js +117 -0
- package/modules/ListHeightMeasurement.js.map +1 -0
- package/modules/Resize.js +50 -39
- package/modules/Resize.js.map +1 -1
- package/modules/Scroll.js +139 -94
- package/modules/Scroll.js.map +1 -1
- package/modules/VirtualScroller.columns.js +36 -0
- package/modules/VirtualScroller.columns.js.map +1 -0
- package/modules/VirtualScroller.constructor.js +371 -0
- package/modules/VirtualScroller.constructor.js.map +1 -0
- package/modules/VirtualScroller.items.js +288 -0
- package/modules/VirtualScroller.items.js.map +1 -0
- package/modules/VirtualScroller.js +159 -1014
- package/modules/VirtualScroller.js.map +1 -1
- package/modules/VirtualScroller.layout.js +549 -0
- package/modules/VirtualScroller.layout.js.map +1 -0
- package/modules/VirtualScroller.onRender.js +337 -0
- package/modules/VirtualScroller.onRender.js.map +1 -0
- package/modules/VirtualScroller.resize.js +176 -0
- package/modules/VirtualScroller.resize.js.map +1 -0
- package/modules/VirtualScroller.state.js +283 -0
- package/modules/VirtualScroller.state.js.map +1 -0
- package/modules/VirtualScroller.verticalSpacing.js +54 -0
- package/modules/VirtualScroller.verticalSpacing.js.map +1 -0
- package/modules/getItemCoordinates.js.map +1 -1
- package/modules/getItemsDiff.js.map +1 -1
- package/modules/getVerticalSpacing.js +8 -8
- package/modules/getVerticalSpacing.js.map +1 -1
- package/modules/react/VirtualScroller.js +179 -634
- package/modules/react/VirtualScroller.js.map +1 -1
- package/modules/react/useClassName.js +18 -0
- package/modules/react/useClassName.js.map +1 -0
- package/modules/react/useHandleItemsChange.js +108 -0
- package/modules/react/useHandleItemsChange.js.map +1 -0
- package/modules/react/useInstanceMethods.js +28 -0
- package/modules/react/useInstanceMethods.js.map +1 -0
- package/modules/react/useItemKeys.js +52 -0
- package/modules/react/useItemKeys.js.map +1 -0
- package/modules/react/useOnItemHeightChange.js +24 -0
- package/modules/react/useOnItemHeightChange.js.map +1 -0
- package/modules/react/useOnItemStateChange.js +24 -0
- package/modules/react/useOnItemStateChange.js.map +1 -0
- package/modules/react/useState.js +132 -0
- package/modules/react/useState.js.map +1 -0
- package/modules/react/useStyle.js +19 -0
- package/modules/react/useStyle.js.map +1 -0
- package/modules/react/useVirtualScroller.js +51 -0
- package/modules/react/useVirtualScroller.js.map +1 -0
- package/modules/react/useVirtualScrollerStartStop.js +12 -0
- package/modules/react/useVirtualScrollerStartStop.js.map +1 -0
- package/modules/test/Engine.js +11 -0
- package/modules/test/Engine.js.map +1 -0
- package/modules/test/ItemsContainer.js +120 -0
- package/modules/test/ItemsContainer.js.map +1 -0
- package/modules/test/ScrollableContainer.js +123 -0
- package/modules/test/ScrollableContainer.js.map +1 -0
- package/modules/test/VirtualScroller.js +270 -0
- package/modules/test/VirtualScroller.js.map +1 -0
- package/modules/utility/debounce.js +28 -6
- package/modules/utility/debounce.js.map +1 -1
- package/modules/utility/debug.js +47 -10
- package/modules/utility/debug.js.map +1 -1
- package/modules/utility/getStateSnapshot.js +43 -0
- package/modules/utility/getStateSnapshot.js.map +1 -0
- package/modules/utility/px.js +1 -1
- package/modules/utility/px.js.map +1 -1
- package/modules/utility/px.test.js +9 -0
- package/modules/utility/px.test.js.map +1 -0
- package/modules/utility/shallowEqual.js +1 -1
- package/modules/utility/shallowEqual.js.map +1 -1
- package/modules/utility/throttle.js.map +1 -1
- package/package.json +54 -29
- package/react/index.cjs +4 -0
- package/react/index.cjs.js +9 -0
- package/react/index.d.ts +28 -0
- package/react/index.js +1 -1
- package/react/package.json +10 -4
- package/rollup.config.mjs +62 -0
- package/runnable/create-commonjs-package-json.js +11 -0
- package/source/BeforeResize.js +312 -0
- package/source/DOM/Engine.js +30 -0
- package/source/DOM/ItemsContainer.js +48 -0
- package/source/DOM/{WaitForStylesToLoad.js → ListTopOffsetWatcher.js} +61 -30
- package/source/DOM/ScrollableContainer.js +51 -73
- package/source/DOM/VirtualScroller.js +33 -18
- package/source/DOM/tbody.js +30 -21
- package/source/ItemHeights.js +27 -27
- package/source/Layout.js +629 -252
- package/source/Layout.test.js +176 -0
- package/source/ListHeightMeasurement.js +95 -0
- package/source/Resize.js +56 -32
- package/source/Scroll.js +135 -82
- package/source/VirtualScroller.columns.js +26 -0
- package/source/VirtualScroller.constructor.js +336 -0
- package/source/VirtualScroller.items.js +302 -0
- package/source/VirtualScroller.js +162 -936
- package/source/VirtualScroller.layout.js +539 -0
- package/source/VirtualScroller.onRender.js +345 -0
- package/source/VirtualScroller.resize.js +189 -0
- package/source/VirtualScroller.state.js +284 -0
- package/source/VirtualScroller.verticalSpacing.js +51 -0
- package/source/getVerticalSpacing.js +7 -7
- package/source/react/VirtualScroller.js +243 -603
- package/source/react/useClassName.js +14 -0
- package/source/react/useHandleItemsChange.js +115 -0
- package/source/react/useInstanceMethods.js +25 -0
- package/source/react/useItemKeys.js +59 -0
- package/source/react/useOnItemHeightChange.js +28 -0
- package/source/react/useOnItemStateChange.js +28 -0
- package/source/react/useState.js +114 -0
- package/source/react/useStyle.js +20 -0
- package/source/react/useVirtualScroller.js +59 -0
- package/source/react/useVirtualScrollerStartStop.js +12 -0
- package/source/test/Engine.js +11 -0
- package/source/test/ItemsContainer.js +87 -0
- package/source/test/ScrollableContainer.js +88 -0
- package/source/test/VirtualScroller.js +232 -0
- package/source/utility/debounce.js +22 -5
- package/source/utility/debug.js +34 -3
- package/source/utility/getStateSnapshot.js +36 -0
- package/source/utility/px.js +1 -1
- package/source/utility/px.test.js +9 -0
- package/website/index-bypass.html +195 -0
- package/website/index-grid.html +0 -1
- package/website/index-scrollableContainer.html +208 -0
- package/website/index-tbody-scrollableContainer.html +68 -0
- package/website/index-tbody.html +55 -0
- package/commonjs/DOM/RenderingEngine.js +0 -33
- package/commonjs/DOM/RenderingEngine.js.map +0 -1
- package/commonjs/DOM/Screen.js +0 -87
- package/commonjs/DOM/Screen.js.map +0 -1
- package/commonjs/DOM/WaitForStylesToLoad.js.map +0 -1
- package/commonjs/RestoreScroll.js +0 -118
- package/commonjs/RestoreScroll.js.map +0 -1
- package/dom/index.commonjs.js +0 -4
- package/index.commonjs.js +0 -4
- package/modules/DOM/RenderingEngine.js +0 -19
- package/modules/DOM/RenderingEngine.js.map +0 -1
- package/modules/DOM/Screen.js +0 -80
- package/modules/DOM/Screen.js.map +0 -1
- package/modules/DOM/WaitForStylesToLoad.js.map +0 -1
- package/modules/RestoreScroll.js +0 -111
- package/modules/RestoreScroll.js.map +0 -1
- package/react/index.commonjs.js +0 -4
- package/source/DOM/RenderingEngine.js +0 -22
- package/source/DOM/Screen.js +0 -51
- package/source/RestoreScroll.js +0 -86
package/modules/Layout.js
CHANGED
|
@@ -1,49 +1,74 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
1
7
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
8
|
|
|
3
9
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4
10
|
|
|
5
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
11
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
12
|
|
|
7
|
-
import log from './utility/debug';
|
|
13
|
+
import log, { warn } from './utility/debug.js';
|
|
8
14
|
|
|
9
|
-
var Layout =
|
|
10
|
-
/*#__PURE__*/
|
|
11
|
-
function () {
|
|
15
|
+
var Layout = /*#__PURE__*/function () {
|
|
12
16
|
function Layout(_ref) {
|
|
13
17
|
var bypass = _ref.bypass,
|
|
14
18
|
estimatedItemHeight = _ref.estimatedItemHeight,
|
|
15
19
|
measureItemsBatchSize = _ref.measureItemsBatchSize,
|
|
20
|
+
getPrerenderMargin = _ref.getPrerenderMargin,
|
|
16
21
|
getVerticalSpacing = _ref.getVerticalSpacing,
|
|
22
|
+
getVerticalSpacingBeforeResize = _ref.getVerticalSpacingBeforeResize,
|
|
17
23
|
getColumnsCount = _ref.getColumnsCount,
|
|
24
|
+
getColumnsCountBeforeResize = _ref.getColumnsCountBeforeResize,
|
|
18
25
|
getItemHeight = _ref.getItemHeight,
|
|
19
|
-
|
|
26
|
+
getItemHeightBeforeResize = _ref.getItemHeightBeforeResize,
|
|
27
|
+
getBeforeResizeItemsCount = _ref.getBeforeResizeItemsCount,
|
|
28
|
+
getAverageItemHeight = _ref.getAverageItemHeight,
|
|
29
|
+
getMaxVisibleAreaHeight = _ref.getMaxVisibleAreaHeight,
|
|
30
|
+
getPreviouslyCalculatedLayout = _ref.getPreviouslyCalculatedLayout;
|
|
20
31
|
|
|
21
32
|
_classCallCheck(this, Layout);
|
|
22
33
|
|
|
23
34
|
this.bypass = bypass;
|
|
24
35
|
this.estimatedItemHeight = estimatedItemHeight;
|
|
25
36
|
this.measureItemsBatchSize = measureItemsBatchSize;
|
|
37
|
+
this.getPrerenderMargin = getPrerenderMargin;
|
|
26
38
|
this.getVerticalSpacing = getVerticalSpacing;
|
|
39
|
+
this.getVerticalSpacingBeforeResize = getVerticalSpacingBeforeResize;
|
|
27
40
|
this.getColumnsCount = getColumnsCount;
|
|
41
|
+
this.getColumnsCountBeforeResize = getColumnsCountBeforeResize;
|
|
28
42
|
this.getItemHeight = getItemHeight;
|
|
43
|
+
this.getItemHeightBeforeResize = getItemHeightBeforeResize;
|
|
44
|
+
this.getBeforeResizeItemsCount = getBeforeResizeItemsCount;
|
|
29
45
|
this.getAverageItemHeight = getAverageItemHeight;
|
|
46
|
+
this.getMaxVisibleAreaHeight = getMaxVisibleAreaHeight; //
|
|
47
|
+
// The "previously calculated layout" feature is not currently used.
|
|
48
|
+
//
|
|
49
|
+
// The current layout snapshot could be stored as a "previously calculated layout" variable
|
|
50
|
+
// so that it could theoretically be used when calculating new layout incrementally
|
|
51
|
+
// rather than from scratch, which would be an optimization.
|
|
52
|
+
//
|
|
53
|
+
|
|
54
|
+
this.getPreviouslyCalculatedLayout = getPreviouslyCalculatedLayout;
|
|
30
55
|
}
|
|
31
56
|
|
|
32
57
|
_createClass(Layout, [{
|
|
33
58
|
key: "getInitialLayoutValues",
|
|
34
59
|
value: function getInitialLayoutValues(_ref2) {
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
visibleAreaHeightIncludingMargins = _ref2.visibleAreaHeightIncludingMargins;
|
|
38
|
-
// On server side, at initialization time, there's no "visible area height",
|
|
39
|
-
// so default to `1` estimated rows count.
|
|
40
|
-
var estimatedRowsCount = visibleAreaHeightIncludingMargins ? this.getEstimatedRowsCountForHeight(visibleAreaHeightIncludingMargins) : 1;
|
|
60
|
+
var itemsCount = _ref2.itemsCount,
|
|
61
|
+
columnsCount = _ref2.columnsCount;
|
|
41
62
|
var firstShownItemIndex;
|
|
42
63
|
var lastShownItemIndex; // If there're no items then `firstShownItemIndex` stays `undefined`.
|
|
43
64
|
|
|
44
65
|
if (itemsCount > 0) {
|
|
45
66
|
firstShownItemIndex = 0;
|
|
46
|
-
lastShownItemIndex = this.
|
|
67
|
+
lastShownItemIndex = this.getInitialLastShownItemIndex({
|
|
68
|
+
itemsCount: itemsCount,
|
|
69
|
+
columnsCount: columnsCount,
|
|
70
|
+
firstShownItemIndex: firstShownItemIndex
|
|
71
|
+
});
|
|
47
72
|
}
|
|
48
73
|
|
|
49
74
|
return {
|
|
@@ -54,21 +79,35 @@ function () {
|
|
|
54
79
|
};
|
|
55
80
|
}
|
|
56
81
|
}, {
|
|
57
|
-
key: "
|
|
58
|
-
value: function
|
|
59
|
-
|
|
82
|
+
key: "getInitialLastShownItemIndex",
|
|
83
|
+
value: function getInitialLastShownItemIndex(_ref3) {
|
|
84
|
+
var itemsCount = _ref3.itemsCount,
|
|
85
|
+
columnsCount = _ref3.columnsCount,
|
|
86
|
+
firstShownItemIndex = _ref3.firstShownItemIndex;
|
|
87
|
+
|
|
88
|
+
if (this.bypass) {
|
|
60
89
|
return itemsCount - 1;
|
|
90
|
+
} // On server side, at initialization time,
|
|
91
|
+
// `scrollableContainer` is `undefined`,
|
|
92
|
+
// so default to `1` estimated rows count.
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
var estimatedRowsCount = 1;
|
|
96
|
+
|
|
97
|
+
if (this.getMaxVisibleAreaHeight()) {
|
|
98
|
+
estimatedRowsCount = this.getEstimatedRowsCountForHeight(this.getMaxVisibleAreaHeight() + this.getPrerenderMargin());
|
|
61
99
|
}
|
|
62
100
|
|
|
63
|
-
return Math.min(firstShownItemIndex + (estimatedRowsCount *
|
|
101
|
+
return Math.min(firstShownItemIndex + (estimatedRowsCount * columnsCount - 1), itemsCount - 1);
|
|
64
102
|
}
|
|
65
103
|
}, {
|
|
66
104
|
key: "getEstimatedRowsCountForHeight",
|
|
67
105
|
value: function getEstimatedRowsCountForHeight(height) {
|
|
68
106
|
var estimatedItemHeight = this.getEstimatedItemHeight();
|
|
107
|
+
var verticalSpacing = this.getVerticalSpacing();
|
|
69
108
|
|
|
70
109
|
if (estimatedItemHeight) {
|
|
71
|
-
return Math.ceil((height +
|
|
110
|
+
return Math.ceil((height + verticalSpacing) / (estimatedItemHeight + verticalSpacing));
|
|
72
111
|
} else {
|
|
73
112
|
// If no items have been rendered yet, and no `estimatedItemHeight` option
|
|
74
113
|
// has been passed, then default to `1` estimated rows count in any `height`.
|
|
@@ -87,286 +126,616 @@ function () {
|
|
|
87
126
|
return this.getAverageItemHeight() || this.estimatedItemHeight || 0;
|
|
88
127
|
}
|
|
89
128
|
}, {
|
|
90
|
-
key: "
|
|
91
|
-
value: function
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
129
|
+
key: "getLayoutUpdateForItemsDiff",
|
|
130
|
+
value: function getLayoutUpdateForItemsDiff(_ref4, _ref5, _ref6) {
|
|
131
|
+
var firstShownItemIndex = _ref4.firstShownItemIndex,
|
|
132
|
+
lastShownItemIndex = _ref4.lastShownItemIndex,
|
|
133
|
+
beforeItemsHeight = _ref4.beforeItemsHeight,
|
|
134
|
+
afterItemsHeight = _ref4.afterItemsHeight;
|
|
135
|
+
var prependedItemsCount = _ref5.prependedItemsCount,
|
|
136
|
+
appendedItemsCount = _ref5.appendedItemsCount;
|
|
137
|
+
var itemsCount = _ref6.itemsCount,
|
|
138
|
+
columnsCount = _ref6.columnsCount,
|
|
139
|
+
shouldRestoreScrollPosition = _ref6.shouldRestoreScrollPosition,
|
|
140
|
+
onResetGridLayout = _ref6.onResetGridLayout;
|
|
141
|
+
// const layoutUpdate = {}
|
|
142
|
+
// If the layout stays the same, then simply increase
|
|
143
|
+
// the top and bottom margins proportionally to the amount
|
|
144
|
+
// of the items added.
|
|
145
|
+
var averageItemHeight = this.getAverageItemHeight();
|
|
146
|
+
var verticalSpacing = this.getVerticalSpacing();
|
|
147
|
+
|
|
148
|
+
if (appendedItemsCount > 0) {
|
|
149
|
+
var appendedRowsCount = Math.ceil(appendedItemsCount / columnsCount);
|
|
150
|
+
var addedHeightAfter = appendedRowsCount * (verticalSpacing + averageItemHeight);
|
|
151
|
+
afterItemsHeight += addedHeightAfter; // layoutUpdate = {
|
|
152
|
+
// ...layoutUpdate,
|
|
153
|
+
// afterItemsHeight
|
|
154
|
+
// }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (prependedItemsCount > 0) {
|
|
158
|
+
var prependedRowsCount = Math.ceil(prependedItemsCount / columnsCount);
|
|
159
|
+
var addedHeightBefore = prependedRowsCount * (averageItemHeight + verticalSpacing);
|
|
160
|
+
firstShownItemIndex += prependedItemsCount;
|
|
161
|
+
lastShownItemIndex += prependedItemsCount;
|
|
162
|
+
beforeItemsHeight += addedHeightBefore; // If the currently shown items position on screen should be preserved
|
|
163
|
+
// when prepending new items, then it means that:
|
|
164
|
+
// * The current scroll position should be snapshotted.
|
|
165
|
+
// * The current list height should be snapshotted.
|
|
166
|
+
// * All prepended items should be shown so that their height could be
|
|
167
|
+
// measured after they're rendered. Based on the prepended items' height,
|
|
168
|
+
// the scroll position will be restored so that there's no "jump of content".
|
|
169
|
+
|
|
170
|
+
if (shouldRestoreScrollPosition) {
|
|
171
|
+
firstShownItemIndex = 0;
|
|
172
|
+
beforeItemsHeight = 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (prependedItemsCount % columnsCount > 0) {
|
|
176
|
+
// Rows will be rebalanced as a result of prepending new items,
|
|
177
|
+
// and row heights can change as a result, so re-layout items
|
|
178
|
+
// after they've been measured (after the upcoming re-render).
|
|
179
|
+
//
|
|
180
|
+
// For example, consider a web page where item rows are `display: flex`.
|
|
181
|
+
// Suppose there're 3 columns and it shows items from 4 to 6.
|
|
182
|
+
//
|
|
183
|
+
// ------------------------------------------
|
|
184
|
+
// | Apples are | Bananas | Cranberries |
|
|
185
|
+
// | green | | |
|
|
186
|
+
// ------------------------------------------
|
|
187
|
+
// | Dates | Elderberry | Figs are |
|
|
188
|
+
// | | | tasty |
|
|
189
|
+
// ------------------------------------------
|
|
190
|
+
//
|
|
191
|
+
// Now, 1 item gets prepended. As a result, all existing rows will have
|
|
192
|
+
// a different set of items, which means that the row heights will change.
|
|
193
|
+
//
|
|
194
|
+
// ------------------------------------------
|
|
195
|
+
// | Zucchini | Apples are | Bananas |
|
|
196
|
+
// | | green | |
|
|
197
|
+
// ------------------------------------------
|
|
198
|
+
// | Cranberries | Dates | Elderberry |
|
|
199
|
+
// ------------------------------------------
|
|
200
|
+
// | Figs |
|
|
201
|
+
// | are tasty |
|
|
202
|
+
// ---------------
|
|
203
|
+
//
|
|
204
|
+
// As it can be seen above, the second row's height has changed from 2 to 1.
|
|
205
|
+
// Not only that, but `itemHeights` have changed as well, so if you thought
|
|
206
|
+
// that the library could easily recalculate row heights using `Math.max()` —
|
|
207
|
+
// turns out it's not always the case.
|
|
208
|
+
//
|
|
209
|
+
// There could be an explicit opt-in option for automatically recalculating
|
|
210
|
+
// row heights, but I don't want to write code for such an extremely rare
|
|
211
|
+
// use case. Instead, use the `getColumnsCount()` parameter function when
|
|
212
|
+
// fetching previous items.
|
|
213
|
+
onResetGridLayout();
|
|
214
|
+
warn('~ Prepended items count', prependedItemsCount, 'is not divisible by Columns Count', columnsCount, '~');
|
|
215
|
+
warn('Layout reset required');
|
|
216
|
+
var shownItemsCountBeforeItemsUpdate = lastShownItemIndex - firstShownItemIndex + 1;
|
|
217
|
+
firstShownItemIndex = 0;
|
|
218
|
+
beforeItemsHeight = 0;
|
|
219
|
+
|
|
220
|
+
if (!shouldRestoreScrollPosition) {
|
|
221
|
+
// Limit shown items count if too many items have been prepended.
|
|
222
|
+
if (prependedItemsCount > shownItemsCountBeforeItemsUpdate) {
|
|
223
|
+
lastShownItemIndex = this.getInitialLastShownItemIndex({
|
|
224
|
+
itemsCount: itemsCount,
|
|
225
|
+
columnsCount: columnsCount,
|
|
226
|
+
firstShownItemIndex: firstShownItemIndex
|
|
227
|
+
}); // Approximate `afterItemsHeight` calculation.
|
|
228
|
+
|
|
229
|
+
var afterItemsCount = itemsCount - (lastShownItemIndex + 1);
|
|
230
|
+
afterItemsHeight = Math.ceil(afterItemsCount / columnsCount) * (verticalSpacing + averageItemHeight); // layoutUpdate = {
|
|
231
|
+
// ...layoutUpdate,
|
|
232
|
+
// afterItemsHeight
|
|
233
|
+
// }
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} // layoutUpdate = {
|
|
237
|
+
// ...layoutUpdate,
|
|
238
|
+
// beforeItemsHeight,
|
|
239
|
+
// firstShownItemIndex,
|
|
240
|
+
// lastShownItemIndex
|
|
241
|
+
// }
|
|
242
|
+
|
|
243
|
+
} // return layoutUpdate
|
|
244
|
+
// Overwrite all four props in all scenarios.
|
|
245
|
+
// The reason is that only this way subsequent `setItems()` calls
|
|
246
|
+
// will be truly "stateless" when a chain of `setItems()` calls
|
|
247
|
+
// could be replaced with just the last one in a scenario when
|
|
248
|
+
// `updateState()` calls are "asynchronous" (delayed execution).
|
|
249
|
+
//
|
|
250
|
+
// So, for example, the user calls `setItems()` with one set of items.
|
|
251
|
+
// A `updateState()` call has been dispatched but the `state` hasn't been updated yet.
|
|
252
|
+
// Then the user calls `setItems()` with another set of items.
|
|
253
|
+
// If this function only returned a minimal set of properties that actually change,
|
|
254
|
+
// the other layout properties of the second `setItems()` call wouldn't overwrite the ones
|
|
255
|
+
// scheduled for update during the first `setItems()` call, resulting in an inconsistent `state`.
|
|
256
|
+
//
|
|
257
|
+
// For example, the first `setItems()` call does a `updateState()` call where it updates
|
|
258
|
+
// `afterItemsHeight`, and then the second `setItems()` call only updates `beforeItemsHeight`
|
|
259
|
+
// and `firstShownItemIndex` and `lastShownItemIndex`. If the second `setItems()` call was to
|
|
260
|
+
// overwrite any effects of the pending-but-not-yet-applied first `setItems()` call, it would
|
|
261
|
+
// have to call `updateState()` with an `afterItemsHeight` property too, even though it hasn't change.
|
|
262
|
+
// That would be just to revert the change to `afterItemsHeight` state property already scheduled
|
|
263
|
+
// by the first `setItems()` call.
|
|
264
|
+
//
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
return {
|
|
268
|
+
beforeItemsHeight: beforeItemsHeight,
|
|
269
|
+
afterItemsHeight: afterItemsHeight,
|
|
270
|
+
firstShownItemIndex: firstShownItemIndex,
|
|
271
|
+
lastShownItemIndex: lastShownItemIndex
|
|
272
|
+
};
|
|
273
|
+
} // If an item that hasn't been shown (and measured) yet is encountered
|
|
274
|
+
// then show such item and then retry after it has been measured.
|
|
275
|
+
|
|
276
|
+
}, {
|
|
277
|
+
key: "getItemNotMeasuredIndexes",
|
|
278
|
+
value: function getItemNotMeasuredIndexes(i, _ref7) {
|
|
279
|
+
var itemsCount = _ref7.itemsCount,
|
|
280
|
+
firstShownItemIndex = _ref7.firstShownItemIndex,
|
|
281
|
+
nonMeasuredAreaHeight = _ref7.nonMeasuredAreaHeight,
|
|
282
|
+
indexOfTheFirstItemInTheRow = _ref7.indexOfTheFirstItemInTheRow;
|
|
283
|
+
log('Item index', i, 'height is required for calculations but hasn\'t been measured yet. Mark the item as "shown", rerender the list, measure the item\'s height and redo the layout.');
|
|
97
284
|
var columnsCount = this.getColumnsCount();
|
|
285
|
+
var itemsCountToRenderForMeasurement = Math.min(this.getEstimatedRowsCountForHeight(nonMeasuredAreaHeight) * columnsCount, this.measureItemsBatchSize || Infinity);
|
|
98
286
|
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
// the top and bottom margins proportionally to the amount
|
|
102
|
-
// of the items added.
|
|
103
|
-
var prependedRowsCount = prependedItemsCount / columnsCount;
|
|
104
|
-
var appendedRowsCount = Math.ceil(appendedItemsCount / columnsCount);
|
|
105
|
-
var averageItemHeight = this.getAverageItemHeight();
|
|
106
|
-
var verticalSpacing = this.getVerticalSpacing();
|
|
107
|
-
layout.beforeItemsHeight += prependedRowsCount * (averageItemHeight + verticalSpacing);
|
|
108
|
-
layout.afterItemsHeight += appendedRowsCount * (verticalSpacing + averageItemHeight);
|
|
109
|
-
} else {
|
|
110
|
-
// Rows will be rebalanced as a result of prepending the items,
|
|
111
|
-
// and the row heights can change as a result, so recalculate
|
|
112
|
-
// `beforeItemsHeight` and `afterItemsHeight` from scratch.
|
|
113
|
-
// `this.itemHeights[]` and `firstShownItemIndex`/`lastShownItemIndex`
|
|
114
|
-
// have already been updated at this point.
|
|
115
|
-
layout.beforeItemsHeight = this.getBeforeItemsHeight(layout.firstShownItemIndex, layout.lastShownItemIndex);
|
|
116
|
-
layout.afterItemsHeight = this.getAfterItemsHeight(layout.firstShownItemIndex, layout.lastShownItemIndex, itemsCount);
|
|
287
|
+
if (firstShownItemIndex === undefined) {
|
|
288
|
+
firstShownItemIndex = indexOfTheFirstItemInTheRow;
|
|
117
289
|
}
|
|
290
|
+
|
|
291
|
+
var lastShownItemIndex = Math.min(indexOfTheFirstItemInTheRow + itemsCountToRenderForMeasurement - 1, // Guard against index overflow.
|
|
292
|
+
itemsCount - 1);
|
|
293
|
+
return {
|
|
294
|
+
firstNonMeasuredItemIndex: i,
|
|
295
|
+
firstShownItemIndex: firstShownItemIndex,
|
|
296
|
+
lastShownItemIndex: lastShownItemIndex
|
|
297
|
+
};
|
|
118
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Finds the indexes of the currently visible items.
|
|
301
|
+
* @return {object} `{ firstShownItemIndex: number, lastShownItemIndex: number, firstNonMeasuredItemIndex: number? }`
|
|
302
|
+
*/
|
|
303
|
+
|
|
119
304
|
}, {
|
|
120
|
-
key: "
|
|
121
|
-
value: function
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
var
|
|
127
|
-
|
|
305
|
+
key: "getShownItemIndexes",
|
|
306
|
+
value: function getShownItemIndexes(_ref8) {
|
|
307
|
+
var itemsCount = _ref8.itemsCount,
|
|
308
|
+
visibleAreaTop = _ref8.visibleAreaTop,
|
|
309
|
+
visibleAreaBottom = _ref8.visibleAreaBottom;
|
|
310
|
+
|
|
311
|
+
var indexes = this._getShownItemIndex({
|
|
312
|
+
itemsCount: itemsCount,
|
|
313
|
+
fromIndex: 0,
|
|
314
|
+
visibleAreaTop: visibleAreaTop,
|
|
315
|
+
visibleAreaBottom: visibleAreaBottom,
|
|
316
|
+
findFirstShownItemIndex: true
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
if (indexes === null) {
|
|
320
|
+
return this.getNonVisibleListShownItemIndexes();
|
|
321
|
+
}
|
|
128
322
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var currentRowHeight = 0;
|
|
133
|
-
var columnIndex = 0;
|
|
134
|
-
var i = void 0;
|
|
323
|
+
if (indexes.firstNonMeasuredItemIndex !== undefined) {
|
|
324
|
+
return indexes;
|
|
325
|
+
}
|
|
135
326
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
327
|
+
var _indexes = indexes,
|
|
328
|
+
firstShownItemIndex = _indexes.firstShownItemIndex,
|
|
329
|
+
beforeItemsHeight = _indexes.beforeItemsHeight;
|
|
330
|
+
indexes = this._getShownItemIndex({
|
|
331
|
+
itemsCount: itemsCount,
|
|
332
|
+
fromIndex: firstShownItemIndex,
|
|
333
|
+
beforeItemsHeight: beforeItemsHeight,
|
|
334
|
+
visibleAreaTop: visibleAreaTop,
|
|
335
|
+
visibleAreaBottom: visibleAreaBottom,
|
|
336
|
+
findLastShownItemIndex: true
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
if (indexes === null) {
|
|
340
|
+
return this.getNonVisibleListShownItemIndexes();
|
|
341
|
+
}
|
|
139
342
|
|
|
140
|
-
|
|
141
|
-
|
|
343
|
+
if (indexes.firstNonMeasuredItemIndex !== undefined) {
|
|
344
|
+
return indexes;
|
|
345
|
+
}
|
|
142
346
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
347
|
+
var _indexes2 = indexes,
|
|
348
|
+
lastShownItemIndex = _indexes2.lastShownItemIndex;
|
|
349
|
+
return {
|
|
350
|
+
firstShownItemIndex: firstShownItemIndex,
|
|
351
|
+
lastShownItemIndex: lastShownItemIndex
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}, {
|
|
355
|
+
key: "_getShownItemIndex",
|
|
356
|
+
value: function _getShownItemIndex(parameters) {
|
|
357
|
+
var beforeResize = parameters.beforeResize,
|
|
358
|
+
itemsCount = parameters.itemsCount,
|
|
359
|
+
visibleAreaTop = parameters.visibleAreaTop,
|
|
360
|
+
visibleAreaBottom = parameters.visibleAreaBottom,
|
|
361
|
+
findFirstShownItemIndex = parameters.findFirstShownItemIndex,
|
|
362
|
+
findLastShownItemIndex = parameters.findLastShownItemIndex;
|
|
363
|
+
var fromIndex = parameters.fromIndex,
|
|
364
|
+
beforeItemsHeight = parameters.beforeItemsHeight; // This function could potentially also use `this.getPreviouslyCalculatedLayout()`
|
|
365
|
+
// in order to skip calculating visible item indexes from scratch
|
|
366
|
+
// and instead just calculate the difference from a "previously calculated layout".
|
|
367
|
+
//
|
|
368
|
+
// I did a simple test in a web browser and found out that running the following
|
|
369
|
+
// piece of code is less than 10 milliseconds:
|
|
370
|
+
//
|
|
371
|
+
// var startedAt = Date.now()
|
|
372
|
+
// var i = 0
|
|
373
|
+
// while (i < 1000000) {
|
|
374
|
+
// i++
|
|
375
|
+
// }
|
|
376
|
+
// console.log(Date.now() - startedAt)
|
|
377
|
+
//
|
|
378
|
+
// Which becomes negligible in my project's use case (a couple thousands items max).
|
|
379
|
+
//
|
|
380
|
+
// If someone would attempt to use a "previously calculated layout" here
|
|
381
|
+
// then `shownItemsHeight` would also have to be returned from this function:
|
|
382
|
+
// the total height of all shown items including vertical spacing between them.
|
|
383
|
+
//
|
|
384
|
+
// If "previously calculated layout" would be used then it would first find
|
|
385
|
+
// `firstShownItemIndex` and then find `lastShownItemIndex` as part of two
|
|
386
|
+
// separate calls of this function, each with or without `backwards` flag,
|
|
387
|
+
// depending on whether `visibleAreaTop` and `visibleAreBottom` have shifted up or down.
|
|
388
|
+
|
|
389
|
+
var firstShownItemIndex;
|
|
390
|
+
var lastShownItemIndex; // It's not always required to pass `beforeItemsHeight` parameter:
|
|
391
|
+
// when `fromIndex` is `0`, it's also assumed to be `0`.
|
|
392
|
+
|
|
393
|
+
if (fromIndex === 0) {
|
|
394
|
+
beforeItemsHeight = 0;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (beforeItemsHeight === undefined) {
|
|
398
|
+
throw new Error('[virtual-scroller] `beforeItemsHeight` not passed to `Layout.getShownItemIndexes()` when starting from index ' + fromIndex);
|
|
399
|
+
} // const backwards = false
|
|
400
|
+
// while (backwards ? i >= 0 : i < itemsCount) {}
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
if (!beforeResize) {
|
|
404
|
+
var beforeResizeItemsCount = this.getBeforeResizeItemsCount();
|
|
405
|
+
|
|
406
|
+
if (beforeResizeItemsCount > fromIndex) {
|
|
407
|
+
// First search for the item in "before resize" items.
|
|
408
|
+
var _this$_getShownItemIn = this._getShownItemIndex(_objectSpread(_objectSpread({}, parameters), {}, {
|
|
409
|
+
beforeResize: true,
|
|
410
|
+
itemsCount: beforeResizeItemsCount
|
|
411
|
+
})),
|
|
412
|
+
notFound = _this$_getShownItemIn.notFound,
|
|
413
|
+
beforeResizeItemsHeight = _this$_getShownItemIn.beforeItemsHeight,
|
|
414
|
+
_firstShownItemIndex = _this$_getShownItemIn.firstShownItemIndex,
|
|
415
|
+
_lastShownItemIndex = _this$_getShownItemIn.lastShownItemIndex; // If the item was not found in "before resize" items
|
|
416
|
+
// then search in regular items skipping "before resize" ones.
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
if (notFound) {
|
|
420
|
+
beforeItemsHeight = beforeResizeItemsHeight;
|
|
421
|
+
fromIndex += beforeResizeItemsCount;
|
|
422
|
+
} else {
|
|
423
|
+
// If the item was found in "before resize" items
|
|
424
|
+
// then return the result.
|
|
425
|
+
// Rebalance first / last shown item indexes based on
|
|
426
|
+
// the current columns count, if required.
|
|
427
|
+
var _columnsCount = this.getColumnsCount();
|
|
146
428
|
|
|
147
|
-
var heightLeft = visibleAreaBottom - (listTopOffset + previousRowsHeight);
|
|
148
|
-
lastShownItemIndex = Math.min((rowIndex + this.getEstimatedRowsCountForHeight(heightLeft)) * columnsCount - 1, // Guard against index overflow.
|
|
149
|
-
itemsCount - 1);
|
|
150
429
|
return {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
430
|
+
firstShownItemIndex: _firstShownItemIndex === undefined ? undefined : Math.floor(_firstShownItemIndex / _columnsCount) * _columnsCount,
|
|
431
|
+
lastShownItemIndex: _lastShownItemIndex === undefined ? undefined : Math.floor(_lastShownItemIndex / _columnsCount) * _columnsCount,
|
|
432
|
+
beforeItemsHeight: beforeResizeItemsHeight
|
|
154
433
|
};
|
|
155
434
|
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
156
437
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (firstShownItemIndex === undefined) {
|
|
161
|
-
if (listTopOffset + previousRowsHeight + currentRowHeight > visibleAreaTop) {
|
|
162
|
-
log('First shown row index', rowIndex);
|
|
163
|
-
firstShownItemIndex = rowIndex * columnsCount;
|
|
164
|
-
}
|
|
165
|
-
} // If this item is the last one visible in the viewport then exit.
|
|
438
|
+
var columnsCount = beforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount();
|
|
439
|
+
var verticalSpacing = beforeResize ? this.getVerticalSpacingBeforeResize() : this.getVerticalSpacing();
|
|
440
|
+
var i = fromIndex;
|
|
166
441
|
|
|
442
|
+
while (i < itemsCount) {
|
|
443
|
+
var currentRowFirstItemIndex = i;
|
|
444
|
+
var hasMoreRows = itemsCount > currentRowFirstItemIndex + columnsCount;
|
|
445
|
+
var verticalSpacingAfterCurrentRow = hasMoreRows ? verticalSpacing : 0;
|
|
446
|
+
var currentRowHeight = 0; // Calculate current row height.
|
|
167
447
|
|
|
168
|
-
|
|
169
|
-
log('Last shown row index', rowIndex); // The list height is estimated until all items have been seen,
|
|
170
|
-
// so it's possible that even when the list DOM element happens
|
|
171
|
-
// to be in the viewport in reality the list isn't visible
|
|
172
|
-
// in which case `firstShownItemIndex` will be `undefined`.
|
|
448
|
+
var columnIndex = 0;
|
|
173
449
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
450
|
+
while (columnIndex < columnsCount && i < itemsCount) {
|
|
451
|
+
var itemHeight = beforeResize ? this.getItemHeightBeforeResize(i) : this.getItemHeight(i); // If this item hasn't been measured yet (or re-measured after a resize)
|
|
452
|
+
// then mark it as the first non-measured one.
|
|
453
|
+
//
|
|
454
|
+
// Can't happen by definition when `beforeResize` parameter is `true`.
|
|
455
|
+
//
|
|
179
456
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
457
|
+
if (itemHeight === undefined) {
|
|
458
|
+
return this.getItemNotMeasuredIndexes(i, {
|
|
459
|
+
itemsCount: itemsCount,
|
|
460
|
+
firstShownItemIndex: findLastShownItemIndex ? fromIndex : undefined,
|
|
461
|
+
indexOfTheFirstItemInTheRow: currentRowFirstItemIndex,
|
|
462
|
+
nonMeasuredAreaHeight: visibleAreaBottom + this.getPrerenderMargin() - beforeItemsHeight
|
|
463
|
+
});
|
|
184
464
|
}
|
|
185
465
|
|
|
466
|
+
currentRowHeight = Math.max(currentRowHeight, itemHeight);
|
|
186
467
|
columnIndex++;
|
|
468
|
+
i++;
|
|
187
469
|
}
|
|
188
470
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
471
|
+
var itemsHeightFromFirstRowToThisRow = beforeItemsHeight + currentRowHeight;
|
|
472
|
+
var rowStepsIntoVisibleAreaTop = itemsHeightFromFirstRowToThisRow > visibleAreaTop - this.getPrerenderMargin();
|
|
473
|
+
var rowStepsOutOfVisibleAreaBottomOrIsAtTheBorder = itemsHeightFromFirstRowToThisRow + verticalSpacingAfterCurrentRow >= visibleAreaBottom + this.getPrerenderMargin(); // if (backwards) {
|
|
474
|
+
// if (findFirstShownItemIndex) {
|
|
475
|
+
// if (rowStepsOutOfVisibleAreaTop) {
|
|
476
|
+
// return {
|
|
477
|
+
// firstShownItemIndex: currentRowFirstItemIndex + columnsCount
|
|
478
|
+
// }
|
|
479
|
+
// }
|
|
480
|
+
// } else if (findLastShownItemIndex) {
|
|
481
|
+
// if (rowStepsIntoVisibleAreaBottom) {
|
|
482
|
+
// return {
|
|
483
|
+
// lastShownItemIndex: currentRowFirstItemIndex + columnsCount - 1
|
|
484
|
+
// }
|
|
485
|
+
// }
|
|
486
|
+
// }
|
|
487
|
+
// }
|
|
488
|
+
|
|
489
|
+
if (findFirstShownItemIndex) {
|
|
490
|
+
if (rowStepsIntoVisibleAreaTop) {
|
|
491
|
+
// If item is the first one visible in the viewport
|
|
492
|
+
// then start showing items from this row.
|
|
493
|
+
return {
|
|
494
|
+
firstShownItemIndex: currentRowFirstItemIndex,
|
|
495
|
+
beforeItemsHeight: beforeItemsHeight
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
} else if (findLastShownItemIndex) {
|
|
499
|
+
if (rowStepsOutOfVisibleAreaBottomOrIsAtTheBorder) {
|
|
500
|
+
return {
|
|
501
|
+
lastShownItemIndex: Math.min( // The index of the last item in the current row.
|
|
502
|
+
currentRowFirstItemIndex + columnsCount - 1, // Guards against index overflow.
|
|
503
|
+
itemsCount - 1)
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
}
|
|
195
507
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
508
|
+
beforeItemsHeight += currentRowHeight + verticalSpacingAfterCurrentRow; // if (backwards) {
|
|
509
|
+
// // Set `i` to be the first item of the current row.
|
|
510
|
+
// i -= columnsCount
|
|
511
|
+
// const prevoiusRowIsBeforeResize = i - 1 < this.getBeforeResizeItemsCount()
|
|
512
|
+
// const previousRowColumnsCount = prevoiusRowIsBeforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount()
|
|
513
|
+
// // Set `i` to be the first item of the previous row.
|
|
514
|
+
// i -= previousRowColumnsCount
|
|
515
|
+
// }
|
|
516
|
+
} // if (backwards) {
|
|
517
|
+
// if (findFirstShownItemIndex) {
|
|
518
|
+
// warn('The list is supposed to be visible but no visible item has been found (while traversing backwards)')
|
|
519
|
+
// return null
|
|
520
|
+
// } else if (findLastShownItemIndex) {
|
|
521
|
+
// return {
|
|
522
|
+
// firstShownItemIndex: 0
|
|
523
|
+
// }
|
|
524
|
+
// }
|
|
525
|
+
// }
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
if (beforeResize) {
|
|
529
|
+
return {
|
|
530
|
+
notFound: true,
|
|
531
|
+
beforeItemsHeight: beforeItemsHeight
|
|
532
|
+
};
|
|
533
|
+
} // This case isn't supposed to happen but it could hypothetically happen
|
|
534
|
+
// because the list height is measured from the user's screen and
|
|
535
|
+
// not necessarily can be trusted.
|
|
200
536
|
|
|
201
|
-
return {
|
|
202
|
-
firstShownItemIndex: firstShownItemIndex,
|
|
203
|
-
lastShownItemIndex: lastShownItemIndex
|
|
204
|
-
};
|
|
205
|
-
} // Finds the items which are displayed in the viewport.
|
|
206
537
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
var redoLayoutAfterMeasuringItemHeights = firstNonMeasuredItemIndex !== undefined; // If some items will be rendered in order to measure their height,
|
|
216
|
-
// and it's not a `preserveScrollPositionOnPrependItems` case,
|
|
217
|
-
// then limit the amount of such items being measured in a single pass.
|
|
218
|
-
|
|
219
|
-
if (redoLayoutAfterMeasuringItemHeights && this.measureItemsBatchSize) {
|
|
220
|
-
var maxAllowedLastShownItemIndex = firstNonMeasuredItemIndex + this.measureItemsBatchSize - 1;
|
|
221
|
-
var columnsCount = this.getColumnsCount();
|
|
222
|
-
lastShownItemIndex = Math.min( // Also guards against index overflow.
|
|
223
|
-
lastShownItemIndex, // The index of the last item in the row.
|
|
224
|
-
Math.ceil(maxAllowedLastShownItemIndex / columnsCount) * columnsCount - 1);
|
|
538
|
+
if (findFirstShownItemIndex) {
|
|
539
|
+
warn('The list is supposed to be visible but no visible item has been found');
|
|
540
|
+
return null;
|
|
541
|
+
} else if (findLastShownItemIndex) {
|
|
542
|
+
return {
|
|
543
|
+
lastShownItemIndex: itemsCount - 1
|
|
544
|
+
};
|
|
225
545
|
}
|
|
226
|
-
|
|
227
|
-
return {
|
|
228
|
-
firstShownItemIndex: firstShownItemIndex,
|
|
229
|
-
lastShownItemIndex: lastShownItemIndex,
|
|
230
|
-
redoLayoutAfterMeasuringItemHeights: redoLayoutAfterMeasuringItemHeights
|
|
231
|
-
};
|
|
232
546
|
}
|
|
233
547
|
}, {
|
|
234
548
|
key: "getNonVisibleListShownItemIndexes",
|
|
235
549
|
value: function getNonVisibleListShownItemIndexes() {
|
|
236
|
-
|
|
550
|
+
var layout = {
|
|
237
551
|
firstShownItemIndex: 0,
|
|
238
|
-
lastShownItemIndex: 0
|
|
239
|
-
redoLayoutAfterMeasuringItemHeights: this.getItemHeight(0) === undefined
|
|
552
|
+
lastShownItemIndex: 0
|
|
240
553
|
};
|
|
241
|
-
}
|
|
242
|
-
}, {
|
|
243
|
-
key: "getItemIndexes",
|
|
244
|
-
value: function getItemIndexes(visibleAreaTop, visibleAreaBottom, listTopOffset, listHeight, itemsCount) {
|
|
245
|
-
var isVisible = listTopOffset + listHeight > visibleAreaTop && listTopOffset < visibleAreaBottom;
|
|
246
|
-
|
|
247
|
-
if (!isVisible) {
|
|
248
|
-
log('The entire list is off-screen. No items are visible.');
|
|
249
|
-
return;
|
|
250
|
-
} // Find the items which are displayed in the viewport.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var indexes = this.getVisibleItemIndexes(visibleAreaTop, visibleAreaBottom, listTopOffset, itemsCount); // The list height is estimated until all items have been seen,
|
|
254
|
-
// so it's possible that even when the list DOM element happens
|
|
255
|
-
// to be in the viewport, in reality the list isn't visible
|
|
256
|
-
// in which case `firstShownItemIndex` will be `undefined`.
|
|
257
554
|
|
|
258
|
-
if (
|
|
259
|
-
|
|
260
|
-
return;
|
|
555
|
+
if (this.getItemHeight(0) === undefined) {
|
|
556
|
+
layout.firstNonMeasuredItemIndex = 0;
|
|
261
557
|
}
|
|
262
558
|
|
|
263
|
-
return
|
|
559
|
+
return layout;
|
|
264
560
|
}
|
|
265
561
|
/**
|
|
266
562
|
* Measures "before" items height.
|
|
267
|
-
* @param {number}
|
|
268
|
-
* @param {number} lastShownItemIndex — New last shown item index.
|
|
563
|
+
* @param {number} beforeItemsCount — Basically, first shown item index.
|
|
269
564
|
* @return {number}
|
|
270
565
|
*/
|
|
271
566
|
|
|
272
567
|
}, {
|
|
273
568
|
key: "getBeforeItemsHeight",
|
|
274
|
-
value: function getBeforeItemsHeight(
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
|
|
569
|
+
value: function getBeforeItemsHeight(beforeItemsCount) {
|
|
570
|
+
var _ref9 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
571
|
+
beforeResize = _ref9.beforeResize;
|
|
572
|
+
|
|
573
|
+
// This function could potentially also use `this.getPreviouslyCalculatedLayout()`
|
|
574
|
+
// in order to skip calculating visible item indexes from scratch
|
|
575
|
+
// and instead just calculate the difference from a "previously calculated layout".
|
|
576
|
+
//
|
|
577
|
+
// I did a simple test in a web browser and found out that running the following
|
|
578
|
+
// piece of code is less than 10 milliseconds:
|
|
579
|
+
//
|
|
580
|
+
// var startedAt = Date.now()
|
|
581
|
+
// var i = 0
|
|
582
|
+
// while (i < 1000000) {
|
|
583
|
+
// i++
|
|
584
|
+
// }
|
|
585
|
+
// console.log(Date.now() - startedAt)
|
|
586
|
+
//
|
|
587
|
+
// Which becomes negligible in my project's use case (a couple thousands items max).
|
|
588
|
+
var beforeItemsHeight = 0;
|
|
589
|
+
var i = 0;
|
|
590
|
+
|
|
591
|
+
if (!beforeResize) {
|
|
592
|
+
var beforeResizeItemsCount = this.getBeforeResizeItemsCount();
|
|
593
|
+
|
|
594
|
+
if (beforeResizeItemsCount > 0) {
|
|
595
|
+
// First add all "before resize" item heights.
|
|
596
|
+
beforeItemsHeight = this.getBeforeItemsHeight( // `firstShownItemIndex` (called `beforeItemsCount`) could be greater than
|
|
597
|
+
// `beforeResizeItemsCount` when the user scrolls down.
|
|
598
|
+
// `firstShownItemIndex` (called `beforeItemsCount`) could be less than
|
|
599
|
+
// `beforeResizeItemsCount` when the user scrolls up.
|
|
600
|
+
Math.min(beforeItemsCount, beforeResizeItemsCount), {
|
|
601
|
+
beforeResize: true
|
|
602
|
+
});
|
|
603
|
+
i = beforeResizeItemsCount;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
278
606
|
|
|
279
|
-
var
|
|
607
|
+
var columnsCount = beforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount();
|
|
608
|
+
var verticalSpacing = beforeResize ? this.getVerticalSpacingBeforeResize() : this.getVerticalSpacing();
|
|
280
609
|
|
|
281
|
-
while (
|
|
610
|
+
while (i < beforeItemsCount) {
|
|
611
|
+
var currentRowFirstItemIndex = i;
|
|
282
612
|
var rowHeight = 0;
|
|
283
|
-
var columnIndex = 0;
|
|
613
|
+
var columnIndex = 0; // Not checking for `itemsCount` overflow here because `i = beforeItemsCount`
|
|
614
|
+
// can only start at the start of a row, meaning that when calculating
|
|
615
|
+
// "before items height" it's not supposed to add item heights from the
|
|
616
|
+
// last row of items because in that case it would have to iterate from
|
|
617
|
+
// `i === beforeItemsCount` and that condition is already checked above.
|
|
618
|
+
// while (i < itemsCount) {
|
|
284
619
|
|
|
285
620
|
while (columnIndex < columnsCount) {
|
|
286
|
-
|
|
621
|
+
var itemHeight = beforeResize ? this.getItemHeightBeforeResize(i) : this.getItemHeight(i);
|
|
622
|
+
|
|
623
|
+
if (itemHeight === undefined) {
|
|
624
|
+
// `itemHeight` can only be `undefined` when not `beforeResize`.
|
|
625
|
+
// Use the current "average item height" as a substitute.
|
|
626
|
+
itemHeight = this.getAverageItemHeight();
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
rowHeight = Math.max(rowHeight, itemHeight);
|
|
630
|
+
i++;
|
|
287
631
|
columnIndex++;
|
|
288
632
|
}
|
|
289
633
|
|
|
290
634
|
beforeItemsHeight += rowHeight;
|
|
291
|
-
beforeItemsHeight +=
|
|
292
|
-
rowIndex++;
|
|
635
|
+
beforeItemsHeight += verticalSpacing;
|
|
293
636
|
}
|
|
294
637
|
|
|
295
638
|
return beforeItemsHeight;
|
|
296
639
|
}
|
|
297
640
|
/**
|
|
298
641
|
* Measures "after" items height.
|
|
299
|
-
* @param {number}
|
|
300
|
-
* @param {number} lastShownItemIndex — New last shown item index.
|
|
301
|
-
* @param {number} averageItemHeight — Average item height.
|
|
302
|
-
* @param {number} verticalSpacing — Item vertical spacing.
|
|
642
|
+
* @param {number} lastShownItemIndex — Last shown item index.
|
|
303
643
|
* @param {number} itemsCount — Items count.
|
|
304
644
|
* @return {number}
|
|
305
645
|
*/
|
|
306
646
|
|
|
307
647
|
}, {
|
|
308
648
|
key: "getAfterItemsHeight",
|
|
309
|
-
value: function getAfterItemsHeight(
|
|
649
|
+
value: function getAfterItemsHeight(lastShownItemIndex, itemsCount) {
|
|
650
|
+
// This function could potentially also use `this.getPreviouslyCalculatedLayout()`
|
|
651
|
+
// in order to skip calculating visible item indexes from scratch
|
|
652
|
+
// and instead just calculate the difference from a "previously calculated layout".
|
|
653
|
+
//
|
|
654
|
+
// I did a simple test in a web browser and found out that running the following
|
|
655
|
+
// piece of code is less than 10 milliseconds:
|
|
656
|
+
//
|
|
657
|
+
// var startedAt = Date.now()
|
|
658
|
+
// var i = 0
|
|
659
|
+
// while (i < 1000000) {
|
|
660
|
+
// i++
|
|
661
|
+
// }
|
|
662
|
+
// console.log(Date.now() - startedAt)
|
|
663
|
+
//
|
|
664
|
+
// Which becomes negligible in my project's use case (a couple thousands items max).
|
|
310
665
|
var columnsCount = this.getColumnsCount();
|
|
311
|
-
var rowsCount = Math.ceil(itemsCount / columnsCount);
|
|
312
666
|
var lastShownRowIndex = Math.floor(lastShownItemIndex / columnsCount);
|
|
313
667
|
var afterItemsHeight = 0;
|
|
314
|
-
var
|
|
668
|
+
var i = lastShownItemIndex + 1;
|
|
315
669
|
|
|
316
|
-
while (
|
|
670
|
+
while (i < itemsCount) {
|
|
317
671
|
var rowHeight = 0;
|
|
318
672
|
var columnIndex = 0;
|
|
319
|
-
var i = void 0;
|
|
320
673
|
|
|
321
|
-
while (columnIndex < columnsCount &&
|
|
322
|
-
|
|
674
|
+
while (columnIndex < columnsCount && i < itemsCount) {
|
|
675
|
+
var itemHeight = this.getItemHeight(i);
|
|
676
|
+
|
|
677
|
+
if (itemHeight === undefined) {
|
|
678
|
+
itemHeight = this.getAverageItemHeight();
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
rowHeight = Math.max(rowHeight, itemHeight);
|
|
682
|
+
i++;
|
|
323
683
|
columnIndex++;
|
|
324
684
|
} // Add all "after" items height.
|
|
325
685
|
|
|
326
686
|
|
|
327
687
|
afterItemsHeight += this.getVerticalSpacing();
|
|
328
688
|
afterItemsHeight += rowHeight;
|
|
329
|
-
rowIndex++;
|
|
330
689
|
}
|
|
331
690
|
|
|
332
691
|
return afterItemsHeight;
|
|
333
692
|
}
|
|
334
693
|
/**
|
|
335
|
-
*
|
|
336
|
-
* @
|
|
694
|
+
* Returns the items's top offset relative to the top edge of the first item.
|
|
695
|
+
* @param {number} i — Item index
|
|
696
|
+
* @return {[number]} Returns `undefined` if any of the previous items haven't been rendered yet.
|
|
337
697
|
*/
|
|
338
698
|
|
|
339
699
|
}, {
|
|
340
|
-
key: "
|
|
341
|
-
value: function
|
|
342
|
-
var
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
700
|
+
key: "getItemTopOffset",
|
|
701
|
+
value: function getItemTopOffset(i) {
|
|
702
|
+
var topOffsetInsideScrollableContainer = 0;
|
|
703
|
+
var beforeResizeItemsCount = this.getBeforeResizeItemsCount();
|
|
704
|
+
var beforeResizeRowsCount = beforeResizeItemsCount === 0 ? 0 : Math.ceil(beforeResizeItemsCount / this.getColumnsCountBeforeResize());
|
|
705
|
+
var maxBeforeResizeRowsCount = i < beforeResizeItemsCount ? Math.floor(i / this.getColumnsCountBeforeResize()) : beforeResizeRowsCount;
|
|
706
|
+
var beforeResizeRowIndex = 0;
|
|
707
|
+
|
|
708
|
+
while (beforeResizeRowIndex < maxBeforeResizeRowsCount) {
|
|
709
|
+
var rowHeight = this.getItemHeightBeforeResize(beforeResizeRowIndex * this.getColumnsCountBeforeResize());
|
|
710
|
+
topOffsetInsideScrollableContainer += rowHeight;
|
|
711
|
+
topOffsetInsideScrollableContainer += this.getVerticalSpacingBeforeResize();
|
|
712
|
+
beforeResizeRowIndex++;
|
|
713
|
+
}
|
|
346
714
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
715
|
+
var itemRowIndex = Math.floor((i - beforeResizeItemsCount) / this.getColumnsCount());
|
|
716
|
+
var rowIndex = 0;
|
|
717
|
+
|
|
718
|
+
while (rowIndex < itemRowIndex) {
|
|
719
|
+
var _rowHeight = 0;
|
|
720
|
+
var columnIndex = 0;
|
|
721
|
+
|
|
722
|
+
while (columnIndex < this.getColumnsCount()) {
|
|
723
|
+
var itemHeight = this.getItemHeight(beforeResizeItemsCount + rowIndex * this.getColumnsCount() + columnIndex);
|
|
724
|
+
|
|
725
|
+
if (itemHeight === undefined) {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
_rowHeight = Math.max(_rowHeight, itemHeight);
|
|
730
|
+
columnIndex++;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
topOffsetInsideScrollableContainer += _rowHeight;
|
|
734
|
+
topOffsetInsideScrollableContainer += this.getVerticalSpacing();
|
|
735
|
+
rowIndex++;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
return topOffsetInsideScrollableContainer;
|
|
370
739
|
}
|
|
371
740
|
}]);
|
|
372
741
|
|
|
@@ -378,9 +747,11 @@ export var LAYOUT_REASON = {
|
|
|
378
747
|
SCROLL: 'scroll',
|
|
379
748
|
STOPPED_SCROLLING: 'stopped scrolling',
|
|
380
749
|
MANUAL: 'manual',
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
750
|
+
STARTED: 'started',
|
|
751
|
+
NON_MEASURED_ITEMS_HAVE_BEEN_MEASURED: 'non-measured item heights have been measured',
|
|
752
|
+
VIEWPORT_WIDTH_CHANGED: 'viewport width changed',
|
|
753
|
+
VIEWPORT_HEIGHT_CHANGED: 'viewport height changed',
|
|
754
|
+
VIEWPORT_SIZE_UNCHANGED: 'viewport size unchanged',
|
|
384
755
|
ITEM_HEIGHT_CHANGED: 'item height changed',
|
|
385
756
|
ITEMS_CHANGED: 'items changed',
|
|
386
757
|
TOP_OFFSET_CHANGED: 'list top offset changed'
|