Merge branch 'main' into feat/add-vben-modal-animation
commit
fc9ea347ca
|
@ -395,7 +395,7 @@ export interface FormCommonConfig {
|
||||||
* 所有表单项的栅格布局
|
* 所有表单项的栅格布局
|
||||||
* @default ""
|
* @default ""
|
||||||
*/
|
*/
|
||||||
formItemClass?: string;
|
formItemClass?: (() => string) | string;
|
||||||
/**
|
/**
|
||||||
* 隐藏所有表单项label
|
* 隐藏所有表单项label
|
||||||
* @default false
|
* @default false
|
||||||
|
|
|
@ -12,7 +12,12 @@ import type {
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
import { Form } from '@vben-core/shadcn-ui';
|
import { Form } from '@vben-core/shadcn-ui';
|
||||||
import { cn, isString, mergeWithArrayOverride } from '@vben-core/shared/utils';
|
import {
|
||||||
|
cn,
|
||||||
|
isFunction,
|
||||||
|
isString,
|
||||||
|
mergeWithArrayOverride,
|
||||||
|
} from '@vben-core/shared/utils';
|
||||||
|
|
||||||
import { provideFormRenderProps } from './context';
|
import { provideFormRenderProps } from './context';
|
||||||
import { useExpandable } from './expandable';
|
import { useExpandable } from './expandable';
|
||||||
|
@ -110,6 +115,17 @@ const computedSchema = computed(
|
||||||
? keepIndex <= index
|
? keepIndex <= index
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
|
// 处理函数形式的formItemClass
|
||||||
|
let resolvedSchemaFormItemClass = schema.formItemClass;
|
||||||
|
if (isFunction(schema.formItemClass)) {
|
||||||
|
try {
|
||||||
|
resolvedSchemaFormItemClass = schema.formItemClass();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error calling formItemClass function:', error);
|
||||||
|
resolvedSchemaFormItemClass = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
colon,
|
colon,
|
||||||
disabled,
|
disabled,
|
||||||
|
@ -133,7 +149,7 @@ const computedSchema = computed(
|
||||||
'flex-shrink-0',
|
'flex-shrink-0',
|
||||||
{ hidden },
|
{ hidden },
|
||||||
formItemClass,
|
formItemClass,
|
||||||
schema.formItemClass,
|
resolvedSchemaFormItemClass,
|
||||||
),
|
),
|
||||||
labelClass: cn(labelClass, schema.labelClass),
|
labelClass: cn(labelClass, schema.labelClass),
|
||||||
};
|
};
|
||||||
|
|
|
@ -174,10 +174,10 @@ export interface FormCommonConfig {
|
||||||
*/
|
*/
|
||||||
formFieldProps?: FormFieldOptions;
|
formFieldProps?: FormFieldOptions;
|
||||||
/**
|
/**
|
||||||
* 所有表单项的栅格布局
|
* 所有表单项的栅格布局,支持函数形式
|
||||||
* @default ""
|
* @default ""
|
||||||
*/
|
*/
|
||||||
formItemClass?: string;
|
formItemClass?: (() => string) | string;
|
||||||
/**
|
/**
|
||||||
* 隐藏所有表单项label
|
* 隐藏所有表单项label
|
||||||
* @default false
|
* @default false
|
||||||
|
|
Loading…
Reference in New Issue