ss-component-new 1.1.12 → 1.1.16

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,233 +0,0 @@
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 B, 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: E, menuTriggerType: U } = N(y), _ = h([]), C = 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
- C.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 ? (C.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, C.value)) : (C.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 = C.value) == null ? void 0 : l.length) > 0 ? (i(), m("div", te, [
73
- (i(!0), m(G, null, K(C.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__ */ B(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), E = R(b), { itemData: U, originalData: _ } = N(k), { activeMenuPath: C } = N(E), 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((p) => {
125
- var O;
126
- return (p == null ? void 0 : p.comp) === "Form" && (p.compData = (O = p.compData) == null ? void 0 : O.map((f) => ((f == null ? void 0 : f.key) === "formContent" && (f.contents = X(f == null ? void 0 : f.contents)), f))), p;
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 && (e != null && e.showButton) ? (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__ */ B(ge, [["__scopeId", "data-v-073c3b72"]]), ve = {
226
- __name: "index",
227
- setup(M) {
228
- return (S, e) => (i(), V(_e, { class: "ssComponent" }));
229
- }
230
- }, ke = /* @__PURE__ */ B(ve, [["__scopeId", "data-v-f196ec9f"]]);
231
- export {
232
- ke as default
233
- };
@@ -1,110 +0,0 @@
1
- import { defineAsyncComponent as B, computed as E, onMounted as F, resolveComponent as L, createBlock as f, openBlock as _, withCtx as b, resolveDynamicComponent as N, defineComponent as U, ref as G, watch as V, unref as q, createVNode as z, createElementVNode as H, toDisplayString as J } from "vue";
2
- import { E as M, u as K, s as C, c as D, _ as Q } from "./menu-3a4UTvU1.js";
3
- import { u as W } from "./modelComp-CFwQm9Yp.js";
4
- const A = B(() => import("./index-hjkvqVVf.js"));
5
- A.install = (n) => {
6
- n.component("ssMenu", A);
7
- };
8
- const X = {
9
- __name: "index",
10
- props: {
11
- name: String
12
- },
13
- setup(n) {
14
- const p = n, c = E(() => M[p.name]);
15
- return F(() => {
16
- const d = Object.keys(M);
17
- console.log("iconComponent", c.value, p.name, M, d);
18
- }), (d, g) => {
19
- const m = L("el-icon");
20
- return _(), f(m, null, {
21
- default: b(() => [
22
- (_(), f(N(c.value)))
23
- ]),
24
- _: 1
25
- });
26
- };
27
- }
28
- };
29
- var S = /* @__PURE__ */ ((n) => (n[n.Menu = 0] = "Menu", n[n.FolderOpened = 1] = "FolderOpened", n[n.Cpu = 2] = "Cpu", n))(S || {});
30
- const Y = /* @__PURE__ */ U({
31
- __name: "index",
32
- setup(n) {
33
- const p = K(), c = W(), { rawMenu: d } = C(p), { itemData: g } = C(c), m = G([]), $ = (e) => {
34
- let o = [], r = [];
35
- return e == null || e.forEach((s) => {
36
- o = y(s, r);
37
- }), console.log("splitMenu", o), o;
38
- }, y = (e, o) => {
39
- const r = o, s = [];
40
- e == null || e.forEach((t) => {
41
- Array.isArray(t) ? s.push({ children: y(t, []) }) : s.push({ title: t });
42
- });
43
- let a = s.reduce((t, u) => (Object.entries(u).forEach(([i, l]) => {
44
- t[i] === void 0 ? l != null && l.title ? t[i] = [l] : t[i] = l : (Array.isArray(t[i]) || (t[i] = [{ title: t[i] }]), l != null && l.title ? t[i].push({ title: l == null ? void 0 : l.title }) : Array.isArray(l) ? t[i].push(l) : t[i].push({ title: l }));
45
- }), t), {});
46
- return a = w(D(a)), r.push(a), Array.isArray(r) && (r == null ? void 0 : r.length) > 1 ? r : r == null ? void 0 : r[0];
47
- }, w = (e) => {
48
- var o, r, s;
49
- return Array.isArray(e == null ? void 0 : e.title) && ((o = e == null ? void 0 : e.title) == null ? void 0 : o.length) === ((s = (r = e == null ? void 0 : e.title) == null ? void 0 : r.filter((a) => a.title)) == null ? void 0 : s.length) ? e == null ? void 0 : e.title : Array.isArray(e == null ? void 0 : e.children) ? P(e) : e;
50
- }, P = (e) => {
51
- var r;
52
- const o = e;
53
- return o.children = (r = o.children) == null ? void 0 : r.map((s) => {
54
- var a;
55
- return (a = s == null ? void 0 : s.title) != null && a.children ? s == null ? void 0 : s.title : s;
56
- }), o;
57
- }, O = (e, o = "", r = 0) => {
58
- var t;
59
- const s = D(g.value), a = (t = s == null ? void 0 : s.filter((u) => {
60
- var i;
61
- return ((i = u.comp) == null ? void 0 : i.toUpperCase()) === "GROUP";
62
- })) == null ? void 0 : t.map((u) => u.name);
63
- return e == null ? void 0 : e.map((u) => {
64
- const i = o ? `${o}/${u.title}` : u.title, l = {
65
- ...u,
66
- path: i,
67
- level: r,
68
- icon: S[`${r}`],
69
- carryData: a == null ? void 0 : a.includes(i)
70
- };
71
- return u.children && u.children.length > 0 && (l.children = O(u.children, i, r + 1)), l;
72
- });
73
- }, h = E(() => {
74
- const e = O(m.value);
75
- return console.log("handleDefaultMenu", e), e;
76
- }), R = (e) => {
77
- console.log("clickMenu", e), p.setActiveMenuPath(e == null ? void 0 : e.path);
78
- }, T = (e) => {
79
- console.log("openMenu1", [e], h.value), p.setActiveMenuOpenPaths([e]), p.setActiveMenuPath(e);
80
- }, j = (e) => {
81
- p.setActiveMenuPath(e);
82
- };
83
- return V(() => d.value, (e) => {
84
- var o, r;
85
- if (e) {
86
- const s = (r = (o = e.compData) == null ? void 0 : o[0]) == null ? void 0 : r.contents;
87
- m.value = $(s), console.log("rawMenu", h.value);
88
- }
89
- }, {
90
- immediate: !0
91
- }), (e, o) => (_(), f(q(A), {
92
- menuList: h.value,
93
- onClickMenu: R,
94
- onOpenMenu: T,
95
- onCloseMenu: j,
96
- class: "menuList-wrap"
97
- }, {
98
- title: b(({ menu: r }) => [
99
- z(X, {
100
- name: r.icon ?? ""
101
- }, null, 8, ["name"]),
102
- H("span", null, J(r.title ?? ""), 1)
103
- ]),
104
- _: 1
105
- }, 8, ["menuList"]));
106
- }
107
- }), k = /* @__PURE__ */ Q(Y, [["__scopeId", "data-v-ab1f8f79"]]);
108
- export {
109
- k as default
110
- };