@duxweb/dvha-core 0.1.4 → 0.1.6
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.
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/main.cjs +1 -1
- package/dist/cjs/preset/authProvider.cjs +1 -1
- package/dist/cjs/preset/dataProvider.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/esm/hooks/data.js +15 -15
- package/dist/esm/main.js +9 -8
- package/dist/esm/preset/authProvider.js +60 -60
- package/dist/esm/preset/dataProvider.js +1 -1
- package/dist/esm/provider/app.js +55 -55
- package/dist/types/hooks/data.d.ts +8 -8
- package/dist/types/hooks/select.d.ts +24 -0
- package/dist/types/types/data.d.ts +2 -3
- package/package.json +1 -1
package/dist/cjs/hooks/data.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("@tanstack/vue-query"),f=require("vue"),v=require("./auth.cjs"),l=require("./manage.cjs");function M(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.getList(d.value,u,g)},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,refetch:n.refetch}}function P(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useInfiniteQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.getList(d.value,u,g)},initialPageParam:0,getNextPageParam:(t,o,r)=>{var a;if(!(!(t!=null&&t.data)||((a=t==null?void 0:t.data)==null?void 0:a.length)===0))return r+1},getPreviousPageParam:(t,o,r)=>{if(!(r<=1))return r-1},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,fetchNextPage:n.fetchNextPage,hasNextPage:n.hasNextPage,refetch:n.refetch}}function N(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.getOne(d.value,u,g)},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,refetch:n.refetch}}function q(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.getMany(d.value,u,g)},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,refetch:n.refetch}}function A(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.create({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function F(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.createMany({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function w(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.update({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function L(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.updateMany({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function S(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.deleteOne({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function G(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.deleteMany({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function C(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.custom(d.value,u,g)},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,refetch:n.refetch}}function D(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:c,options:t,...o}=e;return o}),n=$.useMutation({mutationFn:c=>{var t,o,r,a;if(!((t=u.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return(a=(r=(o=u.config)==null?void 0:o.dataProvider)==null?void 0:r[s])==null?void 0:a.custom({...d.value,...c},u,g)},onSuccess:c=>{var t;(t=e.onSuccess)==null||t.call(e,c)},onError:c=>{var t;h(c),(t=e.onError)==null||t.call(e,c)},...e.options}),i=f.computed(()=>n.isPending);return{...n,isLoading:i,mutate:n.mutate}}function z(){const e=l.useManage(),u=v.useGetAuth();return{request:s=>{var d,n,i,c;if(!((d=e.config)!=null&&d.dataProvider))throw new Error("Data provider is not initialized");const h=s.providerName||"default";return(c=(i=(n=e.config)==null?void 0:n.dataProvider)==null?void 0:i[h])==null?void 0:c.custom({...s},e,u)}}}function y(){const e=$.useQueryClient(),u=l.useManage();return{invalidate:(s,h)=>{var n;let d=s;Array.isArray(s)||(d=[s]);for(const i of d){const c=`${(n=u.config)==null?void 0:n.name}:${h||"default"}:${i}`;e.invalidateQueries({queryKey:[c]})}}}}exports.useClient=z;exports.useCreate=A;exports.useCreateMany=F;exports.useCustom=C;exports.useCustomMutation=D;exports.useDelete=S;exports.useDeleteMany=G;exports.useInfiniteList=P;exports.useInvalidate=y;exports.useList=M;exports.useMany=q;exports.useOne=N;exports.useUpdate=w;exports.useUpdateMany=L;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("@tanstack/vue-query"),f=require("vue"),v=require("./auth.cjs"),l=require("./manage.cjs");function M(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.getList(d.value,u,g)},...e.options}),i=f.computed(()=>n.isFetched.value?!1:n.isFetching.value);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,refetch:n.refetch}}function P(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useInfiniteQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.getList(d.value,u,g)},initialPageParam:0,getNextPageParam:(t,o,r)=>{var a;if(!(!(t!=null&&t.data)||((a=t==null?void 0:t.data)==null?void 0:a.length)===0))return r+1},getPreviousPageParam:(t,o,r)=>{if(!(r<=1))return r-1},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,fetchNextPage:n.fetchNextPage,hasNextPage:n.hasNextPage,refetch:n.refetch}}function N(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.getOne(d.value,u,g)},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,refetch:n.refetch}}function q(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.getMany(d.value,u,g)},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,refetch:n.refetch}}function A(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.create({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function F(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.createMany({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function w(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.update({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function L(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.updateMany({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function S(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.deleteOne({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function G(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),{invalidate:d}=y(),n=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),i=$.useMutation({mutationFn:t=>{var o,r,a,E;if(!((o=u.config)!=null&&o.dataProvider))throw new Error("Data provider is not initialized");return(E=(a=(r=u.config)==null?void 0:r.dataProvider)==null?void 0:a[s])==null?void 0:E.deleteMany({...n.value,...t},u,g)},onSuccess:t=>{var o;(o=e.onSuccess)==null||o.call(e,t),e.path&&d(e.path)},onError:t=>{var o;h(t),(o=e.onError)==null||o.call(e,t)},...e.options}),c=f.computed(()=>i.isPending);return{...i,isLoading:c,mutate:i.mutate}}function C(e){var c;const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:t,options:o,...r}=e;return r}),n=$.useQuery({queryKey:[`${(c=u.config)==null?void 0:c.name}:${s}:${e.path}`,d],queryFn:()=>{var t,o,r;return(r=(o=(t=u.config)==null?void 0:t.dataProvider)==null?void 0:o[s])==null?void 0:r.custom(d.value,u,g)},...e.options}),i=f.computed(()=>n.isFetched?!1:n.isFetching);return f.watch(()=>n.isError,()=>{var t;h(n.error),(t=e.onError)==null||t.call(e,n.error)}),{...n,isLoading:i,data:n.data,refetch:n.refetch}}function D(e){const u=l.useManage(),g=v.useGetAuth(),s=e.providerName||"default",{mutate:h}=v.useError(),d=f.computed(()=>{const{onError:c,options:t,...o}=e;return o}),n=$.useMutation({mutationFn:c=>{var t,o,r,a;if(!((t=u.config)!=null&&t.dataProvider))throw new Error("Data provider is not initialized");return(a=(r=(o=u.config)==null?void 0:o.dataProvider)==null?void 0:r[s])==null?void 0:a.custom({...d.value,...c},u,g)},onSuccess:c=>{var t;(t=e.onSuccess)==null||t.call(e,c)},onError:c=>{var t;h(c),(t=e.onError)==null||t.call(e,c)},...e.options}),i=f.computed(()=>n.isPending);return{...n,isLoading:i,mutate:n.mutate}}function z(){const e=l.useManage(),u=v.useGetAuth();return{request:s=>{var d,n,i,c;if(!((d=e.config)!=null&&d.dataProvider))throw new Error("Data provider is not initialized");const h=s.providerName||"default";return(c=(i=(n=e.config)==null?void 0:n.dataProvider)==null?void 0:i[h])==null?void 0:c.custom({...s},e,u)}}}function y(){const e=$.useQueryClient(),u=l.useManage();return{invalidate:(s,h)=>{var n;let d=s;Array.isArray(s)||(d=[s]);for(const i of d){const c=`${(n=u.config)==null?void 0:n.name}:${h||"default"}:${i}`;e.invalidateQueries({queryKey:[c]})}}}}exports.useClient=z;exports.useCreate=A;exports.useCreateMany=F;exports.useCustom=C;exports.useCustomMutation=D;exports.useDelete=S;exports.useDeleteMany=G;exports.useInfiniteList=P;exports.useInvalidate=y;exports.useList=M;exports.useMany=q;exports.useOne=N;exports.useUpdate=w;exports.useUpdateMany=L;
|
package/dist/cjs/main.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("pinia"),t=require("pinia-plugin-persistedstate"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@tanstack/vue-query"),o=require("pinia"),t=require("pinia-plugin-persistedstate"),c=require("vue"),s=require("./directive/permission.cjs"),d=require("./router/route.cjs");function a(r){const i=o.createPinia();return i.use(t),{install(e){console.log("%c dux-vue %c dux.cn %c","background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent");const u=c.ref();e.provide("dux.config",r),e.provide("dux.manage",u),e.directive("can",s.permissionDirective),e.use(n.VueQueryPlugin),e.use(d.initRouter(r)),e.use(i)}}}exports.createDux=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("axios");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("axios");function l(t){return{login:async(n,c)=>{var d;return await g.post(c.getApiUrl(((d=t==null?void 0:t.apiPath)==null?void 0:d.login)||"/login",t==null?void 0:t.dataProviderName),n).then(e=>{var i,a,s;return{success:!0,message:(i=e==null?void 0:e.data)==null?void 0:i.message,redirectTo:((a=t==null?void 0:t.routePath)==null?void 0:a.index)||"/",data:(s=e==null?void 0:e.data)==null?void 0:s.data}}).catch(e=>{var i,a;return{success:!1,message:((a=(i=e==null?void 0:e.response)==null?void 0:i.data)==null?void 0:a.message)||(e==null?void 0:e.message)}})},check:async(n,c)=>{var d;return await g.get((c==null?void 0:c.getApiUrl(((d=t==null?void 0:t.apiPath)==null?void 0:d.check)||"/check",t==null?void 0:t.dataProviderName))||"").then(e=>{var i,a;return{success:!0,message:(i=e==null?void 0:e.data)==null?void 0:i.message,data:(a=e==null?void 0:e.data)==null?void 0:a.data}}).catch(e=>{var i,a;return{success:!1,message:((a=(i=e==null?void 0:e.response)==null?void 0:i.data)==null?void 0:a.message)||(e==null?void 0:e.message)}})},onError:async n=>{var c;return n.status===403?{logout:!0,redirectTo:((c=t==null?void 0:t.routePath)==null?void 0:c.login)||"/login",error:n}:{logout:!1,error:n}},logout:async()=>{var n;return{success:!0,redirectTo:((n=t==null?void 0:t.routePath)==null?void 0:n.login)||"/login"}},register:async(n,c)=>{var d;return await g.post((c==null?void 0:c.getApiUrl(((d=t==null?void 0:t.apiPath)==null?void 0:d.register)||"/register",t==null?void 0:t.dataProviderName))||"",n).then(e=>{var i,a,s;return{success:!0,message:(i=e==null?void 0:e.data)==null?void 0:i.message,redirectTo:((a=t==null?void 0:t.routePath)==null?void 0:a.index)||"/",data:(s=e==null?void 0:e.data)==null?void 0:s.data}}).catch(e=>{var i,a;return{success:!1,message:((a=(i=e==null?void 0:e.response)==null?void 0:i.data)==null?void 0:a.message)||(e==null?void 0:e.message)}})},forgotPassword:async(n,c)=>{var d;return await g.post((c==null?void 0:c.getApiUrl(((d=t==null?void 0:t.apiPath)==null?void 0:d.forgotPassword)||"/forgot-password",t==null?void 0:t.dataProviderName))||"",n).then(e=>{var i,a;return{success:!0,message:(i=e==null?void 0:e.data)==null?void 0:i.message,redirectTo:((a=t==null?void 0:t.routePath)==null?void 0:a.login)||"/login"}}).catch(e=>{var i,a;return{success:!1,message:((a=(i=e==null?void 0:e.response)==null?void 0:i.data)==null?void 0:a.message)||(e==null?void 0:e.message)}})},updatePassword:async(n,c)=>{var d;return await g.post((c==null?void 0:c.getApiUrl(((d=t==null?void 0:t.apiPath)==null?void 0:d.updatePassword)||"/update-password",t==null?void 0:t.dataProviderName))||"",n).then(e=>{var i,a;return{success:!0,message:(i=e==null?void 0:e.data)==null?void 0:i.message,redirectTo:((a=t==null?void 0:t.routePath)==null?void 0:a.login)||"/login"}}).catch(e=>{var i,a;return{success:!1,message:((a=(i=e==null?void 0:e.response)==null?void 0:i.data)==null?void 0:a.message)||(e==null?void 0:e.message)}})},can:(n,c,d,e)=>{var i,a;return!(e!=null&&e.permission)||Array.isArray(e==null?void 0:e.permission)&&((i=e==null?void 0:e.permission)==null?void 0:i.length)===0||typeof(e==null?void 0:e.permission)=="object"&&Object.keys(e==null?void 0:e.permission).length===0?!0:!(Array.isArray(e==null?void 0:e.permission)&&!((a=e==null?void 0:e.permission)!=null&&a.includes(n))||typeof(e==null?void 0:e.permission)=="object"&&(e==null?void 0:e.permission[n])===!1)}}}exports.simpleAuthProvider=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("axios"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("axios"),i=require("lodash-es");function l(g){const t=e=>e?`${g.apiUrl}/${i.trimStart(e||"","/")}`:g.apiUrl;return{apiUrl:t,getList:(e,n,r)=>{const a={};return e.pagination&&typeof e.pagination=="object"&&(a.page=e.pagination.page,a.pageSize=e.pagination.pageSize),d.get(t(e.path)||"",{params:{...a,...e.filters,...e.sorters},headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(m=>m.data)},create:(e,n,r)=>d.post(t(e.path)||"",e.data,{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),update:(e,n,r)=>d.put(t(e.id?`${e.path}/${e.id}`:e.path)||"",e.data,{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),deleteOne:(e,n,r)=>d.delete(t(e.id?`${e.path}/${e.id}`:e.path)||"",{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),getOne:(e,n,r)=>d.get(t(e.id?`${e.path}/${e.id}`:e.path)||"",{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),getMany:(e,n,r)=>d.get(t(e.path)||"",{params:{ids:e.ids},headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),createMany:(e,n,r)=>d.post(t(e.path)||"",e.data,{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),updateMany:(e,n,r)=>d.put(t(e.path)||"",{ids:e.ids,data:e.data},{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),deleteMany:(e,n,r)=>d.delete(t(e.path)||"",{params:{ids:e.ids},headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),custom:(e,n,r)=>{let a={...e.query};return e.sorters&&typeof e.sorters=="object"&&(a={...a,...e.sorters}),e.filters&&typeof e.filters=="object"&&(a={...a,...e.filters}),d.request({url:t(e.path||""),method:e.method||"GET",data:e.payload,params:a,headers:{Authorization:r==null?void 0:r.token,...e.headers},...e.meta}).then(m=>m.data)}}}exports.simpleDataProvider=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),U=require("@overlastic/vue"),V=require("vue-router"),B=require("../hooks/auth.cjs"),G=require("../hooks/config.cjs");require("@tanstack/vue-query");const H=require("../hooks/manage.cjs");require("lodash-es");require("pinia");const J=require("../stores/auth.cjs"),K=require("../stores/route.cjs"),Q=require("../stores/manage.cjs"),W=require("../stores/i18n.cjs");require("@vueuse/core");require("clsx");const p=l=>Object.freeze(Object.defineProperty({__proto__:null,default:l},Symbol.toStringTag,{value:"Module"})),X=h.defineComponent({name:"DuxAppProvider",props:{},setup(l,{slots:f}){const m=h.inject("dux.manage"),s=G.useConfig(),d=V.useRouter();return d.beforeEach(async(n,Y,a)=>{var $,S,R,A,M,y,_,k,z,w,D,I,O,j;const t=n.meta.manageName,L=n.meta.authorization===!1;if(!t){const e=s.defaultManage||((S=($=s.manages)==null?void 0:$[0])==null?void 0:S.name)||"";return a({path:`/${e}`,replace:!0})}m&&(m.value=t);const g=Q.useManageStore(t);g.isInit()||g.setConfig((R=s.manages)==null?void 0:R.find(e=>e.name===t),s);const c=K.useRouteStore(t),o=H.useManage(t),v=J.useAuthStore(t),q=W.useI18nStore(t);if((A=o.config)!=null&&A.i18nProvider&&!q.isInit()){const e=q.getLocale();e&&((M=o.config)==null||M.i18nProvider.changeLocale(e))}if(!v.isLogin())return L?a():a({path:o.getRoutePath("login"),replace:!0});const P=e=>e==null?void 0:e.map(u=>({...u,path:o.getRoutePath(u.path||"")}));if(!c.getRouteInit()){const e=((y=o.config)==null?void 0:y.components)||{},u=[];if(u.push({name:`${t}.notFound`,label:"404",path:":pathMatch(.*)*",component:e.notFound||(()=>Promise.resolve().then(()=>p(require("../components/status/notFound.cjs")))),hidden:!0,meta:{can:!1}}),u.push({name:`${t}.notAuthorized`,label:"403",path:"notAuthorized",component:e.notAuthorized||(()=>Promise.resolve().then(()=>p(require("../components/status/notAuthorized.cjs")))),hidden:!0,meta:{can:!1}}),u.push({name:`${t}.error`,label:"500",path:"error",component:e.error||(()=>Promise.resolve().then(()=>p(require("../components/status/error.cjs")))),hidden:!0,meta:{can:!1}}),c.setRoutes(P(((_=o.config)==null?void 0:_.menus)||[])),(k=o.config)!=null&&k.apiRoutePath)try{await((D=(w=(z=o.config)==null?void 0:z.dataProvider)==null?void 0:w.default)==null?void 0:D.custom({path:o.config.apiRoutePath,meta:{timeout:5e3}},o,v.getUser()).then(r=>{c.appendRoutes(P(r.data||[]))}))}catch(r){console.error(r)}return c.appendRoutes(u),c.getRoutes().forEach(r=>{var C,N;if(!r.path)return;const i={name:r.name,path:r.path,meta:r.meta};switch(r.loader){case"iframe":i.component=((N=(C=o.config)==null?void 0:C.components)==null?void 0:N.iframe)||(()=>Promise.resolve().then(()=>p(require("../components/loader/iframe.cjs"))));break;case"link":i.beforeEnter=()=>{var F;const E=((F=r.meta)==null?void 0:F.url)||r.path;return E&&window.open(E,"_blank"),!1},i.component=()=>Promise.resolve({template:"<div></div>"});break;default:r.component&&(i.component=r.component);break}d.addRoute(`${t}.auth`,i)}),a({path:((I=n.redirectedFrom)==null?void 0:I.path)||n.path,replace:!0})}const b=["","/",`/${t}`,`/${t}/`];if(b.includes(n.path)){const e=c.getIndexRoute();return!(e!=null&&e.path)||b.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 T=B.useCan(t);return(((O=n.meta)==null?void 0:O.can)===void 0||((j=n.meta)==null?void 0:j.can)===!0)&&!T(n.name)?a({name:`${t}.notAuthorized`}):a()}),()=>h.createVNode(U.OverlaysProvider,null,{default:()=>{var n;return[(n=f.default)==null?void 0:n.call(f)]}})}});exports.DuxAppProvider=X;
|
package/dist/esm/hooks/data.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery as F, useInfiniteQuery as $, useMutation as P, useQueryClient as w } from "@tanstack/vue-query";
|
|
2
|
-
import { computed as h, watch as
|
|
2
|
+
import { computed as h, watch as q } from "vue";
|
|
3
3
|
import { useGetAuth as y, useError as N } from "./auth.js";
|
|
4
4
|
import { useManage as l } from "./manage.js";
|
|
5
5
|
function D(t) {
|
|
@@ -14,8 +14,8 @@ function D(t) {
|
|
|
14
14
|
return (r = (n = (o = i.config) == null ? void 0 : o.dataProvider) == null ? void 0 : n[d]) == null ? void 0 : r.getList(s.value, i, v);
|
|
15
15
|
},
|
|
16
16
|
...t.options
|
|
17
|
-
}), u = h(() => e.isFetched ? !1 : e.isFetching);
|
|
18
|
-
return
|
|
17
|
+
}), u = h(() => e.isFetched.value ? !1 : e.isFetching.value);
|
|
18
|
+
return q(() => e.isError, () => {
|
|
19
19
|
var o;
|
|
20
20
|
f(e.error), (o = t.onError) == null || o.call(t, e.error);
|
|
21
21
|
}), {
|
|
@@ -48,7 +48,7 @@ function z(t) {
|
|
|
48
48
|
},
|
|
49
49
|
...t.options
|
|
50
50
|
}), u = h(() => e.isFetched ? !1 : e.isFetching);
|
|
51
|
-
return
|
|
51
|
+
return q(() => e.isError, () => {
|
|
52
52
|
var o;
|
|
53
53
|
f(e.error), (o = t.onError) == null || o.call(t, e.error);
|
|
54
54
|
}), {
|
|
@@ -73,7 +73,7 @@ function C(t) {
|
|
|
73
73
|
},
|
|
74
74
|
...t.options
|
|
75
75
|
}), u = h(() => e.isFetched ? !1 : e.isFetching);
|
|
76
|
-
return
|
|
76
|
+
return q(() => e.isError, () => {
|
|
77
77
|
var o;
|
|
78
78
|
f(e.error), (o = t.onError) == null || o.call(t, e.error);
|
|
79
79
|
}), {
|
|
@@ -96,7 +96,7 @@ function x(t) {
|
|
|
96
96
|
},
|
|
97
97
|
...t.options
|
|
98
98
|
}), u = h(() => e.isFetched ? !1 : e.isFetching);
|
|
99
|
-
return
|
|
99
|
+
return q(() => e.isError, () => {
|
|
100
100
|
var o;
|
|
101
101
|
f(e.error), (o = t.onError) == null || o.call(t, e.error);
|
|
102
102
|
}), {
|
|
@@ -107,7 +107,7 @@ function x(t) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
function K(t) {
|
|
110
|
-
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } =
|
|
110
|
+
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = a(), e = h(() => {
|
|
111
111
|
const { onError: o, options: n, ...r } = t;
|
|
112
112
|
return r;
|
|
113
113
|
}), u = P({
|
|
@@ -137,7 +137,7 @@ function K(t) {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
function Q(t) {
|
|
140
|
-
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } =
|
|
140
|
+
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = a(), e = h(() => {
|
|
141
141
|
const { onError: o, options: n, ...r } = t;
|
|
142
142
|
return r;
|
|
143
143
|
}), u = P({
|
|
@@ -167,7 +167,7 @@ function Q(t) {
|
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
function k(t) {
|
|
170
|
-
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } =
|
|
170
|
+
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = a(), e = h(() => {
|
|
171
171
|
const { onError: o, options: n, ...r } = t;
|
|
172
172
|
return r;
|
|
173
173
|
}), u = P({
|
|
@@ -197,7 +197,7 @@ function k(t) {
|
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
function I(t) {
|
|
200
|
-
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } =
|
|
200
|
+
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = a(), e = h(() => {
|
|
201
201
|
const { onError: o, options: n, ...r } = t;
|
|
202
202
|
return r;
|
|
203
203
|
}), u = P({
|
|
@@ -227,7 +227,7 @@ function I(t) {
|
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
229
|
function O(t) {
|
|
230
|
-
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } =
|
|
230
|
+
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = a(), e = h(() => {
|
|
231
231
|
const { onError: o, options: n, ...r } = t;
|
|
232
232
|
return r;
|
|
233
233
|
}), u = P({
|
|
@@ -257,7 +257,7 @@ function O(t) {
|
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
259
|
function _(t) {
|
|
260
|
-
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } =
|
|
260
|
+
const i = l(), v = y(), d = t.providerName || "default", { mutate: f } = N(), { invalidate: s } = a(), e = h(() => {
|
|
261
261
|
const { onError: o, options: n, ...r } = t;
|
|
262
262
|
return r;
|
|
263
263
|
}), u = P({
|
|
@@ -299,7 +299,7 @@ function U(t) {
|
|
|
299
299
|
},
|
|
300
300
|
...t.options
|
|
301
301
|
}), u = h(() => e.isFetched ? !1 : e.isFetching);
|
|
302
|
-
return
|
|
302
|
+
return q(() => e.isError, () => {
|
|
303
303
|
var o;
|
|
304
304
|
f(e.error), (o = t.onError) == null || o.call(t, e.error);
|
|
305
305
|
}), {
|
|
@@ -353,7 +353,7 @@ function b() {
|
|
|
353
353
|
}
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function a() {
|
|
357
357
|
const t = w(), i = l();
|
|
358
358
|
return {
|
|
359
359
|
invalidate: (d, f) => {
|
|
@@ -378,7 +378,7 @@ export {
|
|
|
378
378
|
O as useDelete,
|
|
379
379
|
_ as useDeleteMany,
|
|
380
380
|
z as useInfiniteList,
|
|
381
|
-
|
|
381
|
+
a as useInvalidate,
|
|
382
382
|
D as useList,
|
|
383
383
|
x as useMany,
|
|
384
384
|
C as useOne,
|
package/dist/esm/main.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "pinia
|
|
1
|
+
import { VueQueryPlugin as n } from "@tanstack/vue-query";
|
|
2
|
+
import { createPinia as t } from "pinia";
|
|
3
|
+
import u from "pinia-plugin-persistedstate";
|
|
3
4
|
import { ref as d } from "vue";
|
|
4
5
|
import { permissionDirective as c } from "./directive/permission.js";
|
|
5
|
-
import { initRouter as
|
|
6
|
-
function
|
|
7
|
-
const o =
|
|
8
|
-
return o.use(
|
|
6
|
+
import { initRouter as a } from "./router/route.js";
|
|
7
|
+
function l(e) {
|
|
8
|
+
const o = t();
|
|
9
|
+
return o.use(u), {
|
|
9
10
|
install(r) {
|
|
10
11
|
console.log(
|
|
11
12
|
"%c dux-vue %c dux.cn %c",
|
|
@@ -14,10 +15,10 @@ function x(e) {
|
|
|
14
15
|
"background:transparent"
|
|
15
16
|
);
|
|
16
17
|
const i = d();
|
|
17
|
-
r.provide("dux.config", e), r.provide("dux.manage", i), r.directive("can", c), r.use(
|
|
18
|
+
r.provide("dux.config", e), r.provide("dux.manage", i), r.directive("can", c), r.use(n), r.use(a(e)), r.use(o);
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
export {
|
|
22
|
-
|
|
23
|
+
l as createDux
|
|
23
24
|
};
|
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
1
|
+
import g from "axios";
|
|
2
|
+
function m(t) {
|
|
3
3
|
return {
|
|
4
|
-
login: async (
|
|
5
|
-
var
|
|
6
|
-
return await
|
|
7
|
-
var
|
|
4
|
+
login: async (n, c) => {
|
|
5
|
+
var d;
|
|
6
|
+
return await g.post(c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.login) || "/login", t == null ? void 0 : t.dataProviderName), n).then((e) => {
|
|
7
|
+
var i, a, s;
|
|
8
8
|
return {
|
|
9
9
|
success: !0,
|
|
10
|
-
message: (
|
|
11
|
-
redirectTo: ((
|
|
12
|
-
data: (
|
|
10
|
+
message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
|
|
11
|
+
redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.index) || "/",
|
|
12
|
+
data: (s = e == null ? void 0 : e.data) == null ? void 0 : s.data
|
|
13
13
|
};
|
|
14
|
-
}).catch((
|
|
15
|
-
var
|
|
14
|
+
}).catch((e) => {
|
|
15
|
+
var i, a;
|
|
16
16
|
return {
|
|
17
17
|
success: !1,
|
|
18
|
-
message: ((
|
|
18
|
+
message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
21
|
},
|
|
22
|
-
check: async (
|
|
23
|
-
var
|
|
24
|
-
return await
|
|
25
|
-
var
|
|
22
|
+
check: async (n, c) => {
|
|
23
|
+
var d;
|
|
24
|
+
return await g.get((c == null ? void 0 : c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.check) || "/check", t == null ? void 0 : t.dataProviderName)) || "").then((e) => {
|
|
25
|
+
var i, a;
|
|
26
26
|
return {
|
|
27
27
|
success: !0,
|
|
28
|
-
message: (
|
|
29
|
-
data: (
|
|
28
|
+
message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
|
|
29
|
+
data: (a = e == null ? void 0 : e.data) == null ? void 0 : a.data
|
|
30
30
|
};
|
|
31
|
-
}).catch((
|
|
32
|
-
var
|
|
31
|
+
}).catch((e) => {
|
|
32
|
+
var i, a;
|
|
33
33
|
return {
|
|
34
34
|
success: !1,
|
|
35
|
-
message: ((
|
|
35
|
+
message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
38
|
},
|
|
39
|
-
onError: async (
|
|
39
|
+
onError: async (n) => {
|
|
40
40
|
var c;
|
|
41
|
-
return
|
|
41
|
+
return n.status === 403 ? {
|
|
42
42
|
logout: !0,
|
|
43
|
-
redirectTo: ((c =
|
|
44
|
-
error:
|
|
43
|
+
redirectTo: ((c = t == null ? void 0 : t.routePath) == null ? void 0 : c.login) || "/login",
|
|
44
|
+
error: n
|
|
45
45
|
} : {
|
|
46
46
|
logout: !1,
|
|
47
|
-
error:
|
|
47
|
+
error: n
|
|
48
48
|
};
|
|
49
49
|
},
|
|
50
50
|
logout: async () => {
|
|
51
|
-
var
|
|
51
|
+
var n;
|
|
52
52
|
return {
|
|
53
53
|
success: !0,
|
|
54
|
-
redirectTo: ((
|
|
54
|
+
redirectTo: ((n = t == null ? void 0 : t.routePath) == null ? void 0 : n.login) || "/login"
|
|
55
55
|
};
|
|
56
56
|
},
|
|
57
|
-
register: async (
|
|
58
|
-
var
|
|
59
|
-
return await
|
|
60
|
-
var
|
|
57
|
+
register: async (n, c) => {
|
|
58
|
+
var d;
|
|
59
|
+
return await g.post((c == null ? void 0 : c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.register) || "/register", t == null ? void 0 : t.dataProviderName)) || "", n).then((e) => {
|
|
60
|
+
var i, a, s;
|
|
61
61
|
return {
|
|
62
62
|
success: !0,
|
|
63
|
-
message: (
|
|
64
|
-
redirectTo: ((
|
|
65
|
-
data: (
|
|
63
|
+
message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
|
|
64
|
+
redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.index) || "/",
|
|
65
|
+
data: (s = e == null ? void 0 : e.data) == null ? void 0 : s.data
|
|
66
66
|
};
|
|
67
|
-
}).catch((
|
|
68
|
-
var
|
|
67
|
+
}).catch((e) => {
|
|
68
|
+
var i, a;
|
|
69
69
|
return {
|
|
70
70
|
success: !1,
|
|
71
|
-
message: ((
|
|
71
|
+
message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
|
|
72
72
|
};
|
|
73
73
|
});
|
|
74
74
|
},
|
|
75
|
-
forgotPassword: async (
|
|
76
|
-
var
|
|
77
|
-
return await
|
|
78
|
-
var
|
|
75
|
+
forgotPassword: async (n, c) => {
|
|
76
|
+
var d;
|
|
77
|
+
return await g.post((c == null ? void 0 : c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.forgotPassword) || "/forgot-password", t == null ? void 0 : t.dataProviderName)) || "", n).then((e) => {
|
|
78
|
+
var i, a;
|
|
79
79
|
return {
|
|
80
80
|
success: !0,
|
|
81
|
-
message: (
|
|
82
|
-
redirectTo: ((
|
|
81
|
+
message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
|
|
82
|
+
redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.login) || "/login"
|
|
83
83
|
};
|
|
84
|
-
}).catch((
|
|
85
|
-
var
|
|
84
|
+
}).catch((e) => {
|
|
85
|
+
var i, a;
|
|
86
86
|
return {
|
|
87
87
|
success: !1,
|
|
88
|
-
message: ((
|
|
88
|
+
message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
|
|
89
89
|
};
|
|
90
90
|
});
|
|
91
91
|
},
|
|
92
|
-
updatePassword: async (
|
|
93
|
-
var
|
|
94
|
-
return await
|
|
95
|
-
var
|
|
92
|
+
updatePassword: async (n, c) => {
|
|
93
|
+
var d;
|
|
94
|
+
return await g.post((c == null ? void 0 : c.getApiUrl(((d = t == null ? void 0 : t.apiPath) == null ? void 0 : d.updatePassword) || "/update-password", t == null ? void 0 : t.dataProviderName)) || "", n).then((e) => {
|
|
95
|
+
var i, a;
|
|
96
96
|
return {
|
|
97
97
|
success: !0,
|
|
98
|
-
message: (
|
|
99
|
-
redirectTo: ((
|
|
98
|
+
message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
|
|
99
|
+
redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.login) || "/login"
|
|
100
100
|
};
|
|
101
|
-
}).catch((
|
|
102
|
-
var
|
|
101
|
+
}).catch((e) => {
|
|
102
|
+
var i, a;
|
|
103
103
|
return {
|
|
104
104
|
success: !1,
|
|
105
|
-
message: ((
|
|
105
|
+
message: ((a = (i = e == null ? void 0 : e.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (e == null ? void 0 : e.message)
|
|
106
106
|
};
|
|
107
107
|
});
|
|
108
108
|
},
|
|
109
|
-
can: (
|
|
110
|
-
var
|
|
111
|
-
return !(
|
|
109
|
+
can: (n, c, d, e) => {
|
|
110
|
+
var i, a;
|
|
111
|
+
return !(e != null && e.permission) || Array.isArray(e == null ? void 0 : e.permission) && ((i = e == null ? void 0 : e.permission) == null ? void 0 : i.length) === 0 || typeof (e == null ? void 0 : e.permission) == "object" && Object.keys(e == null ? void 0 : e.permission).length === 0 ? !0 : !(Array.isArray(e == null ? void 0 : e.permission) && !((a = e == null ? void 0 : e.permission) != null && a.includes(n)) || typeof (e == null ? void 0 : e.permission) == "object" && (e == null ? void 0 : e.permission[n]) === !1);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
export {
|
|
116
|
-
|
|
116
|
+
m as simpleAuthProvider
|
|
117
117
|
};
|
|
@@ -6,7 +6,7 @@ function z(g) {
|
|
|
6
6
|
apiUrl: t,
|
|
7
7
|
getList: (e, n, r) => {
|
|
8
8
|
const a = {};
|
|
9
|
-
return e.pagination && typeof e.pagination == "object" && (a.page = e.pagination.page, a.
|
|
9
|
+
return e.pagination && typeof e.pagination == "object" && (a.page = e.pagination.page, a.pageSize = e.pagination.pageSize), d.get(t(e.path) || "", {
|
|
10
10
|
params: {
|
|
11
11
|
...a,
|
|
12
12
|
...e.filters,
|
package/dist/esm/provider/app.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { OverlaysProvider as
|
|
3
|
-
import { useRouter as
|
|
4
|
-
import { useCan as
|
|
5
|
-
import { useConfig as
|
|
1
|
+
import { defineComponent as O, inject as U, createVNode as V } from "vue";
|
|
2
|
+
import { OverlaysProvider as q } from "@overlastic/vue";
|
|
3
|
+
import { useRouter as B } from "vue-router";
|
|
4
|
+
import { useCan as G } from "../hooks/auth.js";
|
|
5
|
+
import { useConfig as H } from "../hooks/config.js";
|
|
6
6
|
import "@tanstack/vue-query";
|
|
7
|
-
import { useManage as
|
|
7
|
+
import { useManage as J } from "../hooks/manage.js";
|
|
8
8
|
import "lodash-es";
|
|
9
9
|
import "pinia";
|
|
10
|
-
import { useAuthStore as
|
|
11
|
-
import { useRouteStore as
|
|
12
|
-
import { useManageStore as
|
|
13
|
-
import { useI18nStore as
|
|
10
|
+
import { useAuthStore as K } from "../stores/auth.js";
|
|
11
|
+
import { useRouteStore as Q } from "../stores/route.js";
|
|
12
|
+
import { useManageStore as T } from "../stores/manage.js";
|
|
13
|
+
import { useI18nStore as W } from "../stores/i18n.js";
|
|
14
14
|
import "@vueuse/core";
|
|
15
15
|
import "clsx";
|
|
16
|
-
const
|
|
16
|
+
const he = /* @__PURE__ */ O({
|
|
17
17
|
name: "DuxAppProvider",
|
|
18
18
|
props: {},
|
|
19
|
-
setup(
|
|
19
|
+
setup(X, {
|
|
20
20
|
slots: m
|
|
21
21
|
}) {
|
|
22
|
-
const f =
|
|
23
|
-
return s.beforeEach(async (
|
|
24
|
-
var
|
|
25
|
-
const t =
|
|
22
|
+
const f = U("dux.manage"), u = H(), s = B();
|
|
23
|
+
return s.beforeEach(async (r, Y, n) => {
|
|
24
|
+
var P, R, b, A, S, $, M, k, w, z, I, C, y, D;
|
|
25
|
+
const t = r.meta.manageName, _ = r.meta.authorization === !1;
|
|
26
26
|
if (!t) {
|
|
27
|
-
const e =
|
|
27
|
+
const e = u.defaultManage || ((R = (P = u.manages) == null ? void 0 : P[0]) == null ? void 0 : R.name) || "";
|
|
28
28
|
return n({
|
|
29
29
|
path: `/${e}`,
|
|
30
30
|
replace: !0
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
f && (f.value = t);
|
|
34
|
-
const h =
|
|
35
|
-
h.isInit() || h.setConfig((b =
|
|
36
|
-
const
|
|
37
|
-
if ((A =
|
|
34
|
+
const h = T(t);
|
|
35
|
+
h.isInit() || h.setConfig((b = u.manages) == null ? void 0 : b.find((e) => e.name === t), u);
|
|
36
|
+
const i = Q(t), a = J(t), d = K(t), l = W(t);
|
|
37
|
+
if ((A = a.config) != null && A.i18nProvider && !l.isInit()) {
|
|
38
38
|
const e = l.getLocale();
|
|
39
|
-
e && ((S =
|
|
39
|
+
e && ((S = a.config) == null || S.i18nProvider.changeLocale(e));
|
|
40
40
|
}
|
|
41
41
|
if (!d.isLogin())
|
|
42
42
|
return _ ? n() : n({
|
|
43
|
-
path:
|
|
43
|
+
path: a.getRoutePath("login"),
|
|
44
44
|
replace: !0
|
|
45
45
|
});
|
|
46
|
-
const g = (e) => e == null ? void 0 : e.map((
|
|
47
|
-
...
|
|
48
|
-
path:
|
|
46
|
+
const g = (e) => e == null ? void 0 : e.map((p) => ({
|
|
47
|
+
...p,
|
|
48
|
+
path: a.getRoutePath(p.path || "")
|
|
49
49
|
}));
|
|
50
|
-
if (!
|
|
51
|
-
const e = (($ =
|
|
52
|
-
if (
|
|
50
|
+
if (!i.getRouteInit()) {
|
|
51
|
+
const e = (($ = a.config) == null ? void 0 : $.components) || {}, p = [];
|
|
52
|
+
if (p.push({
|
|
53
53
|
name: `${t}.notFound`,
|
|
54
54
|
label: "404",
|
|
55
55
|
path: ":pathMatch(.*)*",
|
|
@@ -58,7 +58,7 @@ const se = /* @__PURE__ */ j({
|
|
|
58
58
|
meta: {
|
|
59
59
|
can: !1
|
|
60
60
|
}
|
|
61
|
-
}),
|
|
61
|
+
}), p.push({
|
|
62
62
|
name: `${t}.notAuthorized`,
|
|
63
63
|
label: "403",
|
|
64
64
|
path: "notAuthorized",
|
|
@@ -67,7 +67,7 @@ const se = /* @__PURE__ */ j({
|
|
|
67
67
|
meta: {
|
|
68
68
|
can: !1
|
|
69
69
|
}
|
|
70
|
-
}),
|
|
70
|
+
}), p.push({
|
|
71
71
|
name: `${t}.error`,
|
|
72
72
|
label: "500",
|
|
73
73
|
path: "error",
|
|
@@ -76,71 +76,71 @@ const se = /* @__PURE__ */ j({
|
|
|
76
76
|
meta: {
|
|
77
77
|
can: !1
|
|
78
78
|
}
|
|
79
|
-
}),
|
|
79
|
+
}), i.setRoutes(g(((M = a.config) == null ? void 0 : M.menus) || [])), (k = a.config) != null && k.apiRoutePath)
|
|
80
80
|
try {
|
|
81
|
-
await ((I = (z = (w =
|
|
82
|
-
path:
|
|
81
|
+
await ((I = (z = (w = a.config) == null ? void 0 : w.dataProvider) == null ? void 0 : z.default) == null ? void 0 : I.custom({
|
|
82
|
+
path: a.config.apiRoutePath,
|
|
83
83
|
meta: {
|
|
84
84
|
timeout: 5e3
|
|
85
85
|
}
|
|
86
|
-
},
|
|
87
|
-
|
|
86
|
+
}, a, d.getUser()).then((o) => {
|
|
87
|
+
i.appendRoutes(g(o.data || []));
|
|
88
88
|
}));
|
|
89
89
|
} catch (o) {
|
|
90
90
|
console.error(o);
|
|
91
91
|
}
|
|
92
|
-
return
|
|
93
|
-
var
|
|
92
|
+
return i.appendRoutes(p), i.getRoutes().forEach((o) => {
|
|
93
|
+
var E, F;
|
|
94
94
|
if (!o.path)
|
|
95
95
|
return;
|
|
96
|
-
const
|
|
96
|
+
const c = {
|
|
97
97
|
name: o.name,
|
|
98
98
|
path: o.path,
|
|
99
99
|
meta: o.meta
|
|
100
100
|
};
|
|
101
101
|
switch (o.loader) {
|
|
102
102
|
case "iframe":
|
|
103
|
-
|
|
103
|
+
c.component = ((F = (E = a.config) == null ? void 0 : E.components) == null ? void 0 : F.iframe) || (() => import("../components/loader/iframe.js"));
|
|
104
104
|
break;
|
|
105
105
|
case "link":
|
|
106
|
-
|
|
106
|
+
c.beforeEnter = () => {
|
|
107
107
|
var N;
|
|
108
108
|
const L = ((N = o.meta) == null ? void 0 : N.url) || o.path;
|
|
109
109
|
return L && window.open(L, "_blank"), !1;
|
|
110
|
-
},
|
|
110
|
+
}, c.component = () => Promise.resolve({
|
|
111
111
|
template: "<div></div>"
|
|
112
112
|
});
|
|
113
113
|
break;
|
|
114
114
|
default:
|
|
115
|
-
o.component && (
|
|
115
|
+
o.component && (c.component = o.component);
|
|
116
116
|
break;
|
|
117
117
|
}
|
|
118
|
-
s.addRoute(`${t}.auth`,
|
|
118
|
+
s.addRoute(`${t}.auth`, c);
|
|
119
119
|
}), n({
|
|
120
|
-
path:
|
|
120
|
+
path: ((C = r.redirectedFrom) == null ? void 0 : C.path) || r.path,
|
|
121
121
|
replace: !0
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
const e =
|
|
127
|
-
return !(e != null && e.path) ||
|
|
124
|
+
const v = ["", "/", `/${t}`, `/${t}/`];
|
|
125
|
+
if (v.includes(r.path)) {
|
|
126
|
+
const e = i.getIndexRoute();
|
|
127
|
+
return !(e != null && e.path) || v.includes(e == null ? void 0 : e.path) ? (console.warn("[Dux] index route not found, skip redirect"), n()) : n({
|
|
128
128
|
path: (e == null ? void 0 : e.path) || "/",
|
|
129
129
|
replace: !0
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
const
|
|
133
|
-
return (((
|
|
132
|
+
const j = G(t);
|
|
133
|
+
return (((y = r.meta) == null ? void 0 : y.can) === void 0 || ((D = r.meta) == null ? void 0 : D.can) === !0) && !j(r.name) ? n({
|
|
134
134
|
name: `${t}.notAuthorized`
|
|
135
135
|
}) : n();
|
|
136
|
-
}), () =>
|
|
136
|
+
}), () => V(q, null, {
|
|
137
137
|
default: () => {
|
|
138
|
-
var
|
|
139
|
-
return [(
|
|
138
|
+
var r;
|
|
139
|
+
return [(r = m.default) == null ? void 0 : r.call(m)];
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
export {
|
|
145
|
-
|
|
145
|
+
he as DuxAppProvider
|
|
146
146
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DefaultError, DefinedInitialDataInfiniteOptions, DefinedInitialQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/vue-query';
|
|
2
2
|
import type { IDataProviderCreateManyOptions, IDataProviderCreateOptions, IDataProviderCustomOptions, IDataProviderDeleteManyOptions, IDataProviderDeleteOptions, IDataProviderGetManyOptions, IDataProviderGetOneOptions, IDataProviderListOptions, IDataProviderResponse, IDataProviderUpdateManyOptions, IDataProviderUpdateOptions } from '../types';
|
|
3
|
-
type IDataQueryOptions = DefinedInitialQueryOptions<IDataProviderResponse | undefined, DefaultError, IDataProviderResponse | undefined, any
|
|
4
|
-
type IDataQueryOptionsInfinite = DefinedInitialDataInfiniteOptions<IDataProviderResponse | undefined, DefaultError, InfiniteData<IDataProviderResponse | undefined>, any, number
|
|
3
|
+
type IDataQueryOptions = Partial<DefinedInitialQueryOptions<IDataProviderResponse | undefined, DefaultError, IDataProviderResponse | undefined, any>>;
|
|
4
|
+
type IDataQueryOptionsInfinite = Partial<DefinedInitialDataInfiniteOptions<IDataProviderResponse | undefined, DefaultError, InfiniteData<IDataProviderResponse | undefined>, any, number>>;
|
|
5
5
|
interface IListParams extends IDataProviderListOptions {
|
|
6
6
|
providerName?: string;
|
|
7
7
|
options?: IDataQueryOptions;
|
|
@@ -12,7 +12,7 @@ interface IListParams extends IDataProviderListOptions {
|
|
|
12
12
|
* @param params
|
|
13
13
|
*/
|
|
14
14
|
export declare function useList(params: IListParams): {
|
|
15
|
-
isLoading: import("vue").ComputedRef<
|
|
15
|
+
isLoading: import("vue").ComputedRef<boolean>;
|
|
16
16
|
data: import("vue").Ref<IDataProviderResponse | undefined, IDataProviderResponse | undefined> | import("vue").Ref<undefined, undefined>;
|
|
17
17
|
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
18
18
|
error: import("vue").Ref<Error, Error>;
|
|
@@ -39,7 +39,7 @@ export declare function useList(params: IListParams): {
|
|
|
39
39
|
promise: import("vue").Ref<Promise<IDataProviderResponse | undefined>, Promise<IDataProviderResponse | undefined>>;
|
|
40
40
|
suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
41
41
|
} | {
|
|
42
|
-
isLoading: import("vue").ComputedRef<
|
|
42
|
+
isLoading: import("vue").ComputedRef<boolean>;
|
|
43
43
|
data: import("vue").Ref<IDataProviderResponse | undefined, IDataProviderResponse | undefined> | import("vue").Ref<undefined, undefined>;
|
|
44
44
|
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
45
45
|
error: import("vue").Ref<null, null>;
|
|
@@ -66,7 +66,7 @@ export declare function useList(params: IListParams): {
|
|
|
66
66
|
promise: import("vue").Ref<Promise<IDataProviderResponse | undefined>, Promise<IDataProviderResponse | undefined>>;
|
|
67
67
|
suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
68
68
|
} | {
|
|
69
|
-
isLoading: import("vue").ComputedRef<
|
|
69
|
+
isLoading: import("vue").ComputedRef<boolean>;
|
|
70
70
|
data: import("vue").Ref<IDataProviderResponse | undefined, IDataProviderResponse | undefined> | import("vue").Ref<undefined, undefined>;
|
|
71
71
|
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
72
72
|
error: import("vue").Ref<Error, Error>;
|
|
@@ -93,7 +93,7 @@ export declare function useList(params: IListParams): {
|
|
|
93
93
|
promise: import("vue").Ref<Promise<IDataProviderResponse | undefined>, Promise<IDataProviderResponse | undefined>>;
|
|
94
94
|
suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
95
95
|
} | {
|
|
96
|
-
isLoading: import("vue").ComputedRef<
|
|
96
|
+
isLoading: import("vue").ComputedRef<boolean>;
|
|
97
97
|
data: import("vue").Ref<IDataProviderResponse | undefined, IDataProviderResponse | undefined> | import("vue").Ref<undefined, undefined>;
|
|
98
98
|
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
99
99
|
error: import("vue").Ref<null, null>;
|
|
@@ -120,7 +120,7 @@ export declare function useList(params: IListParams): {
|
|
|
120
120
|
promise: import("vue").Ref<Promise<IDataProviderResponse | undefined>, Promise<IDataProviderResponse | undefined>>;
|
|
121
121
|
suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
122
122
|
} | {
|
|
123
|
-
isLoading: import("vue").ComputedRef<
|
|
123
|
+
isLoading: import("vue").ComputedRef<boolean>;
|
|
124
124
|
data: import("vue").Ref<IDataProviderResponse | undefined, IDataProviderResponse | undefined> | import("vue").Ref<undefined, undefined>;
|
|
125
125
|
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
126
126
|
error: import("vue").Ref<null, null>;
|
|
@@ -147,7 +147,7 @@ export declare function useList(params: IListParams): {
|
|
|
147
147
|
promise: import("vue").Ref<Promise<IDataProviderResponse | undefined>, Promise<IDataProviderResponse | undefined>>;
|
|
148
148
|
suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
149
149
|
} | {
|
|
150
|
-
isLoading: import("vue").ComputedRef<
|
|
150
|
+
isLoading: import("vue").ComputedRef<boolean>;
|
|
151
151
|
data: import("vue").Ref<IDataProviderResponse | undefined, IDataProviderResponse | undefined> | import("vue").Ref<undefined, undefined>;
|
|
152
152
|
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<IDataProviderResponse | undefined, Error>>;
|
|
153
153
|
isError: import("vue").Ref<false, false>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type SelectValue = Array<string | number> | string | number | null | undefined;
|
|
2
|
+
interface UseSelectProps {
|
|
3
|
+
value: SelectValue;
|
|
4
|
+
path?: string;
|
|
5
|
+
params?: Record<string, any>;
|
|
6
|
+
pagination?: boolean | number;
|
|
7
|
+
optionLabel?: string | ((item: Record<string, any>) => string);
|
|
8
|
+
optionValue?: string | ((item: Record<string, any>) => string);
|
|
9
|
+
optionField?: string;
|
|
10
|
+
keywordField?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function useSelect(props: UseSelectProps): {
|
|
13
|
+
onSearch: (searchValue: string) => void;
|
|
14
|
+
options: import("vue").ComputedRef<{
|
|
15
|
+
label: string;
|
|
16
|
+
value: string | number;
|
|
17
|
+
raw: Record<string, any>;
|
|
18
|
+
}[]>;
|
|
19
|
+
meta: import("vue").ComputedRef<Record<string, any>>;
|
|
20
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
21
|
+
page: import("vue").Ref<number, number>;
|
|
22
|
+
pageSize: import("vue").Ref<number, number>;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -26,9 +26,8 @@ export interface IDataProviderResponse {
|
|
|
26
26
|
export interface IDataProviderListOptions {
|
|
27
27
|
path: string;
|
|
28
28
|
pagination?: {
|
|
29
|
-
page
|
|
30
|
-
|
|
31
|
-
pageSize: number;
|
|
29
|
+
page?: number;
|
|
30
|
+
pageSize?: number;
|
|
32
31
|
} | boolean;
|
|
33
32
|
sorters?: Record<string, 'asc' | 'desc'>;
|
|
34
33
|
filters?: Record<string, any>;
|