ss-component-new 1.1.72 → 1.1.73

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,254 @@
1
+ import { v as M, c as x } from "./array-BtcGNRWC.js";
2
+ import { ref as Y } from "vue";
3
+ import { c as l } from "./cloneDeep-BcUiE4Tq.js";
4
+ const L = Y(0), Z = (e) => {
5
+ let s;
6
+ e.includes(`\r
7
+ `) ? s = e.split(`\r
8
+ `).filter((t) => t.trim() !== "") : s = e.split(`
9
+ `).filter((t) => t.trim() !== "");
10
+ const p = [];
11
+ let r = "";
12
+ for (const t of s)
13
+ t.includes("{") || r.includes("{") || t.includes("[") || r.includes("[") || t.includes("【") || r.includes("【") || t.includes("(") || r.includes("(") || t.includes("(") || r.includes("(") || t.includes("/*") || r.includes("/*") ? (r += t.trim(), l(r).split("{").length - 1 === l(r).split("}").length - 1 && l(r).split("【").length - 1 === l(r).split("】").length - 1 && l(r).split("[").length - 1 === l(r).split("]").length - 1 && l(r).split("(").length - 1 === l(r).split(")").length - 1 && l(r).split("(").length - 1 === l(r).split(")").length - 1 && l(r).split("/*").length - 1 === l(r).split("*/").length - 1 && (p.push(r), r = "")) : p.push(t.trim());
14
+ return p;
15
+ }, _ = (e) => {
16
+ const [s, p] = e.split(/=(.+)/), r = s.replace(/['"]/g, "").trim(), t = p.replace(/^['"]|['"]$/g, "");
17
+ return { key: r, value: t };
18
+ }, V = (e) => {
19
+ try {
20
+ return JSON.parse(e), !0;
21
+ } catch {
22
+ return !1;
23
+ }
24
+ }, R = (e) => {
25
+ try {
26
+ const s = e.replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",").replace(/:/g, ":").replace(/:\s*(?=,|}|$)/g, ': ""');
27
+ if (l(s).split("{").length - 1 > 1) {
28
+ let p = l(s).replace(/^\{(.*)\}$/, "[$1]");
29
+ if (V(p) && !p.includes("$") || (p = p.replace(/"([^"]+)"\$([\w\u4e00-\u9fa5]+\([^)]*\))/g, '"$1$$$2"')), V(p)) {
30
+ const r = JSON.parse(p);
31
+ let t = [];
32
+ return r == null || r.forEach((o) => {
33
+ var y;
34
+ (y = Object.entries(l(o))) == null || y.forEach((i) => {
35
+ L.value++, t.push({
36
+ id: L.value,
37
+ key: (i == null ? void 0 : i[0]) ?? "",
38
+ value: (i == null ? void 0 : i[1]) === "" ? "" : i == null ? void 0 : i[1],
39
+ // 如果值为空,则key设为空字符串,否则保留原值
40
+ width: Object.keys(l(o)).length
41
+ });
42
+ });
43
+ }), t;
44
+ } else
45
+ return console.error("转换类型不正确:"), [];
46
+ } else if (V(s)) {
47
+ const p = JSON.parse(s);
48
+ return Object.entries(p).map(([r, t]) => (L.value++, {
49
+ id: L.value,
50
+ key: r,
51
+ value: t === "" ? "" : t,
52
+ // 如果值为空,则key设为空字符串,否则保留原值
53
+ width: 1
54
+ }));
55
+ } else
56
+ return s;
57
+ } catch (s) {
58
+ return console.error("转换失败:", s), [];
59
+ }
60
+ }, w = (e, s) => {
61
+ var p;
62
+ try {
63
+ if ((p = M) != null && p.find((r) => (r == null ? void 0 : r.key) === s))
64
+ return e.replace(/['"]/g, "").trim();
65
+ if (l(e).split("[").length - 1 > 1) {
66
+ const r = l(e).replace(/[’]|[‘]|[']/g, '"').replaceAll(/,/g, ",").replaceAll("(", "[").replaceAll(")", "]").replaceAll("],]", "]]");
67
+ return JSON.parse(r);
68
+ } else {
69
+ const r = l(e).replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",");
70
+ if (V(r)) {
71
+ const t = JSON.parse(r);
72
+ return Array.isArray(t) ? t.map((o) => ({ label: o })) : t;
73
+ } else
74
+ return R(l(e));
75
+ }
76
+ } catch (r) {
77
+ return console.error("解析失败:", r), e;
78
+ }
79
+ }, S = (e) => ({ [e == null ? void 0 : e.key]: w(e == null ? void 0 : e.value, e == null ? void 0 : e.key) }), v = (e) => {
80
+ try {
81
+ if (l(e).split("[").length - 1 > 1) {
82
+ const s = l(e).replace(/[’]|[‘]|[']/g, '"').replaceAll(/,/g, ",").replaceAll("(", "[").replaceAll(")", "]").replaceAll("],]", "]]");
83
+ return JSON.parse(s);
84
+ } else
85
+ return JSON.parse(l(e).replace(/[’]|[‘]|[']/g, '"').replace(/,/g, ",")).map((p) => ({ label: p }));
86
+ } catch (s) {
87
+ return console.error("解析失败:", s), e;
88
+ }
89
+ }, ee = (e) => {
90
+ const s = e.match(/\(([^)]+)\)/);
91
+ return s ? s[1] : "";
92
+ }, re = (e) => {
93
+ const s = e.match(/^([^(]+)\s*\(/);
94
+ return s ? s[1].trim() : e;
95
+ }, Q = (e) => e.replace(/'/g, "").replace(/"/g, "").replace(/{|}/g, "").split(":").map((s) => s.trim()).filter((s) => s).join("/"), te = (e) => {
96
+ var y, i;
97
+ let s = [], p = [];
98
+ const r = (y = l(e)) == null ? void 0 : y.map((d) => d == null ? void 0 : d.key), t = [...new Set((i = l(r)) == null ? void 0 : i.map((d) => ee(d)))];
99
+ t == null || t.forEach((d) => {
100
+ let U = e == null ? void 0 : e.filter((u) => u.key.includes(d));
101
+ U == null || U.forEach((u) => {
102
+ u != null && u.key.includes("Menus") && (s.push({
103
+ key: "GroupName",
104
+ value: Q(u == null ? void 0 : u.value)
105
+ }), p.push(Q(u == null ? void 0 : u.value)));
106
+ });
107
+ let C = e == null ? void 0 : e.filter((u) => u.key.includes(d) && !(u != null && u.key.includes("Menus")));
108
+ C = C == null ? void 0 : C.map((u) => (u.key = re(u.key), u));
109
+ const P = {
110
+ key: "GroupContents",
111
+ value: C
112
+ };
113
+ s.push(P);
114
+ });
115
+ const o = {
116
+ key: "Menus",
117
+ value: p
118
+ };
119
+ return s.unshift(o), s;
120
+ }, X = (e) => {
121
+ var s, p;
122
+ if (Array.isArray(Object.keys(e)) && ((s = Object.keys(e)) == null ? void 0 : s.length) > 0) {
123
+ let r = [];
124
+ return (p = Object.entries(e)) == null || p.forEach(([t, o]) => {
125
+ var i, d;
126
+ let y = [];
127
+ if (y.push(t), ((i = Object.keys(o)) == null ? void 0 : i.length) > 0) {
128
+ let U = [];
129
+ U.push((d = X(o)) == null ? void 0 : d[0]), y.push(U == null ? void 0 : U[0]);
130
+ }
131
+ r.push(y);
132
+ }), r;
133
+ }
134
+ }, se = (e, s) => {
135
+ var r;
136
+ let p = s;
137
+ return Array.isArray(Object.keys(e)) && ((r = Object.entries(e)) == null || r.forEach(([t, o]) => {
138
+ let y = [t];
139
+ if (typeof o == "object" && o !== null) {
140
+ let i = X(o);
141
+ i == null || i.forEach((d) => {
142
+ y.push(d);
143
+ });
144
+ }
145
+ p.push(y);
146
+ })), p;
147
+ }, ce = (e) => {
148
+ const s = {};
149
+ return e.forEach((r) => {
150
+ const t = r.split("/");
151
+ let o = s;
152
+ t.forEach((y) => {
153
+ o[y] || (o[y] = {}), o = o[y];
154
+ });
155
+ }), se(s, []);
156
+ }, le = (e) => ce(e), ue = (e) => {
157
+ var y, i, d, U, C, P, u;
158
+ const s = Z((i = (y = l(e)) == null ? void 0 : y.replace("(", "(")) == null ? void 0 : i.replace(")", ")")), p = (U = (d = l(s)) == null ? void 0 : d.filter((c) => !c.includes("/*"))) == null ? void 0 : U.map((c) => _(c)), r = te(p), t = [];
159
+ (C = l(r)) == null || C.forEach((c) => {
160
+ var D, n, a, $, b, E, g, J, N;
161
+ (D = M) != null && D.find((h) => {
162
+ var m, k;
163
+ return ((m = h == null ? void 0 : h.key) == null ? void 0 : m.toUpperCase()) === ((k = c == null ? void 0 : c.key) == null ? void 0 : k.toUpperCase());
164
+ }) ? t.push({
165
+ comp: ((a = (n = M) == null ? void 0 : n.find((h) => {
166
+ var m, k;
167
+ return ((m = h == null ? void 0 : h.key) == null ? void 0 : m.toUpperCase()) === ((k = c == null ? void 0 : c.key) == null ? void 0 : k.toUpperCase());
168
+ })) == null ? void 0 : a.value) ?? "",
169
+ name: ($ = c == null ? void 0 : c.value) == null ? void 0 : $.replace(/[’]|[‘]|[']/g, ""),
170
+ compData: []
171
+ }) : (b = x) != null && b.find((h) => {
172
+ var m, k;
173
+ return ((m = h == null ? void 0 : h.key) == null ? void 0 : m.toUpperCase()) === ((k = c == null ? void 0 : c.key) == null ? void 0 : k.toUpperCase());
174
+ }) && ((t == null ? void 0 : t.length) === 0 && (E = c.key) != null && E.includes("Menus") && t.push({
175
+ comp: "Menu",
176
+ name: "",
177
+ compData: []
178
+ }), (g = t == null ? void 0 : t[(t == null ? void 0 : t.length) - 1]) != null && g.compData && t[(t == null ? void 0 : t.length) - 1].compData.push({
179
+ key: (N = (J = x) == null ? void 0 : J.find((h) => {
180
+ var m, k;
181
+ return ((m = h == null ? void 0 : h.key) == null ? void 0 : m.toUpperCase()) === ((k = c == null ? void 0 : c.key) == null ? void 0 : k.toUpperCase());
182
+ })) == null ? void 0 : N.value,
183
+ contents: c == null ? void 0 : c.value
184
+ }));
185
+ });
186
+ let o = (P = l(t)) == null ? void 0 : P.map((c) => {
187
+ var D;
188
+ return c != null && c.compData && (c.compData = (D = c == null ? void 0 : c.compData) == null ? void 0 : D.map((n) => {
189
+ var a, $, b, E, g, J, N, h, m, k, T;
190
+ if ((n == null ? void 0 : n.key) === "formFlex")
191
+ n.contents = (($ = (a = n.contents) == null ? void 0 : a.replace(/[’]|[‘]|[']/g, "")) == null ? void 0 : $.toUpperCase()) !== "Vertical".toUpperCase();
192
+ else if ((n == null ? void 0 : n.key) === "groupContents")
193
+ n.contents = (b = l(n.contents)) == null ? void 0 : b.map((G) => S(l(G)));
194
+ else if (Array.isArray(n == null ? void 0 : n.contents))
195
+ n.contents = le(n.contents);
196
+ else if (((g = (E = n == null ? void 0 : n.contents) == null ? void 0 : E.trim()) != null && g.startsWith("[") || (N = (J = n.contents) == null ? void 0 : J.trim()) != null && N.startsWith("【")) && ((m = (h = n.contents) == null ? void 0 : h.trim()) != null && m.endsWith("]") || (T = (k = n.contents) == null ? void 0 : k.trim()) != null && T.endsWith("】")))
197
+ n.contents = v(l(n.contents));
198
+ else {
199
+ if (!n.contents) return;
200
+ n.contents = R(l(n.contents));
201
+ }
202
+ return n;
203
+ })), c;
204
+ });
205
+ return o = (u = l(o)) == null ? void 0 : u.map((c) => {
206
+ var D;
207
+ return (c == null ? void 0 : c.comp) === "Group" && (c.compData = (D = c.compData) == null ? void 0 : D.map((n) => {
208
+ var $;
209
+ let a = [];
210
+ return ($ = n.contents) == null || $.forEach((b) => {
211
+ var E, g, J, N, h, m, k, T, G, W, I, F, H, q, z, B, K;
212
+ if ((E = M) != null && E.find((f) => {
213
+ var O, j, A;
214
+ return ((O = f == null ? void 0 : f.key) == null ? void 0 : O.toUpperCase()) === ((A = (j = Object.keys(b)) == null ? void 0 : j[0]) == null ? void 0 : A.toUpperCase());
215
+ }))
216
+ a.push({
217
+ comp: (J = (g = M) == null ? void 0 : g.find((f) => {
218
+ var O, j, A;
219
+ return ((O = f == null ? void 0 : f.key) == null ? void 0 : O.toUpperCase()) === ((A = (j = Object.keys(b)) == null ? void 0 : j[0]) == null ? void 0 : A.toUpperCase());
220
+ })) == null ? void 0 : J.value,
221
+ name: (h = (N = Object.values(b)) == null ? void 0 : N[0]) == null ? void 0 : h.replace(/[’]|[‘]|[']/g, ""),
222
+ compData: []
223
+ });
224
+ else if ((m = x) != null && m.find((f) => {
225
+ var O, j, A;
226
+ return ((O = f == null ? void 0 : f.key) == null ? void 0 : O.toUpperCase()) === ((A = (j = Object.keys(b)) == null ? void 0 : j[0]) == null ? void 0 : A.toUpperCase());
227
+ })) {
228
+ if ((a == null ? void 0 : a.length) === 0) return;
229
+ (k = a == null ? void 0 : a[(a == null ? void 0 : a.length) - 1]) != null && k.compData && a[(a == null ? void 0 : a.length) - 1].compData.push({
230
+ key: (G = (T = x) == null ? void 0 : T.find((f) => {
231
+ var O, j, A;
232
+ return ((O = f == null ? void 0 : f.key) == null ? void 0 : O.toUpperCase()) === ((A = (j = Object.keys(b)) == null ? void 0 : j[0]) == null ? void 0 : A.toUpperCase());
233
+ })) == null ? void 0 : G.value,
234
+ contents: (W = Object.values(b)) == null ? void 0 : W[0]
235
+ });
236
+ } else if ((F = (I = Object.keys(b)) == null ? void 0 : I[0]) != null && F.includes("$")) {
237
+ const f = (q = (H = Object.keys(l(b))) == null ? void 0 : H[0]) == null ? void 0 : q.split("$");
238
+ a[(a == null ? void 0 : a.length) - 1].compData.push({
239
+ key: (B = (z = x) == null ? void 0 : z.find((O) => {
240
+ var j, A;
241
+ return ((j = O == null ? void 0 : O.key) == null ? void 0 : j.toUpperCase()) === ((A = f == null ? void 0 : f[0]) == null ? void 0 : A.toUpperCase());
242
+ })) == null ? void 0 : B.value,
243
+ contents: (K = Object.values(b)) == null ? void 0 : K[0],
244
+ selectLabel: f == null ? void 0 : f[1]
245
+ });
246
+ }
247
+ return b;
248
+ }), n.contents = a, n;
249
+ })), c;
250
+ }), o;
251
+ };
252
+ export {
253
+ ue as e
254
+ };
@@ -1,8 +1,9 @@
1
1
  import { defineAsyncComponent as U, computed as D, onMounted as O, resolveComponent as G, createBlock as v, openBlock as C, withCtx as I, resolveDynamicComponent as N, defineComponent as k, ref as T, watch as q } from "vue";
2
- import { E as M, u as z, s as E } from "./menu-oGClEGzK.js";
3
- import { u as H } from "./modelComp-CqA1NVfH.js";
4
- import { c as f } from "./_plugin-vue_export-helper-B7R8Jogt.js";
5
- const g = U(() => import("./index-BvoThyOF.js"));
2
+ import { E as M } from "./index-NvpJBKaz.js";
3
+ import { u as z, s as E } from "./menu-Dez5HOn4.js";
4
+ import { u as H } from "./modelComp-BdUI1DVP.js";
5
+ import { c as f } from "./cloneDeep-BcUiE4Tq.js";
6
+ const g = U(() => import("./index-BQ18EzV6.js"));
6
7
  g.install = (u) => {
7
8
  u.component("ssMenu", g);
8
9
  };
@@ -12,64 +13,64 @@ const J = {
12
13
  name: String
13
14
  },
14
15
  setup(u) {
15
- const c = u, m = D(() => M[c.name]);
16
+ const m = u, p = D(() => M[m.name]);
16
17
  return O(() => {
17
- const p = Object.keys(M);
18
- console.log("iconComponent", m.value, c.name, M, p);
19
- }), (p, A) => {
18
+ const c = Object.keys(M);
19
+ console.log("iconComponent", p.value, m.name, M, c);
20
+ }), (c, A) => {
20
21
  const d = G("el-icon");
21
22
  return C(), v(d, null, {
22
23
  default: I(() => [
23
- (C(), v(N(m.value)))
24
+ (C(), v(N(p.value)))
24
25
  ]),
25
26
  _: 1
26
27
  });
27
28
  };
28
29
  }
29
- }, Y = k({
30
+ }, Z = k({
30
31
  name: "menu",
31
32
  components: {
32
33
  ssMenu: g,
33
34
  DynamicIcon: J
34
35
  },
35
36
  setup() {
36
- const u = z(), c = H(), { rawMenu: m, menuTriggerType: p } = E(u), { itemData: A } = E(c), d = T([]);
37
+ const u = z(), m = H(), { rawMenu: p, menuTriggerType: c } = E(u), { itemData: A } = E(m), d = T([]);
37
38
  let h;
38
39
  ((e) => {
39
40
  e[e.Menu = 0] = "Menu", e[e.FolderOpened = 1] = "FolderOpened";
40
41
  })(h || (h = {}));
41
42
  const S = (e) => {
42
- let n = [], s = [];
43
+ let o = [], s = [];
43
44
  return e == null || e.forEach((r) => {
44
- n = y(r, s);
45
- }), console.log("splitMenu", n), n;
46
- }, y = (e, n) => {
47
- const s = n, r = [];
48
- e == null || e.forEach((o) => {
49
- Array.isArray(o) ? r.push({ children: y(o, []) }) : r.push({ title: o });
45
+ o = y(r, s);
46
+ }), console.log("splitMenu", o), o;
47
+ }, y = (e, o) => {
48
+ const s = o, r = [];
49
+ e == null || e.forEach((n) => {
50
+ Array.isArray(n) ? r.push({ children: y(n, []) }) : r.push({ title: n });
50
51
  });
51
- let i = r.reduce((o, a) => (Object.entries(a).forEach(([t, l]) => {
52
- o[t] === void 0 ? l != null && l.title ? o[t] = [l] : o[t] = l : (Array.isArray(o[t]) || (o[t] = [{ title: o[t] }]), l != null && l.title || Array.isArray(l) ? o[t].push(l) : o[t].push({ title: l }));
53
- }), o), {});
52
+ let i = r.reduce((n, a) => (Object.entries(a).forEach(([t, l]) => {
53
+ n[t] === void 0 ? l != null && l.title ? n[t] = [l] : n[t] = l : (Array.isArray(n[t]) || (n[t] = [{ title: n[t] }]), l != null && l.title || Array.isArray(l) ? n[t].push(l) : n[t].push({ title: l }));
54
+ }), n), {});
54
55
  return i = F(f(i)), s.push(i), Array.isArray(s) && (s == null ? void 0 : s.length) > 1 ? s : s == null ? void 0 : s[0];
55
56
  }, F = (e) => {
56
- var n, s, r;
57
- return Array.isArray(e == null ? void 0 : e.title) && ((n = e == null ? void 0 : e.title) == null ? void 0 : n.length) === ((r = (s = e == null ? void 0 : e.title) == null ? void 0 : s.filter((i) => i.title)) == null ? void 0 : r.length) ? e == null ? void 0 : e.title : Array.isArray(e == null ? void 0 : e.children) ? P(e) : e;
57
+ var o, s, r;
58
+ return Array.isArray(e == null ? void 0 : e.title) && ((o = e == null ? void 0 : e.title) == null ? void 0 : o.length) === ((r = (s = e == null ? void 0 : e.title) == null ? void 0 : s.filter((i) => i.title)) == null ? void 0 : r.length) ? e == null ? void 0 : e.title : Array.isArray(e == null ? void 0 : e.children) ? P(e) : e;
58
59
  }, P = (e) => {
59
60
  var s;
60
- const n = e;
61
- return n.children = (s = n.children) == null ? void 0 : s.map((r) => {
61
+ const o = e;
62
+ return o.children = (s = o.children) == null ? void 0 : s.map((r) => {
62
63
  var i;
63
64
  return (i = r == null ? void 0 : r.title) != null && i.children ? r == null ? void 0 : r.title : r;
64
- }), n;
65
- }, b = (e, n = "", s = 0) => {
66
- var o;
67
- const r = f(A.value), i = (o = r == null ? void 0 : r.filter((a) => {
65
+ }), o;
66
+ }, b = (e, o = "", s = 0) => {
67
+ var n;
68
+ const r = f(A.value), i = (n = r == null ? void 0 : r.filter((a) => {
68
69
  var t;
69
70
  return ((t = a.comp) == null ? void 0 : t.toUpperCase()) === "GROUP";
70
- })) == null ? void 0 : o.map((a) => a.name);
71
+ })) == null ? void 0 : n.map((a) => a.name);
71
72
  return e == null ? void 0 : e.map((a) => {
72
- const t = n ? `${n}/${a.title}` : a.title, l = {
73
+ const t = o ? `${o}/${a.title}` : a.title, l = {
73
74
  ...a,
74
75
  path: t,
75
76
  level: s,
@@ -84,7 +85,7 @@ const J = {
84
85
  }), $ = (e) => {
85
86
  console.log("clickMenu", e), u.setMenuTriggerType("click"), u.setActiveMenuPath(e == null ? void 0 : e.path);
86
87
  }, R = (e) => {
87
- p.value === "click" ? u.setActiveMenuPath(e) : u.setMenuTriggerType("click");
88
+ c.value === "click" ? u.setActiveMenuPath(e) : u.setMenuTriggerType("click");
88
89
  }, j = (e) => {
89
90
  u.setActiveMenuPath(e);
90
91
  }, w = T([
@@ -113,17 +114,17 @@ const J = {
113
114
  value: "#1d7bef"
114
115
  }
115
116
  ]), B = () => {
116
- var n;
117
+ var o;
117
118
  const e = document.documentElement;
118
- (n = w.value) == null || n.forEach((s) => {
119
+ (o = w.value) == null || o.forEach((s) => {
119
120
  e.style.setProperty(s.name, s.value);
120
121
  });
121
122
  };
122
123
  return O(() => {
123
- }), q(() => m.value, (e) => {
124
- var n, s, r;
124
+ }), q(() => p.value, (e) => {
125
+ var o, s, r;
125
126
  if (e) {
126
- const i = (r = (s = (n = f(e)) == null ? void 0 : n.compData) == null ? void 0 : s[0]) == null ? void 0 : r.contents;
127
+ const i = (r = (s = (o = f(e)) == null ? void 0 : o.compData) == null ? void 0 : s[0]) == null ? void 0 : r.contents;
127
128
  d.value = S(i), console.log("rawMenu", _.value);
128
129
  } else
129
130
  u.setActiveMenuPath("");
@@ -139,5 +140,5 @@ const J = {
139
140
  }
140
141
  });
141
142
  export {
142
- Y as _
143
+ Z as _
143
144
  };