@duxweb/dvha-core 0.1.5 → 0.1.7
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/hooks/select.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/main.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/hooks/select.js +85 -0
- package/dist/esm/index.js +43 -41
- package/dist/esm/main.js +9 -8
- 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/index.d.ts +1 -0
- package/dist/types/hooks/select.d.ts +25 -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("lodash-es"),u=require("vue"),b=require("./data.cjs");function E(t){const c=u.ref(),r=u.ref(1),d=u.ref(typeof t.pagination=="number"?t.pagination:t.pagination?20:0),f=u.ref(!1),S=h.debounce(e=>{c.value=e},t.debounce||300),V=e=>{S(e)};u.watch([()=>t.path,()=>t.params,c],()=>{t.pagination&&(r.value=1)},{deep:!0});const{data:s,isLoading:w}=b.useCustom({get path(){return t.path||""},get filters(){return t.params},get query(){const e={};return t.pagination&&(e.page=r.value,e.pageSize=d.value),c.value&&(e[t.keywordField||"keyword"]=c.value),Object.keys(e).length?e:void 0}}),g=u.ref([]),v=e=>{const{optionField:n}=t;return typeof n=="string"?e[n]||e.value||e.id:e.value||e.id},q=e=>{const{optionLabel:n="label",optionValue:o="value"}=t;let l;typeof n=="function"?l=n(e):typeof n=="string"?l=e[n]||e.label||e.name||e.title||String(e.value||e.id||""):l=e.label||e.name||e.title||String(e.value||e.id||"");let a;return typeof o=="function"?a=o(e):typeof o=="string"?a=e[o]||e.value||e.id:a=e.value||e.id,{label:l,value:a,raw:e}},y=u.computed(()=>{var o;const e=((o=s.value)==null?void 0:o.data)||[],n=[...g.value];return e.forEach(l=>{n.some(i=>v(i)===v(l))||n.push(l)}),n.map(l=>q(l))}),O=u.computed(()=>{var e;return((e=s.value)==null?void 0:e.meta)||{}}),{refetch:k}=b.useMany({get path(){return t.path||""},get ids(){return t.defaultValue?h.isArray(t.defaultValue)?t.defaultValue:[t.defaultValue]:[]},options:{enabled:!1}});u.watch(()=>t.defaultValue,async e=>{var l;if(!(f.value||!e||(f.value=!0,(Array.isArray(e)?e:[e]).every(a=>y.value.some(i=>i.value===a)))))try{const a=await k();g.value=((l=a==null?void 0:a.data)==null?void 0:l.data)||[]}catch(a){console.warn("Failed to fetch selected items:",a)}},{immediate:!0});const x=u.computed(()=>w.value&&!s.value);return{onSearch:V,options:y,meta:O,loading:x,page:r,pageSize:d}}exports.useSelect=E;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./main.cjs"),u=require("./hooks/auth.cjs"),t=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),o=require("./hooks/manage.cjs"),a=require("./hooks/menu.cjs"),n=require("./hooks/theme.cjs"),i=require("./hooks/overlay.cjs"),c=require("./hooks/i18n.cjs"),d=require("./router/route.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./main.cjs"),u=require("./hooks/auth.cjs"),t=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),o=require("./hooks/manage.cjs"),a=require("./hooks/menu.cjs"),n=require("./hooks/theme.cjs"),i=require("./hooks/overlay.cjs"),c=require("./hooks/i18n.cjs"),d=require("./hooks/select.cjs"),q=require("./router/route.cjs"),l=require("./stores/auth.cjs"),g=require("./stores/route.cjs"),v=require("./stores/tab.cjs"),D=require("./stores/manage.cjs"),m=require("./stores/i18n.cjs"),y=require("./components/common/logo.cjs"),C=require("./components/loader/iframe.cjs"),p=require("./components/overlay/overlay.cjs"),M=require("./components/auth/can.cjs"),r=require("./utils/tree.cjs"),h=require("./provider/app.cjs"),P=require("./provider/tab.cjs"),T=require("./preset/authProvider.cjs"),S=require("./preset/dataProvider.cjs"),x=require("./preset/i18nProvider.cjs");exports.createDux=s.createDux;exports.useCan=u.useCan;exports.useCheck=u.useCheck;exports.useError=u.useError;exports.useForgotPassword=u.useForgotPassword;exports.useGetAuth=u.useGetAuth;exports.useIsLogin=u.useIsLogin;exports.useLogin=u.useLogin;exports.useLogout=u.useLogout;exports.useRegister=u.useRegister;exports.useUpdatePassword=u.useUpdatePassword;exports.useConfig=t.useConfig;exports.useClient=e.useClient;exports.useCreate=e.useCreate;exports.useCreateMany=e.useCreateMany;exports.useCustom=e.useCustom;exports.useCustomMutation=e.useCustomMutation;exports.useDelete=e.useDelete;exports.useDeleteMany=e.useDeleteMany;exports.useInfiniteList=e.useInfiniteList;exports.useInvalidate=e.useInvalidate;exports.useList=e.useList;exports.useMany=e.useMany;exports.useOne=e.useOne;exports.useUpdate=e.useUpdate;exports.useUpdateMany=e.useUpdateMany;exports.useManage=o.useManage;exports.useMenu=a.useMenu;exports.useTheme=n.useTheme;exports.useOverlay=i.useOverlay;exports.useI18n=c.useI18n;exports.useSelect=d.useSelect;exports.initRouter=q.initRouter;exports.useAuthStore=l.useAuthStore;exports.useRouteStore=g.useRouteStore;exports.useTabStore=v.useTabStore;exports.useManageStore=D.useManageStore;exports.useI18nStore=m.useI18nStore;exports.DuxLogo=y.DuxLogo;exports.DuxLoaderIframe=C;exports.DuxOverlay=p.DuxOverlay;exports.DuxCan=M.DuxCan;exports.arrayToTree=r.arrayToTree;exports.searchTree=r.searchTree;exports.treeToArr=r.treeToArr;exports.DuxAppProvider=h.DuxAppProvider;exports.DuxTabRouterView=P.DuxTabRouterView;exports.simpleAuthProvider=T.simpleAuthProvider;exports.simpleDataProvider=S.simpleDataProvider;exports.i18nProvider=x.i18nProvider;
|
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 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,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { debounce as A, isArray as E } from "lodash-es";
|
|
2
|
+
import { ref as o, watch as b, computed as d } from "vue";
|
|
3
|
+
import { useCustom as q, useMany as z } from "./data.js";
|
|
4
|
+
function p(a) {
|
|
5
|
+
const r = o(), c = o(1), f = o(
|
|
6
|
+
typeof a.pagination == "number" ? a.pagination : a.pagination ? 20 : 0
|
|
7
|
+
), g = o(!1), V = A((e) => {
|
|
8
|
+
r.value = e;
|
|
9
|
+
}, a.debounce || 300), S = (e) => {
|
|
10
|
+
V(e);
|
|
11
|
+
};
|
|
12
|
+
b([() => a.path, () => a.params, r], () => {
|
|
13
|
+
a.pagination && (c.value = 1);
|
|
14
|
+
}, { deep: !0 });
|
|
15
|
+
const { data: i, isLoading: w } = q({
|
|
16
|
+
get path() {
|
|
17
|
+
return a.path || "";
|
|
18
|
+
},
|
|
19
|
+
get filters() {
|
|
20
|
+
return a.params;
|
|
21
|
+
},
|
|
22
|
+
get query() {
|
|
23
|
+
const e = {};
|
|
24
|
+
return a.pagination && (e.page = c.value, e.pageSize = f.value), r.value && (e[a.keywordField || "keyword"] = r.value), Object.keys(e).length ? e : void 0;
|
|
25
|
+
}
|
|
26
|
+
}), v = o([]), y = (e) => {
|
|
27
|
+
const { optionField: n } = a;
|
|
28
|
+
return typeof n == "string" ? e[n] || e.value || e.id : e.value || e.id;
|
|
29
|
+
}, x = (e) => {
|
|
30
|
+
const { optionLabel: n = "label", optionValue: u = "value" } = a;
|
|
31
|
+
let l;
|
|
32
|
+
typeof n == "function" ? l = n(e) : typeof n == "string" ? l = e[n] || e.label || e.name || e.title || String(e.value || e.id || "") : l = e.label || e.name || e.title || String(e.value || e.id || "");
|
|
33
|
+
let t;
|
|
34
|
+
return typeof u == "function" ? t = u(e) : typeof u == "string" ? t = e[u] || e.value || e.id : t = e.value || e.id, {
|
|
35
|
+
label: l,
|
|
36
|
+
value: t,
|
|
37
|
+
raw: e
|
|
38
|
+
};
|
|
39
|
+
}, h = d(() => {
|
|
40
|
+
var u;
|
|
41
|
+
const e = ((u = i.value) == null ? void 0 : u.data) || [], n = [...v.value];
|
|
42
|
+
return e.forEach((l) => {
|
|
43
|
+
n.some(
|
|
44
|
+
(s) => y(s) === y(l)
|
|
45
|
+
) || n.push(l);
|
|
46
|
+
}), n.map((l) => x(l));
|
|
47
|
+
}), k = d(() => {
|
|
48
|
+
var e;
|
|
49
|
+
return ((e = i.value) == null ? void 0 : e.meta) || {};
|
|
50
|
+
}), { refetch: F } = z({
|
|
51
|
+
get path() {
|
|
52
|
+
return a.path || "";
|
|
53
|
+
},
|
|
54
|
+
get ids() {
|
|
55
|
+
return a.defaultValue ? E(a.defaultValue) ? a.defaultValue : [a.defaultValue] : [];
|
|
56
|
+
},
|
|
57
|
+
options: {
|
|
58
|
+
enabled: !1
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
b(() => a.defaultValue, async (e) => {
|
|
62
|
+
var l;
|
|
63
|
+
if (!(g.value || !e || (g.value = !0, (Array.isArray(e) ? e : [e]).every(
|
|
64
|
+
(t) => h.value.some((s) => s.value === t)
|
|
65
|
+
))))
|
|
66
|
+
try {
|
|
67
|
+
const t = await F();
|
|
68
|
+
v.value = ((l = t == null ? void 0 : t.data) == null ? void 0 : l.data) || [];
|
|
69
|
+
} catch (t) {
|
|
70
|
+
console.warn("Failed to fetch selected items:", t);
|
|
71
|
+
}
|
|
72
|
+
}, { immediate: !0 });
|
|
73
|
+
const O = d(() => w.value && !i.value);
|
|
74
|
+
return {
|
|
75
|
+
onSearch: S,
|
|
76
|
+
options: h,
|
|
77
|
+
meta: k,
|
|
78
|
+
loading: O,
|
|
79
|
+
page: c,
|
|
80
|
+
pageSize: f
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
p as useSelect
|
|
85
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { createDux as o } from "./main.js";
|
|
2
2
|
import { useCan as u, useCheck as s, useError as a, useForgotPassword as p, useGetAuth as x, useIsLogin as m, useLogin as f, useLogout as n, useRegister as i, useUpdatePassword as d } from "./hooks/auth.js";
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useClient as C, useCreate as M, useCreateMany as v, useCustom as y, useCustomMutation as L, useDelete as T, useDeleteMany as h, useInfiniteList as I, useInvalidate as P, useList as
|
|
3
|
+
import { useConfig as D } from "./hooks/config.js";
|
|
4
|
+
import { useClient as C, useCreate as M, useCreateMany as v, useCustom as y, useCustomMutation as L, useDelete as T, useDeleteMany as h, useInfiniteList as I, useInvalidate as P, useList as S, useMany as A, useOne as c, useUpdate as R, useUpdateMany as w } from "./hooks/data.js";
|
|
5
5
|
import { useManage as U } from "./hooks/manage.js";
|
|
6
6
|
import { useMenu as k } from "./hooks/menu.js";
|
|
7
7
|
import { useTheme as F } from "./hooks/theme.js";
|
|
8
8
|
import { useOverlay as V } from "./hooks/overlay.js";
|
|
9
9
|
import { useI18n as q } from "./hooks/i18n.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
10
|
+
import { useSelect as B } from "./hooks/select.js";
|
|
11
|
+
import { initRouter as J } from "./router/route.js";
|
|
12
|
+
import { useAuthStore as N } from "./stores/auth.js";
|
|
13
|
+
import { useRouteStore as W } from "./stores/route.js";
|
|
14
|
+
import { useTabStore as Y } from "./stores/tab.js";
|
|
15
|
+
import { useManageStore as _ } from "./stores/manage.js";
|
|
16
|
+
import { useI18nStore as ee } from "./stores/i18n.js";
|
|
17
|
+
import { DuxLogo as oe } from "./components/common/logo.js";
|
|
18
|
+
import { default as ue } from "./components/loader/iframe.js";
|
|
19
|
+
import { DuxOverlay as ae } from "./components/overlay/overlay.js";
|
|
20
|
+
import { DuxCan as xe } from "./components/auth/can.js";
|
|
21
|
+
import { arrayToTree as fe, searchTree as ne, treeToArr as ie } from "./utils/tree.js";
|
|
22
|
+
import { DuxAppProvider as le } from "./provider/app.js";
|
|
23
|
+
import { DuxTabRouterView as ge } from "./provider/tab.js";
|
|
24
|
+
import { simpleAuthProvider as Me } from "./preset/authProvider.js";
|
|
25
|
+
import { simpleDataProvider as ye } from "./preset/dataProvider.js";
|
|
26
|
+
import { i18nProvider as Te } from "./preset/i18nProvider.js";
|
|
26
27
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
le as DuxAppProvider,
|
|
29
|
+
xe as DuxCan,
|
|
30
|
+
ue as DuxLoaderIframe,
|
|
31
|
+
oe as DuxLogo,
|
|
32
|
+
ae as DuxOverlay,
|
|
33
|
+
ge as DuxTabRouterView,
|
|
34
|
+
fe as arrayToTree,
|
|
34
35
|
o as createDux,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
Te as i18nProvider,
|
|
37
|
+
J as initRouter,
|
|
38
|
+
ne as searchTree,
|
|
39
|
+
Me as simpleAuthProvider,
|
|
40
|
+
ye as simpleDataProvider,
|
|
41
|
+
ie as treeToArr,
|
|
42
|
+
N as useAuthStore,
|
|
42
43
|
u as useCan,
|
|
43
44
|
s as useCheck,
|
|
44
45
|
C as useClient,
|
|
45
|
-
|
|
46
|
+
D as useConfig,
|
|
46
47
|
M as useCreate,
|
|
47
48
|
v as useCreateMany,
|
|
48
49
|
y as useCustom,
|
|
@@ -53,24 +54,25 @@ export {
|
|
|
53
54
|
p as useForgotPassword,
|
|
54
55
|
x as useGetAuth,
|
|
55
56
|
q as useI18n,
|
|
56
|
-
|
|
57
|
+
ee as useI18nStore,
|
|
57
58
|
I as useInfiniteList,
|
|
58
59
|
P as useInvalidate,
|
|
59
60
|
m as useIsLogin,
|
|
60
|
-
|
|
61
|
+
S as useList,
|
|
61
62
|
f as useLogin,
|
|
62
63
|
n as useLogout,
|
|
63
64
|
U as useManage,
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
_ as useManageStore,
|
|
66
|
+
A as useMany,
|
|
66
67
|
k as useMenu,
|
|
67
|
-
|
|
68
|
+
c as useOne,
|
|
68
69
|
V as useOverlay,
|
|
69
70
|
i as useRegister,
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
W as useRouteStore,
|
|
72
|
+
B as useSelect,
|
|
73
|
+
Y as useTabStore,
|
|
72
74
|
F as useTheme,
|
|
73
|
-
|
|
75
|
+
R as useUpdate,
|
|
74
76
|
w as useUpdateMany,
|
|
75
77
|
d as useUpdatePassword
|
|
76
78
|
};
|
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
|
};
|
|
@@ -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,25 @@
|
|
|
1
|
+
type SelectValue = Array<string | number> | string | number | null | undefined;
|
|
2
|
+
interface UseSelectProps {
|
|
3
|
+
defaultValue?: 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
|
+
debounce?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function useSelect(props: UseSelectProps): {
|
|
14
|
+
onSearch: (searchValue: string) => void;
|
|
15
|
+
options: import("vue").ComputedRef<{
|
|
16
|
+
label: string;
|
|
17
|
+
value: string | number;
|
|
18
|
+
raw: Record<string, any>;
|
|
19
|
+
}[]>;
|
|
20
|
+
meta: import("vue").ComputedRef<Record<string, any>>;
|
|
21
|
+
loading: import("vue").ComputedRef<boolean>;
|
|
22
|
+
page: import("vue").Ref<number, number>;
|
|
23
|
+
pageSize: import("vue").Ref<number, number>;
|
|
24
|
+
};
|
|
25
|
+
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>;
|