blob: 66dc0206de806e9f3233b37c13efe20a312ef8f7 [file] [log] [blame]
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/overlay"),require("@angular/cdk/portal"),require("@angular/common"),require("@angular/core"),require("@angular/material/core"),require("@angular/material/button"),require("rxjs"),require("@angular/cdk/platform"),require("rxjs/operators"),require("@angular/animations"),require("@angular/cdk/a11y"),require("@angular/cdk/layout")):"function"==typeof define&&define.amd?define("@angular/material/snack-bar",["exports","@angular/cdk/overlay","@angular/cdk/portal","@angular/common","@angular/core","@angular/material/core","@angular/material/button","rxjs","@angular/cdk/platform","rxjs/operators","@angular/animations","@angular/cdk/a11y","@angular/cdk/layout"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.snackBar={}),t.ng.cdk.overlay,t.ng.cdk.portal,t.ng.common,t.ng.core,t.ng.material.core,t.ng.material.button,t.rxjs,t.ng.cdk.platform,t.rxjs.operators,t.ng.animations,t.ng.cdk.a11y,t.ng.cdk.layout)}(this,(function(t,e,n,a,i,o,r,s,c,l,p,u,d){"use strict";
/**
* @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 m=new i.InjectionToken("MatSnackBarData"),h=function h(){this.politeness="assertive",this.announcementMessage="",this.duration=0,this.data=null,this.horizontalPosition="center",this.verticalPosition="bottom"},f=Math.pow(2,31)-1,_=function(){function t(t,e){var n=this;this._overlayRef=e,this._afterDismissed=new s.Subject,this._afterOpened=new s.Subject,this._onAction=new s.Subject,this._dismissedByAction=!1,this.containerInstance=t,this.onAction().subscribe((function(){return n.dismiss()})),t._onExit.subscribe((function(){return n._finishDismiss()}))}return t.prototype.dismiss=function(){this._afterDismissed.closed||this.containerInstance.exit(),clearTimeout(this._durationTimeoutId)},t.prototype.dismissWithAction=function(){this._onAction.closed||(this._dismissedByAction=!0,this._onAction.next(),this._onAction.complete()),clearTimeout(this._durationTimeoutId)},t.prototype.closeWithAction=function(){this.dismissWithAction()},t.prototype._dismissAfter=function(t){var e=this;this._durationTimeoutId=setTimeout((function(){return e.dismiss()}),Math.min(t,f))},t.prototype._open=function(){this._afterOpened.closed||(this._afterOpened.next(),this._afterOpened.complete())},t.prototype._finishDismiss=function(){this._overlayRef.dispose(),this._onAction.closed||this._onAction.complete(),this._afterDismissed.next({dismissedByAction:this._dismissedByAction}),this._afterDismissed.complete(),this._dismissedByAction=!1},t.prototype.afterDismissed=function(){return this._afterDismissed},t.prototype.afterOpened=function(){return this.containerInstance._onEnter},t.prototype.onAction=function(){return this._onAction},t}(),y=function(){function t(t,e){this.snackBarRef=t,this.data=e}return t.prototype.action=function(){this.snackBarRef.dismissWithAction()},Object.defineProperty(t.prototype,"hasAction",{get:function(){return!!this.data.action},enumerable:!1,configurable:!0}),t}();y.decorators=[{type:i.Component,args:[{selector:"simple-snack-bar",template:'<span>{{data.message}}</span>\n<div class="mat-simple-snackbar-action" *ngIf="hasAction">\n <button mat-button (click)="action()">{{data.action}}</button>\n</div>\n',encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,host:{class:"mat-simple-snackbar"},styles:[".mat-simple-snackbar{display:flex;justify-content:space-between;align-items:center;line-height:20px;opacity:1}.mat-simple-snackbar-action{flex-shrink:0;margin:-8px -8px -8px 8px}.mat-simple-snackbar-action button{max-height:36px;min-width:0}[dir=rtl] .mat-simple-snackbar-action{margin-left:-8px;margin-right:8px}\n"]}]}],y.ctorParameters=function(){return[{type:_},{type:void 0,decorators:[{type:i.Inject,args:[m]}]}]};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var v,g=function(t,e){return(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},k={snackBarState:p.trigger("state",[p.state("void, hidden",p.style({transform:"scale(0.8)",opacity:0})),p.state("visible",p.style({transform:"scale(1)",opacity:1})),p.transition("* => visible",p.animate("150ms cubic-bezier(0, 0, 0.2, 1)")),p.transition("* => void, * => hidden",p.animate("75ms cubic-bezier(0.4, 0.0, 1, 1)",p.style({opacity:0})))])},b=function(t){function e(e,n,a,i,o){var r=t.call(this)||this;return r._ngZone=e,r._elementRef=n,r._changeDetectorRef=a,r._platform=i,r.snackBarConfig=o,r._announceDelay=150,r._destroyed=!1,r._onAnnounce=new s.Subject,r._onExit=new s.Subject,r._onEnter=new s.Subject,r._animationState="void",r.attachDomPortal=function(t){return r._assertNotAttached(),r._applySnackBarClasses(),r._portalOutlet.attachDomPortal(t)},r._live="assertive"!==o.politeness||o.announcementMessage?"off"===o.politeness?"off":"polite":"assertive",r._platform.FIREFOX&&("polite"===r._live&&(r._role="status"),"assertive"===r._live&&(r._role="alert")),r}return function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}g(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.attachComponentPortal=function(t){return this._assertNotAttached(),this._applySnackBarClasses(),this._portalOutlet.attachComponentPortal(t)},e.prototype.attachTemplatePortal=function(t){return this._assertNotAttached(),this._applySnackBarClasses(),this._portalOutlet.attachTemplatePortal(t)},e.prototype.onAnimationEnd=function(t){var e=t.toState;if(("void"===e&&"void"!==t.fromState||"hidden"===e)&&this._completeExit(),"visible"===e){var n=this._onEnter;this._ngZone.run((function(){n.next(),n.complete()}))}},e.prototype.enter=function(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.detectChanges(),this._screenReaderAnnounce())},e.prototype.exit=function(){return this._animationState="hidden",this._elementRef.nativeElement.setAttribute("mat-exit",""),clearTimeout(this._announceTimeoutId),this._onExit},e.prototype.ngOnDestroy=function(){this._destroyed=!0,this._completeExit()},e.prototype._completeExit=function(){var t=this;this._ngZone.onMicrotaskEmpty.pipe(l.take(1)).subscribe((function(){t._onExit.next(),t._onExit.complete()}))},e.prototype._applySnackBarClasses=function(){var t=this._elementRef.nativeElement,e=this.snackBarConfig.panelClass;e&&(Array.isArray(e)?e.forEach((function(e){return t.classList.add(e)})):t.classList.add(e)),"center"===this.snackBarConfig.horizontalPosition&&t.classList.add("mat-snack-bar-center"),"top"===this.snackBarConfig.verticalPosition&&t.classList.add("mat-snack-bar-top")},e.prototype._assertNotAttached=function(){this._portalOutlet.hasAttached()},e.prototype._screenReaderAnnounce=function(){var t=this;this._announceTimeoutId||this._ngZone.runOutsideAngular((function(){t._announceTimeoutId=setTimeout((function(){var e=t._elementRef.nativeElement.querySelector("[aria-hidden]"),n=t._elementRef.nativeElement.querySelector("[aria-live]");if(e&&n){var a=null;t._platform.isBrowser&&document.activeElement instanceof HTMLElement&&e.contains(document.activeElement)&&(a=document.activeElement),e.removeAttribute("aria-hidden"),n.appendChild(e),null==a||a.focus(),t._onAnnounce.next(),t._onAnnounce.complete()}}),t._announceDelay)}))},e}(n.BasePortalOutlet);b.decorators=[{type:i.Component,args:[{selector:"snack-bar-container",template:'\x3c!-- Initially holds the snack bar content, will be empty after announcing to screen readers. --\x3e\n<div aria-hidden="true">\n <ng-template cdkPortalOutlet></ng-template>\n</div>\n\n\x3c!-- Will receive the snack bar content from the non-live div, move will happen a short delay after opening --\x3e\n<div [attr.aria-live]="_live" [attr.role]="_role"></div>\n',changeDetection:i.ChangeDetectionStrategy.Default,encapsulation:i.ViewEncapsulation.None,animations:[k.snackBarState],host:{class:"mat-snack-bar-container","[@state]":"_animationState","(@state.done)":"onAnimationEnd($event)"},styles:[".mat-snack-bar-container{border-radius:4px;box-sizing:border-box;display:block;margin:24px;max-width:33vw;min-width:344px;padding:14px 16px;min-height:48px;transform-origin:center}.cdk-high-contrast-active .mat-snack-bar-container{border:solid 1px}.mat-snack-bar-handset{width:100%}.mat-snack-bar-handset .mat-snack-bar-container{margin:8px;max-width:100%;min-width:0;width:100%}\n"]}]}],b.ctorParameters=function(){return[{type:i.NgZone},{type:i.ElementRef},{type:i.ChangeDetectorRef},{type:c.Platform},{type:h}]},b.propDecorators={_portalOutlet:[{type:i.ViewChild,args:[n.CdkPortalOutlet,{static:!0}]}]},(v=function v(){}).decorators=[{type:i.NgModule,args:[{imports:[e.OverlayModule,n.PortalModule,a.CommonModule,r.MatButtonModule,o.MatCommonModule],exports:[b,o.MatCommonModule],declarations:[b,y],entryComponents:[b,y]}]}];
/**
* @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 B=new i.InjectionToken("mat-snack-bar-default-options",{providedIn:"root",factory:A});function A(){return new h}var S=function(){function t(t,e,n,a,i,o){this._overlay=t,this._live=e,this._injector=n,this._breakpointObserver=a,this._parentSnackBar=i,this._defaultConfig=o,this._snackBarRefAtThisLevel=null,this.simpleSnackBarComponent=y,this.snackBarContainerComponent=b,this.handsetCssClass="mat-snack-bar-handset"}return Object.defineProperty(t.prototype,"_openedSnackBarRef",{get:function(){var t=this._parentSnackBar;return t?t._openedSnackBarRef:this._snackBarRefAtThisLevel},set:function(t){this._parentSnackBar?this._parentSnackBar._openedSnackBarRef=t:this._snackBarRefAtThisLevel=t},enumerable:!1,configurable:!0}),t.prototype.openFromComponent=function(t,e){return this._attach(t,e)},t.prototype.openFromTemplate=function(t,e){return this._attach(t,e)},t.prototype.open=function(t,e,n){void 0===e&&(e="");var a=Object.assign(Object.assign({},this._defaultConfig),n);return a.data={message:t,action:e},a.announcementMessage===t&&(a.announcementMessage=void 0),this.openFromComponent(this.simpleSnackBarComponent,a)},t.prototype.dismiss=function(){this._openedSnackBarRef&&this._openedSnackBarRef.dismiss()},t.prototype.ngOnDestroy=function(){this._snackBarRefAtThisLevel&&this._snackBarRefAtThisLevel.dismiss()},t.prototype._attachSnackBarContainer=function(t,e){var a=i.Injector.create({parent:e&&e.viewContainerRef&&e.viewContainerRef.injector||this._injector,providers:[{provide:h,useValue:e}]}),o=new n.ComponentPortal(this.snackBarContainerComponent,e.viewContainerRef,a),r=t.attach(o);return r.instance.snackBarConfig=e,r.instance},t.prototype._attach=function(t,e){var a=this,o=Object.assign(Object.assign(Object.assign({},new h),this._defaultConfig),e),r=this._createOverlay(o),s=this._attachSnackBarContainer(r,o),c=new _(s,r);if(t instanceof i.TemplateRef){var p=new n.TemplatePortal(t,null,{$implicit:o.data,snackBarRef:c});c.instance=s.attachTemplatePortal(p)}else{var u=this._createInjector(o,c),m=(p=new n.ComponentPortal(t,void 0,u),s.attachComponentPortal(p));c.instance=m.instance}return this._breakpointObserver.observe(d.Breakpoints.HandsetPortrait).pipe(l.takeUntil(r.detachments())).subscribe((function(t){var e=r.overlayElement.classList;t.matches?e.add(a.handsetCssClass):e.remove(a.handsetCssClass)})),o.announcementMessage&&s._onAnnounce.subscribe((function(){a._live.announce(o.announcementMessage,o.politeness)})),this._animateSnackBar(c,o),this._openedSnackBarRef=c,this._openedSnackBarRef},t.prototype._animateSnackBar=function(t,e){var n=this;t.afterDismissed().subscribe((function(){n._openedSnackBarRef==t&&(n._openedSnackBarRef=null),e.announcementMessage&&n._live.clear()})),this._openedSnackBarRef?(this._openedSnackBarRef.afterDismissed().subscribe((function(){t.containerInstance.enter()})),this._openedSnackBarRef.dismiss()):t.containerInstance.enter(),e.duration&&e.duration>0&&t.afterOpened().subscribe((function(){return t._dismissAfter(e.duration)}))},t.prototype._createOverlay=function(t){var n=new e.OverlayConfig;n.direction=t.direction;var a=this._overlay.position().global(),i="rtl"===t.direction,o="left"===t.horizontalPosition||"start"===t.horizontalPosition&&!i||"end"===t.horizontalPosition&&i,r=!o&&"center"!==t.horizontalPosition;return o?a.left("0"):r?a.right("0"):a.centerHorizontally(),"top"===t.verticalPosition?a.top("0"):a.bottom("0"),n.positionStrategy=a,this._overlay.create(n)},t.prototype._createInjector=function(t,e){return i.Injector.create({parent:t&&t.viewContainerRef&&t.viewContainerRef.injector||this._injector,providers:[{provide:_,useValue:e},{provide:m,useValue:t.data}]})},t}();Sprov=i.ɵɵdefineInjectable({factory:function t(){return new S(i.ɵɵinject(e.Overlay),i.ɵɵinject(u.LiveAnnouncer),i.ɵɵinject(i.INJECTOR),i.ɵɵinject(d.BreakpointObserver),i.ɵɵinject(S,12),i.ɵɵinject(B))},token:S,providedIn:v}),S.decorators=[{type:i.Injectable,args:[{providedIn:v}]}],S.ctorParameters=function(){return[{type:e.Overlay},{type:u.LiveAnnouncer},{type:i.Injector},{type:d.BreakpointObserver},{type:S,decorators:[{type:i.Optional},{type:i.SkipSelf}]},{type:h,decorators:[{type:i.Inject,args:[B]}]}]},
/**
* @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
*/
t.MAT_SNACK_BAR_DATA=m,t.MAT_SNACK_BAR_DEFAULT_OPTIONS=B,t.MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY=A,t.MatSnackBar=S,t.MatSnackBarConfig=h,t.MatSnackBarContainer=b,t.MatSnackBarModule=v,t.MatSnackBarRef=_,t.SimpleSnackBar=y,t.matSnackBarAnimations=k,Object.defineProperty(t,"__esModule",{value:!0})}));