Socket
Socket
Sign inDemoInstall

ngx-ntk-smart-module

Package Overview
Dependencies
5
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.4 to 1.1.6

16

bundles/ngx-ntk-smart-module.umd.min.js

@@ -1,2 +0,16 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-ntk-smart-module",["exports","@angular/core","@angular/common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["ngx-ntk-smart-module"]={},t.ng.core,t.ng.common)}(this,(function(t,e,n){"use strict";Object.create;function o(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a}function i(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t}Object.create;var r=function(){function t(){this.modalStack=[]}return t.prototype.addModal=function(t,e){if(e){var n=this.modalStack.findIndex((function(e){return e.id===t.id}));n>-1?this.modalStack[n].modal=t.modal:this.modalStack.push(t)}else this.modalStack.push(t)},t.prototype.getModal=function(t){var e=this.modalStack.find((function(e){return e.id===t}));if(void 0!==e)return e.modal;throw new Error("Cannot find modal with identifier "+t)},t.prototype.getModalStack=function(){return this.modalStack},t.prototype.getOpenedModals=function(){return this.modalStack.filter((function(t){return t.modal.visible}))},t.prototype.getTopOpenedModal=function(){if(!this.getOpenedModals().length)throw new Error("No modal is opened");return this.getOpenedModals().map((function(t){return t.modal})).reduce((function(t,e){return e.layerPosition>t.layerPosition?e:t}),this.getOpenedModals()[0].modal)},t.prototype.getHigherIndex=function(){return Math.max.apply(Math,i(this.modalStack.map((function(t){return t.modal.layerPosition})),[1041]))+1},t.prototype.getModalStackCount=function(){return this.modalStack.length},t.prototype.removeModal=function(t){var e=this.modalStack.findIndex((function(e){return e.id===t}));e>-1&&this.modalStack.splice(e,1)},t}();r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[]};var a="dialog-open",s="ntk-smart-modal.",l=function(){function t(t,n,o,i,r){this._renderer=t,this._changeDetectorRef=n,this.componentFactoryResolver=o,this._document=i,this._platformId=r,this.closable=!0,this.escapable=!0,this.dismissable=!0,this.identifier="",this.customClass="nsm-dialog-animation-fade",this.visible=!1,this.backdrop=!0,this.force=!0,this.hideDelay=500,this.autostart=!1,this.target="",this.ariaLabel=null,this.ariaLabelledBy=null,this.ariaDescribedBy=null,this.refocus=!0,this.visibleChange=new e.EventEmitter,this.onClose=new e.EventEmitter,this.onCloseFinished=new e.EventEmitter,this.onDismiss=new e.EventEmitter,this.onDismissFinished=new e.EventEmitter,this.onAnyCloseEvent=new e.EventEmitter,this.onAnyCloseEventFinished=new e.EventEmitter,this.onOpen=new e.EventEmitter,this.onOpenFinished=new e.EventEmitter,this.onEscape=new e.EventEmitter,this.onDataAdded=new e.EventEmitter,this.onDataRemoved=new e.EventEmitter,this.layerPosition=1041,this.overlayVisible=!1,this.openedClass=!1,this.createFrom="html"}return t.prototype.ngOnInit=function(){if(!this.identifier||!this.identifier.length)throw new Error("identifier field isn’t set. Please set one before calling <ngx-smart-modal> in a template.");this._sendEvent("create")},t.prototype.ngAfterViewInit=function(){var t=this;if(this.contentComponent){var e=this.componentFactoryResolver.resolveComponentFactory(this.contentComponent);this.createDynamicContent(this.dynamicContentContainer,e),this.dynamicContentContainer.changes.subscribe((function(n){t.createDynamicContent(n,e)}))}},t.prototype.ngOnDestroy=function(){this._sendEvent("delete")},t.prototype.open=function(t){return this._sendEvent("open",{top:t}),this},t.prototype.close=function(){return this._sendEvent("close"),this},t.prototype.dismiss=function(t){return this.dismissable&&t.target.classList.contains("overlay")?(this._sendEvent("dismiss"),this):this},t.prototype.toggle=function(t){return this._sendEvent("toggle",{top:t}),this},t.prototype.addCustomClass=function(t){return this.customClass.length?this.customClass+=" "+t:this.customClass=t,this},t.prototype.removeCustomClass=function(t){return this.customClass=t?this.customClass.replace(t,"").trim():"",this},t.prototype.isVisible=function(){return this.visible},t.prototype.hasData=function(){return void 0!==this._data},t.prototype.setData=function(t,e){return(!this.hasData()||this.hasData()&&e)&&(this._data=t,this.onDataAdded.emit(this._data),this.markForCheck()),this},t.prototype.getData=function(){return this._data},t.prototype.removeData=function(){return this._data=void 0,this.onDataRemoved.emit(!0),this.markForCheck(),this},t.prototype.addBodyClass=function(){return this._renderer.addClass(this._document.body,a),this},t.prototype.removeBodyClass=function(){return this._renderer.removeClass(this._document.body,a),this},t.prototype.markForCheck=function(){try{this._changeDetectorRef.detectChanges()}catch(t){}this._changeDetectorRef.markForCheck()},t.prototype.targetPlacement=function(){if(!(this.isBrowser&&this.nsmDialog.length&&this.nsmContent.length&&this.nsmOverlay.length&&this.target))return!1;var t=this._document.querySelector(this.target);if(!t)return!1;var e=t.getBoundingClientRect(),n=this.nsmOverlay.first.nativeElement.getBoundingClientRect(),o=this.nsmContent.first.nativeElement.getBoundingClientRect(),i=this.nsmDialog.first.nativeElement.getBoundingClientRect(),r=parseInt(getComputedStyle(this.nsmContent.first.nativeElement).marginLeft,10),a=parseInt(getComputedStyle(this.nsmContent.first.nativeElement).marginTop,10),s=e.top-i.top-(o.height-e.height)/2,l=e.left-i.left-(o.width-e.width)/2;l+i.left+o.width+2*r>n.width?l=n.width-(i.left+o.width)-2*r:l+i.left<0&&(l=-i.left),s+i.top+o.height+a>n.height&&(s=n.height-(i.top+o.height)-a),this._renderer.setStyle(this.nsmContent.first.nativeElement,"top",(s<0?0:s)+"px"),this._renderer.setStyle(this.nsmContent.first.nativeElement,"left",l+"px")},t.prototype._sendEvent=function(t,e){if(!this.isBrowser)return!1;var n={extraData:e,instance:{id:this.identifier,modal:this}},o=new CustomEvent(s+t,{detail:n});return window.dispatchEvent(o)},Object.defineProperty(t.prototype,"isBrowser",{get:function(){return n.isPlatformBrowser(this._platformId)},enumerable:!1,configurable:!0}),t.prototype.createDynamicContent=function(t,e){var n=this;t.forEach((function(t){t.clear(),t.createComponent(e),n.markForCheck()}))},t}();l.decorators=[{type:e.Component,args:[{selector:"ntk-smart-modal",template:'\n <div *ngIf="overlayVisible"\n [style.z-index]="visible ? layerPosition-1 : -1"\n [ngClass]="{\'transparent\':!backdrop, \'overlay\':true, \'nsm-overlay-open\':openedClass}"\n (click)="dismiss($event)" #nsmOverlay>\n <div [style.z-index]="visible ? layerPosition : -1"\n [ngClass]="[\'nsm-dialog\', customClass, openedClass ? \'nsm-dialog-open\': \'nsm-dialog-close\']" #nsmDialog\n [attr.aria-hidden]="openedClass ? false : true"\n [attr.aria-label]="ariaLabel"\n [attr.aria-labelledby]="ariaLabelledBy"\n [attr.aria-describedby]="ariaDescribedBy">\n <div class="nsm-content" #nsmContent>\n <div class="nsm-body">\n <ng-template #dynamicContent></ng-template>\n <ng-content></ng-content>\n\n </div>\n <button type="button" *ngIf="closable" (click)="close()" aria-label="Close" class="nsm-dialog-btn-close">\n <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 512 512"\n xml:space="preserve" width="16px" height="16px" role="img" aria-labelledby="closeIconTitle closeIconDesc">\n <title id="closeIconTitle">Close Icon</title>\n <desc id="closeIconDesc">A light-gray close icon used to close the modal</desc>\n <g>\n <path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249 C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306 C514.019,27.23,514.019,14.135,505.943,6.058z"\n fill="currentColor"/>\n </g>\n <g>\n <path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636 c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"\n fill="currentColor"/>\n </g>\n </svg>\n </button>\n </div>\n </div>\n </div>\n '}]}],l.ctorParameters=function(){return[{type:e.Renderer2},{type:e.ChangeDetectorRef},{type:e.ComponentFactoryResolver},{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:void 0,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]}]},l.propDecorators={closable:[{type:e.Input}],escapable:[{type:e.Input}],dismissable:[{type:e.Input}],identifier:[{type:e.Input}],customClass:[{type:e.Input}],visible:[{type:e.Input}],backdrop:[{type:e.Input}],force:[{type:e.Input}],hideDelay:[{type:e.Input}],autostart:[{type:e.Input}],target:[{type:e.Input}],ariaLabel:[{type:e.Input}],ariaLabelledBy:[{type:e.Input}],ariaDescribedBy:[{type:e.Input}],refocus:[{type:e.Input}],visibleChange:[{type:e.Output}],onClose:[{type:e.Output}],onCloseFinished:[{type:e.Output}],onDismiss:[{type:e.Output}],onDismissFinished:[{type:e.Output}],onAnyCloseEvent:[{type:e.Output}],onAnyCloseEventFinished:[{type:e.Output}],onOpen:[{type:e.Output}],onOpenFinished:[{type:e.Output}],onEscape:[{type:e.Output}],onDataAdded:[{type:e.Output}],onDataRemoved:[{type:e.Output}],nsmContent:[{type:e.ViewChildren,args:["nsmContent"]}],nsmDialog:[{type:e.ViewChildren,args:["nsmDialog"]}],nsmOverlay:[{type:e.ViewChildren,args:["nsmOverlay"]}],dynamicContentContainer:[{type:e.ViewChildren,args:["dynamicContent",{read:e.ViewContainerRef}]}],targetPlacement:[{type:e.HostListener,args:["window:resize"]}]};var d=function(){function t(t,e,n,o,i,r,a){var s=this;this._componentFactoryResolver=t,this._appRef=e,this._injector=n,this._modalStack=o,this.applicationRef=i,this._document=r,this._platformId=a,this._escapeKeyboardEvent=function(t){if("Escape"===t.key)try{var e=s.getTopOpenedModal();return!!e.escapable&&(e.onEscape.emit(e),s.closeLatestModal(),!0)}catch(t){return!1}return!1},this._trapFocusModal=function(t){if("Tab"===t.key)try{var e=s.getTopOpenedModal();return e.nsmDialog.first.nativeElement.contains(document.activeElement)||(t.preventDefault(),t.stopPropagation(),e.nsmDialog.first.nativeElement.focus()),!0}catch(t){return!1}return!1},this._addEvents()}return t.prototype.addModal=function(t,e){this._modalStack.addModal(t,e)},t.prototype.getModal=function(t){return this._modalStack.getModal(t)},t.prototype.get=function(t){return this.getModal(t)},t.prototype.open=function(t,e){return void 0===e&&(e=!1),this._openModal(this.get(t),e)},t.prototype.close=function(t){return this._closeModal(this.get(t))},t.prototype.closeAll=function(){var t=this;this.getOpenedModals().forEach((function(e){t._closeModal(e.modal)}))},t.prototype.toggle=function(t,e){return void 0===e&&(e=!1),this._toggleModal(this.get(t),e)},t.prototype.getModalStack=function(){return this._modalStack.getModalStack()},t.prototype.getOpenedModals=function(){return this._modalStack.getOpenedModals()},t.prototype.getTopOpenedModal=function(){return this._modalStack.getTopOpenedModal()},t.prototype.getHigherIndex=function(){return this._modalStack.getHigherIndex()},t.prototype.getModalStackCount=function(){return this._modalStack.getModalStackCount()},t.prototype.removeModal=function(t){this._modalStack.removeModal(t)},t.prototype.setModalData=function(t,e,n){var o;return!!(o=this.get(e))&&(o.setData(t,n),!0)},t.prototype.getModalData=function(t){var e;return(e=this.get(t))?e.getData():null},t.prototype.resetModalData=function(t){if(this._modalStack.getModalStack().find((function(e){return e.id===t}))){var e=this.getModal(t).getData();return this.getModal(t).removeData(),e}return!1},t.prototype.closeLatestModal=function(){this.getTopOpenedModal().close()},t.prototype.create=function(t,n,o){void 0===o&&(o={});try{return this.getModal(t)}catch(d){var i=this._componentFactoryResolver.resolveComponentFactory(l),r=this._resolveNgContent(n),a=i.create(this._injector,r);n instanceof e.Type&&(a.instance.contentComponent=n),a.instance.identifier=t,a.instance.createFrom="service","boolean"==typeof o.closable&&(a.instance.closable=o.closable),"boolean"==typeof o.escapable&&(a.instance.escapable=o.escapable),"boolean"==typeof o.dismissable&&(a.instance.dismissable=o.dismissable),"string"==typeof o.customClass&&(a.instance.customClass=o.customClass),"boolean"==typeof o.backdrop&&(a.instance.backdrop=o.backdrop),"boolean"==typeof o.force&&(a.instance.force=o.force),"number"==typeof o.hideDelay&&(a.instance.hideDelay=o.hideDelay),"boolean"==typeof o.autostart&&(a.instance.autostart=o.autostart),"string"==typeof o.target&&(a.instance.target=o.target),"string"==typeof o.ariaLabel&&(a.instance.ariaLabel=o.ariaLabel),"string"==typeof o.ariaLabelledBy&&(a.instance.ariaLabelledBy=o.ariaLabelledBy),"string"==typeof o.ariaDescribedBy&&(a.instance.ariaDescribedBy=o.ariaDescribedBy),"boolean"==typeof o.refocus&&(a.instance.refocus=o.refocus),this._appRef.attachView(a.hostView);var s=a.hostView.rootNodes[0];return this._document.body.appendChild(s),a.instance}},t.prototype._addEvents=function(){var t=this;return!!this.isBrowser&&(window.addEventListener(s+"create",(function(e){t._initModal(e.detail.instance)})),window.addEventListener(s+"delete",(function(e){t._deleteModal(e.detail.instance)})),window.addEventListener(s+"open",(function(e){t._openModal(e.detail.instance.modal,e.detail.top)})),window.addEventListener(s+"toggle",(function(e){t._toggleModal(e.detail.instance.modal,e.detail.top)})),window.addEventListener(s+"close",(function(e){t._closeModal(e.detail.instance.modal)})),window.addEventListener(s+"dismiss",(function(e){t._dismissModal(e.detail.instance.modal)})),window.addEventListener("keyup",this._escapeKeyboardEvent),!0)},t.prototype._initModal=function(t){t.modal.layerPosition+=this.getModalStackCount(),this.addModal(t,t.modal.force),t.modal.autostart&&this.open(t.id)},t.prototype._openModal=function(t,e){return!t.visible&&(this.lastElementFocused=document.activeElement,t.escapable&&window.addEventListener("keyup",this._escapeKeyboardEvent),t.backdrop&&window.addEventListener("keydown",this._trapFocusModal),e&&(t.layerPosition=this.getHigherIndex()),t.addBodyClass(),t.overlayVisible=!0,t.visible=!0,t.onOpen.emit(t),t.markForCheck(),setTimeout((function(){t.openedClass=!0,t.target&&t.targetPlacement(),t.nsmDialog.first.nativeElement.setAttribute("role","dialog"),t.nsmDialog.first.nativeElement.setAttribute("tabIndex","-1"),t.nsmDialog.first.nativeElement.setAttribute("aria-modal","true"),t.nsmDialog.first.nativeElement.focus(),t.markForCheck(),t.onOpenFinished.emit(t)})),!0)},t.prototype._toggleModal=function(t,e){return t.visible?this._closeModal(t):this._openModal(t,e)},t.prototype._closeModal=function(t){var e=this;return!!t.openedClass&&(t.openedClass=!1,t.onClose.emit(t),t.onAnyCloseEvent.emit(t),this.getOpenedModals().length<2&&(t.removeBodyClass(),window.removeEventListener("keyup",this._escapeKeyboardEvent),window.removeEventListener("keydown",this._trapFocusModal)),setTimeout((function(){t.visibleChange.emit(t.visible),t.visible=!1,t.overlayVisible=!1,t.nsmDialog.first.nativeElement.removeAttribute("tabIndex"),t.markForCheck(),t.onCloseFinished.emit(t),t.onAnyCloseEventFinished.emit(t),t.refocus&&e.lastElementFocused.focus()}),t.hideDelay),!0)},t.prototype._dismissModal=function(t){return!!t.openedClass&&(t.openedClass=!1,t.onDismiss.emit(t),t.onAnyCloseEvent.emit(t),this.getOpenedModals().length<2&&t.removeBodyClass(),setTimeout((function(){t.visible=!1,t.visibleChange.emit(t.visible),t.overlayVisible=!1,t.markForCheck(),t.onDismissFinished.emit(t),t.onAnyCloseEventFinished.emit(t)}),t.hideDelay),!0)},t.prototype._deleteModal=function(t){this.removeModal(t.id),this.getModalStack().length||t.modal.removeBodyClass()},t.prototype._resolveNgContent=function(t){if("string"==typeof t)return[[this._document.createTextNode(t)]];if(t instanceof e.TemplateRef){var n=t.createEmbeddedView(null);return this.applicationRef.attachView(n),[n.rootNodes]}return[]},Object.defineProperty(t.prototype,"isBrowser",{get:function(){return n.isPlatformBrowser(this._platformId)},enumerable:!1,configurable:!0}),t}();d.decorators=[{type:e.Injectable}],d.ctorParameters=function(){return[{type:e.ComponentFactoryResolver},{type:e.ApplicationRef},{type:e.Injector},{type:r},{type:e.ApplicationRef},{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:void 0,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]}]};var c=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[d,r]}},t.forChild=function(){return{ngModule:t,providers:[d,r]}},t}();c.decorators=[{type:e.NgModule,args:[{declarations:[l],exports:[l],imports:[n.CommonModule]}]}];var p=function(){function t(){this.privateloaderStack=[],this.privateActions=[]}return t.prototype.addLoader=function(t,e){if(e){var n=this.privateloaderStack.findIndex((function(e){return e.id===t.id}));n>-1?this.privateloaderStack[n].component=t.component:this.privateloaderStack.push(t)}else{if(this._getLoader(t.id))throw new Error("Loader with "+t.id+" identifier already exist");this.privateloaderStack.push(t)}},t.prototype.removeLoader=function(t){this.privateloaderStack=this.privateloaderStack.filter((function(e){return e.id!==t})),this._removeAction(t,"*")},t.prototype.getLoaderStack=function(){return this.privateloaderStack},t.prototype.getLoaderStackCount=function(){return this.privateloaderStack.length},t.prototype.getOpenedLoaders=function(){return this.privateloaderStack.filter((function(t){return t.component.visible}))},t.prototype.getActiveLoaders=function(){return this.privateloaderStack.filter((function(t){return t.component.loading}))},t.prototype.getHigherIndex=function(){var t=this.getOpenedLoaders().map((function(t){return t.component.layerPosition}));return Math.max.apply(Math,i(t))+1},t.prototype.start=function(t){var e,n=this;Array.isArray(t)?t.forEach((function(t){n.start(t)})):(e=this._getLoader(t))?(e.component.start(),this._removeAction(t,"start")):this._addAction(t,"start")},t.prototype.startAll=function(){var t=this;this.privateloaderStack.forEach((function(e){return t.start(e.id)}))},t.prototype.stop=function(t){var e,n=this;Array.isArray(t)?t.forEach((function(t){n.stop(t)})):(e=this._getLoader(t))?(e.component.stop(),this._removeAction(t,"stop")):this._addAction(t,"stop")},t.prototype.stopAll=function(){var t=this;this.privateloaderStack.forEach((function(e){return t.stop(e.id)}))},t.prototype.isLoading=function(t){var e,n=this;if(Array.isArray(t)){var o=[];return t.forEach((function(t){n.privateloaderStack.forEach((function(e){e.id===t&&o.push(e.component.loading)}))})),-1===o.indexOf(!1)}return!!(e=this._getLoader(t))&&e.component.loading},t.prototype.executeAction=function(t,e){if(this.privateActions.find((function(n){return n.identifier===t&&n.action===e})))switch(e){case"start":this.start(t);break;case"stop":this.stop(t)}},t.prototype._getLoader=function(t){return this.privateloaderStack.find((function(e){return e.id===t}))||null},t.prototype._addAction=function(t,e){var n=this;Array.isArray(t)?t.forEach((function(t){n._addAction(t,e)})):this.privateActions.push({identifier:t,action:e})},t.prototype._removeAction=function(t,e){var n=this;Array.isArray(t)?t.forEach((function(t){n._removeAction(t,e)})):this.privateActions=this.privateActions.filter((function(n){return n.identifier!==t||n.action!==e&&"*"!==e}))},t}();p.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new p},token:p,providedIn:"root"}),p.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var u=function(t){this.id=t.identifier,this.component=t},h=function(){function t(t,n){this.ntkSmartLoaderService=t,this.changeDetectorRef=n,this.identifier="",this.customClass="",this.force=!1,this.delayIn=0,this.delayOut=0,this.autostart=!1,this.onStart=new e.EventEmitter,this.onStop=new e.EventEmitter,this.onVisibleChange=new e.EventEmitter,this.loading=!1,this.visible=!1,this.layerPosition=999,this.privateIsProcessing=!1,this.privateLoaderBodyClass="loader-open",this.privateEnterClass="enter",this.privateLeaveClass="leave"}return t.prototype.ngOnInit=function(){try{var t=new u(this);this.ntkSmartLoaderService.addLoader(t,this.force),this.layerPosition+=this.ntkSmartLoaderService.getLoaderStackCount(),this.addCustomClass(this.identifier.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),this.autostart?this.ntkSmartLoaderService.start(this.identifier):this.ntkSmartLoaderService.executeAction(this.identifier,"start")}catch(t){throw t}},t.prototype.ngOnDestroy=function(){this.ntkSmartLoaderService.removeLoader(this.identifier)},t.prototype.start=function(t){var e=this;this.privateIsProcessing=!0,clearInterval(this.privateDebouncer),this.visible=!0,setTimeout((function(){e.addCustomClass(e.privateEnterClass)})),this.privateDebouncer=setTimeout((function(){t&&(e.layerPosition=e.ntkSmartLoaderService.getHigherIndex()),document.body.classList.contains(e.privateLoaderBodyClass)||document.body.classList.add(e.privateLoaderBodyClass),e.loading=!0,e.onStart.emit(e),e.onVisibleChange.emit(e),e.removeCustomClass(e.privateEnterClass),e.privateIsProcessing=!1}),this.delayIn)},t.prototype.stop=function(){var t=this;this.privateIsProcessing&&(this.visible=!1,this.loading=!1),clearInterval(this.privateDebouncer),this.addCustomClass(this.privateLeaveClass),this.loading=!1,this.privateDebouncer=setTimeout((function(){document.body.classList.contains(t.privateLoaderBodyClass)&&document.body.classList.remove(t.privateLoaderBodyClass),t.visible=!1,t.onStop.emit(t),t.onVisibleChange.emit(t),t.removeCustomClass(t.privateLeaveClass),setTimeout((function(){t.changeDetectorRef.markForCheck()}))}),this.delayOut)},t.prototype.addCustomClass=function(t){this.customClass.length?-1===this.customClass.indexOf(t)&&(this.customClass+=" "+t):this.customClass=t},t.prototype.removeCustomClass=function(t){this.customClass=t?this.customClass.replace(t,"").trim():""},t}();h.decorators=[{type:e.Component,args:[{selector:"ntk-smart-loader",template:'\n <div class="loader-container {{customClass}}" [ngClass]="{\'active\': loading}"\n [style.z-index]="layerPosition - 1" *ngIf="visible">\n <ng-content></ng-content>\n </div>\n '}]}],h.ctorParameters=function(){return[{type:p},{type:e.ChangeDetectorRef}]},h.propDecorators={identifier:[{type:e.Input}],customClass:[{type:e.Input}],force:[{type:e.Input}],delayIn:[{type:e.Input}],delayOut:[{type:e.Input}],autostart:[{type:e.Input}],onStart:[{type:e.Output}],onStop:[{type:e.Output}],onVisibleChange:[{type:e.Output}]};var m=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[p]}},t.forChild=function(){return{ngModule:t,providers:[p]}},t}();m.decorators=[{type:e.NgModule,args:[{declarations:[h],exports:[h],imports:[n.CommonModule]}]}],t.NtkSmartLoaderComponent=h,t.NtkSmartLoaderModule=m,t.NtkSmartLoaderService=p,t.NtkSmartModalComponent=l,t.NtkSmartModalModule=c,t.NtkSmartModalService=d,t.ɵa=r,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-ntk-smart-module",["exports","@angular/core","@angular/common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["ngx-ntk-smart-module"]={},t.ng.core,t.ng.common)}(this,(function(t,e,n){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */Object.create;function o(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a}function i(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t}Object.create;var r=function(){function t(){this.modalStack=[]}return t.prototype.addModal=function(t,e){if(e){var n=this.modalStack.findIndex((function(e){return e.id===t.id}));n>-1?this.modalStack[n].modal=t.modal:this.modalStack.push(t)}else this.modalStack.push(t)},t.prototype.getModal=function(t){var e=this.modalStack.find((function(e){return e.id===t}));if(void 0!==e)return e.modal;throw new Error("Cannot find modal with identifier "+t)},t.prototype.getModalStack=function(){return this.modalStack},t.prototype.getOpenedModals=function(){return this.modalStack.filter((function(t){return t.modal.visible}))},t.prototype.getTopOpenedModal=function(){if(!this.getOpenedModals().length)throw new Error("No modal is opened");return this.getOpenedModals().map((function(t){return t.modal})).reduce((function(t,e){return e.layerPosition>t.layerPosition?e:t}),this.getOpenedModals()[0].modal)},t.prototype.getHigherIndex=function(){return Math.max.apply(Math,i(this.modalStack.map((function(t){return t.modal.layerPosition})),[1041]))+1},t.prototype.getModalStackCount=function(){return this.modalStack.length},t.prototype.removeModal=function(t){var e=this.modalStack.findIndex((function(e){return e.id===t}));e>-1&&this.modalStack.splice(e,1)},t}();r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[]};var a="dialog-open",s="ntk-smart-modal.",l=function(){function t(t,n,o,i,r){this._renderer=t,this._changeDetectorRef=n,this.componentFactoryResolver=o,this._document=i,this._platformId=r,this.closable=!0,this.escapable=!0,this.dismissable=!0,this.identifier="",this.customClass="nsm-dialog-animation-fade",this.visible=!1,this.backdrop=!0,this.force=!0,this.hideDelay=500,this.autostart=!1,this.target="",this.ariaLabel=null,this.ariaLabelledBy=null,this.ariaDescribedBy=null,this.refocus=!0,this.visibleChange=new e.EventEmitter,this.onClose=new e.EventEmitter,this.onCloseFinished=new e.EventEmitter,this.onDismiss=new e.EventEmitter,this.onDismissFinished=new e.EventEmitter,this.onAnyCloseEvent=new e.EventEmitter,this.onAnyCloseEventFinished=new e.EventEmitter,this.onOpen=new e.EventEmitter,this.onOpenFinished=new e.EventEmitter,this.onEscape=new e.EventEmitter,this.onDataAdded=new e.EventEmitter,this.onDataRemoved=new e.EventEmitter,this.layerPosition=1041,this.overlayVisible=!1,this.openedClass=!1,this.createFrom="html"}return t.prototype.ngOnInit=function(){if(!this.identifier||!this.identifier.length)throw new Error("identifier field isn’t set. Please set one before calling <ngx-smart-modal> in a template.");this._sendEvent("create")},t.prototype.ngAfterViewInit=function(){var t=this;if(this.contentComponent){var e=this.componentFactoryResolver.resolveComponentFactory(this.contentComponent);this.createDynamicContent(this.dynamicContentContainer,e),this.dynamicContentContainer.changes.subscribe((function(n){t.createDynamicContent(n,e)}))}},t.prototype.ngOnDestroy=function(){this._sendEvent("delete")},t.prototype.open=function(t){return this._sendEvent("open",{top:t}),this},t.prototype.close=function(){return this._sendEvent("close"),this},t.prototype.dismiss=function(t){return this.dismissable&&t.target.classList.contains("overlay")?(this._sendEvent("dismiss"),this):this},t.prototype.toggle=function(t){return this._sendEvent("toggle",{top:t}),this},t.prototype.addCustomClass=function(t){return this.customClass.length?this.customClass+=" "+t:this.customClass=t,this},t.prototype.removeCustomClass=function(t){return this.customClass=t?this.customClass.replace(t,"").trim():"",this},t.prototype.isVisible=function(){return this.visible},t.prototype.hasData=function(){return void 0!==this._data},t.prototype.setData=function(t,e){return(!this.hasData()||this.hasData()&&e)&&(this._data=t,this.onDataAdded.emit(this._data),this.markForCheck()),this},t.prototype.getData=function(){return this._data},t.prototype.removeData=function(){return this._data=void 0,this.onDataRemoved.emit(!0),this.markForCheck(),this},t.prototype.addBodyClass=function(){return this._renderer.addClass(this._document.body,a),this},t.prototype.removeBodyClass=function(){return this._renderer.removeClass(this._document.body,a),this},t.prototype.markForCheck=function(){try{this._changeDetectorRef.detectChanges()}catch(t){}this._changeDetectorRef.markForCheck()},t.prototype.targetPlacement=function(){if(!(this.isBrowser&&this.nsmDialog.length&&this.nsmContent.length&&this.nsmOverlay.length&&this.target))return!1;var t=this._document.querySelector(this.target);if(!t)return!1;var e=t.getBoundingClientRect(),n=this.nsmOverlay.first.nativeElement.getBoundingClientRect(),o=this.nsmContent.first.nativeElement.getBoundingClientRect(),i=this.nsmDialog.first.nativeElement.getBoundingClientRect(),r=parseInt(getComputedStyle(this.nsmContent.first.nativeElement).marginLeft,10),a=parseInt(getComputedStyle(this.nsmContent.first.nativeElement).marginTop,10),s=e.top-i.top-(o.height-e.height)/2,l=e.left-i.left-(o.width-e.width)/2;l+i.left+o.width+2*r>n.width?l=n.width-(i.left+o.width)-2*r:l+i.left<0&&(l=-i.left),s+i.top+o.height+a>n.height&&(s=n.height-(i.top+o.height)-a),this._renderer.setStyle(this.nsmContent.first.nativeElement,"top",(s<0?0:s)+"px"),this._renderer.setStyle(this.nsmContent.first.nativeElement,"left",l+"px")},t.prototype._sendEvent=function(t,e){if(!this.isBrowser)return!1;var n={extraData:e,instance:{id:this.identifier,modal:this}},o=new CustomEvent(s+t,{detail:n});return window.dispatchEvent(o)},Object.defineProperty(t.prototype,"isBrowser",{get:function(){return n.isPlatformBrowser(this._platformId)},enumerable:!1,configurable:!0}),t.prototype.createDynamicContent=function(t,e){var n=this;t.forEach((function(t){t.clear(),t.createComponent(e),n.markForCheck()}))},t}();l.decorators=[{type:e.Component,args:[{selector:"ntk-smart-modal",template:'\n <div *ngIf="overlayVisible"\n [style.z-index]="visible ? layerPosition-1 : -1"\n [ngClass]="{\'transparent\':!backdrop, \'overlay\':true, \'nsm-overlay-open\':openedClass}"\n (click)="dismiss($event)" #nsmOverlay>\n <div [style.z-index]="visible ? layerPosition : -1"\n [ngClass]="[\'nsm-dialog\', customClass, openedClass ? \'nsm-dialog-open\': \'nsm-dialog-close\']" #nsmDialog\n [attr.aria-hidden]="openedClass ? false : true"\n [attr.aria-label]="ariaLabel"\n [attr.aria-labelledby]="ariaLabelledBy"\n [attr.aria-describedby]="ariaDescribedBy">\n <div class="nsm-content" #nsmContent>\n <div class="nsm-body">\n <ng-template #dynamicContent></ng-template>\n <ng-content></ng-content>\n\n </div>\n <button type="button" *ngIf="closable" (click)="close()" aria-label="Close" class="nsm-dialog-btn-close">\n <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 512 512"\n xml:space="preserve" width="16px" height="16px" role="img" aria-labelledby="closeIconTitle closeIconDesc">\n <title id="closeIconTitle">Close Icon</title>\n <desc id="closeIconDesc">A light-gray close icon used to close the modal</desc>\n <g>\n <path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249 C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306 C514.019,27.23,514.019,14.135,505.943,6.058z"\n fill="currentColor"/>\n </g>\n <g>\n <path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636 c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"\n fill="currentColor"/>\n </g>\n </svg>\n </button>\n </div>\n </div>\n </div>\n '}]}],l.ctorParameters=function(){return[{type:e.Renderer2},{type:e.ChangeDetectorRef},{type:e.ComponentFactoryResolver},{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:void 0,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]}]},l.propDecorators={closable:[{type:e.Input}],escapable:[{type:e.Input}],dismissable:[{type:e.Input}],identifier:[{type:e.Input}],customClass:[{type:e.Input}],visible:[{type:e.Input}],backdrop:[{type:e.Input}],force:[{type:e.Input}],hideDelay:[{type:e.Input}],autostart:[{type:e.Input}],target:[{type:e.Input}],ariaLabel:[{type:e.Input}],ariaLabelledBy:[{type:e.Input}],ariaDescribedBy:[{type:e.Input}],refocus:[{type:e.Input}],visibleChange:[{type:e.Output}],onClose:[{type:e.Output}],onCloseFinished:[{type:e.Output}],onDismiss:[{type:e.Output}],onDismissFinished:[{type:e.Output}],onAnyCloseEvent:[{type:e.Output}],onAnyCloseEventFinished:[{type:e.Output}],onOpen:[{type:e.Output}],onOpenFinished:[{type:e.Output}],onEscape:[{type:e.Output}],onDataAdded:[{type:e.Output}],onDataRemoved:[{type:e.Output}],nsmContent:[{type:e.ViewChildren,args:["nsmContent"]}],nsmDialog:[{type:e.ViewChildren,args:["nsmDialog"]}],nsmOverlay:[{type:e.ViewChildren,args:["nsmOverlay"]}],dynamicContentContainer:[{type:e.ViewChildren,args:["dynamicContent",{read:e.ViewContainerRef}]}],targetPlacement:[{type:e.HostListener,args:["window:resize"]}]};var d=function(){function t(t,e,n,o,i,r,a){var s=this;this._componentFactoryResolver=t,this._appRef=e,this._injector=n,this._modalStack=o,this.applicationRef=i,this._document=r,this._platformId=a,this._escapeKeyboardEvent=function(t){if("Escape"===t.key)try{var e=s.getTopOpenedModal();return!!e.escapable&&(e.onEscape.emit(e),s.closeLatestModal(),!0)}catch(t){return!1}return!1},this._trapFocusModal=function(t){if("Tab"===t.key)try{var e=s.getTopOpenedModal();return e.nsmDialog.first.nativeElement.contains(document.activeElement)||(t.preventDefault(),t.stopPropagation(),e.nsmDialog.first.nativeElement.focus()),!0}catch(t){return!1}return!1},this._addEvents()}return t.prototype.addModal=function(t,e){this._modalStack.addModal(t,e)},t.prototype.getModal=function(t){return this._modalStack.getModal(t)},t.prototype.get=function(t){return this.getModal(t)},t.prototype.open=function(t,e){return void 0===e&&(e=!1),this._openModal(this.get(t),e)},t.prototype.close=function(t){return this._closeModal(this.get(t))},t.prototype.closeAll=function(){var t=this;this.getOpenedModals().forEach((function(e){t._closeModal(e.modal)}))},t.prototype.toggle=function(t,e){return void 0===e&&(e=!1),this._toggleModal(this.get(t),e)},t.prototype.getModalStack=function(){return this._modalStack.getModalStack()},t.prototype.getOpenedModals=function(){return this._modalStack.getOpenedModals()},t.prototype.getTopOpenedModal=function(){return this._modalStack.getTopOpenedModal()},t.prototype.getHigherIndex=function(){return this._modalStack.getHigherIndex()},t.prototype.getModalStackCount=function(){return this._modalStack.getModalStackCount()},t.prototype.removeModal=function(t){this._modalStack.removeModal(t)},t.prototype.setModalData=function(t,e,n){var o;return!!(o=this.get(e))&&(o.setData(t,n),!0)},t.prototype.getModalData=function(t){var e;return(e=this.get(t))?e.getData():null},t.prototype.resetModalData=function(t){if(this._modalStack.getModalStack().find((function(e){return e.id===t}))){var e=this.getModal(t).getData();return this.getModal(t).removeData(),e}return!1},t.prototype.closeLatestModal=function(){this.getTopOpenedModal().close()},t.prototype.create=function(t,n,o){void 0===o&&(o={});try{return this.getModal(t)}catch(d){var i=this._componentFactoryResolver.resolveComponentFactory(l),r=this._resolveNgContent(n),a=i.create(this._injector,r);n instanceof e.Type&&(a.instance.contentComponent=n),a.instance.identifier=t,a.instance.createFrom="service","boolean"==typeof o.closable&&(a.instance.closable=o.closable),"boolean"==typeof o.escapable&&(a.instance.escapable=o.escapable),"boolean"==typeof o.dismissable&&(a.instance.dismissable=o.dismissable),"string"==typeof o.customClass&&(a.instance.customClass=o.customClass),"boolean"==typeof o.backdrop&&(a.instance.backdrop=o.backdrop),"boolean"==typeof o.force&&(a.instance.force=o.force),"number"==typeof o.hideDelay&&(a.instance.hideDelay=o.hideDelay),"boolean"==typeof o.autostart&&(a.instance.autostart=o.autostart),"string"==typeof o.target&&(a.instance.target=o.target),"string"==typeof o.ariaLabel&&(a.instance.ariaLabel=o.ariaLabel),"string"==typeof o.ariaLabelledBy&&(a.instance.ariaLabelledBy=o.ariaLabelledBy),"string"==typeof o.ariaDescribedBy&&(a.instance.ariaDescribedBy=o.ariaDescribedBy),"boolean"==typeof o.refocus&&(a.instance.refocus=o.refocus),this._appRef.attachView(a.hostView);var s=a.hostView.rootNodes[0];return this._document.body.appendChild(s),a.instance}},t.prototype._addEvents=function(){var t=this;return!!this.isBrowser&&(window.addEventListener(s+"create",(function(e){t._initModal(e.detail.instance)})),window.addEventListener(s+"delete",(function(e){t._deleteModal(e.detail.instance)})),window.addEventListener(s+"open",(function(e){t._openModal(e.detail.instance.modal,e.detail.top)})),window.addEventListener(s+"toggle",(function(e){t._toggleModal(e.detail.instance.modal,e.detail.top)})),window.addEventListener(s+"close",(function(e){t._closeModal(e.detail.instance.modal)})),window.addEventListener(s+"dismiss",(function(e){t._dismissModal(e.detail.instance.modal)})),window.addEventListener("keyup",this._escapeKeyboardEvent),!0)},t.prototype._initModal=function(t){t.modal.layerPosition+=this.getModalStackCount(),this.addModal(t,t.modal.force),t.modal.autostart&&this.open(t.id)},t.prototype._openModal=function(t,e){return!t.visible&&(this.lastElementFocused=document.activeElement,t.escapable&&window.addEventListener("keyup",this._escapeKeyboardEvent),t.backdrop&&window.addEventListener("keydown",this._trapFocusModal),e&&(t.layerPosition=this.getHigherIndex()),t.addBodyClass(),t.overlayVisible=!0,t.visible=!0,t.onOpen.emit(t),t.markForCheck(),setTimeout((function(){t.openedClass=!0,t.target&&t.targetPlacement(),t.nsmDialog.first.nativeElement.setAttribute("role","dialog"),t.nsmDialog.first.nativeElement.setAttribute("tabIndex","-1"),t.nsmDialog.first.nativeElement.setAttribute("aria-modal","true"),t.nsmDialog.first.nativeElement.focus(),t.markForCheck(),t.onOpenFinished.emit(t)})),!0)},t.prototype._toggleModal=function(t,e){return t.visible?this._closeModal(t):this._openModal(t,e)},t.prototype._closeModal=function(t){var e=this;return!!t.openedClass&&(t.openedClass=!1,t.onClose.emit(t),t.onAnyCloseEvent.emit(t),this.getOpenedModals().length<2&&(t.removeBodyClass(),window.removeEventListener("keyup",this._escapeKeyboardEvent),window.removeEventListener("keydown",this._trapFocusModal)),setTimeout((function(){t.visibleChange.emit(t.visible),t.visible=!1,t.overlayVisible=!1,t.nsmDialog.first.nativeElement.removeAttribute("tabIndex"),t.markForCheck(),t.onCloseFinished.emit(t),t.onAnyCloseEventFinished.emit(t),t.refocus&&e.lastElementFocused.focus()}),t.hideDelay),!0)},t.prototype._dismissModal=function(t){return!!t.openedClass&&(t.openedClass=!1,t.onDismiss.emit(t),t.onAnyCloseEvent.emit(t),this.getOpenedModals().length<2&&t.removeBodyClass(),setTimeout((function(){t.visible=!1,t.visibleChange.emit(t.visible),t.overlayVisible=!1,t.markForCheck(),t.onDismissFinished.emit(t),t.onAnyCloseEventFinished.emit(t)}),t.hideDelay),!0)},t.prototype._deleteModal=function(t){this.removeModal(t.id),this.getModalStack().length||t.modal.removeBodyClass()},t.prototype._resolveNgContent=function(t){if("string"==typeof t)return[[this._document.createTextNode(t)]];if(t instanceof e.TemplateRef){var n=t.createEmbeddedView(null);return this.applicationRef.attachView(n),[n.rootNodes]}return[]},Object.defineProperty(t.prototype,"isBrowser",{get:function(){return n.isPlatformBrowser(this._platformId)},enumerable:!1,configurable:!0}),t}();d.decorators=[{type:e.Injectable}],d.ctorParameters=function(){return[{type:e.ComponentFactoryResolver},{type:e.ApplicationRef},{type:e.Injector},{type:r},{type:e.ApplicationRef},{type:void 0,decorators:[{type:e.Inject,args:[n.DOCUMENT]}]},{type:void 0,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]}]};var c=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[d,r]}},t.forChild=function(){return{ngModule:t,providers:[d,r]}},t}();c.decorators=[{type:e.NgModule,args:[{declarations:[l],exports:[l],imports:[n.CommonModule]}]}];var p=function(){function t(){this.privateloaderStack=[],this.privateActions=[]}return t.prototype.addLoader=function(t,e){if(e){var n=this.privateloaderStack.findIndex((function(e){return e.id===t.id}));n>-1?this.privateloaderStack[n].component=t.component:this.privateloaderStack.push(t)}else{if(this._getLoader(t.id))throw new Error("Loader with "+t.id+" identifier already exist");this.privateloaderStack.push(t)}},t.prototype.removeLoader=function(t){this.privateloaderStack=this.privateloaderStack.filter((function(e){return e.id!==t})),this._removeAction(t,"*")},t.prototype.getLoaderStack=function(){return this.privateloaderStack},t.prototype.getLoaderStackCount=function(){return this.privateloaderStack.length},t.prototype.getOpenedLoaders=function(){return this.privateloaderStack.filter((function(t){return t.component.visible}))},t.prototype.getActiveLoaders=function(){return this.privateloaderStack.filter((function(t){return t.component.loading}))},t.prototype.getHigherIndex=function(){var t=this.getOpenedLoaders().map((function(t){return t.component.layerPosition}));return Math.max.apply(Math,i(t))+1},t.prototype.start=function(t){var e,n=this;Array.isArray(t)?t.forEach((function(t){n.start(t)})):(e=this._getLoader(t))?(e.component.start(),this._removeAction(t,"start")):this._addAction(t,"start")},t.prototype.startAll=function(){var t=this;this.privateloaderStack.forEach((function(e){return t.start(e.id)}))},t.prototype.stop=function(t){var e,n=this;Array.isArray(t)?t.forEach((function(t){n.stop(t)})):(e=this._getLoader(t))?(e.component.stop(),this._removeAction(t,"stop")):this._addAction(t,"stop")},t.prototype.stopAll=function(){var t=this;this.privateloaderStack.forEach((function(e){return t.stop(e.id)}))},t.prototype.isLoading=function(t){var e,n=this;if(Array.isArray(t)){var o=[];return t.forEach((function(t){n.privateloaderStack.forEach((function(e){e.id===t&&o.push(e.component.loading)}))})),-1===o.indexOf(!1)}return!!(e=this._getLoader(t))&&e.component.loading},t.prototype.executeAction=function(t,e){if(this.privateActions.find((function(n){return n.identifier===t&&n.action===e})))switch(e){case"start":this.start(t);break;case"stop":this.stop(t)}},t.prototype._getLoader=function(t){return this.privateloaderStack.find((function(e){return e.id===t}))||null},t.prototype._addAction=function(t,e){var n=this;Array.isArray(t)?t.forEach((function(t){n._addAction(t,e)})):this.privateActions.push({identifier:t,action:e})},t.prototype._removeAction=function(t,e){var n=this;Array.isArray(t)?t.forEach((function(t){n._removeAction(t,e)})):this.privateActions=this.privateActions.filter((function(n){return n.identifier!==t||n.action!==e&&"*"!==e}))},t}();p.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new p},token:p,providedIn:"root"}),p.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var u=function(t){this.id=t.identifier,this.component=t},h=function(){function t(t,n){this.ntkSmartLoaderService=t,this.changeDetectorRef=n,this.identifier="",this.customClass="",this.force=!1,this.delayIn=0,this.delayOut=0,this.autostart=!1,this.onStart=new e.EventEmitter,this.onStop=new e.EventEmitter,this.onVisibleChange=new e.EventEmitter,this.loading=!1,this.visible=!1,this.layerPosition=999,this.privateIsProcessing=!1,this.privateLoaderBodyClass="loader-open",this.privateEnterClass="enter",this.privateLeaveClass="leave"}return t.prototype.ngOnInit=function(){try{var t=new u(this);this.ntkSmartLoaderService.addLoader(t,this.force),this.layerPosition+=this.ntkSmartLoaderService.getLoaderStackCount(),this.addCustomClass(this.identifier.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),this.autostart?this.ntkSmartLoaderService.start(this.identifier):this.ntkSmartLoaderService.executeAction(this.identifier,"start")}catch(t){throw t}},t.prototype.ngOnDestroy=function(){this.ntkSmartLoaderService.removeLoader(this.identifier)},t.prototype.start=function(t){var e=this;this.privateIsProcessing=!0,clearInterval(this.privateDebouncer),this.visible=!0,setTimeout((function(){e.addCustomClass(e.privateEnterClass)})),this.privateDebouncer=setTimeout((function(){t&&(e.layerPosition=e.ntkSmartLoaderService.getHigherIndex()),document.body.classList.contains(e.privateLoaderBodyClass)||document.body.classList.add(e.privateLoaderBodyClass),e.loading=!0,e.onStart.emit(e),e.onVisibleChange.emit(e),e.removeCustomClass(e.privateEnterClass),e.privateIsProcessing=!1}),this.delayIn)},t.prototype.stop=function(){var t=this;this.privateIsProcessing&&(this.visible=!1,this.loading=!1),clearInterval(this.privateDebouncer),this.addCustomClass(this.privateLeaveClass),this.loading=!1,this.privateDebouncer=setTimeout((function(){document.body.classList.contains(t.privateLoaderBodyClass)&&document.body.classList.remove(t.privateLoaderBodyClass),t.visible=!1,t.onStop.emit(t),t.onVisibleChange.emit(t),t.removeCustomClass(t.privateLeaveClass),setTimeout((function(){t.changeDetectorRef.markForCheck()}))}),this.delayOut)},t.prototype.addCustomClass=function(t){this.customClass.length?-1===this.customClass.indexOf(t)&&(this.customClass+=" "+t):this.customClass=t},t.prototype.removeCustomClass=function(t){this.customClass=t?this.customClass.replace(t,"").trim():""},t}();h.decorators=[{type:e.Component,args:[{selector:"ntk-smart-loader",template:'\n <div class="loader-container {{customClass}}" [ngClass]="{\'active\': loading}"\n [style.z-index]="layerPosition - 1" *ngIf="visible">\n <ng-content></ng-content>\n </div>\n '}]}],h.ctorParameters=function(){return[{type:p},{type:e.ChangeDetectorRef}]},h.propDecorators={identifier:[{type:e.Input}],customClass:[{type:e.Input}],force:[{type:e.Input}],delayIn:[{type:e.Input}],delayOut:[{type:e.Input}],autostart:[{type:e.Input}],onStart:[{type:e.Output}],onStop:[{type:e.Output}],onVisibleChange:[{type:e.Output}]};var m=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[p]}},t.forChild=function(){return{ngModule:t,providers:[p]}},t}();m.decorators=[{type:e.NgModule,args:[{declarations:[h],exports:[h],imports:[n.CommonModule]}]}],t.NtkSmartLoaderComponent=h,t.NtkSmartLoaderModule=m,t.NtkSmartLoaderService=p,t.NtkSmartModalComponent=l,t.NtkSmartModalModule=c,t.NtkSmartModalService=d,t.ɵa=r,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-ntk-smart-module.umd.min.js.map

4

package.json
{
"name": "ngx-ntk-smart-module",
"version": "1.1.4",
"version": "1.1.6",
"description": "Ntk Cms Modal ",

@@ -19,3 +19,3 @@ "author": "Alireza-Karavi",

"dependencies": {
"tslib": ">=2.0.0"
"tslib": "^2.0.0"
},

@@ -22,0 +22,0 @@ "main": "bundles/ngx-ntk-smart-module.umd.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc