@pubinfo/core 2.1.8 → 2.1.9
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/built-in/layout-component/composables/useGetComputedStyle.d.ts +2 -1
- package/dist/index.js +9 -9
- package/dist/style.css +1 -1
- package/package.json +7 -7
- package/src/built-in/layout-component/Layout.vue +1 -1
- package/src/built-in/layout-component/composables/useGetComputedStyle.ts +15 -4
- package/src/built-in/layout-component/composables/useLayoutVisible.ts +7 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.9",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"pinia": "^3.0.4",
|
|
32
32
|
"vue": "^3.5.26",
|
|
33
33
|
"vue-router": "^4.6.4",
|
|
34
|
-
"@pubinfo/
|
|
35
|
-
"@pubinfo/
|
|
36
|
-
"@pubinfo/
|
|
34
|
+
"@pubinfo/devtools": "2.1.9",
|
|
35
|
+
"@pubinfo/vite": "2.1.9",
|
|
36
|
+
"@pubinfo/config": "2.1.9"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@alova/adapter-axios": "^2.0.16",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"unctx": "^2.4.1",
|
|
64
64
|
"vue-m-message": "^4.0.2",
|
|
65
65
|
"zxcvbn": "^4.4.2",
|
|
66
|
-
"@pubinfo/shared": "2.1.
|
|
66
|
+
"@pubinfo/shared": "2.1.9"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@alova/mock": "^2.0.17",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"vite-plugin-dts": "^4.5.4",
|
|
94
94
|
"vue": "^3.5.26",
|
|
95
95
|
"vue-router": "^4.6.4",
|
|
96
|
-
"@pubinfo/config": "2.1.
|
|
97
|
-
"@pubinfo/vite": "2.1.
|
|
96
|
+
"@pubinfo/config": "2.1.9",
|
|
97
|
+
"@pubinfo/vite": "2.1.9"
|
|
98
98
|
},
|
|
99
99
|
"scripts": {
|
|
100
100
|
"dev": "vite build -w -m watch",
|
|
@@ -38,7 +38,7 @@ const { show } = useLayoutVisible(props);
|
|
|
38
38
|
const routeInfo = useRoute();
|
|
39
39
|
const { auth } = useAuth();
|
|
40
40
|
const { settingsStore } = useContext();
|
|
41
|
-
const { mainSidebarActualWidth, subSidebarActualWidth } = useGetSidebarActualWidth();
|
|
41
|
+
const { mainSidebarActualWidth, subSidebarActualWidth } = useGetSidebarActualWidth(props);
|
|
42
42
|
useHotkey();
|
|
43
43
|
useWatermark();
|
|
44
44
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { LayoutProps } from '../interface';
|
|
1
2
|
import { useContext } from './useContext';
|
|
3
|
+
import { useLayoutVisible } from './useLayoutVisible';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* 获取指定元素的计算样式属性值
|
|
@@ -16,20 +18,25 @@ type unit = string;
|
|
|
16
18
|
* 根据各种设置和条件计算主侧边栏和子侧边栏的实际宽度。
|
|
17
19
|
* @returns 包含主侧边栏和子侧边栏实际宽度的计算属性对象。
|
|
18
20
|
*/
|
|
19
|
-
export function useGetSidebarActualWidth() {
|
|
21
|
+
export function useGetSidebarActualWidth(props?: LayoutProps) {
|
|
20
22
|
const { settingsStore, menuStore } = useContext();
|
|
23
|
+
const { show } = useLayoutVisible(props);
|
|
21
24
|
|
|
22
25
|
const mainSidebarActualWidth = computed<unit>(() => {
|
|
23
26
|
const menuMode = settingsStore.settings.menu.menuMode;
|
|
24
27
|
const isMobile = settingsStore.mode !== 'mobile';
|
|
25
28
|
const isSingle = menuMode === 'single';
|
|
26
29
|
const isHeadAndOnlyHead = ['head', 'only-head'].includes(menuMode);
|
|
27
|
-
|
|
30
|
+
|
|
31
|
+
if (!show.value.mainSidebar) {
|
|
28
32
|
return '0px';
|
|
29
33
|
}
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
|
|
35
|
+
if (isSingle || (isHeadAndOnlyHead && isMobile)) {
|
|
36
|
+
return '0px';
|
|
32
37
|
}
|
|
38
|
+
|
|
39
|
+
return useGetComputedStyle('--g-main-sidebar-width');
|
|
33
40
|
});
|
|
34
41
|
|
|
35
42
|
/**
|
|
@@ -49,6 +56,10 @@ export function useGetSidebarActualWidth() {
|
|
|
49
56
|
actualWidth = useGetComputedStyle('--g-sub-sidebar-collapse-width');
|
|
50
57
|
}
|
|
51
58
|
|
|
59
|
+
if (!show.value.subSidebar) {
|
|
60
|
+
actualWidth = '0px';
|
|
61
|
+
}
|
|
62
|
+
|
|
52
63
|
if (onlySideOrHead && isMobile) {
|
|
53
64
|
actualWidth = '0px';
|
|
54
65
|
}
|
|
@@ -41,10 +41,15 @@ export function useLayoutVisible(_props?: LayoutProps) {
|
|
|
41
41
|
|
|
42
42
|
return {
|
|
43
43
|
/** 顶部栏 */
|
|
44
|
-
header: mode === 'pc'
|
|
44
|
+
header: mode === 'pc'
|
|
45
|
+
&& ['head', 'only-head'].includes(menuMode)
|
|
46
|
+
&& appMetaData.header
|
|
47
|
+
&& props?.showHeader,
|
|
45
48
|
|
|
46
49
|
/** 主侧边栏 */
|
|
47
|
-
mainSidebar: ((mode === 'mobile' && menuMode !== 'single') || ['side', 'only-side'].includes(menuMode))
|
|
50
|
+
mainSidebar: ((mode === 'mobile' && menuMode !== 'single') || ['side', 'only-side'].includes(menuMode))
|
|
51
|
+
&& appMetaData.sidebar
|
|
52
|
+
&& props?.showSidebar,
|
|
48
53
|
|
|
49
54
|
/** 副侧边栏 */
|
|
50
55
|
subSidebar: (
|