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 • 2.84 kB
JavaScript
import{A as e,C as t,D as n,E as r,J as i,M as a,R as o,T as s,Yt as c,ht as l,it as u,k as d,nt as f,o as p,t as m,w as h}from"./i18n.store-B4krJCIS.js";import{o as g,x as _}from"./_plugin-vue_export-helper-67n0yneU.js";import{t as v}from"./VTooltip-UUcBbF8q.js";import{o as y,r as b}from"./index-CBO402jT.js";import{r as x}from"./JsonEditorDialog-CdnlZOlI.js";var S={key:0,style:{"min-height":`200px`,"max-height":`70vh`,overflow:`auto`}},C={key:1},w=a({__name:`JsonViewDialog`,props:{open:{type:Boolean},value:{}},emits:[`close`],setup(a,{emit:w}){function T(e,t){if(t===null)return{key:e,value:null,type:`null`};if(Array.isArray(t)){let n=t.map((e,t)=>T(String(t),e));return{key:e,value:t,type:`array`,children:n,childCount:n.length}}if(typeof t==`object`){let n=Object.keys(t).map(e=>T(e,t[e]));return{key:e,value:t,type:`object`,children:n,childCount:n.length}}return{key:e,value:t,type:typeof t}}let E=a,D=w,O=m(),k=t(()=>O.strings),{themeKey:A}=p(y()),j=t(()=>[`dark`,`darkNeu`,`darkoBluo`,`matrix`].includes(A.value)),M=l(new Set),N=t(()=>k.value?.label?.tree??`root`),P=t(()=>{try{let e=JSON.parse(E.value);return{isJson:!0,tree:T(N.value,e)}}catch{return{isJson:!1,tree:null}}});f(()=>E.open,e=>{e&&P.value.isJson&&(M.value=new Set([`0-${N.value}`]))});function F(e){let t=new Set(M.value);t.has(e)?t.delete(e):t.add(e),M.value=t}function I(){if(!P.value.tree)return;let e=new Set,t=(n,r)=>{let i=`${r}-${n.key}`;(n.type===`object`||n.type===`array`)&&(e.add(i),n.children?.forEach(e=>t(e,r+1)))};t(P.value.tree,0),M.value=e}function L(){M.value=new Set([`0-${N.value}`])}return(t,l)=>a.open?(i(),s(b,{key:0,open:!0,title:k.value?.intention?.jsonViewShow,onClose:l[1]||=e=>D(`close`)},{headerActions:u(()=>[e(v,{text:k.value?.page?.treeControls?.expandAll,location:`top`},{activator:u(({props:t})=>[e(g,o(t,{icon:``,variant:`text`,color:`inherit`,size:`small`,onClick:I}),{default:u(()=>[e(_,{size:`small`},{default:u(()=>[...l[2]||=[d(`mdi-chevron-down`,-1)]]),_:1})]),_:1},16)]),_:1},8,[`text`]),e(v,{text:k.value?.page?.treeControls?.collapseAll,location:`top`},{activator:u(({props:t})=>[e(g,o(t,{icon:``,variant:`text`,color:`inherit`,size:`small`,onClick:L}),{default:u(()=>[e(_,{size:`small`},{default:u(()=>[...l[3]||=[d(`mdi-chevron-up`,-1)]]),_:1})]),_:1},16)]),_:1},8,[`text`])]),actions:u(()=>[e(g,{variant:`flat`,color:`secondary`,size:`small`,onClick:l[0]||=e=>D(`close`)},{default:u(()=>[e(_,{class:`mr-1`},{default:u(()=>[...l[4]||=[d(`mdi-close`,-1)]]),_:1}),h(`span`,null,c(k.value?.intention?.close),1)]),_:1})]),default:u(()=>[P.value.isJson&&P.value.tree?(i(),n(`div`,S,[e(x,{node:P.value.tree,level:0,"expanded-keys":M.value,"is-dark":j.value,onToggle:F},null,8,[`node`,`expanded-keys`,`is-dark`])])):(i(),n(`div`,C,c(k.value?.label?.jsonViewNotParsable),1))]),_:1},8,[`title`])):r(``,!0)}});export{w as t};