mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#967 internal demo for custom editors (demo shell)
This commit is contained in:
committed by
Mario Romano
parent
effedab739
commit
de4537f0e4
@@ -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() {
|
||||
|
@@ -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 {}
|
Reference in New Issue
Block a user