source: trip-planner-front/node_modules/@angular/material/esm2015/slide-toggle/slide-toggle.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 38.5 KB
Line 
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 */
8import { FocusMonitor } from '@angular/cdk/a11y';
9import { coerceBooleanProperty } from '@angular/cdk/coercion';
10import { Attribute, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, forwardRef, Input, Output, ViewChild, ViewEncapsulation, Optional, Inject, } from '@angular/core';
11import { NG_VALUE_ACCESSOR } from '@angular/forms';
12import { mixinColor, mixinDisabled, mixinDisableRipple, mixinTabIndex, } from '@angular/material/core';
13import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
14import { MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS } from './slide-toggle-config';
15// Increasing integer for generating unique ids for slide-toggle components.
16let nextUniqueId = 0;
17/** @docs-private */
18export const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR = {
19 provide: NG_VALUE_ACCESSOR,
20 useExisting: forwardRef(() => MatSlideToggle),
21 multi: true
22};
23/** Change event object emitted by a MatSlideToggle. */
24export class MatSlideToggleChange {
25 constructor(
26 /** The source MatSlideToggle of the event. */
27 source,
28 /** The new `checked` value of the MatSlideToggle. */
29 checked) {
30 this.source = source;
31 this.checked = checked;
32 }
33}
34// Boilerplate for applying mixins to MatSlideToggle.
35/** @docs-private */
36const _MatSlideToggleBase = mixinTabIndex(mixinColor(mixinDisableRipple(mixinDisabled(class {
37 constructor(_elementRef) {
38 this._elementRef = _elementRef;
39 }
40}))));
41/** Represents a slidable "switch" toggle that can be moved between on and off. */
42export class MatSlideToggle extends _MatSlideToggleBase {
43 constructor(elementRef, _focusMonitor, _changeDetectorRef, tabIndex, defaults, animationMode) {
44 super(elementRef);
45 this._focusMonitor = _focusMonitor;
46 this._changeDetectorRef = _changeDetectorRef;
47 this.defaults = defaults;
48 this._onChange = (_) => { };
49 this._onTouched = () => { };
50 this._uniqueId = `mat-slide-toggle-${++nextUniqueId}`;
51 this._required = false;
52 this._checked = false;
53 /** Name value will be applied to the input element if present. */
54 this.name = null;
55 /** A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. */
56 this.id = this._uniqueId;
57 /** Whether the label should appear after or before the slide-toggle. Defaults to 'after'. */
58 this.labelPosition = 'after';
59 /** Used to set the aria-label attribute on the underlying input element. */
60 this.ariaLabel = null;
61 /** Used to set the aria-labelledby attribute on the underlying input element. */
62 this.ariaLabelledby = null;
63 /** An event will be dispatched each time the slide-toggle changes its value. */
64 this.change = new EventEmitter();
65 /**
66 * An event will be dispatched each time the slide-toggle input is toggled.
67 * This event is always emitted when the user toggles the slide toggle, but this does not mean
68 * the slide toggle's value has changed.
69 */
70 this.toggleChange = new EventEmitter();
71 this.tabIndex = parseInt(tabIndex) || 0;
72 this.color = this.defaultColor = defaults.color || 'accent';
73 this._noopAnimations = animationMode === 'NoopAnimations';
74 }
75 /** Whether the slide-toggle is required. */
76 get required() { return this._required; }
77 set required(value) { this._required = coerceBooleanProperty(value); }
78 /** Whether the slide-toggle element is checked or not. */
79 get checked() { return this._checked; }
80 set checked(value) {
81 this._checked = coerceBooleanProperty(value);
82 this._changeDetectorRef.markForCheck();
83 }
84 /** Returns the unique id for the visual hidden input. */
85 get inputId() { return `${this.id || this._uniqueId}-input`; }
86 ngAfterContentInit() {
87 this._focusMonitor
88 .monitor(this._elementRef, true)
89 .subscribe(focusOrigin => {
90 // Only forward focus manually when it was received programmatically or through the
91 // keyboard. We should not do this for mouse/touch focus for two reasons:
92 // 1. It can prevent clicks from landing in Chrome (see #18269).
93 // 2. They're already handled by the wrapping `label` element.
94 if (focusOrigin === 'keyboard' || focusOrigin === 'program') {
95 this._inputElement.nativeElement.focus();
96 }
97 else if (!focusOrigin) {
98 // When a focused element becomes disabled, the browser *immediately* fires a blur event.
99 // Angular does not expect events to be raised during change detection, so any state
100 // change (such as a form control's 'ng-touched') will cause a changed-after-checked
101 // error. See https://github.com/angular/angular/issues/17793. To work around this,
102 // we defer telling the form control it has been touched until the next tick.
103 Promise.resolve().then(() => this._onTouched());
104 }
105 });
106 }
107 ngOnDestroy() {
108 this._focusMonitor.stopMonitoring(this._elementRef);
109 }
110 /** Method being called whenever the underlying input emits a change event. */
111 _onChangeEvent(event) {
112 // We always have to stop propagation on the change event.
113 // Otherwise the change event, from the input element, will bubble up and
114 // emit its event object to the component's `change` output.
115 event.stopPropagation();
116 this.toggleChange.emit();
117 // When the slide toggle's config disables toggle change event by setting
118 // `disableToggleValue: true`, the slide toggle's value does not change, and the
119 // checked state of the underlying input needs to be changed back.
120 if (this.defaults.disableToggleValue) {
121 this._inputElement.nativeElement.checked = this.checked;
122 return;
123 }
124 // Sync the value from the underlying input element with the component instance.
125 this.checked = this._inputElement.nativeElement.checked;
126 // Emit our custom change event only if the underlying input emitted one. This ensures that
127 // there is no change event, when the checked state changes programmatically.
128 this._emitChangeEvent();
129 }
130 /** Method being called whenever the slide-toggle has been clicked. */
131 _onInputClick(event) {
132 // We have to stop propagation for click events on the visual hidden input element.
133 // By default, when a user clicks on a label element, a generated click event will be
134 // dispatched on the associated input element. Since we are using a label element as our
135 // root container, the click event on the `slide-toggle` will be executed twice.
136 // The real click event will bubble up, and the generated click event also tries to bubble up.
137 // This will lead to multiple click events.
138 // Preventing bubbling for the second event will solve that issue.
139 event.stopPropagation();
140 }
141 /** Implemented as part of ControlValueAccessor. */
142 writeValue(value) {
143 this.checked = !!value;
144 }
145 /** Implemented as part of ControlValueAccessor. */
146 registerOnChange(fn) {
147 this._onChange = fn;
148 }
149 /** Implemented as part of ControlValueAccessor. */
150 registerOnTouched(fn) {
151 this._onTouched = fn;
152 }
153 /** Implemented as a part of ControlValueAccessor. */
154 setDisabledState(isDisabled) {
155 this.disabled = isDisabled;
156 this._changeDetectorRef.markForCheck();
157 }
158 /** Focuses the slide-toggle. */
159 focus(options, origin) {
160 if (origin) {
161 this._focusMonitor.focusVia(this._inputElement, origin, options);
162 }
163 else {
164 this._inputElement.nativeElement.focus(options);
165 }
166 }
167 /** Toggles the checked state of the slide-toggle. */
168 toggle() {
169 this.checked = !this.checked;
170 this._onChange(this.checked);
171 }
172 /**
173 * Emits a change event on the `change` output. Also notifies the FormControl about the change.
174 */
175 _emitChangeEvent() {
176 this._onChange(this.checked);
177 this.change.emit(new MatSlideToggleChange(this, this.checked));
178 }
179 /** Method being called whenever the label text changes. */
180 _onLabelTextChange() {
181 // Since the event of the `cdkObserveContent` directive runs outside of the zone, the
182 // slide-toggle component will be only marked for check, but no actual change detection runs
183 // automatically. Instead of going back into the zone in order to trigger a change detection
184 // which causes *all* components to be checked (if explicitly marked or not using OnPush),
185 // we only trigger an explicit change detection for the slide-toggle view and its children.
186 this._changeDetectorRef.detectChanges();
187 }
188}
189MatSlideToggle.decorators = [
190 { type: Component, args: [{
191 selector: 'mat-slide-toggle',
192 exportAs: 'matSlideToggle',
193 host: {
194 'class': 'mat-slide-toggle',
195 '[id]': 'id',
196 // Needs to be `-1` so it can still receive programmatic focus.
197 '[attr.tabindex]': 'disabled ? null : -1',
198 '[attr.aria-label]': 'null',
199 '[attr.aria-labelledby]': 'null',
200 '[class.mat-checked]': 'checked',
201 '[class.mat-disabled]': 'disabled',
202 '[class.mat-slide-toggle-label-before]': 'labelPosition == "before"',
203 '[class._mat-animation-noopable]': '_noopAnimations',
204 },
205 template: "<label [attr.for]=\"inputId\" class=\"mat-slide-toggle-label\" #label>\n <div #toggleBar class=\"mat-slide-toggle-bar\"\n [class.mat-slide-toggle-bar-no-side-margin]=\"!labelContent.textContent || !labelContent.textContent.trim()\">\n\n <input #input class=\"mat-slide-toggle-input cdk-visually-hidden\" type=\"checkbox\"\n role=\"switch\"\n [id]=\"inputId\"\n [required]=\"required\"\n [tabIndex]=\"tabIndex\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [attr.name]=\"name\"\n [attr.aria-checked]=\"checked.toString()\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-describedby]=\"ariaDescribedby\"\n (change)=\"_onChangeEvent($event)\"\n (click)=\"_onInputClick($event)\">\n\n <div class=\"mat-slide-toggle-thumb-container\" #thumbContainer>\n <div class=\"mat-slide-toggle-thumb\"></div>\n <div class=\"mat-slide-toggle-ripple mat-focus-indicator\" mat-ripple\n [matRippleTrigger]=\"label\"\n [matRippleDisabled]=\"disableRipple || disabled\"\n [matRippleCentered]=\"true\"\n [matRippleRadius]=\"20\"\n [matRippleAnimation]=\"{enterDuration: _noopAnimations ? 0 : 150}\">\n\n <div class=\"mat-ripple-element mat-slide-toggle-persistent-ripple\"></div>\n </div>\n </div>\n\n </div>\n\n <span class=\"mat-slide-toggle-content\" #labelContent (cdkObserveContent)=\"_onLabelTextChange()\">\n <!-- Add an invisible span so JAWS can read the label -->\n <span style=\"display:none\">&nbsp;</span>\n <ng-content></ng-content>\n </span>\n</label>\n",
206 providers: [MAT_SLIDE_TOGGLE_VALUE_ACCESSOR],
207 inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],
208 encapsulation: ViewEncapsulation.None,
209 changeDetection: ChangeDetectionStrategy.OnPush,
210 styles: [".mat-slide-toggle{display:inline-block;height:24px;max-width:100%;line-height:24px;white-space:nowrap;outline:none;-webkit-tap-highlight-color:transparent}.mat-slide-toggle.mat-checked .mat-slide-toggle-thumb-container{transform:translate3d(16px, 0, 0)}[dir=rtl] .mat-slide-toggle.mat-checked .mat-slide-toggle-thumb-container{transform:translate3d(-16px, 0, 0)}.mat-slide-toggle.mat-disabled{opacity:.38}.mat-slide-toggle.mat-disabled .mat-slide-toggle-label,.mat-slide-toggle.mat-disabled .mat-slide-toggle-thumb-container{cursor:default}.mat-slide-toggle-label{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex:1;flex-direction:row;align-items:center;height:inherit;cursor:pointer}.mat-slide-toggle-content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mat-slide-toggle-label-before .mat-slide-toggle-label{order:1}.mat-slide-toggle-label-before .mat-slide-toggle-bar{order:2}[dir=rtl] .mat-slide-toggle-label-before .mat-slide-toggle-bar,.mat-slide-toggle-bar{margin-right:8px;margin-left:0}[dir=rtl] .mat-slide-toggle-bar,.mat-slide-toggle-label-before .mat-slide-toggle-bar{margin-left:8px;margin-right:0}.mat-slide-toggle-bar-no-side-margin{margin-left:0;margin-right:0}.mat-slide-toggle-thumb-container{position:absolute;z-index:1;width:20px;height:20px;top:-3px;left:0;transform:translate3d(0, 0, 0);transition:all 80ms linear;transition-property:transform}._mat-animation-noopable .mat-slide-toggle-thumb-container{transition:none}[dir=rtl] .mat-slide-toggle-thumb-container{left:auto;right:0}.mat-slide-toggle-thumb{height:20px;width:20px;border-radius:50%}.mat-slide-toggle-bar{position:relative;width:36px;height:14px;flex-shrink:0;border-radius:8px}.mat-slide-toggle-input{bottom:0;left:10px}[dir=rtl] .mat-slide-toggle-input{left:auto;right:10px}.mat-slide-toggle-bar,.mat-slide-toggle-thumb{transition:all 80ms linear;transition-property:background-color;transition-delay:50ms}._mat-animation-noopable .mat-slide-toggle-bar,._mat-animation-noopable .mat-slide-toggle-thumb{transition:none}.mat-slide-toggle .mat-slide-toggle-ripple{position:absolute;top:calc(50% - 20px);left:calc(50% - 20px);height:40px;width:40px;z-index:1;pointer-events:none}.mat-slide-toggle .mat-slide-toggle-ripple .mat-ripple-element:not(.mat-slide-toggle-persistent-ripple){opacity:.12}.mat-slide-toggle-persistent-ripple{width:100%;height:100%;transform:none}.mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{opacity:.04}.mat-slide-toggle:not(.mat-disabled).cdk-keyboard-focused .mat-slide-toggle-persistent-ripple{opacity:.12}.mat-slide-toggle-persistent-ripple,.mat-slide-toggle.mat-disabled .mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{opacity:0}@media(hover: none){.mat-slide-toggle-bar:hover .mat-slide-toggle-persistent-ripple{display:none}}.cdk-high-contrast-active .mat-slide-toggle-thumb,.cdk-high-contrast-active .mat-slide-toggle-bar{border:1px solid}.cdk-high-contrast-active .mat-slide-toggle.cdk-keyboard-focused .mat-slide-toggle-bar{outline:2px dotted;outline-offset:5px}\n"]
211 },] }
212];
213MatSlideToggle.ctorParameters = () => [
214 { type: ElementRef },
215 { type: FocusMonitor },
216 { type: ChangeDetectorRef },
217 { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] },
218 { type: undefined, decorators: [{ type: Inject, args: [MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS,] }] },
219 { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
220];
221MatSlideToggle.propDecorators = {
222 _thumbEl: [{ type: ViewChild, args: ['thumbContainer',] }],
223 _thumbBarEl: [{ type: ViewChild, args: ['toggleBar',] }],
224 name: [{ type: Input }],
225 id: [{ type: Input }],
226 labelPosition: [{ type: Input }],
227 ariaLabel: [{ type: Input, args: ['aria-label',] }],
228 ariaLabelledby: [{ type: Input, args: ['aria-labelledby',] }],
229 ariaDescribedby: [{ type: Input, args: ['aria-describedby',] }],
230 required: [{ type: Input }],
231 checked: [{ type: Input }],
232 change: [{ type: Output }],
233 toggleChange: [{ type: Output }],
234 _inputElement: [{ type: ViewChild, args: ['input',] }]
235};
236//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xpZGUtdG9nZ2xlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3NsaWRlLXRvZ2dsZS9zbGlkZS10b2dnbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFlBQVksRUFB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XQtZGlzYWJsZWRdJzogJ2Rpc2FibGVkJyxcbiAgICAnW2NsYXNzLm1hdC1zbGlkZS10b2dnbGUtbGFiZWwtYmVmb3JlXSc6ICdsYWJlbFBvc2l0aW9uID09IFwiYmVmb3JlXCInLFxuICAgICdbY2xhc3MuX21hdC1hbmltYXRpb24tbm9vcGFibGVdJzogJ19ub29wQW5pbWF0aW9ucycsXG4gIH0sXG4gIHRlbXBsYXRlVXJsOiAnc2xpZGUtdG9nZ2xlLmh0bWwnLFxuICBzdHlsZVVybHM6IFsnc2xpZGUtdG9nZ2xlLmNzcyddLFxuICBwcm92aWRlcnM6IFtNQVRfU0xJREVfVE9HR0xFX1ZBTFVFX0FDQ0VTU09SXSxcbiAgaW5wdXRzOiBbJ2Rpc2FibGVkJywgJ2Rpc2FibGVSaXBwbGUnLCAnY29sb3InLCAndGFiSW5kZXgnXSxcbiAgZW5jYXBzdWxhdGlvbjogVmlld0VuY2Fwc3VsYXRpb24uTm9uZSxcbiAgY2hhbmdlRGV0ZWN0aW9uOiBDaGFuZ2VEZXRlY3Rpb25TdHJhdGVneS5PblB1c2gsXG59KVxuZXhwb3J0IGNsYXNzIE1hdFNsaWRlVG9nZ2xlIGV4dGVuZHMgX01hdFNsaWRlVG9nZ2xlQmFzZSBpbXBsZW1lbnRzIE9uRGVzdHJveSwgQWZ0ZXJDb250ZW50SW5pdCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb250cm9sVmFsdWVBY2Nlc3NvcixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDYW5EaXNhYmxlLCBDYW5Db2xvcixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBIYXNUYWJJbmRleCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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