mr-component
Version:
A library for Mr components
94 lines (93 loc) • 2.87 kB
TypeScript
import * as React from 'react';
export interface SelectOption {
/** 选项值 */
value: string | number;
/** 选项文本 */
label: string;
/** 是否禁用 */
disabled?: boolean;
/** 子选项(用于级联选择) */
children?: SelectOption[];
}
export interface MrSelectProps {
/** 当前选中值 */
value?: string | number | Array<string | number>;
/** 默认选中值 */
defaultValue?: string | number | Array<string | number>;
/** 选项数据 */
options?: SelectOption[];
/** 占位符文本 */
placeholder?: string;
/** 是否多选 */
multiple?: boolean;
/** 是否可搜索 */
searchable?: boolean;
/** 搜索占位符 */
searchPlaceholder?: string;
/** 最大选择数量(多选时) */
maxSelect?: number;
/** 标题 */
title?: string;
/** 禁用状态 */
disabled?: boolean;
/** 只读状态 */
readOnly?: boolean;
/** 是否显示确认按钮 */
showConfirmButton?: boolean;
/** 确认按钮文本 */
confirmButtonText?: string;
/** 取消按钮文本 */
cancelButtonText?: string;
/** 列数(多列选择) */
columns?: number;
/** 是否级联选择 */
cascade?: boolean;
/** 加载状态 */
loading?: boolean;
/** 加载提示文本 */
loadingText?: string;
/** 无数据提示文本 */
emptyText?: string;
/** 错误状态 */
error?: boolean;
/** 错误信息 */
errorMessage?: string;
/** 边框颜色 */
borderColor?: string;
/** 背景颜色 */
backgroundColor?: string;
/** 文字颜色 */
textColor?: string;
/** 圆角大小 */
borderRadius?: number | string;
/** 高度 */
height?: number | string;
/** 内边距 */
padding?: number | string;
/** 字体大小 */
fontSize?: number | string;
/** 字体粗细 */
fontWeight?: number | string;
/** 选中项颜色 */
selectedColor?: string;
/** 选中项背景色 */
selectedBackgroundColor?: string;
/** 预设主题 */
theme?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
/** 尺寸 */
size?: 'small' | 'normal' | 'large';
/** 值变化回调 */
onChange?: (value: string | number | Array<string | number>, option?: SelectOption | SelectOption[]) => void;
/** 确认回调 */
onConfirm?: (value: string | number | Array<string | number>, option?: SelectOption | SelectOption[]) => void;
/** 取消回调 */
onCancel?: () => void;
/** 搜索回调 */
onSearch?: (keyword: string) => void;
/** 自定义类名 */
className?: string;
/** 自定义样式 */
style?: React.CSSProperties;
}
declare const RefMrSelect: React.ForwardRefExoticComponent<MrSelectProps & React.RefAttributes<HTMLDivElement>>;
export default RefMrSelect;