ss-component-new 1.1.113 → 1.1.116
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-DLX9HpUG.js +1956 -0
- package/dist/array-tWsmTH5r.cjs +7 -0
- package/dist/{cloneDeep-BfzU0pBe.js → cloneDeep-B2CowBmY.js} +42 -48
- package/dist/cloneDeep-Fj9bqNcO.cjs +1 -0
- package/dist/index-2BSH90QR.cjs +6 -0
- package/dist/{index-BTt24r3U.cjs → index-B2V71oy_.cjs} +1 -1
- package/dist/{index-DxyREQkR.js → index-B5nXV29K.js} +78 -76
- package/dist/index-B6bxf0h2.js +196 -0
- package/dist/{index-COPrDtid.js → index-BEAnS4I-.js} +1 -1
- package/dist/{index-CyQkKXnK.js → index-BGhy_ENi.js} +255 -187
- package/dist/index-BNf8v3E7.cjs +1 -0
- package/dist/index-BXJIxGj9.cjs +1 -0
- package/dist/index-BYNM1Eo-.js +432 -0
- package/dist/index-B_pYEWlS.cjs +6 -0
- package/dist/index-Bo8JGvd0.cjs +1 -0
- package/dist/index-BvvxVAFa.cjs +1 -0
- package/dist/index-C1qnTNzC.cjs +1 -0
- package/dist/index-C86gx6Ye.cjs +1 -0
- package/dist/{index-B4WYIlOz.cjs → index-CbuB7VDV.cjs} +1 -1
- package/dist/{index-B3iQoZwc.js → index-CdRgYGoU.js} +631 -625
- package/dist/{index-BpJeYb4X.js → index-CeJMZbXG.js} +1 -1
- package/dist/index-D0yDjxaf.cjs +1 -0
- package/dist/index-DCRZ9Y1m.js +199 -0
- package/dist/index-DD3Jbedk.cjs +1 -0
- package/dist/index-DH5pTE-1.js +304 -0
- package/dist/index-DQ8UtE2z.js +74 -0
- package/dist/index-DTs391JS.js +208 -0
- package/dist/{index-BMLnfdpX.js → index-DYee8R31.js} +4 -3
- package/dist/{index-BH3F6_ql.js → index-DdiwlYxv.js} +1025 -1121
- package/dist/{index-ChXKNVG8.cjs → index-DjHNYg39.cjs} +1 -1
- package/dist/{index-b_11tfuG.js → index-DmA5-mTS.js} +6 -6
- package/dist/{index-DLartnmY.js → index-M_Td6T9I.js} +1 -1
- package/dist/index-MpVy5A_K.cjs +1 -0
- package/dist/index-ULdYt3Gk.js +138 -0
- package/dist/index-Uak9xh_Z.cjs +1 -0
- package/dist/index-YlTnI4EI.cjs +1 -0
- package/dist/{index-CqJa9o1o.cjs → index-kHFiVhmA.cjs} +1 -1
- package/dist/{index-DWiZqfBA.js → index-vARVx4Lc.js} +4 -4
- package/dist/index.vue_vue_type_style_index_0_scoped_77dec451_lang-BKTdfLNp.cjs +1 -0
- package/dist/index.vue_vue_type_style_index_0_scoped_77dec451_lang-C2CUHQVo.js +7 -0
- package/dist/index.vue_vue_type_style_index_0_scoped_bbb8ace9_lang-DSLx4cvQ.js +235 -0
- package/dist/index.vue_vue_type_style_index_0_scoped_bbb8ace9_lang-DlqdNpcl.cjs +1 -0
- package/dist/login-CBjdvGjn.js +47 -0
- package/dist/login-CHZ1VF7_.cjs +1 -0
- package/dist/main-3fUagSVX.cjs +1 -0
- package/dist/{main-DAPxADXM.js → main-7GSU9TqI.js} +25 -24
- package/dist/menu-BnTNA2Lx.cjs +1 -0
- package/dist/menu-DxrO5JEn.js +34 -0
- package/dist/{modelComp-CHWFvhCq.js → modelComp-BsNooORx.js} +1 -1
- package/dist/modelComp-b_KDs0lh.cjs +1 -0
- package/dist/pinia-8zVC1cUT.cjs +11 -0
- package/dist/pinia-DB5lI5eD.js +4723 -0
- package/dist/{request-BK6KCyS9.js → request-3QszTjDN.js} +1 -1
- package/dist/{request-BrHEv9dn.cjs → request-SLgezlvU.cjs} +1 -1
- package/dist/ss-component.cjs +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +6 -6
- package/dist/ss-component2.cjs +1 -1
- package/dist/ss-component2.js +1 -1
- package/package.json +3 -3
- package/dist/array-BYRvPg11.cjs +0 -7
- package/dist/array-DyxKeexo.js +0 -1732
- package/dist/cloneDeep-WwDap0fL.cjs +0 -1
- package/dist/index-5dGTUAu_.cjs +0 -1
- package/dist/index-BIRKKGuW.cjs +0 -1
- package/dist/index-BUxzwz5l.cjs +0 -1
- package/dist/index-CBHJLZo4.cjs +0 -1
- package/dist/index-CVBCwf2F.cjs +0 -6
- package/dist/index-CbphQpiC.cjs +0 -1
- package/dist/index-CdEEK8I0.js +0 -408
- package/dist/index-CumtOgAw.cjs +0 -7
- package/dist/index-DVEWSdUo.cjs +0 -1
- package/dist/index-DmoecEm1.js +0 -205
- package/dist/index-DzJuDGl8.cjs +0 -1
- package/dist/index-EIbm0jBZ.js +0 -2707
- package/dist/index-EQOXj03f.cjs +0 -1
- package/dist/index-QWm4yJ7u.js +0 -135
- package/dist/index-smYHb1Ta.js +0 -456
- package/dist/index-uMboxmjq.cjs +0 -6
- package/dist/index.vue_vue_type_style_index_0_scoped_77dec451_lang-CF5e1L_i.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_77dec451_lang-DrStz9iD.js +0 -2
- package/dist/index.vue_vue_type_style_index_0_scoped_bbb8ace9_lang-CgrtbAG0.cjs +0 -1
- package/dist/index.vue_vue_type_style_index_0_scoped_bbb8ace9_lang-CqiRIG3B.js +0 -192
- package/dist/main-DS-YP1Wn.cjs +0 -1
- package/dist/menu-BIINB-0Y.js +0 -1013
- package/dist/menu-B_Az9K_F.cjs +0 -11
- package/dist/modelComp-DY1RniW6.cjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue");e.ref([]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("vue"),L=require("./index-uMboxmjq.cjs"),M=require("./menu-B_Az9K_F.cjs"),O=require("./modelComp-DY1RniW6.cjs"),$=require("vue-router"),g=require("./cloneDeep-WwDap0fL.cjs"),y=u.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./index-DzJuDGl8.cjs")));y.install=c=>{c.component("ssMenu",y)};const U={__name:"index",props:{name:String},setup(c){const d=c,p=u.computed(()=>L.ElIcons[d.name]);return u.onMounted(()=>{}),(A,v)=>{const h=u.resolveComponent("el-icon");return u.openBlock(),u.createBlock(h,null,{default:u.withCtx(()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(p.value)))]),_:1})}}},j=u.defineComponent({name:"menu",components:{ssMenu:y,DynamicIcon:U},setup(){const c=M.useMenuState(),d=O.useModelComp(),p=$.useRouter(),{rawMenu:A,menuTriggerType:v}=M.storeToRefs(c),{itemData:h}=M.storeToRefs(d),f=u.ref([]);let a;(e=>{e[e.Menu=0]="Menu",e[e.FolderOpened=1]="FolderOpened"})(a||(a={}));const C=e=>{let s=[],r=[];return e==null||e.forEach(t=>{s=b(t,r)}),console.log("splitMenu",s),s},b=(e,s)=>{const r=s,t=[];e==null||e.forEach(l=>{Array.isArray(l)?t.push({children:b(l,[])}):t.push({title:l})});let i=t.reduce((l,m)=>(Object.entries(m).forEach(([o,n])=>{l[o]===void 0?n!=null&&n.title?l[o]=[n]:l[o]=n:(Array.isArray(l[o])||(l[o]=[{title:l[o]}]),n!=null&&n.title||Array.isArray(n)?l[o].push(n):l[o].push({title:n}))}),l),{});return i=T(g.cloneDeep(i)),r.push(i),Array.isArray(r)&&(r==null?void 0:r.length)>1?r:r==null?void 0:r[0]},T=e=>{var s,r,t;return Array.isArray(e==null?void 0:e.title)&&((s=e==null?void 0:e.title)==null?void 0:s.length)===((t=(r=e==null?void 0:e.title)==null?void 0:r.filter(i=>i.title))==null?void 0:t.length)?e==null?void 0:e.title:Array.isArray(e==null?void 0:e.children)?q(e):e},q=e=>{var r;const s=e;return s.children=(r=s.children)==null?void 0:r.map(t=>{var i;return(i=t==null?void 0:t.title)!=null&&i.children?t==null?void 0:t.title:t}),s},D=(e,s="",r=0)=>{var m;const t=g.cloneDeep(h.value);let i=e;const l=(m=t==null?void 0:t.filter(o=>{var n;return((n=o.comp)==null?void 0:n.toUpperCase())==="GROUP"}))==null?void 0:m.map(o=>o.name);return Array.isArray(i)||(i=[i]),i==null?void 0:i.map(o=>{const n=s?`${s}/${o.title}`:o.title,R={...o,path:n,level:r,icon:a[`${r}`],carryData:l==null?void 0:l.includes(n),isPenultimate:!o.children};return o.children&&o.children.length>0&&(R.children=D(o.children,n,r+1)),R})},_=u.computed(()=>{let e=D(f.value);if((e==null?void 0:e.length)===0)return p.push("/"),[];const s=[{title:"系统管理",path:"/",level:0,icon:a[0],carryData:!1,children:[{title:"角色管理",path:"/role",level:1,icon:a[1],carryData:!1,isRouter:!0},{title:"用户管理",path:"/user",level:1,icon:a[1],carryData:!1,isRouter:!0},{title:"部门管理",path:"/dept",level:1,icon:a[1],carryData:!1,isRouter:!0},{title:"级别管控",path:"/priority",level:1,icon:a[1],carryData:!1,isRouter:!0}]}];return e=[...e,...s],console.log("renderMenuList",e),c.setMenus(e),e}),E=e=>{console.log("clickMenu",e),c.setMenuTriggerType("click"),c.setActiveMenuPath(e==null?void 0:e.path),e.isRouter?p.push(e.path):p.push("/")},P=e=>{console.log(555,e),v.value==="click"?c.setActiveMenuPath(e):c.setMenuTriggerType("click"),e!=null&&e.startsWith("/")?p.push(e):p.push("/")},S=e=>{c.setActiveMenuPath(e)},B=u.ref([{name:"--ssComponent-menu-bg",value:"#426ec4"},{name:"--ssComponent-submenu-hover-bg",value:"#00000033"},{name:"--ssComponent-submenu-open-bg",value:"#2DA0FF"},{name:"--ssComponent-submenu-open-inline-bg",value:"#1C4275"},{name:"--ssComponent-menuitem-hover-bg",value:"#1d7bef"},{name:"--ssComponent-menuitem-active-bg",value:"#1d7bef"}]),F=()=>{var s;const e=document.documentElement;(s=B.value)==null||s.forEach(r=>{e.style.setProperty(r.name,r.value)})};return u.onMounted(()=>{}),u.watch(()=>A.value,e=>{var s,r,t;if(e){const i=(t=(r=(s=g.cloneDeep(e))==null?void 0:s.compData)==null?void 0:r[0])==null?void 0:t.contents;f.value=C(i),console.log("rawMenu",_.value),console.log("menuList",f.value)}else c.setActiveMenuPath("")},{immediate:!0}),{renderMenuList:_,clickMenu:E,openMenu:P,closeMenu:S,changeMenuStyle:F}}});exports._sfc_main=j;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { defineAsyncComponent as w, computed as E, onMounted as P, resolveComponent as G, createBlock as D, openBlock as C, withCtx as I, resolveDynamicComponent as N, defineComponent as W, ref as R, watch as q } from "vue";
|
|
2
|
-
import { E as z } from "./index-BH3F6_ql.js";
|
|
3
|
-
import { u as H, s as T } from "./menu-BIINB-0Y.js";
|
|
4
|
-
import { u as J } from "./modelComp-CHWFvhCq.js";
|
|
5
|
-
import { useRouter as K } from "vue-router";
|
|
6
|
-
import { c as f } from "./cloneDeep-BfzU0pBe.js";
|
|
7
|
-
const M = w(() => import("./index-BMLnfdpX.js"));
|
|
8
|
-
M.install = (u) => {
|
|
9
|
-
u.component("ssMenu", M);
|
|
10
|
-
};
|
|
11
|
-
const Q = {
|
|
12
|
-
__name: "index",
|
|
13
|
-
props: {
|
|
14
|
-
name: String
|
|
15
|
-
},
|
|
16
|
-
setup(u) {
|
|
17
|
-
const m = u, c = E(() => z[m.name]);
|
|
18
|
-
return P(() => {
|
|
19
|
-
}), (g, y) => {
|
|
20
|
-
const h = G("el-icon");
|
|
21
|
-
return C(), D(h, null, {
|
|
22
|
-
default: I(() => [
|
|
23
|
-
(C(), D(N(c.value)))
|
|
24
|
-
]),
|
|
25
|
-
_: 1
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}, ee = W({
|
|
30
|
-
name: "menu",
|
|
31
|
-
components: {
|
|
32
|
-
ssMenu: M,
|
|
33
|
-
DynamicIcon: Q
|
|
34
|
-
},
|
|
35
|
-
setup() {
|
|
36
|
-
const u = H(), m = J(), c = K(), { rawMenu: g, menuTriggerType: y } = T(u), { itemData: h } = T(m), d = R([]);
|
|
37
|
-
let a;
|
|
38
|
-
((e) => {
|
|
39
|
-
e[e.Menu = 0] = "Menu", e[e.FolderOpened = 1] = "FolderOpened";
|
|
40
|
-
})(a || (a = {}));
|
|
41
|
-
const S = (e) => {
|
|
42
|
-
let s = [], r = [];
|
|
43
|
-
return e == null || e.forEach((t) => {
|
|
44
|
-
s = A(t, r);
|
|
45
|
-
}), console.log("splitMenu", s), s;
|
|
46
|
-
}, A = (e, s) => {
|
|
47
|
-
const r = s, t = [];
|
|
48
|
-
e == null || e.forEach((i) => {
|
|
49
|
-
Array.isArray(i) ? t.push({ children: A(i, []) }) : t.push({ title: i });
|
|
50
|
-
});
|
|
51
|
-
let n = t.reduce((i, p) => (Object.entries(p).forEach(([l, o]) => {
|
|
52
|
-
i[l] === void 0 ? o != null && o.title ? i[l] = [o] : i[l] = o : (Array.isArray(i[l]) || (i[l] = [{ title: i[l] }]), o != null && o.title || Array.isArray(o) ? i[l].push(o) : i[l].push({ title: o }));
|
|
53
|
-
}), i), {});
|
|
54
|
-
return n = F(f(n)), r.push(n), Array.isArray(r) && (r == null ? void 0 : r.length) > 1 ? r : r == null ? void 0 : r[0];
|
|
55
|
-
}, F = (e) => {
|
|
56
|
-
var s, r, t;
|
|
57
|
-
return Array.isArray(e == null ? void 0 : e.title) && ((s = e == null ? void 0 : e.title) == null ? void 0 : s.length) === ((t = (r = e == null ? void 0 : e.title) == null ? void 0 : r.filter((n) => n.title)) == null ? void 0 : t.length) ? e == null ? void 0 : e.title : Array.isArray(e == null ? void 0 : e.children) ? L(e) : e;
|
|
58
|
-
}, L = (e) => {
|
|
59
|
-
var r;
|
|
60
|
-
const s = e;
|
|
61
|
-
return s.children = (r = s.children) == null ? void 0 : r.map((t) => {
|
|
62
|
-
var n;
|
|
63
|
-
return (n = t == null ? void 0 : t.title) != null && n.children ? t == null ? void 0 : t.title : t;
|
|
64
|
-
}), s;
|
|
65
|
-
}, v = (e, s = "", r = 0) => {
|
|
66
|
-
var p;
|
|
67
|
-
const t = f(h.value);
|
|
68
|
-
let n = e;
|
|
69
|
-
const i = (p = t == null ? void 0 : t.filter((l) => {
|
|
70
|
-
var o;
|
|
71
|
-
return ((o = l.comp) == null ? void 0 : o.toUpperCase()) === "GROUP";
|
|
72
|
-
})) == null ? void 0 : p.map((l) => l.name);
|
|
73
|
-
return Array.isArray(n) || (n = [n]), n == null ? void 0 : n.map((l) => {
|
|
74
|
-
const o = s ? `${s}/${l.title}` : l.title, _ = {
|
|
75
|
-
...l,
|
|
76
|
-
path: o,
|
|
77
|
-
level: r,
|
|
78
|
-
icon: a[`${r}`],
|
|
79
|
-
carryData: i == null ? void 0 : i.includes(o),
|
|
80
|
-
isPenultimate: !l.children
|
|
81
|
-
//便于角色授权菜单那里给叶子节点添加按钮节点
|
|
82
|
-
};
|
|
83
|
-
return l.children && l.children.length > 0 && (_.children = v(l.children, o, r + 1)), _;
|
|
84
|
-
});
|
|
85
|
-
}, b = E(() => {
|
|
86
|
-
let e = v(d.value);
|
|
87
|
-
if ((e == null ? void 0 : e.length) === 0)
|
|
88
|
-
return c.push("/"), [];
|
|
89
|
-
const s = [
|
|
90
|
-
{
|
|
91
|
-
title: "系统管理",
|
|
92
|
-
path: "/",
|
|
93
|
-
level: 0,
|
|
94
|
-
icon: a[0],
|
|
95
|
-
carryData: !1,
|
|
96
|
-
children: [
|
|
97
|
-
{
|
|
98
|
-
title: "角色管理",
|
|
99
|
-
path: "/role",
|
|
100
|
-
level: 1,
|
|
101
|
-
icon: a[1],
|
|
102
|
-
carryData: !1,
|
|
103
|
-
isRouter: !0
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
title: "用户管理",
|
|
107
|
-
path: "/user",
|
|
108
|
-
level: 1,
|
|
109
|
-
icon: a[1],
|
|
110
|
-
carryData: !1,
|
|
111
|
-
isRouter: !0
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
title: "部门管理",
|
|
115
|
-
path: "/dept",
|
|
116
|
-
level: 1,
|
|
117
|
-
icon: a[1],
|
|
118
|
-
carryData: !1,
|
|
119
|
-
isRouter: !0
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
title: "级别管控",
|
|
123
|
-
path: "/priority",
|
|
124
|
-
level: 1,
|
|
125
|
-
icon: a[1],
|
|
126
|
-
carryData: !1,
|
|
127
|
-
isRouter: !0
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
];
|
|
132
|
-
return e = [...e, ...s], console.log("renderMenuList", e), u.setMenus(e), e;
|
|
133
|
-
}), O = (e) => {
|
|
134
|
-
console.log("clickMenu", e), u.setMenuTriggerType("click"), u.setActiveMenuPath(e == null ? void 0 : e.path), e.isRouter ? c.push(e.path) : c.push("/");
|
|
135
|
-
}, $ = (e) => {
|
|
136
|
-
console.log(555, e), y.value === "click" ? u.setActiveMenuPath(e) : u.setMenuTriggerType("click"), e != null && e.startsWith("/") ? c.push(e) : c.push("/");
|
|
137
|
-
}, B = (e) => {
|
|
138
|
-
u.setActiveMenuPath(e);
|
|
139
|
-
}, U = R([
|
|
140
|
-
{
|
|
141
|
-
name: "--ssComponent-menu-bg",
|
|
142
|
-
value: "#426ec4"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "--ssComponent-submenu-hover-bg",
|
|
146
|
-
value: "#00000033"
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
name: "--ssComponent-submenu-open-bg",
|
|
150
|
-
value: "#2DA0FF"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
name: "--ssComponent-submenu-open-inline-bg",
|
|
154
|
-
value: "#1C4275"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "--ssComponent-menuitem-hover-bg",
|
|
158
|
-
value: "#1d7bef"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
name: "--ssComponent-menuitem-active-bg",
|
|
162
|
-
value: "#1d7bef"
|
|
163
|
-
}
|
|
164
|
-
]), j = () => {
|
|
165
|
-
var s;
|
|
166
|
-
const e = document.documentElement;
|
|
167
|
-
(s = U.value) == null || s.forEach((r) => {
|
|
168
|
-
e.style.setProperty(r.name, r.value);
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
return P(() => {
|
|
172
|
-
}), q(() => g.value, (e) => {
|
|
173
|
-
var s, r, t;
|
|
174
|
-
if (e) {
|
|
175
|
-
const n = (t = (r = (s = f(e)) == null ? void 0 : s.compData) == null ? void 0 : r[0]) == null ? void 0 : t.contents;
|
|
176
|
-
d.value = S(n), console.log("rawMenu", b.value), console.log("menuList", d.value);
|
|
177
|
-
} else
|
|
178
|
-
u.setActiveMenuPath("");
|
|
179
|
-
}, {
|
|
180
|
-
immediate: !0
|
|
181
|
-
}), {
|
|
182
|
-
renderMenuList: b,
|
|
183
|
-
clickMenu: O,
|
|
184
|
-
openMenu: $,
|
|
185
|
-
closeMenu: B,
|
|
186
|
-
changeMenuStyle: j
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
export {
|
|
191
|
-
ee as _
|
|
192
|
-
};
|
package/dist/main-DS-YP1Wn.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),O=require("./index-CbphQpiC.cjs"),T=require("./index-BIRKKGuW.cjs"),U=require("./modelComp-DY1RniW6.cjs"),I=require("./menu-B_Az9K_F.cjs"),F=require("./array-BYRvPg11.cjs"),X=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),h=require("./cloneDeep-WwDap0fL.cjs"),V=[{key:"FormName",value:"Form"},{key:"TableName",value:"Table"}],s=[{key:"FormDirect",value:"formFlex"},{key:"Form",value:"formContent"},{key:"FormButton",value:"formButton"},{key:"TableColumns",value:"header"},{key:"TableButton",value:"extraButton"},{key:"LineButton",value:"rowButton"},{key:"Table",value:"tableContents"},{key:"TableIndex",value:"tableIndex"}],ee={key:0,class:"show-content"},te={class:"item-view-group"},ne={__name:"index",props:{content:String,jsonContents:Array},emits:["change"],setup(j,{emit:E}){const t=j,D=E,g=U.useModelComp(T.pinia),{itemData:p}=I.storeToRefs(g),_=e.ref([]),C=e.ref([]),$=c=>{D("change",{wholeValue:_.value,editValue:c})},S=c=>{const k=h.cloneDeep(_.value),b=k==null?void 0:k.map((i,B)=>(B===(c==null?void 0:c.index)&&(i.compData=c==null?void 0:c.contents),i));_.value=b};e.watch(()=>p.value,()=>{var c;!p.value||((c=p.value)==null?void 0:c.length)===0||(C.value=p.value,_.value=p.value)},{deep:!0,immediate:!0}),e.watch(()=>[t==null?void 0:t.content,t==null?void 0:t.jsonContents],()=>{var k;if(((k=t==null?void 0:t.jsonContents)==null?void 0:k.length)>0){g.setOriginalData(t==null?void 0:t.jsonContents),g.setItemData(t==null?void 0:t.jsonContents);return}if(!(t!=null&&t.content)||(t==null?void 0:t.content)==="")return;const c=F.expandStringToJson(t==null?void 0:t.content);g.setOriginalData(c),g.setItemData(c)},{deep:!0,immediate:!0});const N=c=>F.getComponent(c);return(c,k)=>{var b;return((b=C.value)==null?void 0:b.length)>0?(e.openBlock(),e.createElementBlock("div",ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(i,B)=>(e.openBlock(),e.createElementBlock("div",{class:"item-content",key:B},[e.createElementVNode("div",te,e.toDisplayString(i.name),1),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(N(i.comp)),{itemData:i==null?void 0:i.compData,childItemData:i==null?void 0:i.itemChildData,key:B,onChange:$,index:B,onContentChange:S},null,40,["itemData","childItemData","index"]))]))),128))])):e.createCommentVNode("",!0)}}},oe=X._export_sfc(ne,[["__scopeId","data-v-869e6e20"]]),ae={class:"add-model-content"},le={key:0,class:"model-import-data"},re={class:"import-button"},ce={key:0},se={key:1,class:"model-operate"},ue={class:"model-select"},ie={class:"model-fill"},de={key:2,class:"model-view ssComponent"},me={__name:"main",props:{mode:{type:String,default:"view"},content:{type:String,default:""},jsonContents:{type:Array,default:()=>[]},showButton:{type:Boolean,default:!0}},emits:["change"],setup(j,{emit:E}){const t=j,D=E,g=e.ref(""),p=e.ref([]),_=e.ref(0),C=U.useModelComp(T.pinia);I.useMenuState(T.pinia);const{itemData:$,originalData:S}=I.storeToRefs(C),N=e.ref(null),c=e.ref(0),k=e.ref(""),b=()=>{_.value=window.innerWidth},i=async l=>{var u;const a=(u=h.cloneDeep(l==null?void 0:l.wholeValue))==null?void 0:u.map(o=>{var y;return(o==null?void 0:o.comp)==="Form"&&(o.compData=(y=o.compData)==null?void 0:y.map(f=>((f==null?void 0:f.key)==="formContent"&&(f.contents=F.arrayToNumberArray(f==null?void 0:f.contents)),f))),o});D("change",{originalContents:S.value,currentContents:l==null?void 0:l.wholeValue,editContent:l==null?void 0:l.editValue,stringContent:B(h.cloneDeep(l==null?void 0:l.wholeValue)),arrayToContents:a})},B=l=>{var u;let a=[];return(u=h.cloneDeep(l))==null||u.forEach(o=>{var y,f;V!=null&&V.find(n=>(n==null?void 0:n.value)===(o==null?void 0:o.comp))&&a.push(((y=V==null?void 0:V.find(n=>(n==null?void 0:n.value)===(o==null?void 0:o.comp)))==null?void 0:y.key)+"="+o.name+"/r/n"),(f=o==null?void 0:o.compData)==null||f.forEach(n=>{var J,q,A,M,R,L,z,W,H,P,G,K;if(s!=null&&s.find(d=>(d==null?void 0:d.value)===(n==null?void 0:n.key)))if(!((J=n==null?void 0:n.contents)!=null&&J.length))a.push(((q=s==null?void 0:s.find(d=>(d==null?void 0:d.value)===(n==null?void 0:n.key)))==null?void 0:q.key)+"="+(n.contents===!0?'""':"Vertical")+"/r/n");else{let d=(A=n==null?void 0:n.contents)==null?void 0:A[0];if(!d)return;if(Object.keys(d).includes("label")&&Object.keys(d).includes("key")&&Object.keys(d).includes("width"))if(((R=(M=n.contents)==null?void 0:M.filter(m=>m.width!==1))==null?void 0:R.length)===0){const m=(L=h.cloneDeep(n==null?void 0:n.contents))==null?void 0:L.map(r=>({[r.label]:r.value}));a.push(((z=s==null?void 0:s.find(r=>(r==null?void 0:r.value)===(n==null?void 0:n.key)))==null?void 0:z.key)+"="+JSON.stringify(m)+"/r/n")}else{let m=[];(W=h.cloneDeep(n==null?void 0:n.contents))==null||W.reduce((r,x)=>{var Q;return r[x.label]=x.key,((Q=Object.keys(h.cloneDeep(r)))==null?void 0:Q.length)>=x.width&&(m.push(h.cloneDeep(r)),r={}),r},{}),a.push(((H=s==null?void 0:s.find(r=>(r==null?void 0:r.value)===(n==null?void 0:n.key)))==null?void 0:H.key)+"="+JSON.stringify(m)+"/r/n")}else if(Object.keys(d).includes("label")){const m=(P=h.cloneDeep(n==null?void 0:n.contents))==null?void 0:P.map(r=>r.label);a.push(((G=s==null?void 0:s.find(r=>(r==null?void 0:r.value)===(n==null?void 0:n.key)))==null?void 0:G.key)+"="+JSON.stringify(m)+"/r/n")}else a.push(((K=s==null?void 0:s.find(m=>(m==null?void 0:m.value)===(n==null?void 0:n.key)))==null?void 0:K.key)+"="+JSON.stringify(n==null?void 0:n.contents)+"/r/n")}})}),JSON.stringify(a)},w=e.ref([]),Y=()=>{N.value.click()},Z=l=>{const a=l.target.files[0];if(!a)return;const u=new FileReader;u.onload=o=>{try{g.value=o.target.result,w.value=v(o.target.result),c.value++}catch(y){console.error("解析失败:",y)}},u.onerror=o=>{console.error("文件读取错误:",o)},u.readAsText(a)};e.onMounted(()=>{window.addEventListener("resize",b)}),e.watch(()=>[t==null?void 0:t.content,t==null?void 0:t.jsonContents],()=>{g.value=t==null?void 0:t.content,p.value=t==null?void 0:t.jsonContents},{deep:!0,immediate:!0}),e.watch(()=>c.value,()=>{var l;((l=w.value)==null?void 0:l.length)!==0&&(C.setOriginalData(w.value),C.setItemData(w.value))},{deep:!0,immediate:!0});const v=l=>{let a=l.replace(/,/g,",").replace(/;/g,";").replace(/:/g,":");a=a.replace(/(\w+)\s*:/g,"$1:"),a=a.replace(/\r\n/g,"").replace(/\n/g,"").replace(/\t/g,"").replace(/\s+/g," ").trim(),a=a.replace(/,\s*([}\]])/g,"$1"),a=a.replace(/:(\s*)([^"{}\[\],\s]+)(\s*)([,}])/g,": $2$4");try{return JSON.parse(a)}catch(u){try{const y=new Function(`return ${a}`)();if(Array.isArray(y)||typeof y=="object")return y;throw new Error(`解析结果不是有效的数组或对象: ${u}`)}catch(o){throw new Error(`无法解析JSON: ${o.message}`)}}};return(l,a)=>{var u;return e.openBlock(),e.createElementBlock("div",ae,[((u=t==null?void 0:t.jsonContents)==null?void 0:u.length)===0?(e.openBlock(),e.createElementBlock("div",le,[e.createElementVNode("div",re,[e.createElementVNode("input",{type:"file",ref_key:"fileInput",ref:N,accept:".txt",onChange:Z,style:{display:"none"}},null,544),e.createElementVNode("button",{onClick:Y,class:"import-button-content"},"导入文件"),k.value?(e.openBlock(),e.createElementBlock("span",ce,e.toDisplayString(k.value),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),(t==null?void 0:t.mode)==="edit"?(e.openBlock(),e.createElementBlock("div",se,[e.createElementVNode("div",ue,[e.createVNode(O.modelSelect)]),(e.openBlock(),e.createElementBlock("div",{class:"model-show",key:_.value},[e.createVNode(O.modelShow)])),e.createElementVNode("div",ie,[e.createVNode(O.modelFill)])])):e.createCommentVNode("",!0),(t==null?void 0:t.mode)==="view"?(e.openBlock(),e.createElementBlock("div",de,[(e.openBlock(),e.createBlock(oe,{content:g.value,onChange:i,jsonContents:p.value,key:_.value},null,8,["content","jsonContents"]))])):e.createCommentVNode("",!0)])}}},ye=X._export_sfc(me,[["__scopeId","data-v-b25bde75"]]);exports.default=ye;
|