@skyfox2000/webui 1.3.2 → 1.3.3

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