import React from 'react'; import { Field, FieldConfig, FieldError, FieldProps, IField } from '../common'; import { FieldConfigs } from '../'; import { IFormItem } from '../../../steps/form'; import { ColumnsConfig } from '../../../interface'; export interface GroupFieldConfig extends FieldConfig { type: 'group'; fields: FieldConfigs[]; childColumns?: ColumnsConfig; } /** * 表单步骤组件 - UI渲染方法 - 入参格式 * - columns: 分栏设置 * - * type: 分栏类型 * - * - * span: 固定分栏 * - * - * width: 宽度分栏 * - * value: 分栏相关配置值 * - * wrap: 分栏后是否换行 * - * gap: 分栏边距 * - * horizontal: 左侧文本、右侧输入框、纵向排列 * - * vertical: 顶部文本、底部输入框、纵向排列 * - * inline: 左侧文本、右侧输入框、横向排列 * - submit: 表单提交操作事件 * - cancel: 表单取消操作事件 * - children: 表单内容 */ export interface IGroupField { columns?: ColumnsConfig; children: React.ReactNode[]; } interface IGroupFieldState { didMount: boolean; formData: { status: 'normal' | 'error' | 'loading'; message?: string; name?: string; }[]; } export default class GroupField extends Field implements IField { getALLComponents: (type: any) => typeof Field; formFields: Array | null>; formFieldsMounted: Array; constructor(props: FieldProps); didMount: () => Promise; validate: (value: any) => Promise; get: () => Promise; handleMount: (formFieldIndex: number) => Promise; handleChange: (formFieldIndex: number, value: any) => Promise; /** * 处理set、unset、append、splice、sort后的操作 */ handleValueCallback: (formFieldIndex: number, validation: true | FieldError[]) => Promise; handleValueSet: (formFieldIndex: number, path: string, value: any, validation: true | FieldError[], options?: { noPathCombination?: boolean; }) => Promise; handleValueUnset: (formFieldIndex: number, path: string, validation: true | FieldError[], options?: { noPathCombination?: boolean; }) => Promise; handleValueListAppend: (formFieldIndex: number, path: string, value: any, validation: true | FieldError[], options?: { noPathCombination?: boolean; }) => Promise; handleValueListSplice: (formFieldIndex: number, path: string, index: number, count: number, validation: true | FieldError[], options?: { noPathCombination?: boolean; }) => Promise; handleValueListSort: (formFieldIndex: number, path: string, index: number, sortType: 'up' | 'down', validation: true | FieldError[], options?: { noPathCombination?: boolean; }) => Promise; renderComponent: (props: IGroupField) => JSX.Element; /** * 表单项组件 - UI渲染方法 * 各UI库需重写该方法 * @param props */ renderItemComponent: (props: IFormItem) => JSX.Element; render: () => JSX.Element; } export {};