@skyfox2000/webui 1.4.19 → 1.4.22

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 (46) hide show
  1. package/lib/assets/modules/{baseLayout-D3_NxEzk.js → baseLayout-BcSEYvus.js} +3 -3
  2. package/lib/assets/modules/{file-upload-CNBcbAAZ.js → file-upload-D11e2io7.js} +5 -5
  3. package/lib/assets/modules/{index-CDr74akE.js → index-CO9_YadW.js} +2 -2
  4. package/lib/assets/modules/{index-D14BsF7C.js → index-ClMWx3tg.js} +1 -1
  5. package/lib/assets/modules/{index-DOlO_4KL.js → index-voAmrZ30.js} +2 -2
  6. package/lib/assets/modules/{menuTabs-CqAhoF--.js → menuTabs-C9wkt-m9.js} +16 -16
  7. package/lib/assets/modules/{toolIcon-BnkqBipR.js → toolIcon-9zQ4jiFD.js} +1 -1
  8. package/lib/assets/modules/{upload-template-KI-IFzyp.js → upload-template-CM0O990W.js} +395 -378
  9. package/lib/assets/modules/uploadList-DhkFSkqE.js +466 -0
  10. package/lib/components/content/index.d.ts +4 -0
  11. package/lib/components/content/list/index.vue.d.ts +126 -0
  12. package/lib/components/content/list/listOperate.vue.d.ts +18 -0
  13. package/lib/components/form/index.d.ts +2 -0
  14. package/lib/components/form/switch/index.vue.d.ts +11 -1
  15. package/lib/components/form/upload/imageList.vue.d.ts +486 -0
  16. package/lib/components/form/upload/uploadList.vue.d.ts +449 -1
  17. package/lib/components/index.d.ts +2 -2
  18. package/lib/const/options.d.ts +4 -2
  19. package/lib/es/AceEditor/index.js +3 -3
  20. package/lib/es/BasicLayout/index.js +2 -2
  21. package/lib/es/Error403/index.js +1 -1
  22. package/lib/es/Error404/index.js +1 -1
  23. package/lib/es/ExcelForm/index.js +5 -5
  24. package/lib/es/MenuLayout/index.js +2 -2
  25. package/lib/es/TemplateFile/index.js +4 -4
  26. package/lib/es/UploadForm/index.js +70 -56
  27. package/lib/index.d.ts +1 -1
  28. package/lib/typings/upload.d.ts +10 -0
  29. package/lib/webui.css +1 -1
  30. package/lib/webui.es.js +1671 -1207
  31. package/package.json +1 -1
  32. package/src/components/content/dialog/uploadForm.vue +96 -13
  33. package/src/components/content/index.ts +5 -0
  34. package/src/components/content/list/index.vue +198 -0
  35. package/src/components/content/list/listOperate.vue +122 -0
  36. package/src/components/content/table/index.vue +1 -1
  37. package/src/components/content/table/tableOperate.vue +19 -37
  38. package/src/components/form/index.ts +3 -0
  39. package/src/components/form/switch/index.vue +27 -14
  40. package/src/components/form/upload/imageList.vue +386 -0
  41. package/src/components/form/upload/uploadList.vue +46 -3
  42. package/src/components/index.ts +3 -0
  43. package/src/const/options.ts +11 -1
  44. package/src/index.ts +3 -0
  45. package/src/typings/upload.d.ts +10 -0
  46. package/lib/assets/modules/uploadList-DnFXg_B3.js +0 -423
@@ -1,423 +0,0 @@
1
- import { defineComponent as ae, ref as P, computed as D, watch as B, resolveDirective as ie, createElementBlock as d, openBlock as u, normalizeClass as $, unref as n, createElementVNode as h, withDirectives as y, createBlock as re, mergeProps as le, withCtx as w, createVNode as p, createTextVNode as z, toDisplayString as T, Fragment as ce, renderList as ue, createCommentVNode as C } from "vue";
2
- import { _ as pe } from "./index-D14BsF7C.js";
3
- import { a as A, _ as I } from "./toolIcon-BnkqBipR.js";
4
- import { httpPost as K, ResStatus as j } from "@skyfox2000/fapi";
5
- import { L as V, u as q, v as de, _ as me } from "./upload-template-KI-IFzyp.js";
6
- import { U as i, f as fe, p as Q } from "./file-upload-CNBcbAAZ.js";
7
- import { combineParams as G } from "@skyfox2000/microbase";
8
- import _ from "vue-m-message";
9
- import "async-validator";
10
- import "dayjs";
11
- import { Upload as he, Tag as ve, Popconfirm as xe, Progress as ye } from "ant-design-vue";
12
- import "vue-draggable-next";
13
- import { _ as we } from "./_plugin-vue_export-helper-CHgC5LLL.js";
14
- const Ce = (l, U) => {
15
- const t = document.createElement("a"), m = URL.createObjectURL(l);
16
- t.href = m, t.download = U, t.style.display = "none", document.body.appendChild(t), t.click(), URL.revokeObjectURL(m), document.body.removeChild(t);
17
- }, _e = (l, U, t) => {
18
- try {
19
- t && (l.api || (l.api = t.api), l.authorize === void 0 && (l.authorize = t.authorize));
20
- const m = G(l.params, U);
21
- return K(l, m).then((c) => {
22
- if ((c == null ? void 0 : c.status) === j.SUCCESS && c.data) {
23
- const s = c.data, S = s.Content, F = s.Key.split("/").pop(), g = atob(S), k = [];
24
- for (let E = 0; E < g.length; E++)
25
- k.push(g.charCodeAt(E));
26
- const x = new Blob([new Uint8Array(k)], {
27
- type: s.Type
28
- });
29
- Ce(x, F);
30
- } else if ((c == null ? void 0 : c.errno) == V) {
31
- q().logout(!1);
32
- return;
33
- } else
34
- _.error("下载文件失败!");
35
- });
36
- } catch (m) {
37
- console.error("下载失败:", m), _.error("文件下载失败,请稍后重试");
38
- }
39
- }, Ue = ["xlsx", "xls", "csv", "txt"], Se = (l, U, t) => {
40
- const m = U.split(".").pop();
41
- if (Ue.includes(m))
42
- console.log(l);
43
- else
44
- return _.error("文件类型不支持预览"), !1;
45
- const c = G(l.params, t);
46
- return K(l, c).then((s) => {
47
- if ((s == null ? void 0 : s.status) === j.SUCCESS && s.data) {
48
- const F = s.data.Content, g = atob(F), k = [];
49
- for (let x = 0; x < g.length; x++)
50
- k.push(g.charCodeAt(x));
51
- } else if ((s == null ? void 0 : s.errno) == V) {
52
- q().logout(!1);
53
- return;
54
- } else
55
- _.error("文件预览失败!");
56
- });
57
- }, ge = { class: "flex items-center justify-between w-full" }, be = { class: "w-35 mx-3" }, ke = { class: "mt-4 px-3" }, Fe = { class: "flex items-center justify-between" }, Ee = { class: "flex items-center" }, Oe = { class: "flex items-center" }, ze = {
58
- key: 0,
59
- class: "mr-2"
60
- }, Le = {
61
- key: 1,
62
- class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
63
- }, Pe = ["onClick"], $e = {
64
- key: 2,
65
- class: "flex items-center text-blue-500 hover:text-blue-700 mr-1 cursor-pointer"
66
- }, Ae = ["onClick"], Be = {
67
- key: 3,
68
- class: "flex items-center text-red-500 hover:text-red-700 cursor-pointer"
69
- }, Te = ["onClick"], Ie = {
70
- key: 0,
71
- class: "text-sm text-nowrap"
72
- }, Ke = { key: 0 }, je = /* @__PURE__ */ ae({
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
- },
93
- emits: ["update:file-list"],
94
- setup(l, { emit: U }) {
95
- const t = l, m = de(), { errInfo: c } = m, s = P(t.fileList), S = P([]), F = P(), g = U, k = D(() => {
96
- var e;
97
- return (e = t.fileExt) != null && e.length ? t.fileExt.map((o) => `.${o}`).join(",") : "";
98
- }), x = (e) => {
99
- var o;
100
- if (t.fileExt && t.fileExt.length > 0) {
101
- const r = ((o = e.name.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "";
102
- if (!t.fileExt.includes(r))
103
- return _.error("文件类型不支持"), !1;
104
- }
105
- return e.size / 1024 / 1024 > t.maxFileSize ? (_.error(`文件大小超过 ${t.maxFileSize}MB 限制`), !1) : !0;
106
- }, E = () => t.maxCount > 1 && s.value.length >= t.maxCount, H = (e) => {
107
- const o = e;
108
- return o.params || (o.params = {}), o.params.FileKey = o.name, t.parentPath && (o.params.FileKey = Q.join("/", t.parentPath, o.name)), o.status = i.Pending, o;
109
- }, J = (e) => x(e) && t.autoUpload, W = async (e) => {
110
- if (e.length === 0) return;
111
- const o = [...s.value];
112
- let r = !1;
113
- for (const O of e) {
114
- if (!x(O)) {
115
- r = !0;
116
- continue;
117
- }
118
- const b = H(O);
119
- if (t.maxCount === 1) {
120
- o.length = 0, o.push(b);
121
- break;
122
- }
123
- if (E()) {
124
- _.error(`最多上传 ${t.maxCount} 个文件`), r = !0;
125
- break;
126
- }
127
- const a = o.findIndex(
128
- (f) => f.name === b.name
129
- );
130
- a > -1 ? o[a] = b : o.push(b);
131
- }
132
- (!r || o.length > 0) && (s.value = o), S.value = [];
133
- }, X = (e) => {
134
- S.value = e, W(e);
135
- }, Y = D(() => ({
136
- accept: k.value,
137
- multiple: t.maxCount !== 1,
138
- fileList: S.value,
139
- "onUpdate:fileList": X,
140
- beforeUpload: J,
141
- listType: "text",
142
- showUploadList: !1,
143
- customRequest: async () => {
144
- if (t.autoUpload && t.uploadUrl)
145
- for (const e of s.value)
146
- e.percent === 0 && e.status === i.Pending && await fe(t.uploadUrl, e);
147
- }
148
- }));
149
- B(
150
- () => t.fileList,
151
- (e) => {
152
- s.value = e;
153
- },
154
- { deep: !0, immediate: !0 }
155
- ), B(
156
- () => s.value,
157
- (e) => {
158
- g("update:file-list", e);
159
- },
160
- { deep: !0 }
161
- ), B(
162
- () => t.parentPath,
163
- (e) => {
164
- e && s.value.forEach((o) => {
165
- o.params.FileKey = Q.join("/", e, o.fileName);
166
- });
167
- }
168
- );
169
- const M = (e) => {
170
- const o = s.value[e].minioFile, r = {
171
- api: t.downloadUrl.api,
172
- authorize: t.downloadUrl.authorize,
173
- url: t.downloadUrl.url,
174
- params: {
175
- Query: {
176
- FileKey: o.Key
177
- }
178
- }
179
- };
180
- _e(r);
181
- }, Z = (e) => {
182
- e.minioFile && (e.minioFile.Status = e.status);
183
- }, N = (e) => {
184
- const o = s.value[e].minioFile, r = {
185
- api: t.previewUrl.api,
186
- authorize: t.previewUrl.authorize,
187
- url: t.previewUrl.url,
188
- params: {
189
- Query: {
190
- FileKey: o.Key
191
- }
192
- }
193
- };
194
- Se(r, o.FileName);
195
- }, R = (e) => {
196
- const o = s.value[e];
197
- t.deleteUrl && o.minioFile && o.minioFile.Key ? K(t.deleteUrl, {
198
- Query: {
199
- FileKey: o.minioFile.Key
200
- }
201
- }).then((r) => {
202
- r && r.status === j.SUCCESS && (_.success("删除文件成功!"), s.value.splice(e, 1));
203
- }) : s.value.splice(e, 1), L.value = -1;
204
- }, L = P(-1), ee = (e, o) => {
205
- if (L.value = e, o === i.Pending) {
206
- R(e);
207
- return;
208
- }
209
- }, te = (e) => e === L.value, oe = () => {
210
- const e = t.fileExt && t.fileExt.length && t.fileExtTip ? `文件必须为 ${t.fileExt.join("/")}` : "", o = t.maxFileSize !== 0 && t.maxFileSizeTip ? `单文件最大 ${t.maxFileSize}MB` : "", r = t.maxCount !== 0 && t.maxCountTip ? `最多 ${t.maxCount} 个文件` : "";
211
- return [o, e, r].filter(Boolean).join(",");
212
- }, ne = (e) => {
213
- switch (e) {
214
- case i.Uploading:
215
- return "blue";
216
- case i.Success:
217
- return "green";
218
- case i.Error:
219
- return "red";
220
- case i.Online:
221
- return "green";
222
- case i.Offline:
223
- return "pink";
224
- default:
225
- return "cyan";
226
- }
227
- }, se = (e) => {
228
- switch (e) {
229
- case i.Uploading:
230
- return "上传中";
231
- case i.Success:
232
- return "上传完成";
233
- case i.Error:
234
- return "上传失败";
235
- case i.Online:
236
- return "在线";
237
- case i.Offline:
238
- return "已下线";
239
- default:
240
- return "待上传";
241
- }
242
- };
243
- return (e, o) => {
244
- var O, b;
245
- const r = ie("auth");
246
- return u(), d("div", {
247
- class: $(["w-full border border-solid border-gray-100 mt-1 rounded-md py-5", [(O = n(c)) == null ? void 0 : O.errClass]])
248
- }, [
249
- h("div", ge, [
250
- h("div", be, [
251
- y((u(), re(n(he), le({
252
- ref_key: "fileUploader",
253
- ref: F
254
- }, Y.value), {
255
- default: w(() => {
256
- var a;
257
- return [
258
- p(n(pe), {
259
- class: $([((a = n(c)) == null ? void 0 : a.errClass) + "-text"])
260
- }, {
261
- default: w(() => o[1] || (o[1] = [
262
- z("选择文件")
263
- ])),
264
- _: 1,
265
- __: [1]
266
- }, 8, ["class"])
267
- ];
268
- }),
269
- _: 1
270
- }, 16)), [
271
- [r, { role: ["Super", "Admin"], permit: ":uploadlist:upload" }]
272
- ])
273
- ]),
274
- h("div", {
275
- class: $(["flex-1 text-sm text-gray-500", [((b = n(c)) == null ? void 0 : b.errClass) + "-text"]])
276
- }, T(oe()), 3)
277
- ]),
278
- h("div", ke, [
279
- (u(!0), d(ce, null, ue(s.value, (a, f) => (u(), d("div", {
280
- key: f,
281
- class: "mb-2 pb-1"
282
- }, [
283
- h("div", Fe, [
284
- h("div", Ee, [
285
- h("span", {
286
- class: $(["text-gray-700 mr-2", [a.status == n(i).Offline ? "line-through" : ""]])
287
- }, T(a.fileName ?? a.name), 3),
288
- h("span", null, [
289
- p(n(ve), {
290
- color: ne(a.status)
291
- }, {
292
- default: w(() => [
293
- z(T(se(a.status)), 1)
294
- ]),
295
- _: 2
296
- }, 1032, ["color"])
297
- ])
298
- ]),
299
- h("div", Oe, [
300
- e.showOnlineSwitch && (a.status == n(i).Online || a.status == n(i).Offline) ? (u(), d("div", ze, [
301
- p(n(A), { title: "上线或下线" }, {
302
- default: w(() => [
303
- y(p(n(me), {
304
- checked: a.status,
305
- "onUpdate:checked": (v) => a.status = v,
306
- data: [
307
- { label: "上线", value: n(i).Online },
308
- { label: "下线", value: n(i).Offline }
309
- ],
310
- onChange: (v) => Z(a)
311
- }, null, 8, ["checked", "onUpdate:checked", "data", "onChange"]), [
312
- [r, { role: ["Super", "Admin"], permit: ":uploadlist:online" }]
313
- ])
314
- ]),
315
- _: 2
316
- }, 1024)
317
- ])) : C("", !0),
318
- e.downloadUrl && (a.status == n(i).Online || a.status == n(i).Offline) ? (u(), d("div", Le, [
319
- p(n(A), { title: "下载" }, {
320
- default: w(() => [
321
- y(p(n(I), {
322
- icon: "icon-download",
323
- clickable: "",
324
- onClick: (v) => M(f)
325
- }, null, 8, ["onClick"]), [
326
- [r, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
327
- ]),
328
- e.showActionText ? y((u(), d("span", {
329
- key: 0,
330
- class: "mr-2 text-sm text-nowrap",
331
- onClick: (v) => M(f)
332
- }, o[2] || (o[2] = [
333
- z("下载")
334
- ]), 8, Pe)), [
335
- [r, { role: ["Super", "Admin"], permit: ":uploadlist:download" }]
336
- ]) : C("", !0)
337
- ]),
338
- _: 2
339
- }, 1024)
340
- ])) : C("", !0),
341
- e.previewUrl && (a.status == n(i).Online || a.status == n(i).Offline) ? (u(), d("div", $e, [
342
- p(n(A), { title: "预览" }, {
343
- default: w(() => [
344
- y(p(n(I), {
345
- icon: "icon-eye",
346
- clickable: "",
347
- onClick: (v) => N(f)
348
- }, null, 8, ["onClick"]), [
349
- [r, { role: ["Super", "Admin"], permit: ":uploadlist:preview" }]
350
- ]),
351
- e.showActionText ? y((u(), d("span", {
352
- key: 0,
353
- class: "mr-2 text-sm text-nowrap",
354
- onClick: (v) => N(f)
355
- }, o[3] || (o[3] = [
356
- z("预览")
357
- ]), 8, Ae)), [
358
- [r, { role: ["Super", "Admin"], permit: ":uploadlist:preview" }]
359
- ]) : C("", !0)
360
- ]),
361
- _: 2
362
- }, 1024)
363
- ])) : C("", !0),
364
- e.showDelete !== !1 ? (u(), d("div", Be, [
365
- p(n(xe), {
366
- open: te(f),
367
- cancelText: "否",
368
- okText: "是",
369
- title: "确定删除该文件吗?",
370
- okButtonProps: { size: "small" },
371
- cancelButtonProps: { size: "small" },
372
- onConfirm: (v) => R(f),
373
- onCancel: o[0] || (o[0] = (v) => L.value = -1)
374
- }, {
375
- default: w(() => [
376
- p(n(A), { title: "删除" }, {
377
- default: w(() => [
378
- h("div", {
379
- onClick: (v) => ee(f, a.status)
380
- }, [
381
- y(p(n(I), {
382
- icon: "icon-new",
383
- angle: 45,
384
- clickable: ""
385
- }, null, 512), [
386
- [r, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
387
- ]),
388
- e.showActionText ? y((u(), d("span", Ie, o[4] || (o[4] = [
389
- z("删除")
390
- ]))), [
391
- [r, { role: ["Super", "Admin"], permit: ":uploadlist:delete" }]
392
- ]) : C("", !0)
393
- ], 8, Te)
394
- ]),
395
- _: 2
396
- }, 1024)
397
- ]),
398
- _: 2
399
- }, 1032, ["open", "onConfirm"])
400
- ])) : C("", !0)
401
- ])
402
- ]),
403
- a.status !== n(i).Online && a.status !== n(i).Offline && a.status !== n(i).Success ? (u(), d("div", Ke, [
404
- p(n(ye), {
405
- percent: a.percent,
406
- "stroke-width": 2,
407
- "show-info": !1,
408
- style: { height: "2px" }
409
- }, null, 8, ["percent"])
410
- ])) : C("", !0)
411
- ]))), 128))
412
- ])
413
- ], 2);
414
- };
415
- }
416
- }), Ze = /* @__PURE__ */ we(je, [["__scopeId", "data-v-063bdf08"]]);
417
- export {
418
- Ue as C,
419
- Ze as U,
420
- _e as a,
421
- Ce as d,
422
- Se as p
423
- };