[AAE-15839] Fix file object input in viewers (#8804)

* [AAE-15839] Fix file object input in viewers

* [AAE-15839] Attend review comments

* [AAE-15839] Remove duplication

* [AAE-15839] Fix package-lock.json

* [AAE-15839] Fix package.json

* [AAE-15839] Remove duplication

* [AAE-15839] Remove duplication
This commit is contained in:
Pablo Martinez Garcia
2023-08-09 13:30:50 +02:00
committed by GitHub
parent 1f96c3452c
commit 04803c1815
6 changed files with 37 additions and 66 deletions

View File

@@ -15,10 +15,10 @@
* limitations under the License.
*/
import { FormService, WidgetComponent } from '@alfresco/adf-core';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { BaseViewerWidgetComponent, FormService } from '@alfresco/adf-core';
import { Component, ViewEncapsulation } from '@angular/core';
/* eslint-disable @angular-eslint/component-selector */
/* eslint-disable @angular-eslint/component-selector */
@Component({
selector: 'file-viewer-widget',
@@ -37,18 +37,8 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
},
encapsulation: ViewEncapsulation.None
})
export class FileViewerWidgetComponent extends WidgetComponent implements OnInit {
export class FileViewerWidgetComponent extends BaseViewerWidgetComponent {
constructor(formService: FormService) {
super(formService);
}
ngOnInit(): void {
if (this.field &&
this.field.value &&
Array.isArray(this.field.value) &&
this.field.value.length) {
const file = this.field.value[0];
this.field.value = file.id;
}
}
}