acud
Version:
acg react 组件库
49 lines (48 loc) • 2.3 kB
TypeScript
/// <reference types="react" />
import { SelectProps, RefSelectProps } from '../generate';
export type SelectSource = 'option' | 'selection' | 'input';
export declare const INTERNAL_PROPS_MARK = "RC_SELECT_INTERNAL_PROPS_MARK";
export type Key = string | number;
export type ExpandKey = Key[] | Key;
export type DefaultExpandKey = ExpandKey | boolean;
export type RawValueType = string | number;
export interface LabelValueType {
key?: Key;
value?: RawValueType;
label?: React.ReactNode;
isCacheable?: Boolean;
}
export type DefaultValueType = RawValueType | RawValueType[] | LabelValueType | LabelValueType[] | undefined;
export interface DisplayLabelValueType extends LabelValueType {
disabled?: boolean;
}
export type SingleType<MixType> = MixType extends (infer Single)[] ? Single : MixType;
export type OnClear = () => void;
export interface CustomTagProps {
label: React.ReactNode;
value: DefaultValueType;
disabled: boolean;
onClose: (event?: React.MouseEvent<HTMLElement, MouseEvent>) => void;
closable: boolean;
}
export type GetLabeledValue<FOT extends FlattenOptionsType> = (value: RawValueType, config: {
options: FOT;
prevValueMap: Map<RawValueType, LabelValueType>;
labelInValue: boolean;
optionLabelProp: string;
groupSelectorRender?: (groupLabel: string, value: string | number) => React.ReactElement;
}) => LabelValueType;
export type FilterOptions<OptionsType extends object[]> = (searchValue: string, options: OptionsType,
/** Component props, since Select & TreeSelect use different prop name, use any here */
config: {
optionFilterProp: string;
filterOption: boolean | FilterFunc<OptionsType[number]>;
}) => OptionsType;
export type FilterFunc<OptionType> = (inputValue: string, option?: OptionType) => boolean;
export declare function RefSelectFunc<OptionsType extends object[], ValueType>(Component: React.ForwardRefRenderFunction<RefSelectProps, SelectProps<OptionsType, ValueType>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<SelectProps<OptionsType, ValueType>> & React.RefAttributes<RefSelectProps>>;
export type FlattenOptionsType<OptionsType extends object[] = object[]> = {
key?: Key;
data?: OptionsType[number];
/** Used for customize data */
[name: string]: any;
}[];