@nutui/nutui-react-taro 3.0.18-cpp.beta.1 → 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 (83) hide show
  1. package/CHANGELOG.md +13 -0
  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/ellipsis/ellipsis.js +1 -1
  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/noticebar/style/noticebar.scss +6 -0
  11. package/dist/cjs/packages/noticebar/style/style.css +6 -0
  12. package/dist/cjs/packages/noticebar/style/style.harmony.css +6 -0
  13. package/dist/cjs/packages/noticebar/style-jmapp/noticebar.scss +6 -0
  14. package/dist/cjs/packages/noticebar/style-jmapp/style.css +6 -0
  15. package/dist/cjs/packages/noticebar/style-jrkf/noticebar.scss +6 -0
  16. package/dist/cjs/packages/noticebar/style-jrkf/style.css +6 -0
  17. package/dist/cjs/packages/numberkeyboard/style/style.harmony.css +0 -3
  18. package/dist/cjs/packages/picker/style/style.harmony.css +0 -3
  19. package/dist/cjs/packages/popover/style/style.harmony.css +0 -3
  20. package/dist/cjs/packages/popup/popup.d.ts +1 -1
  21. package/dist/cjs/packages/popup/popup.js +108 -21
  22. package/dist/cjs/packages/popup/style/popup.scss +0 -5
  23. package/dist/cjs/packages/popup/style/style.css +0 -3
  24. package/dist/cjs/packages/popup/style/style.harmony.css +0 -3
  25. package/dist/cjs/packages/popup/style-jmapp/popup.scss +0 -5
  26. package/dist/cjs/packages/popup/style-jmapp/style.css +0 -3
  27. package/dist/cjs/packages/popup/style-jrkf/popup.scss +0 -5
  28. package/dist/cjs/packages/popup/style-jrkf/style.css +0 -3
  29. package/dist/cjs/packages/price/price.js +43 -15
  30. package/dist/cjs/packages/shortpassword/style/style.harmony.css +0 -3
  31. package/dist/cjs/packages/swiper/swiper.js +1 -2
  32. package/dist/cjs/packages/timeselect/style/style.harmony.css +0 -3
  33. package/dist/cjs/packages/tour/style/style.harmony.css +0 -3
  34. package/dist/cjs/types/spec/popup/base.d.ts +6 -0
  35. package/dist/cjs/types/spec/price/base.d.ts +8 -2
  36. package/dist/cjs/types/spec/price/base.js +12 -0
  37. package/dist/cjs/utils/taro/get-rect.d.ts +1 -0
  38. package/dist/cjs/utils/taro/get-rect.js +36 -0
  39. package/dist/es/packages/actionsheet/style/style.harmony.css +0 -3
  40. package/dist/es/packages/address/style/style.harmony.css +0 -3
  41. package/dist/es/packages/calendar/style/style.harmony.css +0 -3
  42. package/dist/es/packages/cascader/style/style.harmony.css +0 -3
  43. package/dist/es/packages/datepicker/style/style.harmony.css +0 -3
  44. package/dist/es/packages/ellipsis/ellipsis.js +2 -2
  45. package/dist/es/packages/imagepreview/style/style.harmony.css +0 -3
  46. package/dist/es/packages/input/input.js +14 -5
  47. package/dist/es/packages/noticebar/style/noticebar.scss +6 -0
  48. package/dist/es/packages/noticebar/style/style.css +6 -0
  49. package/dist/es/packages/noticebar/style/style.harmony.css +6 -0
  50. package/dist/es/packages/noticebar/style-jmapp/noticebar.scss +6 -0
  51. package/dist/es/packages/noticebar/style-jmapp/style.css +6 -0
  52. package/dist/es/packages/noticebar/style-jrkf/noticebar.scss +6 -0
  53. package/dist/es/packages/noticebar/style-jrkf/style.css +6 -0
  54. package/dist/es/packages/numberkeyboard/style/style.harmony.css +0 -3
  55. package/dist/es/packages/picker/style/style.harmony.css +0 -3
  56. package/dist/es/packages/popover/style/style.harmony.css +0 -3
  57. package/dist/es/packages/popup/popup.d.ts +1 -1
  58. package/dist/es/packages/popup/popup.js +109 -22
  59. package/dist/es/packages/popup/style/popup.scss +0 -5
  60. package/dist/es/packages/popup/style/style.css +0 -3
  61. package/dist/es/packages/popup/style/style.harmony.css +0 -3
  62. package/dist/es/packages/popup/style-jmapp/popup.scss +0 -5
  63. package/dist/es/packages/popup/style-jmapp/style.css +0 -3
  64. package/dist/es/packages/popup/style-jrkf/popup.scss +0 -5
  65. package/dist/es/packages/popup/style-jrkf/style.css +0 -3
  66. package/dist/es/packages/price/price.js +42 -15
  67. package/dist/es/packages/shortpassword/style/style.harmony.css +0 -3
  68. package/dist/es/packages/swiper/swiper.js +1 -2
  69. package/dist/es/packages/timeselect/style/style.harmony.css +0 -3
  70. package/dist/es/packages/tour/style/style.harmony.css +0 -3
  71. package/dist/es/types/spec/popup/base.d.ts +24 -0
  72. package/dist/es/types/spec/price/base.d.ts +17 -5
  73. package/dist/es/types/spec/price/base.js +6 -1
  74. package/dist/es/utils/taro/get-rect.d.ts +1 -0
  75. package/dist/es/utils/taro/get-rect.js +34 -0
  76. package/dist/nutui.react.umd.js +229 -70
  77. package/dist/style-jmapp.css +1 -1
  78. package/dist/style-jmapp.scss +27 -27
  79. package/dist/style-jrkf.css +1 -1
  80. package/dist/style-jrkf.scss +35 -35
  81. package/dist/style.css +1 -1
  82. package/dist/style.scss +31 -31
  83. package/package.json +1 -1
@@ -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'>>;
@@ -1,17 +1,21 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
1
2
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
3
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
4
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
5
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
5
- import React, { useState, useEffect } from "react";
6
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
+ import React, { useState, useEffect, useRef } from "react";
6
8
  import { createPortal } from "react-dom";
7
9
  // import { CSSTransition } from 'react-transition-group'
8
10
  import classNames from "classnames";
9
11
  import { Close } from "@nutui/icons-react-taro";
10
12
  import { View } from "@tarojs/components";
13
+ import { getRectInMultiPlatformWithoutCache } from "../../utils/taro/get-rect";
11
14
  import { defaultOverlayProps } from "../overlay/overlay";
12
15
  import Overlay from "../overlay/index";
13
16
  import { useLockScrollTaro } from "../../hooks/taro/use-lock-scoll";
14
17
  import { harmony } from "../../utils/taro/platform";
18
+ import { pxTransform } from "../../utils/taro/px-transform";
15
19
  var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps), {
16
20
  position: 'center',
17
21
  transition: '',
@@ -24,6 +28,8 @@ var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps),
24
28
  portal: null,
25
29
  overlay: true,
26
30
  round: false,
31
+ resizable: false,
32
+ minHeight: '',
27
33
  onOpen: function() {},
28
34
  onClose: function() {},
29
35
  onOverlayClick: function() {
@@ -31,29 +37,51 @@ var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps),
31
37
  },
32
38
  onCloseIconClick: function() {
33
39
  return true;
34
- }
40
+ },
41
+ onTouchStart: function() {},
42
+ onTouchMove: function() {},
43
+ onTouchEnd: function() {}
35
44
  });
36
45
  // 默认1000,参看variables
37
46
  var _zIndex = 1100;
38
47
  export var Popup = function(props) {
39
- 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, 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;
48
+ 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;
40
49
  var innerIndex = zIndex || _zIndex;
41
50
  var _useState = _sliced_to_array(useState(innerIndex), 2), index = _useState[0], setIndex = _useState[1];
42
51
  var _useState1 = _sliced_to_array(useState(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
43
52
  var _useState2 = _sliced_to_array(useState(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
44
53
  var _useState3 = _sliced_to_array(useState(''), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
45
- var refObject = useLockScrollTaro(innerVisible && lockScroll);
54
+ var nodeRef = useLockScrollTaro(innerVisible && lockScroll);
55
+ var rootRect = useRef(null);
56
+ var touchStartRef = useRef(0);
57
+ var touchMoveDistanceRef = useRef(0);
58
+ var heightRef = useRef(0);
59
+ var defaultHeightRef = useRef(0);
60
+ var isTouching = useRef(false);
46
61
  var classPrefix = 'nut-popup';
47
62
  var overlayStyles = _object_spread({}, overlayStyle);
48
63
  var contentZIndex = harmony() ? index + 1 : index // 解决harmony层级问题
49
64
  ;
50
65
  var popStyles = _object_spread({
51
- zIndex: contentZIndex
66
+ zIndex: contentZIndex,
67
+ minHeight: minHeight
52
68
  }, style);
53
69
  var _obj;
54
70
  var popClassName = classNames(classPrefix, (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-round"), round || position === 'bottom'), _define_property(_obj, "".concat(classPrefix, "-").concat(position), true), _obj), className);
71
+ var _useState4 = _sliced_to_array(useState(''), 2), popupHeight = _useState4[0], setPopupHeight = _useState4[1];
72
+ var resizeStyles = function() {
73
+ if (popupHeight !== '') {
74
+ return {
75
+ height: popupHeight
76
+ };
77
+ }
78
+ };
55
79
  var open = function() {
56
80
  if (!innerVisible) {
81
+ // 当高度改变后,再次打开时,将高度置为初始高度
82
+ if (position === 'bottom' && resizable && nodeRef.current && heightRef.current) {
83
+ setPopupHeight(pxTransform(defaultHeightRef.current));
84
+ }
57
85
  setInnerVisible(true);
58
86
  setIndex(++innerIndex);
59
87
  }
@@ -107,19 +135,87 @@ export var Popup = function(props) {
107
135
  return renderCloseIcon();
108
136
  }
109
137
  };
138
+ var handleTouchStart = /*#__PURE__*/ function() {
139
+ var _ref = _async_to_generator(function(event) {
140
+ var _nodeRef_current, _rootRect_current, e, rect;
141
+ return _ts_generator(this, function(_state) {
142
+ switch(_state.label){
143
+ case 0:
144
+ if (position !== 'bottom' || !resizable || !nodeRef.current) return [
145
+ 2
146
+ ];
147
+ e = event;
148
+ // 开始touch,记录下touch的pageY,用以判断是向上滑动还是向下滑动
149
+ touchStartRef.current = e.touches[0].pageY;
150
+ // 标记开始滑动
151
+ isTouching.current = true;
152
+ return [
153
+ 4,
154
+ getRectInMultiPlatformWithoutCache(nodeRef.current)
155
+ ];
156
+ case 1:
157
+ rect = _state.sent();
158
+ rootRect.current = rect;
159
+ 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;
160
+ if (!defaultHeightRef.current) defaultHeightRef.current = heightRef.current;
161
+ onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(heightRef.current, e);
162
+ return [
163
+ 2
164
+ ];
165
+ }
166
+ });
167
+ });
168
+ return function handleTouchStart(event) {
169
+ return _ref.apply(this, arguments);
170
+ };
171
+ }();
172
+ var handleTouchMove = function(event) {
173
+ if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
174
+ var e = event;
175
+ e.stopPropagation();
176
+ // 计算位移:move过程中,当前的pageY 与 start值比较
177
+ touchMoveDistanceRef.current = e.touches[0].pageY - touchStartRef.current;
178
+ var handleMove = function() {
179
+ var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
180
+ var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
181
+ setPopupHeight(pxTransform(currentHeight));
182
+ if (touchMoveDistanceRef.current > 0 && isTouching.current) {
183
+ // 向下滑动
184
+ onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(currentHeight, e, 'down');
185
+ } else {
186
+ // 向上滑动
187
+ onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(currentHeight, e, 'up');
188
+ }
189
+ };
190
+ requestAnimationFrame(handleMove);
191
+ };
192
+ var handleTouchEnd = function(event) {
193
+ if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
194
+ var e = event;
195
+ isTouching.current = false;
196
+ var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
197
+ var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
198
+ onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(currentHeight, e);
199
+ };
110
200
  var renderPop = function() {
111
201
  return /*#__PURE__*/ React.createElement(View, {
112
- ref: refObject,
113
- style: _object_spread_props(_object_spread({}, popStyles), {
202
+ ref: nodeRef,
203
+ style: _object_spread(_object_spread_props(_object_spread({}, popStyles), {
114
204
  display: innerVisible ? 'block' : 'none'
115
- }),
205
+ }), resizeStyles()),
116
206
  className: popClassName,
117
207
  onClick: onClick,
118
- catchMove: lockScroll
119
- }, renderTitle(), showChildren ? children : null);
208
+ catchMove: lockScroll,
209
+ onTouchStart: handleTouchStart,
210
+ onTouchMove: handleTouchMove,
211
+ onTouchEnd: handleTouchEnd,
212
+ onTouchCancel: handleTouchEnd
213
+ }, top, renderTitle(), showChildren ? children : null);
214
+ };
215
+ // const renderPop = () => {
120
216
  // return (
121
217
  // <CSSTransition
122
- // nodeRef={refObject}
218
+ // nodeRef={nodeRef}
123
219
  // classNames={transitionName}
124
220
  // mountOnEnter
125
221
  // unmountOnExit={destroyOnClose}
@@ -128,19 +224,10 @@ export var Popup = function(props) {
128
224
  // onEntered={afterShow}
129
225
  // onExited={afterClose}
130
226
  // >
131
- // <View
132
- // ref={refObject}
133
- // style={popStyles}
134
- // className={popClassName}
135
- // onClick={onClick}
136
- // catchMove={lockScroll}
137
- // >
138
- // {renderTitle()}
139
- // {showChildren ? children : null}
140
- // </View>
227
+ // {renderContent()}
141
228
  // </CSSTransition>
142
229
  // )
143
- };
230
+ // }
144
231
  var renderNode = function() {
145
232
  return /*#__PURE__*/ React.createElement(React.Fragment, null, overlay ? /*#__PURE__*/ React.createElement(Overlay, {
146
233
  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;
@@ -1,11 +1,12 @@
1
1
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
2
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
- import React from "react";
4
+ import React, { useMemo } from "react";
5
5
  import { Text, View } from "@tarojs/components";
6
6
  import classNames from "classnames";
7
7
  import { ComponentDefaults } from "../../utils/typings";
8
8
  import { useRtl } from "../configprovider/index";
9
+ import { PriceColorEnum } from "../../types";
9
10
  import { harmony } from "../../utils/taro/platform";
10
11
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
11
12
  color: 'primary',
@@ -18,9 +19,28 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
18
19
  line: false
19
20
  });
20
21
  export var Price = function(props) {
21
- var _$_object_spread = _object_spread({}, defaultProps, props), color = _$_object_spread.color, price = _$_object_spread.price, symbol = _$_object_spread.symbol, digits = _$_object_spread.digits, thousands = _$_object_spread.thousands, position = _$_object_spread.position, size = _$_object_spread.size, line = _$_object_spread.line, className = _$_object_spread.className, style = _$_object_spread.style;
22
+ var _$_object_spread = _object_spread({}, defaultProps, props), color = _$_object_spread.color, originalPrice = _$_object_spread.price, symbol = _$_object_spread.symbol, digits = _$_object_spread.digits, thousands = _$_object_spread.thousands, position = _$_object_spread.position, size = _$_object_spread.size, line = _$_object_spread.line, className = _$_object_spread.className, style = _$_object_spread.style;
22
23
  var classPrefix = 'nut-price';
23
24
  var rtl = useRtl();
25
+ var price = useMemo(function() {
26
+ return originalPrice.toString().replace(/[^\d.]/g, '');
27
+ }, [
28
+ originalPrice
29
+ ]);
30
+ var isCustomPriceColor = useMemo(function() {
31
+ var specificPriceColor = Object.values(PriceColorEnum);
32
+ return !specificPriceColor.includes(color);
33
+ }, [
34
+ color
35
+ ]);
36
+ var priceColorStyle = useMemo(function() {
37
+ return isCustomPriceColor ? {
38
+ color: color
39
+ } : {};
40
+ }, [
41
+ isCustomPriceColor,
42
+ color
43
+ ]);
24
44
  var replaceSpecialChar = function(url) {
25
45
  url = url.replace(/&quot;/g, '"');
26
46
  url = url.replace(/&amp;/g, '&');
@@ -37,8 +57,8 @@ export var Price = function(props) {
37
57
  if (Number(num) === 0) {
38
58
  num = 0;
39
59
  }
40
- num = num.toString();
41
60
  if (checkPoint(num)) {
61
+ num = num.toString();
42
62
  num = typeof num.split('.') === 'string' ? num.split('.') : num.split('.')[0];
43
63
  }
44
64
  if (thousands) {
@@ -51,14 +71,17 @@ export var Price = function(props) {
51
71
  decimalNum = 0;
52
72
  }
53
73
  if (checkPoint(decimalNum)) {
54
- decimalNum = Number(decimalNum).toFixed(digits);
55
- decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] || 0;
74
+ decimalNum = digits ? Number(decimalNum).toFixed(digits) : "".concat(decimalNum);
75
+ decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] || '';
56
76
  } else {
57
- decimalNum = 0;
77
+ decimalNum = '';
78
+ }
79
+ if (digits) {
80
+ var result = "0.".concat(decimalNum);
81
+ var resultFixed = Number(result).toFixed(digits);
82
+ return String(resultFixed).substring(2, resultFixed.length);
58
83
  }
59
- var result = "0.".concat(decimalNum);
60
- var resultFixed = Number(result).toFixed(digits);
61
- return String(resultFixed).substring(2, resultFixed.length);
84
+ return decimalNum;
62
85
  };
63
86
  var renderSymbol = function() {
64
87
  var _obj;
@@ -67,16 +90,20 @@ export var Price = function(props) {
67
90
  "".concat(classPrefix, "-symbol"),
68
91
  "".concat(classPrefix, "-symbol-").concat(size),
69
92
  (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-line"), line), _define_property(_obj, "".concat(classPrefix, "-rtl"), rtl), _obj)
70
- ])
93
+ ]),
94
+ style: priceColorStyle
71
95
  }, symbol ? replaceSpecialChar(symbol) : '');
72
96
  };
73
97
  var renderInner = function() {
74
98
  return /*#__PURE__*/ React.createElement(React.Fragment, null, symbol && position === 'before' ? renderSymbol() : null, /*#__PURE__*/ React.createElement(Text, {
75
- className: "".concat(classPrefix, "-integer ").concat(classPrefix, "-integer-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
76
- }, formatThousands(price)), digits ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Text, {
77
- className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
78
- }, "."), /*#__PURE__*/ React.createElement(Text, {
79
- className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
99
+ className: "".concat(classPrefix, "-integer ").concat(classPrefix, "-integer-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
100
+ style: priceColorStyle
101
+ }, formatThousands(price)), digits !== 0 ? /*#__PURE__*/ React.createElement(React.Fragment, null, checkPoint(price) || digits ? /*#__PURE__*/ React.createElement(Text, {
102
+ className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
103
+ style: priceColorStyle
104
+ }, ".") : null, /*#__PURE__*/ React.createElement(Text, {
105
+ className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
106
+ style: priceColorStyle
80
107
  }, formatDecimal(price))) : null, symbol && position === 'after' ? renderSymbol() : null);
81
108
  };
82
109
  return /*#__PURE__*/ React.createElement(React.Fragment, null, harmony() ? /*#__PURE__*/ React.createElement(Text, {
@@ -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;
@@ -19,7 +19,7 @@ var defaultProps = {
19
19
  };
20
20
  var classPrefix = 'nut-swiper';
21
21
  export var Swiper = /*#__PURE__*/ React.forwardRef(function(props, ref) {
22
- var _ref = _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 = _object_without_properties(_ref, [
22
+ var _ref = _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 = _object_without_properties(_ref, [
23
23
  "width",
24
24
  "height",
25
25
  "className",
@@ -30,7 +30,6 @@ export var Swiper = /*#__PURE__*/ React.forwardRef(function(props, ref) {
30
30
  "circular",
31
31
  "autoPlay",
32
32
  "autoplay",
33
- "duration",
34
33
  "vertical",
35
34
  "direction",
36
35
  "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;
@@ -34,6 +34,10 @@ export interface BasePopup extends BaseProps, BaseOverlay {
34
34
  */
35
35
  title?: ReactNode
36
36
  /**
37
+ * 頂部佔位
38
+ */
39
+ top?: ReactNode
40
+ /**
37
41
  * 子标题/描述部分
38
42
  */
39
43
  description?: ReactNode
@@ -50,6 +54,14 @@ export interface BasePopup extends BaseProps, BaseOverlay {
50
54
  */
51
55
  round: boolean
52
56
  /**
57
+ * 上下滑动调整高度,当前只支持从底部弹出
58
+ */
59
+ resizable: boolean
60
+ /**
61
+ * 设置最小高度
62
+ */
63
+ minHeight: string
64
+ /**
53
65
  * 打开弹框时触发
54
66
  */
55
67
  onOpen: () => void
@@ -65,4 +77,16 @@ export interface BasePopup extends BaseProps, BaseOverlay {
65
77
  * 点击关闭图标时触发
66
78
  */
67
79
  onCloseIconClick: (e: any) => boolean | void
80
+ /**
81
+ * 滑动时触发
82
+ */
83
+ onTouchMove: (height: number, e: any, direction: 'up' | 'down') => void
84
+ /**
85
+ * 开始触碰时触发
86
+ */
87
+ onTouchStart: (height: number, e: any) => void
88
+ /**
89
+ * 结束触碰时触发
90
+ */
91
+ onTouchEnd: (height: number, e: any) => void
68
92
  }
@@ -1,18 +1,30 @@
1
1
  import { BaseProps } from '../../base/props';
2
2
  import { SimpleValue, UISize } from '../../base/atoms';
3
3
  export type PriceSize = Exclude<UISize, 'mini'>;
4
- export type PriceColor = 'primary' | 'gray' | 'darkgray';
4
+ export type SpecificPriceColor = 'primary' | 'gray' | 'darkgray';
5
+ export type PriceColor = SpecificPriceColor | string;
6
+ export declare enum PriceColorEnum {
7
+ Primary = "primary",
8
+ Gray = "gray",
9
+ Darkgray = "darkgray"
10
+ }
5
11
  export interface BasePrice extends BaseProps {
6
- color: PriceColor;
7
- price: SimpleValue;
12
+ /**
13
+ * 价格类型, 支持自定义颜色
14
+ */
15
+ color: PriceColor
16
+ /**
17
+ * 价格数量
18
+ */
19
+ price: SimpleValue
8
20
  /**
9
21
  * 符号类型
10
22
  */
11
23
  symbol: string
12
24
  /**
13
- * 小数位位数
25
+ * 小数位位数,传入null数据原样输出
14
26
  */
15
- digits: number
27
+ digits: number | null
16
28
  /**
17
29
  * 是否按照千分号形式显示
18
30
  */
@@ -1 +1,6 @@
1
- export { };
1
+ export var PriceColorEnum = /*#__PURE__*/ function(PriceColorEnum) {
2
+ PriceColorEnum["Primary"] = "primary";
3
+ PriceColorEnum["Gray"] = "gray";
4
+ PriceColorEnum["Darkgray"] = "darkgray";
5
+ return PriceColorEnum;
6
+ }({});
@@ -10,3 +10,4 @@ export interface Rect {
10
10
  }
11
11
  export declare function makeRect(width: number, height: number): Rect;
12
12
  export declare const getRectInMultiPlatform: (element: any, harmonyId?: string) => Promise<Rect>;
13
+ export declare const getRectInMultiPlatformWithoutCache: (element: any, harmonyId?: string) => Promise<Rect>;
@@ -56,3 +56,37 @@ export var getRectInMultiPlatform = /*#__PURE__*/ function() {
56
56
  return _ref.apply(this, arguments);
57
57
  };
58
58
  }();
59
+ // 获取元素位置,不走缓存
60
+ export var getRectInMultiPlatformWithoutCache = /*#__PURE__*/ function() {
61
+ var _ref = _async_to_generator(function(element) {
62
+ var harmonyId;
63
+ var _arguments = arguments;
64
+ return _ts_generator(this, function(_state) {
65
+ harmonyId = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : '';
66
+ if (element) {
67
+ if (inBrowser) {
68
+ return [
69
+ 2,
70
+ Promise.resolve(getRect(element))
71
+ ];
72
+ }
73
+ return [
74
+ 2,
75
+ new Promise(function(resolve, reject) {
76
+ createSelectorQuery().select("#".concat(harmonyId || element.uid)).boundingClientRect().exec(function(param) {
77
+ var _param = _sliced_to_array(param, 1), rects = _param[0];
78
+ resolve(rects);
79
+ });
80
+ })
81
+ ];
82
+ }
83
+ return [
84
+ 2,
85
+ Promise.resolve(makeRect(0, 0))
86
+ ];
87
+ });
88
+ });
89
+ return function getRectInMultiPlatformWithoutCache(element) {
90
+ return _ref.apply(this, arguments);
91
+ };
92
+ }();