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