mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#967 custom stencil mapping demo
This commit is contained in:
committed by
Mario Romano
parent
be2a571608
commit
24daa074e0
@@ -31,7 +31,7 @@ import {
|
||||
} from 'ng2-alfresco-datatable';
|
||||
|
||||
import { FormRenderingService } from 'ng2-activiti-form';
|
||||
import { CustomEditorComponent } from './custom-editor/custom-editor.component';
|
||||
import { /*CustomEditorComponent*/ CustomStencil01 } from './custom-editor/custom-editor.component';
|
||||
|
||||
declare let __moduleName: string;
|
||||
declare var componentHandler;
|
||||
@@ -111,6 +111,9 @@ export class ActivitiDemoComponent implements AfterViewChecked {
|
||||
|
||||
// Uncomment this line to replace all 'text' field editors with custom component
|
||||
// formRenderingService.setComponentTypeResolver('text', () => CustomEditorComponent, true);
|
||||
|
||||
// Uncomment this line to map 'custom_stencil_01' to local editor component
|
||||
formRenderingService.setComponentTypeResolver('custom_stencil_01', () => CustomStencil01, true);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { NgModule, Component, ElementRef } from '@angular/core';
|
||||
import { TextFieldWidgetComponent } from 'ng2-activiti-form';
|
||||
import { NgModule, Component } from '@angular/core';
|
||||
import { WidgetComponent } from 'ng2-activiti-form';
|
||||
|
||||
@Component({
|
||||
selector: 'custom-editor',
|
||||
@@ -7,17 +7,17 @@ import { TextFieldWidgetComponent } from 'ng2-activiti-form';
|
||||
<div style="color: red">Look, I'm a custom editor!</div>
|
||||
`
|
||||
})
|
||||
export class CustomEditorComponent extends TextFieldWidgetComponent {
|
||||
export class CustomEditorComponent extends WidgetComponent {}
|
||||
|
||||
constructor(elementRef: ElementRef) {
|
||||
super(elementRef);
|
||||
}
|
||||
|
||||
}
|
||||
@Component({
|
||||
selector: 'custom-stencil-01',
|
||||
template: `<div style="color: green">ADF version of custom Activiti stencil</div>`
|
||||
})
|
||||
export class CustomStencil01 extends WidgetComponent {}
|
||||
|
||||
@NgModule({
|
||||
declarations: [ CustomEditorComponent ],
|
||||
exports: [ CustomEditorComponent ],
|
||||
entryComponents: [ CustomEditorComponent ]
|
||||
declarations: [ CustomEditorComponent, CustomStencil01 ],
|
||||
exports: [ CustomEditorComponent, CustomStencil01 ],
|
||||
entryComponents: [ CustomEditorComponent, CustomStencil01 ]
|
||||
})
|
||||
export class CustomEditorsModule {}
|
||||
|
Reference in New Issue
Block a user