ss-component-new 1.1.71 → 1.1.72
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/_plugin-vue_export-helper-B7R8Jogt.js +524 -0
- package/dist/{array-BtcGNRWC.js → array-BejyPB_1.js} +241 -247
- package/dist/{index-BcPDXPQB.js → index-10n3uNlg.js} +3 -4
- package/dist/{index-C_SGjB9P.js → index-BT8Pkr84.js} +6 -7
- package/dist/{index-BQ18EzV6.js → index-BvoThyOF.js} +2 -2
- package/dist/index-CCr_UQBn.js +3749 -0
- package/dist/{index-btKSK4k7.js → index-ChCXzsYf.js} +2 -2
- package/dist/{index.vue_vue_type_style_index_0_scoped_dc84a8f7_lang-KVrulMLC.js → index.vue_vue_type_style_index_0_scoped_dc84a8f7_lang-DG5vph3h.js} +38 -39
- package/dist/main-BUjoLIJC.js +404 -0
- package/dist/{index-NvpJBKaz.js → menu-oGClEGzK.js} +1788 -3821
- package/dist/{modelComp-BdUI1DVP.js → modelComp-CqA1NVfH.js} +1 -1
- package/dist/ss-component.css +1 -1
- package/dist/ss-component.js +31 -2
- package/dist/ss-component.umd.cjs +51 -84
- package/package.json +1 -1
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
- package/dist/cloneDeep-BcUiE4Tq.js +0 -318
- package/dist/index-CN2pLnQT.js +0 -131
- package/dist/index-M_agR_mA.js +0 -370
- package/dist/index-O_TF6Fp4.js +0 -351
- package/dist/index-mnlbBMqr.js +0 -3133
- package/dist/index.vue_vue_type_style_index_0_scoped_876d48c6_lang-CeS9mECH.js +0 -254
- package/dist/main-C7f7YVTf.js +0 -288
- package/dist/menu-Dez5HOn4.js +0 -924
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as c } from "./index.vue_vue_type_style_index_0_scoped_dc84a8f7_lang-
|
|
1
|
+
import { _ as c } from "./index.vue_vue_type_style_index_0_scoped_dc84a8f7_lang-DG5vph3h.js";
|
|
2
2
|
import { resolveComponent as o, createBlock as a, openBlock as u, withCtx as r, createVNode as l, createElementVNode as i, toDisplayString as p } from "vue";
|
|
3
|
-
import { _ as m } from "./_plugin-vue_export-helper-
|
|
3
|
+
import { _ as m } from "./_plugin-vue_export-helper-B7R8Jogt.js";
|
|
4
4
|
function M(e, _, d, f, C, y) {
|
|
5
5
|
const t = o("DynamicIcon"), s = o("ssMenu");
|
|
6
6
|
return u(), a(s, {
|
|
@@ -1,9 +1,8 @@
|
|
|
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 } from "./
|
|
3
|
-
import { u as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const g = U(() => import("./index-BQ18EzV6.js"));
|
|
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"));
|
|
7
6
|
g.install = (u) => {
|
|
8
7
|
u.component("ssMenu", g);
|
|
9
8
|
};
|
|
@@ -13,64 +12,64 @@ const J = {
|
|
|
13
12
|
name: String
|
|
14
13
|
},
|
|
15
14
|
setup(u) {
|
|
16
|
-
const
|
|
15
|
+
const c = u, m = D(() => M[c.name]);
|
|
17
16
|
return O(() => {
|
|
18
|
-
const
|
|
19
|
-
console.log("iconComponent",
|
|
20
|
-
}), (
|
|
17
|
+
const p = Object.keys(M);
|
|
18
|
+
console.log("iconComponent", m.value, c.name, M, p);
|
|
19
|
+
}), (p, A) => {
|
|
21
20
|
const d = G("el-icon");
|
|
22
21
|
return C(), v(d, null, {
|
|
23
22
|
default: I(() => [
|
|
24
|
-
(C(), v(N(
|
|
23
|
+
(C(), v(N(m.value)))
|
|
25
24
|
]),
|
|
26
25
|
_: 1
|
|
27
26
|
});
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
|
-
},
|
|
29
|
+
}, Y = k({
|
|
31
30
|
name: "menu",
|
|
32
31
|
components: {
|
|
33
32
|
ssMenu: g,
|
|
34
33
|
DynamicIcon: J
|
|
35
34
|
},
|
|
36
35
|
setup() {
|
|
37
|
-
const u = z(),
|
|
36
|
+
const u = z(), c = H(), { rawMenu: m, menuTriggerType: p } = E(u), { itemData: A } = E(c), d = T([]);
|
|
38
37
|
let h;
|
|
39
38
|
((e) => {
|
|
40
39
|
e[e.Menu = 0] = "Menu", e[e.FolderOpened = 1] = "FolderOpened";
|
|
41
40
|
})(h || (h = {}));
|
|
42
41
|
const S = (e) => {
|
|
43
|
-
let
|
|
42
|
+
let n = [], s = [];
|
|
44
43
|
return e == null || e.forEach((r) => {
|
|
45
|
-
|
|
46
|
-
}), console.log("splitMenu",
|
|
47
|
-
}, y = (e,
|
|
48
|
-
const s =
|
|
49
|
-
e == null || e.forEach((
|
|
50
|
-
Array.isArray(
|
|
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 });
|
|
51
50
|
});
|
|
52
|
-
let i = r.reduce((
|
|
53
|
-
|
|
54
|
-
}),
|
|
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), {});
|
|
55
54
|
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];
|
|
56
55
|
}, F = (e) => {
|
|
57
|
-
var
|
|
58
|
-
return Array.isArray(e == null ? void 0 : e.title) && ((
|
|
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;
|
|
59
58
|
}, P = (e) => {
|
|
60
59
|
var s;
|
|
61
|
-
const
|
|
62
|
-
return
|
|
60
|
+
const n = e;
|
|
61
|
+
return n.children = (s = n.children) == null ? void 0 : s.map((r) => {
|
|
63
62
|
var i;
|
|
64
63
|
return (i = r == null ? void 0 : r.title) != null && i.children ? r == null ? void 0 : r.title : r;
|
|
65
|
-
}),
|
|
66
|
-
}, b = (e,
|
|
67
|
-
var
|
|
68
|
-
const r = f(A.value), i = (
|
|
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) => {
|
|
69
68
|
var t;
|
|
70
69
|
return ((t = a.comp) == null ? void 0 : t.toUpperCase()) === "GROUP";
|
|
71
|
-
})) == null ? void 0 :
|
|
70
|
+
})) == null ? void 0 : o.map((a) => a.name);
|
|
72
71
|
return e == null ? void 0 : e.map((a) => {
|
|
73
|
-
const t =
|
|
72
|
+
const t = n ? `${n}/${a.title}` : a.title, l = {
|
|
74
73
|
...a,
|
|
75
74
|
path: t,
|
|
76
75
|
level: s,
|
|
@@ -85,7 +84,7 @@ const J = {
|
|
|
85
84
|
}), $ = (e) => {
|
|
86
85
|
console.log("clickMenu", e), u.setMenuTriggerType("click"), u.setActiveMenuPath(e == null ? void 0 : e.path);
|
|
87
86
|
}, R = (e) => {
|
|
88
|
-
|
|
87
|
+
p.value === "click" ? u.setActiveMenuPath(e) : u.setMenuTriggerType("click");
|
|
89
88
|
}, j = (e) => {
|
|
90
89
|
u.setActiveMenuPath(e);
|
|
91
90
|
}, w = T([
|
|
@@ -114,17 +113,17 @@ const J = {
|
|
|
114
113
|
value: "#1d7bef"
|
|
115
114
|
}
|
|
116
115
|
]), B = () => {
|
|
117
|
-
var
|
|
116
|
+
var n;
|
|
118
117
|
const e = document.documentElement;
|
|
119
|
-
(
|
|
118
|
+
(n = w.value) == null || n.forEach((s) => {
|
|
120
119
|
e.style.setProperty(s.name, s.value);
|
|
121
120
|
});
|
|
122
121
|
};
|
|
123
122
|
return O(() => {
|
|
124
|
-
}), q(() =>
|
|
125
|
-
var
|
|
123
|
+
}), q(() => m.value, (e) => {
|
|
124
|
+
var n, s, r;
|
|
126
125
|
if (e) {
|
|
127
|
-
const i = (r = (s = (
|
|
126
|
+
const i = (r = (s = (n = f(e)) == null ? void 0 : n.compData) == null ? void 0 : s[0]) == null ? void 0 : r.contents;
|
|
128
127
|
d.value = S(i), console.log("rawMenu", _.value);
|
|
129
128
|
} else
|
|
130
129
|
u.setActiveMenuPath("");
|
|
@@ -140,5 +139,5 @@ const J = {
|
|
|
140
139
|
}
|
|
141
140
|
});
|
|
142
141
|
export {
|
|
143
|
-
|
|
142
|
+
Y as _
|
|
144
143
|
};
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { createElementBlock as _, openBlock as r, Fragment as W, renderList as U, unref as ie, createElementVNode as b, createBlock as B, resolveDynamicComponent as q, toDisplayString as E, ref as w, watch as J, resolveComponent as ue, createVNode as z, withCtx as K, createCommentVNode as v, onMounted as _e } from "vue";
|
|
2
|
+
import { p as A, s as fe, g as P, e as he, a as ye } from "./array-BejyPB_1.js";
|
|
3
|
+
import { s as L, E as pe, u as ge } from "./menu-oGClEGzK.js";
|
|
4
|
+
import { u as M } from "./modelComp-CqA1NVfH.js";
|
|
5
|
+
import { _ as R, c as k } from "./_plugin-vue_export-helper-B7R8Jogt.js";
|
|
6
|
+
const Ce = { class: "type-select" }, ke = ["onClick"], be = { class: "list-icon" }, Ie = {
|
|
7
|
+
__name: "index",
|
|
8
|
+
setup(T) {
|
|
9
|
+
const $ = M(A), { itemData: e } = L($), j = (l) => pe[l], f = (l) => {
|
|
10
|
+
const y = k(e.value);
|
|
11
|
+
y.push({
|
|
12
|
+
comp: l.comp,
|
|
13
|
+
name: l.name,
|
|
14
|
+
compData: []
|
|
15
|
+
}), $.setItemData(y);
|
|
16
|
+
};
|
|
17
|
+
return (l, y) => (r(), _("div", Ce, [
|
|
18
|
+
(r(!0), _(W, null, U(ie(fe), (h, s) => (r(), _("div", {
|
|
19
|
+
class: "type-list",
|
|
20
|
+
key: s
|
|
21
|
+
}, [
|
|
22
|
+
b("div", {
|
|
23
|
+
class: "list-content",
|
|
24
|
+
onClick: (p) => f(h)
|
|
25
|
+
}, [
|
|
26
|
+
b("div", be, [
|
|
27
|
+
(r(), B(q(j(h.icon))))
|
|
28
|
+
]),
|
|
29
|
+
b("div", null, E(h.name), 1)
|
|
30
|
+
], 8, ke)
|
|
31
|
+
]))), 128))
|
|
32
|
+
]));
|
|
33
|
+
}
|
|
34
|
+
}, De = /* @__PURE__ */ R(Ie, [["__scopeId", "data-v-fe4aecc8"]]), we = { class: "fill-content" }, $e = { class: "operate-content" }, je = { class: "collapse-title" }, xe = { class: "comp-child" }, Ve = {
|
|
35
|
+
__name: "index",
|
|
36
|
+
setup(T) {
|
|
37
|
+
const $ = M(A), { itemData: e, originalData: j } = L($), f = w([]), l = w([]);
|
|
38
|
+
J(
|
|
39
|
+
() => e.value,
|
|
40
|
+
() => {
|
|
41
|
+
var s;
|
|
42
|
+
!e.value || ((s = e.value) == null ? void 0 : s.length) === 0 || (f.value = k(e.value));
|
|
43
|
+
},
|
|
44
|
+
{ deep: !0, immediate: !0 }
|
|
45
|
+
);
|
|
46
|
+
const y = (s) => P(s), h = (s, p, S) => {
|
|
47
|
+
if (!s || s.length === 0) return;
|
|
48
|
+
let n = k(e.value);
|
|
49
|
+
const c = k(p);
|
|
50
|
+
c.compData = s, n = n == null ? void 0 : n.map((g, d) => (d === S && (g = c), g)), $.setItemData(n);
|
|
51
|
+
};
|
|
52
|
+
return (s, p) => {
|
|
53
|
+
const S = ue("el-collapse-item"), n = ue("el-collapse");
|
|
54
|
+
return r(), _("div", we, [
|
|
55
|
+
p[1] || (p[1] = b("div", { class: "fill-operate" }, E("操作栏"), -1)),
|
|
56
|
+
b("div", $e, [
|
|
57
|
+
z(n, {
|
|
58
|
+
modelValue: l.value,
|
|
59
|
+
"onUpdate:modelValue": p[0] || (p[0] = (c) => l.value = c),
|
|
60
|
+
class: "collapse-content"
|
|
61
|
+
}, {
|
|
62
|
+
default: K(() => [
|
|
63
|
+
(r(!0), _(W, null, U(f.value, (c, g) => (r(), B(S, {
|
|
64
|
+
key: g,
|
|
65
|
+
name: g
|
|
66
|
+
}, {
|
|
67
|
+
title: K(() => [
|
|
68
|
+
b("div", je, E(c.name), 1)
|
|
69
|
+
]),
|
|
70
|
+
default: K(() => {
|
|
71
|
+
var d, O;
|
|
72
|
+
return [
|
|
73
|
+
b("div", xe, [
|
|
74
|
+
(r(), B(q(y(c.comp + "Operate")), {
|
|
75
|
+
itemContents: c == null ? void 0 : c.compData,
|
|
76
|
+
originalItemContents: (O = (d = ie(j)) == null ? void 0 : d.find((N, G) => G === g)) == null ? void 0 : O.compData,
|
|
77
|
+
onChange: (N) => h(N, c, g)
|
|
78
|
+
}, null, 40, ["itemContents", "originalItemContents", "onChange"]))
|
|
79
|
+
])
|
|
80
|
+
];
|
|
81
|
+
}),
|
|
82
|
+
_: 2
|
|
83
|
+
}, 1032, ["name"]))), 128))
|
|
84
|
+
]),
|
|
85
|
+
_: 1
|
|
86
|
+
}, 8, ["modelValue"])
|
|
87
|
+
])
|
|
88
|
+
]);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}, Oe = /* @__PURE__ */ R(Ve, [["__scopeId", "data-v-a216b035"]]), Se = {
|
|
92
|
+
key: 0,
|
|
93
|
+
class: "show-content"
|
|
94
|
+
}, Ne = {
|
|
95
|
+
__name: "index",
|
|
96
|
+
setup(T) {
|
|
97
|
+
const $ = M(A), { itemData: e } = L($), j = w([]);
|
|
98
|
+
J(
|
|
99
|
+
() => e.value,
|
|
100
|
+
() => {
|
|
101
|
+
var l;
|
|
102
|
+
!e.value || ((l = e.value) == null ? void 0 : l.length) === 0 || (j.value = k(e.value));
|
|
103
|
+
},
|
|
104
|
+
{ deep: !0, immediate: !0 }
|
|
105
|
+
);
|
|
106
|
+
const f = (l) => P(l);
|
|
107
|
+
return (l, y) => {
|
|
108
|
+
var h;
|
|
109
|
+
return ((h = j.value) == null ? void 0 : h.length) > 0 ? (r(), _("div", Se, [
|
|
110
|
+
(r(!0), _(W, null, U(j.value, (s, p) => (r(), _("div", {
|
|
111
|
+
class: "item-content",
|
|
112
|
+
key: p
|
|
113
|
+
}, [
|
|
114
|
+
b("div", null, E(s.name), 1),
|
|
115
|
+
(r(), B(q(f(s.comp)), {
|
|
116
|
+
itemData: s == null ? void 0 : s.compData,
|
|
117
|
+
childItemData: s == null ? void 0 : s.itemChildData,
|
|
118
|
+
key: p
|
|
119
|
+
}, null, 8, ["itemData", "childItemData"]))
|
|
120
|
+
]))), 128))
|
|
121
|
+
])) : v("", !0);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}, Te = /* @__PURE__ */ R(Ne, [["__scopeId", "data-v-79320497"]]), F = [
|
|
125
|
+
{
|
|
126
|
+
key: "FormName",
|
|
127
|
+
value: "Form"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
key: "TableName",
|
|
131
|
+
value: "Table"
|
|
132
|
+
}
|
|
133
|
+
], m = [
|
|
134
|
+
{
|
|
135
|
+
key: "FormDirect",
|
|
136
|
+
value: "formFlex"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "Form",
|
|
140
|
+
value: "formContent"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
key: "FormButton",
|
|
144
|
+
value: "formButton"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
key: "TableColumns",
|
|
148
|
+
value: "header"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
key: "TableButton",
|
|
152
|
+
value: "extraButton"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
key: "LineButton",
|
|
156
|
+
value: "rowButton"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: "Table",
|
|
160
|
+
value: "tableContents"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: "TableIndex",
|
|
164
|
+
value: "tableIndex"
|
|
165
|
+
}
|
|
166
|
+
], Fe = {
|
|
167
|
+
key: 0,
|
|
168
|
+
class: "show-content"
|
|
169
|
+
}, ve = { class: "item-view-group" }, Be = {
|
|
170
|
+
__name: "index",
|
|
171
|
+
props: {
|
|
172
|
+
content: String,
|
|
173
|
+
jsonContents: Array
|
|
174
|
+
},
|
|
175
|
+
emits: ["change"],
|
|
176
|
+
setup(T, { emit: $ }) {
|
|
177
|
+
const e = T, j = $, f = M(A), { itemData: l } = L(f), y = w([]), h = w([]), s = (n) => {
|
|
178
|
+
j("change", {
|
|
179
|
+
wholeValue: y.value,
|
|
180
|
+
editValue: n
|
|
181
|
+
});
|
|
182
|
+
}, p = (n) => {
|
|
183
|
+
const c = k(y.value), g = c == null ? void 0 : c.map((d, O) => (O === (n == null ? void 0 : n.index) && (d.compData = n == null ? void 0 : n.contents), d));
|
|
184
|
+
y.value = g;
|
|
185
|
+
};
|
|
186
|
+
J(
|
|
187
|
+
() => l.value,
|
|
188
|
+
() => {
|
|
189
|
+
var n;
|
|
190
|
+
!l.value || ((n = l.value) == null ? void 0 : n.length) === 0 || (h.value = l.value, y.value = l.value);
|
|
191
|
+
},
|
|
192
|
+
{ deep: !0, immediate: !0 }
|
|
193
|
+
), J(
|
|
194
|
+
() => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
|
|
195
|
+
() => {
|
|
196
|
+
var c;
|
|
197
|
+
if (((c = e == null ? void 0 : e.jsonContents) == null ? void 0 : c.length) > 0) {
|
|
198
|
+
f.setOriginalData(e == null ? void 0 : e.jsonContents), f.setItemData(e == null ? void 0 : e.jsonContents);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (!(e != null && e.content) || (e == null ? void 0 : e.content) === "") return;
|
|
202
|
+
const n = he(e == null ? void 0 : e.content);
|
|
203
|
+
f.setOriginalData(n), f.setItemData(n);
|
|
204
|
+
},
|
|
205
|
+
{ deep: !0, immediate: !0 }
|
|
206
|
+
);
|
|
207
|
+
const S = (n) => P(n);
|
|
208
|
+
return (n, c) => {
|
|
209
|
+
var g;
|
|
210
|
+
return ((g = h.value) == null ? void 0 : g.length) > 0 ? (r(), _("div", Fe, [
|
|
211
|
+
(r(!0), _(W, null, U(h.value, (d, O) => (r(), _("div", {
|
|
212
|
+
class: "item-content",
|
|
213
|
+
key: O
|
|
214
|
+
}, [
|
|
215
|
+
b("div", ve, E(d.name), 1),
|
|
216
|
+
(r(), B(q(S(d.comp)), {
|
|
217
|
+
itemData: d == null ? void 0 : d.compData,
|
|
218
|
+
childItemData: d == null ? void 0 : d.itemChildData,
|
|
219
|
+
key: O,
|
|
220
|
+
onChange: s,
|
|
221
|
+
index: O,
|
|
222
|
+
onContentChange: p
|
|
223
|
+
}, null, 40, ["itemData", "childItemData", "index"]))
|
|
224
|
+
]))), 128))
|
|
225
|
+
])) : v("", !0);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}, Ee = /* @__PURE__ */ R(Be, [["__scopeId", "data-v-869e6e20"]]), Je = { class: "add-model-content" }, Ae = {
|
|
229
|
+
key: 0,
|
|
230
|
+
class: "model-import-data"
|
|
231
|
+
}, Le = { class: "import-button" }, Me = { key: 0 }, Re = {
|
|
232
|
+
key: 1,
|
|
233
|
+
class: "model-operate"
|
|
234
|
+
}, ze = { class: "model-select" }, We = { class: "model-fill" }, Ue = {
|
|
235
|
+
key: 2,
|
|
236
|
+
class: "model-view ssComponent"
|
|
237
|
+
}, qe = {
|
|
238
|
+
__name: "main",
|
|
239
|
+
props: {
|
|
240
|
+
mode: {
|
|
241
|
+
type: String,
|
|
242
|
+
default: "view"
|
|
243
|
+
},
|
|
244
|
+
content: {
|
|
245
|
+
type: String,
|
|
246
|
+
default: ""
|
|
247
|
+
},
|
|
248
|
+
jsonContents: {
|
|
249
|
+
type: Array,
|
|
250
|
+
default: () => []
|
|
251
|
+
},
|
|
252
|
+
showButton: {
|
|
253
|
+
type: Boolean,
|
|
254
|
+
default: !0
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
emits: ["change"],
|
|
258
|
+
setup(T, { emit: $ }) {
|
|
259
|
+
const e = T, j = $, f = w(""), l = w([]), y = w(0), h = M(A);
|
|
260
|
+
ge(A);
|
|
261
|
+
const { itemData: s, originalData: p } = L(h), S = w(null), n = w(0), c = w(""), g = () => {
|
|
262
|
+
y.value = window.innerWidth;
|
|
263
|
+
}, d = async (u) => {
|
|
264
|
+
var C;
|
|
265
|
+
const o = (C = k(u == null ? void 0 : u.wholeValue)) == null ? void 0 : C.map((a) => {
|
|
266
|
+
var x;
|
|
267
|
+
return (a == null ? void 0 : a.comp) === "Form" && (a.compData = (x = a.compData) == null ? void 0 : x.map((V) => ((V == null ? void 0 : V.key) === "formContent" && (V.contents = ye(V == null ? void 0 : V.contents)), V))), a;
|
|
268
|
+
});
|
|
269
|
+
j("change", {
|
|
270
|
+
originalContents: p.value,
|
|
271
|
+
currentContents: u == null ? void 0 : u.wholeValue,
|
|
272
|
+
editContent: u == null ? void 0 : u.editValue,
|
|
273
|
+
stringContent: O(k(u == null ? void 0 : u.wholeValue)),
|
|
274
|
+
arrayToContents: o
|
|
275
|
+
});
|
|
276
|
+
}, O = (u) => {
|
|
277
|
+
var C;
|
|
278
|
+
let o = [];
|
|
279
|
+
return (C = k(u)) == null || C.forEach((a) => {
|
|
280
|
+
var x, V;
|
|
281
|
+
F != null && F.find((t) => (t == null ? void 0 : t.value) === (a == null ? void 0 : a.comp)) && o.push(((x = F == null ? void 0 : F.find((t) => (t == null ? void 0 : t.value) === (a == null ? void 0 : a.comp))) == null ? void 0 : x.key) + "=" + a.name + "/r/n"), (V = a == null ? void 0 : a.compData) == null || V.forEach((t) => {
|
|
282
|
+
var Q, X, Y, Z, ee, te, ne, ae, oe, le, se, re;
|
|
283
|
+
if (m != null && m.find((I) => (I == null ? void 0 : I.value) === (t == null ? void 0 : t.key)))
|
|
284
|
+
if (!((Q = t == null ? void 0 : t.contents) != null && Q.length))
|
|
285
|
+
o.push(((X = m == null ? void 0 : m.find((I) => (I == null ? void 0 : I.value) === (t == null ? void 0 : t.key))) == null ? void 0 : X.key) + "=" + (t.contents === !0 ? '""' : "Vertical") + "/r/n");
|
|
286
|
+
else {
|
|
287
|
+
let I = (Y = t == null ? void 0 : t.contents) == null ? void 0 : Y[0];
|
|
288
|
+
if (!I) return;
|
|
289
|
+
if (Object.keys(I).includes("label") && Object.keys(I).includes("key") && Object.keys(I).includes("width"))
|
|
290
|
+
if (((ee = (Z = t.contents) == null ? void 0 : Z.filter((D) => D.width !== 1)) == null ? void 0 : ee.length) === 0) {
|
|
291
|
+
const D = (te = k(t == null ? void 0 : t.contents)) == null ? void 0 : te.map((i) => ({ [i.label]: i.value }));
|
|
292
|
+
o.push(((ne = m == null ? void 0 : m.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key))) == null ? void 0 : ne.key) + "=" + JSON.stringify(D) + "/r/n");
|
|
293
|
+
} else {
|
|
294
|
+
let D = [];
|
|
295
|
+
(ae = k(t == null ? void 0 : t.contents)) == null || ae.reduce((i, H) => {
|
|
296
|
+
var ce;
|
|
297
|
+
return i[H.label] = H.key, ((ce = Object.keys(k(i))) == null ? void 0 : ce.length) >= H.width && (D.push(k(i)), i = {}), i;
|
|
298
|
+
}, {}), o.push(((oe = m == null ? void 0 : m.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key))) == null ? void 0 : oe.key) + "=" + JSON.stringify(D) + "/r/n");
|
|
299
|
+
}
|
|
300
|
+
else if (Object.keys(I).includes("label")) {
|
|
301
|
+
const D = (le = k(t == null ? void 0 : t.contents)) == null ? void 0 : le.map((i) => i.label);
|
|
302
|
+
o.push(((se = m == null ? void 0 : m.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key))) == null ? void 0 : se.key) + "=" + JSON.stringify(D) + "/r/n");
|
|
303
|
+
} else
|
|
304
|
+
o.push(((re = m == null ? void 0 : m.find((D) => (D == null ? void 0 : D.value) === (t == null ? void 0 : t.key))) == null ? void 0 : re.key) + "=" + JSON.stringify(t == null ? void 0 : t.contents) + "/r/n");
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}), JSON.stringify(o);
|
|
308
|
+
}, N = w([]), G = () => {
|
|
309
|
+
S.value.click();
|
|
310
|
+
}, de = (u) => {
|
|
311
|
+
const o = u.target.files[0];
|
|
312
|
+
if (!o) return;
|
|
313
|
+
const C = new FileReader();
|
|
314
|
+
C.onload = (a) => {
|
|
315
|
+
try {
|
|
316
|
+
f.value = a.target.result, N.value = me(a.target.result), n.value++;
|
|
317
|
+
} catch (x) {
|
|
318
|
+
console.error("解析失败:", x);
|
|
319
|
+
}
|
|
320
|
+
}, C.onerror = (a) => {
|
|
321
|
+
console.error("文件读取错误:", a);
|
|
322
|
+
}, C.readAsText(o);
|
|
323
|
+
};
|
|
324
|
+
_e(() => {
|
|
325
|
+
window.addEventListener("resize", g);
|
|
326
|
+
}), J(
|
|
327
|
+
() => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
|
|
328
|
+
() => {
|
|
329
|
+
f.value = e == null ? void 0 : e.content, l.value = e == null ? void 0 : e.jsonContents;
|
|
330
|
+
},
|
|
331
|
+
{ deep: !0, immediate: !0 }
|
|
332
|
+
), J(
|
|
333
|
+
() => n.value,
|
|
334
|
+
() => {
|
|
335
|
+
var u;
|
|
336
|
+
((u = N.value) == null ? void 0 : u.length) !== 0 && (h.setOriginalData(N.value), h.setItemData(N.value));
|
|
337
|
+
},
|
|
338
|
+
{ deep: !0, immediate: !0 }
|
|
339
|
+
);
|
|
340
|
+
const me = (u) => {
|
|
341
|
+
let o = u.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
|
|
342
|
+
o = o.replace(/(\w+)\s*:/g, "$1:"), o = o.replace(/\r\n/g, "").replace(/\n/g, "").replace(/\t/g, "").replace(/\s+/g, " ").trim(), o = o.replace(/,\s*([}\]])/g, "$1"), o = o.replace(/:(\s*)([^"{}\[\],\s]+)(\s*)([,}])/g, ": $2$4");
|
|
343
|
+
try {
|
|
344
|
+
return JSON.parse(o);
|
|
345
|
+
} catch (C) {
|
|
346
|
+
try {
|
|
347
|
+
const x = new Function(`return ${o}`)();
|
|
348
|
+
if (Array.isArray(x) || typeof x == "object")
|
|
349
|
+
return x;
|
|
350
|
+
throw new Error(`解析结果不是有效的数组或对象: ${C}`);
|
|
351
|
+
} catch (a) {
|
|
352
|
+
throw new Error(`无法解析JSON: ${a.message}`);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
return (u, o) => {
|
|
357
|
+
var C;
|
|
358
|
+
return r(), _("div", Je, [
|
|
359
|
+
((C = e == null ? void 0 : e.jsonContents) == null ? void 0 : C.length) === 0 ? (r(), _("div", Ae, [
|
|
360
|
+
b("div", Le, [
|
|
361
|
+
b("input", {
|
|
362
|
+
type: "file",
|
|
363
|
+
ref_key: "fileInput",
|
|
364
|
+
ref: S,
|
|
365
|
+
accept: ".txt",
|
|
366
|
+
onChange: de,
|
|
367
|
+
style: { display: "none" }
|
|
368
|
+
}, null, 544),
|
|
369
|
+
b("button", {
|
|
370
|
+
onClick: G,
|
|
371
|
+
class: "import-button-content"
|
|
372
|
+
}, "导入文件"),
|
|
373
|
+
c.value ? (r(), _("span", Me, E(c.value), 1)) : v("", !0)
|
|
374
|
+
])
|
|
375
|
+
])) : v("", !0),
|
|
376
|
+
(e == null ? void 0 : e.mode) === "edit" ? (r(), _("div", Re, [
|
|
377
|
+
b("div", ze, [
|
|
378
|
+
z(De)
|
|
379
|
+
]),
|
|
380
|
+
(r(), _("div", {
|
|
381
|
+
class: "model-show",
|
|
382
|
+
key: y.value
|
|
383
|
+
}, [
|
|
384
|
+
z(Te)
|
|
385
|
+
])),
|
|
386
|
+
b("div", We, [
|
|
387
|
+
z(Oe)
|
|
388
|
+
])
|
|
389
|
+
])) : v("", !0),
|
|
390
|
+
(e == null ? void 0 : e.mode) === "view" ? (r(), _("div", Ue, [
|
|
391
|
+
(r(), B(Ee, {
|
|
392
|
+
content: f.value,
|
|
393
|
+
onChange: d,
|
|
394
|
+
jsonContents: l.value,
|
|
395
|
+
key: y.value
|
|
396
|
+
}, null, 8, ["content", "jsonContents"]))
|
|
397
|
+
])) : v("", !0)
|
|
398
|
+
]);
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
}, Xe = /* @__PURE__ */ R(qe, [["__scopeId", "data-v-b25bde75"]]);
|
|
402
|
+
export {
|
|
403
|
+
Xe as default
|
|
404
|
+
};
|