From 1a6b5f204fa024fb0e9e5fe3316adb981631f646 Mon Sep 17 00:00:00 2001 From: Linus Schlumberger Date: Tue, 17 Dec 2024 17:07:39 +0100 Subject: [PATCH] fix: do not allow focusing of cell when not in cell selection mode --- .../src/lib/components/body/body-row.component.ts | 7 +++++-- .../src/lib/components/body/body.component.ts | 5 +++++ .../lib/components/body/summary/summary-row.component.ts | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/ngx-datatable/src/lib/components/body/body-row.component.ts b/projects/ngx-datatable/src/lib/components/body/body-row.component.ts index 46d6eaa7b..005d90d54 100644 --- a/projects/ngx-datatable/src/lib/components/body/body-row.component.ts +++ b/projects/ngx-datatable/src/lib/components/body/body-row.component.ts @@ -19,7 +19,7 @@ import { import { columnGroupWidths, columnsByPin, columnsByPinArr } from '../../utils/column'; import { Keys } from '../../utils/keys'; import { BehaviorSubject } from 'rxjs'; -import { ActivateEvent, RowOrGroup, TreeStatus } from '../../types/public.types'; +import { ActivateEvent, RowOrGroup, SelectionType, TreeStatus } from '../../types/public.types'; import { AsyncPipe } from '@angular/common'; import { TableColumn } from '../../types/table-column.type'; import { ColumnGroupWidth, PinnedColumns } from '../../types/internal.types'; @@ -38,7 +38,7 @@ import { DataTableBodyCellComponent } from './body-cell.component'; @for (column of colGroup.columns; track column.$$id; let ii = $index) { implements DoCheck, OnChanges { + SelectionType = SelectionType; + private cd = inject(ChangeDetectorRef); @Input() set columns(val: TableColumn[]) { @@ -92,6 +94,7 @@ export class DataTableBodyRowComponent implements DoCheck, OnChanges @Input() row: TRow; @Input() group: TRow[]; @Input() isSelected: boolean; + @Input() selectionType: SelectionType; @Input() rowIndex: number; @Input() displayCheck: (row: TRow, column: TableColumn, value?: any) => boolean; @Input() treeStatus?: TreeStatus = 'collapsed'; diff --git a/projects/ngx-datatable/src/lib/components/body/body.component.ts b/projects/ngx-datatable/src/lib/components/body/body.component.ts index aa6ef90a1..0d2731502 100644 --- a/projects/ngx-datatable/src/lib/components/body/body.component.ts +++ b/projects/ngx-datatable/src/lib/components/body/body.component.ts @@ -85,6 +85,7 @@ import { ProgressBarComponent } from './progress-bar.component'; any; @@ -35,6 +36,7 @@ function noopSumFunc(cells: any[]): void { tabindex="-1" [innerWidth]="innerWidth" [offsetX]="offsetX" + [selectionType]="selectionType" [columns]="_internalColumns" [rowHeight]="rowHeight" [row]="summaryRow" @@ -55,6 +57,7 @@ export class DataTableSummaryRowComponent implements OnChanges { @Input() rowHeight: number; @Input() offsetX: number; + @Input() selectionType: SelectionType; @Input() innerWidth: number; _internalColumns: ISummaryColumn[];