UNPKG

ng-zorro-antd

Version:

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

31 lines (29 loc) 34.8 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(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"],t):t(((e=e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].modal={}),e.ng.cdk.overlay,e.ng.cdk.portal,e.ng.core,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"].core.config,e["ng-zorro-antd"].button,e["ng-zorro-antd"].core["no-animation"],e["ng-zorro-antd"].core.outlet,e["ng-zorro-antd"].core.pipe,e["ng-zorro-antd"].icon)}(this,(function(e,t,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(e,t){return(v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function b(e,t){function n(){this.constructor=e}v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var O=function(){return(O=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function k(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 l=e.length-1;l>=0;l--)(i=e[l])&&(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 M(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}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.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=T,this.nzOnOk=T,this.nzCloseOnNavigation=!0,this.nzIconType="question-circle"};var A=new o.InjectionToken("NZ_MODAL_CONFIG"),E={enter:"zoom-enter",enterActive:"zoom-enter-active",leave:"zoom-leave",leaveActive:"zoom-leave-active"},R={enter:"fade-enter",enterActive:"fade-enter-active",leave:"fade-leave",leaveActive:"fade-leave-active"},S={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 w(){throw Error("Attempting to attach modal content after content is already attached")}var N=function(e){function t(t,n,i,a,r,l,s,c,p){var d=e.call(this)||this;return d.elementRef=t,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(t,e),t.prototype.onMousedown=function(e){this.latestMousedownTarget=e.target||null},t.prototype.onMouseup=function(e){e.target===this.latestMousedownTarget&&e.target===this.elementRef.nativeElement&&this.containerClick.emit(),this.latestMousedownTarget=null},t.prototype.onCloseClick=function(){this.cancelTriggered.emit()},t.prototype.onOkClick=function(){this.okTriggered.emit()},t.prototype.attachComponentPortal=function(e){return this.portalOutlet.hasAttached()&&w(),this.savePreviouslyFocusedElement(),this.setModalTransformOrigin(),this.portalOutlet.attachComponentPortal(e)},t.prototype.attachTemplatePortal=function(e){return this.portalOutlet.hasAttached()&&w(),this.savePreviouslyFocusedElement(),this.portalOutlet.attachTemplatePortal(e)},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=a.getElementOffset(this.elementFocusedBeforeModalWasOpened),o=n.left+t.width/2,i=n.top+t.height/2,r=o-e.offsetLeft+"px "+(i-e.offsetTop)+"px 0px";this.render.setStyle(e,"transform-origin",r)}},t.prototype.savePreviouslyFocusedElement=function(){var e=this;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.focusTrap||(this.focusTrap=this.focusTrapFactory.create(e)),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(){var e=this;this.animationDisabled()||this.zone.runOutsideAngular((function(){e.setModalTransformOrigin();var t=e.modalElementRef.nativeElement,n=e.overlayRef.backdropElement;e.render.addClass(t,E.enter),e.render.addClass(t,E.enterActive),e.render.addClass(n,R.enter),e.render.addClass(n,R.enterActive)}))},t.prototype.setExitAnimationClass=function(){var e=this;this.zone.runOutsideAngular((function(){var t=e.modalElementRef.nativeElement,n=e.overlayRef.backdropElement;e.animationDisabled()?e.render.removeClass(n,"ant-modal-mask"):(e.render.addClass(t,E.leave),e.render.addClass(t,E.leaveActive),e.render.addClass(n,R.leave),e.render.addClass(n,R.leaveActive))}))},t.prototype.cleanAnimationClass=function(){var e=this;this.animationDisabled()||this.zone.runOutsideAngular((function(){var t=e.overlayRef.backdropElement,n=e.modalElementRef.nativeElement;e.render.removeClass(n,E.enter),e.render.removeClass(n,E.enterActive),e.render.removeClass(n,E.leave),e.render.removeClass(n,E.leaveActive),e.render.removeClass(t,R.enter),e.render.removeClass(t,R.enterActive)}))},t.prototype.bindBackdropStyle=function(){var e=this;this.zone.runOutsideAngular((function(){if(e.oldMaskStyle){var t=e.overlayRef.backdropElement,n=e.oldMaskStyle;Object.keys(n).forEach((function(n){e.render.removeStyle(t,n)})),e.oldMaskStyle=null}if("object"==typeof e.config.nzMaskStyle&&Object.keys(e.config.nzMaskStyle).length){var o=e.overlayRef.backdropElement,i=O({},e.config.nzMaskStyle);Object.keys(i).forEach((function(t){e.render.setStyle(o,t,i[t])})),e.oldMaskStyle=i}}))},t.prototype.setContainer=function(){var e=this.getContainer();e&&this.render.appendChild(e,this.elementRef.nativeElement)},t.prototype.resetContainer=function(){this.getContainer()&&this.render.appendChild(this.overlayRef.overlayElement,this.elementRef.nativeElement)},t.prototype.getContainer=function(){var e=this.config.nzGetContainer,t="function"==typeof e?e():e;return t instanceof HTMLElement?t:null},t.prototype.onAnimationDone=function(e){"void"!==e.toState&&("enter"===e.toState?(this.setContainer(),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.resetContainer(),this.setExitAnimationClass()),this.animationStateChanged.emit(e)},t.prototype.startExitAnimation=function(){this.state="exit",this.cdr.markForCheck()},t}(n.BasePortalOutlet);var x=function(e){function i(t,n,i,a,s,c,p,d,u,f){var g=e.call(this,n,i,a,s,c,p,d,u,f)||this;return g.i18n=t,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,e),i.prototype.onCancel=function(){this.cancelTriggered.emit()},i.prototype.onOk=function(){this.okTriggered.emit()},i.prototype.attachComponentPortal=function(e){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:[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)","(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:t.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}(N);var P=function(e){function i(t,n,o,i,a,r,l,s,c){var p=e.call(this,t,n,o,i,a,r,l,s,c)||this;return p.config=l,p}return b(i,e),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:[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)","(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:t.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}(N);var F=function(){function e(e,t,n){var i=this;this.overlayRef=e,this.config=t,this.containerInstance=n,this.state=0,this.afterClose=new r.Subject,this.afterOpen=new r.Subject,n.animationStateChanged.pipe(l.filter((function(e){return"done"===e.phaseName&&"enter"===e.toState})),l.take(1)).subscribe((function(){i.afterOpen.next(),i.afterOpen.complete(),t.nzAfterOpen instanceof o.EventEmitter&&t.nzAfterOpen.emit()})),n.animationStateChanged.pipe(l.filter((function(e){return"done"===e.phaseName&&"exit"===e.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&&t.nzMask&&t.nzMaskClosable&&i.trigger("cancel")})),e.keydownEvents().pipe(l.filter((function(e){return i.config.nzKeyboard&&!i.config.nzCancelLoading&&!i.config.nzOkLoading&&e.keyCode===f.ESCAPE&&!f.hasModifierKey(e)}))).subscribe((function(e){e.preventDefault(),i.trigger("cancel")})),n.cancelTriggered.subscribe((function(){return i.trigger("cancel")})),n.okTriggered.subscribe((function(){return i.trigger("ok")})),e.detachments().subscribe((function(){i.afterClose.next(i.result),i.afterClose.complete(),t.nzAfterClose instanceof o.EventEmitter&&t.nzAfterClose.emit(i.result),i.componentInstance=null,i.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(){this.trigger("ok")},e.prototype.triggerCancel=function(){this.trigger("cancel")},e.prototype.open=function(){},e.prototype.close=function(e){var t=this;this.result=e,this.containerInstance.animationStateChanged.pipe(l.filter((function(e){return"start"===e.phaseName})),l.take(1)).subscribe((function(e){t.state=2,t.overlayRef.detachBackdrop(),t.closeTimeout=setTimeout((function(){t.overlayRef.dispose()}),e.totalTime+100)})),this.containerInstance.startExitAnimation(),this.state=1},e.prototype.updateConfig=function(e){Object.assign(this.config,e),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){var t,n=this,i={ok:this.config.nzOnOk,cancel:this.config.nzOnCancel}[e],r={ok:"nzOkLoading",cancel:"nzCancelLoading"}[e];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(e){n.config[r]=!1,n.closeWhitResult(e)};l.then(s).catch(s)}else!1!==(t=l)&&n.close(t)}},e.prototype.closeWhitResult=function(e){!1!==e&&this.close(e)},e}(); /** * @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 D(e,t){return O(O({},t),e)}function j(e,t){Object.assign(e,t)}function B(e){return{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,nzGetContainer:e.nzGetContainer,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,nzIconType:e.nzIconType,nzModalType:e.nzModalType,nzOnOk:e.nzOnOk,nzOnCancel:e.nzOnCancel,nzAfterOpen:e.nzAfterOpen,nzAfterClose:e.nzAfterClose}}var L=function(){function e(e,t,n){var o=this;this.overlay=e,this.injector=t,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(e.prototype,"openModals",{get:function(){return this.parentModal?this.parentModal.openModals:this.openModalsAtThisLevel},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_afterAllClosed",{get:function(){var e=this.parentModal;return e?e._afterAllClosed:this.afterAllClosedAtThisLevel},enumerable:!0,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&&i.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=D(t||{},new I),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 n=new t.OverlayConfig({hasBackdrop:!0,scrollStrategy:this.overlay.scrollStrategies.block(),positionStrategy:this.overlay.position().global(),disposeOnNavigation:e.nzCloseOnNavigation});return e.nzMask&&(n.backdropClass="ant-modal-mask"),this.overlay.create(n)},e.prototype.attachModalContainer=function(e,o){var i=o&&o.nzViewContainerRef&&o.nzViewContainerRef.injector,a=new n.PortalInjector(i||this.injector,new WeakMap([[t.OverlayRef,e],[I,o]])),r="confirm"===o.nzModalType?x:P,l=new n.ComponentPortal(r,o.nzViewContainerRef,a);return e.attach(l).instance},e.prototype.attachModalContent=function(e,t,i,r){var l=new F(i,r,t);if(e instanceof o.TemplateRef)t.attachTemplatePortal(new n.TemplatePortal(e,null,{$implicit:r.nzComponentParams,modalRef:l}));else if(a.isNotNil(e)&&"string"!=typeof e){var s=this.createInjector(l,r),c=t.attachComponentPortal(new n.ComponentPortal(e,r.nzViewContainerRef,s));j(c.instance,r.nzComponentParams),l.componentInstance=c.instance}return l},e.prototype.createInjector=function(e,t){var o=t&&t.nzViewContainerRef&&t.nzViewContainerRef.injector,i=new WeakMap([[F,e]]);return new n.PortalInjector(o||this.injector,i)},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:o.Injectable}],e.ctorParameters=function(){return[{type:t.Overlay},{type:o.Injector},{type:e,decorators:[{type:o.Optional},{type:o.SkipSelf}]}]},e}();var _=function(){function e(e,t){this.nzModalRef=e,this.templateRef=t,this.nzModalRef&&this.nzModalRef.updateConfig({nzFooter:this.templateRef})}return e.decorators=[{type:o.Directive,args:[{selector:"[nzModalFooter]",exportAs:"nzModalFooter"}]}],e.ctorParameters=function(){return[{type:F,decorators:[{type:o.Optional}]},{type:o.TemplateRef}]},e}();var W=function(){function e(e,t,n,i){this.nzConfigService=e,this.cdr=t,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(e.prototype,"modalFooter",{set:function(e){e&&e.templateRef&&this.setFooterWithTemplate(e.templateRef)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"afterOpen",{get:function(){return this.nzAfterOpen.asObservable()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"afterClose",{get:function(){return this.nzAfterClose.asObservable()},enumerable:!0,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||(e.nzContent=this.contentTemplateRef),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.decorators=[{type:o.Component,args:[{selector:"nz-modal",exportAs:"nzModal",template:" <ng-template><ng-content></ng-content></ng-template> ",changeDetection:o.ChangeDetectionStrategy.OnPush}]}],e.ctorParameters=function(){return[{type:g.NzConfigService},{type:o.ChangeDetectorRef},{type:L},{type:o.ViewContainerRef}]},e.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([g.WithConfig("modal",!0),a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzMask",void 0),k([g.WithConfig("modal",!0),a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzMaskClosable",void 0),k([a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzVisible",void 0),k([a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzClosable",void 0),k([a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzOkLoading",void 0),k([a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzOkDisabled",void 0),k([a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzCancelDisabled",void 0),k([a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzCancelLoading",void 0),k([a.InputBoolean(),M("design:type",Boolean)],e.prototype,"nzKeyboard",void 0),k([a.InputBoolean(),M("design:type",Object)],e.prototype,"nzNoAnimation",void 0),e}();var V=function(){function e(e){this.config=e}return e.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}]}],e.ctorParameters=function(){return[{type:I}]},e}();var q=function(){function e(e,t){var n=this;this.i18n=e,this.config=t,this.buttonsFooter=!1,this.buttons=[],this.locale={},this.cancelTriggered=new o.EventEmitter,this.okTriggered=new o.EventEmitter,this.destroy$=new r.Subject,Array.isArray(t.nzFooter)&&(this.buttonsFooter=!0,this.buttons=t.nzFooter.map($)),this.i18n.localeChange.pipe(l.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&&a.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.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}]}],e.ctorParameters=function(){return[{type:d.NzI18nService},{type:I}]},e.propDecorators={cancelTriggered:[{type:o.Output}],okTriggered:[{type:o.Output}],modalRef:[{type:o.Input}]},e}();function $(e){return O({type:null,size:"default",autoLoading:!0,show:!0,loading:!1,disabled:!1},e)}var Z=function(){function e(e){this.config=e}return e.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}]}],e.ctorParameters=function(){return[{type:I}]},e}();var K=function(){function e(){}return e.decorators=[{type:o.NgModule,args:[{imports:[c.CommonModule,t.OverlayModule,h.NzOutletModule,n.PortalModule,d.NzI18nModule,m.NzButtonModule,C.NzIconModule,z.NzPipesModule,y.NzNoAnimationModule],exports:[W,_],providers:[L],entryComponents:[P,x],declarations:[W,_,V,q,Z,P,x,W]}]}],e}(),U=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 */e.BaseModalContainer=N,e.FADE_CLASS_NAME_MAP=R,e.MODAL_MASK_CLASS_NAME="ant-modal-mask",e.ModalOptions=I,e.NZ_MODAL_CONFIG=A,e.NzModalCloseComponent=V,e.NzModalComponent=W,e.NzModalConfirmContainerComponent=x,e.NzModalContainerComponent=P,e.NzModalFooterComponent=q,e.NzModalFooterDirective=_,e.NzModalLegacyAPI=U,e.NzModalModule=K,e.NzModalRef=F,e.NzModalService=L,e.NzModalTitleComponent=Z,e.ZOOM_CLASS_NAME_MAP=E,e.applyConfigDefaults=D,e.getConfigFromComponent=B,e.nzModalAnimations=S,e.setContentInstanceParams=j,e.throwNzModalContentAlreadyAttachedError=w,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-modal.umd.min.js.map