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