@enact/ui 4.5.2 → 4.5.3
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 +6 -26
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +26 -56
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +4 -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/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 +17 -50
- package/Group/Group.js +4 -35
- package/Group/GroupItem.js +15 -32
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +7 -35
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.js +14 -48
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +12 -50
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +16 -45
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +17 -46
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +8 -32
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.js +19 -50
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +11 -37
- package/Layout/Layout.js +14 -37
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +62 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +258 -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 +0 -4
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +13 -44
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +1 -29
- package/RadioDecorator/RadioDecorator.js +4 -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 +7 -35
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +8 -44
- package/Routable/Routable.js +10 -33
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +13 -56
- 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 +179 -386
- package/Scrollable/ScrollableNative.js +188 -391
- package/Scrollable/Scrollbar.js +28 -100
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +31 -84
- 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 +26 -64
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +15 -41
- 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 +15 -42
- 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 +15 -52
- 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/Touch.js +37 -65
- package/Touchable/Touchable.js +32 -71
- package/Touchable/config.js +8 -22
- package/Touchable/tests/Touchable-specs.js +270 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +17 -34
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +31 -106
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.js +19 -83
- 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 +256 -406
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +270 -428
- package/VirtualList/tests/VirtualList-specs.js +9 -37
- 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 +7 -22
- 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 +8 -2
- 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
|
@@ -4,55 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ScrollerBasic = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
-
|
|
10
8
|
var _platform = require("@enact/core/platform");
|
|
11
|
-
|
|
12
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _react = require("react");
|
|
17
|
-
|
|
18
12
|
var _ScrollerModule = _interopRequireDefault(require("./Scroller.module.css"));
|
|
19
|
-
|
|
20
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["className", "style"];
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
37
|
-
|
|
38
22
|
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); } }
|
|
39
|
-
|
|
40
23
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
41
|
-
|
|
42
24
|
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); }
|
|
43
|
-
|
|
44
25
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
-
|
|
46
26
|
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); }; }
|
|
47
|
-
|
|
48
27
|
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); }
|
|
49
|
-
|
|
50
28
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
51
|
-
|
|
52
29
|
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; } }
|
|
53
|
-
|
|
54
30
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
55
|
-
|
|
56
31
|
/**
|
|
57
32
|
* An unstyled base scroller component.
|
|
58
33
|
*
|
|
@@ -63,18 +38,13 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
63
38
|
*/
|
|
64
39
|
var ScrollerBasic = /*#__PURE__*/function (_Component) {
|
|
65
40
|
_inherits(ScrollerBasic, _Component);
|
|
66
|
-
|
|
67
41
|
var _super = _createSuper(ScrollerBasic);
|
|
68
|
-
|
|
69
42
|
function ScrollerBasic() {
|
|
70
43
|
var _this;
|
|
71
|
-
|
|
72
44
|
_classCallCheck(this, ScrollerBasic);
|
|
73
|
-
|
|
74
45
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
75
46
|
args[_key] = arguments[_key];
|
|
76
47
|
}
|
|
77
|
-
|
|
78
48
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
79
49
|
_this.scrollBounds = {
|
|
80
50
|
clientWidth: 0,
|
|
@@ -88,34 +58,29 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
|
|
|
88
58
|
top: 0,
|
|
89
59
|
left: 0
|
|
90
60
|
};
|
|
91
|
-
|
|
92
61
|
_this.getScrollBounds = function () {
|
|
93
62
|
return _this.scrollBounds;
|
|
94
63
|
};
|
|
95
|
-
|
|
96
64
|
_this.getRtlPositionX = function (x) {
|
|
97
65
|
if (_this.props.rtl) {
|
|
98
66
|
return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
|
|
99
67
|
}
|
|
100
|
-
|
|
101
68
|
return x;
|
|
102
69
|
};
|
|
103
|
-
|
|
104
70
|
_this.getNodePosition = function (node) {
|
|
105
71
|
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
72
|
+
nodeLeft = _node$getBoundingClie.left,
|
|
73
|
+
nodeTop = _node$getBoundingClie.top,
|
|
74
|
+
nodeHeight = _node$getBoundingClie.height,
|
|
75
|
+
nodeWidth = _node$getBoundingClie.width,
|
|
76
|
+
_this$props$scrollCon = _this.props.scrollContentRef.current.getBoundingClientRect(),
|
|
77
|
+
containerLeft = _this$props$scrollCon.left,
|
|
78
|
+
containerTop = _this$props$scrollCon.top,
|
|
79
|
+
_this$props$scrollCon2 = _this.props.scrollContentRef.current,
|
|
80
|
+
scrollLeft = _this$props$scrollCon2.scrollLeft,
|
|
81
|
+
scrollTop = _this$props$scrollCon2.scrollTop,
|
|
82
|
+
left = _this.isHorizontal() ? scrollLeft + nodeLeft - containerLeft : null,
|
|
83
|
+
top = _this.isVertical() ? scrollTop + nodeTop - containerTop : null;
|
|
119
84
|
return {
|
|
120
85
|
left: left,
|
|
121
86
|
top: top,
|
|
@@ -123,39 +88,29 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
|
|
|
123
88
|
height: nodeHeight
|
|
124
89
|
};
|
|
125
90
|
};
|
|
126
|
-
|
|
127
91
|
_this.isVertical = function () {
|
|
128
92
|
return _this.props.direction !== 'horizontal';
|
|
129
93
|
};
|
|
130
|
-
|
|
131
94
|
_this.isHorizontal = function () {
|
|
132
95
|
return _this.props.direction !== 'vertical';
|
|
133
96
|
};
|
|
134
|
-
|
|
135
97
|
_this.syncClientSize = function () {
|
|
136
98
|
var node = _this.props.scrollContentRef.current;
|
|
137
|
-
|
|
138
99
|
if (!node) {
|
|
139
100
|
return false;
|
|
140
101
|
}
|
|
141
|
-
|
|
142
102
|
var clientWidth = node.clientWidth,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
103
|
+
clientHeight = node.clientHeight,
|
|
104
|
+
_assertThisInitialize = _assertThisInitialized(_this),
|
|
105
|
+
scrollBounds = _assertThisInitialize.scrollBounds;
|
|
147
106
|
if (clientWidth !== scrollBounds.clientWidth || clientHeight !== scrollBounds.clientHeight) {
|
|
148
107
|
_this.calculateMetrics();
|
|
149
|
-
|
|
150
108
|
return true;
|
|
151
109
|
}
|
|
152
|
-
|
|
153
110
|
return false;
|
|
154
111
|
};
|
|
155
|
-
|
|
156
112
|
return _this;
|
|
157
113
|
}
|
|
158
|
-
|
|
159
114
|
_createClass(ScrollerBasic, [{
|
|
160
115
|
key: "componentDidMount",
|
|
161
116
|
value: function componentDidMount() {
|
|
@@ -165,28 +120,27 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
|
|
|
165
120
|
key: "componentDidUpdate",
|
|
166
121
|
value: function componentDidUpdate(prevProps) {
|
|
167
122
|
this.calculateMetrics();
|
|
168
|
-
|
|
169
123
|
if (this.props.isVerticalScrollbarVisible && !prevProps.isVerticalScrollbarVisible) {
|
|
170
124
|
this.forceUpdate();
|
|
171
125
|
}
|
|
172
126
|
}
|
|
173
127
|
}, {
|
|
174
128
|
key: "setScrollPosition",
|
|
175
|
-
value:
|
|
129
|
+
value:
|
|
130
|
+
// scrollMode 'translate'
|
|
176
131
|
function setScrollPosition(x, y) {
|
|
177
132
|
var node = this.props.scrollContentRef.current;
|
|
178
|
-
|
|
179
133
|
if (this.isVertical()) {
|
|
180
134
|
node.scrollTop = y;
|
|
181
135
|
this.scrollPos.top = y;
|
|
182
136
|
}
|
|
183
|
-
|
|
184
137
|
if (this.isHorizontal()) {
|
|
185
138
|
node.scrollLeft = this.getRtlPositionX(x);
|
|
186
139
|
this.scrollPos.left = x;
|
|
187
140
|
}
|
|
188
|
-
}
|
|
141
|
+
}
|
|
189
142
|
|
|
143
|
+
// scrollMode 'native'
|
|
190
144
|
}, {
|
|
191
145
|
key: "scrollToPosition",
|
|
192
146
|
value: function scrollToPosition(left, top, behavior) {
|
|
@@ -195,8 +149,9 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
|
|
|
195
149
|
top: top,
|
|
196
150
|
behavior: behavior
|
|
197
151
|
});
|
|
198
|
-
}
|
|
152
|
+
}
|
|
199
153
|
|
|
154
|
+
// scrollMode 'native'
|
|
200
155
|
}, {
|
|
201
156
|
key: "didScroll",
|
|
202
157
|
value: function didScroll(x, y) {
|
|
@@ -207,11 +162,11 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
|
|
|
207
162
|
key: "calculateMetrics",
|
|
208
163
|
value: function calculateMetrics() {
|
|
209
164
|
var scrollBounds = this.scrollBounds,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
165
|
+
_this$props$scrollCon3 = this.props.scrollContentRef.current,
|
|
166
|
+
scrollWidth = _this$props$scrollCon3.scrollWidth,
|
|
167
|
+
scrollHeight = _this$props$scrollCon3.scrollHeight,
|
|
168
|
+
clientWidth = _this$props$scrollCon3.clientWidth,
|
|
169
|
+
clientHeight = _this$props$scrollCon3.clientHeight;
|
|
215
170
|
scrollBounds.scrollWidth = scrollWidth;
|
|
216
171
|
scrollBounds.scrollHeight = scrollHeight;
|
|
217
172
|
scrollBounds.clientWidth = clientWidth;
|
|
@@ -223,14 +178,13 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
|
|
|
223
178
|
key: "render",
|
|
224
179
|
value: function render() {
|
|
225
180
|
var _this$props = this.props,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
181
|
+
className = _this$props.className,
|
|
182
|
+
style = _this$props.style,
|
|
183
|
+
rest = _objectWithoutProperties(_this$props, _excluded),
|
|
184
|
+
mergedStyle = Object.assign({}, style, {
|
|
185
|
+
overflowX: this.isHorizontal() ? 'auto' : 'hidden',
|
|
186
|
+
overflowY: this.isVertical() ? 'auto' : 'hidden'
|
|
187
|
+
});
|
|
234
188
|
delete rest.cbScrollTo;
|
|
235
189
|
delete rest.direction;
|
|
236
190
|
delete rest.isHorizontalScrollbarVisible;
|
|
@@ -247,17 +201,12 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
|
|
|
247
201
|
}));
|
|
248
202
|
}
|
|
249
203
|
}]);
|
|
250
|
-
|
|
251
204
|
return ScrollerBasic;
|
|
252
205
|
}(_react.Component);
|
|
253
|
-
|
|
254
206
|
exports.ScrollerBasic = ScrollerBasic;
|
|
255
207
|
ScrollerBasic.displayName = 'ui:ScrollerBasic';
|
|
256
|
-
ScrollerBasic.propTypes =
|
|
257
|
-
/** @lends ui/Scroller.ScrollerBasic.prototype */
|
|
258
|
-
{
|
|
208
|
+
ScrollerBasic.propTypes = /** @lends ui/Scroller.ScrollerBasic.prototype */{
|
|
259
209
|
children: _propTypes2["default"].node.isRequired,
|
|
260
|
-
|
|
261
210
|
/**
|
|
262
211
|
* Callback method of scrollTo.
|
|
263
212
|
* Normally, `useScroll` should set this value.
|
|
@@ -266,7 +215,6 @@ ScrollerBasic.propTypes =
|
|
|
266
215
|
* @private
|
|
267
216
|
*/
|
|
268
217
|
cbScrollTo: _propTypes2["default"].func,
|
|
269
|
-
|
|
270
218
|
/**
|
|
271
219
|
* Direction of the scroller.
|
|
272
220
|
*
|
|
@@ -280,7 +228,6 @@ ScrollerBasic.propTypes =
|
|
|
280
228
|
* @public
|
|
281
229
|
*/
|
|
282
230
|
direction: _propTypes2["default"].oneOf(['both', 'horizontal', 'vertical']),
|
|
283
|
-
|
|
284
231
|
/**
|
|
285
232
|
* Prop to check context value if Scrollbar exists or not.
|
|
286
233
|
*
|
|
@@ -288,7 +235,6 @@ ScrollerBasic.propTypes =
|
|
|
288
235
|
* @private
|
|
289
236
|
*/
|
|
290
237
|
isVerticalScrollbarVisible: _propTypes2["default"].bool,
|
|
291
|
-
|
|
292
238
|
/**
|
|
293
239
|
* `true` if RTL, `false` if LTR.
|
|
294
240
|
*
|
|
@@ -296,7 +242,6 @@ ScrollerBasic.propTypes =
|
|
|
296
242
|
* @private
|
|
297
243
|
*/
|
|
298
244
|
rtl: _propTypes2["default"].bool,
|
|
299
|
-
|
|
300
245
|
/**
|
|
301
246
|
* Ref for scroll content
|
|
302
247
|
*
|
|
@@ -4,53 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ScrollerBase = void 0;
|
|
7
|
-
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
8
|
var _platform = require("@enact/core/platform");
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _react = require("react");
|
|
15
|
-
|
|
16
11
|
var _UiScrollerModule = _interopRequireDefault(require("./UiScroller.module.css"));
|
|
17
|
-
|
|
18
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
|
|
20
13
|
var _excluded = ["className", "style"];
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
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; }
|
|
33
|
-
|
|
34
20
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
|
-
|
|
36
21
|
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); } }
|
|
37
|
-
|
|
38
22
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
39
|
-
|
|
40
23
|
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); }
|
|
41
|
-
|
|
42
24
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
|
-
|
|
44
25
|
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); }; }
|
|
45
|
-
|
|
46
26
|
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); }
|
|
47
|
-
|
|
48
27
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
-
|
|
50
28
|
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; } }
|
|
51
|
-
|
|
52
29
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
53
|
-
|
|
54
30
|
/**
|
|
55
31
|
* An unstyled base scroller component.
|
|
56
32
|
*
|
|
@@ -63,14 +39,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
63
39
|
*/
|
|
64
40
|
var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
65
41
|
_inherits(ScrollerBase, _Component);
|
|
66
|
-
|
|
67
42
|
var _super = _createSuper(ScrollerBase);
|
|
68
|
-
|
|
69
43
|
function ScrollerBase(props) {
|
|
70
44
|
var _this;
|
|
71
|
-
|
|
72
45
|
_classCallCheck(this, ScrollerBase);
|
|
73
|
-
|
|
74
46
|
_this = _super.call(this, props);
|
|
75
47
|
_this.scrollBounds = {
|
|
76
48
|
clientWidth: 0,
|
|
@@ -84,34 +56,29 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
84
56
|
top: 0,
|
|
85
57
|
left: 0
|
|
86
58
|
};
|
|
87
|
-
|
|
88
59
|
_this.getScrollBounds = function () {
|
|
89
60
|
return _this.scrollBounds;
|
|
90
61
|
};
|
|
91
|
-
|
|
92
62
|
_this.getRtlPositionX = function (x) {
|
|
93
63
|
if (_this.props.rtl) {
|
|
94
64
|
return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
|
|
95
65
|
}
|
|
96
|
-
|
|
97
66
|
return x;
|
|
98
67
|
};
|
|
99
|
-
|
|
100
68
|
_this.getNodePosition = function (node) {
|
|
101
69
|
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
70
|
+
nodeLeft = _node$getBoundingClie.left,
|
|
71
|
+
nodeTop = _node$getBoundingClie.top,
|
|
72
|
+
nodeHeight = _node$getBoundingClie.height,
|
|
73
|
+
nodeWidth = _node$getBoundingClie.width,
|
|
74
|
+
_this$containerRef$cu = _this.containerRef.current.getBoundingClientRect(),
|
|
75
|
+
containerLeft = _this$containerRef$cu.left,
|
|
76
|
+
containerTop = _this$containerRef$cu.top,
|
|
77
|
+
_this$containerRef$cu2 = _this.containerRef.current,
|
|
78
|
+
scrollLeft = _this$containerRef$cu2.scrollLeft,
|
|
79
|
+
scrollTop = _this$containerRef$cu2.scrollTop,
|
|
80
|
+
left = _this.isHorizontal() ? scrollLeft + nodeLeft - containerLeft : null,
|
|
81
|
+
top = _this.isVertical() ? scrollTop + nodeTop - containerTop : null;
|
|
115
82
|
return {
|
|
116
83
|
left: left,
|
|
117
84
|
top: top,
|
|
@@ -119,19 +86,15 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
119
86
|
height: nodeHeight
|
|
120
87
|
};
|
|
121
88
|
};
|
|
122
|
-
|
|
123
89
|
_this.isVertical = function () {
|
|
124
90
|
return _this.props.direction !== 'horizontal';
|
|
125
91
|
};
|
|
126
|
-
|
|
127
92
|
_this.isHorizontal = function () {
|
|
128
93
|
return _this.props.direction !== 'vertical';
|
|
129
94
|
};
|
|
130
|
-
|
|
131
95
|
_this.containerRef = /*#__PURE__*/(0, _react.createRef)();
|
|
132
96
|
return _this;
|
|
133
97
|
}
|
|
134
|
-
|
|
135
98
|
_createClass(ScrollerBase, [{
|
|
136
99
|
key: "componentDidMount",
|
|
137
100
|
value: function componentDidMount() {
|
|
@@ -141,34 +104,34 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
141
104
|
key: "componentDidUpdate",
|
|
142
105
|
value: function componentDidUpdate(prevProps) {
|
|
143
106
|
this.calculateMetrics();
|
|
144
|
-
|
|
145
107
|
if (this.props.isVerticalScrollbarVisible && !prevProps.isVerticalScrollbarVisible) {
|
|
146
108
|
this.forceUpdate();
|
|
147
109
|
}
|
|
148
110
|
}
|
|
149
111
|
}, {
|
|
150
112
|
key: "setScrollPosition",
|
|
151
|
-
value:
|
|
113
|
+
value:
|
|
114
|
+
// for Scrollable
|
|
152
115
|
function setScrollPosition(x, y) {
|
|
153
116
|
var node = this.containerRef.current;
|
|
154
|
-
|
|
155
117
|
if (this.isVertical()) {
|
|
156
118
|
node.scrollTop = y;
|
|
157
119
|
this.scrollPos.top = y;
|
|
158
120
|
}
|
|
159
|
-
|
|
160
121
|
if (this.isHorizontal()) {
|
|
161
122
|
node.scrollLeft = this.getRtlPositionX(x);
|
|
162
123
|
this.scrollPos.left = x;
|
|
163
124
|
}
|
|
164
|
-
}
|
|
125
|
+
}
|
|
165
126
|
|
|
127
|
+
// for ScrollableNative
|
|
166
128
|
}, {
|
|
167
129
|
key: "scrollToPosition",
|
|
168
130
|
value: function scrollToPosition(x, y) {
|
|
169
131
|
this.containerRef.current.scrollTo(this.getRtlPositionX(x), y);
|
|
170
|
-
}
|
|
132
|
+
}
|
|
171
133
|
|
|
134
|
+
// for ScrollableNative
|
|
172
135
|
}, {
|
|
173
136
|
key: "didScroll",
|
|
174
137
|
value: function didScroll(x, y) {
|
|
@@ -179,11 +142,11 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
179
142
|
key: "calculateMetrics",
|
|
180
143
|
value: function calculateMetrics() {
|
|
181
144
|
var scrollBounds = this.scrollBounds,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
145
|
+
_this$containerRef$cu3 = this.containerRef.current,
|
|
146
|
+
scrollWidth = _this$containerRef$cu3.scrollWidth,
|
|
147
|
+
scrollHeight = _this$containerRef$cu3.scrollHeight,
|
|
148
|
+
clientWidth = _this$containerRef$cu3.clientWidth,
|
|
149
|
+
clientHeight = _this$containerRef$cu3.clientHeight;
|
|
187
150
|
scrollBounds.scrollWidth = scrollWidth;
|
|
188
151
|
scrollBounds.scrollHeight = scrollHeight;
|
|
189
152
|
scrollBounds.clientWidth = clientWidth;
|
|
@@ -195,14 +158,13 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
195
158
|
key: "render",
|
|
196
159
|
value: function render() {
|
|
197
160
|
var _this$props = this.props,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
161
|
+
className = _this$props.className,
|
|
162
|
+
style = _this$props.style,
|
|
163
|
+
rest = _objectWithoutProperties(_this$props, _excluded),
|
|
164
|
+
mergedStyle = Object.assign({}, style, {
|
|
165
|
+
overflowX: this.isHorizontal() ? 'auto' : 'hidden',
|
|
166
|
+
overflowY: this.isVertical() ? 'auto' : 'hidden'
|
|
167
|
+
});
|
|
206
168
|
delete rest.cbScrollTo;
|
|
207
169
|
delete rest.direction;
|
|
208
170
|
delete rest.isHorizontalScrollbarVisible;
|
|
@@ -215,7 +177,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
215
177
|
}));
|
|
216
178
|
}
|
|
217
179
|
}]);
|
|
218
|
-
|
|
219
180
|
return ScrollerBase;
|
|
220
181
|
}(_react.Component);
|
|
221
182
|
/**
|
|
@@ -248,7 +209,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
248
209
|
* @type {Function}
|
|
249
210
|
* @public
|
|
250
211
|
*/
|
|
251
|
-
|
|
252
212
|
/**
|
|
253
213
|
* Specifies how to show horizontal scrollbar.
|
|
254
214
|
*
|
|
@@ -263,7 +223,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
263
223
|
* @default 'auto'
|
|
264
224
|
* @public
|
|
265
225
|
*/
|
|
266
|
-
|
|
267
226
|
/**
|
|
268
227
|
* Prevents scroll by wheeling on the scroller.
|
|
269
228
|
*
|
|
@@ -273,7 +232,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
273
232
|
* @default false
|
|
274
233
|
* @public
|
|
275
234
|
*/
|
|
276
|
-
|
|
277
235
|
/**
|
|
278
236
|
* Called when scrolling.
|
|
279
237
|
*
|
|
@@ -290,7 +248,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
290
248
|
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
291
249
|
* @public
|
|
292
250
|
*/
|
|
293
|
-
|
|
294
251
|
/**
|
|
295
252
|
* Called when scroll starts.
|
|
296
253
|
*
|
|
@@ -320,7 +277,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
320
277
|
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
321
278
|
* @public
|
|
322
279
|
*/
|
|
323
|
-
|
|
324
280
|
/**
|
|
325
281
|
* Called when scroll stops.
|
|
326
282
|
*
|
|
@@ -350,7 +306,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
350
306
|
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
351
307
|
* @public
|
|
352
308
|
*/
|
|
353
|
-
|
|
354
309
|
/**
|
|
355
310
|
* Specifies how to show vertical scrollbar.
|
|
356
311
|
*
|
|
@@ -365,15 +320,10 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
365
320
|
* @default 'auto'
|
|
366
321
|
* @public
|
|
367
322
|
*/
|
|
368
|
-
|
|
369
|
-
|
|
370
323
|
exports.ScrollerBase = ScrollerBase;
|
|
371
324
|
ScrollerBase.displayName = 'ui:ScrollerBase';
|
|
372
|
-
ScrollerBase.propTypes =
|
|
373
|
-
/** @lends ui/Scroller.ScrollerBase.prototype */
|
|
374
|
-
{
|
|
325
|
+
ScrollerBase.propTypes = /** @lends ui/Scroller.ScrollerBase.prototype */{
|
|
375
326
|
children: _propTypes["default"].node.isRequired,
|
|
376
|
-
|
|
377
327
|
/**
|
|
378
328
|
* Callback method of scrollTo.
|
|
379
329
|
* Normally, `Scrollable` should set this value.
|
|
@@ -382,7 +332,6 @@ ScrollerBase.propTypes =
|
|
|
382
332
|
* @private
|
|
383
333
|
*/
|
|
384
334
|
cbScrollTo: _propTypes["default"].func,
|
|
385
|
-
|
|
386
335
|
/**
|
|
387
336
|
* Direction of the scroller.
|
|
388
337
|
*
|
|
@@ -396,7 +345,6 @@ ScrollerBase.propTypes =
|
|
|
396
345
|
* @public
|
|
397
346
|
*/
|
|
398
347
|
direction: _propTypes["default"].oneOf(['both', 'horizontal', 'vertical']),
|
|
399
|
-
|
|
400
348
|
/**
|
|
401
349
|
* Prop to check context value if Scrollbar exists or not.
|
|
402
350
|
*
|
|
@@ -404,7 +352,6 @@ ScrollerBase.propTypes =
|
|
|
404
352
|
* @private
|
|
405
353
|
*/
|
|
406
354
|
isVerticalScrollbarVisible: _propTypes["default"].bool,
|
|
407
|
-
|
|
408
355
|
/**
|
|
409
356
|
* `true` if RTL, `false` if LTR.
|
|
410
357
|
*
|