File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const renderService: ITreeViewRenderService = {
3131 checkbox . id = `cb-${ node . nodeId } ` ;
3232 checkbox . type = 'checkbox' ;
3333 checkbox . checked = node . checked ;
34+ checkbox . indeterminate = node . numVisibleEntities > 0 && ! node . checked ;
3435 checkbox . style . pointerEvents = 'all' ;
3536 if ( checkHandler ) checkbox . addEventListener ( 'change' , checkHandler ) ;
3637 wrapperDiv . appendChild ( checkbox ) ;
@@ -124,12 +125,18 @@ const renderService: ITreeViewRenderService = {
124125 isChecked : ( element : HTMLInputElement ) => {
125126 return element . checked ;
126127 } ,
127- setCheckbox : ( nodeId , checked ) => {
128+ setCheckbox : ( nodeId , checked , indeterminate = false ) => {
128129 const checkbox = document . getElementById ( `cb-${ nodeId } ` ) as HTMLInputElement ;
129130 if ( checkbox ) {
130131 if ( checked !== checkbox . checked ) {
131132 checkbox . checked = checked ;
132133 }
134+ if ( indeterminate !== checkbox . indeterminate ) {
135+ checkbox . indeterminate = indeterminate ;
136+ if ( indeterminate ) {
137+ checkbox . checked = false ;
138+ }
139+ }
133140 }
134141 } ,
135142 setXRayed : ( ) => {
You can’t perform that action at this time.
0 commit comments