gbformdesign 0.1.0 → 0.1.1
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/LICENSE +21 -21
- package/README.md +84 -84
- package/dist/gbformdesign.css +1 -1
- package/dist/gbformdesign.js +1146 -1051
- package/dist/gbformdesign.js.map +1 -1
- package/dist/gbformdesign.umd.cjs +6 -6
- package/dist/gbformdesign.umd.cjs.map +1 -1
- package/package.json +58 -57
- package/src/core/FormVariable.js +328 -328
- package/src/core/dynamicFormUtils.js +139 -139
- package/src/core/fileIO.js +90 -90
- package/src/core/formVariableTypeSystem.js +327 -327
- package/src/core/index.js +26 -26
- package/src/core/schema.js +192 -192
- package/src/design/composables/useDefaultValue.js +55 -55
- package/src/design/constants/componentTemplates.js +181 -190
- package/src/design/constants/componentTypes.js +70 -70
- package/src/design/utils/componentUtils.js +75 -75
- package/src/designer/fc/FcCanvasField.vue +277 -276
- package/src/designer/fc/FcJsonPanel.vue +113 -113
- package/src/designer/fc/FcPreviewDialog.vue +62 -62
- package/src/designer/fc/FcPropsPanel.vue +373 -373
- package/src/designer/fc/FormDesigner.vue +633 -633
- package/src/designer/fc/codegen.js +120 -120
- package/src/index.js +48 -48
- package/src/styles/config.scss +102 -102
- package/src/styles/fc/designer.css +837 -837
- package/src/styles/fc/icon.css +1053 -1053
- package/src/styles/index.scss +4 -4
- package/src/view/FormField.vue +301 -301
- package/src/view/FormViewer.vue +216 -216
- package/src/view/composables/useFormValidation.js +201 -201
package/dist/gbformdesign.js
CHANGED
|
@@ -1,7 +1,138 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { ElMessage as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { defineComponent as ge, h as ee, computed as B, onMounted as st, resolveComponent as N, openBlock as f, createElementBlock as w, unref as C, createVNode as m, withCtx as y, Fragment as z, renderList as G, createBlock as k, createElementVNode as s, createTextVNode as Y, toDisplayString as se, createCommentVNode as W, inject as Ye, withModifiers as X, normalizeClass as U, ref as P, watch as ke, withDirectives as me, vShow as be, vModelText as Ct, reactive as Ne, normalizeStyle as kt, provide as Ie, nextTick as Vt } from "vue";
|
|
2
|
+
import { ElMessage as ae } from "element-plus";
|
|
3
|
+
const St = [["path", { d: "M18 6l-12 12" }], ["path", { d: "M6 6l12 12" }]], Dt = ge({
|
|
4
|
+
name: "Close",
|
|
5
|
+
props: {
|
|
6
|
+
size: { type: [Number, String], default: void 0 },
|
|
7
|
+
strokeWidth: { type: [Number, String], default: void 0 }
|
|
8
|
+
},
|
|
9
|
+
setup: (e, { attrs: l }) => () => ee(
|
|
10
|
+
"svg",
|
|
11
|
+
{
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
fill: "none",
|
|
15
|
+
stroke: "currentColor",
|
|
16
|
+
"stroke-width": Number(e.strokeWidth ?? 2),
|
|
17
|
+
"stroke-linecap": "round",
|
|
18
|
+
"stroke-linejoin": "round",
|
|
19
|
+
width: e.size == null ? "1em" : `${e.size}px`,
|
|
20
|
+
height: e.size == null ? "1em" : `${e.size}px`,
|
|
21
|
+
...l
|
|
22
|
+
},
|
|
23
|
+
St.map(([t, n]) => ee(t, n))
|
|
24
|
+
)
|
|
25
|
+
}), It = [["path", { d: "M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666" }], ["path", { d: "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" }]], $t = ge({
|
|
26
|
+
name: "CopyDocument",
|
|
27
|
+
props: {
|
|
28
|
+
size: { type: [Number, String], default: void 0 },
|
|
29
|
+
strokeWidth: { type: [Number, String], default: void 0 }
|
|
30
|
+
},
|
|
31
|
+
setup: (e, { attrs: l }) => () => ee(
|
|
32
|
+
"svg",
|
|
33
|
+
{
|
|
34
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
+
viewBox: "0 0 24 24",
|
|
36
|
+
fill: "none",
|
|
37
|
+
stroke: "currentColor",
|
|
38
|
+
"stroke-width": Number(e.strokeWidth ?? 2),
|
|
39
|
+
"stroke-linecap": "round",
|
|
40
|
+
"stroke-linejoin": "round",
|
|
41
|
+
width: e.size == null ? "1em" : `${e.size}px`,
|
|
42
|
+
height: e.size == null ? "1em" : `${e.size}px`,
|
|
43
|
+
...l
|
|
44
|
+
},
|
|
45
|
+
It.map(([t, n]) => ee(t, n))
|
|
46
|
+
)
|
|
47
|
+
}), xt = [["path", { d: "M4 7l16 0" }], ["path", { d: "M10 11l0 6" }], ["path", { d: "M14 11l0 6" }], ["path", { d: "M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12" }], ["path", { d: "M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3" }]], Ke = ge({
|
|
48
|
+
name: "Delete",
|
|
49
|
+
props: {
|
|
50
|
+
size: { type: [Number, String], default: void 0 },
|
|
51
|
+
strokeWidth: { type: [Number, String], default: void 0 }
|
|
52
|
+
},
|
|
53
|
+
setup: (e, { attrs: l }) => () => ee(
|
|
54
|
+
"svg",
|
|
55
|
+
{
|
|
56
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
57
|
+
viewBox: "0 0 24 24",
|
|
58
|
+
fill: "none",
|
|
59
|
+
stroke: "currentColor",
|
|
60
|
+
"stroke-width": Number(e.strokeWidth ?? 2),
|
|
61
|
+
"stroke-linecap": "round",
|
|
62
|
+
"stroke-linejoin": "round",
|
|
63
|
+
width: e.size == null ? "1em" : `${e.size}px`,
|
|
64
|
+
height: e.size == null ? "1em" : `${e.size}px`,
|
|
65
|
+
...l
|
|
66
|
+
},
|
|
67
|
+
xt.map(([t, n]) => ee(t, n))
|
|
68
|
+
)
|
|
69
|
+
}), Ut = [["path", { d: "M5 12h14" }], ["path", { d: "M12 5v14" }]], Qe = ge({
|
|
70
|
+
name: "Plus",
|
|
71
|
+
props: {
|
|
72
|
+
size: { type: [Number, String], default: void 0 },
|
|
73
|
+
strokeWidth: { type: [Number, String], default: void 0 }
|
|
74
|
+
},
|
|
75
|
+
setup: (e, { attrs: l }) => () => ee(
|
|
76
|
+
"svg",
|
|
77
|
+
{
|
|
78
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
fill: "none",
|
|
81
|
+
stroke: "currentColor",
|
|
82
|
+
"stroke-width": Number(e.strokeWidth ?? 2),
|
|
83
|
+
"stroke-linecap": "round",
|
|
84
|
+
"stroke-linejoin": "round",
|
|
85
|
+
width: e.size == null ? "1em" : `${e.size}px`,
|
|
86
|
+
height: e.size == null ? "1em" : `${e.size}px`,
|
|
87
|
+
...l
|
|
88
|
+
},
|
|
89
|
+
Ut.map(([t, n]) => ee(t, n))
|
|
90
|
+
)
|
|
91
|
+
}), Pt = [["path", { d: "M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }], ["path", { d: "M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }], ["path", { d: "M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }], ["path", { d: "M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }], ["path", { d: "M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }], ["path", { d: "M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }]], Mt = ge({
|
|
92
|
+
name: "Rank",
|
|
93
|
+
props: {
|
|
94
|
+
size: { type: [Number, String], default: void 0 },
|
|
95
|
+
strokeWidth: { type: [Number, String], default: void 0 }
|
|
96
|
+
},
|
|
97
|
+
setup: (e, { attrs: l }) => () => ee(
|
|
98
|
+
"svg",
|
|
99
|
+
{
|
|
100
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
101
|
+
viewBox: "0 0 24 24",
|
|
102
|
+
fill: "none",
|
|
103
|
+
stroke: "currentColor",
|
|
104
|
+
"stroke-width": Number(e.strokeWidth ?? 2),
|
|
105
|
+
"stroke-linecap": "round",
|
|
106
|
+
"stroke-linejoin": "round",
|
|
107
|
+
width: e.size == null ? "1em" : `${e.size}px`,
|
|
108
|
+
height: e.size == null ? "1em" : `${e.size}px`,
|
|
109
|
+
...l
|
|
110
|
+
},
|
|
111
|
+
Pt.map(([t, n]) => ee(t, n))
|
|
112
|
+
)
|
|
113
|
+
}), Lt = [["path", { d: "M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2" }], ["path", { d: "M7 9l5 -5l5 5" }], ["path", { d: "M12 4l0 12" }]], Ft = ge({
|
|
114
|
+
name: "Upload",
|
|
115
|
+
props: {
|
|
116
|
+
size: { type: [Number, String], default: void 0 },
|
|
117
|
+
strokeWidth: { type: [Number, String], default: void 0 }
|
|
118
|
+
},
|
|
119
|
+
setup: (e, { attrs: l }) => () => ee(
|
|
120
|
+
"svg",
|
|
121
|
+
{
|
|
122
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
123
|
+
viewBox: "0 0 24 24",
|
|
124
|
+
fill: "none",
|
|
125
|
+
stroke: "currentColor",
|
|
126
|
+
"stroke-width": Number(e.strokeWidth ?? 2),
|
|
127
|
+
"stroke-linecap": "round",
|
|
128
|
+
"stroke-linejoin": "round",
|
|
129
|
+
width: e.size == null ? "1em" : `${e.size}px`,
|
|
130
|
+
height: e.size == null ? "1em" : `${e.size}px`,
|
|
131
|
+
...l
|
|
132
|
+
},
|
|
133
|
+
Lt.map(([t, n]) => ee(t, n))
|
|
134
|
+
)
|
|
135
|
+
}), d = {
|
|
5
136
|
INPUT: "input",
|
|
6
137
|
TEXTAREA: "textarea",
|
|
7
138
|
INPUT_NUMBER: "input-number",
|
|
@@ -12,7 +143,7 @@ const d = {
|
|
|
12
143
|
DATE_PICKER: "date-picker",
|
|
13
144
|
ROW: "row",
|
|
14
145
|
BUTTON: "button"
|
|
15
|
-
},
|
|
146
|
+
}, zt = {
|
|
16
147
|
[d.INPUT]: "文本输入框",
|
|
17
148
|
[d.TEXTAREA]: "多行文本",
|
|
18
149
|
[d.INPUT_NUMBER]: "数字输入框",
|
|
@@ -23,16 +154,16 @@ const d = {
|
|
|
23
154
|
[d.DATE_PICKER]: "日期选择器",
|
|
24
155
|
[d.ROW]: "分栏",
|
|
25
156
|
[d.BUTTON]: "按钮"
|
|
26
|
-
},
|
|
157
|
+
}, Xe = [
|
|
27
158
|
d.RADIO_GROUP,
|
|
28
159
|
d.CHECKBOX_GROUP,
|
|
29
160
|
d.SELECT
|
|
30
|
-
],
|
|
161
|
+
], Jn = {
|
|
31
162
|
FULL: 100,
|
|
32
163
|
HALF: 50,
|
|
33
164
|
THIRD: 33.33,
|
|
34
165
|
QUARTER: 25
|
|
35
|
-
},
|
|
166
|
+
}, Yn = {
|
|
36
167
|
MIN_NUMBER: 1,
|
|
37
168
|
MAX_NUMBER: 100,
|
|
38
169
|
DEFAULT_GUTTER: 20,
|
|
@@ -42,17 +173,17 @@ const d = {
|
|
|
42
173
|
MIN_WIDTH: 10,
|
|
43
174
|
MAX_WIDTH: 100,
|
|
44
175
|
WIDTH_STEP: 5
|
|
45
|
-
},
|
|
176
|
+
}, Ze = {
|
|
46
177
|
TODAY: "today",
|
|
47
178
|
TOMORROW: "tomorrow"
|
|
48
179
|
};
|
|
49
|
-
function
|
|
180
|
+
function Ae() {
|
|
50
181
|
return `component_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
51
182
|
}
|
|
52
|
-
function
|
|
53
|
-
return e.id || (e.id =
|
|
183
|
+
function it(e) {
|
|
184
|
+
return e.id || (e.id = Ae()), e;
|
|
54
185
|
}
|
|
55
|
-
function
|
|
186
|
+
function xe(e) {
|
|
56
187
|
if (e == null || e === "")
|
|
57
188
|
return null;
|
|
58
189
|
const l = Number(e);
|
|
@@ -61,42 +192,42 @@ function De(e) {
|
|
|
61
192
|
function rt(e) {
|
|
62
193
|
return e == null || e === "";
|
|
63
194
|
}
|
|
64
|
-
function
|
|
195
|
+
function jt(e) {
|
|
65
196
|
return Array.isArray(e) ? e.map((l) => typeof l == "string" ? { label: l, value: l } : { ...l }) : [];
|
|
66
197
|
}
|
|
67
|
-
function
|
|
198
|
+
function Gt(e, l = 100) {
|
|
68
199
|
if (e == null)
|
|
69
200
|
return l;
|
|
70
201
|
if (typeof e == "number")
|
|
71
202
|
return e;
|
|
72
|
-
const t = String(e).replace("%", ""),
|
|
73
|
-
return isNaN(
|
|
203
|
+
const t = String(e).replace("%", ""), n = parseFloat(t);
|
|
204
|
+
return isNaN(n) ? l : n;
|
|
74
205
|
}
|
|
75
206
|
function Z(e) {
|
|
76
207
|
return e.props?.variableName || `field_${e.id || Date.now()}`;
|
|
77
208
|
}
|
|
78
|
-
const
|
|
209
|
+
const et = (e) => {
|
|
79
210
|
const l = e.defaultValue;
|
|
80
211
|
if (rt(l)) return null;
|
|
81
212
|
if (e.type === d.DATE_PICKER) {
|
|
82
|
-
if (l ===
|
|
213
|
+
if (l === Ze.TODAY)
|
|
83
214
|
return /* @__PURE__ */ new Date();
|
|
84
|
-
if (l ===
|
|
215
|
+
if (l === Ze.TOMORROW) {
|
|
85
216
|
const t = /* @__PURE__ */ new Date();
|
|
86
217
|
return t.setDate(t.getDate() + 1), t;
|
|
87
218
|
}
|
|
88
219
|
return null;
|
|
89
220
|
}
|
|
90
|
-
return e.type === d.INPUT_NUMBER ?
|
|
91
|
-
},
|
|
221
|
+
return e.type === d.INPUT_NUMBER ? xe(l) : e.type === d.CHECKBOX_GROUP ? Array.isArray(l) ? [...l] : [] : l;
|
|
222
|
+
}, ut = (e, l) => {
|
|
92
223
|
const t = e.__vccOpts || e;
|
|
93
|
-
for (const [
|
|
94
|
-
t[
|
|
224
|
+
for (const [n, u] of l)
|
|
225
|
+
t[n] = u;
|
|
95
226
|
return t;
|
|
96
|
-
},
|
|
227
|
+
}, Wt = { class: "form-viewer" }, Bt = {
|
|
97
228
|
key: 0,
|
|
98
229
|
class: "row-container"
|
|
99
|
-
},
|
|
230
|
+
}, Ht = { class: "column-wrapper" }, qt = /* @__PURE__ */ Object.assign({ name: "FormField" }, {
|
|
100
231
|
__name: "FormField",
|
|
101
232
|
props: {
|
|
102
233
|
component: {
|
|
@@ -118,47 +249,47 @@ const Xe = (e) => {
|
|
|
118
249
|
},
|
|
119
250
|
emits: ["update:value"],
|
|
120
251
|
setup(e, { emit: l }) {
|
|
121
|
-
const t = e,
|
|
122
|
-
|
|
252
|
+
const t = e, n = l, u = B(() => Z(t.component));
|
|
253
|
+
st(() => {
|
|
123
254
|
if (!(u.value in t.formData)) {
|
|
124
|
-
const
|
|
125
|
-
|
|
255
|
+
const i = et(t.component);
|
|
256
|
+
i != null ? t.formData[u.value] = i : t.component.type === d.INPUT_NUMBER ? t.formData[u.value] = null : t.component.type === d.RADIO_GROUP || t.component.type === d.SELECT || t.component.type === d.TEXTAREA ? t.formData[u.value] = "" : t.component.type === d.DATE_PICKER ? t.formData[u.value] = null : t.component.type === d.CHECKBOX_GROUP ? t.formData[u.value] = [] : t.component.type === d.SWITCH ? t.formData[u.value] = !1 : t.formData[u.value] = "";
|
|
126
257
|
}
|
|
127
258
|
});
|
|
128
|
-
const
|
|
259
|
+
const r = B({
|
|
129
260
|
get() {
|
|
130
|
-
let
|
|
261
|
+
let i = t.formData[u.value];
|
|
131
262
|
if (t.component.type === d.INPUT_NUMBER)
|
|
132
|
-
return
|
|
133
|
-
if (rt(
|
|
134
|
-
const h =
|
|
263
|
+
return xe(i);
|
|
264
|
+
if (rt(i) && t.component.defaultValue !== void 0 && t.component.defaultValue !== null) {
|
|
265
|
+
const h = et(t.component);
|
|
135
266
|
if (h != null)
|
|
136
267
|
return h;
|
|
137
268
|
}
|
|
138
|
-
return
|
|
269
|
+
return i;
|
|
139
270
|
},
|
|
140
|
-
set(
|
|
141
|
-
t.component.type === d.INPUT_NUMBER ? t.formData[u.value] =
|
|
271
|
+
set(i) {
|
|
272
|
+
t.component.type === d.INPUT_NUMBER ? t.formData[u.value] = xe(i) : t.component.type === d.CHECKBOX_GROUP ? t.formData[u.value] = Array.isArray(i) ? [...i] : [] : t.component.type === d.SWITCH ? t.formData[u.value] = i === !0 : t.formData[u.value] = i, n("update:value", u.value, t.formData[u.value]);
|
|
142
273
|
}
|
|
143
|
-
}), p = (
|
|
144
|
-
|
|
274
|
+
}), p = (i) => {
|
|
275
|
+
n("update:value", u.value, i);
|
|
145
276
|
};
|
|
146
|
-
return (
|
|
147
|
-
const b =
|
|
148
|
-
return
|
|
149
|
-
e.component.type ===
|
|
150
|
-
|
|
277
|
+
return (i, h) => {
|
|
278
|
+
const b = N("FormField", !0), O = N("el-col"), I = N("el-row"), _ = N("el-input"), V = N("el-form-item"), D = N("el-input-number"), A = N("el-radio"), S = N("el-radio-group"), x = N("el-option"), ne = N("el-select"), ie = N("el-checkbox"), K = N("el-checkbox-group"), q = N("el-switch"), E = N("el-date-picker");
|
|
279
|
+
return f(), w("div", Wt, [
|
|
280
|
+
e.component.type === C(d).ROW ? (f(), w("div", Bt, [
|
|
281
|
+
m(I, {
|
|
151
282
|
gutter: e.component.props?.gutter || 20
|
|
152
283
|
}, {
|
|
153
284
|
default: y(() => [
|
|
154
|
-
(
|
|
285
|
+
(f(!0), w(z, null, G(e.component.props?.columns || [], (o, Q) => (f(), k(O, {
|
|
155
286
|
key: Q,
|
|
156
|
-
span:
|
|
287
|
+
span: o.span || 12
|
|
157
288
|
}, {
|
|
158
289
|
default: y(() => [
|
|
159
|
-
|
|
160
|
-
(
|
|
161
|
-
key:
|
|
290
|
+
s("div", Ht, [
|
|
291
|
+
(f(!0), w(z, null, G(e.component.children?.[Q] || [], (F, te) => (f(), k(b, {
|
|
292
|
+
key: te,
|
|
162
293
|
component: F,
|
|
163
294
|
"form-data": e.formData,
|
|
164
295
|
"form-rules": e.formRules,
|
|
@@ -171,16 +302,16 @@ const Xe = (e) => {
|
|
|
171
302
|
]),
|
|
172
303
|
_: 1
|
|
173
304
|
}, 8, ["gutter"])
|
|
174
|
-
])) : e.component.type ===
|
|
305
|
+
])) : e.component.type === C(d).INPUT ? (f(), k(V, {
|
|
175
306
|
key: 1,
|
|
176
307
|
label: e.component.props?.label || "",
|
|
177
|
-
prop:
|
|
308
|
+
prop: C(Z)(e.component),
|
|
178
309
|
required: e.component.required
|
|
179
310
|
}, {
|
|
180
311
|
default: y(() => [
|
|
181
|
-
|
|
182
|
-
modelValue:
|
|
183
|
-
"onUpdate:modelValue": h[0] || (h[0] = (
|
|
312
|
+
m(_, {
|
|
313
|
+
modelValue: r.value,
|
|
314
|
+
"onUpdate:modelValue": h[0] || (h[0] = (o) => r.value = o),
|
|
184
315
|
placeholder: e.component.props?.placeholder || "请输入文本",
|
|
185
316
|
style: { width: "100%" },
|
|
186
317
|
disabled: e.readonly,
|
|
@@ -188,16 +319,16 @@ const Xe = (e) => {
|
|
|
188
319
|
}, null, 8, ["modelValue", "placeholder", "disabled"])
|
|
189
320
|
]),
|
|
190
321
|
_: 1
|
|
191
|
-
}, 8, ["label", "prop", "required"])) : e.component.type ===
|
|
322
|
+
}, 8, ["label", "prop", "required"])) : e.component.type === C(d).TEXTAREA ? (f(), k(V, {
|
|
192
323
|
key: 2,
|
|
193
324
|
label: e.component.props?.label || "",
|
|
194
|
-
prop:
|
|
325
|
+
prop: C(Z)(e.component),
|
|
195
326
|
required: e.component.required
|
|
196
327
|
}, {
|
|
197
328
|
default: y(() => [
|
|
198
|
-
|
|
199
|
-
modelValue:
|
|
200
|
-
"onUpdate:modelValue": h[1] || (h[1] = (
|
|
329
|
+
m(_, {
|
|
330
|
+
modelValue: r.value,
|
|
331
|
+
"onUpdate:modelValue": h[1] || (h[1] = (o) => r.value = o),
|
|
201
332
|
type: "textarea",
|
|
202
333
|
rows: e.component.props?.rows || 3,
|
|
203
334
|
placeholder: e.component.props?.placeholder || "请输入内容",
|
|
@@ -207,16 +338,16 @@ const Xe = (e) => {
|
|
|
207
338
|
}, null, 8, ["modelValue", "rows", "placeholder", "disabled"])
|
|
208
339
|
]),
|
|
209
340
|
_: 1
|
|
210
|
-
}, 8, ["label", "prop", "required"])) : e.component.type ===
|
|
341
|
+
}, 8, ["label", "prop", "required"])) : e.component.type === C(d).INPUT_NUMBER ? (f(), k(V, {
|
|
211
342
|
key: 3,
|
|
212
343
|
label: e.component.props?.label || "",
|
|
213
|
-
prop:
|
|
344
|
+
prop: C(Z)(e.component),
|
|
214
345
|
required: e.component.required
|
|
215
346
|
}, {
|
|
216
347
|
default: y(() => [
|
|
217
|
-
|
|
218
|
-
modelValue:
|
|
219
|
-
"onUpdate:modelValue": h[2] || (h[2] = (
|
|
348
|
+
m(D, {
|
|
349
|
+
modelValue: r.value,
|
|
350
|
+
"onUpdate:modelValue": h[2] || (h[2] = (o) => r.value = o),
|
|
220
351
|
min: e.component.min || 1,
|
|
221
352
|
max: e.component.max || 100,
|
|
222
353
|
style: { width: "100%" },
|
|
@@ -225,27 +356,27 @@ const Xe = (e) => {
|
|
|
225
356
|
}, null, 8, ["modelValue", "min", "max", "disabled"])
|
|
226
357
|
]),
|
|
227
358
|
_: 1
|
|
228
|
-
}, 8, ["label", "prop", "required"])) : e.component.type ===
|
|
359
|
+
}, 8, ["label", "prop", "required"])) : e.component.type === C(d).RADIO_GROUP ? (f(), k(V, {
|
|
229
360
|
key: 4,
|
|
230
361
|
label: e.component.props?.label || "",
|
|
231
|
-
prop:
|
|
362
|
+
prop: C(Z)(e.component),
|
|
232
363
|
required: e.component.required
|
|
233
364
|
}, {
|
|
234
365
|
default: y(() => [
|
|
235
|
-
|
|
236
|
-
modelValue:
|
|
237
|
-
"onUpdate:modelValue": h[3] || (h[3] = (
|
|
366
|
+
m(S, {
|
|
367
|
+
modelValue: r.value,
|
|
368
|
+
"onUpdate:modelValue": h[3] || (h[3] = (o) => r.value = o),
|
|
238
369
|
style: { width: "100%" },
|
|
239
370
|
disabled: e.readonly,
|
|
240
371
|
onChange: p
|
|
241
372
|
}, {
|
|
242
373
|
default: y(() => [
|
|
243
|
-
(
|
|
244
|
-
key:
|
|
245
|
-
value:
|
|
374
|
+
(f(!0), w(z, null, G(e.component.props?.options || ["选项1", "选项2", "选项3"], (o) => (f(), k(A, {
|
|
375
|
+
key: o.value || o,
|
|
376
|
+
value: o.value || o
|
|
246
377
|
}, {
|
|
247
378
|
default: y(() => [
|
|
248
|
-
Y(
|
|
379
|
+
Y(se(o.label || o), 1)
|
|
249
380
|
]),
|
|
250
381
|
_: 2
|
|
251
382
|
}, 1032, ["value"]))), 128))
|
|
@@ -254,53 +385,53 @@ const Xe = (e) => {
|
|
|
254
385
|
}, 8, ["modelValue", "disabled"])
|
|
255
386
|
]),
|
|
256
387
|
_: 1
|
|
257
|
-
}, 8, ["label", "prop", "required"])) : e.component.type ===
|
|
388
|
+
}, 8, ["label", "prop", "required"])) : e.component.type === C(d).SELECT ? (f(), k(V, {
|
|
258
389
|
key: 5,
|
|
259
390
|
label: e.component.props?.label || "",
|
|
260
|
-
prop:
|
|
391
|
+
prop: C(Z)(e.component),
|
|
261
392
|
required: e.component.required
|
|
262
393
|
}, {
|
|
263
394
|
default: y(() => [
|
|
264
|
-
|
|
265
|
-
modelValue:
|
|
266
|
-
"onUpdate:modelValue": h[4] || (h[4] = (
|
|
395
|
+
m(ne, {
|
|
396
|
+
modelValue: r.value,
|
|
397
|
+
"onUpdate:modelValue": h[4] || (h[4] = (o) => r.value = o),
|
|
267
398
|
placeholder: e.component.props?.placeholder || "请选择",
|
|
268
399
|
style: { width: "100%" },
|
|
269
400
|
disabled: e.readonly,
|
|
270
401
|
onChange: p
|
|
271
402
|
}, {
|
|
272
403
|
default: y(() => [
|
|
273
|
-
(
|
|
274
|
-
key:
|
|
275
|
-
label:
|
|
276
|
-
value:
|
|
404
|
+
(f(!0), w(z, null, G(e.component.props?.options || [], (o) => (f(), k(x, {
|
|
405
|
+
key: o.value || o,
|
|
406
|
+
label: o.label || o,
|
|
407
|
+
value: o.value || o
|
|
277
408
|
}, null, 8, ["label", "value"]))), 128))
|
|
278
409
|
]),
|
|
279
410
|
_: 1
|
|
280
411
|
}, 8, ["modelValue", "placeholder", "disabled"])
|
|
281
412
|
]),
|
|
282
413
|
_: 1
|
|
283
|
-
}, 8, ["label", "prop", "required"])) : e.component.type ===
|
|
414
|
+
}, 8, ["label", "prop", "required"])) : e.component.type === C(d).CHECKBOX_GROUP ? (f(), k(V, {
|
|
284
415
|
key: 6,
|
|
285
416
|
label: e.component.props?.label || "",
|
|
286
|
-
prop:
|
|
417
|
+
prop: C(Z)(e.component),
|
|
287
418
|
required: e.component.required
|
|
288
419
|
}, {
|
|
289
420
|
default: y(() => [
|
|
290
|
-
|
|
291
|
-
modelValue:
|
|
292
|
-
"onUpdate:modelValue": h[5] || (h[5] = (
|
|
421
|
+
m(K, {
|
|
422
|
+
modelValue: r.value,
|
|
423
|
+
"onUpdate:modelValue": h[5] || (h[5] = (o) => r.value = o),
|
|
293
424
|
style: { width: "100%" },
|
|
294
425
|
disabled: e.readonly,
|
|
295
426
|
onChange: p
|
|
296
427
|
}, {
|
|
297
428
|
default: y(() => [
|
|
298
|
-
(
|
|
299
|
-
key:
|
|
300
|
-
value:
|
|
429
|
+
(f(!0), w(z, null, G(e.component.props?.options || [], (o) => (f(), k(ie, {
|
|
430
|
+
key: o.value || o,
|
|
431
|
+
value: o.value || o
|
|
301
432
|
}, {
|
|
302
433
|
default: y(() => [
|
|
303
|
-
Y(
|
|
434
|
+
Y(se(o.label || o), 1)
|
|
304
435
|
]),
|
|
305
436
|
_: 2
|
|
306
437
|
}, 1032, ["value"]))), 128))
|
|
@@ -309,16 +440,16 @@ const Xe = (e) => {
|
|
|
309
440
|
}, 8, ["modelValue", "disabled"])
|
|
310
441
|
]),
|
|
311
442
|
_: 1
|
|
312
|
-
}, 8, ["label", "prop", "required"])) : e.component.type ===
|
|
443
|
+
}, 8, ["label", "prop", "required"])) : e.component.type === C(d).SWITCH ? (f(), k(V, {
|
|
313
444
|
key: 7,
|
|
314
445
|
label: e.component.props?.label || "",
|
|
315
|
-
prop:
|
|
446
|
+
prop: C(Z)(e.component),
|
|
316
447
|
required: e.component.required
|
|
317
448
|
}, {
|
|
318
449
|
default: y(() => [
|
|
319
|
-
|
|
320
|
-
modelValue:
|
|
321
|
-
"onUpdate:modelValue": h[6] || (h[6] = (
|
|
450
|
+
m(q, {
|
|
451
|
+
modelValue: r.value,
|
|
452
|
+
"onUpdate:modelValue": h[6] || (h[6] = (o) => r.value = o),
|
|
322
453
|
"active-text": e.component.props?.activeText || "",
|
|
323
454
|
"inactive-text": e.component.props?.inactiveText || "",
|
|
324
455
|
disabled: e.readonly,
|
|
@@ -326,16 +457,16 @@ const Xe = (e) => {
|
|
|
326
457
|
}, null, 8, ["modelValue", "active-text", "inactive-text", "disabled"])
|
|
327
458
|
]),
|
|
328
459
|
_: 1
|
|
329
|
-
}, 8, ["label", "prop", "required"])) : e.component.type ===
|
|
460
|
+
}, 8, ["label", "prop", "required"])) : e.component.type === C(d).DATE_PICKER ? (f(), k(V, {
|
|
330
461
|
key: 8,
|
|
331
462
|
label: e.component.props?.label || "",
|
|
332
|
-
prop:
|
|
463
|
+
prop: C(Z)(e.component),
|
|
333
464
|
required: e.component.required
|
|
334
465
|
}, {
|
|
335
466
|
default: y(() => [
|
|
336
|
-
|
|
337
|
-
modelValue:
|
|
338
|
-
"onUpdate:modelValue": h[7] || (h[7] = (
|
|
467
|
+
m(E, {
|
|
468
|
+
modelValue: r.value,
|
|
469
|
+
"onUpdate:modelValue": h[7] || (h[7] = (o) => r.value = o),
|
|
339
470
|
type: "date",
|
|
340
471
|
placeholder: e.component.props?.placeholder || "选择日期",
|
|
341
472
|
style: { width: "100%" },
|
|
@@ -344,14 +475,14 @@ const Xe = (e) => {
|
|
|
344
475
|
}, null, 8, ["modelValue", "placeholder", "disabled"])
|
|
345
476
|
]),
|
|
346
477
|
_: 1
|
|
347
|
-
}, 8, ["label", "prop", "required"])) :
|
|
478
|
+
}, 8, ["label", "prop", "required"])) : W("", !0)
|
|
348
479
|
]);
|
|
349
480
|
};
|
|
350
481
|
}
|
|
351
|
-
}),
|
|
482
|
+
}), dt = /* @__PURE__ */ ut(qt, [["__scopeId", "data-v-e2eff285"]]), Jt = {
|
|
352
483
|
key: 0,
|
|
353
484
|
class: "_fd-draggable-drag _fd-drag-box gb-fc-row-box"
|
|
354
|
-
},
|
|
485
|
+
}, Yt = ["onDragover", "onDrop"], Kt = { class: "gb-fc-tools" }, Qt = ["title"], Xt = /* @__PURE__ */ Object.assign({ name: "FcCanvasField" }, {
|
|
355
486
|
__name: "FcCanvasField",
|
|
356
487
|
props: {
|
|
357
488
|
component: { type: Object, required: !0 },
|
|
@@ -362,186 +493,159 @@ const Xe = (e) => {
|
|
|
362
493
|
depth: { type: Number, default: 0 }
|
|
363
494
|
},
|
|
364
495
|
setup(e) {
|
|
365
|
-
const l = e, t =
|
|
366
|
-
|
|
496
|
+
const l = e, t = Ye("fcCanvasOps"), n = Ye("fcDragOver"), u = B(() => l.component.type === d.ROW), r = B(() => l.component.props?.columns?.length || 2);
|
|
497
|
+
B(
|
|
367
498
|
() => (l.component.children || []).every((A) => !A || A.length === 0)
|
|
368
499
|
);
|
|
369
500
|
const p = {
|
|
370
501
|
kind: "existing",
|
|
371
502
|
path: l.path
|
|
372
|
-
},
|
|
503
|
+
}, i = (A) => {
|
|
373
504
|
A.dataTransfer.effectAllowed = "move", A.dataTransfer.setData("application/x-gb-field", JSON.stringify(p)), A.dataTransfer.setData("text/plain", "gb-field"), t.startDrag(l.path);
|
|
374
505
|
}, h = () => {
|
|
375
506
|
t.endDrag();
|
|
376
507
|
}, b = (A) => {
|
|
377
508
|
A.preventDefault();
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
},
|
|
381
|
-
|
|
382
|
-
},
|
|
509
|
+
const S = A.currentTarget.getBoundingClientRect(), x = A.clientY - S.top < S.height / 2 ? "top" : "bottom";
|
|
510
|
+
n.value = l.path.join(".") + ":" + x, A.dataTransfer.dropEffect = "move";
|
|
511
|
+
}, O = () => {
|
|
512
|
+
n.value?.startsWith(l.path.join(".")) && (n.value = "");
|
|
513
|
+
}, I = (A) => {
|
|
383
514
|
A.preventDefault(), A.stopPropagation();
|
|
384
|
-
const
|
|
385
|
-
|
|
515
|
+
const S = n.value?.endsWith(":top") ? "top" : "bottom", x = D(A);
|
|
516
|
+
n.value = "", x && t.dropAt(x, { path: l.path, position: S });
|
|
386
517
|
}, _ = (A) => {
|
|
387
|
-
|
|
388
|
-
},
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
},
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
518
|
+
n.value = l.path.join(".") + ":col" + A;
|
|
519
|
+
}, V = (A, S) => {
|
|
520
|
+
const x = D(S);
|
|
521
|
+
n.value = "", x && t.dropAt(x, { path: l.path, column: A });
|
|
522
|
+
}, D = (A) => {
|
|
523
|
+
const S = A?.dataTransfer?.getData("application/x-gb-field");
|
|
524
|
+
if (S)
|
|
394
525
|
try {
|
|
395
|
-
return JSON.parse(
|
|
526
|
+
return JSON.parse(S);
|
|
396
527
|
} catch {
|
|
397
528
|
return null;
|
|
398
529
|
}
|
|
399
530
|
return t.getDragPayload();
|
|
400
531
|
};
|
|
401
|
-
return (A,
|
|
402
|
-
const
|
|
403
|
-
return
|
|
404
|
-
class:
|
|
532
|
+
return (A, S) => {
|
|
533
|
+
const x = N("FcCanvasField", !0), ne = N("el-col"), ie = N("el-row");
|
|
534
|
+
return f(), w("div", {
|
|
535
|
+
class: U(["_fc-draggable-item _fd-drag-item gb-fc-item", {
|
|
405
536
|
"is-active": e.activeId === e.component.id,
|
|
406
537
|
"is-hidden": e.component.hidden,
|
|
407
|
-
"drag-over-top":
|
|
408
|
-
"drag-over-bottom":
|
|
538
|
+
"drag-over-top": C(n) === e.path.join(".") + ":top",
|
|
539
|
+
"drag-over-bottom": C(n) === e.path.join(".") + ":bottom"
|
|
409
540
|
}]),
|
|
410
541
|
onDragover: X(b, ["prevent"]),
|
|
411
|
-
onDragenter:
|
|
542
|
+
onDragenter: S[3] || (S[3] = X(() => {
|
|
412
543
|
}, ["prevent"])),
|
|
413
|
-
onDragleave:
|
|
414
|
-
onDrop: X(
|
|
544
|
+
onDragleave: O,
|
|
545
|
+
onDrop: X(I, ["stop", "prevent"])
|
|
415
546
|
}, [
|
|
416
|
-
u.value ? (
|
|
417
|
-
|
|
547
|
+
u.value ? (f(), w("div", Jt, [
|
|
548
|
+
m(ie, {
|
|
418
549
|
gutter: e.component.props?.gutter || 20
|
|
419
550
|
}, {
|
|
420
551
|
default: y(() => [
|
|
421
|
-
(
|
|
552
|
+
(f(!0), w(z, null, G(r.value, (K, q) => (f(), k(ne, {
|
|
422
553
|
key: q,
|
|
423
554
|
span: e.component.props?.columns?.[q]?.span || 12
|
|
424
555
|
}, {
|
|
425
556
|
default: y(() => [
|
|
426
|
-
|
|
427
|
-
class:
|
|
557
|
+
s("div", {
|
|
558
|
+
class: U(["gb-fc-column", {
|
|
428
559
|
"_fc-child-empty": !(e.component.children?.[q] || []).length,
|
|
429
560
|
"has-child": (e.component.children?.[q] || []).length
|
|
430
561
|
}]),
|
|
431
562
|
onDragover: X((E) => _(q), ["prevent", "stop"]),
|
|
432
|
-
onDrop: X((E) =>
|
|
563
|
+
onDrop: X((E) => V(q, E), ["stop", "prevent"])
|
|
433
564
|
}, [
|
|
434
|
-
(
|
|
435
|
-
key: E.id ||
|
|
565
|
+
(f(!0), w(z, null, G(e.component.children?.[q] || [], (E, o) => (f(), k(x, {
|
|
566
|
+
key: E.id || o,
|
|
436
567
|
component: E,
|
|
437
|
-
path: [...e.path, "children", q,
|
|
568
|
+
path: [...e.path, "children", q, o],
|
|
438
569
|
"form-data": e.formData,
|
|
439
570
|
"form-rules": e.formRules,
|
|
440
571
|
"active-id": e.activeId,
|
|
441
572
|
depth: e.depth + 1
|
|
442
573
|
}, null, 8, ["component", "path", "form-data", "form-rules", "active-id", "depth"]))), 128))
|
|
443
|
-
], 42,
|
|
574
|
+
], 42, Yt)
|
|
444
575
|
]),
|
|
445
576
|
_: 2
|
|
446
577
|
}, 1032, ["span"]))), 128))
|
|
447
578
|
]),
|
|
448
579
|
_: 1
|
|
449
580
|
}, 8, ["gutter"])
|
|
450
|
-
])) : (
|
|
581
|
+
])) : (f(), k(dt, {
|
|
451
582
|
key: 1,
|
|
452
583
|
component: e.component,
|
|
453
584
|
"form-data": e.formData,
|
|
454
585
|
"form-rules": e.formRules,
|
|
455
586
|
readonly: !0
|
|
456
587
|
}, null, 8, ["component", "form-data", "form-rules"])),
|
|
457
|
-
|
|
588
|
+
s("div", {
|
|
458
589
|
class: "gb-fc-mask",
|
|
459
|
-
onClick:
|
|
590
|
+
onClick: S[2] || (S[2] = X((K) => C(t).active(e.component, e.path), ["stop"]))
|
|
460
591
|
}, [
|
|
461
|
-
|
|
462
|
-
|
|
592
|
+
s("div", Kt, [
|
|
593
|
+
s("i", {
|
|
463
594
|
class: "gb-fc-tool gb-fc-tool--handle",
|
|
464
595
|
title: "拖拽" + (e.component.props?.label || e.component.type),
|
|
465
596
|
draggable: "true",
|
|
466
|
-
onDragstart: X(
|
|
597
|
+
onDragstart: X(i, ["stop"]),
|
|
467
598
|
onDragend: h
|
|
468
|
-
}, [
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
height: "14"
|
|
473
|
-
}, [
|
|
474
|
-
o("path", {
|
|
475
|
-
fill: "currentColor",
|
|
476
|
-
d: "M469.3 256a53.3 53.3 0 1 1-106.6 0 53.3 53.3 0 0 1 106.6 0zm0 170.7a53.3 53.3 0 1 1-106.6 0 53.3 53.3 0 0 1 106.6 0zm0 170.6a53.3 53.3 0 1 1-106.6 0 53.3 53.3 0 0 1 106.6 0zm0 170.7a53.3 53.3 0 1 1-106.6 0 53.3 53.3 0 0 1 106.6 0zM661.3 256a53.3 53.3 0 1 1-106.6 0 53.3 53.3 0 0 1 106.6 0zm0 170.7a53.3 53.3 0 1 1-106.6 0 53.3 53.3 0 0 1 106.6 0zm0 170.6a53.3 53.3 0 1 1-106.6 0 53.3 53.3 0 0 1 106.6 0zm0 170.7a53.3 53.3 0 1 1-106.6 0 53.3 53.3 0 0 1 106.6 0z"
|
|
477
|
-
})
|
|
478
|
-
], -1)
|
|
479
|
-
])], 40, Ft),
|
|
480
|
-
o("i", {
|
|
599
|
+
}, [
|
|
600
|
+
m(C(Mt), { style: { width: "14px", height: "14px" } })
|
|
601
|
+
], 40, Qt),
|
|
602
|
+
s("i", {
|
|
481
603
|
class: "gb-fc-tool",
|
|
482
604
|
title: "复制",
|
|
483
|
-
onClick:
|
|
484
|
-
}, [
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
height: "14"
|
|
489
|
-
}, [
|
|
490
|
-
o("path", {
|
|
491
|
-
fill: "currentColor",
|
|
492
|
-
d: "M768 832v-576H320v576h448zM320 192h448a64 64 0 0 1 64 64v576a64 64 0 0 1-64 64H320a64 64 0 0 1-64-64V256a64 64 0 0 1 64-64zm-128 64v640h64v64h-64a64 64 0 0 1-64-64V256h64z"
|
|
493
|
-
})
|
|
494
|
-
], -1)
|
|
495
|
-
])]),
|
|
496
|
-
o("i", {
|
|
605
|
+
onClick: S[0] || (S[0] = X((K) => C(t).copy(e.path), ["stop"]))
|
|
606
|
+
}, [
|
|
607
|
+
m(C($t), { style: { width: "14px", height: "14px" } })
|
|
608
|
+
]),
|
|
609
|
+
s("i", {
|
|
497
610
|
class: "gb-fc-tool gb-fc-tool--danger",
|
|
498
611
|
title: "删除",
|
|
499
|
-
onClick:
|
|
500
|
-
}, [
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
width: "14",
|
|
504
|
-
height: "14"
|
|
505
|
-
}, [
|
|
506
|
-
o("path", {
|
|
507
|
-
fill: "currentColor",
|
|
508
|
-
d: "M512 455.1L761 206a15 15 0 0 1 21.2 0l35.8 35.8a15 15 0 0 1 0 21.2L569 512l249 249a15 15 0 0 1 0 21.2l-35.8 35.8a15 15 0 0 1-21.2 0L512 569l-249 249a15 15 0 0 1-21.2 0l-35.8-35.8a15 15 0 0 1 0-21.2L455 512 206 263a15 15 0 0 1 0-21.2l35.8-35.8a15 15 0 0 1 21.2 0z"
|
|
509
|
-
})
|
|
510
|
-
], -1)
|
|
511
|
-
])])
|
|
612
|
+
onClick: S[1] || (S[1] = X((K) => C(t).remove(e.path), ["stop"]))
|
|
613
|
+
}, [
|
|
614
|
+
m(C(Dt), { style: { width: "14px", height: "14px" } })
|
|
615
|
+
])
|
|
512
616
|
])
|
|
513
617
|
])
|
|
514
618
|
], 34);
|
|
515
619
|
};
|
|
516
620
|
}
|
|
517
|
-
}),
|
|
621
|
+
}), Zt = {
|
|
518
622
|
class: "_fd-config-item",
|
|
519
623
|
style: { "margin-top": "12px" }
|
|
520
|
-
},
|
|
624
|
+
}, el = { class: "_fd-ci-head" }, tl = { class: "_fd-ci-con" }, ll = { class: "_fc-r-config" }, nl = { style: { "grid-area": "base" } }, ol = {
|
|
521
625
|
key: 0,
|
|
522
626
|
class: "_fd-config-item"
|
|
523
|
-
},
|
|
627
|
+
}, al = { class: "_fd-ci-head" }, sl = { class: "_fd-ci-con" }, il = {
|
|
524
628
|
key: 1,
|
|
525
629
|
class: "_fd-config-item"
|
|
526
|
-
},
|
|
630
|
+
}, rl = { class: "_fd-ci-head" }, ul = { class: "_fd-ci-con" }, dl = {
|
|
527
631
|
key: 0,
|
|
528
632
|
style: { display: "flex", "justify-content": "flex-end", "margin-top": "6px" }
|
|
529
|
-
},
|
|
633
|
+
}, cl = {
|
|
530
634
|
key: 2,
|
|
531
635
|
class: "_fd-config-item"
|
|
532
|
-
},
|
|
636
|
+
}, pl = { class: "_fd-ci-head" }, ml = { class: "_fd-ci-con" }, fl = { style: { "grid-area": "props" } }, vl = {
|
|
533
637
|
key: 0,
|
|
534
638
|
class: "_fd-config-item"
|
|
535
|
-
},
|
|
639
|
+
}, yl = { class: "_fd-ci-head" }, hl = { class: "_fd-ci-con" }, bl = { class: "_fd-config-item" }, gl = { class: "_fd-ci-head" }, Tl = { class: "_fd-ci-con" }, El = { class: "_fd-config-item" }, Nl = { class: "_fd-ci-head" }, Ol = { class: "_fd-ci-con" }, Al = {
|
|
536
640
|
key: 2,
|
|
537
641
|
class: "_fd-config-item"
|
|
538
|
-
},
|
|
642
|
+
}, wl = {
|
|
539
643
|
class: "_fd-ci-append",
|
|
540
644
|
style: { display: "block" }
|
|
541
|
-
},
|
|
645
|
+
}, _l = { class: "_fd-config-item" }, Rl = { class: "_fd-ci-head" }, Cl = { class: "_fd-ci-con" }, kl = { class: "_fd-config-item" }, Vl = {
|
|
542
646
|
class: "_fd-ci-append",
|
|
543
647
|
style: { display: "block" }
|
|
544
|
-
},
|
|
648
|
+
}, Sl = { style: { "font-size": "12px", color: "#666", width: "60px" } }, Dl = { class: "_fc-r-config" }, Il = { style: { "grid-area": "base" } }, $l = { class: "_fd-config-item" }, xl = { class: "_fd-ci-head" }, Ul = { class: "_fd-ci-con" }, Pl = { class: "_fd-config-item" }, Ml = { class: "_fd-ci-head" }, Ll = { class: "_fd-ci-con" }, Fl = { class: "_fd-config-item" }, zl = { class: "_fd-ci-head" }, jl = { class: "_fd-ci-con" }, Gl = { class: "_fd-config-item" }, Wl = { class: "_fd-ci-head" }, Bl = { class: "_fd-ci-con" }, Hl = /* @__PURE__ */ Object.assign({ name: "FcPropsPanel" }, {
|
|
545
649
|
__name: "FcPropsPanel",
|
|
546
650
|
props: {
|
|
547
651
|
component: { type: Object, default: null },
|
|
@@ -549,87 +653,87 @@ const Xe = (e) => {
|
|
|
549
653
|
},
|
|
550
654
|
emits: ["close"],
|
|
551
655
|
setup(e, { emit: l }) {
|
|
552
|
-
const t = e,
|
|
656
|
+
const t = e, n = P("props"), u = B(() => t.component?.type === d.ROW), r = B(() => Xe.includes(t.component?.type)), p = B(() => t.component?.props ? (Array.isArray(t.component.props.options) || (t.component.props.options = []), t.component.props.options) : []), i = Object.entries(zt).filter(([E]) => E !== d.BUTTON).map(([E, o]) => ({ value: E, label: o })), h = B({
|
|
553
657
|
get: () => t.component?.type,
|
|
554
658
|
set: (E) => {
|
|
555
|
-
!E || !t.component || (t.component.type = E, t.component.props || (t.component.props = {}),
|
|
659
|
+
!E || !t.component || (t.component.type = E, t.component.props || (t.component.props = {}), Xe.includes(E) && !t.component.props.options?.length && (t.component.props.options = [
|
|
556
660
|
{ label: "选项1", value: "1" },
|
|
557
661
|
{ label: "选项2", value: "2" }
|
|
558
|
-
]), E === d.ROW && (t.component.props.columns || (t.component.props.columns = [{ span: 12 }, { span: 12 }]), t.component.children || (t.component.children = [[], []]), t.component.props.gutter = t.component.props.gutter || 20,
|
|
662
|
+
]), E === d.ROW && (t.component.props.columns || (t.component.props.columns = [{ span: 12 }, { span: 12 }]), t.component.children || (t.component.children = [[], []]), t.component.props.gutter = t.component.props.gutter || 20, it(t.component)));
|
|
559
663
|
}
|
|
560
|
-
}), b = P("100%"),
|
|
561
|
-
const E = t.component?.style?.width,
|
|
664
|
+
}), b = P("100%"), O = P(100), I = () => {
|
|
665
|
+
const E = t.component?.style?.width, o = ["100%", "50%", "33.33%", "25%"];
|
|
562
666
|
if (!E) {
|
|
563
667
|
b.value = "100%";
|
|
564
668
|
return;
|
|
565
669
|
}
|
|
566
|
-
b.value =
|
|
670
|
+
b.value = o.includes(E) ? E : "custom", b.value === "custom" && (O.value = Gt(E));
|
|
567
671
|
};
|
|
568
|
-
|
|
672
|
+
I(), ke(() => t.component?.id, I);
|
|
569
673
|
const _ = (E) => {
|
|
570
|
-
t.component && (t.component.style || (t.component.style = {}), E === "custom" ? t.component.style.width = `${
|
|
571
|
-
},
|
|
674
|
+
t.component && (t.component.style || (t.component.style = {}), E === "custom" ? t.component.style.width = `${O.value}%` : t.component.style.width = E);
|
|
675
|
+
}, V = (E) => {
|
|
572
676
|
t.component && (t.component.style || (t.component.style = {}), t.component.style.width = `${E}%`);
|
|
573
|
-
},
|
|
677
|
+
}, D = (E) => typeof E == "string" ? E : E.label, A = (E) => typeof E == "string" ? E : E.value, S = () => {
|
|
574
678
|
p.value.push({ label: `选项${p.value.length + 1}`, value: `${p.value.length + 1}` });
|
|
575
|
-
},
|
|
679
|
+
}, x = (E) => {
|
|
576
680
|
p.value.splice(E, 1);
|
|
577
|
-
},
|
|
681
|
+
}, ne = () => {
|
|
578
682
|
const E = t.component.props.columns;
|
|
579
683
|
E.push({ span: Math.max(1, Math.round(24 / (E.length + 1))) }), t.component.children || (t.component.children = []), t.component.children.push([]);
|
|
580
|
-
},
|
|
684
|
+
}, ie = (E) => {
|
|
581
685
|
t.component.props.columns.splice(E, 1), t.component.children?.splice(E, 1);
|
|
582
686
|
}, K = async () => {
|
|
583
687
|
const E = t.component?.props?.variableName;
|
|
584
688
|
if (E)
|
|
585
689
|
try {
|
|
586
|
-
await navigator.clipboard.writeText(E),
|
|
690
|
+
await navigator.clipboard.writeText(E), ae.success("字段名已复制");
|
|
587
691
|
} catch {
|
|
588
|
-
|
|
692
|
+
ae.warning("复制失败");
|
|
589
693
|
}
|
|
590
694
|
}, q = () => {
|
|
591
|
-
t.component && (t.component.props.variableName = `field_${
|
|
695
|
+
t.component && (t.component.props.variableName = `field_${Ae().split("_").pop()}`);
|
|
592
696
|
};
|
|
593
|
-
return (E,
|
|
594
|
-
const Q =
|
|
595
|
-
return
|
|
697
|
+
return (E, o) => {
|
|
698
|
+
const Q = N("el-header"), F = N("el-option"), te = N("el-select"), oe = N("el-input"), fe = N("el-switch"), ve = N("el-divider"), re = N("el-input-number"), pe = N("el-button"), Te = N("el-main"), _e = N("el-container");
|
|
699
|
+
return f(), k(_e, { style: { height: "100%" } }, {
|
|
596
700
|
default: y(() => [
|
|
597
|
-
|
|
701
|
+
m(Q, {
|
|
598
702
|
height: "40px",
|
|
599
703
|
class: "_fc-r-tabs"
|
|
600
704
|
}, {
|
|
601
705
|
default: y(() => [
|
|
602
|
-
e.component ? (
|
|
706
|
+
e.component ? (f(), w("div", {
|
|
603
707
|
key: 0,
|
|
604
|
-
class:
|
|
605
|
-
onClick:
|
|
606
|
-
}, " 组件 ", 2)) :
|
|
607
|
-
|
|
608
|
-
class:
|
|
609
|
-
onClick:
|
|
708
|
+
class: U(["_fc-r-tab", { active: n.value === "props" }]),
|
|
709
|
+
onClick: o[0] || (o[0] = (v) => n.value = "props")
|
|
710
|
+
}, " 组件 ", 2)) : W("", !0),
|
|
711
|
+
s("div", {
|
|
712
|
+
class: U(["_fc-r-tab", { active: n.value === "form" || !e.component }]),
|
|
713
|
+
onClick: o[1] || (o[1] = (v) => n.value = "form")
|
|
610
714
|
}, " 表单 ", 2)
|
|
611
715
|
]),
|
|
612
716
|
_: 1
|
|
613
717
|
}),
|
|
614
|
-
|
|
718
|
+
n.value === "props" && e.component ? (f(), k(Te, {
|
|
615
719
|
key: 0,
|
|
616
720
|
class: "_fc-r-tab-props"
|
|
617
721
|
}, {
|
|
618
722
|
default: y(() => [
|
|
619
|
-
|
|
723
|
+
s("div", {
|
|
620
724
|
class: "_fc-r-tools-close",
|
|
621
|
-
onClick:
|
|
622
|
-
}, [...
|
|
623
|
-
|
|
725
|
+
onClick: o[2] || (o[2] = (v) => E.$emit("close"))
|
|
726
|
+
}, [...o[23] || (o[23] = [
|
|
727
|
+
s("i", { class: "fc-icon icon-add2" }, null, -1)
|
|
624
728
|
])]),
|
|
625
|
-
|
|
626
|
-
|
|
729
|
+
o[38] || (o[38] = s("p", { class: "_fc-r-title" }, "组件类型", -1)),
|
|
730
|
+
m(te, {
|
|
627
731
|
modelValue: h.value,
|
|
628
|
-
"onUpdate:modelValue":
|
|
732
|
+
"onUpdate:modelValue": o[3] || (o[3] = (v) => h.value = v),
|
|
629
733
|
style: { width: "100%" }
|
|
630
734
|
}, {
|
|
631
735
|
default: y(() => [
|
|
632
|
-
(
|
|
736
|
+
(f(!0), w(z, null, G(C(i), (v) => (f(), k(F, {
|
|
633
737
|
key: v.value,
|
|
634
738
|
label: v.label,
|
|
635
739
|
value: v.value
|
|
@@ -637,21 +741,21 @@ const Xe = (e) => {
|
|
|
637
741
|
]),
|
|
638
742
|
_: 1
|
|
639
743
|
}, 8, ["modelValue"]),
|
|
640
|
-
|
|
641
|
-
|
|
744
|
+
o[39] || (o[39] = s("p", { class: "_fc-r-title" }, "字段名", -1)),
|
|
745
|
+
m(oe, {
|
|
642
746
|
modelValue: e.component.props.variableName,
|
|
643
|
-
"onUpdate:modelValue":
|
|
747
|
+
"onUpdate:modelValue": o[4] || (o[4] = (v) => e.component.props.variableName = v),
|
|
644
748
|
class: "_fc-r-name-input"
|
|
645
749
|
}, {
|
|
646
750
|
suffix: y(() => [
|
|
647
|
-
|
|
751
|
+
s("i", {
|
|
648
752
|
class: "fc-icon icon-group",
|
|
649
753
|
title: "复制字段名",
|
|
650
754
|
onClick: K
|
|
651
755
|
})
|
|
652
756
|
]),
|
|
653
757
|
append: y(() => [
|
|
654
|
-
|
|
758
|
+
s("i", {
|
|
655
759
|
class: "fc-icon icon-auto",
|
|
656
760
|
title: "根据标题生成",
|
|
657
761
|
onClick: q
|
|
@@ -659,71 +763,71 @@ const Xe = (e) => {
|
|
|
659
763
|
]),
|
|
660
764
|
_: 1
|
|
661
765
|
}, 8, ["modelValue"]),
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
766
|
+
s("div", Zt, [
|
|
767
|
+
s("div", el, [
|
|
768
|
+
o[24] || (o[24] = s("div", { class: "_fd-ci-label" }, "隐藏", -1)),
|
|
769
|
+
s("div", tl, [
|
|
770
|
+
m(fe, {
|
|
667
771
|
modelValue: e.component.hidden,
|
|
668
|
-
"onUpdate:modelValue":
|
|
772
|
+
"onUpdate:modelValue": o[5] || (o[5] = (v) => e.component.hidden = v),
|
|
669
773
|
size: "small"
|
|
670
774
|
}, null, 8, ["modelValue"])
|
|
671
775
|
])
|
|
672
776
|
])
|
|
673
777
|
]),
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
default: y(() => [...
|
|
778
|
+
s("div", ll, [
|
|
779
|
+
s("div", nl, [
|
|
780
|
+
m(ve, null, {
|
|
781
|
+
default: y(() => [...o[25] || (o[25] = [
|
|
678
782
|
Y("规则", -1)
|
|
679
783
|
])]),
|
|
680
784
|
_: 1
|
|
681
785
|
}),
|
|
682
|
-
u.value ?
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
786
|
+
u.value ? W("", !0) : (f(), w("div", ol, [
|
|
787
|
+
s("div", al, [
|
|
788
|
+
o[26] || (o[26] = s("div", { class: "_fd-ci-label" }, [
|
|
789
|
+
s("span", null, "必填")
|
|
686
790
|
], -1)),
|
|
687
|
-
|
|
688
|
-
|
|
791
|
+
s("div", sl, [
|
|
792
|
+
m(fe, {
|
|
689
793
|
modelValue: e.component.required,
|
|
690
|
-
"onUpdate:modelValue":
|
|
794
|
+
"onUpdate:modelValue": o[6] || (o[6] = (v) => e.component.required = v),
|
|
691
795
|
size: "small"
|
|
692
796
|
}, null, 8, ["modelValue"])
|
|
693
797
|
])
|
|
694
798
|
])
|
|
695
799
|
])),
|
|
696
|
-
u.value ?
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
800
|
+
u.value ? W("", !0) : (f(), w("div", il, [
|
|
801
|
+
s("div", rl, [
|
|
802
|
+
o[27] || (o[27] = s("div", { class: "_fd-ci-label" }, [
|
|
803
|
+
s("span", null, "字段宽度")
|
|
700
804
|
], -1)),
|
|
701
|
-
|
|
702
|
-
|
|
805
|
+
s("div", ul, [
|
|
806
|
+
m(te, {
|
|
703
807
|
modelValue: b.value,
|
|
704
|
-
"onUpdate:modelValue":
|
|
808
|
+
"onUpdate:modelValue": o[7] || (o[7] = (v) => b.value = v),
|
|
705
809
|
size: "small",
|
|
706
810
|
style: { width: "120px" },
|
|
707
811
|
onChange: _
|
|
708
812
|
}, {
|
|
709
813
|
default: y(() => [
|
|
710
|
-
|
|
814
|
+
m(F, {
|
|
711
815
|
label: "整行",
|
|
712
816
|
value: "100%"
|
|
713
817
|
}),
|
|
714
|
-
|
|
818
|
+
m(F, {
|
|
715
819
|
label: "1/2",
|
|
716
820
|
value: "50%"
|
|
717
821
|
}),
|
|
718
|
-
|
|
822
|
+
m(F, {
|
|
719
823
|
label: "1/3",
|
|
720
824
|
value: "33.33%"
|
|
721
825
|
}),
|
|
722
|
-
|
|
826
|
+
m(F, {
|
|
723
827
|
label: "1/4",
|
|
724
828
|
value: "25%"
|
|
725
829
|
}),
|
|
726
|
-
|
|
830
|
+
m(F, {
|
|
727
831
|
label: "自定义",
|
|
728
832
|
value: "custom"
|
|
729
833
|
})
|
|
@@ -732,95 +836,95 @@ const Xe = (e) => {
|
|
|
732
836
|
}, 8, ["modelValue"])
|
|
733
837
|
])
|
|
734
838
|
]),
|
|
735
|
-
b.value === "custom" ? (
|
|
736
|
-
|
|
737
|
-
modelValue:
|
|
738
|
-
"onUpdate:modelValue":
|
|
839
|
+
b.value === "custom" ? (f(), w("div", dl, [
|
|
840
|
+
m(re, {
|
|
841
|
+
modelValue: O.value,
|
|
842
|
+
"onUpdate:modelValue": o[8] || (o[8] = (v) => O.value = v),
|
|
739
843
|
min: 10,
|
|
740
844
|
max: 100,
|
|
741
845
|
step: 5,
|
|
742
846
|
size: "small",
|
|
743
|
-
onChange:
|
|
847
|
+
onChange: V
|
|
744
848
|
}, null, 8, ["modelValue"])
|
|
745
|
-
])) :
|
|
849
|
+
])) : W("", !0)
|
|
746
850
|
])),
|
|
747
|
-
u.value ?
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
851
|
+
u.value ? W("", !0) : (f(), w("div", cl, [
|
|
852
|
+
s("div", pl, [
|
|
853
|
+
o[28] || (o[28] = s("div", { class: "_fd-ci-label" }, [
|
|
854
|
+
s("span", null, "默认值")
|
|
751
855
|
], -1)),
|
|
752
|
-
|
|
753
|
-
["radio-group", "select"].includes(e.component.type) ? (
|
|
856
|
+
s("div", ml, [
|
|
857
|
+
["radio-group", "select"].includes(e.component.type) ? (f(), k(te, {
|
|
754
858
|
key: 0,
|
|
755
859
|
modelValue: e.component.defaultValue,
|
|
756
|
-
"onUpdate:modelValue":
|
|
860
|
+
"onUpdate:modelValue": o[9] || (o[9] = (v) => e.component.defaultValue = v),
|
|
757
861
|
size: "small",
|
|
758
862
|
clearable: "",
|
|
759
863
|
style: { width: "180px" }
|
|
760
864
|
}, {
|
|
761
865
|
default: y(() => [
|
|
762
|
-
(
|
|
866
|
+
(f(!0), w(z, null, G(p.value, (v) => (f(), k(F, {
|
|
763
867
|
key: A(v),
|
|
764
|
-
label:
|
|
868
|
+
label: D(v),
|
|
765
869
|
value: A(v)
|
|
766
870
|
}, null, 8, ["label", "value"]))), 128))
|
|
767
871
|
]),
|
|
768
872
|
_: 1
|
|
769
|
-
}, 8, ["modelValue"])) : e.component.type === "checkbox-group" ? (
|
|
873
|
+
}, 8, ["modelValue"])) : e.component.type === "checkbox-group" ? (f(), k(te, {
|
|
770
874
|
key: 1,
|
|
771
875
|
modelValue: e.component.defaultValue,
|
|
772
|
-
"onUpdate:modelValue":
|
|
876
|
+
"onUpdate:modelValue": o[10] || (o[10] = (v) => e.component.defaultValue = v),
|
|
773
877
|
size: "small",
|
|
774
878
|
multiple: "",
|
|
775
879
|
clearable: "",
|
|
776
880
|
style: { width: "180px" }
|
|
777
881
|
}, {
|
|
778
882
|
default: y(() => [
|
|
779
|
-
(
|
|
883
|
+
(f(!0), w(z, null, G(p.value, (v) => (f(), k(F, {
|
|
780
884
|
key: A(v),
|
|
781
|
-
label:
|
|
885
|
+
label: D(v),
|
|
782
886
|
value: A(v)
|
|
783
887
|
}, null, 8, ["label", "value"]))), 128))
|
|
784
888
|
]),
|
|
785
889
|
_: 1
|
|
786
|
-
}, 8, ["modelValue"])) : e.component.type === "switch" ? (
|
|
890
|
+
}, 8, ["modelValue"])) : e.component.type === "switch" ? (f(), k(fe, {
|
|
787
891
|
key: 2,
|
|
788
892
|
modelValue: e.component.defaultValue,
|
|
789
|
-
"onUpdate:modelValue":
|
|
893
|
+
"onUpdate:modelValue": o[11] || (o[11] = (v) => e.component.defaultValue = v),
|
|
790
894
|
size: "small"
|
|
791
|
-
}, null, 8, ["modelValue"])) : e.component.type === "date-picker" ? (
|
|
895
|
+
}, null, 8, ["modelValue"])) : e.component.type === "date-picker" ? (f(), k(te, {
|
|
792
896
|
key: 3,
|
|
793
897
|
modelValue: e.component.defaultValue,
|
|
794
|
-
"onUpdate:modelValue":
|
|
898
|
+
"onUpdate:modelValue": o[12] || (o[12] = (v) => e.component.defaultValue = v),
|
|
795
899
|
size: "small",
|
|
796
900
|
clearable: "",
|
|
797
901
|
style: { width: "120px" }
|
|
798
902
|
}, {
|
|
799
903
|
default: y(() => [
|
|
800
|
-
|
|
904
|
+
m(F, {
|
|
801
905
|
label: "今天",
|
|
802
906
|
value: "today"
|
|
803
907
|
}),
|
|
804
|
-
|
|
908
|
+
m(F, {
|
|
805
909
|
label: "明天",
|
|
806
910
|
value: "tomorrow"
|
|
807
911
|
}),
|
|
808
|
-
|
|
912
|
+
m(F, {
|
|
809
913
|
label: "无",
|
|
810
914
|
value: ""
|
|
811
915
|
})
|
|
812
916
|
]),
|
|
813
917
|
_: 1
|
|
814
|
-
}, 8, ["modelValue"])) : e.component.type === "input-number" ? (
|
|
918
|
+
}, 8, ["modelValue"])) : e.component.type === "input-number" ? (f(), k(re, {
|
|
815
919
|
key: 4,
|
|
816
920
|
modelValue: e.component.defaultValue,
|
|
817
|
-
"onUpdate:modelValue":
|
|
921
|
+
"onUpdate:modelValue": o[13] || (o[13] = (v) => e.component.defaultValue = v),
|
|
818
922
|
size: "small",
|
|
819
923
|
style: { width: "140px" }
|
|
820
|
-
}, null, 8, ["modelValue"])) : (
|
|
924
|
+
}, null, 8, ["modelValue"])) : (f(), k(oe, {
|
|
821
925
|
key: 5,
|
|
822
926
|
modelValue: e.component.defaultValue,
|
|
823
|
-
"onUpdate:modelValue":
|
|
927
|
+
"onUpdate:modelValue": o[14] || (o[14] = (v) => e.component.defaultValue = v),
|
|
824
928
|
size: "small",
|
|
825
929
|
style: { width: "180px" }
|
|
826
930
|
}, null, 8, ["modelValue"]))
|
|
@@ -828,116 +932,116 @@ const Xe = (e) => {
|
|
|
828
932
|
])
|
|
829
933
|
]))
|
|
830
934
|
]),
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
default: y(() => [...
|
|
935
|
+
s("div", fl, [
|
|
936
|
+
m(ve, null, {
|
|
937
|
+
default: y(() => [...o[29] || (o[29] = [
|
|
834
938
|
Y("属性", -1)
|
|
835
939
|
])]),
|
|
836
940
|
_: 1
|
|
837
941
|
}),
|
|
838
|
-
["input", "textarea", "select"].includes(e.component.type) ? (
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
942
|
+
["input", "textarea", "select"].includes(e.component.type) ? (f(), w("div", vl, [
|
|
943
|
+
s("div", yl, [
|
|
944
|
+
o[30] || (o[30] = s("div", { class: "_fd-ci-label" }, [
|
|
945
|
+
s("span", null, "提示文字")
|
|
842
946
|
], -1)),
|
|
843
|
-
|
|
844
|
-
|
|
947
|
+
s("div", hl, [
|
|
948
|
+
m(oe, {
|
|
845
949
|
modelValue: e.component.props.placeholder,
|
|
846
|
-
"onUpdate:modelValue":
|
|
950
|
+
"onUpdate:modelValue": o[15] || (o[15] = (v) => e.component.props.placeholder = v),
|
|
847
951
|
size: "small",
|
|
848
952
|
style: { width: "180px" }
|
|
849
953
|
}, null, 8, ["modelValue"])
|
|
850
954
|
])
|
|
851
955
|
])
|
|
852
|
-
])) :
|
|
853
|
-
e.component.type === "input-number" ? (
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
956
|
+
])) : W("", !0),
|
|
957
|
+
e.component.type === "input-number" ? (f(), w(z, { key: 1 }, [
|
|
958
|
+
s("div", bl, [
|
|
959
|
+
s("div", gl, [
|
|
960
|
+
o[31] || (o[31] = s("div", { class: "_fd-ci-label" }, [
|
|
961
|
+
s("span", null, "最小值")
|
|
858
962
|
], -1)),
|
|
859
|
-
|
|
860
|
-
|
|
963
|
+
s("div", Tl, [
|
|
964
|
+
m(re, {
|
|
861
965
|
modelValue: e.component.min,
|
|
862
|
-
"onUpdate:modelValue":
|
|
966
|
+
"onUpdate:modelValue": o[16] || (o[16] = (v) => e.component.min = v),
|
|
863
967
|
size: "small",
|
|
864
968
|
style: { width: "140px" }
|
|
865
969
|
}, null, 8, ["modelValue"])
|
|
866
970
|
])
|
|
867
971
|
])
|
|
868
972
|
]),
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
973
|
+
s("div", El, [
|
|
974
|
+
s("div", Nl, [
|
|
975
|
+
o[32] || (o[32] = s("div", { class: "_fd-ci-label" }, [
|
|
976
|
+
s("span", null, "最大值")
|
|
873
977
|
], -1)),
|
|
874
|
-
|
|
875
|
-
|
|
978
|
+
s("div", Ol, [
|
|
979
|
+
m(re, {
|
|
876
980
|
modelValue: e.component.max,
|
|
877
|
-
"onUpdate:modelValue":
|
|
981
|
+
"onUpdate:modelValue": o[17] || (o[17] = (v) => e.component.max = v),
|
|
878
982
|
size: "small",
|
|
879
983
|
style: { width: "140px" }
|
|
880
984
|
}, null, 8, ["modelValue"])
|
|
881
985
|
])
|
|
882
986
|
])
|
|
883
987
|
])
|
|
884
|
-
], 64)) :
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
988
|
+
], 64)) : W("", !0),
|
|
989
|
+
r.value ? (f(), w("div", Al, [
|
|
990
|
+
o[34] || (o[34] = s("div", { class: "_fd-ci-head" }, [
|
|
991
|
+
s("div", { class: "_fd-ci-label" }, [
|
|
992
|
+
s("span", null, "选项配置")
|
|
889
993
|
])
|
|
890
994
|
], -1)),
|
|
891
|
-
|
|
892
|
-
(
|
|
893
|
-
key:
|
|
995
|
+
s("div", wl, [
|
|
996
|
+
(f(!0), w(z, null, G(p.value, (v, de) => (f(), w("div", {
|
|
997
|
+
key: de,
|
|
894
998
|
class: "gb-fc-option"
|
|
895
999
|
}, [
|
|
896
|
-
|
|
1000
|
+
m(oe, {
|
|
897
1001
|
modelValue: v.label,
|
|
898
|
-
"onUpdate:modelValue": (
|
|
1002
|
+
"onUpdate:modelValue": (ue) => v.label = ue,
|
|
899
1003
|
size: "small",
|
|
900
1004
|
placeholder: "选项名称"
|
|
901
1005
|
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
902
|
-
|
|
1006
|
+
m(oe, {
|
|
903
1007
|
modelValue: v.value,
|
|
904
|
-
"onUpdate:modelValue": (
|
|
1008
|
+
"onUpdate:modelValue": (ue) => v.value = ue,
|
|
905
1009
|
size: "small",
|
|
906
1010
|
placeholder: "选项值"
|
|
907
1011
|
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
908
|
-
|
|
1012
|
+
m(pe, {
|
|
909
1013
|
type: "danger",
|
|
910
1014
|
plain: "",
|
|
911
1015
|
size: "small",
|
|
912
|
-
icon:
|
|
913
|
-
onClick: (
|
|
1016
|
+
icon: C(Ke),
|
|
1017
|
+
onClick: (ue) => x(de)
|
|
914
1018
|
}, null, 8, ["icon", "onClick"])
|
|
915
1019
|
]))), 128)),
|
|
916
|
-
|
|
1020
|
+
m(pe, {
|
|
917
1021
|
type: "primary",
|
|
918
1022
|
plain: "",
|
|
919
1023
|
size: "small",
|
|
920
|
-
icon:
|
|
1024
|
+
icon: C(Qe),
|
|
921
1025
|
style: { width: "100%" },
|
|
922
|
-
onClick:
|
|
1026
|
+
onClick: S
|
|
923
1027
|
}, {
|
|
924
|
-
default: y(() => [...
|
|
1028
|
+
default: y(() => [...o[33] || (o[33] = [
|
|
925
1029
|
Y(" 添加选项 ", -1)
|
|
926
1030
|
])]),
|
|
927
1031
|
_: 1
|
|
928
1032
|
}, 8, ["icon"])
|
|
929
1033
|
])
|
|
930
|
-
])) :
|
|
931
|
-
u.value ? (
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1034
|
+
])) : W("", !0),
|
|
1035
|
+
u.value ? (f(), w(z, { key: 3 }, [
|
|
1036
|
+
s("div", _l, [
|
|
1037
|
+
s("div", Rl, [
|
|
1038
|
+
o[35] || (o[35] = s("div", { class: "_fd-ci-label" }, [
|
|
1039
|
+
s("span", null, "列间距")
|
|
936
1040
|
], -1)),
|
|
937
|
-
|
|
938
|
-
|
|
1041
|
+
s("div", Cl, [
|
|
1042
|
+
m(re, {
|
|
939
1043
|
modelValue: e.component.props.gutter,
|
|
940
|
-
"onUpdate:modelValue":
|
|
1044
|
+
"onUpdate:modelValue": o[18] || (o[18] = (v) => e.component.props.gutter = v),
|
|
941
1045
|
min: 0,
|
|
942
1046
|
max: 100,
|
|
943
1047
|
size: "small",
|
|
@@ -946,132 +1050,132 @@ const Xe = (e) => {
|
|
|
946
1050
|
])
|
|
947
1051
|
])
|
|
948
1052
|
]),
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1053
|
+
s("div", kl, [
|
|
1054
|
+
o[37] || (o[37] = s("div", { class: "_fd-ci-head" }, [
|
|
1055
|
+
s("div", { class: "_fd-ci-label" }, [
|
|
1056
|
+
s("span", null, "列配置")
|
|
953
1057
|
])
|
|
954
1058
|
], -1)),
|
|
955
|
-
|
|
956
|
-
(
|
|
957
|
-
key:
|
|
1059
|
+
s("div", Vl, [
|
|
1060
|
+
(f(!0), w(z, null, G(e.component.props.columns, (v, de) => (f(), w("div", {
|
|
1061
|
+
key: de,
|
|
958
1062
|
class: "gb-fc-option"
|
|
959
1063
|
}, [
|
|
960
|
-
|
|
961
|
-
|
|
1064
|
+
s("span", Sl, "第" + se(de + 1) + "列", 1),
|
|
1065
|
+
m(re, {
|
|
962
1066
|
modelValue: v.span,
|
|
963
|
-
"onUpdate:modelValue": (
|
|
1067
|
+
"onUpdate:modelValue": (ue) => v.span = ue,
|
|
964
1068
|
min: 1,
|
|
965
1069
|
max: 24,
|
|
966
1070
|
size: "small"
|
|
967
1071
|
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
968
|
-
|
|
1072
|
+
m(pe, {
|
|
969
1073
|
type: "danger",
|
|
970
1074
|
plain: "",
|
|
971
1075
|
size: "small",
|
|
972
|
-
icon:
|
|
1076
|
+
icon: C(Ke),
|
|
973
1077
|
disabled: (e.component.props.columns || []).length <= 1,
|
|
974
|
-
onClick: (
|
|
1078
|
+
onClick: (ue) => ie(de)
|
|
975
1079
|
}, null, 8, ["icon", "disabled", "onClick"])
|
|
976
1080
|
]))), 128)),
|
|
977
|
-
|
|
1081
|
+
m(pe, {
|
|
978
1082
|
type: "primary",
|
|
979
1083
|
plain: "",
|
|
980
1084
|
size: "small",
|
|
981
|
-
icon:
|
|
1085
|
+
icon: C(Qe),
|
|
982
1086
|
style: { width: "100%" },
|
|
983
|
-
onClick:
|
|
1087
|
+
onClick: ne
|
|
984
1088
|
}, {
|
|
985
|
-
default: y(() => [...
|
|
1089
|
+
default: y(() => [...o[36] || (o[36] = [
|
|
986
1090
|
Y(" 添加列 ", -1)
|
|
987
1091
|
])]),
|
|
988
1092
|
_: 1
|
|
989
1093
|
}, 8, ["icon"])
|
|
990
1094
|
])
|
|
991
1095
|
])
|
|
992
|
-
], 64)) :
|
|
1096
|
+
], 64)) : W("", !0)
|
|
993
1097
|
])
|
|
994
1098
|
])
|
|
995
1099
|
]),
|
|
996
1100
|
_: 1
|
|
997
|
-
})) :
|
|
998
|
-
|
|
1101
|
+
})) : W("", !0),
|
|
1102
|
+
me(m(Te, { class: "_fc-r-tab-form" }, {
|
|
999
1103
|
default: y(() => [
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
default: y(() => [...
|
|
1104
|
+
s("div", Dl, [
|
|
1105
|
+
s("div", Il, [
|
|
1106
|
+
m(ve, null, {
|
|
1107
|
+
default: y(() => [...o[40] || (o[40] = [
|
|
1004
1108
|
Y("表单配置", -1)
|
|
1005
1109
|
])]),
|
|
1006
1110
|
_: 1
|
|
1007
1111
|
}),
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1112
|
+
s("div", $l, [
|
|
1113
|
+
s("div", xl, [
|
|
1114
|
+
o[41] || (o[41] = s("div", { class: "_fd-ci-label" }, [
|
|
1115
|
+
s("span", null, "表单名称")
|
|
1012
1116
|
], -1)),
|
|
1013
|
-
|
|
1014
|
-
|
|
1117
|
+
s("div", Ul, [
|
|
1118
|
+
m(oe, {
|
|
1015
1119
|
modelValue: e.formOptions.name,
|
|
1016
|
-
"onUpdate:modelValue":
|
|
1120
|
+
"onUpdate:modelValue": o[19] || (o[19] = (v) => e.formOptions.name = v),
|
|
1017
1121
|
size: "small",
|
|
1018
1122
|
style: { width: "180px" }
|
|
1019
1123
|
}, null, 8, ["modelValue"])
|
|
1020
1124
|
])
|
|
1021
1125
|
])
|
|
1022
1126
|
]),
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1127
|
+
s("div", Pl, [
|
|
1128
|
+
s("div", Ml, [
|
|
1129
|
+
o[42] || (o[42] = s("div", { class: "_fd-ci-label" }, [
|
|
1130
|
+
s("span", null, "表单描述")
|
|
1027
1131
|
], -1)),
|
|
1028
|
-
|
|
1029
|
-
|
|
1132
|
+
s("div", Ll, [
|
|
1133
|
+
m(oe, {
|
|
1030
1134
|
modelValue: e.formOptions.description,
|
|
1031
|
-
"onUpdate:modelValue":
|
|
1135
|
+
"onUpdate:modelValue": o[20] || (o[20] = (v) => e.formOptions.description = v),
|
|
1032
1136
|
size: "small",
|
|
1033
1137
|
style: { width: "180px" }
|
|
1034
1138
|
}, null, 8, ["modelValue"])
|
|
1035
1139
|
])
|
|
1036
1140
|
])
|
|
1037
1141
|
]),
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1142
|
+
s("div", Fl, [
|
|
1143
|
+
s("div", zl, [
|
|
1144
|
+
o[43] || (o[43] = s("div", { class: "_fd-ci-label" }, [
|
|
1145
|
+
s("span", null, "标签宽度")
|
|
1042
1146
|
], -1)),
|
|
1043
|
-
|
|
1044
|
-
|
|
1147
|
+
s("div", jl, [
|
|
1148
|
+
m(oe, {
|
|
1045
1149
|
modelValue: e.formOptions.labelWidth,
|
|
1046
|
-
"onUpdate:modelValue":
|
|
1150
|
+
"onUpdate:modelValue": o[21] || (o[21] = (v) => e.formOptions.labelWidth = v),
|
|
1047
1151
|
size: "small",
|
|
1048
1152
|
style: { width: "120px" }
|
|
1049
1153
|
}, null, 8, ["modelValue"])
|
|
1050
1154
|
])
|
|
1051
1155
|
])
|
|
1052
1156
|
]),
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1157
|
+
s("div", Gl, [
|
|
1158
|
+
s("div", Wl, [
|
|
1159
|
+
o[44] || (o[44] = s("div", { class: "_fd-ci-label" }, [
|
|
1160
|
+
s("span", null, "组件尺寸")
|
|
1057
1161
|
], -1)),
|
|
1058
|
-
|
|
1059
|
-
|
|
1162
|
+
s("div", Bl, [
|
|
1163
|
+
m(te, {
|
|
1060
1164
|
modelValue: e.formOptions.size,
|
|
1061
|
-
"onUpdate:modelValue":
|
|
1165
|
+
"onUpdate:modelValue": o[22] || (o[22] = (v) => e.formOptions.size = v),
|
|
1062
1166
|
size: "small",
|
|
1063
1167
|
style: { width: "120px" }
|
|
1064
1168
|
}, {
|
|
1065
1169
|
default: y(() => [
|
|
1066
|
-
|
|
1170
|
+
m(F, {
|
|
1067
1171
|
label: "较大",
|
|
1068
1172
|
value: "large"
|
|
1069
1173
|
}),
|
|
1070
|
-
|
|
1174
|
+
m(F, {
|
|
1071
1175
|
label: "默认",
|
|
1072
1176
|
value: "default"
|
|
1073
1177
|
}),
|
|
1074
|
-
|
|
1178
|
+
m(F, {
|
|
1075
1179
|
label: "较小",
|
|
1076
1180
|
value: "small"
|
|
1077
1181
|
})
|
|
@@ -1086,17 +1190,17 @@ const Xe = (e) => {
|
|
|
1086
1190
|
]),
|
|
1087
1191
|
_: 1
|
|
1088
1192
|
}, 512), [
|
|
1089
|
-
[
|
|
1193
|
+
[be, n.value === "form" || !e.component]
|
|
1090
1194
|
])
|
|
1091
1195
|
]),
|
|
1092
1196
|
_: 1
|
|
1093
1197
|
});
|
|
1094
1198
|
};
|
|
1095
1199
|
}
|
|
1096
|
-
}),
|
|
1200
|
+
}), ql = { class: "_fc-json-preview-down" }, Jl = {
|
|
1097
1201
|
key: 0,
|
|
1098
1202
|
class: "gb-fc-json-error"
|
|
1099
|
-
},
|
|
1203
|
+
}, Yl = /* @__PURE__ */ Object.assign({ name: "FcJsonPanel" }, {
|
|
1100
1204
|
__name: "FcJsonPanel",
|
|
1101
1205
|
props: {
|
|
1102
1206
|
components: { type: Array, required: !0 },
|
|
@@ -1105,57 +1209,57 @@ const Xe = (e) => {
|
|
|
1105
1209
|
},
|
|
1106
1210
|
emits: ["update:components", "update:formOptions"],
|
|
1107
1211
|
setup(e, { expose: l, emit: t }) {
|
|
1108
|
-
const
|
|
1212
|
+
const n = e, u = t, r = P("rule"), p = P(JSON.stringify(n.components, null, 2)), i = P("");
|
|
1109
1213
|
let h = "";
|
|
1110
|
-
const b = () =>
|
|
1111
|
-
|
|
1112
|
-
},
|
|
1214
|
+
const b = () => r.value === "rule" ? JSON.stringify(n.components, null, 2) : JSON.stringify(n.formOptions, null, 2), O = (D) => {
|
|
1215
|
+
r.value = D, p.value = b(), i.value = "";
|
|
1216
|
+
}, I = () => {
|
|
1113
1217
|
h = b();
|
|
1114
1218
|
}, _ = () => {
|
|
1115
|
-
if (
|
|
1219
|
+
if (i.value = "", p.value.trim() !== h.trim())
|
|
1116
1220
|
try {
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1119
|
-
if (!Array.isArray(
|
|
1120
|
-
u("update:components",
|
|
1221
|
+
const D = JSON.parse(p.value);
|
|
1222
|
+
if (r.value === "rule") {
|
|
1223
|
+
if (!Array.isArray(D)) throw new Error("表单规则必须是数组");
|
|
1224
|
+
u("update:components", D);
|
|
1121
1225
|
} else
|
|
1122
|
-
u("update:formOptions",
|
|
1123
|
-
|
|
1124
|
-
} catch (
|
|
1125
|
-
|
|
1226
|
+
u("update:formOptions", D || {});
|
|
1227
|
+
ae.success("JSON 已应用");
|
|
1228
|
+
} catch (D) {
|
|
1229
|
+
i.value = `JSON 解析失败:${D.message}`;
|
|
1126
1230
|
}
|
|
1127
|
-
},
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1231
|
+
}, V = () => {
|
|
1232
|
+
const D = r.value === "rule" ? { rule: n.components, options: n.formOptions } : { options: n.formOptions, rule: n.components }, A = new Blob([JSON.stringify(D, null, 2)], { type: "application/json" }), S = URL.createObjectURL(A), x = document.createElement("a");
|
|
1233
|
+
x.href = S, x.download = `fc-json-${Date.now()}.json`, x.click(), setTimeout(() => URL.revokeObjectURL(S), 0);
|
|
1130
1234
|
};
|
|
1131
|
-
return l({ refresh: () => p.value = b() }), (
|
|
1132
|
-
const
|
|
1133
|
-
return
|
|
1235
|
+
return l({ refresh: () => p.value = b() }), (D, A) => {
|
|
1236
|
+
const S = N("el-tooltip"), x = N("el-header"), ne = N("el-main"), ie = N("el-container");
|
|
1237
|
+
return f(), k(ie, { class: "_fc-json-preview" }, {
|
|
1134
1238
|
default: y(() => [
|
|
1135
|
-
|
|
1239
|
+
m(x, {
|
|
1136
1240
|
height: "40px",
|
|
1137
1241
|
class: "_fc-l-tabs"
|
|
1138
1242
|
}, {
|
|
1139
1243
|
default: y(() => [
|
|
1140
|
-
|
|
1141
|
-
class:
|
|
1142
|
-
onClick: A[0] || (A[0] = (K) =>
|
|
1244
|
+
s("div", {
|
|
1245
|
+
class: U(["_fc-l-tab", { active: r.value === "rule" }]),
|
|
1246
|
+
onClick: A[0] || (A[0] = (K) => O("rule"))
|
|
1143
1247
|
}, "表单规则", 2),
|
|
1144
|
-
|
|
1145
|
-
class:
|
|
1146
|
-
onClick: A[1] || (A[1] = (K) =>
|
|
1248
|
+
s("div", {
|
|
1249
|
+
class: U(["_fc-l-tab", { active: r.value === "options" }]),
|
|
1250
|
+
onClick: A[1] || (A[1] = (K) => O("options"))
|
|
1147
1251
|
}, "表单配置", 2),
|
|
1148
|
-
|
|
1149
|
-
|
|
1252
|
+
s("div", ql, [
|
|
1253
|
+
m(S, {
|
|
1150
1254
|
effect: "dark",
|
|
1151
1255
|
content: "导出 JSON",
|
|
1152
1256
|
placement: "top",
|
|
1153
1257
|
"hide-after": 0
|
|
1154
1258
|
}, {
|
|
1155
1259
|
default: y(() => [
|
|
1156
|
-
|
|
1260
|
+
s("i", {
|
|
1157
1261
|
class: "fc-icon icon-download",
|
|
1158
|
-
onClick:
|
|
1262
|
+
onClick: V
|
|
1159
1263
|
})
|
|
1160
1264
|
]),
|
|
1161
1265
|
_: 1
|
|
@@ -1164,18 +1268,18 @@ const Xe = (e) => {
|
|
|
1164
1268
|
]),
|
|
1165
1269
|
_: 1
|
|
1166
1270
|
}),
|
|
1167
|
-
|
|
1271
|
+
m(ne, { style: { padding: "8px" } }, {
|
|
1168
1272
|
default: y(() => [
|
|
1169
|
-
|
|
1273
|
+
me(s("textarea", {
|
|
1170
1274
|
"onUpdate:modelValue": A[2] || (A[2] = (K) => p.value = K),
|
|
1171
1275
|
class: "gb-fc-json-editor",
|
|
1172
1276
|
spellcheck: "false",
|
|
1173
|
-
onFocus:
|
|
1277
|
+
onFocus: I,
|
|
1174
1278
|
onBlur: _
|
|
1175
1279
|
}, null, 544), [
|
|
1176
|
-
[
|
|
1280
|
+
[Ct, p.value]
|
|
1177
1281
|
]),
|
|
1178
|
-
|
|
1282
|
+
i.value ? (f(), w("div", Jl, se(i.value), 1)) : W("", !0)
|
|
1179
1283
|
]),
|
|
1180
1284
|
_: 1
|
|
1181
1285
|
})
|
|
@@ -1185,101 +1289,101 @@ const Xe = (e) => {
|
|
|
1185
1289
|
};
|
|
1186
1290
|
}
|
|
1187
1291
|
});
|
|
1188
|
-
function
|
|
1189
|
-
const e = (
|
|
1190
|
-
Z(
|
|
1292
|
+
function Kl() {
|
|
1293
|
+
const e = (r) => {
|
|
1294
|
+
Z(r);
|
|
1191
1295
|
const p = [];
|
|
1192
|
-
if (
|
|
1193
|
-
const
|
|
1296
|
+
if (r.required) {
|
|
1297
|
+
const i = r.type === d.CHECKBOX_GROUP, h = r.type === d.RADIO_GROUP || r.type === d.SELECT;
|
|
1194
1298
|
p.push({
|
|
1195
1299
|
required: !0,
|
|
1196
|
-
...
|
|
1197
|
-
message:
|
|
1198
|
-
trigger: h ||
|
|
1300
|
+
...i ? { type: "array" } : {},
|
|
1301
|
+
message: i || h ? `请选择${r.props?.label || "该字段"}` : `请输入${r.props?.label || "该字段"}`,
|
|
1302
|
+
trigger: h || i ? "change" : "blur"
|
|
1199
1303
|
});
|
|
1200
1304
|
}
|
|
1201
|
-
return
|
|
1305
|
+
return r.type === d.INPUT_NUMBER && (r.min !== void 0 && p.push({
|
|
1202
1306
|
type: "number",
|
|
1203
|
-
min:
|
|
1204
|
-
message: `数值不能小于 ${
|
|
1307
|
+
min: r.min,
|
|
1308
|
+
message: `数值不能小于 ${r.min}`,
|
|
1205
1309
|
trigger: "blur"
|
|
1206
|
-
}),
|
|
1310
|
+
}), r.max !== void 0 && p.push({
|
|
1207
1311
|
type: "number",
|
|
1208
|
-
max:
|
|
1209
|
-
message: `数值不能大于 ${
|
|
1312
|
+
max: r.max,
|
|
1313
|
+
message: `数值不能大于 ${r.max}`,
|
|
1210
1314
|
trigger: "blur"
|
|
1211
1315
|
})), p.length > 0 ? p : void 0;
|
|
1212
1316
|
};
|
|
1213
1317
|
return {
|
|
1214
|
-
generateFormRules: (
|
|
1215
|
-
const p = {},
|
|
1318
|
+
generateFormRules: (r) => {
|
|
1319
|
+
const p = {}, i = {}, h = (b) => {
|
|
1216
1320
|
if (b.type === d.ROW) {
|
|
1217
1321
|
b.children && b.children.forEach((_) => {
|
|
1218
|
-
Array.isArray(_) && _.forEach((
|
|
1219
|
-
h(
|
|
1322
|
+
Array.isArray(_) && _.forEach((V) => {
|
|
1323
|
+
h(V);
|
|
1220
1324
|
});
|
|
1221
1325
|
});
|
|
1222
1326
|
return;
|
|
1223
1327
|
}
|
|
1224
|
-
const
|
|
1225
|
-
if (
|
|
1328
|
+
const O = Z(b), I = e(b);
|
|
1329
|
+
if (I && (i[O] = I), !(O in p))
|
|
1226
1330
|
if (b.defaultValue !== void 0 && b.defaultValue !== null)
|
|
1227
1331
|
if (b.type === d.DATE_PICKER) {
|
|
1228
1332
|
const _ = b.defaultValue;
|
|
1229
1333
|
if (_ === "today")
|
|
1230
|
-
p[
|
|
1334
|
+
p[O] = /* @__PURE__ */ new Date();
|
|
1231
1335
|
else if (_ === "tomorrow") {
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1336
|
+
const V = /* @__PURE__ */ new Date();
|
|
1337
|
+
V.setDate(V.getDate() + 1), p[O] = V;
|
|
1234
1338
|
} else
|
|
1235
|
-
p[
|
|
1339
|
+
p[O] = _;
|
|
1236
1340
|
} else
|
|
1237
|
-
p[
|
|
1341
|
+
p[O] = b.defaultValue;
|
|
1238
1342
|
else
|
|
1239
|
-
b.type === d.INPUT_NUMBER ? p[
|
|
1343
|
+
b.type === d.INPUT_NUMBER ? p[O] = null : b.type === d.RADIO_GROUP || b.type === d.SELECT || b.type === d.TEXTAREA ? p[O] = "" : b.type === d.DATE_PICKER ? p[O] = null : b.type === d.CHECKBOX_GROUP ? p[O] = [] : b.type === d.SWITCH ? p[O] = !1 : p[O] = "";
|
|
1240
1344
|
};
|
|
1241
|
-
return Array.isArray(
|
|
1345
|
+
return Array.isArray(r) && r.forEach((b) => {
|
|
1242
1346
|
h(b);
|
|
1243
|
-
}), { data: p, rules:
|
|
1347
|
+
}), { data: p, rules: i };
|
|
1244
1348
|
},
|
|
1245
|
-
validateForm: async (
|
|
1246
|
-
if (!
|
|
1349
|
+
validateForm: async (r) => {
|
|
1350
|
+
if (!r)
|
|
1247
1351
|
throw new Error("表单引用不存在");
|
|
1248
|
-
return await
|
|
1352
|
+
return await r.validate();
|
|
1249
1353
|
},
|
|
1250
|
-
resetForm: (
|
|
1251
|
-
|
|
1354
|
+
resetForm: (r) => {
|
|
1355
|
+
r && r.resetFields();
|
|
1252
1356
|
},
|
|
1253
|
-
getFormData: (
|
|
1254
|
-
const
|
|
1357
|
+
getFormData: (r, p) => {
|
|
1358
|
+
const i = {}, h = (b) => {
|
|
1255
1359
|
if (b.type === d.ROW) {
|
|
1256
|
-
b.children && b.children.forEach((
|
|
1257
|
-
Array.isArray(
|
|
1360
|
+
b.children && b.children.forEach((I) => {
|
|
1361
|
+
Array.isArray(I) && I.forEach((_) => {
|
|
1258
1362
|
h(_);
|
|
1259
1363
|
});
|
|
1260
1364
|
});
|
|
1261
1365
|
return;
|
|
1262
1366
|
}
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1367
|
+
const O = Z(b);
|
|
1368
|
+
O in r && (i[O] = {
|
|
1265
1369
|
name: b.props?.label || "",
|
|
1266
|
-
value:
|
|
1370
|
+
value: r[O],
|
|
1267
1371
|
type: b.type
|
|
1268
1372
|
});
|
|
1269
1373
|
};
|
|
1270
1374
|
return Array.isArray(p) && p.forEach((b) => {
|
|
1271
1375
|
h(b);
|
|
1272
|
-
}),
|
|
1376
|
+
}), i;
|
|
1273
1377
|
}
|
|
1274
1378
|
};
|
|
1275
1379
|
}
|
|
1276
|
-
const
|
|
1380
|
+
const Ql = { class: "form-view-container" }, Xl = { class: "form-view-content" }, Zl = ["data-width"], en = {
|
|
1277
1381
|
key: 1,
|
|
1278
1382
|
class: "empty-state"
|
|
1279
|
-
},
|
|
1383
|
+
}, tn = {
|
|
1280
1384
|
key: 0,
|
|
1281
1385
|
class: "form-result"
|
|
1282
|
-
},
|
|
1386
|
+
}, ln = /* @__PURE__ */ Object.assign({ name: "GbFormViewer" }, {
|
|
1283
1387
|
__name: "FormViewer",
|
|
1284
1388
|
props: {
|
|
1285
1389
|
formConfig: {
|
|
@@ -1296,168 +1400,168 @@ const Fl = { class: "form-view-container" }, Bl = { class: "form-view-content" }
|
|
|
1296
1400
|
}
|
|
1297
1401
|
},
|
|
1298
1402
|
setup(e, { expose: l }) {
|
|
1299
|
-
const t = e,
|
|
1300
|
-
if (
|
|
1403
|
+
const t = e, n = P(null), u = Ne({}), r = Ne({}), p = P(!1), { generateFormRules: i } = Kl(), h = (I) => {
|
|
1404
|
+
if (I.type === d.ROW)
|
|
1301
1405
|
return { width: "100%" };
|
|
1302
|
-
if (
|
|
1303
|
-
const _ =
|
|
1304
|
-
let
|
|
1305
|
-
return typeof _ == "string" && _.includes("%") ?
|
|
1306
|
-
width:
|
|
1307
|
-
"--item-width":
|
|
1406
|
+
if (I.style?.width) {
|
|
1407
|
+
const _ = I.style.width;
|
|
1408
|
+
let V = _;
|
|
1409
|
+
return typeof _ == "string" && _.includes("%") ? V = _ : typeof _ == "number" && (V = `${_}%`), {
|
|
1410
|
+
width: V,
|
|
1411
|
+
"--item-width": V
|
|
1308
1412
|
};
|
|
1309
1413
|
}
|
|
1310
1414
|
return { width: "100%" };
|
|
1311
1415
|
}, b = () => {
|
|
1312
|
-
Object.keys(u).forEach((
|
|
1313
|
-
const { data:
|
|
1314
|
-
Object.assign(u,
|
|
1416
|
+
Object.keys(u).forEach((V) => delete u[V]), Object.keys(r).forEach((V) => delete r[V]);
|
|
1417
|
+
const { data: I, rules: _ } = i(t.formConfig);
|
|
1418
|
+
Object.assign(u, I), Object.assign(r, _);
|
|
1315
1419
|
};
|
|
1316
|
-
|
|
1420
|
+
ke(() => t.formConfig, () => {
|
|
1317
1421
|
b();
|
|
1318
1422
|
}, { immediate: !0, deep: !0 });
|
|
1319
|
-
const
|
|
1320
|
-
u[
|
|
1423
|
+
const O = (I, _) => {
|
|
1424
|
+
u[I] = _;
|
|
1321
1425
|
};
|
|
1322
1426
|
return l({
|
|
1323
1427
|
formData: u,
|
|
1324
|
-
formRef:
|
|
1325
|
-
formRules:
|
|
1326
|
-
}), (
|
|
1327
|
-
const
|
|
1328
|
-
return
|
|
1329
|
-
|
|
1330
|
-
e.formConfig && e.formConfig.length > 0 ? (
|
|
1428
|
+
formRef: n,
|
|
1429
|
+
formRules: r
|
|
1430
|
+
}), (I, _) => {
|
|
1431
|
+
const V = N("el-form"), D = N("el-empty"), A = N("el-divider");
|
|
1432
|
+
return f(), w("div", Ql, [
|
|
1433
|
+
s("div", Xl, [
|
|
1434
|
+
e.formConfig && e.formConfig.length > 0 ? (f(), k(V, {
|
|
1331
1435
|
key: 0,
|
|
1332
1436
|
ref_key: "formRef",
|
|
1333
|
-
ref:
|
|
1437
|
+
ref: n,
|
|
1334
1438
|
model: u,
|
|
1335
|
-
rules:
|
|
1439
|
+
rules: r,
|
|
1336
1440
|
disabled: e.readonly,
|
|
1337
1441
|
"label-width": "120px",
|
|
1338
1442
|
class: "form-wrapper"
|
|
1339
1443
|
}, {
|
|
1340
1444
|
default: y(() => [
|
|
1341
|
-
(
|
|
1342
|
-
key:
|
|
1343
|
-
class:
|
|
1344
|
-
style:
|
|
1345
|
-
"data-width":
|
|
1445
|
+
(f(!0), w(z, null, G(e.formConfig, (S, x) => (f(), w("div", {
|
|
1446
|
+
key: x,
|
|
1447
|
+
class: U(["form-item-wrapper", { "is-row": S.type === C(d).ROW }]),
|
|
1448
|
+
style: kt(h(S)),
|
|
1449
|
+
"data-width": S.style?.width
|
|
1346
1450
|
}, [
|
|
1347
|
-
|
|
1348
|
-
component:
|
|
1451
|
+
m(dt, {
|
|
1452
|
+
component: S,
|
|
1349
1453
|
"form-data": u,
|
|
1350
|
-
"form-rules":
|
|
1454
|
+
"form-rules": r,
|
|
1351
1455
|
readonly: e.readonly,
|
|
1352
|
-
"onUpdate:value":
|
|
1456
|
+
"onUpdate:value": O
|
|
1353
1457
|
}, null, 8, ["component", "form-data", "form-rules", "readonly"])
|
|
1354
|
-
], 14,
|
|
1458
|
+
], 14, Zl))), 128))
|
|
1355
1459
|
]),
|
|
1356
1460
|
_: 1
|
|
1357
|
-
}, 8, ["model", "rules", "disabled"])) : (
|
|
1358
|
-
|
|
1461
|
+
}, 8, ["model", "rules", "disabled"])) : (f(), w("div", en, [
|
|
1462
|
+
m(D, { description: "暂无表单配置,请先设计表单" })
|
|
1359
1463
|
]))
|
|
1360
1464
|
]),
|
|
1361
|
-
p.value ? (
|
|
1362
|
-
|
|
1465
|
+
p.value ? (f(), w("div", tn, [
|
|
1466
|
+
m(A, null, {
|
|
1363
1467
|
default: y(() => [..._[0] || (_[0] = [
|
|
1364
1468
|
Y("提交结果", -1)
|
|
1365
1469
|
])]),
|
|
1366
1470
|
_: 1
|
|
1367
1471
|
}),
|
|
1368
|
-
|
|
1369
|
-
])) :
|
|
1472
|
+
s("pre", null, se(JSON.stringify(u, null, 2)), 1)
|
|
1473
|
+
])) : W("", !0)
|
|
1370
1474
|
]);
|
|
1371
1475
|
};
|
|
1372
1476
|
}
|
|
1373
|
-
}),
|
|
1374
|
-
function
|
|
1375
|
-
const l = [], t = e.props?.label || "",
|
|
1376
|
-
return t && l.push(`label="${J(t)}"`),
|
|
1477
|
+
}), ct = /* @__PURE__ */ ut(ln, [["__scopeId", "data-v-806779a4"]]), J = (e) => String(e ?? "").replace(/"/g, """);
|
|
1478
|
+
function nn(e) {
|
|
1479
|
+
const l = [], t = e.props?.label || "", n = e.props?.variableName || "";
|
|
1480
|
+
return t && l.push(`label="${J(t)}"`), n && l.push(`prop="${J(n)}"`), e.required && l.push("required"), l.join(" ");
|
|
1377
1481
|
}
|
|
1378
|
-
function
|
|
1379
|
-
const t = " ".repeat(l),
|
|
1482
|
+
function tt(e, l) {
|
|
1483
|
+
const t = " ".repeat(l), n = nn(e), u = e.props?.variableName || "", r = [];
|
|
1380
1484
|
switch (e.type) {
|
|
1381
1485
|
case d.INPUT:
|
|
1382
|
-
|
|
1486
|
+
r.push(`${t} <el-input v-model="formData.${u}" placeholder="${J(e.props?.placeholder || "")}" />`);
|
|
1383
1487
|
break;
|
|
1384
1488
|
case d.TEXTAREA:
|
|
1385
|
-
|
|
1489
|
+
r.push(`${t} <el-input v-model="formData.${u}" type="textarea" :rows="${e.props?.rows || 3}" placeholder="${J(e.props?.placeholder || "")}" />`);
|
|
1386
1490
|
break;
|
|
1387
1491
|
case d.INPUT_NUMBER:
|
|
1388
|
-
|
|
1492
|
+
r.push(`${t} <el-input-number v-model="formData.${u}" :min="${e.min ?? 0}" :max="${e.max ?? 100}" />`);
|
|
1389
1493
|
break;
|
|
1390
1494
|
case d.RADIO_GROUP:
|
|
1391
1495
|
(e.props?.options || []).forEach((p) => {
|
|
1392
|
-
|
|
1393
|
-
}),
|
|
1496
|
+
r.push(`${t} <el-radio value="${J(p.value)}">${J(p.label)}</el-radio>`);
|
|
1497
|
+
}), r.unshift(`${t} <el-radio-group v-model="formData.${u}">`), r.push(`${t} </el-radio-group>`);
|
|
1394
1498
|
break;
|
|
1395
1499
|
case d.CHECKBOX_GROUP:
|
|
1396
1500
|
(e.props?.options || []).forEach((p) => {
|
|
1397
|
-
|
|
1398
|
-
}),
|
|
1501
|
+
r.push(`${t} <el-checkbox value="${J(p.value)}">${J(p.label)}</el-checkbox>`);
|
|
1502
|
+
}), r.unshift(`${t} <el-checkbox-group v-model="formData.${u}">`), r.push(`${t} </el-checkbox-group>`);
|
|
1399
1503
|
break;
|
|
1400
1504
|
case d.SELECT:
|
|
1401
1505
|
(e.props?.options || []).forEach((p) => {
|
|
1402
|
-
|
|
1403
|
-
}),
|
|
1506
|
+
r.push(`${t} <el-option label="${J(p.label)}" value="${J(p.value)}" />`);
|
|
1507
|
+
}), r.unshift(`${t} <el-select v-model="formData.${u}" placeholder="${J(e.props?.placeholder || "")}">`), r.push(`${t} </el-select>`);
|
|
1404
1508
|
break;
|
|
1405
1509
|
case d.SWITCH:
|
|
1406
|
-
|
|
1510
|
+
r.push(`${t} <el-switch v-model="formData.${u}" />`);
|
|
1407
1511
|
break;
|
|
1408
1512
|
case d.DATE_PICKER:
|
|
1409
|
-
|
|
1513
|
+
r.push(`${t} <el-date-picker v-model="formData.${u}" type="date" placeholder="${J(e.props?.placeholder || "")}" />`);
|
|
1410
1514
|
break;
|
|
1411
1515
|
default:
|
|
1412
|
-
|
|
1516
|
+
r.push(`${t} <el-input v-model="formData.${u}" />`);
|
|
1413
1517
|
}
|
|
1414
|
-
return `${t}<el-form-item ${
|
|
1415
|
-
${
|
|
1518
|
+
return `${t}<el-form-item ${n}>
|
|
1519
|
+
${r.join(`
|
|
1416
1520
|
`)}
|
|
1417
1521
|
${t}</el-form-item>`;
|
|
1418
1522
|
}
|
|
1419
|
-
function
|
|
1523
|
+
function on(e, l = {}) {
|
|
1420
1524
|
const t = [];
|
|
1421
|
-
return (e || []).forEach((
|
|
1422
|
-
if (
|
|
1423
|
-
const u =
|
|
1424
|
-
t.push('<el-row :gutter="' + (
|
|
1425
|
-
t.push(' <el-col :span="' + (
|
|
1426
|
-
t.push(
|
|
1525
|
+
return (e || []).forEach((n) => {
|
|
1526
|
+
if (n.type === d.ROW) {
|
|
1527
|
+
const u = n.props?.columns || [];
|
|
1528
|
+
t.push('<el-row :gutter="' + (n.props?.gutter || 20) + '">'), u.forEach((r, p) => {
|
|
1529
|
+
t.push(' <el-col :span="' + (r.span || 12) + '">'), (n.children?.[p] || []).forEach((i) => {
|
|
1530
|
+
t.push(tt(i, 4));
|
|
1427
1531
|
}), t.push(" </el-col>");
|
|
1428
1532
|
}), t.push("</el-row>");
|
|
1429
1533
|
} else
|
|
1430
|
-
t.push(
|
|
1534
|
+
t.push(tt(n, 0));
|
|
1431
1535
|
}), `<template>
|
|
1432
1536
|
<el-form :model="formData" label-width="${l.labelWidth || "120px"}"${l.size && l.size !== "default" ? ` size="${l.size}"` : ""}>
|
|
1433
1537
|
${t.join(`
|
|
1434
1538
|
`).split(`
|
|
1435
|
-
`).map((
|
|
1539
|
+
`).map((n) => " " + n).join(`
|
|
1436
1540
|
`)}
|
|
1437
1541
|
</el-form>
|
|
1438
1542
|
</template>`;
|
|
1439
1543
|
}
|
|
1440
|
-
function
|
|
1441
|
-
const t = [],
|
|
1442
|
-
const p = " ".repeat(
|
|
1544
|
+
function an(e, l = {}) {
|
|
1545
|
+
const t = [], n = (u, r) => {
|
|
1546
|
+
const p = " ".repeat(r), i = J(u.props?.label || ""), h = J(u.props?.variableName || "");
|
|
1443
1547
|
if (u.type === d.ROW) {
|
|
1444
1548
|
const b = u.props?.columns || [];
|
|
1445
|
-
t.push(`${p}<div class="row">`), b.forEach((
|
|
1446
|
-
t.push(`${p} <div class="col-${
|
|
1549
|
+
t.push(`${p}<div class="row">`), b.forEach((O, I) => {
|
|
1550
|
+
t.push(`${p} <div class="col-${O.span || 12}">`), (u.children?.[I] || []).forEach((_) => n(_, r + 4)), t.push(`${p} </div>`);
|
|
1447
1551
|
}), t.push(`${p}</div>`);
|
|
1448
1552
|
return;
|
|
1449
1553
|
}
|
|
1450
|
-
t.push(`${p}<div class="form-item">`), t.push(`${p} <label>${
|
|
1554
|
+
t.push(`${p}<div class="form-item">`), t.push(`${p} <label>${i}${u.required ? " <em>*</em>" : ""}</label>`), t.push(`${p} <div class="form-item-body" data-field="${h}" data-type="${u.type}"></div>`), t.push(`${p}</div>`);
|
|
1451
1555
|
};
|
|
1452
|
-
return (e || []).forEach((u) =>
|
|
1556
|
+
return (e || []).forEach((u) => n(u, 0)), `<form class="gb-flow-form"${l.labelWidth ? ` style="--label-width:${l.labelWidth}"` : ""}>
|
|
1453
1557
|
${t.join(`
|
|
1454
1558
|
`)}
|
|
1455
1559
|
</form>`;
|
|
1456
1560
|
}
|
|
1457
|
-
const
|
|
1561
|
+
const sn = { class: "_fd-preview-tabs el-tabs" }, rn = { class: "el-tabs__header" }, un = { class: "el-tabs__nav-wrap" }, dn = { class: "el-tabs__nav" }, cn = ["onClick"], pn = {
|
|
1458
1562
|
key: 2,
|
|
1459
1563
|
class: "_fd-preview-code"
|
|
1460
|
-
},
|
|
1564
|
+
}, mn = /* @__PURE__ */ Object.assign({ name: "FcPreviewDialog" }, {
|
|
1461
1565
|
__name: "FcPreviewDialog",
|
|
1462
1566
|
props: {
|
|
1463
1567
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -1470,60 +1574,59 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1470
1574
|
{ label: "表单模式", value: "form" },
|
|
1471
1575
|
{ label: "组件模式", value: "component" },
|
|
1472
1576
|
{ label: "HTML 模式", value: "html" }
|
|
1473
|
-
],
|
|
1474
|
-
const
|
|
1577
|
+
], n = P("form"), u = B(() => on(l.components, l.formOptions)), r = B(() => an(l.components, l.formOptions)), p = async () => {
|
|
1578
|
+
const i = n.value === "component" ? u.value : r.value;
|
|
1475
1579
|
try {
|
|
1476
|
-
await navigator.clipboard.writeText(
|
|
1580
|
+
await navigator.clipboard.writeText(i), ae.success("代码已复制");
|
|
1477
1581
|
} catch {
|
|
1478
|
-
|
|
1582
|
+
ae.warning("复制失败,请手动复制");
|
|
1479
1583
|
}
|
|
1480
1584
|
};
|
|
1481
|
-
return (
|
|
1482
|
-
const b =
|
|
1483
|
-
return
|
|
1585
|
+
return (i, h) => {
|
|
1586
|
+
const b = N("el-dialog");
|
|
1587
|
+
return f(), k(b, {
|
|
1484
1588
|
"model-value": e.modelValue,
|
|
1485
1589
|
width: "80%",
|
|
1486
1590
|
class: "_fd-preview-dialog",
|
|
1487
1591
|
"append-to-body": "",
|
|
1488
|
-
"onUpdate:modelValue": h[0] || (h[0] = (
|
|
1592
|
+
"onUpdate:modelValue": h[0] || (h[0] = (O) => i.$emit("update:modelValue", O))
|
|
1489
1593
|
}, {
|
|
1490
1594
|
default: y(() => [
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
(
|
|
1496
|
-
key:
|
|
1497
|
-
class:
|
|
1498
|
-
onClick: (
|
|
1499
|
-
},
|
|
1595
|
+
s("div", sn, [
|
|
1596
|
+
s("div", rn, [
|
|
1597
|
+
s("div", un, [
|
|
1598
|
+
s("div", dn, [
|
|
1599
|
+
(f(), w(z, null, G(t, (O) => s("div", {
|
|
1600
|
+
key: O.value,
|
|
1601
|
+
class: U(["el-tabs__item", { "is-active": n.value === O.value }]),
|
|
1602
|
+
onClick: (I) => n.value = O.value
|
|
1603
|
+
}, se(O.label), 11, cn)), 64))
|
|
1500
1604
|
])
|
|
1501
1605
|
])
|
|
1502
1606
|
])
|
|
1503
1607
|
]),
|
|
1504
|
-
|
|
1608
|
+
n.value !== "form" ? (f(), w("div", {
|
|
1505
1609
|
key: 0,
|
|
1506
1610
|
class: "_fd-preview-copy",
|
|
1507
1611
|
onClick: p
|
|
1508
1612
|
}, [...h[1] || (h[1] = [
|
|
1509
|
-
|
|
1510
|
-
])])) :
|
|
1511
|
-
|
|
1613
|
+
s("i", { class: "fc-icon icon-copy" }, null, -1)
|
|
1614
|
+
])])) : W("", !0),
|
|
1615
|
+
n.value === "form" ? (f(), k(ct, {
|
|
1512
1616
|
key: 1,
|
|
1513
1617
|
"form-config": e.components
|
|
1514
|
-
}, null, 8, ["form-config"])) : (
|
|
1515
|
-
|
|
1618
|
+
}, null, 8, ["form-config"])) : (f(), w("pre", pn, [
|
|
1619
|
+
s("code", null, se(n.value === "component" ? u.value : r.value), 1)
|
|
1516
1620
|
]))
|
|
1517
1621
|
]),
|
|
1518
1622
|
_: 1
|
|
1519
1623
|
}, 8, ["model-value"]);
|
|
1520
1624
|
};
|
|
1521
1625
|
}
|
|
1522
|
-
}),
|
|
1626
|
+
}), fn = [
|
|
1523
1627
|
{
|
|
1524
1628
|
name: "文本输入框",
|
|
1525
1629
|
type: d.INPUT,
|
|
1526
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="5" width="18" height="14" rx="2"/><line x1="7" y1="12" x2="17" y2="12"/><line x1="7" y1="9" x2="10" y2="9"/></svg>',
|
|
1527
1630
|
value: "",
|
|
1528
1631
|
required: !0,
|
|
1529
1632
|
defaultValue: "",
|
|
@@ -1539,7 +1642,6 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1539
1642
|
{
|
|
1540
1643
|
name: "多行文本",
|
|
1541
1644
|
type: d.TEXTAREA,
|
|
1542
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="16" rx="2"/><line x1="7" y1="9" x2="17" y2="9"/><line x1="7" y1="12" x2="17" y2="12"/><line x1="7" y1="15" x2="13" y2="15"/></svg>',
|
|
1543
1645
|
value: "",
|
|
1544
1646
|
required: !0,
|
|
1545
1647
|
defaultValue: "",
|
|
@@ -1556,7 +1658,6 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1556
1658
|
{
|
|
1557
1659
|
name: "数字输入框",
|
|
1558
1660
|
type: d.INPUT_NUMBER,
|
|
1559
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="5" width="18" height="14" rx="2"/><line x1="7" y1="10" x2="7" y2="14"/><line x1="10" y1="10" x2="10" y2="14"/><line x1="13" y1="10" x2="13" y2="14"/></svg>',
|
|
1560
1661
|
value: null,
|
|
1561
1662
|
required: !0,
|
|
1562
1663
|
min: 1,
|
|
@@ -1574,7 +1675,6 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1574
1675
|
{
|
|
1575
1676
|
name: "单选框",
|
|
1576
1677
|
type: d.RADIO_GROUP,
|
|
1577
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="4" fill="currentColor"/></svg>',
|
|
1578
1678
|
value: "",
|
|
1579
1679
|
required: !0,
|
|
1580
1680
|
defaultValue: "1",
|
|
@@ -1594,7 +1694,6 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1594
1694
|
{
|
|
1595
1695
|
name: "下拉选择",
|
|
1596
1696
|
type: d.SELECT,
|
|
1597
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="5" width="18" height="14" rx="2"/><polyline points="8 10 12 14 16 10"/></svg>',
|
|
1598
1697
|
value: "",
|
|
1599
1698
|
required: !0,
|
|
1600
1699
|
defaultValue: "",
|
|
@@ -1615,7 +1714,6 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1615
1714
|
{
|
|
1616
1715
|
name: "多选框",
|
|
1617
1716
|
type: d.CHECKBOX_GROUP,
|
|
1618
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="7" height="7" rx="1"/><polyline points="4.5 7.5 6 9 9 6"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="4" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>',
|
|
1619
1717
|
value: [],
|
|
1620
1718
|
required: !0,
|
|
1621
1719
|
defaultValue: [],
|
|
@@ -1635,7 +1733,6 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1635
1733
|
{
|
|
1636
1734
|
name: "开关",
|
|
1637
1735
|
type: d.SWITCH,
|
|
1638
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="7" width="20" height="10" rx="5"/><circle cx="16" cy="12" r="3" fill="currentColor"/></svg>',
|
|
1639
1736
|
value: !1,
|
|
1640
1737
|
required: !1,
|
|
1641
1738
|
defaultValue: !1,
|
|
@@ -1652,7 +1749,6 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1652
1749
|
{
|
|
1653
1750
|
name: "日期选择器",
|
|
1654
1751
|
type: d.DATE_PICKER,
|
|
1655
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="3" y1="10" x2="21" y2="10"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="16" y1="2" x2="16" y2="6"/><circle cx="12" cy="15" r="1.5" fill="currentColor"/></svg>',
|
|
1656
1752
|
value: null,
|
|
1657
1753
|
required: !0,
|
|
1658
1754
|
defaultValue: null,
|
|
@@ -1665,11 +1761,10 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1665
1761
|
width: "100%"
|
|
1666
1762
|
}
|
|
1667
1763
|
}
|
|
1668
|
-
],
|
|
1764
|
+
], vn = [
|
|
1669
1765
|
{
|
|
1670
1766
|
name: "分栏",
|
|
1671
1767
|
type: d.ROW,
|
|
1672
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="4" width="9" height="16" rx="1"/><rect x="13" y="4" width="9" height="16" rx="1"/></svg>',
|
|
1673
1768
|
value: null,
|
|
1674
1769
|
required: !1,
|
|
1675
1770
|
props: {
|
|
@@ -1684,26 +1779,26 @@ const Yl = { class: "_fd-preview-tabs el-tabs" }, Kl = { class: "el-tabs__header
|
|
|
1684
1779
|
},
|
|
1685
1780
|
children: []
|
|
1686
1781
|
}
|
|
1687
|
-
],
|
|
1782
|
+
], lt = [
|
|
1688
1783
|
{
|
|
1689
1784
|
name: "基础组件",
|
|
1690
1785
|
key: "basic",
|
|
1691
|
-
templates:
|
|
1786
|
+
templates: fn
|
|
1692
1787
|
},
|
|
1693
1788
|
{
|
|
1694
1789
|
name: "布局组件",
|
|
1695
1790
|
key: "layout",
|
|
1696
|
-
templates:
|
|
1791
|
+
templates: vn
|
|
1697
1792
|
}
|
|
1698
|
-
],
|
|
1699
|
-
function
|
|
1793
|
+
], yn = "1.0.0", hn = "gbflow-form";
|
|
1794
|
+
function Oe(e) {
|
|
1700
1795
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
1701
1796
|
}
|
|
1702
|
-
function
|
|
1797
|
+
function bn(e) {
|
|
1703
1798
|
if (e !== void 0)
|
|
1704
1799
|
return JSON.parse(JSON.stringify(e));
|
|
1705
1800
|
}
|
|
1706
|
-
function
|
|
1801
|
+
function gn(e) {
|
|
1707
1802
|
if (typeof e != "string") return e;
|
|
1708
1803
|
const l = e.replace(/^\uFEFF/, "").trim();
|
|
1709
1804
|
if (!l) throw new Error("导入内容为空");
|
|
@@ -1713,16 +1808,16 @@ function sn(e) {
|
|
|
1713
1808
|
throw new Error(`JSON 解析失败:${t.message}`);
|
|
1714
1809
|
}
|
|
1715
1810
|
}
|
|
1716
|
-
function
|
|
1811
|
+
function Ue(e) {
|
|
1717
1812
|
const l = Array.isArray(e) ? e : e?.components, t = Array.isArray(e) ? {} : e?.options || {};
|
|
1718
1813
|
if (!Array.isArray(l)) return { components: [], options: { ...t }, repairs: [] };
|
|
1719
|
-
const
|
|
1720
|
-
const
|
|
1721
|
-
if (
|
|
1722
|
-
const h = Array.isArray(
|
|
1723
|
-
|
|
1814
|
+
const n = [], u = (r) => r.filter((p) => Oe(p) ? !0 : (n.push(`已忽略无效的表单组件配置:${JSON.stringify(p)}`), !1)).map((p) => {
|
|
1815
|
+
const i = bn(p);
|
|
1816
|
+
if (i.id || (i.id = Ae()), i.type || (i.type = d.INPUT, n.push("表单组件缺少 type,已按文本输入框处理")), Oe(i.props) || (i.props = {}), i.props.label === void 0 && (i.props.label = i.type), i.props.variableName === void 0 && (i.props.variableName = ""), i.props.options !== void 0 && (i.props.options = jt(i.props.options)), i.type === d.ROW) {
|
|
1817
|
+
const h = Array.isArray(i.children) ? i.children : [];
|
|
1818
|
+
i.children = h.map((b) => u(Array.isArray(b) ? b : [])), i.children.length || (i.children = [[], []]), i.props.columns || (i.props.columns = i.children.map(() => ({ span: 24 / i.children.length })));
|
|
1724
1819
|
}
|
|
1725
|
-
return
|
|
1820
|
+
return i;
|
|
1726
1821
|
});
|
|
1727
1822
|
return {
|
|
1728
1823
|
components: u(l),
|
|
@@ -1733,100 +1828,100 @@ function Se(e) {
|
|
|
1733
1828
|
size: t.size || "default",
|
|
1734
1829
|
...t
|
|
1735
1830
|
},
|
|
1736
|
-
repairs:
|
|
1831
|
+
repairs: n
|
|
1737
1832
|
};
|
|
1738
1833
|
}
|
|
1739
|
-
function
|
|
1740
|
-
const l = Array.isArray(e) ? e : e?.components || [], t = [],
|
|
1741
|
-
p.forEach((
|
|
1742
|
-
if (!
|
|
1743
|
-
if (
|
|
1744
|
-
|
|
1834
|
+
function Pe(e) {
|
|
1835
|
+
const l = Array.isArray(e) ? e : e?.components || [], t = [], n = [], u = /* @__PURE__ */ new Set(), r = (p) => {
|
|
1836
|
+
p.forEach((i) => {
|
|
1837
|
+
if (!i || typeof i != "object") return;
|
|
1838
|
+
if (i.type === d.ROW) {
|
|
1839
|
+
i.children?.forEach(r);
|
|
1745
1840
|
return;
|
|
1746
1841
|
}
|
|
1747
|
-
const h =
|
|
1842
|
+
const h = i.props?.variableName;
|
|
1748
1843
|
h ? (u.has(h) && t.push({
|
|
1749
1844
|
code: "DUPLICATE_VARIABLE",
|
|
1750
1845
|
message: `表单变量名重复:${h}`,
|
|
1751
|
-
componentId:
|
|
1752
|
-
}), u.add(h)) :
|
|
1846
|
+
componentId: i.id
|
|
1847
|
+
}), u.add(h)) : n.push({
|
|
1753
1848
|
code: "MISSING_VARIABLE",
|
|
1754
|
-
message: `表单项「${
|
|
1755
|
-
componentId:
|
|
1756
|
-
}),
|
|
1849
|
+
message: `表单项「${i.props?.label || i.type}」尚未设置变量名`,
|
|
1850
|
+
componentId: i.id
|
|
1851
|
+
}), i.props?.label || n.push({
|
|
1757
1852
|
code: "MISSING_LABEL",
|
|
1758
|
-
message: `表单项「${
|
|
1759
|
-
componentId:
|
|
1760
|
-
}), ["select", "radio-group", "checkbox-group"].includes(
|
|
1853
|
+
message: `表单项「${i.id}」尚未设置标签`,
|
|
1854
|
+
componentId: i.id
|
|
1855
|
+
}), ["select", "radio-group", "checkbox-group"].includes(i.type) && (!Array.isArray(i.props?.options) || i.props.options.length === 0) && n.push({
|
|
1761
1856
|
code: "MISSING_OPTIONS",
|
|
1762
|
-
message: `选项组件「${
|
|
1763
|
-
componentId:
|
|
1857
|
+
message: `选项组件「${i.props?.label || i.type}」还没有选项`,
|
|
1858
|
+
componentId: i.id
|
|
1764
1859
|
});
|
|
1765
1860
|
});
|
|
1766
1861
|
};
|
|
1767
|
-
return
|
|
1862
|
+
return r(l), { valid: t.length === 0, errors: t, warnings: n };
|
|
1768
1863
|
}
|
|
1769
|
-
function
|
|
1864
|
+
function Tn(e) {
|
|
1770
1865
|
return Object.keys(e || {}).reduce((l, t) => (e[t] !== void 0 && e[t] !== null && (l[t] = e[t]), l), {});
|
|
1771
1866
|
}
|
|
1772
|
-
function
|
|
1773
|
-
const
|
|
1774
|
-
schemaVersion:
|
|
1775
|
-
kind:
|
|
1776
|
-
meta:
|
|
1777
|
-
form: { components:
|
|
1867
|
+
function nt(e, l = {}, t = {}) {
|
|
1868
|
+
const n = Ue(e), u = {
|
|
1869
|
+
schemaVersion: yn,
|
|
1870
|
+
kind: hn,
|
|
1871
|
+
meta: Tn(l),
|
|
1872
|
+
form: { components: n.components, options: n.options }
|
|
1778
1873
|
};
|
|
1779
1874
|
return t.raw ? u : JSON.stringify(u, null, t.space ?? 2);
|
|
1780
1875
|
}
|
|
1781
|
-
function
|
|
1782
|
-
const l =
|
|
1876
|
+
function ot(e) {
|
|
1877
|
+
const l = gn(e);
|
|
1783
1878
|
if (Array.isArray(l)) {
|
|
1784
|
-
const
|
|
1879
|
+
const r = Ue(l);
|
|
1785
1880
|
return {
|
|
1786
|
-
components:
|
|
1787
|
-
options:
|
|
1788
|
-
repairs:
|
|
1789
|
-
validation:
|
|
1881
|
+
components: r.components,
|
|
1882
|
+
options: r.options,
|
|
1883
|
+
repairs: r.repairs,
|
|
1884
|
+
validation: Pe({ components: r.components })
|
|
1790
1885
|
};
|
|
1791
1886
|
}
|
|
1792
|
-
if (!
|
|
1887
|
+
if (!Oe(l)) throw new Error("无法识别的表单导入内容");
|
|
1793
1888
|
const t = l.form || l.formStructure || l.formConfig || l.rule || (l.components ? l : null);
|
|
1794
1889
|
if (!t) throw new Error("导入内容中未找到表单(components)");
|
|
1795
|
-
const
|
|
1796
|
-
...
|
|
1797
|
-
...
|
|
1890
|
+
const n = Ue(t), u = {
|
|
1891
|
+
...n.options,
|
|
1892
|
+
...Oe(l.options) ? l.options : {}
|
|
1798
1893
|
};
|
|
1799
1894
|
return {
|
|
1800
|
-
components:
|
|
1895
|
+
components: n.components,
|
|
1801
1896
|
options: u,
|
|
1802
|
-
repairs:
|
|
1803
|
-
meta:
|
|
1804
|
-
validation:
|
|
1897
|
+
repairs: n.repairs,
|
|
1898
|
+
meta: Oe(l.meta) ? l.meta : void 0,
|
|
1899
|
+
validation: Pe({ components: n.components })
|
|
1805
1900
|
};
|
|
1806
1901
|
}
|
|
1807
|
-
function
|
|
1902
|
+
function Kn(e, l = "flow") {
|
|
1808
1903
|
return String(e || l).trim().replace(/[\\/:*?"<>|]/g, "-").replace(/\s+/g, "-") || l;
|
|
1809
1904
|
}
|
|
1810
|
-
function
|
|
1905
|
+
function En(e, l, t = "application/json;charset=utf-8") {
|
|
1811
1906
|
if (typeof document > "u")
|
|
1812
1907
|
throw new Error("downloadText 只能在浏览器环境使用");
|
|
1813
|
-
const
|
|
1814
|
-
|
|
1908
|
+
const n = new Blob([e], { type: t }), u = URL.createObjectURL(n), r = document.createElement("a");
|
|
1909
|
+
r.href = u, r.download = l, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), setTimeout(() => URL.revokeObjectURL(u), 1e3);
|
|
1815
1910
|
}
|
|
1816
|
-
function
|
|
1817
|
-
const
|
|
1818
|
-
|
|
1911
|
+
function Nn(e, l = "flow.json", t = 2) {
|
|
1912
|
+
const n = typeof e == "string" ? e : JSON.stringify(e, null, t), u = l.endsWith(".json") ? l : `${l}.json`;
|
|
1913
|
+
En(n, u);
|
|
1819
1914
|
}
|
|
1820
|
-
function
|
|
1915
|
+
function On(e) {
|
|
1821
1916
|
return e ? typeof e.text == "function" ? e.text() : new Promise((l, t) => {
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1917
|
+
const n = new FileReader();
|
|
1918
|
+
n.onload = () => l(String(n.result || "")), n.onerror = () => t(n.error || new Error("读取文件失败")), n.readAsText(e, "utf-8");
|
|
1824
1919
|
}) : Promise.reject(new Error("未选择文件"));
|
|
1825
1920
|
}
|
|
1826
|
-
function
|
|
1921
|
+
function An() {
|
|
1827
1922
|
return new Promise((e) => {
|
|
1828
1923
|
if (typeof document > "u") {
|
|
1829
|
-
|
|
1924
|
+
wn();
|
|
1830
1925
|
return;
|
|
1831
1926
|
}
|
|
1832
1927
|
const l = document.createElement("input");
|
|
@@ -1835,26 +1930,26 @@ function mn() {
|
|
|
1835
1930
|
l.parentNode && l.parentNode.removeChild(l);
|
|
1836
1931
|
};
|
|
1837
1932
|
l.addEventListener("change", async () => {
|
|
1838
|
-
const
|
|
1839
|
-
if (!
|
|
1933
|
+
const n = l.files?.[0];
|
|
1934
|
+
if (!n) {
|
|
1840
1935
|
t(), e(null);
|
|
1841
1936
|
return;
|
|
1842
1937
|
}
|
|
1843
1938
|
try {
|
|
1844
|
-
const u = await
|
|
1845
|
-
t(), e({ file:
|
|
1939
|
+
const u = await On(n);
|
|
1940
|
+
t(), e({ file: n, text: u });
|
|
1846
1941
|
} catch (u) {
|
|
1847
|
-
t(), e({ file:
|
|
1942
|
+
t(), e({ file: n, text: "", error: u });
|
|
1848
1943
|
}
|
|
1849
1944
|
}), l.addEventListener("cancel", () => {
|
|
1850
1945
|
t(), e(null);
|
|
1851
1946
|
}), l.click();
|
|
1852
1947
|
});
|
|
1853
1948
|
}
|
|
1854
|
-
function
|
|
1949
|
+
function wn() {
|
|
1855
1950
|
throw new Error("pickJSONFile 只能在浏览器环境使用");
|
|
1856
1951
|
}
|
|
1857
|
-
const
|
|
1952
|
+
const _n = ["onClick"], Rn = { class: "_fc-l-list" }, Cn = ["onDragstart", "onClick"], kn = { class: "_fc-l-icon" }, Vn = { class: "_fc-l-name" }, Sn = { class: "_fc-tree-label" }, Dn = { class: "_fc-m-tools-l" }, In = { class: "devices" }, $n = { class: "_fc-m-tools-r" }, xn = /* @__PURE__ */ Object.assign({ name: "GbFormDesigner" }, {
|
|
1858
1953
|
__name: "FormDesigner",
|
|
1859
1954
|
props: {
|
|
1860
1955
|
modelValue: { type: Array, default: () => [] },
|
|
@@ -1864,25 +1959,25 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
1864
1959
|
},
|
|
1865
1960
|
emits: ["update:modelValue", "update:options", "import", "export", "validate", "change"],
|
|
1866
1961
|
setup(e, { expose: l, emit: t }) {
|
|
1867
|
-
const
|
|
1962
|
+
const n = e, u = t, r = (c) => JSON.parse(JSON.stringify(c ?? [])), p = Ne({
|
|
1868
1963
|
name: "",
|
|
1869
1964
|
description: "",
|
|
1870
1965
|
labelWidth: "120px",
|
|
1871
1966
|
size: "default",
|
|
1872
|
-
...
|
|
1873
|
-
}),
|
|
1874
|
-
|
|
1875
|
-
() =>
|
|
1967
|
+
...n.options || {}
|
|
1968
|
+
}), i = n.options ? Ne(n.options) : p;
|
|
1969
|
+
ke(
|
|
1970
|
+
() => n.options,
|
|
1876
1971
|
(c) => {
|
|
1877
|
-
!c || c ===
|
|
1972
|
+
!c || c === i || Object.assign(i, c);
|
|
1878
1973
|
},
|
|
1879
1974
|
{ deep: !0 }
|
|
1880
|
-
),
|
|
1881
|
-
const h = P("base"), b = P("menu"),
|
|
1975
|
+
), Ie("fcFormOptions", i);
|
|
1976
|
+
const h = P("base"), b = P("menu"), O = P(!1), I = P(!1), _ = P("pc"), V = P(!1), D = P(""), A = P(""), S = P(null), x = {
|
|
1882
1977
|
"--fc-drag-empty": "'拖拽左侧列表中的组件到此处'",
|
|
1883
1978
|
"--fc-child-empty": "'点击右下角 + 按钮添加一列'"
|
|
1884
|
-
},
|
|
1885
|
-
|
|
1979
|
+
}, ne = Ne({}), ie = {}, K = P(
|
|
1980
|
+
lt.map((c) => ({ ...c, hidden: !1 }))
|
|
1886
1981
|
), q = {
|
|
1887
1982
|
[d.INPUT]: "icon-input",
|
|
1888
1983
|
[d.TEXTAREA]: "icon-textarea",
|
|
@@ -1893,223 +1988,223 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
1893
1988
|
[d.SWITCH]: "icon-switch",
|
|
1894
1989
|
[d.DATE_PICKER]: "icon-date",
|
|
1895
1990
|
[d.ROW]: "icon-row"
|
|
1896
|
-
}, E = (c) => q[c] || "icon-input",
|
|
1897
|
-
let F = !1,
|
|
1898
|
-
const
|
|
1899
|
-
const c =
|
|
1900
|
-
|
|
1901
|
-
},
|
|
1902
|
-
const { components: c, options: a } = JSON.parse(
|
|
1903
|
-
F = !0, u("update:modelValue", c), Object.assign(
|
|
1991
|
+
}, E = (c) => q[c] || "icon-input", o = P([]), Q = P(-1);
|
|
1992
|
+
let F = !1, te = null;
|
|
1993
|
+
const oe = () => JSON.stringify({ components: n.modelValue, options: { ...i } }), fe = () => {
|
|
1994
|
+
const c = oe();
|
|
1995
|
+
o.value[Q.value] !== c && (o.value = o.value.slice(0, Q.value + 1), o.value.push(c), o.value.length > 50 && o.value.shift(), Q.value = o.value.length - 1);
|
|
1996
|
+
}, ve = B(() => Q.value > 0), re = B(() => Q.value < o.value.length - 1), pe = () => {
|
|
1997
|
+
const { components: c, options: a } = JSON.parse(o.value[Q.value]);
|
|
1998
|
+
F = !0, u("update:modelValue", c), Object.assign(i, a), Vt(() => {
|
|
1904
1999
|
F = !1;
|
|
1905
2000
|
});
|
|
1906
|
-
},
|
|
1907
|
-
|
|
1908
|
-
},
|
|
1909
|
-
|
|
2001
|
+
}, Te = () => {
|
|
2002
|
+
ve.value && (Q.value -= 1, pe());
|
|
2003
|
+
}, _e = () => {
|
|
2004
|
+
re.value && (Q.value += 1, pe());
|
|
1910
2005
|
};
|
|
1911
|
-
|
|
1912
|
-
() => [
|
|
2006
|
+
ke(
|
|
2007
|
+
() => [n.modelValue, { ...i }],
|
|
1913
2008
|
() => {
|
|
1914
|
-
F || (clearTimeout(
|
|
2009
|
+
F || (clearTimeout(te), te = setTimeout(fe, 300));
|
|
1915
2010
|
},
|
|
1916
2011
|
{ deep: !0 }
|
|
1917
|
-
),
|
|
1918
|
-
|
|
2012
|
+
), st(() => {
|
|
2013
|
+
fe();
|
|
1919
2014
|
});
|
|
1920
2015
|
const v = (c) => {
|
|
1921
|
-
u("update:modelValue",
|
|
2016
|
+
u("update:modelValue", r(c));
|
|
2017
|
+
}, de = (c) => {
|
|
2018
|
+
Object.assign(i, c || {}), u("update:options", { ...i });
|
|
1922
2019
|
}, ue = (c) => {
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
for (const a of et) {
|
|
1926
|
-
const R = a.templates.find((L) => L.type === c);
|
|
2020
|
+
for (const a of lt) {
|
|
2021
|
+
const R = a.templates.find((M) => M.type === c);
|
|
1927
2022
|
if (R) return R;
|
|
1928
2023
|
}
|
|
1929
2024
|
return null;
|
|
1930
|
-
},
|
|
1931
|
-
const a =
|
|
1932
|
-
return delete a.name, delete a.icon,
|
|
1933
|
-
},
|
|
1934
|
-
const a =
|
|
1935
|
-
return a ?
|
|
1936
|
-
},
|
|
1937
|
-
const a =
|
|
1938
|
-
v(R),
|
|
1939
|
-
},
|
|
1940
|
-
if (c.length === 1) return { list:
|
|
1941
|
-
const [a, , R,
|
|
1942
|
-
return { list:
|
|
1943
|
-
},
|
|
2025
|
+
}, Le = (c) => {
|
|
2026
|
+
const a = r(c);
|
|
2027
|
+
return delete a.name, delete a.icon, it(a), a.props = a.props || {}, a.props.variableName || (a.props.variableName = `field_${Ae().split("_").pop()}`), a.type === d.ROW && (a.children = [[], []], a.props.columns = a.props.columns || [{ span: 12 }, { span: 12 }]), a;
|
|
2028
|
+
}, pt = (c) => {
|
|
2029
|
+
const a = ue(c);
|
|
2030
|
+
return a ? Le(a) : null;
|
|
2031
|
+
}, mt = (c) => {
|
|
2032
|
+
const a = Le(c), R = [...n.modelValue, a];
|
|
2033
|
+
v(R), D.value = a.id;
|
|
2034
|
+
}, ye = (c) => {
|
|
2035
|
+
if (c.length === 1) return { list: n.modelValue, index: c[0], node: null };
|
|
2036
|
+
const [a, , R, M] = c, j = n.modelValue[a];
|
|
2037
|
+
return { list: j?.children?.[R] || [], index: M, node: j };
|
|
2038
|
+
}, Ve = (c, a) => {
|
|
1944
2039
|
for (const R of c || []) {
|
|
1945
2040
|
if (R.id === a) return R;
|
|
1946
2041
|
if (R.type === d.ROW)
|
|
1947
|
-
for (const
|
|
1948
|
-
const
|
|
1949
|
-
if (
|
|
2042
|
+
for (const M of R.children || []) {
|
|
2043
|
+
const j = Ve(M, a);
|
|
2044
|
+
if (j) return j;
|
|
1950
2045
|
}
|
|
1951
2046
|
}
|
|
1952
2047
|
return null;
|
|
1953
|
-
},
|
|
1954
|
-
|
|
1955
|
-
},
|
|
1956
|
-
|
|
1957
|
-
},
|
|
1958
|
-
const a =
|
|
2048
|
+
}, ft = B(() => D.value ? Ve(n.modelValue, D.value) : null), vt = (c) => {
|
|
2049
|
+
D.value = c.id;
|
|
2050
|
+
}, Re = () => {
|
|
2051
|
+
D.value = "";
|
|
2052
|
+
}, Fe = (c) => (c.id = Ae(), c.type === d.ROW && (c.children || []).forEach((a) => a.forEach(Fe)), c), ze = (c) => {
|
|
2053
|
+
const a = ye(c), R = a.list[c[c.length - 1]];
|
|
1959
2054
|
if (!R) return;
|
|
1960
|
-
const
|
|
1961
|
-
a.list.splice(a.index + 1, 0,
|
|
1962
|
-
},
|
|
1963
|
-
const a =
|
|
1964
|
-
a.list.splice(a.index, 1), v(
|
|
1965
|
-
},
|
|
2055
|
+
const M = Fe(r(R));
|
|
2056
|
+
a.list.splice(a.index + 1, 0, M), v(n.modelValue), D.value = M.id;
|
|
2057
|
+
}, je = (c) => {
|
|
2058
|
+
const a = ye(c);
|
|
2059
|
+
a.list.splice(a.index, 1), v(n.modelValue), D.value && (Ve(n.modelValue, D.value) || Re());
|
|
2060
|
+
}, ce = P(null), yt = () => ce.value ? ce.value : null, ht = (c, a) => {
|
|
1966
2061
|
const R = { kind: "new", type: a.type };
|
|
1967
|
-
|
|
1968
|
-
},
|
|
1969
|
-
|
|
1970
|
-
},
|
|
1971
|
-
|
|
1972
|
-
},
|
|
2062
|
+
ce.value = R, c.dataTransfer.effectAllowed = "copy", c.dataTransfer.setData("application/x-gb-field", JSON.stringify(R)), c.dataTransfer.setData("text/plain", a.type);
|
|
2063
|
+
}, bt = (c) => {
|
|
2064
|
+
ce.value = { kind: "existing", path: [...c] };
|
|
2065
|
+
}, Ge = () => {
|
|
2066
|
+
ce.value = null, A.value = "";
|
|
2067
|
+
}, gt = (c) => {
|
|
1973
2068
|
const a = c.dataTransfer?.getData("application/x-gb-field");
|
|
1974
|
-
let R =
|
|
2069
|
+
let R = ce.value;
|
|
1975
2070
|
if (a)
|
|
1976
2071
|
try {
|
|
1977
2072
|
R = JSON.parse(a);
|
|
1978
2073
|
} catch {
|
|
1979
|
-
R =
|
|
2074
|
+
R = ce.value;
|
|
1980
2075
|
}
|
|
1981
|
-
A.value = "",
|
|
1982
|
-
},
|
|
2076
|
+
A.value = "", ce.value = null, R && We(R, { path: null, position: "bottom" });
|
|
2077
|
+
}, We = (c, a) => {
|
|
1983
2078
|
if (!c) return;
|
|
1984
|
-
let R =
|
|
2079
|
+
let R = n.modelValue, M = n.modelValue.length;
|
|
1985
2080
|
if (a.column !== void 0 && a.path) {
|
|
1986
|
-
const
|
|
1987
|
-
if (!
|
|
1988
|
-
if (c.kind === "existing" &&
|
|
1989
|
-
|
|
2081
|
+
const L = ye(a.path).list[a.path[a.path.length - 1]];
|
|
2082
|
+
if (!L?.children?.[a.column]) return;
|
|
2083
|
+
if (c.kind === "existing" && ye(c.path).list[c.path[c.path.length - 1]]?.type === d.ROW) {
|
|
2084
|
+
ae.warning("分栏组件不能放入分栏内");
|
|
1990
2085
|
return;
|
|
1991
2086
|
}
|
|
1992
|
-
R =
|
|
2087
|
+
R = L.children[a.column], M = R.length;
|
|
1993
2088
|
} else if (a.path) {
|
|
1994
|
-
if (c.kind === "existing" && c.path.length <= a.path.length && c.path.every((
|
|
2089
|
+
if (c.kind === "existing" && c.path.length <= a.path.length && c.path.every((Ee, Se) => Ee === a.path[Se]))
|
|
1995
2090
|
return;
|
|
1996
|
-
const
|
|
1997
|
-
R =
|
|
2091
|
+
const L = ye(a.path);
|
|
2092
|
+
R = L.list, M = a.position === "top" ? L.index : L.index + 1;
|
|
1998
2093
|
}
|
|
1999
|
-
let
|
|
2094
|
+
let j;
|
|
2000
2095
|
if (c.kind === "new") {
|
|
2001
|
-
if (
|
|
2096
|
+
if (j = pt(c.type), !j) return;
|
|
2002
2097
|
} else {
|
|
2003
|
-
const
|
|
2004
|
-
if (
|
|
2005
|
-
|
|
2098
|
+
const L = ye(c.path);
|
|
2099
|
+
if (j = L.list[L.index], !j) return;
|
|
2100
|
+
L.list === R && L.index < M && (M -= 1), L.list.splice(L.index, 1);
|
|
2006
2101
|
}
|
|
2007
|
-
R.splice(
|
|
2102
|
+
R.splice(M, 0, j), v(n.modelValue), D.value = j.id;
|
|
2008
2103
|
};
|
|
2009
|
-
|
|
2010
|
-
active:
|
|
2011
|
-
copy:
|
|
2012
|
-
remove:
|
|
2013
|
-
startDrag:
|
|
2014
|
-
endDrag:
|
|
2015
|
-
getDragPayload:
|
|
2016
|
-
dropAt:
|
|
2104
|
+
Ie("fcDragOver", A), Ie("fcCanvasOps", {
|
|
2105
|
+
active: vt,
|
|
2106
|
+
copy: ze,
|
|
2107
|
+
remove: je,
|
|
2108
|
+
startDrag: bt,
|
|
2109
|
+
endDrag: Ge,
|
|
2110
|
+
getDragPayload: yt,
|
|
2111
|
+
dropAt: We
|
|
2017
2112
|
});
|
|
2018
|
-
const
|
|
2019
|
-
const
|
|
2113
|
+
const Be = (c, a = []) => (c || []).map((R, M) => {
|
|
2114
|
+
const j = [...a, M], L = {
|
|
2020
2115
|
id: R.id,
|
|
2021
2116
|
label: R.props?.label || R.props?.variableName || R.type,
|
|
2022
2117
|
icon: E(R.type),
|
|
2023
2118
|
rule: R,
|
|
2024
|
-
path:
|
|
2119
|
+
path: j
|
|
2025
2120
|
};
|
|
2026
|
-
return R.type === d.ROW && (
|
|
2027
|
-
(
|
|
2028
|
-
)),
|
|
2029
|
-
}),
|
|
2030
|
-
c.rule && (
|
|
2031
|
-
},
|
|
2032
|
-
a.path && (c === "copy" ?
|
|
2033
|
-
},
|
|
2034
|
-
const c = await
|
|
2121
|
+
return R.type === d.ROW && (L.children = (R.children || []).flatMap(
|
|
2122
|
+
(he, Ee) => Be(he || [], [...a, M, "children", Ee])
|
|
2123
|
+
)), L;
|
|
2124
|
+
}), Tt = B(() => Be(n.modelValue)), Et = (c) => {
|
|
2125
|
+
c.rule && (D.value = c.rule.id);
|
|
2126
|
+
}, Nt = (c, a) => {
|
|
2127
|
+
a.path && (c === "copy" ? ze(a.path) : c === "delete" && je(a.path));
|
|
2128
|
+
}, Ot = async () => {
|
|
2129
|
+
const c = await An();
|
|
2035
2130
|
if (c)
|
|
2036
2131
|
try {
|
|
2037
|
-
const a =
|
|
2038
|
-
u("update:modelValue", a.components), Object.assign(
|
|
2132
|
+
const a = ot(c.text);
|
|
2133
|
+
u("update:modelValue", a.components), Object.assign(i, a.options || {}), u("import", { components: a.components, options: { ...i } }), ae.success("表单导入成功");
|
|
2039
2134
|
} catch (a) {
|
|
2040
|
-
|
|
2135
|
+
ae.error(`导入失败:${a.message}`);
|
|
2041
2136
|
}
|
|
2042
|
-
},
|
|
2043
|
-
u("update:modelValue", []),
|
|
2044
|
-
},
|
|
2045
|
-
const c =
|
|
2137
|
+
}, He = () => {
|
|
2138
|
+
u("update:modelValue", []), Re(), ae.success("表单已清空");
|
|
2139
|
+
}, At = () => {
|
|
2140
|
+
const c = Pe({ components: n.modelValue });
|
|
2046
2141
|
return u("validate", c), c;
|
|
2047
|
-
},
|
|
2142
|
+
}, qe = () => r(n.modelValue);
|
|
2048
2143
|
return l({
|
|
2049
|
-
getComponents:
|
|
2050
|
-
getForm: () => ({ components:
|
|
2144
|
+
getComponents: qe,
|
|
2145
|
+
getForm: () => ({ components: qe(), options: { ...i } }),
|
|
2051
2146
|
importJSON: (c) => {
|
|
2052
|
-
const a =
|
|
2053
|
-
return u("update:modelValue", a.components), Object.assign(
|
|
2147
|
+
const a = ot(c);
|
|
2148
|
+
return u("update:modelValue", a.components), Object.assign(i, a.options || {}), u("import", { components: a.components, options: { ...i } }), a;
|
|
2054
2149
|
},
|
|
2055
2150
|
exportJSON: (c = 2) => {
|
|
2056
|
-
const a =
|
|
2057
|
-
return a.form.options = { ...
|
|
2151
|
+
const a = nt(n.modelValue, { ...n.meta, name: n.meta?.name || n.fileName }, { raw: !0 });
|
|
2152
|
+
return a.form.options = { ...i }, u("export", a), JSON.stringify(a, null, c);
|
|
2058
2153
|
},
|
|
2059
2154
|
downloadForm: () => {
|
|
2060
|
-
const c =
|
|
2061
|
-
c.form.options = { ...
|
|
2155
|
+
const c = nt(n.modelValue, { ...n.meta, name: n.meta?.name || n.fileName }, { raw: !0 });
|
|
2156
|
+
c.form.options = { ...i }, Nn(c, `${n.meta?.name || n.fileName}-form.json`), u("export", c), ae.success("表单 JSON 已导出");
|
|
2062
2157
|
},
|
|
2063
|
-
validate:
|
|
2064
|
-
clearForm:
|
|
2065
|
-
undo:
|
|
2066
|
-
redo:
|
|
2067
|
-
components:
|
|
2068
|
-
formOptions:
|
|
2158
|
+
validate: At,
|
|
2159
|
+
clearForm: He,
|
|
2160
|
+
undo: Te,
|
|
2161
|
+
redo: _e,
|
|
2162
|
+
components: B(() => n.modelValue),
|
|
2163
|
+
formOptions: i
|
|
2069
2164
|
}), (c, a) => {
|
|
2070
|
-
const R =
|
|
2071
|
-
return
|
|
2165
|
+
const R = N("el-tooltip"), M = N("el-aside"), j = N("el-header"), L = N("el-main"), he = N("el-dropdown-item"), Ee = N("el-dropdown-menu"), Se = N("el-dropdown"), wt = N("el-tree"), Ce = N("el-container"), De = N("el-button"), _t = N("el-popconfirm"), Rt = N("el-form");
|
|
2166
|
+
return f(), k(Ce, {
|
|
2072
2167
|
class: "_fc-designer gb-fc-designer",
|
|
2073
2168
|
style: { height: "100%" }
|
|
2074
2169
|
}, {
|
|
2075
2170
|
default: y(() => [
|
|
2076
|
-
|
|
2171
|
+
m(L, null, {
|
|
2077
2172
|
default: y(() => [
|
|
2078
|
-
|
|
2173
|
+
m(Ce, { style: { height: "100%" } }, {
|
|
2079
2174
|
default: y(() => [
|
|
2080
|
-
|
|
2175
|
+
m(M, {
|
|
2081
2176
|
class: "_fc-l-menu",
|
|
2082
2177
|
width: "40px"
|
|
2083
2178
|
}, {
|
|
2084
2179
|
default: y(() => [
|
|
2085
|
-
|
|
2180
|
+
m(R, {
|
|
2086
2181
|
effect: "dark",
|
|
2087
2182
|
content: "组件列表",
|
|
2088
2183
|
placement: "right",
|
|
2089
2184
|
"hide-after": 0
|
|
2090
2185
|
}, {
|
|
2091
2186
|
default: y(() => [
|
|
2092
|
-
|
|
2093
|
-
class:
|
|
2094
|
-
onClick: a[0] || (a[0] = (
|
|
2187
|
+
s("div", {
|
|
2188
|
+
class: U(["_fc-l-menu-item", { active: h.value === "base" }]),
|
|
2189
|
+
onClick: a[0] || (a[0] = ($) => h.value = "base")
|
|
2095
2190
|
}, [...a[15] || (a[15] = [
|
|
2096
|
-
|
|
2191
|
+
s("i", { class: "fc-icon icon-menu" }, null, -1)
|
|
2097
2192
|
])], 2)
|
|
2098
2193
|
]),
|
|
2099
2194
|
_: 1
|
|
2100
2195
|
}),
|
|
2101
|
-
|
|
2196
|
+
m(R, {
|
|
2102
2197
|
effect: "dark",
|
|
2103
2198
|
content: "JSON",
|
|
2104
2199
|
placement: "right",
|
|
2105
2200
|
"hide-after": 0
|
|
2106
2201
|
}, {
|
|
2107
2202
|
default: y(() => [
|
|
2108
|
-
|
|
2109
|
-
class:
|
|
2110
|
-
onClick: a[1] || (a[1] = (
|
|
2203
|
+
s("div", {
|
|
2204
|
+
class: U(["_fc-l-menu-item", { active: h.value === "json" }]),
|
|
2205
|
+
onClick: a[1] || (a[1] = ($) => h.value = "json")
|
|
2111
2206
|
}, [...a[16] || (a[16] = [
|
|
2112
|
-
|
|
2207
|
+
s("i", { class: "fc-icon icon-script" }, null, -1)
|
|
2113
2208
|
])], 2)
|
|
2114
2209
|
]),
|
|
2115
2210
|
_: 1
|
|
@@ -2117,125 +2212,125 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2117
2212
|
]),
|
|
2118
2213
|
_: 1
|
|
2119
2214
|
}),
|
|
2120
|
-
|
|
2215
|
+
me(m(M, {
|
|
2121
2216
|
class: "_fc-l",
|
|
2122
2217
|
width: "266px"
|
|
2123
2218
|
}, {
|
|
2124
2219
|
default: y(() => [
|
|
2125
|
-
|
|
2220
|
+
s("div", {
|
|
2126
2221
|
class: "_fc-l-close",
|
|
2127
|
-
onClick: a[2] || (a[2] = (
|
|
2222
|
+
onClick: a[2] || (a[2] = ($) => O.value = !0)
|
|
2128
2223
|
}, [...a[17] || (a[17] = [
|
|
2129
|
-
|
|
2224
|
+
s("i", { class: "fc-icon icon-arrow" }, null, -1)
|
|
2130
2225
|
])]),
|
|
2131
|
-
h.value === "json" ? (
|
|
2226
|
+
h.value === "json" ? (f(), k(Yl, {
|
|
2132
2227
|
key: 0,
|
|
2133
2228
|
ref_key: "jsonPanelRef",
|
|
2134
|
-
ref:
|
|
2229
|
+
ref: S,
|
|
2135
2230
|
components: e.modelValue,
|
|
2136
|
-
"form-options":
|
|
2231
|
+
"form-options": C(i),
|
|
2137
2232
|
"onUpdate:components": v,
|
|
2138
|
-
"onUpdate:formOptions":
|
|
2139
|
-
}, null, 8, ["components", "form-options"])) : (
|
|
2233
|
+
"onUpdate:formOptions": de
|
|
2234
|
+
}, null, 8, ["components", "form-options"])) : (f(), k(Ce, {
|
|
2140
2235
|
key: 1,
|
|
2141
2236
|
style: { height: "100%" }
|
|
2142
2237
|
}, {
|
|
2143
2238
|
default: y(() => [
|
|
2144
|
-
|
|
2239
|
+
m(j, {
|
|
2145
2240
|
height: "40px",
|
|
2146
2241
|
class: "_fc-l-tabs"
|
|
2147
2242
|
}, {
|
|
2148
2243
|
default: y(() => [
|
|
2149
|
-
|
|
2150
|
-
class:
|
|
2151
|
-
onClick: a[3] || (a[3] = (
|
|
2244
|
+
s("div", {
|
|
2245
|
+
class: U(["_fc-l-tab", { active: b.value === "menu" }]),
|
|
2246
|
+
onClick: a[3] || (a[3] = ($) => b.value = "menu")
|
|
2152
2247
|
}, " 组件 ", 2),
|
|
2153
|
-
|
|
2154
|
-
class:
|
|
2155
|
-
onClick: a[4] || (a[4] = (
|
|
2248
|
+
s("div", {
|
|
2249
|
+
class: U(["_fc-l-tab", { active: b.value === "tree" }]),
|
|
2250
|
+
onClick: a[4] || (a[4] = ($) => b.value = "tree")
|
|
2156
2251
|
}, " 大纲 ", 2)
|
|
2157
2252
|
]),
|
|
2158
2253
|
_: 1
|
|
2159
2254
|
}),
|
|
2160
|
-
|
|
2255
|
+
me(m(L, null, {
|
|
2161
2256
|
default: y(() => [
|
|
2162
|
-
(
|
|
2163
|
-
key:
|
|
2257
|
+
(f(!0), w(z, null, G(K.value, ($) => (f(), w("div", {
|
|
2258
|
+
key: $.key,
|
|
2164
2259
|
class: "_fc-l-group"
|
|
2165
2260
|
}, [
|
|
2166
|
-
|
|
2261
|
+
s("h4", {
|
|
2167
2262
|
class: "_fc-l-title",
|
|
2168
|
-
onClick: (
|
|
2263
|
+
onClick: (le) => $.hidden = !$.hidden
|
|
2169
2264
|
}, [
|
|
2170
|
-
Y(
|
|
2171
|
-
|
|
2172
|
-
class:
|
|
2265
|
+
Y(se($.name) + " ", 1),
|
|
2266
|
+
s("i", {
|
|
2267
|
+
class: U(["fc-icon icon-arrow", { down: !$.hidden }])
|
|
2173
2268
|
}, null, 2)
|
|
2174
|
-
], 8,
|
|
2175
|
-
|
|
2176
|
-
(
|
|
2177
|
-
key:
|
|
2269
|
+
], 8, _n),
|
|
2270
|
+
me(s("div", Rn, [
|
|
2271
|
+
(f(!0), w(z, null, G($.templates, (le) => (f(), w("div", {
|
|
2272
|
+
key: le.type,
|
|
2178
2273
|
class: "_fc-l-item",
|
|
2179
2274
|
draggable: "true",
|
|
2180
|
-
onDragstart: (
|
|
2181
|
-
onDragend:
|
|
2182
|
-
onClick: (
|
|
2275
|
+
onDragstart: (Je) => ht(Je, le),
|
|
2276
|
+
onDragend: Ge,
|
|
2277
|
+
onClick: (Je) => mt(le)
|
|
2183
2278
|
}, [
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
class:
|
|
2279
|
+
s("div", kn, [
|
|
2280
|
+
s("i", {
|
|
2281
|
+
class: U(["fc-icon", E(le.type)])
|
|
2187
2282
|
}, null, 2)
|
|
2188
2283
|
]),
|
|
2189
|
-
|
|
2190
|
-
], 40,
|
|
2284
|
+
s("span", Vn, se(le.name), 1)
|
|
2285
|
+
], 40, Cn))), 128))
|
|
2191
2286
|
], 512), [
|
|
2192
|
-
[
|
|
2287
|
+
[be, !$.hidden]
|
|
2193
2288
|
])
|
|
2194
2289
|
]))), 128))
|
|
2195
2290
|
]),
|
|
2196
2291
|
_: 1
|
|
2197
2292
|
}, 512), [
|
|
2198
|
-
[
|
|
2293
|
+
[be, b.value === "menu"]
|
|
2199
2294
|
]),
|
|
2200
|
-
|
|
2295
|
+
me(m(L, null, {
|
|
2201
2296
|
default: y(() => [
|
|
2202
|
-
|
|
2203
|
-
data:
|
|
2297
|
+
m(wt, {
|
|
2298
|
+
data: Tt.value,
|
|
2204
2299
|
"node-key": "id",
|
|
2205
2300
|
"expand-on-click-node": !1,
|
|
2206
2301
|
"default-expand-all": "",
|
|
2207
|
-
onNodeClick:
|
|
2302
|
+
onNodeClick: Et
|
|
2208
2303
|
}, {
|
|
2209
|
-
default: y(({ data:
|
|
2210
|
-
|
|
2211
|
-
class:
|
|
2304
|
+
default: y(({ data: $ }) => [
|
|
2305
|
+
s("div", {
|
|
2306
|
+
class: U(["_fc-tree-node", { active: D.value === $.rule?.id }])
|
|
2212
2307
|
}, [
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
class:
|
|
2308
|
+
s("div", Sn, [
|
|
2309
|
+
s("i", {
|
|
2310
|
+
class: U(["fc-icon", $.icon || "icon-cell"])
|
|
2216
2311
|
}, null, 2),
|
|
2217
|
-
|
|
2312
|
+
s("span", null, se($.label), 1)
|
|
2218
2313
|
]),
|
|
2219
|
-
|
|
2314
|
+
s("div", {
|
|
2220
2315
|
class: "_fc-tree-more",
|
|
2221
2316
|
onClick: a[5] || (a[5] = X(() => {
|
|
2222
2317
|
}, ["stop"]))
|
|
2223
2318
|
}, [
|
|
2224
|
-
|
|
2319
|
+
m(Se, {
|
|
2225
2320
|
trigger: "click",
|
|
2226
2321
|
size: "default",
|
|
2227
|
-
onCommand: (
|
|
2322
|
+
onCommand: (le) => Nt(le, $)
|
|
2228
2323
|
}, {
|
|
2229
2324
|
dropdown: y(() => [
|
|
2230
|
-
|
|
2325
|
+
m(Ee, null, {
|
|
2231
2326
|
default: y(() => [
|
|
2232
|
-
|
|
2327
|
+
m(he, { command: "copy" }, {
|
|
2233
2328
|
default: y(() => [...a[18] || (a[18] = [
|
|
2234
2329
|
Y("复制", -1)
|
|
2235
2330
|
])]),
|
|
2236
2331
|
_: 1
|
|
2237
2332
|
}),
|
|
2238
|
-
|
|
2333
|
+
m(he, { command: "delete" }, {
|
|
2239
2334
|
default: y(() => [...a[19] || (a[19] = [
|
|
2240
2335
|
Y("删除", -1)
|
|
2241
2336
|
])]),
|
|
@@ -2246,7 +2341,7 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2246
2341
|
})
|
|
2247
2342
|
]),
|
|
2248
2343
|
default: y(() => [
|
|
2249
|
-
a[20] || (a[20] =
|
|
2344
|
+
a[20] || (a[20] = s("i", { class: "fc-icon icon-more" }, null, -1))
|
|
2250
2345
|
]),
|
|
2251
2346
|
_: 1
|
|
2252
2347
|
}, 8, ["onCommand"])
|
|
@@ -2258,7 +2353,7 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2258
2353
|
]),
|
|
2259
2354
|
_: 1
|
|
2260
2355
|
}, 512), [
|
|
2261
|
-
[
|
|
2356
|
+
[be, b.value === "tree"]
|
|
2262
2357
|
])
|
|
2263
2358
|
]),
|
|
2264
2359
|
_: 1
|
|
@@ -2266,81 +2361,81 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2266
2361
|
]),
|
|
2267
2362
|
_: 1
|
|
2268
2363
|
}, 512), [
|
|
2269
|
-
[
|
|
2364
|
+
[be, !O.value]
|
|
2270
2365
|
]),
|
|
2271
|
-
|
|
2366
|
+
m(Ce, { class: "_fc-m" }, {
|
|
2272
2367
|
default: y(() => [
|
|
2273
|
-
|
|
2368
|
+
m(j, {
|
|
2274
2369
|
class: "_fc-m-tools",
|
|
2275
2370
|
height: "45"
|
|
2276
2371
|
}, {
|
|
2277
2372
|
default: y(() => [
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
class:
|
|
2282
|
-
onClick: a[6] || (a[6] = (
|
|
2373
|
+
s("div", Dn, [
|
|
2374
|
+
s("div", In, [
|
|
2375
|
+
s("i", {
|
|
2376
|
+
class: U(["fc-icon icon-pc", { active: _.value === "pc" }]),
|
|
2377
|
+
onClick: a[6] || (a[6] = ($) => _.value = "pc")
|
|
2283
2378
|
}, null, 2),
|
|
2284
|
-
|
|
2285
|
-
class:
|
|
2286
|
-
onClick: a[7] || (a[7] = (
|
|
2379
|
+
s("i", {
|
|
2380
|
+
class: U(["fc-icon icon-pad", { active: _.value === "pad" }]),
|
|
2381
|
+
onClick: a[7] || (a[7] = ($) => _.value = "pad")
|
|
2287
2382
|
}, null, 2),
|
|
2288
|
-
|
|
2289
|
-
class:
|
|
2290
|
-
onClick: a[8] || (a[8] = (
|
|
2383
|
+
s("i", {
|
|
2384
|
+
class: U(["fc-icon icon-mobile", { active: _.value === "mobile" }]),
|
|
2385
|
+
onClick: a[8] || (a[8] = ($) => _.value = "mobile")
|
|
2291
2386
|
}, null, 2)
|
|
2292
2387
|
]),
|
|
2293
|
-
a[21] || (a[21] =
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
class:
|
|
2297
|
-
onClick:
|
|
2388
|
+
a[21] || (a[21] = s("div", { class: "line" }, null, -1)),
|
|
2389
|
+
s("div", null, [
|
|
2390
|
+
s("i", {
|
|
2391
|
+
class: U(["fc-icon icon-pre-step", { disabled: !ve.value }]),
|
|
2392
|
+
onClick: Te
|
|
2298
2393
|
}, null, 2),
|
|
2299
|
-
|
|
2300
|
-
class:
|
|
2301
|
-
onClick:
|
|
2394
|
+
s("i", {
|
|
2395
|
+
class: U(["fc-icon icon-next-step", { disabled: !re.value }]),
|
|
2396
|
+
onClick: _e
|
|
2302
2397
|
}, null, 2)
|
|
2303
2398
|
])
|
|
2304
2399
|
]),
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
icon:
|
|
2400
|
+
s("div", $n, [
|
|
2401
|
+
m(De, {
|
|
2402
|
+
icon: C(Ft),
|
|
2308
2403
|
plain: "",
|
|
2309
2404
|
size: "small",
|
|
2310
|
-
onClick:
|
|
2405
|
+
onClick: Ot
|
|
2311
2406
|
}, {
|
|
2312
2407
|
default: y(() => [...a[22] || (a[22] = [
|
|
2313
2408
|
Y("导入", -1)
|
|
2314
2409
|
])]),
|
|
2315
2410
|
_: 1
|
|
2316
2411
|
}, 8, ["icon"]),
|
|
2317
|
-
|
|
2412
|
+
m(De, {
|
|
2318
2413
|
type: "primary",
|
|
2319
2414
|
plain: "",
|
|
2320
2415
|
size: "small",
|
|
2321
|
-
onClick: a[9] || (a[9] = (
|
|
2416
|
+
onClick: a[9] || (a[9] = ($) => V.value = !0)
|
|
2322
2417
|
}, {
|
|
2323
2418
|
default: y(() => [...a[23] || (a[23] = [
|
|
2324
|
-
|
|
2419
|
+
s("i", { class: "fc-icon icon-preview" }, null, -1),
|
|
2325
2420
|
Y(" 预览 ", -1)
|
|
2326
2421
|
])]),
|
|
2327
2422
|
_: 1
|
|
2328
2423
|
}),
|
|
2329
|
-
|
|
2424
|
+
m(_t, {
|
|
2330
2425
|
title: "确定清空所有组件?",
|
|
2331
2426
|
width: "200px",
|
|
2332
2427
|
"confirm-button-text": "清空",
|
|
2333
2428
|
"cancel-button-text": "取消",
|
|
2334
|
-
onConfirm:
|
|
2429
|
+
onConfirm: He
|
|
2335
2430
|
}, {
|
|
2336
2431
|
reference: y(() => [
|
|
2337
|
-
|
|
2432
|
+
m(De, {
|
|
2338
2433
|
type: "danger",
|
|
2339
2434
|
plain: "",
|
|
2340
2435
|
size: "small"
|
|
2341
2436
|
}, {
|
|
2342
2437
|
default: y(() => [...a[24] || (a[24] = [
|
|
2343
|
-
|
|
2438
|
+
s("i", { class: "fc-icon icon-delete" }, null, -1),
|
|
2344
2439
|
Y(" 清空", -1)
|
|
2345
2440
|
])]),
|
|
2346
2441
|
_: 1
|
|
@@ -2352,41 +2447,41 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2352
2447
|
]),
|
|
2353
2448
|
_: 1
|
|
2354
2449
|
}),
|
|
2355
|
-
|
|
2450
|
+
m(L, { class: "_fc-m-con" }, {
|
|
2356
2451
|
default: y(() => [
|
|
2357
|
-
a[25] || (a[25] =
|
|
2452
|
+
a[25] || (a[25] = s("a", {
|
|
2358
2453
|
class: "gb-fc-watermark",
|
|
2359
2454
|
href: "javascript:void(0)"
|
|
2360
2455
|
}, "GbFlowDesign", -1)),
|
|
2361
|
-
|
|
2456
|
+
s("div", {
|
|
2362
2457
|
ref: "dragCon",
|
|
2363
|
-
class:
|
|
2364
|
-
style:
|
|
2458
|
+
class: U(["_fc-m-drag", _.value]),
|
|
2459
|
+
style: x,
|
|
2365
2460
|
onDragover: a[10] || (a[10] = X(() => {
|
|
2366
2461
|
}, ["prevent"])),
|
|
2367
|
-
onDrop: X(
|
|
2462
|
+
onDrop: X(gt, ["prevent"])
|
|
2368
2463
|
}, [
|
|
2369
|
-
e.modelValue.length ? (
|
|
2464
|
+
e.modelValue.length ? (f(), k(Rt, {
|
|
2370
2465
|
key: 0,
|
|
2371
|
-
model:
|
|
2372
|
-
"label-width":
|
|
2373
|
-
size:
|
|
2466
|
+
model: ne,
|
|
2467
|
+
"label-width": C(i).labelWidth || "120px",
|
|
2468
|
+
size: C(i).size === "default" ? void 0 : C(i).size
|
|
2374
2469
|
}, {
|
|
2375
2470
|
default: y(() => [
|
|
2376
|
-
(
|
|
2377
|
-
key:
|
|
2378
|
-
component:
|
|
2379
|
-
path: [
|
|
2380
|
-
"form-data":
|
|
2381
|
-
"form-rules":
|
|
2382
|
-
"active-id":
|
|
2471
|
+
(f(!0), w(z, null, G(e.modelValue, ($, le) => (f(), k(Xt, {
|
|
2472
|
+
key: $.id || le,
|
|
2473
|
+
component: $,
|
|
2474
|
+
path: [le],
|
|
2475
|
+
"form-data": ne,
|
|
2476
|
+
"form-rules": ie,
|
|
2477
|
+
"active-id": D.value
|
|
2383
2478
|
}, null, 8, ["component", "path", "form-data", "active-id"]))), 128))
|
|
2384
2479
|
]),
|
|
2385
2480
|
_: 1
|
|
2386
|
-
}, 8, ["model", "label-width", "size"])) : (
|
|
2481
|
+
}, 8, ["model", "label-width", "size"])) : (f(), w("div", {
|
|
2387
2482
|
key: 1,
|
|
2388
2483
|
class: "_fd-draggable-drag _fd-drag-box drag-holder",
|
|
2389
|
-
onClick:
|
|
2484
|
+
onClick: Re
|
|
2390
2485
|
}))
|
|
2391
2486
|
], 34)
|
|
2392
2487
|
]),
|
|
@@ -2395,46 +2490,46 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2395
2490
|
]),
|
|
2396
2491
|
_: 1
|
|
2397
2492
|
}),
|
|
2398
|
-
|
|
2493
|
+
me(m(M, {
|
|
2399
2494
|
class: "_fc-r",
|
|
2400
2495
|
width: "320px"
|
|
2401
2496
|
}, {
|
|
2402
2497
|
default: y(() => [
|
|
2403
|
-
|
|
2498
|
+
s("div", {
|
|
2404
2499
|
class: "_fc-r-close",
|
|
2405
|
-
onClick: a[11] || (a[11] = (
|
|
2500
|
+
onClick: a[11] || (a[11] = ($) => I.value = !0)
|
|
2406
2501
|
}, [...a[26] || (a[26] = [
|
|
2407
|
-
|
|
2502
|
+
s("i", { class: "fc-icon icon-arrow" }, null, -1)
|
|
2408
2503
|
])]),
|
|
2409
|
-
|
|
2410
|
-
component:
|
|
2411
|
-
"form-options":
|
|
2412
|
-
onClose:
|
|
2504
|
+
m(Hl, {
|
|
2505
|
+
component: ft.value,
|
|
2506
|
+
"form-options": C(i),
|
|
2507
|
+
onClose: Re
|
|
2413
2508
|
}, null, 8, ["component", "form-options"])
|
|
2414
2509
|
]),
|
|
2415
2510
|
_: 1
|
|
2416
2511
|
}, 512), [
|
|
2417
|
-
[
|
|
2512
|
+
[be, !I.value]
|
|
2418
2513
|
]),
|
|
2419
|
-
|
|
2514
|
+
O.value ? (f(), w("div", {
|
|
2420
2515
|
key: 0,
|
|
2421
2516
|
class: "_fc-l-open",
|
|
2422
|
-
onClick: a[12] || (a[12] = (
|
|
2517
|
+
onClick: a[12] || (a[12] = ($) => O.value = !1)
|
|
2423
2518
|
}, [...a[27] || (a[27] = [
|
|
2424
|
-
|
|
2425
|
-
])])) :
|
|
2426
|
-
|
|
2519
|
+
s("i", { class: "fc-icon icon-arrow" }, null, -1)
|
|
2520
|
+
])])) : W("", !0),
|
|
2521
|
+
I.value ? (f(), w("div", {
|
|
2427
2522
|
key: 1,
|
|
2428
2523
|
class: "_fc-r-open",
|
|
2429
|
-
onClick: a[13] || (a[13] = (
|
|
2524
|
+
onClick: a[13] || (a[13] = ($) => I.value = !1)
|
|
2430
2525
|
}, [...a[28] || (a[28] = [
|
|
2431
|
-
|
|
2432
|
-
])])) :
|
|
2433
|
-
|
|
2434
|
-
modelValue:
|
|
2435
|
-
"onUpdate:modelValue": a[14] || (a[14] = (
|
|
2526
|
+
s("i", { class: "fc-icon icon-arrow" }, null, -1)
|
|
2527
|
+
])])) : W("", !0),
|
|
2528
|
+
m(mn, {
|
|
2529
|
+
modelValue: V.value,
|
|
2530
|
+
"onUpdate:modelValue": a[14] || (a[14] = ($) => V.value = $),
|
|
2436
2531
|
components: e.modelValue,
|
|
2437
|
-
"form-options":
|
|
2532
|
+
"form-options": C(i)
|
|
2438
2533
|
}, null, 8, ["modelValue", "components", "form-options"])
|
|
2439
2534
|
]),
|
|
2440
2535
|
_: 1
|
|
@@ -2462,7 +2557,7 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2462
2557
|
// 数组类型(checkbox)
|
|
2463
2558
|
BOOLEAN: "boolean"
|
|
2464
2559
|
// 布尔类型(预留)
|
|
2465
|
-
}),
|
|
2560
|
+
}), H = Object.freeze({
|
|
2466
2561
|
INPUT: "input",
|
|
2467
2562
|
TEXTAREA: "textarea",
|
|
2468
2563
|
INPUT_NUMBER: "input-number",
|
|
@@ -2472,17 +2567,17 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2472
2567
|
SWITCH: "switch",
|
|
2473
2568
|
DATE_PICKER: "date-picker",
|
|
2474
2569
|
ROW: "row"
|
|
2475
|
-
}),
|
|
2476
|
-
[
|
|
2477
|
-
[
|
|
2478
|
-
[
|
|
2570
|
+
}), Un = Object.freeze({
|
|
2571
|
+
[H.INPUT]: g.STRING,
|
|
2572
|
+
[H.TEXTAREA]: g.STRING,
|
|
2573
|
+
[H.INPUT_NUMBER]: null,
|
|
2479
2574
|
// 动态判断:默认为整数
|
|
2480
|
-
[
|
|
2481
|
-
[
|
|
2482
|
-
[
|
|
2483
|
-
[
|
|
2484
|
-
[
|
|
2485
|
-
[
|
|
2575
|
+
[H.RADIO_GROUP]: g.STRING,
|
|
2576
|
+
[H.SELECT]: g.STRING,
|
|
2577
|
+
[H.CHECKBOX_GROUP]: g.ARRAY,
|
|
2578
|
+
[H.SWITCH]: g.BOOLEAN,
|
|
2579
|
+
[H.DATE_PICKER]: g.DATE,
|
|
2580
|
+
[H.ROW]: null
|
|
2486
2581
|
// 布局组件,不映射
|
|
2487
2582
|
}), T = Object.freeze({
|
|
2488
2583
|
EQUAL: "==",
|
|
@@ -2505,7 +2600,7 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2505
2600
|
// 为空
|
|
2506
2601
|
IS_NOT_EMPTY: "is_not_empty"
|
|
2507
2602
|
// 不为空
|
|
2508
|
-
}),
|
|
2603
|
+
}), Pn = Object.freeze({
|
|
2509
2604
|
[T.EQUAL]: "等于",
|
|
2510
2605
|
[T.NOT_EQUAL]: "不等于",
|
|
2511
2606
|
[T.GREATER_THAN]: "大于",
|
|
@@ -2516,7 +2611,7 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2516
2611
|
[T.NOT_CONTAINS]: "不包含",
|
|
2517
2612
|
[T.IS_EMPTY]: "为空",
|
|
2518
2613
|
[T.IS_NOT_EMPTY]: "不为空"
|
|
2519
|
-
}),
|
|
2614
|
+
}), at = Object.freeze({
|
|
2520
2615
|
[g.STRING]: [
|
|
2521
2616
|
T.EQUAL,
|
|
2522
2617
|
T.NOT_EQUAL,
|
|
@@ -2576,30 +2671,30 @@ const vn = ["onClick"], yn = { class: "_fc-l-list" }, hn = ["onDragstart", "onCl
|
|
|
2576
2671
|
T.NOT_EQUAL
|
|
2577
2672
|
]
|
|
2578
2673
|
});
|
|
2579
|
-
function
|
|
2674
|
+
function Mn(e) {
|
|
2580
2675
|
if (!e || !e.type)
|
|
2581
2676
|
return console.warn("组件配置无效,无法计算数据类型", e), g.STRING;
|
|
2582
2677
|
const l = e.type;
|
|
2583
2678
|
if (e.props, l.startsWith("internal-") || l.startsWith("text/") || l.startsWith("application/"))
|
|
2584
2679
|
return console.warn(`检测到非组件类型: ${l},默认使用STRING类型`, e), g.STRING;
|
|
2585
|
-
if (l ===
|
|
2680
|
+
if (l === H.INPUT_NUMBER)
|
|
2586
2681
|
return g.INTEGER;
|
|
2587
|
-
if (l ===
|
|
2682
|
+
if (l === H.DATE_PICKER)
|
|
2588
2683
|
return g.DATE;
|
|
2589
|
-
const t =
|
|
2684
|
+
const t = Un[l];
|
|
2590
2685
|
return t || (console.warn(`未知的组件类型: ${l},默认使用STRING类型`), g.STRING);
|
|
2591
2686
|
}
|
|
2592
|
-
function
|
|
2593
|
-
const l =
|
|
2687
|
+
function Qn(e) {
|
|
2688
|
+
const l = at[e];
|
|
2594
2689
|
return l ? l.map((t) => ({
|
|
2595
|
-
label:
|
|
2690
|
+
label: Pn[t],
|
|
2596
2691
|
value: t
|
|
2597
|
-
})) : (console.warn(`未知的数据类型: ${e},返回默认操作符`),
|
|
2692
|
+
})) : (console.warn(`未知的数据类型: ${e},返回默认操作符`), at[g.STRING]);
|
|
2598
2693
|
}
|
|
2599
|
-
function
|
|
2694
|
+
function Xn(e) {
|
|
2600
2695
|
return e !== T.IS_EMPTY && e !== T.IS_NOT_EMPTY;
|
|
2601
2696
|
}
|
|
2602
|
-
function
|
|
2697
|
+
function $e(e) {
|
|
2603
2698
|
switch (e) {
|
|
2604
2699
|
case g.INTEGER:
|
|
2605
2700
|
case g.DECIMAL:
|
|
@@ -2615,7 +2710,7 @@ function Ie(e) {
|
|
|
2615
2710
|
return "";
|
|
2616
2711
|
}
|
|
2617
2712
|
}
|
|
2618
|
-
function
|
|
2713
|
+
function Ln(e, l) {
|
|
2619
2714
|
if (e == null || e === "")
|
|
2620
2715
|
return !0;
|
|
2621
2716
|
switch (l) {
|
|
@@ -2636,7 +2731,7 @@ function Cn(e, l) {
|
|
|
2636
2731
|
return !0;
|
|
2637
2732
|
}
|
|
2638
2733
|
}
|
|
2639
|
-
function
|
|
2734
|
+
function Zn(e) {
|
|
2640
2735
|
return {
|
|
2641
2736
|
[g.STRING]: "字符串",
|
|
2642
2737
|
[g.INTEGER]: "整数",
|
|
@@ -2647,13 +2742,13 @@ function zn(e) {
|
|
|
2647
2742
|
[g.BOOLEAN]: "布尔值"
|
|
2648
2743
|
}[e] || e;
|
|
2649
2744
|
}
|
|
2650
|
-
function
|
|
2745
|
+
function eo(e) {
|
|
2651
2746
|
return e === g.INTEGER || e === g.DECIMAL;
|
|
2652
2747
|
}
|
|
2653
|
-
function
|
|
2748
|
+
function to(e) {
|
|
2654
2749
|
return e === g.DATE || e === g.DATETIME;
|
|
2655
2750
|
}
|
|
2656
|
-
class
|
|
2751
|
+
class we {
|
|
2657
2752
|
/**
|
|
2658
2753
|
* 构造函数
|
|
2659
2754
|
*
|
|
@@ -2665,7 +2760,7 @@ class Ne {
|
|
|
2665
2760
|
const t = l.props?.variableName;
|
|
2666
2761
|
if (!t)
|
|
2667
2762
|
throw new Error("FormVariable: 组件必须有props.variableName属性");
|
|
2668
|
-
this.id = l.id, this.variableName = t, this.label = l.props?.label || t, this.componentType = l.type, this.dataType =
|
|
2763
|
+
this.id = l.id, this.variableName = t, this.label = l.props?.label || t, this.componentType = l.type, this.dataType = Mn(l), this.metadata = this._extractMetadata(l), this.defaultValue = this._normalizeDefaultValue(l), this.component = l;
|
|
2669
2764
|
}
|
|
2670
2765
|
/**
|
|
2671
2766
|
* 提取组件元数据
|
|
@@ -2675,23 +2770,23 @@ class Ne {
|
|
|
2675
2770
|
* @returns {Object} 元数据对象
|
|
2676
2771
|
*/
|
|
2677
2772
|
_extractMetadata(l) {
|
|
2678
|
-
const t = l.props || {},
|
|
2773
|
+
const t = l.props || {}, n = {
|
|
2679
2774
|
placeholder: t.placeholder || "",
|
|
2680
2775
|
required: l.required !== !1
|
|
2681
2776
|
// 默认为true
|
|
2682
2777
|
};
|
|
2683
2778
|
switch (l.type) {
|
|
2684
|
-
case
|
|
2685
|
-
|
|
2779
|
+
case H.RADIO_GROUP:
|
|
2780
|
+
n.options = Array.isArray(t.options) ? t.options : [];
|
|
2686
2781
|
break;
|
|
2687
|
-
case
|
|
2688
|
-
|
|
2782
|
+
case H.INPUT_NUMBER:
|
|
2783
|
+
n.min = l.min != null ? Number(l.min) : void 0, n.max = l.max != null ? Number(l.max) : void 0;
|
|
2689
2784
|
break;
|
|
2690
|
-
case
|
|
2691
|
-
|
|
2785
|
+
case H.DATE_PICKER:
|
|
2786
|
+
n.dateFormat = "date";
|
|
2692
2787
|
break;
|
|
2693
2788
|
}
|
|
2694
|
-
return
|
|
2789
|
+
return n;
|
|
2695
2790
|
}
|
|
2696
2791
|
/**
|
|
2697
2792
|
* 标准化默认值
|
|
@@ -2702,10 +2797,10 @@ class Ne {
|
|
|
2702
2797
|
*/
|
|
2703
2798
|
_normalizeDefaultValue(l) {
|
|
2704
2799
|
const t = l.props?.defaultValue;
|
|
2705
|
-
return t == null || t === "" ?
|
|
2800
|
+
return t == null || t === "" ? $e(this.dataType) : Ln(t, this.dataType) ? this._convertValue(t, this.dataType) : (console.warn(
|
|
2706
2801
|
`FormVariable: 默认值 "${t}" 不符合类型 "${this.dataType}",使用类型默认值`,
|
|
2707
2802
|
l
|
|
2708
|
-
),
|
|
2803
|
+
), $e(this.dataType));
|
|
2709
2804
|
}
|
|
2710
2805
|
/**
|
|
2711
2806
|
* 转换值到正确的类型
|
|
@@ -2717,7 +2812,7 @@ class Ne {
|
|
|
2717
2812
|
*/
|
|
2718
2813
|
_convertValue(l, t) {
|
|
2719
2814
|
if (l == null || l === "")
|
|
2720
|
-
return
|
|
2815
|
+
return $e(t);
|
|
2721
2816
|
switch (t) {
|
|
2722
2817
|
case g.INTEGER:
|
|
2723
2818
|
return parseInt(l, 10);
|
|
@@ -2831,7 +2926,7 @@ class Ne {
|
|
|
2831
2926
|
...l.metadata
|
|
2832
2927
|
}
|
|
2833
2928
|
};
|
|
2834
|
-
return new
|
|
2929
|
+
return new we(t);
|
|
2835
2930
|
}
|
|
2836
2931
|
/**
|
|
2837
2932
|
* 批量转换组件列表为FormVariable数组(新格式)
|
|
@@ -2841,11 +2936,11 @@ class Ne {
|
|
|
2841
2936
|
* @returns {Array<FormVariable>} FormVariable数组
|
|
2842
2937
|
*/
|
|
2843
2938
|
static fromComponents(l) {
|
|
2844
|
-
return Array.isArray(l) ? l.filter((t) => !(!t || !t.props?.variableName || t.type ===
|
|
2939
|
+
return Array.isArray(l) ? l.filter((t) => !(!t || !t.props?.variableName || t.type === H.ROW)).map((t) => {
|
|
2845
2940
|
try {
|
|
2846
|
-
return new
|
|
2847
|
-
} catch (
|
|
2848
|
-
return console.error("FormVariable.fromComponents: 创建FormVariable失败",
|
|
2941
|
+
return new we(t);
|
|
2942
|
+
} catch (n) {
|
|
2943
|
+
return console.error("FormVariable.fromComponents: 创建FormVariable失败", n, t), null;
|
|
2849
2944
|
}
|
|
2850
2945
|
}).filter((t) => t !== null) : (console.warn("FormVariable.fromComponents: components必须是数组"), []);
|
|
2851
2946
|
}
|
|
@@ -2860,93 +2955,93 @@ class Ne {
|
|
|
2860
2955
|
return l ? typeof l.variableName == "string" && typeof l.label == "string" && typeof l.componentType == "string" && typeof l.dataType == "string" && typeof l.metadata == "object" : !1;
|
|
2861
2956
|
}
|
|
2862
2957
|
}
|
|
2863
|
-
function
|
|
2958
|
+
function lo(e) {
|
|
2864
2959
|
return e?.components ? e.components.filter(
|
|
2865
2960
|
(l) => l?.type === "row" || l?.props?.variableName && l?.props?.label
|
|
2866
2961
|
) : [];
|
|
2867
2962
|
}
|
|
2868
|
-
function
|
|
2869
|
-
return Array.isArray(e) ? e.reduce((l, t) => (t && (t.type === "row" && t.children ? t.children.forEach((
|
|
2870
|
-
Array.isArray(
|
|
2963
|
+
function Me(e) {
|
|
2964
|
+
return Array.isArray(e) ? e.reduce((l, t) => (t && (t.type === "row" && t.children ? t.children.forEach((n) => {
|
|
2965
|
+
Array.isArray(n) && l.push(...Me(n));
|
|
2871
2966
|
}) : t.props?.variableName && l.push(t)), l), []) : [];
|
|
2872
2967
|
}
|
|
2873
|
-
function
|
|
2968
|
+
function no(e) {
|
|
2874
2969
|
if (!Array.isArray(e)) return [];
|
|
2875
|
-
if (e.length > 0 && e[0] instanceof
|
|
2970
|
+
if (e.length > 0 && e[0] instanceof we)
|
|
2876
2971
|
return e;
|
|
2877
|
-
const l =
|
|
2878
|
-
return
|
|
2972
|
+
const l = Me(e);
|
|
2973
|
+
return we.fromComponents(l);
|
|
2879
2974
|
}
|
|
2880
|
-
function
|
|
2975
|
+
function oo(e, l) {
|
|
2881
2976
|
return Array.isArray(e) && e.find((t) => t.variableName === l) || null;
|
|
2882
2977
|
}
|
|
2883
|
-
function
|
|
2978
|
+
function ao(e) {
|
|
2884
2979
|
const l = [];
|
|
2885
2980
|
return e ? (e.type || l.push("组件类型不能为空"), e.props ? (e.props.variableName || l.push("变量名不能为空"), e.props.label || l.push("标签不能为空"), ["select", "radio", "checkbox"].includes(e.type) && (Array.isArray(e.props.options) && e.props.options.length > 0 || l.push(`${e.type}类型必须配置选项列表`))) : l.push("组件属性不能为空"), {
|
|
2886
2981
|
valid: l.length === 0,
|
|
2887
2982
|
errors: l
|
|
2888
2983
|
}) : (l.push("组件配置不能为空"), { valid: !1, errors: l });
|
|
2889
2984
|
}
|
|
2890
|
-
function
|
|
2891
|
-
return
|
|
2985
|
+
function so(e) {
|
|
2986
|
+
return Me(e).length;
|
|
2892
2987
|
}
|
|
2893
|
-
const
|
|
2894
|
-
version:
|
|
2988
|
+
const Fn = [xn, ct], zn = "0.1.0", io = {
|
|
2989
|
+
version: zn,
|
|
2895
2990
|
install(e) {
|
|
2896
|
-
|
|
2991
|
+
Fn.forEach((l) => {
|
|
2897
2992
|
l.name && e.component(l.name, l);
|
|
2898
2993
|
});
|
|
2899
2994
|
}
|
|
2900
2995
|
};
|
|
2901
2996
|
export {
|
|
2902
2997
|
g as BaseDataType,
|
|
2903
|
-
|
|
2998
|
+
lt as COMPONENT_CATEGORIES,
|
|
2904
2999
|
d as COMPONENT_TYPES,
|
|
2905
|
-
|
|
2906
|
-
|
|
3000
|
+
zt as COMPONENT_TYPE_LABELS,
|
|
3001
|
+
H as ComponentType,
|
|
2907
3002
|
T as ConditionOperator,
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
3003
|
+
at as DATA_TYPE_OPERATORS_MAP,
|
|
3004
|
+
Yn as DEFAULT_CONFIG,
|
|
3005
|
+
hn as FORM_KIND,
|
|
3006
|
+
Xt as FcCanvasField,
|
|
3007
|
+
xn as FormDesigner,
|
|
3008
|
+
we as FormVariable,
|
|
3009
|
+
ct as FormViewer,
|
|
3010
|
+
Pn as OPERATOR_LABEL_MAP,
|
|
3011
|
+
Xe as OPTION_COMPONENT_TYPES,
|
|
3012
|
+
yn as SCHEMA_VERSION,
|
|
3013
|
+
Jn as WIDTH_PRESETS,
|
|
3014
|
+
Mn as computeDataType,
|
|
3015
|
+
so as countFormComponents,
|
|
3016
|
+
io as default,
|
|
3017
|
+
Nn as downloadJSON,
|
|
3018
|
+
En as downloadText,
|
|
3019
|
+
no as enrichFormVariables,
|
|
3020
|
+
it as ensureComponentId,
|
|
3021
|
+
nt as exportForm,
|
|
3022
|
+
lo as filterValidComponents,
|
|
3023
|
+
oo as findFormVariable,
|
|
3024
|
+
Ae as generateComponentId,
|
|
3025
|
+
Me as getAllFormComponents,
|
|
3026
|
+
Zn as getDataTypeLabel,
|
|
2932
3027
|
Z as getFieldName,
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
3028
|
+
Qn as getOperatorsForDataType,
|
|
3029
|
+
$e as getTypeDefaultValue,
|
|
3030
|
+
ot as importForm,
|
|
3031
|
+
to as isDateType,
|
|
2937
3032
|
rt as isEmpty,
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
3033
|
+
eo as isNumericType,
|
|
3034
|
+
Ln as isValidValueForType,
|
|
3035
|
+
Ue as normalizeForm,
|
|
3036
|
+
xe as normalizeNumberValue,
|
|
3037
|
+
jt as normalizeOptions,
|
|
3038
|
+
Xn as operatorNeedsValue,
|
|
3039
|
+
Gt as parseWidth,
|
|
3040
|
+
An as pickJSONFile,
|
|
3041
|
+
On as readTextFile,
|
|
3042
|
+
Kn as sanitizeFileName,
|
|
3043
|
+
ao as validateComponentConfig,
|
|
3044
|
+
Pe as validateForm,
|
|
3045
|
+
zn as version
|
|
2951
3046
|
};
|
|
2952
3047
|
//# sourceMappingURL=gbformdesign.js.map
|