[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { FocusableOption, FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';
|
---|
| 9 | import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
---|
| 10 | import { AfterViewChecked, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, AfterViewInit } from '@angular/core';
|
---|
| 11 | import { ControlValueAccessor } from '@angular/forms';
|
---|
| 12 | import { CanColor, CanDisable, CanDisableRipple, HasTabIndex, MatRipple } from '@angular/material/core';
|
---|
| 13 | import { MatCheckboxDefaultOptions } from './checkbox-config';
|
---|
| 14 | /**
|
---|
| 15 | * Provider Expression that allows mat-checkbox to register as a ControlValueAccessor.
|
---|
| 16 | * This allows it to support [(ngModel)].
|
---|
| 17 | * @docs-private
|
---|
| 18 | */
|
---|
| 19 | export declare const MAT_CHECKBOX_CONTROL_VALUE_ACCESSOR: any;
|
---|
| 20 | /**
|
---|
| 21 | * Represents the different states that require custom transitions between them.
|
---|
| 22 | * @docs-private
|
---|
| 23 | */
|
---|
| 24 | export declare const enum TransitionCheckState {
|
---|
| 25 | /** The initial state of the component before any user interaction. */
|
---|
| 26 | Init = 0,
|
---|
| 27 | /** The state representing the component when it's becoming checked. */
|
---|
| 28 | Checked = 1,
|
---|
| 29 | /** The state representing the component when it's becoming unchecked. */
|
---|
| 30 | Unchecked = 2,
|
---|
| 31 | /** The state representing the component when it's becoming indeterminate. */
|
---|
| 32 | Indeterminate = 3
|
---|
| 33 | }
|
---|
| 34 | /** Change event object emitted by MatCheckbox. */
|
---|
| 35 | export declare class MatCheckboxChange {
|
---|
| 36 | /** The source MatCheckbox of the event. */
|
---|
| 37 | source: MatCheckbox;
|
---|
| 38 | /** The new `checked` value of the checkbox. */
|
---|
| 39 | checked: boolean;
|
---|
| 40 | }
|
---|
| 41 | /** @docs-private */
|
---|
| 42 | declare const _MatCheckboxBase: import("@angular/material/core/common-behaviors/constructor").Constructor<HasTabIndex> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<HasTabIndex> & import("@angular/material/core/common-behaviors/constructor").Constructor<CanColor> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanColor> & import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisableRipple> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisableRipple> & import("@angular/material/core/common-behaviors/constructor").Constructor<CanDisable> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanDisable> & {
|
---|
| 43 | new (_elementRef: ElementRef): {
|
---|
| 44 | _elementRef: ElementRef;
|
---|
| 45 | };
|
---|
| 46 | };
|
---|
| 47 | /**
|
---|
| 48 | * A material design checkbox component. Supports all of the functionality of an HTML5 checkbox,
|
---|
| 49 | * and exposes a similar API. A MatCheckbox can be either checked, unchecked, indeterminate, or
|
---|
| 50 | * disabled. Note that all additional accessibility attributes are taken care of by the component,
|
---|
| 51 | * so there is no need to provide them yourself. However, if you want to omit a label and still
|
---|
| 52 | * have the checkbox be accessible, you may supply an [aria-label] input.
|
---|
| 53 | * See: https://material.io/design/components/selection-controls.html
|
---|
| 54 | */
|
---|
| 55 | export declare class MatCheckbox extends _MatCheckboxBase implements ControlValueAccessor, AfterViewInit, AfterViewChecked, OnDestroy, CanColor, CanDisable, HasTabIndex, CanDisableRipple, FocusableOption {
|
---|
| 56 | private _changeDetectorRef;
|
---|
| 57 | private _focusMonitor;
|
---|
| 58 | private _ngZone;
|
---|
| 59 | _animationMode?: string | undefined;
|
---|
| 60 | private _options?;
|
---|
| 61 | /**
|
---|
| 62 | * Attached to the aria-label attribute of the host element. In most cases, aria-labelledby will
|
---|
| 63 | * take precedence so this may be omitted.
|
---|
| 64 | */
|
---|
| 65 | ariaLabel: string;
|
---|
| 66 | /**
|
---|
| 67 | * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element
|
---|
| 68 | */
|
---|
| 69 | ariaLabelledby: string | null;
|
---|
| 70 | /** The 'aria-describedby' attribute is read after the element's label and field type. */
|
---|
| 71 | ariaDescribedby: string;
|
---|
| 72 | private _uniqueId;
|
---|
| 73 | /** A unique id for the checkbox input. If none is supplied, it will be auto-generated. */
|
---|
| 74 | id: string;
|
---|
| 75 | /** Returns the unique id for the visual hidden input. */
|
---|
| 76 | get inputId(): string;
|
---|
| 77 | /** Whether the checkbox is required. */
|
---|
| 78 | get required(): boolean;
|
---|
| 79 | set required(value: boolean);
|
---|
| 80 | private _required;
|
---|
| 81 | /** Whether the label should appear after or before the checkbox. Defaults to 'after' */
|
---|
| 82 | labelPosition: 'before' | 'after';
|
---|
| 83 | /** Name value will be applied to the input element if present */
|
---|
| 84 | name: string | null;
|
---|
| 85 | /** Event emitted when the checkbox's `checked` value changes. */
|
---|
| 86 | readonly change: EventEmitter<MatCheckboxChange>;
|
---|
| 87 | /** Event emitted when the checkbox's `indeterminate` value changes. */
|
---|
| 88 | readonly indeterminateChange: EventEmitter<boolean>;
|
---|
| 89 | /** The value attribute of the native input element */
|
---|
| 90 | value: string;
|
---|
| 91 | /** The native `<input type="checkbox">` element */
|
---|
| 92 | _inputElement: ElementRef<HTMLInputElement>;
|
---|
| 93 | /** Reference to the ripple instance of the checkbox. */
|
---|
| 94 | ripple: MatRipple;
|
---|
| 95 | /**
|
---|
| 96 | * Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor.
|
---|
| 97 | * @docs-private
|
---|
| 98 | */
|
---|
| 99 | _onTouched: () => any;
|
---|
| 100 | private _currentAnimationClass;
|
---|
| 101 | private _currentCheckState;
|
---|
| 102 | private _controlValueAccessorChangeFn;
|
---|
| 103 | constructor(elementRef: ElementRef<HTMLElement>, _changeDetectorRef: ChangeDetectorRef, _focusMonitor: FocusMonitor, _ngZone: NgZone, tabIndex: string, _animationMode?: string | undefined, _options?: MatCheckboxDefaultOptions | undefined);
|
---|
| 104 | ngAfterViewInit(): void;
|
---|
| 105 | ngAfterViewChecked(): void;
|
---|
| 106 | ngOnDestroy(): void;
|
---|
| 107 | /**
|
---|
| 108 | * Whether the checkbox is checked.
|
---|
| 109 | */
|
---|
| 110 | get checked(): boolean;
|
---|
| 111 | set checked(value: boolean);
|
---|
| 112 | private _checked;
|
---|
| 113 | /**
|
---|
| 114 | * Whether the checkbox is disabled. This fully overrides the implementation provided by
|
---|
| 115 | * mixinDisabled, but the mixin is still required because mixinTabIndex requires it.
|
---|
| 116 | */
|
---|
| 117 | get disabled(): any;
|
---|
| 118 | set disabled(value: any);
|
---|
| 119 | private _disabled;
|
---|
| 120 | /**
|
---|
| 121 | * Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to
|
---|
| 122 | * represent a checkbox with three states, e.g. a checkbox that represents a nested list of
|
---|
| 123 | * checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately
|
---|
| 124 | * set to false.
|
---|
| 125 | */
|
---|
| 126 | get indeterminate(): boolean;
|
---|
| 127 | set indeterminate(value: boolean);
|
---|
| 128 | private _indeterminate;
|
---|
| 129 | _isRippleDisabled(): any;
|
---|
| 130 | /** Method being called whenever the label text changes. */
|
---|
| 131 | _onLabelTextChange(): void;
|
---|
| 132 | writeValue(value: any): void;
|
---|
| 133 | registerOnChange(fn: (value: any) => void): void;
|
---|
| 134 | registerOnTouched(fn: any): void;
|
---|
| 135 | setDisabledState(isDisabled: boolean): void;
|
---|
| 136 | _getAriaChecked(): 'true' | 'false' | 'mixed';
|
---|
| 137 | private _transitionCheckState;
|
---|
| 138 | private _emitChangeEvent;
|
---|
| 139 | /** Toggles the `checked` state of the checkbox. */
|
---|
| 140 | toggle(): void;
|
---|
| 141 | /**
|
---|
| 142 | * Event handler for checkbox input element.
|
---|
| 143 | * Toggles checked state if element is not disabled.
|
---|
| 144 | * Do not toggle on (change) event since IE doesn't fire change event when
|
---|
| 145 | * indeterminate checkbox is clicked.
|
---|
| 146 | * @param event
|
---|
| 147 | */
|
---|
| 148 | _onInputClick(event: Event): void;
|
---|
| 149 | /** Focuses the checkbox. */
|
---|
| 150 | focus(origin?: FocusOrigin, options?: FocusOptions): void;
|
---|
| 151 | _onInteractionEvent(event: Event): void;
|
---|
| 152 | private _getAnimationClassForCheckStateTransition;
|
---|
| 153 | /**
|
---|
| 154 | * Syncs the indeterminate value with the checkbox DOM node.
|
---|
| 155 | *
|
---|
| 156 | * We sync `indeterminate` directly on the DOM node, because in Ivy the check for whether a
|
---|
| 157 | * property is supported on an element boils down to `if (propName in element)`. Domino's
|
---|
| 158 | * HTMLInputElement doesn't have an `indeterminate` property so Ivy will warn during
|
---|
| 159 | * server-side rendering.
|
---|
| 160 | */
|
---|
| 161 | private _syncIndeterminate;
|
---|
| 162 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
| 163 | static ngAcceptInputType_required: BooleanInput;
|
---|
| 164 | static ngAcceptInputType_disableRipple: BooleanInput;
|
---|
| 165 | static ngAcceptInputType_indeterminate: BooleanInput;
|
---|
| 166 | static ngAcceptInputType_tabIndex: NumberInput;
|
---|
| 167 | }
|
---|
| 168 | export {};
|
---|