@nutui/nutui-react-taro 1.3.3 → 1.3.4
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 +21 -0
- package/README.md +3 -2
- package/dist/esm/ActionSheet.js +3 -3
- package/dist/esm/Address.js +3 -3
- package/dist/esm/Audio.js +6 -7
- package/dist/esm/Avatar.js +2 -2
- package/dist/esm/BackTop.js +2 -2
- package/dist/esm/Badge.js +2 -2
- package/dist/esm/Barrage.js +2 -2
- package/dist/esm/Button.js +2 -2
- package/dist/esm/Calendar.js +3 -3
- package/dist/esm/Card.js +3 -3
- package/dist/esm/Cascader.js +4 -4
- package/dist/esm/Cell.js +2 -2
- package/dist/esm/Checkbox.js +2 -2
- package/dist/esm/CircleProgress.js +2 -2
- package/dist/esm/CollapseItem.js +2 -2
- package/dist/esm/DatePicker.js +4 -4
- package/dist/esm/Dialog.js +3 -3
- package/dist/esm/FixedNav.js +2 -2
- package/dist/esm/GridItem.js +2 -2
- package/dist/esm/ImagePreview.js +5 -5
- package/dist/esm/Infiniteloading.js +4 -2
- package/dist/esm/Input.js +2 -2
- package/dist/esm/InputNumber.js +2 -2
- package/dist/esm/Menu.js +2 -2
- package/dist/esm/MenuItem.js +2 -2
- package/dist/esm/NavBar.js +2 -2
- package/dist/esm/NoticeBar.js +2 -2
- package/dist/esm/Notify.js +2 -3
- package/dist/esm/NumberKeyboard.js +3 -3
- package/dist/esm/Picker.js +3 -3
- package/dist/esm/Popover.js +2 -2
- package/dist/esm/Popup.js +2 -2
- package/dist/esm/Progress.js +2 -2
- package/dist/esm/PullToRefresh.js +2 -2
- package/dist/esm/Radio.js +2 -2
- package/dist/esm/Range.js +3 -5
- package/dist/esm/Rate.js +2 -2
- package/dist/esm/SearchBar.js +2 -2
- package/dist/esm/ShortPassword.js +3 -3
- package/dist/esm/SideNavBar.js +3 -3
- package/dist/esm/Signature.js +3 -3
- package/dist/esm/Skeleton.js +3 -3
- package/dist/esm/Step.js +2 -2
- package/dist/esm/Sticky/style/index.js +2 -0
- package/dist/esm/Sticky.js +5 -0
- package/dist/esm/Swiper.js +3 -3
- package/dist/esm/TabbarItem.js +2 -2
- package/dist/esm/Table.js +2 -2
- package/dist/esm/Tabs.js +2 -2
- package/dist/esm/Tag.js +2 -2
- package/dist/esm/TimeSelect.js +3 -3
- package/dist/esm/Toast.js +2 -4
- package/dist/esm/Uploader.js +8 -4
- package/dist/esm/{actionsheet.taro-08b7eab2.js → actionsheet.taro-360d8d34.js} +1 -1
- package/dist/esm/{address.taro-5f8dbfc3.js → address.taro-7540c626.js} +8 -6
- package/dist/esm/{audio.taro-327472dc.js → audio.taro-ab2528b2.js} +105 -148
- package/dist/esm/{avatar.taro-766690a4.js → avatar.taro-ec620cdd.js} +5 -3
- package/dist/esm/{backtop.taro-c414da6c.js → backtop.taro-aa8b2bc5.js} +5 -3
- package/dist/esm/{badge.taro-351d0088.js → badge.taro-38684262.js} +5 -3
- package/dist/esm/{barrage.taro-efac8422.js → barrage.taro-d86c367a.js} +3 -10
- package/dist/esm/{button.taro-7074924f.js → button.taro-a9ebb937.js} +7 -5
- package/dist/esm/{calendar.taro-156a74c0.js → calendar.taro-438940bd.js} +1 -1
- package/dist/esm/{card.taro-f81f1b5c.js → card.taro-1bc35ebe.js} +1 -1
- package/dist/esm/{cascader.taro-39402f43.js → cascader.taro-35387092.js} +2 -2
- package/dist/esm/{cell.taro-075998e0.js → cell.taro-a4c3bb7b.js} +7 -5
- package/dist/esm/{checkbox.taro-62677b5e.js → checkbox.taro-104557c1.js} +2 -2
- package/dist/esm/{circleprogress.taro-1a38e1c6.js → circleprogress.taro-3c89a157.js} +85 -51
- package/dist/esm/{collapseitem-246e1699.js → collapseitem-75843a5e.js} +13 -9
- package/dist/esm/{datepicker.taro-e0e58f39.js → datepicker.taro-1acec61f.js} +1 -1
- package/dist/esm/{dialog.taro-7e9249e7.js → dialog.taro-54c67e08.js} +8 -6
- package/dist/esm/{fixednav.taro-9ee2dbea.js → fixednav.taro-582322a1.js} +5 -3
- package/dist/esm/{griditem.taro-a2ad1edd.js → griditem.taro-866cd288.js} +5 -3
- package/dist/esm/{imagepreview.taro-99659d6a.js → imagepreview.taro-3f1c7638.js} +2 -2
- package/dist/esm/{infiniteloading.taro-aa47eb1e.js → infiniteloading.taro-9701755f.js} +84 -113
- package/dist/esm/{input.taro-32fac7f7.js → input.taro-2453d7c4.js} +9 -7
- package/dist/esm/{inputnumber.taro-83d108b3.js → inputnumber.taro-0cf7c1b7.js} +7 -5
- package/dist/esm/{menu.taro-8330048e.js → menu.taro-9345dcfd.js} +5 -3
- package/dist/esm/{menuitem.taro-818c9e83.js → menuitem.taro-fc0961b7.js} +31 -14
- package/dist/esm/{navbar.taro-05d293bb.js → navbar.taro-c931c078.js} +7 -5
- package/dist/esm/{noticebar.taro-6845f9ab.js → noticebar.taro-1fa04a96.js} +9 -7
- package/dist/esm/{notify.taro-22b8f4cd.js → notify.taro-0d9cfb07.js} +38 -5
- package/dist/esm/{numberkeyboard.taro-6ff18124.js → numberkeyboard.taro-53c350b8.js} +1 -1
- package/dist/esm/nutui-react.es.js +54 -53
- package/dist/esm/{picker.taro-a3f311a0.js → picker.taro-6a4dad23.js} +1 -1
- package/dist/esm/{popover.taro-604c3116.js → popover.taro-eddd0bd2.js} +5 -3
- package/dist/esm/{popup.taro-d74c3422.js → popup.taro-33d0bbc8.js} +5 -3
- package/dist/esm/{progress.taro-57e1a455.js → progress.taro-623bc807.js} +5 -3
- package/dist/esm/{pulltorefresh.taro-8846f019.js → pulltorefresh.taro-e66c78ad.js} +0 -0
- package/dist/esm/{radio.taro-64546f70.js → radio.taro-95d43860.js} +5 -3
- package/dist/esm/{range.taro-ef3b30f0.js → range.taro-141a0163.js} +35 -12
- package/dist/esm/{rate.taro-0119c0e9.js → rate.taro-5077b962.js} +7 -5
- package/dist/esm/{searchbar.taro-2fff1f66.js → searchbar.taro-f134fb96.js} +5 -3
- package/dist/esm/{shortpassword.taro-d39e038d.js → shortpassword.taro-2e96ca22.js} +6 -4
- package/dist/esm/{sidenavbar.taro-48b136b4.js → sidenavbar.taro-87f056cd.js} +1 -1
- package/dist/esm/{signature.taro-3dbc7030.js → signature.taro-a9286cd1.js} +1 -1
- package/dist/esm/{skeleton.taro-112de52a.js → skeleton.taro-b9ff84b9.js} +1 -1
- package/dist/esm/{step.taro-8c2ba0bb.js → step.taro-f1057500.js} +5 -3
- package/dist/esm/sticky.taro-30d4e453.js +23 -0
- package/dist/esm/{swiper.taro-448cd0ad.js → swiper.taro-58ed323b.js} +4 -4
- package/dist/esm/{tabbaritem.taro-8c0a0a3b.js → tabbaritem.taro-94cd62c2.js} +5 -3
- package/dist/esm/{table.taro-04f9ec51.js → table.taro-7ac89a6c.js} +5 -3
- package/dist/esm/{tabs.taro-7bb22cb5.js → tabs.taro-86186dff.js} +12 -13
- package/dist/esm/{tag.taro-81dcc92d.js → tag.taro-95d7f5c2.js} +5 -3
- package/dist/esm/{timeselect.taro-5b6ed203.js → timeselect.taro-73796bfc.js} +1 -1
- package/dist/esm/toast.taro-cd22a0d7.js +167 -0
- package/dist/esm/types/src/packages/audio/audio.taro.d.ts +13 -14
- package/dist/esm/types/src/packages/button/demo.d.ts +1 -0
- package/dist/esm/types/src/packages/collapseitem/collapseitem.d.ts +1 -0
- package/dist/esm/types/src/packages/drag/drag.d.ts +1 -1
- package/dist/esm/types/src/packages/drag/drag.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/fixednav/fixednav.d.ts +1 -1
- package/dist/esm/types/src/packages/fixednav/fixednav.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/griditem/griditem.d.ts +1 -1
- package/dist/esm/types/src/packages/griditem/griditem.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/infiniteloading/infiniteloading.d.ts +3 -3
- package/dist/esm/types/src/packages/infiniteloading/infiniteloading.taro.d.ts +4 -6
- package/dist/esm/types/src/packages/input/input.d.ts +1 -1
- package/dist/esm/types/src/packages/input/input.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/menuitem/menuitem.d.ts +1 -1
- package/dist/esm/types/src/packages/menuitem/menuitem.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/nutui.react.build.d.ts +2 -1
- package/dist/esm/types/src/packages/nutui.react.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.scss.d.ts +1 -0
- package/dist/esm/types/src/packages/nutui.react.taro.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +2 -1
- package/dist/esm/types/src/packages/popover/popover.d.ts +1 -1
- package/dist/esm/types/src/packages/popover/popover.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/progress/progress.d.ts +1 -1
- package/dist/esm/types/src/packages/progress/progress.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/radio/radio.d.ts +1 -1
- package/dist/esm/types/src/packages/radio/radio.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/sticky/__test__/sticky.spec.d.ts +1 -0
- package/dist/esm/types/src/packages/sticky/demo.d.ts +3 -0
- package/dist/esm/types/src/packages/sticky/index.d.ts +2 -0
- package/dist/esm/types/src/packages/sticky/index.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/sticky/sticky.d.ts +13 -0
- package/dist/esm/types/src/packages/sticky/sticky.taro.d.ts +4 -0
- package/dist/esm/types/src/packages/tabs/tabs.d.ts +1 -1
- package/dist/esm/types/src/packages/tabs/tabs.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/toast/index.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/toast/toast.taro.d.ts +11 -17
- package/dist/esm/types/src/packages/uploader/demo.d.ts +1 -0
- package/dist/esm/types/src/packages/uploader/upload.d.ts +4 -0
- package/dist/esm/types/src/packages/uploader/uploader.d.ts +16 -12
- package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +39 -19
- package/dist/esm/types/src/utils/date.d.ts +1 -1
- package/dist/esm/types/src/utils/useWatch.d.ts +6 -0
- package/dist/esm/{uploader.taro-4fd5dd3c.js → uploader.taro-6184abe7.js} +181 -131
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/nutui.react.es.js +1357 -1235
- package/dist/nutui.react.umd.js +1356 -1233
- package/dist/packages/barrage/barrage.scss +7 -2
- package/dist/packages/circleprogress/circleprogress.scss +3 -0
- package/dist/packages/sticky/sticky.scss +0 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +1 -0
- package/dist/types/index.d.ts +75 -64
- package/dist/types/nutui.taro.react.build.ts +3 -1
- package/package.json +10 -5
- package/dist/esm/render-4a3856cb.js +0 -32
- package/dist/esm/toast.taro-d4ecd6af.js +0 -300
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
|
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
|
|
15
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
-
|
|
17
|
-
import * as React from 'react';
|
|
18
|
-
import * as ReactDOM from 'react-dom';
|
|
19
|
-
import classNames from 'classnames';
|
|
20
|
-
import { c as cn } from './bem-893ad28d.js';
|
|
21
|
-
import { I as Icon } from './icon-8dc4de10.js';
|
|
22
|
-
import { r as render } from './render-4a3856cb.js';
|
|
23
|
-
|
|
24
|
-
var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
25
|
-
_inherits(Notification, _React$PureComponent);
|
|
26
|
-
|
|
27
|
-
var _super = _createSuper(Notification);
|
|
28
|
-
|
|
29
|
-
function Notification(props) {
|
|
30
|
-
var _this;
|
|
31
|
-
|
|
32
|
-
_classCallCheck(this, Notification);
|
|
33
|
-
|
|
34
|
-
_this = _super.call(this, props);
|
|
35
|
-
|
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "closeTimer", void 0);
|
|
37
|
-
|
|
38
|
-
_this.close = _this.close.bind(_assertThisInitialized(_this));
|
|
39
|
-
_this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
|
|
40
|
-
_this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
|
|
41
|
-
_this.close = _this.close.bind(_assertThisInitialized(_this));
|
|
42
|
-
_this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
|
|
43
|
-
return _this;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
_createClass(Notification, [{
|
|
47
|
-
key: "close",
|
|
48
|
-
value: function close() {
|
|
49
|
-
this.clearCloseTimer();
|
|
50
|
-
this.props.onClose();
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "startCloseTimer",
|
|
54
|
-
value: function startCloseTimer() {
|
|
55
|
-
var _this2 = this;
|
|
56
|
-
|
|
57
|
-
var duration = this.props.duration;
|
|
58
|
-
|
|
59
|
-
if (duration) {
|
|
60
|
-
this.closeTimer = window.setTimeout(function () {
|
|
61
|
-
_this2.close();
|
|
62
|
-
}, duration * 1000);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "clearCloseTimer",
|
|
67
|
-
value: function clearCloseTimer() {
|
|
68
|
-
if (this.closeTimer) {
|
|
69
|
-
clearTimeout(this.closeTimer);
|
|
70
|
-
this.closeTimer = -1;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "clickCover",
|
|
75
|
-
value: function clickCover() {
|
|
76
|
-
var closeOnClickOverlay = this.props.closeOnClickOverlay;
|
|
77
|
-
|
|
78
|
-
if (closeOnClickOverlay) {
|
|
79
|
-
this.close();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
key: "componentDidMount",
|
|
84
|
-
value: function componentDidMount() {
|
|
85
|
-
this.startCloseTimer();
|
|
86
|
-
}
|
|
87
|
-
}, {
|
|
88
|
-
key: "componentWillUnmount",
|
|
89
|
-
value: function componentWillUnmount() {
|
|
90
|
-
this.clearCloseTimer();
|
|
91
|
-
}
|
|
92
|
-
}, {
|
|
93
|
-
key: "render",
|
|
94
|
-
value: function render() {
|
|
95
|
-
var _classNames,
|
|
96
|
-
_this3 = this;
|
|
97
|
-
|
|
98
|
-
var _this$props = this.props,
|
|
99
|
-
id = _this$props.id,
|
|
100
|
-
style = _this$props.style,
|
|
101
|
-
icon = _this$props.icon,
|
|
102
|
-
iconSize = _this$props.iconSize,
|
|
103
|
-
title = _this$props.title,
|
|
104
|
-
msg = _this$props.msg,
|
|
105
|
-
bottom = _this$props.bottom,
|
|
106
|
-
center = _this$props.center,
|
|
107
|
-
bgColor = _this$props.bgColor,
|
|
108
|
-
coverColor = _this$props.coverColor,
|
|
109
|
-
textAlignCenter = _this$props.textAlignCenter,
|
|
110
|
-
size = _this$props.size,
|
|
111
|
-
customClass = _this$props.customClass,
|
|
112
|
-
cover = _this$props.cover,
|
|
113
|
-
type = _this$props.type;
|
|
114
|
-
var toastBem = cn('toast');
|
|
115
|
-
var classes = classNames((_classNames = {
|
|
116
|
-
'nut-toast-center': center,
|
|
117
|
-
'nut-toast-has-icon': icon,
|
|
118
|
-
'nut-toast-cover': cover,
|
|
119
|
-
'nut-toast-loading': type === 'loading'
|
|
120
|
-
}, _defineProperty(_classNames, "".concat(customClass), true), _defineProperty(_classNames, "nut-toast-".concat(size), true), _classNames));
|
|
121
|
-
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
122
|
-
className: "".concat(toastBem(), " ").concat(classes),
|
|
123
|
-
id: "toast-".concat(id),
|
|
124
|
-
style: _objectSpread({
|
|
125
|
-
bottom: center ? 'auto' : "".concat(bottom),
|
|
126
|
-
backgroundColor: cover ? coverColor : ''
|
|
127
|
-
}, style),
|
|
128
|
-
onClick: function onClick() {
|
|
129
|
-
_this3.clickCover();
|
|
130
|
-
}
|
|
131
|
-
}, React.createElement("div", {
|
|
132
|
-
className: toastBem('inner'),
|
|
133
|
-
style: {
|
|
134
|
-
textAlign: textAlignCenter ? 'center' : 'left',
|
|
135
|
-
backgroundColor: bgColor
|
|
136
|
-
}
|
|
137
|
-
}, icon ? React.createElement("p", {
|
|
138
|
-
className: toastBem('icon-wrapper')
|
|
139
|
-
}, React.createElement(Icon, {
|
|
140
|
-
name: icon || '',
|
|
141
|
-
color: "#ffffff",
|
|
142
|
-
size: iconSize
|
|
143
|
-
})) : null, title ? React.createElement("div", {
|
|
144
|
-
className: "nut-toast-title"
|
|
145
|
-
}, title) : null, React.createElement("span", {
|
|
146
|
-
className: toastBem('text')
|
|
147
|
-
}, msg))));
|
|
148
|
-
}
|
|
149
|
-
}]);
|
|
150
|
-
|
|
151
|
-
return Notification;
|
|
152
|
-
}(React.PureComponent);
|
|
153
|
-
|
|
154
|
-
_defineProperty(Notification, "newInstance", void 0);
|
|
155
|
-
|
|
156
|
-
Notification.newInstance = function (properties, callback) {
|
|
157
|
-
var element = document.createElement('div');
|
|
158
|
-
|
|
159
|
-
if (properties.id) {
|
|
160
|
-
element.setAttribute('id', "".concat(properties.id));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
document.body.appendChild(element);
|
|
164
|
-
var called = false;
|
|
165
|
-
|
|
166
|
-
function ref(instance) {
|
|
167
|
-
if (called) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
called = true;
|
|
172
|
-
callback({
|
|
173
|
-
component: instance,
|
|
174
|
-
destroy: function destroy() {
|
|
175
|
-
ReactDOM.unmountComponentAtNode(element);
|
|
176
|
-
element && element.parentNode && element.parentNode.removeChild(element);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
|
|
182
|
-
ref: ref
|
|
183
|
-
})), element);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
var messageInstance = null;
|
|
187
|
-
var options = {
|
|
188
|
-
msg: '',
|
|
189
|
-
id: '',
|
|
190
|
-
duration: 1.5,
|
|
191
|
-
center: true,
|
|
192
|
-
type: 'text',
|
|
193
|
-
customClass: '',
|
|
194
|
-
bottom: 30,
|
|
195
|
-
size: 'base',
|
|
196
|
-
icon: '',
|
|
197
|
-
textAlignCenter: true,
|
|
198
|
-
loadingRotate: true,
|
|
199
|
-
bgColor: 'rgba(0, 0, 0, .8)',
|
|
200
|
-
onClose: function onClose() {},
|
|
201
|
-
cover: false,
|
|
202
|
-
coverColor: 'rgba(0, 0, 0, 0)',
|
|
203
|
-
closeOnClickOverlay: false // 是否点击遮罩可关闭
|
|
204
|
-
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
function getInstance(props, callback) {
|
|
208
|
-
if (messageInstance) {
|
|
209
|
-
messageInstance.destroy();
|
|
210
|
-
messageInstance = null;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
Notification.newInstance(props, function (notification) {
|
|
214
|
-
return callback && callback(notification);
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function notice(opts) {
|
|
219
|
-
function close() {
|
|
220
|
-
if (messageInstance) {
|
|
221
|
-
messageInstance.destroy();
|
|
222
|
-
messageInstance = null;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
var opts2 = _objectSpread(_objectSpread(_objectSpread({}, options), opts), {}, {
|
|
227
|
-
onClose: close
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
getInstance(opts2, function (notification) {
|
|
231
|
-
messageInstance = notification;
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
var errorMsg = function errorMsg(msg) {
|
|
236
|
-
if (!msg) {
|
|
237
|
-
console.warn('[NutUI Toast]: msg cannot be null');
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
var Toast = {
|
|
242
|
-
text: function text(msg) {
|
|
243
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
244
|
-
errorMsg(msg);
|
|
245
|
-
return notice(_objectSpread({
|
|
246
|
-
msg: msg,
|
|
247
|
-
type: 'text'
|
|
248
|
-
}, option));
|
|
249
|
-
},
|
|
250
|
-
success: function success(msg) {
|
|
251
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
252
|
-
errorMsg(msg);
|
|
253
|
-
return notice(_objectSpread({
|
|
254
|
-
msg: msg,
|
|
255
|
-
icon: 'success',
|
|
256
|
-
type: 'success'
|
|
257
|
-
}, option));
|
|
258
|
-
},
|
|
259
|
-
fail: function fail(msg) {
|
|
260
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
261
|
-
errorMsg(msg);
|
|
262
|
-
return notice(_objectSpread({
|
|
263
|
-
msg: msg,
|
|
264
|
-
icon: 'failure',
|
|
265
|
-
type: 'fail'
|
|
266
|
-
}, option));
|
|
267
|
-
},
|
|
268
|
-
loading: function loading(msg) {
|
|
269
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
270
|
-
errorMsg(msg);
|
|
271
|
-
return notice(_objectSpread({
|
|
272
|
-
msg: msg,
|
|
273
|
-
icon: 'loading',
|
|
274
|
-
type: 'loading'
|
|
275
|
-
}, option));
|
|
276
|
-
},
|
|
277
|
-
warn: function warn(msg) {
|
|
278
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
279
|
-
errorMsg(msg);
|
|
280
|
-
return notice(_objectSpread({
|
|
281
|
-
msg: msg,
|
|
282
|
-
icon: 'tips',
|
|
283
|
-
type: 'warn'
|
|
284
|
-
}, option));
|
|
285
|
-
},
|
|
286
|
-
customIcon: function customIcon(msg) {
|
|
287
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
288
|
-
errorMsg(msg);
|
|
289
|
-
return notice(_objectSpread({
|
|
290
|
-
msg: msg
|
|
291
|
-
}, option));
|
|
292
|
-
},
|
|
293
|
-
hide: function hide() {
|
|
294
|
-
if (messageInstance) {
|
|
295
|
-
messageInstance.destroy();
|
|
296
|
-
messageInstance = null;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
export { Toast as T };
|