ss-component-new 1.1.9 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,233 @@
1
+ import { ref as h, watch as x, createElementBlock as m, openBlock as i, createVNode as T, createCommentVNode as w, Fragment as G, renderList as K, createElementVNode as D, createBlock as V, toDisplayString as J, resolveDynamicComponent as L } from "vue";
2
+ import { p as b, u as W, e as Y, g as q, m as z, a as H, b as Q, c as X, s as Z } from "./array-W6uNHVCX.js";
3
+ import { u as P } from "./modelComp-CFwQm9Yp.js";
4
+ import { _ as E, u as R, s as N, c as $ } from "./menu-3a4UTvU1.js";
5
+ import ee from "./index-lqdgKFyj.js";
6
+ const ae = { class: "system-wrap" }, te = {
7
+ key: 0,
8
+ class: "show-content"
9
+ }, se = { class: "item-view-group" }, oe = {
10
+ __name: "index",
11
+ props: {
12
+ content: String,
13
+ jsonContents: Array
14
+ },
15
+ emits: ["change"],
16
+ setup(M, { emit: S }) {
17
+ const e = M, F = S, d = P(b);
18
+ W(b);
19
+ const y = R(), { itemData: g } = N(d), { activeMenuPath: k, activeMenuOpenPaths: O, menuTriggerType: U } = N(y), _ = h([]), p = h([]), j = (t) => {
20
+ F("change", {
21
+ wholeValue: _.value,
22
+ editValue: t
23
+ });
24
+ }, A = (t) => {
25
+ const n = $(_.value), l = n == null ? void 0 : n.map((o, r) => (r === (t == null ? void 0 : t.index) && (o.compData = t == null ? void 0 : t.contents), o));
26
+ _.value = l;
27
+ };
28
+ x(
29
+ () => g.value,
30
+ () => {
31
+ var n, l, o, r, a, s, c;
32
+ if (!g.value || ((n = g.value) == null ? void 0 : n.length) === 0) return;
33
+ const t = (o = (l = $(g.value)) == null ? void 0 : l.filter((u) => (u == null ? void 0 : u.comp) === "Group")) == null ? void 0 : o[0];
34
+ p.value = (a = (r = t == null ? void 0 : t.compData) == null ? void 0 : r[0]) == null ? void 0 : a.contents, _.value = (c = (s = t == null ? void 0 : t.compData) == null ? void 0 : s[0]) == null ? void 0 : c.contents, y.setActiveMenuPath(t == null ? void 0 : t.name);
35
+ },
36
+ { deep: !0, immediate: !0 }
37
+ ), x(() => k.value, (t) => {
38
+ var n, l, o, r, a;
39
+ if (t) {
40
+ const s = (n = $(g.value)) == null ? void 0 : n.find((c) => c.name === t);
41
+ t && s ? (p.value = (o = (l = s == null ? void 0 : s.compData) == null ? void 0 : l[0]) == null ? void 0 : o.contents, _.value = (a = (r = s == null ? void 0 : s.compData) == null ? void 0 : r[0]) == null ? void 0 : a.contents, console.log("点击-新-data:", t, p.value)) : (p.value = [], _.value = []);
42
+ }
43
+ }), x(
44
+ () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
45
+ () => {
46
+ var o;
47
+ if (((o = e == null ? void 0 : e.jsonContents) == null ? void 0 : o.length) > 0) {
48
+ d.setOriginalData(e == null ? void 0 : e.jsonContents), d.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 = Y(e == null ? void 0 : e.content);
53
+ console.log("newViewContents", t);
54
+ const n = Array.isArray(t) && (t == null ? void 0 : t.find((r) => {
55
+ var a;
56
+ return ((a = r.comp) == null ? void 0 : a.toUpperCase()) === "MENU";
57
+ }));
58
+ y.setRawMenu(n ?? {});
59
+ const l = Array.isArray(t) && (t == null ? void 0 : t.find((r) => {
60
+ var a;
61
+ return ((a = r.comp) == null ? void 0 : a.toUpperCase()) === "SYSTEM";
62
+ }));
63
+ y.setSystemKey((l == null ? void 0 : l.name) ?? ""), d.setOriginalData(t), d.setItemData(t);
64
+ },
65
+ { deep: !0, immediate: !0 }
66
+ );
67
+ const I = (t) => q(t);
68
+ return (t, n) => {
69
+ var l;
70
+ return i(), m("div", ae, [
71
+ T(ee, { class: "sys-aside" }),
72
+ ((l = p.value) == null ? void 0 : l.length) > 0 ? (i(), m("div", te, [
73
+ (i(!0), m(G, null, K(p.value, (o, r) => (i(), m("div", {
74
+ class: "item-content",
75
+ key: r
76
+ }, [
77
+ D("div", se, J(o.name), 1),
78
+ (i(), V(L(I(o.comp)), {
79
+ itemData: o == null ? void 0 : o.compData,
80
+ childItemData: o == null ? void 0 : o.itemChildData,
81
+ key: r,
82
+ onChange: j,
83
+ index: r,
84
+ onContentChange: A
85
+ }, null, 40, ["itemData", "childItemData", "index"]))
86
+ ]))), 128))
87
+ ])) : w("", !0)
88
+ ]);
89
+ };
90
+ }
91
+ }, ne = /* @__PURE__ */ E(oe, [["__scopeId", "data-v-515aa723"]]), re = { class: "add-model-content" }, le = {
92
+ key: 0,
93
+ class: "model-import-data"
94
+ }, ce = { class: "import-button" }, ue = { key: 0 }, ie = {
95
+ key: 1,
96
+ class: "model-operate"
97
+ }, me = { class: "model-select" }, de = { class: "model-fill" }, he = {
98
+ key: 2,
99
+ class: "model-view"
100
+ }, ge = {
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(M, { emit: S }) {
122
+ const e = M, F = S, d = h(""), y = h([]), g = h(0), k = P(b), O = R(b), { itemData: U, originalData: _ } = N(k), { activeMenuPath: p } = N(O), j = h(null), A = h(0), I = h(""), t = (a) => {
123
+ var c, u, v;
124
+ const s = (c = $(a == null ? void 0 : a.wholeValue)) == null ? void 0 : c.map((C) => {
125
+ var B;
126
+ return (C == null ? void 0 : C.comp) === "Form" && (C.compData = (B = C.compData) == null ? void 0 : B.map((f) => ((f == null ? void 0 : f.key) === "formContent" && (f.contents = X(f == null ? void 0 : f.contents)), f))), C;
127
+ });
128
+ F("change", {
129
+ originalContents: _.value,
130
+ currentContents: a == null ? void 0 : a.wholeValue,
131
+ editContent: a == null ? void 0 : a.editValue,
132
+ arrayToContents: s
133
+ }), Z(a == null ? void 0 : a.wholeValue, (u = a == null ? void 0 : a.editValue) == null ? void 0 : u.content, (v = a == null ? void 0 : a.editValue) == null ? void 0 : v.buttonName), console.log("change123", a == null ? void 0 : a.editValue, a == null ? void 0 : a.wholeValue);
134
+ }, n = h([]), l = () => {
135
+ j.value.click();
136
+ }, o = (a) => {
137
+ const s = a.target.files[0];
138
+ if (!s) return;
139
+ const c = new FileReader();
140
+ c.onload = (u) => {
141
+ try {
142
+ d.value = u.target.result, n.value = r(u.target.result), A.value++;
143
+ } catch (v) {
144
+ console.error("解析失败:", v);
145
+ }
146
+ }, c.onerror = (u) => {
147
+ console.error("文件读取错误:", u);
148
+ }, c.readAsText(s);
149
+ };
150
+ x(
151
+ () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
152
+ () => {
153
+ d.value = e == null ? void 0 : e.content, y.value = e == null ? void 0 : e.jsonContents;
154
+ },
155
+ { deep: !0, immediate: !0 }
156
+ ), x(
157
+ () => A.value,
158
+ () => {
159
+ var a;
160
+ ((a = n.value) == null ? void 0 : a.length) !== 0 && (k.setOriginalData(n.value), k.setItemData(n.value));
161
+ },
162
+ { deep: !0, immediate: !0 }
163
+ );
164
+ const r = (a) => {
165
+ let s = a.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
166
+ 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");
167
+ try {
168
+ return JSON.parse(s);
169
+ } catch (c) {
170
+ try {
171
+ const v = new Function(`return ${s}`)();
172
+ if (Array.isArray(v) || typeof v == "object")
173
+ return v;
174
+ throw new Error(`解析结果不是有效的数组或对象: ${c}`);
175
+ } catch (u) {
176
+ throw new Error(`无法解析JSON: ${u.message}`);
177
+ }
178
+ }
179
+ };
180
+ return (a, s) => {
181
+ var c;
182
+ return i(), m("div", re, [
183
+ ((c = e == null ? void 0 : e.jsonContents) == null ? void 0 : c.length) === 0 ? (i(), m("div", le, [
184
+ D("div", ce, [
185
+ D("input", {
186
+ type: "file",
187
+ ref_key: "fileInput",
188
+ ref: j,
189
+ accept: ".txt",
190
+ onChange: o,
191
+ style: { display: "none" }
192
+ }, null, 544),
193
+ D("button", {
194
+ onClick: l,
195
+ class: "import-button-content"
196
+ }, "导入文件"),
197
+ I.value ? (i(), m("span", ue, J(I.value), 1)) : w("", !0)
198
+ ])
199
+ ])) : w("", !0),
200
+ (e == null ? void 0 : e.mode) === "edit" ? (i(), m("div", ie, [
201
+ D("div", me, [
202
+ T(z)
203
+ ]),
204
+ (i(), m("div", {
205
+ class: "model-show",
206
+ key: g.value
207
+ }, [
208
+ T(H)
209
+ ])),
210
+ D("div", de, [
211
+ T(Q)
212
+ ])
213
+ ])) : w("", !0),
214
+ (e == null ? void 0 : e.mode) === "view" ? (i(), m("div", he, [
215
+ (i(), V(ne, {
216
+ content: d.value,
217
+ onChange: t,
218
+ jsonContents: y.value,
219
+ key: g.value
220
+ }, null, 8, ["content", "jsonContents"]))
221
+ ])) : w("", !0)
222
+ ]);
223
+ };
224
+ }
225
+ }, _e = /* @__PURE__ */ E(ge, [["__scopeId", "data-v-7c8f7d17"]]), ve = {
226
+ __name: "index",
227
+ setup(M) {
228
+ return (S, e) => (i(), V(_e, { class: "ssComponent" }));
229
+ }
230
+ }, ke = /* @__PURE__ */ E(ve, [["__scopeId", "data-v-f196ec9f"]]);
231
+ export {
232
+ ke as default
233
+ };