@pepperi/ngx-lib
Version:
Pepperi Angular Components and Services
3 lines (2 loc) • 8.15 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/platform-browser"),require("@angular/platform-browser/animations"),require("@angular/material/core"),require("@angular/material/button"),require("@angular/material/icon"),require("@angular/material/dialog"),require("@pepperi/ngx-lib"),require("@pepperi/ngx-lib/icon"),require("@angular/cdk/overlay"),require("@ngx-translate/core")):"function"==typeof define&&define.amd?define("@pepperi/ngx-lib/dialog",["exports","@angular/core","@angular/common","@angular/platform-browser","@angular/platform-browser/animations","@angular/material/core","@angular/material/button","@angular/material/icon","@angular/material/dialog","@pepperi/ngx-lib","@pepperi/ngx-lib/icon","@angular/cdk/overlay","@ngx-translate/core"],t):t(((e=e||self)["pepperi-addons"]=e["pepperi-addons"]||{},e["pepperi-addons"]["ngx-lib"]=e["pepperi-addons"]["ngx-lib"]||{},e["pepperi-addons"]["ngx-lib"].dialog={}),e.ng.core,e.ng.common,e.ng.platformBrowser,e.ng.platformBrowser.animations,e.ng.material.core,e.ng.material.button,e.ng.material.icon,e.ng.material.dialog,e["pepperi-addons"]["ngx-lib"],e["pepperi-addons"]["ngx-lib"].icon,e.ng.cdk.overlay,e.translate)}(this,(function(e,t,n,a,o,i,l,r,p,d,u,s,c){"use strict";function g(e,n){if(1&e&&(t.ɵɵelementStart(0,"span",9),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){var a=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵtextInterpolate(null==a.data?null:a.data.title)}}function m(e,n){if(1&e&&(t.ɵɵelementStart(0,"h2",5),t.ɵɵtemplate(1,g,2,1,"span",6),t.ɵɵelementStart(2,"button",7),t.ɵɵelementStart(3,"mat-icon"),t.ɵɵelement(4,"pep-icon",8),t.ɵɵelementEnd(),t.ɵɵelementEnd(),t.ɵɵelementEnd()),2&e){var a=t.ɵɵnextContext();t.ɵɵadvance(1),t.ɵɵproperty("ngIf",null==a.data||null==a.data.title?null:a.data.title.length),t.ɵɵadvance(1),t.ɵɵproperty("mat-dialog-close",null)}}function f(e,n){if(1&e&&(t.ɵɵelement(0,"span",10),t.ɵɵpipe(1,"safeHtml")),2&e){var a=t.ɵɵnextContext();t.ɵɵproperty("innerHtml",t.ɵɵpipeBind1(1,1,null==a.data?null:a.data.content),t.ɵɵsanitizeHtml)}}function h(e,n){if(1&e){var a=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"textarea",11),t.ɵɵlistener("blur",(function(e){return t.ɵɵrestoreView(a),t.ɵɵnextContext().updateContent(e)})),t.ɵɵtext(1),t.ɵɵelementEnd()}if(2&e){var o=t.ɵɵnextContext();t.ɵɵproperty("readonly",null==o.data||null==o.data.contentData?null:o.data.contentData.disabled)("name",null==o.data||null==o.data.contentData?null:o.data.contentData.key),t.ɵɵadvance(1),t.ɵɵtextInterpolate(null==o.data?null:o.data.content)}}function v(e,n){if(1&e){var a=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12),t.ɵɵelementStart(1,"div",13),t.ɵɵelementStart(2,"button",14),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(a),t.ɵɵnextContext().save()})),t.ɵɵtext(3),t.ɵɵpipe(4,"translate"),t.ɵɵelementEnd(),t.ɵɵelementStart(5,"button",15),t.ɵɵtext(6),t.ɵɵpipe(7,"translate"),t.ɵɵelementEnd(),t.ɵɵelementEnd(),t.ɵɵelementEnd()}2&e&&(t.ɵɵadvance(3),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(4,3,"ACTIONS.SAVE")," "),t.ɵɵadvance(2),t.ɵɵproperty("mat-dialog-close",null),t.ɵɵadvance(1),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,5,"ACTIONS.CANCEL")," "))}var y;(y=e.DialogDataType||(e.DialogDataType={}))[y.Text=0]="Text",y[y.TextArea=1]="TextArea",y[y.Html=2]="Html",y[y.Iframe=3]="Iframe";var x=function(t){this.title="",this.contentType=e.DialogDataType.Text,this.showHeader=!0,this.showFooter=!1,this.title=t.title||"",this.content=t.content||"",this.contentType=t.contentType,this.contentData=t.contentData||{},this.showHeader=void 0===t.showHeader||t.showHeader,this.showFooter=void 0===t.showFooter||t.showFooter},D=function(){function e(e,t,n){this.dialog=e,this.layoutService=t,this.overlay=n}return e.prototype.getDialogConfig=function(e){void 0===e&&(e={});var t=new p.MatDialogConfig;return t.autoFocus=!1,t.direction=this.layoutService.isRtl()?"rtl":"ltr",t.disableClose=e.disableClose||!1,t.height=e.height||"auto",t.maxWidth=e.maxWidth||"100vw",t.maxHeight=e.maxHeight||"100vh",t.minWidth=e.minWidth||"0",t.panelClass=["pepperi-dialog",e.panelClass||""],t.scrollStrategy=this.overlay.scrollStrategies.noop(),t},e.prototype.openDefaultDialog=function(e,t){return void 0===t&&(t=null),t||(t=this.getDialogConfig()),t.data=e,this.dialog.open(b,t)},e.prototype.openDialog=function(e,t,n){return void 0===t&&(t={}),void 0===n&&(n=null),n||(n=this.getDialogConfig()),n.data=t,this.dialog.open(e,n)},e}();D.ɵfac=function(e){return new(e||D)(t.ɵɵinject(p.MatDialog),t.ɵɵinject(d.LayoutService),t.ɵɵinject(s.Overlay))},D.ɵprov=t.ɵɵdefineInjectable({token:D,factory:D.ɵfac,providedIn:"root"});var b=function(){function t(t,n){this.data=t,this.dialogRef=n,this.DialogDataType=e.DialogDataType}return t.prototype.save=function(){this.dialogRef.close(this.data?this.data.content:"")},t.prototype.updateContent=function(e){this.data.content=e.target?e.target.value:e.currentTarget?e.currentTarget.value:""},t}();b.ɵfac=function(e){return new(e||b)(t.ɵɵdirectiveInject(p.MAT_DIALOG_DATA),t.ɵɵdirectiveInject(p.MatDialogRef))},b.ɵcmp=t.ɵɵdefineComponent({type:b,selectors:[["ng-component"]],decls:5,vars:4,consts:[["mat-dialog-title","","class","pepperi-border-bottom",4,"ngIf"],["mat-dialog-content",""],[3,"innerHtml",4,"ngIf"],[3,"readonly","name","blur",4,"ngIf"],["mat-dialog-actions","","class","pepperi-border-top",4,"ngIf"],["mat-dialog-title","",1,"pepperi-border-bottom"],["class","pull-left flip",4,"ngIf"],["mat-button","",1,"pepperi-button","icon-button","md","weak","pull-right","flip",3,"mat-dialog-close"],["name","system_close"],[1,"pull-left","flip"],[3,"innerHtml"],[3,"readonly","name","blur"],["mat-dialog-actions","",1,"pepperi-border-top"],[1,"spacing-element-negative"],["mat-button","",1,"spacing-element","pepperi-button","md","strong","pull-right","flip",3,"click"],["mat-button","",1,"spacing-element","pepperi-button","md","weak","pull-right","flip",3,"mat-dialog-close"]],template:function(e,n){1&e&&(t.ɵɵtemplate(0,m,5,2,"h2",0),t.ɵɵelementStart(1,"div",1),t.ɵɵtemplate(2,f,2,3,"span",2),t.ɵɵtemplate(3,h,2,3,"textarea",3),t.ɵɵelementEnd(),t.ɵɵtemplate(4,v,8,7,"div",4)),2&e&&(t.ɵɵproperty("ngIf",null==n.data?null:n.data.showHeader),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(null==n.data?null:n.data.contentType)===n.DialogDataType.Text||(null==n.data?null:n.data.contentType)===n.DialogDataType.Html),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",(null==n.data?null:n.data.contentType)===n.DialogDataType.TextArea),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",null==n.data?null:n.data.showFooter))},directives:[n.NgIf,p.MatDialogContent,p.MatDialogTitle,l.MatButton,p.MatDialogClose,r.MatIcon,u.PepperiIconComponent,p.MatDialogActions],pipes:[d.SafeHtmlPipe,c.TranslatePipe],styles:[".mat-dialog-content{padding:0!important}.mat-dialog-content span{padding:var(--pep-spacing-md,.75rem) 0;width:100%}.mat-dialog-content textarea{border:none;height:13rem;padding:var(--pep-spacing-lg,1rem) var(--pep-spacing-sm,.5rem);resize:none;width:25rem}.mat-dialog-content textarea:focus{outline:none}"],encapsulation:2});var M=function(e){this.pepperiIconRegistry=e,this.pepperiIconRegistry.registerIcons([u.pepperiIconSystemClose])};M.ɵmod=t.ɵɵdefineNgModule({type:M}),M.ɵinj=t.ɵɵdefineInjector({factory:function(e){return new(e||M)(t.ɵɵinject(u.PepperiIconRegistry))},imports:[[n.CommonModule,a.BrowserModule,o.BrowserAnimationsModule,i.MatCommonModule,l.MatButtonModule,r.MatIconModule,p.MatDialogModule,d.PepperiModule,u.PepperiIconModule]]}),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(M,{declarations:[b],imports:[n.CommonModule,a.BrowserModule,o.BrowserAnimationsModule,i.MatCommonModule,l.MatButtonModule,r.MatIconModule,p.MatDialogModule,d.PepperiModule,u.PepperiIconModule]}),e.DialogData=x,e.DialogService=D,e.PepperiDefaultDialogComponent=b,e.PepperiDialogModule=M,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=pepperi-addons-ngx-lib-dialog.umd.min.js.map