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