|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="UTF-8" /> |
| 5 | + <title>🚢 UMD Example - Sequential Workflow Editor</title> |
| 6 | + <style> |
| 7 | + body { |
| 8 | + font: 14px/1.5 Arial, Tahoma, Serif; |
| 9 | + } |
| 10 | + a { |
| 11 | + color: blue; |
| 12 | + text-decoration: underline; |
| 13 | + } |
| 14 | + a:hover { |
| 15 | + text-decoration: none; |
| 16 | + } |
| 17 | + #placeholder { |
| 18 | + display: block; |
| 19 | + border: 1px solid #ccc; |
| 20 | + padding: 10px; |
| 21 | + } |
| 22 | + </style> |
| 23 | + |
| 24 | + <script src="../../model/dist/index.umd.js"></script> |
| 25 | + <script src="../../editor/dist/index.umd.js"></script> |
| 26 | + </head> |
| 27 | + <body> |
| 28 | + <h1>🚢 UMD Example - Sequential Workflow Editor</h1> |
| 29 | + |
| 30 | + <p> |
| 31 | + This demo shows basic usage of |
| 32 | + <a href="https://github.com/nocode-js/sequential-workflow-editor" target="_blank">Sequential Workflow Editor</a> |
| 33 | + in a browser using UMD bundles. |
| 34 | + </p> |
| 35 | + |
| 36 | + <div id="placeholder"></div> |
| 37 | + |
| 38 | + <script> |
| 39 | + const fooModel = sequentialWorkflowEditorModel.createStepModel('foo', 'task', step => { |
| 40 | + step.property('isEnabled').value(sequentialWorkflowEditorModel.createBooleanValueModel({})); |
| 41 | + }); |
| 42 | + |
| 43 | + const definitionModel = sequentialWorkflowEditorModel.createDefinitionModel(model => { |
| 44 | + model.valueTypes(['string']); |
| 45 | + model.root(() => {}); |
| 46 | + model.steps([fooModel]); |
| 47 | + }); |
| 48 | + |
| 49 | + const editorProvider = sequentialWorkflowEditor.EditorProvider.create(definitionModel, { |
| 50 | + uidGenerator: () => String(Math.random()) |
| 51 | + }); |
| 52 | + |
| 53 | + const step = { |
| 54 | + id: '0x1', |
| 55 | + name: 'test', |
| 56 | + type: 'foo', |
| 57 | + componentType: 'task', |
| 58 | + properties: { isEnabled: true } |
| 59 | + }; |
| 60 | + const definition = { |
| 61 | + properties: {}, |
| 62 | + sequence: [step] |
| 63 | + }; |
| 64 | + |
| 65 | + const placeholder = document.getElementById('placeholder'); |
| 66 | + const context = { |
| 67 | + notifyPropertiesChanged() {}, |
| 68 | + notifyNameChanged() {} |
| 69 | + }; |
| 70 | + const editor = editorProvider.createStepEditorProvider()(step, context, definition); |
| 71 | + placeholder.appendChild(editor); |
| 72 | + </script> |
| 73 | + </body> |
| 74 | +</html> |
0 commit comments