UNPKG

tdesign-vue

Version:
46 lines (45 loc) 1.68 kB
import { CheckboxGroupValue, TdCheckboxProps } from './type'; export declare type CheckboxValue = TdCheckboxProps['value']; export interface CheckboxStoreData { checked: CheckboxGroupValue; } declare type ObserverMap = { [key: string]: (val: ObserverListenerParams) => void; }; export interface UpdateCheckedData { checked: CheckboxStoreData['checked']; oldChecked?: CheckboxStoreData['checked']; isCheckAll: boolean; indeterminate: boolean; } export interface UpdateCheckboxData { disabled: boolean; maxExceeded: boolean; checkboxName: string; } export declare type ObserverListenerParams = { type: 'checked' | 'checkbox'; parentIsCheckAll?: boolean; parentChecked?: CheckboxStoreData['checked']; parentIsIndeterminate?: boolean; parentMaxExceeded?: boolean; parentDisabled?: boolean; checkboxName?: string; }; declare class CheckboxStore { observerMap: ObserverMap; parentChecked: CheckboxGroupValue; parentExist: boolean; init(): void; updateChecked({ checked, isCheckAll, oldChecked, indeterminate, }: UpdateCheckedData): void; updateCheckbox({ disabled, maxExceeded, checkboxName }: UpdateCheckboxData): void; subscribe(value: CheckboxValue, listener: (val: any) => void): void; unSubscribe(value: CheckboxValue): void; } export declare function getChangedChecked(checked?: CheckboxStoreData['checked'], oldChecked?: CheckboxStoreData['checked']): CheckboxStoreData['checked']; export declare function createCheckboxStore(key?: string): { storeKey: string; checkboxStore: CheckboxStore; }; export declare function getCheckboxStore(key: string): CheckboxStore; export {};