epic-designer-gold 1.0.5 → 1.0.7
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/ETable-adkZzXhI.cjs +1 -0
- package/dist/ETable-ogvH56w7.js +50 -0
- package/dist/ETd-BCM7zA8V.cjs +1 -0
- package/dist/{row-DAy14ve9.js → ETd-CRUvOVnZ.js} +13 -13
- package/dist/ETr-BqGghav2.cjs +1 -0
- package/dist/ETr-nIjGkdzO.js +43 -0
- package/dist/attributeView-BCjRZKcy.cjs +1 -0
- package/dist/{attributeView-Cu_tjo9A.js → attributeView-CcnkUeu9.js} +7 -7
- package/dist/axios-CXDYiOMX.js +1704 -0
- package/dist/axios-tuVKNgv9.cjs +6 -0
- package/dist/card-C9ua0f7r.cjs +1 -0
- package/dist/card-CI6L3YKU.js +33 -0
- package/dist/cell-AML-qIH9.cjs +1 -0
- package/dist/cell-B_q5hgzb.js +35 -0
- package/dist/col-C4lVVBzC.cjs +1 -0
- package/dist/col-DcVPBKEc.js +31 -0
- package/dist/core/components/builder/src/builder.vue.d.ts +2 -2
- package/dist/core/components/designer/src/modules/attributeView/eventView.vue.d.ts +2 -0
- package/dist/core/components/node/src/node.vue.d.ts +3 -2
- package/dist/core/extensions/EColumnEditor/columnItem.vue.d.ts +10 -0
- package/dist/core/extensions/EColumnEditor/index.vue.d.ts +18 -0
- package/dist/core/extensions/PaddingMarginControl/index.vue.d.ts +10 -0
- package/dist/eventView-5fa6mfSD.cjs +1 -0
- package/dist/eventView-C2wKhfU_.js +63 -0
- package/dist/{form-CthzLIgs.cjs → form-Bofkrmkd.cjs} +1 -1
- package/dist/{form-6cUK-Ari.js → form-VbfBmb63.js} +5 -5
- package/dist/iframe-CRF3GSRv.cjs +1 -0
- package/dist/iframe-Fgbk3vqJ.js +48 -0
- package/dist/index-0WmqAKuy.js +4 -0
- package/dist/index-5yjG3fiB.cjs +1 -0
- package/dist/{index-DxNdcsD-.js → index-B0OgKtuT.js} +105 -100
- package/dist/{index-Dg7MK40D.js → index-B1s67XDZ.js} +17 -17
- package/dist/index-BEUYVwRA.cjs +1 -0
- package/dist/{index-DeFAvWuV.cjs → index-BHEw6RsQ.cjs} +1 -1
- package/dist/index-BHZbtFEF.cjs +1 -0
- package/dist/index-BU05X44j.cjs +1 -0
- package/dist/index-BY37Ndo7.cjs +10 -0
- package/dist/index-BoL2PSBk.cjs +1 -0
- package/dist/index-BvfkMKTv.cjs +1 -0
- package/dist/{index-BLJT8e0Q.js → index-BvvGezNc.js} +4 -4
- package/dist/{index-CHCOxt3B.js → index-BydHABbW.js} +3 -3
- package/dist/index-C2s4IuAR.cjs +1 -0
- package/dist/index-CCCx1tbF.cjs +1 -0
- package/dist/index-CD00bJyK.js +839 -0
- package/dist/{index-Bybwt7-u.js → index-CG0UEELU.js} +1 -1
- package/dist/index-CdnV7DS4.js +265 -0
- package/dist/{index-D0kQz_zt.js → index-Cln9MN7u.js} +1 -1
- package/dist/index-CpBfljmg.cjs +1 -0
- package/dist/{index-CMbBKMQU.js → index-CpTA2IRB.js} +2 -2
- package/dist/index-CpevxZqj.cjs +1 -0
- package/dist/index-CraRg8wh.js +107 -0
- package/dist/{index-CEDIwmNK.js → index-Cx7gKpkD.js} +2 -2
- package/dist/index-DYQi05p8.cjs +1 -0
- package/dist/{index-CjIIhZdV.js → index-E8jDNKrc.js} +3 -3
- package/dist/index-FgdbKgb5.cjs +1 -0
- package/dist/index-GIYb626z.js +1422 -0
- package/dist/{index-CgwN4ucQ.js → index-IGxCNti8.js} +48 -28
- package/dist/{index-CqeRfqUw.cjs → index-IPz4bbk7.cjs} +1 -1
- package/dist/index-R2r9Rw5O.cjs +1 -0
- package/dist/index-WkZdU_zw.js +47 -0
- package/dist/index-v2u1WTMm.cjs +1 -0
- package/dist/index-vCJWgHu-.js +142 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/locale/lang/en-US.d.ts +2 -0
- package/dist/locale/lang/zh-cn.d.ts +2 -0
- package/dist/modal-DCBqsiP2.cjs +1 -0
- package/dist/modal-DZRBS-Mt.js +58 -0
- package/dist/outline-BE98qFHQ.cjs +1 -0
- package/dist/{outline-DxCKINRN.js → outline-Ch5PHy3c.js} +2 -2
- package/dist/pluginManager-BCnrHPYv.js +660 -0
- package/dist/pluginManager-DWHAX8kP.cjs +1 -0
- package/dist/sign-BS-9u6is.cjs +1 -0
- package/dist/{sign-B-FCN_7O.js → sign-l63EYvVo.js} +61 -56
- package/dist/style.css +1 -1
- package/dist/styleView-Dhj1GDqf.js +140 -0
- package/dist/styleView-DocskQJQ.cjs +1 -0
- package/dist/tabPanel-CXZYMEwi.cjs +1 -0
- package/dist/{col-D4hvKfJ6.js → tabPanel-DAw7ENrC.js} +7 -7
- package/dist/table-75K2lqjD.js +65 -0
- package/dist/table-CN2LNWqY.cjs +1 -0
- package/dist/tabs-CYH9lAUk.cjs +1 -0
- package/dist/tabs-DCyifACM.js +41 -0
- package/dist/text-B92ioaoV.cjs +1 -0
- package/dist/text-C-b94tBH.js +47 -0
- package/dist/tree.vue_vue_type_script_setup_true_lang-BsVyMb-n.js +243 -0
- package/dist/tree.vue_vue_type_script_setup_true_lang-VGvT-OYl.cjs +1 -0
- package/dist/ui/elementPlus/ETable/ETable.d.ts +20 -0
- package/dist/ui/elementPlus/ETd/ETd.d.ts +20 -0
- package/dist/ui/elementPlus/ETr/ETr.d.ts +20 -0
- package/dist/ui/elementPlus/ETr/index.d.ts +3 -0
- package/dist/ui/elementPlus/iframe/iframe.d.ts +29 -0
- package/dist/ui/elementPlus/iframe/index.d.ts +3 -0
- package/dist/ui/elementPlus/index.cjs +1 -1
- package/dist/ui/elementPlus/index.js +904 -403
- package/dist/ui/elementPlus/rate/index.d.ts +3 -0
- package/dist/ui/elementPlus/tab-panel/index.d.ts +3 -0
- package/dist/ui/elementPlus/table/table.d.ts +9 -0
- package/dist/ui/elementPlus/table-cell/index.d.ts +3 -0
- package/dist/ui/elementPlus/tabs/index.d.ts +2 -0
- package/dist/ui/elementPlus/tabs/tabs.d.ts +29 -0
- package/dist/ui/elementPlus/text/text.d.ts +9 -0
- package/dist/ui/naiveUi/index.cjs +1 -1
- package/dist/ui/naiveUi/index.js +1 -1
- package/dist/uploadFile-pgvj4Lm9.cjs +1 -0
- package/dist/uploadFile-qCbXuHfd.js +81 -0
- package/dist/uploadImage-B3sOX-5F.cjs +1 -0
- package/dist/{uploadImage-CF7fobUP.cjs → uploadImage-CNMsK4Lh.cjs} +1 -1
- package/dist/uploadImage-DQmVV0jl.js +121 -0
- package/dist/{uploadImage-COCC3pxH.js → uploadImage-VFICaVgX.js} +1 -1
- package/package.json +1 -1
- package/dist/attributeView-B2dWB_U2.cjs +0 -1
- package/dist/axios-B8aFvCWj.cjs +0 -6
- package/dist/axios-Bb3STC1u.js +0 -2362
- package/dist/card-BowzD9vN.cjs +0 -1
- package/dist/card-CNGNDzPp.js +0 -31
- package/dist/col-B1GUMkMK.cjs +0 -1
- package/dist/col-BNNn9Yx8.cjs +0 -1
- package/dist/col-u5YiB-UK.js +0 -41
- package/dist/index-21c4Pe3i.cjs +0 -1
- package/dist/index-B553TaXm.js +0 -44
- package/dist/index-BULuVnVl.js +0 -1359
- package/dist/index-BV9SE7wG.cjs +0 -1
- package/dist/index-BhcwWM1G.cjs +0 -1
- package/dist/index-Bn8pwpgq.cjs +0 -1
- package/dist/index-Bxi3JLms.cjs +0 -1
- package/dist/index-CEvDmc0a.js +0 -104
- package/dist/index-CI3dhGXT.cjs +0 -1
- package/dist/index-CYAKMqdR.cjs +0 -1
- package/dist/index-Cq6eLpKZ.cjs +0 -1
- package/dist/index-CrV5FaWU.cjs +0 -10
- package/dist/index-DR80h8IU.js +0 -4
- package/dist/index-DUMEtCCN.cjs +0 -1
- package/dist/index-DddTXMY9.cjs +0 -1
- package/dist/index-DeZ09CHf.cjs +0 -1
- package/dist/index-DzxQG0o7.cjs +0 -1
- package/dist/index-VblxMq6V.js +0 -742
- package/dist/modal-BLOgN3us.cjs +0 -1
- package/dist/modal-UFu4bD6x.js +0 -57
- package/dist/outline-CK-jNomF.cjs +0 -1
- package/dist/row-BWnbt6dh.cjs +0 -1
- package/dist/sign-Dho4kHTC.cjs +0 -1
- package/dist/styleView-CRUqDcCl.cjs +0 -1
- package/dist/styleView-ClMjCfMk.js +0 -106
- package/dist/table-CnBJm7Bx.js +0 -43
- package/dist/table-DM2-xHlv.cjs +0 -1
- package/dist/text-C-52xLjs.js +0 -33
- package/dist/text-X9fl5oe8.cjs +0 -1
- package/dist/tree.vue_vue_type_script_setup_true_lang-B9rWLveX.js +0 -242
- package/dist/tree.vue_vue_type_script_setup_true_lang-DDDqMedP.cjs +0 -1
- package/dist/uploadFile-Bc5Rxk0b.js +0 -77
- package/dist/uploadFile-oB2-NP-v.cjs +0 -1
- package/dist/uploadImage-4tgp3t7X.cjs +0 -1
- package/dist/uploadImage-CGXm3zNQ.js +0 -96
- /package/dist/ui/elementPlus/{table-col → ETable}/index.d.ts +0 -0
- /package/dist/ui/elementPlus/{table-row → ETd}/index.d.ts +0 -0
- /package/dist/ui/elementPlus/{table-col/col.d.ts → tab-panel/tabPanel.d.ts} +0 -0
- /package/dist/ui/elementPlus/{table-row/row.d.ts → table-cell/cell.d.ts} +0 -0
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var A = (i, e, n) => e in i ? x(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
|
+
var l = (i, e, n) => A(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { defineAsyncComponent as G, ref as v, shallowRef as w } from "vue";
|
|
5
|
+
import { u as I } from "./index-B1s67XDZ.js";
|
|
6
|
+
const d = (i, e) => G({
|
|
7
|
+
loader: i,
|
|
8
|
+
loadingComponent: e,
|
|
9
|
+
delay: 80
|
|
10
|
+
});
|
|
11
|
+
function y(i = 10) {
|
|
12
|
+
const e = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
13
|
+
let n = "";
|
|
14
|
+
for (let s = 0; s < i; s++) {
|
|
15
|
+
const t = Math.floor(Math.random() * e.length);
|
|
16
|
+
n += e[t];
|
|
17
|
+
}
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
function L(i) {
|
|
21
|
+
return i.charAt(0).toUpperCase() + i.slice(1);
|
|
22
|
+
}
|
|
23
|
+
const { t: S } = I();
|
|
24
|
+
function m(i, e = /* @__PURE__ */ new WeakMap()) {
|
|
25
|
+
if (typeof i != "object" || i === null)
|
|
26
|
+
return i;
|
|
27
|
+
if (e.has(i))
|
|
28
|
+
return e.get(i);
|
|
29
|
+
if (Array.isArray(i)) {
|
|
30
|
+
const s = i.map((t) => m(t, e));
|
|
31
|
+
return e.set(i, s), s;
|
|
32
|
+
}
|
|
33
|
+
const n = {};
|
|
34
|
+
return e.set(i, n), Object.keys(i).forEach((s) => {
|
|
35
|
+
n[s] = m(i[s], e);
|
|
36
|
+
}), n;
|
|
37
|
+
}
|
|
38
|
+
function R(i) {
|
|
39
|
+
const [e] = M([m(i)], (n) => {
|
|
40
|
+
var t, o;
|
|
41
|
+
const s = {
|
|
42
|
+
...n,
|
|
43
|
+
id: `${n.type}_${y(8)}`
|
|
44
|
+
};
|
|
45
|
+
return (s.field || s.input) && !((o = (t = z.getComponentConfingByType(s.type)) == null ? void 0 : t.editConstraints) != null && o.fixedField) && (s.field = s.id), s;
|
|
46
|
+
});
|
|
47
|
+
return e;
|
|
48
|
+
}
|
|
49
|
+
function b(i, e, n = !0) {
|
|
50
|
+
for (const [s, t] of Object.entries(e)) {
|
|
51
|
+
let o = i == null ? void 0 : i[s];
|
|
52
|
+
o && t && typeof o == "object" && typeof t == "object" ? (Array.isArray(o) && !Array.isArray(t) ? o = i[s] = {} : !Array.isArray(o) && Array.isArray(t) && (o = i[s] = []), b(o, t, n)) : i[s] = t;
|
|
53
|
+
}
|
|
54
|
+
n && Object.keys(i).reverse().forEach((s) => {
|
|
55
|
+
e.hasOwnProperty(s) || (Array.isArray(i) ? i.splice(Number(s), 1) : delete i[s]);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function D(i, e, n = [], s = /* @__PURE__ */ new WeakMap()) {
|
|
59
|
+
const t = (o) => {
|
|
60
|
+
if (Array.isArray(o))
|
|
61
|
+
return o.map(t);
|
|
62
|
+
if (typeof o == "object" && o !== null) {
|
|
63
|
+
if (s.has(o))
|
|
64
|
+
return "[Circular]";
|
|
65
|
+
s.set(o, !0);
|
|
66
|
+
const r = Object.keys(o).sort(), a = {};
|
|
67
|
+
return r.forEach((u) => {
|
|
68
|
+
n.includes(u) || (a[u] = t(o[u]));
|
|
69
|
+
}), s.delete(o), a;
|
|
70
|
+
} else
|
|
71
|
+
return o;
|
|
72
|
+
};
|
|
73
|
+
return JSON.stringify(t(i)) === JSON.stringify(t(e));
|
|
74
|
+
}
|
|
75
|
+
function V(i, e) {
|
|
76
|
+
const n = [];
|
|
77
|
+
let s = !1;
|
|
78
|
+
function t(o) {
|
|
79
|
+
if (n.push(o), o.id === e && (s = !0), !s && o.children != null && o.children.length > 0)
|
|
80
|
+
for (let r = 0; r < o.children.length && (t(o.children[r]), !s); r++)
|
|
81
|
+
;
|
|
82
|
+
if (!s && o.slots)
|
|
83
|
+
for (let r in o.slots)
|
|
84
|
+
for (let a = 0; a < o.slots[r].length && (t(o.slots[r][a]), !s); a++)
|
|
85
|
+
;
|
|
86
|
+
s || n.pop();
|
|
87
|
+
}
|
|
88
|
+
return i.forEach(t), s || console.error(`没有查询到id为${e}的节点`), n;
|
|
89
|
+
}
|
|
90
|
+
function N(i, e, n) {
|
|
91
|
+
const s = e.split(".");
|
|
92
|
+
let t = i;
|
|
93
|
+
for (let o = 0; o < s.length; o++) {
|
|
94
|
+
if (t == null)
|
|
95
|
+
return n;
|
|
96
|
+
t = t[s[o]];
|
|
97
|
+
}
|
|
98
|
+
return t === void 0 ? n : t;
|
|
99
|
+
}
|
|
100
|
+
function W(i, e, n) {
|
|
101
|
+
const s = e.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
102
|
+
let t = i;
|
|
103
|
+
for (let o = 0; o < s.length - 1; o++) {
|
|
104
|
+
const r = s[o];
|
|
105
|
+
t[r] == null && (t[r] = isNaN(Number(s[o + 1])) ? {} : []), t = t[r];
|
|
106
|
+
}
|
|
107
|
+
return t[s[s.length - 1]] = n, i;
|
|
108
|
+
}
|
|
109
|
+
function q(i, e = "default") {
|
|
110
|
+
return k(i, e).map((s) => s.field);
|
|
111
|
+
}
|
|
112
|
+
function k(i, e = "default") {
|
|
113
|
+
const n = p(
|
|
114
|
+
i,
|
|
115
|
+
(t) => {
|
|
116
|
+
var o;
|
|
117
|
+
return t.type === "form" && (((o = t.componentProps) == null ? void 0 : o.name) ?? t.name === e);
|
|
118
|
+
},
|
|
119
|
+
!0
|
|
120
|
+
);
|
|
121
|
+
return p(
|
|
122
|
+
(n == null ? void 0 : n.children) ?? [],
|
|
123
|
+
(t) => !!t.input,
|
|
124
|
+
!1,
|
|
125
|
+
(t) => t.type !== "subform"
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function p(i, e, n = !1, s) {
|
|
129
|
+
const t = [], o = [...i];
|
|
130
|
+
for (; o.length; ) {
|
|
131
|
+
const r = o.pop();
|
|
132
|
+
if (r != null && r.children && (!s || s(r)) && o.push(...r.children), r != null && r.slots && (!s || s(r)))
|
|
133
|
+
for (let a in r.slots)
|
|
134
|
+
o.push(...r.slots[a]);
|
|
135
|
+
if (e(r) && (t.push(r), n))
|
|
136
|
+
return r;
|
|
137
|
+
}
|
|
138
|
+
return n ? !1 : t;
|
|
139
|
+
}
|
|
140
|
+
function M(i, e, n) {
|
|
141
|
+
const s = [...i];
|
|
142
|
+
for (; s.length; ) {
|
|
143
|
+
const t = s.pop();
|
|
144
|
+
if (t != null && t.children && (!n || n(t)) && s.push(...t.children), t != null && t.slots && (!n || n(t)))
|
|
145
|
+
for (let o in t.slots)
|
|
146
|
+
s.push(...t.slots[o]);
|
|
147
|
+
b(t, e(t));
|
|
148
|
+
}
|
|
149
|
+
return i;
|
|
150
|
+
}
|
|
151
|
+
function $(i, e) {
|
|
152
|
+
const n = p(
|
|
153
|
+
i,
|
|
154
|
+
(s) => s.id === e,
|
|
155
|
+
!0
|
|
156
|
+
);
|
|
157
|
+
if (!n)
|
|
158
|
+
throw new Error(`没有查询到id为${e}的节点`);
|
|
159
|
+
return n;
|
|
160
|
+
}
|
|
161
|
+
function U(i, e) {
|
|
162
|
+
const n = [{ type: "", children: i }];
|
|
163
|
+
let s = 0, t = null;
|
|
164
|
+
if (p(
|
|
165
|
+
n,
|
|
166
|
+
(o) => {
|
|
167
|
+
if (t = o.children ?? null, !t) {
|
|
168
|
+
if (o != null && o.slots)
|
|
169
|
+
for (let r in o.slots) {
|
|
170
|
+
t = o.slots[r];
|
|
171
|
+
for (let a = 0; a < t.length; a++)
|
|
172
|
+
if (t[a].id === e)
|
|
173
|
+
return s = a, !0;
|
|
174
|
+
}
|
|
175
|
+
return !1;
|
|
176
|
+
}
|
|
177
|
+
for (let r = 0; r < t.length; r++)
|
|
178
|
+
if (t[r].id === e)
|
|
179
|
+
return s = r, !0;
|
|
180
|
+
return !1;
|
|
181
|
+
},
|
|
182
|
+
!0
|
|
183
|
+
), !t)
|
|
184
|
+
throw new Error(`没有查询到id为${e}的节点`);
|
|
185
|
+
return {
|
|
186
|
+
list: t,
|
|
187
|
+
schema: t[s],
|
|
188
|
+
index: s
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function J(i) {
|
|
192
|
+
const e = {
|
|
193
|
+
schemas: [
|
|
194
|
+
{
|
|
195
|
+
type: "page",
|
|
196
|
+
id: "root",
|
|
197
|
+
label: S("page"),
|
|
198
|
+
children: [
|
|
199
|
+
{
|
|
200
|
+
label: S("form"),
|
|
201
|
+
type: "form",
|
|
202
|
+
icon: "epic-icon-daibanshixiang",
|
|
203
|
+
labelWidth: i.config.labelWidth || 100,
|
|
204
|
+
name: "default",
|
|
205
|
+
componentProps: {
|
|
206
|
+
layout: i.config.layout || "horizontal",
|
|
207
|
+
labelWidth: i.config.labelWidth || 100,
|
|
208
|
+
labelLayout: i.config.labelLayout === "flex" ? "fixed" : "flex",
|
|
209
|
+
labelCol: i.config.labelCol || { span: 5 },
|
|
210
|
+
wrapperCol: i.config.wrapperCol || { span: 19 },
|
|
211
|
+
hideRequiredMark: i.config.hideRequiredMark || !1,
|
|
212
|
+
colon: i.config.colon || !0,
|
|
213
|
+
labelAlign: i.config.labelAlign || "right",
|
|
214
|
+
size: i.config.size || "middle"
|
|
215
|
+
},
|
|
216
|
+
children: [],
|
|
217
|
+
id: "form_" + y()
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
componentProps: {
|
|
221
|
+
style: {
|
|
222
|
+
padding: "16px"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
script: i.script || ""
|
|
228
|
+
};
|
|
229
|
+
return e.schemas[0].children[0].children = c(i.list), e;
|
|
230
|
+
}
|
|
231
|
+
function c(i, e) {
|
|
232
|
+
return i.map((n) => {
|
|
233
|
+
var u, g, C;
|
|
234
|
+
let s = n.type ?? "";
|
|
235
|
+
const t = n.options ?? {}, o = (f, h) => {
|
|
236
|
+
s === f && (s = h, t.defaultValue && (t.defaultValue = JSON.parse(t.defaultValue)));
|
|
237
|
+
};
|
|
238
|
+
if (o("uploadImg", "upload-image"), o("uploadFile", "upload-file"), s === "date" && t.range && (t.type = "daterange", delete t.range), (s === "date" || s === "time") && (t.valueFormat = t.format), s === "textarea") {
|
|
239
|
+
const { minRows: f, maxRows: h } = t;
|
|
240
|
+
t.autoSize = { minRows: f, maxRows: h }, delete t.minRows, delete t.maxRows;
|
|
241
|
+
}
|
|
242
|
+
s === "number" && !t.precision && delete t.precision, t.width && (t.style = { width: t.width }, delete t.width), s === "grid" && (s = "row"), e && e.type === "grid" && (s = "col", t.span = n.span, n.key = y());
|
|
243
|
+
const r = {
|
|
244
|
+
label: n.label,
|
|
245
|
+
type: s,
|
|
246
|
+
icon: n.icon || "",
|
|
247
|
+
field: n.model,
|
|
248
|
+
componentProps: t,
|
|
249
|
+
id: n.key
|
|
250
|
+
};
|
|
251
|
+
return (t.noFormItem || !t.showLabel) && (r.noFormItem = !0, delete t.noFormItem, delete t.showLabel), t.clearable && (t.allowClear = !0, delete t.clearable), [
|
|
252
|
+
"input",
|
|
253
|
+
"textarea",
|
|
254
|
+
"number",
|
|
255
|
+
"password",
|
|
256
|
+
"select",
|
|
257
|
+
"cascader",
|
|
258
|
+
"checkbox",
|
|
259
|
+
"radio",
|
|
260
|
+
"date",
|
|
261
|
+
"time",
|
|
262
|
+
"slider",
|
|
263
|
+
"switch",
|
|
264
|
+
"color-picker",
|
|
265
|
+
"upload-file",
|
|
266
|
+
"upload-image"
|
|
267
|
+
].includes(s) && (r.input = !0, ((g = (u = n.rules) == null ? void 0 : u[0]) == null ? void 0 : g.required) === !1 && n.rules.shift(), ((C = n.rules) == null ? void 0 : C.length) > 0 && (r.rules = n.rules)), n.list && (r.children = c(n.list, n)), n.columns && (r.children = c(n.columns, n)), n.trs && (r.children = c(n.trs, n)), n.tds && (r.children = c(n.tds, n)), r;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
function B(i) {
|
|
271
|
+
return { all: i = i || /* @__PURE__ */ new Map(), on: function(e, n) {
|
|
272
|
+
var s = i.get(e);
|
|
273
|
+
s ? s.push(n) : i.set(e, [n]);
|
|
274
|
+
}, off: function(e, n) {
|
|
275
|
+
var s = i.get(e);
|
|
276
|
+
s && (n ? s.splice(s.indexOf(n) >>> 0, 1) : i.set(e, []));
|
|
277
|
+
}, emit: function(e, n) {
|
|
278
|
+
var s = i.get(e);
|
|
279
|
+
s && s.slice().map(function(t) {
|
|
280
|
+
t(n);
|
|
281
|
+
}), (s = i.get("*")) && s.slice().map(function(t) {
|
|
282
|
+
t(e, n);
|
|
283
|
+
});
|
|
284
|
+
} };
|
|
285
|
+
}
|
|
286
|
+
const P = B();
|
|
287
|
+
class O {
|
|
288
|
+
constructor() {
|
|
289
|
+
// 已初始化基础UI
|
|
290
|
+
l(this, "initialized", v(!1));
|
|
291
|
+
// 数据源存储
|
|
292
|
+
l(this, "sourceData", []);
|
|
293
|
+
// 组件对象字典,key 为组件type,value 为组件
|
|
294
|
+
l(this, "components", {});
|
|
295
|
+
// 组件配置记录字典,key 为组件type,value 为组件配置
|
|
296
|
+
l(this, "componentConfigs", {});
|
|
297
|
+
// 基础组件type,切换ui时,可先移除该数组记录的type
|
|
298
|
+
l(this, "baseComponentTypes", []);
|
|
299
|
+
// 组件模式分组,使用 Vue Composition API 的 ref 进行响应式处理
|
|
300
|
+
l(this, "componentSchemaGroups", v([]));
|
|
301
|
+
// 隐藏的组件列表,存储需要隐藏的组件名称
|
|
302
|
+
l(this, "hiddenComponents", []);
|
|
303
|
+
// 表单模式默认schema数据
|
|
304
|
+
l(this, "formSchemas", [
|
|
305
|
+
{
|
|
306
|
+
label: "表单",
|
|
307
|
+
type: "form",
|
|
308
|
+
componentProps: {
|
|
309
|
+
layout: "horizontal",
|
|
310
|
+
name: "default",
|
|
311
|
+
labelWidth: 100,
|
|
312
|
+
labelLayout: "fixed",
|
|
313
|
+
labelCol: {
|
|
314
|
+
span: 5
|
|
315
|
+
},
|
|
316
|
+
wrapperCol: {
|
|
317
|
+
span: 19
|
|
318
|
+
},
|
|
319
|
+
colon: !0,
|
|
320
|
+
labelAlign: "right",
|
|
321
|
+
labelPlacement: "left"
|
|
322
|
+
},
|
|
323
|
+
children: [],
|
|
324
|
+
id: "root"
|
|
325
|
+
}
|
|
326
|
+
]);
|
|
327
|
+
// 组件分组名称映射,key 为组件原名称,value 为组件分组映射名称
|
|
328
|
+
l(this, "componentGroupNameMap", {});
|
|
329
|
+
// 组件分组排序列表(设置之后,按该数组下标排序)
|
|
330
|
+
l(this, "sortedGroups", ["表单", "布局"]);
|
|
331
|
+
// 视图容器模型,包含活动栏和右侧边栏的配置
|
|
332
|
+
l(this, "viewsContainers", {
|
|
333
|
+
activitybars: w([]),
|
|
334
|
+
// 活动栏配置列表
|
|
335
|
+
rightSidebars: w([])
|
|
336
|
+
// 右侧边栏配置列表
|
|
337
|
+
});
|
|
338
|
+
// 公共方法模型,存储插件的公共方法
|
|
339
|
+
l(this, "publicMethods", {
|
|
340
|
+
// 示例数据
|
|
341
|
+
// publicTest: {
|
|
342
|
+
// describe: "测试函数",
|
|
343
|
+
// name: "test",
|
|
344
|
+
// handler: (e) => {
|
|
345
|
+
// console.log(e)
|
|
346
|
+
// // alert("测试函数弹出");
|
|
347
|
+
// },
|
|
348
|
+
// },
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* 添加组件到插件管理器中
|
|
353
|
+
* @param componentType 组件类型
|
|
354
|
+
* @param component 组件
|
|
355
|
+
*/
|
|
356
|
+
component(e, n) {
|
|
357
|
+
typeof n == "function" && (n = d(n)), this.components[e] = n;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* 注册组件到插件管理器中
|
|
361
|
+
* @param componentConfig 组件配置
|
|
362
|
+
*/
|
|
363
|
+
registerComponent(e) {
|
|
364
|
+
this.component(e.defaultSchema.type, e.component), e.defaultSchema.input && (e.config.action || (e.config.action = []), e.config.action.unshift(
|
|
365
|
+
{
|
|
366
|
+
type: "setValue",
|
|
367
|
+
describe: "设置值",
|
|
368
|
+
// 参数配置
|
|
369
|
+
argsConfigs: [
|
|
370
|
+
{
|
|
371
|
+
...e.defaultSchema,
|
|
372
|
+
label: "设置数据",
|
|
373
|
+
field: "0"
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
type: "getValue",
|
|
379
|
+
describe: "获取值"
|
|
380
|
+
}
|
|
381
|
+
)), this.componentConfigs[e.defaultSchema.type] = e, this.computedComponentSchemaGroups();
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* 从已记录的基础组件类型中移除特定类型的组件
|
|
385
|
+
* @param componentType 要移除的组件类型
|
|
386
|
+
*/
|
|
387
|
+
removeComponent(e) {
|
|
388
|
+
delete this.componentConfigs[e], delete this.components[e];
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* 设置数据源
|
|
392
|
+
* @param
|
|
393
|
+
*/
|
|
394
|
+
setSourceData(e) {
|
|
395
|
+
this.sourceData = e, P.emit("updateSource", /* @__PURE__ */ new Date());
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* 获取数据源
|
|
399
|
+
* @returns
|
|
400
|
+
*/
|
|
401
|
+
getSourceData() {
|
|
402
|
+
return Object.prototype.toString.call(this.sourceData) === "[object Array]" ? this.sourceData : [];
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* 记录基础组件类型
|
|
406
|
+
* @returns baseComponentTypes string[]
|
|
407
|
+
*/
|
|
408
|
+
setBaseComponentTypes(e) {
|
|
409
|
+
this.baseComponentTypes = e;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* 添加基础组件类型
|
|
413
|
+
* @returns baseComponentType string
|
|
414
|
+
*/
|
|
415
|
+
addBaseComponentTypes(e) {
|
|
416
|
+
this.baseComponentTypes.push(e);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* 移除已记录的基础组件类型
|
|
420
|
+
*/
|
|
421
|
+
removeBaseComponents() {
|
|
422
|
+
this.baseComponentTypes.forEach((e) => {
|
|
423
|
+
this.removeComponent(e);
|
|
424
|
+
}), this.setBaseComponentTypes([]), this.computedComponentSchemaGroups();
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* 获取所有插件管理中的所有组件
|
|
428
|
+
* @returns components
|
|
429
|
+
*/
|
|
430
|
+
getComponents() {
|
|
431
|
+
return this.components;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* 通过type 查询相应的组件
|
|
435
|
+
* @returns components
|
|
436
|
+
*/
|
|
437
|
+
getComponent(e) {
|
|
438
|
+
return this.components[e];
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* 注册或更新活动栏(Activitybar)模型。
|
|
442
|
+
* 如果模型中的组件是一个函数,则异步加载该组件。
|
|
443
|
+
* @param activitybar 要注册或更新的活动栏模型
|
|
444
|
+
*/
|
|
445
|
+
registerActivitybar(e) {
|
|
446
|
+
typeof e.component == "function" && (e.component = d(e.component)), typeof e.visible > "u" && (e.visible = !0);
|
|
447
|
+
const n = this.viewsContainers.activitybars.value.findIndex((s) => s.id === e.id);
|
|
448
|
+
n !== -1 ? this.viewsContainers.activitybars.value[n] = e : this.viewsContainers.activitybars.value.push(e);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* 获取所有activitybars
|
|
452
|
+
* @returns activitybars
|
|
453
|
+
*/
|
|
454
|
+
getActivitybars() {
|
|
455
|
+
return this.viewsContainers.activitybars.value;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* 隐藏活动栏
|
|
459
|
+
* @param value 属性
|
|
460
|
+
* @param attr 查询字段 默认值 title
|
|
461
|
+
*/
|
|
462
|
+
hideActivitybar(e, n = "title") {
|
|
463
|
+
const s = this.viewsContainers.activitybars.value.findIndex((t) => t[n] === e);
|
|
464
|
+
s !== -1 && (this.viewsContainers.activitybars.value[s].visible = !1);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* 显示活动栏
|
|
468
|
+
* @param value 属性
|
|
469
|
+
* @param attr 查询字段 默认值 title
|
|
470
|
+
*/
|
|
471
|
+
showActivitybar(e, n = "title") {
|
|
472
|
+
const s = this.viewsContainers.activitybars.value.findIndex((t) => t[n] === e);
|
|
473
|
+
s !== -1 && (this.viewsContainers.activitybars.value[s].visible = !0);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* 注册右侧栏
|
|
477
|
+
*/
|
|
478
|
+
registerRightSidebar(e) {
|
|
479
|
+
typeof e.component == "function" && (e.component = d(e.component)), typeof e.visible > "u" && (e.visible = !0);
|
|
480
|
+
const n = this.viewsContainers.rightSidebars.value.findIndex((s) => s.id === e.id);
|
|
481
|
+
n !== -1 ? this.viewsContainers.rightSidebars.value[n] = e : this.viewsContainers.rightSidebars.value.push(e);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* 获取所有rightSidebars
|
|
485
|
+
* @returns rightSidebars
|
|
486
|
+
*/
|
|
487
|
+
getRightSidebars() {
|
|
488
|
+
return this.viewsContainers.rightSidebars.value;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* 隐藏右侧边栏
|
|
492
|
+
* @param value 属性
|
|
493
|
+
* @param attr 查询字段 默认值 title
|
|
494
|
+
*/
|
|
495
|
+
hideRightSidebar(e, n = "title") {
|
|
496
|
+
const s = this.viewsContainers.rightSidebars.value.findIndex((t) => t[n] === e);
|
|
497
|
+
s !== -1 && (this.viewsContainers.rightSidebars.value[s].visible = !1);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* 显示右侧边栏
|
|
501
|
+
* @param value 属性
|
|
502
|
+
* @param attr 查询字段 默认值 title
|
|
503
|
+
*/
|
|
504
|
+
showRightSidebar(e, n = "title") {
|
|
505
|
+
const s = this.viewsContainers.rightSidebars.value.findIndex((t) => t[n] === e);
|
|
506
|
+
s !== -1 && (this.viewsContainers.rightSidebars.value[s].visible = !0);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* 获取所有插件管理中的所有组件配置
|
|
510
|
+
* @returns componentAttrs
|
|
511
|
+
*/
|
|
512
|
+
getComponentConfings() {
|
|
513
|
+
return this.componentConfigs;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* 通过type获取ComponentConfing
|
|
517
|
+
* @returns
|
|
518
|
+
*/
|
|
519
|
+
getComponentConfingByType(e) {
|
|
520
|
+
return this.componentConfigs[e];
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* 计算componentSchemaGroups
|
|
524
|
+
*/
|
|
525
|
+
computedComponentSchemaGroups() {
|
|
526
|
+
const e = [];
|
|
527
|
+
Object.values(this.componentConfigs).forEach((n) => {
|
|
528
|
+
if (!this.hiddenComponents.includes(n.defaultSchema.type) && n.groupName) {
|
|
529
|
+
const s = this.componentGroupNameMap[n.groupName] ?? n.groupName;
|
|
530
|
+
let t = e.findIndex((r) => r.title === s);
|
|
531
|
+
t === -1 && (e.push({
|
|
532
|
+
title: s,
|
|
533
|
+
list: []
|
|
534
|
+
}), t = e.length - 1);
|
|
535
|
+
let o = e[t].list.findIndex(
|
|
536
|
+
(r) => r.type === n.defaultSchema.type
|
|
537
|
+
);
|
|
538
|
+
o !== -1 ? e[t].list[o] = n.defaultSchema : e[t].list.push(n.defaultSchema);
|
|
539
|
+
}
|
|
540
|
+
}), e.sort((n, s) => {
|
|
541
|
+
const t = this.sortedGroups.indexOf(n.title), o = this.sortedGroups.indexOf(s.title);
|
|
542
|
+
return t === -1 ? 1 : o === -1 ? -1 : t - o;
|
|
543
|
+
}), e.forEach((n) => {
|
|
544
|
+
n.list.sort((s, t) => {
|
|
545
|
+
var a, u;
|
|
546
|
+
const o = ((a = this.componentConfigs[s.type]) == null ? void 0 : a.sort) ?? 1e3, r = ((u = this.componentConfigs[t.type]) == null ? void 0 : u.sort) ?? 1e3;
|
|
547
|
+
return o - r;
|
|
548
|
+
});
|
|
549
|
+
}), this.componentSchemaGroups.value = e;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* 按照分组获取componentSchemaGroups 暂时没啥用
|
|
553
|
+
* @returns componentSchemaGroups
|
|
554
|
+
*/
|
|
555
|
+
getComponentSchemaGroups() {
|
|
556
|
+
return this.componentSchemaGroups;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* 设置组件分组名称到映射名称的关系
|
|
560
|
+
* @param groupName 组件分组名称
|
|
561
|
+
* @param mapName 映射的名称
|
|
562
|
+
*/
|
|
563
|
+
setComponentGroupNameMap(e, n) {
|
|
564
|
+
this.componentGroupNameMap[e] = n;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* 清空组件分组名称到映射名称的关系
|
|
568
|
+
*/
|
|
569
|
+
clearComponentGroupNameMap() {
|
|
570
|
+
this.componentGroupNameMap = {};
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* 设置组件分组的排序
|
|
574
|
+
* @param sortedGroups 包含组名和排序字段的对象数组
|
|
575
|
+
*/
|
|
576
|
+
setSortedGroups(e) {
|
|
577
|
+
this.sortedGroups = e, this.computedComponentSchemaGroups();
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* 清空组件分组的排序
|
|
581
|
+
*/
|
|
582
|
+
clearSortedGroups() {
|
|
583
|
+
this.sortedGroups = [], this.computedComponentSchemaGroups();
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* 添加需要隐藏的组件类型
|
|
587
|
+
* @param {*} type
|
|
588
|
+
* @returns
|
|
589
|
+
*/
|
|
590
|
+
hideComponent(e) {
|
|
591
|
+
this.hiddenComponents.push(e), this.computedComponentSchemaGroups();
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* 移除需要隐藏的组件类型
|
|
595
|
+
* @param {*} type
|
|
596
|
+
* @returns
|
|
597
|
+
*/
|
|
598
|
+
showComponent(e) {
|
|
599
|
+
this.hiddenComponents = this.hiddenComponents.filter((n) => n !== e), this.computedComponentSchemaGroups();
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* 设置需要隐藏的组件类型数组
|
|
603
|
+
* @param {*} type[]
|
|
604
|
+
* @returns
|
|
605
|
+
*/
|
|
606
|
+
setHideComponents(e) {
|
|
607
|
+
this.hiddenComponents = e, this.computedComponentSchemaGroups();
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* 设置initialized的状态。
|
|
611
|
+
*
|
|
612
|
+
* @param value 要设置的布尔值。
|
|
613
|
+
*/
|
|
614
|
+
setInitialized(e) {
|
|
615
|
+
this.initialized.value = e;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* 添加公共方法
|
|
619
|
+
* @param publicMethod
|
|
620
|
+
*/
|
|
621
|
+
addPublicMethod(e) {
|
|
622
|
+
const n = e.methodName ?? e.name, s = e.method ?? e.handler;
|
|
623
|
+
this.publicMethods[n] = {
|
|
624
|
+
...e,
|
|
625
|
+
name: n,
|
|
626
|
+
handler: s
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* 移除公共方法
|
|
631
|
+
* @param methodName
|
|
632
|
+
*/
|
|
633
|
+
removePublicMethod(e) {
|
|
634
|
+
delete this.publicMethods[e];
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
const z = new O();
|
|
638
|
+
export {
|
|
639
|
+
P as E,
|
|
640
|
+
O as P,
|
|
641
|
+
m as a,
|
|
642
|
+
D as b,
|
|
643
|
+
L as c,
|
|
644
|
+
b as d,
|
|
645
|
+
V as e,
|
|
646
|
+
p as f,
|
|
647
|
+
y as g,
|
|
648
|
+
R as h,
|
|
649
|
+
N as i,
|
|
650
|
+
q as j,
|
|
651
|
+
k,
|
|
652
|
+
d as l,
|
|
653
|
+
M as m,
|
|
654
|
+
$ as n,
|
|
655
|
+
U as o,
|
|
656
|
+
z as p,
|
|
657
|
+
J as q,
|
|
658
|
+
c as r,
|
|
659
|
+
W as s
|
|
660
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var B=Object.defineProperty;var M=(s,e,n)=>e in s?B(s,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[e]=n;var l=(s,e,n)=>M(s,typeof e!="symbol"?e+"":e,n);const p=require("vue"),k=require("./index-BoL2PSBk.cjs"),h=(s,e)=>p.defineAsyncComponent({loader:s,loadingComponent:e,delay:80});function m(s=10){const e="abcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let i=0;i<s;i++){const t=Math.floor(Math.random()*e.length);n+=e[t]}return n}function F(s){return s.charAt(0).toUpperCase()+s.slice(1)}const{t:S}=k.useLocale();function d(s,e=new WeakMap){if(typeof s!="object"||s===null)return s;if(e.has(s))return e.get(s);if(Array.isArray(s)){const i=s.map(t=>d(t,e));return e.set(s,i),i}const n={};return e.set(s,n),Object.keys(s).forEach(i=>{n[i]=d(s[i],e)}),n}function P(s){const[e]=x([d(s)],n=>{var t,o;const i={...n,id:`${n.type}_${m(8)}`};return(i.field||i.input)&&!((o=(t=G.getComponentConfingByType(i.type))==null?void 0:t.editConstraints)!=null&&o.fixedField)&&(i.field=i.id),i});return e}function C(s,e,n=!0){for(const[i,t]of Object.entries(e)){let o=s==null?void 0:s[i];o&&t&&typeof o=="object"&&typeof t=="object"?(Array.isArray(o)&&!Array.isArray(t)?o=s[i]={}:!Array.isArray(o)&&Array.isArray(t)&&(o=s[i]=[]),C(o,t,n)):s[i]=t}n&&Object.keys(s).reverse().forEach(i=>{e.hasOwnProperty(i)||(Array.isArray(s)?s.splice(Number(i),1):delete s[i])})}function z(s,e,n=[],i=new WeakMap){const t=o=>{if(Array.isArray(o))return o.map(t);if(typeof o=="object"&&o!==null){if(i.has(o))return"[Circular]";i.set(o,!0);const r=Object.keys(o).sort(),a={};return r.forEach(c=>{n.includes(c)||(a[c]=t(o[c]))}),i.delete(o),a}else return o};return JSON.stringify(t(s))===JSON.stringify(t(e))}function E(s,e){const n=[];let i=!1;function t(o){if(n.push(o),o.id===e&&(i=!0),!i&&o.children!=null&&o.children.length>0)for(let r=0;r<o.children.length&&(t(o.children[r]),!i);r++);if(!i&&o.slots)for(let r in o.slots)for(let a=0;a<o.slots[r].length&&(t(o.slots[r][a]),!i);a++);i||n.pop()}return s.forEach(t),i||console.error(`没有查询到id为${e}的节点`),n}function O(s,e,n){const i=e.split(".");let t=s;for(let o=0;o<i.length;o++){if(t==null)return n;t=t[i[o]]}return t===void 0?n:t}function L(s,e,n){const i=e.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean);let t=s;for(let o=0;o<i.length-1;o++){const r=i[o];t[r]==null&&(t[r]=isNaN(Number(i[o+1]))?{}:[]),t=t[r]}return t[i[i.length-1]]=n,s}function R(s,e="default"){return b(s,e).map(i=>i.field)}function b(s,e="default"){const n=f(s,t=>{var o;return t.type==="form"&&(((o=t.componentProps)==null?void 0:o.name)??t.name===e)},!0);return f((n==null?void 0:n.children)??[],t=>!!t.input,!1,t=>t.type!=="subform")}function f(s,e,n=!1,i){const t=[],o=[...s];for(;o.length;){const r=o.pop();if(r!=null&&r.children&&(!i||i(r))&&o.push(...r.children),r!=null&&r.slots&&(!i||i(r)))for(let a in r.slots)o.push(...r.slots[a]);if(e(r)&&(t.push(r),n))return r}return n?!1:t}function x(s,e,n){const i=[...s];for(;i.length;){const t=i.pop();if(t!=null&&t.children&&(!n||n(t))&&i.push(...t.children),t!=null&&t.slots&&(!n||n(t)))for(let o in t.slots)i.push(...t.slots[o]);C(t,e(t))}return s}function T(s,e){const n=f(s,i=>i.id===e,!0);if(!n)throw new Error(`没有查询到id为${e}的节点`);return n}function D(s,e){const n=[{type:"",children:s}];let i=0,t=null;if(f(n,o=>{if(t=o.children??null,!t){if(o!=null&&o.slots)for(let r in o.slots){t=o.slots[r];for(let a=0;a<t.length;a++)if(t[a].id===e)return i=a,!0}return!1}for(let r=0;r<t.length;r++)if(t[r].id===e)return i=r,!0;return!1},!0),!t)throw new Error(`没有查询到id为${e}的节点`);return{list:t,schema:t[i],index:i}}function V(s){const e={schemas:[{type:"page",id:"root",label:S("page"),children:[{label:S("form"),type:"form",icon:"epic-icon-daibanshixiang",labelWidth:s.config.labelWidth||100,name:"default",componentProps:{layout:s.config.layout||"horizontal",labelWidth:s.config.labelWidth||100,labelLayout:s.config.labelLayout==="flex"?"fixed":"flex",labelCol:s.config.labelCol||{span:5},wrapperCol:s.config.wrapperCol||{span:19},hideRequiredMark:s.config.hideRequiredMark||!1,colon:s.config.colon||!0,labelAlign:s.config.labelAlign||"right",size:s.config.size||"middle"},children:[],id:"form_"+m()}],componentProps:{style:{padding:"16px"}}}],script:s.script||""};return e.schemas[0].children[0].children=u(s.list),e}function u(s,e){return s.map(n=>{var c,v,w;let i=n.type??"";const t=n.options??{},o=(y,g)=>{i===y&&(i=g,t.defaultValue&&(t.defaultValue=JSON.parse(t.defaultValue)))};if(o("uploadImg","upload-image"),o("uploadFile","upload-file"),i==="date"&&t.range&&(t.type="daterange",delete t.range),(i==="date"||i==="time")&&(t.valueFormat=t.format),i==="textarea"){const{minRows:y,maxRows:g}=t;t.autoSize={minRows:y,maxRows:g},delete t.minRows,delete t.maxRows}i==="number"&&!t.precision&&delete t.precision,t.width&&(t.style={width:t.width},delete t.width),i==="grid"&&(i="row"),e&&e.type==="grid"&&(i="col",t.span=n.span,n.key=m());const r={label:n.label,type:i,icon:n.icon||"",field:n.model,componentProps:t,id:n.key};return(t.noFormItem||!t.showLabel)&&(r.noFormItem=!0,delete t.noFormItem,delete t.showLabel),t.clearable&&(t.allowClear=!0,delete t.clearable),["input","textarea","number","password","select","cascader","checkbox","radio","date","time","slider","switch","color-picker","upload-file","upload-image"].includes(i)&&(r.input=!0,((v=(c=n.rules)==null?void 0:c[0])==null?void 0:v.required)===!1&&n.rules.shift(),((w=n.rules)==null?void 0:w.length)>0&&(r.rules=n.rules)),n.list&&(r.children=u(n.list,n)),n.columns&&(r.children=u(n.columns,n)),n.trs&&(r.children=u(n.trs,n)),n.tds&&(r.children=u(n.tds,n)),r})}function N(s){return{all:s=s||new Map,on:function(e,n){var i=s.get(e);i?i.push(n):s.set(e,[n])},off:function(e,n){var i=s.get(e);i&&(n?i.splice(i.indexOf(n)>>>0,1):s.set(e,[]))},emit:function(e,n){var i=s.get(e);i&&i.slice().map(function(t){t(n)}),(i=s.get("*"))&&i.slice().map(function(t){t(e,n)})}}}const A=N();class I{constructor(){l(this,"initialized",p.ref(!1));l(this,"sourceData",[]);l(this,"components",{});l(this,"componentConfigs",{});l(this,"baseComponentTypes",[]);l(this,"componentSchemaGroups",p.ref([]));l(this,"hiddenComponents",[]);l(this,"formSchemas",[{label:"表单",type:"form",componentProps:{layout:"horizontal",name:"default",labelWidth:100,labelLayout:"fixed",labelCol:{span:5},wrapperCol:{span:19},colon:!0,labelAlign:"right",labelPlacement:"left"},children:[],id:"root"}]);l(this,"componentGroupNameMap",{});l(this,"sortedGroups",["表单","布局"]);l(this,"viewsContainers",{activitybars:p.shallowRef([]),rightSidebars:p.shallowRef([])});l(this,"publicMethods",{})}component(e,n){typeof n=="function"&&(n=h(n)),this.components[e]=n}registerComponent(e){this.component(e.defaultSchema.type,e.component),e.defaultSchema.input&&(e.config.action||(e.config.action=[]),e.config.action.unshift({type:"setValue",describe:"设置值",argsConfigs:[{...e.defaultSchema,label:"设置数据",field:"0"}]},{type:"getValue",describe:"获取值"})),this.componentConfigs[e.defaultSchema.type]=e,this.computedComponentSchemaGroups()}removeComponent(e){delete this.componentConfigs[e],delete this.components[e]}setSourceData(e){this.sourceData=e,A.emit("updateSource",new Date)}getSourceData(){return Object.prototype.toString.call(this.sourceData)==="[object Array]"?this.sourceData:[]}setBaseComponentTypes(e){this.baseComponentTypes=e}addBaseComponentTypes(e){this.baseComponentTypes.push(e)}removeBaseComponents(){this.baseComponentTypes.forEach(e=>{this.removeComponent(e)}),this.setBaseComponentTypes([]),this.computedComponentSchemaGroups()}getComponents(){return this.components}getComponent(e){return this.components[e]}registerActivitybar(e){typeof e.component=="function"&&(e.component=h(e.component)),typeof e.visible>"u"&&(e.visible=!0);const n=this.viewsContainers.activitybars.value.findIndex(i=>i.id===e.id);n!==-1?this.viewsContainers.activitybars.value[n]=e:this.viewsContainers.activitybars.value.push(e)}getActivitybars(){return this.viewsContainers.activitybars.value}hideActivitybar(e,n="title"){const i=this.viewsContainers.activitybars.value.findIndex(t=>t[n]===e);i!==-1&&(this.viewsContainers.activitybars.value[i].visible=!1)}showActivitybar(e,n="title"){const i=this.viewsContainers.activitybars.value.findIndex(t=>t[n]===e);i!==-1&&(this.viewsContainers.activitybars.value[i].visible=!0)}registerRightSidebar(e){typeof e.component=="function"&&(e.component=h(e.component)),typeof e.visible>"u"&&(e.visible=!0);const n=this.viewsContainers.rightSidebars.value.findIndex(i=>i.id===e.id);n!==-1?this.viewsContainers.rightSidebars.value[n]=e:this.viewsContainers.rightSidebars.value.push(e)}getRightSidebars(){return this.viewsContainers.rightSidebars.value}hideRightSidebar(e,n="title"){const i=this.viewsContainers.rightSidebars.value.findIndex(t=>t[n]===e);i!==-1&&(this.viewsContainers.rightSidebars.value[i].visible=!1)}showRightSidebar(e,n="title"){const i=this.viewsContainers.rightSidebars.value.findIndex(t=>t[n]===e);i!==-1&&(this.viewsContainers.rightSidebars.value[i].visible=!0)}getComponentConfings(){return this.componentConfigs}getComponentConfingByType(e){return this.componentConfigs[e]}computedComponentSchemaGroups(){const e=[];Object.values(this.componentConfigs).forEach(n=>{if(!this.hiddenComponents.includes(n.defaultSchema.type)&&n.groupName){const i=this.componentGroupNameMap[n.groupName]??n.groupName;let t=e.findIndex(r=>r.title===i);t===-1&&(e.push({title:i,list:[]}),t=e.length-1);let o=e[t].list.findIndex(r=>r.type===n.defaultSchema.type);o!==-1?e[t].list[o]=n.defaultSchema:e[t].list.push(n.defaultSchema)}}),e.sort((n,i)=>{const t=this.sortedGroups.indexOf(n.title),o=this.sortedGroups.indexOf(i.title);return t===-1?1:o===-1?-1:t-o}),e.forEach(n=>{n.list.sort((i,t)=>{var a,c;const o=((a=this.componentConfigs[i.type])==null?void 0:a.sort)??1e3,r=((c=this.componentConfigs[t.type])==null?void 0:c.sort)??1e3;return o-r})}),this.componentSchemaGroups.value=e}getComponentSchemaGroups(){return this.componentSchemaGroups}setComponentGroupNameMap(e,n){this.componentGroupNameMap[e]=n}clearComponentGroupNameMap(){this.componentGroupNameMap={}}setSortedGroups(e){this.sortedGroups=e,this.computedComponentSchemaGroups()}clearSortedGroups(){this.sortedGroups=[],this.computedComponentSchemaGroups()}hideComponent(e){this.hiddenComponents.push(e),this.computedComponentSchemaGroups()}showComponent(e){this.hiddenComponents=this.hiddenComponents.filter(n=>n!==e),this.computedComponentSchemaGroups()}setHideComponents(e){this.hiddenComponents=e,this.computedComponentSchemaGroups()}setInitialized(e){this.initialized.value=e}addPublicMethod(e){const n=e.methodName??e.name,i=e.method??e.handler;this.publicMethods[n]={...e,name:n,handler:i}}removePublicMethod(e){delete this.publicMethods[e]}}const G=new I;exports.EventBus=A;exports.PluginManager=I;exports.capitalizeFirstLetter=F;exports.convertKFormData=V;exports.deepClone=d;exports.deepCompareAndModify=C;exports.deepEqual=z;exports.findSchemaById=T;exports.findSchemaInfoById=D;exports.findSchemas=f;exports.generateNewSchema=P;exports.getFormFields=R;exports.getFormSchemas=b;exports.getMatchedById=E;exports.getUUID=m;exports.getValueByPath=O;exports.loadAsyncComponent=h;exports.mapSchemas=x;exports.pluginManager=G;exports.recursionConvertedNode=u;exports.setValueByPath=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),k=require("./pluginManager-DWHAX8kP.cjs"),p=require("element-plus"),X=require("./axios-tuVKNgv9.cjs"),w=require("./index-BoL2PSBk.cjs"),Y=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),F={class:"sign-main"},O=["src"],H={class:"sign",style:{height:"100%",width:"100%"}},L=["id"],$={class:"btn"},Z={class:"btns"},G={__name:"sign",props:{componentSchema:{type:Object,require:!0,default:()=>({})},modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(T,{expose:B,emit:C}){const{t:l}=w.useLocale(),S=k.pluginManager.getComponent("button"),D=k.pluginManager.getComponent("Dialog"),E=C,o=T,d=e.inject("disabled",{value:!1});e.watch(()=>o.componentSchema,()=>{e.nextTick(()=>{h.value=o.modelValue})},{deep:!0,immediate:!0});const s=e.ref(null),i=e.ref(null),a=e.ref(),M=e.ref("");function N(){var n,t,u,g;if(i.value&&((n=i.value)!=null&&n.clientHeight)&&((t=i.value)!=null&&t.clientWidth)){if(s.value=document.getElementById(`canvas${o.componentSchema.field}`),s.value.height=((u=i.value)==null?void 0:u.clientHeight)||600,s.value.width=(g=i.value)==null?void 0:g.clientWidth,a.value=s.value.getContext("2d"),o.modelValue){let m=new Image;m.src=o.modelValue,m.setAttribute("crossOrigin","anonymous"),m.onload=()=>{a.value.fillStyle=a.value.createPattern(m,"repeat"),a.value.fillRect(0,0,1e3,550)}}a.value.lineWidth=o.componentSchema.componentProps.lineWidth||4,o.componentSchema&&o.componentSchema.componentProps&&o.componentSchema.componentProps.style&&o.componentSchema.componentProps.style.color&&(a.value.strokeStyle=o.componentSchema.componentProps.style.color),M.value=s.value.getBoundingClientRect()}}const v=e.ref(""),f=e.ref(""),q=e.ref(""),A=e.ref(""),c=e.ref([]),x=e.ref(!1);function W(n){if(d.value||o.componentSchema.componentProps.readonly||o.componentSchema.componentProps.disabled)return;n=n||event,n.preventDefault();let t={x:n.offsetX,y:n.offsetY};v.value=t.x,f.value=t.y,a.value.beginPath(),a.value.moveTo(t.x,t.y),a.value.lineTo(t.x,t.y),a.value.stroke(),a.value.closePath(),c.value.push(t),x.value=!0}function j(n){if(!(d.value||o.componentSchema.componentProps.readonly||o.componentSchema.componentProps.disabled)&&(n=n||event,n.preventDefault(),x.value)){let t={x:n.offsetX,y:n.offsetY};q.value=t.x,A.value=t.y,a.value.beginPath(),a.value.moveTo(v.value,f.value),a.value.lineTo(t.x,t.y),a.value.stroke(),a.value.closePath(),v.value=t.x,f.value=t.y,c.value.push(t)}}function R(n){if(d.value||o.componentSchema.componentProps.readonly||o.componentSchema.componentProps.disabled)return;n=n||event,n.preventDefault();let t={x:n.offsetX,y:n.offsetY};a.value.beginPath(),a.value.moveTo(v.value,f.value),a.value.lineTo(t.x,t.y),a.value.stroke(),a.value.closePath(),c.value.push(t),c.value.push({x:-1,y:-1}),x.value=!1}function P(){p.ElMessageBox.confirm(l("rewriteWillClearCanvas"),l("warning"),{confirmButtonText:l("confirm"),cancelButtonText:l("cancel"),type:"warning"}).then(()=>{a.value.clearRect(0,0,s.value.width,s.value.height),c.value=[],p.ElMessage({type:"info",message:l("clearSuccess")})}).catch(()=>{})}const h=e.ref("");async function b(){let n=await z(s.value.toDataURL("image/png"));h.value=n,E("update:modelValue",n)}async function z(n){try{let t=atob(n.split(",")[1]),u=new ArrayBuffer(t.length),g=new Uint8Array(u);for(let y=0;y<t.length;y++)g[y]=t.charCodeAt(y);let m=new Blob([u],{type:"image/png"}),V=new FormData;V.append("file",m,Date.now()+"png");let U=await X.axios({method:"post",url:"https://ess-ds.com/prod-api/center-file/file/upload",data:V,headers:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+w.api.get("Admin-Token"),lang:w.api.get("saas-locale")||"zh-CN",zone:Intl.DateTimeFormat().resolvedOptions().timeZone}});return p.ElMessage({type:"success",message:l("uploadSuccess")}),U.data.data.url}catch{p.ElMessage({type:"warning",message:l("uploadFailed")}),r.value=!1}finally{r.value=!1}}const r=e.ref(!1);function I(){p.ElMessageBox.confirm(l("confirmAbandonSignature"),l("warning"),{confirmButtonText:l("confirm"),cancelButtonText:l("cancel"),type:"warning"}).then(()=>{a.value.clearRect(0,0,s.value.width,s.value.height),c.value=[],r.value=!1}).catch(()=>!1)}function _(){d.value||o.componentSchema.componentProps.readonly||o.componentSchema.componentProps.disabled||(r.value=!0,a.value&&(a.value.clearRect(0,0,s.value.width,s.value.height),c.value=[]),e.nextTick(()=>{N()}))}return e.onMounted(()=>{}),e.onUnmounted(()=>{}),B({surewrite:b}),(n,t)=>(e.openBlock(),e.createElementBlock("div",F,[h.value?(e.openBlock(),e.createElementBlock("img",{key:1,class:"sign-board",src:h.value,alt:"",onClick:_},null,8,O)):(e.openBlock(),e.createElementBlock("div",{key:0,class:"sign-board",onClick:_},e.toDisplayString(e.unref(l)("signaturePad")),1)),e.createVNode(e.unref(D),{modelValue:r.value,"onUpdate:modelValue":t[0]||(t[0]=u=>r.value=u),title:e.unref(l)("signaturePad"),class:"w-860px",width:"860px",style:{height:"600px"},"before-close":I,draggable:!1,modal:""},{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createElementVNode("div",{class:"canvas",ref_key:"canvasWrap",ref:i},[e.createElementVNode("canvas",{id:`canvas${o.componentSchema.field}`,onMousedown:W,onMousemove:j,onMouseup:R},null,40,L)],512),e.createElementVNode("div",$,[t[1]||(t[1]=e.createElementVNode("div",{class:"remark"},null,-1)),e.createElementVNode("div",Z,[e.createVNode(e.unref(S),{type:"info",size:"mini",onClick:P,onTouch:P},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("rewrite")),1)]),_:1}),e.createVNode(e.unref(S),{type:"primary",size:"mini",onClick:b,onTouch:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("confirm")),1)]),_:1})])])])]),_:1},8,["modelValue","title"])]))}},J=Y._export_sfc(G,[["__scopeId","data-v-4e3b1b32"]]);exports.default=J;
|