@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 CHANGED
@@ -32,6 +32,10 @@ import { useAuthStore } from '@jnrs/vue-core/pinia'
32
32
  - DictItem
33
33
  - Dict
34
34
  - MenuItem
35
+
36
+ 函数
37
+ - request 网络请求
38
+
35
39
  #### @jnrs/vue-core/pinia 模块
36
40
  函数
37
41
  ``` typescript
@@ -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-b18e046e]{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 c, ref as h, createBlock as r, openBlock as a, unref as l, withCtx as n, createElementVNode as u, createVNode as _, createElementBlock as g, Fragment as f, renderList as C, createTextVNode as V, toDisplayString as S } from "vue";
3
- import { ElDrawer as k, ElRadioGroup as p, ElRadio as b } from "element-plus";
4
- import { u as E, L as x, M as y, C as L } from "../system-C18uA6p7.js";
5
- const N = { class: "globalSetting_item" }, w = { class: "globalSetting_item" }, I = { class: "globalSetting_item" }, T = /* @__PURE__ */ c({
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(d, { expose: s }) {
8
- const { theme: o, setLocale: m, setMode: i, setCustomColor: O } = E(), v = h(!1);
9
- return s({ handleShow: () => {
10
- v.value = !0;
11
- } }), (D, t) => (a(), r(l(k), {
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: v.value,
14
- "onUpdate:modelValue": t[3] || (t[3] = (e) => v.value = 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: n(() => [
17
+ default: r(() => [
18
18
  u("div", N, [
19
- t[4] || (t[4] = u("h4", null, "语言", -1)),
20
- _(l(p), {
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(m)
23
+ onChange: l(v)
24
24
  }, {
25
- default: n(() => [
26
- (a(!0), g(f, null, C(l(x), (e) => (a(), r(l(b), {
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: n(() => [
31
- V(S(e.label), 1)
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", w, [
40
- t[5] || (t[5] = u("h4", null, "主题", -1)),
41
- _(l(p), {
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(i)
44
+ onChange: l(g)
45
45
  }, {
46
- default: n(() => [
47
- (a(!0), g(f, null, C(l(y), (e) => (a(), r(l(b), {
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: n(() => [
52
- V(S(e.label), 1)
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", I, [
61
- t[6] || (t[6] = u("h4", null, "强调色", -1)),
62
- _(l(p), {
63
- modelValue: l(o).customColor,
64
- "onUpdate:modelValue": t[2] || (t[2] = (e) => l(o).customColor = e),
65
- onChange: l(O)
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: n(() => [
68
- (a(!0), g(f, null, C(l(L), (e) => (a(), r(l(b), {
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: n(() => [
73
- V(S(e.label), 1)
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
- }), U = (d, s) => {
86
- const o = d.__vccOpts || d;
87
- for (const [m, i] of s)
88
- o[m] = i;
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
- }, R = /* @__PURE__ */ U(T, [["__scopeId", "data-v-b18e046e"]]);
90
+ }, M = /* @__PURE__ */ P(I, [["__scopeId", "data-v-b0382b1b"]]);
91
91
  export {
92
- R as GlobalSetting
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: "English";
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: "JNRS";
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
- }), n[t]({ name: "404" });
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
@@ -1,3 +1,4 @@
1
1
  export type * from './types/base';
2
2
  export * as vueRouter from './vueRouter/createVueRouter';
3
3
  export * as piniaStore from './piniaStore/index';
4
+ export { request } from './request/axios';