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