sequential-workflow-designer 0.29.2 → 0.30.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 +6 -4
- package/css/designer-dark.css +10 -0
- package/css/designer-light.css +10 -0
- package/css/designer-soft.css +10 -0
- package/dist/index.umd.js +347 -135
- package/lib/cjs/index.cjs +347 -135
- package/lib/esm/index.js +346 -136
- package/lib/index.d.ts +79 -35
- package/package.json +1 -1
- package/sass/designer-dark.scss +6 -0
- package/sass/designer-light.scss +1 -0
- package/sass/designer-soft.scss +1 -0
- package/sass/designer-theme.scss +26 -0
package/dist/index.umd.js
CHANGED
|
@@ -442,13 +442,16 @@
|
|
|
442
442
|
const scroll = new Vector(window.scrollX, window.scrollY);
|
|
443
443
|
this.cache = this.placeholders.map(placeholder => {
|
|
444
444
|
const rect = placeholder.getClientRect();
|
|
445
|
+
const lt = new Vector(rect.x, rect.y).add(scroll);
|
|
446
|
+
const br = new Vector(rect.x + rect.width, rect.y + rect.height).add(scroll);
|
|
445
447
|
return {
|
|
446
448
|
placeholder,
|
|
447
|
-
lt
|
|
448
|
-
br
|
|
449
|
+
lt,
|
|
450
|
+
br,
|
|
451
|
+
diagSq: lt.x * lt.x + lt.y * lt.y
|
|
449
452
|
};
|
|
450
453
|
});
|
|
451
|
-
this.cache.sort((a, b) => a.
|
|
454
|
+
this.cache.sort((a, b) => a.diagSq - b.diagSq);
|
|
452
455
|
}
|
|
453
456
|
const vR = vLt.x + vWidth;
|
|
454
457
|
const vB = vLt.y + vHeight;
|
|
@@ -600,7 +603,7 @@
|
|
|
600
603
|
}
|
|
601
604
|
activateStep(step) {
|
|
602
605
|
const newStep = ObjectCloner.deepClone(step);
|
|
603
|
-
newStep.id = this.uidGenerator
|
|
606
|
+
newStep.id = this.uidGenerator();
|
|
604
607
|
return newStep;
|
|
605
608
|
}
|
|
606
609
|
}
|
|
@@ -615,9 +618,9 @@
|
|
|
615
618
|
}
|
|
616
619
|
|
|
617
620
|
class ToolboxDataProvider {
|
|
618
|
-
constructor(
|
|
619
|
-
this.iconProvider = iconProvider;
|
|
621
|
+
constructor(i18n, iconProvider, configuration) {
|
|
620
622
|
this.i18n = i18n;
|
|
623
|
+
this.iconProvider = iconProvider;
|
|
621
624
|
this.configuration = configuration;
|
|
622
625
|
this.createItemData = (step) => {
|
|
623
626
|
StepTypeValidator.validate(step.type);
|
|
@@ -1005,8 +1008,8 @@
|
|
|
1005
1008
|
static create(context) {
|
|
1006
1009
|
const workspace = new WorkspaceApi(context.state, context.definitionWalker, context.workspaceController);
|
|
1007
1010
|
const viewportController = context.services.viewportController.create(workspace);
|
|
1008
|
-
const toolboxDataProvider = new ToolboxDataProvider(context.
|
|
1009
|
-
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.
|
|
1011
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.i18n, context.componentContext.iconProvider, context.configuration.toolbox);
|
|
1012
|
+
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.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);
|
|
1010
1013
|
}
|
|
1011
1014
|
constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
1012
1015
|
this.shadowRoot = shadowRoot;
|
|
@@ -1194,7 +1197,7 @@
|
|
|
1194
1197
|
}
|
|
1195
1198
|
}
|
|
1196
1199
|
|
|
1197
|
-
const defaultConfiguration$
|
|
1200
|
+
const defaultConfiguration$5 = {
|
|
1198
1201
|
view: {
|
|
1199
1202
|
size: 22,
|
|
1200
1203
|
iconSize: 12
|
|
@@ -1202,7 +1205,7 @@
|
|
|
1202
1205
|
};
|
|
1203
1206
|
class ValidationErrorBadgeExtension {
|
|
1204
1207
|
static create(configuration) {
|
|
1205
|
-
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
1208
|
+
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$5);
|
|
1206
1209
|
}
|
|
1207
1210
|
constructor(configuration) {
|
|
1208
1211
|
this.configuration = configuration;
|
|
@@ -1292,7 +1295,7 @@
|
|
|
1292
1295
|
switch (targets.length) {
|
|
1293
1296
|
case 1:
|
|
1294
1297
|
if (start.x === targets[0].x) {
|
|
1295
|
-
JoinView.createStraightJoin(parent, start,
|
|
1298
|
+
JoinView.createStraightJoin(parent, start, h * 2 * dy);
|
|
1296
1299
|
}
|
|
1297
1300
|
else {
|
|
1298
1301
|
appendCurvedJoins(parent, start, targets, h, dy);
|
|
@@ -1388,10 +1391,18 @@
|
|
|
1388
1391
|
}
|
|
1389
1392
|
}
|
|
1390
1393
|
|
|
1394
|
+
// PlaceholderExtension
|
|
1395
|
+
exports.PlaceholderGapOrientation = void 0;
|
|
1396
|
+
(function (PlaceholderGapOrientation) {
|
|
1397
|
+
PlaceholderGapOrientation[PlaceholderGapOrientation["along"] = 0] = "along";
|
|
1398
|
+
PlaceholderGapOrientation[PlaceholderGapOrientation["perpendicular"] = 1] = "perpendicular"; // Goes perpendicular to the flow
|
|
1399
|
+
})(exports.PlaceholderGapOrientation || (exports.PlaceholderGapOrientation = {}));
|
|
1400
|
+
|
|
1391
1401
|
class DefaultSequenceComponentView {
|
|
1392
1402
|
static create(parent, sequenceContext, componentContext) {
|
|
1393
|
-
const
|
|
1394
|
-
const
|
|
1403
|
+
const phSize = componentContext.services.placeholder.getGapSize(exports.PlaceholderGapOrientation.along);
|
|
1404
|
+
const phWidth = phSize.x;
|
|
1405
|
+
const phHeight = phSize.y;
|
|
1395
1406
|
const { sequence } = sequenceContext;
|
|
1396
1407
|
const g = Dom.svg('g');
|
|
1397
1408
|
parent.appendChild(g);
|
|
@@ -1428,7 +1439,7 @@
|
|
|
1428
1439
|
JoinView.createStraightJoin(g, new Vector(joinX, offsetY - phHeight), phHeight);
|
|
1429
1440
|
}
|
|
1430
1441
|
if (!sequenceContext.isPreview && componentContext.placeholderController.canCreate(sequence, i)) {
|
|
1431
|
-
const ph = componentContext.services.placeholder.createForGap(g, sequence, i);
|
|
1442
|
+
const ph = componentContext.services.placeholder.createForGap(g, sequence, i, exports.PlaceholderGapOrientation.along);
|
|
1432
1443
|
Dom.translate(ph.view.g, joinX - phWidth / 2, offsetY - phHeight);
|
|
1433
1444
|
placeholders.push(ph);
|
|
1434
1445
|
}
|
|
@@ -1440,7 +1451,7 @@
|
|
|
1440
1451
|
}
|
|
1441
1452
|
const newIndex = components.length;
|
|
1442
1453
|
if (!sequenceContext.isPreview && componentContext.placeholderController.canCreate(sequence, newIndex)) {
|
|
1443
|
-
const ph = componentContext.services.placeholder.createForGap(g, sequence, newIndex);
|
|
1454
|
+
const ph = componentContext.services.placeholder.createForGap(g, sequence, newIndex, exports.PlaceholderGapOrientation.along);
|
|
1444
1455
|
Dom.translate(ph.view.g, joinX - phWidth / 2, offsetY - phHeight);
|
|
1445
1456
|
placeholders.push(ph);
|
|
1446
1457
|
}
|
|
@@ -1488,21 +1499,19 @@
|
|
|
1488
1499
|
}
|
|
1489
1500
|
findById(stepId) {
|
|
1490
1501
|
for (const component of this.view.components) {
|
|
1491
|
-
const
|
|
1492
|
-
if (
|
|
1493
|
-
return
|
|
1502
|
+
const result = component.findById(stepId);
|
|
1503
|
+
if (result) {
|
|
1504
|
+
return result;
|
|
1494
1505
|
}
|
|
1495
1506
|
}
|
|
1496
1507
|
return null;
|
|
1497
1508
|
}
|
|
1498
1509
|
resolvePlaceholders(skipComponent, result) {
|
|
1510
|
+
this.view.components.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
1499
1511
|
this.view.placeholders.forEach(placeholder => result.placeholders.push(placeholder));
|
|
1500
|
-
this.view.components.forEach(c => c.resolvePlaceholders(skipComponent, result));
|
|
1501
1512
|
}
|
|
1502
1513
|
updateBadges(result) {
|
|
1503
|
-
|
|
1504
|
-
component.updateBadges(result);
|
|
1505
|
-
}
|
|
1514
|
+
this.view.components.forEach(component => component.updateBadges(result));
|
|
1506
1515
|
}
|
|
1507
1516
|
}
|
|
1508
1517
|
|
|
@@ -1515,7 +1524,7 @@
|
|
|
1515
1524
|
})(exports.ClickCommandType || (exports.ClickCommandType = {}));
|
|
1516
1525
|
exports.PlaceholderDirection = void 0;
|
|
1517
1526
|
(function (PlaceholderDirection) {
|
|
1518
|
-
PlaceholderDirection[PlaceholderDirection["
|
|
1527
|
+
PlaceholderDirection[PlaceholderDirection["gap"] = 0] = "gap";
|
|
1519
1528
|
PlaceholderDirection[PlaceholderDirection["in"] = 1] = "in";
|
|
1520
1529
|
PlaceholderDirection[PlaceholderDirection["out"] = 2] = "out";
|
|
1521
1530
|
})(exports.PlaceholderDirection || (exports.PlaceholderDirection = {}));
|
|
@@ -1529,7 +1538,7 @@
|
|
|
1529
1538
|
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
1530
1539
|
sequence,
|
|
1531
1540
|
depth: 0,
|
|
1532
|
-
isInputConnected:
|
|
1541
|
+
isInputConnected: Boolean(cfg.start),
|
|
1533
1542
|
isOutputConnected: true,
|
|
1534
1543
|
isPreview: false
|
|
1535
1544
|
}, context);
|
|
@@ -1537,9 +1546,11 @@
|
|
|
1537
1546
|
const x = view.joinX - cfg.size / 2;
|
|
1538
1547
|
const endY = cfg.size + view.height;
|
|
1539
1548
|
const iconSize = parentPlaceIndicator ? cfg.folderIconSize : cfg.defaultIconSize;
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1549
|
+
if (cfg.start) {
|
|
1550
|
+
const startCircle = createCircle('start', parentPlaceIndicator ? cfg.folderIconD : cfg.start.iconD, cfg.size, iconSize);
|
|
1551
|
+
Dom.translate(startCircle, x, 0);
|
|
1552
|
+
g.appendChild(startCircle);
|
|
1553
|
+
}
|
|
1543
1554
|
Dom.translate(view.g, 0, cfg.size);
|
|
1544
1555
|
const stopCircle = createCircle('stop', parentPlaceIndicator ? cfg.folderIconD : cfg.stopIconD, cfg.size, iconSize);
|
|
1545
1556
|
Dom.translate(stopCircle, x, endY);
|
|
@@ -1616,31 +1627,33 @@
|
|
|
1616
1627
|
}
|
|
1617
1628
|
}
|
|
1618
1629
|
|
|
1619
|
-
const
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1630
|
+
const defaultViewConfiguration$2 = {
|
|
1631
|
+
size: 30,
|
|
1632
|
+
defaultIconSize: 22,
|
|
1633
|
+
folderIconSize: 18,
|
|
1634
|
+
start: {
|
|
1635
|
+
iconD: Icons.play
|
|
1636
|
+
},
|
|
1637
|
+
stopIconD: Icons.stop,
|
|
1638
|
+
folderIconD: Icons.folder
|
|
1628
1639
|
};
|
|
1629
1640
|
class StartStopRootComponentExtension {
|
|
1630
1641
|
static create(configuration) {
|
|
1631
|
-
return new StartStopRootComponentExtension(configuration
|
|
1642
|
+
return new StartStopRootComponentExtension(configuration);
|
|
1632
1643
|
}
|
|
1633
1644
|
constructor(configuration) {
|
|
1634
1645
|
this.configuration = configuration;
|
|
1635
1646
|
}
|
|
1636
1647
|
create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
1637
|
-
|
|
1648
|
+
var _a;
|
|
1649
|
+
const view = ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.view) ? Object.assign(Object.assign({}, defaultViewConfiguration$2), this.configuration.view) : defaultViewConfiguration$2;
|
|
1650
|
+
return StartStopRootComponent.create(parentElement, sequence, parentPlaceIndicator, context, view);
|
|
1638
1651
|
}
|
|
1639
1652
|
}
|
|
1640
1653
|
|
|
1641
|
-
const COMPONENT_CLASS_NAME$
|
|
1654
|
+
const COMPONENT_CLASS_NAME$3 = 'container';
|
|
1642
1655
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1643
|
-
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$
|
|
1656
|
+
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$3, (g, regionViewBuilder) => {
|
|
1644
1657
|
const step = stepContext.step;
|
|
1645
1658
|
const name = viewContext.getStepName();
|
|
1646
1659
|
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, name, 'primary');
|
|
@@ -1666,7 +1679,7 @@
|
|
|
1666
1679
|
height,
|
|
1667
1680
|
joinX,
|
|
1668
1681
|
placeholders: null,
|
|
1669
|
-
|
|
1682
|
+
components: [sequenceComponent],
|
|
1670
1683
|
hasOutput: sequenceComponent.hasOutput,
|
|
1671
1684
|
getClientPosition() {
|
|
1672
1685
|
return regionView.getClientPosition();
|
|
@@ -1690,6 +1703,149 @@
|
|
|
1690
1703
|
});
|
|
1691
1704
|
};
|
|
1692
1705
|
|
|
1706
|
+
const COMPONENT_CLASS_NAME$2 = 'launch-pad';
|
|
1707
|
+
function createView$1(parentElement, stepContext, viewContext, regionViewFactory, isInterruptedIfEmpty, cfg) {
|
|
1708
|
+
const step = stepContext.step;
|
|
1709
|
+
const sequence = stepContext.step.sequence;
|
|
1710
|
+
const g = ComponentDom.stepG(COMPONENT_CLASS_NAME$2, step.type, step.id);
|
|
1711
|
+
parentElement.appendChild(g);
|
|
1712
|
+
const components = [];
|
|
1713
|
+
let width;
|
|
1714
|
+
let height;
|
|
1715
|
+
let joinX;
|
|
1716
|
+
const placeholdersX = [];
|
|
1717
|
+
let placeholderOrientation;
|
|
1718
|
+
let placeholderSize;
|
|
1719
|
+
let hasOutput;
|
|
1720
|
+
let inputView = null;
|
|
1721
|
+
let outputView = null;
|
|
1722
|
+
if (sequence.length > 0) {
|
|
1723
|
+
let maxComponentHeight = 0;
|
|
1724
|
+
for (let i = 0; i < sequence.length; i++) {
|
|
1725
|
+
const component = viewContext.createStepComponent(g, sequence, sequence[i], i);
|
|
1726
|
+
components.push(component);
|
|
1727
|
+
maxComponentHeight = Math.max(maxComponentHeight, component.view.height);
|
|
1728
|
+
}
|
|
1729
|
+
const joinsX = [];
|
|
1730
|
+
const positionsX = [];
|
|
1731
|
+
const spacesY = [];
|
|
1732
|
+
placeholderOrientation = exports.PlaceholderGapOrientation.perpendicular;
|
|
1733
|
+
placeholderSize = viewContext.getPlaceholderGapSize(placeholderOrientation);
|
|
1734
|
+
placeholdersX.push(0);
|
|
1735
|
+
let positionX = placeholderSize.x;
|
|
1736
|
+
for (let i = 0; i < components.length; i++) {
|
|
1737
|
+
if (i > 0) {
|
|
1738
|
+
placeholdersX.push(positionX);
|
|
1739
|
+
positionX += placeholderSize.x;
|
|
1740
|
+
}
|
|
1741
|
+
const component = components[i];
|
|
1742
|
+
const componentY = (maxComponentHeight - component.view.height) / 2 + cfg.connectionHeight + cfg.paddingY;
|
|
1743
|
+
Dom.translate(component.view.g, positionX, componentY);
|
|
1744
|
+
joinsX.push(positionX + component.view.joinX);
|
|
1745
|
+
positionX += component.view.width;
|
|
1746
|
+
positionsX.push(positionX);
|
|
1747
|
+
spacesY.push(Math.max(0, (maxComponentHeight - component.view.height) / 2));
|
|
1748
|
+
}
|
|
1749
|
+
placeholdersX.push(positionX);
|
|
1750
|
+
positionX += placeholderSize.x;
|
|
1751
|
+
width = positionX;
|
|
1752
|
+
height = maxComponentHeight + 2 * cfg.connectionHeight + 2 * cfg.paddingY;
|
|
1753
|
+
const contentJoinX = components.length % 2 === 0
|
|
1754
|
+
? positionsX[Math.max(0, Math.floor(components.length / 2) - 1)] + placeholderSize.x / 2
|
|
1755
|
+
: joinsX[Math.floor(components.length / 2)];
|
|
1756
|
+
if (stepContext.isInputConnected) {
|
|
1757
|
+
const joinsTopY = joinsX.map(x => new Vector(x, cfg.connectionHeight));
|
|
1758
|
+
JoinView.createJoins(g, new Vector(contentJoinX, 0), joinsTopY);
|
|
1759
|
+
for (let i = 0; i < joinsX.length; i++) {
|
|
1760
|
+
JoinView.createStraightJoin(g, joinsTopY[i], cfg.paddingY + spacesY[i]);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
const joinsBottomY = joinsX.map(x => new Vector(x, cfg.connectionHeight + 2 * cfg.paddingY + maxComponentHeight));
|
|
1764
|
+
JoinView.createJoins(g, new Vector(contentJoinX, height), joinsBottomY);
|
|
1765
|
+
for (let i = 0; i < joinsX.length; i++) {
|
|
1766
|
+
JoinView.createStraightJoin(g, joinsBottomY[i], -(cfg.paddingY + spacesY[i]));
|
|
1767
|
+
}
|
|
1768
|
+
hasOutput = true;
|
|
1769
|
+
joinX = contentJoinX;
|
|
1770
|
+
}
|
|
1771
|
+
else {
|
|
1772
|
+
placeholderOrientation = exports.PlaceholderGapOrientation.along;
|
|
1773
|
+
placeholderSize = viewContext.getPlaceholderGapSize(placeholderOrientation);
|
|
1774
|
+
placeholdersX.push(cfg.emptyPaddingX);
|
|
1775
|
+
width = placeholderSize.x + cfg.emptyPaddingX * 2;
|
|
1776
|
+
height = placeholderSize.y + cfg.emptyPaddingY * 2;
|
|
1777
|
+
hasOutput = !isInterruptedIfEmpty;
|
|
1778
|
+
if (stepContext.isInputConnected) {
|
|
1779
|
+
inputView = InputView.createRoundInput(g, width / 2, 0, cfg.emptyInputSize);
|
|
1780
|
+
}
|
|
1781
|
+
if (stepContext.isOutputConnected && hasOutput) {
|
|
1782
|
+
outputView = OutputView.create(g, width / 2, height, cfg.emptyOutputSize);
|
|
1783
|
+
}
|
|
1784
|
+
if (cfg.emptyIconSize > 0) {
|
|
1785
|
+
const iconUrl = viewContext.getStepIconUrl();
|
|
1786
|
+
if (iconUrl) {
|
|
1787
|
+
const icon = Dom.svg('image', {
|
|
1788
|
+
href: iconUrl,
|
|
1789
|
+
x: (width - cfg.emptyIconSize) / 2,
|
|
1790
|
+
y: (height - cfg.emptyIconSize) / 2,
|
|
1791
|
+
width: cfg.emptyIconSize,
|
|
1792
|
+
height: cfg.emptyIconSize
|
|
1793
|
+
});
|
|
1794
|
+
g.appendChild(icon);
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
joinX = width / 2;
|
|
1798
|
+
}
|
|
1799
|
+
let regionView = null;
|
|
1800
|
+
if (regionViewFactory) {
|
|
1801
|
+
regionView = regionViewFactory(g, [width], height);
|
|
1802
|
+
}
|
|
1803
|
+
const placeholders = [];
|
|
1804
|
+
const placeholderY = (height - placeholderSize.y) / 2;
|
|
1805
|
+
for (let i = 0; i < placeholdersX.length; i++) {
|
|
1806
|
+
const placeholder = viewContext.createPlaceholderForGap(g, sequence, i, placeholderOrientation);
|
|
1807
|
+
placeholders.push(placeholder);
|
|
1808
|
+
Dom.translate(placeholder.view.g, placeholdersX[i], placeholderY);
|
|
1809
|
+
}
|
|
1810
|
+
return {
|
|
1811
|
+
g,
|
|
1812
|
+
width,
|
|
1813
|
+
height,
|
|
1814
|
+
joinX,
|
|
1815
|
+
components,
|
|
1816
|
+
placeholders,
|
|
1817
|
+
hasOutput,
|
|
1818
|
+
getClientPosition() {
|
|
1819
|
+
return getAbsolutePosition(g);
|
|
1820
|
+
},
|
|
1821
|
+
resolveClick(click) {
|
|
1822
|
+
if (regionView) {
|
|
1823
|
+
const result = regionView.resolveClick(click);
|
|
1824
|
+
return result === true || (result === null && g.contains(click.element)) ? true : result;
|
|
1825
|
+
}
|
|
1826
|
+
return null;
|
|
1827
|
+
},
|
|
1828
|
+
setIsDragging(isDragging) {
|
|
1829
|
+
inputView === null || inputView === void 0 ? void 0 : inputView.setIsHidden(isDragging);
|
|
1830
|
+
outputView === null || outputView === void 0 ? void 0 : outputView.setIsHidden(isDragging);
|
|
1831
|
+
},
|
|
1832
|
+
setIsDisabled(isDisabled) {
|
|
1833
|
+
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1834
|
+
},
|
|
1835
|
+
setIsSelected(isSelected) {
|
|
1836
|
+
regionView === null || regionView === void 0 ? void 0 : regionView.setIsSelected(isSelected);
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
const createLaunchPadStepComponentViewFactory = (isInterruptedIfEmpty, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1841
|
+
if (cfg.isRegionEnabled) {
|
|
1842
|
+
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {
|
|
1843
|
+
return createView$1(g, stepContext, viewContext, regionViewBuilder, isInterruptedIfEmpty, cfg);
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
return createView$1(parentElement, stepContext, viewContext, null, isInterruptedIfEmpty, cfg);
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1693
1849
|
const COMPONENT_CLASS_NAME$1 = 'switch';
|
|
1694
1850
|
function createView(g, width, height, joinX, viewContext, sequenceComponents, regionView, cfg) {
|
|
1695
1851
|
let inputView = null;
|
|
@@ -1703,7 +1859,7 @@
|
|
|
1703
1859
|
height,
|
|
1704
1860
|
joinX,
|
|
1705
1861
|
placeholders: null,
|
|
1706
|
-
sequenceComponents,
|
|
1862
|
+
components: sequenceComponents,
|
|
1707
1863
|
hasOutput: sequenceComponents ? sequenceComponents.some(c => c.hasOutput) : true,
|
|
1708
1864
|
getClientPosition() {
|
|
1709
1865
|
return regionView.getClientPosition();
|
|
@@ -1725,13 +1881,13 @@
|
|
|
1725
1881
|
}
|
|
1726
1882
|
};
|
|
1727
1883
|
}
|
|
1728
|
-
const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
|
|
1884
|
+
const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (parent, stepContext, viewContext) => {
|
|
1729
1885
|
return viewContext.createRegionComponentView(parent, COMPONENT_CLASS_NAME$1, (g, regionViewBuilder) => {
|
|
1730
1886
|
const step = stepContext.step;
|
|
1731
1887
|
const paddingTop = cfg.paddingTop1 + cfg.paddingTop2;
|
|
1732
1888
|
const name = viewContext.getStepName();
|
|
1733
1889
|
const nameLabelView = LabelView.create(g, paddingTop, cfg.nameLabel, name, 'primary');
|
|
1734
|
-
const branchNames = Object.keys(step.branches);
|
|
1890
|
+
const branchNames = branchNameResolver ? branchNameResolver(step) : Object.keys(step.branches);
|
|
1735
1891
|
if (branchNames.length === 0) {
|
|
1736
1892
|
const width = Math.max(nameLabelView.width, cfg.minBranchWidth) + cfg.paddingX * 2;
|
|
1737
1893
|
const height = nameLabelView.height + paddingTop + cfg.noBranchPaddingBottom;
|
|
@@ -1854,7 +2010,7 @@
|
|
|
1854
2010
|
height: cfg.iconSize
|
|
1855
2011
|
});
|
|
1856
2012
|
g.appendChild(icon);
|
|
1857
|
-
const isInputViewHidden = stepContext.
|
|
2013
|
+
const isInputViewHidden = !stepContext.isInputConnected; // TODO: handle inside the folder
|
|
1858
2014
|
const isOutputViewHidden = isInterrupted;
|
|
1859
2015
|
const inputView = isInputViewHidden ? null : InputView.createRoundInput(g, boxWidth / 2, 0, cfg.inputSize);
|
|
1860
2016
|
const outputView = isOutputViewHidden ? null : OutputView.create(g, boxWidth / 2, boxHeight, cfg.outputSize);
|
|
@@ -1863,7 +2019,7 @@
|
|
|
1863
2019
|
width: boxWidth,
|
|
1864
2020
|
height: boxHeight,
|
|
1865
2021
|
joinX: boxWidth / 2,
|
|
1866
|
-
|
|
2022
|
+
components: null,
|
|
1867
2023
|
placeholders: null,
|
|
1868
2024
|
hasOutput: !!outputView,
|
|
1869
2025
|
getClientPosition() {
|
|
@@ -1964,14 +2120,14 @@
|
|
|
1964
2120
|
}
|
|
1965
2121
|
}
|
|
1966
2122
|
|
|
1967
|
-
const defaultConfiguration$
|
|
2123
|
+
const defaultConfiguration$4 = {
|
|
1968
2124
|
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],
|
|
1969
2125
|
smoothDeltaYLimit: 16,
|
|
1970
2126
|
padding: 10
|
|
1971
2127
|
};
|
|
1972
2128
|
class DefaultViewportController {
|
|
1973
2129
|
static create(api, configuration) {
|
|
1974
|
-
const config = configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
2130
|
+
const config = configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4;
|
|
1975
2131
|
const nqn = new NextQuantifiedNumber(config.scales);
|
|
1976
2132
|
return new DefaultViewportController(config.smoothDeltaYLimit, nqn, api, config.padding);
|
|
1977
2133
|
}
|
|
@@ -2038,8 +2194,8 @@
|
|
|
2038
2194
|
if (this.step.id === stepId) {
|
|
2039
2195
|
return this;
|
|
2040
2196
|
}
|
|
2041
|
-
if (this.view.
|
|
2042
|
-
for (const component of this.view.
|
|
2197
|
+
if (this.view.components) {
|
|
2198
|
+
for (const component of this.view.components) {
|
|
2043
2199
|
const result = component.findById(stepId);
|
|
2044
2200
|
if (result) {
|
|
2045
2201
|
return result;
|
|
@@ -2049,14 +2205,22 @@
|
|
|
2049
2205
|
return null;
|
|
2050
2206
|
}
|
|
2051
2207
|
resolveClick(click) {
|
|
2052
|
-
if (this.view.
|
|
2053
|
-
for (const component of this.view.
|
|
2208
|
+
if (this.view.components) {
|
|
2209
|
+
for (const component of this.view.components) {
|
|
2054
2210
|
const result = component.resolveClick(click);
|
|
2055
2211
|
if (result) {
|
|
2056
2212
|
return result;
|
|
2057
2213
|
}
|
|
2058
2214
|
}
|
|
2059
2215
|
}
|
|
2216
|
+
if (this.view.placeholders) {
|
|
2217
|
+
for (const placeholder of this.view.placeholders) {
|
|
2218
|
+
const result = placeholder.resolveClick(click);
|
|
2219
|
+
if (result) {
|
|
2220
|
+
return result;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2060
2224
|
const badgeResult = this.badges.resolveClick(click);
|
|
2061
2225
|
if (badgeResult) {
|
|
2062
2226
|
return badgeResult;
|
|
@@ -2074,8 +2238,8 @@
|
|
|
2074
2238
|
}
|
|
2075
2239
|
resolvePlaceholders(skipComponent, result) {
|
|
2076
2240
|
if (skipComponent !== this) {
|
|
2077
|
-
if (this.view.
|
|
2078
|
-
this.view.
|
|
2241
|
+
if (this.view.components) {
|
|
2242
|
+
this.view.components.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
2079
2243
|
}
|
|
2080
2244
|
if (this.view.placeholders) {
|
|
2081
2245
|
this.view.placeholders.forEach(ph => result.placeholders.push(ph));
|
|
@@ -2093,8 +2257,8 @@
|
|
|
2093
2257
|
this.view.setIsDisabled(isDisabled);
|
|
2094
2258
|
}
|
|
2095
2259
|
updateBadges(result) {
|
|
2096
|
-
if (this.view.
|
|
2097
|
-
this.view.
|
|
2260
|
+
if (this.view.components) {
|
|
2261
|
+
this.view.components.forEach(component => component.updateBadges(result));
|
|
2098
2262
|
}
|
|
2099
2263
|
this.badges.update(result);
|
|
2100
2264
|
}
|
|
@@ -2121,6 +2285,18 @@
|
|
|
2121
2285
|
}
|
|
2122
2286
|
}
|
|
2123
2287
|
|
|
2288
|
+
class PlaceholderController {
|
|
2289
|
+
static create(configuration) {
|
|
2290
|
+
return new PlaceholderController(configuration);
|
|
2291
|
+
}
|
|
2292
|
+
constructor(configuration) {
|
|
2293
|
+
var _a, _b, _c, _d;
|
|
2294
|
+
this.configuration = configuration;
|
|
2295
|
+
this.canCreate = (_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.canCreate) !== null && _b !== void 0 ? _b : (() => true);
|
|
2296
|
+
this.canShow = (_d = (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.canShow) !== null && _d !== void 0 ? _d : (() => true);
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2124
2300
|
class RectPlaceholderView {
|
|
2125
2301
|
static create(parent, width, height, radius, iconSize, direction) {
|
|
2126
2302
|
const g = Dom.svg('g', {
|
|
@@ -2159,8 +2335,8 @@
|
|
|
2159
2335
|
}
|
|
2160
2336
|
|
|
2161
2337
|
class RectPlaceholder {
|
|
2162
|
-
static create(parent, size, direction, sequence, index,
|
|
2163
|
-
const view = RectPlaceholderView.create(parent, size.x, size.y,
|
|
2338
|
+
static create(parent, size, direction, sequence, index, radius, iconSize) {
|
|
2339
|
+
const view = RectPlaceholderView.create(parent, size.x, size.y, radius, iconSize, direction);
|
|
2164
2340
|
return new RectPlaceholder(view, sequence, index);
|
|
2165
2341
|
}
|
|
2166
2342
|
constructor(view, parentSequence, index) {
|
|
@@ -2268,13 +2444,13 @@
|
|
|
2268
2444
|
}
|
|
2269
2445
|
}
|
|
2270
2446
|
|
|
2271
|
-
const defaultConfiguration$
|
|
2447
|
+
const defaultConfiguration$3 = {
|
|
2272
2448
|
gridSizeX: 48,
|
|
2273
2449
|
gridSizeY: 48
|
|
2274
2450
|
};
|
|
2275
2451
|
class LineGridExtension {
|
|
2276
2452
|
static create(configuration) {
|
|
2277
|
-
return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
2453
|
+
return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$3);
|
|
2278
2454
|
}
|
|
2279
2455
|
constructor(configuration) {
|
|
2280
2456
|
this.configuration = configuration;
|
|
@@ -2304,7 +2480,7 @@
|
|
|
2304
2480
|
}
|
|
2305
2481
|
}
|
|
2306
2482
|
|
|
2307
|
-
const defaultConfiguration$
|
|
2483
|
+
const defaultConfiguration$2 = {
|
|
2308
2484
|
view: {
|
|
2309
2485
|
paddingTop: 20,
|
|
2310
2486
|
paddingX: 20,
|
|
@@ -2322,7 +2498,7 @@
|
|
|
2322
2498
|
};
|
|
2323
2499
|
class ContainerStepExtension {
|
|
2324
2500
|
static create(configuration) {
|
|
2325
|
-
return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
2501
|
+
return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);
|
|
2326
2502
|
}
|
|
2327
2503
|
constructor(configuration) {
|
|
2328
2504
|
this.configuration = configuration;
|
|
@@ -2331,40 +2507,39 @@
|
|
|
2331
2507
|
}
|
|
2332
2508
|
}
|
|
2333
2509
|
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
radius: 10
|
|
2357
|
-
}
|
|
2510
|
+
const defaultViewConfiguration$1 = {
|
|
2511
|
+
minBranchWidth: 88,
|
|
2512
|
+
paddingX: 20,
|
|
2513
|
+
paddingTop1: 0,
|
|
2514
|
+
paddingTop2: 22,
|
|
2515
|
+
connectionHeight: 20,
|
|
2516
|
+
noBranchPaddingBottom: 24,
|
|
2517
|
+
inputSize: 18,
|
|
2518
|
+
inputIconSize: 14,
|
|
2519
|
+
inputRadius: 4,
|
|
2520
|
+
autoHideInputOnDrag: true,
|
|
2521
|
+
branchNameLabel: {
|
|
2522
|
+
height: 22,
|
|
2523
|
+
paddingX: 10,
|
|
2524
|
+
minWidth: 50,
|
|
2525
|
+
radius: 10
|
|
2526
|
+
},
|
|
2527
|
+
nameLabel: {
|
|
2528
|
+
height: 22,
|
|
2529
|
+
paddingX: 10,
|
|
2530
|
+
minWidth: 50,
|
|
2531
|
+
radius: 10
|
|
2358
2532
|
}
|
|
2359
2533
|
};
|
|
2360
2534
|
class SwitchStepExtension {
|
|
2361
2535
|
static create(configuration) {
|
|
2362
|
-
return new SwitchStepExtension(configuration
|
|
2536
|
+
return new SwitchStepExtension(configuration);
|
|
2363
2537
|
}
|
|
2364
2538
|
constructor(configuration) {
|
|
2539
|
+
var _a, _b, _c;
|
|
2365
2540
|
this.configuration = configuration;
|
|
2366
2541
|
this.componentType = 'switch';
|
|
2367
|
-
this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);
|
|
2542
|
+
this.createComponentView = createSwitchStepComponentViewFactory((_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.view) !== null && _b !== void 0 ? _b : defaultViewConfiguration$1, (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.branchNamesResolver);
|
|
2368
2543
|
}
|
|
2369
2544
|
}
|
|
2370
2545
|
|
|
@@ -2392,6 +2567,28 @@
|
|
|
2392
2567
|
}
|
|
2393
2568
|
}
|
|
2394
2569
|
|
|
2570
|
+
const defaultViewConfiguration = {
|
|
2571
|
+
isRegionEnabled: true,
|
|
2572
|
+
paddingY: 10,
|
|
2573
|
+
connectionHeight: 20,
|
|
2574
|
+
emptyPaddingX: 20,
|
|
2575
|
+
emptyPaddingY: 20,
|
|
2576
|
+
emptyInputSize: 14,
|
|
2577
|
+
emptyOutputSize: 10,
|
|
2578
|
+
emptyIconSize: 24
|
|
2579
|
+
};
|
|
2580
|
+
class LaunchPadStepExtension {
|
|
2581
|
+
static create(configuration) {
|
|
2582
|
+
return new LaunchPadStepExtension(configuration);
|
|
2583
|
+
}
|
|
2584
|
+
constructor(configuration) {
|
|
2585
|
+
var _a, _b;
|
|
2586
|
+
this.configuration = configuration;
|
|
2587
|
+
this.componentType = 'launchPad';
|
|
2588
|
+
this.createComponentView = createLaunchPadStepComponentViewFactory(false, (_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.view) !== null && _b !== void 0 ? _b : defaultViewConfiguration);
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2395
2592
|
class StepsDesignerExtension {
|
|
2396
2593
|
static create(configuration) {
|
|
2397
2594
|
const steps = [];
|
|
@@ -2404,6 +2601,9 @@
|
|
|
2404
2601
|
if (configuration.task) {
|
|
2405
2602
|
steps.push(TaskStepExtension.create(configuration.task));
|
|
2406
2603
|
}
|
|
2604
|
+
if (configuration.launchPad) {
|
|
2605
|
+
steps.push(LaunchPadStepExtension.create(configuration.launchPad));
|
|
2606
|
+
}
|
|
2407
2607
|
return new StepsDesignerExtension(steps);
|
|
2408
2608
|
}
|
|
2409
2609
|
constructor(steps) {
|
|
@@ -2451,6 +2651,17 @@
|
|
|
2451
2651
|
i18n: componentContext.i18n,
|
|
2452
2652
|
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
2453
2653
|
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
2654
|
+
createStepComponent: (parentElement, parentSequence, step, position) => {
|
|
2655
|
+
return componentContext.stepComponentFactory.create(parentElement, {
|
|
2656
|
+
parentSequence,
|
|
2657
|
+
step,
|
|
2658
|
+
depth: stepContext.depth + 1,
|
|
2659
|
+
position,
|
|
2660
|
+
isInputConnected: stepContext.isInputConnected,
|
|
2661
|
+
isOutputConnected: stepContext.isOutputConnected,
|
|
2662
|
+
isPreview: stepContext.isPreview
|
|
2663
|
+
}, componentContext);
|
|
2664
|
+
},
|
|
2454
2665
|
createSequenceComponent: (parentElement, sequence) => {
|
|
2455
2666
|
const sequenceContext = {
|
|
2456
2667
|
sequence,
|
|
@@ -2464,6 +2675,8 @@
|
|
|
2464
2675
|
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
2465
2676
|
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
2466
2677
|
},
|
|
2678
|
+
getPlaceholderGapSize: orientation => componentContext.services.placeholder.getGapSize(orientation),
|
|
2679
|
+
createPlaceholderForGap: componentContext.services.placeholder.createForGap.bind(componentContext.services.placeholder),
|
|
2467
2680
|
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
2468
2681
|
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
2469
2682
|
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
@@ -2485,7 +2698,7 @@
|
|
|
2485
2698
|
}
|
|
2486
2699
|
|
|
2487
2700
|
class ComponentContext {
|
|
2488
|
-
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage,
|
|
2701
|
+
static create(configuration, state, stepExtensionResolver, placeholderController, definitionWalker, preferenceStorage, i18n, services) {
|
|
2489
2702
|
const validator = new DefinitionValidator(configuration.validator, state);
|
|
2490
2703
|
const iconProvider = new IconProvider(configuration.steps);
|
|
2491
2704
|
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
@@ -2818,14 +3031,15 @@
|
|
|
2818
3031
|
}
|
|
2819
3032
|
|
|
2820
3033
|
class StateModifier {
|
|
2821
|
-
static create(definitionWalker, state, configuration) {
|
|
3034
|
+
static create(definitionWalker, uidGenerator, state, configuration) {
|
|
2822
3035
|
const dependencies = [];
|
|
2823
3036
|
dependencies.push(new SelectedStepIdDefinitionModifierDependency(state, definitionWalker));
|
|
2824
3037
|
dependencies.push(new FolderPathDefinitionModifierDependency(state, definitionWalker));
|
|
2825
|
-
return new StateModifier(definitionWalker, state, configuration, dependencies);
|
|
3038
|
+
return new StateModifier(definitionWalker, uidGenerator, state, configuration, dependencies);
|
|
2826
3039
|
}
|
|
2827
|
-
constructor(definitionWalker, state, configuration, dependencies) {
|
|
3040
|
+
constructor(definitionWalker, uidGenerator, state, configuration, dependencies) {
|
|
2828
3041
|
this.definitionWalker = definitionWalker;
|
|
3042
|
+
this.uidGenerator = uidGenerator;
|
|
2829
3043
|
this.state = state;
|
|
2830
3044
|
this.configuration = configuration;
|
|
2831
3045
|
this.dependencies = dependencies;
|
|
@@ -2834,15 +3048,17 @@
|
|
|
2834
3048
|
this.dependencies.push(dependency);
|
|
2835
3049
|
}
|
|
2836
3050
|
isSelectable(step, parentSequence) {
|
|
2837
|
-
return this.configuration.
|
|
3051
|
+
return this.configuration.isSelectable ? this.configuration.isSelectable(step, parentSequence) : true;
|
|
2838
3052
|
}
|
|
2839
3053
|
trySelectStep(step, parentSequence) {
|
|
2840
3054
|
if (this.isSelectable(step, parentSequence)) {
|
|
2841
3055
|
this.state.setSelectedStepId(step.id);
|
|
3056
|
+
return true;
|
|
2842
3057
|
}
|
|
3058
|
+
return false;
|
|
2843
3059
|
}
|
|
2844
3060
|
trySelectStepById(stepId) {
|
|
2845
|
-
if (this.configuration.
|
|
3061
|
+
if (this.configuration.isSelectable) {
|
|
2846
3062
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2847
3063
|
this.trySelectStep(result.step, result.parentSequence);
|
|
2848
3064
|
}
|
|
@@ -2851,16 +3067,16 @@
|
|
|
2851
3067
|
}
|
|
2852
3068
|
}
|
|
2853
3069
|
isDeletable(stepId) {
|
|
2854
|
-
if (this.configuration.
|
|
3070
|
+
if (this.configuration.isDeletable) {
|
|
2855
3071
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2856
|
-
return this.configuration.
|
|
3072
|
+
return this.configuration.isDeletable(result.step, result.parentSequence);
|
|
2857
3073
|
}
|
|
2858
3074
|
return true;
|
|
2859
3075
|
}
|
|
2860
3076
|
tryDelete(stepId) {
|
|
2861
3077
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2862
|
-
const canDeleteStep = this.configuration.
|
|
2863
|
-
? this.configuration.
|
|
3078
|
+
const canDeleteStep = this.configuration.canDeleteStep
|
|
3079
|
+
? this.configuration.canDeleteStep(result.step, result.parentSequence)
|
|
2864
3080
|
: true;
|
|
2865
3081
|
if (!canDeleteStep) {
|
|
2866
3082
|
return false;
|
|
@@ -2871,46 +3087,43 @@
|
|
|
2871
3087
|
return true;
|
|
2872
3088
|
}
|
|
2873
3089
|
tryInsert(step, targetSequence, targetIndex) {
|
|
2874
|
-
const canInsertStep = this.configuration.
|
|
2875
|
-
? this.configuration.steps.canInsertStep(step, targetSequence, targetIndex)
|
|
2876
|
-
: true;
|
|
3090
|
+
const canInsertStep = this.configuration.canInsertStep ? this.configuration.canInsertStep(step, targetSequence, targetIndex) : true;
|
|
2877
3091
|
if (!canInsertStep) {
|
|
2878
3092
|
return false;
|
|
2879
3093
|
}
|
|
2880
3094
|
SequenceModifier.insertStep(step, targetSequence, targetIndex);
|
|
2881
3095
|
this.state.notifyDefinitionChanged(exports.DefinitionChangeType.stepInserted, step.id);
|
|
2882
|
-
if (!this.configuration.
|
|
3096
|
+
if (!this.configuration.isAutoSelectDisabled) {
|
|
2883
3097
|
this.trySelectStepById(step.id);
|
|
2884
3098
|
}
|
|
2885
3099
|
return true;
|
|
2886
3100
|
}
|
|
2887
3101
|
isDraggable(step, parentSequence) {
|
|
2888
|
-
return this.configuration.
|
|
3102
|
+
return this.configuration.isDraggable ? this.configuration.isDraggable(step, parentSequence) : true;
|
|
2889
3103
|
}
|
|
2890
3104
|
tryMove(sourceSequence, step, targetSequence, targetIndex) {
|
|
2891
3105
|
const apply = SequenceModifier.tryMoveStep(sourceSequence, step, targetSequence, targetIndex);
|
|
2892
3106
|
if (!apply) {
|
|
2893
3107
|
return false;
|
|
2894
3108
|
}
|
|
2895
|
-
const canMoveStep = this.configuration.
|
|
2896
|
-
? this.configuration.
|
|
3109
|
+
const canMoveStep = this.configuration.canMoveStep
|
|
3110
|
+
? this.configuration.canMoveStep(sourceSequence, step, targetSequence, targetIndex)
|
|
2897
3111
|
: true;
|
|
2898
3112
|
if (!canMoveStep) {
|
|
2899
3113
|
return false;
|
|
2900
3114
|
}
|
|
2901
3115
|
apply();
|
|
2902
3116
|
this.state.notifyDefinitionChanged(exports.DefinitionChangeType.stepMoved, step.id);
|
|
2903
|
-
if (!this.configuration.
|
|
3117
|
+
if (!this.configuration.isAutoSelectDisabled) {
|
|
2904
3118
|
this.trySelectStep(step, targetSequence);
|
|
2905
3119
|
}
|
|
2906
3120
|
return true;
|
|
2907
3121
|
}
|
|
2908
3122
|
isDuplicable(step, parentSequence) {
|
|
2909
|
-
return this.configuration.
|
|
3123
|
+
return this.configuration.isDuplicable ? this.configuration.isDuplicable(step, parentSequence) : false;
|
|
2910
3124
|
}
|
|
2911
3125
|
tryDuplicate(step, parentSequence) {
|
|
2912
|
-
const
|
|
2913
|
-
const duplicator = new StepDuplicator(uidGenerator, this.definitionWalker);
|
|
3126
|
+
const duplicator = new StepDuplicator(this.uidGenerator, this.definitionWalker);
|
|
2914
3127
|
const index = parentSequence.indexOf(step);
|
|
2915
3128
|
const newStep = duplicator.duplicate(step);
|
|
2916
3129
|
return this.tryInsert(newStep, parentSequence, index + 1);
|
|
@@ -3156,7 +3369,7 @@
|
|
|
3156
3369
|
|
|
3157
3370
|
class DesignerContext {
|
|
3158
3371
|
static create(placeholder, startDefinition, configuration, services) {
|
|
3159
|
-
var _a, _b, _c, _d, _e;
|
|
3372
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3160
3373
|
const definition = ObjectCloner.deepClone(startDefinition);
|
|
3161
3374
|
const layoutController = new LayoutController(placeholder);
|
|
3162
3375
|
const isReadonly = Boolean(configuration.isReadonly);
|
|
@@ -3165,22 +3378,23 @@
|
|
|
3165
3378
|
const theme = configuration.theme || 'light';
|
|
3166
3379
|
const state = new DesignerState(definition, isReadonly, isToolboxCollapsed, isEditorCollapsed);
|
|
3167
3380
|
const workspaceController = new WorkspaceControllerWrapper();
|
|
3168
|
-
const placeholderController = services.placeholderController.create();
|
|
3169
3381
|
const behaviorController = BehaviorController.create(configuration.shadowRoot);
|
|
3170
3382
|
const stepExtensionResolver = StepExtensionResolver.create(services);
|
|
3383
|
+
const placeholderController = PlaceholderController.create(configuration.placeholder);
|
|
3171
3384
|
const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new DefinitionWalker();
|
|
3172
3385
|
const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
|
|
3173
|
-
const
|
|
3386
|
+
const uidGenerator = (_e = configuration.uidGenerator) !== null && _e !== void 0 ? _e : Uid.next;
|
|
3387
|
+
const stateModifier = StateModifier.create(definitionWalker, uidGenerator, state, configuration.steps);
|
|
3174
3388
|
const customActionController = new CustomActionController(configuration, state, stateModifier);
|
|
3175
3389
|
let historyController = undefined;
|
|
3176
3390
|
if (configuration.undoStackSize) {
|
|
3177
3391
|
historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
|
|
3178
3392
|
}
|
|
3179
|
-
const preferenceStorage = (
|
|
3180
|
-
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage,
|
|
3181
|
-
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
|
|
3393
|
+
const preferenceStorage = (_f = configuration.preferenceStorage) !== null && _f !== void 0 ? _f : new MemoryPreferenceStorage();
|
|
3394
|
+
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, placeholderController, definitionWalker, preferenceStorage, i18n, services);
|
|
3395
|
+
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, uidGenerator, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
|
|
3182
3396
|
}
|
|
3183
|
-
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
3397
|
+
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, uidGenerator, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
3184
3398
|
this.theme = theme;
|
|
3185
3399
|
this.state = state;
|
|
3186
3400
|
this.configuration = configuration;
|
|
@@ -3188,6 +3402,7 @@
|
|
|
3188
3402
|
this.componentContext = componentContext;
|
|
3189
3403
|
this.definitionWalker = definitionWalker;
|
|
3190
3404
|
this.i18n = i18n;
|
|
3405
|
+
this.uidGenerator = uidGenerator;
|
|
3191
3406
|
this.stateModifier = stateModifier;
|
|
3192
3407
|
this.layoutController = layoutController;
|
|
3193
3408
|
this.workspaceController = workspaceController;
|
|
@@ -3418,7 +3633,10 @@
|
|
|
3418
3633
|
if (interrupt) {
|
|
3419
3634
|
return;
|
|
3420
3635
|
}
|
|
3421
|
-
this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence)
|
|
3636
|
+
if (!this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence)) {
|
|
3637
|
+
// If we cannot select the step, we clear the selection.
|
|
3638
|
+
this.state.setSelectedStepId(null);
|
|
3639
|
+
}
|
|
3422
3640
|
return new SelectStepBehaviorEndToken(this.pressedStepComponent.step.id, Date.now());
|
|
3423
3641
|
}
|
|
3424
3642
|
}
|
|
@@ -4704,14 +4922,6 @@
|
|
|
4704
4922
|
}
|
|
4705
4923
|
}
|
|
4706
4924
|
|
|
4707
|
-
class DefaultPlaceholderControllerExtension {
|
|
4708
|
-
create() {
|
|
4709
|
-
return {
|
|
4710
|
-
canCreate: () => true
|
|
4711
|
-
};
|
|
4712
|
-
}
|
|
4713
|
-
}
|
|
4714
|
-
|
|
4715
4925
|
const defaultConfiguration = {
|
|
4716
4926
|
gapWidth: 88,
|
|
4717
4927
|
gapHeight: 24,
|
|
@@ -4724,13 +4934,18 @@
|
|
|
4724
4934
|
}
|
|
4725
4935
|
constructor(configuration) {
|
|
4726
4936
|
this.configuration = configuration;
|
|
4727
|
-
this.
|
|
4937
|
+
this.alongGapSize = new Vector(defaultConfiguration.gapWidth, defaultConfiguration.gapHeight);
|
|
4938
|
+
this.perpendicularGapSize = new Vector(defaultConfiguration.gapHeight, defaultConfiguration.gapWidth);
|
|
4728
4939
|
}
|
|
4729
|
-
|
|
4730
|
-
return
|
|
4940
|
+
getGapSize(orientation) {
|
|
4941
|
+
return orientation === exports.PlaceholderGapOrientation.perpendicular ? this.perpendicularGapSize : this.alongGapSize;
|
|
4942
|
+
}
|
|
4943
|
+
createForGap(parent, parentSequence, index, orientation) {
|
|
4944
|
+
const gapSize = this.getGapSize(orientation);
|
|
4945
|
+
return RectPlaceholder.create(parent, gapSize, exports.PlaceholderDirection.gap, parentSequence, index, this.configuration.radius, this.configuration.iconSize);
|
|
4731
4946
|
}
|
|
4732
4947
|
createForArea(parent, size, direction, parentSequence, index) {
|
|
4733
|
-
return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration);
|
|
4948
|
+
return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration.radius, this.configuration.iconSize);
|
|
4734
4949
|
}
|
|
4735
4950
|
}
|
|
4736
4951
|
|
|
@@ -4799,9 +5014,6 @@
|
|
|
4799
5014
|
if (ext.wheelController) {
|
|
4800
5015
|
services.wheelController = ext.wheelController;
|
|
4801
5016
|
}
|
|
4802
|
-
if (ext.placeholderController) {
|
|
4803
|
-
services.placeholderController = ext.placeholderController;
|
|
4804
|
-
}
|
|
4805
5017
|
if (ext.placeholder) {
|
|
4806
5018
|
services.placeholder = ext.placeholder;
|
|
4807
5019
|
}
|
|
@@ -4835,6 +5047,7 @@
|
|
|
4835
5047
|
services.steps.push(ContainerStepExtension.create());
|
|
4836
5048
|
services.steps.push(SwitchStepExtension.create());
|
|
4837
5049
|
services.steps.push(TaskStepExtension.create());
|
|
5050
|
+
services.steps.push(LaunchPadStepExtension.create());
|
|
4838
5051
|
if (!services.stepComponentViewWrapper) {
|
|
4839
5052
|
services.stepComponentViewWrapper = new DefaultStepComponentViewWrapperExtension();
|
|
4840
5053
|
}
|
|
@@ -4868,9 +5081,6 @@
|
|
|
4868
5081
|
if (!services.wheelController) {
|
|
4869
5082
|
services.wheelController = new ClassicWheelControllerExtension();
|
|
4870
5083
|
}
|
|
4871
|
-
if (!services.placeholderController) {
|
|
4872
|
-
services.placeholderController = new DefaultPlaceholderControllerExtension();
|
|
4873
|
-
}
|
|
4874
5084
|
if (!services.placeholder) {
|
|
4875
5085
|
services.placeholder = RectPlaceholderExtension.create();
|
|
4876
5086
|
}
|
|
@@ -5170,6 +5380,7 @@
|
|
|
5170
5380
|
exports.ObjectCloner = ObjectCloner;
|
|
5171
5381
|
exports.OutputView = OutputView;
|
|
5172
5382
|
exports.PathBarApi = PathBarApi;
|
|
5383
|
+
exports.PlaceholderController = PlaceholderController;
|
|
5173
5384
|
exports.RectPlaceholder = RectPlaceholder;
|
|
5174
5385
|
exports.RectPlaceholderView = RectPlaceholderView;
|
|
5175
5386
|
exports.SelectStepBehaviorEndToken = SelectStepBehaviorEndToken;
|
|
@@ -5188,6 +5399,7 @@
|
|
|
5188
5399
|
exports.ViewportApi = ViewportApi;
|
|
5189
5400
|
exports.WorkspaceApi = WorkspaceApi;
|
|
5190
5401
|
exports.createContainerStepComponentViewFactory = createContainerStepComponentViewFactory;
|
|
5402
|
+
exports.createLaunchPadStepComponentViewFactory = createLaunchPadStepComponentViewFactory;
|
|
5191
5403
|
exports.createSwitchStepComponentViewFactory = createSwitchStepComponentViewFactory;
|
|
5192
5404
|
exports.createTaskStepComponentViewFactory = createTaskStepComponentViewFactory;
|
|
5193
5405
|
exports.getAbsolutePosition = getAbsolutePosition;
|