├── src ├── assets │ ├── .gitkeep │ └── bpmn │ │ └── initial.bpmn ├── favicon.ico ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── styles.scss ├── typings.d.ts ├── app │ ├── app.component.scss │ ├── app.component.html │ ├── app.module.ts │ ├── props-provider │ │ ├── CustomPropsProvider.ts │ │ └── CustomPaletteProvider.ts │ ├── app.component.spec.ts │ ├── bpmn-js │ │ └── bpmn-js.ts │ └── app.component.ts ├── tsconfig.app.json ├── index.html ├── tsconfig.spec.json ├── main.ts ├── test.ts └── polyfills.ts ├── e2e ├── app.po.ts ├── tsconfig.e2e.json └── app.e2e-spec.ts ├── .editorconfig ├── tsconfig.json ├── .gitignore ├── protractor.conf.js ├── karma.conf.js ├── package.json ├── README.md ├── tslint.json └── angular.json /src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/narve/angular-bpmn/HEAD/src/favicon.ico -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | $fa-font-path: "../node_modules/font-awesome/fonts"; 2 | @import "~font-awesome/scss/font-awesome.scss"; 3 | -------------------------------------------------------------------------------- /src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | #properties { 2 | position: absolute; 3 | top: 0; 4 | bottom: 0; 5 | right: 0; 6 | width: 260px; 7 | z-index: 10; 8 | border-left: 1px solid #ccc; 9 | overflow: auto; 10 | } 11 | -------------------------------------------------------------------------------- /e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |

2 | {{title}} 3 |

4 | 5 | 6 | 7 | 8 |
9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('proc-vis-web App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular/BPMN 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "types": [ 8 | "jasmine", 9 | "node" 10 | ] 11 | }, 12 | "files": [ 13 | "test.ts", 14 | "polyfills.ts" 15 | ], 16 | "include": [ 17 | "**/*.spec.ts", 18 | "**/*.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `.angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | 5 | import { AppComponent } from './app.component'; 6 | import {HttpClientModule, HttpClient, HttpHandler} from '@angular/common/http'; 7 | 8 | 9 | 10 | @NgModule({ 11 | declarations: [ 12 | AppComponent 13 | ], 14 | imports: [ 15 | BrowserModule, HttpClientModule 16 | ], 17 | providers: [], 18 | bootstrap: [AppComponent] 19 | }) 20 | export class AppModule { } 21 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "importHelpers": true, 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "moduleResolution": "node", 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "target": "es5", 12 | "typeRoots": [ 13 | "node_modules/@types" 14 | ], 15 | "lib": [ 16 | "es2017", 17 | "dom" 18 | ], 19 | "module": "es2015", 20 | "baseUrl": "./" 21 | } 22 | } -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /dist-server 6 | /tmp 7 | /out-tsc 8 | 9 | # dependencies 10 | /node_modules 11 | 12 | # IDEs and editors 13 | /.idea 14 | .project 15 | .classpath 16 | .c9/ 17 | *.launch 18 | .settings/ 19 | *.sublime-workspace 20 | 21 | # IDE - VSCode 22 | .vscode/* 23 | !.vscode/settings.json 24 | !.vscode/tasks.json 25 | !.vscode/launch.json 26 | !.vscode/extensions.json 27 | 28 | # misc 29 | /.sass-cache 30 | /connect.lock 31 | /coverage 32 | /libpeerconnection.log 33 | npm-debug.log 34 | yarn-error.log 35 | testem.log 36 | /typings 37 | 38 | # e2e 39 | /e2e/*.js 40 | /e2e/*.map 41 | 42 | # System Files 43 | .DS_Store 44 | Thumbs.db 45 | *.*.swp 46 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/assets/bpmn/initial.bpmn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /src/app/props-provider/CustomPropsProvider.ts: -------------------------------------------------------------------------------- 1 | import {EntryFactory, IPropertiesProvider} from '../bpmn-js/bpmn-js'; 2 | 3 | export class CustomPropsProvider implements IPropertiesProvider { 4 | 5 | static $inject = ['translate', 'bpmnPropertiesProvider']; 6 | 7 | // Note that names of arguments must match injected modules, see InjectionNames. 8 | constructor(private translate, private bpmnPropertiesProvider) { 9 | } 10 | 11 | getTabs(element) { 12 | console.log(this.constructor.name, 'Creating property tabs'); 13 | return this.bpmnPropertiesProvider.getTabs(element) 14 | .concat({ 15 | id: 'custom', 16 | label: this.translate('Custom'), 17 | groups: [ 18 | { 19 | id: 'customText', 20 | label: this.translate('customText'), 21 | entries: [ 22 | EntryFactory.textBox({ 23 | id: 'custom', 24 | label: this.translate('customText'), 25 | modelProperty: 'customText' 26 | }), 27 | ] 28 | } 29 | ] 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | describe('AppComponent', () => { 4 | beforeEach(async(() => { 5 | TestBed.configureTestingModule({ 6 | declarations: [ 7 | AppComponent 8 | ], 9 | }).compileComponents(); 10 | })); 11 | it('should create the app', async(() => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.debugElement.componentInstance; 14 | expect(app).toBeTruthy(); 15 | })); 16 | it(`should have as title 'app'`, async(() => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app.title).toEqual('app'); 20 | })); 21 | it('should render title in a h1 tag', async(() => { 22 | const fixture = TestBed.createComponent(AppComponent); 23 | fixture.detectChanges(); 24 | const compiled = fixture.debugElement.nativeElement; 25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/bpmn-js/bpmn-js.ts: -------------------------------------------------------------------------------- 1 | // import _Modeler from 'bpmn-js/lib/Modeler.js'; 2 | import * as _Modeler from "bpmn-js/dist/bpmn-modeler.production.min.js"; 3 | import * as _PropertiesPanelModule from 'bpmn-js-properties-panel'; 4 | import * as _BpmnPropertiesProvider from 'bpmn-js-properties-panel/lib/provider/bpmn'; 5 | import * as _EntryFactory from 'bpmn-js-properties-panel/lib/factory/EntryFactory'; 6 | import _PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider'; 7 | 8 | export const InjectionNames = { 9 | eventBus: 'eventBus', 10 | bpmnFactory: 'bpmnFactory', 11 | elementRegistry: 'elementRegistry', 12 | translate: 'translate', 13 | propertiesProvider: 'propertiesProvider', 14 | bpmnPropertiesProvider: 'bpmnPropertiesProvider', 15 | paletteProvider: 'paletteProvider', 16 | originalPaletteProvider: 'originalPaletteProvider', 17 | }; 18 | 19 | export const Modeler = _Modeler; 20 | export const PropertiesPanelModule = _PropertiesPanelModule; 21 | export const EntryFactory = _EntryFactory; 22 | export const OriginalPaletteProvider = _PaletteProvider; 23 | export const OriginalPropertiesProvider = _BpmnPropertiesProvider; 24 | 25 | export interface IPaletteProvider { 26 | getPaletteEntries(): any; 27 | } 28 | 29 | export interface IPalette { 30 | registerProvider(provider: IPaletteProvider): any; 31 | } 32 | 33 | export interface IPropertiesProvider { 34 | getTabs(elemnt): any; 35 | } 36 | -------------------------------------------------------------------------------- /src/app/props-provider/CustomPaletteProvider.ts: -------------------------------------------------------------------------------- 1 | import {IPalette, IPaletteProvider} from "../bpmn-js/bpmn-js"; 2 | 3 | export class CustomPaletteProvider implements IPaletteProvider { 4 | 5 | static $inject = ['palette', 'originalPaletteProvider', 'elementFactory']; 6 | 7 | private readonly elementFactory: any; 8 | 9 | // Note that names of arguments must match injected modules, see InjectionNames. 10 | // I don't know why originalPaletteProvider matters but it breaks if it isn't there. 11 | // I guess since this component is injected, and it requires an instance of originalPaletteProvider, 12 | // originalPaletteProvider will be new'ed and thus call palette.registerProvider for itself. 13 | // There probably is a better way. 14 | constructor(private palette: IPalette, private originalPaletteProvider: IPaletteProvider, elementFactory) { 15 | // console.log(this.constructor.name, "constructing", palette, originalPaletteProvider); 16 | palette.registerProvider(this); 17 | this.elementFactory = elementFactory; 18 | } 19 | 20 | getPaletteEntries() { 21 | // console.log(this.constructor.name, "getPaletteEntries", this.palette, this.originalPaletteProvider); 22 | return { 23 | save: { 24 | group: 'tools', 25 | className: ['fa-save', 'fa'], 26 | title: 'TEST', 27 | action: { 28 | click: () => console.log( 'TEST Action clicked! Elementfactory: ', this.elementFactory) 29 | } 30 | } 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "proc-vis-web", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "ng", 7 | "start": "ng serve", 8 | "start-prod": "ng serve --prod", 9 | "build": "ng build", 10 | "build-prod": "ng build --prod", 11 | "test": "ng test", 12 | "lint": "ng lint", 13 | "e2e": "ng e2e" 14 | }, 15 | "private": true, 16 | "dependencies": { 17 | "@angular/animations": "7.1.1", 18 | "@angular/common": "7.1.1", 19 | "@angular/compiler": "7.1.1", 20 | "@angular/core": "7.1.1", 21 | "@angular/forms": "7.1.1", 22 | "@angular/http": "7.1.1", 23 | "@angular/platform-browser": "7.1.1", 24 | "@angular/platform-browser-dynamic": "7.1.1", 25 | "@angular/router": "7.1.1", 26 | "bpmn-js": "^2.5.2", 27 | "bpmn-js-properties-panel": "^0.26.2", 28 | "core-js": "^2.4.1", 29 | "font-awesome": "^4.7.0", 30 | "rxjs": "^6.3.3", 31 | "tslib": "^1.9.0", 32 | "zone.js": "^0.8.26" 33 | }, 34 | "devDependencies": { 35 | "@angular-devkit/build-angular": "~0.11.0", 36 | "@angular/cli": "7.1.0", 37 | "@angular/compiler-cli": "7.1.1", 38 | "@angular/language-service": "7.1.1", 39 | "@types/jasmine": "~2.8.3", 40 | "@types/jasminewd2": "~2.0.2", 41 | "@types/node": "~6.0.60", 42 | "codelyzer": "^4.0.1", 43 | "http-server": "^0.11.1", 44 | "jasmine-core": "~2.8.0", 45 | "jasmine-spec-reporter": "~4.2.1", 46 | "karma": "~2.0.0", 47 | "karma-chrome-launcher": "~2.2.0", 48 | "karma-coverage-istanbul-reporter": "^1.2.1", 49 | "karma-jasmine": "~1.1.0", 50 | "karma-jasmine-html-reporter": "^0.2.2", 51 | "protractor": "^5.4.1", 52 | "ts-node": "~4.1.0", 53 | "tslint": "~5.9.1", 54 | "typescript": "3.1.6" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {HttpClient} from '@angular/common/http'; 3 | import {Modeler, OriginalPropertiesProvider, PropertiesPanelModule, InjectionNames, OriginalPaletteProvider} from "./bpmn-js/bpmn-js"; 4 | import {CustomPropsProvider} from './props-provider/CustomPropsProvider'; 5 | import {CustomPaletteProvider} from "./props-provider/CustomPaletteProvider"; 6 | 7 | const customModdle = { 8 | name: "customModdle", 9 | uri: "http://example.com/custom-moddle", 10 | prefix: "custom", 11 | xml: { 12 | tagAlias: "lowerCase" 13 | }, 14 | associations: [], 15 | types: [ 16 | { 17 | "name": "ExtUserTask", 18 | "extends": [ 19 | "bpmn:UserTask" 20 | ], 21 | "properties": [ 22 | { 23 | "name": "worklist", 24 | "isAttr": true, 25 | "type": "String" 26 | } 27 | ] 28 | }, 29 | ] 30 | }; 31 | 32 | @Component({ 33 | selector: 'app-root', 34 | templateUrl: './app.component.html', 35 | styleUrls: ['./app.component.scss'] 36 | }) 37 | export class AppComponent implements OnInit { 38 | title = 'Angular/BPMN'; 39 | modeler; 40 | 41 | constructor(private http: HttpClient) { 42 | } 43 | 44 | ngOnInit(): void { 45 | this.modeler = new Modeler({ 46 | container: '#canvas', 47 | width: '100%', 48 | height: '600px', 49 | additionalModules: [ 50 | PropertiesPanelModule, 51 | 52 | // Re-use original bpmn-properties-module, see CustomPropsProvider 53 | {[InjectionNames.bpmnPropertiesProvider]: ['type', OriginalPropertiesProvider.propertiesProvider[1]]}, 54 | {[InjectionNames.propertiesProvider]: ['type', CustomPropsProvider]}, 55 | 56 | // Re-use original palette, see CustomPaletteProvider 57 | {[InjectionNames.originalPaletteProvider]: ['type', OriginalPaletteProvider]}, 58 | {[InjectionNames.paletteProvider]: ['type', CustomPaletteProvider]}, 59 | ], 60 | propertiesPanel: { 61 | parent: '#properties' 62 | }, 63 | moddleExtension: { 64 | custom: customModdle 65 | } 66 | }); 67 | } 68 | 69 | handleError(err: any) { 70 | if (err) { 71 | console.warn('Ups, error: ', err); 72 | } 73 | } 74 | 75 | load(): void { 76 | const url = '/assets/bpmn/initial.bpmn'; 77 | this.http.get(url, { 78 | headers: {observe: 'response'}, responseType: 'text' 79 | }).subscribe( 80 | (x: any) => { 81 | console.log('Fetched XML, now importing: ', x); 82 | this.modeler.importXML(x, this.handleError); 83 | }, 84 | this.handleError 85 | ); 86 | } 87 | 88 | save(): void { 89 | this.modeler.saveXML((err: any, xml: any) => console.log('Result of saving XML: ', err, xml)); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NB / Warning 2 | 3 | I see that this project is still being forked and viewed. Please note that this repository is old, not updated, 4 | and uses third-party libraries that has since been shown to have multiple vulernabilities. Do not use this code 5 | except for inspiration and ideas. 6 | 7 | # Angular BPMN Sample project 8 | 9 | This is a simple project demonstrating how to integrate Angular (~~5~~ ~~6~~ 7) with the 10 | BPMN-JS components. It is the start of a rewrite of my previous project integrating 11 | Angular2 with BPMN-JS: https://github.com/narve/ang2-bpmnjs. 12 | 13 | The previous project was created in an ancient period when Angular2 was still hot, 14 | and suffered from several problems, 15 | chief among them the complicated setup (lots of webpack configuration) and difficulty 16 | of upgrading components. 17 | 18 | This time around I wanted to use the Angular CLI and as many defaults, standards and conventions as possible. 19 | The main objective is to have a simple, standardized solution, making it easy to maintain and 20 | upgrade the code. 21 | 22 | NB: This project is not affiliated with / created by / endorsed by (etc) Camunda/BPMN.IO or anybody but myself. 23 | 24 | 25 | # Feedback 26 | 27 | Feedback is welcome, as issues, pull requests, comments, whatever. Without feedback this project 28 | will be left unmaintained. 29 | 30 | 31 | # Documentation 32 | 33 | The documentation is kept to a bare minimum in order to avoid out-of-date information. 34 | Especially Angular is a moving target. 35 | Consult the documentation for Typescript/Angular/AngularCLI/BPMN-JS. Remember to check that 36 | you are viewing the correct version! 37 | 38 | To run this project with live-reload etc: 39 | 40 | git clone git@github.com:narve/angular-bpmn.git 41 | cd angular-bpmn 42 | npm install 43 | npm start 44 | 45 | Then look at http://localhost:4200. 46 | 47 | Or else, to run using plain http-server 48 | 49 | npm run build 50 | npx run http-server dist 51 | 52 | 53 | NB: The prod-mode is currently not working - it builds but fails at runtime. 54 | 55 | To run in prod-mode: 56 | 57 | npm run start-prod 58 | 59 | or 60 | 61 | npm run build-prod 62 | npx run http-server dist 63 | 64 | # Requirements / Tested on 65 | 66 | - Linux (Mint) 67 | - Windows (plain Powershell, not Git Bash) 68 | - Linux-On-Windows (WSL) 69 | 70 | - npm v9.2.11 (probably works on other versions) 71 | 72 | # Features / Status 73 | 74 | - Angular CLI based project (see `docs` and `package.json` for exact versions). 75 | - No installation / setup required, besides `node`/`npm` 76 | 77 | - Async loading of a sample BPMN diagram 78 | - Properties panel 79 | - Custom properties (extending original) 80 | - Custom palette (extending original) 81 | 82 | - Surprisingly little actual code (including configuration files!) 83 | - Hopefully usable as a template / inspiration for actual production use 84 | - Hopefully as future-proof as any front-end code can be these days 85 | 86 | 87 | # Known bugs / limitations 88 | 89 | - Let me know :) 90 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | 47 | 48 | 49 | /** 50 | * Required to support Web Animations `@angular/platform-browser/animations`. 51 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 52 | **/ 53 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 54 | 55 | /** 56 | * By default, zone.js will patch all possible macroTask and DomEvents 57 | * user can disable parts of macroTask/DomEvents patch by setting following flags 58 | */ 59 | 60 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 61 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 62 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 63 | 64 | /* 65 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 66 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 67 | */ 68 | // (window as any).__Zone_enable_cross_context_check = true; 69 | 70 | /*************************************************************************************************** 71 | * Zone JS is required by default for Angular itself. 72 | */ 73 | import 'zone.js/dist/zone'; // Included with Angular CLI. 74 | 75 | 76 | 77 | /*************************************************************************************************** 78 | * APPLICATION IMPORTS 79 | */ 80 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 180 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-shadowed-variable": true, 69 | "no-string-literal": false, 70 | "no-string-throw": true, 71 | "no-switch-case-fall-through": true, 72 | "no-trailing-whitespace": false, 73 | "no-unnecessary-initializer": true, 74 | "no-unused-expression": true, 75 | "no-use-before-declare": true, 76 | "no-var-keyword": true, 77 | "object-literal-sort-keys": false, 78 | "one-line": [ 79 | true, 80 | "check-open-brace", 81 | "check-catch", 82 | "check-else", 83 | "check-whitespace" 84 | ], 85 | "prefer-const": true, 86 | "quotemark": [ 87 | false, 88 | "single" 89 | ], 90 | "radix": true, 91 | "semicolon": [ 92 | true, 93 | "always" 94 | ], 95 | "triple-equals": [ 96 | true, 97 | "allow-null-check" 98 | ], 99 | "typedef-whitespace": [ 100 | true, 101 | { 102 | "call-signature": "nospace", 103 | "index-signature": "nospace", 104 | "parameter": "nospace", 105 | "property-declaration": "nospace", 106 | "variable-declaration": "nospace" 107 | } 108 | ], 109 | "unified-signatures": true, 110 | "variable-name": false, 111 | "whitespace": [ 112 | true, 113 | "check-branch", 114 | "check-decl", 115 | "check-operator", 116 | "check-separator", 117 | "check-type" 118 | ], 119 | "directive-selector": [ 120 | true, 121 | "attribute", 122 | "app", 123 | "camelCase" 124 | ], 125 | "component-selector": [ 126 | true, 127 | "element", 128 | "app", 129 | "kebab-case" 130 | ], 131 | "no-output-on-prefix": true, 132 | "use-input-property-decorator": true, 133 | "use-output-property-decorator": true, 134 | "use-host-property-decorator": true, 135 | "no-input-rename": true, 136 | "no-output-rename": true, 137 | "use-life-cycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "component-class-suffix": true, 140 | "directive-class-suffix": true 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "proc-vis-web": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "architect": { 11 | "build": { 12 | "builder": "@angular-devkit/build-angular:browser", 13 | "options": { 14 | "outputPath": "dist", 15 | "index": "src/index.html", 16 | "main": "src/main.ts", 17 | "tsConfig": "src/tsconfig.app.json", 18 | "polyfills": "src/polyfills.ts", 19 | "assets": [ 20 | "src/assets", 21 | "src/favicon.ico" 22 | ], 23 | "styles": [ 24 | "src/styles.scss", 25 | "node_modules/bpmn-js/dist/assets/diagram-js.css", 26 | "node_modules/bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css", 27 | "node_modules/bpmn-js-properties-panel/styles/properties.less" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "optimization": true, 34 | "outputHashing": "all", 35 | "sourceMap": false, 36 | "extractCss": true, 37 | "namedChunks": false, 38 | "aot": true, 39 | "extractLicenses": true, 40 | "vendorChunk": false, 41 | "buildOptimizer": true, 42 | "fileReplacements": [ 43 | { 44 | "replace": "src/environments/environment.ts", 45 | "with": "src/environments/environment.prod.ts" 46 | } 47 | ] 48 | } 49 | } 50 | }, 51 | "serve": { 52 | "builder": "@angular-devkit/build-angular:dev-server", 53 | "options": { 54 | "browserTarget": "proc-vis-web:build" 55 | }, 56 | "configurations": { 57 | "production": { 58 | "browserTarget": "proc-vis-web:build:production" 59 | } 60 | } 61 | }, 62 | "extract-i18n": { 63 | "builder": "@angular-devkit/build-angular:extract-i18n", 64 | "options": { 65 | "browserTarget": "proc-vis-web:build" 66 | } 67 | }, 68 | "test": { 69 | "builder": "@angular-devkit/build-angular:karma", 70 | "options": { 71 | "main": "src/test.ts", 72 | "karmaConfig": "./karma.conf.js", 73 | "polyfills": "src/polyfills.ts", 74 | "tsConfig": "src/tsconfig.spec.json", 75 | "scripts": [], 76 | "styles": [ 77 | "src/styles.scss", 78 | "node_modules/bpmn-js/dist/assets/diagram-js.css", 79 | "node_modules/bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css", 80 | "node_modules/bpmn-js-properties-panel/styles/properties.less" 81 | ], 82 | "assets": [ 83 | "src/assets", 84 | "src/favicon.ico" 85 | ] 86 | } 87 | }, 88 | "lint": { 89 | "builder": "@angular-devkit/build-angular:tslint", 90 | "options": { 91 | "tsConfig": [ 92 | "src/tsconfig.app.json", 93 | "src/tsconfig.spec.json" 94 | ], 95 | "exclude": [ 96 | "**/node_modules/**" 97 | ] 98 | } 99 | } 100 | } 101 | }, 102 | "proc-vis-web-e2e": { 103 | "root": "e2e", 104 | "sourceRoot": "e2e", 105 | "projectType": "application", 106 | "architect": { 107 | "e2e": { 108 | "builder": "@angular-devkit/build-angular:protractor", 109 | "options": { 110 | "protractorConfig": "./protractor.conf.js", 111 | "devServerTarget": "proc-vis-web:serve" 112 | } 113 | }, 114 | "lint": { 115 | "builder": "@angular-devkit/build-angular:tslint", 116 | "options": { 117 | "tsConfig": [ 118 | "e2e/tsconfig.e2e.json" 119 | ], 120 | "exclude": [ 121 | "**/node_modules/**" 122 | ] 123 | } 124 | } 125 | } 126 | } 127 | }, 128 | "defaultProject": "proc-vis-web", 129 | "schematics": { 130 | "@schematics/angular:component": { 131 | "prefix": "app", 132 | "styleext": "css" 133 | }, 134 | "@schematics/angular:directive": { 135 | "prefix": "app" 136 | } 137 | } 138 | } --------------------------------------------------------------------------------