@nutui/nutui-react 0.1.0-beta.1 → 0.1.2
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/README.md +50 -135
- package/dist/esm/ActionSheet/style/index.js +1 -0
- package/dist/esm/Address/style/index.js +1 -0
- package/dist/esm/AnimatingNumbers/style/index.js +1 -0
- package/dist/esm/Avatar/style/index.js +1 -0
- package/dist/esm/BackTop/style/index.js +1 -0
- package/dist/esm/BackTop.js +1 -3
- package/dist/esm/Badge/style/index.js +1 -0
- package/dist/esm/Barrage/style/index.js +1 -0
- package/dist/esm/Button/style/index.js +1 -0
- package/dist/esm/Button.js +110 -4
- package/dist/esm/Calendar/style/index.js +1 -0
- package/dist/esm/Calendar.js +86 -0
- package/dist/esm/CalendarItem/style/index.js +1 -0
- package/dist/esm/CalendarItem.js +554 -0
- package/dist/esm/Cell/style/index.js +1 -0
- package/dist/esm/Cell.js +1 -1
- package/dist/esm/CellGroup/style/index.js +1 -0
- package/dist/esm/CellGroup.js +33 -0
- package/dist/esm/Checkbox/style/index.js +1 -0
- package/dist/esm/Checkbox.js +1 -1
- package/dist/esm/CheckboxGroup/style/index.js +1 -0
- package/dist/esm/CircleProgress/style/index.js +1 -0
- package/dist/esm/Col/style/index.js +1 -0
- package/dist/esm/Col.js +60 -0
- package/dist/esm/Collapse/style/index.js +1 -0
- package/dist/esm/CollapseItem/style/index.js +1 -0
- package/dist/esm/CollapseItem.js +142 -0
- package/dist/esm/Dialog/style/index.js +1 -0
- package/dist/esm/Dialog.js +327 -0
- package/dist/esm/Divider/style/index.js +1 -0
- package/dist/esm/Drag/style/index.js +1 -0
- package/dist/esm/Drag.js +83 -140
- package/dist/esm/Elevator/style/index.js +1 -0
- package/dist/esm/Elevator.js +3 -6
- package/dist/esm/FixedNav/style/index.js +1 -0
- package/dist/esm/FixedNav.js +2 -2
- package/dist/esm/Icon/style/index.js +1 -0
- package/dist/esm/Icon.js +70 -4
- package/dist/esm/Infiniteloading/style/index.js +1 -0
- package/dist/esm/Input/style/index.js +1 -0
- package/dist/esm/Input.js +1 -1
- package/dist/esm/InputNumber/style/index.js +1 -0
- package/dist/esm/Layout/style/index.js +1 -0
- package/dist/esm/NavBar/style/index.js +1 -0
- package/dist/esm/NavBar.js +1 -1
- package/dist/esm/NoticeBar/style/index.js +1 -0
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/Notify/style/index.js +1 -0
- package/dist/esm/Overlay/style/index.js +1 -0
- package/dist/esm/Pagination/style/index.js +1 -0
- package/dist/esm/Picker/style/index.js +1 -0
- package/dist/esm/Picker.js +397 -0
- package/dist/esm/Popover/style/index.js +1 -0
- package/dist/esm/Popover.js +299 -0
- package/dist/esm/Popup/style/index.js +1 -0
- package/dist/esm/Popup.js +0 -3
- package/dist/esm/Price/style/index.js +1 -0
- package/dist/esm/Radio/style/index.js +1 -0
- package/dist/esm/Radio.js +2 -3
- package/dist/esm/RadioGroup/style/index.js +1 -0
- package/dist/esm/Range/style/index.js +1 -0
- package/dist/esm/Range.js +1 -4
- package/dist/esm/Rate/style/index.js +1 -0
- package/dist/esm/Rate.js +1 -1
- package/dist/esm/Row/style/index.js +1 -0
- package/dist/esm/Row.js +48 -0
- package/dist/esm/ShortPassword/style/index.js +1 -0
- package/dist/esm/ShortPassword.js +203 -0
- package/dist/esm/Signature/style/index.js +1 -0
- package/dist/esm/Signature.js +1 -2
- package/dist/esm/Step/style/index.js +1 -0
- package/dist/esm/Steps/style/index.js +1 -0
- package/dist/esm/Swiper/style/index.js +1 -0
- package/dist/esm/Swiper.js +517 -0
- package/dist/esm/SwiperItem/style/index.js +1 -0
- package/dist/esm/SwiperItem.js +64 -0
- package/dist/esm/Switch/style/index.js +1 -0
- package/dist/esm/Switch.js +85 -0
- package/dist/esm/Tabbar/style/index.js +1 -0
- package/dist/esm/Tabbar.js +1 -4
- package/dist/esm/TabbarItem/style/index.js +1 -0
- package/dist/esm/TabbarItem.js +1 -1
- package/dist/esm/Tag/style/index.js +1 -0
- package/dist/esm/TextArea/style/index.js +1 -0
- package/dist/esm/Toast/style/index.js +1 -0
- package/dist/esm/Toast.js +294 -7
- package/dist/esm/Uploader/style/index.js +1 -0
- package/dist/esm/UserContext-b4181162.js +3 -0
- package/dist/esm/UserContext-be8097d2.js +3 -0
- package/dist/esm/date-649fe493.js +112 -0
- package/dist/esm/nutui-react.es.js +28 -15
- package/dist/esm/types/src/packages/calendar/calendar.d.ts +14 -0
- package/dist/esm/types/src/packages/calendar/index.d.ts +2 -0
- package/dist/esm/types/src/packages/calendaritem/calendaritem.d.ts +17 -0
- package/dist/esm/types/src/packages/calendaritem/index.d.ts +2 -0
- package/dist/esm/types/src/packages/dialog/Confirm.d.ts +7 -0
- package/dist/esm/types/src/packages/dialog/Content.d.ts +10 -0
- package/dist/esm/types/src/packages/dialog/DialogWrap.d.ts +11 -0
- package/dist/esm/types/src/packages/dialog/DialogWrapper.d.ts +8 -0
- package/dist/esm/types/src/packages/dialog/Mask.d.ts +3 -0
- package/dist/esm/types/src/packages/dialog/config.d.ts +46 -0
- package/dist/esm/types/src/packages/dialog/dialog.d.ts +2 -0
- package/dist/esm/types/src/packages/dialog/index.d.ts +2 -0
- package/dist/esm/types/src/packages/drag/drag.d.ts +1 -1
- package/dist/esm/types/src/packages/nutui.react.build.d.ts +29 -16
- package/dist/esm/types/src/packages/nutui.react.d.ts +29 -16
- package/dist/esm/types/src/packages/picker/index.d.ts +2 -0
- package/dist/esm/types/src/packages/picker/picker.d.ts +19 -0
- package/dist/esm/types/src/packages/picker/pickerSlot.d.ts +10 -0
- package/dist/esm/types/src/packages/popover/Trigger.d.ts +21 -0
- package/dist/esm/types/src/packages/popover/index.d.ts +2 -0
- package/dist/esm/types/src/packages/popover/popover.d.ts +13 -0
- package/dist/esm/types/src/packages/row/UserContext.d.ts +1 -0
- package/dist/esm/types/src/packages/shortpassword/index.d.ts +2 -0
- package/dist/esm/types/src/packages/shortpassword/shortpassword.d.ts +21 -0
- package/dist/esm/types/src/packages/steps/UserContext.d.ts +1 -0
- package/dist/esm/types/src/packages/swiper/UserContext.d.ts +2 -0
- package/dist/esm/types/src/packages/swiper/index.d.ts +2 -0
- package/dist/esm/types/src/packages/swiper/swiper.d.ts +26 -0
- package/dist/esm/types/src/packages/swiperitem/index.d.ts +2 -0
- package/dist/esm/types/src/packages/swiperitem/swiperitem.d.ts +7 -0
- package/dist/nutui.react.es.js +10683 -4344
- package/dist/nutui.react.umd.js +26 -17
- package/dist/packages/actionsheet/actionsheet.scss +1 -0
- package/dist/packages/address/address.scss +3 -0
- package/dist/packages/animatingnumbers/animatingnumbers.scss +1 -1
- package/dist/packages/backtop/backtop.scss +1 -0
- package/dist/packages/button/button.scss +1 -1
- package/dist/packages/calendar/calendar.scss +200 -0
- package/dist/packages/calendaritem/calendaritem.scss +191 -0
- package/dist/packages/cell/cell.scss +2 -0
- package/dist/packages/checkbox/checkbox.scss +1 -1
- package/dist/packages/collapse/collapse.scss +1 -1
- package/dist/packages/collapseitem/collapseitem.scss +2 -0
- package/dist/packages/dialog/dialog.scss +129 -0
- package/dist/packages/drag/drag.scss +2 -1
- package/dist/packages/fixednav/fixednav.scss +5 -0
- package/dist/packages/icon/icon.scss +1 -1
- package/dist/packages/infiniteloading/infiniteloading.scss +1 -0
- package/dist/packages/input/input.scss +1 -0
- package/dist/packages/inputnumber/inputnumber.scss +1 -0
- package/dist/packages/navbar/navbar.scss +2 -0
- package/dist/packages/noticebar/noticebar.scss +2 -0
- package/dist/packages/picker/picker.scss +104 -0
- package/dist/packages/popover/popover.scss +142 -0
- package/dist/packages/popup/popup.scss +2 -0
- package/dist/packages/radio/radio.scss +2 -0
- package/dist/packages/range/range.scss +1 -0
- package/dist/packages/rate/rate.scss +2 -0
- package/dist/packages/shortpassword/shortpassword.scss +115 -0
- package/dist/packages/signature/signature.scss +1 -0
- package/dist/packages/step/step.scss +1 -0
- package/dist/packages/swiper/swiper.scss +45 -0
- package/dist/packages/swiperitem/swiperitem.scss +3 -0
- package/dist/packages/tabbaritem/{tabbarItem.scss → tabbaritem.scss} +2 -0
- package/dist/packages/tag/tag.scss +1 -0
- package/dist/packages/toast/toast.scss +2 -0
- package/dist/packages/uploader/uploader.scss +2 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +26 -16
- package/dist/styles/variables.scss +25 -0
- package/package.json +16 -5
- package/dist/esm/button-345fb015.js +0 -110
- package/dist/esm/icon-63c0d58f.js +0 -70
- package/dist/esm/toast-420b65b7.js +0 -294
package/dist/esm/TabbarItem.js
CHANGED
|
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
import React__default, { useEffect } from 'react';
|
|
8
8
|
import { c as cn } from './bem-893ad28d.js';
|
|
9
|
-
import
|
|
9
|
+
import Icon from './Icon.js';
|
|
10
10
|
import '@bem-react/classname';
|
|
11
11
|
var defaultProps = {
|
|
12
12
|
tabTitle: '',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../../packages/tag/tag.scss'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../../packages/textarea/textarea.scss'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../../packages/toast/toast.scss'
|
package/dist/esm/Toast.js
CHANGED
|
@@ -1,8 +1,295 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
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 { c as cn } from './bem-893ad28d.js';
|
|
20
|
+
import Icon from './Icon.js';
|
|
21
|
+
import classNames from 'classnames';
|
|
6
22
|
import '@bem-react/classname';
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
_this.state = {
|
|
44
|
+
show: true
|
|
45
|
+
};
|
|
46
|
+
return _this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_createClass(Notification, [{
|
|
50
|
+
key: "close",
|
|
51
|
+
value: function close() {
|
|
52
|
+
this.setState({
|
|
53
|
+
show: false
|
|
54
|
+
});
|
|
55
|
+
this.clearCloseTimer();
|
|
56
|
+
this.props.onClose();
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "startCloseTimer",
|
|
60
|
+
value: function startCloseTimer() {
|
|
61
|
+
var _this2 = this;
|
|
62
|
+
|
|
63
|
+
var duration = this.props.duration;
|
|
64
|
+
|
|
65
|
+
if (duration) {
|
|
66
|
+
this.closeTimer = window.setTimeout(function () {
|
|
67
|
+
_this2.close();
|
|
68
|
+
}, duration * 1000);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
key: "clearCloseTimer",
|
|
73
|
+
value: function clearCloseTimer() {
|
|
74
|
+
if (this.closeTimer) {
|
|
75
|
+
clearTimeout(this.closeTimer);
|
|
76
|
+
this.closeTimer = -1;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "clickCover",
|
|
81
|
+
value: function clickCover() {
|
|
82
|
+
var closeOnClickOverlay = this.props.closeOnClickOverlay;
|
|
83
|
+
|
|
84
|
+
if (closeOnClickOverlay) {
|
|
85
|
+
this.close();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "componentDidMount",
|
|
90
|
+
value: function componentDidMount() {
|
|
91
|
+
this.startCloseTimer();
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "componentWillUnmount",
|
|
95
|
+
value: function componentWillUnmount() {
|
|
96
|
+
this.clearCloseTimer();
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "render",
|
|
100
|
+
value: function render() {
|
|
101
|
+
var _classNames,
|
|
102
|
+
_this3 = this;
|
|
103
|
+
|
|
104
|
+
var _this$props = this.props,
|
|
105
|
+
style = _this$props.style,
|
|
106
|
+
icon = _this$props.icon,
|
|
107
|
+
msg = _this$props.msg,
|
|
108
|
+
bottom = _this$props.bottom,
|
|
109
|
+
center = _this$props.center,
|
|
110
|
+
bgColor = _this$props.bgColor,
|
|
111
|
+
coverColor = _this$props.coverColor,
|
|
112
|
+
textAlignCenter = _this$props.textAlignCenter,
|
|
113
|
+
size = _this$props.size,
|
|
114
|
+
customClass = _this$props.customClass,
|
|
115
|
+
cover = _this$props.cover,
|
|
116
|
+
type = _this$props.type;
|
|
117
|
+
this.state;
|
|
118
|
+
var toastBem = cn('toast');
|
|
119
|
+
var classes = classNames((_classNames = {}, _defineProperty(_classNames, 'nut-toast-center', center), _defineProperty(_classNames, 'nut-toast-has-icon', icon), _defineProperty(_classNames, 'nut-toast-cover', cover), _defineProperty(_classNames, 'nut-toast-loading', type === 'loading'), _defineProperty(_classNames, "customClass", customClass), _defineProperty(_classNames, 'nut-toast-' + size, true), _classNames));
|
|
120
|
+
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
121
|
+
className: "".concat(toastBem(), " ").concat(classes),
|
|
122
|
+
style: {
|
|
123
|
+
bottom: center ? 'auto' : bottom + 'px',
|
|
124
|
+
backgroundColor: cover ? coverColor : ''
|
|
125
|
+
},
|
|
126
|
+
onClick: function onClick() {
|
|
127
|
+
_this3.clickCover();
|
|
128
|
+
}
|
|
129
|
+
}, React.createElement("div", {
|
|
130
|
+
className: toastBem('inner'),
|
|
131
|
+
style: {
|
|
132
|
+
textAlign: textAlignCenter ? 'center' : 'left',
|
|
133
|
+
backgroundColor: bgColor
|
|
134
|
+
}
|
|
135
|
+
}, icon ? React.createElement("p", {
|
|
136
|
+
className: toastBem('icon-wrapper')
|
|
137
|
+
}, React.createElement(Icon, {
|
|
138
|
+
name: icon ? icon : '',
|
|
139
|
+
size: "20"
|
|
140
|
+
})) : null, React.createElement("span", {
|
|
141
|
+
className: toastBem('text')
|
|
142
|
+
}, msg))));
|
|
143
|
+
}
|
|
144
|
+
}]);
|
|
145
|
+
|
|
146
|
+
return Notification;
|
|
147
|
+
}(React.PureComponent);
|
|
148
|
+
|
|
149
|
+
_defineProperty(Notification, "newInstance", void 0);
|
|
150
|
+
|
|
151
|
+
Notification.newInstance = function (properties, callback) {
|
|
152
|
+
var element = document.createElement('div');
|
|
153
|
+
|
|
154
|
+
if (properties.id) {
|
|
155
|
+
element.setAttribute('id', "".concat(properties.id));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
document.body.appendChild(element);
|
|
159
|
+
var called = false;
|
|
160
|
+
|
|
161
|
+
function ref(instance) {
|
|
162
|
+
if (called) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
called = true;
|
|
167
|
+
callback({
|
|
168
|
+
component: instance,
|
|
169
|
+
destroy: function destroy() {
|
|
170
|
+
ReactDOM.unmountComponentAtNode(element);
|
|
171
|
+
element && element.parentNode && element.parentNode.removeChild(element);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
ReactDOM.render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
|
|
177
|
+
ref: ref
|
|
178
|
+
})), element);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
var messageInstance = null;
|
|
182
|
+
var options = {
|
|
183
|
+
msg: '',
|
|
184
|
+
id: '',
|
|
185
|
+
duration: 1.5,
|
|
186
|
+
center: true,
|
|
187
|
+
type: 'text',
|
|
188
|
+
customClass: '',
|
|
189
|
+
bottom: 30,
|
|
190
|
+
size: 'base',
|
|
191
|
+
icon: '',
|
|
192
|
+
textAlignCenter: true,
|
|
193
|
+
loadingRotate: true,
|
|
194
|
+
bgColor: 'rgba(0, 0, 0, .8)',
|
|
195
|
+
onClose: function onClose() {},
|
|
196
|
+
cover: false,
|
|
197
|
+
coverColor: 'rgba(0, 0, 0, 0)',
|
|
198
|
+
closeOnClickOverlay: false // 是否点击遮罩可关闭
|
|
199
|
+
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
function getInstance(props, callback) {
|
|
203
|
+
if (messageInstance) {
|
|
204
|
+
messageInstance.destroy();
|
|
205
|
+
messageInstance = null;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
Notification.newInstance(props, function (notification) {
|
|
209
|
+
return callback && callback(notification);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function notice(opts) {
|
|
214
|
+
function close() {
|
|
215
|
+
if (messageInstance) {
|
|
216
|
+
messageInstance.destroy();
|
|
217
|
+
messageInstance = null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
opts = _objectSpread(_objectSpread(_objectSpread({}, options), opts), {}, {
|
|
222
|
+
onClose: close
|
|
223
|
+
});
|
|
224
|
+
getInstance(opts, function (notification) {
|
|
225
|
+
messageInstance = notification;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
var errorMsg = function errorMsg(msg) {
|
|
230
|
+
if (!msg) {
|
|
231
|
+
console.warn('[NutUI Toast]: msg不能为空');
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
var Toast = {
|
|
237
|
+
text: function text(msg) {
|
|
238
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
239
|
+
errorMsg(msg);
|
|
240
|
+
return notice(_objectSpread({
|
|
241
|
+
msg: msg,
|
|
242
|
+
type: 'text'
|
|
243
|
+
}, option));
|
|
244
|
+
},
|
|
245
|
+
success: function success(msg) {
|
|
246
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
247
|
+
errorMsg(msg);
|
|
248
|
+
return notice(_objectSpread({
|
|
249
|
+
msg: msg,
|
|
250
|
+
icon: 'success',
|
|
251
|
+
type: 'success'
|
|
252
|
+
}, option));
|
|
253
|
+
},
|
|
254
|
+
fail: function fail(msg) {
|
|
255
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
256
|
+
errorMsg(msg);
|
|
257
|
+
return notice(_objectSpread({
|
|
258
|
+
msg: msg,
|
|
259
|
+
icon: 'failure',
|
|
260
|
+
type: 'fail'
|
|
261
|
+
}, option));
|
|
262
|
+
},
|
|
263
|
+
loading: function loading(msg) {
|
|
264
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
265
|
+
errorMsg(msg);
|
|
266
|
+
return notice(_objectSpread({
|
|
267
|
+
msg: msg,
|
|
268
|
+
icon: 'loading',
|
|
269
|
+
type: 'loading'
|
|
270
|
+
}, option));
|
|
271
|
+
},
|
|
272
|
+
warn: function warn(msg) {
|
|
273
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
274
|
+
errorMsg(msg);
|
|
275
|
+
return notice(_objectSpread({
|
|
276
|
+
msg: msg,
|
|
277
|
+
icon: 'tips',
|
|
278
|
+
type: 'warn'
|
|
279
|
+
}, option));
|
|
280
|
+
},
|
|
281
|
+
customIcon: function customIcon(msg) {
|
|
282
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
283
|
+
errorMsg(msg);
|
|
284
|
+
return notice(_objectSpread({
|
|
285
|
+
msg: msg
|
|
286
|
+
}, option));
|
|
287
|
+
},
|
|
288
|
+
hide: function hide() {
|
|
289
|
+
if (messageInstance) {
|
|
290
|
+
messageInstance.destroy();
|
|
291
|
+
messageInstance = null;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
export { Toast as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../../packages/uploader/uploader.scss'
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var Utils = {
|
|
2
|
+
/**
|
|
3
|
+
* 是否为闫年
|
|
4
|
+
* @return {Boolse} true|false
|
|
5
|
+
*/
|
|
6
|
+
isLeapYear: function isLeapYear(y) {
|
|
7
|
+
return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 返回星期数
|
|
12
|
+
* @return {String}
|
|
13
|
+
*/
|
|
14
|
+
getWhatDay: function getWhatDay(year, month, day) {
|
|
15
|
+
var date = new Date(year + '/' + month + '/' + day);
|
|
16
|
+
var index = date.getDay();
|
|
17
|
+
var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
|
|
18
|
+
return dayNames[index];
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 返回星期数
|
|
23
|
+
* @return {Number}
|
|
24
|
+
*/
|
|
25
|
+
getMonthPreDay: function getMonthPreDay(year, month) {
|
|
26
|
+
var date = new Date(year + '/' + month + '/01');
|
|
27
|
+
var day = date.getDay();
|
|
28
|
+
|
|
29
|
+
if (day == 0) {
|
|
30
|
+
day = 7;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return day;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 返回月份天数
|
|
38
|
+
* @return {Number}
|
|
39
|
+
*/
|
|
40
|
+
getMonthDays: function getMonthDays(year, month) {
|
|
41
|
+
if (/^0/.test(month)) {
|
|
42
|
+
month = month.split('')[1];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return [0, 31, this.isLeapYear(Number(year)) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 补齐数字位数
|
|
50
|
+
* @return {string}
|
|
51
|
+
*/
|
|
52
|
+
getNumTwoBit: function getNumTwoBit(n) {
|
|
53
|
+
n = Number(n);
|
|
54
|
+
return (n > 9 ? '' : '0') + n;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 日期对象转成字符串
|
|
59
|
+
* @return {string}
|
|
60
|
+
*/
|
|
61
|
+
date2Str: function date2Str(date, split) {
|
|
62
|
+
split = split || '-';
|
|
63
|
+
var y = date.getFullYear();
|
|
64
|
+
var m = this.getNumTwoBit(date.getMonth() + 1);
|
|
65
|
+
var d = this.getNumTwoBit(date.getDate());
|
|
66
|
+
return [y, m, d].join(split);
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 返回日期格式字符串
|
|
71
|
+
* @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
|
|
72
|
+
* @return {string} '2014-12-31'
|
|
73
|
+
*/
|
|
74
|
+
getDay: function getDay(i) {
|
|
75
|
+
i = i || 0;
|
|
76
|
+
var date = new Date();
|
|
77
|
+
var diff = i * (1000 * 60 * 60 * 24);
|
|
78
|
+
date = new Date(date.getTime() + diff);
|
|
79
|
+
return this.date2Str(date);
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 时间比较
|
|
84
|
+
* @return {Boolean}
|
|
85
|
+
*/
|
|
86
|
+
compareDate: function compareDate(date1, date2) {
|
|
87
|
+
var startTime = new Date(date1.replace('-', '/').replace('-', '/'));
|
|
88
|
+
var endTime = new Date(date2.replace('-', '/').replace('-', '/'));
|
|
89
|
+
|
|
90
|
+
if (startTime >= endTime) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return true;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 时间是否相等
|
|
99
|
+
* @return {Boolean}
|
|
100
|
+
*/
|
|
101
|
+
isEqual: function isEqual(date1, date2) {
|
|
102
|
+
var startTime = new Date(date1).getTime();
|
|
103
|
+
var endTime = new Date(date2).getTime();
|
|
104
|
+
|
|
105
|
+
if (startTime == endTime) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
export { Utils as U };
|
|
@@ -1,42 +1,55 @@
|
|
|
1
1
|
export { default as Avatar } from './Avatar.js';
|
|
2
2
|
export { default as Button } from './Button.js';
|
|
3
3
|
export { default as Cell } from './Cell.js';
|
|
4
|
+
export { default as CellGroup } from './CellGroup.js';
|
|
4
5
|
export { default as Icon } from './Icon.js';
|
|
5
6
|
export { default as Price } from './Price.js';
|
|
6
7
|
export { default as Overlay } from './Overlay.js';
|
|
7
8
|
export { default as Divider } from './Divider.js';
|
|
8
9
|
export { default as Layout } from './Layout.js';
|
|
9
|
-
export { default as
|
|
10
|
-
export { default as
|
|
10
|
+
export { default as Row } from './Row.js';
|
|
11
|
+
export { default as Col } from './Col.js';
|
|
11
12
|
export { default as Toast } from './Toast.js';
|
|
12
|
-
export { default as
|
|
13
|
-
export { default as Range } from './Range.js';
|
|
14
|
-
export { default as Infiniteloading } from './Infiniteloading.js';
|
|
15
|
-
export { default as Steps } from './Steps.js';
|
|
16
|
-
export { default as Step } from './Step.js';
|
|
17
|
-
export { default as CircleProgress } from './CircleProgress.js';
|
|
13
|
+
export { default as Dialog } from './Dialog.js';
|
|
18
14
|
export { default as Popup } from './Popup.js';
|
|
19
15
|
export { default as ActionSheet } from './ActionSheet.js';
|
|
16
|
+
export { default as Picker } from './Picker.js';
|
|
17
|
+
export { default as Infiniteloading } from './Infiniteloading.js';
|
|
18
|
+
export { default as Popover } from './Popover.js';
|
|
19
|
+
export { default as Collapse } from './Collapse.js';
|
|
20
|
+
export { default as CollapseItem } from './CollapseItem.js';
|
|
21
|
+
export { default as Range } from './Range.js';
|
|
22
|
+
export { default as CircleProgress } from './CircleProgress.js';
|
|
20
23
|
export { default as NoticeBar } from './NoticeBar.js';
|
|
21
24
|
export { default as Notify } from './Notify.js';
|
|
25
|
+
export { default as Switch } from './Switch.js';
|
|
22
26
|
export { default as NavBar } from './NavBar.js';
|
|
23
27
|
export { default as Tabbar } from './Tabbar.js';
|
|
24
28
|
export { default as TabbarItem } from './TabbarItem.js';
|
|
25
|
-
export { default as InputNumber } from './InputNumber.js';
|
|
26
29
|
export { default as Elevator } from './Elevator.js';
|
|
27
30
|
export { default as FixedNav } from './FixedNav.js';
|
|
28
31
|
export { default as Pagination } from './Pagination.js';
|
|
32
|
+
export { default as Steps } from './Steps.js';
|
|
33
|
+
export { default as Step } from './Step.js';
|
|
34
|
+
export { default as Swiper } from './Swiper.js';
|
|
35
|
+
export { default as SwiperItem } from './SwiperItem.js';
|
|
36
|
+
export { default as BackTop } from './BackTop.js';
|
|
29
37
|
export { default as Rate } from './Rate.js';
|
|
30
|
-
export { default as Uploader } from './Uploader.js';
|
|
31
38
|
export { default as Input } from './Input.js';
|
|
32
39
|
export { default as TextArea } from './TextArea.js';
|
|
40
|
+
export { default as InputNumber } from './InputNumber.js';
|
|
41
|
+
export { default as ShortPassword } from './ShortPassword.js';
|
|
42
|
+
export { default as Radio } from './Radio.js';
|
|
43
|
+
export { default as RadioGroup } from './RadioGroup.js';
|
|
33
44
|
export { default as Checkbox } from './Checkbox.js';
|
|
34
45
|
export { default as CheckboxGroup } from './CheckboxGroup.js';
|
|
35
46
|
export { default as Tag } from './Tag.js';
|
|
36
47
|
export { default as Badge } from './Badge.js';
|
|
37
|
-
export { default as
|
|
38
|
-
export { default as
|
|
39
|
-
export { default as
|
|
40
|
-
export { default as Signature } from './Signature.js';
|
|
41
|
-
export { default as Barrage } from './Barrage.js';
|
|
48
|
+
export { default as Uploader } from './Uploader.js';
|
|
49
|
+
export { default as Calendar } from './Calendar.js';
|
|
50
|
+
export { default as CalendarItem } from './CalendarItem.js';
|
|
42
51
|
export { default as Address } from './Address.js';
|
|
52
|
+
export { default as Barrage } from './Barrage.js';
|
|
53
|
+
export { default as Signature } from './Signature.js';
|
|
54
|
+
export { default as Drag } from './Drag.js';
|
|
55
|
+
export { default as AnimatingNumbers } from './AnimatingNumbers.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
export interface CalendarProps {
|
|
3
|
+
type?: string;
|
|
4
|
+
isAutoBackFill?: boolean;
|
|
5
|
+
poppable?: boolean;
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
title?: string;
|
|
8
|
+
defaultValue?: string | string[];
|
|
9
|
+
startDate?: string;
|
|
10
|
+
endDate?: string;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
onChoose?: (param: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const Calendar: FunctionComponent<Partial<CalendarProps> & React.HTMLAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
declare type InputDate = string | string[];
|
|
3
|
+
export interface CalendarItemProps {
|
|
4
|
+
type?: string;
|
|
5
|
+
isAutoBackFill?: boolean;
|
|
6
|
+
poppable?: boolean;
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
title?: string;
|
|
9
|
+
defaultValue: InputDate;
|
|
10
|
+
startDate?: InputDate;
|
|
11
|
+
endDate?: InputDate;
|
|
12
|
+
onChoose?: (data: any) => void;
|
|
13
|
+
onUpdate?: () => void;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const CalendarItem: FunctionComponent<Partial<CalendarItemProps> & React.HTMLAttributes<HTMLDivElement>>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConfirmProps } from './config';
|
|
2
|
+
export declare const normalizeConfig: (_config: ConfirmProps) => ConfirmProps;
|
|
3
|
+
declare function confirm(config: ConfirmProps, renderFunc?: (props: ConfirmProps) => void): {
|
|
4
|
+
close: () => void;
|
|
5
|
+
update: (newConfig: ConfirmProps) => void;
|
|
6
|
+
};
|
|
7
|
+
export default confirm;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent, ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
interface ContentProps {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
footer?: ReactNode;
|
|
6
|
+
textAlign?: any;
|
|
7
|
+
footerDirection?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Content: FunctionComponent<Partial<ContentProps> & HTMLAttributes<HTMLDivElement>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FunctionComponent, HTMLAttributes } from 'react';
|
|
2
|
+
interface DialogWrapProps {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
mask?: boolean;
|
|
5
|
+
lockScroll?: boolean;
|
|
6
|
+
closeOnClickOverlay?: boolean;
|
|
7
|
+
onCancel?: Function;
|
|
8
|
+
onClosed?: Function;
|
|
9
|
+
}
|
|
10
|
+
export declare const DialogWrap: FunctionComponent<Partial<DialogWrapProps> & HTMLAttributes<HTMLDivElement>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionComponent, ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
interface DialogWrapperProps {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
footer?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const DialogWrapper: FunctionComponent<Partial<DialogWrapperProps> & HTMLAttributes<HTMLDivElement>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode, ForwardRefExoticComponent, PropsWithChildren } from 'react';
|
|
2
|
+
export declare type DialogConfigType = {
|
|
3
|
+
prefixCls?: string;
|
|
4
|
+
simple?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export interface DialogProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
title?: ReactNode;
|
|
11
|
+
content?: ReactNode;
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
okText?: ReactNode;
|
|
14
|
+
cancelText?: ReactNode;
|
|
15
|
+
mask?: boolean;
|
|
16
|
+
noOkBtn?: boolean;
|
|
17
|
+
noCancelBtn?: boolean;
|
|
18
|
+
okBtnDisabled?: boolean;
|
|
19
|
+
noFooter?: boolean;
|
|
20
|
+
closeOnClickOverlay?: boolean;
|
|
21
|
+
cancelAutoClose?: boolean;
|
|
22
|
+
textAlign?: any;
|
|
23
|
+
footerDirection?: string;
|
|
24
|
+
lockScroll?: boolean;
|
|
25
|
+
onClosed?: Function;
|
|
26
|
+
onOk?: (e?: MouseEvent) => Promise<any> | void;
|
|
27
|
+
onCancel?: () => void;
|
|
28
|
+
onConfirm?: (e?: MouseEvent) => Promise<any> | void;
|
|
29
|
+
}
|
|
30
|
+
export declare type DialogReturnProps = {
|
|
31
|
+
update: Function;
|
|
32
|
+
close: Function;
|
|
33
|
+
};
|
|
34
|
+
export interface ConfirmProps extends DialogProps {
|
|
35
|
+
content?: ReactNode;
|
|
36
|
+
icon?: ReactNode | null;
|
|
37
|
+
isNotice?: boolean;
|
|
38
|
+
noticeType?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface DialogComponent extends ForwardRefExoticComponent<PropsWithChildren<DialogProps>> {
|
|
41
|
+
confirm: (props: ConfirmProps) => DialogReturnProps;
|
|
42
|
+
alert: (props: ConfirmProps) => DialogReturnProps;
|
|
43
|
+
config: (config: DialogConfigType) => void;
|
|
44
|
+
destroyAll: () => void;
|
|
45
|
+
}
|
|
46
|
+
export declare const destroyList: Array<Function>;
|