@duxweb/dvha-core 1.0.39 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("vue"),O=require("@tanstack/vue-query"),M=require("@vueuse/core"),C=require("axios"),q=require("crypto-js"),W=require("dayjs"),T=require("lodash-es"),k=require("mathjs"),l=require("mime"),E=require("mitt"),L=require("pinia"),D=require("vue3-sfc-loader"),J=require("vue-router"),N=require("../../../hooks/manage.cjs"),V=require("../../../hooks/data.cjs");require("json-2-csv");require("@vee-validate/rules");require("vee-validate");const B=require("../../../hooks/i18n.cjs"),F=require("../../../hooks/json.cjs");require("../../../hooks/json/index.cjs");require("../../../utils/bus.cjs");require("@overlastic/vue");require("clsx");require("colorizr");const Q=require("../../../index.cjs");function i(n){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(c,o,a.get?a:{enumerable:!0,get:()=>n[o]})}}return c.default=n,Object.freeze(c)}const U=i(y),z=i(O),A=i(M),H=i(T),I=i(k),G=i(L),K=i(J),f=new Map;function X(n){return q.MD5(n).toString().substring(0,10)}function Y(n){const c=V.useClient(),{mergeLocale:o}=B.useI18n(),{config:a}=N.useManage(),v={moduleCache:{vue:U,"@duxweb/dvha-core":Q,"@vueuse/core":A,"@tanstack/vue-query":z,axios:C,"crypto-js":q,mime:l,math:I,mitt:E,"lodash-es":H,pinia:G,dayjs:W,"vue-router":K,...a?.remote?.packages,"static!":function(e,r,t){const s=l.getType(t);if(s?.startsWith("image"))return`data:${s};charset=utf-8;base64,${btoa(e)}`;if(t===".json")return JSON.parse(e);throw new Error(`${t} unable to parse`)}},async handleModule(e,r){if(e!==".vue"){if(e===".json"){const t=await r(),{render:s}=F.useJsonSchema({data:t?.nodes||{},context:t?.data||{}});return()=>y.createVNode(s,null,null)}if(e!==".mjs")return r()}},customBlockHandler(e){if(e.type==="i18n"){const r=JSON.parse(e.content);for(const t in r)o(t,r[t])}},getFile:async e=>{e=g(e,".vue"),e=g(e,".json");const r=await c.request({path:typeof a?.remote?.apiRoutePath=="function"?a?.remote?.apiRoutePath(e):a?.remote?.apiRoutePath||"static",payload:{path:e},method:a?.remote?.apiMethod||"POST"}).then(s=>s?.data).catch(s=>{throw new Error(`${s?.message} ${e}`)});let t=r?.type||".vue";return(r?.type?.endsWith("js")||r?.type?.endsWith("ts")||r?.type?.endsWith("jsx")||r?.type?.endsWith("tsx"))&&(t=".mjs"),{content:r?.content,type:t}},getResource({refPath:e,relPath:r},t){const{moduleCache:s,pathResolve:_,getFile:j}=t,[b,...m]=r.match(/([^!]+!)|[^!]+$/g).reverse(),w=(u,h,p,x)=>m.reduce((R,$)=>s[$](R,h,p,x),u),d=_({refPath:e,relPath:b},t),S=m.join("")+d,P=u=>u.startsWith("@")?!0:!u.includes("/")&&!u.startsWith(".");return{id:S,path:d,async getContent(){if(P(d))throw new Error(`Package ${d} not imported`);const{content:u,type:h}=await j(d);return{getContentData:async p=>w(u,d,h,t),type:h}}}},addStyle(e){const r=X(e);if(f.has(r))return;f.set(r,!0);const t=document.createElement("style");t.textContent=e,t.setAttribute("data-hash",r),document.head.appendChild(t)}};return()=>D.loadModule(`${n}`,{...v})}function g(n,c){const o=new RegExp(`${c}$`);return n.replace(o,"")}exports.sfcLoader=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("vue"),$=require("@tanstack/vue-query"),C=require("@vueuse/core"),W=require("axios"),_=require("crypto-js"),E=require("dayjs"),T=require("lodash-es"),k=require("mathjs"),q=require("mime"),L=require("mitt"),D=require("pinia"),J=require("vue3-sfc-loader"),N=require("vue-router"),V=require("../../../hooks/auth.cjs"),B=require("../../../hooks/data.cjs");require("json-2-csv");require("@vee-validate/rules");require("vee-validate");const F=require("../../../hooks/i18n.cjs"),Q=require("../../../hooks/json.cjs");require("../../../hooks/json/index.cjs");const U=require("../../../hooks/manage.cjs");require("../../../utils/bus.cjs");require("@overlastic/vue");require("clsx");require("colorizr");const z=require("../../../index.cjs");function u(n){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const o in n)if(o!=="default"){const h=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(a,o,h.get?h:{enumerable:!0,get:()=>n[o]})}}return a.default=n,Object.freeze(a)}const A=u(v),H=u($),I=u(C),G=u(T),K=u(k),X=u(D),Y=u(N),y=new Map;function Z(n){return _.MD5(n).toString().substring(0,10)}function ee(n){const a=B.useClient(),{mutate:o}=V.useError(),{mergeLocale:h}=F.useI18n(),{config:d}=U.useManage(),j={moduleCache:{vue:A,"@duxweb/dvha-core":z,"@vueuse/core":I,"@tanstack/vue-query":H,axios:W,"crypto-js":_,mime:q,math:K,mitt:L,"lodash-es":G,pinia:X,dayjs:E,"vue-router":Y,...d?.remote?.packages,"static!":function(e,t,r){const s=q.getType(r);if(s?.startsWith("image"))return`data:${s};charset=utf-8;base64,${btoa(e)}`;if(r===".json")return JSON.parse(e);throw new Error(`${r} unable to parse`)}},async handleModule(e,t){if(e!==".vue"){if(e===".json"){const r=await t(),{render:s}=Q.useJsonSchema({data:r?.nodes||{},context:r?.data||{}});return()=>v.createVNode(s,null,null)}if(e!==".mjs")return t()}},customBlockHandler(e){if(e.type==="i18n"){const t=JSON.parse(e.content);for(const r in t)h(r,t[r])}},getFile:async e=>{e=g(e,".vue"),e=g(e,".json");const t=await a.request({path:typeof d?.remote?.apiRoutePath=="function"?d?.remote?.apiRoutePath(e):d?.remote?.apiRoutePath||"static",payload:{path:e},method:d?.remote?.apiMethod||"POST"}).then(s=>s?.data).catch(s=>{o(s)});if(!t)return;let r=t?.type||".vue";return(t?.type?.endsWith("js")||t?.type?.endsWith("ts")||t?.type?.endsWith("jsx")||t?.type?.endsWith("tsx"))&&(r=".mjs"),{content:t?.content,type:r}},getResource({refPath:e,relPath:t},r){const{moduleCache:s,pathResolve:b,getFile:S}=r,[w,...p]=t.match(/([^!]+!)|[^!]+$/g).reverse(),P=(c,m,l,f)=>p.reduce((O,M)=>s[M](O,m,l,f),c),i=b({refPath:e,relPath:w},r),x=p.join("")+i,R=c=>c.startsWith("@")?!0:!c.includes("/")&&!c.startsWith(".");return{id:x,path:i,async getContent(){if(R(i))throw new Error(`Package ${i} not imported`);const c=await S(i),{content:m,type:l}=c||{};return{getContentData:async f=>P(m,i,l,r),type:l}}}},addStyle(e){const t=Z(e);if(y.has(t))return;y.set(t,!0);const r=document.createElement("style");r.textContent=e,r.setAttribute("data-hash",t),document.head.appendChild(r)}};return()=>J.loadModule(`${n}`,{...j})}function g(n,a){const o=new RegExp(`${a}$`);return n.replace(o,"")}exports.sfcLoader=ee;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),g=require("vue-router"),c=require("../stores/auth.cjs"),i=require("./manage.cjs");function h(t){const e=i.useManage(),u=c.useAuthStore(),s=g.useRouter(),n=d.ref(!1);return{mutate:async o=>{n.value=!0;const a=await e.config.authProvider?.login(o,e);if(n.value=!1,a?.success){if(!a?.data)throw new Error("Login response data is undefined");t?.onSuccess?.(a),u.login(a.data),s.push(e.getRoutePath(a.redirectTo||"/"));return}t?.onError?.(a)},isLoading:n}}function f(t){const e=i.useManage(),u=c.useAuthStore(),s=g.useRouter();return{mutate:async r=>{const o=await e.config.authProvider?.logout(r,e);if(o?.success){t?.onSuccess?.(o),u.logout(),await s.replace(e.getRoutePath(o.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100);return}t?.onError?.(o)}}}function l(t){const e=i.useManage(),u=c.useAuthStore(),s=g.useRouter();return{mutate:async r=>{const o=await e.config.authProvider?.check?.(r,e,u.getUser());if(o?.success){if(t?.onSuccess?.(o),!o?.data)throw new Error("Check response data is undefined");u.update(o.data);return}t?.onError?.(o),o?.logout&&(await s.replace(e.getRoutePath(o.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100))}}}function w(t){const e=i.useManage(),u=c.useAuthStore(),s=g.useRouter();return{mutate:async r=>{const o=await e.config.authProvider?.register?.(r,e);if(o?.success){if(t?.onSuccess?.(o),!o?.data)throw new Error("Register response data is undefined");u.login(o.data),s.push(e.getRoutePath(o.redirectTo||"/"));return}t?.onError?.(o)}}}function S(t){const e=i.useManage(),u=g.useRouter();return{mutate:async n=>{const r=await e.config.authProvider?.forgotPassword?.(n,e);if(r?.success){t?.onSuccess?.(r),r.redirectTo&&u.push(e.getRoutePath(r.redirectTo||"/"));return}t?.onError?.(r)}}}function m(t){const e=i.useManage(),u=g.useRouter();return{mutate:async n=>{const r=await e.config.authProvider?.updatePassword?.(n,e);if(r?.success){t?.onSuccess?.(r),r.redirectTo&&u.push(e.getRoutePath(r.redirectTo||"/"));return}t?.onError?.(r)}}}function P(t){const{config:e,getRoutePath:u}=i.useManage(),s=g.useRouter(),n=c.useAuthStore();return{mutate:async o=>{const a=await e.authProvider?.onError(o);t?.(a),a?.logout&&(n.logout(),await s.replace(u(a.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100))}}}function R(t){return c.useAuthStore(t).getUser()}function v(t){return c.useAuthStore(t).isLogin()}function T(t){const e=i.useManage(t),s=c.useAuthStore(t).getUser();return(r,o)=>e.config.authProvider?.can?e.config.authProvider.can(r,o,e,s):!0}exports.useCan=T;exports.useCheck=l;exports.useError=P;exports.useForgotPassword=S;exports.useGetAuth=R;exports.useIsLogin=v;exports.useLogin=h;exports.useLogout=f;exports.useRegister=w;exports.useUpdatePassword=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("vue"),g=require("vue-router"),c=require("../stores/auth.cjs");require("pinia");require("lodash-es");const h=require("../stores/route.cjs"),i=require("./manage.cjs");function l(t){const e=i.useManage(),u=c.useAuthStore(),s=h.useRouteStore(),n=g.useRouter(),r=S.ref(!1);return{mutate:async d=>{r.value=!0;const a=await e.config.authProvider?.login(d,e);if(r.value=!1,a?.success){if(!a?.data)throw new Error("Login response data is undefined");s.resetRouteInit(),t?.onSuccess?.(a),u.login(a.data),n.push(e.getRoutePath(a.redirectTo||"/"));return}t?.onError?.(a)},isLoading:r}}function m(t){const e=i.useManage(),u=c.useAuthStore(),s=g.useRouter();return{mutate:async r=>{const o=await e.config.authProvider?.logout(r,e);if(o?.success){t?.onSuccess?.(o),u.logout(),await s.replace(e.getRoutePath(o.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100);return}t?.onError?.(o)}}}function w(t){const e=i.useManage(),u=c.useAuthStore(),{mutate:s}=f();return{mutate:async r=>{const o=await e.config.authProvider?.check?.(r,e,u.getUser());if(o?.success){if(t?.onSuccess?.(o),!o?.data)throw new Error("Check response data is undefined");u.update(o.data);return}t?.onError?.(o),o?.logout&&s({status:401,message:o.message||"Unauthorized"})}}}function P(t){const e=i.useManage(),u=c.useAuthStore(),s=g.useRouter();return{mutate:async r=>{const o=await e.config.authProvider?.register?.(r,e);if(o?.success){if(t?.onSuccess?.(o),!o?.data)throw new Error("Register response data is undefined");u.login(o.data),s.push(e.getRoutePath(o.redirectTo||"/"));return}t?.onError?.(o)}}}function R(t){const e=i.useManage(),u=g.useRouter();return{mutate:async n=>{const r=await e.config.authProvider?.forgotPassword?.(n,e);if(r?.success){t?.onSuccess?.(r),r.redirectTo&&u.push(e.getRoutePath(r.redirectTo||"/"));return}t?.onError?.(r)}}}function v(t){const e=i.useManage(),u=g.useRouter();return{mutate:async n=>{const r=await e.config.authProvider?.updatePassword?.(n,e);if(r?.success){t?.onSuccess?.(r),r.redirectTo&&u.push(e.getRoutePath(r.redirectTo||"/"));return}t?.onError?.(r)}}}function f(t){const{config:e,getRoutePath:u}=i.useManage(),s=g.useRouter(),n=c.useAuthStore(e.name),r=h.useRouteStore(e.name);return{mutate:async d=>{const a=await e.authProvider?.onError(d);t?.(a),a?.logout&&(await n.logout(),await r.resetRouteInit(),await s.replace(u(a.redirectTo||"/login")),setTimeout(()=>{},100))}}}function E(t){return c.useAuthStore(t).getUser()}function T(t){return c.useAuthStore(t).isLogin()}function A(t){const e=i.useManage(t),s=c.useAuthStore(t).getUser();return(r,o)=>e.config.authProvider?.can?e.config.authProvider.can(r,o,e,s):!0}exports.useCan=A;exports.useCheck=w;exports.useError=f;exports.useForgotPassword=R;exports.useGetAuth=E;exports.useIsLogin=T;exports.useLogin=l;exports.useLogout=m;exports.useRegister=P;exports.useUpdatePassword=v;
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("@vueuse/core"),F=require("colorizr"),H=require("pinia"),s=require("vue"),J=require("../config/color.cjs");require("lodash-es");const K=require("../stores/theme.cjs"),Q=require("./manage.cjs");function W(){const u=K.useThemeStore(),{mode:E}=H.storeToRefs(u),$=q.useColorMode({storageRef:E}),b=Q.useManage(),{state:p,next:V,go:v}=q.useCycleList(["dark","light","auto"],{initialValue:$.store.value});s.watchEffect(()=>{$.value=p.value});const y=t=>{switch(t){case"auto":v(2);break;case"light":v(1);break;case"dark":v(0);break}},d=s.computed(()=>{const{system:t,store:e}=$;return e.value==="auto"?t.value==="dark":e.value==="dark"}),B=s.computed(()=>d.value?{logo:b.config?.theme?.darkLogo,banner:b.config?.theme?.darkBanner}:{logo:b.config?.theme?.logo,banner:b.config?.theme?.banner}),r={...{colors:J.themeColor,colorTypes:["primary","info","success","warning","error","gray"],colorShades:["50","100","200","300","400","500","600","700","800","900","950"],colorScenes:{light:{default:{default:"600",hover:"600",pressed:"700",focus:"500",disabled:"300"}},dark:{default:{default:"500",hover:"400",pressed:"300",focus:"500",disabled:"600"}}},colorSemantic:{light:{text:{dimmed:"300",muted:"400",toned:"600",base:"800",highlighted:"900",inverted:"white"},bg:{base:"white",muted:"50",elevated:"100",accented:"200",inverted:"900"},border:{base:"100",muted:"200",accented:"300",inverted:"900"}},dark:{text:{dimmed:"600",muted:"500",toned:"300",base:"400",highlighted:"100",inverted:"black"},bg:{base:"950",muted:"900",elevated:"800",accented:"700",inverted:"100"},border:{base:"900",muted:"800",accented:"700",inverted:"100"}}},colorBase:{white:"#ffffff",black:"#000000"}},...b.config?.theme?.config},{colorShades:C,colorTypes:x}=r,f=s.computed(()=>u.theme),h=s.computed(()=>Object.keys(r.colors)),k=["default","hover","pressed","focus","disabled"];function M(){return d.value?r.colorScenes.dark:r.colorScenes.light}function w(t,e){const o=M(),l=o.default;if(o.overrides?.[t]){const i=o.overrides[t]?.[e];if(i)return i}return l[e]||"500"}function T(t,e){const o=f.value[t];return r.colors[o]?.[e]||""}function n(t,e,o){const c=(d.value?r.colorSemantic.dark:r.colorSemantic.light)[t][e];return c==="white"||c==="black"?`var(--ui-color-${c})`:`var(--base-color-${o}-${c})`}const S=t=>{const e=F.hex2rgb(t);return`${e.r} ${e.g} ${e.b}`};function O(){const t=[];Object.entries(r.colors).forEach(([c,i])=>{typeof i=="object"&&Object.entries(i).forEach(([a,m])=>{try{t.push(`--base-color-${c}-${a}: ${S(m)};`)}catch{t.push(`--base-color-${c}-${a}: ${m};`)}})});const e=[];x.forEach(c=>{const i=f.value[c];C.forEach(a=>{e.push(`--ui-color-${c}-${a}: var(--base-color-${i}-${a});`)}),k.forEach(a=>{const m=w(c,a);a==="default"?e.push(`--ui-color-${c}: var(--base-color-${i}-${m});`):e.push(`--ui-color-${c}-${a}: var(--base-color-${i}-${m});`)})});const o=f.value.gray,l=[`--ui-color-white: ${S(r.colorBase?.white||"#ffffff")};`,`--ui-color-black: ${S(r.colorBase?.black||"#000000")};`,`--ui-text-dimmed: ${n("text","dimmed",o)};`,`--ui-text-muted: ${n("text","muted",o)};`,`--ui-text-toned: ${n("text","toned",o)};`,`--ui-text: ${n("text","base",o)};`,`--ui-text-highlighted: ${n("text","highlighted",o)};`,`--ui-text-inverted: ${n("text","inverted",o)};`,`--ui-bg: ${n("bg","base",o)};`,`--ui-bg-muted: ${n("bg","muted",o)};`,`--ui-bg-elevated: ${n("bg","elevated",o)};`,`--ui-bg-accented: ${n("bg","accented",o)};`,`--ui-bg-inverted: ${n("bg","inverted",o)};`,`--ui-border: ${n("border","base",o)};`,`--ui-border-muted: ${n("border","muted",o)};`,`--ui-border-accented: ${n("border","accented",o)};`,`--ui-border-inverted: ${n("border","inverted",o)};`];return`:root {
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("@vueuse/core"),F=require("colorizr"),H=require("pinia"),s=require("vue"),J=require("../config/color.cjs");require("lodash-es");const K=require("../stores/theme.cjs"),Q=require("./manage.cjs");function W(){const u=K.useThemeStore(),{mode:E}=H.storeToRefs(u),$=q.useColorMode({storageRef:E}),d=Q.useManage(),{state:S,next:L,go:v}=q.useCycleList(["dark","light","auto"],{initialValue:$.store.value});s.watchEffect(()=>{$.value=S.value});const V=t=>{switch(t){case"auto":v(2);break;case"light":v(1);break;case"dark":v(0);break}},f=s.computed(()=>{const{system:t,store:e}=$;return e.value==="auto"?t.value==="dark":e.value==="dark"}),y=s.computed(()=>f.value?{logo:d.config?.theme?.darkLogo,appLogo:d.config?.theme?.appDarkLogo,banner:d.config?.theme?.darkBanner}:{logo:d.config?.theme?.logo,appLogo:d.config?.theme?.appLogo,banner:d.config?.theme?.banner}),r={...{colors:J.themeColor,colorTypes:["primary","info","success","warning","error","gray"],colorShades:["50","100","200","300","400","500","600","700","800","900","950"],colorScenes:{light:{default:{default:"600",hover:"600",pressed:"700",focus:"500",disabled:"300"}},dark:{default:{default:"500",hover:"400",pressed:"300",focus:"500",disabled:"600"}}},colorSemantic:{light:{text:{dimmed:"300",muted:"400",toned:"600",base:"800",highlighted:"900",inverted:"white"},bg:{base:"white",muted:"50",elevated:"100",accented:"200",inverted:"900"},border:{base:"100",muted:"200",accented:"300",inverted:"900"}},dark:{text:{dimmed:"600",muted:"500",toned:"300",base:"400",highlighted:"100",inverted:"black"},bg:{base:"950",muted:"900",elevated:"800",accented:"700",inverted:"100"},border:{base:"900",muted:"800",accented:"700",inverted:"100"}}},colorBase:{white:"#ffffff",black:"#000000"}},...d.config?.theme?.config},{colorShades:C,colorTypes:k}=r,g=s.computed(()=>u.theme),h=s.computed(()=>Object.keys(r.colors)),x=["default","hover","pressed","focus","disabled"];function B(){return f.value?r.colorScenes.dark:r.colorScenes.light}function w(t,e){const o=B(),l=o.default;if(o.overrides?.[t]){const i=o.overrides[t]?.[e];if(i)return i}return l[e]||"500"}function T(t,e){const o=g.value[t];return r.colors[o]?.[e]||""}function n(t,e,o){const c=(f.value?r.colorSemantic.dark:r.colorSemantic.light)[t][e];return c==="white"||c==="black"?`var(--ui-color-${c})`:`var(--base-color-${o}-${c})`}const p=t=>{const e=F.hex2rgb(t);return`${e.r} ${e.g} ${e.b}`};function M(){const t=[];Object.entries(r.colors).forEach(([c,i])=>{typeof i=="object"&&Object.entries(i).forEach(([a,m])=>{try{t.push(`--base-color-${c}-${a}: ${p(m)};`)}catch{t.push(`--base-color-${c}-${a}: ${m};`)}})});const e=[];k.forEach(c=>{const i=g.value[c];C.forEach(a=>{e.push(`--ui-color-${c}-${a}: var(--base-color-${i}-${a});`)}),x.forEach(a=>{const m=w(c,a);a==="default"?e.push(`--ui-color-${c}: var(--base-color-${i}-${m});`):e.push(`--ui-color-${c}-${a}: var(--base-color-${i}-${m});`)})});const o=g.value.gray,l=[`--ui-color-white: ${p(r.colorBase?.white||"#ffffff")};`,`--ui-color-black: ${p(r.colorBase?.black||"#000000")};`,`--ui-text-dimmed: ${n("text","dimmed",o)};`,`--ui-text-muted: ${n("text","muted",o)};`,`--ui-text-toned: ${n("text","toned",o)};`,`--ui-text: ${n("text","base",o)};`,`--ui-text-highlighted: ${n("text","highlighted",o)};`,`--ui-text-inverted: ${n("text","inverted",o)};`,`--ui-bg: ${n("bg","base",o)};`,`--ui-bg-muted: ${n("bg","muted",o)};`,`--ui-bg-elevated: ${n("bg","elevated",o)};`,`--ui-bg-accented: ${n("bg","accented",o)};`,`--ui-bg-inverted: ${n("bg","inverted",o)};`,`--ui-border: ${n("border","base",o)};`,`--ui-border-muted: ${n("border","muted",o)};`,`--ui-border-accented: ${n("border","accented",o)};`,`--ui-border-inverted: ${n("border","inverted",o)};`];return`:root {
2
2
  ${t.join(`
3
3
  `)}
4
4
  ${e.join(`
5
5
  `)}
6
6
  ${l.join(`
7
7
  `)}
8
- }`}let g=null;function j(){const t=O();g||(g=document.createElement("style"),g.id="dvha-variables",document.head.appendChild(g)),g.textContent=t}function I(){u.cssInit||(u.setCssInit(),j())}s.watch([f,d],()=>{u.cssInit&&j()},{deep:!0,immediate:!1});function L(t,e){h.value.includes(e)?u.setThemeColor(t,e):console.warn(`Color "${e}" is not available`)}function z(t){u.setThemeColors(t)}function R(){u.resetTheme()}function U(t,e,o=!1){return o?`--ui-color-${t}-${e}`:T(t,e)}function D(t,e,o=!1){if(e||(e="default"),o)return e==="default"?`--ui-color-${t})`:`--ui-color-${t}-${e})`;const l=w(t,e);return T(t,l)}function G(t,e,o=!1){if(o){let a;switch(t){case"text":a=e==="base"?"--ui-text":`--ui-text-${e}`;break;case"bg":a=e==="base"?"--ui-bg":`--ui-bg-${e}`;break;case"border":a=e==="base"?"--ui-border":`--ui-border-${e}`;break;default:a=`--ui-${t}-${e}`}return`${a}`}const l=f.value.gray,i=(d.value?r.colorSemantic.dark:r.colorSemantic.light)[t][e];return i==="white"?r.colorBase?.white||"#ffffff":i==="black"?r.colorBase?.black||"#000000":r.colors[l]?.[i]||""}const P=s.computed(()=>h.value?.filter(t=>["slate","gray","zinc","neutral","stone"].includes(t))),A=s.computed(()=>h.value?.filter(t=>!["slate","gray","zinc","neutral","stone"].includes(t)));return{toggle:V,mode:p,setMode:y,isDark:d,resources:B,config:s.readonly(r),colorMapping:s.readonly(f),colors:h,neutralColors:P,primaryColors:A,colorShades:C,colorTypes:x,colorScenes:k,cssInit:I,cssReset:R,setColor:L,setColors:z,getSceneColor:D,getShadeColor:U,getSemanticColor:G}}exports.useTheme=W;
8
+ }`}let b=null;function j(){const t=M();b||(b=document.createElement("style"),b.id="dvha-variables",document.head.appendChild(b)),b.textContent=t}function O(){u.cssInit||(u.setCssInit(),j())}s.watch([g,f],()=>{u.cssInit&&j()},{deep:!0,immediate:!1});function I(t,e){h.value.includes(e)?u.setThemeColor(t,e):console.warn(`Color "${e}" is not available`)}function z(t){u.setThemeColors(t)}function R(){u.resetTheme()}function D(t,e,o=!1){return o?`--ui-color-${t}-${e}`:T(t,e)}function U(t,e,o=!1){if(e||(e="default"),o)return e==="default"?`--ui-color-${t})`:`--ui-color-${t}-${e})`;const l=w(t,e);return T(t,l)}function G(t,e,o=!1){if(o){let a;switch(t){case"text":a=e==="base"?"--ui-text":`--ui-text-${e}`;break;case"bg":a=e==="base"?"--ui-bg":`--ui-bg-${e}`;break;case"border":a=e==="base"?"--ui-border":`--ui-border-${e}`;break;default:a=`--ui-${t}-${e}`}return`${a}`}const l=g.value.gray,i=(f.value?r.colorSemantic.dark:r.colorSemantic.light)[t][e];return i==="white"?r.colorBase?.white||"#ffffff":i==="black"?r.colorBase?.black||"#000000":r.colors[l]?.[i]||""}const P=s.computed(()=>h.value?.filter(t=>["slate","gray","zinc","neutral","stone"].includes(t))),A=s.computed(()=>h.value?.filter(t=>!["slate","gray","zinc","neutral","stone"].includes(t)));return{toggle:L,mode:S,setMode:V,isDark:f,resources:y,config:s.readonly(r),colorMapping:s.readonly(g),colors:h,neutralColors:P,primaryColors:A,colorShades:C,colorTypes:k,colorScenes:x,cssInit:O,cssReset:R,setColor:I,setColors:z,getSceneColor:U,getShadeColor:D,getSemanticColor:G}}exports.useTheme=W;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("axios");function n(s){return{login:async(a,r)=>await i.post(r.getApiUrl(s?.apiPath?.login||"/login",s?.dataProviderName),a).then(e=>({success:!0,message:e?.data?.message,redirectTo:s?.routePath?.index||"/",data:e?.data?.data})).catch(e=>({success:!1,message:e?.response?.data?.message||e?.message})),check:async(a,r,e)=>await i.get(r?.getApiUrl(s?.apiPath?.check||"/check",s?.dataProviderName)||"",{headers:{Authorization:e?.token||""}}).then(t=>({success:!0,logout:!1,message:t?.data?.message,data:t?.data?.data})).catch(t=>({success:!1,logout:!0,message:t?.response?.data?.message||t?.message})),onError:async a=>a?.status===401?{logout:!0,redirectTo:s?.routePath?.login||"/login",error:a}:{logout:!1,error:a},logout:async()=>({success:!0,redirectTo:s?.routePath?.login||"/login"}),register:async(a,r)=>await i.post(r?.getApiUrl(s?.apiPath?.register||"/register",s?.dataProviderName)||"",a).then(e=>({success:!0,message:e?.data?.message,redirectTo:s?.routePath?.index||"/",data:e?.data?.data})).catch(e=>({success:!1,message:e?.response?.data?.message||e?.message})),forgotPassword:async(a,r)=>await i.post(r?.getApiUrl(s?.apiPath?.forgotPassword||"/forgot-password",s?.dataProviderName)||"",a).then(e=>({success:!0,message:e?.data?.message,redirectTo:s?.routePath?.login||"/login"})).catch(e=>({success:!1,message:e?.response?.data?.message||e?.message})),updatePassword:async(a,r)=>await i.post(r?.getApiUrl(s?.apiPath?.updatePassword||"/update-password",s?.dataProviderName)||"",a).then(e=>({success:!0,message:e?.data?.message,redirectTo:s?.routePath?.login||"/login"})).catch(e=>({success:!1,message:e?.response?.data?.message||e?.message})),can:(a,r,e,t)=>!t?.permission||Array.isArray(t?.permission)&&t?.permission?.length===0||typeof t?.permission=="object"&&Object.keys(t?.permission).length===0?!0:!(Array.isArray(t?.permission)&&!t?.permission?.includes(a)||typeof t?.permission=="object"&&t?.permission[a]===!1)}}exports.simpleAuthProvider=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("axios");function n(s){return{login:async(t,r)=>await i.post(r.getApiUrl(s?.apiPath?.login||"/login",s?.dataProviderName),t).then(e=>({success:!0,message:e?.data?.message,redirectTo:s?.routePath?.index||"/",data:e?.data?.data})).catch(e=>({success:!1,message:e?.response?.data?.message||e?.message})),check:async(t,r,e)=>await i.get(r?.getApiUrl(s?.apiPath?.check||"/check",s?.dataProviderName)||"",{headers:{Authorization:e?.token||""}}).then(a=>({success:!0,logout:!1,message:a?.data?.message,data:a?.data?.data})).catch(a=>({success:!1,logout:a.status===401,message:a?.response?.data?.message||a?.message})),onError:async t=>t?.status===401?{logout:!0,redirectTo:s?.routePath?.login||"/login",error:t}:{logout:!1,error:t},logout:async()=>({success:!0,redirectTo:s?.routePath?.login||"/login"}),register:async(t,r)=>await i.post(r?.getApiUrl(s?.apiPath?.register||"/register",s?.dataProviderName)||"",t).then(e=>({success:!0,message:e?.data?.message,redirectTo:s?.routePath?.index||"/",data:e?.data?.data})).catch(e=>({success:!1,message:e?.response?.data?.message||e?.message})),forgotPassword:async(t,r)=>await i.post(r?.getApiUrl(s?.apiPath?.forgotPassword||"/forgot-password",s?.dataProviderName)||"",t).then(e=>({success:!0,message:e?.data?.message,redirectTo:s?.routePath?.login||"/login"})).catch(e=>({success:!1,message:e?.response?.data?.message||e?.message})),updatePassword:async(t,r)=>await i.post(r?.getApiUrl(s?.apiPath?.updatePassword||"/update-password",s?.dataProviderName)||"",t).then(e=>({success:!0,message:e?.data?.message,redirectTo:s?.routePath?.login||"/login"})).catch(e=>({success:!1,message:e?.response?.data?.message||e?.message})),can:(t,r,e,a)=>!a?.permission||Array.isArray(a?.permission)&&a?.permission?.length===0||typeof a?.permission=="object"&&Object.keys(a?.permission).length===0?!0:!(Array.isArray(a?.permission)&&!a?.permission?.includes(t)||typeof a?.permission=="object"&&a?.permission[t]===!1)}}exports.simpleAuthProvider=n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("pinia"),i=require("vue");function I(r){const t=i.inject("dux.manage");if(r||(r=t?.value||""),!r)throw new Error("manage not found");return b(r)()}function b(r){return g.defineStore(`routes-${r}`,()=>{const t=i.ref([]),a=e=>t.value?.find(n=>n.path===e),f=e=>t.value?.find(n=>n.name===e),d=e=>{t.value?.push(e)},v=e=>{t.value=[...t.value,...e]},R=e=>{t.value=e},p=()=>t.value,h=()=>{t.value=[]},S=()=>{const e=t.value?.filter(o=>!o.parent&&!o.name?.includes("404")&&!o.name?.includes("403"))?.sort((o,u)=>(o.sort||0)-(u.sort||0)),n=o=>{if(o.path)return o;const u=t.value?.filter(s=>s.parent===o.name)?.sort((s,c)=>(s.sort||0)-(c.sort||0));for(const s of u||[]){const c=n(s);if(c)return c}};for(const o of e||[]){const u=n(o);if(u)return u}},l=i.ref(!1);return{routes:t,searchRoute:a,searchRouteName:f,appendRoute:d,appendRoutes:v,setRoutes:R,getRoutes:p,clearRoutes:h,getIndexRoute:S,getRouteInit:()=>{const e=l.value;return l.value=!0,e}}})}exports.useRouteStore=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("pinia"),a=require("vue");function I(r){const t=a.inject("dux.manage");if(r||(r=t?.value||""),!r)throw new Error("manage not found");return b(r)()}function b(r){return g.defineStore(`routes-${r}`,()=>{const t=a.ref([]),l=e=>t.value?.find(n=>n.path===e),f=e=>t.value?.find(n=>n.name===e),d=e=>{t.value?.push(e)},v=e=>{t.value=[...t.value,...e]},R=e=>{t.value=e},p=()=>t.value,h=()=>{t.value=[]},S=()=>{const e=t.value?.filter(o=>!o.parent&&!o.name?.includes("404")&&!o.name?.includes("403"))?.sort((o,u)=>(o.sort||0)-(u.sort||0)),n=o=>{if(o.path)return o;const u=t.value?.filter(s=>s.parent===o.name)?.sort((s,c)=>(s.sort||0)-(c.sort||0));for(const s of u||[]){const c=n(s);if(c)return c}};for(const o of e||[]){const u=n(o);if(u)return u}},i=a.ref(!1);return{routes:t,searchRoute:l,searchRouteName:f,appendRoute:d,appendRoutes:v,setRoutes:R,getRoutes:p,clearRoutes:h,getIndexRoute:S,getRouteInit:()=>{const e=i.value;return i.value=!0,e},resetRouteInit:()=>{i.value=!1}}})}exports.useRouteStore=I;
@@ -1,149 +1,154 @@
1
- import * as W from "vue";
1
+ import * as E from "vue";
2
2
  import { createVNode as M } from "vue";
3
3
  import * as b from "@tanstack/vue-query";
4
- import * as E from "@vueuse/core";
5
- import k from "axios";
6
- import y from "crypto-js";
7
- import J from "dayjs";
8
- import * as T from "lodash-es";
9
- import * as L from "mathjs";
4
+ import * as k from "@vueuse/core";
5
+ import J from "axios";
6
+ import g from "crypto-js";
7
+ import T from "dayjs";
8
+ import * as L from "lodash-es";
9
+ import * as N from "mathjs";
10
10
  import h from "mime";
11
- import N from "mitt";
12
- import * as O from "pinia";
13
- import { loadModule as _ } from "vue3-sfc-loader";
14
- import * as q from "vue-router";
15
- import { useManage as B } from "../../../hooks/manage.js";
16
- import { useClient as D } from "../../../hooks/data.js";
11
+ import O from "mitt";
12
+ import * as _ from "pinia";
13
+ import { loadModule as q } from "vue3-sfc-loader";
14
+ import * as B from "vue-router";
15
+ import { useError as D } from "../../../hooks/auth.js";
16
+ import { useClient as F } from "../../../hooks/data.js";
17
17
  import "json-2-csv";
18
18
  import "@vee-validate/rules";
19
19
  import "vee-validate";
20
- import { useI18n as F } from "../../../hooks/i18n.js";
21
- import { useJsonSchema as V } from "../../../hooks/json.js";
20
+ import { useI18n as V } from "../../../hooks/i18n.js";
21
+ import { useJsonSchema as A } from "../../../hooks/json.js";
22
22
  import "../../../hooks/json/index.js";
23
+ import { useManage as H } from "../../../hooks/manage.js";
23
24
  import "../../../utils/bus.js";
24
25
  import "@overlastic/vue";
25
26
  import "clsx";
26
27
  import "colorizr";
27
- import * as A from "../../../index.js";
28
- const f = /* @__PURE__ */ new Map();
29
- function H(s) {
30
- return y.MD5(s).toString().substring(0, 10);
28
+ import * as I from "../../../index.js";
29
+ const l = /* @__PURE__ */ new Map();
30
+ function Q(s) {
31
+ return g.MD5(s).toString().substring(0, 10);
31
32
  }
32
- function ut(s) {
33
- const c = D(), {
34
- mergeLocale: u
35
- } = F(), {
33
+ function ft(s) {
34
+ const c = F(), {
35
+ mutate: u
36
+ } = D(), {
37
+ mergeLocale: v
38
+ } = V(), {
36
39
  config: i
37
- } = B(), g = {
40
+ } = H(), j = {
38
41
  moduleCache: {
39
- vue: W,
40
- "@duxweb/dvha-core": A,
41
- "@vueuse/core": E,
42
+ vue: E,
43
+ "@duxweb/dvha-core": I,
44
+ "@vueuse/core": k,
42
45
  "@tanstack/vue-query": b,
43
- axios: k,
44
- "crypto-js": y,
46
+ axios: J,
47
+ "crypto-js": g,
45
48
  mime: h,
46
- math: L,
47
- mitt: N,
48
- "lodash-es": T,
49
- pinia: O,
50
- dayjs: J,
51
- "vue-router": q,
49
+ math: N,
50
+ mitt: O,
51
+ "lodash-es": L,
52
+ pinia: _,
53
+ dayjs: T,
54
+ "vue-router": B,
52
55
  ...i?.remote?.packages,
53
- "static!": function(t, r, e) {
54
- const o = h.getType(e);
56
+ "static!": function(t, e, r) {
57
+ const o = h.getType(r);
55
58
  if (o?.startsWith("image"))
56
59
  return `data:${o};charset=utf-8;base64,${btoa(t)}`;
57
- if (e === ".json")
60
+ if (r === ".json")
58
61
  return JSON.parse(t);
59
- throw new Error(`${e} unable to parse`);
62
+ throw new Error(`${r} unable to parse`);
60
63
  }
61
64
  },
62
- async handleModule(t, r) {
65
+ async handleModule(t, e) {
63
66
  if (t !== ".vue") {
64
67
  if (t === ".json") {
65
- const e = await r(), {
68
+ const r = await e(), {
66
69
  render: o
67
- } = V({
68
- data: e?.nodes || {},
69
- context: e?.data || {}
70
+ } = A({
71
+ data: r?.nodes || {},
72
+ context: r?.data || {}
70
73
  });
71
74
  return () => M(o, null, null);
72
75
  }
73
76
  if (t !== ".mjs")
74
- return r();
77
+ return e();
75
78
  }
76
79
  },
77
80
  customBlockHandler(t) {
78
81
  if (t.type === "i18n") {
79
- const r = JSON.parse(t.content);
80
- for (const e in r)
81
- u(e, r[e]);
82
+ const e = JSON.parse(t.content);
83
+ for (const r in e)
84
+ v(r, e[r]);
82
85
  }
83
86
  },
84
87
  getFile: async (t) => {
85
- t = l(t, ".vue"), t = l(t, ".json");
86
- const r = await c.request({
88
+ t = y(t, ".vue"), t = y(t, ".json");
89
+ const e = await c.request({
87
90
  path: typeof i?.remote?.apiRoutePath == "function" ? i?.remote?.apiRoutePath(t) : i?.remote?.apiRoutePath || "static",
88
91
  payload: {
89
92
  path: t
90
93
  },
91
94
  method: i?.remote?.apiMethod || "POST"
92
95
  }).then((o) => o?.data).catch((o) => {
93
- throw new Error(`${o?.message} ${t}`);
96
+ u(o);
94
97
  });
95
- let e = r?.type || ".vue";
96
- return (r?.type?.endsWith("js") || r?.type?.endsWith("ts") || r?.type?.endsWith("jsx") || r?.type?.endsWith("tsx")) && (e = ".mjs"), {
97
- content: r?.content,
98
- type: e
98
+ if (!e)
99
+ return;
100
+ let r = e?.type || ".vue";
101
+ return (e?.type?.endsWith("js") || e?.type?.endsWith("ts") || e?.type?.endsWith("jsx") || e?.type?.endsWith("tsx")) && (r = ".mjs"), {
102
+ content: e?.content,
103
+ type: r
99
104
  };
100
105
  },
101
106
  getResource({
102
107
  refPath: t,
103
- relPath: r
104
- }, e) {
108
+ relPath: e
109
+ }, r) {
105
110
  const {
106
111
  moduleCache: o,
107
- pathResolve: v,
112
+ pathResolve: x,
108
113
  getFile: w
109
- } = e, [j, ...p] = r.match(/([^!]+!)|[^!]+$/g).reverse(), x = (n, m, d, P) => p.reduce((S, C) => o[C](S, m, d, P), n), a = v({
114
+ } = r, [R, ...d] = e.match(/([^!]+!)|[^!]+$/g).reverse(), P = (n, p, m, f) => d.reduce((C, W) => o[W](C, p, m, f), n), a = x({
110
115
  refPath: t,
111
- relPath: j
112
- }, e), $ = p.join("") + a, R = (n) => n.startsWith("@") ? !0 : !n.includes("/") && !n.startsWith(".");
116
+ relPath: R
117
+ }, r), S = d.join("") + a, $ = (n) => n.startsWith("@") ? !0 : !n.includes("/") && !n.startsWith(".");
113
118
  return {
114
- id: $,
119
+ id: S,
115
120
  path: a,
116
121
  async getContent() {
117
- if (R(a))
122
+ if ($(a))
118
123
  throw new Error(`Package ${a} not imported`);
119
- const {
120
- content: n,
124
+ const n = await w(a), {
125
+ content: p,
121
126
  type: m
122
- } = await w(a);
127
+ } = n || {};
123
128
  return {
124
- getContentData: async (d) => x(n, a, m, e),
129
+ getContentData: async (f) => P(p, a, m, r),
125
130
  type: m
126
131
  };
127
132
  }
128
133
  };
129
134
  },
130
135
  addStyle(t) {
131
- const r = H(t);
132
- if (f.has(r))
136
+ const e = Q(t);
137
+ if (l.has(e))
133
138
  return;
134
- f.set(r, !0);
135
- const e = document.createElement("style");
136
- e.textContent = t, e.setAttribute("data-hash", r), document.head.appendChild(e);
139
+ l.set(e, !0);
140
+ const r = document.createElement("style");
141
+ r.textContent = t, r.setAttribute("data-hash", e), document.head.appendChild(r);
137
142
  }
138
143
  };
139
- return () => _(`${s}`, {
140
- ...g
144
+ return () => q(`${s}`, {
145
+ ...j
141
146
  });
142
147
  }
143
- function l(s, c) {
148
+ function y(s, c) {
144
149
  const u = new RegExp(`${c}$`);
145
150
  return s.replace(u, "");
146
151
  }
147
152
  export {
148
- ut as sfcLoader
153
+ ft as sfcLoader
149
154
  };
@@ -1,127 +1,130 @@
1
- import { ref as d } from "vue";
1
+ import { ref as h } from "vue";
2
2
  import { useRouter as g } from "vue-router";
3
3
  import { useAuthStore as c } from "../stores/auth.js";
4
+ import "pinia";
5
+ import "lodash-es";
6
+ import { useRouteStore as f } from "../stores/route.js";
4
7
  import { useManage as i } from "./manage.js";
5
- function w(e) {
6
- const t = i(), n = c(), u = g(), s = d(!1);
8
+ function T(e) {
9
+ const t = i(), n = c(), u = f(), s = g(), o = h(!1);
7
10
  return {
8
- mutate: async (o) => {
9
- s.value = !0;
10
- const a = await t.config.authProvider?.login(o, t);
11
- if (s.value = !1, a?.success) {
11
+ mutate: async (d) => {
12
+ o.value = !0;
13
+ const a = await t.config.authProvider?.login(d, t);
14
+ if (o.value = !1, a?.success) {
12
15
  if (!a?.data)
13
16
  throw new Error("Login response data is undefined");
14
- e?.onSuccess?.(a), n.login(a.data), u.push(t.getRoutePath(a.redirectTo || "/"));
17
+ u.resetRouteInit(), e?.onSuccess?.(a), n.login(a.data), s.push(t.getRoutePath(a.redirectTo || "/"));
15
18
  return;
16
19
  }
17
20
  e?.onError?.(a);
18
21
  },
19
- isLoading: s
22
+ isLoading: o
20
23
  };
21
24
  }
22
- function P(e) {
25
+ function p(e) {
23
26
  const t = i(), n = c(), u = g();
24
27
  return {
25
- mutate: async (r) => {
26
- const o = await t.config.authProvider?.logout(r, t);
27
- if (o?.success) {
28
- e?.onSuccess?.(o), n.logout(), await u.replace(t.getRoutePath(o.redirectTo || "/login")), setTimeout(() => {
28
+ mutate: async (o) => {
29
+ const r = await t.config.authProvider?.logout(o, t);
30
+ if (r?.success) {
31
+ e?.onSuccess?.(r), n.logout(), await u.replace(t.getRoutePath(r.redirectTo || "/login")), setTimeout(() => {
29
32
  window.location.reload();
30
33
  }, 100);
31
34
  return;
32
35
  }
33
- e?.onError?.(o);
36
+ e?.onError?.(r);
34
37
  }
35
38
  };
36
39
  }
37
- function S(e) {
38
- const t = i(), n = c(), u = g();
40
+ function y(e) {
41
+ const t = i(), n = c(), { mutate: u } = m();
39
42
  return {
40
- mutate: async (r) => {
41
- const o = await t.config.authProvider?.check?.(r, t, n.getUser());
42
- if (o?.success) {
43
- if (e?.onSuccess?.(o), !o?.data)
43
+ mutate: async (o) => {
44
+ const r = await t.config.authProvider?.check?.(o, t, n.getUser());
45
+ if (r?.success) {
46
+ if (e?.onSuccess?.(r), !r?.data)
44
47
  throw new Error("Check response data is undefined");
45
- n.update(o.data);
48
+ n.update(r.data);
46
49
  return;
47
50
  }
48
- e?.onError?.(o), o?.logout && (await u.replace(t.getRoutePath(o.redirectTo || "/login")), setTimeout(() => {
49
- window.location.reload();
50
- }, 100));
51
+ e?.onError?.(r), r?.logout && u({
52
+ status: 401,
53
+ message: r.message || "Unauthorized"
54
+ });
51
55
  }
52
56
  };
53
57
  }
54
- function T(e) {
58
+ function L(e) {
55
59
  const t = i(), n = c(), u = g();
56
60
  return {
57
- mutate: async (r) => {
58
- const o = await t.config.authProvider?.register?.(r, t);
59
- if (o?.success) {
60
- if (e?.onSuccess?.(o), !o?.data)
61
+ mutate: async (o) => {
62
+ const r = await t.config.authProvider?.register?.(o, t);
63
+ if (r?.success) {
64
+ if (e?.onSuccess?.(r), !r?.data)
61
65
  throw new Error("Register response data is undefined");
62
- n.login(o.data), u.push(t.getRoutePath(o.redirectTo || "/"));
66
+ n.login(r.data), u.push(t.getRoutePath(r.redirectTo || "/"));
63
67
  return;
64
68
  }
65
- e?.onError?.(o);
69
+ e?.onError?.(r);
66
70
  }
67
71
  };
68
72
  }
69
- function v(e) {
73
+ function U(e) {
70
74
  const t = i(), n = g();
71
75
  return {
72
76
  mutate: async (s) => {
73
- const r = await t.config.authProvider?.forgotPassword?.(s, t);
74
- if (r?.success) {
75
- e?.onSuccess?.(r), r.redirectTo && n.push(t.getRoutePath(r.redirectTo || "/"));
77
+ const o = await t.config.authProvider?.forgotPassword?.(s, t);
78
+ if (o?.success) {
79
+ e?.onSuccess?.(o), o.redirectTo && n.push(t.getRoutePath(o.redirectTo || "/"));
76
80
  return;
77
81
  }
78
- e?.onError?.(r);
82
+ e?.onError?.(o);
79
83
  }
80
84
  };
81
85
  }
82
- function E(e) {
86
+ function k(e) {
83
87
  const t = i(), n = g();
84
88
  return {
85
89
  mutate: async (s) => {
86
- const r = await t.config.authProvider?.updatePassword?.(s, t);
87
- if (r?.success) {
88
- e?.onSuccess?.(r), r.redirectTo && n.push(t.getRoutePath(r.redirectTo || "/"));
90
+ const o = await t.config.authProvider?.updatePassword?.(s, t);
91
+ if (o?.success) {
92
+ e?.onSuccess?.(o), o.redirectTo && n.push(t.getRoutePath(o.redirectTo || "/"));
89
93
  return;
90
94
  }
91
- e?.onError?.(r);
95
+ e?.onError?.(o);
92
96
  }
93
97
  };
94
98
  }
95
- function R(e) {
96
- const { config: t, getRoutePath: n } = i(), u = g(), s = c();
99
+ function m(e) {
100
+ const { config: t, getRoutePath: n } = i(), u = g(), s = c(t.name), o = f(t.name);
97
101
  return {
98
- mutate: async (o) => {
99
- const a = await t.authProvider?.onError(o);
100
- e?.(a), a?.logout && (s.logout(), await u.replace(n(a.redirectTo || "/login")), setTimeout(() => {
101
- window.location.reload();
102
+ mutate: async (d) => {
103
+ const a = await t.authProvider?.onError(d);
104
+ e?.(a), a?.logout && (await s.logout(), await o.resetRouteInit(), await u.replace(n(a.redirectTo || "/login")), setTimeout(() => {
102
105
  }, 100));
103
106
  }
104
107
  };
105
108
  }
106
- function y(e) {
109
+ function C(e) {
107
110
  return c(e).getUser();
108
111
  }
109
- function p(e) {
112
+ function I(e) {
110
113
  return c(e).isLogin();
111
114
  }
112
- function L(e) {
115
+ function A(e) {
113
116
  const t = i(e), u = c(e).getUser();
114
- return (r, o) => t.config.authProvider?.can ? t.config.authProvider.can(r, o, t, u) : !0;
117
+ return (o, r) => t.config.authProvider?.can ? t.config.authProvider.can(o, r, t, u) : !0;
115
118
  }
116
119
  export {
117
- L as useCan,
118
- S as useCheck,
119
- R as useError,
120
- v as useForgotPassword,
121
- y as useGetAuth,
122
- p as useIsLogin,
123
- w as useLogin,
124
- P as useLogout,
125
- T as useRegister,
126
- E as useUpdatePassword
120
+ A as useCan,
121
+ y as useCheck,
122
+ m as useError,
123
+ U as useForgotPassword,
124
+ C as useGetAuth,
125
+ I as useIsLogin,
126
+ T as useLogin,
127
+ p as useLogout,
128
+ L as useRegister,
129
+ k as useUpdatePassword
127
130
  };
@@ -1,21 +1,21 @@
1
1
  import { useColorMode as H, useCycleList as J } from "@vueuse/core";
2
2
  import { hex2rgb as K } from "colorizr";
3
3
  import { storeToRefs as P } from "pinia";
4
- import { watchEffect as Q, computed as f, watch as W, readonly as j } from "vue";
4
+ import { watchEffect as Q, computed as b, watch as W, readonly as L } from "vue";
5
5
  import { themeColor as X } from "../config/color.js";
6
6
  import "lodash-es";
7
7
  import { useThemeStore as Y } from "../stores/theme.js";
8
8
  import { useManage as Z } from "./manage.js";
9
9
  function ie() {
10
- const s = Y(), { mode: B } = P(s), $ = H({
11
- storageRef: B
12
- }), b = Z(), { state: S, next: V, go: v } = J(["dark", "light", "auto"], {
10
+ const s = Y(), { mode: j } = P(s), $ = H({
11
+ storageRef: j
12
+ }), u = Z(), { state: S, next: B, go: v } = J(["dark", "light", "auto"], {
13
13
  initialValue: $.store.value
14
14
  });
15
15
  Q(() => {
16
16
  $.value = S.value;
17
17
  });
18
- const M = (t) => {
18
+ const V = (t) => {
19
19
  switch (t) {
20
20
  case "auto":
21
21
  v(2);
@@ -27,15 +27,17 @@ function ie() {
27
27
  v(0);
28
28
  break;
29
29
  }
30
- }, u = f(() => {
30
+ }, d = b(() => {
31
31
  const { system: t, store: e } = $;
32
32
  return e.value === "auto" ? t.value === "dark" : e.value === "dark";
33
- }), y = f(() => u.value ? {
34
- logo: b.config?.theme?.darkLogo,
35
- banner: b.config?.theme?.darkBanner
33
+ }), M = b(() => d.value ? {
34
+ logo: u.config?.theme?.darkLogo,
35
+ appLogo: u.config?.theme?.appDarkLogo,
36
+ banner: u.config?.theme?.darkBanner
36
37
  } : {
37
- logo: b.config?.theme?.logo,
38
- banner: b.config?.theme?.banner
38
+ logo: u.config?.theme?.logo,
39
+ appLogo: u.config?.theme?.appLogo,
40
+ banner: u.config?.theme?.banner
39
41
  }), r = { ...{
40
42
  colors: X,
41
43
  // 色彩类型
@@ -65,12 +67,12 @@ function ie() {
65
67
  }
66
68
  },
67
69
  colorBase: { white: "#ffffff", black: "#000000" }
68
- }, ...b.config?.theme?.config }, { colorShades: C, colorTypes: x } = r, d = f(() => s.theme), h = f(() => Object.keys(r.colors)), k = ["default", "hover", "pressed", "focus", "disabled"];
69
- function I() {
70
- return u.value ? r.colorScenes.dark : r.colorScenes.light;
70
+ }, ...u.config?.theme?.config }, { colorShades: C, colorTypes: x } = r, f = b(() => s.theme), h = b(() => Object.keys(r.colors)), k = ["default", "hover", "pressed", "focus", "disabled"];
71
+ function y() {
72
+ return d.value ? r.colorScenes.dark : r.colorScenes.light;
71
73
  }
72
74
  function w(t, e) {
73
- const o = I(), l = o.default;
75
+ const o = y(), l = o.default;
74
76
  if (o.overrides?.[t]) {
75
77
  const i = o.overrides[t]?.[e];
76
78
  if (i)
@@ -79,39 +81,39 @@ function ie() {
79
81
  return l[e] || "500";
80
82
  }
81
83
  function T(t, e) {
82
- const o = d.value[t];
84
+ const o = f.value[t];
83
85
  return r.colors[o]?.[e] || "";
84
86
  }
85
87
  function n(t, e, o) {
86
- const c = (u.value ? r.colorSemantic.dark : r.colorSemantic.light)[t][e];
88
+ const c = (d.value ? r.colorSemantic.dark : r.colorSemantic.light)[t][e];
87
89
  return c === "white" || c === "black" ? `var(--ui-color-${c})` : `var(--base-color-${o}-${c})`;
88
90
  }
89
91
  const p = (t) => {
90
92
  const e = K(t);
91
93
  return `${e.r} ${e.g} ${e.b}`;
92
94
  };
93
- function L() {
95
+ function I() {
94
96
  const t = [];
95
97
  Object.entries(r.colors).forEach(([c, i]) => {
96
- typeof i == "object" && Object.entries(i).forEach(([a, g]) => {
98
+ typeof i == "object" && Object.entries(i).forEach(([a, m]) => {
97
99
  try {
98
- t.push(`--base-color-${c}-${a}: ${p(g)};`);
100
+ t.push(`--base-color-${c}-${a}: ${p(m)};`);
99
101
  } catch {
100
- t.push(`--base-color-${c}-${a}: ${g};`);
102
+ t.push(`--base-color-${c}-${a}: ${m};`);
101
103
  }
102
104
  });
103
105
  });
104
106
  const e = [];
105
107
  x.forEach((c) => {
106
- const i = d.value[c];
108
+ const i = f.value[c];
107
109
  C.forEach((a) => {
108
110
  e.push(`--ui-color-${c}-${a}: var(--base-color-${i}-${a});`);
109
111
  }), k.forEach((a) => {
110
- const g = w(c, a);
111
- a === "default" ? e.push(`--ui-color-${c}: var(--base-color-${i}-${g});`) : e.push(`--ui-color-${c}-${a}: var(--base-color-${i}-${g});`);
112
+ const m = w(c, a);
113
+ a === "default" ? e.push(`--ui-color-${c}: var(--base-color-${i}-${m});`) : e.push(`--ui-color-${c}-${a}: var(--base-color-${i}-${m});`);
112
114
  });
113
115
  });
114
- const o = d.value.gray, l = [
116
+ const o = f.value.gray, l = [
115
117
  `--ui-color-white: ${p(r.colorBase?.white || "#ffffff")};`,
116
118
  `--ui-color-black: ${p(r.colorBase?.black || "#000000")};`,
117
119
  `--ui-text-dimmed: ${n("text", "dimmed", o)};`,
@@ -139,15 +141,15 @@ function ie() {
139
141
  `)}
140
142
  }`;
141
143
  }
142
- let m = null;
144
+ let g = null;
143
145
  function E() {
144
- const t = L();
145
- m || (m = document.createElement("style"), m.id = "dvha-variables", document.head.appendChild(m)), m.textContent = t;
146
+ const t = I();
147
+ g || (g = document.createElement("style"), g.id = "dvha-variables", document.head.appendChild(g)), g.textContent = t;
146
148
  }
147
149
  function O() {
148
150
  s.cssInit || (s.setCssInit(), E());
149
151
  }
150
- W([d, u], () => {
152
+ W([f, d], () => {
151
153
  s.cssInit && E();
152
154
  }, { deep: !0, immediate: !1 });
153
155
  function R(t, e) {
@@ -186,18 +188,18 @@ function ie() {
186
188
  }
187
189
  return `${a}`;
188
190
  }
189
- const l = d.value.gray, i = (u.value ? r.colorSemantic.dark : r.colorSemantic.light)[t][e];
191
+ const l = f.value.gray, i = (d.value ? r.colorSemantic.dark : r.colorSemantic.light)[t][e];
190
192
  return i === "white" ? r.colorBase?.white || "#ffffff" : i === "black" ? r.colorBase?.black || "#000000" : r.colors[l]?.[i] || "";
191
193
  }
192
- const A = f(() => h.value?.filter((t) => ["slate", "gray", "zinc", "neutral", "stone"].includes(t))), F = f(() => h.value?.filter((t) => !["slate", "gray", "zinc", "neutral", "stone"].includes(t)));
194
+ const A = b(() => h.value?.filter((t) => ["slate", "gray", "zinc", "neutral", "stone"].includes(t))), F = b(() => h.value?.filter((t) => !["slate", "gray", "zinc", "neutral", "stone"].includes(t)));
193
195
  return {
194
- toggle: V,
196
+ toggle: B,
195
197
  mode: S,
196
- setMode: M,
197
- isDark: u,
198
- resources: y,
199
- config: j(r),
200
- colorMapping: j(d),
198
+ setMode: V,
199
+ isDark: d,
200
+ resources: M,
201
+ config: L(r),
202
+ colorMapping: L(f),
201
203
  colors: h,
202
204
  neutralColors: A,
203
205
  primaryColors: F,
@@ -1,7 +1,7 @@
1
1
  import i from "axios";
2
2
  function o(a) {
3
3
  return {
4
- login: async (s, r) => await i.post(r.getApiUrl(a?.apiPath?.login || "/login", a?.dataProviderName), s).then((e) => ({
4
+ login: async (t, r) => await i.post(r.getApiUrl(a?.apiPath?.login || "/login", a?.dataProviderName), t).then((e) => ({
5
5
  success: !0,
6
6
  message: e?.data?.message,
7
7
  redirectTo: a?.routePath?.index || "/",
@@ -10,33 +10,33 @@ function o(a) {
10
10
  success: !1,
11
11
  message: e?.response?.data?.message || e?.message
12
12
  })),
13
- check: async (s, r, e) => await i.get(r?.getApiUrl(a?.apiPath?.check || "/check", a?.dataProviderName) || "", {
13
+ check: async (t, r, e) => await i.get(r?.getApiUrl(a?.apiPath?.check || "/check", a?.dataProviderName) || "", {
14
14
  headers: {
15
15
  Authorization: e?.token || ""
16
16
  }
17
- }).then((t) => ({
17
+ }).then((s) => ({
18
18
  success: !0,
19
19
  logout: !1,
20
- message: t?.data?.message,
21
- data: t?.data?.data
22
- })).catch((t) => ({
20
+ message: s?.data?.message,
21
+ data: s?.data?.data
22
+ })).catch((s) => ({
23
23
  success: !1,
24
- logout: !0,
25
- message: t?.response?.data?.message || t?.message
24
+ logout: s.status === 401,
25
+ message: s?.response?.data?.message || s?.message
26
26
  })),
27
- onError: async (s) => s?.status === 401 ? {
27
+ onError: async (t) => t?.status === 401 ? {
28
28
  logout: !0,
29
29
  redirectTo: a?.routePath?.login || "/login",
30
- error: s
30
+ error: t
31
31
  } : {
32
32
  logout: !1,
33
- error: s
33
+ error: t
34
34
  },
35
35
  logout: async () => ({
36
36
  success: !0,
37
37
  redirectTo: a?.routePath?.login || "/login"
38
38
  }),
39
- register: async (s, r) => await i.post(r?.getApiUrl(a?.apiPath?.register || "/register", a?.dataProviderName) || "", s).then((e) => ({
39
+ register: async (t, r) => await i.post(r?.getApiUrl(a?.apiPath?.register || "/register", a?.dataProviderName) || "", t).then((e) => ({
40
40
  success: !0,
41
41
  message: e?.data?.message,
42
42
  redirectTo: a?.routePath?.index || "/",
@@ -45,7 +45,7 @@ function o(a) {
45
45
  success: !1,
46
46
  message: e?.response?.data?.message || e?.message
47
47
  })),
48
- forgotPassword: async (s, r) => await i.post(r?.getApiUrl(a?.apiPath?.forgotPassword || "/forgot-password", a?.dataProviderName) || "", s).then((e) => ({
48
+ forgotPassword: async (t, r) => await i.post(r?.getApiUrl(a?.apiPath?.forgotPassword || "/forgot-password", a?.dataProviderName) || "", t).then((e) => ({
49
49
  success: !0,
50
50
  message: e?.data?.message,
51
51
  redirectTo: a?.routePath?.login || "/login"
@@ -53,7 +53,7 @@ function o(a) {
53
53
  success: !1,
54
54
  message: e?.response?.data?.message || e?.message
55
55
  })),
56
- updatePassword: async (s, r) => await i.post(r?.getApiUrl(a?.apiPath?.updatePassword || "/update-password", a?.dataProviderName) || "", s).then((e) => ({
56
+ updatePassword: async (t, r) => await i.post(r?.getApiUrl(a?.apiPath?.updatePassword || "/update-password", a?.dataProviderName) || "", t).then((e) => ({
57
57
  success: !0,
58
58
  message: e?.data?.message,
59
59
  redirectTo: a?.routePath?.login || "/login"
@@ -61,7 +61,7 @@ function o(a) {
61
61
  success: !1,
62
62
  message: e?.response?.data?.message || e?.message
63
63
  })),
64
- can: (s, r, e, t) => !t?.permission || Array.isArray(t?.permission) && t?.permission?.length === 0 || typeof t?.permission == "object" && Object.keys(t?.permission).length === 0 ? !0 : !(Array.isArray(t?.permission) && !t?.permission?.includes(s) || typeof t?.permission == "object" && t?.permission[s] === !1)
64
+ can: (t, r, e, s) => !s?.permission || Array.isArray(s?.permission) && s?.permission?.length === 0 || typeof s?.permission == "object" && Object.keys(s?.permission).length === 0 ? !0 : !(Array.isArray(s?.permission) && !s?.permission?.includes(t) || typeof s?.permission == "object" && s?.permission[t] === !1)
65
65
  };
66
66
  }
67
67
  export {
@@ -1,14 +1,14 @@
1
- import { defineStore as g } from "pinia";
2
- import { inject as m, ref as l } from "vue";
3
- function E(r) {
4
- const t = m("dux.manage");
1
+ import { defineStore as S } from "pinia";
2
+ import { inject as g, ref as l } from "vue";
3
+ function F(r) {
4
+ const t = g("dux.manage");
5
5
  if (r || (r = t?.value || ""), !r)
6
6
  throw new Error("manage not found");
7
- return I(r)();
7
+ return m(r)();
8
8
  }
9
- function I(r) {
10
- return g(`routes-${r}`, () => {
11
- const t = l([]), a = (e) => t.value?.find((n) => n.path === e), f = (e) => t.value?.find((n) => n.name === e), d = (e) => {
9
+ function m(r) {
10
+ return S(`routes-${r}`, () => {
11
+ const t = l([]), i = (e) => t.value?.find((n) => n.path === e), f = (e) => t.value?.find((n) => n.name === e), d = (e) => {
12
12
  t.value?.push(e);
13
13
  }, v = (e) => {
14
14
  t.value = [...t.value, ...e];
@@ -16,7 +16,7 @@ function I(r) {
16
16
  t.value = e;
17
17
  }, p = () => t.value, h = () => {
18
18
  t.value = [];
19
- }, S = () => {
19
+ }, I = () => {
20
20
  const e = t.value?.filter((o) => !o.parent && !o.name?.includes("404") && !o.name?.includes("403"))?.sort((o, u) => (o.sort || 0) - (u.sort || 0)), n = (o) => {
21
21
  if (o.path)
22
22
  return o;
@@ -32,24 +32,27 @@ function I(r) {
32
32
  if (u)
33
33
  return u;
34
34
  }
35
- }, i = l(!1);
35
+ }, a = l(!1);
36
36
  return {
37
37
  routes: t,
38
- searchRoute: a,
38
+ searchRoute: i,
39
39
  searchRouteName: f,
40
40
  appendRoute: d,
41
41
  appendRoutes: v,
42
42
  setRoutes: R,
43
43
  getRoutes: p,
44
44
  clearRoutes: h,
45
- getIndexRoute: S,
45
+ getIndexRoute: I,
46
46
  getRouteInit: () => {
47
- const e = i.value;
48
- return i.value = !0, e;
47
+ const e = a.value;
48
+ return a.value = !0, e;
49
+ },
50
+ resetRouteInit: () => {
51
+ a.value = !1;
49
52
  }
50
53
  };
51
54
  });
52
55
  }
53
56
  export {
54
- E as useRouteStore
57
+ F as useRouteStore
55
58
  };
@@ -11,10 +11,11 @@ export interface RouteStoreState {
11
11
  clearRoutes: () => void;
12
12
  getIndexRoute: () => IMenu | undefined;
13
13
  getRouteInit: () => boolean;
14
+ resetRouteInit: () => void;
14
15
  }
15
16
  /**
16
17
  * use route store
17
18
  * @param manageName manage name
18
19
  * @returns route store
19
20
  */
20
- export declare function useRouteStore(manageName?: string): import("pinia").Store<string, Pick<RouteStoreState, "routes">, Pick<RouteStoreState, never>, Pick<RouteStoreState, "searchRoute" | "searchRouteName" | "appendRoute" | "appendRoutes" | "setRoutes" | "getRoutes" | "clearRoutes" | "getIndexRoute" | "getRouteInit">>;
21
+ export declare function useRouteStore(manageName?: string): import("pinia").Store<string, Pick<RouteStoreState, "routes">, Pick<RouteStoreState, never>, Pick<RouteStoreState, "searchRoute" | "searchRouteName" | "appendRoute" | "appendRoutes" | "setRoutes" | "getRoutes" | "clearRoutes" | "getIndexRoute" | "getRouteInit" | "resetRouteInit">>;
@@ -3,12 +3,16 @@ import type { ThemeState } from '../stores';
3
3
  export interface IConfigTheme {
4
4
  logo?: string;
5
5
  darkLogo?: string;
6
+ appLogo?: string;
7
+ appDarkLogo?: string;
6
8
  banner?: string;
7
9
  darkBanner?: string;
8
10
  config?: ThemeConfig;
9
11
  defaultTheme?: ThemeState;
12
+ [key: string]: any;
10
13
  }
11
14
  export interface ITheme {
12
15
  logo?: string;
16
+ appLogo?: string;
13
17
  banner?: string;
14
18
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "1.0.39",
4
+ "version": "1.0.41",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {