@flatbiz/antd
Version:
59 lines (56 loc) • 1.57 kB
TypeScript
import { TPlainObject } from '@flatbiz/utils';
import { SearchProps } from 'antd/lib/input';
import { CSSProperties, ReactElement, ReactNode } from 'react';
export type InputSearchWrapperProps = Omit<SearchProps, "defaultValue">;
export interface ISearchMenuProps {
size?: "small" | "default";
/**
* 如果传了value,就变成受控组件
* 目前只支持单选
*/
value?: string;
onChange?: (key: string, targetItem?: TPlainObject) => void;
/** 树型源数据 */
dataSource: TPlainObject[];
/** 惰性搜索 */
lazySearch?: boolean;
/** 搜索目标字段 */
searchKeyList?: string[];
/** 格式化参数 */
fieldNames?: {
label?: string;
key?: string;
};
/** 自定义渲染条目 */
renderItem?: (nodeData: TPlainObject) => ReactElement;
/** 搜索框参数 */
inputProps?: InputSearchWrapperProps;
/** 搜索位置额外元素 */
searchExtraElement?: ReactElement;
placeholder?: string;
className?: string;
wrapStyle?: CSSProperties;
style?: CSSProperties;
searchStyle?: CSSProperties;
/** 是否显示搜索区域 */
showSearch?: boolean;
}
export interface IListViewItem {
label: ReactNode;
key: string;
}
export interface IListViewProps {
dataList: IListViewItem[];
value?: string;
onChange?: (key: string, item: IListViewItem) => void;
style?: CSSProperties;
/** 自定义空数据提示 */
emptyView?: ReactElement;
}
/**
* 列表搜索
* @param props
* @returns
*/
export declare function SearchMenu(props: ISearchMenuProps & Pick<IListViewProps, "emptyView">): import("react").JSX.Element;
export {};