sequential-workflow-designer 0.25.0 → 0.26.0
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 +5 -4
- package/dist/index.umd.js +662 -614
- package/lib/cjs/index.cjs +662 -614
- package/lib/esm/index.js +659 -615
- package/lib/index.d.ts +83 -55
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -199,27 +199,17 @@ function race(timeout, a, b, c, d) {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
class ControlBarApi {
|
|
202
|
-
static create(state, historyController, stateModifier
|
|
203
|
-
const api = new ControlBarApi(state, historyController, stateModifier
|
|
202
|
+
static create(state, historyController, stateModifier) {
|
|
203
|
+
const api = new ControlBarApi(state, historyController, stateModifier);
|
|
204
204
|
race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.forward);
|
|
205
205
|
return api;
|
|
206
206
|
}
|
|
207
|
-
constructor(state, historyController, stateModifier
|
|
207
|
+
constructor(state, historyController, stateModifier) {
|
|
208
208
|
this.state = state;
|
|
209
209
|
this.historyController = historyController;
|
|
210
210
|
this.stateModifier = stateModifier;
|
|
211
|
-
this.viewportApi = viewportApi;
|
|
212
211
|
this.onStateChanged = new SimpleEvent();
|
|
213
212
|
}
|
|
214
|
-
resetViewport() {
|
|
215
|
-
this.viewportApi.resetViewport();
|
|
216
|
-
}
|
|
217
|
-
zoomIn() {
|
|
218
|
-
this.viewportApi.zoom(true);
|
|
219
|
-
}
|
|
220
|
-
zoomOut() {
|
|
221
|
-
this.viewportApi.zoom(false);
|
|
222
|
-
}
|
|
223
213
|
isDragDisabled() {
|
|
224
214
|
return this.state.isDragDisabled;
|
|
225
215
|
}
|
|
@@ -690,21 +680,20 @@ function animate(interval, handler) {
|
|
|
690
680
|
}
|
|
691
681
|
|
|
692
682
|
class ViewportAnimator {
|
|
693
|
-
constructor(
|
|
694
|
-
this.
|
|
683
|
+
constructor(state) {
|
|
684
|
+
this.state = state;
|
|
695
685
|
}
|
|
696
686
|
execute(target) {
|
|
697
687
|
if (this.animation && this.animation.isAlive) {
|
|
698
688
|
this.animation.stop();
|
|
699
689
|
}
|
|
700
|
-
const
|
|
701
|
-
const
|
|
702
|
-
const startScale = viewport.scale;
|
|
690
|
+
const startPosition = this.state.viewport.position;
|
|
691
|
+
const startScale = this.state.viewport.scale;
|
|
703
692
|
const deltaPosition = startPosition.subtract(target.position);
|
|
704
693
|
const deltaScale = startScale - target.scale;
|
|
705
694
|
this.animation = animate(150, progress => {
|
|
706
695
|
const newScale = startScale - deltaScale * progress;
|
|
707
|
-
this.
|
|
696
|
+
this.state.setViewport({
|
|
708
697
|
position: startPosition.subtract(deltaPosition.multiplyByScalar(progress)),
|
|
709
698
|
scale: newScale
|
|
710
699
|
});
|
|
@@ -737,23 +726,23 @@ class ZoomByWheelCalculator {
|
|
|
737
726
|
}
|
|
738
727
|
|
|
739
728
|
class ViewportApi {
|
|
740
|
-
constructor(workspaceController, viewportController
|
|
729
|
+
constructor(state, workspaceController, viewportController) {
|
|
730
|
+
this.state = state;
|
|
741
731
|
this.workspaceController = workspaceController;
|
|
742
732
|
this.viewportController = viewportController;
|
|
743
|
-
this.
|
|
744
|
-
this.animator = new ViewportAnimator(this.api);
|
|
733
|
+
this.animator = new ViewportAnimator(this.state);
|
|
745
734
|
}
|
|
746
735
|
limitScale(scale) {
|
|
747
736
|
return this.viewportController.limitScale(scale);
|
|
748
737
|
}
|
|
749
738
|
resetViewport() {
|
|
750
739
|
const defaultViewport = this.viewportController.getDefault();
|
|
751
|
-
this.
|
|
740
|
+
this.state.setViewport(defaultViewport);
|
|
752
741
|
}
|
|
753
742
|
zoom(direction) {
|
|
754
743
|
const viewport = this.viewportController.getZoomed(direction);
|
|
755
744
|
if (viewport) {
|
|
756
|
-
this.
|
|
745
|
+
this.state.setViewport(viewport);
|
|
757
746
|
}
|
|
758
747
|
}
|
|
759
748
|
moveViewportToStep(stepId) {
|
|
@@ -766,11 +755,10 @@ class ViewportApi {
|
|
|
766
755
|
this.animator.execute(viewport);
|
|
767
756
|
}
|
|
768
757
|
handleWheelEvent(e) {
|
|
769
|
-
const
|
|
770
|
-
const
|
|
771
|
-
const newViewport = ZoomByWheelCalculator.calculate(this.viewportController, viewport, canvasPosition, e);
|
|
758
|
+
const canvasPosition = this.workspaceController.getCanvasPosition();
|
|
759
|
+
const newViewport = ZoomByWheelCalculator.calculate(this.viewportController, this.state.viewport, canvasPosition, e);
|
|
772
760
|
if (newViewport) {
|
|
773
|
-
this.
|
|
761
|
+
this.state.setViewport(newViewport);
|
|
774
762
|
}
|
|
775
763
|
}
|
|
776
764
|
}
|
|
@@ -780,6 +768,12 @@ class WorkspaceApi {
|
|
|
780
768
|
this.state = state;
|
|
781
769
|
this.workspaceController = workspaceController;
|
|
782
770
|
}
|
|
771
|
+
getViewport() {
|
|
772
|
+
return this.state.viewport;
|
|
773
|
+
}
|
|
774
|
+
setViewport(viewport) {
|
|
775
|
+
this.state.setViewport(viewport);
|
|
776
|
+
}
|
|
783
777
|
getCanvasPosition() {
|
|
784
778
|
return this.workspaceController.getCanvasPosition();
|
|
785
779
|
}
|
|
@@ -789,12 +783,6 @@ class WorkspaceApi {
|
|
|
789
783
|
getRootComponentSize() {
|
|
790
784
|
return this.workspaceController.getRootComponentSize();
|
|
791
785
|
}
|
|
792
|
-
getViewport() {
|
|
793
|
-
return this.state.viewport;
|
|
794
|
-
}
|
|
795
|
-
setViewport(viewport) {
|
|
796
|
-
this.state.setViewport(viewport);
|
|
797
|
-
}
|
|
798
786
|
updateRootComponent() {
|
|
799
787
|
this.workspaceController.updateRootComponent();
|
|
800
788
|
}
|
|
@@ -810,9 +798,8 @@ class DesignerApi {
|
|
|
810
798
|
static create(context) {
|
|
811
799
|
const workspace = new WorkspaceApi(context.state, context.workspaceController);
|
|
812
800
|
const viewportController = context.services.viewportController.create(workspace);
|
|
813
|
-
const viewport = new ViewportApi(context.workspaceController, viewportController, workspace);
|
|
814
801
|
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);
|
|
815
|
-
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier
|
|
802
|
+
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.stateModifier), workspace, new ViewportApi(context.state, context.workspaceController, viewportController), new PathBarApi(context.state, context.definitionWalker), context.definitionWalker, context.i18n);
|
|
816
803
|
}
|
|
817
804
|
constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
818
805
|
this.shadowRoot = shadowRoot;
|
|
@@ -827,36 +814,15 @@ class DesignerApi {
|
|
|
827
814
|
}
|
|
828
815
|
}
|
|
829
816
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
}
|
|
835
|
-
validateStep(step, parentSequence) {
|
|
836
|
-
var _a;
|
|
837
|
-
if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.step) {
|
|
838
|
-
return this.configuration.step(step, parentSequence, this.state.definition);
|
|
839
|
-
}
|
|
840
|
-
return true;
|
|
841
|
-
}
|
|
842
|
-
validateRoot() {
|
|
843
|
-
var _a;
|
|
844
|
-
if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.root) {
|
|
845
|
-
return this.configuration.root(this.state.definition);
|
|
846
|
-
}
|
|
847
|
-
return true;
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
class IconProvider {
|
|
852
|
-
constructor(configuration) {
|
|
853
|
-
this.configuration = configuration;
|
|
817
|
+
const TYPE = 'selectStep';
|
|
818
|
+
class SelectStepBehaviorEndToken {
|
|
819
|
+
static is(token) {
|
|
820
|
+
return Boolean(token) && token.type === TYPE;
|
|
854
821
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
return null;
|
|
822
|
+
constructor(stepId, time) {
|
|
823
|
+
this.stepId = stepId;
|
|
824
|
+
this.time = time;
|
|
825
|
+
this.type = TYPE;
|
|
860
826
|
}
|
|
861
827
|
}
|
|
862
828
|
|
|
@@ -921,349 +887,104 @@ function createG(parentElement) {
|
|
|
921
887
|
return g;
|
|
922
888
|
}
|
|
923
889
|
|
|
924
|
-
|
|
925
|
-
(
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
(
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
const badges = Badges.createForStep(stepContext, view, componentContext);
|
|
941
|
-
return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);
|
|
890
|
+
class ValidationErrorBadgeView {
|
|
891
|
+
static create(parent, cfg) {
|
|
892
|
+
const g = Dom.svg('g');
|
|
893
|
+
const halfOfSize = cfg.size / 2;
|
|
894
|
+
const circle = Dom.svg('path', {
|
|
895
|
+
class: 'sqd-validation-error',
|
|
896
|
+
d: `M 0 ${-halfOfSize} l ${halfOfSize} ${cfg.size} l ${-cfg.size} 0 Z`
|
|
897
|
+
});
|
|
898
|
+
Dom.translate(circle, halfOfSize, halfOfSize);
|
|
899
|
+
g.appendChild(circle);
|
|
900
|
+
const icon = Icons.appendPath(g, 'sqd-validation-error-icon-path', Icons.alert, cfg.iconSize);
|
|
901
|
+
const offsetX = (cfg.size - cfg.iconSize) / 2;
|
|
902
|
+
const offsetY = offsetX * 1.5;
|
|
903
|
+
Dom.translate(icon, offsetX, offsetY);
|
|
904
|
+
parent.appendChild(g);
|
|
905
|
+
return new ValidationErrorBadgeView(parent, g, cfg.size, cfg.size);
|
|
942
906
|
}
|
|
943
|
-
constructor(
|
|
944
|
-
this.
|
|
945
|
-
this.
|
|
946
|
-
this.
|
|
947
|
-
this.
|
|
948
|
-
this.badges = badges;
|
|
907
|
+
constructor(parent, g, width, height) {
|
|
908
|
+
this.parent = parent;
|
|
909
|
+
this.g = g;
|
|
910
|
+
this.width = width;
|
|
911
|
+
this.height = height;
|
|
949
912
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
return this;
|
|
953
|
-
}
|
|
954
|
-
if (this.view.sequenceComponents) {
|
|
955
|
-
for (const component of this.view.sequenceComponents) {
|
|
956
|
-
const result = component.findById(stepId);
|
|
957
|
-
if (result) {
|
|
958
|
-
return result;
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
return null;
|
|
913
|
+
destroy() {
|
|
914
|
+
this.parent.removeChild(this.g);
|
|
963
915
|
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
class ValidatorFactory {
|
|
919
|
+
static createForStep(stepContext, view, componentContext) {
|
|
920
|
+
return () => {
|
|
921
|
+
if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {
|
|
922
|
+
return false;
|
|
971
923
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
component: this
|
|
924
|
+
if (view.haveCollapsedChildren) {
|
|
925
|
+
let allChildrenValid = true;
|
|
926
|
+
componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {
|
|
927
|
+
if (!componentContext.validator.validateStep(step, parentSequence)) {
|
|
928
|
+
allChildrenValid = false;
|
|
929
|
+
return false;
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
if (!allChildrenValid) {
|
|
933
|
+
return false;
|
|
983
934
|
}
|
|
984
|
-
: viewResult;
|
|
985
|
-
}
|
|
986
|
-
return null;
|
|
987
|
-
}
|
|
988
|
-
resolvePlaceholders(skipComponent, result) {
|
|
989
|
-
if (skipComponent !== this) {
|
|
990
|
-
if (this.view.sequenceComponents) {
|
|
991
|
-
this.view.sequenceComponents.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
992
935
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
}
|
|
996
|
-
result.components.push(this);
|
|
997
|
-
}
|
|
936
|
+
return true;
|
|
937
|
+
};
|
|
998
938
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
939
|
+
static createForRoot(componentContext) {
|
|
940
|
+
return () => {
|
|
941
|
+
return componentContext.validator.validateRoot();
|
|
942
|
+
};
|
|
1001
943
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
class ValidationErrorBadge {
|
|
947
|
+
static createForStep(parentElement, view, stepContext, componentContext, configuration) {
|
|
948
|
+
const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);
|
|
949
|
+
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1004
950
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
951
|
+
static createForRoot(parentElement, componentContext, configuration) {
|
|
952
|
+
const validator = ValidatorFactory.createForRoot(componentContext);
|
|
953
|
+
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1007
954
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
955
|
+
constructor(parentElement, validator, configuration) {
|
|
956
|
+
this.parentElement = parentElement;
|
|
957
|
+
this.validator = validator;
|
|
958
|
+
this.configuration = configuration;
|
|
959
|
+
this.view = null;
|
|
960
|
+
}
|
|
961
|
+
update(result) {
|
|
962
|
+
const isValid = this.validator();
|
|
963
|
+
if (isValid) {
|
|
964
|
+
if (this.view) {
|
|
965
|
+
this.view.destroy();
|
|
966
|
+
this.view = null;
|
|
967
|
+
}
|
|
1011
968
|
}
|
|
1012
|
-
this.
|
|
969
|
+
else if (!this.view) {
|
|
970
|
+
this.view = ValidationErrorBadgeView.create(this.parentElement, this.configuration);
|
|
971
|
+
}
|
|
972
|
+
return isValid && result;
|
|
1013
973
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
class StepComponentViewContextFactory {
|
|
1017
|
-
static create(stepContext, componentContext) {
|
|
1018
|
-
const preferenceKeyPrefix = stepContext.step.id + ':';
|
|
1019
|
-
return {
|
|
1020
|
-
i18n: componentContext.i18n,
|
|
1021
|
-
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
1022
|
-
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
1023
|
-
createSequenceComponent: (parentElement, sequence) => {
|
|
1024
|
-
const sequenceContext = {
|
|
1025
|
-
sequence,
|
|
1026
|
-
depth: stepContext.depth + 1,
|
|
1027
|
-
isInputConnected: true,
|
|
1028
|
-
isOutputConnected: stepContext.isOutputConnected,
|
|
1029
|
-
isPreview: stepContext.isPreview
|
|
1030
|
-
};
|
|
1031
|
-
return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
|
|
1032
|
-
},
|
|
1033
|
-
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
1034
|
-
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
1035
|
-
},
|
|
1036
|
-
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
1037
|
-
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
1038
|
-
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
1039
|
-
};
|
|
974
|
+
resolveClick() {
|
|
975
|
+
return null;
|
|
1040
976
|
}
|
|
1041
977
|
}
|
|
1042
978
|
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
979
|
+
const defaultConfiguration$7 = {
|
|
980
|
+
view: {
|
|
981
|
+
size: 22,
|
|
982
|
+
iconSize: 12
|
|
1046
983
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
const wrappedView = componentContext.services.stepComponentViewWrapper.wrap(view, stepContext);
|
|
1052
|
-
return StepComponent.create(wrappedView, stepContext, componentContext);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
class ComponentContext {
|
|
1057
|
-
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
|
|
1058
|
-
const validator = new DefinitionValidator(configuration.validator, state);
|
|
1059
|
-
const iconProvider = new IconProvider(configuration.steps);
|
|
1060
|
-
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
1061
|
-
return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
|
|
1062
|
-
}
|
|
1063
|
-
constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
|
|
1064
|
-
this.shadowRoot = shadowRoot;
|
|
1065
|
-
this.validator = validator;
|
|
1066
|
-
this.iconProvider = iconProvider;
|
|
1067
|
-
this.placeholderController = placeholderController;
|
|
1068
|
-
this.stepComponentFactory = stepComponentFactory;
|
|
1069
|
-
this.definitionWalker = definitionWalker;
|
|
1070
|
-
this.services = services;
|
|
1071
|
-
this.preferenceStorage = preferenceStorage;
|
|
1072
|
-
this.i18n = i18n;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
class CustomActionController {
|
|
1077
|
-
constructor(configuration, state, stateModifier) {
|
|
1078
|
-
this.configuration = configuration;
|
|
1079
|
-
this.state = state;
|
|
1080
|
-
this.stateModifier = stateModifier;
|
|
1081
|
-
}
|
|
1082
|
-
trigger(action, step, sequence) {
|
|
1083
|
-
const handler = this.configuration.customActionHandler;
|
|
1084
|
-
if (!handler) {
|
|
1085
|
-
console.warn(`Custom action handler is not defined (action type: ${action.type})`);
|
|
1086
|
-
return;
|
|
1087
|
-
}
|
|
1088
|
-
const context = this.createCustomActionHandlerContext();
|
|
1089
|
-
handler(action, step, sequence, context);
|
|
1090
|
-
}
|
|
1091
|
-
createCustomActionHandlerContext() {
|
|
1092
|
-
return {
|
|
1093
|
-
notifyStepNameChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepNameChanged, stepId, false),
|
|
1094
|
-
notifyStepPropertiesChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepPropertyChanged, stepId, false),
|
|
1095
|
-
notifyStepInserted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepInserted, stepId, true),
|
|
1096
|
-
notifyStepMoved: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepMoved, stepId, true),
|
|
1097
|
-
notifyStepDeleted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepDeleted, stepId, true)
|
|
1098
|
-
};
|
|
1099
|
-
}
|
|
1100
|
-
notifyStepChanged(changeType, stepId, updateDependencies) {
|
|
1101
|
-
if (!stepId) {
|
|
1102
|
-
throw new Error('Step id is empty');
|
|
1103
|
-
}
|
|
1104
|
-
this.state.notifyDefinitionChanged(changeType, stepId);
|
|
1105
|
-
if (updateDependencies) {
|
|
1106
|
-
this.stateModifier.updateDependencies();
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
class EditorView {
|
|
1112
|
-
static create(parent) {
|
|
1113
|
-
return new EditorView(parent);
|
|
1114
|
-
}
|
|
1115
|
-
constructor(parent) {
|
|
1116
|
-
this.parent = parent;
|
|
1117
|
-
this.currentContainer = null;
|
|
1118
|
-
}
|
|
1119
|
-
setContent(content, className) {
|
|
1120
|
-
const container = Dom.element('div', {
|
|
1121
|
-
class: className
|
|
1122
|
-
});
|
|
1123
|
-
container.appendChild(content);
|
|
1124
|
-
if (this.currentContainer) {
|
|
1125
|
-
this.parent.removeChild(this.currentContainer);
|
|
1126
|
-
}
|
|
1127
|
-
this.parent.appendChild(container);
|
|
1128
|
-
this.currentContainer = container;
|
|
1129
|
-
}
|
|
1130
|
-
destroy() {
|
|
1131
|
-
if (this.currentContainer) {
|
|
1132
|
-
this.parent.removeChild(this.currentContainer);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
class Editor {
|
|
1138
|
-
static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider, customSelectedStepIdProvider) {
|
|
1139
|
-
const view = EditorView.create(parent);
|
|
1140
|
-
function render(step) {
|
|
1141
|
-
const definition = api.getDefinition();
|
|
1142
|
-
let content;
|
|
1143
|
-
let className;
|
|
1144
|
-
if (step) {
|
|
1145
|
-
const stepContext = api.createStepEditorContext(step.id);
|
|
1146
|
-
content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
|
|
1147
|
-
className = stepEditorClassName;
|
|
1148
|
-
}
|
|
1149
|
-
else {
|
|
1150
|
-
const rootContext = api.createRootEditorContext();
|
|
1151
|
-
content = rootEditorProvider(definition, rootContext, api.isReadonly());
|
|
1152
|
-
className = rootEditorClassName;
|
|
1153
|
-
}
|
|
1154
|
-
view.setContent(content, className);
|
|
1155
|
-
}
|
|
1156
|
-
const renderer = api.runRenderer(step => render(step), customSelectedStepIdProvider);
|
|
1157
|
-
return new Editor(view, renderer);
|
|
1158
|
-
}
|
|
1159
|
-
constructor(view, renderer) {
|
|
1160
|
-
this.view = view;
|
|
1161
|
-
this.renderer = renderer;
|
|
1162
|
-
}
|
|
1163
|
-
destroy() {
|
|
1164
|
-
this.view.destroy();
|
|
1165
|
-
this.renderer.destroy();
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
class ValidationErrorBadgeView {
|
|
1170
|
-
static create(parent, cfg) {
|
|
1171
|
-
const g = Dom.svg('g');
|
|
1172
|
-
const halfOfSize = cfg.size / 2;
|
|
1173
|
-
const circle = Dom.svg('path', {
|
|
1174
|
-
class: 'sqd-validation-error',
|
|
1175
|
-
d: `M 0 ${-halfOfSize} l ${halfOfSize} ${cfg.size} l ${-cfg.size} 0 Z`
|
|
1176
|
-
});
|
|
1177
|
-
Dom.translate(circle, halfOfSize, halfOfSize);
|
|
1178
|
-
g.appendChild(circle);
|
|
1179
|
-
const icon = Icons.appendPath(g, 'sqd-validation-error-icon-path', Icons.alert, cfg.iconSize);
|
|
1180
|
-
const offsetX = (cfg.size - cfg.iconSize) / 2;
|
|
1181
|
-
const offsetY = offsetX * 1.5;
|
|
1182
|
-
Dom.translate(icon, offsetX, offsetY);
|
|
1183
|
-
parent.appendChild(g);
|
|
1184
|
-
return new ValidationErrorBadgeView(parent, g, cfg.size, cfg.size);
|
|
1185
|
-
}
|
|
1186
|
-
constructor(parent, g, width, height) {
|
|
1187
|
-
this.parent = parent;
|
|
1188
|
-
this.g = g;
|
|
1189
|
-
this.width = width;
|
|
1190
|
-
this.height = height;
|
|
1191
|
-
}
|
|
1192
|
-
destroy() {
|
|
1193
|
-
this.parent.removeChild(this.g);
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
class ValidatorFactory {
|
|
1198
|
-
static createForStep(stepContext, view, componentContext) {
|
|
1199
|
-
return () => {
|
|
1200
|
-
if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {
|
|
1201
|
-
return false;
|
|
1202
|
-
}
|
|
1203
|
-
if (view.haveCollapsedChildren) {
|
|
1204
|
-
let allChildrenValid = true;
|
|
1205
|
-
componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {
|
|
1206
|
-
if (!componentContext.validator.validateStep(step, parentSequence)) {
|
|
1207
|
-
allChildrenValid = false;
|
|
1208
|
-
return false;
|
|
1209
|
-
}
|
|
1210
|
-
});
|
|
1211
|
-
if (!allChildrenValid) {
|
|
1212
|
-
return false;
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
return true;
|
|
1216
|
-
};
|
|
1217
|
-
}
|
|
1218
|
-
static createForRoot(componentContext) {
|
|
1219
|
-
return () => {
|
|
1220
|
-
return componentContext.validator.validateRoot();
|
|
1221
|
-
};
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
class ValidationErrorBadge {
|
|
1226
|
-
static createForStep(parentElement, view, stepContext, componentContext, configuration) {
|
|
1227
|
-
const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);
|
|
1228
|
-
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1229
|
-
}
|
|
1230
|
-
static createForRoot(parentElement, componentContext, configuration) {
|
|
1231
|
-
const validator = ValidatorFactory.createForRoot(componentContext);
|
|
1232
|
-
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1233
|
-
}
|
|
1234
|
-
constructor(parentElement, validator, configuration) {
|
|
1235
|
-
this.parentElement = parentElement;
|
|
1236
|
-
this.validator = validator;
|
|
1237
|
-
this.configuration = configuration;
|
|
1238
|
-
this.view = null;
|
|
1239
|
-
}
|
|
1240
|
-
update(result) {
|
|
1241
|
-
const isValid = this.validator();
|
|
1242
|
-
if (isValid) {
|
|
1243
|
-
if (this.view) {
|
|
1244
|
-
this.view.destroy();
|
|
1245
|
-
this.view = null;
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
else if (!this.view) {
|
|
1249
|
-
this.view = ValidationErrorBadgeView.create(this.parentElement, this.configuration);
|
|
1250
|
-
}
|
|
1251
|
-
return isValid && result;
|
|
1252
|
-
}
|
|
1253
|
-
resolveClick() {
|
|
1254
|
-
return null;
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
const defaultConfiguration$7 = {
|
|
1259
|
-
view: {
|
|
1260
|
-
size: 22,
|
|
1261
|
-
iconSize: 12
|
|
1262
|
-
}
|
|
1263
|
-
};
|
|
1264
|
-
class ValidationErrorBadgeExtension {
|
|
1265
|
-
static create(configuration) {
|
|
1266
|
-
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$7);
|
|
984
|
+
};
|
|
985
|
+
class ValidationErrorBadgeExtension {
|
|
986
|
+
static create(configuration) {
|
|
987
|
+
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$7);
|
|
1267
988
|
}
|
|
1268
989
|
constructor(configuration) {
|
|
1269
990
|
this.configuration = configuration;
|
|
@@ -1563,6 +1284,20 @@ class DefaultSequenceComponent {
|
|
|
1563
1284
|
}
|
|
1564
1285
|
}
|
|
1565
1286
|
|
|
1287
|
+
var ClickCommandType;
|
|
1288
|
+
(function (ClickCommandType) {
|
|
1289
|
+
ClickCommandType[ClickCommandType["selectStep"] = 1] = "selectStep";
|
|
1290
|
+
ClickCommandType[ClickCommandType["rerenderStep"] = 2] = "rerenderStep";
|
|
1291
|
+
ClickCommandType[ClickCommandType["openFolder"] = 3] = "openFolder";
|
|
1292
|
+
ClickCommandType[ClickCommandType["triggerCustomAction"] = 4] = "triggerCustomAction";
|
|
1293
|
+
})(ClickCommandType || (ClickCommandType = {}));
|
|
1294
|
+
var PlaceholderDirection;
|
|
1295
|
+
(function (PlaceholderDirection) {
|
|
1296
|
+
PlaceholderDirection[PlaceholderDirection["none"] = 0] = "none";
|
|
1297
|
+
PlaceholderDirection[PlaceholderDirection["in"] = 1] = "in";
|
|
1298
|
+
PlaceholderDirection[PlaceholderDirection["out"] = 2] = "out";
|
|
1299
|
+
})(PlaceholderDirection || (PlaceholderDirection = {}));
|
|
1300
|
+
|
|
1566
1301
|
class StartStopRootComponentView {
|
|
1567
1302
|
static create(parent, sequence, parentPlaceIndicator, context, cfg) {
|
|
1568
1303
|
const g = Dom.svg('g', {
|
|
@@ -2041,28 +1776,106 @@ class DefaultViewportControllerExtension {
|
|
|
2041
1776
|
}
|
|
2042
1777
|
}
|
|
2043
1778
|
|
|
2044
|
-
class
|
|
2045
|
-
static create(
|
|
2046
|
-
const
|
|
2047
|
-
|
|
2048
|
-
const extension = services.steps[i];
|
|
2049
|
-
dict[extension.componentType] = extension;
|
|
2050
|
-
}
|
|
2051
|
-
return new StepExtensionResolver(dict);
|
|
1779
|
+
class StepComponent {
|
|
1780
|
+
static create(view, stepContext, componentContext) {
|
|
1781
|
+
const badges = Badges.createForStep(stepContext, view, componentContext);
|
|
1782
|
+
return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);
|
|
2052
1783
|
}
|
|
2053
|
-
constructor(
|
|
2054
|
-
this.
|
|
1784
|
+
constructor(view, step, parentSequence, hasOutput, badges) {
|
|
1785
|
+
this.view = view;
|
|
1786
|
+
this.step = step;
|
|
1787
|
+
this.parentSequence = parentSequence;
|
|
1788
|
+
this.hasOutput = hasOutput;
|
|
1789
|
+
this.badges = badges;
|
|
2055
1790
|
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
throw new Error(`Not supported component type: ${componentType}`);
|
|
1791
|
+
findById(stepId) {
|
|
1792
|
+
if (this.step.id === stepId) {
|
|
1793
|
+
return this;
|
|
2060
1794
|
}
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
1795
|
+
if (this.view.sequenceComponents) {
|
|
1796
|
+
for (const component of this.view.sequenceComponents) {
|
|
1797
|
+
const result = component.findById(stepId);
|
|
1798
|
+
if (result) {
|
|
1799
|
+
return result;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
return null;
|
|
1804
|
+
}
|
|
1805
|
+
resolveClick(click) {
|
|
1806
|
+
if (this.view.sequenceComponents) {
|
|
1807
|
+
for (const component of this.view.sequenceComponents) {
|
|
1808
|
+
const result = component.resolveClick(click);
|
|
1809
|
+
if (result) {
|
|
1810
|
+
return result;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
const badgeResult = this.badges.resolveClick(click);
|
|
1815
|
+
if (badgeResult) {
|
|
1816
|
+
return badgeResult;
|
|
1817
|
+
}
|
|
1818
|
+
const viewResult = this.view.resolveClick(click);
|
|
1819
|
+
if (viewResult) {
|
|
1820
|
+
return viewResult === true
|
|
1821
|
+
? {
|
|
1822
|
+
type: ClickCommandType.selectStep,
|
|
1823
|
+
component: this
|
|
1824
|
+
}
|
|
1825
|
+
: viewResult;
|
|
1826
|
+
}
|
|
1827
|
+
return null;
|
|
1828
|
+
}
|
|
1829
|
+
resolvePlaceholders(skipComponent, result) {
|
|
1830
|
+
if (skipComponent !== this) {
|
|
1831
|
+
if (this.view.sequenceComponents) {
|
|
1832
|
+
this.view.sequenceComponents.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
1833
|
+
}
|
|
1834
|
+
if (this.view.placeholders) {
|
|
1835
|
+
this.view.placeholders.forEach(ph => result.placeholders.push(ph));
|
|
1836
|
+
}
|
|
1837
|
+
result.components.push(this);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
setIsDragging(isDragging) {
|
|
1841
|
+
this.view.setIsDragging(isDragging);
|
|
1842
|
+
}
|
|
1843
|
+
setIsSelected(isSelected) {
|
|
1844
|
+
this.view.setIsSelected(isSelected);
|
|
1845
|
+
}
|
|
1846
|
+
setIsDisabled(isDisabled) {
|
|
1847
|
+
this.view.setIsDisabled(isDisabled);
|
|
1848
|
+
}
|
|
1849
|
+
updateBadges(result) {
|
|
1850
|
+
if (this.view.sequenceComponents) {
|
|
1851
|
+
this.view.sequenceComponents.forEach(component => component.updateBadges(result));
|
|
1852
|
+
}
|
|
1853
|
+
this.badges.update(result);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
class StepExtensionResolver {
|
|
1858
|
+
static create(services) {
|
|
1859
|
+
const dict = {};
|
|
1860
|
+
for (let i = services.steps.length - 1; i >= 0; i--) {
|
|
1861
|
+
const extension = services.steps[i];
|
|
1862
|
+
dict[extension.componentType] = extension;
|
|
1863
|
+
}
|
|
1864
|
+
return new StepExtensionResolver(dict);
|
|
1865
|
+
}
|
|
1866
|
+
constructor(dict) {
|
|
1867
|
+
this.dict = dict;
|
|
1868
|
+
}
|
|
1869
|
+
resolve(componentType) {
|
|
1870
|
+
const extension = this.dict[componentType];
|
|
1871
|
+
if (!extension) {
|
|
1872
|
+
throw new Error(`Not supported component type: ${componentType}`);
|
|
1873
|
+
}
|
|
1874
|
+
return extension;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
class RectPlaceholderView {
|
|
2066
1879
|
static create(parent, width, height, radius, iconSize, direction) {
|
|
2067
1880
|
const g = Dom.svg('g', {
|
|
2068
1881
|
visibility: 'hidden',
|
|
@@ -2121,63 +1934,414 @@ class RectPlaceholder {
|
|
|
2121
1934
|
resolveClick() {
|
|
2122
1935
|
return null;
|
|
2123
1936
|
}
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
class DefaultRegionView {
|
|
2127
|
-
static create(parent, widths, height) {
|
|
2128
|
-
const totalWidth = widths.reduce((result, width) => result + width, 0);
|
|
2129
|
-
const lines = [
|
|
2130
|
-
drawLine(parent, 0, 0, totalWidth, 0),
|
|
2131
|
-
drawLine(parent, 0, 0, 0, height),
|
|
2132
|
-
drawLine(parent, 0, height, totalWidth, height),
|
|
2133
|
-
drawLine(parent, totalWidth, 0, totalWidth, height)
|
|
2134
|
-
];
|
|
2135
|
-
let offsetX = widths[0];
|
|
2136
|
-
for (let i = 1; i < widths.length; i++) {
|
|
2137
|
-
lines.push(drawLine(parent, offsetX, 0, offsetX, height));
|
|
2138
|
-
offsetX += widths[i];
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
class DefaultRegionView {
|
|
1940
|
+
static create(parent, widths, height) {
|
|
1941
|
+
const totalWidth = widths.reduce((result, width) => result + width, 0);
|
|
1942
|
+
const lines = [
|
|
1943
|
+
drawLine(parent, 0, 0, totalWidth, 0),
|
|
1944
|
+
drawLine(parent, 0, 0, 0, height),
|
|
1945
|
+
drawLine(parent, 0, height, totalWidth, height),
|
|
1946
|
+
drawLine(parent, totalWidth, 0, totalWidth, height)
|
|
1947
|
+
];
|
|
1948
|
+
let offsetX = widths[0];
|
|
1949
|
+
for (let i = 1; i < widths.length; i++) {
|
|
1950
|
+
lines.push(drawLine(parent, offsetX, 0, offsetX, height));
|
|
1951
|
+
offsetX += widths[i];
|
|
1952
|
+
}
|
|
1953
|
+
return new DefaultRegionView(lines, totalWidth, height);
|
|
1954
|
+
}
|
|
1955
|
+
constructor(lines, width, height) {
|
|
1956
|
+
this.lines = lines;
|
|
1957
|
+
this.width = width;
|
|
1958
|
+
this.height = height;
|
|
1959
|
+
}
|
|
1960
|
+
getClientPosition() {
|
|
1961
|
+
return getAbsolutePosition(this.lines[0]);
|
|
1962
|
+
}
|
|
1963
|
+
resolveClick(click) {
|
|
1964
|
+
const regionPosition = this.getClientPosition();
|
|
1965
|
+
const d = click.position.subtract(regionPosition);
|
|
1966
|
+
if (d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale) {
|
|
1967
|
+
return true;
|
|
1968
|
+
}
|
|
1969
|
+
return null;
|
|
1970
|
+
}
|
|
1971
|
+
setIsSelected(isSelected) {
|
|
1972
|
+
this.lines.forEach(region => {
|
|
1973
|
+
Dom.toggleClass(region, isSelected, 'sqd-selected');
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
function drawLine(parent, x1, y1, x2, y2) {
|
|
1978
|
+
const line = Dom.svg('line', {
|
|
1979
|
+
class: 'sqd-region',
|
|
1980
|
+
x1,
|
|
1981
|
+
y1,
|
|
1982
|
+
x2,
|
|
1983
|
+
y2
|
|
1984
|
+
});
|
|
1985
|
+
parent.insertBefore(line, parent.firstChild);
|
|
1986
|
+
return line;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
class DefaultRegionComponentViewExtension {
|
|
1990
|
+
create(parentElement, componentClassName, stepContext, _, contentFactory) {
|
|
1991
|
+
const g = ComponentDom.stepG(componentClassName, stepContext.step.type, stepContext.step.id);
|
|
1992
|
+
parentElement.appendChild(g);
|
|
1993
|
+
return contentFactory(g, DefaultRegionView.create);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
class DefaultViewportControllerDesignerExtension {
|
|
1998
|
+
static create(configuration) {
|
|
1999
|
+
return new DefaultViewportControllerDesignerExtension(DefaultViewportControllerExtension.create(configuration));
|
|
2000
|
+
}
|
|
2001
|
+
constructor(viewportController) {
|
|
2002
|
+
this.viewportController = viewportController;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
class LineGrid {
|
|
2007
|
+
static create(size) {
|
|
2008
|
+
const path = Dom.svg('path', {
|
|
2009
|
+
class: 'sqd-line-grid-path',
|
|
2010
|
+
fill: 'none'
|
|
2011
|
+
});
|
|
2012
|
+
return new LineGrid(size, path);
|
|
2013
|
+
}
|
|
2014
|
+
constructor(size, element) {
|
|
2015
|
+
this.size = size;
|
|
2016
|
+
this.element = element;
|
|
2017
|
+
}
|
|
2018
|
+
setScale(_, scaledSize) {
|
|
2019
|
+
Dom.attrs(this.element, {
|
|
2020
|
+
d: `M ${scaledSize.x} 0 L 0 0 0 ${scaledSize.y}`
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
const defaultConfiguration$4 = {
|
|
2026
|
+
gridSizeX: 48,
|
|
2027
|
+
gridSizeY: 48
|
|
2028
|
+
};
|
|
2029
|
+
class LineGridExtension {
|
|
2030
|
+
static create(configuration) {
|
|
2031
|
+
return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4);
|
|
2032
|
+
}
|
|
2033
|
+
constructor(configuration) {
|
|
2034
|
+
this.configuration = configuration;
|
|
2035
|
+
}
|
|
2036
|
+
create() {
|
|
2037
|
+
const size = new Vector(this.configuration.gridSizeX, this.configuration.gridSizeY);
|
|
2038
|
+
return LineGrid.create(size);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
class LineGridDesignerExtension {
|
|
2043
|
+
static create(configuration) {
|
|
2044
|
+
const grid = LineGridExtension.create(configuration);
|
|
2045
|
+
return new LineGridDesignerExtension(grid);
|
|
2046
|
+
}
|
|
2047
|
+
constructor(grid) {
|
|
2048
|
+
this.grid = grid;
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
class StartStopRootComponentDesignerExtension {
|
|
2053
|
+
static create(configuration) {
|
|
2054
|
+
return new StartStopRootComponentDesignerExtension(StartStopRootComponentExtension.create(configuration));
|
|
2055
|
+
}
|
|
2056
|
+
constructor(rootComponent) {
|
|
2057
|
+
this.rootComponent = rootComponent;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
const defaultConfiguration$3 = {
|
|
2062
|
+
view: {
|
|
2063
|
+
paddingTop: 20,
|
|
2064
|
+
paddingX: 20,
|
|
2065
|
+
inputSize: 18,
|
|
2066
|
+
inputIconSize: 14,
|
|
2067
|
+
label: {
|
|
2068
|
+
height: 22,
|
|
2069
|
+
paddingX: 10,
|
|
2070
|
+
minWidth: 50,
|
|
2071
|
+
radius: 10
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
class ContainerStepExtension {
|
|
2076
|
+
static create(configuration) {
|
|
2077
|
+
return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$3);
|
|
2078
|
+
}
|
|
2079
|
+
constructor(configuration) {
|
|
2080
|
+
this.configuration = configuration;
|
|
2081
|
+
this.componentType = 'container';
|
|
2082
|
+
this.createComponentView = createContainerStepComponentViewFactory(this.configuration.view);
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
const defaultConfiguration$2 = {
|
|
2087
|
+
view: {
|
|
2088
|
+
minContainerWidth: 40,
|
|
2089
|
+
paddingX: 20,
|
|
2090
|
+
paddingTop: 20,
|
|
2091
|
+
connectionHeight: 16,
|
|
2092
|
+
inputSize: 18,
|
|
2093
|
+
inputIconSize: 14,
|
|
2094
|
+
branchNameLabel: {
|
|
2095
|
+
height: 22,
|
|
2096
|
+
paddingX: 10,
|
|
2097
|
+
minWidth: 50,
|
|
2098
|
+
radius: 10
|
|
2099
|
+
},
|
|
2100
|
+
nameLabel: {
|
|
2101
|
+
height: 22,
|
|
2102
|
+
paddingX: 10,
|
|
2103
|
+
minWidth: 50,
|
|
2104
|
+
radius: 10
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
class SwitchStepExtension {
|
|
2109
|
+
static create(configuration) {
|
|
2110
|
+
return new SwitchStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);
|
|
2111
|
+
}
|
|
2112
|
+
constructor(configuration) {
|
|
2113
|
+
this.configuration = configuration;
|
|
2114
|
+
this.componentType = 'switch';
|
|
2115
|
+
this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
const defaultConfiguration$1 = {
|
|
2120
|
+
view: {
|
|
2121
|
+
paddingLeft: 12,
|
|
2122
|
+
paddingRight: 12,
|
|
2123
|
+
paddingY: 10,
|
|
2124
|
+
textMarginLeft: 12,
|
|
2125
|
+
minTextWidth: 70,
|
|
2126
|
+
iconSize: 22,
|
|
2127
|
+
radius: 5,
|
|
2128
|
+
inputSize: 14,
|
|
2129
|
+
outputSize: 10
|
|
2130
|
+
}
|
|
2131
|
+
};
|
|
2132
|
+
class TaskStepExtension {
|
|
2133
|
+
static create(configuration) {
|
|
2134
|
+
return new TaskStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$1);
|
|
2135
|
+
}
|
|
2136
|
+
constructor(configuration) {
|
|
2137
|
+
this.configuration = configuration;
|
|
2138
|
+
this.componentType = 'task';
|
|
2139
|
+
this.createComponentView = createTaskStepComponentViewFactory(false, this.configuration.view);
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
class StepsDesignerExtension {
|
|
2144
|
+
static create(configuration) {
|
|
2145
|
+
const steps = [];
|
|
2146
|
+
if (configuration.container) {
|
|
2147
|
+
steps.push(ContainerStepExtension.create(configuration.container));
|
|
2148
|
+
}
|
|
2149
|
+
if (configuration.switch) {
|
|
2150
|
+
steps.push(SwitchStepExtension.create(configuration.switch));
|
|
2151
|
+
}
|
|
2152
|
+
if (configuration.task) {
|
|
2153
|
+
steps.push(TaskStepExtension.create(configuration.task));
|
|
2154
|
+
}
|
|
2155
|
+
return new StepsDesignerExtension(steps);
|
|
2156
|
+
}
|
|
2157
|
+
constructor(steps) {
|
|
2158
|
+
this.steps = steps;
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
class DefinitionValidator {
|
|
2163
|
+
constructor(configuration, state) {
|
|
2164
|
+
this.configuration = configuration;
|
|
2165
|
+
this.state = state;
|
|
2166
|
+
}
|
|
2167
|
+
validateStep(step, parentSequence) {
|
|
2168
|
+
var _a;
|
|
2169
|
+
if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.step) {
|
|
2170
|
+
return this.configuration.step(step, parentSequence, this.state.definition);
|
|
2171
|
+
}
|
|
2172
|
+
return true;
|
|
2173
|
+
}
|
|
2174
|
+
validateRoot() {
|
|
2175
|
+
var _a;
|
|
2176
|
+
if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.root) {
|
|
2177
|
+
return this.configuration.root(this.state.definition);
|
|
2178
|
+
}
|
|
2179
|
+
return true;
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
class IconProvider {
|
|
2184
|
+
constructor(configuration) {
|
|
2185
|
+
this.configuration = configuration;
|
|
2186
|
+
}
|
|
2187
|
+
getIconUrl(step) {
|
|
2188
|
+
if (this.configuration.iconUrlProvider) {
|
|
2189
|
+
return this.configuration.iconUrlProvider(step.componentType, step.type);
|
|
2190
|
+
}
|
|
2191
|
+
return null;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
class StepComponentViewContextFactory {
|
|
2196
|
+
static create(stepContext, componentContext) {
|
|
2197
|
+
const preferenceKeyPrefix = stepContext.step.id + ':';
|
|
2198
|
+
return {
|
|
2199
|
+
i18n: componentContext.i18n,
|
|
2200
|
+
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
2201
|
+
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
2202
|
+
createSequenceComponent: (parentElement, sequence) => {
|
|
2203
|
+
const sequenceContext = {
|
|
2204
|
+
sequence,
|
|
2205
|
+
depth: stepContext.depth + 1,
|
|
2206
|
+
isInputConnected: true,
|
|
2207
|
+
isOutputConnected: stepContext.isOutputConnected,
|
|
2208
|
+
isPreview: stepContext.isPreview
|
|
2209
|
+
};
|
|
2210
|
+
return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
|
|
2211
|
+
},
|
|
2212
|
+
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
2213
|
+
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
2214
|
+
},
|
|
2215
|
+
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
2216
|
+
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
2217
|
+
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
class StepComponentFactory {
|
|
2223
|
+
constructor(stepExtensionResolver) {
|
|
2224
|
+
this.stepExtensionResolver = stepExtensionResolver;
|
|
2225
|
+
}
|
|
2226
|
+
create(parentElement, stepContext, componentContext) {
|
|
2227
|
+
const viewContext = StepComponentViewContextFactory.create(stepContext, componentContext);
|
|
2228
|
+
const extension = this.stepExtensionResolver.resolve(stepContext.step.componentType);
|
|
2229
|
+
const view = extension.createComponentView(parentElement, stepContext, viewContext);
|
|
2230
|
+
const wrappedView = componentContext.services.stepComponentViewWrapper.wrap(view, stepContext);
|
|
2231
|
+
return StepComponent.create(wrappedView, stepContext, componentContext);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
class ComponentContext {
|
|
2236
|
+
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
|
|
2237
|
+
const validator = new DefinitionValidator(configuration.validator, state);
|
|
2238
|
+
const iconProvider = new IconProvider(configuration.steps);
|
|
2239
|
+
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
2240
|
+
return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
|
|
2241
|
+
}
|
|
2242
|
+
constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
|
|
2243
|
+
this.shadowRoot = shadowRoot;
|
|
2244
|
+
this.validator = validator;
|
|
2245
|
+
this.iconProvider = iconProvider;
|
|
2246
|
+
this.placeholderController = placeholderController;
|
|
2247
|
+
this.stepComponentFactory = stepComponentFactory;
|
|
2248
|
+
this.definitionWalker = definitionWalker;
|
|
2249
|
+
this.services = services;
|
|
2250
|
+
this.preferenceStorage = preferenceStorage;
|
|
2251
|
+
this.i18n = i18n;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
class CustomActionController {
|
|
2256
|
+
constructor(configuration, state, stateModifier) {
|
|
2257
|
+
this.configuration = configuration;
|
|
2258
|
+
this.state = state;
|
|
2259
|
+
this.stateModifier = stateModifier;
|
|
2260
|
+
}
|
|
2261
|
+
trigger(action, step, sequence) {
|
|
2262
|
+
const handler = this.configuration.customActionHandler;
|
|
2263
|
+
if (!handler) {
|
|
2264
|
+
console.warn(`Custom action handler is not defined (action type: ${action.type})`);
|
|
2265
|
+
return;
|
|
2266
|
+
}
|
|
2267
|
+
const context = this.createCustomActionHandlerContext();
|
|
2268
|
+
handler(action, step, sequence, context);
|
|
2269
|
+
}
|
|
2270
|
+
createCustomActionHandlerContext() {
|
|
2271
|
+
return {
|
|
2272
|
+
notifyStepNameChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepNameChanged, stepId, false),
|
|
2273
|
+
notifyStepPropertiesChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepPropertyChanged, stepId, false),
|
|
2274
|
+
notifyStepInserted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepInserted, stepId, true),
|
|
2275
|
+
notifyStepMoved: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepMoved, stepId, true),
|
|
2276
|
+
notifyStepDeleted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepDeleted, stepId, true)
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2279
|
+
notifyStepChanged(changeType, stepId, updateDependencies) {
|
|
2280
|
+
if (!stepId) {
|
|
2281
|
+
throw new Error('Step id is empty');
|
|
2282
|
+
}
|
|
2283
|
+
this.state.notifyDefinitionChanged(changeType, stepId);
|
|
2284
|
+
if (updateDependencies) {
|
|
2285
|
+
this.stateModifier.updateDependencies();
|
|
2139
2286
|
}
|
|
2140
|
-
return new DefaultRegionView(lines, totalWidth, height);
|
|
2141
2287
|
}
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
class EditorView {
|
|
2291
|
+
static create(parent) {
|
|
2292
|
+
return new EditorView(parent);
|
|
2146
2293
|
}
|
|
2147
|
-
|
|
2148
|
-
|
|
2294
|
+
constructor(parent) {
|
|
2295
|
+
this.parent = parent;
|
|
2296
|
+
this.currentContainer = null;
|
|
2149
2297
|
}
|
|
2150
|
-
|
|
2151
|
-
const
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2298
|
+
setContent(content, className) {
|
|
2299
|
+
const container = Dom.element('div', {
|
|
2300
|
+
class: className
|
|
2301
|
+
});
|
|
2302
|
+
container.appendChild(content);
|
|
2303
|
+
if (this.currentContainer) {
|
|
2304
|
+
this.parent.removeChild(this.currentContainer);
|
|
2155
2305
|
}
|
|
2156
|
-
|
|
2306
|
+
this.parent.appendChild(container);
|
|
2307
|
+
this.currentContainer = container;
|
|
2157
2308
|
}
|
|
2158
|
-
|
|
2159
|
-
this.
|
|
2160
|
-
|
|
2161
|
-
}
|
|
2309
|
+
destroy() {
|
|
2310
|
+
if (this.currentContainer) {
|
|
2311
|
+
this.parent.removeChild(this.currentContainer);
|
|
2312
|
+
}
|
|
2162
2313
|
}
|
|
2163
|
-
}
|
|
2164
|
-
function drawLine(parent, x1, y1, x2, y2) {
|
|
2165
|
-
const line = Dom.svg('line', {
|
|
2166
|
-
class: 'sqd-region',
|
|
2167
|
-
x1,
|
|
2168
|
-
y1,
|
|
2169
|
-
x2,
|
|
2170
|
-
y2
|
|
2171
|
-
});
|
|
2172
|
-
parent.insertBefore(line, parent.firstChild);
|
|
2173
|
-
return line;
|
|
2174
2314
|
}
|
|
2175
2315
|
|
|
2176
|
-
class
|
|
2177
|
-
create(
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
|
|
2316
|
+
class Editor {
|
|
2317
|
+
static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider, customSelectedStepIdProvider) {
|
|
2318
|
+
const view = EditorView.create(parent);
|
|
2319
|
+
function render(step) {
|
|
2320
|
+
const definition = api.getDefinition();
|
|
2321
|
+
let content;
|
|
2322
|
+
let className;
|
|
2323
|
+
if (step) {
|
|
2324
|
+
const stepContext = api.createStepEditorContext(step.id);
|
|
2325
|
+
content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
|
|
2326
|
+
className = stepEditorClassName;
|
|
2327
|
+
}
|
|
2328
|
+
else {
|
|
2329
|
+
const rootContext = api.createRootEditorContext();
|
|
2330
|
+
content = rootEditorProvider(definition, rootContext, api.isReadonly());
|
|
2331
|
+
className = rootEditorClassName;
|
|
2332
|
+
}
|
|
2333
|
+
view.setContent(content, className);
|
|
2334
|
+
}
|
|
2335
|
+
const renderer = api.runRenderer(step => render(step), customSelectedStepIdProvider);
|
|
2336
|
+
return new Editor(view, renderer);
|
|
2337
|
+
}
|
|
2338
|
+
constructor(view, renderer) {
|
|
2339
|
+
this.view = view;
|
|
2340
|
+
this.renderer = renderer;
|
|
2341
|
+
}
|
|
2342
|
+
destroy() {
|
|
2343
|
+
this.view.destroy();
|
|
2344
|
+
this.renderer.destroy();
|
|
2181
2345
|
}
|
|
2182
2346
|
}
|
|
2183
2347
|
|
|
@@ -2226,6 +2390,8 @@ class BehaviorController {
|
|
|
2226
2390
|
constructor(dom, shadowRoot) {
|
|
2227
2391
|
this.dom = dom;
|
|
2228
2392
|
this.shadowRoot = shadowRoot;
|
|
2393
|
+
this.previousEndToken = null;
|
|
2394
|
+
this.state = null;
|
|
2229
2395
|
this.onMouseMove = (e) => {
|
|
2230
2396
|
e.preventDefault();
|
|
2231
2397
|
e.stopPropagation();
|
|
@@ -2297,7 +2463,7 @@ class BehaviorController {
|
|
|
2297
2463
|
const delta = this.state.startPosition.subtract(position);
|
|
2298
2464
|
const newBehavior = this.state.behavior.onMove(delta);
|
|
2299
2465
|
if (newBehavior) {
|
|
2300
|
-
this.state.behavior.onEnd(true, null);
|
|
2466
|
+
this.state.behavior.onEnd(true, null, null);
|
|
2301
2467
|
this.state.behavior = newBehavior;
|
|
2302
2468
|
this.state.startPosition = position;
|
|
2303
2469
|
this.state.behavior.onStart(this.state.startPosition);
|
|
@@ -2311,8 +2477,9 @@ class BehaviorController {
|
|
|
2311
2477
|
this.unbind(this.shadowRoot);
|
|
2312
2478
|
}
|
|
2313
2479
|
this.unbind(window);
|
|
2314
|
-
this.state.behavior.onEnd(interrupt, element);
|
|
2315
|
-
this.state =
|
|
2480
|
+
const endToken = this.state.behavior.onEnd(interrupt, element, this.previousEndToken);
|
|
2481
|
+
this.state = null;
|
|
2482
|
+
this.previousEndToken = endToken || null;
|
|
2316
2483
|
}
|
|
2317
2484
|
}
|
|
2318
2485
|
|
|
@@ -2988,9 +3155,11 @@ class SelectStepBehavior {
|
|
|
2988
3155
|
}
|
|
2989
3156
|
}
|
|
2990
3157
|
onEnd(interrupt) {
|
|
2991
|
-
if (
|
|
2992
|
-
|
|
3158
|
+
if (interrupt) {
|
|
3159
|
+
return;
|
|
2993
3160
|
}
|
|
3161
|
+
this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence);
|
|
3162
|
+
return new SelectStepBehaviorEndToken(this.pressedStepComponent.step.id, Date.now());
|
|
2994
3163
|
}
|
|
2995
3164
|
}
|
|
2996
3165
|
|
|
@@ -3359,13 +3528,14 @@ class Workspace {
|
|
|
3359
3528
|
var _a;
|
|
3360
3529
|
const view = WorkspaceView.create(parent, designerContext.componentContext);
|
|
3361
3530
|
const clickBehaviorResolver = new ClickBehaviorResolver(designerContext);
|
|
3531
|
+
const clickBehaviorWrapper = designerContext.services.clickBehaviorWrapperExtension.create(designerContext.customActionController);
|
|
3362
3532
|
const wheelController = designerContext.services.wheelController.create(api.viewport, api.workspace);
|
|
3363
3533
|
const pinchToZoomController = PinchToZoomController.create(api.workspace, api.viewport, api.shadowRoot);
|
|
3364
3534
|
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
3365
3535
|
? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
|
|
3366
3536
|
: undefined);
|
|
3367
3537
|
const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
|
|
3368
|
-
const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, api.viewport, designerContext.services);
|
|
3538
|
+
const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, api.viewport, designerContext.services);
|
|
3369
3539
|
setTimeout(() => {
|
|
3370
3540
|
workspace.updateRootComponent();
|
|
3371
3541
|
api.viewport.resetViewport();
|
|
@@ -3381,7 +3551,7 @@ class Workspace {
|
|
|
3381
3551
|
view.bindContextMenu(workspace.onContextMenu);
|
|
3382
3552
|
return workspace;
|
|
3383
3553
|
}
|
|
3384
|
-
constructor(view, definitionWalker, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, viewportApi, services) {
|
|
3554
|
+
constructor(view, definitionWalker, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, viewportApi, services) {
|
|
3385
3555
|
this.view = view;
|
|
3386
3556
|
this.definitionWalker = definitionWalker;
|
|
3387
3557
|
this.state = state;
|
|
@@ -3390,6 +3560,7 @@ class Workspace {
|
|
|
3390
3560
|
this.pinchToZoomController = pinchToZoomController;
|
|
3391
3561
|
this.contextMenuController = contextMenuController;
|
|
3392
3562
|
this.clickBehaviorResolver = clickBehaviorResolver;
|
|
3563
|
+
this.clickBehaviorWrapper = clickBehaviorWrapper;
|
|
3393
3564
|
this.viewportApi = viewportApi;
|
|
3394
3565
|
this.services = services;
|
|
3395
3566
|
this.onRendered = new SimpleEvent();
|
|
@@ -3403,7 +3574,8 @@ class Workspace {
|
|
|
3403
3574
|
const forceMove = isMiddleButton || altKey;
|
|
3404
3575
|
const commandOrNull = this.resolveClick(target, position);
|
|
3405
3576
|
const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, forceMove);
|
|
3406
|
-
this.
|
|
3577
|
+
const wrappedBehavior = this.clickBehaviorWrapper.wrap(behavior, commandOrNull);
|
|
3578
|
+
this.behaviorController.start(position, wrappedBehavior);
|
|
3407
3579
|
}
|
|
3408
3580
|
};
|
|
3409
3581
|
this.onPinchToZoom = (distance, centerPoint) => {
|
|
@@ -3721,7 +3893,7 @@ class ControlBar {
|
|
|
3721
3893
|
static create(parent, api) {
|
|
3722
3894
|
const isUndoRedoSupported = api.controlBar.isUndoRedoSupported();
|
|
3723
3895
|
const view = ControlBarView.create(parent, isUndoRedoSupported, api.i18n);
|
|
3724
|
-
const bar = new ControlBar(view, api.controlBar, isUndoRedoSupported);
|
|
3896
|
+
const bar = new ControlBar(view, api.controlBar, api.viewport, isUndoRedoSupported);
|
|
3725
3897
|
view.bindResetButtonClick(() => bar.onResetButtonClicked());
|
|
3726
3898
|
view.bindZoomInButtonClick(() => bar.onZoomInButtonClicked());
|
|
3727
3899
|
view.bindZoomOutButtonClick(() => bar.onZoomOutButtonClicked());
|
|
@@ -3735,9 +3907,10 @@ class ControlBar {
|
|
|
3735
3907
|
bar.refreshButtons();
|
|
3736
3908
|
return bar;
|
|
3737
3909
|
}
|
|
3738
|
-
constructor(view, controlBarApi, isUndoRedoSupported) {
|
|
3910
|
+
constructor(view, controlBarApi, viewportApi, isUndoRedoSupported) {
|
|
3739
3911
|
this.view = view;
|
|
3740
3912
|
this.controlBarApi = controlBarApi;
|
|
3913
|
+
this.viewportApi = viewportApi;
|
|
3741
3914
|
this.isUndoRedoSupported = isUndoRedoSupported;
|
|
3742
3915
|
}
|
|
3743
3916
|
updateLayout() {
|
|
@@ -3747,13 +3920,13 @@ class ControlBar {
|
|
|
3747
3920
|
//
|
|
3748
3921
|
}
|
|
3749
3922
|
onResetButtonClicked() {
|
|
3750
|
-
this.
|
|
3923
|
+
this.viewportApi.resetViewport();
|
|
3751
3924
|
}
|
|
3752
3925
|
onZoomInButtonClicked() {
|
|
3753
|
-
this.
|
|
3926
|
+
this.viewportApi.zoom(true);
|
|
3754
3927
|
}
|
|
3755
3928
|
onZoomOutButtonClicked() {
|
|
3756
|
-
this.
|
|
3929
|
+
this.viewportApi.zoom(false);
|
|
3757
3930
|
}
|
|
3758
3931
|
onMoveButtonClicked() {
|
|
3759
3932
|
this.controlBarApi.toggleIsDragDisabled();
|
|
@@ -4271,31 +4444,6 @@ class ToolboxExtension {
|
|
|
4271
4444
|
}
|
|
4272
4445
|
}
|
|
4273
4446
|
|
|
4274
|
-
const defaultConfiguration$4 = {
|
|
4275
|
-
view: {
|
|
4276
|
-
paddingTop: 20,
|
|
4277
|
-
paddingX: 20,
|
|
4278
|
-
inputSize: 18,
|
|
4279
|
-
inputIconSize: 14,
|
|
4280
|
-
label: {
|
|
4281
|
-
height: 22,
|
|
4282
|
-
paddingX: 10,
|
|
4283
|
-
minWidth: 50,
|
|
4284
|
-
radius: 10
|
|
4285
|
-
}
|
|
4286
|
-
}
|
|
4287
|
-
};
|
|
4288
|
-
class ContainerStepExtension {
|
|
4289
|
-
static create(configuration) {
|
|
4290
|
-
return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4);
|
|
4291
|
-
}
|
|
4292
|
-
constructor(configuration) {
|
|
4293
|
-
this.configuration = configuration;
|
|
4294
|
-
this.componentType = 'container';
|
|
4295
|
-
this.createComponentView = createContainerStepComponentViewFactory(this.configuration.view);
|
|
4296
|
-
}
|
|
4297
|
-
}
|
|
4298
|
-
|
|
4299
4447
|
class DefaultPlaceholderControllerExtension {
|
|
4300
4448
|
create() {
|
|
4301
4449
|
return {
|
|
@@ -4304,7 +4452,7 @@ class DefaultPlaceholderControllerExtension {
|
|
|
4304
4452
|
}
|
|
4305
4453
|
}
|
|
4306
4454
|
|
|
4307
|
-
const defaultConfiguration
|
|
4455
|
+
const defaultConfiguration = {
|
|
4308
4456
|
gapWidth: 88,
|
|
4309
4457
|
gapHeight: 24,
|
|
4310
4458
|
radius: 6,
|
|
@@ -4312,7 +4460,7 @@ const defaultConfiguration$3 = {
|
|
|
4312
4460
|
};
|
|
4313
4461
|
class RectPlaceholderExtension {
|
|
4314
4462
|
static create(configuration) {
|
|
4315
|
-
return new RectPlaceholderExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration
|
|
4463
|
+
return new RectPlaceholderExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration);
|
|
4316
4464
|
}
|
|
4317
4465
|
constructor(configuration) {
|
|
4318
4466
|
this.configuration = configuration;
|
|
@@ -4326,63 +4474,6 @@ class RectPlaceholderExtension {
|
|
|
4326
4474
|
}
|
|
4327
4475
|
}
|
|
4328
4476
|
|
|
4329
|
-
const defaultConfiguration$2 = {
|
|
4330
|
-
view: {
|
|
4331
|
-
minContainerWidth: 40,
|
|
4332
|
-
paddingX: 20,
|
|
4333
|
-
paddingTop: 20,
|
|
4334
|
-
connectionHeight: 16,
|
|
4335
|
-
inputSize: 18,
|
|
4336
|
-
inputIconSize: 14,
|
|
4337
|
-
branchNameLabel: {
|
|
4338
|
-
height: 22,
|
|
4339
|
-
paddingX: 10,
|
|
4340
|
-
minWidth: 50,
|
|
4341
|
-
radius: 10
|
|
4342
|
-
},
|
|
4343
|
-
nameLabel: {
|
|
4344
|
-
height: 22,
|
|
4345
|
-
paddingX: 10,
|
|
4346
|
-
minWidth: 50,
|
|
4347
|
-
radius: 10
|
|
4348
|
-
}
|
|
4349
|
-
}
|
|
4350
|
-
};
|
|
4351
|
-
class SwitchStepExtension {
|
|
4352
|
-
static create(configuration) {
|
|
4353
|
-
return new SwitchStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);
|
|
4354
|
-
}
|
|
4355
|
-
constructor(configuration) {
|
|
4356
|
-
this.configuration = configuration;
|
|
4357
|
-
this.componentType = 'switch';
|
|
4358
|
-
this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);
|
|
4359
|
-
}
|
|
4360
|
-
}
|
|
4361
|
-
|
|
4362
|
-
const defaultConfiguration$1 = {
|
|
4363
|
-
view: {
|
|
4364
|
-
paddingLeft: 12,
|
|
4365
|
-
paddingRight: 12,
|
|
4366
|
-
paddingY: 10,
|
|
4367
|
-
textMarginLeft: 12,
|
|
4368
|
-
minTextWidth: 70,
|
|
4369
|
-
iconSize: 22,
|
|
4370
|
-
radius: 5,
|
|
4371
|
-
inputSize: 14,
|
|
4372
|
-
outputSize: 10
|
|
4373
|
-
}
|
|
4374
|
-
};
|
|
4375
|
-
class TaskStepExtension {
|
|
4376
|
-
static create(configuration) {
|
|
4377
|
-
return new TaskStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$1);
|
|
4378
|
-
}
|
|
4379
|
-
constructor(configuration) {
|
|
4380
|
-
this.configuration = configuration;
|
|
4381
|
-
this.componentType = 'task';
|
|
4382
|
-
this.createComponentView = createTaskStepComponentViewFactory(false, this.configuration.view);
|
|
4383
|
-
}
|
|
4384
|
-
}
|
|
4385
|
-
|
|
4386
4477
|
class DefaultSequenceComponentExtension {
|
|
4387
4478
|
constructor() {
|
|
4388
4479
|
this.create = DefaultSequenceComponent.create;
|
|
@@ -4395,39 +4486,15 @@ class DefaultStepComponentViewWrapperExtension {
|
|
|
4395
4486
|
}
|
|
4396
4487
|
}
|
|
4397
4488
|
|
|
4398
|
-
class
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
class: 'sqd-line-grid-path',
|
|
4402
|
-
fill: 'none'
|
|
4403
|
-
});
|
|
4404
|
-
return new LineGrid(size, path);
|
|
4405
|
-
}
|
|
4406
|
-
constructor(size, element) {
|
|
4407
|
-
this.size = size;
|
|
4408
|
-
this.element = element;
|
|
4409
|
-
}
|
|
4410
|
-
setScale(_, scaledSize) {
|
|
4411
|
-
Dom.attrs(this.element, {
|
|
4412
|
-
d: `M ${scaledSize.x} 0 L 0 0 0 ${scaledSize.y}`
|
|
4413
|
-
});
|
|
4489
|
+
class DefaultClickBehaviorWrapper {
|
|
4490
|
+
constructor() {
|
|
4491
|
+
this.wrap = (behavior) => behavior;
|
|
4414
4492
|
}
|
|
4415
4493
|
}
|
|
4416
4494
|
|
|
4417
|
-
|
|
4418
|
-
gridSizeX: 48,
|
|
4419
|
-
gridSizeY: 48
|
|
4420
|
-
};
|
|
4421
|
-
class LineGridExtension {
|
|
4422
|
-
static create(configuration) {
|
|
4423
|
-
return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration);
|
|
4424
|
-
}
|
|
4425
|
-
constructor(configuration) {
|
|
4426
|
-
this.configuration = configuration;
|
|
4427
|
-
}
|
|
4495
|
+
class DefaultClickBehaviorWrapperExtension {
|
|
4428
4496
|
create() {
|
|
4429
|
-
|
|
4430
|
-
return LineGrid.create(size);
|
|
4497
|
+
return new DefaultClickBehaviorWrapper();
|
|
4431
4498
|
}
|
|
4432
4499
|
}
|
|
4433
4500
|
|
|
@@ -4447,6 +4514,9 @@ function merge(services, extensions) {
|
|
|
4447
4514
|
if (ext.stepComponentViewWrapper) {
|
|
4448
4515
|
services.stepComponentViewWrapper = ext.stepComponentViewWrapper;
|
|
4449
4516
|
}
|
|
4517
|
+
if (ext.clickBehaviorWrapperExtension) {
|
|
4518
|
+
services.clickBehaviorWrapperExtension = ext.clickBehaviorWrapperExtension;
|
|
4519
|
+
}
|
|
4450
4520
|
if (ext.badges) {
|
|
4451
4521
|
services.badges = (services.badges || []).concat(ext.badges);
|
|
4452
4522
|
}
|
|
@@ -4498,6 +4568,9 @@ function setDefaults(services, configuration) {
|
|
|
4498
4568
|
if (!services.stepComponentViewWrapper) {
|
|
4499
4569
|
services.stepComponentViewWrapper = new DefaultStepComponentViewWrapperExtension();
|
|
4500
4570
|
}
|
|
4571
|
+
if (!services.clickBehaviorWrapperExtension) {
|
|
4572
|
+
services.clickBehaviorWrapperExtension = new DefaultClickBehaviorWrapperExtension();
|
|
4573
|
+
}
|
|
4501
4574
|
if (!services.badges) {
|
|
4502
4575
|
services.badges = [];
|
|
4503
4576
|
}
|
|
@@ -4794,33 +4867,4 @@ class Designer {
|
|
|
4794
4867
|
}
|
|
4795
4868
|
}
|
|
4796
4869
|
|
|
4797
|
-
|
|
4798
|
-
static create(configuration) {
|
|
4799
|
-
const grid = LineGridExtension.create(configuration);
|
|
4800
|
-
return new LineGridDesignerExtension(grid);
|
|
4801
|
-
}
|
|
4802
|
-
constructor(grid) {
|
|
4803
|
-
this.grid = grid;
|
|
4804
|
-
}
|
|
4805
|
-
}
|
|
4806
|
-
|
|
4807
|
-
class StepsDesignerExtension {
|
|
4808
|
-
static create(configuration) {
|
|
4809
|
-
const steps = [];
|
|
4810
|
-
if (configuration.container) {
|
|
4811
|
-
steps.push(ContainerStepExtension.create(configuration.container));
|
|
4812
|
-
}
|
|
4813
|
-
if (configuration.switch) {
|
|
4814
|
-
steps.push(SwitchStepExtension.create(configuration.switch));
|
|
4815
|
-
}
|
|
4816
|
-
if (configuration.task) {
|
|
4817
|
-
steps.push(TaskStepExtension.create(configuration.task));
|
|
4818
|
-
}
|
|
4819
|
-
return new StepsDesignerExtension(steps);
|
|
4820
|
-
}
|
|
4821
|
-
constructor(steps) {
|
|
4822
|
-
this.steps = steps;
|
|
4823
|
-
}
|
|
4824
|
-
}
|
|
4825
|
-
|
|
4826
|
-
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, RectPlaceholder, RectPlaceholderView, ServicesResolver, SimpleEvent, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, ViewportApi, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
|
4870
|
+
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerDesignerExtension, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, RectPlaceholder, RectPlaceholderView, SelectStepBehaviorEndToken, ServicesResolver, SimpleEvent, StartStopRootComponentDesignerExtension, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, TYPE, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, ViewportApi, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|