Skip to content

Commit 5c49486

Browse files
berge472Jason Berger
andauthored
fixed styling and name slot (#28)
Co-authored-by: Jason Berger <[email protected]>
1 parent 5fd5c14 commit 5c49486

File tree

2 files changed

+73
-11
lines changed

2 files changed

+73
-11
lines changed

src/style.css

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,82 @@
33
color: white;
44
}
55

6-
.tree-item:hover .on-item-hover {
7-
display: block;
6+
.tree-item:hover .on-item-hover{
7+
display: block;
88
}
99

10-
.tree-item .on-item-hover {
11-
display: none;
10+
.tree-item .on-item-hover{
11+
display: none;
1212
}
1313

14-
.tree-item-node:hover li>.on-item-hover {
15-
display: block;
14+
.tree-item-node:hover li > .on-item-hover{
15+
display: block;
16+
}
17+
18+
.tree-item-node li > .on-item-hover{
19+
display: none;
1620
}
1721

1822

19-
.tree-item-node li>.on-item-hover {
20-
display: none;
23+
.no-guide .tree-item-node {
24+
border: none !important;
25+
}
26+
.no-guide .tree-item-node::before {
27+
border: none !important;
28+
}
29+
30+
.no-guide .guide-line {
31+
border: none !important;
32+
}
33+
34+
.no-guide .guide-line::before {
35+
border: none !important;
36+
}
37+
38+
39+
40+
/**
41+
* Create Vertical Guideline
42+
* Add a dashed border to the left of all but the last child in a parent node.
43+
* There will be a gap between the bottom of this tree-item-node and the top of the next sibling.
44+
*/
45+
.node-child .tree-item-node-parent .tree-item-node:not(:last-child) {
46+
position: relative;
47+
border-left: 1px dashed rgb(192, 192, 192);
48+
border-radius: 0;
49+
}
50+
51+
/**
52+
* Fill in gap on Vertical Guideline
53+
* use the ::before pseudo-element to create a dashed line that extends down to the next sibling.
54+
* This will be applied to all but the last child in a parent node, and fill in the gap mentioned above.
55+
*/
56+
.node-child .tree-item-node-parent .tree-item-node:not(:last-child)::before {
57+
content: "";
58+
position: absolute;
59+
top: 100%; /* Extend below the actual element */
60+
left: -1px; /* Match the border-left width */
61+
height: 1em; /* Adjust the desired height */
62+
border-left: 1px dashed rgb(192, 192, 192);
63+
}
64+
65+
66+
.tree-item-node:only-child .tree-view-item{
67+
position: relative; /* Needed to position the ::before pseudo-element */
68+
}
69+
70+
/**
71+
* Create Vertical Guideline for only-children
72+
* Since we rely on the previous sibling to fill in the gap by extending down,
73+
* only-child elements will need to extend up to fill in the gap.
74+
*/
75+
.node-child .tree-item-node-parent .tree-item-node:only-child > .tree-view-item > .guide-line::before {
76+
content: "";
77+
position: absolute;
78+
bottom: 50%; /* Extend above the actual element */
79+
left: -1px; /* Match the border-left width */
80+
height: 1em; /* Extend 20px above the element */
81+
border-left: 1px dashed rgb(192, 192, 192);
2182
}
2283

2384

@@ -99,7 +160,6 @@ li {
99160
.node-child {
100161
text-align: left;
101162
display: block;
102-
border-left: 1px dashed rgb(192, 192, 192);
103163
}
104164

105165
.hide {
@@ -114,7 +174,7 @@ li {
114174
box-sizing: border-box;
115175
position: relative;
116176
display: block;
117-
transform: scale(var(--ggs, 1));
177+
transform: scale(var(--ggs,1));
118178
width: 22px;
119179
height: 22px;
120180
border: 2px solid transparent;

src/tree-item.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
<div class="tiny_horizontal_margin">
3232
<slot name="prepend"></slot>
3333
</div>
34-
<span>{{ item.name }}</span>
34+
<slot name="name">
35+
<span>{{ item.name }}</span>
36+
</slot>
3537
&nbsp;
3638
<slot name="append"></slot>
3739
</div>

0 commit comments

Comments
 (0)