diff --git a/demo-shell-ng2/app/app.module.ts b/demo-shell-ng2/app/app.module.ts index 37e34f4dcb..bf2cdc287f 100644 --- a/demo-shell-ng2/app/app.module.ts +++ b/demo-shell-ng2/app/app.module.ts @@ -35,6 +35,7 @@ import { AnalyticsModule } from 'ng2-activiti-analytics'; import { AppComponent } from './app.component'; import { routing } from './app.routes'; +import { CustomEditorsModule } from './components/activiti/custom-editor/custom-editor.component'; import { DataTableDemoComponent, @@ -68,7 +69,8 @@ import { ActivitiTaskListModule.forRoot(), ActivitiProcessListModule.forRoot(), UserInfoComponentModule.forRoot(), - AnalyticsModule.forRoot() + AnalyticsModule.forRoot(), + CustomEditorsModule ], declarations: [ AppComponent, diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts index 37bc4c51f2..ba84820db7 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts @@ -30,6 +30,9 @@ import { DataSorting } from 'ng2-alfresco-datatable'; +import { FormRenderingService } from 'ng2-activiti-form'; +import { CustomEditorComponent } from './custom-editor/custom-editor.component'; + declare let __moduleName: string; declare var componentHandler; @@ -87,7 +90,7 @@ export class ActivitiDemoComponent implements AfterViewChecked { dataTasks: ObjectDataTableAdapter; dataProcesses: ObjectDataTableAdapter; - constructor(private route: ActivatedRoute) { + constructor(private route: ActivatedRoute, private formRenderingService: FormRenderingService) { this.dataTasks = new ObjectDataTableAdapter( [], [ @@ -105,6 +108,9 @@ export class ActivitiDemoComponent implements AfterViewChecked { ] ); this.dataProcesses.setSorting(new DataSorting('started', 'desc')); + + // Uncomment this line to replace all 'text' field editors with custom component + // formRenderingService.setComponentTypeResolver('text', () => CustomEditorComponent, true); } ngOnInit() { diff --git a/demo-shell-ng2/app/components/activiti/custom-editor/custom-editor.component.ts b/demo-shell-ng2/app/components/activiti/custom-editor/custom-editor.component.ts new file mode 100644 index 0000000000..549df2da29 --- /dev/null +++ b/demo-shell-ng2/app/components/activiti/custom-editor/custom-editor.component.ts @@ -0,0 +1,23 @@ +import { NgModule, Component, ElementRef } from '@angular/core'; +import { TextFieldWidgetComponent } from 'ng2-activiti-form'; + +@Component({ + selector: 'custom-editor', + template: ` +