@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.
- package/CHANGELOG.md +24 -664
- package/dist/esm/ActionSheet.js +62 -54
- package/dist/esm/Address/style/index.js +0 -1
- package/dist/esm/Address.js +235 -330
- package/dist/esm/Animate.js +43 -32
- package/dist/esm/AnimatingNumbers.js +88 -49
- package/dist/esm/Audio/style/index.js +0 -1
- package/dist/esm/Audio.js +108 -121
- package/dist/esm/Avatar.js +65 -78
- package/dist/esm/AvatarContext.js +5 -0
- package/dist/esm/AvatarGroup.js +46 -27
- package/dist/esm/BackTop/style/index.js +1 -1
- package/dist/esm/BackTop.js +74 -76
- package/dist/esm/Badge.js +57 -54
- package/dist/esm/Barrage.js +45 -32
- package/dist/esm/Button/style/index.js +1 -1
- package/dist/esm/Button.js +66 -87
- package/dist/esm/Calendar.js +80 -79
- package/dist/esm/CalendarItem.js +199 -231
- package/dist/esm/Card.js +44 -37
- package/dist/esm/Cascader.js +431 -434
- package/dist/esm/Cell/style/index.js +1 -1
- package/dist/esm/Cell.js +57 -87
- package/dist/esm/CellGroup.js +7 -5
- package/dist/esm/Checkbox/style/index.js +0 -1
- package/dist/esm/Checkbox.js +11 -8
- package/dist/esm/CheckboxGroup.js +78 -71
- package/dist/esm/CircleProgress.js +50 -40
- package/dist/esm/Col.js +49 -43
- package/dist/esm/Collapse.js +44 -44
- package/dist/esm/CollapseItem/style/index.js +1 -1
- package/dist/esm/CollapseItem.js +64 -104
- package/dist/esm/ConfigProvider.js +400 -101
- package/dist/esm/CountDown.js +90 -95
- package/dist/esm/DatePicker.js +104 -123
- package/dist/esm/Dialog.js +98 -104
- package/dist/esm/Divider.js +36 -27
- package/dist/esm/Drag.js +55 -59
- package/dist/esm/Elevator.js +77 -88
- package/dist/esm/Ellipsis.js +80 -79
- package/dist/esm/Empty.js +50 -44
- package/dist/esm/FixedNav/style/index.js +0 -1
- package/dist/esm/FixedNav.js +57 -65
- package/dist/esm/Form.js +1154 -123
- package/dist/esm/FormItem.js +7 -5
- package/dist/esm/Grid/style/index.js +1 -1
- package/dist/esm/Grid.js +51 -55
- package/dist/esm/GridItem.js +7 -124
- package/dist/esm/Icon.js +83 -5
- package/dist/esm/Image.js +123 -122
- package/dist/esm/ImagePreview.js +76 -94
- package/dist/esm/Indicator.js +41 -36
- package/dist/esm/Infiniteloading/style/index.js +1 -1
- package/dist/esm/Infiniteloading.js +77 -93
- package/dist/esm/Input/style/index.js +1 -1
- package/dist/esm/Input.js +120 -172
- package/dist/esm/InputNumber/style/index.js +1 -1
- package/dist/esm/InputNumber.js +133 -167
- package/dist/esm/Layout.js +27 -6
- package/dist/esm/Menu.js +84 -86
- package/dist/esm/MenuItem/style/index.js +0 -1
- package/dist/esm/MenuItem.js +76 -86
- package/dist/esm/NavBar/style/index.js +1 -1
- package/dist/esm/NavBar.js +59 -63
- package/dist/esm/NoticeBar/style/index.js +1 -1
- package/dist/esm/NoticeBar.js +173 -290
- package/dist/esm/Notify.js +112 -78
- package/dist/esm/NumberKeyboard.js +110 -109
- package/dist/esm/Overlay.js +7 -6
- package/dist/esm/Pagination.js +94 -135
- package/dist/esm/Picker.js +149 -201
- package/dist/esm/Popover/style/index.js +0 -1
- package/dist/esm/Popover.js +121 -116
- package/dist/esm/Popup/style/index.js +0 -1
- package/dist/esm/Popup.js +114 -131
- package/dist/esm/Price.js +51 -39
- package/dist/esm/Progress/style/index.js +1 -1
- package/dist/esm/Progress.js +59 -64
- package/dist/esm/PullToRefresh.js +173 -149
- package/dist/esm/Radio/style/index.js +0 -1
- package/dist/esm/Radio.js +8 -6
- package/dist/esm/RadioGroup.js +64 -84
- package/dist/esm/Range.js +93 -122
- package/dist/esm/Rate/style/index.js +1 -1
- package/dist/esm/Rate.js +77 -95
- package/dist/esm/Row.js +49 -37
- package/dist/esm/SearchBar/style/index.js +1 -1
- package/dist/esm/SearchBar.js +110 -120
- package/dist/esm/ShortPassword/style/index.js +0 -1
- package/dist/esm/ShortPassword.js +120 -116
- package/dist/esm/SideNavBar.js +38 -28
- package/dist/esm/SideNavBarItem.js +31 -14
- package/dist/esm/Signature.js +65 -61
- package/dist/esm/Skeleton.js +48 -40
- package/dist/esm/Step/style/index.js +1 -1
- package/dist/esm/Step.js +49 -49
- package/dist/esm/Steps.js +37 -23
- package/dist/esm/Sticky.js +111 -120
- package/dist/esm/SubSideNavBar.js +50 -38
- package/dist/esm/Swipe.js +75 -63
- package/dist/esm/Swiper.js +171 -206
- package/dist/esm/SwiperItem.js +39 -22
- package/dist/esm/Switch.js +46 -37
- package/dist/esm/TabPane.js +8 -6
- package/dist/esm/Tabbar.js +47 -39
- package/dist/esm/TabbarItem/style/index.js +1 -1
- package/dist/esm/TabbarItem.js +50 -52
- package/dist/esm/Table/style/index.js +1 -1
- package/dist/esm/Table.js +70 -70
- package/dist/esm/Tabs/style/index.js +1 -2
- package/dist/esm/Tabs.js +11 -9
- package/dist/esm/Tag/style/index.js +1 -1
- package/dist/esm/Tag.js +69 -70
- package/dist/esm/TextArea.js +70 -64
- package/dist/esm/TimeDetail.js +47 -38
- package/dist/esm/TimePannel.js +35 -19
- package/dist/esm/TimeSelect.js +60 -68
- package/dist/esm/Toast/style/index.js +1 -1
- package/dist/esm/Toast.js +126 -98
- package/dist/esm/TrendArrow/style/index.js +1 -1
- package/dist/esm/TrendArrow.js +59 -55
- package/dist/esm/Uploader/style/index.js +0 -1
- package/dist/esm/Uploader.js +195 -246
- package/dist/esm/UserContext.js +5 -0
- package/dist/esm/UserContext2.js +5 -0
- package/dist/esm/UserContext3.js +5 -0
- package/dist/esm/Video.js +49 -39
- package/dist/esm/VirtualList.js +111 -146
- package/dist/esm/WaterMark.js +57 -60
- package/dist/esm/bem.js +10 -0
- package/dist/esm/cellgroup2.js +49 -0
- package/dist/esm/checkbox2.js +145 -0
- package/dist/esm/{date-c7aad4c0.js → date.js} +13 -11
- package/dist/esm/{formitem-8a73a5fb.js → formitem2.js} +83 -50
- package/dist/esm/get-scroll-parent.js +26 -0
- package/dist/esm/griditem2.js +96 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/nutui-react.es.js +188 -94
- package/dist/esm/offsetContext.js +19 -0
- package/dist/esm/overlay2.js +98 -0
- package/dist/esm/px-check.js +6 -0
- package/dist/esm/radio2.js +129 -0
- package/dist/esm/render.js +95 -0
- package/dist/esm/tabpane2.js +44 -0
- package/dist/esm/tabs2.js +175 -0
- package/dist/esm/typings.js +7 -0
- package/dist/esm/use-client-rect.js +32 -0
- package/dist/esm/use-props-value.js +18 -0
- package/dist/esm/use-touch.js +74 -0
- package/dist/locales/base.d.ts +2 -2
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +3 -3
- package/dist/locales/id-ID.js +3 -3
- package/dist/locales/zh-CN.js +3 -3
- package/dist/locales/zh-TW.js +3 -3
- package/dist/locales/zh-UG.js +3 -3
- package/dist/nutui.react.mjs +8389 -4901
- package/dist/nutui.react.umd.js +8390 -4902
- package/dist/packages/actionsheet/actionsheet.scss +10 -2
- package/dist/packages/audio/audio.scss +2 -15
- package/dist/packages/backtop/backtop.scss +0 -8
- package/dist/packages/badge/badge.scss +3 -4
- package/dist/packages/button/button.scss +80 -93
- package/dist/packages/calendar/calendar.scss +0 -30
- package/dist/packages/cell/cell.scss +18 -90
- package/dist/packages/cellgroup/cellgroup.scss +26 -20
- package/dist/packages/collapseitem/collapseitem.scss +0 -1
- package/dist/packages/dialog/dialog.scss +1 -1
- package/dist/packages/divider/divider.scss +3 -17
- package/dist/packages/grid/grid.scss +1 -0
- package/dist/packages/griditem/griditem.scss +2 -17
- package/dist/packages/icon/icon.scss +0 -132
- package/dist/packages/image/image.scss +0 -12
- package/dist/packages/indicator/indicator.scss +21 -39
- package/dist/packages/infiniteloading/infiniteloading.scss +4 -12
- package/dist/packages/input/input.scss +4 -0
- package/dist/packages/inputnumber/inputnumber.scss +10 -26
- package/dist/packages/menuitem/menuitem.scss +2 -0
- package/dist/packages/navbar/navbar.scss +4 -5
- package/dist/packages/overlay/overlay.scss +0 -19
- package/dist/packages/picker/picker.scss +97 -103
- package/dist/packages/popup/popup.scss +0 -16
- package/dist/packages/progress/progress.scss +0 -1
- package/dist/packages/radio/radio.scss +8 -0
- package/dist/packages/rate/rate.scss +29 -6
- package/dist/packages/row/row.scss +13 -31
- package/dist/packages/searchbar/searchbar.scss +0 -1
- package/dist/packages/shortpassword/shortpassword.scss +4 -1
- package/dist/packages/sidenavbar/sidenavbar.scss +0 -19
- package/dist/packages/step/step.scss +0 -1
- package/dist/packages/sticky/sticky.scss +1 -1
- package/dist/packages/swiper/swiper.scss +8 -0
- package/dist/packages/tabbaritem/tabbaritem.scss +0 -1
- package/dist/packages/table/table.scss +0 -1
- package/dist/packages/tag/tag.scss +9 -2
- package/dist/packages/timedetail/timedetail.scss +9 -3
- package/dist/packages/timeselect/timeselect.scss +1 -1
- package/dist/packages/toast/toast.scss +0 -1
- package/dist/packages/uploader/uploader.scss +2 -28
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/font-jmapp/config.json +175 -0
- package/dist/styles/font-jmapp/demo.css +539 -0
- package/dist/styles/font-jmapp/demo_index.html +1821 -0
- package/dist/styles/font-jmapp/iconfont.css +299 -0
- package/dist/styles/font-jmapp/iconfont.eot +0 -0
- package/dist/styles/font-jmapp/iconfont.js +68 -0
- package/dist/styles/font-jmapp/iconfont.json +506 -0
- package/dist/styles/font-jmapp/iconfont.svg +356 -0
- package/dist/styles/font-jmapp/iconfont.ttf +0 -0
- package/dist/styles/font-jmapp/iconfont.woff +0 -0
- package/dist/styles/font-jmapp/iconfont.woff2 +0 -0
- package/dist/styles/theme-default.scss +1 -0
- package/dist/styles/theme-jmapp.scss +41 -0
- package/dist/styles/themes/default.scss +0 -1
- package/dist/styles/variables-jmapp.scss +2601 -0
- package/dist/styles/variables.scss +49 -73
- package/dist/types/index.d.ts +169 -266
- package/package.json +23 -154
- package/dist/esm/AvatarContext-15733596.js +0 -3
- package/dist/esm/Icon/style/index.js +0 -4
- package/dist/esm/UserContext-101ad4a4.js +0 -3
- package/dist/esm/UserContext-2629d479.js +0 -3
- package/dist/esm/UserContext-b33bcf21.js +0 -3
- package/dist/esm/bem-3b438e61.js +0 -8
- package/dist/esm/cellgroup-fcc72767.js +0 -34
- package/dist/esm/checkbox-44e13cd0.js +0 -137
- package/dist/esm/get-scroll-parent-5f85dee8.js +0 -24
- package/dist/esm/grid.context-2ee27d95.js +0 -6
- package/dist/esm/icon-4ef1581c.js +0 -70
- package/dist/esm/index-030b7245.js +0 -11
- package/dist/esm/offsetContext-3ab00d40.js +0 -16
- package/dist/esm/overlay-de6c79d5.js +0 -83
- package/dist/esm/radio-9f141e6b.js +0 -118
- package/dist/esm/render-bbebb760.js +0 -79
- package/dist/esm/tabpane-01075e6c.js +0 -29
- package/dist/esm/tabs-e1b4e4b1.js +0 -181
- package/dist/esm/typings-f27b58f4.js +0 -8
- package/dist/esm/useClientRect-56bb675b.js +0 -39
- 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) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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,
|
|
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(
|
|
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 *
|
|
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
|
|
80
|
-
var _classNames,
|
|
81
|
-
|
|
82
|
-
var
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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 ?
|
|
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(
|
|
145
|
+
className: toastBem("inner"),
|
|
117
146
|
style: {
|
|
118
|
-
textAlign: textAlignCenter ?
|
|
147
|
+
textAlign: textAlignCenter ? "center" : "left",
|
|
119
148
|
backgroundColor: bgColor
|
|
120
149
|
}
|
|
121
150
|
}, icon ? React.createElement("p", {
|
|
122
|
-
className: toastBem(
|
|
123
|
-
}, React.createElement(
|
|
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(
|
|
155
|
+
className: toastBem("text")
|
|
131
156
|
}, msg))));
|
|
132
157
|
}
|
|
133
158
|
}]);
|
|
134
|
-
return
|
|
159
|
+
return Notification2;
|
|
135
160
|
}(React.PureComponent);
|
|
136
161
|
_defineProperty(Notification, "newInstance", void 0);
|
|
137
|
-
Notification.newInstance = function
|
|
138
|
-
var element = document.createElement(
|
|
162
|
+
Notification.newInstance = function(properties, callback) {
|
|
163
|
+
var element = document.createElement("div");
|
|
139
164
|
if (properties.id) {
|
|
140
|
-
element.setAttribute(
|
|
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
|
|
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:
|
|
169
|
-
title:
|
|
170
|
-
customClass:
|
|
171
|
-
bottom:
|
|
172
|
-
size:
|
|
193
|
+
type: "text",
|
|
194
|
+
title: "",
|
|
195
|
+
customClass: "",
|
|
196
|
+
bottom: "30px",
|
|
197
|
+
size: "base",
|
|
173
198
|
icon: null,
|
|
174
|
-
iconSize:
|
|
199
|
+
iconSize: "20",
|
|
175
200
|
textAlignCenter: true,
|
|
176
201
|
loadingRotate: true,
|
|
177
|
-
bgColor:
|
|
178
|
-
onClose: function onClose() {
|
|
202
|
+
bgColor: "rgba(0, 0, 0, .8)",
|
|
203
|
+
onClose: function onClose() {
|
|
204
|
+
},
|
|
179
205
|
cover: false,
|
|
180
|
-
coverColor:
|
|
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
|
|
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
|
|
229
|
+
getInstance(opts2, function(notification) {
|
|
204
230
|
messageInstance = notification;
|
|
205
231
|
});
|
|
206
232
|
}
|
|
207
|
-
var errorMsg = function
|
|
233
|
+
var errorMsg = function errorMsg2(msg) {
|
|
208
234
|
if (!msg) {
|
|
209
|
-
console.warn(
|
|
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] !==
|
|
240
|
+
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
215
241
|
errorMsg(msg);
|
|
216
242
|
return notice(_objectSpread({
|
|
217
|
-
msg
|
|
218
|
-
type:
|
|
243
|
+
msg,
|
|
244
|
+
type: "text"
|
|
219
245
|
}, option));
|
|
220
246
|
},
|
|
221
247
|
success: function success(msg) {
|
|
222
|
-
var option = arguments.length > 1 && 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
|
|
226
|
-
icon:
|
|
227
|
-
type:
|
|
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] !==
|
|
257
|
+
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
232
258
|
errorMsg(msg);
|
|
233
259
|
return notice(_objectSpread({
|
|
234
|
-
msg
|
|
235
|
-
icon:
|
|
236
|
-
type:
|
|
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] !==
|
|
266
|
+
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
241
267
|
errorMsg(msg);
|
|
242
268
|
return notice(_objectSpread({
|
|
243
|
-
msg
|
|
244
|
-
icon:
|
|
245
|
-
type:
|
|
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] !==
|
|
275
|
+
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
250
276
|
errorMsg(msg);
|
|
251
277
|
return notice(_objectSpread({
|
|
252
|
-
msg
|
|
253
|
-
icon:
|
|
254
|
-
type:
|
|
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] !==
|
|
284
|
+
var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
259
285
|
errorMsg(msg);
|
|
260
286
|
return notice(_objectSpread({
|
|
261
|
-
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 {
|
|
297
|
+
export {
|
|
298
|
+
Toast as default
|
|
299
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import '../../../packages/trendarrow/trendarrow.scss'
|
package/dist/esm/TrendArrow.js
CHANGED
|
@@ -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", "
|
|
4
|
-
function ownKeys(object, enumerableOnly) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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:
|
|
18
|
-
riseColor:
|
|
19
|
-
dropColor:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
26
|
-
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
46
|
-
var digit = arguments.length > 1 && arguments[1] !==
|
|
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("
|
|
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
|
-
|
|
71
|
-
|
|
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
|
-
|
|
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
|
|
83
|
-
var classNameSuffix = !
|
|
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(
|
|
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(
|
|
94
|
-
|
|
95
|
-
|
|
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 =
|
|
101
|
-
export {
|
|
102
|
+
TrendArrow.displayName = "NutTrendArrow";
|
|
103
|
+
export {
|
|
104
|
+
TrendArrow as default
|
|
105
|
+
};
|