@nutui/nutui-react 1.5.1 → 2.0.0-alpha.1

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 (240) hide show
  1. package/CHANGELOG.md +24 -664
  2. package/dist/esm/ActionSheet.js +62 -54
  3. package/dist/esm/Address/style/index.js +0 -1
  4. package/dist/esm/Address.js +235 -330
  5. package/dist/esm/Animate.js +43 -32
  6. package/dist/esm/AnimatingNumbers.js +88 -49
  7. package/dist/esm/Audio/style/index.js +0 -1
  8. package/dist/esm/Audio.js +108 -121
  9. package/dist/esm/Avatar.js +65 -78
  10. package/dist/esm/AvatarContext.js +5 -0
  11. package/dist/esm/AvatarGroup.js +46 -27
  12. package/dist/esm/BackTop/style/index.js +1 -1
  13. package/dist/esm/BackTop.js +74 -76
  14. package/dist/esm/Badge.js +57 -54
  15. package/dist/esm/Barrage.js +45 -32
  16. package/dist/esm/Button/style/index.js +1 -1
  17. package/dist/esm/Button.js +66 -87
  18. package/dist/esm/Calendar.js +80 -79
  19. package/dist/esm/CalendarItem.js +199 -231
  20. package/dist/esm/Card.js +44 -37
  21. package/dist/esm/Cascader.js +431 -434
  22. package/dist/esm/Cell/style/index.js +1 -1
  23. package/dist/esm/Cell.js +57 -87
  24. package/dist/esm/CellGroup.js +7 -5
  25. package/dist/esm/Checkbox/style/index.js +0 -1
  26. package/dist/esm/Checkbox.js +11 -8
  27. package/dist/esm/CheckboxGroup.js +78 -71
  28. package/dist/esm/CircleProgress.js +50 -40
  29. package/dist/esm/Col.js +49 -43
  30. package/dist/esm/Collapse.js +44 -44
  31. package/dist/esm/CollapseItem/style/index.js +1 -1
  32. package/dist/esm/CollapseItem.js +64 -104
  33. package/dist/esm/ConfigProvider.js +400 -101
  34. package/dist/esm/CountDown.js +90 -95
  35. package/dist/esm/DatePicker.js +104 -123
  36. package/dist/esm/Dialog.js +98 -104
  37. package/dist/esm/Divider.js +36 -27
  38. package/dist/esm/Drag.js +55 -59
  39. package/dist/esm/Elevator.js +77 -88
  40. package/dist/esm/Ellipsis.js +80 -79
  41. package/dist/esm/Empty.js +50 -44
  42. package/dist/esm/FixedNav/style/index.js +0 -1
  43. package/dist/esm/FixedNav.js +57 -65
  44. package/dist/esm/Form.js +1154 -123
  45. package/dist/esm/FormItem.js +7 -5
  46. package/dist/esm/Grid/style/index.js +1 -1
  47. package/dist/esm/Grid.js +51 -55
  48. package/dist/esm/GridItem.js +7 -124
  49. package/dist/esm/Icon.js +83 -5
  50. package/dist/esm/Image.js +123 -122
  51. package/dist/esm/ImagePreview.js +76 -94
  52. package/dist/esm/Indicator.js +41 -36
  53. package/dist/esm/Infiniteloading/style/index.js +1 -1
  54. package/dist/esm/Infiniteloading.js +77 -93
  55. package/dist/esm/Input/style/index.js +1 -1
  56. package/dist/esm/Input.js +120 -172
  57. package/dist/esm/InputNumber/style/index.js +1 -1
  58. package/dist/esm/InputNumber.js +133 -167
  59. package/dist/esm/Layout.js +27 -6
  60. package/dist/esm/Menu.js +84 -86
  61. package/dist/esm/MenuItem/style/index.js +0 -1
  62. package/dist/esm/MenuItem.js +76 -86
  63. package/dist/esm/NavBar/style/index.js +1 -1
  64. package/dist/esm/NavBar.js +59 -63
  65. package/dist/esm/NoticeBar/style/index.js +1 -1
  66. package/dist/esm/NoticeBar.js +173 -290
  67. package/dist/esm/Notify.js +112 -78
  68. package/dist/esm/NumberKeyboard.js +110 -109
  69. package/dist/esm/Overlay.js +7 -6
  70. package/dist/esm/Pagination.js +94 -135
  71. package/dist/esm/Picker.js +149 -201
  72. package/dist/esm/Popover/style/index.js +0 -1
  73. package/dist/esm/Popover.js +121 -116
  74. package/dist/esm/Popup/style/index.js +0 -1
  75. package/dist/esm/Popup.js +114 -131
  76. package/dist/esm/Price.js +51 -39
  77. package/dist/esm/Progress/style/index.js +1 -1
  78. package/dist/esm/Progress.js +59 -64
  79. package/dist/esm/PullToRefresh.js +173 -149
  80. package/dist/esm/Radio/style/index.js +0 -1
  81. package/dist/esm/Radio.js +8 -6
  82. package/dist/esm/RadioGroup.js +64 -84
  83. package/dist/esm/Range.js +93 -122
  84. package/dist/esm/Rate/style/index.js +1 -1
  85. package/dist/esm/Rate.js +77 -95
  86. package/dist/esm/Row.js +49 -37
  87. package/dist/esm/SearchBar/style/index.js +1 -1
  88. package/dist/esm/SearchBar.js +110 -120
  89. package/dist/esm/ShortPassword/style/index.js +0 -1
  90. package/dist/esm/ShortPassword.js +120 -116
  91. package/dist/esm/SideNavBar.js +38 -28
  92. package/dist/esm/SideNavBarItem.js +31 -14
  93. package/dist/esm/Signature.js +65 -61
  94. package/dist/esm/Skeleton.js +48 -40
  95. package/dist/esm/Step/style/index.js +1 -1
  96. package/dist/esm/Step.js +49 -49
  97. package/dist/esm/Steps.js +37 -23
  98. package/dist/esm/Sticky.js +111 -120
  99. package/dist/esm/SubSideNavBar.js +50 -38
  100. package/dist/esm/Swipe.js +75 -63
  101. package/dist/esm/Swiper.js +171 -206
  102. package/dist/esm/SwiperItem.js +39 -22
  103. package/dist/esm/Switch.js +46 -37
  104. package/dist/esm/TabPane.js +8 -6
  105. package/dist/esm/Tabbar.js +47 -39
  106. package/dist/esm/TabbarItem/style/index.js +1 -1
  107. package/dist/esm/TabbarItem.js +50 -52
  108. package/dist/esm/Table/style/index.js +1 -1
  109. package/dist/esm/Table.js +70 -70
  110. package/dist/esm/Tabs/style/index.js +1 -2
  111. package/dist/esm/Tabs.js +11 -9
  112. package/dist/esm/Tag/style/index.js +1 -1
  113. package/dist/esm/Tag.js +69 -70
  114. package/dist/esm/TextArea.js +70 -64
  115. package/dist/esm/TimeDetail.js +47 -38
  116. package/dist/esm/TimePannel.js +35 -19
  117. package/dist/esm/TimeSelect.js +60 -68
  118. package/dist/esm/Toast/style/index.js +1 -1
  119. package/dist/esm/Toast.js +126 -98
  120. package/dist/esm/TrendArrow/style/index.js +1 -1
  121. package/dist/esm/TrendArrow.js +59 -55
  122. package/dist/esm/Uploader/style/index.js +0 -1
  123. package/dist/esm/Uploader.js +195 -246
  124. package/dist/esm/UserContext.js +5 -0
  125. package/dist/esm/UserContext2.js +5 -0
  126. package/dist/esm/UserContext3.js +5 -0
  127. package/dist/esm/Video.js +49 -39
  128. package/dist/esm/VirtualList.js +111 -146
  129. package/dist/esm/WaterMark.js +57 -60
  130. package/dist/esm/bem.js +10 -0
  131. package/dist/esm/cellgroup2.js +49 -0
  132. package/dist/esm/checkbox2.js +145 -0
  133. package/dist/esm/{date-c7aad4c0.js → date.js} +13 -11
  134. package/dist/esm/{formitem-8a73a5fb.js → formitem2.js} +83 -50
  135. package/dist/esm/get-scroll-parent.js +26 -0
  136. package/dist/esm/griditem2.js +96 -0
  137. package/dist/esm/index.js +14 -0
  138. package/dist/esm/nutui-react.es.js +188 -94
  139. package/dist/esm/offsetContext.js +19 -0
  140. package/dist/esm/overlay2.js +98 -0
  141. package/dist/esm/px-check.js +6 -0
  142. package/dist/esm/radio2.js +129 -0
  143. package/dist/esm/render.js +95 -0
  144. package/dist/esm/tabpane2.js +44 -0
  145. package/dist/esm/tabs2.js +175 -0
  146. package/dist/esm/typings.js +7 -0
  147. package/dist/esm/use-client-rect.js +32 -0
  148. package/dist/esm/use-props-value.js +18 -0
  149. package/dist/esm/use-touch.js +74 -0
  150. package/dist/locales/base.d.ts +2 -2
  151. package/dist/locales/base.js +1 -1
  152. package/dist/locales/en-US.js +3 -3
  153. package/dist/locales/id-ID.js +3 -3
  154. package/dist/locales/zh-CN.js +3 -3
  155. package/dist/locales/zh-TW.js +3 -3
  156. package/dist/locales/zh-UG.js +3 -3
  157. package/dist/nutui.react.mjs +8389 -4901
  158. package/dist/nutui.react.umd.js +8390 -4902
  159. package/dist/packages/actionsheet/actionsheet.scss +10 -2
  160. package/dist/packages/audio/audio.scss +2 -15
  161. package/dist/packages/backtop/backtop.scss +0 -8
  162. package/dist/packages/badge/badge.scss +3 -4
  163. package/dist/packages/button/button.scss +80 -93
  164. package/dist/packages/calendar/calendar.scss +0 -30
  165. package/dist/packages/cell/cell.scss +18 -90
  166. package/dist/packages/cellgroup/cellgroup.scss +26 -20
  167. package/dist/packages/collapseitem/collapseitem.scss +0 -1
  168. package/dist/packages/dialog/dialog.scss +1 -1
  169. package/dist/packages/divider/divider.scss +3 -17
  170. package/dist/packages/grid/grid.scss +1 -0
  171. package/dist/packages/griditem/griditem.scss +2 -17
  172. package/dist/packages/icon/icon.scss +0 -132
  173. package/dist/packages/image/image.scss +0 -12
  174. package/dist/packages/indicator/indicator.scss +21 -39
  175. package/dist/packages/infiniteloading/infiniteloading.scss +4 -12
  176. package/dist/packages/input/input.scss +4 -0
  177. package/dist/packages/inputnumber/inputnumber.scss +10 -26
  178. package/dist/packages/menuitem/menuitem.scss +2 -0
  179. package/dist/packages/navbar/navbar.scss +4 -5
  180. package/dist/packages/overlay/overlay.scss +0 -19
  181. package/dist/packages/picker/picker.scss +97 -103
  182. package/dist/packages/popup/popup.scss +0 -16
  183. package/dist/packages/progress/progress.scss +0 -1
  184. package/dist/packages/radio/radio.scss +8 -0
  185. package/dist/packages/rate/rate.scss +29 -6
  186. package/dist/packages/row/row.scss +13 -31
  187. package/dist/packages/searchbar/searchbar.scss +0 -1
  188. package/dist/packages/shortpassword/shortpassword.scss +4 -1
  189. package/dist/packages/sidenavbar/sidenavbar.scss +0 -19
  190. package/dist/packages/step/step.scss +0 -1
  191. package/dist/packages/sticky/sticky.scss +1 -1
  192. package/dist/packages/swiper/swiper.scss +8 -0
  193. package/dist/packages/tabbaritem/tabbaritem.scss +0 -1
  194. package/dist/packages/table/table.scss +0 -1
  195. package/dist/packages/tag/tag.scss +9 -2
  196. package/dist/packages/timedetail/timedetail.scss +9 -3
  197. package/dist/packages/timeselect/timeselect.scss +1 -1
  198. package/dist/packages/toast/toast.scss +0 -1
  199. package/dist/packages/uploader/uploader.scss +2 -28
  200. package/dist/style.css +1 -1
  201. package/dist/style.mjs +1 -1
  202. package/dist/styles/font-jmapp/config.json +175 -0
  203. package/dist/styles/font-jmapp/demo.css +539 -0
  204. package/dist/styles/font-jmapp/demo_index.html +1821 -0
  205. package/dist/styles/font-jmapp/iconfont.css +299 -0
  206. package/dist/styles/font-jmapp/iconfont.eot +0 -0
  207. package/dist/styles/font-jmapp/iconfont.js +68 -0
  208. package/dist/styles/font-jmapp/iconfont.json +506 -0
  209. package/dist/styles/font-jmapp/iconfont.svg +356 -0
  210. package/dist/styles/font-jmapp/iconfont.ttf +0 -0
  211. package/dist/styles/font-jmapp/iconfont.woff +0 -0
  212. package/dist/styles/font-jmapp/iconfont.woff2 +0 -0
  213. package/dist/styles/theme-default.scss +1 -0
  214. package/dist/styles/theme-jmapp.scss +41 -0
  215. package/dist/styles/themes/default.scss +0 -1
  216. package/dist/styles/variables-jmapp.scss +2601 -0
  217. package/dist/styles/variables.scss +49 -73
  218. package/dist/types/index.d.ts +169 -266
  219. package/package.json +23 -154
  220. package/dist/esm/AvatarContext-15733596.js +0 -3
  221. package/dist/esm/Icon/style/index.js +0 -4
  222. package/dist/esm/UserContext-101ad4a4.js +0 -3
  223. package/dist/esm/UserContext-2629d479.js +0 -3
  224. package/dist/esm/UserContext-b33bcf21.js +0 -3
  225. package/dist/esm/bem-3b438e61.js +0 -8
  226. package/dist/esm/cellgroup-fcc72767.js +0 -34
  227. package/dist/esm/checkbox-44e13cd0.js +0 -137
  228. package/dist/esm/get-scroll-parent-5f85dee8.js +0 -24
  229. package/dist/esm/grid.context-2ee27d95.js +0 -6
  230. package/dist/esm/icon-4ef1581c.js +0 -70
  231. package/dist/esm/index-030b7245.js +0 -11
  232. package/dist/esm/offsetContext-3ab00d40.js +0 -16
  233. package/dist/esm/overlay-de6c79d5.js +0 -83
  234. package/dist/esm/radio-9f141e6b.js +0 -118
  235. package/dist/esm/render-bbebb760.js +0 -79
  236. package/dist/esm/tabpane-01075e6c.js +0 -29
  237. package/dist/esm/tabs-e1b4e4b1.js +0 -181
  238. package/dist/esm/typings-f27b58f4.js +0 -8
  239. package/dist/esm/useClientRect-56bb675b.js +0 -39
  240. package/dist/esm/useTouch-cf73a407.js +0 -99
@@ -5,23 +5,68 @@ 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
- 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; }
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; }
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); }; }
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; } }
12
- import * as React from 'react';
13
- import * as ReactDOM from 'react-dom';
14
- import classNames from 'classnames';
15
- import { CSSTransition } from 'react-transition-group';
16
- import { c as cn } from './bem-3b438e61.js';
17
- import { r as render } from './render-bbebb760.js';
18
- import '@bem-react/classname';
19
- var Notification = /*#__PURE__*/function (_React$PureComponent) {
20
- _inherits(Notification, _React$PureComponent);
21
- var _super = _createSuper(Notification);
22
- function Notification(props) {
8
+ function ownKeys(object, enumerableOnly) {
9
+ var keys = Object.keys(object);
10
+ if (Object.getOwnPropertySymbols) {
11
+ var symbols = Object.getOwnPropertySymbols(object);
12
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
13
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
+ })), keys.push.apply(keys, symbols);
15
+ }
16
+ return keys;
17
+ }
18
+ function _objectSpread(target) {
19
+ for (var i = 1; i < arguments.length; i++) {
20
+ var source = null != arguments[i] ? arguments[i] : {};
21
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
22
+ _defineProperty(target, key, source[key]);
23
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
24
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ function _createSuper(Derived) {
30
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
31
+ return function _createSuperInternal() {
32
+ var Super = _getPrototypeOf(Derived), result;
33
+ if (hasNativeReflectConstruct) {
34
+ var NewTarget = _getPrototypeOf(this).constructor;
35
+ result = Reflect.construct(Super, arguments, NewTarget);
36
+ } else {
37
+ result = Super.apply(this, arguments);
38
+ }
39
+ return _possibleConstructorReturn(this, result);
40
+ };
41
+ }
42
+ function _isNativeReflectConstruct() {
43
+ if (typeof Reflect === "undefined" || !Reflect.construct)
44
+ return false;
45
+ if (Reflect.construct.sham)
46
+ return false;
47
+ if (typeof Proxy === "function")
48
+ return true;
49
+ try {
50
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
51
+ }));
52
+ return true;
53
+ } catch (e) {
54
+ return false;
55
+ }
56
+ }
57
+ import * as React from "react";
58
+ import * as ReactDOM from "react-dom";
59
+ import classNames from "classnames";
60
+ import { CSSTransition } from "react-transition-group";
61
+ import { c as cn } from "./bem.js";
62
+ import { r as render } from "./render.js";
63
+ import "@bem-react/classname";
64
+ var Notification = /* @__PURE__ */ function(_React$PureComponent) {
65
+ _inherits(Notification2, _React$PureComponent);
66
+ var _super = _createSuper(Notification2);
67
+ function Notification2(props) {
23
68
  var _this;
24
- _classCallCheck(this, Notification);
69
+ _classCallCheck(this, Notification2);
25
70
  _this = _super.call(this, props);
26
71
  _defineProperty(_assertThisInitialized(_this), "closeTimer", void 0);
27
72
  _this.close = _this.close.bind(_assertThisInitialized(_this));
@@ -33,7 +78,7 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
33
78
  };
34
79
  return _this;
35
80
  }
36
- _createClass(Notification, [{
81
+ _createClass(Notification2, [{
37
82
  key: "close",
38
83
  value: function close() {
39
84
  this.setState({
@@ -52,7 +97,7 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
52
97
  var _this2 = this;
53
98
  var duration = this.props.duration;
54
99
  if (duration) {
55
- this.closeTimer = window.setTimeout(function () {
100
+ this.closeTimer = window.setTimeout(function() {
56
101
  _this2.close();
57
102
  }, duration);
58
103
  }
@@ -82,23 +127,14 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
82
127
  }
83
128
  }, {
84
129
  key: "render",
85
- value: function render() {
86
- var _this$props = this.props,
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;
130
+ value: function render2() {
131
+ var _this$props = this.props, children = _this$props.children, style = _this$props.style, msg = _this$props.msg, color = _this$props.color, background = _this$props.background, type = _this$props.type, className = _this$props.className, position = _this$props.position, isWrapTeleport = _this$props.isWrapTeleport;
96
132
  this.state;
97
- cn('notify');
133
+ cn("notify");
98
134
  var classes = classNames(_defineProperty({
99
- 'nut-notify--popup-top': position === 'top',
100
- 'nut-notify--popup-bottom': position === 'bottom',
101
- 'nut-notify': true
135
+ "nut-notify--popup-top": position === "top",
136
+ "nut-notify--popup-bottom": position === "bottom",
137
+ "nut-notify": true
102
138
  }, "nut-notify--".concat(type), true));
103
139
  return React.createElement(React.Fragment, null, React.createElement(CSSTransition, {
104
140
  "in": this.state.show,
@@ -106,24 +142,24 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
106
142
  classNames: "fade",
107
143
  unmountOnExit: true,
108
144
  appear: true,
109
- position: position,
110
- isWrapTeleport: isWrapTeleport
145
+ position,
146
+ isWrapTeleport
111
147
  }, React.createElement("div", {
112
148
  className: "".concat(classes, " ").concat(className),
113
149
  style: {
114
- color: "".concat(color || ''),
115
- background: "".concat(background || '')
150
+ color: "".concat(color || ""),
151
+ background: "".concat(background || "")
116
152
  },
117
153
  onClick: this.clickCover
118
154
  }, children || msg)));
119
155
  }
120
156
  }]);
121
- return Notification;
157
+ return Notification2;
122
158
  }(React.PureComponent);
123
159
  _defineProperty(Notification, "newInstance", void 0);
124
- Notification.newInstance = function (properties, callback) {
125
- var element = document.createElement('div');
126
- var id = properties.id ? properties.id : "".concat(new Date().getTime());
160
+ Notification.newInstance = function(properties, callback) {
161
+ var element = document.createElement("div");
162
+ var id = properties.id ? properties.id : "".concat((/* @__PURE__ */ new Date()).getTime());
127
163
  element.id = id;
128
164
  properties.id = id;
129
165
  document.body.appendChild(element);
@@ -136,7 +172,7 @@ Notification.newInstance = function (properties, callback) {
136
172
  callback({
137
173
  component: instance,
138
174
  destroy: function destroy() {
139
- setTimeout(function () {
175
+ setTimeout(function() {
140
176
  ReactDOM.unmountComponentAtNode(element);
141
177
  element && element.parentNode && element.parentNode.removeChild(element);
142
178
  }, 300);
@@ -144,86 +180,82 @@ Notification.newInstance = function (properties, callback) {
144
180
  });
145
181
  }
146
182
  render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
147
- ref: ref
183
+ ref
148
184
  })), element);
149
185
  };
150
186
  var messageInstance = null;
151
187
  var options = {
152
- msg: '',
153
- id: '',
154
- duration: 3000,
155
- color: '',
156
- type: 'danger',
157
- className: '',
158
- position: 'top',
159
- onClosed: function onClosed() {},
160
- onClick: function onClick() {}
188
+ msg: "",
189
+ id: "",
190
+ duration: 3e3,
191
+ color: "",
192
+ type: "danger",
193
+ className: "",
194
+ position: "top",
195
+ onClosed: function onClosed() {
196
+ },
197
+ onClick: function onClick() {
198
+ }
161
199
  };
162
200
  function getInstance(props, callback) {
163
201
  if (messageInstance) {
164
202
  messageInstance.destroy();
165
203
  messageInstance = null;
166
204
  }
167
- Notification.newInstance(props, function (notification) {
205
+ Notification.newInstance(props, function(notification) {
168
206
  return callback && callback(notification);
169
207
  });
170
208
  }
171
209
  function notice(opts) {
172
- // function close() {
173
- // if (messageInstance) {
174
- // messageInstance.destroy()
175
- // messageInstance = null
176
- // }
177
- // }
178
210
  opts = _objectSpread(_objectSpread({}, options), opts);
179
- getInstance(opts, function (notification) {
211
+ getInstance(opts, function(notification) {
180
212
  messageInstance = notification;
181
213
  });
182
214
  }
183
- var errorMsg = function errorMsg(msg) {
215
+ var errorMsg = function errorMsg2(msg) {
184
216
  if (!msg) {
185
- console.warn('[NutUI Notify]: msg不能为空');
217
+ console.warn("[NutUI Notify]: msg不能为空");
186
218
  }
187
219
  };
188
220
  var Notify = {
189
221
  text: function text(msg) {
190
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
222
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
191
223
  errorMsg(msg);
192
224
  return notice(_objectSpread({
193
- msg: msg,
194
- type: 'base'
225
+ msg,
226
+ type: "base"
195
227
  }, option));
196
228
  },
197
229
  success: function success(msg) {
198
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
230
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
199
231
  errorMsg(msg);
200
232
  return notice(_objectSpread({
201
- msg: msg,
202
- type: 'success'
233
+ msg,
234
+ type: "success"
203
235
  }, option));
204
236
  },
205
237
  primary: function primary(msg) {
206
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
238
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
207
239
  errorMsg(msg);
208
240
  return notice(_objectSpread({
209
- msg: msg,
210
- type: 'primary'
241
+ msg,
242
+ type: "primary"
211
243
  }, option));
212
244
  },
213
245
  danger: function danger(msg) {
214
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
246
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
215
247
  errorMsg(msg);
216
248
  return notice(_objectSpread({
217
- msg: msg,
218
- type: 'danger'
249
+ msg,
250
+ type: "danger"
219
251
  }, option));
220
252
  },
221
253
  warn: function warn(msg) {
222
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
254
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
223
255
  errorMsg(msg);
224
256
  return notice(_objectSpread({
225
- msg: msg,
226
- type: 'warning'
257
+ msg,
258
+ type: "warning"
227
259
  }, option));
228
260
  },
229
261
  hide: function hide() {
@@ -233,4 +265,6 @@ var Notify = {
233
265
  }
234
266
  }
235
267
  };
236
- export { Notify as default };
268
+ export {
269
+ Notify as default
270
+ };
@@ -1,62 +1,60 @@
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
- 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
- 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; }
6
- import React__default, { useState, useEffect } from 'react';
7
- import classNames from 'classnames';
8
- import { c as cn } from './bem-3b438e61.js';
9
- import Popup from './Popup.js';
10
- import { useConfig } from './ConfigProvider.js';
11
- import '@bem-react/classname';
4
+ function ownKeys(object, enumerableOnly) {
5
+ var keys = Object.keys(object);
6
+ if (Object.getOwnPropertySymbols) {
7
+ var symbols = Object.getOwnPropertySymbols(object);
8
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
9
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
10
+ })), keys.push.apply(keys, symbols);
11
+ }
12
+ return keys;
13
+ }
14
+ function _objectSpread(target) {
15
+ for (var i = 1; i < arguments.length; i++) {
16
+ var source = null != arguments[i] ? arguments[i] : {};
17
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
18
+ _defineProperty(target, key, source[key]);
19
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
20
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
21
+ });
22
+ }
23
+ return target;
24
+ }
25
+ import React__default, { useState, useEffect } from "react";
26
+ import classNames from "classnames";
27
+ import { c as cn } from "./bem.js";
28
+ import Popup from "./Popup.js";
29
+ import { useConfig } from "./ConfigProvider.js";
30
+ import "@bem-react/classname";
12
31
  var defaultProps = {
13
- confirmText: '',
14
- title: '',
32
+ confirmText: "",
33
+ title: "",
15
34
  visible: false,
16
35
  overlay: true,
17
- type: 'default',
36
+ type: "default",
18
37
  customKey: [],
19
- className: '',
38
+ className: "",
20
39
  randomKeys: false,
21
- popClass: '',
22
- onClose: function onClose() {}
40
+ popClass: "",
41
+ onClose: function onClose() {
42
+ }
23
43
  };
24
- var NumberKeyboard = function NumberKeyboard(props) {
25
- var _useConfig = useConfig(),
26
- locale = _useConfig.locale;
27
- var title = props.title,
28
- confirmText = props.confirmText,
29
- visible = props.visible,
30
- overlay = props.overlay,
31
- type = props.type,
32
- customKey = props.customKey,
33
- randomKeys = props.randomKeys,
34
- popClass = props.popClass,
35
- style = props.style,
36
- className = props.className,
37
- onChange = props.onChange,
38
- onDelete = props.onDelete,
39
- onClose = props.onClose;
40
- var b = cn('numberkeyboard');
41
- var _useState = useState(visible),
42
- _useState2 = _slicedToArray(_useState, 2),
43
- show = _useState2[0],
44
- setShow = _useState2[1];
45
- var _useState3 = useState(undefined),
46
- _useState4 = _slicedToArray(_useState3, 2),
47
- clickKeyIndex = _useState4[0],
48
- setClickKeyIndex = _useState4[1];
49
- var _useState5 = useState([]),
50
- _useState6 = _slicedToArray(_useState5, 2),
51
- keysList = _useState6[0],
52
- setKeysList = _useState6[1];
53
- useEffect(function () {
44
+ var NumberKeyboard = function NumberKeyboard2(props) {
45
+ var _useConfig = useConfig(), locale = _useConfig.locale;
46
+ var title = props.title, confirmText = props.confirmText, visible = props.visible, overlay = props.overlay, type = props.type, customKey = props.customKey, randomKeys = props.randomKeys, popClass = props.popClass, style = props.style, className = props.className, onChange = props.onChange, onDelete = props.onDelete, onClose2 = props.onClose;
47
+ var b = cn("numberkeyboard");
48
+ var _useState = useState(visible), _useState2 = _slicedToArray(_useState, 2), show = _useState2[0], setShow = _useState2[1];
49
+ var _useState3 = useState(void 0), _useState4 = _slicedToArray(_useState3, 2), clickKeyIndex = _useState4[0], setClickKeyIndex = _useState4[1];
50
+ var _useState5 = useState([]), _useState6 = _slicedToArray(_useState5, 2), keysList = _useState6[0], setKeysList = _useState6[1];
51
+ useEffect(function() {
54
52
  setShow(visible);
55
53
  }, [visible]);
56
- var defaultKey = function defaultKey() {
54
+ var defaultKey = function defaultKey2() {
57
55
  var leftBottomKey = {
58
- id: 'lock',
59
- type: 'lock'
56
+ id: "lock",
57
+ type: "lock"
60
58
  };
61
59
  if (customKey) {
62
60
  var customKeys = Array.isArray(customKey) ? customKey : [customKey];
@@ -64,186 +62,189 @@ var NumberKeyboard = function NumberKeyboard(props) {
64
62
  var newCustomKey = customKeys[0];
65
63
  leftBottomKey = {
66
64
  id: newCustomKey,
67
- type: 'custom'
65
+ type: "custom"
68
66
  };
69
67
  }
70
68
  }
71
69
  return [].concat(_toConsumableArray(getBasicKeys()), [leftBottomKey, {
72
70
  id: 0,
73
- type: 'number'
71
+ type: "number"
74
72
  }, {
75
- id: 'delete',
76
- type: 'delete'
73
+ id: "delete",
74
+ type: "delete"
77
75
  }]);
78
76
  };
79
- var getBasicKeys = function getBasicKeys() {
77
+ var getBasicKeys = function getBasicKeys2() {
80
78
  var keys = [];
81
79
  for (var i = 1; i <= 9; i++) {
82
80
  keys.push({
83
81
  id: i,
84
- type: 'number'
82
+ type: "number"
85
83
  });
86
84
  }
87
85
  if (randomKeys) {
88
- return keys.sort(function () {
86
+ return keys.sort(function() {
89
87
  return Math.random() > 0.5 ? 1 : -1;
90
88
  });
91
89
  }
92
90
  return keys;
93
91
  };
94
- var genCustomKeys = function genCustomKeys() {
92
+ var genCustomKeys = function genCustomKeys2() {
95
93
  var keys = getBasicKeys();
96
- if (!customKey) return [];
94
+ if (!customKey)
95
+ return [];
97
96
  var customKeys = Array.isArray(customKey) ? customKey : [customKey];
98
97
  if (customKeys.length > 2) {
99
98
  customKeys = [customKeys[0], customKeys[1]];
100
99
  }
101
- if (customKeys.length === 2 && props.title && props.type !== 'rightColumn') {
100
+ if (customKeys.length === 2 && props.title && props.type !== "rightColumn") {
102
101
  customKeys = [customKeys[0]];
103
102
  }
104
103
  if (customKeys.length === 1) {
105
- if (props.title && props.type !== 'rightColumn') {
104
+ if (props.title && props.type !== "rightColumn") {
106
105
  keys.push({
107
106
  id: customKeys[0],
108
- type: 'custom'
107
+ type: "custom"
109
108
  }, {
110
109
  id: 0,
111
- type: 'number'
110
+ type: "number"
112
111
  }, {
113
- id: 'delete',
114
- type: 'delete'
112
+ id: "delete",
113
+ type: "delete"
115
114
  });
116
115
  } else {
117
116
  keys.push({
118
117
  id: 0,
119
- type: 'number'
118
+ type: "number"
120
119
  }, {
121
120
  id: customKeys[0],
122
- type: 'custom'
121
+ type: "custom"
123
122
  });
124
123
  }
125
124
  } else if (customKeys.length === 2) {
126
125
  keys.push({
127
126
  id: customKeys[0],
128
- type: 'custom'
127
+ type: "custom"
129
128
  }, {
130
129
  id: 0,
131
- type: 'number'
130
+ type: "number"
132
131
  }, {
133
132
  id: customKeys[1],
134
- type: 'custom'
133
+ type: "custom"
135
134
  });
136
135
  }
137
136
  return keys;
138
137
  };
139
- useEffect(function () {
140
- if (props.type === 'rightColumn' || props.title !== '') {
138
+ useEffect(function() {
139
+ if (props.type === "rightColumn" || props.title !== "") {
141
140
  setKeysList(genCustomKeys());
142
141
  } else {
143
142
  setKeysList(defaultKey());
144
143
  }
145
144
  }, []);
146
- var onTouchstart = function onTouchstart(item, event) {
145
+ var onTouchstart = function onTouchstart2(item, event) {
147
146
  event.stopPropagation();
148
147
  setClickKeyIndex(item.id);
149
- if (item.type === 'number' || item.type === 'custom') {
148
+ if (item.type === "number" || item.type === "custom") {
150
149
  onChange && onChange(item.id);
151
150
  }
152
- if (item.type === 'lock') {
153
- onClose && onClose();
151
+ if (item.type === "lock") {
152
+ onClose2 && onClose2();
154
153
  }
155
- if (item.type === 'delete') {
154
+ if (item.type === "delete") {
156
155
  onDelete && onDelete();
157
156
  }
158
157
  };
159
- var onTouchMove = function onTouchMove(event) {
158
+ var onTouchMove = function onTouchMove2(event) {
160
159
  event.stopPropagation();
161
160
  };
162
- var onTouchEnd = function onTouchEnd(event) {
161
+ var onTouchEnd = function onTouchEnd2(event) {
163
162
  event.preventDefault();
164
- setClickKeyIndex(undefined);
163
+ setClickKeyIndex(void 0);
165
164
  };
166
165
  return React__default.createElement("div", null, React__default.createElement(Popup, {
167
166
  visible: show,
168
167
  position: "bottom",
169
- popClass: popClass,
170
- onClickOverlay: onClose,
171
- overlay: overlay,
172
- onClickCloseIcon: onClose,
168
+ className: popClass,
169
+ onClickOverlay: onClose2,
170
+ overlay,
171
+ onClickCloseIcon: onClose2,
173
172
  overlayStyle: {
174
- backgroundColor: 'rgba(0, 0, 0, 0)'
173
+ backgroundColor: "rgba(0, 0, 0, 0)"
175
174
  }
176
175
  }, React__default.createElement("div", {
177
176
  className: "".concat(b(), " ").concat(className),
178
177
  style: _objectSpread({}, style)
179
178
  }, title ? React__default.createElement("div", {
180
- className: b('header')
179
+ className: b("header")
181
180
  }, React__default.createElement("h3", {
182
- className: b('header__tit')
183
- }, title), type === 'default' ? React__default.createElement("span", {
184
- className: b('header__close'),
185
- onClick: onClose
181
+ className: b("header__tit")
182
+ }, title), type === "default" ? React__default.createElement("span", {
183
+ className: b("header__close"),
184
+ onClick: onClose2
186
185
  }, locale.done) : null) : null, React__default.createElement("div", {
187
- className: b('body')
186
+ className: b("body")
188
187
  }, React__default.createElement("div", {
189
- className: b('body__keys')
190
- }, keysList === null || keysList === void 0 ? void 0 : keysList.map(function (item, index) {
188
+ className: b("body__keys")
189
+ }, keysList === null || keysList === void 0 ? void 0 : keysList.map(function(item, index) {
191
190
  return React__default.createElement("div", {
192
191
  key: index,
193
192
  className: classNames({
194
- 'key-board-wrapper': true,
195
- 'key-board-wrapper-large': item.id === 0 && type === 'rightColumn' && Array.isArray(customKey) && customKey.length === 1
193
+ "key-board-wrapper": true,
194
+ "key-board-wrapper-large": item.id === 0 && type === "rightColumn" && Array.isArray(customKey) && customKey.length === 1
196
195
  })
197
196
  }, React__default.createElement("div", {
198
197
  className: classNames({
199
198
  key: true,
200
199
  active: item.id === clickKeyIndex,
201
- lock: item.type === 'lock',
202
- "delete": item.type === 'delete'
200
+ lock: item.type === "lock",
201
+ "delete": item.type === "delete"
203
202
  }),
204
203
  onTouchStart: function onTouchStart(event) {
205
204
  return onTouchstart(item, event);
206
205
  },
207
- onTouchMove: onTouchMove,
208
- onTouchEnd: onTouchEnd
209
- }, item.type === 'number' || item.type === 'custom' ? React__default.createElement("div", null, item.id) : null, item.type === 'lock' ? React__default.createElement("img", {
206
+ onTouchMove,
207
+ onTouchEnd
208
+ }, item.type === "number" || item.type === "custom" ? React__default.createElement("div", null, item.id) : null, item.type === "lock" ? React__default.createElement("img", {
210
209
  src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png",
211
210
  alt: ""
212
- }) : null, item.type === 'delete' ? React__default.createElement("img", {
211
+ }) : null, item.type === "delete" ? React__default.createElement("img", {
213
212
  src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
214
213
  alt: ""
215
214
  }) : null));
216
- })), type === 'rightColumn' ? React__default.createElement("div", {
217
- className: b('sidebar')
215
+ })), type === "rightColumn" ? React__default.createElement("div", {
216
+ className: b("sidebar")
218
217
  }, React__default.createElement("div", {
219
218
  className: "key-board-wrapper"
220
219
  }, React__default.createElement("div", {
221
220
  className: classNames({
222
221
  key: true,
223
- active: clickKeyIndex === 'delete'
222
+ active: clickKeyIndex === "delete"
224
223
  }),
225
224
  onTouchStart: function onTouchStart(event) {
226
225
  return onTouchstart({
227
- id: 'delete',
228
- type: 'delete'
226
+ id: "delete",
227
+ type: "delete"
229
228
  }, event);
230
229
  },
231
- onTouchMove: onTouchMove,
232
- onTouchEnd: onTouchEnd
230
+ onTouchMove,
231
+ onTouchEnd
233
232
  }, React__default.createElement("img", {
234
233
  src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
235
234
  alt: ""
236
235
  }))), React__default.createElement("div", {
237
236
  className: "key-board-wrapper key-board-finish",
238
- onClick: onClose
237
+ onClick: onClose2
239
238
  }, React__default.createElement("div", {
240
239
  className: classNames({
241
240
  key: true,
242
241
  finish: true,
243
- activeFinsh: clickKeyIndex === 'finish'
242
+ activeFinsh: clickKeyIndex === "finish"
244
243
  })
245
244
  }, confirmText || locale.done))) : null))));
246
245
  };
247
246
  NumberKeyboard.defaultProps = defaultProps;
248
- NumberKeyboard.displayName = 'NutNumberKeyboard';
249
- export { NumberKeyboard as default };
247
+ NumberKeyboard.displayName = "NutNumberKeyboard";
248
+ export {
249
+ NumberKeyboard as default
250
+ };