@pubinfo/core 2.0.5 → 2.0.6

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 (53) hide show
  1. package/dist/{AppSetting-DXWLCrHK.js → AppSetting-Bn7vxkwu.js} +15 -15
  2. package/dist/{HCheckList.vue_vue_type_script_setup_true_lang-CWeTAl9J.js → HCheckList.vue_vue_type_script_setup_true_lang-CHx9ghjT.js} +6 -7
  3. package/dist/{HToggle-BrA8cCVJ.js → HToggle-CtjNyqPp.js} +1 -1
  4. package/dist/HeaderThinMenu-DOIRf9rF.js +4 -0
  5. package/dist/{PreferencesContent-6s6Bb66p.js → PreferencesContent-DesQ1gs9.js} +4 -4
  6. package/dist/{SettingBreadcrumb-D7XUufYP.js → SettingBreadcrumb-Dgz-kLlD.js} +3 -3
  7. package/dist/{SettingCopyright-B1QA6f0R.js → SettingCopyright-Bb_zsv8S.js} +2 -2
  8. package/dist/{SettingEnableTransition-C1lccvKJ.js → SettingEnableTransition-8Fk8bfQL.js} +2 -2
  9. package/dist/{SettingHome-DFzpduj_.js → SettingHome-KGLeBn-Y.js} +2 -2
  10. package/dist/{SettingMenu-BWVnHKmZ.js → SettingMenu-CbzwRzNT.js} +3 -3
  11. package/dist/{SettingMode-CCYkyiJe.js → SettingMode-C22EONZU.js} +1 -1
  12. package/dist/{SettingNavSearch-CSboDt7O.js → SettingNavSearch-ZEgspalS.js} +2 -2
  13. package/dist/{SettingOther-CKje3ppW.js → SettingOther-0MjVwrIi.js} +2 -2
  14. package/dist/{SettingPage-Cy5QBoiw.js → SettingPage-C-wDrzIC.js} +2 -2
  15. package/dist/{SettingTabbar-CPAGoX7H.js → SettingTabbar-IKM2fNxW.js} +3 -3
  16. package/dist/{SettingThemes-Cj8zHw81.js → SettingThemes-DybjcBGx.js} +1 -1
  17. package/dist/{SettingToolbar-By5fs_vK.js → SettingToolbar-fWSTNiLR.js} +2 -2
  18. package/dist/{SettingTopbar-CMC03lzb.js → SettingTopbar-ddg9ZhqJ.js} +3 -3
  19. package/dist/{SettingWidthMode-CsWVtIhX.js → SettingWidthMode-DPhge32Z.js} +1 -1
  20. package/dist/built-in/layout-component/Layout.vue.d.ts +1 -0
  21. package/dist/built-in/layout-component/index.d.ts +2 -1
  22. package/dist/{colors-PYwA9HeG.js → colors-Cw5YV1k2.js} +1 -1
  23. package/dist/features/components/index.d.ts +0 -1
  24. package/dist/{index-C54-r6zd.js → index-B4WU4ykx.js} +3 -3
  25. package/dist/{index-C0lnDzae.js → index-Bm6KmENu.js} +2 -2
  26. package/dist/{index-CyPGB_nB.js → index-BrB42sd5.js} +2 -2
  27. package/dist/{index-C0MpeDJ4.js → index-ClpIFmv2.js} +1 -1
  28. package/dist/{index-rq5fCkC1.js → index-Cq8mquS8.js} +7983 -8005
  29. package/dist/index-Cvhd8Wyw.js +4 -0
  30. package/dist/{index-KfXI3f5D.js → index-QidxqFx5.js} +2 -2
  31. package/dist/{index-C1gew7gA.js → index-n76z6PLD.js} +4 -4
  32. package/dist/{index-DsXnRME_.js → index-tnsLRhOC.js} +1 -1
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.js +1 -1
  35. package/dist/{pick-BtdlEifh.js → pick-CKgJFfA4.js} +1 -1
  36. package/dist/style.css +1 -1
  37. package/package.json +5 -5
  38. package/src/built-in/layout-component/Layout.vue +14 -2
  39. package/src/built-in/layout-component/components/Menu/index.vue +1 -1
  40. package/src/{features → built-in/layout-component}/components/NotAllowed/index.vue +2 -32
  41. package/src/built-in/layout-component/index.ts +2 -1
  42. package/src/features/components/PubinfoApp/index.vue +1 -14
  43. package/src/features/components/index.ts +0 -1
  44. package/src/features/settings/index.ts +1 -0
  45. package/src/features/stores/modules/menu.ts +2 -2
  46. package/src/features/stores/modules/route.ts +8 -3
  47. package/src/index.ts +1 -0
  48. package/types/settings.d.ts +6 -0
  49. package/dist/HeaderThinMenu-Be1Gkb6k.js +0 -4
  50. package/dist/index-BJQN47v_.js +0 -4
  51. /package/dist/{features → built-in/layout-component}/components/NotAllowed/index.vue.d.ts +0 -0
  52. /package/src/{features/components/NotAllowed/assets → built-in/layout-component/assets/images}/403.svg +0 -0
  53. /package/src/{features/components/NotAllowed/assets → built-in/layout-component/assets/images}/403_dark.svg +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/core",
3
3
  "type": "module",
4
- "version": "2.0.5",
4
+ "version": "2.0.6",
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.5",
30
- "@pubinfo/vite": "2.0.5"
29
+ "@pubinfo/config": "2.0.6",
30
+ "@pubinfo/vite": "2.0.6"
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.5",
89
- "@pubinfo/vite": "2.0.5"
88
+ "@pubinfo/config": "2.0.6",
89
+ "@pubinfo/vite": "2.0.6"
90
90
  },
91
91
  "scripts": {
92
92
  "dev": "vite build -w -m watch",
@@ -1,13 +1,15 @@
1
1
  <script setup lang="ts">
2
2
  import RiLogoutBoxLine from '~icons/ri/logout-box-line';
3
+ import { useAuth } from '@/features/composables';
3
4
  import BackTop from './components/BackTop/index.vue';
4
5
  import LayoutContent from './components/Content/index.vue';
5
6
  import Copyright from './components/Copyright/index.vue';
6
7
  import LayoutHeader from './components/Header/index.vue';
8
+ import NotAllowed from './components/NotAllowed/index.vue';
7
9
  import SettingBar from './components/SettingBar/index.vue';
8
10
  import LayoutSidebar from './components/Sidebar/index.vue';
9
- import LayoutTopbar from './components/Topbar/index.vue';
10
11
 
12
+ import LayoutTopbar from './components/Topbar/index.vue';
11
13
  import { useContext } from './composables/useContext';
12
14
  import { useGetSidebarActualWidth } from './composables/useGetComputedStyle';
13
15
  import { useHotkey } from './composables/useHotkey';
@@ -18,6 +20,12 @@ defineOptions({
18
20
  });
19
21
 
20
22
  const routeInfo = useRoute();
23
+ const { auth } = useAuth();
24
+
25
+ const isAuth = computed(() => {
26
+ return routeInfo.matched.every(item => auth(item.meta.auth ?? ''));
27
+ });
28
+
21
29
  const { settingsStore } = useContext();
22
30
  const { mainSidebarActualWidth, subSidebarActualWidth } = useGetSidebarActualWidth();
23
31
  useHotkey();
@@ -86,9 +94,13 @@ watch(() => routeInfo.path, () => {
86
94
  <RiLogoutBoxLine />
87
95
  </div>
88
96
 
89
- <slot>
97
+ <slot v-if="isAuth">
90
98
  <LayoutContent />
91
99
  </slot>
100
+
101
+ <slot v-else name="notAllowed">
102
+ <NotAllowed />
103
+ </slot>
92
104
  </div>
93
105
 
94
106
  <slot name="footer">
@@ -33,7 +33,7 @@ const isMenuPopup = computed<MenuInjection['isMenuPopup']>(() => {
33
33
  });
34
34
 
35
35
  // 解析传入的 menu 数据,并保存到 items 和 subMenus 对象中
36
- function initItems(menu: MenuProps['menu'], parentPaths: string[] = []) {
36
+ function initItems(menu: MenuProps['menu'] = [], parentPaths: string[] = []) {
37
37
  menu.forEach((item) => {
38
38
  const index = item.path ?? JSON.stringify(item);
39
39
  if (item.children && item.children.length > 0) {
@@ -6,40 +6,15 @@ defineOptions({
6
6
  });
7
7
 
8
8
  const route = useRoute();
9
- const router = useRouter();
10
9
 
11
10
  const settingsStore = useSettingsStore();
12
11
  const tabbarStore = useTabbarStore();
13
12
 
14
- const data = ref({
15
- inter: Number.NaN,
16
- countdown: 5,
17
- });
18
-
19
- onUnmounted(() => {
20
- if (data.value.inter) {
21
- window.clearInterval(data.value.inter);
22
- }
23
- });
24
-
25
13
  onMounted(() => {
26
14
  if (settingsStore.settings.tabbar.enable) {
27
15
  tabbarStore.remove(route.meta.activeMenu || route.fullPath);
28
16
  }
29
- data.value.inter = window.setInterval(() => {
30
- data.value.countdown--;
31
- if (data.value.countdown === 0) {
32
- if (data.value.inter) {
33
- window.clearInterval(data.value.inter);
34
- }
35
- goBack();
36
- }
37
- }, 1000);
38
17
  });
39
-
40
- function goBack() {
41
- router.push('/');
42
- }
43
18
  </script>
44
19
 
45
20
  <template>
@@ -52,23 +27,18 @@ function goBack() {
52
27
  <div class="desc mx-0 text-xl text-stone-5 dark:text-[#C9D6EF]">
53
28
  抱歉,你无权访问该页面
54
29
  </div>
55
- <div>
56
- <HButton @click="goBack">
57
- {{ data.countdown }} 秒后,返回首页
58
- </HButton>
59
- </div>
60
30
  </div>
61
31
  </div>
62
32
  </template>
63
33
 
64
34
  <style scoped>
65
35
  .noPermissionIcon {
66
- background: url("./assets/403.svg") no-repeat;
36
+ background: url("../../assets/images/403.svg") no-repeat;
67
37
  background-size: 100% 100%;
68
38
  }
69
39
 
70
40
  [data-theme="dark"] .noPermissionIcon {
71
- background: url("./assets/403_dark.svg") no-repeat;
41
+ background: url("../../assets/images/403_dark.svg") no-repeat;
72
42
  background-size: 100% 100%;
73
43
  }
74
44
  </style>
@@ -17,6 +17,7 @@ import LayoutTopbar from './components/Topbar/index.vue';
17
17
 
18
18
  import Logo from './components/Logo/index.vue';
19
19
  import Tools from './components/Tools/index.vue';
20
+ import NotAllowed from './components/NotAllowed/index.vue';
20
21
  import Fullscreen from './components/Tools/Fullscreen.vue';
21
22
  import PageReload from './components/Tools/PageReload.vue';
22
23
  import DarkModeToggle from './components/Tools/DarkModeToggle.vue';
@@ -99,6 +100,6 @@ export {
99
100
 
100
101
  Logo,
101
102
  Tools,
102
-
103
+ NotAllowed,
103
104
  Copyright,
104
105
  };
@@ -1,22 +1,9 @@
1
1
  <script setup lang="ts">
2
- import { useAuth } from '@/features/composables';
3
- import NotAllowed from '../NotAllowed/index.vue';
4
-
5
2
  defineOptions({
6
3
  name: 'PubinfoApp',
7
4
  });
8
-
9
- const route = useRoute();
10
- const { auth } = useAuth();
11
-
12
- const isAuth = computed(() => {
13
- return route.matched.every(item => auth(item.meta.auth ?? ''));
14
- });
15
5
  </script>
16
6
 
17
7
  <template>
18
- <RouterView v-slot="{ Component }">
19
- <component :is="Component" v-if="isAuth" />
20
- <NotAllowed v-else />
21
- </RouterView>
8
+ <RouterView />
22
9
  </template>
@@ -1,4 +1,3 @@
1
- export { default as NotAllowed } from './NotAllowed/index.vue';
2
1
  export { default as PageHeader } from './PageHeader/index.vue';
3
2
  export { default as PageMain } from './PageMain/index.vue';
4
3
  export { default as PassStrengthValidator } from './PassStrengthValidator/index.vue';
@@ -36,6 +36,7 @@ let globalSettings: RequiredDeep<Settings.all> = {
36
36
  subMenuCollapse: false,
37
37
  enableSubMenuCollapseButton: true,
38
38
  enableHotkeys: false,
39
+ showWithoutPermission: false,
39
40
  },
40
41
  topbar: {
41
42
  mode: 'fixed',
@@ -45,7 +45,7 @@ const useMenuStore = defineStore(
45
45
  * // { path: '/app/about', title: 'About' },
46
46
  * // ]
47
47
  */
48
- function convertToFullPath(menu: any[], path: string = '') {
48
+ function convertToFullPath(menu: any[] = [], path: string = '') {
49
49
  return menu.map((item) => {
50
50
  item.path = resolveRoutePath(path, item.path);
51
51
  if (item.children) {
@@ -174,7 +174,7 @@ const useMenuStore = defineStore(
174
174
  * @param rootPath 根路径
175
175
  * @returns 默认展开的路径数组
176
176
  */
177
- function getDefaultOpenedPaths(menus: Menu.recordRaw[], rootPath = '') {
177
+ function getDefaultOpenedPaths(menus: Menu.recordRaw[] = [], rootPath = '') {
178
178
  const defaultOpenedPaths: string[] = [];
179
179
  menus.forEach((item) => {
180
180
  if (item.meta?.defaultOpened && item.children) {
@@ -33,6 +33,12 @@ const useRouteStore = defineStore(
33
33
  system?: boolean
34
34
  }>>([]);
35
35
 
36
+ /** 如果权限功能开启 / 不展示无权限菜单,则需要对路由数据进行筛选过滤 */
37
+ const needFilterRoutes = computed(() => {
38
+ const { app, menu } = settingsStore.settings;
39
+ return app.enablePermission && !menu.showWithoutPermission;
40
+ });
41
+
36
42
  /**
37
43
  * 创建面包屑对象
38
44
  * @param currentRouter 当前路由对象
@@ -273,8 +279,7 @@ const useRouteStore = defineStore(
273
279
  */
274
280
  const routes = computed(() => {
275
281
  let returnRoutes: Route.recordMainRaw[];
276
- // 如果权限功能开启,则需要对路由数据进行筛选过滤
277
- if (settingsStore.settings.app.enablePermission) {
282
+ if (needFilterRoutes.value) {
278
283
  returnRoutes = filterAsyncRoutes(routesRaw.value, userStore.user.permissions);
279
284
  }
280
285
  else {
@@ -351,7 +356,7 @@ const useRouteStore = defineStore(
351
356
  * 生成路由
352
357
  */
353
358
  async function generateRoutes() {
354
- const res = await postRbacResourceMineOrAllResourceTree({ needAll: false });
359
+ const res = await postRbacResourceMineOrAllResourceTree({ needAll: !needFilterRoutes.value });
355
360
  if (res.success) {
356
361
  remoteRoutesRaw.value = res?.data ?? [];
357
362
  const staticRoutes = convertSingleRoutes(filterEnabledRoutes(cloneDeep(asyncRoutes)));
package/src/index.ts CHANGED
@@ -88,6 +88,7 @@ export {
88
88
  LayoutSidebar,
89
89
  LayoutTopbar,
90
90
  Logo,
91
+ NotAllowed,
91
92
  Tool,
92
93
  Tools,
93
94
  } from './built-in/layout-component';
@@ -220,6 +220,12 @@ declare namespace Settings {
220
220
  */
221
221
  enableHotkeys?: boolean
222
222
 
223
+ /**
224
+ * 是否展示无权限的菜单
225
+ *
226
+ * @默认值 `false`
227
+ */
228
+ showWithoutPermission?: boolean
223
229
  }
224
230
 
225
231
  /* ================== TOPBAR ================= */
@@ -1,4 +0,0 @@
1
- import { bH as f } from "./index-rq5fCkC1.js";
2
- export {
3
- f as default
4
- };
@@ -1,4 +0,0 @@
1
- import { bG as f } from "./index-rq5fCkC1.js";
2
- export {
3
- f as default
4
- };