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