@skyfox2000/webui 1.5.10 → 1.5.12

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 (36) hide show
  1. package/lib/assets/modules/{baseLayout-BuQjrozB.js → baseLayout-CRSIlLKU.js} +3 -3
  2. package/lib/assets/modules/file-upload-CrA5-gqr.js +211 -0
  3. package/lib/assets/modules/{index-CW_ZCHWs.js → index-CA_H2eOk.js} +1 -1
  4. package/lib/assets/modules/index-CW7dVG4Z.js +372 -0
  5. package/lib/assets/modules/index-Doi0zREW.js +114 -0
  6. package/lib/assets/modules/{menuTabs-BYSjomB7.js → menuTabs-DRoP9rnS.js} +27 -28
  7. package/lib/assets/modules/{toolIcon-D4vAp0qA.js → toolIcon-CghIoh0a.js} +1 -1
  8. package/lib/assets/modules/{upload-template-NU0Bpg4N.js → upload-template-D6r6X3vP.js} +101 -85
  9. package/lib/assets/modules/uploadList-CIGuBEpz.js +468 -0
  10. package/lib/es/AceEditor/index.js +3 -3
  11. package/lib/es/BasicLayout/index.js +2 -2
  12. package/lib/es/Error403/index.js +1 -1
  13. package/lib/es/Error404/index.js +1 -1
  14. package/lib/es/ExcelForm/index.js +196 -196
  15. package/lib/es/MenuLayout/index.js +2 -2
  16. package/lib/es/TemplateFile/index.js +4 -4
  17. package/lib/es/UploadForm/index.js +4 -4
  18. package/lib/locales/default.d.ts +15 -0
  19. package/lib/webui.css +1 -1
  20. package/lib/webui.es.js +1191 -1194
  21. package/package.json +3 -3
  22. package/src/components/content/dialog/excelForm.vue +2 -2
  23. package/src/components/form/upload/imageList.vue +0 -2
  24. package/src/components/form/upload/uploadList.vue +0 -3
  25. package/src/locales/default.ts +18 -3
  26. package/src/utils/data.ts +1 -1
  27. package/src/utils/excel-preview.ts +10 -10
  28. package/src/utils/excel-view.ts +6 -4
  29. package/src/utils/file-upload.ts +2 -2
  30. package/src/utils/micro-openapis.ts +4 -3
  31. package/src/utils/tools.ts +1 -1
  32. package/src/utils/upload-template.ts +2 -1
  33. package/lib/assets/modules/file-upload-DcusqXDb.js +0 -211
  34. package/lib/assets/modules/index-BlQB5KSU.js +0 -381
  35. package/lib/assets/modules/index-CekzHbWp.js +0 -114
  36. package/lib/assets/modules/uploadList-ENSsTfpD.js +0 -472
@@ -1,472 +0,0 @@
1
- import { defineComponent as de, ref as z, computed as I, watch as $, resolveDirective as me, createElementBlock as m, openBlock as p, normalizeClass as A, unref as n, createElementVNode as w, withDirectives as y, createCommentVNode as x, createBlock as V, mergeProps as G, withCtx as v, createVNode as d, createTextVNode as O, toDisplayString as g, Fragment as fe, renderList as he } from "vue";
2
- import { _ as H } from "./index-CW_ZCHWs.js";
3
- import { a as R, _ as K } from "./toolIcon-D4vAp0qA.js";
4
- import { httpPost as N, ResStatus as j } from "@skyfox2000/fapi";
5
- import { L as X, u as Y, $ as a, v as we, _ as ve } from "./upload-template-NU0Bpg4N.js";
6
- import C from "vue-m-message";
7
- import { Upload as J, Tag as be, Popconfirm as ye, Progress as xe } from "ant-design-vue";
8
- import { U as r, f as _e, p as W } from "./file-upload-DcusqXDb.js";
9
- import { combineParams as Z } from "@skyfox2000/microbase";
10
- import "async-validator";
11
- import "dayjs";
12
- import "vue-draggable-next";
13
- import { _ as Ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
14
- const Ue = (c, U) => {
15
- const t = document.createElement("a"), f = URL.createObjectURL(c);
16
- t.href = f, t.download = U, t.style.display = "none", document.body.appendChild(t), t.click(), URL.revokeObjectURL(f), document.body.removeChild(t);
17
- }, Fe = (c, U, t) => {
18
- try {
19
- t && (c.api || (c.api = t.api), c.authorize === void 0 && (c.authorize = t.authorize));
20
- const f = Z(c.params, U);
21
- return N(c, f).then((u) => {
22
- if ((u == null ? void 0 : u.status) === j.SUCCESS && u.data) {
23
- const l = u.data, F = l.Content, L = l.Key.split("/").pop(), k = atob(F), P = [];
24
- for (let E = 0; E < k.length; E++)
25
- P.push(k.charCodeAt(E));
26
- const _ = new Blob([new Uint8Array(P)], {
27
- type: l.Type
28
- });
29
- Ue(_, L);
30
- } else if ((u == null ? void 0 : u.errno) == X) {
31
- Y().logout(!1);
32
- return;
33
- } else
34
- C.error(a("webui.utils.download.downloadFailed"));
35
- });
36
- } catch (f) {
37
- console.error("下载失败:", f), C.error(a("webui.utils.download.fileDownloadFailedRetry"));
38
- }
39
- }, ke = ["xlsx", "xls", "csv", "txt"], Se = (c, U, t) => {
40
- const f = U.split(".").pop();
41
- if (ke.includes(f))
42
- console.log(c);
43
- else
44
- return C.error(a("webui.utils.download.fileTypeNotSupported")), !1;
45
- const u = Z(c.params, t);
46
- return N(c, u).then((l) => {
47
- if ((l == null ? void 0 : l.status) === j.SUCCESS && l.data) {
48
- const L = l.data.Content, k = atob(L), P = [];
49
- for (let _ = 0; _ < k.length; _++)
50
- P.push(k.charCodeAt(_));
51
- } else if ((l == null ? void 0 : l.errno) == X) {
52
- Y().logout(!1);
53
- return;
54
- } else
55
- C.error(a("webui.utils.download.previewFailed"));
56
- });
57
- }, ge = { class: "flex items-center justify-between w-full" }, Pe = { class: "w-35 mx-3 flex gap-2" }, Ee = { class: "mt-4 px-3" }, Oe = { class: "flex items-center justify-between" }, Le = { class: "flex items-center" }, Te = ["title"], ze = { class: "flex items-center" }, Ae = {
58
- key: 0,
59
- class: "mr-2"
60
- }, Be = {
61
- key: 1,
62
- class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
63
- }, Re = ["onClick"], Ie = {
64
- key: 2,
65
- class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
66
- }, $e = ["onClick"], Ke = {
67
- key: 3,
68
- class: "flex items-center text-red-500 hover:text-red-700 cursor-pointer"
69
- }, Ne = ["onClick"], je = {
70
- key: 0,
71
- class: "text-sm text-nowrap"
72
- }, De = { key: 0 }, Me = /* @__PURE__ */ de({
73
- __name: "uploadList",
74
- props: {
75
- autoUpload: { type: Boolean, default: !1 },
76
- uploadUrl: {},
77
- downloadUrl: {},
78
- previewUrl: {},
79
- deleteUrl: {},
80
- fileList: { default: () => [] },
81
- placeholder: { default: "" },
82
- fileExt: {},
83
- maxFileSize: { default: 20 },
84
- maxCount: { default: 5 },
85
- maxCountTip: { type: Boolean, default: !1 },
86
- maxFileSizeTip: { type: Boolean, default: !0 },
87
- fileExtTip: { type: Boolean, default: !0 },
88
- parentPath: {},
89
- showActionText: { type: Boolean, default: !0 },
90
- showOnlineSwitch: { type: Boolean, default: !1 },
91
- showDelete: { type: Boolean, default: !0 },
92
- showFolderUpload: { type: Boolean, default: !1 }
93
- },
94
- emits: ["update:file-list"],
95
- setup(c, { emit: U }) {
96
- const t = c, f = we(), { errInfo: u } = f, l = z(t.fileList), F = z([]), L = z(), k = z(), P = U, _ = I(() => {
97
- var e;
98
- return (e = t.fileExt) != null && e.length ? t.fileExt.map((o) => `.${o}`).join(",") : "";
99
- }), E = (e) => {
100
- var o;
101
- if (t.fileExt && t.fileExt.length > 0) {
102
- const s = ((o = e.name.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "";
103
- if (!t.fileExt.includes(s))
104
- return C.error(a("webui.components.form.upload.unsupportedFileType")), !1;
105
- }
106
- return e.size / 1024 / 1024 > t.maxFileSize ? (C.error(a("webui.components.form.upload.fileSizeExceeded", [t.maxFileSize])), !1) : !0;
107
- }, ee = () => t.maxCount > 1 && l.value.length >= t.maxCount, te = (e) => {
108
- const o = e;
109
- o.params || (o.params = {});
110
- let s = o.name;
111
- return o.webkitRelativePath && (s = o.webkitRelativePath), o.webkitRelativePath && (o.name = o.webkitRelativePath, o.fileName = o.webkitRelativePath.split("/").pop()), o.params.FileKey = o.name, t.parentPath && (o.params.FileKey = W.join("/", t.parentPath, o.name)), o.status = r.Pending, o.webkitRelativePath && (o.relativePath = s), o;
112
- }, oe = (e) => E(e) && t.autoUpload, D = async (e) => {
113
- if (e.length === 0) return;
114
- const o = [...l.value];
115
- let s = !1;
116
- for (const T of e) {
117
- if (!E(T)) {
118
- s = !0;
119
- continue;
120
- }
121
- const S = te(T);
122
- if (t.maxCount === 1) {
123
- o.length = 0, o.push(S);
124
- break;
125
- }
126
- if (ee()) {
127
- C.error(a("webui.components.form.upload.maxFileCount", [t.maxCount])), s = !0;
128
- break;
129
- }
130
- const i = o.findIndex(
131
- (h) => h.name === S.name
132
- );
133
- i > -1 ? o[i] = S : o.push(S);
134
- }
135
- (!s || o.length > 0) && (l.value = o), F.value = [];
136
- }, ne = (e) => {
137
- F.value = e, D(e);
138
- }, ie = I(() => ({
139
- accept: _.value,
140
- multiple: t.maxCount !== 1,
141
- fileList: F.value,
142
- "onUpdate:fileList": ne,
143
- beforeUpload: oe,
144
- listType: "text",
145
- showUploadList: !1,
146
- customRequest: async () => {
147
- if (t.autoUpload && t.uploadUrl)
148
- for (const e of l.value)
149
- e.percent === 0 && e.status === r.Pending && await _e(t.uploadUrl, e);
150
- }
151
- })), ae = I(() => ({
152
- accept: _.value,
153
- multiple: !0,
154
- directory: !0,
155
- // 添加标准属性
156
- webkitdirectory: !0,
157
- // Webkit属性
158
- fileList: [],
159
- "onUpdate:fileList": (e) => D(e),
160
- beforeUpload: () => !1,
161
- listType: "text",
162
- showUploadList: !1,
163
- customRequest: () => {
164
- }
165
- }));
166
- $(
167
- () => t.fileList,
168
- (e) => {
169
- l.value = e;
170
- },
171
- { deep: !0, immediate: !0 }
172
- ), $(
173
- () => l.value,
174
- (e) => {
175
- P("update:file-list", e);
176
- },
177
- { deep: !0 }
178
- ), $(
179
- () => t.parentPath,
180
- (e) => {
181
- e && l.value.forEach((o) => {
182
- o.params.FileKey = W.join("/", e, o.fileName);
183
- });
184
- }
185
- );
186
- const M = (e) => {
187
- const o = l.value[e].minioFile, s = {
188
- api: t.downloadUrl.api,
189
- authorize: t.downloadUrl.authorize,
190
- url: t.downloadUrl.url,
191
- params: {
192
- Query: {
193
- FileKey: o.Key
194
- }
195
- }
196
- };
197
- Fe(s);
198
- }, le = (e) => {
199
- e.minioFile && (e.minioFile.Status = e.status);
200
- }, q = (e) => {
201
- const o = l.value[e].minioFile, s = {
202
- api: t.previewUrl.api,
203
- authorize: t.previewUrl.authorize,
204
- url: t.previewUrl.url,
205
- params: {
206
- Query: {
207
- FileKey: o.Key
208
- }
209
- }
210
- };
211
- Se(s, o.FileName);
212
- }, Q = (e) => {
213
- const o = l.value[e];
214
- t.deleteUrl && o.minioFile && o.minioFile.Key ? N(t.deleteUrl, {
215
- Query: {
216
- FileKey: o.minioFile.Key
217
- }
218
- }).then((s) => {
219
- s && s.status === j.SUCCESS && (C.success(a("webui.components.form.upload.deleteSuccess")), l.value.splice(e, 1));
220
- }) : l.value.splice(e, 1), B.value = -1;
221
- }, B = z(-1), se = (e, o) => {
222
- if (B.value = e, o === r.Pending) {
223
- Q(e);
224
- return;
225
- }
226
- }, re = (e) => e === B.value, ue = () => {
227
- const e = t.fileExt && t.fileExt.length && t.fileExtTip ? a("webui.components.form.upload.fileTypeRequired", [t.fileExt.join("/")]) : "", o = t.maxFileSize !== 0 && t.maxFileSizeTip ? a("webui.components.form.upload.singleFileMax", [t.maxFileSize]) : "", s = t.maxCount !== 0 && t.maxCountTip ? a("webui.components.form.upload.maxFiles", [t.maxCount]) : "";
228
- return [o, e, s].filter(Boolean).join(",");
229
- }, ce = (e) => {
230
- switch (e) {
231
- case r.Uploading:
232
- return "blue";
233
- case r.Success:
234
- return "green";
235
- case r.Error:
236
- return "red";
237
- case r.Online:
238
- return "green";
239
- case r.Offline:
240
- return "pink";
241
- default:
242
- return "cyan";
243
- }
244
- }, pe = (e) => {
245
- switch (e) {
246
- case r.Uploading:
247
- return a("webui.components.form.upload.uploading");
248
- case r.Success:
249
- return a("webui.components.form.upload.uploadComplete");
250
- case r.Error:
251
- return a("webui.components.form.upload.uploadFailed");
252
- case r.Online:
253
- return a("webui.common.online");
254
- case r.Offline:
255
- return a("webui.common.offline");
256
- default:
257
- return a("webui.components.form.upload.pendingUpload");
258
- }
259
- };
260
- return (e, o) => {
261
- var T, S;
262
- const s = me("auth");
263
- return p(), m("div", {
264
- class: A(["w-full border border-solid border-gray-100 mt-1 rounded-md py-5", [(T = n(u)) == null ? void 0 : T.errClass]])
265
- }, [
266
- w("div", ge, [
267
- w("div", Pe, [
268
- y((p(), V(n(J), G({
269
- ref_key: "fileUploader",
270
- ref: L
271
- }, ie.value), {
272
- default: v(() => {
273
- var i;
274
- return [
275
- d(n(H), {
276
- class: A([((i = n(u)) == null ? void 0 : i.errClass) + "-text"])
277
- }, {
278
- default: v(() => [
279
- O(g(n(a)("webui.components.form.upload.selectFile")), 1)
280
- ]),
281
- _: 1
282
- }, 8, ["class"])
283
- ];
284
- }),
285
- _: 1
286
- }, 16)), [
287
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:upload" }]
288
- ]),
289
- e.showFolderUpload ? y((p(), V(n(J), G({
290
- key: 0,
291
- ref_key: "fileFolderUploader",
292
- ref: k,
293
- webkitdirectory: !0,
294
- directory: !0
295
- }, ae.value), {
296
- default: v(() => {
297
- var i;
298
- return [
299
- d(n(H), {
300
- class: A([((i = n(u)) == null ? void 0 : i.errClass) + "-text"])
301
- }, {
302
- default: v(() => [
303
- O(g(n(a)("webui.components.form.upload.selectDirectory")), 1)
304
- ]),
305
- _: 1
306
- }, 8, ["class"])
307
- ];
308
- }),
309
- _: 1
310
- }, 16)), [
311
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:upload" }]
312
- ]) : x("", !0)
313
- ]),
314
- w("div", {
315
- class: A(["flex-1 text-sm text-gray-500", [((S = n(u)) == null ? void 0 : S.errClass) + "-text"]])
316
- }, g(ue()), 3)
317
- ]),
318
- w("div", Ee, [
319
- (p(!0), m(fe, null, he(l.value, (i, h) => (p(), m("div", {
320
- key: (t.parentPath || "") + (i.relativePath || i.name || h),
321
- class: "mb-2 pb-1"
322
- }, [
323
- w("div", Oe, [
324
- w("div", Le, [
325
- w("span", {
326
- class: A(["text-gray-700 mr-2", [i.status == n(r).Offline ? "line-through" : ""]]),
327
- title: i.relativePath || i.fileName || i.name
328
- }, g(i.fileName ?? i.name), 11, Te),
329
- w("span", null, [
330
- d(n(be), {
331
- color: ce(i.status)
332
- }, {
333
- default: v(() => [
334
- O(g(pe(i.status)), 1)
335
- ]),
336
- _: 2
337
- }, 1032, ["color"])
338
- ])
339
- ]),
340
- w("div", ze, [
341
- e.showOnlineSwitch && (i.status == n(r).Online || i.status == n(r).Offline) ? (p(), m("div", Ae, [
342
- d(n(R), {
343
- title: n(a)("webui.components.form.upload.onlineOrOffline")
344
- }, {
345
- default: v(() => [
346
- y(d(n(ve), {
347
- checked: i.status,
348
- "onUpdate:checked": (b) => i.status = b,
349
- data: [
350
- { label: n(a)("webui.common.online"), value: n(r).Online },
351
- { label: n(a)("webui.common.offline"), value: n(r).Offline }
352
- ],
353
- onChange: (b) => le(i)
354
- }, null, 8, ["checked", "onUpdate:checked", "data", "onChange"]), [
355
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:online" }]
356
- ])
357
- ]),
358
- _: 2
359
- }, 1032, ["title"])
360
- ])) : x("", !0),
361
- e.downloadUrl && (i.status == n(r).Online || i.status == n(r).Offline) ? (p(), m("div", Be, [
362
- d(n(R), {
363
- title: n(a)("webui.common.download")
364
- }, {
365
- default: v(() => [
366
- y(d(n(K), {
367
- icon: "icon-download",
368
- clickable: "",
369
- onClick: (b) => M(h)
370
- }, null, 8, ["onClick"]), [
371
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
372
- ]),
373
- e.showActionText ? y((p(), m("span", {
374
- key: 0,
375
- class: "mr-2 text-sm text-nowrap",
376
- onClick: (b) => M(h)
377
- }, o[1] || (o[1] = [
378
- O("下载")
379
- ]), 8, Re)), [
380
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
381
- ]) : x("", !0)
382
- ]),
383
- _: 2
384
- }, 1032, ["title"])
385
- ])) : x("", !0),
386
- e.previewUrl && (i.status == n(r).Online || i.status == n(r).Offline) ? (p(), m("div", Ie, [
387
- d(n(R), {
388
- title: n(a)("webui.common.preview")
389
- }, {
390
- default: v(() => [
391
- y(d(n(K), {
392
- icon: "icon-eye",
393
- clickable: "",
394
- onClick: (b) => q(h)
395
- }, null, 8, ["onClick"]), [
396
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:preview" }]
397
- ]),
398
- e.showActionText ? y((p(), m("span", {
399
- key: 0,
400
- class: "mr-2 text-sm text-nowrap",
401
- onClick: (b) => q(h)
402
- }, [
403
- O(g(n(a)("webui.common.preview")), 1)
404
- ], 8, $e)), [
405
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:preview" }]
406
- ]) : x("", !0)
407
- ]),
408
- _: 2
409
- }, 1032, ["title"])
410
- ])) : x("", !0),
411
- e.showDelete !== !1 ? (p(), m("div", Ke, [
412
- d(n(ye), {
413
- open: re(h),
414
- cancelText: n(a)("webui.common.no"),
415
- okText: n(a)("webui.common.yes"),
416
- title: n(a)("webui.components.form.upload.deleteConfirm"),
417
- okButtonProps: { size: "small" },
418
- cancelButtonProps: { size: "small" },
419
- onConfirm: (b) => Q(h),
420
- onCancel: o[0] || (o[0] = (b) => B.value = -1)
421
- }, {
422
- default: v(() => [
423
- d(n(R), {
424
- title: n(a)("webui.common.delete")
425
- }, {
426
- default: v(() => [
427
- w("div", {
428
- onClick: (b) => se(h, i.status)
429
- }, [
430
- y(d(n(K), {
431
- icon: "icon-new",
432
- angle: 45,
433
- clickable: ""
434
- }, null, 512), [
435
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
436
- ]),
437
- e.showActionText ? y((p(), m("span", je, [
438
- O(g(n(a)("webui.common.delete")), 1)
439
- ])), [
440
- [s, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
441
- ]) : x("", !0)
442
- ], 8, Ne)
443
- ]),
444
- _: 2
445
- }, 1032, ["title"])
446
- ]),
447
- _: 2
448
- }, 1032, ["open", "cancelText", "okText", "title", "onConfirm"])
449
- ])) : x("", !0)
450
- ])
451
- ]),
452
- i.status !== n(r).Online && i.status !== n(r).Offline && i.status !== n(r).Success ? (p(), m("div", De, [
453
- d(n(xe), {
454
- percent: i.percent,
455
- "stroke-width": 2,
456
- "show-info": !1,
457
- style: { height: "2px" }
458
- }, null, 8, ["percent"])
459
- ])) : x("", !0)
460
- ]))), 128))
461
- ])
462
- ], 2);
463
- };
464
- }
465
- }), nt = /* @__PURE__ */ Ce(Me, [["__scopeId", "data-v-139a3807"]]);
466
- export {
467
- ke as C,
468
- nt as U,
469
- Fe as a,
470
- Ue as d,
471
- Se as p
472
- };