sequential-workflow-designer 0.27.4 → 0.29.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/lib/cjs/index.cjs CHANGED
@@ -768,8 +768,9 @@ class ViewportApi {
768
768
  }
769
769
 
770
770
  class WorkspaceApi {
771
- constructor(state, workspaceController) {
771
+ constructor(state, definitionWalker, workspaceController) {
772
772
  this.state = state;
773
+ this.definitionWalker = definitionWalker;
773
774
  this.workspaceController = workspaceController;
774
775
  }
775
776
  getViewport() {
@@ -796,11 +797,29 @@ class WorkspaceApi {
796
797
  updateCanvasSize() {
797
798
  this.workspaceController.updateCanvasSize();
798
799
  }
800
+ getRootSequence() {
801
+ const stepId = this.state.tryGetLastStepIdFromFolderPath();
802
+ if (stepId) {
803
+ const parentStep = this.definitionWalker.getParentSequence(this.state.definition, stepId);
804
+ const children = this.definitionWalker.getChildren(parentStep.step);
805
+ if (!children || children.type !== sequentialWorkflowModel.StepChildrenType.sequence) {
806
+ throw new Error('Cannot find single sequence in folder step');
807
+ }
808
+ return {
809
+ sequence: children.items,
810
+ parentStep
811
+ };
812
+ }
813
+ return {
814
+ sequence: this.state.definition.sequence,
815
+ parentStep: null
816
+ };
817
+ }
799
818
  }
800
819
 
801
820
  class DesignerApi {
802
821
  static create(context) {
803
- const workspace = new WorkspaceApi(context.state, context.workspaceController);
822
+ const workspace = new WorkspaceApi(context.state, context.definitionWalker, context.workspaceController);
804
823
  const viewportController = context.services.viewportController.create(workspace);
805
824
  const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);
806
825
  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);
@@ -1059,11 +1078,11 @@ class InputView {
1059
1078
  parent.appendChild(circle);
1060
1079
  return new InputView(circle);
1061
1080
  }
1062
- constructor(root) {
1063
- this.root = root;
1081
+ constructor(g) {
1082
+ this.g = g;
1064
1083
  }
1065
1084
  setIsHidden(isHidden) {
1066
- Dom.attrs(this.root, {
1085
+ Dom.attrs(this.g, {
1067
1086
  visibility: isHidden ? 'hidden' : 'visible'
1068
1087
  });
1069
1088
  }
@@ -1488,31 +1507,77 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
1488
1507
  };
1489
1508
 
1490
1509
  const COMPONENT_CLASS_NAME$1 = 'switch';
1510
+ function createView(g, width, height, joinX, viewContext, sequenceComponents, regionView, cfg) {
1511
+ let inputView = null;
1512
+ if (cfg.inputSize > 0) {
1513
+ const iconUrl = viewContext.getStepIconUrl();
1514
+ inputView = InputView.createRectInput(g, joinX, cfg.paddingTop1, cfg.inputSize, cfg.inputRadius, cfg.inputIconSize, iconUrl);
1515
+ }
1516
+ return {
1517
+ g,
1518
+ width,
1519
+ height,
1520
+ joinX,
1521
+ placeholders: null,
1522
+ sequenceComponents,
1523
+ hasOutput: sequenceComponents ? sequenceComponents.some(c => c.hasOutput) : true,
1524
+ getClientPosition() {
1525
+ return regionView.getClientPosition();
1526
+ },
1527
+ resolveClick(click) {
1528
+ const result = regionView.resolveClick(click);
1529
+ return result === true || (result === null && g.contains(click.element)) ? true : result;
1530
+ },
1531
+ setIsDragging(isDragging) {
1532
+ if (cfg.autoHideInputOnDrag && inputView) {
1533
+ inputView.setIsHidden(isDragging);
1534
+ }
1535
+ },
1536
+ setIsSelected(isSelected) {
1537
+ regionView.setIsSelected(isSelected);
1538
+ },
1539
+ setIsDisabled(isDisabled) {
1540
+ Dom.toggleClass(g, isDisabled, 'sqd-disabled');
1541
+ }
1542
+ };
1543
+ }
1491
1544
  const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
1492
1545
  return viewContext.createRegionComponentView(parent, COMPONENT_CLASS_NAME$1, (g, regionViewBuilder) => {
1493
1546
  const step = stepContext.step;
1494
1547
  const paddingTop = cfg.paddingTop1 + cfg.paddingTop2;
1548
+ const name = viewContext.getStepName();
1549
+ const nameLabelView = LabelView.create(g, paddingTop, cfg.nameLabel, name, 'primary');
1495
1550
  const branchNames = Object.keys(step.branches);
1496
- const branchComponents = branchNames.map(branchName => {
1497
- return viewContext.createSequenceComponent(g, step.branches[branchName]);
1498
- });
1499
- const branchLabelViews = branchNames.map(branchName => {
1551
+ if (branchNames.length === 0) {
1552
+ const width = Math.max(nameLabelView.width, cfg.minBranchWidth) + cfg.paddingX * 2;
1553
+ const height = nameLabelView.height + paddingTop + cfg.noBranchPaddingBottom;
1554
+ const joinX = width / 2;
1555
+ const regionView = regionViewBuilder(g, [width], height);
1556
+ Dom.translate(nameLabelView.g, joinX, 0);
1557
+ JoinView.createStraightJoin(g, new Vector(joinX, 0), height);
1558
+ return createView(g, width, height, joinX, viewContext, null, regionView, cfg);
1559
+ }
1560
+ const branchComponents = [];
1561
+ const branchLabelViews = [];
1562
+ const branchSizes = [];
1563
+ let totalBranchesWidth = 0;
1564
+ let maxBranchesHeight = 0;
1565
+ branchNames.forEach(branchName => {
1566
+ const component = viewContext.createSequenceComponent(g, step.branches[branchName]);
1500
1567
  const labelY = paddingTop + cfg.nameLabel.height + cfg.connectionHeight;
1501
1568
  const translatedBranchName = viewContext.i18n(`stepComponent.${step.type}.branchName`, branchName);
1502
- return LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');
1503
- });
1504
- const name = viewContext.getStepName();
1505
- const nameLabelView = LabelView.create(g, paddingTop, cfg.nameLabel, name, 'primary');
1506
- let prevOffsetX = 0;
1507
- const branchSizes = branchComponents.map((component, i) => {
1508
- const halfOfWidestBranchElement = Math.max(branchLabelViews[i].width, cfg.minContainerWidth) / 2;
1569
+ const labelView = LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');
1570
+ const halfOfWidestBranchElement = Math.max(labelView.width, cfg.minBranchWidth) / 2;
1509
1571
  const branchOffsetLeft = Math.max(halfOfWidestBranchElement - component.view.joinX, 0) + cfg.paddingX;
1510
1572
  const branchOffsetRight = Math.max(halfOfWidestBranchElement - (component.view.width - component.view.joinX), 0) + cfg.paddingX;
1511
1573
  const width = component.view.width + branchOffsetLeft + branchOffsetRight;
1512
1574
  const joinX = component.view.joinX + branchOffsetLeft;
1513
- const offsetX = prevOffsetX;
1514
- prevOffsetX += width;
1515
- return { width, branchOffsetLeft, offsetX, joinX };
1575
+ const offsetX = totalBranchesWidth;
1576
+ totalBranchesWidth += width;
1577
+ maxBranchesHeight = Math.max(maxBranchesHeight, component.view.height);
1578
+ branchComponents.push(component);
1579
+ branchLabelViews.push(labelView);
1580
+ branchSizes.push({ width, branchOffsetLeft, offsetX, joinX });
1516
1581
  });
1517
1582
  const centerBranchIndex = Math.floor(branchNames.length / 2);
1518
1583
  const centerBranchSize = branchSizes[centerBranchIndex];
@@ -1520,8 +1585,6 @@ const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, view
1520
1585
  if (branchNames.length % 2 !== 0) {
1521
1586
  joinX += centerBranchSize.joinX;
1522
1587
  }
1523
- const totalBranchesWidth = branchSizes.reduce((result, s) => result + s.width, 0);
1524
- const maxBranchesHeight = Math.max(...branchComponents.map(s => s.view.height));
1525
1588
  const halfOfWidestSwitchElement = nameLabelView.width / 2 + cfg.paddingX;
1526
1589
  const switchOffsetLeft = Math.max(halfOfWidestSwitchElement - joinX, 0);
1527
1590
  const switchOffsetRight = Math.max(halfOfWidestSwitchElement - (totalBranchesWidth - joinX), 0);
@@ -1543,18 +1606,16 @@ const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, view
1543
1606
  }
1544
1607
  }
1545
1608
  });
1546
- let inputView = null;
1547
- if (cfg.inputSize > 0) {
1548
- const iconUrl = viewContext.getStepIconUrl();
1549
- inputView = InputView.createRectInput(g, shiftedJoinX, cfg.paddingTop1, cfg.inputSize, cfg.inputRadius, cfg.inputIconSize, iconUrl);
1550
- }
1551
1609
  JoinView.createStraightJoin(g, new Vector(shiftedJoinX, 0), paddingTop);
1552
- JoinView.createJoins(g, new Vector(shiftedJoinX, paddingTop + cfg.nameLabel.height), branchSizes.map(o => new Vector(switchOffsetLeft + o.offsetX + o.joinX, paddingTop + cfg.nameLabel.height + cfg.connectionHeight)));
1610
+ JoinView.createJoins(g, new Vector(shiftedJoinX, paddingTop + cfg.nameLabel.height), branchSizes.map(s => new Vector(switchOffsetLeft + s.offsetX + s.joinX, paddingTop + cfg.nameLabel.height + cfg.connectionHeight)));
1553
1611
  if (stepContext.isOutputConnected) {
1554
1612
  const ongoingSequenceIndexes = branchComponents
1555
1613
  .map((component, index) => (component.hasOutput ? index : null))
1556
1614
  .filter(index => index !== null);
1557
- const ongoingJoinTargets = ongoingSequenceIndexes.map((i) => new Vector(switchOffsetLeft + branchSizes[i].offsetX + branchSizes[i].joinX, paddingTop + cfg.connectionHeight + cfg.nameLabel.height + cfg.branchNameLabel.height + maxBranchesHeight));
1615
+ const ongoingJoinTargets = ongoingSequenceIndexes.map((i) => {
1616
+ const branchSize = branchSizes[i];
1617
+ return new Vector(switchOffsetLeft + branchSize.offsetX + branchSize.joinX, paddingTop + cfg.connectionHeight + cfg.nameLabel.height + cfg.branchNameLabel.height + maxBranchesHeight);
1618
+ });
1558
1619
  if (ongoingJoinTargets.length > 0) {
1559
1620
  JoinView.createJoins(g, new Vector(shiftedJoinX, viewHeight), ongoingJoinTargets);
1560
1621
  }
@@ -1563,33 +1624,7 @@ const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, view
1563
1624
  regions[0] += switchOffsetLeft;
1564
1625
  regions[regions.length - 1] += switchOffsetRight;
1565
1626
  const regionView = regionViewBuilder(g, regions, viewHeight);
1566
- return {
1567
- g,
1568
- width: viewWidth,
1569
- height: viewHeight,
1570
- joinX: shiftedJoinX,
1571
- placeholders: null,
1572
- sequenceComponents: branchComponents,
1573
- hasOutput: branchComponents.some(c => c.hasOutput),
1574
- getClientPosition() {
1575
- return regionView.getClientPosition();
1576
- },
1577
- resolveClick(click) {
1578
- const result = regionView.resolveClick(click);
1579
- return result === true || (result === null && g.contains(click.element)) ? true : result;
1580
- },
1581
- setIsDragging(isDragging) {
1582
- if (cfg.autoHideInputOnDrag && inputView) {
1583
- inputView.setIsHidden(isDragging);
1584
- }
1585
- },
1586
- setIsSelected(isSelected) {
1587
- regionView.setIsSelected(isSelected);
1588
- },
1589
- setIsDisabled(isDisabled) {
1590
- Dom.toggleClass(g, isDisabled, 'sqd-disabled');
1591
- }
1592
- };
1627
+ return createView(g, viewWidth, viewHeight, shiftedJoinX, viewContext, branchComponents, regionView, cfg);
1593
1628
  });
1594
1629
  };
1595
1630
 
@@ -2114,11 +2149,12 @@ class ContainerStepExtension {
2114
2149
 
2115
2150
  const defaultConfiguration$2 = {
2116
2151
  view: {
2117
- minContainerWidth: 40,
2152
+ minBranchWidth: 88,
2118
2153
  paddingX: 20,
2119
2154
  paddingTop1: 0,
2120
2155
  paddingTop2: 22,
2121
- connectionHeight: 16,
2156
+ connectionHeight: 20,
2157
+ noBranchPaddingBottom: 24,
2122
2158
  inputSize: 18,
2123
2159
  inputIconSize: 14,
2124
2160
  inputRadius: 4,
@@ -2995,6 +3031,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2995
3031
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2996
3032
  PERFORMANCE OF THIS SOFTWARE.
2997
3033
  ***************************************************************************** */
3034
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
3035
+
2998
3036
 
2999
3037
  function __awaiter(thisArg, _arguments, P, generator) {
3000
3038
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -3004,7 +3042,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
3004
3042
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3005
3043
  step((generator = generator.apply(thisArg, _arguments || [])).next());
3006
3044
  });
3007
- }
3045
+ }
3046
+
3047
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
3048
+ var e = new Error(message);
3049
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3050
+ };
3008
3051
 
3009
3052
  function isElementAttached(dom, element) {
3010
3053
  return !(dom.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_DISCONNECTED);
@@ -3055,11 +3098,11 @@ class WorkspaceView {
3055
3098
  this.context = context;
3056
3099
  this.onResizeHandler = () => this.onResize();
3057
3100
  }
3058
- render(sequence, parentSequencePlaceIndicator) {
3101
+ render(sequence, parentPlaceIndicator) {
3059
3102
  if (this.rootComponent) {
3060
3103
  this.foreground.removeChild(this.rootComponent.view.g);
3061
3104
  }
3062
- this.rootComponent = this.context.services.rootComponent.create(this.foreground, sequence, parentSequencePlaceIndicator, this.context);
3105
+ this.rootComponent = this.context.services.rootComponent.create(this.foreground, sequence, parentPlaceIndicator, this.context);
3063
3106
  this.refreshSize();
3064
3107
  }
3065
3108
  setPositionAndScale(position, scale) {
@@ -3219,10 +3262,14 @@ class PressingBehavior {
3219
3262
  }
3220
3263
 
3221
3264
  class RerenderStepPressingBehaviorHandler {
3222
- constructor(designerContext) {
3265
+ constructor(command, designerContext) {
3266
+ this.command = command;
3223
3267
  this.designerContext = designerContext;
3224
3268
  }
3225
3269
  handle() {
3270
+ if (this.command.beforeCallback) {
3271
+ this.command.beforeCallback();
3272
+ }
3226
3273
  this.designerContext.workspaceController.updateRootComponent();
3227
3274
  }
3228
3275
  }
@@ -3260,7 +3307,7 @@ class ClickBehaviorResolver {
3260
3307
  case exports.ClickCommandType.selectStep:
3261
3308
  return SelectStepBehavior.create(commandOrNull.component, forceMove, this.context);
3262
3309
  case exports.ClickCommandType.rerenderStep:
3263
- return PressingBehavior.create(element, new RerenderStepPressingBehaviorHandler(this.context));
3310
+ return PressingBehavior.create(element, new RerenderStepPressingBehaviorHandler(commandOrNull, this.context));
3264
3311
  case exports.ClickCommandType.openFolder:
3265
3312
  return PressingBehavior.create(element, new OpenFolderPressingBehaviorHandler(commandOrNull, this.context));
3266
3313
  case exports.ClickCommandType.triggerCustomAction:
@@ -3396,8 +3443,9 @@ class ContextMenuController {
3396
3443
  }
3397
3444
 
3398
3445
  class ContextMenuItemsBuilder {
3399
- constructor(viewportApi, i18n, stateModifier, state, customMenuItemsProvider) {
3446
+ constructor(viewportApi, workspaceApi, i18n, stateModifier, state, customMenuItemsProvider) {
3400
3447
  this.viewportApi = viewportApi;
3448
+ this.workspaceApi = workspaceApi;
3401
3449
  this.i18n = i18n;
3402
3450
  this.stateModifier = stateModifier;
3403
3451
  this.state = state;
@@ -3456,8 +3504,9 @@ class ContextMenuItemsBuilder {
3456
3504
  }
3457
3505
  }
3458
3506
  }
3459
- else {
3460
- this.tryAppendCustomItems(items, null, this.state.definition.sequence);
3507
+ else if (!commandOrNull) {
3508
+ const rootSequence = this.workspaceApi.getRootSequence();
3509
+ this.tryAppendCustomItems(items, null, rootSequence.sequence);
3461
3510
  }
3462
3511
  items.push({
3463
3512
  label: this.i18n('contextMenu.resetView', 'Reset view'),
@@ -3471,7 +3520,7 @@ class ContextMenuItemsBuilder {
3471
3520
  }
3472
3521
  tryAppendCustomItems(items, step, parentSequence) {
3473
3522
  if (this.customMenuItemsProvider) {
3474
- const customItems = this.customMenuItemsProvider.getItems(step, parentSequence);
3523
+ const customItems = this.customMenuItemsProvider.getItems(step, parentSequence, this.state.definition);
3475
3524
  for (const customItem of customItems) {
3476
3525
  items.push(customItem);
3477
3526
  }
@@ -3562,15 +3611,11 @@ class Workspace {
3562
3611
  const clickBehaviorWrapper = designerContext.services.clickBehaviorWrapperExtension.create(designerContext.customActionController);
3563
3612
  const wheelController = designerContext.services.wheelController.create(api.viewport, api.workspace);
3564
3613
  const pinchToZoomController = PinchToZoomController.create(api.workspace, api.viewport, api.shadowRoot);
3565
- const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
3614
+ const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.workspace, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
3566
3615
  ? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
3567
3616
  : undefined);
3568
3617
  const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
3569
- const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, api.viewport, designerContext.services);
3570
- setTimeout(() => {
3571
- workspace.updateRootComponent();
3572
- api.viewport.resetViewport();
3573
- });
3618
+ const workspace = new Workspace(view, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, api.viewport, api.workspace, designerContext.services);
3574
3619
  designerContext.setWorkspaceController(workspace);
3575
3620
  designerContext.state.onViewportChanged.subscribe(workspace.onViewportChanged);
3576
3621
  race(0, designerContext.state.onDefinitionChanged, designerContext.state.onSelectedStepIdChanged, designerContext.state.onFolderPathChanged).subscribe(r => {
@@ -3580,11 +3625,11 @@ class Workspace {
3580
3625
  view.bindTouchStart(workspace.onClick, workspace.onPinchToZoom);
3581
3626
  view.bindWheel(workspace.onWheel);
3582
3627
  view.bindContextMenu(workspace.onContextMenu);
3628
+ workspace.scheduleInit();
3583
3629
  return workspace;
3584
3630
  }
3585
- constructor(view, definitionWalker, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, viewportApi, services) {
3631
+ constructor(view, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, viewportApi, workspaceApi, services) {
3586
3632
  this.view = view;
3587
- this.definitionWalker = definitionWalker;
3588
3633
  this.state = state;
3589
3634
  this.behaviorController = behaviorController;
3590
3635
  this.wheelController = wheelController;
@@ -3593,9 +3638,11 @@ class Workspace {
3593
3638
  this.clickBehaviorResolver = clickBehaviorResolver;
3594
3639
  this.clickBehaviorWrapper = clickBehaviorWrapper;
3595
3640
  this.viewportApi = viewportApi;
3641
+ this.workspaceApi = workspaceApi;
3596
3642
  this.services = services;
3597
3643
  this.onRendered = new SimpleEvent();
3598
3644
  this.isValid = false;
3645
+ this.initTimeout = null;
3599
3646
  this.selectedStepComponent = null;
3600
3647
  this.validationErrorBadgeIndex = null;
3601
3648
  this.onClick = (position, target, buttonIndex, altKey) => {
@@ -3625,28 +3672,23 @@ class Workspace {
3625
3672
  this.view.setPositionAndScale(viewport.position, viewport.scale);
3626
3673
  };
3627
3674
  }
3675
+ scheduleInit() {
3676
+ this.initTimeout = setTimeout(() => {
3677
+ this.initTimeout = null;
3678
+ this.updateRootComponent();
3679
+ this.viewportApi.resetViewport();
3680
+ });
3681
+ }
3628
3682
  updateRootComponent() {
3629
3683
  this.selectedStepComponent = null;
3630
- let parentSequencePlaceIndicator;
3631
- let sequence;
3632
- const stepId = this.state.tryGetLastStepIdFromFolderPath();
3633
- if (stepId) {
3634
- const parentSequence = this.definitionWalker.getParentSequence(this.state.definition, stepId);
3635
- const children = this.definitionWalker.getChildren(parentSequence.step);
3636
- if (!children || children.type !== sequentialWorkflowModel.StepChildrenType.sequence) {
3637
- throw new Error('Cannot find single sequence in folder step');
3684
+ const rootSequence = this.workspaceApi.getRootSequence();
3685
+ const parentPlaceIndicator = rootSequence.parentStep
3686
+ ? {
3687
+ sequence: rootSequence.parentStep.parentSequence,
3688
+ index: rootSequence.parentStep.index
3638
3689
  }
3639
- sequence = children.items;
3640
- parentSequencePlaceIndicator = {
3641
- sequence: parentSequence.parentSequence,
3642
- index: parentSequence.index
3643
- };
3644
- }
3645
- else {
3646
- sequence = this.state.definition.sequence;
3647
- parentSequencePlaceIndicator = null;
3648
- }
3649
- this.view.render(sequence, parentSequencePlaceIndicator);
3690
+ : null;
3691
+ this.view.render(rootSequence.sequence, parentPlaceIndicator);
3650
3692
  this.trySelectStepComponent(this.state.selectedStepId);
3651
3693
  this.updateBadges();
3652
3694
  this.onRendered.forward();
@@ -3688,6 +3730,10 @@ class Workspace {
3688
3730
  setTimeout(() => this.view.refreshSize());
3689
3731
  }
3690
3732
  destroy() {
3733
+ if (this.initTimeout) {
3734
+ clearTimeout(this.initTimeout);
3735
+ this.initTimeout = null;
3736
+ }
3691
3737
  this.contextMenuController.destroy();
3692
3738
  this.view.destroy();
3693
3739
  }
@@ -3785,8 +3831,8 @@ const SAFE_OFFSET = 10;
3785
3831
  class DefaultDraggedComponent {
3786
3832
  static create(parent, step, componentContext) {
3787
3833
  const canvas = Dom.svg('svg');
3788
- canvas.style.marginLeft = -SAFE_OFFSET + 'px';
3789
- canvas.style.marginTop = -SAFE_OFFSET + 'px';
3834
+ canvas.style.marginLeft = -10 + 'px';
3835
+ canvas.style.marginTop = -10 + 'px';
3790
3836
  parent.appendChild(canvas);
3791
3837
  const previewStepContext = {
3792
3838
  parentSequence: [],
@@ -4963,7 +5009,7 @@ exports.createTaskStepComponentViewFactory = createTaskStepComponentViewFactory;
4963
5009
  exports.getAbsolutePosition = getAbsolutePosition;
4964
5010
  exports.race = race;
4965
5011
  Object.keys(sequentialWorkflowModel).forEach(function (k) {
4966
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
5012
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
4967
5013
  enumerable: true,
4968
5014
  get: function () { return sequentialWorkflowModel[k]; }
4969
5015
  });