vue3-tree-vue
Version:
A Simple vue3 project for rendering items in a tree.
222 lines (178 loc) • 4.5 kB
CSS
.vue3-tree-vue .selected-tree-item {
background: rgba(235, 106, 59, 0.795);
color: white;
}
.vue3-tree-vue .tree-item:hover .on-item-hover {
display: block;
}
.vue3-tree-vue .tree-item .on-item-hover {
display: none;
}
.vue3-tree-vue .tree-item-node:hover li>.on-item-hover {
display: block;
}
.vue3-tree-vue .tree-item-node li>.on-item-hover {
display: none;
}
.vue3-tree-vue .no-guide .tree-item-node {
border: none ;
}
.vue3-tree-vue .no-guide .tree-item-node::before {
border: none ;
}
.vue3-tree-vue .no-guide .guide-line {
border: none ;
}
.vue3-tree-vue .no-guide .guide-line::before {
border: none ;
}
/**
* Create Vertical Guideline
* Add a dashed border to the left of all but the last child in a parent node.
* There will be a gap between the bottom of this tree-item-node and the top of the next sibling.
*/
.vue3-tree-vue .node-child .tree-item-node-parent .tree-item-node:not(:last-child) {
position: relative;
border-left: 1px dashed rgb(192, 192, 192);
border-radius: 0;
}
/**
* Fill in gap on Vertical Guideline
* use the ::before pseudo-element to create a dashed line that extends down to the next sibling.
* This will be applied to all but the last child in a parent node, and fill in the gap mentioned above.
*/
.vue3-tree-vue .node-child .tree-item-node-parent .tree-item-node:not(:last-child)::before {
content: "";
position: absolute;
top: 100%;
/* Extend below the actual element */
left: -1px;
/* Match the border-left width */
height: 1em;
/* Adjust the desired height */
border-left: 1px dashed rgb(192, 192, 192);
}
.vue3-tree-vue .tree-item-node:only-child .tree-view-item {
position: relative;
/* Needed to position the ::before pseudo-element */
}
/**
* Create Vertical Guideline for only-children
* Since we rely on the previous sibling to fill in the gap by extending down,
* only-child elements will need to extend up to fill in the gap.
*/
.vue3-tree-vue .node-child .tree-item-node-parent .tree-item-node:only-child>.tree-view-item>.guide-line::before {
content: "";
position: absolute;
bottom: 50%;
/* Extend above the actual element */
left: -1px;
/* Match the border-left width */
height: 1em;
/* Extend 20px above the element */
border-left: 1px dashed rgb(192, 192, 192);
}
.vue3-tree-vue .tree-item {
padding: 0.25em;
}
.vue3-tree-vue ul {
padding-left: 0;
margin: 0;
list-style-type: none;
display: inline-block;
}
.vue3-tree-vue li {
border-radius: 4px;
}
.vue3-tree-vue .tree-item__drag-over {
background-color: rgba(22, 22, 22, 0.068) ;
}
.vue3-tree-vue .root__drag-over {
border-left: 6px solid #ccc ;
}
.vue3-tree-vue .chevron-right {
color: gray;
}
.vue3-tree-vue .hide-chevron {
visibility: collapse;
}
.vue3-tree-vue .icon-area {
width: 22px;
margin-right: 0.4em;
}
.vue3-tree-vue .guide-line {
width: 1em;
border-top: 1px dashed rgb(192, 192, 192);
}
.vue3-tree-vue .node-name {
cursor: pointer;
margin-left: 5px;
}
.vue3-tree-vue .d-flex {
display: flex;
align-items: center;
}
.vue3-tree-vue .align-items-center {
align-items: center;
}
/**
* children of checkable tree items need 47px left margin.
* Otherwise, only 27px left margin is needed.
*/
.vue3-tree-vue .nested{
margin-left: 27px ;
}
.tree-item-node-checkable > .nested {
margin-left: 47px ;
}
.vue3-tree-vue .root {
margin-left: 30px ;
}
.vue3-tree-vue .tiny_horizontal_margin {
margin-left: 2px;
margin-right: 2px;
}
.vue3-tree-vue .tree-item__checkbox-area {
display: flex;
align-items: center;
}
.vue3-tree-vue .node-child {
text-align: left;
display: block;
}
.vue3-tree-vue .hide {
display: none;
}
.vue3-tree-vue .hide-guidelines {
border-left: none ;
}
.vue3-tree-vue .chevron-right {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs, 1));
width: 22px;
height: 22px;
border: 2px solid transparent;
border-radius: 100px;
transition: .2s;
}
.vue3-tree-vue .pointer {
cursor: pointer;
}
.vue3-tree-vue .chevron-right.rotate-90::after {
transform: rotateZ(45deg);
}
.vue3-tree-vue .chevron-right::after {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
width: 7px;
height: 7px;
border-bottom: 2px solid;
border-right: 2px solid;
transform: rotate(-45deg);
right: 6px;
top: 5px
}