@nutui/nutui-react-taro 3.0.18 → 3.0.19-cpp-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +9 -10
  2. package/dist/cjs/packages/actionsheet/style/style.harmony.css +0 -3
  3. package/dist/cjs/packages/address/style/style.harmony.css +0 -3
  4. package/dist/cjs/packages/calendar/style/style.harmony.css +0 -3
  5. package/dist/cjs/packages/cascader/style/style.harmony.css +0 -3
  6. package/dist/cjs/packages/datepicker/style/style.harmony.css +0 -3
  7. package/dist/cjs/packages/dialog/dialog.js +12 -10
  8. package/dist/cjs/packages/imagepreview/style/style.harmony.css +0 -3
  9. package/dist/cjs/packages/input/input.js +14 -5
  10. package/dist/cjs/packages/numberkeyboard/style/style.harmony.css +0 -3
  11. package/dist/cjs/packages/overlay/overlay.js +17 -11
  12. package/dist/cjs/packages/picker/style/style.harmony.css +0 -3
  13. package/dist/cjs/packages/popover/style/style.harmony.css +0 -3
  14. package/dist/cjs/packages/popup/popup.d.ts +1 -1
  15. package/dist/cjs/packages/popup/popup.js +122 -23
  16. package/dist/cjs/packages/popup/style/popup.scss +0 -5
  17. package/dist/cjs/packages/popup/style/style.css +0 -3
  18. package/dist/cjs/packages/popup/style/style.harmony.css +0 -3
  19. package/dist/cjs/packages/popup/style-jmapp/popup.scss +0 -5
  20. package/dist/cjs/packages/popup/style-jmapp/style.css +0 -3
  21. package/dist/cjs/packages/popup/style-jrkf/popup.scss +0 -5
  22. package/dist/cjs/packages/popup/style-jrkf/style.css +0 -3
  23. package/dist/cjs/packages/shortpassword/style/style.harmony.css +0 -3
  24. package/dist/cjs/packages/swiper/swiper.js +1 -2
  25. package/dist/cjs/packages/timeselect/style/style.harmony.css +0 -3
  26. package/dist/cjs/packages/tour/style/style.harmony.css +0 -3
  27. package/dist/cjs/types/spec/popup/base.d.ts +6 -0
  28. package/dist/es/packages/actionsheet/style/style.harmony.css +0 -3
  29. package/dist/es/packages/address/style/style.harmony.css +0 -3
  30. package/dist/es/packages/calendar/style/style.harmony.css +0 -3
  31. package/dist/es/packages/cascader/style/style.harmony.css +0 -3
  32. package/dist/es/packages/datepicker/style/style.harmony.css +0 -3
  33. package/dist/es/packages/dialog/dialog.js +23 -19
  34. package/dist/es/packages/imagepreview/style/style.harmony.css +0 -3
  35. package/dist/es/packages/input/input.js +14 -5
  36. package/dist/es/packages/numberkeyboard/style/style.harmony.css +0 -3
  37. package/dist/es/packages/overlay/overlay.js +17 -11
  38. package/dist/es/packages/picker/style/style.harmony.css +0 -3
  39. package/dist/es/packages/popover/style/style.harmony.css +0 -3
  40. package/dist/es/packages/popup/popup.d.ts +1 -1
  41. package/dist/es/packages/popup/popup.js +124 -24
  42. package/dist/es/packages/popup/style/popup.scss +0 -5
  43. package/dist/es/packages/popup/style/style.css +0 -3
  44. package/dist/es/packages/popup/style/style.harmony.css +0 -3
  45. package/dist/es/packages/popup/style-jmapp/popup.scss +0 -5
  46. package/dist/es/packages/popup/style-jmapp/style.css +0 -3
  47. package/dist/es/packages/popup/style-jrkf/popup.scss +0 -5
  48. package/dist/es/packages/popup/style-jrkf/style.css +0 -3
  49. package/dist/es/packages/shortpassword/style/style.harmony.css +0 -3
  50. package/dist/es/packages/swiper/swiper.js +1 -2
  51. package/dist/es/packages/timeselect/style/style.harmony.css +0 -3
  52. package/dist/es/packages/tour/style/style.harmony.css +0 -3
  53. package/dist/es/types/spec/popup/base.d.ts +24 -0
  54. package/dist/nutui.react.umd.js +9794 -9703
  55. package/dist/style-jmapp.css +1 -1
  56. package/dist/style-jmapp.scss +24 -24
  57. package/dist/style-jrkf.css +1 -1
  58. package/dist/style-jrkf.scss +30 -30
  59. package/dist/style.css +1 -1
  60. package/dist/style.scss +34 -34
  61. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,16 +1,15 @@
1
1
  # v3.0.18
2
- `2025-08-15`
3
-
4
2
 
5
- * 🏡 chore: 升级icon库 (#3330)
6
- * 🏡 chore: 发布taro下的样式按需插件
7
- * 📖 docs: 更新介绍部分内容 (#3324)
8
- * :sparkles: feat: Ellipsis校验越界不走缓存配置 (#3329)
9
- * :sparkles: feat(price): 支持自定义颜色&数据原样输出 (#3328)
10
- * :sparkles: feat(notify): 支持promise调用notice (#3319)
11
- * :bug: fix(noticebar): 适配鸿蒙样式修复 (#3332)
12
- * :bug: Fix icons svg (#3331)
3
+ `2025-08-15`
13
4
 
5
+ - 🏡 chore: 升级icon库 (#3330)
6
+ - 🏡 chore: 发布taro下的样式按需插件
7
+ - 📖 docs: 更新介绍部分内容 (#3324)
8
+ - :sparkles: feat: Ellipsis校验越界不走缓存配置 (#3329)
9
+ - :sparkles: feat(price): 支持自定义颜色&数据原样输出 (#3328)
10
+ - :sparkles: feat(notify): 支持promise调用notice (#3319)
11
+ - :bug: fix(noticebar): 适配鸿蒙样式修复 (#3332)
12
+ - :bug: Fix icons svg (#3331)
14
13
 
15
14
  # v3.0.17
16
15
 
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -277,9 +277,6 @@
277
277
  .nut-popup-center.nut-popup-round {
278
278
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
279
279
  }
280
- .nut-popup-bottom, .nut-popup-top {
281
- max-height: 87%;
282
- }
283
280
  .nut-popup-bottom {
284
281
  bottom: 0;
285
282
  left: 0;
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -29,7 +29,6 @@ var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
29
29
  var _ts_generator = require("@swc/helpers/_/_ts_generator");
30
30
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
31
31
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
32
- var _reacttransitiongroup = require("react-transition-group");
33
32
  var _components = require("@tarojs/components");
34
33
  var _iconsreacttaro = require("@nutui/icons-react-taro");
35
34
  var _index = /*#__PURE__*/ _interop_require_default._(require("../button/index"));
@@ -194,17 +193,20 @@ var BaseDialog = function BaseDialog(props) {
194
193
  var renderContent = function renderContent() {
195
194
  var contentZIndex = (0, _platform.harmony)() ? zIndex + 1 : zIndex // 解决harmony层级问题
196
195
  ;
197
- return /*#__PURE__*/ _react.default.createElement(_reacttransitiongroup.CSSTransition, {
198
- in: visible,
199
- timeout: 300,
200
- classNames: "fadeDialog",
201
- unmountOnExit: true,
202
- appear: true
203
- }, /*#__PURE__*/ _react.default.createElement(_content.Content, {
196
+ return(// <CSSTransition
197
+ // in={visible}
198
+ // timeout={300}
199
+ // classNames="fadeDialog"
200
+ // unmountOnExit
201
+ // appear
202
+ // >
203
+ /*#__PURE__*/ /*#__PURE__*/ _react.default.createElement(_content.Content, {
204
204
  className: className,
205
- style: (0, _object_spread._)({
205
+ style: (0, _object_spread_props._)((0, _object_spread._)({
206
206
  zIndex: contentZIndex
207
- }, style),
207
+ }, style), {
208
+ display: visible ? 'block' : 'none'
209
+ }),
208
210
  title: title,
209
211
  header: header,
210
212
  close: renderCloseIcon(),
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -75,18 +75,27 @@ var Input = /*#__PURE__*/ (0, _react.forwardRef)(function(props, ref) {
75
75
  }), 2), value = _usePropsValue[0], setValue = _usePropsValue[1];
76
76
  var inputRef = (0, _react.useRef)(null);
77
77
  var _useState = (0, _sliced_to_array._)((0, _react.useState)(false), 2), active = _useState[0], setActive = _useState[1];
78
+ // 兼容H5和小程序获取原生input标签
79
+ var getNativeInput = function getNativeInput() {
80
+ if (_taro.default.getEnv() === 'WEB') {
81
+ var taroInputCoreEl = inputRef.current;
82
+ var inputEl = taroInputCoreEl.querySelector('input');
83
+ return inputEl;
84
+ }
85
+ return inputRef.current;
86
+ };
78
87
  (0, _react.useImperativeHandle)(ref, function() {
79
88
  return {
80
89
  clear: function clear() {
81
90
  setValue('');
82
91
  },
83
92
  focus: function focus() {
84
- var _inputRef_current;
85
- (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
93
+ var nativeInput = getNativeInput();
94
+ nativeInput === null || nativeInput === void 0 ? void 0 : nativeInput.focus();
86
95
  },
87
96
  blur: function blur() {
88
- var _inputRef_current;
89
- (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.blur();
97
+ var nativeInput = getNativeInput();
98
+ nativeInput === null || nativeInput === void 0 ? void 0 : nativeInput.blur();
90
99
  },
91
100
  get nativeElement () {
92
101
  return inputRef.current;
@@ -174,7 +183,7 @@ var Input = /*#__PURE__*/ (0, _react.forwardRef)(function(props, ref) {
174
183
  maxlength: maxLength,
175
184
  placeholder: placeholder === undefined ? locale.placeholder : placeholder,
176
185
  placeholderClass: "".concat(classPrefix, "-placeholder"),
177
- disabled: disabled || readOnly,
186
+ disabled: disabled,
178
187
  value: value,
179
188
  focus: autoFocus || focus,
180
189
  confirmType: confirmType,
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -23,7 +23,6 @@ var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
23
23
  var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
24
24
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
25
25
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
26
- var _reacttransitiongroup = require("react-transition-group");
27
26
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
28
27
  var _components = require("@tarojs/components");
29
28
  var _typings = require("../../utils/typings");
@@ -73,20 +72,27 @@ var Overlay = function Overlay(props) {
73
72
  return /*#__PURE__*/ _react.default.createElement(_components.View, (0, _object_spread_props._)((0, _object_spread._)({
74
73
  ref: nodeRef,
75
74
  className: classes,
76
- style: styles
75
+ style: (0, _object_spread_props._)((0, _object_spread._)({}, styles), {
76
+ display: innerVisible ? 'block' : 'none'
77
+ })
77
78
  }, rest), {
78
79
  catchMove: lockScroll,
79
80
  onClick: handleClick
80
81
  }), children);
81
82
  };
82
- return /*#__PURE__*/ _react.default.createElement(_reacttransitiongroup.CSSTransition, {
83
- nodeRef: nodeRef,
84
- classNames: "".concat(classPrefix, "-slide"),
85
- unmountOnExit: true,
86
- timeout: duration,
87
- in: innerVisible,
88
- onEntered: afterShow,
89
- onExited: afterClose
90
- }, renderOverlay());
83
+ return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, renderOverlay());
84
+ // return (
85
+ // <CSSTransition
86
+ // nodeRef={nodeRef}
87
+ // classNames={`${classPrefix}-slide`}
88
+ // unmountOnExit
89
+ // timeout={duration}
90
+ // in={innerVisible}
91
+ // onEntered={afterShow}
92
+ // onExited={afterClose}
93
+ // >
94
+ // {renderOverlay()}
95
+ // </CSSTransition>
96
+ // )
91
97
  };
92
98
  Overlay.displayName = 'NutOverlay';
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -1,3 +1,3 @@
1
1
  import React, { FunctionComponent } from 'react';
2
2
  import { TaroPopupProps } from "../../types";
3
- export declare const Popup: FunctionComponent<Partial<TaroPopupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'title'>>;
3
+ export declare const Popup: FunctionComponent<Partial<TaroPopupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'title' | 'onTouchStart' | 'onTouchMove' | 'onTouchEnd'>>;
@@ -10,20 +10,23 @@ Object.defineProperty(exports, "Popup", {
10
10
  });
11
11
  var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
12
  var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ var _async_to_generator = require("@swc/helpers/_/_async_to_generator");
13
14
  var _define_property = require("@swc/helpers/_/_define_property");
14
15
  var _object_spread = require("@swc/helpers/_/_object_spread");
15
16
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
16
17
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
18
+ var _ts_generator = require("@swc/helpers/_/_ts_generator");
17
19
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
18
20
  var _reactdom = require("react-dom");
19
- var _reacttransitiongroup = require("react-transition-group");
20
21
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
21
22
  var _iconsreacttaro = require("@nutui/icons-react-taro");
22
23
  var _components = require("@tarojs/components");
24
+ var _getrect = require("../../utils/taro/get-rect");
23
25
  var _overlay = require("../overlay/overlay");
24
26
  var _index = /*#__PURE__*/ _interop_require_default._(require("../overlay/index"));
25
27
  var _uselockscoll = require("../../hooks/taro/use-lock-scoll");
26
28
  var _platform = require("../../utils/taro/platform");
29
+ var _pxtransform = require("../../utils/taro/px-transform");
27
30
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _overlay.defaultOverlayProps), {
28
31
  position: 'center',
29
32
  transition: '',
@@ -36,6 +39,8 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _overla
36
39
  portal: null,
37
40
  overlay: true,
38
41
  round: false,
42
+ resizable: false,
43
+ minHeight: '',
39
44
  onOpen: function onOpen() {},
40
45
  onClose: function onClose() {},
41
46
  onOverlayClick: function onOverlayClick() {
@@ -43,29 +48,51 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _overla
43
48
  },
44
49
  onCloseIconClick: function onCloseIconClick() {
45
50
  return true;
46
- }
51
+ },
52
+ onTouchStart: function onTouchStart() {},
53
+ onTouchMove: function onTouchMove() {},
54
+ onTouchEnd: function onTouchEnd() {}
47
55
  });
48
56
  // 默认1000,参看variables
49
57
  var _zIndex = 1100;
50
58
  var Popup = function Popup(props) {
51
- var _$_object_spread = (0, _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, 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, 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;
59
+ var _$_object_spread = (0, _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;
52
60
  var innerIndex = zIndex || _zIndex;
53
61
  var _useState = (0, _sliced_to_array._)((0, _react.useState)(innerIndex), 2), index = _useState[0], setIndex = _useState[1];
54
62
  var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
55
63
  var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
56
64
  var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
57
- var refObject = (0, _uselockscoll.useLockScrollTaro)(innerVisible && lockScroll);
65
+ var nodeRef = (0, _uselockscoll.useLockScrollTaro)(innerVisible && lockScroll);
66
+ var rootRect = (0, _react.useRef)(null);
67
+ var touchStartRef = (0, _react.useRef)(0);
68
+ var touchMoveDistanceRef = (0, _react.useRef)(0);
69
+ var heightRef = (0, _react.useRef)(0);
70
+ var defaultHeightRef = (0, _react.useRef)(0);
71
+ var isTouching = (0, _react.useRef)(false);
58
72
  var classPrefix = 'nut-popup';
59
73
  var overlayStyles = (0, _object_spread._)({}, overlayStyle);
60
74
  var contentZIndex = (0, _platform.harmony)() ? index + 1 : index // 解决harmony层级问题
61
75
  ;
62
76
  var popStyles = (0, _object_spread._)({
63
- zIndex: contentZIndex
77
+ zIndex: contentZIndex,
78
+ minHeight: minHeight
64
79
  }, style);
65
80
  var _obj;
66
81
  var popClassName = (0, _classnames.default)(classPrefix, (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-round"), round || position === 'bottom'), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(position), true), _obj), className);
82
+ var _useState4 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), popupHeight = _useState4[0], setPopupHeight = _useState4[1];
83
+ var resizeStyles = function resizeStyles() {
84
+ if (popupHeight !== '') {
85
+ return {
86
+ height: popupHeight
87
+ };
88
+ }
89
+ };
67
90
  var open = function open() {
68
91
  if (!innerVisible) {
92
+ // 当高度改变后,再次打开时,将高度置为初始高度
93
+ if (position === 'bottom' && resizable && nodeRef.current && heightRef.current) {
94
+ setPopupHeight((0, _pxtransform.pxTransform)(defaultHeightRef.current));
95
+ }
69
96
  setInnerVisible(true);
70
97
  setIndex(++innerIndex);
71
98
  }
@@ -119,27 +146,99 @@ var Popup = function Popup(props) {
119
146
  return renderCloseIcon();
120
147
  }
121
148
  };
122
- var renderContent = function renderContent() {
123
- return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_components.View, {
124
- ref: refObject,
125
- style: popStyles,
126
- className: popClassName,
127
- onClick: onClick,
128
- catchMove: lockScroll
129
- }, renderTitle(), showChildren ? children : null));
149
+ var handleTouchStart = /*#__PURE__*/ function() {
150
+ var _ref = (0, _async_to_generator._)(function(event) {
151
+ var _nodeRef_current, _rootRect_current, e, rect;
152
+ return (0, _ts_generator._)(this, function(_state) {
153
+ switch(_state.label){
154
+ case 0:
155
+ if (position !== 'bottom' || !resizable || !nodeRef.current) return [
156
+ 2
157
+ ];
158
+ e = event;
159
+ // 开始touch,记录下touch的pageY,用以判断是向上滑动还是向下滑动
160
+ touchStartRef.current = e.touches[0].pageY;
161
+ // 标记开始滑动
162
+ isTouching.current = true;
163
+ return [
164
+ 4,
165
+ (0, _getrect.getRectInMultiPlatformWithoutCache)(nodeRef.current)
166
+ ];
167
+ case 1:
168
+ rect = _state.sent();
169
+ rootRect.current = rect;
170
+ heightRef.current = ((_nodeRef_current = nodeRef.current) === null || _nodeRef_current === void 0 ? void 0 : _nodeRef_current.offsetHeight) || ((_rootRect_current = rootRect.current) === null || _rootRect_current === void 0 ? void 0 : _rootRect_current.height) || 0;
171
+ if (!defaultHeightRef.current) defaultHeightRef.current = heightRef.current;
172
+ onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(heightRef.current, e);
173
+ return [
174
+ 2
175
+ ];
176
+ }
177
+ });
178
+ });
179
+ return function handleTouchStart(event) {
180
+ return _ref.apply(this, arguments);
181
+ };
182
+ }();
183
+ var handleTouchMove = function handleTouchMove(event) {
184
+ if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
185
+ var e = event;
186
+ e.stopPropagation();
187
+ // 计算位移:move过程中,当前的pageY 与 start值比较
188
+ touchMoveDistanceRef.current = e.touches[0].pageY - touchStartRef.current;
189
+ var handleMove = function handleMove() {
190
+ var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
191
+ var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
192
+ setPopupHeight((0, _pxtransform.pxTransform)(currentHeight));
193
+ if (touchMoveDistanceRef.current > 0 && isTouching.current) {
194
+ // 向下滑动
195
+ onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(currentHeight, e, 'down');
196
+ } else {
197
+ // 向上滑动
198
+ onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(currentHeight, e, 'up');
199
+ }
200
+ };
201
+ requestAnimationFrame(handleMove);
202
+ };
203
+ var handleTouchEnd = function handleTouchEnd(event) {
204
+ if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
205
+ var e = event;
206
+ isTouching.current = false;
207
+ var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
208
+ var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
209
+ onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(currentHeight, e);
130
210
  };
131
211
  var renderPop = function renderPop() {
132
- return /*#__PURE__*/ _react.default.createElement(_reacttransitiongroup.CSSTransition, {
133
- nodeRef: refObject,
134
- classNames: transitionName,
135
- mountOnEnter: true,
136
- unmountOnExit: destroyOnClose,
137
- timeout: duration,
138
- in: innerVisible,
139
- onEntered: afterShow,
140
- onExited: afterClose
141
- }, renderContent());
212
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
213
+ ref: nodeRef,
214
+ style: (0, _object_spread._)((0, _object_spread_props._)((0, _object_spread._)({}, popStyles), {
215
+ display: innerVisible ? 'block' : 'none'
216
+ }), resizeStyles()),
217
+ className: popClassName,
218
+ onClick: onClick,
219
+ catchMove: lockScroll,
220
+ onTouchStart: handleTouchStart,
221
+ onTouchMove: handleTouchMove,
222
+ onTouchEnd: handleTouchEnd,
223
+ onTouchCancel: handleTouchEnd
224
+ }, top, renderTitle(), showChildren ? children : null);
142
225
  };
226
+ // const renderPop = () => {
227
+ // return (
228
+ // <CSSTransition
229
+ // nodeRef={nodeRef}
230
+ // classNames={transitionName}
231
+ // mountOnEnter
232
+ // unmountOnExit={destroyOnClose}
233
+ // timeout={duration}
234
+ // in={innerVisible}
235
+ // onEntered={afterShow}
236
+ // onExited={afterClose}
237
+ // >
238
+ // {renderContent()}
239
+ // </CSSTransition>
240
+ // )
241
+ // }
143
242
  var renderNode = function renderNode() {
144
243
  return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, overlay ? /*#__PURE__*/ _react.default.createElement(_index.default, {
145
244
  zIndex: index,
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, 12px);
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, 12px);
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -31,7 +31,7 @@ var defaultProps = {
31
31
  };
32
32
  var classPrefix = 'nut-swiper';
33
33
  var Swiper = /*#__PURE__*/ _react.default.forwardRef(function(props, ref) {
34
- var _ref = (0, _object_spread._)({}, defaultProps, props), width = _ref.width, height = _ref.height, className = _ref.className, children = _ref.children, indicator = _ref.indicator, indicatorDots = _ref.indicatorDots, loop = _ref.loop, circular = _ref.circular, autoPlay = _ref.autoPlay, autoplay = _ref.autoplay, duration = _ref.duration, vertical = _ref.vertical, direction = _ref.direction, defaultValue = _ref.defaultValue, current = _ref.current, onChange = _ref.onChange, style = _ref.style, rest = (0, _object_without_properties._)(_ref, [
34
+ var _ref = (0, _object_spread._)({}, defaultProps, props), width = _ref.width, height = _ref.height, className = _ref.className, children = _ref.children, indicator = _ref.indicator, indicatorDots = _ref.indicatorDots, loop = _ref.loop, circular = _ref.circular, autoPlay = _ref.autoPlay, autoplay = _ref.autoplay, vertical = _ref.vertical, direction = _ref.direction, defaultValue = _ref.defaultValue, current = _ref.current, onChange = _ref.onChange, style = _ref.style, rest = (0, _object_without_properties._)(_ref, [
35
35
  "width",
36
36
  "height",
37
37
  "className",
@@ -42,7 +42,6 @@ var Swiper = /*#__PURE__*/ _react.default.forwardRef(function(props, ref) {
42
42
  "circular",
43
43
  "autoPlay",
44
44
  "autoplay",
45
- "duration",
46
45
  "vertical",
47
46
  "direction",
48
47
  "defaultValue",
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -12,12 +12,18 @@ export interface BasePopup extends BaseProps, BaseOverlay {
12
12
  closeIcon: ReactNode;
13
13
  left?: ReactNode;
14
14
  title?: ReactNode;
15
+ top?: ReactNode;
15
16
  description?: ReactNode;
16
17
  destroyOnClose: boolean;
17
18
  overlay: boolean;
18
19
  round: boolean;
20
+ resizable: boolean;
21
+ minHeight: string;
19
22
  onOpen: () => void;
20
23
  onClose: () => void;
21
24
  onOverlayClick: (e: any) => boolean | void;
22
25
  onCloseIconClick: (e: any) => boolean | void;
26
+ onTouchMove: (height: number, e: any, direction: 'up' | 'down') => void;
27
+ onTouchStart: (height: number, e: any) => void;
28
+ onTouchEnd: (height: number, e: any) => void;
23
29
  }
@@ -134,9 +134,6 @@
134
134
  .nut-popup-center.nut-popup-round {
135
135
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
136
136
  }
137
- .nut-popup-bottom, .nut-popup-top {
138
- max-height: 87%;
139
- }
140
137
  .nut-popup-bottom {
141
138
  bottom: 0;
142
139
  left: 0;
@@ -277,9 +277,6 @@
277
277
  .nut-popup-center.nut-popup-round {
278
278
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
279
279
  }
280
- .nut-popup-bottom, .nut-popup-top {
281
- max-height: 87%;
282
- }
283
280
  .nut-popup-bottom {
284
281
  bottom: 0;
285
282
  left: 0;