tdesign-vue
Version:
321 lines (320 loc) • 7.83 kB
CSS
.t-tree {
box-sizing: border-box;
margin: 0;
padding: 0;
list-style: none;
font: var(--td-font-body-medium);
color: var(--td-text-color-primary);
position: relative;
}
.t-tree.t-is-disabled {
color: var(--td-text-color-disabled);
}
.t-tree.t-is-disabled .t-icon {
color: var(--td-text-color-disabled);
}
.t-tree.t-is-disabled .t-tree__item.t-is-active {
background-color: var(--td-bg-color-container-hover);
color: var(--td-text-color-disabled);
}
.t-tree.t-is-disabled .t-tree__item .t-icon {
color: var(--td-text-color-secondary);
}
.t-tree__empty {
color: var(--td-text-color-disabled);
}
.t-tree__branch {
display: block;
}
.t-tree__item {
--level: 0;
--hscale: 2;
will-change: opacity, max-height;
position: relative;
display: flex;
flex-wrap: nowrap;
align-items: center;
padding: 0 0 0 calc(var(--td-comp-margin-xxl) * var(--level));
cursor: default;
transform: translateZ(0);
backface-visibility: hidden;
perspective: 1000;
}
.t-tree__item .t-icon,
.t-tree__item .t-loading {
display: inline-block;
position: relative;
z-index: 2;
font-size: calc(var(--td-font-size-body-medium) + 2px);
}
.t-tree__item .t-icon {
color: var(--td-text-color-secondary);
}
.t-tree__item .t-checkbox {
align-items: center;
font-size: 0;
}
.t-tree__item .t-checkbox__input {
flex-shrink: 0;
}
.t-tree__item .t-checkbox__label {
overflow: hidden;
text-overflow: ellipsis;
}
.t-tree__item .t-tree__icon--default .t-icon {
transform: rotate(0);
}
.t-tree__item--open .t-icon {
color: var(--td-text-color-brand);
}
.t-tree__item--open .t-tree__icon--default .t-icon {
transform: rotate(90deg);
}
.t-tree__item--clickable {
cursor: pointer;
}
.t-tree__item--locked {
color: var(--td-text-color-disabled);
}
.t-tree__item--matched {
color: inherit;
}
.t-tree__item--draggable {
cursor: pointer;
}
.t-tree__item--draggable:hover {
background-color: var(--td-bg-color-container-hover);
background-clip: content-box;
}
.t-tree__item--draggable::after {
position: absolute;
top: -1px;
right: 0;
left: 0;
display: block;
height: 2px;
border-radius: 1px;
content: "";
padding: inherit;
background-clip: content-box;
}
.t-tree__item--tip-top::after {
background-color: var(--td-brand-color);
}
.t-tree__item--tip-bottom::after {
top: unset;
bottom: -1px;
background-color: var(--td-brand-color);
}
.t-tree__item--tip-highlight {
background-color: var(--td-brand-color-light);
background-clip: content-box;
}
.t-tree__item::before {
content: "";
display: block;
width: 0;
flex: 0 0 auto;
height: calc(var(--td-comp-size-m) + 2px);
}
.t-tree--block-node .t-tree__label {
flex: 1;
}
.t-tree--hoverable .t-tree__label:not(.t-is-active):not(.t-is-checked):hover {
background-color: var(--td-bg-color-container-hover);
}
.t-tree__line {
--level: 0;
--color: var(--td-border-level-1-color);
--space: var(--td-comp-margin-xxl);
--iconSize: 16px;
position: absolute;
left: calc(var(--td-comp-margin-xxl) * var(--level) - var(--td-comp-margin-l));
bottom: var(--td-comp-margin-l);
width: 1px;
height: calc(var(--td-comp-size-m) + 2px);
pointer-events: none;
}
.t-tree__line::before {
content: "";
position: absolute;
bottom: 0;
left: 0;
display: block;
height: calc(var(--td-comp-size-m) + 2px);
width: var(--td-comp-margin-m);
border-left: 1px solid var(--color);
border-bottom: 1px solid var(--color);
}
.t-tree__line--first::before {
height: var(--td-line-height-body-medium);
}
.t-tree__line--leaf::before {
width: var(--td-comp-margin-m);
}
.t-tree__icon {
position: relative;
flex: none;
display: inline-flex;
align-items: center;
text-align: center;
width: calc(var(--td-font-size-body-medium) + 2px);
font-size: 0;
user-select: none;
cursor: pointer;
}
.t-tree__icon::after {
content: "";
display: block;
position: absolute;
left: -2px;
top: -2px;
width: calc(calc(var(--td-font-size-body-medium) + 2px) + 4px);
height: calc(calc(var(--td-font-size-body-medium) + 2px) + 4px);
border-radius: var(--td-radius-default);
}
.t-tree__icon:not(:empty):hover {
background-color: var(--td-bg-color-container-hover);
}
.t-tree__icon:empty {
cursor: initial;
}
.t-tree__label {
--ripple-color: var(--td-bg-color-container-active);
flex-wrap: nowrap;
flex: 1;
padding: var(--td-comp-paddingTB-xxs) var(--td-comp-paddingLR-xs);
margin-left: var(--td-comp-margin-xs);
border-radius: var(--td-radius-default);
cursor: pointer;
white-space: nowrap;
word-wrap: normal;
overflow: hidden;
text-overflow: ellipsis;
}
.t-tree__label.t-is-checked {
font-weight: 500;
color: var(--td-text-color-primary);
background-color: var(--td-brand-color-light);
}
.t-tree__label::selection {
background-color: transparent;
}
.t-is-active .t-tree__label {
font-weight: 500;
color: var(--td-text-color-primary);
background-color: var(--td-brand-color-light);
}
.t-tree__space {
display: block;
flex: 1 0 auto;
}
.t-tree__operations {
display: flex;
flex: 0 0 auto;
justify-content: flex-end;
align-items: center;
margin-left: auto;
}
.t-tree__operations .t-icon {
cursor: pointer;
}
.t-tree__item.t-is-disabled {
color: var(--td-text-color-disabled);
cursor: default;
}
.t-tree__item.t-is-disabled .t-checkbox {
cursor: default;
}
.t-tree__item--hidden {
display: none;
}
.t-tree--transition .t-tree__label {
transition: background-color 0.24s cubic-bezier(0.38, 0, 0.24, 1);
}
.t-tree--transition .t-tree__icon {
transition: color, transform 0.24s cubic-bezier(0.38, 0, 0.24, 1);
}
.t-tree--transition .t-tree__icon::after {
transition: 0.2s linear;
}
.t-tree--transition .t-tree__icon:not(:empty):hover {
transition: 0.2s linear;
}
.t-tree--transition .t-tree__icon--default .t-icon {
transition: color, transform cubic-bezier(0.38, 0, 0.24, 1) 0.2s;
}
.t-tree--transition .t-tree__item--visible {
display: flex;
max-height: calc(calc(var(--td-comp-size-m) + 2px) * var(--hscale) + 0px);
opacity: 1;
transition: opacity 150ms linear 150ms, max-height 150ms linear 0s;
}
.t-tree--transition .t-tree__item--hidden {
display: flex;
max-height: 0;
opacity: 0;
overflow: hidden;
pointer-events: none;
user-select: none;
animation: initial;
transition: opacity 150ms linear 0s, max-height 150ms linear 150ms;
}
.t-tree--transition .t-tree__item--enter-active {
animation: t-tree-toggle 300ms linear;
}
.t-tree--transition .t-tree__item--leave-active {
animation: t-tree-toggle 300ms reverse linear forwards;
}
.t-tree__vscroll {
overflow-y: auto;
}
.t-tree__lazyload {
overflow-y: auto;
}
.t-tree__vscroll-cursor {
position: absolute;
width: 1px;
height: 1px;
transition: transform 0.2s;
}
.t-tree--scrolling .t-tree__item {
will-change: initial;
}
.t-tree--scrolling .v-enter,
.t-tree--scrolling .v-leave,
.t-tree--scrolling .t-tree__item--visible,
.t-tree--scrolling .t-tree__item--hidden,
.t-tree--scrolling .t-tree__item--enter,
.t-tree--scrolling .t-tree__item--enter-active,
.t-tree--scrolling .t-tree__item--enter-to,
.t-tree--scrolling .t-tree__item--leave,
.t-tree--scrolling .t-tree__item--leave-active .t-tree__item--leave-to {
animation: none;
transition: none;
}
.t-tree--scrolling .t-tree__item--visible {
max-height: initial;
}
.t-tree--scrolling .t-tree__item--enter-to,
.t-tree--scrolling .t-tree__item--enter-active {
max-height: initial;
}
.t-tree--scrolling .t-tree__item--leave-to,
.t-tree--scrolling .t-tree__item--leave-active {
max-height: 0;
}
@keyframes t-tree-toggle {
0% {
opacity: 0;
max-height: 0;
}
50% {
opacity: 0;
max-height: calc(calc(var(--td-comp-size-m) + 2px) * var(--hscale) + 0px);
}
100% {
opacity: 1;
max-height: calc(calc(var(--td-comp-size-m) + 2px) * var(--hscale) + 0px);
}
}