@skyfox2000/webui 1.2.12 → 1.3.0

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