-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 0.6.0.
- Loading branch information
Showing
61 changed files
with
1,135 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
html, | ||
body, | ||
#designer { | ||
margin: 0; | ||
padding: 0; | ||
width: 100vw; | ||
height: 100vh; | ||
overflow: hidden; | ||
} | ||
body, | ||
input, | ||
textarea { | ||
font: 14px/1.3em Arial, Verdana, sans-serif; | ||
} | ||
.sqd-global-editor { | ||
padding: 10px; | ||
line-height: 1.3em; | ||
box-sizing: border-box; | ||
} | ||
a { | ||
color: #000; | ||
text-decoration: underline; | ||
} | ||
a:hover { | ||
text-decoration: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>📖 Editors - Sequential Workflow Editor</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> | ||
<link rel="icon" href="./assets/favicon.ico" /> | ||
<script src="./builds/editors.js" defer></script> | ||
<link rel="stylesheet" href="./assets/editors.css" /> | ||
</head> | ||
<body> | ||
<div id="designer"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Designer, Uid } from 'sequential-workflow-designer'; | ||
import { EditorProvider } from 'sequential-workflow-editor'; | ||
import { definitionModel } from './model/definition-model'; | ||
|
||
import 'sequential-workflow-designer/css/designer.css'; | ||
import 'sequential-workflow-designer/css/designer-light.css'; | ||
import 'sequential-workflow-editor/css/editor.css'; | ||
|
||
export class App { | ||
public static create(): App { | ||
const placeholder = document.getElementById('designer') as HTMLElement; | ||
|
||
const editorProvider = EditorProvider.create(definitionModel, { | ||
uidGenerator: Uid.next | ||
}); | ||
|
||
const designer = Designer.create(placeholder, editorProvider.activateDefinition(), { | ||
controlBar: true, | ||
editors: { | ||
globalEditorProvider: () => { | ||
const editor = document.createElement('div'); | ||
editor.innerHTML = | ||
'This demo showcases all the supported editors by the Sequential Workflow Editor. <a href="https://github.com/nocode-js/sequential-workflow-editor">GitHub</a>'; | ||
return editor; | ||
}, | ||
stepEditorProvider: editorProvider.createStepEditorProvider() | ||
}, | ||
validator: { | ||
step: editorProvider.createStepValidator(), | ||
root: editorProvider.createRootValidator() | ||
}, | ||
steps: { | ||
iconUrlProvider: () => './assets/icon-task.svg' | ||
}, | ||
toolbox: { | ||
groups: editorProvider.getToolboxGroups(), | ||
labelProvider: editorProvider.createStepLabelProvider() | ||
} | ||
}); | ||
|
||
if (location.hash) { | ||
const type = location.hash.substring(1); | ||
const step = designer.getDefinition().sequence.find(s => s.type === type); | ||
if (step) { | ||
designer.selectStepById(step.id); | ||
} | ||
} | ||
|
||
return new App(); | ||
} | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', App.create, false); |
20 changes: 20 additions & 0 deletions
20
demos/webpack-app/src/editors/model/any-variables-step-model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { AnyVariables, anyVariablesValueModel, createStepModel } from 'sequential-workflow-editor-model'; | ||
import { Step } from 'sequential-workflow-model'; | ||
|
||
export interface AnyVariablesStepModel extends Step { | ||
type: 'anyVariables'; | ||
componentType: 'task'; | ||
properties: { | ||
zeroConfig: AnyVariables; | ||
onlyBoolean: AnyVariables; | ||
}; | ||
} | ||
|
||
export const anyVariablesStepModel = createStepModel<AnyVariablesStepModel>('anyVariables', 'task', step => { | ||
step.property('zeroConfig').value(anyVariablesValueModel({})); | ||
step.property('onlyBoolean').value( | ||
anyVariablesValueModel({ | ||
valueTypes: ['boolean'] | ||
}) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { booleanValueModel, createStepModel } from 'sequential-workflow-editor-model'; | ||
import { Step } from 'sequential-workflow-model'; | ||
|
||
export interface BooleanStepModel extends Step { | ||
type: 'boolean'; | ||
componentType: 'task'; | ||
properties: { | ||
zeroConfig: boolean; | ||
defaultValueTrue: boolean; | ||
defaultValueFalse: boolean; | ||
}; | ||
} | ||
|
||
export const booleanStepModel = createStepModel<BooleanStepModel>('boolean', 'task', step => { | ||
step.property('zeroConfig').value(booleanValueModel({})); | ||
step.property('defaultValueTrue').value( | ||
booleanValueModel({ | ||
defaultValue: true | ||
}) | ||
); | ||
step.property('defaultValueFalse').value( | ||
booleanValueModel({ | ||
defaultValue: false | ||
}) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { choiceValueModel, createStepModel } from 'sequential-workflow-editor-model'; | ||
import { Step } from 'sequential-workflow-model'; | ||
|
||
export interface ChoiceStepModel extends Step { | ||
type: 'choice'; | ||
componentType: 'task'; | ||
properties: { | ||
minimalConfig: string; | ||
defaultValueGreen: string; | ||
}; | ||
} | ||
|
||
export const choiceStepModel = createStepModel<ChoiceStepModel>('choice', 'task', step => { | ||
const choices = ['red', 'blue', 'green']; | ||
|
||
step.property('minimalConfig').value(choiceValueModel({ choices })); | ||
step.property('defaultValueGreen').value(choiceValueModel({ choices, defaultValue: 'green' })); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createDefinitionModel } from 'sequential-workflow-editor-model'; | ||
import { stepModels } from './step-models'; | ||
import { rootModel } from './root-model'; | ||
|
||
export const definitionModel = createDefinitionModel(model => { | ||
model.valueTypes(['string', 'number', 'boolean']); | ||
model.root(rootModel); | ||
model.steps(stepModels); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Dynamic, booleanValueModel, createStepModel, dynamicValueModel, stringValueModel } from 'sequential-workflow-editor-model'; | ||
import { Step } from 'sequential-workflow-model'; | ||
|
||
export interface DynamicStepModel extends Step { | ||
type: 'dynamic'; | ||
componentType: 'task'; | ||
properties: { | ||
example: Dynamic<string | boolean>; | ||
}; | ||
} | ||
|
||
export const dynamicStepModel = createStepModel<DynamicStepModel>('dynamic', 'task', step => { | ||
step.property('example').value( | ||
dynamicValueModel({ | ||
models: [stringValueModel({}), booleanValueModel({})] | ||
}) | ||
); | ||
}); |
37 changes: 37 additions & 0 deletions
37
demos/webpack-app/src/editors/model/generated-string-step-model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { createStepModel, generatedStringValueModel, numberValueModel } from 'sequential-workflow-editor-model'; | ||
import { Step } from 'sequential-workflow-model'; | ||
|
||
export interface GeneratedStringStepModel extends Step { | ||
type: 'generatedString'; | ||
componentType: 'task'; | ||
properties: { | ||
x: number; | ||
example: string; | ||
}; | ||
} | ||
|
||
export const generatedStringStepModel = createStepModel<GeneratedStringStepModel>('generatedString', 'task', step => { | ||
step.property('x').value(numberValueModel({})); | ||
|
||
step.property('example') | ||
.dependentProperty('x') | ||
.value( | ||
generatedStringValueModel({ | ||
generator(context) { | ||
const x = context.getPropertyValue('x'); | ||
switch (x) { | ||
case 0: | ||
return 'Only zero :('; | ||
case 1: | ||
return 'One! Nice! :)'; | ||
case 2: | ||
return 'Two! Cool number! :))))'; | ||
} | ||
if (x < 0) { | ||
return 'No no no! Negative number :('; | ||
} | ||
return 'Give me other number!'; | ||
} | ||
}) | ||
); | ||
}); |
26 changes: 26 additions & 0 deletions
26
demos/webpack-app/src/editors/model/nullable-any-variable-step-model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { NullableAnyVariable, createStepModel, nullableAnyVariableValueModel } from 'sequential-workflow-editor-model'; | ||
import { Step } from 'sequential-workflow-model'; | ||
|
||
export interface NullableAnyVariableStepModel extends Step { | ||
type: 'nullableAnyVariable'; | ||
componentType: 'task'; | ||
properties: { | ||
zeroConfig: NullableAnyVariable; | ||
required: NullableAnyVariable; | ||
onlyNumber: NullableAnyVariable; | ||
}; | ||
} | ||
|
||
export const nullableAnyVariableStepModel = createStepModel<NullableAnyVariableStepModel>('nullableAnyVariable', 'task', step => { | ||
step.property('zeroConfig').value(nullableAnyVariableValueModel({})); | ||
step.property('required').value( | ||
nullableAnyVariableValueModel({ | ||
isRequired: true | ||
}) | ||
); | ||
step.property('onlyNumber').value( | ||
nullableAnyVariableValueModel({ | ||
valueTypes: ['number'] | ||
}) | ||
); | ||
}); |
40 changes: 40 additions & 0 deletions
40
demos/webpack-app/src/editors/model/nullable-variable-definition-step-model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { NullableVariableDefinition, createStepModel, nullableVariableDefinitionValueModel } from 'sequential-workflow-editor-model'; | ||
import { Step } from 'sequential-workflow-model'; | ||
|
||
export interface NullableVariableDefinitionStepModel extends Step { | ||
type: 'nullableVariableDefinition'; | ||
componentType: 'task'; | ||
properties: { | ||
minimalConfig: NullableVariableDefinition; | ||
required: NullableVariableDefinition; | ||
defaultValue: NullableVariableDefinition; | ||
}; | ||
} | ||
|
||
export const nullableVariableDefinitionStepModel = createStepModel<NullableVariableDefinitionStepModel>( | ||
'nullableVariableDefinition', | ||
'task', | ||
step => { | ||
step.property('minimalConfig').value( | ||
nullableVariableDefinitionValueModel({ | ||
valueType: 'number' | ||
}) | ||
); | ||
step.property('required').value( | ||
nullableVariableDefinitionValueModel({ | ||
valueType: 'number', | ||
isRequired: true | ||
}) | ||
); | ||
|
||
step.property('defaultValue').value( | ||
nullableVariableDefinitionValueModel({ | ||
valueType: 'number', | ||
defaultValue: { | ||
name: 'index', | ||
type: 'number' | ||
} | ||
}) | ||
); | ||
} | ||
); |
Oops, something went wrong.