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/dist/index.umd.js
CHANGED
|
@@ -202,27 +202,17 @@
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
class ControlBarApi {
|
|
205
|
-
static create(state, historyController, stateModifier
|
|
206
|
-
const api = new ControlBarApi(state, historyController, stateModifier
|
|
205
|
+
static create(state, historyController, stateModifier) {
|
|
206
|
+
const api = new ControlBarApi(state, historyController, stateModifier);
|
|
207
207
|
race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.forward);
|
|
208
208
|
return api;
|
|
209
209
|
}
|
|
210
|
-
constructor(state, historyController, stateModifier
|
|
210
|
+
constructor(state, historyController, stateModifier) {
|
|
211
211
|
this.state = state;
|
|
212
212
|
this.historyController = historyController;
|
|
213
213
|
this.stateModifier = stateModifier;
|
|
214
|
-
this.viewportApi = viewportApi;
|
|
215
214
|
this.onStateChanged = new SimpleEvent();
|
|
216
215
|
}
|
|
217
|
-
resetViewport() {
|
|
218
|
-
this.viewportApi.resetViewport();
|
|
219
|
-
}
|
|
220
|
-
zoomIn() {
|
|
221
|
-
this.viewportApi.zoom(true);
|
|
222
|
-
}
|
|
223
|
-
zoomOut() {
|
|
224
|
-
this.viewportApi.zoom(false);
|
|
225
|
-
}
|
|
226
216
|
isDragDisabled() {
|
|
227
217
|
return this.state.isDragDisabled;
|
|
228
218
|
}
|
|
@@ -693,21 +683,20 @@
|
|
|
693
683
|
}
|
|
694
684
|
|
|
695
685
|
class ViewportAnimator {
|
|
696
|
-
constructor(
|
|
697
|
-
this.
|
|
686
|
+
constructor(state) {
|
|
687
|
+
this.state = state;
|
|
698
688
|
}
|
|
699
689
|
execute(target) {
|
|
700
690
|
if (this.animation && this.animation.isAlive) {
|
|
701
691
|
this.animation.stop();
|
|
702
692
|
}
|
|
703
|
-
const
|
|
704
|
-
const
|
|
705
|
-
const startScale = viewport.scale;
|
|
693
|
+
const startPosition = this.state.viewport.position;
|
|
694
|
+
const startScale = this.state.viewport.scale;
|
|
706
695
|
const deltaPosition = startPosition.subtract(target.position);
|
|
707
696
|
const deltaScale = startScale - target.scale;
|
|
708
697
|
this.animation = animate(150, progress => {
|
|
709
698
|
const newScale = startScale - deltaScale * progress;
|
|
710
|
-
this.
|
|
699
|
+
this.state.setViewport({
|
|
711
700
|
position: startPosition.subtract(deltaPosition.multiplyByScalar(progress)),
|
|
712
701
|
scale: newScale
|
|
713
702
|
});
|
|
@@ -740,23 +729,23 @@
|
|
|
740
729
|
}
|
|
741
730
|
|
|
742
731
|
class ViewportApi {
|
|
743
|
-
constructor(workspaceController, viewportController
|
|
732
|
+
constructor(state, workspaceController, viewportController) {
|
|
733
|
+
this.state = state;
|
|
744
734
|
this.workspaceController = workspaceController;
|
|
745
735
|
this.viewportController = viewportController;
|
|
746
|
-
this.
|
|
747
|
-
this.animator = new ViewportAnimator(this.api);
|
|
736
|
+
this.animator = new ViewportAnimator(this.state);
|
|
748
737
|
}
|
|
749
738
|
limitScale(scale) {
|
|
750
739
|
return this.viewportController.limitScale(scale);
|
|
751
740
|
}
|
|
752
741
|
resetViewport() {
|
|
753
742
|
const defaultViewport = this.viewportController.getDefault();
|
|
754
|
-
this.
|
|
743
|
+
this.state.setViewport(defaultViewport);
|
|
755
744
|
}
|
|
756
745
|
zoom(direction) {
|
|
757
746
|
const viewport = this.viewportController.getZoomed(direction);
|
|
758
747
|
if (viewport) {
|
|
759
|
-
this.
|
|
748
|
+
this.state.setViewport(viewport);
|
|
760
749
|
}
|
|
761
750
|
}
|
|
762
751
|
moveViewportToStep(stepId) {
|
|
@@ -769,11 +758,10 @@
|
|
|
769
758
|
this.animator.execute(viewport);
|
|
770
759
|
}
|
|
771
760
|
handleWheelEvent(e) {
|
|
772
|
-
const
|
|
773
|
-
const
|
|
774
|
-
const newViewport = ZoomByWheelCalculator.calculate(this.viewportController, viewport, canvasPosition, e);
|
|
761
|
+
const canvasPosition = this.workspaceController.getCanvasPosition();
|
|
762
|
+
const newViewport = ZoomByWheelCalculator.calculate(this.viewportController, this.state.viewport, canvasPosition, e);
|
|
775
763
|
if (newViewport) {
|
|
776
|
-
this.
|
|
764
|
+
this.state.setViewport(newViewport);
|
|
777
765
|
}
|
|
778
766
|
}
|
|
779
767
|
}
|
|
@@ -783,6 +771,12 @@
|
|
|
783
771
|
this.state = state;
|
|
784
772
|
this.workspaceController = workspaceController;
|
|
785
773
|
}
|
|
774
|
+
getViewport() {
|
|
775
|
+
return this.state.viewport;
|
|
776
|
+
}
|
|
777
|
+
setViewport(viewport) {
|
|
778
|
+
this.state.setViewport(viewport);
|
|
779
|
+
}
|
|
786
780
|
getCanvasPosition() {
|
|
787
781
|
return this.workspaceController.getCanvasPosition();
|
|
788
782
|
}
|
|
@@ -792,12 +786,6 @@
|
|
|
792
786
|
getRootComponentSize() {
|
|
793
787
|
return this.workspaceController.getRootComponentSize();
|
|
794
788
|
}
|
|
795
|
-
getViewport() {
|
|
796
|
-
return this.state.viewport;
|
|
797
|
-
}
|
|
798
|
-
setViewport(viewport) {
|
|
799
|
-
this.state.setViewport(viewport);
|
|
800
|
-
}
|
|
801
789
|
updateRootComponent() {
|
|
802
790
|
this.workspaceController.updateRootComponent();
|
|
803
791
|
}
|
|
@@ -813,9 +801,8 @@
|
|
|
813
801
|
static create(context) {
|
|
814
802
|
const workspace = new WorkspaceApi(context.state, context.workspaceController);
|
|
815
803
|
const viewportController = context.services.viewportController.create(workspace);
|
|
816
|
-
const viewport = new ViewportApi(context.workspaceController, viewportController, workspace);
|
|
817
804
|
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);
|
|
818
|
-
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier
|
|
805
|
+
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);
|
|
819
806
|
}
|
|
820
807
|
constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
821
808
|
this.shadowRoot = shadowRoot;
|
|
@@ -830,36 +817,15 @@
|
|
|
830
817
|
}
|
|
831
818
|
}
|
|
832
819
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
838
|
-
validateStep(step, parentSequence) {
|
|
839
|
-
var _a;
|
|
840
|
-
if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.step) {
|
|
841
|
-
return this.configuration.step(step, parentSequence, this.state.definition);
|
|
842
|
-
}
|
|
843
|
-
return true;
|
|
844
|
-
}
|
|
845
|
-
validateRoot() {
|
|
846
|
-
var _a;
|
|
847
|
-
if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.root) {
|
|
848
|
-
return this.configuration.root(this.state.definition);
|
|
849
|
-
}
|
|
850
|
-
return true;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
class IconProvider {
|
|
855
|
-
constructor(configuration) {
|
|
856
|
-
this.configuration = configuration;
|
|
820
|
+
const TYPE = 'selectStep';
|
|
821
|
+
class SelectStepBehaviorEndToken {
|
|
822
|
+
static is(token) {
|
|
823
|
+
return Boolean(token) && token.type === TYPE;
|
|
857
824
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
return null;
|
|
825
|
+
constructor(stepId, time) {
|
|
826
|
+
this.stepId = stepId;
|
|
827
|
+
this.time = time;
|
|
828
|
+
this.type = TYPE;
|
|
863
829
|
}
|
|
864
830
|
}
|
|
865
831
|
|
|
@@ -924,349 +890,104 @@
|
|
|
924
890
|
return g;
|
|
925
891
|
}
|
|
926
892
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
const badges = Badges.createForStep(stepContext, view, componentContext);
|
|
944
|
-
return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);
|
|
893
|
+
class ValidationErrorBadgeView {
|
|
894
|
+
static create(parent, cfg) {
|
|
895
|
+
const g = Dom.svg('g');
|
|
896
|
+
const halfOfSize = cfg.size / 2;
|
|
897
|
+
const circle = Dom.svg('path', {
|
|
898
|
+
class: 'sqd-validation-error',
|
|
899
|
+
d: `M 0 ${-halfOfSize} l ${halfOfSize} ${cfg.size} l ${-cfg.size} 0 Z`
|
|
900
|
+
});
|
|
901
|
+
Dom.translate(circle, halfOfSize, halfOfSize);
|
|
902
|
+
g.appendChild(circle);
|
|
903
|
+
const icon = Icons.appendPath(g, 'sqd-validation-error-icon-path', Icons.alert, cfg.iconSize);
|
|
904
|
+
const offsetX = (cfg.size - cfg.iconSize) / 2;
|
|
905
|
+
const offsetY = offsetX * 1.5;
|
|
906
|
+
Dom.translate(icon, offsetX, offsetY);
|
|
907
|
+
parent.appendChild(g);
|
|
908
|
+
return new ValidationErrorBadgeView(parent, g, cfg.size, cfg.size);
|
|
945
909
|
}
|
|
946
|
-
constructor(
|
|
947
|
-
this.
|
|
948
|
-
this.
|
|
949
|
-
this.
|
|
950
|
-
this.
|
|
951
|
-
this.badges = badges;
|
|
910
|
+
constructor(parent, g, width, height) {
|
|
911
|
+
this.parent = parent;
|
|
912
|
+
this.g = g;
|
|
913
|
+
this.width = width;
|
|
914
|
+
this.height = height;
|
|
952
915
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
return this;
|
|
956
|
-
}
|
|
957
|
-
if (this.view.sequenceComponents) {
|
|
958
|
-
for (const component of this.view.sequenceComponents) {
|
|
959
|
-
const result = component.findById(stepId);
|
|
960
|
-
if (result) {
|
|
961
|
-
return result;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
return null;
|
|
916
|
+
destroy() {
|
|
917
|
+
this.parent.removeChild(this.g);
|
|
966
918
|
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
class ValidatorFactory {
|
|
922
|
+
static createForStep(stepContext, view, componentContext) {
|
|
923
|
+
return () => {
|
|
924
|
+
if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {
|
|
925
|
+
return false;
|
|
974
926
|
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
component: this
|
|
927
|
+
if (view.haveCollapsedChildren) {
|
|
928
|
+
let allChildrenValid = true;
|
|
929
|
+
componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {
|
|
930
|
+
if (!componentContext.validator.validateStep(step, parentSequence)) {
|
|
931
|
+
allChildrenValid = false;
|
|
932
|
+
return false;
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
if (!allChildrenValid) {
|
|
936
|
+
return false;
|
|
986
937
|
}
|
|
987
|
-
: viewResult;
|
|
988
|
-
}
|
|
989
|
-
return null;
|
|
990
|
-
}
|
|
991
|
-
resolvePlaceholders(skipComponent, result) {
|
|
992
|
-
if (skipComponent !== this) {
|
|
993
|
-
if (this.view.sequenceComponents) {
|
|
994
|
-
this.view.sequenceComponents.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
995
938
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
}
|
|
999
|
-
result.components.push(this);
|
|
1000
|
-
}
|
|
939
|
+
return true;
|
|
940
|
+
};
|
|
1001
941
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
942
|
+
static createForRoot(componentContext) {
|
|
943
|
+
return () => {
|
|
944
|
+
return componentContext.validator.validateRoot();
|
|
945
|
+
};
|
|
1004
946
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
class ValidationErrorBadge {
|
|
950
|
+
static createForStep(parentElement, view, stepContext, componentContext, configuration) {
|
|
951
|
+
const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);
|
|
952
|
+
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1007
953
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
954
|
+
static createForRoot(parentElement, componentContext, configuration) {
|
|
955
|
+
const validator = ValidatorFactory.createForRoot(componentContext);
|
|
956
|
+
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1010
957
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
958
|
+
constructor(parentElement, validator, configuration) {
|
|
959
|
+
this.parentElement = parentElement;
|
|
960
|
+
this.validator = validator;
|
|
961
|
+
this.configuration = configuration;
|
|
962
|
+
this.view = null;
|
|
963
|
+
}
|
|
964
|
+
update(result) {
|
|
965
|
+
const isValid = this.validator();
|
|
966
|
+
if (isValid) {
|
|
967
|
+
if (this.view) {
|
|
968
|
+
this.view.destroy();
|
|
969
|
+
this.view = null;
|
|
970
|
+
}
|
|
1014
971
|
}
|
|
1015
|
-
this.
|
|
972
|
+
else if (!this.view) {
|
|
973
|
+
this.view = ValidationErrorBadgeView.create(this.parentElement, this.configuration);
|
|
974
|
+
}
|
|
975
|
+
return isValid && result;
|
|
1016
976
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
class StepComponentViewContextFactory {
|
|
1020
|
-
static create(stepContext, componentContext) {
|
|
1021
|
-
const preferenceKeyPrefix = stepContext.step.id + ':';
|
|
1022
|
-
return {
|
|
1023
|
-
i18n: componentContext.i18n,
|
|
1024
|
-
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
1025
|
-
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
1026
|
-
createSequenceComponent: (parentElement, sequence) => {
|
|
1027
|
-
const sequenceContext = {
|
|
1028
|
-
sequence,
|
|
1029
|
-
depth: stepContext.depth + 1,
|
|
1030
|
-
isInputConnected: true,
|
|
1031
|
-
isOutputConnected: stepContext.isOutputConnected,
|
|
1032
|
-
isPreview: stepContext.isPreview
|
|
1033
|
-
};
|
|
1034
|
-
return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
|
|
1035
|
-
},
|
|
1036
|
-
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
1037
|
-
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
1038
|
-
},
|
|
1039
|
-
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
1040
|
-
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
1041
|
-
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
1042
|
-
};
|
|
977
|
+
resolveClick() {
|
|
978
|
+
return null;
|
|
1043
979
|
}
|
|
1044
980
|
}
|
|
1045
981
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
982
|
+
const defaultConfiguration$7 = {
|
|
983
|
+
view: {
|
|
984
|
+
size: 22,
|
|
985
|
+
iconSize: 12
|
|
1049
986
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
const wrappedView = componentContext.services.stepComponentViewWrapper.wrap(view, stepContext);
|
|
1055
|
-
return StepComponent.create(wrappedView, stepContext, componentContext);
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
class ComponentContext {
|
|
1060
|
-
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
|
|
1061
|
-
const validator = new DefinitionValidator(configuration.validator, state);
|
|
1062
|
-
const iconProvider = new IconProvider(configuration.steps);
|
|
1063
|
-
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
1064
|
-
return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
|
|
1065
|
-
}
|
|
1066
|
-
constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
|
|
1067
|
-
this.shadowRoot = shadowRoot;
|
|
1068
|
-
this.validator = validator;
|
|
1069
|
-
this.iconProvider = iconProvider;
|
|
1070
|
-
this.placeholderController = placeholderController;
|
|
1071
|
-
this.stepComponentFactory = stepComponentFactory;
|
|
1072
|
-
this.definitionWalker = definitionWalker;
|
|
1073
|
-
this.services = services;
|
|
1074
|
-
this.preferenceStorage = preferenceStorage;
|
|
1075
|
-
this.i18n = i18n;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
class CustomActionController {
|
|
1080
|
-
constructor(configuration, state, stateModifier) {
|
|
1081
|
-
this.configuration = configuration;
|
|
1082
|
-
this.state = state;
|
|
1083
|
-
this.stateModifier = stateModifier;
|
|
1084
|
-
}
|
|
1085
|
-
trigger(action, step, sequence) {
|
|
1086
|
-
const handler = this.configuration.customActionHandler;
|
|
1087
|
-
if (!handler) {
|
|
1088
|
-
console.warn(`Custom action handler is not defined (action type: ${action.type})`);
|
|
1089
|
-
return;
|
|
1090
|
-
}
|
|
1091
|
-
const context = this.createCustomActionHandlerContext();
|
|
1092
|
-
handler(action, step, sequence, context);
|
|
1093
|
-
}
|
|
1094
|
-
createCustomActionHandlerContext() {
|
|
1095
|
-
return {
|
|
1096
|
-
notifyStepNameChanged: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepNameChanged, stepId, false),
|
|
1097
|
-
notifyStepPropertiesChanged: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepPropertyChanged, stepId, false),
|
|
1098
|
-
notifyStepInserted: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepInserted, stepId, true),
|
|
1099
|
-
notifyStepMoved: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepMoved, stepId, true),
|
|
1100
|
-
notifyStepDeleted: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepDeleted, stepId, true)
|
|
1101
|
-
};
|
|
1102
|
-
}
|
|
1103
|
-
notifyStepChanged(changeType, stepId, updateDependencies) {
|
|
1104
|
-
if (!stepId) {
|
|
1105
|
-
throw new Error('Step id is empty');
|
|
1106
|
-
}
|
|
1107
|
-
this.state.notifyDefinitionChanged(changeType, stepId);
|
|
1108
|
-
if (updateDependencies) {
|
|
1109
|
-
this.stateModifier.updateDependencies();
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
class EditorView {
|
|
1115
|
-
static create(parent) {
|
|
1116
|
-
return new EditorView(parent);
|
|
1117
|
-
}
|
|
1118
|
-
constructor(parent) {
|
|
1119
|
-
this.parent = parent;
|
|
1120
|
-
this.currentContainer = null;
|
|
1121
|
-
}
|
|
1122
|
-
setContent(content, className) {
|
|
1123
|
-
const container = Dom.element('div', {
|
|
1124
|
-
class: className
|
|
1125
|
-
});
|
|
1126
|
-
container.appendChild(content);
|
|
1127
|
-
if (this.currentContainer) {
|
|
1128
|
-
this.parent.removeChild(this.currentContainer);
|
|
1129
|
-
}
|
|
1130
|
-
this.parent.appendChild(container);
|
|
1131
|
-
this.currentContainer = container;
|
|
1132
|
-
}
|
|
1133
|
-
destroy() {
|
|
1134
|
-
if (this.currentContainer) {
|
|
1135
|
-
this.parent.removeChild(this.currentContainer);
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
class Editor {
|
|
1141
|
-
static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider, customSelectedStepIdProvider) {
|
|
1142
|
-
const view = EditorView.create(parent);
|
|
1143
|
-
function render(step) {
|
|
1144
|
-
const definition = api.getDefinition();
|
|
1145
|
-
let content;
|
|
1146
|
-
let className;
|
|
1147
|
-
if (step) {
|
|
1148
|
-
const stepContext = api.createStepEditorContext(step.id);
|
|
1149
|
-
content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
|
|
1150
|
-
className = stepEditorClassName;
|
|
1151
|
-
}
|
|
1152
|
-
else {
|
|
1153
|
-
const rootContext = api.createRootEditorContext();
|
|
1154
|
-
content = rootEditorProvider(definition, rootContext, api.isReadonly());
|
|
1155
|
-
className = rootEditorClassName;
|
|
1156
|
-
}
|
|
1157
|
-
view.setContent(content, className);
|
|
1158
|
-
}
|
|
1159
|
-
const renderer = api.runRenderer(step => render(step), customSelectedStepIdProvider);
|
|
1160
|
-
return new Editor(view, renderer);
|
|
1161
|
-
}
|
|
1162
|
-
constructor(view, renderer) {
|
|
1163
|
-
this.view = view;
|
|
1164
|
-
this.renderer = renderer;
|
|
1165
|
-
}
|
|
1166
|
-
destroy() {
|
|
1167
|
-
this.view.destroy();
|
|
1168
|
-
this.renderer.destroy();
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
class ValidationErrorBadgeView {
|
|
1173
|
-
static create(parent, cfg) {
|
|
1174
|
-
const g = Dom.svg('g');
|
|
1175
|
-
const halfOfSize = cfg.size / 2;
|
|
1176
|
-
const circle = Dom.svg('path', {
|
|
1177
|
-
class: 'sqd-validation-error',
|
|
1178
|
-
d: `M 0 ${-halfOfSize} l ${halfOfSize} ${cfg.size} l ${-cfg.size} 0 Z`
|
|
1179
|
-
});
|
|
1180
|
-
Dom.translate(circle, halfOfSize, halfOfSize);
|
|
1181
|
-
g.appendChild(circle);
|
|
1182
|
-
const icon = Icons.appendPath(g, 'sqd-validation-error-icon-path', Icons.alert, cfg.iconSize);
|
|
1183
|
-
const offsetX = (cfg.size - cfg.iconSize) / 2;
|
|
1184
|
-
const offsetY = offsetX * 1.5;
|
|
1185
|
-
Dom.translate(icon, offsetX, offsetY);
|
|
1186
|
-
parent.appendChild(g);
|
|
1187
|
-
return new ValidationErrorBadgeView(parent, g, cfg.size, cfg.size);
|
|
1188
|
-
}
|
|
1189
|
-
constructor(parent, g, width, height) {
|
|
1190
|
-
this.parent = parent;
|
|
1191
|
-
this.g = g;
|
|
1192
|
-
this.width = width;
|
|
1193
|
-
this.height = height;
|
|
1194
|
-
}
|
|
1195
|
-
destroy() {
|
|
1196
|
-
this.parent.removeChild(this.g);
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
class ValidatorFactory {
|
|
1201
|
-
static createForStep(stepContext, view, componentContext) {
|
|
1202
|
-
return () => {
|
|
1203
|
-
if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {
|
|
1204
|
-
return false;
|
|
1205
|
-
}
|
|
1206
|
-
if (view.haveCollapsedChildren) {
|
|
1207
|
-
let allChildrenValid = true;
|
|
1208
|
-
componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {
|
|
1209
|
-
if (!componentContext.validator.validateStep(step, parentSequence)) {
|
|
1210
|
-
allChildrenValid = false;
|
|
1211
|
-
return false;
|
|
1212
|
-
}
|
|
1213
|
-
});
|
|
1214
|
-
if (!allChildrenValid) {
|
|
1215
|
-
return false;
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
return true;
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
|
-
static createForRoot(componentContext) {
|
|
1222
|
-
return () => {
|
|
1223
|
-
return componentContext.validator.validateRoot();
|
|
1224
|
-
};
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
class ValidationErrorBadge {
|
|
1229
|
-
static createForStep(parentElement, view, stepContext, componentContext, configuration) {
|
|
1230
|
-
const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);
|
|
1231
|
-
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1232
|
-
}
|
|
1233
|
-
static createForRoot(parentElement, componentContext, configuration) {
|
|
1234
|
-
const validator = ValidatorFactory.createForRoot(componentContext);
|
|
1235
|
-
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1236
|
-
}
|
|
1237
|
-
constructor(parentElement, validator, configuration) {
|
|
1238
|
-
this.parentElement = parentElement;
|
|
1239
|
-
this.validator = validator;
|
|
1240
|
-
this.configuration = configuration;
|
|
1241
|
-
this.view = null;
|
|
1242
|
-
}
|
|
1243
|
-
update(result) {
|
|
1244
|
-
const isValid = this.validator();
|
|
1245
|
-
if (isValid) {
|
|
1246
|
-
if (this.view) {
|
|
1247
|
-
this.view.destroy();
|
|
1248
|
-
this.view = null;
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
else if (!this.view) {
|
|
1252
|
-
this.view = ValidationErrorBadgeView.create(this.parentElement, this.configuration);
|
|
1253
|
-
}
|
|
1254
|
-
return isValid && result;
|
|
1255
|
-
}
|
|
1256
|
-
resolveClick() {
|
|
1257
|
-
return null;
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
const defaultConfiguration$7 = {
|
|
1262
|
-
view: {
|
|
1263
|
-
size: 22,
|
|
1264
|
-
iconSize: 12
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
class ValidationErrorBadgeExtension {
|
|
1268
|
-
static create(configuration) {
|
|
1269
|
-
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$7);
|
|
987
|
+
};
|
|
988
|
+
class ValidationErrorBadgeExtension {
|
|
989
|
+
static create(configuration) {
|
|
990
|
+
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$7);
|
|
1270
991
|
}
|
|
1271
992
|
constructor(configuration) {
|
|
1272
993
|
this.configuration = configuration;
|
|
@@ -1566,6 +1287,20 @@
|
|
|
1566
1287
|
}
|
|
1567
1288
|
}
|
|
1568
1289
|
|
|
1290
|
+
exports.ClickCommandType = void 0;
|
|
1291
|
+
(function (ClickCommandType) {
|
|
1292
|
+
ClickCommandType[ClickCommandType["selectStep"] = 1] = "selectStep";
|
|
1293
|
+
ClickCommandType[ClickCommandType["rerenderStep"] = 2] = "rerenderStep";
|
|
1294
|
+
ClickCommandType[ClickCommandType["openFolder"] = 3] = "openFolder";
|
|
1295
|
+
ClickCommandType[ClickCommandType["triggerCustomAction"] = 4] = "triggerCustomAction";
|
|
1296
|
+
})(exports.ClickCommandType || (exports.ClickCommandType = {}));
|
|
1297
|
+
exports.PlaceholderDirection = void 0;
|
|
1298
|
+
(function (PlaceholderDirection) {
|
|
1299
|
+
PlaceholderDirection[PlaceholderDirection["none"] = 0] = "none";
|
|
1300
|
+
PlaceholderDirection[PlaceholderDirection["in"] = 1] = "in";
|
|
1301
|
+
PlaceholderDirection[PlaceholderDirection["out"] = 2] = "out";
|
|
1302
|
+
})(exports.PlaceholderDirection || (exports.PlaceholderDirection = {}));
|
|
1303
|
+
|
|
1569
1304
|
class StartStopRootComponentView {
|
|
1570
1305
|
static create(parent, sequence, parentPlaceIndicator, context, cfg) {
|
|
1571
1306
|
const g = Dom.svg('g', {
|
|
@@ -2044,28 +1779,106 @@
|
|
|
2044
1779
|
}
|
|
2045
1780
|
}
|
|
2046
1781
|
|
|
2047
|
-
class
|
|
2048
|
-
static create(
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2051
|
-
const extension = services.steps[i];
|
|
2052
|
-
dict[extension.componentType] = extension;
|
|
2053
|
-
}
|
|
2054
|
-
return new StepExtensionResolver(dict);
|
|
1782
|
+
class StepComponent {
|
|
1783
|
+
static create(view, stepContext, componentContext) {
|
|
1784
|
+
const badges = Badges.createForStep(stepContext, view, componentContext);
|
|
1785
|
+
return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);
|
|
2055
1786
|
}
|
|
2056
|
-
constructor(
|
|
2057
|
-
this.
|
|
1787
|
+
constructor(view, step, parentSequence, hasOutput, badges) {
|
|
1788
|
+
this.view = view;
|
|
1789
|
+
this.step = step;
|
|
1790
|
+
this.parentSequence = parentSequence;
|
|
1791
|
+
this.hasOutput = hasOutput;
|
|
1792
|
+
this.badges = badges;
|
|
2058
1793
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
throw new Error(`Not supported component type: ${componentType}`);
|
|
1794
|
+
findById(stepId) {
|
|
1795
|
+
if (this.step.id === stepId) {
|
|
1796
|
+
return this;
|
|
2063
1797
|
}
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
1798
|
+
if (this.view.sequenceComponents) {
|
|
1799
|
+
for (const component of this.view.sequenceComponents) {
|
|
1800
|
+
const result = component.findById(stepId);
|
|
1801
|
+
if (result) {
|
|
1802
|
+
return result;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return null;
|
|
1807
|
+
}
|
|
1808
|
+
resolveClick(click) {
|
|
1809
|
+
if (this.view.sequenceComponents) {
|
|
1810
|
+
for (const component of this.view.sequenceComponents) {
|
|
1811
|
+
const result = component.resolveClick(click);
|
|
1812
|
+
if (result) {
|
|
1813
|
+
return result;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
const badgeResult = this.badges.resolveClick(click);
|
|
1818
|
+
if (badgeResult) {
|
|
1819
|
+
return badgeResult;
|
|
1820
|
+
}
|
|
1821
|
+
const viewResult = this.view.resolveClick(click);
|
|
1822
|
+
if (viewResult) {
|
|
1823
|
+
return viewResult === true
|
|
1824
|
+
? {
|
|
1825
|
+
type: exports.ClickCommandType.selectStep,
|
|
1826
|
+
component: this
|
|
1827
|
+
}
|
|
1828
|
+
: viewResult;
|
|
1829
|
+
}
|
|
1830
|
+
return null;
|
|
1831
|
+
}
|
|
1832
|
+
resolvePlaceholders(skipComponent, result) {
|
|
1833
|
+
if (skipComponent !== this) {
|
|
1834
|
+
if (this.view.sequenceComponents) {
|
|
1835
|
+
this.view.sequenceComponents.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
1836
|
+
}
|
|
1837
|
+
if (this.view.placeholders) {
|
|
1838
|
+
this.view.placeholders.forEach(ph => result.placeholders.push(ph));
|
|
1839
|
+
}
|
|
1840
|
+
result.components.push(this);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
setIsDragging(isDragging) {
|
|
1844
|
+
this.view.setIsDragging(isDragging);
|
|
1845
|
+
}
|
|
1846
|
+
setIsSelected(isSelected) {
|
|
1847
|
+
this.view.setIsSelected(isSelected);
|
|
1848
|
+
}
|
|
1849
|
+
setIsDisabled(isDisabled) {
|
|
1850
|
+
this.view.setIsDisabled(isDisabled);
|
|
1851
|
+
}
|
|
1852
|
+
updateBadges(result) {
|
|
1853
|
+
if (this.view.sequenceComponents) {
|
|
1854
|
+
this.view.sequenceComponents.forEach(component => component.updateBadges(result));
|
|
1855
|
+
}
|
|
1856
|
+
this.badges.update(result);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
class StepExtensionResolver {
|
|
1861
|
+
static create(services) {
|
|
1862
|
+
const dict = {};
|
|
1863
|
+
for (let i = services.steps.length - 1; i >= 0; i--) {
|
|
1864
|
+
const extension = services.steps[i];
|
|
1865
|
+
dict[extension.componentType] = extension;
|
|
1866
|
+
}
|
|
1867
|
+
return new StepExtensionResolver(dict);
|
|
1868
|
+
}
|
|
1869
|
+
constructor(dict) {
|
|
1870
|
+
this.dict = dict;
|
|
1871
|
+
}
|
|
1872
|
+
resolve(componentType) {
|
|
1873
|
+
const extension = this.dict[componentType];
|
|
1874
|
+
if (!extension) {
|
|
1875
|
+
throw new Error(`Not supported component type: ${componentType}`);
|
|
1876
|
+
}
|
|
1877
|
+
return extension;
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
class RectPlaceholderView {
|
|
2069
1882
|
static create(parent, width, height, radius, iconSize, direction) {
|
|
2070
1883
|
const g = Dom.svg('g', {
|
|
2071
1884
|
visibility: 'hidden',
|
|
@@ -2124,63 +1937,414 @@
|
|
|
2124
1937
|
resolveClick() {
|
|
2125
1938
|
return null;
|
|
2126
1939
|
}
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
class DefaultRegionView {
|
|
2130
|
-
static create(parent, widths, height) {
|
|
2131
|
-
const totalWidth = widths.reduce((result, width) => result + width, 0);
|
|
2132
|
-
const lines = [
|
|
2133
|
-
drawLine(parent, 0, 0, totalWidth, 0),
|
|
2134
|
-
drawLine(parent, 0, 0, 0, height),
|
|
2135
|
-
drawLine(parent, 0, height, totalWidth, height),
|
|
2136
|
-
drawLine(parent, totalWidth, 0, totalWidth, height)
|
|
2137
|
-
];
|
|
2138
|
-
let offsetX = widths[0];
|
|
2139
|
-
for (let i = 1; i < widths.length; i++) {
|
|
2140
|
-
lines.push(drawLine(parent, offsetX, 0, offsetX, height));
|
|
2141
|
-
offsetX += widths[i];
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
class DefaultRegionView {
|
|
1943
|
+
static create(parent, widths, height) {
|
|
1944
|
+
const totalWidth = widths.reduce((result, width) => result + width, 0);
|
|
1945
|
+
const lines = [
|
|
1946
|
+
drawLine(parent, 0, 0, totalWidth, 0),
|
|
1947
|
+
drawLine(parent, 0, 0, 0, height),
|
|
1948
|
+
drawLine(parent, 0, height, totalWidth, height),
|
|
1949
|
+
drawLine(parent, totalWidth, 0, totalWidth, height)
|
|
1950
|
+
];
|
|
1951
|
+
let offsetX = widths[0];
|
|
1952
|
+
for (let i = 1; i < widths.length; i++) {
|
|
1953
|
+
lines.push(drawLine(parent, offsetX, 0, offsetX, height));
|
|
1954
|
+
offsetX += widths[i];
|
|
1955
|
+
}
|
|
1956
|
+
return new DefaultRegionView(lines, totalWidth, height);
|
|
1957
|
+
}
|
|
1958
|
+
constructor(lines, width, height) {
|
|
1959
|
+
this.lines = lines;
|
|
1960
|
+
this.width = width;
|
|
1961
|
+
this.height = height;
|
|
1962
|
+
}
|
|
1963
|
+
getClientPosition() {
|
|
1964
|
+
return getAbsolutePosition(this.lines[0]);
|
|
1965
|
+
}
|
|
1966
|
+
resolveClick(click) {
|
|
1967
|
+
const regionPosition = this.getClientPosition();
|
|
1968
|
+
const d = click.position.subtract(regionPosition);
|
|
1969
|
+
if (d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale) {
|
|
1970
|
+
return true;
|
|
1971
|
+
}
|
|
1972
|
+
return null;
|
|
1973
|
+
}
|
|
1974
|
+
setIsSelected(isSelected) {
|
|
1975
|
+
this.lines.forEach(region => {
|
|
1976
|
+
Dom.toggleClass(region, isSelected, 'sqd-selected');
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
function drawLine(parent, x1, y1, x2, y2) {
|
|
1981
|
+
const line = Dom.svg('line', {
|
|
1982
|
+
class: 'sqd-region',
|
|
1983
|
+
x1,
|
|
1984
|
+
y1,
|
|
1985
|
+
x2,
|
|
1986
|
+
y2
|
|
1987
|
+
});
|
|
1988
|
+
parent.insertBefore(line, parent.firstChild);
|
|
1989
|
+
return line;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
class DefaultRegionComponentViewExtension {
|
|
1993
|
+
create(parentElement, componentClassName, stepContext, _, contentFactory) {
|
|
1994
|
+
const g = ComponentDom.stepG(componentClassName, stepContext.step.type, stepContext.step.id);
|
|
1995
|
+
parentElement.appendChild(g);
|
|
1996
|
+
return contentFactory(g, DefaultRegionView.create);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
class DefaultViewportControllerDesignerExtension {
|
|
2001
|
+
static create(configuration) {
|
|
2002
|
+
return new DefaultViewportControllerDesignerExtension(DefaultViewportControllerExtension.create(configuration));
|
|
2003
|
+
}
|
|
2004
|
+
constructor(viewportController) {
|
|
2005
|
+
this.viewportController = viewportController;
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
class LineGrid {
|
|
2010
|
+
static create(size) {
|
|
2011
|
+
const path = Dom.svg('path', {
|
|
2012
|
+
class: 'sqd-line-grid-path',
|
|
2013
|
+
fill: 'none'
|
|
2014
|
+
});
|
|
2015
|
+
return new LineGrid(size, path);
|
|
2016
|
+
}
|
|
2017
|
+
constructor(size, element) {
|
|
2018
|
+
this.size = size;
|
|
2019
|
+
this.element = element;
|
|
2020
|
+
}
|
|
2021
|
+
setScale(_, scaledSize) {
|
|
2022
|
+
Dom.attrs(this.element, {
|
|
2023
|
+
d: `M ${scaledSize.x} 0 L 0 0 0 ${scaledSize.y}`
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
const defaultConfiguration$4 = {
|
|
2029
|
+
gridSizeX: 48,
|
|
2030
|
+
gridSizeY: 48
|
|
2031
|
+
};
|
|
2032
|
+
class LineGridExtension {
|
|
2033
|
+
static create(configuration) {
|
|
2034
|
+
return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4);
|
|
2035
|
+
}
|
|
2036
|
+
constructor(configuration) {
|
|
2037
|
+
this.configuration = configuration;
|
|
2038
|
+
}
|
|
2039
|
+
create() {
|
|
2040
|
+
const size = new Vector(this.configuration.gridSizeX, this.configuration.gridSizeY);
|
|
2041
|
+
return LineGrid.create(size);
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
class LineGridDesignerExtension {
|
|
2046
|
+
static create(configuration) {
|
|
2047
|
+
const grid = LineGridExtension.create(configuration);
|
|
2048
|
+
return new LineGridDesignerExtension(grid);
|
|
2049
|
+
}
|
|
2050
|
+
constructor(grid) {
|
|
2051
|
+
this.grid = grid;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
class StartStopRootComponentDesignerExtension {
|
|
2056
|
+
static create(configuration) {
|
|
2057
|
+
return new StartStopRootComponentDesignerExtension(StartStopRootComponentExtension.create(configuration));
|
|
2058
|
+
}
|
|
2059
|
+
constructor(rootComponent) {
|
|
2060
|
+
this.rootComponent = rootComponent;
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
const defaultConfiguration$3 = {
|
|
2065
|
+
view: {
|
|
2066
|
+
paddingTop: 20,
|
|
2067
|
+
paddingX: 20,
|
|
2068
|
+
inputSize: 18,
|
|
2069
|
+
inputIconSize: 14,
|
|
2070
|
+
label: {
|
|
2071
|
+
height: 22,
|
|
2072
|
+
paddingX: 10,
|
|
2073
|
+
minWidth: 50,
|
|
2074
|
+
radius: 10
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
};
|
|
2078
|
+
class ContainerStepExtension {
|
|
2079
|
+
static create(configuration) {
|
|
2080
|
+
return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$3);
|
|
2081
|
+
}
|
|
2082
|
+
constructor(configuration) {
|
|
2083
|
+
this.configuration = configuration;
|
|
2084
|
+
this.componentType = 'container';
|
|
2085
|
+
this.createComponentView = createContainerStepComponentViewFactory(this.configuration.view);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
const defaultConfiguration$2 = {
|
|
2090
|
+
view: {
|
|
2091
|
+
minContainerWidth: 40,
|
|
2092
|
+
paddingX: 20,
|
|
2093
|
+
paddingTop: 20,
|
|
2094
|
+
connectionHeight: 16,
|
|
2095
|
+
inputSize: 18,
|
|
2096
|
+
inputIconSize: 14,
|
|
2097
|
+
branchNameLabel: {
|
|
2098
|
+
height: 22,
|
|
2099
|
+
paddingX: 10,
|
|
2100
|
+
minWidth: 50,
|
|
2101
|
+
radius: 10
|
|
2102
|
+
},
|
|
2103
|
+
nameLabel: {
|
|
2104
|
+
height: 22,
|
|
2105
|
+
paddingX: 10,
|
|
2106
|
+
minWidth: 50,
|
|
2107
|
+
radius: 10
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
};
|
|
2111
|
+
class SwitchStepExtension {
|
|
2112
|
+
static create(configuration) {
|
|
2113
|
+
return new SwitchStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);
|
|
2114
|
+
}
|
|
2115
|
+
constructor(configuration) {
|
|
2116
|
+
this.configuration = configuration;
|
|
2117
|
+
this.componentType = 'switch';
|
|
2118
|
+
this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
const defaultConfiguration$1 = {
|
|
2123
|
+
view: {
|
|
2124
|
+
paddingLeft: 12,
|
|
2125
|
+
paddingRight: 12,
|
|
2126
|
+
paddingY: 10,
|
|
2127
|
+
textMarginLeft: 12,
|
|
2128
|
+
minTextWidth: 70,
|
|
2129
|
+
iconSize: 22,
|
|
2130
|
+
radius: 5,
|
|
2131
|
+
inputSize: 14,
|
|
2132
|
+
outputSize: 10
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2135
|
+
class TaskStepExtension {
|
|
2136
|
+
static create(configuration) {
|
|
2137
|
+
return new TaskStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$1);
|
|
2138
|
+
}
|
|
2139
|
+
constructor(configuration) {
|
|
2140
|
+
this.configuration = configuration;
|
|
2141
|
+
this.componentType = 'task';
|
|
2142
|
+
this.createComponentView = createTaskStepComponentViewFactory(false, this.configuration.view);
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
class StepsDesignerExtension {
|
|
2147
|
+
static create(configuration) {
|
|
2148
|
+
const steps = [];
|
|
2149
|
+
if (configuration.container) {
|
|
2150
|
+
steps.push(ContainerStepExtension.create(configuration.container));
|
|
2151
|
+
}
|
|
2152
|
+
if (configuration.switch) {
|
|
2153
|
+
steps.push(SwitchStepExtension.create(configuration.switch));
|
|
2154
|
+
}
|
|
2155
|
+
if (configuration.task) {
|
|
2156
|
+
steps.push(TaskStepExtension.create(configuration.task));
|
|
2157
|
+
}
|
|
2158
|
+
return new StepsDesignerExtension(steps);
|
|
2159
|
+
}
|
|
2160
|
+
constructor(steps) {
|
|
2161
|
+
this.steps = steps;
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
class DefinitionValidator {
|
|
2166
|
+
constructor(configuration, state) {
|
|
2167
|
+
this.configuration = configuration;
|
|
2168
|
+
this.state = state;
|
|
2169
|
+
}
|
|
2170
|
+
validateStep(step, parentSequence) {
|
|
2171
|
+
var _a;
|
|
2172
|
+
if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.step) {
|
|
2173
|
+
return this.configuration.step(step, parentSequence, this.state.definition);
|
|
2174
|
+
}
|
|
2175
|
+
return true;
|
|
2176
|
+
}
|
|
2177
|
+
validateRoot() {
|
|
2178
|
+
var _a;
|
|
2179
|
+
if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.root) {
|
|
2180
|
+
return this.configuration.root(this.state.definition);
|
|
2181
|
+
}
|
|
2182
|
+
return true;
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
class IconProvider {
|
|
2187
|
+
constructor(configuration) {
|
|
2188
|
+
this.configuration = configuration;
|
|
2189
|
+
}
|
|
2190
|
+
getIconUrl(step) {
|
|
2191
|
+
if (this.configuration.iconUrlProvider) {
|
|
2192
|
+
return this.configuration.iconUrlProvider(step.componentType, step.type);
|
|
2193
|
+
}
|
|
2194
|
+
return null;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
class StepComponentViewContextFactory {
|
|
2199
|
+
static create(stepContext, componentContext) {
|
|
2200
|
+
const preferenceKeyPrefix = stepContext.step.id + ':';
|
|
2201
|
+
return {
|
|
2202
|
+
i18n: componentContext.i18n,
|
|
2203
|
+
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
2204
|
+
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
2205
|
+
createSequenceComponent: (parentElement, sequence) => {
|
|
2206
|
+
const sequenceContext = {
|
|
2207
|
+
sequence,
|
|
2208
|
+
depth: stepContext.depth + 1,
|
|
2209
|
+
isInputConnected: true,
|
|
2210
|
+
isOutputConnected: stepContext.isOutputConnected,
|
|
2211
|
+
isPreview: stepContext.isPreview
|
|
2212
|
+
};
|
|
2213
|
+
return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
|
|
2214
|
+
},
|
|
2215
|
+
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
2216
|
+
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
2217
|
+
},
|
|
2218
|
+
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
2219
|
+
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
2220
|
+
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
2221
|
+
};
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
class StepComponentFactory {
|
|
2226
|
+
constructor(stepExtensionResolver) {
|
|
2227
|
+
this.stepExtensionResolver = stepExtensionResolver;
|
|
2228
|
+
}
|
|
2229
|
+
create(parentElement, stepContext, componentContext) {
|
|
2230
|
+
const viewContext = StepComponentViewContextFactory.create(stepContext, componentContext);
|
|
2231
|
+
const extension = this.stepExtensionResolver.resolve(stepContext.step.componentType);
|
|
2232
|
+
const view = extension.createComponentView(parentElement, stepContext, viewContext);
|
|
2233
|
+
const wrappedView = componentContext.services.stepComponentViewWrapper.wrap(view, stepContext);
|
|
2234
|
+
return StepComponent.create(wrappedView, stepContext, componentContext);
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
class ComponentContext {
|
|
2239
|
+
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
|
|
2240
|
+
const validator = new DefinitionValidator(configuration.validator, state);
|
|
2241
|
+
const iconProvider = new IconProvider(configuration.steps);
|
|
2242
|
+
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
2243
|
+
return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
|
|
2244
|
+
}
|
|
2245
|
+
constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
|
|
2246
|
+
this.shadowRoot = shadowRoot;
|
|
2247
|
+
this.validator = validator;
|
|
2248
|
+
this.iconProvider = iconProvider;
|
|
2249
|
+
this.placeholderController = placeholderController;
|
|
2250
|
+
this.stepComponentFactory = stepComponentFactory;
|
|
2251
|
+
this.definitionWalker = definitionWalker;
|
|
2252
|
+
this.services = services;
|
|
2253
|
+
this.preferenceStorage = preferenceStorage;
|
|
2254
|
+
this.i18n = i18n;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
class CustomActionController {
|
|
2259
|
+
constructor(configuration, state, stateModifier) {
|
|
2260
|
+
this.configuration = configuration;
|
|
2261
|
+
this.state = state;
|
|
2262
|
+
this.stateModifier = stateModifier;
|
|
2263
|
+
}
|
|
2264
|
+
trigger(action, step, sequence) {
|
|
2265
|
+
const handler = this.configuration.customActionHandler;
|
|
2266
|
+
if (!handler) {
|
|
2267
|
+
console.warn(`Custom action handler is not defined (action type: ${action.type})`);
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
const context = this.createCustomActionHandlerContext();
|
|
2271
|
+
handler(action, step, sequence, context);
|
|
2272
|
+
}
|
|
2273
|
+
createCustomActionHandlerContext() {
|
|
2274
|
+
return {
|
|
2275
|
+
notifyStepNameChanged: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepNameChanged, stepId, false),
|
|
2276
|
+
notifyStepPropertiesChanged: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepPropertyChanged, stepId, false),
|
|
2277
|
+
notifyStepInserted: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepInserted, stepId, true),
|
|
2278
|
+
notifyStepMoved: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepMoved, stepId, true),
|
|
2279
|
+
notifyStepDeleted: (stepId) => this.notifyStepChanged(exports.DefinitionChangeType.stepDeleted, stepId, true)
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
notifyStepChanged(changeType, stepId, updateDependencies) {
|
|
2283
|
+
if (!stepId) {
|
|
2284
|
+
throw new Error('Step id is empty');
|
|
2285
|
+
}
|
|
2286
|
+
this.state.notifyDefinitionChanged(changeType, stepId);
|
|
2287
|
+
if (updateDependencies) {
|
|
2288
|
+
this.stateModifier.updateDependencies();
|
|
2142
2289
|
}
|
|
2143
|
-
return new DefaultRegionView(lines, totalWidth, height);
|
|
2144
2290
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
class EditorView {
|
|
2294
|
+
static create(parent) {
|
|
2295
|
+
return new EditorView(parent);
|
|
2149
2296
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2297
|
+
constructor(parent) {
|
|
2298
|
+
this.parent = parent;
|
|
2299
|
+
this.currentContainer = null;
|
|
2152
2300
|
}
|
|
2153
|
-
|
|
2154
|
-
const
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2301
|
+
setContent(content, className) {
|
|
2302
|
+
const container = Dom.element('div', {
|
|
2303
|
+
class: className
|
|
2304
|
+
});
|
|
2305
|
+
container.appendChild(content);
|
|
2306
|
+
if (this.currentContainer) {
|
|
2307
|
+
this.parent.removeChild(this.currentContainer);
|
|
2158
2308
|
}
|
|
2159
|
-
|
|
2309
|
+
this.parent.appendChild(container);
|
|
2310
|
+
this.currentContainer = container;
|
|
2160
2311
|
}
|
|
2161
|
-
|
|
2162
|
-
this.
|
|
2163
|
-
|
|
2164
|
-
}
|
|
2312
|
+
destroy() {
|
|
2313
|
+
if (this.currentContainer) {
|
|
2314
|
+
this.parent.removeChild(this.currentContainer);
|
|
2315
|
+
}
|
|
2165
2316
|
}
|
|
2166
|
-
}
|
|
2167
|
-
function drawLine(parent, x1, y1, x2, y2) {
|
|
2168
|
-
const line = Dom.svg('line', {
|
|
2169
|
-
class: 'sqd-region',
|
|
2170
|
-
x1,
|
|
2171
|
-
y1,
|
|
2172
|
-
x2,
|
|
2173
|
-
y2
|
|
2174
|
-
});
|
|
2175
|
-
parent.insertBefore(line, parent.firstChild);
|
|
2176
|
-
return line;
|
|
2177
2317
|
}
|
|
2178
2318
|
|
|
2179
|
-
class
|
|
2180
|
-
create(
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2183
|
-
|
|
2319
|
+
class Editor {
|
|
2320
|
+
static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider, customSelectedStepIdProvider) {
|
|
2321
|
+
const view = EditorView.create(parent);
|
|
2322
|
+
function render(step) {
|
|
2323
|
+
const definition = api.getDefinition();
|
|
2324
|
+
let content;
|
|
2325
|
+
let className;
|
|
2326
|
+
if (step) {
|
|
2327
|
+
const stepContext = api.createStepEditorContext(step.id);
|
|
2328
|
+
content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
|
|
2329
|
+
className = stepEditorClassName;
|
|
2330
|
+
}
|
|
2331
|
+
else {
|
|
2332
|
+
const rootContext = api.createRootEditorContext();
|
|
2333
|
+
content = rootEditorProvider(definition, rootContext, api.isReadonly());
|
|
2334
|
+
className = rootEditorClassName;
|
|
2335
|
+
}
|
|
2336
|
+
view.setContent(content, className);
|
|
2337
|
+
}
|
|
2338
|
+
const renderer = api.runRenderer(step => render(step), customSelectedStepIdProvider);
|
|
2339
|
+
return new Editor(view, renderer);
|
|
2340
|
+
}
|
|
2341
|
+
constructor(view, renderer) {
|
|
2342
|
+
this.view = view;
|
|
2343
|
+
this.renderer = renderer;
|
|
2344
|
+
}
|
|
2345
|
+
destroy() {
|
|
2346
|
+
this.view.destroy();
|
|
2347
|
+
this.renderer.destroy();
|
|
2184
2348
|
}
|
|
2185
2349
|
}
|
|
2186
2350
|
|
|
@@ -2412,6 +2576,8 @@
|
|
|
2412
2576
|
constructor(dom, shadowRoot) {
|
|
2413
2577
|
this.dom = dom;
|
|
2414
2578
|
this.shadowRoot = shadowRoot;
|
|
2579
|
+
this.previousEndToken = null;
|
|
2580
|
+
this.state = null;
|
|
2415
2581
|
this.onMouseMove = (e) => {
|
|
2416
2582
|
e.preventDefault();
|
|
2417
2583
|
e.stopPropagation();
|
|
@@ -2483,7 +2649,7 @@
|
|
|
2483
2649
|
const delta = this.state.startPosition.subtract(position);
|
|
2484
2650
|
const newBehavior = this.state.behavior.onMove(delta);
|
|
2485
2651
|
if (newBehavior) {
|
|
2486
|
-
this.state.behavior.onEnd(true, null);
|
|
2652
|
+
this.state.behavior.onEnd(true, null, null);
|
|
2487
2653
|
this.state.behavior = newBehavior;
|
|
2488
2654
|
this.state.startPosition = position;
|
|
2489
2655
|
this.state.behavior.onStart(this.state.startPosition);
|
|
@@ -2497,8 +2663,9 @@
|
|
|
2497
2663
|
this.unbind(this.shadowRoot);
|
|
2498
2664
|
}
|
|
2499
2665
|
this.unbind(window);
|
|
2500
|
-
this.state.behavior.onEnd(interrupt, element);
|
|
2501
|
-
this.state =
|
|
2666
|
+
const endToken = this.state.behavior.onEnd(interrupt, element, this.previousEndToken);
|
|
2667
|
+
this.state = null;
|
|
2668
|
+
this.previousEndToken = endToken || null;
|
|
2502
2669
|
}
|
|
2503
2670
|
}
|
|
2504
2671
|
|
|
@@ -3174,9 +3341,11 @@
|
|
|
3174
3341
|
}
|
|
3175
3342
|
}
|
|
3176
3343
|
onEnd(interrupt) {
|
|
3177
|
-
if (
|
|
3178
|
-
|
|
3344
|
+
if (interrupt) {
|
|
3345
|
+
return;
|
|
3179
3346
|
}
|
|
3347
|
+
this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence);
|
|
3348
|
+
return new SelectStepBehaviorEndToken(this.pressedStepComponent.step.id, Date.now());
|
|
3180
3349
|
}
|
|
3181
3350
|
}
|
|
3182
3351
|
|
|
@@ -3545,13 +3714,14 @@
|
|
|
3545
3714
|
var _a;
|
|
3546
3715
|
const view = WorkspaceView.create(parent, designerContext.componentContext);
|
|
3547
3716
|
const clickBehaviorResolver = new ClickBehaviorResolver(designerContext);
|
|
3717
|
+
const clickBehaviorWrapper = designerContext.services.clickBehaviorWrapperExtension.create(designerContext.customActionController);
|
|
3548
3718
|
const wheelController = designerContext.services.wheelController.create(api.viewport, api.workspace);
|
|
3549
3719
|
const pinchToZoomController = PinchToZoomController.create(api.workspace, api.viewport, api.shadowRoot);
|
|
3550
3720
|
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
3551
3721
|
? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
|
|
3552
3722
|
: undefined);
|
|
3553
3723
|
const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
|
|
3554
|
-
const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, api.viewport, designerContext.services);
|
|
3724
|
+
const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, api.viewport, designerContext.services);
|
|
3555
3725
|
setTimeout(() => {
|
|
3556
3726
|
workspace.updateRootComponent();
|
|
3557
3727
|
api.viewport.resetViewport();
|
|
@@ -3567,7 +3737,7 @@
|
|
|
3567
3737
|
view.bindContextMenu(workspace.onContextMenu);
|
|
3568
3738
|
return workspace;
|
|
3569
3739
|
}
|
|
3570
|
-
constructor(view, definitionWalker, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, viewportApi, services) {
|
|
3740
|
+
constructor(view, definitionWalker, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, viewportApi, services) {
|
|
3571
3741
|
this.view = view;
|
|
3572
3742
|
this.definitionWalker = definitionWalker;
|
|
3573
3743
|
this.state = state;
|
|
@@ -3576,6 +3746,7 @@
|
|
|
3576
3746
|
this.pinchToZoomController = pinchToZoomController;
|
|
3577
3747
|
this.contextMenuController = contextMenuController;
|
|
3578
3748
|
this.clickBehaviorResolver = clickBehaviorResolver;
|
|
3749
|
+
this.clickBehaviorWrapper = clickBehaviorWrapper;
|
|
3579
3750
|
this.viewportApi = viewportApi;
|
|
3580
3751
|
this.services = services;
|
|
3581
3752
|
this.onRendered = new SimpleEvent();
|
|
@@ -3589,7 +3760,8 @@
|
|
|
3589
3760
|
const forceMove = isMiddleButton || altKey;
|
|
3590
3761
|
const commandOrNull = this.resolveClick(target, position);
|
|
3591
3762
|
const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, forceMove);
|
|
3592
|
-
this.
|
|
3763
|
+
const wrappedBehavior = this.clickBehaviorWrapper.wrap(behavior, commandOrNull);
|
|
3764
|
+
this.behaviorController.start(position, wrappedBehavior);
|
|
3593
3765
|
}
|
|
3594
3766
|
};
|
|
3595
3767
|
this.onPinchToZoom = (distance, centerPoint) => {
|
|
@@ -3907,7 +4079,7 @@
|
|
|
3907
4079
|
static create(parent, api) {
|
|
3908
4080
|
const isUndoRedoSupported = api.controlBar.isUndoRedoSupported();
|
|
3909
4081
|
const view = ControlBarView.create(parent, isUndoRedoSupported, api.i18n);
|
|
3910
|
-
const bar = new ControlBar(view, api.controlBar, isUndoRedoSupported);
|
|
4082
|
+
const bar = new ControlBar(view, api.controlBar, api.viewport, isUndoRedoSupported);
|
|
3911
4083
|
view.bindResetButtonClick(() => bar.onResetButtonClicked());
|
|
3912
4084
|
view.bindZoomInButtonClick(() => bar.onZoomInButtonClicked());
|
|
3913
4085
|
view.bindZoomOutButtonClick(() => bar.onZoomOutButtonClicked());
|
|
@@ -3921,9 +4093,10 @@
|
|
|
3921
4093
|
bar.refreshButtons();
|
|
3922
4094
|
return bar;
|
|
3923
4095
|
}
|
|
3924
|
-
constructor(view, controlBarApi, isUndoRedoSupported) {
|
|
4096
|
+
constructor(view, controlBarApi, viewportApi, isUndoRedoSupported) {
|
|
3925
4097
|
this.view = view;
|
|
3926
4098
|
this.controlBarApi = controlBarApi;
|
|
4099
|
+
this.viewportApi = viewportApi;
|
|
3927
4100
|
this.isUndoRedoSupported = isUndoRedoSupported;
|
|
3928
4101
|
}
|
|
3929
4102
|
updateLayout() {
|
|
@@ -3933,13 +4106,13 @@
|
|
|
3933
4106
|
//
|
|
3934
4107
|
}
|
|
3935
4108
|
onResetButtonClicked() {
|
|
3936
|
-
this.
|
|
4109
|
+
this.viewportApi.resetViewport();
|
|
3937
4110
|
}
|
|
3938
4111
|
onZoomInButtonClicked() {
|
|
3939
|
-
this.
|
|
4112
|
+
this.viewportApi.zoom(true);
|
|
3940
4113
|
}
|
|
3941
4114
|
onZoomOutButtonClicked() {
|
|
3942
|
-
this.
|
|
4115
|
+
this.viewportApi.zoom(false);
|
|
3943
4116
|
}
|
|
3944
4117
|
onMoveButtonClicked() {
|
|
3945
4118
|
this.controlBarApi.toggleIsDragDisabled();
|
|
@@ -4457,31 +4630,6 @@
|
|
|
4457
4630
|
}
|
|
4458
4631
|
}
|
|
4459
4632
|
|
|
4460
|
-
const defaultConfiguration$4 = {
|
|
4461
|
-
view: {
|
|
4462
|
-
paddingTop: 20,
|
|
4463
|
-
paddingX: 20,
|
|
4464
|
-
inputSize: 18,
|
|
4465
|
-
inputIconSize: 14,
|
|
4466
|
-
label: {
|
|
4467
|
-
height: 22,
|
|
4468
|
-
paddingX: 10,
|
|
4469
|
-
minWidth: 50,
|
|
4470
|
-
radius: 10
|
|
4471
|
-
}
|
|
4472
|
-
}
|
|
4473
|
-
};
|
|
4474
|
-
class ContainerStepExtension {
|
|
4475
|
-
static create(configuration) {
|
|
4476
|
-
return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4);
|
|
4477
|
-
}
|
|
4478
|
-
constructor(configuration) {
|
|
4479
|
-
this.configuration = configuration;
|
|
4480
|
-
this.componentType = 'container';
|
|
4481
|
-
this.createComponentView = createContainerStepComponentViewFactory(this.configuration.view);
|
|
4482
|
-
}
|
|
4483
|
-
}
|
|
4484
|
-
|
|
4485
4633
|
class DefaultPlaceholderControllerExtension {
|
|
4486
4634
|
create() {
|
|
4487
4635
|
return {
|
|
@@ -4490,7 +4638,7 @@
|
|
|
4490
4638
|
}
|
|
4491
4639
|
}
|
|
4492
4640
|
|
|
4493
|
-
const defaultConfiguration
|
|
4641
|
+
const defaultConfiguration = {
|
|
4494
4642
|
gapWidth: 88,
|
|
4495
4643
|
gapHeight: 24,
|
|
4496
4644
|
radius: 6,
|
|
@@ -4498,7 +4646,7 @@
|
|
|
4498
4646
|
};
|
|
4499
4647
|
class RectPlaceholderExtension {
|
|
4500
4648
|
static create(configuration) {
|
|
4501
|
-
return new RectPlaceholderExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration
|
|
4649
|
+
return new RectPlaceholderExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration);
|
|
4502
4650
|
}
|
|
4503
4651
|
constructor(configuration) {
|
|
4504
4652
|
this.configuration = configuration;
|
|
@@ -4512,63 +4660,6 @@
|
|
|
4512
4660
|
}
|
|
4513
4661
|
}
|
|
4514
4662
|
|
|
4515
|
-
const defaultConfiguration$2 = {
|
|
4516
|
-
view: {
|
|
4517
|
-
minContainerWidth: 40,
|
|
4518
|
-
paddingX: 20,
|
|
4519
|
-
paddingTop: 20,
|
|
4520
|
-
connectionHeight: 16,
|
|
4521
|
-
inputSize: 18,
|
|
4522
|
-
inputIconSize: 14,
|
|
4523
|
-
branchNameLabel: {
|
|
4524
|
-
height: 22,
|
|
4525
|
-
paddingX: 10,
|
|
4526
|
-
minWidth: 50,
|
|
4527
|
-
radius: 10
|
|
4528
|
-
},
|
|
4529
|
-
nameLabel: {
|
|
4530
|
-
height: 22,
|
|
4531
|
-
paddingX: 10,
|
|
4532
|
-
minWidth: 50,
|
|
4533
|
-
radius: 10
|
|
4534
|
-
}
|
|
4535
|
-
}
|
|
4536
|
-
};
|
|
4537
|
-
class SwitchStepExtension {
|
|
4538
|
-
static create(configuration) {
|
|
4539
|
-
return new SwitchStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);
|
|
4540
|
-
}
|
|
4541
|
-
constructor(configuration) {
|
|
4542
|
-
this.configuration = configuration;
|
|
4543
|
-
this.componentType = 'switch';
|
|
4544
|
-
this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);
|
|
4545
|
-
}
|
|
4546
|
-
}
|
|
4547
|
-
|
|
4548
|
-
const defaultConfiguration$1 = {
|
|
4549
|
-
view: {
|
|
4550
|
-
paddingLeft: 12,
|
|
4551
|
-
paddingRight: 12,
|
|
4552
|
-
paddingY: 10,
|
|
4553
|
-
textMarginLeft: 12,
|
|
4554
|
-
minTextWidth: 70,
|
|
4555
|
-
iconSize: 22,
|
|
4556
|
-
radius: 5,
|
|
4557
|
-
inputSize: 14,
|
|
4558
|
-
outputSize: 10
|
|
4559
|
-
}
|
|
4560
|
-
};
|
|
4561
|
-
class TaskStepExtension {
|
|
4562
|
-
static create(configuration) {
|
|
4563
|
-
return new TaskStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$1);
|
|
4564
|
-
}
|
|
4565
|
-
constructor(configuration) {
|
|
4566
|
-
this.configuration = configuration;
|
|
4567
|
-
this.componentType = 'task';
|
|
4568
|
-
this.createComponentView = createTaskStepComponentViewFactory(false, this.configuration.view);
|
|
4569
|
-
}
|
|
4570
|
-
}
|
|
4571
|
-
|
|
4572
4663
|
class DefaultSequenceComponentExtension {
|
|
4573
4664
|
constructor() {
|
|
4574
4665
|
this.create = DefaultSequenceComponent.create;
|
|
@@ -4581,39 +4672,15 @@
|
|
|
4581
4672
|
}
|
|
4582
4673
|
}
|
|
4583
4674
|
|
|
4584
|
-
class
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
class: 'sqd-line-grid-path',
|
|
4588
|
-
fill: 'none'
|
|
4589
|
-
});
|
|
4590
|
-
return new LineGrid(size, path);
|
|
4591
|
-
}
|
|
4592
|
-
constructor(size, element) {
|
|
4593
|
-
this.size = size;
|
|
4594
|
-
this.element = element;
|
|
4595
|
-
}
|
|
4596
|
-
setScale(_, scaledSize) {
|
|
4597
|
-
Dom.attrs(this.element, {
|
|
4598
|
-
d: `M ${scaledSize.x} 0 L 0 0 0 ${scaledSize.y}`
|
|
4599
|
-
});
|
|
4675
|
+
class DefaultClickBehaviorWrapper {
|
|
4676
|
+
constructor() {
|
|
4677
|
+
this.wrap = (behavior) => behavior;
|
|
4600
4678
|
}
|
|
4601
4679
|
}
|
|
4602
4680
|
|
|
4603
|
-
|
|
4604
|
-
gridSizeX: 48,
|
|
4605
|
-
gridSizeY: 48
|
|
4606
|
-
};
|
|
4607
|
-
class LineGridExtension {
|
|
4608
|
-
static create(configuration) {
|
|
4609
|
-
return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration);
|
|
4610
|
-
}
|
|
4611
|
-
constructor(configuration) {
|
|
4612
|
-
this.configuration = configuration;
|
|
4613
|
-
}
|
|
4681
|
+
class DefaultClickBehaviorWrapperExtension {
|
|
4614
4682
|
create() {
|
|
4615
|
-
|
|
4616
|
-
return LineGrid.create(size);
|
|
4683
|
+
return new DefaultClickBehaviorWrapper();
|
|
4617
4684
|
}
|
|
4618
4685
|
}
|
|
4619
4686
|
|
|
@@ -4633,6 +4700,9 @@
|
|
|
4633
4700
|
if (ext.stepComponentViewWrapper) {
|
|
4634
4701
|
services.stepComponentViewWrapper = ext.stepComponentViewWrapper;
|
|
4635
4702
|
}
|
|
4703
|
+
if (ext.clickBehaviorWrapperExtension) {
|
|
4704
|
+
services.clickBehaviorWrapperExtension = ext.clickBehaviorWrapperExtension;
|
|
4705
|
+
}
|
|
4636
4706
|
if (ext.badges) {
|
|
4637
4707
|
services.badges = (services.badges || []).concat(ext.badges);
|
|
4638
4708
|
}
|
|
@@ -4684,6 +4754,9 @@
|
|
|
4684
4754
|
if (!services.stepComponentViewWrapper) {
|
|
4685
4755
|
services.stepComponentViewWrapper = new DefaultStepComponentViewWrapperExtension();
|
|
4686
4756
|
}
|
|
4757
|
+
if (!services.clickBehaviorWrapperExtension) {
|
|
4758
|
+
services.clickBehaviorWrapperExtension = new DefaultClickBehaviorWrapperExtension();
|
|
4759
|
+
}
|
|
4687
4760
|
if (!services.badges) {
|
|
4688
4761
|
services.badges = [];
|
|
4689
4762
|
}
|
|
@@ -4980,35 +5053,6 @@
|
|
|
4980
5053
|
}
|
|
4981
5054
|
}
|
|
4982
5055
|
|
|
4983
|
-
class LineGridDesignerExtension {
|
|
4984
|
-
static create(configuration) {
|
|
4985
|
-
const grid = LineGridExtension.create(configuration);
|
|
4986
|
-
return new LineGridDesignerExtension(grid);
|
|
4987
|
-
}
|
|
4988
|
-
constructor(grid) {
|
|
4989
|
-
this.grid = grid;
|
|
4990
|
-
}
|
|
4991
|
-
}
|
|
4992
|
-
|
|
4993
|
-
class StepsDesignerExtension {
|
|
4994
|
-
static create(configuration) {
|
|
4995
|
-
const steps = [];
|
|
4996
|
-
if (configuration.container) {
|
|
4997
|
-
steps.push(ContainerStepExtension.create(configuration.container));
|
|
4998
|
-
}
|
|
4999
|
-
if (configuration.switch) {
|
|
5000
|
-
steps.push(SwitchStepExtension.create(configuration.switch));
|
|
5001
|
-
}
|
|
5002
|
-
if (configuration.task) {
|
|
5003
|
-
steps.push(TaskStepExtension.create(configuration.task));
|
|
5004
|
-
}
|
|
5005
|
-
return new StepsDesignerExtension(steps);
|
|
5006
|
-
}
|
|
5007
|
-
constructor(steps) {
|
|
5008
|
-
this.steps = steps;
|
|
5009
|
-
}
|
|
5010
|
-
}
|
|
5011
|
-
|
|
5012
5056
|
exports.Badges = Badges;
|
|
5013
5057
|
exports.CenteredViewportCalculator = CenteredViewportCalculator;
|
|
5014
5058
|
exports.ClassicWheelControllerExtension = ClassicWheelControllerExtension;
|
|
@@ -5021,6 +5065,7 @@
|
|
|
5021
5065
|
exports.DefaultSequenceComponent = DefaultSequenceComponent;
|
|
5022
5066
|
exports.DefaultSequenceComponentView = DefaultSequenceComponentView;
|
|
5023
5067
|
exports.DefaultViewportController = DefaultViewportController;
|
|
5068
|
+
exports.DefaultViewportControllerDesignerExtension = DefaultViewportControllerDesignerExtension;
|
|
5024
5069
|
exports.DefaultViewportControllerExtension = DefaultViewportControllerExtension;
|
|
5025
5070
|
exports.DefinitionWalker = DefinitionWalker;
|
|
5026
5071
|
exports.Designer = Designer;
|
|
@@ -5040,12 +5085,15 @@
|
|
|
5040
5085
|
exports.PathBarApi = PathBarApi;
|
|
5041
5086
|
exports.RectPlaceholder = RectPlaceholder;
|
|
5042
5087
|
exports.RectPlaceholderView = RectPlaceholderView;
|
|
5088
|
+
exports.SelectStepBehaviorEndToken = SelectStepBehaviorEndToken;
|
|
5043
5089
|
exports.ServicesResolver = ServicesResolver;
|
|
5044
5090
|
exports.SimpleEvent = SimpleEvent;
|
|
5091
|
+
exports.StartStopRootComponentDesignerExtension = StartStopRootComponentDesignerExtension;
|
|
5045
5092
|
exports.StartStopRootComponentExtension = StartStopRootComponentExtension;
|
|
5046
5093
|
exports.StepComponent = StepComponent;
|
|
5047
5094
|
exports.StepExtensionResolver = StepExtensionResolver;
|
|
5048
5095
|
exports.StepsDesignerExtension = StepsDesignerExtension;
|
|
5096
|
+
exports.TYPE = TYPE;
|
|
5049
5097
|
exports.ToolboxApi = ToolboxApi;
|
|
5050
5098
|
exports.Uid = Uid;
|
|
5051
5099
|
exports.ValidationErrorBadgeExtension = ValidationErrorBadgeExtension;
|