UNPKG

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

2 lines (1 loc) • 4.76 kB
import{a as B}from"./chunk-CQNLQN7A.js";import{c as Q}from"./chunk-BN33DLGQ.js";import"./chunk-SQBBDTZO.js";import"./chunk-KLZILXP3.js";import"./chunk-DCOXSL4B.js";import"./chunk-IDORGLM3.js";import"./chunk-VQDF6UGR.js";import"./chunk-OTFMRDKW.js";import"./chunk-3QQZQR3D.js";import"./chunk-TEXSADK3.js";import"./chunk-AN7C4JCR.js";import{c as N,d as z}from"./chunk-5ONGW7JF.js";import{j as F}from"./chunk-AN3YSLKY.js";import"./chunk-6J2GCUHA.js";import{b as K,f as j,j as L,v as A}from"./chunk-ICUC3WIE.js";import"./chunk-YA4NX3C4.js";import{b as W,c as $}from"./chunk-HFDIHHHN.js";import{a as T,g as R}from"./chunk-7JNYLOAK.js";import{$a as I,Bb as m,Cb as x,Da as d,Db as S,Hb as k,Ia as _,Ib as O,Jb as E,Rd as q,Xa as C,Ya as y,ab as M,ba as u,bb as v,ca as f,cb as r,db as l,jb as h,lb as g,nb as p,oc as V,rb as w,sb as b,tb as P,xa as a,zb as D}from"./chunk-KQUCMSSK.js";import"./chunk-FCVD6SGJ.js";import"./chunk-O7S4L63H.js";var G=["searchInput"],H=(n,s)=>s.label;function J(n,s){if(n&1){let e=h();r(0,"div",7),g("click",function(){let t=u(e).$implicit,o=p();return f(o.execute(t))}),r(1,"span",8),m(2),l(),r(3,"kbd",9),m(4),l()()}if(n&2){let e=s.$implicit,i=s.$index,t=p();D("p3xr-command-palette-item-active",i===t.selectedIndex),a(2),x(e.description),a(2),x(e.label)}}function X(n,s){if(n&1&&(r(0,"div",6),m(1),l()),n&2){let e,i=p();a(),S(" ",(e=i.strings().label)==null?null:e.noResults," ")}}var de=(()=>{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)(d(T),d(q),d(B))};static \u0275cmp=_({type:n,selectors:[["p3xr-command-palette-dialog"]],viewQuery:function(i,t){if(i&1&&w(G,5),i&2){let o;b(o=P())&&(t.searchInput=o.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 o=h();r(0,"div",1)(1,"div",2)(2,"mat-icon"),m(3,"search"),l(),r(4,"input",3,0),E("ngModelChange",function(c){return u(o),O(t.search,c)||(t.search=c),f(c)}),g("keydown",function(c){return t.onKeydown(c)}),l()(),r(6,"div",4),I(7,J,5,4,"div",5,H),C(9,X,2,1,"div",6),l()()}if(i&2){let o;a(4),k("ngModel",t.search),v("placeholder",(o=t.strings().label)==null?null:o.commandPalette),a(3),M(t.filtered),a(2),y(t.filtered.length===0?9:-1)}},dependencies:[V,A,K,j,L,R,Q,$,W,z,N,F],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}"]})}return n})();export{de as CommandPaletteDialogComponent};