@jnrs/vue-core 1.1.5 → 1.1.7

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
@@ -83,7 +87,14 @@ import { useAuthStore } from '@jnrs/vue-core/pinia'
83
87
 
84
88
  #### @jnrs/vue-core/components 模块
85
89
  Vue 组件
86
- - GlobalSetting 全局偏好设置
90
+ - GlobalSetting 全局偏好设置组件
91
+ - JnImageView 图片预览组件
92
+ ```ts
93
+ type PreviewSrcList = {
94
+ src: string
95
+ fileName: string
96
+ }
97
+ ```
87
98
 
88
99
  #### @jnrs/vue-core/composables 模块
89
100
  Vue 组合式 API
@@ -0,0 +1,21 @@
1
+ import { FileItem } from '@jnrs/shared';
2
+ interface JnImageViewProps {
3
+ /**
4
+ * 图片源地址,同原生属性一致
5
+ */
6
+ src?: string;
7
+ /**
8
+ * 开启图片预览功能
9
+ */
10
+ previewSrcList?: FileItem[];
11
+ /**
12
+ * 是否开启预览功能
13
+ */
14
+ preview?: boolean;
15
+ /**
16
+ * 图片最大高度
17
+ */
18
+ maxHeight?: string;
19
+ }
20
+ declare const _default: import('vue').DefineComponent<JnImageViewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<JnImageViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { FileItem } from '@jnrs/shared';
2
+ interface JnPdfViewProps {
3
+ /**
4
+ * 文件列表
5
+ */
6
+ fileList?: FileItem[];
7
+ /**
8
+ * 是否显示文件名
9
+ */
10
+ showFileName?: boolean;
11
+ /**
12
+ * 是否是 pdf 文件(pdf 文件直接预览,其他文件下载)
13
+ */
14
+ isPdf?: boolean;
15
+ /**
16
+ * 预览窗口宽度
17
+ */
18
+ windowWidth?: number;
19
+ /**
20
+ * 预览窗口高度
21
+ */
22
+ windowHeight?: number;
23
+ }
24
+ declare const _default: import('vue').DefineComponent<JnPdfViewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<JnPdfViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
25
+ export default _default;
@@ -1,2 +1,4 @@
1
1
  import { default as GlobalSetting } from './GlobalSetting.vue';
2
- export { GlobalSetting };
2
+ import { default as JnImageView } from './JnImageView.vue';
3
+ import { default as JnPdfView } from './JnPdfView.vue';
4
+ export { GlobalSetting, JnImageView, JnPdfView };
@@ -1,34 +1,45 @@
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({
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".globalSetting_item[data-v-85ebefe8]{margin-bottom:20px}.globalSetting_header{margin-bottom:0;padding-bottom:20px}.jnImageView[data-v-f05df144]{display:block;width:100%;height:100%}.jnImageView .jnImageView_error[data-v-f05df144]{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:.8em;line-height:1.1em;text-align:center;filter:opacity(.7)}.jn_image_view_icon[data-v-f05df144]:hover{color:var(--jnrs-color-primary);transform:scale(1.2);transition:all .3s ease}.jnFileView[data-v-d17155ca]{display:block;width:100%;height:100%;line-height:1em;cursor:pointer}.jnFileView:hover .jnFileView_btn[data-v-d17155ca]{color:var(--jnrs-color-primary)}.jnFileView .jnFileView_fileName[data-v-d17155ca]{font-size:.8em;color:var(--jnrs-font-primary-06);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.jnFileView .jnFileView_btn[data-v-d17155ca]{height:auto;padding:0;text-decoration:underline;font-size:.9em;transition:all .3s ease}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
+ import { defineComponent as y, ref as I, createBlock as k, openBlock as r, unref as e, withCtx as n, createElementVNode as v, createVNode as t, toDisplayString as m, isRef as L, createElementBlock as g, Fragment as C, renderList as p, createTextVNode as S, computed as O, normalizeStyle as P, createCommentVNode as E } from "vue";
3
+ import { storeToRefs as R } from "pinia";
4
+ import { ElDrawer as B, ElSwitch as D, ElRadioGroup as V, ElRadio as $, ElImage as F, ElIcon as f, ElButton as G } from "element-plus";
5
+ import { u as J, b as T, L as H, M, C as U } from "../index-KdP2kDTZ.js";
6
+ import { Back as z, Right as W, DArrowRight as A, ZoomOut as Z, ZoomIn as x, Switch as q, RefreshLeft as K, Refresh as Q, Download as X } from "@element-plus/icons-vue";
7
+ import { downloadByUrl as N } from "@jnrs/shared";
8
+ const Y = { class: "globalSetting_item" }, ee = { class: "globalSetting_item" }, le = { class: "globalSetting_item" }, te = { class: "globalSetting_item" }, oe = /* @__PURE__ */ y({
6
9
  __name: "GlobalSetting",
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), {
10
+ setup(o, { expose: w }) {
11
+ const { isMock: i } = R(J()), { theme: a, setLocale: c, setMode: s, setPrimaryColor: _ } = T(), h = I(!1);
12
+ return w({ handleShow: () => {
13
+ h.value = !0;
14
+ } }), (u, d) => (r(), k(e(B), {
12
15
  "header-class": "globalSetting_header",
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
+ modelValue: h.value,
17
+ "onUpdate:modelValue": d[4] || (d[4] = (l) => h.value = l),
18
+ title: u.$t("@jnrs/vue-core.components.GlobalSetting.title")
16
19
  }, {
17
- default: r(() => [
18
- u("div", N, [
19
- u("h4", null, s(a.$t("@jnrs/vue-core.components.GlobalSetting.language")), 1),
20
- _(l(C), {
21
- modelValue: l(o).locale,
22
- "onUpdate:modelValue": t[0] || (t[0] = (e) => l(o).locale = e),
23
- onChange: l(v)
20
+ default: n(() => [
21
+ v("div", Y, [
22
+ v("h4", null, m(u.$t("@jnrs/vue-core.components.GlobalSetting.isMockServer")), 1),
23
+ t(e(D), {
24
+ modelValue: e(i),
25
+ "onUpdate:modelValue": d[0] || (d[0] = (l) => L(i) ? i.value = l : null),
26
+ size: "small"
27
+ }, null, 8, ["modelValue"])
28
+ ]),
29
+ v("div", ee, [
30
+ v("h4", null, m(u.$t("@jnrs/vue-core.components.GlobalSetting.language")), 1),
31
+ t(e(V), {
32
+ modelValue: e(a).locale,
33
+ "onUpdate:modelValue": d[1] || (d[1] = (l) => e(a).locale = l),
34
+ onChange: e(c)
24
35
  }, {
25
- default: r(() => [
26
- (n(!0), c(S, null, b(l(G), (e) => (n(), d(l(V), {
27
- key: e.value,
28
- value: e.value
36
+ default: n(() => [
37
+ (r(!0), g(C, null, p(e(H), (l) => (r(), k(e($), {
38
+ key: l.value,
39
+ value: l.value
29
40
  }, {
30
- default: r(() => [
31
- f(s(a.$t(e.label)), 1)
41
+ default: n(() => [
42
+ S(m(u.$t(l.label)), 1)
32
43
  ]),
33
44
  _: 2
34
45
  }, 1032, ["value"]))), 128))
@@ -36,20 +47,20 @@ const N = { class: "globalSetting_item" }, j = { class: "globalSetting_item" },
36
47
  _: 1
37
48
  }, 8, ["modelValue", "onChange"])
38
49
  ]),
39
- u("div", j, [
40
- u("h4", null, s(a.$t("@jnrs/vue-core.components.GlobalSetting.theme")), 1),
41
- _(l(C), {
42
- modelValue: l(o).mode,
43
- "onUpdate:modelValue": t[1] || (t[1] = (e) => l(o).mode = e),
44
- onChange: l(g)
50
+ v("div", le, [
51
+ v("h4", null, m(u.$t("@jnrs/vue-core.components.GlobalSetting.theme")), 1),
52
+ t(e(V), {
53
+ modelValue: e(a).mode,
54
+ "onUpdate:modelValue": d[2] || (d[2] = (l) => e(a).mode = l),
55
+ onChange: e(s)
45
56
  }, {
46
- default: r(() => [
47
- (n(!0), c(S, null, b(l($), (e) => (n(), d(l(V), {
48
- key: e.value,
49
- value: e.value
57
+ default: n(() => [
58
+ (r(!0), g(C, null, p(e(M), (l) => (r(), k(e($), {
59
+ key: l.value,
60
+ value: l.value
50
61
  }, {
51
- default: r(() => [
52
- f(s(a.$t(e.label)), 1)
62
+ default: n(() => [
63
+ S(m(u.$t(l.label)), 1)
53
64
  ]),
54
65
  _: 2
55
66
  }, 1032, ["value"]))), 128))
@@ -57,20 +68,20 @@ const N = { class: "globalSetting_item" }, j = { class: "globalSetting_item" },
57
68
  _: 1
58
69
  }, 8, ["modelValue", "onChange"])
59
70
  ]),
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)
71
+ v("div", te, [
72
+ v("h4", null, m(u.$t("@jnrs/vue-core.components.GlobalSetting.primaryColor")), 1),
73
+ t(e(V), {
74
+ modelValue: e(a).primaryColor,
75
+ "onUpdate:modelValue": d[3] || (d[3] = (l) => e(a).primaryColor = l),
76
+ onChange: e(_)
66
77
  }, {
67
- default: r(() => [
68
- (n(!0), c(S, null, b(l(L), (e) => (n(), d(l(V), {
69
- key: e.value,
70
- value: e.value
78
+ default: n(() => [
79
+ (r(!0), g(C, null, p(e(U), (l) => (r(), k(e($), {
80
+ key: l.value,
81
+ value: l.value
71
82
  }, {
72
- default: r(() => [
73
- f(s(a.$t(e.label)), 1)
83
+ default: n(() => [
84
+ S(m(u.$t(l.label)), 1)
74
85
  ]),
75
86
  _: 2
76
87
  }, 1032, ["value"]))), 128))
@@ -82,12 +93,172 @@ const N = { class: "globalSetting_item" }, j = { class: "globalSetting_item" },
82
93
  _: 1
83
94
  }, 8, ["modelValue", "title"]));
84
95
  }
85
- }), P = (m, i) => {
86
- const o = m.__vccOpts || m;
87
- for (const [v, g] of i)
88
- o[v] = g;
89
- return o;
90
- }, M = /* @__PURE__ */ P(I, [["__scopeId", "data-v-b0382b1b"]]);
96
+ }), b = (o, w) => {
97
+ const i = o.__vccOpts || o;
98
+ for (const [a, c] of w)
99
+ i[a] = c;
100
+ return i;
101
+ }, ge = /* @__PURE__ */ b(oe, [["__scopeId", "data-v-85ebefe8"]]), ne = {
102
+ key: 0,
103
+ class: "jnImageView_error"
104
+ }, ae = { key: 1 }, ie = /* @__PURE__ */ y({
105
+ __name: "JnImageView",
106
+ props: {
107
+ src: { default: "" },
108
+ previewSrcList: { default: () => [] },
109
+ preview: { type: Boolean, default: !1 },
110
+ maxHeight: { default: "200px" }
111
+ },
112
+ setup(o) {
113
+ const w = O(() => o.src || o.previewSrcList[0]?.src || ""), i = (a) => {
114
+ const c = o.previewSrcList[a].src, s = o.previewSrcList[a].fileName;
115
+ N(c, s);
116
+ };
117
+ return (a, c) => (r(), k(e(F), {
118
+ class: "jnImageView",
119
+ style: P({ maxHeight: o.maxHeight }),
120
+ src: w.value,
121
+ "preview-teleported": "",
122
+ "preview-src-list": o.preview ? o.previewSrcList.map((s) => s.src) : [],
123
+ fit: "cover",
124
+ "show-progress": ""
125
+ }, {
126
+ error: n(() => [
127
+ w.value ? (r(), g("span", ne, m(a.$t("@jnrs/vue-core.components.JnImageView.noDisplay")), 1)) : (r(), g("span", ae, " "))
128
+ ]),
129
+ toolbar: n(({ actions: s, prev: _, next: h, reset: j, activeIndex: u, setActiveItem: d }) => [
130
+ t(e(f), {
131
+ class: "jn_image_view_icon",
132
+ onClick: _
133
+ }, {
134
+ default: n(() => [
135
+ t(e(z))
136
+ ]),
137
+ _: 1
138
+ }, 8, ["onClick"]),
139
+ t(e(f), {
140
+ class: "jn_image_view_icon",
141
+ onClick: h
142
+ }, {
143
+ default: n(() => [
144
+ t(e(W))
145
+ ]),
146
+ _: 1
147
+ }, 8, ["onClick"]),
148
+ t(e(f), {
149
+ class: "jn_image_view_icon",
150
+ onClick: (l) => d(o.previewSrcList.length - 1)
151
+ }, {
152
+ default: n(() => [
153
+ t(e(A))
154
+ ]),
155
+ _: 1
156
+ }, 8, ["onClick"]),
157
+ t(e(f), {
158
+ class: "jn_image_view_icon",
159
+ onClick: (l) => s("zoomOut")
160
+ }, {
161
+ default: n(() => [
162
+ t(e(Z))
163
+ ]),
164
+ _: 1
165
+ }, 8, ["onClick"]),
166
+ t(e(f), {
167
+ class: "jn_image_view_icon",
168
+ onClick: (l) => s("zoomIn", { enableTransition: !1, zoomRate: 2 })
169
+ }, {
170
+ default: n(() => [
171
+ t(e(x))
172
+ ]),
173
+ _: 1
174
+ }, 8, ["onClick"]),
175
+ t(e(f), {
176
+ class: "jn_image_view_icon",
177
+ onClick: (l) => s("clockwise", { rotateDeg: 180, enableTransition: !1 })
178
+ }, {
179
+ default: n(() => [
180
+ t(e(q))
181
+ ]),
182
+ _: 1
183
+ }, 8, ["onClick"]),
184
+ t(e(f), {
185
+ class: "jn_image_view_icon",
186
+ onClick: (l) => s("anticlockwise")
187
+ }, {
188
+ default: n(() => [
189
+ t(e(K))
190
+ ]),
191
+ _: 1
192
+ }, 8, ["onClick"]),
193
+ t(e(f), {
194
+ class: "jn_image_view_icon",
195
+ onClick: j
196
+ }, {
197
+ default: n(() => [
198
+ t(e(Q))
199
+ ]),
200
+ _: 1
201
+ }, 8, ["onClick"]),
202
+ t(e(f), {
203
+ class: "jn_image_view_icon",
204
+ onClick: (l) => i(u)
205
+ }, {
206
+ default: n(() => [
207
+ t(e(X))
208
+ ]),
209
+ _: 1
210
+ }, 8, ["onClick"])
211
+ ]),
212
+ _: 1
213
+ }, 8, ["style", "src", "preview-src-list"]));
214
+ }
215
+ }), _e = /* @__PURE__ */ b(ie, [["__scopeId", "data-v-f05df144"]]), se = ["title", "onClick"], re = {
216
+ key: 0,
217
+ class: "jnFileView_fileName"
218
+ }, ce = /* @__PURE__ */ y({
219
+ __name: "JnPdfView",
220
+ props: {
221
+ fileList: { default: () => [] },
222
+ showFileName: { type: Boolean, default: !0 },
223
+ isPdf: { type: Boolean, default: !1 },
224
+ windowWidth: { default: 800 },
225
+ windowHeight: { default: 600 }
226
+ },
227
+ setup(o) {
228
+ const w = (i) => {
229
+ if (o.isPdf) {
230
+ const s = screen.width / 2 - o.windowWidth / 2, _ = screen.height / 2 - o.windowHeight / 2;
231
+ return window.open(
232
+ i.src,
233
+ "_blank",
234
+ `left=${s},top=${_},width=${o.windowWidth},height=${o.windowHeight}`
235
+ );
236
+ }
237
+ const a = i.src, c = i.fileName;
238
+ N(a, c);
239
+ };
240
+ return (i, a) => (r(!0), g(C, null, p(o.fileList, (c, s) => (r(), g("div", {
241
+ class: "jnFileView",
242
+ key: s,
243
+ title: c.fileName,
244
+ onClick: (_) => w(c)
245
+ }, [
246
+ o.showFileName ? (r(), g("div", re, m(c.fileName), 1)) : E("", !0),
247
+ t(e(G), {
248
+ class: "jnFileView_btn",
249
+ type: "primary",
250
+ text: ""
251
+ }, {
252
+ default: n(() => [
253
+ S(m(o.isPdf ? i.$t("@jnrs/vue-core.components.JnPdfView.viewPDF") : i.$t("@jnrs/vue-core.components.JnPdfView.downloadFile")), 1)
254
+ ]),
255
+ _: 1
256
+ })
257
+ ], 8, se))), 128));
258
+ }
259
+ }), he = /* @__PURE__ */ b(ce, [["__scopeId", "data-v-d17155ca"]]);
91
260
  export {
92
- M as GlobalSetting
261
+ ge as GlobalSetting,
262
+ _e as JnImageView,
263
+ he as JnPdfView
93
264
  };
@@ -0,0 +1,201 @@
1
+ import "pinia-plugin-persistedstate";
2
+ import { defineStore as p } from "pinia";
3
+ import { ref as s, computed as k, watch as S } from "vue";
4
+ import { Fullscreen as j } from "@jnrs/shared";
5
+ import { usePreferredDark as O } from "@vueuse/core";
6
+ import { a as C } from "./index-Ci9uljtG.js";
7
+ const M = p(
8
+ "jnrs-app-mock",
9
+ () => ({ isMock: s(!1) }),
10
+ {
11
+ persist: {
12
+ pick: ["isMock"]
13
+ }
14
+ }
15
+ ), w = [
16
+ { value: "zhCn", label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.zhCn" },
17
+ { value: "en", label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.en" }
18
+ ], G = [
19
+ { value: "auto", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.auto" },
20
+ { value: "light", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.light" },
21
+ { value: "dark", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.dark" }
22
+ ], U = [
23
+ { value: "oklch(0.6 0.19 41)", label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jnrs" },
24
+ {
25
+ value: "oklch(0.51 0.21 264)",
26
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.azure"
27
+ },
28
+ {
29
+ value: "oklch(0.90 0.16 98)",
30
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.moonYellow"
31
+ },
32
+ { value: "oklch(0.63 0.25 27)", label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jdRed" },
33
+ {
34
+ value: "oklch(0.65 0.24 33)",
35
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.taobaoRed"
36
+ },
37
+ {
38
+ value: "oklch(0.61 0.20 261)",
39
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.dingtalkBlue"
40
+ },
41
+ {
42
+ value: "oklch(0.70 0.12 152)",
43
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.wechatGreen"
44
+ }
45
+ ];
46
+ function I(e) {
47
+ return e === "zhCn" || e === "en";
48
+ }
49
+ function x(e) {
50
+ return e === "light" || e === "dark" || e === "auto";
51
+ }
52
+ function L(e) {
53
+ return typeof e == "string" && e.trim() !== "";
54
+ }
55
+ const R = p(
56
+ "@jnrs/vue-core/pinia:system",
57
+ () => {
58
+ const e = s(!1), o = () => e.value = !e.value, a = new j(), n = s(!1), i = async () => {
59
+ await a.toggle(), n.value = a.isFullscreen();
60
+ }, l = s({
61
+ locale: w[0].value,
62
+ mode: G[0].value,
63
+ primaryColor: U[0].value
64
+ }), u = k(() => l.value.mode === "auto" ? d.value ? "dark" : "light" : l.value.mode), d = O();
65
+ return S(
66
+ [() => l.value.mode, d, () => l.value.primaryColor],
67
+ ([r, f, g]) => {
68
+ const m = document.documentElement;
69
+ m.classList.remove("light", "dark"), r === "auto" ? m.classList.add(f ? "dark" : "light") : m.classList.add(r), g ? m.style.setProperty("--jnrs-color-primary", g) : m.style.removeProperty("--jnrs-color-primary");
70
+ },
71
+ { immediate: !0 }
72
+ ), {
73
+ theme: l,
74
+ computedThemeMode: u,
75
+ menuCollapse: e,
76
+ documentFullscreen: n,
77
+ toggleCollapse: o,
78
+ toggleFullScreen: i,
79
+ setLocale: (r) => {
80
+ I(r) && (l.value.locale = r);
81
+ },
82
+ setMode: (r) => {
83
+ x(r) && (l.value.mode = r);
84
+ },
85
+ setPrimaryColor: (r) => {
86
+ L(r) && (l.value.primaryColor = r);
87
+ }
88
+ };
89
+ },
90
+ {
91
+ persist: {
92
+ pick: ["theme", "menuCollapse"]
93
+ }
94
+ }
95
+ ), D = p(
96
+ "@jnrs/vue-core/pinia:auth",
97
+ () => {
98
+ const e = s(!1), o = s(null), a = s(null), n = s(), i = s([]);
99
+ return {
100
+ hasAuthenticated: e,
101
+ token: o,
102
+ userInfo: a,
103
+ dict: n,
104
+ role: i,
105
+ setUserInfo: (c) => {
106
+ a.value = c;
107
+ },
108
+ setToken: (c) => {
109
+ o.value = c, e.value = !0;
110
+ },
111
+ setDict: (c) => {
112
+ n.value = c;
113
+ },
114
+ setRole: (c) => {
115
+ i.value = c;
116
+ },
117
+ clearAuth: () => {
118
+ o.value = null, a.value = null, n.value = void 0, i.value = [], e.value = !1;
119
+ }
120
+ };
121
+ },
122
+ {
123
+ persist: {
124
+ pick: ["hasAuthenticated", "token", "userInfo", "dict"]
125
+ }
126
+ }
127
+ ), t = [];
128
+ for (let e = 0; e < 256; ++e)
129
+ t.push((e + 256).toString(16).slice(1));
130
+ function P(e, o = 0) {
131
+ return (t[e[o + 0]] + t[e[o + 1]] + t[e[o + 2]] + t[e[o + 3]] + "-" + t[e[o + 4]] + t[e[o + 5]] + "-" + t[e[o + 6]] + t[e[o + 7]] + "-" + t[e[o + 8]] + t[e[o + 9]] + "-" + t[e[o + 10]] + t[e[o + 11]] + t[e[o + 12]] + t[e[o + 13]] + t[e[o + 14]] + t[e[o + 15]]).toLowerCase();
132
+ }
133
+ let v;
134
+ const T = new Uint8Array(16);
135
+ function A() {
136
+ if (!v) {
137
+ if (typeof crypto > "u" || !crypto.getRandomValues)
138
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
139
+ v = crypto.getRandomValues.bind(crypto);
140
+ }
141
+ return v(T);
142
+ }
143
+ const _ = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), h = { randomUUID: _ };
144
+ function z(e, o, a) {
145
+ e = e || {};
146
+ const n = e.random ?? e.rng?.() ?? A();
147
+ if (n.length < 16)
148
+ throw new Error("Random bytes length must be >= 16");
149
+ return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, P(n);
150
+ }
151
+ function E(e, o, a) {
152
+ return h.randomUUID && !e ? h.randomUUID() : z(e);
153
+ }
154
+ const F = p(
155
+ "@jnrs/vue-core/pinia:menu",
156
+ () => {
157
+ const e = s(!1), o = s([]), a = async (l) => {
158
+ if (e.value)
159
+ return o.value;
160
+ n(l), o.value = l, e.value = !0;
161
+ try {
162
+ await C(o.value);
163
+ } catch (u) {
164
+ throw u;
165
+ }
166
+ return o.value;
167
+ }, n = (l) => {
168
+ for (const u of l)
169
+ u.meta.uuid = E(), u.children && n(u.children);
170
+ };
171
+ return { hasFetchedAsyncMenus: e, menus: o, asyncSetMenus: a, clearMenu: () => {
172
+ e.value = !1, o.value = [];
173
+ } };
174
+ }
175
+ // {
176
+ // persist: {
177
+ // pick: ['menus']
178
+ // }
179
+ // }
180
+ );
181
+ console.log(
182
+ "%c✨ 欢迎使用 @jnrs/vue-core/pinia",
183
+ 'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
184
+ );
185
+ const J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
186
+ __proto__: null,
187
+ useAuthStore: D,
188
+ useMenuStore: F,
189
+ useMockStore: M,
190
+ useSystemStore: R
191
+ }, Symbol.toStringTag, { value: "Module" }));
192
+ export {
193
+ U as C,
194
+ w as L,
195
+ G as M,
196
+ D as a,
197
+ R as b,
198
+ F as c,
199
+ J as i,
200
+ M as u
201
+ };
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';