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/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$6 = {
|
|
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$6);
|
|
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$1 = {
|
|
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$1), this.configuration.view) : defaultViewConfiguration$1;
|
|
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();
|
|
@@ -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() {
|
|
@@ -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) {
|
|
@@ -2206,6 +2382,28 @@ class TaskStepExtension {
|
|
|
2206
2382
|
}
|
|
2207
2383
|
}
|
|
2208
2384
|
|
|
2385
|
+
const defaultViewConfiguration = {
|
|
2386
|
+
isRegionEnabled: true,
|
|
2387
|
+
paddingY: 10,
|
|
2388
|
+
connectionHeight: 20,
|
|
2389
|
+
emptyPaddingX: 20,
|
|
2390
|
+
emptyPaddingY: 20,
|
|
2391
|
+
emptyInputSize: 14,
|
|
2392
|
+
emptyOutputSize: 10,
|
|
2393
|
+
emptyIconSize: 24
|
|
2394
|
+
};
|
|
2395
|
+
class LaunchPadStepExtension {
|
|
2396
|
+
static create(configuration) {
|
|
2397
|
+
return new LaunchPadStepExtension(configuration);
|
|
2398
|
+
}
|
|
2399
|
+
constructor(configuration) {
|
|
2400
|
+
var _a, _b;
|
|
2401
|
+
this.configuration = configuration;
|
|
2402
|
+
this.componentType = 'launchPad';
|
|
2403
|
+
this.createComponentView = createLaunchPadStepComponentViewFactory(false, (_b = (_a = this.configuration) === null || _a === void 0 ? void 0 : _a.view) !== null && _b !== void 0 ? _b : defaultViewConfiguration);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2209
2407
|
class StepsDesignerExtension {
|
|
2210
2408
|
static create(configuration) {
|
|
2211
2409
|
const steps = [];
|
|
@@ -2218,6 +2416,9 @@ class StepsDesignerExtension {
|
|
|
2218
2416
|
if (configuration.task) {
|
|
2219
2417
|
steps.push(TaskStepExtension.create(configuration.task));
|
|
2220
2418
|
}
|
|
2419
|
+
if (configuration.launchPad) {
|
|
2420
|
+
steps.push(LaunchPadStepExtension.create(configuration.launchPad));
|
|
2421
|
+
}
|
|
2221
2422
|
return new StepsDesignerExtension(steps);
|
|
2222
2423
|
}
|
|
2223
2424
|
constructor(steps) {
|
|
@@ -2265,6 +2466,17 @@ class StepComponentViewContextFactory {
|
|
|
2265
2466
|
i18n: componentContext.i18n,
|
|
2266
2467
|
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
2267
2468
|
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
2469
|
+
createStepComponent: (parentElement, parentSequence, step, position) => {
|
|
2470
|
+
return componentContext.stepComponentFactory.create(parentElement, {
|
|
2471
|
+
parentSequence,
|
|
2472
|
+
step,
|
|
2473
|
+
depth: stepContext.depth + 1,
|
|
2474
|
+
position,
|
|
2475
|
+
isInputConnected: stepContext.isInputConnected,
|
|
2476
|
+
isOutputConnected: stepContext.isOutputConnected,
|
|
2477
|
+
isPreview: stepContext.isPreview
|
|
2478
|
+
}, componentContext);
|
|
2479
|
+
},
|
|
2268
2480
|
createSequenceComponent: (parentElement, sequence) => {
|
|
2269
2481
|
const sequenceContext = {
|
|
2270
2482
|
sequence,
|
|
@@ -2278,6 +2490,8 @@ class StepComponentViewContextFactory {
|
|
|
2278
2490
|
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
2279
2491
|
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
2280
2492
|
},
|
|
2493
|
+
getPlaceholderGapSize: orientation => componentContext.services.placeholder.getGapSize(orientation),
|
|
2494
|
+
createPlaceholderForGap: componentContext.services.placeholder.createForGap.bind(componentContext.services.placeholder),
|
|
2281
2495
|
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
2282
2496
|
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
2283
2497
|
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
@@ -2299,7 +2513,7 @@ class StepComponentFactory {
|
|
|
2299
2513
|
}
|
|
2300
2514
|
|
|
2301
2515
|
class ComponentContext {
|
|
2302
|
-
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage,
|
|
2516
|
+
static create(configuration, state, stepExtensionResolver, placeholderController, definitionWalker, preferenceStorage, i18n, services) {
|
|
2303
2517
|
const validator = new DefinitionValidator(configuration.validator, state);
|
|
2304
2518
|
const iconProvider = new IconProvider(configuration.steps);
|
|
2305
2519
|
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
@@ -2632,14 +2846,15 @@ class SelectedStepIdDefinitionModifierDependency {
|
|
|
2632
2846
|
}
|
|
2633
2847
|
|
|
2634
2848
|
class StateModifier {
|
|
2635
|
-
static create(definitionWalker, state, configuration) {
|
|
2849
|
+
static create(definitionWalker, uidGenerator, state, configuration) {
|
|
2636
2850
|
const dependencies = [];
|
|
2637
2851
|
dependencies.push(new SelectedStepIdDefinitionModifierDependency(state, definitionWalker));
|
|
2638
2852
|
dependencies.push(new FolderPathDefinitionModifierDependency(state, definitionWalker));
|
|
2639
|
-
return new StateModifier(definitionWalker, state, configuration, dependencies);
|
|
2853
|
+
return new StateModifier(definitionWalker, uidGenerator, state, configuration, dependencies);
|
|
2640
2854
|
}
|
|
2641
|
-
constructor(definitionWalker, state, configuration, dependencies) {
|
|
2855
|
+
constructor(definitionWalker, uidGenerator, state, configuration, dependencies) {
|
|
2642
2856
|
this.definitionWalker = definitionWalker;
|
|
2857
|
+
this.uidGenerator = uidGenerator;
|
|
2643
2858
|
this.state = state;
|
|
2644
2859
|
this.configuration = configuration;
|
|
2645
2860
|
this.dependencies = dependencies;
|
|
@@ -2648,15 +2863,17 @@ class StateModifier {
|
|
|
2648
2863
|
this.dependencies.push(dependency);
|
|
2649
2864
|
}
|
|
2650
2865
|
isSelectable(step, parentSequence) {
|
|
2651
|
-
return this.configuration.
|
|
2866
|
+
return this.configuration.isSelectable ? this.configuration.isSelectable(step, parentSequence) : true;
|
|
2652
2867
|
}
|
|
2653
2868
|
trySelectStep(step, parentSequence) {
|
|
2654
2869
|
if (this.isSelectable(step, parentSequence)) {
|
|
2655
2870
|
this.state.setSelectedStepId(step.id);
|
|
2871
|
+
return true;
|
|
2656
2872
|
}
|
|
2873
|
+
return false;
|
|
2657
2874
|
}
|
|
2658
2875
|
trySelectStepById(stepId) {
|
|
2659
|
-
if (this.configuration.
|
|
2876
|
+
if (this.configuration.isSelectable) {
|
|
2660
2877
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2661
2878
|
this.trySelectStep(result.step, result.parentSequence);
|
|
2662
2879
|
}
|
|
@@ -2665,16 +2882,16 @@ class StateModifier {
|
|
|
2665
2882
|
}
|
|
2666
2883
|
}
|
|
2667
2884
|
isDeletable(stepId) {
|
|
2668
|
-
if (this.configuration.
|
|
2885
|
+
if (this.configuration.isDeletable) {
|
|
2669
2886
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2670
|
-
return this.configuration.
|
|
2887
|
+
return this.configuration.isDeletable(result.step, result.parentSequence);
|
|
2671
2888
|
}
|
|
2672
2889
|
return true;
|
|
2673
2890
|
}
|
|
2674
2891
|
tryDelete(stepId) {
|
|
2675
2892
|
const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);
|
|
2676
|
-
const canDeleteStep = this.configuration.
|
|
2677
|
-
? this.configuration.
|
|
2893
|
+
const canDeleteStep = this.configuration.canDeleteStep
|
|
2894
|
+
? this.configuration.canDeleteStep(result.step, result.parentSequence)
|
|
2678
2895
|
: true;
|
|
2679
2896
|
if (!canDeleteStep) {
|
|
2680
2897
|
return false;
|
|
@@ -2685,46 +2902,43 @@ class StateModifier {
|
|
|
2685
2902
|
return true;
|
|
2686
2903
|
}
|
|
2687
2904
|
tryInsert(step, targetSequence, targetIndex) {
|
|
2688
|
-
const canInsertStep = this.configuration.
|
|
2689
|
-
? this.configuration.steps.canInsertStep(step, targetSequence, targetIndex)
|
|
2690
|
-
: true;
|
|
2905
|
+
const canInsertStep = this.configuration.canInsertStep ? this.configuration.canInsertStep(step, targetSequence, targetIndex) : true;
|
|
2691
2906
|
if (!canInsertStep) {
|
|
2692
2907
|
return false;
|
|
2693
2908
|
}
|
|
2694
2909
|
SequenceModifier.insertStep(step, targetSequence, targetIndex);
|
|
2695
2910
|
this.state.notifyDefinitionChanged(DefinitionChangeType.stepInserted, step.id);
|
|
2696
|
-
if (!this.configuration.
|
|
2911
|
+
if (!this.configuration.isAutoSelectDisabled) {
|
|
2697
2912
|
this.trySelectStepById(step.id);
|
|
2698
2913
|
}
|
|
2699
2914
|
return true;
|
|
2700
2915
|
}
|
|
2701
2916
|
isDraggable(step, parentSequence) {
|
|
2702
|
-
return this.configuration.
|
|
2917
|
+
return this.configuration.isDraggable ? this.configuration.isDraggable(step, parentSequence) : true;
|
|
2703
2918
|
}
|
|
2704
2919
|
tryMove(sourceSequence, step, targetSequence, targetIndex) {
|
|
2705
2920
|
const apply = SequenceModifier.tryMoveStep(sourceSequence, step, targetSequence, targetIndex);
|
|
2706
2921
|
if (!apply) {
|
|
2707
2922
|
return false;
|
|
2708
2923
|
}
|
|
2709
|
-
const canMoveStep = this.configuration.
|
|
2710
|
-
? this.configuration.
|
|
2924
|
+
const canMoveStep = this.configuration.canMoveStep
|
|
2925
|
+
? this.configuration.canMoveStep(sourceSequence, step, targetSequence, targetIndex)
|
|
2711
2926
|
: true;
|
|
2712
2927
|
if (!canMoveStep) {
|
|
2713
2928
|
return false;
|
|
2714
2929
|
}
|
|
2715
2930
|
apply();
|
|
2716
2931
|
this.state.notifyDefinitionChanged(DefinitionChangeType.stepMoved, step.id);
|
|
2717
|
-
if (!this.configuration.
|
|
2932
|
+
if (!this.configuration.isAutoSelectDisabled) {
|
|
2718
2933
|
this.trySelectStep(step, targetSequence);
|
|
2719
2934
|
}
|
|
2720
2935
|
return true;
|
|
2721
2936
|
}
|
|
2722
2937
|
isDuplicable(step, parentSequence) {
|
|
2723
|
-
return this.configuration.
|
|
2938
|
+
return this.configuration.isDuplicable ? this.configuration.isDuplicable(step, parentSequence) : false;
|
|
2724
2939
|
}
|
|
2725
2940
|
tryDuplicate(step, parentSequence) {
|
|
2726
|
-
const
|
|
2727
|
-
const duplicator = new StepDuplicator(uidGenerator, this.definitionWalker);
|
|
2941
|
+
const duplicator = new StepDuplicator(this.uidGenerator, this.definitionWalker);
|
|
2728
2942
|
const index = parentSequence.indexOf(step);
|
|
2729
2943
|
const newStep = duplicator.duplicate(step);
|
|
2730
2944
|
return this.tryInsert(newStep, parentSequence, index + 1);
|
|
@@ -2970,7 +3184,7 @@ class MemoryPreferenceStorage {
|
|
|
2970
3184
|
|
|
2971
3185
|
class DesignerContext {
|
|
2972
3186
|
static create(placeholder, startDefinition, configuration, services) {
|
|
2973
|
-
var _a, _b, _c, _d, _e;
|
|
3187
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2974
3188
|
const definition = ObjectCloner.deepClone(startDefinition);
|
|
2975
3189
|
const layoutController = new LayoutController(placeholder);
|
|
2976
3190
|
const isReadonly = Boolean(configuration.isReadonly);
|
|
@@ -2979,22 +3193,23 @@ class DesignerContext {
|
|
|
2979
3193
|
const theme = configuration.theme || 'light';
|
|
2980
3194
|
const state = new DesignerState(definition, isReadonly, isToolboxCollapsed, isEditorCollapsed);
|
|
2981
3195
|
const workspaceController = new WorkspaceControllerWrapper();
|
|
2982
|
-
const placeholderController = services.placeholderController.create();
|
|
2983
3196
|
const behaviorController = BehaviorController.create(configuration.shadowRoot);
|
|
2984
3197
|
const stepExtensionResolver = StepExtensionResolver.create(services);
|
|
3198
|
+
const placeholderController = PlaceholderController.create(configuration.placeholder);
|
|
2985
3199
|
const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new DefinitionWalker();
|
|
2986
3200
|
const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
|
|
2987
|
-
const
|
|
3201
|
+
const uidGenerator = (_e = configuration.uidGenerator) !== null && _e !== void 0 ? _e : Uid.next;
|
|
3202
|
+
const stateModifier = StateModifier.create(definitionWalker, uidGenerator, state, configuration.steps);
|
|
2988
3203
|
const customActionController = new CustomActionController(configuration, state, stateModifier);
|
|
2989
3204
|
let historyController = undefined;
|
|
2990
3205
|
if (configuration.undoStackSize) {
|
|
2991
3206
|
historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
|
|
2992
3207
|
}
|
|
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);
|
|
3208
|
+
const preferenceStorage = (_f = configuration.preferenceStorage) !== null && _f !== void 0 ? _f : new MemoryPreferenceStorage();
|
|
3209
|
+
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, placeholderController, definitionWalker, preferenceStorage, i18n, services);
|
|
3210
|
+
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, uidGenerator, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
|
|
2996
3211
|
}
|
|
2997
|
-
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
3212
|
+
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, uidGenerator, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
2998
3213
|
this.theme = theme;
|
|
2999
3214
|
this.state = state;
|
|
3000
3215
|
this.configuration = configuration;
|
|
@@ -3002,6 +3217,7 @@ class DesignerContext {
|
|
|
3002
3217
|
this.componentContext = componentContext;
|
|
3003
3218
|
this.definitionWalker = definitionWalker;
|
|
3004
3219
|
this.i18n = i18n;
|
|
3220
|
+
this.uidGenerator = uidGenerator;
|
|
3005
3221
|
this.stateModifier = stateModifier;
|
|
3006
3222
|
this.layoutController = layoutController;
|
|
3007
3223
|
this.workspaceController = workspaceController;
|
|
@@ -3232,7 +3448,10 @@ class SelectStepBehavior {
|
|
|
3232
3448
|
if (interrupt) {
|
|
3233
3449
|
return;
|
|
3234
3450
|
}
|
|
3235
|
-
this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence)
|
|
3451
|
+
if (!this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence)) {
|
|
3452
|
+
// If we cannot select the step, we clear the selection.
|
|
3453
|
+
this.state.setSelectedStepId(null);
|
|
3454
|
+
}
|
|
3236
3455
|
return new SelectStepBehaviorEndToken(this.pressedStepComponent.step.id, Date.now());
|
|
3237
3456
|
}
|
|
3238
3457
|
}
|
|
@@ -4518,14 +4737,6 @@ class ToolboxExtension {
|
|
|
4518
4737
|
}
|
|
4519
4738
|
}
|
|
4520
4739
|
|
|
4521
|
-
class DefaultPlaceholderControllerExtension {
|
|
4522
|
-
create() {
|
|
4523
|
-
return {
|
|
4524
|
-
canCreate: () => true
|
|
4525
|
-
};
|
|
4526
|
-
}
|
|
4527
|
-
}
|
|
4528
|
-
|
|
4529
4740
|
const defaultConfiguration = {
|
|
4530
4741
|
gapWidth: 88,
|
|
4531
4742
|
gapHeight: 24,
|
|
@@ -4538,13 +4749,18 @@ class RectPlaceholderExtension {
|
|
|
4538
4749
|
}
|
|
4539
4750
|
constructor(configuration) {
|
|
4540
4751
|
this.configuration = configuration;
|
|
4541
|
-
this.
|
|
4752
|
+
this.alongGapSize = new Vector(defaultConfiguration.gapWidth, defaultConfiguration.gapHeight);
|
|
4753
|
+
this.perpendicularGapSize = new Vector(defaultConfiguration.gapHeight, defaultConfiguration.gapWidth);
|
|
4542
4754
|
}
|
|
4543
|
-
|
|
4544
|
-
return
|
|
4755
|
+
getGapSize(orientation) {
|
|
4756
|
+
return orientation === PlaceholderGapOrientation.perpendicular ? this.perpendicularGapSize : this.alongGapSize;
|
|
4757
|
+
}
|
|
4758
|
+
createForGap(parent, parentSequence, index, orientation) {
|
|
4759
|
+
const gapSize = this.getGapSize(orientation);
|
|
4760
|
+
return RectPlaceholder.create(parent, gapSize, PlaceholderDirection.gap, parentSequence, index, this.configuration.radius, this.configuration.iconSize);
|
|
4545
4761
|
}
|
|
4546
4762
|
createForArea(parent, size, direction, parentSequence, index) {
|
|
4547
|
-
return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration);
|
|
4763
|
+
return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration.radius, this.configuration.iconSize);
|
|
4548
4764
|
}
|
|
4549
4765
|
}
|
|
4550
4766
|
|
|
@@ -4613,9 +4829,6 @@ function merge(services, extensions) {
|
|
|
4613
4829
|
if (ext.wheelController) {
|
|
4614
4830
|
services.wheelController = ext.wheelController;
|
|
4615
4831
|
}
|
|
4616
|
-
if (ext.placeholderController) {
|
|
4617
|
-
services.placeholderController = ext.placeholderController;
|
|
4618
|
-
}
|
|
4619
4832
|
if (ext.placeholder) {
|
|
4620
4833
|
services.placeholder = ext.placeholder;
|
|
4621
4834
|
}
|
|
@@ -4649,6 +4862,7 @@ function setDefaults(services, configuration) {
|
|
|
4649
4862
|
services.steps.push(ContainerStepExtension.create());
|
|
4650
4863
|
services.steps.push(SwitchStepExtension.create());
|
|
4651
4864
|
services.steps.push(TaskStepExtension.create());
|
|
4865
|
+
services.steps.push(LaunchPadStepExtension.create());
|
|
4652
4866
|
if (!services.stepComponentViewWrapper) {
|
|
4653
4867
|
services.stepComponentViewWrapper = new DefaultStepComponentViewWrapperExtension();
|
|
4654
4868
|
}
|
|
@@ -4682,9 +4896,6 @@ function setDefaults(services, configuration) {
|
|
|
4682
4896
|
if (!services.wheelController) {
|
|
4683
4897
|
services.wheelController = new ClassicWheelControllerExtension();
|
|
4684
4898
|
}
|
|
4685
|
-
if (!services.placeholderController) {
|
|
4686
|
-
services.placeholderController = new DefaultPlaceholderControllerExtension();
|
|
4687
|
-
}
|
|
4688
4899
|
if (!services.placeholder) {
|
|
4689
4900
|
services.placeholder = RectPlaceholderExtension.create();
|
|
4690
4901
|
}
|
|
@@ -4954,4 +5165,4 @@ class Designer {
|
|
|
4954
5165
|
}
|
|
4955
5166
|
}
|
|
4956
5167
|
|
|
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 };
|
|
5168
|
+
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 };
|