@nutui/nutui-react 1.3.5 → 1.3.7

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 (110) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/esm/ActionSheet.js +15 -25
  3. package/dist/esm/Address.js +151 -221
  4. package/dist/esm/AnimatingNumbers.js +7 -31
  5. package/dist/esm/Audio.js +31 -66
  6. package/dist/esm/Avatar.js +25 -51
  7. package/dist/esm/AvatarGroup.js +2 -9
  8. package/dist/esm/BackTop.js +29 -55
  9. package/dist/esm/Badge.js +9 -20
  10. package/dist/esm/Barrage.js +8 -20
  11. package/dist/esm/Button.js +22 -37
  12. package/dist/esm/Calendar.js +23 -37
  13. package/dist/esm/CalendarItem.js +86 -186
  14. package/dist/esm/Card.js +14 -20
  15. package/dist/esm/Cascader.js +77 -197
  16. package/dist/esm/Cell.js +20 -30
  17. package/dist/esm/CellGroup.js +6 -12
  18. package/dist/esm/Checkbox.js +27 -48
  19. package/dist/esm/CheckboxGroup.js +12 -30
  20. package/dist/esm/CircleProgress.js +11 -28
  21. package/dist/esm/Col.js +11 -22
  22. package/dist/esm/Collapse.js +11 -27
  23. package/dist/esm/CollapseItem.js +33 -47
  24. package/dist/esm/ConfigProvider.js +4 -15
  25. package/dist/esm/CountDown.js +37 -74
  26. package/dist/esm/DatePicker.js +44 -106
  27. package/dist/esm/Dialog.js +31 -89
  28. package/dist/esm/Divider.js +8 -15
  29. package/dist/esm/Drag.js +30 -45
  30. package/dist/esm/Elevator.js +37 -74
  31. package/dist/esm/Empty.js +11 -24
  32. package/dist/esm/FixedNav.js +18 -29
  33. package/dist/esm/Grid.js +13 -28
  34. package/dist/esm/GridItem.js +18 -34
  35. package/dist/esm/ImagePreview.js +36 -71
  36. package/dist/esm/Indicator.js +9 -20
  37. package/dist/esm/Infiniteloading.js +26 -55
  38. package/dist/esm/Input.js +62 -106
  39. package/dist/esm/InputNumber.js +25 -52
  40. package/dist/esm/Layout.js +0 -6
  41. package/dist/esm/Menu.js +27 -49
  42. package/dist/esm/MenuItem.js +32 -56
  43. package/dist/esm/NavBar.js +18 -34
  44. package/dist/esm/NoticeBar.js +54 -102
  45. package/dist/esm/Notify.js +9 -38
  46. package/dist/esm/NumberKeyboard.js +21 -52
  47. package/dist/esm/Pagination.js +38 -71
  48. package/dist/esm/Picker.js +91 -178
  49. package/dist/esm/Popover.js +32 -72
  50. package/dist/esm/Popup.js +40 -72
  51. package/dist/esm/Price.js +7 -24
  52. package/dist/esm/Progress.js +35 -50
  53. package/dist/esm/PullToRefresh.js +28 -83
  54. package/dist/esm/Radio.js +24 -47
  55. package/dist/esm/RadioGroup.js +14 -24
  56. package/dist/esm/Range.js +44 -116
  57. package/dist/esm/Rate.js +21 -39
  58. package/dist/esm/Row.js +7 -16
  59. package/dist/esm/SearchBar.js +47 -68
  60. package/dist/esm/ShortPassword.js +29 -56
  61. package/dist/esm/SideNavBar.js +9 -16
  62. package/dist/esm/SideNavBarItem.js +4 -11
  63. package/dist/esm/Signature.js +13 -43
  64. package/dist/esm/Skeleton.js +13 -23
  65. package/dist/esm/Step.js +12 -28
  66. package/dist/esm/Steps.js +6 -14
  67. package/dist/esm/Sticky.js +24 -52
  68. package/dist/esm/SubSideNavBar.js +7 -22
  69. package/dist/esm/Swipe.js +15 -54
  70. package/dist/esm/Swiper.js +102 -186
  71. package/dist/esm/SwiperItem.js +2 -12
  72. package/dist/esm/Switch.js +13 -27
  73. package/dist/esm/Tabbar.js +13 -25
  74. package/dist/esm/TabbarItem.js +15 -23
  75. package/dist/esm/Table.js +19 -39
  76. package/dist/esm/Tag.js +19 -36
  77. package/dist/esm/TextArea.js +19 -43
  78. package/dist/esm/TimeDetail.js +15 -28
  79. package/dist/esm/TimePannel.js +5 -12
  80. package/dist/esm/TimeSelect.js +35 -59
  81. package/dist/esm/Toast.js +16 -49
  82. package/dist/esm/Uploader.js +57 -152
  83. package/dist/esm/Video.js +8 -19
  84. package/dist/esm/VirtualList.js +84 -118
  85. package/dist/esm/date-710f8c7c.js +9 -33
  86. package/dist/esm/get-scroll-parent-3dcd3f53.js +1 -9
  87. package/dist/esm/icon-8dc4de10.js +11 -21
  88. package/dist/esm/offsetContext-0e3d04b3.js +0 -3
  89. package/dist/esm/overlay-ed3eb37d.js +12 -23
  90. package/dist/esm/render-18227751.js +0 -11
  91. package/dist/esm/tabpane-c957ab14.js +4 -10
  92. package/dist/esm/tabs-0896a61b.js +28 -56
  93. package/dist/esm/types/src/packages/elevator/demo.d.ts +1 -0
  94. package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +2 -0
  95. package/dist/esm/useClientRect-839d18c5.js +0 -5
  96. package/dist/esm/useTouch-a2ea68c6.js +27 -47
  97. package/dist/locales/base.js +1 -1
  98. package/dist/locales/en-US.js +1 -1
  99. package/dist/locales/id-ID.js +1 -1
  100. package/dist/locales/zh-CN.js +1 -1
  101. package/dist/locales/zh-TW.js +1 -1
  102. package/dist/nutui.react.es.js +429 -413
  103. package/dist/nutui.react.umd.js +421 -405
  104. package/dist/packages/menu/menu.scss +4 -0
  105. package/dist/packages/menuitem/menuitem.scss +27 -2
  106. package/dist/packages/searchbar/searchbar.scss +20 -3
  107. package/dist/style.css +1 -1
  108. package/dist/style.es.js +1 -1
  109. package/dist/types/index.d.ts +2 -0
  110. package/package.json +1 -1
@@ -8,24 +8,19 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
9
  import _typeof from "@babel/runtime/helpers/typeof";
10
10
  var _excluded = ["children", "list", "theme", "location", "visible", "offset", "className", "style", "onClick", "onChoose", "iconClassPrefix", "iconFontClassName"];
11
-
12
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
-
14
12
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
-
16
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
17
-
18
14
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
-
20
15
  import React__default, { useRef, useState, useEffect } from 'react';
21
16
  import Icon from './Icon.js';
22
17
  import Overlay from './Overlay.js';
23
18
  import { g as getRect } from './useClientRect-839d18c5.js';
24
19
  import { C as ComponentDefaults } from './typings-1c5f2628.js';
20
+
25
21
  /**
26
22
  * 过滤ref
27
23
  */
28
-
29
24
  function fillRef(ref, node) {
30
25
  if (typeof ref === 'function') {
31
26
  ref(node);
@@ -36,42 +31,31 @@ function fillRef(ref, node) {
36
31
  /**
37
32
  * 将ref合并到一个ref函数中以支持ref传递
38
33
  */
39
-
40
-
41
34
  function composeRef() {
42
35
  for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
43
36
  refs[_key] = arguments[_key];
44
37
  }
45
-
46
38
  return function (node) {
47
39
  refs.forEach(function (ref) {
48
40
  fillRef(ref, node);
49
41
  });
50
42
  };
51
43
  }
52
-
53
44
  var Trigger = /*#__PURE__*/function (_React__default$Compo) {
54
45
  _inherits(Trigger, _React__default$Compo);
55
-
56
46
  var _super = _createSuper(Trigger);
57
-
58
47
  function Trigger() {
59
48
  _classCallCheck(this, Trigger);
60
-
61
49
  return _super.apply(this, arguments);
62
50
  }
63
-
64
51
  _createClass(Trigger, [{
65
52
  key: "fireEvents",
66
53
  value: function fireEvents(type, e) {
67
54
  var childCallback = this.props.children.props[type];
68
-
69
55
  if (childCallback) {
70
56
  childCallback(e);
71
57
  }
72
-
73
58
  var callback = this.props[type];
74
-
75
59
  if (callback) {
76
60
  callback(e);
77
61
  }
@@ -80,29 +64,24 @@ var Trigger = /*#__PURE__*/function (_React__default$Compo) {
80
64
  key: "render",
81
65
  value: function render() {
82
66
  var _this$props = this.props,
83
- children = _this$props.children,
84
- _this$props$className = _this$props.className,
85
- className = _this$props$className === void 0 ? '' : _this$props$className;
67
+ children = _this$props.children,
68
+ _this$props$className = _this$props.className,
69
+ className = _this$props$className === void 0 ? '' : _this$props$className;
86
70
  var child = React__default.Children.only(children);
87
71
  var newChildProps = {
88
72
  key: 'trigger'
89
73
  };
90
-
91
74
  if (child && child.props && child.props.className) {
92
75
  newChildProps.className = className;
93
76
  }
94
-
95
77
  var cloneProps = _objectSpread({}, newChildProps);
96
-
97
78
  cloneProps.ref = composeRef(this.props.forwardedRef, child.ref);
98
79
  var trigger = React__default.cloneElement(child, cloneProps);
99
80
  return trigger;
100
81
  }
101
82
  }]);
102
-
103
83
  return Trigger;
104
84
  }(React__default.Component);
105
-
106
85
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
107
86
  list: [],
108
87
  theme: 'light',
@@ -113,23 +92,21 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
113
92
  onClick: function onClick(e) {},
114
93
  onChoose: function onChoose(item, index) {}
115
94
  });
116
-
117
95
  var Popover = function Popover(props) {
118
96
  var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
119
- children = _defaultProps$props.children,
120
- list = _defaultProps$props.list,
121
- theme = _defaultProps$props.theme,
122
- location = _defaultProps$props.location,
123
- visible = _defaultProps$props.visible,
124
- offset = _defaultProps$props.offset,
125
- className = _defaultProps$props.className,
126
- style = _defaultProps$props.style,
127
- onClick = _defaultProps$props.onClick,
128
- onChoose = _defaultProps$props.onChoose,
129
- iconClassPrefix = _defaultProps$props.iconClassPrefix,
130
- iconFontClassName = _defaultProps$props.iconFontClassName,
131
- reset = _objectWithoutProperties(_defaultProps$props, _excluded);
132
-
97
+ children = _defaultProps$props.children,
98
+ list = _defaultProps$props.list,
99
+ theme = _defaultProps$props.theme,
100
+ location = _defaultProps$props.location,
101
+ visible = _defaultProps$props.visible,
102
+ offset = _defaultProps$props.offset,
103
+ className = _defaultProps$props.className,
104
+ style = _defaultProps$props.style,
105
+ onClick = _defaultProps$props.onClick,
106
+ onChoose = _defaultProps$props.onChoose,
107
+ iconClassPrefix = _defaultProps$props.iconClassPrefix,
108
+ iconFontClassName = _defaultProps$props.iconFontClassName,
109
+ reset = _objectWithoutProperties(_defaultProps$props, _excluded);
133
110
  var goodItem = useRef(null);
134
111
  setTimeout(function () {
135
112
  if (goodItem.current && getRect(goodItem.current)) {
@@ -137,42 +114,34 @@ var Popover = function Popover(props) {
137
114
  setElHeight(getRect(goodItem.current).height);
138
115
  }
139
116
  });
140
-
141
117
  var _useState = useState(''),
142
- _useState2 = _slicedToArray(_useState, 2),
143
- classes = _useState2[0],
144
- setClasses = _useState2[1];
145
-
118
+ _useState2 = _slicedToArray(_useState, 2),
119
+ classes = _useState2[0],
120
+ setClasses = _useState2[1];
146
121
  var _useState3 = useState(0),
147
- _useState4 = _slicedToArray(_useState3, 2),
148
- elWidth = _useState4[0],
149
- setElWidth = _useState4[1];
150
-
122
+ _useState4 = _slicedToArray(_useState3, 2),
123
+ elWidth = _useState4[0],
124
+ setElWidth = _useState4[1];
151
125
  var _useState5 = useState(0),
152
- _useState6 = _slicedToArray(_useState5, 2),
153
- elHeight = _useState6[0],
154
- setElHeight = _useState6[1];
155
-
126
+ _useState6 = _slicedToArray(_useState5, 2),
127
+ elHeight = _useState6[0],
128
+ setElHeight = _useState6[1];
156
129
  var _useState7 = useState(''),
157
- _useState8 = _slicedToArray(_useState7, 2),
158
- popoverContent = _useState8[0],
159
- setPopoverContent = _useState8[1];
160
-
130
+ _useState8 = _slicedToArray(_useState7, 2),
131
+ popoverContent = _useState8[0],
132
+ setPopoverContent = _useState8[1];
161
133
  var _useState9 = useState(''),
162
- _useState10 = _slicedToArray(_useState9, 2),
163
- popoverArrow = _useState10[0],
164
- setPopoverArrow = _useState10[1];
165
-
134
+ _useState10 = _slicedToArray(_useState9, 2),
135
+ popoverArrow = _useState10[0],
136
+ setPopoverArrow = _useState10[1];
166
137
  useEffect(function () {
167
138
  setClasses(classesSelf());
168
139
  setPopoverContent(popoverContentSelf());
169
140
  setPopoverArrow(popoverArrowSelf());
170
141
  }, [list, theme]);
171
-
172
142
  var getStyle = function getStyle() {
173
143
  var offNumer = Number(offset) ? Number(offset) : 0;
174
144
  var style = {};
175
-
176
145
  if (location.includes('top')) {
177
146
  style.bottom = "".concat(elHeight + offNumer, "px");
178
147
  } else if (location.includes('right')) {
@@ -182,44 +151,36 @@ var Popover = function Popover(props) {
182
151
  } else {
183
152
  style.top = "".concat(elHeight + offNumer, "px");
184
153
  }
185
-
186
154
  return style;
187
155
  };
188
-
189
156
  var classesSelf = function classesSelf() {
190
157
  var prefixCls = 'nut-popover';
191
158
  return "".concat(prefixCls, " ").concat(theme ? "".concat(prefixCls, "--").concat(theme) : '');
192
159
  };
193
-
194
160
  var popoverContentSelf = function popoverContentSelf() {
195
161
  var prefixCls = 'popover-content';
196
162
  return "".concat(prefixCls, "-show ").concat(prefixCls, " ").concat(location ? "".concat(prefixCls, "--").concat(location) : '');
197
163
  };
198
-
199
164
  var filter = function filter() {
200
165
  var ms = ['top', 'bottom', 'left', 'right'];
201
166
  return ms.filter(function (m) {
202
167
  return location.includes(m);
203
168
  })[0];
204
169
  };
205
-
206
170
  var popoverArrowSelf = function popoverArrowSelf() {
207
171
  var prefixCls = 'popover-arrow';
208
172
  return "".concat(prefixCls, " ").concat(prefixCls, "-").concat(filter(), " ").concat(location ? "".concat(prefixCls, "--").concat(location) : '');
209
173
  };
210
-
211
174
  var handleClick = function handleClick(e) {
212
175
  if (props.onClick) {
213
176
  props.onClick(e);
214
177
  }
215
178
  };
216
-
217
179
  var handleChoose = function handleChoose(item, index) {
218
180
  if (!item.disabled) {
219
181
  onChoose(item, index);
220
182
  }
221
183
  };
222
-
223
184
  return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", _objectSpread({
224
185
  className: "".concat(classes, " ").concat(className),
225
186
  style: _objectSpread({}, style)
@@ -259,7 +220,6 @@ var Popover = function Popover(props) {
259
220
  }
260
221
  }) : '');
261
222
  };
262
-
263
223
  Popover.defaultProps = defaultProps;
264
224
  Popover.displayName = 'NutPopover';
265
225
  export { Popover as default };
package/dist/esm/Popup.js CHANGED
@@ -1,10 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
-
4
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
-
6
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
-
8
5
  import React__default, { useState, useEffect } from 'react';
9
6
  import { createPortal } from 'react-dom';
10
7
  import { CSSTransition } from 'react-transition-group';
@@ -15,7 +12,6 @@ import Overlay from './Overlay.js';
15
12
  import { c as cn } from './bem-893ad28d.js';
16
13
  import { C as ComponentDefaults } from './typings-1c5f2628.js';
17
14
  import '@bem-react/classname';
18
-
19
15
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
20
16
  position: 'center',
21
17
  transition: '',
@@ -36,96 +32,80 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
36
32
  onClickOverlay: function onClickOverlay(e) {},
37
33
  onClickCloseIcon: function onClickCloseIcon(e) {}
38
34
  }, defaultOverlayProps);
39
-
40
35
  var _zIndex = 2000;
41
-
42
36
  var Popup = function Popup(props) {
43
37
  var _classNames;
44
-
45
38
  var children = props.children,
46
- visible = props.visible,
47
- overlay = props.overlay,
48
- closeOnClickOverlay = props.closeOnClickOverlay,
49
- overlayStyle = props.overlayStyle,
50
- overlayClass = props.overlayClass,
51
- zIndex = props.zIndex,
52
- lockScroll = props.lockScroll,
53
- duration = props.duration,
54
- closeable = props.closeable,
55
- closeIconPosition = props.closeIconPosition,
56
- closeIcon = props.closeIcon,
57
- style = props.style,
58
- transition = props.transition,
59
- round = props.round,
60
- position = props.position,
61
- popClass = props.popClass,
62
- className = props.className,
63
- destroyOnClose = props.destroyOnClose,
64
- teleport = props.teleport,
65
- onOpen = props.onOpen,
66
- onClose = props.onClose,
67
- onClickOverlay = props.onClickOverlay,
68
- onClickCloseIcon = props.onClickCloseIcon,
69
- onOpened = props.onOpened,
70
- onClosed = props.onClosed,
71
- onClick = props.onClick,
72
- iconClassPrefix = props.iconClassPrefix,
73
- iconFontClassName = props.iconFontClassName;
74
-
39
+ visible = props.visible,
40
+ overlay = props.overlay,
41
+ closeOnClickOverlay = props.closeOnClickOverlay,
42
+ overlayStyle = props.overlayStyle,
43
+ overlayClass = props.overlayClass,
44
+ zIndex = props.zIndex,
45
+ lockScroll = props.lockScroll,
46
+ duration = props.duration,
47
+ closeable = props.closeable,
48
+ closeIconPosition = props.closeIconPosition,
49
+ closeIcon = props.closeIcon,
50
+ style = props.style,
51
+ transition = props.transition,
52
+ round = props.round,
53
+ position = props.position,
54
+ popClass = props.popClass,
55
+ className = props.className,
56
+ destroyOnClose = props.destroyOnClose,
57
+ teleport = props.teleport,
58
+ onOpen = props.onOpen,
59
+ onClose = props.onClose,
60
+ onClickOverlay = props.onClickOverlay,
61
+ onClickCloseIcon = props.onClickCloseIcon,
62
+ onOpened = props.onOpened,
63
+ onClosed = props.onClosed,
64
+ onClick = props.onClick,
65
+ iconClassPrefix = props.iconClassPrefix,
66
+ iconFontClassName = props.iconFontClassName;
75
67
  var _useState = useState(zIndex || _zIndex),
76
- _useState2 = _slicedToArray(_useState, 2),
77
- index = _useState2[0],
78
- setIndex = _useState2[1];
79
-
68
+ _useState2 = _slicedToArray(_useState, 2),
69
+ index = _useState2[0],
70
+ setIndex = _useState2[1];
80
71
  var _useState3 = useState(visible),
81
- _useState4 = _slicedToArray(_useState3, 2),
82
- innerVisible = _useState4[0],
83
- setInnerVisible = _useState4[1];
84
-
72
+ _useState4 = _slicedToArray(_useState3, 2),
73
+ innerVisible = _useState4[0],
74
+ setInnerVisible = _useState4[1];
85
75
  var _useState5 = useState(true),
86
- _useState6 = _slicedToArray(_useState5, 2),
87
- showChildren = _useState6[0],
88
- setShowChildren = _useState6[1];
89
-
76
+ _useState6 = _slicedToArray(_useState5, 2),
77
+ showChildren = _useState6[0],
78
+ setShowChildren = _useState6[1];
90
79
  var _useState7 = useState(''),
91
- _useState8 = _slicedToArray(_useState7, 2),
92
- transitionName = _useState8[0],
93
- setTransitionName = _useState8[1];
94
-
80
+ _useState8 = _slicedToArray(_useState7, 2),
81
+ transitionName = _useState8[0],
82
+ setTransitionName = _useState8[1];
95
83
  var b = cn('popup');
96
84
  var baseStyle = {
97
85
  zIndex: index,
98
86
  animationDuration: "".concat(duration, "s")
99
87
  };
100
-
101
88
  var overlayStyles = _objectSpread(_objectSpread({}, overlayStyle), baseStyle);
102
-
103
89
  var popStyles = _objectSpread(_objectSpread({}, style), baseStyle);
104
-
105
90
  var classes = classNames((_classNames = {
106
91
  round: round
107
92
  }, _defineProperty(_classNames, "popup-".concat(position), true), _defineProperty(_classNames, "".concat(popClass), true), _defineProperty(_classNames, "".concat(className), true), _classNames), b(''));
108
93
  var closeClasses = classNames(_defineProperty({
109
94
  'nutui-popup__close-icon': true
110
95
  }, "nutui-popup__close-icon--".concat(closeIconPosition), true));
111
-
112
96
  var open = function open() {
113
97
  if (!innerVisible) {
114
98
  setInnerVisible(true);
115
99
  setIndex(++_zIndex);
116
100
  }
117
-
118
101
  if (destroyOnClose) {
119
102
  setShowChildren(true);
120
103
  }
121
-
122
104
  onOpen && onOpen();
123
105
  };
124
-
125
106
  var close = function close() {
126
107
  if (innerVisible) {
127
108
  setInnerVisible(false);
128
-
129
109
  if (destroyOnClose) {
130
110
  setTimeout(function () {
131
111
  setShowChildren(false);
@@ -134,45 +114,36 @@ var Popup = function Popup(props) {
134
114
  }
135
115
  }
136
116
  };
137
-
138
117
  var onHandleClickOverlay = function onHandleClickOverlay(e) {
139
118
  if (closeOnClickOverlay) {
140
119
  onClickOverlay && onClickOverlay(e);
141
120
  close();
142
121
  }
143
122
  };
144
-
145
123
  var onHandleClick = function onHandleClick(e) {
146
124
  onClick && onClick(e);
147
125
  };
148
-
149
126
  var onHandleClickCloseIcon = function onHandleClickCloseIcon(e) {
150
127
  onClickCloseIcon && onClickCloseIcon(e);
151
128
  close();
152
129
  };
153
-
154
130
  var onHandleOpened = function onHandleOpened(e) {
155
131
  onOpened && onOpened(e);
156
132
  };
157
-
158
133
  var onHandleClosed = function onHandleClosed(e) {
159
134
  onClosed && onClosed(e);
160
135
  };
161
-
162
136
  var resolveContainer = function resolveContainer(getContainer) {
163
137
  var container = typeof getContainer === 'function' ? getContainer() : getContainer;
164
138
  return container || document.body;
165
139
  };
166
-
167
140
  var renderToContainer = function renderToContainer(getContainer, node) {
168
141
  if (getContainer) {
169
142
  var container = resolveContainer(getContainer);
170
143
  return createPortal(node, container);
171
144
  }
172
-
173
145
  return node;
174
146
  };
175
-
176
147
  var renderPop = function renderPop() {
177
148
  return React__default.createElement(CSSTransition, {
178
149
  classNames: transitionName,
@@ -195,7 +166,6 @@ var Popup = function Popup(props) {
195
166
  size: "12px"
196
167
  })) : ''));
197
168
  };
198
-
199
169
  var renderNode = function renderNode() {
200
170
  return React__default.createElement(React__default.Fragment, null, overlay ? React__default.createElement(React__default.Fragment, null, React__default.createElement(Overlay, {
201
171
  style: overlayStyles,
@@ -208,7 +178,6 @@ var Popup = function Popup(props) {
208
178
  onClick: onHandleClickOverlay
209
179
  }), renderPop()) : React__default.createElement(React__default.Fragment, null, renderPop()));
210
180
  };
211
-
212
181
  useEffect(function () {
213
182
  visible && open();
214
183
  !visible && close();
@@ -218,7 +187,6 @@ var Popup = function Popup(props) {
218
187
  }, [position]);
219
188
  return React__default.createElement(React__default.Fragment, null, renderToContainer(teleport, renderNode()));
220
189
  };
221
-
222
190
  Popup.defaultProps = defaultProps;
223
191
  Popup.displayName = 'NutPopup';
224
192
  export { Popup as default };
package/dist/esm/Price.js CHANGED
@@ -1,11 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["price", "needSymbol", "symbol", "decimalDigits", "thousands", "className"];
4
-
5
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
6
  import React__default from 'react';
10
7
  import { c as cn } from './bem-893ad28d.js';
11
8
  import '@bem-react/classname';
@@ -17,19 +14,16 @@ var defaultProps = {
17
14
  thousands: false,
18
15
  className: ''
19
16
  };
20
-
21
17
  var Price = function Price(props) {
22
18
  var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
23
- price = _defaultProps$props.price,
24
- needSymbol = _defaultProps$props.needSymbol,
25
- symbol = _defaultProps$props.symbol,
26
- decimalDigits = _defaultProps$props.decimalDigits,
27
- thousands = _defaultProps$props.thousands,
28
- className = _defaultProps$props.className,
29
- rest = _objectWithoutProperties(_defaultProps$props, _excluded);
30
-
19
+ price = _defaultProps$props.price,
20
+ needSymbol = _defaultProps$props.needSymbol,
21
+ symbol = _defaultProps$props.symbol,
22
+ decimalDigits = _defaultProps$props.decimalDigits,
23
+ thousands = _defaultProps$props.thousands,
24
+ className = _defaultProps$props.className,
25
+ rest = _objectWithoutProperties(_defaultProps$props, _excluded);
31
26
  var b = cn('price');
32
-
33
27
  var replaceSpecialChar = function replaceSpecialChar(symbol) {
34
28
  var desSymbol = symbol;
35
29
  desSymbol = symbol.replace(/&quot;/g, '"');
@@ -40,53 +34,43 @@ var Price = function Price(props) {
40
34
  desSymbol = symbol.replace(/&yen;/g, '¥');
41
35
  return desSymbol;
42
36
  };
43
-
44
37
  var showSymbol = function showSymbol() {
45
38
  return {
46
39
  __html: (needSymbol ? replaceSpecialChar(symbol) : '') || ''
47
40
  };
48
41
  };
49
-
50
42
  var checkPoint = function checkPoint(price) {
51
43
  return String(price).indexOf('.') > 0;
52
44
  };
53
-
54
45
  var formatThousands = function formatThousands(num) {
55
46
  if (Number(num) === 0) {
56
47
  num = 0;
57
48
  }
58
-
59
49
  if (checkPoint(num)) {
60
50
  num = Number(num).toFixed(decimalDigits);
61
51
  num = typeof num.split('.') === 'string' ? num.split('.') : num.split('.')[0];
62
52
  } else {
63
53
  num = num.toString();
64
54
  }
65
-
66
55
  if (thousands) {
67
56
  return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
68
57
  }
69
-
70
58
  return num;
71
59
  };
72
-
73
60
  var formatDecimal = function formatDecimal(decimalNum) {
74
61
  if (Number(decimalNum) === 0) {
75
62
  decimalNum = 0;
76
63
  }
77
-
78
64
  if (checkPoint(decimalNum)) {
79
65
  decimalNum = Number(decimalNum).toFixed(decimalDigits);
80
66
  decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1];
81
67
  } else {
82
68
  decimalNum = 0;
83
69
  }
84
-
85
70
  var result = "0.".concat(decimalNum);
86
71
  var resultFixed = Number(result).toFixed(decimalDigits);
87
72
  return String(resultFixed).substring(2, resultFixed.length);
88
73
  };
89
-
90
74
  return React__default.createElement("div", _objectSpread({
91
75
  className: "".concat(b(), " ").concat(className)
92
76
  }, rest), needSymbol ? React__default.createElement("div", {
@@ -100,7 +84,6 @@ var Price = function Price(props) {
100
84
  className: "".concat(b('small'))
101
85
  }, formatDecimal(price)));
102
86
  };
103
-
104
87
  Price.defaultProps = defaultProps;
105
88
  Price.displayName = 'NutPrice';
106
89
  export { Price as default };