@saltcorn/workflow-editor 1.6.0-alpha.12 → 1.6.0-alpha.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/workflow-editor",
3
- "version": "1.6.0-alpha.12",
3
+ "version": "1.6.0-alpha.13",
4
4
  "description": "React Flow-based workflow editor for Saltcorn",
5
5
  "main": "index.js",
6
6
  "homepage": "https://saltcorn.com",
@@ -303,6 +303,11 @@ const buildGraph = (
303
303
  const allStepNames = steps.map((s) => s.name).filter(Boolean);
304
304
  const orderIndex = new Map(steps.map((s, idx) => [String(s.id), idx]));
305
305
 
306
+ const hasAnyWorkflowPosition = steps.some(
307
+ (s) => s?.configuration?.workflow_position
308
+ );
309
+ const shouldIndentLoopBodies = steps.length > 0 && !hasAnyWorkflowPosition;
310
+
306
311
  const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
307
312
 
308
313
  const extractNextStepNames = (rawNextStep) => {
@@ -416,6 +421,9 @@ const buildGraph = (
416
421
  width: DEFAULT_NODE_WIDTH,
417
422
  height: DEFAULT_NODE_HEIGHT,
418
423
  };
424
+ const bodyX = shouldIndentLoopBodies
425
+ ? (loopPos.x || 0) + (loopSize.width || DEFAULT_NODE_WIDTH) + H_GAP
426
+ : loopPos.x;
419
427
  let yCursor = loopPos.y + loopSize.height + V_GAP;
420
428
 
421
429
  body.forEach((s) => {
@@ -425,7 +433,7 @@ const buildGraph = (
425
433
  height: DEFAULT_NODE_HEIGHT,
426
434
  };
427
435
  positionOverrides[String(s.id)] = {
428
- x: loopPos.x,
436
+ x: bodyX,
429
437
  y: yCursor,
430
438
  };
431
439
  yCursor += bodySize.height + V_GAP;
@@ -871,7 +879,7 @@ const WorkflowEditor = ({ data }) => {
871
879
  const cardBodyEl = shellEl.closest(".card-body");
872
880
  if (!cardBodyEl) return;
873
881
 
874
- const minHeight = 320;
882
+ const minHeight = 400;
875
883
  const bottomMargin = 28;
876
884
 
877
885
  const cardBodyRect = cardBodyEl.getBoundingClientRect();