import React from 'react'; import { FormPathPattern } from '@formily/shared'; import { IFieldState, IVirtualFieldState, IMutators, IFormProps, IForm, IFormActions, IFormAsyncActions, IFormEffect } from '@formily/react'; import { ValidatePatternRules } from '@formily/validator'; import { Schema } from './shared/schema'; export * from '@formily/react'; declare global { namespace FormilyCore { interface FieldProps extends ISchema { } interface VirtualFieldProps extends ISchema { } } } export interface ISchemaFieldProps { path?: FormPathPattern; schema?: Schema; onlyRenderProperties?: boolean; } export declare type ComponentWithStyleComponent = React.JSXElementConstructor & { styledComponentId?: string; displayName?: string; }; export interface ISchemaFieldComponentProps extends IFieldState { schema: Schema; mutators: IMutators; form: IForm; renderField: (addtionKey: string | number, reactKey?: string | number) => React.ReactElement; } export declare type ISchemaFieldContextProps = Partial; export interface ISchemaVirtualFieldComponentProps extends IVirtualFieldState { schema: Schema; form: IForm; children: React.ReactElement[]; renderField: (addtionKey: string | number, reactKey?: string | number) => React.ReactElement; } export declare type IVirtualBoxProps = Props & { name?: string; visible?: boolean; display?: boolean; }; export interface ISchemaFieldWrapper { (Traget: ISchemaFieldComponent): React.FC | React.ClassicComponent; } export declare type ISchemaFieldComponent = ComponentWithStyleComponent & { __WRAPPERS__?: ISchemaFieldWrapper[]; }; export declare type ISchemaVirtualFieldComponent = ComponentWithStyleComponent & { __WRAPPERS__?: ISchemaFieldWrapper[]; }; export declare type ISchemaLinkageHandler = (spec: any, context: any) => IFormEffect; export interface ISchemaFormRegistry { fields: { [key: string]: ISchemaFieldComponent; }; virtualFields: { [key: string]: ISchemaVirtualFieldComponent; }; wrappers?: ISchemaFieldWrapper[]; componentPropsInterceptor?: (schema: ISchema) => any; formItemComponent: React.JSXElementConstructor; formComponent: string | React.JSXElementConstructor; previewText?: React.JSXElementConstructor; } export declare type SchemaMessage = React.ReactNode; export interface ISchema { title?: SchemaMessage; description?: SchemaMessage; default?: any; readOnly?: boolean; writeOnly?: boolean; type?: 'string' | 'object' | 'array' | 'number' | 'boolean' | string; enum?: Array; const?: any; multipleOf?: number; maximum?: number; exclusiveMaximum?: number; minimum?: number; exclusiveMinimum?: number; maxLength?: number; minLength?: number; pattern?: string | RegExp; maxItems?: number; minItems?: number; uniqueItems?: boolean; maxProperties?: number; minProperties?: number; required?: string[] | boolean | string; format?: string; properties?: { [key: string]: ISchema; }; items?: ISchema | ISchema[]; additionalItems?: ISchema; patternProperties?: { [key: string]: ISchema; }; additionalProperties?: ISchema; editable?: boolean; visible?: boolean | string; display?: boolean | string; triggerType?: 'onBlur' | 'onChange'; ['x-props']?: { [name: string]: any; }; ['x-index']?: number; ['x-rules']?: ValidatePatternRules; ['x-linkages']?: Array<{ target: FormPathPattern; type: string; [key: string]: any; }>; ['x-mega-props']?: { [name: string]: any; }; ['x-item-props']?: { [name: string]: any; }; ['x-component']?: string; ['x-component-props']?: { [name: string]: any; }; ['x-render']?: (props: T & { renderComponent: () => React.ReactElement; }) => React.ReactElement; ['x-effect']?: (dispatch: (type: string, payload: any) => void, option?: object) => { [key: string]: any; }; } export interface ISchemaFormProps extends IFormProps { schema?: ISchema; fields?: ISchemaFormRegistry['fields']; components?: { [key: string]: React.JSXElementConstructor; }; virtualFields?: ISchemaFormRegistry['virtualFields']; formComponent?: ISchemaFormRegistry['formComponent']; formItemComponent?: ISchemaFormRegistry['formItemComponent']; componentPropsInterceptor?: ISchemaFormRegistry['componentPropsInterceptor']; expressionScope?: { [key: string]: any; }; } export interface IMarkupSchemaFieldProps extends ISchema { name?: string; } export declare type MergedFieldComponentProps = Partial; export interface IConnectOptions { valueName?: string; eventName?: string; defaultProps?: {}; getValueFromEvent?: (event?: any, value?: any) => any; getProps?: (componentProps: {}, fieldProps: MergedFieldComponentProps) => {} | void; getComponent?: (Target: any, componentProps: {}, fieldProps: MergedFieldComponentProps) => React.JSXElementConstructor; } export interface IConnectProps { [key: string]: any; } export interface ISchemaFormActions extends IFormActions { getSchema(): Schema; getFormSchema(): Schema; } export interface ISchemaFormAsyncActions extends IFormAsyncActions { getSchema(): Promise; getFormSchema(): Promise; } export declare type MixinConnectedComponent = React.FC & { [key in T]: React.FC; };