Man, I´m make like this:
import {
Component,
OnInit,
AfterViewInit,
ViewChild,
ElementRef,
AfterContentInit,
OnDestroy,
} from ‘@angular/core’;
import BpmnModeler from ‘camunda-bpmn-js/lib/camunda-platform/Modeler’;
import minimapModule from ‘diagram-js-minimap’;
import BpmnColorPickerModule from ‘bpmn-js-color-picker’;
// import {
// BpmnPropertiesPanelModule,
// BpmnPropertiesProviderModule,
// } from ‘bpmn-js-properties-panel’;
// import camundaModdleDescriptors from ‘camunda-bpmn-moddle/resources/camunda.json’;
@Component({
selector: ‘lib-modeler’,
templateUrl: ‘./modeler.component.html’,
styleUrls: [‘modeler.component.scss’]
})
export class ModelerComponent implements OnInit, AfterViewInit, AfterContentInit, OnDestroy {
@ViewChild(‘bpmn’, { static: true }) private el: ElementRef;
// @ViewChild(‘pro’, { static: true }) private properties: ElementRef;
public bpmnJS: BpmnModeler;
constructor() {
this.bpmnJS = new BpmnModeler({
// propertiesPanel: {
// parent: '#properties'
// },
additionalModules: [
minimapModule,
BpmnColorPickerModule,
// BpmnPropertiesPanelModule,
// BpmnPropertiesProviderModule,
],
// moddleExtensions: {
// camunda: camundaModdleDescriptors
// }
})
}
ngOnInit(): void {
fetch(‘https://cdn.staticaly.com/gh/bpmn-io/bpmn-js-examples/dfceecba/starter/diagram.bpmn’)
// fetch(‘…/…/assets/processo-de-vendas.bpmn’)
.then(res => res.text())
.then((xml) => {
this.bpmnJS.importXML(xml)
})
}
ngAfterContentInit(): void {
this.bpmnJS.attachTo(this.el.nativeElement);
// const propertiesPanel: any = this.bpmnJS.get(‘propertiesPanel’);
// propertiesPanel.attachTo(this.properties.nativeElement);
}
ngOnDestroy(): void {
this.bpmnJS.destroy();
}
ngAfterViewInit(): void {
}
}