[ADF-1873] Remove all deprecated code from ADF (#4145)

* remove deprecated code part 1

* remove deprecation step 2

* fix spellcheck

* fix

* fix lint

* fix not used import

* remove deprecation

* fix test first part after remove deprecation

* fix test

* fix sidebar demo shell
This commit is contained in:
Eugenio Romano
2019-01-15 15:36:01 +00:00
committed by GitHub
parent 24a7c939e6
commit 7d061b2c11
109 changed files with 351 additions and 1106 deletions

View File

@@ -114,14 +114,14 @@
</mat-menu>
</ng-container>
<ng-container *ngIf="allowSidebar">
<ng-container *ngIf="allowRightSidebar">
<adf-toolbar-divider></adf-toolbar-divider>
<button
mat-icon-button
title="{{ 'ADF_VIEWER.ACTIONS.INFO' | translate }}"
data-automation-id="adf-toolbar-sidebar"
[color]="showSidebar ? 'accent' : 'default'"
[color]="showRightSidebar ? 'accent' : 'default'"
(click)="toggleSidebar()">
<mat-icon>info_outline</mat-icon>
</button>
@@ -132,12 +132,12 @@
</ng-container>
<div fxLayout="row" fxFlex="1 1 auto">
<ng-container *ngIf="allowSidebar && showSidebar">
<ng-container *ngIf="allowRightSidebar && showRightSidebar">
<div class="adf-viewer__sidebar" [ngClass]="'adf-viewer__sidebar__right'" fxFlexOrder="4" id="adf-right-sidebar" >
<ng-container *ngIf="sidebarTemplate">
<ng-container *ngTemplateOutlet="sidebarTemplate;context:sidebarTemplateContext"></ng-container>
<ng-container *ngIf="sidebarRightTemplate">
<ng-container *ngTemplateOutlet="sidebarRightTemplate;context:sidebarRightTemplateContext"></ng-container>
</ng-container>
<ng-content *ngIf="!sidebarTemplate" select="adf-viewer-sidebar"></ng-content>
<ng-content *ngIf="!sidebarRightTemplate" select="adf-viewer-sidebar"></ng-content>
</div>
</ng-container>
@@ -150,7 +150,7 @@
</div>
</ng-container>
<div *ngIf="isLoading" class="adf-viewer-main" fxFlexOrder="{{sidebarPosition !== 'left'? 1 : 4}}" fxFlex="1 1 auto">
<div *ngIf="isLoading" class="adf-viewer-main" fxFlexOrder="1" fxFlex="1 1 auto">
<div class="adf-viewer-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-content-container">
<ng-container *ngIf="isLoading">
@@ -166,7 +166,7 @@
</div>
</div>
<div *ngIf="!isLoading" class="adf-viewer-main" fxFlexOrder="{{sidebarPosition !== 'left'? 1 : 4}}" fxFlex="1 1 auto">
<div *ngIf="!isLoading" class="adf-viewer-main" fxFlexOrder="1" fxFlex="1 1 auto">
<div class="adf-viewer-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-content-container" [ngSwitch]="viewerType">
<ng-container *ngSwitchCase="'pdf'">

View File

@@ -467,8 +467,8 @@ describe('ViewerComponent', () => {
describe('SideBar Test', () => {
it('should NOT display sidebar if is not allowed', (done) => {
component.showSidebar = true;
component.allowSidebar = false;
component.showRightSidebar = true;
component.allowRightSidebar = false;
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -479,8 +479,8 @@ describe('ViewerComponent', () => {
});
it('should display sidebar on the right side', (done) => {
component.allowSidebar = true;
component.showSidebar = true;
component.allowRightSidebar = true;
component.showRightSidebar = true;
fixture.detectChanges();
fixture.whenStable().then(() => {

View File

@@ -129,40 +129,25 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
@Input()
allowLeftSidebar = false;
/** Allow the right sidebar.
* @deprecated 2.5.0 - will be renamed allowRightSidebar in 3.0.0
*/
/** Allow the right sidebar. */
@Input()
allowSidebar = false;
allowRightSidebar = false;
/** Toggles PDF thumbnails. */
@Input()
allowThumbnails = true;
/**
* Toggles sidebar visibility. Requires `allowSidebar` to be set to `true`.
* @deprecated 2.5.0 - will be renamed showRightSidebar in 3.0.0
*/
/** Toggles right sidebar visibility. Requires `allowRightSidebar` to be set to `true`. */
@Input()
showSidebar = false;
showRightSidebar = false;
/** Toggles left sidebar visibility. Requires `allowSidebar` to be set to `true`. */
/** Toggles left sidebar visibility. Requires `allowLeftSidebar` to be set to `true`. */
@Input()
showLeftSidebar = false;
/**
* The position of the sidebar. Can be `left` or `right`.
* @deprecated 2.5.0 use sidebarTemplateLeft
*/
/** The template for the right sidebar. The template context contains the loaded node data. */
@Input()
sidebarPosition = 'right';
/**
* The template for the sidebar. The template context contains the loaded node data.
* @deprecated 2.5.0 renamed as sidebarRight
*/
@Input()
sidebarTemplate: TemplateRef<any> = null;
sidebarRightTemplate: TemplateRef<any> = null;
/** The template for the left sidebar. The template context contains the loaded node data. */
@Input()
@@ -223,7 +208,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
urlFileContent: string;
otherMenu: any;
extension: string;
sidebarTemplateContext: { node: Node } = { node: null };
sidebarRightTemplateContext: { node: Node } = { node: null };
sidebarLeftTemplateContext: { node: Node } = { node: null };
fileTitle: string;
@@ -376,7 +361,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
this.extensionChange.emit(this.extension);
this.sidebarTemplateContext.node = data;
this.sidebarRightTemplateContext.node = data;
this.sidebarLeftTemplateContext.node = data;
this.scrollTop();
@@ -404,18 +389,18 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
toggleSidebar() {
this.showSidebar = !this.showSidebar;
if (this.showSidebar && this.nodeId) {
this.showRightSidebar = !this.showRightSidebar;
if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => {
this.sidebarTemplateContext.node = nodeEntry.entry;
this.sidebarRightTemplateContext.node = nodeEntry.entry;
});
}
}
toggleLeftSidebar() {
this.showLeftSidebar = !this.showLeftSidebar;
if (this.showSidebar && this.nodeId) {
if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => {
this.sidebarLeftTemplateContext.node = nodeEntry.entry;