@aliretail/react-materials-components
Version:
62 lines (61 loc) • 1.9 kB
TypeScript
import * as React from 'react';
import { TreeSelectProps } from '@alifd/next/types/tree-select';
declare type IDataSource = TreeSelectProps['dataSource'];
declare type TComponentProps = TreeSelectProps & {
dataSource: IDataSource;
className: string;
appCode: string;
apiCode: string;
url: string;
primaryValueKey: string;
primaryLabelKey: string;
extRequestParams: Record<string, any>;
isGetAllDataSource: boolean;
followTrigger: boolean;
};
interface IState {
dataSource: IDataSource;
errorMsg: string;
}
export default class TreeSelector extends React.Component<TComponentProps, IState> {
static defaultProps: {
dataSource: any[];
primaryValueKey: string;
primaryLabelKey: string;
style: {};
appCode: string;
apiCode: string;
url: string;
className: string;
extRequestParams: {};
isGetAllDataSource: boolean;
followTrigger: boolean;
};
COM_PREFIX: string;
DEFAULT_LABEL_KEY: string;
DEFAULT_VALUE_KEY: string;
constructor(props: TComponentProps);
componentDidUpdate(prevProps: TComponentProps): void;
/**
* 校验规则,提供外部使用 ref 方式调用
* @param isRequired 是否是必填项
*/
validate: (isRequired?: boolean) => string | true;
setErrors(error: IState['errorMsg']): void;
isEmptyValue(): boolean;
clearErrors(): void;
isSetRequest(): boolean;
setDSByApi(primaryValue?: string): Promise<void>;
getDSByApi(primaryValue?: string): Promise<any>;
getHandledDataSource(ds: any): TComponentProps['dataSource'];
getItemDefault(ds: any): {
[x: string]: any;
disabled: any;
checkboxDisabled: any;
isLeaf: any;
};
onLoadData(node: any): Promise<void>;
getItemByPos(pos: any): any;
render(): JSX.Element;
}
export {};