@sd-angular/core
Version:
Sd Angular Core Lib
2 lines • 9.03 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/material/dialog"),require("ngx-device-detector"),require("@angular/material/bottom-sheet"),require("rxjs"),require("@angular/common"),require("@angular/material/icon"),require("@angular/material/button"),require("@sd-angular/core/button")):"function"==typeof define&&define.amd?define("@sd-angular/core/modal",["exports","@angular/core","@angular/material/dialog","ngx-device-detector","@angular/material/bottom-sheet","rxjs","@angular/common","@angular/material/icon","@angular/material/button","@sd-angular/core/button"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["sd-angular"]=t["sd-angular"]||{},t["sd-angular"].core=t["sd-angular"].core||{},t["sd-angular"].core.modal={}),t.ng.core,t.ng.material.dialog,t.ngxDeviceDetector,t.ng.material.bottomSheet,t.rxjs,t.ng.common,t.ng.material.icon,t.ng.material.button,t["sd-angular"].core.button)}(this,(function(t,e,n,o,i,r,a,s,l,d){"use strict";var c=function(){function t(t,n,o,i){var a=this;this.ref=t,this.dialog=n,this.bottomSheet=o,this.height="auto",this.lazyLoadContent=!0,this.sdClosed=new e.EventEmitter,this.isOpened=!1,this.alreadyOpened=!1,this.isMobileOrTablet=!1,this.subcription=new r.Subscription,this.open=function(){a.isOpened||(a.ref.markForCheck(),a.alreadyOpened=!0,a.isOpened=!0,!a.view&&a.isMobileOrTablet||"bottomSheet"===a.view?(a.bottomSheetRef=a.bottomSheet.open(a.templateRef),a.subcription.add(a.bottomSheetRef.afterDismissed().subscribe((function(){a.isOpened=!1,a.sdClosed.emit()})))):(a.dialogRef=a.dialog.open(a.templateRef,{width:a.width,maxWidth:a.width,disableClose:!a.closeClickOutSide}),a.subcription.add(a.dialogRef.afterClosed().subscribe((function(){a.isOpened=!1,a.sdClosed.emit()})))))},this.close=function(){var t,e;a.ref.markForCheck(),null===(t=a.bottomSheetRef)||void 0===t||t.dismiss(),null===(e=a.dialogRef)||void 0===e||e.close()},this.isMobileOrTablet=!i.isDesktop()}return t.prototype.ngOnInit=function(){if(this.type=this.type||"primary",this.width=this.width||"80vw",!this.isMobileOrTablet)switch(this.width){case"lg":this.width="80vw";break;case"md":this.width="60vw";break;case"sm":this.width="40vw"}},t.prototype.ngOnDestroy=function(){this.subcription.unsubscribe()},t}();c.index=0,c.decorators=[{type:e.Component,args:[{selector:"sd-modal",template:'<ng-template #templateRef>\r\n <ng-container *ngIf="!lazyLoadContent || alreadyOpened">\r\n <sd-modal-header *ngIf="title">\r\n <span [innerHtml]="title"></span>\r\n <div class="d-flex align-items-center">\r\n <ng-content select="[sdModalHeaderRight]"></ng-content>\r\n <button *ngIf="!noClose" type="button" (click)="close()" mat-icon-button>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n </div>\r\n </sd-modal-header>\r\n <div class="d-flex flex-column px-12 px-md-24 pb-6 overflow-auto w-100 mh-100">\r\n <ng-content></ng-content>\r\n </div>\r\n </ng-container>\r\n</ng-template>',encapsulation:e.ViewEncapsulation.None,changeDetection:e.ChangeDetectionStrategy.OnPush,styles:['button:focus{outline:none!important}.mat-dialog-container{padding:0!important}.mat-dialog-container .mat-dialog-content{max-height:80vh}.mat-dialog-container .mat-dialog-actions{margin-bottom:0;min-height:auto;padding:0}.mat-bottom-sheet-container{max-height:"inherit"}sd-modal-header{display:block;padding:12px 24px;width:100%}@media (max-width:640px){sd-modal-header{padding:12px}}.cdk-global-overlay-wrapper .mat-bottom-sheet-container{border-top-left-radius:4px;border-top-right-radius:4px;box-sizing:border-box;display:flex;flex-direction:column;max-height:80vh;min-width:100vw;outline:0;overflow:hidden;padding:0}']}]}],c.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:n.MatDialog},{type:i.MatBottomSheet},{type:o.DeviceDetectorService}]},c.propDecorators={templateRef:[{type:e.ViewChild,args:["templateRef"]}],title:[{type:e.Input}],noClose:[{type:e.Input}],type:[{type:e.Input}],width:[{type:e.Input}],height:[{type:e.Input}],view:[{type:e.Input}],lazyLoadContent:[{type:e.Input}],closeClickOutSide:[{type:e.Input}],sdClosed:[{type:e.Output}],modal:[{type:e.ViewChild,args:["modal"]}]};var p=function(){function t(t){this.isMobileOrTablet=!1,this.isMobileOrTablet=!t.isDesktop()}return t.prototype.ngOnInit=function(){},t}();p.decorators=[{type:e.Component,args:[{selector:"sd-modal-header",template:'<h3 class="mb-0" mat-dialog-title *ngIf="!isMobileOrTablet">\r\n <ng-container *ngTemplateOutlet="content"></ng-container>\r\n</h3>\r\n<sd-bottom-sheet-header *ngIf="isMobileOrTablet">\r\n <ng-container *ngTemplateOutlet="content"></ng-container>\r\n</sd-bottom-sheet-header>\r\n<ng-template #content>\r\n <ng-content></ng-content>\r\n</ng-template>',encapsulation:e.ViewEncapsulation.None,styles:[".mat-dialog-title{align-items:center;display:flex!important;justify-content:space-between}button:focus{outline:none!important}"]}]}],p.ctorParameters=function(){return[{type:o.DeviceDetectorService}]};var g=function(){function t(t){this.height="auto",this.isMobileOrTablet=!1,this.isMobileOrTablet=!t.isDesktop()}return t.prototype.ngOnInit=function(){},t}();g.decorators=[{type:e.Component,args:[{selector:"sd-modal-body",template:'<mat-dialog-content *ngIf="!isMobileOrTablet" [ngStyle]="{\'height\': height}" class="pb-5">\r\n <ng-container *ngTemplateOutlet="content"></ng-container>\r\n</mat-dialog-content>\r\n<sd-bottom-sheet-body *ngIf="isMobileOrTablet" [height]="height">\r\n <ng-container *ngTemplateOutlet="content"></ng-container>\r\n</sd-bottom-sheet-body>\r\n<ng-template #content>\r\n <ng-content></ng-content>\r\n</ng-template>',styles:[":host{width:100%}"]}]}],g.ctorParameters=function(){return[{type:o.DeviceDetectorService}]},g.propDecorators={height:[{type:e.Input}]};var m=function(){function t(t){this.isMobileOrTablet=!1,this.isMobileOrTablet=!t.isDesktop()}return t.prototype.ngOnInit=function(){},t}();m.decorators=[{type:e.Component,args:[{selector:"sd-modal-footer",template:'\x3c!-- <div class="modal-footer" style="padding:5px"><ng-content></ng-content></div> --\x3e\r\n<mat-dialog-actions *ngIf="!isMobileOrTablet">\r\n <div class="c-footer">\r\n <ng-container *ngTemplateOutlet="content"></ng-container>\r\n </div>\r\n</mat-dialog-actions>\r\n<sd-bottom-sheet-footer *ngIf="isMobileOrTablet">\r\n <ng-container *ngTemplateOutlet="content"></ng-container>\r\n</sd-bottom-sheet-footer>\r\n<ng-template #content>\r\n <ng-content></ng-content>\r\n</ng-template>',styles:[":host{width:100%}:host .c-footer{align-items:center;display:flex;flex:auto;justify-content:flex-end;padding:8px 0}"]}]}],m.ctorParameters=function(){return[{type:o.DeviceDetectorService}]};var u=function(t){var e=this;this.bottomSheet=t,this.isOpened=!1,this.open=function(){e.isOpened=!0,e.bottomSheet.open(e.templateRef)},this.close=function(){e.bottomSheet.dismiss()}};u.decorators=[{type:e.Component,args:[{selector:"sd-bottom-sheet",template:'<ng-template #templateRef>\r\n <ng-container *ngIf="isOpened">\r\n <sd-bottom-sheet-header *ngIf="title">{{title}}</sd-bottom-sheet-header>\r\n <ng-content></ng-content>\r\n </ng-container>\r\n</ng-template>'}]}],u.ctorParameters=function(){return[{type:i.MatBottomSheet}]},u.propDecorators={templateRef:[{type:e.ViewChild,args:["templateRef"]}],title:[{type:e.Input}]};var h=function(){function t(){}return t.prototype.ngOnInit=function(){},t}();h.decorators=[{type:e.Component,args:[{selector:"sd-bottom-sheet-header",template:'<h3 class="mb-0" mat-dialog-title><ng-content></ng-content></h3>'}]}],h.ctorParameters=function(){return[]};var f=function(){function t(){this.height="auto"}return t.prototype.ngOnInit=function(){},t}();f.decorators=[{type:e.Component,args:[{selector:"sd-bottom-sheet-body",template:"<div [ngStyle]=\"{'height': height}\">\r\n <ng-content></ng-content>\r\n<div>"}]}],f.ctorParameters=function(){return[]},f.propDecorators={height:[{type:e.Input}]};var b=function(){function t(){}return t.prototype.ngOnInit=function(){},t}();b.decorators=[{type:e.Component,args:[{selector:"sd-bottom-sheet-footer",template:'\x3c!-- <div class="modal-footer" style="padding:5px"><ng-content></ng-content></div> --\x3e\r\n<div class="c-footer">\r\n <ng-content></ng-content>\r\n</div>',styles:[".c-footer{align-items:center;display:flex;flex:auto;justify-content:flex-end;padding-bottom:5px;padding-top:5px}"]}]}],b.ctorParameters=function(){return[]};var y=function(){};y.decorators=[{type:e.NgModule,args:[{imports:[a.CommonModule,s.MatIconModule,i.MatBottomSheetModule,n.MatDialogModule,l.MatButtonModule,d.SdButtonModule],declarations:[c,p,g,m,u,h,f,b],exports:[c,p,g,m,u,h,f,b],providers:[]}]}],t.SdBottomSheet=u,t.SdBottomSheetBody=f,t.SdBottomSheetFooter=b,t.SdBottomSheetHeader=h,t.SdModal=c,t.SdModalBody=g,t.SdModalFooter=m,t.SdModalHeader=p,t.SdModalModule=y,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=sd-angular-core-modal.umd.min.js.map