mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +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:
@@ -16,8 +16,8 @@
|
|||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strictNullChecks": false,
|
"strictNullChecks": false,
|
||||||
"target": "es2018",
|
"target": "es2022",
|
||||||
"lib": ["es2018", "dom"],
|
"lib": ["es2022", "dom"],
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"typeRoots": ["node_modules/@types", "../../node_modules/@types"],
|
"typeRoots": ["node_modules/@types", "../../node_modules/@types"],
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"target": "es2020"
|
"target": "es2022"
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"skipTemplateCodegen": true,
|
"skipTemplateCodegen": true,
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import { FormsModule } from '@angular/forms';
|
|||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { ErrorWidgetComponent } from '../error/error.component';
|
import { ErrorWidgetComponent } from '../error/error.component';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
import { filter, isObservable, Observable } from 'rxjs';
|
import { filter, isObservable, Observable } from 'rxjs';
|
||||||
@@ -87,12 +86,11 @@ export class AmountWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public formService: FormService,
|
|
||||||
@Optional() @Inject(ADF_AMOUNT_SETTINGS) settings: Observable<AmountWidgetSettings> | AmountWidgetSettings,
|
@Optional() @Inject(ADF_AMOUNT_SETTINGS) settings: Observable<AmountWidgetSettings> | AmountWidgetSettings,
|
||||||
private currencyPipe: CurrencyPipe,
|
private currencyPipe: CurrencyPipe,
|
||||||
private translationService: TranslationService
|
private translationService: TranslationService
|
||||||
) {
|
) {
|
||||||
super(formService);
|
super();
|
||||||
if (isObservable(settings)) {
|
if (isObservable(settings)) {
|
||||||
settings.pipe(takeUntilDestroyed()).subscribe((data: AmountWidgetSettings) => {
|
settings.pipe(takeUntilDestroyed()).subscribe((data: AmountWidgetSettings) => {
|
||||||
this.updateSettingsBasedProperties(data);
|
this.updateSettingsBasedProperties(data);
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { ViewerComponent } from '../../../../viewer';
|
import { ViewerComponent } from '../../../../viewer';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { ErrorWidgetComponent } from '../error/error.component';
|
import { ErrorWidgetComponent } from '../error/error.component';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
|
|
||||||
@@ -35,10 +34,6 @@ import { WidgetComponent } from '../widget.component';
|
|||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class BaseViewerWidgetComponent extends WidgetComponent implements OnInit {
|
export class BaseViewerWidgetComponent extends WidgetComponent implements OnInit {
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
if (this.field?.value) {
|
if (this.field?.value) {
|
||||||
if (Array.isArray(this.field.value) && this.field.value.length > 0) {
|
if (Array.isArray(this.field.value) && this.field.value.length > 0) {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
import { Component, ViewEncapsulation } from '@angular/core';
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
@@ -37,10 +36,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||||||
export class ButtonWidgetComponent extends WidgetComponent {
|
export class ButtonWidgetComponent extends WidgetComponent {
|
||||||
readonly tooltipShowDelay: number = 500;
|
readonly tooltipShowDelay: number = 500;
|
||||||
|
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
get hostClasses(): string {
|
get hostClasses(): string {
|
||||||
return `adf-button-widget ${this.field?.className || ''}`;
|
return `adf-button-widget ${this.field?.className || ''}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import { Component, ViewEncapsulation } from '@angular/core';
|
|||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { ErrorWidgetComponent } from '../error/error.component';
|
import { ErrorWidgetComponent } from '../error/error.component';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
|
|
||||||
@@ -51,10 +50,4 @@ import { WidgetComponent } from '../widget.component';
|
|||||||
imports: [NgClass, MatCheckboxModule, FormsModule, TranslatePipe, ErrorWidgetComponent, NgIf],
|
imports: [NgClass, MatCheckboxModule, FormsModule, TranslatePipe, ErrorWidgetComponent, NgIf],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class CheckboxWidgetComponent extends WidgetComponent {
|
export class CheckboxWidgetComponent extends WidgetComponent {}
|
||||||
checkboxValue: boolean;
|
|
||||||
|
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { FormsModule } from '@angular/forms';
|
|||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { ErrorWidgetComponent } from '../error/error.component';
|
import { ErrorWidgetComponent } from '../error/error.component';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
|
|
||||||
@@ -43,8 +42,4 @@ import { WidgetComponent } from '../widget.component';
|
|||||||
imports: [NgIf, TranslatePipe, MatFormFieldModule, MatInputModule, FormsModule, ErrorWidgetComponent],
|
imports: [NgIf, TranslatePipe, MatFormFieldModule, MatInputModule, FormsModule, ErrorWidgetComponent],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class DecimalWidgetComponent extends WidgetComponent {
|
export class DecimalWidgetComponent extends WidgetComponent {}
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
import { Component, ViewEncapsulation } from '@angular/core';
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -40,8 +39,4 @@ import { WidgetComponent } from '../widget.component';
|
|||||||
imports: [TranslatePipe],
|
imports: [TranslatePipe],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class DisplayTextWidgetComponent extends WidgetComponent {
|
export class DisplayTextWidgetComponent extends WidgetComponent {}
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { animate, state, style, transition, trigger } from '@angular/animations'
|
|||||||
import { NgIf } from '@angular/common';
|
import { NgIf } from '@angular/common';
|
||||||
import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { ErrorMessageModel } from '../core';
|
import { ErrorMessageModel } from '../core';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
import { IconModule } from '../../../../icon/icon.module';
|
import { IconModule } from '../../../../icon/icon.module';
|
||||||
@@ -64,13 +63,8 @@ export class ErrorWidgetComponent extends WidgetComponent implements OnChanges {
|
|||||||
required: string;
|
required: string;
|
||||||
|
|
||||||
translateParameters: any = null;
|
translateParameters: any = null;
|
||||||
|
|
||||||
subscriptAnimationState: string = '';
|
subscriptAnimationState: string = '';
|
||||||
|
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (changes['required']) {
|
if (changes['required']) {
|
||||||
this.required = changes.required.currentValue;
|
this.required = changes.required.currentValue;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { FormFieldModel } from '../core';
|
import { FormFieldModel } from '../core';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
|
|
||||||
@@ -48,10 +47,6 @@ export class HyperlinkWidgetComponent extends WidgetComponent implements OnInit
|
|||||||
linkUrl: string = '#';
|
linkUrl: string = '#';
|
||||||
linkText: string = null;
|
linkText: string = null;
|
||||||
|
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
this.linkUrl = this.getHyperlinkUrl(this.field);
|
this.linkUrl = this.getHyperlinkUrl(this.field);
|
||||||
|
|||||||
@@ -15,11 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ViewEncapsulation } from '@angular/core';
|
import { Component, inject, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { EditJsonDialogSettings, EditJsonDialogComponent } from '../../../../dialogs/edit-json/edit-json.dialog';
|
import { EditJsonDialogSettings, EditJsonDialogComponent } from '../../../../dialogs/edit-json/edit-json.dialog';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
@@ -42,9 +41,7 @@ import { TranslatePipe } from '@ngx-translate/core';
|
|||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class JsonWidgetComponent extends WidgetComponent {
|
export class JsonWidgetComponent extends WidgetComponent {
|
||||||
constructor(public formService: FormService, private dialog: MatDialog) {
|
private dialog = inject(MatDialog);
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
view() {
|
view() {
|
||||||
const rawValue = this.field.value;
|
const rawValue = this.field.value;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import { FormsModule } from '@angular/forms';
|
|||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { ErrorWidgetComponent } from '../error/error.component';
|
import { ErrorWidgetComponent } from '../error/error.component';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
|
|
||||||
@@ -45,8 +44,4 @@ import { WidgetComponent } from '../widget.component';
|
|||||||
imports: [MatFormFieldModule, NgIf, TranslatePipe, MatInputModule, FormsModule, ErrorWidgetComponent],
|
imports: [MatFormFieldModule, NgIf, TranslatePipe, MatInputModule, FormsModule, ErrorWidgetComponent],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class MultilineTextWidgetComponentComponent extends WidgetComponent {
|
export class MultilineTextWidgetComponentComponent extends WidgetComponent {}
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -18,13 +18,12 @@
|
|||||||
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
|
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { NgIf } from '@angular/common';
|
import { NgIf } from '@angular/common';
|
||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { DecimalNumberPipe } from '../../../../pipes';
|
import { DecimalNumberPipe } from '../../../../pipes';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { ErrorWidgetComponent } from '../error/error.component';
|
import { ErrorWidgetComponent } from '../error/error.component';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
|
|
||||||
@@ -50,9 +49,7 @@ import { WidgetComponent } from '../widget.component';
|
|||||||
export class NumberWidgetComponent extends WidgetComponent implements OnInit {
|
export class NumberWidgetComponent extends WidgetComponent implements OnInit {
|
||||||
displayValue: number;
|
displayValue: number;
|
||||||
|
|
||||||
constructor(public formService: FormService, private decimalNumberPipe: DecimalNumberPipe) {
|
private decimalNumberPipe = inject(DecimalNumberPipe);
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field.readOnly) {
|
if (this.field.readOnly) {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import { FormsModule } from '@angular/forms';
|
|||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { ErrorWidgetComponent } from '../error/error.component';
|
import { ErrorWidgetComponent } from '../error/error.component';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
import { InputMaskDirective } from './text-mask.component';
|
import { InputMaskDirective } from './text-mask.component';
|
||||||
@@ -51,10 +50,6 @@ export class TextWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
placeholder: string;
|
placeholder: string;
|
||||||
isMaskReversed: boolean;
|
isMaskReversed: boolean;
|
||||||
|
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field.params) {
|
if (this.field.params) {
|
||||||
this.mask = this.field.params['inputMask'];
|
this.mask = this.field.params['inputMask'];
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
import { Component, ViewEncapsulation } from '@angular/core';
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import { MatListModule } from '@angular/material/list';
|
import { MatListModule } from '@angular/material/list';
|
||||||
import { FormService } from '../../../services/form.service';
|
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
import { IconModule } from '../../../../icon/icon.module';
|
import { IconModule } from '../../../../icon/icon.module';
|
||||||
|
|
||||||
@@ -48,8 +47,4 @@ import { IconModule } from '../../../../icon/icon.module';
|
|||||||
imports: [MatListModule, IconModule],
|
imports: [MatListModule, IconModule],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class UnknownWidgetComponent extends WidgetComponent {
|
export class UnknownWidgetComponent extends WidgetComponent {}
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -20,17 +20,20 @@ import { filter } from 'rxjs/operators';
|
|||||||
import { FormRulesEvent } from '../../events';
|
import { FormRulesEvent } from '../../events';
|
||||||
import { FormFieldModel, FormModel } from './core';
|
import { FormFieldModel, FormModel } from './core';
|
||||||
import { WidgetComponent } from './widget.component';
|
import { WidgetComponent } from './widget.component';
|
||||||
|
import { FormService } from '@alfresco/adf-core';
|
||||||
|
|
||||||
describe('WidgetComponent', () => {
|
describe('WidgetComponent', () => {
|
||||||
let widget: WidgetComponent;
|
let widget: WidgetComponent;
|
||||||
let fixture: ComponentFixture<WidgetComponent>;
|
let fixture: ComponentFixture<WidgetComponent>;
|
||||||
let element: HTMLElement;
|
let element: HTMLElement;
|
||||||
|
let formService: FormService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [WidgetComponent]
|
imports: [WidgetComponent]
|
||||||
});
|
});
|
||||||
fixture = TestBed.createComponent(WidgetComponent);
|
fixture = TestBed.createComponent(WidgetComponent);
|
||||||
|
formService = fixture.debugElement.injector.get(FormService);
|
||||||
|
|
||||||
element = fixture.nativeElement;
|
element = fixture.nativeElement;
|
||||||
widget = fixture.componentInstance;
|
widget = fixture.componentInstance;
|
||||||
@@ -40,7 +43,7 @@ describe('WidgetComponent', () => {
|
|||||||
|
|
||||||
describe('Events', () => {
|
describe('Events', () => {
|
||||||
it('should click event be redirect on the form event service', fakeAsync(() => {
|
it('should click event be redirect on the form event service', fakeAsync(() => {
|
||||||
widget.formService.formEvents.subscribe((event) => {
|
formService.formEvents.subscribe((event) => {
|
||||||
expect(event).toBeTruthy();
|
expect(event).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -48,7 +51,7 @@ describe('WidgetComponent', () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('should click event be redirect on the form rules event service', fakeAsync(() => {
|
it('should click event be redirect on the form rules event service', fakeAsync(() => {
|
||||||
widget.formService.formRulesEvent.pipe(filter((event) => event.type === 'click')).subscribe((event) => {
|
formService.formRulesEvent.pipe(filter((event) => event.type === 'click')).subscribe((event) => {
|
||||||
expect(event).toBeTruthy();
|
expect(event).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -95,7 +98,7 @@ describe('WidgetComponent', () => {
|
|||||||
const fakeField = new FormFieldModel(fakeForm, { id: 'fakeField', value: 'fakeValue' });
|
const fakeField = new FormFieldModel(fakeForm, { id: 'fakeField', value: 'fakeValue' });
|
||||||
|
|
||||||
let lastValue: FormRulesEvent;
|
let lastValue: FormRulesEvent;
|
||||||
widget.formService.formRulesEvent.subscribe((event) => (lastValue = event));
|
formService.formRulesEvent.subscribe((event) => (lastValue = event));
|
||||||
|
|
||||||
widget.onFieldChanged(fakeField);
|
widget.onFieldChanged(fakeField);
|
||||||
expect(lastValue.type).toEqual('fieldValueChanged');
|
expect(lastValue.type).toEqual('fieldValueChanged');
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { AfterViewInit, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
|
import { AfterViewInit, Component, EventEmitter, Input, Output, ViewEncapsulation, inject } from '@angular/core';
|
||||||
import { FormFieldEvent, FormRulesEvent } from '../../events';
|
import { FormFieldEvent, FormRulesEvent } from '../../events';
|
||||||
import { FormService } from '../../services/form.service';
|
import { FormService } from '../../services/form.service';
|
||||||
import { FormFieldModel } from './core';
|
import { FormFieldModel } from './core';
|
||||||
@@ -60,7 +60,7 @@ export class WidgetComponent implements AfterViewInit {
|
|||||||
|
|
||||||
touched: boolean = false;
|
touched: boolean = false;
|
||||||
|
|
||||||
constructor(public formService?: FormService) {}
|
protected formService = inject(FormService);
|
||||||
|
|
||||||
hasField(): boolean {
|
hasField(): boolean {
|
||||||
return !!this.field;
|
return !!this.field;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"target": "es2020"
|
"target": "es2022"
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"skipTemplateCodegen": true,
|
"skipTemplateCodegen": true,
|
||||||
|
|||||||
@@ -1,32 +1,26 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"lib": [
|
"lib": ["es2022", "dom"],
|
||||||
"es2018",
|
"declaration": true,
|
||||||
"dom"
|
"module": "commonjs",
|
||||||
],
|
"moduleResolution": "node",
|
||||||
"declaration": true,
|
"noEmitOnError": true,
|
||||||
"module": "commonjs",
|
"noFallthroughCasesInSwitch": true,
|
||||||
"moduleResolution": "node",
|
"noImplicitAny": true,
|
||||||
"noEmitOnError": true,
|
"noImplicitThis": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitAny": true,
|
"noUnusedLocals": true,
|
||||||
"noImplicitThis": true,
|
"rootDir": "./migrations",
|
||||||
"noUnusedParameters": true,
|
"outDir": "../../dist/libs/core/migrations",
|
||||||
"noUnusedLocals": true,
|
"skipDefaultLibCheck": true,
|
||||||
"rootDir": "./migrations",
|
"skipLibCheck": true,
|
||||||
"outDir": "../../dist/libs/core/migrations",
|
"sourceMap": true,
|
||||||
"skipDefaultLibCheck": true,
|
"strictNullChecks": true,
|
||||||
"skipLibCheck": true,
|
"target": "es2022",
|
||||||
"sourceMap": true,
|
"typeRoots": ["node_modules/@types"],
|
||||||
"strictNullChecks": true,
|
"types": ["node"]
|
||||||
"target": "es2015",
|
},
|
||||||
"typeRoots": ["node_modules/@types"],
|
"include": ["migrations/**/*"],
|
||||||
"types": ["node"]
|
"files": ["schematics/migrations/7_0_0/index.ts"]
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"migrations/**/*"
|
|
||||||
],
|
|
||||||
"files": ["schematics/migrations/7_0_0/index.ts"]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,23 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"lib": [
|
"lib": ["es2022", "dom"],
|
||||||
"es2018",
|
"declaration": true,
|
||||||
"dom"
|
"module": "commonjs",
|
||||||
],
|
"moduleResolution": "node",
|
||||||
"declaration": true,
|
"noEmitOnError": true,
|
||||||
"module": "commonjs",
|
"noFallthroughCasesInSwitch": true,
|
||||||
"moduleResolution": "node",
|
"noImplicitThis": true,
|
||||||
"noEmitOnError": true,
|
"noUnusedParameters": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noUnusedLocals": true,
|
||||||
"noImplicitThis": true,
|
"rootDir": "./schematics",
|
||||||
"noUnusedParameters": true,
|
"outDir": "../../dist/libs/core/schematics",
|
||||||
"noUnusedLocals": true,
|
"skipDefaultLibCheck": true,
|
||||||
"rootDir": "./schematics",
|
"skipLibCheck": true,
|
||||||
"outDir": "../../dist/libs/core/schematics",
|
"sourceMap": true,
|
||||||
"skipDefaultLibCheck": true,
|
"strictNullChecks": true,
|
||||||
"skipLibCheck": true,
|
"target": "es2022",
|
||||||
"sourceMap": true,
|
"types": ["node"]
|
||||||
"strictNullChecks": true,
|
},
|
||||||
"target": "es2015",
|
"include": ["schematics/**/*"]
|
||||||
"types": ["node"]
|
}
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"schematics/**/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,17 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2019",
|
"target": "ES2022",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"types": [
|
"types": ["node", "@typescript-eslint/utils"]
|
||||||
"node", "@typescript-eslint/utils"
|
},
|
||||||
]
|
"include": ["**/*"],
|
||||||
},
|
"exclude": ["node_modules", "tests"]
|
||||||
"include": [
|
|
||||||
"**/*"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"tests"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"target": "es2020"
|
"target": "es2022"
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"skipTemplateCodegen": true,
|
"skipTemplateCodegen": true,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"target": "es2020"
|
"target": "es2022"
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"skipTemplateCodegen": true,
|
"skipTemplateCodegen": true,
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"stripInternal": false,
|
"stripInternal": false,
|
||||||
"target": "es2015",
|
"target": "es2022",
|
||||||
"outDir": "./.out",
|
"outDir": "./.out",
|
||||||
"lib": ["es2018", "dom"],
|
"lib": ["es2022", "dom"],
|
||||||
"typeRoots": ["node_modules/@types"],
|
"typeRoots": ["node_modules/@types"],
|
||||||
"types": []
|
"types": []
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.base.json",
|
"extends": "./tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "es2015",
|
"module": "es2022",
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"removeComments": false,
|
"removeComments": false,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "../../../dist/libs/js-api/typings",
|
"declarationDir": "../../../dist/libs/js-api/typings",
|
||||||
"emitDeclarationOnly": true
|
"emitDeclarationOnly": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
import { Component, EventEmitter, inject, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, inject, OnDestroy, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
FormService,
|
|
||||||
FormValues,
|
FormValues,
|
||||||
ContentLinkModel,
|
ContentLinkModel,
|
||||||
AppConfigService,
|
AppConfigService,
|
||||||
@@ -80,10 +79,6 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
|||||||
}
|
}
|
||||||
displayedColumns = ['icon', 'fileName', 'title', 'action'];
|
displayedColumns = ['icon', 'fileName', 'title', 'action'];
|
||||||
|
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
if (this.hasFile && this.field.value.length > 0) {
|
if (this.hasFile && this.field.value.length > 0) {
|
||||||
|
|||||||
+2
-6
@@ -17,10 +17,9 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
WidgetComponent,
|
WidgetComponent,
|
||||||
FormService,
|
|
||||||
FormBaseModule,
|
FormBaseModule,
|
||||||
DataRow,
|
DataRow,
|
||||||
DataColumn,
|
DataColumn,
|
||||||
@@ -64,10 +63,7 @@ export class DataTableWidgetComponent extends WidgetComponent implements OnInit
|
|||||||
private variableName: string;
|
private variableName: string;
|
||||||
private defaultResponseProperty = 'data';
|
private defaultResponseProperty = 'data';
|
||||||
private pathParserHelper = new DataTablePathParserHelper();
|
private pathParserHelper = new DataTablePathParserHelper();
|
||||||
|
private formCloudService = inject(FormCloudService);
|
||||||
constructor(public formService: FormService, private formCloudService: FormCloudService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.init();
|
this.init();
|
||||||
|
|||||||
+3
-5
@@ -15,8 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { WidgetComponent, FormService, FormBaseModule } from '@alfresco/adf-core';
|
import { WidgetComponent, FormBaseModule } from '@alfresco/adf-core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { FormCloudService } from '../../../services/form-cloud.service';
|
import { FormCloudService } from '../../../services/form-cloud.service';
|
||||||
@@ -49,9 +49,7 @@ export class DisplayExternalPropertyWidgetComponent extends WidgetComponent impl
|
|||||||
previewState = false;
|
previewState = false;
|
||||||
propertyControl: FormControl;
|
propertyControl: FormControl;
|
||||||
|
|
||||||
constructor(public readonly formService: FormService, private readonly formCloudService: FormCloudService) {
|
private readonly formCloudService = inject(FormCloudService);
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.initFormControl();
|
this.initFormControl();
|
||||||
|
|||||||
+1
-5
@@ -18,7 +18,7 @@
|
|||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, inject, InjectionToken, OnInit, SecurityContext, ViewEncapsulation } from '@angular/core';
|
import { Component, inject, InjectionToken, OnInit, SecurityContext, ViewEncapsulation } from '@angular/core';
|
||||||
import { WidgetComponent, FormService } from '@alfresco/adf-core';
|
import { WidgetComponent } from '@alfresco/adf-core';
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
import { RichTextParserService } from '../../../services/rich-text-parser.service';
|
import { RichTextParserService } from '../../../services/rich-text-parser.service';
|
||||||
|
|
||||||
@@ -49,10 +49,6 @@ export class DisplayRichTextWidgetComponent extends WidgetComponent implements O
|
|||||||
private readonly richTextParserService = inject(RICH_TEXT_PARSER_TOKEN);
|
private readonly richTextParserService = inject(RICH_TEXT_PARSER_TOKEN);
|
||||||
private readonly sanitizer = inject(DomSanitizer);
|
private readonly sanitizer = inject(DomSanitizer);
|
||||||
|
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.parsedHTML = this.richTextParserService.parse(this.field.value);
|
this.parsedHTML = this.richTextParserService.parse(this.field.value);
|
||||||
|
|
||||||
|
|||||||
+2
-6
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ViewEncapsulation } from '@angular/core';
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormService, BaseViewerWidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
import { BaseViewerWidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||||
import { AlfrescoViewerComponent } from '@alfresco/adf-content-services';
|
import { AlfrescoViewerComponent } from '@alfresco/adf-content-services';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
|
|
||||||
@@ -29,8 +29,4 @@ import { TranslatePipe } from '@ngx-translate/core';
|
|||||||
styleUrls: ['./file-viewer.widget.scss'],
|
styleUrls: ['./file-viewer.widget.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class FileViewerWidgetComponent extends BaseViewerWidgetComponent {
|
export class FileViewerWidgetComponent extends BaseViewerWidgetComponent {}
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+1
-5
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ErrorWidgetComponent, FormService, WidgetComponent } from '@alfresco/adf-core';
|
import { ErrorWidgetComponent, WidgetComponent } from '@alfresco/adf-core';
|
||||||
import { UntypedFormControl } from '@angular/forms';
|
import { UntypedFormControl } from '@angular/forms';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { ComponentSelectionMode } from '../../../../types';
|
import { ComponentSelectionMode } from '../../../../types';
|
||||||
@@ -56,10 +56,6 @@ export class GroupCloudWidgetComponent extends WidgetComponent implements OnInit
|
|||||||
|
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
this.roles = this.field.roles;
|
this.roles = this.field.roles;
|
||||||
|
|||||||
+1
-5
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ErrorWidgetComponent, FormService, WidgetComponent } from '@alfresco/adf-core';
|
import { ErrorWidgetComponent, WidgetComponent } from '@alfresco/adf-core';
|
||||||
import { UntypedFormControl } from '@angular/forms';
|
import { UntypedFormControl } from '@angular/forms';
|
||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import { ComponentSelectionMode } from '../../../../types';
|
import { ComponentSelectionMode } from '../../../../types';
|
||||||
@@ -62,10 +62,6 @@ export class PeopleCloudWidgetComponent extends WidgetComponent implements OnIni
|
|||||||
|
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
this.roles = this.field.roles;
|
this.roles = this.field.roles;
|
||||||
|
|||||||
+1
-5
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { BaseViewerWidgetComponent, ErrorWidgetComponent, FormService } from '@alfresco/adf-core';
|
import { BaseViewerWidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
import { PropertiesViewerWrapperComponent } from './properties-viewer-wrapper/properties-viewer-wrapper.component';
|
import { PropertiesViewerWrapperComponent } from './properties-viewer-wrapper/properties-viewer-wrapper.component';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
@@ -35,10 +35,6 @@ export class PropertiesViewerWidgetComponent extends BaseViewerWidgetComponent {
|
|||||||
@Output()
|
@Output()
|
||||||
nodeContentLoaded: EventEmitter<Node> = new EventEmitter();
|
nodeContentLoaded: EventEmitter<Node> = new EventEmitter();
|
||||||
|
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
onNodeContentLoaded(node: Node) {
|
onNodeContentLoaded(node: Node) {
|
||||||
this.nodeContentLoaded.emit(node);
|
this.nodeContentLoaded.emit(node);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { FormFieldModel, FormFieldOption, FormFieldTypes, FormModel } from '@alfresco/adf-core';
|
import { FormFieldModel, FormFieldOption, FormFieldTypes, FormModel, FormService } from '@alfresco/adf-core';
|
||||||
import { FormCloudService } from '../../../services/form-cloud.service';
|
import { FormCloudService } from '../../../services/form-cloud.service';
|
||||||
import { RadioButtonsCloudWidgetComponent } from './radio-buttons-cloud.widget';
|
import { RadioButtonsCloudWidgetComponent } from './radio-buttons-cloud.widget';
|
||||||
import { of, throwError } from 'rxjs';
|
import { of, throwError } from 'rxjs';
|
||||||
@@ -29,6 +29,7 @@ describe('RadioButtonsCloudWidgetComponent', () => {
|
|||||||
let fixture: ComponentFixture<RadioButtonsCloudWidgetComponent>;
|
let fixture: ComponentFixture<RadioButtonsCloudWidgetComponent>;
|
||||||
let widget: RadioButtonsCloudWidgetComponent;
|
let widget: RadioButtonsCloudWidgetComponent;
|
||||||
let formCloudService: FormCloudService;
|
let formCloudService: FormCloudService;
|
||||||
|
let formService: FormService;
|
||||||
let formUtilsService: FormUtilsService;
|
let formUtilsService: FormUtilsService;
|
||||||
let element: HTMLElement;
|
let element: HTMLElement;
|
||||||
let loader: HarnessLoader;
|
let loader: HarnessLoader;
|
||||||
@@ -50,6 +51,7 @@ describe('RadioButtonsCloudWidgetComponent', () => {
|
|||||||
formCloudService = TestBed.inject(FormCloudService);
|
formCloudService = TestBed.inject(FormCloudService);
|
||||||
formUtilsService = TestBed.inject(FormUtilsService);
|
formUtilsService = TestBed.inject(FormUtilsService);
|
||||||
fixture = TestBed.createComponent(RadioButtonsCloudWidgetComponent);
|
fixture = TestBed.createComponent(RadioButtonsCloudWidgetComponent);
|
||||||
|
formService = fixture.debugElement.injector.get(FormService);
|
||||||
widget = fixture.componentInstance;
|
widget = fixture.componentInstance;
|
||||||
element = fixture.nativeElement;
|
element = fixture.nativeElement;
|
||||||
loader = TestbedHarnessEnvironment.loader(fixture);
|
loader = TestbedHarnessEnvironment.loader(fixture);
|
||||||
@@ -291,7 +293,7 @@ describe('RadioButtonsCloudWidgetComponent', () => {
|
|||||||
options: restOption
|
options: restOption
|
||||||
});
|
});
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const formValueSpy = spyOn(widget.formService.formRulesEvent, 'next');
|
const formValueSpy = spyOn(formService.formRulesEvent, 'next');
|
||||||
const radioButton = await loader.getHarness(MatRadioButtonHarness.with({ label: 'opt-name-1' }));
|
const radioButton = await loader.getHarness(MatRadioButtonHarness.with({ label: 'opt-name-1' }));
|
||||||
await radioButton.check();
|
await radioButton.check();
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -18,7 +18,7 @@
|
|||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ErrorMessageModel, ErrorWidgetComponent, FormFieldOption, FormService, WidgetComponent } from '@alfresco/adf-core';
|
import { ErrorMessageModel, ErrorWidgetComponent, FormFieldOption, WidgetComponent } from '@alfresco/adf-core';
|
||||||
import { FormCloudService } from '../../../services/form-cloud.service';
|
import { FormCloudService } from '../../../services/form-cloud.service';
|
||||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
@@ -55,10 +55,6 @@ export class RadioButtonsCloudWidgetComponent extends WidgetComponent implements
|
|||||||
|
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.isValidRestConfig() && !this.isReadOnlyForm()) {
|
if (this.isValidRestConfig() && !this.isReadOnlyForm()) {
|
||||||
this.getValuesFromRestApi();
|
this.getValuesFromRestApi();
|
||||||
|
|||||||
+1
-5
@@ -21,7 +21,7 @@ import { Component, ElementRef, EventEmitter, inject, OnInit, Output, ViewChild,
|
|||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
import { Observable, from } from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { mergeMap } from 'rxjs/operators';
|
import { mergeMap } from 'rxjs/operators';
|
||||||
import { WidgetComponent, FormService, ThumbnailService, NotificationService, ErrorWidgetComponent, IconModule } from '@alfresco/adf-core';
|
import { WidgetComponent, ThumbnailService, NotificationService, ErrorWidgetComponent, IconModule } from '@alfresco/adf-core';
|
||||||
import { ProcessCloudContentService } from '../../../services/process-cloud-content.service';
|
import { ProcessCloudContentService } from '../../../services/process-cloud-content.service';
|
||||||
import { FileSourceTypes, DestinationFolderPathType } from '../../../models/form-cloud-representation.model';
|
import { FileSourceTypes, DestinationFolderPathType } from '../../../models/form-cloud-representation.model';
|
||||||
import { VersionManagerUploadData } from '@alfresco/adf-content-services';
|
import { VersionManagerUploadData } from '@alfresco/adf-content-services';
|
||||||
@@ -65,10 +65,6 @@ export class UploadCloudWidgetComponent extends WidgetComponent implements OnIni
|
|||||||
@ViewChild('uploadFiles')
|
@ViewChild('uploadFiles')
|
||||||
fileInput: ElementRef;
|
fileInput: ElementRef;
|
||||||
|
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field?.value?.length > 0) {
|
if (this.field?.value?.length > 0) {
|
||||||
this.hasFile = true;
|
this.hasFile = true;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"target": "es2020"
|
"target": "es2022"
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"skipTemplateCodegen": true,
|
"skipTemplateCodegen": true,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../../dist/out-tsc",
|
"outDir": "../../dist/out-tsc",
|
||||||
"target": "ES2021",
|
"target": "ES2022",
|
||||||
"useDefineForClassFields": false
|
"useDefineForClassFields": false
|
||||||
},
|
},
|
||||||
"files": ["src/test.ts"],
|
"files": ["src/test.ts"],
|
||||||
|
|||||||
+8
-8
@@ -189,7 +189,7 @@ describe('AttachFileWidgetComponent', () => {
|
|||||||
processContentService = TestBed.inject(ProcessContentService);
|
processContentService = TestBed.inject(ProcessContentService);
|
||||||
downloadService = TestBed.inject(DownloadService);
|
downloadService = TestBed.inject(DownloadService);
|
||||||
appConfigService = TestBed.inject(AppConfigService);
|
appConfigService = TestBed.inject(AppConfigService);
|
||||||
formService = TestBed.inject(FormService);
|
formService = fixture.debugElement.injector.get(FormService);
|
||||||
attachFileWidgetDialogService = TestBed.inject(AttachFileWidgetDialogService);
|
attachFileWidgetDialogService = TestBed.inject(AttachFileWidgetDialogService);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -845,7 +845,7 @@ describe('AttachFileWidgetComponent', () => {
|
|||||||
value: []
|
value: []
|
||||||
});
|
});
|
||||||
|
|
||||||
spyOn(widget.formService.formContentClicked, 'next');
|
spyOn(formService.formContentClicked, 'next');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call formContentClicked when file clicked and it has sourceId', () => {
|
it('should call formContentClicked when file clicked and it has sourceId', () => {
|
||||||
@@ -853,7 +853,7 @@ describe('AttachFileWidgetComponent', () => {
|
|||||||
|
|
||||||
widget.onAttachFileClicked(fileWithSourceId);
|
widget.onAttachFileClicked(fileWithSourceId);
|
||||||
|
|
||||||
expect(widget.formService.formContentClicked.next).toHaveBeenCalledWith(fileWithSourceId);
|
expect(formService.formContentClicked.next).toHaveBeenCalledWith(fileWithSourceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call formContentClicked when file is temporary', () => {
|
it('should call formContentClicked when file is temporary', () => {
|
||||||
@@ -864,7 +864,7 @@ describe('AttachFileWidgetComponent', () => {
|
|||||||
|
|
||||||
widget.onAttachFileClicked(regularFile);
|
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', () => {
|
it('should fetch getContentPreview when file is neither temporary nor has sourceId', () => {
|
||||||
@@ -874,7 +874,7 @@ describe('AttachFileWidgetComponent', () => {
|
|||||||
widget.onAttachFileClicked(regularFile);
|
widget.onAttachFileClicked(regularFile);
|
||||||
|
|
||||||
expect(processContentService.getContentPreview).toHaveBeenCalledWith(123);
|
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', () => {
|
it('should not emit formContentClicked when file has no sourceId and contentAvailable is false', () => {
|
||||||
@@ -882,7 +882,7 @@ describe('AttachFileWidgetComponent', () => {
|
|||||||
|
|
||||||
widget.onAttachFileClicked(fileWithoutContent);
|
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', () => {
|
it('should not emit formContentClicked when file is external', () => {
|
||||||
@@ -890,7 +890,7 @@ describe('AttachFileWidgetComponent', () => {
|
|||||||
|
|
||||||
widget.onAttachFileClicked(externalFile);
|
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', () => {
|
it('should not emit formContentClicked when file has no sourceId and isStartProcessPage is true', () => {
|
||||||
@@ -899,7 +899,7 @@ describe('AttachFileWidgetComponent', () => {
|
|||||||
|
|
||||||
widget.onAttachFileClicked(fileWithoutContent);
|
widget.onAttachFileClicked(fileWithoutContent);
|
||||||
|
|
||||||
expect(widget.formService.formContentClicked.next).not.toHaveBeenCalled();
|
expect(formService.formContentClicked.next).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-6
@@ -18,14 +18,13 @@
|
|||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, DestroyRef, inject, isDevMode, OnInit, ViewEncapsulation } from '@angular/core';
|
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 { AlfrescoIconComponent, ContentNodeDialogService, ContentService } from '@alfresco/adf-content-services';
|
||||||
import { AlfrescoEndpointRepresentation, Node, NodeChildAssociation, RelatedContentRepresentation } from '@alfresco/js-api';
|
import { AlfrescoEndpointRepresentation, Node, NodeChildAssociation, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||||
import { from, of, zip } from 'rxjs';
|
import { from, of, zip } from 'rxjs';
|
||||||
import { mergeMap } from 'rxjs/operators';
|
import { mergeMap } from 'rxjs/operators';
|
||||||
import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service';
|
import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service';
|
||||||
import { UploadWidgetComponent } from '../upload/upload.widget';
|
import { UploadWidgetComponent } from '../upload/upload.widget';
|
||||||
import { ProcessContentService } from '../../services/process-content.service';
|
|
||||||
import { ActivitiContentService } from '../../services/activiti-alfresco.service';
|
import { ActivitiContentService } from '../../services/activiti-alfresco.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
@@ -53,9 +52,6 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
|||||||
private readonly destroyRef = inject(DestroyRef);
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public formService: FormService,
|
|
||||||
public thumbnails: ThumbnailService,
|
|
||||||
public processContentService: ProcessContentService,
|
|
||||||
private activitiContentService: ActivitiContentService,
|
private activitiContentService: ActivitiContentService,
|
||||||
private contentService: ContentService,
|
private contentService: ContentService,
|
||||||
private contentDialog: ContentNodeDialogService,
|
private contentDialog: ContentNodeDialogService,
|
||||||
@@ -65,7 +61,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
|||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private attachDialogService: AttachFileWidgetDialogService
|
private attachDialogService: AttachFileWidgetDialogService
|
||||||
) {
|
) {
|
||||||
super(formService, thumbnails, processContentService);
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
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 { CommonModule } from '@angular/common';
|
||||||
import { ContentWidgetComponent } from './content.widget';
|
import { ContentWidgetComponent } from './content.widget';
|
||||||
|
|
||||||
@@ -41,10 +41,6 @@ export class DocumentWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
fileId: string = null;
|
fileId: string = null;
|
||||||
hasFile: boolean = false;
|
hasFile: boolean = false;
|
||||||
|
|
||||||
constructor(public formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
const file = this.field.value;
|
const file = this.field.value;
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { WidgetVisibilityService, WidgetComponent, FormService, ErrorWidgetComponent } from '@alfresco/adf-core';
|
import { WidgetVisibilityService, WidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||||
import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewEncapsulation } from '@angular/core';
|
import { ChangeDetectorRef, Component, ElementRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { DynamicTableColumn } from './editors/models/dynamic-table-column.model';
|
import { DynamicTableColumn } from './editors/models/dynamic-table-column.model';
|
||||||
import { DynamicTableRow } from './editors/models/dynamic-table-row.model';
|
import { DynamicTableRow } from './editors/models/dynamic-table-row.model';
|
||||||
import { DynamicTableModel } from './editors/models/dynamic-table.widget.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];
|
private selectArrayCode = [32, 0, 13];
|
||||||
|
|
||||||
constructor(
|
public elementRef = inject(ElementRef);
|
||||||
public formService: FormService,
|
private visibilityService = inject(WidgetVisibilityService);
|
||||||
public elementRef: ElementRef,
|
private cd = inject(ChangeDetectorRef);
|
||||||
private visibilityService: WidgetVisibilityService,
|
|
||||||
private cd: ChangeDetectorRef
|
|
||||||
) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* 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 { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
@@ -30,8 +30,4 @@ import { AlfrescoViewerComponent } from '@alfresco/adf-content-services';
|
|||||||
styleUrls: ['./file-viewer.widget.scss'],
|
styleUrls: ['./file-viewer.widget.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class FileViewerWidgetComponent extends BaseViewerWidgetComponent {
|
export class FileViewerWidgetComponent extends BaseViewerWidgetComponent {}
|
||||||
constructor(formService: FormService) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+4
-5
@@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, ElementRef, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, ElementRef, inject, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { ErrorWidgetComponent, FormService, GroupModel, WidgetComponent } from '@alfresco/adf-core';
|
import { ErrorWidgetComponent, GroupModel, WidgetComponent } from '@alfresco/adf-core';
|
||||||
import { catchError, debounceTime, distinctUntilChanged, switchMap, tap } from 'rxjs/operators';
|
import { catchError, debounceTime, distinctUntilChanged, switchMap, tap } from 'rxjs/operators';
|
||||||
import { merge, of } from 'rxjs';
|
import { merge, of } from 'rxjs';
|
||||||
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
||||||
@@ -84,9 +84,8 @@ export class FunctionalGroupWidgetComponent extends WidgetComponent implements O
|
|||||||
@ViewChild('inputValue', { static: true })
|
@ViewChild('inputValue', { static: true })
|
||||||
input: ElementRef;
|
input: ElementRef;
|
||||||
|
|
||||||
constructor(public peopleProcessService: PeopleProcessService, public formService: FormService, public elementRef: ElementRef) {
|
public peopleProcessService = inject(PeopleProcessService);
|
||||||
super(formService);
|
public elementRef = inject(ElementRef);
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { ErrorWidgetComponent, FormService, InitialUsernamePipe, WidgetComponent } from '@alfresco/adf-core';
|
import { ErrorWidgetComponent, InitialUsernamePipe, WidgetComponent } from '@alfresco/adf-core';
|
||||||
import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, inject, OnInit, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';
|
||||||
import { MatChipsModule } from '@angular/material/chips';
|
import { MatChipsModule } from '@angular/material/chips';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
@@ -91,13 +91,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
return list;
|
return list;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
public peopleProcessService = inject(PeopleProcessService);
|
||||||
constructor(
|
|
||||||
public formService: FormService,
|
|
||||||
public peopleProcessService: PeopleProcessService
|
|
||||||
) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
|
|||||||
+1
-4
@@ -18,7 +18,6 @@
|
|||||||
import { ComponentFixture, fakeAsync, getTestBed } from '@angular/core/testing';
|
import { ComponentFixture, fakeAsync, getTestBed } from '@angular/core/testing';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
FormService,
|
|
||||||
ContainerModel,
|
ContainerModel,
|
||||||
FormFieldTypes,
|
FormFieldTypes,
|
||||||
FormFieldOption,
|
FormFieldOption,
|
||||||
@@ -36,7 +35,6 @@ import { MatRadioButtonHarness, MatRadioGroupHarness } from '@angular/material/r
|
|||||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
describe('RadioButtonsWidgetComponent', () => {
|
describe('RadioButtonsWidgetComponent', () => {
|
||||||
let formService: FormService;
|
|
||||||
let widget: RadioButtonsWidgetComponent;
|
let widget: RadioButtonsWidgetComponent;
|
||||||
let taskFormService: TaskFormService;
|
let taskFormService: TaskFormService;
|
||||||
let processDefinitionService: ProcessDefinitionService;
|
let processDefinitionService: ProcessDefinitionService;
|
||||||
@@ -52,8 +50,7 @@ describe('RadioButtonsWidgetComponent', () => {
|
|||||||
taskFormService = getTestBed().inject(TaskFormService);
|
taskFormService = getTestBed().inject(TaskFormService);
|
||||||
processDefinitionService = getTestBed().inject(ProcessDefinitionService);
|
processDefinitionService = getTestBed().inject(ProcessDefinitionService);
|
||||||
|
|
||||||
formService = new FormService();
|
widget = getTestBed().createComponent(RadioButtonsWidgetComponent).componentInstance;
|
||||||
widget = new RadioButtonsWidgetComponent(formService, taskFormService, processDefinitionService);
|
|
||||||
widget.field = new FormFieldModel(new FormModel(), { restUrl: '<url>', optionType: 'rest' });
|
widget.field = new FormFieldModel(new FormModel(), { restUrl: '<url>', optionType: 'rest' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { ErrorWidgetComponent, FormService, WidgetComponent } from '@alfresco/adf-core';
|
import { ErrorWidgetComponent, WidgetComponent } from '@alfresco/adf-core';
|
||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, inject, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { TaskFormService } from '../../services/task-form.service';
|
import { TaskFormService } from '../../services/task-form.service';
|
||||||
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@@ -45,13 +45,8 @@ import { FormsModule } from '@angular/forms';
|
|||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class RadioButtonsWidgetComponent extends WidgetComponent implements OnInit {
|
export class RadioButtonsWidgetComponent extends WidgetComponent implements OnInit {
|
||||||
constructor(
|
private taskFormService = inject(TaskFormService);
|
||||||
public formService: FormService,
|
private processDefinitionService = inject(ProcessDefinitionService);
|
||||||
private taskFormService: TaskFormService,
|
|
||||||
private processDefinitionService: ProcessDefinitionService
|
|
||||||
) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.isValidRestConfig() && !this.isReadOnlyForm()) {
|
if (this.isValidRestConfig() && !this.isReadOnlyForm()) {
|
||||||
|
|||||||
@@ -18,18 +18,16 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { By } from '@angular/platform-browser';
|
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 { TypeaheadWidgetComponent } from './typeahead.widget';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { TaskFormService } from '../../services/task-form.service';
|
import { TaskFormService } from '../../services/task-form.service';
|
||||||
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
||||||
|
|
||||||
describe('TypeaheadWidgetComponent', () => {
|
describe('TypeaheadWidgetComponent', () => {
|
||||||
let formService: FormService;
|
|
||||||
let widget: TypeaheadWidgetComponent;
|
let widget: TypeaheadWidgetComponent;
|
||||||
let translationService: TranslateService;
|
let translationService: TranslateService;
|
||||||
let taskFormService: TaskFormService;
|
let taskFormService: TaskFormService;
|
||||||
let processDefinitionService: ProcessDefinitionService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -37,12 +35,10 @@ describe('TypeaheadWidgetComponent', () => {
|
|||||||
});
|
});
|
||||||
translationService = TestBed.inject(TranslateService);
|
translationService = TestBed.inject(TranslateService);
|
||||||
taskFormService = TestBed.inject(TaskFormService);
|
taskFormService = TestBed.inject(TaskFormService);
|
||||||
processDefinitionService = TestBed.inject(ProcessDefinitionService);
|
|
||||||
spyOn(translationService, 'instant').and.callFake((key) => key);
|
spyOn(translationService, 'instant').and.callFake((key) => key);
|
||||||
spyOn(translationService, 'get').and.callFake((key) => of(key));
|
spyOn(translationService, 'get').and.callFake((key) => of(key));
|
||||||
|
|
||||||
formService = new FormService();
|
widget = TestBed.createComponent(TypeaheadWidgetComponent).componentInstance;
|
||||||
widget = new TypeaheadWidgetComponent(formService, taskFormService, processDefinitionService);
|
|
||||||
widget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }));
|
widget.field = new FormFieldModel(new FormModel({ taskId: 'task-id' }));
|
||||||
widget.field.restUrl = 'whateverURL';
|
widget.field.restUrl = 'whateverURL';
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* 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 { 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 { TaskFormService } from '../../services/task-form.service';
|
||||||
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@@ -53,13 +53,8 @@ export class TypeaheadWidgetComponent extends WidgetComponent implements OnInit
|
|||||||
oldValue: string;
|
oldValue: string;
|
||||||
options: FormFieldOption[] = [];
|
options: FormFieldOption[] = [];
|
||||||
|
|
||||||
constructor(
|
private taskFormService = inject(TaskFormService);
|
||||||
public formService: FormService,
|
private processDefinitionService = inject(ProcessDefinitionService);
|
||||||
private taskFormService: TaskFormService,
|
|
||||||
private processDefinitionService: ProcessDefinitionService
|
|
||||||
) {
|
|
||||||
super(formService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field.form.taskId && this.field.restUrl) {
|
if (this.field.form.taskId && this.field.restUrl) {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { ThumbnailService, FormService, ContentLinkModel, WidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
import { ThumbnailService, ContentLinkModel, WidgetComponent, ErrorWidgetComponent } from '@alfresco/adf-core';
|
||||||
import { Component, ElementRef, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, ElementRef, inject, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { Observable, from } from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { ProcessContentService } from '../../services/process-content.service';
|
import { ProcessContentService } from '../../services/process-content.service';
|
||||||
import { mergeMap, map } from 'rxjs/operators';
|
import { mergeMap, map } from 'rxjs/operators';
|
||||||
@@ -55,9 +55,8 @@ export class UploadWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
@ViewChild('uploadFiles')
|
@ViewChild('uploadFiles')
|
||||||
fileInput: ElementRef;
|
fileInput: ElementRef;
|
||||||
|
|
||||||
constructor(public formService: FormService, private thumbnailService: ThumbnailService, public processContentService: ProcessContentService) {
|
protected thumbnailService = inject(ThumbnailService);
|
||||||
super(formService);
|
protected processContentService = inject(ProcessContentService);
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field?.value?.length > 0) {
|
if (this.field?.value?.length > 0) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"target": "es2020"
|
"target": "es2022"
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"skipTemplateCodegen": true,
|
"skipTemplateCodegen": true,
|
||||||
|
|||||||
+2
-2
@@ -15,12 +15,12 @@
|
|||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"target": "es2015",
|
"target": "ES2022",
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"typeRoots": ["node_modules/@types"],
|
"typeRoots": ["node_modules/@types"],
|
||||||
"types": ["jasmine", "node", "jasminewd2"],
|
"types": ["jasmine", "node", "jasminewd2"],
|
||||||
"lib": ["es2018", "esnext.array", "esnext.asynciterable", "dom"],
|
"lib": ["es2022", "dom"],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@alfresco/adf-content-services": ["lib/content-services/src/public-api.ts"],
|
"@alfresco/adf-content-services": ["lib/content-services/src/public-api.ts"],
|
||||||
"@alfresco/adf-core": ["lib/core/src/public-api.ts"],
|
"@alfresco/adf-core": ["lib/core/src/public-api.ts"],
|
||||||
|
|||||||
Reference in New Issue
Block a user