Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ebf73b2d
authored
Jul 14, 2024
by
vben
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refactor(project): remove the use of core internal bem syntax
1 parent
fed422e1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
191 additions
and
144 deletions
apps/web-antd/package.json
apps/web-antd/src/views/dashboard/analytics/index.vue
packages/@core/forward/stores/src/modules/tabbar.ts
packages/@core/shared/hooks/package.json
packages/@core/shared/hooks/src/index.ts
packages/@core/shared/toolkit/src/namespace.ts → packages/@core/shared/hooks/src/use-namespace.ts
packages/@core/shared/hooks/src/use-sortable.test.ts
packages/@core/shared/toolkit/src/index.ts
packages/@core/shared/typings/src/basic.d.ts
packages/@core/shared/typings/src/tabs.ts
packages/@core/ui-kit/menu-ui/build.config.ts
packages/@core/ui-kit/menu-ui/package.json
packages/@core/ui-kit/menu-ui/src/components/menu-item.vue
packages/@core/ui-kit/menu-ui/src/components/menu.vue
packages/@core/ui-kit/menu-ui/src/components/normal-menu/normal-menu.vue
packages/@core/ui-kit/menu-ui/src/components/sub-menu-content.vue
packages/@core/ui-kit/menu-ui/src/components/sub-menu.vue
packages/@core/ui-kit/menu-ui/src/index.ts
packages/@core/ui-kit/menu-ui/src/menu.vue
packages/@core/ui-kit/menu-ui/src/styles/index.scss
packages/@core/ui-kit/menu-ui/vite.config.mts
packages/@core/ui-kit/shadcn-ui/src/index.ts
packages/@core/ui-kit/tabs-ui/package.json
packages/@core/ui-kit/tabs-ui/src/components/index.ts
packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue
packages/@core/ui-kit/tabs-ui/src/components/tabs/index.vue
packages/@core/ui-kit/tabs-ui/src/components/tabs/tabs.vue
packages/@core/ui-kit/tabs-ui/src/tabs-view.vue
packages/@core/ui-kit/tabs-ui/src/types.ts
packages/effects/common-ui/package.json
packages/effects/common-ui/src/authentication/login-expired-modal.vue
packages/effects/common-ui/src/dashboard/analysis/analysis-charts-tabs.vue
packages/effects/layouts/src/basic/tabbar/use-tabs.ts
packages/effects/layouts/src/widgets/theme-toggle/theme-button.vue
packages/hooks/package.json
packages/hooks/src/index.ts
pnpm-lock.yaml
apps/web-antd/package.json
View file @
ebf73b2
...
...
@@ -35,6 +35,7 @@
"@vben/chart-ui"
:
"workspace:*"
,
"@vben/common-ui"
:
"workspace:*"
,
"@vben/constants"
:
"workspace:*"
,
"@vben/hooks"
:
"workspace:*"
,
"@vben/icons"
:
"workspace:*"
,
"@vben/layouts"
:
"workspace:*"
,
"@vben/styles"
:
"workspace:*"
,
...
...
apps/web-antd/src/views/dashboard/analytics/index.vue
View file @
ebf73b2
<
script
lang=
"ts"
setup
>
import
type
{
AnalysisOverviewItem
}
from
'@vben/common-ui'
;
import
type
{
Tab
s
Option
}
from
'@vben/types'
;
import
type
{
TabOption
}
from
'@vben/types'
;
import
{
AnalysisChartCard
,
...
...
@@ -53,7 +53,7 @@ const overviewItems: AnalysisOverviewItem[] = [
},
];
const
chartTabs
:
Tab
s
Option
[]
=
[
const
chartTabs
:
TabOption
[]
=
[
{
label
:
'流量趋势'
,
value
:
'trends'
,
...
...
packages/@core/forward/stores/src/modules/tabbar.ts
View file @
ebf73b2
import
type
{
Tab
Item
}
from
'@vben-core/typings'
;
import
type
{
Tab
Definition
}
from
'@vben-core/typings'
;
import
type
{
RouteRecordNormalized
,
Router
}
from
'vue-router'
;
import
{
toRaw
}
from
'vue'
;
...
...
@@ -27,7 +27,7 @@ interface TabsState {
/**
* @zh_CN 当前打开的标签页列表
*/
tabs
:
Tab
Item
[];
tabs
:
Tab
Definition
[];
}
/**
...
...
@@ -49,7 +49,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @zh_CN 关闭标签页
* @param tab
*/
_close
(
tab
:
Tab
Item
)
{
_close
(
tab
:
Tab
Definition
)
{
const
{
fullPath
}
=
tab
;
if
(
isAffixTab
(
tab
))
{
return
;
...
...
@@ -72,7 +72,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @zh_CN 跳转到标签页
* @param tab
*/
async
_goToTab
(
tab
:
Tab
Item
,
router
:
Router
)
{
async
_goToTab
(
tab
:
Tab
Definition
,
router
:
Router
)
{
const
{
params
,
path
,
query
}
=
tab
;
const
toParams
=
{
params
:
params
||
{},
...
...
@@ -85,7 +85,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @zh_CN 添加标签页
* @param routeTab
*/
addTab
(
routeTab
:
Tab
Item
)
{
addTab
(
routeTab
:
Tab
Definition
)
{
const
tab
=
cloneTab
(
routeTab
);
if
(
!
isTabShown
(
tab
))
{
return
;
...
...
@@ -116,7 +116,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @zh_CN 关闭左侧标签页
* @param tab
*/
async
closeLeftTabs
(
tab
:
Tab
Item
)
{
async
closeLeftTabs
(
tab
:
Tab
Definition
)
{
const
index
=
this
.
tabs
.
findIndex
(
(
item
)
=>
getTabPath
(
item
)
===
getTabPath
(
tab
),
);
...
...
@@ -139,7 +139,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @zh_CN 关闭其他标签页
* @param tab
*/
async
closeOtherTabs
(
tab
:
Tab
Item
)
{
async
closeOtherTabs
(
tab
:
Tab
Definition
)
{
const
closePaths
=
this
.
tabs
.
map
((
item
)
=>
getTabPath
(
item
));
const
paths
:
string
[]
=
[];
...
...
@@ -162,7 +162,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @zh_CN 关闭右侧标签页
* @param tab
*/
async
closeRightTabs
(
tab
:
Tab
Item
)
{
async
closeRightTabs
(
tab
:
Tab
Definition
)
{
const
index
=
this
.
tabs
.
findIndex
(
(
item
)
=>
getTabPath
(
item
)
===
getTabPath
(
tab
),
);
...
...
@@ -185,7 +185,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @param tab
* @param router
*/
async
closeTab
(
tab
:
Tab
Item
,
router
:
Router
)
{
async
closeTab
(
tab
:
Tab
Definition
,
router
:
Router
)
{
const
{
currentRoute
}
=
router
;
// 关闭不是激活选项卡
...
...
@@ -230,7 +230,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @zh_CN 固定标签页
* @param tab
*/
async
pinTab
(
tab
:
Tab
Item
)
{
async
pinTab
(
tab
:
Tab
Definition
)
{
const
index
=
this
.
tabs
.
findIndex
(
(
item
)
=>
getTabPath
(
item
)
===
getTabPath
(
tab
),
);
...
...
@@ -282,7 +282,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
* @zh_CN 取消固定标签页
* @param tab
*/
async
unpinTab
(
tab
:
Tab
Item
)
{
async
unpinTab
(
tab
:
Tab
Definition
)
{
const
index
=
this
.
tabs
.
findIndex
(
(
item
)
=>
getTabPath
(
item
)
===
getTabPath
(
tab
),
);
...
...
@@ -318,7 +318,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
},
},
getters
:
{
affixTabs
():
Tab
Item
[]
{
affixTabs
():
Tab
Definition
[]
{
return
this
.
tabs
.
filter
((
tab
)
=>
isAffixTab
(
tab
));
},
getCachedTabs
():
string
[]
{
...
...
@@ -327,7 +327,7 @@ const useCoreTabbarStore = defineStore('core-tabbar', {
getExcludeCachedTabs
():
string
[]
{
return
[...
this
.
excludeCachedTabs
];
},
getTabs
():
Tab
Item
[]
{
getTabs
():
Tab
Definition
[]
{
const
affixTabs
=
this
.
tabs
.
filter
((
tab
)
=>
isAffixTab
(
tab
));
const
normalTabs
=
this
.
tabs
.
filter
((
tab
)
=>
!
isAffixTab
(
tab
));
return
[...
affixTabs
,
...
normalTabs
].
filter
(
Boolean
);
...
...
@@ -359,7 +359,7 @@ if (hot) {
* @zh_CN 克隆路由,防止路由被修改
* @param route
*/
function
cloneTab
(
route
:
Tab
Item
):
TabItem
{
function
cloneTab
(
route
:
Tab
Definition
):
TabDefinition
{
if
(
!
route
)
{
return
route
;
}
...
...
@@ -380,7 +380,7 @@ function cloneTab(route: TabItem): TabItem {
* @zh_CN 是否是固定标签页
* @param tab
*/
function
isAffixTab
(
tab
:
Tab
Item
)
{
function
isAffixTab
(
tab
:
Tab
Definition
)
{
return
tab
?.
meta
?.
affixTab
??
false
;
}
...
...
@@ -388,7 +388,7 @@ function isAffixTab(tab: TabItem) {
* @zh_CN 是否显示标签
* @param tab
*/
function
isTabShown
(
tab
:
Tab
Item
)
{
function
isTabShown
(
tab
:
Tab
Definition
)
{
return
!
tab
.
meta
.
hideInTab
;
}
...
...
@@ -396,8 +396,8 @@ function isTabShown(tab: TabItem) {
* @zh_CN 获取标签页路径
* @param tab
*/
function
getTabPath
(
tab
:
RouteRecordNormalized
|
Tab
Item
)
{
return
decodeURIComponent
((
tab
as
Tab
Item
).
fullPath
||
tab
.
path
);
function
getTabPath
(
tab
:
RouteRecordNormalized
|
Tab
Definition
)
{
return
decodeURIComponent
((
tab
as
Tab
Definition
).
fullPath
||
tab
.
path
);
}
function
routeToTab
(
route
:
RouteRecordNormalized
)
{
...
...
@@ -405,7 +405,7 @@ function routeToTab(route: RouteRecordNormalized) {
meta
:
route
.
meta
,
name
:
route
.
name
,
path
:
route
.
path
,
}
as
Tab
Item
;
}
as
Tab
Definition
;
}
export
{
useCoreTabbarStore
};
packages/@core/shared/hooks/package.json
View file @
ebf73b2
...
...
@@ -36,8 +36,8 @@
}
},
"dependencies"
:
{
"
sortablejs"
:
"^1.15.2
"
,
"
vue"
:
"^3.4.31
"
"
radix-vue"
:
"^1.9.1
"
,
"
sortablejs"
:
"^1.15.2
"
},
"devDependencies"
:
{
"@types/sortablejs"
:
"^1.15.8"
...
...
packages/@core/shared/hooks/src/index.ts
View file @
ebf73b2
export
*
from
'./use-namespace'
;
export
*
from
'./use-sortable'
;
export
{
useEmitAsProps
,
useForwardExpose
,
useForwardProps
,
useForwardPropsEmits
,
}
from
'radix-vue'
;
packages/@core/shared/
toolkit/src/
namespace.ts
→
packages/@core/shared/
hooks/src/use-
namespace.ts
View file @
ebf73b2
File moved
packages/@core/shared/hooks/src/use-sortable.test.ts
View file @
ebf73b2
...
...
@@ -6,7 +6,7 @@ import { useSortable } from './use-sortable';
describe
(
'useSortable'
,
()
=>
{
beforeEach
(()
=>
{
vi
.
mock
(
'sortablejs'
,
()
=>
({
vi
.
mock
(
'sortablejs
/modular/sortable.complete.esm.js
'
,
()
=>
({
default
:
{
create
:
vi
.
fn
(),
},
...
...
@@ -29,7 +29,10 @@ describe('useSortable', () => {
await
initializeSortable
();
// Import sortablejs to access the mocked create function
const
Sortable
=
await
import
(
'sortablejs'
);
const
Sortable
=
await
import
(
// @ts-expect-error - This is a dynamic import
'sortablejs/modular/sortable.complete.esm.js'
);
// Verify that Sortable.create was called with the correct parameters
expect
(
Sortable
.
default
.
create
).
toHaveBeenCalledTimes
(
1
);
...
...
packages/@core/shared/toolkit/src/index.ts
View file @
ebf73b2
...
...
@@ -6,7 +6,6 @@ export * from './dom';
export
*
from
'./inference'
;
export
*
from
'./letter'
;
export
*
from
'./merge'
;
export
*
from
'./namespace'
;
export
*
from
'./nprogress'
;
export
*
from
'./tree'
;
export
*
from
'./unique'
;
...
...
packages/@core/shared/typings/src/basic.d.ts
View file @
ebf73b2
...
...
@@ -5,7 +5,7 @@ interface BasicOption {
interface
SelectOption
extends
BasicOption
{}
interface
Tab
s
Option
extends
BasicOption
{}
interface
TabOption
extends
BasicOption
{}
interface
BasicUserInfo
{
/**
...
...
@@ -30,4 +30,4 @@ interface BasicUserInfo {
username
:
string
;
}
export
type
{
BasicOption
,
BasicUserInfo
,
SelectOption
,
Tab
s
Option
};
export
type
{
BasicOption
,
BasicUserInfo
,
SelectOption
,
TabOption
};
packages/@core/shared/typings/src/tabs.ts
View file @
ebf73b2
import
type
{
RouteLocationNormalized
}
from
'vue-router'
;
export
type
Tab
Item
=
RouteLocationNormalized
;
export
type
Tab
Definition
=
RouteLocationNormalized
;
packages/@core/ui-kit/menu-ui/build.config.ts
0 → 100644
View file @
ebf73b2
import
{
defineBuildConfig
}
from
'unbuild'
;
export
default
defineBuildConfig
({
clean
:
true
,
declaration
:
true
,
entries
:
[
{
builder
:
'mkdist'
,
input
:
'./src'
,
pattern
:
[
'**/*'
],
},
{
builder
:
'mkdist'
,
input
:
'./src'
,
loaders
:
[
'vue'
],
pattern
:
[
'**/*.vue'
],
},
// {
// builder: 'mkdist',
// format: 'cjs',
// input: './src',
// loaders: ['js'],
// pattern: ['**/*.ts'],
// },
{
builder
:
'mkdist'
,
format
:
'esm'
,
input
:
'./src'
,
loaders
:
[
'js'
],
pattern
:
[
'**/*.ts'
],
},
],
});
packages/@core/ui-kit/menu-ui/package.json
View file @
ebf73b2
...
...
@@ -11,7 +11,7 @@
"license"
:
"MIT"
,
"type"
:
"module"
,
"scripts"
:
{
"build"
:
"pnpm
vite
build"
,
"build"
:
"pnpm
un
build"
,
"prepublishOnly"
:
"npm run build"
},
"files"
:
[
...
...
@@ -37,7 +37,7 @@
}
},
"dependencies"
:
{
"@vben-core/
design
"
:
"workspace:*"
,
"@vben-core/
hooks
"
:
"workspace:*"
,
"@vben-core/iconify"
:
"workspace:*"
,
"@vben-core/shadcn-ui"
:
"workspace:*"
,
"@vben-core/toolkit"
:
"workspace:*"
,
...
...
packages/@core/ui-kit/menu-ui/src/components/menu-item.vue
View file @
ebf73b2
...
...
@@ -3,8 +3,8 @@ import type { MenuItemProps, MenuItemRegistered } from '../interface';
import
{
computed
,
onBeforeUnmount
,
onMounted
,
reactive
,
useSlots
}
from
'vue'
;
import
{
useNamespace
}
from
'@vben-core/hooks'
;
import
{
VbenIcon
,
VbenMenuBadge
,
VbenTooltip
}
from
'@vben-core/shadcn-ui'
;
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
import
{
useMenu
,
useMenuContext
,
useSubMenuContext
}
from
'../hooks'
;
...
...
packages/@core/ui-kit/menu-ui/src/components/menu.vue
View file @
ebf73b2
This diff is collapsed.
Click to expand it.
packages/@core/ui-kit/menu-ui/src/components/normal-menu/normal-menu.vue
View file @
ebf73b2
...
...
@@ -3,8 +3,8 @@ import type { MenuRecordRaw } from '@vben-core/typings';
import
type
{
NormalMenuProps
}
from
'./normal-menu'
;
import
{
useNamespace
}
from
'@vben-core/hooks'
;
import
{
VbenIcon
}
from
'@vben-core/shadcn-ui'
;
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
interface
Props
extends
NormalMenuProps
{}
...
...
@@ -58,9 +58,9 @@ function handleMouseenter(menu: MenuRecordRaw) {
</ul>
</template>
<
style
lang=
"scss"
scoped
>
@import
'@vben-core/design/bem'
;
$
namespace
:
vben
;
@include
b
(
'normal-menu'
)
{
.
#
{
$namespace
}
-normal-menu
{
--menu-item-margin-y
:
4px
;
--menu-item-margin-x
:
0px
;
--menu-item-padding-y
:
11px
;
...
...
@@ -70,18 +70,37 @@ function handleMouseenter(menu: MenuRecordRaw) {
height
:
calc
(
100%
-
4px
);
@include
is('rounded')
{
&.is-rounded
{
--menu-item-radius
:
6px
;
--menu-item-margin-x
:
8px
;
}
@include
is
(
'dark'
)
{
&
.is-dark
{
.#{$namespace
}
-normal-menu__item
{
color
:
hsl
(
var
(
--dark-foreground
)
/
80%
);
&:not(.is-active):hover
{
color
:
hsl
(
var
(
--primary-foreground
));
background-color
:
hsl
(
var
(
--menu-dark-background
));
}
}
}
&
.is-collapse
{
.#{$namespace
}
-normal-menu__name
{
width
:
0
;
height
:
0
;
margin-top
:
0
;
overflow
:
hidden
;
opacity
:
0
;
}
.
#
{
$namespace
}
-normal-menu__icon
{
font-size
:
20px
;
}
}
@include
e
(
'item'
)
{
&
__item
{
position
:
relative
;
display
:
flex
;
flex-direction
:
column
;
...
...
@@ -100,7 +119,7 @@ function handleMouseenter(menu: MenuRecordRaw) {
padding
0.15s
ease
,
border-color
0.15s
ease
;
@include
is('active')
{
&.is-active
{
font-weight
:
700
;
color
:
hsl
(
var
(
--primary-foreground
));
background-color
:
hsl
(
var
(
--primary
));
...
...
@@ -126,36 +145,13 @@ function handleMouseenter(menu: MenuRecordRaw) {
}
}
@include
is
(
'dark'
)
{
.
#
{
$namespace
}
-normal-menu__item
{
&:not(.is-active):hover
{
color
:
hsl
(
var
(
--primary-foreground
));
background-color
:
hsl
(
var
(
--menu-dark-background
));
}
}
}
@include
is
(
'collapse'
)
{
.
#
{
$namespace
}
-normal-menu__name
{
width
:
0
;
height
:
0
;
margin-top
:
0
;
overflow
:
hidden
;
opacity
:
0
;
}
.
#
{
$namespace
}
-normal-menu__icon
{
font-size
:
20px
;
}
}
@include
e
(
'icon'
)
{
&
__icon
{
max-height
:
20px
;
font-size
:
20px
;
transition
:
all
0.25s
ease
;
}
@include
e
(
'name'
)
{
&
__name
{
margin-top
:
8px
;
margin-bottom
:
0
;
font-size
:
12px
;
...
...
packages/@core/ui-kit/menu-ui/src/components/sub-menu-content.vue
View file @
ebf73b2
...
...
@@ -3,12 +3,12 @@ import type { MenuItemProps } from '../interface';
import
{
computed
}
from
'vue'
;
import
{
useNamespace
}
from
'@vben-core/hooks'
;
import
{
IcRoundChevronRight
,
IcRoundKeyboardArrowDown
,
}
from
'@vben-core/iconify'
;
import
{
VbenIcon
}
from
'@vben-core/shadcn-ui'
;
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
import
{
useMenuContext
}
from
'../hooks'
;
...
...
packages/@core/ui-kit/menu-ui/src/components/sub-menu.vue
View file @
ebf73b2
...
...
@@ -9,8 +9,8 @@ import type {
import
{
computed
,
onBeforeUnmount
,
onMounted
,
reactive
,
ref
}
from
'vue'
;
import
{
useNamespace
}
from
'@vben-core/hooks'
;
import
{
VbenHoverCard
}
from
'@vben-core/shadcn-ui'
;
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
import
{
createSubMenuContext
,
...
...
packages/@core/ui-kit/menu-ui/src/index.ts
View file @
ebf73b2
import
'./styles/index.scss'
;
export
*
from
'./components/normal-menu'
;
export
type
*
from
'./interface'
;
export
{
default
as
Menu
}
from
'./menu.vue'
;
packages/@core/ui-kit/menu-ui/src/menu.vue
View file @
ebf73b2
<
script
setup
lang=
"ts"
>
import
type
{
MenuRecordRaw
}
from
'@vben-core/typings'
;
import
{
useForwardProps
}
from
'@vben-core/
shadcn-ui
'
;
import
{
useForwardProps
}
from
'@vben-core/
hooks
'
;
import
{
Menu
}
from
'./components'
;
import
{
MenuProps
}
from
'./interface'
;
...
...
packages/@core/ui-kit/menu-ui/src/styles/index.scss
View file @
ebf73b2
@import
'@vben-core/design/bem'
;
$namespace
:
vben
;
.
#{
$namespace
}
-menu__popup-container
,
.
#{
$namespace
}
-menu
{
...
...
@@ -133,7 +133,7 @@
padding
0
.15s
ease
,
border-color
0
.15s
ease
;
@include
is
(
disabled
)
{
&
.is-disabled
{
cursor
:
not
-
allowed
;
background
:
none
!
important
;
opacity
:
0
.25
;
...
...
@@ -167,7 +167,7 @@
opacity
:
1
;
}
@include
b
(
'menu'
)
{
.
#{
$namespace
}
-menu
{
position
:
relative
;
box-sizing
:
border-box
;
padding-left
:
0
;
...
...
@@ -176,15 +176,13 @@
background
:
hsl
(
var
(
--
menu-background-color
));
// 垂直菜单
@include
is
(
'vertical'
)
{
&
{
&
.is-vertical
{
&
:not
(
.
#{
$namespace
}
-menu.is-collapse
)
{
&
.
#{
$namespace
}
-menu-item
,
&
.
#{
$namespace
}
-sub-menu-content
,
&
.
#{
$namespace
}
-menu-item-group__title
{
padding-left
:
calc
(
var
(
--
menu-item-indent
)
+
var
(
--
menu-level
)
*
var
(
--
menu-item-indent
)
var
(
--
menu-item-indent
)
+
var
(
--
menu-level
)
*
var
(
--
menu-item-indent
)
);
white-space
:
nowrap
;
}
...
...
@@ -217,9 +215,8 @@
}
}
}
}
@include
is
(
'horizontal'
)
{
&
.is-horizontal
{
display
:
flex
;
flex-wrap
:
nowrap
;
max-width
:
100%
;
...
...
@@ -287,7 +284,7 @@
}
// 折叠菜单
@include
is
(
'collapse'
)
{
&
.is-collapse
{
.
#{
$namespace
}
-menu__icon
{
margin-right
:
0
;
}
...
...
@@ -333,14 +330,14 @@
}
}
@include
e
(
'popup-container'
)
{
&
__popup-container
{
max-width
:
240px
;
height
:
unset
;
padding
:
0
;
background
:
var
(
--
menu-background-color
);
}
@include
e
(
'popup'
)
{
&
__popup
{
padding
:
4px
0
;
border-radius
:
var
(
--
menu-item-radius
);
...
...
@@ -350,7 +347,7 @@
}
}
@include
e
(
'icon'
)
{
&
__icon
{
flex-shrink
:
0
;
// width: var(--menu-item-icon-width);
max-height
:
var
(
--
menu-item-icon-width
);
...
...
@@ -361,27 +358,27 @@
}
}
@include
b
(
'menu-item'
)
{
.
#{
$namespace
}
-menu-item
{
fill
:
var
(
--
menu-item-color
);
stroke
:
var
(
--
menu-item-color
);
@include
menu-item
;
@include
is
(
active
)
{
&
.is-active
{
fill
:
var
(
--
menu-item-active-color
);
stroke
:
var
(
--
menu-item-active-color
);
@include
menu-item-active
;
}
@include
e
(
'content'
)
{
&
__content
{
display
:
inline-flex
;
align-items
:
center
;
width
:
100%
;
height
:
var
(
--
menu-item-height
);
}
@include
is
(
'collapse-show-title'
)
{
&
.is-collapse-show-title
{
padding
:
32px
0
!
important
;
// margin: 4px 8px !important;
.
#{
$namespace
}
-menu-tooltip__trigger
{
...
...
@@ -427,7 +424,7 @@
}
}
@include
b
(
'sub-menu'
)
{
.
#{
$namespace
}
-sub-menu
{
padding-left
:
0
;
margin
:
0
;
list-style
:
none
;
...
...
@@ -435,7 +432,7 @@
fill
:
var
(
--
menu-item-color
);
stroke
:
var
(
--
menu-item-color
);
@include
is
(
'active'
)
{
&
.is-active
{
div
[
data-state
=
'open'
]
>
.
#{
$namespace
}
-sub-menu-content
,
>
.
#{
$namespace
}
-sub-menu-content
{
color
:
var
(
--
menu-submenu-active-color
);
...
...
@@ -448,12 +445,12 @@
}
}
@include
b
(
'sub-menu-content'
)
{
.
#{
$namespace
}
-sub-menu-content
{
height
:
var
(
--
menu-item-height
);
@include
menu-item
;
@include
e
(
'icon-arrow'
)
{
&
__icon-arrow
{
position
:
absolute
;
top
:
50%
;
right
:
6px
;
...
...
@@ -466,11 +463,11 @@
transition
:
transform
0
.25s
ease
;
}
@include
e
(
'title'
)
{
&
__title
{
@include
menu-title
;
}
@include
is
(
'collapse-show-title'
)
{
&
.is-collapse-show-title
{
flex-direction
:
column
;
padding
:
32px
0
!
important
;
// margin: 4px 8px !important;
...
...
packages/@core/ui-kit/menu-ui/vite.config.mts
deleted
100644 → 0
View file @
fed422e
import { defineConfig } from '@vben/vite-config';
export default defineConfig();
packages/@core/ui-kit/shadcn-ui/src/index.ts
View file @
ebf73b2
import
'./styles/index.css'
;
export
*
from
'./components'
;
export
{
VisuallyHidden
,
useEmitAsProps
,
useForwardExpose
,
useForwardProps
,
useForwardPropsEmits
,
}
from
'radix-vue'
;
export
{
VisuallyHidden
}
from
'radix-vue'
;
packages/@core/ui-kit/tabs-ui/package.json
View file @
ebf73b2
...
...
@@ -37,7 +37,6 @@
}
},
"dependencies"
:
{
"@vben-core/design"
:
"workspace:*"
,
"@vben-core/hooks"
:
"workspace:*"
,
"@vben-core/iconify"
:
"workspace:*"
,
"@vben-core/shadcn-ui"
:
"workspace:*"
,
...
...
packages/@core/ui-kit/tabs-ui/src/components/index.ts
View file @
ebf73b2
export
{
default
as
Tabs
}
from
'./tabs/tabs.vue'
;
export
{
default
as
TabsChrome
}
from
'./tabs-chrome/tabs.vue'
;
packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue
View file @
ebf73b2
<
script
setup
lang=
"ts"
>
import
type
{
Tab
Item
}
from
'@vben-core/typings'
;
import
type
{
Tab
Definition
}
from
'@vben-core/typings'
;
import
type
{
TabsProps
}
from
'../../types'
;
import
type
{
Tab
Config
,
Tab
sProps
}
from
'../../types'
;
import
{
computed
,
nextTick
,
onMounted
,
ref
,
watch
}
from
'vue'
;
...
...
@@ -25,7 +25,7 @@ const props = withDefaults(defineProps<Props>(), {
tabs
:
()
=>
[],
});
const
emit
=
defineEmits
<
{
close
:
[
string
];
unpin
:
[
Tab
Item
]
}
>
();
const
emit
=
defineEmits
<
{
close
:
[
string
];
unpin
:
[
Tab
Definition
]
}
>
();
const
active
=
defineModel
<
string
>
(
'active'
);
const
contentRef
=
ref
();
...
...
@@ -56,12 +56,14 @@ const layout = () => {
tabWidth
.
value
=
width
;
};
const
tabsView
=
computed
(()
=>
{
const
tabsView
=
computed
(()
:
TabConfig
[]
=>
{
return
props
.
tabs
.
map
((
tab
)
=>
{
return
{
...
tab
,
affixTab
:
!!
tab
.
meta
?.
affixTab
,
closable
:
tab
.
meta
?.
tabClosable
??
true
,
closable
:
Reflect
.
has
(
tab
.
meta
,
'tabClosable'
)
?
!!
tab
.
meta
.
tabClosable
:
true
,
icon
:
tab
.
meta
.
icon
as
string
,
key
:
tab
.
fullPath
||
tab
.
path
,
title
:
(
tab
.
meta
?.
title
||
tab
.
name
)
as
string
,
...
...
@@ -85,7 +87,8 @@ onMounted(() => {
function
handleClose
(
key
:
string
)
{
emit
(
'close'
,
key
);
}
function
handleUnpinTab
(
tab
:
TabItem
)
{
function
handleUnpinTab
(
tab
:
TabConfig
)
{
emit
(
'unpin'
,
tab
);
}
</
script
>
...
...
packages/@core/ui-kit/tabs-ui/src/components/tabs/index.vue
deleted
100644 → 0
View file @
fed422e
<
script
lang=
"ts"
setup
></
script
>
<
template
>
<div></div>
</
template
>
packages/@core/ui-kit/tabs-ui/src/components/tabs/tabs.vue
0 → 100644
View file @
ebf73b2
<
script
lang=
"ts"
setup
>
import
{
VbenScrollbar
}
from
'@vben-core/shadcn-ui'
;
</
script
>
<
template
>
<div
class=
"bg-accent size-full"
>
<VbenScrollbar>
<slot></slot>
</VbenScrollbar>
</div>
</
template
>
packages/@core/ui-kit/tabs-ui/src/tabs-view.vue
View file @
ebf73b2
<
script
setup
lang=
"ts"
>
import
type
{
Tab
Item
}
from
'@vben-core/typings'
;
import
type
{
Tab
Definition
}
from
'@vben-core/typings'
;
import
{
nextTick
,
onMounted
}
from
'vue'
;
import
{
useSortable
}
from
'@vben-core/hooks'
;
import
{
useForwardPropsEmits
}
from
'@vben-core/shadcn-ui'
;
import
{
useForwardPropsEmits
,
useSortable
}
from
'@vben-core/hooks'
;
import
{
TabsChrome
}
from
'./components'
;
import
{
TabsProps
}
from
'./types'
;
...
...
@@ -23,7 +22,7 @@ const props = withDefaults(defineProps<Props>(), {
const
emit
=
defineEmits
<
{
close
:
[
string
];
sortTabs
:
[
number
,
number
];
unpin
:
[
Tab
Item
];
unpin
:
[
Tab
Definition
];
}
>
();
const
forward
=
useForwardPropsEmits
(
props
,
emit
);
...
...
packages/@core/ui-kit/tabs-ui/src/types.ts
View file @
ebf73b2
import
type
{
IContextMenuItem
}
from
'@vben-core/shadcn-ui'
;
import
type
{
Tab
Item
}
from
'@vben-core/typings'
;
import
type
{
Tab
Definition
}
from
'@vben-core/typings'
;
interface
TabsProps
{
/**
...
...
@@ -41,7 +41,15 @@ interface TabsProps {
/**
* @zh_CN 选项卡数据
*/
tabs
?:
Tab
Item
[];
tabs
?:
Tab
Definition
[];
}
export
type
{
TabsProps
};
interface
TabConfig
extends
TabDefinition
{
affixTab
:
boolean
;
closable
:
boolean
;
icon
:
string
;
key
:
string
;
title
:
string
;
}
export
type
{
TabConfig
,
TabsProps
};
packages/effects/common-ui/package.json
View file @
ebf73b2
...
...
@@ -37,6 +37,7 @@
}
},
"dependencies"
:
{
"@vben-core/hooks"
:
"workspace:*"
,
"@vben-core/iconify"
:
"workspace:*"
,
"@vben-core/locales"
:
"workspace:*"
,
"@vben-core/shadcn-ui"
:
"workspace:*"
,
...
...
packages/effects/common-ui/src/authentication/login-expired-modal.vue
View file @
ebf73b2
<
script
setup
lang=
"ts"
>
import
{
useForwardPropsEmits
}
from
'@vben-core/hooks'
;
import
{
Dialog
,
DialogContent
,
DialogDescription
,
DialogTitle
,
VisuallyHidden
,
useForwardPropsEmits
,
}
from
'@vben-core/shadcn-ui'
;
import
AuthenticationLogin
from
'./login.vue'
;
...
...
packages/effects/common-ui/src/dashboard/analysis/analysis-charts-tabs.vue
View file @
ebf73b2
<
script
setup
lang=
"ts"
>
import
type
{
Tab
s
Option
}
from
'@vben/types'
;
import
type
{
TabOption
}
from
'@vben/types'
;
import
{
computed
}
from
'vue'
;
import
{
Tabs
,
TabsContent
,
TabsList
,
TabsTrigger
}
from
'@vben-core/shadcn-ui'
;
interface
Props
{
tabs
:
Tab
s
Option
[];
tabs
:
TabOption
[];
}
defineOptions
({
...
...
packages/effects/layouts/src/basic/tabbar/use-tabs.ts
View file @
ebf73b2
import
type
{
IContextMenuItem
}
from
'@vben-core/tabs-ui'
;
import
type
{
Tab
Item
}
from
'@vben-core/typings'
;
import
type
{
Tab
Definition
}
from
'@vben-core/typings'
;
import
type
{
RouteLocationNormalized
,
RouteLocationNormalizedGeneric
,
...
...
@@ -105,7 +105,7 @@ function useTabs() {
{
immediate
:
true
},
);
const
createContextMenus
=
(
tab
:
Tab
Item
)
=>
{
const
createContextMenus
=
(
tab
:
Tab
Definition
)
=>
{
const
tabs
=
coreTabbarStore
.
getTabs
;
const
affixTabs
=
coreTabbarStore
.
affixTabs
;
const
index
=
tabs
.
findIndex
((
item
)
=>
item
.
path
===
tab
.
path
);
...
...
@@ -228,7 +228,7 @@ function useTabs() {
/**
* 取消固定标签页
*/
const
handleUnpinTab
=
async
(
tab
:
Tab
Item
)
=>
{
const
handleUnpinTab
=
async
(
tab
:
Tab
Definition
)
=>
{
await
coreTabbarStore
.
unpinTab
(
tab
);
};
...
...
packages/effects/layouts/src/widgets/theme-toggle/theme-button.vue
View file @
ebf73b2
...
...
@@ -2,7 +2,6 @@
import
{
computed
,
nextTick
}
from
'vue'
;
import
{
VbenButton
}
from
'@vben-core/shadcn-ui'
;
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
interface
Props
{
/**
...
...
@@ -21,8 +20,6 @@ const props = withDefaults(defineProps<Props>(), {
const
isDark
=
defineModel
<
boolean
>
();
const
{
b
,
e
,
is
}
=
useNamespace
(
'theme-toggle'
);
const
theme
=
computed
(()
=>
{
return
isDark
.
value
?
'light'
:
'dark'
;
});
...
...
@@ -86,7 +83,7 @@ function toggleTheme(event: MouseEvent) {
<
template
>
<VbenButton
:aria-label=
"theme"
:class=
"[
b(), is(theme),
`is-$
{theme}`]"
:class=
"[`is-$
{theme}`]"
aria-live="polite"
class="theme-toggle cursor-pointer border-none bg-none"
v-bind="bindProps"
...
...
@@ -95,7 +92,6 @@ function toggleTheme(event: MouseEvent) {
<svg
aria-hidden=
"true"
height=
"24"
viewBox=
"0 0 24 24"
width=
"24"
>
<mask
id=
"theme-toggle-moon"
:class=
"e('moon')"
class=
"theme-toggle__moon"
fill=
"hsl(var(--foreground)/80%)"
stroke=
"none"
...
...
@@ -105,14 +101,13 @@ function toggleTheme(event: MouseEvent) {
</mask>
<circle
id=
"sun"
:class=
"e('sun')"
class=
"theme-toggle__sun"
cx=
"12"
cy=
"12"
mask=
"url(#theme-toggle-moon)"
r=
"11"
/>
<g
:class=
"e('sun-beams')"
class=
"theme-toggle__sun-beams"
>
<g
class=
"theme-toggle__sun-beams"
>
<line
x1=
"12"
x2=
"12"
y1=
"1"
y2=
"3"
/>
<line
x1=
"12"
x2=
"12"
y1=
"21"
y2=
"23"
/>
<line
x1=
"4.22"
x2=
"5.64"
y1=
"4.22"
y2=
"5.64"
/>
...
...
packages/hooks/package.json
View file @
ebf73b2
...
...
@@ -36,5 +36,8 @@
"default"
:
"./dist/index.mjs"
}
}
},
"dependencies"
:
{
"@vben-core/hooks"
:
"workspace:*"
}
}
packages/hooks/src/index.ts
View file @
ebf73b2
export
{}
;
export
*
from
'@vben-core/hooks'
;
pnpm-lock.yaml
View file @
ebf73b2
...
...
@@ -210,6 +210,9 @@ importers:
'
@vben/constants'
:
specifier
:
workspace:*
version
:
link:../../packages/constants
'
@vben/hooks'
:
specifier
:
workspace:*
version
:
link:../../packages/hooks
'
@vben/icons'
:
specifier
:
workspace:*
version
:
link:../../packages/icons
...
...
@@ -655,12 +658,12 @@ importers:
packages/@core/shared/hooks
:
dependencies
:
radix-vue
:
specifier
:
^1.9.1
version
:
1.9.1(vue@3.4.31(typescript@5.5.3))
sortablejs
:
specifier
:
^1.15.2
version
:
1.15.2
vue
:
specifier
:
^3.4.31
version
:
3.4.31(typescript@5.5.3)
devDependencies
:
'
@types/sortablejs'
:
specifier
:
^1.15.8
...
...
@@ -741,9 +744,9 @@ importers:
packages/@core/ui-kit/menu-ui
:
dependencies
:
'
@vben-core/
design
'
:
'
@vben-core/
hooks
'
:
specifier
:
workspace:*
version
:
link:../../shared/
design
version
:
link:../../shared/
hooks
'
@vben-core/iconify'
:
specifier
:
workspace:*
version
:
link:../../shared/iconify
...
...
@@ -795,9 +798,6 @@ importers:
packages/@core/ui-kit/tabs-ui
:
dependencies
:
'
@vben-core/design'
:
specifier
:
workspace:*
version
:
link:../../shared/design
'
@vben-core/hooks'
:
specifier
:
workspace:*
version
:
link:../../shared/hooks
...
...
@@ -858,6 +858,9 @@ importers:
packages/effects/common-ui
:
dependencies
:
'
@vben-core/hooks'
:
specifier
:
workspace:*
version
:
link:../../@core/shared/hooks
'
@vben-core/iconify'
:
specifier
:
workspace:*
version
:
link:../../@core/shared/iconify
...
...
@@ -935,7 +938,11 @@ importers:
specifier
:
^4.4.0
version
:
4.4.0(vue@3.4.31(typescript@5.5.3))
packages/hooks
:
{}
packages/hooks
:
dependencies
:
'
@vben-core/hooks'
:
specifier
:
workspace:*
version
:
link:../@core/shared/hooks
packages/icons
:
dependencies
:
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment