ss-component-new 1.1.16 → 1.1.17

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