vft 0.0.487 → 0.0.493
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/es/components/dialog/use-dialog.js +11 -11
- package/es/components/message/message.vue2.js +45 -42
- package/es/components/message/types.d.ts +8 -2
- package/es/components/message/types.js +2 -1
- package/es/components/modal/modal-footer-action.vue.d.ts +1 -1
- package/es/components/modal/modal-footer-action.vue2.js +13 -15
- package/es/components/modal/modal.vue2.js +35 -36
- package/es/components/super-form/index.d.ts +30 -24
- package/es/components/super-form/super-form-item.vue2.js +263 -231
- package/es/components/super-form/super-form.vue.d.ts +3 -1
- package/es/components/super-form/super-form.vue2.js +153 -132
- package/es/components/super-form/types.d.ts +4 -2
- package/es/components/super-form/use/helper.d.ts +34 -0
- package/es/components/super-form/use/helper.js +81 -34
- package/es/components/switch/index.d.ts +1 -0
- package/es/components/switch/switch.vue.d.ts +1 -25
- package/es/components/switch/types.d.ts +25 -0
- package/es/components/switch/types.js +1 -0
- package/es/components/table/index.d.ts +6 -0
- package/es/components/table/table.vue.d.ts +4 -0
- package/es/components/table/table.vue2.js +164 -149
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/es/utils/form-register.d.ts +1 -1
- package/es/utils/form-register.js +1 -1
- package/lib/components/dialog/use-dialog.cjs +1 -1
- package/lib/components/message/message.vue2.cjs +1 -1
- package/lib/components/message/types.cjs +1 -1
- package/lib/components/message/types.d.ts +8 -2
- package/lib/components/modal/modal-footer-action.vue.d.ts +1 -1
- package/lib/components/modal/modal-footer-action.vue2.cjs +1 -1
- package/lib/components/modal/modal.vue2.cjs +1 -1
- package/lib/components/super-form/index.d.ts +30 -24
- package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
- package/lib/components/super-form/super-form.vue.d.ts +3 -1
- package/lib/components/super-form/super-form.vue2.cjs +1 -1
- package/lib/components/super-form/types.d.ts +4 -2
- package/lib/components/super-form/use/helper.cjs +1 -1
- package/lib/components/super-form/use/helper.d.ts +34 -0
- package/lib/components/switch/index.d.ts +1 -0
- package/lib/components/switch/switch.vue.d.ts +1 -25
- package/lib/components/switch/types.cjs +1 -0
- package/lib/components/switch/types.d.ts +25 -0
- package/lib/components/table/index.d.ts +6 -0
- package/lib/components/table/table.vue.d.ts +4 -0
- package/lib/components/table/table.vue2.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/lib/utils/form-register.cjs +1 -1
- package/lib/utils/form-register.d.ts +1 -1
- package/package.json +5 -5
- package/tags.json +1 -1
- package/theme-style/index.css +1 -1
- package/theme-style/src/dialog.scss +1 -1
- package/theme-style/src/message.scss +8 -4
- package/theme-style/src/super-form.scss +6 -0
- package/theme-style/src/table.scss +25 -6
- package/theme-style/vft-dialog.css +1 -1
- package/theme-style/vft-message.css +1 -1
- package/theme-style/vft-super-form.css +1 -1
- package/theme-style/vft-table.css +1 -1
- package/web-types.json +1 -1
|
@@ -46,6 +46,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
46
46
|
getSchema: import("vue").ComputedRef<FormSchema[]>;
|
|
47
47
|
setFormItemError: (field: string, errMess: string) => Promise<void>;
|
|
48
48
|
formModel: import("vue").ComputedRef<Recordable>;
|
|
49
|
+
hasActionButton: import("vue").ComputedRef<boolean>;
|
|
50
|
+
willExceedOneRow: import("vue").ComputedRef<boolean>;
|
|
49
51
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
50
52
|
register: (instance: Partial<FormActionType>) => void;
|
|
51
53
|
reset: (data: Recordable) => void;
|
|
@@ -89,11 +91,11 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
89
91
|
showResetButton: boolean;
|
|
90
92
|
showSubmitButton: boolean;
|
|
91
93
|
showCommonButton: boolean;
|
|
94
|
+
quickColSpan: number;
|
|
92
95
|
rulesMessageJoinLabel: boolean;
|
|
93
96
|
autoCleanErrorMessage: boolean;
|
|
94
97
|
compFullWidth: boolean;
|
|
95
98
|
autoSetPlaceHolder: boolean;
|
|
96
|
-
quickColSpan: number;
|
|
97
99
|
rowProps: import("vft/es/components/row").RowProps;
|
|
98
100
|
autoFocusFirstItem: boolean;
|
|
99
101
|
autoSubmitOnEnter: boolean;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { VftCol as
|
|
3
|
-
import { VftForm as
|
|
4
|
-
import { VftRow as
|
|
5
|
-
import { useTimeoutFn as
|
|
6
|
-
import { cloneDeep as
|
|
1
|
+
import { defineComponent as J, useAttrs as le, reactive as ue, ref as m, computed as u, unref as n, watch as d, nextTick as ie, useSlots as me, createBlock as i, createCommentVNode as U, openBlock as l, mergeProps as B, withKeys as fe, withModifiers as ce, withCtx as h, renderSlot as O, normalizeProps as W, createElementBlock as pe, Fragment as de, renderList as j, createSlots as Be, resolveDynamicComponent as A, h as he } from "vue";
|
|
2
|
+
import { VftCol as ye } from "../col/index.js";
|
|
3
|
+
import { VftForm as ve } from "../form/index.js";
|
|
4
|
+
import { VftRow as be } from "../row/index.js";
|
|
5
|
+
import { useTimeoutFn as ge, useDebounceFn as we } from "@vueuse/core";
|
|
6
|
+
import { cloneDeep as Fe, isEqual as Re, pick as Se, deepMerge as Ce } from "@vft/utils";
|
|
7
7
|
import "../config-provider/hooks/use-global-config.js";
|
|
8
8
|
import "lodash-es";
|
|
9
|
-
import { useNamespace as
|
|
9
|
+
import { useNamespace as ke } from "../../hooks/use-namespace/index.js";
|
|
10
10
|
import "../../hooks/use-model-toggle/index.js";
|
|
11
11
|
import "@popperjs/core";
|
|
12
12
|
import "../../hooks/use-z-index/index.js";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import Ee from "./super-form-action.vue2.js";
|
|
14
|
+
import Oe from "./super-form-item.vue2.js";
|
|
15
15
|
import { useAutoFocus as Ae } from "./use/use-auto-focus.js";
|
|
16
|
-
import { createFormContext as
|
|
17
|
-
import { useFormEvents as
|
|
18
|
-
import { useFormValues as
|
|
19
|
-
|
|
16
|
+
import { createFormContext as Pe } from "./use/use-form-context.js";
|
|
17
|
+
import { useFormEvents as Ve } from "./use/use-form-events.js";
|
|
18
|
+
import { useFormValues as Ie } from "./use/use-form-values.js";
|
|
19
|
+
import { willFormExceedOneRow as Me } from "./use/helper.js";
|
|
20
|
+
const _e = J({
|
|
20
21
|
name: "vft-super-form"
|
|
21
|
-
}),
|
|
22
|
-
...
|
|
22
|
+
}), et = /* @__PURE__ */ J({
|
|
23
|
+
..._e,
|
|
23
24
|
props: {
|
|
24
25
|
size: {
|
|
25
26
|
default: "default"
|
|
@@ -148,186 +149,206 @@ const Ve = j({
|
|
|
148
149
|
}
|
|
149
150
|
},
|
|
150
151
|
emits: ["register", "reset", "submit", "field-value-change", "common-btn-click"],
|
|
151
|
-
setup(
|
|
152
|
-
expose:
|
|
153
|
-
emit:
|
|
152
|
+
setup(Q, {
|
|
153
|
+
expose: X,
|
|
154
|
+
emit: Y
|
|
154
155
|
}) {
|
|
155
|
-
const P =
|
|
156
|
+
const P = Q, y = Y, V = ke("super-form"), Z = le(), r = ue({}), p = m({}), v = m(!1), b = m({}), I = m(), g = m(null), M = m(), t = u(() => ({
|
|
156
157
|
...P,
|
|
157
|
-
...
|
|
158
|
-
})),
|
|
158
|
+
...n(b)
|
|
159
|
+
})), f = u(() => ({
|
|
159
160
|
...Z,
|
|
160
161
|
...P,
|
|
161
|
-
...
|
|
162
|
-
})),
|
|
163
|
-
const e =
|
|
164
|
-
return
|
|
162
|
+
...n(t)
|
|
163
|
+
})), a = u(() => {
|
|
164
|
+
const e = n(I);
|
|
165
|
+
return Fe(e);
|
|
165
166
|
}), {
|
|
166
|
-
handleFormValues:
|
|
167
|
-
initDefault:
|
|
168
|
-
} =
|
|
167
|
+
handleFormValues: _,
|
|
168
|
+
initDefault: ee
|
|
169
|
+
} = Ie({
|
|
169
170
|
getProps: t,
|
|
170
|
-
defaultValueRef:
|
|
171
|
-
getSchema:
|
|
171
|
+
defaultValueRef: p,
|
|
172
|
+
getSchema: a,
|
|
172
173
|
formModel: r
|
|
173
174
|
});
|
|
174
175
|
Ae({
|
|
175
|
-
getSchema:
|
|
176
|
+
getSchema: a,
|
|
176
177
|
getProps: t,
|
|
177
|
-
isInitedDefault:
|
|
178
|
-
formElRef:
|
|
178
|
+
isInitedDefault: v,
|
|
179
|
+
formElRef: g
|
|
179
180
|
});
|
|
180
181
|
const {
|
|
181
|
-
handleSubmit:
|
|
182
|
+
handleSubmit: c,
|
|
182
183
|
setFieldsValue: w,
|
|
183
184
|
clearValidate: D,
|
|
184
185
|
validate: T,
|
|
185
|
-
validateField:
|
|
186
|
-
getFieldsValue:
|
|
187
|
-
updateSchema:
|
|
188
|
-
resetSchema:
|
|
189
|
-
appendSchemaByField:
|
|
190
|
-
removeSchemaByField:
|
|
191
|
-
resetFields:
|
|
192
|
-
scrollToField:
|
|
193
|
-
getFieldValue:
|
|
194
|
-
setFormItemError:
|
|
195
|
-
} =
|
|
196
|
-
emit:
|
|
186
|
+
validateField: x,
|
|
187
|
+
getFieldsValue: F,
|
|
188
|
+
updateSchema: R,
|
|
189
|
+
resetSchema: S,
|
|
190
|
+
appendSchemaByField: q,
|
|
191
|
+
removeSchemaByField: L,
|
|
192
|
+
resetFields: C,
|
|
193
|
+
scrollToField: te,
|
|
194
|
+
getFieldValue: $,
|
|
195
|
+
setFormItemError: N
|
|
196
|
+
} = Ve({
|
|
197
|
+
emit: y,
|
|
197
198
|
getProps: t,
|
|
198
199
|
formModel: r,
|
|
199
|
-
getSchema:
|
|
200
|
-
defaultValueRef:
|
|
201
|
-
formElRef:
|
|
202
|
-
schemaRef:
|
|
203
|
-
handleFormValues:
|
|
204
|
-
initValues:
|
|
200
|
+
getSchema: a,
|
|
201
|
+
defaultValueRef: p,
|
|
202
|
+
formElRef: g,
|
|
203
|
+
schemaRef: I,
|
|
204
|
+
handleFormValues: _,
|
|
205
|
+
initValues: M
|
|
205
206
|
});
|
|
206
|
-
|
|
207
|
-
resetAction:
|
|
208
|
-
submitAction:
|
|
209
|
-
commonAction: () =>
|
|
210
|
-
}),
|
|
207
|
+
Pe({
|
|
208
|
+
resetAction: C,
|
|
209
|
+
submitAction: c,
|
|
210
|
+
commonAction: () => y("common-btn-click")
|
|
211
|
+
}), d(() => n(t).model, () => {
|
|
211
212
|
const {
|
|
212
213
|
model: e
|
|
213
|
-
} =
|
|
214
|
+
} = n(t);
|
|
214
215
|
e && w(e);
|
|
215
216
|
}, {
|
|
216
217
|
immediate: !0
|
|
217
|
-
}),
|
|
218
|
-
|
|
219
|
-
}),
|
|
220
|
-
|
|
221
|
-
}), !
|
|
222
|
-
|
|
218
|
+
}), d(() => n(t).schemas, (e, o) => {
|
|
219
|
+
Re(e, o) || S(e ?? []);
|
|
220
|
+
}), d(() => a.value, (e) => {
|
|
221
|
+
ie(() => {
|
|
222
|
+
}), !n(v) && e?.length && (ee(), v.value = !0, t.value?.watchDataIsChange && ge(() => {
|
|
223
|
+
M.value = F();
|
|
223
224
|
}, 40));
|
|
224
|
-
}),
|
|
225
|
-
|
|
225
|
+
}), d(() => r, we(() => {
|
|
226
|
+
n(t).submitOnChange && c();
|
|
226
227
|
}, 300), {
|
|
227
228
|
deep: !0
|
|
228
229
|
});
|
|
229
230
|
async function G(e) {
|
|
230
|
-
|
|
231
|
+
b.value = Ce(n(b) || {}, e);
|
|
231
232
|
}
|
|
232
|
-
function
|
|
233
|
-
r[e] =
|
|
233
|
+
function oe(e, o, s) {
|
|
234
|
+
r[e] = o;
|
|
234
235
|
}
|
|
235
|
-
function
|
|
236
|
+
function ne(e) {
|
|
236
237
|
const {
|
|
237
|
-
autoSubmitOnEnter:
|
|
238
|
-
} =
|
|
239
|
-
if (
|
|
240
|
-
const
|
|
241
|
-
|
|
238
|
+
autoSubmitOnEnter: o
|
|
239
|
+
} = n(t);
|
|
240
|
+
if (o && e.key === "Enter" && e.target && e.target instanceof HTMLElement) {
|
|
241
|
+
const s = e.target;
|
|
242
|
+
s && s.tagName && s.tagName.toUpperCase() === "INPUT" && c();
|
|
242
243
|
}
|
|
243
244
|
}
|
|
244
245
|
const H = {
|
|
245
|
-
getFieldsValue:
|
|
246
|
-
getFieldValue:
|
|
246
|
+
getFieldsValue: F,
|
|
247
|
+
getFieldValue: $,
|
|
247
248
|
setFieldsValue: w,
|
|
248
|
-
resetFields:
|
|
249
|
-
updateSchema:
|
|
250
|
-
resetSchema:
|
|
249
|
+
resetFields: C,
|
|
250
|
+
updateSchema: R,
|
|
251
|
+
resetSchema: S,
|
|
251
252
|
setProps: G,
|
|
252
|
-
removeSchemaByField:
|
|
253
|
-
appendSchemaByField:
|
|
253
|
+
removeSchemaByField: L,
|
|
254
|
+
appendSchemaByField: q,
|
|
254
255
|
clearValidate: D,
|
|
255
|
-
validateField:
|
|
256
|
-
setFormItemError:
|
|
256
|
+
validateField: x,
|
|
257
|
+
setFormItemError: N,
|
|
257
258
|
validate: T,
|
|
258
|
-
submit:
|
|
259
|
-
scrollToField:
|
|
259
|
+
submit: c,
|
|
260
|
+
scrollToField: te
|
|
260
261
|
};
|
|
261
|
-
|
|
262
|
-
const ae =
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
y("register", H);
|
|
263
|
+
const ae = u(() => Se(t.value, ["showResetButton", "showCommonButton", "showSubmitButton", "resetButtonOptions", "submitButtonOptions", "commonButtonOptions", "actionRowOptions", "actionSpan", "submitResetReverse"])), se = u(() => {
|
|
264
|
+
const {
|
|
265
|
+
showCommonButton: e,
|
|
266
|
+
showResetButton: o,
|
|
267
|
+
showSubmitButton: s
|
|
268
|
+
} = t.value;
|
|
269
|
+
return !!(e || o || s);
|
|
270
|
+
}), z = u(() => {
|
|
271
|
+
const e = n(a);
|
|
272
|
+
if (!e || e.length === 0)
|
|
273
|
+
return !1;
|
|
274
|
+
try {
|
|
275
|
+
return Me(e, t.value, r, p.value).willExceed;
|
|
276
|
+
} catch {
|
|
277
|
+
return !1;
|
|
278
|
+
}
|
|
279
|
+
}), k = me(), E = (e) => e ? he(Ee, ae.value, {
|
|
280
|
+
resetBefore: (o) => k.resetBefore?.(o),
|
|
281
|
+
submitBefore: (o) => k.submitBefore?.(o),
|
|
282
|
+
submitAfter: (o) => k.submitAfter?.(o)
|
|
266
283
|
}) : null;
|
|
267
|
-
return
|
|
268
|
-
getFieldsValue:
|
|
269
|
-
getFieldValue:
|
|
284
|
+
return X({
|
|
285
|
+
getFieldsValue: F,
|
|
286
|
+
getFieldValue: $,
|
|
270
287
|
setFieldsValue: w,
|
|
271
|
-
resetFields:
|
|
272
|
-
updateSchema:
|
|
273
|
-
resetSchema:
|
|
288
|
+
resetFields: C,
|
|
289
|
+
updateSchema: R,
|
|
290
|
+
resetSchema: S,
|
|
274
291
|
setProps: G,
|
|
275
|
-
removeSchemaByField:
|
|
276
|
-
appendSchemaByField:
|
|
292
|
+
removeSchemaByField: L,
|
|
293
|
+
appendSchemaByField: q,
|
|
277
294
|
clearValidate: D,
|
|
278
|
-
validateField:
|
|
295
|
+
validateField: x,
|
|
279
296
|
validate: T,
|
|
280
|
-
submit:
|
|
281
|
-
getSchema:
|
|
282
|
-
setFormItemError:
|
|
283
|
-
formModel:
|
|
284
|
-
|
|
297
|
+
submit: c,
|
|
298
|
+
getSchema: a,
|
|
299
|
+
setFormItemError: N,
|
|
300
|
+
formModel: u(() => _(r)),
|
|
301
|
+
hasActionButton: se,
|
|
302
|
+
willExceedOneRow: z
|
|
303
|
+
}), (e, o) => a.value?.length ? (l(), i(n(ve), B({
|
|
285
304
|
key: 0
|
|
286
|
-
},
|
|
305
|
+
}, f.value, {
|
|
287
306
|
ref_key: "formElRef",
|
|
288
|
-
ref:
|
|
289
|
-
class:
|
|
307
|
+
ref: g,
|
|
308
|
+
class: [n(V).b(), {
|
|
309
|
+
[n(V).is("exceed-one-row")]: z.value
|
|
310
|
+
}],
|
|
290
311
|
model: r,
|
|
291
|
-
onSubmit:
|
|
312
|
+
onSubmit: o[0] || (o[0] = ce(() => {
|
|
292
313
|
}, ["prevent"])),
|
|
293
|
-
onKeypress:
|
|
314
|
+
onKeypress: fe(ne, ["enter"])
|
|
294
315
|
}), {
|
|
295
|
-
default:
|
|
316
|
+
default: h(() => [a.value?.length ? (l(), i(n(be), W(B({
|
|
296
317
|
key: 0
|
|
297
|
-
},
|
|
298
|
-
default:
|
|
299
|
-
key:
|
|
318
|
+
}, f.value?.rowProps)), {
|
|
319
|
+
default: h(() => [O(e.$slots, "formHeader"), (l(!0), pe(de, null, j(a.value, (s) => (l(), i(Oe, {
|
|
320
|
+
key: s.field,
|
|
300
321
|
"form-action-type": H,
|
|
301
|
-
schema:
|
|
322
|
+
schema: s,
|
|
302
323
|
"form-props": t.value,
|
|
303
|
-
"all-default-values":
|
|
324
|
+
"all-default-values": p.value,
|
|
304
325
|
"form-model": r,
|
|
305
|
-
"set-form-model":
|
|
306
|
-
"update-schema":
|
|
307
|
-
},
|
|
326
|
+
"set-form-model": oe,
|
|
327
|
+
"update-schema": n(R)
|
|
328
|
+
}, Be({
|
|
308
329
|
_: 2
|
|
309
|
-
}, [
|
|
310
|
-
name:
|
|
311
|
-
fn:
|
|
330
|
+
}, [j(Object.keys(e.$slots), (K) => ({
|
|
331
|
+
name: K,
|
|
332
|
+
fn: h((re) => [O(e.$slots, K, B({
|
|
312
333
|
ref_for: !0
|
|
313
|
-
},
|
|
314
|
-
}))]), 1032, ["schema", "form-props", "all-default-values", "form-model", "update-schema"]))), 128)), t.value?.customLayout ? (l(),
|
|
334
|
+
}, re || {}))])
|
|
335
|
+
}))]), 1032, ["schema", "form-props", "all-default-values", "form-model", "update-schema"]))), 128)), t.value?.customLayout ? (l(), i(A(E(t.value?.showActionButtonGroup && t.value?.actionInline)), {
|
|
315
336
|
key: 1
|
|
316
|
-
})) : (l(),
|
|
337
|
+
})) : (l(), i(n(ye), W(B({
|
|
317
338
|
key: 0
|
|
318
|
-
},
|
|
319
|
-
span: Math.ceil(24 /
|
|
320
|
-
...
|
|
339
|
+
}, f.value?.quickColSpan ? {
|
|
340
|
+
span: Math.ceil(24 / f.value?.quickColSpan),
|
|
341
|
+
...f.value?.baseColProps
|
|
321
342
|
} : {})), {
|
|
322
|
-
default:
|
|
343
|
+
default: h(() => [(l(), i(A(E(t.value?.showActionButtonGroup && t.value?.actionInline))))]),
|
|
323
344
|
_: 1
|
|
324
345
|
}, 16))]),
|
|
325
346
|
_: 3
|
|
326
|
-
}, 16)) :
|
|
347
|
+
}, 16)) : U("", !0), (l(), i(A(E(t.value?.showActionButtonGroup && !t.value?.actionInline)))), O(e.$slots, "formFooter")]),
|
|
327
348
|
_: 3
|
|
328
|
-
}, 16, ["class", "model"])) :
|
|
349
|
+
}, 16, ["class", "model"])) : U("", !0);
|
|
329
350
|
}
|
|
330
351
|
});
|
|
331
352
|
export {
|
|
332
|
-
|
|
353
|
+
et as default
|
|
333
354
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SwitchProps } from 'vft/es/components';
|
|
1
2
|
import type { ButtonProps } from 'vft/es/components/button';
|
|
2
3
|
import type { ColProps } from 'vft/es/components/col';
|
|
3
4
|
import type { FormItemProp, FormItemProps, FormProps } from 'vft/es/components/form';
|
|
@@ -39,6 +40,7 @@ type FormItemRule = Omit<RuleItem, 'validator'> & Rule & {
|
|
|
39
40
|
} & {
|
|
40
41
|
isNumber?: boolean;
|
|
41
42
|
};
|
|
43
|
+
export type SchemaCompOptions = SwitchProps | Record<string, any>;
|
|
42
44
|
/** 渲染回调参数接口 */
|
|
43
45
|
export interface RenderCallbackParams {
|
|
44
46
|
/** 表单配置模式 */
|
|
@@ -205,8 +207,8 @@ export interface FormSchema {
|
|
|
205
207
|
componentProps?: ((opt: {
|
|
206
208
|
schema: FormSchema;
|
|
207
209
|
formActionType: FormActionType;
|
|
208
|
-
formModel:
|
|
209
|
-
}) =>
|
|
210
|
+
formModel: Record<string, any>;
|
|
211
|
+
}) => SchemaCompOptions | Promise<SchemaCompOptions>) | SchemaCompOptions;
|
|
210
212
|
/** 是否为必填项 */
|
|
211
213
|
required?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean);
|
|
212
214
|
/** 组件后自定义内容 */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FormSchema, RenderCallbackParams, SuperFormProps } from '../types';
|
|
1
2
|
import { type FormCompEnumType } from 'vft/es/utils';
|
|
2
3
|
/**
|
|
3
4
|
* @description 自动创建 placeholder
|
|
@@ -15,3 +16,36 @@ export declare function createPlaceholderMessage(type: FormCompEnumType, label?:
|
|
|
15
16
|
* @param val
|
|
16
17
|
*/
|
|
17
18
|
export declare function handleInputNumberValue(type?: FormCompEnumType, val?: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* @description 获取表单项的显示状态
|
|
21
|
+
* @param schema 表单配置
|
|
22
|
+
* @param values 渲染回调参数(可选,用于函数类型的 show/ifShow)
|
|
23
|
+
* @returns { isShow: boolean, isIfShow: boolean }
|
|
24
|
+
*/
|
|
25
|
+
export declare function getSchemaShowState(schema: FormSchema, values?: RenderCallbackParams): {
|
|
26
|
+
isShow: boolean;
|
|
27
|
+
isIfShow: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @description 计算表单项的 span 值
|
|
31
|
+
* @param schema 表单配置
|
|
32
|
+
* @param formProps 表单属性
|
|
33
|
+
* @returns span 值
|
|
34
|
+
*/
|
|
35
|
+
export declare function calculateSchemaSpan(schema: FormSchema, formProps: SuperFormProps): number;
|
|
36
|
+
/**
|
|
37
|
+
* @description 判断表单是否会超过一行
|
|
38
|
+
* @param schemas 表单配置数组
|
|
39
|
+
* @param formProps 表单属性
|
|
40
|
+
* @param formModel 表单模型(可选,用于计算动态显示状态)
|
|
41
|
+
* @param allDefaultValues 所有默认值(可选,用于计算动态显示状态)
|
|
42
|
+
* @returns { willExceed: boolean, totalSpan: number, visibleItems: Array }
|
|
43
|
+
*/
|
|
44
|
+
export declare function willFormExceedOneRow(schemas: FormSchema[], formProps: SuperFormProps, formModel?: Record<string, any>, allDefaultValues?: Record<string, any>): {
|
|
45
|
+
willExceed: boolean;
|
|
46
|
+
totalSpan: number;
|
|
47
|
+
visibleItems: Array<{
|
|
48
|
+
field: string;
|
|
49
|
+
span: number;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
@@ -1,43 +1,90 @@
|
|
|
1
|
-
import { isNumber as
|
|
2
|
-
import { isInput as
|
|
3
|
-
import { FormCompEnum as
|
|
1
|
+
import { isBoolean as l, isFunction as a, isNumber as h } from "@vft/utils";
|
|
2
|
+
import { isInput as p } from "../component-map.js";
|
|
3
|
+
import { FormCompEnum as i } from "../../../utils/form-register.js";
|
|
4
4
|
import "@vueuse/core";
|
|
5
5
|
import "../../config-provider/hooks/use-global-config.js";
|
|
6
6
|
import "vue";
|
|
7
7
|
import "lodash-es";
|
|
8
8
|
import "../../form/index.js";
|
|
9
|
-
function
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
].includes(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
].includes(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
].includes(
|
|
9
|
+
function P(n, e = "") {
|
|
10
|
+
return e = (e || "").replace(":", "") || "", [
|
|
11
|
+
i.Input,
|
|
12
|
+
i.InputNumber,
|
|
13
|
+
i.Textarea,
|
|
14
|
+
i.AutoComplete
|
|
15
|
+
].includes(n) ? "请输入" + e : [i.Password].includes(n) ? "请输入密码" : [
|
|
16
|
+
i.Select,
|
|
17
|
+
i.Radio,
|
|
18
|
+
i.RadioSingle,
|
|
19
|
+
i.RadioButton,
|
|
20
|
+
i.Cascader,
|
|
21
|
+
i.ColorPicker,
|
|
22
|
+
i.Checkbox,
|
|
23
|
+
i.CheckboxButton
|
|
24
|
+
].includes(n) ? "请选择" + e : [i.CheckboxSingle].includes(n) ? "请勾选" + e : [i.Search].includes(n) ? "请输入要搜索的内容" : [i.InputTag].includes(n) ? "请输入标签内容" : [i.Upload].includes(n) ? "请选择上传文件" : [i.Slider].includes(n) ? "请拖动滑块" : [
|
|
25
|
+
i.TimePicker,
|
|
26
|
+
i.YearPicker,
|
|
27
|
+
i.MonthPicker,
|
|
28
|
+
i.DatePicker,
|
|
29
|
+
i.DatesPicker,
|
|
30
|
+
i.DateTimePicker,
|
|
31
|
+
i.WeekPicker,
|
|
32
|
+
i.DateTimeRangePicker,
|
|
33
|
+
i.DateRangePicker,
|
|
34
|
+
i.MonthRangePicker
|
|
35
|
+
].includes(n) ? "请选择时间" : "";
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function q(n, e) {
|
|
38
|
+
return n && p(n) && e && h(e) ? `${e}` : e;
|
|
39
|
+
}
|
|
40
|
+
function k(n, e) {
|
|
41
|
+
const { show: t, ifShow: o } = n;
|
|
42
|
+
let c = !0, r = !0;
|
|
43
|
+
return l(t) ? c = t : a(t) && e && (c = t(e)), l(o) ? r = o : a(o) && e && (r = o(e)), { isShow: c, isIfShow: r };
|
|
44
|
+
}
|
|
45
|
+
function m(n, e) {
|
|
46
|
+
const { baseColProps: t = {}, quickColSpan: o } = e;
|
|
47
|
+
return n.type === i.Divider ? 24 : n.colProps?.span !== void 0 ? n.colProps.span : n.quickColSpan ? Math.ceil(24 / n.quickColSpan) : t.span !== void 0 ? t.span : o ? Math.ceil(24 / o) : 24;
|
|
48
|
+
}
|
|
49
|
+
function D(n, e, t, o) {
|
|
50
|
+
if (e.customLayout)
|
|
51
|
+
return {
|
|
52
|
+
willExceed: !1,
|
|
53
|
+
totalSpan: 0,
|
|
54
|
+
visibleItems: []
|
|
55
|
+
};
|
|
56
|
+
const c = [];
|
|
57
|
+
let r = 0;
|
|
58
|
+
for (const u of n) {
|
|
59
|
+
const f = t && o ? {
|
|
60
|
+
field: u.field,
|
|
61
|
+
model: t,
|
|
62
|
+
values: {
|
|
63
|
+
...o,
|
|
64
|
+
...t
|
|
65
|
+
},
|
|
66
|
+
schema: u
|
|
67
|
+
} : void 0, { isIfShow: S } = k(u, f);
|
|
68
|
+
if (!S)
|
|
69
|
+
continue;
|
|
70
|
+
const s = m(u, e);
|
|
71
|
+
c.push({ field: u.field, span: s }), r += s;
|
|
72
|
+
}
|
|
73
|
+
const d = e.showCommonButton || e.showResetButton || e.showSubmitButton;
|
|
74
|
+
if (e.actionInline && e.showActionButtonGroup && d && !e.customLayout) {
|
|
75
|
+
const u = e.quickColSpan ? Math.ceil(24 / e.quickColSpan) : e.baseColProps?.span || 24;
|
|
76
|
+
r += u;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
willExceed: r > 24,
|
|
80
|
+
totalSpan: r,
|
|
81
|
+
visibleItems: c
|
|
82
|
+
};
|
|
39
83
|
}
|
|
40
84
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
85
|
+
m as calculateSchemaSpan,
|
|
86
|
+
P as createPlaceholderMessage,
|
|
87
|
+
k as getSchemaShowState,
|
|
88
|
+
q as handleInputNumberValue,
|
|
89
|
+
D as willFormExceedOneRow
|
|
43
90
|
};
|
|
@@ -164,3 +164,4 @@ export declare const VftSwitch: import("vft/es/utils").SFCWithInstall<import("vu
|
|
|
164
164
|
inactiveValue: boolean | string | number;
|
|
165
165
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>> & Record<string, any>;
|
|
166
166
|
export default VftSwitch;
|
|
167
|
+
export * from './types';
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComponentSize } from 'vft/es/constants';
|
|
3
|
-
export interface SwitchProps {
|
|
4
|
-
modelValue?: boolean | string | number;
|
|
5
|
-
value?: boolean | string | number;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
width?: string | number;
|
|
8
|
-
inlinePrompt?: boolean;
|
|
9
|
-
activeIcon?: IconProps | string;
|
|
10
|
-
inactiveIcon?: IconProps | string;
|
|
11
|
-
activeText?: string;
|
|
12
|
-
inactiveText?: string;
|
|
13
|
-
activeColor?: string;
|
|
14
|
-
inactiveColor?: string;
|
|
15
|
-
borderColor?: string;
|
|
16
|
-
activeValue?: boolean | string | number;
|
|
17
|
-
inactiveValue?: boolean | string | number;
|
|
18
|
-
name?: string;
|
|
19
|
-
validateEvent?: boolean;
|
|
20
|
-
id?: string;
|
|
21
|
-
loading?: boolean;
|
|
22
|
-
beforeChange?: Function;
|
|
23
|
-
size?: ComponentSize;
|
|
24
|
-
tabindex?: string | number;
|
|
25
|
-
}
|
|
1
|
+
import type { SwitchProps } from './types';
|
|
26
2
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SwitchProps>, {
|
|
27
3
|
modelValue: boolean;
|
|
28
4
|
value: boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IconProps } from 'vft/es/components/icon';
|
|
2
|
+
import type { ComponentSize } from 'vft/es/constants';
|
|
3
|
+
export interface SwitchProps {
|
|
4
|
+
modelValue?: boolean | string | number;
|
|
5
|
+
value?: boolean | string | number;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
width?: string | number;
|
|
8
|
+
inlinePrompt?: boolean;
|
|
9
|
+
activeIcon?: IconProps | string;
|
|
10
|
+
inactiveIcon?: IconProps | string;
|
|
11
|
+
activeText?: string;
|
|
12
|
+
inactiveText?: string;
|
|
13
|
+
activeColor?: string;
|
|
14
|
+
inactiveColor?: string;
|
|
15
|
+
borderColor?: string;
|
|
16
|
+
activeValue?: boolean | string | number;
|
|
17
|
+
inactiveValue?: boolean | string | number;
|
|
18
|
+
name?: string;
|
|
19
|
+
validateEvent?: boolean;
|
|
20
|
+
id?: string;
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
beforeChange?: Function;
|
|
23
|
+
size?: ComponentSize;
|
|
24
|
+
tabindex?: string | number;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|