bm-admin-ui 1.0.16-alpha → 1.0.19-alpha
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/es/components/staffs-selector/index.js +1 -1
- package/es/components/timeline/index.d.ts +20 -6
- package/es/components/timeline/index.js +2 -2
- package/es/components/timeline/src/props.d.ts +6 -2
- package/es/components/timeline/src/timeline-item.vue.d.ts +20 -6
- package/es/components/upload/index.d.ts +9 -0
- package/es/components/upload/index.js +101 -17
- package/es/components/upload/src/upload.vue.d.ts +9 -0
- package/index.esm.js +104 -20
- package/index.js +104 -20
- package/lib/components/staffs-selector/index.js +1 -1
- package/lib/components/timeline/index.d.ts +20 -6
- package/lib/components/timeline/index.js +2 -2
- package/lib/components/timeline/src/props.d.ts +6 -2
- package/lib/components/timeline/src/timeline-item.vue.d.ts +20 -6
- package/lib/components/upload/index.d.ts +9 -0
- package/lib/components/upload/index.js +101 -17
- package/lib/components/upload/src/upload.vue.d.ts +9 -0
- package/package.json +1 -1
- package/theme-chalk/feedback.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/types/components/timeline/index.d.ts +20 -6
- package/types/components/timeline/src/props.d.ts +6 -2
- package/types/components/timeline/src/timeline-item.vue.d.ts +20 -6
- package/types/components/upload/index.d.ts +9 -0
- package/types/components/upload/src/upload.vue.d.ts +9 -0
package/index.js
CHANGED
|
@@ -45043,7 +45043,7 @@ var process = {
|
|
|
45043
45043
|
});
|
|
45044
45044
|
},
|
|
45045
45045
|
getSelectName(key) {
|
|
45046
|
-
let data = props.dataMap.get(
|
|
45046
|
+
let data = props.dataMap.get(key) || null;
|
|
45047
45047
|
return data ? data.title : "\u672A\u77E5";
|
|
45048
45048
|
}
|
|
45049
45049
|
};
|
|
@@ -46056,6 +46056,16 @@ var process = {
|
|
|
46056
46056
|
cloudReadUrl: {
|
|
46057
46057
|
type: String,
|
|
46058
46058
|
default: ""
|
|
46059
|
+
},
|
|
46060
|
+
holdProgress: {
|
|
46061
|
+
type: Number,
|
|
46062
|
+
default: 0
|
|
46063
|
+
},
|
|
46064
|
+
customErrors: {
|
|
46065
|
+
type: Object,
|
|
46066
|
+
default() {
|
|
46067
|
+
return void 0;
|
|
46068
|
+
}
|
|
46059
46069
|
}
|
|
46060
46070
|
},
|
|
46061
46071
|
emits: [
|
|
@@ -46065,7 +46075,9 @@ var process = {
|
|
|
46065
46075
|
"previewFile",
|
|
46066
46076
|
"successFile",
|
|
46067
46077
|
"deleteFile",
|
|
46068
|
-
"error"
|
|
46078
|
+
"error",
|
|
46079
|
+
"updateDisabledStatus",
|
|
46080
|
+
"updateIsUploadingStatus"
|
|
46069
46081
|
],
|
|
46070
46082
|
setup(props, { emit }) {
|
|
46071
46083
|
let acceptList = [
|
|
@@ -46117,15 +46129,15 @@ var process = {
|
|
|
46117
46129
|
disabled: false,
|
|
46118
46130
|
async customRequest({ file, fileField, data }) {
|
|
46119
46131
|
if (file.size > state.extraConfigs.maxSize * 1024 * 1024) {
|
|
46120
|
-
return methods.uploadError(new Error(`\u4E0D\u80FD\u4E0A\u4F20\u5927\u4E8E${state.extraConfigs.maxSize}M\u7684\u6587\u4EF6`));
|
|
46132
|
+
return methods.uploadError(new Error(props.customErrors?.maxSize || `\u4E0D\u80FD\u4E0A\u4F20\u5927\u4E8E${state.extraConfigs.maxSize}M\u7684\u6587\u4EF6`));
|
|
46121
46133
|
}
|
|
46122
46134
|
if (Object.keys(state.fileList).length >= state.extraConfigs.maxCount) {
|
|
46123
|
-
return methods.uploadError(new Error(`\u4E0D\u80FD\u4E0A\u4F20\u591A\u4E8E${state.extraConfigs.maxCount}\u4E2A\u6587\u4EF6`));
|
|
46135
|
+
return methods.uploadError(new Error(props.customErrors?.maxCount || `\u4E0D\u80FD\u4E0A\u4F20\u591A\u4E8E${state.extraConfigs.maxCount}\u4E2A\u6587\u4EF6`));
|
|
46124
46136
|
}
|
|
46125
46137
|
let name = file.name;
|
|
46126
46138
|
let fileFormat = name.split(".").pop();
|
|
46127
46139
|
if (!state.uploadConfigs.accept.includes(`.${fileFormat}`)) {
|
|
46128
|
-
return methods.uploadError(new Error(`\u4E0D\u80FD\u4E0A\u4F20\u8BE5\u7C7B\u578B\u6587\u4EF6`));
|
|
46140
|
+
return methods.uploadError(new Error(props.customErrors?.format || `\u4E0D\u80FD\u4E0A\u4F20\u8BE5\u7C7B\u578B\u6587\u4EF6`));
|
|
46129
46141
|
}
|
|
46130
46142
|
state.fileList[file.uid] = {
|
|
46131
46143
|
uid: file.uid,
|
|
@@ -46145,16 +46157,25 @@ var process = {
|
|
|
46145
46157
|
});
|
|
46146
46158
|
const methods = {
|
|
46147
46159
|
customUploadRequest(file) {
|
|
46160
|
+
const updateUploadProgress = (progress) => {
|
|
46161
|
+
if (methods.fileIsDelete(file)) {
|
|
46162
|
+
return;
|
|
46163
|
+
}
|
|
46164
|
+
state.fileList[file.uid] = {
|
|
46165
|
+
...state.fileList[file.uid],
|
|
46166
|
+
progress
|
|
46167
|
+
};
|
|
46168
|
+
};
|
|
46148
46169
|
props.uploadRequest?.(file, {
|
|
46149
46170
|
onUploadProgress: (e) => {
|
|
46150
46171
|
let progress = Math.round(e.loaded / e.total * 100);
|
|
46151
|
-
|
|
46152
|
-
|
|
46153
|
-
|
|
46154
|
-
|
|
46172
|
+
if (props.holdProgress) {
|
|
46173
|
+
progress = progress > props.holdProgress ? props.holdProgress : progress;
|
|
46174
|
+
}
|
|
46175
|
+
updateUploadProgress(progress);
|
|
46155
46176
|
}
|
|
46156
46177
|
}).then(function(data) {
|
|
46157
|
-
|
|
46178
|
+
updateUploadProgress(100);
|
|
46158
46179
|
methods.uploadSuccess(data, file);
|
|
46159
46180
|
}).catch(function(error) {
|
|
46160
46181
|
console.error(error);
|
|
@@ -46164,13 +46185,20 @@ var process = {
|
|
|
46164
46185
|
methods.uploadError(error, file);
|
|
46165
46186
|
});
|
|
46166
46187
|
},
|
|
46188
|
+
fileIsDelete(file) {
|
|
46189
|
+
return !state.fileList[file.uid];
|
|
46190
|
+
},
|
|
46167
46191
|
uploadSuccess(data, file) {
|
|
46192
|
+
if (methods.fileIsDelete(file)) {
|
|
46193
|
+
return;
|
|
46194
|
+
}
|
|
46168
46195
|
emit("successFile", data);
|
|
46169
46196
|
let uri = data?.url;
|
|
46170
46197
|
let item = state.extraConfigs.fileDetail ? {
|
|
46171
46198
|
name: file.name,
|
|
46172
46199
|
size: file.size,
|
|
46173
46200
|
type: file.type,
|
|
46201
|
+
uid: file.uid,
|
|
46174
46202
|
url: uri
|
|
46175
46203
|
} : uri;
|
|
46176
46204
|
state.uploadedList.push(item);
|
|
@@ -46179,6 +46207,9 @@ var process = {
|
|
|
46179
46207
|
emit("update", state.uploadedList);
|
|
46180
46208
|
},
|
|
46181
46209
|
uploadError(error, file = {}) {
|
|
46210
|
+
if (methods.fileIsDelete(file)) {
|
|
46211
|
+
return;
|
|
46212
|
+
}
|
|
46182
46213
|
if (file.uid && state.fileList[file.uid]) {
|
|
46183
46214
|
state.fileList[file.uid].status = "error";
|
|
46184
46215
|
}
|
|
@@ -46252,9 +46283,14 @@ var process = {
|
|
|
46252
46283
|
}
|
|
46253
46284
|
};
|
|
46254
46285
|
require$$1$1.watch(() => props.defaultList, function(list) {
|
|
46255
|
-
if (list
|
|
46286
|
+
if (list?.length) {
|
|
46287
|
+
list.forEach((item) => {
|
|
46288
|
+
if (!item.uid) {
|
|
46289
|
+
item.uid = utils.getuid();
|
|
46290
|
+
}
|
|
46291
|
+
});
|
|
46256
46292
|
list.forEach(function(item) {
|
|
46257
|
-
let uid = utils.getuid();
|
|
46293
|
+
let uid = item.uid || utils.getuid();
|
|
46258
46294
|
if (!item.url.includes("http") && !item.url.includes(CLOUND_PRE))
|
|
46259
46295
|
item.url = props.cloudReadUrl + item.url;
|
|
46260
46296
|
state.fileList[uid] = {
|
|
@@ -46265,8 +46301,13 @@ var process = {
|
|
|
46265
46301
|
progress: 100,
|
|
46266
46302
|
isDoneDeloy: true
|
|
46267
46303
|
};
|
|
46268
|
-
state.uploadedList.
|
|
46304
|
+
if (!state.uploadedList.find((item2) => item2.uid === uid)) {
|
|
46305
|
+
state.uploadedList.push(item);
|
|
46306
|
+
}
|
|
46269
46307
|
});
|
|
46308
|
+
} else {
|
|
46309
|
+
state.fileList = {};
|
|
46310
|
+
state.uploadedList = [];
|
|
46270
46311
|
}
|
|
46271
46312
|
}, {
|
|
46272
46313
|
immediate: true
|
|
@@ -46294,6 +46335,26 @@ var process = {
|
|
|
46294
46335
|
require$$1$1.watchEffect(() => {
|
|
46295
46336
|
state.uploadConfigs.disabled = uploadDisabled.value;
|
|
46296
46337
|
});
|
|
46338
|
+
require$$1$1.watch(() => uploadDisabled.value, (value) => {
|
|
46339
|
+
emit("updateDisabledStatus", value);
|
|
46340
|
+
}, {
|
|
46341
|
+
immediate: true
|
|
46342
|
+
});
|
|
46343
|
+
const isUploading = require$$1$1.computed(() => {
|
|
46344
|
+
let ret = false;
|
|
46345
|
+
let fileList = state.fileList || {};
|
|
46346
|
+
Object.keys(fileList).forEach((uid) => {
|
|
46347
|
+
if (fileList[uid]?.progress && fileList[uid].progress < 100) {
|
|
46348
|
+
ret = true;
|
|
46349
|
+
}
|
|
46350
|
+
});
|
|
46351
|
+
return ret;
|
|
46352
|
+
});
|
|
46353
|
+
require$$1$1.watch(() => isUploading.value, (value) => {
|
|
46354
|
+
emit("updateIsUploadingStatus", value);
|
|
46355
|
+
}, {
|
|
46356
|
+
immediate: true
|
|
46357
|
+
});
|
|
46297
46358
|
return {
|
|
46298
46359
|
...require$$1$1.toRefs(state),
|
|
46299
46360
|
icons,
|
|
@@ -46400,27 +46461,50 @@ var process = {
|
|
|
46400
46461
|
onMouseleave: ($event) => _ctx.pictureHoverLeave(item.uid),
|
|
46401
46462
|
onClick: _cache[0] || (_cache[0] = (e) => e.stopPropagation())
|
|
46402
46463
|
}, [
|
|
46403
|
-
|
|
46464
|
+
["pdf", "application/pdf"].includes(item.type) ? (require$$1$1.openBlock(), require$$1$1.createElementBlock("img", {
|
|
46404
46465
|
key: 0,
|
|
46405
46466
|
class: "bm-upload__picture-result__image",
|
|
46406
46467
|
src: $setup.icons.pdf,
|
|
46407
46468
|
alt: "avatar"
|
|
46408
|
-
}, null, 8, _hoisted_4$1)) :
|
|
46469
|
+
}, null, 8, _hoisted_4$1)) : [
|
|
46470
|
+
"xlsx",
|
|
46471
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
46472
|
+
].includes(item.type) ? (require$$1$1.openBlock(), require$$1$1.createElementBlock("img", {
|
|
46409
46473
|
key: 1,
|
|
46410
46474
|
class: "bm-upload__picture-result__image",
|
|
46411
46475
|
src: $setup.icons.excel,
|
|
46412
46476
|
alt: "avatar"
|
|
46413
|
-
}, null, 8, _hoisted_5$1)) :
|
|
46477
|
+
}, null, 8, _hoisted_5$1)) : [
|
|
46478
|
+
"ppt",
|
|
46479
|
+
"application/vnd.ms-powerpoint",
|
|
46480
|
+
"pptx",
|
|
46481
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
46482
|
+
].includes(item.type) ? (require$$1$1.openBlock(), require$$1$1.createElementBlock("img", {
|
|
46414
46483
|
key: 2,
|
|
46415
46484
|
class: "bm-upload__picture-result__image",
|
|
46416
46485
|
src: $setup.icons.ppt,
|
|
46417
46486
|
alt: "avatar"
|
|
46418
|
-
}, null, 8, _hoisted_6$1)) : [
|
|
46487
|
+
}, null, 8, _hoisted_6$1)) : [
|
|
46488
|
+
"doc",
|
|
46489
|
+
"application/msword",
|
|
46490
|
+
"docx",
|
|
46491
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
46492
|
+
].includes(item.type) ? (require$$1$1.openBlock(), require$$1$1.createElementBlock("img", {
|
|
46419
46493
|
key: 3,
|
|
46420
46494
|
class: "bm-upload__picture-result__image",
|
|
46421
46495
|
src: $setup.icons.doc,
|
|
46422
46496
|
alt: "avatar"
|
|
46423
|
-
}, null, 8, _hoisted_7$1)) : [
|
|
46497
|
+
}, null, 8, _hoisted_7$1)) : [
|
|
46498
|
+
"img",
|
|
46499
|
+
"image",
|
|
46500
|
+
"png",
|
|
46501
|
+
"image/png",
|
|
46502
|
+
"jpg",
|
|
46503
|
+
"jpeg",
|
|
46504
|
+
"image/jpeg",
|
|
46505
|
+
"gif",
|
|
46506
|
+
"image/gif"
|
|
46507
|
+
].includes(item.type) ? (require$$1$1.openBlock(), require$$1$1.createElementBlock("img", {
|
|
46424
46508
|
key: 4,
|
|
46425
46509
|
class: "bm-upload__picture-result__image",
|
|
46426
46510
|
src: item.url,
|
|
@@ -46609,8 +46693,8 @@ var process = {
|
|
|
46609
46693
|
});
|
|
46610
46694
|
const timelineItemProps = () => ({
|
|
46611
46695
|
color: z.oneOf(['blue', 'red', 'green', 'gray']).def('blue'),
|
|
46612
|
-
dot: z.any,
|
|
46613
|
-
label: z.any,
|
|
46696
|
+
dot: z.any.def(''),
|
|
46697
|
+
label: z.any.def(''),
|
|
46614
46698
|
});
|
|
46615
46699
|
|
|
46616
46700
|
const __default__$1 = {
|
|
@@ -1638,7 +1638,7 @@ const _sfc_main$1 = vue.defineComponent({
|
|
|
1638
1638
|
});
|
|
1639
1639
|
},
|
|
1640
1640
|
getSelectName(key) {
|
|
1641
|
-
let data = props.dataMap.get(
|
|
1641
|
+
let data = props.dataMap.get(key) || null;
|
|
1642
1642
|
return data ? data.title : "\u672A\u77E5";
|
|
1643
1643
|
}
|
|
1644
1644
|
};
|
|
@@ -44,8 +44,12 @@ declare const BmTimelineItem: import("bm-admin-ui/es/utils/with-install").SFCWit
|
|
|
44
44
|
color: import("vue-types").VueTypeDef<string> & {
|
|
45
45
|
default: string;
|
|
46
46
|
};
|
|
47
|
-
dot: import("vue-types").VueTypeValidableDef<any
|
|
48
|
-
|
|
47
|
+
dot: import("vue-types").VueTypeValidableDef<any> & {
|
|
48
|
+
default: any;
|
|
49
|
+
};
|
|
50
|
+
label: import("vue-types").VueTypeValidableDef<any> & {
|
|
51
|
+
default: any;
|
|
52
|
+
};
|
|
49
53
|
}, {
|
|
50
54
|
slots: Readonly<{
|
|
51
55
|
[name: string]: import("vue").Slot | undefined;
|
|
@@ -54,8 +58,12 @@ declare const BmTimelineItem: import("bm-admin-ui/es/utils/with-install").SFCWit
|
|
|
54
58
|
color: import("vue-types").VueTypeDef<string> & {
|
|
55
59
|
default: string;
|
|
56
60
|
};
|
|
57
|
-
dot: import("vue-types").VueTypeValidableDef<any
|
|
58
|
-
|
|
61
|
+
dot: import("vue-types").VueTypeValidableDef<any> & {
|
|
62
|
+
default: any;
|
|
63
|
+
};
|
|
64
|
+
label: import("vue-types").VueTypeValidableDef<any> & {
|
|
65
|
+
default: any;
|
|
66
|
+
};
|
|
59
67
|
}>> & {
|
|
60
68
|
[x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
|
|
61
69
|
}>>;
|
|
@@ -84,10 +92,16 @@ declare const BmTimelineItem: import("bm-admin-ui/es/utils/with-install").SFCWit
|
|
|
84
92
|
color: import("vue-types").VueTypeDef<string> & {
|
|
85
93
|
default: string;
|
|
86
94
|
};
|
|
87
|
-
dot: import("vue-types").VueTypeValidableDef<any
|
|
88
|
-
|
|
95
|
+
dot: import("vue-types").VueTypeValidableDef<any> & {
|
|
96
|
+
default: any;
|
|
97
|
+
};
|
|
98
|
+
label: import("vue-types").VueTypeValidableDef<any> & {
|
|
99
|
+
default: any;
|
|
100
|
+
};
|
|
89
101
|
}>>, {
|
|
90
102
|
color: string;
|
|
103
|
+
label: any;
|
|
104
|
+
dot: any;
|
|
91
105
|
}>>;
|
|
92
106
|
export { BmTimeline, BmTimelineItem };
|
|
93
107
|
export default BmTimeline;
|
|
@@ -46,8 +46,8 @@ const timelineProps = () => ({
|
|
|
46
46
|
});
|
|
47
47
|
const timelineItemProps = () => ({
|
|
48
48
|
color: z.oneOf(['blue', 'red', 'green', 'gray']).def('blue'),
|
|
49
|
-
dot: z.any,
|
|
50
|
-
label: z.any,
|
|
49
|
+
dot: z.any.def(''),
|
|
50
|
+
label: z.any.def(''),
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
var _export_sfc = (sfc, props) => {
|
|
@@ -14,7 +14,11 @@ export declare const timelineItemProps: () => {
|
|
|
14
14
|
color: import("vue-types").VueTypeDef<string> & {
|
|
15
15
|
default: string;
|
|
16
16
|
};
|
|
17
|
-
dot: import("vue-types").VueTypeValidableDef<any
|
|
18
|
-
|
|
17
|
+
dot: import("vue-types").VueTypeValidableDef<any> & {
|
|
18
|
+
default: any;
|
|
19
|
+
};
|
|
20
|
+
label: import("vue-types").VueTypeValidableDef<any> & {
|
|
21
|
+
default: any;
|
|
22
|
+
};
|
|
19
23
|
};
|
|
20
24
|
export declare type TimelineItemProps = Partial<ExtractPropTypes<ReturnType<typeof timelineItemProps>>>;
|
|
@@ -3,8 +3,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3
3
|
color: import("vue-types").VueTypeDef<string> & {
|
|
4
4
|
default: string;
|
|
5
5
|
};
|
|
6
|
-
dot: import("vue-types").VueTypeValidableDef<any
|
|
7
|
-
|
|
6
|
+
dot: import("vue-types").VueTypeValidableDef<any> & {
|
|
7
|
+
default: any;
|
|
8
|
+
};
|
|
9
|
+
label: import("vue-types").VueTypeValidableDef<any> & {
|
|
10
|
+
default: any;
|
|
11
|
+
};
|
|
8
12
|
}, {
|
|
9
13
|
slots: Readonly<{
|
|
10
14
|
[name: string]: import("vue").Slot | undefined;
|
|
@@ -13,8 +17,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
13
17
|
color: import("vue-types").VueTypeDef<string> & {
|
|
14
18
|
default: string;
|
|
15
19
|
};
|
|
16
|
-
dot: import("vue-types").VueTypeValidableDef<any
|
|
17
|
-
|
|
20
|
+
dot: import("vue-types").VueTypeValidableDef<any> & {
|
|
21
|
+
default: any;
|
|
22
|
+
};
|
|
23
|
+
label: import("vue-types").VueTypeValidableDef<any> & {
|
|
24
|
+
default: any;
|
|
25
|
+
};
|
|
18
26
|
}>> & {
|
|
19
27
|
[x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
|
|
20
28
|
}>>;
|
|
@@ -43,9 +51,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
43
51
|
color: import("vue-types").VueTypeDef<string> & {
|
|
44
52
|
default: string;
|
|
45
53
|
};
|
|
46
|
-
dot: import("vue-types").VueTypeValidableDef<any
|
|
47
|
-
|
|
54
|
+
dot: import("vue-types").VueTypeValidableDef<any> & {
|
|
55
|
+
default: any;
|
|
56
|
+
};
|
|
57
|
+
label: import("vue-types").VueTypeValidableDef<any> & {
|
|
58
|
+
default: any;
|
|
59
|
+
};
|
|
48
60
|
}>>, {
|
|
49
61
|
color: string;
|
|
62
|
+
label: any;
|
|
63
|
+
dot: any;
|
|
50
64
|
}>;
|
|
51
65
|
export default _default;
|
|
@@ -61,6 +61,14 @@ declare const BmUpload: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
|
|
|
61
61
|
type: StringConstructor;
|
|
62
62
|
default: string;
|
|
63
63
|
};
|
|
64
|
+
holdProgress: {
|
|
65
|
+
type: NumberConstructor;
|
|
66
|
+
default: number;
|
|
67
|
+
};
|
|
68
|
+
customErrors: {
|
|
69
|
+
type: ObjectConstructor;
|
|
70
|
+
default(): undefined;
|
|
71
|
+
};
|
|
64
72
|
};
|
|
65
73
|
emits: string[];
|
|
66
74
|
setup(props: any, { emit }: {
|
|
@@ -68,6 +76,7 @@ declare const BmUpload: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
|
|
|
68
76
|
}): {
|
|
69
77
|
uploadDisabled: import("vue").ComputedRef<boolean>;
|
|
70
78
|
customUploadRequest(file: any): void;
|
|
79
|
+
fileIsDelete(file: any): boolean;
|
|
71
80
|
uploadSuccess(data: any, file: any): void;
|
|
72
81
|
uploadError(error: any, file?: any): void;
|
|
73
82
|
deleteFile(uid: any): Promise<void>;
|
|
@@ -1337,6 +1337,16 @@ const _sfc_main = {
|
|
|
1337
1337
|
cloudReadUrl: {
|
|
1338
1338
|
type: String,
|
|
1339
1339
|
default: ""
|
|
1340
|
+
},
|
|
1341
|
+
holdProgress: {
|
|
1342
|
+
type: Number,
|
|
1343
|
+
default: 0
|
|
1344
|
+
},
|
|
1345
|
+
customErrors: {
|
|
1346
|
+
type: Object,
|
|
1347
|
+
default() {
|
|
1348
|
+
return void 0;
|
|
1349
|
+
}
|
|
1340
1350
|
}
|
|
1341
1351
|
},
|
|
1342
1352
|
emits: [
|
|
@@ -1346,7 +1356,9 @@ const _sfc_main = {
|
|
|
1346
1356
|
"previewFile",
|
|
1347
1357
|
"successFile",
|
|
1348
1358
|
"deleteFile",
|
|
1349
|
-
"error"
|
|
1359
|
+
"error",
|
|
1360
|
+
"updateDisabledStatus",
|
|
1361
|
+
"updateIsUploadingStatus"
|
|
1350
1362
|
],
|
|
1351
1363
|
setup(props, { emit }) {
|
|
1352
1364
|
let acceptList = [
|
|
@@ -1398,15 +1410,15 @@ const _sfc_main = {
|
|
|
1398
1410
|
disabled: false,
|
|
1399
1411
|
async customRequest({ file, fileField, data }) {
|
|
1400
1412
|
if (file.size > state.extraConfigs.maxSize * 1024 * 1024) {
|
|
1401
|
-
return methods.uploadError(new Error(`\u4E0D\u80FD\u4E0A\u4F20\u5927\u4E8E${state.extraConfigs.maxSize}M\u7684\u6587\u4EF6`));
|
|
1413
|
+
return methods.uploadError(new Error(props.customErrors?.maxSize || `\u4E0D\u80FD\u4E0A\u4F20\u5927\u4E8E${state.extraConfigs.maxSize}M\u7684\u6587\u4EF6`));
|
|
1402
1414
|
}
|
|
1403
1415
|
if (Object.keys(state.fileList).length >= state.extraConfigs.maxCount) {
|
|
1404
|
-
return methods.uploadError(new Error(`\u4E0D\u80FD\u4E0A\u4F20\u591A\u4E8E${state.extraConfigs.maxCount}\u4E2A\u6587\u4EF6`));
|
|
1416
|
+
return methods.uploadError(new Error(props.customErrors?.maxCount || `\u4E0D\u80FD\u4E0A\u4F20\u591A\u4E8E${state.extraConfigs.maxCount}\u4E2A\u6587\u4EF6`));
|
|
1405
1417
|
}
|
|
1406
1418
|
let name = file.name;
|
|
1407
1419
|
let fileFormat = name.split(".").pop();
|
|
1408
1420
|
if (!state.uploadConfigs.accept.includes(`.${fileFormat}`)) {
|
|
1409
|
-
return methods.uploadError(new Error(`\u4E0D\u80FD\u4E0A\u4F20\u8BE5\u7C7B\u578B\u6587\u4EF6`));
|
|
1421
|
+
return methods.uploadError(new Error(props.customErrors?.format || `\u4E0D\u80FD\u4E0A\u4F20\u8BE5\u7C7B\u578B\u6587\u4EF6`));
|
|
1410
1422
|
}
|
|
1411
1423
|
state.fileList[file.uid] = {
|
|
1412
1424
|
uid: file.uid,
|
|
@@ -1426,16 +1438,25 @@ const _sfc_main = {
|
|
|
1426
1438
|
});
|
|
1427
1439
|
const methods = {
|
|
1428
1440
|
customUploadRequest(file) {
|
|
1441
|
+
const updateUploadProgress = (progress) => {
|
|
1442
|
+
if (methods.fileIsDelete(file)) {
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
state.fileList[file.uid] = {
|
|
1446
|
+
...state.fileList[file.uid],
|
|
1447
|
+
progress
|
|
1448
|
+
};
|
|
1449
|
+
};
|
|
1429
1450
|
props.uploadRequest?.(file, {
|
|
1430
1451
|
onUploadProgress: (e) => {
|
|
1431
1452
|
let progress = Math.round(e.loaded / e.total * 100);
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1453
|
+
if (props.holdProgress) {
|
|
1454
|
+
progress = progress > props.holdProgress ? props.holdProgress : progress;
|
|
1455
|
+
}
|
|
1456
|
+
updateUploadProgress(progress);
|
|
1436
1457
|
}
|
|
1437
1458
|
}).then(function(data) {
|
|
1438
|
-
|
|
1459
|
+
updateUploadProgress(100);
|
|
1439
1460
|
methods.uploadSuccess(data, file);
|
|
1440
1461
|
}).catch(function(error) {
|
|
1441
1462
|
console.error(error);
|
|
@@ -1445,13 +1466,20 @@ const _sfc_main = {
|
|
|
1445
1466
|
methods.uploadError(error, file);
|
|
1446
1467
|
});
|
|
1447
1468
|
},
|
|
1469
|
+
fileIsDelete(file) {
|
|
1470
|
+
return !state.fileList[file.uid];
|
|
1471
|
+
},
|
|
1448
1472
|
uploadSuccess(data, file) {
|
|
1473
|
+
if (methods.fileIsDelete(file)) {
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1449
1476
|
emit("successFile", data);
|
|
1450
1477
|
let uri = data?.url;
|
|
1451
1478
|
let item = state.extraConfigs.fileDetail ? {
|
|
1452
1479
|
name: file.name,
|
|
1453
1480
|
size: file.size,
|
|
1454
1481
|
type: file.type,
|
|
1482
|
+
uid: file.uid,
|
|
1455
1483
|
url: uri
|
|
1456
1484
|
} : uri;
|
|
1457
1485
|
state.uploadedList.push(item);
|
|
@@ -1460,6 +1488,9 @@ const _sfc_main = {
|
|
|
1460
1488
|
emit("update", state.uploadedList);
|
|
1461
1489
|
},
|
|
1462
1490
|
uploadError(error, file = {}) {
|
|
1491
|
+
if (methods.fileIsDelete(file)) {
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1463
1494
|
if (file.uid && state.fileList[file.uid]) {
|
|
1464
1495
|
state.fileList[file.uid].status = "error";
|
|
1465
1496
|
}
|
|
@@ -1533,9 +1564,14 @@ const _sfc_main = {
|
|
|
1533
1564
|
}
|
|
1534
1565
|
};
|
|
1535
1566
|
vue.watch(() => props.defaultList, function(list) {
|
|
1536
|
-
if (list
|
|
1567
|
+
if (list?.length) {
|
|
1568
|
+
list.forEach((item) => {
|
|
1569
|
+
if (!item.uid) {
|
|
1570
|
+
item.uid = utils.getuid();
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1537
1573
|
list.forEach(function(item) {
|
|
1538
|
-
let uid = utils.getuid();
|
|
1574
|
+
let uid = item.uid || utils.getuid();
|
|
1539
1575
|
if (!item.url.includes("http") && !item.url.includes(CLOUND_PRE))
|
|
1540
1576
|
item.url = props.cloudReadUrl + item.url;
|
|
1541
1577
|
state.fileList[uid] = {
|
|
@@ -1546,8 +1582,13 @@ const _sfc_main = {
|
|
|
1546
1582
|
progress: 100,
|
|
1547
1583
|
isDoneDeloy: true
|
|
1548
1584
|
};
|
|
1549
|
-
state.uploadedList.
|
|
1585
|
+
if (!state.uploadedList.find((item2) => item2.uid === uid)) {
|
|
1586
|
+
state.uploadedList.push(item);
|
|
1587
|
+
}
|
|
1550
1588
|
});
|
|
1589
|
+
} else {
|
|
1590
|
+
state.fileList = {};
|
|
1591
|
+
state.uploadedList = [];
|
|
1551
1592
|
}
|
|
1552
1593
|
}, {
|
|
1553
1594
|
immediate: true
|
|
@@ -1575,6 +1616,26 @@ const _sfc_main = {
|
|
|
1575
1616
|
vue.watchEffect(() => {
|
|
1576
1617
|
state.uploadConfigs.disabled = uploadDisabled.value;
|
|
1577
1618
|
});
|
|
1619
|
+
vue.watch(() => uploadDisabled.value, (value) => {
|
|
1620
|
+
emit("updateDisabledStatus", value);
|
|
1621
|
+
}, {
|
|
1622
|
+
immediate: true
|
|
1623
|
+
});
|
|
1624
|
+
const isUploading = vue.computed(() => {
|
|
1625
|
+
let ret = false;
|
|
1626
|
+
let fileList = state.fileList || {};
|
|
1627
|
+
Object.keys(fileList).forEach((uid) => {
|
|
1628
|
+
if (fileList[uid]?.progress && fileList[uid].progress < 100) {
|
|
1629
|
+
ret = true;
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
return ret;
|
|
1633
|
+
});
|
|
1634
|
+
vue.watch(() => isUploading.value, (value) => {
|
|
1635
|
+
emit("updateIsUploadingStatus", value);
|
|
1636
|
+
}, {
|
|
1637
|
+
immediate: true
|
|
1638
|
+
});
|
|
1578
1639
|
return {
|
|
1579
1640
|
...vue.toRefs(state),
|
|
1580
1641
|
icons,
|
|
@@ -1681,27 +1742,50 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1681
1742
|
onMouseleave: ($event) => _ctx.pictureHoverLeave(item.uid),
|
|
1682
1743
|
onClick: _cache[0] || (_cache[0] = (e) => e.stopPropagation())
|
|
1683
1744
|
}, [
|
|
1684
|
-
|
|
1745
|
+
["pdf", "application/pdf"].includes(item.type) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1685
1746
|
key: 0,
|
|
1686
1747
|
class: "bm-upload__picture-result__image",
|
|
1687
1748
|
src: $setup.icons.pdf,
|
|
1688
1749
|
alt: "avatar"
|
|
1689
|
-
}, null, 8, _hoisted_4)) :
|
|
1750
|
+
}, null, 8, _hoisted_4)) : [
|
|
1751
|
+
"xlsx",
|
|
1752
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
1753
|
+
].includes(item.type) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1690
1754
|
key: 1,
|
|
1691
1755
|
class: "bm-upload__picture-result__image",
|
|
1692
1756
|
src: $setup.icons.excel,
|
|
1693
1757
|
alt: "avatar"
|
|
1694
|
-
}, null, 8, _hoisted_5)) :
|
|
1758
|
+
}, null, 8, _hoisted_5)) : [
|
|
1759
|
+
"ppt",
|
|
1760
|
+
"application/vnd.ms-powerpoint",
|
|
1761
|
+
"pptx",
|
|
1762
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
1763
|
+
].includes(item.type) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1695
1764
|
key: 2,
|
|
1696
1765
|
class: "bm-upload__picture-result__image",
|
|
1697
1766
|
src: $setup.icons.ppt,
|
|
1698
1767
|
alt: "avatar"
|
|
1699
|
-
}, null, 8, _hoisted_6)) : [
|
|
1768
|
+
}, null, 8, _hoisted_6)) : [
|
|
1769
|
+
"doc",
|
|
1770
|
+
"application/msword",
|
|
1771
|
+
"docx",
|
|
1772
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
1773
|
+
].includes(item.type) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1700
1774
|
key: 3,
|
|
1701
1775
|
class: "bm-upload__picture-result__image",
|
|
1702
1776
|
src: $setup.icons.doc,
|
|
1703
1777
|
alt: "avatar"
|
|
1704
|
-
}, null, 8, _hoisted_7)) : [
|
|
1778
|
+
}, null, 8, _hoisted_7)) : [
|
|
1779
|
+
"img",
|
|
1780
|
+
"image",
|
|
1781
|
+
"png",
|
|
1782
|
+
"image/png",
|
|
1783
|
+
"jpg",
|
|
1784
|
+
"jpeg",
|
|
1785
|
+
"image/jpeg",
|
|
1786
|
+
"gif",
|
|
1787
|
+
"image/gif"
|
|
1788
|
+
].includes(item.type) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1705
1789
|
key: 4,
|
|
1706
1790
|
class: "bm-upload__picture-result__image",
|
|
1707
1791
|
src: item.url,
|
|
@@ -61,6 +61,14 @@ declare const _default: {
|
|
|
61
61
|
type: StringConstructor;
|
|
62
62
|
default: string;
|
|
63
63
|
};
|
|
64
|
+
holdProgress: {
|
|
65
|
+
type: NumberConstructor;
|
|
66
|
+
default: number;
|
|
67
|
+
};
|
|
68
|
+
customErrors: {
|
|
69
|
+
type: ObjectConstructor;
|
|
70
|
+
default(): undefined;
|
|
71
|
+
};
|
|
64
72
|
};
|
|
65
73
|
emits: string[];
|
|
66
74
|
setup(props: any, { emit }: {
|
|
@@ -68,6 +76,7 @@ declare const _default: {
|
|
|
68
76
|
}): {
|
|
69
77
|
uploadDisabled: import("vue").ComputedRef<boolean>;
|
|
70
78
|
customUploadRequest(file: any): void;
|
|
79
|
+
fileIsDelete(file: any): boolean;
|
|
71
80
|
uploadSuccess(data: any, file: any): void;
|
|
72
81
|
uploadError(error: any, file?: any): void;
|
|
73
82
|
deleteFile(uid: any): Promise<void>;
|