choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
46 lines (45 loc) • 1.85 kB
TypeScript
import React, { Component, FormEventHandler, ReactElement } from 'react';
import { AbstractSelectProps, OptGroupProps, OptionProps, SelectValue } from '../select';
import { InputProps } from '../input';
import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext';
export interface DataSourceItemObject {
value: string;
text: string;
}
export declare type DataSourceItemType = string | DataSourceItemObject | ReactElement<OptionProps> | ReactElement<OptGroupProps>;
export interface AutoCompleteInputProps {
onChange?: FormEventHandler<any>;
value: any;
}
export declare type ValidInputElement = HTMLInputElement | HTMLTextAreaElement | ReactElement<AutoCompleteInputProps>;
export interface AutoCompleteProps extends AbstractSelectProps {
value?: SelectValue;
defaultValue?: SelectValue;
dataSource?: DataSourceItemType[];
backfill?: boolean;
optionLabelProp?: string;
onChange?: (value: SelectValue) => void;
onSelect?: (value: SelectValue, option: Record<string, any>) => any;
children?: ValidInputElement | ReactElement<OptionProps> | ReactElement<OptionProps>[];
inputProps?: InputProps;
}
export default class AutoComplete extends Component<AutoCompleteProps, {}> {
static displayName: string;
static get contextType(): typeof ConfigContext;
static Option: React.ClassicComponentClass<OptionProps>;
static OptGroup: React.ClassicComponentClass<OptGroupProps>;
static defaultProps: {
transitionName: string;
optionLabelProp: string;
choiceTransitionName: string;
showSearch: boolean;
filterOption: boolean;
};
context: ConfigContextValue;
private select;
getInputElement: () => JSX.Element;
focus(): void;
blur(): void;
saveSelect: (node: any) => void;
render(): JSX.Element;
}