UNPKG

@angular-mdc/web

Version:
108 lines (107 loc) 4.27 kB
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { Platform } from '@angular/cdk/platform'; import { MDCCheckboxFoundation } from '@material/checkbox'; import { MDCComponent } from '@angular-mdc/web/base'; import { MdcRipple, MDCRippleCapableSurface } from '@angular-mdc/web/ripple'; import { MdcFormField, MdcFormFieldControl } from '@angular-mdc/web/form-field'; /** Change event object emitted by MdcCheckbox. */ export declare class MdcCheckboxChange { /** The source MdcCheckbox of the event. */ source: MdcCheckbox; /** The new `checked` value of the checkbox. */ checked: boolean; constructor( /** The source MdcCheckbox of the event. */ source: MdcCheckbox, /** The new `checked` value of the checkbox. */ checked: boolean); } export interface MdcIndeterminateChange { source: MdcCheckbox; indeterminate: boolean; } export declare const MDC_CHECKBOX_CONTROL_VALUE_ACCESSOR: any; export declare class MdcCheckbox extends MDCComponent<MDCCheckboxFoundation> implements AfterViewInit, ControlValueAccessor, OnDestroy, MdcFormFieldControl<any>, MDCRippleCapableSurface { private _platform; private _ngZone; private _changeDetectorRef; elementRef: ElementRef<HTMLElement>; ripple: MdcRipple; private _parentFormField; /** Emits whenever the component is destroyed. */ private _destroy; _root: Element; private _initialized; private _uniqueId; id: string; /** Returns the unique id for the visual hidden input. */ get inputId(): string; name: string | null; get checked(): boolean; set checked(value: boolean); private _checked; get touch(): boolean; set touch(value: boolean); private _touch; get disabled(): boolean; set disabled(value: boolean); private _disabled; /** The value attribute of the native input element */ value: string | null; /** * Alternative state of the checkbox, not user set-able state. Between * [checked] and [indeterminate], only one can be true, though both can be * false. * `true` is INDETERMINATE and `false` is not. */ get indeterminate(): boolean; set indeterminate(value: boolean); private _indeterminate; /** * Determines the state to go into when [indeterminate] state is toggled. * `true` will go to checked and `false` will go to unchecked. */ get indeterminateToChecked(): boolean; set indeterminateToChecked(value: boolean); private _indeterminateToChecked; /** Whether the ripple ink is disabled. */ get disableRipple(): boolean; set disableRipple(value: boolean); private _disableRipple; tabIndex: number; ariaLabel: string; ariaLabelledby: string | null; /** * Fired when checkbox is checked or unchecked, but not when set * indeterminate. Sends the state of [checked]. */ readonly change: EventEmitter<MdcCheckboxChange>; /** * Fired when checkbox goes in and out of indeterminate state, but not when * set to checked. Sends the state of [indeterminate]; */ readonly indeterminateChange: EventEmitter<MdcIndeterminateChange>; _inputElement: ElementRef<HTMLInputElement>; /** View to model callback called when value changes */ _onChange: (value: any) => void; /** View to model callback called when component has been touched */ _onTouched: () => any; getDefaultFoundation(): any; constructor(_platform: Platform, _ngZone: NgZone, _changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef<HTMLElement>, ripple: MdcRipple, _parentFormField: MdcFormField); _asyncBuildFoundation(): Promise<void>; ngAfterViewInit(): void; ngOnDestroy(): void; writeValue(value: any): void; registerOnChange(fn: (value: any) => void): void; registerOnTouched(fn: any): void; /** Focuses the checkbox. */ focus(): void; toggle(checked?: boolean): void; _onInteraction(evt: Event): void; _onInputClick(evt: Event): void; setDisabledState(disabled: boolean): void; private _setState; private _createRipple; private _loadListeners; }