@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
package/dist/esm/Toast.js CHANGED
@@ -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 classNames from 'classnames';
14
- import { c as cn } from './bem-3b438e61.js';
15
- import Icon from './Icon.js';
16
- import { r as render, u as unmount } from './render-bbebb760.js';
17
- import '@bem-react/classname';
18
- import 'react-dom';
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 classNames from "classnames";
59
+ import { c as cn } from "./bem.js";
60
+ import { r as render, u as unmount } from "./render.js";
61
+ import { Loading } from "@nutui/icons-react";
62
+ import "@bem-react/classname";
63
+ import "react-dom";
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));
@@ -31,7 +76,7 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
31
76
  _this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
32
77
  return _this;
33
78
  }
34
- _createClass(Notification, [{
79
+ _createClass(Notification2, [{
35
80
  key: "close",
36
81
  value: function close() {
37
82
  this.clearCloseTimer();
@@ -43,9 +88,9 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
43
88
  var _this2 = this;
44
89
  var duration = this.props.duration;
45
90
  if (duration) {
46
- this.closeTimer = window.setTimeout(function () {
91
+ this.closeTimer = window.setTimeout(function() {
47
92
  _this2.close();
48
- }, duration * 1000);
93
+ }, duration * 1e3);
49
94
  }
50
95
  }
51
96
  }, {
@@ -76,68 +121,48 @@ var Notification = /*#__PURE__*/function (_React$PureComponent) {
76
121
  }
77
122
  }, {
78
123
  key: "render",
79
- value: function render() {
80
- var _classNames,
81
- _this3 = this;
82
- var _this$props = this.props,
83
- id = _this$props.id,
84
- style = _this$props.style,
85
- icon = _this$props.icon,
86
- iconSize = _this$props.iconSize,
87
- title = _this$props.title,
88
- msg = _this$props.msg,
89
- bottom = _this$props.bottom,
90
- center = _this$props.center,
91
- bgColor = _this$props.bgColor,
92
- coverColor = _this$props.coverColor,
93
- textAlignCenter = _this$props.textAlignCenter,
94
- size = _this$props.size,
95
- customClass = _this$props.customClass,
96
- cover = _this$props.cover,
97
- type = _this$props.type;
98
- var toastBem = cn('toast');
124
+ value: function render2() {
125
+ var _classNames, _this3 = this;
126
+ var _this$props = this.props, id = _this$props.id, style = _this$props.style, icon = _this$props.icon, title = _this$props.title, msg = _this$props.msg, bottom = _this$props.bottom, center = _this$props.center, bgColor = _this$props.bgColor, coverColor = _this$props.coverColor, textAlignCenter = _this$props.textAlignCenter, size = _this$props.size, customClass = _this$props.customClass, cover = _this$props.cover, type = _this$props.type;
127
+ var toastBem = cn("toast");
99
128
  var classes = classNames((_classNames = {
100
- 'nut-toast-center': center,
101
- 'nut-toast-has-icon': icon,
102
- 'nut-toast-cover': cover,
103
- 'nut-toast-loading': type === 'loading'
129
+ "nut-toast-center": center,
130
+ "nut-toast-has-icon": icon,
131
+ "nut-toast-cover": cover,
132
+ "nut-toast-loading": type === "loading"
104
133
  }, _defineProperty(_classNames, "".concat(customClass), true), _defineProperty(_classNames, "nut-toast-".concat(size), true), _classNames));
105
134
  return React.createElement(React.Fragment, null, React.createElement("div", {
106
135
  className: "".concat(toastBem(), " ").concat(classes),
107
136
  id: "toast-".concat(id),
108
137
  style: _objectSpread({
109
- bottom: center ? 'auto' : "".concat(bottom),
110
- backgroundColor: cover ? coverColor : ''
138
+ bottom: center ? "auto" : "".concat(bottom),
139
+ backgroundColor: cover ? coverColor : ""
111
140
  }, style),
112
141
  onClick: function onClick() {
113
142
  _this3.clickCover();
114
143
  }
115
144
  }, React.createElement("div", {
116
- className: toastBem('inner'),
145
+ className: toastBem("inner"),
117
146
  style: {
118
- textAlign: textAlignCenter ? 'center' : 'left',
147
+ textAlign: textAlignCenter ? "center" : "left",
119
148
  backgroundColor: bgColor
120
149
  }
121
150
  }, icon ? React.createElement("p", {
122
- className: toastBem('icon-wrapper')
123
- }, React.createElement(Icon, {
124
- name: icon || '',
125
- color: "#ffffff",
126
- size: iconSize
127
- })) : null, title ? React.createElement("div", {
151
+ className: toastBem("icon-wrapper")
152
+ }, icon) : null, title ? React.createElement("div", {
128
153
  className: "nut-toast-title"
129
154
  }, title) : null, React.createElement("span", {
130
- className: toastBem('text')
155
+ className: toastBem("text")
131
156
  }, msg))));
132
157
  }
133
158
  }]);
134
- return Notification;
159
+ return Notification2;
135
160
  }(React.PureComponent);
136
161
  _defineProperty(Notification, "newInstance", void 0);
137
- Notification.newInstance = function (properties, callback) {
138
- var element = document.createElement('div');
162
+ Notification.newInstance = function(properties, callback) {
163
+ var element = document.createElement("div");
139
164
  if (properties.id) {
140
- element.setAttribute('id', "".concat(properties.id));
165
+ element.setAttribute("id", "".concat(properties.id));
141
166
  }
142
167
  document.body.appendChild(element);
143
168
  var called = false;
@@ -155,38 +180,39 @@ Notification.newInstance = function (properties, callback) {
155
180
  });
156
181
  }
157
182
  render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
158
- ref: ref
183
+ ref
159
184
  })), element);
160
185
  };
161
186
  var messageInstance = null;
162
187
  var options = {
163
- msg: '',
164
- id: '',
188
+ msg: "",
189
+ id: "",
165
190
  style: {},
166
191
  duration: 1.5,
167
192
  center: true,
168
- type: 'text',
169
- title: '',
170
- customClass: '',
171
- bottom: '30px',
172
- size: 'base',
193
+ type: "text",
194
+ title: "",
195
+ customClass: "",
196
+ bottom: "30px",
197
+ size: "base",
173
198
  icon: null,
174
- iconSize: '20',
199
+ iconSize: "20",
175
200
  textAlignCenter: true,
176
201
  loadingRotate: true,
177
- bgColor: 'rgba(0, 0, 0, .8)',
178
- onClose: function onClose() {},
202
+ bgColor: "rgba(0, 0, 0, .8)",
203
+ onClose: function onClose() {
204
+ },
179
205
  cover: false,
180
- coverColor: 'rgba(0, 0, 0, 0)',
181
- closeOnClickOverlay: false // 是否点击遮罩可关闭
206
+ coverColor: "rgba(0, 0, 0, 0)",
207
+ closeOnClickOverlay: false
208
+ // 是否点击遮罩可关闭
182
209
  };
183
-
184
210
  function getInstance(props, callback) {
185
211
  if (messageInstance) {
186
212
  messageInstance.destroy();
187
213
  messageInstance = null;
188
214
  }
189
- Notification.newInstance(props, function (notification) {
215
+ Notification.newInstance(props, function(notification) {
190
216
  return callback && callback(notification);
191
217
  });
192
218
  }
@@ -200,65 +226,65 @@ function notice(opts) {
200
226
  var opts2 = _objectSpread(_objectSpread(_objectSpread({}, options), opts), {}, {
201
227
  onClose: close
202
228
  });
203
- getInstance(opts2, function (notification) {
229
+ getInstance(opts2, function(notification) {
204
230
  messageInstance = notification;
205
231
  });
206
232
  }
207
- var errorMsg = function errorMsg(msg) {
233
+ var errorMsg = function errorMsg2(msg) {
208
234
  if (!msg) {
209
- console.warn('[NutUI Toast]: msg cannot be null');
235
+ console.warn("[NutUI Toast]: msg cannot be null");
210
236
  }
211
237
  };
212
238
  var Toast = {
213
239
  text: function text(msg) {
214
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
240
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
215
241
  errorMsg(msg);
216
242
  return notice(_objectSpread({
217
- msg: msg,
218
- type: 'text'
243
+ msg,
244
+ type: "text"
219
245
  }, option));
220
246
  },
221
247
  success: function success(msg) {
222
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
248
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
223
249
  errorMsg(msg);
224
250
  return notice(_objectSpread({
225
- msg: msg,
226
- icon: 'success',
227
- type: 'success'
251
+ msg,
252
+ icon: "success",
253
+ type: "success"
228
254
  }, option));
229
255
  },
230
256
  fail: function fail(msg) {
231
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
257
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
232
258
  errorMsg(msg);
233
259
  return notice(_objectSpread({
234
- msg: msg,
235
- icon: 'failure',
236
- type: 'fail'
260
+ msg,
261
+ icon: "failure",
262
+ type: "fail"
237
263
  }, option));
238
264
  },
239
265
  loading: function loading(msg) {
240
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
266
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
241
267
  errorMsg(msg);
242
268
  return notice(_objectSpread({
243
- msg: msg,
244
- icon: 'loading',
245
- type: 'loading'
269
+ msg,
270
+ icon: React.createElement(Loading, null),
271
+ type: "loading"
246
272
  }, option));
247
273
  },
248
274
  warn: function warn(msg) {
249
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
275
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
250
276
  errorMsg(msg);
251
277
  return notice(_objectSpread({
252
- msg: msg,
253
- icon: 'tips',
254
- type: 'warn'
278
+ msg,
279
+ icon: "tips",
280
+ type: "warn"
255
281
  }, option));
256
282
  },
257
283
  customIcon: function customIcon(msg) {
258
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
284
+ var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
259
285
  errorMsg(msg);
260
286
  return notice(_objectSpread({
261
- msg: msg
287
+ msg
262
288
  }, option));
263
289
  },
264
290
  hide: function hide() {
@@ -268,4 +294,6 @@ var Toast = {
268
294
  }
269
295
  }
270
296
  };
271
- export { Toast as default };
297
+ export {
298
+ Toast as default
299
+ };
@@ -1,2 +1,2 @@
1
- import '../../Icon/style'
1
+
2
2
  import '../../../packages/trendarrow/trendarrow.scss'
@@ -1,12 +1,31 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["rate", "digits", "showSign", "showZero", "arrowLeft", "syncTextColor", "textColor", "riseColor", "dropColor", "iconSize", "upIconName", "downIconName", "className", "children"];
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, { useRef } from 'react';
7
- import { c as cn } from './bem-3b438e61.js';
8
- import Icon from './Icon.js';
9
- import '@bem-react/classname';
3
+ var _excluded = ["rate", "digits", "showSign", "showZero", "arrowLeft", "syncTextColor", "textColor", "riseColor", "dropColor", "upIcon", "downIcon", "className", "children"];
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, { useRef } from "react";
26
+ import { TriangleUp, TriangleDown } from "@nutui/icons-react";
27
+ import { c as cn } from "./bem.js";
28
+ import "@bem-react/classname";
10
29
  var defaultProps = {
11
30
  rate: 0,
12
31
  digits: 2,
@@ -14,45 +33,29 @@ var defaultProps = {
14
33
  showZero: false,
15
34
  arrowLeft: false,
16
35
  syncTextColor: true,
17
- textColor: '#333',
18
- riseColor: '#fa2c19',
19
- dropColor: '#64b578',
20
- iconSize: '12px',
21
- upIconName: 'triangle-up',
22
- downIconName: 'triangle-down',
23
- className: ''
36
+ textColor: "#333",
37
+ riseColor: "#fa2c19",
38
+ dropColor: "#64b578",
39
+ upIcon: null,
40
+ downIcon: null,
41
+ className: ""
24
42
  };
25
- var TrendArrow = function TrendArrow(props) {
26
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
27
- rate = _defaultProps$props.rate,
28
- digits = _defaultProps$props.digits,
29
- showSign = _defaultProps$props.showSign,
30
- showZero = _defaultProps$props.showZero,
31
- arrowLeft = _defaultProps$props.arrowLeft,
32
- syncTextColor = _defaultProps$props.syncTextColor,
33
- textColor = _defaultProps$props.textColor,
34
- riseColor = _defaultProps$props.riseColor,
35
- dropColor = _defaultProps$props.dropColor,
36
- iconSize = _defaultProps$props.iconSize,
37
- upIconName = _defaultProps$props.upIconName,
38
- downIconName = _defaultProps$props.downIconName,
39
- className = _defaultProps$props.className,
40
- children = _defaultProps$props.children,
41
- rest = _objectWithoutProperties(_defaultProps$props, _excluded);
42
- var b = cn('trendarrow');
43
- var handleClick = function handleClick() {};
43
+ var TrendArrow = function TrendArrow2(props) {
44
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), rate = _defaultProps$props.rate, digits = _defaultProps$props.digits, showSign = _defaultProps$props.showSign, showZero = _defaultProps$props.showZero, arrowLeft = _defaultProps$props.arrowLeft, syncTextColor = _defaultProps$props.syncTextColor, textColor = _defaultProps$props.textColor, riseColor = _defaultProps$props.riseColor, dropColor = _defaultProps$props.dropColor, upIcon = _defaultProps$props.upIcon, downIcon = _defaultProps$props.downIcon, className = _defaultProps$props.className, children = _defaultProps$props.children, rest = _objectWithoutProperties(_defaultProps$props, _excluded);
45
+ var b = cn("trendarrow");
46
+ var handleClick = function handleClick2() {
47
+ };
44
48
  var rateTrend = useRef(rate > 0);
45
- var myFixed = function myFixed(num) {
46
- var digit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
49
+ var myFixed = function myFixed2(num) {
50
+ var digit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
47
51
  if (Object.is(parseFloat(num), NaN)) {
48
- return console.log("\u4F20\u5165\u7684\u503C\uFF1A".concat(num, "\u4E0D\u662F\u4E00\u4E2A\u6570\u5B57"));
52
+ return console.log("传入的值:".concat(num, "不是一个数字"));
49
53
  }
50
54
  num = parseFloat(num);
51
- // eslint-disable-next-line no-restricted-properties
52
55
  var numPow = Math.pow(10, digit);
53
56
  return (Math.round((num + Number.EPSILON) * numPow) / numPow).toFixed(digit);
54
57
  };
55
- var calcStyle = function () {
58
+ var calcStyle = function() {
56
59
  var arrowColor = rateTrend.current ? riseColor : dropColor;
57
60
  var textEquArrowColor = syncTextColor ? arrowColor : textColor;
58
61
  var style = {
@@ -60,29 +63,28 @@ var TrendArrow = function TrendArrow(props) {
60
63
  };
61
64
  return style;
62
65
  }();
63
- var calcRate = function () {
66
+ var calcRate = function() {
64
67
  rateTrend.current = rate > 0;
65
68
  var absRate = Math.abs(rate);
66
69
  if (!showZero && rate === 0) {
67
- return '--';
70
+ return "--";
68
71
  }
69
72
  var resultRate = "".concat(
70
- // eslint-disable-next-line no-nested-ternary
71
- showSign && rate !== 0 ? rateTrend.current ? '+' : '-' : '').concat(myFixed(Number(absRate), digits), "%");
73
+ // eslint-disable-next-line no-nested-ternary
74
+ showSign && rate !== 0 ? rateTrend.current ? "+" : "-" : ""
75
+ ).concat(myFixed(Number(absRate), digits), "%");
72
76
  return resultRate;
73
77
  }();
74
- var calcIconProps = function () {
78
+ var calcIconProps = function() {
75
79
  var iconProps = {
76
- name: rateTrend.current ? upIconName : downIconName,
77
- color: rateTrend.current ? riseColor : dropColor,
78
- size: iconSize
80
+ color: rateTrend.current ? riseColor : dropColor
79
81
  };
80
82
  return iconProps;
81
83
  }();
82
- var renderContent = function renderContent(arrowLeft) {
83
- var classNameSuffix = !arrowLeft ? 'icon-after' : 'icon-before';
84
+ var renderContent = function renderContent2(arrowLeft2) {
85
+ var classNameSuffix = !arrowLeft2 ? "icon-after" : "icon-before";
84
86
  return React__default.createElement("span", {
85
- className: "".concat(b(classNameSuffix), " ").concat(b('rate')),
87
+ className: "".concat(b(classNameSuffix), " ").concat(b("rate")),
86
88
  style: calcStyle
87
89
  }, calcRate);
88
90
  };
@@ -90,12 +92,14 @@ var TrendArrow = function TrendArrow(props) {
90
92
  className: "".concat(b(), " ").concat(className)
91
93
  }, rest), {}, {
92
94
  onClick: handleClick
93
- }), !arrowLeft && renderContent(!arrowLeft), children || React__default.createElement(React__default.Fragment, null, Number(rate) !== 0 && React__default.createElement(Icon, {
94
- size: calcIconProps.size,
95
- name: calcIconProps.name,
95
+ }), !arrowLeft && renderContent(!arrowLeft), children || React__default.createElement(React__default.Fragment, null, Number(rate) !== 0 && React__default.createElement(React__default.Fragment, null, rateTrend ? React__default.createElement(TriangleUp, {
96
+ color: calcIconProps.color
97
+ }) : React__default.createElement(TriangleDown, {
96
98
  color: calcIconProps.color
97
- })), arrowLeft && renderContent(!arrowLeft));
99
+ }))), arrowLeft && renderContent(!arrowLeft));
98
100
  };
99
101
  TrendArrow.defaultProps = defaultProps;
100
- TrendArrow.displayName = 'NutTrendArrow';
101
- export { TrendArrow as default };
102
+ TrendArrow.displayName = "NutTrendArrow";
103
+ export {
104
+ TrendArrow as default
105
+ };
@@ -1,4 +1,3 @@
1
- import '../../Icon/style'
2
1
  import '../../Progress/style'
3
2
 
4
3
  import '../../../packages/uploader/uploader.scss'