@nutui/nutui-react 1.3.5-beta.1 → 1.3.6

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 (108) hide show
  1. package/CHANGELOG.md +7 -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 +24 -46
  42. package/dist/esm/MenuItem.js +29 -52
  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 +424 -406
  103. package/dist/nutui.react.umd.js +416 -398
  104. package/dist/packages/searchbar/searchbar.scss +20 -3
  105. package/dist/style.css +1 -1
  106. package/dist/style.es.js +1 -1
  107. package/dist/types/index.d.ts +2 -0
  108. package/package.json +1 -1
@@ -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, { useRef, useState, useEffect } from 'react';
9
6
  import classNames from 'classnames';
10
7
  import Icon from './Icon.js';
@@ -12,7 +9,6 @@ import { c as cn } from './bem-893ad28d.js';
12
9
  import { g as getRect } from './useClientRect-839d18c5.js';
13
10
  import { C as ComponentDefaults } from './typings-1c5f2628.js';
14
11
  import '@bem-react/classname';
15
-
16
12
  var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
17
13
  // 滚动方向 across 横向 vertical 纵向
18
14
  direction: 'across',
@@ -30,87 +26,73 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
30
26
  scrollable: null,
31
27
  speed: 50
32
28
  });
33
-
34
29
  var NoticeBar = function NoticeBar(props) {
35
30
  var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
36
- children = _defaultProps$props.children,
37
- className = _defaultProps$props.className,
38
- style = _defaultProps$props.style,
39
- direction = _defaultProps$props.direction,
40
- list = _defaultProps$props.list,
41
- standTime = _defaultProps$props.standTime,
42
- complexAm = _defaultProps$props.complexAm,
43
- height = _defaultProps$props.height,
44
- text = _defaultProps$props.text,
45
- closeMode = _defaultProps$props.closeMode,
46
- wrapable = _defaultProps$props.wrapable,
47
- leftIcon = _defaultProps$props.leftIcon,
48
- color = _defaultProps$props.color,
49
- background = _defaultProps$props.background,
50
- delay = _defaultProps$props.delay,
51
- scrollable = _defaultProps$props.scrollable,
52
- speed = _defaultProps$props.speed,
53
- rightIcon = _defaultProps$props.rightIcon,
54
- close = _defaultProps$props.close,
55
- click = _defaultProps$props.click,
56
- iconClassPrefix = _defaultProps$props.iconClassPrefix,
57
- iconFontClassName = _defaultProps$props.iconFontClassName;
58
-
31
+ children = _defaultProps$props.children,
32
+ className = _defaultProps$props.className,
33
+ style = _defaultProps$props.style,
34
+ direction = _defaultProps$props.direction,
35
+ list = _defaultProps$props.list,
36
+ standTime = _defaultProps$props.standTime,
37
+ complexAm = _defaultProps$props.complexAm,
38
+ height = _defaultProps$props.height,
39
+ text = _defaultProps$props.text,
40
+ closeMode = _defaultProps$props.closeMode,
41
+ wrapable = _defaultProps$props.wrapable,
42
+ leftIcon = _defaultProps$props.leftIcon,
43
+ color = _defaultProps$props.color,
44
+ background = _defaultProps$props.background,
45
+ delay = _defaultProps$props.delay,
46
+ scrollable = _defaultProps$props.scrollable,
47
+ speed = _defaultProps$props.speed,
48
+ rightIcon = _defaultProps$props.rightIcon,
49
+ close = _defaultProps$props.close,
50
+ click = _defaultProps$props.click,
51
+ iconClassPrefix = _defaultProps$props.iconClassPrefix,
52
+ iconFontClassName = _defaultProps$props.iconFontClassName;
59
53
  var wrap = useRef(null);
60
54
  var content = useRef(null);
61
-
62
55
  var _useState = useState(true),
63
- _useState2 = _slicedToArray(_useState, 2),
64
- showNoticeBar = _useState2[0],
65
- SetShowNoticeBar = _useState2[1];
66
-
56
+ _useState2 = _slicedToArray(_useState, 2),
57
+ showNoticeBar = _useState2[0],
58
+ SetShowNoticeBar = _useState2[1];
67
59
  var scrollList = useRef([]);
68
-
69
60
  var _useState3 = useState(0),
70
- _useState4 = _slicedToArray(_useState3, 2),
71
- wrapWidth = _useState4[0],
72
- SetWrapWidth = _useState4[1];
73
-
61
+ _useState4 = _slicedToArray(_useState3, 2),
62
+ wrapWidth = _useState4[0],
63
+ SetWrapWidth = _useState4[1];
74
64
  var _useState5 = useState(true),
75
- _useState6 = _slicedToArray(_useState5, 2),
76
- firstRound = _useState6[0],
77
- SetFirstRound = _useState6[1];
78
-
65
+ _useState6 = _slicedToArray(_useState5, 2),
66
+ firstRound = _useState6[0],
67
+ SetFirstRound = _useState6[1];
79
68
  var _useState7 = useState(0),
80
- _useState8 = _slicedToArray(_useState7, 2),
81
- duration = _useState8[0],
82
- SetDuration = _useState8[1];
83
-
69
+ _useState8 = _slicedToArray(_useState7, 2),
70
+ duration = _useState8[0],
71
+ SetDuration = _useState8[1];
84
72
  var _useState9 = useState(0),
85
- _useState10 = _slicedToArray(_useState9, 2),
86
- offsetWidth = _useState10[0],
87
- SetOffsetW = _useState10[1];
88
-
73
+ _useState10 = _slicedToArray(_useState9, 2),
74
+ offsetWidth = _useState10[0],
75
+ SetOffsetW = _useState10[1];
89
76
  var _useState11 = useState(''),
90
- _useState12 = _slicedToArray(_useState11, 2),
91
- animationClass = _useState12[0],
92
- SetAnimationClass = _useState12[1];
93
-
77
+ _useState12 = _slicedToArray(_useState11, 2),
78
+ animationClass = _useState12[0],
79
+ SetAnimationClass = _useState12[1];
94
80
  var _useState13 = useState(false),
95
- _useState14 = _slicedToArray(_useState13, 2),
96
- animate = _useState14[0],
97
- SetAnimate = _useState14[1];
98
-
81
+ _useState14 = _slicedToArray(_useState13, 2),
82
+ animate = _useState14[0],
83
+ SetAnimate = _useState14[1];
99
84
  var _useState15 = useState(0),
100
- _useState16 = _slicedToArray(_useState15, 2),
101
- distance = _useState16[0],
102
- SetDistance = _useState16[1];
103
-
85
+ _useState16 = _slicedToArray(_useState15, 2),
86
+ distance = _useState16[0],
87
+ SetDistance = _useState16[1];
104
88
  var _useState17 = useState(0),
105
- _useState18 = _slicedToArray(_useState17, 2),
106
- timer = _useState18[0],
107
- SetTimer = _useState18[1];
108
-
89
+ _useState18 = _slicedToArray(_useState17, 2),
90
+ timer = _useState18[0],
91
+ SetTimer = _useState18[1];
109
92
  var _useState19 = useState(null),
110
- _useState20 = _slicedToArray(_useState19, 2),
111
- isCanScroll = _useState20[0],
112
- SetIsCanScroll = _useState20[1];
113
-
93
+ _useState20 = _slicedToArray(_useState19, 2),
94
+ isCanScroll = _useState20[0],
95
+ SetIsCanScroll = _useState20[1];
114
96
  useEffect(function () {
115
97
  if (direction === 'vertical') {
116
98
  if (children) {
@@ -122,14 +104,12 @@ var NoticeBar = function NoticeBar(props) {
122
104
  } else {
123
105
  scrollList.current = [].concat(list);
124
106
  }
125
-
126
107
  setTimeout(function () {
127
108
  complexAm ? startRoll() : startRollEasy();
128
109
  }, Number(standTime));
129
110
  } else {
130
111
  initScrollWrap();
131
112
  }
132
-
133
113
  return function () {
134
114
  // 销毁事件
135
115
  clearInterval(timer);
@@ -137,7 +117,6 @@ var NoticeBar = function NoticeBar(props) {
137
117
  startRollEasy();
138
118
  };
139
119
  }, []);
140
-
141
120
  var cloneChild = function cloneChild(listItem, listIndex) {
142
121
  return React__default.Children.map(children, function (child, index) {
143
122
  if (child && index === listIndex) {
@@ -146,11 +125,9 @@ var NoticeBar = function NoticeBar(props) {
146
125
  children: listItem
147
126
  });
148
127
  }
149
-
150
128
  return null;
151
129
  });
152
130
  };
153
-
154
131
  useEffect(function () {
155
132
  initScrollWrap();
156
133
  }, [text]);
@@ -159,22 +136,18 @@ var NoticeBar = function NoticeBar(props) {
159
136
  scrollList.current = [].concat(list);
160
137
  }
161
138
  }, [list]);
162
-
163
139
  var initScrollWrap = function initScrollWrap(value) {
164
140
  if (showNoticeBar === false) {
165
141
  return;
166
142
  }
167
-
168
143
  setTimeout(function () {
169
144
  if (!wrap.current || !content.current) {
170
145
  return;
171
146
  }
172
-
173
147
  var wrapW = getRect(wrap.current).width;
174
148
  var offsetW = getRect(content.current).width;
175
149
  var canScroll = scrollable == null ? offsetW > wrapW : scrollable;
176
150
  SetIsCanScroll(canScroll);
177
-
178
151
  if (canScroll) {
179
152
  SetWrapWidth(wrapW);
180
153
  SetOffsetW(offsetW);
@@ -185,17 +158,14 @@ var NoticeBar = function NoticeBar(props) {
185
158
  }
186
159
  }, 0);
187
160
  };
188
-
189
161
  var handleClick = function handleClick(event) {
190
162
  click && click(event);
191
163
  };
192
-
193
164
  var onClickIcon = function onClickIcon(event) {
194
165
  event.stopPropagation();
195
166
  SetShowNoticeBar(!closeMode);
196
167
  close && close(event);
197
168
  };
198
-
199
169
  var onAnimationEnd = function onAnimationEnd() {
200
170
  SetFirstRound(false);
201
171
  setTimeout(function () {
@@ -206,14 +176,11 @@ var NoticeBar = function NoticeBar(props) {
206
176
  /**
207
177
  * 滚动方式一
208
178
  */
209
-
210
-
211
179
  var startRollEasy = function startRollEasy() {
212
180
  showhorseLamp();
213
181
  var timerCurr = setInterval(showhorseLamp, ~~(height / speed / 4) * 1000 + Number(standTime));
214
182
  SetTimer(timerCurr);
215
183
  };
216
-
217
184
  var showhorseLamp = function showhorseLamp() {
218
185
  SetAnimate(true);
219
186
  setTimeout(function () {
@@ -222,25 +189,21 @@ var NoticeBar = function NoticeBar(props) {
222
189
  SetAnimate(false);
223
190
  }, ~~(height / speed / 4) * 1000);
224
191
  };
225
-
226
192
  var startRoll = function startRoll() {
227
193
  var timerCurr = setInterval(function () {
228
194
  var chunk = 100;
229
-
230
195
  for (var i = 0; i < chunk; i++) {
231
196
  scroll(i, !(i < chunk - 1));
232
197
  }
233
198
  }, Number(standTime) + 100 * speed);
234
199
  SetTimer(timerCurr);
235
200
  };
236
-
237
201
  var scroll = function scroll(n, last) {
238
202
  SetAnimate(true);
239
203
  setTimeout(function () {
240
204
  var _long = distance;
241
205
  _long -= height / 100;
242
206
  SetDistance(_long);
243
-
244
207
  if (last) {
245
208
  scrollList.current.push(scrollList.current[0]);
246
209
  scrollList.current.shift();
@@ -252,42 +215,31 @@ var NoticeBar = function NoticeBar(props) {
252
215
  /**
253
216
  * 点击滚动单元
254
217
  */
255
-
256
-
257
218
  var go = function go(item) {
258
219
  click && click(item);
259
220
  };
260
-
261
221
  var handleClickIcon = function handleClickIcon() {
262
222
  close && close(scrollList[0]);
263
223
  };
264
-
265
224
  var iconShow = function iconShow() {
266
225
  if (leftIcon === 'close') {
267
226
  return false;
268
227
  }
269
-
270
228
  return true;
271
229
  };
272
-
273
230
  var iconBg = function iconBg() {
274
231
  var iconBg = '';
275
-
276
232
  if (leftIcon) {
277
233
  iconBg = leftIcon;
278
234
  }
279
-
280
235
  return iconBg;
281
236
  };
282
-
283
237
  var isEllipsis = function isEllipsis() {
284
238
  if (isCanScroll == null) {
285
239
  return wrapable;
286
240
  }
287
-
288
241
  return !isCanScroll && !wrapable;
289
242
  };
290
-
291
243
  var contentStyle = {
292
244
  animationDelay: "".concat(firstRound ? delay : 0, "s"),
293
245
  animationDuration: "".concat(duration, "s"),
@@ -357,7 +309,8 @@ var NoticeBar = function NoticeBar(props) {
357
309
  className: "horseLamp_list",
358
310
  style: horseLampStyle
359
311
  }, scrollList.current.map(function (item, index) {
360
- return (// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
312
+ return (
313
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
361
314
  React__default.createElement("li", {
362
315
  className: "horseLamp_list_item",
363
316
  style: {
@@ -382,7 +335,6 @@ var NoticeBar = function NoticeBar(props) {
382
335
  size: "11px"
383
336
  }) : null))) : null);
384
337
  };
385
-
386
338
  NoticeBar.defaultProps = defaultProps;
387
339
  NoticeBar.displayName = 'NutNoticeBar';
388
340
  export { NoticeBar as default };
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  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; }
10
-
11
9
  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; }
12
-
13
10
  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); }; }
14
-
15
11
  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; } }
16
-
17
12
  import * as React from 'react';
18
13
  import * as ReactDOM from 'react-dom';
19
14
  import classNames from 'classnames';
@@ -21,21 +16,14 @@ import { CSSTransition } from 'react-transition-group';
21
16
  import { c as cn } from './bem-893ad28d.js';
22
17
  import { r as render } from './render-18227751.js';
23
18
  import '@bem-react/classname';
24
-
25
19
  var Notification = /*#__PURE__*/function (_React$PureComponent) {
26
20
  _inherits(Notification, _React$PureComponent);
27
-
28
21
  var _super = _createSuper(Notification);
29
-
30
22
  function Notification(props) {
31
23
  var _this;
32
-
33
24
  _classCallCheck(this, Notification);
34
-
35
25
  _this = _super.call(this, props);
36
-
37
26
  _defineProperty(_assertThisInitialized(_this), "closeTimer", void 0);
38
-
39
27
  _this.close = _this.close.bind(_assertThisInitialized(_this));
40
28
  _this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
41
29
  _this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
@@ -45,7 +33,6 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
45
33
  };
46
34
  return _this;
47
35
  }
48
-
49
36
  _createClass(Notification, [{
50
37
  key: "close",
51
38
  value: function close() {
@@ -53,21 +40,17 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
53
40
  show: false
54
41
  });
55
42
  this.clearCloseTimer();
56
-
57
43
  if (this.props.id) {
58
44
  var element = document.getElementById(this.props.id);
59
45
  element && element.parentNode && element.parentNode.removeChild(element);
60
46
  }
61
-
62
47
  this.props.onClosed();
63
48
  }
64
49
  }, {
65
50
  key: "startCloseTimer",
66
51
  value: function startCloseTimer() {
67
52
  var _this2 = this;
68
-
69
53
  var duration = this.props.duration;
70
-
71
54
  if (duration) {
72
55
  this.closeTimer = window.setTimeout(function () {
73
56
  _this2.close();
@@ -101,15 +84,15 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
101
84
  key: "render",
102
85
  value: function render() {
103
86
  var _this$props = this.props,
104
- children = _this$props.children,
105
- style = _this$props.style,
106
- msg = _this$props.msg,
107
- color = _this$props.color,
108
- background = _this$props.background,
109
- type = _this$props.type,
110
- className = _this$props.className,
111
- position = _this$props.position,
112
- isWrapTeleport = _this$props.isWrapTeleport;
87
+ children = _this$props.children,
88
+ style = _this$props.style,
89
+ msg = _this$props.msg,
90
+ color = _this$props.color,
91
+ background = _this$props.background,
92
+ type = _this$props.type,
93
+ className = _this$props.className,
94
+ position = _this$props.position,
95
+ isWrapTeleport = _this$props.isWrapTeleport;
113
96
  this.state;
114
97
  cn('notify');
115
98
  var classes = classNames(_defineProperty({
@@ -135,12 +118,9 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
135
118
  }, children || msg)));
136
119
  }
137
120
  }]);
138
-
139
121
  return Notification;
140
122
  }(React.PureComponent);
141
-
142
123
  _defineProperty(Notification, "newInstance", void 0);
143
-
144
124
  Notification.newInstance = function (properties, callback) {
145
125
  var element = document.createElement('div');
146
126
  var id = properties.id ? properties.id : "".concat(new Date().getTime());
@@ -148,12 +128,10 @@ Notification.newInstance = function (properties, callback) {
148
128
  properties.id = id;
149
129
  document.body.appendChild(element);
150
130
  var called = false;
151
-
152
131
  function ref(instance) {
153
132
  if (called) {
154
133
  return;
155
134
  }
156
-
157
135
  called = true;
158
136
  callback({
159
137
  component: instance,
@@ -165,12 +143,10 @@ Notification.newInstance = function (properties, callback) {
165
143
  }
166
144
  });
167
145
  }
168
-
169
146
  render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
170
147
  ref: ref
171
148
  })), element);
172
149
  };
173
-
174
150
  var messageInstance = null;
175
151
  var options = {
176
152
  msg: '',
@@ -184,18 +160,15 @@ var options = {
184
160
  onClosed: function onClosed() {},
185
161
  onClick: function onClick() {}
186
162
  };
187
-
188
163
  function getInstance(props, callback) {
189
164
  if (messageInstance) {
190
165
  messageInstance.destroy();
191
166
  messageInstance = null;
192
167
  }
193
-
194
168
  Notification.newInstance(props, function (notification) {
195
169
  return callback && callback(notification);
196
170
  });
197
171
  }
198
-
199
172
  function notice(opts) {
200
173
  // function close() {
201
174
  // if (messageInstance) {
@@ -208,13 +181,11 @@ function notice(opts) {
208
181
  messageInstance = notification;
209
182
  });
210
183
  }
211
-
212
184
  var errorMsg = function errorMsg(msg) {
213
185
  if (!msg) {
214
186
  console.warn('[NutUI Notify]: msg不能为空');
215
187
  }
216
188
  };
217
-
218
189
  var Notify = {
219
190
  text: function text(msg) {
220
191
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -1,11 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
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, { useState, useEffect } from 'react';
10
7
  import classNames from 'classnames';
11
8
  import { c as cn } from './bem-893ad28d.js';
@@ -23,53 +20,44 @@ var defaultProps = {
23
20
  popClass: '',
24
21
  onClose: function onClose() {}
25
22
  };
26
-
27
23
  var NumberKeyboard = function NumberKeyboard(props) {
28
24
  var _useConfig = useConfig(),
29
- locale = _useConfig.locale;
30
-
25
+ locale = _useConfig.locale;
31
26
  var title = props.title,
32
- confirmText = props.confirmText,
33
- visible = props.visible,
34
- type = props.type,
35
- customKey = props.customKey,
36
- randomKeys = props.randomKeys,
37
- popClass = props.popClass,
38
- style = props.style,
39
- className = props.className,
40
- onChange = props.onChange,
41
- onDelete = props.onDelete,
42
- onClose = props.onClose;
27
+ confirmText = props.confirmText,
28
+ visible = props.visible,
29
+ type = props.type,
30
+ customKey = props.customKey,
31
+ randomKeys = props.randomKeys,
32
+ popClass = props.popClass,
33
+ style = props.style,
34
+ className = props.className,
35
+ onChange = props.onChange,
36
+ onDelete = props.onDelete,
37
+ onClose = props.onClose;
43
38
  var b = cn('numberkeyboard');
44
-
45
39
  var _useState = useState(visible),
46
- _useState2 = _slicedToArray(_useState, 2),
47
- show = _useState2[0],
48
- setShow = _useState2[1];
49
-
40
+ _useState2 = _slicedToArray(_useState, 2),
41
+ show = _useState2[0],
42
+ setShow = _useState2[1];
50
43
  var _useState3 = useState(undefined),
51
- _useState4 = _slicedToArray(_useState3, 2),
52
- clickKeyIndex = _useState4[0],
53
- setClickKeyIndex = _useState4[1];
54
-
44
+ _useState4 = _slicedToArray(_useState3, 2),
45
+ clickKeyIndex = _useState4[0],
46
+ setClickKeyIndex = _useState4[1];
55
47
  var _useState5 = useState([]),
56
- _useState6 = _slicedToArray(_useState5, 2),
57
- keysList = _useState6[0],
58
- setKeysList = _useState6[1];
59
-
48
+ _useState6 = _slicedToArray(_useState5, 2),
49
+ keysList = _useState6[0],
50
+ setKeysList = _useState6[1];
60
51
  useEffect(function () {
61
52
  setShow(visible);
62
53
  }, [visible]);
63
-
64
54
  var defaultKey = function defaultKey() {
65
55
  var leftBottomKey = {
66
56
  id: 'lock',
67
57
  type: 'lock'
68
58
  };
69
-
70
59
  if (customKey) {
71
60
  var customKeys = Array.isArray(customKey) ? customKey : [customKey];
72
-
73
61
  if (customKeys.length > 0) {
74
62
  var newCustomKey = customKeys[0];
75
63
  leftBottomKey = {
@@ -78,7 +66,6 @@ var NumberKeyboard = function NumberKeyboard(props) {
78
66
  };
79
67
  }
80
68
  }
81
-
82
69
  return [].concat(_toConsumableArray(getBasicKeys()), [leftBottomKey, {
83
70
  id: 0,
84
71
  type: 'number'
@@ -87,39 +74,31 @@ var NumberKeyboard = function NumberKeyboard(props) {
87
74
  type: 'delete'
88
75
  }]);
89
76
  };
90
-
91
77
  var getBasicKeys = function getBasicKeys() {
92
78
  var keys = [];
93
-
94
79
  for (var i = 1; i <= 9; i++) {
95
80
  keys.push({
96
81
  id: i,
97
82
  type: 'number'
98
83
  });
99
84
  }
100
-
101
85
  if (randomKeys) {
102
86
  return keys.sort(function () {
103
87
  return Math.random() > 0.5 ? 1 : -1;
104
88
  });
105
89
  }
106
-
107
90
  return keys;
108
91
  };
109
-
110
92
  var genCustomKeys = function genCustomKeys() {
111
93
  var keys = getBasicKeys();
112
94
  if (!customKey) return [];
113
95
  var customKeys = Array.isArray(customKey) ? customKey : [customKey];
114
-
115
96
  if (customKeys.length > 2) {
116
97
  customKeys = [customKeys[0], customKeys[1]];
117
98
  }
118
-
119
99
  if (customKeys.length === 2 && props.title && props.type !== 'rightColumn') {
120
100
  customKeys = [customKeys[0]];
121
101
  }
122
-
123
102
  if (customKeys.length === 1) {
124
103
  if (props.title && props.type !== 'rightColumn') {
125
104
  keys.push({
@@ -153,10 +132,8 @@ var NumberKeyboard = function NumberKeyboard(props) {
153
132
  type: 'custom'
154
133
  });
155
134
  }
156
-
157
135
  return keys;
158
136
  };
159
-
160
137
  useEffect(function () {
161
138
  if (props.type === 'rightColumn' || props.title !== '') {
162
139
  setKeysList(genCustomKeys());
@@ -164,33 +141,26 @@ var NumberKeyboard = function NumberKeyboard(props) {
164
141
  setKeysList(defaultKey());
165
142
  }
166
143
  }, []);
167
-
168
144
  var onTouchstart = function onTouchstart(item, event) {
169
145
  event.stopPropagation();
170
146
  setClickKeyIndex(item.id);
171
-
172
147
  if (item.type === 'number' || item.type === 'custom') {
173
148
  onChange && onChange(item.id);
174
149
  }
175
-
176
150
  if (item.type === 'lock') {
177
151
  onClose && onClose();
178
152
  }
179
-
180
153
  if (item.type === 'delete') {
181
154
  onDelete && onDelete();
182
155
  }
183
156
  };
184
-
185
157
  var onTouchMove = function onTouchMove(event) {
186
158
  event.stopPropagation();
187
159
  };
188
-
189
160
  var onTouchEnd = function onTouchEnd(event) {
190
161
  event.preventDefault();
191
162
  setClickKeyIndex(undefined);
192
163
  };
193
-
194
164
  return React__default.createElement("div", null, React__default.createElement(Popup, {
195
165
  visible: show,
196
166
  position: "bottom",
@@ -271,7 +241,6 @@ var NumberKeyboard = function NumberKeyboard(props) {
271
241
  })
272
242
  }, confirmText || locale.done))) : null))));
273
243
  };
274
-
275
244
  NumberKeyboard.defaultProps = defaultProps;
276
245
  NumberKeyboard.displayName = 'NutNumberKeyboard';
277
246
  export { NumberKeyboard as default };