ss-component-new 1.1.21 → 1.1.23

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