@pubinfo/core 2.0.15 → 2.1.1
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/{AppSetting-CF0Y36Kx.js → AppSetting-CmT5_15W.js} +17 -17
- package/dist/{HCheckList.vue_vue_type_script_setup_true_lang-B7ZyR4n6.js → HCheckList.vue_vue_type_script_setup_true_lang-CHzkJth7.js} +1 -1
- package/dist/{HToggle-Dap0xf8L.js → HToggle-DpDYLh8y.js} +1 -1
- package/dist/HeaderThinMenu-D6jF8yl1.js +4 -0
- package/dist/{PreferencesContent-DWHQ2EOo.js → PreferencesContent-AXqWatOF.js} +6 -6
- package/dist/{SettingBreadcrumb-P-C21e5U.js → SettingBreadcrumb-CBWdS_nO.js} +3 -3
- package/dist/{SettingCopyright-XUQuMUND.js → SettingCopyright-D5Jhdu1J.js} +2 -2
- package/dist/{SettingEnableTransition-hJTXOtuP.js → SettingEnableTransition-DQJozSZH.js} +2 -2
- package/dist/{SettingHome-1C9Ph1Dl.js → SettingHome-DAwn9Ypx.js} +3 -3
- package/dist/{SettingMenu-B2h4e61Z.js → SettingMenu-DEQRAtWl.js} +4 -4
- package/dist/{SettingMode-bStWvnHg.js → SettingMode-bh3I8UBZ.js} +1 -1
- package/dist/{SettingNavSearch-BvTlahqj.js → SettingNavSearch-iYc-eRzY.js} +3 -3
- package/dist/{SettingOther-ihHycIPn.js → SettingOther-C2TS6okv.js} +3 -3
- package/dist/{SettingPage-d8HGOfhZ.js → SettingPage-B2_SNyn5.js} +2 -2
- package/dist/{SettingTabbar-YLshyP8G.js → SettingTabbar-BETdKJxz.js} +6 -6
- package/dist/{SettingThemes-Do-SwCzx.js → SettingThemes-ComNCP3P.js} +16 -15
- package/dist/{SettingToolbar-DHbr1d6B.js → SettingToolbar-D0DTBbbb.js} +3 -3
- package/dist/{SettingTopbar-QwqH9maD.js → SettingTopbar-BcO5Hcxm.js} +4 -4
- package/dist/{SettingWidthMode-CGmv4JQk.js → SettingWidthMode-wzTMq96A.js} +2 -2
- package/dist/built-in/devtools/index.d.ts +13 -0
- package/dist/built-in/index.d.ts +1 -0
- package/dist/built-in/layout-component/Layout.vue.d.ts +7 -1
- package/dist/built-in/layout-component/components/Topbar/index.vue.d.ts +1 -1
- package/dist/built-in/layout-component/composables/useLayoutVisible.d.ts +8 -0
- package/dist/built-in/layout-component/interface.d.ts +22 -0
- package/dist/built-in/pinia-plugin/plugins/persist.d.ts +2 -2
- package/dist/built-in/pinia-plugin/plugins/persistedstate/index.d.ts +3 -0
- package/dist/built-in/pinia-plugin/plugins/persistedstate/persistedstate.d.ts +15 -0
- package/dist/built-in/pinia-plugin/plugins/persistedstate/types.d.ts +150 -0
- package/dist/built-in/pinia-plugin/plugins/persistedstate/utils.d.ts +17 -0
- package/dist/core/ctx.d.ts +1 -0
- package/dist/core/interface.d.ts +26 -1
- package/dist/core/utils/index.d.ts +2 -0
- package/dist/features/composables/index.d.ts +1 -0
- package/dist/features/composables/partyLogin.d.ts +7 -1
- package/dist/features/stores/modules/settings.d.ts +6 -6
- package/dist/features/stores/modules/user.d.ts +14 -2
- package/dist/{index-WLA0JU4Y.js → index-6W8u4oWQ.js} +1 -1
- package/dist/{index-CEodMjIg.js → index-B9i7R1pn.js} +4 -5
- package/dist/{index-Ctu3_aXu.js → index-BXLF9xfN.js} +17666 -17025
- package/dist/{index-egA-td8O.js → index-C5X0cH7a.js} +3 -3
- package/dist/{index-Da79wYQP.js → index-CMSPnrUx.js} +1 -1
- package/dist/index-DSKHePRb.js +4 -0
- package/dist/{index-B8wbywmR.js → index-FATjHAwl.js} +1 -1
- package/dist/{index-B69sIuLj.js → index-_VKoUSGo.js} +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -12
- package/dist/{pick-BS5wr8z9.js → pick-BvMRfqim.js} +1 -1
- package/dist/{question-line-CfkciTFq.js → question-line-DCMVyZ3e.js} +2 -2
- package/dist/{right-Bfe2p1o0.js → right-aIVrXLnr.js} +4 -4
- package/dist/style.css +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/package.json +10 -9
- package/src/built-in/devtools/index.ts +292 -0
- package/src/built-in/index.ts +1 -0
- package/src/built-in/layout-component/Layout.vue +93 -9
- package/src/built-in/layout-component/components/Header/index.vue +4 -11
- package/src/built-in/layout-component/components/Sidebar/MainSidebar.vue +3 -1
- package/src/built-in/layout-component/components/Sidebar/SubSidebar.vue +4 -21
- package/src/built-in/layout-component/components/Topbar/index.vue +4 -105
- package/src/built-in/layout-component/composables/useLayoutVisible.ts +87 -0
- package/src/built-in/layout-component/interface.ts +25 -0
- package/src/built-in/pinia-plugin/index.ts +2 -2
- package/src/built-in/pinia-plugin/plugins/persist.ts +15 -4
- package/src/built-in/pinia-plugin/plugins/persistedstate/README.md +551 -0
- package/src/built-in/pinia-plugin/plugins/persistedstate/index.ts +3 -0
- package/src/built-in/pinia-plugin/plugins/persistedstate/persistedstate.ts +575 -0
- package/src/built-in/pinia-plugin/plugins/persistedstate/types.ts +162 -0
- package/src/built-in/pinia-plugin/plugins/persistedstate/utils.ts +46 -0
- package/src/core/create.ts +1 -3
- package/src/core/ctx.ts +24 -1
- package/src/core/interface.ts +31 -1
- package/src/core/request.ts +0 -1
- package/src/core/resolver/icon.ts +1 -1
- package/src/core/utils/index.ts +2 -0
- package/src/features/assets/styles/globals.css +2 -1
- package/src/features/composables/index.ts +1 -0
- package/src/features/composables/log.ts +3 -5
- package/src/features/composables/partyLogin.ts +180 -38
- package/src/features/context/index.ts +1 -1
- package/src/features/stores/modules/keepAlive.ts +10 -14
- package/src/features/stores/modules/settings.ts +2 -7
- package/src/features/stores/modules/user.ts +57 -2
- package/src/index.ts +9 -5
- package/src/utils/index.ts +0 -1
- package/src/utils/proxy.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/pinia.d.ts +94 -0
- package/types/vue-router.d.ts +7 -0
- package/dist/HeaderThinMenu-Bu4X2-vs.js +0 -4
- package/dist/index-ondkWqUz.js +0 -4
- /package/dist/{utils → core/utils}/global.d.ts +0 -0
- /package/dist/core/{utils.d.ts → utils/utils.d.ts} +0 -0
- /package/src/{utils → core/utils}/global.ts +0 -0
- /package/src/core/{utils.ts → utils/utils.ts} +0 -0
|
@@ -22,14 +22,13 @@ const useKeepAliveStore = defineStore(
|
|
|
22
22
|
if (isString(name)) {
|
|
23
23
|
return !list.value.includes(name) && list.value.push(name);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
useWarn(`KeepAlive 需要接受一个字符串或者字符串数组作为参数, 但是接受到了 ${typeof name} 类型`);
|
|
25
|
+
|
|
26
|
+
if (isArray(name)) {
|
|
27
|
+
name.forEach(_name => add(_name));
|
|
28
|
+
return;
|
|
32
29
|
}
|
|
30
|
+
|
|
31
|
+
useWarn(`KeepAlive 需要接受一个字符串或者字符串数组作为参数, 但是接受到了 ${typeof name} 类型`);
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
/**
|
|
@@ -39,14 +38,11 @@ const useKeepAliveStore = defineStore(
|
|
|
39
38
|
*/
|
|
40
39
|
function remove(name: string | string[]) {
|
|
41
40
|
if (isString(name)) {
|
|
42
|
-
list.value = list.value.filter(
|
|
43
|
-
return v !== name;
|
|
44
|
-
});
|
|
41
|
+
list.value = list.value.filter(v => v !== name);
|
|
45
42
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
43
|
+
|
|
44
|
+
if (isArray(name)) {
|
|
45
|
+
list.value = list.value.filter(v => !name.includes(v));
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
48
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RouteLocationNormalized, RouteMeta } from 'vue-router';
|
|
2
2
|
import { FrownOutlined } from '@ant-design/icons-vue';
|
|
3
|
-
import { usePreferredDark } from '@vueuse/core';
|
|
3
|
+
import { usePreferredDark, useToggle } from '@vueuse/core';
|
|
4
4
|
import { Modal } from 'ant-design-vue';
|
|
5
5
|
import { cloneDeep, defaultsDeep, get, isArray, isEmpty, isObject, reduce, set } from 'lodash-es';
|
|
6
6
|
import { defineStore } from 'pinia';
|
|
@@ -243,13 +243,8 @@ const useSettingsStore = defineStore(
|
|
|
243
243
|
settings.value.app.colorScheme = color;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
// 主页面是否最大化
|
|
247
|
-
const mainPageMaximizeStatus = ref(false);
|
|
248
|
-
|
|
249
246
|
// 切换当前主页面最大化
|
|
250
|
-
|
|
251
|
-
mainPageMaximizeStatus.value = value ?? !mainPageMaximizeStatus.value;
|
|
252
|
-
}
|
|
247
|
+
const [mainPageMaximizeStatus, setMainPageMaximize] = useToggle(false);
|
|
253
248
|
|
|
254
249
|
/**
|
|
255
250
|
* 更新配置
|
|
@@ -2,7 +2,7 @@ import type { AxiosRequestHeaders } from 'axios';
|
|
|
2
2
|
import type { ComputedRef } from 'vue';
|
|
3
3
|
import { find } from 'lodash-es';
|
|
4
4
|
import { defineStore } from 'pinia';
|
|
5
|
-
import { postAuthChangeLoginOrg, postAuthLogin } from '@/features/api/modules/auth';
|
|
5
|
+
import { postAuthChangeLoginOrg, postAuthLogin, postAuthLoginNew } from '@/features/api/modules/auth';
|
|
6
6
|
import { getRbacResourceGrantedResources, getRbacUserUserEntireInfo, putRbacUserChangePassword } from '@/features/api/modules/rbac';
|
|
7
7
|
import { usePubinfoContext } from '@/features/context';
|
|
8
8
|
import { publicKeyEncryption } from '@/utils';
|
|
@@ -24,7 +24,10 @@ export interface UserStore {
|
|
|
24
24
|
/** 获取用户权限码 */
|
|
25
25
|
getPermissions: () => Promise<string[]>
|
|
26
26
|
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* 登录
|
|
29
|
+
* @deprecated 请使用 `signIn` 方法替代
|
|
30
|
+
*/
|
|
28
31
|
login: (data: {
|
|
29
32
|
account: string
|
|
30
33
|
password: string
|
|
@@ -33,6 +36,16 @@ export interface UserStore {
|
|
|
33
36
|
loginType?: 'password' | string
|
|
34
37
|
}) => Promise<API.ResponseDataLoginTokenVo>
|
|
35
38
|
|
|
39
|
+
/** 登录 */
|
|
40
|
+
signIn: (data: {
|
|
41
|
+
account: string
|
|
42
|
+
password: string
|
|
43
|
+
captchas: string
|
|
44
|
+
captchaHash: string
|
|
45
|
+
loginType?: 'password' | string
|
|
46
|
+
captchaType?: string
|
|
47
|
+
}) => Promise<API.ResponseDataLoginTokenVo>
|
|
48
|
+
|
|
36
49
|
/** 登出 */
|
|
37
50
|
logout: () => void
|
|
38
51
|
|
|
@@ -96,6 +109,7 @@ const useUserStore = defineStore<STORE_NAME.USER, UserStore>(
|
|
|
96
109
|
|
|
97
110
|
/**
|
|
98
111
|
* 用户登录函数
|
|
112
|
+
* @deprecated 请使用 `signIn` 方法替代
|
|
99
113
|
* @param data 登录所需的数据
|
|
100
114
|
* @param data.account 账号
|
|
101
115
|
* @param data.password 密码
|
|
@@ -130,6 +144,46 @@ const useUserStore = defineStore<STORE_NAME.USER, UserStore>(
|
|
|
130
144
|
return result;
|
|
131
145
|
}
|
|
132
146
|
|
|
147
|
+
/**
|
|
148
|
+
* 用户登录函数
|
|
149
|
+
* @param data 登录所需的数据
|
|
150
|
+
* @param data.account 账号
|
|
151
|
+
* @param data.password 密码
|
|
152
|
+
* @param data.captchas 验证码
|
|
153
|
+
* @param data.captchaHash 验证码哈希值
|
|
154
|
+
* @param data.loginType 登录类型,默认为 'password'
|
|
155
|
+
* @param data.captchaType 验证类型
|
|
156
|
+
*/
|
|
157
|
+
async function signIn(data: {
|
|
158
|
+
account: string
|
|
159
|
+
password: string
|
|
160
|
+
captchas: string
|
|
161
|
+
captchaHash: string
|
|
162
|
+
loginType?: 'password' | string
|
|
163
|
+
captchaType?: string
|
|
164
|
+
}) {
|
|
165
|
+
const {
|
|
166
|
+
account: loginName,
|
|
167
|
+
password,
|
|
168
|
+
captchaHash: codeHash,
|
|
169
|
+
captchas: code,
|
|
170
|
+
loginType = 'password',
|
|
171
|
+
captchaType,
|
|
172
|
+
} = data;
|
|
173
|
+
const loginPwd = await publicKeyEncryption(password);
|
|
174
|
+
const result = await postAuthLoginNew({
|
|
175
|
+
loginType,
|
|
176
|
+
loginName,
|
|
177
|
+
loginPwd,
|
|
178
|
+
codeHash,
|
|
179
|
+
code,
|
|
180
|
+
captchaType,
|
|
181
|
+
});
|
|
182
|
+
const { accessToken, refreshToken } = result.data as Required<API.LoginTokenVo>;
|
|
183
|
+
setToken(accessToken, refreshToken);
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
|
|
133
187
|
/**
|
|
134
188
|
* 执行用户注销操作,并跳转到登录页面。
|
|
135
189
|
*/
|
|
@@ -231,6 +285,7 @@ const useUserStore = defineStore<STORE_NAME.USER, UserStore>(
|
|
|
231
285
|
getUserInfo,
|
|
232
286
|
getPermissions,
|
|
233
287
|
login,
|
|
288
|
+
signIn,
|
|
234
289
|
logout,
|
|
235
290
|
changePassword,
|
|
236
291
|
changeOrg,
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Options, RequestInstance } from './core';
|
|
|
2
2
|
import {
|
|
3
3
|
Authentication,
|
|
4
4
|
Authorization,
|
|
5
|
+
Devtools,
|
|
5
6
|
LayoutComponent,
|
|
6
7
|
NProgress,
|
|
7
8
|
PiniaPlugin,
|
|
@@ -75,6 +76,7 @@ export function createPubinfo(options: PubinfoOptions) {
|
|
|
75
76
|
NProgress(),
|
|
76
77
|
SystemInfo(),
|
|
77
78
|
...(options.modules ?? []),
|
|
79
|
+
Devtools(),
|
|
78
80
|
],
|
|
79
81
|
});
|
|
80
82
|
}
|
|
@@ -105,19 +107,21 @@ export {
|
|
|
105
107
|
readProjectModules,
|
|
106
108
|
} from './core';
|
|
107
109
|
export * from './core/interface';
|
|
110
|
+
export {
|
|
111
|
+
clearPersistedState,
|
|
112
|
+
createContext,
|
|
113
|
+
getPersistedState,
|
|
114
|
+
getPubinfoNamespace,
|
|
115
|
+
setPersistedState,
|
|
116
|
+
} from './core/utils';
|
|
108
117
|
|
|
109
118
|
export * from './features';
|
|
110
119
|
|
|
111
120
|
export {
|
|
112
121
|
cleanup,
|
|
113
122
|
cleanupWithoutUser,
|
|
114
|
-
clearPersistedState,
|
|
115
|
-
createContext,
|
|
116
123
|
createRawContext,
|
|
117
|
-
getPersistedState,
|
|
118
|
-
getPubinfoNamespace,
|
|
119
124
|
publicKeyEncryption,
|
|
120
|
-
setPersistedState,
|
|
121
125
|
storage,
|
|
122
126
|
wrapProxy,
|
|
123
127
|
} from './utils';
|
package/src/utils/index.ts
CHANGED
package/src/utils/proxy.ts
CHANGED
package/types/index.d.ts
CHANGED
package/types/pinia.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { StateTree } from 'pinia';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 持久化选项类型
|
|
5
|
+
*/
|
|
6
|
+
export type PersistenceOptions<State extends StateTree = StateTree> = Partial<{
|
|
7
|
+
/** 自定义存储键名 */
|
|
8
|
+
key: string
|
|
9
|
+
/** 存储实例 */
|
|
10
|
+
storage: {
|
|
11
|
+
getItem: (key: string) => string | null
|
|
12
|
+
setItem: (key: string, value: string) => void
|
|
13
|
+
}
|
|
14
|
+
/** 序列化器 */
|
|
15
|
+
serializer: {
|
|
16
|
+
serialize: (data: StateTree) => string
|
|
17
|
+
deserialize: (data: string) => StateTree
|
|
18
|
+
}
|
|
19
|
+
/** 是否开启调试模式 */
|
|
20
|
+
debug: boolean
|
|
21
|
+
/** 恢复数据前的钩子 */
|
|
22
|
+
beforeHydrate: (context: any) => void
|
|
23
|
+
/** 恢复数据后的钩子 */
|
|
24
|
+
afterHydrate: (context: any) => void
|
|
25
|
+
/** 要持久化的状态字段(白名单) */
|
|
26
|
+
pick: string[]
|
|
27
|
+
/** 不需要持久化的状态字段(黑名单) */
|
|
28
|
+
omit: string[]
|
|
29
|
+
/** 存储区域类型 */
|
|
30
|
+
storageArea: 'local' | 'session'
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 扩展 Pinia 的 Store 类型定义
|
|
35
|
+
*/
|
|
36
|
+
declare module 'pinia' {
|
|
37
|
+
/**
|
|
38
|
+
* 扩展 Store 实例,添加持久化相关方法
|
|
39
|
+
*/
|
|
40
|
+
export interface Store<Id extends string = string, S extends StateTree = StateTree, G = Record<string, unknown>, A = Record<string, unknown>> {
|
|
41
|
+
/**
|
|
42
|
+
* 手动持久化当前状态到存储
|
|
43
|
+
*/
|
|
44
|
+
$persist?: () => void
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 手动从存储恢复状态
|
|
48
|
+
* @param options - 恢复选项
|
|
49
|
+
*/
|
|
50
|
+
$hydrate?: (options?: { runHooks?: boolean }) => void
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 扩展 DefineStoreOptionsInPlugin,添加 persist 选项支持
|
|
55
|
+
* 适用于 Options API 风格和插件系统
|
|
56
|
+
*/
|
|
57
|
+
export interface DefineStoreOptionsInPlugin<Id extends string, S extends StateTree, G, A> {
|
|
58
|
+
/**
|
|
59
|
+
* 持久化配置
|
|
60
|
+
* - `true`: 启用默认持久化
|
|
61
|
+
* - `object`: 单个持久化配置
|
|
62
|
+
* - `array`: 多个持久化配置(可以将不同字段保存到不同存储)
|
|
63
|
+
*/
|
|
64
|
+
persist?: boolean | PersistenceOptions<S> | PersistenceOptions<S>[]
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 扩展 DefineSetupStoreOptions,添加 persist 选项支持
|
|
69
|
+
* 适用于 Setup 函数风格(defineStore 的第三个参数)
|
|
70
|
+
*/
|
|
71
|
+
export interface DefineSetupStoreOptions<Id extends string, S extends StateTree, G, A> {
|
|
72
|
+
/**
|
|
73
|
+
* 持久化配置
|
|
74
|
+
* - `true`: 启用默认持久化
|
|
75
|
+
* - `object`: 单个持久化配置
|
|
76
|
+
* - `array`: 多个持久化配置(可以将不同字段保存到不同存储)
|
|
77
|
+
*/
|
|
78
|
+
persist?: boolean | PersistenceOptions<S> | PersistenceOptions<S>[]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 扩展 DefineStoreOptions,添加 persist 选项支持
|
|
83
|
+
* 适用于 Options API 风格(defineStore 的第二个参数)
|
|
84
|
+
*/
|
|
85
|
+
export interface DefineStoreOptions<Id extends string, S extends StateTree, G, A> {
|
|
86
|
+
/**
|
|
87
|
+
* 持久化配置
|
|
88
|
+
* - `true`: 启用默认持久化
|
|
89
|
+
* - `object`: 单个持久化配置
|
|
90
|
+
* - `array`: 多个持久化配置(可以将不同字段保存到不同存储)
|
|
91
|
+
*/
|
|
92
|
+
persist?: boolean | PersistenceOptions<S> | PersistenceOptions<S>[]
|
|
93
|
+
}
|
|
94
|
+
}
|
package/types/vue-router.d.ts
CHANGED
|
@@ -29,7 +29,14 @@ export interface RouterMetaRawBaseOptions {
|
|
|
29
29
|
pin?: boolean
|
|
30
30
|
routeName?: string
|
|
31
31
|
id?: string | number
|
|
32
|
+
layout?: {
|
|
33
|
+
header?: boolean
|
|
34
|
+
sidebar?: boolean
|
|
35
|
+
tabs?: boolean
|
|
36
|
+
toolbar?: boolean
|
|
37
|
+
}
|
|
32
38
|
partyLogin?: PartyLoginStepConfig[]
|
|
39
|
+
custom?: any
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
type RouterMetaRaw = RequireExactlyOne<Partial<RouterMetaRawBaseOptions>, 'title'>;
|
package/dist/index-ondkWqUz.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|