[ADF-5517] Reverted extra bug fixes changes (#8605)

* ADF-5517 Reverted extra bug fixes changes

* ADF-5517 Reverted extra bug fixes changes
This commit is contained in:
AleksanderSklorz
2023-05-29 12:49:25 +02:00
committed by GitHub
parent 7bcb74662b
commit 32f244d934
3 changed files with 7 additions and 16 deletions

View File

@@ -166,7 +166,6 @@
(select)="onEnterKeyPressed(row, $event)" (select)="onEnterKeyPressed(row, $event)"
(keyup)="onRowKeyUp(row, $event)" (keyup)="onRowKeyUp(row, $event)"
(keydown)="onRowEnterKeyDown(row, $event)" (keydown)="onRowEnterKeyDown(row, $event)"
(click)="onRowClick(row, $event)"
[adf-upload]="rowAllowsDrop(row)" [adf-upload]="rowAllowsDrop(row)"
[adf-upload-data]="row" [adf-upload-data]="row"
[ngStyle]="rowStyle" [ngStyle]="rowStyle"
@@ -210,7 +209,7 @@
[attr.data-automation-id]="getAutomationValue(row)" [attr.data-automation-id]="getAutomationValue(row)"
[attr.aria-selected]="row.isSelected ? true : false" [attr.aria-selected]="row.isSelected ? true : false"
[attr.aria-label]="col.title ? (col.title | translate) : null" [attr.aria-label]="col.title ? (col.title | translate) : null"
(click)="storeActiveRow(row)" (click)="onRowClick(row, $event)"
(keydown.enter)="onEnterKeyPressed(row, $any($event))" (keydown.enter)="onEnterKeyPressed(row, $any($event))"
[adf-context-menu]="getContextMenuActions(row, col)" [adf-context-menu]="getContextMenuActions(row, col)"
[adf-context-menu-enabled]="contextMenu" [adf-context-menu-enabled]="contextMenu"

View File

@@ -1352,7 +1352,7 @@ describe('DataTable', () => {
dataTable.resetSelection(); dataTable.resetSelection();
const rowClickPromise = dataTable.rowClick.pipe(take(1)).toPromise(); const rowClickPromise = dataTable.rowClick.pipe(take(1)).toPromise();
const rowElement = fixture.debugElement.query(By.css(`[data-automation-id="datatable-row-0"]`)).nativeElement as HTMLElement; const rowElement = fixture.debugElement.query(By.css(`[data-automation-id="datatable-row-0"] > div`)).nativeElement as HTMLElement;
rowElement.dispatchEvent(new MouseEvent('click')); rowElement.dispatchEvent(new MouseEvent('click'));
fixture.detectChanges(); fixture.detectChanges();
await rowClickPromise; await rowClickPromise;

View File

@@ -501,24 +501,16 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
} }
onRowClick(row: DataRow, mouseEvent: MouseEvent) { onRowClick(row: DataRow, mouseEvent: MouseEvent) {
if (!mouseEvent.composedPath().some(
(element: HTMLElement) => element.id?.startsWith('action_menu_right_') || element.classList?.contains('adf-checkbox-sr-only'))
) {
if (mouseEvent) { if (mouseEvent) {
mouseEvent.preventDefault(); mouseEvent.preventDefault();
} }
if (row) {
const dataRowEvent = new DataRowEvent(row, mouseEvent, this);
this.clickObserver.next(dataRowEvent);
}
}
}
storeActiveRow(row: DataRow) {
if (row) { if (row) {
const rowIndex = this.data.getRows().indexOf(row) + (this.isHeaderListVisible() ? 1 : 0); const rowIndex = this.data.getRows().indexOf(row) + (this.isHeaderListVisible() ? 1 : 0);
this.keyManager.setActiveItem(rowIndex); this.keyManager.setActiveItem(rowIndex);
const dataRowEvent = new DataRowEvent(row, mouseEvent, this);
this.clickObserver.next(dataRowEvent);
} }
} }