#967 internal demo for custom editors (demo shell)

This commit is contained in:
Denys Vuika
2016-11-15 16:51:51 +00:00
committed by Mario Romano
parent effedab739
commit de4537f0e4
4 changed files with 35 additions and 2 deletions

View File

@@ -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() {

View File

@@ -0,0 +1,23 @@
import { NgModule, Component, ElementRef } from '@angular/core';
import { TextFieldWidgetComponent } from 'ng2-activiti-form';
@Component({
selector: 'custom-editor',
template: `
<div style="color: red">Look, I'm a custom editor!</div>
`
})
export class CustomEditorComponent extends TextFieldWidgetComponent {
constructor(elementRef: ElementRef) {
super(elementRef);
}
}
@NgModule({
declarations: [ CustomEditorComponent ],
exports: [ CustomEditorComponent ],
entryComponents: [ CustomEditorComponent ]
})
export class CustomEditorsModule {}