All Projects → bpmn-io → bpmn-js-example-angular

bpmn-io / bpmn-js-example-angular

Licence: other
An example how to integrate bpmn-js with an Angular application.

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to bpmn-js-example-angular

bpmn
BPMN diagrams in R
Stars: ✭ 16 (-67.35%)
Mutual labels:  bpmn-js
Bpmn Js
A BPMN 2.0 rendering toolkit and web modeler.
Stars: ✭ 5,592 (+11312.24%)
Mutual labels:  bpmn-js
bpmn-js-sketchy
A sketchy renderer for bpmn-js.
Stars: ✭ 19 (-61.22%)
Mutual labels:  bpmn-js
bpmn-js-token-simulation
A BPMN 2.0 specification compliant token simulator.
Stars: ✭ 130 (+165.31%)
Mutual labels:  bpmn-js
bpmn-editor
This repository contains a number of examples showing how use and integrate bpmn-js it into your applications.
Stars: ✭ 48 (-2.04%)
Mutual labels:  bpmn-js
vs-code-bpmn-io
Edit BPMN 2.0 files. Based on bpmn.io tools.
Stars: ✭ 87 (+77.55%)
Mutual labels:  bpmn-js
bpmn-server
BPMN 2.0 server for Node.js , providing modeling, execution, persistence and monitoring for Workflow. along with sample UI. Intended to be developers workbench for BPMN 2.0
Stars: ✭ 70 (+42.86%)
Mutual labels:  bpmn-js
bpmn-js-seed
[DISCONTINUED] A project to quickly get started with bpmn-js
Stars: ✭ 30 (-38.78%)
Mutual labels:  bpmn-js
bpmn-js-i18n
Internationalization resources for bpmn-js
Stars: ✭ 49 (+0%)
Mutual labels:  bpmn-js
bpmn-vue-activiti
基于Vue3.x + Vite + bpmn-js + element-plus + tsx 实现的Activiti流程设计器(Activiti process designer based on Vue3.x + Vite + BPMN-JS + Element-Plus + TSX implementation)
Stars: ✭ 345 (+604.08%)
Mutual labels:  bpmn-js
blog
一个前端菜鸟的学习记录博客
Stars: ✭ 30 (-38.78%)
Mutual labels:  bpmn-js

bpmn-js-example-angular

CI

An example how to integrate bpmn-js with an Angular application.

Integration Screenshot

Prerequisites

Assume you bootstrapped your application using the ng command:

ng new bpmn-js-app --defaults=true
cd bpmn-js-app

Integrating bpmn-js

Create a component similar to DiagramComponent:

import {
  AfterContentInit,
  Component,
  ElementRef,
  Input,
  OnChanges,
  OnDestroy,
  Output,
  ViewChild,
  SimpleChanges,
  EventEmitter
} from '@angular/core';

import { HttpClient } from '@angular/common/http';
import { catchError } from 'rxjs/operators';

/**
 * You may include a different variant of BpmnJS:
 *
 * bpmn-viewer  - displays BPMN diagrams without the ability
 *                to navigate them
 * bpmn-modeler - bootstraps a full-fledged BPMN editor
 */
import * as BpmnJS from 'bpmn-js/dist/bpmn-modeler.production.min.js';

import { importDiagram } from './rx';

import { throwError } from 'rxjs';

@Component({
  selector: 'app-diagram',
  template: `
    <div #ref class="diagram-container"></div>
  `,
  styles: [
    `
      .diagram-container {
        height: 100%;
        width: 100%;
      }
    `
  ]
})
export class DiagramComponent implements AfterContentInit, OnChanges, OnDestroy {

  // instantiate BpmnJS with component
  private bpmnJS: BpmnJS;

  // retrieve DOM element reference
  @ViewChild('ref', { static: true }) private el: ElementRef;

  @Output() private importDone: EventEmitter<any> = new EventEmitter();

  @Input() private url: string;

  constructor(private http: HttpClient) {

    this.bpmnJS = new BpmnJS();

    this.bpmnJS.on('import.done', ({ error }) => {
      if (!error) {
        this.bpmnJS.get('canvas').zoom('fit-viewport');
      }
    });
  }

  ngAfterContentInit(): void {
    // attach BpmnJS instance to DOM element
    this.bpmnJS.attachTo(this.el.nativeElement);
  }

  ngOnChanges(changes: SimpleChanges) {
    // re-import whenever the url changes
    if (changes.url) {
      this.loadUrl(changes.url.currentValue);
    }
  }

  ngOnDestroy(): void {
    // destroy BpmnJS instance
    this.bpmnJS.destroy();

    this.viewer.attachTo(this.el.nativeElement);
  }
}

Test the Example

npm install
npm run all

Additional Resources

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].