UNPKG

p3x-redis-ui-material

Version:

💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io

1 lines 9.32 kB
"use strict";(self.webpackChunkp3x_redis_ui_material=self.webpackChunkp3x_redis_ui_material||[]).push([[4404],{628(t,i,e){e.d(i,{m:()=>g});var n=e(11228),o=e(24698),a=e(63924),s=e(30943),r=e(33825),l=e(46256),c=e(90870),h=e(23232),d=e(51218),p=e(34503);function m(t,i){if(1&t&&(d.j41(0,"span"),d.EFF(1),d.k0s()),2&t){const t=d.XpG();d.R7$(),d.JRh(t.label)}}class g{breakpointObserver;i18n;cdr;label="";icon="cancel";cancel=new o.bkB;isWide=!0;constructor(t,i,e){this.breakpointObserver=t,this.i18n=i,this.cdr=e,this.breakpointObserver.observe("(min-width: 600px)").subscribe((t=>{this.isWide=t.matches,this.cdr.markForCheck()}))}ngOnInit(){this.label||(this.label=this.i18n.strings().intention?.cancel||"Cancel")}static ɵfac=function(t){return new(t||g)(d.rXU(c.Q),d.rXU(h.W),d.rXU(n.gRc))};static ɵcmp=d.VBU({type:g,selectors:[["p3xr-dialog-cancel"]],inputs:{label:"label",icon:"icon"},outputs:{cancel:"cancel"},decls:4,vars:5,consts:[["mat-raised-button","","type","button",1,"btn-warn",3,"click","matTooltip","matTooltipDisabled"]],template:function(t,i){1&t&&(d.j41(0,"button",0),d.bIt("click",(function(){return i.cancel.emit()})),d.j41(1,"mat-icon"),d.EFF(2),d.k0s(),d.nVh(3,m,2,1,"span"),d.k0s()),2&t&&(d.Y8G("matTooltip",i.label)("matTooltipDisabled",i.isWide),d.BMQ("aria-label",i.label),d.R7$(2),d.JRh(i.icon),d.R7$(),d.vxM(i.isWide?3:-1))},dependencies:[a.MD,s.Hl,s.$z,r.m_,r.An,l.uc,p.oV],encapsulation:2})}},62178(t,i,e){e.d(i,{JsonEditorDialogComponent:()=>j});var n=e(63924),o=e(64961),a=e(30943),s=e(33825),r=e(66608),l=e(46256),c=e(90870),h=e(23232),d=e(95477),p=e(77385),m=e(628),g=e(51218),u=e(24698),b=e(65209),w=e(34503),k=e(12027);const f=["editorContainer"];function v(t,i){if(1&t&&(g.j41(0,"mat-dialog-content",11),g.nrm(1,"div",12,0),g.k0s()),2&t){const t=g.XpG();g.xc7("height",t.minHeight)}}function x(t,i){if(1&t&&(g.j41(0,"mat-dialog-content",5),g.EFF(1),g.k0s()),2&t){let t;const i=g.XpG();g.R7$(),g.SpI(" ",(null==(t=i.strings().label)?null:t.jsonViewNotParsable)||"Not valid JSON"," ")}}function y(t,i){if(1&t){const t=g.RV6();g.j41(0,"button",13),g.bIt("click",(function(){u.eBV(t);const i=g.XpG(2);return u.Njj(i.save(!0))})),g.j41(1,"mat-icon"),g.EFF(2,"save"),g.k0s(),g.j41(3,"mat-icon"),g.EFF(4,"format_line_spacing"),g.k0s(),g.j41(5,"span",8),g.EFF(6),g.k0s()()}if(2&t){let t,i;const e=g.XpG(2);g.Y8G("matTooltip",(null==(t=e.strings().intention)?null:t.saveWithFormatJson)||"Save Formatted"),g.R7$(6),g.JRh((null==(i=e.strings().intention)?null:i.saveWithFormatJson)||"Save Formatted")}}function F(t,i){if(1&t){const t=g.RV6();g.j41(0,"button",13),g.bIt("click",(function(){u.eBV(t);const i=g.XpG();return u.Njj(i.save(!1))})),g.j41(1,"mat-icon"),g.EFF(2,"save"),g.k0s(),g.j41(3,"span",8),g.EFF(4),g.k0s()(),g.nVh(5,y,7,2,"button",14)}if(2&t){let t,i;const e=g.XpG();g.Y8G("matTooltip",(null==(t=e.strings().intention)?null:t.save)||"Save"),g.R7$(4),g.JRh((null==(i=e.strings().intention)?null:i.save)||"Save"),g.R7$(),g.vxM(e.hideFormatSave?-1:5)}}class j{dialogRef;data;i18n;theme;common;breakpointObserver;editorContainer;isJson=!1;isReadonly=!1;hideFormatSave=!1;lineWrap=!0;minHeight="400px";strings;editorView;wrapCompartment;EditorViewClass;obj;resizeHandler;constructor(t,i,e,n,o,a){this.dialogRef=t,this.data=i,this.i18n=e,this.theme=n,this.common=o,this.breakpointObserver=a,this.strings=this.i18n.strings}ngOnInit(){try{this.obj=JSON.parse(this.data.value),this.isJson=!0}catch(t){this.obj=void 0,this.isJson=!1}this.isReadonly=!0===k?.state?.connection?.readonly,this.hideFormatSave=!0===this.data.hideFormatSave,this.updateMinHeight()}async ngAfterViewInit(){if(!this.isJson||!this.editorContainer)return;const{EditorView:t,keymap:i,lineNumbers:n,highlightActiveLineGutter:o,highlightSpecialChars:a,drawSelection:s,highlightActiveLine:r,rectangularSelection:l,crosshairCursor:c}=await Promise.all([e.e(8313),e.e(221)]).then(e.bind(e,43599)),{EditorState:h,Compartment:d}=await e.e(8313).then(e.bind(e,41762));this.wrapCompartment=new d;const{json:p}=await Promise.all([e.e(8313),e.e(221),e.e(9668),e.e(4561)]).then(e.bind(e,70549)),{defaultKeymap:m,history:g,historyKeymap:u}=await Promise.all([e.e(8313),e.e(221),e.e(9668),e.e(3180)]).then(e.bind(e,380)),{bracketMatching:b,foldGutter:w,foldKeymap:f,indentOnInput:v,syntaxHighlighting:x,defaultHighlightStyle:y}=await Promise.all([e.e(8313),e.e(221),e.e(9668)]).then(e.bind(e,22828)),{closeBrackets:F,closeBracketsKeymap:j}=await Promise.all([e.e(8313),e.e(221),e.e(9668),e.e(1178)]).then(e.bind(e,52478)),{searchKeymap:C,highlightSelectionMatches:R}=await Promise.all([e.e(8313),e.e(221),e.e(2730)]).then(e.bind(e,45106)),{lintKeymap:V}=await Promise.all([e.e(8313),e.e(221),e.e(7189)]).then(e.bind(e,46541));let E;if(this.theme.isDark()){const{oneDark:t}=await Promise.all([e.e(8313),e.e(221),e.e(9668),e.e(5334)]).then(e.bind(e,61115));E=t}else{const{githubLight:t}=await Promise.all([e.e(8313),e.e(221),e.e(9668),e.e(1350)]).then(e.bind(e,21932));E=t}const O=JSON.stringify(this.obj,null,k?.settings?.jsonFormat??2);this.EditorViewClass=t,this.editorView=new t({state:h.create({doc:O,extensions:[n(),o(),a(),g(),w(),s(),v(),x(y,{fallback:!0}),b(),F(),l(),c(),r(),R(),i.of([...j,...m,...C,...u,...f,...V]),p(),E,t.theme({".cm-scroller":{"overflow-x":"scroll","scrollbar-width":"auto"},".cm-scroller::-webkit-scrollbar":{height:"12px",display:"block"},".cm-scroller::-webkit-scrollbar-track":{background:"rgba(128, 128, 128, 0.1)"},".cm-scroller::-webkit-scrollbar-thumb":{background:"rgba(128, 128, 128, 0.4)","border-radius":"6px"},".cm-scroller::-webkit-scrollbar-thumb:hover":{background:"rgba(128, 128, 128, 0.6)"}}),this.wrapCompartment.of(this.lineWrap?t.lineWrapping:[]),h.readOnly.of(this.isReadonly)]}),parent:this.editorContainer.nativeElement}),this.resizeHandler=()=>{this.updateMinHeight()},window.addEventListener("resize",this.resizeHandler)}ngOnDestroy(){this.resizeHandler&&window.removeEventListener("resize",this.resizeHandler),this.editorView&&(this.editorView.destroy(),this.editorView=void 0)}toggleWrap(){this.lineWrap=!this.lineWrap,this.editorView&&this.wrapCompartment&&this.EditorViewClass&&this.editorView.dispatch({effects:this.wrapCompartment.reconfigure(this.lineWrap?this.EditorViewClass.lineWrapping:[])})}save(t){try{const i=this.editorView.state.doc.toString(),e=JSON.parse(i),n=JSON.stringify(e,null,t?k?.settings?.jsonFormat??2:0);this.dialogRef.close({obj:n})}catch(t){this.common.generalHandleError(t)}}close(){this.dialogRef.close(void 0)}updateMinHeight(){const t=this.breakpointObserver.isMatched("(max-width: 959px)");this.minHeight=t?"100%":`${Math.max(10,window.innerHeight-100)}px`}static ɵfac=function(t){return new(t||j)(g.rXU(o.CP),g.rXU(o.Vh),g.rXU(h.W),g.rXU(d.F),g.rXU(p.h),g.rXU(c.Q))};static ɵcmp=g.VBU({type:j,selectors:[["p3xr-json-editor-dialog"]],viewQuery:function(t,i){if(1&t&&g.GBs(f,5),2&t){let t;g.mGM(t=g.lsd())&&(i.editorContainer=t.first)}},decls:20,vars:5,consts:[["editorContainer",""],[1,"p3xr-dialog-toolbar","p3xr-mat-layout-strong"],["mat-dialog-title","",1,"p3xr-dialog-title","p3xr-dialog-title-with-icon"],["mat-icon-button","",3,"click"],[1,"p3xr-dialog-content","p3xr-dialog-content-mono","p3xr-dialog-content-editor",3,"height"],[1,"p3xr-dialog-content","p3xr-dialog-content-mono","p3xr-dialog-content-message"],[1,"p3xr-dialog-actions"],["mat-raised-button","","type","button",1,"btn-accent",3,"click"],[1,"hide-sm"],[2,"flex","1"],[3,"cancel"],[1,"p3xr-dialog-content","p3xr-dialog-content-mono","p3xr-dialog-content-editor"],[1,"p3xr-codemirror-host"],["mat-raised-button","","type","button",1,"btn-primary",3,"click","matTooltip"],["mat-raised-button","","type","button",1,"btn-primary",3,"matTooltip"]],template:function(t,i){if(1&t&&(g.j41(0,"mat-toolbar",1)(1,"span",2)(2,"mat-icon"),g.EFF(3,"edit"),g.k0s(),g.j41(4,"span"),g.EFF(5),g.k0s()(),g.j41(6,"button",3),g.bIt("click",(function(){return i.close()})),g.j41(7,"mat-icon"),g.EFF(8,"close"),g.k0s()()(),g.nVh(9,v,3,2,"mat-dialog-content",4)(10,x,2,1,"mat-dialog-content",5),g.j41(11,"mat-dialog-actions",6)(12,"button",7),g.bIt("click",(function(){return i.toggleWrap()})),g.j41(13,"mat-icon"),g.EFF(14),g.k0s(),g.j41(15,"span",8),g.EFF(16),g.k0s()(),g.nrm(17,"span",9),g.j41(18,"p3xr-dialog-cancel",10),g.bIt("cancel",(function(){return i.close()})),g.k0s(),g.nVh(19,F,6,3),g.k0s()),2&t){let t,e;g.R7$(5),g.JRh((null==(t=i.strings().intention)?null:t.jsonViewEditor)||"JSON Editor"),g.R7$(4),g.vxM(i.isJson?9:10),g.R7$(5),g.JRh(i.lineWrap?"wrap_text":"notes"),g.R7$(2),g.JRh(i.lineWrap?(null==(e=i.strings().intention)?null:e.unwrap)||"Unwrap":(null==(e=i.strings().intention)?null:e.wrap)||"Wrap"),g.R7$(3),g.vxM(i.isJson&&!i.isReadonly?19:-1)}},dependencies:[n.MD,o.hM,o.BI,o.E7,o.Yi,a.Hl,a.$z,b.iY,s.m_,s.An,r.s5,r.KQ,l.uc,w.oV,m.m],styles:[".hide-sm[_ngcontent-%COMP%] { display: inline; }\n .p3xr-dialog-content-editor[_ngcontent-%COMP%] { padding: 0 !important; overflow: hidden !important; }\n .p3xr-dialog-content-message[_ngcontent-%COMP%] { min-height: 320px; }\n .p3xr-codemirror-host[_ngcontent-%COMP%] { height: 100%; min-height: inherit; }\n .p3xr-codemirror-host[_ngcontent-%COMP%] .cm-editor[_ngcontent-%COMP%] { height: 100%; }\n @media (max-width: 959px) { .hide-sm[_ngcontent-%COMP%] { display: none; } }"]})}}}]);