ss-component-new 1.1.95 → 1.1.97

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.
@@ -1,953 +0,0 @@
1
- import { ref as S, onMounted as be, createElementBlock as L, openBlock as w, Fragment as me, renderList as fe, createElementVNode as X, createCommentVNode as z, toDisplayString as re, watch as v, createVNode as se, unref as Q, createBlock as oe, resolveDynamicComponent as Ae } from "vue";
2
- import { v as q, d as Y, p as ee, u as De, f as je, i as Oe, e as _e, g as Ue, m as Ee, a as Me, b as Te, c as xe } from "./array-DsDJkF2m.js";
3
- import { u as de } from "./modelComp-B3sxj_Kp.js";
4
- import { u as ye, s as te } from "./menu-BIINB-0Y.js";
5
- import Ie from "./index-DkIX1rI1.js";
6
- import { _ as ie } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
- import { c as a } from "./cloneDeep-YxMVYT3Q.js";
8
- const Ne = { class: "bread-content" }, Je = ["onClick"], Pe = { key: 0 }, we = {
9
- __name: "index",
10
- props: {
11
- breadArray: {
12
- type: Array,
13
- default: () => []
14
- }
15
- },
16
- emits: ["click"],
17
- setup(t, { emit: r }) {
18
- const s = t, e = S([]), l = r;
19
- be(() => {
20
- e.value = s == null ? void 0 : s.breadArray;
21
- });
22
- const p = (m) => {
23
- l("click", m);
24
- };
25
- return (m, k) => (w(), L("div", Ne, [
26
- (w(!0), L(me, null, fe(e.value, (f, o) => (w(), L("div", {
27
- key: o,
28
- class: "bread-item"
29
- }, [
30
- X("div", {
31
- class: "bread-title",
32
- onClick: (n) => p(f)
33
- }, re(f.value), 9, Je),
34
- o !== e.value.length - 1 ? (w(), L("div", Pe, re("/"))) : z("", !0)
35
- ]))), 128))
36
- ]));
37
- }
38
- }, Fe = /* @__PURE__ */ ie(we, [["__scopeId", "data-v-d55d3ede"]]);
39
- function We(t) {
40
- var e, l, p, m;
41
- const r = (l = (e = t[0]) == null ? void 0 : e.compData) == null ? void 0 : l.filter((k) => k.key !== "formContent"), s = (m = (p = t[0]) == null ? void 0 : p.compData) == null ? void 0 : m.filter((k) => k.key === "formContent");
42
- console.log("handleFormModel:", r, s, t);
43
- }
44
- const Z = S(0), Se = (t) => {
45
- let r;
46
- t.includes(`\r
47
- `) ? r = t.split(`\r
48
- `).filter((l) => l.trim() !== "") : r = t.split(`
49
- `).filter((l) => l.trim() !== "");
50
- const s = [];
51
- let e = "";
52
- for (const l of r)
53
- l.includes("{") || e.includes("{") || l.includes("[") || e.includes("[") || l.includes("【") || e.includes("【") || l.includes("(") || e.includes("(") || l.includes("(") || e.includes("(") || l.includes("/*") || e.includes("/*") ? (e += l.trim(), a(e).split("{").length - 1 === a(e).split("}").length - 1 && a(e).split("【").length - 1 === a(e).split("】").length - 1 && a(e).split("[").length - 1 === a(e).split("]").length - 1 && a(e).split("(").length - 1 === a(e).split(")").length - 1 && a(e).split("(").length - 1 === a(e).split(")").length - 1 && a(e).split("/*").length - 1 === a(e).split("*/").length - 1 && (s.push(e), e = "")) : s.push(l.trim());
54
- return s;
55
- }, Le = (t) => {
56
- const [r, s] = t.split(/=(.+)/), e = r.replace(/['"]/g, "").trim(), l = s.replace(/^['"]|['"]$/g, "");
57
- return { key: e, value: l };
58
- }, le = (t) => {
59
- try {
60
- return JSON.parse(t), !0;
61
- } catch {
62
- return !1;
63
- }
64
- }, Ge = (t) => t.includes("$") && t.trim().endsWith("(") ? t + ")" : t, Be = (t) => {
65
- let r = t;
66
- const s = [];
67
- let e = "";
68
- for (const l of r)
69
- l.includes("{") || e.includes("{") || l.includes("[") || e.includes("[") || l.includes("【") || e.includes("【") || l.includes("(") || e.includes("(") || l.includes("(") || e.includes("(") || l.includes("/*") || e.includes("/*") ? (e += l.trim(), a(e).split("{").length - 1 === a(e).split("}").length - 1 && a(e).split("【").length - 1 === a(e).split("】").length - 1 && a(e).split("[").length - 1 === a(e).split("]").length - 1 && a(e).split("(").length - 1 === a(e).split(")").length - 1 && a(e).split("(").length - 1 === a(e).split(")").length - 1 && a(e).split("/*").length - 1 === a(e).split("*/").length - 1 && (s.push(e), e = "")) : s.push(l.trim());
70
- return s == null ? void 0 : s.filter((l) => l.includes("{"));
71
- }, Re = (t) => {
72
- var s;
73
- let r = [];
74
- return (s = Be(t.slice(1, -1))) == null || s.forEach((e) => {
75
- var p, m, k, f;
76
- let l = ((m = (p = e.slice(1, -1)) == null ? void 0 : p.split(",")) == null ? void 0 : m.length) ?? 1;
77
- (f = (k = e.slice(1, -1)) == null ? void 0 : k.split(",")) == null || f.forEach((o) => {
78
- var g, J, c, D, $, A, x, U, I, h, u, d, i;
79
- let n = o == null ? void 0 : o.split(":"), M = n != null && n[0] ? (n == null ? void 0 : n[1].split("$").length) - 1 === 1 ? ((g = n == null ? void 0 : n[0]) == null ? void 0 : g.replace(/^"(.*)"$/, "$1")) + ((J = n == null ? void 0 : n[1]) == null ? void 0 : J.replace(/^"(.*)"$/, "$1")) : Array.isArray((D = (c = n == null ? void 0 : n[1]) == null ? void 0 : c.replace(/^"(.*)"$/, "$1")) == null ? void 0 : D.split("(")) && ((x = (A = ($ = n == null ? void 0 : n[1]) == null ? void 0 : $.replace(/^"(.*)"$/, "$1")) == null ? void 0 : A.split("(")) == null ? void 0 : x.length) > 1 ? ((U = n == null ? void 0 : n[0]) == null ? void 0 : U.replace(/^"(.*)"$/, "$1")) + ((u = (h = (I = n == null ? void 0 : n[1]) == null ? void 0 : I.replace(/^"(.*)"$/, "$1")) == null ? void 0 : h.split("(")) == null ? void 0 : u[0]) + "()" : (d = n == null ? void 0 : n[0]) == null ? void 0 : d.replace(/^"(.*)"$/, "$1") : "", C = (n == null ? void 0 : n[1].split("$").length) - 1 === 0 ? (i = n == null ? void 0 : n[1]) == null ? void 0 : i.replace(/^"(.*)"$/, "$1") : "";
80
- Z.value++, r.push({
81
- id: Z.value,
82
- key: M,
83
- value: C,
84
- // 如果值为空,则key设为空字符串,否则保留原值
85
- width: l,
86
- extraContent: n == null ? void 0 : n[1]
87
- });
88
- });
89
- }), r;
90
- }, ge = (t) => {
91
- var r, s;
92
- try {
93
- const e = t.replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",").replace(/:/g, ":").replace(/:\s*(?=,|}|$)/g, ': ""');
94
- if (a(e).split("{").length - 1 > 1) {
95
- let l = a(e).replace(/^\{(.*)\}$/, "[$1]");
96
- if (le(l) && !l.includes("$") || (l = l.replace(/"([^"]+)"\$([\w\u4e00-\u9fa5]+\([^)]*\))/g, '"$1$$$2"')), le(l)) {
97
- const p = JSON.parse(l);
98
- let m = [];
99
- return p == null || p.forEach((k) => {
100
- var f;
101
- (f = Object.entries(a(k))) == null || f.forEach((o) => {
102
- Z.value++, m.push({
103
- id: Z.value,
104
- key: (o == null ? void 0 : o[0]) ?? "",
105
- value: (o == null ? void 0 : o[1]) === "" ? "" : o == null ? void 0 : o[1],
106
- // 如果值为空,则key设为空字符串,否则保留原值
107
- width: Object.keys(a(k)).length
108
- });
109
- });
110
- }), m;
111
- } else
112
- return e.trim().startsWith("{{") ? Re(e.trim()) : ae(l);
113
- } else if (le(e)) {
114
- const l = JSON.parse(e);
115
- return Object.entries(l).map(([p, m]) => (Z.value++, {
116
- id: Z.value,
117
- key: p,
118
- value: m === "" ? "" : m,
119
- // 如果值为空,则key设为空字符串,否则保留原值
120
- width: 1
121
- }));
122
- } else
123
- return ((r = ae(e)) == null ? void 0 : r.length) === 0 ? e : (s = ae(e)) == null ? void 0 : s.map((l) => ({
124
- label: l.label,
125
- method: Ge(l.method)
126
- }));
127
- } catch (e) {
128
- return console.error("转换失败:", e), [];
129
- }
130
- }, ae = (t) => {
131
- t = t.trim().replace(/^\{|\}$/g, "").trim();
132
- const r = [];
133
- let s = 0;
134
- for (; s < t.length; ) {
135
- const e = t.slice(s).match(/^\s*"([^"]+)"\s*:\s*/);
136
- if (!e) break;
137
- const l = e[1];
138
- s += e[0].length;
139
- let p = "", m = 0, k = !1, f = "";
140
- for (let o = s; o < t.length; o++) {
141
- const n = t[o];
142
- if ((n === '"' || n === "'") && !k ? (k = !0, f = n) : n === f && k && (k = !1, f = ""), !k && ((n === "{" || n === "(" || n === "[") && m++, (n === "}" || n === ")" || n === "]") && m--, n === "," && m === 0 || o === t.length - 1)) {
143
- p = t.slice(s, o + 1).trim(), s = o + 1;
144
- break;
145
- }
146
- }
147
- r.push({
148
- label: l,
149
- method: p
150
- });
151
- }
152
- return r;
153
- }, Ke = (t, r) => {
154
- var s;
155
- try {
156
- if ((s = q) != null && s.find((e) => (e == null ? void 0 : e.key) === r))
157
- return t.replace(/['"]/g, "").trim();
158
- if (a(t).split("[").length - 1 > 1) {
159
- const e = a(t).replace(/[’]|[‘]|[']/g, '"').replaceAll(/,/g, ",").replaceAll("(", "[").replaceAll(")", "]").replaceAll("],]", "]]");
160
- return JSON.parse(e);
161
- } else {
162
- const e = a(t).replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",");
163
- if (le(e)) {
164
- const l = JSON.parse(e);
165
- return Array.isArray(l) ? l.map((p) => ({ label: p })) : l;
166
- } else
167
- return ge(a(t));
168
- }
169
- } catch (e) {
170
- return console.error("解析失败:", e), t;
171
- }
172
- }, He = (t) => ({ [t == null ? void 0 : t.key]: Ke(t == null ? void 0 : t.value, t == null ? void 0 : t.key) }), Ye = (t) => {
173
- try {
174
- if (a(t).split("[").length - 1 > 1) {
175
- const r = a(t).replace(/[’]|[‘]|[']/g, '"').replaceAll(/,/g, ",").replaceAll("(", "[").replaceAll(")", "]").replaceAll("],]", "]]");
176
- return JSON.parse(r);
177
- } else
178
- return JSON.parse(a(t).replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",")).map((s) => ({ label: s }));
179
- } catch (r) {
180
- return console.error("解析失败:", r), t;
181
- }
182
- }, qe = (t) => {
183
- const r = t.match(/\(([^)]+)\)/);
184
- return r ? r[1] : "";
185
- }, ze = (t) => {
186
- const r = t.match(/^([^(]+)\s*\(/);
187
- return r ? r[1].trim() : t;
188
- }, ue = (t) => t.replace(/'/g, "").replace(/"/g, "").replace(/{|}/g, "").split(":").map((r) => r.trim()).filter((r) => r).join("/"), Qe = (t) => {
189
- var m, k;
190
- let r = [], s = [];
191
- const e = (m = a(t)) == null ? void 0 : m.map((f) => f == null ? void 0 : f.key), l = [...new Set((k = a(e)) == null ? void 0 : k.map((f) => qe(f)))];
192
- l == null || l.forEach((f) => {
193
- let o = t == null ? void 0 : t.filter((C) => C.key.includes(f));
194
- o == null || o.forEach((C) => {
195
- C != null && C.key.includes("Menus") && (r.push({
196
- key: "GroupName",
197
- value: ue(C == null ? void 0 : C.value)
198
- }), s.push(ue(C == null ? void 0 : C.value)));
199
- });
200
- let n = t == null ? void 0 : t.filter((C) => C.key.includes(f) && !(C != null && C.key.includes("Menus")));
201
- n = n == null ? void 0 : n.map((C) => (C.key = ze(C.key), C));
202
- const M = {
203
- key: "GroupContents",
204
- value: n
205
- };
206
- r.push(M);
207
- });
208
- const p = {
209
- key: "Menus",
210
- value: s
211
- };
212
- return r.unshift(p), r;
213
- }, ke = (t) => {
214
- var r, s;
215
- if (Array.isArray(Object.keys(t)) && ((r = Object.keys(t)) == null ? void 0 : r.length) > 0) {
216
- let e = [];
217
- return (s = Object.entries(t)) == null || s.forEach(([l, p]) => {
218
- var k, f;
219
- let m = [];
220
- if (m.push(l), ((k = Object.keys(p)) == null ? void 0 : k.length) > 0) {
221
- let o = [];
222
- o.push((f = ke(p)) == null ? void 0 : f[0]), m.push(o == null ? void 0 : o[0]);
223
- }
224
- e.push(m);
225
- }), e;
226
- }
227
- }, Xe = (t, r) => {
228
- var e;
229
- let s = r;
230
- return Array.isArray(Object.keys(t)) && ((e = Object.entries(t)) == null || e.forEach(([l, p]) => {
231
- let m = [l];
232
- if (typeof p == "object" && p !== null) {
233
- let k = ke(p);
234
- k == null || k.forEach((f) => {
235
- m.push(f);
236
- });
237
- }
238
- s.push(m);
239
- })), s;
240
- }, Ze = (t) => {
241
- const r = {};
242
- return t.forEach((e) => {
243
- const l = e.split("/");
244
- let p = r;
245
- l.forEach((m) => {
246
- p[m] || (p[m] = {}), p = p[m];
247
- });
248
- }), Xe(r, []);
249
- }, Ve = (t) => Ze(t), pe = (t) => {
250
- var r, s, e, l, p, m, k, f, o;
251
- try {
252
- const n = Se((s = (r = a(t)) == null ? void 0 : r.replace("(", "(")) == null ? void 0 : s.replace(")", ")")), M = (l = (e = a(n)) == null ? void 0 : e.filter((c) => !c.includes("/*"))) == null ? void 0 : l.map((c) => Le(c)), C = Qe(M), g = [];
253
- if ((C == null ? void 0 : C.length) === 1 && ((m = (p = C == null ? void 0 : C.find((c) => (c == null ? void 0 : c.key) === "Menus")) == null ? void 0 : p.value) == null ? void 0 : m.length) === 0)
254
- return !1;
255
- (k = a(C)) == null || k.forEach((c) => {
256
- var D, $, A, x, U, I, h, u, d;
257
- (D = q) != null && D.find((i) => {
258
- var y, b;
259
- return ((y = i == null ? void 0 : i.key) == null ? void 0 : y.toUpperCase()) === ((b = c == null ? void 0 : c.key) == null ? void 0 : b.toUpperCase());
260
- }) ? g.push({
261
- comp: ((A = ($ = q) == null ? void 0 : $.find((i) => {
262
- var y, b;
263
- return ((y = i == null ? void 0 : i.key) == null ? void 0 : y.toUpperCase()) === ((b = c == null ? void 0 : c.key) == null ? void 0 : b.toUpperCase());
264
- })) == null ? void 0 : A.value) ?? "",
265
- name: (x = c == null ? void 0 : c.value) == null ? void 0 : x.replace(/[’]|[‘]|[']/g, ""),
266
- compData: []
267
- }) : (U = Y) != null && U.find((i) => {
268
- var y, b;
269
- return ((y = i == null ? void 0 : i.key) == null ? void 0 : y.toUpperCase()) === ((b = c == null ? void 0 : c.key) == null ? void 0 : b.toUpperCase());
270
- }) && ((g == null ? void 0 : g.length) === 0 && (I = c.key) != null && I.includes("Menus") && g.push({
271
- comp: "Menu",
272
- name: "",
273
- compData: []
274
- }), (h = g == null ? void 0 : g[(g == null ? void 0 : g.length) - 1]) != null && h.compData && g[(g == null ? void 0 : g.length) - 1].compData.push({
275
- key: (d = (u = Y) == null ? void 0 : u.find((i) => {
276
- var y, b;
277
- return ((y = i == null ? void 0 : i.key) == null ? void 0 : y.toUpperCase()) === ((b = c == null ? void 0 : c.key) == null ? void 0 : b.toUpperCase());
278
- })) == null ? void 0 : d.value,
279
- contents: c == null ? void 0 : c.value
280
- }));
281
- });
282
- let J = (f = a(g)) == null ? void 0 : f.map((c) => {
283
- var D;
284
- return c != null && c.compData && (c.compData = (D = c == null ? void 0 : c.compData) == null ? void 0 : D.map(($) => {
285
- var A, x, U, I, h, u, d, i, y, b, _;
286
- if (($ == null ? void 0 : $.key) === "formFlex")
287
- $.contents = ((x = (A = $.contents) == null ? void 0 : A.replace(/[’]|[‘]|[']/g, "")) == null ? void 0 : x.toUpperCase()) !== "Vertical".toUpperCase();
288
- else if (($ == null ? void 0 : $.key) === "groupContents")
289
- $.contents = (U = a($.contents)) == null ? void 0 : U.map((N) => He(a(N)));
290
- else if (Array.isArray($ == null ? void 0 : $.contents))
291
- $.contents = Ve($.contents);
292
- else if (((h = (I = $ == null ? void 0 : $.contents) == null ? void 0 : I.trim()) != null && h.startsWith("[") || (d = (u = $.contents) == null ? void 0 : u.trim()) != null && d.startsWith("【")) && ((y = (i = $.contents) == null ? void 0 : i.trim()) != null && y.endsWith("]") || (_ = (b = $.contents) == null ? void 0 : b.trim()) != null && _.endsWith("】")))
293
- $.contents = Ye(a($.contents));
294
- else {
295
- if (!$.contents) return;
296
- $.contents = ge(a($.contents));
297
- }
298
- return $;
299
- })), c;
300
- });
301
- return J = (o = a(J)) == null ? void 0 : o.map((c) => {
302
- var D;
303
- return (c == null ? void 0 : c.comp) === "Group" && (c.compData = (D = c.compData) == null ? void 0 : D.map(($) => {
304
- var x;
305
- let A = [];
306
- return (x = $.contents) == null || x.forEach((U) => {
307
- var I, h, u, d, i, y, b, _, N, T, j, W, G, B, H, P, F;
308
- if ((I = q) != null && I.find((O) => {
309
- var E, R, K;
310
- return ((E = O == null ? void 0 : O.key) == null ? void 0 : E.toUpperCase()) === ((K = (R = Object.keys(U)) == null ? void 0 : R[0]) == null ? void 0 : K.toUpperCase());
311
- }))
312
- A.push({
313
- comp: (u = (h = q) == null ? void 0 : h.find((O) => {
314
- var E, R, K;
315
- return ((E = O == null ? void 0 : O.key) == null ? void 0 : E.toUpperCase()) === ((K = (R = Object.keys(U)) == null ? void 0 : R[0]) == null ? void 0 : K.toUpperCase());
316
- })) == null ? void 0 : u.value,
317
- name: (i = (d = Object.values(U)) == null ? void 0 : d[0]) == null ? void 0 : i.replace(/[’]|[‘]|[']/g, ""),
318
- compData: []
319
- });
320
- else if ((y = Y) != null && y.find((O) => {
321
- var E, R, K;
322
- return ((E = O == null ? void 0 : O.key) == null ? void 0 : E.toUpperCase()) === ((K = (R = Object.keys(U)) == null ? void 0 : R[0]) == null ? void 0 : K.toUpperCase());
323
- })) {
324
- if ((A == null ? void 0 : A.length) === 0) return;
325
- (b = A == null ? void 0 : A[(A == null ? void 0 : A.length) - 1]) != null && b.compData && A[(A == null ? void 0 : A.length) - 1].compData.push({
326
- key: (N = (_ = Y) == null ? void 0 : _.find((O) => {
327
- var E, R, K;
328
- return ((E = O == null ? void 0 : O.key) == null ? void 0 : E.toUpperCase()) === ((K = (R = Object.keys(U)) == null ? void 0 : R[0]) == null ? void 0 : K.toUpperCase());
329
- })) == null ? void 0 : N.value,
330
- contents: (T = Object.values(U)) == null ? void 0 : T[0]
331
- });
332
- } else if ((W = (j = Object.keys(U)) == null ? void 0 : j[0]) != null && W.includes("$")) {
333
- const O = (B = (G = Object.keys(a(U))) == null ? void 0 : G[0]) == null ? void 0 : B.split("$");
334
- A[(A == null ? void 0 : A.length) - 1].compData.push({
335
- key: (P = (H = Y) == null ? void 0 : H.find((E) => {
336
- var R, K;
337
- return ((R = E == null ? void 0 : E.key) == null ? void 0 : R.toUpperCase()) === ((K = O == null ? void 0 : O[0]) == null ? void 0 : K.toUpperCase());
338
- })) == null ? void 0 : P.value,
339
- contents: (F = Object.values(U)) == null ? void 0 : F[0],
340
- selectLabel: O == null ? void 0 : O[1]
341
- });
342
- }
343
- return U;
344
- }), $.contents = A, $;
345
- })), c;
346
- }), J;
347
- } catch {
348
- return !1;
349
- }
350
- }, V = S(0), ve = (t) => {
351
- let r;
352
- t.includes(`\r
353
- `) ? r = t.split(`\r
354
- `).filter((l) => l.trim() !== "") : r = t.split(`
355
- `).filter((l) => l.trim() !== "");
356
- const s = [];
357
- let e = "";
358
- for (const l of r)
359
- l.includes("{") || e.includes("{") || l.includes("[") || e.includes("[") || l.includes("【") || e.includes("【") || l.includes("(") || e.includes("(") || l.includes("(") || e.includes("(") || l.includes("/*") || e.includes("/*") ? (e += l.trim(), a(e).split("{").length - 1 === a(e).split("}").length - 1 && a(e).split("【").length - 1 === a(e).split("】").length - 1 && a(e).split("[").length - 1 === a(e).split("]").length - 1 && a(e).split("(").length - 1 === a(e).split(")").length - 1 && a(e).split("(").length - 1 === a(e).split(")").length - 1 && a(e).split("/*").length - 1 === a(e).split("*/").length - 1 && (s.push(e), e = "")) : s.push(l.trim());
360
- return s;
361
- }, et = (t) => {
362
- const [r, s] = t.split(/=(.+)/), e = r.replace(/['"]/g, "").trim(), l = s.replace(/^['"]|['"]$/g, "");
363
- return { key: e, value: l };
364
- }, ne = (t) => {
365
- try {
366
- return JSON.parse(t), !0;
367
- } catch {
368
- return !1;
369
- }
370
- }, tt = (t) => t.includes("$") && t.trim().endsWith("(") ? t + ")" : t, st = (t) => {
371
- let r = t;
372
- const s = [];
373
- let e = "";
374
- for (const l of r)
375
- l.includes("{") || e.includes("{") || l.includes("[") || e.includes("[") || l.includes("【") || e.includes("【") || l.includes("(") || e.includes("(") || l.includes("(") || e.includes("(") || l.includes("/*") || e.includes("/*") ? (e += l.trim(), a(e).split("{").length - 1 === a(e).split("}").length - 1 && a(e).split("【").length - 1 === a(e).split("】").length - 1 && a(e).split("[").length - 1 === a(e).split("]").length - 1 && a(e).split("(").length - 1 === a(e).split(")").length - 1 && a(e).split("(").length - 1 === a(e).split(")").length - 1 && a(e).split("/*").length - 1 === a(e).split("*/").length - 1 && (s.push(e), e = "")) : s.push(l.trim());
376
- return s == null ? void 0 : s.filter((l) => l.includes("{"));
377
- }, lt = (t) => {
378
- var s;
379
- let r = [];
380
- return (s = st(t.slice(1, -1))) == null || s.forEach((e) => {
381
- var p, m, k, f;
382
- let l = ((m = (p = e.slice(1, -1)) == null ? void 0 : p.split(",")) == null ? void 0 : m.length) ?? 1;
383
- (f = (k = e.slice(1, -1)) == null ? void 0 : k.split(",")) == null || f.forEach((o) => {
384
- var g, J, c, D, $, A, x, U, I, h, u, d, i;
385
- let n = o == null ? void 0 : o.split(":"), M = n != null && n[0] ? (n == null ? void 0 : n[1].split("$").length) - 1 === 1 ? ((g = n == null ? void 0 : n[0]) == null ? void 0 : g.replace(/^"(.*)"$/, "$1")) + ((J = n == null ? void 0 : n[1]) == null ? void 0 : J.replace(/^"(.*)"$/, "$1")) : Array.isArray((D = (c = n == null ? void 0 : n[1]) == null ? void 0 : c.replace(/^"(.*)"$/, "$1")) == null ? void 0 : D.split("(")) && ((x = (A = ($ = n == null ? void 0 : n[1]) == null ? void 0 : $.replace(/^"(.*)"$/, "$1")) == null ? void 0 : A.split("(")) == null ? void 0 : x.length) > 1 ? ((U = n == null ? void 0 : n[0]) == null ? void 0 : U.replace(/^"(.*)"$/, "$1")) + ((u = (h = (I = n == null ? void 0 : n[1]) == null ? void 0 : I.replace(/^"(.*)"$/, "$1")) == null ? void 0 : h.split("(")) == null ? void 0 : u[0]) + "()" : (d = n == null ? void 0 : n[0]) == null ? void 0 : d.replace(/^"(.*)"$/, "$1") : "", C = (n == null ? void 0 : n[1].split("$").length) - 1 === 0 ? (i = n == null ? void 0 : n[1]) == null ? void 0 : i.replace(/^"(.*)"$/, "$1") : "";
386
- V.value++, r.push({
387
- id: V.value,
388
- key: M,
389
- value: C,
390
- // 如果值为空,则key设为空字符串,否则保留原值
391
- width: l,
392
- extraContent: n == null ? void 0 : n[1]
393
- });
394
- });
395
- }), r;
396
- }, $e = (t) => {
397
- var r, s;
398
- try {
399
- const e = t.replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",").replace(/:/g, ":").replace(/:\s*(?=,|}|$)/g, ': ""');
400
- if (a(e).split("{").length - 1 > 1) {
401
- let l = a(e).replace(/^\{(.*)\}$/, "[$1]");
402
- if (ne(l) && !l.includes("$") || (l = l.replace(/"([^"]+)"\$([\w\u4e00-\u9fa5]+\([^)]*\))/g, '"$1$$$2"')), ne(l)) {
403
- const p = JSON.parse(l);
404
- let m = [];
405
- return p == null || p.forEach((k) => {
406
- var f;
407
- (f = Object.entries(a(k))) == null || f.forEach((o) => {
408
- V.value++, m.push({
409
- id: V.value,
410
- key: (o == null ? void 0 : o[0]) ?? "",
411
- value: (o == null ? void 0 : o[1]) === "" ? "" : o == null ? void 0 : o[1],
412
- // 如果值为空,则key设为空字符串,否则保留原值
413
- width: Object.keys(a(k)).length
414
- });
415
- });
416
- }), m;
417
- } else
418
- return e.trim().startsWith("{{") ? lt(e.trim()) : ce(l);
419
- } else if (ne(e)) {
420
- const l = JSON.parse(e);
421
- return Object.entries(l).map(([p, m]) => (V.value++, {
422
- id: V.value,
423
- key: p,
424
- value: m === "" ? "" : m,
425
- // 如果值为空,则key设为空字符串,否则保留原值
426
- width: 1
427
- }));
428
- } else
429
- return ((r = ce(e)) == null ? void 0 : r.length) === 0 ? e : (s = ce(e)) == null ? void 0 : s.map((l) => ({
430
- label: l.label,
431
- method: tt(l.method)
432
- }));
433
- } catch (e) {
434
- return console.error("转换失败:", e), [];
435
- }
436
- }, ce = (t) => {
437
- t = t.trim().replace(/^\{|\}$/g, "").trim();
438
- const r = [];
439
- let s = 0;
440
- for (; s < t.length; ) {
441
- const e = t.slice(s).match(/^\s*"([^"]+)"\s*:\s*/);
442
- if (!e) break;
443
- const l = e[1];
444
- s += e[0].length;
445
- let p = "", m = 0, k = !1, f = "";
446
- for (let o = s; o < t.length; o++) {
447
- const n = t[o];
448
- if ((n === '"' || n === "'") && !k ? (k = !0, f = n) : n === f && k && (k = !1, f = ""), !k && ((n === "{" || n === "(" || n === "[") && m++, (n === "}" || n === ")" || n === "]") && m--, n === "," && m === 0 || o === t.length - 1)) {
449
- p = t.slice(s, o + 1).trim(), s = o + 1;
450
- break;
451
- }
452
- }
453
- r.push({
454
- label: l,
455
- method: p
456
- });
457
- }
458
- return r;
459
- }, nt = (t, r) => {
460
- var s;
461
- try {
462
- if ((s = q) != null && s.find((e) => (e == null ? void 0 : e.key) === r))
463
- return t.replace(/['"]/g, "").trim();
464
- if (a(t).split("[").length - 1 > 1) {
465
- const e = a(t).replace(/[’]|[‘]|[']/g, '"').replaceAll(/,/g, ",").replaceAll("(", "[").replaceAll(")", "]").replaceAll("],]", "]]");
466
- return JSON.parse(e);
467
- } else {
468
- const e = a(t).replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",");
469
- if (ne(e)) {
470
- const l = JSON.parse(e);
471
- return Array.isArray(l) ? l.map((p) => ({ label: p })) : l;
472
- } else
473
- return $e(a(t));
474
- }
475
- } catch (e) {
476
- return console.error("解析失败:", e), t;
477
- }
478
- }, rt = (t) => ({ [t == null ? void 0 : t.key]: nt(t == null ? void 0 : t.value, t == null ? void 0 : t.key) }), at = (t) => {
479
- try {
480
- if (a(t).split("[").length - 1 > 1) {
481
- const r = a(t).replace(/[’]|[‘]|[']/g, '"').replaceAll(/,/g, ",").replaceAll("(", "[").replaceAll(")", "]").replaceAll("],]", "]]");
482
- return JSON.parse(r);
483
- } else
484
- return JSON.parse(a(t).replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",")).map((s) => ({ label: s }));
485
- } catch (r) {
486
- return console.error("解析失败:", r), t;
487
- }
488
- }, ct = (t) => {
489
- const r = t.match(/\(([^)]+)\)/);
490
- return r ? r[1] : "";
491
- }, ot = (t) => {
492
- const r = t.match(/^([^(]+)\s*\(/);
493
- return r ? r[1].trim() : t;
494
- }, he = (t) => t.replace(/'/g, "").replace(/"/g, "").replace(/{|}/g, "").split(":").map((r) => r.trim()).filter((r) => r).join("/"), it = (t) => {
495
- var m, k;
496
- let r = [], s = [];
497
- const e = (m = a(t)) == null ? void 0 : m.map((f) => f == null ? void 0 : f.key), l = [...new Set((k = a(e)) == null ? void 0 : k.map((f) => ct(f)))];
498
- l == null || l.forEach((f) => {
499
- let o = t == null ? void 0 : t.filter((C) => C.key.includes(f));
500
- o == null || o.forEach((C) => {
501
- C != null && C.key.includes("Menus") && (r.push({
502
- key: "GroupName",
503
- value: he(C == null ? void 0 : C.value)
504
- }), s.push(he(C == null ? void 0 : C.value)));
505
- });
506
- let n = t == null ? void 0 : t.filter((C) => C.key.includes(f) && !(C != null && C.key.includes("Menus")));
507
- n = n == null ? void 0 : n.map((C) => (C.key = ot(C.key), C));
508
- const M = {
509
- key: "GroupContents",
510
- value: n
511
- };
512
- r.push(M);
513
- });
514
- const p = {
515
- key: "Menus",
516
- value: s
517
- };
518
- return r.unshift(p), r;
519
- }, Ce = (t) => {
520
- var r, s;
521
- if (Array.isArray(Object.keys(t)) && ((r = Object.keys(t)) == null ? void 0 : r.length) > 0) {
522
- let e = [];
523
- return (s = Object.entries(t)) == null || s.forEach(([l, p]) => {
524
- var k, f;
525
- let m = [];
526
- if (m.push(l), ((k = Object.keys(p)) == null ? void 0 : k.length) > 0) {
527
- let o = [];
528
- o.push((f = Ce(p)) == null ? void 0 : f[0]), m.push(o == null ? void 0 : o[0]);
529
- }
530
- e.push(m);
531
- }), e;
532
- }
533
- }, ut = (t, r) => {
534
- var e;
535
- let s = r;
536
- return Array.isArray(Object.keys(t)) && ((e = Object.entries(t)) == null || e.forEach(([l, p]) => {
537
- let m = [l];
538
- if (typeof p == "object" && p !== null) {
539
- let k = Ce(p);
540
- k == null || k.forEach((f) => {
541
- m.push(f);
542
- });
543
- }
544
- s.push(m);
545
- })), s;
546
- }, pt = (t) => {
547
- const r = {};
548
- return t.forEach((e) => {
549
- const l = e.split("/");
550
- let p = r;
551
- l.forEach((m) => {
552
- p[m] || (p[m] = {}), p = p[m];
553
- });
554
- }), ut(r, []);
555
- }, ht = (t) => pt(t), mt = (t) => {
556
- var r, s, e, l, p, m, k;
557
- try {
558
- const f = ve((s = (r = a(t)) == null ? void 0 : r.replace("(", "(")) == null ? void 0 : s.replace(")", ")")), o = (l = (e = a(f)) == null ? void 0 : e.filter((g) => !g.includes("/*"))) == null ? void 0 : l.map((g) => et(g)), n = it(o), M = [];
559
- (p = a(n)) == null || p.forEach((g) => {
560
- var J, c, D, $, A, x, U, I, h;
561
- (J = q) != null && J.find((u) => {
562
- var d, i;
563
- return ((d = u == null ? void 0 : u.key) == null ? void 0 : d.toUpperCase()) === ((i = g == null ? void 0 : g.key) == null ? void 0 : i.toUpperCase());
564
- }) ? M.push({
565
- comp: ((D = (c = q) == null ? void 0 : c.find((u) => {
566
- var d, i;
567
- return ((d = u == null ? void 0 : u.key) == null ? void 0 : d.toUpperCase()) === ((i = g == null ? void 0 : g.key) == null ? void 0 : i.toUpperCase());
568
- })) == null ? void 0 : D.value) ?? "",
569
- name: ($ = g == null ? void 0 : g.value) == null ? void 0 : $.replace(/[’]|[‘]|[']/g, ""),
570
- compData: []
571
- }) : (A = Y) != null && A.find((u) => {
572
- var d, i;
573
- return ((d = u == null ? void 0 : u.key) == null ? void 0 : d.toUpperCase()) === ((i = g == null ? void 0 : g.key) == null ? void 0 : i.toUpperCase());
574
- }) && ((M == null ? void 0 : M.length) === 0 && (x = g.key) != null && x.includes("Menus") && M.push({
575
- comp: "Menu",
576
- name: "",
577
- compData: []
578
- }), (U = M == null ? void 0 : M[(M == null ? void 0 : M.length) - 1]) != null && U.compData && M[(M == null ? void 0 : M.length) - 1].compData.push({
579
- key: (h = (I = Y) == null ? void 0 : I.find((u) => {
580
- var d, i;
581
- return ((d = u == null ? void 0 : u.key) == null ? void 0 : d.toUpperCase()) === ((i = g == null ? void 0 : g.key) == null ? void 0 : i.toUpperCase());
582
- })) == null ? void 0 : h.value,
583
- contents: g == null ? void 0 : g.value
584
- }));
585
- });
586
- let C = (m = a(M)) == null ? void 0 : m.map((g) => {
587
- var J;
588
- return g != null && g.compData && (g.compData = (J = g == null ? void 0 : g.compData) == null ? void 0 : J.map((c) => {
589
- var D, $, A, x, U, I, h, u, d, i, y;
590
- if ((c == null ? void 0 : c.key) === "formFlex")
591
- c.contents = (($ = (D = c.contents) == null ? void 0 : D.replace(/[’]|[‘]|[']/g, "")) == null ? void 0 : $.toUpperCase()) !== "Vertical".toUpperCase();
592
- else if ((c == null ? void 0 : c.key) === "groupContents")
593
- c.contents = (A = a(c.contents)) == null ? void 0 : A.map((b) => rt(a(b)));
594
- else if (Array.isArray(c == null ? void 0 : c.contents))
595
- c.contents = ht(c.contents);
596
- else if (((U = (x = c == null ? void 0 : c.contents) == null ? void 0 : x.trim()) != null && U.startsWith("[") || (h = (I = c.contents) == null ? void 0 : I.trim()) != null && h.startsWith("【")) && ((d = (u = c.contents) == null ? void 0 : u.trim()) != null && d.endsWith("]") || (y = (i = c.contents) == null ? void 0 : i.trim()) != null && y.endsWith("】")))
597
- c.contents = at(a(c.contents));
598
- else {
599
- if (!c.contents) return;
600
- c.contents = $e(a(c.contents));
601
- }
602
- return c;
603
- })), g;
604
- });
605
- return C = (k = a(C)) == null ? void 0 : k.map((g) => {
606
- var J;
607
- return (g == null ? void 0 : g.comp) === "Group" && (g.compData = (J = g.compData) == null ? void 0 : J.map((c) => {
608
- var $;
609
- let D = [];
610
- return ($ = c.contents) == null || $.forEach((A) => {
611
- var x, U, I, h, u, d, i, y, b, _, N, T, j, W, G, B, H;
612
- if ((x = q) != null && x.find((P) => {
613
- var F, O, E;
614
- return ((F = P == null ? void 0 : P.key) == null ? void 0 : F.toUpperCase()) === ((E = (O = Object.keys(A)) == null ? void 0 : O[0]) == null ? void 0 : E.toUpperCase());
615
- }))
616
- D.push({
617
- comp: (I = (U = q) == null ? void 0 : U.find((P) => {
618
- var F, O, E;
619
- return ((F = P == null ? void 0 : P.key) == null ? void 0 : F.toUpperCase()) === ((E = (O = Object.keys(A)) == null ? void 0 : O[0]) == null ? void 0 : E.toUpperCase());
620
- })) == null ? void 0 : I.value,
621
- name: (u = (h = Object.values(A)) == null ? void 0 : h[0]) == null ? void 0 : u.replace(/[’]|[‘]|[']/g, ""),
622
- compData: []
623
- });
624
- else if ((d = Y) != null && d.find((P) => {
625
- var F, O, E;
626
- return ((F = P == null ? void 0 : P.key) == null ? void 0 : F.toUpperCase()) === ((E = (O = Object.keys(A)) == null ? void 0 : O[0]) == null ? void 0 : E.toUpperCase());
627
- })) {
628
- if ((D == null ? void 0 : D.length) === 0) return;
629
- (i = D == null ? void 0 : D[(D == null ? void 0 : D.length) - 1]) != null && i.compData && D[(D == null ? void 0 : D.length) - 1].compData.push({
630
- key: (b = (y = Y) == null ? void 0 : y.find((P) => {
631
- var F, O, E;
632
- return ((F = P == null ? void 0 : P.key) == null ? void 0 : F.toUpperCase()) === ((E = (O = Object.keys(A)) == null ? void 0 : O[0]) == null ? void 0 : E.toUpperCase());
633
- })) == null ? void 0 : b.value,
634
- contents: (_ = Object.values(A)) == null ? void 0 : _[0]
635
- });
636
- } else if ((T = (N = Object.keys(A)) == null ? void 0 : N[0]) != null && T.includes("$")) {
637
- const P = (W = (j = Object.keys(a(A))) == null ? void 0 : j[0]) == null ? void 0 : W.split("$");
638
- D[(D == null ? void 0 : D.length) - 1].compData.push({
639
- key: (B = (G = Y) == null ? void 0 : G.find((F) => {
640
- var O, E;
641
- return ((O = F == null ? void 0 : F.key) == null ? void 0 : O.toUpperCase()) === ((E = P == null ? void 0 : P[0]) == null ? void 0 : E.toUpperCase());
642
- })) == null ? void 0 : B.value,
643
- contents: (H = Object.values(A)) == null ? void 0 : H[0],
644
- selectLabel: P == null ? void 0 : P[1]
645
- });
646
- }
647
- return A;
648
- }), c.contents = D, c;
649
- })), g;
650
- }), C;
651
- } catch {
652
- return !1;
653
- }
654
- }, ft = { class: "system-wrap" }, dt = {
655
- key: 0,
656
- class: "show-content"
657
- }, yt = {
658
- key: 0,
659
- class: "item-menu-content"
660
- }, gt = {
661
- key: 0,
662
- class: "item-view-group"
663
- }, kt = {
664
- __name: "index",
665
- props: {
666
- content: String,
667
- jsonContents: Array
668
- },
669
- emits: ["change", "contentChange"],
670
- setup(t, { emit: r }) {
671
- const s = t, e = r, l = de(ee);
672
- De(ee);
673
- const p = S(!0), m = ye(), k = S(!0), { itemData: f } = te(l), o = je(ee), { activeMenuPath: n, activeMenuOpenPaths: M, menuTriggerType: C, menus: g } = te(m), { selectIndex: J, selectTitle: c } = te(o), D = S([]), $ = S([]), A = (h) => {
674
- var d, i, y;
675
- const u = (d = f.value) == null ? void 0 : d.find((b) => b.name === n.value);
676
- $.value = (y = (i = u == null ? void 0 : u.compData) == null ? void 0 : i[0]) == null ? void 0 : y.contents, k.value = !0, k.value && (k.value = !1), e("change", {
677
- wholeValue: D.value,
678
- editValue: h
679
- });
680
- }, x = (h) => {
681
- var _, N, T;
682
- const u = a(D.value), d = u == null ? void 0 : u.map((j, W) => (W === (h == null ? void 0 : h.index) && (j.compData = h == null ? void 0 : h.contents), j));
683
- let i = "";
684
- (N = (_ = a(d)) == null ? void 0 : _.filter((j) => (j == null ? void 0 : j.comp) === "Form")) == null || N.forEach((j) => {
685
- var W;
686
- (W = j == null ? void 0 : j.compData) == null || W.forEach((G) => {
687
- var B;
688
- (G == null ? void 0 : G.key) === "formContent" && ((B = G == null ? void 0 : G.contents) == null || B.forEach((H) => {
689
- H.value !== "" && (i = i === "" ? H == null ? void 0 : H.value : i + "-" + (H == null ? void 0 : H.value));
690
- }));
691
- });
692
- });
693
- let y = c == null ? void 0 : c.value;
694
- (y == null ? void 0 : y.length) > 0 ? y[0] = { key: "main", value: i } : (Array.isArray(y) || (y = []), y.push({ key: "main", value: i })), o.setSelectTitle(y), p.value = !1, D.value = d;
695
- const b = (T = f.value) == null ? void 0 : T.map((j, W) => {
696
- var G;
697
- return j.name === n.value && (j.compData = (G = j.compData) == null ? void 0 : G.map((B) => ((B == null ? void 0 : B.key) === "groupContents" && (B.contents = D.value), B))), j;
698
- });
699
- l.setItemData(b), k.value && (k.value = !1), e("contentChange", {
700
- wholeContent: f.value
701
- });
702
- }, U = (h) => {
703
- var u, d;
704
- if ((h == null ? void 0 : h.key) === "main")
705
- o.setSelectIndex(""), o.setSelectMenu(""), o.setSelectTitle((u = c.value) == null ? void 0 : u[0]);
706
- else {
707
- const i = [];
708
- let y = -1;
709
- (d = c.value) == null || d.forEach((b, _) => {
710
- (b == null ? void 0 : b.key) === (h == null ? void 0 : h.key) && (y = _), (y === -1 || y >= _) && i.push(b);
711
- }), o.setSelectTitle(i), o.setSelectMenu(h == null ? void 0 : h.key);
712
- }
713
- };
714
- v(
715
- () => f.value,
716
- () => {
717
- var u, d, i, y, b, _, N, T;
718
- if (!f.value || ((u = f.value) == null ? void 0 : u.length) === 0 || !p.value) return;
719
- let h = null;
720
- if (!n.value && Array.isArray(f.value))
721
- h = (i = (d = a(f.value)) == null ? void 0 : d.filter((j) => (j == null ? void 0 : j.comp) === "Group")) == null ? void 0 : i[0], m.setActiveMenuPath(h == null ? void 0 : h.name);
722
- else if (Array.isArray(f.value)) {
723
- const j = (y = a(f.value)) == null ? void 0 : y.filter((W) => (W == null ? void 0 : W.comp) === "Group");
724
- h = j == null ? void 0 : j.find((W) => W.name === n.value);
725
- }
726
- $.value = (_ = (b = h == null ? void 0 : h.compData) == null ? void 0 : b[0]) == null ? void 0 : _.contents, D.value = (T = (N = h == null ? void 0 : h.compData) == null ? void 0 : N[0]) == null ? void 0 : T.contents, console.log("itemData监听", h, n.value, f.value);
727
- },
728
- { deep: !0, immediate: !0 }
729
- ), v(() => n.value, (h) => {
730
- var u, d, i, y, b, _;
731
- if (h) {
732
- const N = (u = a(f.value)) == null ? void 0 : u.find((T) => T.name === h);
733
- if (h && N) {
734
- $.value = (i = (d = N == null ? void 0 : N.compData) == null ? void 0 : d[0]) == null ? void 0 : i.contents, D.value = (b = (y = N == null ? void 0 : N.compData) == null ? void 0 : y[0]) == null ? void 0 : b.contents, console.log("点击-新-data:", h, $.value);
735
- const T = (_ = $.value) == null ? void 0 : _.filter((j) => j.comp === "Form");
736
- We(T);
737
- } else
738
- $.value = [], D.value = [];
739
- o.setSelectTitle([]), o.setSelectIndex(""), o.setSelectMenu("");
740
- }
741
- }, {
742
- immediate: !0
743
- }), v(
744
- () => [s == null ? void 0 : s.content, s == null ? void 0 : s.jsonContents],
745
- () => {
746
- var y, b, _, N;
747
- if (((y = s == null ? void 0 : s.jsonContents) == null ? void 0 : y.length) > 0) {
748
- l.setOriginalData(s == null ? void 0 : s.jsonContents), l.setItemData(s == null ? void 0 : s.jsonContents);
749
- return;
750
- }
751
- if (!(s != null && s.content) || ((b = s == null ? void 0 : s.content) == null ? void 0 : b.length) === 0) return;
752
- p.value = !0;
753
- let h, u = [];
754
- (N = (_ = s == null ? void 0 : s.content) == null ? void 0 : _.filter((T) => T !== "")) == null || N.forEach((T) => {
755
- Oe(T) ? u.push(_e(T)) : pe(T) ? u.push(pe(T)) : u.push(mt(T));
756
- }), h = u[0];
757
- const d = Array.isArray(h) && (h == null ? void 0 : h.find((T) => {
758
- var j;
759
- return ((j = T.comp) == null ? void 0 : j.toUpperCase()) === "MENU";
760
- }));
761
- m.setRawMenu(d ?? {});
762
- const i = Array.isArray(h) && (h == null ? void 0 : h.find((T) => {
763
- var j;
764
- return ((j = T.comp) == null ? void 0 : j.toUpperCase()) === "SYSTEM";
765
- }));
766
- m.setSystemKey((i == null ? void 0 : i.name) ?? ""), l.setOriginalData(h), l.setItemData(h);
767
- },
768
- { deep: !0, immediate: !0 }
769
- );
770
- const I = (h) => Ue(h);
771
- return (h, u) => {
772
- var d, i;
773
- return w(), L("div", ft, [
774
- se(Ie, { class: "sys-aside" }),
775
- ((d = $.value) == null ? void 0 : d.length) > 0 ? (w(), L("div", dt, [
776
- ((i = Q(c)) == null ? void 0 : i.length) > 1 ? (w(), L("div", yt, [
777
- (w(), oe(Fe, {
778
- key: Q(c),
779
- breadArray: Q(c),
780
- onClick: U
781
- }, null, 8, ["breadArray"]))
782
- ])) : z("", !0),
783
- (w(!0), L(me, null, fe($.value, (y, b) => (w(), L("div", {
784
- class: "item-content",
785
- key: b
786
- }, [
787
- Q(J) === "" || b.toString() === Q(J) ? (w(), L("div", gt, re(y.name), 1)) : z("", !0),
788
- Q(J) === "" || b.toString() === Q(J) ? (w(), oe(Ae(I(y.comp)), {
789
- itemData: y == null ? void 0 : y.compData,
790
- childItemData: y == null ? void 0 : y.itemChildData,
791
- key: b,
792
- onChange: A,
793
- index: b,
794
- onContentChange: x
795
- }, null, 40, ["itemData", "childItemData", "index"])) : z("", !0)
796
- ]))), 128))
797
- ])) : z("", !0)
798
- ]);
799
- };
800
- }
801
- }, $t = /* @__PURE__ */ ie(kt, [["__scopeId", "data-v-a3c7f525"]]), Ct = { class: "add-model-content" }, bt = {
802
- key: 0,
803
- class: "model-import-data"
804
- }, At = { class: "import-button" }, Dt = { key: 0 }, jt = {
805
- key: 1,
806
- class: "model-operate"
807
- }, Ot = { class: "model-select" }, _t = { class: "model-fill" }, Ut = {
808
- key: 2,
809
- class: "model-view"
810
- }, Et = {
811
- __name: "index",
812
- props: {
813
- mode: {
814
- type: String,
815
- default: "view"
816
- },
817
- content: {
818
- type: String,
819
- default: ""
820
- },
821
- jsonContents: {
822
- type: Array,
823
- default: () => []
824
- },
825
- showButton: {
826
- type: Boolean,
827
- default: !0
828
- }
829
- },
830
- emits: ["change", "contentChange"],
831
- setup(t, { emit: r }) {
832
- const s = t, e = r, l = S([]), p = S([]), m = S([]), k = S(0), f = de(ee), o = ye(ee), { itemData: n, originalData: M } = te(f), { activeMenuPath: C } = te(o), g = S(null), J = S(0), c = S([]), D = S(""), $ = S(0), A = (u) => {
833
- e("contentChange", u);
834
- }, x = (u) => {
835
- var i;
836
- const d = (i = a(u == null ? void 0 : u.wholeValue)) == null ? void 0 : i.map((y) => {
837
- var b;
838
- return (y == null ? void 0 : y.comp) === "Form" && (y.compData = (b = y.compData) == null ? void 0 : b.map((_) => ((_ == null ? void 0 : _.key) === "formContent" && (_.contents = xe(_ == null ? void 0 : _.contents)), _))), y;
839
- });
840
- e("change", {
841
- originalContents: M.value,
842
- currentContents: u == null ? void 0 : u.wholeValue,
843
- editContent: u == null ? void 0 : u.editValue,
844
- arrayToContents: d
845
- });
846
- };
847
- v(
848
- () => p.value,
849
- () => {
850
- $.value === p.value.length && p.value.length !== 0 && (l.value = p.value);
851
- },
852
- { deep: !0, immediate: !0 }
853
- );
854
- const U = () => {
855
- g.value.click();
856
- }, I = async (u) => {
857
- const d = u.target.files;
858
- if (!d) return;
859
- new FileReader(), l.value = [], p.value = [], $.value = d.length;
860
- const i = Array.from(d).map(async (y) => await new Promise((b) => {
861
- const _ = new FileReader();
862
- _.onload = (N) => {
863
- try {
864
- p.value.push(N.target.result), c.value = h(N.target.result), J.value++;
865
- } catch (T) {
866
- console.error("解析失败:", T);
867
- return;
868
- }
869
- }, _.onerror = () => b(`读取 ${y.name} 失败`), _.readAsText(y);
870
- }));
871
- await Promise.all(i);
872
- };
873
- v(
874
- () => [s == null ? void 0 : s.content, s == null ? void 0 : s.jsonContents],
875
- () => {
876
- l.value.push(s == null ? void 0 : s.content), m.value = s == null ? void 0 : s.jsonContents;
877
- },
878
- { deep: !0, immediate: !0 }
879
- ), v(
880
- () => J.value,
881
- () => {
882
- var u;
883
- ((u = c.value) == null ? void 0 : u.length) !== 0 && (f.setOriginalData(c.value), f.setItemData(c.value));
884
- },
885
- { deep: !0, immediate: !0 }
886
- );
887
- const h = (u) => {
888
- let d = u.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
889
- d = d.replace(/(\w+)\s*:/g, "$1:"), d = d.replace(/\r\n/g, "").replace(/\n/g, "").replace(/\t/g, "").replace(/\s+/g, " ").trim(), d = d.replace(/,\s*([}\]])/g, "$1"), d = d.replace(/:(\s*)([^"{}\[\],\s]+)(\s*)([,}])/g, ": $2$4");
890
- try {
891
- return JSON.parse(d);
892
- } catch (i) {
893
- try {
894
- const b = new Function(`return ${d}`)();
895
- if (Array.isArray(b) || typeof b == "object")
896
- return b;
897
- throw new Error(`解析结果不是有效的数组或对象: ${i}`);
898
- } catch (y) {
899
- throw new Error(`无法解析JSON: ${y.message}`);
900
- }
901
- }
902
- };
903
- return (u, d) => {
904
- var i;
905
- return w(), L("div", Ct, [
906
- ((i = s == null ? void 0 : s.jsonContents) == null ? void 0 : i.length) === 0 && (s != null && s.showButton) ? (w(), L("div", bt, [
907
- X("div", At, [
908
- X("input", {
909
- type: "file",
910
- ref_key: "fileInput",
911
- ref: g,
912
- accept: ".txt, .inm",
913
- onChange: I,
914
- style: { display: "none" },
915
- multiple: ""
916
- }, null, 544),
917
- X("button", {
918
- onClick: U,
919
- class: "import-button-content"
920
- }, "导入文件"),
921
- D.value ? (w(), L("span", Dt, re(D.value), 1)) : z("", !0)
922
- ])
923
- ])) : z("", !0),
924
- (s == null ? void 0 : s.mode) === "edit" ? (w(), L("div", jt, [
925
- X("div", Ot, [
926
- se(Ee)
927
- ]),
928
- (w(), L("div", {
929
- class: "model-show",
930
- key: k.value
931
- }, [
932
- se(Me)
933
- ])),
934
- X("div", _t, [
935
- se(Te)
936
- ])
937
- ])) : z("", !0),
938
- (s == null ? void 0 : s.mode) === "view" ? (w(), L("div", Ut, [
939
- (w(), oe($t, {
940
- content: l.value,
941
- onChange: x,
942
- jsonContents: m.value,
943
- onContentChange: A,
944
- key: k.value
945
- }, null, 8, ["content", "jsonContents"]))
946
- ])) : z("", !0)
947
- ]);
948
- };
949
- }
950
- }, wt = /* @__PURE__ */ ie(Et, [["__scopeId", "data-v-245fc653"]]);
951
- export {
952
- wt as default
953
- };