import React from 'react'; import { StandardFormDialogProps, WithStandardFormConfig, ExternalSchemaConfig } from './types'; /** * 标准表单配置接口 - 向后兼容 * @deprecated 请使用 WithStandardFormConfig 类型 */ export interface StandardFormConfig extends WithStandardFormConfig { } /** * 重新导出类型以保持向后兼容性 */ export type { ExternalSchemaConfig, WithStandardFormConfig }; /** * 创建带有标准表单的高阶组件 * * 这个工厂函数创建一个标准化的表单对话框组件,包含: * - 支持外部Schema文件导入或自动Schema构建 * - 标准的 API 调用逻辑 * - 统一的错误处理 * - 可配置的业务字段 * * @param config 标准表单配置 * @returns 标准表单对话框组件 * * @example * // 使用businessFields(内部构建schema) * const FormDialog = withStandardForm({ * formId: 'Common.Materials', * businessFields: { * code: FieldCreators.input('物料编码', true), * name: FieldCreators.input('物料名称', true) * }, * apiConfig: { get: GetAsync, create: CreateAsync } * }); * * @example * // 使用外部schema文件 * import { form, schema } from './schema'; * const FormDialog = withStandardForm({ * formId: 'Common.Materials', * externalSchema: { form, schema }, * apiConfig: { get: GetAsync, create: CreateAsync } * }); */ export declare const withStandardForm: (config: WithStandardFormConfig) => React.FC & { entityId?: string | undefined; title?: string | undefined; onAfterSubmit?: (() => void) | undefined; children?: React.ReactNode; buttonProps?: any; }>; /** * 字段创建器工具函数集合 * 提供常用字段类型的快速创建方法 */ export declare const FieldCreators: { /** * 输入框字段 */ input: (title: string, required?: boolean, props?: any) => { type: string; title: string; required: boolean; 'x-component': string; 'x-component-props': any; }; /** * 数字输入字段 */ number: (title: string, required?: boolean, props?: any) => { type: string; title: string; required: boolean; 'x-component': string; 'x-component-props': any; }; /** * 文本域字段 */ textarea: (title: string, required?: boolean, props?: any) => { type: string; title: string; required: boolean; 'x-component': string; 'x-component-props': any; }; /** * 日期字段 */ date: (title: string, required?: boolean, props?: any) => { type: string; title: string; required: boolean; 'x-component': string; 'x-component-props': any; }; /** * 日期时间字段 */ datetime: (title: string, required?: boolean, props?: any) => { type: string; title: string; required: boolean; 'x-component': string; 'x-component-props': any; }; /** * 开关字段 */ switch: (title: string, defaultValue?: boolean, props?: any) => { type: string; title: string; default: boolean; 'x-component': string; 'x-component-props': any; }; /** * 选择字段 */ select: (title: string, required?: boolean, props?: any) => { type: string; title: string; required: boolean; 'x-component': string; 'x-component-props': any; }; /** * 隐藏字段 */ hidden: (defaultValue?: any) => { type: string; default: any; 'x-component': string; 'x-display': string; }; }; /** * 创建选择字段 */ export declare const createSelectField: (title: string, options: { [key: string]: any; label: string; value: any; }[], config?: { required?: boolean | undefined; multiple?: boolean | undefined; allowClear?: boolean | undefined; showSearch?: boolean | undefined; placeholder?: string | undefined; }) => { type: string; title: string; required: boolean; enum: any[]; 'x-component': string; 'x-component-props': { placeholder: string; style: { width: string; }; allowClear: boolean; showSearch: boolean; mode: string | undefined; options: { label: string; value: any; }[]; }; }; /** * 创建级联选择字段 */ export declare const createCascaderField: (title: string, options: any[], config?: { required?: boolean | undefined; changeOnSelect?: boolean | undefined; expandTrigger?: "click" | "hover" | undefined; placeholder?: string | undefined; }) => { type: string; title: string; required: boolean; 'x-component': string; 'x-component-props': { placeholder: string; style: { width: string; }; options: any[]; changeOnSelect: boolean; expandTrigger: "click" | "hover"; }; }; export default withStandardForm;