[ADF-4965] Viewer - pass navigate before and next event (#5166)

* pass event

* update docs
This commit is contained in:
Cilibiu Bogdan
2019-10-17 21:25:54 +03:00
committed by Denys Vuika
parent 85cd6d9506
commit a60fb744c4
3 changed files with 12 additions and 12 deletions

View File

@@ -41,7 +41,7 @@
mat-icon-button
[attr.aria-label]="'ADF_VIEWER.ACTIONS.PREV_FILE' | translate"
title="{{ 'ADF_VIEWER.ACTIONS.PREV_FILE' | translate }}"
(click)="onNavigateBeforeClick()">
(click)="onNavigateBeforeClick($event)">
<mat-icon>navigate_before</mat-icon>
</button>
<img class="adf-viewer__mimeicon" [alt]="mimeType" [src]="mimeType | adfMimeTypeIcon" data-automation-id="adf-file-thumbnail">
@@ -52,7 +52,7 @@
mat-icon-button
[attr.aria-label]="'ADF_VIEWER.ACTIONS.NEXT_FILE' | translate"
title="{{ 'ADF_VIEWER.ACTIONS.NEXT_FILE' | translate }}"
(click)="onNavigateNextClick()">
(click)="onNavigateNextClick($event)">
<mat-icon>navigate_next</mat-icon>
</button>
</div>

View File

@@ -190,11 +190,11 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
/** Emitted when user clicks 'Navigate Before' ("<") button. */
@Output()
navigateBefore = new EventEmitter();
navigateBefore = new EventEmitter<MouseEvent|KeyboardEvent>();
/** Emitted when user clicks 'Navigate Next' (">") button. */
@Output()
navigateNext = new EventEmitter();
navigateNext = new EventEmitter<MouseEvent|KeyboardEvent>();
/** Emitted when the shared link used is not valid. */
@Output()
@@ -477,12 +477,12 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
this.close();
}
onNavigateBeforeClick() {
this.navigateBefore.next();
onNavigateBeforeClick(event: MouseEvent|KeyboardEvent) {
this.navigateBefore.next(event);
}
onNavigateNextClick() {
this.navigateNext.next();
onNavigateNextClick(event: MouseEvent|KeyboardEvent) {
this.navigateNext.next(event);
}
/**
@@ -553,13 +553,13 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
// Left arrow
if (key === 37 && this.canNavigateBefore) {
event.preventDefault();
this.onNavigateBeforeClick();
this.onNavigateBeforeClick(event);
}
// Right arrow
if (key === 39 && this.canNavigateNext) {
event.preventDefault();
this.onNavigateNextClick();
this.onNavigateNextClick(event);
}
// Ctrl+F