@pubinfo/core 2.2.4 → 2.2.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.
- package/dist/built-in/layout-component/Layout.vue.d.ts +4 -0
- package/dist/built-in/layout-component/components/Topbar/Toolbar/index.vue.d.ts +19 -1
- package/dist/built-in/layout-component/components/Topbar/index.vue.d.ts +19 -1
- package/dist/built-in/layout-component/components/Topbar/interface.d.ts +8 -0
- package/dist/built-in/layout-component/index.d.ts +1 -0
- package/dist/built-in/layout-component/interface.d.ts +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +39 -26
- package/dist/style.css +1 -1
- package/package.json +7 -7
- package/src/built-in/layout-component/Layout.vue +7 -1
- package/src/built-in/layout-component/components/Topbar/Toolbar/index.vue +36 -40
- package/src/built-in/layout-component/components/Topbar/index.vue +10 -1
- package/src/built-in/layout-component/components/Topbar/interface.ts +9 -0
- package/src/built-in/layout-component/composables/useLayoutVisible.ts +6 -2
- package/src/built-in/layout-component/index.ts +1 -0
- package/src/built-in/layout-component/interface.ts +6 -0
- package/src/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.5",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"pinia": "^3.0.4",
|
|
33
33
|
"vue": "^3.5.28",
|
|
34
34
|
"vue-router": "^5.0.2",
|
|
35
|
-
"@pubinfo/
|
|
36
|
-
"@pubinfo/vite": "2.2.
|
|
37
|
-
"@pubinfo/
|
|
35
|
+
"@pubinfo/config": "2.2.5",
|
|
36
|
+
"@pubinfo/vite": "2.2.5",
|
|
37
|
+
"@pubinfo/devtools": "2.2.5"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@alova/adapter-axios": "^2.0.17",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"unctx": "^2.5.0",
|
|
65
65
|
"vue-m-message": "^4.0.2",
|
|
66
66
|
"zxcvbn": "^4.4.2",
|
|
67
|
-
"@pubinfo/shared": "2.2.
|
|
67
|
+
"@pubinfo/shared": "2.2.5"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@alova/mock": "^2.0.18",
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
"vite-plugin-dts": "^4.5.4",
|
|
95
95
|
"vue": "^3.5.28",
|
|
96
96
|
"vue-router": "^5.0.2",
|
|
97
|
-
"@pubinfo/config": "2.2.
|
|
98
|
-
"@pubinfo/vite": "2.2.
|
|
97
|
+
"@pubinfo/config": "2.2.5",
|
|
98
|
+
"@pubinfo/vite": "2.2.5"
|
|
99
99
|
},
|
|
100
100
|
"scripts": {
|
|
101
101
|
"dev": "vite build -w -m watch",
|
|
@@ -29,6 +29,7 @@ const props = withDefaults(
|
|
|
29
29
|
showSidebar: true,
|
|
30
30
|
showTabbar: true,
|
|
31
31
|
showToolbar: true,
|
|
32
|
+
showBreadcrumb: true,
|
|
32
33
|
},
|
|
33
34
|
);
|
|
34
35
|
|
|
@@ -39,6 +40,7 @@ const routeInfo = useRoute();
|
|
|
39
40
|
const { auth } = useAuth();
|
|
40
41
|
const { settingsStore } = useContext();
|
|
41
42
|
const { mainSidebarActualWidth, subSidebarActualWidth } = useGetSidebarActualWidth(props);
|
|
43
|
+
const slots = useSlots();
|
|
42
44
|
useHotkey();
|
|
43
45
|
useWatermark();
|
|
44
46
|
|
|
@@ -140,7 +142,11 @@ watch(scrollTop, (val, oldVal) => {
|
|
|
140
142
|
data-fixed-calc-width
|
|
141
143
|
>
|
|
142
144
|
<slot name="topbar">
|
|
143
|
-
<LayoutTopbar
|
|
145
|
+
<LayoutTopbar>
|
|
146
|
+
<template v-if="slots.breadcrumb" #breadcrumb="slotProps">
|
|
147
|
+
<slot name="breadcrumb" v-bind="slotProps" />
|
|
148
|
+
</template>
|
|
149
|
+
</LayoutTopbar>
|
|
144
150
|
</slot>
|
|
145
151
|
</div>
|
|
146
152
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { RouteRecordRaw } from 'vue-router';
|
|
3
|
+
import type { BreadcrumbSlotItem, BreadcrumbSlotProps } from '../interface';
|
|
3
4
|
import { cloneDeep } from 'lodash-es';
|
|
4
5
|
import { compile } from 'path-to-regexp';
|
|
5
6
|
import { PubinfoIcon } from '@/features/components';
|
|
6
7
|
import { useContext } from '../../../composables/useContext';
|
|
8
|
+
import { useLayoutVisible } from '../../../composables/useLayoutVisible';
|
|
7
9
|
import Breadcrumb from '../../Tools/Breadcrumb/index.vue';
|
|
8
10
|
import BreadcrumbItem from '../../Tools/Breadcrumb/item.vue';
|
|
9
11
|
import Tools from '../../Tools/index.vue';
|
|
@@ -14,10 +16,15 @@ defineOptions({
|
|
|
14
16
|
name: 'Toolbar',
|
|
15
17
|
});
|
|
16
18
|
|
|
19
|
+
defineSlots<{
|
|
20
|
+
breadcrumb?: (props: BreadcrumbSlotProps) => any
|
|
21
|
+
}>();
|
|
22
|
+
|
|
17
23
|
const route = useRoute();
|
|
18
24
|
const router = useRouter();
|
|
19
25
|
|
|
20
26
|
const { settingsStore, menuStore, generateTitle } = useContext();
|
|
27
|
+
const { show } = useLayoutVisible();
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* 计算属性:是否启用子菜单折叠按钮
|
|
@@ -39,16 +46,6 @@ const enableSubMenuCollapseButton = computed(() => {
|
|
|
39
46
|
);
|
|
40
47
|
});
|
|
41
48
|
|
|
42
|
-
/**
|
|
43
|
-
* 顶部工具栏组件
|
|
44
|
-
*
|
|
45
|
-
* @returns {boolean}
|
|
46
|
-
*/
|
|
47
|
-
const breadcrumbIsShow = computed(() =>
|
|
48
|
-
settingsStore.mode === 'pc'
|
|
49
|
-
&& settingsStore.settings.breadcrumb.enable,
|
|
50
|
-
);
|
|
51
|
-
|
|
52
49
|
function createHomeBreadcrumb() {
|
|
53
50
|
return {
|
|
54
51
|
path: '/',
|
|
@@ -56,10 +53,8 @@ function createHomeBreadcrumb() {
|
|
|
56
53
|
};
|
|
57
54
|
}
|
|
58
55
|
|
|
59
|
-
interface BreadcrumbItemNode { title: string, path: string, mainIndex?: number }
|
|
60
|
-
|
|
61
56
|
const breadcrumbList = computed(() => {
|
|
62
|
-
const breadcrumbList:
|
|
57
|
+
const breadcrumbList: BreadcrumbSlotItem[] = [];
|
|
63
58
|
if (settingsStore.settings.home.enable) {
|
|
64
59
|
breadcrumbList.push(createHomeBreadcrumb());
|
|
65
60
|
}
|
|
@@ -226,34 +221,35 @@ function onSelect(node: RouteRecordRaw, index: number) {
|
|
|
226
221
|
<Favorites />
|
|
227
222
|
</template>
|
|
228
223
|
</HDropdown>
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
>
|
|
241
|
-
<HDropdownTree
|
|
242
|
-
:item="getCurrentBreadcrumb(item.path)"
|
|
243
|
-
:disabled="(index === breadcrumbList.length - 1) || getCurrentBreadcrumb(item.path)?.children?.length <= 1"
|
|
244
|
-
@select="onSelect($event, index)"
|
|
224
|
+
<slot v-if="show.breadcrumb" name="breadcrumb" :items="breadcrumbList">
|
|
225
|
+
<Breadcrumb
|
|
226
|
+
class="breadcrumb"
|
|
227
|
+
:class="{
|
|
228
|
+
[`breadcrumb-${settingsStore.settings.breadcrumb.style}`]: settingsStore.settings.breadcrumb.style !== '',
|
|
229
|
+
}"
|
|
230
|
+
>
|
|
231
|
+
<TransitionGroup name="breadcrumb">
|
|
232
|
+
<BreadcrumbItem
|
|
233
|
+
v-for="(item, index) in breadcrumbList"
|
|
234
|
+
:key="`${index}_${item.path}_${item.title}`"
|
|
245
235
|
>
|
|
246
|
-
<
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
236
|
+
<HDropdownTree
|
|
237
|
+
:item="getCurrentBreadcrumb(item.path)"
|
|
238
|
+
:disabled="(index === breadcrumbList.length - 1) || getCurrentBreadcrumb(item.path)?.children?.length <= 1"
|
|
239
|
+
@select="onSelect($event, index)"
|
|
240
|
+
>
|
|
241
|
+
<span class="flex items-center gap-0.5">
|
|
242
|
+
<span>{{ item.title }}</span>
|
|
243
|
+
<PubinfoIcon
|
|
244
|
+
v-if="(getCurrentBreadcrumb(item.path)?.children?.length > 1) && (index !== breadcrumbList.length - 1)"
|
|
245
|
+
name="i-material-symbols-keyboard-arrow-down"
|
|
246
|
+
/>
|
|
247
|
+
</span>
|
|
248
|
+
</HDropdownTree>
|
|
249
|
+
</BreadcrumbItem>
|
|
250
|
+
</TransitionGroup>
|
|
251
|
+
</Breadcrumb>
|
|
252
|
+
</slot>
|
|
257
253
|
</div>
|
|
258
254
|
|
|
259
255
|
<Tools />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { BreadcrumbSlotProps } from './interface';
|
|
2
3
|
import { useLayoutVisible } from '../../composables/useLayoutVisible';
|
|
3
4
|
import Tabbar from './Tabbar/index.vue';
|
|
4
5
|
import Toolbar from './Toolbar/index.vue';
|
|
@@ -7,10 +8,18 @@ defineOptions({
|
|
|
7
8
|
name: 'Topbar',
|
|
8
9
|
});
|
|
9
10
|
|
|
11
|
+
const slots = defineSlots<{
|
|
12
|
+
breadcrumb?: (props: BreadcrumbSlotProps) => any
|
|
13
|
+
}>();
|
|
14
|
+
|
|
10
15
|
const { show } = useLayoutVisible();
|
|
11
16
|
</script>
|
|
12
17
|
|
|
13
18
|
<template>
|
|
14
19
|
<Tabbar v-if="show.tabbar" />
|
|
15
|
-
<Toolbar v-if="show.toolbar"
|
|
20
|
+
<Toolbar v-if="show.toolbar">
|
|
21
|
+
<template v-if="slots.breadcrumb" #breadcrumb="slotProps">
|
|
22
|
+
<slot name="breadcrumb" v-bind="slotProps" />
|
|
23
|
+
</template>
|
|
24
|
+
</Toolbar>
|
|
16
25
|
</template>
|
|
@@ -38,6 +38,7 @@ export function useLayoutVisible(_props?: LayoutProps) {
|
|
|
38
38
|
const tabbarEnable = settingsStore.settings.tabbar.enable;
|
|
39
39
|
const favoritesEnable = settingsStore.settings.favorites.enable;
|
|
40
40
|
const breadcrumbEnable = settingsStore.settings.breadcrumb.enable;
|
|
41
|
+
const breadcrumb = mode === 'pc' && breadcrumbEnable && props?.showBreadcrumb;
|
|
41
42
|
|
|
42
43
|
return {
|
|
43
44
|
/** 顶部栏 */
|
|
@@ -76,13 +77,16 @@ export function useLayoutVisible(_props?: LayoutProps) {
|
|
|
76
77
|
menuMode === 'head'
|
|
77
78
|
&& !enableSubMenuCollapseButton
|
|
78
79
|
&& !favoritesEnable
|
|
79
|
-
&& !
|
|
80
|
+
&& !breadcrumb
|
|
80
81
|
) || (
|
|
81
82
|
menuMode === 'only-head'
|
|
82
83
|
&& !favoritesEnable
|
|
83
|
-
&& !
|
|
84
|
+
&& !breadcrumb
|
|
84
85
|
)
|
|
85
86
|
) && appMetaData.toolbar && props?.showToolbar,
|
|
87
|
+
|
|
88
|
+
/** 面包屑 */
|
|
89
|
+
breadcrumb,
|
|
86
90
|
};
|
|
87
91
|
});
|
|
88
92
|
|
|
@@ -68,6 +68,7 @@ export function LayoutComponent(): ModuleOptions {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export type { DropdownMenu, DropdownMenuRender } from './components/Tools/interface';
|
|
71
|
+
export type { BreadcrumbSlotItem, BreadcrumbSlotProps } from './components/Topbar/interface';
|
|
71
72
|
|
|
72
73
|
export const Tool = {
|
|
73
74
|
Fullscreen,
|
package/src/index.ts
CHANGED
|
@@ -95,7 +95,7 @@ export {
|
|
|
95
95
|
Tool,
|
|
96
96
|
Tools,
|
|
97
97
|
} from './built-in/layout-component';
|
|
98
|
-
export type { DropdownMenu, DropdownMenuRender } from './built-in/layout-component';
|
|
98
|
+
export type { BreadcrumbSlotItem, BreadcrumbSlotProps, DropdownMenu, DropdownMenuRender } from './built-in/layout-component';
|
|
99
99
|
export { updateWatermark } from './built-in/layout-component/composables/useWatermark';
|
|
100
100
|
|
|
101
101
|
export {
|