@nutui/nutui 3.1.12-beta.0 → 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/dist/nutui.d.ts +4 -1
- package/dist/nutui.es.js +3943 -4130
- package/dist/nutui.umd.js +3947 -4201
- 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 +24 -89
- 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 +16 -14
- package/dist/packages/_es/MenuItem.js +9 -11
- 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 +17 -77
- package/dist/packages/_es/Price.js +18 -7
- package/dist/packages/_es/Progress.js +23 -12
- package/dist/packages/_es/Radio.js +3 -3
- package/dist/packages/_es/RadioGroup.js +2 -2
- package/dist/packages/_es/Range.js +37 -30
- 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 +54 -79
- 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 +22 -16
- 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 +109 -149
- 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 +40 -27
- package/dist/packages/_es/index3.js +413 -7
- 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 +6 -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/numberkeyboard/index.scss +1 -1
- package/dist/packages/switch/index.scss +1 -1
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -2
- package/dist/styles/themes/default.scss +35 -32
- package/dist/styles/variables.scss +11 -1
- package/package.json +2 -2
- package/dist/packages/_es/Video.js +0 -405
- package/dist/packages/_es/plugin-vue_export-helper.js +0 -13
|
@@ -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", "");
|
|
@@ -116,17 +119,26 @@ class FileItem {
|
|
|
116
119
|
__publicField(this, "status", "ready");
|
|
117
120
|
__publicField(this, "message", "\u51C6\u5907\u5B8C\u6210");
|
|
118
121
|
__publicField(this, "uid", new Date().getTime().toString());
|
|
119
|
-
__publicField(this, "name");
|
|
120
122
|
__publicField(this, "url");
|
|
123
|
+
__publicField(this, "path");
|
|
124
|
+
__publicField(this, "name");
|
|
121
125
|
__publicField(this, "type");
|
|
122
126
|
__publicField(this, "percentage", 0);
|
|
123
|
-
__publicField(this, "formData",
|
|
127
|
+
__publicField(this, "formData", {});
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
|
-
|
|
130
|
+
var _sfc_main = create({
|
|
127
131
|
props: {
|
|
128
132
|
name: { type: String, default: "file" },
|
|
129
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
|
+
},
|
|
130
142
|
timeout: { type: [Number, String], default: 1e3 * 30 },
|
|
131
143
|
fileList: { type: Array, default: () => [] },
|
|
132
144
|
isPreview: { type: Boolean, default: true },
|
|
@@ -135,7 +147,7 @@ const _sfc_main = create({
|
|
|
135
147
|
method: { type: String, default: "post" },
|
|
136
148
|
capture: { type: Boolean, default: false },
|
|
137
149
|
maximize: { type: [Number, String], default: Number.MAX_VALUE },
|
|
138
|
-
maximum: { type: [Number, String], default:
|
|
150
|
+
maximum: { type: [Number, String], default: 9 },
|
|
139
151
|
clearInput: { type: Boolean, default: true },
|
|
140
152
|
accept: { type: String, default: "*" },
|
|
141
153
|
headers: { type: Object, default: {} },
|
|
@@ -143,14 +155,8 @@ const _sfc_main = create({
|
|
|
143
155
|
uploadIcon: { type: String, default: "photograph" },
|
|
144
156
|
uploadIconSize: { type: [String, Number], default: "" },
|
|
145
157
|
xhrState: { type: [Number, String], default: 200 },
|
|
146
|
-
withCredentials: { type: Boolean, default: false },
|
|
147
|
-
multiple: { type: Boolean, default: false },
|
|
148
158
|
disabled: { type: Boolean, default: false },
|
|
149
159
|
autoUpload: { type: Boolean, default: true },
|
|
150
|
-
beforeUpload: {
|
|
151
|
-
type: Function,
|
|
152
|
-
default: null
|
|
153
|
-
},
|
|
154
160
|
beforeDelete: {
|
|
155
161
|
type: Function,
|
|
156
162
|
default: (file, files) => {
|
|
@@ -179,97 +185,101 @@ const _sfc_main = create({
|
|
|
179
185
|
[prefixCls]: true
|
|
180
186
|
};
|
|
181
187
|
});
|
|
182
|
-
const
|
|
183
|
-
|
|
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
|
+
});
|
|
184
198
|
};
|
|
185
199
|
const fileItemClick = (fileItem) => {
|
|
186
200
|
emit("file-item-click", { fileItem });
|
|
187
201
|
};
|
|
188
|
-
const executeUpload = (fileItem,
|
|
202
|
+
const executeUpload = (fileItem, index) => {
|
|
189
203
|
const uploadOption = new UploadOptions();
|
|
204
|
+
uploadOption.name = props.name;
|
|
190
205
|
uploadOption.url = props.url;
|
|
206
|
+
for (const [key, value] of Object.entries(props.data)) {
|
|
207
|
+
fileItem.formData[key] = value;
|
|
208
|
+
}
|
|
191
209
|
uploadOption.formData = fileItem.formData;
|
|
192
|
-
uploadOption.timeout = props.timeout * 1;
|
|
193
210
|
uploadOption.method = props.method;
|
|
194
|
-
uploadOption.xhrState = props.xhrState;
|
|
195
211
|
uploadOption.headers = props.headers;
|
|
196
|
-
uploadOption.
|
|
212
|
+
uploadOption.taroFilePath = fileItem.path;
|
|
197
213
|
uploadOption.onStart = (option) => {
|
|
198
214
|
fileItem.status = "ready";
|
|
199
215
|
fileItem.message = "\u51C6\u5907\u4E0A\u4F20";
|
|
200
|
-
clearUploadQueue(
|
|
216
|
+
clearUploadQueue(index);
|
|
201
217
|
emit("start", option);
|
|
202
218
|
};
|
|
203
219
|
uploadOption.onProgress = (event, option) => {
|
|
204
220
|
fileItem.status = "uploading";
|
|
205
221
|
fileItem.message = "\u4E0A\u4F20\u4E2D";
|
|
206
|
-
fileItem.percentage =
|
|
222
|
+
fileItem.percentage = event.progress;
|
|
207
223
|
emit("progress", { event, option, percentage: fileItem.percentage });
|
|
208
224
|
};
|
|
209
|
-
uploadOption.onSuccess = (
|
|
225
|
+
uploadOption.onSuccess = (data, option) => {
|
|
210
226
|
fileItem.status = "success";
|
|
211
227
|
fileItem.message = "\u4E0A\u4F20\u6210\u529F";
|
|
212
228
|
emit("success", {
|
|
213
|
-
|
|
229
|
+
data,
|
|
214
230
|
option,
|
|
215
231
|
fileItem
|
|
216
232
|
});
|
|
217
233
|
emit("update:fileList", fileList);
|
|
218
234
|
};
|
|
219
|
-
uploadOption.onFailure = (
|
|
235
|
+
uploadOption.onFailure = (data, option) => {
|
|
220
236
|
fileItem.status = "error";
|
|
221
237
|
fileItem.message = "\u4E0A\u4F20\u5931\u8D25";
|
|
222
238
|
emit("failure", {
|
|
223
|
-
|
|
239
|
+
data,
|
|
224
240
|
option,
|
|
225
241
|
fileItem
|
|
226
242
|
});
|
|
227
243
|
};
|
|
228
244
|
let task = new Uploader(uploadOption);
|
|
229
245
|
if (props.autoUpload) {
|
|
230
|
-
task.
|
|
246
|
+
task.uploadTaro(Taro.uploadFile);
|
|
231
247
|
} else {
|
|
232
248
|
uploadQueue.push(new Promise((resolve, reject) => {
|
|
233
249
|
resolve(task);
|
|
234
250
|
}));
|
|
235
251
|
}
|
|
236
252
|
};
|
|
237
|
-
const clearUploadQueue = (
|
|
238
|
-
if (
|
|
239
|
-
uploadQueue.splice(
|
|
253
|
+
const clearUploadQueue = (index = -1) => {
|
|
254
|
+
if (index > -1) {
|
|
255
|
+
uploadQueue.splice(index, 1);
|
|
240
256
|
} else {
|
|
241
257
|
uploadQueue = [];
|
|
242
258
|
}
|
|
243
259
|
};
|
|
244
260
|
const submit = () => {
|
|
245
261
|
Promise.all(uploadQueue).then((res) => {
|
|
246
|
-
res.forEach((i) => i.
|
|
262
|
+
res.forEach((i) => i.uploadTaro(Taro.uploadFile));
|
|
247
263
|
});
|
|
248
264
|
};
|
|
249
265
|
const readFile = (files) => {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
formData.append(key, value);
|
|
254
|
-
}
|
|
255
|
-
formData.append(props.name, file);
|
|
266
|
+
const imgReg = /\.(png|jpeg|jpg|webp|gif)$/gi;
|
|
267
|
+
files.forEach((file, index) => {
|
|
268
|
+
let fileType = file.type;
|
|
256
269
|
const fileItem = reactive(new FileItem());
|
|
257
|
-
|
|
270
|
+
if (!fileType && imgReg.test(file.path)) {
|
|
271
|
+
fileType = "image";
|
|
272
|
+
}
|
|
273
|
+
fileItem.path = file.path;
|
|
274
|
+
fileItem.name = file.path;
|
|
258
275
|
fileItem.status = "ready";
|
|
259
|
-
fileItem.type = file.type;
|
|
260
|
-
fileItem.formData = formData;
|
|
261
276
|
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);
|
|
277
|
+
fileItem.type = fileType;
|
|
278
|
+
if (props.isPreview) {
|
|
279
|
+
fileItem.url = file.path;
|
|
272
280
|
}
|
|
281
|
+
fileList.push(fileItem);
|
|
282
|
+
executeUpload(fileItem, index);
|
|
273
283
|
});
|
|
274
284
|
};
|
|
275
285
|
const filterFiles = (files) => {
|
|
@@ -292,10 +302,10 @@ const _sfc_main = create({
|
|
|
292
302
|
}
|
|
293
303
|
return files;
|
|
294
304
|
};
|
|
295
|
-
const onDelete = (file,
|
|
296
|
-
clearUploadQueue(
|
|
305
|
+
const onDelete = (file, index) => {
|
|
306
|
+
clearUploadQueue(index);
|
|
297
307
|
if (props.beforeDelete(file, fileList)) {
|
|
298
|
-
fileList.splice(
|
|
308
|
+
fileList.splice(index, 1);
|
|
299
309
|
emit("delete", {
|
|
300
310
|
file,
|
|
301
311
|
fileList
|
|
@@ -304,34 +314,19 @@ const _sfc_main = create({
|
|
|
304
314
|
console.log("\u7528\u6237\u963B\u6B62\u4E86\u5220\u9664\uFF01");
|
|
305
315
|
}
|
|
306
316
|
};
|
|
307
|
-
const onChange = (
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const $el = event.target;
|
|
312
|
-
let { files } = $el;
|
|
313
|
-
if (props.beforeUpload) {
|
|
314
|
-
props.beforeUpload(files).then((f) => {
|
|
315
|
-
const _files = filterFiles(new Array().slice.call(f));
|
|
316
|
-
readFile(_files);
|
|
317
|
-
});
|
|
318
|
-
} else {
|
|
319
|
-
const _files = filterFiles(new Array().slice.call(files));
|
|
320
|
-
readFile(_files);
|
|
321
|
-
}
|
|
317
|
+
const onChange = (res) => {
|
|
318
|
+
const { tempFilePaths, tempFiles } = res;
|
|
319
|
+
const _files = filterFiles(tempFiles);
|
|
320
|
+
readFile(_files);
|
|
322
321
|
emit("change", {
|
|
323
|
-
fileList
|
|
324
|
-
event
|
|
322
|
+
fileList
|
|
325
323
|
});
|
|
326
|
-
if (props.clearInput) {
|
|
327
|
-
clearInput($el);
|
|
328
|
-
}
|
|
329
324
|
};
|
|
330
325
|
return {
|
|
331
|
-
onChange,
|
|
332
326
|
onDelete,
|
|
333
327
|
fileList,
|
|
334
328
|
classes,
|
|
329
|
+
chooseImage,
|
|
335
330
|
fileItemClick,
|
|
336
331
|
clearUploadQueue,
|
|
337
332
|
submit
|
|
@@ -342,37 +337,34 @@ const _hoisted_1 = {
|
|
|
342
337
|
key: 0,
|
|
343
338
|
class: "nut-uploader__slot"
|
|
344
339
|
};
|
|
345
|
-
const _hoisted_2 =
|
|
346
|
-
const _hoisted_3 = ["accept", "multiple", "name", "disabled"];
|
|
347
|
-
const _hoisted_4 = {
|
|
340
|
+
const _hoisted_2 = {
|
|
348
341
|
key: 0,
|
|
349
342
|
class: "nut-uploader__preview-img"
|
|
350
343
|
};
|
|
351
|
-
const
|
|
344
|
+
const _hoisted_3 = {
|
|
352
345
|
key: 0,
|
|
353
346
|
class: "nut-uploader__preview__progress"
|
|
354
347
|
};
|
|
355
|
-
const
|
|
356
|
-
const
|
|
348
|
+
const _hoisted_4 = { class: "nut-uploader__preview__progress__msg" };
|
|
349
|
+
const _hoisted_5 = {
|
|
357
350
|
key: 1,
|
|
358
351
|
class: "nut-uploader__preview__progress"
|
|
359
352
|
};
|
|
360
|
-
const
|
|
361
|
-
const
|
|
362
|
-
const
|
|
353
|
+
const _hoisted_6 = { class: "nut-uploader__preview__progress__msg" };
|
|
354
|
+
const _hoisted_7 = ["onClick", "src"];
|
|
355
|
+
const _hoisted_8 = {
|
|
363
356
|
key: 4,
|
|
364
357
|
class: "nut-uploader__preview-img__file"
|
|
365
358
|
};
|
|
366
|
-
const
|
|
367
|
-
const
|
|
368
|
-
const
|
|
359
|
+
const _hoisted_9 = ["onClick"];
|
|
360
|
+
const _hoisted_10 = { class: "tips" };
|
|
361
|
+
const _hoisted_11 = {
|
|
369
362
|
key: 1,
|
|
370
363
|
class: "nut-uploader__preview-list"
|
|
371
364
|
};
|
|
372
|
-
const
|
|
373
|
-
const _hoisted_15 = ["accept", "multiple", "name", "disabled"];
|
|
374
|
-
const _hoisted_16 = ["accept", "multiple", "name", "disabled"];
|
|
365
|
+
const _hoisted_12 = ["onClick"];
|
|
375
366
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
367
|
+
const _component_nut_button = resolveComponent("nut-button");
|
|
376
368
|
const _component_nut_icon = resolveComponent("nut-icon");
|
|
377
369
|
const _component_nut_progress = resolveComponent("nut-progress");
|
|
378
370
|
return openBlock(), createElementBlock("view", {
|
|
@@ -380,80 +372,64 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
380
372
|
}, [
|
|
381
373
|
_ctx.$slots.default ? (openBlock(), createElementBlock("view", _hoisted_1, [
|
|
382
374
|
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)
|
|
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)
|
|
405
380
|
])) : createCommentVNode("", true),
|
|
406
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fileList, (item,
|
|
381
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.fileList, (item, index) => {
|
|
382
|
+
var _a;
|
|
407
383
|
return openBlock(), createElementBlock("view", {
|
|
408
384
|
class: normalizeClass(["nut-uploader__preview", [_ctx.listType]]),
|
|
409
385
|
key: item.uid
|
|
410
386
|
}, [
|
|
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",
|
|
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, [
|
|
415
391
|
createVNode(_component_nut_icon, {
|
|
416
392
|
color: "#fff",
|
|
417
393
|
name: item.status == "error" ? "failure" : "loading"
|
|
418
394
|
}, null, 8, ["name"]),
|
|
419
|
-
createElementVNode("view",
|
|
395
|
+
createElementVNode("view", _hoisted_6, toDisplayString(item.message), 1)
|
|
420
396
|
])) : createCommentVNode("", true),
|
|
421
397
|
_ctx.isDeletable ? (openBlock(), createBlock(_component_nut_icon, {
|
|
422
398
|
key: 2,
|
|
423
399
|
color: "rgba(0,0,0,0.6)",
|
|
424
|
-
onClick: ($event) => _ctx.onDelete(item,
|
|
400
|
+
onClick: ($event) => _ctx.onDelete(item, index),
|
|
425
401
|
class: "close",
|
|
426
402
|
name: "failure"
|
|
427
403
|
}, null, 8, ["onClick"])) : createCommentVNode("", true),
|
|
428
|
-
item.type.includes("image") && item.url ? (openBlock(), createElementBlock("img", {
|
|
404
|
+
((_a = item.type) == null ? void 0 : _a.includes("image")) && item.url ? (openBlock(), createElementBlock("img", {
|
|
429
405
|
key: 3,
|
|
430
406
|
class: "nut-uploader__preview-img__c",
|
|
431
407
|
onClick: ($event) => _ctx.fileItemClick(item),
|
|
432
408
|
src: item.url
|
|
433
|
-
}, null, 8,
|
|
409
|
+
}, null, 8, _hoisted_7)) : (openBlock(), createElementBlock("view", _hoisted_8, [
|
|
434
410
|
createElementVNode("view", {
|
|
435
|
-
|
|
436
|
-
|
|
411
|
+
class: "nut-uploader__preview-img__file__name",
|
|
412
|
+
onClick: ($event) => _ctx.fileItemClick(item)
|
|
437
413
|
}, [
|
|
438
414
|
createVNode(_component_nut_icon, {
|
|
439
415
|
color: "#808080",
|
|
440
416
|
name: "link"
|
|
441
417
|
}),
|
|
442
418
|
createTextVNode("\xA0" + toDisplayString(item.name), 1)
|
|
443
|
-
], 8,
|
|
419
|
+
], 8, _hoisted_9)
|
|
444
420
|
])),
|
|
445
|
-
createElementVNode("view",
|
|
446
|
-
])) : _ctx.listType == "list" ? (openBlock(), createElementBlock("view",
|
|
421
|
+
createElementVNode("view", _hoisted_10, toDisplayString(item.name), 1)
|
|
422
|
+
])) : _ctx.listType == "list" ? (openBlock(), createElementBlock("view", _hoisted_11, [
|
|
447
423
|
createElementVNode("view", {
|
|
448
|
-
|
|
449
|
-
|
|
424
|
+
class: normalizeClass(["nut-uploader__preview-img__file__name", [item.status]]),
|
|
425
|
+
onClick: ($event) => _ctx.fileItemClick(item)
|
|
450
426
|
}, [
|
|
451
427
|
createVNode(_component_nut_icon, { name: "link" }),
|
|
452
428
|
createTextVNode("\xA0" + toDisplayString(item.name), 1)
|
|
453
|
-
], 10,
|
|
429
|
+
], 10, _hoisted_12),
|
|
454
430
|
createVNode(_component_nut_icon, {
|
|
455
431
|
class: "nut-uploader__preview-img__file__del",
|
|
456
|
-
onClick: ($event) => _ctx.onDelete(item,
|
|
432
|
+
onClick: ($event) => _ctx.onDelete(item, index),
|
|
457
433
|
color: "#808080",
|
|
458
434
|
name: "del"
|
|
459
435
|
}, null, 8, ["onClick"]),
|
|
@@ -476,28 +452,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
476
452
|
color: "#808080",
|
|
477
453
|
name: _ctx.uploadIcon
|
|
478
454
|
}, 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,
|
|
455
|
+
createVNode(_component_nut_button, {
|
|
491
456
|
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))
|
|
457
|
+
onClick: _ctx.chooseImage
|
|
458
|
+
}, null, 8, ["onClick"])
|
|
499
459
|
], 2)) : createCommentVNode("", true)
|
|
500
460
|
], 2);
|
|
501
461
|
}
|
|
502
|
-
|
|
503
|
-
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 _ };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui v3.1.
|
|
2
|
+
* @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
|
|
3
3
|
* (c) 2021 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -7,30 +7,43 @@ import { unref } from "vue";
|
|
|
7
7
|
function isWindow(val) {
|
|
8
8
|
return val === window;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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}`).boundingClientRect();
|
|
43
|
+
query.exec(function(res) {
|
|
44
|
+
resolve(res[0]);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
35
48
|
};
|
|
36
|
-
export {
|
|
49
|
+
export { useTaroRect as u };
|