@aimake/nanod
Version:
## 设计模式 NANO DESIGN 是面向于企业级中台化应用的解决方案。服务于 ToB 和 ToE 类型的单页应用,应用于各产品中从而产出了一套设计及前端规范。
58 lines (57 loc) • 1.77 kB
TypeScript
import * as React from 'react';
export declare type CheckboxValueType = string | number;
export interface CheckboxOptionType {
label: string;
value: CheckboxValueType;
disabled?: boolean;
}
export interface AbstractCheckboxGroupProps {
prefixCls?: string;
className?: string;
options?: Array<CheckboxOptionType | string>;
disabled?: boolean;
style?: React.CSSProperties;
}
export interface CheckboxGroupProps extends AbstractCheckboxGroupProps {
defaultValue?: Array<CheckboxValueType>;
value?: Array<CheckboxValueType>;
onChange?: (checkedValue: Array<CheckboxValueType>) => void;
}
export interface CheckboxGroupState {
value: any;
}
export interface CheckboxGroupContext {
checkboxGroup: {
toggleOption: (option: CheckboxOptionType) => void;
value: any;
disabled: boolean;
};
}
export default class CheckboxGroup extends React.Component<CheckboxGroupProps, CheckboxGroupState> {
static defaultProps: {
options: never[];
prefixCls: string;
};
static propTypes: {
defaultValue: any;
value: any;
options: any;
onChange: any;
};
static childContextTypes: {
checkboxGroup: any;
};
constructor(props: CheckboxGroupProps);
getChildContext(): {
checkboxGroup: {
toggleOption: (option: CheckboxOptionType) => void;
value: any;
disabled: boolean | undefined;
};
};
componentWillReceiveProps(nextProps: CheckboxGroupProps): void;
shouldComponentUpdate(nextProps: CheckboxGroupProps, nextState: CheckboxGroupState): boolean;
getOptions(): CheckboxOptionType[];
toggleOption: (option: CheckboxOptionType) => void;
render(): JSX.Element;
}