blob: 251d9ad61f3c8938e5aa9bdfc41fd281b7e2b2ef [file] [log] [blame]
{"version":3,"file":"material-slide-toggle.umd.min.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/material/slide-toggle/slide-toggle-config.ts","../../src/material/slide-toggle/slide-toggle.ts","../../src/material/slide-toggle/slide-toggle-module.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {InjectionToken} from '@angular/core';\n\n\n/** Default `mat-slide-toggle` options that can be overridden. */\nexport interface MatSlideToggleDefaultOptions {\n /** Whether toggle action triggers value changes in slide toggle. */\n disableToggleValue?: boolean;\n /** Whether drag action triggers value changes in slide toggle. */\n disableDragValue?: boolean;\n}\n\n/** Injection token to be used to override the default options for `mat-slide-toggle`. */\nexport const MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS =\n new InjectionToken<MatSlideToggleDefaultOptions>('mat-slide-toggle-default-options', {\n providedIn: 'root',\n factory: () => ({disableToggleValue: false, disableDragValue: false})\n });\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {FocusMonitor} from '@angular/cdk/a11y';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Attribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n OnDestroy,\n Output,\n ViewChild,\n ViewEncapsulation,\n NgZone,\n Optional,\n Inject,\n} from '@angular/core';\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {\n CanColor, CanColorCtor,\n CanDisable, CanDisableCtor,\n CanDisableRipple, CanDisableRippleCtor,\n HammerInput,\n HasTabIndex, HasTabIndexCtor,\n mixinColor,\n mixinDisabled,\n mixinDisableRipple,\n mixinTabIndex,\n} from '@angular/material/core';\nimport {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';\nimport {\n MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS,\n MatSlideToggleDefaultOptions\n} from './slide-toggle-config';\n\n// Increasing integer for generating unique ids for slide-toggle components.\nlet nextUniqueId = 0;\n\n/** @docs-private */\nexport const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MatSlideToggle),\n multi: true\n};\n\n/** Change event object emitted by a MatSlideToggle. */\nexport class MatSlideToggleChange {\n constructor(\n /** The source MatSlideToggle of the event. */\n public source: MatSlideToggle,\n /** The new `checked` value of the MatSlideToggle. */\n public checked: boolean) { }\n}\n\n// Boilerplate for applying mixins to MatSlideToggle.\n/** @docs-private */\nclass MatSlideToggleBase {\n constructor(public _elementRef: ElementRef) {}\n}\nconst _MatSlideToggleMixinBase:\n HasTabIndexCtor &\n CanColorCtor &\n CanDisableRippleCtor &\n CanDisableCtor &\n typeof MatSlideToggleBase =\n mixinTabIndex(mixinColor(mixinDisableRipple(mixinDisabled(MatSlideToggleBase)), 'accent'));\n\n/** Represents a slidable \"switch\" toggle that can be moved between on and off. */\n@Component({\n moduleId: module.id,\n selector: 'mat-slide-toggle',\n exportAs: 'matSlideToggle',\n host: {\n 'class': 'mat-slide-toggle',\n '[id]': 'id',\n // Needs to be `-1` so it can still receive programmatic focus.\n '[attr.tabindex]': 'disabled ? null : -1',\n '[class.mat-checked]': 'checked',\n '[class.mat-disabled]': 'disabled',\n '[class.mat-slide-toggle-label-before]': 'labelPosition == \"before\"',\n '[class._mat-animation-noopable]': '_animationMode === \"NoopAnimations\"',\n '(focus)': '_inputElement.nativeElement.focus()',\n },\n templateUrl: 'slide-toggle.html',\n styleUrls: ['slide-toggle.css'],\n providers: [MAT_SLIDE_TOGGLE_VALUE_ACCESSOR],\n inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestroy, AfterContentInit,\n ControlValueAccessor,\n CanDisable, CanColor,\n HasTabIndex,\n CanDisableRipple {\n private _onChange = (_: any) => {};\n private _onTouched = () => {};\n\n private _uniqueId: string = `mat-slide-toggle-${++nextUniqueId}`;\n private _required: boolean = false;\n private _checked: boolean = false;\n\n /** Whether the thumb is currently being dragged. */\n private _dragging = false;\n\n /** Previous checked state before drag started. */\n private _previousChecked: boolean;\n\n /** Width of the thumb bar of the slide-toggle. */\n private _thumbBarWidth: number;\n\n /** Percentage of the thumb while dragging. Percentage as fraction of 100. */\n private _dragPercentage: number;\n\n /** Reference to the thumb HTMLElement. */\n @ViewChild('thumbContainer', {static: false}) _thumbEl: ElementRef;\n\n /** Reference to the thumb bar HTMLElement. */\n @ViewChild('toggleBar', {static: false}) _thumbBarEl: ElementRef;\n\n /** Name value will be applied to the input element if present. */\n @Input() name: string | null = null;\n\n /** A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. */\n @Input() id: string = this._uniqueId;\n\n /** Whether the label should appear after or before the slide-toggle. Defaults to 'after'. */\n @Input() labelPosition: 'before' | 'after' = 'after';\n\n /** Used to set the aria-label attribute on the underlying input element. */\n @Input('aria-label') ariaLabel: string | null = null;\n\n /** Used to set the aria-labelledby attribute on the underlying input element. */\n @Input('aria-labelledby') ariaLabelledby: string | null = null;\n\n /** Whether the slide-toggle is required. */\n @Input()\n get required(): boolean { return this._required; }\n set required(value) { this._required = coerceBooleanProperty(value); }\n\n /** Whether the slide-toggle element is checked or not. */\n @Input()\n get checked(): boolean { return this._checked; }\n set checked(value) {\n this._checked = coerceBooleanProperty(value);\n this._changeDetectorRef.markForCheck();\n }\n /** An event will be dispatched each time the slide-toggle changes its value. */\n @Output() readonly change: EventEmitter<MatSlideToggleChange> =\n new EventEmitter<MatSlideToggleChange>();\n\n /**\n * An event will be dispatched each time the slide-toggle input is toggled.\n * This event is always emitted when the user toggles the slide toggle, but this does not mean\n * the slide toggle's value has changed. The event does not fire when the user drags to change\n * the slide toggle value.\n */\n @Output() readonly toggleChange: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * An event will be dispatched each time the slide-toggle is dragged.\n * This event is always emitted when the user drags the slide toggle to make a change greater\n * than 50%. It does not mean the slide toggle's value is changed. The event is not emitted when\n * the user toggles the slide toggle to change its value.\n */\n @Output() readonly dragChange: EventEmitter<void> = new EventEmitter<void>();\n\n /** Returns the unique id for the visual hidden input. */\n get inputId(): string { return `${this.id || this._uniqueId}-input`; }\n\n /** Reference to the underlying input element. */\n @ViewChild('input', {static: false}) _inputElement: ElementRef<HTMLInputElement>;\n\n constructor(elementRef: ElementRef,\n private _focusMonitor: FocusMonitor,\n private _changeDetectorRef: ChangeDetectorRef,\n @Attribute('tabindex') tabIndex: string,\n private _ngZone: NgZone,\n @Inject(MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS)\n public defaults: MatSlideToggleDefaultOptions,\n @Optional() @Inject(ANIMATION_MODULE_TYPE) public _animationMode?: string,\n @Optional() private _dir?: Directionality) {\n super(elementRef);\n this.tabIndex = parseInt(tabIndex) || 0;\n }\n\n ngAfterContentInit() {\n this._focusMonitor\n .monitor(this._elementRef, true)\n .subscribe(focusOrigin => {\n if (!focusOrigin) {\n // When a focused element becomes disabled, the browser *immediately* fires a blur event.\n // Angular does not expect events to be raised during change detection, so any state\n // change (such as a form control's 'ng-touched') will cause a changed-after-checked\n // error. See https://github.com/angular/angular/issues/17793. To work around this,\n // we defer telling the form control it has been touched until the next tick.\n Promise.resolve().then(() => this._onTouched());\n }\n });\n }\n\n ngOnDestroy() {\n this._focusMonitor.stopMonitoring(this._elementRef);\n }\n\n /** Method being called whenever the underlying input emits a change event. */\n _onChangeEvent(event: Event) {\n // We always have to stop propagation on the change event.\n // Otherwise the change event, from the input element, will bubble up and\n // emit its event object to the component's `change` output.\n event.stopPropagation();\n\n if (!this._dragging) {\n this.toggleChange.emit();\n }\n // Releasing the pointer over the `<label>` element while dragging triggers another\n // click event on the `<label>` element. This means that the checked state of the underlying\n // input changed unintentionally and needs to be changed back. Or when the slide toggle's config\n // disabled toggle change event by setting `disableToggleValue: true`, the slide toggle's value\n // does not change, and the checked state of the underlying input needs to be changed back.\n if (this._dragging || this.defaults.disableToggleValue) {\n this._inputElement.nativeElement.checked = this.checked;\n return;\n }\n\n // Sync the value from the underlying input element with the component instance.\n this.checked = this._inputElement.nativeElement.checked;\n\n // Emit our custom change event only if the underlying input emitted one. This ensures that\n // there is no change event, when the checked state changes programmatically.\n this._emitChangeEvent();\n }\n\n /** Method being called whenever the slide-toggle has been clicked. */\n _onInputClick(event: Event) {\n // We have to stop propagation for click events on the visual hidden input element.\n // By default, when a user clicks on a label element, a generated click event will be\n // dispatched on the associated input element. Since we are using a label element as our\n // root container, the click event on the `slide-toggle` will be executed twice.\n // The real click event will bubble up, and the generated click event also tries to bubble up.\n // This will lead to multiple click events.\n // Preventing bubbling for the second event will solve that issue.\n event.stopPropagation();\n }\n\n /** Implemented as part of ControlValueAccessor. */\n writeValue(value: any): void {\n this.checked = !!value;\n }\n\n /** Implemented as part of ControlValueAccessor. */\n registerOnChange(fn: any): void {\n this._onChange = fn;\n }\n\n /** Implemented as part of ControlValueAccessor. */\n registerOnTouched(fn: any): void {\n this._onTouched = fn;\n }\n\n /** Implemented as a part of ControlValueAccessor. */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this._changeDetectorRef.markForCheck();\n }\n\n /** Focuses the slide-toggle. */\n focus(): void {\n this._focusMonitor.focusVia(this._inputElement, 'keyboard');\n }\n\n /** Toggles the checked state of the slide-toggle. */\n toggle(): void {\n this.checked = !this.checked;\n this._onChange(this.checked);\n }\n\n /**\n * Emits a change event on the `change` output. Also notifies the FormControl about the change.\n */\n private _emitChangeEvent() {\n this._onChange(this.checked);\n this.change.emit(new MatSlideToggleChange(this, this.checked));\n }\n\n /** Retrieves the percentage of thumb from the moved distance. Percentage as fraction of 100. */\n private _getDragPercentage(distance: number) {\n let percentage = (distance / this._thumbBarWidth) * 100;\n\n // When the toggle was initially checked, then we have to start the drag at the end.\n if (this._previousChecked) {\n percentage += 100;\n }\n\n return Math.max(0, Math.min(percentage, 100));\n }\n\n _onDragStart() {\n if (!this.disabled && !this._dragging) {\n const thumbEl = this._thumbEl.nativeElement;\n this._thumbBarWidth = this._thumbBarEl.nativeElement.clientWidth - thumbEl.clientWidth;\n thumbEl.classList.add('mat-dragging');\n\n this._previousChecked = this.checked;\n this._dragging = true;\n }\n }\n\n _onDrag(event: HammerInput) {\n if (this._dragging) {\n const direction = this._dir && this._dir.value === 'rtl' ? -1 : 1;\n this._dragPercentage = this._getDragPercentage(event.deltaX * direction);\n // Calculate the moved distance based on the thumb bar width.\n const dragX = (this._dragPercentage / 100) * this._thumbBarWidth * direction;\n this._thumbEl.nativeElement.style.transform = `translate3d(${dragX}px, 0, 0)`;\n }\n }\n\n _onDragEnd() {\n if (this._dragging) {\n const newCheckedValue = this._dragPercentage > 50;\n\n if (newCheckedValue !== this.checked) {\n this.dragChange.emit();\n if (!this.defaults.disableDragValue) {\n this.checked = newCheckedValue;\n this._emitChangeEvent();\n }\n }\n\n // The drag should be stopped outside of the current event handler, otherwise the\n // click event will be fired before it and will revert the drag change.\n this._ngZone.runOutsideAngular(() => setTimeout(() => {\n if (this._dragging) {\n this._dragging = false;\n this._thumbEl.nativeElement.classList.remove('mat-dragging');\n\n // Reset the transform because the component will take care\n // of the thumb position after drag.\n this._thumbEl.nativeElement.style.transform = '';\n }\n }));\n }\n }\n\n /** Method being called whenever the label text changes. */\n _onLabelTextChange() {\n // Since the event of the `cdkObserveContent` directive runs outside of the zone, the\n // slide-toggle component will be only marked for check, but no actual change detection runs\n // automatically. Instead of going back into the zone in order to trigger a change detection\n // which causes *all* components to be checked (if explicitly marked or not using OnPush),\n // we only trigger an explicit change detection for the slide-toggle view and it's children.\n this._changeDetectorRef.detectChanges();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ObserversModule} from '@angular/cdk/observers';\nimport {NgModule} from '@angular/core';\nimport {GestureConfig, MatCommonModule, MatRippleModule} from '@angular/material/core';\nimport {HAMMER_GESTURE_CONFIG} from '@angular/platform-browser';\nimport {MatSlideToggle} from './slide-toggle';\n\n\n@NgModule({\n imports: [MatRippleModule, MatCommonModule, ObserversModule],\n exports: [MatSlideToggle, MatCommonModule],\n declarations: [MatSlideToggle],\n providers: [\n {provide: HAMMER_GESTURE_CONFIG, useClass: GestureConfig}\n ],\n})\nexport class MatSlideToggleModule {}\n"],"names":["__extends","d","b","__","this","constructor","extendStatics","prototype","Object","create","setPrototypeOf","__proto__","Array","p","hasOwnProperty","MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS","InjectionToken","providedIn","factory","disableToggleValue","disableDragValue","nextUniqueId","MAT_SLIDE_TOGGLE_VALUE_ACCESSOR","provide","NG_VALUE_ACCESSOR","useExisting","forwardRef","MatSlideToggle","multi","MatSlideToggleChange","source","checked","MatSlideToggleBase","_elementRef","_MatSlideToggleMixinBase","mixinTabIndex","mixinColor","mixinDisableRipple","mixinDisabled","_super","elementRef","_focusMonitor","_changeDetectorRef","tabIndex","_ngZone","defaults","_animationMode","_dir","_this","call","_onChange","_","_onTouched","_uniqueId","_required","_checked","_dragging","name","id","labelPosition","ariaLabel","ariaLabelledby","change","EventEmitter","toggleChange","dragChange","parseInt","tslib_1.__extends","defineProperty","value","coerceBooleanProperty","markForCheck","ngAfterContentInit","monitor","subscribe","focusOrigin","Promise","resolve","then","ngOnDestroy","stopMonitoring","_onChangeEvent","event","stopPropagation","emit","_inputElement","nativeElement","_emitChangeEvent","_onInputClick","writeValue","registerOnChange","fn","registerOnTouched","setDisabledState","isDisabled","disabled","focus","focusVia","toggle","_getDragPercentage","distance","percentage","_thumbBarWidth","_previousChecked","Math","max","min","_onDragStart","thumbEl","_thumbEl","_thumbBarEl","clientWidth","classList","add","_onDrag","direction","_dragPercentage","deltaX","dragX","style","transform","_onDragEnd","newCheckedValue","runOutsideAngular","setTimeout","remove","_onLabelTextChange","detectChanges","type","Component","args","selector","exportAs","host","class","[id]","[attr.tabindex]","[class.mat-disabled]","[class.mat-slide-toggle-label-before]","[class._mat-animation-noopable]","(focus)","template","styles","providers","inputs","encapsulation","ViewEncapsulation","None","changeDetection","ChangeDetectionStrategy","OnPush","ChangeDetectorRef","String","decorators","Attribute","NgZone","undefined","Inject","Optional","ANIMATION_MODULE_TYPE","Directionality","propDecorators","Input","required","Output","ViewChild","static","MatSlideToggleModule","NgModule","imports","MatRippleModule","MatCommonModule","ObserversModule","exports","declarations","HAMMER_GESTURE_CONFIG","useClass","GestureConfig"],"mappings":";;;;;;;u8BAuBA,SAAgBA,GAAUC,EAAGC,GAEzB,QAASC,KAAOC,KAAKC,YAAcJ,EADnCK,EAAcL,EAAGC,GAEjBD,EAAEM,UAAkB,OAANL,EAAaM,OAAOC,OAAOP,IAAMC,EAAGI,UAAYL,EAAEK,UAAW,GAAIJ,IAVnF,GAAIG,GAAgB,SAASL,EAAGC,GAI5B,OAHAI,EAAgBE,OAAOE,iBAChBC,uBAA2BC,QAAS,SAAUX,EAAGC,GAAKD,EAAEU,UAAYT,IACvE,SAAUD,EAAGC,GAAK,IAAK,GAAIW,KAAKX,GAAOA,EAAEY,eAAeD,KAAIZ,EAAEY,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