@enact/ui 4.5.2 → 4.6.1
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/AnnounceDecorator/Announce.js +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +45 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/package.json +3 -0
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +24 -57
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +7 -29
- package/RadioDecorator/RadioDecorator.js +9 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +37 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +23 -45
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.js +16 -43
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.js +24 -57
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Pinch.js +185 -0
- package/Touchable/Touch.js +71 -76
- package/Touchable/Touchable.js +95 -75
- package/Touchable/config.js +27 -24
- package/Touchable/tests/Touchable-specs.js +360 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +57 -65
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.js +20 -84
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +265 -409
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +6 -20
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +9 -3
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
- package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
- package/BodyText/BodyText.d.ts +0 -66
- package/Button/Button.d.ts +0 -125
- package/Cancelable/Cancelable.d.ts +0 -64
- package/Changeable/Changeable.d.ts +0 -54
- package/ComponentOverride/ComponentOverride.d.ts +0 -52
- package/ForwardRef/ForwardRef.d.ts +0 -22
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/Group/Group.d.ts +0 -107
- package/Heading/Heading.d.ts +0 -90
- package/Icon/Icon.d.ts +0 -88
- package/IconButton/IconButton.d.ts +0 -115
- package/Image/Image.d.ts +0 -113
- package/ImageItem/ImageItem.d.ts +0 -83
- package/Item/Item.d.ts +0 -64
- package/LabeledIcon/LabeledIcon.d.ts +0 -130
- package/Layout/Layout.d.ts +0 -247
- package/Marquee/index.d.ts +0 -258
- package/Measurable/Measurable.d.ts +0 -26
- package/Media/Media.d.ts +0 -99
- package/Placeholder/index.d.ts +0 -53
- package/ProgressBar/ProgressBar.d.ts +0 -92
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/Repeater/Repeater.d.ts +0 -83
- package/Resizable/Resizable.d.ts +0 -31
- package/Routable/Routable.d.ts +0 -148
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scroller/Scroller.d.ts +0 -276
- package/Skinnable/Skinnable.d.ts +0 -94
- package/Slider/Slider.d.ts +0 -202
- package/SlotItem/SlotItem.d.ts +0 -118
- package/Slottable/Slottable.d.ts +0 -22
- package/Spinner/Spinner.d.ts +0 -95
- package/ToggleIcon/ToggleIcon.d.ts +0 -90
- package/ToggleItem/ToggleItem.d.ts +0 -134
- package/Toggleable/Toggleable.d.ts +0 -103
- package/Touchable/Touchable.d.ts +0 -175
- package/Transition/Transition.d.ts +0 -196
- package/ViewManager/ViewManager.d.ts +0 -191
- package/VirtualList/VirtualList.d.ts +0 -530
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/localized-fonts/localized-fonts.d.ts +0 -53
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/resolution/index.d.ts +0 -187
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useScroll/useScroll.d.ts +0 -0
|
@@ -4,77 +4,44 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.itemSizesShape = exports.gridListItemSizeShape = exports["default"] = exports.VirtualListBasic = void 0;
|
|
7
|
-
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
11
|
-
|
|
12
9
|
var _handle = require("@enact/core/handle");
|
|
13
|
-
|
|
14
10
|
var _platform = require("@enact/core/platform");
|
|
15
|
-
|
|
16
11
|
var _util = require("@enact/core/util");
|
|
17
|
-
|
|
18
12
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
13
|
var _equals = _interopRequireDefault(require("ramda/src/equals"));
|
|
21
|
-
|
|
22
14
|
var _react = require("react");
|
|
23
|
-
|
|
24
15
|
var _VirtualListModule = _interopRequireDefault(require("./VirtualList.module.css"));
|
|
25
|
-
|
|
26
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
-
|
|
28
17
|
var _excluded = ["className", "containerProps", "placeholderRenderer", "role", "style", "scrollMode"];
|
|
29
|
-
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
|
-
|
|
32
19
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
33
|
-
|
|
34
20
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
35
|
-
|
|
36
21
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
|
-
|
|
38
22
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
39
|
-
|
|
40
23
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
|
-
|
|
42
24
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
43
|
-
|
|
44
25
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
45
|
-
|
|
46
26
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
47
|
-
|
|
48
27
|
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; }
|
|
49
|
-
|
|
50
28
|
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; }
|
|
51
|
-
|
|
52
29
|
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; }
|
|
53
|
-
|
|
54
30
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
55
|
-
|
|
56
31
|
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); } }
|
|
57
|
-
|
|
58
32
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
59
|
-
|
|
60
33
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
61
|
-
|
|
62
34
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
63
|
-
|
|
64
35
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
65
|
-
|
|
66
36
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
67
|
-
|
|
68
37
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
69
|
-
|
|
70
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
71
|
-
|
|
72
39
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
73
|
-
|
|
74
40
|
var nop = function nop() {};
|
|
41
|
+
|
|
75
42
|
/**
|
|
76
43
|
* The shape for the grid list item size
|
|
77
|
-
* in a list for
|
|
44
|
+
* in a list for {@link ui/VirtualList.VirtualGridList|VirtualGridList}.
|
|
78
45
|
*
|
|
79
46
|
* @typedef {Object} gridListItemSizeShape
|
|
80
47
|
* @memberof ui/VirtualList
|
|
@@ -82,15 +49,14 @@ var nop = function nop() {};
|
|
|
82
49
|
* @property {Number} minHeight The minimum height of the grid list item.
|
|
83
50
|
* @public
|
|
84
51
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
52
|
var gridListItemSizeShape = _propTypes2["default"].shape({
|
|
88
53
|
minHeight: _propTypes2["default"].number.isRequired,
|
|
89
54
|
minWidth: _propTypes2["default"].number.isRequired
|
|
90
55
|
});
|
|
56
|
+
|
|
91
57
|
/**
|
|
92
58
|
* The shape for the list different item size
|
|
93
|
-
* in a list for
|
|
59
|
+
* in a list for {@link ui/VirtualList.VirtualList|VirtualList}.
|
|
94
60
|
*
|
|
95
61
|
* @typedef {Object} itemSizesShape
|
|
96
62
|
* @memberof ui/VirtualList
|
|
@@ -98,37 +64,28 @@ var gridListItemSizeShape = _propTypes2["default"].shape({
|
|
|
98
64
|
* @property {Number[]} size An array of the list item size. If it is not defined, the list items will render with the `minSize` size.
|
|
99
65
|
* @public
|
|
100
66
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
67
|
exports.gridListItemSizeShape = gridListItemSizeShape;
|
|
104
|
-
|
|
105
68
|
var itemSizesShape = _propTypes2["default"].shape({
|
|
106
69
|
minSize: _propTypes2["default"].number.isRequired,
|
|
107
70
|
size: _propTypes2["default"].arrayOf(_propTypes2["default"].number)
|
|
108
71
|
});
|
|
72
|
+
|
|
109
73
|
/**
|
|
110
74
|
* A basic base component for
|
|
111
|
-
*
|
|
75
|
+
* {@link ui/VirtualList.VirtualList|VirtualList} and {@link ui/VirtualList.VirtualGridList|VirtualGridList}.
|
|
112
76
|
*
|
|
113
77
|
* @class VirtualListBasic
|
|
114
78
|
* @memberof ui/VirtualList
|
|
115
79
|
* @ui
|
|
116
80
|
* @public
|
|
117
81
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
82
|
exports.itemSizesShape = itemSizesShape;
|
|
121
|
-
|
|
122
83
|
var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
123
84
|
_inherits(VirtualListBasic, _Component);
|
|
124
|
-
|
|
125
85
|
var _super = _createSuper(VirtualListBasic);
|
|
126
|
-
|
|
127
86
|
function VirtualListBasic(_props) {
|
|
128
87
|
var _this;
|
|
129
|
-
|
|
130
88
|
_classCallCheck(this, VirtualListBasic);
|
|
131
|
-
|
|
132
89
|
var nextState = null;
|
|
133
90
|
_this = _super.call(this, _props);
|
|
134
91
|
_this.displayName = 'ui:VirtualListBasic';
|
|
@@ -160,70 +117,53 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
160
117
|
_this.scrollToPositionTarget = -1;
|
|
161
118
|
_this.itemPositions = [];
|
|
162
119
|
_this.indexToScrollIntoView = -1;
|
|
163
|
-
|
|
164
120
|
_this.updateScrollPosition = function (_ref, behavior) {
|
|
165
121
|
var x = _ref.x,
|
|
166
|
-
|
|
167
|
-
|
|
122
|
+
y = _ref.y;
|
|
168
123
|
if (_this.props.scrollMode === 'native') {
|
|
169
124
|
_this.scrollToPosition(x, y, behavior);
|
|
170
125
|
} else {
|
|
171
126
|
_this.setScrollPositionTarget(x, y);
|
|
172
|
-
|
|
173
127
|
_this.setScrollPosition(x, y);
|
|
174
128
|
}
|
|
175
129
|
};
|
|
176
|
-
|
|
177
130
|
_this.isVertical = function () {
|
|
178
131
|
return _this.isPrimaryDirectionVertical;
|
|
179
132
|
};
|
|
180
|
-
|
|
181
133
|
_this.isHorizontal = function () {
|
|
182
134
|
return !_this.isPrimaryDirectionVertical;
|
|
183
135
|
};
|
|
184
|
-
|
|
185
136
|
_this.getScrollBounds = function () {
|
|
186
137
|
return _this.scrollBounds;
|
|
187
138
|
};
|
|
188
|
-
|
|
189
139
|
_this.getMoreInfo = function () {
|
|
190
140
|
return _this.moreInfo;
|
|
191
141
|
};
|
|
192
|
-
|
|
193
142
|
_this.getCenterItemIndexFromScrollPosition = function (scrollPosition) {
|
|
194
143
|
return Math.floor((scrollPosition + _this.primary.clientSize / 2) / _this.primary.gridSize) * _this.dimensionToExtent + Math.floor(_this.dimensionToExtent / 2);
|
|
195
144
|
};
|
|
196
|
-
|
|
197
145
|
_this.getItemBottomPosition = function (index) {
|
|
198
146
|
var itemPosition = _this.itemPositions[index],
|
|
199
|
-
|
|
200
|
-
|
|
147
|
+
itemSize = _this.props.itemSizes[index];
|
|
201
148
|
if (itemPosition && (itemSize || itemSize === 0)) {
|
|
202
149
|
return itemPosition.position + itemSize;
|
|
203
150
|
} else {
|
|
204
151
|
return index * _this.primary.gridSize - _this.props.spacing;
|
|
205
152
|
}
|
|
206
153
|
};
|
|
207
|
-
|
|
208
154
|
_this.getItemTopPositionFromPreviousItemBottomPosition = function (index, spacing) {
|
|
209
155
|
return index === 0 ? 0 : _this.getItemBottomPosition(index - 1) + spacing;
|
|
210
156
|
};
|
|
211
|
-
|
|
212
157
|
_this.getItemPosition = function (index) {
|
|
213
158
|
var stickTo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'start';
|
|
214
159
|
var optionalOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
215
|
-
|
|
216
160
|
var _assertThisInitialize = _assertThisInitialized(_this),
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
161
|
+
isPrimaryDirectionVertical = _assertThisInitialize.isPrimaryDirectionVertical,
|
|
162
|
+
primary = _assertThisInitialize.primary,
|
|
163
|
+
scrollBounds = _assertThisInitialize.scrollBounds;
|
|
221
164
|
var maxPos = isPrimaryDirectionVertical ? scrollBounds.maxTop : scrollBounds.maxLeft;
|
|
222
|
-
|
|
223
165
|
var position = _this.getGridPosition(index);
|
|
224
|
-
|
|
225
166
|
var offset = 0;
|
|
226
|
-
|
|
227
167
|
if (stickTo === 'start') {
|
|
228
168
|
offset = optionalOffset;
|
|
229
169
|
} else if (_this.props.itemSizes) {
|
|
@@ -233,14 +173,12 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
233
173
|
} else {
|
|
234
174
|
offset = primary.clientSize - primary.itemSize - optionalOffset;
|
|
235
175
|
}
|
|
236
|
-
|
|
237
176
|
position.primaryPosition = (0, _util.clamp)(0, maxPos, position.primaryPosition - offset);
|
|
238
177
|
return _this.gridPositionToItemPosition(position);
|
|
239
178
|
};
|
|
240
|
-
|
|
241
179
|
_this.gridPositionToItemPosition = function (_ref2) {
|
|
242
180
|
var primaryPosition = _ref2.primaryPosition,
|
|
243
|
-
|
|
181
|
+
secondaryPosition = _ref2.secondaryPosition;
|
|
244
182
|
return _this.isPrimaryDirectionVertical ? {
|
|
245
183
|
left: secondaryPosition,
|
|
246
184
|
top: primaryPosition
|
|
@@ -249,7 +187,6 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
249
187
|
top: secondaryPosition
|
|
250
188
|
};
|
|
251
189
|
};
|
|
252
|
-
|
|
253
190
|
_this.getXY = function (primaryPosition, secondaryPosition) {
|
|
254
191
|
return _this.isPrimaryDirectionVertical ? {
|
|
255
192
|
x: secondaryPosition,
|
|
@@ -259,45 +196,40 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
259
196
|
y: secondaryPosition
|
|
260
197
|
};
|
|
261
198
|
};
|
|
262
|
-
|
|
263
199
|
_this.getClientSize = function (node) {
|
|
264
200
|
return {
|
|
265
201
|
clientWidth: node.clientWidth,
|
|
266
202
|
clientHeight: node.clientHeight
|
|
267
203
|
};
|
|
268
204
|
};
|
|
269
|
-
|
|
270
205
|
_this.getStatesAndUpdateBounds = function (props) {
|
|
271
206
|
var firstIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
272
|
-
|
|
273
207
|
var dataSize = props.dataSize,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
208
|
+
overhang = props.overhang,
|
|
209
|
+
updateStatesAndBounds = props.updateStatesAndBounds,
|
|
210
|
+
_assertThisInitialize2 = _assertThisInitialized(_this),
|
|
211
|
+
dimensionToExtent = _assertThisInitialize2.dimensionToExtent,
|
|
212
|
+
primary = _assertThisInitialize2.primary,
|
|
213
|
+
moreInfo = _assertThisInitialize2.moreInfo,
|
|
214
|
+
scrollPosition = _assertThisInitialize2.scrollPosition,
|
|
215
|
+
numOfItems = Math.min(dataSize, dimensionToExtent * (Math.ceil(primary.clientSize / primary.gridSize) + overhang)),
|
|
216
|
+
wasFirstIndexMax = _this.maxFirstIndex < moreInfo.firstVisibleIndex - dimensionToExtent && firstIndex === _this.maxFirstIndex,
|
|
217
|
+
dataSizeDiff = dataSize - _this.curDataSize;
|
|
218
|
+
var newFirstIndex = firstIndex;
|
|
284
219
|
|
|
285
|
-
|
|
220
|
+
// When calling setState() except in didScroll(), `shouldUpdateBounds` should be `true`
|
|
286
221
|
// so that setState() in didScroll() could be called to override state.
|
|
287
222
|
// Before calling setState() except in didScroll(), getStatesAndUpdateBounds() is always called.
|
|
288
223
|
// So `shouldUpdateBounds` is true here.
|
|
289
|
-
|
|
290
224
|
_this.shouldUpdateBounds = true;
|
|
291
225
|
_this.maxFirstIndex = Math.ceil((dataSize - numOfItems) / dimensionToExtent) * dimensionToExtent;
|
|
292
|
-
_this.curDataSize = dataSize;
|
|
226
|
+
_this.curDataSize = dataSize;
|
|
293
227
|
|
|
228
|
+
// reset children
|
|
294
229
|
_this.cc = [];
|
|
295
230
|
_this.itemPositions = []; // For individually sized item
|
|
296
|
-
|
|
297
231
|
_this.calculateScrollBounds(props);
|
|
298
|
-
|
|
299
232
|
_this.updateMoreInfo(dataSize, scrollPosition);
|
|
300
|
-
|
|
301
233
|
if (!(updateStatesAndBounds && updateStatesAndBounds({
|
|
302
234
|
cbScrollTo: props.cbScrollTo,
|
|
303
235
|
numOfItems: numOfItems,
|
|
@@ -306,52 +238,44 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
306
238
|
}))) {
|
|
307
239
|
newFirstIndex = _this.calculateFirstIndex(props, wasFirstIndexMax, dataSizeDiff, firstIndex);
|
|
308
240
|
}
|
|
309
|
-
|
|
310
241
|
return {
|
|
311
242
|
firstIndex: Math.min(newFirstIndex, _this.maxFirstIndex),
|
|
312
243
|
numOfItems: numOfItems
|
|
313
244
|
};
|
|
314
245
|
};
|
|
315
|
-
|
|
316
246
|
_this.setContainerSize = function () {
|
|
317
247
|
if (_this.contentRef.current) {
|
|
318
248
|
_this.contentRef.current.style.width = _this.scrollBounds.scrollWidth + (_this.isPrimaryDirectionVertical ? -1 : 0) + 'px';
|
|
319
249
|
_this.contentRef.current.style.height = _this.scrollBounds.scrollHeight + (_this.isPrimaryDirectionVertical ? 0 : -1) + 'px';
|
|
320
250
|
}
|
|
321
251
|
};
|
|
322
|
-
|
|
323
252
|
_this.getRtlPositionX = function (x) {
|
|
324
253
|
if (_this.props.rtl) {
|
|
325
254
|
return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
|
|
326
255
|
}
|
|
327
|
-
|
|
328
256
|
return x;
|
|
329
257
|
};
|
|
330
|
-
|
|
331
258
|
_this.applyStyleToNewNode = function (index) {
|
|
332
259
|
var _this2;
|
|
333
|
-
|
|
334
260
|
var _this$props = _this.props,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
261
|
+
childProps = _this$props.childProps,
|
|
262
|
+
itemRefs = _this$props.itemRefs,
|
|
263
|
+
itemRenderer = _this$props.itemRenderer,
|
|
264
|
+
getComponentProps = _this$props.getComponentProps,
|
|
265
|
+
key = index % _this.state.numOfItems,
|
|
266
|
+
componentProps = getComponentProps && getComponentProps(index) || {},
|
|
267
|
+
itemContainerRef = function itemContainerRef(ref) {
|
|
268
|
+
if (ref === null) {
|
|
269
|
+
itemRefs.current[key] = ref;
|
|
270
|
+
} else {
|
|
271
|
+
var itemNode = ref.children[0];
|
|
272
|
+
itemRefs.current[key] = parseInt(itemNode.dataset.index) === index ? itemNode : ref.querySelector("[data-index=\"".concat(index, "\"]"));
|
|
273
|
+
_this.itemContainerRefs[key] = ref;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
351
276
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
352
277
|
rest[_key - 1] = arguments[_key];
|
|
353
278
|
}
|
|
354
|
-
|
|
355
279
|
_this.cc[key] = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
356
280
|
className: _VirtualListModule["default"].listItem,
|
|
357
281
|
ref: itemContainerRef,
|
|
@@ -361,14 +285,12 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
361
285
|
}))
|
|
362
286
|
}, key);
|
|
363
287
|
};
|
|
364
|
-
|
|
365
288
|
_this.applyStyleToHideNode = function (index) {
|
|
366
289
|
var itemRefs = _this.props.itemRefs,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
290
|
+
key = index % _this.state.numOfItems,
|
|
291
|
+
itemContainerRef = function itemContainerRef() {
|
|
292
|
+
return itemRefs.current[key] = null;
|
|
293
|
+
};
|
|
372
294
|
_this.cc[key] = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
373
295
|
ref: itemContainerRef,
|
|
374
296
|
style: {
|
|
@@ -376,15 +298,12 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
376
298
|
}
|
|
377
299
|
}, key);
|
|
378
300
|
};
|
|
379
|
-
|
|
380
301
|
_this.getScrollHeight = function () {
|
|
381
302
|
return _this.isPrimaryDirectionVertical ? _this.getVirtualScrollDimension() + _this.props.getAffordance() : _this.scrollBounds.clientHeight;
|
|
382
303
|
};
|
|
383
|
-
|
|
384
304
|
_this.getScrollWidth = function () {
|
|
385
305
|
return _this.isPrimaryDirectionVertical ? _this.scrollBounds.clientWidth : _this.getVirtualScrollDimension();
|
|
386
306
|
};
|
|
387
|
-
|
|
388
307
|
_this.getVirtualScrollDimension = function () {
|
|
389
308
|
if (_this.props.itemSizes) {
|
|
390
309
|
return _this.props.itemSizes.reduce(function (total, size, index) {
|
|
@@ -392,52 +311,39 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
392
311
|
}, 0);
|
|
393
312
|
} else {
|
|
394
313
|
var _assertThisInitialize3 = _assertThisInitialized(_this),
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
314
|
+
dimensionToExtent = _assertThisInitialize3.dimensionToExtent,
|
|
315
|
+
primary = _assertThisInitialize3.primary,
|
|
316
|
+
curDataSize = _assertThisInitialize3.curDataSize,
|
|
317
|
+
spacing = _this.props.spacing;
|
|
400
318
|
return Math.ceil(curDataSize / dimensionToExtent) * primary.gridSize - spacing;
|
|
401
319
|
}
|
|
402
320
|
};
|
|
403
|
-
|
|
404
321
|
_this.syncClientSize = function () {
|
|
405
322
|
var _assertThisInitialize4 = _assertThisInitialized(_this),
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
323
|
+
props = _assertThisInitialize4.props,
|
|
324
|
+
node = _this.props.scrollContentRef.current;
|
|
409
325
|
if (!props.clientSize && !node) {
|
|
410
326
|
return false;
|
|
411
327
|
}
|
|
412
|
-
|
|
413
328
|
var _ref3 = props.clientSize || _this.getClientSize(node),
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
329
|
+
clientWidth = _ref3.clientWidth,
|
|
330
|
+
clientHeight = _ref3.clientHeight,
|
|
331
|
+
_assertThisInitialize5 = _assertThisInitialized(_this),
|
|
332
|
+
scrollBounds = _assertThisInitialize5.scrollBounds;
|
|
419
333
|
if (clientWidth !== scrollBounds.clientWidth || clientHeight !== scrollBounds.clientHeight) {
|
|
420
334
|
_this.calculateMetrics(props);
|
|
421
|
-
|
|
422
335
|
_this.setState(_this.getStatesAndUpdateBounds(props));
|
|
423
|
-
|
|
424
336
|
_this.setContainerSize();
|
|
425
|
-
|
|
426
337
|
return true;
|
|
427
338
|
}
|
|
428
|
-
|
|
429
339
|
return false;
|
|
430
340
|
};
|
|
431
|
-
|
|
432
341
|
_this.contentRef = /*#__PURE__*/(0, _react.createRef)();
|
|
433
342
|
_this.itemContainerRefs = [];
|
|
434
|
-
|
|
435
343
|
if (_props.clientSize) {
|
|
436
344
|
_this.calculateMetrics(_props);
|
|
437
|
-
|
|
438
345
|
nextState = _this.getStatesAndUpdateBounds(_props);
|
|
439
346
|
}
|
|
440
|
-
|
|
441
347
|
_this.state = _objectSpread({
|
|
442
348
|
firstIndex: 0,
|
|
443
349
|
numOfItems: 0,
|
|
@@ -448,10 +354,10 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
448
354
|
}, nextState);
|
|
449
355
|
return _this;
|
|
450
356
|
}
|
|
451
|
-
|
|
452
357
|
_createClass(VirtualListBasic, [{
|
|
453
358
|
key: "componentDidMount",
|
|
454
|
-
value:
|
|
359
|
+
value:
|
|
360
|
+
// Calculate metrics for VirtualList after the 1st render to know client W/H.
|
|
455
361
|
function componentDidMount() {
|
|
456
362
|
if (!this.props.clientSize) {
|
|
457
363
|
this.calculateMetrics(this.props);
|
|
@@ -459,7 +365,6 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
459
365
|
} else {
|
|
460
366
|
this.emitUpdateItems();
|
|
461
367
|
}
|
|
462
|
-
|
|
463
368
|
if (this.props.itemSizes) {
|
|
464
369
|
this.adjustItemPositionWithItemSize();
|
|
465
370
|
} else {
|
|
@@ -471,19 +376,19 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
471
376
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
472
377
|
var deferScrollTo = false;
|
|
473
378
|
var _this$state = this.state,
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
this.shouldUpdateBounds = false;
|
|
379
|
+
firstIndex = _this$state.firstIndex,
|
|
380
|
+
numOfItems = _this$state.numOfItems;
|
|
381
|
+
this.shouldUpdateBounds = false;
|
|
477
382
|
|
|
383
|
+
// TODO: remove `this.hasDataSizeChanged` and fix useScroll
|
|
478
384
|
this.hasDataSizeChanged = prevProps.dataSize !== this.props.dataSize;
|
|
479
|
-
|
|
480
385
|
if (prevState.firstIndex !== firstIndex || prevState.numOfItems !== numOfItems) {
|
|
481
386
|
this.emitUpdateItems();
|
|
482
|
-
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// When an item expands or shrinks,
|
|
483
390
|
// we need to calculate the item position again and
|
|
484
391
|
// the item needs to scroll into view if the item does not show fully.
|
|
485
|
-
|
|
486
|
-
|
|
487
392
|
if (this.props.itemSizes) {
|
|
488
393
|
if (this.itemPositions.length > this.props.itemSizes.length) {
|
|
489
394
|
// The item with `this.props.itemSizes.length` index is not rendered yet.
|
|
@@ -495,19 +400,17 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
495
400
|
} else {
|
|
496
401
|
var indexToScrollIntoView = this.indexToScrollIntoView;
|
|
497
402
|
this.adjustItemPositionWithItemSize();
|
|
498
|
-
|
|
499
403
|
if (indexToScrollIntoView !== -1) {
|
|
500
404
|
// Currently we support expandable items in only vertical VirtualList.
|
|
501
405
|
// So the top and bottom of the boundaries are checked.
|
|
502
406
|
var scrollBounds = {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
407
|
+
top: this.scrollPosition,
|
|
408
|
+
bottom: this.scrollPosition + this.scrollBounds.clientHeight
|
|
409
|
+
},
|
|
410
|
+
itemBounds = {
|
|
411
|
+
top: this.getGridPosition(indexToScrollIntoView).primaryPosition,
|
|
412
|
+
bottom: this.getItemBottomPosition(indexToScrollIntoView)
|
|
413
|
+
};
|
|
511
414
|
if (itemBounds.top < scrollBounds.top) {
|
|
512
415
|
this.props.cbScrollTo({
|
|
513
416
|
index: indexToScrollIntoView,
|
|
@@ -522,24 +425,21 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
522
425
|
});
|
|
523
426
|
}
|
|
524
427
|
}
|
|
525
|
-
|
|
526
428
|
this.indexToScrollIntoView = -1;
|
|
527
429
|
}
|
|
528
430
|
}
|
|
529
|
-
|
|
530
431
|
if (prevProps.direction !== this.props.direction || prevProps.overhang !== this.props.overhang || prevProps.spacing !== this.props.spacing || !(0, _equals["default"])(prevProps.itemSize, this.props.itemSize)) {
|
|
531
432
|
var _this$getXY = this.getXY(this.scrollPosition, 0),
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
433
|
+
x = _this$getXY.x,
|
|
434
|
+
y = _this$getXY.y;
|
|
535
435
|
this.calculateMetrics(this.props);
|
|
536
436
|
this.setState(this.getStatesAndUpdateBounds(this.props));
|
|
537
437
|
this.setContainerSize();
|
|
538
438
|
var _this$scrollBounds = this.scrollBounds,
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
439
|
+
clientHeight = _this$scrollBounds.clientHeight,
|
|
440
|
+
clientWidth = _this$scrollBounds.clientWidth,
|
|
441
|
+
scrollHeight = _this$scrollBounds.scrollHeight,
|
|
442
|
+
scrollWidth = _this$scrollBounds.scrollWidth;
|
|
543
443
|
var xMax = scrollWidth - clientWidth;
|
|
544
444
|
var yMax = scrollHeight - clientHeight;
|
|
545
445
|
this.updateScrollPosition({
|
|
@@ -555,14 +455,11 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
555
455
|
} else if (prevProps.rtl !== this.props.rtl) {
|
|
556
456
|
this.updateScrollPosition(this.getXY(this.scrollPosition, 0), 'instant');
|
|
557
457
|
}
|
|
558
|
-
|
|
559
458
|
var maxPos = this.isPrimaryDirectionVertical ? this.scrollBounds.maxTop : this.scrollBounds.maxLeft;
|
|
560
459
|
var currentPos = this.scrollPosition;
|
|
561
|
-
|
|
562
460
|
if (this.props.scrollMode === 'native' && this.scrollToPositionTarget >= 0) {
|
|
563
461
|
currentPos = this.scrollToPositionTarget;
|
|
564
462
|
}
|
|
565
|
-
|
|
566
463
|
if (!deferScrollTo && currentPos > maxPos) {
|
|
567
464
|
this.props.cbScrollTo({
|
|
568
465
|
position: this.isPrimaryDirectionVertical ? {
|
|
@@ -579,26 +476,23 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
579
476
|
key: "getGridPosition",
|
|
580
477
|
value: function getGridPosition(index) {
|
|
581
478
|
var _this$props2 = this.props,
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
479
|
+
dataSize = _this$props2.dataSize,
|
|
480
|
+
itemSizes = _this$props2.itemSizes,
|
|
481
|
+
dimensionToExtent = this.dimensionToExtent,
|
|
482
|
+
itemPositions = this.itemPositions,
|
|
483
|
+
primary = this.primary,
|
|
484
|
+
secondary = this.secondary,
|
|
485
|
+
secondaryPosition = index % dimensionToExtent * secondary.gridSize,
|
|
486
|
+
extent = Math.floor(index / dimensionToExtent);
|
|
590
487
|
var primaryPosition;
|
|
591
|
-
|
|
592
488
|
if (itemSizes && typeof itemSizes[index] !== 'undefined' && dataSize > index) {
|
|
593
489
|
var firstIndexInExtent = extent * dimensionToExtent;
|
|
594
|
-
|
|
595
490
|
if (!itemPositions[firstIndexInExtent]) {
|
|
596
491
|
// Cache individually sized item positions
|
|
597
492
|
for (var i = itemPositions.length; i <= index; i++) {
|
|
598
493
|
this.calculateAndCacheItemPosition(i);
|
|
599
494
|
}
|
|
600
495
|
}
|
|
601
|
-
|
|
602
496
|
if (itemPositions[firstIndexInExtent]) {
|
|
603
497
|
primaryPosition = itemPositions[firstIndexInExtent].position;
|
|
604
498
|
} else {
|
|
@@ -607,20 +501,20 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
607
501
|
} else {
|
|
608
502
|
primaryPosition = extent * primary.gridSize;
|
|
609
503
|
}
|
|
610
|
-
|
|
611
504
|
return {
|
|
612
505
|
primaryPosition: primaryPosition,
|
|
613
506
|
secondaryPosition: secondaryPosition
|
|
614
507
|
};
|
|
615
|
-
}
|
|
508
|
+
}
|
|
616
509
|
|
|
510
|
+
// For individually sized item
|
|
617
511
|
}, {
|
|
618
512
|
key: "emitUpdateItems",
|
|
619
513
|
value: function emitUpdateItems() {
|
|
620
514
|
var dataSize = this.props.dataSize;
|
|
621
515
|
var _this$state2 = this.state,
|
|
622
|
-
|
|
623
|
-
|
|
516
|
+
firstIndex = _this$state2.firstIndex,
|
|
517
|
+
numOfItems = _this$state2.numOfItems;
|
|
624
518
|
(0, _handle.forward)('onUpdateItems', {
|
|
625
519
|
firstIndex: firstIndex,
|
|
626
520
|
lastIndex: Math.min(firstIndex + numOfItems, dataSize)
|
|
@@ -630,34 +524,30 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
630
524
|
key: "calculateMetrics",
|
|
631
525
|
value: function calculateMetrics(props) {
|
|
632
526
|
var clientSize = props.clientSize,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
527
|
+
direction = props.direction,
|
|
528
|
+
itemSize = props.itemSize,
|
|
529
|
+
overhang = props.overhang,
|
|
530
|
+
scrollMode = props.scrollMode,
|
|
531
|
+
spacing = props.spacing,
|
|
532
|
+
node = this.props.scrollContentRef.current;
|
|
640
533
|
if (!clientSize && !node) {
|
|
641
534
|
return;
|
|
642
535
|
}
|
|
643
|
-
|
|
644
536
|
var _ref4 = clientSize || this.getClientSize(node),
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
537
|
+
clientWidth = _ref4.clientWidth,
|
|
538
|
+
clientHeight = _ref4.clientHeight,
|
|
539
|
+
heightInfo = {
|
|
540
|
+
clientSize: clientHeight,
|
|
541
|
+
minItemSize: itemSize.minHeight || null,
|
|
542
|
+
itemSize: itemSize
|
|
543
|
+
},
|
|
544
|
+
widthInfo = {
|
|
545
|
+
clientSize: clientWidth,
|
|
546
|
+
minItemSize: itemSize.minWidth || null,
|
|
547
|
+
itemSize: itemSize
|
|
548
|
+
};
|
|
658
549
|
var primary, secondary, dimensionToExtent, thresholdBase;
|
|
659
550
|
this.isPrimaryDirectionVertical = direction === 'vertical';
|
|
660
|
-
|
|
661
551
|
if (this.isPrimaryDirectionVertical) {
|
|
662
552
|
primary = heightInfo;
|
|
663
553
|
secondary = widthInfo;
|
|
@@ -665,21 +555,18 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
665
555
|
primary = widthInfo;
|
|
666
556
|
secondary = heightInfo;
|
|
667
557
|
}
|
|
668
|
-
|
|
669
558
|
dimensionToExtent = 1;
|
|
670
559
|
this.isItemSized = primary.minItemSize && secondary.minItemSize;
|
|
671
|
-
|
|
672
560
|
if (this.isItemSized) {
|
|
673
561
|
// the number of columns is the ratio of the available width plus the spacing
|
|
674
562
|
// by the minimum item width plus the spacing
|
|
675
|
-
dimensionToExtent = Math.max(Math.floor((secondary.clientSize + spacing) / (secondary.minItemSize + spacing)), 1);
|
|
563
|
+
dimensionToExtent = Math.max(Math.floor((secondary.clientSize + spacing) / (secondary.minItemSize + spacing)), 1);
|
|
564
|
+
// the actual item width is a ratio of the remaining width after all columns
|
|
676
565
|
// and spacing are accounted for and the number of columns that we know we should have
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
566
|
+
secondary.itemSize = Math.floor((secondary.clientSize - spacing * (dimensionToExtent - 1)) / dimensionToExtent);
|
|
567
|
+
// the actual item height is related to the item width
|
|
680
568
|
primary.itemSize = Math.floor(primary.minItemSize * (secondary.itemSize / secondary.minItemSize));
|
|
681
569
|
}
|
|
682
|
-
|
|
683
570
|
primary.gridSize = primary.itemSize + spacing;
|
|
684
571
|
secondary.gridSize = secondary.itemSize + spacing;
|
|
685
572
|
thresholdBase = primary.gridSize * Math.ceil(overhang / 2);
|
|
@@ -690,11 +577,11 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
690
577
|
};
|
|
691
578
|
this.dimensionToExtent = dimensionToExtent;
|
|
692
579
|
this.primary = primary;
|
|
693
|
-
this.secondary = secondary;
|
|
580
|
+
this.secondary = secondary;
|
|
694
581
|
|
|
582
|
+
// reset
|
|
695
583
|
this.scrollPosition = 0;
|
|
696
584
|
this.scrollToPositionTarget = -1;
|
|
697
|
-
|
|
698
585
|
if (scrollMode === 'translate' && this.contentRef.current) {
|
|
699
586
|
this.contentRef.current.style.transform = null;
|
|
700
587
|
} else if (scrollMode === 'native' && node) {
|
|
@@ -705,16 +592,15 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
705
592
|
key: "calculateFirstIndex",
|
|
706
593
|
value: function calculateFirstIndex(props, wasFirstIndexMax, dataSizeDiff, firstIndex) {
|
|
707
594
|
var overhang = props.overhang,
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
595
|
+
dimensionToExtent = this.dimensionToExtent,
|
|
596
|
+
isPrimaryDirectionVertical = this.isPrimaryDirectionVertical,
|
|
597
|
+
maxFirstIndex = this.maxFirstIndex,
|
|
598
|
+
primary = this.primary,
|
|
599
|
+
scrollBounds = this.scrollBounds,
|
|
600
|
+
scrollPosition = this.scrollPosition,
|
|
601
|
+
threshold = this.threshold,
|
|
602
|
+
gridSize = primary.gridSize;
|
|
716
603
|
var newFirstIndex = firstIndex;
|
|
717
|
-
|
|
718
604
|
if (wasFirstIndexMax && dataSizeDiff > 0) {
|
|
719
605
|
// If dataSize increased from bottom, we need adjust firstIndex
|
|
720
606
|
// If this is a gridlist and dataSizeDiff is smaller than 1 line, we are adjusting firstIndex without threshold change.
|
|
@@ -723,15 +609,17 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
723
609
|
} else {
|
|
724
610
|
// For other bottom adding case, we need to update firstIndex and threshold.
|
|
725
611
|
var maxPos = isPrimaryDirectionVertical ? scrollBounds.maxTop : scrollBounds.maxLeft,
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
612
|
+
maxOfMin = maxPos - threshold.base,
|
|
613
|
+
numOfUpperLine = Math.floor(overhang / 2),
|
|
614
|
+
firstIndexFromPosition = Math.floor(scrollPosition / gridSize),
|
|
615
|
+
expectedFirstIndex = Math.max(0, firstIndexFromPosition - numOfUpperLine);
|
|
616
|
+
|
|
617
|
+
// To navigate with 5way, we need to adjust firstIndex to the next line
|
|
730
618
|
// since at the bottom we have num of overhang lines for upper side but none for bottom side
|
|
731
619
|
// So we add numOfUpperLine at the top and rest lines at the bottom
|
|
620
|
+
newFirstIndex = Math.min(maxFirstIndex, expectedFirstIndex * dimensionToExtent);
|
|
732
621
|
|
|
733
|
-
|
|
734
|
-
|
|
622
|
+
// We need to update threshold also since we moved the firstIndex
|
|
735
623
|
threshold.max = Math.min(maxPos, threshold.max + gridSize);
|
|
736
624
|
threshold.min = Math.min(maxOfMin, threshold.max - gridSize);
|
|
737
625
|
}
|
|
@@ -739,33 +627,30 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
739
627
|
// Other cases, we can keep the min value between firstIndex and maxFirstIndex. No need to change threshold
|
|
740
628
|
newFirstIndex = Math.min(firstIndex, maxFirstIndex);
|
|
741
629
|
}
|
|
742
|
-
|
|
743
630
|
return newFirstIndex;
|
|
744
631
|
}
|
|
745
632
|
}, {
|
|
746
633
|
key: "calculateScrollBounds",
|
|
747
634
|
value: function calculateScrollBounds(props) {
|
|
748
635
|
var clientSize = props.clientSize,
|
|
749
|
-
|
|
750
|
-
|
|
636
|
+
node = this.props.scrollContentRef.current;
|
|
751
637
|
if (!clientSize && !node) {
|
|
752
638
|
return;
|
|
753
639
|
}
|
|
754
|
-
|
|
755
640
|
var scrollBounds = this.scrollBounds,
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
641
|
+
isPrimaryDirectionVertical = this.isPrimaryDirectionVertical,
|
|
642
|
+
_ref5 = clientSize || this.getClientSize(node),
|
|
643
|
+
clientWidth = _ref5.clientWidth,
|
|
644
|
+
clientHeight = _ref5.clientHeight;
|
|
761
645
|
var maxPos;
|
|
762
646
|
scrollBounds.clientWidth = clientWidth;
|
|
763
647
|
scrollBounds.clientHeight = clientHeight;
|
|
764
648
|
scrollBounds.scrollWidth = this.getScrollWidth();
|
|
765
649
|
scrollBounds.scrollHeight = this.getScrollHeight();
|
|
766
650
|
scrollBounds.maxLeft = Math.max(0, scrollBounds.scrollWidth - clientWidth);
|
|
767
|
-
scrollBounds.maxTop = Math.max(0, scrollBounds.scrollHeight - clientHeight);
|
|
651
|
+
scrollBounds.maxTop = Math.max(0, scrollBounds.scrollHeight - clientHeight);
|
|
768
652
|
|
|
653
|
+
// correct position
|
|
769
654
|
maxPos = isPrimaryDirectionVertical ? scrollBounds.maxTop : scrollBounds.maxLeft;
|
|
770
655
|
this.syncThreshold(maxPos);
|
|
771
656
|
}
|
|
@@ -773,47 +658,42 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
773
658
|
key: "updateMoreInfo",
|
|
774
659
|
value: function updateMoreInfo(dataSize, primaryPosition) {
|
|
775
660
|
var dimensionToExtent = this.dimensionToExtent,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
661
|
+
moreInfo = this.moreInfo,
|
|
662
|
+
_this$primary = this.primary,
|
|
663
|
+
itemSize = _this$primary.itemSize,
|
|
664
|
+
gridSize = _this$primary.gridSize,
|
|
665
|
+
clientSize = _this$primary.clientSize;
|
|
782
666
|
if (dataSize <= 0) {
|
|
783
667
|
moreInfo.firstVisibleIndex = null;
|
|
784
668
|
moreInfo.lastVisibleIndex = null;
|
|
785
669
|
} else if (this.props.itemSizes) {
|
|
786
670
|
var _this$state3 = this.state,
|
|
787
|
-
|
|
788
|
-
|
|
671
|
+
firstIndex = _this$state3.firstIndex,
|
|
672
|
+
numOfItems = _this$state3.numOfItems;
|
|
789
673
|
var isPrimaryDirectionVertical = this.isPrimaryDirectionVertical,
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
674
|
+
_this$scrollBounds2 = this.scrollBounds,
|
|
675
|
+
clientWidth = _this$scrollBounds2.clientWidth,
|
|
676
|
+
clientHeight = _this$scrollBounds2.clientHeight,
|
|
677
|
+
scrollPosition = this.scrollPosition;
|
|
794
678
|
var size = isPrimaryDirectionVertical ? clientHeight : clientWidth;
|
|
795
679
|
var firstVisibleIndex = null,
|
|
796
|
-
|
|
797
|
-
|
|
680
|
+
lastVisibleIndex = null;
|
|
798
681
|
for (var i = firstIndex; i < firstIndex + numOfItems; i++) {
|
|
799
682
|
if (scrollPosition <= this.getItemBottomPosition(i)) {
|
|
800
683
|
firstVisibleIndex = i;
|
|
801
684
|
break;
|
|
802
685
|
}
|
|
803
686
|
}
|
|
804
|
-
|
|
805
687
|
for (var _i = firstIndex + numOfItems - 1; _i >= firstIndex; _i--) {
|
|
806
688
|
if (scrollPosition + size >= this.getItemBottomPosition(_i) - this.props.itemSizes[_i]) {
|
|
807
689
|
lastVisibleIndex = _i;
|
|
808
690
|
break;
|
|
809
691
|
}
|
|
810
692
|
}
|
|
811
|
-
|
|
812
693
|
if (firstVisibleIndex > lastVisibleIndex) {
|
|
813
694
|
firstVisibleIndex = null;
|
|
814
695
|
lastVisibleIndex = null;
|
|
815
696
|
}
|
|
816
|
-
|
|
817
697
|
moreInfo.firstVisibleIndex = firstVisibleIndex;
|
|
818
698
|
moreInfo.lastVisibleIndex = lastVisibleIndex;
|
|
819
699
|
} else {
|
|
@@ -825,7 +705,6 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
825
705
|
key: "syncThreshold",
|
|
826
706
|
value: function syncThreshold(maxPos) {
|
|
827
707
|
var threshold = this.threshold;
|
|
828
|
-
|
|
829
708
|
if (threshold.max > maxPos) {
|
|
830
709
|
if (maxPos < threshold.base) {
|
|
831
710
|
threshold.max = threshold.base;
|
|
@@ -835,11 +714,13 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
835
714
|
threshold.min = maxPos - threshold.base;
|
|
836
715
|
}
|
|
837
716
|
}
|
|
838
|
-
}
|
|
717
|
+
}
|
|
839
718
|
|
|
719
|
+
// scrollMode 'native' only
|
|
840
720
|
}, {
|
|
841
721
|
key: "scrollToPosition",
|
|
842
|
-
value:
|
|
722
|
+
value:
|
|
723
|
+
// scrollMode 'native' only
|
|
843
724
|
function scrollToPosition(left, top, behavior) {
|
|
844
725
|
if (this.props.scrollContentRef.current && this.props.scrollContentRef.current.scrollTo) {
|
|
845
726
|
this.props.scrollContentRef.current.scrollTo({
|
|
@@ -848,8 +729,9 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
848
729
|
behavior: behavior
|
|
849
730
|
});
|
|
850
731
|
}
|
|
851
|
-
}
|
|
732
|
+
}
|
|
852
733
|
|
|
734
|
+
// scrollMode 'native' only
|
|
853
735
|
}, {
|
|
854
736
|
key: "setScrollToPositionTarget",
|
|
855
737
|
value: function setScrollToPositionTarget(x, y) {
|
|
@@ -858,8 +740,9 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
858
740
|
} else {
|
|
859
741
|
this.scrollToPositionTarget = x;
|
|
860
742
|
}
|
|
861
|
-
}
|
|
743
|
+
}
|
|
862
744
|
|
|
745
|
+
// scrollMode 'translate' only
|
|
863
746
|
}, {
|
|
864
747
|
key: "setScrollPositionTarget",
|
|
865
748
|
value: function setScrollPositionTarget(x, y) {
|
|
@@ -871,13 +754,13 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
871
754
|
} else {
|
|
872
755
|
this.scrollPositionTarget = x;
|
|
873
756
|
}
|
|
874
|
-
}
|
|
757
|
+
}
|
|
875
758
|
|
|
759
|
+
// scrollMode 'translate' only
|
|
876
760
|
}, {
|
|
877
761
|
key: "setScrollPosition",
|
|
878
762
|
value: function setScrollPosition(x, y) {
|
|
879
763
|
var rtl = this.props.rtl;
|
|
880
|
-
|
|
881
764
|
if (this.contentRef.current) {
|
|
882
765
|
this.contentRef.current.style.transform = "translate3d(".concat(rtl ? x : -x, "px, -").concat(y, "px, 0)");
|
|
883
766
|
this.didScroll(x, y);
|
|
@@ -887,51 +770,48 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
887
770
|
key: "didScroll",
|
|
888
771
|
value: function didScroll(x, y) {
|
|
889
772
|
var _this$props3 = this.props,
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
773
|
+
dataSize = _this$props3.dataSize,
|
|
774
|
+
spacing = _this$props3.spacing,
|
|
775
|
+
itemSizes = _this$props3.itemSizes,
|
|
776
|
+
firstIndex = this.state.firstIndex,
|
|
777
|
+
isPrimaryDirectionVertical = this.isPrimaryDirectionVertical,
|
|
778
|
+
threshold = this.threshold,
|
|
779
|
+
dimensionToExtent = this.dimensionToExtent,
|
|
780
|
+
maxFirstIndex = this.maxFirstIndex,
|
|
781
|
+
scrollBounds = this.scrollBounds,
|
|
782
|
+
itemPositions = this.itemPositions,
|
|
783
|
+
_this$primary2 = this.primary,
|
|
784
|
+
clientSize = _this$primary2.clientSize,
|
|
785
|
+
gridSize = _this$primary2.gridSize,
|
|
786
|
+
maxPos = isPrimaryDirectionVertical ? scrollBounds.maxTop : scrollBounds.maxLeft;
|
|
904
787
|
var newFirstIndex = firstIndex,
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
788
|
+
index,
|
|
789
|
+
pos,
|
|
790
|
+
size,
|
|
791
|
+
itemPosition;
|
|
910
792
|
if (isPrimaryDirectionVertical) {
|
|
911
793
|
pos = y;
|
|
912
794
|
} else {
|
|
913
795
|
pos = x;
|
|
914
796
|
}
|
|
915
|
-
|
|
916
797
|
if (pos > threshold.max || pos < threshold.min) {
|
|
917
798
|
var newThresholdMin = -Infinity,
|
|
918
|
-
|
|
919
|
-
|
|
799
|
+
newThresholdMax = Infinity;
|
|
920
800
|
if (this.props.itemSizes) {
|
|
921
801
|
var overhangBefore = Math.floor(this.props.overhang / 2);
|
|
922
|
-
var firstRenderedIndex = -1;
|
|
802
|
+
var firstRenderedIndex = -1;
|
|
923
803
|
|
|
804
|
+
// find an item which is known as placed the first rendered item's position
|
|
924
805
|
for (index = 0; index < dataSize; index += dimensionToExtent) {
|
|
925
806
|
itemPosition = itemPositions[index];
|
|
926
807
|
size = itemSizes[index];
|
|
927
|
-
|
|
928
808
|
if (itemPosition && size && itemPosition.position + size >= pos && itemPosition.position <= pos + clientSize) {
|
|
929
809
|
firstRenderedIndex = index;
|
|
930
810
|
break;
|
|
931
811
|
}
|
|
932
|
-
}
|
|
933
|
-
|
|
812
|
+
}
|
|
934
813
|
|
|
814
|
+
// found an item which is visible within a current viewport
|
|
935
815
|
if (index < dataSize) {
|
|
936
816
|
if (itemPosition.position <= pos) {
|
|
937
817
|
newFirstIndex = firstRenderedIndex - overhangBefore * dimensionToExtent;
|
|
@@ -950,92 +830,87 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
950
830
|
newThresholdMin = (firstExtent + overhangBefore) * gridSize;
|
|
951
831
|
newThresholdMax = newThresholdMin + gridSize;
|
|
952
832
|
}
|
|
953
|
-
|
|
954
833
|
newFirstIndex = Math.max(0, Math.min(maxFirstIndex, newFirstIndex));
|
|
955
834
|
} else {
|
|
956
835
|
var _overhangBefore = Math.floor(this.props.overhang / 2),
|
|
957
|
-
|
|
958
|
-
|
|
836
|
+
_firstExtent = Math.max(0, Math.min(Math.floor(maxFirstIndex / dimensionToExtent), Math.floor((pos - gridSize * _overhangBefore) / gridSize)));
|
|
959
837
|
newFirstIndex = _firstExtent * dimensionToExtent;
|
|
960
838
|
newThresholdMin = (_firstExtent + _overhangBefore) * gridSize;
|
|
961
839
|
newThresholdMax = newThresholdMin + gridSize;
|
|
962
840
|
}
|
|
963
|
-
|
|
964
841
|
threshold.min = newFirstIndex === 0 ? -Infinity : newThresholdMin;
|
|
965
842
|
threshold.max = newFirstIndex === maxFirstIndex ? Infinity : newThresholdMax;
|
|
966
843
|
}
|
|
967
|
-
|
|
968
844
|
this.syncThreshold(maxPos);
|
|
969
845
|
this.scrollPosition = pos;
|
|
970
846
|
this.updateMoreInfo(dataSize, pos);
|
|
971
|
-
|
|
972
847
|
if (this.shouldUpdateBounds || firstIndex !== newFirstIndex) {
|
|
973
848
|
this.setState({
|
|
974
849
|
firstIndex: newFirstIndex
|
|
975
850
|
});
|
|
976
851
|
}
|
|
977
|
-
}
|
|
852
|
+
}
|
|
978
853
|
|
|
854
|
+
// For individually sized item
|
|
979
855
|
}, {
|
|
980
856
|
key: "calculateAndCacheItemPosition",
|
|
981
857
|
value: function calculateAndCacheItemPosition(index) {
|
|
982
858
|
var itemSizes = this.props.itemSizes;
|
|
983
|
-
|
|
984
859
|
if (!this.itemPositions[index] && itemSizes[index]) {
|
|
985
860
|
var spacing = this.props.spacing,
|
|
986
|
-
|
|
861
|
+
position = this.getItemTopPositionFromPreviousItemBottomPosition(index, spacing);
|
|
987
862
|
this.itemPositions[index] = {
|
|
988
863
|
position: position
|
|
989
864
|
};
|
|
990
865
|
}
|
|
991
|
-
}
|
|
866
|
+
}
|
|
992
867
|
|
|
868
|
+
// For individually sized item
|
|
993
869
|
}, {
|
|
994
870
|
key: "applyItemPositionToDOMElement",
|
|
995
871
|
value: function applyItemPositionToDOMElement(index) {
|
|
996
872
|
var _this$props4 = this.props,
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
873
|
+
direction = _this$props4.direction,
|
|
874
|
+
rtl = _this$props4.rtl,
|
|
875
|
+
numOfItems = this.state.numOfItems,
|
|
876
|
+
itemPositions = this.itemPositions,
|
|
877
|
+
childNode = this.itemContainerRefs[index % numOfItems];
|
|
1003
878
|
if (childNode && itemPositions[index]) {
|
|
1004
879
|
var position = itemPositions[index].position;
|
|
1005
|
-
|
|
1006
880
|
if (direction === 'vertical') {
|
|
1007
881
|
childNode.style.transform = "translate3d(0, ".concat(position, "px, 0)");
|
|
1008
882
|
} else {
|
|
1009
883
|
childNode.style.transform = "translate3d(".concat(position * (rtl ? -1 : 1), "px, 0, 0)");
|
|
1010
884
|
}
|
|
1011
885
|
}
|
|
1012
|
-
}
|
|
886
|
+
}
|
|
1013
887
|
|
|
888
|
+
// For individually sized item
|
|
1014
889
|
}, {
|
|
1015
890
|
key: "updateThresholdWithItemPosition",
|
|
1016
891
|
value: function updateThresholdWithItemPosition() {
|
|
1017
892
|
var overhang = this.props.overhang,
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
893
|
+
firstIndex = this.state.firstIndex,
|
|
894
|
+
maxFirstIndex = this.maxFirstIndex,
|
|
895
|
+
numOfUpperLine = Math.floor(overhang / 2);
|
|
1021
896
|
this.threshold.min = firstIndex === 0 ? -Infinity : this.getItemBottomPosition(firstIndex + numOfUpperLine);
|
|
1022
897
|
this.threshold.max = firstIndex === maxFirstIndex ? Infinity : this.getItemBottomPosition(firstIndex + (numOfUpperLine + 1));
|
|
1023
|
-
}
|
|
898
|
+
}
|
|
1024
899
|
|
|
900
|
+
// For individually sized item
|
|
1025
901
|
}, {
|
|
1026
902
|
key: "updateScrollBoundsWithItemPositions",
|
|
1027
903
|
value: function updateScrollBoundsWithItemPositions() {
|
|
1028
904
|
var _this$props5 = this.props,
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
905
|
+
dataSize = _this$props5.dataSize,
|
|
906
|
+
itemSizes = _this$props5.itemSizes,
|
|
907
|
+
spacing = _this$props5.spacing,
|
|
908
|
+
_this$state4 = this.state,
|
|
909
|
+
firstIndex = _this$state4.firstIndex,
|
|
910
|
+
numOfItems = _this$state4.numOfItems,
|
|
911
|
+
isPrimaryDirectionVertical = this.isPrimaryDirectionVertical,
|
|
912
|
+
itemPositions = this.itemPositions,
|
|
913
|
+
scrollBoundsDimension = isPrimaryDirectionVertical ? 'scrollHeight' : 'scrollWidth';
|
|
1039
914
|
if (itemPositions.length === dataSize) {
|
|
1040
915
|
// all item sizes are known
|
|
1041
916
|
this.scrollBounds[scrollBoundsDimension] = itemSizes.reduce(function (acc, cur) {
|
|
@@ -1044,45 +919,46 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
1044
919
|
} else {
|
|
1045
920
|
for (var index = firstIndex + numOfItems - 1; index < dataSize; index++) {
|
|
1046
921
|
var nextInfo = itemPositions[index + 1];
|
|
1047
|
-
|
|
1048
922
|
if (!nextInfo) {
|
|
1049
923
|
var endPosition = this.getItemBottomPosition(index);
|
|
1050
|
-
|
|
1051
924
|
if (endPosition > this.scrollBounds[scrollBoundsDimension]) {
|
|
1052
925
|
this.scrollBounds[scrollBoundsDimension] = endPosition;
|
|
1053
926
|
}
|
|
1054
|
-
|
|
1055
927
|
break;
|
|
1056
928
|
}
|
|
1057
929
|
}
|
|
1058
930
|
}
|
|
1059
|
-
|
|
1060
931
|
this.scrollBounds.maxTop = Math.max(0, this.scrollBounds.scrollHeight - this.scrollBounds.clientHeight);
|
|
1061
|
-
}
|
|
932
|
+
}
|
|
1062
933
|
|
|
934
|
+
// For individually sized item
|
|
1063
935
|
}, {
|
|
1064
936
|
key: "adjustItemPositionWithItemSize",
|
|
1065
937
|
value: function adjustItemPositionWithItemSize() {
|
|
1066
938
|
if (this.cc.length) {
|
|
1067
939
|
var dataSize = this.props.dataSize,
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
// and adjust item DOM element positions
|
|
940
|
+
_this$state5 = this.state,
|
|
941
|
+
firstIndex = _this$state5.firstIndex,
|
|
942
|
+
numOfItems = _this$state5.numOfItems,
|
|
943
|
+
lastIndex = firstIndex + numOfItems - 1;
|
|
1073
944
|
|
|
945
|
+
// Cache individually sized item positions
|
|
946
|
+
// and adjust item DOM element positions
|
|
1074
947
|
for (var index = firstIndex; index <= lastIndex; index++) {
|
|
1075
948
|
this.calculateAndCacheItemPosition(index);
|
|
1076
949
|
this.applyItemPositionToDOMElement(index);
|
|
1077
|
-
}
|
|
1078
|
-
|
|
950
|
+
}
|
|
1079
951
|
|
|
1080
|
-
|
|
952
|
+
// Update threshold based on this.itemPositions
|
|
953
|
+
this.updateThresholdWithItemPosition();
|
|
1081
954
|
|
|
1082
|
-
|
|
955
|
+
// Update scroll bounds based on this.itemPositions
|
|
956
|
+
this.updateScrollBoundsWithItemPositions();
|
|
1083
957
|
|
|
1084
|
-
|
|
958
|
+
// Set container size based on this.scrollbounds
|
|
959
|
+
this.setContainerSize();
|
|
1085
960
|
|
|
961
|
+
// Update moreInfo based on this.itemPositions
|
|
1086
962
|
this.updateMoreInfo(dataSize, this.scrollPosition);
|
|
1087
963
|
}
|
|
1088
964
|
}
|
|
@@ -1090,61 +966,55 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
1090
966
|
key: "composeStyle",
|
|
1091
967
|
value: function composeStyle(width, height, primaryPosition, secondaryPosition) {
|
|
1092
968
|
var _this$getXY2 = this.getXY(primaryPosition, secondaryPosition),
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
969
|
+
x = _this$getXY2.x,
|
|
970
|
+
y = _this$getXY2.y,
|
|
971
|
+
style = {
|
|
972
|
+
/* FIXME: RTL / this calculation only works for Chrome */
|
|
973
|
+
transform: "translate3d(".concat(this.props.rtl ? -x : x, "px, ").concat(y, "px, 0)")
|
|
974
|
+
};
|
|
1100
975
|
if (this.isItemSized) {
|
|
1101
976
|
style.width = width;
|
|
1102
977
|
style.height = height;
|
|
1103
978
|
}
|
|
1104
|
-
|
|
1105
979
|
return style;
|
|
1106
980
|
}
|
|
1107
981
|
}, {
|
|
1108
982
|
key: "positionItems",
|
|
1109
983
|
value: function positionItems() {
|
|
1110
984
|
var _this$props6 = this.props,
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
985
|
+
dataSize = _this$props6.dataSize,
|
|
986
|
+
itemSizes = _this$props6.itemSizes,
|
|
987
|
+
_this$state6 = this.state,
|
|
988
|
+
firstIndex = _this$state6.firstIndex,
|
|
989
|
+
numOfItems = _this$state6.numOfItems,
|
|
990
|
+
cc = this.cc,
|
|
991
|
+
isPrimaryDirectionVertical = this.isPrimaryDirectionVertical,
|
|
992
|
+
dimensionToExtent = this.dimensionToExtent,
|
|
993
|
+
primary = this.primary,
|
|
994
|
+
secondary = this.secondary,
|
|
995
|
+
itemPositions = this.itemPositions;
|
|
1122
996
|
var hideTo = 0,
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
997
|
+
updateFrom = cc.length ? this.state.updateFrom : firstIndex,
|
|
998
|
+
updateTo = cc.length ? this.state.updateTo : firstIndex + numOfItems;
|
|
1126
999
|
if (updateFrom >= updateTo) {
|
|
1127
1000
|
return;
|
|
1128
1001
|
} else if (updateTo > dataSize) {
|
|
1129
1002
|
hideTo = updateTo;
|
|
1130
1003
|
updateTo = dataSize;
|
|
1131
1004
|
}
|
|
1132
|
-
|
|
1133
1005
|
var width,
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1006
|
+
height,
|
|
1007
|
+
_this$getGridPosition = this.getGridPosition(updateFrom),
|
|
1008
|
+
primaryPosition = _this$getGridPosition.primaryPosition,
|
|
1009
|
+
secondaryPosition = _this$getGridPosition.secondaryPosition;
|
|
1139
1010
|
width = (isPrimaryDirectionVertical ? secondary.itemSize : primary.itemSize) + 'px';
|
|
1140
|
-
height = (isPrimaryDirectionVertical ? primary.itemSize : secondary.itemSize) + 'px';
|
|
1011
|
+
height = (isPrimaryDirectionVertical ? primary.itemSize : secondary.itemSize) + 'px';
|
|
1141
1012
|
|
|
1013
|
+
// positioning items
|
|
1142
1014
|
for (var i = updateFrom, j = updateFrom % dimensionToExtent; i < updateTo; i++) {
|
|
1143
1015
|
this.applyStyleToNewNode(i, width, height, primaryPosition, secondaryPosition);
|
|
1144
|
-
|
|
1145
1016
|
if (++j === dimensionToExtent) {
|
|
1146
1017
|
secondaryPosition = 0;
|
|
1147
|
-
|
|
1148
1018
|
if (this.props.itemSizes) {
|
|
1149
1019
|
if (itemPositions[i + 1] || itemPositions[i + 1] === 0) {
|
|
1150
1020
|
primaryPosition = itemPositions[i + 1].position;
|
|
@@ -1156,36 +1026,35 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
1156
1026
|
} else {
|
|
1157
1027
|
primaryPosition += primary.gridSize;
|
|
1158
1028
|
}
|
|
1159
|
-
|
|
1160
1029
|
j = 0;
|
|
1161
1030
|
} else {
|
|
1162
1031
|
secondaryPosition += secondary.gridSize;
|
|
1163
1032
|
}
|
|
1164
1033
|
}
|
|
1165
|
-
|
|
1166
1034
|
for (var _i2 = updateTo; _i2 < hideTo; _i2++) {
|
|
1167
1035
|
this.applyStyleToHideNode(_i2);
|
|
1168
1036
|
}
|
|
1169
1037
|
}
|
|
1170
1038
|
}, {
|
|
1171
1039
|
key: "render",
|
|
1172
|
-
value:
|
|
1040
|
+
value:
|
|
1041
|
+
// render
|
|
1042
|
+
|
|
1173
1043
|
function render() {
|
|
1174
1044
|
var _this$props7 = this.props,
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1045
|
+
className = _this$props7.className,
|
|
1046
|
+
containerProps = _this$props7.containerProps,
|
|
1047
|
+
placeholderRenderer = _this$props7.placeholderRenderer,
|
|
1048
|
+
role = _this$props7.role,
|
|
1049
|
+
style = _this$props7.style,
|
|
1050
|
+
scrollMode = _this$props7.scrollMode,
|
|
1051
|
+
rest = _objectWithoutProperties(_this$props7, _excluded),
|
|
1052
|
+
cc = this.cc,
|
|
1053
|
+
isPrimaryDirectionVertical = this.isPrimaryDirectionVertical,
|
|
1054
|
+
primary = this.primary,
|
|
1055
|
+
scrollModeNative = scrollMode === 'native',
|
|
1056
|
+
containerClasses = (0, _classnames["default"])(_VirtualListModule["default"].virtualList, isPrimaryDirectionVertical ? _VirtualListModule["default"].vertical : _VirtualListModule["default"].horizontal, _defineProperty({}, _VirtualListModule["default"]["native"], scrollModeNative), className),
|
|
1057
|
+
contentClasses = scrollModeNative ? null : _VirtualListModule["default"].content;
|
|
1189
1058
|
delete rest.cbScrollTo;
|
|
1190
1059
|
delete rest.childProps;
|
|
1191
1060
|
delete rest.clientSize;
|
|
@@ -1210,11 +1079,9 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
1210
1079
|
delete rest.setThemeScrollContentHandle;
|
|
1211
1080
|
delete rest.spacing;
|
|
1212
1081
|
delete rest.updateStatesAndBounds;
|
|
1213
|
-
|
|
1214
1082
|
if (primary) {
|
|
1215
1083
|
this.positionItems();
|
|
1216
1084
|
}
|
|
1217
|
-
|
|
1218
1085
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
|
|
1219
1086
|
className: containerClasses
|
|
1220
1087
|
}, containerProps), {}, {
|
|
@@ -1232,27 +1099,23 @@ var VirtualListBasic = /*#__PURE__*/function (_Component) {
|
|
|
1232
1099
|
key: "getDerivedStateFromProps",
|
|
1233
1100
|
value: function getDerivedStateFromProps(props, state) {
|
|
1234
1101
|
var shouldInvalidate = state.prevFirstIndex === state.firstIndex || state.prevChildProps !== props.childProps,
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1102
|
+
diff = state.firstIndex - state.prevFirstIndex,
|
|
1103
|
+
updateTo = -state.numOfItems >= diff || diff > 0 || shouldInvalidate ? state.firstIndex + state.numOfItems : state.prevFirstIndex,
|
|
1104
|
+
updateFrom = 0 >= diff || diff >= state.numOfItems || shouldInvalidate ? state.firstIndex : state.prevFirstIndex + state.numOfItems,
|
|
1105
|
+
nextUpdateFromAndTo = state.updateFrom !== updateFrom || state.updateTo !== updateTo ? {
|
|
1106
|
+
updateFrom: updateFrom,
|
|
1107
|
+
updateTo: updateTo
|
|
1108
|
+
} : null;
|
|
1242
1109
|
return _objectSpread(_objectSpread({}, nextUpdateFromAndTo), {}, {
|
|
1243
1110
|
prevChildProps: props.childProps,
|
|
1244
1111
|
prevFirstIndex: state.firstIndex
|
|
1245
1112
|
});
|
|
1246
1113
|
}
|
|
1247
1114
|
}]);
|
|
1248
|
-
|
|
1249
1115
|
return VirtualListBasic;
|
|
1250
1116
|
}(_react.Component);
|
|
1251
|
-
|
|
1252
1117
|
exports.VirtualListBasic = VirtualListBasic;
|
|
1253
|
-
VirtualListBasic.propTypes =
|
|
1254
|
-
/** @lends ui/VirtualList.VirtualListBasic.prototype */
|
|
1255
|
-
{
|
|
1118
|
+
VirtualListBasic.propTypes = /** @lends ui/VirtualList.VirtualListBasic.prototype */{
|
|
1256
1119
|
/**
|
|
1257
1120
|
* The rendering function called for each item in the list.
|
|
1258
1121
|
*
|
|
@@ -1278,7 +1141,6 @@ VirtualListBasic.propTypes =
|
|
|
1278
1141
|
* @public
|
|
1279
1142
|
*/
|
|
1280
1143
|
itemRenderer: _propTypes2["default"].func.isRequired,
|
|
1281
|
-
|
|
1282
1144
|
/**
|
|
1283
1145
|
* The size of an item for the list; valid values are either a number for `VirtualList`
|
|
1284
1146
|
* or an object that has `minWidth` and `minHeight` for `VirtualGridList`.
|
|
@@ -1288,7 +1150,6 @@ VirtualListBasic.propTypes =
|
|
|
1288
1150
|
* @private
|
|
1289
1151
|
*/
|
|
1290
1152
|
itemSize: _propTypes2["default"].oneOfType([_propTypes2["default"].number, gridListItemSizeShape]).isRequired,
|
|
1291
|
-
|
|
1292
1153
|
/**
|
|
1293
1154
|
* Callback method of scrollTo.
|
|
1294
1155
|
* Normally, useScroll should set this value.
|
|
@@ -1297,7 +1158,6 @@ VirtualListBasic.propTypes =
|
|
|
1297
1158
|
* @private
|
|
1298
1159
|
*/
|
|
1299
1160
|
cbScrollTo: _propTypes2["default"].func,
|
|
1300
|
-
|
|
1301
1161
|
/**
|
|
1302
1162
|
* Additional props included in the object passed to the `itemRenderer` callback.
|
|
1303
1163
|
*
|
|
@@ -1305,7 +1165,6 @@ VirtualListBasic.propTypes =
|
|
|
1305
1165
|
* @public
|
|
1306
1166
|
*/
|
|
1307
1167
|
childProps: _propTypes2["default"].object,
|
|
1308
|
-
|
|
1309
1168
|
/**
|
|
1310
1169
|
* Client size of the list; valid values are an object that has `clientWidth` and `clientHeight`.
|
|
1311
1170
|
*
|
|
@@ -1318,7 +1177,6 @@ VirtualListBasic.propTypes =
|
|
|
1318
1177
|
clientHeight: _propTypes2["default"].number.isRequired,
|
|
1319
1178
|
clientWidth: _propTypes2["default"].number.isRequired
|
|
1320
1179
|
}),
|
|
1321
|
-
|
|
1322
1180
|
/**
|
|
1323
1181
|
* An object with properties to be passed to the container DOM.
|
|
1324
1182
|
*
|
|
@@ -1326,7 +1184,6 @@ VirtualListBasic.propTypes =
|
|
|
1326
1184
|
* @private
|
|
1327
1185
|
*/
|
|
1328
1186
|
containerProps: _propTypes2["default"].object,
|
|
1329
|
-
|
|
1330
1187
|
/**
|
|
1331
1188
|
* The number of items of data the list contains.
|
|
1332
1189
|
*
|
|
@@ -1335,7 +1192,6 @@ VirtualListBasic.propTypes =
|
|
|
1335
1192
|
* @public
|
|
1336
1193
|
*/
|
|
1337
1194
|
dataSize: _propTypes2["default"].number,
|
|
1338
|
-
|
|
1339
1195
|
/**
|
|
1340
1196
|
* The layout direction of the list.
|
|
1341
1197
|
*
|
|
@@ -1348,7 +1204,6 @@ VirtualListBasic.propTypes =
|
|
|
1348
1204
|
* @public
|
|
1349
1205
|
*/
|
|
1350
1206
|
direction: _propTypes2["default"].oneOf(['horizontal', 'vertical']),
|
|
1351
|
-
|
|
1352
1207
|
/**
|
|
1353
1208
|
* Called to get the scroll affordance from themed component.
|
|
1354
1209
|
*
|
|
@@ -1356,7 +1211,6 @@ VirtualListBasic.propTypes =
|
|
|
1356
1211
|
* @private
|
|
1357
1212
|
*/
|
|
1358
1213
|
getAffordance: _propTypes2["default"].func,
|
|
1359
|
-
|
|
1360
1214
|
/**
|
|
1361
1215
|
* Called to get the props for list items.
|
|
1362
1216
|
*
|
|
@@ -1364,7 +1218,6 @@ VirtualListBasic.propTypes =
|
|
|
1364
1218
|
* @private
|
|
1365
1219
|
*/
|
|
1366
1220
|
getComponentProps: _propTypes2["default"].func,
|
|
1367
|
-
|
|
1368
1221
|
/**
|
|
1369
1222
|
* Ref for items
|
|
1370
1223
|
*
|
|
@@ -1372,7 +1225,6 @@ VirtualListBasic.propTypes =
|
|
|
1372
1225
|
* @private
|
|
1373
1226
|
*/
|
|
1374
1227
|
itemRefs: _propTypes2["default"].object,
|
|
1375
|
-
|
|
1376
1228
|
/**
|
|
1377
1229
|
* The array for individually sized items.
|
|
1378
1230
|
*
|
|
@@ -1380,7 +1232,6 @@ VirtualListBasic.propTypes =
|
|
|
1380
1232
|
* @private
|
|
1381
1233
|
*/
|
|
1382
1234
|
itemSizes: _propTypes2["default"].arrayOf(_propTypes2["default"].number),
|
|
1383
|
-
|
|
1384
1235
|
/**
|
|
1385
1236
|
* Called when the range of items has updated.
|
|
1386
1237
|
*
|
|
@@ -1390,7 +1241,6 @@ VirtualListBasic.propTypes =
|
|
|
1390
1241
|
* @private
|
|
1391
1242
|
*/
|
|
1392
1243
|
onUpdateItems: _propTypes2["default"].func,
|
|
1393
|
-
|
|
1394
1244
|
/**
|
|
1395
1245
|
* Number of spare DOM node.
|
|
1396
1246
|
* `3` is good for the default value experimentally and
|
|
@@ -1401,7 +1251,6 @@ VirtualListBasic.propTypes =
|
|
|
1401
1251
|
* @private
|
|
1402
1252
|
*/
|
|
1403
1253
|
overhang: _propTypes2["default"].number,
|
|
1404
|
-
|
|
1405
1254
|
/**
|
|
1406
1255
|
* When `true`, the list will scroll by page. Otherwise the list will scroll by item.
|
|
1407
1256
|
*
|
|
@@ -1410,7 +1259,6 @@ VirtualListBasic.propTypes =
|
|
|
1410
1259
|
* @private
|
|
1411
1260
|
*/
|
|
1412
1261
|
pageScroll: _propTypes2["default"].bool,
|
|
1413
|
-
|
|
1414
1262
|
/**
|
|
1415
1263
|
* The render function for the placeholder elements.
|
|
1416
1264
|
*
|
|
@@ -1419,7 +1267,6 @@ VirtualListBasic.propTypes =
|
|
|
1419
1267
|
* @private
|
|
1420
1268
|
*/
|
|
1421
1269
|
placeholderRenderer: _propTypes2["default"].func,
|
|
1422
|
-
|
|
1423
1270
|
/**
|
|
1424
1271
|
* The ARIA role for the list.
|
|
1425
1272
|
*
|
|
@@ -1428,7 +1275,6 @@ VirtualListBasic.propTypes =
|
|
|
1428
1275
|
* @public
|
|
1429
1276
|
*/
|
|
1430
1277
|
role: _propTypes2["default"].string,
|
|
1431
|
-
|
|
1432
1278
|
/**
|
|
1433
1279
|
* `true` if RTL, `false` if LTR.
|
|
1434
1280
|
*
|
|
@@ -1436,7 +1282,6 @@ VirtualListBasic.propTypes =
|
|
|
1436
1282
|
* @private
|
|
1437
1283
|
*/
|
|
1438
1284
|
rtl: _propTypes2["default"].bool,
|
|
1439
|
-
|
|
1440
1285
|
/**
|
|
1441
1286
|
* Ref for scroll content
|
|
1442
1287
|
*
|
|
@@ -1444,7 +1289,6 @@ VirtualListBasic.propTypes =
|
|
|
1444
1289
|
* @private
|
|
1445
1290
|
*/
|
|
1446
1291
|
scrollContentRef: _propTypes["default"].ref,
|
|
1447
|
-
|
|
1448
1292
|
/**
|
|
1449
1293
|
* Specifies how to scroll.
|
|
1450
1294
|
*
|
|
@@ -1457,7 +1301,6 @@ VirtualListBasic.propTypes =
|
|
|
1457
1301
|
* @public
|
|
1458
1302
|
*/
|
|
1459
1303
|
scrollMode: _propTypes2["default"].string,
|
|
1460
|
-
|
|
1461
1304
|
/**
|
|
1462
1305
|
* The spacing between items.
|
|
1463
1306
|
*
|
|
@@ -1466,7 +1309,6 @@ VirtualListBasic.propTypes =
|
|
|
1466
1309
|
* @public
|
|
1467
1310
|
*/
|
|
1468
1311
|
spacing: _propTypes2["default"].number,
|
|
1469
|
-
|
|
1470
1312
|
/**
|
|
1471
1313
|
* Called to execute additional logic in a themed component when updating states and bounds.
|
|
1472
1314
|
*
|