Skip to content

Commit 1a1a2fc

Browse files
committed
Enhance tree view checkbox functionality with indeterminate state support
1 parent 1a78166 commit 1a1a2fc

File tree

3 files changed

+4
-41
lines changed

3 files changed

+4
-41
lines changed

src/assets/main.scss

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -65,45 +65,6 @@
6565
position: relative;
6666
cursor: pointer;
6767
}
68-
69-
.treeWrapper ul li input[type=checkbox]:before {
70-
content: "";
71-
display: block;
72-
position: absolute;
73-
width: 20px;
74-
height: 20px;
75-
top: 0;
76-
left: 0;
77-
border: 2px solid rgba(0, 0, 0, 0.54);
78-
border-radius: 3px;
79-
background-color:#fff;
80-
}
81-
82-
.treeWrapper ul li input[type=checkbox]:checked:before {
83-
content: "";
84-
display: block;
85-
position: absolute;
86-
width: 20px;
87-
height: 20px;
88-
top: 0;
89-
left: 0;
90-
border: 2px solid #398684;
91-
background-color: #398684 !important;
92-
}
93-
.treeWrapper ul li input[type=checkbox]:checked:after {
94-
content: "";
95-
display: block;
96-
width: 8px;
97-
height: 12px;
98-
border: solid white;
99-
border-width: 0 2px 2px 0;
100-
-webkit-transform: rotate(45deg);
101-
-ms-transform: rotate(45deg);
102-
transform: rotate(45deg);
103-
position: absolute;
104-
top: 2px;
105-
left: 6px;
106-
}
10768

10869
.treeWrapper ul li span {
10970
vertical-align: middle;

src/components/viewer.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ onMounted(() => {
3737
containerElement: treeContainer.value,
3838
hierarchy: 'containment',
3939
autoExpandDepth: 3,
40-
renderService: renderService
40+
renderService: renderService,
41+
showIndeterminate: true,
42+
pruneEmptyNodes: true
4143
});
4244
4345
const xktLoader = new XKTLoaderPlugin(viewer.value);

src/treeviewRenderService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ const renderService: ITreeViewRenderService = {
132132
checkbox.checked = checked;
133133
}
134134
if (indeterminate !== checkbox.indeterminate) {
135-
checkbox.indeterminate = indeterminate;
136135
if (indeterminate) {
137136
checkbox.checked = false;
138137
}
138+
checkbox.indeterminate = indeterminate;
139139
}
140140
}
141141
},

0 commit comments

Comments
 (0)