1 line
7.5 KiB
JavaScript
1 line
7.5 KiB
JavaScript
|
|
import{A as e,C as t,I as n,J as r,Q as i,St as a,_ as o,b as s,g as c,h as l,l as u,m as d,v as f,w as p,x as m,y as h,yt as g,z as _}from"./vue.runtime.esm-bundler-DS0mm12S.js";import{a as v,i as y,n as ee,r as b,t as x}from"./SelectValue-BXvq5Kkp.js";import{t as S}from"./use-sidebar-1HOdWNC3.js";import{t as C}from"./Spinner-DJesLX-i.js";import{n as w}from"./lib-CiHeuR38.js";import{n as T,r as E,t as D}from"./useMutation-d7gcLMcv.js";import{Y as O,s as k,u as A}from"./index-Cta5aHeD.js";import"./Teleport-C8puyUPF.js";import{n as j}from"./button-DQxx5HZh.js";import{n as M,r as N,t as P}from"./RadioGroupItem-BKiP5LFn.js";import{a as F,c as I,i as L,l as R,n as z,r as B,s as V,t as H}from"./vee-validate-zod-D6HZ7fRB.js";import{t as U}from"./Separator-6ZbuHEOH.js";import{n as W,r as G,t as K}from"./global-layout-DnpI9DBq.js";var q=A({theme:k([`light`,`dark`],{error:`Please select a theme.`}),font:k([`inter`,`manrope`,`system`],{error:`Please select a font.`})}),J=[{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 Y(e,t=!0){return{data:e,extra:{},code:200,message:`success`,success:t}}function X(e){return T({queryKey:[`useGetSystemConfigByKeyQuery`,e],queryFn:async()=>{let t=await new Promise((t,n)=>{setTimeout(()=>{let r=J.find(t=>t.key===e);r||n(Error(`Config not found`)),t(r)},1e3)});if(!t)throw Error(`Config not found`);return Y(t)}})}function Z(e){let t=E();return D({mutationKey:[`useUpdateSystemConfigByKeyMutation`,e],mutationFn:async e=>await new Promise(t=>{setTimeout(()=>{t(Y(e))},100)}),onSuccess:()=>{t.invalidateQueries({queryKey:[`useGetSystemConfigByKeyQuery`,e]})}})}function Q(){let e=E();return D({mutationKey:[`useCreateTaskMutation`],mutationFn:async e=>new Promise(t=>{setTimeout(()=>{t(Y(e))},100)}),onSuccess:()=>{e.invalidateQueries({queryKey:[`useGetSystemConfigByKeyQuery`]})}})}function te({key:e,defaultValue:t,description:n,schema:i}){let a={...t},{handleSubmit:o,resetForm:s}=I({validationSchema:H(i),initialValues:a}),c=O(e,a),{data:l,isPending:u}=X(e),{mutate:f,isPending:m}=Q(),{mutate:h,isPending:g}=Z(e),_=d(()=>m.value||g.value);return r(l,()=>{if(!u.value&&!l.value){c.value=l.value,f({key:e,description:n,value:JSON.stringify(t)},{onSuccess:()=>{c.value=a,w(`System config created with default value.`,{description:p(`pre`,{class:`mt-2 w-[340px] rounded-md bg-slate-950 p-4`},p(`code`,{class:`text-white`},JSON.stringify({key:e,description:n,value:t},null,2)))})}});return}let r=l.value?.data?.value?JSON.parse(l.value.data.value):a;c.value=r,s({values:{...r}})},{immediate:!0,deep:!0}),{isPending:_,isGetting:u,onSubmit:o(t=>{let r={key:e,value:t,description:n};c.value=t,h({...r,value:JSON.stringify(t)},{onSuccess:()=>{w(`You submitted the following values:`,{description:p(`pre`,{class:`mt-2 w-[340px] rounded-md bg-slate-950 p-4`},p(`code`,{class:`text-white`},JSON.stringify(r,null,2)))})}})})}}var $={key:0},ne={class:`flex justify-start`},re=`appearance_config`,ie=`Customize the appearance of the app. Automatically switch between day and night themes.`,ae=m({__name:`appearance-form`,setup(r){let{isGetting:d,isPending:p,onSubmit:m}=te({key:re,description:ie,defaultValue:{theme:`light`,font:`inter`},schema:q});return(r,_)=>{let S=x,w=ee,T=F,E=b,D=R,O=y,k=v;return n(),f(u,null,[_[14]||=l(`div`,null,[l(`h3`,{class:`text-lg font-medium`},` Appearance `),l(`p`,{class:`text-sm text-muted-foreground`},` Customize the appearance of the app. Automatically switch between day and night themes. `)],-1),s(g(U),{class:`my-4`}),g(d)?(n(),f(`div`,$,[s(g(j),{variant:`secondary`,disabled:``,size:`sm`},{default:i(()=>[s(g(C)),_[1]||=h(` Please wait `,-1)]),_:1})])):o(``,!0),g(d)?o(``,!0):(n(),f(`form`,{key:1,class:`space-y-8`,onSubmit:_[0]||=(...e)=>g(m)&&g(m)(...e)},[s(g(V),{name:`font`},{default:i(({componentField:e})=>[s(g(L),null,{default:i(()=>[s(g(B),null,{default:i(()=>[..._[2]||=[h(`Font`,-1)]]),_:1}),s(k,a(t(e)),{default:i(()=>[s(T,null,{default:i(()=>[s(w,null,{def
|