@@ -40,6 +40,14 @@ import IgcGridLiteHeaderRow from './header-row.js';
4040import IgcGridLiteRow from './row.js' ;
4141import IgcVirtualizer from './virtualizer.js' ;
4242
43+ /** Column reducer matching either direct column element or one nested in container */
44+ function columnReducer < T extends Element > ( acc : T [ ] , el : T ) : T [ ] {
45+ const tag = IgcGridLiteColumn . tagName ;
46+ const column = el . matches ( tag ) ? el : el . querySelector ( tag ) ;
47+ if ( column ) acc . push ( column as T ) ;
48+ return acc ;
49+ }
50+
4351/**
4452 * Event object for the filtering event of the grid.
4553 */
@@ -348,15 +356,15 @@ export class IgcGridLite<T extends object> extends EventEmitterBase<IgcGridLiteE
348356 const slot = this . renderRoot . querySelector ( 'slot' ) as HTMLSlotElement ;
349357 const assignedNodes = slot
350358 . assignedElements ( { flatten : true } )
351- . filter ( ( element ) => element . matches ( IgcGridLiteColumn . tagName ) ) ;
359+ . reduce < Element [ ] > ( columnReducer , [ ] ) ;
352360 return assignedNodes . length > 0 ;
353361 }
354362
355363 private _handleSlotChange ( event : Event ) : void {
356364 const slot = event . target as HTMLSlotElement ;
357365 const assignedNodes = slot
358366 . assignedElements ( { flatten : true } )
359- . filter ( ( element ) => element . matches ( IgcGridLiteColumn . tagName ) ) ;
367+ . reduce < Element [ ] > ( columnReducer , [ ] ) ;
360368
361369 this . _stateController . setColumnConfiguration (
362370 assignedNodes as unknown as ColumnConfiguration < T > [ ]
0 commit comments