UNPKG

@orca-fe/antd-plus

Version:
26 lines (25 loc) 1.16 kB
import type { ComponentType, ReactElement } from 'react'; type BasicType = string | number | boolean | null | undefined; export interface ValueMappingProps extends Record<string, any> { __valuePropName?: string; __trigger?: string; __mapping?: [BasicType, BasicType][]; __mappingValue?: (value: any, props?: any) => any; __mappingTrigger?: (value: any, props?: any) => any; children?: ReactElement; } export declare const ValueMapping: (props: ValueMappingProps) => import("react/jsx-runtime").JSX.Element; export default ValueMapping; export type createValueMappedOptions = { /** 值字段名 默认为 `value` */ valuePropName?: string; /** 值变化事件名 默认为 `onChange` */ trigger?: string; /** 一对一值映射 */ mapping?: [BasicType, BasicType][]; /** 值映射函数 */ mappingValue?: (value: any, props?: any) => any; /** 事件映射函数 */ mappingTrigger?: (value: any, props?: any) => any; }; export declare function createValueMappedComponent<Props>(Comp: ComponentType<Props>, options: createValueMappedOptions): (props: Props) => import("react/jsx-runtime").JSX.Element;