vft 0.0.500 → 0.0.501
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/es/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/es/components/autocomplete/index.d.ts +6 -6
- package/es/components/button/index.d.ts +9 -9
- package/es/components/image-viewer/image-viewer.vue.d.ts +2 -0
- package/es/components/image-viewer/image-viewer.vue2.js +89 -85
- package/es/components/image-viewer/index.d.ts +18 -0
- package/es/components/popconfirm/index.d.ts +15 -15
- package/es/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/es/components/select/index.d.ts +4 -4
- package/es/components/select/select.vue.d.ts +4 -4
- package/es/components/select/useSelect.d.ts +4 -4
- package/es/components/super-form/super-form-item.vue2.js +313 -294
- package/es/components/table/field.js +32 -33
- package/es/components/tree-select/select.js +24 -24
- package/es/components/tree-select/tree-select-option.js +18 -7
- package/es/components/tree-select/tree-select.vue2.js +28 -26
- package/es/components/tree-select/tree.js +27 -26
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/lib/components/autocomplete/index.d.ts +6 -6
- package/lib/components/button/index.d.ts +9 -9
- package/lib/components/image-viewer/image-viewer.vue.d.ts +2 -0
- package/lib/components/image-viewer/image-viewer.vue2.cjs +1 -1
- package/lib/components/image-viewer/index.d.ts +18 -0
- package/lib/components/popconfirm/index.d.ts +15 -15
- package/lib/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/lib/components/select/index.d.ts +4 -4
- package/lib/components/select/select.vue.d.ts +4 -4
- package/lib/components/select/useSelect.d.ts +4 -4
- package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
- package/lib/components/table/field.cjs +1 -1
- package/lib/components/tree-select/select.cjs +1 -1
- package/lib/components/tree-select/tree-select-option.cjs +1 -1
- package/lib/components/tree-select/tree-select.vue2.cjs +1 -1
- package/lib/components/tree-select/tree.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +5 -5
- package/theme-style/index.css +1 -1
- package/theme-style/src/tree-select.scss +8 -0
- package/theme-style/vft-tree-select.css +1 -1
- package/web-types.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as me, ref as
|
|
1
|
+
import { defineComponent as me, ref as G, computed as H, watch as J, onMounted as Pe, nextTick as O, unref as d, useSlots as ke, createVNode as f, mergeProps as U, withDirectives as Ce, vShow as Se, isVNode as ve, createTextVNode as ie, resolveComponent as X } from "vue";
|
|
2
2
|
import "../alert/index.js";
|
|
3
3
|
import "../avatar/index.js";
|
|
4
4
|
import "../avatar-stack/index.js";
|
|
@@ -18,14 +18,14 @@ import "../collapse-transition/index.js";
|
|
|
18
18
|
import "../color-picker/index.js";
|
|
19
19
|
import "../config-provider/index.js";
|
|
20
20
|
import "../container/index.js";
|
|
21
|
-
import { isBoolean as
|
|
21
|
+
import { isBoolean as Z, isFunction as k, singleAttrToObj as ae, isNullOrUndefined as xe, isArray as _, cloneDeep as Ae, isNull as Re, upperFirst as we, isString as Me } from "@vft/utils";
|
|
22
22
|
import "../context-menu/context-menu.vue2.js";
|
|
23
|
-
import { VftIcon as
|
|
23
|
+
import { VftIcon as le } from "../icon/index.js";
|
|
24
24
|
import "../date-picker/index.js";
|
|
25
25
|
import "../date-time-select/index.js";
|
|
26
26
|
import "../descriptions/index.js";
|
|
27
27
|
import "../dialog/index.js";
|
|
28
|
-
import { VftDivider as
|
|
28
|
+
import { VftDivider as Ie } from "../divider/index.js";
|
|
29
29
|
import "../drawer/index.js";
|
|
30
30
|
import "../dropdown/index.js";
|
|
31
31
|
import "../empty/index.js";
|
|
@@ -70,7 +70,7 @@ import "../table/index.js";
|
|
|
70
70
|
import "../tabs/index.js";
|
|
71
71
|
import "../tag/index.js";
|
|
72
72
|
import "../time-picker/index.js";
|
|
73
|
-
import { VftTooltip as
|
|
73
|
+
import { VftTooltip as De } from "../tooltip/index.js";
|
|
74
74
|
import "../tree/index.js";
|
|
75
75
|
import "../tree-select/index.js";
|
|
76
76
|
import "../verify-code/index.js";
|
|
@@ -100,21 +100,21 @@ import "../md-container/index.js";
|
|
|
100
100
|
import "../md-tabs/index.js";
|
|
101
101
|
import "../md-vue-playground/index.js";
|
|
102
102
|
import "../infinite-scroll/index.js";
|
|
103
|
-
import { FormCompEnum as t, getComponent as
|
|
103
|
+
import { FormCompEnum as t, getComponent as se } from "../../utils/form-register.js";
|
|
104
104
|
import "@vueuse/core";
|
|
105
105
|
import "../config-provider/hooks/use-global-config.js";
|
|
106
|
-
import { debounce as
|
|
107
|
-
import { useNamespace as
|
|
106
|
+
import { debounce as qe } from "lodash-es";
|
|
107
|
+
import { useNamespace as Ke } from "../../hooks/use-namespace/index.js";
|
|
108
108
|
import "../../hooks/use-model-toggle/index.js";
|
|
109
109
|
import "@popperjs/core";
|
|
110
110
|
import "../../hooks/use-z-index/index.js";
|
|
111
111
|
import "../message/index.js";
|
|
112
112
|
import "../progress-i/index.js";
|
|
113
113
|
import "./index.js";
|
|
114
|
-
import { isRangePicker as
|
|
114
|
+
import { isRangePicker as Fe, isInput as Le, isDatePicker as Ve } from "./component-map.js";
|
|
115
115
|
import { createPlaceholderMessage as ce } from "./use/helper.js";
|
|
116
|
-
function
|
|
117
|
-
return typeof
|
|
116
|
+
function ee(e) {
|
|
117
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !ve(e);
|
|
118
118
|
}
|
|
119
119
|
const je = me({
|
|
120
120
|
inheritAttrs: !1
|
|
@@ -130,64 +130,75 @@ const je = me({
|
|
|
130
130
|
updateSchema: {},
|
|
131
131
|
formActionType: {}
|
|
132
132
|
},
|
|
133
|
-
setup(
|
|
134
|
-
const q =
|
|
133
|
+
setup(e) {
|
|
134
|
+
const q = Ke("super-form"), F = G(), P = H(() => {
|
|
135
135
|
const {
|
|
136
|
-
mergeDynamicData:
|
|
137
|
-
} =
|
|
136
|
+
mergeDynamicData: r
|
|
137
|
+
} = e.formProps;
|
|
138
138
|
return {
|
|
139
|
-
field:
|
|
140
|
-
model:
|
|
139
|
+
field: e.schema.field,
|
|
140
|
+
model: e.formModel,
|
|
141
141
|
values: {
|
|
142
|
-
...
|
|
143
|
-
...
|
|
144
|
-
...
|
|
142
|
+
...r,
|
|
143
|
+
...e.allDefaultValues,
|
|
144
|
+
...e.formModel
|
|
145
145
|
},
|
|
146
|
-
schema:
|
|
147
|
-
elRef:
|
|
148
|
-
formActionType:
|
|
146
|
+
schema: e.schema,
|
|
147
|
+
elRef: F,
|
|
148
|
+
formActionType: e.formActionType
|
|
149
149
|
};
|
|
150
|
-
}),
|
|
150
|
+
}), fe = /* @__PURE__ */ new Set([t.Select, t.Radio, t.Checkbox, t.RadioButton, t.CheckboxButton, t.Cascader, t.AutoComplete]), L = /* @__PURE__ */ new Set([t.Select, t.Radio, t.RadioButton, t.Checkbox, t.CheckboxButton, t.Cascader, t.AutoComplete]), z = /* @__PURE__ */ new Set([t.Tree, t.TreeSelect]), Y = () => e.schema.type && fe.has(e.schema.type) ? {
|
|
151
151
|
options: []
|
|
152
|
-
} : {},
|
|
153
|
-
async function
|
|
152
|
+
} : {}, p = G(Y());
|
|
153
|
+
async function ue() {
|
|
154
154
|
const {
|
|
155
|
-
componentProps:
|
|
156
|
-
} =
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
|
|
155
|
+
componentProps: r = {}
|
|
156
|
+
} = e.schema;
|
|
157
|
+
if (k(r)) {
|
|
158
|
+
const o = Y();
|
|
159
|
+
p.value = o;
|
|
160
160
|
try {
|
|
161
|
-
const i =
|
|
162
|
-
schema:
|
|
163
|
-
formModel:
|
|
164
|
-
formActionType:
|
|
165
|
-
}), n = i instanceof Promise ? await i : i,
|
|
166
|
-
...
|
|
161
|
+
const i = r({
|
|
162
|
+
schema: e.schema,
|
|
163
|
+
formModel: e.formModel,
|
|
164
|
+
formActionType: e.formActionType
|
|
165
|
+
}), n = i instanceof Promise ? await i : i, a = {
|
|
166
|
+
...o,
|
|
167
167
|
...n ?? {}
|
|
168
168
|
};
|
|
169
|
-
L.has(
|
|
169
|
+
L.has(e.schema.type) && (!a.options || !Array.isArray(a.options)) && (a.options = []), p.value = a;
|
|
170
170
|
} catch (i) {
|
|
171
|
-
console.error("componentProps 执行错误:", i),
|
|
171
|
+
console.error("componentProps 执行错误:", i), p.value = Y();
|
|
172
172
|
}
|
|
173
173
|
} else
|
|
174
|
-
|
|
174
|
+
p.value = r, L.has(e.schema.type) && (!p.value.options || !Array.isArray(p.value.options)) && (p.value.options = []);
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
J(() => e.schema.componentProps, (r, o) => (r || o) && ue(), {
|
|
177
177
|
immediate: !0
|
|
178
|
-
}),
|
|
179
|
-
if (
|
|
180
|
-
const
|
|
181
|
-
|
|
178
|
+
}), Pe(() => {
|
|
179
|
+
if (e.schema.type === t.Tree) {
|
|
180
|
+
const r = e.formModel[e.schema.field], o = p.value, i = o?.defaultCheckedKeys, n = o?.includeHalfChecked;
|
|
181
|
+
i && Array.isArray(i) && i.length > 0 && (!r || !Array.isArray(r) || r.length === 0) && (n ? O(() => {
|
|
182
|
+
if (F.value) {
|
|
183
|
+
const a = F.value;
|
|
184
|
+
if (a?.getHalfCheckedKeys) {
|
|
185
|
+
const u = [...a.getHalfCheckedKeys() || [], ...i];
|
|
186
|
+
e.setFormModel(e.schema.field, u, e.schema);
|
|
187
|
+
const C = Symbol.for(`${e.schema.field}_checkedKeys`);
|
|
188
|
+
e.formModel[C] = [...i];
|
|
189
|
+
} else
|
|
190
|
+
e.setFormModel(e.schema.field, [...i], e.schema);
|
|
191
|
+
}
|
|
192
|
+
}) : e.setFormModel(e.schema.field, [...i], e.schema));
|
|
182
193
|
}
|
|
183
194
|
});
|
|
184
|
-
let
|
|
185
|
-
const
|
|
195
|
+
let A = null;
|
|
196
|
+
const N = G(!1), $ = async (r, o) => {
|
|
186
197
|
try {
|
|
187
198
|
const i = {
|
|
188
|
-
...
|
|
189
|
-
}, n = L.has(
|
|
190
|
-
|
|
199
|
+
...p.value
|
|
200
|
+
}, n = L.has(e.schema.type);
|
|
201
|
+
p.value = {
|
|
191
202
|
...i,
|
|
192
203
|
loading: !0,
|
|
193
204
|
// 清空 options,避免显示旧数据,确保是数组类型
|
|
@@ -195,96 +206,101 @@ const je = me({
|
|
|
195
206
|
options: []
|
|
196
207
|
} : {}
|
|
197
208
|
};
|
|
198
|
-
const
|
|
199
|
-
type:
|
|
200
|
-
} =
|
|
201
|
-
n ?
|
|
209
|
+
const a = await r(d(P)), {
|
|
210
|
+
type: m
|
|
211
|
+
} = e.schema, u = n ? Array.isArray(a) ? a : [] : a;
|
|
212
|
+
n ? p.value = {
|
|
202
213
|
...i,
|
|
203
|
-
options:
|
|
204
|
-
requestResult:
|
|
214
|
+
options: u,
|
|
215
|
+
requestResult: a,
|
|
205
216
|
loading: !1
|
|
206
|
-
} :
|
|
217
|
+
} : z.has(m) ? p.value = {
|
|
207
218
|
...i,
|
|
208
|
-
data: Array.isArray(
|
|
209
|
-
requestResult:
|
|
219
|
+
data: Array.isArray(a) ? a : a || [],
|
|
220
|
+
requestResult: a,
|
|
210
221
|
loading: !1
|
|
211
|
-
} :
|
|
222
|
+
} : p.value = {
|
|
212
223
|
...i,
|
|
213
|
-
requestResult:
|
|
224
|
+
requestResult: a,
|
|
214
225
|
loading: !1
|
|
215
|
-
},
|
|
226
|
+
}, o && await o(a, d(P));
|
|
216
227
|
} catch (i) {
|
|
217
228
|
console.error("fetchRemoteData 执行错误:", i);
|
|
218
|
-
const n = L.has(
|
|
219
|
-
|
|
220
|
-
...
|
|
229
|
+
const n = L.has(e.schema.type), a = z.has(e.schema.type);
|
|
230
|
+
p.value = {
|
|
231
|
+
...p.value,
|
|
221
232
|
loading: !1,
|
|
222
233
|
// 确保错误时 options 也是数组
|
|
223
234
|
...n ? {
|
|
224
235
|
options: []
|
|
225
236
|
} : {},
|
|
226
237
|
// 确保错误时 tree 组件的 data 也是数组
|
|
227
|
-
...
|
|
238
|
+
...a ? {
|
|
228
239
|
data: []
|
|
229
240
|
} : {}
|
|
230
241
|
};
|
|
231
242
|
} finally {
|
|
232
|
-
await
|
|
243
|
+
await O();
|
|
233
244
|
}
|
|
234
|
-
},
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
if (
|
|
238
|
-
|
|
245
|
+
}, te = () => {
|
|
246
|
+
const r = p.value?.request;
|
|
247
|
+
if (r)
|
|
248
|
+
if (k(r))
|
|
249
|
+
$(r);
|
|
239
250
|
else {
|
|
240
251
|
const {
|
|
241
|
-
watchFields:
|
|
252
|
+
watchFields: o = [],
|
|
242
253
|
options: i = {},
|
|
243
254
|
wait: n = 0,
|
|
244
|
-
callback:
|
|
245
|
-
onSuccess:
|
|
246
|
-
} =
|
|
247
|
-
if (!
|
|
248
|
-
const
|
|
249
|
-
if (i?.immediate && !
|
|
250
|
-
|
|
255
|
+
callback: a,
|
|
256
|
+
onSuccess: m
|
|
257
|
+
} = r;
|
|
258
|
+
if (!a) return;
|
|
259
|
+
const u = Array.isArray(o) && o.length > 0;
|
|
260
|
+
if (i?.immediate && !u) {
|
|
261
|
+
N.value || (N.value = !0, $(a, m));
|
|
251
262
|
return;
|
|
252
263
|
}
|
|
253
264
|
const {
|
|
254
|
-
immediate:
|
|
255
|
-
...
|
|
256
|
-
} = i, y =
|
|
257
|
-
|
|
265
|
+
immediate: C,
|
|
266
|
+
...h
|
|
267
|
+
} = i, y = o.map((s) => () => e.formModel[s]), g = n > 0 ? qe(() => {
|
|
268
|
+
$(a, m);
|
|
258
269
|
}, n) : () => {
|
|
259
|
-
|
|
270
|
+
$(a, m);
|
|
260
271
|
};
|
|
261
|
-
|
|
272
|
+
A = J(y, g, h), i?.immediate && (N.value || (N.value = !0, $(a, m)));
|
|
262
273
|
}
|
|
263
|
-
}, de =
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}) : (!
|
|
274
|
+
}, de = H(() => E());
|
|
275
|
+
J(de, (r, o) => {
|
|
276
|
+
r.isIfShow && r.isShow && (o == null || !o.isIfShow || !o.isShow) ? O(() => {
|
|
277
|
+
A && (A(), A = null), te();
|
|
278
|
+
}) : (!r.isIfShow || !r.isShow) && (N.value = !1, A && (A(), A = null));
|
|
268
279
|
}, {
|
|
269
280
|
immediate: !0
|
|
270
|
-
}),
|
|
281
|
+
}), J(() => p.value?.request, () => {
|
|
271
282
|
const {
|
|
272
|
-
isIfShow:
|
|
273
|
-
isShow:
|
|
274
|
-
} =
|
|
275
|
-
|
|
276
|
-
|
|
283
|
+
isIfShow: r,
|
|
284
|
+
isShow: o
|
|
285
|
+
} = E();
|
|
286
|
+
r && o && O(() => {
|
|
287
|
+
A && (A(), A = null), te();
|
|
277
288
|
});
|
|
278
289
|
});
|
|
279
|
-
const
|
|
280
|
-
let
|
|
281
|
-
...
|
|
290
|
+
const K = H(() => {
|
|
291
|
+
let r = {
|
|
292
|
+
...p.value
|
|
282
293
|
};
|
|
283
|
-
if (L.has(
|
|
284
|
-
const n =
|
|
285
|
-
Array.isArray(n) &&
|
|
294
|
+
if (L.has(e.schema.type) && (!r.options || !Array.isArray(r.options)) && (r.options = []), z.has(e.schema.type) && (!r.data || !Array.isArray(r.data)) && (r.data = []), e.schema.type === t.Tree) {
|
|
295
|
+
const n = e.formModel[e.schema.field];
|
|
296
|
+
if (Array.isArray(n) && r.data?.length > 0)
|
|
297
|
+
if (r.includeHalfChecked) {
|
|
298
|
+
const a = Symbol.for(`${e.schema.field}_checkedKeys`), m = e.formModel[a];
|
|
299
|
+
r.defaultCheckedKeys = Array.isArray(m) ? m : n;
|
|
300
|
+
} else
|
|
301
|
+
r.defaultCheckedKeys = n;
|
|
286
302
|
}
|
|
287
|
-
const
|
|
303
|
+
const o = /* @__PURE__ */ new Map([[t.Divider, {
|
|
288
304
|
type: "horizontal"
|
|
289
305
|
}], [t.Textarea, {
|
|
290
306
|
type: "textarea"
|
|
@@ -327,324 +343,327 @@ const je = me({
|
|
|
327
343
|
"start-placeholder": "开始月份",
|
|
328
344
|
"end-placeholder": "结束月份"
|
|
329
345
|
}]]);
|
|
330
|
-
|
|
331
|
-
const i =
|
|
332
|
-
return
|
|
333
|
-
}),
|
|
346
|
+
e.schema.type && o.has(e.schema.type) && (r = Object.assign(o.get(e.schema.type) || {}, r));
|
|
347
|
+
const i = r;
|
|
348
|
+
return e.formProps.inputMaxLength && e.schema.type === t.Input && !i?.maxlength && (i.maxlength = e.formProps.inputMaxLength), L.has(e.schema.type) && (!i.options || !Array.isArray(i.options)) && (i.options = []), z.has(e.schema.type) && (!i.data || !Array.isArray(i.data)) && (i.data = []), i;
|
|
349
|
+
}), he = H(() => {
|
|
334
350
|
const {
|
|
335
|
-
disabled:
|
|
336
|
-
} =
|
|
337
|
-
dynamicDisabled:
|
|
338
|
-
} =
|
|
351
|
+
disabled: r
|
|
352
|
+
} = e.formProps, {
|
|
353
|
+
dynamicDisabled: o
|
|
354
|
+
} = e.schema, {
|
|
339
355
|
disabled: i = !1
|
|
340
|
-
} =
|
|
341
|
-
let n = !!
|
|
342
|
-
return
|
|
356
|
+
} = d(K);
|
|
357
|
+
let n = !!r || i;
|
|
358
|
+
return Z(o) && (n = o), k(o) && (n = o(d(P))), n;
|
|
343
359
|
});
|
|
344
|
-
function
|
|
360
|
+
function E() {
|
|
345
361
|
const {
|
|
346
|
-
show:
|
|
347
|
-
ifShow:
|
|
348
|
-
} =
|
|
362
|
+
show: r,
|
|
363
|
+
ifShow: o
|
|
364
|
+
} = e.schema;
|
|
349
365
|
let i = !0, n = !0;
|
|
350
|
-
return
|
|
366
|
+
return Z(r) && (i = r), Z(o) && (n = o), k(r) && (i = r(d(P))), k(o) && (n = o(d(P))), {
|
|
351
367
|
isShow: i,
|
|
352
368
|
isIfShow: n
|
|
353
369
|
};
|
|
354
370
|
}
|
|
355
|
-
function
|
|
371
|
+
function pe() {
|
|
356
372
|
const {
|
|
357
|
-
rules:
|
|
358
|
-
type:
|
|
373
|
+
rules: r = [],
|
|
374
|
+
type: o = t.Input,
|
|
359
375
|
rulesMessageJoinLabel: i,
|
|
360
376
|
label: n,
|
|
361
|
-
title:
|
|
362
|
-
dynamicRule:
|
|
363
|
-
required:
|
|
364
|
-
dynamicRuleAdd:
|
|
365
|
-
} =
|
|
366
|
-
if (!
|
|
377
|
+
title: a,
|
|
378
|
+
dynamicRule: m,
|
|
379
|
+
required: u,
|
|
380
|
+
dynamicRuleAdd: C = !0
|
|
381
|
+
} = e.schema, h = k(u) ? u(d(P)) : u, y = e.formModel[e.schema.field];
|
|
382
|
+
if (!h && (xe(y) || y === "" || _(y) && !y.length))
|
|
367
383
|
return [];
|
|
368
|
-
const g = n ||
|
|
369
|
-
if (
|
|
370
|
-
return
|
|
371
|
-
let s =
|
|
384
|
+
const g = n || a;
|
|
385
|
+
if (k(m) && !C)
|
|
386
|
+
return m(d(P));
|
|
387
|
+
let s = Ae(_(r) ? r : [r]);
|
|
372
388
|
const {
|
|
373
|
-
rulesMessageJoinLabel:
|
|
374
|
-
} =
|
|
375
|
-
function
|
|
376
|
-
const
|
|
377
|
-
return c === void 0 ||
|
|
389
|
+
rulesMessageJoinLabel: R
|
|
390
|
+
} = e.formProps, b = Reflect.has(e.schema, "rulesMessageJoinLabel") ? i : R, w = ce(o, `${b ? g : ""}`);
|
|
391
|
+
function M(l, c) {
|
|
392
|
+
const x = l.message || w;
|
|
393
|
+
return c === void 0 || Re(c) || o === t.CheckboxSingle && !c || Array.isArray(c) && c.length === 0 || typeof c == "string" && c.trim() === "" || typeof c == "object" && Reflect.has(c, "checked") && Reflect.has(c, "halfChecked") && Array.isArray(c.checked) && Array.isArray(c.halfChecked) && c.checked.length === 0 && c.halfChecked.length === 0 ? Promise.reject(x) : Promise.resolve();
|
|
378
394
|
}
|
|
379
|
-
const
|
|
380
|
-
(!s || s.length === 0 ||
|
|
381
|
-
required:
|
|
382
|
-
validator:
|
|
383
|
-
trigger:
|
|
395
|
+
const V = [t.Radio, t.Select, t.RadioSingle, t.RadioButton, t.Checkbox, t.CheckboxSingle, t.CheckboxButton, t.AutoComplete, t.Cascader, t.ColorPicker, t.Upload, t.Slider].includes(o);
|
|
396
|
+
(!s || s.length === 0 || h) && (s = [{
|
|
397
|
+
required: h,
|
|
398
|
+
validator: M,
|
|
399
|
+
trigger: V ? "change" : "blur"
|
|
384
400
|
}, ...s]);
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
387
|
-
const
|
|
401
|
+
const W = s.findIndex((l) => Reflect.has(l, "required") && !Reflect.has(l, "validator"));
|
|
402
|
+
if (W !== -1) {
|
|
403
|
+
const l = s[W], {
|
|
388
404
|
isShow: c
|
|
389
|
-
} =
|
|
390
|
-
c || (
|
|
405
|
+
} = E();
|
|
406
|
+
c || (l.required = !1), o && (l.message = l.message || w);
|
|
391
407
|
}
|
|
392
|
-
const
|
|
393
|
-
function j(
|
|
394
|
-
const
|
|
395
|
-
return ["min", "all"].includes(
|
|
408
|
+
const v = s.findIndex((l) => l.min), D = s.findIndex((l) => l.max);
|
|
409
|
+
function j(l, c, x = "all") {
|
|
410
|
+
const S = s[c], B = S.isNumber ? isNaN(l) ? l?.length || 0 : Number(l) : l?.length || 0;
|
|
411
|
+
return ["min", "all"].includes(x) && B < S.min ? Promise.reject(`${g}至少为${S.min}位`) : ["max", "all"].includes(x) && B > S.max ? Promise.reject(`${g}最多${S.max}位`) : Promise.resolve();
|
|
396
412
|
}
|
|
397
|
-
(
|
|
398
|
-
const T = s.findIndex((
|
|
399
|
-
if (T !== -1 && (s[T].validator = (
|
|
400
|
-
let
|
|
401
|
-
|
|
413
|
+
(v !== -1 || D !== -1) && (v !== -1 && D !== -1 && !s[v].validator && !s[v].message ? s[v].validator = (l, c) => j(c, v) : v !== -1 && !s[v].validator && !s[v].message ? s[v].validator = (l, c) => j(c, v, "min") : D !== -1 && !s[D].validator && !s[D].message && (s[D].validator = (l, c) => j(c, D, "max")));
|
|
414
|
+
const T = s.findIndex((l) => l.len);
|
|
415
|
+
if (T !== -1 && (s[T].validator = (l, c) => c?.length !== s[T].len ? Promise.reject(`${g}必须是${s[T].len}位`) : Promise.resolve()), k(m) && C) {
|
|
416
|
+
let l = m(d(P));
|
|
417
|
+
l = _(l) ? l : [l], s = s.concat(l);
|
|
402
418
|
}
|
|
403
419
|
return s;
|
|
404
420
|
}
|
|
405
421
|
const ye = () => {
|
|
406
422
|
const {
|
|
407
|
-
renderComponentContent:
|
|
408
|
-
type:
|
|
423
|
+
renderComponentContent: r,
|
|
424
|
+
type: o = t.Input,
|
|
409
425
|
field: i,
|
|
410
426
|
changeEvent: n = "change",
|
|
411
|
-
valueField:
|
|
412
|
-
label:
|
|
413
|
-
title:
|
|
414
|
-
placeholderJoinLabel:
|
|
415
|
-
} =
|
|
416
|
-
let
|
|
417
|
-
|
|
418
|
-
const y = `on${
|
|
427
|
+
valueField: a,
|
|
428
|
+
label: m,
|
|
429
|
+
title: u,
|
|
430
|
+
placeholderJoinLabel: C = !0
|
|
431
|
+
} = e.schema;
|
|
432
|
+
let h = n;
|
|
433
|
+
Le(o) ? h = "input" : Ve(o) || o === t.TimePicker || o === t.InputTag || o === t.AutoComplete || o === t.Cascader || o === t.ColorPicker || o === t.Slider || o === t.TreeSelect ? h = "update:modelValue" : o === t.Upload ? h = "update:fileList" : o === t.Tree && (h = "check");
|
|
434
|
+
const y = `on${we(h)}`, g = se(o), {
|
|
419
435
|
autoSetPlaceHolder: s,
|
|
420
|
-
size:
|
|
421
|
-
} =
|
|
436
|
+
size: R
|
|
437
|
+
} = e.formProps, b = {
|
|
422
438
|
clearable: !0,
|
|
423
|
-
...
|
|
439
|
+
...d(K)
|
|
424
440
|
};
|
|
425
|
-
if (
|
|
426
|
-
const
|
|
427
|
-
b.placeholder =
|
|
441
|
+
if (o !== t.Search && (b.size = d(K)?.size || R, b.disabled = d(he)), !b.disabled && s && !Fe(o) && o) {
|
|
442
|
+
const l = m || u;
|
|
443
|
+
b.placeholder = d(K)?.placeholder || ce(o, C && Me(l) ? l : "");
|
|
428
444
|
}
|
|
429
|
-
const
|
|
430
|
-
[y]: (...
|
|
431
|
-
const [c] =
|
|
432
|
-
let
|
|
433
|
-
if (
|
|
434
|
-
const [,
|
|
435
|
-
|
|
445
|
+
const M = b[y], I = b.onClear, V = {
|
|
446
|
+
[y]: (...l) => {
|
|
447
|
+
const [c] = l;
|
|
448
|
+
let x;
|
|
449
|
+
if (o === t.Tree && h === "check") {
|
|
450
|
+
const [, S] = l, B = d(K)?.includeHalfChecked;
|
|
451
|
+
if (B ? x = [...S?.halfCheckedKeys || [], ...S?.checkedKeys || []] : x = S?.checkedKeys || [], B) {
|
|
452
|
+
const be = Symbol.for(`${i}_checkedKeys`);
|
|
453
|
+
e.formModel[be] = S?.checkedKeys || [];
|
|
454
|
+
}
|
|
436
455
|
} else {
|
|
437
|
-
const
|
|
438
|
-
|
|
456
|
+
const S = c ? c.target : null;
|
|
457
|
+
x = S ? S.value : c;
|
|
439
458
|
}
|
|
440
|
-
|
|
441
|
-
|
|
459
|
+
e.setFormModel(i, x, e.schema), M && k(M) && O(() => {
|
|
460
|
+
M(...l);
|
|
442
461
|
});
|
|
443
462
|
},
|
|
444
463
|
// 监听 clear 事件,清除错误信息
|
|
445
|
-
onClear: (...
|
|
446
|
-
|
|
464
|
+
onClear: (...l) => {
|
|
465
|
+
e.updateSchema([{
|
|
447
466
|
field: i,
|
|
448
467
|
itemProps: {
|
|
449
468
|
error: ""
|
|
450
469
|
}
|
|
451
|
-
}]),
|
|
470
|
+
}]), e.formActionType?.clearValidate?.(i), I && k(I) && I(...l);
|
|
452
471
|
}
|
|
453
|
-
},
|
|
454
|
-
[
|
|
472
|
+
}, W = o === t.Tree ? {} : {
|
|
473
|
+
[a || "model-value"]: e.formModel[i]
|
|
455
474
|
}, {
|
|
456
|
-
[y]:
|
|
475
|
+
[y]: v,
|
|
457
476
|
...D
|
|
458
477
|
} = b, j = {
|
|
459
478
|
...D,
|
|
460
|
-
...
|
|
461
|
-
...
|
|
479
|
+
...V,
|
|
480
|
+
...W
|
|
462
481
|
};
|
|
463
|
-
if (!
|
|
464
|
-
return
|
|
465
|
-
ref:
|
|
482
|
+
if (!r && o !== t.Upload)
|
|
483
|
+
return f(g, U({
|
|
484
|
+
ref: F
|
|
466
485
|
}, j), null);
|
|
467
486
|
let T;
|
|
468
|
-
if (T =
|
|
469
|
-
...
|
|
470
|
-
...
|
|
471
|
-
elRef:
|
|
487
|
+
if (T = k(r) ? {
|
|
488
|
+
...r({
|
|
489
|
+
...d(P),
|
|
490
|
+
elRef: F
|
|
472
491
|
})
|
|
473
492
|
} : {
|
|
474
|
-
default: () =>
|
|
475
|
-
},
|
|
493
|
+
default: () => r
|
|
494
|
+
}, o === t.Upload && !r) {
|
|
476
495
|
const {
|
|
477
|
-
drag:
|
|
478
|
-
} =
|
|
479
|
-
T =
|
|
480
|
-
default: () =>
|
|
496
|
+
drag: l
|
|
497
|
+
} = d(K);
|
|
498
|
+
T = l ? {
|
|
499
|
+
default: () => f(X("vft-icon"), {
|
|
481
500
|
icon: "icon-arrow-upload"
|
|
482
501
|
}, null)
|
|
483
502
|
} : {
|
|
484
|
-
default: () =>
|
|
503
|
+
default: () => f(X("vft-button"), {
|
|
485
504
|
type: "primary"
|
|
486
505
|
}, {
|
|
487
|
-
default: () => [
|
|
506
|
+
default: () => [f(X("vft-icon"), {
|
|
488
507
|
icon: "icon-arrow-upload"
|
|
489
508
|
}, null)]
|
|
490
509
|
})
|
|
491
510
|
};
|
|
492
511
|
}
|
|
493
|
-
return
|
|
494
|
-
ref:
|
|
495
|
-
}, j),
|
|
512
|
+
return f(g, U({
|
|
513
|
+
ref: F
|
|
514
|
+
}, j), ee(T) ? T : {
|
|
496
515
|
default: () => [T]
|
|
497
516
|
});
|
|
498
517
|
};
|
|
499
|
-
function
|
|
518
|
+
function Q() {
|
|
500
519
|
const {
|
|
501
|
-
showLabel:
|
|
502
|
-
label:
|
|
520
|
+
showLabel: r = !0,
|
|
521
|
+
label: o,
|
|
503
522
|
title: i,
|
|
504
523
|
subLabel: n,
|
|
505
|
-
labelRequired:
|
|
506
|
-
helpIcon:
|
|
507
|
-
helpTooltip:
|
|
508
|
-
labelSuffix:
|
|
509
|
-
} =
|
|
510
|
-
labelSuffix:
|
|
511
|
-
} =
|
|
524
|
+
labelRequired: a,
|
|
525
|
+
helpIcon: m,
|
|
526
|
+
helpTooltip: u,
|
|
527
|
+
labelSuffix: C
|
|
528
|
+
} = e.schema, {
|
|
529
|
+
labelSuffix: h = ""
|
|
530
|
+
} = e.formProps, y = C ?? h, g = o || i, s = g ? f("span", null, [a && f("span", {
|
|
512
531
|
class: "label-required"
|
|
513
|
-
}, [ie("*")]),
|
|
532
|
+
}, [ie("*")]), f("span", null, [g]), y && f("span", {
|
|
514
533
|
class: q.m("label-suffix")
|
|
515
|
-
}, [y])]) : null,
|
|
516
|
-
if (!
|
|
517
|
-
const b =
|
|
534
|
+
}, [y])]) : null, R = () => {
|
|
535
|
+
if (!m && !u) return null;
|
|
536
|
+
const b = H(() => ae(m, "icon", {
|
|
518
537
|
size: 20,
|
|
519
538
|
pointer: !0,
|
|
520
539
|
icon: "icon-help"
|
|
521
540
|
}));
|
|
522
|
-
if (
|
|
523
|
-
const
|
|
541
|
+
if (u) {
|
|
542
|
+
const w = H(() => ae(u, "content", {
|
|
524
543
|
placement: "right-start"
|
|
525
544
|
}));
|
|
526
|
-
return
|
|
545
|
+
return f(De, U({
|
|
527
546
|
className: "box-item"
|
|
528
|
-
},
|
|
529
|
-
default: () => [
|
|
547
|
+
}, w.value), {
|
|
548
|
+
default: () => [f(le, b.value, null)]
|
|
530
549
|
});
|
|
531
550
|
}
|
|
532
|
-
return
|
|
551
|
+
return f(le, b.value, null);
|
|
533
552
|
};
|
|
534
|
-
return
|
|
553
|
+
return r && s ? n ? f("div", {
|
|
535
554
|
class: "label-content"
|
|
536
|
-
}, [
|
|
555
|
+
}, [f("div", null, [s, ie(" "), f("span", {
|
|
537
556
|
class: "sub-label"
|
|
538
|
-
}, [n])]),
|
|
557
|
+
}, [n])]), R()]) : f("div", {
|
|
539
558
|
class: "label-content"
|
|
540
|
-
}, [
|
|
559
|
+
}, [f("div", null, [s]), R()]) : void 0;
|
|
541
560
|
}
|
|
542
|
-
const
|
|
543
|
-
function
|
|
544
|
-
if (!
|
|
561
|
+
const oe = ke();
|
|
562
|
+
function re(r, o = "default", i) {
|
|
563
|
+
if (!r || !Reflect.has(r, o))
|
|
545
564
|
return null;
|
|
546
|
-
if (!
|
|
547
|
-
return console.error(`${
|
|
548
|
-
const n = o
|
|
565
|
+
if (!k(r[o]))
|
|
566
|
+
return console.error(`${o} is not a function!`), null;
|
|
567
|
+
const n = r[o];
|
|
549
568
|
return n ? n(i) : null;
|
|
550
569
|
}
|
|
551
570
|
function ge() {
|
|
552
571
|
const {
|
|
553
|
-
required:
|
|
554
|
-
itemProps:
|
|
572
|
+
required: r,
|
|
573
|
+
itemProps: o,
|
|
555
574
|
slot: i,
|
|
556
575
|
render: n,
|
|
557
|
-
field:
|
|
558
|
-
suffix:
|
|
559
|
-
prefix:
|
|
560
|
-
prefixParentStyle:
|
|
561
|
-
} =
|
|
562
|
-
autoCleanErrorMessage:
|
|
576
|
+
field: a,
|
|
577
|
+
suffix: m,
|
|
578
|
+
prefix: u,
|
|
579
|
+
prefixParentStyle: C
|
|
580
|
+
} = e.schema, {
|
|
581
|
+
autoCleanErrorMessage: h,
|
|
563
582
|
compFullWidth: y
|
|
564
|
-
} =
|
|
565
|
-
|
|
566
|
-
field:
|
|
583
|
+
} = e.formProps, g = () => i ? re(oe, i, d(P)) : n ? n(d(P)) : ye(), s = !!m, R = !!u, b = k(m) ? m(d(P)) : m, w = k(u) ? u(d(P)) : u, M = () => {
|
|
584
|
+
e.updateSchema([{
|
|
585
|
+
field: a,
|
|
567
586
|
itemProps: {
|
|
568
587
|
error: ""
|
|
569
588
|
}
|
|
570
589
|
}]);
|
|
571
|
-
},
|
|
590
|
+
}, I = k(r) ? r(d(P)) : r, V = () => f(Te, U({
|
|
572
591
|
style: {
|
|
573
|
-
marginRight:
|
|
592
|
+
marginRight: e.formProps.customLayout ? "10px" : 0
|
|
574
593
|
},
|
|
575
|
-
prop:
|
|
594
|
+
prop: a,
|
|
576
595
|
class: [{
|
|
577
596
|
[q.is("suffix")]: s
|
|
578
597
|
}, {
|
|
579
598
|
[q.is("comp-full-width")]: y
|
|
580
599
|
}, q.e("item")]
|
|
581
|
-
},
|
|
582
|
-
label:
|
|
583
|
-
"onUpdate:error":
|
|
600
|
+
}, o, {
|
|
601
|
+
label: o?.label || o?.title,
|
|
602
|
+
"onUpdate:error": h ? M : () => {
|
|
584
603
|
},
|
|
585
|
-
rules:
|
|
586
|
-
required:
|
|
604
|
+
rules: pe(),
|
|
605
|
+
required: I
|
|
587
606
|
}), {
|
|
588
|
-
default: () => [
|
|
607
|
+
default: () => [f("div", {
|
|
589
608
|
class: q.e("container")
|
|
590
|
-
}, [
|
|
609
|
+
}, [f("div", {
|
|
591
610
|
class: q.e("content")
|
|
592
|
-
}, [g(), s &&
|
|
611
|
+
}, [g(), s && f("span", {
|
|
593
612
|
class: q.m("suffix")
|
|
594
613
|
}, [b])])])],
|
|
595
|
-
label:
|
|
614
|
+
label: Q() ? () => Q() : void 0
|
|
596
615
|
});
|
|
597
|
-
return
|
|
598
|
-
style:
|
|
599
|
-
}, [
|
|
616
|
+
return R ? f("div", {
|
|
617
|
+
style: C
|
|
618
|
+
}, [f("span", {
|
|
600
619
|
class: q.m("prefix")
|
|
601
|
-
}, [
|
|
620
|
+
}, [w]), V()]) : V();
|
|
602
621
|
}
|
|
603
622
|
return () => {
|
|
604
|
-
let
|
|
623
|
+
let r;
|
|
605
624
|
const {
|
|
606
|
-
colProps:
|
|
625
|
+
colProps: o = {},
|
|
607
626
|
colSlot: i,
|
|
608
627
|
renderColContent: n,
|
|
609
|
-
type:
|
|
610
|
-
render:
|
|
611
|
-
quickColSpan:
|
|
612
|
-
} =
|
|
613
|
-
if (!
|
|
628
|
+
type: a = t.Input,
|
|
629
|
+
render: m,
|
|
630
|
+
quickColSpan: u
|
|
631
|
+
} = e.schema;
|
|
632
|
+
if (!se(a) && !n && !m)
|
|
614
633
|
return null;
|
|
615
634
|
const {
|
|
616
|
-
baseColProps:
|
|
617
|
-
quickColSpan:
|
|
618
|
-
} =
|
|
619
|
-
span: Math.ceil(24 /
|
|
620
|
-
...
|
|
635
|
+
baseColProps: C = {},
|
|
636
|
+
quickColSpan: h
|
|
637
|
+
} = e.formProps, y = h ? {
|
|
638
|
+
span: Math.ceil(24 / h),
|
|
639
|
+
...C
|
|
621
640
|
} : {
|
|
622
|
-
...
|
|
623
|
-
}, g =
|
|
624
|
-
span: Math.ceil(24 /
|
|
625
|
-
...
|
|
641
|
+
...C
|
|
642
|
+
}, g = u ? {
|
|
643
|
+
span: Math.ceil(24 / u),
|
|
644
|
+
...o
|
|
626
645
|
} : {
|
|
627
|
-
...
|
|
646
|
+
...o
|
|
628
647
|
}, s = {
|
|
629
648
|
...y,
|
|
630
649
|
...g
|
|
631
650
|
}, {
|
|
632
|
-
isIfShow:
|
|
651
|
+
isIfShow: R,
|
|
633
652
|
isShow: b
|
|
634
|
-
} =
|
|
635
|
-
if (
|
|
636
|
-
let
|
|
637
|
-
return
|
|
653
|
+
} = E(), w = d(P), M = () => i ? re(oe, i, w) : n ? n(w) : ge();
|
|
654
|
+
if (a === t.Divider) {
|
|
655
|
+
let I;
|
|
656
|
+
return f(ne, U({
|
|
638
657
|
span: 24
|
|
639
658
|
}, g), {
|
|
640
|
-
default: () => [
|
|
641
|
-
default: () => [
|
|
659
|
+
default: () => [f(Ie, d(K), ee(I = Q()) ? I : {
|
|
660
|
+
default: () => [I]
|
|
642
661
|
})]
|
|
643
662
|
});
|
|
644
663
|
}
|
|
645
|
-
return
|
|
646
|
-
default: () => [
|
|
647
|
-
}), [[
|
|
664
|
+
return R && (e.formProps.customLayout ? M() : Ce(f(ne, s, ee(r = M()) ? r : {
|
|
665
|
+
default: () => [r]
|
|
666
|
+
}), [[Se, b]]));
|
|
648
667
|
};
|
|
649
668
|
}
|
|
650
669
|
});
|