Closed NexPlex closed 1 week ago
Hello @NexPlex,
currently there is one recommended solution: hidden dependent + external. The hidden dependent is available in the pro version.
You can check this example: https://nocode-js.com/examples/sequential-workflow-editor-pro/webpack-pro-app/public/editors.html#branches In this examples branches are generated from the dependant property. It could be a single string as in this example but also the external editor. Also it could be 2 properties with two separated lists (strings). The UX may be not the best but should be fast for prototyping.
The external editor allows to create the best UX, because you can create a popup that provides an expected data structure to the editor. In this case you are not limited by narrow width of the editor panel.
interface Condition {
name: string;
rules: { var: string; something: number; foo: boolean; ... }[];
}
interface ConditionStepModel extends BranchedStep {
type: 'condition';
componentType: 'switch';
properties: {
conditions: Condition[]; // << to edit this value you use own external editor like popup.
};
}
// model
step.property('conditions').value(
createExternalValueModel({
defaultValue: [],
editorId: 'external_foo'
})
);
step.branches()
.dependentProperty('conditions') // << you can have more than 1 dependant property
.value(
createDependentValueModel({
editorId: 'hiddenDependent',
model: createBranchesValueModel({
branches: {},
dynamic: true,
}),
generator(context, currentValue) {
const conditions: Condition[] = context.getPropertyValue('conditions');
const branches: Branches = {};
// here is a logic that creates branches from the dependant property
return branches;
}
})
);
Hi, great application.
I'm trying to add and remove branches using the Angular version. like in this example
https://nocode-js.github.io/sequential-workflow-designer/examples/multi-conditional-switch.html
https://github.com/nocode-js/sequential-workflow-designer/blob/7ca5488da7a5b42419c9f764f004354e6ebb4245/examples/assets/multi-conditional-switch.js
I'm having a lot of difficulty with the TypeScripts restrictions; maybe you can offer some suggestions.
I tried many techniques. This is the code I have now. I am able to add the steps to the designer but not the editor panel.
I am trying to update the parallelStepModel before calling const editorRoot = originalStepEditorProvider(step, context, definition, false), but I can't get it to work. I'm not even sure if this is the best approach.
Thank you in advance.