@jxyszb/jxy-form-designer 0.1.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/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/chunks/RuntimePreviewPanel-3704c8f8.js +1991 -0
- package/dist/chunks/compositeField-98c1b192.js +588 -0
- package/dist/chunks/dataSourceUrl-4b17feb8.js +55 -0
- package/dist/designer.js +3023 -0
- package/dist/index.js +45 -0
- package/dist/runtime.js +67 -0
- package/dist/schema.js +266 -0
- package/dist/style.css +1 -0
- package/dist/testing.js +1026 -0
- package/docs/field-suffix-extension.md +289 -0
- package/package.json +100 -0
- package/types/designer.d.ts +12 -0
- package/types/index.d.ts +345 -0
- package/types/runtime.d.ts +22 -0
- package/types/schema.d.ts +31 -0
- package/types/testing.d.ts +3 -0
|
@@ -0,0 +1,1991 @@
|
|
|
1
|
+
import { computed as F, resolveComponent as I, openBlock as V, createBlock as $, unref as y, isRef as J, withCtx as C, createElementBlock as R, Fragment as Y, renderList as H, createTextVNode as X, toDisplayString as W, createCommentVNode as L, onMounted as ge, resolveDynamicComponent as se, normalizeClass as N, normalizeStyle as Re, mergeProps as je, createVNode as U, createElementVNode as Z, ref as de, watch as fe, provide as $e, renderSlot as Q, inject as Oe, normalizeProps as oe, guardReactiveProps as ie, useSlots as Te, reactive as Se, nextTick as ne, toRef as we, createSlots as Ne } from "vue";
|
|
2
|
+
import { formItemContextKey as De, ElMessage as Fe } from "element-plus";
|
|
3
|
+
import { WarningFilled as Le } from "@element-plus/icons-vue";
|
|
4
|
+
import { g as Ce, f as Ie, h as ee, i as he, j as Ee, m as Ye } from "./compositeField-98c1b192.js";
|
|
5
|
+
const D = (e, a) => {
|
|
6
|
+
const t = e.__vccOpts || e;
|
|
7
|
+
for (const [l, n] of a)
|
|
8
|
+
t[l] = n;
|
|
9
|
+
return t;
|
|
10
|
+
}, ze = 60;
|
|
11
|
+
function Ae(e) {
|
|
12
|
+
if (e == null || e === "")
|
|
13
|
+
return null;
|
|
14
|
+
const a = Number(e);
|
|
15
|
+
return Number.isFinite(a) && a >= 0 ? a : null;
|
|
16
|
+
}
|
|
17
|
+
function He(e, a) {
|
|
18
|
+
var n, d;
|
|
19
|
+
const t = Ae((d = (n = e == null ? void 0 : e.extensions) == null ? void 0 : n.suffix) == null ? void 0 : d.width);
|
|
20
|
+
if (t !== null)
|
|
21
|
+
return t;
|
|
22
|
+
const l = Ae(a == null ? void 0 : a.suffixWidth);
|
|
23
|
+
return l !== null ? l : ze;
|
|
24
|
+
}
|
|
25
|
+
const Xe = {
|
|
26
|
+
__name: "InputField",
|
|
27
|
+
props: {
|
|
28
|
+
modelValue: { default: "" },
|
|
29
|
+
field: { type: Object, required: !0 },
|
|
30
|
+
disabled: { type: Boolean, default: !1 }
|
|
31
|
+
},
|
|
32
|
+
emits: ["update:modelValue"],
|
|
33
|
+
setup(e, { emit: a }) {
|
|
34
|
+
const t = e, l = F({
|
|
35
|
+
get: () => t.modelValue ?? "",
|
|
36
|
+
set: (d) => a("update:modelValue", d)
|
|
37
|
+
}), n = F(() => t.field.type === "textarea" ? "textarea" : t.field.type === "password" ? "password" : "text");
|
|
38
|
+
return (d, c) => {
|
|
39
|
+
var o, x, A;
|
|
40
|
+
const r = I("el-input");
|
|
41
|
+
return V(), $(r, {
|
|
42
|
+
modelValue: y(l),
|
|
43
|
+
"onUpdate:modelValue": c[0] || (c[0] = (h) => J(l) ? l.value = h : null),
|
|
44
|
+
type: y(n),
|
|
45
|
+
placeholder: e.field.placeholder || (e.disabled ? "" : "请输入"),
|
|
46
|
+
disabled: e.disabled,
|
|
47
|
+
maxlength: ((o = e.field.props) == null ? void 0 : o.max) || void 0,
|
|
48
|
+
"show-word-limit": !!((x = e.field.props) != null && x.max),
|
|
49
|
+
rows: e.field.type === "textarea" ? ((A = e.field.props) == null ? void 0 : A.rows) || 3 : void 0,
|
|
50
|
+
autocomplete: e.field.type === "password" ? "new-password" : "off",
|
|
51
|
+
resize: "none",
|
|
52
|
+
style: { width: "100%" }
|
|
53
|
+
}, null, 8, ["modelValue", "type", "placeholder", "disabled", "maxlength", "show-word-limit", "rows", "autocomplete"]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}, me = Xe, Je = {
|
|
57
|
+
__name: "NumberField",
|
|
58
|
+
props: {
|
|
59
|
+
modelValue: { default: void 0 },
|
|
60
|
+
field: { type: Object, required: !0 },
|
|
61
|
+
disabled: { type: Boolean, default: !1 }
|
|
62
|
+
},
|
|
63
|
+
emits: ["update:modelValue"],
|
|
64
|
+
setup(e, { emit: a }) {
|
|
65
|
+
const t = e, l = F({
|
|
66
|
+
get: () => t.modelValue,
|
|
67
|
+
set: (d) => a("update:modelValue", d)
|
|
68
|
+
}), n = F(() => {
|
|
69
|
+
var d;
|
|
70
|
+
return t.field.type === "floatNum" ? ((d = t.field.props) == null ? void 0 : d.decimal) ?? 2 : 0;
|
|
71
|
+
});
|
|
72
|
+
return (d, c) => {
|
|
73
|
+
var o;
|
|
74
|
+
const r = I("el-input-number");
|
|
75
|
+
return V(), $(r, {
|
|
76
|
+
modelValue: y(l),
|
|
77
|
+
"onUpdate:modelValue": c[0] || (c[0] = (x) => J(l) ? l.value = x : null),
|
|
78
|
+
precision: y(n),
|
|
79
|
+
max: ((o = e.field.props) == null ? void 0 : o.max) ?? 1 / 0,
|
|
80
|
+
placeholder: e.field.placeholder || (e.disabled ? "" : "请输入"),
|
|
81
|
+
disabled: e.disabled,
|
|
82
|
+
"controls-position": "right",
|
|
83
|
+
style: { width: "100%" }
|
|
84
|
+
}, null, 8, ["modelValue", "precision", "max", "placeholder", "disabled"]);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}, Pe = Je, We = {
|
|
88
|
+
__name: "DateField",
|
|
89
|
+
props: {
|
|
90
|
+
modelValue: { default: "" },
|
|
91
|
+
field: { type: Object, required: !0 },
|
|
92
|
+
disabled: { type: Boolean, default: !1 }
|
|
93
|
+
},
|
|
94
|
+
emits: ["update:modelValue"],
|
|
95
|
+
setup(e, { emit: a }) {
|
|
96
|
+
const t = e, l = F({
|
|
97
|
+
get: () => t.modelValue,
|
|
98
|
+
set: (c) => a("update:modelValue", c)
|
|
99
|
+
}), n = F(() => ({
|
|
100
|
+
date: "date",
|
|
101
|
+
month: "month",
|
|
102
|
+
year: "year",
|
|
103
|
+
daterange: "daterange",
|
|
104
|
+
datetimerange: "datetimerange"
|
|
105
|
+
})[t.field.type] || "date"), d = F(() => ({
|
|
106
|
+
date: "YYYY-MM-DD",
|
|
107
|
+
month: "YYYY-MM",
|
|
108
|
+
year: "YYYY",
|
|
109
|
+
daterange: "YYYY-MM-DD",
|
|
110
|
+
datetimerange: "YYYY-MM-DD HH:mm:ss"
|
|
111
|
+
})[t.field.type] || "YYYY-MM-DD");
|
|
112
|
+
return (c, r) => {
|
|
113
|
+
var x, A, h, S;
|
|
114
|
+
const o = I("el-date-picker");
|
|
115
|
+
return V(), $(o, {
|
|
116
|
+
modelValue: y(l),
|
|
117
|
+
"onUpdate:modelValue": r[0] || (r[0] = (s) => J(l) ? l.value = s : null),
|
|
118
|
+
type: y(n),
|
|
119
|
+
format: ((x = e.field.props) == null ? void 0 : x.format) || y(d),
|
|
120
|
+
"value-format": ((A = e.field.props) == null ? void 0 : A.valueFormat) || y(d),
|
|
121
|
+
placeholder: e.field.placeholder || (e.disabled ? "" : "请选择"),
|
|
122
|
+
"start-placeholder": ((h = e.field.props) == null ? void 0 : h.startPlaceholder) || "开始日期",
|
|
123
|
+
"end-placeholder": ((S = e.field.props) == null ? void 0 : S.endPlaceholder) || "结束日期",
|
|
124
|
+
disabled: e.disabled,
|
|
125
|
+
editable: !1,
|
|
126
|
+
style: { width: "100%" }
|
|
127
|
+
}, null, 8, ["modelValue", "type", "format", "value-format", "placeholder", "start-placeholder", "end-placeholder", "disabled"]);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}, ae = We, Ke = {
|
|
131
|
+
__name: "SelectField",
|
|
132
|
+
props: {
|
|
133
|
+
modelValue: { default: "" },
|
|
134
|
+
field: { type: Object, required: !0 },
|
|
135
|
+
disabled: { type: Boolean, default: !1 },
|
|
136
|
+
options: { type: Array, default: () => [] },
|
|
137
|
+
loading: { type: Boolean, default: !1 }
|
|
138
|
+
},
|
|
139
|
+
emits: ["update:modelValue"],
|
|
140
|
+
setup(e, { emit: a }) {
|
|
141
|
+
const t = e, l = F({
|
|
142
|
+
get: () => c(t.modelValue),
|
|
143
|
+
set: (r) => a("update:modelValue", c(r))
|
|
144
|
+
}), n = F(() => {
|
|
145
|
+
var r;
|
|
146
|
+
return ((r = t.field.props) == null ? void 0 : r.multiple) === !0;
|
|
147
|
+
}), d = F(() => {
|
|
148
|
+
const r = /* @__PURE__ */ new Set();
|
|
149
|
+
return t.options.filter((o) => {
|
|
150
|
+
if (!o || o.value === void 0 || o.value === null)
|
|
151
|
+
return !1;
|
|
152
|
+
const x = String(o.value);
|
|
153
|
+
return r.has(x) ? !1 : (r.add(x), !0);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
function c(r) {
|
|
157
|
+
return n.value ? Array.isArray(r) ? r : r === "" || r === void 0 || r === null ? [] : [r] : Array.isArray(r) ? "" : r ?? "";
|
|
158
|
+
}
|
|
159
|
+
return (r, o) => {
|
|
160
|
+
var h, S;
|
|
161
|
+
const x = I("el-option"), A = I("el-select");
|
|
162
|
+
return V(), $(A, {
|
|
163
|
+
modelValue: y(l),
|
|
164
|
+
"onUpdate:modelValue": o[0] || (o[0] = (s) => J(l) ? l.value = s : null),
|
|
165
|
+
multiple: (h = e.field.props) == null ? void 0 : h.multiple,
|
|
166
|
+
clearable: ((S = e.field.props) == null ? void 0 : S.clearable) ?? !0,
|
|
167
|
+
placeholder: e.field.placeholder || (e.disabled ? "" : "请选择"),
|
|
168
|
+
disabled: e.disabled,
|
|
169
|
+
loading: e.loading,
|
|
170
|
+
style: { width: "100%" }
|
|
171
|
+
}, {
|
|
172
|
+
default: C(() => [
|
|
173
|
+
(V(!0), R(Y, null, H(y(d), (s) => (V(), $(x, {
|
|
174
|
+
key: s.value,
|
|
175
|
+
label: s.label,
|
|
176
|
+
value: s.value,
|
|
177
|
+
disabled: s.disabled
|
|
178
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
179
|
+
]),
|
|
180
|
+
_: 1
|
|
181
|
+
}, 8, ["modelValue", "multiple", "clearable", "placeholder", "disabled", "loading"]);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}, Ge = Ke, Ze = {
|
|
185
|
+
__name: "CascaderField",
|
|
186
|
+
props: {
|
|
187
|
+
modelValue: { default: () => [] },
|
|
188
|
+
field: { type: Object, required: !0 },
|
|
189
|
+
disabled: { type: Boolean, default: !1 },
|
|
190
|
+
options: { type: Array, default: () => [] }
|
|
191
|
+
},
|
|
192
|
+
emits: ["update:modelValue"],
|
|
193
|
+
setup(e, { emit: a }) {
|
|
194
|
+
const t = e, l = F({
|
|
195
|
+
get: () => t.modelValue,
|
|
196
|
+
set: (d) => a("update:modelValue", d)
|
|
197
|
+
}), n = F(() => {
|
|
198
|
+
var d, c;
|
|
199
|
+
return {
|
|
200
|
+
multiple: ((d = t.field.props) == null ? void 0 : d.multiple) ?? !1,
|
|
201
|
+
checkStrictly: ((c = t.field.props) == null ? void 0 : c.checkStrictly) ?? !1,
|
|
202
|
+
label: "label",
|
|
203
|
+
value: "value",
|
|
204
|
+
children: "children"
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
return (d, c) => {
|
|
208
|
+
const r = I("el-cascader");
|
|
209
|
+
return V(), $(r, {
|
|
210
|
+
modelValue: y(l),
|
|
211
|
+
"onUpdate:modelValue": c[0] || (c[0] = (o) => J(l) ? l.value = o : null),
|
|
212
|
+
options: e.options,
|
|
213
|
+
props: y(n),
|
|
214
|
+
placeholder: e.field.placeholder || (e.disabled ? "" : "请选择"),
|
|
215
|
+
disabled: e.disabled,
|
|
216
|
+
clearable: "",
|
|
217
|
+
style: { width: "100%" }
|
|
218
|
+
}, null, 8, ["modelValue", "options", "props", "placeholder", "disabled"]);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}, Qe = Ze;
|
|
222
|
+
const et = {
|
|
223
|
+
key: 0,
|
|
224
|
+
class: "no-options"
|
|
225
|
+
}, tt = {
|
|
226
|
+
__name: "RadioField",
|
|
227
|
+
props: {
|
|
228
|
+
modelValue: { default: "" },
|
|
229
|
+
field: { type: Object, required: !0 },
|
|
230
|
+
disabled: { type: Boolean, default: !1 },
|
|
231
|
+
options: { type: Array, default: () => [] }
|
|
232
|
+
},
|
|
233
|
+
emits: ["update:modelValue"],
|
|
234
|
+
setup(e, { emit: a }) {
|
|
235
|
+
const t = e, l = F({
|
|
236
|
+
get: () => t.modelValue,
|
|
237
|
+
set: (n) => a("update:modelValue", n)
|
|
238
|
+
});
|
|
239
|
+
return (n, d) => {
|
|
240
|
+
const c = I("el-radio"), r = I("el-radio-group");
|
|
241
|
+
return V(), $(r, {
|
|
242
|
+
modelValue: y(l),
|
|
243
|
+
"onUpdate:modelValue": d[0] || (d[0] = (o) => J(l) ? l.value = o : null),
|
|
244
|
+
disabled: e.disabled
|
|
245
|
+
}, {
|
|
246
|
+
default: C(() => [
|
|
247
|
+
(V(!0), R(Y, null, H(e.options, (o) => (V(), $(c, {
|
|
248
|
+
key: o.value,
|
|
249
|
+
label: o.value,
|
|
250
|
+
disabled: o.disabled
|
|
251
|
+
}, {
|
|
252
|
+
default: C(() => [
|
|
253
|
+
X(W(o.label), 1)
|
|
254
|
+
]),
|
|
255
|
+
_: 2
|
|
256
|
+
}, 1032, ["label", "disabled"]))), 128)),
|
|
257
|
+
e.options.length === 0 ? (V(), R("span", et, "暂无选项")) : L("", !0)
|
|
258
|
+
]),
|
|
259
|
+
_: 1
|
|
260
|
+
}, 8, ["modelValue", "disabled"]);
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}, lt = /* @__PURE__ */ D(tt, [["__scopeId", "data-v-dcf61f35"]]);
|
|
264
|
+
const nt = {
|
|
265
|
+
key: 0,
|
|
266
|
+
class: "no-options"
|
|
267
|
+
}, at = {
|
|
268
|
+
__name: "CheckboxField",
|
|
269
|
+
props: {
|
|
270
|
+
modelValue: { default: () => [] },
|
|
271
|
+
field: { type: Object, required: !0 },
|
|
272
|
+
disabled: { type: Boolean, default: !1 },
|
|
273
|
+
options: { type: Array, default: () => [] }
|
|
274
|
+
},
|
|
275
|
+
emits: ["update:modelValue"],
|
|
276
|
+
setup(e, { emit: a }) {
|
|
277
|
+
const t = e, l = F({
|
|
278
|
+
get: () => Array.isArray(t.modelValue) ? t.modelValue : [],
|
|
279
|
+
set: (n) => a("update:modelValue", n)
|
|
280
|
+
});
|
|
281
|
+
return (n, d) => {
|
|
282
|
+
const c = I("el-checkbox"), r = I("el-checkbox-group");
|
|
283
|
+
return V(), $(r, {
|
|
284
|
+
modelValue: y(l),
|
|
285
|
+
"onUpdate:modelValue": d[0] || (d[0] = (o) => J(l) ? l.value = o : null),
|
|
286
|
+
disabled: e.disabled
|
|
287
|
+
}, {
|
|
288
|
+
default: C(() => [
|
|
289
|
+
(V(!0), R(Y, null, H(e.options, (o) => (V(), $(c, {
|
|
290
|
+
key: o.value,
|
|
291
|
+
label: o.value,
|
|
292
|
+
disabled: o.disabled
|
|
293
|
+
}, {
|
|
294
|
+
default: C(() => [
|
|
295
|
+
X(W(o.label), 1)
|
|
296
|
+
]),
|
|
297
|
+
_: 2
|
|
298
|
+
}, 1032, ["label", "disabled"]))), 128)),
|
|
299
|
+
e.options.length === 0 ? (V(), R("span", nt, "暂无选项")) : L("", !0)
|
|
300
|
+
]),
|
|
301
|
+
_: 1
|
|
302
|
+
}, 8, ["modelValue", "disabled"]);
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
}, dt = /* @__PURE__ */ D(at, [["__scopeId", "data-v-2545dad2"]]);
|
|
306
|
+
const ot = {
|
|
307
|
+
key: 1,
|
|
308
|
+
class: "jxy-host-component-missing"
|
|
309
|
+
}, it = {
|
|
310
|
+
__name: "FileUploadField",
|
|
311
|
+
props: {
|
|
312
|
+
modelValue: { default: () => [] },
|
|
313
|
+
field: { type: Object, required: !0 },
|
|
314
|
+
disabled: { type: Boolean, default: !1 },
|
|
315
|
+
hostComponent: { type: [Object, Function], default: null }
|
|
316
|
+
},
|
|
317
|
+
emits: ["update:modelValue", "schema-error"],
|
|
318
|
+
setup(e, { emit: a }) {
|
|
319
|
+
const t = e, l = F({
|
|
320
|
+
get: () => Array.isArray(t.modelValue) ? t.modelValue : [],
|
|
321
|
+
set: (n) => a("update:modelValue", n)
|
|
322
|
+
});
|
|
323
|
+
return ge(() => {
|
|
324
|
+
var n;
|
|
325
|
+
t.hostComponent || a("schema-error", {
|
|
326
|
+
type: "missingHostComponent",
|
|
327
|
+
component: "fileUpload",
|
|
328
|
+
field: ((n = t.field) == null ? void 0 : n.prop) || "",
|
|
329
|
+
message: "JXYFormRuntime 未配置宿主上传组件 fileUpload"
|
|
330
|
+
});
|
|
331
|
+
}), (n, d) => {
|
|
332
|
+
var c, r, o;
|
|
333
|
+
return e.hostComponent ? (V(), $(se(e.hostComponent), {
|
|
334
|
+
key: 0,
|
|
335
|
+
modelValue: y(l),
|
|
336
|
+
"onUpdate:modelValue": d[0] || (d[0] = (x) => J(l) ? l.value = x : null),
|
|
337
|
+
drag: e.field.type === "dragFile",
|
|
338
|
+
disabled: e.disabled,
|
|
339
|
+
"file-type": (c = e.field.props) == null ? void 0 : c.fileType,
|
|
340
|
+
"file-size": (r = e.field.props) == null ? void 0 : r.fileSize,
|
|
341
|
+
limit: (o = e.field.props) == null ? void 0 : o.limit,
|
|
342
|
+
"list-type": e.field.type === "imgFile" ? "picture-card" : "text",
|
|
343
|
+
"btn-name": e.field.type === "imgFile" ? "选取图片" : "点击上传",
|
|
344
|
+
"is-show-tip": !0
|
|
345
|
+
}, null, 8, ["modelValue", "drag", "disabled", "file-type", "file-size", "limit", "list-type", "btn-name"])) : (V(), R("div", ot, " 未配置宿主上传组件 fileUpload "));
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
}, ye = /* @__PURE__ */ D(it, [["__scopeId", "data-v-1e52dc63"]]);
|
|
349
|
+
const rt = ["innerHTML"], st = {
|
|
350
|
+
key: 2,
|
|
351
|
+
class: "jxy-editor-missing"
|
|
352
|
+
}, ut = {
|
|
353
|
+
__name: "EditorField",
|
|
354
|
+
props: {
|
|
355
|
+
modelValue: { default: "" },
|
|
356
|
+
field: { type: Object, required: !0 },
|
|
357
|
+
disabled: { type: Boolean, default: !1 },
|
|
358
|
+
hostComponent: { type: [Object, Function], default: null }
|
|
359
|
+
},
|
|
360
|
+
emits: ["update:modelValue", "schema-error"],
|
|
361
|
+
setup(e, { emit: a }) {
|
|
362
|
+
const t = e, l = F({
|
|
363
|
+
get: () => t.modelValue ?? "",
|
|
364
|
+
set: (d) => a("update:modelValue", d)
|
|
365
|
+
}), n = F(() => (t.modelValue || "").replace(/<script[\s\S]*?<\/script>/gi, ""));
|
|
366
|
+
return ge(() => {
|
|
367
|
+
var d;
|
|
368
|
+
!t.disabled && !t.hostComponent && a("schema-error", {
|
|
369
|
+
type: "missingHostComponent",
|
|
370
|
+
component: "editor",
|
|
371
|
+
field: ((d = t.field) == null ? void 0 : d.prop) || "",
|
|
372
|
+
message: "JXYFormRuntime 未配置宿主富文本组件 editor"
|
|
373
|
+
});
|
|
374
|
+
}), (d, c) => {
|
|
375
|
+
var r, o, x;
|
|
376
|
+
return V(), R("div", {
|
|
377
|
+
class: N(["jxy-editor-field", { "is-disabled": e.disabled }])
|
|
378
|
+
}, [
|
|
379
|
+
!e.disabled && e.hostComponent ? (V(), $(se(e.hostComponent), {
|
|
380
|
+
key: 0,
|
|
381
|
+
modelValue: y(l),
|
|
382
|
+
"onUpdate:modelValue": c[0] || (c[0] = (A) => J(l) ? l.value = A : null),
|
|
383
|
+
"min-height": ((r = e.field.props) == null ? void 0 : r.height) || 200,
|
|
384
|
+
height: (o = e.field.props) == null ? void 0 : o.height,
|
|
385
|
+
readOnly: !1
|
|
386
|
+
}, null, 8, ["modelValue", "min-height", "height"])) : e.disabled ? (V(), R("div", {
|
|
387
|
+
key: 1,
|
|
388
|
+
class: "jxy-editor-readonly",
|
|
389
|
+
style: Re({ minHeight: (((x = e.field.props) == null ? void 0 : x.height) || 200) + "px" }),
|
|
390
|
+
innerHTML: y(n)
|
|
391
|
+
}, null, 12, rt)) : L("", !0),
|
|
392
|
+
!e.disabled && !e.hostComponent ? (V(), R("div", st, " 未配置宿主富文本组件 editor ")) : L("", !0)
|
|
393
|
+
], 2);
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
}, ct = /* @__PURE__ */ D(ut, [["__scopeId", "data-v-620014d1"]]);
|
|
397
|
+
const ft = { class: "jxy-custom-field" }, pt = {
|
|
398
|
+
key: 1,
|
|
399
|
+
class: "custom-not-found"
|
|
400
|
+
}, mt = {
|
|
401
|
+
__name: "CustomField",
|
|
402
|
+
props: {
|
|
403
|
+
modelValue: { default: void 0 },
|
|
404
|
+
field: { type: Object, required: !0 },
|
|
405
|
+
disabled: { type: Boolean, default: !1 },
|
|
406
|
+
componentRegistry: { type: Object, default: () => ({}) }
|
|
407
|
+
},
|
|
408
|
+
emits: ["update:modelValue"],
|
|
409
|
+
setup(e, { emit: a }) {
|
|
410
|
+
const t = e, l = F({
|
|
411
|
+
get: () => t.modelValue,
|
|
412
|
+
set: (d) => a("update:modelValue", d)
|
|
413
|
+
}), n = F(() => {
|
|
414
|
+
var c;
|
|
415
|
+
const d = t.field.componentKey;
|
|
416
|
+
return d && ((c = t.componentRegistry) == null ? void 0 : c[d]) || null;
|
|
417
|
+
});
|
|
418
|
+
return (d, c) => {
|
|
419
|
+
const r = I("el-icon");
|
|
420
|
+
return V(), R("div", ft, [
|
|
421
|
+
y(n) ? (V(), $(se(y(n)), je({
|
|
422
|
+
key: 0,
|
|
423
|
+
modelValue: y(l),
|
|
424
|
+
"onUpdate:modelValue": c[0] || (c[0] = (o) => J(l) ? l.value = o : null),
|
|
425
|
+
disabled: e.disabled
|
|
426
|
+
}, e.field.componentProps || {}), null, 16, ["modelValue", "disabled"])) : (V(), R("div", pt, [
|
|
427
|
+
U(r, { color: "#e6a23c" }, {
|
|
428
|
+
default: C(() => [
|
|
429
|
+
U(y(Le))
|
|
430
|
+
]),
|
|
431
|
+
_: 1
|
|
432
|
+
}),
|
|
433
|
+
Z("span", null, [
|
|
434
|
+
X("自定义组件 "),
|
|
435
|
+
Z("code", null, W(e.field.componentKey), 1),
|
|
436
|
+
X(" 未在 componentRegistry 中注册")
|
|
437
|
+
])
|
|
438
|
+
]))
|
|
439
|
+
]);
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
}, yt = /* @__PURE__ */ D(mt, [["__scopeId", "data-v-47936676"]]);
|
|
443
|
+
const ht = { class: "jxy-address-selector" }, gt = { class: "jxy-address-selector__selects" }, vt = {
|
|
444
|
+
__name: "index",
|
|
445
|
+
props: {
|
|
446
|
+
modelValue: { type: Object, default: () => ({}) },
|
|
447
|
+
options: { type: Array, default: () => [] },
|
|
448
|
+
provinceProp: { type: String, default: "province" },
|
|
449
|
+
cityProp: { type: String, default: "city" },
|
|
450
|
+
countyProp: { type: String, default: "county" },
|
|
451
|
+
detailAddressProp: { type: String, default: "detailAddress" },
|
|
452
|
+
provincePlaceholder: { type: String, default: "请选择省份" },
|
|
453
|
+
cityPlaceholder: { type: String, default: "请选择城市" },
|
|
454
|
+
countyPlaceholder: { type: String, default: "请选择区县" },
|
|
455
|
+
detailPlaceholder: { type: String, default: "请输入详细地址" },
|
|
456
|
+
required: { type: Boolean, default: !1 },
|
|
457
|
+
detailRequired: { type: Boolean, default: !0 },
|
|
458
|
+
disabled: { type: Boolean, default: !1 }
|
|
459
|
+
},
|
|
460
|
+
emits: ["update:modelValue", "change"],
|
|
461
|
+
setup(e, { emit: a }) {
|
|
462
|
+
const t = e, l = F(() => ({
|
|
463
|
+
province: o(t.provinceProp, "province"),
|
|
464
|
+
city: o(t.cityProp, "city"),
|
|
465
|
+
county: o(t.countyProp, "county"),
|
|
466
|
+
detailAddress: o(t.detailAddressProp, "detailAddress")
|
|
467
|
+
})), n = F(() => {
|
|
468
|
+
var h, S, s, p;
|
|
469
|
+
return {
|
|
470
|
+
province: ((h = t.modelValue) == null ? void 0 : h[l.value.province]) ?? "",
|
|
471
|
+
city: ((S = t.modelValue) == null ? void 0 : S[l.value.city]) ?? "",
|
|
472
|
+
county: ((s = t.modelValue) == null ? void 0 : s[l.value.county]) ?? "",
|
|
473
|
+
detailAddress: ((p = t.modelValue) == null ? void 0 : p[l.value.detailAddress]) ?? ""
|
|
474
|
+
};
|
|
475
|
+
}), d = F(() => {
|
|
476
|
+
var h;
|
|
477
|
+
return ((h = t.options.find((S) => S.value === n.value.province)) == null ? void 0 : h.children) || [];
|
|
478
|
+
}), c = F(() => {
|
|
479
|
+
var h;
|
|
480
|
+
return ((h = d.value.find((S) => S.value === n.value.city)) == null ? void 0 : h.children) || [];
|
|
481
|
+
});
|
|
482
|
+
function r(h) {
|
|
483
|
+
const S = { ...n.value, ...h }, s = l.value, p = {
|
|
484
|
+
[s.province]: S.province,
|
|
485
|
+
[s.city]: S.city,
|
|
486
|
+
[s.county]: S.county,
|
|
487
|
+
[s.detailAddress]: S.detailAddress
|
|
488
|
+
};
|
|
489
|
+
a("update:modelValue", p), a("change", p);
|
|
490
|
+
}
|
|
491
|
+
function o(h, S) {
|
|
492
|
+
const s = typeof h == "string" ? h.trim() : "";
|
|
493
|
+
return s && !["__proto__", "prototype", "constructor"].includes(s) ? s : S;
|
|
494
|
+
}
|
|
495
|
+
function x(h) {
|
|
496
|
+
r({ province: h ?? "", city: "", county: "" });
|
|
497
|
+
}
|
|
498
|
+
function A(h) {
|
|
499
|
+
r({ city: h ?? "", county: "" });
|
|
500
|
+
}
|
|
501
|
+
return (h, S) => {
|
|
502
|
+
const s = I("el-option"), p = I("el-select"), _ = I("el-input");
|
|
503
|
+
return V(), R("div", ht, [
|
|
504
|
+
Z("div", gt, [
|
|
505
|
+
U(p, {
|
|
506
|
+
class: N({ "jxy-extension-control--invalid": e.required && !y(n).province }),
|
|
507
|
+
"model-value": y(n).province,
|
|
508
|
+
placeholder: e.provincePlaceholder,
|
|
509
|
+
clearable: "",
|
|
510
|
+
disabled: e.disabled,
|
|
511
|
+
"onUpdate:modelValue": x
|
|
512
|
+
}, {
|
|
513
|
+
default: C(() => [
|
|
514
|
+
(V(!0), R(Y, null, H(e.options, (u) => (V(), $(s, {
|
|
515
|
+
key: u.value,
|
|
516
|
+
label: u.label,
|
|
517
|
+
value: u.value,
|
|
518
|
+
disabled: u.disabled
|
|
519
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
520
|
+
]),
|
|
521
|
+
_: 1
|
|
522
|
+
}, 8, ["class", "model-value", "placeholder", "disabled"]),
|
|
523
|
+
U(p, {
|
|
524
|
+
class: N({ "jxy-extension-control--invalid": e.required && !y(n).city }),
|
|
525
|
+
"model-value": y(n).city,
|
|
526
|
+
placeholder: e.cityPlaceholder,
|
|
527
|
+
clearable: "",
|
|
528
|
+
disabled: e.disabled || !y(n).province,
|
|
529
|
+
"onUpdate:modelValue": A
|
|
530
|
+
}, {
|
|
531
|
+
default: C(() => [
|
|
532
|
+
(V(!0), R(Y, null, H(y(d), (u) => (V(), $(s, {
|
|
533
|
+
key: u.value,
|
|
534
|
+
label: u.label,
|
|
535
|
+
value: u.value,
|
|
536
|
+
disabled: u.disabled
|
|
537
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
538
|
+
]),
|
|
539
|
+
_: 1
|
|
540
|
+
}, 8, ["class", "model-value", "placeholder", "disabled"]),
|
|
541
|
+
U(p, {
|
|
542
|
+
class: N({ "jxy-extension-control--invalid": e.required && !y(n).county }),
|
|
543
|
+
"model-value": y(n).county,
|
|
544
|
+
placeholder: e.countyPlaceholder,
|
|
545
|
+
clearable: "",
|
|
546
|
+
disabled: e.disabled || !y(n).city,
|
|
547
|
+
"onUpdate:modelValue": S[0] || (S[0] = (u) => r({ county: u ?? "" }))
|
|
548
|
+
}, {
|
|
549
|
+
default: C(() => [
|
|
550
|
+
(V(!0), R(Y, null, H(y(c), (u) => (V(), $(s, {
|
|
551
|
+
key: u.value,
|
|
552
|
+
label: u.label,
|
|
553
|
+
value: u.value,
|
|
554
|
+
disabled: u.disabled
|
|
555
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
556
|
+
]),
|
|
557
|
+
_: 1
|
|
558
|
+
}, 8, ["class", "model-value", "placeholder", "disabled"])
|
|
559
|
+
]),
|
|
560
|
+
U(_, {
|
|
561
|
+
class: N({ "jxy-extension-control--invalid": e.detailRequired && !y(n).detailAddress }),
|
|
562
|
+
"model-value": y(n).detailAddress,
|
|
563
|
+
placeholder: e.detailPlaceholder,
|
|
564
|
+
clearable: "",
|
|
565
|
+
disabled: e.disabled,
|
|
566
|
+
"onUpdate:modelValue": S[1] || (S[1] = (u) => r({ detailAddress: u ?? "" }))
|
|
567
|
+
}, null, 8, ["class", "model-value", "placeholder", "disabled"])
|
|
568
|
+
]);
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
}, bt = /* @__PURE__ */ D(vt, [["__scopeId", "data-v-7143c4fd"]]), Vt = {
|
|
572
|
+
__name: "AddressSelectorField",
|
|
573
|
+
props: {
|
|
574
|
+
modelValue: { type: Object, default: () => ({}) },
|
|
575
|
+
field: { type: Object, required: !0 },
|
|
576
|
+
disabled: { type: Boolean, default: !1 },
|
|
577
|
+
required: { type: Boolean, default: !1 },
|
|
578
|
+
options: { type: Array, default: () => [] }
|
|
579
|
+
},
|
|
580
|
+
emits: ["update:modelValue"],
|
|
581
|
+
setup(e, { emit: a }) {
|
|
582
|
+
return (t, l) => {
|
|
583
|
+
var n, d, c, r, o, x, A, h, S;
|
|
584
|
+
return V(), $(bt, {
|
|
585
|
+
"model-value": e.modelValue,
|
|
586
|
+
options: e.options,
|
|
587
|
+
disabled: e.disabled,
|
|
588
|
+
required: e.required,
|
|
589
|
+
"province-prop": (n = e.field.props) == null ? void 0 : n.provinceProp,
|
|
590
|
+
"city-prop": (d = e.field.props) == null ? void 0 : d.cityProp,
|
|
591
|
+
"county-prop": (c = e.field.props) == null ? void 0 : c.countyProp,
|
|
592
|
+
"detail-address-prop": (r = e.field.props) == null ? void 0 : r.detailAddressProp,
|
|
593
|
+
"province-placeholder": (o = e.field.props) == null ? void 0 : o.provincePlaceholder,
|
|
594
|
+
"city-placeholder": (x = e.field.props) == null ? void 0 : x.cityPlaceholder,
|
|
595
|
+
"county-placeholder": (A = e.field.props) == null ? void 0 : A.countyPlaceholder,
|
|
596
|
+
"detail-placeholder": (h = e.field.props) == null ? void 0 : h.detailPlaceholder,
|
|
597
|
+
"detail-required": (S = e.field.props) == null ? void 0 : S.detailRequired,
|
|
598
|
+
"onUpdate:modelValue": l[0] || (l[0] = (s) => a("update:modelValue", s))
|
|
599
|
+
}, null, 8, ["model-value", "options", "disabled", "required", "province-prop", "city-prop", "county-prop", "detail-address-prop", "province-placeholder", "city-placeholder", "county-placeholder", "detail-placeholder", "detail-required"]);
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
}, xt = Vt, pe = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], _t = ["仟", "佰", "拾", ""], St = ["", "万", "亿", "万亿"], re = 16;
|
|
603
|
+
function ke(e, a = re) {
|
|
604
|
+
if (e === "" || e === null || e === void 0)
|
|
605
|
+
return "";
|
|
606
|
+
const t = String(e).replace(/\D/g, "");
|
|
607
|
+
if (!t)
|
|
608
|
+
return "";
|
|
609
|
+
const l = t.replace(/^0+(?=\d)/, ""), n = Math.min(Math.max(Math.trunc(a) || 1, 1), re);
|
|
610
|
+
return l.slice(0, n);
|
|
611
|
+
}
|
|
612
|
+
function wt(e) {
|
|
613
|
+
const a = e.padStart(4, "0");
|
|
614
|
+
let t = "", l = !1;
|
|
615
|
+
for (let n = 0; n < a.length; n += 1) {
|
|
616
|
+
const d = Number(a[n]);
|
|
617
|
+
if (d === 0) {
|
|
618
|
+
t && (l = !0);
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
l && (t += pe[0]), t += pe[d] + _t[n], l = !1;
|
|
622
|
+
}
|
|
623
|
+
return t;
|
|
624
|
+
}
|
|
625
|
+
function Ft(e) {
|
|
626
|
+
if (e === "" || e === null || e === void 0)
|
|
627
|
+
return "";
|
|
628
|
+
const a = String(e).replace(/^0+(?=\d)/, "");
|
|
629
|
+
if (!/^\d+$/.test(a) || a.length > re)
|
|
630
|
+
return "";
|
|
631
|
+
if (a === "0")
|
|
632
|
+
return pe[0];
|
|
633
|
+
const t = [];
|
|
634
|
+
for (let d = a.length; d > 0; d -= 4)
|
|
635
|
+
t.unshift(a.slice(Math.max(0, d - 4), d));
|
|
636
|
+
let l = "", n = !1;
|
|
637
|
+
return t.forEach((d, c) => {
|
|
638
|
+
const r = Number(d);
|
|
639
|
+
if (r === 0) {
|
|
640
|
+
l && (n = !0);
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
l && (n || r < 1e3) && (l += pe[0]), l += wt(d) + St[t.length - c - 1], n = !1;
|
|
644
|
+
}), l;
|
|
645
|
+
}
|
|
646
|
+
const At = { class: "jxy-integer-uppercase-input" }, Pt = {
|
|
647
|
+
key: 0,
|
|
648
|
+
class: "jxy-integer-uppercase-input__preview",
|
|
649
|
+
role: "status",
|
|
650
|
+
"aria-live": "polite"
|
|
651
|
+
}, kt = {
|
|
652
|
+
__name: "index",
|
|
653
|
+
props: {
|
|
654
|
+
modelValue: { type: [String, Number], default: "" },
|
|
655
|
+
suffixText: { type: String, default: "" },
|
|
656
|
+
placeholder: { type: String, default: "请输入整数" },
|
|
657
|
+
maxLength: { type: Number, default: re },
|
|
658
|
+
disabled: { type: Boolean, default: !1 }
|
|
659
|
+
},
|
|
660
|
+
emits: ["update:modelValue", "change"],
|
|
661
|
+
setup(e, { emit: a }) {
|
|
662
|
+
const t = e, l = F(() => Math.min(Math.max(Math.trunc(t.maxLength) || 1, 1), re)), n = de("");
|
|
663
|
+
fe(
|
|
664
|
+
[() => t.modelValue, l],
|
|
665
|
+
([r]) => {
|
|
666
|
+
n.value = ke(r, l.value);
|
|
667
|
+
},
|
|
668
|
+
{ immediate: !0 }
|
|
669
|
+
);
|
|
670
|
+
const d = F(() => {
|
|
671
|
+
const r = Ft(n.value);
|
|
672
|
+
return r ? `${r}${t.suffixText}` : "";
|
|
673
|
+
});
|
|
674
|
+
function c(r) {
|
|
675
|
+
const o = ke(r, l.value);
|
|
676
|
+
n.value = o, a("update:modelValue", o), a("change", o);
|
|
677
|
+
}
|
|
678
|
+
return (r, o) => {
|
|
679
|
+
const x = I("el-input");
|
|
680
|
+
return V(), R("div", At, [
|
|
681
|
+
U(x, {
|
|
682
|
+
"model-value": n.value,
|
|
683
|
+
maxlength: y(l),
|
|
684
|
+
placeholder: e.placeholder,
|
|
685
|
+
disabled: e.disabled,
|
|
686
|
+
inputmode: "numeric",
|
|
687
|
+
autocomplete: "off",
|
|
688
|
+
onInput: c
|
|
689
|
+
}, null, 8, ["model-value", "maxlength", "placeholder", "disabled"]),
|
|
690
|
+
y(d) ? (V(), R("div", Pt, W(y(d)), 1)) : L("", !0)
|
|
691
|
+
]);
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
}, Rt = /* @__PURE__ */ D(kt, [["__scopeId", "data-v-23d44c1e"]]), jt = {
|
|
695
|
+
__name: "IntegerUppercaseField",
|
|
696
|
+
props: {
|
|
697
|
+
modelValue: { type: [String, Number], default: "" },
|
|
698
|
+
field: { type: Object, required: !0 },
|
|
699
|
+
disabled: { type: Boolean, default: !1 },
|
|
700
|
+
required: { type: Boolean, default: !1 }
|
|
701
|
+
},
|
|
702
|
+
emits: ["update:modelValue"],
|
|
703
|
+
setup(e, { emit: a }) {
|
|
704
|
+
return (t, l) => {
|
|
705
|
+
var n, d;
|
|
706
|
+
return V(), $(Rt, {
|
|
707
|
+
"model-value": e.modelValue,
|
|
708
|
+
disabled: e.disabled,
|
|
709
|
+
placeholder: e.field.placeholder || "请输入整数",
|
|
710
|
+
"suffix-text": (n = e.field.props) == null ? void 0 : n.suffixText,
|
|
711
|
+
"max-length": (d = e.field.props) == null ? void 0 : d.maxLength,
|
|
712
|
+
"onUpdate:modelValue": l[0] || (l[0] = (c) => a("update:modelValue", c))
|
|
713
|
+
}, null, 8, ["model-value", "disabled", "placeholder", "suffix-text", "max-length"]);
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
}, $t = jt;
|
|
717
|
+
const Ot = { class: "jxy-linked-select-list" }, Ct = {
|
|
718
|
+
__name: "index",
|
|
719
|
+
props: {
|
|
720
|
+
modelValue: { type: Array, default: () => [] },
|
|
721
|
+
options: { type: Array, default: () => [] },
|
|
722
|
+
parentValueProp: { type: String, default: "parentValue" },
|
|
723
|
+
childValueProp: { type: String, default: "childValue" },
|
|
724
|
+
firstPlaceholder: { type: String, default: "请选择一级选项" },
|
|
725
|
+
secondPlaceholder: { type: String, default: "请选择二级选项" },
|
|
726
|
+
addText: { type: String, default: "点击新增" },
|
|
727
|
+
minItems: { type: Number, default: 1 },
|
|
728
|
+
maxItems: { type: Number, default: 5 },
|
|
729
|
+
required: { type: Boolean, default: !1 },
|
|
730
|
+
allowDuplicate: { type: Boolean, default: !0 },
|
|
731
|
+
addButtonAlign: { type: String, default: "center" },
|
|
732
|
+
disabled: { type: Boolean, default: !1 }
|
|
733
|
+
},
|
|
734
|
+
emits: ["update:modelValue", "change", "add", "remove"],
|
|
735
|
+
setup(e, { emit: a }) {
|
|
736
|
+
const t = e, l = F(() => ({
|
|
737
|
+
parentValue: m(t.parentValueProp, "parentValue"),
|
|
738
|
+
childValue: m(t.childValueProp, "childValue")
|
|
739
|
+
})), n = F(() => Math.max(Math.trunc(t.maxItems) || 1, 1)), d = F(() => Math.min(Math.max(Math.trunc(t.minItems) || 1, 1), n.value)), c = F(
|
|
740
|
+
() => ["left", "center", "right"].includes(t.addButtonAlign) ? t.addButtonAlign : "center"
|
|
741
|
+
), r = F(() => {
|
|
742
|
+
const i = t.modelValue.length ? t.modelValue : [o()], g = l.value;
|
|
743
|
+
return i.map((b) => ({
|
|
744
|
+
parentValue: (b == null ? void 0 : b[g.parentValue]) ?? "",
|
|
745
|
+
childValue: (b == null ? void 0 : b[g.childValue]) ?? ""
|
|
746
|
+
}));
|
|
747
|
+
});
|
|
748
|
+
function o() {
|
|
749
|
+
return { parentValue: "", childValue: "" };
|
|
750
|
+
}
|
|
751
|
+
function x(i) {
|
|
752
|
+
var g;
|
|
753
|
+
return ((g = t.options.find((b) => b.value === i)) == null ? void 0 : g.children) || [];
|
|
754
|
+
}
|
|
755
|
+
const A = F(() => {
|
|
756
|
+
if (t.allowDuplicate)
|
|
757
|
+
return /* @__PURE__ */ new Set();
|
|
758
|
+
const i = /* @__PURE__ */ new Map();
|
|
759
|
+
r.value.forEach((b, k) => {
|
|
760
|
+
if (!b.parentValue || !b.childValue)
|
|
761
|
+
return;
|
|
762
|
+
const q = `${String(b.parentValue)}::${String(b.childValue)}`, E = i.get(q) || [];
|
|
763
|
+
E.push(k), i.set(q, E);
|
|
764
|
+
});
|
|
765
|
+
const g = /* @__PURE__ */ new Set();
|
|
766
|
+
return i.forEach((b) => {
|
|
767
|
+
b.length > 1 && b.forEach((k) => g.add(k));
|
|
768
|
+
}), g;
|
|
769
|
+
});
|
|
770
|
+
function h(i, g) {
|
|
771
|
+
return t.required && !i.parentValue || A.value.has(g);
|
|
772
|
+
}
|
|
773
|
+
function S(i, g) {
|
|
774
|
+
return t.required && !i.childValue || A.value.has(g);
|
|
775
|
+
}
|
|
776
|
+
function s(i, g) {
|
|
777
|
+
const b = P(i);
|
|
778
|
+
a("update:modelValue", b), a("change", b, g);
|
|
779
|
+
}
|
|
780
|
+
function p(i, g) {
|
|
781
|
+
const b = r.value.map((k) => ({ ...k }));
|
|
782
|
+
b[i] = { parentValue: g ?? "", childValue: "" }, s(b, { type: "parent-change", index: i });
|
|
783
|
+
}
|
|
784
|
+
function _(i, g) {
|
|
785
|
+
const b = r.value.map((k) => ({ ...k }));
|
|
786
|
+
b[i].childValue = g ?? "", s(b, { type: "child-change", index: i });
|
|
787
|
+
}
|
|
788
|
+
function u() {
|
|
789
|
+
if (t.disabled || r.value.length >= n.value)
|
|
790
|
+
return;
|
|
791
|
+
const i = [...r.value.map((g) => ({ ...g })), o()];
|
|
792
|
+
s(i, { type: "add", index: i.length - 1 }), a("add", i.length - 1);
|
|
793
|
+
}
|
|
794
|
+
function w(i) {
|
|
795
|
+
if (t.disabled || r.value.length <= d.value)
|
|
796
|
+
return;
|
|
797
|
+
const g = r.value[i], b = r.value.filter((k, q) => q !== i).map((k) => ({ ...k }));
|
|
798
|
+
s(b, { type: "remove", index: i }), a("remove", i, P([g])[0]);
|
|
799
|
+
}
|
|
800
|
+
function P(i) {
|
|
801
|
+
const g = l.value;
|
|
802
|
+
return i.map((b) => ({
|
|
803
|
+
[g.parentValue]: b.parentValue ?? "",
|
|
804
|
+
[g.childValue]: b.childValue ?? ""
|
|
805
|
+
}));
|
|
806
|
+
}
|
|
807
|
+
function m(i, g) {
|
|
808
|
+
const b = typeof i == "string" ? i.trim() : "";
|
|
809
|
+
return b && !["__proto__", "prototype", "constructor"].includes(b) ? b : g;
|
|
810
|
+
}
|
|
811
|
+
return (i, g) => {
|
|
812
|
+
const b = I("el-option"), k = I("el-select"), q = I("el-button");
|
|
813
|
+
return V(), R("div", Ot, [
|
|
814
|
+
(V(!0), R(Y, null, H(y(r), (E, B) => (V(), R("div", {
|
|
815
|
+
key: B,
|
|
816
|
+
class: "jxy-linked-select-list__row"
|
|
817
|
+
}, [
|
|
818
|
+
U(k, {
|
|
819
|
+
class: N({ "jxy-extension-control--invalid": h(E, B) }),
|
|
820
|
+
"model-value": E.parentValue,
|
|
821
|
+
placeholder: e.firstPlaceholder,
|
|
822
|
+
disabled: e.disabled,
|
|
823
|
+
clearable: "",
|
|
824
|
+
"onUpdate:modelValue": (M) => p(B, M)
|
|
825
|
+
}, {
|
|
826
|
+
default: C(() => [
|
|
827
|
+
(V(!0), R(Y, null, H(e.options, (M) => (V(), $(b, {
|
|
828
|
+
key: M.value,
|
|
829
|
+
label: M.label,
|
|
830
|
+
value: M.value,
|
|
831
|
+
disabled: M.disabled
|
|
832
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
833
|
+
]),
|
|
834
|
+
_: 2
|
|
835
|
+
}, 1032, ["class", "model-value", "placeholder", "disabled", "onUpdate:modelValue"]),
|
|
836
|
+
U(k, {
|
|
837
|
+
class: N({ "jxy-extension-control--invalid": S(E, B) }),
|
|
838
|
+
"model-value": E.childValue,
|
|
839
|
+
placeholder: e.secondPlaceholder,
|
|
840
|
+
disabled: e.disabled || !E.parentValue,
|
|
841
|
+
clearable: "",
|
|
842
|
+
"onUpdate:modelValue": (M) => _(B, M)
|
|
843
|
+
}, {
|
|
844
|
+
default: C(() => [
|
|
845
|
+
(V(!0), R(Y, null, H(x(E.parentValue), (M) => (V(), $(b, {
|
|
846
|
+
key: M.value,
|
|
847
|
+
label: M.label,
|
|
848
|
+
value: M.value,
|
|
849
|
+
disabled: M.disabled
|
|
850
|
+
}, null, 8, ["label", "value", "disabled"]))), 128))
|
|
851
|
+
]),
|
|
852
|
+
_: 2
|
|
853
|
+
}, 1032, ["class", "model-value", "placeholder", "disabled", "onUpdate:modelValue"]),
|
|
854
|
+
!e.disabled && y(r).length > y(d) ? (V(), $(q, {
|
|
855
|
+
key: 0,
|
|
856
|
+
class: "jxy-linked-select-list__remove",
|
|
857
|
+
link: "",
|
|
858
|
+
type: "danger",
|
|
859
|
+
onClick: (M) => w(B)
|
|
860
|
+
}, {
|
|
861
|
+
default: C(() => [
|
|
862
|
+
X("删除")
|
|
863
|
+
]),
|
|
864
|
+
_: 2
|
|
865
|
+
}, 1032, ["onClick"])) : L("", !0)
|
|
866
|
+
]))), 128)),
|
|
867
|
+
e.disabled ? L("", !0) : (V(), $(q, {
|
|
868
|
+
key: 0,
|
|
869
|
+
class: N([
|
|
870
|
+
"jxy-linked-select-list__add",
|
|
871
|
+
`jxy-linked-select-list__add--${y(c)}`
|
|
872
|
+
]),
|
|
873
|
+
link: "",
|
|
874
|
+
type: "primary",
|
|
875
|
+
disabled: y(r).length >= y(n),
|
|
876
|
+
onClick: u
|
|
877
|
+
}, {
|
|
878
|
+
default: C(() => [
|
|
879
|
+
X("+ " + W(e.addText), 1)
|
|
880
|
+
]),
|
|
881
|
+
_: 1
|
|
882
|
+
}, 8, ["class", "disabled"]))
|
|
883
|
+
]);
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
}, It = /* @__PURE__ */ D(Ct, [["__scopeId", "data-v-dc09a2f0"]]), Et = {
|
|
887
|
+
__name: "LinkedSelectListField",
|
|
888
|
+
props: {
|
|
889
|
+
modelValue: { type: Array, default: () => [] },
|
|
890
|
+
field: { type: Object, required: !0 },
|
|
891
|
+
disabled: { type: Boolean, default: !1 },
|
|
892
|
+
required: { type: Boolean, default: !1 },
|
|
893
|
+
options: { type: Array, default: () => [] }
|
|
894
|
+
},
|
|
895
|
+
emits: ["update:modelValue"],
|
|
896
|
+
setup(e, { emit: a }) {
|
|
897
|
+
return (t, l) => {
|
|
898
|
+
var n, d, c, r, o, x, A, h, S;
|
|
899
|
+
return V(), $(It, {
|
|
900
|
+
"model-value": e.modelValue,
|
|
901
|
+
options: e.options,
|
|
902
|
+
disabled: e.disabled,
|
|
903
|
+
required: e.required,
|
|
904
|
+
"parent-value-prop": (n = e.field.props) == null ? void 0 : n.parentValueProp,
|
|
905
|
+
"child-value-prop": (d = e.field.props) == null ? void 0 : d.childValueProp,
|
|
906
|
+
"first-placeholder": (c = e.field.props) == null ? void 0 : c.firstPlaceholder,
|
|
907
|
+
"second-placeholder": (r = e.field.props) == null ? void 0 : r.secondPlaceholder,
|
|
908
|
+
"add-text": (o = e.field.props) == null ? void 0 : o.addText,
|
|
909
|
+
"min-items": (x = e.field.props) == null ? void 0 : x.minItems,
|
|
910
|
+
"max-items": (A = e.field.props) == null ? void 0 : A.maxItems,
|
|
911
|
+
"allow-duplicate": (h = e.field.props) == null ? void 0 : h.allowDuplicate,
|
|
912
|
+
"add-button-align": (S = e.field.props) == null ? void 0 : S.addButtonAlign,
|
|
913
|
+
"onUpdate:modelValue": l[0] || (l[0] = (s) => a("update:modelValue", s))
|
|
914
|
+
}, null, 8, ["model-value", "options", "disabled", "required", "parent-value-prop", "child-value-prop", "first-placeholder", "second-placeholder", "add-text", "min-items", "max-items", "allow-duplicate", "add-button-align"]);
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
}, qt = Et, Mt = {
|
|
918
|
+
text: me,
|
|
919
|
+
password: me,
|
|
920
|
+
textarea: me,
|
|
921
|
+
number: Pe,
|
|
922
|
+
floatNum: Pe,
|
|
923
|
+
date: ae,
|
|
924
|
+
month: ae,
|
|
925
|
+
year: ae,
|
|
926
|
+
daterange: ae,
|
|
927
|
+
datetimerange: ae,
|
|
928
|
+
select: Ge,
|
|
929
|
+
cascader: Qe,
|
|
930
|
+
checkBox: dt,
|
|
931
|
+
radio: lt,
|
|
932
|
+
file: ye,
|
|
933
|
+
dragFile: ye,
|
|
934
|
+
imgFile: ye,
|
|
935
|
+
editor: ct,
|
|
936
|
+
addressSelector: xt,
|
|
937
|
+
integerUppercase: $t,
|
|
938
|
+
linkedSelectList: qt,
|
|
939
|
+
custom: yt
|
|
940
|
+
};
|
|
941
|
+
function Ut(e) {
|
|
942
|
+
return Mt[e] || null;
|
|
943
|
+
}
|
|
944
|
+
const Bt = (e) => e == null || e === "";
|
|
945
|
+
function ce(e) {
|
|
946
|
+
if (Bt(e))
|
|
947
|
+
return null;
|
|
948
|
+
const a = Number(e);
|
|
949
|
+
return isNaN(a) ? null : a + "px";
|
|
950
|
+
}
|
|
951
|
+
function Tt(e, a, t, l) {
|
|
952
|
+
return ce(e == null ? void 0 : e.labelWidth) || ce(a == null ? void 0 : a.labelWidth) || ce(t == null ? void 0 : t.labelWidth) || ce(l == null ? void 0 : l.labelWidth) || "120px";
|
|
953
|
+
}
|
|
954
|
+
const Nt = {
|
|
955
|
+
__name: "FieldSuffixHost",
|
|
956
|
+
props: {
|
|
957
|
+
width: { type: Number, default: 60 }
|
|
958
|
+
},
|
|
959
|
+
setup(e) {
|
|
960
|
+
return $e(De, void 0), (a, t) => (V(), R("div", {
|
|
961
|
+
class: "jxy-field-suffix",
|
|
962
|
+
style: Re({ width: `${e.width}px` })
|
|
963
|
+
}, [
|
|
964
|
+
Q(a.$slots, "default", {}, void 0, !0)
|
|
965
|
+
], 4));
|
|
966
|
+
}
|
|
967
|
+
}, Dt = /* @__PURE__ */ D(Nt, [["__scopeId", "data-v-8626e24d"]]);
|
|
968
|
+
const Lt = { class: "jxy-field-control" }, Yt = {
|
|
969
|
+
key: 1,
|
|
970
|
+
class: "jxy-field-unknown"
|
|
971
|
+
}, zt = {
|
|
972
|
+
__name: "FieldRenderer",
|
|
973
|
+
props: {
|
|
974
|
+
node: { type: Object, required: !0 },
|
|
975
|
+
/** 所在 column(非 grid 内时为 null) */
|
|
976
|
+
columnNode: { type: Object, default: null },
|
|
977
|
+
/** 所在 grid(非 grid 内时为 null) */
|
|
978
|
+
gridNode: { type: Object, default: null },
|
|
979
|
+
/** Runtime 调用方是否提供了右侧扩展插槽 */
|
|
980
|
+
hasFieldSuffixSlot: { type: Boolean, default: !1 }
|
|
981
|
+
},
|
|
982
|
+
setup(e) {
|
|
983
|
+
const a = e, t = Oe("jxyRuntime", null), l = F(() => {
|
|
984
|
+
var m;
|
|
985
|
+
return !t || !a.node.prop ? null : ((m = t.fieldStates) == null ? void 0 : m[a.node.prop]) || null;
|
|
986
|
+
}), n = F(() => {
|
|
987
|
+
var m;
|
|
988
|
+
return ((m = l.value) == null ? void 0 : m.hidden) ?? a.node.hidden ?? !1;
|
|
989
|
+
}), d = F(
|
|
990
|
+
() => {
|
|
991
|
+
var m, i;
|
|
992
|
+
return ((m = l.value) == null ? void 0 : m.disabled) ?? a.node.disabled ?? ((i = t == null ? void 0 : t.disabled) == null ? void 0 : i.value) ?? !1;
|
|
993
|
+
}
|
|
994
|
+
), c = F(() => {
|
|
995
|
+
var m;
|
|
996
|
+
return ((m = l.value) == null ? void 0 : m.required) ?? a.node.required ?? !1;
|
|
997
|
+
}), r = F(() => {
|
|
998
|
+
var m, i;
|
|
999
|
+
return a.hasFieldSuffixSlot && ((i = (m = a.node.extensions) == null ? void 0 : m.suffix) == null ? void 0 : i.enabled) === !0;
|
|
1000
|
+
}), o = F(() => {
|
|
1001
|
+
var m, i;
|
|
1002
|
+
return He(a.node, (i = (m = t == null ? void 0 : t.schema) == null ? void 0 : m.value) == null ? void 0 : i.config);
|
|
1003
|
+
}), x = F(() => ["addressSelector", "linkedSelectList"].includes(a.node.type)), A = F(() => ["addressSelector", "integerUppercase", "linkedSelectList"].includes(a.node.type) ? { required: c.value } : {}), h = F({
|
|
1004
|
+
get: () => {
|
|
1005
|
+
var m;
|
|
1006
|
+
return (m = t == null ? void 0 : t.formData) == null ? void 0 : m[a.node.prop];
|
|
1007
|
+
},
|
|
1008
|
+
set: (m) => {
|
|
1009
|
+
t != null && t.onFieldChange && t.onFieldChange(a.node.prop, m);
|
|
1010
|
+
}
|
|
1011
|
+
}), S = F(() => {
|
|
1012
|
+
var m;
|
|
1013
|
+
return ((m = l.value) == null ? void 0 : m.options) || [];
|
|
1014
|
+
}), s = F(() => {
|
|
1015
|
+
var m;
|
|
1016
|
+
return ((m = l.value) == null ? void 0 : m.loading) || !1;
|
|
1017
|
+
}), p = F(() => Ut(a.node.type)), _ = F(() => {
|
|
1018
|
+
var i;
|
|
1019
|
+
const m = ((i = t == null ? void 0 : t.hostComponents) == null ? void 0 : i.value) || {};
|
|
1020
|
+
return ["file", "dragFile", "imgFile"].includes(a.node.type) ? m.fileUpload || null : a.node.type === "editor" && m.editor || null;
|
|
1021
|
+
}), u = F(() => ["file", "dragFile", "imgFile", "editor"].includes(a.node.type) ? {
|
|
1022
|
+
hostComponent: _.value,
|
|
1023
|
+
onSchemaError: (m) => {
|
|
1024
|
+
var i;
|
|
1025
|
+
return (i = t == null ? void 0 : t.reportSchemaError) == null ? void 0 : i.call(t, m);
|
|
1026
|
+
}
|
|
1027
|
+
} : {}), w = F(() => ({
|
|
1028
|
+
...A.value,
|
|
1029
|
+
...u.value
|
|
1030
|
+
})), P = F(
|
|
1031
|
+
() => {
|
|
1032
|
+
var m, i;
|
|
1033
|
+
return Tt(
|
|
1034
|
+
a.node,
|
|
1035
|
+
a.columnNode,
|
|
1036
|
+
a.gridNode,
|
|
1037
|
+
(i = (m = t == null ? void 0 : t.schema) == null ? void 0 : m.value) == null ? void 0 : i.config
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1041
|
+
return (m, i) => {
|
|
1042
|
+
const g = I("el-tag"), b = I("el-form-item");
|
|
1043
|
+
return y(n) ? L("", !0) : (V(), $(b, {
|
|
1044
|
+
key: 0,
|
|
1045
|
+
prop: e.node.prop,
|
|
1046
|
+
label: e.node.label ? e.node.label + ":" : "",
|
|
1047
|
+
"label-width": y(P),
|
|
1048
|
+
class: N([
|
|
1049
|
+
"jxy-field-item",
|
|
1050
|
+
{ "jxy-field-item--composite": y(x) },
|
|
1051
|
+
e.node.customClass
|
|
1052
|
+
])
|
|
1053
|
+
}, {
|
|
1054
|
+
default: C(() => {
|
|
1055
|
+
var k, q;
|
|
1056
|
+
return [
|
|
1057
|
+
Z("div", {
|
|
1058
|
+
class: N(["jxy-field-content", { "jxy-field-content--with-suffix": y(r) }])
|
|
1059
|
+
}, [
|
|
1060
|
+
Z("div", Lt, [
|
|
1061
|
+
y(p) ? (V(), $(se(y(p)), je({
|
|
1062
|
+
key: 0,
|
|
1063
|
+
modelValue: y(h),
|
|
1064
|
+
"onUpdate:modelValue": i[0] || (i[0] = (E) => J(h) ? h.value = E : null),
|
|
1065
|
+
field: e.node,
|
|
1066
|
+
disabled: y(d),
|
|
1067
|
+
options: y(S),
|
|
1068
|
+
loading: y(s),
|
|
1069
|
+
"component-registry": ((q = (k = y(t)) == null ? void 0 : k.componentRegistry) == null ? void 0 : q.value) || {}
|
|
1070
|
+
}, y(w)), null, 16, ["modelValue", "field", "disabled", "options", "loading", "component-registry"])) : (V(), R("div", Yt, [
|
|
1071
|
+
U(g, {
|
|
1072
|
+
size: "small",
|
|
1073
|
+
type: "danger"
|
|
1074
|
+
}, {
|
|
1075
|
+
default: C(() => [
|
|
1076
|
+
X("未知类型:" + W(e.node.type), 1)
|
|
1077
|
+
]),
|
|
1078
|
+
_: 1
|
|
1079
|
+
})
|
|
1080
|
+
]))
|
|
1081
|
+
]),
|
|
1082
|
+
y(r) ? (V(), $(Dt, {
|
|
1083
|
+
key: 0,
|
|
1084
|
+
width: y(o)
|
|
1085
|
+
}, {
|
|
1086
|
+
default: C(() => [
|
|
1087
|
+
Q(m.$slots, "field-suffix", {
|
|
1088
|
+
field: e.node,
|
|
1089
|
+
fieldId: e.node.id,
|
|
1090
|
+
prop: e.node.prop,
|
|
1091
|
+
label: e.node.label,
|
|
1092
|
+
value: y(h),
|
|
1093
|
+
disabled: y(d),
|
|
1094
|
+
required: y(c)
|
|
1095
|
+
}, void 0, !0)
|
|
1096
|
+
]),
|
|
1097
|
+
_: 3
|
|
1098
|
+
}, 8, ["width"])) : L("", !0)
|
|
1099
|
+
], 2)
|
|
1100
|
+
];
|
|
1101
|
+
}),
|
|
1102
|
+
_: 3
|
|
1103
|
+
}, 8, ["prop", "label", "label-width", "class"]));
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
}, Ht = /* @__PURE__ */ D(zt, [["__scopeId", "data-v-6a13f76c"]]);
|
|
1107
|
+
const Xt = {
|
|
1108
|
+
key: 0,
|
|
1109
|
+
class: "jxy-title-description"
|
|
1110
|
+
}, Jt = {
|
|
1111
|
+
__name: "TitleRenderer",
|
|
1112
|
+
props: {
|
|
1113
|
+
node: { type: Object, required: !0 }
|
|
1114
|
+
},
|
|
1115
|
+
setup(e) {
|
|
1116
|
+
const a = e, t = F(() => `h${a.node.level || 2}`);
|
|
1117
|
+
return (l, n) => (V(), R("div", {
|
|
1118
|
+
class: N(["jxy-title-node", [`jxy-title-level-${e.node.level || 2}`, e.node.customClass]])
|
|
1119
|
+
}, [
|
|
1120
|
+
(V(), $(se(y(t)), { class: "jxy-title-text" }, {
|
|
1121
|
+
default: C(() => [
|
|
1122
|
+
X(W(e.node.title || "未命名标题"), 1)
|
|
1123
|
+
]),
|
|
1124
|
+
_: 1
|
|
1125
|
+
})),
|
|
1126
|
+
e.node.description ? (V(), R("p", Xt, W(e.node.description), 1)) : L("", !0)
|
|
1127
|
+
], 2));
|
|
1128
|
+
}
|
|
1129
|
+
}, Wt = /* @__PURE__ */ D(Jt, [["__scopeId", "data-v-a3dadfb8"]]);
|
|
1130
|
+
const Kt = {
|
|
1131
|
+
__name: "GridRenderer",
|
|
1132
|
+
props: {
|
|
1133
|
+
node: { type: Object, required: !0 },
|
|
1134
|
+
hasFieldSuffixSlot: { type: Boolean, default: !1 }
|
|
1135
|
+
},
|
|
1136
|
+
setup(e) {
|
|
1137
|
+
return (a, t) => {
|
|
1138
|
+
const l = I("el-col"), n = I("el-row");
|
|
1139
|
+
return V(), R("div", {
|
|
1140
|
+
class: N(["jxy-grid-node", e.node.customClass])
|
|
1141
|
+
}, [
|
|
1142
|
+
U(n, {
|
|
1143
|
+
gutter: e.node.gutter || 16
|
|
1144
|
+
}, {
|
|
1145
|
+
default: C(() => [
|
|
1146
|
+
(V(!0), R(Y, null, H(e.node.columns, (d) => (V(), $(l, {
|
|
1147
|
+
key: d.id,
|
|
1148
|
+
span: d.span
|
|
1149
|
+
}, {
|
|
1150
|
+
default: C(() => [
|
|
1151
|
+
Z("div", {
|
|
1152
|
+
class: N(["jxy-grid-col", d.customClass])
|
|
1153
|
+
}, [
|
|
1154
|
+
U(qe, {
|
|
1155
|
+
nodes: d.children || [],
|
|
1156
|
+
"column-node": d,
|
|
1157
|
+
"grid-node": e.node,
|
|
1158
|
+
"has-field-suffix-slot": e.hasFieldSuffixSlot
|
|
1159
|
+
}, {
|
|
1160
|
+
"field-suffix": C((c) => [
|
|
1161
|
+
Q(a.$slots, "field-suffix", oe(ie(c)), void 0, !0)
|
|
1162
|
+
]),
|
|
1163
|
+
_: 2
|
|
1164
|
+
}, 1032, ["nodes", "column-node", "grid-node", "has-field-suffix-slot"])
|
|
1165
|
+
], 2)
|
|
1166
|
+
]),
|
|
1167
|
+
_: 2
|
|
1168
|
+
}, 1032, ["span"]))), 128))
|
|
1169
|
+
]),
|
|
1170
|
+
_: 3
|
|
1171
|
+
}, 8, ["gutter"])
|
|
1172
|
+
], 2);
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
}, Gt = /* @__PURE__ */ D(Kt, [["__scopeId", "data-v-df3469b9"]]), Zt = {
|
|
1176
|
+
__name: "SchemaNodeRenderer",
|
|
1177
|
+
props: {
|
|
1178
|
+
/** 待渲染节点列表 */
|
|
1179
|
+
nodes: { type: Array, default: () => [] },
|
|
1180
|
+
/** 所在 grid column(非 grid 内时为 null)—— 透传给 FieldRenderer */
|
|
1181
|
+
columnNode: { type: Object, default: null },
|
|
1182
|
+
/** 所在 grid(非 grid 内时为 null)—— 透传给 FieldRenderer */
|
|
1183
|
+
gridNode: { type: Object, default: null },
|
|
1184
|
+
/** Runtime 调用方是否提供了右侧扩展插槽 */
|
|
1185
|
+
hasFieldSuffixSlot: { type: Boolean, default: !1 }
|
|
1186
|
+
},
|
|
1187
|
+
setup(e) {
|
|
1188
|
+
return (a, t) => (V(!0), R(Y, null, H(e.nodes, (l) => (V(), R(Y, {
|
|
1189
|
+
key: l.id
|
|
1190
|
+
}, [
|
|
1191
|
+
l.nodeType === "field" ? (V(), $(Ht, {
|
|
1192
|
+
key: 0,
|
|
1193
|
+
node: l,
|
|
1194
|
+
"column-node": e.columnNode,
|
|
1195
|
+
"grid-node": e.gridNode,
|
|
1196
|
+
"has-field-suffix-slot": e.hasFieldSuffixSlot
|
|
1197
|
+
}, {
|
|
1198
|
+
"field-suffix": C((n) => [
|
|
1199
|
+
Q(a.$slots, "field-suffix", oe(ie(n)))
|
|
1200
|
+
]),
|
|
1201
|
+
_: 2
|
|
1202
|
+
}, 1032, ["node", "column-node", "grid-node", "has-field-suffix-slot"])) : l.nodeType === "title" ? (V(), $(Wt, {
|
|
1203
|
+
key: 1,
|
|
1204
|
+
node: l
|
|
1205
|
+
}, null, 8, ["node"])) : l.nodeType === "grid" ? (V(), $(Gt, {
|
|
1206
|
+
key: 2,
|
|
1207
|
+
node: l,
|
|
1208
|
+
"has-field-suffix-slot": e.hasFieldSuffixSlot
|
|
1209
|
+
}, {
|
|
1210
|
+
"field-suffix": C((n) => [
|
|
1211
|
+
Q(a.$slots, "field-suffix", oe(ie(n)))
|
|
1212
|
+
]),
|
|
1213
|
+
_: 2
|
|
1214
|
+
}, 1032, ["node", "has-field-suffix-slot"])) : L("", !0)
|
|
1215
|
+
], 64))), 128));
|
|
1216
|
+
}
|
|
1217
|
+
}, qe = Zt;
|
|
1218
|
+
function Qt(e) {
|
|
1219
|
+
const a = e.trigger || "blur", t = e.message || "格式不正确";
|
|
1220
|
+
switch (e.type) {
|
|
1221
|
+
case "pattern":
|
|
1222
|
+
try {
|
|
1223
|
+
return { pattern: new RegExp(e.value), message: t, trigger: a };
|
|
1224
|
+
} catch {
|
|
1225
|
+
return console.warn("[JXYRuntime] 无效的正则:", e.value), null;
|
|
1226
|
+
}
|
|
1227
|
+
case "minLength":
|
|
1228
|
+
return { min: Number(e.value), message: t, trigger: a };
|
|
1229
|
+
case "maxLength":
|
|
1230
|
+
return { max: Number(e.value), message: t, trigger: a };
|
|
1231
|
+
case "min":
|
|
1232
|
+
return {
|
|
1233
|
+
validator: (l, n, d) => {
|
|
1234
|
+
if (n === "" || n === null || n === void 0)
|
|
1235
|
+
return d();
|
|
1236
|
+
if (Number(n) < Number(e.value))
|
|
1237
|
+
return d(new Error(t));
|
|
1238
|
+
d();
|
|
1239
|
+
},
|
|
1240
|
+
trigger: a
|
|
1241
|
+
};
|
|
1242
|
+
case "max":
|
|
1243
|
+
return {
|
|
1244
|
+
validator: (l, n, d) => {
|
|
1245
|
+
if (n === "" || n === null || n === void 0)
|
|
1246
|
+
return d();
|
|
1247
|
+
if (Number(n) > Number(e.value))
|
|
1248
|
+
return d(new Error(t));
|
|
1249
|
+
d();
|
|
1250
|
+
},
|
|
1251
|
+
trigger: a
|
|
1252
|
+
};
|
|
1253
|
+
case "email":
|
|
1254
|
+
return { type: "email", message: t, trigger: a };
|
|
1255
|
+
case "url":
|
|
1256
|
+
return { type: "url", message: t, trigger: a };
|
|
1257
|
+
default:
|
|
1258
|
+
return console.warn("[JXYRuntime] 未知的 validationType:", e.type), null;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
function el(e, a) {
|
|
1262
|
+
const t = [], l = a !== void 0 ? a : e.required;
|
|
1263
|
+
if (["addressSelector", "linkedSelectList", "integerUppercase"].includes(e.type) ? t.push(tl(e, l)) : l && t.push({
|
|
1264
|
+
required: !0,
|
|
1265
|
+
message: `${e.label || e.prop || "该字段"}不能为空`,
|
|
1266
|
+
trigger: ["blur", "change"],
|
|
1267
|
+
validator: (n, d, c) => {
|
|
1268
|
+
if (K(d)) {
|
|
1269
|
+
c(new Error(`${e.label || e.prop || "该字段"}不能为空`));
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
c();
|
|
1273
|
+
}
|
|
1274
|
+
}), Array.isArray(e.validations))
|
|
1275
|
+
for (const n of e.validations) {
|
|
1276
|
+
const d = Qt(n);
|
|
1277
|
+
d && t.push(d);
|
|
1278
|
+
}
|
|
1279
|
+
return t;
|
|
1280
|
+
}
|
|
1281
|
+
function tl(e, a) {
|
|
1282
|
+
return {
|
|
1283
|
+
// Element Plus 依赖 required 元数据展示表单项 label 前的红色星号。
|
|
1284
|
+
required: a,
|
|
1285
|
+
trigger: ["blur", "change"],
|
|
1286
|
+
validator: (t, l, n) => {
|
|
1287
|
+
var o, x, A;
|
|
1288
|
+
const d = e.label || e.prop || "该字段";
|
|
1289
|
+
if (e.type === "addressSelector") {
|
|
1290
|
+
const h = l && typeof l == "object" && !Array.isArray(l) ? l : {}, S = Ce(e), p = [h[S.province], h[S.city], h[S.county], h[S.detailAddress]].every((_) => K(_));
|
|
1291
|
+
return p && !a ? n() : p ? n(new Error(`${d}不能为空`)) : K(h[S.province]) || K(h[S.city]) || K(h[S.county]) ? n(new Error(`${d}的省、市、区县必须选择完整`)) : ((o = e.props) == null ? void 0 : o.detailRequired) !== !1 && K(h[S.detailAddress]) ? n(new Error(`${d}的详细地址不能为空`)) : n();
|
|
1292
|
+
}
|
|
1293
|
+
if (e.type === "linkedSelectList") {
|
|
1294
|
+
const h = Array.isArray(l) ? l : [], S = Ie(e);
|
|
1295
|
+
if (h.length === 0 && !a)
|
|
1296
|
+
return n();
|
|
1297
|
+
if (h.length === 0)
|
|
1298
|
+
return n(new Error(`${d}不能为空`));
|
|
1299
|
+
if (h.some((s) => K(s == null ? void 0 : s[S.parentValue]) || K(s == null ? void 0 : s[S.childValue])))
|
|
1300
|
+
return n(new Error(`${d}存在未选择完整的行`));
|
|
1301
|
+
if (((x = e.props) == null ? void 0 : x.allowDuplicate) === !1) {
|
|
1302
|
+
const s = h.map((p) => `${String(p[S.parentValue])}::${String(p[S.childValue])}`);
|
|
1303
|
+
if (new Set(s).size !== s.length)
|
|
1304
|
+
return n(new Error(`${d}不能重复选择`));
|
|
1305
|
+
}
|
|
1306
|
+
return n();
|
|
1307
|
+
}
|
|
1308
|
+
if (K(l))
|
|
1309
|
+
return a ? n(new Error(`${d}不能为空`)) : n();
|
|
1310
|
+
const c = String(l), r = Math.min(Math.max(Math.trunc((A = e.props) == null ? void 0 : A.maxLength) || 1, 1), 16);
|
|
1311
|
+
if (!/^\d+$/.test(c) || c.length > r)
|
|
1312
|
+
return n(new Error(`${d}必须是 ${r} 位以内的非负整数`));
|
|
1313
|
+
n();
|
|
1314
|
+
}
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
function K(e) {
|
|
1318
|
+
return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "string" ? e.trim() === "" : !1;
|
|
1319
|
+
}
|
|
1320
|
+
function ll(e, a = /* @__PURE__ */ new Set(), t = {}) {
|
|
1321
|
+
const l = {};
|
|
1322
|
+
return Me(e.nodes || [], l, a, t), l;
|
|
1323
|
+
}
|
|
1324
|
+
function Me(e, a, t, l) {
|
|
1325
|
+
for (const n of e)
|
|
1326
|
+
if (n.nodeType === "field") {
|
|
1327
|
+
if (n.prop && !t.has(n.prop)) {
|
|
1328
|
+
const d = l[n.prop], c = d ? d.required : void 0, r = el(n, c);
|
|
1329
|
+
r.length > 0 && (a[n.prop] = r);
|
|
1330
|
+
}
|
|
1331
|
+
} else if (n.nodeType === "grid" && Array.isArray(n.columns))
|
|
1332
|
+
for (const d of n.columns)
|
|
1333
|
+
Me(d.children || [], a, t, l);
|
|
1334
|
+
}
|
|
1335
|
+
function nl({ schema: e, formData: a, fieldStates: t, provider: l, onError: n }) {
|
|
1336
|
+
function d() {
|
|
1337
|
+
return y(l);
|
|
1338
|
+
}
|
|
1339
|
+
function c(s) {
|
|
1340
|
+
var p;
|
|
1341
|
+
return !s || !((p = e.value) != null && p.dataSources) ? null : e.value.dataSources.find((_) => _.id === s) || null;
|
|
1342
|
+
}
|
|
1343
|
+
async function r(s) {
|
|
1344
|
+
var P, m;
|
|
1345
|
+
const _ = ee(e.value).find((i) => i.prop === s);
|
|
1346
|
+
if (!_ || !_.dataSourceId)
|
|
1347
|
+
return;
|
|
1348
|
+
const u = c(_.dataSourceId);
|
|
1349
|
+
if (!u)
|
|
1350
|
+
return;
|
|
1351
|
+
const w = t[s];
|
|
1352
|
+
if (w)
|
|
1353
|
+
try {
|
|
1354
|
+
if (w.loading = !0, u.type === "static")
|
|
1355
|
+
w.options = x(u.options);
|
|
1356
|
+
else if (u.type === "dict") {
|
|
1357
|
+
const i = d();
|
|
1358
|
+
if (!(i != null && i.loadDictOptions)) {
|
|
1359
|
+
w.options = [], n && n(s, new Error("未配置支持 DICT 的 dataSourceProvider"));
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
const g = ((m = (P = e.value) == null ? void 0 : P.dataSourceConfig) == null ? void 0 : m.dictUrl) || "";
|
|
1363
|
+
w.options = x(await i.loadDictOptions(u.dictType, g));
|
|
1364
|
+
} else if (u.type === "api") {
|
|
1365
|
+
const i = d();
|
|
1366
|
+
if (!(i != null && i.loadApiOptions)) {
|
|
1367
|
+
w.options = [], n && n(s, new Error("未配置支持 API 的 dataSourceProvider"));
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
const g = o(u, a);
|
|
1371
|
+
if (g === null) {
|
|
1372
|
+
w.options = [];
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
w.options = x(await i.loadApiOptions(u.url, g));
|
|
1376
|
+
}
|
|
1377
|
+
} catch (i) {
|
|
1378
|
+
console.error(`[JXYRuntime] 加载字段 ${s} 数据源失败:`, i), w.options = [], n && n(s, i);
|
|
1379
|
+
} finally {
|
|
1380
|
+
w.loading = !1;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
function o(s, p) {
|
|
1384
|
+
if (!Array.isArray(s.params) || s.params.length === 0)
|
|
1385
|
+
return {};
|
|
1386
|
+
const _ = {};
|
|
1387
|
+
for (const u of s.params) {
|
|
1388
|
+
let w;
|
|
1389
|
+
if (u.valueType === "field" ? w = p[u.field] : w = u.value, u.required && (w === "" || w === null || w === void 0))
|
|
1390
|
+
return null;
|
|
1391
|
+
_[u.key] = w;
|
|
1392
|
+
}
|
|
1393
|
+
return _;
|
|
1394
|
+
}
|
|
1395
|
+
function x(s) {
|
|
1396
|
+
if (!Array.isArray(s))
|
|
1397
|
+
return [];
|
|
1398
|
+
const p = /* @__PURE__ */ new Set(), _ = [];
|
|
1399
|
+
for (const u of s) {
|
|
1400
|
+
if (!u || u.value === void 0 || u.value === null)
|
|
1401
|
+
continue;
|
|
1402
|
+
const w = String(u.value);
|
|
1403
|
+
if (p.has(w))
|
|
1404
|
+
continue;
|
|
1405
|
+
p.add(w);
|
|
1406
|
+
const P = {
|
|
1407
|
+
...u,
|
|
1408
|
+
label: u.label ?? String(u.value),
|
|
1409
|
+
value: u.value
|
|
1410
|
+
};
|
|
1411
|
+
Array.isArray(u.children) && (P.children = x(u.children)), _.push(P);
|
|
1412
|
+
}
|
|
1413
|
+
return _;
|
|
1414
|
+
}
|
|
1415
|
+
async function A() {
|
|
1416
|
+
const s = ee(e.value), p = [];
|
|
1417
|
+
for (const _ of s)
|
|
1418
|
+
_.dataSourceId && _.prop && p.push(r(_.prop));
|
|
1419
|
+
await Promise.allSettled(p);
|
|
1420
|
+
}
|
|
1421
|
+
function h() {
|
|
1422
|
+
const s = d();
|
|
1423
|
+
s != null && s.clearDictCache && s.clearDictCache();
|
|
1424
|
+
}
|
|
1425
|
+
function S(s) {
|
|
1426
|
+
var P, m;
|
|
1427
|
+
const p = t[s];
|
|
1428
|
+
if (!p || !p.options || p.options.length === 0)
|
|
1429
|
+
return;
|
|
1430
|
+
const _ = a[s];
|
|
1431
|
+
if (_ === "" || _ === null || _ === void 0)
|
|
1432
|
+
return;
|
|
1433
|
+
const u = ee(e.value).find((i) => i.prop === s);
|
|
1434
|
+
if ((u == null ? void 0 : u.type) === "addressSelector") {
|
|
1435
|
+
const i = he(u, _), g = Ce(u), b = p.options.find((E) => E.value === i[g.province]), k = (P = b == null ? void 0 : b.children) == null ? void 0 : P.find((E) => E.value === i[g.city]), q = (m = k == null ? void 0 : k.children) == null ? void 0 : m.find((E) => E.value === i[g.county]);
|
|
1436
|
+
a[s] = {
|
|
1437
|
+
[g.province]: b ? i[g.province] : "",
|
|
1438
|
+
[g.city]: b && k ? i[g.city] : "",
|
|
1439
|
+
[g.county]: b && k && q ? i[g.county] : "",
|
|
1440
|
+
[g.detailAddress]: i[g.detailAddress] ?? ""
|
|
1441
|
+
};
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
if ((u == null ? void 0 : u.type) === "linkedSelectList") {
|
|
1445
|
+
const i = Ee(u, _), g = Ie(u);
|
|
1446
|
+
a[s] = i.map((b) => {
|
|
1447
|
+
var E;
|
|
1448
|
+
const k = p.options.find((B) => B.value === (b == null ? void 0 : b[g.parentValue])), q = (E = k == null ? void 0 : k.children) == null ? void 0 : E.find((B) => B.value === (b == null ? void 0 : b[g.childValue]));
|
|
1449
|
+
return {
|
|
1450
|
+
[g.parentValue]: k ? b[g.parentValue] : "",
|
|
1451
|
+
[g.childValue]: k && q ? b[g.childValue] : ""
|
|
1452
|
+
};
|
|
1453
|
+
});
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
if (Array.isArray(_)) {
|
|
1457
|
+
const i = new Set(p.options.map((b) => b.value)), g = _.filter((b) => i.has(b));
|
|
1458
|
+
g.length !== _.length && (a[s] = g);
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1461
|
+
p.options.some((i) => i.value === _) || (a[s] = "");
|
|
1462
|
+
}
|
|
1463
|
+
return {
|
|
1464
|
+
loadFieldOptions: r,
|
|
1465
|
+
loadAllDataSources: A,
|
|
1466
|
+
validateCurrentValue: S,
|
|
1467
|
+
findDataSource: c,
|
|
1468
|
+
buildApiParams: o,
|
|
1469
|
+
normalizeOptions: x,
|
|
1470
|
+
resetCache: h
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
const te = 3;
|
|
1474
|
+
function al({ schema: e, formData: a, fieldStates: t, dataSourceApi: l, setFieldValue: n, getFieldEmptyValue: d }) {
|
|
1475
|
+
function c(p, _) {
|
|
1476
|
+
const u = (p == null ? void 0 : p.type) || "always", w = p == null ? void 0 : p.value;
|
|
1477
|
+
switch (u) {
|
|
1478
|
+
case "always":
|
|
1479
|
+
return !0;
|
|
1480
|
+
case "eq":
|
|
1481
|
+
return String(_) === String(w);
|
|
1482
|
+
case "neq":
|
|
1483
|
+
return String(_) !== String(w);
|
|
1484
|
+
case "in":
|
|
1485
|
+
return (Array.isArray(w) ? w : String(w).split(",").map((m) => m.trim())).includes(String(_));
|
|
1486
|
+
case "notIn":
|
|
1487
|
+
return !(Array.isArray(w) ? w : String(w).split(",").map((m) => m.trim())).includes(String(_));
|
|
1488
|
+
case "empty":
|
|
1489
|
+
return r(_);
|
|
1490
|
+
case "notEmpty":
|
|
1491
|
+
return !r(_);
|
|
1492
|
+
default:
|
|
1493
|
+
return console.warn(`[JXYReaction] 未知条件类型:${u}`), !1;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
function r(p) {
|
|
1497
|
+
return p == null || p === "" ? !0 : Array.isArray(p) ? p.length === 0 : !1;
|
|
1498
|
+
}
|
|
1499
|
+
function o(p) {
|
|
1500
|
+
const _ = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
|
|
1501
|
+
for (const w of p) {
|
|
1502
|
+
const P = w.targetField;
|
|
1503
|
+
if (!P)
|
|
1504
|
+
continue;
|
|
1505
|
+
const m = t[P];
|
|
1506
|
+
if (m)
|
|
1507
|
+
switch (u.add(P), w.type) {
|
|
1508
|
+
case "clearValue":
|
|
1509
|
+
A(P, x(P)), _.add(P);
|
|
1510
|
+
break;
|
|
1511
|
+
case "setValue":
|
|
1512
|
+
A(P, w.value), _.add(P);
|
|
1513
|
+
break;
|
|
1514
|
+
case "setHidden":
|
|
1515
|
+
m.hidden = !!w.value;
|
|
1516
|
+
break;
|
|
1517
|
+
case "setDisabled":
|
|
1518
|
+
m.disabled = !!w.value;
|
|
1519
|
+
break;
|
|
1520
|
+
case "setRequired":
|
|
1521
|
+
m.required = !!w.value;
|
|
1522
|
+
break;
|
|
1523
|
+
case "reloadOptions":
|
|
1524
|
+
l != null && l.loadFieldOptions && l.loadFieldOptions(P).then(() => {
|
|
1525
|
+
l != null && l.validateCurrentValue && l.validateCurrentValue(P);
|
|
1526
|
+
});
|
|
1527
|
+
break;
|
|
1528
|
+
default:
|
|
1529
|
+
console.warn(`[JXYReaction] 未知动作类型:${w.type}`);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
return { changedProps: _, affectedProps: u };
|
|
1533
|
+
}
|
|
1534
|
+
function x(p) {
|
|
1535
|
+
if (typeof d == "function")
|
|
1536
|
+
return d(p);
|
|
1537
|
+
const _ = a[p];
|
|
1538
|
+
return Array.isArray(_) ? [] : "";
|
|
1539
|
+
}
|
|
1540
|
+
function A(p, _) {
|
|
1541
|
+
if (typeof n == "function") {
|
|
1542
|
+
n(p, _);
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
a[p] = _;
|
|
1546
|
+
}
|
|
1547
|
+
function h(p) {
|
|
1548
|
+
var m;
|
|
1549
|
+
const u = (((m = e.value) == null ? void 0 : m.reactions) || []).filter((i) => i.sourceField === p), w = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Set();
|
|
1550
|
+
for (const i of u) {
|
|
1551
|
+
const g = a[p];
|
|
1552
|
+
if (c(i.condition, g) && Array.isArray(i.effects)) {
|
|
1553
|
+
const k = o(i.effects);
|
|
1554
|
+
k.changedProps.forEach((q) => w.add(q)), k.affectedProps.forEach((q) => P.add(q));
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
return { changedProps: w, affectedProps: P };
|
|
1558
|
+
}
|
|
1559
|
+
function S(p) {
|
|
1560
|
+
let _ = /* @__PURE__ */ new Set([p]);
|
|
1561
|
+
const u = /* @__PURE__ */ new Set();
|
|
1562
|
+
let w = 0;
|
|
1563
|
+
for (; _.size > 0 && w < te; ) {
|
|
1564
|
+
w++;
|
|
1565
|
+
const P = /* @__PURE__ */ new Set();
|
|
1566
|
+
for (const m of _) {
|
|
1567
|
+
const i = h(m);
|
|
1568
|
+
i.changedProps.forEach((g) => P.add(g)), i.affectedProps.forEach((g) => u.add(g));
|
|
1569
|
+
}
|
|
1570
|
+
_ = P;
|
|
1571
|
+
}
|
|
1572
|
+
return w >= te && _.size > 0 && console.warn(
|
|
1573
|
+
`[JXYReaction] 联动评估超过 ${te} 轮仍有变化,可能存在循环依赖。涉及字段:`,
|
|
1574
|
+
[..._]
|
|
1575
|
+
), u;
|
|
1576
|
+
}
|
|
1577
|
+
function s() {
|
|
1578
|
+
var m;
|
|
1579
|
+
const p = ((m = e.value) == null ? void 0 : m.reactions) || [];
|
|
1580
|
+
if (p.length === 0)
|
|
1581
|
+
return;
|
|
1582
|
+
const _ = new Set(p.map((i) => i.sourceField).filter(Boolean));
|
|
1583
|
+
let u = /* @__PURE__ */ new Set([..._]);
|
|
1584
|
+
const w = /* @__PURE__ */ new Set();
|
|
1585
|
+
let P = 0;
|
|
1586
|
+
for (; u.size > 0 && P < te; ) {
|
|
1587
|
+
P++;
|
|
1588
|
+
const i = /* @__PURE__ */ new Set();
|
|
1589
|
+
for (const g of u) {
|
|
1590
|
+
const b = h(g);
|
|
1591
|
+
b.changedProps.forEach((k) => i.add(k)), b.affectedProps.forEach((k) => w.add(k));
|
|
1592
|
+
}
|
|
1593
|
+
u = i;
|
|
1594
|
+
}
|
|
1595
|
+
return P >= te && u.size > 0 && console.warn(
|
|
1596
|
+
`[JXYReaction] evaluateAllReactions 超过 ${te} 轮,可能存在循环依赖:`,
|
|
1597
|
+
[...u]
|
|
1598
|
+
), w;
|
|
1599
|
+
}
|
|
1600
|
+
return {
|
|
1601
|
+
evaluateCondition: c,
|
|
1602
|
+
executeEffects: o,
|
|
1603
|
+
evaluateReactions: S,
|
|
1604
|
+
evaluateAllReactions: s,
|
|
1605
|
+
evaluateForSource: h
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
const dl = Symbol("JXY_FORM_HOST_CONTEXT");
|
|
1609
|
+
const ol = {
|
|
1610
|
+
__name: "index",
|
|
1611
|
+
props: {
|
|
1612
|
+
/** 表单 schema(必填) */
|
|
1613
|
+
schema: { type: Object, required: !0 },
|
|
1614
|
+
/** v-model 表单数据 */
|
|
1615
|
+
modelValue: { type: Object, default: () => ({}) },
|
|
1616
|
+
/** 是否整体禁用 */
|
|
1617
|
+
disabled: { type: Boolean, default: !1 },
|
|
1618
|
+
/**
|
|
1619
|
+
* 可选数据源 Provider。
|
|
1620
|
+
* 不传时使用基于项目 request 的默认实现;预览/测试可注入 mock provider。
|
|
1621
|
+
* 格式:{ loadApiOptions(url, params), loadDictOptions(dictType, dictUrl), listApiSources? }
|
|
1622
|
+
*/
|
|
1623
|
+
dataSourceProvider: { type: Object, default: null },
|
|
1624
|
+
/**
|
|
1625
|
+
* 自定义组件注册表
|
|
1626
|
+
* 格式:{ [componentKey]: VueComponent }
|
|
1627
|
+
*/
|
|
1628
|
+
componentRegistry: { type: Object, default: () => ({}) }
|
|
1629
|
+
},
|
|
1630
|
+
emits: ["update:modelValue", "field-change", "data-source-error", "schema-error"],
|
|
1631
|
+
setup(e, { expose: a, emit: t }) {
|
|
1632
|
+
const l = e, n = Te(), d = F(() => !!n["field-suffix"]), c = Oe(dl, null), r = de(null), o = Se({}), x = Se({}), A = F(() => {
|
|
1633
|
+
const f = s(l.schema);
|
|
1634
|
+
return Ye(f).schema;
|
|
1635
|
+
});
|
|
1636
|
+
function h(f = {}) {
|
|
1637
|
+
var G;
|
|
1638
|
+
const { useModelValue: v = !0, emitUpdate: j = !1 } = f, O = ee(A.value), T = {};
|
|
1639
|
+
for (const z of O) {
|
|
1640
|
+
if (!z.prop)
|
|
1641
|
+
continue;
|
|
1642
|
+
const le = v ? (G = l.modelValue) == null ? void 0 : G[z.prop] : void 0, ue = le !== void 0 ? le : s(z.defaultValue);
|
|
1643
|
+
T[z.prop] = u(z, ue);
|
|
1644
|
+
}
|
|
1645
|
+
p(o, T), j && t("update:modelValue", { ...o });
|
|
1646
|
+
}
|
|
1647
|
+
function S() {
|
|
1648
|
+
const f = ee(A.value), v = {};
|
|
1649
|
+
for (const j of f)
|
|
1650
|
+
j.prop && (v[j.prop] = {
|
|
1651
|
+
hidden: j.hidden ?? !1,
|
|
1652
|
+
disabled: j.disabled ?? !1,
|
|
1653
|
+
required: j.required ?? !1,
|
|
1654
|
+
options: [],
|
|
1655
|
+
loading: !1
|
|
1656
|
+
});
|
|
1657
|
+
p(x, v);
|
|
1658
|
+
}
|
|
1659
|
+
function s(f) {
|
|
1660
|
+
if (f == null)
|
|
1661
|
+
return f;
|
|
1662
|
+
try {
|
|
1663
|
+
return JSON.parse(JSON.stringify(f));
|
|
1664
|
+
} catch {
|
|
1665
|
+
return f;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
function p(f, v) {
|
|
1669
|
+
Object.keys(f).forEach((j) => delete f[j]), Object.assign(f, v);
|
|
1670
|
+
}
|
|
1671
|
+
function _(f) {
|
|
1672
|
+
return ee(A.value).find((v) => v.prop === f);
|
|
1673
|
+
}
|
|
1674
|
+
function u(f, v) {
|
|
1675
|
+
var j, O;
|
|
1676
|
+
if (!f)
|
|
1677
|
+
return v;
|
|
1678
|
+
if (["number", "floatNum"].includes(f.type)) {
|
|
1679
|
+
if (v === "" || v === void 0 || v === null)
|
|
1680
|
+
return null;
|
|
1681
|
+
const T = Number(v);
|
|
1682
|
+
return Number.isFinite(T) ? T : null;
|
|
1683
|
+
}
|
|
1684
|
+
if (f.type === "addressSelector")
|
|
1685
|
+
return he(f, v);
|
|
1686
|
+
if (f.type === "integerUppercase") {
|
|
1687
|
+
if (v == null)
|
|
1688
|
+
return "";
|
|
1689
|
+
const T = Math.min(Math.max(Math.trunc((j = f.props) == null ? void 0 : j.maxLength) || 1, 1), 16);
|
|
1690
|
+
return String(v).replace(/\D/g, "").replace(/^0+(?=\d)/, "").slice(0, T);
|
|
1691
|
+
}
|
|
1692
|
+
return f.type === "linkedSelectList" ? Ee(f, v) : f.type === "select" ? (O = f.props) != null && O.multiple ? Array.isArray(v) ? v : v === "" || v === void 0 || v === null ? [] : [v] : Array.isArray(v) ? "" : v ?? "" : ["checkBox", "file", "dragFile", "imgFile", "daterange", "datetimerange"].includes(f.type) ? Array.isArray(v) ? v : [] : f.type === "cascader" ? Array.isArray(v) ? v : [] : v ?? "";
|
|
1693
|
+
}
|
|
1694
|
+
function w(f, v) {
|
|
1695
|
+
const j = _(f);
|
|
1696
|
+
j && (o[f] = u(j, v));
|
|
1697
|
+
}
|
|
1698
|
+
function P(f) {
|
|
1699
|
+
var j;
|
|
1700
|
+
const v = _(f);
|
|
1701
|
+
return v ? ["number", "floatNum"].includes(v.type) ? null : v.type === "addressSelector" ? he(v, {}) : v.type === "linkedSelectList" ? [] : v.type === "select" && ((j = v.props) != null && j.multiple) ? [] : ["checkBox", "cascader", "file", "dragFile", "imgFile", "daterange", "datetimerange"].includes(v.type) ? [] : "" : "";
|
|
1702
|
+
}
|
|
1703
|
+
function m() {
|
|
1704
|
+
t("update:modelValue", { ...o });
|
|
1705
|
+
}
|
|
1706
|
+
async function i(f) {
|
|
1707
|
+
var O, T;
|
|
1708
|
+
if (await ne(), !f) {
|
|
1709
|
+
(O = r.value) == null || O.clearValidate();
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
const j = (Array.isArray(f) ? f : [...f]).filter(Boolean);
|
|
1713
|
+
j.length > 0 && ((T = r.value) == null || T.clearValidate(j));
|
|
1714
|
+
}
|
|
1715
|
+
const g = F(() => {
|
|
1716
|
+
const f = /* @__PURE__ */ new Set();
|
|
1717
|
+
for (const [v, j] of Object.entries(x))
|
|
1718
|
+
j.hidden && f.add(v);
|
|
1719
|
+
return f;
|
|
1720
|
+
}), b = F(() => ll(A.value, g.value, x)), k = F(() => l.dataSourceProvider || (c == null ? void 0 : c.dataSourceProvider) || null), q = F(() => (c == null ? void 0 : c.components) || {});
|
|
1721
|
+
function E(f) {
|
|
1722
|
+
t("schema-error", f);
|
|
1723
|
+
}
|
|
1724
|
+
const B = nl({
|
|
1725
|
+
schema: A,
|
|
1726
|
+
formData: o,
|
|
1727
|
+
fieldStates: x,
|
|
1728
|
+
provider: k,
|
|
1729
|
+
onError: (f, v) => t("data-source-error", { prop: f, error: v })
|
|
1730
|
+
}), M = al({
|
|
1731
|
+
schema: A,
|
|
1732
|
+
formData: o,
|
|
1733
|
+
fieldStates: x,
|
|
1734
|
+
dataSourceApi: B,
|
|
1735
|
+
setFieldValue: w,
|
|
1736
|
+
getFieldEmptyValue: P
|
|
1737
|
+
});
|
|
1738
|
+
function Ue(f, v) {
|
|
1739
|
+
const j = o[f];
|
|
1740
|
+
w(f, v);
|
|
1741
|
+
const O = M.evaluateReactions(f) || /* @__PURE__ */ new Set();
|
|
1742
|
+
m(), t("field-change", { prop: f, value: o[f], oldValue: j }), i(O);
|
|
1743
|
+
}
|
|
1744
|
+
return fe(
|
|
1745
|
+
() => l.modelValue,
|
|
1746
|
+
(f) => {
|
|
1747
|
+
if (!f)
|
|
1748
|
+
return;
|
|
1749
|
+
const v = ee(A.value), j = new Map(v.map((O) => [O.prop, O]));
|
|
1750
|
+
for (const O of Object.keys(o))
|
|
1751
|
+
j.has(O) || delete o[O];
|
|
1752
|
+
for (const [O, T] of Object.entries(f)) {
|
|
1753
|
+
const G = j.get(O);
|
|
1754
|
+
if (!G)
|
|
1755
|
+
continue;
|
|
1756
|
+
const z = u(G, T);
|
|
1757
|
+
o[O] !== z && (o[O] = z);
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
{ deep: !0 }
|
|
1761
|
+
), fe(
|
|
1762
|
+
[A, () => l.dataSourceProvider],
|
|
1763
|
+
async () => {
|
|
1764
|
+
B.resetCache(), h({ useModelValue: !0, emitUpdate: !0 }), S(), await ne(), await B.loadAllDataSources();
|
|
1765
|
+
const f = M.evaluateAllReactions() || /* @__PURE__ */ new Set();
|
|
1766
|
+
m(), i(f);
|
|
1767
|
+
},
|
|
1768
|
+
{ deep: !1 }
|
|
1769
|
+
), $e("jxyRuntime", {
|
|
1770
|
+
formData: o,
|
|
1771
|
+
fieldStates: x,
|
|
1772
|
+
schema: A,
|
|
1773
|
+
disabled: we(l, "disabled"),
|
|
1774
|
+
componentRegistry: we(l, "componentRegistry"),
|
|
1775
|
+
hostComponents: q,
|
|
1776
|
+
reportSchemaError: E,
|
|
1777
|
+
onFieldChange: Ue
|
|
1778
|
+
}), ge(async () => {
|
|
1779
|
+
h({ useModelValue: !0, emitUpdate: !0 }), S(), await ne(), await B.loadAllDataSources();
|
|
1780
|
+
const f = M.evaluateAllReactions() || /* @__PURE__ */ new Set();
|
|
1781
|
+
m(), i(f);
|
|
1782
|
+
}), a({
|
|
1783
|
+
/**
|
|
1784
|
+
* 触发表单校验
|
|
1785
|
+
* @returns {Promise<boolean>}
|
|
1786
|
+
*/
|
|
1787
|
+
validate() {
|
|
1788
|
+
var f;
|
|
1789
|
+
return (f = r.value) == null ? void 0 : f.validate();
|
|
1790
|
+
},
|
|
1791
|
+
/**
|
|
1792
|
+
* 获取当前表单数据(深拷贝)
|
|
1793
|
+
* @returns {object}
|
|
1794
|
+
*/
|
|
1795
|
+
getData() {
|
|
1796
|
+
return s({ ...o });
|
|
1797
|
+
},
|
|
1798
|
+
/**
|
|
1799
|
+
* 设置表单数据(合并模式),之后触发完整联动评估
|
|
1800
|
+
* @param {object} data
|
|
1801
|
+
*/
|
|
1802
|
+
async setData(f) {
|
|
1803
|
+
if (!f || typeof f != "object")
|
|
1804
|
+
return;
|
|
1805
|
+
const v = /* @__PURE__ */ new Set();
|
|
1806
|
+
for (const [O, T] of Object.entries(f))
|
|
1807
|
+
_(O) && (w(O, T), v.add(O));
|
|
1808
|
+
await ne(), (M.evaluateAllReactions() || /* @__PURE__ */ new Set()).forEach((O) => v.add(O)), m(), await i(v);
|
|
1809
|
+
},
|
|
1810
|
+
/**
|
|
1811
|
+
* 重置表单到 schema 默认值
|
|
1812
|
+
*/
|
|
1813
|
+
async resetFields() {
|
|
1814
|
+
h({ useModelValue: !1, emitUpdate: !0 }), S(), await ne(), await B.loadAllDataSources(), M.evaluateAllReactions(), m(), await i();
|
|
1815
|
+
},
|
|
1816
|
+
/**
|
|
1817
|
+
* 清空指定字段(或全部)的校验状态
|
|
1818
|
+
* @param {string|string[]} [props]
|
|
1819
|
+
*/
|
|
1820
|
+
clearValidate(f) {
|
|
1821
|
+
var v;
|
|
1822
|
+
(v = r.value) == null || v.clearValidate(f);
|
|
1823
|
+
},
|
|
1824
|
+
/**
|
|
1825
|
+
* 手动重新加载某字段的数据源选项
|
|
1826
|
+
* @param {string} prop
|
|
1827
|
+
*/
|
|
1828
|
+
async reloadOptions(f) {
|
|
1829
|
+
await B.loadFieldOptions(f), B.validateCurrentValue(f);
|
|
1830
|
+
},
|
|
1831
|
+
/**
|
|
1832
|
+
* 获取字段当前选项(Phase 4 实现)
|
|
1833
|
+
* @param {string} prop
|
|
1834
|
+
* @returns {Array}
|
|
1835
|
+
*/
|
|
1836
|
+
getOptions(f) {
|
|
1837
|
+
var v;
|
|
1838
|
+
return ((v = x[f]) == null ? void 0 : v.options) || [];
|
|
1839
|
+
}
|
|
1840
|
+
}), (f, v) => {
|
|
1841
|
+
var O, T, G, z, le, ue, ve, be, Ve, xe;
|
|
1842
|
+
const j = I("el-form");
|
|
1843
|
+
return V(), R("div", {
|
|
1844
|
+
class: N(["jxy-form-runtime", (T = (O = y(A)) == null ? void 0 : O.config) == null ? void 0 : T.customClass])
|
|
1845
|
+
}, [
|
|
1846
|
+
U(j, {
|
|
1847
|
+
ref_key: "formRef",
|
|
1848
|
+
ref: r,
|
|
1849
|
+
model: o,
|
|
1850
|
+
rules: y(b),
|
|
1851
|
+
"label-position": ((z = (G = y(A)) == null ? void 0 : G.config) == null ? void 0 : z.labelPosition) || "right",
|
|
1852
|
+
"label-width": (ue = (le = y(A)) == null ? void 0 : le.config) != null && ue.labelWidth ? y(A).config.labelWidth + "px" : "120px",
|
|
1853
|
+
size: ((be = (ve = y(A)) == null ? void 0 : ve.config) == null ? void 0 : be.size) || "default",
|
|
1854
|
+
disabled: e.disabled || ((xe = (Ve = y(A)) == null ? void 0 : Ve.config) == null ? void 0 : xe.disabled),
|
|
1855
|
+
"validate-on-rule-change": !1,
|
|
1856
|
+
class: "jxy-runtime-form"
|
|
1857
|
+
}, {
|
|
1858
|
+
default: C(() => {
|
|
1859
|
+
var _e;
|
|
1860
|
+
return [
|
|
1861
|
+
U(qe, {
|
|
1862
|
+
nodes: ((_e = y(A)) == null ? void 0 : _e.nodes) || [],
|
|
1863
|
+
"has-field-suffix-slot": y(d)
|
|
1864
|
+
}, {
|
|
1865
|
+
"field-suffix": C((Be) => [
|
|
1866
|
+
Q(f.$slots, "field-suffix", oe(ie(Be)), void 0, !0)
|
|
1867
|
+
]),
|
|
1868
|
+
_: 3
|
|
1869
|
+
}, 8, ["nodes", "has-field-suffix-slot"])
|
|
1870
|
+
];
|
|
1871
|
+
}),
|
|
1872
|
+
_: 3
|
|
1873
|
+
}, 8, ["model", "rules", "label-position", "label-width", "size", "disabled"])
|
|
1874
|
+
], 2);
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
}, il = /* @__PURE__ */ D(ol, [["__scopeId", "data-v-c8c6eb87"]]);
|
|
1878
|
+
const rl = { class: "runtime-preview-form" }, sl = {
|
|
1879
|
+
key: 0,
|
|
1880
|
+
class: "runtime-preview-side"
|
|
1881
|
+
}, ul = { class: "runtime-preview-actions" }, cl = {
|
|
1882
|
+
key: 0,
|
|
1883
|
+
class: "runtime-preview-data"
|
|
1884
|
+
}, fl = {
|
|
1885
|
+
__name: "RuntimePreviewPanel",
|
|
1886
|
+
props: {
|
|
1887
|
+
schema: { type: Object, required: !0 },
|
|
1888
|
+
dataSourceProvider: { type: Object, default: null },
|
|
1889
|
+
disabled: { type: Boolean, default: !1 },
|
|
1890
|
+
componentRegistry: { type: Object, default: () => ({}) },
|
|
1891
|
+
showActions: { type: Boolean, default: !0 },
|
|
1892
|
+
layout: { type: String, default: "default" }
|
|
1893
|
+
},
|
|
1894
|
+
setup(e, { expose: a }) {
|
|
1895
|
+
const t = e, l = de(null), n = de({}), d = de(!1);
|
|
1896
|
+
fe(
|
|
1897
|
+
() => t.schema,
|
|
1898
|
+
() => {
|
|
1899
|
+
n.value = {}, d.value = !1;
|
|
1900
|
+
},
|
|
1901
|
+
{ deep: !1 }
|
|
1902
|
+
);
|
|
1903
|
+
async function c() {
|
|
1904
|
+
var o;
|
|
1905
|
+
try {
|
|
1906
|
+
await ((o = l.value) == null ? void 0 : o.validate()), Fe.success("校验通过");
|
|
1907
|
+
} catch {
|
|
1908
|
+
Fe.error("校验未通过,请检查表单");
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
async function r() {
|
|
1912
|
+
var o, x, A;
|
|
1913
|
+
await ((o = l.value) == null ? void 0 : o.resetFields()), n.value = ((A = (x = l.value) == null ? void 0 : x.getData) == null ? void 0 : A.call(x)) || {}, d.value = !1;
|
|
1914
|
+
}
|
|
1915
|
+
return a({
|
|
1916
|
+
validate: () => {
|
|
1917
|
+
var o;
|
|
1918
|
+
return (o = l.value) == null ? void 0 : o.validate();
|
|
1919
|
+
},
|
|
1920
|
+
resetFields: () => {
|
|
1921
|
+
var o;
|
|
1922
|
+
return (o = l.value) == null ? void 0 : o.resetFields();
|
|
1923
|
+
},
|
|
1924
|
+
getData: () => {
|
|
1925
|
+
var o, x;
|
|
1926
|
+
return (x = (o = l.value) == null ? void 0 : o.getData) == null ? void 0 : x.call(o);
|
|
1927
|
+
}
|
|
1928
|
+
}), (o, x) => {
|
|
1929
|
+
const A = I("el-divider"), h = I("el-button");
|
|
1930
|
+
return V(), R("div", {
|
|
1931
|
+
class: N(["jxy-runtime-preview-panel", { "is-dialog-layout": e.layout === "dialog" }])
|
|
1932
|
+
}, [
|
|
1933
|
+
Z("div", rl, [
|
|
1934
|
+
U(il, {
|
|
1935
|
+
ref_key: "runtimeRef",
|
|
1936
|
+
ref: l,
|
|
1937
|
+
modelValue: n.value,
|
|
1938
|
+
"onUpdate:modelValue": x[0] || (x[0] = (S) => n.value = S),
|
|
1939
|
+
schema: e.schema,
|
|
1940
|
+
disabled: e.disabled,
|
|
1941
|
+
"data-source-provider": e.dataSourceProvider,
|
|
1942
|
+
"component-registry": e.componentRegistry
|
|
1943
|
+
}, Ne({ _: 2 }, [
|
|
1944
|
+
o.$slots["field-suffix"] ? {
|
|
1945
|
+
name: "field-suffix",
|
|
1946
|
+
fn: C((S) => [
|
|
1947
|
+
Q(o.$slots, "field-suffix", oe(ie(S)), void 0, !0)
|
|
1948
|
+
]),
|
|
1949
|
+
key: "0"
|
|
1950
|
+
} : void 0
|
|
1951
|
+
]), 1032, ["modelValue", "schema", "disabled", "data-source-provider", "component-registry"])
|
|
1952
|
+
]),
|
|
1953
|
+
e.showActions ? (V(), R("div", sl, [
|
|
1954
|
+
U(A, { class: "runtime-preview-divider" }),
|
|
1955
|
+
Z("div", ul, [
|
|
1956
|
+
U(h, { onClick: c }, {
|
|
1957
|
+
default: C(() => [
|
|
1958
|
+
X("校验表单")
|
|
1959
|
+
]),
|
|
1960
|
+
_: 1
|
|
1961
|
+
}),
|
|
1962
|
+
U(h, { onClick: r }, {
|
|
1963
|
+
default: C(() => [
|
|
1964
|
+
X("重置")
|
|
1965
|
+
]),
|
|
1966
|
+
_: 1
|
|
1967
|
+
}),
|
|
1968
|
+
U(h, {
|
|
1969
|
+
type: "primary",
|
|
1970
|
+
onClick: x[1] || (x[1] = (S) => d.value = !d.value)
|
|
1971
|
+
}, {
|
|
1972
|
+
default: C(() => [
|
|
1973
|
+
X(W(d.value ? "隐藏数据" : "查看数据"), 1)
|
|
1974
|
+
]),
|
|
1975
|
+
_: 1
|
|
1976
|
+
}),
|
|
1977
|
+
Q(o.$slots, "preview-actions", {}, void 0, !0)
|
|
1978
|
+
]),
|
|
1979
|
+
d.value ? (V(), R("pre", cl, W(JSON.stringify(n.value, null, 2)), 1)) : L("", !0)
|
|
1980
|
+
])) : L("", !0)
|
|
1981
|
+
], 2);
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
}, gl = /* @__PURE__ */ D(fl, [["__scopeId", "data-v-1eae2f9c"]]);
|
|
1985
|
+
export {
|
|
1986
|
+
dl as J,
|
|
1987
|
+
D as _,
|
|
1988
|
+
il as a,
|
|
1989
|
+
gl as b,
|
|
1990
|
+
He as r
|
|
1991
|
+
};
|