Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.zip
.DS_Store
node_modules
.yarn/cache
Binary file modified .yarn/install-state.gz
Binary file not shown.
3 changes: 3 additions & 0 deletions lowcoder-comp-bpmn-io/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.yarn/
node_modules/
lowcoder-comp-bpmn-io-*.tgz
Binary file added lowcoder-comp-bpmn-io/.yarn/install-state.gz
Binary file not shown.
22 changes: 22 additions & 0 deletions lowcoder-comp-bpmn-io/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Using the Lowcoder BPMN.io plugin

![bpmn-js](https://github.com/sjhoeksma/lowcoder-create-component-plugin/blob/lowcoder-comp-bpmn-io/lowcoder-comp-bpmn-io/images/bpmn-js.gif?raw=true)
This plugin enables the usage of [bpmn-js](https://bpmn-js.io) within lowcoder. To use this plugin. Open your lowcoder environment goto the app. Select insert tab, extensions and plugins and add: **lowcoder-comp-bpmn-io**

Edit properties explained:
* **xml**: contains the xml of the bpmn flow. When you load it from a query in none designer mode, for example by `{{query1.data.length>0 ? query1.data[0].xml : ""}}` you can replace variables ex."{{myvalues}}" stored within xml. For example the {{myvalues}} will be replaces with the one within **values** otherwise it is removed
* **values**: Object contain values which will be replaced when using a query. Only works in none designer mode
* **Designer mode**: should we use desinger mode. The onChange event is trigger on editing. The data is available by using referencing `.xml` of the component
* **Image Download**: when enabled you can download the image as svg using the icon in upper rightcorner
* **Download Name**: The name of the image to download
* **onChange**: This event triggers in designer mode when the xml has changed. You can access the changed xml by referencing `.xml` of the component
* **Show BPMN.io logo**: You can turn of the BPMN.io logo, but make sure your are [entitled](https://forum.bpmn.io/t/license-questions/85)

# Example
To help you with understanding how you can use this plugin we have added an [example application](https://github.com/sjhoeksma/lowcoder-create-component-plugin/blob/lowcoder-comp-bpmn-io/lowcoder-comp-bpmn-io/examples/lowcoder-comp-bpmn-io.json?raw=true). Just download the json application file and import it within lowcoder. The two images below show the difference between designer and viewer. Within the viewer you see the variable replacement working.

#### Designer
![designer](https://github.com/sjhoeksma/lowcoder-create-component-plugin/blob/lowcoder-comp-bpmn-io/lowcoder-comp-bpmn-io/images/designer-example.png?raw=true)

#### Viewer
![viewer](https://github.com/sjhoeksma/lowcoder-create-component-plugin/blob/lowcoder-comp-bpmn-io/lowcoder-comp-bpmn-io/images/viewer-example.png?raw=true)
134 changes: 134 additions & 0 deletions lowcoder-comp-bpmn-io/examples/lowcoder-comp-bpmn-io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"applicationInfo": {
"name": "Example lowcoder-comp-bpmn-io",
"createAt": 1708374549503,
"createBy": "659c3d906dfae3228796b5ba",
"applicationId": "65d3ba15ce88962d49bb640x",
"applicationType": 1
},
"applicationDSL": {
"ui": {
"layout": {
"91ffd1f": {
"i": "91ffd1f",
"h": 46,
"w": 24,
"x": 0,
"y": 0
}
},
"items": {
"91ffd1f": {
"compType": "remote#npm#lowcoder-comp-bpmn-io@0.0.6#bpmn",
"comp": {
"autoHeight": "fixed",
"styles": {
"margin": "0",
"padding": "0"
},
"xml": "{{xmlquery.value.length>0 ? xmlquery.value[0].xml : \"\"}}",
"values": "{{values.value}}",
"svgDownload": true,
"designer": false,
"showLogo": true,
"onEvent": [
{
"name": "change",
"handler": {
"compType": "message",
"comp": {
"text": "BPMN Changed",
"level": "info"
},
"condition": "",
"slowdown": "debounce",
"delay": "2s"
}
}
]
},
"name": "bpmn1"
}
}
},
"transformers": [
{
"name": "values",
"script": "return {\"a\" :1, \"O\" : {\"a\":1} }"
},
{
"name": "xmlquery",
"script": "return [\n {\n \"xml\": `<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<bpmn:definitions xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" xmlns:bpmn=\\\"http://www.omg.org/spec/BPMN/20100524/MODEL\\\" xmlns:bpmndi=\\\"http://www.omg.org/spec/BPMN/20100524/DI\\\" xmlns:dc=\\\"http://www.omg.org/spec/DD/20100524/DC\\\" xmlns:di=\\\"http://www.omg.org/spec/DD/20100524/DI\\\" id=\\\"Definitions_04v2rks\\\" targetNamespace=\\\"http://bpmn.io/schema/bpmn\\\" exporter=\\\"bpmn-js (https://demo.bpmn.io)\\\" exporterVersion=\\\"16.4.0\\\">\\n <bpmn:process id=\\\"Process_0x17sqv\\\" isExecutable=\\\"false\\\">\\n <bpmn:task id=\\\"Activity_1u6navf\\\" name=\\\"A\n{{a}}\\\">\\n <bpmn:outgoing>Flow_1fuxa7x</bpmn:outgoing>\\n </bpmn:task>\\n <bpmn:task id=\\\"Activity_0k1jyoh\\\" name=\\\"O.a\n{{O.a}}\\\">\\n <bpmn:incoming>Flow_1fuxa7x</bpmn:incoming>\\n </bpmn:task>\\n <bpmn:sequenceFlow id=\\\"Flow_1fuxa7x\\\" sourceRef=\\\"Activity_1u6navf\\\" targetRef=\\\"Activity_0k1jyoh\\\" />\\n </bpmn:process>\\n <bpmndi:BPMNDiagram id=\\\"BPMNDiagram_1\\\">\\n <bpmndi:BPMNPlane id=\\\"BPMNPlane_1\\\" bpmnElement=\\\"Process_0x17sqv\\\">\\n <bpmndi:BPMNShape id=\\\"Activity_1u6navf_di\\\" bpmnElement=\\\"Activity_1u6navf\\\">\\n <dc:Bounds x=\\\"220\\\" y=\\\"150\\\" width=\\\"100\\\" height=\\\"80\\\" />\\n <bpmndi:BPMNLabel />\\n </bpmndi:BPMNShape>\\n <bpmndi:BPMNShape id=\\\"Activity_0k1jyoh_di\\\" bpmnElement=\\\"Activity_0k1jyoh\\\">\\n <dc:Bounds x=\\\"370\\\" y=\\\"150\\\" width=\\\"100\\\" height=\\\"80\\\" />\\n <bpmndi:BPMNLabel />\\n </bpmndi:BPMNShape>\\n <bpmndi:BPMNEdge id=\\\"Flow_1fuxa7x_di\\\" bpmnElement=\\\"Flow_1fuxa7x\\\">\\n <di:waypoint x=\\\"320\\\" y=\\\"190\\\" />\\n <di:waypoint x=\\\"370\\\" y=\\\"190\\\" />\\n </bpmndi:BPMNEdge>\\n </bpmndi:BPMNPlane>\\n </bpmndi:BPMNDiagram>\\n</bpmn:definitions>\\n`\n }\n]"
}
],
"refTree": {
"value": "",
"items": [
{
"value": "values"
},
{
"value": "xmlquery"
}
]
},
"hooks": [
{
"compType": "urlParams",
"comp": {},
"name": "url"
},
{
"compType": "dayJsLib",
"comp": {},
"name": "dayjs"
},
{
"compType": "lodashJsLib",
"comp": {},
"name": "_"
},
{
"compType": "utils",
"comp": {},
"name": "utils"
},
{
"compType": "message",
"comp": {},
"name": "message"
},
{
"compType": "localStorage",
"comp": {},
"name": "localStorage"
},
{
"compType": "currentUser",
"comp": {},
"name": "currentUser"
},
{
"compType": "screenInfo",
"comp": {},
"name": "screenInfo"
},
{
"compType": "theme",
"comp": {},
"name": "theme"
}
],
"settings": {
"maxWidth": {
"dropdown": "Infinity",
"input": "Infinity"
},
"themeId": "default"
},
"preload": {
"script": "",
"css": ""
}
}
}
5 changes: 5 additions & 0 deletions lowcoder-comp-bpmn-io/icons/bpmn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lowcoder-comp-bpmn-io/images/bpmn-js.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lowcoder-comp-bpmn-io/images/designer-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lowcoder-comp-bpmn-io/images/viewer-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions lowcoder-comp-bpmn-io/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lowcoder Plugin Preview</title>
<style>
#root {
height: 100vh;
}
#root-loader {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
</style>
</head>
<body>
<div id="root">
<div id="root-loader">Loading...</div>
</div>
<script src="index.tsx" type="module"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions lowcoder-comp-bpmn-io/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { createRoot } from 'react-dom/client';
import { CompIDE } from "lowcoder-sdk";
import { name, version, lowcoder } from "./package.json";
import compMap from "./src/index";
import "lowcoder-sdk/dist/style.css";

function CompDevApp() {
return (
<CompIDE
compMap={compMap}
packageName={name}
packageVersion={version}
compMeta={lowcoder.comps}
/>
);
}
const container = document.querySelector("#root") as Element | DocumentFragment;
const root = createRoot(container);
root.render(<CompDevApp />);
39 changes: 39 additions & 0 deletions lowcoder-comp-bpmn-io/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "lowcoder-comp-bpmn-io",
"version": "0.0.6",
"type": "module",
"license": "MIT",
"dependencies": {
"@observablehq/runtime": "^5.9.7",
"@types/react": "18",
"@types/react-dom": "18",
"bpmn-js": "^17.0.2",
"lowcoder-cli": "^0.0.30",
"lowcoder-sdk": "^2.3.1",
"prop-types": "^15.8.1",
"react": "18",
"react-dom": "18",
"react-resize-detector": "^10.0.1",
"typescript": "^5.3.3",
"vite": "^5.1.4"
},
"lowcoder": {
"description": "A https://bpmn.io Lowcoder Component Plugin",
"comps": {
"bpmn": {
"name": "bpmn",
"icon": "./icons/bpmn.svg",
"description": "BPMN Component",
"layoutInfo": {
"w": 24,
"h": 60
}
}
}
},
"scripts": {
"start": "vite",
"build": "lowcoder-cli build",
"build_publish": "lowcoder-cli build --publish"
}
}
Loading