@nutui/nutui-react-taro 1.3.4-beta.0 → 1.3.5-beta.0
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 +12 -0
- package/dist/esm/Address.js +3 -4
- package/dist/esm/AnimatingNumbers.js +2 -2
- package/dist/esm/Audio.js +4 -4
- package/dist/esm/Cascader/style/index.js +2 -1
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/Dialog.js +2 -4
- package/dist/esm/ImagePreview/style/index.js +3 -1
- package/dist/esm/ImagePreview.js +3 -4
- package/dist/esm/Infiniteloading.js +2 -2
- package/dist/esm/Notify.js +2 -3
- package/dist/esm/Range.js +3 -3
- package/dist/esm/Rate.js +2 -2
- package/dist/esm/Swiper/style/index.js +1 -1
- package/dist/esm/Swiper.js +2 -2
- package/dist/esm/Toast.js +2 -2
- package/dist/esm/{address.taro-7540c626.js → address.taro-f16cef31.js} +76 -373
- package/dist/esm/{animatingnumbers.taro-877baa98.js → animatingnumbers.taro-6f40a2e9.js} +41 -25
- package/dist/esm/{audio.taro-ab2528b2.js → audio.taro-29f5568f.js} +1 -1
- package/dist/esm/{cascader.taro-35387092.js → cascader.taro-77100fb4.js} +54 -48
- package/dist/esm/dialog.taro-492e2b9a.js +218 -0
- package/dist/esm/{imagepreview.taro-3f1c7638.js → imagepreview.taro-1199e977.js} +3 -11
- package/dist/esm/{infiniteloading.taro-9701755f.js → infiniteloading.taro-b95e62bf.js} +1 -3
- package/dist/esm/notify.taro-d9c48fae.js +122 -0
- package/dist/esm/nutui-react.es.js +12 -12
- package/dist/esm/{range.taro-141a0163.js → range.taro-515d37a4.js} +1 -1
- package/dist/esm/{rate.taro-5077b962.js → rate.taro-69c85081.js} +4 -2
- package/dist/esm/{swiper.taro-58ed323b.js → swiper.taro-f314d67a.js} +4 -2
- package/dist/esm/{toast.taro-cd22a0d7.js → toast.taro-86862dff.js} +1 -1
- package/dist/esm/types/src/packages/address/customRender.taro.d.ts +15 -0
- package/dist/esm/types/src/packages/cascader/cascader.d.ts +1 -0
- package/dist/esm/types/src/packages/cascader/cascader.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/notify/index.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/notify/notify.taro.d.ts +9 -15
- 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 +582 -1232
- package/dist/nutui.react.umd.js +577 -1227
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/types/index.d.ts +169 -174
- package/package.json +1 -1
- package/dist/esm/dialog.taro-54c67e08.js +0 -554
- package/dist/esm/notify.taro-0d9cfb07.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 _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); }; }
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
|
|
17
|
-
import * as React from 'react';
|
|
18
|
-
import * as ReactDOM from 'react-dom';
|
|
19
|
-
import classNames from 'classnames';
|
|
20
|
-
import { CSSTransition } from 'react-transition-group';
|
|
21
|
-
import { c as cn } from './bem-893ad28d.js';
|
|
22
|
-
var createRoot;
|
|
23
|
-
var version = ReactDOM.version;
|
|
24
|
-
|
|
25
|
-
var reactDOMClone = _objectSpread({}, ReactDOM);
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
var mainVersion = Number((version || '').split('.')[0]);
|
|
29
|
-
|
|
30
|
-
if (mainVersion >= 18) {
|
|
31
|
-
createRoot = reactDOMClone.createRoot;
|
|
32
|
-
}
|
|
33
|
-
} catch (e) {
|
|
34
|
-
console.log(e);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function legacyRender(node, container) {
|
|
38
|
-
ReactDOM.render(node, container);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function concurrentRender(node, container) {
|
|
42
|
-
if (createRoot) {
|
|
43
|
-
var root = createRoot(container);
|
|
44
|
-
root.render(node);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function render(node, container) {
|
|
49
|
-
if (createRoot) {
|
|
50
|
-
concurrentRender(node, container);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
legacyRender(node, container);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var Notification = /*#__PURE__*/function (_React$PureComponent) {
|
|
58
|
-
_inherits(Notification, _React$PureComponent);
|
|
59
|
-
|
|
60
|
-
var _super = _createSuper(Notification);
|
|
61
|
-
|
|
62
|
-
function Notification(props) {
|
|
63
|
-
var _this;
|
|
64
|
-
|
|
65
|
-
_classCallCheck(this, Notification);
|
|
66
|
-
|
|
67
|
-
_this = _super.call(this, props);
|
|
68
|
-
|
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "closeTimer", void 0);
|
|
70
|
-
|
|
71
|
-
_this.close = _this.close.bind(_assertThisInitialized(_this));
|
|
72
|
-
_this.startCloseTimer = _this.startCloseTimer.bind(_assertThisInitialized(_this));
|
|
73
|
-
_this.clearCloseTimer = _this.clearCloseTimer.bind(_assertThisInitialized(_this));
|
|
74
|
-
_this.clickCover = _this.clickCover.bind(_assertThisInitialized(_this));
|
|
75
|
-
_this.state = {
|
|
76
|
-
show: true
|
|
77
|
-
};
|
|
78
|
-
return _this;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
_createClass(Notification, [{
|
|
82
|
-
key: "close",
|
|
83
|
-
value: function close() {
|
|
84
|
-
this.setState({
|
|
85
|
-
show: false
|
|
86
|
-
});
|
|
87
|
-
this.clearCloseTimer();
|
|
88
|
-
|
|
89
|
-
if (this.props.id) {
|
|
90
|
-
var element = document.getElementById(this.props.id);
|
|
91
|
-
element && element.parentNode && element.parentNode.removeChild(element);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this.props.onClosed();
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "startCloseTimer",
|
|
98
|
-
value: function startCloseTimer() {
|
|
99
|
-
var _this2 = this;
|
|
100
|
-
|
|
101
|
-
var duration = this.props.duration;
|
|
102
|
-
|
|
103
|
-
if (duration) {
|
|
104
|
-
this.closeTimer = window.setTimeout(function () {
|
|
105
|
-
_this2.close();
|
|
106
|
-
}, duration);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}, {
|
|
110
|
-
key: "clearCloseTimer",
|
|
111
|
-
value: function clearCloseTimer() {
|
|
112
|
-
if (this.closeTimer) {
|
|
113
|
-
clearTimeout(this.closeTimer);
|
|
114
|
-
this.closeTimer = -1;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}, {
|
|
118
|
-
key: "clickCover",
|
|
119
|
-
value: function clickCover() {
|
|
120
|
-
this.props.onClick();
|
|
121
|
-
}
|
|
122
|
-
}, {
|
|
123
|
-
key: "componentDidMount",
|
|
124
|
-
value: function componentDidMount() {
|
|
125
|
-
this.startCloseTimer();
|
|
126
|
-
}
|
|
127
|
-
}, {
|
|
128
|
-
key: "componentWillUnmount",
|
|
129
|
-
value: function componentWillUnmount() {
|
|
130
|
-
this.clearCloseTimer();
|
|
131
|
-
}
|
|
132
|
-
}, {
|
|
133
|
-
key: "render",
|
|
134
|
-
value: function render() {
|
|
135
|
-
var _this$props = this.props,
|
|
136
|
-
children = _this$props.children,
|
|
137
|
-
style = _this$props.style,
|
|
138
|
-
msg = _this$props.msg,
|
|
139
|
-
color = _this$props.color,
|
|
140
|
-
background = _this$props.background,
|
|
141
|
-
type = _this$props.type,
|
|
142
|
-
className = _this$props.className,
|
|
143
|
-
position = _this$props.position,
|
|
144
|
-
isWrapTeleport = _this$props.isWrapTeleport;
|
|
145
|
-
this.state;
|
|
146
|
-
cn('notify');
|
|
147
|
-
var classes = classNames(_defineProperty({
|
|
148
|
-
'popup-top': position === 'top',
|
|
149
|
-
'popup-bottom': position === 'bottom',
|
|
150
|
-
'nut-notify': true
|
|
151
|
-
}, "nut-notify--".concat(type), true));
|
|
152
|
-
return React.createElement(React.Fragment, null, React.createElement(CSSTransition, {
|
|
153
|
-
"in": this.state.show,
|
|
154
|
-
timeout: 300,
|
|
155
|
-
classNames: "fade",
|
|
156
|
-
unmountOnExit: true,
|
|
157
|
-
appear: true,
|
|
158
|
-
position: position,
|
|
159
|
-
isWrapTeleport: isWrapTeleport
|
|
160
|
-
}, React.createElement("div", {
|
|
161
|
-
className: "".concat(classes, " ").concat(className),
|
|
162
|
-
style: {
|
|
163
|
-
color: "".concat(color || ''),
|
|
164
|
-
background: "".concat(background || '')
|
|
165
|
-
},
|
|
166
|
-
onClick: this.clickCover
|
|
167
|
-
}, children || msg)));
|
|
168
|
-
}
|
|
169
|
-
}]);
|
|
170
|
-
|
|
171
|
-
return Notification;
|
|
172
|
-
}(React.PureComponent);
|
|
173
|
-
|
|
174
|
-
_defineProperty(Notification, "newInstance", void 0);
|
|
175
|
-
|
|
176
|
-
Notification.newInstance = function (properties, callback) {
|
|
177
|
-
var element = document.createElement('div');
|
|
178
|
-
var id = properties.id ? properties.id : "".concat(new Date().getTime());
|
|
179
|
-
element.id = id;
|
|
180
|
-
properties.id = id;
|
|
181
|
-
document.body.appendChild(element);
|
|
182
|
-
var called = false;
|
|
183
|
-
|
|
184
|
-
function ref(instance) {
|
|
185
|
-
if (called) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
called = true;
|
|
190
|
-
callback({
|
|
191
|
-
component: instance,
|
|
192
|
-
destroy: function destroy() {
|
|
193
|
-
setTimeout(function () {
|
|
194
|
-
ReactDOM.unmountComponentAtNode(element);
|
|
195
|
-
element && element.parentNode && element.parentNode.removeChild(element);
|
|
196
|
-
}, 300);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
render(React.createElement(Notification, _objectSpread(_objectSpread({}, properties), {}, {
|
|
202
|
-
ref: ref
|
|
203
|
-
})), element);
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
var messageInstance = null;
|
|
207
|
-
var options = {
|
|
208
|
-
msg: '',
|
|
209
|
-
id: '',
|
|
210
|
-
duration: 3000,
|
|
211
|
-
color: '',
|
|
212
|
-
type: 'danger',
|
|
213
|
-
className: '',
|
|
214
|
-
position: 'top',
|
|
215
|
-
isWrapTeleport: true,
|
|
216
|
-
onClosed: function onClosed() {},
|
|
217
|
-
onClick: function onClick() {}
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
function getInstance(props, callback) {
|
|
221
|
-
if (messageInstance) {
|
|
222
|
-
messageInstance.destroy();
|
|
223
|
-
messageInstance = null;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
Notification.newInstance(props, function (notification) {
|
|
227
|
-
return callback && callback(notification);
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function notice(opts) {
|
|
232
|
-
// function close() {
|
|
233
|
-
// if (messageInstance) {
|
|
234
|
-
// messageInstance.destroy()
|
|
235
|
-
// messageInstance = null
|
|
236
|
-
// }
|
|
237
|
-
// }
|
|
238
|
-
opts = _objectSpread(_objectSpread({}, options), opts);
|
|
239
|
-
getInstance(opts, function (notification) {
|
|
240
|
-
messageInstance = notification;
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
var errorMsg = function errorMsg(msg) {
|
|
245
|
-
if (!msg) {
|
|
246
|
-
console.warn('[NutUI Notify]: msg不能为空');
|
|
247
|
-
} else {
|
|
248
|
-
console.log('ok');
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
var Notify = {
|
|
253
|
-
text: function text(msg) {
|
|
254
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
255
|
-
errorMsg(msg);
|
|
256
|
-
return notice(_objectSpread({
|
|
257
|
-
msg: msg,
|
|
258
|
-
type: 'base'
|
|
259
|
-
}, option));
|
|
260
|
-
},
|
|
261
|
-
success: function success(msg) {
|
|
262
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
263
|
-
errorMsg(msg);
|
|
264
|
-
return notice(_objectSpread({
|
|
265
|
-
msg: msg,
|
|
266
|
-
type: 'success'
|
|
267
|
-
}, option));
|
|
268
|
-
},
|
|
269
|
-
primary: function primary(msg) {
|
|
270
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
271
|
-
errorMsg(msg);
|
|
272
|
-
return notice(_objectSpread({
|
|
273
|
-
msg: msg,
|
|
274
|
-
type: 'primary'
|
|
275
|
-
}, option));
|
|
276
|
-
},
|
|
277
|
-
danger: function danger(msg) {
|
|
278
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
279
|
-
errorMsg(msg);
|
|
280
|
-
return notice(_objectSpread({
|
|
281
|
-
msg: msg,
|
|
282
|
-
type: 'danger'
|
|
283
|
-
}, option));
|
|
284
|
-
},
|
|
285
|
-
warn: function warn(msg) {
|
|
286
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
287
|
-
errorMsg(msg);
|
|
288
|
-
return notice(_objectSpread({
|
|
289
|
-
msg: msg,
|
|
290
|
-
type: 'warning'
|
|
291
|
-
}, option));
|
|
292
|
-
},
|
|
293
|
-
hide: function hide() {
|
|
294
|
-
if (messageInstance) {
|
|
295
|
-
messageInstance.destroy();
|
|
296
|
-
messageInstance = null;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
export { Notify as N };
|