vft 0.0.496 → 0.0.498

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