ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 35.5 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/overlay"),require("@angular/cdk/portal"),require("@angular/core"),require("ng-zorro-antd/core/config"),require("ng-zorro-antd/core/logger"),require("ng-zorro-antd/core/util"),require("rxjs"),require("rxjs/operators"),require("@angular/cdk/a11y"),require("@angular/common"),require("@angular/platform-browser/animations"),require("ng-zorro-antd/i18n"),require("@angular/animations"),require("@angular/cdk/keycodes"),require("ng-zorro-antd/button"),require("ng-zorro-antd/core/no-animation"),require("ng-zorro-antd/core/outlet"),require("ng-zorro-antd/core/pipe"),require("ng-zorro-antd/icon")):"function"==typeof define&&define.amd?define("ng-zorro-antd/modal",["exports","@angular/cdk/overlay","@angular/cdk/portal","@angular/core","ng-zorro-antd/core/config","ng-zorro-antd/core/logger","ng-zorro-antd/core/util","rxjs","rxjs/operators","@angular/cdk/a11y","@angular/common","@angular/platform-browser/animations","ng-zorro-antd/i18n","@angular/animations","@angular/cdk/keycodes","ng-zorro-antd/button","ng-zorro-antd/core/no-animation","ng-zorro-antd/core/outlet","ng-zorro-antd/core/pipe","ng-zorro-antd/icon"],e):e(((t=t||self)["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].modal={}),t.ng.cdk.overlay,t.ng.cdk.portal,t.ng.core,t["ng-zorro-antd"].core.config,t["ng-zorro-antd"].core.logger,t["ng-zorro-antd"].core.util,t.rxjs,t.rxjs.operators,t.ng.cdk.a11y,t.ng.common,t.ng.platformBrowser.animations,t["ng-zorro-antd"].i18n,t.ng.animations,t.ng.cdk.keycodes,t["ng-zorro-antd"].button,t["ng-zorro-antd"].core["no-animation"],t["ng-zorro-antd"].core.outlet,t["ng-zorro-antd"].core.pipe,t["ng-zorro-antd"].icon)}(this,(function(t,e,n,o,i,a,r,s,l,c,p,d,u,f,g,m,h,y,z,C){"use strict";
/*! *****************************************************************************
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=function(t,e){return(v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function b(t,e){function n(){this.constructor=t}v(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var k=function(){return(k=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function O(t,e,n,o){var i,a=arguments.length,r=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(r=(a<3?i(r):a>3?i(e,n,r):i(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r}function M(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var T=function(){},I=function(){this.nzClosable=!0,this.nzOkLoading=!1,this.nzOkDisabled=!1,this.nzCancelDisabled=!1,this.nzCancelLoading=!1,this.nzNoAnimation=!1,this.nzAutofocus="auto",this.nzKeyboard=!0,this.nzZIndex=1e3,this.nzWidth=520,this.nzCloseIcon="close",this.nzOkType="primary",this.nzModalType="default",this.nzOnCancel=T,this.nzOnOk=T,this.nzIconType="question-circle"};var A={enter:"zoom-enter",enterActive:"zoom-enter-active",leave:"zoom-leave",leaveActive:"zoom-leave-active"},E={enter:"fade-enter",enterActive:"fade-enter-active",leave:"fade-leave",leaveActive:"fade-leave-active"},S={modalContainer:f.trigger("modalContainer",[f.state("void, exit",f.style({})),f.state("enter",f.style({})),f.transition("* => enter",f.animate(".24s",f.style({}))),f.transition("* => void, * => exit",f.animate(".2s",f.style({})))])};function R(t,e){return k(k({},e),t)}function w(t,e,n){return void 0===t?void 0===e?n:e:t}function N(t,e){Object.assign(t,e)}function x(t){return{nzMask:t.nzMask,nzMaskClosable:t.nzMaskClosable,nzClosable:t.nzClosable,nzOkLoading:t.nzOkLoading,nzOkDisabled:t.nzOkDisabled,nzCancelDisabled:t.nzCancelDisabled,nzCancelLoading:t.nzCancelLoading,nzKeyboard:t.nzKeyboard,nzNoAnimation:t.nzNoAnimation,nzContent:t.nzContent,nzComponentParams:t.nzComponentParams,nzFooter:t.nzFooter,nzGetContainer:t.nzGetContainer,nzZIndex:t.nzZIndex,nzWidth:t.nzWidth,nzWrapClassName:t.nzWrapClassName,nzClassName:t.nzClassName,nzStyle:t.nzStyle,nzTitle:t.nzTitle,nzCloseIcon:t.nzCloseIcon,nzMaskStyle:t.nzMaskStyle,nzBodyStyle:t.nzBodyStyle,nzOkText:t.nzOkText,nzCancelText:t.nzCancelText,nzOkType:t.nzOkType,nzIconType:t.nzIconType,nzModalType:t.nzModalType,nzOnOk:t.nzOnOk,nzOnCancel:t.nzOnCancel,nzAfterOpen:t.nzAfterOpen,nzAfterClose:t.nzAfterClose,nzCloseOnNavigation:t.nzCloseOnNavigation,nzAutofocus:t.nzAutofocus}}function D(){throw Error("Attempting to attach modal content after content is already attached")}var P=function(t){function e(e,n,i,a,r,c,p,d,u){var f=t.call(this)||this;return f.elementRef=e,f.focusTrapFactory=n,f.cdr=i,f.render=a,f.overlayRef=r,f.nzConfigService=c,f.config=p,f.animationType=u,f.animationStateChanged=new o.EventEmitter,f.containerClick=new o.EventEmitter,f.cancelTriggered=new o.EventEmitter,f.okTriggered=new o.EventEmitter,f.state="enter",f.isStringContent=!1,f.elementFocusedBeforeModalWasOpened=null,f.mouseDown=!1,f.oldMaskStyle=null,f.destroy$=new s.Subject,f.document=d,f.isStringContent="string"==typeof p.nzContent,f.setContainer(),f.nzConfigService.getConfigChangeEventForComponent("modal").pipe(l.takeUntil(f.destroy$)).subscribe((function(){f.updateMaskClassname()})),f}return b(e,t),Object.defineProperty(e.prototype,"showMask",{get:function(){var t=this.nzConfigService.getConfigForComponent("modal")||{};return!!w(this.config.nzMask,t.nzMask,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maskClosable",{get:function(){var t=this.nzConfigService.getConfigForComponent("modal")||{};return!!w(this.config.nzMaskClosable,t.nzMaskClosable,!0)},enumerable:!0,configurable:!0}),e.prototype.onContainerClick=function(t){t.target===t.currentTarget&&!this.mouseDown&&this.showMask&&this.maskClosable&&this.containerClick.emit()},e.prototype.onMousedown=function(){this.mouseDown=!0},e.prototype.onMouseup=function(){var t=this;this.mouseDown&&setTimeout((function(){t.mouseDown=!1}))},e.prototype.onCloseClick=function(){this.cancelTriggered.emit()},e.prototype.onOkClick=function(){this.okTriggered.emit()},e.prototype.attachComponentPortal=function(t){return this.portalOutlet.hasAttached()&&D(),this.savePreviouslyFocusedElement(),this.setModalTransformOrigin(),this.portalOutlet.attachComponentPortal(t)},e.prototype.attachTemplatePortal=function(t){return this.portalOutlet.hasAttached()&&D(),this.savePreviouslyFocusedElement(),this.portalOutlet.attachTemplatePortal(t)},e.prototype.getNativeElement=function(){return this.elementRef.nativeElement},e.prototype.animationDisabled=function(){return this.config.nzNoAnimation||"NoopAnimations"===this.animationType},e.prototype.setModalTransformOrigin=function(){var t=this.modalElementRef.nativeElement;if(this.elementFocusedBeforeModalWasOpened){var e=this.elementFocusedBeforeModalWasOpened.getBoundingClientRect(),n=r.getElementOffset(this.elementFocusedBeforeModalWasOpened),o=n.left+e.width/2,i=n.top+e.height/2,a=o-t.offsetLeft+"px "+(i-t.offsetTop)+"px 0px";this.render.setStyle(t,"transform-origin",a)}},e.prototype.savePreviouslyFocusedElement=function(){var t=this;this.focusTrap||(this.focusTrap=this.focusTrapFactory.create(this.elementRef.nativeElement)),this.document&&(this.elementFocusedBeforeModalWasOpened=this.document.activeElement,this.elementRef.nativeElement.focus&&Promise.resolve().then((function(){return t.elementRef.nativeElement.focus()})))},e.prototype.trapFocus=function(){var t=this.elementRef.nativeElement;if(this.config.nzAutofocus)this.focusTrap.focusInitialElementWhenReady().then();else{var e=this.document.activeElement;e===t||t.contains(e)||t.focus()}},e.prototype.restoreFocus=function(){var t=this.elementFocusedBeforeModalWasOpened;if(t&&"function"==typeof t.focus){var e=this.document.activeElement,n=this.elementRef.nativeElement;e&&e!==this.document.body&&e!==n&&!n.contains(e)||t.focus()}this.focusTrap&&this.focusTrap.destroy()},e.prototype.setEnterAnimationClass=function(){if(!this.animationDisabled()){this.setModalTransformOrigin();var t=this.modalElementRef.nativeElement,e=this.overlayRef.backdropElement;t.classList.add(A.enter),t.classList.add(A.enterActive),e&&(e.classList.add(E.enter),e.classList.add(E.enterActive))}},e.prototype.setExitAnimationClass=function(){var t=this.modalElementRef.nativeElement;t.classList.add(A.leave),t.classList.add(A.leaveActive),this.setMaskExitAnimationClass()},e.prototype.setMaskExitAnimationClass=function(t){void 0===t&&(t=!1);var e=this.overlayRef.backdropElement;if(e){if(this.animationDisabled()||t)return void e.classList.remove("ant-modal-mask");e.classList.add(E.leave),e.classList.add(E.leaveActive)}},e.prototype.cleanAnimationClass=function(){if(!this.animationDisabled()){var t=this.overlayRef.backdropElement,e=this.modalElementRef.nativeElement;t&&(t.classList.remove(E.enter),t.classList.remove(E.enterActive)),e.classList.remove(A.enter),e.classList.remove(A.enterActive),e.classList.remove(A.leave),e.classList.remove(A.leaveActive)}},e.prototype.bindBackdropStyle=function(){var t=this,e=this.overlayRef.backdropElement;if(e){if(this.oldMaskStyle){var n=this.oldMaskStyle;Object.keys(n).forEach((function(n){t.render.removeStyle(e,n)})),this.oldMaskStyle=null}if("object"==typeof this.config.nzMaskStyle&&Object.keys(this.config.nzMaskStyle).length){var o=k({},this.config.nzMaskStyle);Object.keys(o).forEach((function(n){t.render.setStyle(e,n,o[n])})),this.oldMaskStyle=o}}},e.prototype.setContainer=function(){var t=this.getContainer();t&&this.render.appendChild(t,this.elementRef.nativeElement)},e.prototype.resetContainer=function(){this.getContainer()&&this.render.appendChild(this.overlayRef.overlayElement,this.elementRef.nativeElement)},e.prototype.getContainer=function(){var t=this.config.nzGetContainer,e="function"==typeof t?t():t;return e instanceof HTMLElement?e:null},e.prototype.updateMaskClassname=function(){var t=this.overlayRef.backdropElement;t&&(this.showMask?t.classList.add("ant-modal-mask"):t.classList.remove("ant-modal-mask"))},e.prototype.onAnimationDone=function(t){"enter"===t.toState?(this.setContainer(),this.trapFocus()):"exit"===t.toState&&this.restoreFocus(),this.cleanAnimationClass(),this.animationStateChanged.emit(t)},e.prototype.onAnimationStart=function(t){"enter"===t.toState?(this.setEnterAnimationClass(),this.bindBackdropStyle()):"exit"===t.toState&&(this.resetContainer(),this.setExitAnimationClass()),this.animationStateChanged.emit(t)},e.prototype.startExitAnimation=function(){this.state="exit",this.cdr.markForCheck()},e.prototype.ngOnDestroy=function(){this.setMaskExitAnimationClass(!0),this.destroy$.next(),this.destroy$.complete()},e}(n.BasePortalOutlet);var F=function(t){function a(e,n,i,a,r,s,c,p,d,u){var f=t.call(this,n,i,a,r,s,c,p,d,u)||this;return f.i18n=e,f.config=p,f.cancelTriggered=new o.EventEmitter,f.okTriggered=new o.EventEmitter,f.i18n.localeChange.pipe(l.takeUntil(f.destroy$)).subscribe((function(){f.locale=f.i18n.getLocaleData("Modal")})),f}return b(a,t),a.prototype.onCancel=function(){this.cancelTriggered.emit()},a.prototype.onOk=function(){this.okTriggered.emit()},a.decorators=[{type:o.Component,args:[{selector:"nz-modal-confirm-container",exportAs:"nzModalConfirmContainer",template:'\n <div\n #modalElement\n role="document"\n class="ant-modal"\n (mousedown)="onMousedown()"\n [ngClass]="config.nzClassName!"\n [ngStyle]="config.nzStyle!"\n [style.width]="config?.nzWidth! | nzToCssUnit"\n >\n <div class="ant-modal-content">\n <button *ngIf="config.nzClosable" nz-modal-close (click)="onCloseClick()"></button>\n <div class="ant-modal-body" [ngStyle]="config.nzBodyStyle!">\n <div class="ant-modal-confirm-body-wrapper">\n <div class="ant-modal-confirm-body">\n <i nz-icon [nzType]="config.nzIconType!"></i>\n <span class="ant-modal-confirm-title">\n <ng-container *nzStringTemplateOutlet="config.nzTitle">\n <span [innerHTML]="config.nzTitle"></span>\n </ng-container>\n </span>\n <div class="ant-modal-confirm-content">\n <ng-template cdkPortalOutlet></ng-template>\n <div *ngIf="isStringContent" [innerHTML]="config.nzContent"></div>\n </div>\n </div>\n <div class="ant-modal-confirm-btns">\n <button\n *ngIf="config.nzCancelText !== null"\n [attr.cdkFocusInitial]="config.nzAutofocus === \'cancel\' || null"\n nz-button\n (click)="onCancel()"\n [nzLoading]="!!config.nzCancelLoading"\n [disabled]="config.nzCancelDisabled"\n >\n {{ config.nzCancelText || locale.cancelText }}\n </button>\n <button\n *ngIf="config.nzOkText !== null"\n [attr.cdkFocusInitial]="config.nzAutofocus === \'ok\' || null"\n nz-button\n [nzType]="config.nzOkType!"\n (click)="onOk()"\n [nzLoading]="!!config.nzOkLoading"\n [disabled]="config.nzOkDisabled"\n >\n {{ config.nzOkText || locale.okText }}\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n ',animations:[S.modalContainer],changeDetection:o.ChangeDetectionStrategy.Default,host:{tabindex:"-1",role:"dialog","[class]":'config.nzWrapClassName ? "ant-modal-wrap " + config.nzWrapClassName : "ant-modal-wrap"',"[style.zIndex]":"config.nzZIndex","[@.disabled]":"config.nzNoAnimation","[@modalContainer]":"state","(@modalContainer.start)":"onAnimationStart($event)","(@modalContainer.done)":"onAnimationDone($event)","(click)":"onContainerClick($event)","(mouseup)":"onMouseup()"}}]}],a.ctorParameters=function(){return[{type:u.NzI18nService},{type:o.ElementRef},{type:c.ConfigurableFocusTrapFactory},{type:o.ChangeDetectorRef},{type:o.Renderer2},{type:e.OverlayRef},{type:i.NzConfigService},{type:I},{type:void 0,decorators:[{type:o.Optional},{type:o.Inject,args:[p.DOCUMENT]}]},{type:String,decorators:[{type:o.Optional},{type:o.Inject,args:[d.ANIMATION_MODULE_TYPE]}]}]},a.propDecorators={portalOutlet:[{type:o.ViewChild,args:[n.CdkPortalOutlet,{static:!0}]}],modalElementRef:[{type:o.ViewChild,args:["modalElement",{static:!0}]}],cancelTriggered:[{type:o.Output}],okTriggered:[{type:o.Output}]},a}(P);var L=function(t){function a(e,n,o,i,a,r,s,l,c){var p=t.call(this,e,n,o,i,a,r,s,l,c)||this;return p.config=s,p}return b(a,t),a.decorators=[{type:o.Component,args:[{selector:"nz-modal-container",exportAs:"nzModalContainer",template:'\n <div\n #modalElement\n role="document"\n class="ant-modal"\n (mousedown)="onMousedown()"\n [ngClass]="config.nzClassName!"\n [ngStyle]="config.nzStyle!"\n [style.width]="config?.nzWidth! | nzToCssUnit"\n >\n <div class="ant-modal-content">\n <button *ngIf="config.nzClosable" nz-modal-close (click)="onCloseClick()"></button>\n <div *ngIf="config.nzTitle" nz-modal-title></div>\n <div class="ant-modal-body" [ngStyle]="config.nzBodyStyle!">\n <ng-template cdkPortalOutlet></ng-template>\n <div *ngIf="isStringContent" [innerHTML]="config.nzContent"></div>\n </div>\n <div\n *ngIf="config.nzFooter !== null"\n nz-modal-footer\n [modalRef]="modalRef"\n (cancelTriggered)="onCloseClick()"\n (okTriggered)="onOkClick()"\n ></div>\n </div>\n </div>\n ',animations:[S.modalContainer],changeDetection:o.ChangeDetectionStrategy.Default,host:{tabindex:"-1",role:"dialog","[class]":'config.nzWrapClassName ? "ant-modal-wrap " + config.nzWrapClassName : "ant-modal-wrap"',"[style.zIndex]":"config.nzZIndex","[@.disabled]":"config.nzNoAnimation","[@modalContainer]":"state","(@modalContainer.start)":"onAnimationStart($event)","(@modalContainer.done)":"onAnimationDone($event)","(click)":"onContainerClick($event)","(mouseup)":"onMouseup()"}}]}],a.ctorParameters=function(){return[{type:o.ElementRef},{type:c.ConfigurableFocusTrapFactory},{type:o.ChangeDetectorRef},{type:o.Renderer2},{type:e.OverlayRef},{type:i.NzConfigService},{type:I},{type:void 0,decorators:[{type:o.Optional},{type:o.Inject,args:[p.DOCUMENT]}]},{type:String,decorators:[{type:o.Optional},{type:o.Inject,args:[d.ANIMATION_MODULE_TYPE]}]}]},a.propDecorators={portalOutlet:[{type:o.ViewChild,args:[n.CdkPortalOutlet,{static:!0}]}],modalElementRef:[{type:o.ViewChild,args:["modalElement",{static:!0}]}]},a}(P);var B=function(){function t(t,e,n){var i=this;this.overlayRef=t,this.config=e,this.containerInstance=n,this.componentInstance=null,this.state=0,this.afterClose=new s.Subject,this.afterOpen=new s.Subject,n.animationStateChanged.pipe(l.filter((function(t){return"done"===t.phaseName&&"enter"===t.toState})),l.take(1)).subscribe((function(){i.afterOpen.next(),i.afterOpen.complete(),e.nzAfterOpen instanceof o.EventEmitter&&e.nzAfterOpen.emit()})),n.animationStateChanged.pipe(l.filter((function(t){return"done"===t.phaseName&&"exit"===t.toState})),l.take(1)).subscribe((function(){clearTimeout(i.closeTimeout),i._finishDialogClose()})),n.containerClick.pipe(l.take(1)).subscribe((function(){!i.config.nzCancelLoading&&!i.config.nzOkLoading&&i.trigger("cancel")})),t.keydownEvents().pipe(l.filter((function(t){return i.config.nzKeyboard&&!i.config.nzCancelLoading&&!i.config.nzOkLoading&&t.keyCode===g.ESCAPE&&!g.hasModifierKey(t)}))).subscribe((function(t){t.preventDefault(),i.trigger("cancel")})),n.cancelTriggered.subscribe((function(){return i.trigger("cancel")})),n.okTriggered.subscribe((function(){return i.trigger("ok")})),t.detachments().subscribe((function(){i.afterClose.next(i.result),i.afterClose.complete(),e.nzAfterClose instanceof o.EventEmitter&&e.nzAfterClose.emit(i.result),i.componentInstance=null,i.overlayRef.dispose()}))}return t.prototype.getContentComponent=function(){return this.componentInstance},t.prototype.getElement=function(){return this.containerInstance.getNativeElement()},t.prototype.destroy=function(t){this.close(t)},t.prototype.triggerOk=function(){this.trigger("ok")},t.prototype.triggerCancel=function(){this.trigger("cancel")},t.prototype.open=function(){},t.prototype.close=function(t){var e=this;this.result=t,this.containerInstance.animationStateChanged.pipe(l.filter((function(t){return"start"===t.phaseName})),l.take(1)).subscribe((function(t){e.overlayRef.detachBackdrop(),e.closeTimeout=setTimeout((function(){e._finishDialogClose()}),t.totalTime+100)})),this.containerInstance.startExitAnimation(),this.state=1},t.prototype.updateConfig=function(t){Object.assign(this.config,t),this.containerInstance.bindBackdropStyle(),this.containerInstance.cdr.markForCheck()},t.prototype.getState=function(){return this.state},t.prototype.getConfig=function(){return this.config},t.prototype.getBackdropElement=function(){return this.overlayRef.backdropElement},t.prototype.trigger=function(t){var e,n=this,i={ok:this.config.nzOnOk,cancel:this.config.nzOnCancel}[t],a={ok:"nzOkLoading",cancel:"nzCancelLoading"}[t];if(!this.config[a])if(i instanceof o.EventEmitter)i.emit(this.getContentComponent());else if("function"==typeof i){var s=i(this.getContentComponent());if(r.isPromise(s)){this.config[a]=!0;var l=function(t){n.config[a]=!1,n.closeWhitResult(t)};s.then(l).catch(l)}else!1!==(e=s)&&n.close(e)}},t.prototype.closeWhitResult=function(t){!1!==t&&this.close(t)},t.prototype._finishDialogClose=function(){this.state=2,this.overlayRef.dispose()},t}();var j=function(){function t(t,e,n,o){var i=this;this.overlay=t,this.injector=e,this.nzConfigService=n,this.parentModal=o,this.openModalsAtThisLevel=[],this.afterAllClosedAtThisLevel=new s.Subject,this.afterAllClose=s.defer((function(){return i.openModals.length?i._afterAllClosed:i._afterAllClosed.pipe(l.startWith(void 0))}))}return Object.defineProperty(t.prototype,"openModals",{get:function(){return this.parentModal?this.parentModal.openModals:this.openModalsAtThisLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_afterAllClosed",{get:function(){var t=this.parentModal;return t?t._afterAllClosed:this.afterAllClosedAtThisLevel},enumerable:!0,configurable:!0}),t.prototype.create=function(t){return this.open(t.nzContent,t)},t.prototype.closeAll=function(){this.closeModals(this.openModals)},t.prototype.confirm=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="confirm"),"nzFooter"in t&&a.warn('The Confirm-Modal doesn\'t support "nzFooter", this property will be ignored.'),"nzWidth"in t||(t.nzWidth=416),"nzMaskClosable"in t||(t.nzMaskClosable=!1),t.nzModalType="confirm",t.nzClassName="ant-modal-confirm ant-modal-confirm-"+e+" "+(t.nzClassName||""),this.create(t)},t.prototype.info=function(t){return void 0===t&&(t={}),this.confirmFactory(t,"info")},t.prototype.success=function(t){return void 0===t&&(t={}),this.confirmFactory(t,"success")},t.prototype.error=function(t){return void 0===t&&(t={}),this.confirmFactory(t,"error")},t.prototype.warning=function(t){return void 0===t&&(t={}),this.confirmFactory(t,"warning")},t.prototype.open=function(t,e){var n=this,o=R(e||{},new I),i=this.createOverlay(o),a=this.attachModalContainer(i,o),r=this.attachModalContent(t,a,i,o);return a.modalRef=r,this.openModals.push(r),r.afterClose.subscribe((function(){return n.removeOpenModal(r)})),r},t.prototype.removeOpenModal=function(t){var e=this.openModals.indexOf(t);e>-1&&(this.openModals.splice(e,1),this.openModals.length||this._afterAllClosed.next())},t.prototype.closeModals=function(t){for(var e=t.length;e--;)t[e].close(),this.openModals.length||this._afterAllClosed.next()},t.prototype.createOverlay=function(t){var n=this.nzConfigService.getConfigForComponent("modal")||{},o=new e.OverlayConfig({hasBackdrop:!0,scrollStrategy:this.overlay.scrollStrategies.block(),positionStrategy:this.overlay.position().global(),disposeOnNavigation:w(t.nzCloseOnNavigation,n.nzCloseOnNavigation,!0)});return w(t.nzMask,n.nzMask,!0)&&(o.backdropClass="ant-modal-mask"),this.overlay.create(o)},t.prototype.attachModalContainer=function(t,o){var i=o&&o.nzViewContainerRef&&o.nzViewContainerRef.injector,a=new n.PortalInjector(i||this.injector,new WeakMap([[e.OverlayRef,t],[I,o]])),r="confirm"===o.nzModalType?F:L,s=new n.ComponentPortal(r,o.nzViewContainerRef,a);return t.attach(s).instance},t.prototype.attachModalContent=function(t,e,i,a){var s=new B(i,a,e);if(t instanceof o.TemplateRef)e.attachTemplatePortal(new n.TemplatePortal(t,null,{$implicit:a.nzComponentParams,modalRef:s}));else if(r.isNotNil(t)&&"string"!=typeof t){var l=this.createInjector(s,a),c=e.attachComponentPortal(new n.ComponentPortal(t,a.nzViewContainerRef,l));N(c.instance,a.nzComponentParams),s.componentInstance=c.instance}return s},t.prototype.createInjector=function(t,e){var o=e&&e.nzViewContainerRef&&e.nzViewContainerRef.injector,i=new WeakMap([[B,t]]);return new n.PortalInjector(o||this.injector,i)},t.prototype.confirmFactory=function(t,e){void 0===t&&(t={});return"nzIconType"in t||(t.nzIconType={info:"info-circle",success:"check-circle",error:"close-circle",warning:"exclamation-circle"}[e]),"nzCancelText"in t||(t.nzCancelText=null),this.confirm(t,e)},t.prototype.ngOnDestroy=function(){this.closeModals(this.openModalsAtThisLevel),this.afterAllClosedAtThisLevel.complete()},t.decorators=[{type:o.Injectable}],t.ctorParameters=function(){return[{type:e.Overlay},{type:o.Injector},{type:i.NzConfigService},{type:t,decorators:[{type:o.Optional},{type:o.SkipSelf}]}]},t}();var _=function(){function t(t,e){this.nzModalRef=t,this.templateRef=e,this.nzModalRef&&this.nzModalRef.updateConfig({nzFooter:this.templateRef})}return t.decorators=[{type:o.Directive,args:[{selector:"[nzModalFooter]",exportAs:"nzModalFooter"}]}],t.ctorParameters=function(){return[{type:B,decorators:[{type:o.Optional}]},{type:o.TemplateRef}]},t}();var W=function(){function t(t,e,n){this.cdr=t,this.modal=e,this.viewContainerRef=n,this.nzVisible=!1,this.nzClosable=!0,this.nzOkLoading=!1,this.nzOkDisabled=!1,this.nzCancelDisabled=!1,this.nzCancelLoading=!1,this.nzKeyboard=!0,this.nzNoAnimation=!1,this.nzZIndex=1e3,this.nzWidth=520,this.nzCloseIcon="close",this.nzOkType="primary",this.nzIconType="question-circle",this.nzModalType="default",this.nzAutofocus="auto",this.nzOnOk=new o.EventEmitter,this.nzOnCancel=new o.EventEmitter,this.nzAfterOpen=new o.EventEmitter,this.nzAfterClose=new o.EventEmitter,this.nzVisibleChange=new o.EventEmitter,this.modalRef=null}return Object.defineProperty(t.prototype,"modalFooter",{set:function(t){t&&t.templateRef&&this.setFooterWithTemplate(t.templateRef)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"afterOpen",{get:function(){return this.nzAfterOpen.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"afterClose",{get:function(){return this.nzAfterClose.asObservable()},enumerable:!0,configurable:!0}),t.prototype.open=function(){if(this.nzVisible||(this.nzVisible=!0,this.nzVisibleChange.emit(!0)),!this.modalRef){var t=this.getConfig();this.modalRef=this.modal.create(t)}},t.prototype.close=function(t){this.nzVisible&&(this.nzVisible=!1,this.nzVisibleChange.emit(!1)),this.modalRef&&(this.modalRef.close(t),this.modalRef=null)},t.prototype.destroy=function(t){this.close(t)},t.prototype.triggerOk=function(){var t;null===(t=this.modalRef)||void 0===t||t.triggerOk()},t.prototype.triggerCancel=function(){var t;null===(t=this.modalRef)||void 0===t||t.triggerCancel()},t.prototype.getContentComponent=function(){var t;return null===(t=this.modalRef)||void 0===t?void 0:t.getContentComponent()},t.prototype.getElement=function(){var t;return null===(t=this.modalRef)||void 0===t?void 0:t.getElement()},t.prototype.getModalRef=function(){return this.modalRef},t.prototype.setFooterWithTemplate=function(t){var e=this;this.nzFooter=t,this.modalRef&&Promise.resolve().then((function(){e.modalRef.updateConfig({nzFooter:e.nzFooter})})),this.cdr.markForCheck()},t.prototype.getConfig=function(){var t=x(this);return t.nzViewContainerRef=this.viewContainerRef,this.nzContent||(t.nzContent=this.contentTemplateRef),t},t.prototype.ngOnChanges=function(t){var e=t.nzVisible,n=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]])}return n}(t,["nzVisible"]);Object.keys(n).length&&this.modalRef&&this.modalRef.updateConfig(x(this)),e&&(this.nzVisible?this.open():this.close())},t.prototype.ngOnDestroy=function(){var t;null===(t=this.modalRef)||void 0===t||t._finishDialogClose()},t.decorators=[{type:o.Component,args:[{selector:"nz-modal",exportAs:"nzModal",template:" <ng-template><ng-content></ng-content></ng-template> ",changeDetection:o.ChangeDetectionStrategy.OnPush}]}],t.ctorParameters=function(){return[{type:o.ChangeDetectorRef},{type:j},{type:o.ViewContainerRef}]},t.propDecorators={nzMask:[{type:o.Input}],nzMaskClosable:[{type:o.Input}],nzCloseOnNavigation:[{type:o.Input}],nzVisible:[{type:o.Input}],nzClosable:[{type:o.Input}],nzOkLoading:[{type:o.Input}],nzOkDisabled:[{type:o.Input}],nzCancelDisabled:[{type:o.Input}],nzCancelLoading:[{type:o.Input}],nzKeyboard:[{type:o.Input}],nzNoAnimation:[{type:o.Input}],nzContent:[{type:o.Input}],nzComponentParams:[{type:o.Input}],nzFooter:[{type:o.Input}],nzGetContainer:[{type:o.Input}],nzZIndex:[{type:o.Input}],nzWidth:[{type:o.Input}],nzWrapClassName:[{type:o.Input}],nzClassName:[{type:o.Input}],nzStyle:[{type:o.Input}],nzTitle:[{type:o.Input}],nzCloseIcon:[{type:o.Input}],nzMaskStyle:[{type:o.Input}],nzBodyStyle:[{type:o.Input}],nzOkText:[{type:o.Input}],nzCancelText:[{type:o.Input}],nzOkType:[{type:o.Input}],nzIconType:[{type:o.Input}],nzModalType:[{type:o.Input}],nzAutofocus:[{type:o.Input}],nzOnOk:[{type:o.Input},{type:o.Output}],nzOnCancel:[{type:o.Input},{type:o.Output}],nzAfterOpen:[{type:o.Output}],nzAfterClose:[{type:o.Output}],nzVisibleChange:[{type:o.Output}],contentTemplateRef:[{type:o.ViewChild,args:[o.TemplateRef,{static:!0}]}],modalFooter:[{type:o.ContentChild,args:[_]}]},O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzMask",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzMaskClosable",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzCloseOnNavigation",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzVisible",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzClosable",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzOkLoading",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzOkDisabled",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzCancelDisabled",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzCancelLoading",void 0),O([r.InputBoolean(),M("design:type",Boolean)],t.prototype,"nzKeyboard",void 0),O([r.InputBoolean(),M("design:type",Object)],t.prototype,"nzNoAnimation",void 0),t}();var V=function(){function t(t){this.config=t}return t.decorators=[{type:o.Component,args:[{selector:"button[nz-modal-close]",exportAs:"NzModalCloseBuiltin",template:'\n <span class="ant-modal-close-x">\n <ng-container *nzStringTemplateOutlet="config.nzCloseIcon; let closeIcon">\n <i nz-icon [nzType]="closeIcon" class="ant-modal-close-icon"></i>\n </ng-container>\n </span>\n ',host:{class:"ant-modal-close","aria-label":"Close"},changeDetection:o.ChangeDetectionStrategy.OnPush}]}],t.ctorParameters=function(){return[{type:I}]},t}();var q=function(){function t(t,e){var n=this;this.i18n=t,this.config=e,this.buttonsFooter=!1,this.buttons=[],this.cancelTriggered=new o.EventEmitter,this.okTriggered=new o.EventEmitter,this.destroy$=new s.Subject,Array.isArray(e.nzFooter)&&(this.buttonsFooter=!0,this.buttons=e.nzFooter.map($)),this.i18n.localeChange.pipe(l.takeUntil(this.destroy$)).subscribe((function(){n.locale=n.i18n.getLocaleData("Modal")}))}return t.prototype.onCancel=function(){this.cancelTriggered.emit()},t.prototype.onOk=function(){this.okTriggered.emit()},t.prototype.getButtonCallableProp=function(t,e){var n=t[e],o=this.modalRef.getContentComponent();return"function"==typeof n?n.apply(t,o&&[o]):n},t.prototype.onButtonClick=function(t){if(!this.getButtonCallableProp(t,"loading")){var e=this.getButtonCallableProp(t,"onClick");t.autoLoading&&r.isPromise(e)&&(t.loading=!0,e.then((function(){return t.loading=!1})).catch((function(){return t.loading=!1})))}},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},t.decorators=[{type:o.Component,args:[{selector:"div[nz-modal-footer]",exportAs:"NzModalFooterBuiltin",template:'\n <ng-container *ngIf="config.nzFooter; else defaultFooterButtons">\n <ng-container *nzStringTemplateOutlet="config.nzFooter">\n <div *ngIf="!buttonsFooter" [innerHTML]="config.nzTitle"></div>\n <ng-container *ngIf="buttonsFooter">\n <button\n *ngFor="let button of buttons"\n nz-button\n (click)="onButtonClick(button)"\n [hidden]="!getButtonCallableProp(button, \'show\')"\n [nzLoading]="getButtonCallableProp(button, \'loading\')"\n [disabled]="getButtonCallableProp(button, \'disabled\')"\n [nzType]="button.type!"\n [nzShape]="button.shape!"\n [nzSize]="button.size!"\n [nzGhost]="button.ghost!"\n >\n {{ button.label }}\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n <ng-template #defaultFooterButtons>\n <button\n *ngIf="config.nzCancelText !== null"\n [attr.cdkFocusInitial]="config.nzAutofocus === \'cancel\' || null"\n nz-button\n (click)="onCancel()"\n [nzLoading]="!!config.nzCancelLoading"\n [disabled]="config.nzCancelDisabled"\n >\n {{ config.nzCancelText || locale.cancelText }}\n </button>\n <button\n *ngIf="config.nzOkText !== null"\n [attr.cdkFocusInitial]="config.nzAutofocus === \'ok\' || null"\n nz-button\n [nzType]="config.nzOkType!"\n (click)="onOk()"\n [nzLoading]="!!config.nzOkLoading"\n [disabled]="config.nzOkDisabled"\n >\n {{ config.nzOkText || locale.okText }}\n </button>\n </ng-template>\n ',host:{class:"ant-modal-footer"},changeDetection:o.ChangeDetectionStrategy.Default}]}],t.ctorParameters=function(){return[{type:u.NzI18nService},{type:I}]},t.propDecorators={cancelTriggered:[{type:o.Output}],okTriggered:[{type:o.Output}],modalRef:[{type:o.Input}]},t}();function $(t){return k({type:null,size:"default",autoLoading:!0,show:!0,loading:!1,disabled:!1},t)}var K=function(){function t(t){this.config=t}return t.decorators=[{type:o.Component,args:[{selector:"div[nz-modal-title]",exportAs:"NzModalTitleBuiltin",template:'\n <div class="ant-modal-title">\n <ng-container *nzStringTemplateOutlet="config.nzTitle">\n <div [innerHTML]="config.nzTitle"></div>\n </ng-container>\n </div>\n ',host:{class:"ant-modal-header"},changeDetection:o.ChangeDetectionStrategy.OnPush}]}],t.ctorParameters=function(){return[{type:I}]},t}();var U=function(){function t(){}return t.decorators=[{type:o.NgModule,args:[{imports:[p.CommonModule,e.OverlayModule,y.NzOutletModule,n.PortalModule,u.NzI18nModule,m.NzButtonModule,C.NzIconModule,z.NzPipesModule,h.NzNoAnimationModule],exports:[W,_],providers:[j],entryComponents:[L,F],declarations:[W,_,V,q,K,L,F,W]}]}],t}(),Z=function(){};t.BaseModalContainer=P,t.FADE_CLASS_NAME_MAP=E,t.MODAL_MASK_CLASS_NAME="ant-modal-mask",t.ModalOptions=I,t.NZ_CONFIG_COMPONENT_NAME="modal",t.NzModalCloseComponent=V,t.NzModalComponent=W,t.NzModalConfirmContainerComponent=F,t.NzModalContainerComponent=L,t.NzModalFooterComponent=q,t.NzModalFooterDirective=_,t.NzModalLegacyAPI=Z,t.NzModalModule=U,t.NzModalRef=B,t.NzModalService=j,t.NzModalTitleComponent=K,t.ZOOM_CLASS_NAME_MAP=A,t.applyConfigDefaults=R,t.getConfigFromComponent=x,t.getValueWithConfig=w,t.nzModalAnimations=S,t.setContentInstanceParams=N,t.throwNzModalContentAlreadyAttachedError=D,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-modal.umd.min.js.map