@skyfox2000/webui 1.5.7 → 1.5.10

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