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/lib/esm/index.js
CHANGED
|
@@ -439,13 +439,16 @@ class PlaceholderFinder {
|
|
|
439
439
|
const scroll = new Vector(window.scrollX, window.scrollY);
|
|
440
440
|
this.cache = this.placeholders.map(placeholder => {
|
|
441
441
|
const rect = placeholder.getClientRect();
|
|
442
|
+
const lt = new Vector(rect.x, rect.y).add(scroll);
|
|
443
|
+
const br = new Vector(rect.x + rect.width, rect.y + rect.height).add(scroll);
|
|
442
444
|
return {
|
|
443
445
|
placeholder,
|
|
444
|
-
lt
|
|
445
|
-
br
|
|
446
|
+
lt,
|
|
447
|
+
br,
|
|
448
|
+
diagSq: lt.x * lt.x + lt.y * lt.y
|
|
446
449
|
};
|
|
447
450
|
});
|
|
448
|
-
this.cache.sort((a, b) => a.
|
|
451
|
+
this.cache.sort((a, b) => a.diagSq - b.diagSq);
|
|
449
452
|
}
|
|
450
453
|
const vR = vLt.x + vWidth;
|
|
451
454
|
const vB = vLt.y + vHeight;
|
|
@@ -597,7 +600,7 @@ class ToolboxApi {
|
|
|
597
600
|
}
|
|
598
601
|
activateStep(step) {
|
|
599
602
|
const newStep = ObjectCloner.deepClone(step);
|
|
600
|
-
newStep.id = this.uidGenerator
|
|
603
|
+
newStep.id = this.uidGenerator();
|
|
601
604
|
return newStep;
|
|
602
605
|
}
|
|
603
606
|
}
|
|
@@ -612,9 +615,9 @@ class StepTypeValidator {
|
|
|
612
615
|
}
|
|
613
616
|
|
|
614
617
|
class ToolboxDataProvider {
|
|
615
|
-
constructor(
|
|
616
|
-
this.iconProvider = iconProvider;
|
|
618
|
+
constructor(i18n, iconProvider, configuration) {
|
|
617
619
|
this.i18n = i18n;
|
|
620
|
+
this.iconProvider = iconProvider;
|
|
618
621
|
this.configuration = configuration;
|
|
619
622
|
this.createItemData = (step) => {
|
|
620
623
|
StepTypeValidator.validate(step.type);
|
|
@@ -819,8 +822,8 @@ class DesignerApi {
|
|
|
819
822
|
static create(context) {
|
|
820
823
|
const workspace = new WorkspaceApi(context.state, context.definitionWalker, context.workspaceController);
|
|
821
824
|
const viewportController = context.services.viewportController.create(workspace);
|
|
822
|
-
const toolboxDataProvider = new ToolboxDataProvider(context.
|
|
823
|
-
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.
|
|
825
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.i18n, context.componentContext.iconProvider, context.configuration.toolbox);
|
|
826
|
+
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);
|
|
824
827
|
}
|
|
825
828
|
constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
826
829
|
this.shadowRoot = shadowRoot;
|
|
@@ -1008,7 +1011,7 @@ class ValidationErrorBadge {
|
|
|
1008
1011
|
}
|
|
1009
1012
|
}
|
|
1010
1013
|
|
|
1011
|
-
const defaultConfiguration$
|
|
1014
|
+
const defaultConfiguration$5 = {
|
|
1012
1015
|
view: {
|
|
1013
1016
|
size: 22,
|
|
1014
1017
|
iconSize: 12
|
|
@@ -1016,7 +1019,7 @@ const defaultConfiguration$7 = {
|
|
|
1016
1019
|
};
|
|
1017
1020
|
class ValidationErrorBadgeExtension {
|
|
1018
1021
|
static create(configuration) {
|
|
1019
|
-
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
1022
|
+
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$5);
|
|
1020
1023
|
}
|
|
1021
1024
|
constructor(configuration) {
|
|
1022
1025
|
this.configuration = configuration;
|
|
@@ -1106,7 +1109,7 @@ class JoinView {
|
|
|
1106
1109
|
switch (targets.length) {
|
|
1107
1110
|
case 1:
|
|
1108
1111
|
if (start.x === targets[0].x) {
|
|
1109
|
-
JoinView.createStraightJoin(parent, start,
|
|
1112
|
+
JoinView.createStraightJoin(parent, start, h * 2 * dy);
|
|
1110
1113
|
}
|
|
1111
1114
|
else {
|
|
1112
1115
|
appendCurvedJoins(parent, start, targets, h, dy);
|
|
@@ -1202,10 +1205,18 @@ class OutputView {
|
|
|
1202
1205
|
}
|
|
1203
1206
|
}
|
|
1204
1207
|
|
|
1208
|
+
// PlaceholderExtension
|
|
1209
|
+
var PlaceholderGapOrientation;
|
|
1210
|
+
(function (PlaceholderGapOrientation) {
|
|
1211
|
+
PlaceholderGapOrientation[PlaceholderGapOrientation["along"] = 0] = "along";
|
|
1212
|
+
PlaceholderGapOrientation[PlaceholderGapOrientation["perpendicular"] = 1] = "perpendicular"; // Goes perpendicular to the flow
|
|
1213
|
+
})(PlaceholderGapOrientation || (PlaceholderGapOrientation = {}));
|
|
1214
|
+
|
|
1205
1215
|
class DefaultSequenceComponentView {
|
|
1206
1216
|
static create(parent, sequenceContext, componentContext) {
|
|
1207
|
-
const
|
|
1208
|
-
const
|
|
1217
|
+
const phSize = componentContext.services.placeholder.getGapSize(PlaceholderGapOrientation.along);
|
|
1218
|
+
const phWidth = phSize.x;
|
|
1219
|
+
const phHeight = phSize.y;
|
|
1209
1220
|
const { sequence } = sequenceContext;
|
|
1210
1221
|
const g = Dom.svg('g');
|
|
1211
1222
|
parent.appendChild(g);
|
|
@@ -1242,7 +1253,7 @@ class DefaultSequenceComponentView {
|
|
|
1242
1253
|
JoinView.createStraightJoin(g, new Vector(joinX, offsetY - phHeight), phHeight);
|
|
1243
1254
|
}
|
|
1244
1255
|
if (!sequenceContext.isPreview && componentContext.placeholderController.canCreate(sequence, i)) {
|
|
1245
|
-
const ph = componentContext.services.placeholder.createForGap(g, sequence, i);
|
|
1256
|
+
const ph = componentContext.services.placeholder.createForGap(g, sequence, i, PlaceholderGapOrientation.along);
|
|
1246
1257
|
Dom.translate(ph.view.g, joinX - phWidth / 2, offsetY - phHeight);
|
|
1247
1258
|
placeholders.push(ph);
|
|
1248
1259
|
}
|
|
@@ -1254,7 +1265,7 @@ class DefaultSequenceComponentView {
|
|
|
1254
1265
|
}
|
|
1255
1266
|
const newIndex = components.length;
|
|
1256
1267
|
if (!sequenceContext.isPreview && componentContext.placeholderController.canCreate(sequence, newIndex)) {
|
|
1257
|
-
const ph = componentContext.services.placeholder.createForGap(g, sequence, newIndex);
|
|
1268
|
+
const ph = componentContext.services.placeholder.createForGap(g, sequence, newIndex, PlaceholderGapOrientation.along);
|
|
1258
1269
|
Dom.translate(ph.view.g, joinX - phWidth / 2, offsetY - phHeight);
|
|
1259
1270
|
placeholders.push(ph);
|
|
1260
1271
|
}
|
|
@@ -1302,21 +1313,19 @@ class DefaultSequenceComponent {
|
|
|
1302
1313
|
}
|
|
1303
1314
|
findById(stepId) {
|
|
1304
1315
|
for (const component of this.view.components) {
|
|
1305
|
-
const
|
|
1306
|
-
if (
|
|
1307
|
-
return
|
|
1316
|
+
const result = component.findById(stepId);
|
|
1317
|
+
if (result) {
|
|
1318
|
+
return result;
|
|
1308
1319
|
}
|
|
1309
1320
|
}
|
|
1310
1321
|
return null;
|
|
1311
1322
|
}
|
|
1312
1323
|
resolvePlaceholders(skipComponent, result) {
|
|
1324
|
+
this.view.components.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
1313
1325
|
this.view.placeholders.forEach(placeholder => result.placeholders.push(placeholder));
|
|
1314
|
-
this.view.components.forEach(c => c.resolvePlaceholders(skipComponent, result));
|
|
1315
1326
|
}
|
|
1316
1327
|
updateBadges(result) {
|
|
1317
|
-
|
|
1318
|
-
component.updateBadges(result);
|
|
1319
|
-
}
|
|
1328
|
+
this.view.components.forEach(component => component.updateBadges(result));
|
|
1320
1329
|
}
|
|
1321
1330
|
}
|
|
1322
1331
|
|
|
@@ -1329,7 +1338,7 @@ var ClickCommandType;
|
|
|
1329
1338
|
})(ClickCommandType || (ClickCommandType = {}));
|
|
1330
1339
|
var PlaceholderDirection;
|
|
1331
1340
|
(function (PlaceholderDirection) {
|
|
1332
|
-
PlaceholderDirection[PlaceholderDirection["
|
|
1341
|
+
PlaceholderDirection[PlaceholderDirection["gap"] = 0] = "gap";
|
|
1333
1342
|
PlaceholderDirection[PlaceholderDirection["in"] = 1] = "in";
|
|
1334
1343
|
PlaceholderDirection[PlaceholderDirection["out"] = 2] = "out";
|
|
1335
1344
|
})(PlaceholderDirection || (PlaceholderDirection = {}));
|
|
@@ -1343,7 +1352,7 @@ class StartStopRootComponentView {
|
|
|
1343
1352
|
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
1344
1353
|
sequence,
|
|
1345
1354
|
depth: 0,
|
|
1346
|
-
isInputConnected:
|
|
1355
|
+
isInputConnected: Boolean(cfg.start),
|
|
1347
1356
|
isOutputConnected: true,
|
|
1348
1357
|
isPreview: false
|
|
1349
1358
|
}, context);
|
|
@@ -1351,9 +1360,11 @@ class StartStopRootComponentView {
|
|
|
1351
1360
|
const x = view.joinX - cfg.size / 2;
|
|
1352
1361
|
const endY = cfg.size + view.height;
|
|
1353
1362
|
const iconSize = parentPlaceIndicator ? cfg.folderIconSize : cfg.defaultIconSize;
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1363
|
+
if (cfg.start) {
|
|
1364
|
+
const startCircle = createCircle('start', parentPlaceIndicator ? cfg.folderIconD : cfg.start.iconD, cfg.size, iconSize);
|
|
1365
|
+
Dom.translate(startCircle, x, 0);
|
|
1366
|
+
g.appendChild(startCircle);
|
|
1367
|
+
}
|
|
1357
1368
|
Dom.translate(view.g, 0, cfg.size);
|
|
1358
1369
|
const stopCircle = createCircle('stop', parentPlaceIndicator ? cfg.folderIconD : cfg.stopIconD, cfg.size, iconSize);
|
|
1359
1370
|
Dom.translate(stopCircle, x, endY);
|
|
@@ -1430,31 +1441,33 @@ class StartStopRootComponent {
|
|
|
1430
1441
|
}
|
|
1431
1442
|
}
|
|
1432
1443
|
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1444
|
+
const defaultViewConfiguration$2 = {
|
|
1445
|
+
size: 30,
|
|
1446
|
+
defaultIconSize: 22,
|
|
1447
|
+
folderIconSize: 18,
|
|
1448
|
+
start: {
|
|
1449
|
+
iconD: Icons.play
|
|
1450
|
+
},
|
|
1451
|
+
stopIconD: Icons.stop,
|
|
1452
|
+
folderIconD: Icons.folder
|
|
1442
1453
|
};
|
|
1443
1454
|
class StartStopRootComponentExtension {
|
|
1444
1455
|
static create(configuration) {
|
|
1445
|
-
return new StartStopRootComponentExtension(configuration
|
|
1456
|
+
return new StartStopRootComponentExtension(configuration);
|
|
1446
1457
|
}
|
|
1447
1458
|
constructor(configuration) {
|
|
1448
1459
|
this.configuration = configuration;
|
|
1449
1460
|
}
|
|
1450
1461
|
create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
1451
|
-
|
|
1462
|
+
var _a;
|
|
1463
|
+
const view = ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.view) ? Object.assign(Object.assign({}, defaultViewConfiguration$2), this.configuration.view) : defaultViewConfiguration$2;
|
|
1464
|
+
return StartStopRootComponent.create(parentElement, sequence, parentPlaceIndicator, context, view);
|
|
1452
1465
|
}
|
|
1453
1466
|
}
|
|
1454
1467
|
|
|
1455
|
-
const COMPONENT_CLASS_NAME$
|
|
1468
|
+
const COMPONENT_CLASS_NAME$3 = 'container';
|
|
1456
1469
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1457
|
-
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$
|
|
1470
|
+
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$3, (g, regionViewBuilder) => {
|
|
1458
1471
|
const step = stepContext.step;
|
|
1459
1472
|
const name = viewContext.getStepName();
|
|
1460
1473
|
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, name, 'primary');
|
|
@@ -1480,7 +1493,7 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1480
1493
|
height,
|
|
1481
1494
|
joinX,
|
|
1482
1495
|
placeholders: null,
|
|
1483
|
-
|
|
1496
|
+
components: [sequenceComponent],
|
|
1484
1497
|
hasOutput: sequenceComponent.hasOutput,
|
|
1485
1498
|
getClientPosition() {
|
|
1486
1499
|
return regionView.getClientPosition();
|
|
@@ -1504,6 +1517,149 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1504
1517
|
});
|
|
1505
1518
|
};
|
|
1506
1519
|
|
|
1520
|
+
const COMPONENT_CLASS_NAME$2 = 'launch-pad';
|
|
1521
|
+
function createView$1(parentElement, stepContext, viewContext, regionViewFactory, isInterruptedIfEmpty, cfg) {
|
|
1522
|
+
const step = stepContext.step;
|
|
1523
|
+
const sequence = stepContext.step.sequence;
|
|
1524
|
+
const g = ComponentDom.stepG(COMPONENT_CLASS_NAME$2, step.type, step.id);
|
|
1525
|
+
parentElement.appendChild(g);
|
|
1526
|
+
const components = [];
|
|
1527
|
+
let width;
|
|
1528
|
+
let height;
|
|
1529
|
+
let joinX;
|
|
1530
|
+
const placeholdersX = [];
|
|
1531
|
+
let placeholderOrientation;
|
|
1532
|
+
let placeholderSize;
|
|
1533
|
+
let hasOutput;
|
|
1534
|
+
let inputView = null;
|
|
1535
|
+
let outputView = null;
|
|
1536
|
+
if (sequence.length > 0) {
|
|
1537
|
+
let maxComponentHeight = 0;
|
|
1538
|
+
for (let i = 0; i < sequence.length; i++) {
|
|
1539
|
+
const component = viewContext.createStepComponent(g, sequence, sequence[i], i);
|
|
1540
|
+
components.push(component);
|
|
1541
|
+
maxComponentHeight = Math.max(maxComponentHeight, component.view.height);
|
|
1542
|
+
}
|
|
1543
|
+
const joinsX = [];
|
|
1544
|
+
const positionsX = [];
|
|
1545
|
+
const spacesY = [];
|
|
1546
|
+
placeholderOrientation = PlaceholderGapOrientation.perpendicular;
|
|
1547
|
+
placeholderSize = viewContext.getPlaceholderGapSize(placeholderOrientation);
|
|
1548
|
+
placeholdersX.push(0);
|
|
1549
|
+
let positionX = placeholderSize.x;
|
|
1550
|
+
for (let i = 0; i < components.length; i++) {
|
|
1551
|
+
if (i > 0) {
|
|
1552
|
+
placeholdersX.push(positionX);
|
|
1553
|
+
positionX += placeholderSize.x;
|
|
1554
|
+
}
|
|
1555
|
+
const component = components[i];
|
|
1556
|
+
const componentY = (maxComponentHeight - component.view.height) / 2 + cfg.connectionHeight + cfg.paddingY;
|
|
1557
|
+
Dom.translate(component.view.g, positionX, componentY);
|
|
1558
|
+
joinsX.push(positionX + component.view.joinX);
|
|
1559
|
+
positionX += component.view.width;
|
|
1560
|
+
positionsX.push(positionX);
|
|
1561
|
+
spacesY.push(Math.max(0, (maxComponentHeight - component.view.height) / 2));
|
|
1562
|
+
}
|
|
1563
|
+
placeholdersX.push(positionX);
|
|
1564
|
+
positionX += placeholderSize.x;
|
|
1565
|
+
width = positionX;
|
|
1566
|
+
height = maxComponentHeight + 2 * cfg.connectionHeight + 2 * cfg.paddingY;
|
|
1567
|
+
const contentJoinX = components.length % 2 === 0
|
|
1568
|
+
? positionsX[Math.max(0, Math.floor(components.length / 2) - 1)] + placeholderSize.x / 2
|
|
1569
|
+
: joinsX[Math.floor(components.length / 2)];
|
|
1570
|
+
if (stepContext.isInputConnected) {
|
|
1571
|
+
const joinsTopY = joinsX.map(x => new Vector(x, cfg.connectionHeight));
|
|
1572
|
+
JoinView.createJoins(g, new Vector(contentJoinX, 0), joinsTopY);
|
|
1573
|
+
for (let i = 0; i < joinsX.length; i++) {
|
|
1574
|
+
JoinView.createStraightJoin(g, joinsTopY[i], cfg.paddingY + spacesY[i]);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
const joinsBottomY = joinsX.map(x => new Vector(x, cfg.connectionHeight + 2 * cfg.paddingY + maxComponentHeight));
|
|
1578
|
+
JoinView.createJoins(g, new Vector(contentJoinX, height), joinsBottomY);
|
|
1579
|
+
for (let i = 0; i < joinsX.length; i++) {
|
|
1580
|
+
JoinView.createStraightJoin(g, joinsBottomY[i], -(cfg.paddingY + spacesY[i]));
|
|
1581
|
+
}
|
|
1582
|
+
hasOutput = true;
|
|
1583
|
+
joinX = contentJoinX;
|
|
1584
|
+
}
|
|
1585
|
+
else {
|
|
1586
|
+
placeholderOrientation = PlaceholderGapOrientation.along;
|
|
1587
|
+
placeholderSize = viewContext.getPlaceholderGapSize(placeholderOrientation);
|
|
1588
|
+
placeholdersX.push(cfg.emptyPaddingX);
|
|
1589
|
+
width = placeholderSize.x + cfg.emptyPaddingX * 2;
|
|
1590
|
+
height = placeholderSize.y + cfg.emptyPaddingY * 2;
|
|
1591
|
+
hasOutput = !isInterruptedIfEmpty;
|
|
1592
|
+
if (stepContext.isInputConnected) {
|
|
1593
|
+
inputView = InputView.createRoundInput(g, width / 2, 0, cfg.emptyInputSize);
|
|
1594
|
+
}
|
|
1595
|
+
if (stepContext.isOutputConnected && hasOutput) {
|
|
1596
|
+
outputView = OutputView.create(g, width / 2, height, cfg.emptyOutputSize);
|
|
1597
|
+
}
|
|
1598
|
+
if (cfg.emptyIconSize > 0) {
|
|
1599
|
+
const iconUrl = viewContext.getStepIconUrl();
|
|
1600
|
+
if (iconUrl) {
|
|
1601
|
+
const icon = Dom.svg('image', {
|
|
1602
|
+
href: iconUrl,
|
|
1603
|
+
x: (width - cfg.emptyIconSize) / 2,
|
|
1604
|
+
y: (height - cfg.emptyIconSize) / 2,
|
|
1605
|
+
width: cfg.emptyIconSize,
|
|
1606
|
+
height: cfg.emptyIconSize
|
|
1607
|
+
});
|
|
1608
|
+
g.appendChild(icon);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
joinX = width / 2;
|
|
1612
|
+
}
|
|
1613
|
+
let regionView = null;
|
|
1614
|
+
if (regionViewFactory) {
|
|
1615
|
+
regionView = regionViewFactory(g, [width], height);
|
|
1616
|
+
}
|
|
1617
|
+
const placeholders = [];
|
|
1618
|
+
const placeholderY = (height - placeholderSize.y) / 2;
|
|
1619
|
+
for (let i = 0; i < placeholdersX.length; i++) {
|
|
1620
|
+
const placeholder = viewContext.createPlaceholderForGap(g, sequence, i, placeholderOrientation);
|
|
1621
|
+
placeholders.push(placeholder);
|
|
1622
|
+
Dom.translate(placeholder.view.g, placeholdersX[i], placeholderY);
|
|
1623
|
+
}
|
|
1624
|
+
return {
|
|
1625
|
+
g,
|
|
1626
|
+
width,
|
|
1627
|
+
height,
|
|
1628
|
+
joinX,
|
|
1629
|
+
components,
|
|
1630
|
+
placeholders,
|
|
1631
|
+
hasOutput,
|
|
1632
|
+
getClientPosition() {
|
|
1633
|
+
return getAbsolutePosition(g);
|
|
1634
|
+
},
|
|
1635
|
+
resolveClick(click) {
|
|
1636
|
+
if (regionView) {
|
|
1637
|
+
const result = regionView.resolveClick(click);
|
|
1638
|
+
return result === true || (result === null && g.contains(click.element)) ? true : result;
|
|
1639
|
+
}
|
|
1640
|
+
return null;
|
|
1641
|
+
},
|
|
1642
|
+
setIsDragging(isDragging) {
|
|
1643
|
+
inputView === null || inputView === void 0 ? void 0 : inputView.setIsHidden(isDragging);
|
|
1644
|
+
outputView === null || outputView === void 0 ? void 0 : outputView.setIsHidden(isDragging);
|
|
1645
|
+
},
|
|
1646
|
+
setIsDisabled(isDisabled) {
|
|
1647
|
+
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1648
|
+
},
|
|
1649
|
+
setIsSelected(isSelected) {
|
|
1650
|
+
regionView === null || regionView === void 0 ? void 0 : regionView.setIsSelected(isSelected);
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
const createLaunchPadStepComponentViewFactory = (isInterruptedIfEmpty, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1655
|
+
if (cfg.isRegionEnabled) {
|
|
1656
|
+
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {
|
|
1657
|
+
return createView$1(g, stepContext, viewContext, regionViewBuilder, isInterruptedIfEmpty, cfg);
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
return createView$1(parentElement, stepContext, viewContext, null, isInterruptedIfEmpty, cfg);
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1507
1663
|
const COMPONENT_CLASS_NAME$1 = 'switch';
|
|
1508
1664
|
function createView(g, width, height, joinX, viewContext, sequenceComponents, regionView, cfg) {
|
|
1509
1665
|
let inputView = null;
|
|
@@ -1517,7 +1673,7 @@ function createView(g, width, height, joinX, viewContext, sequenceComponents, re
|
|
|
1517
1673
|
height,
|
|
1518
1674
|
joinX,
|
|
1519
1675
|
placeholders: null,
|
|
1520
|
-
sequenceComponents,
|
|
1676
|
+
components: sequenceComponents,
|
|
1521
1677
|
hasOutput: sequenceComponents ? sequenceComponents.some(c => c.hasOutput) : true,
|
|
1522
1678
|
getClientPosition() {
|
|
1523
1679
|
return regionView.getClientPosition();
|
|
@@ -1539,13 +1695,13 @@ function createView(g, width, height, joinX, viewContext, sequenceComponents, re
|
|
|
1539
1695
|
}
|
|
1540
1696
|
};
|
|
1541
1697
|
}
|
|
1542
|
-
const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
|
|
1698
|
+
const createSwitchStepComponentViewFactory = (cfg, branchNameResolver) => (parent, stepContext, viewContext) => {
|
|
1543
1699
|
return viewContext.createRegionComponentView(parent, COMPONENT_CLASS_NAME$1, (g, regionViewBuilder) => {
|
|
1544
1700
|
const step = stepContext.step;
|
|
1545
1701
|
const paddingTop = cfg.paddingTop1 + cfg.paddingTop2;
|
|
1546
1702
|
const name = viewContext.getStepName();
|
|
1547
1703
|
const nameLabelView = LabelView.create(g, paddingTop, cfg.nameLabel, name, 'primary');
|
|
1548
|
-
const branchNames = Object.keys(step.branches);
|
|
1704
|
+
const branchNames = branchNameResolver ? branchNameResolver(step) : Object.keys(step.branches);
|
|
1549
1705
|
if (branchNames.length === 0) {
|
|
1550
1706
|
const width = Math.max(nameLabelView.width, cfg.minBranchWidth) + cfg.paddingX * 2;
|
|
1551
1707
|
const height = nameLabelView.height + paddingTop + cfg.noBranchPaddingBottom;
|
|
@@ -1668,7 +1824,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1668
1824
|
height: cfg.iconSize
|
|
1669
1825
|
});
|
|
1670
1826
|
g.appendChild(icon);
|
|
1671
|
-
const isInputViewHidden = stepContext.
|
|
1827
|
+
const isInputViewHidden = !stepContext.isInputConnected; // TODO: handle inside the folder
|
|
1672
1828
|
const isOutputViewHidden = isInterrupted;
|
|
1673
1829
|
const inputView = isInputViewHidden ? null : InputView.createRoundInput(g, boxWidth / 2, 0, cfg.inputSize);
|
|
1674
1830
|
const outputView = isOutputViewHidden ? null : OutputView.create(g, boxWidth / 2, boxHeight, cfg.outputSize);
|
|
@@ -1677,7 +1833,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1677
1833
|
width: boxWidth,
|
|
1678
1834
|
height: boxHeight,
|
|
1679
1835
|
joinX: boxWidth / 2,
|
|
1680
|
-
|
|
1836
|
+
components: null,
|
|
1681
1837
|
placeholders: null,
|
|
1682
1838
|
hasOutput: !!outputView,
|
|
1683
1839
|
getClientPosition() {
|
|
@@ -1778,14 +1934,14 @@ class NextQuantifiedNumber {
|
|
|
1778
1934
|
}
|
|
1779
1935
|
}
|
|
1780
1936
|
|
|
1781
|
-
const defaultConfiguration$
|
|
1937
|
+
const defaultConfiguration$4 = {
|
|
1782
1938
|
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],
|
|
1783
1939
|
smoothDeltaYLimit: 16,
|
|
1784
1940
|
padding: 10
|
|
1785
1941
|
};
|
|
1786
1942
|
class DefaultViewportController {
|
|
1787
1943
|
static create(api, configuration) {
|
|
1788
|
-
const config = configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
1944
|
+
const config = configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4;
|
|
1789
1945
|
const nqn = new NextQuantifiedNumber(config.scales);
|
|
1790
1946
|
return new DefaultViewportController(config.smoothDeltaYLimit, nqn, api, config.padding);
|
|
1791
1947
|
}
|
|
@@ -1852,8 +2008,8 @@ class StepComponent {
|
|
|
1852
2008
|
if (this.step.id === stepId) {
|
|
1853
2009
|
return this;
|
|
1854
2010
|
}
|
|
1855
|
-
if (this.view.
|
|
1856
|
-
for (const component of this.view.
|
|
2011
|
+
if (this.view.components) {
|
|
2012
|
+
for (const component of this.view.components) {
|
|
1857
2013
|
const result = component.findById(stepId);
|
|
1858
2014
|
if (result) {
|
|
1859
2015
|
return result;
|
|
@@ -1863,14 +2019,22 @@ class StepComponent {
|
|
|
1863
2019
|
return null;
|
|
1864
2020
|
}
|
|
1865
2021
|
resolveClick(click) {
|
|
1866
|
-
if (this.view.
|
|
1867
|
-
for (const component of this.view.
|
|
2022
|
+
if (this.view.components) {
|
|
2023
|
+
for (const component of this.view.components) {
|
|
1868
2024
|
const result = component.resolveClick(click);
|
|
1869
2025
|
if (result) {
|
|
1870
2026
|
return result;
|
|
1871
2027
|
}
|
|
1872
2028
|
}
|
|
1873
2029
|
}
|
|
2030
|
+
if (this.view.placeholders) {
|
|
2031
|
+
for (const placeholder of this.view.placeholders) {
|
|
2032
|
+
const result = placeholder.resolveClick(click);
|
|
2033
|
+
if (result) {
|
|
2034
|
+
return result;
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
1874
2038
|
const badgeResult = this.badges.resolveClick(click);
|
|
1875
2039
|
if (badgeResult) {
|
|
1876
2040
|
return badgeResult;
|
|
@@ -1888,8 +2052,8 @@ class StepComponent {
|
|
|
1888
2052
|
}
|
|
1889
2053
|
resolvePlaceholders(skipComponent, result) {
|
|
1890
2054
|
if (skipComponent !== this) {
|
|
1891
|
-
if (this.view.
|
|
1892
|
-
this.view.
|
|
2055
|
+
if (this.view.components) {
|
|
2056
|
+
this.view.components.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
1893
2057
|
}
|
|
1894
2058
|
if (this.view.placeholders) {
|
|
1895
2059
|
this.view.placeholders.forEach(ph => result.placeholders.push(ph));
|
|
@@ -1907,8 +2071,8 @@ class StepComponent {
|
|
|
1907
2071
|
this.view.setIsDisabled(isDisabled);
|
|
1908
2072
|
}
|
|
1909
2073
|
updateBadges(result) {
|
|
1910
|
-
if (this.view.
|
|
1911
|
-
this.view.
|
|
2074
|
+
if (this.view.components) {
|
|
2075
|
+
this.view.components.forEach(component => component.updateBadges(result));
|
|
1912
2076
|
}
|
|
1913
2077
|
this.badges.update(result);
|
|
1914
2078
|
}
|
|
@@ -1935,6 +2099,18 @@ class StepExtensionResolver {
|
|
|
1935
2099
|
}
|
|
1936
2100
|
}
|
|
1937
2101
|
|
|
2102
|
+
class PlaceholderController {
|
|
2103
|
+
static create(configuration) {
|
|
2104
|
+
return new PlaceholderController(configuration);
|
|
2105
|
+
}
|
|
2106
|
+
constructor(configuration) {
|
|
2107
|
+
var _a, _b, _c, _d;
|
|
2108
|
+
this.configuration = configuration;
|
|
2109
|
+
this.canCreate = (_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.canCreate) !== null && _b !== void 0 ? _b : (() => true);
|
|
2110
|
+
this.canShow = (_d = (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.canShow) !== null && _d !== void 0 ? _d : (() => true);
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
|
|
1938
2114
|
class RectPlaceholderView {
|
|
1939
2115
|
static create(parent, width, height, radius, iconSize, direction) {
|
|
1940
2116
|
const g = Dom.svg('g', {
|
|
@@ -1973,8 +2149,8 @@ class RectPlaceholderView {
|
|
|
1973
2149
|
}
|
|
1974
2150
|
|
|
1975
2151
|
class RectPlaceholder {
|
|
1976
|
-
static create(parent, size, direction, sequence, index,
|
|
1977
|
-
const view = RectPlaceholderView.create(parent, size.x, size.y,
|
|
2152
|
+
static create(parent, size, direction, sequence, index, radius, iconSize) {
|
|
2153
|
+
const view = RectPlaceholderView.create(parent, size.x, size.y, radius, iconSize, direction);
|
|
1978
2154
|
return new RectPlaceholder(view, sequence, index);
|
|
1979
2155
|
}
|
|
1980
2156
|
constructor(view, parentSequence, index) {
|
|
@@ -2082,13 +2258,13 @@ class LineGrid {
|
|
|
2082
2258
|
}
|
|
2083
2259
|
}
|
|
2084
2260
|
|
|
2085
|
-
const defaultConfiguration$
|
|
2261
|
+
const defaultConfiguration$3 = {
|
|
2086
2262
|
gridSizeX: 48,
|
|
2087
2263
|
gridSizeY: 48
|
|
2088
2264
|
};
|
|
2089
2265
|
class LineGridExtension {
|
|
2090
2266
|
static create(configuration) {
|
|
2091
|
-
return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
2267
|
+
return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$3);
|
|
2092
2268
|
}
|
|
2093
2269
|
constructor(configuration) {
|
|
2094
2270
|
this.configuration = configuration;
|
|
@@ -2118,7 +2294,7 @@ class StartStopRootComponentDesignerExtension {
|
|
|
2118
2294
|
}
|
|
2119
2295
|
}
|
|
2120
2296
|
|
|
2121
|
-
const defaultConfiguration$
|
|
2297
|
+
const defaultConfiguration$2 = {
|
|
2122
2298
|
view: {
|
|
2123
2299
|
paddingTop: 20,
|
|
2124
2300
|
paddingX: 20,
|
|
@@ -2136,7 +2312,7 @@ const defaultConfiguration$3 = {
|
|
|
2136
2312
|
};
|
|
2137
2313
|
class ContainerStepExtension {
|
|
2138
2314
|
static create(configuration) {
|
|
2139
|
-
return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
2315
|
+
return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);
|
|
2140
2316
|
}
|
|
2141
2317
|
constructor(configuration) {
|
|
2142
2318
|
this.configuration = configuration;
|
|
@@ -2145,40 +2321,39 @@ class ContainerStepExtension {
|
|
|
2145
2321
|
}
|
|
2146
2322
|
}
|
|
2147
2323
|
|
|
2148
|
-
const
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
radius: 10
|
|
2171
|
-
}
|
|
2324
|
+
const defaultViewConfiguration$1 = {
|
|
2325
|
+
minBranchWidth: 88,
|
|
2326
|
+
paddingX: 20,
|
|
2327
|
+
paddingTop1: 0,
|
|
2328
|
+
paddingTop2: 22,
|
|
2329
|
+
connectionHeight: 20,
|
|
2330
|
+
noBranchPaddingBottom: 24,
|
|
2331
|
+
inputSize: 18,
|
|
2332
|
+
inputIconSize: 14,
|
|
2333
|
+
inputRadius: 4,
|
|
2334
|
+
autoHideInputOnDrag: true,
|
|
2335
|
+
branchNameLabel: {
|
|
2336
|
+
height: 22,
|
|
2337
|
+
paddingX: 10,
|
|
2338
|
+
minWidth: 50,
|
|
2339
|
+
radius: 10
|
|
2340
|
+
},
|
|
2341
|
+
nameLabel: {
|
|
2342
|
+
height: 22,
|
|
2343
|
+
paddingX: 10,
|
|
2344
|
+
minWidth: 50,
|
|
2345
|
+
radius: 10
|
|
2172
2346
|
}
|
|
2173
2347
|
};
|
|
2174
2348
|
class SwitchStepExtension {
|
|
2175
2349
|
static create(configuration) {
|
|
2176
|
-
return new SwitchStepExtension(configuration
|
|
2350
|
+
return new SwitchStepExtension(configuration);
|
|
2177
2351
|
}
|
|
2178
2352
|
constructor(configuration) {
|
|
2353
|
+
var _a, _b, _c;
|
|
2179
2354
|
this.configuration = configuration;
|
|
2180
2355
|
this.componentType = 'switch';
|
|
2181
|
-
this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);
|
|
2356
|
+
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);
|
|
2182
2357
|
}
|
|
2183
2358
|
}
|
|
2184
2359
|
|
|
@@ -2206,6 +2381,28 @@ class TaskStepExtension {
|
|
|
2206
2381
|
}
|
|
2207
2382
|
}
|
|
2208
2383
|
|
|
2384
|
+
const defaultViewConfiguration = {
|
|
2385
|
+
isRegionEnabled: true,
|
|
2386
|
+
paddingY: 10,
|
|
2387
|
+
connectionHeight: 20,
|
|
2388
|
+
emptyPaddingX: 20,
|
|
2389
|
+
emptyPaddingY: 20,
|
|
2390
|
+
emptyInputSize: 14,
|
|
2391
|
+
emptyOutputSize: 10,
|
|
2392
|
+
emptyIconSize: 24
|
|
2393
|
+
};
|
|
2394
|
+
class LaunchPadStepExtension {
|
|
2395
|
+
static create(configuration) {
|
|
2396
|
+
return new LaunchPadStepExtension(configuration);
|
|
2397
|
+
}
|
|
2398
|
+
constructor(configuration) {
|
|
2399
|
+
var _a, _b;
|
|
2400
|
+
this.configuration = configuration;
|
|
2401
|
+
this.componentType = 'launchPad';
|
|
2402
|
+
this.createComponentView = createLaunchPadStepComponentViewFactory(false, (_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.view) !== null && _b !== void 0 ? _b : defaultViewConfiguration);
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2209
2406
|
class StepsDesignerExtension {
|
|
2210
2407
|
static create(configuration) {
|
|
2211
2408
|
const steps = [];
|
|
@@ -2218,6 +2415,9 @@ class StepsDesignerExtension {
|
|
|
2218
2415
|
if (configuration.task) {
|
|
2219
2416
|
steps.push(TaskStepExtension.create(configuration.task));
|
|
2220
2417
|
}
|
|
2418
|
+
if (configuration.launchPad) {
|
|
2419
|
+
steps.push(LaunchPadStepExtension.create(configuration.launchPad));
|
|
2420
|
+
}
|
|
2221
2421
|
return new StepsDesignerExtension(steps);
|
|
2222
2422
|
}
|
|
2223
2423
|
constructor(steps) {
|
|
@@ -2265,6 +2465,17 @@ class StepComponentViewContextFactory {
|
|
|
2265
2465
|
i18n: componentContext.i18n,
|
|
2266
2466
|
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
2267
2467
|
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
2468
|
+
createStepComponent: (parentElement, parentSequence, step, position) => {
|
|
2469
|
+
return componentContext.stepComponentFactory.create(parentElement, {
|
|
2470
|
+
parentSequence,
|
|
2471
|
+
step,
|
|
2472
|
+
depth: stepContext.depth + 1,
|
|
2473
|
+
position,
|
|
2474
|
+
isInputConnected: stepContext.isInputConnected,
|
|
2475
|
+
isOutputConnected: stepContext.isOutputConnected,
|
|
2476
|
+
isPreview: stepContext.isPreview
|
|
2477
|
+
}, componentContext);
|
|
2478
|
+
},
|
|
2268
2479
|
createSequenceComponent: (parentElement, sequence) => {
|
|
2269
2480
|
const sequenceContext = {
|
|
2270
2481
|
sequence,
|
|
@@ -2278,6 +2489,8 @@ class StepComponentViewContextFactory {
|
|
|
2278
2489
|
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
2279
2490
|
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
2280
2491
|
},
|
|
2492
|
+
getPlaceholderGapSize: orientation => componentContext.services.placeholder.getGapSize(orientation),
|
|
2493
|
+
createPlaceholderForGap: componentContext.services.placeholder.createForGap.bind(componentContext.services.placeholder),
|
|
2281
2494
|
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
2282
2495
|
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
2283
2496
|
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
@@ -2299,7 +2512,7 @@ class StepComponentFactory {
|
|
|
2299
2512
|
}
|
|
2300
2513
|
|
|
2301
2514
|
class ComponentContext {
|
|
2302
|
-
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage,
|
|
2515
|
+
static create(configuration, state, stepExtensionResolver, placeholderController, definitionWalker, preferenceStorage, i18n, services) {
|
|
2303
2516
|
const validator = new DefinitionValidator(configuration.validator, state);
|
|
2304
2517
|
const iconProvider = new IconProvider(configuration.steps);
|
|
2305
2518
|
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
@@ -2632,14 +2845,15 @@ class SelectedStepIdDefinitionModifierDependency {
|
|
|
2632
2845
|
}
|
|
2633
2846
|
|
|
2634
2847
|
class StateModifier {
|
|
2635
|
-
static create(definitionWalker, state, configuration) {
|
|
2848
|
+
static create(definitionWalker, uidGenerator, state, configuration) {
|
|
2636
2849
|
const dependencies = [];
|
|
2637
2850
|
dependencies.push(new SelectedStepIdDefinitionModifierDependency(state, definitionWalker));
|
|
2638
2851
|
dependencies.push(new FolderPathDefinitionModifierDependency(state, definitionWalker));
|
|
2639
|
-
return new StateModifier(definitionWalker, state, configuration, dependencies);
|
|
2852
|
+
return new StateModifier(definitionWalker, uidGenerator, state, configuration, dependencies);
|
|
2640
2853
|
}
|
|
2641
|
-
constructor(definitionWalker, state, configuration, dependencies) {
|
|
2854
|
+
constructor(definitionWalker, uidGenerator, state, configuration, dependencies) {
|
|
2642
2855
|
this.definitionWalker = definitionWalker;
|
|
2856
|
+
this.uidGenerator = uidGenerator;
|
|
2643
2857
|
this.state = state;
|
|
2644
2858
|
this.configuration = configuration;
|
|
2645
2859
|
this.dependencies = dependencies;
|
|
@@ -2648,15 +2862,17 @@ class StateModifier {
|
|
|
2648
2862
|
this.dependencies.push(dependency);
|
|
2649
2863
|
}
|
|
2650
2864
|
isSelectable(step, parentSequence) {
|
|
2651
|
-
return this.configuration.
|
|
2865
|
+
return this.configuration.isSelectable ? this.configuration.isSelectable(step, parentSequence) : true;
|
|
2652
2866
|
}
|
|
2653
2867
|
trySelectStep(step, parentSequence) {
|
|
2654
2868
|
if (this.isSelectable(step, parentSequence)) {
|
|
2655
2869
|
this.state.setSelectedStepId(step.id);
|
|
2870
|
+
return true;
|
|
2656
2871
|
}
|
|
2872
|
+
return false;
|
|
2657
2873
|
}
|
|
2658
2874
|
trySelectStepById(stepId) {
|
|
2659
|
-
if (this.configuration.
|
|
2875
|
+
if (this.configuration.isSelectable) {
|
|
2660
2876
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2661
2877
|
this.trySelectStep(result.step, result.parentSequence);
|
|
2662
2878
|
}
|
|
@@ -2665,16 +2881,16 @@ class StateModifier {
|
|
|
2665
2881
|
}
|
|
2666
2882
|
}
|
|
2667
2883
|
isDeletable(stepId) {
|
|
2668
|
-
if (this.configuration.
|
|
2884
|
+
if (this.configuration.isDeletable) {
|
|
2669
2885
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2670
|
-
return this.configuration.
|
|
2886
|
+
return this.configuration.isDeletable(result.step, result.parentSequence);
|
|
2671
2887
|
}
|
|
2672
2888
|
return true;
|
|
2673
2889
|
}
|
|
2674
2890
|
tryDelete(stepId) {
|
|
2675
2891
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2676
|
-
const canDeleteStep = this.configuration.
|
|
2677
|
-
? this.configuration.
|
|
2892
|
+
const canDeleteStep = this.configuration.canDeleteStep
|
|
2893
|
+
? this.configuration.canDeleteStep(result.step, result.parentSequence)
|
|
2678
2894
|
: true;
|
|
2679
2895
|
if (!canDeleteStep) {
|
|
2680
2896
|
return false;
|
|
@@ -2685,46 +2901,43 @@ class StateModifier {
|
|
|
2685
2901
|
return true;
|
|
2686
2902
|
}
|
|
2687
2903
|
tryInsert(step, targetSequence, targetIndex) {
|
|
2688
|
-
const canInsertStep = this.configuration.
|
|
2689
|
-
? this.configuration.steps.canInsertStep(step, targetSequence, targetIndex)
|
|
2690
|
-
: true;
|
|
2904
|
+
const canInsertStep = this.configuration.canInsertStep ? this.configuration.canInsertStep(step, targetSequence, targetIndex) : true;
|
|
2691
2905
|
if (!canInsertStep) {
|
|
2692
2906
|
return false;
|
|
2693
2907
|
}
|
|
2694
2908
|
SequenceModifier.insertStep(step, targetSequence, targetIndex);
|
|
2695
2909
|
this.state.notifyDefinitionChanged(DefinitionChangeType.stepInserted, step.id);
|
|
2696
|
-
if (!this.configuration.
|
|
2910
|
+
if (!this.configuration.isAutoSelectDisabled) {
|
|
2697
2911
|
this.trySelectStepById(step.id);
|
|
2698
2912
|
}
|
|
2699
2913
|
return true;
|
|
2700
2914
|
}
|
|
2701
2915
|
isDraggable(step, parentSequence) {
|
|
2702
|
-
return this.configuration.
|
|
2916
|
+
return this.configuration.isDraggable ? this.configuration.isDraggable(step, parentSequence) : true;
|
|
2703
2917
|
}
|
|
2704
2918
|
tryMove(sourceSequence, step, targetSequence, targetIndex) {
|
|
2705
2919
|
const apply = SequenceModifier.tryMoveStep(sourceSequence, step, targetSequence, targetIndex);
|
|
2706
2920
|
if (!apply) {
|
|
2707
2921
|
return false;
|
|
2708
2922
|
}
|
|
2709
|
-
const canMoveStep = this.configuration.
|
|
2710
|
-
? this.configuration.
|
|
2923
|
+
const canMoveStep = this.configuration.canMoveStep
|
|
2924
|
+
? this.configuration.canMoveStep(sourceSequence, step, targetSequence, targetIndex)
|
|
2711
2925
|
: true;
|
|
2712
2926
|
if (!canMoveStep) {
|
|
2713
2927
|
return false;
|
|
2714
2928
|
}
|
|
2715
2929
|
apply();
|
|
2716
2930
|
this.state.notifyDefinitionChanged(DefinitionChangeType.stepMoved, step.id);
|
|
2717
|
-
if (!this.configuration.
|
|
2931
|
+
if (!this.configuration.isAutoSelectDisabled) {
|
|
2718
2932
|
this.trySelectStep(step, targetSequence);
|
|
2719
2933
|
}
|
|
2720
2934
|
return true;
|
|
2721
2935
|
}
|
|
2722
2936
|
isDuplicable(step, parentSequence) {
|
|
2723
|
-
return this.configuration.
|
|
2937
|
+
return this.configuration.isDuplicable ? this.configuration.isDuplicable(step, parentSequence) : false;
|
|
2724
2938
|
}
|
|
2725
2939
|
tryDuplicate(step, parentSequence) {
|
|
2726
|
-
const
|
|
2727
|
-
const duplicator = new StepDuplicator(uidGenerator, this.definitionWalker);
|
|
2940
|
+
const duplicator = new StepDuplicator(this.uidGenerator, this.definitionWalker);
|
|
2728
2941
|
const index = parentSequence.indexOf(step);
|
|
2729
2942
|
const newStep = duplicator.duplicate(step);
|
|
2730
2943
|
return this.tryInsert(newStep, parentSequence, index + 1);
|
|
@@ -2970,7 +3183,7 @@ class MemoryPreferenceStorage {
|
|
|
2970
3183
|
|
|
2971
3184
|
class DesignerContext {
|
|
2972
3185
|
static create(placeholder, startDefinition, configuration, services) {
|
|
2973
|
-
var _a, _b, _c, _d, _e;
|
|
3186
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2974
3187
|
const definition = ObjectCloner.deepClone(startDefinition);
|
|
2975
3188
|
const layoutController = new LayoutController(placeholder);
|
|
2976
3189
|
const isReadonly = Boolean(configuration.isReadonly);
|
|
@@ -2979,22 +3192,23 @@ class DesignerContext {
|
|
|
2979
3192
|
const theme = configuration.theme || 'light';
|
|
2980
3193
|
const state = new DesignerState(definition, isReadonly, isToolboxCollapsed, isEditorCollapsed);
|
|
2981
3194
|
const workspaceController = new WorkspaceControllerWrapper();
|
|
2982
|
-
const placeholderController = services.placeholderController.create();
|
|
2983
3195
|
const behaviorController = BehaviorController.create(configuration.shadowRoot);
|
|
2984
3196
|
const stepExtensionResolver = StepExtensionResolver.create(services);
|
|
3197
|
+
const placeholderController = PlaceholderController.create(configuration.placeholder);
|
|
2985
3198
|
const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new DefinitionWalker();
|
|
2986
3199
|
const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
|
|
2987
|
-
const
|
|
3200
|
+
const uidGenerator = (_e = configuration.uidGenerator) !== null && _e !== void 0 ? _e : Uid.next;
|
|
3201
|
+
const stateModifier = StateModifier.create(definitionWalker, uidGenerator, state, configuration.steps);
|
|
2988
3202
|
const customActionController = new CustomActionController(configuration, state, stateModifier);
|
|
2989
3203
|
let historyController = undefined;
|
|
2990
3204
|
if (configuration.undoStackSize) {
|
|
2991
3205
|
historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
|
|
2992
3206
|
}
|
|
2993
|
-
const preferenceStorage = (
|
|
2994
|
-
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage,
|
|
2995
|
-
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
|
|
3207
|
+
const preferenceStorage = (_f = configuration.preferenceStorage) !== null && _f !== void 0 ? _f : new MemoryPreferenceStorage();
|
|
3208
|
+
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, placeholderController, definitionWalker, preferenceStorage, i18n, services);
|
|
3209
|
+
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, uidGenerator, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
|
|
2996
3210
|
}
|
|
2997
|
-
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
3211
|
+
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, uidGenerator, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
2998
3212
|
this.theme = theme;
|
|
2999
3213
|
this.state = state;
|
|
3000
3214
|
this.configuration = configuration;
|
|
@@ -3002,6 +3216,7 @@ class DesignerContext {
|
|
|
3002
3216
|
this.componentContext = componentContext;
|
|
3003
3217
|
this.definitionWalker = definitionWalker;
|
|
3004
3218
|
this.i18n = i18n;
|
|
3219
|
+
this.uidGenerator = uidGenerator;
|
|
3005
3220
|
this.stateModifier = stateModifier;
|
|
3006
3221
|
this.layoutController = layoutController;
|
|
3007
3222
|
this.workspaceController = workspaceController;
|
|
@@ -3232,7 +3447,10 @@ class SelectStepBehavior {
|
|
|
3232
3447
|
if (interrupt) {
|
|
3233
3448
|
return;
|
|
3234
3449
|
}
|
|
3235
|
-
this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence)
|
|
3450
|
+
if (!this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence)) {
|
|
3451
|
+
// If we cannot select the step, we clear the selection.
|
|
3452
|
+
this.state.setSelectedStepId(null);
|
|
3453
|
+
}
|
|
3236
3454
|
return new SelectStepBehaviorEndToken(this.pressedStepComponent.step.id, Date.now());
|
|
3237
3455
|
}
|
|
3238
3456
|
}
|
|
@@ -4518,14 +4736,6 @@ class ToolboxExtension {
|
|
|
4518
4736
|
}
|
|
4519
4737
|
}
|
|
4520
4738
|
|
|
4521
|
-
class DefaultPlaceholderControllerExtension {
|
|
4522
|
-
create() {
|
|
4523
|
-
return {
|
|
4524
|
-
canCreate: () => true
|
|
4525
|
-
};
|
|
4526
|
-
}
|
|
4527
|
-
}
|
|
4528
|
-
|
|
4529
4739
|
const defaultConfiguration = {
|
|
4530
4740
|
gapWidth: 88,
|
|
4531
4741
|
gapHeight: 24,
|
|
@@ -4538,13 +4748,18 @@ class RectPlaceholderExtension {
|
|
|
4538
4748
|
}
|
|
4539
4749
|
constructor(configuration) {
|
|
4540
4750
|
this.configuration = configuration;
|
|
4541
|
-
this.
|
|
4751
|
+
this.alongGapSize = new Vector(defaultConfiguration.gapWidth, defaultConfiguration.gapHeight);
|
|
4752
|
+
this.perpendicularGapSize = new Vector(defaultConfiguration.gapHeight, defaultConfiguration.gapWidth);
|
|
4542
4753
|
}
|
|
4543
|
-
|
|
4544
|
-
return
|
|
4754
|
+
getGapSize(orientation) {
|
|
4755
|
+
return orientation === PlaceholderGapOrientation.perpendicular ? this.perpendicularGapSize : this.alongGapSize;
|
|
4756
|
+
}
|
|
4757
|
+
createForGap(parent, parentSequence, index, orientation) {
|
|
4758
|
+
const gapSize = this.getGapSize(orientation);
|
|
4759
|
+
return RectPlaceholder.create(parent, gapSize, PlaceholderDirection.gap, parentSequence, index, this.configuration.radius, this.configuration.iconSize);
|
|
4545
4760
|
}
|
|
4546
4761
|
createForArea(parent, size, direction, parentSequence, index) {
|
|
4547
|
-
return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration);
|
|
4762
|
+
return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration.radius, this.configuration.iconSize);
|
|
4548
4763
|
}
|
|
4549
4764
|
}
|
|
4550
4765
|
|
|
@@ -4613,9 +4828,6 @@ function merge(services, extensions) {
|
|
|
4613
4828
|
if (ext.wheelController) {
|
|
4614
4829
|
services.wheelController = ext.wheelController;
|
|
4615
4830
|
}
|
|
4616
|
-
if (ext.placeholderController) {
|
|
4617
|
-
services.placeholderController = ext.placeholderController;
|
|
4618
|
-
}
|
|
4619
4831
|
if (ext.placeholder) {
|
|
4620
4832
|
services.placeholder = ext.placeholder;
|
|
4621
4833
|
}
|
|
@@ -4649,6 +4861,7 @@ function setDefaults(services, configuration) {
|
|
|
4649
4861
|
services.steps.push(ContainerStepExtension.create());
|
|
4650
4862
|
services.steps.push(SwitchStepExtension.create());
|
|
4651
4863
|
services.steps.push(TaskStepExtension.create());
|
|
4864
|
+
services.steps.push(LaunchPadStepExtension.create());
|
|
4652
4865
|
if (!services.stepComponentViewWrapper) {
|
|
4653
4866
|
services.stepComponentViewWrapper = new DefaultStepComponentViewWrapperExtension();
|
|
4654
4867
|
}
|
|
@@ -4682,9 +4895,6 @@ function setDefaults(services, configuration) {
|
|
|
4682
4895
|
if (!services.wheelController) {
|
|
4683
4896
|
services.wheelController = new ClassicWheelControllerExtension();
|
|
4684
4897
|
}
|
|
4685
|
-
if (!services.placeholderController) {
|
|
4686
|
-
services.placeholderController = new DefaultPlaceholderControllerExtension();
|
|
4687
|
-
}
|
|
4688
4898
|
if (!services.placeholder) {
|
|
4689
4899
|
services.placeholder = RectPlaceholderExtension.create();
|
|
4690
4900
|
}
|
|
@@ -4954,4 +5164,4 @@ class Designer {
|
|
|
4954
5164
|
}
|
|
4955
5165
|
}
|
|
4956
5166
|
|
|
4957
|
-
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerDesignerExtension, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, RectPlaceholder, RectPlaceholderView, SelectStepBehaviorEndToken, ServicesResolver, SimpleEvent, StartStopRootComponentDesignerExtension, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, TYPE, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, ViewportApi, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
|
5167
|
+
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerDesignerExtension, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderController, PlaceholderDirection, PlaceholderGapOrientation, RectPlaceholder, RectPlaceholderView, SelectStepBehaviorEndToken, ServicesResolver, SimpleEvent, StartStopRootComponentDesignerExtension, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, TYPE, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, ViewportApi, WorkspaceApi, createContainerStepComponentViewFactory, createLaunchPadStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|