ss-component-new 1.1.74 → 1.1.76

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,131 +0,0 @@
1
- import { createElementBlock as r, openBlock as n, Fragment as k, renderList as y, unref as F, createElementVNode as c, createBlock as f, resolveDynamicComponent as $, toDisplayString as C, ref as I, watch as L, resolveComponent as b, createVNode as R, withCtx as g, createCommentVNode as T } from "vue";
2
- import { p as V, s as U, g as M } from "./array-vzwMZhM4.js";
3
- import { E as j } from "./index-TqZwOJHG.js";
4
- import { u as w } from "./modelComp-B2WEXyGq.js";
5
- import { s as x } from "./menu-CD2KJPvR.js";
6
- import { _ as E } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
- import { c as v } from "./cloneDeep-DA0SrY7X.js";
8
- const q = { class: "type-select" }, z = ["onClick"], A = { class: "list-icon" }, G = {
9
- __name: "index",
10
- setup(N) {
11
- const m = w(V), { itemData: o } = x(m), p = (t) => j[t], _ = (t) => {
12
- const d = v(o.value);
13
- d.push({
14
- comp: t.comp,
15
- name: t.name,
16
- compData: []
17
- }), m.setItemData(d);
18
- };
19
- return (t, d) => (n(), r("div", q, [
20
- (n(!0), r(k, null, y(F(U), (l, e) => (n(), r("div", {
21
- class: "type-list",
22
- key: e
23
- }, [
24
- c("div", {
25
- class: "list-content",
26
- onClick: (s) => _(l)
27
- }, [
28
- c("div", A, [
29
- (n(), f($(p(l.icon))))
30
- ]),
31
- c("div", null, C(l.name), 1)
32
- ], 8, z)
33
- ]))), 128))
34
- ]));
35
- }
36
- }, se = /* @__PURE__ */ E(G, [["__scopeId", "data-v-fe4aecc8"]]), H = { class: "fill-content" }, J = { class: "operate-content" }, K = { class: "collapse-title" }, P = { class: "comp-child" }, Q = {
37
- __name: "index",
38
- setup(N) {
39
- const m = w(V), { itemData: o, originalData: p } = x(m), _ = I([]), t = I([]);
40
- L(
41
- () => o.value,
42
- () => {
43
- var e;
44
- !o.value || ((e = o.value) == null ? void 0 : e.length) === 0 || (_.value = v(o.value));
45
- },
46
- { deep: !0, immediate: !0 }
47
- );
48
- const d = (e) => M(e), l = (e, s, D) => {
49
- if (!e || e.length === 0) return;
50
- let i = v(o.value);
51
- const a = v(s);
52
- a.compData = e, i = i == null ? void 0 : i.map((u, h) => (h === D && (u = a), u)), m.setItemData(i);
53
- };
54
- return (e, s) => {
55
- const D = b("el-collapse-item"), i = b("el-collapse");
56
- return n(), r("div", H, [
57
- s[1] || (s[1] = c("div", { class: "fill-operate" }, C("操作栏"), -1)),
58
- c("div", J, [
59
- R(i, {
60
- modelValue: t.value,
61
- "onUpdate:modelValue": s[0] || (s[0] = (a) => t.value = a),
62
- class: "collapse-content"
63
- }, {
64
- default: g(() => [
65
- (n(!0), r(k, null, y(_.value, (a, u) => (n(), f(D, {
66
- key: u,
67
- name: u
68
- }, {
69
- title: g(() => [
70
- c("div", K, C(a.name), 1)
71
- ]),
72
- default: g(() => {
73
- var h, B;
74
- return [
75
- c("div", P, [
76
- (n(), f($(d(a.comp + "Operate")), {
77
- itemContents: a == null ? void 0 : a.compData,
78
- originalItemContents: (B = (h = F(p)) == null ? void 0 : h.find((S, O) => O === u)) == null ? void 0 : B.compData,
79
- onChange: (S) => l(S, a, u)
80
- }, null, 40, ["itemContents", "originalItemContents", "onChange"]))
81
- ])
82
- ];
83
- }),
84
- _: 2
85
- }, 1032, ["name"]))), 128))
86
- ]),
87
- _: 1
88
- }, 8, ["modelValue"])
89
- ])
90
- ]);
91
- };
92
- }
93
- }, le = /* @__PURE__ */ E(Q, [["__scopeId", "data-v-a216b035"]]), W = {
94
- key: 0,
95
- class: "show-content"
96
- }, X = {
97
- __name: "index",
98
- setup(N) {
99
- const m = w(V), { itemData: o } = x(m), p = I([]);
100
- L(
101
- () => o.value,
102
- () => {
103
- var t;
104
- !o.value || ((t = o.value) == null ? void 0 : t.length) === 0 || (p.value = v(o.value));
105
- },
106
- { deep: !0, immediate: !0 }
107
- );
108
- const _ = (t) => M(t);
109
- return (t, d) => {
110
- var l;
111
- return ((l = p.value) == null ? void 0 : l.length) > 0 ? (n(), r("div", W, [
112
- (n(!0), r(k, null, y(p.value, (e, s) => (n(), r("div", {
113
- class: "item-content",
114
- key: s
115
- }, [
116
- c("div", null, C(e.name), 1),
117
- (n(), f($(_(e.comp)), {
118
- itemData: e == null ? void 0 : e.compData,
119
- childItemData: e == null ? void 0 : e.itemChildData,
120
- key: s
121
- }, null, 8, ["itemData", "childItemData"]))
122
- ]))), 128))
123
- ])) : T("", !0);
124
- };
125
- }
126
- }, ce = /* @__PURE__ */ E(X, [["__scopeId", "data-v-79320497"]]);
127
- export {
128
- ce as a,
129
- le as b,
130
- se as m
131
- };
@@ -1,254 +0,0 @@
1
- import { v as M, c as x } from "./array-vzwMZhM4.js";
2
- import { ref as Y } from "vue";
3
- import { c as l } from "./cloneDeep-DA0SrY7X.js";
4
- const L = Y(0), Z = (e) => {
5
- let s;
6
- e.includes(`\r
7
- `) ? s = e.split(`\r
8
- `).filter((t) => t.trim() !== "") : s = e.split(`
9
- `).filter((t) => t.trim() !== "");
10
- const p = [];
11
- let r = "";
12
- for (const t of s)
13
- t.includes("{") || r.includes("{") || t.includes("[") || r.includes("[") || t.includes("【") || r.includes("【") || t.includes("(") || r.includes("(") || t.includes("(") || r.includes("(") || t.includes("/*") || r.includes("/*") ? (r += t.trim(), l(r).split("{").length - 1 === l(r).split("}").length - 1 && l(r).split("【").length - 1 === l(r).split("】").length - 1 && l(r).split("[").length - 1 === l(r).split("]").length - 1 && l(r).split("(").length - 1 === l(r).split(")").length - 1 && l(r).split("(").length - 1 === l(r).split(")").length - 1 && l(r).split("/*").length - 1 === l(r).split("*/").length - 1 && (p.push(r), r = "")) : p.push(t.trim());
14
- return p;
15
- }, _ = (e) => {
16
- const [s, p] = e.split(/=(.+)/), r = s.replace(/['"]/g, "").trim(), t = p.replace(/^['"]|['"]$/g, "");
17
- return { key: r, value: t };
18
- }, V = (e) => {
19
- try {
20
- return JSON.parse(e), !0;
21
- } catch {
22
- return !1;
23
- }
24
- }, R = (e) => {
25
- try {
26
- const s = e.replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",").replace(/:/g, ":").replace(/:\s*(?=,|}|$)/g, ': ""');
27
- if (l(s).split("{").length - 1 > 1) {
28
- let p = l(s).replace(/^\{(.*)\}$/, "[$1]");
29
- if (V(p) && !p.includes("$") || (p = p.replace(/"([^"]+)"\$([\w\u4e00-\u9fa5]+\([^)]*\))/g, '"$1$$$2"')), V(p)) {
30
- const r = JSON.parse(p);
31
- let t = [];
32
- return r == null || r.forEach((o) => {
33
- var y;
34
- (y = Object.entries(l(o))) == null || y.forEach((i) => {
35
- L.value++, t.push({
36
- id: L.value,
37
- key: (i == null ? void 0 : i[0]) ?? "",
38
- value: (i == null ? void 0 : i[1]) === "" ? "" : i == null ? void 0 : i[1],
39
- // 如果值为空,则key设为空字符串,否则保留原值
40
- width: Object.keys(l(o)).length
41
- });
42
- });
43
- }), t;
44
- } else
45
- return console.error("转换类型不正确:"), [];
46
- } else if (V(s)) {
47
- const p = JSON.parse(s);
48
- return Object.entries(p).map(([r, t]) => (L.value++, {
49
- id: L.value,
50
- key: r,
51
- value: t === "" ? "" : t,
52
- // 如果值为空,则key设为空字符串,否则保留原值
53
- width: 1
54
- }));
55
- } else
56
- return s;
57
- } catch (s) {
58
- return console.error("转换失败:", s), [];
59
- }
60
- }, w = (e, s) => {
61
- var p;
62
- try {
63
- if ((p = M) != null && p.find((r) => (r == null ? void 0 : r.key) === s))
64
- return e.replace(/['"]/g, "").trim();
65
- if (l(e).split("[").length - 1 > 1) {
66
- const r = l(e).replace(/[’]|[‘]|[']/g, '"').replaceAll(/,/g, ",").replaceAll("(", "[").replaceAll(")", "]").replaceAll("],]", "]]");
67
- return JSON.parse(r);
68
- } else {
69
- const r = l(e).replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",");
70
- if (V(r)) {
71
- const t = JSON.parse(r);
72
- return Array.isArray(t) ? t.map((o) => ({ label: o })) : t;
73
- } else
74
- return R(l(e));
75
- }
76
- } catch (r) {
77
- return console.error("解析失败:", r), e;
78
- }
79
- }, S = (e) => ({ [e == null ? void 0 : e.key]: w(e == null ? void 0 : e.value, e == null ? void 0 : e.key) }), v = (e) => {
80
- try {
81
- if (l(e).split("[").length - 1 > 1) {
82
- const s = l(e).replace(/[’]|[‘]|[']/g, '"').replaceAll(/,/g, ",").replaceAll("(", "[").replaceAll(")", "]").replaceAll("],]", "]]");
83
- return JSON.parse(s);
84
- } else
85
- return JSON.parse(l(e).replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",")).map((p) => ({ label: p }));
86
- } catch (s) {
87
- return console.error("解析失败:", s), e;
88
- }
89
- }, ee = (e) => {
90
- const s = e.match(/\(([^)]+)\)/);
91
- return s ? s[1] : "";
92
- }, re = (e) => {
93
- const s = e.match(/^([^(]+)\s*\(/);
94
- return s ? s[1].trim() : e;
95
- }, Q = (e) => e.replace(/'/g, "").replace(/"/g, "").replace(/{|}/g, "").split(":").map((s) => s.trim()).filter((s) => s).join("/"), te = (e) => {
96
- var y, i;
97
- let s = [], p = [];
98
- const r = (y = l(e)) == null ? void 0 : y.map((d) => d == null ? void 0 : d.key), t = [...new Set((i = l(r)) == null ? void 0 : i.map((d) => ee(d)))];
99
- t == null || t.forEach((d) => {
100
- let U = e == null ? void 0 : e.filter((u) => u.key.includes(d));
101
- U == null || U.forEach((u) => {
102
- u != null && u.key.includes("Menus") && (s.push({
103
- key: "GroupName",
104
- value: Q(u == null ? void 0 : u.value)
105
- }), p.push(Q(u == null ? void 0 : u.value)));
106
- });
107
- let C = e == null ? void 0 : e.filter((u) => u.key.includes(d) && !(u != null && u.key.includes("Menus")));
108
- C = C == null ? void 0 : C.map((u) => (u.key = re(u.key), u));
109
- const P = {
110
- key: "GroupContents",
111
- value: C
112
- };
113
- s.push(P);
114
- });
115
- const o = {
116
- key: "Menus",
117
- value: p
118
- };
119
- return s.unshift(o), s;
120
- }, X = (e) => {
121
- var s, p;
122
- if (Array.isArray(Object.keys(e)) && ((s = Object.keys(e)) == null ? void 0 : s.length) > 0) {
123
- let r = [];
124
- return (p = Object.entries(e)) == null || p.forEach(([t, o]) => {
125
- var i, d;
126
- let y = [];
127
- if (y.push(t), ((i = Object.keys(o)) == null ? void 0 : i.length) > 0) {
128
- let U = [];
129
- U.push((d = X(o)) == null ? void 0 : d[0]), y.push(U == null ? void 0 : U[0]);
130
- }
131
- r.push(y);
132
- }), r;
133
- }
134
- }, se = (e, s) => {
135
- var r;
136
- let p = s;
137
- return Array.isArray(Object.keys(e)) && ((r = Object.entries(e)) == null || r.forEach(([t, o]) => {
138
- let y = [t];
139
- if (typeof o == "object" && o !== null) {
140
- let i = X(o);
141
- i == null || i.forEach((d) => {
142
- y.push(d);
143
- });
144
- }
145
- p.push(y);
146
- })), p;
147
- }, ce = (e) => {
148
- const s = {};
149
- return e.forEach((r) => {
150
- const t = r.split("/");
151
- let o = s;
152
- t.forEach((y) => {
153
- o[y] || (o[y] = {}), o = o[y];
154
- });
155
- }), se(s, []);
156
- }, le = (e) => ce(e), ue = (e) => {
157
- var y, i, d, U, C, P, u;
158
- const s = Z((i = (y = l(e)) == null ? void 0 : y.replace("(", "(")) == null ? void 0 : i.replace(")", ")")), p = (U = (d = l(s)) == null ? void 0 : d.filter((c) => !c.includes("/*"))) == null ? void 0 : U.map((c) => _(c)), r = te(p), t = [];
159
- (C = l(r)) == null || C.forEach((c) => {
160
- var D, n, a, $, b, E, g, J, N;
161
- (D = M) != null && D.find((h) => {
162
- var m, k;
163
- return ((m = h == null ? void 0 : h.key) == null ? void 0 : m.toUpperCase()) === ((k = c == null ? void 0 : c.key) == null ? void 0 : k.toUpperCase());
164
- }) ? t.push({
165
- comp: ((a = (n = M) == null ? void 0 : n.find((h) => {
166
- var m, k;
167
- return ((m = h == null ? void 0 : h.key) == null ? void 0 : m.toUpperCase()) === ((k = c == null ? void 0 : c.key) == null ? void 0 : k.toUpperCase());
168
- })) == null ? void 0 : a.value) ?? "",
169
- name: ($ = c == null ? void 0 : c.value) == null ? void 0 : $.replace(/[’]|[‘]|[']/g, ""),
170
- compData: []
171
- }) : (b = x) != null && b.find((h) => {
172
- var m, k;
173
- return ((m = h == null ? void 0 : h.key) == null ? void 0 : m.toUpperCase()) === ((k = c == null ? void 0 : c.key) == null ? void 0 : k.toUpperCase());
174
- }) && ((t == null ? void 0 : t.length) === 0 && (E = c.key) != null && E.includes("Menus") && t.push({
175
- comp: "Menu",
176
- name: "",
177
- compData: []
178
- }), (g = t == null ? void 0 : t[(t == null ? void 0 : t.length) - 1]) != null && g.compData && t[(t == null ? void 0 : t.length) - 1].compData.push({
179
- key: (N = (J = x) == null ? void 0 : J.find((h) => {
180
- var m, k;
181
- return ((m = h == null ? void 0 : h.key) == null ? void 0 : m.toUpperCase()) === ((k = c == null ? void 0 : c.key) == null ? void 0 : k.toUpperCase());
182
- })) == null ? void 0 : N.value,
183
- contents: c == null ? void 0 : c.value
184
- }));
185
- });
186
- let o = (P = l(t)) == null ? void 0 : P.map((c) => {
187
- var D;
188
- return c != null && c.compData && (c.compData = (D = c == null ? void 0 : c.compData) == null ? void 0 : D.map((n) => {
189
- var a, $, b, E, g, J, N, h, m, k, T;
190
- if ((n == null ? void 0 : n.key) === "formFlex")
191
- n.contents = (($ = (a = n.contents) == null ? void 0 : a.replace(/[’]|[‘]|[']/g, "")) == null ? void 0 : $.toUpperCase()) !== "Vertical".toUpperCase();
192
- else if ((n == null ? void 0 : n.key) === "groupContents")
193
- n.contents = (b = l(n.contents)) == null ? void 0 : b.map((G) => S(l(G)));
194
- else if (Array.isArray(n == null ? void 0 : n.contents))
195
- n.contents = le(n.contents);
196
- else if (((g = (E = n == null ? void 0 : n.contents) == null ? void 0 : E.trim()) != null && g.startsWith("[") || (N = (J = n.contents) == null ? void 0 : J.trim()) != null && N.startsWith("【")) && ((m = (h = n.contents) == null ? void 0 : h.trim()) != null && m.endsWith("]") || (T = (k = n.contents) == null ? void 0 : k.trim()) != null && T.endsWith("】")))
197
- n.contents = v(l(n.contents));
198
- else {
199
- if (!n.contents) return;
200
- n.contents = R(l(n.contents));
201
- }
202
- return n;
203
- })), c;
204
- });
205
- return o = (u = l(o)) == null ? void 0 : u.map((c) => {
206
- var D;
207
- return (c == null ? void 0 : c.comp) === "Group" && (c.compData = (D = c.compData) == null ? void 0 : D.map((n) => {
208
- var $;
209
- let a = [];
210
- return ($ = n.contents) == null || $.forEach((b) => {
211
- var E, g, J, N, h, m, k, T, G, W, I, F, H, q, z, B, K;
212
- if ((E = M) != null && E.find((f) => {
213
- var O, j, A;
214
- return ((O = f == null ? void 0 : f.key) == null ? void 0 : O.toUpperCase()) === ((A = (j = Object.keys(b)) == null ? void 0 : j[0]) == null ? void 0 : A.toUpperCase());
215
- }))
216
- a.push({
217
- comp: (J = (g = M) == null ? void 0 : g.find((f) => {
218
- var O, j, A;
219
- return ((O = f == null ? void 0 : f.key) == null ? void 0 : O.toUpperCase()) === ((A = (j = Object.keys(b)) == null ? void 0 : j[0]) == null ? void 0 : A.toUpperCase());
220
- })) == null ? void 0 : J.value,
221
- name: (h = (N = Object.values(b)) == null ? void 0 : N[0]) == null ? void 0 : h.replace(/[’]|[‘]|[']/g, ""),
222
- compData: []
223
- });
224
- else if ((m = x) != null && m.find((f) => {
225
- var O, j, A;
226
- return ((O = f == null ? void 0 : f.key) == null ? void 0 : O.toUpperCase()) === ((A = (j = Object.keys(b)) == null ? void 0 : j[0]) == null ? void 0 : A.toUpperCase());
227
- })) {
228
- if ((a == null ? void 0 : a.length) === 0) return;
229
- (k = a == null ? void 0 : a[(a == null ? void 0 : a.length) - 1]) != null && k.compData && a[(a == null ? void 0 : a.length) - 1].compData.push({
230
- key: (G = (T = x) == null ? void 0 : T.find((f) => {
231
- var O, j, A;
232
- return ((O = f == null ? void 0 : f.key) == null ? void 0 : O.toUpperCase()) === ((A = (j = Object.keys(b)) == null ? void 0 : j[0]) == null ? void 0 : A.toUpperCase());
233
- })) == null ? void 0 : G.value,
234
- contents: (W = Object.values(b)) == null ? void 0 : W[0]
235
- });
236
- } else if ((F = (I = Object.keys(b)) == null ? void 0 : I[0]) != null && F.includes("$")) {
237
- const f = (q = (H = Object.keys(l(b))) == null ? void 0 : H[0]) == null ? void 0 : q.split("$");
238
- a[(a == null ? void 0 : a.length) - 1].compData.push({
239
- key: (B = (z = x) == null ? void 0 : z.find((O) => {
240
- var j, A;
241
- return ((j = O == null ? void 0 : O.key) == null ? void 0 : j.toUpperCase()) === ((A = f == null ? void 0 : f[0]) == null ? void 0 : A.toUpperCase());
242
- })) == null ? void 0 : B.value,
243
- contents: (K = Object.values(b)) == null ? void 0 : K[0],
244
- selectLabel: f == null ? void 0 : f[1]
245
- });
246
- }
247
- return b;
248
- }), n.contents = a, n;
249
- })), c;
250
- }), o;
251
- };
252
- export {
253
- ue as e
254
- };
@@ -1,288 +0,0 @@
1
- import { ref as _, watch as V, createElementBlock as C, createCommentVNode as I, openBlock as f, Fragment as le, renderList as se, createElementVNode as O, createBlock as Z, toDisplayString as v, resolveDynamicComponent as ue, onMounted as ce, createVNode as A } from "vue";
2
- import { m as ie, a as me, b as de } from "./index-DtuPN0eZ.js";
3
- import { p as E, e as ye, g as fe, a as ge } from "./array-vzwMZhM4.js";
4
- import { u as ee } from "./modelComp-B2WEXyGq.js";
5
- import { s as te, u as he } from "./menu-CD2KJPvR.js";
6
- import { _ as ne } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
- import { c as k } from "./cloneDeep-DA0SrY7X.js";
8
- const x = [
9
- {
10
- key: "FormName",
11
- value: "Form"
12
- },
13
- {
14
- key: "TableName",
15
- value: "Table"
16
- }
17
- ], s = [
18
- {
19
- key: "FormDirect",
20
- value: "formFlex"
21
- },
22
- {
23
- key: "Form",
24
- value: "formContent"
25
- },
26
- {
27
- key: "FormButton",
28
- value: "formButton"
29
- },
30
- {
31
- key: "TableColumns",
32
- value: "header"
33
- },
34
- {
35
- key: "TableButton",
36
- value: "extraButton"
37
- },
38
- {
39
- key: "LineButton",
40
- value: "rowButton"
41
- },
42
- {
43
- key: "Table",
44
- value: "tableContents"
45
- },
46
- {
47
- key: "TableIndex",
48
- value: "tableIndex"
49
- }
50
- ], ke = {
51
- key: 0,
52
- class: "show-content"
53
- }, _e = { class: "item-view-group" }, Ce = {
54
- __name: "index",
55
- props: {
56
- content: String,
57
- jsonContents: Array
58
- },
59
- emits: ["change"],
60
- setup(F, { emit: B }) {
61
- const e = F, $ = B, h = ee(E), { itemData: p } = te(h), b = _([]), w = _([]), L = (l) => {
62
- $("change", {
63
- wholeValue: b.value,
64
- editValue: l
65
- });
66
- }, D = (l) => {
67
- const g = k(b.value), S = g == null ? void 0 : g.map((c, j) => (j === (l == null ? void 0 : l.index) && (c.compData = l == null ? void 0 : l.contents), c));
68
- b.value = S;
69
- };
70
- V(
71
- () => p.value,
72
- () => {
73
- var l;
74
- !p.value || ((l = p.value) == null ? void 0 : l.length) === 0 || (w.value = p.value, b.value = p.value);
75
- },
76
- { deep: !0, immediate: !0 }
77
- ), V(
78
- () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
79
- () => {
80
- var g;
81
- if (((g = e == null ? void 0 : e.jsonContents) == null ? void 0 : g.length) > 0) {
82
- h.setOriginalData(e == null ? void 0 : e.jsonContents), h.setItemData(e == null ? void 0 : e.jsonContents);
83
- return;
84
- }
85
- if (!(e != null && e.content) || (e == null ? void 0 : e.content) === "") return;
86
- const l = ye(e == null ? void 0 : e.content);
87
- h.setOriginalData(l), h.setItemData(l);
88
- },
89
- { deep: !0, immediate: !0 }
90
- );
91
- const N = (l) => fe(l);
92
- return (l, g) => {
93
- var S;
94
- return ((S = w.value) == null ? void 0 : S.length) > 0 ? (f(), C("div", ke, [
95
- (f(!0), C(le, null, se(w.value, (c, j) => (f(), C("div", {
96
- class: "item-content",
97
- key: j
98
- }, [
99
- O("div", _e, v(c.name), 1),
100
- (f(), Z(ue(N(c.comp)), {
101
- itemData: c == null ? void 0 : c.compData,
102
- childItemData: c == null ? void 0 : c.itemChildData,
103
- key: j,
104
- onChange: L,
105
- index: j,
106
- onContentChange: D
107
- }, null, 40, ["itemData", "childItemData", "index"]))
108
- ]))), 128))
109
- ])) : I("", !0);
110
- };
111
- }
112
- }, pe = /* @__PURE__ */ ne(Ce, [["__scopeId", "data-v-869e6e20"]]), be = { class: "add-model-content" }, we = {
113
- key: 0,
114
- class: "model-import-data"
115
- }, je = { class: "import-button" }, Se = { key: 0 }, xe = {
116
- key: 1,
117
- class: "model-operate"
118
- }, Oe = { class: "model-select" }, Ie = { class: "model-fill" }, Ne = {
119
- key: 2,
120
- class: "model-view ssComponent"
121
- }, Te = {
122
- __name: "main",
123
- props: {
124
- mode: {
125
- type: String,
126
- default: "view"
127
- },
128
- content: {
129
- type: String,
130
- default: ""
131
- },
132
- jsonContents: {
133
- type: Array,
134
- default: () => []
135
- },
136
- showButton: {
137
- type: Boolean,
138
- default: !0
139
- }
140
- },
141
- emits: ["change"],
142
- setup(F, { emit: B }) {
143
- const e = F, $ = B, h = _(""), p = _([]), b = _(0), w = ee(E);
144
- he(E);
145
- const { itemData: L, originalData: D } = te(w), N = _(null), l = _(0), g = _(""), S = () => {
146
- b.value = window.innerWidth;
147
- }, c = async (o) => {
148
- var u;
149
- const a = (u = k(o == null ? void 0 : o.wholeValue)) == null ? void 0 : u.map((n) => {
150
- var d;
151
- return (n == null ? void 0 : n.comp) === "Form" && (n.compData = (d = n.compData) == null ? void 0 : d.map((y) => ((y == null ? void 0 : y.key) === "formContent" && (y.contents = ge(y == null ? void 0 : y.contents)), y))), n;
152
- });
153
- $("change", {
154
- originalContents: D.value,
155
- currentContents: o == null ? void 0 : o.wholeValue,
156
- editContent: o == null ? void 0 : o.editValue,
157
- stringContent: j(k(o == null ? void 0 : o.wholeValue)),
158
- arrayToContents: a
159
- });
160
- }, j = (o) => {
161
- var u;
162
- let a = [];
163
- return (u = k(o)) == null || u.forEach((n) => {
164
- var d, y;
165
- x != null && x.find((t) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.comp)) && a.push(((d = x == null ? void 0 : x.find((t) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.comp))) == null ? void 0 : d.key) + "=" + n.name + "/r/n"), (y = n == null ? void 0 : n.compData) == null || y.forEach((t) => {
166
- var M, R, z, W, q, G, H, K, P, Q, U, X;
167
- if (s != null && s.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key)))
168
- if (!((M = t == null ? void 0 : t.contents) != null && M.length))
169
- a.push(((R = s == null ? void 0 : s.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key))) == null ? void 0 : R.key) + "=" + (t.contents === !0 ? '""' : "Vertical") + "/r/n");
170
- else {
171
- let i = (z = t == null ? void 0 : t.contents) == null ? void 0 : z[0];
172
- if (!i) return;
173
- if (Object.keys(i).includes("label") && Object.keys(i).includes("key") && Object.keys(i).includes("width"))
174
- if (((q = (W = t.contents) == null ? void 0 : W.filter((m) => m.width !== 1)) == null ? void 0 : q.length) === 0) {
175
- const m = (G = k(t == null ? void 0 : t.contents)) == null ? void 0 : G.map((r) => ({ [r.label]: r.value }));
176
- a.push(((H = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : H.key) + "=" + JSON.stringify(m) + "/r/n");
177
- } else {
178
- let m = [];
179
- (K = k(t == null ? void 0 : t.contents)) == null || K.reduce((r, J) => {
180
- var Y;
181
- return r[J.label] = J.key, ((Y = Object.keys(k(r))) == null ? void 0 : Y.length) >= J.width && (m.push(k(r)), r = {}), r;
182
- }, {}), a.push(((P = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : P.key) + "=" + JSON.stringify(m) + "/r/n");
183
- }
184
- else if (Object.keys(i).includes("label")) {
185
- const m = (Q = k(t == null ? void 0 : t.contents)) == null ? void 0 : Q.map((r) => r.label);
186
- a.push(((U = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : U.key) + "=" + JSON.stringify(m) + "/r/n");
187
- } else
188
- a.push(((X = s == null ? void 0 : s.find((m) => (m == null ? void 0 : m.value) === (t == null ? void 0 : t.key))) == null ? void 0 : X.key) + "=" + JSON.stringify(t == null ? void 0 : t.contents) + "/r/n");
189
- }
190
- });
191
- }), JSON.stringify(a);
192
- }, T = _([]), ae = () => {
193
- N.value.click();
194
- }, oe = (o) => {
195
- const a = o.target.files[0];
196
- if (!a) return;
197
- const u = new FileReader();
198
- u.onload = (n) => {
199
- try {
200
- h.value = n.target.result, T.value = re(n.target.result), l.value++;
201
- } catch (d) {
202
- console.error("解析失败:", d);
203
- }
204
- }, u.onerror = (n) => {
205
- console.error("文件读取错误:", n);
206
- }, u.readAsText(a);
207
- };
208
- ce(() => {
209
- window.addEventListener("resize", S);
210
- }), V(
211
- () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
212
- () => {
213
- h.value = e == null ? void 0 : e.content, p.value = e == null ? void 0 : e.jsonContents;
214
- },
215
- { deep: !0, immediate: !0 }
216
- ), V(
217
- () => l.value,
218
- () => {
219
- var o;
220
- ((o = T.value) == null ? void 0 : o.length) !== 0 && (w.setOriginalData(T.value), w.setItemData(T.value));
221
- },
222
- { deep: !0, immediate: !0 }
223
- );
224
- const re = (o) => {
225
- let a = o.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
226
- a = a.replace(/(\w+)\s*:/g, "$1:"), a = a.replace(/\r\n/g, "").replace(/\n/g, "").replace(/\t/g, "").replace(/\s+/g, " ").trim(), a = a.replace(/,\s*([}\]])/g, "$1"), a = a.replace(/:(\s*)([^"{}\[\],\s]+)(\s*)([,}])/g, ": $2$4");
227
- try {
228
- return JSON.parse(a);
229
- } catch (u) {
230
- try {
231
- const d = new Function(`return ${a}`)();
232
- if (Array.isArray(d) || typeof d == "object")
233
- return d;
234
- throw new Error(`解析结果不是有效的数组或对象: ${u}`);
235
- } catch (n) {
236
- throw new Error(`无法解析JSON: ${n.message}`);
237
- }
238
- }
239
- };
240
- return (o, a) => {
241
- var u;
242
- return f(), C("div", be, [
243
- ((u = e == null ? void 0 : e.jsonContents) == null ? void 0 : u.length) === 0 ? (f(), C("div", we, [
244
- O("div", je, [
245
- O("input", {
246
- type: "file",
247
- ref_key: "fileInput",
248
- ref: N,
249
- accept: ".txt",
250
- onChange: oe,
251
- style: { display: "none" }
252
- }, null, 544),
253
- O("button", {
254
- onClick: ae,
255
- class: "import-button-content"
256
- }, "导入文件"),
257
- g.value ? (f(), C("span", Se, v(g.value), 1)) : I("", !0)
258
- ])
259
- ])) : I("", !0),
260
- (e == null ? void 0 : e.mode) === "edit" ? (f(), C("div", xe, [
261
- O("div", Oe, [
262
- A(ie)
263
- ]),
264
- (f(), C("div", {
265
- class: "model-show",
266
- key: b.value
267
- }, [
268
- A(me)
269
- ])),
270
- O("div", Ie, [
271
- A(de)
272
- ])
273
- ])) : I("", !0),
274
- (e == null ? void 0 : e.mode) === "view" ? (f(), C("div", Ne, [
275
- (f(), Z(pe, {
276
- content: h.value,
277
- onChange: c,
278
- jsonContents: p.value,
279
- key: b.value
280
- }, null, 8, ["content", "jsonContents"]))
281
- ])) : I("", !0)
282
- ]);
283
- };
284
- }
285
- }, Ee = /* @__PURE__ */ ne(Te, [["__scopeId", "data-v-b25bde75"]]);
286
- export {
287
- Ee as default
288
- };