|
1 | | -import { |
2 | | - ChangeDetectionStrategy, |
3 | | - ChangeDetectorRef, |
4 | | - Component, |
5 | | - Inject, |
6 | | - OnInit, |
7 | | - TemplateRef, |
8 | | - ViewChild |
9 | | -} from '@angular/core'; |
| 1 | +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core'; |
10 | 2 | import { |
11 | 3 | assertUnreachable, |
12 | 4 | Dictionary, |
@@ -70,7 +62,7 @@ import { TableWidgetModel } from './table-widget.model'; |
70 | 62 | [selectControls]="this.selectControls$ | async" |
71 | 63 | [checkboxControls]="this.checkboxControls$ | async" |
72 | 64 | [selectedRows]="this.selectedRows" |
73 | | - [customControlContent]="this.isCustomControlPresent() ? customControlDetail : undefined" |
| 65 | + [customControlContent]="(this.isCustomControlPresent | htMemoize) ? customControlDetail : undefined" |
74 | 66 | [viewItems]="this.viewItems" |
75 | 67 | (searchChange)="this.onSearchChange($event)" |
76 | 68 | (selectChange)="this.onSelectChange($event)" |
@@ -124,9 +116,6 @@ export class TableWidgetRendererComponent |
124 | 116 |
|
125 | 117 | public selectedRows?: StatefulTableRow[] = []; |
126 | 118 |
|
127 | | - @ViewChild('customControlDetail') |
128 | | - public readonly customControlDetailTemplate!: TemplateRef<unknown>; |
129 | | - |
130 | 119 | private readonly toggleFilterSubject: Subject<TableFilter[]> = new BehaviorSubject<TableFilter[]>([]); |
131 | 120 | private readonly searchFilterSubject: Subject<TableFilter[]> = new BehaviorSubject<TableFilter[]>([]); |
132 | 121 | private readonly selectFilterSubject: BehaviorSubject<TableFilter[]> = new BehaviorSubject<TableFilter[]>([]); |
@@ -397,22 +386,24 @@ export class TableWidgetRendererComponent |
397 | 386 |
|
398 | 387 | public onRowSelection(selections: StatefulTableRow[]): void { |
399 | 388 | this.selectedRows = selections; |
400 | | - // Todo: Revisit this |
| 389 | + /** |
| 390 | + * Todo: Stich this with selection handlers |
| 391 | + */ |
401 | 392 | } |
402 | 393 |
|
403 | 394 | private getRowClickInteractionHandler(selectedRow: StatefulTableRow): InteractionHandler | undefined { |
404 | 395 | return this.getInteractionHandler(selectedRow, this.api.model.getRowClickHandlers()); |
405 | 396 | } |
406 | 397 |
|
407 | 398 | private getInteractionHandler( |
408 | | - selectedRow: StatefulTableRow, |
409 | | - rowInteractionHandlers: TableWidgetRowInteractionModel[] = [] |
| 399 | + row: StatefulTableRow, |
| 400 | + rowHandlers: TableWidgetRowInteractionModel[] = [] |
410 | 401 | ): InteractionHandler | undefined { |
411 | | - const matchedSelectionHandlers = rowInteractionHandlers |
412 | | - .filter(selectionModel => selectionModel.appliesToCurrentRowDepth(selectedRow.$$state.depth)) |
| 402 | + const matchedHandlers = rowHandlers |
| 403 | + .filter(interactionModel => interactionModel.appliesToCurrentRowDepth(row.$$state.depth)) |
413 | 404 | .sort((model1, model2) => model2.rowDepth - model1.rowDepth); |
414 | 405 |
|
415 | | - return !isEmpty(matchedSelectionHandlers) ? matchedSelectionHandlers[0].handler : undefined; |
| 406 | + return !isEmpty(matchedHandlers) ? matchedHandlers[0].handler : undefined; |
416 | 407 | } |
417 | 408 |
|
418 | 409 | private pickPersistColumnProperties(column: TableColumnConfig): Pick<TableColumnConfig, 'id' | 'visible'> { |
|
0 commit comments