@pubinfo/core 2.0.3 → 2.0.5

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.
Files changed (64) hide show
  1. package/dist/{AppSetting-C-uQWp09.js → AppSetting-DXWLCrHK.js} +28 -28
  2. package/dist/{HCheckList.vue_vue_type_script_setup_true_lang-Dix75g7Y.js → HCheckList.vue_vue_type_script_setup_true_lang-CWeTAl9J.js} +1 -1
  3. package/dist/{HToggle-CkLtDSqB.js → HToggle-BrA8cCVJ.js} +1 -1
  4. package/dist/HeaderThinMenu-Be1Gkb6k.js +4 -0
  5. package/dist/{PreferencesContent-uLLIbpgi.js → PreferencesContent-6s6Bb66p.js} +42 -42
  6. package/dist/{SettingBreadcrumb-eOf8TqIs.js → SettingBreadcrumb-D7XUufYP.js} +5 -5
  7. package/dist/{SettingCopyright-DwaL1fDm.js → SettingCopyright-B1QA6f0R.js} +3 -3
  8. package/dist/{SettingEnableTransition-CBybF9vH.js → SettingEnableTransition-C1lccvKJ.js} +11 -11
  9. package/dist/{SettingHome-DZjnXioZ.js → SettingHome-DFzpduj_.js} +4 -4
  10. package/dist/{SettingMenu-BoDFUNC2.js → SettingMenu-BWVnHKmZ.js} +5 -5
  11. package/dist/{SettingMode-BjC403k0.js → SettingMode-CCYkyiJe.js} +3 -3
  12. package/dist/{SettingNavSearch-l7X-Iwjk.js → SettingNavSearch-CSboDt7O.js} +4 -4
  13. package/dist/{SettingOther-C07luGm-.js → SettingOther-CKje3ppW.js} +11 -11
  14. package/dist/{SettingPage-CpCp1Tnk.js → SettingPage-Cy5QBoiw.js} +2 -2
  15. package/dist/{SettingTabbar-BpvyU_8s.js → SettingTabbar-CPAGoX7H.js} +10 -10
  16. package/dist/{SettingThemes-BNqblNbu.js → SettingThemes-Cj8zHw81.js} +15 -15
  17. package/dist/{SettingToolbar-C-s6o0qU.js → SettingToolbar-By5fs_vK.js} +6 -6
  18. package/dist/{SettingTopbar-DlASsEm4.js → SettingTopbar-CMC03lzb.js} +5 -5
  19. package/dist/{SettingWidthMode-DUhpdqt0.js → SettingWidthMode-CsWVtIhX.js} +4 -4
  20. package/dist/built-in/layout-component/components/Header/HeaderMenu.vue.d.ts +2 -0
  21. package/dist/built-in/layout-component/components/Sidebar/index.vue.d.ts +3 -1
  22. package/dist/built-in/layout-component/composables/useGetComputedStyle.d.ts +1 -1
  23. package/dist/built-in/layout-component/index.d.ts +4 -1
  24. package/dist/{colors-DEL1DLxl.js → colors-PYwA9HeG.js} +1 -1
  25. package/dist/features/stores/utils/index.d.ts +0 -1
  26. package/dist/index-BJQN47v_.js +4 -0
  27. package/dist/{index-C5-BAU1l.js → index-C0MpeDJ4.js} +1 -1
  28. package/dist/{index-DoyP74bp.js → index-C0lnDzae.js} +2 -2
  29. package/dist/{index-Cl9ha8wq.js → index-C1gew7gA.js} +4 -4
  30. package/dist/{index-RctfGvXs.js → index-C54-r6zd.js} +2 -2
  31. package/dist/{index-CqRJBmZ2.js → index-CyPGB_nB.js} +2 -2
  32. package/dist/{index-DhzrIShp.js → index-DsXnRME_.js} +1 -1
  33. package/dist/{index-BC4fIMeo.js → index-KfXI3f5D.js} +2 -2
  34. package/dist/{index-Dm0Yz_my.js → index-rq5fCkC1.js} +29251 -28945
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +35 -34
  37. package/dist/{pick-BvpiopvO.js → pick-BtdlEifh.js} +1 -1
  38. package/dist/style.css +1 -1
  39. package/dist/utils/index.d.ts +1 -0
  40. package/dist/utils/publicKey.d.ts +4 -0
  41. package/package.json +5 -5
  42. package/src/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/index.vue +1 -1
  43. package/src/built-in/layout-component/components/Header/HeaderMenu.vue +19 -0
  44. package/src/built-in/layout-component/components/Header/{TopThinMode.vue → HeaderThinMenu.vue} +1 -1
  45. package/src/built-in/layout-component/components/Header/index.vue +2 -7
  46. package/src/built-in/layout-component/components/Sidebar/index.vue +7 -0
  47. package/src/built-in/layout-component/composables/useGetComputedStyle.ts +12 -9
  48. package/src/built-in/layout-component/index.ts +14 -0
  49. package/src/core/ctx.ts +1 -1
  50. package/src/core/resolver/icon.ts +1 -1
  51. package/src/features/stores/modules/user.ts +4 -4
  52. package/src/features/stores/utils/index.ts +0 -1
  53. package/src/index.ts +1 -0
  54. package/src/utils/index.ts +1 -0
  55. package/src/{features/stores/utils/crypto.ts → utils/publicKey.ts} +9 -10
  56. package/dist/TopThinMode-C4ENwLBo.js +0 -35
  57. package/dist/features/stores/utils/crypto.d.ts +0 -1
  58. package/dist/index-BAQ3G_yS.js +0 -272
  59. /package/dist/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/More.vue.d.ts +0 -0
  60. /package/dist/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/NotCursor.vue.d.ts +0 -0
  61. /package/dist/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/index.vue.d.ts +0 -0
  62. /package/dist/built-in/layout-component/components/Header/{TopThinMode.vue.d.ts → HeaderThinMenu.vue.d.ts} +0 -0
  63. /package/src/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/More.vue +0 -0
  64. /package/src/built-in/layout-component/components/Header/{TopMode → HeaderFullMenu}/NotCursor.vue +0 -0
@@ -2,5 +2,6 @@ export * from './cleanup';
2
2
  export * from './global';
3
3
  export * from './path';
4
4
  export * from './proxy';
5
+ export * from './publicKey';
5
6
  export * from './storage';
6
7
  export { createContext as createRawContext } from 'unctx';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 使用 `publicKey` 进行加密
3
+ */
4
+ export declare function publicKeyEncryption(content: string): Promise<string>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/core",
3
3
  "type": "module",
4
- "version": "2.0.3",
4
+ "version": "2.0.5",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -26,8 +26,8 @@
26
26
  "pinia": "^3.0.3",
27
27
  "vue": "^3.5.17",
28
28
  "vue-router": "^4.5.1",
29
- "@pubinfo/config": "2.0.3",
30
- "@pubinfo/vite": "2.0.3"
29
+ "@pubinfo/config": "2.0.5",
30
+ "@pubinfo/vite": "2.0.5"
31
31
  },
32
32
  "dependencies": {
33
33
  "@alova/adapter-axios": "^2.0.16",
@@ -85,8 +85,8 @@
85
85
  "vite-plugin-dts": "^4.5.4",
86
86
  "vue": "^3.5.17",
87
87
  "vue-router": "^4.5.1",
88
- "@pubinfo/config": "2.0.3",
89
- "@pubinfo/vite": "2.0.3"
88
+ "@pubinfo/config": "2.0.5",
89
+ "@pubinfo/vite": "2.0.5"
90
90
  },
91
91
  "scripts": {
92
92
  "dev": "vite build -w -m watch",
@@ -9,7 +9,7 @@ import More from './More.vue';
9
9
  import NotCursor from './NotCursor.vue';
10
10
 
11
11
  defineOptions({
12
- name: 'TopMode',
12
+ name: 'LayoutHeaderFullMenu',
13
13
  });
14
14
 
15
15
  const { settingsStore, menuStore, generateTitle } = useContext();
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ import { useContext } from '../../composables/useContext';
3
+
4
+ defineOptions({
5
+ name: 'LayoutHeaderMenu',
6
+ });
7
+
8
+ const HeaderFullMenu = defineAsyncComponent(() => import('./HeaderFullMenu/index.vue'));
9
+ const HeaderThinMenu = defineAsyncComponent(() => import('./HeaderThinMenu.vue'));
10
+
11
+ const { settingsStore } = useContext();
12
+ </script>
13
+
14
+ <template>
15
+ <!-- 顶部模式 -->
16
+ <HeaderFullMenu v-if="settingsStore.settings.menu.menuMode === 'head'" />
17
+ <!-- 顶部精简模式 -->
18
+ <HeaderThinMenu v-else-if="settingsStore.settings.menu.menuMode === 'only-head'" />
19
+ </template>
@@ -5,7 +5,7 @@ import Menu from '../Menu/index.vue';
5
5
  = Vue SFC Options 配置 =
6
6
  ============================================= */
7
7
  defineOptions({
8
- name: 'TopThinMode',
8
+ name: 'LayoutHeaderThinMenu',
9
9
  });
10
10
  /* =============================================
11
11
  = 逻辑代码 =
@@ -2,14 +2,12 @@
2
2
  import { useContext } from '../../composables/useContext';
3
3
  import Logo from '../Logo/index.vue';
4
4
  import Tools from '../Tools/index.vue';
5
+ import HeaderMenu from './HeaderMenu.vue';
5
6
 
6
7
  defineOptions({
7
8
  name: 'LayoutHeader',
8
9
  });
9
10
 
10
- const TopMode = defineAsyncComponent(() => import('./TopMode/index.vue'));
11
- const TopThinMode = defineAsyncComponent(() => import('./TopThinMode.vue'));
12
-
13
11
  const { settingsStore } = useContext();
14
12
  </script>
15
13
 
@@ -23,10 +21,7 @@ const { settingsStore } = useContext();
23
21
  </slot>
24
22
 
25
23
  <slot name="menu">
26
- <!-- 顶部模式 -->
27
- <TopMode v-if="settingsStore.settings.menu.menuMode === 'head'" />
28
- <!-- 顶部精简模式 -->
29
- <TopThinMode v-else-if="settingsStore.settings.menu.menuMode === 'only-head'" />
24
+ <HeaderMenu />
30
25
  </slot>
31
26
  </div>
32
27
 
@@ -1,10 +1,17 @@
1
1
  <script setup lang="ts">
2
+ import { useContext } from '../../composables/useContext';
2
3
  import MainSidebar from './MainSidebar.vue';
3
4
  import SubSidebar from './SubSidebar.vue';
4
5
 
5
6
  defineOptions({
6
7
  name: 'LayoutSidebar',
7
8
  });
9
+
10
+ const { settingsStore } = useContext();
11
+
12
+ defineExpose({
13
+ toggleSidebarCollapse: () => settingsStore.toggleSidebarCollapse(),
14
+ });
8
15
  </script>
9
16
 
10
17
  <template>
@@ -7,10 +7,10 @@ import { useContext } from './useContext';
7
7
  * @returns 样式属性值的整数形式
8
8
  */
9
9
  export function useGetComputedStyle(property: string, root: HTMLElement = document.documentElement) {
10
- return Number.parseInt(getComputedStyle(root).getPropertyValue(property));
10
+ return getComputedStyle(root).getPropertyValue(property).trim();
11
11
  }
12
12
 
13
- type unit = `${string}px`;
13
+ type unit = string;
14
14
 
15
15
  /**
16
16
  * 根据各种设置和条件计算主侧边栏和子侧边栏的实际宽度。
@@ -28,7 +28,7 @@ export function useGetSidebarActualWidth() {
28
28
  return '0px';
29
29
  }
30
30
  else {
31
- return `${useGetComputedStyle('--g-main-sidebar-width')}px`;
31
+ return useGetComputedStyle('--g-main-sidebar-width');
32
32
  }
33
33
  });
34
34
 
@@ -39,18 +39,18 @@ export function useGetSidebarActualWidth() {
39
39
  */
40
40
  const subSidebarActualWidth = computed<unit>(() => {
41
41
  let actualWidth = useGetComputedStyle('--g-sub-sidebar-width');
42
- const subSidebarActualWidth = settingsStore.settings.menu.subMenuCollapse;
42
+ const _subSidebarActualWidth = settingsStore.settings.menu.subMenuCollapse;
43
43
  const subMenuOnlyOneHide = settingsStore.settings.menu.subMenuOnlyOneHide;
44
44
  const menuMode = settingsStore.settings.menu.menuMode;
45
45
  const isMobile = settingsStore.mode !== 'mobile';
46
46
  const onlySideOrHead = ['only-side', 'only-head'].includes(menuMode);
47
47
 
48
- if (subSidebarActualWidth && isMobile) {
48
+ if (_subSidebarActualWidth && isMobile) {
49
49
  actualWidth = useGetComputedStyle('--g-sub-sidebar-collapse-width');
50
50
  }
51
51
 
52
52
  if (onlySideOrHead && isMobile) {
53
- actualWidth = 0;
53
+ actualWidth = '0px';
54
54
  }
55
55
  if (
56
56
  subMenuOnlyOneHide
@@ -60,10 +60,13 @@ export function useGetSidebarActualWidth() {
60
60
  || menuStore.sidebarMenus[0]?.children.every(item => item.meta?.sidebar === false)
61
61
  )
62
62
  ) {
63
- actualWidth = 0;
63
+ actualWidth = '0px';
64
64
  }
65
- return `${actualWidth}px`;
65
+ return actualWidth;
66
66
  });
67
67
 
68
- return { mainSidebarActualWidth, subSidebarActualWidth };
68
+ return {
69
+ mainSidebarActualWidth,
70
+ subSidebarActualWidth,
71
+ };
69
72
  }
@@ -6,7 +6,12 @@ import { defineSystemRoutes } from '@/features';
6
6
  import { Provider as LayoutProvider } from './provider';
7
7
  import Layout from './Layout.vue';
8
8
  import LayoutContent from './components/Content/index.vue';
9
+
9
10
  import LayoutHeader from './components/Header/index.vue';
11
+ import LayoutHeaderMenu from './components/Header/HeaderMenu.vue';
12
+ import LayoutHeaderFullMenu from './components/Header/HeaderFullMenu/index.vue';
13
+ import LayoutHeaderThinMenu from './components/Header/HeaderThinMenu.vue';
14
+
10
15
  import LayoutSidebar from './components/Sidebar/index.vue';
11
16
  import LayoutTopbar from './components/Topbar/index.vue';
12
17
 
@@ -71,6 +76,10 @@ export const Tool = {
71
76
 
72
77
  Layout.Provider = LayoutProvider;
73
78
  Layout.Header = LayoutHeader;
79
+ Layout.HeaderMenu = LayoutHeaderMenu;
80
+ Layout.HeaderFullMenu = LayoutHeaderFullMenu;
81
+ Layout.HeaderThinMenu = LayoutHeaderThinMenu;
82
+ Layout.Header = LayoutHeader;
74
83
  Layout.Content = LayoutContent;
75
84
  Layout.Sidebar = LayoutSidebar;
76
85
  Layout.Topbar = LayoutTopbar;
@@ -79,7 +88,12 @@ export {
79
88
  LayoutProvider,
80
89
  Layout,
81
90
  LayoutContent,
91
+
82
92
  LayoutHeader,
93
+ LayoutHeaderMenu,
94
+ LayoutHeaderFullMenu,
95
+ LayoutHeaderThinMenu,
96
+
83
97
  LayoutSidebar,
84
98
  LayoutTopbar,
85
99
 
package/src/core/ctx.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createHooks } from 'hookable';
2
- import { getPubinfoNamespace } from '@/utils';
2
+ import { getPubinfoNamespace } from '../utils/global';
3
3
 
4
4
  const HOOKS_KEY = '__pubinfo_core_hooks__';
5
5
  type HookStore = ReturnType<typeof createHooks>;
@@ -1,5 +1,5 @@
1
1
  import type { ModuleRecord } from './resolver';
2
- import { getPubinfoNamespace } from '@/utils';
2
+ import { getPubinfoNamespace } from '../../utils/global';
3
3
  import { loadProjectModules, readProjectModules } from './resolver';
4
4
 
5
5
  // 持久化图标模块,支持 HMR 后恢复
@@ -5,8 +5,8 @@ import { defineStore } from 'pinia';
5
5
  import { postAuthChangeLoginOrg, postAuthLogin } from '@/features/api/modules/auth';
6
6
  import { getRbacResourceGrantedResources, getRbacUserUserEntireInfo, putRbacUserChangePassword } from '@/features/api/modules/rbac';
7
7
  import { usePubinfoContext } from '@/features/context';
8
+ import { publicKeyEncryption } from '@/utils';
8
9
  import { STORE_NAME } from '../enum';
9
- import { getEncryptedData } from '../utils';
10
10
 
11
11
  export interface UserStore {
12
12
  /** 用户信息 */
@@ -117,7 +117,7 @@ const useUserStore = defineStore<STORE_NAME.USER, UserStore>(
117
117
  captchas: code,
118
118
  loginType = 'password',
119
119
  } = data;
120
- const loginPwd = await getEncryptedData(password);
120
+ const loginPwd = await publicKeyEncryption(password);
121
121
  const result = await postAuthLogin({
122
122
  loginType,
123
123
  loginName,
@@ -179,8 +179,8 @@ const useUserStore = defineStore<STORE_NAME.USER, UserStore>(
179
179
  if (form.token) {
180
180
  headers.authorization = form.token;
181
181
  }
182
- const encryptedOldpassword = await getEncryptedData(form.oldPassword);
183
- const encryptedNewpassword = await getEncryptedData(form.newPassword);
182
+ const encryptedOldpassword = await publicKeyEncryption(form.oldPassword);
183
+ const encryptedNewpassword = await publicKeyEncryption(form.newPassword);
184
184
  const res = await putRbacUserChangePassword({
185
185
  oldPassword: encryptedOldpassword,
186
186
  newPassword: encryptedNewpassword,
@@ -1,2 +1 @@
1
- export * from './crypto';
2
1
  export * from './routerHelper';
package/src/index.ts CHANGED
@@ -114,6 +114,7 @@ export {
114
114
  createRawContext,
115
115
  getPersistedState,
116
116
  getPubinfoNamespace,
117
+ publicKeyEncryption,
117
118
  setPersistedState,
118
119
  storage,
119
120
  wrapProxy,
@@ -2,5 +2,6 @@ export * from './cleanup';
2
2
  export * from './global';
3
3
  export * from './path';
4
4
  export * from './proxy';
5
+ export * from './publicKey';
5
6
  export * from './storage';
6
7
  export { createContext as createRawContext } from 'unctx';
@@ -7,18 +7,17 @@ function compilePublicKey(key: string) {
7
7
  return compiled({ publickKey: key });
8
8
  }
9
9
 
10
- async function getPem() {
11
- const { data } = await getAuthLoginKey();
12
- return compilePublicKey(data!);
10
+ async function getPublicKey() {
11
+ const res = await getAuthLoginKey();
12
+ return compilePublicKey(res.data ?? '');
13
13
  }
14
14
 
15
- async function encryptWithPublicKey(publicKey: string, data: string) {
15
+ /**
16
+ * 使用 `publicKey` 进行加密
17
+ */
18
+ export async function publicKeyEncryption(content: string) {
19
+ const publicKey = await getPublicKey();
16
20
  const encryptor = new JSEncrypt();
17
21
  encryptor.setPublicKey(publicKey);
18
- return encryptor.encrypt(data) as string;
19
- }
20
-
21
- export async function getEncryptedData(str: string) {
22
- const key = await getPem();
23
- return await encryptWithPublicKey(key, str);
22
+ return encryptor.encrypt(content) as string;
24
23
  }
@@ -1,35 +0,0 @@
1
- import { defineComponent as a, ref as l, createElementBlock as m, openBlock as i, withModifiers as c, createVNode as d, normalizeClass as f, unref as e } from "vue";
2
- import { bL as p, bT as _ } from "./index-Dm0Yz_my.js";
3
- import { useRoute as h } from "vue-router";
4
- const y = /* @__PURE__ */ a({
5
- name: "TopThinMode",
6
- __name: "TopThinMode",
7
- setup(v) {
8
- const o = h(), { settingsStore: n, menuStore: u } = p(), s = l();
9
- function r(t) {
10
- s.value.scrollBy({
11
- left: (t.deltaY || t.detail) > 0 ? 50 : -50
12
- });
13
- }
14
- return (t, M) => (i(), m("div", {
15
- ref_key: "menuRef",
16
- ref: s,
17
- class: "menu-container",
18
- onWheel: c(r, ["prevent"])
19
- }, [
20
- d(_, {
21
- menu: e(u).allMenus,
22
- value: e(o).meta.activeMenu || e(o).path,
23
- mode: "horizontal",
24
- "show-collapse-name": "",
25
- rounded: e(n).settings.menu.isRounded,
26
- class: f(["menu", {
27
- [`menu-active-${e(n).settings.menu.menuActiveStyle}`]: e(n).settings.menu.menuActiveStyle !== ""
28
- }])
29
- }, null, 8, ["menu", "value", "rounded", "class"])
30
- ], 544));
31
- }
32
- });
33
- export {
34
- y as default
35
- };
@@ -1 +0,0 @@
1
- export declare function getEncryptedData(str: string): Promise<string>;