ss-component-new 1.1.30 → 1.1.32

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,351 +0,0 @@
1
- import { ref as D, onMounted as ee, createElementBlock as m, openBlock as i, Fragment as z, renderList as H, createElementVNode as N, createCommentVNode as T, toDisplayString as U, watch as O, createVNode as R, unref as E, createBlock as G, resolveDynamicComponent as te } from "vue";
2
- import { p as J, u as ae, d as ne, e as oe, g as se, m as le, a as re, b as ce, c as ue } from "./array-QkRCQCnN.js";
3
- import { u as Q } from "./modelComp-BrI6MfnJ.js";
4
- import { u as X, s as P } from "./menu-CER-9e62.js";
5
- import ie from "./index-BBJEg3iA.js";
6
- import { _ as V, c as B } from "./_plugin-vue_export-helper-B7R8Jogt.js";
7
- const de = { class: "bread-content" }, me = ["onClick"], fe = { key: 0 }, he = {
8
- __name: "index",
9
- props: {
10
- breadArray: {
11
- type: Array,
12
- default: () => []
13
- }
14
- },
15
- emits: ["click"],
16
- setup(_, { emit: y }) {
17
- const t = _, d = D([]), u = y;
18
- ee(() => {
19
- d.value = t == null ? void 0 : t.breadArray;
20
- });
21
- const f = (p) => {
22
- u("click", p);
23
- };
24
- return (p, v) => (i(), m("div", de, [
25
- (i(!0), m(z, null, H(d.value, (h, g) => (i(), m("div", {
26
- key: g,
27
- class: "bread-item"
28
- }, [
29
- N("div", {
30
- class: "bread-title",
31
- onClick: (A) => f(h)
32
- }, U(h.value), 9, me),
33
- g !== d.value.length - 1 ? (i(), m("div", fe, U("/"))) : T("", !0)
34
- ]))), 128))
35
- ]));
36
- }
37
- }, ve = /* @__PURE__ */ V(he, [["__scopeId", "data-v-d55d3ede"]]);
38
- function ge(_) {
39
- const y = [], t = {
40
- "(": ")",
41
- "{": "}",
42
- "[": "]"
43
- };
44
- for (let d = 0; d < _.length; d++) {
45
- const u = _[d];
46
- if (t[u])
47
- y.push(u);
48
- else if (Object.values(t).includes(u)) {
49
- const f = y.pop();
50
- if (console.log("stack", y, f, t[f]), t[f] !== u)
51
- return !1;
52
- }
53
- }
54
- return y.length === 0;
55
- }
56
- function _e(_) {
57
- var d, u, f, p;
58
- const y = (u = (d = _[0]) == null ? void 0 : d.compData) == null ? void 0 : u.filter((v) => v.key !== "formContent"), t = (p = (f = _[0]) == null ? void 0 : f.compData) == null ? void 0 : p.filter((v) => v.key === "formContent");
59
- console.log("handleFormModel:", y, t, _);
60
- }
61
- const ye = { class: "system-wrap" }, pe = {
62
- key: 0,
63
- class: "show-content"
64
- }, Ce = {
65
- key: 0,
66
- class: "item-menu-content"
67
- }, ke = {
68
- key: 0,
69
- class: "item-view-group"
70
- }, De = {
71
- __name: "index",
72
- props: {
73
- content: String,
74
- jsonContents: Array
75
- },
76
- emits: ["change", "contentChange"],
77
- setup(_, { emit: y }) {
78
- const t = _, d = y, u = Q(J);
79
- ae(J);
80
- const f = D(!0), p = X(), v = D(!0), { itemData: h } = P(u), g = ne(J), { activeMenuPath: A, activeMenuOpenPaths: Z, menuTriggerType: K, menus: L } = P(p), { selectIndex: w, selectTitle: M } = P(g), b = D([]), C = D([]), W = (e) => {
81
- var n, o, a;
82
- const s = (n = h.value) == null ? void 0 : n.find((l) => l.name === A.value);
83
- C.value = (a = (o = s == null ? void 0 : s.compData) == null ? void 0 : o[0]) == null ? void 0 : a.contents, v.value = !0, v.value && (v.value = !1), d("change", {
84
- wholeValue: b.value,
85
- editValue: e
86
- });
87
- }, Y = (e) => {
88
- var S, k, $;
89
- const s = B(b.value), n = s == null ? void 0 : s.map((r, I) => (I === (e == null ? void 0 : e.index) && (r.compData = e == null ? void 0 : e.contents), r));
90
- let o = "";
91
- (k = (S = B(n)) == null ? void 0 : S.filter((r) => (r == null ? void 0 : r.comp) === "Form")) == null || k.forEach((r) => {
92
- var I;
93
- (I = r == null ? void 0 : r.compData) == null || I.forEach((x) => {
94
- var j;
95
- (x == null ? void 0 : x.key) === "formContent" && ((j = x == null ? void 0 : x.contents) == null || j.forEach((F) => {
96
- F.value !== "" && (o = o === "" ? F == null ? void 0 : F.value : o + "-" + (F == null ? void 0 : F.value));
97
- }));
98
- });
99
- });
100
- let a = M == null ? void 0 : M.value;
101
- (a == null ? void 0 : a.length) > 0 ? a[0] = { key: "main", value: o } : (Array.isArray(a) || (a = []), a.push({ key: "main", value: o })), g.setSelectTitle(a), f.value = !1, b.value = n;
102
- const l = ($ = h.value) == null ? void 0 : $.map((r, I) => {
103
- var x;
104
- return r.name === A.value && (r.compData = (x = r.compData) == null ? void 0 : x.map((j) => ((j == null ? void 0 : j.key) === "groupContents" && (j.contents = b.value), j))), r;
105
- });
106
- u.setItemData(l), v.value && (v.value = !1), d("contentChange", {
107
- wholeContent: h.value
108
- });
109
- }, q = (e) => {
110
- var s, n;
111
- if ((e == null ? void 0 : e.key) === "main")
112
- g.setSelectIndex(""), g.setSelectMenu(""), g.setSelectTitle((s = M.value) == null ? void 0 : s[0]);
113
- else {
114
- const o = [];
115
- let a = -1;
116
- (n = M.value) == null || n.forEach((l, S) => {
117
- (l == null ? void 0 : l.key) === (e == null ? void 0 : e.key) && (a = S), (a === -1 || a >= S) && o.push(l);
118
- }), g.setSelectTitle(o), g.setSelectMenu(e == null ? void 0 : e.key);
119
- }
120
- };
121
- O(
122
- () => h.value,
123
- () => {
124
- var s, n, o, a, l, S, k, $;
125
- if (!h.value || ((s = h.value) == null ? void 0 : s.length) === 0 || !f.value) return;
126
- let e = null;
127
- if (!A.value)
128
- e = (o = (n = B(h.value)) == null ? void 0 : n.filter((r) => (r == null ? void 0 : r.comp) === "Group")) == null ? void 0 : o[0], p.setActiveMenuPath(e == null ? void 0 : e.name);
129
- else {
130
- const r = (a = B(h.value)) == null ? void 0 : a.filter((I) => (I == null ? void 0 : I.comp) === "Group");
131
- e = r == null ? void 0 : r.find((I) => I.name === A.value);
132
- }
133
- C.value = (S = (l = e == null ? void 0 : e.compData) == null ? void 0 : l[0]) == null ? void 0 : S.contents, b.value = ($ = (k = e == null ? void 0 : e.compData) == null ? void 0 : k[0]) == null ? void 0 : $.contents, console.log("itemData监听", e, A.value, h.value);
134
- },
135
- { deep: !0, immediate: !0 }
136
- ), O(() => A.value, (e) => {
137
- var s, n, o, a, l, S;
138
- if (e) {
139
- const k = (s = B(h.value)) == null ? void 0 : s.find(($) => $.name === e);
140
- if (e && k) {
141
- C.value = (o = (n = k == null ? void 0 : k.compData) == null ? void 0 : n[0]) == null ? void 0 : o.contents, b.value = (l = (a = k == null ? void 0 : k.compData) == null ? void 0 : a[0]) == null ? void 0 : l.contents, console.log("点击-新-data:", e, C.value);
142
- const $ = (S = C.value) == null ? void 0 : S.filter((r) => r.comp === "Form");
143
- _e($);
144
- } else
145
- C.value = [], b.value = [];
146
- g.setSelectTitle([]), g.setSelectIndex(""), g.setSelectMenu("");
147
- }
148
- }, {
149
- immediate: !0
150
- }), O(
151
- () => [t == null ? void 0 : t.content, t == null ? void 0 : t.jsonContents],
152
- () => {
153
- var o;
154
- if (((o = t == null ? void 0 : t.jsonContents) == null ? void 0 : o.length) > 0) {
155
- u.setOriginalData(t == null ? void 0 : t.jsonContents), u.setItemData(t == null ? void 0 : t.jsonContents);
156
- return;
157
- }
158
- if (!(t != null && t.content) || (t == null ? void 0 : t.content) === "") return;
159
- f.value = !0;
160
- const e = oe(t == null ? void 0 : t.content), s = Array.isArray(e) && (e == null ? void 0 : e.find((a) => {
161
- var l;
162
- return ((l = a.comp) == null ? void 0 : l.toUpperCase()) === "MENU";
163
- }));
164
- p.setRawMenu(s ?? {});
165
- const n = Array.isArray(e) && (e == null ? void 0 : e.find((a) => {
166
- var l;
167
- return ((l = a.comp) == null ? void 0 : l.toUpperCase()) === "SYSTEM";
168
- }));
169
- p.setSystemKey((n == null ? void 0 : n.name) ?? ""), u.setOriginalData(e), u.setItemData(e);
170
- },
171
- { deep: !0, immediate: !0 }
172
- );
173
- const c = (e) => se(e);
174
- return (e, s) => {
175
- var n, o;
176
- return i(), m("div", ye, [
177
- R(ie, { class: "sys-aside" }),
178
- ((n = C.value) == null ? void 0 : n.length) > 0 ? (i(), m("div", pe, [
179
- ((o = E(M)) == null ? void 0 : o.length) > 1 ? (i(), m("div", Ce, [
180
- (i(), G(ve, {
181
- key: E(M),
182
- breadArray: E(M),
183
- onClick: q
184
- }, null, 8, ["breadArray"]))
185
- ])) : T("", !0),
186
- (i(!0), m(z, null, H(C.value, (a, l) => (i(), m("div", {
187
- class: "item-content",
188
- key: l
189
- }, [
190
- E(w) === "" || l.toString() === E(w) ? (i(), m("div", ke, U(a.name), 1)) : T("", !0),
191
- E(w) === "" || l.toString() === E(w) ? (i(), G(te(c(a.comp)), {
192
- itemData: a == null ? void 0 : a.compData,
193
- childItemData: a == null ? void 0 : a.itemChildData,
194
- key: l,
195
- onChange: W,
196
- index: l,
197
- onContentChange: Y
198
- }, null, 40, ["itemData", "childItemData", "index"])) : T("", !0)
199
- ]))), 128))
200
- ])) : T("", !0)
201
- ]);
202
- };
203
- }
204
- }, Se = /* @__PURE__ */ V(De, [["__scopeId", "data-v-59cfbaff"]]), Ie = { class: "add-model-content" }, Me = {
205
- key: 0,
206
- class: "model-import-data"
207
- }, Ae = { class: "import-button" }, be = { key: 0 }, $e = {
208
- key: 1,
209
- class: "model-operate"
210
- }, xe = { class: "model-select" }, Te = { class: "model-fill" }, je = {
211
- key: 2,
212
- class: "model-view"
213
- }, we = {
214
- __name: "index",
215
- props: {
216
- mode: {
217
- type: String,
218
- default: "view"
219
- },
220
- content: {
221
- type: String,
222
- default: ""
223
- },
224
- jsonContents: {
225
- type: Array,
226
- default: () => []
227
- },
228
- showButton: {
229
- type: Boolean,
230
- default: !0
231
- }
232
- },
233
- emits: ["change", "contentChange"],
234
- setup(_, { emit: y }) {
235
- const t = _, d = y, u = D(""), f = D([]), p = D(0), v = Q(J), h = X(J), { itemData: g, originalData: A } = P(v), { activeMenuPath: Z } = P(h), K = D(null), L = D(0), w = D(""), M = (c) => {
236
- d("contentChange", c);
237
- }, b = (c) => {
238
- var s;
239
- const e = (s = B(c == null ? void 0 : c.wholeValue)) == null ? void 0 : s.map((n) => {
240
- var o;
241
- return (n == null ? void 0 : n.comp) === "Form" && (n.compData = (o = n.compData) == null ? void 0 : o.map((a) => ((a == null ? void 0 : a.key) === "formContent" && (a.contents = ue(a == null ? void 0 : a.contents)), a))), n;
242
- });
243
- d("change", {
244
- originalContents: A.value,
245
- currentContents: c == null ? void 0 : c.wholeValue,
246
- editContent: c == null ? void 0 : c.editValue,
247
- arrayToContents: e
248
- });
249
- }, C = D([]), W = () => {
250
- K.value.click();
251
- }, Y = (c) => {
252
- const e = c.target.files[0];
253
- if (!e) return;
254
- const s = new FileReader();
255
- s.onload = (n) => {
256
- try {
257
- u.value = n.target.result;
258
- const o = ge(n.target.result);
259
- console.log("handleFileChange-isValid", o), C.value = q(n.target.result), L.value++;
260
- } catch (o) {
261
- console.error("解析失败:", o);
262
- }
263
- }, s.onerror = (n) => {
264
- console.error("文件读取错误:", n);
265
- }, s.readAsText(e);
266
- };
267
- O(
268
- () => [t == null ? void 0 : t.content, t == null ? void 0 : t.jsonContents],
269
- () => {
270
- u.value = t == null ? void 0 : t.content, f.value = t == null ? void 0 : t.jsonContents;
271
- },
272
- { deep: !0, immediate: !0 }
273
- ), O(
274
- () => L.value,
275
- () => {
276
- var c;
277
- ((c = C.value) == null ? void 0 : c.length) !== 0 && (v.setOriginalData(C.value), v.setItemData(C.value));
278
- },
279
- { deep: !0, immediate: !0 }
280
- );
281
- const q = (c) => {
282
- let e = c.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
283
- e = e.replace(/(\w+)\s*:/g, "$1:"), e = e.replace(/\r\n/g, "").replace(/\n/g, "").replace(/\t/g, "").replace(/\s+/g, " ").trim(), e = e.replace(/,\s*([}\]])/g, "$1"), e = e.replace(/:(\s*)([^"{}\[\],\s]+)(\s*)([,}])/g, ": $2$4");
284
- try {
285
- return JSON.parse(e);
286
- } catch (s) {
287
- try {
288
- const o = new Function(`return ${e}`)();
289
- if (Array.isArray(o) || typeof o == "object")
290
- return o;
291
- throw new Error(`解析结果不是有效的数组或对象: ${s}`);
292
- } catch (n) {
293
- throw new Error(`无法解析JSON: ${n.message}`);
294
- }
295
- }
296
- };
297
- return (c, e) => {
298
- var s;
299
- return i(), m("div", Ie, [
300
- ((s = t == null ? void 0 : t.jsonContents) == null ? void 0 : s.length) === 0 && (t != null && t.showButton) ? (i(), m("div", Me, [
301
- N("div", Ae, [
302
- N("input", {
303
- type: "file",
304
- ref_key: "fileInput",
305
- ref: K,
306
- accept: ".txt",
307
- onChange: Y,
308
- style: { display: "none" }
309
- }, null, 544),
310
- N("button", {
311
- onClick: W,
312
- class: "import-button-content"
313
- }, "导入文件"),
314
- w.value ? (i(), m("span", be, U(w.value), 1)) : T("", !0)
315
- ])
316
- ])) : T("", !0),
317
- (t == null ? void 0 : t.mode) === "edit" ? (i(), m("div", $e, [
318
- N("div", xe, [
319
- R(le)
320
- ]),
321
- (i(), m("div", {
322
- class: "model-show",
323
- key: p.value
324
- }, [
325
- R(re)
326
- ])),
327
- N("div", Te, [
328
- R(ce)
329
- ])
330
- ])) : T("", !0),
331
- (t == null ? void 0 : t.mode) === "view" ? (i(), m("div", je, [
332
- (i(), G(Se, {
333
- content: u.value,
334
- onChange: b,
335
- jsonContents: f.value,
336
- onContentChange: M,
337
- key: p.value
338
- }, null, 8, ["content", "jsonContents"]))
339
- ])) : T("", !0)
340
- ]);
341
- };
342
- }
343
- }, Fe = /* @__PURE__ */ V(we, [["__scopeId", "data-v-876d48c6"]]), Ee = {
344
- __name: "index",
345
- setup(_) {
346
- return (y, t) => (i(), G(Fe, { class: "ssComponent" }));
347
- }
348
- }, Ue = /* @__PURE__ */ V(Ee, [["__scopeId", "data-v-f196ec9f"]]);
349
- export {
350
- Ue as default
351
- };
@@ -1,286 +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 { p as E, e as ie, g as de, m as me, a as ye, b as fe, c as ge } from "./array-QkRCQCnN.js";
3
- import { u as ee } from "./modelComp-BrI6MfnJ.js";
4
- import { s as te, u as he } from "./menu-CER-9e62.js";
5
- import { _ as ne, c as k } from "./_plugin-vue_export-helper-B7R8Jogt.js";
6
- const x = [
7
- {
8
- key: "FormName",
9
- value: "Form"
10
- },
11
- {
12
- key: "TableName",
13
- value: "Table"
14
- }
15
- ], s = [
16
- {
17
- key: "FormDirect",
18
- value: "formFlex"
19
- },
20
- {
21
- key: "Form",
22
- value: "formContent"
23
- },
24
- {
25
- key: "FormButton",
26
- value: "formButton"
27
- },
28
- {
29
- key: "TableColumns",
30
- value: "header"
31
- },
32
- {
33
- key: "TableButton",
34
- value: "extraButton"
35
- },
36
- {
37
- key: "LineButton",
38
- value: "rowButton"
39
- },
40
- {
41
- key: "Table",
42
- value: "tableContents"
43
- },
44
- {
45
- key: "TableIndex",
46
- value: "tableIndex"
47
- }
48
- ], ke = {
49
- key: 0,
50
- class: "show-content"
51
- }, _e = { class: "item-view-group" }, Ce = {
52
- __name: "index",
53
- props: {
54
- content: String,
55
- jsonContents: Array
56
- },
57
- emits: ["change"],
58
- setup(F, { emit: B }) {
59
- const e = F, $ = B, h = ee(E), { itemData: b } = te(h), p = _([]), w = _([]), L = (l) => {
60
- $("change", {
61
- wholeValue: p.value,
62
- editValue: l
63
- });
64
- }, D = (l) => {
65
- const g = k(p.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));
66
- p.value = S;
67
- };
68
- V(
69
- () => b.value,
70
- () => {
71
- var l;
72
- !b.value || ((l = b.value) == null ? void 0 : l.length) === 0 || (w.value = b.value, p.value = b.value);
73
- },
74
- { deep: !0, immediate: !0 }
75
- ), V(
76
- () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
77
- () => {
78
- var g;
79
- if (((g = e == null ? void 0 : e.jsonContents) == null ? void 0 : g.length) > 0) {
80
- h.setOriginalData(e == null ? void 0 : e.jsonContents), h.setItemData(e == null ? void 0 : e.jsonContents);
81
- return;
82
- }
83
- if (!(e != null && e.content) || (e == null ? void 0 : e.content) === "") return;
84
- const l = ie(e == null ? void 0 : e.content);
85
- h.setOriginalData(l), h.setItemData(l);
86
- },
87
- { deep: !0, immediate: !0 }
88
- );
89
- const N = (l) => de(l);
90
- return (l, g) => {
91
- var S;
92
- return ((S = w.value) == null ? void 0 : S.length) > 0 ? (f(), C("div", ke, [
93
- (f(!0), C(le, null, se(w.value, (c, j) => (f(), C("div", {
94
- class: "item-content",
95
- key: j
96
- }, [
97
- O("div", _e, v(c.name), 1),
98
- (f(), Z(ue(N(c.comp)), {
99
- itemData: c == null ? void 0 : c.compData,
100
- childItemData: c == null ? void 0 : c.itemChildData,
101
- key: j,
102
- onChange: L,
103
- index: j,
104
- onContentChange: D
105
- }, null, 40, ["itemData", "childItemData", "index"]))
106
- ]))), 128))
107
- ])) : I("", !0);
108
- };
109
- }
110
- }, be = /* @__PURE__ */ ne(Ce, [["__scopeId", "data-v-869e6e20"]]), pe = { class: "add-model-content" }, we = {
111
- key: 0,
112
- class: "model-import-data"
113
- }, je = { class: "import-button" }, Se = { key: 0 }, xe = {
114
- key: 1,
115
- class: "model-operate"
116
- }, Oe = { class: "model-select" }, Ie = { class: "model-fill" }, Ne = {
117
- key: 2,
118
- class: "model-view ssComponent"
119
- }, Te = {
120
- __name: "main",
121
- props: {
122
- mode: {
123
- type: String,
124
- default: "view"
125
- },
126
- content: {
127
- type: String,
128
- default: ""
129
- },
130
- jsonContents: {
131
- type: Array,
132
- default: () => []
133
- },
134
- showButton: {
135
- type: Boolean,
136
- default: !0
137
- }
138
- },
139
- emits: ["change"],
140
- setup(F, { emit: B }) {
141
- const e = F, $ = B, h = _(""), b = _([]), p = _(0), w = ee(E);
142
- he(E);
143
- const { itemData: L, originalData: D } = te(w), N = _(null), l = _(0), g = _(""), S = () => {
144
- p.value = window.innerWidth;
145
- }, c = async (o) => {
146
- var u;
147
- const a = (u = k(o == null ? void 0 : o.wholeValue)) == null ? void 0 : u.map((n) => {
148
- var m;
149
- return (n == null ? void 0 : n.comp) === "Form" && (n.compData = (m = n.compData) == null ? void 0 : m.map((y) => ((y == null ? void 0 : y.key) === "formContent" && (y.contents = ge(y == null ? void 0 : y.contents)), y))), n;
150
- });
151
- $("change", {
152
- originalContents: D.value,
153
- currentContents: o == null ? void 0 : o.wholeValue,
154
- editContent: o == null ? void 0 : o.editValue,
155
- stringContent: j(k(o == null ? void 0 : o.wholeValue)),
156
- arrayToContents: a
157
- });
158
- }, j = (o) => {
159
- var u;
160
- let a = [];
161
- return (u = k(o)) == null || u.forEach((n) => {
162
- var m, y;
163
- x != null && x.find((t) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.comp)) && a.push(((m = x == null ? void 0 : x.find((t) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.comp))) == null ? void 0 : m.key) + "=" + n.name + "/r/n"), (y = n == null ? void 0 : n.compData) == null || y.forEach((t) => {
164
- var M, R, z, W, q, G, H, K, P, Q, U, X;
165
- if (s != null && s.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key)))
166
- if (!((M = t == null ? void 0 : t.contents) != null && M.length))
167
- 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");
168
- else {
169
- let i = (z = t == null ? void 0 : t.contents) == null ? void 0 : z[0];
170
- if (!i) return;
171
- if (Object.keys(i).includes("label") && Object.keys(i).includes("key") && Object.keys(i).includes("width"))
172
- if (((q = (W = t.contents) == null ? void 0 : W.filter((d) => d.width !== 1)) == null ? void 0 : q.length) === 0) {
173
- const d = (G = k(t == null ? void 0 : t.contents)) == null ? void 0 : G.map((r) => ({ [r.label]: r.value }));
174
- 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(d) + "/r/n");
175
- } else {
176
- let d = [];
177
- (K = k(t == null ? void 0 : t.contents)) == null || K.reduce((r, J) => {
178
- var Y;
179
- return r[J.label] = J.key, ((Y = Object.keys(k(r))) == null ? void 0 : Y.length) >= J.width && (d.push(k(r)), r = {}), r;
180
- }, {}), 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(d) + "/r/n");
181
- }
182
- else if (Object.keys(i).includes("label")) {
183
- const d = (Q = k(t == null ? void 0 : t.contents)) == null ? void 0 : Q.map((r) => r.label);
184
- 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(d) + "/r/n");
185
- } else
186
- a.push(((X = s == null ? void 0 : s.find((d) => (d == null ? void 0 : d.value) === (t == null ? void 0 : t.key))) == null ? void 0 : X.key) + "=" + JSON.stringify(t == null ? void 0 : t.contents) + "/r/n");
187
- }
188
- });
189
- }), JSON.stringify(a);
190
- }, T = _([]), ae = () => {
191
- N.value.click();
192
- }, oe = (o) => {
193
- const a = o.target.files[0];
194
- if (!a) return;
195
- const u = new FileReader();
196
- u.onload = (n) => {
197
- try {
198
- h.value = n.target.result, T.value = re(n.target.result), l.value++;
199
- } catch (m) {
200
- console.error("解析失败:", m);
201
- }
202
- }, u.onerror = (n) => {
203
- console.error("文件读取错误:", n);
204
- }, u.readAsText(a);
205
- };
206
- ce(() => {
207
- window.addEventListener("resize", S);
208
- }), V(
209
- () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
210
- () => {
211
- h.value = e == null ? void 0 : e.content, b.value = e == null ? void 0 : e.jsonContents;
212
- },
213
- { deep: !0, immediate: !0 }
214
- ), V(
215
- () => l.value,
216
- () => {
217
- var o;
218
- ((o = T.value) == null ? void 0 : o.length) !== 0 && (w.setOriginalData(T.value), w.setItemData(T.value));
219
- },
220
- { deep: !0, immediate: !0 }
221
- );
222
- const re = (o) => {
223
- let a = o.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
224
- 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");
225
- try {
226
- return JSON.parse(a);
227
- } catch (u) {
228
- try {
229
- const m = new Function(`return ${a}`)();
230
- if (Array.isArray(m) || typeof m == "object")
231
- return m;
232
- throw new Error(`解析结果不是有效的数组或对象: ${u}`);
233
- } catch (n) {
234
- throw new Error(`无法解析JSON: ${n.message}`);
235
- }
236
- }
237
- };
238
- return (o, a) => {
239
- var u;
240
- return f(), C("div", pe, [
241
- ((u = e == null ? void 0 : e.jsonContents) == null ? void 0 : u.length) === 0 ? (f(), C("div", we, [
242
- O("div", je, [
243
- O("input", {
244
- type: "file",
245
- ref_key: "fileInput",
246
- ref: N,
247
- accept: ".txt",
248
- onChange: oe,
249
- style: { display: "none" }
250
- }, null, 544),
251
- O("button", {
252
- onClick: ae,
253
- class: "import-button-content"
254
- }, "导入文件"),
255
- g.value ? (f(), C("span", Se, v(g.value), 1)) : I("", !0)
256
- ])
257
- ])) : I("", !0),
258
- (e == null ? void 0 : e.mode) === "edit" ? (f(), C("div", xe, [
259
- O("div", Oe, [
260
- A(me)
261
- ]),
262
- (f(), C("div", {
263
- class: "model-show",
264
- key: p.value
265
- }, [
266
- A(ye)
267
- ])),
268
- O("div", Ie, [
269
- A(fe)
270
- ])
271
- ])) : I("", !0),
272
- (e == null ? void 0 : e.mode) === "view" ? (f(), C("div", Ne, [
273
- (f(), Z(be, {
274
- content: h.value,
275
- onChange: c,
276
- jsonContents: b.value,
277
- key: p.value
278
- }, null, 8, ["content", "jsonContents"]))
279
- ])) : I("", !0)
280
- ]);
281
- };
282
- }
283
- }, Je = /* @__PURE__ */ ne(Te, [["__scopeId", "data-v-b25bde75"]]);
284
- export {
285
- Je as default
286
- };