@saltcorn/workflow-editor 1.6.0-alpha.12 → 1.6.0-alpha.14
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/dist/workflow_bundle.js +1 -1
- package/dist/workflow_bundle.js.map +1 -1
- package/package.json +1 -1
- package/src/WorkflowEditor.jsx +25 -18
package/package.json
CHANGED
package/src/WorkflowEditor.jsx
CHANGED
|
@@ -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:
|
|
436
|
+
x: bodyX,
|
|
429
437
|
y: yCursor,
|
|
430
438
|
};
|
|
431
439
|
yCursor += bodySize.height + V_GAP;
|
|
@@ -784,21 +792,20 @@ const StepDrawer = ({
|
|
|
784
792
|
<button className="btn btn-secondary" onClick={onClose}>
|
|
785
793
|
Close
|
|
786
794
|
</button>
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
)}
|
|
795
|
+
|
|
796
|
+
<button
|
|
797
|
+
className="btn btn-primary"
|
|
798
|
+
onClick={() =>
|
|
799
|
+
innerRef.current
|
|
800
|
+
?.querySelector("form")
|
|
801
|
+
?.dispatchEvent(
|
|
802
|
+
new Event("submit", { cancelable: true, bubbles: true })
|
|
803
|
+
)
|
|
804
|
+
}
|
|
805
|
+
disabled={submitting}
|
|
806
|
+
>
|
|
807
|
+
{submitting ? "Saving..." : "Save"}
|
|
808
|
+
</button>
|
|
802
809
|
</div>
|
|
803
810
|
</>
|
|
804
811
|
) : null}
|
|
@@ -871,7 +878,7 @@ const WorkflowEditor = ({ data }) => {
|
|
|
871
878
|
const cardBodyEl = shellEl.closest(".card-body");
|
|
872
879
|
if (!cardBodyEl) return;
|
|
873
880
|
|
|
874
|
-
const minHeight =
|
|
881
|
+
const minHeight = 400;
|
|
875
882
|
const bottomMargin = 28;
|
|
876
883
|
|
|
877
884
|
const cardBodyRect = cardBodyEl.getBoundingClientRect();
|
|
@@ -1509,7 +1516,7 @@ const WorkflowEditor = ({ data }) => {
|
|
|
1509
1516
|
autoSavingRef.current = true;
|
|
1510
1517
|
try {
|
|
1511
1518
|
await submitStepForm(formEl, { closeOnSuccess: false });
|
|
1512
|
-
} catch (err) {
|
|
1519
|
+
} catch (err) {
|
|
1513
1520
|
setError(err.message);
|
|
1514
1521
|
} finally {
|
|
1515
1522
|
autoSavingRef.current = false;
|