1.0.0 • Published 6 years ago

ux-checkbox-wulei v1.0.0

Weekly downloads
1
License
ISC
Repository
gitlab
Last release
6 years ago

复选组件

API

Checkbox

// --------- Checkbox 复选框 ---------
export interface TranslationType{
    [key: string]: string
}

export interface CheckboxProps {
    autoFocus?: boolean; // 自动获取焦点
    defaultChecked?: boolean; // 默认是否选中
    checked?: boolean; // 是否选中
    disabled?: boolean; // 是否禁用
    required?: boolean; // 是否必填
    indeterminate?: boolean; // 设置 indeterminate 状态,只负责样式控制
    name?: string; // input的name属性
    tabIndex?: number; 
    value?: any;
    readOnly?: boolean;
    children?: React.ReactNode; // label 显示的内容
    onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
    translation?: TranslationType // 多语言文本翻译参数
}

// --------- CheckboxGroup 复选框组 ---------

export interface CheckboxGroupProps {
    defaultValues?: string[]; // 默认已选中
    checked?: boolean; // 是否全部选中
    disabled?: boolean; // 是否全部禁用
    values?: string; // 选中的
    options?: CheckboxProps[]; // 可选项
    onChange?: (event: React.ChangeEvent<HTMLInputElement>, checkedValues: any[]) => void;
    translation?: TranslationType; // 多语言文本翻译参数
}