UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

31 lines (29 loc) 34.4 kB
!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/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/core/config"),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/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/core/config","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.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"].core.config,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,l,s,c,p,d,u,f,g,m,y,h,z,C){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */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 O=function(){return(O=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 k(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 l=t.length-1;l>=0;l--)(i=t[l])&&(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 T(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var M=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.nzMask=!0,this.nzMaskClosable=!0,this.nzKeyboard=!0,this.nzZIndex=1e3,this.nzWidth=520,this.nzCloseIcon="close",this.nzOkType="primary",this.nzModalType="default",this.nzOnCancel=M,this.nzOnOk=M,this.nzCloseOnNavigation=!0,this.nzIconType="question-circle"};var E={modalContainer:u.trigger("modalContainer",[u.state("void, exit",u.style({})),u.state("enter",u.style({})),u.transition("* => enter",u.animate(".24s",u.style({}))),u.transition("* => void, * => exit",u.animate(".2s",u.style({})))])};function R(){throw Error("Attempting to attach modal content after content is already attached")}var A="zoom-enter",S="zoom-enter-active",w="zoom-leave",x="zoom-leave-active",N="fade-enter",P="fade-enter-active",F="fade-leave",D="fade-leave-active",j=function(t){function e(e,n,i,a,r,l,s,c,p){var d=t.call(this)||this;return d.elementRef=e,d.focusTrapFactory=n,d.cdr=i,d.render=a,d.zone=r,d.overlayRef=l,d.config=s,d.animationType=p,d.animationStateChanged=new o.EventEmitter,d.containerClick=new o.EventEmitter,d.cancelTriggered=new o.EventEmitter,d.okTriggered=new o.EventEmitter,d.state="enter",d.isStringContent=!1,d.elementFocusedBeforeModalWasOpened=null,d.latestMousedownTarget=null,d.oldMaskStyle=null,d.document=c,d.isStringContent="string"==typeof s.nzContent,d.setContainer(),d}return b(e,t),e.prototype.onMousedown=function(t){this.latestMousedownTarget=t.target||null},e.prototype.onMouseup=function(t){t.target===this.latestMousedownTarget&&t.target===this.elementRef.nativeElement&&this.containerClick.emit(),this.latestMousedownTarget=null},e.prototype.onCloseClick=function(){this.cancelTriggered.emit()},e.prototype.onOkClick=function(){this.okTriggered.emit()},e.prototype.attachComponentPortal=function(t){return this.portalOutlet.hasAttached()&&R(),this.savePreviouslyFocusedElement(),this.setModalTransformOrigin(),this.portalOutlet.attachComponentPortal(t)},e.prototype.attachTemplatePortal=function(t){return this.portalOutlet.hasAttached()&&R(),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=a.getElementOffset(this.elementFocusedBeforeModalWasOpened),o=n.left+e.width/2,i=n.top+e.height/2,r=o-t.offsetLeft+"px "+(i-t.offsetTop)+"px 0px";this.render.setStyle(t,"transform-origin",r)}},e.prototype.savePreviouslyFocusedElement=function(){var t=this;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.focusTrap||(this.focusTrap=this.focusTrapFactory.create(t)),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(){var t=this;this.animationDisabled()||this.zone.runOutsideAngular((function(){t.setModalTransformOrigin();var e=t.modalElementRef.nativeElement,n=t.overlayRef.backdropElement;t.render.addClass(e,A),t.render.addClass(e,S),t.render.addClass(n,N),t.render.addClass(n,P)}))},e.prototype.setExitAnimationClass=function(){var t=this;this.animationDisabled()||this.zone.runOutsideAngular((function(){var e=t.modalElementRef.nativeElement,n=t.overlayRef.backdropElement;t.render.addClass(e,w),t.render.addClass(e,x),t.render.addClass(n,F),t.render.addClass(n,D)}))},e.prototype.cleanAnimationClass=function(){var t=this;this.animationDisabled()||this.zone.runOutsideAngular((function(){var e=t.overlayRef.backdropElement,n=t.modalElementRef.nativeElement;t.render.removeClass(n,A),t.render.removeClass(n,S),t.render.removeClass(n,w),t.render.removeClass(n,x),t.render.removeClass(e,N),t.render.removeClass(e,P)}))},e.prototype.bindBackdropStyle=function(){var t=this;this.zone.runOutsideAngular((function(){if(t.oldMaskStyle){var e=t.overlayRef.backdropElement,n=t.oldMaskStyle;Object.keys(n).forEach((function(n){t.render.removeStyle(e,n)})),t.oldMaskStyle=null}if("object"==typeof t.config.nzMaskStyle&&Object.keys(t.config.nzMaskStyle).length){var o=t.overlayRef.backdropElement,i=O({},t.config.nzMaskStyle);Object.keys(i).forEach((function(e){t.render.setStyle(o,e,i[e])})),t.oldMaskStyle=i}}))},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.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}(n.BasePortalOutlet);var B=function(t){function i(e,n,i,a,s,c,p,d,u,f){var g=t.call(this,n,i,a,s,c,p,d,u,f)||this;return g.i18n=e,g.config=d,g.cancelTriggered=new o.EventEmitter,g.okTriggered=new o.EventEmitter,g.locale={},g.destroy$=new r.Subject,g.i18n.localeChange.pipe(l.takeUntil(g.destroy$)).subscribe((function(){g.locale=g.i18n.getLocaleData("Modal")})),g}return b(i,t),i.prototype.onCancel=function(){this.cancelTriggered.emit()},i.prototype.onOk=function(){this.okTriggered.emit()},i.prototype.attachComponentPortal=function(t){throw new Error("The confirm mode does not support using component as content")},i.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},i.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 [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\'"\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\'"\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:[E.modalContainer],changeDetection:o.ChangeDetectionStrategy.Default,host:{tabindex:"-1",role:"dialog",class:"ant-modal-wrap","[class]":"config.nzWrapClassName","[style.zIndex]":"config.nzZIndex","[@.disabled]":"config.nzNoAnimation","[@modalContainer]":"state","(@modalContainer.start)":"onAnimationStart($event)","(@modalContainer.done)":"onAnimationDone($event)","(mousedown)":"onMousedown($event)","(mouseup)":"onMouseup($event)"}}]}],i.ctorParameters=function(){return[{type:d.NzI18nService},{type:o.ElementRef},{type:s.FocusTrapFactory},{type:o.ChangeDetectorRef},{type:o.Renderer2},{type:o.NgZone},{type:e.OverlayRef},{type:I},{type:void 0,decorators:[{type:o.Optional},{type:o.Inject,args:[c.DOCUMENT]}]},{type:String,decorators:[{type:o.Optional},{type:o.Inject,args:[p.ANIMATION_MODULE_TYPE]}]}]},i.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}]},i}(j);var L=function(t){function i(e,n,o,i,a,r,l,s,c){var p=t.call(this,e,n,o,i,a,r,l,s,c)||this;return p.config=l,p}return b(i,t),i.decorators=[{type:o.Component,args:[{selector:"nz-modal-container",exportAs:"nzModalContainer",template:'\n <div\n #modalElement\n role="document"\n class="ant-modal"\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:[E.modalContainer],changeDetection:o.ChangeDetectionStrategy.Default,host:{tabindex:"-1",role:"dialog",class:"ant-modal-wrap","[class]":"config.nzWrapClassName","[style.zIndex]":"config.nzZIndex","[@.disabled]":"config.nzNoAnimation","[@modalContainer]":"state","(@modalContainer.start)":"onAnimationStart($event)","(@modalContainer.done)":"onAnimationDone($event)","(mousedown)":"onMousedown($event)","(mouseup)":"onMouseup($event)"}}]}],i.ctorParameters=function(){return[{type:o.ElementRef},{type:s.FocusTrapFactory},{type:o.ChangeDetectorRef},{type:o.Renderer2},{type:o.NgZone},{type:e.OverlayRef},{type:I},{type:void 0,decorators:[{type:o.Optional},{type:o.Inject,args:[c.DOCUMENT]}]},{type:String,decorators:[{type:o.Optional},{type:o.Inject,args:[p.ANIMATION_MODULE_TYPE]}]}]},i.propDecorators={portalOutlet:[{type:o.ViewChild,args:[n.CdkPortalOutlet,{static:!0}]}],modalElementRef:[{type:o.ViewChild,args:["modalElement",{static:!0}]}]},i}(j);var W=function(){function t(t,e,n){var i=this;this.overlayRef=t,this.config=e,this.containerInstance=n,this.state=0,this.afterClose=new r.Subject,this.afterOpen=new r.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.overlayRef.dispose()})),n.containerClick.pipe(l.take(1)).subscribe((function(){!i.config.nzCancelLoading&&!i.config.nzOkLoading&&e.nzMask&&e.nzMaskClosable&&i.trigger("cancel")})),t.keydownEvents().pipe(l.filter((function(t){return i.config.nzKeyboard&&!i.config.nzCancelLoading&&!i.config.nzOkLoading&&t.keyCode===f.ESCAPE&&!f.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.state=2,e.overlayRef.detachBackdrop(),e.closeTimeout=setTimeout((function(){e.overlayRef.dispose()}),t.totalTime+100)})),this.containerInstance.startExitAnimation(),this.state=1},t.prototype.updateConfig=function(t){Object.assign(this.config,t),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],r={ok:"nzOkLoading",cancel:"nzCancelLoading"}[t];if(!this.config[r])if(i instanceof o.EventEmitter)i.emit(this.getContentComponent());else if("function"==typeof i){var l=i(this.getContentComponent());if(a.isPromise(l)){this.config[r]=!0;var s=function(t){n.config[r]=!1,n.closeWhitResult(t)};l.then(s).catch(s)}else!1!==(e=l)&&n.close(e)}},t.prototype.closeWhitResult=function(t){!1!==t&&this.close(t)},t}(); /** * @license * Copyright Alibaba.com 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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ function V(t,e){return O(O({},e),t)}function _(t,e){Object.assign(t,e)}function q(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}}var $=function(){function t(t,e,n){var o=this;this.overlay=t,this.injector=e,this.parentModal=n,this.openModalsAtThisLevel=[],this.afterAllClosedAtThisLevel=new r.Subject,this.afterAllClose=r.defer((function(){return o.openModals.length?o._afterAllClosed:o._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&&i.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=V(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=new e.OverlayConfig({hasBackdrop:!0,scrollStrategy:this.overlay.scrollStrategies.block(),positionStrategy:this.overlay.position().global(),disposeOnNavigation:t.nzCloseOnNavigation});return t.nzMask&&(n.backdropClass="ant-modal-mask"),this.overlay.create(n)},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?B:L,l=new n.ComponentPortal(r,o.nzViewContainerRef,a);return t.attach(l).instance},t.prototype.attachModalContent=function(t,e,i,r){var l=new W(i,r,e);if(t instanceof o.TemplateRef)e.attachTemplatePortal(new n.TemplatePortal(t,null,{$implicit:r.nzComponentParams,modalRef:l}));else if(a.isNotNil(t)&&"string"!=typeof t){var s=this.createInjector(l,r),c=e.attachComponentPortal(new n.ComponentPortal(t,r.nzViewContainerRef,s));_(c.instance,r.nzComponentParams),l.componentInstance=c.instance}return l},t.prototype.createInjector=function(t,e){var o=e&&e.nzViewContainerRef&&e.nzViewContainerRef.injector,i=new WeakMap([[W,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:t,decorators:[{type:o.Optional},{type:o.SkipSelf}]}]},t}();var Z=new o.InjectionToken("NZ_MODAL_CONFIG"),K=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:W,decorators:[{type:o.Optional}]},{type:o.TemplateRef}]},t}();var U=function(){function t(t,e,n,i){this.nzConfigService=t,this.cdr=e,this.modal=n,this.viewContainerRef=i,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.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=q(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(q(this)),e&&(this.nzVisible?this.open():this.close())},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:g.NzConfigService},{type:o.ChangeDetectorRef},{type:$},{type:o.ViewContainerRef}]},t.propDecorators={nzMask:[{type:o.Input}],nzMaskClosable:[{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}],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:[K]}]},k([g.WithConfig("modal",!0),a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzMask",void 0),k([g.WithConfig("modal",!0),a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzMaskClosable",void 0),k([a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzVisible",void 0),k([a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzClosable",void 0),k([a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzOkLoading",void 0),k([a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzOkDisabled",void 0),k([a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzCancelDisabled",void 0),k([a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzCancelLoading",void 0),k([a.InputBoolean(),T("design:type",Boolean)],t.prototype,"nzKeyboard",void 0),k([a.InputBoolean(),T("design:type",Object)],t.prototype,"nzNoAnimation",void 0),t}();var G=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">\n <i nz-icon [nzType]="config?.nzCloseIcon" 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 H=function(){function t(t,e){var n=this;this.i18n=t,this.config=e,this.buttonsFooter=!1,this.buttons=[],this.locale={},this.cancelTriggered=new o.EventEmitter,this.okTriggered=new o.EventEmitter,this.destroy$=new r.Subject,Array.isArray(e.nzFooter)&&(this.buttonsFooter=!0,this.buttons=e.nzFooter.map(Y)),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&&a.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\'"\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\'"\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:d.NzI18nService},{type:I}]},t.propDecorators={cancelTriggered:[{type:o.Output}],okTriggered:[{type:o.Output}],modalRef:[{type:o.Input}]},t}();function Y(t){return O({type:null,size:"default",autoLoading:!0,show:!0,loading:!1,disabled:!1},t)}var J=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 Q=function(){function t(){}return t.decorators=[{type:o.NgModule,args:[{imports:[c.CommonModule,e.OverlayModule,h.NzOutletModule,n.PortalModule,d.NzI18nModule,m.NzButtonModule,C.NzIconModule,z.NzPipesModule,y.NzNoAnimationModule],exports:[U,K],providers:[$],entryComponents:[U],declarations:[U,K,G,H,J,L,B,U]}]}],t}(),X=function(){}; /** * @license * Copyright Alibaba.com 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://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */t.BaseModalContainer=j,t.ModalOptions=I,t.NZ_MODAL_CONFIG=Z,t.NzModalCloseComponent=G,t.NzModalComponent=U,t.NzModalConfirmContainerComponent=B,t.NzModalContainerComponent=L,t.NzModalFooterComponent=H,t.NzModalFooterDirective=K,t.NzModalLegacyAPI=X,t.NzModalModule=Q,t.NzModalRef=W,t.NzModalService=$,t.NzModalTitleComponent=J,t.applyConfigDefaults=V,t.getConfigFromComponent=q,t.nzModalAnimations=E,t.setContentInstanceParams=_,t.throwNzModalContentAlreadyAttachedError=R,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-modal.umd.min.js.map