mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5106] fix stencil registration (#5694)
* customize services on the module level * improved service registration
This commit is contained in:
@@ -17,20 +17,16 @@
|
||||
|
||||
import { Component, EventEmitter, Input, Output, ViewEncapsulation, SimpleChanges, OnInit, OnDestroy, OnChanges } from '@angular/core';
|
||||
import { EcmModelService, NodeService, WidgetVisibilityService,
|
||||
FormService, FormRenderingService, FormBaseComponent, FormOutcomeModel,
|
||||
FormService, FormBaseComponent, FormOutcomeModel,
|
||||
FormEvent, FormErrorEvent, FormFieldModel,
|
||||
FormModel, FormOutcomeEvent, FormValues, ContentLinkModel } from '@alfresco/adf-core';
|
||||
import { Observable, of, Subject } from 'rxjs';
|
||||
import { switchMap, takeUntil } from 'rxjs/operators';
|
||||
import { ProcessFormRenderingService } from './process-form-rendering.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-form',
|
||||
templateUrl: './form.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
providers: [
|
||||
{ provide: FormRenderingService, useClass: ProcessFormRenderingService }
|
||||
]
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class FormComponent extends FormBaseComponent implements OnInit, OnDestroy, OnChanges {
|
||||
|
||||
|
@@ -26,7 +26,10 @@ import { AttachFolderWidgetComponent } from '../content-widget/attach-folder-wid
|
||||
export class ProcessFormRenderingService extends FormRenderingService {
|
||||
constructor() {
|
||||
super();
|
||||
this.setComponentTypeResolver('upload', () => AttachFileWidgetComponent, true);
|
||||
this.setComponentTypeResolver('select-folder', () => AttachFolderWidgetComponent, true);
|
||||
|
||||
this.register({
|
||||
'upload': () => AttachFileWidgetComponent,
|
||||
'select-folder': () => AttachFolderWidgetComponent
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { CoreModule, TRANSLATION_PROVIDER } from '@alfresco/adf-core';
|
||||
import { CoreModule, TRANSLATION_PROVIDER, FormRenderingService } from '@alfresco/adf-core';
|
||||
|
||||
import { MaterialModule } from './material.module';
|
||||
|
||||
@@ -29,6 +29,7 @@ import { ProcessCommentsModule } from './process-comments/process-comments.modul
|
||||
import { AttachmentModule } from './attachment/attachment.module';
|
||||
import { PeopleModule } from './people/people.module';
|
||||
import { FormModule } from './form/form.module';
|
||||
import { ProcessFormRenderingService } from './form/process-form-rendering.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -80,7 +81,9 @@ export class ProcessModule {
|
||||
name: 'adf-process-services',
|
||||
source: 'assets/adf-process-services'
|
||||
}
|
||||
}
|
||||
},
|
||||
FormRenderingService,
|
||||
{ provide: FormRenderingService, useClass: ProcessFormRenderingService }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ import { Component, OnInit, Input, Output, EventEmitter, SimpleChanges } from '@
|
||||
import {
|
||||
FormModel,
|
||||
ContentLinkModel,
|
||||
FormRenderingService,
|
||||
FormFieldValidator,
|
||||
FormOutcomeEvent,
|
||||
AuthenticationService,
|
||||
@@ -29,8 +28,6 @@ import {
|
||||
import { TaskDetailsModel } from '../../models/task-details.model';
|
||||
import { TaskListService } from '../../services/tasklist.service';
|
||||
import { UserRepresentation } from '@alfresco/js-api';
|
||||
import { AttachFileWidgetComponent } from '../../../content-widget/attach-file-widget.component';
|
||||
import { AttachFolderWidgetComponent } from '../../../content-widget/attach-folder-widget.component';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
@@ -129,11 +126,8 @@ export class TaskFormComponent implements OnInit {
|
||||
constructor(
|
||||
private taskListService: TaskListService,
|
||||
private authService: AuthenticationService,
|
||||
private formRenderingService: FormRenderingService,
|
||||
private translationService: TranslationService
|
||||
) {
|
||||
this.formRenderingService.setComponentTypeResolver('upload', () => AttachFileWidgetComponent, true);
|
||||
this.formRenderingService.setComponentTypeResolver('select-folder', () => AttachFolderWidgetComponent, true);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
Reference in New Issue
Block a user