@nutui/nutui-react-taro 3.0.19-cpp.25 → 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 +45 -24
- package/dist/cjs/packages/address/style/style.harmony.css +45 -24
- package/dist/cjs/packages/calendar/style/style.harmony.css +45 -24
- package/dist/cjs/packages/cascader/style/style.harmony.css +45 -24
- package/dist/cjs/packages/configprovider/types.d.ts +1 -1
- package/dist/cjs/packages/datepicker/style/style.harmony.css +46 -25
- package/dist/cjs/packages/imagepreview/style/style.harmony.css +45 -24
- package/dist/cjs/packages/numberkeyboard/style/style.css +1 -1
- package/dist/cjs/packages/numberkeyboard/style/style.harmony.css +46 -25
- 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.css +1 -1
- package/dist/cjs/packages/picker/style/style.harmony.css +46 -25
- package/dist/cjs/packages/popover/style/style.harmony.css +45 -24
- package/dist/cjs/packages/popup/popup.js +171 -99
- package/dist/cjs/packages/popup/style/popup.scss +29 -9
- package/dist/cjs/packages/popup/style/style.css +45 -24
- package/dist/cjs/packages/popup/style/style.harmony.css +45 -24
- package/dist/cjs/packages/popup/style-jmapp/popup.scss +29 -9
- package/dist/cjs/packages/popup/style-jmapp/style.css +29 -8
- package/dist/cjs/packages/popup/style-jrkf/popup.scss +29 -9
- package/dist/cjs/packages/popup/style-jrkf/style.css +29 -8
- 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 +45 -24
- package/dist/cjs/packages/timeselect/style/style.harmony.css +45 -24
- package/dist/cjs/packages/tour/style/style.harmony.css +45 -24
- 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 +45 -24
- package/dist/es/packages/address/style/style.harmony.css +45 -24
- package/dist/es/packages/calendar/style/style.harmony.css +45 -24
- package/dist/es/packages/cascader/style/style.harmony.css +45 -24
- package/dist/es/packages/configprovider/types.d.ts +1 -1
- package/dist/es/packages/datepicker/style/style.harmony.css +46 -25
- package/dist/es/packages/imagepreview/style/style.harmony.css +45 -24
- package/dist/es/packages/numberkeyboard/style/style.css +1 -1
- package/dist/es/packages/numberkeyboard/style/style.harmony.css +46 -25
- 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.css +1 -1
- package/dist/es/packages/picker/style/style.harmony.css +46 -25
- package/dist/es/packages/popover/style/style.harmony.css +45 -24
- package/dist/es/packages/popup/popup.js +172 -101
- package/dist/es/packages/popup/style/popup.scss +29 -9
- package/dist/es/packages/popup/style/style.css +45 -24
- package/dist/es/packages/popup/style/style.harmony.css +45 -24
- package/dist/es/packages/popup/style-jmapp/popup.scss +29 -9
- package/dist/es/packages/popup/style-jmapp/style.css +29 -8
- package/dist/es/packages/popup/style-jrkf/popup.scss +29 -9
- package/dist/es/packages/popup/style-jrkf/style.css +29 -8
- 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 +45 -24
- package/dist/es/packages/timeselect/style/style.harmony.css +45 -24
- package/dist/es/packages/tour/style/style.harmony.css +45 -24
- 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 +631 -332
- package/dist/style-jmapp.css +1 -1
- package/dist/style-jmapp.scss +35 -34
- package/dist/style-jrkf.css +1 -1
- package/dist/style-jrkf.scss +34 -33
- package/dist/style.css +1 -1
- package/dist/style.scss +35 -34
- 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 +37 -1
- 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
|
};
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
color: $color-title;
|
|
27
27
|
font-weight: $font-weight-bold;
|
|
28
28
|
font-size: $popup-title-font-size;
|
|
29
|
-
line-height: $popup-title-font-size;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
&-description {
|
|
@@ -79,6 +78,8 @@
|
|
|
79
78
|
&-center {
|
|
80
79
|
top: 50%;
|
|
81
80
|
left: 50%;
|
|
81
|
+
right: auto;
|
|
82
|
+
bottom: auto;
|
|
82
83
|
min-height: 10%;
|
|
83
84
|
max-width: 295px;
|
|
84
85
|
transform: translate(-50%, -50%);
|
|
@@ -91,6 +92,8 @@
|
|
|
91
92
|
&-bottom {
|
|
92
93
|
bottom: 0;
|
|
93
94
|
left: 0;
|
|
95
|
+
right: auto;
|
|
96
|
+
top: auto;
|
|
94
97
|
width: 100%;
|
|
95
98
|
|
|
96
99
|
&.nut-popup-round {
|
|
@@ -105,6 +108,8 @@
|
|
|
105
108
|
&-right {
|
|
106
109
|
top: 0;
|
|
107
110
|
right: 0;
|
|
111
|
+
left: auto;
|
|
112
|
+
bottom: auto;
|
|
108
113
|
width: 100px;
|
|
109
114
|
height: 100%;
|
|
110
115
|
|
|
@@ -116,6 +121,8 @@
|
|
|
116
121
|
&-left {
|
|
117
122
|
top: 0;
|
|
118
123
|
left: 0;
|
|
124
|
+
right: auto;
|
|
125
|
+
bottom: auto;
|
|
119
126
|
width: 100px;
|
|
120
127
|
height: 100%;
|
|
121
128
|
|
|
@@ -127,6 +134,8 @@
|
|
|
127
134
|
&-top {
|
|
128
135
|
top: 0;
|
|
129
136
|
left: 0;
|
|
137
|
+
right: auto;
|
|
138
|
+
bottom: auto;
|
|
130
139
|
width: 100%;
|
|
131
140
|
|
|
132
141
|
&.nut-popup-round {
|
|
@@ -210,6 +219,9 @@
|
|
|
210
219
|
}
|
|
211
220
|
|
|
212
221
|
@keyframes popup-slide-top-exit {
|
|
222
|
+
from {
|
|
223
|
+
transform: translate3d(0, 0%, 0);
|
|
224
|
+
}
|
|
213
225
|
to {
|
|
214
226
|
transform: translate3d(0, -100%, 0);
|
|
215
227
|
}
|
|
@@ -240,6 +252,9 @@
|
|
|
240
252
|
}
|
|
241
253
|
|
|
242
254
|
@keyframes popup-slide-right-exit {
|
|
255
|
+
from {
|
|
256
|
+
transform: translate3d(0%, 0, 0);
|
|
257
|
+
}
|
|
243
258
|
to {
|
|
244
259
|
transform: translate3d(100%, 0, 0);
|
|
245
260
|
}
|
|
@@ -253,7 +268,7 @@
|
|
|
253
268
|
animation-duration: $popup-animation-duration;
|
|
254
269
|
}
|
|
255
270
|
|
|
256
|
-
&-right-exit {
|
|
271
|
+
&-right-exit-active {
|
|
257
272
|
animation-fill-mode: both;
|
|
258
273
|
animation-name: popup-slide-right-exit;
|
|
259
274
|
animation-duration: $popup-animation-duration;
|
|
@@ -269,7 +284,10 @@
|
|
|
269
284
|
}
|
|
270
285
|
}
|
|
271
286
|
|
|
272
|
-
@keyframes slide-bottom-exit {
|
|
287
|
+
@keyframes popup-slide-bottom-exit {
|
|
288
|
+
from {
|
|
289
|
+
transform: translate3d(0, 0%, 0);
|
|
290
|
+
}
|
|
273
291
|
to {
|
|
274
292
|
transform: translate3d(0, 100%, 0);
|
|
275
293
|
}
|
|
@@ -277,15 +295,15 @@
|
|
|
277
295
|
|
|
278
296
|
&-bottom-enter-active,
|
|
279
297
|
&-bottom-appear-active {
|
|
280
|
-
transform:
|
|
298
|
+
transform: translate3d(0, 0, 0);
|
|
281
299
|
animation-fill-mode: both;
|
|
282
300
|
animation-name: popup-slide-bottom-enter;
|
|
283
301
|
animation-duration: $popup-animation-duration;
|
|
284
302
|
}
|
|
285
303
|
|
|
286
|
-
&-bottom-exit {
|
|
304
|
+
&-bottom-exit-active {
|
|
287
305
|
animation-fill-mode: both;
|
|
288
|
-
animation-name: slide-bottom-exit;
|
|
306
|
+
animation-name: popup-slide-bottom-exit;
|
|
289
307
|
animation-duration: $popup-animation-duration;
|
|
290
308
|
}
|
|
291
309
|
|
|
@@ -300,6 +318,9 @@
|
|
|
300
318
|
}
|
|
301
319
|
|
|
302
320
|
@keyframes popup-slide-left-exit {
|
|
321
|
+
from {
|
|
322
|
+
transform: translate3d(0%, 0, 0);
|
|
323
|
+
}
|
|
303
324
|
to {
|
|
304
325
|
transform: translate3d(-100%, 0, 0);
|
|
305
326
|
}
|
|
@@ -307,14 +328,13 @@
|
|
|
307
328
|
|
|
308
329
|
&-left-enter-active,
|
|
309
330
|
&-left-appear-active {
|
|
310
|
-
transform:
|
|
331
|
+
transform: translate3d(0, 0, 0);
|
|
311
332
|
animation-fill-mode: both;
|
|
312
333
|
animation-name: popup-slide-left-enter;
|
|
313
334
|
animation-duration: $popup-animation-duration;
|
|
314
335
|
}
|
|
315
336
|
|
|
316
|
-
&-left-exit-active
|
|
317
|
-
&-left-exit-done {
|
|
337
|
+
&-left-exit-active {
|
|
318
338
|
animation-fill-mode: both;
|
|
319
339
|
animation-name: popup-slide-left-exit;
|
|
320
340
|
animation-duration: $popup-animation-duration;
|