@nutui/nutui 3.1.19-beta.0 → 3.1.19-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/dist/nutui.d.ts +38 -37
- package/dist/nutui.es.js +13439 -12616
- package/dist/nutui.umd.js +13431 -12695
- package/dist/packages/_es/ActionSheet.js +12 -18
- package/dist/packages/_es/Address.js +78 -69
- package/dist/packages/_es/Audio.js +12 -12
- package/dist/packages/_es/AudioOperate.js +1 -1
- package/dist/packages/_es/Avatar.js +3 -3
- package/dist/packages/_es/BackTop.js +68 -110
- package/dist/packages/_es/Badge.js +3 -3
- package/dist/packages/_es/Barrage.js +62 -55
- package/dist/packages/_es/Button.js +2 -2
- package/dist/packages/_es/Calendar.js +28 -23
- package/dist/packages/_es/CalendarItem.js +3 -3
- package/dist/packages/_es/Card.js +6 -5
- package/dist/packages/_es/Cascader.js +7 -7
- package/dist/packages/_es/Cell.js +4 -11
- package/dist/packages/_es/CellGroup.js +1 -1
- package/dist/packages/_es/Checkbox.js +1 -1
- package/dist/packages/_es/CheckboxGroup.js +1 -1
- package/dist/packages/_es/CircleProgress.js +149 -40
- package/dist/packages/_es/Col.js +1 -1
- package/dist/packages/_es/Collapse.js +34 -8
- package/dist/packages/_es/CollapseItem.js +90 -59
- package/dist/packages/_es/CountDown.js +5 -5
- package/dist/packages/_es/CountUp.js +43 -51
- package/dist/packages/_es/DatePicker.js +21 -20
- package/dist/packages/_es/Dialog.js +8 -86
- package/dist/packages/_es/Divider.js +4 -4
- package/dist/packages/_es/Drag.js +92 -54
- package/dist/packages/_es/Elevator.js +74 -49
- package/dist/packages/_es/Empty.js +3 -3
- package/dist/packages/_es/FixedNav.js +5 -5
- package/dist/packages/_es/Form.js +4 -4
- package/dist/packages/_es/FormItem.js +1 -1
- package/dist/packages/_es/Grid.js +1 -1
- package/dist/packages/_es/GridItem.js +8 -26
- package/dist/packages/_es/Icon.js +1 -1
- package/dist/packages/_es/ImagePreview.js +15 -84
- package/dist/packages/_es/Indicator.js +3 -3
- package/dist/packages/_es/InfiniteLoading.js +93 -107
- package/dist/packages/_es/Input.js +8 -8
- package/dist/packages/_es/InputNumber.js +23 -16
- package/dist/packages/_es/Layout.js +1 -1
- package/dist/packages/_es/List.js +41 -34
- package/dist/packages/_es/Menu.js +15 -12
- package/dist/packages/_es/MenuItem.js +9 -9
- package/dist/packages/_es/Navbar.js +3 -4
- package/dist/packages/_es/NoticeBar.js +47 -40
- package/dist/packages/_es/Notify.js +29 -168
- package/dist/packages/_es/NumberKeyboard.js +5 -10
- package/dist/packages/_es/OldPicker.js +122 -120
- package/dist/packages/_es/OverLay.js +5 -25
- package/dist/packages/_es/Pagination.js +7 -7
- package/dist/packages/_es/Picker.js +39 -16
- package/dist/packages/_es/Popover.js +155 -30
- package/dist/packages/_es/Popup.js +8 -71
- package/dist/packages/_es/Price.js +17 -5
- package/dist/packages/_es/Progress.js +18 -8
- package/dist/packages/_es/PullRefresh.js +1 -1
- package/dist/packages/_es/Radio.js +2 -2
- package/dist/packages/_es/RadioGroup.js +1 -1
- package/dist/packages/_es/Range.js +46 -33
- package/dist/packages/_es/Rate.js +16 -19
- package/dist/packages/_es/Row.js +1 -1
- package/dist/packages/_es/SearchBar.js +8 -6
- package/dist/packages/_es/ShortPassword.js +89 -67
- package/dist/packages/_es/SideNavBar.js +5 -16
- package/dist/packages/_es/SideNavBarItem.js +1 -1
- package/dist/packages/_es/Signature.js +69 -88
- package/dist/packages/_es/Skeleton.js +8 -11
- package/dist/packages/_es/Sku.js +47 -56
- package/dist/packages/_es/Step.js +1 -1
- package/dist/packages/_es/Steps.js +1 -1
- package/dist/packages/_es/Sticky.js +28 -23
- package/dist/packages/_es/SubSideNavBar.js +1 -1
- package/dist/packages/_es/Swipe.js +39 -26
- package/dist/packages/_es/Swiper.js +31 -13
- package/dist/packages/_es/SwiperItem.js +1 -1
- package/dist/packages/_es/Switch.js +3 -3
- package/dist/packages/_es/TabPane.js +1 -1
- package/dist/packages/_es/Tabbar.js +3 -3
- package/dist/packages/_es/TabbarItem.js +17 -23
- package/dist/packages/_es/Table.js +13 -13
- package/dist/packages/_es/Tabs.js +21 -20
- package/dist/packages/_es/Tag.js +4 -4
- package/dist/packages/_es/TextArea.js +44 -42
- package/dist/packages/_es/TimeDetail.js +4 -3
- package/dist/packages/_es/TimePannel.js +3 -3
- package/dist/packages/_es/TimeSelect.js +8 -7
- package/dist/packages/_es/Toast.js +41 -170
- package/dist/packages/_es/Uploader.js +109 -138
- package/dist/packages/_es/Video.js +3 -3
- package/dist/packages/_es/common.js +1 -1
- package/dist/packages/_es/component.js +1 -1
- package/dist/packages/_es/index.js +44 -6
- package/dist/packages/_es/{index5.js → index.taro.js} +127 -95
- package/dist/packages/_es/index2.js +1 -1
- package/dist/packages/_es/index3.js +56 -28
- package/dist/packages/_es/index4.js +413 -56
- package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
- package/dist/packages/_es/pxCheck.js +1 -1
- package/dist/packages/_es/use-lock-scroll.js +23 -0
- package/dist/packages/_es/util.js +1 -1
- package/dist/packages/uploader/index.scss +2 -2
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +61 -61
- package/dist/styles/themes/jdt.scss +61 -61
- package/package.json +1 -1
- package/dist/packages/_es/raf.js +0 -19
|
@@ -19,12 +19,13 @@ var __publicField = (obj, key, value) => {
|
|
|
19
19
|
return value;
|
|
20
20
|
};
|
|
21
21
|
/*!
|
|
22
|
-
* @nutui/nutui v3.1.19-beta.
|
|
22
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
23
23
|
* (c) 2022 @jdf2e.
|
|
24
24
|
* Released under the MIT License.
|
|
25
25
|
*/
|
|
26
|
-
import { reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot,
|
|
26
|
+
import { reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock, createCommentVNode, Fragment, renderList, createElementVNode, toDisplayString, createVNode, createTextVNode } from "vue";
|
|
27
27
|
import { c as createComponent } from "./component.js";
|
|
28
|
+
import Taro from "@tarojs/taro";
|
|
28
29
|
import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
|
|
29
30
|
class UploadOptions {
|
|
30
31
|
constructor() {
|
|
@@ -116,17 +117,26 @@ class FileItem {
|
|
|
116
117
|
__publicField(this, "status", "ready");
|
|
117
118
|
__publicField(this, "message", "\u51C6\u5907\u5B8C\u6210");
|
|
118
119
|
__publicField(this, "uid", new Date().getTime().toString());
|
|
119
|
-
__publicField(this, "name");
|
|
120
120
|
__publicField(this, "url");
|
|
121
|
+
__publicField(this, "path");
|
|
122
|
+
__publicField(this, "name");
|
|
121
123
|
__publicField(this, "type");
|
|
122
124
|
__publicField(this, "percentage", 0);
|
|
123
|
-
__publicField(this, "formData",
|
|
125
|
+
__publicField(this, "formData", {});
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
const _sfc_main = create({
|
|
127
129
|
props: {
|
|
128
130
|
name: { type: String, default: "file" },
|
|
129
131
|
url: { type: String, default: "" },
|
|
132
|
+
sizeType: {
|
|
133
|
+
type: Array,
|
|
134
|
+
default: () => ["original", "compressed"]
|
|
135
|
+
},
|
|
136
|
+
sourceType: {
|
|
137
|
+
type: Array,
|
|
138
|
+
default: () => ["album", "camera"]
|
|
139
|
+
},
|
|
130
140
|
timeout: { type: [Number, String], default: 1e3 * 30 },
|
|
131
141
|
fileList: { type: Array, default: () => [] },
|
|
132
142
|
isPreview: { type: Boolean, default: true },
|
|
@@ -135,7 +145,7 @@ const _sfc_main = create({
|
|
|
135
145
|
method: { type: String, default: "post" },
|
|
136
146
|
capture: { type: Boolean, default: false },
|
|
137
147
|
maximize: { type: [Number, String], default: Number.MAX_VALUE },
|
|
138
|
-
maximum: { type: [Number, String], default:
|
|
148
|
+
maximum: { type: [Number, String], default: 9 },
|
|
139
149
|
clearInput: { type: Boolean, default: true },
|
|
140
150
|
accept: { type: String, default: "*" },
|
|
141
151
|
headers: { type: Object, default: {} },
|
|
@@ -143,8 +153,6 @@ const _sfc_main = create({
|
|
|
143
153
|
uploadIcon: { type: String, default: "photograph" },
|
|
144
154
|
uploadIconSize: { type: [String, Number], default: "" },
|
|
145
155
|
xhrState: { type: [Number, String], default: 200 },
|
|
146
|
-
withCredentials: { type: Boolean, default: false },
|
|
147
|
-
multiple: { type: Boolean, default: false },
|
|
148
156
|
disabled: { type: Boolean, default: false },
|
|
149
157
|
autoUpload: { type: Boolean, default: true },
|
|
150
158
|
beforeUpload: {
|
|
@@ -179,97 +187,101 @@ const _sfc_main = create({
|
|
|
179
187
|
[prefixCls]: true
|
|
180
188
|
};
|
|
181
189
|
});
|
|
182
|
-
const
|
|
183
|
-
|
|
190
|
+
const chooseImage = () => {
|
|
191
|
+
if (props.disabled) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
Taro.chooseImage({
|
|
195
|
+
count: props.maximum * 1 - props.fileList.length,
|
|
196
|
+
sizeType: props.sizeType,
|
|
197
|
+
sourceType: props.sourceType,
|
|
198
|
+
success: onChange
|
|
199
|
+
});
|
|
184
200
|
};
|
|
185
201
|
const fileItemClick = (fileItem) => {
|
|
186
202
|
emit("file-item-click", { fileItem });
|
|
187
203
|
};
|
|
188
|
-
const executeUpload = (fileItem,
|
|
204
|
+
const executeUpload = (fileItem, index) => {
|
|
189
205
|
const uploadOption = new UploadOptions();
|
|
206
|
+
uploadOption.name = props.name;
|
|
190
207
|
uploadOption.url = props.url;
|
|
208
|
+
for (const [key, value] of Object.entries(props.data)) {
|
|
209
|
+
fileItem.formData[key] = value;
|
|
210
|
+
}
|
|
191
211
|
uploadOption.formData = fileItem.formData;
|
|
192
|
-
uploadOption.timeout = props.timeout * 1;
|
|
193
212
|
uploadOption.method = props.method;
|
|
194
|
-
uploadOption.xhrState = props.xhrState;
|
|
195
213
|
uploadOption.headers = props.headers;
|
|
196
|
-
uploadOption.
|
|
214
|
+
uploadOption.taroFilePath = fileItem.path;
|
|
197
215
|
uploadOption.onStart = (option) => {
|
|
198
216
|
fileItem.status = "ready";
|
|
199
217
|
fileItem.message = "\u51C6\u5907\u4E0A\u4F20";
|
|
200
|
-
clearUploadQueue(
|
|
218
|
+
clearUploadQueue(index);
|
|
201
219
|
emit("start", option);
|
|
202
220
|
};
|
|
203
221
|
uploadOption.onProgress = (event, option) => {
|
|
204
222
|
fileItem.status = "uploading";
|
|
205
223
|
fileItem.message = "\u4E0A\u4F20\u4E2D";
|
|
206
|
-
fileItem.percentage =
|
|
224
|
+
fileItem.percentage = event.progress;
|
|
207
225
|
emit("progress", { event, option, percentage: fileItem.percentage });
|
|
208
226
|
};
|
|
209
|
-
uploadOption.onSuccess = (
|
|
227
|
+
uploadOption.onSuccess = (data, option) => {
|
|
210
228
|
fileItem.status = "success";
|
|
211
229
|
fileItem.message = "\u4E0A\u4F20\u6210\u529F";
|
|
212
230
|
emit("success", {
|
|
213
|
-
|
|
231
|
+
data,
|
|
214
232
|
option,
|
|
215
233
|
fileItem
|
|
216
234
|
});
|
|
217
235
|
emit("update:fileList", fileList);
|
|
218
236
|
};
|
|
219
|
-
uploadOption.onFailure = (
|
|
237
|
+
uploadOption.onFailure = (data, option) => {
|
|
220
238
|
fileItem.status = "error";
|
|
221
239
|
fileItem.message = "\u4E0A\u4F20\u5931\u8D25";
|
|
222
240
|
emit("failure", {
|
|
223
|
-
|
|
241
|
+
data,
|
|
224
242
|
option,
|
|
225
243
|
fileItem
|
|
226
244
|
});
|
|
227
245
|
};
|
|
228
246
|
let task = new Uploader(uploadOption);
|
|
229
247
|
if (props.autoUpload) {
|
|
230
|
-
task.
|
|
248
|
+
task.uploadTaro(Taro.uploadFile);
|
|
231
249
|
} else {
|
|
232
250
|
uploadQueue.push(new Promise((resolve, reject) => {
|
|
233
251
|
resolve(task);
|
|
234
252
|
}));
|
|
235
253
|
}
|
|
236
254
|
};
|
|
237
|
-
const clearUploadQueue = (
|
|
238
|
-
if (
|
|
239
|
-
uploadQueue.splice(
|
|
255
|
+
const clearUploadQueue = (index = -1) => {
|
|
256
|
+
if (index > -1) {
|
|
257
|
+
uploadQueue.splice(index, 1);
|
|
240
258
|
} else {
|
|
241
259
|
uploadQueue = [];
|
|
242
260
|
}
|
|
243
261
|
};
|
|
244
262
|
const submit = () => {
|
|
245
263
|
Promise.all(uploadQueue).then((res) => {
|
|
246
|
-
res.forEach((i) => i.
|
|
264
|
+
res.forEach((i) => i.uploadTaro(Taro.uploadFile));
|
|
247
265
|
});
|
|
248
266
|
};
|
|
249
267
|
const readFile = (files) => {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
formData.append(key, value);
|
|
254
|
-
}
|
|
255
|
-
formData.append(props.name, file);
|
|
268
|
+
const imgReg = /\.(png|jpeg|jpg|webp|gif)$/i;
|
|
269
|
+
files.forEach((file, index) => {
|
|
270
|
+
let fileType = file.type;
|
|
256
271
|
const fileItem = reactive(new FileItem());
|
|
257
|
-
|
|
272
|
+
if (!fileType && imgReg.test(file.path)) {
|
|
273
|
+
fileType = "image";
|
|
274
|
+
}
|
|
275
|
+
fileItem.path = file.path;
|
|
276
|
+
fileItem.name = file.path;
|
|
258
277
|
fileItem.status = "ready";
|
|
259
|
-
fileItem.type = file.type;
|
|
260
|
-
fileItem.formData = formData;
|
|
261
278
|
fileItem.message = "\u7B49\u5F85\u4E0A\u4F20";
|
|
262
|
-
|
|
263
|
-
if (props.isPreview
|
|
264
|
-
|
|
265
|
-
reader.onload = (event) => {
|
|
266
|
-
fileItem.url = event.target.result;
|
|
267
|
-
fileList.push(fileItem);
|
|
268
|
-
};
|
|
269
|
-
reader.readAsDataURL(file);
|
|
270
|
-
} else {
|
|
271
|
-
fileList.push(fileItem);
|
|
279
|
+
fileItem.type = fileType;
|
|
280
|
+
if (props.isPreview) {
|
|
281
|
+
fileItem.url = file.path;
|
|
272
282
|
}
|
|
283
|
+
fileList.push(fileItem);
|
|
284
|
+
executeUpload(fileItem, index);
|
|
273
285
|
});
|
|
274
286
|
};
|
|
275
287
|
const filterFiles = (files) => {
|
|
@@ -293,45 +305,39 @@ const _sfc_main = create({
|
|
|
293
305
|
}
|
|
294
306
|
return files;
|
|
295
307
|
};
|
|
296
|
-
const onDelete = (file,
|
|
297
|
-
clearUploadQueue(
|
|
308
|
+
const onDelete = (file, index) => {
|
|
309
|
+
clearUploadQueue(index);
|
|
298
310
|
if (props.beforeDelete(file, fileList)) {
|
|
299
|
-
fileList.splice(
|
|
311
|
+
fileList.splice(index, 1);
|
|
300
312
|
emit("delete", {
|
|
301
313
|
file,
|
|
302
314
|
fileList,
|
|
303
|
-
index
|
|
315
|
+
index
|
|
304
316
|
});
|
|
317
|
+
} else {
|
|
318
|
+
console.log("\u7528\u6237\u963B\u6B62\u4E86\u5220\u9664\uFF01");
|
|
305
319
|
}
|
|
306
320
|
};
|
|
307
|
-
const onChange = (
|
|
308
|
-
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
const $el = event.target;
|
|
312
|
-
let { files } = $el;
|
|
321
|
+
const onChange = (res) => {
|
|
322
|
+
const { tempFilePaths, tempFiles } = res;
|
|
313
323
|
if (props.beforeUpload) {
|
|
314
|
-
props.beforeUpload(
|
|
315
|
-
const _files = filterFiles(
|
|
324
|
+
props.beforeUpload(tempFiles).then((f) => {
|
|
325
|
+
const _files = filterFiles(f);
|
|
316
326
|
readFile(_files);
|
|
317
327
|
});
|
|
318
328
|
} else {
|
|
319
|
-
const _files = filterFiles(
|
|
329
|
+
const _files = filterFiles(tempFiles);
|
|
320
330
|
readFile(_files);
|
|
321
331
|
}
|
|
322
332
|
emit("change", {
|
|
323
|
-
fileList
|
|
324
|
-
event
|
|
333
|
+
fileList
|
|
325
334
|
});
|
|
326
|
-
if (props.clearInput) {
|
|
327
|
-
clearInput($el);
|
|
328
|
-
}
|
|
329
335
|
};
|
|
330
336
|
return {
|
|
331
|
-
onChange,
|
|
332
337
|
onDelete,
|
|
333
338
|
fileList,
|
|
334
339
|
classes,
|
|
340
|
+
chooseImage,
|
|
335
341
|
fileItemClick,
|
|
336
342
|
clearUploadQueue,
|
|
337
343
|
submit
|
|
@@ -342,37 +348,34 @@ const _hoisted_1 = {
|
|
|
342
348
|
key: 0,
|
|
343
349
|
class: "nut-uploader__slot"
|
|
344
350
|
};
|
|
345
|
-
const _hoisted_2 =
|
|
346
|
-
const _hoisted_3 = ["accept", "multiple", "name", "disabled"];
|
|
347
|
-
const _hoisted_4 = {
|
|
351
|
+
const _hoisted_2 = {
|
|
348
352
|
key: 0,
|
|
349
353
|
class: "nut-uploader__preview-img"
|
|
350
354
|
};
|
|
351
|
-
const
|
|
355
|
+
const _hoisted_3 = {
|
|
352
356
|
key: 0,
|
|
353
357
|
class: "nut-uploader__preview__progress"
|
|
354
358
|
};
|
|
355
|
-
const
|
|
356
|
-
const
|
|
359
|
+
const _hoisted_4 = { class: "nut-uploader__preview__progress__msg" };
|
|
360
|
+
const _hoisted_5 = {
|
|
357
361
|
key: 1,
|
|
358
362
|
class: "nut-uploader__preview__progress"
|
|
359
363
|
};
|
|
360
|
-
const
|
|
361
|
-
const
|
|
362
|
-
const
|
|
364
|
+
const _hoisted_6 = { class: "nut-uploader__preview__progress__msg" };
|
|
365
|
+
const _hoisted_7 = ["onClick", "src"];
|
|
366
|
+
const _hoisted_8 = {
|
|
363
367
|
key: 4,
|
|
364
368
|
class: "nut-uploader__preview-img__file"
|
|
365
369
|
};
|
|
366
|
-
const
|
|
367
|
-
const
|
|
368
|
-
const
|
|
370
|
+
const _hoisted_9 = ["onClick"];
|
|
371
|
+
const _hoisted_10 = { class: "tips" };
|
|
372
|
+
const _hoisted_11 = {
|
|
369
373
|
key: 1,
|
|
370
374
|
class: "nut-uploader__preview-list"
|
|
371
375
|
};
|
|
372
|
-
const
|
|
373
|
-
const _hoisted_15 = ["accept", "multiple", "name", "disabled"];
|
|
374
|
-
const _hoisted_16 = ["accept", "multiple", "name", "disabled"];
|
|
376
|
+
const _hoisted_12 = ["onClick"];
|
|
375
377
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
378
|
+
const _component_nut_button = resolveComponent("nut-button");
|
|
376
379
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
377
380
|
const _component_nut_progress = resolveComponent("nut-progress");
|
|
378
381
|
return openBlock(), createElementBlock("view", {
|
|
@@ -380,80 +383,64 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
380
383
|
}, [
|
|
381
384
|
_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
382
385
|
renderSlot(_ctx.$slots, "default"),
|
|
383
|
-
_ctx.maximum - _ctx.fileList.length ? (openBlock(),
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
capture: "camera",
|
|
389
|
-
accept: _ctx.accept,
|
|
390
|
-
multiple: _ctx.multiple,
|
|
391
|
-
name: _ctx.name,
|
|
392
|
-
disabled: _ctx.disabled,
|
|
393
|
-
onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args))
|
|
394
|
-
}, null, 40, _hoisted_2)) : (openBlock(), createElementBlock("input", {
|
|
395
|
-
key: 1,
|
|
396
|
-
class: "nut-uploader__input",
|
|
397
|
-
type: "file",
|
|
398
|
-
accept: _ctx.accept,
|
|
399
|
-
multiple: _ctx.multiple,
|
|
400
|
-
name: _ctx.name,
|
|
401
|
-
disabled: _ctx.disabled,
|
|
402
|
-
onChange: _cache[1] || (_cache[1] = (...args) => _ctx.onChange && _ctx.onChange(...args))
|
|
403
|
-
}, null, 40, _hoisted_3))
|
|
404
|
-
], 64)) : createCommentVNode("", true)
|
|
386
|
+
_ctx.maximum - _ctx.fileList.length ? (openBlock(), createBlock(_component_nut_button, {
|
|
387
|
+
key: 0,
|
|
388
|
+
class: "nut-uploader__input",
|
|
389
|
+
onClick: _ctx.chooseImage
|
|
390
|
+
}, null, 8, ["onClick"])) : createCommentVNode("", true)
|
|
405
391
|
])) : createCommentVNode("", true),
|
|
406
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fileList, (item,
|
|
392
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fileList, (item, index) => {
|
|
393
|
+
var _a;
|
|
407
394
|
return openBlock(), createElementBlock("view", {
|
|
408
395
|
class: normalizeClass(["nut-uploader__preview", [_ctx.listType]]),
|
|
409
396
|
key: item.uid
|
|
410
397
|
}, [
|
|
411
|
-
_ctx.listType == "picture" && !_ctx.$slots.default ? (openBlock(), createElementBlock("view",
|
|
412
|
-
item.status == "ready" ? (openBlock(), createElementBlock("view",
|
|
413
|
-
createElementVNode("view",
|
|
414
|
-
])) : item.status != "success" ? (openBlock(), createElementBlock("view",
|
|
398
|
+
_ctx.listType == "picture" && !_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_2, [
|
|
399
|
+
item.status == "ready" ? (openBlock(), createElementBlock("view", _hoisted_3, [
|
|
400
|
+
createElementVNode("view", _hoisted_4, toDisplayString(item.message), 1)
|
|
401
|
+
])) : item.status != "success" ? (openBlock(), createElementBlock("view", _hoisted_5, [
|
|
415
402
|
createVNode(_component_nut_icon, {
|
|
416
403
|
color: "#fff",
|
|
417
404
|
name: item.status == "error" ? "failure" : "loading"
|
|
418
405
|
}, null, 8, ["name"]),
|
|
419
|
-
createElementVNode("view",
|
|
406
|
+
createElementVNode("view", _hoisted_6, toDisplayString(item.message), 1)
|
|
420
407
|
])) : createCommentVNode("", true),
|
|
421
408
|
_ctx.isDeletable ? (openBlock(), createBlock(_component_nut_icon, {
|
|
422
409
|
key: 2,
|
|
423
410
|
color: "rgba(0,0,0,0.6)",
|
|
424
|
-
onClick: ($event) => _ctx.onDelete(item,
|
|
411
|
+
onClick: ($event) => _ctx.onDelete(item, index),
|
|
425
412
|
class: "close",
|
|
426
413
|
name: "failure"
|
|
427
414
|
}, null, 8, ["onClick"])) : createCommentVNode("", true),
|
|
428
|
-
item.type.includes("image") && item.url ? (openBlock(), createElementBlock("img", {
|
|
415
|
+
((_a = item.type) == null ? void 0 : _a.includes("image")) && item.url ? (openBlock(), createElementBlock("img", {
|
|
429
416
|
key: 3,
|
|
430
417
|
class: "nut-uploader__preview-img__c",
|
|
431
418
|
onClick: ($event) => _ctx.fileItemClick(item),
|
|
432
419
|
src: item.url
|
|
433
|
-
}, null, 8,
|
|
420
|
+
}, null, 8, _hoisted_7)) : (openBlock(), createElementBlock("view", _hoisted_8, [
|
|
434
421
|
createElementVNode("view", {
|
|
435
|
-
|
|
436
|
-
|
|
422
|
+
class: "nut-uploader__preview-img__file__name",
|
|
423
|
+
onClick: ($event) => _ctx.fileItemClick(item)
|
|
437
424
|
}, [
|
|
438
425
|
createVNode(_component_nut_icon, {
|
|
439
426
|
color: "#808080",
|
|
440
427
|
name: "link"
|
|
441
428
|
}),
|
|
442
429
|
createTextVNode("\xA0" + toDisplayString(item.name), 1)
|
|
443
|
-
], 8,
|
|
430
|
+
], 8, _hoisted_9)
|
|
444
431
|
])),
|
|
445
|
-
createElementVNode("view",
|
|
446
|
-
])) : _ctx.listType == "list" ? (openBlock(), createElementBlock("view",
|
|
432
|
+
createElementVNode("view", _hoisted_10, toDisplayString(item.name), 1)
|
|
433
|
+
])) : _ctx.listType == "list" ? (openBlock(), createElementBlock("view", _hoisted_11, [
|
|
447
434
|
createElementVNode("view", {
|
|
448
|
-
|
|
449
|
-
|
|
435
|
+
class: normalizeClass(["nut-uploader__preview-img__file__name", [item.status]]),
|
|
436
|
+
onClick: ($event) => _ctx.fileItemClick(item)
|
|
450
437
|
}, [
|
|
451
438
|
createVNode(_component_nut_icon, { name: "link" }),
|
|
452
439
|
createTextVNode("\xA0" + toDisplayString(item.name), 1)
|
|
453
|
-
], 10,
|
|
440
|
+
], 10, _hoisted_12),
|
|
454
441
|
createVNode(_component_nut_icon, {
|
|
455
442
|
class: "nut-uploader__preview-img__file__del",
|
|
456
|
-
onClick: ($event) => _ctx.onDelete(item,
|
|
443
|
+
onClick: ($event) => _ctx.onDelete(item, index),
|
|
457
444
|
color: "#808080",
|
|
458
445
|
name: "del"
|
|
459
446
|
}, null, 8, ["onClick"]),
|
|
@@ -476,28 +463,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
476
463
|
color: "#808080",
|
|
477
464
|
name: _ctx.uploadIcon
|
|
478
465
|
}, null, 8, ["size", "name"]),
|
|
479
|
-
|
|
480
|
-
key: 0,
|
|
481
|
-
class: "nut-uploader__input",
|
|
482
|
-
type: "file",
|
|
483
|
-
capture: "camera",
|
|
484
|
-
accept: _ctx.accept,
|
|
485
|
-
multiple: _ctx.multiple,
|
|
486
|
-
name: _ctx.name,
|
|
487
|
-
disabled: _ctx.disabled,
|
|
488
|
-
onChange: _cache[2] || (_cache[2] = (...args) => _ctx.onChange && _ctx.onChange(...args))
|
|
489
|
-
}, null, 40, _hoisted_15)) : (openBlock(), createElementBlock("input", {
|
|
490
|
-
key: 1,
|
|
466
|
+
createVNode(_component_nut_button, {
|
|
491
467
|
class: "nut-uploader__input",
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
multiple: _ctx.multiple,
|
|
495
|
-
name: _ctx.name,
|
|
496
|
-
disabled: _ctx.disabled,
|
|
497
|
-
onChange: _cache[3] || (_cache[3] = (...args) => _ctx.onChange && _ctx.onChange(...args))
|
|
498
|
-
}, null, 40, _hoisted_16))
|
|
468
|
+
onClick: _ctx.chooseImage
|
|
469
|
+
}, null, 8, ["onClick"])
|
|
499
470
|
], 2)) : createCommentVNode("", true)
|
|
500
471
|
], 2);
|
|
501
472
|
}
|
|
502
|
-
var
|
|
503
|
-
export { FileItem,
|
|
473
|
+
var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
474
|
+
export { FileItem, index_taro as default };
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* @nutui/nutui v3.1.19-beta.
|
|
21
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
22
22
|
* (c) 2022 @jdf2e.
|
|
23
23
|
* Released under the MIT License.
|
|
24
24
|
*/
|
|
@@ -351,5 +351,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
351
351
|
])
|
|
352
352
|
], 512);
|
|
353
353
|
}
|
|
354
|
-
var
|
|
355
|
-
export {
|
|
354
|
+
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
355
|
+
export { index as default };
|
|
@@ -1,11 +1,49 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.19-beta.
|
|
2
|
+
* @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
return proxy.$router || null;
|
|
6
|
+
import { unref } from "vue";
|
|
7
|
+
function isWindow(val) {
|
|
8
|
+
return val === window;
|
|
10
9
|
}
|
|
11
|
-
|
|
10
|
+
const useTaroRect = (elementRef, Taro) => {
|
|
11
|
+
let element = unref(elementRef);
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
if (Taro.getEnv() === "WEB") {
|
|
14
|
+
if (element && element.$el) {
|
|
15
|
+
element = element.$el;
|
|
16
|
+
}
|
|
17
|
+
if (isWindow(element)) {
|
|
18
|
+
const width = element.innerWidth;
|
|
19
|
+
const height = element.innerHeight;
|
|
20
|
+
resolve({
|
|
21
|
+
top: 0,
|
|
22
|
+
left: 0,
|
|
23
|
+
right: width,
|
|
24
|
+
bottom: height,
|
|
25
|
+
width,
|
|
26
|
+
height
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (element && element.getBoundingClientRect) {
|
|
30
|
+
resolve(element.getBoundingClientRect());
|
|
31
|
+
}
|
|
32
|
+
resolve({
|
|
33
|
+
top: 0,
|
|
34
|
+
left: 0,
|
|
35
|
+
right: 0,
|
|
36
|
+
bottom: 0,
|
|
37
|
+
width: 0,
|
|
38
|
+
height: 0
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
const query = Taro.createSelectorQuery();
|
|
42
|
+
query.select(`#${element.id}`) && query.select(`#${element.id}`).boundingClientRect();
|
|
43
|
+
query.exec(function(res) {
|
|
44
|
+
resolve(res[0]);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export { useTaroRect as u };
|