@jnrs/vue-core 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/components/index.js +46 -46
- package/dist/constants/themeOptions.d.ts +12 -12
- package/dist/index-9Ug4oygq.js +116 -0
- package/dist/{index-DEkMXVh9.js → index-Ci9uljtG.js} +3 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3275 -4
- package/dist/locales/en.d.ts +31 -0
- package/dist/locales/i18next.d.ts +1 -0
- package/dist/locales/index.d.ts +3 -0
- package/dist/locales/index.js +63 -0
- package/dist/locales/zhCn.d.ts +31 -0
- package/dist/piniaStore/base/auth.d.ts +46 -9
- package/dist/piniaStore/base/menu.d.ts +4 -1
- package/dist/piniaStore/base/system.d.ts +11 -11
- package/dist/piniaStore/index.d.ts +1 -0
- package/dist/piniaStore/index.js +6 -5
- package/dist/piniaStore/mock.d.ts +11 -0
- package/dist/request/axios.d.ts +6 -0
- package/dist/request/fetch.d.ts +0 -0
- package/dist/system-KZETuQYC.js +91 -0
- package/dist/utils/index.d.ts +0 -0
- package/dist/vueRouter/index.js +1 -1
- package/package.json +8 -3
- package/dist/index-BEHnZZvl.js +0 -100
- package/dist/system-C18uA6p7.js +0 -76
package/README.md
CHANGED
package/dist/components/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".globalSetting_item[data-v-
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { ElDrawer as k, ElRadioGroup as
|
|
4
|
-
import { u as E, L as
|
|
5
|
-
const N = { class: "globalSetting_item" },
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".globalSetting_item[data-v-b0382b1b]{margin-bottom:20px}.globalSetting_header{margin-bottom:0;padding-bottom:20px}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
import { defineComponent as O, ref as y, createBlock as d, openBlock as n, unref as l, withCtx as r, createElementVNode as u, createVNode as _, toDisplayString as s, createElementBlock as c, Fragment as S, renderList as b, createTextVNode as f } from "vue";
|
|
3
|
+
import { ElDrawer as k, ElRadioGroup as C, ElRadio as V } from "element-plus";
|
|
4
|
+
import { u as E, L as G, M as $, C as L } from "../system-KZETuQYC.js";
|
|
5
|
+
const N = { class: "globalSetting_item" }, j = { class: "globalSetting_item" }, w = { class: "globalSetting_item" }, I = /* @__PURE__ */ O({
|
|
6
6
|
__name: "GlobalSetting",
|
|
7
|
-
setup(
|
|
8
|
-
const { theme: o, setLocale:
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
} }), (
|
|
7
|
+
setup(m, { expose: i }) {
|
|
8
|
+
const { theme: o, setLocale: v, setMode: g, setPrimaryColor: h } = E(), p = y(!1);
|
|
9
|
+
return i({ handleShow: () => {
|
|
10
|
+
p.value = !0;
|
|
11
|
+
} }), (a, t) => (n(), d(l(k), {
|
|
12
12
|
"header-class": "globalSetting_header",
|
|
13
|
-
modelValue:
|
|
14
|
-
"onUpdate:modelValue": t[3] || (t[3] = (e) =>
|
|
15
|
-
title: "
|
|
13
|
+
modelValue: p.value,
|
|
14
|
+
"onUpdate:modelValue": t[3] || (t[3] = (e) => p.value = e),
|
|
15
|
+
title: a.$t("@jnrs/vue-core.components.GlobalSetting.title")
|
|
16
16
|
}, {
|
|
17
|
-
default:
|
|
17
|
+
default: r(() => [
|
|
18
18
|
u("div", N, [
|
|
19
|
-
|
|
20
|
-
_(l(
|
|
19
|
+
u("h4", null, s(a.$t("@jnrs/vue-core.components.GlobalSetting.language")), 1),
|
|
20
|
+
_(l(C), {
|
|
21
21
|
modelValue: l(o).locale,
|
|
22
22
|
"onUpdate:modelValue": t[0] || (t[0] = (e) => l(o).locale = e),
|
|
23
|
-
onChange: l(
|
|
23
|
+
onChange: l(v)
|
|
24
24
|
}, {
|
|
25
|
-
default:
|
|
26
|
-
(
|
|
25
|
+
default: r(() => [
|
|
26
|
+
(n(!0), c(S, null, b(l(G), (e) => (n(), d(l(V), {
|
|
27
27
|
key: e.value,
|
|
28
28
|
value: e.value
|
|
29
29
|
}, {
|
|
30
|
-
default:
|
|
31
|
-
|
|
30
|
+
default: r(() => [
|
|
31
|
+
f(s(a.$t(e.label)), 1)
|
|
32
32
|
]),
|
|
33
33
|
_: 2
|
|
34
34
|
}, 1032, ["value"]))), 128))
|
|
@@ -36,20 +36,20 @@ const N = { class: "globalSetting_item" }, w = { class: "globalSetting_item" },
|
|
|
36
36
|
_: 1
|
|
37
37
|
}, 8, ["modelValue", "onChange"])
|
|
38
38
|
]),
|
|
39
|
-
u("div",
|
|
40
|
-
|
|
41
|
-
_(l(
|
|
39
|
+
u("div", j, [
|
|
40
|
+
u("h4", null, s(a.$t("@jnrs/vue-core.components.GlobalSetting.theme")), 1),
|
|
41
|
+
_(l(C), {
|
|
42
42
|
modelValue: l(o).mode,
|
|
43
43
|
"onUpdate:modelValue": t[1] || (t[1] = (e) => l(o).mode = e),
|
|
44
|
-
onChange: l(
|
|
44
|
+
onChange: l(g)
|
|
45
45
|
}, {
|
|
46
|
-
default:
|
|
47
|
-
(
|
|
46
|
+
default: r(() => [
|
|
47
|
+
(n(!0), c(S, null, b(l($), (e) => (n(), d(l(V), {
|
|
48
48
|
key: e.value,
|
|
49
49
|
value: e.value
|
|
50
50
|
}, {
|
|
51
|
-
default:
|
|
52
|
-
|
|
51
|
+
default: r(() => [
|
|
52
|
+
f(s(a.$t(e.label)), 1)
|
|
53
53
|
]),
|
|
54
54
|
_: 2
|
|
55
55
|
}, 1032, ["value"]))), 128))
|
|
@@ -57,20 +57,20 @@ const N = { class: "globalSetting_item" }, w = { class: "globalSetting_item" },
|
|
|
57
57
|
_: 1
|
|
58
58
|
}, 8, ["modelValue", "onChange"])
|
|
59
59
|
]),
|
|
60
|
-
u("div",
|
|
61
|
-
|
|
62
|
-
_(l(
|
|
63
|
-
modelValue: l(o).
|
|
64
|
-
"onUpdate:modelValue": t[2] || (t[2] = (e) => l(o).
|
|
65
|
-
onChange: l(
|
|
60
|
+
u("div", w, [
|
|
61
|
+
u("h4", null, s(a.$t("@jnrs/vue-core.components.GlobalSetting.primaryColor")), 1),
|
|
62
|
+
_(l(C), {
|
|
63
|
+
modelValue: l(o).primaryColor,
|
|
64
|
+
"onUpdate:modelValue": t[2] || (t[2] = (e) => l(o).primaryColor = e),
|
|
65
|
+
onChange: l(h)
|
|
66
66
|
}, {
|
|
67
|
-
default:
|
|
68
|
-
(
|
|
67
|
+
default: r(() => [
|
|
68
|
+
(n(!0), c(S, null, b(l(L), (e) => (n(), d(l(V), {
|
|
69
69
|
key: e.value,
|
|
70
70
|
value: e.value
|
|
71
71
|
}, {
|
|
72
|
-
default:
|
|
73
|
-
|
|
72
|
+
default: r(() => [
|
|
73
|
+
f(s(a.$t(e.label)), 1)
|
|
74
74
|
]),
|
|
75
75
|
_: 2
|
|
76
76
|
}, 1032, ["value"]))), 128))
|
|
@@ -80,14 +80,14 @@ const N = { class: "globalSetting_item" }, w = { class: "globalSetting_item" },
|
|
|
80
80
|
])
|
|
81
81
|
]),
|
|
82
82
|
_: 1
|
|
83
|
-
}, 8, ["modelValue"]));
|
|
83
|
+
}, 8, ["modelValue", "title"]));
|
|
84
84
|
}
|
|
85
|
-
}),
|
|
86
|
-
const o =
|
|
87
|
-
for (const [
|
|
88
|
-
o[
|
|
85
|
+
}), P = (m, i) => {
|
|
86
|
+
const o = m.__vccOpts || m;
|
|
87
|
+
for (const [v, g] of i)
|
|
88
|
+
o[v] = g;
|
|
89
89
|
return o;
|
|
90
|
-
},
|
|
90
|
+
}, M = /* @__PURE__ */ P(I, [["__scopeId", "data-v-b0382b1b"]]);
|
|
91
91
|
export {
|
|
92
|
-
|
|
92
|
+
M as GlobalSetting
|
|
93
93
|
};
|
|
@@ -3,46 +3,46 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const LOCALE_OPTIONS: readonly [{
|
|
5
5
|
readonly value: "zhCn";
|
|
6
|
-
readonly label: "
|
|
6
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.zhCn";
|
|
7
7
|
}, {
|
|
8
8
|
readonly value: "en";
|
|
9
|
-
readonly label: "
|
|
9
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.en";
|
|
10
10
|
}];
|
|
11
11
|
/**
|
|
12
12
|
* 主题模式选项
|
|
13
13
|
*/
|
|
14
14
|
export declare const MODE_OPTIONS: readonly [{
|
|
15
15
|
readonly value: "auto";
|
|
16
|
-
readonly label: "
|
|
16
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.auto";
|
|
17
17
|
}, {
|
|
18
18
|
readonly value: "light";
|
|
19
|
-
readonly label: "
|
|
19
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.light";
|
|
20
20
|
}, {
|
|
21
21
|
readonly value: "dark";
|
|
22
|
-
readonly label: "
|
|
22
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.dark";
|
|
23
23
|
}];
|
|
24
24
|
/**
|
|
25
25
|
* 强调色选项
|
|
26
26
|
*/
|
|
27
27
|
export declare const COLOR_OPTIONS: readonly [{
|
|
28
28
|
readonly value: "oklch(0.6 0.19 41)";
|
|
29
|
-
readonly label: "
|
|
29
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jnrs";
|
|
30
30
|
}, {
|
|
31
31
|
readonly value: "oklch(0.51 0.21 264)";
|
|
32
|
-
readonly label: "
|
|
32
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.azure";
|
|
33
33
|
}, {
|
|
34
34
|
readonly value: "oklch(0.90 0.16 98)";
|
|
35
|
-
readonly label: "
|
|
35
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.moonYellow";
|
|
36
36
|
}, {
|
|
37
37
|
readonly value: "oklch(0.63 0.25 27)";
|
|
38
|
-
readonly label: "
|
|
38
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jdRed";
|
|
39
39
|
}, {
|
|
40
40
|
readonly value: "oklch(0.65 0.24 33)";
|
|
41
|
-
readonly label: "
|
|
41
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.taobaoRed";
|
|
42
42
|
}, {
|
|
43
43
|
readonly value: "oklch(0.61 0.20 261)";
|
|
44
|
-
readonly label: "
|
|
44
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.dingtalkBlue";
|
|
45
45
|
}, {
|
|
46
46
|
readonly value: "oklch(0.70 0.12 152)";
|
|
47
|
-
readonly label: "
|
|
47
|
+
readonly label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.wechatGreen";
|
|
48
48
|
}];
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import "pinia-plugin-persistedstate";
|
|
2
|
+
import { defineStore as d } from "pinia";
|
|
3
|
+
import { ref as u } from "vue";
|
|
4
|
+
import { u as m } from "./system-KZETuQYC.js";
|
|
5
|
+
import { a as v } from "./index-Ci9uljtG.js";
|
|
6
|
+
const y = d(
|
|
7
|
+
"jnrs-app-mock",
|
|
8
|
+
() => ({ isMock: u(!1) }),
|
|
9
|
+
{
|
|
10
|
+
persist: {
|
|
11
|
+
pick: ["isMock"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
), h = d(
|
|
15
|
+
"@jnrs/vue-core/pinia:auth",
|
|
16
|
+
() => {
|
|
17
|
+
const e = u(!1), t = u(null), r = u(null), o = u(), i = u([]);
|
|
18
|
+
return {
|
|
19
|
+
hasAuthenticated: e,
|
|
20
|
+
token: t,
|
|
21
|
+
userInfo: r,
|
|
22
|
+
dict: o,
|
|
23
|
+
role: i,
|
|
24
|
+
setUserInfo: (s) => {
|
|
25
|
+
r.value = s;
|
|
26
|
+
},
|
|
27
|
+
setToken: (s) => {
|
|
28
|
+
t.value = s, e.value = !0;
|
|
29
|
+
},
|
|
30
|
+
setDict: (s) => {
|
|
31
|
+
o.value = s;
|
|
32
|
+
},
|
|
33
|
+
setRole: (s) => {
|
|
34
|
+
i.value = s;
|
|
35
|
+
},
|
|
36
|
+
clearAuth: () => {
|
|
37
|
+
t.value = null, r.value = null, o.value = void 0, i.value = [], e.value = !1;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
persist: {
|
|
43
|
+
pick: ["hasAuthenticated", "token", "userInfo", "dict"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
), n = [];
|
|
47
|
+
for (let e = 0; e < 256; ++e)
|
|
48
|
+
n.push((e + 256).toString(16).slice(1));
|
|
49
|
+
function f(e, t = 0) {
|
|
50
|
+
return (n[e[t + 0]] + n[e[t + 1]] + n[e[t + 2]] + n[e[t + 3]] + "-" + n[e[t + 4]] + n[e[t + 5]] + "-" + n[e[t + 6]] + n[e[t + 7]] + "-" + n[e[t + 8]] + n[e[t + 9]] + "-" + n[e[t + 10]] + n[e[t + 11]] + n[e[t + 12]] + n[e[t + 13]] + n[e[t + 14]] + n[e[t + 15]]).toLowerCase();
|
|
51
|
+
}
|
|
52
|
+
let l;
|
|
53
|
+
const g = new Uint8Array(16);
|
|
54
|
+
function b() {
|
|
55
|
+
if (!l) {
|
|
56
|
+
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
57
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
58
|
+
l = crypto.getRandomValues.bind(crypto);
|
|
59
|
+
}
|
|
60
|
+
return l(g);
|
|
61
|
+
}
|
|
62
|
+
const U = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), p = { randomUUID: U };
|
|
63
|
+
function k(e, t, r) {
|
|
64
|
+
e = e || {};
|
|
65
|
+
const o = e.random ?? e.rng?.() ?? b();
|
|
66
|
+
if (o.length < 16)
|
|
67
|
+
throw new Error("Random bytes length must be >= 16");
|
|
68
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, f(o);
|
|
69
|
+
}
|
|
70
|
+
function S(e, t, r) {
|
|
71
|
+
return p.randomUUID && !e ? p.randomUUID() : k(e);
|
|
72
|
+
}
|
|
73
|
+
const x = d(
|
|
74
|
+
"@jnrs/vue-core/pinia:menu",
|
|
75
|
+
() => {
|
|
76
|
+
const e = u(!1), t = u([]), r = async (a) => {
|
|
77
|
+
if (e.value)
|
|
78
|
+
return t.value;
|
|
79
|
+
o(a), t.value = a, e.value = !0;
|
|
80
|
+
try {
|
|
81
|
+
await v(t.value);
|
|
82
|
+
} catch (c) {
|
|
83
|
+
throw c;
|
|
84
|
+
}
|
|
85
|
+
return t.value;
|
|
86
|
+
}, o = (a) => {
|
|
87
|
+
for (const c of a)
|
|
88
|
+
c.meta.uuid = S(), c.children && o(c.children);
|
|
89
|
+
};
|
|
90
|
+
return { hasFetchedAsyncMenus: e, menus: t, asyncSetMenus: r, clearMenu: () => {
|
|
91
|
+
e.value = !1, t.value = [];
|
|
92
|
+
} };
|
|
93
|
+
}
|
|
94
|
+
// {
|
|
95
|
+
// persist: {
|
|
96
|
+
// pick: ['menus']
|
|
97
|
+
// }
|
|
98
|
+
// }
|
|
99
|
+
);
|
|
100
|
+
console.log(
|
|
101
|
+
"%c✨ 欢迎使用 @jnrs/vue-core/pinia",
|
|
102
|
+
'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
|
|
103
|
+
);
|
|
104
|
+
const T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
105
|
+
__proto__: null,
|
|
106
|
+
useAuthStore: h,
|
|
107
|
+
useMenuStore: x,
|
|
108
|
+
useMockStore: y,
|
|
109
|
+
useSystemStore: m
|
|
110
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
111
|
+
export {
|
|
112
|
+
h as a,
|
|
113
|
+
x as b,
|
|
114
|
+
T as i,
|
|
115
|
+
y as u
|
|
116
|
+
};
|
|
@@ -4,24 +4,18 @@ const h = {
|
|
|
4
4
|
routes: []
|
|
5
5
|
};
|
|
6
6
|
let n, s, i, m;
|
|
7
|
-
const f = ({
|
|
8
|
-
options: o,
|
|
9
|
-
fileModules: t,
|
|
10
|
-
layoutName: e,
|
|
11
|
-
globalComponent: a,
|
|
12
|
-
handleBeforeEach: r
|
|
13
|
-
}) => (s = t, e && (i = e), a && (m = a), n = d({ ...h, ...o }), n.beforeEach(
|
|
7
|
+
const f = ({ options: o, fileModules: t, layoutName: e, globalComponent: a, handleBeforeEach: r }) => (s = t, e && (i = e), a && (m = a), n = d({ ...h, ...o }), n.beforeEach(
|
|
14
8
|
async (c, u) => r?.(c, u)
|
|
15
9
|
), n), g = async (o, t = "push") => {
|
|
16
10
|
try {
|
|
17
11
|
return await n[t](o);
|
|
18
12
|
} catch (e) {
|
|
19
|
-
console.warn(`router.${t} 失败`, {
|
|
13
|
+
n[t]({ name: "404" }), console.warn(`router.${t} 失败`, {
|
|
20
14
|
code: "ROUTER_NOT_MATCH",
|
|
21
15
|
message: "未匹配到有效路由",
|
|
22
16
|
error: o || e,
|
|
23
17
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
24
|
-
})
|
|
18
|
+
});
|
|
25
19
|
}
|
|
26
20
|
}, _ = (o) => s[`/src/views${o}.vue`], l = async (o, t) => {
|
|
27
21
|
for (const e of o) {
|
package/dist/index.d.ts
CHANGED