@nutui/nutui 3.1.10 → 3.1.12-beta.1
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 +17 -0
- package/dist/nutui.d.ts +5 -1
- package/dist/nutui.es.js +4041 -3518
- package/dist/nutui.umd.js +4084 -3627
- package/dist/packages/_es/ActionSheet.js +13 -12
- package/dist/packages/_es/Address.js +63 -49
- package/dist/packages/_es/Avatar.js +4 -5
- package/dist/packages/_es/BackTop.js +72 -109
- package/dist/packages/_es/Badge.js +4 -5
- package/dist/packages/_es/Barrage.js +63 -57
- package/dist/packages/_es/Button.js +5 -6
- package/dist/packages/_es/Calendar.js +27 -18
- package/dist/packages/_es/Card.js +104 -0
- package/dist/packages/_es/Cell.js +5 -13
- package/dist/packages/_es/CellGroup.js +4 -5
- package/dist/packages/_es/Checkbox.js +3 -3
- package/dist/packages/_es/CheckboxGroup.js +9 -4
- package/dist/packages/_es/CircleProgress.js +142 -46
- package/dist/packages/_es/Col.js +4 -5
- package/dist/packages/_es/Collapse.js +35 -10
- package/dist/packages/_es/CollapseItem.js +80 -35
- package/dist/packages/_es/CountDown.js +7 -5
- package/dist/packages/_es/CountUp.js +34 -31
- package/dist/packages/_es/DatePicker.js +451 -219
- package/dist/packages/_es/Dialog.js +13 -87
- package/dist/packages/_es/Divider.js +5 -6
- package/dist/packages/_es/Drag.js +76 -50
- package/dist/packages/_es/Elevator.js +81 -52
- package/dist/packages/_es/FixedNav.js +8 -9
- package/dist/packages/_es/Form.js +137 -0
- package/dist/packages/_es/FormItem.js +109 -0
- package/dist/packages/_es/Icon.js +6 -40
- package/dist/packages/_es/ImagePreview.js +23 -21
- package/dist/packages/_es/InfiniteLoading.js +95 -109
- package/dist/packages/_es/Input.js +22 -21
- package/dist/packages/_es/InputNumber.js +24 -18
- package/dist/packages/_es/Layout.js +2 -2
- package/dist/packages/_es/Menu.js +89 -171
- package/dist/packages/_es/MenuItem.js +155 -18
- package/dist/packages/_es/Navbar.js +7 -7
- package/dist/packages/_es/NoticeBar.js +39 -26
- package/dist/packages/_es/Notify.js +30 -166
- package/dist/packages/_es/NumberKeyboard.js +10 -6
- package/dist/packages/_es/OverLay.js +22 -29
- package/dist/packages/_es/Pagination.js +8 -9
- package/dist/packages/_es/Picker.js +61 -447
- package/dist/packages/_es/Popover.js +146 -25
- package/dist/packages/_es/Popup.js +18 -39
- package/dist/packages/_es/Price.js +18 -7
- package/dist/packages/_es/Progress.js +23 -12
- package/dist/packages/_es/Radio.js +20 -7
- package/dist/packages/_es/RadioGroup.js +7 -3
- package/dist/packages/_es/Range.js +38 -59
- package/dist/packages/_es/Rate.js +16 -20
- package/dist/packages/_es/Row.js +4 -5
- package/dist/packages/_es/SearchBar.js +7 -5
- package/dist/packages/_es/ShortPassword.js +89 -59
- package/dist/packages/_es/Signature.js +70 -71
- package/dist/packages/_es/Sku.js +508 -0
- package/dist/packages/_es/Step.js +10 -8
- package/dist/packages/_es/Steps.js +2 -2
- package/dist/packages/_es/Swipe.js +42 -27
- package/dist/packages/_es/Swiper.js +17 -418
- package/dist/packages/_es/SwiperItem.js +14 -39
- package/dist/packages/_es/Switch.js +4 -5
- package/dist/packages/_es/TabPane.js +4 -5
- package/dist/packages/_es/Tabbar.js +4 -5
- package/dist/packages/_es/TabbarItem.js +8 -9
- package/dist/packages/_es/Tabs.js +23 -17
- package/dist/packages/_es/Tag.js +5 -6
- package/dist/packages/_es/TextArea.js +16 -12
- package/dist/packages/_es/TimeDetail.js +7 -5
- package/dist/packages/_es/TimePannel.js +7 -5
- package/dist/packages/_es/TimeSelect.js +12 -7
- package/dist/packages/_es/Toast.js +41 -163
- package/dist/packages/_es/Uploader.js +210 -164
- package/dist/packages/_es/commonProps.js +30 -0
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +1 -1
- package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
- package/dist/packages/_es/index2.js +44 -8
- package/dist/packages/_es/index3.js +419 -0
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/raf.js +1 -1
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +47 -0
- package/dist/packages/button/index.scss +9 -0
- package/dist/packages/card/index.scss +97 -0
- package/dist/packages/checkbox/index.scss +1 -1
- package/dist/packages/form/index.scss +2 -0
- package/dist/packages/formitem/index.scss +60 -0
- package/dist/packages/menu/index.scss +32 -60
- package/dist/packages/menuitem/index.scss +36 -99
- package/dist/packages/numberkeyboard/index.scss +1 -1
- package/dist/packages/progress/index.scss +2 -0
- package/dist/packages/radio/index.scss +32 -4
- package/dist/packages/radiogroup/index.scss +20 -0
- package/dist/packages/sku/index.scss +147 -0
- package/dist/packages/switch/index.scss +1 -1
- package/dist/packages/uploader/index.scss +95 -8
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -2
- package/dist/styles/mixins/index.scss +0 -4
- package/dist/styles/themes/default.scss +34 -30
- package/dist/styles/variables.scss +45 -3
- package/package.json +3 -2
- package/dist/packages/_es/Video.js +0 -405
- package/dist/packages/_es/plugin-vue_export-helper.js +0 -12
- package/dist/packages/_es/style.css +0 -160
|
@@ -14,18 +14,21 @@ var __spreadValues = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
+
var __require = typeof require !== "undefined" ? require : (x) => {
|
|
18
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
19
|
+
};
|
|
17
20
|
var __publicField = (obj, key, value) => {
|
|
18
21
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
22
|
return value;
|
|
20
23
|
};
|
|
21
24
|
/*!
|
|
22
|
-
* @nutui/nutui v3.1.
|
|
25
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
23
26
|
* (c) 2021 @jdf2e.
|
|
24
27
|
* Released under the MIT License.
|
|
25
28
|
*/
|
|
26
|
-
import { reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot,
|
|
29
|
+
import { reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock, createCommentVNode, Fragment, renderList, createElementVNode, toDisplayString, createVNode, createTextVNode } from "vue";
|
|
27
30
|
import { c as createComponent } from "./component.js";
|
|
28
|
-
import
|
|
31
|
+
import Taro from "@tarojs/taro";
|
|
29
32
|
class UploadOptions {
|
|
30
33
|
constructor() {
|
|
31
34
|
__publicField(this, "url", "");
|
|
@@ -61,7 +64,7 @@ class Uploader {
|
|
|
61
64
|
xhr.onreadystatechange = () => {
|
|
62
65
|
var _a2, _b;
|
|
63
66
|
if (xhr.readyState === 4) {
|
|
64
|
-
if (xhr.status
|
|
67
|
+
if (xhr.status == options.xhrState) {
|
|
65
68
|
(_a2 = options.onSuccess) == null ? void 0 : _a2.call(options, xhr.responseText, options);
|
|
66
69
|
} else {
|
|
67
70
|
(_b = options.onFailure) == null ? void 0 : _b.call(options, xhr.responseText, options);
|
|
@@ -92,7 +95,7 @@ class Uploader {
|
|
|
92
95
|
name: options.name,
|
|
93
96
|
success(response) {
|
|
94
97
|
var _a2, _b;
|
|
95
|
-
if (options.xhrState
|
|
98
|
+
if (options.xhrState == response.statusCode) {
|
|
96
99
|
(_a2 = options.onSuccess) == null ? void 0 : _a2.call(options, response, options);
|
|
97
100
|
} else {
|
|
98
101
|
(_b = options.onFailure) == null ? void 0 : _b.call(options, response, options);
|
|
@@ -114,40 +117,46 @@ const { componentName, create } = createComponent("uploader");
|
|
|
114
117
|
class FileItem {
|
|
115
118
|
constructor() {
|
|
116
119
|
__publicField(this, "status", "ready");
|
|
120
|
+
__publicField(this, "message", "\u51C6\u5907\u5B8C\u6210");
|
|
117
121
|
__publicField(this, "uid", new Date().getTime().toString());
|
|
118
|
-
__publicField(this, "name");
|
|
119
122
|
__publicField(this, "url");
|
|
123
|
+
__publicField(this, "path");
|
|
124
|
+
__publicField(this, "name");
|
|
120
125
|
__publicField(this, "type");
|
|
121
|
-
__publicField(this, "
|
|
126
|
+
__publicField(this, "percentage", 0);
|
|
127
|
+
__publicField(this, "formData", {});
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
|
-
|
|
130
|
+
var _sfc_main = create({
|
|
125
131
|
props: {
|
|
126
132
|
name: { type: String, default: "file" },
|
|
127
133
|
url: { type: String, default: "" },
|
|
134
|
+
sizeType: {
|
|
135
|
+
type: Array,
|
|
136
|
+
default: () => ["original", "compressed"]
|
|
137
|
+
},
|
|
138
|
+
sourceType: {
|
|
139
|
+
type: Array,
|
|
140
|
+
default: () => ["album", "camera"]
|
|
141
|
+
},
|
|
128
142
|
timeout: { type: [Number, String], default: 1e3 * 30 },
|
|
129
143
|
fileList: { type: Array, default: () => [] },
|
|
130
144
|
isPreview: { type: Boolean, default: true },
|
|
145
|
+
listType: { type: String, default: "picture" },
|
|
131
146
|
isDeletable: { type: Boolean, default: true },
|
|
132
147
|
method: { type: String, default: "post" },
|
|
133
148
|
capture: { type: Boolean, default: false },
|
|
134
149
|
maximize: { type: [Number, String], default: Number.MAX_VALUE },
|
|
135
|
-
maximum: { type: [Number, String], default:
|
|
136
|
-
clearInput: { type: Boolean, default:
|
|
150
|
+
maximum: { type: [Number, String], default: 9 },
|
|
151
|
+
clearInput: { type: Boolean, default: true },
|
|
137
152
|
accept: { type: String, default: "*" },
|
|
138
153
|
headers: { type: Object, default: {} },
|
|
139
154
|
data: { type: Object, default: {} },
|
|
140
155
|
uploadIcon: { type: String, default: "photograph" },
|
|
141
156
|
uploadIconSize: { type: [String, Number], default: "" },
|
|
142
157
|
xhrState: { type: [Number, String], default: 200 },
|
|
143
|
-
withCredentials: { type: Boolean, default: false },
|
|
144
|
-
multiple: { type: Boolean, default: false },
|
|
145
158
|
disabled: { type: Boolean, default: false },
|
|
146
159
|
autoUpload: { type: Boolean, default: true },
|
|
147
|
-
beforeUpload: {
|
|
148
|
-
type: Function,
|
|
149
|
-
default: null
|
|
150
|
-
},
|
|
151
160
|
beforeDelete: {
|
|
152
161
|
type: Function,
|
|
153
162
|
default: (file, files) => {
|
|
@@ -156,7 +165,17 @@ const _sfc_main = create({
|
|
|
156
165
|
},
|
|
157
166
|
onChange: { type: Function }
|
|
158
167
|
},
|
|
159
|
-
emits: [
|
|
168
|
+
emits: [
|
|
169
|
+
"start",
|
|
170
|
+
"progress",
|
|
171
|
+
"oversize",
|
|
172
|
+
"success",
|
|
173
|
+
"failure",
|
|
174
|
+
"change",
|
|
175
|
+
"delete",
|
|
176
|
+
"update:fileList",
|
|
177
|
+
"file-item-click"
|
|
178
|
+
],
|
|
160
179
|
setup(props, { emit }) {
|
|
161
180
|
const fileList = reactive(props.fileList);
|
|
162
181
|
let uploadQueue = [];
|
|
@@ -166,86 +185,101 @@ const _sfc_main = create({
|
|
|
166
185
|
[prefixCls]: true
|
|
167
186
|
};
|
|
168
187
|
});
|
|
169
|
-
const
|
|
170
|
-
|
|
188
|
+
const chooseImage = () => {
|
|
189
|
+
if (props.disabled) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
Taro.chooseImage({
|
|
193
|
+
count: props.maximum * 1 - props.fileList.length,
|
|
194
|
+
sizeType: props.sizeType,
|
|
195
|
+
sourceType: props.sourceType,
|
|
196
|
+
success: onChange
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
const fileItemClick = (fileItem) => {
|
|
200
|
+
emit("file-item-click", { fileItem });
|
|
171
201
|
};
|
|
172
|
-
const executeUpload = (fileItem,
|
|
202
|
+
const executeUpload = (fileItem, index) => {
|
|
173
203
|
const uploadOption = new UploadOptions();
|
|
204
|
+
uploadOption.name = props.name;
|
|
174
205
|
uploadOption.url = props.url;
|
|
175
206
|
for (const [key, value] of Object.entries(props.data)) {
|
|
176
|
-
fileItem.formData
|
|
207
|
+
fileItem.formData[key] = value;
|
|
177
208
|
}
|
|
178
209
|
uploadOption.formData = fileItem.formData;
|
|
179
|
-
uploadOption.timeout = props.timeout * 1;
|
|
180
210
|
uploadOption.method = props.method;
|
|
181
|
-
uploadOption.xhrState = props.xhrState;
|
|
182
211
|
uploadOption.headers = props.headers;
|
|
183
|
-
uploadOption.
|
|
212
|
+
uploadOption.taroFilePath = fileItem.path;
|
|
184
213
|
uploadOption.onStart = (option) => {
|
|
185
214
|
fileItem.status = "ready";
|
|
186
|
-
|
|
215
|
+
fileItem.message = "\u51C6\u5907\u4E0A\u4F20";
|
|
216
|
+
clearUploadQueue(index);
|
|
187
217
|
emit("start", option);
|
|
188
218
|
};
|
|
189
|
-
uploadOption.onProgress = (
|
|
219
|
+
uploadOption.onProgress = (event, option) => {
|
|
190
220
|
fileItem.status = "uploading";
|
|
191
|
-
|
|
221
|
+
fileItem.message = "\u4E0A\u4F20\u4E2D";
|
|
222
|
+
fileItem.percentage = event.progress;
|
|
223
|
+
emit("progress", { event, option, percentage: fileItem.percentage });
|
|
192
224
|
};
|
|
193
|
-
uploadOption.onSuccess = (
|
|
225
|
+
uploadOption.onSuccess = (data, option) => {
|
|
194
226
|
fileItem.status = "success";
|
|
227
|
+
fileItem.message = "\u4E0A\u4F20\u6210\u529F";
|
|
195
228
|
emit("success", {
|
|
196
|
-
|
|
197
|
-
option
|
|
229
|
+
data,
|
|
230
|
+
option,
|
|
231
|
+
fileItem
|
|
198
232
|
});
|
|
199
233
|
emit("update:fileList", fileList);
|
|
200
234
|
};
|
|
201
|
-
uploadOption.onFailure = (
|
|
235
|
+
uploadOption.onFailure = (data, option) => {
|
|
202
236
|
fileItem.status = "error";
|
|
237
|
+
fileItem.message = "\u4E0A\u4F20\u5931\u8D25";
|
|
203
238
|
emit("failure", {
|
|
204
|
-
|
|
205
|
-
option
|
|
239
|
+
data,
|
|
240
|
+
option,
|
|
241
|
+
fileItem
|
|
206
242
|
});
|
|
207
243
|
};
|
|
208
244
|
let task = new Uploader(uploadOption);
|
|
209
245
|
if (props.autoUpload) {
|
|
210
|
-
task.
|
|
246
|
+
task.uploadTaro(Taro.uploadFile);
|
|
211
247
|
} else {
|
|
212
248
|
uploadQueue.push(new Promise((resolve, reject) => {
|
|
213
249
|
resolve(task);
|
|
214
250
|
}));
|
|
215
251
|
}
|
|
216
252
|
};
|
|
217
|
-
const clearUploadQueue = (
|
|
218
|
-
if (
|
|
219
|
-
uploadQueue.splice(
|
|
253
|
+
const clearUploadQueue = (index = -1) => {
|
|
254
|
+
if (index > -1) {
|
|
255
|
+
uploadQueue.splice(index, 1);
|
|
220
256
|
} else {
|
|
221
257
|
uploadQueue = [];
|
|
222
258
|
}
|
|
223
259
|
};
|
|
224
260
|
const submit = () => {
|
|
225
261
|
Promise.all(uploadQueue).then((res) => {
|
|
226
|
-
res.forEach((i) => i.
|
|
262
|
+
res.forEach((i) => i.uploadTaro(Taro.uploadFile));
|
|
227
263
|
});
|
|
228
264
|
};
|
|
229
265
|
const readFile = (files) => {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
266
|
+
const imgReg = /\.(png|jpeg|jpg|webp|gif)$/gi;
|
|
267
|
+
files.forEach((file, index) => {
|
|
268
|
+
let fileType = file.type;
|
|
233
269
|
const fileItem = reactive(new FileItem());
|
|
234
|
-
|
|
270
|
+
if (!fileType && imgReg.test(file.path)) {
|
|
271
|
+
fileType = "image";
|
|
272
|
+
}
|
|
273
|
+
fileItem.path = file.path;
|
|
274
|
+
fileItem.name = file.path;
|
|
235
275
|
fileItem.status = "ready";
|
|
236
|
-
fileItem.
|
|
237
|
-
fileItem.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const reader = new FileReader();
|
|
241
|
-
reader.onload = (event) => {
|
|
242
|
-
fileItem.url = event.target.result;
|
|
243
|
-
fileList.push(fileItem);
|
|
244
|
-
};
|
|
245
|
-
reader.readAsDataURL(file);
|
|
246
|
-
} else {
|
|
247
|
-
fileList.push(fileItem);
|
|
276
|
+
fileItem.message = "\u7B49\u5F85\u4E0A\u4F20";
|
|
277
|
+
fileItem.type = fileType;
|
|
278
|
+
if (props.isPreview) {
|
|
279
|
+
fileItem.url = file.path;
|
|
248
280
|
}
|
|
281
|
+
fileList.push(fileItem);
|
|
282
|
+
executeUpload(fileItem, index);
|
|
249
283
|
});
|
|
250
284
|
};
|
|
251
285
|
const filterFiles = (files) => {
|
|
@@ -268,10 +302,10 @@ const _sfc_main = create({
|
|
|
268
302
|
}
|
|
269
303
|
return files;
|
|
270
304
|
};
|
|
271
|
-
const onDelete = (file,
|
|
272
|
-
clearUploadQueue(
|
|
305
|
+
const onDelete = (file, index) => {
|
|
306
|
+
clearUploadQueue(index);
|
|
273
307
|
if (props.beforeDelete(file, fileList)) {
|
|
274
|
-
fileList.splice(
|
|
308
|
+
fileList.splice(index, 1);
|
|
275
309
|
emit("delete", {
|
|
276
310
|
file,
|
|
277
311
|
fileList
|
|
@@ -280,34 +314,20 @@ const _sfc_main = create({
|
|
|
280
314
|
console.log("\u7528\u6237\u963B\u6B62\u4E86\u5220\u9664\uFF01");
|
|
281
315
|
}
|
|
282
316
|
};
|
|
283
|
-
const onChange = (
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const $el = event.target;
|
|
288
|
-
let { files } = $el;
|
|
289
|
-
if (props.beforeUpload) {
|
|
290
|
-
props.beforeUpload(files).then((f) => {
|
|
291
|
-
const _files = filterFiles(new Array().slice.call(f));
|
|
292
|
-
readFile(_files);
|
|
293
|
-
});
|
|
294
|
-
} else {
|
|
295
|
-
const _files = filterFiles(new Array().slice.call(files));
|
|
296
|
-
readFile(_files);
|
|
297
|
-
}
|
|
317
|
+
const onChange = (res) => {
|
|
318
|
+
const { tempFilePaths, tempFiles } = res;
|
|
319
|
+
const _files = filterFiles(tempFiles);
|
|
320
|
+
readFile(_files);
|
|
298
321
|
emit("change", {
|
|
299
|
-
fileList
|
|
300
|
-
event
|
|
322
|
+
fileList
|
|
301
323
|
});
|
|
302
|
-
if (props.clearInput) {
|
|
303
|
-
clearInput($el);
|
|
304
|
-
}
|
|
305
324
|
};
|
|
306
325
|
return {
|
|
307
|
-
onChange,
|
|
308
326
|
onDelete,
|
|
309
327
|
fileList,
|
|
310
328
|
classes,
|
|
329
|
+
chooseImage,
|
|
330
|
+
fileItemClick,
|
|
311
331
|
clearUploadQueue,
|
|
312
332
|
submit
|
|
313
333
|
};
|
|
@@ -317,101 +337,127 @@ const _hoisted_1 = {
|
|
|
317
337
|
key: 0,
|
|
318
338
|
class: "nut-uploader__slot"
|
|
319
339
|
};
|
|
320
|
-
const _hoisted_2 =
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const _hoisted_5 = ["src"];
|
|
324
|
-
const _hoisted_6 = {
|
|
325
|
-
key: 2,
|
|
326
|
-
class: "tips"
|
|
340
|
+
const _hoisted_2 = {
|
|
341
|
+
key: 0,
|
|
342
|
+
class: "nut-uploader__preview-img"
|
|
327
343
|
};
|
|
328
|
-
const
|
|
344
|
+
const _hoisted_3 = {
|
|
329
345
|
key: 0,
|
|
330
|
-
class: "nut-
|
|
346
|
+
class: "nut-uploader__preview__progress"
|
|
347
|
+
};
|
|
348
|
+
const _hoisted_4 = { class: "nut-uploader__preview__progress__msg" };
|
|
349
|
+
const _hoisted_5 = {
|
|
350
|
+
key: 1,
|
|
351
|
+
class: "nut-uploader__preview__progress"
|
|
352
|
+
};
|
|
353
|
+
const _hoisted_6 = { class: "nut-uploader__preview__progress__msg" };
|
|
354
|
+
const _hoisted_7 = ["onClick", "src"];
|
|
355
|
+
const _hoisted_8 = {
|
|
356
|
+
key: 4,
|
|
357
|
+
class: "nut-uploader__preview-img__file"
|
|
358
|
+
};
|
|
359
|
+
const _hoisted_9 = ["onClick"];
|
|
360
|
+
const _hoisted_10 = { class: "tips" };
|
|
361
|
+
const _hoisted_11 = {
|
|
362
|
+
key: 1,
|
|
363
|
+
class: "nut-uploader__preview-list"
|
|
331
364
|
};
|
|
332
|
-
const
|
|
333
|
-
const _hoisted_9 = ["accept", "multiple", "name", "disabled"];
|
|
365
|
+
const _hoisted_12 = ["onClick"];
|
|
334
366
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
367
|
+
const _component_nut_button = resolveComponent("nut-button");
|
|
335
368
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
369
|
+
const _component_nut_progress = resolveComponent("nut-progress");
|
|
336
370
|
return openBlock(), createElementBlock("view", {
|
|
337
371
|
class: normalizeClass(_ctx.classes)
|
|
338
372
|
}, [
|
|
339
373
|
_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
340
374
|
renderSlot(_ctx.$slots, "default"),
|
|
341
|
-
_ctx.maximum - _ctx.fileList.length ? (openBlock(),
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
375
|
+
_ctx.maximum - _ctx.fileList.length ? (openBlock(), createBlock(_component_nut_button, {
|
|
376
|
+
key: 0,
|
|
377
|
+
class: "nut-uploader__input",
|
|
378
|
+
onClick: _ctx.chooseImage
|
|
379
|
+
}, null, 8, ["onClick"])) : createCommentVNode("", true)
|
|
380
|
+
])) : createCommentVNode("", true),
|
|
381
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fileList, (item, index) => {
|
|
382
|
+
var _a;
|
|
383
|
+
return openBlock(), createElementBlock("view", {
|
|
384
|
+
class: normalizeClass(["nut-uploader__preview", [_ctx.listType]]),
|
|
385
|
+
key: item.uid
|
|
386
|
+
}, [
|
|
387
|
+
_ctx.listType == "picture" && !_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_2, [
|
|
388
|
+
item.status == "ready" ? (openBlock(), createElementBlock("view", _hoisted_3, [
|
|
389
|
+
createElementVNode("view", _hoisted_4, toDisplayString(item.message), 1)
|
|
390
|
+
])) : item.status != "success" ? (openBlock(), createElementBlock("view", _hoisted_5, [
|
|
391
|
+
createVNode(_component_nut_icon, {
|
|
392
|
+
color: "#fff",
|
|
393
|
+
name: item.status == "error" ? "failure" : "loading"
|
|
394
|
+
}, null, 8, ["name"]),
|
|
395
|
+
createElementVNode("view", _hoisted_6, toDisplayString(item.message), 1)
|
|
396
|
+
])) : createCommentVNode("", true),
|
|
397
|
+
_ctx.isDeletable ? (openBlock(), createBlock(_component_nut_icon, {
|
|
398
|
+
key: 2,
|
|
399
|
+
color: "rgba(0,0,0,0.6)",
|
|
400
|
+
onClick: ($event) => _ctx.onDelete(item, index),
|
|
401
|
+
class: "close",
|
|
402
|
+
name: "failure"
|
|
403
|
+
}, null, 8, ["onClick"])) : createCommentVNode("", true),
|
|
404
|
+
((_a = item.type) == null ? void 0 : _a.includes("image")) && item.url ? (openBlock(), createElementBlock("img", {
|
|
405
|
+
key: 3,
|
|
406
|
+
class: "nut-uploader__preview-img__c",
|
|
407
|
+
onClick: ($event) => _ctx.fileItemClick(item),
|
|
408
|
+
src: item.url
|
|
409
|
+
}, null, 8, _hoisted_7)) : (openBlock(), createElementBlock("view", _hoisted_8, [
|
|
410
|
+
createElementVNode("view", {
|
|
411
|
+
class: "nut-uploader__preview-img__file__name",
|
|
412
|
+
onClick: ($event) => _ctx.fileItemClick(item)
|
|
413
|
+
}, [
|
|
414
|
+
createVNode(_component_nut_icon, {
|
|
415
|
+
color: "#808080",
|
|
416
|
+
name: "link"
|
|
417
|
+
}),
|
|
418
|
+
createTextVNode("\xA0" + toDisplayString(item.name), 1)
|
|
419
|
+
], 8, _hoisted_9)
|
|
420
|
+
])),
|
|
421
|
+
createElementVNode("view", _hoisted_10, toDisplayString(item.name), 1)
|
|
422
|
+
])) : _ctx.listType == "list" ? (openBlock(), createElementBlock("view", _hoisted_11, [
|
|
423
|
+
createElementVNode("view", {
|
|
424
|
+
class: normalizeClass(["nut-uploader__preview-img__file__name", [item.status]]),
|
|
425
|
+
onClick: ($event) => _ctx.fileItemClick(item)
|
|
426
|
+
}, [
|
|
427
|
+
createVNode(_component_nut_icon, { name: "link" }),
|
|
428
|
+
createTextVNode("\xA0" + toDisplayString(item.name), 1)
|
|
429
|
+
], 10, _hoisted_12),
|
|
430
|
+
createVNode(_component_nut_icon, {
|
|
431
|
+
class: "nut-uploader__preview-img__file__del",
|
|
432
|
+
onClick: ($event) => _ctx.onDelete(item, index),
|
|
433
|
+
color: "#808080",
|
|
434
|
+
name: "del"
|
|
435
|
+
}, null, 8, ["onClick"]),
|
|
436
|
+
item.status == "uploading" ? (openBlock(), createBlock(_component_nut_progress, {
|
|
437
|
+
key: 0,
|
|
438
|
+
size: "small",
|
|
439
|
+
percentage: item.percentage,
|
|
440
|
+
"stroke-color": "linear-gradient(270deg, rgba(18,126,255,1) 0%,rgba(32,147,255,1) 32.815625%,rgba(13,242,204,1) 100%)",
|
|
441
|
+
"show-text": false
|
|
442
|
+
}, null, 8, ["percentage"])) : createCommentVNode("", true)
|
|
443
|
+
])) : createCommentVNode("", true)
|
|
444
|
+
], 2);
|
|
445
|
+
}), 128)),
|
|
446
|
+
_ctx.listType == "picture" && !_ctx.$slots.default && _ctx.maximum - _ctx.fileList.length ? (openBlock(), createElementBlock("view", {
|
|
447
|
+
key: 1,
|
|
448
|
+
class: normalizeClass(["nut-uploader__upload", [_ctx.listType]])
|
|
449
|
+
}, [
|
|
450
|
+
createVNode(_component_nut_icon, {
|
|
451
|
+
size: _ctx.uploadIconSize,
|
|
452
|
+
color: "#808080",
|
|
453
|
+
name: _ctx.uploadIcon
|
|
454
|
+
}, null, 8, ["size", "name"]),
|
|
455
|
+
createVNode(_component_nut_button, {
|
|
456
|
+
class: "nut-uploader__input",
|
|
457
|
+
onClick: _ctx.chooseImage
|
|
458
|
+
}, null, 8, ["onClick"])
|
|
459
|
+
], 2)) : createCommentVNode("", true)
|
|
414
460
|
], 2);
|
|
415
461
|
}
|
|
416
|
-
|
|
417
|
-
export { FileItem,
|
|
462
|
+
_sfc_main.render = _sfc_render;
|
|
463
|
+
export { FileItem, _sfc_main as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
const commonProps = {
|
|
7
|
+
listData: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
readonly: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false
|
|
16
|
+
},
|
|
17
|
+
visibleItemCount: {
|
|
18
|
+
type: [Number, String],
|
|
19
|
+
default: 7
|
|
20
|
+
},
|
|
21
|
+
defaultIndex: {
|
|
22
|
+
type: [Number, String],
|
|
23
|
+
default: 0
|
|
24
|
+
},
|
|
25
|
+
itemHeight: {
|
|
26
|
+
type: [Number, String],
|
|
27
|
+
default: 35
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export { commonProps as c };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
3
|
+
* (c) 2021 @jdf2e.
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { h } from "vue";
|
|
7
|
+
import { c as createComponent } from "./component.js";
|
|
8
|
+
import { p as pxCheck } from "./pxCheck.js";
|
|
9
|
+
const { componentName, create } = createComponent("icon");
|
|
10
|
+
var _sfc_main = create({
|
|
11
|
+
props: {
|
|
12
|
+
name: { type: String, default: "" },
|
|
13
|
+
size: { type: [String, Number], default: "" },
|
|
14
|
+
classPrefix: { type: String, default: "nut-icon" },
|
|
15
|
+
fontClassName: { type: String, default: "nutui-iconfont" },
|
|
16
|
+
color: { type: String, default: "" },
|
|
17
|
+
tag: { type: String, default: "i" }
|
|
18
|
+
},
|
|
19
|
+
emits: ["click"],
|
|
20
|
+
setup(props, { emit, slots }) {
|
|
21
|
+
const handleClick = (event) => {
|
|
22
|
+
emit("click", event);
|
|
23
|
+
};
|
|
24
|
+
const isImage = () => {
|
|
25
|
+
return props.name ? props.name.indexOf("/") !== -1 : false;
|
|
26
|
+
};
|
|
27
|
+
return () => {
|
|
28
|
+
var _a;
|
|
29
|
+
const _isImage = isImage();
|
|
30
|
+
return h(_isImage ? "img" : props.tag, {
|
|
31
|
+
class: _isImage ? `${componentName}__img` : `${props.fontClassName} ${componentName} ${props.classPrefix}-${props.name}`,
|
|
32
|
+
style: {
|
|
33
|
+
color: props.color,
|
|
34
|
+
fontSize: pxCheck(props.size),
|
|
35
|
+
width: pxCheck(props.size),
|
|
36
|
+
height: pxCheck(props.size)
|
|
37
|
+
},
|
|
38
|
+
onClick: handleClick,
|
|
39
|
+
src: _isImage ? props.name : ""
|
|
40
|
+
}, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export { _sfc_main as _ };
|