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 { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';
|
---|
9 | import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
---|
10 | import { AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy } from '@angular/core';
|
---|
11 | import { ControlValueAccessor } from '@angular/forms';
|
---|
12 | import { CanColor, CanDisable, CanDisableRipple, HasTabIndex } from '@angular/material/core';
|
---|
13 | import { MatSlideToggleDefaultOptions } from './slide-toggle-config';
|
---|
14 | /** @docs-private */
|
---|
15 | export declare const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR: any;
|
---|
16 | /** Change event object emitted by a MatSlideToggle. */
|
---|
17 | export declare class MatSlideToggleChange {
|
---|
18 | /** The source MatSlideToggle of the event. */
|
---|
19 | source: MatSlideToggle;
|
---|
20 | /** The new `checked` value of the MatSlideToggle. */
|
---|
21 | checked: boolean;
|
---|
22 | constructor(
|
---|
23 | /** The source MatSlideToggle of the event. */
|
---|
24 | source: MatSlideToggle,
|
---|
25 | /** The new `checked` value of the MatSlideToggle. */
|
---|
26 | checked: boolean);
|
---|
27 | }
|
---|
28 | /** @docs-private */
|
---|
29 | declare const _MatSlideToggleBase: 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> & {
|
---|
30 | new (_elementRef: ElementRef): {
|
---|
31 | _elementRef: ElementRef;
|
---|
32 | };
|
---|
33 | };
|
---|
34 | /** Represents a slidable "switch" toggle that can be moved between on and off. */
|
---|
35 | export declare class MatSlideToggle extends _MatSlideToggleBase implements OnDestroy, AfterContentInit, ControlValueAccessor, CanDisable, CanColor, HasTabIndex, CanDisableRipple {
|
---|
36 | private _focusMonitor;
|
---|
37 | private _changeDetectorRef;
|
---|
38 | defaults: MatSlideToggleDefaultOptions;
|
---|
39 | private _onChange;
|
---|
40 | private _onTouched;
|
---|
41 | private _uniqueId;
|
---|
42 | private _required;
|
---|
43 | private _checked;
|
---|
44 | /** Whether noop animations are enabled. */
|
---|
45 | _noopAnimations: boolean;
|
---|
46 | /** Reference to the thumb HTMLElement. */
|
---|
47 | _thumbEl: ElementRef;
|
---|
48 | /** Reference to the thumb bar HTMLElement. */
|
---|
49 | _thumbBarEl: ElementRef;
|
---|
50 | /** Name value will be applied to the input element if present. */
|
---|
51 | name: string | null;
|
---|
52 | /** A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. */
|
---|
53 | id: string;
|
---|
54 | /** Whether the label should appear after or before the slide-toggle. Defaults to 'after'. */
|
---|
55 | labelPosition: 'before' | 'after';
|
---|
56 | /** Used to set the aria-label attribute on the underlying input element. */
|
---|
57 | ariaLabel: string | null;
|
---|
58 | /** Used to set the aria-labelledby attribute on the underlying input element. */
|
---|
59 | ariaLabelledby: string | null;
|
---|
60 | /** Used to set the aria-describedby attribute on the underlying input element. */
|
---|
61 | ariaDescribedby: string;
|
---|
62 | /** Whether the slide-toggle is required. */
|
---|
63 | get required(): boolean;
|
---|
64 | set required(value: boolean);
|
---|
65 | /** Whether the slide-toggle element is checked or not. */
|
---|
66 | get checked(): boolean;
|
---|
67 | set checked(value: boolean);
|
---|
68 | /** An event will be dispatched each time the slide-toggle changes its value. */
|
---|
69 | readonly change: EventEmitter<MatSlideToggleChange>;
|
---|
70 | /**
|
---|
71 | * An event will be dispatched each time the slide-toggle input is toggled.
|
---|
72 | * This event is always emitted when the user toggles the slide toggle, but this does not mean
|
---|
73 | * the slide toggle's value has changed.
|
---|
74 | */
|
---|
75 | readonly toggleChange: EventEmitter<void>;
|
---|
76 | /** Returns the unique id for the visual hidden input. */
|
---|
77 | get inputId(): string;
|
---|
78 | /** Reference to the underlying input element. */
|
---|
79 | _inputElement: ElementRef<HTMLInputElement>;
|
---|
80 | constructor(elementRef: ElementRef, _focusMonitor: FocusMonitor, _changeDetectorRef: ChangeDetectorRef, tabIndex: string, defaults: MatSlideToggleDefaultOptions, animationMode?: string);
|
---|
81 | ngAfterContentInit(): void;
|
---|
82 | ngOnDestroy(): void;
|
---|
83 | /** Method being called whenever the underlying input emits a change event. */
|
---|
84 | _onChangeEvent(event: Event): void;
|
---|
85 | /** Method being called whenever the slide-toggle has been clicked. */
|
---|
86 | _onInputClick(event: Event): void;
|
---|
87 | /** Implemented as part of ControlValueAccessor. */
|
---|
88 | writeValue(value: any): void;
|
---|
89 | /** Implemented as part of ControlValueAccessor. */
|
---|
90 | registerOnChange(fn: any): void;
|
---|
91 | /** Implemented as part of ControlValueAccessor. */
|
---|
92 | registerOnTouched(fn: any): void;
|
---|
93 | /** Implemented as a part of ControlValueAccessor. */
|
---|
94 | setDisabledState(isDisabled: boolean): void;
|
---|
95 | /** Focuses the slide-toggle. */
|
---|
96 | focus(options?: FocusOptions, origin?: FocusOrigin): void;
|
---|
97 | /** Toggles the checked state of the slide-toggle. */
|
---|
98 | toggle(): void;
|
---|
99 | /**
|
---|
100 | * Emits a change event on the `change` output. Also notifies the FormControl about the change.
|
---|
101 | */
|
---|
102 | private _emitChangeEvent;
|
---|
103 | /** Method being called whenever the label text changes. */
|
---|
104 | _onLabelTextChange(): void;
|
---|
105 | static ngAcceptInputType_required: BooleanInput;
|
---|
106 | static ngAcceptInputType_checked: BooleanInput;
|
---|
107 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
108 | static ngAcceptInputType_disableRipple: BooleanInput;
|
---|
109 | static ngAcceptInputType_tabIndex: NumberInput;
|
---|
110 | }
|
---|
111 | export {};
|
---|