ss-component-new 1.1.8 → 1.1.10

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.
package/dist/config.js ADDED
@@ -0,0 +1,10 @@
1
+ window.__env__ = {
2
+ "VITE_PORT": "8888",
3
+ "VITE_OPEN": "true",
4
+ "VITE_OPEN_CDN": "false",
5
+ "VITE_PUBLIC_PATH": "",
6
+ "VITE_SM_PUBLIC_KEY": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312",
7
+ "VITE_API_URL": "http://139.196.154.85:20013",
8
+ "VITE_DEFAULT_USER": "",
9
+ "VITE_DEFAULT_USER_PASSWORD": ""
10
+ }
@@ -1,6 +1,6 @@
1
1
  import { getCurrentInstance as ze, inject as Be, ref as k, computed as M, unref as x, readonly as wo, getCurrentScope as _o, onScopeDispose as Eo, onMounted as Dt, nextTick as Ke, watch as be, isRef as So, warn as Do, provide as Co, defineComponent as Ae, createElementBlock as T, openBlock as v, mergeProps as kn, renderSlot as de, normalizeClass as _e, createVNode as jt, Transition as An, withCtx as L, withDirectives as $n, createElementVNode as mt, normalizeStyle as se, createTextVNode as Mn, toDisplayString as me, vShow as Rn, shallowReactive as xo, createBlock as P, createCommentVNode as z, resolveDynamicComponent as Le, Fragment as ne, withModifiers as To, isVNode as Fn, render as on, resolveComponent as K, renderList as ue, createSlots as Bn, normalizeProps as Oo, guardReactiveProps as Io } from "vue";
2
- import { i as No, b as Po, e as Yt, S as rn, M as Vn, f as ko, h as Ao, w as $o, j as Mo, k as Ro, _ as Wt, c as Ct } from "./menu-qSnszHpf.js";
3
- import Fo from "./index-CgQCR4W5.js";
2
+ import { i as No, b as Po, e as Yt, S as rn, M as Vn, f as ko, h as Ao, w as $o, j as Mo, k as Ro, _ as Wt, c as Ct } from "./menu-3a4UTvU1.js";
3
+ import Fo from "./index-hjkvqVVf.js";
4
4
  /**!
5
5
  * Sortable 1.15.6
6
6
  * @author RubaXa <trash@rubaxa.org>
@@ -3111,6 +3111,7 @@ const ai = {
3111
3111
  }
3112
3112
  }, ci = /* @__PURE__ */ Wt(ui, [["__scopeId", "data-v-77ef4151"]]);
3113
3113
  export {
3114
+ Fa as E,
3114
3115
  Ga as a,
3115
3116
  gi as i,
3116
3117
  ci as s
@@ -0,0 +1,239 @@
1
+ import { ref as _, watch as w, createElementBlock as d, openBlock as i, createVNode as j, createCommentVNode as D, Fragment as R, renderList as P, createElementVNode as C, createBlock as N, toDisplayString as B, resolveDynamicComponent as U, onMounted as z } from "vue";
2
+ import { p as I, u as L, e as W, g as G, m as K, a as Y, b as q, c as H, s as Q } from "./array-0PzArXAH.js";
3
+ import { u as O } from "./modelComp-BLx5jS0f.js";
4
+ import { _ as E, u as V, s as F, c as A } from "./menu-3a4UTvU1.js";
5
+ import X from "./index-vyAHI5uV.js";
6
+ const Z = { class: "system-wrap" }, ee = {
7
+ key: 0,
8
+ class: "show-content"
9
+ }, te = { class: "item-view-group" }, ae = {
10
+ __name: "index",
11
+ props: {
12
+ content: String,
13
+ jsonContents: Array
14
+ },
15
+ emits: ["change"],
16
+ setup(k, { emit: x }) {
17
+ const e = k, S = x, m = O(I);
18
+ L(I);
19
+ const y = V(), { itemData: h } = F(m), { activeMenuPath: p, activeMenuOpenPaths: J, menuTriggerType: T } = F(y), g = _([]), v = _([]), M = (t) => {
20
+ S("change", {
21
+ wholeValue: g.value,
22
+ editValue: t
23
+ });
24
+ }, $ = (t) => {
25
+ const c = A(g.value), l = c == null ? void 0 : c.map((n, a) => (a === (t == null ? void 0 : t.index) && (n.compData = t == null ? void 0 : t.contents), n));
26
+ g.value = l;
27
+ };
28
+ w(
29
+ () => h.value,
30
+ () => {
31
+ var c, l, n, a, s, o, r;
32
+ if (!h.value || ((c = h.value) == null ? void 0 : c.length) === 0) return;
33
+ const t = (n = (l = A(h.value)) == null ? void 0 : l.filter((u) => (u == null ? void 0 : u.comp) === "Group")) == null ? void 0 : n[0];
34
+ v.value = (s = (a = t == null ? void 0 : t.compData) == null ? void 0 : a[0]) == null ? void 0 : s.contents, g.value = (r = (o = t == null ? void 0 : t.compData) == null ? void 0 : o[0]) == null ? void 0 : r.contents, y.setActiveMenuPath(t == null ? void 0 : t.name);
35
+ },
36
+ { deep: !0, immediate: !0 }
37
+ ), w(() => p.value, (t) => {
38
+ var c, l, n, a, s;
39
+ if (t) {
40
+ const o = (c = A(h.value)) == null ? void 0 : c.find((r) => r.name === t);
41
+ t && o ? (v.value = (n = (l = o == null ? void 0 : o.compData) == null ? void 0 : l[0]) == null ? void 0 : n.contents, g.value = (s = (a = o == null ? void 0 : o.compData) == null ? void 0 : a[0]) == null ? void 0 : s.contents, console.log("点击-新-data:", t, v.value)) : (v.value = [], g.value = []);
42
+ }
43
+ }), w(
44
+ () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
45
+ () => {
46
+ var n;
47
+ if (((n = e == null ? void 0 : e.jsonContents) == null ? void 0 : n.length) > 0) {
48
+ m.setOriginalData(e == null ? void 0 : e.jsonContents), m.setItemData(e == null ? void 0 : e.jsonContents);
49
+ return;
50
+ }
51
+ if (!(e != null && e.content) || (e == null ? void 0 : e.content) === "") return;
52
+ const t = W(e == null ? void 0 : e.content);
53
+ console.log("newViewContents", t);
54
+ const c = Array.isArray(t) && (t == null ? void 0 : t.find((a) => {
55
+ var s;
56
+ return ((s = a.comp) == null ? void 0 : s.toUpperCase()) === "MENU";
57
+ }));
58
+ y.setRawMenu(c ?? {});
59
+ const l = Array.isArray(t) && (t == null ? void 0 : t.find((a) => {
60
+ var s;
61
+ return ((s = a.comp) == null ? void 0 : s.toUpperCase()) === "SYSTEM";
62
+ }));
63
+ y.setSystemKey((l == null ? void 0 : l.name) ?? ""), m.setOriginalData(t), m.setItemData(t);
64
+ },
65
+ { deep: !0, immediate: !0 }
66
+ );
67
+ const b = (t) => G(t);
68
+ return (t, c) => {
69
+ var l;
70
+ return i(), d("div", Z, [
71
+ j(X, { class: "sys-aside" }),
72
+ ((l = v.value) == null ? void 0 : l.length) > 0 ? (i(), d("div", ee, [
73
+ (i(!0), d(R, null, P(v.value, (n, a) => (i(), d("div", {
74
+ class: "item-content",
75
+ key: a
76
+ }, [
77
+ C("div", te, B(n.name), 1),
78
+ (i(), N(U(b(n.comp)), {
79
+ itemData: n == null ? void 0 : n.compData,
80
+ childItemData: n == null ? void 0 : n.itemChildData,
81
+ key: a,
82
+ onChange: M,
83
+ index: a,
84
+ onContentChange: $
85
+ }, null, 40, ["itemData", "childItemData", "index"]))
86
+ ]))), 128))
87
+ ])) : D("", !0)
88
+ ]);
89
+ };
90
+ }
91
+ }, se = /* @__PURE__ */ E(ae, [["__scopeId", "data-v-515aa723"]]), ne = { class: "add-model-content" }, oe = {
92
+ key: 0,
93
+ class: "model-import-data"
94
+ }, re = { class: "import-button" }, le = { key: 0 }, ce = {
95
+ key: 1,
96
+ class: "model-operate"
97
+ }, ie = { class: "model-select" }, ue = { class: "model-fill" }, de = {
98
+ key: 2,
99
+ class: "model-view"
100
+ }, me = {
101
+ __name: "index",
102
+ props: {
103
+ mode: {
104
+ type: String,
105
+ default: "view"
106
+ },
107
+ content: {
108
+ type: String,
109
+ default: ""
110
+ },
111
+ jsonContents: {
112
+ type: Array,
113
+ default: () => []
114
+ },
115
+ showButton: {
116
+ type: Boolean,
117
+ default: !0
118
+ }
119
+ },
120
+ emits: ["change"],
121
+ setup(k, { emit: x }) {
122
+ const e = k, S = x, m = _(""), y = _([]), h = _(0), p = O(I);
123
+ V(I);
124
+ const { itemData: J, originalData: T } = F(p), g = _(null), v = _(0), M = _(""), $ = () => {
125
+ h.value = window.innerWidth;
126
+ }, b = (a) => {
127
+ var o;
128
+ const s = (o = A(a == null ? void 0 : a.wholeValue)) == null ? void 0 : o.map((r) => {
129
+ var u;
130
+ return (r == null ? void 0 : r.comp) === "Form" && (r.compData = (u = r.compData) == null ? void 0 : u.map((f) => ((f == null ? void 0 : f.key) === "formContent" && (f.contents = H(f == null ? void 0 : f.contents)), f))), r;
131
+ });
132
+ S("change", {
133
+ originalContents: T.value,
134
+ currentContents: a == null ? void 0 : a.wholeValue,
135
+ editContent: a == null ? void 0 : a.editValue,
136
+ arrayToContents: s
137
+ }), console.log("change", T.value, a, a == null ? void 0 : a.editValue), Q(a == null ? void 0 : a.wholeValue, a == null ? void 0 : a.editValue);
138
+ }, t = _([]), c = () => {
139
+ g.value.click();
140
+ }, l = (a) => {
141
+ const s = a.target.files[0];
142
+ if (!s) return;
143
+ const o = new FileReader();
144
+ o.onload = (r) => {
145
+ try {
146
+ m.value = r.target.result, t.value = n(r.target.result), v.value++;
147
+ } catch (u) {
148
+ console.error("解析失败:", u);
149
+ }
150
+ }, o.onerror = (r) => {
151
+ console.error("文件读取错误:", r);
152
+ }, o.readAsText(s);
153
+ };
154
+ z(() => {
155
+ window.addEventListener("resize", $);
156
+ }), w(
157
+ () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
158
+ () => {
159
+ m.value = e == null ? void 0 : e.content, y.value = e == null ? void 0 : e.jsonContents;
160
+ },
161
+ { deep: !0, immediate: !0 }
162
+ ), w(
163
+ () => v.value,
164
+ () => {
165
+ var a;
166
+ ((a = t.value) == null ? void 0 : a.length) !== 0 && (p.setOriginalData(t.value), p.setItemData(t.value));
167
+ },
168
+ { deep: !0, immediate: !0 }
169
+ );
170
+ const n = (a) => {
171
+ let s = a.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
172
+ s = s.replace(/(\w+)\s*:/g, "$1:"), s = s.replace(/\r\n/g, "").replace(/\n/g, "").replace(/\t/g, "").replace(/\s+/g, " ").trim(), s = s.replace(/,\s*([}\]])/g, "$1"), s = s.replace(/:(\s*)([^"{}\[\],\s]+)(\s*)([,}])/g, ": $2$4");
173
+ try {
174
+ return JSON.parse(s);
175
+ } catch (o) {
176
+ try {
177
+ const u = new Function(`return ${s}`)();
178
+ if (Array.isArray(u) || typeof u == "object")
179
+ return u;
180
+ throw new Error(`解析结果不是有效的数组或对象: ${o}`);
181
+ } catch (r) {
182
+ throw new Error(`无法解析JSON: ${r.message}`);
183
+ }
184
+ }
185
+ };
186
+ return (a, s) => {
187
+ var o;
188
+ return i(), d("div", ne, [
189
+ ((o = e == null ? void 0 : e.jsonContents) == null ? void 0 : o.length) === 0 && (e != null && e.showButton) ? (i(), d("div", oe, [
190
+ C("div", re, [
191
+ C("input", {
192
+ type: "file",
193
+ ref_key: "fileInput",
194
+ ref: g,
195
+ accept: ".txt",
196
+ onChange: l,
197
+ style: { display: "none" }
198
+ }, null, 544),
199
+ C("button", {
200
+ onClick: c,
201
+ class: "import-button-content"
202
+ }, "导入文件"),
203
+ M.value ? (i(), d("span", le, B(M.value), 1)) : D("", !0)
204
+ ])
205
+ ])) : D("", !0),
206
+ (e == null ? void 0 : e.mode) === "edit" ? (i(), d("div", ce, [
207
+ C("div", ie, [
208
+ j(K)
209
+ ]),
210
+ (i(), d("div", {
211
+ class: "model-show",
212
+ key: h.value
213
+ }, [
214
+ j(Y)
215
+ ])),
216
+ C("div", ue, [
217
+ j(q)
218
+ ])
219
+ ])) : D("", !0),
220
+ (e == null ? void 0 : e.mode) === "view" ? (i(), d("div", de, [
221
+ (i(), N(se, {
222
+ content: m.value,
223
+ onChange: b,
224
+ jsonContents: y.value,
225
+ key: h.value
226
+ }, null, 8, ["content", "jsonContents"]))
227
+ ])) : D("", !0)
228
+ ]);
229
+ };
230
+ }
231
+ }, he = /* @__PURE__ */ E(me, [["__scopeId", "data-v-a63b93f2"]]), ge = {
232
+ __name: "index",
233
+ setup(k) {
234
+ return (x, e) => (i(), N(he, { class: "ssComponent" }));
235
+ }
236
+ }, pe = /* @__PURE__ */ E(ge, [["__scopeId", "data-v-f196ec9f"]]);
237
+ export {
238
+ pe as default
239
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as S, onMounted as A, resolveComponent as l, createElementBlock as d, openBlock as o, Fragment as m, renderList as M, createBlock as r, withCtx as s, createVNode as b, createSlots as g, renderSlot as u, mergeProps as O, computed as I } from "vue";
2
- import { u as R, s as q, _ as E } from "./menu-qSnszHpf.js";
2
+ import { u as R, s as q, _ as E } from "./menu-3a4UTvU1.js";
3
3
  const F = /* @__PURE__ */ S({
4
4
  __name: "menuItem",
5
5
  props: {
@@ -133,7 +133,7 @@ const F = /* @__PURE__ */ S({
133
133
  }, 8, ["default-active", "default-openeds"]);
134
134
  };
135
135
  }
136
- }), D = /* @__PURE__ */ E(V, [["__scopeId", "data-v-18c3cabc"]]);
136
+ }), D = /* @__PURE__ */ E(V, [["__scopeId", "data-v-6cdfb310"]]);
137
137
  export {
138
138
  D as default
139
139
  };
@@ -0,0 +1,110 @@
1
+ import { defineAsyncComponent as B, computed as E, onMounted as F, resolveComponent as L, createBlock as f, openBlock as _, withCtx as b, resolveDynamicComponent as N, defineComponent as U, ref as G, watch as V, unref as q, createVNode as z, createElementVNode as H, toDisplayString as J } from "vue";
2
+ import { E as M, u as K, s as C, c as D, _ as Q } from "./menu-3a4UTvU1.js";
3
+ import { u as W } from "./modelComp-BLx5jS0f.js";
4
+ const A = B(() => import("./index-hjkvqVVf.js"));
5
+ A.install = (n) => {
6
+ n.component("ssMenu", A);
7
+ };
8
+ const X = {
9
+ __name: "index",
10
+ props: {
11
+ name: String
12
+ },
13
+ setup(n) {
14
+ const p = n, c = E(() => M[p.name]);
15
+ return F(() => {
16
+ const d = Object.keys(M);
17
+ console.log("iconComponent", c.value, p.name, M, d);
18
+ }), (d, g) => {
19
+ const m = L("el-icon");
20
+ return _(), f(m, null, {
21
+ default: b(() => [
22
+ (_(), f(N(c.value)))
23
+ ]),
24
+ _: 1
25
+ });
26
+ };
27
+ }
28
+ };
29
+ var S = /* @__PURE__ */ ((n) => (n[n.Menu = 0] = "Menu", n[n.FolderOpened = 1] = "FolderOpened", n[n.Cpu = 2] = "Cpu", n))(S || {});
30
+ const Y = /* @__PURE__ */ U({
31
+ __name: "index",
32
+ setup(n) {
33
+ const p = K(), c = W(), { rawMenu: d } = C(p), { itemData: g } = C(c), m = G([]), $ = (e) => {
34
+ let o = [], r = [];
35
+ return e == null || e.forEach((s) => {
36
+ o = y(s, r);
37
+ }), console.log("splitMenu", o), o;
38
+ }, y = (e, o) => {
39
+ const r = o, s = [];
40
+ e == null || e.forEach((t) => {
41
+ Array.isArray(t) ? s.push({ children: y(t, []) }) : s.push({ title: t });
42
+ });
43
+ let a = s.reduce((t, u) => (Object.entries(u).forEach(([i, l]) => {
44
+ t[i] === void 0 ? l != null && l.title ? t[i] = [l] : t[i] = l : (Array.isArray(t[i]) || (t[i] = [{ title: t[i] }]), l != null && l.title ? t[i].push({ title: l == null ? void 0 : l.title }) : Array.isArray(l) ? t[i].push(l) : t[i].push({ title: l }));
45
+ }), t), {});
46
+ return a = w(D(a)), r.push(a), Array.isArray(r) && (r == null ? void 0 : r.length) > 1 ? r : r == null ? void 0 : r[0];
47
+ }, w = (e) => {
48
+ var o, r, s;
49
+ return Array.isArray(e == null ? void 0 : e.title) && ((o = e == null ? void 0 : e.title) == null ? void 0 : o.length) === ((s = (r = e == null ? void 0 : e.title) == null ? void 0 : r.filter((a) => a.title)) == null ? void 0 : s.length) ? e == null ? void 0 : e.title : Array.isArray(e == null ? void 0 : e.children) ? P(e) : e;
50
+ }, P = (e) => {
51
+ var r;
52
+ const o = e;
53
+ return o.children = (r = o.children) == null ? void 0 : r.map((s) => {
54
+ var a;
55
+ return (a = s == null ? void 0 : s.title) != null && a.children ? s == null ? void 0 : s.title : s;
56
+ }), o;
57
+ }, O = (e, o = "", r = 0) => {
58
+ var t;
59
+ const s = D(g.value), a = (t = s == null ? void 0 : s.filter((u) => {
60
+ var i;
61
+ return ((i = u.comp) == null ? void 0 : i.toUpperCase()) === "GROUP";
62
+ })) == null ? void 0 : t.map((u) => u.name);
63
+ return e == null ? void 0 : e.map((u) => {
64
+ const i = o ? `${o}/${u.title}` : u.title, l = {
65
+ ...u,
66
+ path: i,
67
+ level: r,
68
+ icon: S[`${r}`],
69
+ carryData: a == null ? void 0 : a.includes(i)
70
+ };
71
+ return u.children && u.children.length > 0 && (l.children = O(u.children, i, r + 1)), l;
72
+ });
73
+ }, h = E(() => {
74
+ const e = O(m.value);
75
+ return console.log("handleDefaultMenu", e), e;
76
+ }), R = (e) => {
77
+ console.log("clickMenu", e), p.setActiveMenuPath(e == null ? void 0 : e.path);
78
+ }, T = (e) => {
79
+ console.log("openMenu1", [e], h.value), p.setActiveMenuOpenPaths([e]), p.setActiveMenuPath(e);
80
+ }, j = (e) => {
81
+ p.setActiveMenuPath(e);
82
+ };
83
+ return V(() => d.value, (e) => {
84
+ var o, r;
85
+ if (e) {
86
+ const s = (r = (o = e.compData) == null ? void 0 : o[0]) == null ? void 0 : r.contents;
87
+ m.value = $(s), console.log("rawMenu", h.value);
88
+ }
89
+ }, {
90
+ immediate: !0
91
+ }), (e, o) => (_(), f(q(A), {
92
+ menuList: h.value,
93
+ onClickMenu: R,
94
+ onOpenMenu: T,
95
+ onCloseMenu: j,
96
+ class: "menuList-wrap"
97
+ }, {
98
+ title: b(({ menu: r }) => [
99
+ z(X, {
100
+ name: r.icon ?? ""
101
+ }, null, 8, ["name"]),
102
+ H("span", null, J(r.title ?? ""), 1)
103
+ ]),
104
+ _: 1
105
+ }, 8, ["menuList"]));
106
+ }
107
+ }), k = /* @__PURE__ */ Q(Y, [["__scopeId", "data-v-ab1f8f79"]]);
108
+ export {
109
+ k as default
110
+ };
@@ -0,0 +1,285 @@
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-0PzArXAH.js";
3
+ import { u as ee } from "./modelComp-BLx5jS0f.js";
4
+ import { _ as te, s as ne, c as k, u as he } from "./menu-3a4UTvU1.js";
5
+ const x = [
6
+ {
7
+ key: "FormName",
8
+ value: "Form"
9
+ },
10
+ {
11
+ key: "TableName",
12
+ value: "Table"
13
+ }
14
+ ], s = [
15
+ {
16
+ key: "FormDirect",
17
+ value: "formFlex"
18
+ },
19
+ {
20
+ key: "Form",
21
+ value: "formContent"
22
+ },
23
+ {
24
+ key: "FormButton",
25
+ value: "formButton"
26
+ },
27
+ {
28
+ key: "TableColumns",
29
+ value: "header"
30
+ },
31
+ {
32
+ key: "TableButton",
33
+ value: "extraButton"
34
+ },
35
+ {
36
+ key: "LineButton",
37
+ value: "rowButton"
38
+ },
39
+ {
40
+ key: "Table",
41
+ value: "tableContents"
42
+ },
43
+ {
44
+ key: "TableIndex",
45
+ value: "tableIndex"
46
+ }
47
+ ], ke = {
48
+ key: 0,
49
+ class: "show-content"
50
+ }, _e = { class: "item-view-group" }, Ce = {
51
+ __name: "index",
52
+ props: {
53
+ content: String,
54
+ jsonContents: Array
55
+ },
56
+ emits: ["change"],
57
+ setup(F, { emit: B }) {
58
+ const e = F, $ = B, h = ee(E), { itemData: p } = ne(h), b = _([]), w = _([]), L = (l) => {
59
+ $("change", {
60
+ wholeValue: b.value,
61
+ editValue: l
62
+ });
63
+ }, D = (l) => {
64
+ 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));
65
+ b.value = S;
66
+ };
67
+ V(
68
+ () => p.value,
69
+ () => {
70
+ var l;
71
+ !p.value || ((l = p.value) == null ? void 0 : l.length) === 0 || (w.value = p.value, b.value = p.value);
72
+ },
73
+ { deep: !0, immediate: !0 }
74
+ ), V(
75
+ () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
76
+ () => {
77
+ var g;
78
+ if (((g = e == null ? void 0 : e.jsonContents) == null ? void 0 : g.length) > 0) {
79
+ h.setOriginalData(e == null ? void 0 : e.jsonContents), h.setItemData(e == null ? void 0 : e.jsonContents);
80
+ return;
81
+ }
82
+ if (!(e != null && e.content) || (e == null ? void 0 : e.content) === "") return;
83
+ const l = ie(e == null ? void 0 : e.content);
84
+ h.setOriginalData(l), h.setItemData(l);
85
+ },
86
+ { deep: !0, immediate: !0 }
87
+ );
88
+ const N = (l) => de(l);
89
+ return (l, g) => {
90
+ var S;
91
+ return ((S = w.value) == null ? void 0 : S.length) > 0 ? (f(), C("div", ke, [
92
+ (f(!0), C(le, null, se(w.value, (c, j) => (f(), C("div", {
93
+ class: "item-content",
94
+ key: j
95
+ }, [
96
+ O("div", _e, v(c.name), 1),
97
+ (f(), Z(ue(N(c.comp)), {
98
+ itemData: c == null ? void 0 : c.compData,
99
+ childItemData: c == null ? void 0 : c.itemChildData,
100
+ key: j,
101
+ onChange: L,
102
+ index: j,
103
+ onContentChange: D
104
+ }, null, 40, ["itemData", "childItemData", "index"]))
105
+ ]))), 128))
106
+ ])) : I("", !0);
107
+ };
108
+ }
109
+ }, pe = /* @__PURE__ */ te(Ce, [["__scopeId", "data-v-869e6e20"]]), be = { class: "add-model-content" }, we = {
110
+ key: 0,
111
+ class: "model-import-data"
112
+ }, je = { class: "import-button" }, Se = { key: 0 }, xe = {
113
+ key: 1,
114
+ class: "model-operate"
115
+ }, Oe = { class: "model-select" }, Ie = { class: "model-fill" }, Ne = {
116
+ key: 2,
117
+ class: "model-view ssComponent"
118
+ }, Te = {
119
+ __name: "main",
120
+ props: {
121
+ mode: {
122
+ type: String,
123
+ default: "view"
124
+ },
125
+ content: {
126
+ type: String,
127
+ default: ""
128
+ },
129
+ jsonContents: {
130
+ type: Array,
131
+ default: () => []
132
+ },
133
+ showButton: {
134
+ type: Boolean,
135
+ default: !0
136
+ }
137
+ },
138
+ emits: ["change"],
139
+ setup(F, { emit: B }) {
140
+ const e = F, $ = B, h = _(""), p = _([]), b = _(0), w = ee(E);
141
+ he(E);
142
+ const { itemData: L, originalData: D } = ne(w), N = _(null), l = _(0), g = _(""), S = () => {
143
+ b.value = window.innerWidth;
144
+ }, c = (o) => {
145
+ var u;
146
+ const a = (u = k(o == null ? void 0 : o.wholeValue)) == null ? void 0 : u.map((n) => {
147
+ var m;
148
+ 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;
149
+ });
150
+ $("change", {
151
+ originalContents: D.value,
152
+ currentContents: o == null ? void 0 : o.wholeValue,
153
+ editContent: o == null ? void 0 : o.editValue,
154
+ stringContent: j(k(o == null ? void 0 : o.wholeValue)),
155
+ arrayToContents: a
156
+ });
157
+ }, j = (o) => {
158
+ var u;
159
+ let a = [];
160
+ return (u = k(o)) == null || u.forEach((n) => {
161
+ var m, y;
162
+ 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) => {
163
+ var M, R, z, W, q, G, H, K, P, Q, U, X;
164
+ if (s != null && s.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key)))
165
+ if (!((M = t == null ? void 0 : t.contents) != null && M.length))
166
+ 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");
167
+ else {
168
+ let i = (z = t == null ? void 0 : t.contents) == null ? void 0 : z[0];
169
+ if (!i) return;
170
+ if (Object.keys(i).includes("label") && Object.keys(i).includes("key") && Object.keys(i).includes("width"))
171
+ if (((q = (W = t.contents) == null ? void 0 : W.filter((d) => d.width !== 1)) == null ? void 0 : q.length) === 0) {
172
+ const d = (G = k(t == null ? void 0 : t.contents)) == null ? void 0 : G.map((r) => ({ [r.label]: r.value }));
173
+ 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");
174
+ } else {
175
+ let d = [];
176
+ (K = k(t == null ? void 0 : t.contents)) == null || K.reduce((r, J) => {
177
+ var Y;
178
+ return r[J.label] = J.key, ((Y = Object.keys(k(r))) == null ? void 0 : Y.length) >= J.width && (d.push(k(r)), r = {}), r;
179
+ }, {}), 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");
180
+ }
181
+ else if (Object.keys(i).includes("label")) {
182
+ const d = (Q = k(t == null ? void 0 : t.contents)) == null ? void 0 : Q.map((r) => r.label);
183
+ 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");
184
+ } else
185
+ 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");
186
+ }
187
+ });
188
+ }), JSON.stringify(a);
189
+ }, T = _([]), ae = () => {
190
+ N.value.click();
191
+ }, oe = (o) => {
192
+ const a = o.target.files[0];
193
+ if (!a) return;
194
+ const u = new FileReader();
195
+ u.onload = (n) => {
196
+ try {
197
+ h.value = n.target.result, T.value = re(n.target.result), l.value++;
198
+ } catch (m) {
199
+ console.error("解析失败:", m);
200
+ }
201
+ }, u.onerror = (n) => {
202
+ console.error("文件读取错误:", n);
203
+ }, u.readAsText(a);
204
+ };
205
+ ce(() => {
206
+ window.addEventListener("resize", S);
207
+ }), V(
208
+ () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
209
+ () => {
210
+ h.value = e == null ? void 0 : e.content, p.value = e == null ? void 0 : e.jsonContents;
211
+ },
212
+ { deep: !0, immediate: !0 }
213
+ ), V(
214
+ () => l.value,
215
+ () => {
216
+ var o;
217
+ ((o = T.value) == null ? void 0 : o.length) !== 0 && (w.setOriginalData(T.value), w.setItemData(T.value));
218
+ },
219
+ { deep: !0, immediate: !0 }
220
+ );
221
+ const re = (o) => {
222
+ let a = o.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
223
+ 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");
224
+ try {
225
+ return JSON.parse(a);
226
+ } catch (u) {
227
+ try {
228
+ const m = new Function(`return ${a}`)();
229
+ if (Array.isArray(m) || typeof m == "object")
230
+ return m;
231
+ throw new Error(`解析结果不是有效的数组或对象: ${u}`);
232
+ } catch (n) {
233
+ throw new Error(`无法解析JSON: ${n.message}`);
234
+ }
235
+ }
236
+ };
237
+ return (o, a) => {
238
+ var u;
239
+ return f(), C("div", be, [
240
+ ((u = e == null ? void 0 : e.jsonContents) == null ? void 0 : u.length) === 0 ? (f(), C("div", we, [
241
+ O("div", je, [
242
+ O("input", {
243
+ type: "file",
244
+ ref_key: "fileInput",
245
+ ref: N,
246
+ accept: ".txt",
247
+ onChange: oe,
248
+ style: { display: "none" }
249
+ }, null, 544),
250
+ O("button", {
251
+ onClick: ae,
252
+ class: "import-button-content"
253
+ }, "导入文件"),
254
+ g.value ? (f(), C("span", Se, v(g.value), 1)) : I("", !0)
255
+ ])
256
+ ])) : I("", !0),
257
+ (e == null ? void 0 : e.mode) === "edit" ? (f(), C("div", xe, [
258
+ O("div", Oe, [
259
+ A(me)
260
+ ]),
261
+ (f(), C("div", {
262
+ class: "model-show",
263
+ key: b.value
264
+ }, [
265
+ A(ye)
266
+ ])),
267
+ O("div", Ie, [
268
+ A(fe)
269
+ ])
270
+ ])) : I("", !0),
271
+ (e == null ? void 0 : e.mode) === "view" ? (f(), C("div", Ne, [
272
+ (f(), Z(pe, {
273
+ content: h.value,
274
+ onChange: c,
275
+ jsonContents: p.value,
276
+ key: b.value
277
+ }, null, 8, ["content", "jsonContents"]))
278
+ ])) : I("", !0)
279
+ ]);
280
+ };
281
+ }
282
+ }, De = /* @__PURE__ */ te(Te, [["__scopeId", "data-v-512609c1"]]);
283
+ export {
284
+ De as default
285
+ };