UNPKG

@pepperi/lib

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.

2 lines 8 kB
!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/lib"),require("@pepperi/lib/icon"),require("@angular/cdk/overlay"),require("@ngx-translate/core")):"function"==typeof define&&define.amd?define("@pepperi/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/lib","@pepperi/lib/icon","@angular/cdk/overlay","@ngx-translate/core"],t):t(((e=e||self).pepperi=e.pepperi||{},e.pepperi.lib=e.pepperi.lib||{},e.pepperi.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.lib,e.pepperi.lib.icon,e.ng.cdk.overlay,e.translate)}(this,(function(e,t,a,n,o,i,l,r,p,d,u,c,s){"use strict";function g(e,a){if(1&e&&(t.ɵɵelementStart(0,"span",9),t.ɵɵtext(1),t.ɵɵelementEnd()),2&e){var n=t.ɵɵnextContext(2);t.ɵɵadvance(1),t.ɵɵtextInterpolate(null==n.data?null:n.data.title)}}function m(e,a){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 n=t.ɵɵnextContext();t.ɵɵadvance(1),t.ɵɵproperty("ngIf",null==n.data||null==n.data.title?null:n.data.title.length),t.ɵɵadvance(1),t.ɵɵproperty("mat-dialog-close",null)}}function f(e,a){if(1&e&&(t.ɵɵelement(0,"span",10),t.ɵɵpipe(1,"safeHtml")),2&e){var n=t.ɵɵnextContext();t.ɵɵproperty("innerHtml",t.ɵɵpipeBind1(1,1,null==n.data?null:n.data.content),t.ɵɵsanitizeHtml)}}function h(e,a){if(1&e){var n=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"textarea",11),t.ɵɵlistener("blur",(function(e){return t.ɵɵrestoreView(n),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,a){if(1&e){var n=t.ɵɵgetCurrentView();t.ɵɵelementStart(0,"div",12),t.ɵɵelementStart(1,"div",13),t.ɵɵelementStart(2,"button",14),t.ɵɵlistener("click",(function(){return t.ɵɵrestoreView(n),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,"Save")," "),t.ɵɵadvance(2),t.ɵɵproperty("mat-dialog-close",null),t.ɵɵadvance(1),t.ɵɵtextInterpolate1(" ",t.ɵɵpipeBind1(7,5,"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 D=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},b=function(){function e(e,t,a){this.dialog=e,this.layoutService=t,this.overlay=a}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(M,t)},e.prototype.openDialog=function(e,t,a){return void 0===t&&(t={}),void 0===a&&(a=null),a||(a=this.getDialogConfig()),a.data=t,this.dialog.open(e,a)},e}();b.ɵfac=function(e){return new(e||b)(t.ɵɵinject(p.MatDialog),t.ɵɵinject(d.LayoutService),t.ɵɵinject(c.Overlay))},b.ɵprov=t.ɵɵdefineInjectable({token:b,factory:b.ɵfac,providedIn:"root"});var M=function(){function t(t,a){this.data=t,this.dialogRef=a,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}();M.ɵfac=function(e){return new(e||M)(t.ɵɵdirectiveInject(p.MAT_DIALOG_DATA),t.ɵɵdirectiveInject(p.MatDialogRef))},M.ɵcmp=t.ɵɵdefineComponent({type:M,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,a){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==a.data?null:a.data.showHeader),t.ɵɵadvance(2),t.ɵɵproperty("ngIf",(null==a.data?null:a.data.contentType)===a.DialogDataType.Text||(null==a.data?null:a.data.contentType)===a.DialogDataType.Html),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",(null==a.data?null:a.data.contentType)===a.DialogDataType.TextArea),t.ɵɵadvance(1),t.ɵɵproperty("ngIf",null==a.data?null:a.data.showFooter))},directives:[a.NgIf,p.MatDialogContent,p.MatDialogTitle,l.MatButton,p.MatDialogClose,r.MatIcon,u.PepperiIconComponent,p.MatDialogActions],pipes:[d.SafeHtmlPipe,s.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 x=function(e){this.pepperiIconRegistry=e,this.pepperiIconRegistry.registerIcons([u.pepperiIconSystemClose])};x.ɵmod=t.ɵɵdefineNgModule({type:x}),x.ɵinj=t.ɵɵdefineInjector({factory:function(e){return new(e||x)(t.ɵɵinject(u.PepperiIconRegistry))},imports:[[a.CommonModule,n.BrowserModule,o.BrowserAnimationsModule,i.MatCommonModule,l.MatButtonModule,r.MatIconModule,p.MatDialogModule,d.PepperiModule,u.PepperiIconModule]]}),("undefined"==typeof ngJitMode||ngJitMode)&&t.ɵɵsetNgModuleScope(x,{declarations:[M],imports:[a.CommonModule,n.BrowserModule,o.BrowserAnimationsModule,i.MatCommonModule,l.MatButtonModule,r.MatIconModule,p.MatDialogModule,d.PepperiModule,u.PepperiIconModule]}),e.DialogData=D,e.DialogService=b,e.PepperiDefaultDialogComponent=M,e.PepperiDialogModule=x,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=pepperi-lib-dialog.umd.min.js.map