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