Skip to content

Commit 4f2076a

Browse files
committed
Added collapsing feature to tree view, when there is only one item in group selected
1 parent 4b5f2a0 commit 4f2076a

File tree

2 files changed

+43
-13
lines changed

2 files changed

+43
-13
lines changed

client/src/components/subjects/index-tree.vue

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div role="tree" :class="{ 'view': viewOnly }">
2+
<div role="tree" :class="{ view: viewOnly }">
33
<tree-item
44
:subject="root"
55
:groups="groups"
@@ -68,9 +68,37 @@ div[role="tree"] {
6868
font-size: 12pt;
6969
overflow: auto;
7070
}
71-
div[role="tree"].view .indeterminate:not(:hover){
72-
opacity:0;
73-
display: block;
74-
height:0;
71+
div[role="tree"] ul.group:hover {
72+
box-shadow: inset 1px 0 0 0 black;
73+
}
74+
div[role="tree"].view .indeterminate {
75+
display: block;
76+
font-size: 0.8em;
77+
opacity: 0.7;
78+
}
79+
div[role="tree"].view .indeterminate sup {
80+
font-weight: 900;
81+
font-size: 1em;
82+
}
83+
div[role="tree"].view .collapsed.group {
84+
display: flex;
85+
flex-direction: row;
86+
align-items: baseline;
87+
}
88+
div[role="tree"].view .collapsed.group > * {
89+
display: block;
90+
}
91+
div[role="tree"].view .collapsed.group > .indeterminate {
92+
max-width: 25%;
93+
white-space: nowrap;
94+
overflow: hidden;
95+
text-overflow: ellipsis;
96+
}
97+
div[role="tree"].view .collapsed.group > .indeterminate::after{
98+
content:' > ';
99+
font-weight: 700;
100+
}
101+
div[role="tree"] .collapsed.group > ul {
102+
flex-grow: 1;
75103
}
76104
</style>

client/src/components/subjects/tree-item.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
2-
<ul>
3-
<label :class="[{indeterminate:containsSelected},subject.$type]" v-show="showCase">
2+
<ul
3+
v-if="showCase"
4+
:class="[{ collapsed: selectedUsers==1 }, subject.$type]"
5+
>
6+
<label :class="[{ indeterminate: containsSelected }]">
47
<input
58
type="checkbox"
69
v-model="isChecked"
@@ -42,10 +45,10 @@ export default {
4245
},
4346
computed: {
4447
showCase() {
45-
if(!this.viewOnly) return true;
46-
if(this.isChecked) return true;
47-
if(this.containsSelected) return true;
48-
return false;
48+
if (!this.viewOnly) return true;
49+
if (this.isChecked) return true;
50+
if (this.containsSelected) return true;
51+
return false;
4952
},
5053
children() {
5154
return this.getChildren(this.subject);
@@ -130,13 +133,12 @@ label {
130133
cursor: pointer;
131134
text-transform: none;
132135
}
133-
label.group {
136+
ul.group > label {
134137
text-transform: uppercase;
135138
}
136139
input:checked ~ span {
137140
font-weight: 600;
138141
}
139-
140142
input[indeterminate] ~ span {
141143
font-weight: 400;
142144
}

0 commit comments

Comments
 (0)