mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-04-23 22:30:37 +00:00
AAE-41225 update typescript target to es2022 and fix FormService propagation (#11508)
* update targets * update targets * fixed FormService propagation [ci:force] * fixed FormService propagation [ci:force]
This commit is contained in:
@@ -189,7 +189,7 @@ describe('AttachFileWidgetComponent', () => {
|
||||
processContentService = TestBed.inject(ProcessContentService);
|
||||
downloadService = TestBed.inject(DownloadService);
|
||||
appConfigService = TestBed.inject(AppConfigService);
|
||||
formService = TestBed.inject(FormService);
|
||||
formService = fixture.debugElement.injector.get(FormService);
|
||||
attachFileWidgetDialogService = TestBed.inject(AttachFileWidgetDialogService);
|
||||
});
|
||||
|
||||
@@ -845,7 +845,7 @@ describe('AttachFileWidgetComponent', () => {
|
||||
value: []
|
||||
});
|
||||
|
||||
spyOn(widget.formService.formContentClicked, 'next');
|
||||
spyOn(formService.formContentClicked, 'next');
|
||||
});
|
||||
|
||||
it('should call formContentClicked when file clicked and it has sourceId', () => {
|
||||
@@ -853,7 +853,7 @@ describe('AttachFileWidgetComponent', () => {
|
||||
|
||||
widget.onAttachFileClicked(fileWithSourceId);
|
||||
|
||||
expect(widget.formService.formContentClicked.next).toHaveBeenCalledWith(fileWithSourceId);
|
||||
expect(formService.formContentClicked.next).toHaveBeenCalledWith(fileWithSourceId);
|
||||
});
|
||||
|
||||
it('should call formContentClicked when file is temporary', () => {
|
||||
@@ -864,7 +864,7 @@ describe('AttachFileWidgetComponent', () => {
|
||||
|
||||
widget.onAttachFileClicked(regularFile);
|
||||
|
||||
expect(widget.formService.formContentClicked.next).toHaveBeenCalledWith(regularFile);
|
||||
expect(formService.formContentClicked.next).toHaveBeenCalledWith(regularFile);
|
||||
});
|
||||
|
||||
it('should fetch getContentPreview when file is neither temporary nor has sourceId', () => {
|
||||
@@ -874,7 +874,7 @@ describe('AttachFileWidgetComponent', () => {
|
||||
widget.onAttachFileClicked(regularFile);
|
||||
|
||||
expect(processContentService.getContentPreview).toHaveBeenCalledWith(123);
|
||||
expect(widget.formService.formContentClicked.next).toHaveBeenCalled();
|
||||
expect(formService.formContentClicked.next).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not emit formContentClicked when file has no sourceId and contentAvailable is false', () => {
|
||||
@@ -882,7 +882,7 @@ describe('AttachFileWidgetComponent', () => {
|
||||
|
||||
widget.onAttachFileClicked(fileWithoutContent);
|
||||
|
||||
expect(widget.formService.formContentClicked.next).not.toHaveBeenCalled();
|
||||
expect(formService.formContentClicked.next).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not emit formContentClicked when file is external', () => {
|
||||
@@ -890,7 +890,7 @@ describe('AttachFileWidgetComponent', () => {
|
||||
|
||||
widget.onAttachFileClicked(externalFile);
|
||||
|
||||
expect(widget.formService.formContentClicked.next).not.toHaveBeenCalled();
|
||||
expect(formService.formContentClicked.next).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not emit formContentClicked when file has no sourceId and isStartProcessPage is true', () => {
|
||||
@@ -899,7 +899,7 @@ describe('AttachFileWidgetComponent', () => {
|
||||
|
||||
widget.onAttachFileClicked(fileWithoutContent);
|
||||
|
||||
expect(widget.formService.formContentClicked.next).not.toHaveBeenCalled();
|
||||
expect(formService.formContentClicked.next).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,14 +18,13 @@
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
import { Component, DestroyRef, inject, isDevMode, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { AppConfigService, AppConfigValues, DownloadService, ErrorWidgetComponent, FormService, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, AppConfigValues, DownloadService, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { AlfrescoIconComponent, ContentNodeDialogService, ContentService } from '@alfresco/adf-content-services';
|
||||
import { AlfrescoEndpointRepresentation, Node, NodeChildAssociation, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { from, of, zip } from 'rxjs';
|
||||
import { mergeMap } from 'rxjs/operators';
|
||||
import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service';
|
||||
import { UploadWidgetComponent } from '../upload/upload.widget';
|
||||
import { ProcessContentService } from '../../services/process-content.service';
|
||||
import { ActivitiContentService } from '../../services/activiti-alfresco.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
@@ -53,9 +52,6 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
public formService: FormService,
|
||||
public thumbnails: ThumbnailService,
|
||||
public processContentService: ProcessContentService,
|
||||
private activitiContentService: ActivitiContentService,
|
||||
private contentService: ContentService,
|
||||
private contentDialog: ContentNodeDialogService,
|
||||
@@ -65,7 +61,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private attachDialogService: AttachFileWidgetDialogService
|
||||
) {
|
||||
super(formService, thumbnails, processContentService);
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { FormService, WidgetComponent } from '@alfresco/adf-core';
|
||||
import { WidgetComponent } from '@alfresco/adf-core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ContentWidgetComponent } from './content.widget';
|
||||
|
||||
@@ -41,10 +41,6 @@ export class DocumentWidgetComponent extends WidgetComponent implements OnInit {
|
||||
fileId: string = null;
|
||||
hasFile: boolean = false;
|
||||
|
||||
constructor(public formService: FormService) {
|
||||
super(formService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.field) {
|
||||
const file = this.field.value;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
import { WidgetVisibilityService, WidgetComponent, FormService, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { WidgetVisibilityService, WidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { ChangeDetectorRef, Component, ElementRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { DynamicTableColumn } from './editors/models/dynamic-table-column.model';
|
||||
import { DynamicTableRow } from './editors/models/dynamic-table-row.model';
|
||||
import { DynamicTableModel } from './editors/models/dynamic-table.widget.model';
|
||||
@@ -55,14 +55,9 @@ export class DynamicTableWidgetComponent extends WidgetComponent implements OnIn
|
||||
|
||||
private selectArrayCode = [32, 0, 13];
|
||||
|
||||
constructor(
|
||||
public formService: FormService,
|
||||
public elementRef: ElementRef,
|
||||
private visibilityService: WidgetVisibilityService,
|
||||
private cd: ChangeDetectorRef
|
||||
) {
|
||||
super(formService);
|
||||
}
|
||||
public elementRef = inject(ElementRef);
|
||||
private visibilityService = inject(WidgetVisibilityService);
|
||||
private cd = inject(ChangeDetectorRef);
|
||||
|
||||
ngOnInit() {
|
||||
if (this.field) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseViewerWidgetComponent, ErrorWidgetComponent, FormService } from '@alfresco/adf-core';
|
||||
import { BaseViewerWidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
@@ -30,8 +30,4 @@ import { AlfrescoViewerComponent } from '@alfresco/adf-content-services';
|
||||
styleUrls: ['./file-viewer.widget.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class FileViewerWidgetComponent extends BaseViewerWidgetComponent {
|
||||
constructor(formService: FormService) {
|
||||
super(formService);
|
||||
}
|
||||
}
|
||||
export class FileViewerWidgetComponent extends BaseViewerWidgetComponent {}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
import { Component, ElementRef, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ErrorWidgetComponent, FormService, GroupModel, WidgetComponent } from '@alfresco/adf-core';
|
||||
import { Component, ElementRef, inject, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ErrorWidgetComponent, GroupModel, WidgetComponent } from '@alfresco/adf-core';
|
||||
import { catchError, debounceTime, distinctUntilChanged, switchMap, tap } from 'rxjs/operators';
|
||||
import { merge, of } from 'rxjs';
|
||||
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
||||
@@ -84,9 +84,8 @@ export class FunctionalGroupWidgetComponent extends WidgetComponent implements O
|
||||
@ViewChild('inputValue', { static: true })
|
||||
input: ElementRef;
|
||||
|
||||
constructor(public peopleProcessService: PeopleProcessService, public formService: FormService, public elementRef: ElementRef) {
|
||||
super(formService);
|
||||
}
|
||||
public peopleProcessService = inject(PeopleProcessService);
|
||||
public elementRef = inject(ElementRef);
|
||||
|
||||
ngOnInit() {
|
||||
if (this.field) {
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
import { ErrorWidgetComponent, FormService, InitialUsernamePipe, WidgetComponent } from '@alfresco/adf-core';
|
||||
import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ErrorWidgetComponent, InitialUsernamePipe, WidgetComponent } from '@alfresco/adf-core';
|
||||
import { Component, ElementRef, EventEmitter, inject, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
@@ -91,13 +91,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
||||
return list;
|
||||
})
|
||||
);
|
||||
|
||||
constructor(
|
||||
public formService: FormService,
|
||||
public peopleProcessService: PeopleProcessService
|
||||
) {
|
||||
super(formService);
|
||||
}
|
||||
public peopleProcessService = inject(PeopleProcessService);
|
||||
|
||||
ngOnInit() {
|
||||
if (this.field) {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
import { ComponentFixture, fakeAsync, getTestBed } from '@angular/core/testing';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import {
|
||||
FormService,
|
||||
ContainerModel,
|
||||
FormFieldTypes,
|
||||
FormFieldOption,
|
||||
@@ -36,7 +35,6 @@ import { MatRadioButtonHarness, MatRadioGroupHarness } from '@angular/material/r
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
|
||||
describe('RadioButtonsWidgetComponent', () => {
|
||||
let formService: FormService;
|
||||
let widget: RadioButtonsWidgetComponent;
|
||||
let taskFormService: TaskFormService;
|
||||
let processDefinitionService: ProcessDefinitionService;
|
||||
@@ -52,8 +50,7 @@ describe('RadioButtonsWidgetComponent', () => {
|
||||
taskFormService = getTestBed().inject(TaskFormService);
|
||||
processDefinitionService = getTestBed().inject(ProcessDefinitionService);
|
||||
|
||||
formService = new FormService();
|
||||
widget = new RadioButtonsWidgetComponent(formService, taskFormService, processDefinitionService);
|
||||
widget = getTestBed().createComponent(RadioButtonsWidgetComponent).componentInstance;
|
||||
widget.field = new FormFieldModel(new FormModel(), { restUrl: '<url>', optionType: 'rest' });
|
||||
});
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
import { ErrorWidgetComponent, FormService, WidgetComponent } from '@alfresco/adf-core';
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ErrorWidgetComponent, WidgetComponent } from '@alfresco/adf-core';
|
||||
import { Component, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { TaskFormService } from '../../services/task-form.service';
|
||||
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -45,13 +45,8 @@ import { FormsModule } from '@angular/forms';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class RadioButtonsWidgetComponent extends WidgetComponent implements OnInit {
|
||||
constructor(
|
||||
public formService: FormService,
|
||||
private taskFormService: TaskFormService,
|
||||
private processDefinitionService: ProcessDefinitionService
|
||||
) {
|
||||
super(formService);
|
||||
}
|
||||
private taskFormService = inject(TaskFormService);
|
||||
private processDefinitionService = inject(ProcessDefinitionService);
|
||||
|
||||
ngOnInit() {
|
||||
if (this.isValidRestConfig() && !this.isReadOnlyForm()) {
|
||||
|
||||
@@ -18,18 +18,16 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { FormService, FormFieldOption, FormFieldTypes, FormFieldModel, FormModel } from '@alfresco/adf-core';
|
||||
import { FormFieldOption, FormFieldTypes, FormFieldModel, FormModel } from '@alfresco/adf-core';
|
||||
import { TypeaheadWidgetComponent } from './typeahead.widget';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { TaskFormService } from '../../services/task-form.service';
|
||||
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
||||
|
||||
describe('TypeaheadWidgetComponent', () => {
|
||||
let formService: FormService;
|
||||
let widget: TypeaheadWidgetComponent;
|
||||
let translationService: TranslateService;
|
||||
let taskFormService: TaskFormService;
|
||||
let processDefinitionService: ProcessDefinitionService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -37,12 +35,10 @@ describe('TypeaheadWidgetComponent', () => {
|
||||
});
|
||||
translationService = TestBed.inject(TranslateService);
|
||||
taskFormService = TestBed.inject(TaskFormService);
|
||||
processDefinitionService = TestBed.inject(ProcessDefinitionService);
|
||||
spyOn(translationService, 'instant').and.callFake((key) => key);
|
||||
spyOn(translationService, 'get').and.callFake((key) => of(key));
|
||||
|
||||
formService = new FormService();
|
||||
widget = new TypeaheadWidgetComponent(formService, taskFormService, processDefinitionService);
|
||||
widget = TestBed.createComponent(TypeaheadWidgetComponent).componentInstance;
|
||||
widget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }));
|
||||
widget.field.restUrl = 'whateverURL';
|
||||
});
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
import { FormService, FormFieldOption, WidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { FormFieldOption, WidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { ENTER, ESCAPE } from '@angular/cdk/keycodes';
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { TaskFormService } from '../../services/task-form.service';
|
||||
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
||||
import { CommonModule } from '@angular/common';
|
||||
@@ -53,13 +53,8 @@ export class TypeaheadWidgetComponent extends WidgetComponent implements OnInit
|
||||
oldValue: string;
|
||||
options: FormFieldOption[] = [];
|
||||
|
||||
constructor(
|
||||
public formService: FormService,
|
||||
private taskFormService: TaskFormService,
|
||||
private processDefinitionService: ProcessDefinitionService
|
||||
) {
|
||||
super(formService);
|
||||
}
|
||||
private taskFormService = inject(TaskFormService);
|
||||
private processDefinitionService = inject(ProcessDefinitionService);
|
||||
|
||||
ngOnInit() {
|
||||
if (this.field.form.taskId && this.field.restUrl) {
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
import { ThumbnailService, FormService, ContentLinkModel, WidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { Component, ElementRef, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { ThumbnailService, ContentLinkModel, WidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||
import { Component, ElementRef, inject, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { ProcessContentService } from '../../services/process-content.service';
|
||||
import { mergeMap, map } from 'rxjs/operators';
|
||||
@@ -55,9 +55,8 @@ export class UploadWidgetComponent extends WidgetComponent implements OnInit {
|
||||
@ViewChild('uploadFiles')
|
||||
fileInput: ElementRef;
|
||||
|
||||
constructor(public formService: FormService, private thumbnailService: ThumbnailService, public processContentService: ProcessContentService) {
|
||||
super(formService);
|
||||
}
|
||||
protected thumbnailService = inject(ThumbnailService);
|
||||
protected processContentService = inject(ProcessContentService);
|
||||
|
||||
ngOnInit() {
|
||||
if (this.field?.value?.length > 0) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
],
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"target": "es2020"
|
||||
"target": "es2022"
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
|
||||
Reference in New Issue
Block a user