@pubinfo/core 2.0.0-beta.15 → 2.0.0-beta.17

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 (40) hide show
  1. package/dist/{AppSetting-jAFvWPf_.js → AppSetting-DodCOb_z.js} +16 -16
  2. package/dist/{HCheckList.vue_vue_type_script_setup_true_lang-03vNFTY7.js → HCheckList.vue_vue_type_script_setup_true_lang-CMOw56Mk.js} +2 -2
  3. package/dist/{PreferencesContent-BKospVVk.js → PreferencesContent-Dic24ifo.js} +4 -4
  4. package/dist/{SettingBreadcrumb-B-MGqvCL.js → SettingBreadcrumb-DWpbGcSy.js} +2 -2
  5. package/dist/{SettingCopyright-DJYD0pRt.js → SettingCopyright-CIY0pFMT.js} +1 -1
  6. package/dist/{SettingEnableTransition-CbigI-kJ.js → SettingEnableTransition-f0xuLIrZ.js} +1 -1
  7. package/dist/{SettingHome-srwYPPUa.js → SettingHome-BFtJsJsN.js} +1 -1
  8. package/dist/{SettingMenu-6cFfXyh6.js → SettingMenu-DuPD3iSG.js} +2 -2
  9. package/dist/{SettingMode-DCVZHznZ.js → SettingMode-nZ65qSWK.js} +1 -1
  10. package/dist/{SettingNavSearch-8SpKAVyw.js → SettingNavSearch-CrarPE7d.js} +1 -1
  11. package/dist/{SettingOther-BcYQ2Ed7.js → SettingOther-BddvExCF.js} +1 -1
  12. package/dist/{SettingPage-obBObHeU.js → SettingPage-C6Na8HEN.js} +1 -1
  13. package/dist/{SettingTabbar-BsGbQ-D2.js → SettingTabbar-nuwfRRaE.js} +2 -2
  14. package/dist/{SettingThemes-m8f3gPn2.js → SettingThemes-DBq6j0zt.js} +2 -2
  15. package/dist/{SettingToolbar-WmyCi6TX.js → SettingToolbar-BdizZaGF.js} +1 -1
  16. package/dist/{SettingTopbar-bBmoKC9Z.js → SettingTopbar-D5BX5vS_.js} +2 -2
  17. package/dist/{SettingWidthMode-B1OdsVl5.js → SettingWidthMode-CHrLW3gs.js} +1 -1
  18. package/dist/{TopThinMode-D4d9RmKt.js → TopThinMode-CttqTmaT.js} +1 -1
  19. package/dist/{_...all_-D6gpCuEL.js → _...all_--d4S-8dL.js} +1 -1
  20. package/dist/{colors-C5Ze8zIC.js → colors-BOKDjZQI.js} +1 -1
  21. package/dist/context.d.ts +1 -1
  22. package/dist/{index-B-J9tu40.js → index-B0i20hau.js} +2 -2
  23. package/dist/{index-BP62vA7t.js → index-Bz9lh14R.js} +2 -2
  24. package/dist/{index-CMTmyz7f.js → index-CC3GE307.js} +3 -3
  25. package/dist/{index-BSzSj0b3.js → index-Cf8yM5Cv.js} +4 -4
  26. package/dist/{index-DQbvPQCH.js → index-Cygbc-66.js} +4 -4
  27. package/dist/{index-CAoR4_8l.js → index-D0CMv5FJ.js} +1561 -1561
  28. package/dist/{index-DQlWenum.js → index-DORROKh7.js} +57 -62
  29. package/dist/{index-B2C38hfC.js → index-DltN2SCZ.js} +2 -2
  30. package/dist/{index-SGumP-Y7.js → index-dPREgrj8.js} +1 -1
  31. package/dist/index.js +4 -4
  32. package/dist/{index.vue_vue_type_style_index_0_scoped_fa1c6ee4_lang--zsKN-Gh.js → index.vue_vue_type_style_index_0_scoped_fa1c6ee4_lang-Bmtn9Oo4.js} +1 -1
  33. package/dist/{menu-x8H6Akde.js → menu-Ddxel9ck.js} +1819 -1811
  34. package/dist/{pick-DMuBL1OS.js → pick-DEgsMKda.js} +1 -1
  35. package/dist/request.js +1 -1
  36. package/package.json +3 -3
  37. package/src/context.ts +1 -2
  38. package/src/layout/components/Header/TopMode/index.vue +12 -16
  39. package/src/stores/modules/menu.ts +24 -1
  40. package/src/utils/watermark.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { c3 as u, c4 as f, c5 as l, c6 as o, c7 as k } from "./menu-x8H6Akde.js";
1
+ import { c3 as u, c4 as f, c5 as l, c6 as o, c7 as k } from "./menu-Ddxel9ck.js";
2
2
  function v(n, r, s) {
3
3
  for (var a = -1, c = r.length, t = {}; ++a < c; ) {
4
4
  var e = r[a], i = u(n, e);
package/dist/request.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createAlova as et } from "alova";
2
2
  import { createServerTokenAuthentication as tt } from "alova/client";
3
3
  import nt from "alova/vue";
4
- import { u as ue, $ as rt, e as Ne } from "./menu-x8H6Akde.js";
4
+ import { u as ue, $ as rt, e as Ne } from "./menu-Ddxel9ck.js";
5
5
  import "pinia-plugin-persistedstate";
6
6
  import "vue";
7
7
  const Y = "undefined", st = void 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/core",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.15",
4
+ "version": "2.0.0-beta.17",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "vue": "^3.5.13",
29
29
  "vue-i18n": "^10.0.5",
30
30
  "vue-router": "^4.5.0",
31
- "@pubinfo/config": "2.0.0-beta.15"
31
+ "@pubinfo/config": "2.0.0-beta.17"
32
32
  },
33
33
  "dependencies": {
34
34
  "@alova/adapter-axios": "^2.0.13",
@@ -85,7 +85,7 @@
85
85
  "vue": "^3.5.13",
86
86
  "vue-i18n": "^10.0.5",
87
87
  "vue-router": "^4.5.0",
88
- "@pubinfo/config": "2.0.0-beta.15"
88
+ "@pubinfo/config": "2.0.0-beta.17"
89
89
  },
90
90
  "scripts": {
91
91
  "dev": "vite build -w -m watch",
package/src/context.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { Context } from './interface';
2
2
  import { createHooks } from 'hookable';
3
3
  import { auth, basic } from 'pubinfo:project/api/request';
4
- import layout from 'pubinfo:project/layouts/index.vue';
5
4
 
6
5
  export const hooks = createHooks();
7
6
 
@@ -24,7 +23,7 @@ export function usePubinfoContext() {
24
23
  */
25
24
  export function readProject() {
26
25
  return {
27
- layout,
26
+ layout: () => import('pubinfo:project/layouts/index.vue'),
28
27
  request: { auth, basic },
29
28
  };
30
29
  }
@@ -31,8 +31,6 @@ const menuRef = ref<HTMLElement | null>();
31
31
  const { width } = useElementSize(menuRef);
32
32
  const menuHideIndex = ref(0);
33
33
 
34
- watchMenuItem();
35
-
36
34
  const moreApple = computed(() => {
37
35
  return menuHideIndex.value === menuStore.allMenus.length - 1;
38
36
  });
@@ -42,19 +40,6 @@ function moreApplyClick(index: number, item: Menu.recordMainRaw) {
42
40
  switchTo(menuIndex, item);
43
41
  }
44
42
 
45
- function watchMenuItem() {
46
- onMounted(() => {
47
- watch(
48
- width,
49
- () => {
50
- menuHideIndex.value = fitMenus();
51
- },
52
- {
53
- immediate: true,
54
- });
55
- });
56
- }
57
-
58
43
  // 计算顶部菜单宽度
59
44
  function fitMenus() {
60
45
  const containerRoot = menuRef.value!;
@@ -89,6 +74,17 @@ function fitMenus() {
89
74
 
90
75
  return restrictedIndex;
91
76
  }
77
+
78
+ onMounted(() => {
79
+ watch(
80
+ width,
81
+ () => {
82
+ menuHideIndex.value = fitMenus();
83
+ },
84
+ {
85
+ immediate: true,
86
+ });
87
+ });
92
88
  </script>
93
89
 
94
90
  <template>
@@ -99,7 +95,7 @@ function fitMenus() {
99
95
  [`menu-active-${settingsStore.settings.menu.menuActiveStyle}`]: settingsStore.settings.menu.menuActiveStyle !== '',
100
96
  }"
101
97
  >
102
- <template v-for="(item, index) in menuStore.allMenus" :key="index">
98
+ <template v-for="(item, index) in menuStore.allMenus" :key="item?.meta?.title || index">
103
99
  <div
104
100
  class="menu-item relative transition-all"
105
101
  invisible
@@ -185,13 +185,36 @@ const useMenuStore = defineStore(
185
185
  }
186
186
  else {
187
187
  // 如果是 string 类型,则认为是路由,需要查找对应的主导航索引
188
- const findIndex = allMenus.value.findIndex(item => item.children.some(r => data.indexOf(`${r.path}/`) === 0 || data === r.path));
188
+ const findIndex = findRootIndexByPath(allMenus.value, data);
189
189
  if (findIndex >= 0) {
190
190
  actived.value = findIndex;
191
191
  }
192
192
  }
193
193
  }
194
194
 
195
+ /**
196
+ * 根据路径查找主导航索引
197
+ */
198
+ function findRootIndexByPath(routes: Menu.recordRaw[], targetPath: string) {
199
+ function containsPath(route: Menu.recordRaw): boolean {
200
+ if (route.path === targetPath) {
201
+ return true;
202
+ }
203
+ if (route.children) {
204
+ return route.children.some(child => containsPath(child));
205
+ }
206
+ return false;
207
+ }
208
+
209
+ for (let i = 0; i < routes.length; i++) {
210
+ if (containsPath(routes[i])) {
211
+ return i;
212
+ }
213
+ }
214
+
215
+ return 0;
216
+ }
217
+
195
218
  return {
196
219
  menus,
197
220
  actived,
@@ -68,7 +68,7 @@ export default function wmFn() {
68
68
  parent_width: 0,
69
69
  parent_height: 0,
70
70
  parent_node: null,
71
- monitor: true,
71
+ monitor: false,
72
72
  };
73
73
  let forceRemove = false;
74
74
  const watermarkDom = new MutationObserver(domChangeCallback);