@duxweb/dvha-core 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("vue"),d=require("vue-router"),h=require("../stores/auth.cjs"),s=require("./manage.cjs");function m(e){const n=s.useManage(),o=h.useAuthStore(),r=d.useRouter(),g=S.ref(!1);return{mutate:async t=>{var c,i,f;g.value=!0;const u=await((c=n.config.authProvider)==null?void 0:c.login(t,n));if(g.value=!1,u!=null&&u.success){if(!(u!=null&&u.data))throw new Error("Login response data is undefined");(i=e==null?void 0:e.onSuccess)==null||i.call(e,u),o.login(u.data),r.push(n.getRoutePath(u.redirectTo||"/"));return}(f=e==null?void 0:e.onError)==null||f.call(e,u)},isLoading:g}}function P(e){const n=s.useManage(),o=h.useAuthStore(),r=d.useRouter();return{mutate:async a=>{var u,c,i;const t=await((u=n.config.authProvider)==null?void 0:u.logout(a,n));if(t!=null&&t.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,t),o.logout(),await r.replace(n.getRoutePath(t.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100);return}(i=e==null?void 0:e.onError)==null||i.call(e,t)}}}function w(e){const n=s.useManage(),o=h.useAuthStore(),r=d.useRouter();return{mutate:async a=>{var u,c,i;const t=await((u=n.config.authProvider)==null?void 0:u.check(a,n));if(t!=null&&t.success){if((c=e==null?void 0:e.onSuccess)==null||c.call(e,t),!(t!=null&&t.data))throw new Error("Check response data is undefined");o.update(t.data);return}(i=e==null?void 0:e.onError)==null||i.call(e,t),t!=null&&t.logout&&r.push(n.getRoutePath(t.redirectTo||"/login"))}}}function R(e){const n=s.useManage(),o=h.useAuthStore(),r=d.useRouter();return{mutate:async a=>{var u,c,i,f;const t=await((c=(u=n.config.authProvider)==null?void 0:u.register)==null?void 0:c.call(u,a,n));if(t!=null&&t.success){if((i=e==null?void 0:e.onSuccess)==null||i.call(e,t),!(t!=null&&t.data))throw new Error("Register response data is undefined");o.login(t.data),r.push(n.getRoutePath(t.redirectTo||""));return}(f=e==null?void 0:e.onError)==null||f.call(e,t)}}}function v(e){const n=s.useManage(),o=d.useRouter();return{mutate:async g=>{var t,u,c,i;const a=await((u=(t=n.config.authProvider)==null?void 0:t.forgotPassword)==null?void 0:u.call(t,g,n));if(a!=null&&a.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,a),a.redirectTo&&o.push(n.getRoutePath(a.redirectTo));return}(i=e==null?void 0:e.onError)==null||i.call(e,a)}}}function E(e){const n=s.useManage(),o=d.useRouter();return{mutate:async g=>{var t,u,c,i;const a=await((u=(t=n.config.authProvider)==null?void 0:t.updatePassword)==null?void 0:u.call(t,g,n));if(a!=null&&a.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,a),a.redirectTo&&o.push(n.getRoutePath(a.redirectTo));return}(i=e==null?void 0:e.onError)==null||i.call(e,a)}}}function T(e){const{config:n,getRoutePath:o}=s.useManage(),r=d.useRouter();return{mutate:async a=>{var u;const t=await((u=n.authProvider)==null?void 0:u.onError(a));e==null||e(t),t!=null&&t.logout&&r.push(o(t.redirectTo||"/login"))}}}function y(e){return h.useAuthStore(e).getUser()}function A(e){return h.useAuthStore(e).isLogin()}function L(e){const n=s.useManage(e),r=h.useAuthStore(e).getUser();return(a,t)=>{var u;return(u=n.config.authProvider)!=null&&u.can?n.config.authProvider.can(a,t,n,r):!0}}exports.useCan=L;exports.useCheck=w;exports.useError=T;exports.useForgotPassword=v;exports.useGetAuth=y;exports.useIsLogin=A;exports.useLogin=m;exports.useLogout=P;exports.useRegister=R;exports.useUpdatePassword=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("vue"),f=require("vue-router"),d=require("../stores/auth.cjs"),h=require("./manage.cjs");function S(e){const n=h.useManage(),i=d.useAuthStore(),r=f.useRouter(),g=w.ref(!1);return{mutate:async t=>{var c,o,s;g.value=!0;const u=await((c=n.config.authProvider)==null?void 0:c.login(t,n));if(g.value=!1,u!=null&&u.success){if(!(u!=null&&u.data))throw new Error("Login response data is undefined");(o=e==null?void 0:e.onSuccess)==null||o.call(e,u),i.login(u.data),r.push(n.getRoutePath(u.redirectTo||"/"));return}(s=e==null?void 0:e.onError)==null||s.call(e,u)},isLoading:g}}function m(e){const n=h.useManage(),i=d.useAuthStore(),r=f.useRouter();return{mutate:async a=>{var u,c,o;const t=await((u=n.config.authProvider)==null?void 0:u.logout(a,n));if(t!=null&&t.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,t),i.logout(),await r.replace(n.getRoutePath(t.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100);return}(o=e==null?void 0:e.onError)==null||o.call(e,t)}}}function P(e){const n=h.useManage(),i=d.useAuthStore(),r=f.useRouter();return{mutate:async a=>{var u,c,o,s;const t=await((c=(u=n.config.authProvider)==null?void 0:u.check)==null?void 0:c.call(u,a,n,i.getUser()));if(t!=null&&t.success){if((o=e==null?void 0:e.onSuccess)==null||o.call(e,t),!(t!=null&&t.data))throw new Error("Check response data is undefined");i.update(t.data);return}(s=e==null?void 0:e.onError)==null||s.call(e,t),t!=null&&t.logout&&(await r.replace(n.getRoutePath(t.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100))}}}function R(e){const n=h.useManage(),i=d.useAuthStore(),r=f.useRouter();return{mutate:async a=>{var u,c,o,s;const t=await((c=(u=n.config.authProvider)==null?void 0:u.register)==null?void 0:c.call(u,a,n));if(t!=null&&t.success){if((o=e==null?void 0:e.onSuccess)==null||o.call(e,t),!(t!=null&&t.data))throw new Error("Register response data is undefined");i.login(t.data),r.push(n.getRoutePath(t.redirectTo||"/"));return}(s=e==null?void 0:e.onError)==null||s.call(e,t)}}}function v(e){const n=h.useManage(),i=f.useRouter();return{mutate:async g=>{var t,u,c,o;const a=await((u=(t=n.config.authProvider)==null?void 0:t.forgotPassword)==null?void 0:u.call(t,g,n));if(a!=null&&a.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,a),a.redirectTo&&i.push(n.getRoutePath(a.redirectTo||"/"));return}(o=e==null?void 0:e.onError)==null||o.call(e,a)}}}function T(e){const n=h.useManage(),i=f.useRouter();return{mutate:async g=>{var t,u,c,o;const a=await((u=(t=n.config.authProvider)==null?void 0:t.updatePassword)==null?void 0:u.call(t,g,n));if(a!=null&&a.success){(c=e==null?void 0:e.onSuccess)==null||c.call(e,a),a.redirectTo&&i.push(n.getRoutePath(a.redirectTo||"/"));return}(o=e==null?void 0:e.onError)==null||o.call(e,a)}}}function E(e){const{config:n,getRoutePath:i}=h.useManage(),r=f.useRouter(),g=d.useAuthStore();return{mutate:async t=>{var c;const u=await((c=n.authProvider)==null?void 0:c.onError(t));e==null||e(u),u!=null&&u.logout&&(g.logout(),await r.replace(i(u.redirectTo||"/login")),setTimeout(()=>{window.location.reload()},100))}}}function A(e){return d.useAuthStore(e).getUser()}function y(e){return d.useAuthStore(e).isLogin()}function L(e){const n=h.useManage(e),r=d.useAuthStore(e).getUser();return(a,t)=>{var u;return(u=n.config.authProvider)!=null&&u.can?n.config.authProvider.can(a,t,n,r):!0}}exports.useCan=L;exports.useCheck=P;exports.useError=E;exports.useForgotPassword=v;exports.useGetAuth=A;exports.useIsLogin=y;exports.useLogin=S;exports.useLogout=m;exports.useRegister=R;exports.useUpdatePassword=T;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),h=require("./data.cjs"),w=e=>new Promise(t=>setTimeout(t,e));function y(e){const t=n.ref(!1),f=n.computed(()=>{const{onSuccess:u,onProgress:i,interval:l,maxPage:s,...r}=e;return{...r,options:{...r.options,enabled:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}}}),c=n.computed(()=>e.interval||300),{data:o,isLoading:g,fetchNextPage:v,hasNextPage:d,refetch:P,pagination:a}=h.useInfiniteList(f.value),m=async()=>{var u,i,l;if(!t.value)try{t.value=!0,a.value.page=1,(u=e.onProgress)==null||u.call(e,a.value),await P();const s=typeof e.maxPage=="function"?e.maxPage():e.maxPage||100;for(;d.value&&a.value.page<s;)c.value>0&&await w(c.value),await v(),(i=e.onProgress)==null||i.call(e,a.value);(l=e.onSuccess)==null||l.call(e,o.value)}finally{t.value=!1}},x=n.computed(()=>g.value||t.value);return{data:o,isLoading:x,trigger:m}}exports.useExport=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),h=require("./data.cjs"),w=e=>new Promise(a=>setTimeout(a,e));function y(e){const a=n.ref(!1),f=n.computed(()=>{const{onSuccess:u,onProgress:i,interval:l,maxPage:c,...r}=e;return{...r,options:{...r.options,enabled:!1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}}}),o=n.computed(()=>e.interval||300),{data:s,isLoading:g,fetchNextPage:v,hasNextPage:d,refetch:P,pagination:t}=h.useInfiniteList(f.value),m=async()=>{var u,i,l;if(!a.value)try{a.value=!0,t.value.page=1,(u=e.onProgress)==null||u.call(e,t.value),await P();const c=typeof e.maxPage=="function"?e.maxPage():e.maxPage||0;for(;d.value&&!(c>0&&t.value.page>=c);)o.value>0&&await w(o.value),await v(),(i=e.onProgress)==null||i.call(e,t.value);(l=e.onSuccess)==null||l.call(e,s.value)}finally{a.value=!1}},x=n.computed(()=>g.value||a.value);return{data:s,isLoading:x,trigger:m}}exports.useExport=y;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("json-2-csv"),l=require("vue"),f=require("./export.cjs");function h(e){const d=l.computed(()=>{const{filename:t,headers:n,csvOptions:o,...c}=e;return c}),v=l.computed(()=>{const t=e.csvOptions||{},n=t.quote;return{prependHeader:e.headers!==!1,keys:Array.isArray(e.headers)?e.headers:void 0,delimiter:{field:t.delimiter||",",wrap:typeof n=="string"?n:'"',eol:t.eol||`
2
- `},excelBOM:t.writeBOM||!1}});return f.useExport({...d.value,onSuccess:async t=>{var o,c,i,u;if(!(t!=null&&t.pages)){(o=e.onError)==null||o.call(e,{message:"No data to export",status:400});return}const n=t.pages.flatMap(r=>Array.isArray(r==null?void 0:r.data)?r.data:[]);if(!n||!(n!=null&&n.length)){(c=e.onError)==null||c.call(e,{message:"No data to export",status:400});return}try{const r=await y.json2csv(n,v.value),m=new Blob([r],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(m),s=document.createElement("a");s.href=a,s.download=e.filename||"export.csv",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(a),(i=e.onSuccess)==null||i.call(e,t)}catch(r){(u=e.onError)==null||u.call(e,{message:`CSV Export Error: ${r}`,status:500})}}})}exports.useExportCsv=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("json-2-csv"),d=require("vue"),y=require("./export.cjs");function f(e){const u=d.computed(()=>{const{filename:t,headers:n,csvOptions:a,...o}=e;return o}),l=d.computed(()=>{const t=e.csvOptions||{},n=t.quote;return{prependHeader:e.headers!==!1,keys:Array.isArray(e.headers)?e.headers:void 0,delimiter:{field:t.delimiter||",",wrap:typeof n=="string"?n:'"',eol:t.eol||`
2
+ `},excelBOM:t.writeBOM||!1}});return y.useExport({...u.value,onSuccess:async t=>{var n,a,o,s;if(!(t!=null&&t.data)||!((n=t==null?void 0:t.data)!=null&&n.length)){(a=e.onError)==null||a.call(e,{message:"No data to export",status:400});return}try{const r=await m.json2csv(t.data,l.value),v=new Blob([r],{type:"text/csv;charset=utf-8;"}),i=URL.createObjectURL(v),c=document.createElement("a");c.href=i,c.download=e.filename||"export.csv",c.style.display="none",document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(i),(o=e.onSuccess)==null||o.call(e,t)}catch(r){(s=e.onError)==null||s.call(e,{message:`CSV Export Error: ${r}`,status:500})}}})}exports.useExportCsv=f;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("pinia");require("vue");const i=require("../stores/i18n.cjs");require("lodash-es");const u=require("./manage.cjs");function g(){const a=i.useI18nStore(),c=u.useManage();return{t:(e,o,r)=>{var n,t;return(t=(n=c.config)==null?void 0:n.i18nProvider)==null?void 0:t.t(e,o,r)},changeLocale:e=>{var o,r;return a.setLocale(e),(r=(o=c.config)==null?void 0:o.i18nProvider)==null?void 0:r.changeLocale(e)},getLocale:()=>{var e,o;return(o=(e=c.config)==null?void 0:e.i18nProvider)==null?void 0:o.getLocale()},loadLocale:(e,o)=>{var r,n;return(n=(r=c.config)==null?void 0:r.i18nProvider)==null?void 0:n.loadLocale(e,o)},mergeLocale:(e,o)=>{var r,n;return(n=(r=c.config)==null?void 0:r.i18nProvider)==null?void 0:n.mergeLocale(e,o)}}}exports.useI18n=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("pinia");require("vue");const i=require("../stores/i18n.cjs");require("lodash-es");const g=require("./manage.cjs");function l(){const a=i.useI18nStore(),c=g.useManage();return{t:(e,o,r)=>{var n,t;return(t=(n=c.config)==null?void 0:n.i18nProvider)==null?void 0:t.t(e,o,r)},changeLocale:e=>{var o,r;return a.setLocale(e),(r=(o=c.config)==null?void 0:o.i18nProvider)==null?void 0:r.changeLocale(e)},getLocale:()=>{var e,o;return(o=(e=c.config)==null?void 0:e.i18nProvider)==null?void 0:o.getLocale()},loadLocale:(e,o)=>{var r,n;return(n=(r=c.config)==null?void 0:r.i18nProvider)==null?void 0:n.loadLocale(e,o)},mergeLocale:(e,o)=>{var r,n;return(n=(r=c.config)==null?void 0:r.i18nProvider)==null?void 0:n.mergeLocale(e,o)},getLocales:()=>{var e,o;return(o=(e=c.config)==null?void 0:e.i18nProvider)==null?void 0:o.getLocales()}}}exports.useI18n=l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@vueuse/core"),n=require("vue"),J=require("./data.cjs"),z=require("./exportCsv.cjs"),K=require("./importCsv.cjs");function N(t){const c=n.toRef(t,"filters",{}),s=n.toRef(t,"sorters",{}),l=n.toRef(typeof t.pagination=="object"?t.pagination:{page:1,pageSize:20}),m=[10,20,30,40,50,100],f=e=>m.includes(e)?m:Array.from({length:5},(a,i)=>e*(i+1)),g=n.ref(f(l.value.pageSize));n.watch(()=>l.value.pageSize,e=>{g.value.includes(e)||(g.value=f(e))});const P=e=>{l.value.pageSize=e,l.value.page=1},R=e=>{l.value.page=e},{data:o,isLoading:I,refetch:L}=J.useList({path:t.path,pagination:t.pagination?l.value:!1,filters:c.value,sorters:s.value}),k=n.computed(()=>{var e;return((e=o.value)==null?void 0:e.data)||[]}),h=n.computed(()=>{var e;return((e=o.value)==null?void 0:e.meta)||{}}),x=n.computed(()=>{var e,a;return((e=t.total)==null?void 0:e.call(t,o.value))||((a=h.value)==null?void 0:a[t.totalField||"total"])||0}),w=n.computed(()=>Math.ceil(x.value/l.value.pageSize)||0),U=e=>{c.value=e},q=e=>{s.value=e},u=n.ref([]),S=n.computed(()=>{var e,a;return u.value.length>0&&u.value.length===((a=(e=o.value)==null?void 0:e.data)==null?void 0:a.length)}),y=n.computed(()=>{var e,a;return u.value.length>0&&u.value.length<(((a=(e=o.value)==null?void 0:e.data)==null?void 0:a.length)||0)}),F=e=>{const a=u.value.indexOf(e);a>-1?u.value.splice(a,1):u.value.push(e)},A=e=>{u.value=e},b=e=>u.value.includes(e),M=()=>{var e,a;S.value?u.value=[]:u.value=((a=(e=o.value)==null?void 0:e.data)==null?void 0:a.map(i=>i[t.key||"id"]).filter(i=>i!=null))||[]};n.watch(()=>{var e;return(e=o.value)==null?void 0:e.data},()=>{u.value=[]});const v=()=>{u.value=[],L()},d=n.ref({page:1,pageSize:100}),{trigger:j,isLoading:O}=z.useExportCsv({path:t.path,filters:c.value||{},sorters:s.value||{},maxPage:()=>l.value.pageSize||t.exportMaxPage||10,pagination:d.value,filename:t.exportFilename||"data.csv",onSuccess:e=>{var a;(a=t.onExportSuccess)==null||a.call(t,e),d.value.page=1},onProgress:e=>{var a;(a=t.onExportProgress)==null||a.call(t,e)},onError:e=>{var a;(a=t.onExportError)==null||a.call(t,e),d.value.page=1}}),T=C.reactiveComputed(()=>({ids:u.value})),{trigger:V,isLoading:_}=z.useExportCsv({path:t.path,filters:T,maxPage:1,filename:t.exportFilename||"rows.csv",onSuccess:e=>{var a;(a=t.onExportSuccess)==null||a.call(t,e)},onError:e=>{var a;(a=t.onExportError)==null||a.call(t,e)}}),{open:$,isLoading:B}=K.useImportCsv({path:t.path,onComplete:e=>{var a;(a=t.onImportSuccess)==null||a.call(t,e)},onProgress:e=>{var a;(a=t.onImportProgress)==null||a.call(t,e)},onError:e=>{var a;(a=t.onImportError)==null||a.call(t,e)}}),r=n.ref(!1),{remaining:D,start:E,stop:G}=C.useCountdown(10,{onComplete:()=>{v(),E()}}),H=()=>{r.value=!r.value,r.value?(v(),E()):G()};return{list:k,meta:h,isLoading:I,pagination:l,filters:c,sorters:s,onRefresh:v,onUpdateFilters:U,onUpdateSorters:q,checkeds:u,isAllChecked:S,isIndeterminate:y,toggleChecked:F,isChecked:b,toggleSelectAll:M,onUpdateChecked:A,total:x,page:n.computed(()=>l.value.page),pageSize:n.computed(()=>l.value.pageSize),pageSizes:g.value,pageCount:w,onUpdatePage:R,onUpdatePageSize:P,onExport:j,isExporting:O,onExportRows:V,isExportingRows:_,onImport:$,isImporting:B,autoRefetch:r,onAutoRefetch:H,autoCountdown:D}}exports.useExtendList=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@vueuse/core"),n=require("vue"),J=require("./data.cjs"),P=require("./exportCsv.cjs"),K=require("./importCsv.cjs");function N(t){const c=n.toRef(t,"filters",{}),s=n.toRef(t,"sorters",{}),l=n.toRef(typeof t.pagination=="object"?t.pagination:{page:1,pageSize:20}),m=[10,20,30,40,50,100],f=e=>m.includes(e)?m:Array.from({length:5},(a,i)=>e*(i+1)),g=n.ref(f(l.value.pageSize));n.watch(()=>l.value.pageSize,e=>{g.value.includes(e)||(g.value=f(e))});const z=e=>{l.value.pageSize=e,l.value.page=1},R=e=>{l.value.page=e},{data:o,isLoading:I,refetch:L}=J.useList({path:t.path,pagination:t.pagination?l.value:!1,filters:c.value,sorters:s.value}),k=n.computed(()=>{var e;return((e=o.value)==null?void 0:e.data)||[]}),h=n.computed(()=>{var e;return((e=o.value)==null?void 0:e.meta)||{}}),x=n.computed(()=>{var e,a;return((e=t.total)==null?void 0:e.call(t,o.value))||((a=h.value)==null?void 0:a[t.totalField||"total"])||0}),w=n.computed(()=>Math.ceil(x.value/l.value.pageSize)||0),U=e=>{c.value=e},q=e=>{s.value=e},u=n.ref([]),S=n.computed(()=>{var e,a;return u.value.length>0&&u.value.length===((a=(e=o.value)==null?void 0:e.data)==null?void 0:a.length)}),y=n.computed(()=>{var e,a;return u.value.length>0&&u.value.length<(((a=(e=o.value)==null?void 0:e.data)==null?void 0:a.length)||0)}),F=e=>{const a=u.value.indexOf(e);a>-1?u.value.splice(a,1):u.value.push(e)},A=e=>{u.value=e},b=e=>u.value.includes(e),M=()=>{var e,a;S.value?u.value=[]:u.value=((a=(e=o.value)==null?void 0:e.data)==null?void 0:a.map(i=>i[t.key||"id"]).filter(i=>i!=null))||[]};n.watch(()=>{var e;return(e=o.value)==null?void 0:e.data},()=>{u.value=[]});const v=()=>{u.value=[],L()},d=n.ref({page:1,pageSize:100}),{trigger:j,isLoading:O}=P.useExportCsv({path:t.path,filters:c.value||{},sorters:s.value||{},maxPage:()=>t.exportMaxPage||0,pagination:d.value,filename:t.exportFilename||"data.csv",onSuccess:e=>{var a;(a=t.onExportSuccess)==null||a.call(t,e),d.value.page=1},onProgress:e=>{var a;(a=t.onExportProgress)==null||a.call(t,e)},onError:e=>{var a;(a=t.onExportError)==null||a.call(t,e),d.value.page=1}}),T=C.reactiveComputed(()=>({ids:u.value})),{trigger:V,isLoading:_}=P.useExportCsv({path:t.path,filters:T,maxPage:1,filename:t.exportFilename||"rows.csv",onSuccess:e=>{var a;(a=t.onExportSuccess)==null||a.call(t,e)},onError:e=>{var a;(a=t.onExportError)==null||a.call(t,e)}}),{open:$,isLoading:B}=K.useImportCsv({path:t.path,onComplete:e=>{var a;(a=t.onImportSuccess)==null||a.call(t,e)},onProgress:e=>{var a;(a=t.onImportProgress)==null||a.call(t,e)},onError:e=>{var a;(a=t.onImportError)==null||a.call(t,e)}}),r=n.ref(!1),{remaining:D,start:E,stop:G}=C.useCountdown(10,{onComplete:()=>{v(),E()}}),H=()=>{r.value=!r.value,r.value?(v(),E()):G()};return{list:k,meta:h,isLoading:I,pagination:l,filters:c,sorters:s,onRefresh:v,onUpdateFilters:U,onUpdateSorters:q,checkeds:u,isAllChecked:S,isIndeterminate:y,toggleChecked:F,isChecked:b,toggleSelectAll:M,onUpdateChecked:A,total:x,page:n.computed(()=>l.value.page),pageSize:n.computed(()=>l.value.pageSize),pageSizes:g.value,pageCount:w,onUpdatePage:R,onUpdatePageSize:z,onExport:j,isExporting:O,onExportRows:V,isExportingRows:_,onImport:$,isImporting:B,autoRefetch:r,onAutoRefetch:H,autoCountdown:D}}exports.useExtendList=N;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@vueuse/core"),H=require("lodash-es"),d=require("vue"),J=require("./upload/local.cjs");function Q(a){a=a||{};const v=d.ref(!1),i=d.ref([]),f=d.ref(-1),m=d.ref(new Map),A=a.driver||J.createLocalUploadDriver(),$=d.computed(()=>{const{onProgress:e,onDataCallback:n,onCancel:l,onComplete:t,maxFileSize:r,maxFileCount:c,accept:o,multiple:s,autoUpload:u,options:S,onSuccess:P,onError:b,method:W,driver:X,...V}=a;return V}),I=d.computed(()=>a.method||"POST"),x=d.computed(()=>{const e=i.value.length,n=i.value.reduce((c,o)=>c+(o.filesize||0),0);let l=0,t=0;return i.value.forEach((c,o)=>{var s;o<f.value?l+=c.filesize||0:o===f.value&&(l+=((s=c.progress)==null?void 0:s.loaded)||0)}),n>0&&(t=Math.round(l/n*100)),{index:f.value>=0?f.value+1:0,totalFiles:e,currentFile:i.value[f.value],totalPercent:t,totalLoaded:l,totalSize:n}}),w=e=>{if(e===0)return"0 Bytes";const n=1024,l=["Bytes","KB","MB","GB"],t=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**t).toFixed(2))} ${l[t]}`},g=e=>{if(e===0)return"0 B/s";const n=1024,l=["B/s","KB/s","MB/s","GB/s"],t=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**t).toFixed(2))} ${l[t]}`},T=()=>H.uniqueId("upload-"),k=async(e,n,l)=>{switch(n){case"file":{if(!(e instanceof File))throw new TypeError('Payload must be a File when type is "file"');return e}case"blob":{if(!(e instanceof Blob))throw new TypeError('Payload must be a Blob when type is "blob"');return new File([e],"blob-file",{type:e.type})}case"base64":{if(typeof e!="string")throw new TypeError('Payload must be a string when type is "base64"');const t=e.includes(",")?e.split(",")[1]:e,r=e.includes(",")?e.split(",")[0].split(":")[1].split(";")[0]:"application/octet-stream",c=atob(t),o=new Uint8Array(c.length);for(let u=0;u<c.length;u++)o[u]=c.charCodeAt(u);const s=new Blob([o],{type:r});return new File([s],"base64-file",{type:r})}case"arrayBuffer":{if(!(e instanceof ArrayBuffer))throw new TypeError('Payload must be ArrayBuffer when type is "arrayBuffer"');const t=new Blob([e]);return new File([t],"array-buffer-file",{type:"application/octet-stream"})}default:throw new Error(`Unsupported upload type: ${n}`)}},z=e=>{if(a.maxFileSize&&e.size>a.maxFileSize)throw new Error(`File size cannot exceed ${w(a.maxFileSize)}`);if(a.maxFileCount&&i.value.length>=a.maxFileCount)throw new Error(`File count cannot exceed ${a.maxFileCount}`)},q=async(e,n,l)=>{const t=await k(e,n);z(t);const r={id:T(),file:t,filename:t.name,filesize:t.size,filetype:t.type,filesizeText:w(t.size),status:"pending",progress:{loaded:0,total:t.size,percent:0,speed:0,speedText:g(0),remainingTime:0,uploadTime:0}};return i.value.push(r),r},h=(e,n)=>{const l=i.value.findIndex(t=>t.id===e);l!==-1&&(i.value[l]={...i.value[l],...n})},C=()=>{var n;i.value.every(l=>l.status!=="uploading")&&((n=a.onComplete)==null||n.call(a,i.value))},y=e=>{var l;const n=i.value.find(t=>t.id===e);if(!n||n.status!=="pending"&&n.status!=="uploading")return!1;if(n.status==="uploading"){const t=m.value.get(e);t&&(t.abort(),m.value.delete(e))}return h(e,{status:"cancelled"}),(l=a.onCancel)==null||l.call(a,e),C(),!0},D=e=>{e?e.forEach(n=>y(n)):i.value.forEach(n=>y(n.id))},G=async e=>{if(!e.file)throw new Error("File not found");z(e.file);const n=new AbortController;m.value.set(e.id,n);const l=Date.now();return h(e.id,{status:"uploading"}),A.upload(e.file,{...$.value,method:I.value,signal:n.signal,onUploadProgress:t=>{var b;const o=(Date.now()-l)/1e3,s=o>0?t.loaded/o:0,u=(t.total||0)-t.loaded,S=s>0?u/s:0,P={loaded:t.loaded,total:t.total,percent:t.percent||0,speed:Math.round(s),speedText:g(s),uploadTime:Math.round(o),remainingTime:Math.round(S)};h(e.id,{status:"uploading",progress:P}),(b=a.onProgress)==null||b.call(a,x.value)}}).then(t=>{var s,u;if(e.status==="cancelled")throw new Error("Upload cancelled");const r=((s=a.onDataCallback)==null?void 0:s.call(a,t,e))||t.data,c=Math.round((Date.now()-l)/1e3),o={...e,status:"success",data:t,...r,progress:{...e.progress,loaded:e.filesize||0,percent:100,speed:0,speedText:g(0),uploadTime:c,remainingTime:0}};return h(e.id,o),m.value.delete(e.id),(u=a.onSuccess)==null||u.call(a,t),o}).catch(t=>{throw t.message==="canceled"||e.status==="cancelled"?new Error("Upload cancelled"):(h(e.id,{status:"error",error:t.message}),m.value.delete(e.id),t)}).finally(()=>{C()})},E=async()=>{var n;const e=i.value.filter(l=>l.status==="pending");if(e.length===0)return[];v.value=!0;try{const l=[];for(let t=0;t<e.length;t++){const r=e[t],c=i.value.findIndex(s=>s.id===r.id);f.value=c;const o=await G(r);l.push(o)}return l}catch(l){throw(n=a.onError)==null||n.call(a,{status:(l==null?void 0:l.status)||500,message:(l==null?void 0:l.message)||"upload failed"}),l}finally{v.value=!1,f.value=-1}},F=()=>{i.value.forEach(e=>{y(e.id)}),m.value.clear(),i.value=[],f.value=-1},B=async(e,n="file")=>{var l;try{if(!a.multiple&&e.length>1)throw new Error("Single file mode: only one file can be selected");if(!a.multiple&&i.value.length>0&&F(),a.maxFileCount&&i.value.length+e.length>a.maxFileCount)throw new Error(`Adding ${e.length} files would exceed the maximum limit of ${a.maxFileCount}`);for(const t of e)await q(t,n)}catch(t){throw(l=a.onError)==null||l.call(a,{status:(t==null?void 0:t.status)||400,message:(t==null?void 0:t.message)||"Failed to add files"}),t}a.autoUpload&&E().catch(t=>{console.warn("Auto upload failed:",t)})},M=e=>{const n=i.value.find(t=>t.id===e);if(n&&n.status==="uploading"){h(e,{status:"cancelled"});const t=m.value.get(e);if(!t)return;t.abort(),m.value.delete(e)}const l=i.value.findIndex(t=>t.id===e);l!==-1&&i.value.splice(l,1)},K=e=>{e?e.forEach(n=>M(n)):i.value.forEach(n=>M(n.id))},{files:L,open:N,reset:U}=_.useFileDialog({accept:a.accept,multiple:a.multiple||!1}),O=e=>({id:T(),...e,filesizeText:e.filesize?w(e.filesize):void 0,status:e.url?"success":"pending",progress:{loaded:0,total:e.filesize||0,percent:e.url?100:0,speed:0,speedText:g(0),remainingTime:0,uploadTime:0}});d.watch(L,async e=>{if(e&&e.length>0){const n=Array.from(e);U(),await B(n,"file").catch(l=>{console.warn("Failed to add selected files:",l)})}});const j=d.computed(()=>i.value.filter(e=>e.status==="success").map(e=>({url:e.url,filename:e.filename,filesize:e.filesize,filetype:e.filetype})));return{isUploading:v,uploadFiles:i,dataFiles:j,progress:x,open:N,trigger:E,resetFiles:U,clearFiles:F,removeFiles:K,addFiles:B,addDataFiles:e=>{!a.multiple&&i.value.length>0&&F();const n=e.map(l=>O(l));i.value.push(...n)},cancelFiles:D}}exports.useUpload=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@vueuse/core"),H=require("lodash-es"),d=require("vue"),J=require("./upload/local.cjs");function Q(l){l=l||{};const v=d.ref(!1),i=d.ref([]),f=d.ref(-1),m=d.ref(new Map),A=l.driver||J.createLocalUploadDriver(),$=d.computed(()=>{const{onProgress:e,onDataCallback:n,onCancel:a,onComplete:t,maxFileSize:c,maxFileCount:r,accept:o,multiple:s,autoUpload:u,options:S,onSuccess:P,onError:b,method:W,driver:X,params:Y,...V}=l;return V}),I=d.computed(()=>l.method||"POST"),x=d.computed(()=>{const e=i.value.length,n=i.value.reduce((r,o)=>r+(o.filesize||0),0);let a=0,t=0;return i.value.forEach((r,o)=>{var s;o<f.value?a+=r.filesize||0:o===f.value&&(a+=((s=r.progress)==null?void 0:s.loaded)||0)}),n>0&&(t=Math.round(a/n*100)),{index:f.value>=0?f.value+1:0,totalFiles:e,currentFile:i.value[f.value],totalPercent:t,totalLoaded:a,totalSize:n}}),w=e=>{if(e===0)return"0 Bytes";const n=1024,a=["Bytes","KB","MB","GB"],t=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**t).toFixed(2))} ${a[t]}`},g=e=>{if(e===0)return"0 B/s";const n=1024,a=["B/s","KB/s","MB/s","GB/s"],t=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**t).toFixed(2))} ${a[t]}`},T=()=>H.uniqueId("upload-"),k=async(e,n,a)=>{switch(n){case"file":{if(!(e instanceof File))throw new TypeError('Payload must be a File when type is "file"');return e}case"blob":{if(!(e instanceof Blob))throw new TypeError('Payload must be a Blob when type is "blob"');return new File([e],"blob-file",{type:e.type})}case"base64":{if(typeof e!="string")throw new TypeError('Payload must be a string when type is "base64"');const t=e.includes(",")?e.split(",")[1]:e,c=e.includes(",")?e.split(",")[0].split(":")[1].split(";")[0]:"application/octet-stream",r=atob(t),o=new Uint8Array(r.length);for(let u=0;u<r.length;u++)o[u]=r.charCodeAt(u);const s=new Blob([o],{type:c});return new File([s],"base64-file",{type:c})}case"arrayBuffer":{if(!(e instanceof ArrayBuffer))throw new TypeError('Payload must be ArrayBuffer when type is "arrayBuffer"');const t=new Blob([e]);return new File([t],"array-buffer-file",{type:"application/octet-stream"})}default:throw new Error(`Unsupported upload type: ${n}`)}},z=e=>{if(l.maxFileSize&&e.size>l.maxFileSize)throw new Error(`File size cannot exceed ${w(l.maxFileSize)}`);if(l.maxFileCount&&i.value.length>=l.maxFileCount)throw new Error(`File count cannot exceed ${l.maxFileCount}`)},q=async(e,n,a)=>{const t=await k(e,n);z(t);const c={id:T(),file:t,filename:t.name,filesize:t.size,filetype:t.type,filesizeText:w(t.size),status:"pending",progress:{loaded:0,total:t.size,percent:0,speed:0,speedText:g(0),remainingTime:0,uploadTime:0}};return i.value.push(c),c},h=(e,n)=>{const a=i.value.findIndex(t=>t.id===e);a!==-1&&(i.value[a]={...i.value[a],...n})},C=()=>{var n;i.value.every(a=>a.status!=="uploading")&&((n=l.onComplete)==null||n.call(l,i.value))},y=e=>{var a;const n=i.value.find(t=>t.id===e);if(!n||n.status!=="pending"&&n.status!=="uploading")return!1;if(n.status==="uploading"){const t=m.value.get(e);t&&(t.abort(),m.value.delete(e))}return h(e,{status:"cancelled"}),(a=l.onCancel)==null||a.call(l,e),C(),!0},D=e=>{e?e.forEach(n=>y(n)):i.value.forEach(n=>y(n.id))},G=async e=>{if(!e.file)throw new Error("File not found");z(e.file);const n=new AbortController;m.value.set(e.id,n);const a=Date.now();return h(e.id,{status:"uploading"}),A.upload(e.file,{...$.value,method:I.value,signal:n.signal,params:l.params,onUploadProgress:t=>{var b;const o=(Date.now()-a)/1e3,s=o>0?t.loaded/o:0,u=(t.total||0)-t.loaded,S=s>0?u/s:0,P={loaded:t.loaded,total:t.total,percent:t.percent||0,speed:Math.round(s),speedText:g(s),uploadTime:Math.round(o),remainingTime:Math.round(S)};h(e.id,{status:"uploading",progress:P}),(b=l.onProgress)==null||b.call(l,x.value)}}).then(t=>{var s,u;if(e.status==="cancelled")throw new Error("Upload cancelled");const c=((s=l.onDataCallback)==null?void 0:s.call(l,t,e))||t.data,r=Math.round((Date.now()-a)/1e3),o={...e,status:"success",data:t,...c,progress:{...e.progress,loaded:e.filesize||0,percent:100,speed:0,speedText:g(0),uploadTime:r,remainingTime:0}};return h(e.id,o),m.value.delete(e.id),(u=l.onSuccess)==null||u.call(l,t),o}).catch(t=>{throw t.message==="canceled"||e.status==="cancelled"?new Error("Upload cancelled"):(h(e.id,{status:"error",error:t.message}),m.value.delete(e.id),t)}).finally(()=>{C()})},E=async()=>{var n;const e=i.value.filter(a=>a.status==="pending");if(e.length===0)return[];v.value=!0;try{const a=[];for(let t=0;t<e.length;t++){const c=e[t],r=i.value.findIndex(s=>s.id===c.id);f.value=r;const o=await G(c);a.push(o)}return a}catch(a){throw(n=l.onError)==null||n.call(l,{status:(a==null?void 0:a.status)||500,message:(a==null?void 0:a.message)||"upload failed"}),a}finally{v.value=!1,f.value=-1}},F=()=>{i.value.forEach(e=>{y(e.id)}),m.value.clear(),i.value=[],f.value=-1},B=async(e,n="file")=>{var a;try{if(!l.multiple&&e.length>1)throw new Error("Single file mode: only one file can be selected");if(!l.multiple&&i.value.length>0&&F(),l.maxFileCount&&i.value.length+e.length>l.maxFileCount)throw new Error(`Adding ${e.length} files would exceed the maximum limit of ${l.maxFileCount}`);for(const t of e)await q(t,n)}catch(t){throw(a=l.onError)==null||a.call(l,{status:(t==null?void 0:t.status)||400,message:(t==null?void 0:t.message)||"Failed to add files"}),t}l.autoUpload&&E().catch(t=>{console.warn("Auto upload failed:",t)})},M=e=>{const n=i.value.find(t=>t.id===e);if(n&&n.status==="uploading"){h(e,{status:"cancelled"});const t=m.value.get(e);if(!t)return;t.abort(),m.value.delete(e)}const a=i.value.findIndex(t=>t.id===e);a!==-1&&i.value.splice(a,1)},K=e=>{e?e.forEach(n=>M(n)):i.value.forEach(n=>M(n.id))},{files:L,open:N,reset:U}=_.useFileDialog({accept:l.accept,multiple:l.multiple||!1}),O=e=>({id:T(),...e,filesizeText:e.filesize?w(e.filesize):void 0,status:e.url?"success":"pending",progress:{loaded:0,total:e.filesize||0,percent:e.url?100:0,speed:0,speedText:g(0),remainingTime:0,uploadTime:0}});d.watch(L,async e=>{if(e&&e.length>0){const n=Array.from(e);U(),await B(n,"file").catch(a=>{console.warn("Failed to add selected files:",a)})}});const j=d.computed(()=>i.value.filter(e=>e.status==="success").map(e=>({url:e.url,filename:e.filename,filesize:e.filesize,filetype:e.filetype})));return{isUploading:v,uploadFiles:i,dataFiles:j,progress:x,open:N,trigger:E,resetFiles:U,clearFiles:F,removeFiles:K,addFiles:B,addDataFiles:e=>{!l.multiple&&i.value.length>0&&F();const n=e.map(a=>O(a));i.value.push(...n)},cancelFiles:D}}exports.useUpload=Q;
@@ -1 +1 @@
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==null?void 0:n.status)===401?{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
+ "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,d)=>{var e;return await g.get((c==null?void 0:c.getApiUrl(((e=t==null?void 0:t.apiPath)==null?void 0:e.check)||"/check",t==null?void 0:t.dataProviderName))||"",{headers:{Authorization:(d==null?void 0:d.token)||""}}).then(i=>{var a,s;return{success:!0,logout:!1,message:(a=i==null?void 0:i.data)==null?void 0:a.message,data:(s=i==null?void 0:i.data)==null?void 0:s.data}}).catch(i=>{var a,s;return{success:!1,logout:!0,message:((s=(a=i==null?void 0:i.response)==null?void 0:a.data)==null?void 0:s.message)||(i==null?void 0:i.message)}})},onError:async n=>{var c;return(n==null?void 0:n.status)===401?{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 o=require("vue-i18n");function i(l){const n=o.createI18n({legacy:!1,locale:l==null?void 0:l.locale,fallbackLocale:l==null?void 0:l.fallbackLocale,messages:l==null?void 0:l.messages,missingWarn:!1,fallbackWarn:!1});return{t:(e,a,c)=>{const t=n.global.t(e,a);return t===e&&c?c:t},changeLocale:(e,a)=>new Promise(c=>{n.global.locale.value=e,c(e)}),loadLocale:(e,a)=>new Promise(c=>{n.global.setLocaleMessage(e,a),c(e)}),mergeLocale:(e,a)=>{n.global.mergeLocaleMessage(e,a)},getLocale:()=>n.global.locale.value}}exports.i18nProvider=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue-i18n");function r(l){const a=o.createI18n({legacy:!1,locale:l==null?void 0:l.locale,fallbackLocale:l==null?void 0:l.fallbackLocale,messages:l==null?void 0:l.messages,missingWarn:!1,fallbackWarn:!1});return{t:(e,c,n)=>{const t=a.global.t(e,c);return t===e&&n?n:t},changeLocale:(e,c)=>new Promise(n=>{a.global.locale.value=e,n(e)}),loadLocale:(e,c)=>new Promise(n=>{a.global.setLocaleMessage(e,c),n(e)}),mergeLocale:(e,c)=>{a.global.mergeLocaleMessage(e,c)},getLocale:()=>a.global.locale.value,getLocales:()=>a.global.availableLocales.map(e=>e)}}exports.i18nProvider=r;
@@ -1,33 +1,33 @@
1
1
  import { ref as w } from "vue";
2
- import { useRouter as f } from "vue-router";
3
- import { useAuthStore as h } from "../stores/auth.js";
4
- import { useManage as d } from "./manage.js";
5
- function s(t) {
6
- const u = d(), o = h(), r = f(), g = w(!1);
2
+ import { useRouter as m } from "vue-router";
3
+ import { useAuthStore as f } from "../stores/auth.js";
4
+ import { useManage as h } from "./manage.js";
5
+ function v(t) {
6
+ const a = h(), o = f(), r = m(), g = w(!1);
7
7
  return {
8
8
  mutate: async (e) => {
9
- var c, i, m;
9
+ var c, i, d;
10
10
  g.value = !0;
11
- const n = await ((c = u.config.authProvider) == null ? void 0 : c.login(e, u));
11
+ const n = await ((c = a.config.authProvider) == null ? void 0 : c.login(e, a));
12
12
  if (g.value = !1, n != null && n.success) {
13
13
  if (!(n != null && n.data))
14
14
  throw new Error("Login response data is undefined");
15
- (i = t == null ? void 0 : t.onSuccess) == null || i.call(t, n), o.login(n.data), r.push(u.getRoutePath(n.redirectTo || "/"));
15
+ (i = t == null ? void 0 : t.onSuccess) == null || i.call(t, n), o.login(n.data), r.push(a.getRoutePath(n.redirectTo || "/"));
16
16
  return;
17
17
  }
18
- (m = t == null ? void 0 : t.onError) == null || m.call(t, n);
18
+ (d = t == null ? void 0 : t.onError) == null || d.call(t, n);
19
19
  },
20
20
  isLoading: g
21
21
  };
22
22
  }
23
- function R(t) {
24
- const u = d(), o = h(), r = f();
23
+ function E(t) {
24
+ const a = h(), o = f(), r = m();
25
25
  return {
26
- mutate: async (a) => {
26
+ mutate: async (u) => {
27
27
  var n, c, i;
28
- const e = await ((n = u.config.authProvider) == null ? void 0 : n.logout(a, u));
28
+ const e = await ((n = a.config.authProvider) == null ? void 0 : n.logout(u, a));
29
29
  if (e != null && e.success) {
30
- (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, e), o.logout(), await r.replace(u.getRoutePath(e.redirectTo || "/login")), setTimeout(() => {
30
+ (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, e), o.logout(), await r.replace(a.getRoutePath(e.redirectTo || "/login")), setTimeout(() => {
31
31
  window.location.reload();
32
32
  }, 100);
33
33
  return;
@@ -36,98 +36,102 @@ function R(t) {
36
36
  }
37
37
  };
38
38
  }
39
- function T(t) {
40
- const u = d(), o = h(), r = f();
39
+ function R(t) {
40
+ const a = h(), o = f(), r = m();
41
41
  return {
42
- mutate: async (a) => {
43
- var n, c, i;
44
- const e = await ((n = u.config.authProvider) == null ? void 0 : n.check(a, u));
42
+ mutate: async (u) => {
43
+ var n, c, i, d;
44
+ const e = await ((c = (n = a.config.authProvider) == null ? void 0 : n.check) == null ? void 0 : c.call(n, u, a, o.getUser()));
45
45
  if (e != null && e.success) {
46
- if ((c = t == null ? void 0 : t.onSuccess) == null || c.call(t, e), !(e != null && e.data))
46
+ if ((i = t == null ? void 0 : t.onSuccess) == null || i.call(t, e), !(e != null && e.data))
47
47
  throw new Error("Check response data is undefined");
48
48
  o.update(e.data);
49
49
  return;
50
50
  }
51
- (i = t == null ? void 0 : t.onError) == null || i.call(t, e), e != null && e.logout && r.push(u.getRoutePath(e.redirectTo || "/login"));
51
+ (d = t == null ? void 0 : t.onError) == null || d.call(t, e), e != null && e.logout && (await r.replace(a.getRoutePath(e.redirectTo || "/login")), setTimeout(() => {
52
+ window.location.reload();
53
+ }, 100));
52
54
  }
53
55
  };
54
56
  }
55
57
  function y(t) {
56
- const u = d(), o = h(), r = f();
58
+ const a = h(), o = f(), r = m();
57
59
  return {
58
- mutate: async (a) => {
59
- var n, c, i, m;
60
- const e = await ((c = (n = u.config.authProvider) == null ? void 0 : n.register) == null ? void 0 : c.call(n, a, u));
60
+ mutate: async (u) => {
61
+ var n, c, i, d;
62
+ const e = await ((c = (n = a.config.authProvider) == null ? void 0 : n.register) == null ? void 0 : c.call(n, u, a));
61
63
  if (e != null && e.success) {
62
64
  if ((i = t == null ? void 0 : t.onSuccess) == null || i.call(t, e), !(e != null && e.data))
63
65
  throw new Error("Register response data is undefined");
64
- o.login(e.data), r.push(u.getRoutePath(e.redirectTo || ""));
66
+ o.login(e.data), r.push(a.getRoutePath(e.redirectTo || "/"));
65
67
  return;
66
68
  }
67
- (m = t == null ? void 0 : t.onError) == null || m.call(t, e);
69
+ (d = t == null ? void 0 : t.onError) == null || d.call(t, e);
68
70
  }
69
71
  };
70
72
  }
71
73
  function L(t) {
72
- const u = d(), o = f();
74
+ const a = h(), o = m();
73
75
  return {
74
76
  mutate: async (g) => {
75
77
  var e, n, c, i;
76
- const a = await ((n = (e = u.config.authProvider) == null ? void 0 : e.forgotPassword) == null ? void 0 : n.call(e, g, u));
77
- if (a != null && a.success) {
78
- (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, a), a.redirectTo && o.push(u.getRoutePath(a.redirectTo));
78
+ const u = await ((n = (e = a.config.authProvider) == null ? void 0 : e.forgotPassword) == null ? void 0 : n.call(e, g, a));
79
+ if (u != null && u.success) {
80
+ (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, u), u.redirectTo && o.push(a.getRoutePath(u.redirectTo || "/"));
79
81
  return;
80
82
  }
81
- (i = t == null ? void 0 : t.onError) == null || i.call(t, a);
83
+ (i = t == null ? void 0 : t.onError) == null || i.call(t, u);
82
84
  }
83
85
  };
84
86
  }
85
87
  function U(t) {
86
- const u = d(), o = f();
88
+ const a = h(), o = m();
87
89
  return {
88
90
  mutate: async (g) => {
89
91
  var e, n, c, i;
90
- const a = await ((n = (e = u.config.authProvider) == null ? void 0 : e.updatePassword) == null ? void 0 : n.call(e, g, u));
91
- if (a != null && a.success) {
92
- (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, a), a.redirectTo && o.push(u.getRoutePath(a.redirectTo));
92
+ const u = await ((n = (e = a.config.authProvider) == null ? void 0 : e.updatePassword) == null ? void 0 : n.call(e, g, a));
93
+ if (u != null && u.success) {
94
+ (c = t == null ? void 0 : t.onSuccess) == null || c.call(t, u), u.redirectTo && o.push(a.getRoutePath(u.redirectTo || "/"));
93
95
  return;
94
96
  }
95
- (i = t == null ? void 0 : t.onError) == null || i.call(t, a);
97
+ (i = t == null ? void 0 : t.onError) == null || i.call(t, u);
96
98
  }
97
99
  };
98
100
  }
99
- function A(t) {
100
- const { config: u, getRoutePath: o } = d(), r = f();
101
+ function l(t) {
102
+ const { config: a, getRoutePath: o } = h(), r = m(), g = f();
101
103
  return {
102
- mutate: async (a) => {
103
- var n;
104
- const e = await ((n = u.authProvider) == null ? void 0 : n.onError(a));
105
- t == null || t(e), e != null && e.logout && r.push(o(e.redirectTo || "/login"));
104
+ mutate: async (e) => {
105
+ var c;
106
+ const n = await ((c = a.authProvider) == null ? void 0 : c.onError(e));
107
+ t == null || t(n), n != null && n.logout && (g.logout(), await r.replace(o(n.redirectTo || "/login")), setTimeout(() => {
108
+ window.location.reload();
109
+ }, 100));
106
110
  }
107
111
  };
108
112
  }
113
+ function A(t) {
114
+ return f(t).getUser();
115
+ }
109
116
  function x(t) {
110
- return h(t).getUser();
117
+ return f(t).isLogin();
111
118
  }
112
119
  function F(t) {
113
- return h(t).isLogin();
114
- }
115
- function G(t) {
116
- const u = d(t), r = h(t).getUser();
117
- return (a, e) => {
120
+ const a = h(t), r = f(t).getUser();
121
+ return (u, e) => {
118
122
  var n;
119
- return (n = u.config.authProvider) != null && n.can ? u.config.authProvider.can(a, e, u, r) : !0;
123
+ return (n = a.config.authProvider) != null && n.can ? a.config.authProvider.can(u, e, a, r) : !0;
120
124
  };
121
125
  }
122
126
  export {
123
- G as useCan,
124
- T as useCheck,
125
- A as useError,
127
+ F as useCan,
128
+ R as useCheck,
129
+ l as useError,
126
130
  L as useForgotPassword,
127
- x as useGetAuth,
128
- F as useIsLogin,
129
- s as useLogin,
130
- R as useLogout,
131
+ A as useGetAuth,
132
+ x as useIsLogin,
133
+ v as useLogin,
134
+ E as useLogout,
131
135
  y as useRegister,
132
136
  U as useUpdatePassword
133
137
  };
@@ -1,9 +1,9 @@
1
- import { ref as h, computed as u } from "vue";
1
+ import { ref as h, computed as c } from "vue";
2
2
  import { useInfiniteList as w } from "./data.js";
3
3
  const y = (e) => new Promise((a) => setTimeout(a, e));
4
- function E(e) {
5
- const a = h(!1), r = u(() => {
6
- const { onSuccess: n, onProgress: i, interval: l, maxPage: s, ...f } = e;
4
+ function b(e) {
5
+ const a = h(!1), r = c(() => {
6
+ const { onSuccess: n, onProgress: i, interval: l, maxPage: u, ...f } = e;
7
7
  return {
8
8
  ...f,
9
9
  options: {
@@ -14,25 +14,25 @@ function E(e) {
14
14
  refetchOnReconnect: !1
15
15
  }
16
16
  };
17
- }), c = u(() => e.interval || 300), { data: o, isLoading: g, fetchNextPage: v, hasNextPage: m, refetch: P, pagination: t } = w(r.value), x = async () => {
17
+ }), o = c(() => e.interval || 300), { data: s, isLoading: g, fetchNextPage: v, hasNextPage: m, refetch: P, pagination: t } = w(r.value), x = async () => {
18
18
  var n, i, l;
19
19
  if (!a.value)
20
20
  try {
21
21
  a.value = !0, t.value.page = 1, (n = e.onProgress) == null || n.call(e, t.value), await P();
22
- const s = typeof e.maxPage == "function" ? e.maxPage() : e.maxPage || 100;
23
- for (; m.value && t.value.page < s; )
24
- c.value > 0 && await y(c.value), await v(), (i = e.onProgress) == null || i.call(e, t.value);
25
- (l = e.onSuccess) == null || l.call(e, o.value);
22
+ const u = typeof e.maxPage == "function" ? e.maxPage() : e.maxPage || 0;
23
+ for (; m.value && !(u > 0 && t.value.page >= u); )
24
+ o.value > 0 && await y(o.value), await v(), (i = e.onProgress) == null || i.call(e, t.value);
25
+ (l = e.onSuccess) == null || l.call(e, s.value);
26
26
  } finally {
27
27
  a.value = !1;
28
28
  }
29
- }, d = u(() => g.value || a.value);
29
+ }, d = c(() => g.value || a.value);
30
30
  return {
31
- data: o,
31
+ data: s,
32
32
  isLoading: d,
33
33
  trigger: x
34
34
  };
35
35
  }
36
36
  export {
37
- E as useExport
37
+ b as useExport
38
38
  };
@@ -1,37 +1,29 @@
1
1
  import { json2csv as v } from "json-2-csv";
2
- import { computed as u } from "vue";
3
- import { useExport as y } from "./export.js";
2
+ import { computed as s } from "vue";
3
+ import { useExport as f } from "./export.js";
4
4
  function b(e) {
5
- const d = u(() => {
6
- const { filename: t, headers: r, csvOptions: s, ...c } = e;
7
- return c;
8
- }), m = u(() => {
9
- const t = e.csvOptions || {}, r = t.quote;
5
+ const l = s(() => {
6
+ const { filename: t, headers: n, csvOptions: c, ...a } = e;
7
+ return a;
8
+ }), u = s(() => {
9
+ const t = e.csvOptions || {}, n = t.quote;
10
10
  return {
11
11
  prependHeader: e.headers !== !1,
12
12
  keys: Array.isArray(e.headers) ? e.headers : void 0,
13
13
  delimiter: {
14
14
  field: t.delimiter || ",",
15
- wrap: typeof r == "string" ? r : '"',
15
+ wrap: typeof n == "string" ? n : '"',
16
16
  eol: t.eol || `
17
17
  `
18
18
  },
19
19
  excelBOM: t.writeBOM || !1
20
20
  };
21
21
  });
22
- return y({
23
- ...d.value,
22
+ return f({
23
+ ...l.value,
24
24
  onSuccess: async (t) => {
25
- var s, c, i, a;
26
- if (!(t != null && t.pages)) {
27
- (s = e.onError) == null || s.call(e, {
28
- message: "No data to export",
29
- status: 400
30
- });
31
- return;
32
- }
33
- const r = t.pages.flatMap((n) => Array.isArray(n == null ? void 0 : n.data) ? n.data : []);
34
- if (!r || !(r != null && r.length)) {
25
+ var n, c, a, i;
26
+ if (!(t != null && t.data) || !((n = t == null ? void 0 : t.data) != null && n.length)) {
35
27
  (c = e.onError) == null || c.call(e, {
36
28
  message: "No data to export",
37
29
  status: 400
@@ -39,11 +31,11 @@ function b(e) {
39
31
  return;
40
32
  }
41
33
  try {
42
- const n = await v(r, m.value), f = new Blob([n], { type: "text/csv;charset=utf-8;" }), l = URL.createObjectURL(f), o = document.createElement("a");
43
- o.href = l, o.download = e.filename || "export.csv", o.style.display = "none", document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(l), (i = e.onSuccess) == null || i.call(e, t);
44
- } catch (n) {
45
- (a = e.onError) == null || a.call(e, {
46
- message: `CSV Export Error: ${n}`,
34
+ const r = await v(t.data, u.value), m = new Blob([r], { type: "text/csv;charset=utf-8;" }), d = URL.createObjectURL(m), o = document.createElement("a");
35
+ o.href = d, o.download = e.filename || "export.csv", o.style.display = "none", document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(d), (a = e.onSuccess) == null || a.call(e, t);
36
+ } catch (r) {
37
+ (i = e.onError) == null || i.call(e, {
38
+ message: `CSV Export Error: ${r}`,
47
39
  status: 500
48
40
  });
49
41
  }
@@ -3,7 +3,7 @@ import "vue";
3
3
  import { useI18nStore as i } from "../stores/i18n.js";
4
4
  import "lodash-es";
5
5
  import { useManage as g } from "./manage.js";
6
- function h() {
6
+ function I() {
7
7
  const a = i(), c = g();
8
8
  return {
9
9
  t: (e, o, r) => {
@@ -25,9 +25,13 @@ function h() {
25
25
  mergeLocale: (e, o) => {
26
26
  var r, n;
27
27
  return (n = (r = c.config) == null ? void 0 : r.i18nProvider) == null ? void 0 : n.mergeLocale(e, o);
28
+ },
29
+ getLocales: () => {
30
+ var e, o;
31
+ return (o = (e = c.config) == null ? void 0 : e.i18nProvider) == null ? void 0 : o.getLocales();
28
32
  }
29
33
  };
30
34
  }
31
35
  export {
32
- h as useI18n
36
+ I as useI18n
33
37
  };
@@ -1,5 +1,5 @@
1
1
  import { reactiveComputed as V, useCountdown as W } from "@vueuse/core";
2
- import { toRef as f, ref as r, watch as P, computed as o } from "vue";
2
+ import { toRef as f, ref as v, watch as P, computed as o } from "vue";
3
3
  import { useList as X } from "./data.js";
4
4
  import { useExportCsv as I } from "./exportCsv.js";
5
5
  import { useImportCsv as Y } from "./importCsv.js";
@@ -9,7 +9,7 @@ function ae(t) {
9
9
  pageSize: 20
10
10
  }), h = [10, 20, 30, 40, 50, 100], x = (e) => h.includes(e) ? h : Array.from({
11
11
  length: 5
12
- }, (a, u) => e * (u + 1)), s = r(x(l.value.pageSize));
12
+ }, (a, u) => e * (u + 1)), s = v(x(l.value.pageSize));
13
13
  P(() => l.value.pageSize, (e) => {
14
14
  s.value.includes(e) || (s.value = x(e));
15
15
  });
@@ -39,7 +39,7 @@ function ae(t) {
39
39
  c.value = e;
40
40
  }, y = (e) => {
41
41
  g.value = e;
42
- }, n = r([]), z = o(() => {
42
+ }, n = v([]), C = o(() => {
43
43
  var e, a;
44
44
  return n.value.length > 0 && n.value.length === ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.length);
45
45
  }), M = o(() => {
@@ -52,7 +52,7 @@ function ae(t) {
52
52
  n.value = e;
53
53
  }, O = (e) => n.value.includes(e), _ = () => {
54
54
  var e, a;
55
- z.value ? n.value = [] : n.value = ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.map((u) => u[t.key || "id"]).filter((u) => u != null)) || [];
55
+ C.value ? n.value = [] : n.value = ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.map((u) => u[t.key || "id"]).filter((u) => u != null)) || [];
56
56
  };
57
57
  P(() => {
58
58
  var e;
@@ -62,7 +62,7 @@ function ae(t) {
62
62
  });
63
63
  const d = () => {
64
64
  n.value = [], w();
65
- }, m = r({
65
+ }, m = v({
66
66
  page: 1,
67
67
  pageSize: 100
68
68
  }), {
@@ -72,7 +72,7 @@ function ae(t) {
72
72
  path: t.path,
73
73
  filters: c.value || {},
74
74
  sorters: g.value || {},
75
- maxPage: () => l.value.pageSize || t.exportMaxPage || 10,
75
+ maxPage: () => t.exportMaxPage || 0,
76
76
  pagination: m.value,
77
77
  filename: t.exportFilename || "data.csv",
78
78
  onSuccess: (e) => {
@@ -122,16 +122,16 @@ function ae(t) {
122
122
  var a;
123
123
  (a = t.onImportError) == null || a.call(t, e);
124
124
  }
125
- }), v = r(!1), {
125
+ }), r = v(!1), {
126
126
  remaining: N,
127
- start: C,
127
+ start: z,
128
128
  stop: Q
129
129
  } = W(10, {
130
130
  onComplete: () => {
131
- d(), C();
131
+ d(), z();
132
132
  }
133
133
  }), T = () => {
134
- v.value = !v.value, v.value ? (d(), C()) : Q();
134
+ r.value = !r.value, r.value ? (d(), z()) : Q();
135
135
  };
136
136
  return {
137
137
  // 数据
@@ -146,7 +146,7 @@ function ae(t) {
146
146
  onUpdateSorters: y,
147
147
  // 选中
148
148
  checkeds: n,
149
- isAllChecked: z,
149
+ isAllChecked: C,
150
150
  isIndeterminate: M,
151
151
  toggleChecked: b,
152
152
  isChecked: O,
@@ -169,7 +169,7 @@ function ae(t) {
169
169
  onImport: J,
170
170
  isImporting: K,
171
171
  // 自动刷新
172
- autoRefetch: v,
172
+ autoRefetch: r,
173
173
  onAutoRefetch: T,
174
174
  autoCountdown: N
175
175
  };
@@ -2,37 +2,37 @@ import { useFileDialog as Q } from "@vueuse/core";
2
2
  import { uniqueId as R } from "lodash-es";
3
3
  import { ref as g, computed as v, watch as V } from "vue";
4
4
  import { createLocalUploadDriver as W } from "./upload/local.js";
5
- function ne(a) {
6
- a = a || {};
7
- const w = g(!1), i = g([]), d = g(-1), f = g(/* @__PURE__ */ new Map()), $ = a.driver || W(), I = v(() => {
8
- const { onProgress: e, onDataCallback: n, onCancel: l, onComplete: t, maxFileSize: c, maxFileCount: r, accept: o, multiple: s, autoUpload: u, options: A, onSuccess: P, onError: b, method: Y, driver: Z, ...J } = a;
5
+ function ne(l) {
6
+ l = l || {};
7
+ const w = g(!1), i = g([]), d = g(-1), f = g(/* @__PURE__ */ new Map()), $ = l.driver || W(), I = v(() => {
8
+ const { onProgress: e, onDataCallback: a, onCancel: n, onComplete: t, maxFileSize: c, maxFileCount: r, accept: o, multiple: s, autoUpload: u, options: A, onSuccess: P, onError: b, method: Y, driver: Z, params: _, ...J } = l;
9
9
  return J;
10
- }), k = v(() => a.method || "POST"), T = v(() => {
11
- const e = i.value.length, n = i.value.reduce((r, o) => r + (o.filesize || 0), 0);
12
- let l = 0, t = 0;
10
+ }), k = v(() => l.method || "POST"), T = v(() => {
11
+ const e = i.value.length, a = i.value.reduce((r, o) => r + (o.filesize || 0), 0);
12
+ let n = 0, t = 0;
13
13
  return i.value.forEach((r, o) => {
14
14
  var s;
15
- o < d.value ? l += r.filesize || 0 : o === d.value && (l += ((s = r.progress) == null ? void 0 : s.loaded) || 0);
16
- }), n > 0 && (t = Math.round(l / n * 100)), {
15
+ o < d.value ? n += r.filesize || 0 : o === d.value && (n += ((s = r.progress) == null ? void 0 : s.loaded) || 0);
16
+ }), a > 0 && (t = Math.round(n / a * 100)), {
17
17
  index: d.value >= 0 ? d.value + 1 : 0,
18
18
  totalFiles: e,
19
19
  currentFile: i.value[d.value],
20
20
  totalPercent: t,
21
- totalLoaded: l,
22
- totalSize: n
21
+ totalLoaded: n,
22
+ totalSize: a
23
23
  };
24
24
  }), F = (e) => {
25
25
  if (e === 0)
26
26
  return "0 Bytes";
27
- const n = 1024, l = ["Bytes", "KB", "MB", "GB"], t = Math.floor(Math.log(e) / Math.log(n));
28
- return `${Number.parseFloat((e / n ** t).toFixed(2))} ${l[t]}`;
27
+ const a = 1024, n = ["Bytes", "KB", "MB", "GB"], t = Math.floor(Math.log(e) / Math.log(a));
28
+ return `${Number.parseFloat((e / a ** t).toFixed(2))} ${n[t]}`;
29
29
  }, h = (e) => {
30
30
  if (e === 0)
31
31
  return "0 B/s";
32
- const n = 1024, l = ["B/s", "KB/s", "MB/s", "GB/s"], t = Math.floor(Math.log(e) / Math.log(n));
33
- return `${Number.parseFloat((e / n ** t).toFixed(2))} ${l[t]}`;
34
- }, z = () => R("upload-"), D = async (e, n, l) => {
35
- switch (n) {
32
+ const a = 1024, n = ["B/s", "KB/s", "MB/s", "GB/s"], t = Math.floor(Math.log(e) / Math.log(a));
33
+ return `${Number.parseFloat((e / a ** t).toFixed(2))} ${n[t]}`;
34
+ }, z = () => R("upload-"), D = async (e, a, n) => {
35
+ switch (a) {
36
36
  case "file": {
37
37
  if (!(e instanceof File))
38
38
  throw new TypeError('Payload must be a File when type is "file"');
@@ -59,15 +59,15 @@ function ne(a) {
59
59
  return new File([t], "array-buffer-file", { type: "application/octet-stream" });
60
60
  }
61
61
  default:
62
- throw new Error(`Unsupported upload type: ${n}`);
62
+ throw new Error(`Unsupported upload type: ${a}`);
63
63
  }
64
64
  }, C = (e) => {
65
- if (a.maxFileSize && e.size > a.maxFileSize)
66
- throw new Error(`File size cannot exceed ${F(a.maxFileSize)}`);
67
- if (a.maxFileCount && i.value.length >= a.maxFileCount)
68
- throw new Error(`File count cannot exceed ${a.maxFileCount}`);
69
- }, G = async (e, n, l) => {
70
- const t = await D(e, n);
65
+ if (l.maxFileSize && e.size > l.maxFileSize)
66
+ throw new Error(`File size cannot exceed ${F(l.maxFileSize)}`);
67
+ if (l.maxFileCount && i.value.length >= l.maxFileCount)
68
+ throw new Error(`File count cannot exceed ${l.maxFileCount}`);
69
+ }, G = async (e, a, n) => {
70
+ const t = await D(e, a);
71
71
  C(t);
72
72
  const c = {
73
73
  id: z(),
@@ -88,40 +88,41 @@ function ne(a) {
88
88
  }
89
89
  };
90
90
  return i.value.push(c), c;
91
- }, m = (e, n) => {
92
- const l = i.value.findIndex((t) => t.id === e);
93
- l !== -1 && (i.value[l] = { ...i.value[l], ...n });
91
+ }, m = (e, a) => {
92
+ const n = i.value.findIndex((t) => t.id === e);
93
+ n !== -1 && (i.value[n] = { ...i.value[n], ...a });
94
94
  }, E = () => {
95
- var n;
96
- i.value.every((l) => l.status !== "uploading") && ((n = a.onComplete) == null || n.call(a, i.value));
95
+ var a;
96
+ i.value.every((n) => n.status !== "uploading") && ((a = l.onComplete) == null || a.call(l, i.value));
97
97
  }, y = (e) => {
98
- var l;
99
- const n = i.value.find((t) => t.id === e);
100
- if (!n || n.status !== "pending" && n.status !== "uploading")
98
+ var n;
99
+ const a = i.value.find((t) => t.id === e);
100
+ if (!a || a.status !== "pending" && a.status !== "uploading")
101
101
  return !1;
102
- if (n.status === "uploading") {
102
+ if (a.status === "uploading") {
103
103
  const t = f.value.get(e);
104
104
  t && (t.abort(), f.value.delete(e));
105
105
  }
106
106
  return m(e, {
107
107
  status: "cancelled"
108
- }), (l = a.onCancel) == null || l.call(a, e), E(), !0;
108
+ }), (n = l.onCancel) == null || n.call(l, e), E(), !0;
109
109
  }, K = (e) => {
110
- e ? e.forEach((n) => y(n)) : i.value.forEach((n) => y(n.id));
110
+ e ? e.forEach((a) => y(a)) : i.value.forEach((a) => y(a.id));
111
111
  }, L = async (e) => {
112
112
  if (!e.file)
113
113
  throw new Error("File not found");
114
114
  C(e.file);
115
- const n = new AbortController();
116
- f.value.set(e.id, n);
117
- const l = Date.now();
115
+ const a = new AbortController();
116
+ f.value.set(e.id, a);
117
+ const n = Date.now();
118
118
  return m(e.id, { status: "uploading" }), $.upload(e.file, {
119
119
  ...I.value,
120
120
  method: k.value,
121
- signal: n.signal,
121
+ signal: a.signal,
122
+ params: l.params,
122
123
  onUploadProgress: (t) => {
123
124
  var b;
124
- const o = (Date.now() - l) / 1e3, s = o > 0 ? t.loaded / o : 0, u = (t.total || 0) - t.loaded, A = s > 0 ? u / s : 0, P = {
125
+ const o = (Date.now() - n) / 1e3, s = o > 0 ? t.loaded / o : 0, u = (t.total || 0) - t.loaded, A = s > 0 ? u / s : 0, P = {
125
126
  loaded: t.loaded,
126
127
  total: t.total,
127
128
  percent: t.percent || 0,
@@ -133,13 +134,13 @@ function ne(a) {
133
134
  m(e.id, {
134
135
  status: "uploading",
135
136
  progress: P
136
- }), (b = a.onProgress) == null || b.call(a, T.value);
137
+ }), (b = l.onProgress) == null || b.call(l, T.value);
137
138
  }
138
139
  }).then((t) => {
139
140
  var s, u;
140
141
  if (e.status === "cancelled")
141
142
  throw new Error("Upload cancelled");
142
- const c = ((s = a.onDataCallback) == null ? void 0 : s.call(a, t, e)) || t.data, r = Math.round((Date.now() - l) / 1e3), o = {
143
+ const c = ((s = l.onDataCallback) == null ? void 0 : s.call(l, t, e)) || t.data, r = Math.round((Date.now() - n) / 1e3), o = {
143
144
  ...e,
144
145
  status: "success",
145
146
  data: t,
@@ -154,7 +155,7 @@ function ne(a) {
154
155
  remainingTime: 0
155
156
  }
156
157
  };
157
- return m(e.id, o), f.value.delete(e.id), (u = a.onSuccess) == null || u.call(a, t), o;
158
+ return m(e.id, o), f.value.delete(e.id), (u = l.onSuccess) == null || u.call(l, t), o;
158
159
  }).catch((t) => {
159
160
  throw t.message === "canceled" || e.status === "cancelled" ? new Error("Upload cancelled") : (m(e.id, {
160
161
  status: "error",
@@ -164,25 +165,25 @@ function ne(a) {
164
165
  E();
165
166
  });
166
167
  }, B = async () => {
167
- var n;
168
- const e = i.value.filter((l) => l.status === "pending");
168
+ var a;
169
+ const e = i.value.filter((n) => n.status === "pending");
169
170
  if (e.length === 0)
170
171
  return [];
171
172
  w.value = !0;
172
173
  try {
173
- const l = [];
174
+ const n = [];
174
175
  for (let t = 0; t < e.length; t++) {
175
176
  const c = e[t], r = i.value.findIndex((s) => s.id === c.id);
176
177
  d.value = r;
177
178
  const o = await L(c);
178
- l.push(o);
179
+ n.push(o);
179
180
  }
180
- return l;
181
- } catch (l) {
182
- throw (n = a.onError) == null || n.call(a, {
183
- status: (l == null ? void 0 : l.status) || 500,
184
- message: (l == null ? void 0 : l.message) || "upload failed"
185
- }), l;
181
+ return n;
182
+ } catch (n) {
183
+ throw (a = l.onError) == null || a.call(l, {
184
+ status: (n == null ? void 0 : n.status) || 500,
185
+ message: (n == null ? void 0 : n.message) || "upload failed"
186
+ }), n;
186
187
  } finally {
187
188
  w.value = !1, d.value = -1;
188
189
  }
@@ -190,27 +191,27 @@ function ne(a) {
190
191
  i.value.forEach((e) => {
191
192
  y(e.id);
192
193
  }), f.value.clear(), i.value = [], d.value = -1;
193
- }, M = async (e, n = "file") => {
194
- var l;
194
+ }, M = async (e, a = "file") => {
195
+ var n;
195
196
  try {
196
- if (!a.multiple && e.length > 1)
197
+ if (!l.multiple && e.length > 1)
197
198
  throw new Error("Single file mode: only one file can be selected");
198
- if (!a.multiple && i.value.length > 0 && x(), a.maxFileCount && i.value.length + e.length > a.maxFileCount)
199
- throw new Error(`Adding ${e.length} files would exceed the maximum limit of ${a.maxFileCount}`);
199
+ if (!l.multiple && i.value.length > 0 && x(), l.maxFileCount && i.value.length + e.length > l.maxFileCount)
200
+ throw new Error(`Adding ${e.length} files would exceed the maximum limit of ${l.maxFileCount}`);
200
201
  for (const t of e)
201
- await G(t, n);
202
+ await G(t, a);
202
203
  } catch (t) {
203
- throw (l = a.onError) == null || l.call(a, {
204
+ throw (n = l.onError) == null || n.call(l, {
204
205
  status: (t == null ? void 0 : t.status) || 400,
205
206
  message: (t == null ? void 0 : t.message) || "Failed to add files"
206
207
  }), t;
207
208
  }
208
- a.autoUpload && B().catch((t) => {
209
+ l.autoUpload && B().catch((t) => {
209
210
  console.warn("Auto upload failed:", t);
210
211
  });
211
212
  }, U = (e) => {
212
- const n = i.value.find((t) => t.id === e);
213
- if (n && n.status === "uploading") {
213
+ const a = i.value.find((t) => t.id === e);
214
+ if (a && a.status === "uploading") {
214
215
  m(e, {
215
216
  status: "cancelled"
216
217
  });
@@ -219,13 +220,13 @@ function ne(a) {
219
220
  return;
220
221
  t.abort(), f.value.delete(e);
221
222
  }
222
- const l = i.value.findIndex((t) => t.id === e);
223
- l !== -1 && i.value.splice(l, 1);
223
+ const n = i.value.findIndex((t) => t.id === e);
224
+ n !== -1 && i.value.splice(n, 1);
224
225
  }, N = (e) => {
225
- e ? e.forEach((n) => U(n)) : i.value.forEach((n) => U(n.id));
226
+ e ? e.forEach((a) => U(a)) : i.value.forEach((a) => U(a.id));
226
227
  }, { files: q, open: O, reset: S } = Q({
227
- accept: a.accept,
228
- multiple: a.multiple || !1
228
+ accept: l.accept,
229
+ multiple: l.multiple || !1
229
230
  }), j = (e) => ({
230
231
  id: z(),
231
232
  ...e,
@@ -243,9 +244,9 @@ function ne(a) {
243
244
  });
244
245
  V(q, async (e) => {
245
246
  if (e && e.length > 0) {
246
- const n = Array.from(e);
247
- S(), await M(n, "file").catch((l) => {
248
- console.warn("Failed to add selected files:", l);
247
+ const a = Array.from(e);
248
+ S(), await M(a, "file").catch((n) => {
249
+ console.warn("Failed to add selected files:", n);
249
250
  });
250
251
  }
251
252
  });
@@ -267,9 +268,9 @@ function ne(a) {
267
268
  removeFiles: N,
268
269
  addFiles: M,
269
270
  addDataFiles: (e) => {
270
- !a.multiple && i.value.length > 0 && x();
271
- const n = e.map((l) => j(l));
272
- i.value.push(...n);
271
+ !l.multiple && i.value.length > 0 && x();
272
+ const a = e.map((n) => j(n));
273
+ i.value.push(...a);
273
274
  },
274
275
  cancelFiles: K
275
276
  };
@@ -1,38 +1,44 @@
1
1
  import g from "axios";
2
- function m(e) {
2
+ function m(t) {
3
3
  return {
4
4
  login: async (n, c) => {
5
5
  var d;
6
- return await g.post(c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.login) || "/login", e == null ? void 0 : e.dataProviderName), n).then((t) => {
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
7
  var i, a, s;
8
8
  return {
9
9
  success: !0,
10
- message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
11
- redirectTo: ((a = e == null ? void 0 : e.routePath) == null ? void 0 : a.index) || "/",
12
- data: (s = t == null ? void 0 : t.data) == null ? void 0 : s.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((t) => {
14
+ }).catch((e) => {
15
15
  var i, a;
16
16
  return {
17
17
  success: !1,
18
- message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.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 (n, c) => {
23
- var d;
24
- return await g.get((c == null ? void 0 : c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.check) || "/check", e == null ? void 0 : e.dataProviderName)) || "").then((t) => {
25
- var i, a;
22
+ check: async (n, c, d) => {
23
+ var e;
24
+ return await g.get((c == null ? void 0 : c.getApiUrl(((e = t == null ? void 0 : t.apiPath) == null ? void 0 : e.check) || "/check", t == null ? void 0 : t.dataProviderName)) || "", {
25
+ headers: {
26
+ Authorization: (d == null ? void 0 : d.token) || ""
27
+ }
28
+ }).then((i) => {
29
+ var a, s;
26
30
  return {
27
31
  success: !0,
28
- message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
29
- data: (a = t == null ? void 0 : t.data) == null ? void 0 : a.data
32
+ logout: !1,
33
+ message: (a = i == null ? void 0 : i.data) == null ? void 0 : a.message,
34
+ data: (s = i == null ? void 0 : i.data) == null ? void 0 : s.data
30
35
  };
31
- }).catch((t) => {
32
- var i, a;
36
+ }).catch((i) => {
37
+ var a, s;
33
38
  return {
34
39
  success: !1,
35
- message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
40
+ logout: !0,
41
+ message: ((s = (a = i == null ? void 0 : i.response) == null ? void 0 : a.data) == null ? void 0 : s.message) || (i == null ? void 0 : i.message)
36
42
  };
37
43
  });
38
44
  },
@@ -40,7 +46,7 @@ function m(e) {
40
46
  var c;
41
47
  return (n == null ? void 0 : n.status) === 401 ? {
42
48
  logout: !0,
43
- redirectTo: ((c = e == null ? void 0 : e.routePath) == null ? void 0 : c.login) || "/login",
49
+ redirectTo: ((c = t == null ? void 0 : t.routePath) == null ? void 0 : c.login) || "/login",
44
50
  error: n
45
51
  } : {
46
52
  logout: !1,
@@ -51,64 +57,64 @@ function m(e) {
51
57
  var n;
52
58
  return {
53
59
  success: !0,
54
- redirectTo: ((n = e == null ? void 0 : e.routePath) == null ? void 0 : n.login) || "/login"
60
+ redirectTo: ((n = t == null ? void 0 : t.routePath) == null ? void 0 : n.login) || "/login"
55
61
  };
56
62
  },
57
63
  register: async (n, c) => {
58
64
  var d;
59
- return await g.post((c == null ? void 0 : c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.register) || "/register", e == null ? void 0 : e.dataProviderName)) || "", n).then((t) => {
65
+ 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
66
  var i, a, s;
61
67
  return {
62
68
  success: !0,
63
- message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
64
- redirectTo: ((a = e == null ? void 0 : e.routePath) == null ? void 0 : a.index) || "/",
65
- data: (s = t == null ? void 0 : t.data) == null ? void 0 : s.data
69
+ message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
70
+ redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.index) || "/",
71
+ data: (s = e == null ? void 0 : e.data) == null ? void 0 : s.data
66
72
  };
67
- }).catch((t) => {
73
+ }).catch((e) => {
68
74
  var i, a;
69
75
  return {
70
76
  success: !1,
71
- message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
77
+ 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
78
  };
73
79
  });
74
80
  },
75
81
  forgotPassword: async (n, c) => {
76
82
  var d;
77
- return await g.post((c == null ? void 0 : c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.forgotPassword) || "/forgot-password", e == null ? void 0 : e.dataProviderName)) || "", n).then((t) => {
83
+ 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
84
  var i, a;
79
85
  return {
80
86
  success: !0,
81
- message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
82
- redirectTo: ((a = e == null ? void 0 : e.routePath) == null ? void 0 : a.login) || "/login"
87
+ message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
88
+ redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.login) || "/login"
83
89
  };
84
- }).catch((t) => {
90
+ }).catch((e) => {
85
91
  var i, a;
86
92
  return {
87
93
  success: !1,
88
- message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
94
+ 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
95
  };
90
96
  });
91
97
  },
92
98
  updatePassword: async (n, c) => {
93
99
  var d;
94
- return await g.post((c == null ? void 0 : c.getApiUrl(((d = e == null ? void 0 : e.apiPath) == null ? void 0 : d.updatePassword) || "/update-password", e == null ? void 0 : e.dataProviderName)) || "", n).then((t) => {
100
+ 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
101
  var i, a;
96
102
  return {
97
103
  success: !0,
98
- message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message,
99
- redirectTo: ((a = e == null ? void 0 : e.routePath) == null ? void 0 : a.login) || "/login"
104
+ message: (i = e == null ? void 0 : e.data) == null ? void 0 : i.message,
105
+ redirectTo: ((a = t == null ? void 0 : t.routePath) == null ? void 0 : a.login) || "/login"
100
106
  };
101
- }).catch((t) => {
107
+ }).catch((e) => {
102
108
  var i, a;
103
109
  return {
104
110
  success: !1,
105
- message: ((a = (i = t == null ? void 0 : t.response) == null ? void 0 : i.data) == null ? void 0 : a.message) || (t == null ? void 0 : t.message)
111
+ 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
112
  };
107
113
  });
108
114
  },
109
- can: (n, c, d, t) => {
115
+ can: (n, c, d, e) => {
110
116
  var i, a;
111
- return !(t != null && t.permission) || Array.isArray(t == null ? void 0 : t.permission) && ((i = t == null ? void 0 : t.permission) == null ? void 0 : i.length) === 0 || typeof (t == null ? void 0 : t.permission) == "object" && Object.keys(t == null ? void 0 : t.permission).length === 0 ? !0 : !(Array.isArray(t == null ? void 0 : t.permission) && !((a = t == null ? void 0 : t.permission) != null && a.includes(n)) || typeof (t == null ? void 0 : t.permission) == "object" && (t == null ? void 0 : t.permission[n]) === !1);
117
+ 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
118
  }
113
119
  };
114
120
  }
@@ -1,6 +1,6 @@
1
1
  import { createI18n as o } from "vue-i18n";
2
- function i(l) {
3
- const n = o({
2
+ function r(l) {
3
+ const a = o({
4
4
  legacy: !1,
5
5
  locale: l == null ? void 0 : l.locale,
6
6
  fallbackLocale: l == null ? void 0 : l.fallbackLocale,
@@ -9,22 +9,23 @@ function i(l) {
9
9
  fallbackWarn: !1
10
10
  });
11
11
  return {
12
- t: (e, a, c) => {
13
- const t = n.global.t(e, a);
14
- return t === e && c ? c : t;
12
+ t: (e, c, n) => {
13
+ const t = a.global.t(e, c);
14
+ return t === e && n ? n : t;
15
15
  },
16
- changeLocale: (e, a) => new Promise((c) => {
17
- n.global.locale.value = e, c(e);
16
+ changeLocale: (e, c) => new Promise((n) => {
17
+ a.global.locale.value = e, n(e);
18
18
  }),
19
- loadLocale: (e, a) => new Promise((c) => {
20
- n.global.setLocaleMessage(e, a), c(e);
19
+ loadLocale: (e, c) => new Promise((n) => {
20
+ a.global.setLocaleMessage(e, c), n(e);
21
21
  }),
22
- mergeLocale: (e, a) => {
23
- n.global.mergeLocaleMessage(e, a);
22
+ mergeLocale: (e, c) => {
23
+ a.global.mergeLocaleMessage(e, c);
24
24
  },
25
- getLocale: () => n.global.locale.value
25
+ getLocale: () => a.global.locale.value,
26
+ getLocales: () => a.global.availableLocales.map((e) => e)
26
27
  };
27
28
  }
28
29
  export {
29
- i as i18nProvider
30
+ r as i18nProvider
30
31
  };
@@ -1,9 +1,8 @@
1
- import type { InfiniteData } from '@tanstack/vue-query';
2
1
  import type { IDataProviderPagination, IDataProviderResponse } from '../types';
3
2
  import type { IInfiniteListParams } from './data';
4
3
  export interface IUseExportProps extends IInfiniteListParams {
5
- onSuccess?: (data: InfiniteData<IDataProviderResponse | undefined> | undefined) => void;
6
- onProgress?: (data: IDataProviderPagination) => void;
4
+ onSuccess?: (data?: IDataProviderResponse) => void;
5
+ onProgress?: (data?: IDataProviderPagination) => void;
7
6
  interval?: number;
8
7
  maxPage?: number | (() => number);
9
8
  }
@@ -4,4 +4,5 @@ export declare function useI18n(): {
4
4
  getLocale: () => string | undefined;
5
5
  loadLocale: (lang: string, messages: Record<string, unknown>) => Promise<any> | undefined;
6
6
  mergeLocale: (lang: string, messages: Record<string, unknown>) => void | undefined;
7
+ getLocales: () => string[] | undefined;
7
8
  };
@@ -1,6 +1,6 @@
1
1
  import type { IDataProviderCustomOptions, IDataProviderResponse } from '../../types';
2
2
  export interface IUploadDriver {
3
- upload(file: File, options: IUploadDriverOptions): Promise<IDataProviderResponse>;
3
+ upload: (file: File, options: IUploadDriverOptions) => Promise<IDataProviderResponse>;
4
4
  }
5
5
  export interface IUploadDriverOptions extends Omit<IDataProviderCustomOptions, 'onUploadProgress' | 'onDownloadProgress'> {
6
6
  method?: 'POST' | 'PUT';
@@ -8,6 +8,7 @@ export interface IUseUploadProps extends Omit<IDataProviderCustomOptions, 'onUpl
8
8
  accept?: string;
9
9
  multiple?: boolean;
10
10
  autoUpload?: boolean;
11
+ params?: Record<string, string>;
11
12
  driver?: IUploadDriver;
12
13
  options?: UseMutationOptions<IDataProviderResponse, IDataProviderError, IDataProviderCustomOptions>;
13
14
  onSuccess?: (data: IDataProviderResponse) => void;
@@ -7,11 +7,11 @@ import type { IDataProviderError } from './data';
7
7
  */
8
8
  export interface IAuthProvider {
9
9
  login: (params: any, manage: IManageHook) => Promise<IAuthLoginResponse>;
10
- check: (params?: any, manage?: IManageHook) => Promise<IAuthCheckResponse>;
11
10
  logout: (params?: any, manage?: IManageHook) => Promise<IAuthLogoutResponse>;
12
11
  register?: (params: any, manage?: IManageHook) => Promise<IAuthLoginResponse>;
13
12
  forgotPassword?: (params: any, manage?: IManageHook) => Promise<IAuthActionResponse>;
14
13
  updatePassword?: (params: any, manage?: IManageHook) => Promise<IAuthActionResponse>;
14
+ check?: (params?: any, manage?: IManageHook, auth?: IUserState) => Promise<IAuthCheckResponse>;
15
15
  can?: (name: string, params?: any, manage?: IManageHook, auth?: IUserState) => boolean;
16
16
  onError: (error?: IDataProviderError) => Promise<IAuthErrorResponse>;
17
17
  }
@@ -8,4 +8,5 @@ export interface I18nProvider {
8
8
  loadLocale: (lang: string, files: Record<string, unknown>) => Promise<any>;
9
9
  mergeLocale: (lang: string, messages: Record<string, unknown>) => void;
10
10
  getLocale: () => string;
11
+ getLocales: () => string[];
11
12
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-core",
3
3
  "type": "module",
4
- "version": "1.0.19",
4
+ "version": "1.0.21",
5
5
  "author": "DuxWeb",
6
6
  "license": "MIT",
7
7
  "repository": {