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.
Files changed (44) hide show
  1. package/dist/index.css +1 -1
  2. package/es/components/autocomplete/autocomplete.vue.d.ts +2 -2
  3. package/es/components/autocomplete/index.d.ts +6 -6
  4. package/es/components/button/index.d.ts +9 -9
  5. package/es/components/image-viewer/image-viewer.vue.d.ts +2 -0
  6. package/es/components/image-viewer/image-viewer.vue2.js +89 -85
  7. package/es/components/image-viewer/index.d.ts +18 -0
  8. package/es/components/popconfirm/index.d.ts +15 -15
  9. package/es/components/popconfirm/popconfirm.vue.d.ts +1 -1
  10. package/es/components/select/index.d.ts +4 -4
  11. package/es/components/select/select.vue.d.ts +4 -4
  12. package/es/components/select/useSelect.d.ts +4 -4
  13. package/es/components/super-form/super-form-item.vue2.js +313 -294
  14. package/es/components/table/field.js +32 -33
  15. package/es/components/tree-select/select.js +24 -24
  16. package/es/components/tree-select/tree-select-option.js +18 -7
  17. package/es/components/tree-select/tree-select.vue2.js +28 -26
  18. package/es/components/tree-select/tree.js +27 -26
  19. package/es/package.json.d.ts +1 -1
  20. package/es/package.json.js +1 -1
  21. package/lib/components/autocomplete/autocomplete.vue.d.ts +2 -2
  22. package/lib/components/autocomplete/index.d.ts +6 -6
  23. package/lib/components/button/index.d.ts +9 -9
  24. package/lib/components/image-viewer/image-viewer.vue.d.ts +2 -0
  25. package/lib/components/image-viewer/image-viewer.vue2.cjs +1 -1
  26. package/lib/components/image-viewer/index.d.ts +18 -0
  27. package/lib/components/popconfirm/index.d.ts +15 -15
  28. package/lib/components/popconfirm/popconfirm.vue.d.ts +1 -1
  29. package/lib/components/select/index.d.ts +4 -4
  30. package/lib/components/select/select.vue.d.ts +4 -4
  31. package/lib/components/select/useSelect.d.ts +4 -4
  32. package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
  33. package/lib/components/table/field.cjs +1 -1
  34. package/lib/components/tree-select/select.cjs +1 -1
  35. package/lib/components/tree-select/tree-select-option.cjs +1 -1
  36. package/lib/components/tree-select/tree-select.vue2.cjs +1 -1
  37. package/lib/components/tree-select/tree.cjs +1 -1
  38. package/lib/package.json.cjs +1 -1
  39. package/lib/package.json.d.ts +1 -1
  40. package/package.json +5 -5
  41. package/theme-style/index.css +1 -1
  42. package/theme-style/src/tree-select.scss +8 -0
  43. package/theme-style/vft-tree-select.css +1 -1
  44. package/web-types.json +1 -1
@@ -1,4 +1,4 @@
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";
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 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";
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 se } from "../icon/index.js";
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 Me } from "../divider/index.js";
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 Ie } from "../tooltip/index.js";
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 le } from "../../utils/form-register.js";
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 De } from "lodash-es";
107
- import { useNamespace as qe } from "../../hooks/use-namespace/index.js";
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 Le, isInput as Ve, isDatePicker as Fe } from "./component-map.js";
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 _(r) {
117
- return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !Se(r);
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(r) {
134
- const q = qe("super-form"), $ = Q(), P = N(() => {
133
+ setup(e) {
134
+ const q = Ke("super-form"), F = G(), P = H(() => {
135
135
  const {
136
- mergeDynamicData: o
137
- } = r.formProps;
136
+ mergeDynamicData: r
137
+ } = e.formProps;
138
138
  return {
139
- field: r.schema.field,
140
- model: r.formModel,
139
+ field: e.schema.field,
140
+ model: e.formModel,
141
141
  values: {
142
- ...o,
143
- ...r.allDefaultValues,
144
- ...r.formModel
142
+ ...r,
143
+ ...e.allDefaultValues,
144
+ ...e.formModel
145
145
  },
146
- schema: r.schema,
147
- elRef: $,
148
- formActionType: r.formActionType
146
+ schema: e.schema,
147
+ elRef: F,
148
+ formActionType: e.formActionType
149
149
  };
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) ? {
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
- } : {}, h = Q(J());
153
- async function fe() {
152
+ } : {}, p = G(Y());
153
+ async function ue() {
154
154
  const {
155
- componentProps: o = {}
156
- } = r.schema;
157
- if (C(o)) {
158
- const e = J();
159
- h.value = e;
155
+ componentProps: r = {}
156
+ } = e.schema;
157
+ if (k(r)) {
158
+ const o = Y();
159
+ p.value = o;
160
160
  try {
161
- const i = o({
162
- schema: r.schema,
163
- formModel: r.formModel,
164
- formActionType: r.formActionType
165
- }), n = i instanceof Promise ? await i : i, l = {
166
- ...e,
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(r.schema.type) && (!l.options || !Array.isArray(l.options)) && (l.options = []), h.value = l;
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), h.value = J();
171
+ console.error("componentProps 执行错误:", i), p.value = Y();
172
172
  }
173
173
  } else
174
- h.value = o, L.has(r.schema.type) && (!h.value.options || !Array.isArray(h.value.options)) && (h.value.options = []);
174
+ p.value = r, L.has(e.schema.type) && (!p.value.options || !Array.isArray(p.value.options)) && (p.value.options = []);
175
175
  }
176
- W(() => r.schema.componentProps, (o, e) => (o || e) && fe(), {
176
+ J(() => e.schema.componentProps, (r, o) => (r || o) && ue(), {
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);
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 x = null;
185
- const B = Q(!1), O = async (o, e) => {
195
+ let A = null;
196
+ const N = G(!1), $ = async (r, o) => {
186
197
  try {
187
198
  const i = {
188
- ...h.value
189
- }, n = L.has(r.schema.type);
190
- h.value = {
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 l = await o(f(P)), {
199
- type: u
200
- } = r.schema, d = n ? Array.isArray(l) ? l : [] : l;
201
- n ? h.value = {
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: d,
204
- requestResult: l,
214
+ options: u,
215
+ requestResult: a,
205
216
  loading: !1
206
- } : U.has(u) ? h.value = {
217
+ } : z.has(m) ? p.value = {
207
218
  ...i,
208
- data: Array.isArray(l) ? l : l || [],
209
- requestResult: l,
219
+ data: Array.isArray(a) ? a : a || [],
220
+ requestResult: a,
210
221
  loading: !1
211
- } : h.value = {
222
+ } : p.value = {
212
223
  ...i,
213
- requestResult: l,
224
+ requestResult: a,
214
225
  loading: !1
215
- }, e && await e(l, f(P));
226
+ }, o && await o(a, d(P));
216
227
  } catch (i) {
217
228
  console.error("fetchRemoteData 执行错误:", i);
218
- const n = L.has(r.schema.type), l = U.has(r.schema.type);
219
- h.value = {
220
- ...h.value,
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
- ...l ? {
238
+ ...a ? {
228
239
  data: []
229
240
  } : {}
230
241
  };
231
242
  } finally {
232
- await H();
243
+ await O();
233
244
  }
234
- }, ee = () => {
235
- const o = h.value?.request;
236
- if (o)
237
- if (C(o))
238
- O(o);
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: e = [],
252
+ watchFields: o = [],
242
253
  options: i = {},
243
254
  wait: n = 0,
244
- callback: l,
245
- onSuccess: u
246
- } = o;
247
- if (!l) return;
248
- const d = Array.isArray(e) && e.length > 0;
249
- if (i?.immediate && !d) {
250
- B.value || (B.value = !0, O(l, u));
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: k,
255
- ...p
256
- } = i, y = e.map((s) => () => r.formModel[s]), g = n > 0 ? De(() => {
257
- O(l, u);
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
- O(l, u);
270
+ $(a, m);
260
271
  };
261
- x = W(y, g, p), i?.immediate && (B.value || (B.value = !0, O(l, u)));
272
+ A = J(y, g, h), i?.immediate && (N.value || (N.value = !0, $(a, m)));
262
273
  }
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));
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
- }), W(() => h.value?.request, () => {
281
+ }), J(() => p.value?.request, () => {
271
282
  const {
272
- isIfShow: o,
273
- isShow: e
274
- } = z();
275
- o && e && H(() => {
276
- x && (x(), x = null), ee();
283
+ isIfShow: r,
284
+ isShow: o
285
+ } = E();
286
+ r && o && O(() => {
287
+ A && (A(), A = null), te();
277
288
  });
278
289
  });
279
- const V = N(() => {
280
- let o = {
281
- ...h.value
290
+ const K = H(() => {
291
+ let r = {
292
+ ...p.value
282
293
  };
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);
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 e = /* @__PURE__ */ new Map([[t.Divider, {
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
- r.schema.type && e.has(r.schema.type) && (o = Object.assign(e.get(r.schema.type) || {}, o));
331
- const i = o;
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(() => {
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: o
336
- } = r.formProps, {
337
- dynamicDisabled: e
338
- } = r.schema, {
351
+ disabled: r
352
+ } = e.formProps, {
353
+ dynamicDisabled: o
354
+ } = e.schema, {
339
355
  disabled: i = !1
340
- } = f(V);
341
- let n = !!o || i;
342
- return X(e) && (n = e), C(e) && (n = e(f(P))), n;
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 z() {
360
+ function E() {
345
361
  const {
346
- show: o,
347
- ifShow: e
348
- } = r.schema;
362
+ show: r,
363
+ ifShow: o
364
+ } = e.schema;
349
365
  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))), {
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 he() {
371
+ function pe() {
356
372
  const {
357
- rules: o = [],
358
- type: e = t.Input,
373
+ rules: r = [],
374
+ type: o = t.Input,
359
375
  rulesMessageJoinLabel: i,
360
376
  label: n,
361
- title: l,
362
- dynamicRule: u,
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))
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 || l;
369
- if (C(u) && !k)
370
- return u(f(P));
371
- let s = xe(Z(o) ? o : [o]);
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: 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();
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 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,
382
- validator: w,
383
- trigger: F ? "change" : "blur"
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 E = s.findIndex((a) => Reflect.has(a, "required") && !Reflect.has(a, "validator"));
386
- if (E !== -1) {
387
- const a = s[E], {
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
- } = z();
390
- c || (a.required = !1), e && (a.message = a.message || R);
405
+ } = E();
406
+ c || (l.required = !1), o && (l.message = l.message || w);
391
407
  }
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();
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
- (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);
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: o,
408
- type: e = t.Input,
423
+ renderComponentContent: r,
424
+ type: o = t.Input,
409
425
  field: i,
410
426
  changeEvent: n = "change",
411
- valueField: l,
412
- label: u,
413
- title: d,
414
- placeholderJoinLabel: k = !0
415
- } = r.schema;
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), {
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: v
421
- } = r.formProps, b = {
436
+ size: R
437
+ } = e.formProps, b = {
422
438
  clearable: !0,
423
- ...f(V)
439
+ ...d(K)
424
440
  };
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 : "");
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 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 || [];
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 I = c ? c.target : null;
438
- A = I ? I.value : c;
456
+ const S = c ? c.target : null;
457
+ x = S ? S.value : c;
439
458
  }
440
- r.setFormModel(i, A, r.schema), w && C(w) && H(() => {
441
- w(...a);
459
+ e.setFormModel(i, x, e.schema), M && k(M) && O(() => {
460
+ M(...l);
442
461
  });
443
462
  },
444
463
  // 监听 clear 事件,清除错误信息
445
- onClear: (...a) => {
446
- r.updateSchema([{
464
+ onClear: (...l) => {
465
+ e.updateSchema([{
447
466
  field: i,
448
467
  itemProps: {
449
468
  error: ""
450
469
  }
451
- }]), r.formActionType?.clearValidate?.(i), M && C(M) && M(...a);
470
+ }]), e.formActionType?.clearValidate?.(i), I && k(I) && I(...l);
452
471
  }
453
- }, E = e === t.Tree ? {} : {
454
- [l || "model-value"]: r.formModel[i]
472
+ }, W = o === t.Tree ? {} : {
473
+ [a || "model-value"]: e.formModel[i]
455
474
  }, {
456
- [y]: S,
475
+ [y]: v,
457
476
  ...D
458
477
  } = b, j = {
459
478
  ...D,
460
- ...F,
461
- ...E
479
+ ...V,
480
+ ...W
462
481
  };
463
- if (!o && e !== t.Upload)
464
- return m(g, K({
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 = C(o) ? {
469
- ...o({
470
- ...f(P),
471
- elRef: $
487
+ if (T = k(r) ? {
488
+ ...r({
489
+ ...d(P),
490
+ elRef: F
472
491
  })
473
492
  } : {
474
- default: () => o
475
- }, e === t.Upload && !o) {
493
+ default: () => r
494
+ }, o === t.Upload && !r) {
476
495
  const {
477
- drag: a
478
- } = f(V);
479
- T = a ? {
480
- default: () => m(G("vft-icon"), {
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: () => m(G("vft-button"), {
503
+ default: () => f(X("vft-button"), {
485
504
  type: "primary"
486
505
  }, {
487
- default: () => [m(G("vft-icon"), {
506
+ default: () => [f(X("vft-icon"), {
488
507
  icon: "icon-arrow-upload"
489
508
  }, null)]
490
509
  })
491
510
  };
492
511
  }
493
- return m(g, K({
494
- ref: $
495
- }, j), _(T) ? T : {
512
+ return f(g, U({
513
+ ref: F
514
+ }, j), ee(T) ? T : {
496
515
  default: () => [T]
497
516
  });
498
517
  };
499
- function Y() {
518
+ function Q() {
500
519
  const {
501
- showLabel: o = !0,
502
- label: e,
520
+ showLabel: r = !0,
521
+ label: o,
503
522
  title: i,
504
523
  subLabel: n,
505
- labelRequired: l,
506
- helpIcon: u,
507
- helpTooltip: d,
508
- labelSuffix: k
509
- } = r.schema, {
510
- labelSuffix: p = ""
511
- } = r.formProps, y = k ?? p, g = e || i, s = g ? m("span", null, [l && m("span", {
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("*")]), m("span", null, [g]), y && m("span", {
532
+ }, [ie("*")]), f("span", null, [g]), y && f("span", {
514
533
  class: q.m("label-suffix")
515
- }, [y])]) : null, v = () => {
516
- if (!u && !d) return null;
517
- const b = N(() => ae(u, "icon", {
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 (d) {
523
- const R = N(() => ae(d, "content", {
541
+ if (u) {
542
+ const w = H(() => ae(u, "content", {
524
543
  placement: "right-start"
525
544
  }));
526
- return m(Ie, K({
545
+ return f(De, U({
527
546
  className: "box-item"
528
- }, R.value), {
529
- default: () => [m(se, b.value, null)]
547
+ }, w.value), {
548
+ default: () => [f(le, b.value, null)]
530
549
  });
531
550
  }
532
- return m(se, b.value, null);
551
+ return f(le, b.value, null);
533
552
  };
534
- return o && s ? n ? m("div", {
553
+ return r && s ? n ? f("div", {
535
554
  class: "label-content"
536
- }, [m("div", null, [s, ie(" "), m("span", {
555
+ }, [f("div", null, [s, ie(" "), f("span", {
537
556
  class: "sub-label"
538
- }, [n])]), v()]) : m("div", {
557
+ }, [n])]), R()]) : f("div", {
539
558
  class: "label-content"
540
- }, [m("div", null, [s]), v()]) : void 0;
559
+ }, [f("div", null, [s]), R()]) : void 0;
541
560
  }
542
- const te = Pe();
543
- function oe(o, e = "default", i) {
544
- if (!o || !Reflect.has(o, e))
561
+ const oe = ke();
562
+ function re(r, o = "default", i) {
563
+ if (!r || !Reflect.has(r, o))
545
564
  return null;
546
- if (!C(o[e]))
547
- return console.error(`${e} is not a function!`), null;
548
- const n = o[e];
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: o,
554
- itemProps: e,
572
+ required: r,
573
+ itemProps: o,
555
574
  slot: i,
556
575
  render: n,
557
- field: l,
558
- suffix: u,
559
- prefix: d,
560
- prefixParentStyle: k
561
- } = r.schema, {
562
- autoCleanErrorMessage: p,
576
+ field: a,
577
+ suffix: m,
578
+ prefix: u,
579
+ prefixParentStyle: C
580
+ } = e.schema, {
581
+ autoCleanErrorMessage: h,
563
582
  compFullWidth: y
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 = () => {
565
- r.updateSchema([{
566
- field: l,
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
- }, M = C(o) ? o(f(P)) : o, F = () => m(Te, K({
590
+ }, I = k(r) ? r(d(P)) : r, V = () => f(Te, U({
572
591
  style: {
573
- marginRight: r.formProps.customLayout ? "10px" : 0
592
+ marginRight: e.formProps.customLayout ? "10px" : 0
574
593
  },
575
- prop: l,
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
- }, e, {
582
- label: e?.label || e?.title,
583
- "onUpdate:error": p ? w : () => {
600
+ }, o, {
601
+ label: o?.label || o?.title,
602
+ "onUpdate:error": h ? M : () => {
584
603
  },
585
- rules: he(),
586
- required: M
604
+ rules: pe(),
605
+ required: I
587
606
  }), {
588
- default: () => [m("div", {
607
+ default: () => [f("div", {
589
608
  class: q.e("container")
590
- }, [m("div", {
609
+ }, [f("div", {
591
610
  class: q.e("content")
592
- }, [g(), s && m("span", {
611
+ }, [g(), s && f("span", {
593
612
  class: q.m("suffix")
594
613
  }, [b])])])],
595
- label: Y() ? () => Y() : void 0
614
+ label: Q() ? () => Q() : void 0
596
615
  });
597
- return v ? m("div", {
598
- style: k
599
- }, [m("span", {
616
+ return R ? f("div", {
617
+ style: C
618
+ }, [f("span", {
600
619
  class: q.m("prefix")
601
- }, [R]), F()]) : F();
620
+ }, [w]), V()]) : V();
602
621
  }
603
622
  return () => {
604
- let o;
623
+ let r;
605
624
  const {
606
- colProps: e = {},
625
+ colProps: o = {},
607
626
  colSlot: i,
608
627
  renderColContent: n,
609
- type: l = t.Input,
610
- render: u,
611
- quickColSpan: d
612
- } = r.schema;
613
- if (!le(l) && !n && !u)
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: k = {},
617
- quickColSpan: p
618
- } = r.formProps, y = p ? {
619
- span: Math.ceil(24 / p),
620
- ...k
635
+ baseColProps: C = {},
636
+ quickColSpan: h
637
+ } = e.formProps, y = h ? {
638
+ span: Math.ceil(24 / h),
639
+ ...C
621
640
  } : {
622
- ...k
623
- }, g = d ? {
624
- span: Math.ceil(24 / d),
625
- ...e
641
+ ...C
642
+ }, g = u ? {
643
+ span: Math.ceil(24 / u),
644
+ ...o
626
645
  } : {
627
- ...e
646
+ ...o
628
647
  }, s = {
629
648
  ...y,
630
649
  ...g
631
650
  }, {
632
- isIfShow: v,
651
+ isIfShow: R,
633
652
  isShow: b
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({
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: () => [m(Me, f(V), _(M = Y()) ? M : {
641
- default: () => [M]
659
+ default: () => [f(Ie, d(K), ee(I = Q()) ? I : {
660
+ default: () => [I]
642
661
  })]
643
662
  });
644
663
  }
645
- return v && (r.formProps.customLayout ? w() : Ce(m(ne, s, _(o = w()) ? o : {
646
- default: () => [o]
647
- }), [[ke, b]]));
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
  });