@@ -66,9 +66,7 @@ export function deriveTreeInteractionView(
6666 }
6767
6868 const controlledKey = selectionKey ( controlledIds ) ;
69- const selectedIds = new Set (
70- controlledIds . filter ( ( id ) => ! rowsById . get ( id ) ?. node . disabled ) ,
71- ) ;
69+ const selectedIds = new Set ( controlledIds ) ;
7270 const focusedId =
7371 nextState . focusTarget && visibleIds . has ( nextState . focusTarget . id )
7472 ? nextState . focusTarget . id
@@ -145,21 +143,18 @@ function selectionRange(
145143 anchorId : string ,
146144 targetId : string ,
147145) : Set < string > | undefined {
148- const enabledIds = rows
149- . filter ( ( row ) => ! row . node . disabled )
150- . map ( ( row ) => row . node . id ) ;
151- const anchor = enabledIds . indexOf ( anchorId ) ;
152- const target = enabledIds . indexOf ( targetId ) ;
146+ const rowIds = rows . map ( ( row ) => row . node . id ) ;
147+ const anchor = rowIds . indexOf ( anchorId ) ;
148+ const target = rowIds . indexOf ( targetId ) ;
153149 if ( anchor < 0 || target < 0 ) return undefined ;
154150
155151 const ids = new Set ( selectedIds ) ;
156152 let start = anchor ;
157153 let end = anchor ;
158- while ( start > 0 && ids . has ( enabledIds [ start - 1 ] ?? "" ) ) start -- ;
159- while ( end < enabledIds . length - 1 && ids . has ( enabledIds [ end + 1 ] ?? "" ) )
160- end ++ ;
161- for ( const id of enabledIds . slice ( start , end + 1 ) ) ids . delete ( id ) ;
162- for ( const id of enabledIds . slice (
154+ while ( start > 0 && ids . has ( rowIds [ start - 1 ] ?? "" ) ) start -- ;
155+ while ( end < rowIds . length - 1 && ids . has ( rowIds [ end + 1 ] ?? "" ) ) end ++ ;
156+ for ( const id of rowIds . slice ( start , end + 1 ) ) ids . delete ( id ) ;
157+ for ( const id of rowIds . slice (
163158 Math . min ( anchor , target ) ,
164159 Math . max ( anchor , target ) + 1 ,
165160 ) ) {
@@ -176,7 +171,7 @@ function selectRow(
176171 row : TreeRowModel | undefined ,
177172 { toggle, range, preserveHidden = true } : SelectCommandOptions = { } ,
178173) : readonly [ Set < string > , string ] | undefined {
179- if ( ! row || row . node . disabled ) return undefined ;
174+ if ( ! row ) return undefined ;
180175 const id = row . node . id ;
181176 if ( ! multiSelect ) return [ new Set ( [ id ] ) , id ] ;
182177
@@ -204,15 +199,12 @@ function scopedSelection(
204199) : Set < string > {
205200 const scopeId = parentId ( row ) ;
206201 const descendants = model . rows . filter (
207- ( candidate ) =>
208- ! candidate . node . disabled &&
209- ( scopeId === undefined || candidate . pathIds . includes ( scopeId ) ) ,
202+ ( candidate ) => scopeId === undefined || candidate . pathIds . includes ( scopeId ) ,
210203 ) ;
211204 const ids = new Set ( descendants . map ( ( candidate ) => candidate . node . id ) ) ;
212205 const scope = scopeId ? model . rowsById . get ( scopeId ) : undefined ;
213206 if (
214207 scope &&
215- ! scope . node . disabled &&
216208 descendants . every ( ( candidate ) => selectedIds . has ( candidate . node . id ) )
217209 ) {
218210 ids . add ( scope . node . id ) ;
@@ -230,7 +222,6 @@ function toggleBranches(
230222 const affected = recursive
231223 ? model . allRows . filter (
232224 ( candidate ) =>
233- ! candidate . node . disabled &&
234225 candidate . node . children &&
235226 ( candidate === row || candidate . pathIds . includes ( row . node . id ) ) ,
236227 )
@@ -298,7 +289,7 @@ export function transitionTree(
298289 } ;
299290 const emit = ( ids : ReadonlySet < string > , nextAnchor ?: string ) : void => {
300291 selection = model . allRows
301- . filter ( ( row ) => ids . has ( row . node . id ) && ! row . node . disabled )
292+ . filter ( ( row ) => ids . has ( row . node . id ) )
302293 . map ( ( row ) => row . node . id ) ;
303294 selectedIds = new Set ( selection ) ;
304295 currentKey = selectionKey ( selection ) ;
@@ -354,7 +345,7 @@ export function transitionTree(
354345 break ;
355346 }
356347 case "toggle" :
357- if ( row && ! row . node . disabled && row . expanded !== undefined ) {
348+ if ( row ? .expanded !== undefined ) {
358349 expandedIds = toggleBranches (
359350 row ,
360351 model ,
0 commit comments