choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
55 lines (54 loc) • 1.98 kB
TypeScript
import { Component, CSSProperties, ReactNode } from 'react';
import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext';
export declare type CheckboxValueType = string | number | boolean;
export interface CheckboxOptionType {
label: ReactNode;
value: CheckboxValueType;
disabled?: boolean;
}
export interface AbstractCheckboxGroupProps {
prefixCls?: string;
checkboxPrefixCls?: string;
className?: string;
options?: Array<CheckboxOptionType | string>;
disabled?: boolean;
style?: CSSProperties;
}
export interface CheckboxGroupProps extends AbstractCheckboxGroupProps {
defaultValue?: Array<CheckboxValueType>;
value?: Array<CheckboxValueType>;
onChange?: (checkedValue: Array<CheckboxValueType>) => void;
label?: string;
}
export interface CheckboxGroupState {
value: any;
}
export interface CheckboxGroupContext {
checkboxGroup?: {
toggleOption: (option: CheckboxOptionType) => void;
value: any;
disabled?: boolean;
};
getPrefixCls(suffixCls: string, customizePrefixCls?: string): string;
}
export default class CheckboxGroup extends Component<CheckboxGroupProps, CheckboxGroupState> {
static displayName: string;
static get contextType(): typeof ConfigContext;
static defaultProps: {
options: never[];
};
context: ConfigContextValue;
constructor(props: CheckboxGroupProps, context: ConfigContextValue);
getContextValue(): {
checkboxGroup: {
toggleOption: (option: CheckboxOptionType) => void;
value: any;
disabled: boolean | undefined;
};
};
componentWillReceiveProps(nextProps: CheckboxGroupProps): void;
shouldComponentUpdate(nextProps: CheckboxGroupProps, nextState: CheckboxGroupState, nextContext: ConfigContextValue): boolean;
getOptions(): CheckboxOptionType[];
toggleOption: (option: CheckboxOptionType) => void;
render(): JSX.Element;
}