vft 0.0.499 → 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 (85) hide show
  1. package/dist/index.css +1 -1
  2. package/es/components/autocomplete/autocomplete.vue.d.ts +6 -6
  3. package/es/components/autocomplete/index.d.ts +18 -18
  4. package/es/components/button/index.d.ts +9 -9
  5. package/es/components/carousel/use-carousel.js +1 -1
  6. package/es/components/config-provider/hooks/use-global-config.js +3 -3
  7. package/es/components/image-viewer/image-viewer.vue.d.ts +2 -0
  8. package/es/components/image-viewer/image-viewer.vue2.js +89 -85
  9. package/es/components/image-viewer/index.d.ts +18 -0
  10. package/es/components/input/input.vue2.js +4 -4
  11. package/es/components/input-tag/composables/use-input-tag.js +1 -1
  12. package/es/components/popconfirm/index.d.ts +15 -15
  13. package/es/components/popconfirm/popconfirm.vue.d.ts +1 -1
  14. package/es/components/popper/index.d.ts +3 -3
  15. package/es/components/select/index.d.ts +15 -15
  16. package/es/components/select/select.vue.d.ts +15 -15
  17. package/es/components/select/useSelect.d.ts +12 -12
  18. package/es/components/super-form/style/css.d.ts +1 -0
  19. package/es/components/super-form/style/index.d.ts +1 -0
  20. package/es/components/super-form/super-form-item.vue2.js +360 -325
  21. package/es/components/super-form/types.d.ts +3 -1
  22. package/es/components/table/field.js +32 -33
  23. package/es/components/table/table.vue2.js +51 -49
  24. package/es/components/table/use/use-data-source.js +166 -143
  25. package/es/components/table/use/use-loading.js +11 -11
  26. package/es/components/table/use/use-table.js +7 -6
  27. package/es/components/tooltip/index.d.ts +3 -3
  28. package/es/components/tree/index.d.ts +5 -5
  29. package/es/components/tree/tree.vue.d.ts +2 -2
  30. package/es/components/tree-select/select.js +24 -24
  31. package/es/components/tree-select/tree-select-option.js +18 -7
  32. package/es/components/tree-select/tree-select.vue2.js +28 -26
  33. package/es/components/tree-select/tree.js +27 -26
  34. package/es/components/upload/index.d.ts +15 -15
  35. package/es/components/upload/upload-content.vue.d.ts +1 -1
  36. package/es/components/upload/upload.vue.d.ts +1 -1
  37. package/es/hooks/use-z-index/index.js +3 -3
  38. package/es/package.json.d.ts +1 -1
  39. package/es/package.json.js +1 -1
  40. package/es/utils/form-register.d.ts +1 -0
  41. package/es/utils/form-register.js +5 -4
  42. package/es/utils/vue/vnode.js +1 -1
  43. package/lib/components/autocomplete/autocomplete.vue.d.ts +6 -6
  44. package/lib/components/autocomplete/index.d.ts +18 -18
  45. package/lib/components/button/index.d.ts +9 -9
  46. package/lib/components/image-viewer/image-viewer.vue.d.ts +2 -0
  47. package/lib/components/image-viewer/image-viewer.vue2.cjs +1 -1
  48. package/lib/components/image-viewer/index.d.ts +18 -0
  49. package/lib/components/input/input.vue2.cjs +1 -1
  50. package/lib/components/popconfirm/index.d.ts +15 -15
  51. package/lib/components/popconfirm/popconfirm.vue.d.ts +1 -1
  52. package/lib/components/popper/index.d.ts +3 -3
  53. package/lib/components/select/index.d.ts +15 -15
  54. package/lib/components/select/select.vue.d.ts +15 -15
  55. package/lib/components/select/useSelect.d.ts +12 -12
  56. package/lib/components/super-form/style/css.d.ts +1 -0
  57. package/lib/components/super-form/style/index.d.ts +1 -0
  58. package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
  59. package/lib/components/super-form/types.d.ts +3 -1
  60. package/lib/components/table/field.cjs +1 -1
  61. package/lib/components/table/table.vue2.cjs +1 -1
  62. package/lib/components/table/use/use-data-source.cjs +1 -1
  63. package/lib/components/table/use/use-loading.cjs +1 -1
  64. package/lib/components/table/use/use-table.cjs +1 -1
  65. package/lib/components/tooltip/index.d.ts +3 -3
  66. package/lib/components/tree/index.d.ts +5 -5
  67. package/lib/components/tree/tree.vue.d.ts +2 -2
  68. package/lib/components/tree-select/select.cjs +1 -1
  69. package/lib/components/tree-select/tree-select-option.cjs +1 -1
  70. package/lib/components/tree-select/tree-select.vue2.cjs +1 -1
  71. package/lib/components/tree-select/tree.cjs +1 -1
  72. package/lib/components/upload/index.d.ts +15 -15
  73. package/lib/components/upload/upload-content.vue.d.ts +1 -1
  74. package/lib/components/upload/upload.vue.d.ts +1 -1
  75. package/lib/package.json.cjs +1 -1
  76. package/lib/package.json.d.ts +1 -1
  77. package/lib/utils/form-register.cjs +1 -1
  78. package/lib/utils/form-register.d.ts +1 -0
  79. package/package.json +5 -5
  80. package/theme-style/index.css +1 -1
  81. package/theme-style/src/icon-text.scss +1 -1
  82. package/theme-style/src/tree-select.scss +8 -0
  83. package/theme-style/vft-icon-text.css +1 -1
  84. package/theme-style/vft-tree-select.css +1 -1
  85. 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 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,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 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 Ae } 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";
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";
@@ -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 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 Me } from "lodash-es";
107
- import { useNamespace as Te } 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 qe, isInput as Le, isDatePicker as je } 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
- 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: {},
@@ -130,505 +130,540 @@ const Fe = me({
130
130
  updateSchema: {},
131
131
  formActionType: {}
132
132
  },
133
- setup(r) {
134
- const T = Te("super-form"), U = 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: U,
148
- formActionType: r.formActionType
146
+ schema: e.schema,
147
+ elRef: F,
148
+ formActionType: e.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
+ }), 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
- } : {}, d = Q(Y());
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 t = Y();
159
- d.value = t;
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
- }), s = i instanceof Promise ? await i : i, l = {
166
- ...t,
167
- ...s ?? {}
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
+ ...n ?? {}
168
168
  };
169
- L.has(r.schema.type) && (!l.options || !Array.isArray(l.options)) && (l.options = []), d.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), d.value = Y();
171
+ console.error("componentProps 执行错误:", i), p.value = Y();
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
+ p.value = r, L.has(e.schema.type) && (!p.value.options || !Array.isArray(p.value.options)) && (p.value.options = []);
175
175
  }
176
- H(() => r.schema.componentProps, (o, t) => (o || t) && fe(), {
176
+ J(() => e.schema.componentProps, (r, o) => (r || o) && ue(), {
177
177
  immediate: !0
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));
193
+ }
178
194
  });
179
- let k = null;
180
- const B = Q(!1), O = async (o, t) => {
195
+ let A = null;
196
+ const N = G(!1), $ = async (r, o) => {
181
197
  try {
182
198
  const i = {
183
- ...d.value
184
- }, s = L.has(r.schema.type);
185
- d.value = {
199
+ ...p.value
200
+ }, n = L.has(e.schema.type);
201
+ p.value = {
186
202
  ...i,
187
203
  loading: !0,
188
204
  // 清空 options,避免显示旧数据,确保是数组类型
189
- ...s ? {
205
+ ...n ? {
190
206
  options: []
191
207
  } : {}
192
208
  };
193
- const l = await o(f(P)), {
194
- type: u
195
- } = r.schema, p = s ? Array.isArray(l) ? l : [] : l;
196
- s ? d.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 = {
197
213
  ...i,
198
- options: p,
199
- requestResult: l,
214
+ options: u,
215
+ requestResult: a,
200
216
  loading: !1
201
- } : z.has(u) ? d.value = {
217
+ } : z.has(m) ? p.value = {
202
218
  ...i,
203
- data: Array.isArray(l) ? l : l || [],
204
- requestResult: l,
219
+ data: Array.isArray(a) ? a : a || [],
220
+ requestResult: a,
205
221
  loading: !1
206
- } : d.value = {
222
+ } : p.value = {
207
223
  ...i,
208
- requestResult: l,
224
+ requestResult: a,
209
225
  loading: !1
210
- }, t && await t(l, f(P));
226
+ }, o && await o(a, d(P));
211
227
  } catch (i) {
212
228
  console.error("fetchRemoteData 执行错误:", i);
213
- const s = L.has(r.schema.type), l = z.has(r.schema.type);
214
- d.value = {
215
- ...d.value,
229
+ const n = L.has(e.schema.type), a = z.has(e.schema.type);
230
+ p.value = {
231
+ ...p.value,
216
232
  loading: !1,
217
233
  // 确保错误时 options 也是数组
218
- ...s ? {
234
+ ...n ? {
219
235
  options: []
220
236
  } : {},
221
237
  // 确保错误时 tree 组件的 data 也是数组
222
- ...l ? {
238
+ ...a ? {
223
239
  data: []
224
240
  } : {}
225
241
  };
226
242
  } finally {
227
- await J();
243
+ await O();
228
244
  }
229
- }, ee = () => {
230
- const o = d.value?.request;
231
- if (o)
232
- if (C(o))
233
- O(o);
245
+ }, te = () => {
246
+ const r = p.value?.request;
247
+ if (r)
248
+ if (k(r))
249
+ $(r);
234
250
  else {
235
251
  const {
236
- watchFields: t = [],
252
+ watchFields: o = [],
237
253
  options: i = {},
238
- wait: s = 0,
239
- callback: l,
240
- onSuccess: u
241
- } = o;
242
- if (!l) return;
243
- const p = Array.isArray(t) && t.length > 0;
244
- if (i?.immediate && !p) {
245
- B.value || (B.value = !0, O(l, u));
254
+ wait: n = 0,
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));
246
262
  return;
247
263
  }
248
264
  const {
249
- immediate: S,
265
+ immediate: C,
250
266
  ...h
251
- } = i, y = t.map((a) => () => r.formModel[a]), g = s > 0 ? Me(() => {
252
- O(l, u);
253
- }, s) : () => {
254
- O(l, u);
267
+ } = i, y = o.map((s) => () => e.formModel[s]), g = n > 0 ? qe(() => {
268
+ $(a, m);
269
+ }, n) : () => {
270
+ $(a, m);
255
271
  };
256
- k = H(y, g, h), 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)));
257
273
  }
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));
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));
263
279
  }, {
264
280
  immediate: !0
265
- }), H(() => d.value?.request, () => {
281
+ }), J(() => p.value?.request, () => {
266
282
  const {
267
- isIfShow: o,
268
- isShow: t
283
+ isIfShow: r,
284
+ isShow: o
269
285
  } = E();
270
- o && t && J(() => {
271
- k && (k(), k = null), ee();
286
+ r && o && O(() => {
287
+ A && (A(), A = null), te();
272
288
  });
273
289
  });
274
- const j = N(() => {
275
- let o = {
276
- ...d.value
290
+ const K = H(() => {
291
+ let r = {
292
+ ...p.value
277
293
  };
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, {
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;
302
+ }
303
+ const o = /* @__PURE__ */ new Map([[t.Divider, {
280
304
  type: "horizontal"
281
- }], [e.Textarea, {
305
+ }], [t.Textarea, {
282
306
  type: "textarea"
283
- }], [e.Password, {
307
+ }], [t.Password, {
284
308
  type: "password",
285
309
  "show-password": !0
286
- }], [e.InputNumber, {
310
+ }], [t.InputNumber, {
287
311
  type: "number"
288
- }], [e.CheckboxButton, {
312
+ }], [t.CheckboxButton, {
289
313
  useButton: !0
290
- }], [e.RadioButton, {
314
+ }], [t.RadioButton, {
291
315
  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,
316
+ }], [t.YearPicker, {
317
+ type: t.YearPicker
318
+ }], [t.MonthPicker, {
319
+ type: t.MonthPicker
320
+ }], [t.DatePicker, {
321
+ type: t.DatePicker
322
+ }], [t.DatesPicker, {
323
+ type: t.DatesPicker
324
+ }], [t.DateTimePicker, {
325
+ type: t.DateTimePicker
326
+ }], [t.WeekPicker, {
327
+ type: t.WeekPicker
328
+ }], [t.TimeRangePicker, {
329
+ type: t.TimePicker,
306
330
  "is-range": !0,
307
331
  "start-placeholder": "开始时间",
308
332
  "end-placeholder": "结束时间"
309
- }], [e.DateTimeRangePicker, {
310
- type: e.DateTimeRangePicker,
333
+ }], [t.DateTimeRangePicker, {
334
+ type: t.DateTimeRangePicker,
311
335
  "start-placeholder": "开始日期",
312
336
  "end-placeholder": "结束日期"
313
- }], [e.DateRangePicker, {
314
- type: e.DateRangePicker,
337
+ }], [t.DateRangePicker, {
338
+ type: t.DateRangePicker,
315
339
  "start-placeholder": "开始日期",
316
340
  "end-placeholder": "结束日期"
317
- }], [e.MonthRangePicker, {
318
- type: e.MonthRangePicker,
341
+ }], [t.MonthRangePicker, {
342
+ type: t.MonthRangePicker,
319
343
  "start-placeholder": "开始月份",
320
344
  "end-placeholder": "结束月份"
321
345
  }]]);
322
- r.schema.type && t.has(r.schema.type) && (o = Object.assign(t.get(r.schema.type) || {}, o));
323
- 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(() => {
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(() => {
326
350
  const {
327
- disabled: o
328
- } = r.formProps, {
329
- dynamicDisabled: t
330
- } = r.schema, {
351
+ disabled: r
352
+ } = e.formProps, {
353
+ dynamicDisabled: o
354
+ } = e.schema, {
331
355
  disabled: i = !1
332
- } = f(j);
333
- let s = !!o || i;
334
- return X(t) && (s = t), C(t) && (s = t(f(P))), s;
356
+ } = d(K);
357
+ let n = !!r || i;
358
+ return Z(o) && (n = o), k(o) && (n = o(d(P))), n;
335
359
  });
336
360
  function E() {
337
361
  const {
338
- show: o,
339
- ifShow: t
340
- } = 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))), {
362
+ show: r,
363
+ ifShow: o
364
+ } = e.schema;
365
+ let i = !0, n = !0;
366
+ return Z(r) && (i = r), Z(o) && (n = o), k(r) && (i = r(d(P))), k(o) && (n = o(d(P))), {
343
367
  isShow: i,
344
- isIfShow: s
368
+ isIfShow: n
345
369
  };
346
370
  }
347
- function he() {
371
+ function pe() {
348
372
  const {
349
- rules: o = [],
350
- type: t = e.Input,
373
+ rules: r = [],
374
+ type: o = t.Input,
351
375
  rulesMessageJoinLabel: i,
352
- label: s,
353
- title: l,
354
- 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))
376
+ label: n,
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))
359
383
  return [];
360
- const g = s || l;
361
- if (C(u) && !S)
362
- return u(f(P));
363
- let a = ke(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]);
364
388
  const {
365
389
  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();
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();
370
394
  }
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 = [{
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 = [{
373
397
  required: h,
374
- validator: w,
375
- trigger: F ? "change" : "blur"
376
- }, ...a]);
377
- const W = a.findIndex((n) => Reflect.has(n, "required") && !Reflect.has(n, "validator"));
398
+ validator: M,
399
+ trigger: V ? "change" : "blur"
400
+ }, ...s]);
401
+ const W = s.findIndex((l) => Reflect.has(l, "required") && !Reflect.has(l, "validator"));
378
402
  if (W !== -1) {
379
- const n = a[W], {
403
+ const l = s[W], {
380
404
  isShow: c
381
405
  } = E();
382
- c || (n.required = !1), t && (n.message = n.message || v);
406
+ c || (l.required = !1), o && (l.message = l.message || w);
383
407
  }
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();
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();
388
412
  }
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);
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);
394
418
  }
395
- return a;
419
+ return s;
396
420
  }
397
421
  const ye = () => {
398
422
  const {
399
- renderComponentContent: o,
400
- type: t = e.Input,
423
+ renderComponentContent: r,
424
+ type: o = t.Input,
401
425
  field: i,
402
- changeEvent: s = "change",
403
- valueField: l,
404
- label: u,
405
- title: p,
406
- placeholderJoinLabel: S = !0
407
- } = 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,
426
+ changeEvent: n = "change",
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), {
435
+ autoSetPlaceHolder: s,
412
436
  size: R
413
- } = r.formProps, b = {
437
+ } = e.formProps, b = {
414
438
  clearable: !0,
415
- ...f(j)
439
+ ...d(K)
416
440
  };
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 : "");
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 : "");
420
444
  }
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);
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
+ }
455
+ } else {
456
+ const S = c ? c.target : null;
457
+ x = S ? S.value : c;
458
+ }
459
+ e.setFormModel(i, x, e.schema), M && k(M) && O(() => {
460
+ M(...l);
426
461
  });
427
462
  },
428
463
  // 监听 clear 事件,清除错误信息
429
- onClear: (...n) => {
430
- r.updateSchema([{
464
+ onClear: (...l) => {
465
+ e.updateSchema([{
431
466
  field: i,
432
467
  itemProps: {
433
468
  error: ""
434
469
  }
435
- }]), r.formActionType?.clearValidate?.(i), A && C(A) && A(...n);
470
+ }]), e.formActionType?.clearValidate?.(i), I && k(I) && I(...l);
436
471
  }
437
- }, W = {
438
- [l || "model-value"]: r.formModel[i]
472
+ }, W = o === t.Tree ? {} : {
473
+ [a || "model-value"]: e.formModel[i]
439
474
  }, {
440
- [y]: x,
441
- ...M
442
- } = b, V = {
443
- ...M,
444
- ...F,
475
+ [y]: v,
476
+ ...D
477
+ } = b, j = {
478
+ ...D,
479
+ ...V,
445
480
  ...W
446
481
  };
447
- if (!o && t !== e.Upload)
448
- return m(g, $({
449
- ref: U
450
- }, V), null);
451
- let I;
452
- if (I = C(o) ? {
453
- ...o({
454
- ...f(P),
455
- elRef: U
482
+ if (!r && o !== t.Upload)
483
+ return f(g, U({
484
+ ref: F
485
+ }, j), null);
486
+ let T;
487
+ if (T = k(r) ? {
488
+ ...r({
489
+ ...d(P),
490
+ elRef: F
456
491
  })
457
492
  } : {
458
- default: () => o
459
- }, t === e.Upload && !o) {
493
+ default: () => r
494
+ }, o === t.Upload && !r) {
460
495
  const {
461
- drag: n
462
- } = f(j);
463
- I = n ? {
464
- default: () => m(G("vft-icon"), {
496
+ drag: l
497
+ } = d(K);
498
+ T = l ? {
499
+ default: () => f(X("vft-icon"), {
465
500
  icon: "icon-arrow-upload"
466
501
  }, null)
467
502
  } : {
468
- default: () => m(G("vft-button"), {
503
+ default: () => f(X("vft-button"), {
469
504
  type: "primary"
470
505
  }, {
471
- default: () => [m(G("vft-icon"), {
506
+ default: () => [f(X("vft-icon"), {
472
507
  icon: "icon-arrow-upload"
473
508
  }, null)]
474
509
  })
475
510
  };
476
511
  }
477
- return m(g, $({
478
- ref: U
479
- }, V), _(I) ? I : {
480
- default: () => [I]
512
+ return f(g, U({
513
+ ref: F
514
+ }, j), ee(T) ? T : {
515
+ default: () => [T]
481
516
  });
482
517
  };
483
- function K() {
518
+ function Q() {
484
519
  const {
485
- showLabel: o = !0,
486
- label: t,
520
+ showLabel: r = !0,
521
+ label: o,
487
522
  title: i,
488
- subLabel: s,
489
- labelRequired: l,
490
- helpIcon: u,
491
- helpTooltip: p,
492
- labelSuffix: S
493
- } = r.schema, {
523
+ subLabel: n,
524
+ labelRequired: a,
525
+ helpIcon: m,
526
+ helpTooltip: u,
527
+ labelSuffix: C
528
+ } = e.schema, {
494
529
  labelSuffix: h = ""
495
- } = r.formProps, y = S ?? h, g = t || i, a = g ? m("span", null, [l && m("span", {
530
+ } = e.formProps, y = C ?? h, g = o || i, s = g ? f("span", null, [a && f("span", {
496
531
  class: "label-required"
497
- }, [ie("*")]), m("span", null, [g]), y && m("span", {
498
- class: T.m("label-suffix")
532
+ }, [ie("*")]), f("span", null, [g]), y && f("span", {
533
+ class: q.m("label-suffix")
499
534
  }, [y])]) : null, R = () => {
500
- if (!u && !p) return null;
501
- const b = N(() => ae(u, "icon", {
535
+ if (!m && !u) return null;
536
+ const b = H(() => ae(m, "icon", {
502
537
  size: 20,
503
538
  pointer: !0,
504
539
  icon: "icon-help"
505
540
  }));
506
- if (p) {
507
- const v = N(() => ae(p, "content", {
541
+ if (u) {
542
+ const w = H(() => ae(u, "content", {
508
543
  placement: "right-start"
509
544
  }));
510
- return m(De, $({
545
+ return f(De, U({
511
546
  className: "box-item"
512
- }, v.value), {
513
- default: () => [m(se, b.value, null)]
547
+ }, w.value), {
548
+ default: () => [f(le, b.value, null)]
514
549
  });
515
550
  }
516
- return m(se, b.value, null);
551
+ return f(le, b.value, null);
517
552
  };
518
- return o && a ? s ? m("div", {
553
+ return r && s ? n ? f("div", {
519
554
  class: "label-content"
520
- }, [m("div", null, [a, ie(" "), m("span", {
555
+ }, [f("div", null, [s, ie(" "), f("span", {
521
556
  class: "sub-label"
522
- }, [s])]), R()]) : m("div", {
557
+ }, [n])]), R()]) : f("div", {
523
558
  class: "label-content"
524
- }, [m("div", null, [a]), R()]) : void 0;
559
+ }, [f("div", null, [s]), R()]) : void 0;
525
560
  }
526
- const te = be();
527
- function oe(o, t = "default", i) {
528
- if (!o || !Reflect.has(o, t))
561
+ const oe = ke();
562
+ function re(r, o = "default", i) {
563
+ if (!r || !Reflect.has(r, o))
529
564
  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;
565
+ if (!k(r[o]))
566
+ return console.error(`${o} is not a function!`), null;
567
+ const n = r[o];
568
+ return n ? n(i) : null;
534
569
  }
535
570
  function ge() {
536
571
  const {
537
- required: o,
538
- itemProps: t,
572
+ required: r,
573
+ itemProps: o,
539
574
  slot: i,
540
- render: s,
541
- field: l,
542
- suffix: u,
543
- prefix: p,
544
- prefixParentStyle: S
545
- } = r.schema, {
575
+ render: n,
576
+ field: a,
577
+ suffix: m,
578
+ prefix: u,
579
+ prefixParentStyle: C
580
+ } = e.schema, {
546
581
  autoCleanErrorMessage: h,
547
582
  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 = () => {
549
- r.updateSchema([{
550
- 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,
551
586
  itemProps: {
552
587
  error: ""
553
588
  }
554
589
  }]);
555
- }, A = C(o) ? o(f(P)) : o, F = () => m(Ie, $({
590
+ }, I = k(r) ? r(d(P)) : r, V = () => f(Te, U({
556
591
  style: {
557
- marginRight: r.formProps.customLayout ? "10px" : 0
592
+ marginRight: e.formProps.customLayout ? "10px" : 0
558
593
  },
559
- prop: l,
594
+ prop: a,
560
595
  class: [{
561
- [T.is("suffix")]: a
596
+ [q.is("suffix")]: s
562
597
  }, {
563
- [T.is("comp-full-width")]: y
564
- }, T.e("item")]
565
- }, t, {
566
- label: t?.label || t?.title,
567
- "onUpdate:error": h ? w : () => {
598
+ [q.is("comp-full-width")]: y
599
+ }, q.e("item")]
600
+ }, o, {
601
+ label: o?.label || o?.title,
602
+ "onUpdate:error": h ? M : () => {
568
603
  },
569
- rules: he(),
570
- required: A
604
+ rules: pe(),
605
+ required: I
571
606
  }), {
572
- default: () => [m("div", {
573
- class: T.e("container")
574
- }, [m("div", {
575
- class: T.e("content")
576
- }, [g(), a && m("span", {
577
- class: T.m("suffix")
607
+ default: () => [f("div", {
608
+ class: q.e("container")
609
+ }, [f("div", {
610
+ class: q.e("content")
611
+ }, [g(), s && f("span", {
612
+ class: q.m("suffix")
578
613
  }, [b])])])],
579
- label: K() ? () => K() : void 0
614
+ label: Q() ? () => Q() : void 0
580
615
  });
581
- return R ? m("div", {
582
- style: S
583
- }, [m("span", {
584
- class: T.m("prefix")
585
- }, [v]), F()]) : F();
616
+ return R ? f("div", {
617
+ style: C
618
+ }, [f("span", {
619
+ class: q.m("prefix")
620
+ }, [w]), V()]) : V();
586
621
  }
587
622
  return () => {
588
- let o;
623
+ let r;
589
624
  const {
590
- colProps: t = {},
625
+ colProps: o = {},
591
626
  colSlot: i,
592
- renderColContent: s,
593
- type: l = e.Input,
594
- render: u,
595
- quickColSpan: p
596
- } = r.schema;
597
- if (!le(l) && !s && !u)
627
+ renderColContent: n,
628
+ type: a = t.Input,
629
+ render: m,
630
+ quickColSpan: u
631
+ } = e.schema;
632
+ if (!se(a) && !n && !m)
598
633
  return null;
599
634
  const {
600
- baseColProps: S = {},
635
+ baseColProps: C = {},
601
636
  quickColSpan: h
602
- } = r.formProps, y = h ? {
637
+ } = e.formProps, y = h ? {
603
638
  span: Math.ceil(24 / h),
604
- ...S
639
+ ...C
605
640
  } : {
606
- ...S
607
- }, g = p ? {
608
- span: Math.ceil(24 / p),
609
- ...t
641
+ ...C
642
+ }, g = u ? {
643
+ span: Math.ceil(24 / u),
644
+ ...o
610
645
  } : {
611
- ...t
612
- }, a = {
646
+ ...o
647
+ }, s = {
613
648
  ...y,
614
649
  ...g
615
650
  }, {
616
651
  isIfShow: R,
617
652
  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, $({
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({
622
657
  span: 24
623
658
  }, g), {
624
- default: () => [m(Ae, f(j), _(A = K()) ? A : {
625
- default: () => [A]
659
+ default: () => [f(Ie, d(K), ee(I = Q()) ? I : {
660
+ default: () => [I]
626
661
  })]
627
662
  });
628
663
  }
629
- return R && (r.formProps.customLayout ? w() : Pe(m(ne, a, _(o = w()) ? o : {
630
- default: () => [o]
631
- }), [[Ce, b]]));
664
+ return R && (e.formProps.customLayout ? M() : Ce(f(ne, s, ee(r = M()) ? r : {
665
+ default: () => [r]
666
+ }), [[Se, b]]));
632
667
  };
633
668
  }
634
669
  });