[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

@@ -111,8 +111,8 @@ See the [Custom layout](#custom-layout) section for full details of all availabl
| extensionChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when the filename extension changes. | | extensionChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when the filename extension changes. |
| goBack | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`BaseEvent`](../../../lib/core/events/base.event.ts)`<any>>` | Emitted when user clicks the 'Back' button. | | goBack | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`BaseEvent`](../../../lib/core/events/base.event.ts)`<any>>` | Emitted when user clicks the 'Back' button. |
| invalidSharedLink | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<>` | Emitted when the shared link used is not valid. | | invalidSharedLink | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<>` | Emitted when the shared link used is not valid. |
| navigateBefore | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<>` | Emitted when user clicks 'Navigate Before' ("&lt;") button. | | navigateBefore | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<MouseEvent|KeybordEvent>` | Emitted when user clicks 'Navigate Before' ("&lt;") button or keyboard left key |
| navigateNext | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<>` | Emitted when user clicks 'Navigate Next' (">") button. | | navigateNext | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<MouseEvent|KeybordEvent>` | Emitted when user clicks 'Navigate Next' (">") button or keyboard right key. |
| print | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`BaseEvent`](../../../lib/core/events/base.event.ts)`<any>>` | Emitted when user clicks the 'Print' button. | | print | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`BaseEvent`](../../../lib/core/events/base.event.ts)`<any>>` | Emitted when user clicks the 'Print' button. |
| showViewerChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when the viewer is shown or hidden. | | showViewerChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when the viewer is shown or hidden. |

View File

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

View File

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