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