kui-vue
Version:
A lightweight desktop UI component library suitable for Vue.js 2.
271 lines (239 loc) • 4.76 kB
text/less
@import "../../styles/var.less";
.k-tree {
.k-tree-item {
// padding-bottom: 4px;
margin-bottom: 4px;
list-style: none;
white-space: nowrap;
outline: 0;
user-select: none;
display: flex;
align-items: center;
line-height: 1;
transition: all 0.2s ease-in-out;
position: relative;
.k-checkbox {
margin: 0 4px;
}
&::before {
content: "";
position: absolute;
top: 0;
width: 100%;
height: 24px;
}
}
.k-tree-comment,
.k-tree-comment-line {
display: inline-block;
width: 24px;
position: relative;
height: 24px;
}
.k-tree-icon {
margin-right: 5px;
vertical-align: middle;
font-size: 14px;
}
.k-tree-title {
display: inline-flex;
padding: 0 4px;
box-sizing: border-box;
margin-left: 4px;
align-items: center;
z-index: 0;
border-radius: @radius;
cursor: pointer;
color: var(--kui-color-font);
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
font-size: 14px;
min-height: 24px;
&:hover {
background: var(--kui-color-hover);
outline: none;
}
}
.k-tree-item-drop {
> .k-tree-title {
background-color: var(--kui-color-main) ;
color: #fff;
}
}
.k-tree-item-extra {
flex: 1;
text-align: right;
z-index: 1;
padding-right: 4px;
height: 24px;
overflow: hidden;
text-overflow: ellipsis;
position: absolute;
right: 0
}
.k-tree-item-extra-hidden {
.k-tree-item-extra {
display: none;
}
&:hover {
.k-tree-item-extra {
display: block;
}
}
}
.k-tree-item-disabled {
.k-tree-title,
.k-tree-icon {
color: var(--kui-color-disabled);
cursor: not-allowed;
}
.k-tree-title {
&:hover,
&:focus {
background-color: transparent;
}
}
}
.k-tree-title-selected {
background: var(--kui-color-selected);
&:hover {
background: var(--kui-color-selected);
}
}
.k-tree-arrow {
font-size: 14px;
width: 24px;
height: 24px;
position: relative;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
.k-icon {
transition: all 0.2s ease-in-out;
}
}
.k-tree-arrow-open .k-icon {
transform: rotate(90deg);
}
.tree-nodata {
padding: 8px 10px;
display: block;
color: var(--kui-color-disabled);
font-size: 12px;
}
}
.k-tree-directory {
position: relative;
.k-tree-title {
&:hover,
&:focus {
background-color: transparent;
}
}
.k-tree-item {
cursor: pointer;
position: relative;
&::before {
content: "";
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 24px;
}
}
.k-tree-item:hover::before {
background-color: var(--kui-color-hover);
}
.k-tree-item-selected,
.k-tree-item-selected:hover {
&::before {
background-color: var(--kui-color-selected);
}
.k-tree-title,
.k-icon {
background-color: transparent;
}
}
.k-tree-item-disabled:hover {
cursor: not-allowed;
.k-tree-title {
color: var(--kui-color-disabled);
}
&::before {
display: none;
}
}
}
//line
/* 基础缩进块大小 */
.k-tree-indent-line,
.k-tree-arrow-placeholder,
.k-tree-indent-empty {
display: inline-block;
width: 24px; /* 根据你的设计调整 */
height: 24px; /* 或者固定高度 */
vertical-align: middle;
position: relative;
flex-shrink: 0;
}
//line-en
.k-tree-show-line {
/* 1. 垂直贯穿线 (父节点不是最后) */
.k-tree-indent-line::before {
content: "";
position: absolute;
height: 28px;
top: 0;
bottom: 0;
left: 50%; /* 居中画线 */
border-left: 1px solid var(--kui-color-border);
}
.k-tree-arrow {
transform: rotate(90deg);
.k-icon {
font-size: 16px;
}
}
.k-tree-item-children {
position: relative;
}
.k-tree-line {
border-left: 1px solid var(--kui-color-border);
position: absolute;
height: 100%;
z-index: 1;
}
.k-tree-comment-line {
&::before {
content: "";
position: absolute;
height: 24px;
background-color: var(--kui-color-border);
width: 1px;
left: 12px;
}
}
.k-tree-comment {
&::before {
content: "";
position: absolute;
left: 12px;
top: 0;
width: 1px;
height: 24px;
background-color: var(--kui-color-border);
}
&::after {
content: "";
position: absolute;
left: 12px;
top: 12px;
width: 12px;
height: 1px;
background-color: var(--kui-color-border);
}
}
}