@duxweb/dvha-core 0.1.0 → 0.1.2
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/auth.cjs +1 -1
- package/dist/cjs/hooks/i18n.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/{simple → preset}/dataProvider.cjs +1 -1
- package/dist/cjs/preset/i18nProvider.cjs +1 -0
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/stores/i18n.cjs +1 -0
- package/dist/cjs/stores/manage.cjs +1 -1
- package/dist/esm/hooks/auth.js +53 -53
- package/dist/esm/hooks/i18n.js +25 -0
- package/dist/esm/index.js +45 -39
- package/dist/esm/preset/i18nProvider.js +22 -0
- package/dist/esm/provider/app.js +57 -54
- package/dist/esm/stores/i18n.js +31 -0
- package/dist/esm/stores/manage.js +18 -18
- package/dist/types/hooks/i18n.d.ts +5 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/preset/i18nProvider.d.ts +3 -0
- package/dist/types/{simple → preset}/index.d.ts +1 -0
- package/dist/types/stores/i18n.d.ts +22 -0
- package/dist/types/stores/index.d.ts +1 -0
- package/dist/types/stores/route.d.ts +525 -0
- package/dist/types/stores/tab.d.ts +210 -0
- package/dist/types/types/config.d.ts +2 -0
- package/dist/types/types/i18n.d.ts +10 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/manage.d.ts +2 -0
- package/package.json +2 -1
- package/dist/cjs/{simple → preset}/authProvider.cjs +0 -0
- package/dist/esm/{simple → preset}/authProvider.js +0 -0
- package/dist/esm/{simple → preset}/dataProvider.js +1 -1
- /package/dist/types/{simple → preset}/authProvider.d.ts +0 -0
- /package/dist/types/{simple → preset}/dataProvider.d.ts +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineStore as i } from "pinia";
|
|
2
|
+
import { inject as c, ref as r } from "vue";
|
|
3
|
+
function p(e) {
|
|
4
|
+
const t = c("dux.manage");
|
|
5
|
+
if (e || (e = (t == null ? void 0 : t.value) || ""), !e)
|
|
6
|
+
throw new Error("manage not found");
|
|
7
|
+
return u(e)();
|
|
8
|
+
}
|
|
9
|
+
function u(e) {
|
|
10
|
+
return i(`i18n-${e}`, () => {
|
|
11
|
+
const t = r(""), n = r(!1);
|
|
12
|
+
return {
|
|
13
|
+
lang: t,
|
|
14
|
+
isInit: () => {
|
|
15
|
+
const o = n.value;
|
|
16
|
+
return n.value = !0, o;
|
|
17
|
+
},
|
|
18
|
+
setLocale: (o) => {
|
|
19
|
+
t.value = o;
|
|
20
|
+
},
|
|
21
|
+
getLocale: () => t.value
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
persist: {
|
|
25
|
+
pick: ["lang"]
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
p as useI18nStore
|
|
31
|
+
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { cloneDeep as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import { inject as h, ref as
|
|
4
|
-
function
|
|
1
|
+
import { cloneDeep as P } from "lodash-es";
|
|
2
|
+
import { defineStore as p } from "pinia";
|
|
3
|
+
import { inject as h, ref as n } from "vue";
|
|
4
|
+
function v(e) {
|
|
5
5
|
return e != null && typeof e == "object" && !Array.isArray(e) && typeof e.getList != "function";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function a(e) {
|
|
8
8
|
const i = h("dux.manage");
|
|
9
9
|
if (e || (e = (i == null ? void 0 : i.value) || ""), !e)
|
|
10
10
|
throw new Error("manage not found");
|
|
11
|
-
return
|
|
11
|
+
return y(e)();
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
15
|
-
const i =
|
|
13
|
+
function y(e) {
|
|
14
|
+
return p(`manages-${e}`, () => {
|
|
15
|
+
const i = n(), s = n(!1);
|
|
16
16
|
return {
|
|
17
17
|
config: i,
|
|
18
18
|
isInit: () => {
|
|
19
|
-
const
|
|
20
|
-
return
|
|
19
|
+
const u = s.value;
|
|
20
|
+
return s.value = !0, u;
|
|
21
21
|
},
|
|
22
|
-
setConfig: (
|
|
23
|
-
const t =
|
|
24
|
-
t.title &&
|
|
22
|
+
setConfig: (u, r) => {
|
|
23
|
+
const t = P(u), o = [];
|
|
24
|
+
t.title && o.push(t.title), r.title && o.push(r.title), t.title = o.join(" - "), t.copyright = t.copyright || r.copyright, t.description = t.description || r.description, t.theme = { ...r == null ? void 0 : r.theme, ...t == null ? void 0 : t.theme };
|
|
25
25
|
const d = {};
|
|
26
|
-
r != null && r.dataProvider && (
|
|
26
|
+
r != null && r.dataProvider && (v(r.dataProvider) ? Object.keys(r.dataProvider).forEach((c) => {
|
|
27
27
|
d[c] = r.dataProvider[c];
|
|
28
|
-
}) : d.default = r.dataProvider), t != null && t.dataProvider && (
|
|
28
|
+
}) : d.default = r.dataProvider), t != null && t.dataProvider && (v(t.dataProvider) ? Object.keys(t.dataProvider).forEach((c) => {
|
|
29
29
|
d[c] = t.dataProvider[c];
|
|
30
|
-
}) : d.default = t.dataProvider), t.authProvider = (r == null ? void 0 : r.authProvider) || (t == null ? void 0 : t.authProvider), t.dataProvider = d, t.layoutComponent = {
|
|
30
|
+
}) : d.default = t.dataProvider), t.authProvider = (r == null ? void 0 : r.authProvider) || (t == null ? void 0 : t.authProvider), t.dataProvider = d, t.i18nProvider = (r == null ? void 0 : r.i18nProvider) || (t == null ? void 0 : t.i18nProvider), t.layoutComponent = {
|
|
31
31
|
...r.layoutComponent,
|
|
32
32
|
...t.layoutComponent
|
|
33
33
|
}, i.value = t;
|
|
@@ -37,5 +37,5 @@ function a(e) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
export {
|
|
40
|
-
|
|
40
|
+
a as useManageStore
|
|
41
41
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* use i18n store
|
|
4
|
+
* @param manageName manage name
|
|
5
|
+
* @returns i18n store
|
|
6
|
+
*/
|
|
7
|
+
export declare function useI18nStore(manageName?: string): import("pinia").Store<`i18n-${string}`, Pick<{
|
|
8
|
+
lang: Ref<string, string>;
|
|
9
|
+
isInit: () => boolean;
|
|
10
|
+
setLocale: (value: string) => void;
|
|
11
|
+
getLocale: () => string;
|
|
12
|
+
}, "lang">, Pick<{
|
|
13
|
+
lang: Ref<string, string>;
|
|
14
|
+
isInit: () => boolean;
|
|
15
|
+
setLocale: (value: string) => void;
|
|
16
|
+
getLocale: () => string;
|
|
17
|
+
}, never>, Pick<{
|
|
18
|
+
lang: Ref<string, string>;
|
|
19
|
+
isInit: () => boolean;
|
|
20
|
+
setLocale: (value: string) => void;
|
|
21
|
+
getLocale: () => string;
|
|
22
|
+
}, "isInit" | "setLocale" | "getLocale">>;
|