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.
Files changed (61) hide show
  1. package/dist/index.css +1 -1
  2. package/es/components/autocomplete/autocomplete.vue.d.ts +4 -4
  3. package/es/components/autocomplete/index.d.ts +12 -12
  4. package/es/components/carousel/use-carousel.js +1 -1
  5. package/es/components/config-provider/hooks/use-global-config.js +3 -3
  6. package/es/components/input/input.vue2.js +4 -4
  7. package/es/components/input-tag/composables/use-input-tag.js +1 -1
  8. package/es/components/popper/index.d.ts +3 -3
  9. package/es/components/select/index.d.ts +11 -11
  10. package/es/components/select/select.vue.d.ts +11 -11
  11. package/es/components/select/useSelect.d.ts +8 -8
  12. package/es/components/super-form/style/css.d.ts +1 -0
  13. package/es/components/super-form/style/index.d.ts +1 -0
  14. package/es/components/super-form/super-form-item.vue2.js +265 -249
  15. package/es/components/super-form/types.d.ts +3 -1
  16. package/es/components/table/table.vue2.js +51 -49
  17. package/es/components/table/use/use-data-source.js +166 -143
  18. package/es/components/table/use/use-loading.js +11 -11
  19. package/es/components/table/use/use-table.js +7 -6
  20. package/es/components/tooltip/index.d.ts +3 -3
  21. package/es/components/tree/index.d.ts +5 -5
  22. package/es/components/tree/tree.vue.d.ts +2 -2
  23. package/es/components/upload/index.d.ts +15 -15
  24. package/es/components/upload/upload-content.vue.d.ts +1 -1
  25. package/es/components/upload/upload.vue.d.ts +1 -1
  26. package/es/hooks/use-z-index/index.js +3 -3
  27. package/es/package.json.d.ts +1 -1
  28. package/es/package.json.js +1 -1
  29. package/es/utils/form-register.d.ts +1 -0
  30. package/es/utils/form-register.js +5 -4
  31. package/es/utils/vue/vnode.js +1 -1
  32. package/lib/components/autocomplete/autocomplete.vue.d.ts +4 -4
  33. package/lib/components/autocomplete/index.d.ts +12 -12
  34. package/lib/components/input/input.vue2.cjs +1 -1
  35. package/lib/components/popper/index.d.ts +3 -3
  36. package/lib/components/select/index.d.ts +11 -11
  37. package/lib/components/select/select.vue.d.ts +11 -11
  38. package/lib/components/select/useSelect.d.ts +8 -8
  39. package/lib/components/super-form/style/css.d.ts +1 -0
  40. package/lib/components/super-form/style/index.d.ts +1 -0
  41. package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
  42. package/lib/components/super-form/types.d.ts +3 -1
  43. package/lib/components/table/table.vue2.cjs +1 -1
  44. package/lib/components/table/use/use-data-source.cjs +1 -1
  45. package/lib/components/table/use/use-loading.cjs +1 -1
  46. package/lib/components/table/use/use-table.cjs +1 -1
  47. package/lib/components/tooltip/index.d.ts +3 -3
  48. package/lib/components/tree/index.d.ts +5 -5
  49. package/lib/components/tree/tree.vue.d.ts +2 -2
  50. package/lib/components/upload/index.d.ts +15 -15
  51. package/lib/components/upload/upload-content.vue.d.ts +1 -1
  52. package/lib/components/upload/upload.vue.d.ts +1 -1
  53. package/lib/package.json.cjs +1 -1
  54. package/lib/package.json.d.ts +1 -1
  55. package/lib/utils/form-register.cjs +1 -1
  56. package/lib/utils/form-register.d.ts +1 -0
  57. package/package.json +6 -6
  58. package/theme-style/index.css +1 -1
  59. package/theme-style/src/icon-text.scss +1 -1
  60. package/theme-style/vft-icon-text.css +1 -1
  61. package/web-types.json +1 -1
@@ -1,4 +1,4 @@
1
- import { defineComponent as me, ref as Q, computed as N, watch as H, nextTick as J, unref as f, useSlots as be, createVNode as m, mergeProps as $, withDirectives as Pe, vShow as Ce, isVNode as Se, createTextVNode as ie, resolveComponent as G } from "vue";
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 xe, isArray as Z, cloneDeep as ke, isNull as Re, upperFirst as ve, isString as we } from "@vft/utils";
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 Ae } from "../divider/index.js";
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 Ie } from "../form/index.js";
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 De } from "../tooltip/index.js";
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 e, getComponent as le } from "../../utils/form-register.js";
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 Me } from "lodash-es";
107
- import { useNamespace as Te } from "../../hooks/use-namespace/index.js";
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 qe, isInput as Le, isDatePicker as je } from "./component-map.js";
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 Fe = me({
119
+ const je = me({
120
120
  inheritAttrs: !1
121
121
  }), Wo = /* @__PURE__ */ me({
122
- ...Fe,
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 T = Te("super-form"), U = Q(), P = N(() => {
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: U,
147
+ elRef: $,
148
148
  formActionType: r.formActionType
149
149
  };
150
- }), ue = /* @__PURE__ */ new Set([e.Select, e.Radio, e.Checkbox, e.RadioButton, e.CheckboxButton, e.Cascader, e.AutoComplete]), L = /* @__PURE__ */ new Set([e.Select, e.Radio, e.RadioButton, e.Checkbox, e.CheckboxButton, e.Cascader, e.AutoComplete]), z = /* @__PURE__ */ new Set([e.TreeSelect]), Y = () => r.schema.type && ue.has(r.schema.type) ? {
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
- } : {}, d = Q(Y());
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 t = Y();
159
- d.value = t;
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
- }), s = i instanceof Promise ? await i : i, l = {
166
- ...t,
167
- ...s ?? {}
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 = []), d.value = l;
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), d.value = Y();
171
+ console.error("componentProps 执行错误:", i), h.value = J();
172
172
  }
173
173
  } else
174
- d.value = o, L.has(r.schema.type) && (!d.value.options || !Array.isArray(d.value.options)) && (d.value.options = []);
174
+ h.value = o, L.has(r.schema.type) && (!h.value.options || !Array.isArray(h.value.options)) && (h.value.options = []);
175
175
  }
176
- H(() => r.schema.componentProps, (o, t) => (o || t) && fe(), {
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 k = null;
180
- const B = Q(!1), O = async (o, t) => {
184
+ let x = null;
185
+ const B = Q(!1), O = async (o, e) => {
181
186
  try {
182
187
  const i = {
183
- ...d.value
184
- }, s = L.has(r.schema.type);
185
- d.value = {
188
+ ...h.value
189
+ }, n = L.has(r.schema.type);
190
+ h.value = {
186
191
  ...i,
187
192
  loading: !0,
188
193
  // 清空 options,避免显示旧数据,确保是数组类型
189
- ...s ? {
194
+ ...n ? {
190
195
  options: []
191
196
  } : {}
192
197
  };
193
198
  const l = await o(f(P)), {
194
199
  type: u
195
- } = r.schema, p = s ? Array.isArray(l) ? l : [] : l;
196
- s ? d.value = {
200
+ } = r.schema, d = n ? Array.isArray(l) ? l : [] : l;
201
+ n ? h.value = {
197
202
  ...i,
198
- options: p,
203
+ options: d,
199
204
  requestResult: l,
200
205
  loading: !1
201
- } : z.has(u) ? d.value = {
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
- } : d.value = {
211
+ } : h.value = {
207
212
  ...i,
208
213
  requestResult: l,
209
214
  loading: !1
210
- }, t && await t(l, f(P));
215
+ }, e && await e(l, f(P));
211
216
  } catch (i) {
212
217
  console.error("fetchRemoteData 执行错误:", i);
213
- const s = L.has(r.schema.type), l = z.has(r.schema.type);
214
- d.value = {
215
- ...d.value,
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
- ...s ? {
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 J();
232
+ await H();
228
233
  }
229
234
  }, ee = () => {
230
- const o = d.value?.request;
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: t = [],
241
+ watchFields: e = [],
237
242
  options: i = {},
238
- wait: s = 0,
243
+ wait: n = 0,
239
244
  callback: l,
240
245
  onSuccess: u
241
246
  } = o;
242
247
  if (!l) return;
243
- const p = Array.isArray(t) && t.length > 0;
244
- if (i?.immediate && !p) {
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: S,
250
- ...h
251
- } = i, y = t.map((a) => () => r.formModel[a]), g = s > 0 ? Me(() => {
254
+ immediate: k,
255
+ ...p
256
+ } = i, y = e.map((s) => () => r.formModel[s]), g = n > 0 ? De(() => {
252
257
  O(l, u);
253
- }, s) : () => {
258
+ }, n) : () => {
254
259
  O(l, u);
255
260
  };
256
- k = H(y, g, h), i?.immediate && (B.value || (B.value = !0, O(l, u)));
261
+ x = W(y, g, p), i?.immediate && (B.value || (B.value = !0, O(l, u)));
257
262
  }
258
- }, pe = N(() => E());
259
- H(pe, (o, t) => {
260
- o.isIfShow && o.isShow && (t == null || !t.isIfShow || !t.isShow) ? J(() => {
261
- k && (k(), k = null), ee();
262
- }) : (!o.isIfShow || !o.isShow) && (B.value = !1, k && (k(), k = null));
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
- }), H(() => d.value?.request, () => {
270
+ }), W(() => h.value?.request, () => {
266
271
  const {
267
272
  isIfShow: o,
268
- isShow: t
269
- } = E();
270
- o && t && J(() => {
271
- k && (k(), k = null), ee();
273
+ isShow: e
274
+ } = z();
275
+ o && e && H(() => {
276
+ x && (x(), x = null), ee();
272
277
  });
273
278
  });
274
- const j = N(() => {
279
+ const V = N(() => {
275
280
  let o = {
276
- ...d.value
281
+ ...h.value
277
282
  };
278
- L.has(r.schema.type) && (!o.options || !Array.isArray(o.options)) && (o.options = []), z.has(r.schema.type) && (!o.data || !Array.isArray(o.data)) && (o.data = []);
279
- const t = /* @__PURE__ */ new Map([[e.Divider, {
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
- }], [e.Textarea, {
289
+ }], [t.Textarea, {
282
290
  type: "textarea"
283
- }], [e.Password, {
291
+ }], [t.Password, {
284
292
  type: "password",
285
293
  "show-password": !0
286
- }], [e.InputNumber, {
294
+ }], [t.InputNumber, {
287
295
  type: "number"
288
- }], [e.CheckboxButton, {
296
+ }], [t.CheckboxButton, {
289
297
  useButton: !0
290
- }], [e.RadioButton, {
298
+ }], [t.RadioButton, {
291
299
  useButton: !0
292
- }], [e.YearPicker, {
293
- type: e.YearPicker
294
- }], [e.MonthPicker, {
295
- type: e.MonthPicker
296
- }], [e.DatePicker, {
297
- type: e.DatePicker
298
- }], [e.DatesPicker, {
299
- type: e.DatesPicker
300
- }], [e.DateTimePicker, {
301
- type: e.DateTimePicker
302
- }], [e.WeekPicker, {
303
- type: e.WeekPicker
304
- }], [e.TimeRangePicker, {
305
- type: e.TimePicker,
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
- }], [e.DateTimeRangePicker, {
310
- type: e.DateTimeRangePicker,
317
+ }], [t.DateTimeRangePicker, {
318
+ type: t.DateTimeRangePicker,
311
319
  "start-placeholder": "开始日期",
312
320
  "end-placeholder": "结束日期"
313
- }], [e.DateRangePicker, {
314
- type: e.DateRangePicker,
321
+ }], [t.DateRangePicker, {
322
+ type: t.DateRangePicker,
315
323
  "start-placeholder": "开始日期",
316
324
  "end-placeholder": "结束日期"
317
- }], [e.MonthRangePicker, {
318
- type: e.MonthRangePicker,
325
+ }], [t.MonthRangePicker, {
326
+ type: t.MonthRangePicker,
319
327
  "start-placeholder": "开始月份",
320
328
  "end-placeholder": "结束月份"
321
329
  }]]);
322
- r.schema.type && t.has(r.schema.type) && (o = Object.assign(t.get(r.schema.type) || {}, o));
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 === e.Input && !i?.maxlength && (i.maxlength = r.formProps.inputMaxLength), L.has(r.schema.type) && (!i.options || !Array.isArray(i.options)) && (i.options = []), z.has(r.schema.type) && (!i.data || !Array.isArray(i.data)) && (i.data = []), i;
325
- }), de = N(() => {
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: t
337
+ dynamicDisabled: e
330
338
  } = r.schema, {
331
339
  disabled: i = !1
332
- } = f(j);
333
- let s = !!o || i;
334
- return X(t) && (s = t), C(t) && (s = t(f(P))), s;
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 E() {
344
+ function z() {
337
345
  const {
338
346
  show: o,
339
- ifShow: t
347
+ ifShow: e
340
348
  } = r.schema;
341
- let i = !0, s = !0;
342
- return X(o) && (i = o), X(t) && (s = t), C(o) && (i = o(f(P))), C(t) && (s = t(f(P))), {
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: s
352
+ isIfShow: n
345
353
  };
346
354
  }
347
355
  function he() {
348
356
  const {
349
357
  rules: o = [],
350
- type: t = e.Input,
358
+ type: e = t.Input,
351
359
  rulesMessageJoinLabel: i,
352
- label: s,
360
+ label: n,
353
361
  title: l,
354
362
  dynamicRule: u,
355
- required: p,
356
- dynamicRuleAdd: S = !0
357
- } = r.schema, h = C(p) ? p(f(P)) : p, y = r.formModel[r.schema.field];
358
- if (!h && (xe(y) || y === "" || Z(y) && !y.length))
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 = s || l;
361
- if (C(u) && !S)
368
+ const g = n || l;
369
+ if (C(u) && !k)
362
370
  return u(f(P));
363
- let a = ke(Z(o) ? o : [o]);
371
+ let s = xe(Z(o) ? o : [o]);
364
372
  const {
365
- rulesMessageJoinLabel: R
366
- } = r.formProps, b = Reflect.has(r.schema, "rulesMessageJoinLabel") ? i : R, v = ce(t, `${b ? g : ""}`);
367
- function w(n, c) {
368
- const D = n.message || v;
369
- return c === void 0 || Re(c) || t === e.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(D) : Promise.resolve();
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 = [e.Radio, e.Select, e.RadioSingle, e.RadioButton, e.Checkbox, e.CheckboxSingle, e.CheckboxButton, e.AutoComplete, e.Cascader, e.ColorPicker, e.Upload, e.Slider].includes(t);
372
- (!a || a.length === 0 || h) && (a = [{
373
- required: h,
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
- }, ...a]);
377
- const W = a.findIndex((n) => Reflect.has(n, "required") && !Reflect.has(n, "validator"));
378
- if (W !== -1) {
379
- const n = a[W], {
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
- } = E();
382
- c || (n.required = !1), t && (n.message = n.message || v);
389
+ } = z();
390
+ c || (a.required = !1), e && (a.message = a.message || R);
383
391
  }
384
- const x = a.findIndex((n) => n.min), M = a.findIndex((n) => n.max);
385
- function V(n, c, D = "all") {
386
- const q = a[c], re = q.isNumber ? isNaN(n) ? n?.length || 0 : Number(n) : n?.length || 0;
387
- return ["min", "all"].includes(D) && re < q.min ? Promise.reject(`${g}至少为${q.min}位`) : ["max", "all"].includes(D) && re > q.max ? Promise.reject(`${g}最多${q.max}位`) : Promise.resolve();
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
- (x !== -1 || M !== -1) && (x !== -1 && M !== -1 && !a[x].validator && !a[x].message ? a[x].validator = (n, c) => V(c, x) : x !== -1 && !a[x].validator && !a[x].message ? a[x].validator = (n, c) => V(c, x, "min") : M !== -1 && !a[M].validator && !a[M].message && (a[M].validator = (n, c) => V(c, M, "max")));
390
- const I = a.findIndex((n) => n.len);
391
- if (I !== -1 && (a[I].validator = (n, c) => c?.length !== a[I].len ? Promise.reject(`${g}必须是${a[I].len}位`) : Promise.resolve()), C(u) && S) {
392
- let n = u(f(P));
393
- n = Z(n) ? n : [n], a = a.concat(n);
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 a;
403
+ return s;
396
404
  }
397
405
  const ye = () => {
398
406
  const {
399
407
  renderComponentContent: o,
400
- type: t = e.Input,
408
+ type: e = t.Input,
401
409
  field: i,
402
- changeEvent: s = "change",
410
+ changeEvent: n = "change",
403
411
  valueField: l,
404
412
  label: u,
405
- title: p,
406
- placeholderJoinLabel: S = !0
413
+ title: d,
414
+ placeholderJoinLabel: k = !0
407
415
  } = r.schema;
408
- let h = s;
409
- Le(t) ? h = "input" : je(t) || t === e.TimePicker || t === e.InputTag || t === e.AutoComplete || t === e.Cascader || t === e.ColorPicker || t === e.Slider || t === e.TreeSelect ? h = "update:modelValue" : t === e.Upload && (h = "update:fileList");
410
- const y = `on${ve(h)}`, g = le(t), {
411
- autoSetPlaceHolder: a,
412
- size: R
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(j)
423
+ ...f(V)
416
424
  };
417
- if (t !== e.Search && (b.size = f(j)?.size || R, b.disabled = f(de)), !b.disabled && a && !qe(t) && t) {
418
- const n = u || p;
419
- b.placeholder = f(j)?.placeholder || ce(t, S && we(n) ? n : "");
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], A = b.onClear, F = {
422
- [y]: (...n) => {
423
- const [c] = n, D = c ? c.target : null, q = D ? D.value : c;
424
- r.setFormModel(i, q, r.schema), w && C(w) && J(() => {
425
- w(...n);
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: (...n) => {
445
+ onClear: (...a) => {
430
446
  r.updateSchema([{
431
447
  field: i,
432
448
  itemProps: {
433
449
  error: ""
434
450
  }
435
- }]), r.formActionType?.clearValidate?.(i), A && C(A) && A(...n);
451
+ }]), r.formActionType?.clearValidate?.(i), M && C(M) && M(...a);
436
452
  }
437
- }, W = {
453
+ }, E = e === t.Tree ? {} : {
438
454
  [l || "model-value"]: r.formModel[i]
439
455
  }, {
440
- [y]: x,
441
- ...M
442
- } = b, V = {
443
- ...M,
456
+ [y]: S,
457
+ ...D
458
+ } = b, j = {
459
+ ...D,
444
460
  ...F,
445
- ...W
461
+ ...E
446
462
  };
447
- if (!o && t !== e.Upload)
448
- return m(g, $({
449
- ref: U
450
- }, V), null);
451
- let I;
452
- if (I = C(o) ? {
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: U
471
+ elRef: $
456
472
  })
457
473
  } : {
458
474
  default: () => o
459
- }, t === e.Upload && !o) {
475
+ }, e === t.Upload && !o) {
460
476
  const {
461
- drag: n
462
- } = f(j);
463
- I = n ? {
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: U
479
- }, V), _(I) ? I : {
480
- default: () => [I]
493
+ return m(g, K({
494
+ ref: $
495
+ }, j), _(T) ? T : {
496
+ default: () => [T]
481
497
  });
482
498
  };
483
- function K() {
499
+ function Y() {
484
500
  const {
485
501
  showLabel: o = !0,
486
- label: t,
502
+ label: e,
487
503
  title: i,
488
- subLabel: s,
504
+ subLabel: n,
489
505
  labelRequired: l,
490
506
  helpIcon: u,
491
- helpTooltip: p,
492
- labelSuffix: S
507
+ helpTooltip: d,
508
+ labelSuffix: k
493
509
  } = r.schema, {
494
- labelSuffix: h = ""
495
- } = r.formProps, y = S ?? h, g = t || i, a = g ? m("span", null, [l && m("span", {
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: T.m("label-suffix")
499
- }, [y])]) : null, R = () => {
500
- if (!u && !p) return null;
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 (p) {
507
- const v = N(() => ae(p, "content", {
522
+ if (d) {
523
+ const R = N(() => ae(d, "content", {
508
524
  placement: "right-start"
509
525
  }));
510
- return m(De, $({
526
+ return m(Ie, K({
511
527
  className: "box-item"
512
- }, v.value), {
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 && a ? s ? m("div", {
534
+ return o && s ? n ? m("div", {
519
535
  class: "label-content"
520
- }, [m("div", null, [a, ie(" "), m("span", {
536
+ }, [m("div", null, [s, ie(" "), m("span", {
521
537
  class: "sub-label"
522
- }, [s])]), R()]) : m("div", {
538
+ }, [n])]), v()]) : m("div", {
523
539
  class: "label-content"
524
- }, [m("div", null, [a]), R()]) : void 0;
540
+ }, [m("div", null, [s]), v()]) : void 0;
525
541
  }
526
- const te = be();
527
- function oe(o, t = "default", i) {
528
- if (!o || !Reflect.has(o, t))
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[t]))
531
- return console.error(`${t} is not a function!`), null;
532
- const s = o[t];
533
- return s ? s(i) : null;
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: t,
554
+ itemProps: e,
539
555
  slot: i,
540
- render: s,
556
+ render: n,
541
557
  field: l,
542
558
  suffix: u,
543
- prefix: p,
544
- prefixParentStyle: S
559
+ prefix: d,
560
+ prefixParentStyle: k
545
561
  } = r.schema, {
546
- autoCleanErrorMessage: h,
562
+ autoCleanErrorMessage: p,
547
563
  compFullWidth: y
548
- } = r.formProps, g = () => i ? oe(te, i, f(P)) : s ? s(f(P)) : ye(), a = !!u, R = !!p, b = C(u) ? u(f(P)) : u, v = C(p) ? p(f(P)) : p, w = () => {
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
- }, A = C(o) ? o(f(P)) : o, F = () => m(Ie, $({
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
- [T.is("suffix")]: a
577
+ [q.is("suffix")]: s
562
578
  }, {
563
- [T.is("comp-full-width")]: y
564
- }, T.e("item")]
565
- }, t, {
566
- label: t?.label || t?.title,
567
- "onUpdate:error": h ? w : () => {
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: A
586
+ required: M
571
587
  }), {
572
588
  default: () => [m("div", {
573
- class: T.e("container")
589
+ class: q.e("container")
574
590
  }, [m("div", {
575
- class: T.e("content")
576
- }, [g(), a && m("span", {
577
- class: T.m("suffix")
591
+ class: q.e("content")
592
+ }, [g(), s && m("span", {
593
+ class: q.m("suffix")
578
594
  }, [b])])])],
579
- label: K() ? () => K() : void 0
595
+ label: Y() ? () => Y() : void 0
580
596
  });
581
- return R ? m("div", {
582
- style: S
597
+ return v ? m("div", {
598
+ style: k
583
599
  }, [m("span", {
584
- class: T.m("prefix")
585
- }, [v]), F()]) : F();
600
+ class: q.m("prefix")
601
+ }, [R]), F()]) : F();
586
602
  }
587
603
  return () => {
588
604
  let o;
589
605
  const {
590
- colProps: t = {},
606
+ colProps: e = {},
591
607
  colSlot: i,
592
- renderColContent: s,
593
- type: l = e.Input,
608
+ renderColContent: n,
609
+ type: l = t.Input,
594
610
  render: u,
595
- quickColSpan: p
611
+ quickColSpan: d
596
612
  } = r.schema;
597
- if (!le(l) && !s && !u)
613
+ if (!le(l) && !n && !u)
598
614
  return null;
599
615
  const {
600
- baseColProps: S = {},
601
- quickColSpan: h
602
- } = r.formProps, y = h ? {
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
- ...t
620
+ ...k
621
+ } : {
622
+ ...k
623
+ }, g = d ? {
624
+ span: Math.ceil(24 / d),
625
+ ...e
610
626
  } : {
611
- ...t
612
- }, a = {
627
+ ...e
628
+ }, s = {
613
629
  ...y,
614
630
  ...g
615
631
  }, {
616
- isIfShow: R,
632
+ isIfShow: v,
617
633
  isShow: b
618
- } = E(), v = f(P), w = () => i ? oe(te, i, v) : s ? s(v) : ge();
619
- if (l === e.Divider) {
620
- let A;
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(Ae, f(j), _(A = K()) ? A : {
625
- default: () => [A]
640
+ default: () => [m(Me, f(V), _(M = Y()) ? M : {
641
+ default: () => [M]
626
642
  })]
627
643
  });
628
644
  }
629
- return R && (r.formProps.customLayout ? w() : Pe(m(ne, a, _(o = w()) ? o : {
645
+ return v && (r.formProps.customLayout ? w() : Ce(m(ne, s, _(o = w()) ? o : {
630
646
  default: () => [o]
631
- }), [[Ce, b]]));
647
+ }), [[ke, b]]));
632
648
  };
633
649
  }
634
650
  });