UNPKG

1.4 kBTypeScriptView Raw
1import { OnInit, Provider } from '@angular/core';
2import { ControlValueAccessor } from '@angular/forms';
3import * as i0 from "@angular/core";
4export declare const CHECKBOX_CONTROL_VALUE_ACCESSOR: Provider;
5declare type AvailableValues = boolean | string | number;
6/**
7 * Add checkbox functionality to any element
8 */
9export declare class ButtonCheckboxDirective implements ControlValueAccessor, OnInit {
10 /** Truthy value, will be set to ngModel */
11 btnCheckboxTrue: AvailableValues;
12 /** Falsy value, will be set to ngModel */
13 btnCheckboxFalse: AvailableValues;
14 state: boolean;
15 protected value?: AvailableValues;
16 protected isDisabled: boolean;
17 protected onChange: Function;
18 protected onTouched: Function;
19 onClick(): void;
20 ngOnInit(): void;
21 protected get trueValue(): AvailableValues;
22 protected get falseValue(): AvailableValues;
23 toggle(state: boolean): void;
24 writeValue(value: boolean | string | null): void;
25 setDisabledState(isDisabled: boolean): void;
26 registerOnChange(fn: () => void): void;
27 registerOnTouched(fn: () => void): void;
28 static ɵfac: i0.ɵɵFactoryDeclaration<ButtonCheckboxDirective, never>;
29 static ɵdir: i0.ɵɵDirectiveDeclaration<ButtonCheckboxDirective, "[btnCheckbox]", never, { "btnCheckboxTrue": "btnCheckboxTrue"; "btnCheckboxFalse": "btnCheckboxFalse"; }, {}, never, never, false>;
30}
31export {};