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