act-plus 1.1.56 → 1.1.57

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.
@@ -0,0 +1,71 @@
1
+ import { defineAsyncComponent as _, ref as C, watch as y, resolveComponent as u, openBlock as k, createBlock as w, withCtx as a, createElementVNode as x, createVNode as s, createTextVNode as m, unref as p, isRef as S } from "vue";
2
+ const B = { class: "dialog-footer" }, A = {
3
+ __name: "dialogSiteComponentsParams",
4
+ props: {
5
+ visible: { type: Boolean, default: !1 },
6
+ title: { type: String, default: "" },
7
+ modelValue: { type: String, default: "" }
8
+ },
9
+ emits: ["update:visible", "refresh", "update:modelValue"],
10
+ setup(f, { emit: c }) {
11
+ const v = _(() => import("./index-61ed059b.js")), n = c, o = f;
12
+ let t = C();
13
+ y(
14
+ () => o.visible,
15
+ async (l, e) => {
16
+ l && (t.value = o.modelValue);
17
+ }
18
+ );
19
+ const b = (l) => {
20
+ d(), l();
21
+ }, d = () => {
22
+ t.value = "", n("update:visible", !1);
23
+ }, V = () => {
24
+ n("update:modelValue", t.value), n("update:visible", !1);
25
+ };
26
+ return (l, e) => {
27
+ const r = u("el-button"), g = u("el-dialog");
28
+ return k(), w(g, {
29
+ "model-value": o.visible,
30
+ title: o.title,
31
+ top: "5vh",
32
+ width: "800",
33
+ draggable: "",
34
+ overflow: "",
35
+ "close-on-click-modal": !1,
36
+ "before-close": b
37
+ }, {
38
+ footer: a(() => [
39
+ x("span", B, [
40
+ s(r, { onClick: d }, {
41
+ default: a(() => e[2] || (e[2] = [
42
+ m("取消")
43
+ ])),
44
+ _: 1
45
+ }),
46
+ s(r, {
47
+ type: "primary",
48
+ onClick: e[1] || (e[1] = (i) => V())
49
+ }, {
50
+ default: a(() => e[3] || (e[3] = [
51
+ m("保存")
52
+ ])),
53
+ _: 1
54
+ })
55
+ ])
56
+ ]),
57
+ default: a(() => [
58
+ s(p(v), {
59
+ modelValue: p(t),
60
+ "onUpdate:modelValue": e[0] || (e[0] = (i) => S(t) ? t.value = i : t = i),
61
+ height: 600
62
+ }, null, 8, ["modelValue"])
63
+ ]),
64
+ _: 1
65
+ }, 8, ["model-value", "title"]);
66
+ };
67
+ }
68
+ };
69
+ export {
70
+ A as default
71
+ };
@@ -0,0 +1,293 @@
1
+ import { defineComponent as L, openBlock as d, createElementBlock as T, createElementVNode as _, ref as D, computed as oe, resolveComponent as F, resolveDirective as ne, withDirectives as ie, createBlock as U, mergeProps as se, unref as p, withCtx as z, renderSlot as j, toDisplayString as I, createCommentVNode as A, createVNode as $, createTextVNode as re, Fragment as ce, renderList as ue, normalizeClass as pe, nextTick as de } from "vue";
2
+ import { ElNotification as E } from "element-plus";
3
+ import { _ as me, u as _e, n as fe } from "./index-5fa8f416.js";
4
+ import "vue-router";
5
+ /*! Element Plus Icons Vue v2.3.1 */
6
+ var ge = /* @__PURE__ */ L({
7
+ name: "Delete",
8
+ __name: "delete",
9
+ setup(l) {
10
+ return (a, f) => (d(), T("svg", {
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ viewBox: "0 0 1024 1024"
13
+ }, [
14
+ _("path", {
15
+ fill: "currentColor",
16
+ d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
17
+ })
18
+ ]));
19
+ }
20
+ }), ve = ge, he = /* @__PURE__ */ L({
21
+ name: "Download",
22
+ __name: "download",
23
+ setup(l) {
24
+ return (a, f) => (d(), T("svg", {
25
+ xmlns: "http://www.w3.org/2000/svg",
26
+ viewBox: "0 0 1024 1024"
27
+ }, [
28
+ _("path", {
29
+ fill: "currentColor",
30
+ d: "M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"
31
+ })
32
+ ]));
33
+ }
34
+ }), ye = he, we = /* @__PURE__ */ L({
35
+ name: "ZoomIn",
36
+ __name: "zoom-in",
37
+ setup(l) {
38
+ return (a, f) => (d(), T("svg", {
39
+ xmlns: "http://www.w3.org/2000/svg",
40
+ viewBox: "0 0 1024 1024"
41
+ }, [
42
+ _("path", {
43
+ fill: "currentColor",
44
+ d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"
45
+ })
46
+ ]));
47
+ }
48
+ }), xe = we;
49
+ let S;
50
+ const Fe = new Uint8Array(16);
51
+ function Te() {
52
+ if (!S && (S = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !S))
53
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
54
+ return S(Fe);
55
+ }
56
+ const n = [];
57
+ for (let l = 0; l < 256; ++l)
58
+ n.push((l + 256).toString(16).slice(1));
59
+ function Ve(l, a = 0) {
60
+ return n[l[a + 0]] + n[l[a + 1]] + n[l[a + 2]] + n[l[a + 3]] + "-" + n[l[a + 4]] + n[l[a + 5]] + "-" + n[l[a + 6]] + n[l[a + 7]] + "-" + n[l[a + 8]] + n[l[a + 9]] + "-" + n[l[a + 10]] + n[l[a + 11]] + n[l[a + 12]] + n[l[a + 13]] + n[l[a + 14]] + n[l[a + 15]];
61
+ }
62
+ const ke = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), H = {
63
+ randomUUID: ke
64
+ };
65
+ function $e(l, a, f) {
66
+ if (H.randomUUID && !a && !l)
67
+ return H.randomUUID();
68
+ l = l || {};
69
+ const g = l.random || (l.rng || Te)();
70
+ if (g[6] = g[6] & 15 | 64, g[8] = g[8] & 63 | 128, a) {
71
+ f = f || 0;
72
+ for (let x = 0; x < 16; ++x)
73
+ a[f + x] = g[x];
74
+ return a;
75
+ }
76
+ return Ve(g);
77
+ }
78
+ const be = { class: "upload-container" }, Ce = { class: "el-upload__text" }, Pe = { class: "tip-text" }, De = { class: "file-list-l" }, Ue = ["onMouseenter", "onMouseleave"], ze = { class: "el-file-operate" }, Ie = {
79
+ __name: "index",
80
+ props: {
81
+ request: { type: Function, required: !0, default: null },
82
+ modelValue: { type: [Array, String], default: [] },
83
+ action: { type: String, default: "/api/v1/utils/uploadFiles" },
84
+ data: { type: Object, default: () => ({ uploadFileType: 1 }) },
85
+ name: { type: String, default: "files" },
86
+ multiple: { type: Boolean, default: !0 },
87
+ limit: { type: Number, default: 9 },
88
+ accept: { type: String, default: "*" },
89
+ tipText: { type: String, default: "" },
90
+ fileMaxSize: { type: Number, default: 100 },
91
+ autoUpload: { type: Boolean, default: !0 }
92
+ },
93
+ emits: ["update:modelValue", "delete"],
94
+ setup(l, { expose: a, emit: f }) {
95
+ const { getAssetsFileName: g, getAssetsFilePath: x, downloadFile: O } = fe(), { t: h } = _e(), b = f, s = l, R = {
96
+ image: /(gif|jpg|jpeg|png|pdf|bmp|webp|GIF|JPG|PDF|PNG|JPEG)$/,
97
+ word: /(doc|docx)$/,
98
+ pdf: /(pdf)$/,
99
+ excel: /(xls|xlsx)$/
100
+ };
101
+ let C = D(!1), M = D({}), B = D(!1), y = D(null), P = null, w = oe({
102
+ get() {
103
+ return J(s.modelValue);
104
+ },
105
+ set(e) {
106
+ b("update:modelValue", e);
107
+ }
108
+ });
109
+ const q = (e) => {
110
+ const t = (w.value || []).map((c) => c.filePath);
111
+ if (e == 0)
112
+ return t;
113
+ let o = t.splice(e), i = t.splice(0, e);
114
+ return o.concat(i);
115
+ }, G = (e) => {
116
+ const t = e.substring(e.lastIndexOf(".") + 1);
117
+ let o = null;
118
+ return Object.keys(R).some((i) => {
119
+ if (R[i].test(t))
120
+ return o = i, !0;
121
+ }), o === null && (o = "file"), o;
122
+ }, W = (e) => e.map((t) => ({ uid: t.uid ?? $e(), name: g(t), filePath: t, fileType: G(t), status: "success" })), J = (e) => {
123
+ const t = Array.isArray(e) ? e.map((o) => o.filePath) : e ? e.split(";") : [];
124
+ return W(t || []);
125
+ }, Z = ({ name: e }) => {
126
+ const t = e.lastIndexOf("."), o = e.slice(t), i = s.accept.trim().split(",");
127
+ let c = !1;
128
+ return i.includes(o) && (c = !0), c = i.some((m) => m == "image/*" ? R.image.test(o) : m.startsWith(".") ? e.endsWith(m) : m === o), c || E({
129
+ title: `${h("act.tip")}`,
130
+ message: `【${e}】${h("act.uploadErrorTip")}`,
131
+ type: "warning",
132
+ duration: 2500
133
+ }), c;
134
+ }, K = (e, t, o) => {
135
+ P && (clearTimeout(P), P = null), P = setTimeout(() => {
136
+ e.call(this, t);
137
+ }, o);
138
+ }, Q = (e) => s.request({ url: s.action, method: "POST", data: e, headers: { "Content-Type": "application/x-www-form-urlencoded" } }), X = async (e) => {
139
+ try {
140
+ const t = e.filter((r) => r.status == "ready" && Z(r)), o = w.value.length + t.length;
141
+ if (t.length === 0) {
142
+ y.value.clearFiles();
143
+ return;
144
+ }
145
+ if (o > s.limit) {
146
+ E({
147
+ title: `${h("act.tip")}`,
148
+ message: `${h("act.uploadLimitTip")}`,
149
+ type: "warning",
150
+ duration: 2500
151
+ }), y.value.clearFiles();
152
+ return;
153
+ }
154
+ if (!s.autoUpload) {
155
+ const r = t.map((V) => ({ ...V, filePath: null, status: "success" }));
156
+ b("update:modelValue", r), y.value.clearFiles();
157
+ return;
158
+ }
159
+ C.value = !0;
160
+ const i = new FormData();
161
+ Object.keys(s.data).forEach((r) => {
162
+ i.append(r, s.data[r]);
163
+ }), t.forEach((r) => {
164
+ i.append(s.name, r.raw);
165
+ });
166
+ let { data: c } = await Q(i);
167
+ const m = s.multiple ? [...w.value.map((r) => r.filePath), ...c.filePaths || []].join(";") : [...c.filePaths || []].join(";");
168
+ y.value.clearFiles(), b("update:modelValue", m), C.value = !1;
169
+ } catch (t) {
170
+ y.value.clearFiles(), C.value = !1, console.error(t);
171
+ }
172
+ }, Y = (e, t) => {
173
+ K(X, t, 500);
174
+ }, N = (e, t) => {
175
+ const o = M.value[`tooltipRef${t}`];
176
+ B.value = o.scrollWidth <= Math.round(o.getBoundingClientRect().width);
177
+ }, ee = ({ filePath: e, name: t, uid: o }, i) => {
178
+ de(() => {
179
+ document.querySelector(`.previewImage_${o}`).children[0].click();
180
+ });
181
+ }, te = ({ filePath: e, name: t }) => {
182
+ O(s.request, e);
183
+ }, le = (e, t) => {
184
+ w.value = w.value.filter((o, i) => i !== t), b("delete", { data: e });
185
+ };
186
+ return a({ clearFiles: () => {
187
+ w.value = [], y.value.clearFiles();
188
+ } }), (e, t) => {
189
+ const o = F("upload-filled"), i = F("el-icon"), c = F("el-upload"), m = F("el-image"), r = F("el-tooltip"), V = F("el-button"), ae = ne("loading");
190
+ return d(), T("div", be, [
191
+ ie((d(), U(c, se({
192
+ ref_key: "uploadRef",
193
+ ref: y,
194
+ action: "#",
195
+ drag: "",
196
+ accept: s.accept,
197
+ multiple: s.multiple,
198
+ "auto-upload": !1,
199
+ "show-file-list": !1,
200
+ "on-change": Y
201
+ }, e.$attrs, {
202
+ "element-loading-text": p(h)("act.uploadLoading")
203
+ }), {
204
+ tip: z(() => [
205
+ s.tipText ? j(e.$slots, "default", { key: 0 }, () => [
206
+ _("p", Pe, I(s.tipText), 1)
207
+ ], !0) : A("", !0)
208
+ ]),
209
+ default: z(() => [
210
+ $(i, { class: "el-icon--upload" }, {
211
+ default: z(() => [
212
+ $(o)
213
+ ]),
214
+ _: 1
215
+ }),
216
+ _("div", Ce, [
217
+ re(I(p(h)("act.uploadText")), 1),
218
+ _("em", null, I(p(h)("act.clickUpload")), 1)
219
+ ])
220
+ ]),
221
+ _: 3
222
+ }, 16, ["accept", "multiple", "element-loading-text"])), [
223
+ [ae, p(C)]
224
+ ]),
225
+ j(e.$slots, "default", {}, () => [
226
+ (d(!0), T(ce, null, ue(p(w), (u, k) => (d(), T("div", {
227
+ class: "file-list",
228
+ key: u.uid
229
+ }, [
230
+ _("div", De, [
231
+ u.fileType === "image" ? (d(), U(m, {
232
+ key: 0,
233
+ class: pe(["file-list-image", { [`previewImage_${u.uid}`]: !0 }]),
234
+ fit: "cover",
235
+ "preview-src-list": q(k),
236
+ "preview-teleported": "",
237
+ src: u.filePath
238
+ }, null, 8, ["class", "preview-src-list", "src"])) : (d(), U(m, {
239
+ key: 1,
240
+ class: "file-list-icon",
241
+ src: p(x)(`images/upload-${u.fileType}.png`)
242
+ }, null, 8, ["src"])),
243
+ $(r, {
244
+ effect: "dark",
245
+ content: u.name,
246
+ placement: "bottom-start",
247
+ disabled: p(B)
248
+ }, {
249
+ default: z(() => [
250
+ _("div", {
251
+ class: "el-file-name",
252
+ ref_for: !0,
253
+ ref: (v) => p(M)[`tooltipRef${k}`] = v,
254
+ onMouseenter: (v) => N(v, k),
255
+ onMouseleave: (v) => N(v, k)
256
+ }, I(u.name), 41, Ue)
257
+ ]),
258
+ _: 2
259
+ }, 1032, ["content", "disabled"])
260
+ ]),
261
+ _("div", ze, [
262
+ u.fileType === "image" ? (d(), U(V, {
263
+ key: 0,
264
+ type: "primary",
265
+ size: "small",
266
+ icon: p(xe),
267
+ circle: "",
268
+ onClick: (v) => ee(u)
269
+ }, null, 8, ["icon", "onClick"])) : A("", !0),
270
+ $(V, {
271
+ type: "primary",
272
+ size: "small",
273
+ icon: p(ye),
274
+ circle: "",
275
+ onClick: (v) => te(u)
276
+ }, null, 8, ["icon", "onClick"]),
277
+ $(V, {
278
+ type: "danger",
279
+ size: "small",
280
+ icon: p(ve),
281
+ circle: "",
282
+ onClick: (v) => le(u, k)
283
+ }, null, 8, ["icon", "onClick"])
284
+ ])
285
+ ]))), 128))
286
+ ], !0)
287
+ ]);
288
+ };
289
+ }
290
+ }, Ne = /* @__PURE__ */ me(Ie, [["__scopeId", "data-v-f839bee6"]]);
291
+ export {
292
+ Ne as default
293
+ };
@@ -0,0 +1,103 @@
1
+ import { ref as p, watch as h, resolveComponent as _, openBlock as r, createElementBlock as m, createVNode as v, unref as u, isRef as w, withCtx as f, createElementVNode as g, createBlock as C, createCommentVNode as N, createTextVNode as $, Fragment as B, renderList as E, normalizeClass as L } from "vue";
2
+ import { _ as P } from "./index-5fa8f416.js";
3
+ import "vue-router";
4
+ import "element-plus";
5
+ const R = { class: "select-icon-container" }, S = { class: "icon-list" }, j = ["onClick"], z = {
6
+ class: "icon-value",
7
+ slot: "reference"
8
+ }, A = {
9
+ __name: "index",
10
+ props: {
11
+ modelValue: { type: String, default: "" },
12
+ icons: { type: Array, default: () => [] },
13
+ props: {
14
+ type: Object,
15
+ default: () => ({ value: "value", type: "btn" })
16
+ }
17
+ },
18
+ emits: ["update:modelValue"],
19
+ setup(x, { emit: V }) {
20
+ const y = V, s = x;
21
+ let c = p(!1), n = p(-1), i = p([]);
22
+ const b = () => n.value == -1 ? "" : i.value[n.value];
23
+ h(
24
+ () => s.icons,
25
+ (l, e) => {
26
+ l && (i.value = (s.icons || []).map((t) => {
27
+ const { props: o } = s;
28
+ return Reflect.has(t, o.value) ? `${o.type}-${t[o.value]}` : `${o.type}-${t}`;
29
+ }));
30
+ },
31
+ { deep: !0, immediate: !0 }
32
+ ), h(
33
+ () => s.modelValue,
34
+ (l, e) => {
35
+ if (!l) {
36
+ n.value = -1, y("update:modelValue", "");
37
+ return;
38
+ }
39
+ const t = i.value.findIndex((o) => o === l);
40
+ n.value = t;
41
+ },
42
+ { deep: !0, immediate: !0 }
43
+ );
44
+ const k = (l, e) => {
45
+ n.value = e, y("update:modelValue", b()), c.value = !1;
46
+ };
47
+ return (l, e) => {
48
+ const t = _("a-svg-icon"), o = _("el-button"), I = _("el-popover");
49
+ return r(), m("div", R, [
50
+ v(I, {
51
+ "popper-class": "select-icon-popover",
52
+ placement: "bottom-start",
53
+ visible: u(c),
54
+ "onUpdate:visible": e[0] || (e[0] = (a) => w(c) ? c.value = a : c = a),
55
+ width: 400,
56
+ trigger: "click"
57
+ }, {
58
+ reference: f(() => [
59
+ g("div", z, [
60
+ u(n) >= 0 ? (r(), C(t, {
61
+ key: 0,
62
+ name: s.modelValue,
63
+ width: "24",
64
+ height: "24",
65
+ color: "#000"
66
+ }, null, 8, ["name"])) : N("", !0),
67
+ v(o, {
68
+ class: "icon-btn",
69
+ type: "primary"
70
+ }, {
71
+ default: f(() => e[1] || (e[1] = [
72
+ $("选择图标")
73
+ ])),
74
+ _: 1
75
+ })
76
+ ])
77
+ ]),
78
+ default: f(() => [
79
+ g("ul", S, [
80
+ (r(!0), m(B, null, E(u(i), (a, d) => (r(), m("li", {
81
+ class: L(["icon-item", { "icon-item-checked": u(n) == d }]),
82
+ key: d,
83
+ onClick: (F) => k(a, d)
84
+ }, [
85
+ v(t, {
86
+ class: "icon-svg",
87
+ name: a,
88
+ width: "24",
89
+ height: "24",
90
+ color: "#999"
91
+ }, null, 8, ["name"])
92
+ ], 10, j))), 128))
93
+ ])
94
+ ]),
95
+ _: 1
96
+ }, 8, ["visible"])
97
+ ]);
98
+ };
99
+ }
100
+ }, D = /* @__PURE__ */ P(A, [["__scopeId", "data-v-308d02d4"]]);
101
+ export {
102
+ D as default
103
+ };