Enables save button when decision table is altered
This commit is contained in:
parent
91132ff792
commit
0aab80522a
|
@ -57,6 +57,7 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
|
|||
}
|
||||
|
||||
onChange(newValue: string, svgValue: string) {
|
||||
console.log('DiagramComponent default onChange');
|
||||
}
|
||||
|
||||
onTouched() {
|
||||
|
@ -123,6 +124,7 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
|
|||
}
|
||||
|
||||
saveDiagram() {
|
||||
if (this.modeler && this.modeler.saveSVG) {
|
||||
this.modeler.saveSVG((svgErr, svg) => {
|
||||
this.svg = svg;
|
||||
this.modeler.saveXML({format: true}, (xmlErr, xml) => {
|
||||
|
@ -130,6 +132,12 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
|
|||
this.writeValue(xml);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.modeler.saveXML({format: true}, (xmlErr, xml) => {
|
||||
this.xml = xml;
|
||||
this.writeValue(xml);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
saveXML() {
|
||||
|
@ -208,14 +216,17 @@ export class DiagramComponent implements ControlValueAccessor, AfterViewInit {
|
|||
moddleExtensions: dmnModelerConfig.moddleExtensions,
|
||||
});
|
||||
|
||||
this.modeler.on('commandStack.changed', () => this.saveDiagram());
|
||||
this.modeler.on('commandStack.changed', () => {
|
||||
this.saveDiagram();
|
||||
});
|
||||
|
||||
this.modeler.on('views.changed', () => {
|
||||
this.saveDiagram();
|
||||
|
||||
const viewer = this.modeler.getActiveViewer();
|
||||
if (viewer) {
|
||||
viewer.get('eventBus').on('commandStack.changed', () => this.saveDiagram());
|
||||
}
|
||||
this.saveDiagram();
|
||||
});
|
||||
|
||||
this.modeler.on('import.done', ({error}) => {
|
||||
|
|
|
@ -69,6 +69,7 @@ export class ModelerComponent implements AfterViewInit {
|
|||
|
||||
ngAfterViewInit(): void {
|
||||
this.diagramComponent.registerOnChange((newXmlValue: string, newSvgValue: string) => {
|
||||
console.log('ModelerComponent > DiagramComponent > onChange');
|
||||
this.draftXml = newXmlValue;
|
||||
this.svg = newSvgValue;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue