@nutui/nutui 3.1.12-beta.1 → 3.1.12
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 +27 -0
- package/dist/nutui.d.ts +1 -1
- package/dist/nutui.es.js +3219 -2562
- package/dist/nutui.umd.js +3292 -2565
- package/dist/packages/_es/ActionSheet.js +12 -13
- package/dist/packages/_es/Address.js +49 -63
- package/dist/packages/_es/Avatar.js +5 -4
- package/dist/packages/_es/BackTop.js +109 -72
- package/dist/packages/_es/Badge.js +5 -4
- package/dist/packages/_es/Barrage.js +57 -63
- package/dist/packages/_es/Button.js +6 -5
- package/dist/packages/_es/Calendar.js +18 -27
- package/dist/packages/_es/Card.js +8 -7
- package/dist/packages/_es/Cell.js +13 -5
- package/dist/packages/_es/CellGroup.js +14 -7
- package/dist/packages/_es/Checkbox.js +3 -3
- package/dist/packages/_es/CheckboxGroup.js +4 -9
- package/dist/packages/_es/CircleProgress.js +46 -142
- package/dist/packages/_es/Col.js +5 -4
- package/dist/packages/_es/Collapse.js +10 -35
- package/dist/packages/_es/CollapseItem.js +35 -80
- package/dist/packages/_es/CountDown.js +5 -7
- package/dist/packages/_es/CountUp.js +31 -34
- package/dist/packages/_es/DatePicker.js +219 -451
- package/dist/packages/_es/Dialog.js +98 -46
- package/dist/packages/_es/Divider.js +6 -5
- package/dist/packages/_es/Drag.js +50 -76
- package/dist/packages/_es/Elevator.js +52 -81
- package/dist/packages/_es/FixedNav.js +9 -8
- package/dist/packages/_es/Form.js +6 -5
- package/dist/packages/_es/FormItem.js +5 -4
- package/dist/packages/_es/Icon.js +40 -6
- package/dist/packages/_es/ImagePreview.js +158 -44
- package/dist/packages/_es/InfiniteLoading.js +109 -95
- package/dist/packages/_es/Input.js +21 -22
- package/dist/packages/_es/InputNumber.js +18 -24
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/Menu.js +14 -16
- package/dist/packages/_es/MenuItem.js +11 -9
- package/dist/packages/_es/Navbar.js +7 -7
- package/dist/packages/_es/NoticeBar.js +26 -39
- package/dist/packages/_es/Notify.js +166 -30
- package/dist/packages/_es/NumberKeyboard.js +7 -9
- package/dist/packages/_es/OverLay.js +29 -22
- package/dist/packages/_es/Pagination.js +9 -8
- package/dist/packages/_es/Picker.js +447 -61
- package/dist/packages/_es/Popover.js +34 -161
- package/dist/packages/_es/Popup.js +77 -17
- package/dist/packages/_es/Price.js +7 -18
- package/dist/packages/_es/Progress.js +12 -23
- package/dist/packages/_es/Radio.js +3 -3
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +31 -38
- package/dist/packages/_es/Rate.js +35 -17
- package/dist/packages/_es/Row.js +5 -4
- package/dist/packages/_es/SearchBar.js +5 -7
- package/dist/packages/_es/ShortPassword.js +59 -89
- package/dist/packages/_es/Signature.js +71 -70
- package/dist/packages/_es/Sku.js +43 -53
- package/dist/packages/_es/Step.js +8 -10
- package/dist/packages/_es/Steps.js +2 -2
- package/dist/packages/_es/Swipe.js +28 -43
- package/dist/packages/_es/Swiper.js +418 -17
- package/dist/packages/_es/SwiperItem.js +39 -14
- package/dist/packages/_es/Switch.js +32 -11
- package/dist/packages/_es/TabPane.js +5 -4
- package/dist/packages/_es/Tabbar.js +5 -4
- package/dist/packages/_es/TabbarItem.js +9 -8
- package/dist/packages/_es/Tabs.js +16 -22
- package/dist/packages/_es/Tag.js +6 -5
- package/dist/packages/_es/TextArea.js +12 -16
- package/dist/packages/_es/TimeDetail.js +5 -7
- package/dist/packages/_es/TimePannel.js +5 -7
- package/dist/packages/_es/TimeSelect.js +7 -12
- package/dist/packages/_es/Toast.js +178 -46
- package/dist/packages/_es/Uploader.js +149 -109
- package/dist/packages/_es/Video.js +405 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +7 -58
- package/dist/packages/_es/index2.js +58 -43
- package/dist/packages/_es/index3.js +28 -411
- package/dist/packages/_es/plugin-vue_export-helper.js +13 -0
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/util.js +1 -1
- package/dist/packages/cellgroup/index.scss +9 -0
- package/dist/packages/dialog/index.scss +17 -0
- package/dist/packages/drag/index.scss +4 -0
- package/dist/packages/fixednav/index.scss +6 -1
- package/dist/packages/formitem/index.scss +3 -0
- package/dist/packages/icon/index.scss +2 -1
- package/dist/packages/numberkeyboard/index.scss +1 -1
- package/dist/packages/popover/index.scss +2 -2
- package/dist/packages/rate/index.scss +1 -0
- package/dist/packages/textarea/index.scss +1 -0
- package/dist/packages/timedetail/index.scss +1 -2
- package/dist/packages/timeselect/index.scss +3 -0
- package/dist/packages/toast/index.scss +6 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +2 -1
- package/dist/styles/font/config.json +2 -1
- package/dist/styles/font/demo_index.html +26 -3
- package/dist/styles/font/iconfont.css +7 -3
- package/dist/styles/font/iconfont.js +31 -32
- package/dist/styles/font/iconfont.json +7 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/themes/default.scss +38 -38
- package/dist/styles/variables.scss +5 -1
- package/package.json +1 -1
- package/dist/packages/_es/commonProps.js +0 -30
- package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +0 -44
- package/dist/packages/_es/use-lock-scroll.js +0 -23
|
@@ -1,11 +1,31 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1
20
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
21
|
+
* @nutui/nutui v3.1.12 Sat Nov 27 2021 11:30:43 GMT+0800 (中国标准时间)
|
|
3
22
|
* (c) 2021 @jdf2e.
|
|
4
23
|
* Released under the MIT License.
|
|
5
24
|
*/
|
|
6
|
-
import { watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle,
|
|
25
|
+
import { reactive, onMounted, watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, createElementBlock, createVNode, createCommentVNode, toDisplayString, vShow, render } from "vue";
|
|
7
26
|
import { c as createComponent } from "./component.js";
|
|
8
|
-
import
|
|
27
|
+
import _sfc_main$1 from "./Icon.js";
|
|
28
|
+
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
9
29
|
import "./pxCheck.js";
|
|
10
30
|
const { create } = createComponent("toast");
|
|
11
31
|
const _sfc_main = create({
|
|
@@ -23,14 +43,11 @@ const _sfc_main = create({
|
|
|
23
43
|
type: Boolean,
|
|
24
44
|
default: true
|
|
25
45
|
},
|
|
26
|
-
type:
|
|
27
|
-
type: String,
|
|
28
|
-
default: "text"
|
|
29
|
-
},
|
|
46
|
+
type: String,
|
|
30
47
|
customClass: String,
|
|
31
48
|
bottom: {
|
|
32
|
-
type:
|
|
33
|
-
default:
|
|
49
|
+
type: String,
|
|
50
|
+
default: "30px"
|
|
34
51
|
},
|
|
35
52
|
size: {
|
|
36
53
|
type: [String, Number],
|
|
@@ -59,18 +76,23 @@ const _sfc_main = create({
|
|
|
59
76
|
type: String,
|
|
60
77
|
default: "rgba(0, 0, 0, 0)"
|
|
61
78
|
},
|
|
62
|
-
|
|
63
|
-
type:
|
|
64
|
-
default:
|
|
79
|
+
title: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: ""
|
|
65
82
|
},
|
|
66
|
-
|
|
83
|
+
closeOnClickOverlay: {
|
|
67
84
|
type: Boolean,
|
|
68
85
|
default: false
|
|
69
86
|
}
|
|
70
87
|
},
|
|
71
|
-
|
|
72
|
-
setup(props, { emit }) {
|
|
88
|
+
setup(props) {
|
|
73
89
|
let timer;
|
|
90
|
+
const state = reactive({
|
|
91
|
+
mounted: false
|
|
92
|
+
});
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
state.mounted = true;
|
|
95
|
+
});
|
|
74
96
|
const clearTimer = () => {
|
|
75
97
|
if (timer) {
|
|
76
98
|
clearTimeout(timer);
|
|
@@ -78,8 +100,7 @@ const _sfc_main = create({
|
|
|
78
100
|
}
|
|
79
101
|
};
|
|
80
102
|
const hide = () => {
|
|
81
|
-
|
|
82
|
-
emit("closed");
|
|
103
|
+
state.mounted = false;
|
|
83
104
|
};
|
|
84
105
|
const show = () => {
|
|
85
106
|
clearTimer();
|
|
@@ -94,7 +115,10 @@ const _sfc_main = create({
|
|
|
94
115
|
hide();
|
|
95
116
|
}
|
|
96
117
|
};
|
|
97
|
-
|
|
118
|
+
if (props.duration) {
|
|
119
|
+
show();
|
|
120
|
+
}
|
|
121
|
+
watch(() => props.duration, (val) => {
|
|
98
122
|
if (val) {
|
|
99
123
|
show();
|
|
100
124
|
}
|
|
@@ -106,18 +130,6 @@ const _sfc_main = create({
|
|
|
106
130
|
return !!props.icon;
|
|
107
131
|
}
|
|
108
132
|
});
|
|
109
|
-
const iconName = computed(() => {
|
|
110
|
-
if (props.icon) {
|
|
111
|
-
return props.icon;
|
|
112
|
-
} else {
|
|
113
|
-
return {
|
|
114
|
-
success: "success",
|
|
115
|
-
fail: "failure",
|
|
116
|
-
warn: "tips",
|
|
117
|
-
loading: "loading"
|
|
118
|
-
}[props.type];
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
133
|
const toastBodyClass = computed(() => {
|
|
122
134
|
return [
|
|
123
135
|
"nut-toast",
|
|
@@ -130,15 +142,15 @@ const _sfc_main = create({
|
|
|
130
142
|
];
|
|
131
143
|
});
|
|
132
144
|
const onAfterLeave = () => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
145
|
+
clearTimer();
|
|
146
|
+
props.unmount(props.id);
|
|
147
|
+
props.onClose && props.onClose();
|
|
137
148
|
};
|
|
138
149
|
return {
|
|
150
|
+
state,
|
|
151
|
+
hide,
|
|
139
152
|
clickCover,
|
|
140
153
|
hasIcon,
|
|
141
|
-
iconName,
|
|
142
154
|
toastBodyClass,
|
|
143
155
|
onAfterLeave
|
|
144
156
|
};
|
|
@@ -148,7 +160,11 @@ const _hoisted_1 = {
|
|
|
148
160
|
key: 0,
|
|
149
161
|
class: "nut-toast-icon-wrapper"
|
|
150
162
|
};
|
|
151
|
-
const _hoisted_2 =
|
|
163
|
+
const _hoisted_2 = {
|
|
164
|
+
key: 1,
|
|
165
|
+
class: "nut-toast-title"
|
|
166
|
+
};
|
|
167
|
+
const _hoisted_3 = ["innerHTML"];
|
|
152
168
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
153
169
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
154
170
|
return openBlock(), createBlock(Transition, {
|
|
@@ -159,13 +175,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
159
175
|
withDirectives(createElementVNode("view", {
|
|
160
176
|
class: normalizeClass(_ctx.toastBodyClass),
|
|
161
177
|
style: normalizeStyle({
|
|
162
|
-
bottom: _ctx.center ? "auto" : _ctx.bottom
|
|
178
|
+
bottom: _ctx.center ? "auto" : _ctx.bottom,
|
|
163
179
|
"background-color": _ctx.coverColor
|
|
164
180
|
}),
|
|
165
181
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
|
|
166
182
|
}, [
|
|
167
|
-
|
|
168
|
-
key: 1,
|
|
183
|
+
createElementVNode("view", {
|
|
169
184
|
class: "nut-toast-inner",
|
|
170
185
|
style: normalizeStyle({
|
|
171
186
|
"text-align": _ctx.textAlignCenter ? "center" : "left",
|
|
@@ -176,20 +191,137 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
176
191
|
createVNode(_component_nut_icon, {
|
|
177
192
|
size: "20",
|
|
178
193
|
color: "#ffffff",
|
|
179
|
-
name: _ctx.
|
|
194
|
+
name: _ctx.icon
|
|
180
195
|
}, null, 8, ["name"])
|
|
181
196
|
])) : createCommentVNode("", true),
|
|
197
|
+
_ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
|
|
182
198
|
createElementVNode("view", {
|
|
183
199
|
class: "nut-toast-text",
|
|
184
200
|
innerHTML: _ctx.msg
|
|
185
|
-
}, null, 8,
|
|
186
|
-
], 4)
|
|
201
|
+
}, null, 8, _hoisted_3)
|
|
202
|
+
], 4)
|
|
187
203
|
], 6), [
|
|
188
|
-
[vShow, _ctx.
|
|
204
|
+
[vShow, _ctx.state.mounted]
|
|
189
205
|
])
|
|
190
206
|
]),
|
|
191
|
-
_:
|
|
207
|
+
_: 1
|
|
192
208
|
}, 8, ["onAfterLeave"]);
|
|
193
209
|
}
|
|
194
|
-
_sfc_main
|
|
195
|
-
|
|
210
|
+
var Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
211
|
+
const defaultOptions = {
|
|
212
|
+
msg: "",
|
|
213
|
+
id: "",
|
|
214
|
+
duration: 2e3,
|
|
215
|
+
center: true,
|
|
216
|
+
type: "text",
|
|
217
|
+
title: "",
|
|
218
|
+
customClass: "",
|
|
219
|
+
bottom: "30px",
|
|
220
|
+
size: "base",
|
|
221
|
+
icon: null,
|
|
222
|
+
textAlignCenter: true,
|
|
223
|
+
loadingRotate: true,
|
|
224
|
+
bgColor: "rgba(0, 0, 0, .8)",
|
|
225
|
+
onClose: null,
|
|
226
|
+
unmount: null,
|
|
227
|
+
cover: false,
|
|
228
|
+
coverColor: "rgba(0, 0, 0, 0)",
|
|
229
|
+
closeOnClickOverlay: false
|
|
230
|
+
};
|
|
231
|
+
let idsMap = [];
|
|
232
|
+
let optsMap = [];
|
|
233
|
+
const clearToast = (id) => {
|
|
234
|
+
if (id) {
|
|
235
|
+
const container = document.getElementById(id);
|
|
236
|
+
optsMap = optsMap.filter((item) => item.id !== id);
|
|
237
|
+
idsMap = idsMap.filter((item) => item !== id);
|
|
238
|
+
if (container) {
|
|
239
|
+
document.body.removeChild(container);
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
idsMap.forEach((item) => {
|
|
243
|
+
const container = document.getElementById(item);
|
|
244
|
+
if (container) {
|
|
245
|
+
document.body.removeChild(container);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
optsMap = [];
|
|
249
|
+
idsMap = [];
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const updateToast = (opts) => {
|
|
253
|
+
const container = document.getElementById(opts.id);
|
|
254
|
+
if (container) {
|
|
255
|
+
const currentOpt = optsMap.find((item) => item.id === opts.id);
|
|
256
|
+
if (currentOpt) {
|
|
257
|
+
opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
|
|
258
|
+
} else {
|
|
259
|
+
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
260
|
+
}
|
|
261
|
+
const instance = createVNode(Toast, opts);
|
|
262
|
+
render(instance, container);
|
|
263
|
+
return instance.component.ctx;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const mountToast = (opts) => {
|
|
267
|
+
opts.unmount = clearToast;
|
|
268
|
+
let _id;
|
|
269
|
+
if (opts.id) {
|
|
270
|
+
_id = opts.id;
|
|
271
|
+
if (idsMap.find((item) => item === opts.id)) {
|
|
272
|
+
return updateToast(opts);
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
_id = new Date().getTime() + "";
|
|
276
|
+
}
|
|
277
|
+
opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
|
|
278
|
+
opts.id = _id;
|
|
279
|
+
idsMap.push(opts.id);
|
|
280
|
+
optsMap.push(opts);
|
|
281
|
+
const container = document.createElement("div");
|
|
282
|
+
container.id = opts.id;
|
|
283
|
+
const instance = createVNode(Toast, opts);
|
|
284
|
+
render(instance, container);
|
|
285
|
+
document.body.appendChild(container);
|
|
286
|
+
return instance.component.ctx;
|
|
287
|
+
};
|
|
288
|
+
const errorMsg = (msg) => {
|
|
289
|
+
if (!msg) {
|
|
290
|
+
console.warn("[NutUI Toast]: msg\u4E0D\u80FD\u4E3A\u7A7A");
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const ToastFunction = {
|
|
295
|
+
text(msg, opts = {}) {
|
|
296
|
+
errorMsg(msg);
|
|
297
|
+
return mountToast(__spreadProps(__spreadValues({}, opts), { type: "text", msg }));
|
|
298
|
+
},
|
|
299
|
+
success(msg, opts = {}) {
|
|
300
|
+
errorMsg(msg);
|
|
301
|
+
return mountToast(__spreadProps(__spreadValues({ icon: "success" }, opts), { msg, type: "success" }));
|
|
302
|
+
},
|
|
303
|
+
fail(msg, opts = {}) {
|
|
304
|
+
errorMsg(msg);
|
|
305
|
+
return mountToast(__spreadProps(__spreadValues({ icon: "failure" }, opts), { msg, type: "fail" }));
|
|
306
|
+
},
|
|
307
|
+
warn(msg, opts = {}) {
|
|
308
|
+
errorMsg(msg);
|
|
309
|
+
return mountToast(__spreadProps(__spreadValues({ icon: "tips" }, opts), { msg, type: "warn" }));
|
|
310
|
+
},
|
|
311
|
+
loading(msg, opts = {}) {
|
|
312
|
+
return mountToast(__spreadProps(__spreadValues({
|
|
313
|
+
icon: "loading"
|
|
314
|
+
}, opts), {
|
|
315
|
+
msg,
|
|
316
|
+
type: "loading"
|
|
317
|
+
}));
|
|
318
|
+
},
|
|
319
|
+
hide(id) {
|
|
320
|
+
clearToast(id);
|
|
321
|
+
},
|
|
322
|
+
install(app) {
|
|
323
|
+
app.use(Toast);
|
|
324
|
+
app.config.globalProperties.$toast = ToastFunction;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
export { Toast, ToastFunction, ToastFunction as default };
|