/// import type FormItem from '../core-form/FormItem'; import type FormFieldRenderProps from './FormFieldRenderProps'; import type ReadonlyRenderProps from './ReadonlyRenderProps'; import type AppInfo from '../app/AppInfo'; import type ValidateFunction from './ValidateFunction'; import type ValidateFunctionContext from './ValidateFunctionContext'; import type FormFieldGroup from './FormFieldGroup'; /** * 表单字段配置 */ export default interface FormFieldConfig { /** * 字段类型 */ type: string; /** * 字段标题 */ title: string; /** * 所属组别。默认为 `senior` */ group?: FormFieldGroup; /** * 字段在表单中的渲染组件 */ render: React.ReactType>; /** * 字段在子表单中的渲染组件。如果不指定,则采用 `render` 组件在子表单中渲染。 */ subformRender?: React.ReactType>; /** * 禁止在子表单中渲染。默认为 `false`,表示可以在子表单中渲染。 */ disallowInSubform?: boolean; /** * 只读渲染器。在需要只读显示的地方使用。如子表单中的字段只读显示、数据查询列表中的显示。如果不指定,则默认直接展示表单项值的值。 */ readonlyRender?: React.ReactType>; /** * 获取默认值的方法 * * @param formItem 表单项 * @param appInfo 应用信息 */ defaultValueGetter?: (formItem: FormItem, appInfo: AppInfo) => ValueType | null | undefined; /** * 禁止在数据表格中出现 */ disabledInList?: boolean; /** * 禁止在查询中出现 */ disabledInSeniorSearch?: boolean; /** * 字段级默认校验规则函数 */ defaultValidate?: (value: any, context: ValidateFunctionContext) => string | undefined | null; /** * 字段级校验规则函数 */ validates?: { [validateName: string]: ValidateFunction; }; /** * 是否支持浮动布局 */ enableFloating?: boolean; /** * 不显示标题 */ disabledShowTitle?: boolean; }