-
-
-
![]()
-
-
+
+
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/imgViewer.component.scss b/ng2-components/ng2-alfresco-viewer/src/components/imgViewer.component.scss
new file mode 100644
index 0000000000..b62e87f509
--- /dev/null
+++ b/ng2-components/ng2-alfresco-viewer/src/components/imgViewer.component.scss
@@ -0,0 +1,13 @@
+.adf-img-viewer {
+ .image-container {
+ display: flex;
+ flex: 1;
+ text-align: center;
+ flex-direction: row;
+ justify-content: center;
+ height: 90vh;
+ img {
+ object-fit: contain;
+ }
+ }
+}
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/imgViewer.component.ts b/ng2-components/ng2-alfresco-viewer/src/components/imgViewer.component.ts
index a491b3d7fa..378d8e6a23 100644
--- a/ng2-components/ng2-alfresco-viewer/src/components/imgViewer.component.ts
+++ b/ng2-components/ng2-alfresco-viewer/src/components/imgViewer.component.ts
@@ -15,15 +15,15 @@
* limitations under the License.
*/
-/* tslint:disable:component-selector */
-
-import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
+import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { ContentService } from 'ng2-alfresco-core';
@Component({
- selector: 'img-viewer',
+ selector: 'adf-img-viewer',
templateUrl: './imgViewer.component.html',
- styleUrls: ['./imgViewer.component.css']
+ styleUrls: ['./imgViewer.component.scss'],
+ host: { 'class': 'adf-img-viewer' },
+ encapsulation: ViewEncapsulation.None
})
export class ImgViewerComponent implements OnChanges {
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.css b/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.css
deleted file mode 100644
index 9a7c6e3e95..0000000000
--- a/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.css
+++ /dev/null
@@ -1,48 +0,0 @@
-.viewer-video-row {
- display: -webkit-box;
- display: -moz-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
-
- -webkit-box-orient: horizontal;
- -moz-box-orient: horizontal;
- box-orient: horizontal;
- flex-direction: row;
-
- -webkit-box-pack: center;
- -moz-box-pack: center;
- box-pack: center;
- justify-content: center;
-
- -webkit-box-align: center;
- -moz-box-align: center;
- box-align: center;
- align-items: center;
-}
-
-.viewer-video-cell {
- -webkit-box-flex: 1;
- -moz-box-flex: 1;
- box-flex: 1;
- -webkit-flex: 1 1 auto;
- flex: 1 1 auto;
-
- padding: 10px;
- margin: 10px;
-
- text-align: center;
-}
-
-video {
- max-height: 80vh;
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- justify-content: center;
- align-items: center;
- align-content: center;
- max-width: 100%;
- margin-left: auto;
- margin-right: auto;
-}
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.html b/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.html
index cf89162907..d79967452a 100644
--- a/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.html
+++ b/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.html
@@ -1,10 +1,3 @@
-
-
+
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.scss b/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.scss
new file mode 100644
index 0000000000..7add596dd5
--- /dev/null
+++ b/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.scss
@@ -0,0 +1,7 @@
+.adf-media-player {
+ video {
+ display: flex;
+ flex: 1;
+ max-height: 90vh;
+ }
+}
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.ts b/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.ts
index 2f241532df..a8c7d8810f 100644
--- a/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.ts
+++ b/ng2-components/ng2-alfresco-viewer/src/components/mediaPlayer.component.ts
@@ -15,15 +15,15 @@
* limitations under the License.
*/
-/* tslint:disable:component-selector */
-
-import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
+import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { ContentService } from 'ng2-alfresco-core';
@Component({
- selector: 'media-player',
+ selector: 'adf-media-player',
templateUrl: './mediaPlayer.component.html',
- styleUrls: ['./mediaPlayer.component.css']
+ styleUrls: ['./mediaPlayer.component.scss'],
+ host: { 'class': 'adf-media-player' },
+ encapsulation: ViewEncapsulation.None
})
export class MediaPlayerComponent implements OnChanges {
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.css b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.css
deleted file mode 100644
index 3f4bb8d0d4..0000000000
--- a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.css
+++ /dev/null
@@ -1,48 +0,0 @@
-
-.unsupported-container {
- width: 600px;
-}
-
-.viewer-margin {
- margin: auto !important;
- padding: 16px;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.viewer-download-text {
- text-align: center;
- word-wrap: break-word;
- min-height: 100px;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.viewer-download-text h4 {
- margin: 0;
-}
-
-.adf-conversion-spinner {
- margin: 16px 0;
-}
-
-.viewer-margin >>> .adf-conversion-spinner.mat-spinner path {
- stroke: #00BFD4;
-}
-
-.button-container {
- display: flex;
- align-items: center;
- justify-content: space-around;
-}
-
-.button-container button {
- line-height: 40px;
-}
-
-.viewer-button-icon {
- margin-right: 10px;
- margin-top: -5px;
-}
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.html b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.html
index 2c435e4690..01d5009114 100644
--- a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.html
+++ b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.html
@@ -1,39 +1,47 @@
-
-
-
-
File '{{nameFile}}' is of an unsupported format
-
-
-
+
+
+ Unknown format
+
+
+ File '{{nameFile}}' is of an unsupported format
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+ data-automation-id="pdf-rendition-viewer">
+
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.scss b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.scss
new file mode 100644
index 0000000000..b6bae84645
--- /dev/null
+++ b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.scss
@@ -0,0 +1,5 @@
+.adf-not-supported-format {
+ .mat-card {
+ max-width: 400px;
+ }
+}
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.spec.ts b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.spec.ts
index d4bab0e344..5670e79a9b 100644
--- a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.spec.ts
+++ b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.spec.ts
@@ -17,18 +17,10 @@
import { DebugElement } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { MdButtonModule, MdIconModule, MdProgressSpinnerModule } from '@angular/material';
import { By } from '@angular/platform-browser';
-import {
- AlfrescoApiService,
- AlfrescoAuthenticationService,
- AlfrescoSettingsService,
- ContentService,
- CoreModule,
- LogService,
- RenditionsService
-} from 'ng2-alfresco-core';
+import { ContentService, CoreModule, RenditionsService } from 'ng2-alfresco-core';
import { Subject } from 'rxjs/Subject';
+import { MaterialModule } from './../material.module';
import { NotSupportedFormatComponent } from './notSupportedFormat.component';
import { PdfViewerComponent } from './pdfViewer.component';
@@ -49,28 +41,18 @@ describe('NotSupportedFormatComponent', () => {
let element: HTMLElement;
let renditionsService: RenditionsService;
- let renditionSubject: Subject
,
- conversionSubject: Subject;
+ let renditionSubject: Subject;
+ let conversionSubject: Subject;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
CoreModule,
- MdIconModule,
- MdButtonModule,
- MdProgressSpinnerModule
+ MaterialModule
],
declarations: [
NotSupportedFormatComponent,
PdfViewerComponent
- ],
- providers: [
- AlfrescoSettingsService,
- AlfrescoAuthenticationService,
- AlfrescoApiService,
- ContentService,
- RenditionsService,
- LogService
]
}).compileComponents();
}));
@@ -96,8 +78,8 @@ describe('NotSupportedFormatComponent', () => {
fixture.detectChanges();
});
- it('should be present Download button', () => {
- expect(element.querySelector('#viewer-download-button')).not.toBeNull();
+ it('should display the Download button', () => {
+ expect(element.querySelector('[data-automation-id="viewer-download-button"]')).not.toBeNull();
});
it('should display the name of the file', () => {
@@ -107,7 +89,7 @@ describe('NotSupportedFormatComponent', () => {
});
it('should NOT show loading spinner by default', () => {
- expect(element.querySelector('#conversion-spinner')).toBeNull('Conversion spinner should NOT be shown by default');
+ expect(element.querySelector('[data-automation-id="viewer-conversion-spinner"]')).toBeNull('Conversion spinner should NOT be shown by default');
});
});
@@ -115,7 +97,7 @@ describe('NotSupportedFormatComponent', () => {
it('should not show the "Convert to PDF" button by default', () => {
fixture.detectChanges();
- expect(element.querySelector('#viewer-convert-button')).toBeNull();
+ expect(element.querySelector('[data-automation-id="viewer-convert-button"]')).toBeNull();
});
it('should be checked on ngInit', () => {
@@ -135,7 +117,7 @@ describe('NotSupportedFormatComponent', () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
- expect(element.querySelector('#viewer-convert-button')).not.toBeNull();
+ expect(element.querySelector('[data-automation-id="viewer-convert-button"]')).not.toBeNull();
});
}));
@@ -146,7 +128,7 @@ describe('NotSupportedFormatComponent', () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
- expect(element.querySelector('#viewer-convert-button')).toBeNull();
+ expect(element.querySelector('[data-automation-id="viewer-convert-button"]')).toBeNull();
});
}));
@@ -155,7 +137,7 @@ describe('NotSupportedFormatComponent', () => {
fixture.whenStable().then(() => {
fixture.detectChanges();
- expect(element.querySelector('#viewer-convert-button')).toBeNull();
+ expect(element.querySelector('[data-automation-id="viewer-convert-button"]')).toBeNull();
});
}));
@@ -226,7 +208,7 @@ describe('NotSupportedFormatComponent', () => {
spyOn(window, 'open');
component.urlFile = 'test';
- let downloadButton: any = element.querySelector('#viewer-download-button');
+ let downloadButton: any = element.querySelector('[data-automation-id="viewer-download-button"]');
downloadButton.click();
expect(window.open).toHaveBeenCalled();
@@ -237,7 +219,7 @@ describe('NotSupportedFormatComponent', () => {
component.blobFile = new Blob();
- let downloadButton: any = element.querySelector('#viewer-download-button');
+ let downloadButton: any = element.querySelector('[data-automation-id="viewer-download-button"]');
downloadButton.click();
expect(service.downloadBlob).toHaveBeenCalled();
@@ -250,7 +232,7 @@ describe('NotSupportedFormatComponent', () => {
renditionSubject.next({ entry: { status: 'NOT_CREATED' } });
fixture.detectChanges();
- let convertButton: any = element.querySelector('#viewer-convert-button');
+ let convertButton: any = element.querySelector('[data-automation-id="viewer-convert-button"]');
convertButton.click();
fixture.detectChanges();
}
@@ -258,8 +240,8 @@ describe('NotSupportedFormatComponent', () => {
it('should show loading spinner and disable the "Convert to PDF button" after the button was clicked', () => {
clickOnConvertButton();
- let convertButton: any = element.querySelector('#viewer-convert-button');
- expect(element.querySelector('#conversion-spinner')).not.toBeNull('Conversion spinner should be shown');
+ let convertButton: any = element.querySelector('[data-automation-id="viewer-convert-button"]');
+ expect(element.querySelector('[data-automation-id="viewer-conversion-spinner"]')).not.toBeNull('Conversion spinner should be shown');
expect(convertButton.disabled).toBe(true);
});
@@ -269,8 +251,8 @@ describe('NotSupportedFormatComponent', () => {
conversionSubject.error(new Error());
fixture.detectChanges();
- let convertButton: any = element.querySelector('#viewer-convert-button');
- expect(element.querySelector('#conversion-spinner')).toBeNull('Conversion spinner should be shown');
+ let convertButton: any = element.querySelector('[data-automation-id="viewer-convert-button"]');
+ expect(element.querySelector('[data-automation-id="viewer-conversion-spinner"]')).toBeNull('Conversion spinner should be shown');
expect(convertButton.disabled).toBe(false);
});
@@ -282,7 +264,7 @@ describe('NotSupportedFormatComponent', () => {
fixture.detectChanges();
fixture.detectChanges();
- expect(element.querySelector('#pdf-rendition-viewer')).not.toBeNull('Pdf rendition should be shown.');
+ expect(element.querySelector('[data-automation-id="pdf-rendition-viewer"]')).not.toBeNull('Pdf rendition should be shown.');
});
});
});
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.ts b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.ts
index 8e6f72f1fc..178a92f176 100644
--- a/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.ts
+++ b/ng2-components/ng2-alfresco-viewer/src/components/notSupportedFormat.component.ts
@@ -15,18 +15,18 @@
* limitations under the License.
*/
-/* tslint:disable:component-selector */
-
-import { Component, Input, OnDestroy, OnInit } from '@angular/core';
+import { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ContentService, RenditionsService } from 'ng2-alfresco-core';
import { AlfrescoApiService } from 'ng2-alfresco-core';
const DEFAULT_CONVERSION_ENCODING = 'pdf';
@Component({
- selector: 'not-supported-format',
+ selector: 'adf-not-supported-format',
templateUrl: './notSupportedFormat.component.html',
- styleUrls: ['./notSupportedFormat.component.css']
+ styleUrls: ['./notSupportedFormat.component.scss'],
+ host: { 'class': 'adf-not-supported-format' },
+ encapsulation: ViewEncapsulation.None
})
export class NotSupportedFormatComponent implements OnInit, OnDestroy {
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/pdfViewer.component.css b/ng2-components/ng2-alfresco-viewer/src/components/pdfViewer.component.css
deleted file mode 100644
index 98e4fa099a..0000000000
--- a/ng2-components/ng2-alfresco-viewer/src/components/pdfViewer.component.css
+++ /dev/null
@@ -1,96 +0,0 @@
-.loader-container {
- display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
- display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
- display: -webkit-flex; /* NEW - Chrome */
- display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
- -webkit-box-flex-direction: row;
- -moz-box-flex-direction: row;
- -webkit-flex-direction: row;
- flex-direction: row;
- height:100%;
-}
-
-.loader-item {
- margin: auto;
- max-height:100px;
- max-width:300px;
-}
-
-.loader-text{
- white-space: nowrap;
- text-align: center;
- position: relative;
- color : #fff;
-}
-
-.left {
- float: left;
-}
-
-.viewer-toolbar-pagination{
- padding-top: 4px;
- top: 80px;
- right:35px;
- width:auto;
- position:absolute;
- border-radius: 10px;
- background: #3E3E3E;
- color: white;
-}
-
-.viewer-toolbar-command{
- height: 30px;
- padding-top: 4px;
- top: 80px;
- left:35px;
- width:auto;
- position:absolute;
- border-radius: 10px;
- background: #3E3E3E;
- color: white;
-}
-
-.viewer-pagenumber-input {
- border: none;
- display: block;
- font-size: 16px;
- padding: 4px 0;
- background: 0 0;
- text-align: right;
- color: inherit;
- width: 33px;
- margin-right: 4px;
- height: 20px;
-}
-
-.viewer-total-pages {
- border: medium none;
- display: flex;
- font-size: 16px;
- padding: 4px 0px;
- background: transparent none repeat scroll 0px 0px;
- text-align: right;
- color: inherit;
- margin-right: 4px;
- height: 20px;
- align-items: center;
- justify-content: center;
-}
-
-.viewer-page-counter {
- margin-right: 20px;
-}
-
-.button-page {
- margin-right: 4px;
- height: 24px;
- width: 24px;
- margin-left: 4px;
- cursor: pointer;
-}
-
-.button-page:hover {
- cursor: pointer;
- background: grey;
- border-radius: 24px;
-}
diff --git a/ng2-components/ng2-alfresco-viewer/src/components/pdfViewer.component.html b/ng2-components/ng2-alfresco-viewer/src/components/pdfViewer.component.html
index eb8eb2897f..05c6347d63 100644
--- a/ng2-components/ng2-alfresco-viewer/src/components/pdfViewer.component.html
+++ b/ng2-components/ng2-alfresco-viewer/src/components/pdfViewer.component.html
@@ -3,8 +3,7 @@
-
-
Loading {{nameFile}} {{laodingPercent}}%
+
@@ -13,33 +12,62 @@
-