sequential-workflow-designer 0.29.2 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/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 +314 -101
- package/lib/cjs/index.cjs +314 -101
- package/lib/esm/index.js +313 -102
- package/lib/index.d.ts +68 -31
- 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/cjs/index.cjs
CHANGED
|
@@ -440,13 +440,16 @@ class PlaceholderFinder {
|
|
|
440
440
|
const scroll = new Vector(window.scrollX, window.scrollY);
|
|
441
441
|
this.cache = this.placeholders.map(placeholder => {
|
|
442
442
|
const rect = placeholder.getClientRect();
|
|
443
|
+
const lt = new Vector(rect.x, rect.y).add(scroll);
|
|
444
|
+
const br = new Vector(rect.x + rect.width, rect.y + rect.height).add(scroll);
|
|
443
445
|
return {
|
|
444
446
|
placeholder,
|
|
445
|
-
lt
|
|
446
|
-
br
|
|
447
|
+
lt,
|
|
448
|
+
br,
|
|
449
|
+
diagSq: lt.x * lt.x + lt.y * lt.y
|
|
447
450
|
};
|
|
448
451
|
});
|
|
449
|
-
this.cache.sort((a, b) => a.
|
|
452
|
+
this.cache.sort((a, b) => a.diagSq - b.diagSq);
|
|
450
453
|
}
|
|
451
454
|
const vR = vLt.x + vWidth;
|
|
452
455
|
const vB = vLt.y + vHeight;
|
|
@@ -598,7 +601,7 @@ class ToolboxApi {
|
|
|
598
601
|
}
|
|
599
602
|
activateStep(step) {
|
|
600
603
|
const newStep = ObjectCloner.deepClone(step);
|
|
601
|
-
newStep.id = this.uidGenerator
|
|
604
|
+
newStep.id = this.uidGenerator();
|
|
602
605
|
return newStep;
|
|
603
606
|
}
|
|
604
607
|
}
|
|
@@ -613,9 +616,9 @@ class StepTypeValidator {
|
|
|
613
616
|
}
|
|
614
617
|
|
|
615
618
|
class ToolboxDataProvider {
|
|
616
|
-
constructor(
|
|
617
|
-
this.iconProvider = iconProvider;
|
|
619
|
+
constructor(i18n, iconProvider, configuration) {
|
|
618
620
|
this.i18n = i18n;
|
|
621
|
+
this.iconProvider = iconProvider;
|
|
619
622
|
this.configuration = configuration;
|
|
620
623
|
this.createItemData = (step) => {
|
|
621
624
|
StepTypeValidator.validate(step.type);
|
|
@@ -820,8 +823,8 @@ class DesignerApi {
|
|
|
820
823
|
static create(context) {
|
|
821
824
|
const workspace = new WorkspaceApi(context.state, context.definitionWalker, context.workspaceController);
|
|
822
825
|
const viewportController = context.services.viewportController.create(workspace);
|
|
823
|
-
const toolboxDataProvider = new ToolboxDataProvider(context.
|
|
824
|
-
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.
|
|
826
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.i18n, context.componentContext.iconProvider, context.configuration.toolbox);
|
|
827
|
+
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);
|
|
825
828
|
}
|
|
826
829
|
constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
827
830
|
this.shadowRoot = shadowRoot;
|
|
@@ -1009,7 +1012,7 @@ class ValidationErrorBadge {
|
|
|
1009
1012
|
}
|
|
1010
1013
|
}
|
|
1011
1014
|
|
|
1012
|
-
const defaultConfiguration$
|
|
1015
|
+
const defaultConfiguration$6 = {
|
|
1013
1016
|
view: {
|
|
1014
1017
|
size: 22,
|
|
1015
1018
|
iconSize: 12
|
|
@@ -1017,7 +1020,7 @@ const defaultConfiguration$7 = {
|
|
|
1017
1020
|
};
|
|
1018
1021
|
class ValidationErrorBadgeExtension {
|
|
1019
1022
|
static create(configuration) {
|
|
1020
|
-
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
1023
|
+
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$6);
|
|
1021
1024
|
}
|
|
1022
1025
|
constructor(configuration) {
|
|
1023
1026
|
this.configuration = configuration;
|
|
@@ -1107,7 +1110,7 @@ class JoinView {
|
|
|
1107
1110
|
switch (targets.length) {
|
|
1108
1111
|
case 1:
|
|
1109
1112
|
if (start.x === targets[0].x) {
|
|
1110
|
-
JoinView.createStraightJoin(parent, start,
|
|
1113
|
+
JoinView.createStraightJoin(parent, start, h * 2 * dy);
|
|
1111
1114
|
}
|
|
1112
1115
|
else {
|
|
1113
1116
|
appendCurvedJoins(parent, start, targets, h, dy);
|
|
@@ -1203,10 +1206,18 @@ class OutputView {
|
|
|
1203
1206
|
}
|
|
1204
1207
|
}
|
|
1205
1208
|
|
|
1209
|
+
// PlaceholderExtension
|
|
1210
|
+
exports.PlaceholderGapOrientation = void 0;
|
|
1211
|
+
(function (PlaceholderGapOrientation) {
|
|
1212
|
+
PlaceholderGapOrientation[PlaceholderGapOrientation["along"] = 0] = "along";
|
|
1213
|
+
PlaceholderGapOrientation[PlaceholderGapOrientation["perpendicular"] = 1] = "perpendicular"; // Goes perpendicular to the flow
|
|
1214
|
+
})(exports.PlaceholderGapOrientation || (exports.PlaceholderGapOrientation = {}));
|
|
1215
|
+
|
|
1206
1216
|
class DefaultSequenceComponentView {
|
|
1207
1217
|
static create(parent, sequenceContext, componentContext) {
|
|
1208
|
-
const
|
|
1209
|
-
const
|
|
1218
|
+
const phSize = componentContext.services.placeholder.getGapSize(exports.PlaceholderGapOrientation.along);
|
|
1219
|
+
const phWidth = phSize.x;
|
|
1220
|
+
const phHeight = phSize.y;
|
|
1210
1221
|
const { sequence } = sequenceContext;
|
|
1211
1222
|
const g = Dom.svg('g');
|
|
1212
1223
|
parent.appendChild(g);
|
|
@@ -1243,7 +1254,7 @@ class DefaultSequenceComponentView {
|
|
|
1243
1254
|
JoinView.createStraightJoin(g, new Vector(joinX, offsetY - phHeight), phHeight);
|
|
1244
1255
|
}
|
|
1245
1256
|
if (!sequenceContext.isPreview && componentContext.placeholderController.canCreate(sequence, i)) {
|
|
1246
|
-
const ph = componentContext.services.placeholder.createForGap(g, sequence, i);
|
|
1257
|
+
const ph = componentContext.services.placeholder.createForGap(g, sequence, i, exports.PlaceholderGapOrientation.along);
|
|
1247
1258
|
Dom.translate(ph.view.g, joinX - phWidth / 2, offsetY - phHeight);
|
|
1248
1259
|
placeholders.push(ph);
|
|
1249
1260
|
}
|
|
@@ -1255,7 +1266,7 @@ class DefaultSequenceComponentView {
|
|
|
1255
1266
|
}
|
|
1256
1267
|
const newIndex = components.length;
|
|
1257
1268
|
if (!sequenceContext.isPreview && componentContext.placeholderController.canCreate(sequence, newIndex)) {
|
|
1258
|
-
const ph = componentContext.services.placeholder.createForGap(g, sequence, newIndex);
|
|
1269
|
+
const ph = componentContext.services.placeholder.createForGap(g, sequence, newIndex, exports.PlaceholderGapOrientation.along);
|
|
1259
1270
|
Dom.translate(ph.view.g, joinX - phWidth / 2, offsetY - phHeight);
|
|
1260
1271
|
placeholders.push(ph);
|
|
1261
1272
|
}
|
|
@@ -1303,21 +1314,19 @@ class DefaultSequenceComponent {
|
|
|
1303
1314
|
}
|
|
1304
1315
|
findById(stepId) {
|
|
1305
1316
|
for (const component of this.view.components) {
|
|
1306
|
-
const
|
|
1307
|
-
if (
|
|
1308
|
-
return
|
|
1317
|
+
const result = component.findById(stepId);
|
|
1318
|
+
if (result) {
|
|
1319
|
+
return result;
|
|
1309
1320
|
}
|
|
1310
1321
|
}
|
|
1311
1322
|
return null;
|
|
1312
1323
|
}
|
|
1313
1324
|
resolvePlaceholders(skipComponent, result) {
|
|
1325
|
+
this.view.components.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
1314
1326
|
this.view.placeholders.forEach(placeholder => result.placeholders.push(placeholder));
|
|
1315
|
-
this.view.components.forEach(c => c.resolvePlaceholders(skipComponent, result));
|
|
1316
1327
|
}
|
|
1317
1328
|
updateBadges(result) {
|
|
1318
|
-
|
|
1319
|
-
component.updateBadges(result);
|
|
1320
|
-
}
|
|
1329
|
+
this.view.components.forEach(component => component.updateBadges(result));
|
|
1321
1330
|
}
|
|
1322
1331
|
}
|
|
1323
1332
|
|
|
@@ -1330,7 +1339,7 @@ exports.ClickCommandType = void 0;
|
|
|
1330
1339
|
})(exports.ClickCommandType || (exports.ClickCommandType = {}));
|
|
1331
1340
|
exports.PlaceholderDirection = void 0;
|
|
1332
1341
|
(function (PlaceholderDirection) {
|
|
1333
|
-
PlaceholderDirection[PlaceholderDirection["
|
|
1342
|
+
PlaceholderDirection[PlaceholderDirection["gap"] = 0] = "gap";
|
|
1334
1343
|
PlaceholderDirection[PlaceholderDirection["in"] = 1] = "in";
|
|
1335
1344
|
PlaceholderDirection[PlaceholderDirection["out"] = 2] = "out";
|
|
1336
1345
|
})(exports.PlaceholderDirection || (exports.PlaceholderDirection = {}));
|
|
@@ -1344,7 +1353,7 @@ class StartStopRootComponentView {
|
|
|
1344
1353
|
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
1345
1354
|
sequence,
|
|
1346
1355
|
depth: 0,
|
|
1347
|
-
isInputConnected:
|
|
1356
|
+
isInputConnected: Boolean(cfg.start),
|
|
1348
1357
|
isOutputConnected: true,
|
|
1349
1358
|
isPreview: false
|
|
1350
1359
|
}, context);
|
|
@@ -1352,9 +1361,11 @@ class StartStopRootComponentView {
|
|
|
1352
1361
|
const x = view.joinX - cfg.size / 2;
|
|
1353
1362
|
const endY = cfg.size + view.height;
|
|
1354
1363
|
const iconSize = parentPlaceIndicator ? cfg.folderIconSize : cfg.defaultIconSize;
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1364
|
+
if (cfg.start) {
|
|
1365
|
+
const startCircle = createCircle('start', parentPlaceIndicator ? cfg.folderIconD : cfg.start.iconD, cfg.size, iconSize);
|
|
1366
|
+
Dom.translate(startCircle, x, 0);
|
|
1367
|
+
g.appendChild(startCircle);
|
|
1368
|
+
}
|
|
1358
1369
|
Dom.translate(view.g, 0, cfg.size);
|
|
1359
1370
|
const stopCircle = createCircle('stop', parentPlaceIndicator ? cfg.folderIconD : cfg.stopIconD, cfg.size, iconSize);
|
|
1360
1371
|
Dom.translate(stopCircle, x, endY);
|
|
@@ -1431,31 +1442,33 @@ class StartStopRootComponent {
|
|
|
1431
1442
|
}
|
|
1432
1443
|
}
|
|
1433
1444
|
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1445
|
+
const defaultViewConfiguration$1 = {
|
|
1446
|
+
size: 30,
|
|
1447
|
+
defaultIconSize: 22,
|
|
1448
|
+
folderIconSize: 18,
|
|
1449
|
+
start: {
|
|
1450
|
+
iconD: Icons.play
|
|
1451
|
+
},
|
|
1452
|
+
stopIconD: Icons.stop,
|
|
1453
|
+
folderIconD: Icons.folder
|
|
1443
1454
|
};
|
|
1444
1455
|
class StartStopRootComponentExtension {
|
|
1445
1456
|
static create(configuration) {
|
|
1446
|
-
return new StartStopRootComponentExtension(configuration
|
|
1457
|
+
return new StartStopRootComponentExtension(configuration);
|
|
1447
1458
|
}
|
|
1448
1459
|
constructor(configuration) {
|
|
1449
1460
|
this.configuration = configuration;
|
|
1450
1461
|
}
|
|
1451
1462
|
create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
1452
|
-
|
|
1463
|
+
var _a;
|
|
1464
|
+
const view = ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.view) ? Object.assign(Object.assign({}, defaultViewConfiguration$1), this.configuration.view) : defaultViewConfiguration$1;
|
|
1465
|
+
return StartStopRootComponent.create(parentElement, sequence, parentPlaceIndicator, context, view);
|
|
1453
1466
|
}
|
|
1454
1467
|
}
|
|
1455
1468
|
|
|
1456
|
-
const COMPONENT_CLASS_NAME$
|
|
1469
|
+
const COMPONENT_CLASS_NAME$3 = 'container';
|
|
1457
1470
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1458
|
-
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$
|
|
1471
|
+
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$3, (g, regionViewBuilder) => {
|
|
1459
1472
|
const step = stepContext.step;
|
|
1460
1473
|
const name = viewContext.getStepName();
|
|
1461
1474
|
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, name, 'primary');
|
|
@@ -1481,7 +1494,7 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1481
1494
|
height,
|
|
1482
1495
|
joinX,
|
|
1483
1496
|
placeholders: null,
|
|
1484
|
-
|
|
1497
|
+
components: [sequenceComponent],
|
|
1485
1498
|
hasOutput: sequenceComponent.hasOutput,
|
|
1486
1499
|
getClientPosition() {
|
|
1487
1500
|
return regionView.getClientPosition();
|
|
@@ -1505,6 +1518,149 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1505
1518
|
});
|
|
1506
1519
|
};
|
|
1507
1520
|
|
|
1521
|
+
const COMPONENT_CLASS_NAME$2 = 'launch-pad';
|
|
1522
|
+
function createView$1(parentElement, stepContext, viewContext, regionViewFactory, isInterruptedIfEmpty, cfg) {
|
|
1523
|
+
const step = stepContext.step;
|
|
1524
|
+
const sequence = stepContext.step.sequence;
|
|
1525
|
+
const g = ComponentDom.stepG(COMPONENT_CLASS_NAME$2, step.type, step.id);
|
|
1526
|
+
parentElement.appendChild(g);
|
|
1527
|
+
const components = [];
|
|
1528
|
+
let width;
|
|
1529
|
+
let height;
|
|
1530
|
+
let joinX;
|
|
1531
|
+
const placeholdersX = [];
|
|
1532
|
+
let placeholderOrientation;
|
|
1533
|
+
let placeholderSize;
|
|
1534
|
+
let hasOutput;
|
|
1535
|
+
let inputView = null;
|
|
1536
|
+
let outputView = null;
|
|
1537
|
+
if (sequence.length > 0) {
|
|
1538
|
+
let maxComponentHeight = 0;
|
|
1539
|
+
for (let i = 0; i < sequence.length; i++) {
|
|
1540
|
+
const component = viewContext.createStepComponent(g, sequence, sequence[i], i);
|
|
1541
|
+
components.push(component);
|
|
1542
|
+
maxComponentHeight = Math.max(maxComponentHeight, component.view.height);
|
|
1543
|
+
}
|
|
1544
|
+
const joinsX = [];
|
|
1545
|
+
const positionsX = [];
|
|
1546
|
+
const spacesY = [];
|
|
1547
|
+
placeholderOrientation = exports.PlaceholderGapOrientation.perpendicular;
|
|
1548
|
+
placeholderSize = viewContext.getPlaceholderGapSize(placeholderOrientation);
|
|
1549
|
+
placeholdersX.push(0);
|
|
1550
|
+
let positionX = placeholderSize.x;
|
|
1551
|
+
for (let i = 0; i < components.length; i++) {
|
|
1552
|
+
if (i > 0) {
|
|
1553
|
+
placeholdersX.push(positionX);
|
|
1554
|
+
positionX += placeholderSize.x;
|
|
1555
|
+
}
|
|
1556
|
+
const component = components[i];
|
|
1557
|
+
const componentY = (maxComponentHeight - component.view.height) / 2 + cfg.connectionHeight + cfg.paddingY;
|
|
1558
|
+
Dom.translate(component.view.g, positionX, componentY);
|
|
1559
|
+
joinsX.push(positionX + component.view.joinX);
|
|
1560
|
+
positionX += component.view.width;
|
|
1561
|
+
positionsX.push(positionX);
|
|
1562
|
+
spacesY.push(Math.max(0, (maxComponentHeight - component.view.height) / 2));
|
|
1563
|
+
}
|
|
1564
|
+
placeholdersX.push(positionX);
|
|
1565
|
+
positionX += placeholderSize.x;
|
|
1566
|
+
width = positionX;
|
|
1567
|
+
height = maxComponentHeight + 2 * cfg.connectionHeight + 2 * cfg.paddingY;
|
|
1568
|
+
const contentJoinX = components.length % 2 === 0
|
|
1569
|
+
? positionsX[Math.max(0, Math.floor(components.length / 2) - 1)] + placeholderSize.x / 2
|
|
1570
|
+
: joinsX[Math.floor(components.length / 2)];
|
|
1571
|
+
if (stepContext.isInputConnected) {
|
|
1572
|
+
const joinsTopY = joinsX.map(x => new Vector(x, cfg.connectionHeight));
|
|
1573
|
+
JoinView.createJoins(g, new Vector(contentJoinX, 0), joinsTopY);
|
|
1574
|
+
for (let i = 0; i < joinsX.length; i++) {
|
|
1575
|
+
JoinView.createStraightJoin(g, joinsTopY[i], cfg.paddingY + spacesY[i]);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
const joinsBottomY = joinsX.map(x => new Vector(x, cfg.connectionHeight + 2 * cfg.paddingY + maxComponentHeight));
|
|
1579
|
+
JoinView.createJoins(g, new Vector(contentJoinX, height), joinsBottomY);
|
|
1580
|
+
for (let i = 0; i < joinsX.length; i++) {
|
|
1581
|
+
JoinView.createStraightJoin(g, joinsBottomY[i], -(cfg.paddingY + spacesY[i]));
|
|
1582
|
+
}
|
|
1583
|
+
hasOutput = true;
|
|
1584
|
+
joinX = contentJoinX;
|
|
1585
|
+
}
|
|
1586
|
+
else {
|
|
1587
|
+
placeholderOrientation = exports.PlaceholderGapOrientation.along;
|
|
1588
|
+
placeholderSize = viewContext.getPlaceholderGapSize(placeholderOrientation);
|
|
1589
|
+
placeholdersX.push(cfg.emptyPaddingX);
|
|
1590
|
+
width = placeholderSize.x + cfg.emptyPaddingX * 2;
|
|
1591
|
+
height = placeholderSize.y + cfg.emptyPaddingY * 2;
|
|
1592
|
+
hasOutput = !isInterruptedIfEmpty;
|
|
1593
|
+
if (stepContext.isInputConnected) {
|
|
1594
|
+
inputView = InputView.createRoundInput(g, width / 2, 0, cfg.emptyInputSize);
|
|
1595
|
+
}
|
|
1596
|
+
if (stepContext.isOutputConnected && hasOutput) {
|
|
1597
|
+
outputView = OutputView.create(g, width / 2, height, cfg.emptyOutputSize);
|
|
1598
|
+
}
|
|
1599
|
+
if (cfg.emptyIconSize > 0) {
|
|
1600
|
+
const iconUrl = viewContext.getStepIconUrl();
|
|
1601
|
+
if (iconUrl) {
|
|
1602
|
+
const icon = Dom.svg('image', {
|
|
1603
|
+
href: iconUrl,
|
|
1604
|
+
x: (width - cfg.emptyIconSize) / 2,
|
|
1605
|
+
y: (height - cfg.emptyIconSize) / 2,
|
|
1606
|
+
width: cfg.emptyIconSize,
|
|
1607
|
+
height: cfg.emptyIconSize
|
|
1608
|
+
});
|
|
1609
|
+
g.appendChild(icon);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
joinX = width / 2;
|
|
1613
|
+
}
|
|
1614
|
+
let regionView = null;
|
|
1615
|
+
if (regionViewFactory) {
|
|
1616
|
+
regionView = regionViewFactory(g, [width], height);
|
|
1617
|
+
}
|
|
1618
|
+
const placeholders = [];
|
|
1619
|
+
const placeholderY = (height - placeholderSize.y) / 2;
|
|
1620
|
+
for (let i = 0; i < placeholdersX.length; i++) {
|
|
1621
|
+
const placeholder = viewContext.createPlaceholderForGap(g, sequence, i, placeholderOrientation);
|
|
1622
|
+
placeholders.push(placeholder);
|
|
1623
|
+
Dom.translate(placeholder.view.g, placeholdersX[i], placeholderY);
|
|
1624
|
+
}
|
|
1625
|
+
return {
|
|
1626
|
+
g,
|
|
1627
|
+
width,
|
|
1628
|
+
height,
|
|
1629
|
+
joinX,
|
|
1630
|
+
components,
|
|
1631
|
+
placeholders,
|
|
1632
|
+
hasOutput,
|
|
1633
|
+
getClientPosition() {
|
|
1634
|
+
return getAbsolutePosition(g);
|
|
1635
|
+
},
|
|
1636
|
+
resolveClick(click) {
|
|
1637
|
+
if (regionView) {
|
|
1638
|
+
const result = regionView.resolveClick(click);
|
|
1639
|
+
return result === true || (result === null && g.contains(click.element)) ? true : result;
|
|
1640
|
+
}
|
|
1641
|
+
return null;
|
|
1642
|
+
},
|
|
1643
|
+
setIsDragging(isDragging) {
|
|
1644
|
+
inputView === null || inputView === void 0 ? void 0 : inputView.setIsHidden(isDragging);
|
|
1645
|
+
outputView === null || outputView === void 0 ? void 0 : outputView.setIsHidden(isDragging);
|
|
1646
|
+
},
|
|
1647
|
+
setIsDisabled(isDisabled) {
|
|
1648
|
+
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1649
|
+
},
|
|
1650
|
+
setIsSelected(isSelected) {
|
|
1651
|
+
regionView === null || regionView === void 0 ? void 0 : regionView.setIsSelected(isSelected);
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
const createLaunchPadStepComponentViewFactory = (isInterruptedIfEmpty, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1656
|
+
if (cfg.isRegionEnabled) {
|
|
1657
|
+
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {
|
|
1658
|
+
return createView$1(g, stepContext, viewContext, regionViewBuilder, isInterruptedIfEmpty, cfg);
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
return createView$1(parentElement, stepContext, viewContext, null, isInterruptedIfEmpty, cfg);
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1508
1664
|
const COMPONENT_CLASS_NAME$1 = 'switch';
|
|
1509
1665
|
function createView(g, width, height, joinX, viewContext, sequenceComponents, regionView, cfg) {
|
|
1510
1666
|
let inputView = null;
|
|
@@ -1518,7 +1674,7 @@ function createView(g, width, height, joinX, viewContext, sequenceComponents, re
|
|
|
1518
1674
|
height,
|
|
1519
1675
|
joinX,
|
|
1520
1676
|
placeholders: null,
|
|
1521
|
-
sequenceComponents,
|
|
1677
|
+
components: sequenceComponents,
|
|
1522
1678
|
hasOutput: sequenceComponents ? sequenceComponents.some(c => c.hasOutput) : true,
|
|
1523
1679
|
getClientPosition() {
|
|
1524
1680
|
return regionView.getClientPosition();
|
|
@@ -1669,7 +1825,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1669
1825
|
height: cfg.iconSize
|
|
1670
1826
|
});
|
|
1671
1827
|
g.appendChild(icon);
|
|
1672
|
-
const isInputViewHidden = stepContext.
|
|
1828
|
+
const isInputViewHidden = !stepContext.isInputConnected; // TODO: handle inside the folder
|
|
1673
1829
|
const isOutputViewHidden = isInterrupted;
|
|
1674
1830
|
const inputView = isInputViewHidden ? null : InputView.createRoundInput(g, boxWidth / 2, 0, cfg.inputSize);
|
|
1675
1831
|
const outputView = isOutputViewHidden ? null : OutputView.create(g, boxWidth / 2, boxHeight, cfg.outputSize);
|
|
@@ -1678,7 +1834,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1678
1834
|
width: boxWidth,
|
|
1679
1835
|
height: boxHeight,
|
|
1680
1836
|
joinX: boxWidth / 2,
|
|
1681
|
-
|
|
1837
|
+
components: null,
|
|
1682
1838
|
placeholders: null,
|
|
1683
1839
|
hasOutput: !!outputView,
|
|
1684
1840
|
getClientPosition() {
|
|
@@ -1853,8 +2009,8 @@ class StepComponent {
|
|
|
1853
2009
|
if (this.step.id === stepId) {
|
|
1854
2010
|
return this;
|
|
1855
2011
|
}
|
|
1856
|
-
if (this.view.
|
|
1857
|
-
for (const component of this.view.
|
|
2012
|
+
if (this.view.components) {
|
|
2013
|
+
for (const component of this.view.components) {
|
|
1858
2014
|
const result = component.findById(stepId);
|
|
1859
2015
|
if (result) {
|
|
1860
2016
|
return result;
|
|
@@ -1864,14 +2020,22 @@ class StepComponent {
|
|
|
1864
2020
|
return null;
|
|
1865
2021
|
}
|
|
1866
2022
|
resolveClick(click) {
|
|
1867
|
-
if (this.view.
|
|
1868
|
-
for (const component of this.view.
|
|
2023
|
+
if (this.view.components) {
|
|
2024
|
+
for (const component of this.view.components) {
|
|
1869
2025
|
const result = component.resolveClick(click);
|
|
1870
2026
|
if (result) {
|
|
1871
2027
|
return result;
|
|
1872
2028
|
}
|
|
1873
2029
|
}
|
|
1874
2030
|
}
|
|
2031
|
+
if (this.view.placeholders) {
|
|
2032
|
+
for (const placeholder of this.view.placeholders) {
|
|
2033
|
+
const result = placeholder.resolveClick(click);
|
|
2034
|
+
if (result) {
|
|
2035
|
+
return result;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
1875
2039
|
const badgeResult = this.badges.resolveClick(click);
|
|
1876
2040
|
if (badgeResult) {
|
|
1877
2041
|
return badgeResult;
|
|
@@ -1889,8 +2053,8 @@ class StepComponent {
|
|
|
1889
2053
|
}
|
|
1890
2054
|
resolvePlaceholders(skipComponent, result) {
|
|
1891
2055
|
if (skipComponent !== this) {
|
|
1892
|
-
if (this.view.
|
|
1893
|
-
this.view.
|
|
2056
|
+
if (this.view.components) {
|
|
2057
|
+
this.view.components.forEach(component => component.resolvePlaceholders(skipComponent, result));
|
|
1894
2058
|
}
|
|
1895
2059
|
if (this.view.placeholders) {
|
|
1896
2060
|
this.view.placeholders.forEach(ph => result.placeholders.push(ph));
|
|
@@ -1908,8 +2072,8 @@ class StepComponent {
|
|
|
1908
2072
|
this.view.setIsDisabled(isDisabled);
|
|
1909
2073
|
}
|
|
1910
2074
|
updateBadges(result) {
|
|
1911
|
-
if (this.view.
|
|
1912
|
-
this.view.
|
|
2075
|
+
if (this.view.components) {
|
|
2076
|
+
this.view.components.forEach(component => component.updateBadges(result));
|
|
1913
2077
|
}
|
|
1914
2078
|
this.badges.update(result);
|
|
1915
2079
|
}
|
|
@@ -1936,6 +2100,18 @@ class StepExtensionResolver {
|
|
|
1936
2100
|
}
|
|
1937
2101
|
}
|
|
1938
2102
|
|
|
2103
|
+
class PlaceholderController {
|
|
2104
|
+
static create(configuration) {
|
|
2105
|
+
return new PlaceholderController(configuration);
|
|
2106
|
+
}
|
|
2107
|
+
constructor(configuration) {
|
|
2108
|
+
var _a, _b, _c, _d;
|
|
2109
|
+
this.configuration = configuration;
|
|
2110
|
+
this.canCreate = (_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.canCreate) !== null && _b !== void 0 ? _b : (() => true);
|
|
2111
|
+
this.canShow = (_d = (_c = this.configuration) === null || _c === void 0 ? void 0 : _c.canShow) !== null && _d !== void 0 ? _d : (() => true);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
|
|
1939
2115
|
class RectPlaceholderView {
|
|
1940
2116
|
static create(parent, width, height, radius, iconSize, direction) {
|
|
1941
2117
|
const g = Dom.svg('g', {
|
|
@@ -1974,8 +2150,8 @@ class RectPlaceholderView {
|
|
|
1974
2150
|
}
|
|
1975
2151
|
|
|
1976
2152
|
class RectPlaceholder {
|
|
1977
|
-
static create(parent, size, direction, sequence, index,
|
|
1978
|
-
const view = RectPlaceholderView.create(parent, size.x, size.y,
|
|
2153
|
+
static create(parent, size, direction, sequence, index, radius, iconSize) {
|
|
2154
|
+
const view = RectPlaceholderView.create(parent, size.x, size.y, radius, iconSize, direction);
|
|
1979
2155
|
return new RectPlaceholder(view, sequence, index);
|
|
1980
2156
|
}
|
|
1981
2157
|
constructor(view, parentSequence, index) {
|
|
@@ -2207,6 +2383,28 @@ class TaskStepExtension {
|
|
|
2207
2383
|
}
|
|
2208
2384
|
}
|
|
2209
2385
|
|
|
2386
|
+
const defaultViewConfiguration = {
|
|
2387
|
+
isRegionEnabled: true,
|
|
2388
|
+
paddingY: 10,
|
|
2389
|
+
connectionHeight: 20,
|
|
2390
|
+
emptyPaddingX: 20,
|
|
2391
|
+
emptyPaddingY: 20,
|
|
2392
|
+
emptyInputSize: 14,
|
|
2393
|
+
emptyOutputSize: 10,
|
|
2394
|
+
emptyIconSize: 24
|
|
2395
|
+
};
|
|
2396
|
+
class LaunchPadStepExtension {
|
|
2397
|
+
static create(configuration) {
|
|
2398
|
+
return new LaunchPadStepExtension(configuration);
|
|
2399
|
+
}
|
|
2400
|
+
constructor(configuration) {
|
|
2401
|
+
var _a, _b;
|
|
2402
|
+
this.configuration = configuration;
|
|
2403
|
+
this.componentType = 'launchPad';
|
|
2404
|
+
this.createComponentView = createLaunchPadStepComponentViewFactory(false, (_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.view) !== null && _b !== void 0 ? _b : defaultViewConfiguration);
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2210
2408
|
class StepsDesignerExtension {
|
|
2211
2409
|
static create(configuration) {
|
|
2212
2410
|
const steps = [];
|
|
@@ -2219,6 +2417,9 @@ class StepsDesignerExtension {
|
|
|
2219
2417
|
if (configuration.task) {
|
|
2220
2418
|
steps.push(TaskStepExtension.create(configuration.task));
|
|
2221
2419
|
}
|
|
2420
|
+
if (configuration.launchPad) {
|
|
2421
|
+
steps.push(LaunchPadStepExtension.create(configuration.launchPad));
|
|
2422
|
+
}
|
|
2222
2423
|
return new StepsDesignerExtension(steps);
|
|
2223
2424
|
}
|
|
2224
2425
|
constructor(steps) {
|
|
@@ -2266,6 +2467,17 @@ class StepComponentViewContextFactory {
|
|
|
2266
2467
|
i18n: componentContext.i18n,
|
|
2267
2468
|
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
2268
2469
|
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
2470
|
+
createStepComponent: (parentElement, parentSequence, step, position) => {
|
|
2471
|
+
return componentContext.stepComponentFactory.create(parentElement, {
|
|
2472
|
+
parentSequence,
|
|
2473
|
+
step,
|
|
2474
|
+
depth: stepContext.depth + 1,
|
|
2475
|
+
position,
|
|
2476
|
+
isInputConnected: stepContext.isInputConnected,
|
|
2477
|
+
isOutputConnected: stepContext.isOutputConnected,
|
|
2478
|
+
isPreview: stepContext.isPreview
|
|
2479
|
+
}, componentContext);
|
|
2480
|
+
},
|
|
2269
2481
|
createSequenceComponent: (parentElement, sequence) => {
|
|
2270
2482
|
const sequenceContext = {
|
|
2271
2483
|
sequence,
|
|
@@ -2279,6 +2491,8 @@ class StepComponentViewContextFactory {
|
|
|
2279
2491
|
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
2280
2492
|
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
2281
2493
|
},
|
|
2494
|
+
getPlaceholderGapSize: orientation => componentContext.services.placeholder.getGapSize(orientation),
|
|
2495
|
+
createPlaceholderForGap: componentContext.services.placeholder.createForGap.bind(componentContext.services.placeholder),
|
|
2282
2496
|
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
2283
2497
|
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
2284
2498
|
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
@@ -2300,7 +2514,7 @@ class StepComponentFactory {
|
|
|
2300
2514
|
}
|
|
2301
2515
|
|
|
2302
2516
|
class ComponentContext {
|
|
2303
|
-
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage,
|
|
2517
|
+
static create(configuration, state, stepExtensionResolver, placeholderController, definitionWalker, preferenceStorage, i18n, services) {
|
|
2304
2518
|
const validator = new DefinitionValidator(configuration.validator, state);
|
|
2305
2519
|
const iconProvider = new IconProvider(configuration.steps);
|
|
2306
2520
|
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
@@ -2633,14 +2847,15 @@ class SelectedStepIdDefinitionModifierDependency {
|
|
|
2633
2847
|
}
|
|
2634
2848
|
|
|
2635
2849
|
class StateModifier {
|
|
2636
|
-
static create(definitionWalker, state, configuration) {
|
|
2850
|
+
static create(definitionWalker, uidGenerator, state, configuration) {
|
|
2637
2851
|
const dependencies = [];
|
|
2638
2852
|
dependencies.push(new SelectedStepIdDefinitionModifierDependency(state, definitionWalker));
|
|
2639
2853
|
dependencies.push(new FolderPathDefinitionModifierDependency(state, definitionWalker));
|
|
2640
|
-
return new StateModifier(definitionWalker, state, configuration, dependencies);
|
|
2854
|
+
return new StateModifier(definitionWalker, uidGenerator, state, configuration, dependencies);
|
|
2641
2855
|
}
|
|
2642
|
-
constructor(definitionWalker, state, configuration, dependencies) {
|
|
2856
|
+
constructor(definitionWalker, uidGenerator, state, configuration, dependencies) {
|
|
2643
2857
|
this.definitionWalker = definitionWalker;
|
|
2858
|
+
this.uidGenerator = uidGenerator;
|
|
2644
2859
|
this.state = state;
|
|
2645
2860
|
this.configuration = configuration;
|
|
2646
2861
|
this.dependencies = dependencies;
|
|
@@ -2649,15 +2864,17 @@ class StateModifier {
|
|
|
2649
2864
|
this.dependencies.push(dependency);
|
|
2650
2865
|
}
|
|
2651
2866
|
isSelectable(step, parentSequence) {
|
|
2652
|
-
return this.configuration.
|
|
2867
|
+
return this.configuration.isSelectable ? this.configuration.isSelectable(step, parentSequence) : true;
|
|
2653
2868
|
}
|
|
2654
2869
|
trySelectStep(step, parentSequence) {
|
|
2655
2870
|
if (this.isSelectable(step, parentSequence)) {
|
|
2656
2871
|
this.state.setSelectedStepId(step.id);
|
|
2872
|
+
return true;
|
|
2657
2873
|
}
|
|
2874
|
+
return false;
|
|
2658
2875
|
}
|
|
2659
2876
|
trySelectStepById(stepId) {
|
|
2660
|
-
if (this.configuration.
|
|
2877
|
+
if (this.configuration.isSelectable) {
|
|
2661
2878
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2662
2879
|
this.trySelectStep(result.step, result.parentSequence);
|
|
2663
2880
|
}
|
|
@@ -2666,16 +2883,16 @@ class StateModifier {
|
|
|
2666
2883
|
}
|
|
2667
2884
|
}
|
|
2668
2885
|
isDeletable(stepId) {
|
|
2669
|
-
if (this.configuration.
|
|
2886
|
+
if (this.configuration.isDeletable) {
|
|
2670
2887
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2671
|
-
return this.configuration.
|
|
2888
|
+
return this.configuration.isDeletable(result.step, result.parentSequence);
|
|
2672
2889
|
}
|
|
2673
2890
|
return true;
|
|
2674
2891
|
}
|
|
2675
2892
|
tryDelete(stepId) {
|
|
2676
2893
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2677
|
-
const canDeleteStep = this.configuration.
|
|
2678
|
-
? this.configuration.
|
|
2894
|
+
const canDeleteStep = this.configuration.canDeleteStep
|
|
2895
|
+
? this.configuration.canDeleteStep(result.step, result.parentSequence)
|
|
2679
2896
|
: true;
|
|
2680
2897
|
if (!canDeleteStep) {
|
|
2681
2898
|
return false;
|
|
@@ -2686,46 +2903,43 @@ class StateModifier {
|
|
|
2686
2903
|
return true;
|
|
2687
2904
|
}
|
|
2688
2905
|
tryInsert(step, targetSequence, targetIndex) {
|
|
2689
|
-
const canInsertStep = this.configuration.
|
|
2690
|
-
? this.configuration.steps.canInsertStep(step, targetSequence, targetIndex)
|
|
2691
|
-
: true;
|
|
2906
|
+
const canInsertStep = this.configuration.canInsertStep ? this.configuration.canInsertStep(step, targetSequence, targetIndex) : true;
|
|
2692
2907
|
if (!canInsertStep) {
|
|
2693
2908
|
return false;
|
|
2694
2909
|
}
|
|
2695
2910
|
SequenceModifier.insertStep(step, targetSequence, targetIndex);
|
|
2696
2911
|
this.state.notifyDefinitionChanged(exports.DefinitionChangeType.stepInserted, step.id);
|
|
2697
|
-
if (!this.configuration.
|
|
2912
|
+
if (!this.configuration.isAutoSelectDisabled) {
|
|
2698
2913
|
this.trySelectStepById(step.id);
|
|
2699
2914
|
}
|
|
2700
2915
|
return true;
|
|
2701
2916
|
}
|
|
2702
2917
|
isDraggable(step, parentSequence) {
|
|
2703
|
-
return this.configuration.
|
|
2918
|
+
return this.configuration.isDraggable ? this.configuration.isDraggable(step, parentSequence) : true;
|
|
2704
2919
|
}
|
|
2705
2920
|
tryMove(sourceSequence, step, targetSequence, targetIndex) {
|
|
2706
2921
|
const apply = SequenceModifier.tryMoveStep(sourceSequence, step, targetSequence, targetIndex);
|
|
2707
2922
|
if (!apply) {
|
|
2708
2923
|
return false;
|
|
2709
2924
|
}
|
|
2710
|
-
const canMoveStep = this.configuration.
|
|
2711
|
-
? this.configuration.
|
|
2925
|
+
const canMoveStep = this.configuration.canMoveStep
|
|
2926
|
+
? this.configuration.canMoveStep(sourceSequence, step, targetSequence, targetIndex)
|
|
2712
2927
|
: true;
|
|
2713
2928
|
if (!canMoveStep) {
|
|
2714
2929
|
return false;
|
|
2715
2930
|
}
|
|
2716
2931
|
apply();
|
|
2717
2932
|
this.state.notifyDefinitionChanged(exports.DefinitionChangeType.stepMoved, step.id);
|
|
2718
|
-
if (!this.configuration.
|
|
2933
|
+
if (!this.configuration.isAutoSelectDisabled) {
|
|
2719
2934
|
this.trySelectStep(step, targetSequence);
|
|
2720
2935
|
}
|
|
2721
2936
|
return true;
|
|
2722
2937
|
}
|
|
2723
2938
|
isDuplicable(step, parentSequence) {
|
|
2724
|
-
return this.configuration.
|
|
2939
|
+
return this.configuration.isDuplicable ? this.configuration.isDuplicable(step, parentSequence) : false;
|
|
2725
2940
|
}
|
|
2726
2941
|
tryDuplicate(step, parentSequence) {
|
|
2727
|
-
const
|
|
2728
|
-
const duplicator = new StepDuplicator(uidGenerator, this.definitionWalker);
|
|
2942
|
+
const duplicator = new StepDuplicator(this.uidGenerator, this.definitionWalker);
|
|
2729
2943
|
const index = parentSequence.indexOf(step);
|
|
2730
2944
|
const newStep = duplicator.duplicate(step);
|
|
2731
2945
|
return this.tryInsert(newStep, parentSequence, index + 1);
|
|
@@ -2971,7 +3185,7 @@ class MemoryPreferenceStorage {
|
|
|
2971
3185
|
|
|
2972
3186
|
class DesignerContext {
|
|
2973
3187
|
static create(placeholder, startDefinition, configuration, services) {
|
|
2974
|
-
var _a, _b, _c, _d, _e;
|
|
3188
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2975
3189
|
const definition = ObjectCloner.deepClone(startDefinition);
|
|
2976
3190
|
const layoutController = new LayoutController(placeholder);
|
|
2977
3191
|
const isReadonly = Boolean(configuration.isReadonly);
|
|
@@ -2980,22 +3194,23 @@ class DesignerContext {
|
|
|
2980
3194
|
const theme = configuration.theme || 'light';
|
|
2981
3195
|
const state = new DesignerState(definition, isReadonly, isToolboxCollapsed, isEditorCollapsed);
|
|
2982
3196
|
const workspaceController = new WorkspaceControllerWrapper();
|
|
2983
|
-
const placeholderController = services.placeholderController.create();
|
|
2984
3197
|
const behaviorController = BehaviorController.create(configuration.shadowRoot);
|
|
2985
3198
|
const stepExtensionResolver = StepExtensionResolver.create(services);
|
|
3199
|
+
const placeholderController = PlaceholderController.create(configuration.placeholder);
|
|
2986
3200
|
const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new sequentialWorkflowModel.DefinitionWalker();
|
|
2987
3201
|
const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
|
|
2988
|
-
const
|
|
3202
|
+
const uidGenerator = (_e = configuration.uidGenerator) !== null && _e !== void 0 ? _e : Uid.next;
|
|
3203
|
+
const stateModifier = StateModifier.create(definitionWalker, uidGenerator, state, configuration.steps);
|
|
2989
3204
|
const customActionController = new CustomActionController(configuration, state, stateModifier);
|
|
2990
3205
|
let historyController = undefined;
|
|
2991
3206
|
if (configuration.undoStackSize) {
|
|
2992
3207
|
historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
|
|
2993
3208
|
}
|
|
2994
|
-
const preferenceStorage = (
|
|
2995
|
-
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage,
|
|
2996
|
-
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
|
|
3209
|
+
const preferenceStorage = (_f = configuration.preferenceStorage) !== null && _f !== void 0 ? _f : new MemoryPreferenceStorage();
|
|
3210
|
+
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, placeholderController, definitionWalker, preferenceStorage, i18n, services);
|
|
3211
|
+
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, uidGenerator, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
|
|
2997
3212
|
}
|
|
2998
|
-
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
3213
|
+
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, uidGenerator, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
2999
3214
|
this.theme = theme;
|
|
3000
3215
|
this.state = state;
|
|
3001
3216
|
this.configuration = configuration;
|
|
@@ -3003,6 +3218,7 @@ class DesignerContext {
|
|
|
3003
3218
|
this.componentContext = componentContext;
|
|
3004
3219
|
this.definitionWalker = definitionWalker;
|
|
3005
3220
|
this.i18n = i18n;
|
|
3221
|
+
this.uidGenerator = uidGenerator;
|
|
3006
3222
|
this.stateModifier = stateModifier;
|
|
3007
3223
|
this.layoutController = layoutController;
|
|
3008
3224
|
this.workspaceController = workspaceController;
|
|
@@ -3233,7 +3449,10 @@ class SelectStepBehavior {
|
|
|
3233
3449
|
if (interrupt) {
|
|
3234
3450
|
return;
|
|
3235
3451
|
}
|
|
3236
|
-
this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence)
|
|
3452
|
+
if (!this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence)) {
|
|
3453
|
+
// If we cannot select the step, we clear the selection.
|
|
3454
|
+
this.state.setSelectedStepId(null);
|
|
3455
|
+
}
|
|
3237
3456
|
return new SelectStepBehaviorEndToken(this.pressedStepComponent.step.id, Date.now());
|
|
3238
3457
|
}
|
|
3239
3458
|
}
|
|
@@ -4519,14 +4738,6 @@ class ToolboxExtension {
|
|
|
4519
4738
|
}
|
|
4520
4739
|
}
|
|
4521
4740
|
|
|
4522
|
-
class DefaultPlaceholderControllerExtension {
|
|
4523
|
-
create() {
|
|
4524
|
-
return {
|
|
4525
|
-
canCreate: () => true
|
|
4526
|
-
};
|
|
4527
|
-
}
|
|
4528
|
-
}
|
|
4529
|
-
|
|
4530
4741
|
const defaultConfiguration = {
|
|
4531
4742
|
gapWidth: 88,
|
|
4532
4743
|
gapHeight: 24,
|
|
@@ -4539,13 +4750,18 @@ class RectPlaceholderExtension {
|
|
|
4539
4750
|
}
|
|
4540
4751
|
constructor(configuration) {
|
|
4541
4752
|
this.configuration = configuration;
|
|
4542
|
-
this.
|
|
4753
|
+
this.alongGapSize = new Vector(defaultConfiguration.gapWidth, defaultConfiguration.gapHeight);
|
|
4754
|
+
this.perpendicularGapSize = new Vector(defaultConfiguration.gapHeight, defaultConfiguration.gapWidth);
|
|
4543
4755
|
}
|
|
4544
|
-
|
|
4545
|
-
return
|
|
4756
|
+
getGapSize(orientation) {
|
|
4757
|
+
return orientation === exports.PlaceholderGapOrientation.perpendicular ? this.perpendicularGapSize : this.alongGapSize;
|
|
4758
|
+
}
|
|
4759
|
+
createForGap(parent, parentSequence, index, orientation) {
|
|
4760
|
+
const gapSize = this.getGapSize(orientation);
|
|
4761
|
+
return RectPlaceholder.create(parent, gapSize, exports.PlaceholderDirection.gap, parentSequence, index, this.configuration.radius, this.configuration.iconSize);
|
|
4546
4762
|
}
|
|
4547
4763
|
createForArea(parent, size, direction, parentSequence, index) {
|
|
4548
|
-
return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration);
|
|
4764
|
+
return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration.radius, this.configuration.iconSize);
|
|
4549
4765
|
}
|
|
4550
4766
|
}
|
|
4551
4767
|
|
|
@@ -4614,9 +4830,6 @@ function merge(services, extensions) {
|
|
|
4614
4830
|
if (ext.wheelController) {
|
|
4615
4831
|
services.wheelController = ext.wheelController;
|
|
4616
4832
|
}
|
|
4617
|
-
if (ext.placeholderController) {
|
|
4618
|
-
services.placeholderController = ext.placeholderController;
|
|
4619
|
-
}
|
|
4620
4833
|
if (ext.placeholder) {
|
|
4621
4834
|
services.placeholder = ext.placeholder;
|
|
4622
4835
|
}
|
|
@@ -4650,6 +4863,7 @@ function setDefaults(services, configuration) {
|
|
|
4650
4863
|
services.steps.push(ContainerStepExtension.create());
|
|
4651
4864
|
services.steps.push(SwitchStepExtension.create());
|
|
4652
4865
|
services.steps.push(TaskStepExtension.create());
|
|
4866
|
+
services.steps.push(LaunchPadStepExtension.create());
|
|
4653
4867
|
if (!services.stepComponentViewWrapper) {
|
|
4654
4868
|
services.stepComponentViewWrapper = new DefaultStepComponentViewWrapperExtension();
|
|
4655
4869
|
}
|
|
@@ -4683,9 +4897,6 @@ function setDefaults(services, configuration) {
|
|
|
4683
4897
|
if (!services.wheelController) {
|
|
4684
4898
|
services.wheelController = new ClassicWheelControllerExtension();
|
|
4685
4899
|
}
|
|
4686
|
-
if (!services.placeholderController) {
|
|
4687
|
-
services.placeholderController = new DefaultPlaceholderControllerExtension();
|
|
4688
|
-
}
|
|
4689
4900
|
if (!services.placeholder) {
|
|
4690
4901
|
services.placeholder = RectPlaceholderExtension.create();
|
|
4691
4902
|
}
|
|
@@ -4984,6 +5195,7 @@ exports.LineGridDesignerExtension = LineGridDesignerExtension;
|
|
|
4984
5195
|
exports.ObjectCloner = ObjectCloner;
|
|
4985
5196
|
exports.OutputView = OutputView;
|
|
4986
5197
|
exports.PathBarApi = PathBarApi;
|
|
5198
|
+
exports.PlaceholderController = PlaceholderController;
|
|
4987
5199
|
exports.RectPlaceholder = RectPlaceholder;
|
|
4988
5200
|
exports.RectPlaceholderView = RectPlaceholderView;
|
|
4989
5201
|
exports.SelectStepBehaviorEndToken = SelectStepBehaviorEndToken;
|
|
@@ -5002,6 +5214,7 @@ exports.Vector = Vector;
|
|
|
5002
5214
|
exports.ViewportApi = ViewportApi;
|
|
5003
5215
|
exports.WorkspaceApi = WorkspaceApi;
|
|
5004
5216
|
exports.createContainerStepComponentViewFactory = createContainerStepComponentViewFactory;
|
|
5217
|
+
exports.createLaunchPadStepComponentViewFactory = createLaunchPadStepComponentViewFactory;
|
|
5005
5218
|
exports.createSwitchStepComponentViewFactory = createSwitchStepComponentViewFactory;
|
|
5006
5219
|
exports.createTaskStepComponentViewFactory = createTaskStepComponentViewFactory;
|
|
5007
5220
|
exports.getAbsolutePosition = getAbsolutePosition;
|