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.
- package/dist/index.css +1 -1
- package/es/component.js +18 -16
- package/es/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/es/components/autocomplete/index.d.ts +6 -6
- package/es/components/button/index.d.ts +9 -9
- package/es/components/index.d.ts +1 -0
- package/es/components/index.js +257 -255
- package/es/components/modal/index.d.ts +6 -0
- package/es/components/modal/modal.vue.d.ts +3 -0
- package/es/components/modal/modal.vue2.js +12 -12
- package/es/components/popconfirm/index.d.ts +15 -15
- package/es/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/es/components/select/defaults.d.ts +4 -0
- package/es/components/select/defaults.js +7 -3
- package/es/components/select/index.d.ts +13 -4
- package/es/components/select/select.vue.d.ts +13 -4
- package/es/components/select/select.vue.js +9 -8
- package/es/components/select/select.vue2.js +40 -29
- package/es/components/select/token.d.ts +4 -1
- package/es/components/select/useSelect.d.ts +4 -4
- package/es/components/super-form/index.d.ts +9 -0
- package/es/components/super-form/style/css.d.ts +1 -0
- package/es/components/super-form/style/css.js +2 -0
- package/es/components/super-form/style/index.d.ts +1 -0
- package/es/components/super-form/style/index.js +2 -0
- package/es/components/super-form/super-form-item.vue2.js +355 -255
- package/es/components/super-form/super-form.vue2.js +1 -1
- package/es/components/super-form/types.d.ts +26 -1
- package/es/components/super-form/use/helper.js +37 -36
- package/es/components/super-form/use/use-form-events.js +126 -125
- package/es/components/table/index.d.ts +9 -6
- package/es/components/table/style/css.js +2 -0
- package/es/components/table/style/index.js +2 -0
- package/es/components/table/table.vue.d.ts +2 -1
- package/es/components/table/table.vue2.js +99 -94
- package/es/components/table/types.d.ts +5 -3
- package/es/components/table/use/use-data-source.d.ts +6 -4
- package/es/components/table/use/use-data-source.js +150 -148
- package/es/components/table/use/use-table.js +8 -8
- package/es/components/tree/index.d.ts +71 -71
- package/es/components/tree/tree-node.vue.d.ts +1 -1
- package/es/components/tree/tree.type.d.ts +2 -0
- package/es/components/tree/tree.vue.d.ts +14 -14
- package/es/components/tree-select/cache-options.d.ts +20 -0
- package/es/components/tree-select/cache-options.js +30 -0
- package/es/components/tree-select/index.d.ts +8 -0
- package/es/components/tree-select/index.js +10 -0
- package/es/components/tree-select/instance.d.ts +5 -0
- package/es/components/tree-select/instance.js +1 -0
- package/es/components/tree-select/select.d.ts +10 -0
- package/es/components/tree-select/select.js +129 -0
- package/es/components/tree-select/style/css.d.ts +4 -0
- package/es/components/tree-select/style/css.js +11 -0
- package/es/components/tree-select/style/index.d.ts +4 -0
- package/es/components/tree-select/style/index.js +11 -0
- package/es/components/tree-select/tree-select-option.d.ts +42 -0
- package/es/components/tree-select/tree-select-option.js +35 -0
- package/es/components/tree-select/tree-select.vue.d.ts +4 -0
- package/es/components/tree-select/tree-select.vue.js +5 -0
- package/es/components/tree-select/tree-select.vue2.js +155 -0
- package/es/components/tree-select/tree.d.ts +11 -0
- package/es/components/tree-select/tree.js +201 -0
- package/es/components/tree-select/utils.d.ts +10 -0
- package/es/components/tree-select/utils.js +45 -0
- package/es/index.js +1 -0
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/es/script.css +1 -1
- package/es/utils/form-register.d.ts +1 -0
- package/es/utils/form-register.js +11 -10
- package/lib/component.cjs +1 -1
- package/lib/components/autocomplete/autocomplete.vue.d.ts +2 -2
- package/lib/components/autocomplete/index.d.ts +6 -6
- package/lib/components/button/index.d.ts +9 -9
- package/lib/components/index.cjs +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/modal/index.d.ts +6 -0
- package/lib/components/modal/modal.vue.d.ts +3 -0
- package/lib/components/modal/modal.vue2.cjs +1 -1
- package/lib/components/popconfirm/index.d.ts +15 -15
- package/lib/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/lib/components/select/defaults.cjs +1 -1
- package/lib/components/select/defaults.d.ts +4 -0
- package/lib/components/select/index.d.ts +13 -4
- package/lib/components/select/select.vue.cjs +1 -1
- package/lib/components/select/select.vue.d.ts +13 -4
- package/lib/components/select/select.vue2.cjs +1 -1
- package/lib/components/select/token.d.ts +4 -1
- package/lib/components/select/useSelect.d.ts +4 -4
- package/lib/components/super-form/index.d.ts +9 -0
- package/lib/components/super-form/style/css.cjs +1 -1
- package/lib/components/super-form/style/css.d.ts +1 -0
- package/lib/components/super-form/style/index.cjs +1 -1
- package/lib/components/super-form/style/index.d.ts +1 -0
- package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
- package/lib/components/super-form/super-form.vue2.cjs +1 -1
- package/lib/components/super-form/types.d.ts +26 -1
- package/lib/components/super-form/use/helper.cjs +1 -1
- package/lib/components/super-form/use/use-form-events.cjs +1 -1
- package/lib/components/table/index.d.ts +9 -6
- package/lib/components/table/style/css.cjs +1 -1
- package/lib/components/table/style/index.cjs +1 -1
- package/lib/components/table/table.vue.d.ts +2 -1
- package/lib/components/table/table.vue2.cjs +1 -1
- package/lib/components/table/types.d.ts +5 -3
- package/lib/components/table/use/use-data-source.cjs +1 -1
- package/lib/components/table/use/use-data-source.d.ts +6 -4
- package/lib/components/table/use/use-table.cjs +1 -1
- package/lib/components/tree/index.d.ts +71 -71
- package/lib/components/tree/tree-node.vue.d.ts +1 -1
- package/lib/components/tree/tree.type.d.ts +2 -0
- package/lib/components/tree/tree.vue.d.ts +14 -14
- package/lib/components/tree-select/cache-options.cjs +1 -0
- package/lib/components/tree-select/cache-options.d.ts +20 -0
- package/lib/components/tree-select/index.cjs +1 -0
- package/lib/components/tree-select/index.d.ts +8 -0
- package/lib/components/tree-select/instance.cjs +1 -0
- package/lib/components/tree-select/instance.d.ts +5 -0
- package/lib/components/tree-select/select.cjs +1 -0
- package/lib/components/tree-select/select.d.ts +10 -0
- package/lib/components/tree-select/style/css.cjs +1 -0
- package/lib/components/tree-select/style/css.d.ts +4 -0
- package/lib/components/tree-select/style/index.cjs +1 -0
- package/lib/components/tree-select/style/index.d.ts +4 -0
- package/lib/components/tree-select/tree-select-option.cjs +1 -0
- package/lib/components/tree-select/tree-select-option.d.ts +42 -0
- package/lib/components/tree-select/tree-select.vue.cjs +1 -0
- package/lib/components/tree-select/tree-select.vue.d.ts +4 -0
- package/lib/components/tree-select/tree-select.vue2.cjs +1 -0
- package/lib/components/tree-select/tree.cjs +1 -0
- package/lib/components/tree-select/tree.d.ts +11 -0
- package/lib/components/tree-select/utils.cjs +1 -0
- package/lib/components/tree-select/utils.d.ts +10 -0
- package/lib/index.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/lib/script.css +1 -1
- package/lib/utils/form-register.cjs +1 -1
- package/lib/utils/form-register.d.ts +1 -0
- package/package.json +5 -5
- package/theme-style/index.css +1 -1
- package/theme-style/src/cascader.scss +1 -12
- package/theme-style/src/tree-select.scss +10 -1
- package/theme-style/vft-cascader.css +1 -1
- package/theme-style/vft-tree-select.css +1 -1
- package/web-types.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
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
|
|
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
|
|
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
|
|
23
|
+
import { VftIcon as se } from "../icon/index.js";
|
|
24
24
|
import "../date-picker/index.js";
|
|
25
25
|
import "../date-time-select/index.js";
|
|
26
26
|
import "../descriptions/index.js";
|
|
27
27
|
import "../dialog/index.js";
|
|
28
|
-
import { VftDivider as
|
|
28
|
+
import { VftDivider as 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
114
|
-
import { createPlaceholderMessage as
|
|
115
|
-
function
|
|
116
|
-
return typeof
|
|
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
|
|
119
|
+
const Fe = me({
|
|
119
120
|
inheritAttrs: !1
|
|
120
|
-
}),
|
|
121
|
-
...
|
|
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(
|
|
133
|
-
const
|
|
133
|
+
setup(r) {
|
|
134
|
+
const T = Te("super-form"), U = Q(), P = N(() => {
|
|
134
135
|
const {
|
|
135
|
-
mergeDynamicData:
|
|
136
|
-
} =
|
|
136
|
+
mergeDynamicData: o
|
|
137
|
+
} = r.formProps;
|
|
137
138
|
return {
|
|
138
|
-
field:
|
|
139
|
-
model:
|
|
139
|
+
field: r.schema.field,
|
|
140
|
+
model: r.formModel,
|
|
140
141
|
values: {
|
|
141
|
-
...
|
|
142
|
-
...
|
|
143
|
-
...
|
|
142
|
+
...o,
|
|
143
|
+
...r.allDefaultValues,
|
|
144
|
+
...r.formModel
|
|
144
145
|
},
|
|
145
|
-
schema:
|
|
146
|
-
elRef:
|
|
146
|
+
schema: r.schema,
|
|
147
|
+
elRef: U,
|
|
148
|
+
formActionType: r.formActionType
|
|
147
149
|
};
|
|
148
|
-
}),
|
|
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
|
-
} : {},
|
|
151
|
-
async function
|
|
152
|
+
} : {}, d = Q(Y());
|
|
153
|
+
async function fe() {
|
|
152
154
|
const {
|
|
153
|
-
componentProps:
|
|
154
|
-
} =
|
|
155
|
-
if (
|
|
156
|
-
const t =
|
|
157
|
-
|
|
155
|
+
componentProps: o = {}
|
|
156
|
+
} = r.schema;
|
|
157
|
+
if (C(o)) {
|
|
158
|
+
const t = Y();
|
|
159
|
+
d.value = t;
|
|
158
160
|
try {
|
|
159
|
-
const
|
|
160
|
-
schema:
|
|
161
|
-
formModel:
|
|
162
|
-
formActionType:
|
|
163
|
-
}), s =
|
|
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
|
-
|
|
169
|
-
|
|
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
|
-
|
|
174
|
+
d.value = o, L.has(r.schema.type) && (!d.value.options || !Array.isArray(d.value.options)) && (d.value.options = []);
|
|
173
175
|
}
|
|
174
|
-
|
|
176
|
+
H(() => r.schema.componentProps, (o, t) => (o || t) && fe(), {
|
|
175
177
|
immediate: !0
|
|
176
178
|
});
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
-
|
|
225
|
-
const
|
|
226
|
-
return
|
|
227
|
-
}),
|
|
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:
|
|
230
|
-
} =
|
|
327
|
+
disabled: o
|
|
328
|
+
} = r.formProps, {
|
|
231
329
|
dynamicDisabled: t
|
|
232
|
-
} =
|
|
233
|
-
disabled:
|
|
234
|
-
} =
|
|
235
|
-
let s = !!
|
|
236
|
-
return
|
|
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
|
|
336
|
+
function E() {
|
|
239
337
|
const {
|
|
240
|
-
show:
|
|
338
|
+
show: o,
|
|
241
339
|
ifShow: t
|
|
242
|
-
} =
|
|
243
|
-
let
|
|
244
|
-
return
|
|
245
|
-
isShow:
|
|
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
|
|
347
|
+
function he() {
|
|
250
348
|
const {
|
|
251
|
-
rules:
|
|
349
|
+
rules: o = [],
|
|
252
350
|
type: t = e.Input,
|
|
253
|
-
rulesMessageJoinLabel:
|
|
351
|
+
rulesMessageJoinLabel: i,
|
|
254
352
|
label: s,
|
|
255
|
-
title:
|
|
256
|
-
dynamicRule:
|
|
257
|
-
required:
|
|
258
|
-
dynamicRuleAdd:
|
|
259
|
-
} =
|
|
260
|
-
if (!
|
|
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 ||
|
|
263
|
-
if (
|
|
264
|
-
return
|
|
265
|
-
let
|
|
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:
|
|
268
|
-
} =
|
|
269
|
-
function
|
|
270
|
-
const
|
|
271
|
-
return
|
|
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
|
|
274
|
-
(!
|
|
275
|
-
required:
|
|
276
|
-
validator:
|
|
277
|
-
trigger:
|
|
278
|
-
}]);
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
281
|
-
const
|
|
282
|
-
isShow:
|
|
283
|
-
} =
|
|
284
|
-
|
|
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
|
|
287
|
-
function
|
|
288
|
-
const
|
|
289
|
-
return ["min", "all"].includes(
|
|
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
|
-
(
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
294
|
-
let
|
|
295
|
-
|
|
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
|
|
395
|
+
return a;
|
|
298
396
|
}
|
|
299
|
-
const
|
|
397
|
+
const ye = () => {
|
|
300
398
|
const {
|
|
301
|
-
renderComponentContent:
|
|
399
|
+
renderComponentContent: o,
|
|
302
400
|
type: t = e.Input,
|
|
303
|
-
field:
|
|
401
|
+
field: i,
|
|
304
402
|
changeEvent: s = "change",
|
|
305
|
-
valueField:
|
|
306
|
-
label:
|
|
307
|
-
title:
|
|
308
|
-
placeholderJoinLabel:
|
|
309
|
-
} =
|
|
310
|
-
let
|
|
311
|
-
|
|
312
|
-
const
|
|
313
|
-
autoSetPlaceHolder:
|
|
314
|
-
size:
|
|
315
|
-
} =
|
|
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
|
-
...
|
|
415
|
+
...f(j)
|
|
318
416
|
};
|
|
319
|
-
if (t !== e.Search && (
|
|
320
|
-
const
|
|
321
|
-
|
|
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
|
|
324
|
-
[
|
|
325
|
-
const [
|
|
326
|
-
|
|
327
|
-
|
|
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: (...
|
|
332
|
-
|
|
333
|
-
field:
|
|
429
|
+
onClear: (...n) => {
|
|
430
|
+
r.updateSchema([{
|
|
431
|
+
field: i,
|
|
334
432
|
itemProps: {
|
|
335
433
|
error: ""
|
|
336
434
|
}
|
|
337
|
-
}]),
|
|
435
|
+
}]), r.formActionType?.clearValidate?.(i), A && C(A) && A(...n);
|
|
338
436
|
}
|
|
339
|
-
},
|
|
340
|
-
[
|
|
437
|
+
}, W = {
|
|
438
|
+
[l || "model-value"]: r.formModel[i]
|
|
341
439
|
}, {
|
|
342
|
-
[
|
|
343
|
-
...
|
|
344
|
-
} =
|
|
345
|
-
...
|
|
346
|
-
...
|
|
347
|
-
...
|
|
440
|
+
[y]: x,
|
|
441
|
+
...M
|
|
442
|
+
} = b, V = {
|
|
443
|
+
...M,
|
|
444
|
+
...F,
|
|
445
|
+
...W
|
|
348
446
|
};
|
|
349
|
-
if (!
|
|
350
|
-
return
|
|
351
|
-
ref:
|
|
352
|
-
},
|
|
353
|
-
let
|
|
354
|
-
if (
|
|
355
|
-
...
|
|
356
|
-
...
|
|
357
|
-
elRef:
|
|
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: () =>
|
|
361
|
-
}, t === e.Upload && !
|
|
458
|
+
default: () => o
|
|
459
|
+
}, t === e.Upload && !o) {
|
|
362
460
|
const {
|
|
363
|
-
drag:
|
|
364
|
-
} =
|
|
365
|
-
|
|
366
|
-
default: () =>
|
|
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: () =>
|
|
468
|
+
default: () => m(G("vft-button"), {
|
|
371
469
|
type: "primary"
|
|
372
470
|
}, {
|
|
373
|
-
default: () => [
|
|
471
|
+
default: () => [m(G("vft-icon"), {
|
|
374
472
|
icon: "icon-arrow-upload"
|
|
375
473
|
}, null)]
|
|
376
474
|
})
|
|
377
475
|
};
|
|
378
476
|
}
|
|
379
|
-
return
|
|
380
|
-
ref:
|
|
381
|
-
},
|
|
382
|
-
default: () => [
|
|
477
|
+
return m(g, $({
|
|
478
|
+
ref: U
|
|
479
|
+
}, V), _(I) ? I : {
|
|
480
|
+
default: () => [I]
|
|
383
481
|
});
|
|
384
482
|
};
|
|
385
|
-
function
|
|
483
|
+
function K() {
|
|
386
484
|
const {
|
|
387
|
-
showLabel:
|
|
485
|
+
showLabel: o = !0,
|
|
388
486
|
label: t,
|
|
389
|
-
title:
|
|
487
|
+
title: i,
|
|
390
488
|
subLabel: s,
|
|
391
|
-
labelRequired:
|
|
392
|
-
helpIcon:
|
|
393
|
-
helpTooltip:
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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
|
-
}, [
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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 (
|
|
407
|
-
const
|
|
506
|
+
if (p) {
|
|
507
|
+
const v = N(() => ae(p, "content", {
|
|
408
508
|
placement: "right-start"
|
|
409
509
|
}));
|
|
410
|
-
return
|
|
510
|
+
return m(De, $({
|
|
411
511
|
className: "box-item"
|
|
412
|
-
},
|
|
413
|
-
default: () => [
|
|
512
|
+
}, v.value), {
|
|
513
|
+
default: () => [m(se, b.value, null)]
|
|
414
514
|
});
|
|
415
515
|
}
|
|
416
|
-
return
|
|
516
|
+
return m(se, b.value, null);
|
|
417
517
|
};
|
|
418
|
-
return
|
|
518
|
+
return o && a ? s ? m("div", {
|
|
419
519
|
class: "label-content"
|
|
420
|
-
}, [
|
|
520
|
+
}, [m("div", null, [a, ie(" "), m("span", {
|
|
421
521
|
class: "sub-label"
|
|
422
|
-
}, [s])]),
|
|
522
|
+
}, [s])]), R()]) : m("div", {
|
|
423
523
|
class: "label-content"
|
|
424
|
-
}, [
|
|
524
|
+
}, [m("div", null, [a]), R()]) : void 0;
|
|
425
525
|
}
|
|
426
|
-
const
|
|
427
|
-
function
|
|
428
|
-
if (!
|
|
526
|
+
const te = be();
|
|
527
|
+
function oe(o, t = "default", i) {
|
|
528
|
+
if (!o || !Reflect.has(o, t))
|
|
429
529
|
return null;
|
|
430
|
-
if (!
|
|
530
|
+
if (!C(o[t]))
|
|
431
531
|
return console.error(`${t} is not a function!`), null;
|
|
432
|
-
const s =
|
|
433
|
-
return s ? s(
|
|
532
|
+
const s = o[t];
|
|
533
|
+
return s ? s(i) : null;
|
|
434
534
|
}
|
|
435
|
-
function
|
|
535
|
+
function ge() {
|
|
436
536
|
const {
|
|
437
|
-
required:
|
|
537
|
+
required: o,
|
|
438
538
|
itemProps: t,
|
|
439
|
-
slot:
|
|
539
|
+
slot: i,
|
|
440
540
|
render: s,
|
|
441
|
-
field:
|
|
442
|
-
suffix:
|
|
443
|
-
prefix:
|
|
444
|
-
prefixParentStyle:
|
|
445
|
-
} =
|
|
446
|
-
autoCleanErrorMessage:
|
|
447
|
-
compFullWidth:
|
|
448
|
-
} =
|
|
449
|
-
|
|
450
|
-
field:
|
|
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
|
-
},
|
|
555
|
+
}, A = C(o) ? o(f(P)) : o, F = () => m(Ie, $({
|
|
456
556
|
style: {
|
|
457
|
-
marginRight:
|
|
557
|
+
marginRight: r.formProps.customLayout ? "10px" : 0
|
|
458
558
|
},
|
|
459
|
-
prop:
|
|
559
|
+
prop: l,
|
|
460
560
|
class: [{
|
|
461
|
-
[
|
|
561
|
+
[T.is("suffix")]: a
|
|
462
562
|
}, {
|
|
463
|
-
[
|
|
464
|
-
},
|
|
563
|
+
[T.is("comp-full-width")]: y
|
|
564
|
+
}, T.e("item")]
|
|
465
565
|
}, t, {
|
|
466
566
|
label: t?.label || t?.title,
|
|
467
|
-
"onUpdate:error":
|
|
567
|
+
"onUpdate:error": h ? w : () => {
|
|
468
568
|
},
|
|
469
|
-
rules:
|
|
470
|
-
required:
|
|
569
|
+
rules: he(),
|
|
570
|
+
required: A
|
|
471
571
|
}), {
|
|
472
|
-
default: () => [
|
|
473
|
-
class:
|
|
474
|
-
}, [
|
|
475
|
-
class:
|
|
476
|
-
}, [g(),
|
|
477
|
-
class:
|
|
478
|
-
}, [
|
|
479
|
-
label:
|
|
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
|
|
482
|
-
style:
|
|
483
|
-
}, [
|
|
484
|
-
class:
|
|
485
|
-
}, [
|
|
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
|
|
588
|
+
let o;
|
|
489
589
|
const {
|
|
490
590
|
colProps: t = {},
|
|
491
|
-
colSlot:
|
|
591
|
+
colSlot: i,
|
|
492
592
|
renderColContent: s,
|
|
493
|
-
type:
|
|
494
|
-
render:
|
|
495
|
-
quickColSpan:
|
|
496
|
-
} =
|
|
497
|
-
if (!
|
|
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:
|
|
501
|
-
quickColSpan:
|
|
502
|
-
} =
|
|
503
|
-
span: Math.ceil(24 /
|
|
504
|
-
...
|
|
600
|
+
baseColProps: S = {},
|
|
601
|
+
quickColSpan: h
|
|
602
|
+
} = r.formProps, y = h ? {
|
|
603
|
+
span: Math.ceil(24 / h),
|
|
604
|
+
...S
|
|
505
605
|
} : {
|
|
506
|
-
...
|
|
507
|
-
}, g =
|
|
508
|
-
span: Math.ceil(24 /
|
|
606
|
+
...S
|
|
607
|
+
}, g = p ? {
|
|
608
|
+
span: Math.ceil(24 / p),
|
|
509
609
|
...t
|
|
510
610
|
} : {
|
|
511
611
|
...t
|
|
512
|
-
},
|
|
513
|
-
...
|
|
612
|
+
}, a = {
|
|
613
|
+
...y,
|
|
514
614
|
...g
|
|
515
615
|
}, {
|
|
516
|
-
isIfShow:
|
|
517
|
-
isShow:
|
|
518
|
-
} =
|
|
519
|
-
if (
|
|
520
|
-
let
|
|
521
|
-
return
|
|
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: () => [
|
|
525
|
-
default: () => [
|
|
624
|
+
default: () => [m(Ae, f(j), _(A = K()) ? A : {
|
|
625
|
+
default: () => [A]
|
|
526
626
|
})]
|
|
527
627
|
});
|
|
528
628
|
}
|
|
529
|
-
return
|
|
530
|
-
default: () => [
|
|
531
|
-
}), [[
|
|
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
|
-
|
|
636
|
+
Wo as default
|
|
537
637
|
};
|