sequential-workflow-designer 0.19.2 → 0.19.4
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 +56 -51
- package/lib/cjs/index.cjs +56 -51
- package/lib/esm/index.js +56 -52
- package/lib/index.d.ts +14 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ Pro:
|
|
|
43
43
|
* [🍬 Custom Theme Flat](https://nocode-js.com/examples/sequential-workflow-designer-pro/webpack-pro-app/public/custom-theme-flat.html)
|
|
44
44
|
* [🌹 Custom Step Types](https://nocode-js.com/examples/sequential-workflow-designer-pro/webpack-pro-app/public/custom-step-types.html)
|
|
45
45
|
* [📺 Popup Editor](https://nocode-js.com/examples/sequential-workflow-designer-pro/webpack-pro-app/public/popup-editor.html)
|
|
46
|
+
* [💼 Copy Paste](https://nocode-js.com/examples/sequential-workflow-designer-pro/webpack-pro-app/public/copy-paste.html)
|
|
46
47
|
* [👈 Goto](https://nocode-js.com/examples/sequential-workflow-designer-pro/webpack-pro-app/public/goto.html)
|
|
47
48
|
* [📁 Folders](https://nocode-js.com/examples/sequential-workflow-designer-pro/webpack-pro-app/public/folders.html)
|
|
48
49
|
* [⭕ Wheel Mode](https://nocode-js.com/examples/sequential-workflow-designer-pro/webpack-pro-app/public/wheel-mode.html)
|
|
@@ -99,10 +100,10 @@ Add the below code to your head section in HTML document.
|
|
|
99
100
|
```html
|
|
100
101
|
<head>
|
|
101
102
|
...
|
|
102
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.19.
|
|
103
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.19.
|
|
104
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.19.
|
|
105
|
-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.19.
|
|
103
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.19.4/css/designer.css" rel="stylesheet">
|
|
104
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.19.4/css/designer-light.css" rel="stylesheet">
|
|
105
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.19.4/css/designer-dark.css" rel="stylesheet">
|
|
106
|
+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.19.4/dist/index.umd.js"></script>
|
|
106
107
|
```
|
|
107
108
|
|
|
108
109
|
Call the designer by:
|
package/dist/index.umd.js
CHANGED
|
@@ -1140,6 +1140,15 @@
|
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
1142
|
|
|
1143
|
+
class ComponentDom {
|
|
1144
|
+
static stepG(componentClassName, type, id) {
|
|
1145
|
+
return Dom.svg('g', {
|
|
1146
|
+
class: `sqd-step-${componentClassName} sqd-type-${type}`,
|
|
1147
|
+
'data-step-id': id
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1143
1152
|
class InputView {
|
|
1144
1153
|
static createRectInput(parent, x, y, size, iconSize, iconUrl) {
|
|
1145
1154
|
const g = Dom.svg('g');
|
|
@@ -1345,43 +1354,6 @@
|
|
|
1345
1354
|
return line;
|
|
1346
1355
|
}
|
|
1347
1356
|
|
|
1348
|
-
class RectPlaceholderView {
|
|
1349
|
-
static create(parent, width, height, radius, iconSize, direction) {
|
|
1350
|
-
const g = Dom.svg('g', {
|
|
1351
|
-
visibility: 'hidden',
|
|
1352
|
-
class: 'sqd-placeholder'
|
|
1353
|
-
});
|
|
1354
|
-
parent.appendChild(g);
|
|
1355
|
-
const rect = Dom.svg('rect', {
|
|
1356
|
-
class: 'sqd-placeholder-rect',
|
|
1357
|
-
width,
|
|
1358
|
-
height,
|
|
1359
|
-
rx: radius,
|
|
1360
|
-
ry: radius
|
|
1361
|
-
});
|
|
1362
|
-
g.appendChild(rect);
|
|
1363
|
-
if (direction) {
|
|
1364
|
-
const iconD = direction === exports.PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;
|
|
1365
|
-
const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);
|
|
1366
|
-
Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);
|
|
1367
|
-
}
|
|
1368
|
-
parent.appendChild(g);
|
|
1369
|
-
return new RectPlaceholderView(rect, g);
|
|
1370
|
-
}
|
|
1371
|
-
constructor(rect, g) {
|
|
1372
|
-
this.rect = rect;
|
|
1373
|
-
this.g = g;
|
|
1374
|
-
}
|
|
1375
|
-
setIsHover(isHover) {
|
|
1376
|
-
Dom.toggleClass(this.g, isHover, 'sqd-hover');
|
|
1377
|
-
}
|
|
1378
|
-
setIsVisible(isVisible) {
|
|
1379
|
-
Dom.attrs(this.g, {
|
|
1380
|
-
visibility: isVisible ? 'visible' : 'hidden'
|
|
1381
|
-
});
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
1357
|
class DefaultSequenceComponentView {
|
|
1386
1358
|
static create(parent, sequenceContext, componentContext) {
|
|
1387
1359
|
const phWidth = componentContext.services.placeholder.gapSize.x;
|
|
@@ -1510,9 +1482,7 @@
|
|
|
1510
1482
|
|
|
1511
1483
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1512
1484
|
const { step } = stepContext;
|
|
1513
|
-
const g =
|
|
1514
|
-
class: `sqd-step-container sqd-type-${step.type}`
|
|
1515
|
-
});
|
|
1485
|
+
const g = ComponentDom.stepG('container', step.type, step.id);
|
|
1516
1486
|
parentElement.appendChild(g);
|
|
1517
1487
|
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, step.name, 'primary');
|
|
1518
1488
|
const sequenceComponent = viewContext.createSequenceComponent(g, step.sequence);
|
|
@@ -1558,9 +1528,7 @@
|
|
|
1558
1528
|
|
|
1559
1529
|
const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
|
|
1560
1530
|
const { step } = stepContext;
|
|
1561
|
-
const g =
|
|
1562
|
-
class: `sqd-step-switch sqd-type-${step.type}`
|
|
1563
|
-
});
|
|
1531
|
+
const g = ComponentDom.stepG('switch', step.type, step.id);
|
|
1564
1532
|
parent.appendChild(g);
|
|
1565
1533
|
const branchNames = Object.keys(step.branches);
|
|
1566
1534
|
const branchComponents = branchNames.map(branchName => {
|
|
@@ -1661,9 +1629,7 @@
|
|
|
1661
1629
|
|
|
1662
1630
|
const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1663
1631
|
const { step } = stepContext;
|
|
1664
|
-
const g =
|
|
1665
|
-
class: `sqd-step-task sqd-type-${step.type}`
|
|
1666
|
-
});
|
|
1632
|
+
const g = ComponentDom.stepG('task', step.type, step.id);
|
|
1667
1633
|
parentElement.appendChild(g);
|
|
1668
1634
|
const boxHeight = cfg.paddingY * 2 + cfg.iconSize;
|
|
1669
1635
|
const text = Dom.svg('text', {
|
|
@@ -1786,7 +1752,7 @@
|
|
|
1786
1752
|
}
|
|
1787
1753
|
|
|
1788
1754
|
const SCALES = [0.06, 0.08, 0.1, 0.12, 0.16, 0.2, 0.26, 0.32, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
|
|
1789
|
-
const MAX_DELTA_Y = 16;
|
|
1755
|
+
const MAX_DELTA_Y$1 = 16;
|
|
1790
1756
|
const quantifiedScale = new NextQuantifiedNumber(SCALES);
|
|
1791
1757
|
class QuantifiedScaleViewportCalculator {
|
|
1792
1758
|
static zoom(current, direction) {
|
|
@@ -1803,8 +1769,8 @@
|
|
|
1803
1769
|
const nextScale = quantifiedScale.next(current.scale, e.deltaY < 0);
|
|
1804
1770
|
let scale;
|
|
1805
1771
|
const absDeltaY = Math.abs(e.deltaY);
|
|
1806
|
-
if (absDeltaY < MAX_DELTA_Y) {
|
|
1807
|
-
const fraction = absDeltaY / MAX_DELTA_Y;
|
|
1772
|
+
if (absDeltaY < MAX_DELTA_Y$1) {
|
|
1773
|
+
const fraction = absDeltaY / MAX_DELTA_Y$1;
|
|
1808
1774
|
const step = nextScale.next - nextScale.current;
|
|
1809
1775
|
scale = current.scale + step * fraction;
|
|
1810
1776
|
}
|
|
@@ -1943,6 +1909,43 @@
|
|
|
1943
1909
|
}
|
|
1944
1910
|
}
|
|
1945
1911
|
|
|
1912
|
+
class RectPlaceholderView {
|
|
1913
|
+
static create(parent, width, height, radius, iconSize, direction) {
|
|
1914
|
+
const g = Dom.svg('g', {
|
|
1915
|
+
visibility: 'hidden',
|
|
1916
|
+
class: 'sqd-placeholder'
|
|
1917
|
+
});
|
|
1918
|
+
parent.appendChild(g);
|
|
1919
|
+
const rect = Dom.svg('rect', {
|
|
1920
|
+
class: 'sqd-placeholder-rect',
|
|
1921
|
+
width,
|
|
1922
|
+
height,
|
|
1923
|
+
rx: radius,
|
|
1924
|
+
ry: radius
|
|
1925
|
+
});
|
|
1926
|
+
g.appendChild(rect);
|
|
1927
|
+
if (direction) {
|
|
1928
|
+
const iconD = direction === exports.PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;
|
|
1929
|
+
const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);
|
|
1930
|
+
Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);
|
|
1931
|
+
}
|
|
1932
|
+
parent.appendChild(g);
|
|
1933
|
+
return new RectPlaceholderView(rect, g);
|
|
1934
|
+
}
|
|
1935
|
+
constructor(rect, g) {
|
|
1936
|
+
this.rect = rect;
|
|
1937
|
+
this.g = g;
|
|
1938
|
+
}
|
|
1939
|
+
setIsHover(isHover) {
|
|
1940
|
+
Dom.toggleClass(this.g, isHover, 'sqd-hover');
|
|
1941
|
+
}
|
|
1942
|
+
setIsVisible(isVisible) {
|
|
1943
|
+
Dom.attrs(this.g, {
|
|
1944
|
+
visibility: isVisible ? 'visible' : 'hidden'
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1946
1949
|
class RectPlaceholder {
|
|
1947
1950
|
static create(parent, size, direction, sequence, index, configuration) {
|
|
1948
1951
|
const view = RectPlaceholderView.create(parent, size.x, size.y, configuration.radius, configuration.iconSize, direction);
|
|
@@ -3741,6 +3744,7 @@
|
|
|
3741
3744
|
}
|
|
3742
3745
|
}
|
|
3743
3746
|
|
|
3747
|
+
const MAX_DELTA_Y = 25;
|
|
3744
3748
|
const listenerOptions = {
|
|
3745
3749
|
passive: false
|
|
3746
3750
|
};
|
|
@@ -3819,9 +3823,9 @@
|
|
|
3819
3823
|
e.preventDefault();
|
|
3820
3824
|
e.stopPropagation();
|
|
3821
3825
|
if (this.content) {
|
|
3822
|
-
const delta = e.deltaY
|
|
3826
|
+
const delta = Math.sign(e.deltaY) * Math.min(Math.abs(e.deltaY), MAX_DELTA_Y);
|
|
3823
3827
|
const scrollTop = this.getScrollTop();
|
|
3824
|
-
this.setScrollTop(scrollTop
|
|
3828
|
+
this.setScrollTop(scrollTop - delta);
|
|
3825
3829
|
}
|
|
3826
3830
|
}
|
|
3827
3831
|
startScroll(startPosition) {
|
|
@@ -4707,6 +4711,7 @@
|
|
|
4707
4711
|
exports.CenteredViewportCalculator = CenteredViewportCalculator;
|
|
4708
4712
|
exports.ClassicWheelControllerExtension = ClassicWheelControllerExtension;
|
|
4709
4713
|
exports.ComponentContext = ComponentContext;
|
|
4714
|
+
exports.ComponentDom = ComponentDom;
|
|
4710
4715
|
exports.ControlBarApi = ControlBarApi;
|
|
4711
4716
|
exports.CustomActionController = CustomActionController;
|
|
4712
4717
|
exports.DefaultSequenceComponent = DefaultSequenceComponent;
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -1138,6 +1138,15 @@ class ValidationErrorBadgeExtension {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
1140
|
|
|
1141
|
+
class ComponentDom {
|
|
1142
|
+
static stepG(componentClassName, type, id) {
|
|
1143
|
+
return Dom.svg('g', {
|
|
1144
|
+
class: `sqd-step-${componentClassName} sqd-type-${type}`,
|
|
1145
|
+
'data-step-id': id
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1141
1150
|
class InputView {
|
|
1142
1151
|
static createRectInput(parent, x, y, size, iconSize, iconUrl) {
|
|
1143
1152
|
const g = Dom.svg('g');
|
|
@@ -1343,43 +1352,6 @@ function drawLine(parent, x1, y1, x2, y2) {
|
|
|
1343
1352
|
return line;
|
|
1344
1353
|
}
|
|
1345
1354
|
|
|
1346
|
-
class RectPlaceholderView {
|
|
1347
|
-
static create(parent, width, height, radius, iconSize, direction) {
|
|
1348
|
-
const g = Dom.svg('g', {
|
|
1349
|
-
visibility: 'hidden',
|
|
1350
|
-
class: 'sqd-placeholder'
|
|
1351
|
-
});
|
|
1352
|
-
parent.appendChild(g);
|
|
1353
|
-
const rect = Dom.svg('rect', {
|
|
1354
|
-
class: 'sqd-placeholder-rect',
|
|
1355
|
-
width,
|
|
1356
|
-
height,
|
|
1357
|
-
rx: radius,
|
|
1358
|
-
ry: radius
|
|
1359
|
-
});
|
|
1360
|
-
g.appendChild(rect);
|
|
1361
|
-
if (direction) {
|
|
1362
|
-
const iconD = direction === exports.PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;
|
|
1363
|
-
const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);
|
|
1364
|
-
Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);
|
|
1365
|
-
}
|
|
1366
|
-
parent.appendChild(g);
|
|
1367
|
-
return new RectPlaceholderView(rect, g);
|
|
1368
|
-
}
|
|
1369
|
-
constructor(rect, g) {
|
|
1370
|
-
this.rect = rect;
|
|
1371
|
-
this.g = g;
|
|
1372
|
-
}
|
|
1373
|
-
setIsHover(isHover) {
|
|
1374
|
-
Dom.toggleClass(this.g, isHover, 'sqd-hover');
|
|
1375
|
-
}
|
|
1376
|
-
setIsVisible(isVisible) {
|
|
1377
|
-
Dom.attrs(this.g, {
|
|
1378
|
-
visibility: isVisible ? 'visible' : 'hidden'
|
|
1379
|
-
});
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
1355
|
class DefaultSequenceComponentView {
|
|
1384
1356
|
static create(parent, sequenceContext, componentContext) {
|
|
1385
1357
|
const phWidth = componentContext.services.placeholder.gapSize.x;
|
|
@@ -1508,9 +1480,7 @@ class DefaultSequenceComponent {
|
|
|
1508
1480
|
|
|
1509
1481
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1510
1482
|
const { step } = stepContext;
|
|
1511
|
-
const g =
|
|
1512
|
-
class: `sqd-step-container sqd-type-${step.type}`
|
|
1513
|
-
});
|
|
1483
|
+
const g = ComponentDom.stepG('container', step.type, step.id);
|
|
1514
1484
|
parentElement.appendChild(g);
|
|
1515
1485
|
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, step.name, 'primary');
|
|
1516
1486
|
const sequenceComponent = viewContext.createSequenceComponent(g, step.sequence);
|
|
@@ -1556,9 +1526,7 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1556
1526
|
|
|
1557
1527
|
const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
|
|
1558
1528
|
const { step } = stepContext;
|
|
1559
|
-
const g =
|
|
1560
|
-
class: `sqd-step-switch sqd-type-${step.type}`
|
|
1561
|
-
});
|
|
1529
|
+
const g = ComponentDom.stepG('switch', step.type, step.id);
|
|
1562
1530
|
parent.appendChild(g);
|
|
1563
1531
|
const branchNames = Object.keys(step.branches);
|
|
1564
1532
|
const branchComponents = branchNames.map(branchName => {
|
|
@@ -1659,9 +1627,7 @@ const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, view
|
|
|
1659
1627
|
|
|
1660
1628
|
const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1661
1629
|
const { step } = stepContext;
|
|
1662
|
-
const g =
|
|
1663
|
-
class: `sqd-step-task sqd-type-${step.type}`
|
|
1664
|
-
});
|
|
1630
|
+
const g = ComponentDom.stepG('task', step.type, step.id);
|
|
1665
1631
|
parentElement.appendChild(g);
|
|
1666
1632
|
const boxHeight = cfg.paddingY * 2 + cfg.iconSize;
|
|
1667
1633
|
const text = Dom.svg('text', {
|
|
@@ -1784,7 +1750,7 @@ class NextQuantifiedNumber {
|
|
|
1784
1750
|
}
|
|
1785
1751
|
|
|
1786
1752
|
const SCALES = [0.06, 0.08, 0.1, 0.12, 0.16, 0.2, 0.26, 0.32, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
|
|
1787
|
-
const MAX_DELTA_Y = 16;
|
|
1753
|
+
const MAX_DELTA_Y$1 = 16;
|
|
1788
1754
|
const quantifiedScale = new NextQuantifiedNumber(SCALES);
|
|
1789
1755
|
class QuantifiedScaleViewportCalculator {
|
|
1790
1756
|
static zoom(current, direction) {
|
|
@@ -1801,8 +1767,8 @@ class QuantifiedScaleViewportCalculator {
|
|
|
1801
1767
|
const nextScale = quantifiedScale.next(current.scale, e.deltaY < 0);
|
|
1802
1768
|
let scale;
|
|
1803
1769
|
const absDeltaY = Math.abs(e.deltaY);
|
|
1804
|
-
if (absDeltaY < MAX_DELTA_Y) {
|
|
1805
|
-
const fraction = absDeltaY / MAX_DELTA_Y;
|
|
1770
|
+
if (absDeltaY < MAX_DELTA_Y$1) {
|
|
1771
|
+
const fraction = absDeltaY / MAX_DELTA_Y$1;
|
|
1806
1772
|
const step = nextScale.next - nextScale.current;
|
|
1807
1773
|
scale = current.scale + step * fraction;
|
|
1808
1774
|
}
|
|
@@ -1941,6 +1907,43 @@ class StepExtensionResolver {
|
|
|
1941
1907
|
}
|
|
1942
1908
|
}
|
|
1943
1909
|
|
|
1910
|
+
class RectPlaceholderView {
|
|
1911
|
+
static create(parent, width, height, radius, iconSize, direction) {
|
|
1912
|
+
const g = Dom.svg('g', {
|
|
1913
|
+
visibility: 'hidden',
|
|
1914
|
+
class: 'sqd-placeholder'
|
|
1915
|
+
});
|
|
1916
|
+
parent.appendChild(g);
|
|
1917
|
+
const rect = Dom.svg('rect', {
|
|
1918
|
+
class: 'sqd-placeholder-rect',
|
|
1919
|
+
width,
|
|
1920
|
+
height,
|
|
1921
|
+
rx: radius,
|
|
1922
|
+
ry: radius
|
|
1923
|
+
});
|
|
1924
|
+
g.appendChild(rect);
|
|
1925
|
+
if (direction) {
|
|
1926
|
+
const iconD = direction === exports.PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;
|
|
1927
|
+
const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);
|
|
1928
|
+
Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);
|
|
1929
|
+
}
|
|
1930
|
+
parent.appendChild(g);
|
|
1931
|
+
return new RectPlaceholderView(rect, g);
|
|
1932
|
+
}
|
|
1933
|
+
constructor(rect, g) {
|
|
1934
|
+
this.rect = rect;
|
|
1935
|
+
this.g = g;
|
|
1936
|
+
}
|
|
1937
|
+
setIsHover(isHover) {
|
|
1938
|
+
Dom.toggleClass(this.g, isHover, 'sqd-hover');
|
|
1939
|
+
}
|
|
1940
|
+
setIsVisible(isVisible) {
|
|
1941
|
+
Dom.attrs(this.g, {
|
|
1942
|
+
visibility: isVisible ? 'visible' : 'hidden'
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1944
1947
|
class RectPlaceholder {
|
|
1945
1948
|
static create(parent, size, direction, sequence, index, configuration) {
|
|
1946
1949
|
const view = RectPlaceholderView.create(parent, size.x, size.y, configuration.radius, configuration.iconSize, direction);
|
|
@@ -3556,6 +3559,7 @@ class SmartEditorExtension {
|
|
|
3556
3559
|
}
|
|
3557
3560
|
}
|
|
3558
3561
|
|
|
3562
|
+
const MAX_DELTA_Y = 25;
|
|
3559
3563
|
const listenerOptions = {
|
|
3560
3564
|
passive: false
|
|
3561
3565
|
};
|
|
@@ -3634,9 +3638,9 @@ class ScrollBoxView {
|
|
|
3634
3638
|
e.preventDefault();
|
|
3635
3639
|
e.stopPropagation();
|
|
3636
3640
|
if (this.content) {
|
|
3637
|
-
const delta = e.deltaY
|
|
3641
|
+
const delta = Math.sign(e.deltaY) * Math.min(Math.abs(e.deltaY), MAX_DELTA_Y);
|
|
3638
3642
|
const scrollTop = this.getScrollTop();
|
|
3639
|
-
this.setScrollTop(scrollTop
|
|
3643
|
+
this.setScrollTop(scrollTop - delta);
|
|
3640
3644
|
}
|
|
3641
3645
|
}
|
|
3642
3646
|
startScroll(startPosition) {
|
|
@@ -4522,6 +4526,7 @@ exports.Badges = Badges;
|
|
|
4522
4526
|
exports.CenteredViewportCalculator = CenteredViewportCalculator;
|
|
4523
4527
|
exports.ClassicWheelControllerExtension = ClassicWheelControllerExtension;
|
|
4524
4528
|
exports.ComponentContext = ComponentContext;
|
|
4529
|
+
exports.ComponentDom = ComponentDom;
|
|
4525
4530
|
exports.ControlBarApi = ControlBarApi;
|
|
4526
4531
|
exports.CustomActionController = CustomActionController;
|
|
4527
4532
|
exports.DefaultSequenceComponent = DefaultSequenceComponent;
|
package/lib/esm/index.js
CHANGED
|
@@ -1137,6 +1137,15 @@ class ValidationErrorBadgeExtension {
|
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
1139
|
|
|
1140
|
+
class ComponentDom {
|
|
1141
|
+
static stepG(componentClassName, type, id) {
|
|
1142
|
+
return Dom.svg('g', {
|
|
1143
|
+
class: `sqd-step-${componentClassName} sqd-type-${type}`,
|
|
1144
|
+
'data-step-id': id
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1140
1149
|
class InputView {
|
|
1141
1150
|
static createRectInput(parent, x, y, size, iconSize, iconUrl) {
|
|
1142
1151
|
const g = Dom.svg('g');
|
|
@@ -1342,43 +1351,6 @@ function drawLine(parent, x1, y1, x2, y2) {
|
|
|
1342
1351
|
return line;
|
|
1343
1352
|
}
|
|
1344
1353
|
|
|
1345
|
-
class RectPlaceholderView {
|
|
1346
|
-
static create(parent, width, height, radius, iconSize, direction) {
|
|
1347
|
-
const g = Dom.svg('g', {
|
|
1348
|
-
visibility: 'hidden',
|
|
1349
|
-
class: 'sqd-placeholder'
|
|
1350
|
-
});
|
|
1351
|
-
parent.appendChild(g);
|
|
1352
|
-
const rect = Dom.svg('rect', {
|
|
1353
|
-
class: 'sqd-placeholder-rect',
|
|
1354
|
-
width,
|
|
1355
|
-
height,
|
|
1356
|
-
rx: radius,
|
|
1357
|
-
ry: radius
|
|
1358
|
-
});
|
|
1359
|
-
g.appendChild(rect);
|
|
1360
|
-
if (direction) {
|
|
1361
|
-
const iconD = direction === PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;
|
|
1362
|
-
const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);
|
|
1363
|
-
Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);
|
|
1364
|
-
}
|
|
1365
|
-
parent.appendChild(g);
|
|
1366
|
-
return new RectPlaceholderView(rect, g);
|
|
1367
|
-
}
|
|
1368
|
-
constructor(rect, g) {
|
|
1369
|
-
this.rect = rect;
|
|
1370
|
-
this.g = g;
|
|
1371
|
-
}
|
|
1372
|
-
setIsHover(isHover) {
|
|
1373
|
-
Dom.toggleClass(this.g, isHover, 'sqd-hover');
|
|
1374
|
-
}
|
|
1375
|
-
setIsVisible(isVisible) {
|
|
1376
|
-
Dom.attrs(this.g, {
|
|
1377
|
-
visibility: isVisible ? 'visible' : 'hidden'
|
|
1378
|
-
});
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
1354
|
class DefaultSequenceComponentView {
|
|
1383
1355
|
static create(parent, sequenceContext, componentContext) {
|
|
1384
1356
|
const phWidth = componentContext.services.placeholder.gapSize.x;
|
|
@@ -1507,9 +1479,7 @@ class DefaultSequenceComponent {
|
|
|
1507
1479
|
|
|
1508
1480
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1509
1481
|
const { step } = stepContext;
|
|
1510
|
-
const g =
|
|
1511
|
-
class: `sqd-step-container sqd-type-${step.type}`
|
|
1512
|
-
});
|
|
1482
|
+
const g = ComponentDom.stepG('container', step.type, step.id);
|
|
1513
1483
|
parentElement.appendChild(g);
|
|
1514
1484
|
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, step.name, 'primary');
|
|
1515
1485
|
const sequenceComponent = viewContext.createSequenceComponent(g, step.sequence);
|
|
@@ -1555,9 +1525,7 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1555
1525
|
|
|
1556
1526
|
const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
|
|
1557
1527
|
const { step } = stepContext;
|
|
1558
|
-
const g =
|
|
1559
|
-
class: `sqd-step-switch sqd-type-${step.type}`
|
|
1560
|
-
});
|
|
1528
|
+
const g = ComponentDom.stepG('switch', step.type, step.id);
|
|
1561
1529
|
parent.appendChild(g);
|
|
1562
1530
|
const branchNames = Object.keys(step.branches);
|
|
1563
1531
|
const branchComponents = branchNames.map(branchName => {
|
|
@@ -1658,9 +1626,7 @@ const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, view
|
|
|
1658
1626
|
|
|
1659
1627
|
const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1660
1628
|
const { step } = stepContext;
|
|
1661
|
-
const g =
|
|
1662
|
-
class: `sqd-step-task sqd-type-${step.type}`
|
|
1663
|
-
});
|
|
1629
|
+
const g = ComponentDom.stepG('task', step.type, step.id);
|
|
1664
1630
|
parentElement.appendChild(g);
|
|
1665
1631
|
const boxHeight = cfg.paddingY * 2 + cfg.iconSize;
|
|
1666
1632
|
const text = Dom.svg('text', {
|
|
@@ -1783,7 +1749,7 @@ class NextQuantifiedNumber {
|
|
|
1783
1749
|
}
|
|
1784
1750
|
|
|
1785
1751
|
const SCALES = [0.06, 0.08, 0.1, 0.12, 0.16, 0.2, 0.26, 0.32, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
|
|
1786
|
-
const MAX_DELTA_Y = 16;
|
|
1752
|
+
const MAX_DELTA_Y$1 = 16;
|
|
1787
1753
|
const quantifiedScale = new NextQuantifiedNumber(SCALES);
|
|
1788
1754
|
class QuantifiedScaleViewportCalculator {
|
|
1789
1755
|
static zoom(current, direction) {
|
|
@@ -1800,8 +1766,8 @@ class QuantifiedScaleViewportCalculator {
|
|
|
1800
1766
|
const nextScale = quantifiedScale.next(current.scale, e.deltaY < 0);
|
|
1801
1767
|
let scale;
|
|
1802
1768
|
const absDeltaY = Math.abs(e.deltaY);
|
|
1803
|
-
if (absDeltaY < MAX_DELTA_Y) {
|
|
1804
|
-
const fraction = absDeltaY / MAX_DELTA_Y;
|
|
1769
|
+
if (absDeltaY < MAX_DELTA_Y$1) {
|
|
1770
|
+
const fraction = absDeltaY / MAX_DELTA_Y$1;
|
|
1805
1771
|
const step = nextScale.next - nextScale.current;
|
|
1806
1772
|
scale = current.scale + step * fraction;
|
|
1807
1773
|
}
|
|
@@ -1940,6 +1906,43 @@ class StepExtensionResolver {
|
|
|
1940
1906
|
}
|
|
1941
1907
|
}
|
|
1942
1908
|
|
|
1909
|
+
class RectPlaceholderView {
|
|
1910
|
+
static create(parent, width, height, radius, iconSize, direction) {
|
|
1911
|
+
const g = Dom.svg('g', {
|
|
1912
|
+
visibility: 'hidden',
|
|
1913
|
+
class: 'sqd-placeholder'
|
|
1914
|
+
});
|
|
1915
|
+
parent.appendChild(g);
|
|
1916
|
+
const rect = Dom.svg('rect', {
|
|
1917
|
+
class: 'sqd-placeholder-rect',
|
|
1918
|
+
width,
|
|
1919
|
+
height,
|
|
1920
|
+
rx: radius,
|
|
1921
|
+
ry: radius
|
|
1922
|
+
});
|
|
1923
|
+
g.appendChild(rect);
|
|
1924
|
+
if (direction) {
|
|
1925
|
+
const iconD = direction === PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;
|
|
1926
|
+
const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);
|
|
1927
|
+
Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);
|
|
1928
|
+
}
|
|
1929
|
+
parent.appendChild(g);
|
|
1930
|
+
return new RectPlaceholderView(rect, g);
|
|
1931
|
+
}
|
|
1932
|
+
constructor(rect, g) {
|
|
1933
|
+
this.rect = rect;
|
|
1934
|
+
this.g = g;
|
|
1935
|
+
}
|
|
1936
|
+
setIsHover(isHover) {
|
|
1937
|
+
Dom.toggleClass(this.g, isHover, 'sqd-hover');
|
|
1938
|
+
}
|
|
1939
|
+
setIsVisible(isVisible) {
|
|
1940
|
+
Dom.attrs(this.g, {
|
|
1941
|
+
visibility: isVisible ? 'visible' : 'hidden'
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1943
1946
|
class RectPlaceholder {
|
|
1944
1947
|
static create(parent, size, direction, sequence, index, configuration) {
|
|
1945
1948
|
const view = RectPlaceholderView.create(parent, size.x, size.y, configuration.radius, configuration.iconSize, direction);
|
|
@@ -3555,6 +3558,7 @@ class SmartEditorExtension {
|
|
|
3555
3558
|
}
|
|
3556
3559
|
}
|
|
3557
3560
|
|
|
3561
|
+
const MAX_DELTA_Y = 25;
|
|
3558
3562
|
const listenerOptions = {
|
|
3559
3563
|
passive: false
|
|
3560
3564
|
};
|
|
@@ -3633,9 +3637,9 @@ class ScrollBoxView {
|
|
|
3633
3637
|
e.preventDefault();
|
|
3634
3638
|
e.stopPropagation();
|
|
3635
3639
|
if (this.content) {
|
|
3636
|
-
const delta = e.deltaY
|
|
3640
|
+
const delta = Math.sign(e.deltaY) * Math.min(Math.abs(e.deltaY), MAX_DELTA_Y);
|
|
3637
3641
|
const scrollTop = this.getScrollTop();
|
|
3638
|
-
this.setScrollTop(scrollTop
|
|
3642
|
+
this.setScrollTop(scrollTop - delta);
|
|
3639
3643
|
}
|
|
3640
3644
|
}
|
|
3641
3645
|
startScroll(startPosition) {
|
|
@@ -4517,4 +4521,4 @@ class StepsDesignerExtension {
|
|
|
4517
4521
|
}
|
|
4518
4522
|
}
|
|
4519
4523
|
|
|
4520
|
-
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ControlBarApi, CustomActionController, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, RegionView, ServicesResolver, SimpleEvent, StepComponent, StepExtensionResolver, StepsDesignerExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
|
4524
|
+
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, RegionView, ServicesResolver, SimpleEvent, StepComponent, StepExtensionResolver, StepsDesignerExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
package/lib/index.d.ts
CHANGED
|
@@ -509,6 +509,10 @@ declare class ValidationErrorBadgeExtension implements BadgeExtension {
|
|
|
509
509
|
readonly createStartValue: () => boolean;
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
+
declare class ComponentDom {
|
|
513
|
+
static stepG(componentClassName: string, type: string, id: string): SVGGElement;
|
|
514
|
+
}
|
|
515
|
+
|
|
512
516
|
declare class InputView {
|
|
513
517
|
private readonly root;
|
|
514
518
|
static createRectInput(parent: SVGElement, x: number, y: number, size: number, iconSize: number, iconUrl: string | null): InputView;
|
|
@@ -555,15 +559,6 @@ declare class RegionView {
|
|
|
555
559
|
setIsSelected(isSelected: boolean): void;
|
|
556
560
|
}
|
|
557
561
|
|
|
558
|
-
declare class RectPlaceholderView implements PlaceholderView {
|
|
559
|
-
readonly rect: SVGElement;
|
|
560
|
-
readonly g: SVGGElement;
|
|
561
|
-
static create(parent: SVGElement, width: number, height: number, radius: number, iconSize: number, direction: PlaceholderDirection): RectPlaceholderView;
|
|
562
|
-
private constructor();
|
|
563
|
-
setIsHover(isHover: boolean): void;
|
|
564
|
-
setIsVisible(isVisible: boolean): void;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
562
|
declare class DefaultSequenceComponentView implements ComponentView {
|
|
568
563
|
readonly g: SVGGElement;
|
|
569
564
|
readonly width: number;
|
|
@@ -686,6 +681,15 @@ interface RectPlaceholderConfiguration {
|
|
|
686
681
|
iconSize: number;
|
|
687
682
|
}
|
|
688
683
|
|
|
684
|
+
declare class RectPlaceholderView implements PlaceholderView {
|
|
685
|
+
readonly rect: SVGElement;
|
|
686
|
+
readonly g: SVGGElement;
|
|
687
|
+
static create(parent: SVGElement, width: number, height: number, radius: number, iconSize: number, direction: PlaceholderDirection): RectPlaceholderView;
|
|
688
|
+
private constructor();
|
|
689
|
+
setIsHover(isHover: boolean): void;
|
|
690
|
+
setIsVisible(isVisible: boolean): void;
|
|
691
|
+
}
|
|
692
|
+
|
|
689
693
|
declare class RectPlaceholder implements Placeholder {
|
|
690
694
|
readonly view: RectPlaceholderView;
|
|
691
695
|
readonly parentSequence: Sequence;
|
|
@@ -1210,4 +1214,4 @@ declare class StepsDesignerExtension implements DesignerExtension {
|
|
|
1210
1214
|
protected constructor(steps: StepExtension<Step>[]);
|
|
1211
1215
|
}
|
|
1212
1216
|
|
|
1213
|
-
export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentView, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ContextMenuExtension, ContextMenuItem, ContextMenuItemsProvider, ControlBarApi, CustomAction, CustomActionController, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, Grid, GridExtension, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SelectedStepIdProvider, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StateModifierDependency, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
|
1217
|
+
export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentDom, ComponentView, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ContextMenuExtension, ContextMenuItem, ContextMenuItemsProvider, ControlBarApi, CustomAction, CustomActionController, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, Grid, GridExtension, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SelectedStepIdProvider, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StateModifierDependency, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
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.19.
|
|
4
|
+
"version": "0.19.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|