@enact/ui 4.5.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.d.ts +1 -1
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.d.ts +6 -6
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +36 -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.d.ts +1 -1
- 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.d.ts +4 -4
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.d.ts +4 -4
- package/IconButton/IconButton.js +17 -55
- 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.d.ts +2 -2
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.d.ts +16 -16
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +31 -64
- 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 +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 +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.d.ts +2 -2
- 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 +31 -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.d.ts +2 -2
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.d.ts +1 -1
- package/SlotItem/SlotItem.js +17 -43
- 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.d.ts +1 -1
- 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.d.ts +3 -3
- package/ToggleItem/ToggleItem.js +18 -55
- 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 +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.d.ts +1 -1
- 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 +259 -409
- package/VirtualList/VirtualList.d.ts +4 -4
- 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/ViewManager/View.js
CHANGED
|
@@ -4,47 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.wrapWithView = exports["default"] = exports.View = void 0;
|
|
7
|
-
|
|
8
7
|
var _util = require("@enact/core/util");
|
|
9
|
-
|
|
10
8
|
var _react = require("react");
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
15
|
-
|
|
16
11
|
var _Arranger = require("./Arranger");
|
|
17
|
-
|
|
18
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
29
|
-
|
|
30
18
|
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); } }
|
|
31
|
-
|
|
32
19
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
33
|
-
|
|
34
20
|
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); }
|
|
35
|
-
|
|
36
21
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
|
-
|
|
38
22
|
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); }; }
|
|
39
|
-
|
|
40
23
|
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); }
|
|
41
|
-
|
|
42
24
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
|
-
|
|
44
25
|
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; } }
|
|
45
|
-
|
|
46
26
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
|
-
|
|
48
27
|
// If the View was "appearing", then entering will always be false and this will not result in a
|
|
49
28
|
// re-render. If the view should enter, state.enter will be true and this will toggle it to false
|
|
50
29
|
// causing a re-render.
|
|
@@ -54,6 +33,7 @@ var clearEntering = function clearEntering(_ref) {
|
|
|
54
33
|
entering: false
|
|
55
34
|
} : null;
|
|
56
35
|
};
|
|
36
|
+
|
|
57
37
|
/**
|
|
58
38
|
* A `View` wraps a set of children for {@link ui/ViewManager.ViewManager}.
|
|
59
39
|
* It is not intended to be used directly
|
|
@@ -62,36 +42,29 @@ var clearEntering = function clearEntering(_ref) {
|
|
|
62
42
|
* @memberof ui/ViewManager
|
|
63
43
|
* @private
|
|
64
44
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
45
|
var View = /*#__PURE__*/function (_Component) {
|
|
68
46
|
_inherits(View, _Component);
|
|
69
|
-
|
|
70
47
|
var _super = _createSuper(View);
|
|
71
|
-
|
|
72
48
|
function View(props) {
|
|
73
49
|
var _this;
|
|
74
|
-
|
|
75
50
|
_classCallCheck(this, View);
|
|
76
|
-
|
|
77
51
|
_this = _super.call(this, props);
|
|
78
52
|
_this.enteringJob = new _util.Job(function () {
|
|
79
53
|
_this.setState(clearEntering);
|
|
80
54
|
});
|
|
81
|
-
|
|
82
55
|
_this.prepareTransition = function (arranger, callback, noAnimation) {
|
|
83
56
|
var _this$props = _this.props,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
57
|
+
duration = _this$props.duration,
|
|
58
|
+
index = _this$props.index,
|
|
59
|
+
_this$props$previousI = _this$props.previousIndex,
|
|
60
|
+
previousIndex = _this$props$previousI === void 0 ? index : _this$props$previousI,
|
|
61
|
+
reverseTransition = _this$props.reverseTransition,
|
|
62
|
+
rtl = _this$props.rtl;
|
|
63
|
+
|
|
64
|
+
// Need to ensure that we have a valid node reference before we animation. Sometimes, React
|
|
90
65
|
// will replace the node after mount causing a reference cached there to be invalid.
|
|
91
66
|
// eslint-disable-next-line react/no-find-dom-node
|
|
92
|
-
|
|
93
67
|
_this.node = _reactDom["default"].findDOMNode(_assertThisInitialized(_this));
|
|
94
|
-
|
|
95
68
|
if (_this.animation && _this.animation.playState !== 'finished' && _this.changeDirection) {
|
|
96
69
|
_this.animation.reverse();
|
|
97
70
|
} else {
|
|
@@ -104,31 +77,29 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
104
77
|
fill: 'forwards',
|
|
105
78
|
duration: duration
|
|
106
79
|
});
|
|
107
|
-
}
|
|
108
|
-
|
|
80
|
+
}
|
|
109
81
|
|
|
82
|
+
// Must set a new handler here to ensure the right callback is invoked
|
|
110
83
|
_this.animation.onfinish = function () {
|
|
111
|
-
_this.animation = null;
|
|
84
|
+
_this.animation = null;
|
|
85
|
+
// Possible for the animation callback to still be fired after the node has been
|
|
112
86
|
// unmounted if it finished before the unmount can cancel it so we check for that.
|
|
113
|
-
|
|
114
87
|
if (_this.node) {
|
|
115
88
|
callback();
|
|
116
89
|
}
|
|
117
|
-
};
|
|
118
|
-
|
|
90
|
+
};
|
|
119
91
|
|
|
92
|
+
// disable animation when the instance or props flag is true
|
|
120
93
|
if (noAnimation || _this.props.noAnimation) {
|
|
121
94
|
_this.animation.finish();
|
|
122
95
|
}
|
|
123
96
|
};
|
|
124
|
-
|
|
125
97
|
_this.animation = null;
|
|
126
98
|
_this.state = {
|
|
127
99
|
entering: !props.appearing
|
|
128
100
|
};
|
|
129
101
|
return _this;
|
|
130
102
|
}
|
|
131
|
-
|
|
132
103
|
_createClass(View, [{
|
|
133
104
|
key: "shouldComponentUpdate",
|
|
134
105
|
value: function shouldComponentUpdate(nextProps) {
|
|
@@ -139,7 +110,6 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
139
110
|
this.changeDirection = this.shouldChangeDirection(this.props, nextProps);
|
|
140
111
|
return false;
|
|
141
112
|
}
|
|
142
|
-
|
|
143
113
|
return true;
|
|
144
114
|
}
|
|
145
115
|
}, {
|
|
@@ -152,7 +122,6 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
152
122
|
value: function componentWillUnmount() {
|
|
153
123
|
this.enteringJob.stop();
|
|
154
124
|
this.node = null;
|
|
155
|
-
|
|
156
125
|
if (this.animation && typeof this.animation.cancel === 'function') {
|
|
157
126
|
this.animation.cancel();
|
|
158
127
|
}
|
|
@@ -166,7 +135,6 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
166
135
|
key: "componentWillAppear",
|
|
167
136
|
value: function componentWillAppear(callback) {
|
|
168
137
|
var arranger = this.props.arranger;
|
|
169
|
-
|
|
170
138
|
if (arranger && arranger.stay) {
|
|
171
139
|
this.prepareTransition(arranger.stay, callback, true);
|
|
172
140
|
} else {
|
|
@@ -177,26 +145,26 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
177
145
|
key: "componentDidAppear",
|
|
178
146
|
value: function componentDidAppear() {
|
|
179
147
|
this.setState(clearEntering);
|
|
180
|
-
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// This is called at the same time as componentDidMount() for components added to an existing
|
|
181
151
|
// TransitionGroup. It will block other animations from occurring until callback is called. It
|
|
182
152
|
// will not be called on the initial render of a TransitionGroup.
|
|
183
|
-
|
|
184
153
|
}, {
|
|
185
154
|
key: "componentWillEnter",
|
|
186
155
|
value: function componentWillEnter(callback) {
|
|
187
156
|
var _this$props2 = this.props,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
157
|
+
appearing = _this$props2.appearing,
|
|
158
|
+
arranger = _this$props2.arranger,
|
|
159
|
+
reverseTransition = _this$props2.reverseTransition,
|
|
160
|
+
enteringProp = _this$props2.enteringProp;
|
|
161
|
+
// This can happen if the panel was going to be removed and the animation was canceled,
|
|
192
162
|
// causing this panel to re-enter.
|
|
193
|
-
|
|
194
163
|
if (!appearing && enteringProp && !this.state.entering) {
|
|
195
164
|
this.setState({
|
|
196
165
|
entering: true
|
|
197
166
|
});
|
|
198
167
|
}
|
|
199
|
-
|
|
200
168
|
if (arranger) {
|
|
201
169
|
this.prepareTransition(reverseTransition ? arranger.leave : arranger.enter, callback);
|
|
202
170
|
} else {
|
|
@@ -207,9 +175,8 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
207
175
|
key: "componentDidEnter",
|
|
208
176
|
value: function componentDidEnter() {
|
|
209
177
|
var _this$props3 = this.props,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
178
|
+
enteringDelay = _this$props3.enteringDelay,
|
|
179
|
+
enteringProp = _this$props3.enteringProp;
|
|
213
180
|
if (enteringProp) {
|
|
214
181
|
// FIXME: `startRafAfter` is a temporary solution using rAF. We need a better way to handle
|
|
215
182
|
// transition cycle and component life cycle to be in sync. See ENYO-4835.
|
|
@@ -222,30 +189,30 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
222
189
|
key: "componentWillStay",
|
|
223
190
|
value: function componentWillStay(callback) {
|
|
224
191
|
var arranger = this.props.arranger;
|
|
225
|
-
|
|
226
192
|
if (arranger && arranger.stay) {
|
|
227
193
|
this.prepareTransition(arranger.stay, callback);
|
|
228
194
|
} else {
|
|
229
195
|
callback();
|
|
230
196
|
}
|
|
231
|
-
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// This is called when the child has been removed from the ReactTransitionGroup. Though the
|
|
232
200
|
// child has been removed, ReactTransitionGroup will keep it in the DOM until callback is
|
|
233
201
|
// called.
|
|
234
|
-
|
|
235
202
|
}, {
|
|
236
203
|
key: "componentWillLeave",
|
|
237
204
|
value: function componentWillLeave(callback) {
|
|
238
205
|
var _this$props4 = this.props,
|
|
239
|
-
|
|
240
|
-
|
|
206
|
+
arranger = _this$props4.arranger,
|
|
207
|
+
reverseTransition = _this$props4.reverseTransition;
|
|
241
208
|
this.enteringJob.stop();
|
|
242
|
-
|
|
243
209
|
if (arranger) {
|
|
244
210
|
this.prepareTransition(reverseTransition ? arranger.enter : arranger.leave, callback);
|
|
245
211
|
} else {
|
|
246
212
|
callback();
|
|
247
213
|
}
|
|
248
214
|
}
|
|
215
|
+
|
|
249
216
|
/**
|
|
250
217
|
* Initiates a new transition
|
|
251
218
|
*
|
|
@@ -255,42 +222,32 @@ var View = /*#__PURE__*/function (_Component) {
|
|
|
255
222
|
* @returns {undefined}
|
|
256
223
|
* @private
|
|
257
224
|
*/
|
|
258
|
-
|
|
259
225
|
}, {
|
|
260
226
|
key: "render",
|
|
261
227
|
value: function render() {
|
|
262
228
|
var _this$props5 = this.props,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
229
|
+
enteringProp = _this$props5.enteringProp,
|
|
230
|
+
children = _this$props5.children,
|
|
231
|
+
childProps = _this$props5.childProps;
|
|
267
232
|
if (enteringProp || childProps) {
|
|
268
233
|
var props = Object.assign({}, childProps);
|
|
269
|
-
|
|
270
234
|
if (enteringProp) {
|
|
271
235
|
props[enteringProp] = this.state.entering;
|
|
272
236
|
}
|
|
273
|
-
|
|
274
237
|
return /*#__PURE__*/(0, _react.cloneElement)(children, props);
|
|
275
238
|
} else {
|
|
276
239
|
return _react.Children.only(children);
|
|
277
240
|
}
|
|
278
241
|
}
|
|
279
242
|
}]);
|
|
280
|
-
|
|
281
243
|
return View;
|
|
282
244
|
}(_react.Component); // Not a true render method but instead a wrapper for TransitionGroup to wrap arbitrary children
|
|
283
245
|
// with a TransitionGroup-compatible child that supports animation
|
|
284
246
|
//
|
|
285
247
|
// eslint-disable-next-line enact/display-name
|
|
286
|
-
|
|
287
|
-
|
|
288
248
|
exports.View = View;
|
|
289
|
-
View.propTypes =
|
|
290
|
-
/** @lends ui/ViewManager.View.prototype */
|
|
291
|
-
{
|
|
249
|
+
View.propTypes = /** @lends ui/ViewManager.View.prototype */{
|
|
292
250
|
children: _propTypes["default"].node.isRequired,
|
|
293
|
-
|
|
294
251
|
/**
|
|
295
252
|
* Time in milliseconds to complete a transition
|
|
296
253
|
*
|
|
@@ -299,7 +256,6 @@ View.propTypes =
|
|
|
299
256
|
* @public
|
|
300
257
|
*/
|
|
301
258
|
duration: _propTypes["default"].number.isRequired,
|
|
302
|
-
|
|
303
259
|
/**
|
|
304
260
|
* Set to `true` when the View should 'appear' without transitioning into the viewport
|
|
305
261
|
*
|
|
@@ -307,7 +263,6 @@ View.propTypes =
|
|
|
307
263
|
* @public
|
|
308
264
|
*/
|
|
309
265
|
appearing: _propTypes["default"].bool,
|
|
310
|
-
|
|
311
266
|
/**
|
|
312
267
|
* Arranger to control the animation
|
|
313
268
|
*
|
|
@@ -315,7 +270,6 @@ View.propTypes =
|
|
|
315
270
|
* @public
|
|
316
271
|
*/
|
|
317
272
|
arranger: _Arranger.shape,
|
|
318
|
-
|
|
319
273
|
/**
|
|
320
274
|
* An object containing properties to be passed to each child.
|
|
321
275
|
*
|
|
@@ -323,7 +277,6 @@ View.propTypes =
|
|
|
323
277
|
* @public
|
|
324
278
|
*/
|
|
325
279
|
childProps: _propTypes["default"].object,
|
|
326
|
-
|
|
327
280
|
/**
|
|
328
281
|
* Time, in milliseconds, to wait after a view has entered to inform it by passing the
|
|
329
282
|
* `enteringProp` as `false`.
|
|
@@ -333,7 +286,6 @@ View.propTypes =
|
|
|
333
286
|
* @public
|
|
334
287
|
*/
|
|
335
288
|
enteringDelay: _propTypes["default"].number,
|
|
336
|
-
|
|
337
289
|
/**
|
|
338
290
|
* Name of the property to pass to the wrapped view to indicate when it is entering the
|
|
339
291
|
* viewport. When `true`, the view has been created but has not transitioned into place.
|
|
@@ -346,21 +298,18 @@ View.propTypes =
|
|
|
346
298
|
* @public
|
|
347
299
|
*/
|
|
348
300
|
enteringProp: _propTypes["default"].string,
|
|
349
|
-
|
|
350
301
|
/**
|
|
351
302
|
* Index of the currently 'active' view.
|
|
352
303
|
*
|
|
353
304
|
* @type {Number}
|
|
354
305
|
*/
|
|
355
306
|
index: _propTypes["default"].number,
|
|
356
|
-
|
|
357
307
|
/**
|
|
358
308
|
* When `true`, indicates if a view is currently leaving.
|
|
359
309
|
*
|
|
360
310
|
* @type {Boolean}
|
|
361
311
|
*/
|
|
362
312
|
leaving: _propTypes["default"].bool,
|
|
363
|
-
|
|
364
313
|
/**
|
|
365
314
|
* When `true`, indicates if the transition should be animated
|
|
366
315
|
*
|
|
@@ -369,14 +318,12 @@ View.propTypes =
|
|
|
369
318
|
* @public
|
|
370
319
|
*/
|
|
371
320
|
noAnimation: _propTypes["default"].bool,
|
|
372
|
-
|
|
373
321
|
/**
|
|
374
322
|
* Index of the previously 'active' view.
|
|
375
323
|
*
|
|
376
324
|
* @type {Number}
|
|
377
325
|
*/
|
|
378
326
|
previousIndex: _propTypes["default"].number,
|
|
379
|
-
|
|
380
327
|
/**
|
|
381
328
|
* When `true`, indicates if the transition should be reversed. The effect depends on how the provided
|
|
382
329
|
* `arranger` handles reversal.
|
|
@@ -385,7 +332,6 @@ View.propTypes =
|
|
|
385
332
|
* @default false
|
|
386
333
|
*/
|
|
387
334
|
reverseTransition: _propTypes["default"].bool,
|
|
388
|
-
|
|
389
335
|
/**
|
|
390
336
|
* When `true`, indicates the current locale uses right-to-left reading order.
|
|
391
337
|
*
|
|
@@ -401,7 +347,6 @@ View.defaultProps = {
|
|
|
401
347
|
index: 0,
|
|
402
348
|
reverseTransition: false
|
|
403
349
|
};
|
|
404
|
-
|
|
405
350
|
var wrapWithView = function wrapWithView(config) {
|
|
406
351
|
return function (child) {
|
|
407
352
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(View, _objectSpread(_objectSpread({}, config), {}, {
|
|
@@ -409,7 +354,6 @@ var wrapWithView = function wrapWithView(config) {
|
|
|
409
354
|
}));
|
|
410
355
|
};
|
|
411
356
|
};
|
|
412
|
-
|
|
413
357
|
exports.wrapWithView = wrapWithView;
|
|
414
358
|
var _default = View;
|
|
415
359
|
exports["default"] = _default;
|