sequential-workflow-designer 0.15.4 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -7
- package/css/designer-dark.css +1 -0
- package/css/designer-light.css +1 -0
- package/dist/index.umd.js +84 -57
- package/lib/cjs/index.cjs +84 -57
- package/lib/esm/index.js +84 -57
- package/lib/index.d.ts +27 -8
- package/package.json +1 -1
- package/sass/designer-theme.scss +10 -0
package/README.md
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://actions-badge.atrox.dev/b4rtaz/sequential-workflow-designer/goto?ref=main) [](/LICENSE) [](https://npmjs.org/package/sequential-workflow-designer)
|
|
6
6
|
|
|
7
|
-
> 🚨 **Have you noticed the "package not found" error?** 🚨<br />
|
|
8
|
-
> Check [this comment](https://github.com/nocode-js/sequential-workflow-designer/issues/82#issuecomment-1712958636) for instructions on how to resolve the problem.
|
|
9
|
-
|
|
10
7
|
Sequential workflow designer with 0 external dependencies for web applications. It's written in pure TypeScript and uses SVG for rendering. This designer is not associated with any workflow engine. It's full generic. You may create any kind application by this, from graphical programming languages to workflow builders.
|
|
11
8
|
|
|
12
9
|
Features:
|
|
@@ -98,10 +95,10 @@ Add the below code to your head section in HTML document.
|
|
|
98
95
|
```html
|
|
99
96
|
<head>
|
|
100
97
|
...
|
|
101
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
102
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
103
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
104
|
-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
98
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.1/css/designer.css" rel="stylesheet">
|
|
99
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.1/css/designer-light.css" rel="stylesheet">
|
|
100
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.1/css/designer-dark.css" rel="stylesheet">
|
|
101
|
+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.1/dist/index.umd.js"></script>
|
|
105
102
|
```
|
|
106
103
|
|
|
107
104
|
Call the designer by:
|
package/css/designer-dark.css
CHANGED
package/css/designer-light.css
CHANGED
package/dist/index.umd.js
CHANGED
|
@@ -614,12 +614,11 @@
|
|
|
614
614
|
}
|
|
615
615
|
|
|
616
616
|
class ToolboxApi {
|
|
617
|
-
constructor(state, designerContext, behaviorController,
|
|
617
|
+
constructor(state, designerContext, behaviorController, toolboxDataProvider, uidGenerator) {
|
|
618
618
|
this.state = state;
|
|
619
619
|
this.designerContext = designerContext;
|
|
620
620
|
this.behaviorController = behaviorController;
|
|
621
|
-
this.
|
|
622
|
-
this.configuration = configuration;
|
|
621
|
+
this.toolboxDataProvider = toolboxDataProvider;
|
|
623
622
|
this.uidGenerator = uidGenerator;
|
|
624
623
|
}
|
|
625
624
|
isCollapsed() {
|
|
@@ -631,24 +630,11 @@
|
|
|
631
630
|
subscribeIsCollapsed(listener) {
|
|
632
631
|
this.state.onIsToolboxCollapsedChanged.subscribe(listener);
|
|
633
632
|
}
|
|
634
|
-
|
|
635
|
-
return this.
|
|
636
|
-
}
|
|
637
|
-
getLabel(step) {
|
|
638
|
-
const labelProvider = this.getConfiguration().labelProvider;
|
|
639
|
-
return labelProvider ? labelProvider(step) : step.name;
|
|
633
|
+
getAllGroups() {
|
|
634
|
+
return this.toolboxDataProvider.getAllGroups();
|
|
640
635
|
}
|
|
641
|
-
|
|
642
|
-
return this.
|
|
643
|
-
.groups.map(group => {
|
|
644
|
-
return {
|
|
645
|
-
name: group.name,
|
|
646
|
-
steps: group.steps.filter(s => {
|
|
647
|
-
return filter ? s.name.toLowerCase().includes(filter) : true;
|
|
648
|
-
})
|
|
649
|
-
};
|
|
650
|
-
})
|
|
651
|
-
.filter(group => group.steps.length > 0);
|
|
636
|
+
applyFilter(allGroups, filter) {
|
|
637
|
+
return this.toolboxDataProvider.applyFilter(allGroups, filter);
|
|
652
638
|
}
|
|
653
639
|
/**
|
|
654
640
|
* @param position Mouse or touch position.
|
|
@@ -668,11 +654,62 @@
|
|
|
668
654
|
newStep.id = this.uidGenerator ? this.uidGenerator() : Uid.next();
|
|
669
655
|
return newStep;
|
|
670
656
|
}
|
|
671
|
-
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const regexp = /^[a-zA-Z][a-zA-Z0-9_-]+$/;
|
|
660
|
+
class StepTypeValidator {
|
|
661
|
+
static validate(type) {
|
|
662
|
+
if (!regexp.test(type)) {
|
|
663
|
+
throw new Error(`Step type "${type}" contains not allowed characters`);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
class ToolboxDataProvider {
|
|
669
|
+
constructor(iconProvider, configuration) {
|
|
670
|
+
this.iconProvider = iconProvider;
|
|
671
|
+
this.configuration = configuration;
|
|
672
|
+
this.createItemData = (step) => {
|
|
673
|
+
StepTypeValidator.validate(step.type);
|
|
674
|
+
const iconUrl = this.iconProvider.getIconUrl(step);
|
|
675
|
+
const label = this.configuration && this.configuration.labelProvider ? this.configuration.labelProvider(step) : step.name;
|
|
676
|
+
const description = this.configuration && this.configuration.descriptionProvider ? this.configuration.descriptionProvider(step) : label;
|
|
677
|
+
const lowerCaseLabel = label.toLowerCase();
|
|
678
|
+
return {
|
|
679
|
+
iconUrl,
|
|
680
|
+
label,
|
|
681
|
+
description,
|
|
682
|
+
lowerCaseLabel,
|
|
683
|
+
step
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
getAllGroups() {
|
|
672
688
|
if (!this.configuration) {
|
|
673
|
-
|
|
689
|
+
return [];
|
|
674
690
|
}
|
|
675
|
-
return this.configuration
|
|
691
|
+
return this.configuration.groups.map(group => {
|
|
692
|
+
return {
|
|
693
|
+
name: group.name,
|
|
694
|
+
items: group.steps.map(this.createItemData)
|
|
695
|
+
};
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
applyFilter(allGroups, filter) {
|
|
699
|
+
if (!filter) {
|
|
700
|
+
return allGroups;
|
|
701
|
+
}
|
|
702
|
+
const lowerCaseFilter = filter.toLowerCase();
|
|
703
|
+
return allGroups
|
|
704
|
+
.map(group => {
|
|
705
|
+
return {
|
|
706
|
+
name: group.name,
|
|
707
|
+
items: group.items.filter(s => {
|
|
708
|
+
return s.lowerCaseLabel.includes(lowerCaseFilter);
|
|
709
|
+
})
|
|
710
|
+
};
|
|
711
|
+
})
|
|
712
|
+
.filter(group => group.items.length > 0);
|
|
676
713
|
}
|
|
677
714
|
}
|
|
678
715
|
|
|
@@ -731,7 +768,8 @@
|
|
|
731
768
|
const workspace = new WorkspaceApi(context.state, context.workspaceController);
|
|
732
769
|
const viewportController = context.services.viewportController.create(workspace);
|
|
733
770
|
const viewport = new ViewportApi(context.workspaceController, viewportController);
|
|
734
|
-
|
|
771
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.configuration.toolbox);
|
|
772
|
+
return new DesignerApi(new ControlBarApi(context.state, context.historyController, context.definitionModifier, viewport), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.definitionModifier), workspace, viewport, new PathBarApi(context.state, context.definitionWalker));
|
|
735
773
|
}
|
|
736
774
|
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar) {
|
|
737
775
|
this.controlBar = controlBar;
|
|
@@ -2668,8 +2706,8 @@
|
|
|
2668
2706
|
}
|
|
2669
2707
|
|
|
2670
2708
|
class SelectStepBehavior {
|
|
2671
|
-
static create(pressedStepComponent,
|
|
2672
|
-
const isDragDisabled =
|
|
2709
|
+
static create(pressedStepComponent, isMiddleButton, context) {
|
|
2710
|
+
const isDragDisabled = isMiddleButton ||
|
|
2673
2711
|
context.state.isDragDisabled ||
|
|
2674
2712
|
!context.definitionModifier.isDraggable(pressedStepComponent.step, pressedStepComponent.parentSequence);
|
|
2675
2713
|
return new SelectStepBehavior(pressedStepComponent, isDragDisabled, context, context.state);
|
|
@@ -2779,13 +2817,13 @@
|
|
|
2779
2817
|
this.designerContext = designerContext;
|
|
2780
2818
|
this.state = state;
|
|
2781
2819
|
}
|
|
2782
|
-
resolve(commandOrNull, element,
|
|
2820
|
+
resolve(commandOrNull, element, isMiddleButton) {
|
|
2783
2821
|
if (!commandOrNull) {
|
|
2784
|
-
return MoveViewportBehavior.create(this.state,
|
|
2822
|
+
return MoveViewportBehavior.create(this.state, !isMiddleButton);
|
|
2785
2823
|
}
|
|
2786
2824
|
switch (commandOrNull.type) {
|
|
2787
2825
|
case exports.ClickCommandType.selectStep:
|
|
2788
|
-
return SelectStepBehavior.create(commandOrNull.component,
|
|
2826
|
+
return SelectStepBehavior.create(commandOrNull.component, isMiddleButton, this.designerContext);
|
|
2789
2827
|
case exports.ClickCommandType.rerenderStep:
|
|
2790
2828
|
return PressingBehavior.create(element, new RerenderStepPressingBehaviorHandler(this.designerContext));
|
|
2791
2829
|
case exports.ClickCommandType.openFolder:
|
|
@@ -3078,8 +3116,7 @@
|
|
|
3078
3116
|
const isMiddleButton = buttonIndex === 1;
|
|
3079
3117
|
if (isPrimaryButton || isMiddleButton) {
|
|
3080
3118
|
const commandOrNull = this.resolveClick(target, position);
|
|
3081
|
-
const
|
|
3082
|
-
const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, forceDisableDrag);
|
|
3119
|
+
const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, isMiddleButton);
|
|
3083
3120
|
this.behaviorController.start(position, behavior);
|
|
3084
3121
|
}
|
|
3085
3122
|
}
|
|
@@ -3638,30 +3675,19 @@
|
|
|
3638
3675
|
}
|
|
3639
3676
|
}
|
|
3640
3677
|
|
|
3641
|
-
const regexp = /^[a-zA-Z][a-zA-Z0-9_-]+$/;
|
|
3642
|
-
class StepTypeValidator {
|
|
3643
|
-
static validate(type) {
|
|
3644
|
-
if (!regexp.test(type)) {
|
|
3645
|
-
throw new Error(`Step type "${type}" contains not allowed characters`);
|
|
3646
|
-
}
|
|
3647
|
-
}
|
|
3648
|
-
}
|
|
3649
|
-
|
|
3650
3678
|
class ToolboxItemView {
|
|
3651
|
-
static create(parent,
|
|
3652
|
-
const label = api.getLabel(step);
|
|
3679
|
+
static create(parent, data) {
|
|
3653
3680
|
const root = Dom.element('div', {
|
|
3654
|
-
class: `sqd-toolbox-item sqd-type-${step.type}`,
|
|
3655
|
-
title:
|
|
3681
|
+
class: `sqd-toolbox-item sqd-type-${data.step.type}`,
|
|
3682
|
+
title: data.description
|
|
3656
3683
|
});
|
|
3657
|
-
const iconUrl = api.tryGetIconUrl(step);
|
|
3658
3684
|
const icon = Dom.element('div', {
|
|
3659
3685
|
class: 'sqd-toolbox-item-icon'
|
|
3660
3686
|
});
|
|
3661
|
-
if (iconUrl) {
|
|
3687
|
+
if (data.iconUrl) {
|
|
3662
3688
|
const iconImage = Dom.element('img', {
|
|
3663
3689
|
class: 'sqd-toolbox-item-icon-image',
|
|
3664
|
-
src: iconUrl
|
|
3690
|
+
src: data.iconUrl
|
|
3665
3691
|
});
|
|
3666
3692
|
icon.appendChild(iconImage);
|
|
3667
3693
|
}
|
|
@@ -3671,7 +3697,7 @@
|
|
|
3671
3697
|
const text = Dom.element('div', {
|
|
3672
3698
|
class: 'sqd-toolbox-item-text'
|
|
3673
3699
|
});
|
|
3674
|
-
text.textContent = label;
|
|
3700
|
+
text.textContent = data.label;
|
|
3675
3701
|
root.appendChild(icon);
|
|
3676
3702
|
root.appendChild(text);
|
|
3677
3703
|
parent.appendChild(root);
|
|
@@ -3692,10 +3718,9 @@
|
|
|
3692
3718
|
}
|
|
3693
3719
|
|
|
3694
3720
|
class ToolboxItem {
|
|
3695
|
-
static create(parent,
|
|
3696
|
-
|
|
3697
|
-
const
|
|
3698
|
-
const item = new ToolboxItem(step, api);
|
|
3721
|
+
static create(parent, data, api) {
|
|
3722
|
+
const view = ToolboxItemView.create(parent, data);
|
|
3723
|
+
const item = new ToolboxItem(data.step, api);
|
|
3699
3724
|
view.bindMousedown(e => item.onMousedown(e));
|
|
3700
3725
|
view.bindTouchstart(e => item.onTouchstart(e));
|
|
3701
3726
|
view.bindContextMenu(e => item.onContextMenu(e));
|
|
@@ -3795,7 +3820,7 @@
|
|
|
3795
3820
|
});
|
|
3796
3821
|
groupTitle.innerText = group.name;
|
|
3797
3822
|
list.appendChild(groupTitle);
|
|
3798
|
-
group.
|
|
3823
|
+
group.items.forEach(item => ToolboxItem.create(list, item, this.api));
|
|
3799
3824
|
});
|
|
3800
3825
|
this.scrollBoxView.setContent(list);
|
|
3801
3826
|
}
|
|
@@ -3806,8 +3831,9 @@
|
|
|
3806
3831
|
|
|
3807
3832
|
class Toolbox {
|
|
3808
3833
|
static create(root, api) {
|
|
3834
|
+
const allGroups = api.getAllGroups();
|
|
3809
3835
|
const view = ToolboxView.create(root, api);
|
|
3810
|
-
const toolbox = new Toolbox(view, api);
|
|
3836
|
+
const toolbox = new Toolbox(view, api, allGroups);
|
|
3811
3837
|
toolbox.render();
|
|
3812
3838
|
toolbox.onIsCollapsedChanged();
|
|
3813
3839
|
view.bindToggleClick(() => toolbox.onToggleClicked());
|
|
@@ -3815,15 +3841,16 @@
|
|
|
3815
3841
|
api.subscribeIsCollapsed(() => toolbox.onIsCollapsedChanged());
|
|
3816
3842
|
return toolbox;
|
|
3817
3843
|
}
|
|
3818
|
-
constructor(view, api) {
|
|
3844
|
+
constructor(view, api, allGroups) {
|
|
3819
3845
|
this.view = view;
|
|
3820
3846
|
this.api = api;
|
|
3847
|
+
this.allGroups = allGroups;
|
|
3821
3848
|
}
|
|
3822
3849
|
destroy() {
|
|
3823
3850
|
this.view.destroy();
|
|
3824
3851
|
}
|
|
3825
3852
|
render() {
|
|
3826
|
-
const groups = this.api.
|
|
3853
|
+
const groups = this.api.applyFilter(this.allGroups, this.filter);
|
|
3827
3854
|
this.view.setGroups(groups);
|
|
3828
3855
|
}
|
|
3829
3856
|
onIsCollapsedChanged() {
|
|
@@ -3833,7 +3860,7 @@
|
|
|
3833
3860
|
this.api.toggleIsCollapsed();
|
|
3834
3861
|
}
|
|
3835
3862
|
onFilterInputChanged(value) {
|
|
3836
|
-
this.filter = value
|
|
3863
|
+
this.filter = value;
|
|
3837
3864
|
this.render();
|
|
3838
3865
|
}
|
|
3839
3866
|
}
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -612,12 +612,11 @@ class DragStepBehavior {
|
|
|
612
612
|
}
|
|
613
613
|
|
|
614
614
|
class ToolboxApi {
|
|
615
|
-
constructor(state, designerContext, behaviorController,
|
|
615
|
+
constructor(state, designerContext, behaviorController, toolboxDataProvider, uidGenerator) {
|
|
616
616
|
this.state = state;
|
|
617
617
|
this.designerContext = designerContext;
|
|
618
618
|
this.behaviorController = behaviorController;
|
|
619
|
-
this.
|
|
620
|
-
this.configuration = configuration;
|
|
619
|
+
this.toolboxDataProvider = toolboxDataProvider;
|
|
621
620
|
this.uidGenerator = uidGenerator;
|
|
622
621
|
}
|
|
623
622
|
isCollapsed() {
|
|
@@ -629,24 +628,11 @@ class ToolboxApi {
|
|
|
629
628
|
subscribeIsCollapsed(listener) {
|
|
630
629
|
this.state.onIsToolboxCollapsedChanged.subscribe(listener);
|
|
631
630
|
}
|
|
632
|
-
|
|
633
|
-
return this.
|
|
634
|
-
}
|
|
635
|
-
getLabel(step) {
|
|
636
|
-
const labelProvider = this.getConfiguration().labelProvider;
|
|
637
|
-
return labelProvider ? labelProvider(step) : step.name;
|
|
631
|
+
getAllGroups() {
|
|
632
|
+
return this.toolboxDataProvider.getAllGroups();
|
|
638
633
|
}
|
|
639
|
-
|
|
640
|
-
return this.
|
|
641
|
-
.groups.map(group => {
|
|
642
|
-
return {
|
|
643
|
-
name: group.name,
|
|
644
|
-
steps: group.steps.filter(s => {
|
|
645
|
-
return filter ? s.name.toLowerCase().includes(filter) : true;
|
|
646
|
-
})
|
|
647
|
-
};
|
|
648
|
-
})
|
|
649
|
-
.filter(group => group.steps.length > 0);
|
|
634
|
+
applyFilter(allGroups, filter) {
|
|
635
|
+
return this.toolboxDataProvider.applyFilter(allGroups, filter);
|
|
650
636
|
}
|
|
651
637
|
/**
|
|
652
638
|
* @param position Mouse or touch position.
|
|
@@ -666,11 +652,62 @@ class ToolboxApi {
|
|
|
666
652
|
newStep.id = this.uidGenerator ? this.uidGenerator() : Uid.next();
|
|
667
653
|
return newStep;
|
|
668
654
|
}
|
|
669
|
-
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
const regexp = /^[a-zA-Z][a-zA-Z0-9_-]+$/;
|
|
658
|
+
class StepTypeValidator {
|
|
659
|
+
static validate(type) {
|
|
660
|
+
if (!regexp.test(type)) {
|
|
661
|
+
throw new Error(`Step type "${type}" contains not allowed characters`);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
class ToolboxDataProvider {
|
|
667
|
+
constructor(iconProvider, configuration) {
|
|
668
|
+
this.iconProvider = iconProvider;
|
|
669
|
+
this.configuration = configuration;
|
|
670
|
+
this.createItemData = (step) => {
|
|
671
|
+
StepTypeValidator.validate(step.type);
|
|
672
|
+
const iconUrl = this.iconProvider.getIconUrl(step);
|
|
673
|
+
const label = this.configuration && this.configuration.labelProvider ? this.configuration.labelProvider(step) : step.name;
|
|
674
|
+
const description = this.configuration && this.configuration.descriptionProvider ? this.configuration.descriptionProvider(step) : label;
|
|
675
|
+
const lowerCaseLabel = label.toLowerCase();
|
|
676
|
+
return {
|
|
677
|
+
iconUrl,
|
|
678
|
+
label,
|
|
679
|
+
description,
|
|
680
|
+
lowerCaseLabel,
|
|
681
|
+
step
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
getAllGroups() {
|
|
670
686
|
if (!this.configuration) {
|
|
671
|
-
|
|
687
|
+
return [];
|
|
672
688
|
}
|
|
673
|
-
return this.configuration
|
|
689
|
+
return this.configuration.groups.map(group => {
|
|
690
|
+
return {
|
|
691
|
+
name: group.name,
|
|
692
|
+
items: group.steps.map(this.createItemData)
|
|
693
|
+
};
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
applyFilter(allGroups, filter) {
|
|
697
|
+
if (!filter) {
|
|
698
|
+
return allGroups;
|
|
699
|
+
}
|
|
700
|
+
const lowerCaseFilter = filter.toLowerCase();
|
|
701
|
+
return allGroups
|
|
702
|
+
.map(group => {
|
|
703
|
+
return {
|
|
704
|
+
name: group.name,
|
|
705
|
+
items: group.items.filter(s => {
|
|
706
|
+
return s.lowerCaseLabel.includes(lowerCaseFilter);
|
|
707
|
+
})
|
|
708
|
+
};
|
|
709
|
+
})
|
|
710
|
+
.filter(group => group.items.length > 0);
|
|
674
711
|
}
|
|
675
712
|
}
|
|
676
713
|
|
|
@@ -729,7 +766,8 @@ class DesignerApi {
|
|
|
729
766
|
const workspace = new WorkspaceApi(context.state, context.workspaceController);
|
|
730
767
|
const viewportController = context.services.viewportController.create(workspace);
|
|
731
768
|
const viewport = new ViewportApi(context.workspaceController, viewportController);
|
|
732
|
-
|
|
769
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.configuration.toolbox);
|
|
770
|
+
return new DesignerApi(new ControlBarApi(context.state, context.historyController, context.definitionModifier, viewport), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.definitionModifier), workspace, viewport, new PathBarApi(context.state, context.definitionWalker));
|
|
733
771
|
}
|
|
734
772
|
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar) {
|
|
735
773
|
this.controlBar = controlBar;
|
|
@@ -2483,8 +2521,8 @@ class MoveViewportBehavior {
|
|
|
2483
2521
|
}
|
|
2484
2522
|
|
|
2485
2523
|
class SelectStepBehavior {
|
|
2486
|
-
static create(pressedStepComponent,
|
|
2487
|
-
const isDragDisabled =
|
|
2524
|
+
static create(pressedStepComponent, isMiddleButton, context) {
|
|
2525
|
+
const isDragDisabled = isMiddleButton ||
|
|
2488
2526
|
context.state.isDragDisabled ||
|
|
2489
2527
|
!context.definitionModifier.isDraggable(pressedStepComponent.step, pressedStepComponent.parentSequence);
|
|
2490
2528
|
return new SelectStepBehavior(pressedStepComponent, isDragDisabled, context, context.state);
|
|
@@ -2594,13 +2632,13 @@ class ClickBehaviorResolver {
|
|
|
2594
2632
|
this.designerContext = designerContext;
|
|
2595
2633
|
this.state = state;
|
|
2596
2634
|
}
|
|
2597
|
-
resolve(commandOrNull, element,
|
|
2635
|
+
resolve(commandOrNull, element, isMiddleButton) {
|
|
2598
2636
|
if (!commandOrNull) {
|
|
2599
|
-
return MoveViewportBehavior.create(this.state,
|
|
2637
|
+
return MoveViewportBehavior.create(this.state, !isMiddleButton);
|
|
2600
2638
|
}
|
|
2601
2639
|
switch (commandOrNull.type) {
|
|
2602
2640
|
case exports.ClickCommandType.selectStep:
|
|
2603
|
-
return SelectStepBehavior.create(commandOrNull.component,
|
|
2641
|
+
return SelectStepBehavior.create(commandOrNull.component, isMiddleButton, this.designerContext);
|
|
2604
2642
|
case exports.ClickCommandType.rerenderStep:
|
|
2605
2643
|
return PressingBehavior.create(element, new RerenderStepPressingBehaviorHandler(this.designerContext));
|
|
2606
2644
|
case exports.ClickCommandType.openFolder:
|
|
@@ -2893,8 +2931,7 @@ class Workspace {
|
|
|
2893
2931
|
const isMiddleButton = buttonIndex === 1;
|
|
2894
2932
|
if (isPrimaryButton || isMiddleButton) {
|
|
2895
2933
|
const commandOrNull = this.resolveClick(target, position);
|
|
2896
|
-
const
|
|
2897
|
-
const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, forceDisableDrag);
|
|
2934
|
+
const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, isMiddleButton);
|
|
2898
2935
|
this.behaviorController.start(position, behavior);
|
|
2899
2936
|
}
|
|
2900
2937
|
}
|
|
@@ -3453,30 +3490,19 @@ class ScrollBoxView {
|
|
|
3453
3490
|
}
|
|
3454
3491
|
}
|
|
3455
3492
|
|
|
3456
|
-
const regexp = /^[a-zA-Z][a-zA-Z0-9_-]+$/;
|
|
3457
|
-
class StepTypeValidator {
|
|
3458
|
-
static validate(type) {
|
|
3459
|
-
if (!regexp.test(type)) {
|
|
3460
|
-
throw new Error(`Step type "${type}" contains not allowed characters`);
|
|
3461
|
-
}
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
|
|
3465
3493
|
class ToolboxItemView {
|
|
3466
|
-
static create(parent,
|
|
3467
|
-
const label = api.getLabel(step);
|
|
3494
|
+
static create(parent, data) {
|
|
3468
3495
|
const root = Dom.element('div', {
|
|
3469
|
-
class: `sqd-toolbox-item sqd-type-${step.type}`,
|
|
3470
|
-
title:
|
|
3496
|
+
class: `sqd-toolbox-item sqd-type-${data.step.type}`,
|
|
3497
|
+
title: data.description
|
|
3471
3498
|
});
|
|
3472
|
-
const iconUrl = api.tryGetIconUrl(step);
|
|
3473
3499
|
const icon = Dom.element('div', {
|
|
3474
3500
|
class: 'sqd-toolbox-item-icon'
|
|
3475
3501
|
});
|
|
3476
|
-
if (iconUrl) {
|
|
3502
|
+
if (data.iconUrl) {
|
|
3477
3503
|
const iconImage = Dom.element('img', {
|
|
3478
3504
|
class: 'sqd-toolbox-item-icon-image',
|
|
3479
|
-
src: iconUrl
|
|
3505
|
+
src: data.iconUrl
|
|
3480
3506
|
});
|
|
3481
3507
|
icon.appendChild(iconImage);
|
|
3482
3508
|
}
|
|
@@ -3486,7 +3512,7 @@ class ToolboxItemView {
|
|
|
3486
3512
|
const text = Dom.element('div', {
|
|
3487
3513
|
class: 'sqd-toolbox-item-text'
|
|
3488
3514
|
});
|
|
3489
|
-
text.textContent = label;
|
|
3515
|
+
text.textContent = data.label;
|
|
3490
3516
|
root.appendChild(icon);
|
|
3491
3517
|
root.appendChild(text);
|
|
3492
3518
|
parent.appendChild(root);
|
|
@@ -3507,10 +3533,9 @@ class ToolboxItemView {
|
|
|
3507
3533
|
}
|
|
3508
3534
|
|
|
3509
3535
|
class ToolboxItem {
|
|
3510
|
-
static create(parent,
|
|
3511
|
-
|
|
3512
|
-
const
|
|
3513
|
-
const item = new ToolboxItem(step, api);
|
|
3536
|
+
static create(parent, data, api) {
|
|
3537
|
+
const view = ToolboxItemView.create(parent, data);
|
|
3538
|
+
const item = new ToolboxItem(data.step, api);
|
|
3514
3539
|
view.bindMousedown(e => item.onMousedown(e));
|
|
3515
3540
|
view.bindTouchstart(e => item.onTouchstart(e));
|
|
3516
3541
|
view.bindContextMenu(e => item.onContextMenu(e));
|
|
@@ -3610,7 +3635,7 @@ class ToolboxView {
|
|
|
3610
3635
|
});
|
|
3611
3636
|
groupTitle.innerText = group.name;
|
|
3612
3637
|
list.appendChild(groupTitle);
|
|
3613
|
-
group.
|
|
3638
|
+
group.items.forEach(item => ToolboxItem.create(list, item, this.api));
|
|
3614
3639
|
});
|
|
3615
3640
|
this.scrollBoxView.setContent(list);
|
|
3616
3641
|
}
|
|
@@ -3621,8 +3646,9 @@ class ToolboxView {
|
|
|
3621
3646
|
|
|
3622
3647
|
class Toolbox {
|
|
3623
3648
|
static create(root, api) {
|
|
3649
|
+
const allGroups = api.getAllGroups();
|
|
3624
3650
|
const view = ToolboxView.create(root, api);
|
|
3625
|
-
const toolbox = new Toolbox(view, api);
|
|
3651
|
+
const toolbox = new Toolbox(view, api, allGroups);
|
|
3626
3652
|
toolbox.render();
|
|
3627
3653
|
toolbox.onIsCollapsedChanged();
|
|
3628
3654
|
view.bindToggleClick(() => toolbox.onToggleClicked());
|
|
@@ -3630,15 +3656,16 @@ class Toolbox {
|
|
|
3630
3656
|
api.subscribeIsCollapsed(() => toolbox.onIsCollapsedChanged());
|
|
3631
3657
|
return toolbox;
|
|
3632
3658
|
}
|
|
3633
|
-
constructor(view, api) {
|
|
3659
|
+
constructor(view, api, allGroups) {
|
|
3634
3660
|
this.view = view;
|
|
3635
3661
|
this.api = api;
|
|
3662
|
+
this.allGroups = allGroups;
|
|
3636
3663
|
}
|
|
3637
3664
|
destroy() {
|
|
3638
3665
|
this.view.destroy();
|
|
3639
3666
|
}
|
|
3640
3667
|
render() {
|
|
3641
|
-
const groups = this.api.
|
|
3668
|
+
const groups = this.api.applyFilter(this.allGroups, this.filter);
|
|
3642
3669
|
this.view.setGroups(groups);
|
|
3643
3670
|
}
|
|
3644
3671
|
onIsCollapsedChanged() {
|
|
@@ -3648,7 +3675,7 @@ class Toolbox {
|
|
|
3648
3675
|
this.api.toggleIsCollapsed();
|
|
3649
3676
|
}
|
|
3650
3677
|
onFilterInputChanged(value) {
|
|
3651
|
-
this.filter = value
|
|
3678
|
+
this.filter = value;
|
|
3652
3679
|
this.render();
|
|
3653
3680
|
}
|
|
3654
3681
|
}
|
package/lib/esm/index.js
CHANGED
|
@@ -611,12 +611,11 @@ class DragStepBehavior {
|
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
class ToolboxApi {
|
|
614
|
-
constructor(state, designerContext, behaviorController,
|
|
614
|
+
constructor(state, designerContext, behaviorController, toolboxDataProvider, uidGenerator) {
|
|
615
615
|
this.state = state;
|
|
616
616
|
this.designerContext = designerContext;
|
|
617
617
|
this.behaviorController = behaviorController;
|
|
618
|
-
this.
|
|
619
|
-
this.configuration = configuration;
|
|
618
|
+
this.toolboxDataProvider = toolboxDataProvider;
|
|
620
619
|
this.uidGenerator = uidGenerator;
|
|
621
620
|
}
|
|
622
621
|
isCollapsed() {
|
|
@@ -628,24 +627,11 @@ class ToolboxApi {
|
|
|
628
627
|
subscribeIsCollapsed(listener) {
|
|
629
628
|
this.state.onIsToolboxCollapsedChanged.subscribe(listener);
|
|
630
629
|
}
|
|
631
|
-
|
|
632
|
-
return this.
|
|
633
|
-
}
|
|
634
|
-
getLabel(step) {
|
|
635
|
-
const labelProvider = this.getConfiguration().labelProvider;
|
|
636
|
-
return labelProvider ? labelProvider(step) : step.name;
|
|
630
|
+
getAllGroups() {
|
|
631
|
+
return this.toolboxDataProvider.getAllGroups();
|
|
637
632
|
}
|
|
638
|
-
|
|
639
|
-
return this.
|
|
640
|
-
.groups.map(group => {
|
|
641
|
-
return {
|
|
642
|
-
name: group.name,
|
|
643
|
-
steps: group.steps.filter(s => {
|
|
644
|
-
return filter ? s.name.toLowerCase().includes(filter) : true;
|
|
645
|
-
})
|
|
646
|
-
};
|
|
647
|
-
})
|
|
648
|
-
.filter(group => group.steps.length > 0);
|
|
633
|
+
applyFilter(allGroups, filter) {
|
|
634
|
+
return this.toolboxDataProvider.applyFilter(allGroups, filter);
|
|
649
635
|
}
|
|
650
636
|
/**
|
|
651
637
|
* @param position Mouse or touch position.
|
|
@@ -665,11 +651,62 @@ class ToolboxApi {
|
|
|
665
651
|
newStep.id = this.uidGenerator ? this.uidGenerator() : Uid.next();
|
|
666
652
|
return newStep;
|
|
667
653
|
}
|
|
668
|
-
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const regexp = /^[a-zA-Z][a-zA-Z0-9_-]+$/;
|
|
657
|
+
class StepTypeValidator {
|
|
658
|
+
static validate(type) {
|
|
659
|
+
if (!regexp.test(type)) {
|
|
660
|
+
throw new Error(`Step type "${type}" contains not allowed characters`);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
class ToolboxDataProvider {
|
|
666
|
+
constructor(iconProvider, configuration) {
|
|
667
|
+
this.iconProvider = iconProvider;
|
|
668
|
+
this.configuration = configuration;
|
|
669
|
+
this.createItemData = (step) => {
|
|
670
|
+
StepTypeValidator.validate(step.type);
|
|
671
|
+
const iconUrl = this.iconProvider.getIconUrl(step);
|
|
672
|
+
const label = this.configuration && this.configuration.labelProvider ? this.configuration.labelProvider(step) : step.name;
|
|
673
|
+
const description = this.configuration && this.configuration.descriptionProvider ? this.configuration.descriptionProvider(step) : label;
|
|
674
|
+
const lowerCaseLabel = label.toLowerCase();
|
|
675
|
+
return {
|
|
676
|
+
iconUrl,
|
|
677
|
+
label,
|
|
678
|
+
description,
|
|
679
|
+
lowerCaseLabel,
|
|
680
|
+
step
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
getAllGroups() {
|
|
669
685
|
if (!this.configuration) {
|
|
670
|
-
|
|
686
|
+
return [];
|
|
671
687
|
}
|
|
672
|
-
return this.configuration
|
|
688
|
+
return this.configuration.groups.map(group => {
|
|
689
|
+
return {
|
|
690
|
+
name: group.name,
|
|
691
|
+
items: group.steps.map(this.createItemData)
|
|
692
|
+
};
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
applyFilter(allGroups, filter) {
|
|
696
|
+
if (!filter) {
|
|
697
|
+
return allGroups;
|
|
698
|
+
}
|
|
699
|
+
const lowerCaseFilter = filter.toLowerCase();
|
|
700
|
+
return allGroups
|
|
701
|
+
.map(group => {
|
|
702
|
+
return {
|
|
703
|
+
name: group.name,
|
|
704
|
+
items: group.items.filter(s => {
|
|
705
|
+
return s.lowerCaseLabel.includes(lowerCaseFilter);
|
|
706
|
+
})
|
|
707
|
+
};
|
|
708
|
+
})
|
|
709
|
+
.filter(group => group.items.length > 0);
|
|
673
710
|
}
|
|
674
711
|
}
|
|
675
712
|
|
|
@@ -728,7 +765,8 @@ class DesignerApi {
|
|
|
728
765
|
const workspace = new WorkspaceApi(context.state, context.workspaceController);
|
|
729
766
|
const viewportController = context.services.viewportController.create(workspace);
|
|
730
767
|
const viewport = new ViewportApi(context.workspaceController, viewportController);
|
|
731
|
-
|
|
768
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.configuration.toolbox);
|
|
769
|
+
return new DesignerApi(new ControlBarApi(context.state, context.historyController, context.definitionModifier, viewport), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.definitionModifier), workspace, viewport, new PathBarApi(context.state, context.definitionWalker));
|
|
732
770
|
}
|
|
733
771
|
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar) {
|
|
734
772
|
this.controlBar = controlBar;
|
|
@@ -2482,8 +2520,8 @@ class MoveViewportBehavior {
|
|
|
2482
2520
|
}
|
|
2483
2521
|
|
|
2484
2522
|
class SelectStepBehavior {
|
|
2485
|
-
static create(pressedStepComponent,
|
|
2486
|
-
const isDragDisabled =
|
|
2523
|
+
static create(pressedStepComponent, isMiddleButton, context) {
|
|
2524
|
+
const isDragDisabled = isMiddleButton ||
|
|
2487
2525
|
context.state.isDragDisabled ||
|
|
2488
2526
|
!context.definitionModifier.isDraggable(pressedStepComponent.step, pressedStepComponent.parentSequence);
|
|
2489
2527
|
return new SelectStepBehavior(pressedStepComponent, isDragDisabled, context, context.state);
|
|
@@ -2593,13 +2631,13 @@ class ClickBehaviorResolver {
|
|
|
2593
2631
|
this.designerContext = designerContext;
|
|
2594
2632
|
this.state = state;
|
|
2595
2633
|
}
|
|
2596
|
-
resolve(commandOrNull, element,
|
|
2634
|
+
resolve(commandOrNull, element, isMiddleButton) {
|
|
2597
2635
|
if (!commandOrNull) {
|
|
2598
|
-
return MoveViewportBehavior.create(this.state,
|
|
2636
|
+
return MoveViewportBehavior.create(this.state, !isMiddleButton);
|
|
2599
2637
|
}
|
|
2600
2638
|
switch (commandOrNull.type) {
|
|
2601
2639
|
case ClickCommandType.selectStep:
|
|
2602
|
-
return SelectStepBehavior.create(commandOrNull.component,
|
|
2640
|
+
return SelectStepBehavior.create(commandOrNull.component, isMiddleButton, this.designerContext);
|
|
2603
2641
|
case ClickCommandType.rerenderStep:
|
|
2604
2642
|
return PressingBehavior.create(element, new RerenderStepPressingBehaviorHandler(this.designerContext));
|
|
2605
2643
|
case ClickCommandType.openFolder:
|
|
@@ -2892,8 +2930,7 @@ class Workspace {
|
|
|
2892
2930
|
const isMiddleButton = buttonIndex === 1;
|
|
2893
2931
|
if (isPrimaryButton || isMiddleButton) {
|
|
2894
2932
|
const commandOrNull = this.resolveClick(target, position);
|
|
2895
|
-
const
|
|
2896
|
-
const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, forceDisableDrag);
|
|
2933
|
+
const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, isMiddleButton);
|
|
2897
2934
|
this.behaviorController.start(position, behavior);
|
|
2898
2935
|
}
|
|
2899
2936
|
}
|
|
@@ -3452,30 +3489,19 @@ class ScrollBoxView {
|
|
|
3452
3489
|
}
|
|
3453
3490
|
}
|
|
3454
3491
|
|
|
3455
|
-
const regexp = /^[a-zA-Z][a-zA-Z0-9_-]+$/;
|
|
3456
|
-
class StepTypeValidator {
|
|
3457
|
-
static validate(type) {
|
|
3458
|
-
if (!regexp.test(type)) {
|
|
3459
|
-
throw new Error(`Step type "${type}" contains not allowed characters`);
|
|
3460
|
-
}
|
|
3461
|
-
}
|
|
3462
|
-
}
|
|
3463
|
-
|
|
3464
3492
|
class ToolboxItemView {
|
|
3465
|
-
static create(parent,
|
|
3466
|
-
const label = api.getLabel(step);
|
|
3493
|
+
static create(parent, data) {
|
|
3467
3494
|
const root = Dom.element('div', {
|
|
3468
|
-
class: `sqd-toolbox-item sqd-type-${step.type}`,
|
|
3469
|
-
title:
|
|
3495
|
+
class: `sqd-toolbox-item sqd-type-${data.step.type}`,
|
|
3496
|
+
title: data.description
|
|
3470
3497
|
});
|
|
3471
|
-
const iconUrl = api.tryGetIconUrl(step);
|
|
3472
3498
|
const icon = Dom.element('div', {
|
|
3473
3499
|
class: 'sqd-toolbox-item-icon'
|
|
3474
3500
|
});
|
|
3475
|
-
if (iconUrl) {
|
|
3501
|
+
if (data.iconUrl) {
|
|
3476
3502
|
const iconImage = Dom.element('img', {
|
|
3477
3503
|
class: 'sqd-toolbox-item-icon-image',
|
|
3478
|
-
src: iconUrl
|
|
3504
|
+
src: data.iconUrl
|
|
3479
3505
|
});
|
|
3480
3506
|
icon.appendChild(iconImage);
|
|
3481
3507
|
}
|
|
@@ -3485,7 +3511,7 @@ class ToolboxItemView {
|
|
|
3485
3511
|
const text = Dom.element('div', {
|
|
3486
3512
|
class: 'sqd-toolbox-item-text'
|
|
3487
3513
|
});
|
|
3488
|
-
text.textContent = label;
|
|
3514
|
+
text.textContent = data.label;
|
|
3489
3515
|
root.appendChild(icon);
|
|
3490
3516
|
root.appendChild(text);
|
|
3491
3517
|
parent.appendChild(root);
|
|
@@ -3506,10 +3532,9 @@ class ToolboxItemView {
|
|
|
3506
3532
|
}
|
|
3507
3533
|
|
|
3508
3534
|
class ToolboxItem {
|
|
3509
|
-
static create(parent,
|
|
3510
|
-
|
|
3511
|
-
const
|
|
3512
|
-
const item = new ToolboxItem(step, api);
|
|
3535
|
+
static create(parent, data, api) {
|
|
3536
|
+
const view = ToolboxItemView.create(parent, data);
|
|
3537
|
+
const item = new ToolboxItem(data.step, api);
|
|
3513
3538
|
view.bindMousedown(e => item.onMousedown(e));
|
|
3514
3539
|
view.bindTouchstart(e => item.onTouchstart(e));
|
|
3515
3540
|
view.bindContextMenu(e => item.onContextMenu(e));
|
|
@@ -3609,7 +3634,7 @@ class ToolboxView {
|
|
|
3609
3634
|
});
|
|
3610
3635
|
groupTitle.innerText = group.name;
|
|
3611
3636
|
list.appendChild(groupTitle);
|
|
3612
|
-
group.
|
|
3637
|
+
group.items.forEach(item => ToolboxItem.create(list, item, this.api));
|
|
3613
3638
|
});
|
|
3614
3639
|
this.scrollBoxView.setContent(list);
|
|
3615
3640
|
}
|
|
@@ -3620,8 +3645,9 @@ class ToolboxView {
|
|
|
3620
3645
|
|
|
3621
3646
|
class Toolbox {
|
|
3622
3647
|
static create(root, api) {
|
|
3648
|
+
const allGroups = api.getAllGroups();
|
|
3623
3649
|
const view = ToolboxView.create(root, api);
|
|
3624
|
-
const toolbox = new Toolbox(view, api);
|
|
3650
|
+
const toolbox = new Toolbox(view, api, allGroups);
|
|
3625
3651
|
toolbox.render();
|
|
3626
3652
|
toolbox.onIsCollapsedChanged();
|
|
3627
3653
|
view.bindToggleClick(() => toolbox.onToggleClicked());
|
|
@@ -3629,15 +3655,16 @@ class Toolbox {
|
|
|
3629
3655
|
api.subscribeIsCollapsed(() => toolbox.onIsCollapsedChanged());
|
|
3630
3656
|
return toolbox;
|
|
3631
3657
|
}
|
|
3632
|
-
constructor(view, api) {
|
|
3658
|
+
constructor(view, api, allGroups) {
|
|
3633
3659
|
this.view = view;
|
|
3634
3660
|
this.api = api;
|
|
3661
|
+
this.allGroups = allGroups;
|
|
3635
3662
|
}
|
|
3636
3663
|
destroy() {
|
|
3637
3664
|
this.view.destroy();
|
|
3638
3665
|
}
|
|
3639
3666
|
render() {
|
|
3640
|
-
const groups = this.api.
|
|
3667
|
+
const groups = this.api.applyFilter(this.allGroups, this.filter);
|
|
3641
3668
|
this.view.setGroups(groups);
|
|
3642
3669
|
}
|
|
3643
3670
|
onIsCollapsedChanged() {
|
|
@@ -3647,7 +3674,7 @@ class Toolbox {
|
|
|
3647
3674
|
this.api.toggleIsCollapsed();
|
|
3648
3675
|
}
|
|
3649
3676
|
onFilterInputChanged(value) {
|
|
3650
|
-
this.filter = value
|
|
3677
|
+
this.filter = value;
|
|
3651
3678
|
this.render();
|
|
3652
3679
|
}
|
|
3653
3680
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -408,20 +408,38 @@ declare class PathBarApi {
|
|
|
408
408
|
getFolderPathStepNames(): string[];
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
+
declare class ToolboxDataProvider {
|
|
412
|
+
private readonly iconProvider;
|
|
413
|
+
private readonly configuration;
|
|
414
|
+
constructor(iconProvider: IconProvider, configuration: ToolboxConfiguration | false);
|
|
415
|
+
getAllGroups(): ToolboxGroupData[];
|
|
416
|
+
private readonly createItemData;
|
|
417
|
+
applyFilter(allGroups: ToolboxGroupData[], filter: string | undefined): ToolboxGroupData[];
|
|
418
|
+
}
|
|
419
|
+
interface ToolboxGroupData {
|
|
420
|
+
name: string;
|
|
421
|
+
items: ToolboxItemData[];
|
|
422
|
+
}
|
|
423
|
+
interface ToolboxItemData {
|
|
424
|
+
iconUrl: string | null;
|
|
425
|
+
label: string;
|
|
426
|
+
lowerCaseLabel: string;
|
|
427
|
+
description: string;
|
|
428
|
+
step: StepDefinition;
|
|
429
|
+
}
|
|
430
|
+
|
|
411
431
|
declare class ToolboxApi {
|
|
412
432
|
private readonly state;
|
|
413
433
|
private readonly designerContext;
|
|
414
434
|
private readonly behaviorController;
|
|
415
|
-
private readonly
|
|
416
|
-
private readonly configuration;
|
|
435
|
+
private readonly toolboxDataProvider;
|
|
417
436
|
private readonly uidGenerator;
|
|
418
|
-
constructor(state: DesignerState, designerContext: DesignerContext, behaviorController: BehaviorController,
|
|
437
|
+
constructor(state: DesignerState, designerContext: DesignerContext, behaviorController: BehaviorController, toolboxDataProvider: ToolboxDataProvider, uidGenerator: UidGenerator | undefined);
|
|
419
438
|
isCollapsed(): boolean;
|
|
420
439
|
toggleIsCollapsed(): void;
|
|
421
440
|
subscribeIsCollapsed(listener: SimpleEventListener<boolean>): void;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
filterGroups(filter: string | undefined): ToolboxGroupConfiguration[];
|
|
441
|
+
getAllGroups(): ToolboxGroupData[];
|
|
442
|
+
applyFilter(allGroups: ToolboxGroupData[], filter: string | undefined): ToolboxGroupData[];
|
|
425
443
|
/**
|
|
426
444
|
* @param position Mouse or touch position.
|
|
427
445
|
* @param step Step definition.
|
|
@@ -429,7 +447,6 @@ declare class ToolboxApi {
|
|
|
429
447
|
*/
|
|
430
448
|
tryDrag(position: Vector, step: StepDefinition): boolean;
|
|
431
449
|
private activateStep;
|
|
432
|
-
private getConfiguration;
|
|
433
450
|
}
|
|
434
451
|
|
|
435
452
|
declare class ViewportApi {
|
|
@@ -890,11 +907,13 @@ interface CustomActionHandlerContext {
|
|
|
890
907
|
}
|
|
891
908
|
interface ToolboxConfiguration {
|
|
892
909
|
labelProvider?: StepLabelProvider;
|
|
910
|
+
descriptionProvider?: StepDescriptionProvider;
|
|
893
911
|
isCollapsed?: boolean;
|
|
894
912
|
groups: ToolboxGroupConfiguration[];
|
|
895
913
|
}
|
|
896
914
|
type StepDefinition = Omit<Step, 'id'>;
|
|
897
915
|
type StepLabelProvider = (step: StepDefinition) => string;
|
|
916
|
+
type StepDescriptionProvider = (step: StepDefinition) => string;
|
|
898
917
|
interface ToolboxGroupConfiguration {
|
|
899
918
|
name: string;
|
|
900
919
|
steps: StepDefinition[];
|
|
@@ -1126,4 +1145,4 @@ declare class StepsExtension extends StepsDesignerExtension {
|
|
|
1126
1145
|
interface StepsExtensionConfiguration extends StepsDesignerExtensionConfiguration {
|
|
1127
1146
|
}
|
|
1128
1147
|
|
|
1129
|
-
export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentView, ContainerStep, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ControlBarApi, CustomAction, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, GlobalEditorContext, GlobalEditorProvider, Grid, GridExtension, Icons, InputView, JoinView, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootValidator, SelectStepClickCommand, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, StepsExtension, StepsExtensionConfiguration, SwitchStep, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStep, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
|
|
1148
|
+
export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentView, ContainerStep, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ControlBarApi, CustomAction, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, GlobalEditorContext, GlobalEditorProvider, Grid, GridExtension, Icons, InputView, JoinView, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootValidator, SelectStepClickCommand, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, StepsExtension, StepsExtensionConfiguration, SwitchStep, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStep, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sequential-workflow-designer",
|
|
3
3
|
"description": "Customizable no-code component for building flow-based programming applications.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.16.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
package/sass/designer-theme.scss
CHANGED
|
@@ -353,6 +353,9 @@
|
|
|
353
353
|
$stepType: '',
|
|
354
354
|
$labelTextColor: #fff,
|
|
355
355
|
$labelFillColor: #2411db,
|
|
356
|
+
$labelStrokeColor: #2411db,
|
|
357
|
+
$labelStrokeWidth: 0,
|
|
358
|
+
$labelShadow: '',
|
|
356
359
|
$inputStrokeWidth: 2,
|
|
357
360
|
$inputStrokeColor: #000,
|
|
358
361
|
$inputFillColor: #fff
|
|
@@ -363,6 +366,13 @@
|
|
|
363
366
|
}
|
|
364
367
|
& > .sqd-label > .sqd-label-rect {
|
|
365
368
|
fill: $labelFillColor;
|
|
369
|
+
stroke-width: $labelStrokeWidth;
|
|
370
|
+
@if $labelStrokeWidth > 0 {
|
|
371
|
+
stroke: $labelStrokeColor;
|
|
372
|
+
}
|
|
373
|
+
@if $labelShadow != '' {
|
|
374
|
+
filter: drop-shadow($labelShadow);
|
|
375
|
+
}
|
|
366
376
|
}
|
|
367
377
|
& > g > {
|
|
368
378
|
@include _sqd-input(
|