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 3f2dcb82
authored
Sep 01, 2024
by
Vben
Committed by
GitHub
Sep 01, 2024
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix(@vben/web-ele): fixed some style issues in dark mode (#4298)
1 parent
67f3d630
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
93 additions
and
36 deletions
docs/src/components/common-ui/vben-drawer.md
docs/src/components/common-ui/vben-modal.md
packages/@core/ui-kit/layout-ui/src/components/layout-content.vue
packages/@core/ui-kit/layout-ui/src/components/layout-sidebar.vue
packages/@core/ui-kit/layout-ui/src/vben-layout.vue
packages/@core/ui-kit/popup-ui/src/drawer/drawer-api.ts
packages/@core/ui-kit/popup-ui/src/drawer/drawer.ts
packages/@core/ui-kit/popup-ui/src/drawer/drawer.vue
packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts
packages/@core/ui-kit/popup-ui/src/modal/modal.ts
packages/@core/ui-kit/popup-ui/src/modal/modal.vue
packages/@core/ui-kit/shadcn-ui/src/index.ts
packages/effects/hooks/src/use-design-tokens.ts
packages/effects/layouts/src/basic/content/content-spinner.vue
packages/effects/layouts/src/basic/layout.vue
packages/effects/layouts/src/widgets/preferences/blocks/toggle-item.vue
playground/src/router/routes/modules/examples.ts
docs/src/components/common-ui/vben-drawer.md
View file @
3f2dcb8
...
...
@@ -74,6 +74,8 @@ const [Drawer, drawerApi] = useVbenDrawer({
| closeOnPressEscape | esc 关闭弹窗 |
`boolean`
|
`true`
|
| confirmText | 确认按钮文本 |
`string\|slot`
|
`确认`
|
| cancelText | 取消按钮文本 |
`string\|slot`
|
`取消`
|
| showCancelButton | 显示取消按钮 |
`boolean`
|
`true`
|
| showConfirmButton | 显示确认按钮文本 |
`boolean`
|
`true`
|
| class | modal的class,宽度通过这个配置 |
`string`
| - |
| contentClass | modal内容区域的class |
`string`
| - |
| footerClass | modal底部区域的class |
`string`
| - |
...
...
docs/src/components/common-ui/vben-modal.md
View file @
3f2dcb8
...
...
@@ -84,6 +84,8 @@ const [Modal, modalApi] = useVbenModal({
| closeOnPressEscape | esc 关闭弹窗 |
`boolean`
|
`true`
|
| confirmText | 确认按钮文本 |
`string\|slot`
|
`确认`
|
| cancelText | 取消按钮文本 |
`string\|slot`
|
`取消`
|
| showCancelButton | 显示取消按钮 |
`boolean`
|
`true`
|
| showConfirmButton | 显示确认按钮文本 |
`boolean`
|
`true`
|
| class | modal的class,宽度通过这个配置 |
`string`
| - |
| contentClass | modal内容区域的class |
`string`
| - |
| footerClass | modal底部区域的class |
`string`
| - |
...
...
packages/@core/ui-kit/layout-ui/src/components/layout-content.vue
View file @
3f2dcb8
...
...
@@ -5,6 +5,7 @@ import type { CSSProperties } from 'vue';
import
{
computed
}
from
'vue'
;
import
{
useContentStyle
}
from
'@vben-core/composables'
;
import
{
Slot
}
from
'@vben-core/shadcn-ui'
;
interface
Props
{
/**
...
...
@@ -54,7 +55,9 @@ const style = computed((): CSSProperties => {
<
template
>
<main
ref=
"contentElement"
:style=
"style"
class=
"bg-background-deep relative"
>
<slot
:overlay-style=
"overlayStyle"
name=
"overlay"
></slot>
<Slot
:style=
"overlayStyle"
>
<slot
name=
"overlay"
></slot>
</Slot>
<slot></slot>
</main>
</
template
>
packages/@core/ui-kit/layout-ui/src/components/layout-sidebar.vue
View file @
3f2dcb8
...
...
@@ -217,13 +217,17 @@ function handleMouseenter() {
if
(
!
expandOnHovering
.
value
)
{
collapse
.
value
=
false
;
}
isLocked
.
value
=
true
;
if
(
props
.
isSidebarMixed
)
{
isLocked
.
value
=
true
;
}
expandOnHovering
.
value
=
true
;
}
function
handleMouseleave
()
{
emit
(
'leave'
);
isLocked
.
value
=
false
;
if
(
props
.
isSidebarMixed
)
{
isLocked
.
value
=
false
;
}
if
(
expandOnHover
.
value
)
{
return
;
}
...
...
packages/@core/ui-kit/layout-ui/src/vben-layout.vue
View file @
3f2dcb8
...
...
@@ -534,8 +534,8 @@ function handleHeaderToggle() {
>
<slot
name=
"content"
></slot>
<
template
#
overlay
=
"{ overlayStyle }"
>
<slot
:overlay-style=
"overlayStyle"
name=
"content-overlay"
></slot>
<
template
#
overlay
>
<slot
name=
"content-overlay"
></slot>
</
template
>
</LayoutContent>
...
...
packages/@core/ui-kit/popup-ui/src/drawer/drawer-api.ts
View file @
3f2dcb8
...
...
@@ -36,6 +36,8 @@ export class DrawerApi {
isOpen
:
false
,
loading
:
false
,
modal
:
true
,
showCancelButton
:
true
,
showConfirmButton
:
true
,
title
:
''
,
};
...
...
packages/@core/ui-kit/popup-ui/src/drawer/drawer.ts
View file @
3f2dcb8
...
...
@@ -51,6 +51,16 @@ export interface DrawerProps {
*/
modal
?:
boolean
;
/**
* 是否显示取消按钮
* @default true
*/
showCancelButton
?:
boolean
;
/**
* 是否显示确认按钮
* @default true
*/
showConfirmButton
?:
boolean
;
/**
* 弹窗标题
*/
title
?:
string
;
...
...
packages/@core/ui-kit/popup-ui/src/drawer/drawer.vue
View file @
3f2dcb8
...
...
@@ -54,6 +54,8 @@ const cancelText = usePriorityValue('cancelText', props, state);
const
confirmText
=
usePriorityValue
(
'confirmText'
,
props
,
state
);
const
closeOnClickModal
=
usePriorityValue
(
'closeOnClickModal'
,
props
,
state
);
const
closeOnPressEscape
=
usePriorityValue
(
'closeOnPressEscape'
,
props
,
state
);
const
showCancelButton
=
usePriorityValue
(
'showCancelButton'
,
props
,
state
);
const
showConfirmButton
=
usePriorityValue
(
'showConfirmButton'
,
props
,
state
);
watch
(
()
=>
showLoading
.
value
,
...
...
@@ -167,12 +169,17 @@ function pointerDownOutside(e: Event) {
>
<slot
name=
"prepend-footer"
></slot>
<slot
name=
"footer"
>
<VbenButton
variant=
"ghost"
@
click=
"() => drawerApi?.onCancel()"
>
<VbenButton
v-if=
"showCancelButton"
variant=
"ghost"
@
click=
"() => drawerApi?.onCancel()"
>
<slot
name=
"cancelText"
>
{{ cancelText || $t('cancel') }}
</slot>
</VbenButton>
<VbenButton
v-if=
"showConfirmButton"
:loading=
"confirmLoading"
@
click=
"() => drawerApi?.onConfirm()"
>
...
...
packages/@core/ui-kit/popup-ui/src/modal/modal-api.ts
View file @
3f2dcb8
...
...
@@ -40,6 +40,8 @@ export class ModalApi {
isOpen
:
false
,
loading
:
false
,
modal
:
true
,
showCancelButton
:
true
,
showConfirmButton
:
true
,
title
:
''
,
};
...
...
packages/@core/ui-kit/popup-ui/src/modal/modal.ts
View file @
3f2dcb8
...
...
@@ -76,6 +76,16 @@ export interface ModalProps {
*/
modal
?:
boolean
;
/**
* 是否显示取消按钮
* @default true
*/
showCancelButton
?:
boolean
;
/**
* 是否显示确认按钮
* @default true
*/
showConfirmButton
?:
boolean
;
/**
* 弹窗标题
*/
title
?:
string
;
...
...
packages/@core/ui-kit/popup-ui/src/modal/modal.vue
View file @
3f2dcb8
...
...
@@ -69,6 +69,8 @@ const draggable = usePriorityValue('draggable', props, state);
const
fullscreenButton
=
usePriorityValue
(
'fullscreenButton'
,
props
,
state
);
const
closeOnClickModal
=
usePriorityValue
(
'closeOnClickModal'
,
props
,
state
);
const
closeOnPressEscape
=
usePriorityValue
(
'closeOnPressEscape'
,
props
,
state
);
const
showCancelButton
=
usePriorityValue
(
'showCancelButton'
,
props
,
state
);
const
showConfirmButton
=
usePriorityValue
(
'showConfirmButton'
,
props
,
state
);
const
shouldFullscreen
=
computed
(
()
=>
(
fullscreen
.
value
&&
header
.
value
)
||
isMobile
.
value
,
...
...
@@ -238,12 +240,17 @@ function pointerDownOutside(e: Event) {
>
<slot
name=
"prepend-footer"
></slot>
<slot
name=
"footer"
>
<VbenButton
variant=
"ghost"
@
click=
"() => modalApi?.onCancel()"
>
<VbenButton
v-if=
"showCancelButton"
variant=
"ghost"
@
click=
"() => modalApi?.onCancel()"
>
<slot
name=
"cancelText"
>
{{ cancelText || $t('cancel') }}
</slot>
</VbenButton>
<VbenButton
v-if=
"showConfirmButton"
:loading=
"confirmLoading"
@
click=
"() => modalApi?.onConfirm()"
>
...
...
packages/@core/ui-kit/shadcn-ui/src/index.ts
View file @
3f2dcb8
export
*
from
'./components'
;
export
{
VisuallyHidden
}
from
'radix-vue'
;
export
{
Slot
,
VisuallyHidden
}
from
'radix-vue'
;
packages/effects/hooks/src/use-design-tokens.ts
View file @
3f2dcb8
import
{
reactive
,
watch
}
from
'vue'
;
import
{
preferences
}
from
'@vben/preferences'
;
import
{
preferences
,
usePreferences
}
from
'@vben/preferences'
;
import
{
convertToRgb
,
updateCSSVariables
}
from
'@vben/utils'
;
/**
...
...
@@ -160,53 +160,64 @@ export function useNaiveDesignTokens() {
}
export
function
useElementPlusDesignTokens
()
{
const
{
isDark
}
=
usePreferences
();
const
rootStyles
=
getComputedStyle
(
document
.
documentElement
);
const
getCssVariableValueRaw
=
(
variable
:
string
)
=>
{
return
rootStyles
.
getPropertyValue
(
variable
);
};
const
getCssVariableValue
=
(
variable
:
string
,
isColor
:
boolean
=
true
)
=>
{
const
value
=
rootStyles
.
getPropertyValue
(
variable
);
const
value
=
getCssVariableValueRaw
(
variable
);
return
isColor
?
convertToRgb
(
`hsl(
${
value
}
)`
)
:
value
;
};
watch
(
()
=>
preferences
.
theme
,
()
=>
{
const
background
=
getCssVariableValue
(
'--background'
);
const
border
=
getCssVariableValue
(
'--border'
);
const
accent
=
getCssVariableValue
(
'--accent'
);
const
variables
:
Record
<
string
,
string
>
=
{
'--el-bg-color'
:
background
,
'--el-bg-color-overlay'
:
getCssVariableValue
(
'--popover'
),
'--el-bg-color-page'
:
getCssVariableValue
(
'--background-deep'
),
'--el-border-color'
:
border
,
'--el-border-color-dark'
:
border
,
'--el-border-color-hover'
:
accent
,
'--el-border-color-light'
:
border
,
'--el-border-color-lighter'
:
border
,
'--el-border-radius-base'
:
getCssVariableValue
(
'--radius'
,
false
),
'--el-border-radius-base'
:
getCssVariableValue
(
'--radius'
,
false
),
'--el-color-danger'
:
getCssVariableValue
(
'--destructive-500'
),
'--el-color-danger-dark-2'
:
getCssVariableValue
(
'--destructive'
),
'--el-color-danger-light-3'
:
getCssVariableValue
(
'--destructive-400'
),
'--el-color-danger-light-5'
:
getCssVariableValue
(
'--destructive-300'
),
'--el-color-danger-light-7'
:
getCssVariableValue
(
'--destructive-200'
),
'--el-color-danger-light-8'
:
getCssVariableValue
(
'--destructive-100'
),
'--el-color-danger-light-9'
:
getCssVariableValue
(
'--destructive-50'
),
'--el-color-danger-light-9'
:
getCssVariableValue
(
'--destructive-50'
),
'--el-color-error'
:
getCssVariableValue
(
'--destructive-500'
),
'--el-color-error-dark-2'
:
getCssVariableValue
(
'--destructive'
),
'--el-color-error-light-3'
:
getCssVariableValue
(
'--destructive-400'
),
'--el-color-error-light-5'
:
getCssVariableValue
(
'--destructive-300'
),
'--el-color-error-light-7'
:
getCssVariableValue
(
'--destructive-200'
),
'--el-color-error-light-8'
:
getCssVariableValue
(
'--destructive-100'
),
'--el-color-error-light-9'
:
getCssVariableValue
(
'--destructive-50'
),
'--el-color-error-light-9'
:
getCssVariableValue
(
'--destructive-50'
),
'--el-color-info-light-8'
:
border
,
'--el-color-info-light-9'
:
background
,
'--el-color-info-light-9'
:
background
,
'--el-color-primary'
:
getCssVariableValue
(
'--primary-500'
),
'--el-color-primary-dark-2'
:
getCssVariableValue
(
'--primary'
),
'--el-color-primary-light-3'
:
getCssVariableValue
(
'--primary-400'
),
'--el-color-primary-light-5'
:
getCssVariableValue
(
'--primary-300'
),
'--el-color-primary-light-7'
:
getCssVariableValue
(
'--primary-200'
),
'--el-color-primary-light-8'
:
getCssVariableValue
(
'--primary-100'
),
'--el-color-primary-light-9'
:
getCssVariableValue
(
'--primary-50'
),
'--el-color-primary-light-9'
:
isDark
.
value
?
accent
:
getCssVariableValue
(
'--primary-50'
),
'--el-color-success'
:
getCssVariableValue
(
'--success-500'
),
'--el-color-success-dark-2'
:
getCssVariableValue
(
'--success'
),
...
...
@@ -214,18 +225,20 @@ export function useElementPlusDesignTokens() {
'--el-color-success-light-5'
:
getCssVariableValue
(
'--success-300'
),
'--el-color-success-light-7'
:
getCssVariableValue
(
'--success-200'
),
'--el-color-success-light-8'
:
getCssVariableValue
(
'--success-100'
),
'--el-color-success-light-9'
:
getCssVariableValue
(
'--success-50'
),
'--el-color-success-light-9'
:
getCssVariableValue
(
'--success-50'
),
'--el-color-warning'
:
getCssVariableValue
(
'--warning-500'
),
'--el-color-warning-dark-2'
:
getCssVariableValue
(
'--warning'
),
'--el-color-warning-light-3'
:
getCssVariableValue
(
'--warning-400'
),
'--el-color-warning-light-5'
:
getCssVariableValue
(
'--warning-300'
),
'--el-color-warning-light-7'
:
getCssVariableValue
(
'--warning-200'
),
'--el-color-warning-light-8'
:
getCssVariableValue
(
'--warning-100'
),
'--el-color-warning-light-9'
:
getCssVariableValue
(
'--warning-50'
),
'--el-color-warning-light-9'
:
getCssVariableValue
(
'--warning-50'
),
'--el-fill-color-blank'
:
background
,
'--el-fill-color-light'
:
getCssVariableValue
(
'--accent'
),
'--el-text-color-primary'
:
getCssVariableValue
(
'--foreground'
),
'--el-text-color-regular'
:
getCssVariableValue
(
'--foreground'
),
};
updateCSSVariables
(
variables
,
`__vben_design_styles__`
);
...
...
packages/effects/layouts/src/basic/content/content-spinner.vue
View file @
3f2dcb8
<
script
lang=
"ts"
setup
>
import
type
{
CSSProperties
}
from
'vue'
;
import
{
VbenSpinner
}
from
'@vben-core/shadcn-ui'
;
import
{
useContentSpinner
}
from
'./use-content-spinner'
;
defineOptions
({
name
:
'LayoutContentSpinner'
});
defineProps
<
{
overlayStyle
:
CSSProperties
}
>
();
const
{
spinning
}
=
useContentSpinner
();
</
script
>
<
template
>
<VbenSpinner
:spinning=
"spinning"
:style=
"overlayStyle"
/>
<VbenSpinner
:spinning=
"spinning"
/>
</
template
>
packages/effects/layouts/src/basic/layout.vue
View file @
3f2dcb8
...
...
@@ -295,11 +295,8 @@ const headerSlots = computed(() => {
<
template
#
content
>
<LayoutContent
/>
</
template
>
<
template
v-if=
"preferences.transition.loading"
#
content-overlay=
"{ overlayStyle }"
>
<LayoutContentSpinner
:overlay-style=
"overlayStyle"
/>
<
template
v-if=
"preferences.transition.loading"
#
content-overlay
>
<LayoutContentSpinner
/>
</
template
>
<!-- 页脚 -->
...
...
packages/effects/layouts/src/widgets/preferences/blocks/toggle-item.vue
View file @
3f2dcb8
...
...
@@ -23,7 +23,9 @@ const modelValue = defineModel<string>();
class="hover:bg-accent flex w-full items-center justify-between rounded-md px-2 py-2"
disabled
>
<span
class=
"text-sm"
><slot></slot></span>
<span
class=
"text-sm"
>
<slot></slot>
</span>
<ToggleGroup
v-model=
"modelValue"
class=
"gap-2"
...
...
playground/src/router/routes/modules/examples.ts
View file @
3f2dcb8
...
...
@@ -16,14 +16,6 @@ const routes: RouteRecordRaw[] = [
path
:
'/examples'
,
children
:
[
{
name
:
'EllipsisExample'
,
path
:
'/examples/ellipsis'
,
component
:
()
=>
import
(
'#/views/examples/ellipsis/index.vue'
),
meta
:
{
title
:
$t
(
'page.examples.ellipsis.title'
),
},
},
{
name
:
'ModalExample'
,
path
:
'/examples/modal'
,
component
:
()
=>
import
(
'#/views/examples/modal/index.vue'
),
...
...
@@ -39,6 +31,14 @@ const routes: RouteRecordRaw[] = [
title
:
$t
(
'page.examples.drawer.title'
),
},
},
{
name
:
'EllipsisExample'
,
path
:
'/examples/ellipsis'
,
component
:
()
=>
import
(
'#/views/examples/ellipsis/index.vue'
),
meta
:
{
title
:
$t
(
'page.examples.ellipsis.title'
),
},
},
],
},
];
...
...
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