@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
package/Touchable/Touchable.js
CHANGED
|
@@ -17,79 +17,65 @@ Object.defineProperty(exports, "useTouch", {
|
|
|
17
17
|
return _useTouch["default"];
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
|
|
21
20
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
22
|
-
|
|
23
21
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
24
|
-
|
|
25
22
|
var _react = require("react");
|
|
26
|
-
|
|
27
23
|
var _config = require("./config");
|
|
28
|
-
|
|
29
24
|
var _Drag = require("./Drag");
|
|
30
|
-
|
|
31
25
|
var _Flick = require("./Flick");
|
|
32
|
-
|
|
33
26
|
var _Hold = require("./Hold");
|
|
34
|
-
|
|
27
|
+
var _Pinch = require("./Pinch");
|
|
35
28
|
var _useTouch = _interopRequireDefault(require("./useTouch"));
|
|
36
|
-
|
|
37
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
38
|
-
|
|
39
|
-
var _excluded = ["dragConfig", "flickConfig", "holdConfig", "disabled", "noResume", "onBlur", "onClick", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "onDown", "onDrag", "onDragEnd", "onDragStart", "onFlick", "onHold", "onHoldEnd", "onHoldStart", "onMove", "onTap", "onUp"];
|
|
40
|
-
|
|
30
|
+
var _excluded = ["dragConfig", "flickConfig", "holdConfig", "pinchConfig", "disabled", "noResume", "onBlur", "onClick", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "onDown", "onDrag", "onDragEnd", "onDragStart", "onFlick", "onHold", "onHoldEnd", "onHoldStart", "onMove", "onPinch", "onPinchEnd", "onPinchStart", "onTap", "onUp"];
|
|
41
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
42
|
-
|
|
43
32
|
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; }
|
|
44
|
-
|
|
45
33
|
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; }
|
|
46
|
-
|
|
47
34
|
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; }
|
|
48
|
-
|
|
49
35
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
50
|
-
|
|
51
36
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
52
|
-
|
|
53
37
|
var selectProps = function selectProps(props) {
|
|
54
38
|
var dragConfig = props.dragConfig,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
39
|
+
flickConfig = props.flickConfig,
|
|
40
|
+
holdConfig = props.holdConfig,
|
|
41
|
+
pinchConfig = props.pinchConfig,
|
|
42
|
+
disabled = props.disabled,
|
|
43
|
+
noResume = props.noResume,
|
|
44
|
+
onBlur = props.onBlur,
|
|
45
|
+
onClick = props.onClick,
|
|
46
|
+
onMouseDown = props.onMouseDown,
|
|
47
|
+
onMouseEnter = props.onMouseEnter,
|
|
48
|
+
onMouseLeave = props.onMouseLeave,
|
|
49
|
+
onMouseMove = props.onMouseMove,
|
|
50
|
+
onMouseUp = props.onMouseUp,
|
|
51
|
+
onTouchEnd = props.onTouchEnd,
|
|
52
|
+
onTouchMove = props.onTouchMove,
|
|
53
|
+
onTouchStart = props.onTouchStart,
|
|
54
|
+
onDown = props.onDown,
|
|
55
|
+
onDrag = props.onDrag,
|
|
56
|
+
onDragEnd = props.onDragEnd,
|
|
57
|
+
onDragStart = props.onDragStart,
|
|
58
|
+
onFlick = props.onFlick,
|
|
59
|
+
onHold = props.onHold,
|
|
60
|
+
onHoldEnd = props.onHoldEnd,
|
|
61
|
+
onHoldStart = props.onHoldStart,
|
|
62
|
+
onMove = props.onMove,
|
|
63
|
+
onPinch = props.onPinch,
|
|
64
|
+
onPinchEnd = props.onPinchEnd,
|
|
65
|
+
onPinchStart = props.onPinchStart,
|
|
66
|
+
onTap = props.onTap,
|
|
67
|
+
onUp = props.onUp,
|
|
68
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
82
69
|
return {
|
|
83
70
|
configForHook: {
|
|
84
71
|
/* configs */
|
|
85
72
|
dragConfig: dragConfig,
|
|
86
73
|
flickConfig: flickConfig,
|
|
87
74
|
holdConfig: holdConfig,
|
|
88
|
-
|
|
75
|
+
pinchConfig: pinchConfig,
|
|
89
76
|
/* general props */
|
|
90
77
|
disabled: disabled,
|
|
91
78
|
noResume: noResume,
|
|
92
|
-
|
|
93
79
|
/* events to be captured and forwarded by useTouch hook */
|
|
94
80
|
onBlur: onBlur,
|
|
95
81
|
onClick: onClick,
|
|
@@ -101,7 +87,6 @@ var selectProps = function selectProps(props) {
|
|
|
101
87
|
onTouchEnd: onTouchEnd,
|
|
102
88
|
onTouchMove: onTouchMove,
|
|
103
89
|
onTouchStart: onTouchStart,
|
|
104
|
-
|
|
105
90
|
/* custom events to be forwarded by useTouch hook */
|
|
106
91
|
onDown: onDown,
|
|
107
92
|
onDrag: onDrag,
|
|
@@ -112,6 +97,9 @@ var selectProps = function selectProps(props) {
|
|
|
112
97
|
onHoldEnd: onHoldEnd,
|
|
113
98
|
onHoldStart: onHoldStart,
|
|
114
99
|
onMove: onMove,
|
|
100
|
+
onPinch: onPinch,
|
|
101
|
+
onPinchEnd: onPinchEnd,
|
|
102
|
+
onPinchStart: onPinchStart,
|
|
115
103
|
onTap: onTap,
|
|
116
104
|
onUp: onUp
|
|
117
105
|
},
|
|
@@ -120,14 +108,13 @@ var selectProps = function selectProps(props) {
|
|
|
120
108
|
}, rest)
|
|
121
109
|
};
|
|
122
110
|
};
|
|
111
|
+
|
|
123
112
|
/**
|
|
124
113
|
* Default config for `Touchable`.
|
|
125
114
|
*
|
|
126
115
|
* @memberof ui/Touchable.Touchable
|
|
127
116
|
* @hocconfig
|
|
128
117
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
118
|
var defaultConfig = {
|
|
132
119
|
/**
|
|
133
120
|
* Configures the prop name to pass the active state to the wrapped component
|
|
@@ -138,11 +125,12 @@ var defaultConfig = {
|
|
|
138
125
|
*/
|
|
139
126
|
activeProp: null
|
|
140
127
|
};
|
|
128
|
+
|
|
141
129
|
/**
|
|
142
130
|
* A higher-order component that provides a consistent set of pointer events -- `onDown`, `onUp`,
|
|
143
131
|
* and `onTap` -- across mouse and touch interfaces along with support for common gestures including
|
|
144
|
-
* `onFlick`, `onDrag`, `onHoldStart`, `onHold`,
|
|
145
|
-
*
|
|
132
|
+
* `onFlick`, `onDragStart`, `onDrag`, `onDragEnd`, `onHoldStart`, `onHold`, `onHoldEnd`,
|
|
133
|
+
* `onPinchStart`, `onPinch`, and `onPinchEnd`.
|
|
146
134
|
* Note: This HoC passes a number of props to the wrapped component that should be passed to the
|
|
147
135
|
* main DOM node or consumed by the wrapped component.
|
|
148
136
|
*
|
|
@@ -151,24 +139,21 @@ var defaultConfig = {
|
|
|
151
139
|
* @hoc
|
|
152
140
|
* @public
|
|
153
141
|
*/
|
|
154
|
-
|
|
155
142
|
var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
156
|
-
var activeProp = config.activeProp;
|
|
143
|
+
var activeProp = config.activeProp;
|
|
157
144
|
|
|
145
|
+
// eslint-disable-next-line no-shadow
|
|
158
146
|
var Touchable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
159
147
|
var _selectProps = selectProps(props),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
148
|
+
configForHook = _selectProps.configForHook,
|
|
149
|
+
propsForWrapped = _selectProps.propsForWrapped;
|
|
163
150
|
var hook = (0, _useTouch["default"])(_objectSpread({
|
|
164
151
|
getActive: !!activeProp
|
|
165
152
|
}, configForHook));
|
|
166
153
|
Object.assign(propsForWrapped, hook.handlers);
|
|
167
|
-
|
|
168
154
|
if (activeProp) {
|
|
169
155
|
propsForWrapped[activeProp] = hook.active;
|
|
170
156
|
}
|
|
171
|
-
|
|
172
157
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread(_objectSpread({}, propsForWrapped), {}, {
|
|
173
158
|
ref: ref
|
|
174
159
|
}));
|
|
@@ -183,7 +168,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
183
168
|
* @public
|
|
184
169
|
*/
|
|
185
170
|
disabled: _propTypes["default"].bool,
|
|
186
|
-
|
|
187
171
|
/**
|
|
188
172
|
* Instance-specific overrides of the drag configuration.
|
|
189
173
|
*
|
|
@@ -193,7 +177,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
193
177
|
* @public
|
|
194
178
|
*/
|
|
195
179
|
dragConfig: _Drag.dragConfigPropType,
|
|
196
|
-
|
|
197
180
|
/**
|
|
198
181
|
* Instance-specific overrides of the flick configuration.
|
|
199
182
|
*
|
|
@@ -203,7 +186,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
203
186
|
* @public
|
|
204
187
|
*/
|
|
205
188
|
flickConfig: _Flick.flickConfigPropType,
|
|
206
|
-
|
|
207
189
|
/**
|
|
208
190
|
* Instance-specific overrides of the hold configuration.
|
|
209
191
|
*
|
|
@@ -213,7 +195,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
213
195
|
* @public
|
|
214
196
|
*/
|
|
215
197
|
holdConfig: _Hold.holdConfigPropType,
|
|
216
|
-
|
|
217
198
|
/**
|
|
218
199
|
* Prevents resuming the touch events and gestures when re-entering the component.
|
|
219
200
|
*
|
|
@@ -223,7 +204,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
223
204
|
* @public
|
|
224
205
|
*/
|
|
225
206
|
noResume: _propTypes["default"].bool,
|
|
226
|
-
|
|
227
207
|
/**
|
|
228
208
|
* Event handler for 'down' pointer events.
|
|
229
209
|
*
|
|
@@ -232,7 +212,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
232
212
|
* @public
|
|
233
213
|
*/
|
|
234
214
|
onDown: _propTypes["default"].func,
|
|
235
|
-
|
|
236
215
|
/**
|
|
237
216
|
* Event handler for a drag gesture.
|
|
238
217
|
*
|
|
@@ -247,7 +226,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
247
226
|
* @public
|
|
248
227
|
*/
|
|
249
228
|
onDrag: _propTypes["default"].func,
|
|
250
|
-
|
|
251
229
|
/**
|
|
252
230
|
* Event handler for the end of a drag gesture.
|
|
253
231
|
*
|
|
@@ -260,7 +238,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
260
238
|
* @public
|
|
261
239
|
*/
|
|
262
240
|
onDragEnd: _propTypes["default"].func,
|
|
263
|
-
|
|
264
241
|
/**
|
|
265
242
|
* Event handler for the start of a drag gesture.
|
|
266
243
|
*
|
|
@@ -275,7 +252,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
275
252
|
* @public
|
|
276
253
|
*/
|
|
277
254
|
onDragStart: _propTypes["default"].func,
|
|
278
|
-
|
|
279
255
|
/**
|
|
280
256
|
* Event handler for a flick gesture.
|
|
281
257
|
*
|
|
@@ -292,7 +268,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
292
268
|
* @public
|
|
293
269
|
*/
|
|
294
270
|
onFlick: _propTypes["default"].func,
|
|
295
|
-
|
|
296
271
|
/**
|
|
297
272
|
* Event handler for hold pulse events.
|
|
298
273
|
*
|
|
@@ -306,7 +281,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
306
281
|
* @public
|
|
307
282
|
*/
|
|
308
283
|
onHold: _propTypes["default"].func,
|
|
309
|
-
|
|
310
284
|
/**
|
|
311
285
|
* Event handler for the end of hold events.
|
|
312
286
|
*
|
|
@@ -320,7 +294,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
320
294
|
* @public
|
|
321
295
|
*/
|
|
322
296
|
onHoldEnd: _propTypes["default"].func,
|
|
323
|
-
|
|
324
297
|
/**
|
|
325
298
|
* Event handler for hold events.
|
|
326
299
|
*
|
|
@@ -336,7 +309,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
336
309
|
* @public
|
|
337
310
|
*/
|
|
338
311
|
onHoldStart: _propTypes["default"].func,
|
|
339
|
-
|
|
340
312
|
/**
|
|
341
313
|
* Event handler for 'move' pointer events.
|
|
342
314
|
*
|
|
@@ -345,7 +317,47 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
345
317
|
* @public
|
|
346
318
|
*/
|
|
347
319
|
onMove: _propTypes["default"].func,
|
|
348
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Event handler for a pinch gesture.
|
|
322
|
+
*
|
|
323
|
+
* Event payload includes:
|
|
324
|
+
*
|
|
325
|
+
* * `type` - Type of event, `'onPinch'`
|
|
326
|
+
* * `scale` - The scale factor, calculated from the distance while pinching.
|
|
327
|
+
* The default value is 1.0. The value would be a number between
|
|
328
|
+
* pinchConfig.minScale and pinchConfig.maxScale.
|
|
329
|
+
* * `coords` - The coordinates array of the touch point, relative to the viewport
|
|
330
|
+
*
|
|
331
|
+
* @memberof ui/Touchable.Touchable.prototype
|
|
332
|
+
* @type {Function}
|
|
333
|
+
* @public
|
|
334
|
+
*/
|
|
335
|
+
onPinch: _propTypes["default"].func,
|
|
336
|
+
/**
|
|
337
|
+
* Event handler for the end of a pinch gesture.
|
|
338
|
+
*
|
|
339
|
+
* Event payload includes:
|
|
340
|
+
*
|
|
341
|
+
* * `type` - Type of event, `'onPinchEnd'`
|
|
342
|
+
*
|
|
343
|
+
* @memberof ui/Touchable.Touchable.prototype
|
|
344
|
+
* @type {Function}
|
|
345
|
+
* @public
|
|
346
|
+
*/
|
|
347
|
+
onPinchEnd: _propTypes["default"].func,
|
|
348
|
+
/**
|
|
349
|
+
* Event handler for the start of a pinch gesture.
|
|
350
|
+
*
|
|
351
|
+
* Event payload includes:
|
|
352
|
+
*
|
|
353
|
+
* * `type` - Type of event, `'onPinchStart'`
|
|
354
|
+
* * `coords` - The coordinates array of the touch point, relative to the viewport
|
|
355
|
+
*
|
|
356
|
+
* @memberof ui/Touchable.Touchable.prototype
|
|
357
|
+
* @type {Function}
|
|
358
|
+
* @public
|
|
359
|
+
*/
|
|
360
|
+
onPinchStart: _propTypes["default"].func,
|
|
349
361
|
/**
|
|
350
362
|
* Event handler for 'tap' pointer events.
|
|
351
363
|
*
|
|
@@ -354,7 +366,6 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
354
366
|
* @public
|
|
355
367
|
*/
|
|
356
368
|
onTap: _propTypes["default"].func,
|
|
357
|
-
|
|
358
369
|
/**
|
|
359
370
|
* Event handler for 'up' pointer events.
|
|
360
371
|
*
|
|
@@ -362,7 +373,16 @@ var Touchable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
362
373
|
* @type {Function}
|
|
363
374
|
* @public
|
|
364
375
|
*/
|
|
365
|
-
onUp: _propTypes["default"].func
|
|
376
|
+
onUp: _propTypes["default"].func,
|
|
377
|
+
/**
|
|
378
|
+
* Instance-specific overrides of the pinch configuration.
|
|
379
|
+
*
|
|
380
|
+
* @see {@link ui/Touchable.configure}
|
|
381
|
+
* @memberof ui/Touchable.Touchable.prototype
|
|
382
|
+
* @type {Object}
|
|
383
|
+
* @public
|
|
384
|
+
*/
|
|
385
|
+
pinchConfig: _Pinch.pinchConfigPropType
|
|
366
386
|
};
|
|
367
387
|
Touchable.defaultProps = {
|
|
368
388
|
disabled: false,
|
package/Touchable/config.js
CHANGED
|
@@ -4,57 +4,54 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.resetDefaultConfig = exports.mergeConfig = exports.getConfig = exports["default"] = exports.configure = void 0;
|
|
7
|
-
|
|
8
7
|
var _Drag = require("./Drag.js");
|
|
9
|
-
|
|
10
8
|
var _Flick = require("./Flick.js");
|
|
11
|
-
|
|
12
9
|
var _Hold = require("./Hold.js");
|
|
13
|
-
|
|
10
|
+
var _Pinch = require("./Pinch");
|
|
14
11
|
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; }
|
|
15
|
-
|
|
16
12
|
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; }
|
|
17
|
-
|
|
18
13
|
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; }
|
|
19
|
-
|
|
20
14
|
var allowedDragKeys = Object.keys(_Drag.defaultDragConfig);
|
|
21
15
|
var allowedFlickKeys = Object.keys(_Flick.defaultFlickConfig);
|
|
22
16
|
var allowedHoldKeys = Object.keys(_Hold.defaultHoldConfig);
|
|
17
|
+
var allowedPinchKeys = Object.keys(_Pinch.defaultPinchConfig);
|
|
18
|
+
|
|
23
19
|
/**
|
|
24
20
|
* The Global Gesture Configuration Object
|
|
25
21
|
*
|
|
26
22
|
* @private
|
|
27
23
|
* @memberof ui/Touchable
|
|
28
24
|
*/
|
|
25
|
+
var config = {};
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
// map-friendly clone method
|
|
32
28
|
var clone = function clone(o) {
|
|
33
29
|
return Object.assign({}, o);
|
|
34
|
-
};
|
|
35
|
-
|
|
30
|
+
};
|
|
36
31
|
|
|
32
|
+
// Merges two configuation objects while retaining only the allowed keys
|
|
37
33
|
var mergeGestureConfig = function mergeGestureConfig(current, update, allowed) {
|
|
38
34
|
var cfg = _objectSpread(_objectSpread({}, current), update);
|
|
39
|
-
|
|
40
35
|
Object.keys(cfg).forEach(function (key) {
|
|
41
36
|
if (allowed.indexOf(key) === -1) {
|
|
42
37
|
delete cfg[key];
|
|
43
38
|
}
|
|
44
39
|
});
|
|
45
40
|
return cfg;
|
|
46
|
-
};
|
|
47
|
-
|
|
41
|
+
};
|
|
48
42
|
|
|
43
|
+
// Merges the current global config with the provided `cfg` and returns the result
|
|
49
44
|
var mergeConfig = function mergeConfig(cfg) {
|
|
50
45
|
var merged = {
|
|
51
46
|
drag: mergeGestureConfig(config.drag, cfg.drag, allowedDragKeys),
|
|
52
47
|
flick: mergeGestureConfig(config.flick, cfg.flick, allowedFlickKeys),
|
|
53
|
-
hold: mergeGestureConfig(config.hold, cfg.hold, allowedHoldKeys)
|
|
48
|
+
hold: mergeGestureConfig(config.hold, cfg.hold, allowedHoldKeys),
|
|
49
|
+
pinch: mergeGestureConfig(config.pinch, cfg.pinch, allowedPinchKeys)
|
|
54
50
|
};
|
|
55
51
|
merged.hold.events = merged.hold.events.map(clone);
|
|
56
52
|
return merged;
|
|
57
53
|
};
|
|
54
|
+
|
|
58
55
|
/**
|
|
59
56
|
* Configures the global gesture configuration for the application.
|
|
60
57
|
*
|
|
@@ -110,6 +107,19 @@ var mergeConfig = function mergeConfig(cfg) {
|
|
|
110
107
|
* controls the amount of time that must pass before this `onHoldStart` event is fired and should
|
|
111
108
|
* be a multiple of `frequency`.
|
|
112
109
|
*
|
|
110
|
+
* `pinch`
|
|
111
|
+
*
|
|
112
|
+
* * `boxSizing` - The part of the component's box model is used as the bounds of the constraint.
|
|
113
|
+
* Only applies when `global` is `false`.
|
|
114
|
+
* * `'border-box'` - the default, includes the padding and border but excludes the margin.
|
|
115
|
+
* * `'content-box'` - excludes the padding, border, and margin.
|
|
116
|
+
* * `global` - When `true`, pinch gestures will continue when leaving the bounds of the component
|
|
117
|
+
* or blurring the component.
|
|
118
|
+
* * `maxScale` - The maximum scale value. Defaults to `4`.
|
|
119
|
+
* * `minScale` - The minimum scale value. Defaults to `0.5`.
|
|
120
|
+
* * `moveTolerance` - The distance difference from the previous distance that the pointer may move
|
|
121
|
+
* before cancelling the scaling. Defaults to `16`.
|
|
122
|
+
*
|
|
113
123
|
* @function
|
|
114
124
|
* @param {Object} cfg A partial or complete configuration object
|
|
115
125
|
*
|
|
@@ -117,30 +127,23 @@ var mergeConfig = function mergeConfig(cfg) {
|
|
|
117
127
|
* @public
|
|
118
128
|
* @memberof ui/Touchable
|
|
119
129
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
130
|
exports.mergeConfig = mergeConfig;
|
|
123
|
-
|
|
124
131
|
var configure = function configure(cfg) {
|
|
125
132
|
config = mergeConfig(cfg);
|
|
126
133
|
};
|
|
127
|
-
|
|
128
134
|
exports.configure = configure;
|
|
129
|
-
|
|
130
135
|
var getConfig = function getConfig() {
|
|
131
136
|
return config;
|
|
132
137
|
};
|
|
133
|
-
|
|
134
138
|
exports.getConfig = getConfig;
|
|
135
|
-
|
|
136
139
|
var resetDefaultConfig = function resetDefaultConfig() {
|
|
137
140
|
return configure({
|
|
138
141
|
drag: _Drag.defaultDragConfig,
|
|
142
|
+
flick: _Flick.defaultFlickConfig,
|
|
139
143
|
hold: _Hold.defaultHoldConfig,
|
|
140
|
-
|
|
144
|
+
pinch: _Pinch.defaultPinchConfig
|
|
141
145
|
});
|
|
142
146
|
};
|
|
143
|
-
|
|
144
147
|
exports.resetDefaultConfig = resetDefaultConfig;
|
|
145
148
|
resetDefaultConfig();
|
|
146
149
|
var _default = configure;
|