/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var _MatTestDialogOpenerBase_1, MatTestDialogOpener_1; import { __decorate, __metadata } from "tslib"; import { ChangeDetectionStrategy, Component, Directive, NgModule, ViewEncapsulation, } from '@angular/core'; import { MatDialog, MatDialogModule, _MatDialogBase, } from '@angular/material/dialog'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; /** Base class for a component that immediately opens a dialog when created. */ export let _MatTestDialogOpenerBase = class _MatTestDialogOpenerBase { static { _MatTestDialogOpenerBase_1 = this; } constructor(dialog) { this.dialog = dialog; if (!_MatTestDialogOpenerBase_1.component) { throw new Error(`MatTestDialogOpener does not have a component provided.`); } this.dialogRef = this.dialog.open(_MatTestDialogOpenerBase_1.component, _MatTestDialogOpenerBase_1.config || {}); this._afterClosedSubscription = this.dialogRef.afterClosed().subscribe(result => { this.closedResult = result; }); } ngOnDestroy() { this._afterClosedSubscription.unsubscribe(); _MatTestDialogOpenerBase_1.component = undefined; _MatTestDialogOpenerBase_1.config = undefined; } }; _MatTestDialogOpenerBase = _MatTestDialogOpenerBase_1 = __decorate([ Directive(), __metadata("design:paramtypes", [_MatDialogBase]) ], _MatTestDialogOpenerBase); /** Test component that immediately opens a dialog when bootstrapped. */ export let MatTestDialogOpener = MatTestDialogOpener_1 = class MatTestDialogOpener extends _MatTestDialogOpenerBase { constructor(dialog) { super(dialog); } /** Static method that prepares this class to open the provided component. */ static withComponent(component, config) { _MatTestDialogOpenerBase.component = component; _MatTestDialogOpenerBase.config = config; return MatTestDialogOpener_1; } }; MatTestDialogOpener = MatTestDialogOpener_1 = __decorate([ Component({ selector: 'mat-test-dialog-opener', template: '', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, }), __metadata("design:paramtypes", [MatDialog]) ], MatTestDialogOpener); export let MatTestDialogOpenerModule = class MatTestDialogOpenerModule { }; MatTestDialogOpenerModule = __decorate([ NgModule({ declarations: [MatTestDialogOpener], imports: [MatDialogModule, NoopAnimationsModule], }) ], MatTestDialogOpenerModule); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLW9wZW5lci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9kaWFsb2cvdGVzdGluZy9kaWFsb2ctb3BlbmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7O0FBR0gsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixTQUFTLEVBQ1QsU0FBUyxFQUNULFFBQVEsRUFFUixpQkFBaUIsR0FDbEIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUNMLFNBQVMsRUFHVCxlQUFlLEVBQ2YsY0FBYyxHQUdmLE1BQU0sMEJBQTBCLENBQUM7QUFDbEMsT0FBTyxFQUFDLG9CQUFvQixFQUFDLE1BQU0sc0NBQXNDLENBQUM7QUFHMUUsK0VBQStFO0FBRXhFLFdBQU0sd0JBQXdCLEdBQTlCLE1BQU0sd0JBQXdCOztJQWlCbkMsWUFBbUIsTUFBeUI7UUFBekIsV0FBTSxHQUFOLE1BQU0sQ0FBbUI7UUFDMUMsSUFBSSxDQUFDLDBCQUF3QixDQUFDLFNBQVMsRUFBRTtZQUN2QyxNQUFNLElBQUksS0FBSyxDQUFDLHlEQUF5RCxDQUFDLENBQUM7U0FDNUU7UUFFRCxJQUFJLENBQUMsU0FBUyxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUMvQiwwQkFBd0IsQ0FBQyxTQUE2QixFQUN0RCwwQkFBd0IsQ0FBQyxNQUFNLElBQUksRUFBRSxDQUN0QyxDQUFDO1FBQ0YsSUFBSSxDQUFDLHdCQUF3QixHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsV0FBVyxFQUFF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