@nutui/nutui 3.1.22-beta.0 → 3.1.22
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 +48 -0
- package/README.md +3 -4
- package/dist/nutui.es.js +4203 -19263
- package/dist/nutui.umd.js +4208 -19368
- package/dist/packages/_es/ActionSheet.js +17 -167
- package/dist/packages/_es/Address.js +110 -552
- package/dist/packages/_es/AddressList.js +113 -613
- package/dist/packages/_es/Animate.js +22 -0
- package/dist/packages/_es/Audio.js +53 -274
- package/dist/packages/_es/AudioOperate.js +13 -121
- package/dist/packages/_es/Avatar.js +38 -177
- package/dist/packages/_es/AvatarGroup.js +14 -73
- package/dist/packages/_es/BackTop.js +43 -156
- package/dist/packages/_es/Badge.js +14 -86
- package/dist/packages/_es/Barrage.js +41 -120
- package/dist/packages/_es/Button.js +23 -128
- package/dist/packages/_es/Calendar.js +30 -237
- package/dist/packages/_es/CalendarItem.js +2 -1
- package/dist/packages/_es/Card.js +10 -107
- package/dist/packages/_es/Cascader.js +147 -523
- package/dist/packages/_es/Category.js +15 -58
- package/dist/packages/_es/CategoryPane.js +11 -111
- package/dist/packages/_es/Cell.js +21 -100
- package/dist/packages/_es/CellGroup.js +9 -44
- package/dist/packages/_es/Checkbox.js +31 -113
- package/dist/packages/_es/CheckboxGroup.js +29 -58
- package/dist/packages/_es/CircleProgress.js +28 -151
- package/dist/packages/_es/Col.js +14 -56
- package/dist/packages/_es/Collapse.js +32 -84
- package/dist/packages/_es/CollapseItem.js +59 -272
- package/dist/packages/_es/Comment.js +64 -434
- package/dist/packages/_es/ConfigProvider.js +13 -0
- package/dist/packages/_es/CountDown.js +56 -256
- package/dist/packages/_es/CountUp.js +140 -556
- package/dist/packages/_es/DatePicker.js +98 -332
- package/dist/packages/_es/Dialog.js +60 -271
- package/dist/packages/_es/Divider.js +13 -82
- package/dist/packages/_es/Drag.js +56 -197
- package/dist/packages/_es/Ecard.js +24 -159
- package/dist/packages/_es/Elevator.js +58 -212
- package/dist/packages/_es/Ellipsis.js +64 -0
- package/dist/packages/_es/Empty.js +12 -71
- package/dist/packages/_es/FixedNav.js +15 -122
- package/dist/packages/_es/Form.js +64 -151
- package/dist/packages/_es/FormItem.js +15 -110
- package/dist/packages/_es/Grid.js +5 -6
- package/dist/packages/_es/GridItem.js +33 -144
- package/dist/packages/_es/Icon.js +15 -40
- package/dist/packages/_es/Image.js +31 -0
- package/dist/packages/_es/ImagePreview.js +77 -309
- package/dist/packages/_es/Indicator.js +15 -62
- package/dist/packages/_es/InfiniteLoading.js +57 -268
- package/dist/packages/_es/Input.js +51 -413
- package/dist/packages/_es/InputNumber.js +41 -160
- package/dist/packages/_es/Layout.js +4 -5
- package/dist/packages/_es/List.js +18 -124
- package/dist/packages/_es/Menu.js +45 -118
- package/dist/packages/_es/MenuItem.js +37 -162
- package/dist/packages/_es/Navbar.js +30 -192
- package/dist/packages/_es/NoticeBar.js +74 -397
- package/dist/packages/_es/Notify.js +72 -246
- package/dist/packages/_es/NumberKeyboard.js +41 -272
- package/dist/packages/_es/OldPicker.js +131 -474
- package/dist/packages/_es/OverLay.js +24 -113
- package/dist/packages/_es/Pagination.js +39 -157
- package/dist/packages/_es/Picker.js +129 -469
- package/dist/packages/_es/Popover.js +318 -975
- package/dist/packages/_es/Popup.js +55 -313
- package/dist/packages/_es/Price.js +16 -118
- package/dist/packages/_es/Progress.js +14 -146
- package/dist/packages/_es/PullRefresh.js +84 -354
- package/dist/packages/_es/Radio.js +22 -90
- package/dist/packages/_es/RadioGroup.js +8 -37
- package/dist/packages/_es/Range.js +83 -427
- package/dist/packages/_es/Rate.js +35 -137
- package/dist/packages/_es/Row.js +22 -64
- package/dist/packages/_es/SearchBar.js +37 -257
- package/dist/packages/_es/ShortPassword.js +35 -225
- package/dist/packages/_es/SideNavBar.js +24 -99
- package/dist/packages/_es/SideNavBarItem.js +11 -46
- package/dist/packages/_es/Signature.js +41 -179
- package/dist/packages/_es/Skeleton.js +20 -136
- package/dist/packages/_es/Sku.js +84 -509
- package/dist/packages/_es/Step.js +20 -133
- package/dist/packages/_es/Steps.js +18 -53
- package/dist/packages/_es/Sticky.js +53 -138
- package/dist/packages/_es/SubSideNavBar.js +17 -100
- package/dist/packages/_es/Swipe.js +41 -197
- package/dist/packages/_es/Swiper.js +121 -433
- package/dist/packages/_es/SwiperItem.js +22 -53
- package/dist/packages/_es/Switch.js +21 -116
- package/dist/packages/_es/TabPane.js +12 -39
- package/dist/packages/_es/Tabbar.js +17 -72
- package/dist/packages/_es/TabbarItem.js +29 -151
- package/dist/packages/_es/Table.js +18 -196
- package/dist/packages/_es/Tabs.js +43 -217
- package/dist/packages/_es/Tag.js +20 -97
- package/dist/packages/_es/TextArea.js +42 -160
- package/dist/packages/_es/TimeDetail.js +18 -98
- package/dist/packages/_es/TimePannel.js +14 -66
- package/dist/packages/_es/TimeSelect.js +15 -103
- package/dist/packages/_es/Toast.js +71 -329
- package/dist/packages/_es/Uploader.js +104 -468
- package/dist/packages/_es/Video.js +74 -350
- package/dist/packages/_es/common.js +38 -128
- package/dist/packages/_es/component.js +35 -76
- package/dist/packages/_es/index.js +5 -6
- package/dist/packages/_es/index2.js +9 -30
- package/dist/packages/_es/index3.js +6 -8
- package/dist/packages/_es/index4.js +13 -58
- package/dist/packages/_es/index5.js +164 -682
- package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
- package/dist/packages/_es/pxCheck.js +3 -5
- package/dist/packages/_es/raf.js +8 -15
- package/dist/packages/animate/index.scss +299 -0
- package/dist/packages/button/index.scss +2 -1
- package/dist/packages/cell/index.scss +18 -1
- package/dist/packages/checkbox/index.scss +16 -0
- package/dist/packages/configprovider/index.scss +2 -0
- package/dist/packages/dialog/index.scss +1 -0
- package/dist/packages/elevator/index.scss +21 -0
- package/dist/packages/ellipsis/index.scss +12 -0
- package/dist/packages/formitem/index.scss +12 -0
- package/dist/packages/griditem/index.scss +11 -0
- package/dist/packages/image/index.scss +39 -0
- package/dist/packages/imagepreview/index.scss +21 -2
- package/dist/packages/input/index.scss +26 -1
- package/dist/packages/inputnumber/index.scss +21 -0
- package/dist/packages/locale/lang/baseLang.d.ts +1 -0
- package/dist/packages/locale/lang/baseLang.js +3 -3
- package/dist/packages/locale/lang/en-US.d.ts +8 -0
- package/dist/packages/locale/lang/en-US.js +5 -97
- package/dist/packages/locale/lang/id-ID.d.ts +8 -0
- package/dist/packages/locale/lang/id-ID.js +5 -97
- package/dist/packages/locale/lang/index.js +16 -38
- package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
- package/dist/packages/locale/lang/zh-CN.js +5 -97
- package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
- package/dist/packages/locale/lang/zh-TW.js +5 -97
- package/dist/packages/menu/index.scss +45 -36
- package/dist/packages/menuitem/index.scss +4 -0
- package/dist/packages/navbar/index.scss +9 -0
- package/dist/packages/pagination/index.scss +19 -0
- package/dist/packages/radio/index.scss +19 -0
- package/dist/packages/range/index.scss +19 -0
- package/dist/packages/rate/index.scss +1 -1
- package/dist/packages/searchbar/index.scss +21 -0
- package/dist/packages/switch/index.scss +4 -3
- package/dist/packages/tabbar/index.scss +5 -0
- package/dist/packages/tabbaritem/index.scss +7 -0
- package/dist/packages/tabpane/index.scss +6 -0
- package/dist/packages/tabs/index.scss +22 -0
- package/dist/packages/textarea/index.scss +8 -0
- package/dist/smartips/attributes.json +192 -12
- package/dist/smartips/tags.json +70 -10
- package/dist/smartips/web-types.json +6945 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/font/config.json +3 -1
- package/dist/styles/font/demo_index.html +49 -3
- package/dist/styles/font/iconfont.css +11 -3
- package/dist/styles/font/iconfont.js +15 -15
- package/dist/styles/font/iconfont.json +14 -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 +54 -50
- package/dist/styles/themes/jdb.scss +54 -50
- package/dist/styles/themes/jdt.scss +54 -50
- package/dist/styles/variables-jdb.scss +22 -1
- package/dist/styles/variables-jdt.scss +22 -1
- package/dist/styles/variables.scss +22 -1
- package/dist/types/__VUE/actionsheet/index.vue.d.ts +2 -2
- package/dist/types/__VUE/address/index.vue.d.ts +4 -4
- package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
- package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
- package/dist/types/__VUE/animate/type.d.ts +6 -0
- package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
- package/dist/types/__VUE/avatar/index.vue.d.ts +5 -5
- package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
- package/dist/types/__VUE/badge/index.vue.d.ts +4 -4
- package/dist/types/__VUE/button/index.vue.d.ts +6 -6
- package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
- package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
- package/dist/types/__VUE/cell/index.vue.d.ts +11 -4
- package/dist/types/__VUE/checkbox/common.d.ts +59 -0
- package/dist/types/__VUE/checkbox/index.vue.d.ts +20 -7
- package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
- package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
- package/dist/types/__VUE/collapse/index.vue.d.ts +3 -1
- package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
- package/dist/types/__VUE/configprovider/common.d.ts +20 -0
- package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
- package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/dialog/index.d.ts +9 -2
- package/dist/types/__VUE/dialog/index.vue.d.ts +25 -10
- package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
- package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
- package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
- package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
- package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
- package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
- package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
- package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
- package/dist/types/__VUE/image/index.vue.d.ts +105 -0
- package/dist/types/__VUE/image/type.d.ts +6 -0
- package/dist/types/__VUE/imagepreview/index.vue.d.ts +36 -2
- package/dist/types/__VUE/input/index.vue.d.ts +6 -6
- package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +29 -2
- package/dist/types/__VUE/menuitem/index.vue.d.ts +12 -3
- package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
- package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
- package/dist/types/__VUE/oldpicker/index.vue.d.ts +2 -2
- package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
- package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
- package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
- package/dist/types/__VUE/popup/index.vue.d.ts +2 -2
- package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
- package/dist/types/__VUE/range/index.vue.d.ts +4 -4
- package/dist/types/__VUE/rate/common.d.ts +149 -0
- package/dist/types/__VUE/rate/index.vue.d.ts +15 -5
- package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
- package/dist/types/__VUE/sku/index.vue.d.ts +2 -2
- package/dist/types/__VUE/step/index.vue.d.ts +2 -2
- package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
- package/dist/types/__VUE/swiper/index.vue.d.ts +4 -4
- package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
- package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
- package/dist/types/__VUE/timeselect/index.vue.d.ts +10 -2
- package/dist/types/__VUE/toast/index.vue.d.ts +5 -5
- package/dist/types/__VUE/uploader/index.vue.d.ts +6 -6
- package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
- package/dist/types/__VUE/video/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/nutui.d.ts +5 -1
- package/package.json +6 -3
|
@@ -1,495 +1,131 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
1
|
/*!
|
|
18
|
-
* @nutui/nutui v3.1.22
|
|
2
|
+
* @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
|
|
19
3
|
* (c) 2022 @jdf2e.
|
|
20
4
|
* Released under the MIT License.
|
|
21
5
|
*/
|
|
22
|
-
import { reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, Fragment, createCommentVNode, renderList, createElementVNode, toDisplayString, createVNode, createBlock, createTextVNode } from "vue";
|
|
23
|
-
import { c as
|
|
24
|
-
import { _ as
|
|
6
|
+
import { reactive as e, computed as t, resolveComponent as a, openBlock as l, createElementBlock as s, normalizeClass as i, renderSlot as n, Fragment as o, createCommentVNode as r, renderList as u, createElementVNode as p, toDisplayString as c, createVNode as d, createBlock as m, createTextVNode as f } from "vue";
|
|
7
|
+
import { c as g } from "./component.js";
|
|
8
|
+
import { _ as h } from "./plugin-vue_export-helper.js";
|
|
25
9
|
import "../locale/lang";
|
|
26
|
-
class
|
|
10
|
+
class y {
|
|
27
11
|
constructor() {
|
|
28
|
-
this.url = "";
|
|
29
|
-
this.name = "file";
|
|
30
|
-
this.method = "post";
|
|
31
|
-
this.xhrState = 200;
|
|
32
|
-
this.timeout = 30 * 1e3;
|
|
33
|
-
this.headers = {};
|
|
34
|
-
this.withCredentials = false;
|
|
12
|
+
this.url = "", this.name = "file", this.fileType = "image", this.method = "post", this.xhrState = 200, this.timeout = 3e4, this.headers = {}, this.withCredentials = false;
|
|
35
13
|
}
|
|
36
14
|
}
|
|
37
|
-
class
|
|
38
|
-
constructor(
|
|
39
|
-
this.options =
|
|
15
|
+
class _ {
|
|
16
|
+
constructor(e2) {
|
|
17
|
+
this.options = e2;
|
|
40
18
|
}
|
|
41
19
|
upload() {
|
|
42
20
|
var _a;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (xhr.upload) {
|
|
47
|
-
xhr.upload.addEventListener("progress", (e) => {
|
|
21
|
+
const e2 = this.options, t2 = new XMLHttpRequest();
|
|
22
|
+
if (t2.timeout = e2.timeout, t2.upload) {
|
|
23
|
+
t2.upload.addEventListener("progress", (t3) => {
|
|
48
24
|
var _a2;
|
|
49
|
-
(_a2 =
|
|
50
|
-
}, false)
|
|
51
|
-
xhr.onreadystatechange = () => {
|
|
25
|
+
(_a2 = e2.onProgress) == null ? void 0 : _a2.call(e2, t3, e2);
|
|
26
|
+
}, false), t2.onreadystatechange = () => {
|
|
52
27
|
var _a2, _b;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
xhr.withCredentials = options.withCredentials;
|
|
62
|
-
xhr.open(options.method, options.url, true);
|
|
63
|
-
for (const [key, value] of Object.entries(options.headers)) {
|
|
64
|
-
xhr.setRequestHeader(key, value);
|
|
65
|
-
}
|
|
66
|
-
(_a = options.onStart) == null ? void 0 : _a.call(options, options);
|
|
67
|
-
xhr.send(options.formData);
|
|
68
|
-
} else {
|
|
69
|
-
console.warn("\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 XMLHttpRequest");
|
|
28
|
+
t2.readyState === 4 && (t2.status == e2.xhrState ? (_a2 = e2.onSuccess) == null ? void 0 : _a2.call(e2, t2.responseText, e2) : (_b = e2.onFailure) == null ? void 0 : _b.call(e2, t2.responseText, e2));
|
|
29
|
+
}, t2.withCredentials = e2.withCredentials, t2.open(e2.method, e2.url, true);
|
|
30
|
+
for (const [a2, l2] of Object.entries(e2.headers))
|
|
31
|
+
t2.setRequestHeader(a2, l2);
|
|
32
|
+
(_a = e2.onStart) == null ? void 0 : _a.call(e2, e2), t2.send(e2.formData);
|
|
70
33
|
}
|
|
71
34
|
}
|
|
72
|
-
uploadTaro(
|
|
35
|
+
uploadTaro(e2, t2) {
|
|
73
36
|
var _a;
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
37
|
+
const a2 = this.options;
|
|
38
|
+
if (t2 === "WEB")
|
|
76
39
|
this.upload();
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
success(response) {
|
|
87
|
-
var _a2, _b;
|
|
88
|
-
if (options.xhrState == response.statusCode) {
|
|
89
|
-
(_a2 = options.onSuccess) == null ? void 0 : _a2.call(options, response, options);
|
|
90
|
-
} else {
|
|
91
|
-
(_b = options.onFailure) == null ? void 0 : _b.call(options, response, options);
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
fail(e) {
|
|
95
|
-
var _a2;
|
|
96
|
-
(_a2 = options.onFailure) == null ? void 0 : _a2.call(options, e, options);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
(_a = options.onStart) == null ? void 0 : _a.call(options, options);
|
|
100
|
-
uploadTask.progress((res) => {
|
|
40
|
+
else {
|
|
41
|
+
const t3 = e2({ url: a2.url, filePath: a2.taroFilePath, fileType: a2.fileType, header: { "Content-Type": "multipart/form-data", ...a2.headers }, formData: a2.formData, name: a2.name, success(e3) {
|
|
42
|
+
var _a2, _b;
|
|
43
|
+
a2.xhrState == e3.statusCode ? (_a2 = a2.onSuccess) == null ? void 0 : _a2.call(a2, e3, a2) : (_b = a2.onFailure) == null ? void 0 : _b.call(a2, e3, a2);
|
|
44
|
+
}, fail(e3) {
|
|
45
|
+
var _a2;
|
|
46
|
+
(_a2 = a2.onFailure) == null ? void 0 : _a2.call(a2, e3, a2);
|
|
47
|
+
} });
|
|
48
|
+
(_a = a2.onStart) == null ? void 0 : _a.call(a2, a2), t3.progress((e3) => {
|
|
101
49
|
var _a2;
|
|
102
|
-
(_a2 =
|
|
50
|
+
(_a2 = a2.onProgress) == null ? void 0 : _a2.call(a2, e3, a2);
|
|
103
51
|
});
|
|
104
52
|
}
|
|
105
53
|
}
|
|
106
54
|
}
|
|
107
|
-
const { translate:
|
|
108
|
-
class
|
|
55
|
+
const { translate: w } = g("uploader");
|
|
56
|
+
class v {
|
|
109
57
|
constructor() {
|
|
110
|
-
this.status = "ready";
|
|
111
|
-
this.message = translate$1("ready");
|
|
112
|
-
this.uid = new Date().getTime().toString();
|
|
113
|
-
this.percentage = 0;
|
|
114
|
-
this.formData = {};
|
|
58
|
+
this.status = "ready", this.message = w("ready"), this.uid = new Date().getTime().toString(), this.percentage = 0, this.formData = {};
|
|
115
59
|
}
|
|
116
60
|
}
|
|
117
|
-
const { componentName, create, translate } =
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
type: Function,
|
|
144
|
-
default: null
|
|
145
|
-
},
|
|
146
|
-
beforeDelete: {
|
|
147
|
-
type: Function,
|
|
148
|
-
default: (file, files) => {
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
onChange: { type: Function }
|
|
153
|
-
},
|
|
154
|
-
emits: [
|
|
155
|
-
"start",
|
|
156
|
-
"progress",
|
|
157
|
-
"oversize",
|
|
158
|
-
"success",
|
|
159
|
-
"failure",
|
|
160
|
-
"change",
|
|
161
|
-
"delete",
|
|
162
|
-
"update:fileList",
|
|
163
|
-
"file-item-click"
|
|
164
|
-
],
|
|
165
|
-
setup(props, { emit }) {
|
|
166
|
-
const fileList = reactive(props.fileList);
|
|
167
|
-
let uploadQueue = [];
|
|
168
|
-
const classes = computed(() => {
|
|
169
|
-
const prefixCls = componentName;
|
|
170
|
-
return {
|
|
171
|
-
[prefixCls]: true
|
|
172
|
-
};
|
|
173
|
-
});
|
|
174
|
-
const clearInput = (el) => {
|
|
175
|
-
el.value = "";
|
|
176
|
-
};
|
|
177
|
-
const fileItemClick = (fileItem) => {
|
|
178
|
-
emit("file-item-click", { fileItem });
|
|
179
|
-
};
|
|
180
|
-
const executeUpload = (fileItem, index2) => {
|
|
181
|
-
const uploadOption = new UploadOptions();
|
|
182
|
-
uploadOption.url = props.url;
|
|
183
|
-
uploadOption.formData = fileItem.formData;
|
|
184
|
-
uploadOption.timeout = props.timeout * 1;
|
|
185
|
-
uploadOption.method = props.method;
|
|
186
|
-
uploadOption.xhrState = props.xhrState;
|
|
187
|
-
uploadOption.headers = props.headers;
|
|
188
|
-
uploadOption.withCredentials = props.withCredentials;
|
|
189
|
-
uploadOption.onStart = (option) => {
|
|
190
|
-
fileItem.status = "ready";
|
|
191
|
-
fileItem.message = translate("readyUpload");
|
|
192
|
-
clearUploadQueue(index2);
|
|
193
|
-
emit("start", option);
|
|
194
|
-
};
|
|
195
|
-
uploadOption.onProgress = (event, option) => {
|
|
196
|
-
fileItem.status = "uploading";
|
|
197
|
-
fileItem.message = translate("uploading");
|
|
198
|
-
fileItem.percentage = (event.loaded / event.total * 100).toFixed(0);
|
|
199
|
-
emit("progress", { event, option, percentage: fileItem.percentage });
|
|
200
|
-
};
|
|
201
|
-
uploadOption.onSuccess = (responseText, option) => {
|
|
202
|
-
fileItem.status = "success";
|
|
203
|
-
fileItem.message = translate("success");
|
|
204
|
-
emit("success", {
|
|
205
|
-
responseText,
|
|
206
|
-
option,
|
|
207
|
-
fileItem
|
|
208
|
-
});
|
|
209
|
-
emit("update:fileList", fileList);
|
|
210
|
-
};
|
|
211
|
-
uploadOption.onFailure = (responseText, option) => {
|
|
212
|
-
fileItem.status = "error";
|
|
213
|
-
fileItem.message = translate("error");
|
|
214
|
-
emit("failure", {
|
|
215
|
-
responseText,
|
|
216
|
-
option,
|
|
217
|
-
fileItem
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
let task = new Uploader(uploadOption);
|
|
221
|
-
if (props.autoUpload) {
|
|
222
|
-
task.upload();
|
|
223
|
-
} else {
|
|
224
|
-
uploadQueue.push(new Promise((resolve, reject) => {
|
|
225
|
-
resolve(task);
|
|
61
|
+
const { componentName: b, create: C, translate: k } = g("uploader"), S = C({ props: { name: { type: String, default: "file" }, url: { type: String, default: "" }, timeout: { type: [Number, String], default: 3e4 }, fileList: { type: Array, default: () => [] }, isPreview: { type: Boolean, default: true }, listType: { type: String, default: "picture" }, isDeletable: { type: Boolean, default: true }, method: { type: String, default: "post" }, capture: { type: Boolean, default: false }, maximize: { type: [Number, String], default: Number.MAX_VALUE }, maximum: { type: [Number, String], default: 1 }, clearInput: { type: Boolean, default: true }, accept: { type: String, default: "*" }, headers: { type: Object, default: {} }, data: { type: Object, default: {} }, uploadIcon: { type: String, default: "photograph" }, uploadIconSize: { type: [String, Number], default: "" }, xhrState: { type: [Number, String], default: 200 }, withCredentials: { type: Boolean, default: false }, multiple: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, autoUpload: { type: Boolean, default: true }, beforeUpload: { type: Function, default: null }, beforeDelete: { type: Function, default: (e2, t2) => true }, onChange: { type: Function } }, emits: ["start", "progress", "oversize", "success", "failure", "change", "delete", "update:fileList", "file-item-click"], setup(a2, { emit: l2 }) {
|
|
62
|
+
const s2 = e(a2.fileList);
|
|
63
|
+
let i2 = [];
|
|
64
|
+
const n2 = t(() => ({ [b]: true })), o2 = (e2 = -1) => {
|
|
65
|
+
e2 > -1 ? i2.splice(e2, 1) : i2 = [];
|
|
66
|
+
}, r2 = (t2) => {
|
|
67
|
+
t2.forEach((t3, n3) => {
|
|
68
|
+
const r3 = new FormData();
|
|
69
|
+
for (const [e2, t4] of Object.entries(a2.data))
|
|
70
|
+
r3.append(e2, t4);
|
|
71
|
+
r3.append(a2.name, t3);
|
|
72
|
+
const u3 = e(new v());
|
|
73
|
+
if (u3.name = t3.name, u3.status = "ready", u3.type = t3.type, u3.formData = r3, u3.message = k("waitingUpload"), ((e2, t4) => {
|
|
74
|
+
const n4 = new y();
|
|
75
|
+
n4.url = a2.url, n4.formData = e2.formData, n4.timeout = 1 * a2.timeout, n4.method = a2.method, n4.xhrState = a2.xhrState, n4.headers = a2.headers, n4.withCredentials = a2.withCredentials, n4.onStart = (a3) => {
|
|
76
|
+
e2.status = "ready", e2.message = k("readyUpload"), o2(t4), l2("start", a3);
|
|
77
|
+
}, n4.onProgress = (t5, a3) => {
|
|
78
|
+
e2.status = "uploading", e2.message = k("uploading"), e2.percentage = (t5.loaded / t5.total * 100).toFixed(0), l2("progress", { event: t5, option: a3, percentage: e2.percentage });
|
|
79
|
+
}, n4.onSuccess = (t5, a3) => {
|
|
80
|
+
e2.status = "success", e2.message = k("success"), l2("success", { responseText: t5, option: a3, fileItem: e2 }), l2("update:fileList", s2);
|
|
81
|
+
}, n4.onFailure = (t5, a3) => {
|
|
82
|
+
e2.status = "error", e2.message = k("error"), l2("failure", { responseText: t5, option: a3, fileItem: e2 });
|
|
83
|
+
};
|
|
84
|
+
let r4 = new _(n4);
|
|
85
|
+
a2.autoUpload ? r4.upload() : i2.push(new Promise((e3, t5) => {
|
|
86
|
+
e3(r4);
|
|
226
87
|
}));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
} else
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
fileItem.status = "ready";
|
|
251
|
-
fileItem.type = file.type;
|
|
252
|
-
fileItem.formData = formData;
|
|
253
|
-
fileItem.message = translate("waitingUpload");
|
|
254
|
-
executeUpload(fileItem, index2);
|
|
255
|
-
if (props.isPreview && file.type.includes("image")) {
|
|
256
|
-
const reader = new FileReader();
|
|
257
|
-
reader.onload = (event) => {
|
|
258
|
-
fileItem.url = event.target.result;
|
|
259
|
-
fileList.push(fileItem);
|
|
260
|
-
};
|
|
261
|
-
reader.readAsDataURL(file);
|
|
262
|
-
} else {
|
|
263
|
-
fileList.push(fileItem);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
};
|
|
267
|
-
const filterFiles = (files) => {
|
|
268
|
-
const maximum = props.maximum * 1;
|
|
269
|
-
const maximize = props.maximize * 1;
|
|
270
|
-
const oversizes = new Array();
|
|
271
|
-
files = files.filter((file) => {
|
|
272
|
-
if (file.size > maximize) {
|
|
273
|
-
oversizes.push(file);
|
|
274
|
-
return false;
|
|
275
|
-
} else {
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
if (oversizes.length) {
|
|
280
|
-
emit("oversize", oversizes);
|
|
281
|
-
}
|
|
282
|
-
let currentFileLength = files.length + fileList.length;
|
|
283
|
-
if (currentFileLength > maximum) {
|
|
284
|
-
files.splice(files.length - (currentFileLength - maximum));
|
|
285
|
-
}
|
|
286
|
-
return files;
|
|
287
|
-
};
|
|
288
|
-
const onDelete = (file, index2) => {
|
|
289
|
-
clearUploadQueue(index2);
|
|
290
|
-
if (props.beforeDelete(file, fileList)) {
|
|
291
|
-
fileList.splice(index2, 1);
|
|
292
|
-
emit("delete", {
|
|
293
|
-
file,
|
|
294
|
-
fileList,
|
|
295
|
-
index: index2
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
const onChange = (event) => {
|
|
300
|
-
if (props.disabled) {
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
const $el = event.target;
|
|
304
|
-
let { files } = $el;
|
|
305
|
-
if (props.beforeUpload) {
|
|
306
|
-
props.beforeUpload(files).then((f) => {
|
|
307
|
-
const _files = filterFiles(new Array().slice.call(f));
|
|
308
|
-
readFile(_files);
|
|
309
|
-
});
|
|
310
|
-
} else {
|
|
311
|
-
const _files = filterFiles(new Array().slice.call(files));
|
|
312
|
-
readFile(_files);
|
|
313
|
-
}
|
|
314
|
-
emit("change", {
|
|
315
|
-
fileList,
|
|
316
|
-
event
|
|
88
|
+
})(u3, n3), a2.isPreview && t3.type.includes("image")) {
|
|
89
|
+
const e2 = new FileReader();
|
|
90
|
+
e2.onload = (e3) => {
|
|
91
|
+
u3.url = e3.target.result, s2.push(u3);
|
|
92
|
+
}, e2.readAsDataURL(t3);
|
|
93
|
+
} else
|
|
94
|
+
s2.push(u3);
|
|
95
|
+
});
|
|
96
|
+
}, u2 = (e2) => {
|
|
97
|
+
const t2 = 1 * a2.maximum, i3 = 1 * a2.maximize, n3 = new Array();
|
|
98
|
+
e2 = e2.filter((e3) => !(e3.size > i3) || (n3.push(e3), false)), n3.length && l2("oversize", n3);
|
|
99
|
+
let o3 = e2.length + s2.length;
|
|
100
|
+
return o3 > t2 && e2.splice(e2.length - (o3 - t2)), e2;
|
|
101
|
+
};
|
|
102
|
+
return { onChange: (e2) => {
|
|
103
|
+
if (a2.disabled)
|
|
104
|
+
return;
|
|
105
|
+
const t2 = e2.target;
|
|
106
|
+
let { files: i3 } = t2;
|
|
107
|
+
if (a2.beforeUpload)
|
|
108
|
+
a2.beforeUpload(i3).then((e3) => {
|
|
109
|
+
const t3 = u2(new Array().slice.call(e3));
|
|
110
|
+
r2(t3);
|
|
317
111
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
class: "nut-
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
const _hoisted_3 = ["accept", "multiple", "name", "disabled"];
|
|
339
|
-
const _hoisted_4 = {
|
|
340
|
-
key: 0,
|
|
341
|
-
class: "nut-uploader__preview-img"
|
|
342
|
-
};
|
|
343
|
-
const _hoisted_5 = {
|
|
344
|
-
key: 0,
|
|
345
|
-
class: "nut-uploader__preview__progress"
|
|
346
|
-
};
|
|
347
|
-
const _hoisted_6 = { class: "nut-uploader__preview__progress__msg" };
|
|
348
|
-
const _hoisted_7 = {
|
|
349
|
-
key: 1,
|
|
350
|
-
class: "nut-uploader__preview__progress"
|
|
351
|
-
};
|
|
352
|
-
const _hoisted_8 = { class: "nut-uploader__preview__progress__msg" };
|
|
353
|
-
const _hoisted_9 = ["onClick", "src"];
|
|
354
|
-
const _hoisted_10 = {
|
|
355
|
-
key: 4,
|
|
356
|
-
class: "nut-uploader__preview-img__file"
|
|
357
|
-
};
|
|
358
|
-
const _hoisted_11 = ["onClick"];
|
|
359
|
-
const _hoisted_12 = { class: "tips" };
|
|
360
|
-
const _hoisted_13 = {
|
|
361
|
-
key: 1,
|
|
362
|
-
class: "nut-uploader__preview-list"
|
|
363
|
-
};
|
|
364
|
-
const _hoisted_14 = ["onClick"];
|
|
365
|
-
const _hoisted_15 = ["accept", "multiple", "name", "disabled"];
|
|
366
|
-
const _hoisted_16 = ["accept", "multiple", "name", "disabled"];
|
|
367
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
368
|
-
const _component_nut_icon = resolveComponent("nut-icon");
|
|
369
|
-
const _component_nut_progress = resolveComponent("nut-progress");
|
|
370
|
-
return openBlock(), createElementBlock("view", {
|
|
371
|
-
class: normalizeClass(_ctx.classes)
|
|
372
|
-
}, [
|
|
373
|
-
_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
374
|
-
renderSlot(_ctx.$slots, "default"),
|
|
375
|
-
_ctx.maximum - _ctx.fileList.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
376
|
-
_ctx.capture ? (openBlock(), createElementBlock("input", {
|
|
377
|
-
key: 0,
|
|
378
|
-
class: "nut-uploader__input",
|
|
379
|
-
type: "file",
|
|
380
|
-
capture: "camera",
|
|
381
|
-
accept: _ctx.accept,
|
|
382
|
-
multiple: _ctx.multiple,
|
|
383
|
-
name: _ctx.name,
|
|
384
|
-
disabled: _ctx.disabled,
|
|
385
|
-
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args))
|
|
386
|
-
}, null, 40, _hoisted_2)) : (openBlock(), createElementBlock("input", {
|
|
387
|
-
key: 1,
|
|
388
|
-
class: "nut-uploader__input",
|
|
389
|
-
type: "file",
|
|
390
|
-
accept: _ctx.accept,
|
|
391
|
-
multiple: _ctx.multiple,
|
|
392
|
-
name: _ctx.name,
|
|
393
|
-
disabled: _ctx.disabled,
|
|
394
|
-
onChange: _cache[1] || (_cache[1] = (...args) => _ctx.onChange && _ctx.onChange(...args))
|
|
395
|
-
}, null, 40, _hoisted_3))
|
|
396
|
-
], 64)) : createCommentVNode("", true)
|
|
397
|
-
])) : createCommentVNode("", true),
|
|
398
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fileList, (item, index2) => {
|
|
399
|
-
return openBlock(), createElementBlock("view", {
|
|
400
|
-
class: normalizeClass(["nut-uploader__preview", [_ctx.listType]]),
|
|
401
|
-
key: item.uid
|
|
402
|
-
}, [
|
|
403
|
-
_ctx.listType == "picture" && !_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_4, [
|
|
404
|
-
item.status == "ready" ? (openBlock(), createElementBlock("view", _hoisted_5, [
|
|
405
|
-
createElementVNode("view", _hoisted_6, toDisplayString(item.message), 1)
|
|
406
|
-
])) : item.status != "success" ? (openBlock(), createElementBlock("view", _hoisted_7, [
|
|
407
|
-
createVNode(_component_nut_icon, {
|
|
408
|
-
color: "#fff",
|
|
409
|
-
name: item.status == "error" ? "failure" : "loading"
|
|
410
|
-
}, null, 8, ["name"]),
|
|
411
|
-
createElementVNode("view", _hoisted_8, toDisplayString(item.message), 1)
|
|
412
|
-
])) : createCommentVNode("", true),
|
|
413
|
-
_ctx.isDeletable ? (openBlock(), createBlock(_component_nut_icon, {
|
|
414
|
-
key: 2,
|
|
415
|
-
color: "rgba(0,0,0,0.6)",
|
|
416
|
-
onClick: ($event) => _ctx.onDelete(item, index2),
|
|
417
|
-
class: "close",
|
|
418
|
-
name: "failure"
|
|
419
|
-
}, null, 8, ["onClick"])) : createCommentVNode("", true),
|
|
420
|
-
item.type.includes("image") && item.url ? (openBlock(), createElementBlock("img", {
|
|
421
|
-
key: 3,
|
|
422
|
-
class: "nut-uploader__preview-img__c",
|
|
423
|
-
onClick: ($event) => _ctx.fileItemClick(item),
|
|
424
|
-
src: item.url
|
|
425
|
-
}, null, 8, _hoisted_9)) : (openBlock(), createElementBlock("view", _hoisted_10, [
|
|
426
|
-
createElementVNode("view", {
|
|
427
|
-
onClick: ($event) => _ctx.fileItemClick(item),
|
|
428
|
-
class: "nut-uploader__preview-img__file__name"
|
|
429
|
-
}, [
|
|
430
|
-
createVNode(_component_nut_icon, {
|
|
431
|
-
color: "#808080",
|
|
432
|
-
name: "link"
|
|
433
|
-
}),
|
|
434
|
-
createTextVNode("\xA0" + toDisplayString(item.name), 1)
|
|
435
|
-
], 8, _hoisted_11)
|
|
436
|
-
])),
|
|
437
|
-
createElementVNode("view", _hoisted_12, toDisplayString(item.name), 1)
|
|
438
|
-
])) : _ctx.listType == "list" ? (openBlock(), createElementBlock("view", _hoisted_13, [
|
|
439
|
-
createElementVNode("view", {
|
|
440
|
-
onClick: ($event) => _ctx.fileItemClick(item),
|
|
441
|
-
class: normalizeClass(["nut-uploader__preview-img__file__name", [item.status]])
|
|
442
|
-
}, [
|
|
443
|
-
createVNode(_component_nut_icon, { name: "link" }),
|
|
444
|
-
createTextVNode("\xA0" + toDisplayString(item.name), 1)
|
|
445
|
-
], 10, _hoisted_14),
|
|
446
|
-
createVNode(_component_nut_icon, {
|
|
447
|
-
class: "nut-uploader__preview-img__file__del",
|
|
448
|
-
onClick: ($event) => _ctx.onDelete(item, index2),
|
|
449
|
-
color: "#808080",
|
|
450
|
-
name: "del"
|
|
451
|
-
}, null, 8, ["onClick"]),
|
|
452
|
-
item.status == "uploading" ? (openBlock(), createBlock(_component_nut_progress, {
|
|
453
|
-
key: 0,
|
|
454
|
-
size: "small",
|
|
455
|
-
percentage: item.percentage,
|
|
456
|
-
"stroke-color": "linear-gradient(270deg, rgba(18,126,255,1) 0%,rgba(32,147,255,1) 32.815625%,rgba(13,242,204,1) 100%)",
|
|
457
|
-
"show-text": false
|
|
458
|
-
}, null, 8, ["percentage"])) : createCommentVNode("", true)
|
|
459
|
-
])) : createCommentVNode("", true)
|
|
460
|
-
], 2);
|
|
461
|
-
}), 128)),
|
|
462
|
-
_ctx.listType == "picture" && !_ctx.$slots.default && _ctx.maximum - _ctx.fileList.length ? (openBlock(), createElementBlock("view", {
|
|
463
|
-
key: 1,
|
|
464
|
-
class: normalizeClass(["nut-uploader__upload", [_ctx.listType]])
|
|
465
|
-
}, [
|
|
466
|
-
createVNode(_component_nut_icon, {
|
|
467
|
-
size: _ctx.uploadIconSize,
|
|
468
|
-
color: "#808080",
|
|
469
|
-
name: _ctx.uploadIcon
|
|
470
|
-
}, null, 8, ["size", "name"]),
|
|
471
|
-
_ctx.capture ? (openBlock(), createElementBlock("input", {
|
|
472
|
-
key: 0,
|
|
473
|
-
class: "nut-uploader__input",
|
|
474
|
-
type: "file",
|
|
475
|
-
capture: "camera",
|
|
476
|
-
accept: _ctx.accept,
|
|
477
|
-
multiple: _ctx.multiple,
|
|
478
|
-
name: _ctx.name,
|
|
479
|
-
disabled: _ctx.disabled,
|
|
480
|
-
onChange: _cache[2] || (_cache[2] = (...args) => _ctx.onChange && _ctx.onChange(...args))
|
|
481
|
-
}, null, 40, _hoisted_15)) : (openBlock(), createElementBlock("input", {
|
|
482
|
-
key: 1,
|
|
483
|
-
class: "nut-uploader__input",
|
|
484
|
-
type: "file",
|
|
485
|
-
accept: _ctx.accept,
|
|
486
|
-
multiple: _ctx.multiple,
|
|
487
|
-
name: _ctx.name,
|
|
488
|
-
disabled: _ctx.disabled,
|
|
489
|
-
onChange: _cache[3] || (_cache[3] = (...args) => _ctx.onChange && _ctx.onChange(...args))
|
|
490
|
-
}, null, 40, _hoisted_16))
|
|
491
|
-
], 2)) : createCommentVNode("", true)
|
|
492
|
-
], 2);
|
|
493
|
-
}
|
|
494
|
-
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
495
|
-
export { index as default };
|
|
112
|
+
else {
|
|
113
|
+
const e3 = u2(new Array().slice.call(i3));
|
|
114
|
+
r2(e3);
|
|
115
|
+
}
|
|
116
|
+
l2("change", { fileList: s2, event: e2 }), a2.clearInput && (t2.value = "");
|
|
117
|
+
}, onDelete: (e2, t2) => {
|
|
118
|
+
o2(t2), a2.beforeDelete(e2, s2) && (s2.splice(t2, 1), l2("delete", { file: e2, fileList: s2, index: t2 }));
|
|
119
|
+
}, fileList: s2, classes: n2, fileItemClick: (e2) => {
|
|
120
|
+
l2("file-item-click", { fileItem: e2 });
|
|
121
|
+
}, clearUploadQueue: o2, submit: () => {
|
|
122
|
+
Promise.all(i2).then((e2) => {
|
|
123
|
+
e2.forEach((e3) => e3.upload());
|
|
124
|
+
});
|
|
125
|
+
} };
|
|
126
|
+
} }), x = { key: 0, class: "nut-uploader__slot" }, D = ["accept", "multiple", "name", "disabled"], T = ["accept", "multiple", "name", "disabled"], L = { key: 0, class: "nut-uploader__preview-img" }, I = { key: 0, class: "nut-uploader__preview__progress" }, F = { class: "nut-uploader__preview__progress__msg" }, z = { key: 1, class: "nut-uploader__preview__progress" }, U = { class: "nut-uploader__preview__progress__msg" }, B = ["onClick", "src"], P = { key: 4, class: "nut-uploader__preview-img__file" }, A = ["onClick"], N = { class: "tips" }, j = { key: 1, class: "nut-uploader__preview-list" }, E = ["onClick"], O = ["accept", "multiple", "name", "disabled"], R = ["accept", "multiple", "name", "disabled"];
|
|
127
|
+
var $ = h(S, [["render", function(e2, t2, g2, h2, y2, _2) {
|
|
128
|
+
const w2 = a("nut-icon"), v2 = a("nut-progress");
|
|
129
|
+
return l(), s("view", { class: i(e2.classes) }, [e2.$slots.default ? (l(), s("view", x, [n(e2.$slots, "default"), e2.maximum - e2.fileList.length ? (l(), s(o, { key: 0 }, [e2.capture ? (l(), s("input", { key: 0, class: "nut-uploader__input", type: "file", capture: "camera", accept: e2.accept, multiple: e2.multiple, name: e2.name, disabled: e2.disabled, onChange: t2[0] || (t2[0] = (...t3) => e2.onChange && e2.onChange(...t3)) }, null, 40, D)) : (l(), s("input", { key: 1, class: "nut-uploader__input", type: "file", accept: e2.accept, multiple: e2.multiple, name: e2.name, disabled: e2.disabled, onChange: t2[1] || (t2[1] = (...t3) => e2.onChange && e2.onChange(...t3)) }, null, 40, T))], 64)) : r("", true)])) : r("", true), (l(true), s(o, null, u(e2.fileList, (t3, a2) => (l(), s("view", { class: i(["nut-uploader__preview", [e2.listType]]), key: t3.uid }, [e2.listType != "picture" || e2.$slots.default ? e2.listType == "list" ? (l(), s("view", j, [p("view", { onClick: (a3) => e2.fileItemClick(t3), class: i(["nut-uploader__preview-img__file__name", [t3.status]]) }, [d(w2, { name: "link" }), f("\xA0" + c(t3.name), 1)], 10, E), d(w2, { class: "nut-uploader__preview-img__file__del", onClick: (l2) => e2.onDelete(t3, a2), color: "#808080", name: "del" }, null, 8, ["onClick"]), t3.status == "uploading" ? (l(), m(v2, { key: 0, size: "small", percentage: t3.percentage, "stroke-color": "linear-gradient(270deg, rgba(18,126,255,1) 0%,rgba(32,147,255,1) 32.815625%,rgba(13,242,204,1) 100%)", "show-text": false }, null, 8, ["percentage"])) : r("", true)])) : r("", true) : (l(), s("view", L, [t3.status == "ready" ? (l(), s("view", I, [p("view", F, c(t3.message), 1)])) : t3.status != "success" ? (l(), s("view", z, [d(w2, { color: "#fff", name: t3.status == "error" ? "failure" : "loading" }, null, 8, ["name"]), p("view", U, c(t3.message), 1)])) : r("", true), e2.isDeletable ? (l(), m(w2, { key: 2, color: "rgba(0,0,0,0.6)", onClick: (l2) => e2.onDelete(t3, a2), class: "close", name: "failure" }, null, 8, ["onClick"])) : r("", true), t3.type.includes("image") && t3.url ? (l(), s("img", { key: 3, class: "nut-uploader__preview-img__c", onClick: (a3) => e2.fileItemClick(t3), src: t3.url }, null, 8, B)) : (l(), s("view", P, [p("view", { onClick: (a3) => e2.fileItemClick(t3), class: "nut-uploader__preview-img__file__name" }, [d(w2, { color: "#808080", name: "link" }), f("\xA0" + c(t3.name), 1)], 8, A)])), p("view", N, c(t3.name), 1)]))], 2))), 128)), e2.listType == "picture" && !e2.$slots.default && e2.maximum - e2.fileList.length ? (l(), s("view", { key: 1, class: i(["nut-uploader__upload", [e2.listType]]) }, [d(w2, { size: e2.uploadIconSize, color: "#808080", name: e2.uploadIcon }, null, 8, ["size", "name"]), e2.capture ? (l(), s("input", { key: 0, class: "nut-uploader__input", type: "file", capture: "camera", accept: e2.accept, multiple: e2.multiple, name: e2.name, disabled: e2.disabled, onChange: t2[2] || (t2[2] = (...t3) => e2.onChange && e2.onChange(...t3)) }, null, 40, O)) : (l(), s("input", { key: 1, class: "nut-uploader__input", type: "file", accept: e2.accept, multiple: e2.multiple, name: e2.name, disabled: e2.disabled, onChange: t2[3] || (t2[3] = (...t3) => e2.onChange && e2.onChange(...t3)) }, null, 40, R))], 2)) : r("", true)], 2);
|
|
130
|
+
}]]);
|
|
131
|
+
export { $ as default };
|