sequential-workflow-designer 0.33.1 → 0.34.1
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 +4 -4
- package/dist/index.umd.js +31 -18
- package/lib/cjs/index.cjs +31 -18
- package/lib/esm/index.js +31 -18
- package/lib/index.d.ts +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -106,10 +106,10 @@ Add the below code to your head section in HTML document.
|
|
|
106
106
|
```html
|
|
107
107
|
<head>
|
|
108
108
|
...
|
|
109
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
110
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
111
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
112
|
-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
109
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.34.1/css/designer.css" rel="stylesheet">
|
|
110
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.34.1/css/designer-light.css" rel="stylesheet">
|
|
111
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.34.1/css/designer-dark.css" rel="stylesheet">
|
|
112
|
+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.34.1/dist/index.umd.js"></script>
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
Call the designer by:
|
package/dist/index.umd.js
CHANGED
|
@@ -759,7 +759,7 @@
|
|
|
759
759
|
const clientPosition = component.view.getClientPosition();
|
|
760
760
|
const componentPosition = clientPosition.subtract(canvasPosition);
|
|
761
761
|
const componentSize = new Vector(component.view.width, component.view.height);
|
|
762
|
-
const viewport = this.viewportController.getFocusedOnComponent(componentPosition, componentSize);
|
|
762
|
+
const viewport = this.viewportController.getFocusedOnComponent(componentPosition, componentSize, component.step.componentType, component.view.g);
|
|
763
763
|
this.animator.execute(viewport);
|
|
764
764
|
}
|
|
765
765
|
handleWheelEvent(e) {
|
|
@@ -1684,11 +1684,16 @@
|
|
|
1684
1684
|
return regionView.getClientPosition();
|
|
1685
1685
|
},
|
|
1686
1686
|
resolveClick(click) {
|
|
1687
|
-
|
|
1688
|
-
|
|
1687
|
+
if (cfg.isRegionClickable) {
|
|
1688
|
+
const result = regionView.resolveClick(click);
|
|
1689
|
+
if (result !== null) {
|
|
1690
|
+
return result;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
return labelView.g.contains(click.element) || (inputView && inputView.g.contains(click.element)) ? true : null;
|
|
1689
1694
|
},
|
|
1690
1695
|
setIsDragging(isDragging) {
|
|
1691
|
-
if (cfg.autoHideInputOnDrag
|
|
1696
|
+
if (inputView && cfg.autoHideInputOnDrag) {
|
|
1692
1697
|
inputView.setIsHidden(isDragging);
|
|
1693
1698
|
}
|
|
1694
1699
|
},
|
|
@@ -1846,7 +1851,7 @@
|
|
|
1846
1851
|
};
|
|
1847
1852
|
|
|
1848
1853
|
const COMPONENT_CLASS_NAME$1 = 'switch';
|
|
1849
|
-
function createView(g, width, height, joinX, viewContext, sequenceComponents, regionView, cfg) {
|
|
1854
|
+
function createView(g, width, height, joinX, viewContext, sequenceComponents, labelViews, regionView, cfg) {
|
|
1850
1855
|
let inputView = null;
|
|
1851
1856
|
if (cfg.inputSize > 0) {
|
|
1852
1857
|
const iconUrl = viewContext.getStepIconUrl();
|
|
@@ -1864,11 +1869,16 @@
|
|
|
1864
1869
|
return regionView.getClientPosition();
|
|
1865
1870
|
},
|
|
1866
1871
|
resolveClick(click) {
|
|
1867
|
-
|
|
1868
|
-
|
|
1872
|
+
if (cfg.isRegionClickable) {
|
|
1873
|
+
const result = regionView.resolveClick(click);
|
|
1874
|
+
if (result !== null) {
|
|
1875
|
+
return result;
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
return labelViews.some(v => v.g.contains(click.element) || (inputView && inputView.g.contains(click.element))) ? true : null;
|
|
1869
1879
|
},
|
|
1870
1880
|
setIsDragging(isDragging) {
|
|
1871
|
-
if (cfg.autoHideInputOnDrag
|
|
1881
|
+
if (inputView && cfg.autoHideInputOnDrag) {
|
|
1872
1882
|
inputView.setIsHidden(isDragging);
|
|
1873
1883
|
}
|
|
1874
1884
|
},
|
|
@@ -1894,14 +1904,15 @@
|
|
|
1894
1904
|
const regionView = regionViewBuilder(g, [width], height);
|
|
1895
1905
|
Dom.translate(nameLabelView.g, joinX, 0);
|
|
1896
1906
|
JoinView.createStraightJoin(g, new Vector(joinX, 0), height);
|
|
1897
|
-
return createView(g, width, height, joinX, viewContext, null, regionView, cfg);
|
|
1907
|
+
return createView(g, width, height, joinX, viewContext, null, [nameLabelView], regionView, cfg);
|
|
1898
1908
|
}
|
|
1899
|
-
const branchComponents =
|
|
1900
|
-
const
|
|
1901
|
-
const
|
|
1909
|
+
const branchComponents = new Array(branchNames.length);
|
|
1910
|
+
const branchSizes = new Array(branchNames.length);
|
|
1911
|
+
const labelViews = new Array(branchNames.length + 1);
|
|
1912
|
+
labelViews[branchNames.length] = nameLabelView;
|
|
1902
1913
|
let totalBranchesWidth = 0;
|
|
1903
1914
|
let maxBranchesHeight = 0;
|
|
1904
|
-
branchNames.forEach(branchName => {
|
|
1915
|
+
branchNames.forEach((branchName, i) => {
|
|
1905
1916
|
const labelY = paddingTop + cfg.nameLabel.height + cfg.connectionHeight;
|
|
1906
1917
|
const translatedBranchName = viewContext.i18n(`stepComponent.${step.type}.branchName`, branchName);
|
|
1907
1918
|
const labelView = LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');
|
|
@@ -1914,9 +1925,9 @@
|
|
|
1914
1925
|
const offsetX = totalBranchesWidth;
|
|
1915
1926
|
totalBranchesWidth += width;
|
|
1916
1927
|
maxBranchesHeight = Math.max(maxBranchesHeight, component.view.height);
|
|
1917
|
-
branchComponents
|
|
1918
|
-
|
|
1919
|
-
|
|
1928
|
+
branchComponents[i] = component;
|
|
1929
|
+
branchSizes[i] = { width, branchOffsetLeft, offsetX, joinX };
|
|
1930
|
+
labelViews[i] = labelView;
|
|
1920
1931
|
});
|
|
1921
1932
|
const centerBranchIndex = Math.floor(branchNames.length / 2);
|
|
1922
1933
|
const centerBranchSize = branchSizes[centerBranchIndex];
|
|
@@ -1935,7 +1946,7 @@
|
|
|
1935
1946
|
branchComponents.forEach((component, i) => {
|
|
1936
1947
|
const branchSize = branchSizes[i];
|
|
1937
1948
|
const branchOffsetLeft = switchOffsetLeft + branchSize.offsetX + branchSize.branchOffsetLeft;
|
|
1938
|
-
Dom.translate(
|
|
1949
|
+
Dom.translate(labelViews[i].g, switchOffsetLeft + branchSize.offsetX + branchSize.joinX, 0);
|
|
1939
1950
|
Dom.translate(component.view.g, branchOffsetLeft, branchOffsetTop);
|
|
1940
1951
|
if (component.hasOutput && stepContext.isOutputConnected) {
|
|
1941
1952
|
const endOffsetTopOfComponent = paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight + component.view.height;
|
|
@@ -1963,7 +1974,7 @@
|
|
|
1963
1974
|
regions[0] += switchOffsetLeft;
|
|
1964
1975
|
regions[regions.length - 1] += switchOffsetRight;
|
|
1965
1976
|
const regionView = regionViewBuilder(g, regions, viewHeight);
|
|
1966
|
-
return createView(g, viewWidth, viewHeight, shiftedJoinX, viewContext, branchComponents, regionView, cfg);
|
|
1977
|
+
return createView(g, viewWidth, viewHeight, shiftedJoinX, viewContext, branchComponents, labelViews, regionView, cfg);
|
|
1967
1978
|
});
|
|
1968
1979
|
};
|
|
1969
1980
|
|
|
@@ -2533,6 +2544,7 @@
|
|
|
2533
2544
|
inputRadius: 4,
|
|
2534
2545
|
inputIconSize: 14,
|
|
2535
2546
|
autoHideInputOnDrag: true,
|
|
2547
|
+
isRegionClickable: true,
|
|
2536
2548
|
label: {
|
|
2537
2549
|
height: 22,
|
|
2538
2550
|
paddingX: 10,
|
|
@@ -2563,6 +2575,7 @@
|
|
|
2563
2575
|
inputIconSize: 14,
|
|
2564
2576
|
inputRadius: 4,
|
|
2565
2577
|
autoHideInputOnDrag: true,
|
|
2578
|
+
isRegionClickable: true,
|
|
2566
2579
|
branchNameLabel: {
|
|
2567
2580
|
height: 22,
|
|
2568
2581
|
paddingX: 10,
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -757,7 +757,7 @@ class ViewportApi {
|
|
|
757
757
|
const clientPosition = component.view.getClientPosition();
|
|
758
758
|
const componentPosition = clientPosition.subtract(canvasPosition);
|
|
759
759
|
const componentSize = new Vector(component.view.width, component.view.height);
|
|
760
|
-
const viewport = this.viewportController.getFocusedOnComponent(componentPosition, componentSize);
|
|
760
|
+
const viewport = this.viewportController.getFocusedOnComponent(componentPosition, componentSize, component.step.componentType, component.view.g);
|
|
761
761
|
this.animator.execute(viewport);
|
|
762
762
|
}
|
|
763
763
|
handleWheelEvent(e) {
|
|
@@ -1499,11 +1499,16 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1499
1499
|
return regionView.getClientPosition();
|
|
1500
1500
|
},
|
|
1501
1501
|
resolveClick(click) {
|
|
1502
|
-
|
|
1503
|
-
|
|
1502
|
+
if (cfg.isRegionClickable) {
|
|
1503
|
+
const result = regionView.resolveClick(click);
|
|
1504
|
+
if (result !== null) {
|
|
1505
|
+
return result;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
return labelView.g.contains(click.element) || (inputView && inputView.g.contains(click.element)) ? true : null;
|
|
1504
1509
|
},
|
|
1505
1510
|
setIsDragging(isDragging) {
|
|
1506
|
-
if (cfg.autoHideInputOnDrag
|
|
1511
|
+
if (inputView && cfg.autoHideInputOnDrag) {
|
|
1507
1512
|
inputView.setIsHidden(isDragging);
|
|
1508
1513
|
}
|
|
1509
1514
|
},
|
|
@@ -1661,7 +1666,7 @@ const createLaunchPadStepComponentViewFactory = (isInterruptedIfEmpty, cfg) => (
|
|
|
1661
1666
|
};
|
|
1662
1667
|
|
|
1663
1668
|
const COMPONENT_CLASS_NAME$1 = 'switch';
|
|
1664
|
-
function createView(g, width, height, joinX, viewContext, sequenceComponents, regionView, cfg) {
|
|
1669
|
+
function createView(g, width, height, joinX, viewContext, sequenceComponents, labelViews, regionView, cfg) {
|
|
1665
1670
|
let inputView = null;
|
|
1666
1671
|
if (cfg.inputSize > 0) {
|
|
1667
1672
|
const iconUrl = viewContext.getStepIconUrl();
|
|
@@ -1679,11 +1684,16 @@ function createView(g, width, height, joinX, viewContext, sequenceComponents, re
|
|
|
1679
1684
|
return regionView.getClientPosition();
|
|
1680
1685
|
},
|
|
1681
1686
|
resolveClick(click) {
|
|
1682
|
-
|
|
1683
|
-
|
|
1687
|
+
if (cfg.isRegionClickable) {
|
|
1688
|
+
const result = regionView.resolveClick(click);
|
|
1689
|
+
if (result !== null) {
|
|
1690
|
+
return result;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
return labelViews.some(v => v.g.contains(click.element) || (inputView && inputView.g.contains(click.element))) ? true : null;
|
|
1684
1694
|
},
|
|
1685
1695
|
setIsDragging(isDragging) {
|
|
1686
|
-
if (cfg.autoHideInputOnDrag
|
|
1696
|
+
if (inputView && cfg.autoHideInputOnDrag) {
|
|
1687
1697
|
inputView.setIsHidden(isDragging);
|
|
1688
1698
|
}
|
|
1689
1699
|
},
|
|
@@ -1709,14 +1719,15 @@ const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (paren
|
|
|
1709
1719
|
const regionView = regionViewBuilder(g, [width], height);
|
|
1710
1720
|
Dom.translate(nameLabelView.g, joinX, 0);
|
|
1711
1721
|
JoinView.createStraightJoin(g, new Vector(joinX, 0), height);
|
|
1712
|
-
return createView(g, width, height, joinX, viewContext, null, regionView, cfg);
|
|
1722
|
+
return createView(g, width, height, joinX, viewContext, null, [nameLabelView], regionView, cfg);
|
|
1713
1723
|
}
|
|
1714
|
-
const branchComponents =
|
|
1715
|
-
const
|
|
1716
|
-
const
|
|
1724
|
+
const branchComponents = new Array(branchNames.length);
|
|
1725
|
+
const branchSizes = new Array(branchNames.length);
|
|
1726
|
+
const labelViews = new Array(branchNames.length + 1);
|
|
1727
|
+
labelViews[branchNames.length] = nameLabelView;
|
|
1717
1728
|
let totalBranchesWidth = 0;
|
|
1718
1729
|
let maxBranchesHeight = 0;
|
|
1719
|
-
branchNames.forEach(branchName => {
|
|
1730
|
+
branchNames.forEach((branchName, i) => {
|
|
1720
1731
|
const labelY = paddingTop + cfg.nameLabel.height + cfg.connectionHeight;
|
|
1721
1732
|
const translatedBranchName = viewContext.i18n(`stepComponent.${step.type}.branchName`, branchName);
|
|
1722
1733
|
const labelView = LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');
|
|
@@ -1729,9 +1740,9 @@ const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (paren
|
|
|
1729
1740
|
const offsetX = totalBranchesWidth;
|
|
1730
1741
|
totalBranchesWidth += width;
|
|
1731
1742
|
maxBranchesHeight = Math.max(maxBranchesHeight, component.view.height);
|
|
1732
|
-
branchComponents
|
|
1733
|
-
|
|
1734
|
-
|
|
1743
|
+
branchComponents[i] = component;
|
|
1744
|
+
branchSizes[i] = { width, branchOffsetLeft, offsetX, joinX };
|
|
1745
|
+
labelViews[i] = labelView;
|
|
1735
1746
|
});
|
|
1736
1747
|
const centerBranchIndex = Math.floor(branchNames.length / 2);
|
|
1737
1748
|
const centerBranchSize = branchSizes[centerBranchIndex];
|
|
@@ -1750,7 +1761,7 @@ const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (paren
|
|
|
1750
1761
|
branchComponents.forEach((component, i) => {
|
|
1751
1762
|
const branchSize = branchSizes[i];
|
|
1752
1763
|
const branchOffsetLeft = switchOffsetLeft + branchSize.offsetX + branchSize.branchOffsetLeft;
|
|
1753
|
-
Dom.translate(
|
|
1764
|
+
Dom.translate(labelViews[i].g, switchOffsetLeft + branchSize.offsetX + branchSize.joinX, 0);
|
|
1754
1765
|
Dom.translate(component.view.g, branchOffsetLeft, branchOffsetTop);
|
|
1755
1766
|
if (component.hasOutput && stepContext.isOutputConnected) {
|
|
1756
1767
|
const endOffsetTopOfComponent = paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight + component.view.height;
|
|
@@ -1778,7 +1789,7 @@ const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (paren
|
|
|
1778
1789
|
regions[0] += switchOffsetLeft;
|
|
1779
1790
|
regions[regions.length - 1] += switchOffsetRight;
|
|
1780
1791
|
const regionView = regionViewBuilder(g, regions, viewHeight);
|
|
1781
|
-
return createView(g, viewWidth, viewHeight, shiftedJoinX, viewContext, branchComponents, regionView, cfg);
|
|
1792
|
+
return createView(g, viewWidth, viewHeight, shiftedJoinX, viewContext, branchComponents, labelViews, regionView, cfg);
|
|
1782
1793
|
});
|
|
1783
1794
|
};
|
|
1784
1795
|
|
|
@@ -2348,6 +2359,7 @@ const defaultConfiguration$1 = {
|
|
|
2348
2359
|
inputRadius: 4,
|
|
2349
2360
|
inputIconSize: 14,
|
|
2350
2361
|
autoHideInputOnDrag: true,
|
|
2362
|
+
isRegionClickable: true,
|
|
2351
2363
|
label: {
|
|
2352
2364
|
height: 22,
|
|
2353
2365
|
paddingX: 10,
|
|
@@ -2378,6 +2390,7 @@ const defaultViewConfiguration$1 = {
|
|
|
2378
2390
|
inputIconSize: 14,
|
|
2379
2391
|
inputRadius: 4,
|
|
2380
2392
|
autoHideInputOnDrag: true,
|
|
2393
|
+
isRegionClickable: true,
|
|
2381
2394
|
branchNameLabel: {
|
|
2382
2395
|
height: 22,
|
|
2383
2396
|
paddingX: 10,
|
package/lib/esm/index.js
CHANGED
|
@@ -756,7 +756,7 @@ class ViewportApi {
|
|
|
756
756
|
const clientPosition = component.view.getClientPosition();
|
|
757
757
|
const componentPosition = clientPosition.subtract(canvasPosition);
|
|
758
758
|
const componentSize = new Vector(component.view.width, component.view.height);
|
|
759
|
-
const viewport = this.viewportController.getFocusedOnComponent(componentPosition, componentSize);
|
|
759
|
+
const viewport = this.viewportController.getFocusedOnComponent(componentPosition, componentSize, component.step.componentType, component.view.g);
|
|
760
760
|
this.animator.execute(viewport);
|
|
761
761
|
}
|
|
762
762
|
handleWheelEvent(e) {
|
|
@@ -1498,11 +1498,16 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1498
1498
|
return regionView.getClientPosition();
|
|
1499
1499
|
},
|
|
1500
1500
|
resolveClick(click) {
|
|
1501
|
-
|
|
1502
|
-
|
|
1501
|
+
if (cfg.isRegionClickable) {
|
|
1502
|
+
const result = regionView.resolveClick(click);
|
|
1503
|
+
if (result !== null) {
|
|
1504
|
+
return result;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
return labelView.g.contains(click.element) || (inputView && inputView.g.contains(click.element)) ? true : null;
|
|
1503
1508
|
},
|
|
1504
1509
|
setIsDragging(isDragging) {
|
|
1505
|
-
if (cfg.autoHideInputOnDrag
|
|
1510
|
+
if (inputView && cfg.autoHideInputOnDrag) {
|
|
1506
1511
|
inputView.setIsHidden(isDragging);
|
|
1507
1512
|
}
|
|
1508
1513
|
},
|
|
@@ -1660,7 +1665,7 @@ const createLaunchPadStepComponentViewFactory = (isInterruptedIfEmpty, cfg) => (
|
|
|
1660
1665
|
};
|
|
1661
1666
|
|
|
1662
1667
|
const COMPONENT_CLASS_NAME$1 = 'switch';
|
|
1663
|
-
function createView(g, width, height, joinX, viewContext, sequenceComponents, regionView, cfg) {
|
|
1668
|
+
function createView(g, width, height, joinX, viewContext, sequenceComponents, labelViews, regionView, cfg) {
|
|
1664
1669
|
let inputView = null;
|
|
1665
1670
|
if (cfg.inputSize > 0) {
|
|
1666
1671
|
const iconUrl = viewContext.getStepIconUrl();
|
|
@@ -1678,11 +1683,16 @@ function createView(g, width, height, joinX, viewContext, sequenceComponents, re
|
|
|
1678
1683
|
return regionView.getClientPosition();
|
|
1679
1684
|
},
|
|
1680
1685
|
resolveClick(click) {
|
|
1681
|
-
|
|
1682
|
-
|
|
1686
|
+
if (cfg.isRegionClickable) {
|
|
1687
|
+
const result = regionView.resolveClick(click);
|
|
1688
|
+
if (result !== null) {
|
|
1689
|
+
return result;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
return labelViews.some(v => v.g.contains(click.element) || (inputView && inputView.g.contains(click.element))) ? true : null;
|
|
1683
1693
|
},
|
|
1684
1694
|
setIsDragging(isDragging) {
|
|
1685
|
-
if (cfg.autoHideInputOnDrag
|
|
1695
|
+
if (inputView && cfg.autoHideInputOnDrag) {
|
|
1686
1696
|
inputView.setIsHidden(isDragging);
|
|
1687
1697
|
}
|
|
1688
1698
|
},
|
|
@@ -1708,14 +1718,15 @@ const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (paren
|
|
|
1708
1718
|
const regionView = regionViewBuilder(g, [width], height);
|
|
1709
1719
|
Dom.translate(nameLabelView.g, joinX, 0);
|
|
1710
1720
|
JoinView.createStraightJoin(g, new Vector(joinX, 0), height);
|
|
1711
|
-
return createView(g, width, height, joinX, viewContext, null, regionView, cfg);
|
|
1721
|
+
return createView(g, width, height, joinX, viewContext, null, [nameLabelView], regionView, cfg);
|
|
1712
1722
|
}
|
|
1713
|
-
const branchComponents =
|
|
1714
|
-
const
|
|
1715
|
-
const
|
|
1723
|
+
const branchComponents = new Array(branchNames.length);
|
|
1724
|
+
const branchSizes = new Array(branchNames.length);
|
|
1725
|
+
const labelViews = new Array(branchNames.length + 1);
|
|
1726
|
+
labelViews[branchNames.length] = nameLabelView;
|
|
1716
1727
|
let totalBranchesWidth = 0;
|
|
1717
1728
|
let maxBranchesHeight = 0;
|
|
1718
|
-
branchNames.forEach(branchName => {
|
|
1729
|
+
branchNames.forEach((branchName, i) => {
|
|
1719
1730
|
const labelY = paddingTop + cfg.nameLabel.height + cfg.connectionHeight;
|
|
1720
1731
|
const translatedBranchName = viewContext.i18n(`stepComponent.${step.type}.branchName`, branchName);
|
|
1721
1732
|
const labelView = LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');
|
|
@@ -1728,9 +1739,9 @@ const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (paren
|
|
|
1728
1739
|
const offsetX = totalBranchesWidth;
|
|
1729
1740
|
totalBranchesWidth += width;
|
|
1730
1741
|
maxBranchesHeight = Math.max(maxBranchesHeight, component.view.height);
|
|
1731
|
-
branchComponents
|
|
1732
|
-
|
|
1733
|
-
|
|
1742
|
+
branchComponents[i] = component;
|
|
1743
|
+
branchSizes[i] = { width, branchOffsetLeft, offsetX, joinX };
|
|
1744
|
+
labelViews[i] = labelView;
|
|
1734
1745
|
});
|
|
1735
1746
|
const centerBranchIndex = Math.floor(branchNames.length / 2);
|
|
1736
1747
|
const centerBranchSize = branchSizes[centerBranchIndex];
|
|
@@ -1749,7 +1760,7 @@ const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (paren
|
|
|
1749
1760
|
branchComponents.forEach((component, i) => {
|
|
1750
1761
|
const branchSize = branchSizes[i];
|
|
1751
1762
|
const branchOffsetLeft = switchOffsetLeft + branchSize.offsetX + branchSize.branchOffsetLeft;
|
|
1752
|
-
Dom.translate(
|
|
1763
|
+
Dom.translate(labelViews[i].g, switchOffsetLeft + branchSize.offsetX + branchSize.joinX, 0);
|
|
1753
1764
|
Dom.translate(component.view.g, branchOffsetLeft, branchOffsetTop);
|
|
1754
1765
|
if (component.hasOutput && stepContext.isOutputConnected) {
|
|
1755
1766
|
const endOffsetTopOfComponent = paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight + component.view.height;
|
|
@@ -1777,7 +1788,7 @@ const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (paren
|
|
|
1777
1788
|
regions[0] += switchOffsetLeft;
|
|
1778
1789
|
regions[regions.length - 1] += switchOffsetRight;
|
|
1779
1790
|
const regionView = regionViewBuilder(g, regions, viewHeight);
|
|
1780
|
-
return createView(g, viewWidth, viewHeight, shiftedJoinX, viewContext, branchComponents, regionView, cfg);
|
|
1791
|
+
return createView(g, viewWidth, viewHeight, shiftedJoinX, viewContext, branchComponents, labelViews, regionView, cfg);
|
|
1781
1792
|
});
|
|
1782
1793
|
};
|
|
1783
1794
|
|
|
@@ -2347,6 +2358,7 @@ const defaultConfiguration$1 = {
|
|
|
2347
2358
|
inputRadius: 4,
|
|
2348
2359
|
inputIconSize: 14,
|
|
2349
2360
|
autoHideInputOnDrag: true,
|
|
2361
|
+
isRegionClickable: true,
|
|
2350
2362
|
label: {
|
|
2351
2363
|
height: 22,
|
|
2352
2364
|
paddingX: 10,
|
|
@@ -2377,6 +2389,7 @@ const defaultViewConfiguration$1 = {
|
|
|
2377
2389
|
inputIconSize: 14,
|
|
2378
2390
|
inputRadius: 4,
|
|
2379
2391
|
autoHideInputOnDrag: true,
|
|
2392
|
+
isRegionClickable: true,
|
|
2380
2393
|
branchNameLabel: {
|
|
2381
2394
|
height: 22,
|
|
2382
2395
|
paddingX: 10,
|
package/lib/index.d.ts
CHANGED
|
@@ -652,6 +652,10 @@ interface ContainerStepComponentViewConfiguration {
|
|
|
652
652
|
inputIconSize: number;
|
|
653
653
|
autoHideInputOnDrag: boolean;
|
|
654
654
|
label: LabelViewConfiguration;
|
|
655
|
+
/**
|
|
656
|
+
* If `true`, the entire region of the switch step is clickable; otherwise, only the labels and icon are clickable.
|
|
657
|
+
*/
|
|
658
|
+
isRegionClickable: boolean;
|
|
655
659
|
}
|
|
656
660
|
|
|
657
661
|
interface ContainerStepExtensionConfiguration {
|
|
@@ -700,6 +704,10 @@ interface SwitchStepComponentViewConfiguration {
|
|
|
700
704
|
noBranchPaddingBottom: number;
|
|
701
705
|
inputSize: number;
|
|
702
706
|
inputIconSize: number;
|
|
707
|
+
/**
|
|
708
|
+
* If `true`, the entire region of the switch step is clickable; otherwise, only the labels and icon are clickable.
|
|
709
|
+
*/
|
|
710
|
+
isRegionClickable: boolean;
|
|
703
711
|
autoHideInputOnDrag: boolean;
|
|
704
712
|
inputRadius: number;
|
|
705
713
|
nameLabel: LabelViewConfiguration;
|
|
@@ -964,7 +972,7 @@ interface ViewportController {
|
|
|
964
972
|
smoothDeltaYLimit: number;
|
|
965
973
|
getDefault(): Viewport;
|
|
966
974
|
getZoomed(direction: boolean): Viewport | null;
|
|
967
|
-
getFocusedOnComponent(componentPosition: Vector, componentSize: Vector): Viewport;
|
|
975
|
+
getFocusedOnComponent(componentPosition: Vector, componentSize: Vector, componentType: string, componentElement: SVGElement): Viewport;
|
|
968
976
|
getNextScale(scale: number, direction: boolean): NextScale;
|
|
969
977
|
limitScale(scale: number): number;
|
|
970
978
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sequential-workflow-designer",
|
|
3
3
|
"description": "Customizable no-code component for building flow-based programming applications.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.34.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|