@lemon30_npm/csit-vue3 1.0.66 → 1.0.68

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.
Files changed (33) hide show
  1. package/dist/csit-vue3.js +797 -744
  2. package/dist/index.css +1 -1
  3. package/dist/lib/ci-common-list/ci-common-list-layout/index.css +1 -1
  4. package/dist/lib/ci-common-list/ci-common-list-layout/index.vue.js +2 -2
  5. package/dist/lib/ci-common-list/ci-common-list-layout/index.vue2.js +25 -31
  6. package/dist/lib/ci-common-list/ci-common-list-query/index.css +1 -1
  7. package/dist/lib/ci-common-list/ci-common-list-query/index.vue.js +2 -2
  8. package/dist/lib/ci-common-list/ci-common-list-query/index.vue2.js +32 -32
  9. package/dist/lib/ci-upload/hooks/rules/createUploadRules.js +14 -0
  10. package/dist/lib/ci-upload/hooks/rules/fileNameLengthRule.js +15 -0
  11. package/dist/lib/ci-upload/hooks/rules/maxSizeRule.js +8 -0
  12. package/dist/lib/ci-upload/hooks/rules/minSizeRule.js +8 -0
  13. package/dist/lib/ci-upload/hooks/rules/typeRule.js +10 -0
  14. package/dist/lib/ci-upload/hooks/useAbortUploadFlow.js +7 -0
  15. package/dist/lib/ci-upload/hooks/useConfirmBeforeUpload.js +11 -0
  16. package/dist/lib/ci-upload/hooks/useUploadValidateFail.js +12 -0
  17. package/dist/lib/ci-upload/index.css +1 -1
  18. package/dist/lib/ci-upload/index.vue.js +2 -2
  19. package/dist/lib/ci-upload/index.vue2.js +206 -200
  20. package/dist/lib/ci-upload/props/index.js +11 -1
  21. package/dist/types/src/components/components-project/ci-upload/hooks/rules/createUploadRules.d.ts +2 -0
  22. package/dist/types/src/components/components-project/ci-upload/hooks/rules/fileNameLengthRule.d.ts +2 -0
  23. package/dist/types/src/components/components-project/ci-upload/hooks/rules/maxSizeRule.d.ts +2 -0
  24. package/dist/types/src/components/components-project/ci-upload/hooks/rules/minSizeRule.d.ts +2 -0
  25. package/dist/types/src/components/components-project/ci-upload/hooks/rules/typeRule.d.ts +2 -0
  26. package/dist/types/src/components/components-project/ci-upload/hooks/rules/types.d.ts +2 -0
  27. package/dist/types/src/components/components-project/ci-upload/hooks/useAbortUploadFlow.d.ts +12 -0
  28. package/dist/types/src/components/components-project/ci-upload/hooks/useConfirmBeforeUpload.d.ts +1 -0
  29. package/dist/types/src/components/components-project/ci-upload/hooks/useUploadValidateFail.d.ts +19 -0
  30. package/dist/types/src/components/components-project/ci-upload/index.vue.d.ts +2 -0
  31. package/dist/types/src/components/components-project/ci-upload/props/index.d.ts +10 -0
  32. package/dist/types/src/components/components-project/ci-upload/type.d.ts +10 -0
  33. package/package.json +1 -1
@@ -1,50 +1,54 @@
1
- import { ElUpload as re, ElButton as de, ElLink as ue, ElTooltip as me, ElDivider as ce } from "element-plus/es";
2
- import { defineComponent as pe, mergeDefaults as fe, useSlots as ge, ref as V, watch as ye, createElementBlock as l, openBlock as s, createBlock as L, createCommentVNode as n, mergeProps as ve, unref as y, createSlots as ke, withCtx as m, renderSlot as P, Fragment as v, createElementVNode as a, toDisplayString as b, renderList as M, normalizeProps as we, guardReactiveProps as he, normalizeClass as $, createTextVNode as _, createVNode as N, normalizeStyle as q, nextTick as D } from "vue";
3
- import A from "./icons/icon-upload-btn.svg.js";
4
- import H from "./icons/icon-upload-btn-hover.svg.js";
5
- import O from "./icons/icon-upload-btn-disabled.svg.js";
6
- import be from "./icons/icon-loading-blue.svg.js";
7
- import Be from "./icons/icon-upload-success.svg.js";
8
- import Se from "./icons/icon-upload-retry.svg.js";
9
- import Ce from "./icons/icon-upload-fail.svg.js";
10
- import { ElMessageBox as Le, ElMessage as z } from "element-plus";
11
- import { useUpload as _e } from "./hooks/useUpload.js";
12
- import { useUploadRetry as Ne } from "./hooks/useUploadRetry.js";
13
- import { downloadFileWithAxios as ze } from "./utils/file.js";
14
- import { getFileIconByName as $e } from "./utils/file-icon-maps.js";
15
- import { useExposeMethods as De } from "./expose/index.js";
16
- import { useCiUploadComputed as Ee } from "./computed/index.js";
17
- import { defaultProps as Te } from "./props/index.js";
18
- import { useFileSize as Pe } from "./hooks/useFileSize.js";
19
- const Ue = { class: "CiUpload" }, Ie = {
1
+ import { ElUpload as oe, ElButton as te, ElLink as se, ElTooltip as le, ElDivider as ae } from "element-plus/es";
2
+ import { defineComponent as ne, mergeDefaults as ie, useSlots as re, ref as E, watch as de, createElementBlock as l, openBlock as s, createBlock as k, createCommentVNode as n, mergeProps as ue, unref as f, createSlots as me, withCtx as r, renderSlot as U, Fragment as g, createElementVNode as a, toDisplayString as y, renderList as z, normalizeProps as pe, guardReactiveProps as ce, normalizeClass as C, createTextVNode as v, createVNode as h, normalizeStyle as P, nextTick as fe } from "vue";
3
+ import R from "./icons/icon-upload-btn.svg.js";
4
+ import F from "./icons/icon-upload-btn-hover.svg.js";
5
+ import L from "./icons/icon-upload-btn-disabled.svg.js";
6
+ import ge from "./icons/icon-loading-blue.svg.js";
7
+ import ye from "./icons/icon-upload-success.svg.js";
8
+ import we from "./icons/icon-upload-retry.svg.js";
9
+ import ke from "./icons/icon-upload-fail.svg.js";
10
+ import { ElMessageBox as ve, ElMessage as he } from "element-plus";
11
+ import { useUpload as be } from "./hooks/useUpload.js";
12
+ import { useUploadRetry as Be } from "./hooks/useUploadRetry.js";
13
+ import { downloadFileWithAxios as Ce } from "./utils/file.js";
14
+ import { getFileIconByName as _e } from "./utils/file-icon-maps.js";
15
+ import { useExposeMethods as Ue } from "./expose/index.js";
16
+ import { useCiUploadComputed as Se } from "./computed/index.js";
17
+ import { defaultProps as Ne } from "./props/index.js";
18
+ import { useFileSize as Ee } from "./hooks/useFileSize.js";
19
+ import { handleUploadValidateFail as De } from "./hooks/useUploadValidateFail.js";
20
+ import { createUploadRules as $e } from "./hooks/rules/createUploadRules.js";
21
+ import { confirmBeforeUpload as ze } from "./hooks/useConfirmBeforeUpload.js";
22
+ import { abortUploadFlow as Pe } from "./hooks/useAbortUploadFlow.js";
23
+ const Re = { class: "CiUpload" }, Fe = {
20
24
  key: 0,
21
25
  class: "tip-slot-textInfo"
22
- }, Re = {
26
+ }, Le = {
23
27
  key: 1,
24
28
  class: "default-tip-slot-textInfo"
25
- }, Ve = { class: "upload-btn-text" }, Fe = {
29
+ }, Te = { class: "upload-btn-text" }, Ie = {
26
30
  key: 0,
27
31
  class: "tip-slot-textInfo"
28
32
  }, Ke = {
29
33
  key: 1,
30
34
  class: "default-tip-slot-textInfo"
31
- }, Me = { class: "file-item-top" }, qe = { class: "file-name-file-icon" }, Ae = ["src"], He = { class: "top-right" }, Oe = {
35
+ }, Ve = { class: "file-item-top" }, Me = { class: "file-name-file-icon" }, qe = ["src"], He = { class: "top-right" }, Ae = {
32
36
  key: 0,
33
37
  class: "file-size"
34
- }, We = {
38
+ }, Oe = {
35
39
  key: 1,
36
40
  class: "file-operate-btn"
37
- }, je = { class: "file-status-icon-wrapper" }, Ge = { class: "uploading-percentage" }, Je = ["onClick"], Qe = {
41
+ }, We = { class: "file-status-icon-wrapper" }, je = { class: "uploading-percentage" }, Ge = ["onClick"], Je = {
38
42
  key: 0,
39
43
  class: "file-item-bottom file-progress-bar"
40
- }, Xe = {
44
+ }, Qe = {
41
45
  key: 0,
42
46
  class: "file-item-bottom file-progress-bar download-progress-bar"
43
- }, Ye = {
47
+ }, Xe = {
44
48
  name: "CiUpload"
45
- }, kt = /* @__PURE__ */ pe({
46
- ...Ye,
47
- props: /* @__PURE__ */ fe({
49
+ }, ho = /* @__PURE__ */ ne({
50
+ ...Xe,
51
+ props: /* @__PURE__ */ ie({
48
52
  action: {},
49
53
  downloadUrl: {},
50
54
  data: {},
@@ -71,66 +75,68 @@ const Ue = { class: "CiUpload" }, Ie = {
71
75
  minSize: {},
72
76
  showFileNameEllipsisTooltip: { type: Boolean },
73
77
  maxFileNameLength: {},
74
- minFileNameLength: {}
75
- }, Te),
78
+ minFileNameLength: {},
79
+ confirmBeforeUpload: { type: Boolean },
80
+ confirmBeforeUploadText: {}
81
+ }, Ne),
76
82
  emits: ["update:fileList", "onSuccess", "onRemove", "onChange", "onError", "onCustomDownload"],
77
- setup(W, { expose: j, emit: G }) {
78
- const { formatFileSize: U } = Pe(), J = ge(), F = V(), f = V(!1), S = V([]), { checkUploadStatus: Q } = De(S), i = W, { customHttpRequest: X } = _e(i.axiosInstance), r = G;
79
- j({
80
- checkUploadStatus: Q
83
+ setup(T, { expose: I, emit: K }) {
84
+ const { formatFileSize: V } = Ee(), M = re(), D = E(), _ = E(!1), w = E([]), { checkUploadStatus: q } = Ue(w), i = T, { customHttpRequest: H } = be(i.axiosInstance), d = K;
85
+ I({
86
+ checkUploadStatus: q
81
87
  });
82
- const { retryUpload: Y } = Ne(S, r, i);
83
- ye(
88
+ const { retryUpload: A } = Be(w, d, i);
89
+ de(
84
90
  () => i.fileList,
85
91
  (e) => {
86
- S.value = e.map((t) => ({ ...t }));
92
+ w.value = e.map((o) => ({ ...o }));
87
93
  },
88
94
  { immediate: !0 }
89
95
  );
90
- const I = (e) => {
91
- var t;
92
- (t = F.value) == null || t.handleRemove(e);
93
- }, R = (e) => {
96
+ const S = (e) => {
97
+ var o;
98
+ _.value = !1, (o = D.value) == null || o.handleRemove(e);
99
+ }, N = (e) => {
94
100
  if (i.customDownload) {
95
- r("onCustomDownload", e);
101
+ d("onCustomDownload", e);
96
102
  return;
97
103
  }
98
- e.downloadPercentage = 0, e.status = "downloading", ze(
104
+ e.downloadPercentage = 0, e.status = "downloading", Ce(
99
105
  {
100
106
  fileKey: e.fileKey || "当前此条数据没有fileKey字段",
101
107
  fileName: e.fileName || "当前此条数据没有fileName字段"
102
108
  },
103
109
  i.downloadUrl,
104
- (t) => {
105
- e.downloadPercentage = t, t === 100 && (e.status = "success");
110
+ (o) => {
111
+ e.downloadPercentage = o, o === 100 && (e.status = "success");
106
112
  },
107
- (t) => {
113
+ (o) => {
108
114
  e.status = "success";
109
115
  },
110
116
  i.axiosInstance
111
117
  );
112
- }, Z = (e) => {
113
- const t = i.accept.split(",").map((u) => u.trim().toLowerCase()), c = e.type.toLowerCase(), k = e.name.toLowerCase();
114
- if (!t.some((u) => c === u || k.endsWith(u)))
115
- return z.error("不支持上传该类型文件"), f.value = !0, D(() => {
116
- const u = i.fileList.filter((B) => B.uid !== e.uid);
117
- r("update:fileList", u), f.value = !1;
118
- }), !1;
119
- const g = e.name || "", w = g.lastIndexOf("."), d = (w > 0 ? g.slice(0, w) : g).length, h = i.maxFileNameLength, C = i.minFileNameLength;
120
- let E = !0, T = "";
121
- return h > 0 && C > 0 ? (d > h || d < C) && (E = !1, T = `文件名长度需在 ${C} 到 ${h} 个字符之间`) : h > 0 ? d > h && (E = !1, T = `文件名长度不能超过 ${h} 个字符`) : C > 0 && d < C && (E = !1, T = `文件名长度不能小于 ${C} 个字符`), E ? e.size < i.minSize || e.size === 0 ? (e.size === 0 ? z.error("文件大小不能为空") : z.error(`文件大小不能小于 ${U(i.minSize)}`), f.value = !0, D(() => {
122
- const u = i.fileList.filter((B) => B.uid !== e.uid);
123
- r("update:fileList", u), f.value = !1;
124
- }), !1) : e.size <= i.maxSize ? !0 : (z.error(`文件大小超出限制,最大文件大小为${U(i.maxSize)}`), f.value = !0, D(() => {
125
- const u = i.fileList.filter((B) => B.uid !== e.uid);
126
- r("update:fileList", u), f.value = !1;
127
- }), !1) : (z.error(T), f.value = !0, D(() => {
128
- const u = i.fileList.filter((B) => B.uid !== e.uid);
129
- r("update:fileList", u), f.value = !1;
130
- }), !1);
131
- }, x = (e, t) => f.value ? !0 : Le.confirm(
118
+ }, O = async (e) => {
119
+ if (i.confirmBeforeUpload)
120
+ try {
121
+ await ze(i.confirmBeforeUploadText);
122
+ } catch {
123
+ return Pe(_);
124
+ }
125
+ const o = $e(i);
126
+ for (const u of o) {
127
+ const m = u(e);
128
+ if (m !== !0)
129
+ return De(m, {
130
+ rawFile: e,
131
+ fileList: i.fileList,
132
+ emit: d,
133
+ internalRemoveFlag: _
134
+ });
135
+ }
136
+ return !0;
137
+ }, W = (e, o) => _.value ? !0 : ve.confirm(
132
138
  `确定删除 ${e.fileName || e.name} 文件?`,
133
- "确定删除",
139
+ "温馨提示",
134
140
  {
135
141
  // 是否可以点击遮罩层关闭
136
142
  closeOnClickModal: !1,
@@ -141,96 +147,96 @@ const Ue = { class: "CiUpload" }, Ie = {
141
147
  // 用户点击“确定”按钮,允许删除
142
148
  () => !1
143
149
  // 用户点击“取消”按钮,取消删除
144
- ), ee = (e, t) => {
145
- z.error(`文件数量超出限制,最大文件数量为${i.limit}个`);
146
- }, te = (e, t, c) => {
147
- t.status = "fail", t.percentage = 0, D(() => {
148
- r("update:fileList", [...c, t]), r("onError", t, c);
150
+ ), j = (e, o) => {
151
+ he.error(`文件数量超出限制,最大文件数量为${i.limit}个`);
152
+ }, G = (e, o, u) => {
153
+ o.status = "fail", o.percentage = 0, fe(() => {
154
+ d("update:fileList", [...u, o]), d("onError", o, u);
149
155
  });
150
- }, oe = (e, t, c) => {
151
- var p, g, w;
156
+ }, J = (e, o, u) => {
157
+ var p, b, B;
152
158
  if (!e) return;
153
- const k = c.find((o) => o.uid === t.uid);
154
- k && (k.fileName = ((p = e == null ? void 0 : e.data) == null ? void 0 : p.fileName) || t.name, k.fileKey = ((g = e == null ? void 0 : e.data) == null ? void 0 : g.fileKey) || "当前接口没有返回fileKey字段", k.fileSize = ((w = e == null ? void 0 : e.data) == null ? void 0 : w.fileSize) || t.size), r("update:fileList", c), r("onSuccess", t, c);
155
- }, se = (e, t) => {
156
- e.status === "success" && !e.response || (r("update:fileList", t), r("onChange", e, t));
157
- }, le = (e, t) => {
158
- r("update:fileList", t), r("onRemove", e, t);
159
- }, { hasRealDefaultSlot: ae, finalBeforeUpload: ie, defaultTipSlotTextInfo: K, otherSlots: ne } = Ee(i, J, Z);
160
- return (e, t) => {
161
- const c = de, k = re, p = ue, g = me, w = ce;
162
- return s(), l("div", Ue, [
163
- e.readonly ? n("", !0) : (s(), L(k, ve({
159
+ const m = u.find((t) => t.uid === o.uid);
160
+ m && (m.fileName = ((p = e == null ? void 0 : e.data) == null ? void 0 : p.fileName) || o.name, m.fileKey = ((b = e == null ? void 0 : e.data) == null ? void 0 : b.fileKey) || "当前接口没有返回fileKey字段", m.fileSize = ((B = e == null ? void 0 : e.data) == null ? void 0 : B.fileSize) || o.size), d("update:fileList", u), d("onSuccess", o, u);
161
+ }, Q = (e, o) => {
162
+ e.status === "success" && !e.response || (d("update:fileList", o), d("onChange", e, o));
163
+ }, X = (e, o) => {
164
+ d("update:fileList", o), d("onRemove", e, o);
165
+ }, { hasRealDefaultSlot: Y, finalBeforeUpload: Z, defaultTipSlotTextInfo: $, otherSlots: x } = Se(i, M, O);
166
+ return (e, o) => {
167
+ const u = te, m = oe, p = se, b = le, B = ae;
168
+ return s(), l("div", Re, [
169
+ e.readonly ? n("", !0) : (s(), k(m, ue({
164
170
  key: 0,
165
171
  class: ["ci-el-upload-component", { "is-disabled": e.disabled }],
166
172
  ref_key: "uploadRef",
167
- ref: F,
173
+ ref: D,
168
174
  action: e.action,
169
175
  data: e.data,
170
176
  headers: e.headers,
171
- "file-list": S.value,
177
+ "file-list": w.value,
172
178
  accept: e.accept,
173
179
  limit: e.limit,
174
180
  multiple: e.multiple,
175
181
  drag: e.drag,
176
182
  disabled: e.disabled,
177
- "before-upload": y(ie),
178
- "before-remove": x,
179
- "on-success": oe,
180
- "on-change": se,
181
- "on-remove": le,
182
- "on-exceed": ee,
183
- "on-error": te,
184
- "http-request": y(X),
183
+ "before-upload": f(Z),
184
+ "before-remove": W,
185
+ "on-success": J,
186
+ "on-change": Q,
187
+ "on-remove": X,
188
+ "on-exceed": j,
189
+ "on-error": G,
190
+ "http-request": f(H),
185
191
  "show-file-list": !1
186
- }, e.$attrs), ke({
187
- default: m(() => [
188
- y(ae) ? P(e.$slots, "default", { key: 0 }, void 0, !0) : (s(), l(v, { key: 1 }, [
189
- e.drag ? (s(), l(v, { key: 0 }, [
190
- t[0] || (t[0] = a("img", {
192
+ }, e.$attrs), me({
193
+ default: r(() => [
194
+ f(Y) ? U(e.$slots, "default", { key: 0 }, void 0, !0) : (s(), l(g, { key: 1 }, [
195
+ e.drag ? (s(), l(g, { key: 0 }, [
196
+ o[0] || (o[0] = a("img", {
191
197
  class: "upload-btn-icon",
192
- src: A,
198
+ src: R,
193
199
  alt: ""
194
200
  }, null, -1)),
195
- t[1] || (t[1] = a("img", {
201
+ o[1] || (o[1] = a("img", {
196
202
  class: "upload-btn-icon-hover",
197
- src: H,
203
+ src: F,
198
204
  alt: ""
199
205
  }, null, -1)),
200
- t[2] || (t[2] = a("img", {
206
+ o[2] || (o[2] = a("img", {
201
207
  class: "upload-btn-icon-disabled",
202
- src: O,
208
+ src: L,
203
209
  alt: ""
204
210
  }, null, -1)),
205
- t[3] || (t[3] = a("div", { class: "drag-text-info" }, [
211
+ o[3] || (o[3] = a("div", { class: "drag-text-info" }, [
206
212
  a("span", { class: "drag-text-info-click" }, "点击上传"),
207
213
  a("span", { class: "drag-text-info-black" }, "或将文件拖拽到这里上传")
208
214
  ], -1)),
209
- e.$slots.tip ? (s(), l("div", Ie, [
210
- P(e.$slots, "tip", {}, void 0, !0)
211
- ])) : (s(), l("div", Re, b(y(K)), 1))
212
- ], 64)) : (s(), L(c, {
215
+ e.$slots.tip ? (s(), l("div", Fe, [
216
+ U(e.$slots, "tip", {}, void 0, !0)
217
+ ])) : (s(), l("div", Le, y(f($)), 1))
218
+ ], 64)) : (s(), k(u, {
213
219
  key: 1,
214
220
  class: "upload-btn",
215
221
  disabled: e.disabled
216
222
  }, {
217
- default: m(() => [
218
- t[4] || (t[4] = a("img", {
223
+ default: r(() => [
224
+ o[4] || (o[4] = a("img", {
219
225
  class: "upload-btn-icon",
220
- src: A,
226
+ src: R,
221
227
  alt: ""
222
228
  }, null, -1)),
223
- t[5] || (t[5] = a("img", {
229
+ o[5] || (o[5] = a("img", {
224
230
  class: "upload-btn-icon-hover",
225
- src: H,
231
+ src: F,
226
232
  alt: ""
227
233
  }, null, -1)),
228
- t[6] || (t[6] = a("img", {
234
+ o[6] || (o[6] = a("img", {
229
235
  class: "upload-btn-icon-disabled",
230
- src: O,
236
+ src: L,
231
237
  alt: ""
232
238
  }, null, -1)),
233
- a("span", Ve, b(e.uploadBtnText), 1)
239
+ a("span", Te, y(e.uploadBtnText), 1)
234
240
  ]),
235
241
  _: 1,
236
242
  __: [4, 5, 6]
@@ -241,179 +247,179 @@ const Ue = { class: "CiUpload" }, Ie = {
241
247
  }, [
242
248
  e.drag ? void 0 : {
243
249
  name: "tip",
244
- fn: m(() => [
245
- e.$slots.tip ? (s(), l("div", Fe, [
246
- P(e.$slots, "tip", {}, void 0, !0)
247
- ])) : (s(), l("div", Ke, b(y(K)), 1))
250
+ fn: r(() => [
251
+ e.$slots.tip ? (s(), l("div", Ie, [
252
+ U(e.$slots, "tip", {}, void 0, !0)
253
+ ])) : (s(), l("div", Ke, y(f($)), 1))
248
254
  ]),
249
255
  key: "0"
250
256
  },
251
- M(y(ne), (o, d) => ({
252
- name: d,
253
- fn: m((h) => [
254
- P(e.$slots, d, we(he(h || {})), void 0, !0)
257
+ z(f(x), (t, c) => ({
258
+ name: c,
259
+ fn: r((ee) => [
260
+ U(e.$slots, c, pe(ce(ee || {})), void 0, !0)
255
261
  ])
256
262
  }))
257
263
  ]), 1040, ["class", "action", "data", "headers", "file-list", "accept", "limit", "multiple", "drag", "disabled", "before-upload", "http-request"])),
258
- S.value.length ? (s(), l("div", {
264
+ w.value.length ? (s(), l("div", {
259
265
  key: 1,
260
- class: $(["custom-file-list-default", { "is-readonly": e.readonly }])
266
+ class: C(["custom-file-list-default", { "is-readonly": e.readonly }])
261
267
  }, [
262
- (s(!0), l(v, null, M(S.value, (o) => (s(), l("div", {
268
+ (s(!0), l(g, null, z(w.value, (t) => (s(), l("div", {
263
269
  class: "file-item-wrapper",
264
- key: o.uid
270
+ key: t.uid
265
271
  }, [
266
- a("div", Me, [
267
- a("div", qe, [
272
+ a("div", Ve, [
273
+ a("div", Me, [
268
274
  e.showFileExtIcon ? (s(), l("img", {
269
275
  key: 0,
270
276
  class: "file-icon",
271
- src: y($e)(o.fileName || o.name)
272
- }, null, 8, Ae)) : n("", !0),
273
- e.showFileNameEllipsisTooltip ? (s(), L(g, {
277
+ src: f(_e)(t.fileName || t.name)
278
+ }, null, 8, qe)) : n("", !0),
279
+ e.showFileNameEllipsisTooltip ? (s(), k(b, {
274
280
  key: 2,
275
281
  effect: "dark",
276
- content: o.fileName || o.name,
282
+ content: t.fileName || t.name,
277
283
  placement: "right"
278
284
  }, {
279
- default: m(() => [
280
- N(p, {
281
- class: $(["top-left file-name", { "is-show-file-name-ellipsis-tooltip": e.showFileNameEllipsisTooltip }]),
282
- disabled: o.status === "downloading" || o.status === "uploading",
283
- onClick: (d) => R(o)
285
+ default: r(() => [
286
+ h(p, {
287
+ class: C(["top-left file-name", { "is-show-file-name-ellipsis-tooltip": e.showFileNameEllipsisTooltip }]),
288
+ disabled: t.status === "downloading" || t.status === "uploading",
289
+ onClick: (c) => N(t)
284
290
  }, {
285
- default: m(() => [
286
- _(b(o.fileName || o.name), 1)
291
+ default: r(() => [
292
+ v(y(t.fileName || t.name), 1)
287
293
  ]),
288
294
  _: 2
289
295
  }, 1032, ["class", "disabled", "onClick"])
290
296
  ]),
291
297
  _: 2
292
- }, 1032, ["content"])) : (s(), L(p, {
298
+ }, 1032, ["content"])) : (s(), k(p, {
293
299
  key: 1,
294
300
  class: "top-left file-name",
295
- disabled: o.status === "downloading" || o.status === "uploading",
296
- onClick: (d) => R(o)
301
+ disabled: t.status === "downloading" || t.status === "uploading",
302
+ onClick: (c) => N(t)
297
303
  }, {
298
- default: m(() => [
299
- _(b(o.fileName || o.name), 1)
304
+ default: r(() => [
305
+ v(y(t.fileName || t.name), 1)
300
306
  ]),
301
307
  _: 2
302
308
  }, 1032, ["disabled", "onClick"]))
303
309
  ]),
304
310
  a("div", He, [
305
- e.showFileSize ? (s(), l("span", Oe, b(y(U)(o.fileSize || o.size)), 1)) : n("", !0),
306
- o.status !== "fail" ? (s(), l("div", We, [
307
- o.status !== "uploading" ? (s(), l(v, { key: 0 }, [
308
- e.showPreviewBtn ? (s(), l(v, { key: 0 }, [
309
- N(p, {
310
- onClick: (d) => I(o)
311
+ e.showFileSize ? (s(), l("span", Ae, y(f(V)(t.fileSize || t.size)), 1)) : n("", !0),
312
+ t.status !== "fail" ? (s(), l("div", Oe, [
313
+ t.status !== "uploading" ? (s(), l(g, { key: 0 }, [
314
+ e.showPreviewBtn ? (s(), l(g, { key: 0 }, [
315
+ h(p, {
316
+ onClick: (c) => S(t)
311
317
  }, {
312
- default: m(() => t[7] || (t[7] = [
313
- _(" 在线预览 ")
318
+ default: r(() => o[7] || (o[7] = [
319
+ v(" 在线预览 ")
314
320
  ])),
315
321
  _: 2,
316
322
  __: [7]
317
323
  }, 1032, ["onClick"]),
318
- N(w, { direction: "vertical" })
324
+ h(B, { direction: "vertical" })
319
325
  ], 64)) : n("", !0),
320
- e.showDownloadBtn ? (s(), l(v, { key: 1 }, [
321
- N(p, {
322
- disabled: o.status === "downloading",
323
- onClick: (d) => R(o)
326
+ e.showDownloadBtn ? (s(), l(g, { key: 1 }, [
327
+ h(p, {
328
+ disabled: t.status === "downloading",
329
+ onClick: (c) => N(t)
324
330
  }, {
325
- default: m(() => [
326
- _(b(o.status === "downloading" && e.showDownloadProgress && e.customDownload ? `下载中...${o.downloadPercentage || 0}%` : "下载"), 1)
331
+ default: r(() => [
332
+ v(y(t.status === "downloading" && e.showDownloadProgress && e.customDownload ? `下载中...${t.downloadPercentage || 0}%` : "下载"), 1)
327
333
  ]),
328
334
  _: 2
329
335
  }, 1032, ["disabled", "onClick"]),
330
- e.showDeleteBtn && !e.readonly ? (s(), L(w, {
336
+ e.showDeleteBtn && !e.readonly ? (s(), k(B, {
331
337
  key: 0,
332
338
  direction: "vertical"
333
339
  })) : n("", !0)
334
340
  ], 64)) : n("", !0),
335
- e.showDeleteBtn && !e.readonly ? (s(), L(p, {
341
+ e.showDeleteBtn && !e.readonly ? (s(), k(p, {
336
342
  key: 2,
337
- onClick: (d) => I(o)
343
+ onClick: (c) => S(t)
338
344
  }, {
339
- default: m(() => t[8] || (t[8] = [
340
- _("删除")
345
+ default: r(() => o[8] || (o[8] = [
346
+ v("删除")
341
347
  ])),
342
348
  _: 2,
343
349
  __: [8]
344
350
  }, 1032, ["onClick"])) : n("", !0)
345
351
  ], 64)) : n("", !0)
346
352
  ])) : n("", !0),
347
- a("div", je, [
348
- o.status === "uploading" ? (s(), l("div", {
353
+ a("div", We, [
354
+ t.status === "uploading" ? (s(), l("div", {
349
355
  key: 0,
350
- class: $(o.status)
356
+ class: C(t.status)
351
357
  }, [
352
- t[9] || (t[9] = a("img", {
358
+ o[9] || (o[9] = a("img", {
353
359
  class: "uploading-icon",
354
- src: be
360
+ src: ge
355
361
  }, null, -1)),
356
- a("span", Ge, b(o.percentage) + "%", 1)
362
+ a("span", je, y(t.percentage) + "%", 1)
357
363
  ], 2)) : n("", !0),
358
- e.readonly ? n("", !0) : (s(), l(v, { key: 1 }, [
359
- o.status === "success" || o.status === "downloading" ? (s(), l("span", {
364
+ e.readonly ? n("", !0) : (s(), l(g, { key: 1 }, [
365
+ t.status === "success" || t.status === "downloading" ? (s(), l("span", {
360
366
  key: 0,
361
- class: $(o.status)
362
- }, t[10] || (t[10] = [
367
+ class: C(t.status)
368
+ }, o[10] || (o[10] = [
363
369
  a("img", {
364
370
  class: "success-icon",
365
- src: Be
371
+ src: ye
366
372
  }, null, -1)
367
373
  ]), 2)) : n("", !0)
368
374
  ], 64)),
369
- o.status === "fail" ? (s(), l("div", {
375
+ t.status === "fail" ? (s(), l("div", {
370
376
  key: 2,
371
- class: $(["fail-icon-wrapper", o.status])
377
+ class: C(["fail-icon-wrapper", t.status])
372
378
  }, [
373
- N(p, {
374
- onClick: (d) => I(o)
379
+ h(p, {
380
+ onClick: (c) => S(t)
375
381
  }, {
376
- default: m(() => t[11] || (t[11] = [
377
- _(" 删除 ")
382
+ default: r(() => o[11] || (o[11] = [
383
+ v(" 删除 ")
378
384
  ])),
379
385
  _: 2,
380
386
  __: [11]
381
387
  }, 1032, ["onClick"]),
382
- N(g, {
388
+ h(b, {
383
389
  effect: "dark",
384
390
  content: "点击重新上传",
385
391
  placement: "bottom"
386
392
  }, {
387
- default: m(() => [
393
+ default: r(() => [
388
394
  a("img", {
389
395
  class: "retry-icon",
390
- src: Se,
391
- onClick: (d) => y(Y)(o)
392
- }, null, 8, Je)
396
+ src: we,
397
+ onClick: (c) => f(A)(t)
398
+ }, null, 8, Ge)
393
399
  ]),
394
400
  _: 2
395
401
  }, 1024),
396
- t[12] || (t[12] = a("img", {
402
+ o[12] || (o[12] = a("img", {
397
403
  class: "fail-icon",
398
- src: Ce
404
+ src: ke
399
405
  }, null, -1))
400
406
  ], 2)) : n("", !0)
401
407
  ])
402
408
  ])
403
409
  ]),
404
- e.showUploadProgress ? (s(), l(v, { key: 0 }, [
405
- o.status === "uploading" ? (s(), l("div", Qe, [
410
+ e.showUploadProgress ? (s(), l(g, { key: 0 }, [
411
+ t.status === "uploading" ? (s(), l("div", Je, [
406
412
  a("div", {
407
413
  class: "file-progress-inner",
408
- style: q({ width: (o.percentage || 0) + "%" })
414
+ style: P({ width: (t.percentage || 0) + "%" })
409
415
  }, null, 4)
410
416
  ])) : n("", !0)
411
417
  ], 64)) : n("", !0),
412
- e.showDownloadProgress ? (s(), l(v, { key: 1 }, [
413
- o.status === "downloading" ? (s(), l("div", Xe, [
418
+ e.showDownloadProgress ? (s(), l(g, { key: 1 }, [
419
+ t.status === "downloading" ? (s(), l("div", Qe, [
414
420
  a("div", {
415
421
  class: "file-progress-inner",
416
- style: q({ width: (o.downloadPercentage || 0) + "%" })
422
+ style: P({ width: (t.downloadPercentage || 0) + "%" })
417
423
  }, null, 4)
418
424
  ])) : n("", !0)
419
425
  ], 64)) : n("", !0)
@@ -424,5 +430,5 @@ const Ue = { class: "CiUpload" }, Ie = {
424
430
  }
425
431
  });
426
432
  export {
427
- kt as default
433
+ ho as default
428
434
  };
@@ -56,7 +56,17 @@ const e = {
56
56
  // 限制上传的文件名最大长度 - 默认 0: 代表: 不限制文件名长度; 如果开发者配置的值大于0, 则就是: 文件名长度必须小于等于maxFileNameLength即可.
57
57
  maxFileNameLength: 0,
58
58
  // 限制上传的文件名最小长度 - 默认 0: 代表: 不限制文件名长度; 如果开发者配置的值大于0, 则就是: 文件名长度必须大于等于minFileNameLength即可.
59
- minFileNameLength: 0
59
+ minFileNameLength: 0,
60
+ /**
61
+ * 是否在上传前进行二次确认
62
+ * @default false
63
+ */
64
+ confirmBeforeUpload: !1,
65
+ /**
66
+ * 二次确认提示文案
67
+ * confirmBeforeUpload = true 时生效
68
+ */
69
+ confirmBeforeUploadText: "确定要上传该文件吗?"
60
70
  };
61
71
  export {
62
72
  e as defaultProps
@@ -0,0 +1,2 @@
1
+ import { UploadValidateRule } from './types';
2
+ export declare const createUploadRules: (props: any) => UploadValidateRule[];