p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
1 lines • 4.3 kB
JavaScript
import {X as Xe,cV as z,f as fQ,D,_ as _e,m as mb,aJ as jn,cj as He,bd as On,be as tn,cW as zt,Y as Yt,y as yt,w as wt,ck as Ve,cl as Be,bc as Ut,x as YT,B as Ba,I as IS,v as vf,cr as Lv,k as bv,bj as Mx,H as HT,n as no,c as In,cs as Fv,p as pv,bk as Nx,U as UT,r as ro,a$ as rc,b0 as Df,b1 as Ef,J as JT,o as mt,R as Rv,t as If,z as fm,A as pm,cu as AS}from'./chunk-BwlFOdbx.js';import'./main-HNF44SV3.js';var J=["searchInput"],X=(n,s)=>s.label;function Y(n,s){if(n&1){let e=YT();Ba(0,"div",7),bv("click",function(){let t=fm(e).$implicit,l=JT();return pm(l.execute(t))}),Ba(1,"span",8),IS(2),vf(),Ba(3,"kbd",9),IS(4),vf()();}if(n&2){let e=s.$implicit,i=s.$index,t=JT();mt("p3xr-command-palette-item-active",i===t.selectedIndex),In(2),Rv(e.description),In(2),Rv(e.label);}}function Z(n,s){if(n&1&&(Ba(0,"div",6),IS(1),vf()),n&2){let e=JT();In(),If(" ",e.strings().label?.noResults," ");}}var he=(()=>{class n{dialogRef;i18n;shortcutsService;searchInput;search="";selectedIndex=0;strings;allItems=[];filtered=[];constructor(e,i,t){this.dialogRef=e,this.i18n=i,this.shortcutsService=t,this.strings=this.i18n.strings;}ngOnInit(){let e=this.strings(),i=new Set;this.allItems=[];for(let t of this.shortcutsService.getShortcuts())i.has(t.descriptionKey)||(i.add(t.descriptionKey),this.allItems.push({label:t.label,description:e?.label?.[t.descriptionKey]||t.descriptionKey,shortcut:t}));this.filtered=[...this.allItems];}ngAfterViewInit(){setTimeout(()=>this.searchInput?.nativeElement?.focus(),50);}onKeydown(e){e.key==="ArrowDown"?(e.preventDefault(),this.selectedIndex=Math.min(this.selectedIndex+1,this.filtered.length-1)):e.key==="ArrowUp"?(e.preventDefault(),this.selectedIndex=Math.max(this.selectedIndex-1,0)):e.key==="Enter"?(e.preventDefault(),this.filtered[this.selectedIndex]&&this.execute(this.filtered[this.selectedIndex])):e.key==="Escape"?this.dialogRef.close():this.filter();}filter(){let e=this.search.toLowerCase().trim();this.filtered=e?this.allItems.filter(i=>i.description.toLowerCase().includes(e)||i.label.toLowerCase().includes(e)):[...this.allItems],this.selectedIndex=0;}execute(e){this.dialogRef.close(),e.shortcut.action();}static \u0275fac=function(i){return new(i||n)(Xe(z),Xe(fQ),Xe(D))};static \u0275cmp=_e({type:n,selectors:[["p3xr-command-palette-dialog"]],viewQuery:function(i,t){if(i&1&&rc(J,5),i&2){let l;Df(l=Ef())&&(t.searchInput=l.first);}},decls:10,vars:3,consts:[["searchInput",""],[1,"p3xr-command-palette"],[1,"p3xr-command-palette-search"],["matInput","","autocomplete","off",3,"ngModelChange","keydown","ngModel","placeholder"],[1,"p3xr-command-palette-list"],[1,"p3xr-command-palette-item",3,"p3xr-command-palette-item-active"],[1,"p3xr-command-palette-empty"],[1,"p3xr-command-palette-item",3,"click"],[1,"p3xr-command-palette-desc"],[1,"p3xr-kbd"]],template:function(i,t){if(i&1){let l=YT();Ba(0,"div",1)(1,"div",2)(2,"mat-icon"),IS(3,"search"),vf(),Ba(4,"input",3,0),Lv("ngModelChange",function(c){return fm(l),AS(t.search,c)||(t.search=c),pm(c)}),bv("keydown",function(c){return t.onKeydown(c)}),vf(),Mx(),vf(),Ba(6,"div",4),HT(7,Y,5,4,"div",5,X),no(9,Z,2,1,"div",6),vf()();}i&2&&(In(4),Fv("ngModel",t.search),pv("placeholder",t.strings().label?.commandPalette),Nx(),In(3),UT(t.filtered),In(2),ro(t.filtered.length===0?9:-1));},dependencies:[mb,jn,He,On,tn,zt,Yt,yt,wt,Ve,Be,Ut],styles:[".p3xr-command-palette[_ngcontent-%COMP%]{width:100%;min-width:400px}.p3xr-command-palette-search[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--p3xr-list-border, rgba(0,0,0,.12))}.p3xr-command-palette-search[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent;color:inherit;font-size:16px;font-family:inherit}.p3xr-command-palette-list[_ngcontent-%COMP%]{max-height:300px;overflow-y:auto}.p3xr-command-palette-item[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;cursor:pointer}.p3xr-command-palette-item[_ngcontent-%COMP%]:hover, .p3xr-command-palette-item-active[_ngcontent-%COMP%]{background:var(--p3xr-hover-bg, rgba(0,0,0,.04))}.p3xr-command-palette-empty[_ngcontent-%COMP%]{padding:16px;text-align:center;opacity:.5}"],changeDetection:1})}return n})();export{he as CommandPaletteDialogComponent};