You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { FormInstance } from 'antd/lib/form';
import { ReactNode } from 'react';
export declare type ProSchemaValueEnumObj = {
[key: string]: {
text: ReactNode;
status: string;
} | ReactNode;
};
export declare type ProSchemaValueEnumMap = Map<React.ReactText, {
text: ReactNode;
status: string;
} | ReactNode>;
export declare type ProSchemaComponentTypes = 'form' | 'list' | 'descriptions' | 'table' | 'cardList' | undefined;
export declare type ProFieldRequestData<T, U = any> = (params: U, props: T) => Promise<{
label: React.ReactNode;
value: React.ReactText;
[key: string]: any;
}[]>;
/**
* 操作类型
*/
export interface ProCoreActionType {
reload: (resetPageIndex?: boolean) => void;
reloadAndRest?: () => void;
fetchMore?: () => void;
reset?: () => void;
clearSelected?: () => void;
}
/**
* 各个组件公共支持的 render
*/
export declare type ProSchema<T = unknown, U = string, Extra = unknown> = {
key?: React.ReactText;
dataIndex?: string | number | (string | number)[];
/**
* 选择如何渲染相应的模式
*/
valueType?: ((entity: T) => U) | U;
title?: ((schema: ProSchema<T, U, Extra>, type: ProSchemaComponentTypes, dom: React.ReactNode) => React.ReactNode) | React.ReactNode;
/**
*展示一个 iconhover 是展示一些提示信息
*/
tip?: string;
render?: (dom: React.ReactNode, entity: T, index: number, action: ProCoreActionType, schema: ProSchema<T, U, Extra>) => React.ReactNode;
renderFormItem?: (item: ProSchema<T, U, Extra>, config: {
value?: any;
onChange?: (value: any) => void;
onSelect?: (value: any) => void;
type: ProSchemaComponentTypes;
defaultRender: (newItem: ProSchema<T, U, Extra>) => JSX.Element | null;
}, form: FormInstance) => React.ReactNode;
/**
* 自定义 render但是需要返回 string
*/
renderText?: (text: any, record: T, index: number, action: ProCoreActionType) => any;
formItemProps?: any;
/**
* 映射值的类型
*/
valueEnum?: ProSchemaValueEnumObj | ProSchemaValueEnumMap;
/**
* 从服务器请求枚举
*/
request?: ProFieldRequestData<ProSchema>;
/**
* 从服务器请求的参数,改变了会触发 reload
*/
params?: {
[key: string]: any;
};
/**
* 隐藏在 descriptions
*/
hideInDescriptions?: boolean;
} & Extra;