@duxweb/dvha-core 1.0.17 → 1.0.19

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.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("vue-router");require("pinia");const o=require("../../hooks/manage.cjs");require("@tanstack/vue-query");require("json-2-csv");require("lodash-es");require("@vee-validate/rules");require("vee-validate");require("@vueuse/core");require("../../hooks/json/index.cjs");require("../../utils/bus.cjs");require("@overlastic/vue");require("clsx");const t=require("../status/exception.cjs");require("colorizr");require("axios");require("crypto-js");require("dayjs");require("mathjs");require("mime");require("mitt");require("vue3-sfc-loader");require("pinia-plugin-persistedstate");require("vue-i18n");const q=require("./remote/render.cjs"),a=e.defineComponent({name:"DuxLoaderRemote",setup(l){const{config:i}=o.useManage(),n=()=>{var u;const r=(u=i.components)==null?void 0:u.loading;return r?e.h(r):null};return()=>e.createVNode("div",{class:"app-remote-loader"},[e.createVNode(t.DuxException,null,{default:()=>[e.createVNode(e.Suspense,null,{default:()=>e.createVNode(q.DuxRemoteRender,null,null),fallback:()=>n()})]})])}});exports.default=a;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("../status/exception.cjs");require("@tanstack/vue-query");require("@vueuse/core");require("axios");require("crypto-js");require("dayjs");require("lodash-es");require("mathjs");require("mime");require("mitt");require("pinia");require("vue3-sfc-loader");require("vue-router");require("json-2-csv");require("@vee-validate/rules");require("vee-validate");require("../../hooks/json/index.cjs");require("../../utils/bus.cjs");require("@overlastic/vue");require("clsx");require("colorizr");require("pinia-plugin-persistedstate");require("vue-i18n");const u=require("./remote/render.cjs"),i=e.defineComponent({name:"DuxLoaderRemote",setup(q){return()=>e.createVNode("div",{class:"app-remote-loader"},[e.createVNode(r.DuxException,null,{default:()=>[e.createVNode(u.DuxRemoteRender,null,null)]})])}});exports.default=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("vue"),x=require("@tanstack/vue-query"),M=require("@vueuse/core"),T=require("axios"),b=require("crypto-js"),k=require("dayjs"),E=require("lodash-es"),L=require("mathjs"),g=require("mime"),J=require("mitt"),N=require("pinia"),V=require("vue3-sfc-loader"),W=require("vue-router"),D=require("../../../hooks/manage.cjs"),F=require("../../../hooks/data.cjs");require("json-2-csv");require("@vee-validate/rules");require("vee-validate");const Q=require("../../../hooks/i18n.cjs"),U=require("../../../hooks/json.cjs");require("../../../hooks/json/index.cjs");require("../../../utils/bus.cjs");require("@overlastic/vue");require("clsx");require("colorizr");const z=require("../../../index.cjs");function d(a){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const u in a)if(u!=="default"){const n=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(c,u,n.get?n:{enumerable:!0,get:()=>a[u]})}}return c.default=a,Object.freeze(c)}const A=d(w),B=d(x),H=d(M),I=d(E),G=d(L),K=d(N),X=d(W),v=new Map;function Y(a){return b.MD5(a).toString().substring(0,10)}function Z(a){var y;const c=F.useClient(),{mergeLocale:u}=Q.useI18n(),{config:n}=D.useManage(),S={moduleCache:{vue:A,"@duxweb/dvha-core":z,"@vueuse/core":H,"@tanstack/vue-query":B,axios:T,crypto:b,mime:g,math:G,mitt:J,"lodash-es":I,pinia:K,dayjs:k,"vue-router":X,...(y=n==null?void 0:n.remote)==null?void 0:y.packages,"static!":function(t,r,e){const o=g.getType(e);if(o!=null&&o.startsWith("image"))return`data:${o};charset=utf-8;base64,${btoa(t)}`;if(e===".json")return JSON.parse(t);throw new Error(`${e} unable to parse`)}},async handleModule(t,r){if(t!==".vue"){if(t===".json"){const e=await r(),{render:o}=U.useJsonSchema({data:(e==null?void 0:e.nodes)||{},context:(e==null?void 0:e.data)||{}});return()=>w.createVNode(o,null,null)}return r()}},customBlockHandler(t){if(t.type==="i18n"){const r=JSON.parse(t.content);for(const e in r)u(e,r[e])}},getFile:async t=>{var e,o,l,m;t=_(t,".vue"),t=_(t,".json");const r=await c.request({path:typeof((e=n==null?void 0:n.remote)==null?void 0:e.apiRoutePath)=="function"?(o=n==null?void 0:n.remote)==null?void 0:o.apiRoutePath(t):((l=n==null?void 0:n.remote)==null?void 0:l.apiRoutePath)||"static",payload:{path:t},method:((m=n==null?void 0:n.remote)==null?void 0:m.apiMethod)||"POST"}).then(s=>s==null?void 0:s.data).catch(s=>{throw new Error(`${s==null?void 0:s.message} ${t}`)});return await setTimeout(()=>{console.log("res",r)},1e4),{getContentData:()=>r==null?void 0:r.content,type:`${(r==null?void 0:r.type)||"vue"}`}},getResource({refPath:t,relPath:r},e){const{moduleCache:o,pathResolve:l,getFile:m}=e,[s,...f]=r.match(/([^!]+!)|[^!]+$/g).reverse(),j=(i,p,q,R)=>f.reduce((C,O)=>o[O](C,p,q,R),i),h=l({refPath:t,relPath:s},e),P=f.join("")+h,$=i=>i.startsWith("@")?!0:!i.includes("/")&&!i.startsWith(".");return{id:P,path:h,async getContent(){if($(h))throw new Error(`Package ${h} not imported`);const{getContentData:i,type:p}=await m(h);return{getContentData:async q=>j(await i(q),h,p,e),type:p}}}},addStyle(t){const r=Y(t);if(v.has(r))return;v.set(r,!0);const e=document.createElement("style");e.textContent=t,e.setAttribute("data-hash",r),document.head.appendChild(e)}};return()=>V.loadModule(`${a}`,{...S})}function _(a,c){const u=new RegExp(`${c}$`);return a.replace(u,"")}exports.sfcLoader=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("vue"),x=require("@tanstack/vue-query"),M=require("@vueuse/core"),k=require("axios"),b=require("crypto-js"),E=require("dayjs"),L=require("lodash-es"),T=require("mathjs"),g=require("mime"),J=require("mitt"),N=require("pinia"),V=require("vue3-sfc-loader"),W=require("vue-router"),D=require("../../../hooks/manage.cjs"),F=require("../../../hooks/data.cjs");require("json-2-csv");require("@vee-validate/rules");require("vee-validate");const Q=require("../../../hooks/i18n.cjs"),U=require("../../../hooks/json.cjs");require("../../../hooks/json/index.cjs");require("../../../utils/bus.cjs");require("@overlastic/vue");require("clsx");require("colorizr");const z=require("../../../index.cjs");function d(a){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const u in a)if(u!=="default"){const n=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(c,u,n.get?n:{enumerable:!0,get:()=>a[u]})}}return c.default=a,Object.freeze(c)}const A=d(w),B=d(x),H=d(M),I=d(L),G=d(T),K=d(N),X=d(W),v=new Map;function Y(a){return b.MD5(a).toString().substring(0,10)}function Z(a){var y;const c=F.useClient(),{mergeLocale:u}=Q.useI18n(),{config:n}=D.useManage(),S={moduleCache:{vue:A,"@duxweb/dvha-core":z,"@vueuse/core":H,"@tanstack/vue-query":B,axios:k,crypto:b,mime:g,math:G,mitt:J,"lodash-es":I,pinia:K,dayjs:E,"vue-router":X,...(y=n==null?void 0:n.remote)==null?void 0:y.packages,"static!":function(t,r,e){const o=g.getType(e);if(o!=null&&o.startsWith("image"))return`data:${o};charset=utf-8;base64,${btoa(t)}`;if(e===".json")return JSON.parse(t);throw new Error(`${e} unable to parse`)}},async handleModule(t,r){if(t!==".vue"){if(t===".json"){const e=await r(),{render:o}=U.useJsonSchema({data:(e==null?void 0:e.nodes)||{},context:(e==null?void 0:e.data)||{}});return()=>w.createVNode(o,null,null)}return r()}},customBlockHandler(t){if(t.type==="i18n"){const r=JSON.parse(t.content);for(const e in r)u(e,r[e])}},getFile:async t=>{var e,o,m,l;t=_(t,".vue"),t=_(t,".json");const r=await c.request({path:typeof((e=n==null?void 0:n.remote)==null?void 0:e.apiRoutePath)=="function"?(o=n==null?void 0:n.remote)==null?void 0:o.apiRoutePath(t):((m=n==null?void 0:n.remote)==null?void 0:m.apiRoutePath)||"static",payload:{path:t},method:((l=n==null?void 0:n.remote)==null?void 0:l.apiMethod)||"POST"}).then(s=>s==null?void 0:s.data).catch(s=>{throw new Error(`${s==null?void 0:s.message} ${t}`)});return{getContentData:()=>r==null?void 0:r.content,type:`${(r==null?void 0:r.type)||"vue"}`}},getResource({refPath:t,relPath:r},e){const{moduleCache:o,pathResolve:m,getFile:l}=e,[s,...f]=r.match(/([^!]+!)|[^!]+$/g).reverse(),j=(i,p,q,R)=>f.reduce((C,O)=>o[O](C,p,q,R),i),h=m({refPath:t,relPath:s},e),P=f.join("")+h,$=i=>i.startsWith("@")?!0:!i.includes("/")&&!i.startsWith(".");return{id:P,path:h,async getContent(){if($(h))throw new Error(`Package ${h} not imported`);const{getContentData:i,type:p}=await l(h);return{getContentData:async q=>j(await i(q),h,p,e),type:p}}}},addStyle(t){const r=Y(t);if(v.has(r))return;v.set(r,!0);const e=document.createElement("style");e.textContent=t,e.setAttribute("data-hash",r),document.head.appendChild(e)}};return()=>V.loadModule(`${a}`,{...S})}function _(a,c){const u=new RegExp(`${c}$`);return a.replace(u,"")}exports.sfcLoader=Z;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("vue"),h=require("vue-router"),d=require("../stores/auth.cjs"),s=require("./manage.cjs");function P(t){const n=s.useManage(),o=d.useAuthStore(),r=h.useRouter(),g=S.ref(!1);return{mutate:async e=>{var c,i,f;g.value=!0;const u=await((c=n.config.authProvider)==null?void 0:c.login(e,n));if(g.value=!1,u!=null&&u.success){if(!(u!=null&&u.data))throw new Error("Login response data is undefined");(i=t==null?void 0:t.onSuccess)==null||i.call(t,u),o.login(u.data),r.push(n.getRoutePath(u.redirectTo||"/"));return}(f=t==null?void 0:t.onError)==null||f.call(t,u)},isLoading:g}}function m(t){const n=s.useManage(),o=d.useAuthStore(),r=h.useRouter();return{mutate:async a=>{var u,c,i;const e=await((u=n.config.authProvider)==null?void 0:u.logout(a,n));if(e!=null&&e.success){(c=t==null?void 0:t.onSuccess)==null||c.call(t,e),o.logout(),r.push(n.getRoutePath(e.redirectTo||"/login"));return}(i=t==null?void 0:t.onError)==null||i.call(t,e)}}}function w(t){const n=s.useManage(),o=d.useAuthStore(),r=h.useRouter();return{mutate:async a=>{var u,c,i;const e=await((u=n.config.authProvider)==null?void 0:u.check(a,n));if(e!=null&&e.success){if((c=t==null?void 0:t.onSuccess)==null||c.call(t,e),!(e!=null&&e.data))throw new Error("Check response data is undefined");o.update(e.data);return}(i=t==null?void 0:t.onError)==null||i.call(t,e),e!=null&&e.logout&&r.push(n.getRoutePath(e.redirectTo||"/login"))}}}function R(t){const n=s.useManage(),o=d.useAuthStore(),r=h.useRouter();return{mutate:async a=>{var u,c,i,f;const e=await((c=(u=n.config.authProvider)==null?void 0:u.register)==null?void 0:c.call(u,a,n));if(e!=null&&e.success){if((i=t==null?void 0:t.onSuccess)==null||i.call(t,e),!(e!=null&&e.data))throw new Error("Register response data is undefined");o.login(e.data),r.push(n.getRoutePath(e.redirectTo||""));return}(f=t==null?void 0:t.onError)==null||f.call(t,e)}}}function v(t){const n=s.useManage(),o=h.useRouter();return{mutate:async g=>{var e,u,c,i;const a=await((u=(e=n.config.authProvider)==null?void 0:e.forgotPassword)==null?void 0:u.call(e,g,n));if(a!=null&&a.success){(c=t==null?void 0:t.onSuccess)==null||c.call(t,a),a.redirectTo&&o.push(n.getRoutePath(a.redirectTo));return}(i=t==null?void 0:t.onError)==null||i.call(t,a)}}}function E(t){const n=s.useManage(),o=h.useRouter();return{mutate:async g=>{var e,u,c,i;const a=await((u=(e=n.config.authProvider)==null?void 0:e.updatePassword)==null?void 0:u.call(e,g,n));if(a!=null&&a.success){(c=t==null?void 0:t.onSuccess)==null||c.call(t,a),a.redirectTo&&o.push(n.getRoutePath(a.redirectTo));return}(i=t==null?void 0:t.onError)==null||i.call(t,a)}}}function T(t){const{config:n,getRoutePath:o}=s.useManage(),r=h.useRouter();return{mutate:async a=>{var u;const e=await((u=n.authProvider)==null?void 0:u.onError(a));t==null||t(e),e!=null&&e.logout&&r.push(o(e.redirectTo||"/login"))}}}function y(t){return d.useAuthStore(t).getUser()}function A(t){return d.useAuthStore(t).isLogin()}function L(t){const n=s.useManage(t),r=d.useAuthStore(t).getUser();return(a,e)=>{var u;return(u=n.config.authProvider)!=null&&u.can?n.config.authProvider.can(a,e,n,r):!0}}exports.useCan=L;exports.useCheck=w;exports.useError=T;exports.useForgotPassword=v;exports.useGetAuth=y;exports.useIsLogin=A;exports.useLogin=P;exports.useLogout=m;exports.useRegister=R;exports.useUpdatePassword=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("vue"),d=require("vue-router"),h=require("../stores/auth.cjs"),s=require("./manage.cjs");function m(e){const n=s.useManage(),o=h.useAuthStore(),r=d.useRouter(),g=S.ref(!1);return{mutate:async t=>{var c,i,f;g.value=!0;const u=await((c=n.config.authProvider)==null?void 0:c.login(t,n));if(g.value=!1,u!=null&&u.success){if(!(u!=null&&u.data))throw new Error("Login response data is undefined");(i=e==null?void 0:e.onSuccess)==null||i.call(e,u),o.login(u.data),r.push(n.getRoutePath(u.redirectTo||"/"));return}(f=e==null?void 0:e.onError)==null||f.call(e,u)},isLoading:g}}function P(e){const n=s.useManage(),o=h.useAuthStore(),r=d.useRouter();return{mutate:async a=>{var u,c,i;const t=await((u=n.config.authProvider)==null?void 0:u.logout(a,n));if(t!=null&&t.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,t),o.logout(),await r.replace(n.getRoutePath(t.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100);return}(i=e==null?void 0:e.onError)==null||i.call(e,t)}}}function w(e){const n=s.useManage(),o=h.useAuthStore(),r=d.useRouter();return{mutate:async a=>{var u,c,i;const t=await((u=n.config.authProvider)==null?void 0:u.check(a,n));if(t!=null&&t.success){if((c=e==null?void 0:e.onSuccess)==null||c.call(e,t),!(t!=null&&t.data))throw new Error("Check response data is undefined");o.update(t.data);return}(i=e==null?void 0:e.onError)==null||i.call(e,t),t!=null&&t.logout&&r.push(n.getRoutePath(t.redirectTo||"/login"))}}}function R(e){const n=s.useManage(),o=h.useAuthStore(),r=d.useRouter();return{mutate:async a=>{var u,c,i,f;const t=await((c=(u=n.config.authProvider)==null?void 0:u.register)==null?void 0:c.call(u,a,n));if(t!=null&&t.success){if((i=e==null?void 0:e.onSuccess)==null||i.call(e,t),!(t!=null&&t.data))throw new Error("Register response data is undefined");o.login(t.data),r.push(n.getRoutePath(t.redirectTo||""));return}(f=e==null?void 0:e.onError)==null||f.call(e,t)}}}function v(e){const n=s.useManage(),o=d.useRouter();return{mutate:async g=>{var t,u,c,i;const a=await((u=(t=n.config.authProvider)==null?void 0:t.forgotPassword)==null?void 0:u.call(t,g,n));if(a!=null&&a.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,a),a.redirectTo&&o.push(n.getRoutePath(a.redirectTo));return}(i=e==null?void 0:e.onError)==null||i.call(e,a)}}}function E(e){const n=s.useManage(),o=d.useRouter();return{mutate:async g=>{var t,u,c,i;const a=await((u=(t=n.config.authProvider)==null?void 0:t.updatePassword)==null?void 0:u.call(t,g,n));if(a!=null&&a.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,a),a.redirectTo&&o.push(n.getRoutePath(a.redirectTo));return}(i=e==null?void 0:e.onError)==null||i.call(e,a)}}}function T(e){const{config:n,getRoutePath:o}=s.useManage(),r=d.useRouter();return{mutate:async a=>{var u;const t=await((u=n.authProvider)==null?void 0:u.onError(a));e==null||e(t),t!=null&&t.logout&&r.push(o(t.redirectTo||"/login"))}}}function y(e){return h.useAuthStore(e).getUser()}function A(e){return h.useAuthStore(e).isLogin()}function L(e){const n=s.useManage(e),r=h.useAuthStore(e).getUser();return(a,t)=>{var u;return(u=n.config.authProvider)!=null&&u.can?n.config.authProvider.can(a,t,n,r):!0}}exports.useCan=L;exports.useCheck=w;exports.useError=T;exports.useForgotPassword=v;exports.useGetAuth=y;exports.useIsLogin=A;exports.useLogin=m;exports.useLogout=P;exports.useRegister=R;exports.useUpdatePassword=E;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("@tanstack/vue-query"),i=require("vue"),h=require("./auth.cjs"),P=require("./manage.cjs");function C(e){var E;const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),s=i.toRef(e.pagination?e.pagination:{page:1,pageSize:20}),n=i.computed(()=>{const{onError:v,options:M,pagination:y,...$}=e;return $});i.watch(n,()=>{e.pagination&&(s.value.page=1)},{deep:!0});const d=i.computed(()=>({...n.value,pagination:e.pagination?s.value:void 0})),c=N.useQuery({queryKey:[`${(E=r.config)==null?void 0:E.name}:${g}:${e.path}`,d],queryFn:()=>{var v,M,y;return(y=(M=(v=r.config)==null?void 0:v.dataProvider)==null?void 0:M[g])==null?void 0:y.getList(d.value,r,a)},...e.options}),o=i.computed(()=>c.isFetching.value);i.watch(()=>c.isError,()=>{var v;l(c.error),(v=e.onError)==null||v.call(e,c.error)});const t=i.ref(void 0),u=i.ref(0),f=i.ref(0);return i.watch(c.data,v=>{var M,y,$,q;v&&(t.value=v,u.value=((q=($=(y=(M=r.config)==null?void 0:M.dataProvider)==null?void 0:y[g])==null?void 0:$.getTotal)==null?void 0:q.call($,v))||0,f.value=Math.ceil(u.value/(s.value.pageSize||20))||0)},{immediate:!0}),{...c,isLoading:o,data:t,refetch:c.refetch,pagination:s,total:u,pageCount:f}}function D(e){var E;const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),s=i.toRef(e,"pagination",{page:1,pageSize:20}),n=i.computed(()=>{const{onError:v,options:M,pagination:y,...$}=e;return $});i.watch(n,()=>{s.value.page=1},{deep:!0});const d=i.ref(0),c=i.ref(0),o=N.useInfiniteQuery({queryKey:[`${(E=r.config)==null?void 0:E.name}:${g}:${e.path}`,n],queryFn:({pageParam:v})=>{var M,y,$;return s.value.page=v,($=(y=(M=r.config)==null?void 0:M.dataProvider)==null?void 0:y[g])==null?void 0:$.getList({...n.value,pagination:{...s.value,page:v}},r,a)},initialPageParam:1,getNextPageParam:(v,M,y)=>{var S,w,F,L,z;if(!(v!=null&&v.data)||((S=v==null?void 0:v.data)==null?void 0:S.length)===0)return;const $=((z=(L=(F=(w=r.config)==null?void 0:w.dataProvider)==null?void 0:F[g])==null?void 0:L.getTotal)==null?void 0:z.call(L,v))||0;if(c.value=Math.ceil($/(s.value.pageSize||20))||0,d.value=$,!(y*(s.value.pageSize||20)>=$))return y+1},getPreviousPageParam:(v,M,y)=>{var q,S,w,F;if(y<=1)return;const $=((F=(w=(S=(q=r.config)==null?void 0:q.dataProvider)==null?void 0:S[g])==null?void 0:w.getTotal)==null?void 0:F.call(w,v))||0;return c.value=Math.ceil($/(s.value.pageSize||20))||0,d.value=$,y-1},...e.options}),t=i.computed(()=>o.isFetching.value);i.watch(()=>o.isError,()=>{var v;l(o.error),(v=e.onError)==null||v.call(e,o.error)});const u=()=>{if(!(!o.hasNextPage.value||o.isFetching.value))return o.fetchNextPage()},f=i.ref(void 0);return i.watch(o.data,v=>{if(!(v!=null&&v.pages)||v.pages.length===0)return;const M=v.pages.reduce(($,q)=>q!=null&&q.data&&q.data.length>0?$.concat(q.data):$,[]),y=v.pages[0];y&&(f.value={...y,data:M})},{deep:!0,immediate:!0}),{...o,isLoading:t,data:f,fetchNextPage:u,hasNextPage:o.hasNextPage,refetch:o.refetch,pagination:s,total:d,pageCount:c}}function G(e){var o;const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),s=i.computed(()=>{const{onError:t,options:u,...f}=e;return f}),n=N.useQuery({queryKey:[`${(o=r.config)==null?void 0:o.name}:${g}:${e.path}`,s],queryFn:()=>{var t,u,f;return(f=(u=(t=r.config)==null?void 0:t.dataProvider)==null?void 0:u[g])==null?void 0:f.getOne(s.value,r,a)},...e.options}),d=i.computed(()=>n.isFetched.value?!1:n.isFetching.value);i.watch(()=>n.isError,()=>{var t;l(n.error),(t=e.onError)==null||t.call(e,n.error)});const c=i.ref(void 0);return i.watch(n.data,t=>{t&&(c.value=t)},{immediate:!0}),{...n,isLoading:d,data:c,refetch:n.refetch}}function Q(e){var o;const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),s=i.computed(()=>{const{onError:t,options:u,...f}=e;return f}),n=N.useQuery({queryKey:[`${(o=r.config)==null?void 0:o.name}:${g}:${e.path}`,s],queryFn:()=>{var t,u,f;return(f=(u=(t=r.config)==null?void 0:t.dataProvider)==null?void 0:u[g])==null?void 0:f.getMany(s.value,r,a)},...e.options}),d=i.computed(()=>n.isFetched.value?!1:n.isFetching.value);i.watch(()=>n.isError,()=>{var t;l(n.error),(t=e.onError)==null||t.call(e,n.error)});const c=i.ref(void 0);return i.watch(n.data,t=>{t&&(c.value=t)},{immediate:!0}),{...n,isLoading:d,data:c,refetch:n.refetch}}function T(e){const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),{invalidate:s}=A(),n=i.computed(()=>{const{onError:o,options:t,...u}=e;return u}),d=N.useMutation({mutationFn:o=>{var t,u,f,E;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return(E=(f=(u=r.config)==null?void 0:u.dataProvider)==null?void 0:f[g])==null?void 0:E.create({...n.value,...o},r,a)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&s(e.path)},onError:o=>{var t;l(o),(t=e.onError)==null||t.call(e,o)},...e.options}),c=i.computed(()=>d.isPending.value);return{...d,isLoading:c,mutate:d.mutate}}function x(e){const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),{invalidate:s}=A(),n=i.computed(()=>{const{onError:o,options:t,...u}=e;return u}),d=N.useMutation({mutationFn:o=>{var t,u,f,E;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return(E=(f=(u=r.config)==null?void 0:u.dataProvider)==null?void 0:f[g])==null?void 0:E.createMany({...n.value,...o},r,a)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&s(e.path)},onError:o=>{var t;l(o),(t=e.onError)==null||t.call(e,o)},...e.options}),c=i.computed(()=>d.isPending.value);return{...d,isLoading:c,mutate:d.mutate}}function K(e){const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),{invalidate:s}=A(),n=i.computed(()=>{const{onError:o,options:t,...u}=e;return u}),d=N.useMutation({mutationFn:o=>{var t,u,f,E;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return(E=(f=(u=r.config)==null?void 0:u.dataProvider)==null?void 0:f[g])==null?void 0:E.update({...n.value,...o},r,a)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&s(e.path)},onError:o=>{var t;l(o),(t=e.onError)==null||t.call(e,o)},...e.options}),c=i.computed(()=>d.isPending.value);return{...d,isLoading:c,mutate:d.mutate}}function I(e){const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),{invalidate:s}=A(),n=i.computed(()=>{const{onError:o,options:t,...u}=e;return u}),d=N.useMutation({mutationFn:o=>{var t,u,f,E;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return(E=(f=(u=r.config)==null?void 0:u.dataProvider)==null?void 0:f[g])==null?void 0:E.updateMany({...n.value,...o},r,a)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&s(e.path)},onError:o=>{var t;l(o),(t=e.onError)==null||t.call(e,o)},...e.options}),c=i.computed(()=>d.isPending.value);return{...d,isLoading:c,mutate:d.mutate}}function O(e){const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),{invalidate:s}=A(),n=i.computed(()=>{const{onError:o,options:t,...u}=e;return u}),d=N.useMutation({mutationFn:o=>{var t,u,f,E;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return(E=(f=(u=r.config)==null?void 0:u.dataProvider)==null?void 0:f[g])==null?void 0:E.deleteOne({...n.value,...o},r,a)},onSuccess:o=>{var t;d.reset(),(t=e.onSuccess)==null||t.call(e,o),e.path&&s(e.path)},onError:o=>{var t;l(o),(t=e.onError)==null||t.call(e,o)},...e.options}),c=i.computed(()=>d.isPending.value);return{...d,isLoading:c,mutate:d.mutate}}function U(e){const r=P.useManage(),a=h.useGetAuth(),g=e.providerName||"default",{mutate:l}=h.useError(),{invalidate:s}=A(),n=i.computed(()=>{const{onError:o,options:t,...u}=e;return u}),d=N.useMutation({mutationFn:o=>{var t,u,f,E;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return(E=(f=(u=r.config)==null?void 0:u.dataProvider)==null?void 0:f[g])==null?void 0:E.deleteMany({...n.value,...o},r,a)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&s(e.path)},onError:o=>{var t;l(o),(t=e.onError)==null||t.call(e,o)},...e.options}),c=i.computed(()=>d.isPending.value);return{...d,isLoading:c,mutate:d.mutate}}function k(e){var o;const r=P.useManage(),a=h.useGetAuth(),g=(e==null?void 0:e.providerName)||"default",{mutate:l}=h.useError(),s=i.computed(()=>{if(!e)return{};const{onError:t,options:u,...f}=e;return f}),n=N.useQuery({queryKey:[`${(o=r.config)==null?void 0:o.name}:${g}:${e==null?void 0:e.path}`,s],queryFn:()=>{var t,u,f;return(f=(u=(t=r.config)==null?void 0:t.dataProvider)==null?void 0:u[g])==null?void 0:f.custom(s.value,r,a)},...e==null?void 0:e.options}),d=i.computed(()=>n.isFetched.value?!1:n.isFetching.value);i.watch(()=>n.isError,()=>{var t;l(n.error),(t=e==null?void 0:e.onError)==null||t.call(e,n.error)});const c=i.ref(void 0);return i.watch(n.data,t=>{t&&(c.value=t)},{immediate:!0}),{...n,isLoading:d,data:c,refetch:n.refetch}}function b(e){const r=P.useManage(),a=h.useGetAuth(),g=(e==null?void 0:e.providerName)||"default",{mutate:l}=h.useError(),s=i.computed(()=>{if(!e)return{};const{onError:c,options:o,...t}=e;return t}),n=N.useMutation({mutationFn:c=>{var o,t,u,f;if(!((o=r.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(f=(u=(t=r.config)==null?void 0:t.dataProvider)==null?void 0:u[g])==null?void 0:f.custom({...s.value,...c},r,a)},onSuccess:c=>{var o;n.reset(),(o=e==null?void 0:e.onSuccess)==null||o.call(e,c)},onError:c=>{var o;l(c),(o=e==null?void 0:e.onError)==null||o.call(e,c)},...e==null?void 0:e.options}),d=i.computed(()=>n.isPending.value);return{...n,isLoading:d,mutate:n.mutate}}function R(){const e=P.useManage(),r=h.useGetAuth();return{request:g=>{var s,n,d,c;if(!((s=e.config)!=null&&s.dataProvider))throw new Error("Data provider is not initialized");const l=g.providerName||"default";return(c=(d=(n=e.config)==null?void 0:n.dataProvider)==null?void 0:d[l])==null?void 0:c.custom({...g},e,r)}}}function A(){const e=N.useQueryClient(),r=P.useManage();return{invalidate:(g,l)=>{var n;let s=g;Array.isArray(g)||(s=[g]);for(const d of s){const c=`${(n=r.config)==null?void 0:n.name}:${l||"default"}:${d}`;e.invalidateQueries({queryKey:[c]})}}}}exports.useClient=R;exports.useCreate=T;exports.useCreateMany=x;exports.useCustom=k;exports.useCustomMutation=b;exports.useDelete=O;exports.useDeleteMany=U;exports.useInfiniteList=D;exports.useInvalidate=A;exports.useList=C;exports.useMany=Q;exports.useOne=G;exports.useUpdate=K;exports.useUpdateMany=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tanstack/vue-query"),u=require("vue"),y=require("./auth.cjs"),N=require("./manage.cjs");function R(e){var z;const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),c=u.toRef(e.pagination?e.pagination:{page:1,pageSize:20}),i=u.toRef(e,"sorters",{}),d=u.toRef(e,"filters",{}),l=u.toRef(e,"meta",{}),o=u.computed(()=>{const{onError:A,options:v,pagination:M,filters:$,sorters:P,meta:S,...q}=e;return q});u.watch(o,()=>{e.pagination&&(c.value.page=1)},{deep:!0});const t=u.computed(()=>({...o.value,pagination:e.pagination?c.value:void 0,filters:d.value||{},sorters:i.value||{},meta:l.value||{}})),n=a.useQuery({queryKey:[`${(z=r.config)==null?void 0:z.name}:${f}:${e.path}`,t.value],queryFn:()=>{var A,v,M;return(M=(v=(A=r.config)==null?void 0:A.dataProvider)==null?void 0:v[f])==null?void 0:M.getList(t.value,r,E)},...e.options}),s=u.computed(()=>n.isFetching.value);u.watch(n.isError,A=>{var v;A&&(g(n.error.value),(v=e==null?void 0:e.onError)==null||v.call(e,n.error.value))});const h=u.ref(void 0),L=u.ref(0),D=u.ref(0);return u.watch(n.data,A=>{var v,M,$,P;A&&(h.value=A,L.value=((P=($=(M=(v=r.config)==null?void 0:v.dataProvider)==null?void 0:M[f])==null?void 0:$.getTotal)==null?void 0:P.call($,A))||0,D.value=Math.ceil(L.value/(c.value.pageSize||20))||0)},{immediate:!0}),{...n,isLoading:s,data:h,refetch:n.refetch,pagination:c,total:L,pageCount:D}}function T(e){var A;const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),c=u.toRef(e,"pagination",{page:1,pageSize:20}),i=u.toRef(e,"sorters",{}),d=u.toRef(e,"filters",{}),l=u.toRef(e,"meta",{}),o=u.computed(()=>{const{onError:v,options:M,pagination:$,filters:P,sorters:S,meta:q,...w}=e;return w});u.watch(o,()=>{c.value.page=1},{deep:!0});const t=u.ref(0),n=u.ref(0),s=u.computed(()=>({...o.value,filters:d.value||{},sorters:i.value||{},meta:l.value||{}})),h=a.useInfiniteQuery({queryKey:[`${(A=r.config)==null?void 0:A.name}:${f}:${e.path}:infinite`,s.value],queryFn:({pageParam:v})=>{var M,$,P;return c.value.page=v,(P=($=(M=r.config)==null?void 0:M.dataProvider)==null?void 0:$[f])==null?void 0:P.getList({...s.value,pagination:{...c.value,page:v}},r,E)},initialPageParam:1,getNextPageParam:(v,M,$)=>{var q,w,C,G,Q;if(!(v!=null&&v.data)||!((q=v==null?void 0:v.data)!=null&&q.length))return;const P=((Q=(G=(C=(w=r.config)==null?void 0:w.dataProvider)==null?void 0:C[f])==null?void 0:G.getTotal)==null?void 0:Q.call(G,v))||0;if(n.value=Math.ceil(P/(c.value.pageSize||20))||0,t.value=P,!($*(c.value.pageSize||20)>=P))return $+1},getPreviousPageParam:(v,M,$)=>{var S,q,w,C;if($<=1)return;const P=((C=(w=(q=(S=r.config)==null?void 0:S.dataProvider)==null?void 0:q[f])==null?void 0:w.getTotal)==null?void 0:C.call(w,v))||0;return n.value=Math.ceil(P/(c.value.pageSize||20))||0,t.value=P,$-1},...e.options}),L=u.computed(()=>h.isFetching.value);u.watch(h.isError,v=>{var M;v&&(g(h.error.value),(M=e==null?void 0:e.onError)==null||M.call(e,h.error.value))});const D=()=>{if(!(!h.hasNextPage.value||h.isFetching.value))return h.fetchNextPage()},z=u.ref(void 0);return u.watch(h.data,v=>{var P;if(!v||!(v!=null&&v.pages)||!((P=v.pages)!=null&&P.length))return;const M=v.pages.reduce((S,q)=>{var w;return q!=null&&q.data&&Array.isArray(q.data)&&((w=q.data)!=null&&w.length)?S.concat(q.data):S},[]),$=v.pages[0];$&&(z.value={...$,data:M})},{deep:!0,immediate:!0}),{...h,isLoading:L,data:z,fetchNextPage:D,hasNextPage:h.hasNextPage,refetch:h.refetch,pagination:c,total:t,pageCount:n}}function x(e){var o;const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),c=u.computed(()=>{const{onError:t,options:n,...s}=e;return s}),i=a.useQuery({queryKey:[`${(o=r.config)==null?void 0:o.name}:${f}:${e.path}`,c],queryFn:()=>{var t,n,s;return(s=(n=(t=r.config)==null?void 0:t.dataProvider)==null?void 0:n[f])==null?void 0:s.getOne(c.value,r,E)},...e.options}),d=u.computed(()=>i.isFetched.value?!1:i.isFetching.value);u.watch(i.isError,t=>{var n;t&&(g(i.error.value),(n=e==null?void 0:e.onError)==null||n.call(e,i.error.value))},{immediate:!0});const l=u.ref(void 0);return u.watch(i.data,t=>{t&&(l.value=t)},{immediate:!0}),{...i,isLoading:d,data:l,refetch:i.refetch}}function K(e){var o;const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),c=u.computed(()=>{const{onError:t,options:n,...s}=e;return s}),i=a.useQuery({queryKey:[`${(o=r.config)==null?void 0:o.name}:${f}:${e.path}`,c],queryFn:()=>{var t,n,s;return(s=(n=(t=r.config)==null?void 0:t.dataProvider)==null?void 0:n[f])==null?void 0:s.getMany(c.value,r,E)},...e.options}),d=u.computed(()=>i.isFetched.value?!1:i.isFetching.value);u.watch(i.isError,t=>{var n;t&&(g(i.error.value),(n=e==null?void 0:e.onError)==null||n.call(e,i.error.value))});const l=u.ref(void 0);return u.watch(i.data,t=>{t&&(l.value=t)},{immediate:!0}),{...i,isLoading:d,data:l,refetch:i.refetch}}function I(e){const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),{invalidate:c}=F(),i=u.computed(()=>{const{onError:o,options:t,...n}=e;return n}),d=a.useMutation({mutationFn:o=>{var t,n,s,h;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return o.path&&(e.path=o.path),(h=(s=(n=r.config)==null?void 0:n.dataProvider)==null?void 0:s[f])==null?void 0:h.create({...i.value,...o},r,E)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&c(e.path)},onError:o=>{var t;g(o),(t=e==null?void 0:e.onError)==null||t.call(e,o)},...e.options}),l=u.computed(()=>d.isPending.value);return{...d,isLoading:l,mutate:d.mutate}}function O(e){const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),{invalidate:c}=F(),i=u.computed(()=>{const{onError:o,options:t,...n}=e;return n}),d=a.useMutation({mutationFn:o=>{var t,n,s,h;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return o.path&&(e.path=o.path),(h=(s=(n=r.config)==null?void 0:n.dataProvider)==null?void 0:s[f])==null?void 0:h.createMany({...i.value,...o},r,E)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&c(e.path)},onError:o=>{var t;g(o),(t=e==null?void 0:e.onError)==null||t.call(e,o)},...e.options}),l=u.computed(()=>d.isPending.value);return{...d,isLoading:l,mutate:d.mutate}}function U(e){const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),{invalidate:c}=F(),i=u.computed(()=>{const{onError:o,options:t,...n}=e;return n}),d=a.useMutation({mutationFn:o=>{var t,n,s,h;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return o.path&&(e.path=o.path),(h=(s=(n=r.config)==null?void 0:n.dataProvider)==null?void 0:s[f])==null?void 0:h.update({...i.value,...o},r,E)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&c(e.path)},onError:o=>{var t;g(o),(t=e==null?void 0:e.onError)==null||t.call(e,o)},...e.options}),l=u.computed(()=>d.isPending.value);return{...d,isLoading:l,mutate:d.mutate}}function k(e){const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),{invalidate:c}=F(),i=u.computed(()=>{const{onError:o,options:t,...n}=e;return n}),d=a.useMutation({mutationFn:o=>{var t,n,s,h;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return o.path&&(e.path=o.path),(h=(s=(n=r.config)==null?void 0:n.dataProvider)==null?void 0:s[f])==null?void 0:h.updateMany({...i.value,...o},r,E)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&c(e.path)},onError:o=>{var t;g(o),(t=e==null?void 0:e.onError)==null||t.call(e,o)},...e.options}),l=u.computed(()=>d.isPending.value);return{...d,isLoading:l,mutate:d.mutate}}function b(e){const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),{invalidate:c}=F(),i=u.computed(()=>{const{onError:o,options:t,...n}=e;return n}),d=a.useMutation({mutationFn:o=>{var t,n,s,h;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return o.path&&(e.path=o.path),(h=(s=(n=r.config)==null?void 0:n.dataProvider)==null?void 0:s[f])==null?void 0:h.deleteOne({...i.value,...o},r,E)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&c(e.path)},onError:o=>{var t;g(o),(t=e==null?void 0:e.onError)==null||t.call(e,o)},...e.options}),l=u.computed(()=>d.isPending.value);return{...d,isLoading:l,mutate:d.mutate}}function _(e){const r=N.useManage(),E=y.useGetAuth(),f=e.providerName||"default",{mutate:g}=y.useError(),{invalidate:c}=F(),i=u.computed(()=>{const{onError:o,options:t,...n}=e;return n}),d=a.useMutation({mutationFn:o=>{var t,n,s,h;if(!((t=r.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return o.path&&(e.path=o.path),(h=(s=(n=r.config)==null?void 0:n.dataProvider)==null?void 0:s[f])==null?void 0:h.deleteMany({...i.value,...o},r,E)},onSuccess:o=>{var t;(t=e.onSuccess)==null||t.call(e,o),e.path&&c(e.path)},onError:o=>{var t;g(o),(t=e==null?void 0:e.onError)==null||t.call(e,o)},...e.options}),l=u.computed(()=>d.isPending.value);return{...d,isLoading:l,mutate:d.mutate}}function j(e){var o;const r=N.useManage(),E=y.useGetAuth(),f=(e==null?void 0:e.providerName)||"default",{mutate:g}=y.useError(),c=u.computed(()=>{if(!e)return{};const{onError:t,options:n,...s}=e;return s}),i=a.useQuery({queryKey:[`${(o=r.config)==null?void 0:o.name}:${f}:${e==null?void 0:e.path}`,c],queryFn:()=>{var t,n,s;return(s=(n=(t=r.config)==null?void 0:t.dataProvider)==null?void 0:n[f])==null?void 0:s.custom(c.value,r,E)},...e==null?void 0:e.options}),d=u.computed(()=>i.isFetched.value?!1:i.isFetching.value);u.watch(i.isError,t=>{var n;t&&(g(i.error.value),(n=e==null?void 0:e.onError)==null||n.call(e,i.error.value))});const l=u.ref(void 0);return u.watch(i.data,t=>{t&&(l.value=t)},{immediate:!0}),{...i,isLoading:d,data:l,refetch:i.refetch}}function V(e){const r=N.useManage(),E=y.useGetAuth(),f=(e==null?void 0:e.providerName)||"default",{mutate:g}=y.useError(),c=u.computed(()=>{if(!e)return{};const{onError:l,options:o,...t}=e;return t}),i=a.useMutation({mutationFn:l=>{var o,t,n,s;if(!((o=r.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(s=(n=(t=r.config)==null?void 0:t.dataProvider)==null?void 0:n[f])==null?void 0:s.custom({...c.value,...l},r,E)},onSuccess:l=>{var o;i.reset(),(o=e==null?void 0:e.onSuccess)==null||o.call(e,l)},onError:l=>{var o;g(l),(o=e==null?void 0:e.onError)==null||o.call(e,l)},...e==null?void 0:e.options}),d=u.computed(()=>i.isPending.value);return{...i,isLoading:d,mutate:i.mutate}}function B(){const e=N.useManage(),r=y.useGetAuth();return{request:f=>{var c,i,d,l;if(!((c=e.config)!=null&&c.dataProvider))throw new Error("Data provider is not initialized");const g=f.providerName||"default";return(l=(d=(i=e.config)==null?void 0:i.dataProvider)==null?void 0:d[g])==null?void 0:l.custom({...f},e,r)}}}function F(){const e=a.useQueryClient(),r=N.useManage();return{invalidate:(f,g)=>{var i;let c=f;Array.isArray(f)||(c=[f]);for(const d of c){const l=`${(i=r.config)==null?void 0:i.name}:${g||"default"}:${d}`;e.invalidateQueries({queryKey:[l]})}}}}exports.useClient=B;exports.useCreate=I;exports.useCreateMany=O;exports.useCustom=j;exports.useCustomMutation=V;exports.useDelete=b;exports.useDeleteMany=_;exports.useInfiniteList=T;exports.useInvalidate=F;exports.useList=R;exports.useMany=K;exports.useOne=x;exports.useUpdate=U;exports.useUpdateMany=k;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("json-2-csv"),l=require("vue"),y=require("./export.cjs");function h(e){const d=l.computed(()=>{const{filename:t,headers:r,csvOptions:o,...c}=e;return c}),v=l.computed(()=>{const t=e.csvOptions||{},r=t.quote;return{prependHeader:e.headers!==!1,keys:Array.isArray(e.headers)?e.headers:void 0,delimiter:{field:t.delimiter||",",wrap:typeof r=="string"?r:'"',eol:t.eol||`
2
- `},excelBOM:t.writeBOM||!1}});return y.useExport({...d.value,onSuccess:async t=>{var o,c,a,i;if(!(t!=null&&t.pages)){(o=e.onError)==null||o.call(e,{message:"No data to export",status:400});return}const r=t.pages.flatMap(n=>(n==null?void 0:n.data)||[]);if(r.length===0){(c=e.onError)==null||c.call(e,{message:"No data to export",status:400});return}try{const n=await f.json2csv(r,v.value),m=new Blob([n],{type:"text/csv;charset=utf-8;"}),u=URL.createObjectURL(m),s=document.createElement("a");s.href=u,s.download=e.filename||"export.csv",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(u),(a=e.onSuccess)==null||a.call(e,t)}catch(n){(i=e.onError)==null||i.call(e,{message:`CSV Export Error: ${n}`,status:500})}}})}exports.useExportCsv=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("json-2-csv"),l=require("vue"),f=require("./export.cjs");function h(e){const d=l.computed(()=>{const{filename:t,headers:n,csvOptions:o,...c}=e;return c}),v=l.computed(()=>{const t=e.csvOptions||{},n=t.quote;return{prependHeader:e.headers!==!1,keys:Array.isArray(e.headers)?e.headers:void 0,delimiter:{field:t.delimiter||",",wrap:typeof n=="string"?n:'"',eol:t.eol||`
2
+ `},excelBOM:t.writeBOM||!1}});return f.useExport({...d.value,onSuccess:async t=>{var o,c,i,u;if(!(t!=null&&t.pages)){(o=e.onError)==null||o.call(e,{message:"No data to export",status:400});return}const n=t.pages.flatMap(r=>Array.isArray(r==null?void 0:r.data)?r.data:[]);if(!n||!(n!=null&&n.length)){(c=e.onError)==null||c.call(e,{message:"No data to export",status:400});return}try{const r=await y.json2csv(n,v.value),m=new Blob([r],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(m),s=document.createElement("a");s.href=a,s.download=e.filename||"export.csv",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(a),(i=e.onSuccess)==null||i.call(e,t)}catch(r){(u=e.onError)==null||u.call(e,{message:`CSV Export Error: ${r}`,status:500})}}})}exports.useExportCsv=h;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("lodash-es"),i=require("vue"),d=require("./data.cjs");function b(e){const n=i.toRef(e,"form",{}),c=i.ref(u.cloneDeep(e.form||{})),o=i.computed(()=>e.action==="edit"||e.id),{data:m,isLoading:r,refetch:f}=d.useOne({path:e.path||"",id:e.id,options:{enabled:!!e.id},providerName:e.providerName});i.watch([()=>e.action,()=>e.id],async()=>{var t;if(!o.value)return;await f();const a=u.cloneDeep(((t=m.value)==null?void 0:t.data)||{});Object.assign(n.value,a),Object.assign(c.value,a)},{immediate:!0});const g=()=>{const a=u.cloneDeep(c.value);Object.assign(n.value,a)},l=d.useCreate({path:e.path??"",data:n.value,onSuccess:a=>{var t;(t=e.onSuccess)==null||t.call(e,a)},onError:a=>{var t;(t=e.onError)==null||t.call(e,a)},providerName:e.providerName}),v=d.useUpdate({path:e.path??"",id:e.id,data:n.value,onSuccess:a=>{var t;(t=e.onSuccess)==null||t.call(e,a)},onError:a=>{var t;(t=e.onError)==null||t.call(e,a)},providerName:e.providerName}),s=a=>{e.action==="create"?l.mutate({data:a||n.value}):v.mutate({id:e.id,data:a||n.value})},h=i.computed(()=>r.value||l.isLoading.value||v.isLoading.value);return{form:n,initData:c,isLoading:h,isEdit:o,onSubmit:s,onReset:g}}exports.useForm=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("lodash-es"),i=require("vue"),v=require("./data.cjs");function S(e){const n=i.toRef(e,"form",{}),c=i.toRef(e,"id",void 0),d=i.ref(l.cloneDeep(n.value||{})),r=i.ref(l.cloneDeep(n.value||{})),u=i.computed(()=>e.action==="edit"||!!c.value),{data:g,isLoading:f,refetch:D}=v.useOne({get path(){return e.path||""},get id(){return c.value},options:{enabled:u.value},providerName:e.providerName}),o=()=>{let a={};u.value?a=l.cloneDeep(d.value):a=l.cloneDeep(r.value),Object.assign(n.value,a)};i.watch([c,u],async()=>{var t;if(!u.value){o();return}await D();const a=l.cloneDeep(((t=g.value)==null?void 0:t.data)||{});Object.assign(n.value,a),Object.assign(d.value,a)},{immediate:!0});const s=v.useCreate({path:e.path??"",data:n.value,onSuccess:a=>{var t;o(),(t=e.onSuccess)==null||t.call(e,a)},onError:a=>{var t;(t=e.onError)==null||t.call(e,a)},providerName:e.providerName}),m=v.useUpdate({get path(){return e.path??""},get id(){return c.value},data:n.value,onSuccess:a=>{var t;(t=e.onSuccess)==null||t.call(e,a)},onError:a=>{var t;(t=e.onError)==null||t.call(e,a)},providerName:e.providerName}),h=a=>{u.value?m.mutate({id:c.value,data:a||n.value}):s.mutate({data:a||n.value})},b=i.computed(()=>f.value||s.isLoading.value||m.isLoading.value);return{form:n,initData:u.value?d.value:r.value,isLoading:b,isEdit:u,onSubmit:h,onReset:o}}exports.useForm=S;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),f=require("./form.cjs"),l=require("./formValidate.cjs");function g(e){const n=i.toRef(e,"form",{}),{validate:u,reset:m}=l.useValidateForm({data:n,rules:e.rules}),a=i.computed(()=>{const{form:o,...r}=e;return{...r,form:o}}),t=f.useForm(a.value),d=o=>{u().then(r=>{var s;if(!r.valid){(s=e.onError)==null||s.call(e,{message:"表单验证失败"});return}t.onSubmit(o)})},c=()=>{t.onReset(),m()};return{isLoading:t.isLoading,isEdit:t.isEdit,form:n,onSubmit:d,onReset:c}}exports.useExtendForm=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),f=require("./form.cjs"),l=require("./formValidate.cjs");function g(e){const o=i.toRef(e,"form",{}),{validate:u,reset:a}=l.useValidateForm({data:o,rules:e.rules}),m=i.computed(()=>{const{form:n,...r}=e;return{...r}}),t=f.useForm({...m.value,form:o.value}),d=n=>{u().then(r=>{var s;if(!r.valid){(s=e.onError)==null||s.call(e,{message:"表单验证失败"});return}t.onSubmit(n)})},c=()=>{t.onReset(),a()};return{isLoading:t.isLoading,isEdit:t.isEdit,form:o,onSubmit:d,onReset:c}}exports.useExtendForm=g;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue");require("../utils/bus.cjs");const s=require("../utils/tree.cjs"),v=require("./data.cjs");function m(e){const{data:o,isLoading:l}=v.useList({get path(){return e.path||""},get filters(){return e.params},get providerName(){return e.providerName}}),u=a.computed(()=>{var r,n,i,t,d,c;return e.converTree?s.arrayToTree(((n=o.value)==null?void 0:n.data)||[],{idKey:((i=e.treeOptions)==null?void 0:i.valueKey)||"id",parentKey:((t=e.treeOptions)==null?void 0:t.parentKey)||"parentId",sortKey:((d=e.treeOptions)==null?void 0:d.sortKey)||"sort",childrenKey:((c=e.treeOptions)==null?void 0:c.childrenKey)||"children"}):((r=o.value)==null?void 0:r.data)||[]}),y=a.computed(()=>{var r,n;return s.treeToArr(u.value,((r=e.treeOptions)==null?void 0:r.valueKey)||"id",((n=e.treeOptions)==null?void 0:n.childrenKey)||"children")}),h=a.computed(()=>l.value);return{options:a.computed(()=>{const r=n=>n.map(i=>{const t={...i};return Array.isArray(t.children)&&(t.children.length===0?delete t.children:t.children=r(t.children)),t});return r(u.value||[])}),loading:h,expanded:y}}exports.useTree=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue");require("../utils/bus.cjs");const s=require("../utils/tree.cjs"),K=require("./data.cjs");function f(e){const l=a.toRef(e,"path"),v=a.toRef(e,"params"),y=a.toRef(e,"providerName"),{data:o,isLoading:h}=K.useList({path:l.value||"",filters:v.value,providerName:y.value}),d=a.computed(()=>{var r,n,i,t,u,c;return e.converTree?s.arrayToTree(((n=o.value)==null?void 0:n.data)||[],{idKey:((i=e.treeOptions)==null?void 0:i.valueKey)||"id",parentKey:((t=e.treeOptions)==null?void 0:t.parentKey)||"parent_id",sortKey:((u=e.treeOptions)==null?void 0:u.sortKey)||"sort",childrenKey:((c=e.treeOptions)==null?void 0:c.childrenKey)||"children"}):((r=o.value)==null?void 0:r.data)||[]}),m=a.computed(()=>{var r,n;return s.treeToArr(d.value,((r=e.treeOptions)==null?void 0:r.valueKey)||"id",((n=e.treeOptions)==null?void 0:n.childrenKey)||"children")}),p=a.computed(()=>h.value);return{options:a.computed(()=>{const r=n=>n.map(i=>{const t={...i};return Array.isArray(t.children)&&(t.children.length===0?delete t.children:t.children=r(t.children)),t});return r(d.value||[])}),loading:p,expanded:m}}exports.useTree=f;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),J=require("@overlastic/vue"),T=require("vue-router"),U=require("../hooks/auth.cjs"),B=require("../hooks/config.cjs");require("@tanstack/vue-query");const G=require("../hooks/manage.cjs");require("json-2-csv");require("lodash-es");require("@vee-validate/rules");require("vee-validate");const H=require("../stores/auth.cjs"),K=require("../stores/i18n.cjs");require("pinia");const Q=require("../stores/manage.cjs"),W=require("../stores/route.cjs");require("@vueuse/core");const X=require("../hooks/json.cjs");require("../hooks/json/index.cjs");require("../utils/bus.cjs");require("colorizr");require("axios");require("clsx");const Y=require("../components/status/error.cjs"),Z=require("../components/status/notAuthorized.cjs"),x=require("../components/status/notFound.cjs"),ee=h.defineComponent({name:"DuxAppProvider",props:{},setup(re,{slots:p}){const f=h.inject("dux.manage"),s=B.useConfig(),m=T.useRouter();return m.beforeEach(async(o,te,a)=>{var P,b,$,A,R,S,M,k,z,D,w,y,C,F;const r=o.meta.manageName,O=o.meta.authorization===!1;if(!r){const e=s.defaultManage||((b=(P=s.manages)==null?void 0:P[0])==null?void 0:b.name)||"";return a({path:`/${e}`,replace:!0})}f&&(f.value=r);const d=Q.useManageStore(r);d.isInit()||d.setConfig(($=s.manages)==null?void 0:$.find(e=>e.name===r),s);const i=W.useRouteStore(r),n=G.useManage(r),l=H.useAuthStore(r),g=K.useI18nStore(r);if((A=n.config)!=null&&A.i18nProvider&&!g.isInit()){const e=g.getLocale();e&&((R=n.config)==null||R.i18nProvider.changeLocale(e))}if(X.initJsonSchemaComponents(s,r),!l.isLogin())return O?a():a({path:n.getRoutePath("login"),replace:!0});const q=e=>e==null?void 0:e.map(u=>({...u,path:u.path?n.getRoutePath(u.path):void 0}));if(!i.getRouteInit()){const e=((S=n.config)==null?void 0:S.components)||{},u=[];if(u.push({name:`${r}.notFound`,label:"404",path:":pathMatch(.*)*",component:e.notFound||x.DuxNotFound,hidden:!0,meta:{can:!1}}),u.push({name:`${r}.notAuthorized`,label:"403",path:"notAuthorized",component:e.notAuthorized||Z.DuxNotAuthorized,hidden:!0,meta:{can:!1}}),u.push({name:`${r}.error`,label:"500",path:"error",component:e.error||Y.DuxError,hidden:!0,meta:{can:!1}}),i.setRoutes(q(((M=n.config)==null?void 0:M.menus)||[])),(k=n.config)!=null&&k.apiRoutePath)try{await((w=(D=(z=n.config)==null?void 0:z.dataProvider)==null?void 0:D.default)==null?void 0:w.custom({path:n.config.apiRoutePath,meta:{timeout:5e3}},n,l.getUser()).then(t=>{i.appendRoutes(q(t.data||[]))}))}catch(t){console.error(t)}return i.appendRoutes(u),i.getRoutes().forEach(t=>{var I,N,E,j;if(!t.path)return;const c={name:t.name,path:t.path,meta:t.meta};switch(t.loader){case"iframe":c.component=((N=(I=n.config)==null?void 0:I.components)==null?void 0:N.iframe)||(()=>Promise.resolve().then(()=>require("../components/loader/iframe.cjs")));break;case"remote":c.component=((j=(E=n.config)==null?void 0:E.components)==null?void 0:j.remote)||(()=>Promise.resolve().then(()=>require("../components/loader/loader.cjs")));break;case"link":c.beforeEnter=()=>{var _;const L=((_=t.meta)==null?void 0:_.url)||t.path;return L&&window.open(L,"_blank"),!1},c.component=()=>Promise.resolve({template:"<div></div>"});break;default:t.component&&(c.component=t.component);break}m.addRoute(`${r}.auth`,c)}),a({path:((y=o.redirectedFrom)==null?void 0:y.path)||o.path,replace:!0})}const v=["","/",`/${r}`,`/${r}/`];if(v.includes(o.path)){const e=i.getIndexRoute();return!(e!=null&&e.path)||v.includes(e==null?void 0:e.path)?(console.warn("[Dux] index route not found, skip redirect"),a()):a({path:(e==null?void 0:e.path)||"/",replace:!0})}const V=U.useCan(r);return(((C=o.meta)==null?void 0:C.can)===void 0||((F=o.meta)==null?void 0:F.can)===!0)&&!V(o.name)?a({name:`${r}.notAuthorized`}):a()}),()=>h.createVNode(J.OverlaysProvider,null,{default:()=>{var o;return[(o=p.default)==null?void 0:o.call(p)]}})}});exports.DuxAppProvider=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),V=require("@overlastic/vue"),J=require("vue-router"),U=require("../hooks/auth.cjs"),B=require("../hooks/config.cjs");require("@tanstack/vue-query");const G=require("../hooks/manage.cjs");require("json-2-csv");require("lodash-es");require("@vee-validate/rules");require("vee-validate");const H=require("../stores/auth.cjs"),K=require("../stores/i18n.cjs");require("pinia");const Q=require("../stores/manage.cjs"),W=require("../stores/route.cjs");require("@vueuse/core");const X=require("../hooks/json.cjs");require("../hooks/json/index.cjs");require("../utils/bus.cjs");require("colorizr");require("axios");require("clsx");const Y=require("../components/status/error.cjs"),Z=require("../components/status/notAuthorized.cjs"),x=require("../components/status/notFound.cjs"),ee=l.defineComponent({name:"DuxAppProvider",props:{},setup(te,{slots:d}){const q=l.inject("dux.manage"),h=B.useConfig(),m=J.useRouter();return m.beforeEach(async(n,re,u)=>{var $,A,S,M,k,z,D,w,C,E,F,I,N,y;const t=n.meta.manageName,O=n.meta.authorization===!1;if(!t){const e=h.defaultManage||((A=($=h.manages)==null?void 0:$[0])==null?void 0:A.name)||"";return u({path:`/${e}`,replace:!0})}q&&(q.value=t);const v=Q.useManageStore(t);v.isInit()||v.setConfig((S=h.manages)==null?void 0:S.find(e=>e.name===t),h);const p=W.useRouteStore(t),r=G.useManage(t),g=H.useAuthStore(t),P=K.useI18nStore(t);if((M=r.config)!=null&&M.i18nProvider&&!P.isInit()){const e=P.getLocale();e&&((k=r.config)==null||k.i18nProvider.changeLocale(e))}if(X.initJsonSchemaComponents(h,t),!g.isLogin())return O?u():u({path:r.getRoutePath("login"),replace:!0});const b=e=>e==null?void 0:e.map(i=>({...i,path:i.path?r.getRoutePath(i.path):void 0}));if(!p.getRouteInit()){const e=((z=r.config)==null?void 0:z.components)||{},i=[];return i.push({name:`${t}.notFound`,label:"404",path:":pathMatch(.*)*",component:e.notFound||x.DuxNotFound,hidden:!0,meta:{can:!1}}),i.push({name:`${t}.notAuthorized`,label:"403",path:"notAuthorized",component:e.notAuthorized||Z.DuxNotAuthorized,hidden:!0,meta:{can:!1}}),i.push({name:`${t}.error`,label:"500",path:"error",component:e.error||Y.DuxError,hidden:!0,meta:{can:!1}}),p.setRoutes(b(((D=r.config)==null?void 0:D.menus)||[])),(w=r.config)!=null&&w.apiRoutePath&&await((F=(E=(C=r.config)==null?void 0:C.dataProvider)==null?void 0:E.default)==null?void 0:F.custom({path:r.config.apiRoutePath,meta:{timeout:5e3}},r,g.getUser()).then(o=>{p.appendRoutes(b(o.data||[]))}).catch(o=>{var a,c,f;throw(f=(c=(a=r.config)==null?void 0:a.authProvider)==null?void 0:c.onError)==null||f.call(c,o).then(s=>{s!=null&&s.logout&&(g.logout(),m.push(r.getRoutePath(s.redirectTo||"/login")))}),o})),p.appendRoutes(i),p.getRoutes().forEach(o=>{var c,f,s,j;if(!o.path)return;const a={name:o.name,path:o.path,meta:o.meta};switch(o.loader){case"iframe":a.component=((f=(c=r.config)==null?void 0:c.components)==null?void 0:f.iframe)||(()=>Promise.resolve().then(()=>require("../components/loader/iframe.cjs")));break;case"remote":a.component=((j=(s=r.config)==null?void 0:s.components)==null?void 0:j.remote)||(()=>Promise.resolve().then(()=>require("../components/loader/loader.cjs")));break;case"link":a.beforeEnter=()=>{var _;const L=((_=o.meta)==null?void 0:_.url)||o.path;return L&&window.open(L,"_blank"),!1},a.component=()=>Promise.resolve({template:"<div></div>"});break;default:o.component&&(a.component=o.component);break}m.addRoute(`${t}.auth`,a)}),u({path:((I=n.redirectedFrom)==null?void 0:I.path)||n.path,replace:!0})}const R=["","/",`/${t}`,`/${t}/`];if(R.includes(n.path)){const e=p.getIndexRoute();return!(e!=null&&e.path)||R.includes(e==null?void 0:e.path)?(console.warn("[Dux] index route not found, skip redirect"),u()):u({path:(e==null?void 0:e.path)||"/",replace:!0})}const T=U.useCan(t);return(((N=n.meta)==null?void 0:N.can)===void 0||((y=n.meta)==null?void 0:y.can)===!0)&&!T(n.name)?u({name:`${t}.notAuthorized`}):u()}),()=>l.createVNode(V.OverlaysProvider,null,{default:()=>{var n;return[(n=d.default)==null?void 0:n.call(d)]}})}});exports.DuxAppProvider=ee;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("pinia"),a=require("vue");function i(t,e){const o=t.toString?t.toString():String(t);return`${e}-${o.slice(0,32)}`}function l(t){const e=a.inject("dux.manage");if(t||(t=(e==null?void 0:e.value)||""),!t)throw new Error("manage not found");return S(t)()}function S(t){return u.defineStore(`jsonSchema-${t}`,()=>{const e=a.ref(new Map),o=a.ref(new Map);return{componentCache:e,componentsByName:o,addComponent:(n,r,s)=>{const c=i(n,r);return e.value.has(c)||(e.value.set(c,{component:n,name:r,originalName:s||r,cacheKey:c}),o.value.set(r,n)),c},getComponent:n=>{var r;return(r=e.value.get(n))==null?void 0:r.component},getComponentByName:n=>o.value.get(n),hasComponent:n=>e.value.has(n),clearCache:()=>{e.value.clear(),o.value.clear()},getCacheSize:()=>e.value.size}})}exports.useJsonSchemaStore=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("pinia"),a=require("vue");function i(o){const e=a.inject("dux.manage");if(o||(o=(e==null?void 0:e.value)||""),!o)throw new Error("manage not found");return h(o)()}function h(o){return s.defineStore(`jsonSchema-${o}`,()=>{const e=a.ref(new Map),r=a.ref(new Map);return{componentCache:e,componentsByName:r,addComponent:(t,n,u)=>{const c=n;return e.value.has(c)||(e.value.set(c,{component:t,name:n,originalName:u||n,cacheKey:c}),r.value.set(n,t)),c},getComponent:t=>{var n;return(n=e.value.get(t))==null?void 0:n.component},getComponentByName:t=>r.value.get(t),hasComponent:t=>e.value.has(t),clearCache:()=>{e.value.clear(),r.value.clear()},getCacheSize:()=>e.value.size}})}exports.useJsonSchemaStore=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("pinia"),a=require("vue");function w(n){const t=a.inject("dux.manage");if(n||(n=(t==null?void 0:t.value)||""),!n)throw new Error("manage not found");return x(n)()}function x(n){return q.defineStore(`routes-${n}`,()=>{const t=a.ref([]),l=e=>{var o;return(o=t.value)==null?void 0:o.find(u=>u.path===e)},p=e=>{var o;return(o=t.value)==null?void 0:o.find(u=>u.name===e)},h=e=>{var o;(o=t.value)==null||o.push(e)},S=e=>{t.value=[...t.value,...e]},g=e=>{t.value=e},I=()=>t.value,b=()=>{t.value=[]},j=()=>{var u,d;const e=(d=(u=t.value)==null?void 0:u.filter(r=>!r.parent&&!r.name.includes("404")&&!r.name.includes("403")))==null?void 0:d.sort((r,s)=>(r.sort||0)-(s.sort||0)),o=r=>{var v,R;if(r.path)return r;const s=(R=(v=t.value)==null?void 0:v.filter(c=>c.parent===r.name))==null?void 0:R.sort((c,i)=>(c.sort||0)-(i.sort||0));for(const c of s||[]){const i=o(c);if(i)return i}};for(const r of e||[]){const s=o(r);if(s)return s}},f=a.ref(!1);return{routes:t,searchRoute:l,searchRouteName:p,appendRoute:h,appendRoutes:S,setRoutes:g,getRoutes:I,clearRoutes:b,getIndexRoute:j,getRouteInit:()=>{const e=f.value;return f.value=!0,e}}})}exports.useRouteStore=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("pinia"),l=require("vue");function w(u){const t=l.inject("dux.manage");if(u||(u=(t==null?void 0:t.value)||""),!u)throw new Error("manage not found");return x(u)()}function x(u){return q.defineStore(`routes-${u}`,()=>{const t=l.ref([]),f=e=>{var o;return(o=t.value)==null?void 0:o.find(s=>s.path===e)},p=e=>{var o;return(o=t.value)==null?void 0:o.find(s=>s.name===e)},h=e=>{var o;(o=t.value)==null||o.push(e)},S=e=>{t.value=[...t.value,...e]},g=e=>{t.value=e},I=()=>t.value,b=()=>{t.value=[]},j=()=>{var s,v;const e=(v=(s=t.value)==null?void 0:s.filter(r=>{var n,c;return!r.parent&&!((n=r.name)!=null&&n.includes("404"))&&!((c=r.name)!=null&&c.includes("403"))}))==null?void 0:v.sort((r,n)=>(r.sort||0)-(n.sort||0)),o=r=>{var c,R;if(r.path)return r;const n=(R=(c=t.value)==null?void 0:c.filter(i=>i.parent===r.name))==null?void 0:R.sort((i,a)=>(i.sort||0)-(a.sort||0));for(const i of n||[]){const a=o(i);if(a)return a}};for(const r of e||[]){const n=o(r);if(n)return n}},d=l.ref(!1);return{routes:t,searchRoute:f,searchRouteName:p,appendRoute:h,appendRoutes:S,setRoutes:g,getRoutes:I,clearRoutes:b,getIndexRoute:j,getRouteInit:()=>{const e=d.value;return d.value=!0,e}}})}exports.useRouteStore=w;
@@ -1,49 +1,38 @@
1
- import { defineComponent as e, createVNode as o, Suspense as i, h as n } from "vue";
2
- import "vue-router";
3
- import "pinia";
4
- import { useManage as l } from "../../hooks/manage.js";
1
+ import { defineComponent as r, createVNode as o } from "vue";
2
+ import { DuxException as t } from "../status/exception.js";
5
3
  import "@tanstack/vue-query";
6
- import "json-2-csv";
7
- import "lodash-es";
8
- import "@vee-validate/rules";
9
- import "vee-validate";
10
4
  import "@vueuse/core";
11
- import "../../hooks/json/index.js";
12
- import "../../utils/bus.js";
13
- import "@overlastic/vue";
14
- import "clsx";
15
- import { DuxException as a } from "../status/exception.js";
16
- import "colorizr";
17
5
  import "axios";
18
6
  import "crypto-js";
19
7
  import "dayjs";
8
+ import "lodash-es";
20
9
  import "mathjs";
21
10
  import "mime";
22
11
  import "mitt";
12
+ import "pinia";
23
13
  import "vue3-sfc-loader";
14
+ import "vue-router";
15
+ import "json-2-csv";
16
+ import "@vee-validate/rules";
17
+ import "vee-validate";
18
+ import "../../hooks/json/index.js";
19
+ import "../../utils/bus.js";
20
+ import "@overlastic/vue";
21
+ import "clsx";
22
+ import "colorizr";
24
23
  import "pinia-plugin-persistedstate";
25
24
  import "vue-i18n";
26
- import { DuxRemoteRender as u } from "./remote/render.js";
27
- const F = /* @__PURE__ */ e({
25
+ import { DuxRemoteRender as m } from "./remote/render.js";
26
+ const q = /* @__PURE__ */ r({
28
27
  name: "DuxLoaderRemote",
29
- setup(d) {
30
- const {
31
- config: m
32
- } = l(), p = () => {
33
- var t;
34
- const r = (t = m.components) == null ? void 0 : t.loading;
35
- return r ? n(r) : null;
36
- };
28
+ setup(p) {
37
29
  return () => o("div", {
38
30
  class: "app-remote-loader"
39
- }, [o(a, null, {
40
- default: () => [o(i, null, {
41
- default: () => o(u, null, null),
42
- fallback: () => p()
43
- })]
31
+ }, [o(t, null, {
32
+ default: () => [o(m, null, null)]
44
33
  })]);
45
34
  }
46
35
  });
47
36
  export {
48
- F as default
37
+ q as default
49
38
  };
@@ -2,12 +2,12 @@ import * as b from "vue";
2
2
  import { createVNode as E } from "vue";
3
3
  import * as k from "@tanstack/vue-query";
4
4
  import * as J from "@vueuse/core";
5
- import T from "axios";
5
+ import L from "axios";
6
6
  import $ from "crypto-js";
7
- import L from "dayjs";
8
- import * as N from "lodash-es";
9
- import * as O from "mathjs";
10
- import g from "mime";
7
+ import N from "dayjs";
8
+ import * as O from "lodash-es";
9
+ import * as T from "mathjs";
10
+ import v from "mime";
11
11
  import W from "mitt";
12
12
  import * as q from "pinia";
13
13
  import { loadModule as F } from "vue3-sfc-loader";
@@ -25,7 +25,7 @@ import "@overlastic/vue";
25
25
  import "clsx";
26
26
  import "colorizr";
27
27
  import * as I from "../../../index.js";
28
- const v = /* @__PURE__ */ new Map();
28
+ const g = /* @__PURE__ */ new Map();
29
29
  function Q(m) {
30
30
  return $.MD5(m).toString().substring(0, 10);
31
31
  }
@@ -41,18 +41,18 @@ function pt(m) {
41
41
  "@duxweb/dvha-core": I,
42
42
  "@vueuse/core": J,
43
43
  "@tanstack/vue-query": k,
44
- axios: T,
44
+ axios: L,
45
45
  crypto: $,
46
- mime: g,
47
- math: O,
46
+ mime: v,
47
+ math: T,
48
48
  mitt: W,
49
- "lodash-es": N,
49
+ "lodash-es": O,
50
50
  pinia: q,
51
- dayjs: L,
51
+ dayjs: N,
52
52
  "vue-router": V,
53
53
  ...(l = r == null ? void 0 : r.remote) == null ? void 0 : l.packages,
54
54
  "static!": function(e, o, t) {
55
- const a = g.getType(t);
55
+ const a = v.getType(t);
56
56
  if (a != null && a.startsWith("image"))
57
57
  return `data:${a};charset=utf-8;base64,${btoa(e)}`;
58
58
  if (t === ".json")
@@ -90,12 +90,10 @@ function pt(m) {
90
90
  path: e
91
91
  },
92
92
  method: ((c = r == null ? void 0 : r.remote) == null ? void 0 : c.apiMethod) || "POST"
93
- }).then((s) => s == null ? void 0 : s.data).catch((s) => {
94
- throw new Error(`${s == null ? void 0 : s.message} ${e}`);
93
+ }).then((n) => n == null ? void 0 : n.data).catch((n) => {
94
+ throw new Error(`${n == null ? void 0 : n.message} ${e}`);
95
95
  });
96
- return await setTimeout(() => {
97
- console.log("res", o);
98
- }, 1e4), {
96
+ return {
99
97
  getContentData: () => o == null ? void 0 : o.content,
100
98
  type: `${(o == null ? void 0 : o.type) || "vue"}`
101
99
  };
@@ -108,10 +106,10 @@ function pt(m) {
108
106
  moduleCache: a,
109
107
  pathResolve: u,
110
108
  getFile: c
111
- } = t, [s, ...y] = o.match(/([^!]+!)|[^!]+$/g).reverse(), C = (n, p, f, S) => y.reduce((j, M) => a[M](j, p, f, S), n), i = u({
109
+ } = t, [n, ...y] = o.match(/([^!]+!)|[^!]+$/g).reverse(), C = (s, p, f, S) => y.reduce((j, M) => a[M](j, p, f, S), s), i = u({
112
110
  refPath: e,
113
- relPath: s
114
- }, t), R = y.join("") + i, P = (n) => n.startsWith("@") ? !0 : !n.includes("/") && !n.startsWith(".");
111
+ relPath: n
112
+ }, t), R = y.join("") + i, P = (s) => s.startsWith("@") ? !0 : !s.includes("/") && !s.startsWith(".");
115
113
  return {
116
114
  id: R,
117
115
  path: i,
@@ -119,11 +117,11 @@ function pt(m) {
119
117
  if (P(i))
120
118
  throw new Error(`Package ${i} not imported`);
121
119
  const {
122
- getContentData: n,
120
+ getContentData: s,
123
121
  type: p
124
122
  } = await c(i);
125
123
  return {
126
- getContentData: async (f) => C(await n(f), i, p, t),
124
+ getContentData: async (f) => C(await s(f), i, p, t),
127
125
  type: p
128
126
  };
129
127
  }
@@ -131,9 +129,9 @@ function pt(m) {
131
129
  },
132
130
  addStyle(e) {
133
131
  const o = Q(e);
134
- if (v.has(o))
132
+ if (g.has(o))
135
133
  return;
136
- v.set(o, !0);
134
+ g.set(o, !0);
137
135
  const t = document.createElement("style");
138
136
  t.textContent = e, t.setAttribute("data-hash", o), document.head.appendChild(t);
139
137
  }
@@ -1,33 +1,35 @@
1
- import { ref as P } from "vue";
2
- import { useRouter as d } from "vue-router";
1
+ import { ref as w } from "vue";
2
+ import { useRouter as f } from "vue-router";
3
3
  import { useAuthStore as h } from "../stores/auth.js";
4
- import { useManage as f } from "./manage.js";
4
+ import { useManage as d } from "./manage.js";
5
5
  function s(t) {
6
- const u = f(), o = h(), g = d(), r = P(!1);
6
+ const u = d(), o = h(), r = f(), g = w(!1);
7
7
  return {
8
8
  mutate: async (e) => {
9
9
  var c, i, m;
10
- r.value = !0;
10
+ g.value = !0;
11
11
  const n = await ((c = u.config.authProvider) == null ? void 0 : c.login(e, u));
12
- if (r.value = !1, n != null && n.success) {
12
+ if (g.value = !1, n != null && n.success) {
13
13
  if (!(n != null && n.data))
14
14
  throw new Error("Login response data is undefined");
15
- (i = t == null ? void 0 : t.onSuccess) == null || i.call(t, n), o.login(n.data), g.push(u.getRoutePath(n.redirectTo || "/"));
15
+ (i = t == null ? void 0 : t.onSuccess) == null || i.call(t, n), o.login(n.data), r.push(u.getRoutePath(n.redirectTo || "/"));
16
16
  return;
17
17
  }
18
18
  (m = t == null ? void 0 : t.onError) == null || m.call(t, n);
19
19
  },
20
- isLoading: r
20
+ isLoading: g
21
21
  };
22
22
  }
23
23
  function R(t) {
24
- const u = f(), o = h(), g = d();
24
+ const u = d(), o = h(), r = f();
25
25
  return {
26
26
  mutate: async (a) => {
27
27
  var n, c, i;
28
28
  const e = await ((n = u.config.authProvider) == null ? void 0 : n.logout(a, u));
29
29
  if (e != null && e.success) {
30
- (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, e), o.logout(), g.push(u.getRoutePath(e.redirectTo || "/login"));
30
+ (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, e), o.logout(), await r.replace(u.getRoutePath(e.redirectTo || "/login")), setTimeout(() => {
31
+ window.location.reload();
32
+ }, 100);
31
33
  return;
32
34
  }
33
35
  (i = t == null ? void 0 : t.onError) == null || i.call(t, e);
@@ -35,7 +37,7 @@ function R(t) {
35
37
  };
36
38
  }
37
39
  function T(t) {
38
- const u = f(), o = h(), g = d();
40
+ const u = d(), o = h(), r = f();
39
41
  return {
40
42
  mutate: async (a) => {
41
43
  var n, c, i;
@@ -46,12 +48,12 @@ function T(t) {
46
48
  o.update(e.data);
47
49
  return;
48
50
  }
49
- (i = t == null ? void 0 : t.onError) == null || i.call(t, e), e != null && e.logout && g.push(u.getRoutePath(e.redirectTo || "/login"));
51
+ (i = t == null ? void 0 : t.onError) == null || i.call(t, e), e != null && e.logout && r.push(u.getRoutePath(e.redirectTo || "/login"));
50
52
  }
51
53
  };
52
54
  }
53
55
  function y(t) {
54
- const u = f(), o = h(), g = d();
56
+ const u = d(), o = h(), r = f();
55
57
  return {
56
58
  mutate: async (a) => {
57
59
  var n, c, i, m;
@@ -59,7 +61,7 @@ function y(t) {
59
61
  if (e != null && e.success) {
60
62
  if ((i = t == null ? void 0 : t.onSuccess) == null || i.call(t, e), !(e != null && e.data))
61
63
  throw new Error("Register response data is undefined");
62
- o.login(e.data), g.push(u.getRoutePath(e.redirectTo || ""));
64
+ o.login(e.data), r.push(u.getRoutePath(e.redirectTo || ""));
63
65
  return;
64
66
  }
65
67
  (m = t == null ? void 0 : t.onError) == null || m.call(t, e);
@@ -67,11 +69,11 @@ function y(t) {
67
69
  };
68
70
  }
69
71
  function L(t) {
70
- const u = f(), o = d();
72
+ const u = d(), o = f();
71
73
  return {
72
- mutate: async (r) => {
74
+ mutate: async (g) => {
73
75
  var e, n, c, i;
74
- const a = await ((n = (e = u.config.authProvider) == null ? void 0 : e.forgotPassword) == null ? void 0 : n.call(e, r, u));
76
+ const a = await ((n = (e = u.config.authProvider) == null ? void 0 : e.forgotPassword) == null ? void 0 : n.call(e, g, u));
75
77
  if (a != null && a.success) {
76
78
  (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, a), a.redirectTo && o.push(u.getRoutePath(a.redirectTo));
77
79
  return;
@@ -81,11 +83,11 @@ function L(t) {
81
83
  };
82
84
  }
83
85
  function U(t) {
84
- const u = f(), o = d();
86
+ const u = d(), o = f();
85
87
  return {
86
- mutate: async (r) => {
88
+ mutate: async (g) => {
87
89
  var e, n, c, i;
88
- const a = await ((n = (e = u.config.authProvider) == null ? void 0 : e.updatePassword) == null ? void 0 : n.call(e, r, u));
90
+ const a = await ((n = (e = u.config.authProvider) == null ? void 0 : e.updatePassword) == null ? void 0 : n.call(e, g, u));
89
91
  if (a != null && a.success) {
90
92
  (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, a), a.redirectTo && o.push(u.getRoutePath(a.redirectTo));
91
93
  return;
@@ -95,12 +97,12 @@ function U(t) {
95
97
  };
96
98
  }
97
99
  function A(t) {
98
- const { config: u, getRoutePath: o } = f(), g = d();
100
+ const { config: u, getRoutePath: o } = d(), r = f();
99
101
  return {
100
102
  mutate: async (a) => {
101
103
  var n;
102
104
  const e = await ((n = u.authProvider) == null ? void 0 : n.onError(a));
103
- t == null || t(e), e != null && e.logout && g.push(o(e.redirectTo || "/login"));
105
+ t == null || t(e), e != null && e.logout && r.push(o(e.redirectTo || "/login"));
104
106
  }
105
107
  };
106
108
  }
@@ -111,10 +113,10 @@ function F(t) {
111
113
  return h(t).isLogin();
112
114
  }
113
115
  function G(t) {
114
- const u = f(t), g = h(t).getUser();
116
+ const u = d(t), r = h(t).getUser();
115
117
  return (a, e) => {
116
118
  var n;
117
- return (n = u.config.authProvider) != null && n.can ? u.config.authProvider.can(a, e, u, g) : !0;
119
+ return (n = u.config.authProvider) != null && n.can ? u.config.authProvider.can(a, e, u, r) : !0;
118
120
  };
119
121
  }
120
122
  export {