@enact/ui 4.5.2 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnnounceDecorator/Announce.js +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +45 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/package.json +3 -0
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +24 -57
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +7 -29
- package/RadioDecorator/RadioDecorator.js +9 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +37 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +23 -45
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.js +16 -43
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.js +24 -57
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Pinch.js +185 -0
- package/Touchable/Touch.js +71 -76
- package/Touchable/Touchable.js +95 -75
- package/Touchable/config.js +27 -24
- package/Touchable/tests/Touchable-specs.js +360 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +57 -65
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.js +20 -84
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +265 -409
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +6 -20
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +9 -3
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
- package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
- package/BodyText/BodyText.d.ts +0 -66
- package/Button/Button.d.ts +0 -125
- package/Cancelable/Cancelable.d.ts +0 -64
- package/Changeable/Changeable.d.ts +0 -54
- package/ComponentOverride/ComponentOverride.d.ts +0 -52
- package/ForwardRef/ForwardRef.d.ts +0 -22
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/Group/Group.d.ts +0 -107
- package/Heading/Heading.d.ts +0 -90
- package/Icon/Icon.d.ts +0 -88
- package/IconButton/IconButton.d.ts +0 -115
- package/Image/Image.d.ts +0 -113
- package/ImageItem/ImageItem.d.ts +0 -83
- package/Item/Item.d.ts +0 -64
- package/LabeledIcon/LabeledIcon.d.ts +0 -130
- package/Layout/Layout.d.ts +0 -247
- package/Marquee/index.d.ts +0 -258
- package/Measurable/Measurable.d.ts +0 -26
- package/Media/Media.d.ts +0 -99
- package/Placeholder/index.d.ts +0 -53
- package/ProgressBar/ProgressBar.d.ts +0 -92
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/Repeater/Repeater.d.ts +0 -83
- package/Resizable/Resizable.d.ts +0 -31
- package/Routable/Routable.d.ts +0 -148
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scroller/Scroller.d.ts +0 -276
- package/Skinnable/Skinnable.d.ts +0 -94
- package/Slider/Slider.d.ts +0 -202
- package/SlotItem/SlotItem.d.ts +0 -118
- package/Slottable/Slottable.d.ts +0 -22
- package/Spinner/Spinner.d.ts +0 -95
- package/ToggleIcon/ToggleIcon.d.ts +0 -90
- package/ToggleItem/ToggleItem.d.ts +0 -134
- package/Toggleable/Toggleable.d.ts +0 -103
- package/Touchable/Touchable.d.ts +0 -175
- package/Transition/Transition.d.ts +0 -196
- package/ViewManager/ViewManager.d.ts +0 -191
- package/VirtualList/VirtualList.d.ts +0 -530
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/localized-fonts/localized-fonts.d.ts +0 -53
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/resolution/index.d.ts +0 -187
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useScroll/useScroll.d.ts +0 -0
|
@@ -4,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,30 @@ 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
|
-
|
|
8
|
+
var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
|
|
10
9
|
var _platform = require("@enact/core/platform");
|
|
11
|
-
|
|
12
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
11
|
var _react = require("react");
|
|
15
|
-
|
|
16
12
|
var _UiScrollerModule = _interopRequireDefault(require("./UiScroller.module.css"));
|
|
17
|
-
|
|
18
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
|
|
20
14
|
var _excluded = ["className", "style"];
|
|
21
|
-
|
|
22
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
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; }
|
|
25
|
-
|
|
26
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; }
|
|
27
|
-
|
|
28
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; }
|
|
29
|
-
|
|
30
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; }
|
|
31
|
-
|
|
32
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; }
|
|
33
|
-
|
|
34
21
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
|
-
|
|
36
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); } }
|
|
37
|
-
|
|
38
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; }
|
|
39
|
-
|
|
40
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); }
|
|
41
|
-
|
|
42
25
|
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
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); }; }
|
|
45
|
-
|
|
46
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); }
|
|
47
|
-
|
|
48
28
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
-
|
|
50
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; } }
|
|
51
|
-
|
|
52
30
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
53
|
-
|
|
54
31
|
/**
|
|
55
32
|
* An unstyled base scroller component.
|
|
56
33
|
*
|
|
@@ -60,17 +37,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
60
37
|
* @memberof ui/Scroller
|
|
61
38
|
* @ui
|
|
62
39
|
* @public
|
|
40
|
+
* @deprecated Will be removed in 5.0.0.
|
|
63
41
|
*/
|
|
64
42
|
var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
65
43
|
_inherits(ScrollerBase, _Component);
|
|
66
|
-
|
|
67
44
|
var _super = _createSuper(ScrollerBase);
|
|
68
|
-
|
|
69
45
|
function ScrollerBase(props) {
|
|
70
46
|
var _this;
|
|
71
|
-
|
|
72
47
|
_classCallCheck(this, ScrollerBase);
|
|
73
|
-
|
|
74
48
|
_this = _super.call(this, props);
|
|
75
49
|
_this.scrollBounds = {
|
|
76
50
|
clientWidth: 0,
|
|
@@ -84,34 +58,29 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
84
58
|
top: 0,
|
|
85
59
|
left: 0
|
|
86
60
|
};
|
|
87
|
-
|
|
88
61
|
_this.getScrollBounds = function () {
|
|
89
62
|
return _this.scrollBounds;
|
|
90
63
|
};
|
|
91
|
-
|
|
92
64
|
_this.getRtlPositionX = function (x) {
|
|
93
65
|
if (_this.props.rtl) {
|
|
94
66
|
return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
|
|
95
67
|
}
|
|
96
|
-
|
|
97
68
|
return x;
|
|
98
69
|
};
|
|
99
|
-
|
|
100
70
|
_this.getNodePosition = function (node) {
|
|
101
71
|
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
72
|
+
nodeLeft = _node$getBoundingClie.left,
|
|
73
|
+
nodeTop = _node$getBoundingClie.top,
|
|
74
|
+
nodeHeight = _node$getBoundingClie.height,
|
|
75
|
+
nodeWidth = _node$getBoundingClie.width,
|
|
76
|
+
_this$containerRef$cu = _this.containerRef.current.getBoundingClientRect(),
|
|
77
|
+
containerLeft = _this$containerRef$cu.left,
|
|
78
|
+
containerTop = _this$containerRef$cu.top,
|
|
79
|
+
_this$containerRef$cu2 = _this.containerRef.current,
|
|
80
|
+
scrollLeft = _this$containerRef$cu2.scrollLeft,
|
|
81
|
+
scrollTop = _this$containerRef$cu2.scrollTop,
|
|
82
|
+
left = _this.isHorizontal() ? scrollLeft + nodeLeft - containerLeft : null,
|
|
83
|
+
top = _this.isVertical() ? scrollTop + nodeTop - containerTop : null;
|
|
115
84
|
return {
|
|
116
85
|
left: left,
|
|
117
86
|
top: top,
|
|
@@ -119,19 +88,15 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
119
88
|
height: nodeHeight
|
|
120
89
|
};
|
|
121
90
|
};
|
|
122
|
-
|
|
123
91
|
_this.isVertical = function () {
|
|
124
92
|
return _this.props.direction !== 'horizontal';
|
|
125
93
|
};
|
|
126
|
-
|
|
127
94
|
_this.isHorizontal = function () {
|
|
128
95
|
return _this.props.direction !== 'vertical';
|
|
129
96
|
};
|
|
130
|
-
|
|
131
97
|
_this.containerRef = /*#__PURE__*/(0, _react.createRef)();
|
|
132
98
|
return _this;
|
|
133
99
|
}
|
|
134
|
-
|
|
135
100
|
_createClass(ScrollerBase, [{
|
|
136
101
|
key: "componentDidMount",
|
|
137
102
|
value: function componentDidMount() {
|
|
@@ -141,34 +106,34 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
141
106
|
key: "componentDidUpdate",
|
|
142
107
|
value: function componentDidUpdate(prevProps) {
|
|
143
108
|
this.calculateMetrics();
|
|
144
|
-
|
|
145
109
|
if (this.props.isVerticalScrollbarVisible && !prevProps.isVerticalScrollbarVisible) {
|
|
146
110
|
this.forceUpdate();
|
|
147
111
|
}
|
|
148
112
|
}
|
|
149
113
|
}, {
|
|
150
114
|
key: "setScrollPosition",
|
|
151
|
-
value:
|
|
115
|
+
value:
|
|
116
|
+
// for Scrollable
|
|
152
117
|
function setScrollPosition(x, y) {
|
|
153
118
|
var node = this.containerRef.current;
|
|
154
|
-
|
|
155
119
|
if (this.isVertical()) {
|
|
156
120
|
node.scrollTop = y;
|
|
157
121
|
this.scrollPos.top = y;
|
|
158
122
|
}
|
|
159
|
-
|
|
160
123
|
if (this.isHorizontal()) {
|
|
161
124
|
node.scrollLeft = this.getRtlPositionX(x);
|
|
162
125
|
this.scrollPos.left = x;
|
|
163
126
|
}
|
|
164
|
-
}
|
|
127
|
+
}
|
|
165
128
|
|
|
129
|
+
// for ScrollableNative
|
|
166
130
|
}, {
|
|
167
131
|
key: "scrollToPosition",
|
|
168
132
|
value: function scrollToPosition(x, y) {
|
|
169
133
|
this.containerRef.current.scrollTo(this.getRtlPositionX(x), y);
|
|
170
|
-
}
|
|
134
|
+
}
|
|
171
135
|
|
|
136
|
+
// for ScrollableNative
|
|
172
137
|
}, {
|
|
173
138
|
key: "didScroll",
|
|
174
139
|
value: function didScroll(x, y) {
|
|
@@ -179,11 +144,11 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
179
144
|
key: "calculateMetrics",
|
|
180
145
|
value: function calculateMetrics() {
|
|
181
146
|
var scrollBounds = this.scrollBounds,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
147
|
+
_this$containerRef$cu3 = this.containerRef.current,
|
|
148
|
+
scrollWidth = _this$containerRef$cu3.scrollWidth,
|
|
149
|
+
scrollHeight = _this$containerRef$cu3.scrollHeight,
|
|
150
|
+
clientWidth = _this$containerRef$cu3.clientWidth,
|
|
151
|
+
clientHeight = _this$containerRef$cu3.clientHeight;
|
|
187
152
|
scrollBounds.scrollWidth = scrollWidth;
|
|
188
153
|
scrollBounds.scrollHeight = scrollHeight;
|
|
189
154
|
scrollBounds.clientWidth = clientWidth;
|
|
@@ -194,15 +159,18 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
194
159
|
}, {
|
|
195
160
|
key: "render",
|
|
196
161
|
value: function render() {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
rest = _objectWithoutProperties(_this$props, _excluded),
|
|
201
|
-
mergedStyle = Object.assign({}, style, {
|
|
202
|
-
overflowX: this.isHorizontal() ? 'auto' : 'hidden',
|
|
203
|
-
overflowY: this.isVertical() ? 'auto' : 'hidden'
|
|
162
|
+
(0, _deprecate["default"])({
|
|
163
|
+
name: 'ui/Scroller.ScrollerBase',
|
|
164
|
+
until: '5.0.0'
|
|
204
165
|
});
|
|
205
|
-
|
|
166
|
+
var _this$props = this.props,
|
|
167
|
+
className = _this$props.className,
|
|
168
|
+
style = _this$props.style,
|
|
169
|
+
rest = _objectWithoutProperties(_this$props, _excluded),
|
|
170
|
+
mergedStyle = Object.assign({}, style, {
|
|
171
|
+
overflowX: this.isHorizontal() ? 'auto' : 'hidden',
|
|
172
|
+
overflowY: this.isVertical() ? 'auto' : 'hidden'
|
|
173
|
+
});
|
|
206
174
|
delete rest.cbScrollTo;
|
|
207
175
|
delete rest.direction;
|
|
208
176
|
delete rest.isHorizontalScrollbarVisible;
|
|
@@ -215,7 +183,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
215
183
|
}));
|
|
216
184
|
}
|
|
217
185
|
}]);
|
|
218
|
-
|
|
219
186
|
return ScrollerBase;
|
|
220
187
|
}(_react.Component);
|
|
221
188
|
/**
|
|
@@ -248,7 +215,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
248
215
|
* @type {Function}
|
|
249
216
|
* @public
|
|
250
217
|
*/
|
|
251
|
-
|
|
252
218
|
/**
|
|
253
219
|
* Specifies how to show horizontal scrollbar.
|
|
254
220
|
*
|
|
@@ -263,7 +229,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
263
229
|
* @default 'auto'
|
|
264
230
|
* @public
|
|
265
231
|
*/
|
|
266
|
-
|
|
267
232
|
/**
|
|
268
233
|
* Prevents scroll by wheeling on the scroller.
|
|
269
234
|
*
|
|
@@ -273,7 +238,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
273
238
|
* @default false
|
|
274
239
|
* @public
|
|
275
240
|
*/
|
|
276
|
-
|
|
277
241
|
/**
|
|
278
242
|
* Called when scrolling.
|
|
279
243
|
*
|
|
@@ -290,7 +254,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
290
254
|
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
291
255
|
* @public
|
|
292
256
|
*/
|
|
293
|
-
|
|
294
257
|
/**
|
|
295
258
|
* Called when scroll starts.
|
|
296
259
|
*
|
|
@@ -320,7 +283,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
320
283
|
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
321
284
|
* @public
|
|
322
285
|
*/
|
|
323
|
-
|
|
324
286
|
/**
|
|
325
287
|
* Called when scroll stops.
|
|
326
288
|
*
|
|
@@ -350,7 +312,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
350
312
|
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
351
313
|
* @public
|
|
352
314
|
*/
|
|
353
|
-
|
|
354
315
|
/**
|
|
355
316
|
* Specifies how to show vertical scrollbar.
|
|
356
317
|
*
|
|
@@ -365,15 +326,10 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
|
365
326
|
* @default 'auto'
|
|
366
327
|
* @public
|
|
367
328
|
*/
|
|
368
|
-
|
|
369
|
-
|
|
370
329
|
exports.ScrollerBase = ScrollerBase;
|
|
371
330
|
ScrollerBase.displayName = 'ui:ScrollerBase';
|
|
372
|
-
ScrollerBase.propTypes =
|
|
373
|
-
/** @lends ui/Scroller.ScrollerBase.prototype */
|
|
374
|
-
{
|
|
331
|
+
ScrollerBase.propTypes = /** @lends ui/Scroller.ScrollerBase.prototype */{
|
|
375
332
|
children: _propTypes["default"].node.isRequired,
|
|
376
|
-
|
|
377
333
|
/**
|
|
378
334
|
* Callback method of scrollTo.
|
|
379
335
|
* Normally, `Scrollable` should set this value.
|
|
@@ -382,7 +338,6 @@ ScrollerBase.propTypes =
|
|
|
382
338
|
* @private
|
|
383
339
|
*/
|
|
384
340
|
cbScrollTo: _propTypes["default"].func,
|
|
385
|
-
|
|
386
341
|
/**
|
|
387
342
|
* Direction of the scroller.
|
|
388
343
|
*
|
|
@@ -396,7 +351,6 @@ ScrollerBase.propTypes =
|
|
|
396
351
|
* @public
|
|
397
352
|
*/
|
|
398
353
|
direction: _propTypes["default"].oneOf(['both', 'horizontal', 'vertical']),
|
|
399
|
-
|
|
400
354
|
/**
|
|
401
355
|
* Prop to check context value if Scrollbar exists or not.
|
|
402
356
|
*
|
|
@@ -404,7 +358,6 @@ ScrollerBase.propTypes =
|
|
|
404
358
|
* @private
|
|
405
359
|
*/
|
|
406
360
|
isVerticalScrollbarVisible: _propTypes["default"].bool,
|
|
407
|
-
|
|
408
361
|
/**
|
|
409
362
|
* `true` if RTL, `false` if LTR.
|
|
410
363
|
*
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("@testing-library/jest-dom");
|
|
4
|
+
var _react = require("@testing-library/react");
|
|
5
|
+
var _Scroller = _interopRequireDefault(require("../Scroller"));
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
+
describe('Scroller', function () {
|
|
9
|
+
var contents;
|
|
10
|
+
beforeEach(function () {
|
|
11
|
+
contents = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
12
|
+
children: ["Lorem ipsum dolor sit amet, consectetur adipiscing elit.", /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), "Aenean id blandit nunc. Donec lacinia nisi vitae mi dictum, eget pulvinar nunc tincidunt. Integer vehicula tempus rutrum. Sed efficitur neque in arcu dignissim cursus."]
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
afterEach(function () {
|
|
16
|
+
contents = null;
|
|
17
|
+
});
|
|
18
|
+
describe('Scrollbar visibility', function () {
|
|
19
|
+
test('should render both horizontal and vertical scrollbars when \'horizontalScrollbar\' and \'verticalScrollbar\' are "visible"', function () {
|
|
20
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Scroller["default"], {
|
|
21
|
+
"data-testid": "scroller",
|
|
22
|
+
horizontalScrollbar: "visible",
|
|
23
|
+
verticalScrollbar: "visible",
|
|
24
|
+
children: contents
|
|
25
|
+
}));
|
|
26
|
+
var horizontalScrollbar = _react.screen.getByTestId('scroller').children.item(1);
|
|
27
|
+
var verticalScrollbar = _react.screen.getByTestId('scroller').children.item(0).children.item(1);
|
|
28
|
+
expect(horizontalScrollbar).toBeInTheDocument();
|
|
29
|
+
expect(verticalScrollbar).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
test('should render only vertical scrollbar when \'verticalScrollbar\' is "visible" and \'horizontalScrollbar\' is "hidden"', function () {
|
|
32
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Scroller["default"], {
|
|
33
|
+
"data-testid": "scroller",
|
|
34
|
+
horizontalScrollbar: "hidden",
|
|
35
|
+
verticalScrollbar: "visible",
|
|
36
|
+
children: contents
|
|
37
|
+
}));
|
|
38
|
+
var horizontalScrollbar = _react.screen.getByTestId('scroller').children.item(1);
|
|
39
|
+
var verticalScrollbar = _react.screen.getByTestId('scroller').children.item(0).children.item(1);
|
|
40
|
+
expect(horizontalScrollbar).toBeNull();
|
|
41
|
+
expect(verticalScrollbar).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
test('should not render any scrollbar when \'horizontalScrollbar\' and \'verticalScrollbar\' are "hidden"', function () {
|
|
44
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Scroller["default"], {
|
|
45
|
+
"data-testid": "scroller",
|
|
46
|
+
horizontalScrollbar: "hidden",
|
|
47
|
+
verticalScrollbar: "hidden",
|
|
48
|
+
children: contents
|
|
49
|
+
}));
|
|
50
|
+
var horizontalScrollbar = _react.screen.getByTestId('scroller').children.item(1);
|
|
51
|
+
var verticalScrollbar = _react.screen.getByTestId('scroller').children.item(0).children.item(1);
|
|
52
|
+
expect(horizontalScrollbar).toBeNull();
|
|
53
|
+
expect(verticalScrollbar).toBeNull();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|