@veltra/desktop 1.2.4 → 1.2.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.
- package/dist/components/auto-complete/auto-complete.js +25 -13
- package/dist/components/auto-complete/auto-complete.js.map +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +3 -2
- package/dist/components/batch-edit/batch-edit-form.js +33 -26
- package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
- package/dist/components/batch-edit/batch-edit-list.js +4 -1
- package/dist/components/batch-edit/batch-edit-list.js.map +1 -1
- package/dist/components/batch-edit/batch-edit.js +29 -50
- package/dist/components/batch-edit/batch-edit.js.map +1 -1
- package/dist/components/batch-edit/batch-edit.vue.d.ts +3 -3
- package/dist/components/batch-edit/di.js.map +1 -1
- package/dist/components/batch-edit/style2.css +3 -0
- package/dist/components/batch-edit/use-edit.js +39 -71
- package/dist/components/batch-edit/use-edit.js.map +1 -1
- package/dist/components/batch-edit/use-features.js +38 -0
- package/dist/components/batch-edit/use-features.js.map +1 -0
- package/dist/components/cascade/cascade.vue.d.ts +1 -1
- package/dist/components/contextmenu/style2.css +7 -7
- package/dist/components/dual-nav/dual-nav-app.js +70 -0
- package/dist/components/dual-nav/dual-nav-app.js.map +1 -0
- package/dist/components/dual-nav/dual-nav.js +128 -0
- package/dist/components/dual-nav/dual-nav.js.map +1 -0
- package/dist/components/dual-nav/dual-nav.vue.d.ts +13 -0
- package/dist/components/dual-nav/helper.js +21 -0
- package/dist/components/dual-nav/helper.js.map +1 -0
- package/dist/components/dual-nav/index.d.ts +1 -0
- package/dist/components/dual-nav/style.js +5 -0
- package/dist/components/dual-nav/style2.css +174 -0
- package/dist/components/index.d.ts +23 -22
- package/dist/components/index.js +28 -26
- package/dist/components/index.js.map +1 -1
- package/dist/components/loading/loading.js +1 -1
- package/dist/components/loading/loading.js.map +1 -1
- package/dist/components/loading/style2.css +61 -81
- package/dist/components/nav/di.js +7 -0
- package/dist/components/nav/di.js.map +1 -0
- package/dist/components/nav/helper.js +18 -0
- package/dist/components/nav/helper.js.map +1 -0
- package/dist/components/nav/index.d.ts +3 -0
- package/dist/components/{menu/menu-icon.js → nav/nav-icon.js} +4 -4
- package/dist/components/nav/nav-icon.js.map +1 -0
- package/dist/components/{menu/menu-item-collapsed.js → nav/nav-item-collapsed.js} +23 -23
- package/dist/components/nav/nav-item-collapsed.js.map +1 -0
- package/dist/components/{menu/menu-item.js → nav/nav-item.js} +13 -13
- package/dist/components/nav/nav-item.js.map +1 -0
- package/dist/components/{menu/menu-item.vue.d.ts → nav/nav-item.vue.d.ts} +4 -4
- package/dist/components/{menu/menu-sub-collapsed.js → nav/nav-sub-collapsed.js} +19 -19
- package/dist/components/nav/nav-sub-collapsed.js.map +1 -0
- package/dist/components/{menu/menu-sub.js → nav/nav-sub.js} +24 -24
- package/dist/components/nav/nav-sub.js.map +1 -0
- package/dist/components/{menu/menu-sub.vue.d.ts → nav/nav-sub.vue.d.ts} +4 -4
- package/dist/components/{menu/menu.js → nav/nav.js} +45 -36
- package/dist/components/nav/nav.js.map +1 -0
- package/dist/components/nav/nav.vue.d.ts +18 -0
- package/dist/components/nav/style.d.ts +1 -0
- package/dist/components/{menu → nav}/style2.css +105 -105
- package/dist/components/{menu/use-menu-item.js → nav/use-nav-item.js} +11 -11
- package/dist/components/nav/use-nav-item.js.map +1 -0
- package/dist/components/{menu/walk-menu-path.js → nav/walk-nav-path.js} +5 -5
- package/dist/components/nav/walk-nav-path.js.map +1 -0
- package/dist/components/number/number.vue.d.ts +1 -1
- package/dist/components/select/style2.css +4 -4
- package/dist/components/steps/steps.vue.d.ts +2 -2
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +2 -2
- package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
- package/dist/components/tabs/tabs.vue.d.ts +2 -2
- package/dist/components/watermark/watermark.vue.d.ts +1 -1
- package/dist/index.d.ts +63 -61
- package/dist/index.js +56 -55
- package/dist/style.js +2 -1
- package/dist/types/auto-complete.d.ts +6 -1
- package/dist/types/batch-edit.d.ts +15 -2
- package/dist/types/dual-nav.d.ts +27 -0
- package/dist/types/index.d.ts +4 -3
- package/dist/types/loading.d.ts +1 -1
- package/dist/types/nav.d.ts +48 -0
- package/package.json +6 -6
- package/src/components/auto-complete/auto-complete.vue +24 -13
- package/src/components/batch-edit/batch-edit-form.vue +29 -18
- package/src/components/batch-edit/batch-edit-list.vue +6 -1
- package/src/components/batch-edit/batch-edit.vue +36 -73
- package/src/components/batch-edit/di.ts +3 -1
- package/src/components/batch-edit/style.scss +5 -0
- package/src/components/batch-edit/use-edit.ts +63 -116
- package/src/components/batch-edit/use-features.ts +58 -0
- package/src/components/contextmenu/style.scss +5 -5
- package/src/components/dual-nav/dual-nav-app.vue +61 -0
- package/src/components/dual-nav/dual-nav.vue +156 -0
- package/src/components/dual-nav/helper.ts +25 -0
- package/src/components/dual-nav/index.ts +1 -0
- package/src/components/dual-nav/style.scss +188 -0
- package/src/components/dual-nav/style.ts +5 -0
- package/src/components/index.ts +3 -1
- package/src/components/loading/loading.vue +1 -1
- package/src/components/loading/style.scss +68 -104
- package/src/components/nav/di.ts +17 -0
- package/src/components/nav/helper.ts +22 -0
- package/src/components/nav/index.ts +3 -0
- package/src/components/{menu/menu-icon.vue → nav/nav-icon.vue} +1 -1
- package/src/components/nav/nav-item-collapsed.vue +66 -0
- package/src/components/nav/nav-item.vue +36 -0
- package/src/components/{menu/menu-sub-collapsed.vue → nav/nav-sub-collapsed.vue} +15 -15
- package/src/components/{menu/menu-sub.vue → nav/nav-sub.vue} +19 -19
- package/src/components/{menu/menu.vue → nav/nav.vue} +42 -42
- package/src/components/{menu → nav}/style.scss +16 -14
- package/src/components/{menu/use-menu-item.ts → nav/use-nav-item.ts} +14 -14
- package/src/components/{menu/walk-menu-path.ts → nav/walk-nav-path.ts} +2 -2
- package/src/components/select/style.scss +4 -4
- package/src/style.ts +2 -1
- package/src/types/auto-complete.ts +6 -1
- package/src/types/batch-edit.ts +18 -1
- package/src/types/dual-nav.ts +28 -0
- package/src/types/index.ts +2 -1
- package/src/types/loading.ts +1 -1
- package/src/types/nav.ts +49 -0
- package/dist/components/menu/di.js +0 -7
- package/dist/components/menu/di.js.map +0 -1
- package/dist/components/menu/helper.js +0 -8
- package/dist/components/menu/helper.js.map +0 -1
- package/dist/components/menu/index.d.ts +0 -3
- package/dist/components/menu/menu-icon.js.map +0 -1
- package/dist/components/menu/menu-item-collapsed.js.map +0 -1
- package/dist/components/menu/menu-item.js.map +0 -1
- package/dist/components/menu/menu-sub-collapsed.js.map +0 -1
- package/dist/components/menu/menu-sub.js.map +0 -1
- package/dist/components/menu/menu.js.map +0 -1
- package/dist/components/menu/menu.vue.d.ts +0 -14
- package/dist/components/menu/use-menu-item.js.map +0 -1
- package/dist/components/menu/walk-menu-path.js.map +0 -1
- package/dist/types/menu.d.ts +0 -40
- package/src/components/menu/di.ts +0 -17
- package/src/components/menu/helper.ts +0 -3
- package/src/components/menu/index.ts +0 -3
- package/src/components/menu/menu-item-collapsed.vue +0 -66
- package/src/components/menu/menu-item.vue +0 -36
- package/src/components/menu/menu-node.ts +0 -6
- package/src/types/menu.ts +0 -41
- /package/dist/components/{menu → dual-nav}/style.d.ts +0 -0
- /package/dist/components/{menu → nav}/style.js +0 -0
- /package/src/components/{menu → nav}/style.ts +0 -0
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
v-model:visible="visible"
|
|
9
9
|
>
|
|
10
10
|
<li :class="[collapsedCls.e('sub-content'), bem.is('first-level', depth === 0)]">
|
|
11
|
-
<
|
|
11
|
+
<NavIcon v-if="item.icon" :icon="item.icon" :class="collapsedCls.e('icon')" />
|
|
12
12
|
|
|
13
|
-
<span v-else>{{
|
|
13
|
+
<span v-else>{{ item.title[0] }}</span>
|
|
14
14
|
|
|
15
15
|
<template v-if="depth !== 0">
|
|
16
16
|
<span :class="collapsedCls.e('sub-title')">
|
|
17
|
-
{{
|
|
17
|
+
{{ item.title }}
|
|
18
18
|
</span>
|
|
19
19
|
|
|
20
20
|
<!-- 展开图标 -->
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
|
|
27
27
|
<template #content>
|
|
28
28
|
<u-scroll tag="ul" :class="collapsedCls.e('sub-list')">
|
|
29
|
-
<template v-for="(child, index) of
|
|
30
|
-
<
|
|
29
|
+
<template v-for="(child, index) of item.children!" :key="getKey(index, parentKey)">
|
|
30
|
+
<UNavItemCollapsed
|
|
31
31
|
v-if="!child.children?.length"
|
|
32
|
-
:
|
|
32
|
+
:item="child"
|
|
33
33
|
:depth="depth + 1"
|
|
34
34
|
@click="closeSubMenu"
|
|
35
35
|
/>
|
|
36
36
|
|
|
37
|
-
<
|
|
37
|
+
<NavSubCollapsed
|
|
38
38
|
v-else
|
|
39
|
-
:
|
|
39
|
+
:item="child"
|
|
40
40
|
:parent-key="getKey(index, parentKey)"
|
|
41
41
|
:depth="depth + 1"
|
|
42
42
|
/>
|
|
@@ -51,18 +51,18 @@ import { ArrowRight } from '@veltra/icons/normal'
|
|
|
51
51
|
import { bem } from '@veltra/utils'
|
|
52
52
|
import { inject, ref } from 'vue'
|
|
53
53
|
|
|
54
|
-
import type {
|
|
54
|
+
import type { NavItem } from '../../types'
|
|
55
55
|
import { UIcon } from '../icon'
|
|
56
56
|
import { UScroll } from '../scroll'
|
|
57
57
|
import { UTip } from '../tip'
|
|
58
|
-
import {
|
|
58
|
+
import { NavDIKey } from './di'
|
|
59
59
|
import { getKey } from './helper'
|
|
60
|
-
import
|
|
61
|
-
import
|
|
60
|
+
import NavIcon from './nav-icon.vue'
|
|
61
|
+
import UNavItemCollapsed from './nav-item-collapsed.vue'
|
|
62
62
|
|
|
63
|
-
defineOptions({ name: '
|
|
63
|
+
defineOptions({ name: 'NavSubCollapsed' })
|
|
64
64
|
|
|
65
|
-
defineProps<{
|
|
65
|
+
defineProps<{ item: NavItem; parentKey: string; depth: number }>()
|
|
66
66
|
|
|
67
67
|
const visible = ref(false)
|
|
68
68
|
|
|
@@ -70,5 +70,5 @@ function closeSubMenu() {
|
|
|
70
70
|
visible.value = false
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const { collapsedCls, size } = inject(
|
|
73
|
+
const { collapsedCls, size } = inject(NavDIKey)!
|
|
74
74
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<li :class="
|
|
2
|
+
<li :class="cls.e('sub')">
|
|
3
3
|
<div
|
|
4
4
|
:class="[
|
|
5
5
|
cls.e('sub-content'),
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
]"
|
|
10
10
|
@click="handleToggleExpand"
|
|
11
11
|
>
|
|
12
|
-
<
|
|
12
|
+
<UNavIcon v-if="item.icon" :icon="item.icon" :class="cls.e('icon')" />
|
|
13
13
|
|
|
14
14
|
<!-- 文本 -->
|
|
15
15
|
<span :class="cls.e('sub-title')">
|
|
16
|
-
{{
|
|
16
|
+
{{ item.title }}
|
|
17
17
|
</span>
|
|
18
18
|
|
|
19
19
|
<!-- 展开图标 -->
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
@after-leave="(el: Element) => expandTransition.afterLeave(el as HTMLElement)"
|
|
32
32
|
>
|
|
33
33
|
<ul :class="cls.e('sub-list')" v-show="expanded">
|
|
34
|
-
<template v-for="(child, index) of
|
|
35
|
-
<
|
|
36
|
-
<
|
|
34
|
+
<template v-for="(child, index) of item.children!" :key="getKey(index, parentKey)">
|
|
35
|
+
<UNavItem v-if="!child.children?.length" :item="child" :depth="depth + 1" />
|
|
36
|
+
<NavSub v-else :item="child" :parent-key="getKey(index, parentKey)" :depth="depth + 1" />
|
|
37
37
|
</template>
|
|
38
38
|
</ul>
|
|
39
39
|
</transition>
|
|
@@ -45,34 +45,34 @@ import { ArrowRight } from '@veltra/icons/normal'
|
|
|
45
45
|
import { bem } from '@veltra/utils'
|
|
46
46
|
import { computed, inject } from 'vue'
|
|
47
47
|
|
|
48
|
-
import type {
|
|
48
|
+
import type { NavItem } from '../../types'
|
|
49
49
|
import { UIcon } from '../icon'
|
|
50
|
-
import {
|
|
50
|
+
import { NavDIKey } from './di'
|
|
51
51
|
import { getKey } from './helper'
|
|
52
|
-
import
|
|
53
|
-
import
|
|
52
|
+
import UNavIcon from './nav-icon.vue'
|
|
53
|
+
import UNavItem from './nav-item.vue'
|
|
54
54
|
|
|
55
|
-
defineOptions({ name: '
|
|
55
|
+
defineOptions({ name: 'NavSub' })
|
|
56
56
|
|
|
57
|
-
const props = defineProps<{
|
|
57
|
+
const props = defineProps<{ item: NavItem; parentKey: string; depth: number }>()
|
|
58
58
|
|
|
59
|
-
const { cls, expandedPath,
|
|
59
|
+
const { cls, expandedPath, navProps, expandTransition } = inject(NavDIKey)!
|
|
60
60
|
|
|
61
|
-
const expanded = computed(() => expandedPath.has(props.
|
|
61
|
+
const expanded = computed(() => expandedPath.has(props.item.path))
|
|
62
62
|
|
|
63
63
|
const branchActive = computed(() => {
|
|
64
|
-
const currentPath =
|
|
64
|
+
const currentPath = navProps.currentPath
|
|
65
65
|
if (!currentPath) return false
|
|
66
66
|
|
|
67
|
-
const check = (items?:
|
|
67
|
+
const check = (items?: NavItem[]) => {
|
|
68
68
|
return items?.some((item) => item.path === currentPath || check(item.children)) ?? false
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
return check(props.
|
|
71
|
+
return check(props.item.children)
|
|
72
72
|
})
|
|
73
73
|
|
|
74
74
|
function handleToggleExpand() {
|
|
75
|
-
const {
|
|
76
|
-
expandedPath.has(
|
|
75
|
+
const { item } = props
|
|
76
|
+
expandedPath.has(item.path) ? expandedPath.delete(item.path) : expandedPath.add(item.path)
|
|
77
77
|
}
|
|
78
78
|
</script>
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<u-scroll
|
|
3
|
-
tag="ul"
|
|
4
|
-
:class="[menuCls.b, menuCls.m(size)]"
|
|
5
|
-
:container-class="menuCls.e('container')"
|
|
6
|
-
>
|
|
2
|
+
<u-scroll tag="ul" :class="[navCls.b, navCls.m(size)]" :container-class="navCls.e('container')">
|
|
7
3
|
<!-- 常规 -->
|
|
8
4
|
<template v-if="!collapsed">
|
|
9
|
-
<template v-for="(
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
:menu="menu"
|
|
13
|
-
:parent-key="String(index)"
|
|
14
|
-
:depth="0"
|
|
15
|
-
/>
|
|
16
|
-
<UMenuItem v-else :menu="menu" :key="index" :depth="0" />
|
|
5
|
+
<template v-for="(item, index) of menus" :key="index">
|
|
6
|
+
<UNavSub v-if="item.children?.length" :item="item" :parent-key="String(index)" :depth="0" />
|
|
7
|
+
<UNavItem v-else :item="item" :key="index" :depth="0" />
|
|
17
8
|
</template>
|
|
18
9
|
</template>
|
|
19
10
|
|
|
20
11
|
<!-- 折叠 -->
|
|
21
12
|
<template v-else>
|
|
22
|
-
<template v-for="(
|
|
23
|
-
<
|
|
24
|
-
v-if="
|
|
25
|
-
:
|
|
13
|
+
<template v-for="(item, index) of menus" :key="index">
|
|
14
|
+
<UNavSubCollapsed
|
|
15
|
+
v-if="item.children?.length"
|
|
16
|
+
:item="item"
|
|
26
17
|
:parent-key="String(index)"
|
|
27
18
|
:depth="0"
|
|
28
19
|
/>
|
|
29
|
-
<
|
|
20
|
+
<UNavItemCollapsed v-else :item="item" :key="index" :depth="0" />
|
|
30
21
|
</template>
|
|
31
22
|
</template>
|
|
32
23
|
</u-scroll>
|
|
@@ -35,32 +26,29 @@
|
|
|
35
26
|
<script lang="ts" setup>
|
|
36
27
|
import { useFallbackProps } from '@veltra/compositions'
|
|
37
28
|
import { bem, ExpandTransition } from '@veltra/utils'
|
|
29
|
+
import type { ComponentSize } from '@veltra/utils'
|
|
38
30
|
import { computed, provide, shallowReactive, watch } from 'vue'
|
|
39
31
|
|
|
40
|
-
import type {
|
|
32
|
+
import type { NavEmits, NavProps } from '../../types/nav'
|
|
41
33
|
import { UScroll } from '../scroll'
|
|
42
|
-
import {
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const props = withDefaults(defineProps<MenuProps>(), {
|
|
52
|
-
expand: false,
|
|
53
|
-
activeIndex: '',
|
|
54
|
-
collapsed: false,
|
|
55
|
-
uniqueOpened: false
|
|
56
|
-
})
|
|
34
|
+
import { NavDIKey } from './di'
|
|
35
|
+
import { collectNavBranchPaths } from './helper'
|
|
36
|
+
import UNavItemCollapsed from './nav-item-collapsed.vue'
|
|
37
|
+
import UNavItem from './nav-item.vue'
|
|
38
|
+
import UNavSubCollapsed from './nav-sub-collapsed.vue'
|
|
39
|
+
import UNavSub from './nav-sub.vue'
|
|
40
|
+
import { walkNavWithPath } from './walk-nav-path'
|
|
41
|
+
|
|
42
|
+
defineOptions({ name: 'Nav' })
|
|
57
43
|
|
|
58
|
-
const
|
|
44
|
+
const props = withDefaults(defineProps<NavProps>(), { collapsed: false })
|
|
59
45
|
|
|
60
|
-
const
|
|
61
|
-
const collapsedCls = bem('collapsed-menu')
|
|
46
|
+
const emit = defineEmits<NavEmits>()
|
|
62
47
|
|
|
63
|
-
const
|
|
48
|
+
const cls = bem('nav')
|
|
49
|
+
const collapsedCls = bem('collapsed-nav')
|
|
50
|
+
|
|
51
|
+
const navCls = computed(() => {
|
|
64
52
|
return props.collapsed ? collapsedCls : cls
|
|
65
53
|
})
|
|
66
54
|
|
|
@@ -81,7 +69,7 @@ watch(
|
|
|
81
69
|
([currentPath, menus]) => {
|
|
82
70
|
if (!currentPath || !menus) return
|
|
83
71
|
menus.forEach((menu) => {
|
|
84
|
-
|
|
72
|
+
walkNavWithPath(menu, (node, nodePath) => {
|
|
85
73
|
if (node.path === currentPath) {
|
|
86
74
|
nodePath.slice(0, -1).forEach((path) => {
|
|
87
75
|
expandedPath.add(path.path)
|
|
@@ -94,13 +82,25 @@ watch(
|
|
|
94
82
|
{ immediate: true }
|
|
95
83
|
)
|
|
96
84
|
|
|
97
|
-
provide(
|
|
85
|
+
provide(NavDIKey, {
|
|
98
86
|
cls,
|
|
99
87
|
collapsedCls,
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
navProps: props,
|
|
89
|
+
navEmit: emit,
|
|
102
90
|
expandedPath,
|
|
103
91
|
size,
|
|
104
92
|
expandTransition
|
|
105
93
|
})
|
|
94
|
+
|
|
95
|
+
function expandAll() {
|
|
96
|
+
collectNavBranchPaths(props.menus).forEach((path) => {
|
|
97
|
+
expandedPath.add(path)
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function collapseAll() {
|
|
102
|
+
expandedPath.clear()
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
defineExpose({ expandAll, collapseAll })
|
|
106
106
|
</script>
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
@use 'pkg:@veltra/styles/vars';
|
|
4
4
|
|
|
5
5
|
// 方便拼接
|
|
6
|
-
$root-name:
|
|
7
|
-
$collapsed-
|
|
6
|
+
$root-name: nav;
|
|
7
|
+
$collapsed-nav: collapsed-nav;
|
|
8
8
|
|
|
9
|
-
@include m.b($root-name, $collapsed-
|
|
9
|
+
@include m.b($root-name, $collapsed-nav) {
|
|
10
10
|
user-select: none;
|
|
11
|
-
color: var(--u-
|
|
11
|
+
color: var(--u-nav-color);
|
|
12
12
|
|
|
13
13
|
@include m.e(item, sub, sub-list) {
|
|
14
14
|
list-style: none;
|
|
@@ -28,8 +28,8 @@ $collapsed-menu: collapsed-menu;
|
|
|
28
28
|
@include m.flex;
|
|
29
29
|
|
|
30
30
|
&:hover {
|
|
31
|
-
background-color: var(--u-
|
|
32
|
-
color: var(--u-
|
|
31
|
+
background-color: var(--u-nav-hover-bg);
|
|
32
|
+
color: var(--u-nav-hover-color);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
@include m.is(expanded, branch-active) {
|
|
@@ -38,8 +38,8 @@ $collapsed-menu: collapsed-menu;
|
|
|
38
38
|
|
|
39
39
|
@include m.is(active) {
|
|
40
40
|
position: relative;
|
|
41
|
-
background-color: var(--u-
|
|
42
|
-
color: var(--u-
|
|
41
|
+
background-color: var(--u-nav-active-bg);
|
|
42
|
+
color: var(--u-nav-active-color);
|
|
43
43
|
|
|
44
44
|
&::before {
|
|
45
45
|
content: '';
|
|
@@ -55,7 +55,9 @@ $collapsed-menu: collapsed-menu;
|
|
|
55
55
|
pointer-events: none;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
}
|
|
58
59
|
|
|
60
|
+
@include m.e(item) {
|
|
59
61
|
@include m.is(disabled) {
|
|
60
62
|
opacity: 0.55;
|
|
61
63
|
cursor: not-allowed;
|
|
@@ -84,7 +86,7 @@ $collapsed-menu: collapsed-menu;
|
|
|
84
86
|
|
|
85
87
|
#{$b}__item,
|
|
86
88
|
#{$b}__sub-content {
|
|
87
|
-
min-height: var(--u-
|
|
89
|
+
min-height: var(--u-nav-height-#{$size});
|
|
88
90
|
border-radius: calc(fn.use-var(radius, $size) + 4px);
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -104,10 +106,10 @@ $collapsed-menu: collapsed-menu;
|
|
|
104
106
|
@include m.b($root-name) {
|
|
105
107
|
margin: 0;
|
|
106
108
|
padding: 0;
|
|
107
|
-
background-color: var(--u-
|
|
109
|
+
background-color: var(--u-nav-bg-color);
|
|
108
110
|
backdrop-filter: fn.use-var(bg-filter);
|
|
109
111
|
-webkit-backdrop-filter: fn.use-var(bg-filter);
|
|
110
|
-
background-image: var(--u-
|
|
112
|
+
background-image: var(--u-nav-bg-image);
|
|
111
113
|
background-size: cover;
|
|
112
114
|
background-repeat: no-repeat;
|
|
113
115
|
border: 1px solid fn.use-var(border, color);
|
|
@@ -170,7 +172,7 @@ $collapsed-menu: collapsed-menu;
|
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
@include m.b($collapsed-
|
|
175
|
+
@include m.b($collapsed-nav) {
|
|
174
176
|
margin: 0;
|
|
175
177
|
padding: 0;
|
|
176
178
|
|
|
@@ -184,7 +186,7 @@ $collapsed-menu: collapsed-menu;
|
|
|
184
186
|
@include m.is(first-level) {
|
|
185
187
|
justify-content: center;
|
|
186
188
|
|
|
187
|
-
@include m.bem($collapsed-
|
|
189
|
+
@include m.bem($collapsed-nav, icon) {
|
|
188
190
|
margin-right: 0;
|
|
189
191
|
}
|
|
190
192
|
}
|
|
@@ -212,7 +214,7 @@ $collapsed-menu: collapsed-menu;
|
|
|
212
214
|
@include m.e(panel) {
|
|
213
215
|
min-width: 240px;
|
|
214
216
|
padding: 8px !important;
|
|
215
|
-
background-color: var(--u-
|
|
217
|
+
background-color: var(--u-nav-bg-color);
|
|
216
218
|
backdrop-filter: fn.use-var(bg-filter);
|
|
217
219
|
-webkit-backdrop-filter: fn.use-var(bg-filter);
|
|
218
220
|
border: 1px solid fn.use-var(border, color);
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { scrollIntoContainerView, type BEM } from '@veltra/utils'
|
|
2
2
|
import { computed, inject, watch, type ShallowRef, type ComputedRef } from 'vue'
|
|
3
3
|
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
4
|
+
import type { NavItem } from '../../types'
|
|
5
|
+
import { NavDIKey } from './di'
|
|
6
6
|
|
|
7
7
|
interface Options {
|
|
8
|
-
itemProps: {
|
|
8
|
+
itemProps: { item: NavItem; depth: number }
|
|
9
9
|
itemRef: ShallowRef<HTMLElement | null>
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
interface
|
|
13
|
-
cls: BEM<'
|
|
14
|
-
collapsedCls: BEM<'collapsed-
|
|
12
|
+
interface UseNavItemReturned {
|
|
13
|
+
cls: BEM<'nav'>
|
|
14
|
+
collapsedCls: BEM<'collapsed-nav'>
|
|
15
15
|
|
|
16
16
|
active: ComputedRef<boolean>
|
|
17
|
-
|
|
17
|
+
handleClickItem: () => void
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function
|
|
20
|
+
export function useNavItem(options: Options): UseNavItemReturned {
|
|
21
21
|
const { itemProps, itemRef } = options
|
|
22
|
-
const { cls, collapsedCls,
|
|
22
|
+
const { cls, collapsedCls, navProps, navEmit } = inject(NavDIKey)!
|
|
23
23
|
|
|
24
24
|
const active = computed(() => {
|
|
25
|
-
return
|
|
25
|
+
return navProps.currentPath === itemProps.item.path
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
let changedByClick = false
|
|
@@ -35,10 +35,10 @@ export function useMenuItem(options: Options): UseMenuItemReturned {
|
|
|
35
35
|
scrollIntoContainerView(itemEl, null)
|
|
36
36
|
})
|
|
37
37
|
|
|
38
|
-
function
|
|
39
|
-
if (itemProps.
|
|
38
|
+
function handleClickItem() {
|
|
39
|
+
if (itemProps.item.disabled) return
|
|
40
40
|
changedByClick = true
|
|
41
|
-
|
|
41
|
+
navEmit('item-click', itemProps.item)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
return {
|
|
@@ -46,6 +46,6 @@ export function useMenuItem(options: Options): UseMenuItemReturned {
|
|
|
46
46
|
collapsedCls,
|
|
47
47
|
|
|
48
48
|
active,
|
|
49
|
-
|
|
49
|
+
handleClickItem
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 深度优先 + 路径;回调返回 `false` 时剪枝当前节点子树(不中断兄弟)。
|
|
3
3
|
* `@cat-kit/core` 的 `dfs` 在返回 `true` 时会终止整段遍历,语义不同,故保留此辅助。
|
|
4
4
|
*/
|
|
5
|
-
export function
|
|
5
|
+
export function walkNavWithPath<T extends Record<string, unknown>>(
|
|
6
6
|
data: T,
|
|
7
7
|
cb: (node: T, path: T[]) => void | false,
|
|
8
8
|
childrenKey = 'children',
|
|
@@ -13,6 +13,6 @@ export function walkMenuWithPath<T extends Record<string, unknown>>(
|
|
|
13
13
|
const raw = data[childrenKey]
|
|
14
14
|
if (!Array.isArray(raw)) return
|
|
15
15
|
for (let i = 0; i < raw.length; i++) {
|
|
16
|
-
|
|
16
|
+
walkNavWithPath(raw[i] as T, cb, childrenKey, path)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -68,14 +68,14 @@ $root-name: select;
|
|
|
68
68
|
@include m.ellipsis;
|
|
69
69
|
|
|
70
70
|
&:hover {
|
|
71
|
-
background-color: var(--u-
|
|
72
|
-
color: var(--u-
|
|
71
|
+
background-color: var(--u-nav-hover-bg);
|
|
72
|
+
color: var(--u-nav-hover-color);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
@include m.is(selected) {
|
|
76
76
|
position: relative;
|
|
77
|
-
background-color: var(--u-
|
|
78
|
-
color: var(--u-
|
|
77
|
+
background-color: var(--u-nav-active-bg);
|
|
78
|
+
color: var(--u-nav-active-color);
|
|
79
79
|
font-weight: 600;
|
|
80
80
|
|
|
81
81
|
&::before {
|
package/src/style.ts
CHANGED
|
@@ -37,7 +37,8 @@ import './components/input/style'
|
|
|
37
37
|
import './components/layout/style'
|
|
38
38
|
import './components/list/style'
|
|
39
39
|
import './components/loading/style'
|
|
40
|
-
import './components/
|
|
40
|
+
import './components/dual-nav/style'
|
|
41
|
+
import './components/nav/style'
|
|
41
42
|
import './components/message-confirm/style'
|
|
42
43
|
import './components/message/style'
|
|
43
44
|
import './components/multi-select/style'
|
|
@@ -9,6 +9,8 @@ export interface AutoCompleteProps extends FormComponentProps {
|
|
|
9
9
|
suggestions?: string[] | (() => Promise<string[]> | string[])
|
|
10
10
|
/** 是否可清空 */
|
|
11
11
|
clearable?: boolean
|
|
12
|
+
/** 是否允许输入不在建议列表中的自定义值 */
|
|
13
|
+
allowCustom?: boolean
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** 自动补全组件组件定义的事件 */
|
|
@@ -18,7 +20,10 @@ export interface AutoCompleteEmits {
|
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
/** 自动补全组件组件暴露的属性和方法(组件内部使用) */
|
|
21
|
-
export interface _AutoCompleteExposed {
|
|
23
|
+
export interface _AutoCompleteExposed {
|
|
24
|
+
open: () => void
|
|
25
|
+
close: () => void
|
|
26
|
+
}
|
|
22
27
|
|
|
23
28
|
/** 自动补全组件组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
24
29
|
export type AutoCompleteExposed = DeconstructValue<_AutoCompleteExposed>
|
package/src/types/batch-edit.ts
CHANGED
|
@@ -18,6 +18,9 @@ export interface BatchEditColumn extends TableColumn {
|
|
|
18
18
|
|
|
19
19
|
export type BatchEditFeature = 'create' | 'update' | 'copy' | 'delete' | 'view' | 'createChild'
|
|
20
20
|
|
|
21
|
+
/** 批量编辑模式 */
|
|
22
|
+
export type BatchEditMode = 'normal' | 'quick'
|
|
23
|
+
|
|
21
24
|
/** 批量编辑组件属性 */
|
|
22
25
|
export interface BatchEditProps extends TableProps {
|
|
23
26
|
/**
|
|
@@ -33,13 +36,27 @@ export interface BatchEditProps extends TableProps {
|
|
|
33
36
|
cols?: string | [string, string]
|
|
34
37
|
/** 只读模式 */
|
|
35
38
|
readonly?: boolean
|
|
39
|
+
/**
|
|
40
|
+
* 编辑模式
|
|
41
|
+
* @default 'normal'
|
|
42
|
+
* @description `quick` 模式下编辑行时表单直接绑定 `row.data` 实时更新,且不调用 `saveMethod`
|
|
43
|
+
*/
|
|
44
|
+
mode?: BatchEditMode
|
|
45
|
+
/**
|
|
46
|
+
* 新增前的钩子
|
|
47
|
+
* @description 仅作用于 create 类操作。`normal` 模式在保存时调用;`quick` 模式在点击新增类按钮时立即调用。可直接修改传入的 draft 对象
|
|
48
|
+
*/
|
|
49
|
+
beforeCreate?: (
|
|
50
|
+
data: Record<string, any>,
|
|
51
|
+
parentData?: Record<string, any>
|
|
52
|
+
) => void | Promise<void>
|
|
36
53
|
/** label的宽度 */
|
|
37
54
|
labelWidth?: string | number
|
|
38
55
|
/** 删除方法 */
|
|
39
56
|
deleteMethod?: (data: Record<string, any>[]) => any
|
|
40
57
|
/**
|
|
41
58
|
* 保存方法
|
|
42
|
-
* @description
|
|
59
|
+
* @description 仅在 `normal` 模式下、保存时调用(create / update)
|
|
43
60
|
* @returns 如果返回一个值,那么这个值会被插入,否则插入的为表单值
|
|
44
61
|
*/
|
|
45
62
|
saveMethod?: (
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
import type { NavItem } from './nav'
|
|
4
|
+
|
|
5
|
+
/** 双栏导航根级应用项;`description` 在左轨 tooltip 与右栏顶部展示 */
|
|
6
|
+
export interface DualNavRootItem extends NavItem {
|
|
7
|
+
/** 子导航 */
|
|
8
|
+
children?: NavItem[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** 双栏导航组件属性 */
|
|
12
|
+
export interface DualNavProps {
|
|
13
|
+
/** 当前路径 */
|
|
14
|
+
currentPath?: string
|
|
15
|
+
/** 根级应用导航列表 */
|
|
16
|
+
menus?: DualNavRootItem[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 双栏导航组件定义的事件 */
|
|
20
|
+
export interface DualNavEmits {
|
|
21
|
+
(e: 'item-click', item: NavItem): void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 双栏导航组件暴露的属性和方法(组件内部使用) */
|
|
25
|
+
export interface _DualNavExposed {}
|
|
26
|
+
|
|
27
|
+
/** 双栏导航组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
28
|
+
export type DualNavExposed = DeconstructValue<_DualNavExposed>
|
package/src/types/index.ts
CHANGED
|
@@ -47,7 +47,8 @@ export * from './text'
|
|
|
47
47
|
export * from './checkbox-group'
|
|
48
48
|
export * from './table-editor'
|
|
49
49
|
export * from './table'
|
|
50
|
-
export * from './
|
|
50
|
+
export * from './nav'
|
|
51
|
+
export * from './dual-nav'
|
|
51
52
|
export * from './password-input'
|
|
52
53
|
export * from './date-picker'
|
|
53
54
|
export * from './dropdown'
|
package/src/types/loading.ts
CHANGED
package/src/types/nav.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
import type { DefineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
/** 导航项 */
|
|
5
|
+
export interface NavItem {
|
|
6
|
+
/** 图标 */
|
|
7
|
+
icon?: string | DefineComponent
|
|
8
|
+
/** 导航标题 */
|
|
9
|
+
title: string
|
|
10
|
+
/** 导航路径 */
|
|
11
|
+
path: string
|
|
12
|
+
/**
|
|
13
|
+
* 应用描述;仅根级导航项有效,在 UDualNav 左轨 tooltip 与右栏顶部展示
|
|
14
|
+
* @see DualNavRootItem
|
|
15
|
+
*/
|
|
16
|
+
description?: string
|
|
17
|
+
/** 是否禁用 */
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
/** 子导航 */
|
|
20
|
+
children?: NavItem[]
|
|
21
|
+
|
|
22
|
+
[key: string]: any
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 导航组件属性 */
|
|
26
|
+
export interface NavProps {
|
|
27
|
+
/** 当前路径 */
|
|
28
|
+
currentPath?: string
|
|
29
|
+
/** 是否折叠 */
|
|
30
|
+
collapsed?: boolean
|
|
31
|
+
/** 导航列表 */
|
|
32
|
+
menus?: NavItem[]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 导航组件定义的事件 */
|
|
36
|
+
export interface NavEmits {
|
|
37
|
+
(e: 'item-click', item: NavItem): void
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** 导航组件暴露的属性和方法(组件内部使用) */
|
|
41
|
+
export interface _NavExposed {
|
|
42
|
+
/** 展开所有含子级的导航项 */
|
|
43
|
+
expandAll: () => void
|
|
44
|
+
/** 折叠所有导航项 */
|
|
45
|
+
collapseAll: () => void
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 导航组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
49
|
+
export type NavExposed = DeconstructValue<_NavExposed>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"di.js","names":[],"sources":["../../../src/components/menu/di.ts"],"sourcesContent":["import { type BEM, ExpandTransition } from '@veltra/utils'\nimport type { ComputedRef, InjectionKey } from 'vue'\n\nimport type { MenuProps, MenuEmits } from '../../types'\nimport type { ComponentSize } from '../../types'\n\nexport interface MenuContext {\n cls: BEM<'menu', 'u-'>\n collapsedCls: BEM<'collapsed-menu', 'u-'>\n menuProps: MenuProps\n menuEmit: MenuEmits\n expandedPath: Set<string>\n size: ComputedRef<ComponentSize>\n expandTransition: ExpandTransition\n}\n\nexport const MenuDIKey: InjectionKey<MenuContext> = Symbol('MenuDIKey')\n"],"mappings":";;AAgBA,MAAa,YAAuC,OAAO,WAAW"}
|