@lemon30_npm/csit-vue3 1.0.72 → 1.0.73
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/csit-vue3.js +91 -86
- package/dist/index.css +1 -1
- package/dist/lib/ci-upload/index.css +1 -1
- package/dist/lib/ci-upload/index.vue.js +1 -1
- package/dist/lib/ci-upload/index.vue2.js +86 -83
- package/dist/lib/ci-upload/props/index.js +3 -1
- package/dist/types/src/components/components-project/ci-upload/index.vue.d.ts +1 -0
- package/dist/types/src/components/components-project/ci-upload/props/index.d.ts +1 -0
- package/dist/types/src/components/components-project/ci-upload/type.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ElUpload as oe, ElButton as te, ElLink as se, ElTooltip as
|
|
2
|
-
import { defineComponent as ne, mergeDefaults as ie, useSlots as re, ref as
|
|
3
|
-
import
|
|
1
|
+
import { ElUpload as oe, ElButton as te, ElLink as se, ElTooltip as ae, ElDivider as le } from "element-plus/es";
|
|
2
|
+
import { defineComponent as ne, mergeDefaults as ie, useSlots as re, ref as _, watch as de, createElementBlock as a, openBlock as s, normalizeClass as w, createBlock as v, createCommentVNode as n, mergeProps as ue, unref as f, createSlots as pe, withCtx as r, renderSlot as U, Fragment as g, createElementVNode as l, toDisplayString as y, renderList as $, normalizeProps as me, guardReactiveProps as ce, createTextVNode as h, createVNode as b, normalizeStyle as z, nextTick as fe } from "vue";
|
|
3
|
+
import P from "./icons/icon-upload-btn.svg.js";
|
|
4
4
|
import R from "./icons/icon-upload-btn-hover.svg.js";
|
|
5
5
|
import F from "./icons/icon-upload-btn-disabled.svg.js";
|
|
6
6
|
import ge from "./icons/icon-loading-blue.svg.js";
|
|
@@ -11,16 +11,16 @@ import { ElMessageBox as ve, ElMessage as he } from "element-plus";
|
|
|
11
11
|
import { useUpload as be } from "./hooks/useUpload.js";
|
|
12
12
|
import { useUploadRetry as Be } from "./hooks/useUploadRetry.js";
|
|
13
13
|
import { downloadFileWithAxios as Ce } from "./utils/file.js";
|
|
14
|
-
import { getFileIconByName as
|
|
15
|
-
import { useExposeMethods as
|
|
16
|
-
import { useCiUploadComputed as
|
|
14
|
+
import { getFileIconByName as Se } from "./utils/file-icon-maps.js";
|
|
15
|
+
import { useExposeMethods as Ue } from "./expose/index.js";
|
|
16
|
+
import { useCiUploadComputed as Te } from "./computed/index.js";
|
|
17
17
|
import { defaultProps as Ne } from "./props/index.js";
|
|
18
|
-
import { useFileSize as
|
|
19
|
-
import { handleUploadValidateFail as
|
|
20
|
-
import { createUploadRules as
|
|
21
|
-
import { confirmBeforeUpload as
|
|
22
|
-
import { abortUploadFlow as
|
|
23
|
-
const
|
|
18
|
+
import { useFileSize as _e } from "./hooks/useFileSize.js";
|
|
19
|
+
import { handleUploadValidateFail as Ee } from "./hooks/useUploadValidateFail.js";
|
|
20
|
+
import { createUploadRules as De } from "./hooks/rules/createUploadRules.js";
|
|
21
|
+
import { confirmBeforeUpload as $e } from "./hooks/useConfirmBeforeUpload.js";
|
|
22
|
+
import { abortUploadFlow as ze } from "./hooks/useAbortUploadFlow.js";
|
|
23
|
+
const Pe = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "tip-slot-textInfo"
|
|
26
26
|
}, Re = {
|
|
@@ -78,11 +78,12 @@ const Te = {
|
|
|
78
78
|
minFileNameLength: {},
|
|
79
79
|
confirmBeforeUpload: { type: Boolean },
|
|
80
80
|
confirmBeforeUploadText: {},
|
|
81
|
-
showUploadSecretTip: { type: Boolean }
|
|
81
|
+
showUploadSecretTip: { type: Boolean },
|
|
82
|
+
uploadSecretTipText: {}
|
|
82
83
|
}, Ne),
|
|
83
84
|
emits: ["update:fileList", "onSuccess", "onRemove", "onChange", "onError", "onCustomDownload"],
|
|
84
85
|
setup(L, { expose: I, emit: K }) {
|
|
85
|
-
const { formatFileSize: V } =
|
|
86
|
+
const { formatFileSize: V } = _e(), M = re(), E = _(), S = _(!1), k = _([]), { checkUploadStatus: q } = Ue(k), i = L, { customHttpRequest: H } = be(i.axiosInstance), d = K;
|
|
86
87
|
I({
|
|
87
88
|
checkUploadStatus: q
|
|
88
89
|
});
|
|
@@ -94,9 +95,9 @@ const Te = {
|
|
|
94
95
|
},
|
|
95
96
|
{ immediate: !0 }
|
|
96
97
|
);
|
|
97
|
-
const
|
|
98
|
+
const T = (e) => {
|
|
98
99
|
var o;
|
|
99
|
-
|
|
100
|
+
S.value = !1, (o = E.value) == null || o.handleRemove(e);
|
|
100
101
|
}, N = (e) => {
|
|
101
102
|
if (i.customDownload) {
|
|
102
103
|
d("onCustomDownload", e);
|
|
@@ -119,23 +120,23 @@ const Te = {
|
|
|
119
120
|
}, O = async (e) => {
|
|
120
121
|
if (i.confirmBeforeUpload)
|
|
121
122
|
try {
|
|
122
|
-
await
|
|
123
|
+
await $e(i.confirmBeforeUploadText);
|
|
123
124
|
} catch {
|
|
124
|
-
return
|
|
125
|
+
return ze(S);
|
|
125
126
|
}
|
|
126
|
-
const o =
|
|
127
|
+
const o = De(i);
|
|
127
128
|
for (const u of o) {
|
|
128
129
|
const p = u(e);
|
|
129
130
|
if (p !== !0)
|
|
130
|
-
return
|
|
131
|
+
return Ee(p, {
|
|
131
132
|
rawFile: e,
|
|
132
133
|
fileList: i.fileList,
|
|
133
134
|
emit: d,
|
|
134
|
-
internalRemoveFlag:
|
|
135
|
+
internalRemoveFlag: S
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
return !0;
|
|
138
|
-
}, W = (e, o) =>
|
|
139
|
+
}, W = (e, o) => S.value ? !0 : ve.confirm(
|
|
139
140
|
`确定删除 ${e.fileName || e.name} 文件?`,
|
|
140
141
|
"温馨提示",
|
|
141
142
|
{
|
|
@@ -163,10 +164,10 @@ const Te = {
|
|
|
163
164
|
e.status === "success" && !e.response || (d("update:fileList", o), d("onChange", e, o));
|
|
164
165
|
}, X = (e, o) => {
|
|
165
166
|
d("update:fileList", o), d("onRemove", e, o);
|
|
166
|
-
}, { hasRealDefaultSlot: Y, finalBeforeUpload: Z, defaultTipSlotTextInfo:
|
|
167
|
+
}, { hasRealDefaultSlot: Y, finalBeforeUpload: Z, defaultTipSlotTextInfo: D, otherSlots: x } = Te(i, M, O);
|
|
167
168
|
return (e, o) => {
|
|
168
|
-
const u = te, p = oe, m = se, B =
|
|
169
|
-
return s(),
|
|
169
|
+
const u = te, p = oe, m = se, B = ae, C = le;
|
|
170
|
+
return s(), a("div", {
|
|
170
171
|
class: w(["CiUpload", {}])
|
|
171
172
|
}, [
|
|
172
173
|
e.readonly ? n("", !0) : (s(), v(p, ue({
|
|
@@ -176,8 +177,9 @@ const Te = {
|
|
|
176
177
|
"is-drag": e.drag,
|
|
177
178
|
"is-disabled-upload-secret": e.showUploadSecretTip && e.drag
|
|
178
179
|
}],
|
|
180
|
+
"data-secret-tip": e.uploadSecretTipText,
|
|
179
181
|
ref_key: "uploadRef",
|
|
180
|
-
ref:
|
|
182
|
+
ref: E,
|
|
181
183
|
action: e.action,
|
|
182
184
|
data: e.data,
|
|
183
185
|
headers: e.headers,
|
|
@@ -198,56 +200,57 @@ const Te = {
|
|
|
198
200
|
"show-file-list": !1
|
|
199
201
|
}, e.$attrs), pe({
|
|
200
202
|
default: r(() => [
|
|
201
|
-
f(Y) ?
|
|
202
|
-
e.drag ? (s(),
|
|
203
|
-
o[0] || (o[0] =
|
|
203
|
+
f(Y) ? U(e.$slots, "default", { key: 0 }, void 0, !0) : (s(), a(g, { key: 1 }, [
|
|
204
|
+
e.drag ? (s(), a(g, { key: 0 }, [
|
|
205
|
+
o[0] || (o[0] = l("img", {
|
|
204
206
|
class: "upload-btn-icon",
|
|
205
|
-
src:
|
|
207
|
+
src: P,
|
|
206
208
|
alt: ""
|
|
207
209
|
}, null, -1)),
|
|
208
|
-
o[1] || (o[1] =
|
|
210
|
+
o[1] || (o[1] = l("img", {
|
|
209
211
|
class: "upload-btn-icon-hover",
|
|
210
212
|
src: R,
|
|
211
213
|
alt: ""
|
|
212
214
|
}, null, -1)),
|
|
213
|
-
o[2] || (o[2] =
|
|
215
|
+
o[2] || (o[2] = l("img", {
|
|
214
216
|
class: "upload-btn-icon-disabled",
|
|
215
217
|
src: F,
|
|
216
218
|
alt: ""
|
|
217
219
|
}, null, -1)),
|
|
218
|
-
o[3] || (o[3] =
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
o[3] || (o[3] = l("div", { class: "drag-text-info" }, [
|
|
221
|
+
l("span", { class: "drag-text-info-click" }, "点击上传"),
|
|
222
|
+
l("span", { class: "drag-text-info-black" }, "或将文件拖拽到这里上传")
|
|
221
223
|
], -1)),
|
|
222
|
-
e.$slots.tip ? (s(),
|
|
223
|
-
|
|
224
|
-
])) : (s(),
|
|
224
|
+
e.$slots.tip ? (s(), a("div", Pe, [
|
|
225
|
+
U(e.$slots, "tip", {}, void 0, !0)
|
|
226
|
+
])) : (s(), a("div", Re, y(f(D)), 1))
|
|
225
227
|
], 64)) : (s(), v(u, {
|
|
226
228
|
key: 1,
|
|
227
229
|
class: w(["upload-btn", { "is-disabled-upload-secret": e.showUploadSecretTip }]),
|
|
230
|
+
"data-secret-tip": e.uploadSecretTipText,
|
|
228
231
|
disabled: e.disabled
|
|
229
232
|
}, {
|
|
230
233
|
default: r(() => [
|
|
231
|
-
o[4] || (o[4] =
|
|
234
|
+
o[4] || (o[4] = l("img", {
|
|
232
235
|
class: "upload-btn-icon",
|
|
233
|
-
src:
|
|
236
|
+
src: P,
|
|
234
237
|
alt: ""
|
|
235
238
|
}, null, -1)),
|
|
236
|
-
o[5] || (o[5] =
|
|
239
|
+
o[5] || (o[5] = l("img", {
|
|
237
240
|
class: "upload-btn-icon-hover",
|
|
238
241
|
src: R,
|
|
239
242
|
alt: ""
|
|
240
243
|
}, null, -1)),
|
|
241
|
-
o[6] || (o[6] =
|
|
244
|
+
o[6] || (o[6] = l("img", {
|
|
242
245
|
class: "upload-btn-icon-disabled",
|
|
243
246
|
src: F,
|
|
244
247
|
alt: ""
|
|
245
248
|
}, null, -1)),
|
|
246
|
-
|
|
249
|
+
l("span", Fe, y(e.uploadBtnText), 1)
|
|
247
250
|
]),
|
|
248
251
|
_: 1,
|
|
249
252
|
__: [4, 5, 6]
|
|
250
|
-
}, 8, ["class", "disabled"]))
|
|
253
|
+
}, 8, ["class", "data-secret-tip", "disabled"]))
|
|
251
254
|
], 64))
|
|
252
255
|
]),
|
|
253
256
|
_: 2
|
|
@@ -255,33 +258,33 @@ const Te = {
|
|
|
255
258
|
e.drag ? void 0 : {
|
|
256
259
|
name: "tip",
|
|
257
260
|
fn: r(() => [
|
|
258
|
-
e.$slots.tip ? (s(),
|
|
259
|
-
|
|
260
|
-
])) : (s(),
|
|
261
|
+
e.$slots.tip ? (s(), a("div", Le, [
|
|
262
|
+
U(e.$slots, "tip", {}, void 0, !0)
|
|
263
|
+
])) : (s(), a("div", Ie, y(f(D)), 1))
|
|
261
264
|
]),
|
|
262
265
|
key: "0"
|
|
263
266
|
},
|
|
264
|
-
|
|
267
|
+
$(f(x), (t, c) => ({
|
|
265
268
|
name: c,
|
|
266
269
|
fn: r((ee) => [
|
|
267
|
-
|
|
270
|
+
U(e.$slots, c, me(ce(ee || {})), void 0, !0)
|
|
268
271
|
])
|
|
269
272
|
}))
|
|
270
|
-
]), 1040, ["class", "action", "data", "headers", "file-list", "accept", "limit", "multiple", "drag", "disabled", "before-upload", "http-request"])),
|
|
271
|
-
k.value.length ? (s(),
|
|
273
|
+
]), 1040, ["class", "data-secret-tip", "action", "data", "headers", "file-list", "accept", "limit", "multiple", "drag", "disabled", "before-upload", "http-request"])),
|
|
274
|
+
k.value.length ? (s(), a("div", {
|
|
272
275
|
key: 1,
|
|
273
276
|
class: w(["custom-file-list-default", { "is-readonly": e.readonly }])
|
|
274
277
|
}, [
|
|
275
|
-
(s(!0),
|
|
278
|
+
(s(!0), a(g, null, $(k.value, (t) => (s(), a("div", {
|
|
276
279
|
class: "file-item-wrapper",
|
|
277
280
|
key: t.uid
|
|
278
281
|
}, [
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
e.showFileExtIcon ? (s(),
|
|
282
|
+
l("div", Ke, [
|
|
283
|
+
l("div", Ve, [
|
|
284
|
+
e.showFileExtIcon ? (s(), a("img", {
|
|
282
285
|
key: 0,
|
|
283
286
|
class: "file-icon",
|
|
284
|
-
src: f(
|
|
287
|
+
src: f(Se)(t.fileName || t.name)
|
|
285
288
|
}, null, 8, Me)) : n("", !0),
|
|
286
289
|
e.showFileNameEllipsisTooltip ? (s(), v(B, {
|
|
287
290
|
key: 2,
|
|
@@ -314,13 +317,13 @@ const Te = {
|
|
|
314
317
|
_: 2
|
|
315
318
|
}, 1032, ["disabled", "onClick"]))
|
|
316
319
|
]),
|
|
317
|
-
|
|
318
|
-
e.showFileSize ? (s(),
|
|
319
|
-
t.status !== "fail" ? (s(),
|
|
320
|
-
t.status !== "uploading" ? (s(),
|
|
321
|
-
e.showPreviewBtn ? (s(),
|
|
320
|
+
l("div", qe, [
|
|
321
|
+
e.showFileSize ? (s(), a("span", He, y(f(V)(t.fileSize || t.size)), 1)) : n("", !0),
|
|
322
|
+
t.status !== "fail" ? (s(), a("div", Ae, [
|
|
323
|
+
t.status !== "uploading" ? (s(), a(g, { key: 0 }, [
|
|
324
|
+
e.showPreviewBtn ? (s(), a(g, { key: 0 }, [
|
|
322
325
|
b(m, {
|
|
323
|
-
onClick: (c) =>
|
|
326
|
+
onClick: (c) => T(t)
|
|
324
327
|
}, {
|
|
325
328
|
default: r(() => o[7] || (o[7] = [
|
|
326
329
|
h(" 在线预览 ")
|
|
@@ -330,7 +333,7 @@ const Te = {
|
|
|
330
333
|
}, 1032, ["onClick"]),
|
|
331
334
|
b(C, { direction: "vertical" })
|
|
332
335
|
], 64)) : n("", !0),
|
|
333
|
-
e.showDownloadBtn ? (s(),
|
|
336
|
+
e.showDownloadBtn ? (s(), a(g, { key: 1 }, [
|
|
334
337
|
b(m, {
|
|
335
338
|
disabled: t.status === "downloading",
|
|
336
339
|
onClick: (c) => N(t)
|
|
@@ -347,7 +350,7 @@ const Te = {
|
|
|
347
350
|
], 64)) : n("", !0),
|
|
348
351
|
e.showDeleteBtn && !e.readonly ? (s(), v(m, {
|
|
349
352
|
key: 2,
|
|
350
|
-
onClick: (c) =>
|
|
353
|
+
onClick: (c) => T(t)
|
|
351
354
|
}, {
|
|
352
355
|
default: r(() => o[8] || (o[8] = [
|
|
353
356
|
h("删除")
|
|
@@ -357,34 +360,34 @@ const Te = {
|
|
|
357
360
|
}, 1032, ["onClick"])) : n("", !0)
|
|
358
361
|
], 64)) : n("", !0)
|
|
359
362
|
])) : n("", !0),
|
|
360
|
-
|
|
361
|
-
t.status === "uploading" ? (s(),
|
|
363
|
+
l("div", Oe, [
|
|
364
|
+
t.status === "uploading" ? (s(), a("div", {
|
|
362
365
|
key: 0,
|
|
363
366
|
class: w(t.status)
|
|
364
367
|
}, [
|
|
365
|
-
o[9] || (o[9] =
|
|
368
|
+
o[9] || (o[9] = l("img", {
|
|
366
369
|
class: "uploading-icon",
|
|
367
370
|
src: ge
|
|
368
371
|
}, null, -1)),
|
|
369
|
-
|
|
372
|
+
l("span", We, y(t.percentage) + "%", 1)
|
|
370
373
|
], 2)) : n("", !0),
|
|
371
|
-
e.readonly ? n("", !0) : (s(),
|
|
372
|
-
t.status === "success" || t.status === "downloading" ? (s(),
|
|
374
|
+
e.readonly ? n("", !0) : (s(), a(g, { key: 1 }, [
|
|
375
|
+
t.status === "success" || t.status === "downloading" ? (s(), a("span", {
|
|
373
376
|
key: 0,
|
|
374
377
|
class: w(t.status)
|
|
375
378
|
}, o[10] || (o[10] = [
|
|
376
|
-
|
|
379
|
+
l("img", {
|
|
377
380
|
class: "success-icon",
|
|
378
381
|
src: ye
|
|
379
382
|
}, null, -1)
|
|
380
383
|
]), 2)) : n("", !0)
|
|
381
384
|
], 64)),
|
|
382
|
-
t.status === "fail" ? (s(),
|
|
385
|
+
t.status === "fail" ? (s(), a("div", {
|
|
383
386
|
key: 2,
|
|
384
387
|
class: w(["fail-icon-wrapper", t.status])
|
|
385
388
|
}, [
|
|
386
389
|
b(m, {
|
|
387
|
-
onClick: (c) =>
|
|
390
|
+
onClick: (c) => T(t)
|
|
388
391
|
}, {
|
|
389
392
|
default: r(() => o[11] || (o[11] = [
|
|
390
393
|
h(" 删除 ")
|
|
@@ -398,7 +401,7 @@ const Te = {
|
|
|
398
401
|
placement: "bottom"
|
|
399
402
|
}, {
|
|
400
403
|
default: r(() => [
|
|
401
|
-
|
|
404
|
+
l("img", {
|
|
402
405
|
class: "retry-icon",
|
|
403
406
|
src: we,
|
|
404
407
|
onClick: (c) => f(A)(t)
|
|
@@ -406,7 +409,7 @@ const Te = {
|
|
|
406
409
|
]),
|
|
407
410
|
_: 2
|
|
408
411
|
}, 1024),
|
|
409
|
-
o[12] || (o[12] =
|
|
412
|
+
o[12] || (o[12] = l("img", {
|
|
410
413
|
class: "fail-icon",
|
|
411
414
|
src: ke
|
|
412
415
|
}, null, -1))
|
|
@@ -414,19 +417,19 @@ const Te = {
|
|
|
414
417
|
])
|
|
415
418
|
])
|
|
416
419
|
]),
|
|
417
|
-
e.showUploadProgress ? (s(),
|
|
418
|
-
t.status === "uploading" ? (s(),
|
|
419
|
-
|
|
420
|
+
e.showUploadProgress ? (s(), a(g, { key: 0 }, [
|
|
421
|
+
t.status === "uploading" ? (s(), a("div", Ge, [
|
|
422
|
+
l("div", {
|
|
420
423
|
class: "file-progress-inner",
|
|
421
|
-
style:
|
|
424
|
+
style: z({ width: (t.percentage || 0) + "%" })
|
|
422
425
|
}, null, 4)
|
|
423
426
|
])) : n("", !0)
|
|
424
427
|
], 64)) : n("", !0),
|
|
425
|
-
e.showDownloadProgress ? (s(),
|
|
426
|
-
t.status === "downloading" ? (s(),
|
|
427
|
-
|
|
428
|
+
e.showDownloadProgress ? (s(), a(g, { key: 1 }, [
|
|
429
|
+
t.status === "downloading" ? (s(), a("div", Je, [
|
|
430
|
+
l("div", {
|
|
428
431
|
class: "file-progress-inner",
|
|
429
|
-
style:
|
|
432
|
+
style: z({ width: (t.downloadPercentage || 0) + "%" })
|
|
430
433
|
}, null, 4)
|
|
431
434
|
])) : n("", !0)
|
|
432
435
|
], 64)) : n("", !0)
|
|
@@ -68,7 +68,9 @@ const e = {
|
|
|
68
68
|
*/
|
|
69
69
|
confirmBeforeUploadText: "确定要上传该文件吗?",
|
|
70
70
|
// 是否展示 '禁止上传国家秘密' 提示文案 - 默认值: false
|
|
71
|
-
showUploadSecretTip: !1
|
|
71
|
+
showUploadSecretTip: !1,
|
|
72
|
+
// 自定义展示的保密提示文案 - 默认值: '禁止上传国家秘密和工作秘密文件'
|
|
73
|
+
uploadSecretTipText: "禁止上传国家秘密和工作秘密文件"
|
|
72
74
|
};
|
|
73
75
|
export {
|
|
74
76
|
e as defaultProps
|
|
@@ -53,6 +53,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Ci
|
|
|
53
53
|
confirmBeforeUpload: boolean;
|
|
54
54
|
confirmBeforeUploadText: string;
|
|
55
55
|
showUploadSecretTip: boolean;
|
|
56
|
+
uploadSecretTipText: string;
|
|
56
57
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
57
58
|
uploadRef: unknown;
|
|
58
59
|
}, HTMLDivElement>, Partial<Record<number, (_: any) => any>> & {
|