2023-06-25 12:18:34 +08:00
|
|
|
import React from 'react';
|
2024-04-01 15:49:45 +08:00
|
|
|
|
2024-05-27 15:06:38 +08:00
|
|
|
import type { CheckboxOptionType } from './Group';
|
2023-06-25 12:18:34 +08:00
|
|
|
|
2024-05-27 15:06:38 +08:00
|
|
|
export interface CheckboxGroupContext<T = any> {
|
2023-06-25 12:18:34 +08:00
|
|
|
name?: string;
|
2024-04-01 15:49:45 +08:00
|
|
|
toggleOption?: (option: CheckboxOptionType<T>) => void;
|
2023-06-25 12:18:34 +08:00
|
|
|
value?: any;
|
|
|
|
disabled?: boolean;
|
2023-12-22 17:07:34 +08:00
|
|
|
registerValue: (val: T) => void;
|
|
|
|
cancelValue: (val: T) => void;
|
2023-06-25 12:18:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const GroupContext = React.createContext<CheckboxGroupContext | null>(null);
|
|
|
|
|
|
|
|
export default GroupContext;
|