@jnrs/vue-core 1.1.2 → 1.1.3
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 +12 -3
- package/dist/components/GlobalSetting.vue.d.ts +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +122 -0
- package/dist/index-pLO4r50y.js +94 -0
- package/dist/index.js +1 -1
- package/dist/piniaStore/base/auth.d.ts +1 -1
- package/dist/piniaStore/base/menu.d.ts +2 -5
- package/dist/piniaStore/base/system.d.ts +45 -13
- package/dist/piniaStore/index.js +5 -4
- package/dist/system-DSegwP0Z.js +1644 -0
- package/dist/types/base.d.ts +0 -31
- package/package.json +11 -4
- package/dist/index-Bh-gM-SZ.js +0 -171
package/dist/types/base.d.ts
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
import { RouteMeta } from 'vue-router';
|
|
2
|
-
/**
|
|
3
|
-
* 用户信息
|
|
4
|
-
*/
|
|
5
|
-
export interface User {
|
|
6
|
-
id: number;
|
|
7
|
-
name: string;
|
|
8
|
-
account?: string;
|
|
9
|
-
role?: number;
|
|
10
|
-
jobTitle?: number;
|
|
11
|
-
workNo?: string;
|
|
12
|
-
workgroup?: null | string;
|
|
13
|
-
avatarFileName?: string;
|
|
14
|
-
loginDateTime?: string;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 字典
|
|
19
|
-
*/
|
|
20
|
-
export interface DictItem {
|
|
21
|
-
label: string;
|
|
22
|
-
value: string | number;
|
|
23
|
-
displayColor?: string;
|
|
24
|
-
sequence?: number;
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* 字典键值对
|
|
29
|
-
*/
|
|
30
|
-
export interface Dict {
|
|
31
|
-
[key: string]: DictItem[];
|
|
32
|
-
}
|
|
33
2
|
/**
|
|
34
3
|
* 定义菜单项接口
|
|
35
4
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jnrs/vue-core",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "巨能前端工程化开发,Vue
|
|
3
|
+
"version": "1.1.3",
|
|
4
|
+
"description": "巨能前端工程化开发,Vue 专用核心功能包。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jnrs",
|
|
7
7
|
"vue-core"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
19
|
"types": "dist/index.d.ts",
|
|
20
|
+
"sideEffects": true,
|
|
20
21
|
"files": [
|
|
21
22
|
"dist",
|
|
22
23
|
"README.md",
|
|
@@ -34,22 +35,28 @@
|
|
|
34
35
|
"./pinia": {
|
|
35
36
|
"import": "./dist/piniaStore/index.js",
|
|
36
37
|
"types": "./dist/piniaStore/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./components": {
|
|
40
|
+
"import": "./dist/components/index.js",
|
|
41
|
+
"types": "./dist/components/index.d.ts"
|
|
37
42
|
}
|
|
38
43
|
},
|
|
39
44
|
"peerDependencies": {
|
|
40
45
|
"@vueuse/core": "^14.1.0",
|
|
46
|
+
"element-plus": "^2.11.9",
|
|
41
47
|
"pinia": "^3.0.3",
|
|
42
48
|
"pinia-plugin-persistedstate": "^4.7.1",
|
|
43
49
|
"vue": "^3.5.22",
|
|
44
50
|
"vue-router": "^4.5.1",
|
|
45
|
-
"@jnrs/core": "1.1.
|
|
46
|
-
"@jnrs/shared": "1.1.
|
|
51
|
+
"@jnrs/core": "1.1.3",
|
|
52
|
+
"@jnrs/shared": "1.1.3"
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {
|
|
49
55
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
50
56
|
"rimraf": "^6.0.1",
|
|
51
57
|
"typescript": "^5.9.3",
|
|
52
58
|
"vite": "^7.1.7",
|
|
59
|
+
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
53
60
|
"vite-plugin-dts": "^4.5.4",
|
|
54
61
|
"vue-tsc": "^3.1.0"
|
|
55
62
|
},
|
package/dist/index-Bh-gM-SZ.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import "pinia-plugin-persistedstate";
|
|
2
|
-
import { ref as r } from "vue";
|
|
3
|
-
import { defineStore as i } from "pinia";
|
|
4
|
-
import { a as y } from "./index-DEkMXVh9.js";
|
|
5
|
-
class p {
|
|
6
|
-
// 默认全屏元素,可配置
|
|
7
|
-
defaultElement;
|
|
8
|
-
constructor(e) {
|
|
9
|
-
this.defaultElement = e || document.documentElement;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* 进入全屏
|
|
13
|
-
* @param element 可选,指定要全屏的元素
|
|
14
|
-
*/
|
|
15
|
-
async request(e) {
|
|
16
|
-
const o = e || this.defaultElement;
|
|
17
|
-
try {
|
|
18
|
-
await o.requestFullscreen({
|
|
19
|
-
navigationUI: "hide"
|
|
20
|
-
});
|
|
21
|
-
} catch (n) {
|
|
22
|
-
console.error("进入全屏失败:", n);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 退出全屏
|
|
27
|
-
*/
|
|
28
|
-
async exit() {
|
|
29
|
-
if (document.fullscreenElement)
|
|
30
|
-
try {
|
|
31
|
-
await document.exitFullscreen();
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.error("退出全屏失败:", e);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 切换全屏状态
|
|
38
|
-
* @param element 可选,指定要切换全屏的元素
|
|
39
|
-
*/
|
|
40
|
-
async toggle(e) {
|
|
41
|
-
document.fullscreenElement ? await this.exit() : await this.request(e);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* 判断当前是否处于全屏状态
|
|
45
|
-
* @returns boolean
|
|
46
|
-
*/
|
|
47
|
-
isFullscreen() {
|
|
48
|
-
return !!document.fullscreenElement;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* 设置默认全屏元素
|
|
52
|
-
* @param element 新的默认元素
|
|
53
|
-
*/
|
|
54
|
-
setDefaultElement(e) {
|
|
55
|
-
this.defaultElement = e;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* 获取当前全屏的元素(如果存在)
|
|
59
|
-
* @returns HTMLElement | null
|
|
60
|
-
*/
|
|
61
|
-
getFullscreenElement() {
|
|
62
|
-
return document.fullscreenElement;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const l = new p(), h = i(
|
|
66
|
-
"@jnrs/vue-core/pinia:system",
|
|
67
|
-
() => {
|
|
68
|
-
const t = r("zh-CN"), e = r("light"), o = r(!1), n = r(l.isFullscreen());
|
|
69
|
-
return { i18n: t, theme: e, menuCollapse: o, documentFullscreen: n, toggleCollapse: () => {
|
|
70
|
-
o.value = !o.value;
|
|
71
|
-
}, toggleFullScreen: async () => {
|
|
72
|
-
await l.toggle(), n.value = l.isFullscreen();
|
|
73
|
-
} };
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
persist: {
|
|
77
|
-
pick: ["i18n", "theme", "menuCollapse"]
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
), g = i(
|
|
81
|
-
"@jnrs/vue-core/pinia:auth",
|
|
82
|
-
() => {
|
|
83
|
-
const t = r(!1), e = r(), o = r(), n = r();
|
|
84
|
-
return {
|
|
85
|
-
hasAuthenticated: t,
|
|
86
|
-
token: e,
|
|
87
|
-
userInfo: o,
|
|
88
|
-
dict: n,
|
|
89
|
-
asyncSetAuth: async (s) => {
|
|
90
|
-
t.value = !0, s.token && (e.value = s.token), s.userInfo && (o.value = s.userInfo), s.dict && (n.value = s.dict);
|
|
91
|
-
},
|
|
92
|
-
asyncClearAuth: async () => {
|
|
93
|
-
t.value = !1, e.value = void 0, o.value = void 0, n.value = void 0;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
persist: {
|
|
99
|
-
pick: ["hasAuthenticated", "token", "userInfo", "dict"]
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
), u = [];
|
|
103
|
-
for (let t = 0; t < 256; ++t)
|
|
104
|
-
u.push((t + 256).toString(16).slice(1));
|
|
105
|
-
function v(t, e = 0) {
|
|
106
|
-
return (u[t[e + 0]] + u[t[e + 1]] + u[t[e + 2]] + u[t[e + 3]] + "-" + u[t[e + 4]] + u[t[e + 5]] + "-" + u[t[e + 6]] + u[t[e + 7]] + "-" + u[t[e + 8]] + u[t[e + 9]] + "-" + u[t[e + 10]] + u[t[e + 11]] + u[t[e + 12]] + u[t[e + 13]] + u[t[e + 14]] + u[t[e + 15]]).toLowerCase();
|
|
107
|
-
}
|
|
108
|
-
let a;
|
|
109
|
-
const f = new Uint8Array(16);
|
|
110
|
-
function b() {
|
|
111
|
-
if (!a) {
|
|
112
|
-
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
113
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
114
|
-
a = crypto.getRandomValues.bind(crypto);
|
|
115
|
-
}
|
|
116
|
-
return a(f);
|
|
117
|
-
}
|
|
118
|
-
const w = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), m = { randomUUID: w };
|
|
119
|
-
function S(t, e, o) {
|
|
120
|
-
t = t || {};
|
|
121
|
-
const n = t.random ?? t.rng?.() ?? b();
|
|
122
|
-
if (n.length < 16)
|
|
123
|
-
throw new Error("Random bytes length must be >= 16");
|
|
124
|
-
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, v(n);
|
|
125
|
-
}
|
|
126
|
-
function x(t, e, o) {
|
|
127
|
-
return m.randomUUID && !t ? m.randomUUID() : S(t);
|
|
128
|
-
}
|
|
129
|
-
const E = i(
|
|
130
|
-
"@jnrs/vue-core/pinia:menu",
|
|
131
|
-
() => {
|
|
132
|
-
const t = r(!1), e = r([]), o = async (c) => {
|
|
133
|
-
if (t.value)
|
|
134
|
-
return e.value;
|
|
135
|
-
n(c), e.value = c, t.value = !0;
|
|
136
|
-
try {
|
|
137
|
-
await y(e.value);
|
|
138
|
-
} catch (s) {
|
|
139
|
-
throw s;
|
|
140
|
-
}
|
|
141
|
-
return e.value;
|
|
142
|
-
}, n = (c) => {
|
|
143
|
-
for (const s of c)
|
|
144
|
-
s.meta.uuid = x(), s.children && n(s.children);
|
|
145
|
-
};
|
|
146
|
-
return { hasFetchedAsyncMenus: t, menus: e, asyncSetMenus: o, asyncClearMenu: () => {
|
|
147
|
-
t.value = !1, e.value = [];
|
|
148
|
-
} };
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
persist: {
|
|
152
|
-
pick: ["menus"]
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
console.log(
|
|
157
|
-
"%c✨ 欢迎使用 @jnrs/vue-core/pinia",
|
|
158
|
-
'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
|
|
159
|
-
);
|
|
160
|
-
const A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
161
|
-
__proto__: null,
|
|
162
|
-
useAuthStore: g,
|
|
163
|
-
useMenuStore: E,
|
|
164
|
-
useSystemStore: h
|
|
165
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
166
|
-
export {
|
|
167
|
-
g as a,
|
|
168
|
-
E as b,
|
|
169
|
-
A as i,
|
|
170
|
-
h as u
|
|
171
|
-
};
|