ss-component-new 1.1.12 → 1.1.15

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