mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
raise keyboard events, improve task list keyboard handling (#2401)
This commit is contained in:
committed by
Eugenio Romano
parent
9f0e40a6e8
commit
e756db03cd
@@ -42,7 +42,7 @@
|
||||
[adf-upload]="allowDropFiles && rowAllowsDrop(row)" [adf-upload-data]="row"
|
||||
[ngStyle]="rowStyle"
|
||||
[ngClass]="getRowStyle(row)"
|
||||
(keyup.enter)="onKeyboardNavigate(row, $event)">
|
||||
(keyup)="onRowKeyUp(row, $event)">
|
||||
|
||||
<!-- Actions (left) -->
|
||||
<td *ngIf="actions && actionsPosition === 'left'">
|
||||
|
@@ -73,19 +73,19 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
|
||||
showHeader: boolean = true;
|
||||
|
||||
@Output()
|
||||
rowClick: EventEmitter<DataRowEvent> = new EventEmitter<DataRowEvent>();
|
||||
rowClick = new EventEmitter<DataRowEvent>();
|
||||
|
||||
@Output()
|
||||
rowDblClick: EventEmitter<DataRowEvent> = new EventEmitter<DataRowEvent>();
|
||||
rowDblClick = new EventEmitter<DataRowEvent>();
|
||||
|
||||
@Output()
|
||||
showRowContextMenu: EventEmitter<DataCellEvent> = new EventEmitter<DataCellEvent>();
|
||||
showRowContextMenu = new EventEmitter<DataCellEvent>();
|
||||
|
||||
@Output()
|
||||
showRowActionsMenu: EventEmitter<DataCellEvent> = new EventEmitter<DataCellEvent>();
|
||||
showRowActionsMenu = new EventEmitter<DataCellEvent>();
|
||||
|
||||
@Output()
|
||||
executeRowAction: EventEmitter<DataRowActionEvent> = new EventEmitter<DataRowActionEvent>();
|
||||
executeRowAction = new EventEmitter<DataRowActionEvent>();
|
||||
|
||||
@Input()
|
||||
loading: boolean = false;
|
||||
@@ -282,10 +282,32 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck
|
||||
this.clickObserver.next(dataRowEvent);
|
||||
}
|
||||
|
||||
onKeyboardNavigate(row: DataRow, e: KeyboardEvent) {
|
||||
onRowKeyUp(row: DataRow, e: KeyboardEvent) {
|
||||
const event = new CustomEvent('row-keyup', {
|
||||
detail: {
|
||||
row: row,
|
||||
keyboardEvent: e,
|
||||
sender: this
|
||||
},
|
||||
bubbles: true
|
||||
});
|
||||
|
||||
this.elementRef.nativeElement.dispatchEvent(event);
|
||||
|
||||
if (event.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
} else {
|
||||
if (e.key === 'Enter') {
|
||||
this.onKeyboardNavigate(row, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private onKeyboardNavigate(row: DataRow, e: KeyboardEvent) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
const event = new DataRowEvent(row, e, this);
|
||||
|
||||
this.rowDblClick.emit(event);
|
||||
|
Reference in New Issue
Block a user