@duxweb/dvha-core 1.0.19 → 1.0.20
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/export.cjs +1 -1
- package/dist/cjs/hooks/exportCsv.cjs +2 -2
- package/dist/cjs/hooks/i18n.cjs +1 -1
- package/dist/cjs/hooks/list.cjs +1 -1
- package/dist/cjs/preset/i18nProvider.cjs +1 -1
- package/dist/esm/hooks/export.js +12 -12
- package/dist/esm/hooks/exportCsv.js +17 -25
- package/dist/esm/hooks/i18n.js +6 -2
- package/dist/esm/hooks/list.js +12 -12
- package/dist/esm/preset/i18nProvider.js +14 -13
- package/dist/types/hooks/export.d.ts +2 -3
- package/dist/types/hooks/i18n.d.ts +1 -0
- package/dist/types/types/i18n.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),h=require("./data.cjs"),w=e=>new Promise(
|
|
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
|
|
2
|
-
`},excelBOM:t.writeBOM||!1}});return
|
|
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;
|
package/dist/cjs/hooks/i18n.cjs
CHANGED
|
@@ -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
|
|
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;
|
package/dist/cjs/hooks/list.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@vueuse/core"),n=require("vue"),J=require("./data.cjs"),
|
|
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 o=require("vue-i18n");function
|
|
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;
|
package/dist/esm/hooks/export.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ref as h, computed as
|
|
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
|
|
5
|
-
const a = h(!1), r =
|
|
6
|
-
const { onSuccess: n, onProgress: i, interval: l, maxPage:
|
|
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
|
-
}),
|
|
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
|
|
23
|
-
for (; m.value && t.value.page
|
|
24
|
-
|
|
25
|
-
(l = e.onSuccess) == null || l.call(e,
|
|
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 =
|
|
29
|
+
}, d = c(() => g.value || a.value);
|
|
30
30
|
return {
|
|
31
|
-
data:
|
|
31
|
+
data: s,
|
|
32
32
|
isLoading: d,
|
|
33
33
|
trigger: x
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
b as useExport
|
|
38
38
|
};
|
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
import { json2csv as v } from "json-2-csv";
|
|
2
|
-
import { computed as
|
|
3
|
-
import { useExport as
|
|
2
|
+
import { computed as s } from "vue";
|
|
3
|
+
import { useExport as f } from "./export.js";
|
|
4
4
|
function b(e) {
|
|
5
|
-
const
|
|
6
|
-
const { filename: t, headers:
|
|
7
|
-
return
|
|
8
|
-
}),
|
|
9
|
-
const t = e.csvOptions || {},
|
|
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
|
|
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
|
|
23
|
-
...
|
|
22
|
+
return f({
|
|
23
|
+
...l.value,
|
|
24
24
|
onSuccess: async (t) => {
|
|
25
|
-
var
|
|
26
|
-
if (!(t != null && t.
|
|
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
|
|
43
|
-
o.href =
|
|
44
|
-
} catch (
|
|
45
|
-
(
|
|
46
|
-
message: `CSV Export Error: ${
|
|
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
|
}
|
package/dist/esm/hooks/i18n.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
36
|
+
I as useI18n
|
|
33
37
|
};
|
package/dist/esm/hooks/list.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { reactiveComputed as V, useCountdown as W } from "@vueuse/core";
|
|
2
|
-
import { toRef as f, ref as
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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: () =>
|
|
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
|
-
}),
|
|
125
|
+
}), r = v(!1), {
|
|
126
126
|
remaining: N,
|
|
127
|
-
start:
|
|
127
|
+
start: z,
|
|
128
128
|
stop: Q
|
|
129
129
|
} = W(10, {
|
|
130
130
|
onComplete: () => {
|
|
131
|
-
d(),
|
|
131
|
+
d(), z();
|
|
132
132
|
}
|
|
133
133
|
}), T = () => {
|
|
134
|
-
|
|
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:
|
|
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:
|
|
172
|
+
autoRefetch: r,
|
|
173
173
|
onAutoRefetch: T,
|
|
174
174
|
autoCountdown: N
|
|
175
175
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createI18n as o } from "vue-i18n";
|
|
2
|
-
function
|
|
3
|
-
const
|
|
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,
|
|
13
|
-
const t =
|
|
14
|
-
return t === e &&
|
|
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,
|
|
17
|
-
|
|
16
|
+
changeLocale: (e, c) => new Promise((n) => {
|
|
17
|
+
a.global.locale.value = e, n(e);
|
|
18
18
|
}),
|
|
19
|
-
loadLocale: (e,
|
|
20
|
-
|
|
19
|
+
loadLocale: (e, c) => new Promise((n) => {
|
|
20
|
+
a.global.setLocaleMessage(e, c), n(e);
|
|
21
21
|
}),
|
|
22
|
-
mergeLocale: (e,
|
|
23
|
-
|
|
22
|
+
mergeLocale: (e, c) => {
|
|
23
|
+
a.global.mergeLocaleMessage(e, c);
|
|
24
24
|
},
|
|
25
|
-
getLocale: () =>
|
|
25
|
+
getLocale: () => a.global.locale.value,
|
|
26
|
+
getLocales: () => a.global.availableLocales.map((e) => e)
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
export {
|
|
29
|
-
|
|
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
|
|
6
|
-
onProgress?: (data
|
|
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
|
};
|