ss-component-new 1.1.63 → 1.1.65

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.
@@ -1,163 +0,0 @@
1
- import { defineAsyncComponent as j, computed as E, onMounted as O, resolveComponent as A, createBlock as C, openBlock as b, withCtx as F, resolveDynamicComponent as B, defineComponent as U, ref as T, watch as G, createVNode as V, createElementVNode as q, toDisplayString as z } from "vue";
2
- import { E as y, u as H, s as $ } from "./menu-D6yKPqgS.js";
3
- import { u as J } from "./modelComp-Cr1QF6ip.js";
4
- import { c as _, _ as K } from "./_plugin-vue_export-helper-B7R8Jogt.js";
5
- const v = j(() => import("./index-DiAssal2.js"));
6
- v.install = (r) => {
7
- r.component("ssMenu", v);
8
- };
9
- const Q = {
10
- __name: "index",
11
- props: {
12
- name: String
13
- },
14
- setup(r) {
15
- const c = r, p = E(() => y[c.name]);
16
- return O(() => {
17
- const m = Object.keys(y);
18
- console.log("iconComponent", p.value, c.name, y, m);
19
- }), (m, f) => {
20
- const d = A("el-icon");
21
- return b(), C(d, null, {
22
- default: F(() => [
23
- (b(), C(B(p.value)))
24
- ]),
25
- _: 1
26
- });
27
- };
28
- }
29
- }, W = U({
30
- name: "menu",
31
- components: {
32
- ssMenu: v,
33
- DynamicIcon: Q
34
- },
35
- setup() {
36
- const r = H(), c = J(), { rawMenu: p, menuTriggerType: m } = $(r), { itemData: f } = $(c), d = T([]);
37
- let M;
38
- ((e) => {
39
- e[e.Menu = 0] = "Menu", e[e.FolderOpened = 1] = "FolderOpened";
40
- })(M || (M = {}));
41
- const g = (e) => {
42
- let o = [], n = [];
43
- return e == null || e.forEach((s) => {
44
- o = h(s, n);
45
- }), console.log("splitMenu", o), o;
46
- }, h = (e, o) => {
47
- const n = o, s = [];
48
- e == null || e.forEach((t) => {
49
- Array.isArray(t) ? s.push({ children: h(t, []) }) : s.push({ title: t });
50
- });
51
- let u = s.reduce((t, a) => (Object.entries(a).forEach(([l, i]) => {
52
- t[l] === void 0 ? i != null && i.title ? t[l] = [i] : t[l] = i : (Array.isArray(t[l]) || (t[l] = [{ title: t[l] }]), i != null && i.title || Array.isArray(i) ? t[l].push(i) : t[l].push({ title: i }));
53
- }), t), {});
54
- return u = I(_(u)), n.push(u), Array.isArray(n) && (n == null ? void 0 : n.length) > 1 ? n : n == null ? void 0 : n[0];
55
- }, I = (e) => {
56
- var o, n, s;
57
- return Array.isArray(e == null ? void 0 : e.title) && ((o = e == null ? void 0 : e.title) == null ? void 0 : o.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;
58
- }, P = (e) => {
59
- var n;
60
- const o = e;
61
- return o.children = (n = o.children) == null ? void 0 : n.map((s) => {
62
- var u;
63
- return (u = s == null ? void 0 : s.title) != null && u.children ? s == null ? void 0 : s.title : s;
64
- }), o;
65
- }, D = (e, o = "", n = 0) => {
66
- var t;
67
- const s = _(f.value), u = (t = s == null ? void 0 : s.filter((a) => {
68
- var l;
69
- return ((l = a.comp) == null ? void 0 : l.toUpperCase()) === "GROUP";
70
- })) == null ? void 0 : t.map((a) => a.name);
71
- return e == null ? void 0 : e.map((a) => {
72
- const l = o ? `${o}/${a.title}` : a.title, i = {
73
- ...a,
74
- path: l,
75
- level: n,
76
- icon: M[`${n}`],
77
- carryData: u == null ? void 0 : u.includes(l)
78
- };
79
- return a.children && a.children.length > 0 && (i.children = D(a.children, l, n + 1)), i;
80
- });
81
- }, S = E(() => {
82
- const e = D(d.value);
83
- return console.log("temps", e), r.setMenus(e), e;
84
- }), k = (e) => {
85
- console.log("clickMenu", e), r.setMenuTriggerType("click"), r.setActiveMenuPath(e == null ? void 0 : e.path);
86
- }, w = (e) => {
87
- m.value === "click" ? r.setActiveMenuPath(e) : r.setMenuTriggerType("click");
88
- }, L = (e) => {
89
- r.setActiveMenuPath(e);
90
- }, N = T([
91
- {
92
- name: "--ssComponent-menu-bg",
93
- value: "#426ec4"
94
- },
95
- {
96
- name: "--ssComponent-submenu-hover-bg",
97
- value: "#00000033"
98
- },
99
- {
100
- name: "--ssComponent-submenu-open-bg",
101
- value: "#2DA0FF"
102
- },
103
- {
104
- name: "--ssComponent-submenu-open-inline-bg",
105
- value: "#1C4275"
106
- },
107
- {
108
- name: "--ssComponent-menuitem-hover-bg",
109
- value: "#1d7bef"
110
- },
111
- {
112
- name: "--ssComponent-menuitem-active-bg",
113
- value: "#1d7bef"
114
- }
115
- ]), R = () => {
116
- var o;
117
- const e = document.documentElement;
118
- (o = N.value) == null || o.forEach((n) => {
119
- e.style.setProperty(n.name, n.value);
120
- });
121
- };
122
- return O(() => {
123
- }), G(() => p.value, (e) => {
124
- var o, n, s;
125
- if (e) {
126
- const u = (s = (n = (o = _(e)) == null ? void 0 : o.compData) == null ? void 0 : n[0]) == null ? void 0 : s.contents;
127
- d.value = g(u), console.log("rawMenu", S.value);
128
- } else
129
- r.setActiveMenuPath("");
130
- }, {
131
- immediate: !0
132
- }), {
133
- renderMenuList: S,
134
- clickMenu: k,
135
- openMenu: w,
136
- closeMenu: L,
137
- changeMenuStyle: R
138
- };
139
- }
140
- });
141
- function X(r, c, p, m, f, d) {
142
- const M = A("DynamicIcon"), g = A("ssMenu");
143
- return b(), C(g, {
144
- menuList: r.renderMenuList,
145
- onClickMenu: r.clickMenu,
146
- onOpenMenu: r.openMenu,
147
- onCloseMenu: r.closeMenu,
148
- onChangeMenuStyle: r.changeMenuStyle,
149
- class: "menuList-wrap"
150
- }, {
151
- title: F(({ menu: h }) => [
152
- V(M, {
153
- name: h.icon ?? ""
154
- }, null, 8, ["name"]),
155
- q("span", null, z(h.title ?? ""), 1)
156
- ]),
157
- _: 1
158
- }, 8, ["menuList", "onClickMenu", "onOpenMenu", "onCloseMenu", "onChangeMenuStyle"]);
159
- }
160
- const ne = /* @__PURE__ */ K(W, [["render", X], ["__scopeId", "data-v-dc84a8f7"]]);
161
- export {
162
- ne as default
163
- };
@@ -1,286 +0,0 @@
1
- import { ref as _, watch as V, createElementBlock as C, createCommentVNode as I, openBlock as f, Fragment as le, renderList as se, createElementVNode as O, createBlock as Z, toDisplayString as v, resolveDynamicComponent as ue, onMounted as ce, createVNode as A } from "vue";
2
- import { p as E, e as ie, g as de, m as me, a as ye, b as fe, c as ge } from "./array-TPqQws5q.js";
3
- import { u as ee } from "./modelComp-Cr1QF6ip.js";
4
- import { s as te, u as he } from "./menu-D6yKPqgS.js";
5
- import { _ as ne, c as k } from "./_plugin-vue_export-helper-B7R8Jogt.js";
6
- const x = [
7
- {
8
- key: "FormName",
9
- value: "Form"
10
- },
11
- {
12
- key: "TableName",
13
- value: "Table"
14
- }
15
- ], s = [
16
- {
17
- key: "FormDirect",
18
- value: "formFlex"
19
- },
20
- {
21
- key: "Form",
22
- value: "formContent"
23
- },
24
- {
25
- key: "FormButton",
26
- value: "formButton"
27
- },
28
- {
29
- key: "TableColumns",
30
- value: "header"
31
- },
32
- {
33
- key: "TableButton",
34
- value: "extraButton"
35
- },
36
- {
37
- key: "LineButton",
38
- value: "rowButton"
39
- },
40
- {
41
- key: "Table",
42
- value: "tableContents"
43
- },
44
- {
45
- key: "TableIndex",
46
- value: "tableIndex"
47
- }
48
- ], ke = {
49
- key: 0,
50
- class: "show-content"
51
- }, _e = { class: "item-view-group" }, Ce = {
52
- __name: "index",
53
- props: {
54
- content: String,
55
- jsonContents: Array
56
- },
57
- emits: ["change"],
58
- setup(F, { emit: B }) {
59
- const e = F, $ = B, h = ee(E), { itemData: b } = te(h), p = _([]), w = _([]), L = (l) => {
60
- $("change", {
61
- wholeValue: p.value,
62
- editValue: l
63
- });
64
- }, D = (l) => {
65
- const g = k(p.value), S = g == null ? void 0 : g.map((c, j) => (j === (l == null ? void 0 : l.index) && (c.compData = l == null ? void 0 : l.contents), c));
66
- p.value = S;
67
- };
68
- V(
69
- () => b.value,
70
- () => {
71
- var l;
72
- !b.value || ((l = b.value) == null ? void 0 : l.length) === 0 || (w.value = b.value, p.value = b.value);
73
- },
74
- { deep: !0, immediate: !0 }
75
- ), V(
76
- () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
77
- () => {
78
- var g;
79
- if (((g = e == null ? void 0 : e.jsonContents) == null ? void 0 : g.length) > 0) {
80
- h.setOriginalData(e == null ? void 0 : e.jsonContents), h.setItemData(e == null ? void 0 : e.jsonContents);
81
- return;
82
- }
83
- if (!(e != null && e.content) || (e == null ? void 0 : e.content) === "") return;
84
- const l = ie(e == null ? void 0 : e.content);
85
- h.setOriginalData(l), h.setItemData(l);
86
- },
87
- { deep: !0, immediate: !0 }
88
- );
89
- const N = (l) => de(l);
90
- return (l, g) => {
91
- var S;
92
- return ((S = w.value) == null ? void 0 : S.length) > 0 ? (f(), C("div", ke, [
93
- (f(!0), C(le, null, se(w.value, (c, j) => (f(), C("div", {
94
- class: "item-content",
95
- key: j
96
- }, [
97
- O("div", _e, v(c.name), 1),
98
- (f(), Z(ue(N(c.comp)), {
99
- itemData: c == null ? void 0 : c.compData,
100
- childItemData: c == null ? void 0 : c.itemChildData,
101
- key: j,
102
- onChange: L,
103
- index: j,
104
- onContentChange: D
105
- }, null, 40, ["itemData", "childItemData", "index"]))
106
- ]))), 128))
107
- ])) : I("", !0);
108
- };
109
- }
110
- }, be = /* @__PURE__ */ ne(Ce, [["__scopeId", "data-v-869e6e20"]]), pe = { class: "add-model-content" }, we = {
111
- key: 0,
112
- class: "model-import-data"
113
- }, je = { class: "import-button" }, Se = { key: 0 }, xe = {
114
- key: 1,
115
- class: "model-operate"
116
- }, Oe = { class: "model-select" }, Ie = { class: "model-fill" }, Ne = {
117
- key: 2,
118
- class: "model-view ssComponent"
119
- }, Te = {
120
- __name: "main",
121
- props: {
122
- mode: {
123
- type: String,
124
- default: "view"
125
- },
126
- content: {
127
- type: String,
128
- default: ""
129
- },
130
- jsonContents: {
131
- type: Array,
132
- default: () => []
133
- },
134
- showButton: {
135
- type: Boolean,
136
- default: !0
137
- }
138
- },
139
- emits: ["change"],
140
- setup(F, { emit: B }) {
141
- const e = F, $ = B, h = _(""), b = _([]), p = _(0), w = ee(E);
142
- he(E);
143
- const { itemData: L, originalData: D } = te(w), N = _(null), l = _(0), g = _(""), S = () => {
144
- p.value = window.innerWidth;
145
- }, c = async (o) => {
146
- var u;
147
- const a = (u = k(o == null ? void 0 : o.wholeValue)) == null ? void 0 : u.map((n) => {
148
- var m;
149
- return (n == null ? void 0 : n.comp) === "Form" && (n.compData = (m = n.compData) == null ? void 0 : m.map((y) => ((y == null ? void 0 : y.key) === "formContent" && (y.contents = ge(y == null ? void 0 : y.contents)), y))), n;
150
- });
151
- $("change", {
152
- originalContents: D.value,
153
- currentContents: o == null ? void 0 : o.wholeValue,
154
- editContent: o == null ? void 0 : o.editValue,
155
- stringContent: j(k(o == null ? void 0 : o.wholeValue)),
156
- arrayToContents: a
157
- });
158
- }, j = (o) => {
159
- var u;
160
- let a = [];
161
- return (u = k(o)) == null || u.forEach((n) => {
162
- var m, y;
163
- x != null && x.find((t) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.comp)) && a.push(((m = x == null ? void 0 : x.find((t) => (t == null ? void 0 : t.value) === (n == null ? void 0 : n.comp))) == null ? void 0 : m.key) + "=" + n.name + "/r/n"), (y = n == null ? void 0 : n.compData) == null || y.forEach((t) => {
164
- var M, R, z, W, q, G, H, K, P, Q, U, X;
165
- if (s != null && s.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key)))
166
- if (!((M = t == null ? void 0 : t.contents) != null && M.length))
167
- a.push(((R = s == null ? void 0 : s.find((i) => (i == null ? void 0 : i.value) === (t == null ? void 0 : t.key))) == null ? void 0 : R.key) + "=" + (t.contents === !0 ? '""' : "Vertical") + "/r/n");
168
- else {
169
- let i = (z = t == null ? void 0 : t.contents) == null ? void 0 : z[0];
170
- if (!i) return;
171
- if (Object.keys(i).includes("label") && Object.keys(i).includes("key") && Object.keys(i).includes("width"))
172
- if (((q = (W = t.contents) == null ? void 0 : W.filter((d) => d.width !== 1)) == null ? void 0 : q.length) === 0) {
173
- const d = (G = k(t == null ? void 0 : t.contents)) == null ? void 0 : G.map((r) => ({ [r.label]: r.value }));
174
- a.push(((H = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : H.key) + "=" + JSON.stringify(d) + "/r/n");
175
- } else {
176
- let d = [];
177
- (K = k(t == null ? void 0 : t.contents)) == null || K.reduce((r, J) => {
178
- var Y;
179
- return r[J.label] = J.key, ((Y = Object.keys(k(r))) == null ? void 0 : Y.length) >= J.width && (d.push(k(r)), r = {}), r;
180
- }, {}), a.push(((P = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : P.key) + "=" + JSON.stringify(d) + "/r/n");
181
- }
182
- else if (Object.keys(i).includes("label")) {
183
- const d = (Q = k(t == null ? void 0 : t.contents)) == null ? void 0 : Q.map((r) => r.label);
184
- a.push(((U = s == null ? void 0 : s.find((r) => (r == null ? void 0 : r.value) === (t == null ? void 0 : t.key))) == null ? void 0 : U.key) + "=" + JSON.stringify(d) + "/r/n");
185
- } else
186
- a.push(((X = s == null ? void 0 : s.find((d) => (d == null ? void 0 : d.value) === (t == null ? void 0 : t.key))) == null ? void 0 : X.key) + "=" + JSON.stringify(t == null ? void 0 : t.contents) + "/r/n");
187
- }
188
- });
189
- }), JSON.stringify(a);
190
- }, T = _([]), ae = () => {
191
- N.value.click();
192
- }, oe = (o) => {
193
- const a = o.target.files[0];
194
- if (!a) return;
195
- const u = new FileReader();
196
- u.onload = (n) => {
197
- try {
198
- h.value = n.target.result, T.value = re(n.target.result), l.value++;
199
- } catch (m) {
200
- console.error("解析失败:", m);
201
- }
202
- }, u.onerror = (n) => {
203
- console.error("文件读取错误:", n);
204
- }, u.readAsText(a);
205
- };
206
- ce(() => {
207
- window.addEventListener("resize", S);
208
- }), V(
209
- () => [e == null ? void 0 : e.content, e == null ? void 0 : e.jsonContents],
210
- () => {
211
- h.value = e == null ? void 0 : e.content, b.value = e == null ? void 0 : e.jsonContents;
212
- },
213
- { deep: !0, immediate: !0 }
214
- ), V(
215
- () => l.value,
216
- () => {
217
- var o;
218
- ((o = T.value) == null ? void 0 : o.length) !== 0 && (w.setOriginalData(T.value), w.setItemData(T.value));
219
- },
220
- { deep: !0, immediate: !0 }
221
- );
222
- const re = (o) => {
223
- let a = o.replace(/,/g, ",").replace(/;/g, ";").replace(/:/g, ":");
224
- 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");
225
- try {
226
- return JSON.parse(a);
227
- } catch (u) {
228
- try {
229
- const m = new Function(`return ${a}`)();
230
- if (Array.isArray(m) || typeof m == "object")
231
- return m;
232
- throw new Error(`解析结果不是有效的数组或对象: ${u}`);
233
- } catch (n) {
234
- throw new Error(`无法解析JSON: ${n.message}`);
235
- }
236
- }
237
- };
238
- return (o, a) => {
239
- var u;
240
- return f(), C("div", pe, [
241
- ((u = e == null ? void 0 : e.jsonContents) == null ? void 0 : u.length) === 0 ? (f(), C("div", we, [
242
- O("div", je, [
243
- O("input", {
244
- type: "file",
245
- ref_key: "fileInput",
246
- ref: N,
247
- accept: ".txt",
248
- onChange: oe,
249
- style: { display: "none" }
250
- }, null, 544),
251
- O("button", {
252
- onClick: ae,
253
- class: "import-button-content"
254
- }, "导入文件"),
255
- g.value ? (f(), C("span", Se, v(g.value), 1)) : I("", !0)
256
- ])
257
- ])) : I("", !0),
258
- (e == null ? void 0 : e.mode) === "edit" ? (f(), C("div", xe, [
259
- O("div", Oe, [
260
- A(me)
261
- ]),
262
- (f(), C("div", {
263
- class: "model-show",
264
- key: p.value
265
- }, [
266
- A(ye)
267
- ])),
268
- O("div", Ie, [
269
- A(fe)
270
- ])
271
- ])) : I("", !0),
272
- (e == null ? void 0 : e.mode) === "view" ? (f(), C("div", Ne, [
273
- (f(), Z(be, {
274
- content: h.value,
275
- onChange: c,
276
- jsonContents: b.value,
277
- key: p.value
278
- }, null, 8, ["content", "jsonContents"]))
279
- ])) : I("", !0)
280
- ]);
281
- };
282
- }
283
- }, Je = /* @__PURE__ */ ne(Te, [["__scopeId", "data-v-b25bde75"]]);
284
- export {
285
- Je as default
286
- };