Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
miyuesc committed Sep 3, 2024
1 parent 56af294 commit 0ee6a89
Show file tree
Hide file tree
Showing 14 changed files with 1,365 additions and 62 deletions.
13 changes: 13 additions & 0 deletions applications/app-process/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions applications/app-process/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@miyue-mma/app-process",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@bpmn-io/properties-panel": "^3.23.0",
"bpmn-js": "^17.9.2",
"bpmn-js-properties-panel": "^5.21.0"
},
"devDependencies": {
"globals": "^15.9.0"
}
}
1 change: 1 addition & 0 deletions applications/app-process/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions applications/app-process/src/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@import '@bpmn-io/properties-panel/assets/properties-panel.css';
@import 'bpmn-js/dist/assets/diagram-js.css';
@import 'bpmn-js/dist/assets/bpmn-js.css';
@import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';

html,
body,
#root {
width: 100vw;
height: 100vh;
overflow: hidden;
margin: 0;
padding: 0;
box-sizing: border-box;
}
#root {
display: flex;
}
.designer {
flex: 1;
}
.panel {
width: 400px;
}
66 changes: 66 additions & 0 deletions applications/app-process/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import './App.scss'
import { useEffect } from 'react'
import Modeler from 'bpmn-js/lib/Modeler'
import {
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
} from 'bpmn-js-properties-panel'

function App() {
let modeler: Modeler

const initialDiagram
= '<?xml version="1.0" encoding="UTF-8"?>'
+ '<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" '
+ 'targetNamespace="http://bpmn.io/schema/bpmn" '
+ 'id="Definitions_1">'
+ '<bpmn:process id="Process_1" isExecutable="false">'
+ '<bpmn:startEvent id="StartEvent_1"/>'
+ '</bpmn:process>'
+ '<bpmndi:BPMNDiagram id="BPMNDiagram_1">'
+ '<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">'
+ '<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">'
+ '<dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/>'
+ '</bpmndi:BPMNShape>'
+ '</bpmndi:BPMNPlane>'
+ '</bpmndi:BPMNDiagram>'
+ '</bpmn:definitions>'

function initModeler() {
if (modeler)
return
modeler = new Modeler({
container: '#designer',
propertiesPanel: {
parent: '#panel',
},
additionalModules: [
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
],
})

modeler.importXML(initialDiagram, (err) => {
console.log(err)
})

console.log(modeler)
console.log(modeler.get('propertiesPanel'))
}

useEffect(() => {
initModeler()
}, [])

return (
<>
<div className="designer" id="designer"></div>
<div className="panel" id="panel"></div>
</>
)
}

export default App
9 changes: 9 additions & 0 deletions applications/app-process/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App.tsx'

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
1 change: 1 addition & 0 deletions applications/app-process/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
24 changes: 24 additions & 0 deletions applications/app-process/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
7 changes: 7 additions & 0 deletions applications/app-process/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}
22 changes: 22 additions & 0 deletions applications/app-process/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}
7 changes: 7 additions & 0 deletions applications/app-process/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default antfu({
}
},
vue: true,
react: true,
node: true,
typescript: true,
rules: {
Expand Down
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,30 @@
},
"devDependencies": {
"@antfu/eslint-config": "^2.22.0",
"@eslint-react/eslint-plugin": "^1.10.1",
"@eslint/js": "^9.9.0",
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^20.12.11",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@unocss/eslint-plugin": "^0.59.4",
"@vitejs/plugin-react": "^4.3.1",
"@vitejs/plugin-vue": "^5.0.4",
"@vitest/ui": "^1.6.0",
"axios": "^1.6.8",
"esbuild": "^0.21.2",
"eslint": "^8.56.0",
"eslint-plugin-format": "^0.1.1",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"rimraf": "^5.0.7",
"rollup": "^4.17.2",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-node-externals": "^7.1.2",
"sass": "^1.77.7",
"typescript": "^5.4.5",
"typescript-eslint": "^8.0.1",
"unocss": "^0.60.0",
"vite": "^5.2.11",
"vite-plugin-dts": "^3.9.1"
Expand All @@ -55,6 +63,7 @@
"lucide-vue-next": "^0.417.0",
"pinia": "^2.1.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"vitest": "^1.6.0",
"vue": "^3.4.27",
"vue-router": "^4.3.2"
Expand Down
Loading

0 comments on commit 0ee6a89

Please sign in to comment.