@nutui/nutui-react-taro 3.0.19-cpp.26-beta.1 → 3.0.19-cpp.26-beta.2
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/dist/cjs/locales/base.d.ts +3 -0
- package/dist/cjs/locales/en-US.js +4 -1
- package/dist/cjs/locales/id-ID.js +4 -1
- package/dist/cjs/locales/ja-JP.js +4 -1
- package/dist/cjs/locales/tr-TR.js +4 -1
- package/dist/cjs/locales/zh-CN.js +4 -1
- package/dist/cjs/locales/zh-TW.js +4 -1
- package/dist/cjs/locales/zh-UG.js +4 -1
- package/dist/cjs/packages/actionsheet/style/style.harmony.css +19 -7
- package/dist/cjs/packages/address/style/style.harmony.css +19 -7
- package/dist/cjs/packages/calendar/style/style.harmony.css +19 -7
- package/dist/cjs/packages/cascader/style/style.harmony.css +19 -7
- package/dist/cjs/packages/configprovider/types.d.ts +1 -1
- package/dist/cjs/packages/datepicker/style/style.harmony.css +19 -7
- package/dist/cjs/packages/imagepreview/style/style.harmony.css +19 -7
- package/dist/cjs/packages/numberkeyboard/style/style.harmony.css +19 -7
- package/dist/cjs/packages/nutui.react.build.d.ts +3 -1
- package/dist/cjs/packages/nutui.react.build.js +18 -14
- package/dist/cjs/packages/nutui.react.d.ts +4 -1
- package/dist/cjs/packages/nutui.react.js +19 -14
- package/dist/cjs/packages/nutui.react.scss.d.ts +1 -0
- package/dist/cjs/packages/nutui.react.scss.js +1 -0
- package/dist/cjs/packages/overlay/overlay.js +11 -17
- package/dist/cjs/packages/picker/style/style.harmony.css +19 -7
- package/dist/cjs/packages/popover/style/style.harmony.css +19 -7
- package/dist/cjs/packages/popup/popup.js +171 -99
- package/dist/cjs/packages/popup/style/popup.scss +19 -8
- package/dist/cjs/packages/popup/style/style.css +19 -7
- package/dist/cjs/packages/popup/style/style.harmony.css +19 -7
- package/dist/cjs/packages/popup/style-jmapp/popup.scss +19 -8
- package/dist/cjs/packages/popup/style-jmapp/style.css +19 -7
- package/dist/cjs/packages/popup/style-jrkf/popup.scss +19 -8
- package/dist/cjs/packages/popup/style-jrkf/style.css +19 -7
- package/dist/cjs/packages/quickenter/index.d.ts +3 -0
- package/dist/cjs/packages/quickenter/index.js +13 -0
- package/dist/cjs/packages/quickenter/quickenter.d.ts +4 -0
- package/dist/cjs/packages/quickenter/quickenter.js +147 -0
- package/dist/cjs/packages/quickenter/style/css.js +2 -0
- package/dist/cjs/packages/quickenter/style/index.js +2 -0
- package/dist/cjs/packages/quickenter/style/quickenter.scss +110 -0
- package/dist/cjs/packages/quickenter/style/style.css +99 -0
- package/dist/cjs/packages/quickenter/style/style.harmony.css +500 -0
- package/dist/cjs/packages/quickenter/style-jmapp/css.js +2 -0
- package/dist/cjs/packages/quickenter/style-jmapp/index.js +2 -0
- package/dist/cjs/packages/quickenter/style-jmapp/quickenter.scss +110 -0
- package/dist/cjs/packages/quickenter/style-jmapp/style.css +99 -0
- package/dist/cjs/packages/quickenter/style-jrkf/css.js +2 -0
- package/dist/cjs/packages/quickenter/style-jrkf/index.js +2 -0
- package/dist/cjs/packages/quickenter/style-jrkf/quickenter.scss +110 -0
- package/dist/cjs/packages/quickenter/style-jrkf/style.css +99 -0
- package/dist/cjs/packages/shortpassword/style/style.harmony.css +19 -7
- package/dist/cjs/packages/timeselect/style/style.harmony.css +19 -7
- package/dist/cjs/packages/tour/style/style.harmony.css +19 -7
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/cjs/types/index.js +3 -0
- package/dist/cjs/types/spec/quickenter/base.d.ts +26 -0
- package/dist/cjs/types/spec/quickenter/base.js +4 -0
- package/dist/cjs/types/spec/quickenter/h5.d.ts +5 -0
- package/dist/cjs/types/spec/quickenter/h5.js +4 -0
- package/dist/cjs/types/spec/quickenter/taro.d.ts +5 -0
- package/dist/cjs/types/spec/quickenter/taro.js +4 -0
- package/dist/cjs/utils/taro/ConfigurableCSSTransition.d.ts +15 -0
- package/dist/cjs/utils/taro/ConfigurableCSSTransition.js +90 -0
- package/dist/es/locales/base.d.ts +3 -0
- package/dist/es/locales/en-US.js +4 -1
- package/dist/es/locales/id-ID.js +4 -1
- package/dist/es/locales/ja-JP.js +4 -1
- package/dist/es/locales/tr-TR.js +4 -1
- package/dist/es/locales/zh-CN.js +4 -1
- package/dist/es/locales/zh-TW.js +4 -1
- package/dist/es/locales/zh-UG.js +4 -1
- package/dist/es/packages/actionsheet/style/style.harmony.css +19 -7
- package/dist/es/packages/address/style/style.harmony.css +19 -7
- package/dist/es/packages/calendar/style/style.harmony.css +19 -7
- package/dist/es/packages/cascader/style/style.harmony.css +19 -7
- package/dist/es/packages/configprovider/types.d.ts +1 -1
- package/dist/es/packages/datepicker/style/style.harmony.css +19 -7
- package/dist/es/packages/imagepreview/style/style.harmony.css +19 -7
- package/dist/es/packages/numberkeyboard/style/style.harmony.css +19 -7
- package/dist/es/packages/nutui.react.build.d.ts +3 -1
- package/dist/es/packages/nutui.react.build.js +3 -1
- package/dist/es/packages/overlay/overlay.js +11 -17
- package/dist/es/packages/picker/style/style.harmony.css +19 -7
- package/dist/es/packages/popover/style/style.harmony.css +19 -7
- package/dist/es/packages/popup/popup.js +172 -101
- package/dist/es/packages/popup/style/popup.scss +19 -8
- package/dist/es/packages/popup/style/style.css +19 -7
- package/dist/es/packages/popup/style/style.harmony.css +19 -7
- package/dist/es/packages/popup/style-jmapp/popup.scss +19 -8
- package/dist/es/packages/popup/style-jmapp/style.css +19 -7
- package/dist/es/packages/popup/style-jrkf/popup.scss +19 -8
- package/dist/es/packages/popup/style-jrkf/style.css +19 -7
- package/dist/es/packages/quickenter/index.d.ts +3 -0
- package/dist/es/packages/quickenter/index.js +2 -0
- package/dist/es/packages/quickenter/quickenter.d.ts +4 -0
- package/dist/es/packages/quickenter/quickenter.js +135 -0
- package/dist/es/packages/quickenter/style/css.js +2 -0
- package/dist/es/packages/quickenter/style/index.js +2 -0
- package/dist/es/packages/quickenter/style/quickenter.scss +110 -0
- package/dist/es/packages/quickenter/style/style.css +99 -0
- package/dist/es/packages/quickenter/style/style.harmony.css +500 -0
- package/dist/es/packages/quickenter/style-jmapp/css.js +2 -0
- package/dist/es/packages/quickenter/style-jmapp/index.js +2 -0
- package/dist/es/packages/quickenter/style-jmapp/quickenter.scss +110 -0
- package/dist/es/packages/quickenter/style-jmapp/style.css +99 -0
- package/dist/es/packages/quickenter/style-jrkf/css.js +2 -0
- package/dist/es/packages/quickenter/style-jrkf/index.js +2 -0
- package/dist/es/packages/quickenter/style-jrkf/quickenter.scss +110 -0
- package/dist/es/packages/quickenter/style-jrkf/style.css +99 -0
- package/dist/es/packages/shortpassword/style/style.harmony.css +19 -7
- package/dist/es/packages/timeselect/style/style.harmony.css +19 -7
- package/dist/es/packages/tour/style/style.harmony.css +19 -7
- package/dist/es/types/index.d.ts +3 -0
- package/dist/es/types/index.js +3 -0
- package/dist/es/types/spec/quickenter/base.d.ts +44 -0
- package/dist/es/types/spec/quickenter/base.js +1 -0
- package/dist/es/types/spec/quickenter/h5.d.ts +5 -0
- package/dist/es/types/spec/quickenter/h5.js +1 -0
- package/dist/es/types/spec/quickenter/taro.d.ts +5 -0
- package/dist/es/types/spec/quickenter/taro.js +1 -0
- package/dist/es/utils/taro/ConfigurableCSSTransition.d.ts +15 -0
- package/dist/es/utils/taro/ConfigurableCSSTransition.js +79 -0
- package/dist/nutui.react.umd.js +582 -295
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +31 -30
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +27 -26
- package/dist/style.css +1 -1
- package/dist/style.scss +30 -29
- package/dist/styles/variables-daojia.scss +36 -0
- package/dist/styles/variables-jmapp.scss +36 -0
- package/dist/styles/variables-jrkf.scss +36 -0
- package/dist/styles/variables.scss +36 -0
- package/package.json +1 -1
|
@@ -4,13 +4,13 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
4
4
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
5
5
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
6
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
7
|
-
import React, { useState, useEffect, useRef } from "react";
|
|
7
|
+
import React, { useState, useEffect, useRef, useMemo, useCallback } from "react";
|
|
8
8
|
import { nextTick } from "@tarojs/taro";
|
|
9
9
|
import { createPortal } from "react-dom";
|
|
10
|
-
// import { CSSTransition } from 'react-transition-group'
|
|
11
10
|
import classNames from "classnames";
|
|
12
11
|
import { Close } from "@nutui/icons-react-taro";
|
|
13
12
|
import { View } from "@tarojs/components";
|
|
13
|
+
import ConfigurableCSSTransition from "../../utils/taro/ConfigurableCSSTransition";
|
|
14
14
|
import { getRectInMultiPlatformWithoutCache } from "../../utils/taro/get-rect";
|
|
15
15
|
import { defaultOverlayProps } from "../overlay/overlay";
|
|
16
16
|
import Overlay from "../overlay/index";
|
|
@@ -48,54 +48,57 @@ var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps),
|
|
|
48
48
|
var _zIndex = 1100;
|
|
49
49
|
export var Popup = function(props) {
|
|
50
50
|
var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, visible = _$_object_spread.visible, overlay = _$_object_spread.overlay, closeOnOverlayClick = _$_object_spread.closeOnOverlayClick, overlayStyle = _$_object_spread.overlayStyle, overlayClassName = _$_object_spread.overlayClassName, zIndex = _$_object_spread.zIndex, lockScroll = _$_object_spread.lockScroll, duration = _$_object_spread.duration, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, left = _$_object_spread.left, title = _$_object_spread.title, top = _$_object_spread.top, description = _$_object_spread.description, style = _$_object_spread.style, transition = _$_object_spread.transition, round = _$_object_spread.round, position = _$_object_spread.position, className = _$_object_spread.className, destroyOnClose = _$_object_spread.destroyOnClose, portal = _$_object_spread.portal, resizable = _$_object_spread.resizable, minHeight = _$_object_spread.minHeight, onOpen = _$_object_spread.onOpen, onClose = _$_object_spread.onClose, onOverlayClick = _$_object_spread.onOverlayClick, onCloseIconClick = _$_object_spread.onCloseIconClick, afterShow = _$_object_spread.afterShow, afterClose = _$_object_spread.afterClose, onClick = _$_object_spread.onClick, onTouchStart = _$_object_spread.onTouchStart, onTouchMove = _$_object_spread.onTouchMove, onTouchEnd = _$_object_spread.onTouchEnd, closeAriaLabel = _$_object_spread.closeAriaLabel;
|
|
51
|
-
var
|
|
52
|
-
var _useState = _sliced_to_array(useState(
|
|
51
|
+
var locale = useConfig().locale;
|
|
52
|
+
var _useState = _sliced_to_array(useState(zIndex || _zIndex), 2), index = _useState[0], setIndex = _useState[1];
|
|
53
53
|
var _useState1 = _sliced_to_array(useState(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
|
|
54
54
|
var _useState2 = _sliced_to_array(useState(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
|
|
55
|
-
var _useState3 = _sliced_to_array(useState(''), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
|
|
56
55
|
var nodeRef = useLockScrollTaro(innerVisible && lockScroll);
|
|
57
|
-
var topNodeRef =
|
|
56
|
+
var topNodeRef = useRef(null);
|
|
58
57
|
var rootRect = useRef(null);
|
|
59
58
|
var touchStartRef = useRef(0);
|
|
60
59
|
var touchMoveDistanceRef = useRef(0);
|
|
61
60
|
var heightRef = useRef(0);
|
|
62
61
|
var defaultHeightRef = useRef(0);
|
|
63
62
|
var isTouching = useRef(false);
|
|
64
|
-
var locale = useConfig().locale;
|
|
65
63
|
var classPrefix = 'nut-popup';
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
64
|
+
var transitionName = useMemo(function() {
|
|
65
|
+
return transition || "".concat(classPrefix, "-slide-").concat(position);
|
|
66
|
+
}, [
|
|
67
|
+
transition,
|
|
68
|
+
position
|
|
69
|
+
]);
|
|
70
|
+
var overlayStyles = useMemo(function() {
|
|
71
|
+
return _object_spread({}, overlayStyle);
|
|
72
|
+
}, [
|
|
73
|
+
overlayStyle
|
|
74
|
+
]);
|
|
75
|
+
var contentZIndex = useMemo(function() {
|
|
76
|
+
return harmony() ? index + 1 : index // 解决harmony层级问题
|
|
77
|
+
;
|
|
78
|
+
}, [
|
|
79
|
+
index
|
|
80
|
+
]);
|
|
81
|
+
var popStyles = useMemo(function() {
|
|
82
|
+
return _object_spread({
|
|
83
|
+
zIndex: contentZIndex,
|
|
84
|
+
minHeight: minHeight
|
|
85
|
+
}, style);
|
|
86
|
+
}, [
|
|
87
|
+
contentZIndex,
|
|
88
|
+
minHeight,
|
|
89
|
+
style
|
|
90
|
+
]);
|
|
91
|
+
var popClassName = useMemo(function() {
|
|
92
|
+
var _obj;
|
|
93
|
+
return classNames(classPrefix, (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-round"), round || position === 'bottom'), _define_property(_obj, "".concat(classPrefix, "-").concat(position), true), _obj), className);
|
|
94
|
+
}, [
|
|
95
|
+
round,
|
|
96
|
+
position,
|
|
97
|
+
className
|
|
98
|
+
]);
|
|
99
|
+
var _useState3 = _sliced_to_array(useState(''), 2), popupHeight = _useState3[0], setPopupHeight = _useState3[1];
|
|
100
|
+
var _useState4 = _sliced_to_array(useState(''), 2), topBottom = _useState4[0], setTopBottom = _useState4[1];
|
|
101
|
+
var getPopupHeight = useCallback(function() {
|
|
99
102
|
return _async_to_generator(function() {
|
|
100
103
|
var _nodeRef_current, rect, height;
|
|
101
104
|
return _ts_generator(this, function(_state) {
|
|
@@ -115,19 +118,36 @@ export var Popup = function(props) {
|
|
|
115
118
|
}
|
|
116
119
|
});
|
|
117
120
|
})();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
}, [
|
|
122
|
+
nodeRef
|
|
123
|
+
]);
|
|
124
|
+
var open = useCallback(function() {
|
|
125
|
+
if (!innerVisible) {
|
|
126
|
+
// 当高度改变后,再次打开时,将高度置为初始高度
|
|
127
|
+
if (position === 'bottom' && resizable && nodeRef.current && heightRef.current) {
|
|
128
|
+
setPopupHeight(pxTransform(defaultHeightRef.current));
|
|
129
|
+
}
|
|
130
|
+
setInnerVisible(true);
|
|
131
|
+
setIndex(function(prev) {
|
|
132
|
+
return prev + 1;
|
|
125
133
|
});
|
|
126
134
|
}
|
|
135
|
+
if (destroyOnClose) {
|
|
136
|
+
setShowChildren(true);
|
|
137
|
+
}
|
|
138
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
127
139
|
}, [
|
|
128
|
-
innerVisible
|
|
140
|
+
innerVisible,
|
|
141
|
+
position,
|
|
142
|
+
resizable,
|
|
143
|
+
destroyOnClose,
|
|
144
|
+
onOpen,
|
|
145
|
+
nodeRef,
|
|
146
|
+
setInnerVisible,
|
|
147
|
+
setIndex,
|
|
148
|
+
setShowChildren
|
|
129
149
|
]);
|
|
130
|
-
var close = function() {
|
|
150
|
+
var close = useCallback(function() {
|
|
131
151
|
if (innerVisible) {
|
|
132
152
|
setInnerVisible(false);
|
|
133
153
|
if (destroyOnClose) {
|
|
@@ -135,28 +155,70 @@ export var Popup = function(props) {
|
|
|
135
155
|
setShowChildren(false);
|
|
136
156
|
}, Number(duration));
|
|
137
157
|
}
|
|
138
|
-
onClose
|
|
158
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
139
159
|
}
|
|
140
|
-
}
|
|
141
|
-
|
|
160
|
+
}, [
|
|
161
|
+
innerVisible,
|
|
162
|
+
destroyOnClose,
|
|
163
|
+
duration,
|
|
164
|
+
onClose,
|
|
165
|
+
setInnerVisible,
|
|
166
|
+
setShowChildren
|
|
167
|
+
]);
|
|
168
|
+
useEffect(function() {
|
|
169
|
+
visible ? open() : close();
|
|
170
|
+
}, [
|
|
171
|
+
visible,
|
|
172
|
+
open,
|
|
173
|
+
close
|
|
174
|
+
]);
|
|
175
|
+
useEffect(function() {
|
|
176
|
+
if (innerVisible && topNodeRef.current && nodeRef.current) {
|
|
177
|
+
nextTick(function() {
|
|
178
|
+
nextTick(function() {
|
|
179
|
+
getPopupHeight();
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}, [
|
|
184
|
+
innerVisible,
|
|
185
|
+
getPopupHeight,
|
|
186
|
+
nodeRef
|
|
187
|
+
]);
|
|
188
|
+
var handleOverlayClick = useCallback(function(e) {
|
|
142
189
|
e.stopPropagation();
|
|
143
190
|
if (closeOnOverlayClick && onOverlayClick(e)) {
|
|
144
191
|
close();
|
|
145
192
|
}
|
|
146
|
-
}
|
|
147
|
-
|
|
193
|
+
}, [
|
|
194
|
+
closeOnOverlayClick,
|
|
195
|
+
onOverlayClick,
|
|
196
|
+
close
|
|
197
|
+
]);
|
|
198
|
+
var handleCloseIconClick = useCallback(function(e) {
|
|
148
199
|
onCloseIconClick(e) && close();
|
|
149
|
-
}
|
|
150
|
-
|
|
200
|
+
}, [
|
|
201
|
+
onCloseIconClick,
|
|
202
|
+
close
|
|
203
|
+
]);
|
|
204
|
+
var renderCloseIcon = useCallback(function() {
|
|
205
|
+
if (!closeable) return null;
|
|
151
206
|
var closeClasses = classNames("".concat(classPrefix, "-title-right"), "".concat(classPrefix, "-title-right-").concat(closeIconPosition));
|
|
152
|
-
return /*#__PURE__*/ React.createElement(
|
|
207
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
153
208
|
className: closeClasses,
|
|
154
209
|
onClick: handleCloseIconClick,
|
|
155
210
|
ariaRole: "button",
|
|
156
211
|
ariaLabel: closeAriaLabel || locale.close
|
|
157
|
-
}, /*#__PURE__*/ React.isValidElement(closeIcon) ? closeIcon : /*#__PURE__*/ React.createElement(Close, null))
|
|
158
|
-
}
|
|
159
|
-
|
|
212
|
+
}, /*#__PURE__*/ React.isValidElement(closeIcon) ? closeIcon : /*#__PURE__*/ React.createElement(Close, null));
|
|
213
|
+
}, [
|
|
214
|
+
closeable,
|
|
215
|
+
closeIconPosition,
|
|
216
|
+
handleCloseIconClick,
|
|
217
|
+
closeAriaLabel,
|
|
218
|
+
locale.close,
|
|
219
|
+
closeIcon
|
|
220
|
+
]);
|
|
221
|
+
var renderTop = useCallback(function() {
|
|
160
222
|
if (!top) return null;
|
|
161
223
|
return /*#__PURE__*/ React.createElement(View, {
|
|
162
224
|
className: "".concat(classPrefix, "-bottom-top"),
|
|
@@ -165,8 +227,11 @@ export var Popup = function(props) {
|
|
|
165
227
|
bottom: topBottom
|
|
166
228
|
}
|
|
167
229
|
}, top);
|
|
168
|
-
}
|
|
169
|
-
|
|
230
|
+
}, [
|
|
231
|
+
top,
|
|
232
|
+
topBottom
|
|
233
|
+
]);
|
|
234
|
+
var renderTitle = useCallback(function() {
|
|
170
235
|
if (left || title || description) {
|
|
171
236
|
return /*#__PURE__*/ React.createElement(View, {
|
|
172
237
|
className: "".concat(classPrefix, "-title")
|
|
@@ -183,8 +248,15 @@ export var Popup = function(props) {
|
|
|
183
248
|
if (closeable) {
|
|
184
249
|
return renderCloseIcon();
|
|
185
250
|
}
|
|
186
|
-
}
|
|
187
|
-
|
|
251
|
+
}, [
|
|
252
|
+
left,
|
|
253
|
+
title,
|
|
254
|
+
description,
|
|
255
|
+
position,
|
|
256
|
+
closeable,
|
|
257
|
+
renderCloseIcon
|
|
258
|
+
]);
|
|
259
|
+
var handleTouchStart = useCallback(function(event) {
|
|
188
260
|
return _async_to_generator(function() {
|
|
189
261
|
var _nodeRef_current, _rootRect_current, e, rect;
|
|
190
262
|
return _ts_generator(this, function(_state) {
|
|
@@ -214,8 +286,13 @@ export var Popup = function(props) {
|
|
|
214
286
|
}
|
|
215
287
|
});
|
|
216
288
|
})();
|
|
217
|
-
}
|
|
218
|
-
|
|
289
|
+
}, [
|
|
290
|
+
position,
|
|
291
|
+
resizable,
|
|
292
|
+
onTouchStart,
|
|
293
|
+
nodeRef
|
|
294
|
+
]);
|
|
295
|
+
var handleTouchMove = useCallback(function(event) {
|
|
219
296
|
if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
|
|
220
297
|
var e = event;
|
|
221
298
|
e.stopPropagation();
|
|
@@ -234,21 +311,42 @@ export var Popup = function(props) {
|
|
|
234
311
|
}
|
|
235
312
|
};
|
|
236
313
|
requestAnimationFrame(handleMove);
|
|
237
|
-
}
|
|
238
|
-
|
|
314
|
+
}, [
|
|
315
|
+
position,
|
|
316
|
+
resizable,
|
|
317
|
+
minHeight,
|
|
318
|
+
onTouchMove,
|
|
319
|
+
nodeRef
|
|
320
|
+
]);
|
|
321
|
+
var handleTouchEnd = useCallback(function(event) {
|
|
239
322
|
if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
|
|
240
323
|
var e = event;
|
|
241
324
|
isTouching.current = false;
|
|
242
325
|
var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
|
|
243
326
|
var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
|
|
244
327
|
onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(currentHeight, e);
|
|
245
|
-
}
|
|
328
|
+
}, [
|
|
329
|
+
position,
|
|
330
|
+
resizable,
|
|
331
|
+
minHeight,
|
|
332
|
+
onTouchEnd,
|
|
333
|
+
nodeRef
|
|
334
|
+
]);
|
|
246
335
|
var renderPop = function() {
|
|
247
|
-
return /*#__PURE__*/ React.createElement(
|
|
336
|
+
return /*#__PURE__*/ React.createElement(ConfigurableCSSTransition, {
|
|
337
|
+
nodeRef: nodeRef,
|
|
338
|
+
classNames: transitionName,
|
|
339
|
+
mountOnEnter: true,
|
|
340
|
+
unmountOnExit: destroyOnClose,
|
|
341
|
+
timeout: Number(duration),
|
|
342
|
+
in: innerVisible,
|
|
343
|
+
onEntered: afterShow,
|
|
344
|
+
onExited: afterClose
|
|
345
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
248
346
|
ref: nodeRef,
|
|
249
|
-
style: _object_spread(
|
|
250
|
-
|
|
251
|
-
}
|
|
347
|
+
style: _object_spread({}, popStyles, popupHeight ? {
|
|
348
|
+
height: popupHeight
|
|
349
|
+
} : {}),
|
|
252
350
|
className: popClassName,
|
|
253
351
|
onClick: onClick,
|
|
254
352
|
catchMove: lockScroll,
|
|
@@ -256,24 +354,8 @@ export var Popup = function(props) {
|
|
|
256
354
|
onTouchMove: handleTouchMove,
|
|
257
355
|
onTouchEnd: handleTouchEnd,
|
|
258
356
|
onTouchCancel: handleTouchEnd
|
|
259
|
-
}, renderTop(), renderTitle(), showChildren ? children : null);
|
|
357
|
+
}, renderTop(), renderTitle(), showChildren ? children : null));
|
|
260
358
|
};
|
|
261
|
-
// const renderPop = () => {
|
|
262
|
-
// return (
|
|
263
|
-
// <CSSTransition
|
|
264
|
-
// nodeRef={nodeRef}
|
|
265
|
-
// classNames={transitionName}
|
|
266
|
-
// mountOnEnter
|
|
267
|
-
// unmountOnExit={destroyOnClose}
|
|
268
|
-
// timeout={duration}
|
|
269
|
-
// in={innerVisible}
|
|
270
|
-
// onEntered={afterShow}
|
|
271
|
-
// onExited={afterClose}
|
|
272
|
-
// >
|
|
273
|
-
// {renderContent()}
|
|
274
|
-
// </CSSTransition>
|
|
275
|
-
// )
|
|
276
|
-
// }
|
|
277
359
|
var renderNode = function() {
|
|
278
360
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, overlay ? /*#__PURE__*/ React.createElement(Overlay, {
|
|
279
361
|
zIndex: index,
|
|
@@ -286,17 +368,6 @@ export var Popup = function(props) {
|
|
|
286
368
|
onClick: handleOverlayClick
|
|
287
369
|
}) : null, renderPop());
|
|
288
370
|
};
|
|
289
|
-
useEffect(function() {
|
|
290
|
-
visible ? open() : close();
|
|
291
|
-
}, [
|
|
292
|
-
visible
|
|
293
|
-
]);
|
|
294
|
-
useEffect(function() {
|
|
295
|
-
setTransitionName(transition || "".concat(classPrefix, "-slide-").concat(position));
|
|
296
|
-
}, [
|
|
297
|
-
position,
|
|
298
|
-
transition
|
|
299
|
-
]);
|
|
300
371
|
var resolveContainer = function(getContainer) {
|
|
301
372
|
return (typeof getContainer === 'function' ? getContainer() : getContainer) || document.body;
|
|
302
373
|
};
|
|
@@ -219,6 +219,9 @@
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
@keyframes popup-slide-top-exit {
|
|
222
|
+
from {
|
|
223
|
+
transform: translate3d(0, 0%, 0);
|
|
224
|
+
}
|
|
222
225
|
to {
|
|
223
226
|
transform: translate3d(0, -100%, 0);
|
|
224
227
|
}
|
|
@@ -249,6 +252,9 @@
|
|
|
249
252
|
}
|
|
250
253
|
|
|
251
254
|
@keyframes popup-slide-right-exit {
|
|
255
|
+
from {
|
|
256
|
+
transform: translate3d(0%, 0, 0);
|
|
257
|
+
}
|
|
252
258
|
to {
|
|
253
259
|
transform: translate3d(100%, 0, 0);
|
|
254
260
|
}
|
|
@@ -262,7 +268,7 @@
|
|
|
262
268
|
animation-duration: $popup-animation-duration;
|
|
263
269
|
}
|
|
264
270
|
|
|
265
|
-
&-right-exit {
|
|
271
|
+
&-right-exit-active {
|
|
266
272
|
animation-fill-mode: both;
|
|
267
273
|
animation-name: popup-slide-right-exit;
|
|
268
274
|
animation-duration: $popup-animation-duration;
|
|
@@ -278,7 +284,10 @@
|
|
|
278
284
|
}
|
|
279
285
|
}
|
|
280
286
|
|
|
281
|
-
@keyframes slide-bottom-exit {
|
|
287
|
+
@keyframes popup-slide-bottom-exit {
|
|
288
|
+
from {
|
|
289
|
+
transform: translate3d(0, 0%, 0);
|
|
290
|
+
}
|
|
282
291
|
to {
|
|
283
292
|
transform: translate3d(0, 100%, 0);
|
|
284
293
|
}
|
|
@@ -286,15 +295,15 @@
|
|
|
286
295
|
|
|
287
296
|
&-bottom-enter-active,
|
|
288
297
|
&-bottom-appear-active {
|
|
289
|
-
transform:
|
|
298
|
+
transform: translate3d(0, 0, 0);
|
|
290
299
|
animation-fill-mode: both;
|
|
291
300
|
animation-name: popup-slide-bottom-enter;
|
|
292
301
|
animation-duration: $popup-animation-duration;
|
|
293
302
|
}
|
|
294
303
|
|
|
295
|
-
&-bottom-exit {
|
|
304
|
+
&-bottom-exit-active {
|
|
296
305
|
animation-fill-mode: both;
|
|
297
|
-
animation-name: slide-bottom-exit;
|
|
306
|
+
animation-name: popup-slide-bottom-exit;
|
|
298
307
|
animation-duration: $popup-animation-duration;
|
|
299
308
|
}
|
|
300
309
|
|
|
@@ -309,6 +318,9 @@
|
|
|
309
318
|
}
|
|
310
319
|
|
|
311
320
|
@keyframes popup-slide-left-exit {
|
|
321
|
+
from {
|
|
322
|
+
transform: translate3d(0%, 0, 0);
|
|
323
|
+
}
|
|
312
324
|
to {
|
|
313
325
|
transform: translate3d(-100%, 0, 0);
|
|
314
326
|
}
|
|
@@ -316,14 +328,13 @@
|
|
|
316
328
|
|
|
317
329
|
&-left-enter-active,
|
|
318
330
|
&-left-appear-active {
|
|
319
|
-
transform:
|
|
331
|
+
transform: translate3d(0, 0, 0);
|
|
320
332
|
animation-fill-mode: both;
|
|
321
333
|
animation-name: popup-slide-left-enter;
|
|
322
334
|
animation-duration: $popup-animation-duration;
|
|
323
335
|
}
|
|
324
336
|
|
|
325
|
-
&-left-exit-active
|
|
326
|
-
&-left-exit-done {
|
|
337
|
+
&-left-exit-active {
|
|
327
338
|
animation-fill-mode: both;
|
|
328
339
|
animation-name: popup-slide-left-exit;
|
|
329
340
|
animation-duration: $popup-animation-duration;
|
|
@@ -197,6 +197,9 @@
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
@keyframes popup-slide-top-exit {
|
|
200
|
+
from {
|
|
201
|
+
transform: translate3d(0, 0%, 0);
|
|
202
|
+
}
|
|
200
203
|
to {
|
|
201
204
|
transform: translate3d(0, -100%, 0);
|
|
202
205
|
}
|
|
@@ -221,6 +224,9 @@
|
|
|
221
224
|
}
|
|
222
225
|
}
|
|
223
226
|
@keyframes popup-slide-right-exit {
|
|
227
|
+
from {
|
|
228
|
+
transform: translate3d(0%, 0, 0);
|
|
229
|
+
}
|
|
224
230
|
to {
|
|
225
231
|
transform: translate3d(100%, 0, 0);
|
|
226
232
|
}
|
|
@@ -231,7 +237,7 @@
|
|
|
231
237
|
animation-name: popup-slide-right-enter;
|
|
232
238
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
233
239
|
}
|
|
234
|
-
.nut-popup-slide-right-exit {
|
|
240
|
+
.nut-popup-slide-right-exit-active {
|
|
235
241
|
animation-fill-mode: both;
|
|
236
242
|
animation-name: popup-slide-right-exit;
|
|
237
243
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
@@ -244,20 +250,23 @@
|
|
|
244
250
|
transform: translate3d(0, 0%, 0);
|
|
245
251
|
}
|
|
246
252
|
}
|
|
247
|
-
@keyframes slide-bottom-exit {
|
|
253
|
+
@keyframes popup-slide-bottom-exit {
|
|
254
|
+
from {
|
|
255
|
+
transform: translate3d(0, 0%, 0);
|
|
256
|
+
}
|
|
248
257
|
to {
|
|
249
258
|
transform: translate3d(0, 100%, 0);
|
|
250
259
|
}
|
|
251
260
|
}
|
|
252
261
|
.nut-popup-slide-bottom-enter-active, .nut-popup-slide-bottom-appear-active {
|
|
253
|
-
transform:
|
|
262
|
+
transform: translate3d(0, 0, 0);
|
|
254
263
|
animation-fill-mode: both;
|
|
255
264
|
animation-name: popup-slide-bottom-enter;
|
|
256
265
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
257
266
|
}
|
|
258
|
-
.nut-popup-slide-bottom-exit {
|
|
267
|
+
.nut-popup-slide-bottom-exit-active {
|
|
259
268
|
animation-fill-mode: both;
|
|
260
|
-
animation-name: slide-bottom-exit;
|
|
269
|
+
animation-name: popup-slide-bottom-exit;
|
|
261
270
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
262
271
|
}
|
|
263
272
|
@keyframes popup-slide-left-enter {
|
|
@@ -269,17 +278,20 @@
|
|
|
269
278
|
}
|
|
270
279
|
}
|
|
271
280
|
@keyframes popup-slide-left-exit {
|
|
281
|
+
from {
|
|
282
|
+
transform: translate3d(0%, 0, 0);
|
|
283
|
+
}
|
|
272
284
|
to {
|
|
273
285
|
transform: translate3d(-100%, 0, 0);
|
|
274
286
|
}
|
|
275
287
|
}
|
|
276
288
|
.nut-popup-slide-left-enter-active, .nut-popup-slide-left-appear-active {
|
|
277
|
-
transform:
|
|
289
|
+
transform: translate3d(0, 0, 0);
|
|
278
290
|
animation-fill-mode: both;
|
|
279
291
|
animation-name: popup-slide-left-enter;
|
|
280
292
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
281
293
|
}
|
|
282
|
-
.nut-popup-slide-left-exit-active
|
|
294
|
+
.nut-popup-slide-left-exit-active {
|
|
283
295
|
animation-fill-mode: both;
|
|
284
296
|
animation-name: popup-slide-left-exit;
|
|
285
297
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
@@ -251,6 +251,9 @@
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
@keyframes popup-slide-top-exit {
|
|
254
|
+
from {
|
|
255
|
+
transform: translate3d(0, 0%, 0);
|
|
256
|
+
}
|
|
254
257
|
to {
|
|
255
258
|
transform: translate3d(0, -100%, 0);
|
|
256
259
|
}
|
|
@@ -275,6 +278,9 @@
|
|
|
275
278
|
}
|
|
276
279
|
}
|
|
277
280
|
@keyframes popup-slide-right-exit {
|
|
281
|
+
from {
|
|
282
|
+
transform: translate3d(0%, 0, 0);
|
|
283
|
+
}
|
|
278
284
|
to {
|
|
279
285
|
transform: translate3d(100%, 0, 0);
|
|
280
286
|
}
|
|
@@ -285,7 +291,7 @@
|
|
|
285
291
|
animation-name: popup-slide-right-enter;
|
|
286
292
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
287
293
|
}
|
|
288
|
-
.nut-popup-slide-right-exit {
|
|
294
|
+
.nut-popup-slide-right-exit-active {
|
|
289
295
|
animation-fill-mode: both;
|
|
290
296
|
animation-name: popup-slide-right-exit;
|
|
291
297
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
@@ -298,20 +304,23 @@
|
|
|
298
304
|
transform: translate3d(0, 0%, 0);
|
|
299
305
|
}
|
|
300
306
|
}
|
|
301
|
-
@keyframes slide-bottom-exit {
|
|
307
|
+
@keyframes popup-slide-bottom-exit {
|
|
308
|
+
from {
|
|
309
|
+
transform: translate3d(0, 0%, 0);
|
|
310
|
+
}
|
|
302
311
|
to {
|
|
303
312
|
transform: translate3d(0, 100%, 0);
|
|
304
313
|
}
|
|
305
314
|
}
|
|
306
315
|
.nut-popup-slide-bottom-enter-active, .nut-popup-slide-bottom-appear-active {
|
|
307
|
-
transform:
|
|
316
|
+
transform: translate3d(0, 0, 0);
|
|
308
317
|
animation-fill-mode: both;
|
|
309
318
|
animation-name: popup-slide-bottom-enter;
|
|
310
319
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
311
320
|
}
|
|
312
|
-
.nut-popup-slide-bottom-exit {
|
|
321
|
+
.nut-popup-slide-bottom-exit-active {
|
|
313
322
|
animation-fill-mode: both;
|
|
314
|
-
animation-name: slide-bottom-exit;
|
|
323
|
+
animation-name: popup-slide-bottom-exit;
|
|
315
324
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
316
325
|
}
|
|
317
326
|
@keyframes popup-slide-left-enter {
|
|
@@ -323,17 +332,20 @@
|
|
|
323
332
|
}
|
|
324
333
|
}
|
|
325
334
|
@keyframes popup-slide-left-exit {
|
|
335
|
+
from {
|
|
336
|
+
transform: translate3d(0%, 0, 0);
|
|
337
|
+
}
|
|
326
338
|
to {
|
|
327
339
|
transform: translate3d(-100%, 0, 0);
|
|
328
340
|
}
|
|
329
341
|
}
|
|
330
342
|
.nut-popup-slide-left-enter-active, .nut-popup-slide-left-appear-active {
|
|
331
|
-
transform:
|
|
343
|
+
transform: translate3d(0, 0, 0);
|
|
332
344
|
animation-fill-mode: both;
|
|
333
345
|
animation-name: popup-slide-left-enter;
|
|
334
346
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|
|
335
347
|
}
|
|
336
|
-
.nut-popup-slide-left-exit-active
|
|
348
|
+
.nut-popup-slide-left-exit-active {
|
|
337
349
|
animation-fill-mode: both;
|
|
338
350
|
animation-name: popup-slide-left-exit;
|
|
339
351
|
animation-duration: var(--nutui-popup-animation-duration, 0.3s);
|