sy-form-designer 1.0.0
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/_commonjsHelpers-C6fGbg64.js +6 -0
- package/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/designer-DsmFhyc-.js +198 -0
- package/index-BFhlK9cb.js +39 -0
- package/index-CKi_slLG.js +1220 -0
- package/index-CPJTgrJ5.js +228 -0
- package/index-CiII3mIY.js +350 -0
- package/index-CsmEJRUU.js +2433 -0
- package/index.css +1 -0
- package/index.js +5 -0
- package/index.umd.cjs +1011 -0
- package/package.json +15 -0
- package/render-CfYxuuCz.js +958 -0
- package/settings-Cc6phwii.js +14907 -0
- package/vite.svg +1 -0
- package/vue-i18n-CiM3E4ph.js +3113 -0
- package/widgets-BHbptXKj.js +90 -0
|
@@ -0,0 +1,958 @@
|
|
|
1
|
+
import { inject, ref, defineComponent, getCurrentInstance, watch, provide, createVNode, Fragment, resolveComponent, computed, createTextVNode, h, onMounted, isVNode } from "vue";
|
|
2
|
+
import draggable from "vuedraggable";
|
|
3
|
+
import { E as ElMessage } from "./index-CKi_slLG.js";
|
|
4
|
+
function isNull(n) {
|
|
5
|
+
return n == null;
|
|
6
|
+
}
|
|
7
|
+
const getRegExp = function(n) {
|
|
8
|
+
return {
|
|
9
|
+
number: "/^[-]?\\d+(\\.\\d+)?$/",
|
|
10
|
+
letter: "/^[A-Za-z]+$/",
|
|
11
|
+
letterAndNumber: "/^[A-Za-z0-9]+$/",
|
|
12
|
+
mobilePhone: "/^[1][3-9][0-9]{9}$/",
|
|
13
|
+
letterStartNumberIncluded: "/^[A-Za-z]+[A-Za-z\\d]*$/",
|
|
14
|
+
noChinese: "/^[^一-龥]+$/",
|
|
15
|
+
chinese: "/^[一-龥]+$/",
|
|
16
|
+
email: "/^([-_A-Za-z0-9.]+)@([_A-Za-z0-9]+\\.)+[A-Za-z0-9]{2,3}$/",
|
|
17
|
+
url: "/^([hH][tT]{2}[pP]:\\/\\/|[hH][tT]{2}[pP][sS]:\\/\\/)(([A-Za-z0-9-~]+)\\.)+([A-Za-z0-9-~\\/])+$/"
|
|
18
|
+
}[n];
|
|
19
|
+
}, validateFn = function(validatorName, rule, value, callback, defaultErrorMsg) {
|
|
20
|
+
if (isNull(value) || value.length <= 0) {
|
|
21
|
+
callback();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const reg = eval(getRegExp(validatorName));
|
|
25
|
+
if (reg.test(value))
|
|
26
|
+
callback();
|
|
27
|
+
else {
|
|
28
|
+
let n = rule.errorMsg || defaultErrorMsg;
|
|
29
|
+
callback(new Error(n));
|
|
30
|
+
}
|
|
31
|
+
}, FormValidators = {
|
|
32
|
+
/* 数字 */
|
|
33
|
+
number(n, c, f) {
|
|
34
|
+
validateFn("number", n, c, f, "[" + n.label + "]包含非数字字符");
|
|
35
|
+
},
|
|
36
|
+
/* 字母 */
|
|
37
|
+
letter(n, c, f) {
|
|
38
|
+
validateFn("letter", n, c, f, "[" + n.label + "]包含非字母字符");
|
|
39
|
+
},
|
|
40
|
+
/* 字母和数字 */
|
|
41
|
+
letterAndNumber(n, c, f) {
|
|
42
|
+
validateFn("letterAndNumber", n, c, f, "[" + n.label + "]只能输入字母或数字");
|
|
43
|
+
},
|
|
44
|
+
/* 手机号码 */
|
|
45
|
+
mobilePhone(n, c, f) {
|
|
46
|
+
validateFn("mobilePhone", n, c, f, "[" + n.label + "]手机号码格式有误");
|
|
47
|
+
},
|
|
48
|
+
/* 禁止空白字符开头 */
|
|
49
|
+
noBlankStart(n, c, f) {
|
|
50
|
+
},
|
|
51
|
+
/* 禁止空白字符结尾 */
|
|
52
|
+
noBlankEnd(n, c, f) {
|
|
53
|
+
},
|
|
54
|
+
/* 字母开头,仅可包含数字 */
|
|
55
|
+
letterStartNumberIncluded(n, c, f) {
|
|
56
|
+
validateFn("letterStartNumberIncluded", n, c, f, "[" + n.label + "]必须以字母开头,可包含数字");
|
|
57
|
+
},
|
|
58
|
+
/* 禁止中文输入 */
|
|
59
|
+
noChinese(n, c, f) {
|
|
60
|
+
validateFn("noChinese", n, c, f, "[" + n.label + "]不可输入中文字符");
|
|
61
|
+
},
|
|
62
|
+
/* 必须中文输入 */
|
|
63
|
+
chinese(n, c, f) {
|
|
64
|
+
validateFn("chinese", n, c, f, "[" + n.label + "]只能输入中文字符");
|
|
65
|
+
},
|
|
66
|
+
/* 电子邮箱 */
|
|
67
|
+
email(n, c, f) {
|
|
68
|
+
validateFn("email", n, c, f, "[" + n.label + "]邮箱格式有误");
|
|
69
|
+
},
|
|
70
|
+
/* URL网址 */
|
|
71
|
+
url(n, c, f) {
|
|
72
|
+
validateFn("url", n, c, f, "[" + n.label + "]URL格式有误");
|
|
73
|
+
},
|
|
74
|
+
/*测试
|
|
75
|
+
test(rule, value, callback, errorMsg) {
|
|
76
|
+
//空值不校验
|
|
77
|
+
if (isNull(value) || (value.length <= 0)) {
|
|
78
|
+
callback()
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (value < 100) {
|
|
83
|
+
callback(new Error('[' + rule.label + ']不能小于100'))
|
|
84
|
+
} else {
|
|
85
|
+
callback()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
*/
|
|
89
|
+
regExp(rule, value, callback) {
|
|
90
|
+
if (isNull(value) || value.length <= 0) {
|
|
91
|
+
callback();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const pattern = eval(rule.regExp);
|
|
95
|
+
if (pattern.test(value))
|
|
96
|
+
callback();
|
|
97
|
+
else {
|
|
98
|
+
let n = rule.errorMsg || "[" + rule.label + "]invalid value";
|
|
99
|
+
callback(new Error(n));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, fieldOptionMixin = {
|
|
103
|
+
inject: ["refDict"],
|
|
104
|
+
// on ctx of instance
|
|
105
|
+
methods: {
|
|
106
|
+
// on ctx of instance
|
|
107
|
+
getWidgets: function() {
|
|
108
|
+
return this.refDict;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
function useFieldMixin(n, c) {
|
|
113
|
+
const f = inject("refDict"), x = ref([]), s = () => {
|
|
114
|
+
f == null || !n.options.name || (f.value[n.options.name] = c);
|
|
115
|
+
}, M = () => {
|
|
116
|
+
if (n.options.onCreated)
|
|
117
|
+
try {
|
|
118
|
+
new Function(n.options.onCreated).call(c);
|
|
119
|
+
} catch (g) {
|
|
120
|
+
console.error(g);
|
|
121
|
+
}
|
|
122
|
+
}, b = () => {
|
|
123
|
+
if (n.options.onMounted)
|
|
124
|
+
try {
|
|
125
|
+
new Function(n.options.onMounted).call(c);
|
|
126
|
+
} catch (g) {
|
|
127
|
+
console.error(g);
|
|
128
|
+
}
|
|
129
|
+
}, C = (g) => {
|
|
130
|
+
n.options.onChange && new Function("value", "oldValue", n.options.onChange).call(c, g);
|
|
131
|
+
};
|
|
132
|
+
return {
|
|
133
|
+
registerRef: s,
|
|
134
|
+
handleOnCreated: M,
|
|
135
|
+
handleOnMounted: b,
|
|
136
|
+
handleOnChange: (g) => {
|
|
137
|
+
C(g);
|
|
138
|
+
},
|
|
139
|
+
removeRef: (g) => {
|
|
140
|
+
delete f.value[g];
|
|
141
|
+
},
|
|
142
|
+
rebuildRules: () => {
|
|
143
|
+
if (n.formItemFlag && (n.options.required && x.value.push({
|
|
144
|
+
required: !0,
|
|
145
|
+
trigger: ["blur"],
|
|
146
|
+
message: n.options.requiredHint || "必须填写"
|
|
147
|
+
}), n.options.validation)) {
|
|
148
|
+
let g = n.options.validation;
|
|
149
|
+
FormValidators[g] ? x.value.push({
|
|
150
|
+
validator: FormValidators[g],
|
|
151
|
+
trigger: ["blur", "change"],
|
|
152
|
+
label: n.options.label,
|
|
153
|
+
errorMsg: n.options.validationHint
|
|
154
|
+
}) : x.value.push({
|
|
155
|
+
validator: FormValidators.regExp,
|
|
156
|
+
trigger: ["blur", "change"],
|
|
157
|
+
regExp: g,
|
|
158
|
+
label: n.options.label,
|
|
159
|
+
errorMsg: n.options.validationHint
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
rules: x
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function _isSlot(n) {
|
|
167
|
+
return typeof n == "function" || Object.prototype.toString.call(n) === "[object Object]" && !isVNode(n);
|
|
168
|
+
}
|
|
169
|
+
const render = /* @__PURE__ */ defineComponent({
|
|
170
|
+
components: {},
|
|
171
|
+
props: {
|
|
172
|
+
conf: {
|
|
173
|
+
type: Object,
|
|
174
|
+
default: () => {
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
mode: {
|
|
178
|
+
type: String,
|
|
179
|
+
default: () => "edit"
|
|
180
|
+
},
|
|
181
|
+
active: {
|
|
182
|
+
type: Object,
|
|
183
|
+
default: null
|
|
184
|
+
},
|
|
185
|
+
/* Original form data */
|
|
186
|
+
formData: {
|
|
187
|
+
type: Object,
|
|
188
|
+
default: {}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
emits: ["update:active", "setting"],
|
|
192
|
+
setup(n, c) {
|
|
193
|
+
const f = getCurrentInstance().proxy, x = ref({}), s = ref(n), M = ref([]);
|
|
194
|
+
let b = ref(n.active);
|
|
195
|
+
watch(() => b.value, (t) => {
|
|
196
|
+
c.emit("update:active", t);
|
|
197
|
+
});
|
|
198
|
+
const C = (t, l) => {
|
|
199
|
+
n.mode === "edit" && (t.stopPropagation(), b.value = l);
|
|
200
|
+
}, E = (t) => {
|
|
201
|
+
const l = [];
|
|
202
|
+
return t.widgetList && t.widgetList.length && t.widgetList.forEach((u) => {
|
|
203
|
+
l.push(g({
|
|
204
|
+
conf: u,
|
|
205
|
+
parent: t
|
|
206
|
+
}));
|
|
207
|
+
}), l;
|
|
208
|
+
}, y = /* @__PURE__ */ defineComponent({
|
|
209
|
+
props: ["conf", "mode", "rules"],
|
|
210
|
+
setup(t, {
|
|
211
|
+
slots: l
|
|
212
|
+
}) {
|
|
213
|
+
const u = computed(() => b.value && b.value.id === t.conf.id);
|
|
214
|
+
return () => {
|
|
215
|
+
let m, r;
|
|
216
|
+
return createVNode(Fragment, null, [t.mode === "edit" && createVNode(resolveComponent("el-form-item"), {
|
|
217
|
+
rules: t.rules,
|
|
218
|
+
label: t.conf.options.labelHidden ? " " : t.conf.options.label,
|
|
219
|
+
"label-width": t.conf.options.labelWidth,
|
|
220
|
+
class: `${u.value && "selected" || ""} ${t.conf.options.labelHidden ? "hidden-label" : ""} ${t.conf.options.labelAlign}`,
|
|
221
|
+
onClick: (v) => {
|
|
222
|
+
C(v, t.conf);
|
|
223
|
+
},
|
|
224
|
+
required: t.conf.options.required
|
|
225
|
+
}, _isSlot(m = l.default()) ? m : {
|
|
226
|
+
default: () => [m]
|
|
227
|
+
}), t.mode === "view" && (!t.conf.options.hidden || O(t.conf)) && createVNode(resolveComponent("el-form-item"), {
|
|
228
|
+
rules: t.rules,
|
|
229
|
+
prop: t.conf.options.name,
|
|
230
|
+
label: t.conf.options.labelHidden ? " " : t.conf.options.label,
|
|
231
|
+
"label-width": t.conf.options.labelHidden ? "0px" : t.conf.options.labelWidth,
|
|
232
|
+
class: ` ${t.conf.options.labelHidden ? "hidden-label" : ""} ${t.conf.options.labelAlign}`,
|
|
233
|
+
required: t.conf.options.required
|
|
234
|
+
}, _isSlot(r = l.default()) ? r : {
|
|
235
|
+
default: () => [r]
|
|
236
|
+
})]);
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}), p = /* @__PURE__ */ defineComponent({
|
|
240
|
+
props: {
|
|
241
|
+
self: {
|
|
242
|
+
type: Object
|
|
243
|
+
},
|
|
244
|
+
parent: {
|
|
245
|
+
type: Object
|
|
246
|
+
},
|
|
247
|
+
childrenKey: {
|
|
248
|
+
type: String,
|
|
249
|
+
default: () => "widgetList"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
setup(t) {
|
|
253
|
+
const l = t.parent[t.childrenKey], u = (e) => {
|
|
254
|
+
C(e, t.parent);
|
|
255
|
+
}, m = (e) => {
|
|
256
|
+
e.stopPropagation(), l && l.splice(l.indexOf(t.self), 1);
|
|
257
|
+
}, r = (e) => {
|
|
258
|
+
if (e.stopPropagation(), l) {
|
|
259
|
+
let o = l.indexOf(t.self);
|
|
260
|
+
if (o == 0) {
|
|
261
|
+
ElMessage("已经是第一个了");
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
let a = l.splice(o, 1)[0];
|
|
265
|
+
l.splice(o - 1, 0, a);
|
|
266
|
+
}
|
|
267
|
+
}, v = (e) => {
|
|
268
|
+
if (e.stopPropagation(), l) {
|
|
269
|
+
let o = l.indexOf(t.self);
|
|
270
|
+
if (o == l.length - 1) {
|
|
271
|
+
ElMessage("已经是最后一个了");
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
let a = l.splice(o, 1)[0];
|
|
275
|
+
l.splice(o + 1, 0, a);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
return () => createVNode("div", null, [createVNode("i", {
|
|
279
|
+
title: "选中父组件"
|
|
280
|
+
}, [createVNode("svg", {
|
|
281
|
+
class: "svg-icon",
|
|
282
|
+
"aria-hidden": "true",
|
|
283
|
+
onClick: u
|
|
284
|
+
}, [createVNode("use", {
|
|
285
|
+
"xlink:href": "#icon-el-back"
|
|
286
|
+
}, null)])]), createVNode("i", {
|
|
287
|
+
title: "上移组件"
|
|
288
|
+
}, [createVNode("svg", {
|
|
289
|
+
class: "svg-icon",
|
|
290
|
+
"aria-hidden": "true",
|
|
291
|
+
onClick: r
|
|
292
|
+
}, [createVNode("use", {
|
|
293
|
+
"xlink:href": "#icon-el-move-up"
|
|
294
|
+
}, null)])]), createVNode("i", {
|
|
295
|
+
title: "下移组件"
|
|
296
|
+
}, [createVNode("svg", {
|
|
297
|
+
class: "svg-icon",
|
|
298
|
+
"aria-hidden": "true",
|
|
299
|
+
onClick: v
|
|
300
|
+
}, [createVNode("use", {
|
|
301
|
+
"xlink:href": "#icon-el-move-down"
|
|
302
|
+
}, null)])]), createVNode("i", {
|
|
303
|
+
title: "配置组件"
|
|
304
|
+
}, [createVNode("svg", {
|
|
305
|
+
class: "svg-icon",
|
|
306
|
+
"aria-hidden": "true"
|
|
307
|
+
}, [createVNode("use", {
|
|
308
|
+
"xlink:href": "#icon-el-set-up"
|
|
309
|
+
}, null)])]), createVNode("i", {
|
|
310
|
+
title: "移除组件"
|
|
311
|
+
}, [createVNode("svg", {
|
|
312
|
+
class: "svg-icon",
|
|
313
|
+
"aria-hidden": "true",
|
|
314
|
+
onClick: m
|
|
315
|
+
}, [createVNode("use", {
|
|
316
|
+
"xlink:href": "#icon-el-delete"
|
|
317
|
+
}, null)])])]);
|
|
318
|
+
}
|
|
319
|
+
}), g = ({
|
|
320
|
+
conf: t,
|
|
321
|
+
parent: l
|
|
322
|
+
}) => {
|
|
323
|
+
let u = "", m = null;
|
|
324
|
+
const r = computed(() => b.value && b.value.id === t.id);
|
|
325
|
+
if (t.category == "container" ? u = "container-wrapper" : u = "field-wrapper", t.type == "grid") {
|
|
326
|
+
const v = /* @__PURE__ */ defineComponent({
|
|
327
|
+
props: ["conf", "active"],
|
|
328
|
+
setup(o) {
|
|
329
|
+
const a = computed(() => o.active && o.active.id === o.conf.id), i = {
|
|
330
|
+
item: ({
|
|
331
|
+
element: F,
|
|
332
|
+
index: w
|
|
333
|
+
}) => createVNode("div", {
|
|
334
|
+
className: "transition-group-el"
|
|
335
|
+
}, [createTextVNode(" "), h(g, {
|
|
336
|
+
conf: F,
|
|
337
|
+
parent: o.conf
|
|
338
|
+
})])
|
|
339
|
+
}, d = (F) => {
|
|
340
|
+
b.value = o.conf.widgetList[F.newIndex];
|
|
341
|
+
}, N = () => {
|
|
342
|
+
};
|
|
343
|
+
return () => createVNode(resolveComponent("el-col"), {
|
|
344
|
+
class: `grid-cell ${a.value && "selected" || ""}`,
|
|
345
|
+
span: o.conf.options.span
|
|
346
|
+
}, {
|
|
347
|
+
default: () => {
|
|
348
|
+
var F;
|
|
349
|
+
return [s.value.mode == "edit" && createVNode(draggable, {
|
|
350
|
+
tag: "div",
|
|
351
|
+
class: "form-widget-list",
|
|
352
|
+
"item-key": "id",
|
|
353
|
+
modelValue: o.conf.widgetList,
|
|
354
|
+
"onUpdate:modelValue": (w) => o.conf.widgetList = w,
|
|
355
|
+
group: "people",
|
|
356
|
+
ghostClass: "ghost",
|
|
357
|
+
animation: 200,
|
|
358
|
+
handle: ".drag-handler",
|
|
359
|
+
onEnd: N,
|
|
360
|
+
onAdd: d
|
|
361
|
+
}, i), s.value.mode == "view" && createVNode(Fragment, null, [(F = o.conf.widgetList) == null ? void 0 : F.map((w) => h(g, {
|
|
362
|
+
conf: w,
|
|
363
|
+
parent: o.conf
|
|
364
|
+
}))]), a.value && createVNode(p, {
|
|
365
|
+
className: "grid-col-action",
|
|
366
|
+
self: o.conf,
|
|
367
|
+
parent: t,
|
|
368
|
+
childrenKey: "cols"
|
|
369
|
+
}, null), a.value && createVNode("div", {
|
|
370
|
+
className: "grid-col-handler"
|
|
371
|
+
}, [createVNode("i", null, [createTextVNode("栅格列")])])];
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}), e = /* @__PURE__ */ defineComponent({
|
|
376
|
+
props: ["conf"],
|
|
377
|
+
setup(o) {
|
|
378
|
+
return () => {
|
|
379
|
+
let a, i;
|
|
380
|
+
return createVNode("div", {
|
|
381
|
+
class: [u].join(" ")
|
|
382
|
+
}, [s.value.mode == "edit" && createVNode(resolveComponent("el-row"), {
|
|
383
|
+
class: `grid-container ${r.value ? "selected" : ""}`,
|
|
384
|
+
gutter: t.options.gutter
|
|
385
|
+
}, _isSlot(a = o.conf.cols.map((d) => createVNode(v, {
|
|
386
|
+
id: d.id,
|
|
387
|
+
conf: d,
|
|
388
|
+
active: b.value,
|
|
389
|
+
onClick: (N) => C(N, d)
|
|
390
|
+
}, null))) ? a : {
|
|
391
|
+
default: () => [a]
|
|
392
|
+
}), s.value.mode == "view" && (!o.conf.options.hidden || O(o.conf)) && createVNode(resolveComponent("el-row"), {
|
|
393
|
+
class: "grid-container",
|
|
394
|
+
gutter: t.options.gutter
|
|
395
|
+
}, _isSlot(i = o.conf.cols.map((d) => createVNode(Fragment, null, [(!d.options.hidden || O(d)) && createVNode(v, {
|
|
396
|
+
id: d.id,
|
|
397
|
+
conf: d
|
|
398
|
+
}, null)]))) ? i : {
|
|
399
|
+
default: () => [i]
|
|
400
|
+
}), r.value && createVNode(p, {
|
|
401
|
+
class: "container-action",
|
|
402
|
+
self: o.conf,
|
|
403
|
+
parent: l
|
|
404
|
+
}, null), r.value && createVNode("div", {
|
|
405
|
+
className: "drag-handler"
|
|
406
|
+
}, [createVNode("i", {
|
|
407
|
+
title: "拖拽手柄"
|
|
408
|
+
}, [createVNode("svg", {
|
|
409
|
+
class: "svg-icon",
|
|
410
|
+
"aria-hidden": "true"
|
|
411
|
+
}, [createVNode("use", {
|
|
412
|
+
"xlink:href": "#icon-el-drag-move"
|
|
413
|
+
}, null)])]), createVNode("i", null, [createTextVNode("栅格")])])]);
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
m = (o) => createVNode(e, {
|
|
418
|
+
id: o.id,
|
|
419
|
+
conf: o,
|
|
420
|
+
onClick: (a) => C(a, o)
|
|
421
|
+
}, null);
|
|
422
|
+
} else if (t.type == "input") {
|
|
423
|
+
const v = /* @__PURE__ */ defineComponent({
|
|
424
|
+
inject: ["render"],
|
|
425
|
+
mixins: [fieldOptionMixin],
|
|
426
|
+
props: ["conf"],
|
|
427
|
+
setup(o) {
|
|
428
|
+
const a = getCurrentInstance().proxy, i = useFieldMixin(t, a);
|
|
429
|
+
return i.registerRef(), i.rebuildRules(), i.handleOnCreated(), onMounted(() => {
|
|
430
|
+
i.handleOnMounted();
|
|
431
|
+
}), () => createVNode("div", {
|
|
432
|
+
className: u
|
|
433
|
+
}, [createVNode(y, {
|
|
434
|
+
rules: i.rules.value,
|
|
435
|
+
conf: o.conf,
|
|
436
|
+
mode: s.value.mode
|
|
437
|
+
}, {
|
|
438
|
+
default: () => [s.value.mode == "edit" && createVNode(resolveComponent("el-input"), {
|
|
439
|
+
clearable: o.conf.options.clearable,
|
|
440
|
+
placeholder: o.conf.options.placeholder,
|
|
441
|
+
modelValue: o.conf.options.defaultValue,
|
|
442
|
+
"onUpdate:modelValue": (d) => o.conf.options.defaultValue = d,
|
|
443
|
+
onChange: i.handleOnChange
|
|
444
|
+
}, null), s.value.mode == "view" && createVNode(resolveComponent("el-input"), {
|
|
445
|
+
clearable: o.conf.options.clearable,
|
|
446
|
+
placeholder: o.conf.options.placeholder,
|
|
447
|
+
modelValue: V.value[o.conf.options.name],
|
|
448
|
+
"onUpdate:modelValue": (d) => V.value[o.conf.options.name] = d,
|
|
449
|
+
onChange: i.handleOnChange
|
|
450
|
+
}, null)]
|
|
451
|
+
}), r.value && createVNode(p, {
|
|
452
|
+
className: "field-action",
|
|
453
|
+
self: o.conf,
|
|
454
|
+
parent: l
|
|
455
|
+
}, null), r.value && createVNode("div", {
|
|
456
|
+
className: "drag-handler"
|
|
457
|
+
}, [createVNode("i", {
|
|
458
|
+
title: "拖拽手柄"
|
|
459
|
+
}, [createVNode("svg", {
|
|
460
|
+
class: "svg-icon",
|
|
461
|
+
"aria-hidden": "true"
|
|
462
|
+
}, [createVNode("use", {
|
|
463
|
+
"xlink:href": "#icon-el-drag-move"
|
|
464
|
+
}, null)])]), createVNode("i", null, [createTextVNode("单行输入")])])]);
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
m = (o) => createVNode(v, {
|
|
468
|
+
id: o.id,
|
|
469
|
+
conf: o,
|
|
470
|
+
onClick: (a) => C(a, o)
|
|
471
|
+
}, null);
|
|
472
|
+
} else if (t.type == "textarea") {
|
|
473
|
+
const v = /* @__PURE__ */ defineComponent({
|
|
474
|
+
props: ["conf"],
|
|
475
|
+
mixins: [fieldOptionMixin],
|
|
476
|
+
setup(e) {
|
|
477
|
+
const o = getCurrentInstance().proxy, a = useFieldMixin(t, o);
|
|
478
|
+
return a.registerRef(), a.rebuildRules(), a.handleOnCreated(), onMounted(() => {
|
|
479
|
+
a.handleOnMounted();
|
|
480
|
+
}), () => createVNode("div", {
|
|
481
|
+
className: u
|
|
482
|
+
}, [createVNode(y, {
|
|
483
|
+
rules: a.rules.value,
|
|
484
|
+
conf: e.conf,
|
|
485
|
+
mode: s.value.mode
|
|
486
|
+
}, {
|
|
487
|
+
default: () => [s.value.mode == "edit" && createVNode(resolveComponent("el-input"), {
|
|
488
|
+
type: "textarea",
|
|
489
|
+
rows: t.options.rows,
|
|
490
|
+
placeholder: e.conf.options.placeholder,
|
|
491
|
+
modelValue: e.conf.options.defaultValue,
|
|
492
|
+
"onUpdate:modelValue": (i) => e.conf.options.defaultValue = i,
|
|
493
|
+
onChange: a.handleOnChange
|
|
494
|
+
}, null), s.value.mode == "view" && createVNode(resolveComponent("el-input"), {
|
|
495
|
+
type: "textarea",
|
|
496
|
+
rows: t.options.rows,
|
|
497
|
+
placeholder: e.conf.options.placeholder,
|
|
498
|
+
modelValue: V.value[e.conf.options.name],
|
|
499
|
+
"onUpdate:modelValue": (i) => V.value[e.conf.options.name] = i,
|
|
500
|
+
onChange: a.handleOnChange
|
|
501
|
+
}, null)]
|
|
502
|
+
}), r.value && createVNode(p, {
|
|
503
|
+
className: "field-action",
|
|
504
|
+
self: e.conf,
|
|
505
|
+
parent: l
|
|
506
|
+
}, null), r.value && createVNode("div", {
|
|
507
|
+
className: "drag-handler"
|
|
508
|
+
}, [createVNode("i", {
|
|
509
|
+
title: "拖拽手柄"
|
|
510
|
+
}, [createVNode("svg", {
|
|
511
|
+
class: "svg-icon",
|
|
512
|
+
"aria-hidden": "true"
|
|
513
|
+
}, [createVNode("use", {
|
|
514
|
+
"xlink:href": "#icon-el-drag-move"
|
|
515
|
+
}, null)])]), createVNode("i", null, [createTextVNode("多行输入")])])]);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
m = (e) => createVNode(v, {
|
|
519
|
+
id: e.id,
|
|
520
|
+
conf: e,
|
|
521
|
+
onClick: (o) => C(o, e)
|
|
522
|
+
}, null);
|
|
523
|
+
} else if (t.type == "radio") {
|
|
524
|
+
const v = /* @__PURE__ */ defineComponent({
|
|
525
|
+
props: ["conf"],
|
|
526
|
+
mixins: [fieldOptionMixin],
|
|
527
|
+
setup(e) {
|
|
528
|
+
const o = getCurrentInstance().proxy, a = useFieldMixin(t, o);
|
|
529
|
+
return a.registerRef(), a.rebuildRules(), a.handleOnCreated(), onMounted(() => {
|
|
530
|
+
a.handleOnMounted();
|
|
531
|
+
}), () => createVNode("div", {
|
|
532
|
+
className: u
|
|
533
|
+
}, [createVNode(y, {
|
|
534
|
+
rules: a.rules.value,
|
|
535
|
+
conf: e.conf,
|
|
536
|
+
mode: s.value.mode
|
|
537
|
+
}, {
|
|
538
|
+
default: () => [s.value.mode == "edit" && createVNode(resolveComponent("el-radio-group"), {
|
|
539
|
+
style: {
|
|
540
|
+
display: "inline"
|
|
541
|
+
},
|
|
542
|
+
modelValue: e.conf.options.defaultValue,
|
|
543
|
+
"onUpdate:modelValue": (i) => e.conf.options.defaultValue = i,
|
|
544
|
+
onChange: a.handleOnChange
|
|
545
|
+
}, {
|
|
546
|
+
default: () => {
|
|
547
|
+
var i;
|
|
548
|
+
return [(i = e.conf.options.optionItems) == null ? void 0 : i.map((d, N) => createVNode(resolveComponent("el-radio"), {
|
|
549
|
+
key: N,
|
|
550
|
+
value: d.value,
|
|
551
|
+
disabled: d.disabled,
|
|
552
|
+
style: {
|
|
553
|
+
display: e.conf.options.displayStyle
|
|
554
|
+
}
|
|
555
|
+
}, {
|
|
556
|
+
default: () => [d.label]
|
|
557
|
+
}))];
|
|
558
|
+
}
|
|
559
|
+
}), s.value.mode == "view" && createVNode(resolveComponent("el-radio-group"), {
|
|
560
|
+
style: {
|
|
561
|
+
display: "inline"
|
|
562
|
+
},
|
|
563
|
+
modelValue: V.value[e.conf.options.name],
|
|
564
|
+
"onUpdate:modelValue": (i) => V.value[e.conf.options.name] = i,
|
|
565
|
+
onChange: a.handleOnChange
|
|
566
|
+
}, {
|
|
567
|
+
default: () => {
|
|
568
|
+
var i;
|
|
569
|
+
return [(i = e.conf.options.optionItems) == null ? void 0 : i.map((d, N) => createVNode(resolveComponent("el-radio"), {
|
|
570
|
+
key: N,
|
|
571
|
+
value: d.value,
|
|
572
|
+
disabled: d.disabled,
|
|
573
|
+
style: {
|
|
574
|
+
display: e.conf.options.displayStyle
|
|
575
|
+
}
|
|
576
|
+
}, {
|
|
577
|
+
default: () => [d.label]
|
|
578
|
+
}))];
|
|
579
|
+
}
|
|
580
|
+
})]
|
|
581
|
+
}), r.value && createVNode(p, {
|
|
582
|
+
className: "field-action",
|
|
583
|
+
self: e.conf,
|
|
584
|
+
parent: l
|
|
585
|
+
}, null), r.value && createVNode("div", {
|
|
586
|
+
className: "drag-handler"
|
|
587
|
+
}, [createVNode("i", {
|
|
588
|
+
title: "拖拽手柄"
|
|
589
|
+
}, [createVNode("svg", {
|
|
590
|
+
class: "svg-icon",
|
|
591
|
+
"aria-hidden": "true"
|
|
592
|
+
}, [createVNode("use", {
|
|
593
|
+
"xlink:href": "#icon-el-drag-move"
|
|
594
|
+
}, null)])]), createVNode("i", null, [createTextVNode("单选项")])])]);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
m = (e) => createVNode(v, {
|
|
598
|
+
id: e.id,
|
|
599
|
+
conf: e,
|
|
600
|
+
onClick: (o) => C(o, e)
|
|
601
|
+
}, null);
|
|
602
|
+
} else if (t.type == "checkbox") {
|
|
603
|
+
const v = /* @__PURE__ */ defineComponent({
|
|
604
|
+
props: ["conf"],
|
|
605
|
+
mixins: [fieldOptionMixin],
|
|
606
|
+
setup(e) {
|
|
607
|
+
const o = getCurrentInstance().proxy, a = useFieldMixin(t, o);
|
|
608
|
+
return a.registerRef(), a.rebuildRules(), a.handleOnCreated(), onMounted(() => {
|
|
609
|
+
a.handleOnMounted();
|
|
610
|
+
}), () => createVNode("div", {
|
|
611
|
+
className: u
|
|
612
|
+
}, [createVNode(y, {
|
|
613
|
+
rules: a.rules.value,
|
|
614
|
+
conf: e.conf,
|
|
615
|
+
mode: s.value.mode
|
|
616
|
+
}, {
|
|
617
|
+
default: () => [s.value.mode == "edit" && createVNode(resolveComponent("el-checkbox-group"), {
|
|
618
|
+
style: {
|
|
619
|
+
lineHeight: "32px"
|
|
620
|
+
},
|
|
621
|
+
modelValue: e.conf.options.defaultValue,
|
|
622
|
+
"onUpdate:modelValue": (i) => e.conf.options.defaultValue = i,
|
|
623
|
+
onChange: a.handleOnChange
|
|
624
|
+
}, {
|
|
625
|
+
default: () => {
|
|
626
|
+
var i;
|
|
627
|
+
return [(i = e.conf.options.optionItems) == null ? void 0 : i.map((d, N) => createVNode(resolveComponent("el-checkbox"), {
|
|
628
|
+
key: N,
|
|
629
|
+
value: d.value,
|
|
630
|
+
disabled: d.disabled,
|
|
631
|
+
style: {
|
|
632
|
+
display: e.conf.options.displayStyle
|
|
633
|
+
}
|
|
634
|
+
}, {
|
|
635
|
+
default: () => [d.label]
|
|
636
|
+
}))];
|
|
637
|
+
}
|
|
638
|
+
}), s.value.mode == "view" && createVNode(resolveComponent("el-checkbox-group"), {
|
|
639
|
+
style: {
|
|
640
|
+
lineHeight: "32px"
|
|
641
|
+
},
|
|
642
|
+
modelValue: V.value[e.conf.options.name],
|
|
643
|
+
"onUpdate:modelValue": (i) => V.value[e.conf.options.name] = i,
|
|
644
|
+
onChange: a.handleOnChange
|
|
645
|
+
}, {
|
|
646
|
+
default: () => {
|
|
647
|
+
var i;
|
|
648
|
+
return [(i = e.conf.options.optionItems) == null ? void 0 : i.map((d, N) => createVNode(resolveComponent("el-checkbox"), {
|
|
649
|
+
key: N,
|
|
650
|
+
value: d.value,
|
|
651
|
+
disabled: d.disabled,
|
|
652
|
+
style: {
|
|
653
|
+
display: e.conf.options.displayStyle
|
|
654
|
+
}
|
|
655
|
+
}, {
|
|
656
|
+
default: () => [d.label]
|
|
657
|
+
}))];
|
|
658
|
+
}
|
|
659
|
+
})]
|
|
660
|
+
}), r.value && createVNode(p, {
|
|
661
|
+
className: "field-action",
|
|
662
|
+
self: e.conf,
|
|
663
|
+
parent: l
|
|
664
|
+
}, null), r.value && createVNode("div", {
|
|
665
|
+
className: "drag-handler"
|
|
666
|
+
}, [createVNode("i", {
|
|
667
|
+
title: "拖拽手柄"
|
|
668
|
+
}, [createVNode("svg", {
|
|
669
|
+
class: "svg-icon",
|
|
670
|
+
"aria-hidden": "true"
|
|
671
|
+
}, [createVNode("use", {
|
|
672
|
+
"xlink:href": "#icon-el-drag-move"
|
|
673
|
+
}, null)])]), createVNode("i", null, [createTextVNode("单选项")])])]);
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
m = (e) => createVNode(v, {
|
|
677
|
+
id: e.id,
|
|
678
|
+
conf: e,
|
|
679
|
+
onClick: (o) => C(o, e)
|
|
680
|
+
}, null);
|
|
681
|
+
} else if (t.type == "select") {
|
|
682
|
+
const v = /* @__PURE__ */ defineComponent({
|
|
683
|
+
props: ["conf"],
|
|
684
|
+
mixins: [fieldOptionMixin],
|
|
685
|
+
setup(e) {
|
|
686
|
+
const o = getCurrentInstance().proxy, a = useFieldMixin(t, o);
|
|
687
|
+
return a.registerRef(), a.rebuildRules(), a.handleOnCreated(), onMounted(() => {
|
|
688
|
+
a.handleOnMounted();
|
|
689
|
+
}), () => createVNode("div", {
|
|
690
|
+
className: u
|
|
691
|
+
}, [createVNode(y, {
|
|
692
|
+
rules: a.rules.value,
|
|
693
|
+
conf: e.conf,
|
|
694
|
+
mode: s.value.mode
|
|
695
|
+
}, {
|
|
696
|
+
default: () => [s.value.mode == "edit" && createVNode(resolveComponent("el-select"), {
|
|
697
|
+
style: {
|
|
698
|
+
lineHeight: "32px"
|
|
699
|
+
},
|
|
700
|
+
clearable: e.conf.options.clearable,
|
|
701
|
+
modelValue: e.conf.options.defaultValue,
|
|
702
|
+
"onUpdate:modelValue": (i) => e.conf.options.defaultValue = i,
|
|
703
|
+
onChange: a.handleOnChange
|
|
704
|
+
}, {
|
|
705
|
+
default: () => {
|
|
706
|
+
var i;
|
|
707
|
+
return [(i = e.conf.options.optionItems) == null ? void 0 : i.map((d, N) => createVNode(resolveComponent("el-option"), {
|
|
708
|
+
key: N,
|
|
709
|
+
value: d.value,
|
|
710
|
+
label: d.label,
|
|
711
|
+
disabled: d.disabled,
|
|
712
|
+
style: {
|
|
713
|
+
display: e.conf.options.displayStyle
|
|
714
|
+
}
|
|
715
|
+
}, null))];
|
|
716
|
+
}
|
|
717
|
+
}), s.value.mode == "view" && createVNode(resolveComponent("el-select"), {
|
|
718
|
+
style: {
|
|
719
|
+
lineHeight: "32px"
|
|
720
|
+
},
|
|
721
|
+
clearable: e.conf.options.clearable,
|
|
722
|
+
modelValue: V.value[e.conf.options.name],
|
|
723
|
+
"onUpdate:modelValue": (i) => V.value[e.conf.options.name] = i,
|
|
724
|
+
onChange: a.handleOnChange
|
|
725
|
+
}, {
|
|
726
|
+
default: () => {
|
|
727
|
+
var i;
|
|
728
|
+
return [(i = e.conf.options.optionItems) == null ? void 0 : i.map((d, N) => createVNode(resolveComponent("el-option"), {
|
|
729
|
+
key: N,
|
|
730
|
+
value: d.value,
|
|
731
|
+
label: d.label,
|
|
732
|
+
disabled: d.disabled,
|
|
733
|
+
style: {
|
|
734
|
+
display: e.conf.options.displayStyle
|
|
735
|
+
}
|
|
736
|
+
}, null))];
|
|
737
|
+
}
|
|
738
|
+
})]
|
|
739
|
+
}), r.value && createVNode(p, {
|
|
740
|
+
className: "field-action",
|
|
741
|
+
self: e.conf,
|
|
742
|
+
parent: l
|
|
743
|
+
}, null), r.value && createVNode("div", {
|
|
744
|
+
className: "drag-handler"
|
|
745
|
+
}, [createVNode("i", {
|
|
746
|
+
title: "拖拽手柄"
|
|
747
|
+
}, [createVNode("svg", {
|
|
748
|
+
class: "svg-icon",
|
|
749
|
+
"aria-hidden": "true"
|
|
750
|
+
}, [createVNode("use", {
|
|
751
|
+
"xlink:href": "#icon-el-drag-move"
|
|
752
|
+
}, null)])]), createVNode("i", null, [createTextVNode("下拉选项")])])]);
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
m = (e) => createVNode(v, {
|
|
756
|
+
id: e.id,
|
|
757
|
+
conf: e,
|
|
758
|
+
onClick: (o) => C(o, e)
|
|
759
|
+
}, null);
|
|
760
|
+
} else if (t.type == "picture-upload") {
|
|
761
|
+
const v = /* @__PURE__ */ defineComponent({
|
|
762
|
+
props: ["conf"],
|
|
763
|
+
mixins: [fieldOptionMixin],
|
|
764
|
+
setup(e) {
|
|
765
|
+
const o = getCurrentInstance().proxy, a = useFieldMixin(t, o);
|
|
766
|
+
return a.registerRef(), a.rebuildRules(), a.handleOnCreated(), onMounted(() => {
|
|
767
|
+
a.handleOnMounted();
|
|
768
|
+
}), () => createVNode("div", {
|
|
769
|
+
className: u
|
|
770
|
+
}, [createVNode(y, {
|
|
771
|
+
rules: a.rules.value,
|
|
772
|
+
conf: e.conf,
|
|
773
|
+
mode: s.value.mode
|
|
774
|
+
}, {
|
|
775
|
+
default: () => [s.value.mode == "edit" && createVNode(resolveComponent("sy-picture-upload"), {
|
|
776
|
+
fileType: e.conf.options.fileTypes,
|
|
777
|
+
fileMaxSize: e.conf.options.fileMaxSize,
|
|
778
|
+
isShowTip: e.conf.options.isShowTip,
|
|
779
|
+
multipleSelect: e.conf.options.multipleSelect,
|
|
780
|
+
defaultBg: e.conf.options.defaultBg
|
|
781
|
+
}, null), s.value.mode == "view" && createVNode(resolveComponent("sy-picture-upload"), {
|
|
782
|
+
fileType: e.conf.options.fileTypes,
|
|
783
|
+
fileMaxSize: e.conf.options.fileMaxSize,
|
|
784
|
+
isShowTip: e.conf.options.isShowTip,
|
|
785
|
+
multipleSelect: e.conf.options.multipleSelect,
|
|
786
|
+
defaultBg: e.conf.options.defaultBg,
|
|
787
|
+
oss: {
|
|
788
|
+
signatureUrl: e.conf.options.signatureUrl
|
|
789
|
+
},
|
|
790
|
+
md5: {
|
|
791
|
+
requireMd5: e.conf.options.requireMd5,
|
|
792
|
+
addFileMd5Url: e.conf.options.addFileMd5Url,
|
|
793
|
+
queryFileMd5Url: e.conf.options.queryFileMd5Url
|
|
794
|
+
},
|
|
795
|
+
modelValue: V.value[e.conf.options.name],
|
|
796
|
+
"onUpdate:modelValue": (i) => V.value[e.conf.options.name] = i
|
|
797
|
+
}, null)]
|
|
798
|
+
}), r.value && createVNode(p, {
|
|
799
|
+
className: "field-action",
|
|
800
|
+
self: e.conf,
|
|
801
|
+
parent: l
|
|
802
|
+
}, null), r.value && createVNode("div", {
|
|
803
|
+
className: "drag-handler"
|
|
804
|
+
}, [createVNode("i", {
|
|
805
|
+
title: "拖拽手柄"
|
|
806
|
+
}, [createVNode("svg", {
|
|
807
|
+
class: "svg-icon",
|
|
808
|
+
"aria-hidden": "true"
|
|
809
|
+
}, [createVNode("use", {
|
|
810
|
+
"xlink:href": "#icon-el-drag-move"
|
|
811
|
+
}, null)])]), createVNode("i", null, [createTextVNode("下拉选项")])])]);
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
m = (e) => createVNode(v, {
|
|
815
|
+
id: e.id,
|
|
816
|
+
conf: e,
|
|
817
|
+
onClick: (o) => C(o, e)
|
|
818
|
+
}, null);
|
|
819
|
+
} else if (t.type == "static-title") {
|
|
820
|
+
const v = /* @__PURE__ */ defineComponent({
|
|
821
|
+
props: ["conf"],
|
|
822
|
+
setup(e) {
|
|
823
|
+
return () => createVNode("div", {
|
|
824
|
+
className: `${u}`
|
|
825
|
+
}, [e.conf.options.titleLevel === 1 && createVNode("h1", {
|
|
826
|
+
style: `text-align: ${e.conf.options.textAlign};`
|
|
827
|
+
}, [e.conf.options.textContent]), e.conf.options.titleLevel === 2 && createVNode("h2", {
|
|
828
|
+
style: `text-align: ${e.conf.options.textAlign};`
|
|
829
|
+
}, [e.conf.options.textContent]), e.conf.options.titleLevel === 3 && createVNode("h3", {
|
|
830
|
+
style: `text-align: ${e.conf.options.textAlign};`
|
|
831
|
+
}, [e.conf.options.textContent]), r.value && createVNode(p, {
|
|
832
|
+
className: "field-action",
|
|
833
|
+
self: e.conf,
|
|
834
|
+
parent: l
|
|
835
|
+
}, null), r.value && createVNode("div", {
|
|
836
|
+
className: "drag-handler"
|
|
837
|
+
}, [createVNode("i", {
|
|
838
|
+
title: "拖拽手柄"
|
|
839
|
+
}, [createVNode("svg", {
|
|
840
|
+
class: "svg-icon",
|
|
841
|
+
"aria-hidden": "true"
|
|
842
|
+
}, [createVNode("use", {
|
|
843
|
+
"xlink:href": "#icon-el-drag-move"
|
|
844
|
+
}, null)])]), createVNode("i", null, [createTextVNode("静态标题")])])]);
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
m = (e) => createVNode("div", {
|
|
848
|
+
class: `static-content-item ${r.value && "selected" || ""}`,
|
|
849
|
+
onClick: (o) => C(o, e)
|
|
850
|
+
}, [createVNode(v, {
|
|
851
|
+
id: e.id,
|
|
852
|
+
conf: e
|
|
853
|
+
}, null)]);
|
|
854
|
+
}
|
|
855
|
+
if (m == null)
|
|
856
|
+
throw new Error("Component " + t.type + " is not exists.");
|
|
857
|
+
return m(t);
|
|
858
|
+
}, S = () => {
|
|
859
|
+
}, $ = (t) => {
|
|
860
|
+
b.value = n.conf.widgetList[t.newIndex];
|
|
861
|
+
}, V = ref({}), k = ref({}), j = (t) => {
|
|
862
|
+
let l = typeof t;
|
|
863
|
+
return l == "object" && t instanceof Array && (l = "array"), l;
|
|
864
|
+
}, D = (t, l) => {
|
|
865
|
+
let u = typeof t;
|
|
866
|
+
if (u == "object" && t instanceof Array && (u = "array"), t == null || t === "") {
|
|
867
|
+
if (l == "array")
|
|
868
|
+
return [];
|
|
869
|
+
if (l == "object")
|
|
870
|
+
return {};
|
|
871
|
+
if (l == "string" || l == "number" || l == "boolean")
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
return u == l ? t : u == "string" && l == "array" ? t.split(",") : u == "string" && l == "object" ? JSON.parse(t) : u == "string" && l == "number" ? t * 1 : u == "array" && l == "string" ? t.join(",") : t;
|
|
875
|
+
}, A = (t) => {
|
|
876
|
+
t.forEach((l, u) => {
|
|
877
|
+
l.type === "grid" ? l.cols.forEach((m, r) => {
|
|
878
|
+
A(m.widgetList);
|
|
879
|
+
}) : Object.keys(l.options).indexOf("defaultValue") != -1 && Object.assign(V.value, {
|
|
880
|
+
[l.options.name]: s.value.formData.hasOwnProperty(l.options.name) ? D(s.value.formData[l.options.name], j(l.options.defaultValue)) : l.options.defaultValue
|
|
881
|
+
});
|
|
882
|
+
});
|
|
883
|
+
}, R = (t) => {
|
|
884
|
+
t.forEach((l, u) => {
|
|
885
|
+
if (l.type === "grid")
|
|
886
|
+
l.cols.forEach((m, r) => {
|
|
887
|
+
R(m.widgetList);
|
|
888
|
+
});
|
|
889
|
+
else if (Object.keys(l.options).indexOf("defaultValue") != -1) {
|
|
890
|
+
if (l.options.hidden)
|
|
891
|
+
return;
|
|
892
|
+
Object.assign(k.value, {
|
|
893
|
+
[l.options.name]: D(s.value.formData[l.options.name], l.options.submitType)
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
}, T = () => (k.value = {}, R(n.conf.widgetList), k.value);
|
|
898
|
+
n.mode == "view" && (A(n.conf.widgetList), M.value = E(n.conf));
|
|
899
|
+
const B = {
|
|
900
|
+
item: ({
|
|
901
|
+
element: t,
|
|
902
|
+
index: l
|
|
903
|
+
}) => createVNode("div", {
|
|
904
|
+
tag: "div",
|
|
905
|
+
className: "transition-group-el"
|
|
906
|
+
}, [createTextVNode(" "), h(g, {
|
|
907
|
+
conf: t,
|
|
908
|
+
parent: n.conf
|
|
909
|
+
})])
|
|
910
|
+
}, I = (t) => x.value[t], U = (t = [], l) => {
|
|
911
|
+
const u = {
|
|
912
|
+
eq: "==",
|
|
913
|
+
lt: "<",
|
|
914
|
+
gt: ">",
|
|
915
|
+
elt: "<=",
|
|
916
|
+
egt: ">="
|
|
917
|
+
};
|
|
918
|
+
return t.reduce((m, r, v) => (r.operator in u && (m += [l[r.left] ? l[r.left] : "null", u[r.operator], r.right].join(" ")), v < t.length - 1 && (m += " " + (r.relation == "and" ? "&&" : "||") + " "), m), "");
|
|
919
|
+
}, L = (t, l = {}) => new Function("return " + t).call(l), O = (t) => t.options.hidden ? t.options.showCondition && !t.options.showCondition.length ? !1 : L(U(t.options.showCondition, V.value), {}) : !0;
|
|
920
|
+
return provide("refDict", x), provide("render", f), f.$getWidgetRef = I, c.expose({
|
|
921
|
+
getWidgetRef: I,
|
|
922
|
+
getFormData: T
|
|
923
|
+
// in view mode
|
|
924
|
+
}), () => createVNode(Fragment, null, [n.mode === "edit" && createVNode("div", {
|
|
925
|
+
class: "form-widget-container"
|
|
926
|
+
}, [createVNode(resolveComponent("el-form"), {
|
|
927
|
+
class: `full-height-width widget-form ${n.conf.formConfig.labelAlign}`,
|
|
928
|
+
"label-position": n.conf.formConfig.labelPosition,
|
|
929
|
+
"label-width": n.conf.formConfig.labelWidth
|
|
930
|
+
}, {
|
|
931
|
+
default: () => [createVNode(draggable, {
|
|
932
|
+
tag: "div",
|
|
933
|
+
class: "form-widget-list",
|
|
934
|
+
"item-key": "id",
|
|
935
|
+
modelValue: n.conf.widgetList,
|
|
936
|
+
"onUpdate:modelValue": (t) => n.conf.widgetList = t,
|
|
937
|
+
group: "people",
|
|
938
|
+
ghostClass: "ghost",
|
|
939
|
+
animation: 200,
|
|
940
|
+
handle: ".drag-handler",
|
|
941
|
+
onEnd: S,
|
|
942
|
+
onAdd: $
|
|
943
|
+
}, B)]
|
|
944
|
+
})]), n.mode === "view" && createVNode("div", {
|
|
945
|
+
class: "form-render-wrapper"
|
|
946
|
+
}, [createVNode(resolveComponent("el-form"), {
|
|
947
|
+
class: `full-height-width render-form ${n.conf.formConfig.labelAlign}`,
|
|
948
|
+
"label-position": n.conf.formConfig.labelPosition,
|
|
949
|
+
"label-width": n.conf.formConfig.labelWidth,
|
|
950
|
+
model: V
|
|
951
|
+
}, {
|
|
952
|
+
default: () => [M.value]
|
|
953
|
+
})])]);
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
export {
|
|
957
|
+
render as default
|
|
958
|
+
};
|