Skip to content

feat(cascader): [cascader,tree] dark theme adaptation #3136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/sites/demos/pc/app/tree/icons-composition-api.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
:data="data"
show-checkbox
:expand-icon="expandIcon"
expand-icon-color="#c2c2c2"
expand-icon-color="#5291FF"
:shrink-icon="shrinkIcon"
shrink-icon-color="#191919"
shrink-icon-color="#5291FF"
>
<template #prefix="{ node }">
<component v-if="node.data.icon === 'file'" :is="tinyIconFile"></component>
Expand Down
4 changes: 2 additions & 2 deletions examples/sites/demos/pc/app/tree/icons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
:data="data"
show-checkbox
:expand-icon="expandIcon"
expand-icon-color="#c2c2c2"
expand-icon-color="#5291FF"
:shrink-icon="shrinkIcon"
shrink-icon-color="#191919"
shrink-icon-color="#5291FF"
>
<template #prefix="{ node }">
<component v-if="node.data.icon === 'file'" :is="tinyIconFile"></component>
Expand Down
8 changes: 7 additions & 1 deletion packages/theme/src/cascader-node/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
}
.@{cascader-node-prefix-cls}__label {
font-weight: var(--tv-CascaderNode-active-font-weight);
svg {
fill: var(--tv-CascaderNode-active-icon-color);
}
}
}

Expand All @@ -99,7 +102,10 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

svg {
font-size: var(--tv-CascaderNode-icon-font-size);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the SVG styles are compatible with all supported browsers, especially older versions that might not fully support CSS variables.

fill: var(--tv-CascaderNode-icon-color);
}
// 兼容ie10-ie11
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
flex-basis: auto;
Expand Down
9 changes: 3 additions & 6 deletions packages/theme/src/cascader/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,10 @@
.@{cascader-prefix-cls}-panel {
justify-content: flex-start;
align-items: flex-start;
border: solid 1px var(--tv-Cascader-border-color);
}
.@{cascader-prefix-cls}-menu {
border: 1px solid #e4e7ed;
background:var(--tv-Cascader-dropdown-bg-color);
&:not(:first-child) {
margin-left: -1px;
}
.@{cascader-prefix-cls}-menu {
background:var(--tv-Cascader-dropdown-bg-color);
.@{cascader-prefix-cls}-menu__wrap {
height: auto;
padding-bottom: 6px;
Expand Down
4 changes: 3 additions & 1 deletion packages/theme/src/cascader/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
--tv-Cascader-font-size: var(--tv-font-size-default, 14px);
// 输入框图标字体大小
--tv-Cascader-input-icon-font-size: 10px; // 无对应变量
// 下拉菜单边框色
--tv-Cascader-border-color: var(--tv-color-border-divider);
// 悬浮时显示的边框色
--tv-Cascader-hover-border-color: var(--tv-color-border-hover, #191919);
// 聚焦时显示的边框色
Expand Down Expand Up @@ -54,7 +56,7 @@
// 下拉列表子项悬浮时的背景色(没有生效)
--tv-Cascader-item-hover-bg-color: var(--tv-color-bg-hover);
// 搜索后下拉列表无匹配数据的文本色
--tv-Cascader-empty-text-color: var(--tv-color-text-weaken, #808080);
--tv-Cascader-empty-text-color: var(--tv-color-text-secondary);
// 搜索框的文本色(没有生效)
--tv-Cascader-search-input-text-color: var(--tv-color-text, #191919);
// 搜索框的占位符的文本色(没有生效)
Expand Down
4 changes: 3 additions & 1 deletion packages/theme/src/transfer/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@
text-align: left;
padding-right: var(--tv-Transfer-panel-body-padding-right);
padding-left: var(--tv-Transfer-panel-body-padding-left);

.tiny-table.simple table tbody tr:has(td svg.is-check) {
background-color: var(--tv-Transfer-panel-item-active-bg-color);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check compatibility of the ':has()' pseudo-class as it may not be supported in all browsers. Consider using an alternative approach for broader compatibility.

}
&.is-with-footer {
padding-bottom: var(--tv-Transfer-panel-body-footer-padding-bottom);
height: var(--tv-Transfer-panel-body-footer-height);
Expand Down
2 changes: 2 additions & 0 deletions packages/theme/src/transfer/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
--tv-Transfer-panel-item-hover-text-color: var(--tv-color-text, #191919);
// 面板悬浮时背景色
--tv-Transfer-panel-item-hover-bg-color: var(--tv-color-bg, #f5f5f5);
// 面板选中时背景色
--tv-Transfer-panel-item-active-bg-color: var(--tv-color-bg-active-emphasize-light);
// 面板搜索框高度
--tv-Transfer-panel-filter-height: 32px;
// 面板搜索框字体大小
Expand Down