@enact/ui 4.5.2 → 4.5.4

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.
Files changed (167) hide show
  1. package/AnnounceDecorator/Announce.js +1 -40
  2. package/AnnounceDecorator/AnnounceDecorator.js +3 -21
  3. package/AnnounceDecorator/tests/Announce-specs.js +2 -7
  4. package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
  5. package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
  6. package/AnnounceDecorator/useAnnounce.js +0 -6
  7. package/BodyText/BodyText.js +6 -26
  8. package/BodyText/tests/BodyText-specs.js +0 -19
  9. package/Button/Button.js +26 -56
  10. package/Button/tests/Button-specs.js +0 -26
  11. package/CHANGELOG.md +10 -0
  12. package/Cancelable/Cancelable.js +8 -47
  13. package/Cancelable/cancelHandler.js +5 -12
  14. package/Cancelable/modalHandler.js +3 -11
  15. package/Cancelable/tests/Cancelable-specs.js +3 -57
  16. package/Changeable/Changeable.js +2 -34
  17. package/Changeable/tests/Changeable-specs.js +20 -66
  18. package/ComponentOverride/ComponentOverride.js +1 -13
  19. package/FloatingLayer/FloatingLayer.js +17 -73
  20. package/FloatingLayer/FloatingLayerContainer.js +0 -15
  21. package/FloatingLayer/FloatingLayerDecorator.js +4 -17
  22. package/FloatingLayer/Scrim.js +9 -53
  23. package/FloatingLayer/index.js +0 -4
  24. package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
  25. package/FloatingLayer/tests/Scrim-specs.js +0 -9
  26. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
  27. package/FloatingLayer/useFloatingLayer.js +3 -14
  28. package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
  29. package/ForwardRef/ForwardRef.js +1 -10
  30. package/GridListImageItem/GridListImageItem.js +17 -50
  31. package/Group/Group.js +4 -35
  32. package/Group/GroupItem.js +15 -32
  33. package/Group/tests/Group-specs.js +0 -32
  34. package/Heading/Heading.js +7 -35
  35. package/Heading/tests/Heading-specs.js +81 -14
  36. package/Icon/Icon.js +14 -48
  37. package/Icon/tests/Icon-specs.js +0 -22
  38. package/IconButton/IconButton.js +12 -50
  39. package/IconButton/tests/IconButton-specs.js +0 -7
  40. package/Image/Image.js +16 -45
  41. package/Image/tests/Image-specs.js +0 -14
  42. package/ImageItem/ImageItem.js +17 -46
  43. package/ImageItem/tests/ImageItem-specs.js +0 -25
  44. package/Item/Item.js +8 -32
  45. package/Item/tests/Item-specs.js +0 -24
  46. package/LabeledIcon/LabeledIcon.js +19 -50
  47. package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
  48. package/Layout/Cell.js +11 -37
  49. package/Layout/Layout.js +14 -37
  50. package/Layout/tests/Layout-specs.js +10 -39
  51. package/Marquee/MarqueeBase.js +29 -63
  52. package/Marquee/MarqueeController.js +11 -72
  53. package/Marquee/MarqueeDecorator.js +62 -196
  54. package/Marquee/index.js +1 -5
  55. package/Marquee/tests/Marquee-specs.js +258 -87
  56. package/Measurable/Measurable.js +12 -34
  57. package/Measurable/tests/Measurable-specs.js +115 -0
  58. package/Media/Media.js +15 -65
  59. package/Media/tests/Media-specs.js +168 -0
  60. package/Placeholder/PlaceholderControllerDecorator.js +7 -43
  61. package/Placeholder/PlaceholderDecorator.js +7 -38
  62. package/Placeholder/index.js +0 -4
  63. package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
  64. package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
  65. package/ProgressBar/ProgressBar.js +13 -44
  66. package/ProgressBar/tests/ProgressBar-specs.js +0 -17
  67. package/RadioDecorator/RadioControllerDecorator.js +1 -29
  68. package/RadioDecorator/RadioDecorator.js +4 -42
  69. package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
  70. package/Repeater/Repeater.js +9 -33
  71. package/Repeater/tests/Repeater-specs.js +0 -38
  72. package/Resizable/Resizable.js +7 -35
  73. package/Resizable/tests/Resizable-specs.js +34 -0
  74. package/Routable/Link.js +8 -44
  75. package/Routable/Routable.js +10 -33
  76. package/Routable/Route.js +0 -6
  77. package/Routable/Router.js +13 -56
  78. package/Routable/tests/Routable-specs.js +7 -33
  79. package/Routable/tests/Router-specs.js +18 -44
  80. package/Routable/useLink.js +4 -8
  81. package/Routable/util.js +18 -24
  82. package/Scrollable/ScrollAnimator.js +49 -65
  83. package/Scrollable/ScrollThumb.js +2 -13
  84. package/Scrollable/Scrollable.js +179 -386
  85. package/Scrollable/ScrollableNative.js +188 -391
  86. package/Scrollable/Scrollbar.js +28 -100
  87. package/Scroller/Scroller.js +15 -39
  88. package/Scroller/ScrollerBasic.js +34 -89
  89. package/Scroller/UiScrollerBase.js +31 -84
  90. package/Skinnable/Skinnable.js +11 -38
  91. package/Skinnable/tests/Skinnable-specs.js +3 -74
  92. package/Skinnable/tests/useSkins-specs.js +1 -13
  93. package/Skinnable/tests/util-specs.js +0 -14
  94. package/Skinnable/useSkins.js +8 -15
  95. package/Skinnable/util.js +9 -20
  96. package/Slider/Knob.js +5 -24
  97. package/Slider/PositionDecorator.js +16 -54
  98. package/Slider/Slider.js +26 -64
  99. package/Slider/tests/Slider-specs.js +94 -7
  100. package/Slider/utils.js +0 -2
  101. package/SlotItem/SlotItem.js +15 -41
  102. package/SlotItem/tests/SlotItem-specs.js +0 -5
  103. package/Slottable/Slottable.js +4 -12
  104. package/Slottable/tests/Slottable-specs.js +19 -46
  105. package/Slottable/tests/useSlots-specs.js +27 -65
  106. package/Slottable/useSlots.js +8 -33
  107. package/Spinner/Spinner.js +15 -42
  108. package/Spinner/tests/Spinner-specs.js +0 -15
  109. package/ToggleIcon/ToggleIcon.js +10 -36
  110. package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
  111. package/ToggleItem/ToggleItem.js +15 -52
  112. package/ToggleItem/tests/ToggleItem-specs.js +0 -30
  113. package/Toggleable/Toggle.js +1 -15
  114. package/Toggleable/Toggleable.js +12 -45
  115. package/Toggleable/tests/Toggleable-specs.js +28 -96
  116. package/Toggleable/useToggle.js +3 -19
  117. package/Touchable/ClickAllow.js +5 -14
  118. package/Touchable/Drag.js +16 -54
  119. package/Touchable/Flick.js +11 -42
  120. package/Touchable/Hold.js +21 -68
  121. package/Touchable/Touch.js +37 -65
  122. package/Touchable/Touchable.js +32 -71
  123. package/Touchable/config.js +8 -22
  124. package/Touchable/tests/Touchable-specs.js +270 -119
  125. package/Touchable/tests/useTouch-specs.js +6 -80
  126. package/Touchable/useTouch.js +17 -34
  127. package/Transition/Transition.js +37 -118
  128. package/Transition/tests/Transition-specs.js +20 -60
  129. package/ViewManager/Arranger.js +10 -22
  130. package/ViewManager/TransitionGroup.js +31 -106
  131. package/ViewManager/View.js +35 -91
  132. package/ViewManager/ViewManager.js +19 -83
  133. package/ViewManager/tests/View-specs.js +0 -17
  134. package/ViewManager/tests/ViewManager-specs.js +236 -305
  135. package/ViewManager/tests/test-utils.js +0 -8
  136. package/VirtualList/UiVirtualListBase.js +256 -406
  137. package/VirtualList/VirtualList.js +29 -69
  138. package/VirtualList/VirtualListBase.js +0 -3
  139. package/VirtualList/VirtualListBasic.js +270 -428
  140. package/VirtualList/tests/VirtualList-specs.js +9 -37
  141. package/internal/IdProvider/IdProvider.js +7 -21
  142. package/internal/IdProvider/Provider.js +4 -17
  143. package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
  144. package/internal/IdProvider/tests/useId-specs.js +7 -22
  145. package/internal/IdProvider/useId.js +0 -6
  146. package/internal/Pure/Pure.js +3 -30
  147. package/internal/Pure/tests/Pure-specs.js +88 -0
  148. package/internal/localized-fonts/localized-fonts.js +33 -62
  149. package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
  150. package/internal/selection/selection.js +1 -6
  151. package/internal/selection/tests/selection-specs.js +6 -4
  152. package/internal/validators/tests/validators-specs.js +80 -0
  153. package/internal/validators/validators.js +14 -34
  154. package/package.json +8 -2
  155. package/resolution/ResolutionDecorator.js +4 -40
  156. package/resolution/index.js +0 -7
  157. package/resolution/resolution.js +42 -80
  158. package/resolution/tests/ResolutionDecorator-specs.js +4 -11
  159. package/resolution/tests/resolution-specs.js +2 -2
  160. package/useControlledState/tests/useControlledState-specs.js +15 -46
  161. package/useControlledState/useControlledState.js +11 -22
  162. package/useScroll/ScrollAnimator.js +49 -65
  163. package/useScroll/Scrollbar.js +22 -58
  164. package/useScroll/ScrollbarTrack.js +3 -19
  165. package/useScroll/useScroll.js +325 -502
  166. package/useScroll/utilDOM.js +8 -14
  167. package/useScroll/utilEvent.js +0 -4
@@ -4,107 +4,71 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.constants = exports.ScrollableNative = exports.ScrollableBaseNative = void 0;
7
-
8
7
  var _classnames = _interopRequireDefault(require("classnames"));
9
-
10
8
  var _handle = _interopRequireWildcard(require("@enact/core/handle"));
11
-
12
9
  var _keymap = require("@enact/core/keymap");
13
-
14
10
  var _platform = require("@enact/core/platform");
15
-
16
11
  var _Registry = _interopRequireDefault(require("@enact/core/internal/Registry"));
17
-
18
12
  var _util = require("@enact/core/util");
19
-
20
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
21
-
22
14
  var _clamp = _interopRequireDefault(require("ramda/src/clamp"));
23
-
24
15
  var _react = require("react");
25
-
26
16
  var _Resizable = require("../Resizable");
27
-
28
17
  var _resolution = _interopRequireDefault(require("../resolution"));
29
-
30
18
  var _Touchable = _interopRequireDefault(require("../Touchable"));
31
-
32
19
  var _ScrollAnimator = _interopRequireDefault(require("./ScrollAnimator"));
33
-
34
20
  var _Scrollbar = _interopRequireDefault(require("./Scrollbar"));
35
-
36
21
  var _ScrollableModule = _interopRequireDefault(require("./Scrollable.module.css"));
37
-
38
22
  var _jsxRuntime = require("react/jsx-runtime");
39
-
40
23
  var _excluded = ["className", "containerRenderer", "noScrollByDrag", "rtl", "style"],
41
- _excluded2 = ["childRenderer"];
42
-
24
+ _excluded2 = ["childRenderer"];
43
25
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
44
-
45
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
46
-
47
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
48
-
49
28
  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; }
50
-
51
29
  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; }
52
-
53
30
  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; }
54
-
55
31
  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; }
56
-
57
32
  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; }
58
-
59
33
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
60
-
61
34
  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); } }
62
-
63
35
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
64
-
65
36
  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); }
66
-
67
37
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
68
-
69
38
  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); }; }
70
-
71
39
  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); }
72
-
73
40
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
74
-
75
41
  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; } }
76
-
77
42
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
78
-
79
43
  var constants = {
80
- epsilon: 1,
81
- flickConfig: {
82
- maxDuration: null
44
+ epsilon: 1,
45
+ flickConfig: {
46
+ maxDuration: null
47
+ },
48
+ isPageDown: (0, _keymap.is)('pageDown'),
49
+ isPageUp: (0, _keymap.is)('pageUp'),
50
+ nop: function nop() {},
51
+ overscrollTypeNone: 0,
52
+ overscrollTypeHold: 1,
53
+ overscrollTypeOnce: 2,
54
+ overscrollTypeDone: 9,
55
+ overscrollVelocityFactor: 300,
56
+ scrollStopWaiting: 200,
57
+ scrollWheelPageMultiplierForMaxPixel: 0.2 // The ratio of the maximum distance scrolled by wheel to the size of the viewport.
83
58
  },
84
- isPageDown: (0, _keymap.is)('pageDown'),
85
- isPageUp: (0, _keymap.is)('pageUp'),
86
- nop: function nop() {},
87
- overscrollTypeNone: 0,
88
- overscrollTypeHold: 1,
89
- overscrollTypeOnce: 2,
90
- overscrollTypeDone: 9,
91
- overscrollVelocityFactor: 300,
92
- scrollStopWaiting: 200,
93
- scrollWheelPageMultiplierForMaxPixel: 0.2 // The ratio of the maximum distance scrolled by wheel to the size of the viewport.
94
-
95
- },
96
- epsilon = constants.epsilon,
97
- flickConfig = constants.flickConfig,
98
- nop = constants.nop,
99
- overscrollTypeDone = constants.overscrollTypeDone,
100
- overscrollTypeHold = constants.overscrollTypeHold,
101
- overscrollTypeNone = constants.overscrollTypeNone,
102
- overscrollTypeOnce = constants.overscrollTypeOnce,
103
- overscrollVelocityFactor = constants.overscrollVelocityFactor,
104
- scrollStopWaiting = constants.scrollStopWaiting,
105
- scrollWheelPageMultiplierForMaxPixel = constants.scrollWheelPageMultiplierForMaxPixel;
59
+ epsilon = constants.epsilon,
60
+ flickConfig = constants.flickConfig,
61
+ nop = constants.nop,
62
+ overscrollTypeDone = constants.overscrollTypeDone,
63
+ overscrollTypeHold = constants.overscrollTypeHold,
64
+ overscrollTypeNone = constants.overscrollTypeNone,
65
+ overscrollTypeOnce = constants.overscrollTypeOnce,
66
+ overscrollVelocityFactor = constants.overscrollVelocityFactor,
67
+ scrollStopWaiting = constants.scrollStopWaiting,
68
+ scrollWheelPageMultiplierForMaxPixel = constants.scrollWheelPageMultiplierForMaxPixel;
106
69
  exports.constants = constants;
107
70
  var TouchableDiv = (0, _Touchable["default"])('div');
71
+
108
72
  /**
109
73
  * An unstyled native component that passes scrollable behavior information as its render prop's arguments.
110
74
  *
@@ -113,38 +77,26 @@ var TouchableDiv = (0, _Touchable["default"])('div');
113
77
  * @ui
114
78
  * @private
115
79
  */
116
-
117
80
  var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
118
81
  _inherits(ScrollableBaseNative, _Component);
119
-
120
82
  var _super = _createSuper(ScrollableBaseNative);
121
-
122
83
  function ScrollableBaseNative(props) {
123
84
  var _this;
124
-
125
85
  _classCallCheck(this, ScrollableBaseNative);
126
-
127
86
  _this = _super.call(this, props);
128
-
129
87
  _this.handleResizeWindow = function () {
130
88
  // `handleSize` in `ui/resolution.ResolutionDecorator` should be executed first.
131
89
  setTimeout(function () {
132
90
  var handleResizeWindow = _this.props.handleResizeWindow;
133
-
134
91
  if (handleResizeWindow) {
135
92
  handleResizeWindow();
136
93
  }
137
-
138
94
  _this.childRefCurrent.containerRef.current.style.scrollBehavior = null;
139
-
140
95
  _this.childRefCurrent.scrollToPosition(0, 0);
141
-
142
96
  _this.childRefCurrent.containerRef.current.style.scrollBehavior = 'smooth';
143
-
144
97
  _this.enqueueForceUpdate();
145
98
  });
146
99
  };
147
-
148
100
  _this.pixelPerLine = 39;
149
101
  _this.scrollWheelMultiplierForDeltaPixel = 1.5;
150
102
  _this.deferScrollTo = true;
@@ -191,38 +143,31 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
191
143
  _this.scrollToInfo = null;
192
144
  _this.childRefCurrent = null;
193
145
  _this.animator = new _ScrollAnimator["default"]();
194
-
195
146
  _this.getRtlX = function (x) {
196
147
  return _this.props.rtl ? -x : x;
197
148
  };
198
-
199
149
  _this.onMouseDown = (0, _handle["default"])((0, _handle.forwardWithPrevent)('onMouseDown'), _this.stop).bindAs(_assertThisInitialized(_this), 'onMouseDown');
200
-
201
150
  _this.onTouchStart = function () {
202
151
  _this.isTouching = true;
203
152
  };
204
-
205
153
  _this.onDragStart = function (ev) {
206
154
  if (!_this.isTouching) {
207
155
  _this.stop();
208
-
209
156
  _this.isDragging = true;
210
- } // these values are used also for touch inputs
211
-
157
+ }
212
158
 
159
+ // these values are used also for touch inputs
213
160
  _this.dragStartX = _this.scrollLeft + _this.getRtlX(ev.x);
214
161
  _this.dragStartY = _this.scrollTop + ev.y;
215
162
  };
216
-
217
163
  _this.onDrag = function (ev) {
218
164
  var _this$props = _this.props,
219
- direction = _this$props.direction,
220
- overscrollEffectOn = _this$props.overscrollEffectOn,
221
- targetX = direction === 'vertical' ? 0 : _this.dragStartX - _this.getRtlX(ev.x),
222
- targetY = direction === 'horizontal' ? 0 : _this.dragStartY - ev.y; // 'vertical' or 'both'
165
+ direction = _this$props.direction,
166
+ overscrollEffectOn = _this$props.overscrollEffectOn,
167
+ targetX = direction === 'vertical' ? 0 : _this.dragStartX - _this.getRtlX(ev.x),
168
+ targetY = direction === 'horizontal' ? 0 : _this.dragStartY - ev.y; // 'vertical' or 'both'
223
169
 
224
170
  _this.lastInputType = 'drag';
225
-
226
171
  if (!_this.isTouching) {
227
172
  _this.start({
228
173
  targetX: targetX,
@@ -234,20 +179,16 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
234
179
  _this.checkAndApplyOverscrollEffectOnDrag(targetX, targetY, overscrollTypeHold);
235
180
  }
236
181
  };
237
-
238
182
  _this.onDragEnd = function () {
239
183
  _this.isDragging = false;
240
184
  _this.lastInputType = 'drag';
241
-
242
185
  if (_this.flickTarget) {
243
186
  var overscrollEffectOn = _this.props.overscrollEffectOn,
244
- _this$flickTarget = _this.flickTarget,
245
- targetX = _this$flickTarget.targetX,
246
- targetY = _this$flickTarget.targetY;
247
-
187
+ _this$flickTarget = _this.flickTarget,
188
+ targetX = _this$flickTarget.targetX,
189
+ targetY = _this$flickTarget.targetY;
248
190
  if (!_this.isTouching) {
249
191
  _this.isScrollAnimationTargetAccumulated = false;
250
-
251
192
  _this.start({
252
193
  targetX: targetX,
253
194
  targetY: targetY,
@@ -259,19 +200,15 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
259
200
  } else if (!_this.isTouching) {
260
201
  _this.stop();
261
202
  }
262
-
263
203
  if (_this.overscrollEnabled) {
264
204
  // not check this.props.overscrollEffectOn.drag for safety
265
205
  _this.clearAllOverscrollEffects();
266
206
  }
267
-
268
207
  _this.isTouching = false;
269
208
  _this.flickTarget = null;
270
209
  };
271
-
272
210
  _this.onFlick = function (ev) {
273
211
  var direction = _this.props.direction;
274
-
275
212
  if (!_this.isTouching) {
276
213
  _this.flickTarget = _this.animator.simulate(_this.scrollLeft, _this.scrollTop, direction !== 'vertical' ? _this.getRtlX(-ev.velocityX) : 0, direction !== 'horizontal' ? -ev.velocityY : 0);
277
214
  } else if (_this.overscrollEnabled && _this.props.overscrollEffectOn.drag) {
@@ -279,7 +216,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
279
216
  targetX: _this.scrollLeft + _this.getRtlX(-ev.velocityX) * overscrollVelocityFactor,
280
217
  // 'horizontal' or 'both'
281
218
  targetY: _this.scrollTop + -ev.velocityY * overscrollVelocityFactor // 'vertical' or 'both'
282
-
283
219
  };
284
220
  }
285
221
 
@@ -287,49 +223,43 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
287
223
  (0, _handle.forward)('onFlick', ev, _this.props);
288
224
  }
289
225
  };
290
-
291
226
  _this.onWheel = function (ev) {
292
227
  if (_this.isDragging) {
293
228
  ev.preventDefault();
294
229
  ev.stopPropagation();
295
230
  } else {
296
231
  var overscrollEffectOn = _this.props.overscrollEffectOn,
297
- overscrollEffectRequired = _this.overscrollEnabled && overscrollEffectOn.wheel,
298
- bounds = _this.getScrollBounds(),
299
- canScrollHorizontally = _this.canScrollHorizontally(bounds),
300
- canScrollVertically = _this.canScrollVertically(bounds),
301
- eventDeltaMode = ev.deltaMode,
302
- eventDelta = -ev.wheelDeltaY || ev.deltaY;
303
-
232
+ overscrollEffectRequired = _this.overscrollEnabled && overscrollEffectOn.wheel,
233
+ bounds = _this.getScrollBounds(),
234
+ canScrollHorizontally = _this.canScrollHorizontally(bounds),
235
+ canScrollVertically = _this.canScrollVertically(bounds),
236
+ eventDeltaMode = ev.deltaMode,
237
+ eventDelta = -ev.wheelDeltaY || ev.deltaY;
304
238
  var delta = 0,
305
- needToHideThumb = false;
239
+ needToHideThumb = false;
306
240
  _this.lastInputType = 'wheel';
307
-
308
241
  if (_this.props.noScrollByWheel) {
309
242
  if (canScrollVertically) {
310
243
  ev.preventDefault();
311
244
  }
312
-
313
245
  return;
314
246
  }
315
-
316
247
  if (_this.props.onWheel) {
317
248
  (0, _handle.forward)('onWheel', ev, _this.props);
318
249
  return;
319
250
  }
251
+ _this.showThumb(bounds);
320
252
 
321
- _this.showThumb(bounds); // FIXME This routine is a temporary support for horizontal wheel scroll.
253
+ // FIXME This routine is a temporary support for horizontal wheel scroll.
322
254
  // FIXME If web engine supports horizontal wheel, this routine should be refined or removed.
323
-
324
-
325
255
  if (canScrollVertically) {
326
256
  // This routine handles wheel events on scrollbars for vertical scroll.
327
257
  if (eventDelta < 0 && _this.scrollTop > 0 || eventDelta > 0 && _this.scrollTop < bounds.maxTop) {
328
258
  var _assertThisInitialize = _assertThisInitialized(_this),
329
- horizontalScrollbarRef = _assertThisInitialize.horizontalScrollbarRef,
330
- verticalScrollbarRef = _assertThisInitialize.verticalScrollbarRef; // Not to check if ev.target is a descendant of a wrapped component which may have a lot of nodes in it.
331
-
259
+ horizontalScrollbarRef = _assertThisInitialize.horizontalScrollbarRef,
260
+ verticalScrollbarRef = _assertThisInitialize.verticalScrollbarRef;
332
261
 
262
+ // Not to check if ev.target is a descendant of a wrapped component which may have a lot of nodes in it.
333
263
  if (horizontalScrollbarRef.current && horizontalScrollbarRef.current.getContainerRef().current.contains(ev.target) || verticalScrollbarRef.current && verticalScrollbarRef.current.getContainerRef().current.contains(ev.target)) {
334
264
  delta = _this.calculateDistanceByWheel(eventDeltaMode, eventDelta, bounds.clientHeight * scrollWheelPageMultiplierForMaxPixel);
335
265
  needToHideThumb = !delta;
@@ -337,13 +267,11 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
337
267
  } else if (overscrollEffectRequired) {
338
268
  _this.checkAndApplyOverscrollEffect('vertical', eventDelta > 0 ? 'after' : 'before', overscrollTypeOnce);
339
269
  }
340
-
341
270
  ev.stopPropagation();
342
271
  } else {
343
272
  if (overscrollEffectRequired && (eventDelta < 0 && _this.scrollTop <= 0 || eventDelta > 0 && _this.scrollTop >= bounds.maxTop)) {
344
273
  _this.applyOverscrollEffect('vertical', eventDelta > 0 ? 'after' : 'before', overscrollTypeOnce, 1);
345
274
  }
346
-
347
275
  needToHideThumb = true;
348
276
  }
349
277
  } else if (canScrollHorizontally) {
@@ -357,85 +285,67 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
357
285
  if (overscrollEffectRequired && (eventDelta < 0 && _this.scrollLeft <= 0 || eventDelta > 0 && _this.scrollLeft >= bounds.maxLeft)) {
358
286
  _this.applyOverscrollEffect('horizontal', eventDelta > 0 ? 'after' : 'before', overscrollTypeOnce, 1);
359
287
  }
360
-
361
288
  needToHideThumb = true;
362
289
  }
363
290
  }
364
-
365
291
  if (delta !== 0) {
366
- var direction = Math.sign(delta); // Not to accumulate scroll position if wheel direction is different from hold direction
367
-
292
+ var direction = Math.sign(delta);
293
+ // Not to accumulate scroll position if wheel direction is different from hold direction
368
294
  if (direction !== _this.wheelDirection) {
369
295
  _this.isScrollAnimationTargetAccumulated = false;
370
296
  _this.wheelDirection = direction;
371
297
  }
372
-
373
298
  _this.scrollToAccumulatedTarget(delta, canScrollVertically, overscrollEffectOn.wheel);
374
299
  }
375
-
376
300
  if (needToHideThumb) {
377
301
  _this.startHidingThumb();
378
302
  }
379
303
  }
380
304
  };
381
-
382
305
  _this.onScroll = function (ev) {
383
306
  var _ev$target = ev.target,
384
- scrollLeft = _ev$target.scrollLeft,
385
- scrollTop = _ev$target.scrollTop;
386
-
307
+ scrollLeft = _ev$target.scrollLeft,
308
+ scrollTop = _ev$target.scrollTop;
387
309
  var bounds = _this.getScrollBounds(),
388
- canScrollHorizontally = _this.canScrollHorizontally(bounds);
389
-
310
+ canScrollHorizontally = _this.canScrollHorizontally(bounds);
390
311
  if (!_this.scrolling) {
391
312
  _this.scrollStartOnScroll();
392
313
  }
393
-
394
314
  if (_this.props.rtl && canScrollHorizontally) {
395
315
  scrollLeft = _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -scrollLeft : bounds.maxLeft - scrollLeft;
396
316
  }
397
-
398
317
  if (scrollLeft !== _this.scrollLeft) {
399
318
  _this.setScrollLeft(scrollLeft);
400
319
  }
401
-
402
320
  if (scrollTop !== _this.scrollTop) {
403
321
  _this.setScrollTop(scrollTop);
404
322
  }
405
-
406
323
  if (_this.childRefCurrent.didScroll) {
407
324
  _this.childRefCurrent.didScroll(_this.scrollLeft, _this.scrollTop);
408
325
  }
409
-
410
326
  _this.forwardScrollEvent('onScroll');
411
-
412
327
  _this.scrollStopJob.start();
413
328
  };
414
-
415
329
  _this.onKeyDown = function (ev) {
416
330
  (0, _handle.forward)('onKeyDown', ev, _this.props);
417
331
  };
418
-
419
332
  _this.scrollToAccumulatedTarget = function (delta, vertical, overscrollEffect) {
420
333
  if (!_this.isScrollAnimationTargetAccumulated) {
421
334
  _this.accumulatedTargetX = _this.scrollLeft;
422
335
  _this.accumulatedTargetY = _this.scrollTop;
423
336
  _this.isScrollAnimationTargetAccumulated = true;
424
337
  }
425
-
426
338
  if (vertical) {
427
339
  _this.accumulatedTargetY += delta;
428
340
  } else {
429
341
  _this.accumulatedTargetX += delta;
430
342
  }
431
-
432
343
  _this.start({
433
344
  targetX: _this.accumulatedTargetX,
434
345
  targetY: _this.accumulatedTargetY,
435
346
  overscrollEffect: overscrollEffect
436
347
  });
437
348
  };
438
-
439
349
  _this.getEdgeFromPosition = function (position, maxPosition) {
440
350
  if (position <= 0) {
441
351
  return 'before';
@@ -447,25 +357,20 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
447
357
  return null;
448
358
  }
449
359
  };
450
-
451
360
  _this.setOverscrollStatus = function (orientation, edge, type, ratio) {
452
361
  var status = _this.overscrollStatus[orientation][edge];
453
362
  status.type = type;
454
363
  status.ratio = ratio;
455
364
  };
456
-
457
365
  _this.getOverscrollStatus = function (orientation, edge) {
458
366
  return _this.overscrollStatus[orientation][edge];
459
367
  };
460
-
461
368
  _this.calculateOverscrollRatio = function (orientation, position) {
462
369
  var bounds = _this.getScrollBounds(),
463
- isVertical = orientation === 'vertical',
464
- baseSize = isVertical ? bounds.clientHeight : bounds.clientWidth,
465
- maxPos = bounds[isVertical ? 'maxTop' : 'maxLeft'];
466
-
370
+ isVertical = orientation === 'vertical',
371
+ baseSize = isVertical ? bounds.clientHeight : bounds.clientWidth,
372
+ maxPos = bounds[isVertical ? 'maxTop' : 'maxLeft'];
467
373
  var overDistance = 0;
468
-
469
374
  if (position < 0) {
470
375
  overDistance = -position;
471
376
  } else if (position > maxPos) {
@@ -473,26 +378,20 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
473
378
  } else {
474
379
  return 0;
475
380
  }
476
-
477
381
  return Math.min(1, 2 * overDistance / baseSize);
478
382
  };
479
-
480
383
  _this.applyOverscrollEffect = function (orientation, edge, type, ratio) {
481
384
  _this.props.applyOverscrollEffect(orientation, edge, type, ratio);
482
-
483
385
  _this.setOverscrollStatus(orientation, edge, type === overscrollTypeOnce ? overscrollTypeDone : type, ratio);
484
386
  };
485
-
486
387
  _this.checkAndApplyOverscrollEffect = function (orientation, edge, type) {
487
388
  var ratio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
488
-
489
389
  var isVertical = orientation === 'vertical',
490
- curPos = isVertical ? _this.scrollTop : _this.scrollLeft,
491
- maxPos = _this.getScrollBounds()[isVertical ? 'maxTop' : 'maxLeft'];
390
+ curPos = isVertical ? _this.scrollTop : _this.scrollLeft,
391
+ maxPos = _this.getScrollBounds()[isVertical ? 'maxTop' : 'maxLeft'];
392
+
492
393
  /* If a scroll size or a client size is not integer,
493
394
  browser's max scroll position could be smaller than maxPos by 1 pixel.*/
494
-
495
-
496
395
  if (edge === 'before' && curPos <= 0 || edge === 'after' && curPos >= maxPos - 1) {
497
396
  // Already on the edge
498
397
  _this.applyOverscrollEffect(orientation, edge, type, ratio);
@@ -500,7 +399,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
500
399
  _this.setOverscrollStatus(orientation, edge, type, ratio);
501
400
  }
502
401
  };
503
-
504
402
  _this.clearOverscrollEffect = function (orientation, edge) {
505
403
  if (_this.getOverscrollStatus(orientation, edge).type !== overscrollTypeNone) {
506
404
  if (_this.props.clearOverscrollEffect) {
@@ -510,7 +408,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
510
408
  }
511
409
  }
512
410
  };
513
-
514
411
  _this.clearAllOverscrollEffects = function () {
515
412
  ['horizontal', 'vertical'].forEach(function (orientation) {
516
413
  ['before', 'after'].forEach(function (edge) {
@@ -518,46 +415,36 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
518
415
  });
519
416
  });
520
417
  };
521
-
522
418
  _this.applyOverscrollEffectOnDrag = function (orientation, edge, targetPosition, type) {
523
419
  if (edge) {
524
420
  var oppositeEdge = edge === 'before' ? 'after' : 'before',
525
- ratio = _this.calculateOverscrollRatio(orientation, targetPosition);
526
-
421
+ ratio = _this.calculateOverscrollRatio(orientation, targetPosition);
527
422
  _this.applyOverscrollEffect(orientation, edge, type, ratio);
528
-
529
423
  _this.clearOverscrollEffect(orientation, oppositeEdge);
530
424
  } else {
531
425
  _this.clearOverscrollEffect(orientation, 'before');
532
-
533
426
  _this.clearOverscrollEffect(orientation, 'after');
534
427
  }
535
428
  };
536
-
537
429
  _this.checkAndApplyOverscrollEffectOnDrag = function (targetX, targetY, type) {
538
430
  var bounds = _this.getScrollBounds();
539
-
540
431
  if (_this.canScrollHorizontally(bounds)) {
541
432
  _this.applyOverscrollEffectOnDrag('horizontal', _this.getEdgeFromPosition(targetX, bounds.maxLeft), targetX, type);
542
433
  }
543
-
544
434
  if (_this.canScrollVertically(bounds)) {
545
435
  _this.applyOverscrollEffectOnDrag('vertical', _this.getEdgeFromPosition(targetY, bounds.maxTop), targetY, type);
546
436
  }
547
437
  };
548
-
549
438
  _this.checkAndApplyOverscrollEffectOnScroll = function (orientation) {
550
439
  ['before', 'after'].forEach(function (edge) {
551
440
  var _this$getOverscrollSt = _this.getOverscrollStatus(orientation, edge),
552
- ratio = _this$getOverscrollSt.ratio,
553
- type = _this$getOverscrollSt.type;
554
-
441
+ ratio = _this$getOverscrollSt.ratio,
442
+ type = _this$getOverscrollSt.type;
555
443
  if (type === overscrollTypeOnce) {
556
444
  _this.checkAndApplyOverscrollEffect(orientation, edge, type, ratio);
557
445
  }
558
446
  });
559
447
  };
560
-
561
448
  _this.checkAndApplyOverscrollEffectOnStart = function (orientation, edge, targetPosition) {
562
449
  if (_this.isDragging) {
563
450
  _this.applyOverscrollEffectOnDrag(orientation, edge, targetPosition, overscrollTypeHold);
@@ -565,49 +452,37 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
565
452
  _this.checkAndApplyOverscrollEffect(orientation, edge, overscrollTypeOnce);
566
453
  }
567
454
  };
568
-
569
455
  _this.scrollStartOnScroll = function () {
570
456
  _this.scrolling = true;
571
-
572
457
  _this.showThumb(_this.getScrollBounds());
573
-
574
458
  _this.forwardScrollEvent('onScrollStart');
575
459
  };
576
-
577
460
  _this.scrollStopOnScroll = function () {
578
461
  if (_this.props.scrollStopOnScroll) {
579
462
  _this.props.scrollStopOnScroll();
580
463
  }
581
-
582
464
  if (_this.overscrollEnabled && !_this.isDragging) {
583
465
  // not check this.props.overscrollEffectOn for safety
584
466
  _this.clearAllOverscrollEffects();
585
467
  }
586
-
587
468
  _this.lastInputType = null;
588
469
  _this.isScrollAnimationTargetAccumulated = false;
589
470
  _this.scrolling = false;
590
-
591
471
  _this.forwardScrollEvent('onScrollStop', _this.getReachedEdgeInfo());
592
-
593
472
  _this.startHidingThumb();
594
473
  };
595
-
596
474
  _this.scrollStopJob = new _util.Job(_this.scrollStopOnScroll, scrollStopWaiting);
597
-
598
475
  _this.getReachedEdgeInfo = function () {
599
476
  var bounds = _this.getScrollBounds(),
600
- reachedEdgeInfo = {
601
- bottom: false,
602
- left: false,
603
- right: false,
604
- top: false
605
- };
606
-
477
+ reachedEdgeInfo = {
478
+ bottom: false,
479
+ left: false,
480
+ right: false,
481
+ top: false
482
+ };
607
483
  if (_this.canScrollHorizontally(bounds)) {
608
484
  var rtl = _this.props.rtl,
609
- edge = _this.getEdgeFromPosition(_this.scrollLeft, bounds.maxLeft);
610
-
485
+ edge = _this.getEdgeFromPosition(_this.scrollLeft, bounds.maxLeft);
611
486
  if (edge) {
612
487
  // if edge is null, no need to check which edge is reached.
613
488
  if (edge === 'before' && !rtl || edge === 'after' && rtl) {
@@ -617,29 +492,23 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
617
492
  }
618
493
  }
619
494
  }
620
-
621
495
  if (_this.canScrollVertically(bounds)) {
622
496
  var _edge = _this.getEdgeFromPosition(_this.scrollTop, bounds.maxTop);
623
-
624
497
  if (_edge === 'before') {
625
498
  reachedEdgeInfo.top = true;
626
499
  } else if (_edge === 'after') {
627
500
  reachedEdgeInfo.bottom = true;
628
501
  }
629
502
  }
630
-
631
503
  return reachedEdgeInfo;
632
504
  };
633
-
634
505
  _this.getPositionForScrollTo = function (opt) {
635
506
  var bounds = _this.getScrollBounds(),
636
- canScrollHorizontally = _this.canScrollHorizontally(bounds),
637
- canScrollVertically = _this.canScrollVertically(bounds);
638
-
507
+ canScrollHorizontally = _this.canScrollHorizontally(bounds),
508
+ canScrollVertically = _this.canScrollVertically(bounds);
639
509
  var itemPos,
640
- left = null,
641
- top = null;
642
-
510
+ left = null,
511
+ top = null;
643
512
  if (opt instanceof Object) {
644
513
  if (opt.position instanceof Object) {
645
514
  if (canScrollHorizontally) {
@@ -648,7 +517,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
648
517
  } else {
649
518
  left = 0;
650
519
  }
651
-
652
520
  if (canScrollVertically) {
653
521
  // We need '!=' to check if opt.position.y is null or undefined
654
522
  top = opt.position.y != null ? opt.position.y : _this.scrollTop;
@@ -663,7 +531,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
663
531
  left = bounds.maxLeft;
664
532
  }
665
533
  }
666
-
667
534
  if (canScrollVertically) {
668
535
  if (opt.align.includes('top')) {
669
536
  top = 0;
@@ -679,37 +546,30 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
679
546
  itemPos = _this.childRefCurrent.getNodePosition(opt.node);
680
547
  }
681
548
  }
682
-
683
549
  if (itemPos) {
684
550
  if (canScrollHorizontally) {
685
551
  left = itemPos.left;
686
552
  }
687
-
688
553
  if (canScrollVertically) {
689
554
  top = itemPos.top;
690
555
  }
691
556
  }
692
557
  }
693
558
  }
694
-
695
559
  return {
696
560
  left: left,
697
561
  top: top
698
562
  };
699
563
  };
700
-
701
564
  _this.scrollTo = function (opt) {
702
565
  if (!_this.deferScrollTo) {
703
566
  var _this$getPositionForS = _this.getPositionForScrollTo(opt),
704
- left = _this$getPositionForS.left,
705
- top = _this$getPositionForS.top;
706
-
567
+ left = _this$getPositionForS.left,
568
+ top = _this$getPositionForS.top;
707
569
  if (_this.props.scrollTo) {
708
570
  _this.props.scrollTo(opt);
709
571
  }
710
-
711
572
  _this.scrollToInfo = null;
712
-
713
573
  _this.start({
714
574
  targetX: left !== null ? left : _this.scrollLeft,
715
575
  targetY: top !== null ? top : _this.scrollTop,
@@ -719,43 +579,37 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
719
579
  _this.scrollToInfo = opt;
720
580
  }
721
581
  };
722
-
723
582
  _this.canScrollHorizontally = function (bounds) {
724
583
  var direction = _this.props.direction;
725
584
  return (direction === 'horizontal' || direction === 'both') && bounds.scrollWidth > bounds.clientWidth && !isNaN(bounds.scrollWidth);
726
585
  };
727
-
728
586
  _this.canScrollVertically = function (bounds) {
729
587
  var direction = _this.props.direction;
730
588
  return (direction === 'vertical' || direction === 'both') && bounds.scrollHeight > bounds.clientHeight && !isNaN(bounds.scrollHeight);
731
589
  };
732
-
733
590
  _this.startHidingThumb = function () {
734
591
  if (_this.state.isHorizontalScrollbarVisible && _this.horizontalScrollbarRef.current) {
735
592
  _this.horizontalScrollbarRef.current.startHidingThumb();
736
593
  }
737
-
738
594
  if (_this.state.isVerticalScrollbarVisible && _this.verticalScrollbarRef.current) {
739
595
  _this.verticalScrollbarRef.current.startHidingThumb();
740
596
  }
741
597
  };
742
-
743
598
  _this.updateScrollbars = function () {
744
599
  var _this$props2 = _this.props,
745
- horizontalScrollbar = _this$props2.horizontalScrollbar,
746
- verticalScrollbar = _this$props2.verticalScrollbar,
747
- _this$state = _this.state,
748
- isHorizontalScrollbarVisible = _this$state.isHorizontalScrollbarVisible,
749
- isVerticalScrollbarVisible = _this$state.isVerticalScrollbarVisible,
750
- bounds = _this.getScrollBounds(),
751
- canScrollHorizontally = _this.canScrollHorizontally(bounds),
752
- canScrollVertically = _this.canScrollVertically(bounds),
753
- curHorizontalScrollbarVisible = horizontalScrollbar === 'auto' ? canScrollHorizontally : horizontalScrollbar === 'visible',
754
- curVerticalScrollbarVisible = verticalScrollbar === 'auto' ? canScrollVertically : verticalScrollbar === 'visible'; // determine if we should hide or show any scrollbars
755
-
756
-
600
+ horizontalScrollbar = _this$props2.horizontalScrollbar,
601
+ verticalScrollbar = _this$props2.verticalScrollbar,
602
+ _this$state = _this.state,
603
+ isHorizontalScrollbarVisible = _this$state.isHorizontalScrollbarVisible,
604
+ isVerticalScrollbarVisible = _this$state.isVerticalScrollbarVisible,
605
+ bounds = _this.getScrollBounds(),
606
+ canScrollHorizontally = _this.canScrollHorizontally(bounds),
607
+ canScrollVertically = _this.canScrollVertically(bounds),
608
+ curHorizontalScrollbarVisible = horizontalScrollbar === 'auto' ? canScrollHorizontally : horizontalScrollbar === 'visible',
609
+ curVerticalScrollbarVisible = verticalScrollbar === 'auto' ? canScrollVertically : verticalScrollbar === 'visible';
610
+
611
+ // determine if we should hide or show any scrollbars
757
612
  var isVisibilityChanged = isHorizontalScrollbarVisible !== curHorizontalScrollbarVisible || isVerticalScrollbarVisible !== curVerticalScrollbarVisible;
758
-
759
613
  if (isVisibilityChanged) {
760
614
  // one or both scrollbars have changed visibility
761
615
  _this.setState({
@@ -767,17 +621,15 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
767
621
  _this.isUpdatedScrollThumb = _this.updateScrollThumbSize();
768
622
  }
769
623
  };
770
-
771
624
  _this.updateScrollThumbSize = function () {
772
625
  var _this$props3 = _this.props,
773
- horizontalScrollbar = _this$props3.horizontalScrollbar,
774
- verticalScrollbar = _this$props3.verticalScrollbar,
775
- bounds = _this.getScrollBounds(),
776
- canScrollHorizontally = _this.canScrollHorizontally(bounds),
777
- canScrollVertically = _this.canScrollVertically(bounds),
778
- curHorizontalScrollbarVisible = horizontalScrollbar === 'auto' ? canScrollHorizontally : horizontalScrollbar === 'visible',
779
- curVerticalScrollbarVisible = verticalScrollbar === 'auto' ? canScrollVertically : verticalScrollbar === 'visible';
780
-
626
+ horizontalScrollbar = _this$props3.horizontalScrollbar,
627
+ verticalScrollbar = _this$props3.verticalScrollbar,
628
+ bounds = _this.getScrollBounds(),
629
+ canScrollHorizontally = _this.canScrollHorizontally(bounds),
630
+ canScrollVertically = _this.canScrollVertically(bounds),
631
+ curHorizontalScrollbarVisible = horizontalScrollbar === 'auto' ? canScrollHorizontally : horizontalScrollbar === 'visible',
632
+ curVerticalScrollbarVisible = verticalScrollbar === 'auto' ? canScrollVertically : verticalScrollbar === 'visible';
781
633
  if (curHorizontalScrollbarVisible || curVerticalScrollbarVisible) {
782
634
  // no visibility change but need to notify whichever scrollbars are visible of the
783
635
  // updated bounds and scroll position
@@ -785,27 +637,21 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
785
637
  scrollLeft: _this.scrollLeft,
786
638
  scrollTop: _this.scrollTop
787
639
  });
788
-
789
640
  if (curHorizontalScrollbarVisible && _this.horizontalScrollbarRef.current) {
790
641
  _this.horizontalScrollbarRef.current.update(updatedBounds);
791
642
  }
792
-
793
643
  if (curVerticalScrollbarVisible && _this.verticalScrollbarRef.current) {
794
644
  _this.verticalScrollbarRef.current.update(updatedBounds);
795
645
  }
796
-
797
646
  return true;
798
647
  }
799
-
800
648
  return false;
801
649
  };
802
-
803
650
  _this.initChildRef = function (ref) {
804
651
  if (ref) {
805
652
  _this.childRefCurrent = ref.current || ref;
806
653
  }
807
654
  };
808
-
809
655
  _this.state = {
810
656
  remeasure: false,
811
657
  isHorizontalScrollbarVisible: props.horizontalScrollbar === 'visible',
@@ -824,14 +670,14 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
824
670
  vertical: true,
825
671
  clientSize: props.clientSize
826
672
  };
827
- _this.overscrollEnabled = !!props.applyOverscrollEffect; // Enable the early bail out of repeated scrolling to the same position
673
+ _this.overscrollEnabled = !!props.applyOverscrollEffect;
828
674
 
675
+ // Enable the early bail out of repeated scrolling to the same position
829
676
  _this.animationInfo = null;
830
677
  _this.resizeRegistry = _Registry["default"].create(_this.handleResize.bind(_assertThisInitialized(_this)));
831
678
  props.cbScrollTo(_this.scrollTo);
832
679
  return _this;
833
680
  }
834
-
835
681
  _createClass(ScrollableBaseNative, [{
836
682
  key: "componentDidMount",
837
683
  value: function componentDidMount() {
@@ -843,10 +689,11 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
843
689
  key: "componentDidUpdate",
844
690
  value: function componentDidUpdate(prevProps, prevState) {
845
691
  var _this$state2 = this.state,
846
- isHorizontalScrollbarVisible = _this$state2.isHorizontalScrollbarVisible,
847
- isVerticalScrollbarVisible = _this$state2.isVerticalScrollbarVisible,
848
- hasDataSizeChanged = this.childRefCurrent.hasDataSizeChanged; // Need to sync calculated client size if it is different from the real size
692
+ isHorizontalScrollbarVisible = _this$state2.isHorizontalScrollbarVisible,
693
+ isVerticalScrollbarVisible = _this$state2.isVerticalScrollbarVisible,
694
+ hasDataSizeChanged = this.childRefCurrent.hasDataSizeChanged;
849
695
 
696
+ // Need to sync calculated client size if it is different from the real size
850
697
  if (this.childRefCurrent.syncClientSize) {
851
698
  // If we actually synced, we need to reset scroll position.
852
699
  if (this.childRefCurrent.syncClientSize()) {
@@ -854,26 +701,22 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
854
701
  this.setScrollTop(0);
855
702
  }
856
703
  }
857
-
858
704
  this.addEventListeners();
859
-
860
705
  if (hasDataSizeChanged === false && (isHorizontalScrollbarVisible && !prevState.isHorizontalScrollbarVisible || isVerticalScrollbarVisible && !prevState.isVerticalScrollbarVisible)) {
861
706
  this.deferScrollTo = false;
862
707
  this.isUpdatedScrollThumb = this.updateScrollThumbSize();
863
708
  } else {
864
709
  this.updateScrollbars();
865
710
  }
866
-
867
711
  if (this.scrollToInfo !== null) {
868
712
  if (!this.deferScrollTo) {
869
713
  this.scrollTo(this.scrollToInfo);
870
714
  }
871
- } // publish container resize changes
872
-
715
+ }
873
716
 
717
+ // publish container resize changes
874
718
  var horizontal = isHorizontalScrollbarVisible !== prevState.isHorizontalScrollbarVisible;
875
719
  var vertical = isVerticalScrollbarVisible !== prevState.isVerticalScrollbarVisible;
876
-
877
720
  if (horizontal || vertical) {
878
721
  this.resizeRegistry.notify({});
879
722
  }
@@ -881,12 +724,11 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
881
724
  }, {
882
725
  key: "componentWillUnmount",
883
726
  value: function componentWillUnmount() {
884
- this.resizeRegistry.parent = null; // Before call cancelAnimationFrame, you must send scrollStop Event.
885
-
727
+ this.resizeRegistry.parent = null;
728
+ // Before call cancelAnimationFrame, you must send scrollStop Event.
886
729
  if (this.scrolling) {
887
730
  this.forwardScrollEvent('onScrollStop', this.getReachedEdgeInfo());
888
731
  }
889
-
890
732
  this.scrollStopJob.stop();
891
733
  this.removeEventListeners();
892
734
  }
@@ -899,13 +741,15 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
899
741
  }
900
742
  }, {
901
743
  key: "enqueueForceUpdate",
902
- value: // TODO: consider replacing forceUpdate() by storing bounds in state rather than a non-
744
+ value:
745
+ // TODO: consider replacing forceUpdate() by storing bounds in state rather than a non-
903
746
  // state member.
904
747
  function enqueueForceUpdate() {
905
748
  this.childRefCurrent.calculateMetrics(this.childRefCurrent.props);
906
749
  this.forceUpdate();
907
- } // constants
750
+ }
908
751
 
752
+ // constants
909
753
  }, {
910
754
  key: "calculateDistanceByWheel",
911
755
  value: function calculateDistanceByWheel(deltaMode, delta, maxPixel) {
@@ -918,18 +762,19 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
918
762
  // page
919
763
  delta = delta < 0 ? -maxPixel : maxPixel;
920
764
  }
921
-
922
765
  return delta;
923
766
  }
767
+
924
768
  /*
925
769
  * wheel event handler;
926
770
  * - for horizontal scroll, supports wheel action on any children nodes since web engine cannot support this
927
771
  * - for vertical scroll, supports wheel action on scrollbars only
928
772
  */
929
-
930
773
  }, {
931
774
  key: "forwardScrollEvent",
932
- value: // call scroll callbacks
775
+ value:
776
+ // call scroll callbacks
777
+
933
778
  function forwardScrollEvent(type, reachedEdgeInfo) {
934
779
  (0, _handle.forward)(type, {
935
780
  type: type,
@@ -938,19 +783,20 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
938
783
  moreInfo: this.getMoreInfo(),
939
784
  reachedEdgeInfo: reachedEdgeInfo
940
785
  }, this.props);
941
- } // call scroll callbacks and update scrollbars for native scroll
786
+ }
942
787
 
788
+ // call scroll callbacks and update scrollbars for native scroll
943
789
  }, {
944
790
  key: "setScrollLeft",
945
- value: // update scroll position
791
+ value:
792
+ // update scroll position
793
+
946
794
  function setScrollLeft(value) {
947
795
  var bounds = this.getScrollBounds();
948
796
  this.scrollLeft = (0, _clamp["default"])(0, bounds.maxLeft, value);
949
-
950
797
  if (this.overscrollEnabled && this.props.overscrollEffectOn[this.lastInputType]) {
951
798
  this.checkAndApplyOverscrollEffectOnScroll('horizontal');
952
799
  }
953
-
954
800
  if (this.state.isHorizontalScrollbarVisible) {
955
801
  this.updateThumb(this.horizontalScrollbarRef, bounds);
956
802
  }
@@ -960,61 +806,56 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
960
806
  value: function setScrollTop(value) {
961
807
  var bounds = this.getScrollBounds();
962
808
  this.scrollTop = (0, _clamp["default"])(0, bounds.maxTop, value);
963
-
964
809
  if (this.overscrollEnabled && this.props.overscrollEffectOn[this.lastInputType]) {
965
810
  this.checkAndApplyOverscrollEffectOnScroll('vertical');
966
811
  }
967
-
968
812
  if (this.state.isVerticalScrollbarVisible) {
969
813
  this.updateThumb(this.verticalScrollbarRef, bounds);
970
814
  }
971
815
  }
972
816
  }, {
973
817
  key: "start",
974
- value: // scroll start
818
+ value:
819
+ // scroll start
820
+
975
821
  function start(_ref) {
976
822
  var targetX = _ref.targetX,
977
- targetY = _ref.targetY,
978
- _ref$animate = _ref.animate,
979
- animate = _ref$animate === void 0 ? true : _ref$animate,
980
- _ref$overscrollEffect = _ref.overscrollEffect,
981
- overscrollEffect = _ref$overscrollEffect === void 0 ? false : _ref$overscrollEffect;
823
+ targetY = _ref.targetY,
824
+ _ref$animate = _ref.animate,
825
+ animate = _ref$animate === void 0 ? true : _ref$animate,
826
+ _ref$overscrollEffect = _ref.overscrollEffect,
827
+ overscrollEffect = _ref$overscrollEffect === void 0 ? false : _ref$overscrollEffect;
982
828
  var scrollLeft = this.scrollLeft,
983
- scrollTop = this.scrollTop,
984
- childRefCurrent = this.childRefCurrent,
985
- childContainerRef = childRefCurrent.containerRef,
986
- bounds = this.getScrollBounds(),
987
- maxLeft = bounds.maxLeft,
988
- maxTop = bounds.maxTop;
829
+ scrollTop = this.scrollTop,
830
+ childRefCurrent = this.childRefCurrent,
831
+ childContainerRef = childRefCurrent.containerRef,
832
+ bounds = this.getScrollBounds(),
833
+ maxLeft = bounds.maxLeft,
834
+ maxTop = bounds.maxTop;
989
835
  var updatedAnimationInfo = {
990
836
  targetX: targetX,
991
837
  targetY: targetY
992
- }; // bail early when scrolling to the same position
838
+ };
993
839
 
840
+ // bail early when scrolling to the same position
994
841
  if (this.scrolling && this.animationInfo && this.animationInfo.targetX === targetX && this.animationInfo.targetY === targetY) {
995
842
  return;
996
843
  }
997
-
998
844
  this.animationInfo = updatedAnimationInfo;
999
-
1000
845
  if (Math.abs(maxLeft - targetX) < epsilon) {
1001
846
  targetX = maxLeft;
1002
847
  }
1003
-
1004
848
  if (Math.abs(maxTop - targetY) < epsilon) {
1005
849
  targetY = maxTop;
1006
850
  }
1007
-
1008
851
  if (this.overscrollEnabled && overscrollEffect) {
1009
852
  if (scrollLeft !== targetX && this.canScrollHorizontally(bounds)) {
1010
853
  this.checkAndApplyOverscrollEffectOnStart('horizontal', this.getEdgeFromPosition(targetX, maxLeft), targetX);
1011
854
  }
1012
-
1013
855
  if (scrollTop !== targetY && this.canScrollVertically(bounds)) {
1014
856
  this.checkAndApplyOverscrollEffectOnStart('vertical', this.getEdgeFromPosition(targetY, maxTop), targetY);
1015
857
  }
1016
858
  }
1017
-
1018
859
  if (animate) {
1019
860
  childRefCurrent.scrollToPosition(targetX, targetY);
1020
861
  } else {
@@ -1022,9 +863,7 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
1022
863
  childRefCurrent.scrollToPosition(targetX, targetY);
1023
864
  childContainerRef.current.style.scrollBehavior = 'smooth';
1024
865
  }
1025
-
1026
866
  this.scrollStopJob.start();
1027
-
1028
867
  if (this.props.start) {
1029
868
  this.props.start(animate);
1030
869
  }
@@ -1033,20 +872,22 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
1033
872
  key: "stop",
1034
873
  value: function stop() {
1035
874
  var childRefCurrent = this.childRefCurrent,
1036
- childContainerRef = childRefCurrent.containerRef;
875
+ childContainerRef = childRefCurrent.containerRef;
1037
876
  childContainerRef.current.style.scrollBehavior = null;
1038
877
  childRefCurrent.scrollToPosition(this.scrollLeft + 0.1, this.scrollTop + 0.1);
1039
878
  childContainerRef.current.style.scrollBehavior = 'smooth';
1040
- } // scrollTo API
879
+ }
1041
880
 
881
+ // scrollTo API
1042
882
  }, {
1043
883
  key: "showThumb",
1044
- value: // scroll bar
884
+ value:
885
+ // scroll bar
886
+
1045
887
  function showThumb(bounds) {
1046
888
  if (this.state.isHorizontalScrollbarVisible && this.canScrollHorizontally(bounds) && this.horizontalScrollbarRef.current) {
1047
889
  this.horizontalScrollbarRef.current.showThumb();
1048
890
  }
1049
-
1050
891
  if (this.state.isVerticalScrollbarVisible && this.canScrollVertically(bounds) && this.verticalScrollbarRef.current) {
1051
892
  this.verticalScrollbarRef.current.showThumb();
1052
893
  }
@@ -1061,7 +902,9 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
1061
902
  }
1062
903
  }, {
1063
904
  key: "getScrollBounds",
1064
- value: // ref
905
+ value:
906
+ // ref
907
+
1065
908
  function getScrollBounds() {
1066
909
  if (this.childRefCurrent && typeof this.childRefCurrent.getScrollBounds === 'function') {
1067
910
  return this.childRefCurrent.getScrollBounds();
@@ -1073,20 +916,19 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
1073
916
  if (this.childRefCurrent && typeof this.childRefCurrent.getMoreInfo === 'function') {
1074
917
  return this.childRefCurrent.getMoreInfo();
1075
918
  }
1076
- } // FIXME setting event handlers directly to work on the V8 snapshot.
919
+ }
1077
920
 
921
+ // FIXME setting event handlers directly to work on the V8 snapshot.
1078
922
  }, {
1079
923
  key: "addEventListeners",
1080
924
  value: function addEventListeners() {
1081
925
  var childRefCurrent = this.childRefCurrent,
1082
- containerRef = this.containerRef;
1083
-
926
+ containerRef = this.containerRef;
1084
927
  if (containerRef.current && containerRef.current.addEventListener) {
1085
928
  containerRef.current.addEventListener('wheel', this.onWheel);
1086
929
  containerRef.current.addEventListener('keydown', this.onKeyDown);
1087
930
  containerRef.current.addEventListener('mousedown', this.onMouseDown);
1088
931
  }
1089
-
1090
932
  if (childRefCurrent.containerRef.current) {
1091
933
  if (childRefCurrent.containerRef.current.addEventListener) {
1092
934
  childRefCurrent.containerRef.current.addEventListener('scroll', this.onScroll, {
@@ -1094,74 +936,68 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
1094
936
  passive: true
1095
937
  });
1096
938
  }
1097
-
1098
939
  this.childRefCurrent.containerRef.current.style.scrollBehavior = 'smooth';
1099
940
  }
1100
-
1101
941
  if (this.props.addEventListeners) {
1102
942
  this.props.addEventListeners(childRefCurrent.containerRef);
1103
943
  }
1104
-
1105
944
  if (window) {
1106
945
  window.addEventListener('resize', this.handleResizeWindow);
1107
946
  }
1108
- } // FIXME setting event handlers directly to work on the V8 snapshot.
947
+ }
1109
948
 
949
+ // FIXME setting event handlers directly to work on the V8 snapshot.
1110
950
  }, {
1111
951
  key: "removeEventListeners",
1112
952
  value: function removeEventListeners() {
1113
953
  var childRefCurrent = this.childRefCurrent,
1114
- containerRef = this.containerRef;
1115
-
954
+ containerRef = this.containerRef;
1116
955
  if (containerRef.current && containerRef.current.removeEventListener) {
1117
956
  containerRef.current.removeEventListener('wheel', this.onWheel);
1118
957
  containerRef.current.removeEventListener('keydown', this.onKeyDown);
1119
958
  containerRef.current.removeEventListener('mousedown', this.onMouseDown);
1120
959
  }
1121
-
1122
960
  if (childRefCurrent.containerRef.current && childRefCurrent.containerRef.current.removeEventListener) {
1123
961
  childRefCurrent.containerRef.current.removeEventListener('scroll', this.onScroll, {
1124
962
  capture: true,
1125
963
  passive: true
1126
964
  });
1127
965
  }
1128
-
1129
966
  if (this.props.removeEventListeners) {
1130
967
  this.props.removeEventListeners(childRefCurrent.containerRef);
1131
968
  }
1132
-
1133
969
  if (window) {
1134
970
  window.removeEventListener('resize', this.handleResizeWindow);
1135
971
  }
1136
- } // render
972
+ }
1137
973
 
974
+ // render
1138
975
  }, {
1139
976
  key: "render",
1140
977
  value: function render() {
1141
978
  var _this$props4 = this.props,
1142
- className = _this$props4.className,
1143
- containerRenderer = _this$props4.containerRenderer,
1144
- noScrollByDrag = _this$props4.noScrollByDrag,
1145
- rtl = _this$props4.rtl,
1146
- style = _this$props4.style,
1147
- rest = _objectWithoutProperties(_this$props4, _excluded),
1148
- _this$state3 = this.state,
1149
- isHorizontalScrollbarVisible = _this$state3.isHorizontalScrollbarVisible,
1150
- isVerticalScrollbarVisible = _this$state3.isVerticalScrollbarVisible,
1151
- scrollableClasses = (0, _classnames["default"])(_ScrollableModule["default"].scrollable, className),
1152
- contentClasses = (0, _classnames["default"])(_ScrollableModule["default"].content, _ScrollableModule["default"].contentNative),
1153
- childWrapper = noScrollByDrag ? 'div' : TouchableDiv,
1154
- childWrapperProps = _objectSpread({
1155
- className: contentClasses
1156
- }, !noScrollByDrag && {
1157
- flickConfig: flickConfig,
1158
- onDrag: this.onDrag,
1159
- onDragEnd: this.onDragEnd,
1160
- onDragStart: this.onDragStart,
1161
- onFlick: this.onFlick,
1162
- onTouchStart: this.onTouchStart
1163
- });
1164
-
979
+ className = _this$props4.className,
980
+ containerRenderer = _this$props4.containerRenderer,
981
+ noScrollByDrag = _this$props4.noScrollByDrag,
982
+ rtl = _this$props4.rtl,
983
+ style = _this$props4.style,
984
+ rest = _objectWithoutProperties(_this$props4, _excluded),
985
+ _this$state3 = this.state,
986
+ isHorizontalScrollbarVisible = _this$state3.isHorizontalScrollbarVisible,
987
+ isVerticalScrollbarVisible = _this$state3.isVerticalScrollbarVisible,
988
+ scrollableClasses = (0, _classnames["default"])(_ScrollableModule["default"].scrollable, className),
989
+ contentClasses = (0, _classnames["default"])(_ScrollableModule["default"].content, _ScrollableModule["default"].contentNative),
990
+ childWrapper = noScrollByDrag ? 'div' : TouchableDiv,
991
+ childWrapperProps = _objectSpread({
992
+ className: contentClasses
993
+ }, !noScrollByDrag && {
994
+ flickConfig: flickConfig,
995
+ onDrag: this.onDrag,
996
+ onDragEnd: this.onDragEnd,
997
+ onDragStart: this.onDragStart,
998
+ onFlick: this.onFlick,
999
+ onTouchStart: this.onTouchStart
1000
+ });
1165
1001
  delete rest.addEventListeners;
1166
1002
  delete rest.applyOverscrollEffect;
1167
1003
  delete rest.cbScrollTo;
@@ -1204,7 +1040,6 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
1204
1040
  });
1205
1041
  }
1206
1042
  }]);
1207
-
1208
1043
  return ScrollableBaseNative;
1209
1044
  }(_react.Component);
1210
1045
  /**
@@ -1216,13 +1051,9 @@ var ScrollableBaseNative = /*#__PURE__*/function (_Component) {
1216
1051
  * @ui
1217
1052
  * @private
1218
1053
  */
1219
-
1220
-
1221
1054
  exports.ScrollableBaseNative = ScrollableBaseNative;
1222
1055
  ScrollableBaseNative.displayName = 'ui:ScrollableBaseNative';
1223
- ScrollableBaseNative.propTypes =
1224
- /** @lends ui/ScrollableNative.ScrollableNative.prototype */
1225
- {
1056
+ ScrollableBaseNative.propTypes = /** @lends ui/ScrollableNative.ScrollableNative.prototype */{
1226
1057
  /**
1227
1058
  * Render function.
1228
1059
  *
@@ -1231,7 +1062,6 @@ ScrollableBaseNative.propTypes =
1231
1062
  * @private
1232
1063
  */
1233
1064
  containerRenderer: _propTypes["default"].func.isRequired,
1234
-
1235
1065
  /**
1236
1066
  * Called when adding additional event listeners in a themed component.
1237
1067
  *
@@ -1239,7 +1069,6 @@ ScrollableBaseNative.propTypes =
1239
1069
  * @private
1240
1070
  */
1241
1071
  addEventListeners: _propTypes["default"].func,
1242
-
1243
1072
  /**
1244
1073
  * Called to execute additional logic in a themed component to show overscroll effect.
1245
1074
  *
@@ -1247,7 +1076,6 @@ ScrollableBaseNative.propTypes =
1247
1076
  * @private
1248
1077
  */
1249
1078
  applyOverscrollEffect: _propTypes["default"].func,
1250
-
1251
1079
  /**
1252
1080
  * A callback function that receives a reference to the `scrollTo` feature.
1253
1081
  *
@@ -1279,7 +1107,6 @@ ScrollableBaseNative.propTypes =
1279
1107
  * @public
1280
1108
  */
1281
1109
  cbScrollTo: _propTypes["default"].func,
1282
-
1283
1110
  /**
1284
1111
  * Called to execute additional logic in a themed component to clear overscroll effect.
1285
1112
  *
@@ -1287,7 +1114,6 @@ ScrollableBaseNative.propTypes =
1287
1114
  * @private
1288
1115
  */
1289
1116
  clearOverscrollEffect: _propTypes["default"].func,
1290
-
1291
1117
  /**
1292
1118
  * Client size of the container; valid values are an object that has `clientWidth` and `clientHeight`.
1293
1119
  *
@@ -1300,7 +1126,6 @@ ScrollableBaseNative.propTypes =
1300
1126
  clientHeight: _propTypes["default"].number.isRequired,
1301
1127
  clientWidth: _propTypes["default"].number.isRequired
1302
1128
  }),
1303
-
1304
1129
  /**
1305
1130
  * Direction of the list or the scroller.
1306
1131
  *
@@ -1315,7 +1140,6 @@ ScrollableBaseNative.propTypes =
1315
1140
  * @private
1316
1141
  */
1317
1142
  direction: _propTypes["default"].oneOf(['both', 'horizontal', 'vertical']),
1318
-
1319
1143
  /**
1320
1144
  * Called when resizing window
1321
1145
  *
@@ -1323,7 +1147,6 @@ ScrollableBaseNative.propTypes =
1323
1147
  * @private
1324
1148
  */
1325
1149
  handleResizeWindow: _propTypes["default"].func,
1326
-
1327
1150
  /**
1328
1151
  * Specifies how to show horizontal scrollbar.
1329
1152
  *
@@ -1337,7 +1160,6 @@ ScrollableBaseNative.propTypes =
1337
1160
  * @public
1338
1161
  */
1339
1162
  horizontalScrollbar: _propTypes["default"].oneOf(['auto', 'visible', 'hidden']),
1340
-
1341
1163
  /**
1342
1164
  * Prevents scroll by dragging or flicking on the list or the scroller.
1343
1165
  *
@@ -1346,7 +1168,6 @@ ScrollableBaseNative.propTypes =
1346
1168
  * @private
1347
1169
  */
1348
1170
  noScrollByDrag: _propTypes["default"].bool,
1349
-
1350
1171
  /**
1351
1172
  * Prevents scroll by wheeling on the list or the scroller.
1352
1173
  *
@@ -1355,7 +1176,6 @@ ScrollableBaseNative.propTypes =
1355
1176
  * @public
1356
1177
  */
1357
1178
  noScrollByWheel: _propTypes["default"].bool,
1358
-
1359
1179
  /**
1360
1180
  * Called when flicking with a mouse or a touch screen.
1361
1181
  *
@@ -1363,7 +1183,6 @@ ScrollableBaseNative.propTypes =
1363
1183
  * @private
1364
1184
  */
1365
1185
  onFlick: _propTypes["default"].func,
1366
-
1367
1186
  /**
1368
1187
  * Called when pressing a key.
1369
1188
  *
@@ -1371,7 +1190,6 @@ ScrollableBaseNative.propTypes =
1371
1190
  * @private
1372
1191
  */
1373
1192
  onKeyDown: _propTypes["default"].func,
1374
-
1375
1193
  /**
1376
1194
  * Called when triggering a mousedown event.
1377
1195
  *
@@ -1379,7 +1197,6 @@ ScrollableBaseNative.propTypes =
1379
1197
  * @private
1380
1198
  */
1381
1199
  onMouseDown: _propTypes["default"].func,
1382
-
1383
1200
  /**
1384
1201
  * Called when scrolling.
1385
1202
  *
@@ -1395,7 +1212,6 @@ ScrollableBaseNative.propTypes =
1395
1212
  * @public
1396
1213
  */
1397
1214
  onScroll: _propTypes["default"].func,
1398
-
1399
1215
  /**
1400
1216
  * Called when scroll starts.
1401
1217
  *
@@ -1426,7 +1242,6 @@ ScrollableBaseNative.propTypes =
1426
1242
  * @public
1427
1243
  */
1428
1244
  onScrollStart: _propTypes["default"].func,
1429
-
1430
1245
  /**
1431
1246
  * Called when scroll stops.
1432
1247
  *
@@ -1457,7 +1272,6 @@ ScrollableBaseNative.propTypes =
1457
1272
  * @public
1458
1273
  */
1459
1274
  onScrollStop: _propTypes["default"].func,
1460
-
1461
1275
  /**
1462
1276
  * Called when wheeling.
1463
1277
  *
@@ -1465,7 +1279,6 @@ ScrollableBaseNative.propTypes =
1465
1279
  * @private
1466
1280
  */
1467
1281
  onWheel: _propTypes["default"].func,
1468
-
1469
1282
  /**
1470
1283
  * Specifies overscroll effects shows on which type of inputs.
1471
1284
  *
@@ -1478,7 +1291,6 @@ ScrollableBaseNative.propTypes =
1478
1291
  pageKey: _propTypes["default"].bool,
1479
1292
  wheel: _propTypes["default"].bool
1480
1293
  }),
1481
-
1482
1294
  /**
1483
1295
  * Called when removing additional event listeners in a themed component.
1484
1296
  *
@@ -1486,7 +1298,6 @@ ScrollableBaseNative.propTypes =
1486
1298
  * @private
1487
1299
  */
1488
1300
  removeEventListeners: _propTypes["default"].func,
1489
-
1490
1301
  /**
1491
1302
  * Indicates the content's text direction is right-to-left.
1492
1303
  *
@@ -1494,7 +1305,6 @@ ScrollableBaseNative.propTypes =
1494
1305
  * @private
1495
1306
  */
1496
1307
  rtl: _propTypes["default"].bool,
1497
-
1498
1308
  /**
1499
1309
  * Called to execute additional logic in a themed component after scrolling.
1500
1310
  *
@@ -1502,7 +1312,6 @@ ScrollableBaseNative.propTypes =
1502
1312
  * @private
1503
1313
  */
1504
1314
  scrollStopOnScroll: _propTypes["default"].func,
1505
-
1506
1315
  /**
1507
1316
  * Called to execute additional logic in a themed component when scrollTo is called.
1508
1317
  *
@@ -1510,7 +1319,6 @@ ScrollableBaseNative.propTypes =
1510
1319
  * @private
1511
1320
  */
1512
1321
  scrollTo: _propTypes["default"].func,
1513
-
1514
1322
  /**
1515
1323
  * Called to execute additional logic in a themed component when scroll starts.
1516
1324
  *
@@ -1518,7 +1326,6 @@ ScrollableBaseNative.propTypes =
1518
1326
  * @private
1519
1327
  */
1520
1328
  start: _propTypes["default"].func,
1521
-
1522
1329
  /**
1523
1330
  * Specifies how to show vertical scrollbar.
1524
1331
  *
@@ -1549,41 +1356,35 @@ ScrollableBaseNative.defaultProps = {
1549
1356
  verticalScrollbar: 'auto'
1550
1357
  };
1551
1358
  ScrollableBaseNative.contextType = _Resizable.ResizeContext;
1552
-
1553
1359
  var ScrollableNative = /*#__PURE__*/function (_Component2) {
1554
1360
  _inherits(ScrollableNative, _Component2);
1555
-
1556
1361
  var _super2 = _createSuper(ScrollableNative);
1557
-
1558
1362
  function ScrollableNative() {
1559
1363
  _classCallCheck(this, ScrollableNative);
1560
-
1561
1364
  return _super2.apply(this, arguments);
1562
1365
  }
1563
-
1564
1366
  _createClass(ScrollableNative, [{
1565
1367
  key: "render",
1566
1368
  value: function render() {
1567
1369
  var _this$props5 = this.props,
1568
- childRenderer = _this$props5.childRenderer,
1569
- rest = _objectWithoutProperties(_this$props5, _excluded2);
1570
-
1370
+ childRenderer = _this$props5.childRenderer,
1371
+ rest = _objectWithoutProperties(_this$props5, _excluded2);
1571
1372
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScrollableBaseNative, _objectSpread(_objectSpread({}, rest), {}, {
1572
1373
  containerRenderer: function containerRenderer(_ref2) {
1573
1374
  var childComponentProps = _ref2.childComponentProps,
1574
- ChildWrapper = _ref2.childWrapper,
1575
- childWrapperProps = _ref2.childWrapperProps,
1576
- className = _ref2.className,
1577
- componentCss = _ref2.componentCss,
1578
- containerRef = _ref2.containerRef,
1579
- horizontalScrollbarProps = _ref2.horizontalScrollbarProps,
1580
- initChildRef = _ref2.initChildRef,
1581
- isHorizontalScrollbarVisible = _ref2.isHorizontalScrollbarVisible,
1582
- isVerticalScrollbarVisible = _ref2.isVerticalScrollbarVisible,
1583
- rtl = _ref2.rtl,
1584
- scrollTo = _ref2.scrollTo,
1585
- style = _ref2.style,
1586
- verticalScrollbarProps = _ref2.verticalScrollbarProps;
1375
+ ChildWrapper = _ref2.childWrapper,
1376
+ childWrapperProps = _ref2.childWrapperProps,
1377
+ className = _ref2.className,
1378
+ componentCss = _ref2.componentCss,
1379
+ containerRef = _ref2.containerRef,
1380
+ horizontalScrollbarProps = _ref2.horizontalScrollbarProps,
1381
+ initChildRef = _ref2.initChildRef,
1382
+ isHorizontalScrollbarVisible = _ref2.isHorizontalScrollbarVisible,
1383
+ isVerticalScrollbarVisible = _ref2.isVerticalScrollbarVisible,
1384
+ rtl = _ref2.rtl,
1385
+ scrollTo = _ref2.scrollTo,
1386
+ style = _ref2.style,
1387
+ verticalScrollbarProps = _ref2.verticalScrollbarProps;
1587
1388
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1588
1389
  className: className,
1589
1390
  ref: containerRef,
@@ -1609,15 +1410,11 @@ var ScrollableNative = /*#__PURE__*/function (_Component2) {
1609
1410
  }));
1610
1411
  }
1611
1412
  }]);
1612
-
1613
1413
  return ScrollableNative;
1614
1414
  }(_react.Component);
1615
-
1616
1415
  exports.ScrollableNative = ScrollableNative;
1617
1416
  ScrollableNative.displayName = 'ui:ScrollableNative';
1618
- ScrollableNative.propTypes =
1619
- /** @lends ui/ScrollableNative.ScrollableNative.prototype */
1620
- {
1417
+ ScrollableNative.propTypes = /** @lends ui/ScrollableNative.ScrollableNative.prototype */{
1621
1418
  /**
1622
1419
  * Render function.
1623
1420
  *