[ADF-2137] Document Thumbnail Pane (#2943)

* pdf thumbnails

* update TestBed declarations

* add PdfViewerService to TestBed

* content projection

* update TestBed declaration

* update TestBed

* update TestBed

* docs

* pristine

* added doc component image

* use global PDFJS instance fro tests
This commit is contained in:
Cilibiu Bogdan
2018-02-20 12:29:40 +02:00
committed by Eugenio Romano
parent 5955cc567d
commit 28ca71a5f9
22 changed files with 631 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

View File

@@ -69,6 +69,8 @@ Using with file url:
| showSidebar | `boolean` | `false` | Toggles sidebar visibility. Requires `allowSidebar` to be set to `true`. |
| sidebarPosition | `string` | `'right'` | The position of the sidebar. Can be `left` or `right`. |
| sidebarTemplate | `TemplateRef<any>` | `null` | The template for the sidebar. The template context contains the loaded node data. |
| allowThumbnails | `boolean` | `true` | Enables pdf viewer thumbnails. |
| thumbnailsTemplate | `TemplateRef<any>` | `null` | Custom template content for thumbnails. |
| mimeType | `string` | | MIME type of the file content (when not determined by the filename extension). |
| fileName | `string` | | Content filename. |
| downloadUrl | `string` | `null` | URL to download. |
@@ -279,6 +281,38 @@ Everything you put inside the "adf-viewer-sidebar" tags is going to be rendered.
<adf-viewer [allowSidebar]="true" [sidebarTemplate]="sidebarTemplate"></adf-viewer>
```
### Custom thumbnails
By default, the pdf viewer comes with its own thumbnails list but this can be replaced
by providing a custom template and binding to context property `viewer` to access PDFJS.PDFViewer
instance.
![PDF thumbnails](docassets/images/pdf-thumbnails.png)
#### Using template injection
```javascript
import { Component, Input } from '@angular/core';
@Component({
selector: 'custom-thumbnails',
template: '<p> Custom Thumbnails Component </p>'
})
export class CustomThumbnailsComponent {
@Input() pdfViewer: any;
...
}
```
```html
<ng-template let-pdfViewer="viewer" #customThumbnailsTemplate>
<custom-thumbnails [pdfViewer]="pdfViewer"></custom-thumbnails>
</ng-template>
<adf-viewer [thumbnailsTemplate]="customThumbnailsTemplate"></adf-viewer>
```
### Custom "Open With" menu
You can enable custom "Open With" menu by providing at least one action inside the "adf-viewer-open-with" tag: