forked from VadimDez/ng2-pdf-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
1,255 additions
and
825 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Valid | ||
/**/*.spec.ts | ||
/**/*.stories.ts | ||
/**/*.json | ||
/**/*.po.ts | ||
|
||
# GQL auto generated files | ||
/**/*types.ts | ||
|
||
# Config file in JS | ||
/**/*index.js | ||
/**/*index.ts | ||
wallaby.js | ||
decorate-angular-cli.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"extends": [ | ||
"@wemaintain/eslint-config", | ||
"eslint:recommended", | ||
"plugin:@angular-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
"prettier/@typescript-eslint", | ||
"prettier" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2020, | ||
"sourceType": "module", | ||
"project": "./tsconfig.base.json" | ||
}, | ||
"rules": { | ||
"max-len": ["off"] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["**/*.ts", "**/*.spec.ts"], | ||
"plugins": ["@angular-eslint/template"], | ||
"rules": { | ||
"@typescript-eslint/no-explicit-any": ["off"] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Artifacts | ||
coverage | ||
dist | ||
build | ||
|
||
# GQL auto generated files | ||
/**/*types.ts | ||
|
||
# Config file in JS | ||
/**/*index.js | ||
/**/*index.ts | ||
wallaby.js | ||
decorate-angular-cli.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"recommendations": [ | ||
"nrwl.angular-console", | ||
"angular.ng-template", | ||
"ms-vscode.vscode-typescript-tslint-plugin", | ||
"esbenp.prettier-vscode" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "chrome", | ||
"request": "launch", | ||
"name": "Launch Chrome against localhost", | ||
"url": "http://localhost:4200", | ||
"webRoot": "${workspaceFolder}", | ||
"runtimeExecutable": "/usr/bin/google-chrome-stable" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"editor.tabSize": 2, | ||
"[javascript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
} | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
} | ||
}, | ||
"[json]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
} | ||
}, | ||
"[html]": { | ||
"editor.defaultFormatter": "vscode.html-language-features" | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="pager"> | ||
<div class="page">Page {{ page }} / {{ numPages }}</div> | ||
<div class="operators"> | ||
<span (click)="this.nextPage()" class="operator"> | ||
<mat-icon>add</mat-icon> | ||
</span> | ||
<span (click)="this.previousPage()" class="operator"> | ||
<mat-icon>remove</mat-icon> | ||
</span> | ||
</div> | ||
<div class="operators"> | ||
<span (click)="this.zoomIn()" class="operator"> | ||
<mat-icon>zoom_in</mat-icon> | ||
</span> | ||
<span class="zoom-value">{{ zoom | percent }}</span> | ||
<span (click)="this.zoomOut()" class="operator"> | ||
<mat-icon>zoom_out</mat-icon> | ||
</span> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
.pager { | ||
position: absolute; | ||
bottom: 60px; | ||
left: 50%; | ||
color: white; | ||
display: flex; | ||
font-size: 12px; | ||
height: 36px; | ||
|
||
.page { | ||
display: flex; | ||
align-items: center; | ||
background: rgba(0, 0, 0, 0.7); | ||
|
||
border-right: 1px solid white; | ||
padding: 8px; | ||
} | ||
|
||
.operators { | ||
font-size: 12px; | ||
display: flex; | ||
align-items: center; | ||
border-right: 1px solid white; | ||
|
||
.operator { | ||
cursor: pointer; | ||
display: block; | ||
background: rgba(0, 0, 0, 0.7); | ||
display: flex; | ||
align-items: center; | ||
width: 36px; | ||
height: 36px; | ||
justify-content: center; | ||
font-size: 18px; | ||
|
||
&:hover { | ||
background: rgba(0, 0, 0, 0.6); | ||
} | ||
} | ||
|
||
.zoom-value { | ||
font-size: 12px; | ||
background: rgba(0, 0, 0, 0.7); | ||
display: flex; | ||
align-items: center; | ||
width: 36px; | ||
height: 36px; | ||
justify-content: center; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PagerComponent } from './pager.component'; | ||
|
||
describe('PagerComponent', () => { | ||
let component: PagerComponent; | ||
let fixture: ComponentFixture<PagerComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ PagerComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(PagerComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { | ||
Component, | ||
EventEmitter, | ||
Input, | ||
OnChanges, | ||
OnInit, | ||
Output, | ||
} from '@angular/core' | ||
|
||
@Component({ | ||
selector: 'app-pager', | ||
templateUrl: './pager.component.html', | ||
styleUrls: ['./pager.component.scss'], | ||
}) | ||
export class PagerComponent implements OnInit { | ||
/** Current page */ | ||
@Input() page: number | ||
|
||
/** Current zoom level */ | ||
@Input() zoom: number | ||
|
||
/** Total pages */ | ||
@Input() numPages: number | ||
|
||
/** Emits when the current page has changed */ | ||
@Output() pageChange: EventEmitter<number> = new EventEmitter() | ||
|
||
/** Emits when the zoom has changed */ | ||
@Output() zoomChange: EventEmitter<number> = new EventEmitter() | ||
|
||
constructor() {} | ||
|
||
ngOnInit(): void {} | ||
|
||
public nextPage(): void { | ||
this.pageChange.emit(this.page + 1) | ||
} | ||
|
||
public previousPage(): void { | ||
this.pageChange.emit(this.page - 1) | ||
} | ||
|
||
public zoomIn(): void { | ||
this.zoom = Math.round((this.zoom + 0.1) * 100) / 100 | ||
this.zoomChange.emit(this.zoom) | ||
} | ||
|
||
public zoomOut(): void { | ||
this.zoom = Math.round((this.zoom - 0.1) * 100) / 100 | ||
this.zoomChange.emit(this.zoom) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div #pdfViewerContainer class="pdf-viewer-container"> | ||
<div class="pdfViewer"></div> | ||
|
||
<div class="annotations"> | ||
<div class="annotation-card" *ngIf="activeAnnotation" | ||
[ngStyle]="{ top: annotationCardCoordinates.positionY * zoom + 'px', left: annotationCardCoordinates.positionX * zoom + 'px' }"> | ||
<ng-content select=".annotation-card-content"></ng-content> | ||
</div> | ||
|
||
<div *ngFor="let annotation of annotations" [ngStyle]="{ | ||
top: annotation.positionY * zoom + 'px', | ||
left: annotation.positionX * zoom + 'px' | ||
}" class="annotation" [id]="annotation.id">{{ annotation.index }}</div> | ||
</div> | ||
|
||
</div> | ||
<app-pager [page]="page" (pageChange)="pageChanged($event)" [numPages]="numPages" [zoom]="zoom" | ||
(zoomChange)="zoomChanged($event)"></app-pager> |
Oops, something went wrong.