@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/Button/Button.js
CHANGED
|
@@ -4,39 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ButtonDecorator = exports.ButtonBase = exports.Button = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
-
|
|
10
8
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
11
|
-
|
|
12
9
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
15
|
-
|
|
16
11
|
var _ComponentOverride = _interopRequireDefault(require("../ComponentOverride"));
|
|
17
|
-
|
|
18
12
|
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
19
|
-
|
|
20
13
|
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
21
|
-
|
|
22
14
|
var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
|
|
23
|
-
|
|
24
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
-
|
|
26
16
|
var _excluded = ["children", "componentRef", "css", "decoration", "disabled", "icon"];
|
|
27
|
-
|
|
28
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": 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 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; }
|
|
35
|
-
|
|
36
21
|
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; }
|
|
37
|
-
|
|
38
22
|
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; }
|
|
39
|
-
|
|
40
23
|
/**
|
|
41
24
|
* A basic button component structure without any behaviors applied to it.
|
|
42
25
|
*
|
|
@@ -47,9 +30,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
47
30
|
*/
|
|
48
31
|
var ButtonBase = (0, _kind["default"])({
|
|
49
32
|
name: 'ui:Button',
|
|
50
|
-
propTypes:
|
|
51
|
-
/** @lends ui/Button.ButtonBase.prototype */
|
|
52
|
-
{
|
|
33
|
+
propTypes: /** @lends ui/Button.ButtonBase.prototype */{
|
|
53
34
|
/**
|
|
54
35
|
* Called with a reference to the root component.
|
|
55
36
|
*
|
|
@@ -60,7 +41,6 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
60
41
|
* @public
|
|
61
42
|
*/
|
|
62
43
|
componentRef: _propTypes["default"].ref,
|
|
63
|
-
|
|
64
44
|
/**
|
|
65
45
|
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
66
46
|
* corresponding internal elements and states of this component.
|
|
@@ -82,7 +62,6 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
82
62
|
* @public
|
|
83
63
|
*/
|
|
84
64
|
css: _propTypes2["default"].object,
|
|
85
|
-
|
|
86
65
|
/**
|
|
87
66
|
* Additional DOM nodes which may be necessary for decorating the Button.
|
|
88
67
|
*
|
|
@@ -90,7 +69,6 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
90
69
|
* @private
|
|
91
70
|
*/
|
|
92
71
|
decoration: _propTypes2["default"].node,
|
|
93
|
-
|
|
94
72
|
/**
|
|
95
73
|
* Applies the `disabled` class.
|
|
96
74
|
*
|
|
@@ -101,7 +79,6 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
101
79
|
* @public
|
|
102
80
|
*/
|
|
103
81
|
disabled: _propTypes2["default"].bool,
|
|
104
|
-
|
|
105
82
|
/**
|
|
106
83
|
* The icon displayed within the Button.
|
|
107
84
|
*
|
|
@@ -122,12 +99,11 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
122
99
|
* @public
|
|
123
100
|
*/
|
|
124
101
|
icon: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].bool]),
|
|
125
|
-
|
|
126
102
|
/**
|
|
127
|
-
* The component used to render the
|
|
103
|
+
* The component used to render the {@link ui/Button.ButtonBase.icon|icon}.
|
|
128
104
|
*
|
|
129
105
|
* This component will receive the `icon` class to customize its styling.
|
|
130
|
-
* If
|
|
106
|
+
* If {@link ui/Button.ButtonBase.icon|icon} is not assigned or is false, this component
|
|
131
107
|
* will not be rendered.
|
|
132
108
|
*
|
|
133
109
|
* If this is a component rather than an HTML element string, this component will also
|
|
@@ -138,7 +114,6 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
138
114
|
* @public
|
|
139
115
|
*/
|
|
140
116
|
iconComponent: _propTypes["default"].componentOverride,
|
|
141
|
-
|
|
142
117
|
/**
|
|
143
118
|
* Flips the icon.
|
|
144
119
|
*
|
|
@@ -147,48 +122,44 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
147
122
|
* @public
|
|
148
123
|
*/
|
|
149
124
|
iconFlip: _propTypes2["default"].string,
|
|
150
|
-
|
|
151
125
|
/**
|
|
152
126
|
* Enforces a minimum width for the component.
|
|
153
127
|
*
|
|
154
128
|
* Applies the `minWidth` CSS class which can be customized by
|
|
155
|
-
*
|
|
129
|
+
* {@link /docs/developer-guide/theming/|theming}.
|
|
156
130
|
*
|
|
157
131
|
* @type {Boolean}
|
|
158
132
|
* @default true
|
|
159
133
|
* @public
|
|
160
134
|
*/
|
|
161
135
|
minWidth: _propTypes2["default"].bool,
|
|
162
|
-
|
|
163
136
|
/**
|
|
164
137
|
* Indicates the component is depressed.
|
|
165
138
|
*
|
|
166
139
|
* Applies the `pressed` CSS class which can be customized by
|
|
167
|
-
*
|
|
140
|
+
* {@link /docs/developer-guide/theming/|theming}.
|
|
168
141
|
*
|
|
169
142
|
* @type {Boolean}
|
|
170
143
|
* @default false
|
|
171
144
|
* @public
|
|
172
145
|
*/
|
|
173
146
|
pressed: _propTypes2["default"].bool,
|
|
174
|
-
|
|
175
147
|
/**
|
|
176
148
|
* Indicates the component is selected.
|
|
177
149
|
*
|
|
178
150
|
* Applies the `selected` CSS class which can be customized by
|
|
179
|
-
*
|
|
151
|
+
* {@link /docs/developer-guide/theming/|theming}.
|
|
180
152
|
*
|
|
181
153
|
* @type {Boolean}
|
|
182
154
|
* @default false
|
|
183
155
|
* @public
|
|
184
156
|
*/
|
|
185
157
|
selected: _propTypes2["default"].bool,
|
|
186
|
-
|
|
187
158
|
/**
|
|
188
159
|
* The size of the button.
|
|
189
160
|
*
|
|
190
161
|
* Applies the CSS class which can be customized by
|
|
191
|
-
*
|
|
162
|
+
* {@link /docs/developer-guide/theming/|theming}.
|
|
192
163
|
*
|
|
193
164
|
* @type {String}
|
|
194
165
|
* @public
|
|
@@ -209,11 +180,11 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
209
180
|
computed: {
|
|
210
181
|
className: function className(_ref) {
|
|
211
182
|
var icon = _ref.icon,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
183
|
+
minWidth = _ref.minWidth,
|
|
184
|
+
pressed = _ref.pressed,
|
|
185
|
+
selected = _ref.selected,
|
|
186
|
+
size = _ref.size,
|
|
187
|
+
styler = _ref.styler;
|
|
217
188
|
return styler.append({
|
|
218
189
|
hasIcon: !!icon,
|
|
219
190
|
minWidth: minWidth,
|
|
@@ -223,42 +194,41 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
223
194
|
},
|
|
224
195
|
icon: function icon(_ref2) {
|
|
225
196
|
var css = _ref2.css,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (_icon == null || _icon === false) return;
|
|
231
|
-
// HTML element string.
|
|
197
|
+
_icon = _ref2.icon,
|
|
198
|
+
iconComponent = _ref2.iconComponent,
|
|
199
|
+
iconFlip = _ref2.iconFlip,
|
|
200
|
+
size = _ref2.size;
|
|
201
|
+
if (_icon == null || _icon === false) return;
|
|
232
202
|
|
|
203
|
+
// Establish the base collection of props for the most basic `iconComponent` type, an
|
|
204
|
+
// HTML element string.
|
|
233
205
|
var props = {
|
|
234
206
|
className: css.icon,
|
|
235
207
|
component: iconComponent
|
|
236
|
-
};
|
|
237
|
-
// configured to handle.
|
|
208
|
+
};
|
|
238
209
|
|
|
210
|
+
// Add in additional props that any Component supplied to `iconComponent` should be
|
|
211
|
+
// configured to handle.
|
|
239
212
|
if (typeof iconComponent !== 'string') {
|
|
240
|
-
props.size = size;
|
|
213
|
+
props.size = size;
|
|
214
|
+
// the following inadvertently triggers a linting rule
|
|
241
215
|
// eslint-disable-next-line enact/prop-types
|
|
242
|
-
|
|
243
216
|
props.flip = iconFlip;
|
|
244
217
|
}
|
|
245
|
-
|
|
246
218
|
if (_icon !== true) {
|
|
247
219
|
props.children = _icon;
|
|
248
220
|
}
|
|
249
|
-
|
|
250
221
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ComponentOverride["default"], _objectSpread({}, props));
|
|
251
222
|
}
|
|
252
223
|
},
|
|
253
224
|
render: function render(_ref3) {
|
|
254
225
|
var children = _ref3.children,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
226
|
+
componentRef = _ref3.componentRef,
|
|
227
|
+
css = _ref3.css,
|
|
228
|
+
decoration = _ref3.decoration,
|
|
229
|
+
disabled = _ref3.disabled,
|
|
230
|
+
icon = _ref3.icon,
|
|
231
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
262
232
|
delete rest.iconComponent;
|
|
263
233
|
delete rest.iconFlip;
|
|
264
234
|
delete rest.minWidth;
|
|
@@ -283,21 +253,22 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
283
253
|
}));
|
|
284
254
|
}
|
|
285
255
|
});
|
|
256
|
+
|
|
286
257
|
/**
|
|
287
|
-
* A higher-order component that adds touch support to a
|
|
258
|
+
* A higher-order component that adds touch support to a {@link ui/Button.ButtonBase|ButtonBase}.
|
|
288
259
|
*
|
|
289
260
|
* @hoc
|
|
290
261
|
* @memberof ui/Button
|
|
291
262
|
* @mixes ui/Touchable.Touchable
|
|
292
263
|
* @public
|
|
293
264
|
*/
|
|
294
|
-
|
|
295
265
|
exports.ButtonBase = ButtonBase;
|
|
296
266
|
var ButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
|
|
297
267
|
prop: 'componentRef'
|
|
298
268
|
}), (0, _Touchable["default"])({
|
|
299
269
|
activeProp: 'pressed'
|
|
300
270
|
}));
|
|
271
|
+
|
|
301
272
|
/**
|
|
302
273
|
* A minimally-styled button component with touch support.
|
|
303
274
|
*
|
|
@@ -309,7 +280,6 @@ var ButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
|
|
|
309
280
|
* @ui
|
|
310
281
|
* @public
|
|
311
282
|
*/
|
|
312
|
-
|
|
313
283
|
exports.ButtonDecorator = ButtonDecorator;
|
|
314
284
|
var Button = ButtonDecorator(ButtonBase);
|
|
315
285
|
exports.Button = Button;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("@testing-library/jest-dom");
|
|
4
|
-
|
|
5
4
|
var _react = require("@testing-library/react");
|
|
6
|
-
|
|
7
5
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
8
|
-
|
|
9
6
|
var _Button = require("../Button");
|
|
10
|
-
|
|
11
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
|
|
13
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
-
|
|
15
9
|
describe('Button', function () {
|
|
16
10
|
test('should return a DOM node reference for `componentRef`', function () {
|
|
17
11
|
var ref = jest.fn();
|
|
@@ -27,16 +21,12 @@ describe('Button', function () {
|
|
|
27
21
|
disabled: true,
|
|
28
22
|
children: "I am a disabled Button"
|
|
29
23
|
}));
|
|
30
|
-
|
|
31
24
|
var button = _react.screen.getByRole('button');
|
|
32
|
-
|
|
33
25
|
expect(button).toHaveAttribute('disabled');
|
|
34
26
|
});
|
|
35
27
|
test('should have default minWidth class', function () {
|
|
36
28
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {}));
|
|
37
|
-
|
|
38
29
|
var button = _react.screen.getByRole('button');
|
|
39
|
-
|
|
40
30
|
var expected = 'minWidth';
|
|
41
31
|
expect(button).toHaveClass(expected);
|
|
42
32
|
});
|
|
@@ -44,9 +34,7 @@ describe('Button', function () {
|
|
|
44
34
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {
|
|
45
35
|
selected: true
|
|
46
36
|
}));
|
|
47
|
-
|
|
48
37
|
var button = _react.screen.getByRole('button');
|
|
49
|
-
|
|
50
38
|
var expected = 'selected';
|
|
51
39
|
expect(button).toHaveClass(expected);
|
|
52
40
|
});
|
|
@@ -54,9 +42,7 @@ describe('Button', function () {
|
|
|
54
42
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {
|
|
55
43
|
pressed: true
|
|
56
44
|
}));
|
|
57
|
-
|
|
58
45
|
var button = _react.screen.getByRole('button');
|
|
59
|
-
|
|
60
46
|
var expected = 'pressed';
|
|
61
47
|
expect(button).toHaveClass(expected);
|
|
62
48
|
});
|
|
@@ -64,9 +50,7 @@ describe('Button', function () {
|
|
|
64
50
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {
|
|
65
51
|
size: "large"
|
|
66
52
|
}));
|
|
67
|
-
|
|
68
53
|
var button = _react.screen.getByRole('button');
|
|
69
|
-
|
|
70
54
|
var expected = 'large';
|
|
71
55
|
expect(button).toHaveClass(expected);
|
|
72
56
|
});
|
|
@@ -74,9 +58,7 @@ describe('Button', function () {
|
|
|
74
58
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {
|
|
75
59
|
size: "small"
|
|
76
60
|
}));
|
|
77
|
-
|
|
78
61
|
var button = _react.screen.getByRole('button');
|
|
79
|
-
|
|
80
62
|
var expected = 'small';
|
|
81
63
|
expect(button).toHaveClass(expected);
|
|
82
64
|
});
|
|
@@ -85,9 +67,7 @@ describe('Button', function () {
|
|
|
85
67
|
icon: true,
|
|
86
68
|
children: "Hello Button!"
|
|
87
69
|
}));
|
|
88
|
-
|
|
89
70
|
var button = _react.screen.getByRole('button');
|
|
90
|
-
|
|
91
71
|
var expected = 'hasIcon';
|
|
92
72
|
expect(button).toHaveClass(expected);
|
|
93
73
|
});
|
|
@@ -97,11 +77,8 @@ describe('Button', function () {
|
|
|
97
77
|
onClick: handleCLick,
|
|
98
78
|
children: "Hello Button!"
|
|
99
79
|
}));
|
|
100
|
-
|
|
101
80
|
var button = _react.screen.getByRole('button');
|
|
102
|
-
|
|
103
81
|
_userEvent["default"].click(button);
|
|
104
|
-
|
|
105
82
|
var expected = 1;
|
|
106
83
|
expect(handleCLick).toHaveBeenCalledTimes(expected);
|
|
107
84
|
});
|
|
@@ -112,11 +89,8 @@ describe('Button', function () {
|
|
|
112
89
|
onClick: handleClick,
|
|
113
90
|
children: "Hello Button!"
|
|
114
91
|
}));
|
|
115
|
-
|
|
116
92
|
var button = _react.screen.getByRole('button');
|
|
117
|
-
|
|
118
93
|
_userEvent["default"].click(button);
|
|
119
|
-
|
|
120
94
|
expect(handleClick).not.toHaveBeenCalled();
|
|
121
95
|
});
|
|
122
96
|
});
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact ui module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [4.6.0] - 2022-12-05
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `ui/Marquee.MarqueeDecorator` to restart animation properly when `marqueeDelay` is 0
|
|
10
|
+
|
|
11
|
+
## [4.0.12] - 2022-09-16
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- `ui/Marquee.MarqueeDecorator` to have proper spacing for bidirectional text
|
|
16
|
+
|
|
17
|
+
## [4.5.2] - 2022-08-17
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- `ui/Marquee` to stop at the starting point after one cycle when scaled
|
|
22
|
+
|
|
5
23
|
## [4.5.1] - 2022-08-03
|
|
6
24
|
|
|
7
25
|
### Fixed
|
|
@@ -43,12 +61,20 @@ No significant changes.
|
|
|
43
61
|
|
|
44
62
|
- `ui/Marquee.MarqueeDecorator` config `css` to support customizing the marquee styles
|
|
45
63
|
|
|
64
|
+
## [4.0.11] - 2022-04-25
|
|
65
|
+
|
|
66
|
+
No significant changes.
|
|
67
|
+
|
|
46
68
|
## [4.5.0-alpha.1] - 2022-04-15
|
|
47
69
|
|
|
48
70
|
### Fixed
|
|
49
71
|
|
|
50
72
|
- `ui/FloatingLayer` to stack popups always in the order in which they were opened
|
|
51
73
|
|
|
74
|
+
## [4.0.10] - 2022-04-05
|
|
75
|
+
|
|
76
|
+
No significant changes.
|
|
77
|
+
|
|
52
78
|
## [4.1.4] - 2022-03-24
|
|
53
79
|
|
|
54
80
|
### Removed
|
|
@@ -68,6 +94,10 @@ No significant changes.
|
|
|
68
94
|
|
|
69
95
|
- Updated to use `forwardCustom` and add `type` when forwarding custom events
|
|
70
96
|
|
|
97
|
+
## [3.2.7] - 2022-01-17
|
|
98
|
+
|
|
99
|
+
No significant changes.
|
|
100
|
+
|
|
71
101
|
## [4.1.2] - 2021-12-22
|
|
72
102
|
|
|
73
103
|
### Fixed
|
|
@@ -75,6 +105,10 @@ No significant changes.
|
|
|
75
105
|
- `ui/Scroller` and `ui/VirtualList` to avoid stuttering of content on drag in mobile devices
|
|
76
106
|
- `ui/Scroller` and `ui/VirtualList` to scroll correctly on Android platform for RTL locales
|
|
77
107
|
|
|
108
|
+
## [4.0.9] - 2021-12-15
|
|
109
|
+
|
|
110
|
+
No significant changes.
|
|
111
|
+
|
|
78
112
|
## [4.1.1] - 2021-11-30
|
|
79
113
|
|
|
80
114
|
No significant changes.
|
|
@@ -370,6 +404,8 @@ No significant changes.
|
|
|
370
404
|
|
|
371
405
|
### Fixed
|
|
372
406
|
|
|
407
|
+
- `ui/VirtualList.VirtualGridList` and `ui/VirtualList.VirtualList` to show items properly when reducing data size by updating `firstIndex` correctly
|
|
408
|
+
- `ui/VirtualList.VirtualList` and `ui/VirtualList.VirtualGridList` not to suddenly jump when pressing directional keys after wheeling
|
|
373
409
|
- `ui/VirtualList.VirtualList` and `ui/VirtualList.VirtualGridList` to show items properly when reducing data size
|
|
374
410
|
|
|
375
411
|
## [3.2.5] - 2019-11-14
|
package/Cancelable/Cancelable.js
CHANGED
|
@@ -17,53 +17,29 @@ Object.defineProperty(exports, "removeCancelHandler", {
|
|
|
17
17
|
return _cancelHandler.removeCancelHandler;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
|
|
21
20
|
var _handle = require("@enact/core/handle");
|
|
22
|
-
|
|
23
21
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
24
|
-
|
|
25
22
|
var _keymap = require("@enact/core/keymap");
|
|
26
|
-
|
|
27
23
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
28
|
-
|
|
29
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
30
|
-
|
|
31
25
|
var _react = require("react");
|
|
32
|
-
|
|
33
26
|
var _cancelHandler = require("./cancelHandler");
|
|
34
|
-
|
|
35
27
|
var _modalHandler = require("./modalHandler");
|
|
36
|
-
|
|
37
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
38
|
-
|
|
39
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
40
|
-
|
|
41
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
42
|
-
|
|
43
31
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
44
|
-
|
|
45
32
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
46
|
-
|
|
47
33
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
48
|
-
|
|
49
34
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
50
|
-
|
|
51
35
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
52
|
-
|
|
53
36
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
54
|
-
|
|
55
37
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
56
|
-
|
|
57
38
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
58
|
-
|
|
59
39
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
60
|
-
|
|
61
40
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
62
|
-
|
|
63
41
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
64
|
-
|
|
65
42
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
66
|
-
|
|
67
43
|
/**
|
|
68
44
|
* Default config for {@link ui/Cancelable.Cancelable}
|
|
69
45
|
*
|
|
@@ -86,7 +62,6 @@ var defaultConfig = {
|
|
|
86
62
|
* @memberof ui/Cancelable.Cancelable.defaultConfig
|
|
87
63
|
*/
|
|
88
64
|
onCancel: null,
|
|
89
|
-
|
|
90
65
|
/**
|
|
91
66
|
* Subscribes to cancel events globally for this instance.
|
|
92
67
|
*
|
|
@@ -102,7 +77,6 @@ var defaultConfig = {
|
|
|
102
77
|
* @memberof ui/Cancelable.Cancelable.defaultConfig
|
|
103
78
|
*/
|
|
104
79
|
modal: false,
|
|
105
|
-
|
|
106
80
|
/**
|
|
107
81
|
* The component that will contain the wrapped component.
|
|
108
82
|
*
|
|
@@ -114,9 +88,11 @@ var defaultConfig = {
|
|
|
114
88
|
* @memberof ui/Cancelable.Cancelable.defaultConfig
|
|
115
89
|
*/
|
|
116
90
|
component: null
|
|
117
|
-
};
|
|
91
|
+
};
|
|
118
92
|
|
|
93
|
+
// Add keymap for escape key
|
|
119
94
|
(0, _keymap.add)('cancel', 27);
|
|
95
|
+
|
|
120
96
|
/**
|
|
121
97
|
* A higher-order component that adds support to a component to handle cancel actions.
|
|
122
98
|
*
|
|
@@ -164,17 +140,14 @@ var defaultConfig = {
|
|
|
164
140
|
* @hoc
|
|
165
141
|
* @public
|
|
166
142
|
*/
|
|
167
|
-
|
|
168
143
|
var Cancelable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
169
144
|
var _class;
|
|
170
|
-
|
|
171
145
|
var onCancel = config.onCancel,
|
|
172
|
-
|
|
173
|
-
|
|
146
|
+
modal = config.modal,
|
|
147
|
+
Component = config.component;
|
|
174
148
|
!onCancel ? process.env.NODE_ENV !== "production" ? (0, _invariant["default"])(false, 'onCancel must be specified with Cancelable') : (0, _invariant["default"])(false) : void 0;
|
|
175
149
|
var onCancelIsString = typeof onCancel === 'string';
|
|
176
150
|
var onCancelIsFunction = typeof onCancel === 'function';
|
|
177
|
-
|
|
178
151
|
var dispatchCancelToConfig = function dispatchCancelToConfig(ev, props) {
|
|
179
152
|
// by default, we return false which allows event propagation because it will "break" the
|
|
180
153
|
// handler chain and not call `stop` and `stopImmediate` below
|
|
@@ -185,7 +158,6 @@ var Cancelable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped)
|
|
|
185
158
|
stopped = true;
|
|
186
159
|
}
|
|
187
160
|
};
|
|
188
|
-
|
|
189
161
|
if (onCancelIsString && typeof props[onCancel] === 'function') {
|
|
190
162
|
// use the custom event name from the config
|
|
191
163
|
cancelEvent.type = onCancel;
|
|
@@ -193,30 +165,24 @@ var Cancelable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped)
|
|
|
193
165
|
} else if (onCancelIsFunction) {
|
|
194
166
|
onCancel(cancelEvent, props);
|
|
195
167
|
}
|
|
196
|
-
|
|
197
168
|
return stopped;
|
|
198
169
|
};
|
|
199
|
-
|
|
200
170
|
return _class = /*#__PURE__*/function (_ReactComponent) {
|
|
201
171
|
_inherits(_class, _ReactComponent);
|
|
202
|
-
|
|
203
172
|
var _super = _createSuper(_class);
|
|
204
|
-
|
|
205
173
|
function _class(props) {
|
|
206
174
|
var _this;
|
|
207
|
-
|
|
208
175
|
_classCallCheck(this, _class);
|
|
209
|
-
|
|
210
176
|
_this = _super.call(this, props);
|
|
211
177
|
_this.handle = _handle.handle.bind(_assertThisInitialized(_this));
|
|
212
178
|
_this.handleCancel = _this.handle(_cancelHandler.forCancel, (0, _handle.forwardCustom)('onCancel'), dispatchCancelToConfig, _handle.stop, _handle.stopImmediate);
|
|
213
|
-
_this.handleKeyUp = _this.handle((0, _handle.forward)('onKeyUp'),
|
|
179
|
+
_this.handleKeyUp = _this.handle((0, _handle.forward)('onKeyUp'),
|
|
180
|
+
// nesting handlers for DRYness. note that if any conditions return false in
|
|
214
181
|
// this.handleCancel(), this handler chain will stop too
|
|
215
182
|
_this.handleCancel);
|
|
216
183
|
_this.isFirstRender = true;
|
|
217
184
|
return _this;
|
|
218
185
|
}
|
|
219
|
-
|
|
220
186
|
_createClass(_class, [{
|
|
221
187
|
key: "componentWillUnmount",
|
|
222
188
|
value: function componentWillUnmount() {
|
|
@@ -250,20 +216,15 @@ var Cancelable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped)
|
|
|
250
216
|
var props = Object.assign({}, this.props);
|
|
251
217
|
delete props.onCancel;
|
|
252
218
|
delete props[onCancel];
|
|
253
|
-
|
|
254
219
|
if (this.isFirstRender && modal) {
|
|
255
220
|
(0, _modalHandler.addModal)(this);
|
|
256
221
|
this.isFirstRender = false;
|
|
257
222
|
}
|
|
258
|
-
|
|
259
223
|
return modal && this.renderModal(props) || Component && this.renderWrapped(props) || this.renderUnwrapped(props);
|
|
260
224
|
}
|
|
261
225
|
}]);
|
|
262
|
-
|
|
263
226
|
return _class;
|
|
264
|
-
}(_react.Component), _class.displayName = 'Cancelable', _class.propTypes =
|
|
265
|
-
/** @lends ui/Cancelable.Cancelable.prototype */
|
|
266
|
-
{
|
|
227
|
+
}(_react.Component), _class.displayName = 'Cancelable', _class.propTypes = /** @lends ui/Cancelable.Cancelable.prototype */{
|
|
267
228
|
/**
|
|
268
229
|
* Called when a cancel action is received.
|
|
269
230
|
*
|
|
@@ -4,17 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.removeCancelHandler = exports.forCancel = exports.addCancelHandler = void 0;
|
|
7
|
-
|
|
8
7
|
var _handle = require("@enact/core/handle");
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* Array of cancel handlers. If any of these returns `false`, `forCancel` will return `false`;
|
|
12
10
|
*
|
|
13
11
|
* @type {Function[]}
|
|
14
12
|
* @private
|
|
15
13
|
*/
|
|
16
|
-
var cancelHandlers = [
|
|
14
|
+
var cancelHandlers = [
|
|
15
|
+
// always support the Escape key
|
|
17
16
|
(0, _handle.forKey)('cancel')];
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* Event handler compatible with {@link core/handle} that allows the handler chain to
|
|
20
20
|
* continue for any cancel event. A cancel event is an Escape key press by default but can be
|
|
@@ -27,7 +27,6 @@ var cancelHandlers = [// always support the Escape key
|
|
|
27
27
|
* @returns {Boolean} `true` to stop the handler chain
|
|
28
28
|
* @private
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
30
|
var forCancel = function forCancel(ev) {
|
|
32
31
|
var ok = false;
|
|
33
32
|
cancelHandlers.forEach(function (fn) {
|
|
@@ -36,6 +35,7 @@ var forCancel = function forCancel(ev) {
|
|
|
36
35
|
});
|
|
37
36
|
return ok;
|
|
38
37
|
};
|
|
38
|
+
|
|
39
39
|
/**
|
|
40
40
|
* Adds an event handler to filter cancel events.
|
|
41
41
|
*
|
|
@@ -46,15 +46,13 @@ var forCancel = function forCancel(ev) {
|
|
|
46
46
|
* @returns {undefined}
|
|
47
47
|
* @public
|
|
48
48
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
49
|
exports.forCancel = forCancel;
|
|
52
|
-
|
|
53
50
|
var addCancelHandler = function addCancelHandler(handler) {
|
|
54
51
|
if (cancelHandlers.indexOf(handler) < 0) {
|
|
55
52
|
cancelHandlers.push(handler);
|
|
56
53
|
}
|
|
57
54
|
};
|
|
55
|
+
|
|
58
56
|
/**
|
|
59
57
|
* Removes an event handler to filter cancel events
|
|
60
58
|
*
|
|
@@ -64,16 +62,11 @@ var addCancelHandler = function addCancelHandler(handler) {
|
|
|
64
62
|
* @returns {undefined}
|
|
65
63
|
* @public
|
|
66
64
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
65
|
exports.addCancelHandler = addCancelHandler;
|
|
70
|
-
|
|
71
66
|
var removeCancelHandler = function removeCancelHandler(handler) {
|
|
72
67
|
var index = cancelHandlers.indexOf(handler);
|
|
73
|
-
|
|
74
68
|
if (index >= 0) {
|
|
75
69
|
cancelHandlers.splice(index, 1);
|
|
76
70
|
}
|
|
77
71
|
};
|
|
78
|
-
|
|
79
72
|
exports.removeCancelHandler = removeCancelHandler;
|