ss-component-new 1.1.20 → 1.1.21

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