Files
monisuo/monisuo-admin/dist/assets/appearance-EX9f5qtw.js
2026-03-22 23:32:23 +08:00

1 line
7.3 KiB
JavaScript

import{Ct as e,D as t,E as n,Et as r,N as i,Q as a,S as o,_ as s,b as c,d as l,g as u,nt as d,v as f,w as p,x as m,y as h,z as g}from"./vue.runtime.esm-bundler-DQjudA8G.js";import{a as _,i as v,n as y,r as b,t as x}from"./SelectContent-Bb2H68dj.js";import{t as S}from"./Spinner-BbvbfTgK.js";import{n as C}from"./lib-Cz3jviUu.js";import{p as w}from"./dist-t_U6YImb.js";import{n as T,r as E,t as D}from"./useMutation-Do6Zc9nc.js";import{f as O,s as k}from"./index-CcML0o3b.js";import"./Teleport-CLYBkdRb.js";import{n as A,t as j}from"./RadioGroupItem-DnFkEnO6.js";import{t as M}from"./SelectGroup-CFM1aDq9.js";import{t as N}from"./Separator-5drwYWrN.js";import{t as P}from"./Button-2mdP_ygs.js";import{i as F,n as I,o as L,r as R,s as z,t as B,u as V}from"./FormMessage-DO2c5bWz.js";import{t as H}from"./FormDescription-DwQJgDgd.js";import"./global-layout-BuXj6D-T.js";import{t as U}from"./settings-layout-DVMhlnCW.js";var W=O({theme:k([`light`,`dark`],{error:`Please select a theme.`}),font:k([`inter`,`manrope`,`system`],{error:`Please select a font.`})}),G=[{key:`appearance_config`,value:JSON.stringify({theme:`dark`,font:`inter`}),description:`Appearance configuration for the application, including theme color, border radius, and content layout.`}];function K(e,t=!0){return{data:e,extra:{},code:200,message:`success`,success:t}}function q(e){return T({queryKey:[`useGetSystemConfigByKeyQuery`,e],queryFn:async()=>{let t=await new Promise((t,n)=>{setTimeout(()=>{let r=G.find(t=>t.key===e);r||n(Error(`Config not found`)),t(r)},1e3)});if(!t)throw Error(`Config not found`);return K(t)}})}function J(e){let t=E();return D({mutationKey:[`useUpdateSystemConfigByKeyMutation`,e],mutationFn:async e=>await new Promise(t=>{setTimeout(()=>{t(K(e))},100)}),onSuccess:()=>{t.invalidateQueries({queryKey:[`useGetSystemConfigByKeyQuery`,e]})}})}function Y(){let e=E();return D({mutationKey:[`useCreateTaskMutation`],mutationFn:async e=>new Promise(t=>{setTimeout(()=>{t(K(e))},100)}),onSuccess:()=>{e.invalidateQueries({queryKey:[`useGetSystemConfigByKeyQuery`]})}})}function X({key:e,defaultValue:n,description:r,schema:i}){let o={...n},{handleSubmit:s,resetForm:c}=V({validationSchema:L(i),initialValues:o}),l=w(e,o),{data:d,isPending:f}=q(e),{mutate:p,isPending:m}=Y(),{mutate:h,isPending:g}=J(e),_=u(()=>m.value||g.value);return a(d,()=>{if(!f.value&&!d.value){l.value=d.value,p({key:e,description:r,value:JSON.stringify(n)},{onSuccess:()=>{l.value=o,C(`System config created with default value.`,{description:t(`pre`,{class:`mt-2 w-[340px] rounded-md bg-slate-950 p-4`},t(`code`,{class:`text-white`},JSON.stringify({key:e,description:r,value:n},null,2)))})}});return}let i=d.value?.data?.value?JSON.parse(d.value.data.value):o;l.value=i,c({values:{...i}})},{immediate:!0,deep:!0}),{isPending:_,isGetting:f,onSubmit:s(n=>{let i={key:e,value:n,description:r};l.value=n,h({...i,value:JSON.stringify(n)},{onSuccess:()=>{C(`You submitted the following values:`,{description:t(`pre`,{class:`mt-2 w-[340px] rounded-md bg-slate-950 p-4`},t(`code`,{class:`text-white`},JSON.stringify(i,null,2)))})}})})}}var Z={key:0},Q={class:`flex justify-start`},$=`appearance_config`,ee=`Customize the appearance of the app. Automatically switch between day and night themes.`,te=p({__name:`appearance-form`,setup(t){let{isGetting:a,isPending:u,onSubmit:p}=X({key:$,description:ee,defaultValue:{theme:`light`,font:`inter`},schema:W});return(t,C)=>{let w=y,T=b,E=F,D=v,O=M,k=x,L=_;return g(),c(l,null,[C[14]||=s(`div`,null,[s(`h3`,{class:`text-lg font-medium`},` Appearance `),s(`p`,{class:`text-sm text-muted-foreground`},` Customize the appearance of the app. Automatically switch between day and night themes. `)],-1),o(e(N),{class:`my-4`}),e(a)?(g(),c(`div`,Z,[o(e(P),{variant:`secondary`,disabled:``,size:`sm`},{default:d(()=>[o(e(S)),C[1]||=m(` Please wait `,-1)]),_:1})])):h(``,!0),e(a)?h(``,!0):(g(),c(`form`,{key:1,class:`space-y-8`,onSubmit:C[0]||=(...t)=>e(p)&&e(p)(...t)},[o(e(z),{name:`font`},{default:d(({componentField:t})=>[o(e(R),null,{default:d(()=>[o(e(I),null,{default:d(()=>[...C[2]||=[m(`Font`,-1)]]),_:1}),o(L,r(n(t)),{default:d(()=>[o(E,null,{default:d(()=>[o(T,null,{default:d(()=>[o(w,{placeholder:`Select a font`})]),_:1})]),_:1}),o(k,null,{default:d(()=>[o(O,null,{default:d(()=>[o(D,{value:`inter`},{default:d(()=>[...C[3]||=[m(` Inter `,-1)]]),_:1}),o(D,{value:`manrope`},{default:d(()=>[...C[4]||=[m(` Manrope `,-1)]]),_:1}),o(D,{value:`system`},{default:d(()=>[...C[5]||=[m(` System `,-1)]]),_:1})]),_:1})]),_:1})]),_:1},16),o(e(H),null,{default:d(()=>[...C[6]||=[m(` Set the font you want to use in the dashboard. `,-1)]]),_:1}),o(e(B))]),_:2},1024)]),_:1}),o(e(z),{type:`radio`,name:`theme`},{default:d(({componentField:t})=>[o(e(R),{class:`space-y-1`},{default:d(()=>[o(e(I),null,{default:d(()=>[...C[7]||=[m(`Theme`,-1)]]),_:1}),o(e(H),null,{default:d(()=>[...C[8]||=[m(` Select the theme for the dashboard. `,-1)]]),_:1}),o(e(B)),o(e(A),i({class:`grid max-w-md grid-cols-2 gap-8 pt-2`},t),{default:d(()=>[o(e(R),null,{default:d(()=>[o(e(I),{class:`[&:has([data-state=checked])>div]:border-primary flex flex-col`},{default:d(()=>[o(e(F),null,{default:d(()=>[o(e(j),{value:`light`,class:`sr-only`})]),_:1}),C[9]||=s(`div`,{class:`items-center p-1 border-2 rounded-md border-muted hover:border-accent`},[s(`div`,{class:`space-y-2 rounded-sm bg-[#ecedef] p-2`},[s(`div`,{class:`p-2 space-y-2 bg-white rounded-md shadow-xs`},[s(`div`,{class:`h-2 w-20 rounded-lg bg-[#ecedef]`}),s(`div`,{class:`h-2 w-[100px] rounded-lg bg-[#ecedef]`})]),s(`div`,{class:`flex items-center p-2 space-x-2 bg-white rounded-md shadow-xs`},[s(`div`,{class:`h-4 w-4 rounded-full bg-[#ecedef]`}),s(`div`,{class:`h-2 w-[100px] rounded-lg bg-[#ecedef]`})]),s(`div`,{class:`flex items-center p-2 space-x-2 bg-white rounded-md shadow-xs`},[s(`div`,{class:`h-4 w-4 rounded-full bg-[#ecedef]`}),s(`div`,{class:`h-2 w-[100px] rounded-lg bg-[#ecedef]`})])])],-1),C[10]||=s(`span`,{class:`block w-full p-2 font-normal text-center`},` Light `,-1)]),_:1})]),_:1}),o(e(R),null,{default:d(()=>[o(e(I),{class:`[&:has([data-state=checked])>div]:border-primary flex flex-col`},{default:d(()=>[o(e(F),null,{default:d(()=>[o(e(j),{value:`dark`,class:`sr-only`})]),_:1}),C[11]||=s(`div`,{class:`items-center p-1 border-2 rounded-md border-muted bg-popover hover:bg-accent hover:text-accent-foreground`},[s(`div`,{class:`p-2 space-y-2 rounded-sm bg-slate-950`},[s(`div`,{class:`p-2 space-y-2 rounded-md shadow-xs bg-slate-800`},[s(`div`,{class:`w-20 h-2 rounded-lg bg-slate-400`}),s(`div`,{class:`h-2 w-[100px] rounded-lg bg-slate-400`})]),s(`div`,{class:`flex items-center p-2 space-x-2 rounded-md shadow-xs bg-slate-800`},[s(`div`,{class:`size-4 rounded-full bg-slate-400`}),s(`div`,{class:`h-2 w-[100px] rounded-lg bg-slate-400`})]),s(`div`,{class:`flex items-center p-2 space-x-2 rounded-md shadow-xs bg-slate-800`},[s(`div`,{class:`size-4 rounded-full bg-slate-400`}),s(`div`,{class:`h-2 w-[100px] rounded-lg bg-slate-400`})])])],-1),C[12]||=s(`span`,{class:`block w-full p-2 font-normal text-center`},` Dark `,-1)]),_:1})]),_:1})]),_:1},16)]),_:2},1024)]),_:1}),s(`div`,Q,[o(e(P),{type:`submit`,disabled:e(u)},{default:d(()=>[e(u)?(g(),f(e(S),{key:0,size:`sm`})):h(``,!0),C[13]||=m(` Update preferences `,-1)]),_:1},8,[`disabled`])])],32))],64)}}}),ne=p({__name:`appearance`,setup(e){return(e,t)=>(g(),f(U,null,{default:d(()=>[o(te)]),_:1}))}});export{ne as default};