sequential-workflow-designer 0.19.4 → 0.21.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/dist/index.umd.js +320 -243
- package/lib/cjs/index.cjs +320 -243
- package/lib/esm/index.js +319 -243
- package/lib/index.d.ts +61 -18
- package/package.json +2 -2
package/lib/esm/index.js
CHANGED
|
@@ -599,13 +599,15 @@ class StepTypeValidator {
|
|
|
599
599
|
}
|
|
600
600
|
|
|
601
601
|
class ToolboxDataProvider {
|
|
602
|
-
constructor(iconProvider, configuration) {
|
|
602
|
+
constructor(iconProvider, i18n, configuration) {
|
|
603
603
|
this.iconProvider = iconProvider;
|
|
604
|
+
this.i18n = i18n;
|
|
604
605
|
this.configuration = configuration;
|
|
605
606
|
this.createItemData = (step) => {
|
|
606
607
|
StepTypeValidator.validate(step.type);
|
|
607
608
|
const iconUrl = this.iconProvider.getIconUrl(step);
|
|
608
|
-
const
|
|
609
|
+
const rawLabel = this.configuration && this.configuration.labelProvider ? this.configuration.labelProvider(step) : step.name;
|
|
610
|
+
const label = this.i18n(`toolbox.item.${step.type}.label`, rawLabel);
|
|
609
611
|
const description = this.configuration && this.configuration.descriptionProvider ? this.configuration.descriptionProvider(step) : label;
|
|
610
612
|
const lowerCaseLabel = label.toLowerCase();
|
|
611
613
|
return {
|
|
@@ -703,10 +705,10 @@ class DesignerApi {
|
|
|
703
705
|
const workspace = new WorkspaceApi(context.state, context.workspaceController);
|
|
704
706
|
const viewportController = context.services.viewportController.create(workspace);
|
|
705
707
|
const viewport = new ViewportApi(context.workspaceController, viewportController);
|
|
706
|
-
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.configuration.toolbox);
|
|
707
|
-
return new DesignerApi(ControlBarApi.create(context.state, context.historyController, context.stateModifier, viewport), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.stateModifier), workspace, viewport, new PathBarApi(context.state, context.definitionWalker), context.definitionWalker);
|
|
708
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);
|
|
709
|
+
return new DesignerApi(ControlBarApi.create(context.state, context.historyController, context.stateModifier, viewport), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.stateModifier), workspace, viewport, new PathBarApi(context.state, context.definitionWalker), context.definitionWalker, context.i18n);
|
|
708
710
|
}
|
|
709
|
-
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker) {
|
|
711
|
+
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
710
712
|
this.controlBar = controlBar;
|
|
711
713
|
this.toolbox = toolbox;
|
|
712
714
|
this.editor = editor;
|
|
@@ -714,6 +716,7 @@ class DesignerApi {
|
|
|
714
716
|
this.viewport = viewport;
|
|
715
717
|
this.pathBar = pathBar;
|
|
716
718
|
this.definitionWalker = definitionWalker;
|
|
719
|
+
this.i18n = i18n;
|
|
717
720
|
}
|
|
718
721
|
}
|
|
719
722
|
|
|
@@ -754,7 +757,7 @@ const BADGE_GAP = 4;
|
|
|
754
757
|
class Badges {
|
|
755
758
|
static createForStep(stepContext, view, componentContext) {
|
|
756
759
|
const g = createG(view.g);
|
|
757
|
-
const badges = componentContext.services.badges.map(ext => ext.createForStep(g, stepContext, componentContext));
|
|
760
|
+
const badges = componentContext.services.badges.map(ext => ext.createForStep(g, view, stepContext, componentContext));
|
|
758
761
|
const position = new Vector(view.width, 0);
|
|
759
762
|
return new Badges(g, position, badges);
|
|
760
763
|
}
|
|
@@ -828,7 +831,7 @@ var PlaceholderDirection;
|
|
|
828
831
|
class StepComponent {
|
|
829
832
|
static create(view, stepContext, componentContext) {
|
|
830
833
|
const badges = Badges.createForStep(stepContext, view, componentContext);
|
|
831
|
-
return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput
|
|
834
|
+
return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);
|
|
832
835
|
}
|
|
833
836
|
constructor(view, step, parentSequence, hasOutput, badges) {
|
|
834
837
|
this.view = view;
|
|
@@ -914,8 +917,11 @@ class StepComponent {
|
|
|
914
917
|
|
|
915
918
|
class StepComponentViewContextFactory {
|
|
916
919
|
static create(stepContext, componentContext) {
|
|
920
|
+
const preferenceKeyPrefix = stepContext.step.id + ':';
|
|
917
921
|
return {
|
|
922
|
+
i18n: componentContext.i18n,
|
|
918
923
|
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
924
|
+
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
919
925
|
createSequenceComponent: (parentElement, sequence) => {
|
|
920
926
|
const sequenceContext = {
|
|
921
927
|
sequence,
|
|
@@ -925,7 +931,12 @@ class StepComponentViewContextFactory {
|
|
|
925
931
|
};
|
|
926
932
|
return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
|
|
927
933
|
},
|
|
928
|
-
|
|
934
|
+
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
935
|
+
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
936
|
+
},
|
|
937
|
+
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
938
|
+
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
939
|
+
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
929
940
|
};
|
|
930
941
|
}
|
|
931
942
|
}
|
|
@@ -944,19 +955,22 @@ class StepComponentFactory {
|
|
|
944
955
|
}
|
|
945
956
|
|
|
946
957
|
class ComponentContext {
|
|
947
|
-
static create(
|
|
948
|
-
const validator = new DefinitionValidator(
|
|
949
|
-
const iconProvider = new IconProvider(
|
|
958
|
+
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, i18n, services) {
|
|
959
|
+
const validator = new DefinitionValidator(configuration.validator, state);
|
|
960
|
+
const iconProvider = new IconProvider(configuration.steps);
|
|
950
961
|
const placeholderController = services.placeholderController.create();
|
|
951
962
|
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
952
|
-
return new ComponentContext(validator, iconProvider, placeholderController, stepComponentFactory, services);
|
|
963
|
+
return new ComponentContext(validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
|
|
953
964
|
}
|
|
954
|
-
constructor(validator, iconProvider, placeholderController, stepComponentFactory, services) {
|
|
965
|
+
constructor(validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
|
|
955
966
|
this.validator = validator;
|
|
956
967
|
this.iconProvider = iconProvider;
|
|
957
968
|
this.placeholderController = placeholderController;
|
|
958
969
|
this.stepComponentFactory = stepComponentFactory;
|
|
970
|
+
this.definitionWalker = definitionWalker;
|
|
959
971
|
this.services = services;
|
|
972
|
+
this.preferenceStorage = preferenceStorage;
|
|
973
|
+
this.i18n = i18n;
|
|
960
974
|
}
|
|
961
975
|
}
|
|
962
976
|
|
|
@@ -1081,13 +1095,41 @@ class ValidationErrorBadgeView {
|
|
|
1081
1095
|
}
|
|
1082
1096
|
}
|
|
1083
1097
|
|
|
1098
|
+
class ValidatorFactory {
|
|
1099
|
+
static createForStep(stepContext, view, componentContext) {
|
|
1100
|
+
return () => {
|
|
1101
|
+
if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
1104
|
+
if (view.haveCollapsedChildren) {
|
|
1105
|
+
let allChildrenValid = true;
|
|
1106
|
+
componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {
|
|
1107
|
+
if (!componentContext.validator.validateStep(step, parentSequence)) {
|
|
1108
|
+
allChildrenValid = false;
|
|
1109
|
+
return false;
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
if (!allChildrenValid) {
|
|
1113
|
+
return false;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
return true;
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
static createForRoot(componentContext) {
|
|
1120
|
+
return () => {
|
|
1121
|
+
return componentContext.validator.validateRoot();
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1084
1126
|
class ValidationErrorBadge {
|
|
1085
|
-
static createForStep(parentElement, stepContext, componentContext, configuration) {
|
|
1086
|
-
const validator =
|
|
1127
|
+
static createForStep(parentElement, view, stepContext, componentContext, configuration) {
|
|
1128
|
+
const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);
|
|
1087
1129
|
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1088
1130
|
}
|
|
1089
1131
|
static createForRoot(parentElement, componentContext, configuration) {
|
|
1090
|
-
const validator = (
|
|
1132
|
+
const validator = ValidatorFactory.createForRoot(componentContext);
|
|
1091
1133
|
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1092
1134
|
}
|
|
1093
1135
|
constructor(parentElement, validator, configuration) {
|
|
@@ -1129,8 +1171,8 @@ class ValidationErrorBadgeExtension {
|
|
|
1129
1171
|
this.id = 'validationError';
|
|
1130
1172
|
this.createStartValue = () => true;
|
|
1131
1173
|
}
|
|
1132
|
-
createForStep(parentElement, stepContext, componentContext) {
|
|
1133
|
-
return ValidationErrorBadge.createForStep(parentElement, stepContext, componentContext, this.configuration.view);
|
|
1174
|
+
createForStep(parentElement, view, stepContext, componentContext) {
|
|
1175
|
+
return ValidationErrorBadge.createForStep(parentElement, view, stepContext, componentContext, this.configuration.view);
|
|
1134
1176
|
}
|
|
1135
1177
|
createForRoot(parentElement, componentContext) {
|
|
1136
1178
|
return ValidationErrorBadge.createForRoot(parentElement, componentContext, this.configuration.view);
|
|
@@ -1304,53 +1346,6 @@ class OutputView {
|
|
|
1304
1346
|
}
|
|
1305
1347
|
}
|
|
1306
1348
|
|
|
1307
|
-
class RegionView {
|
|
1308
|
-
static create(parent, widths, height) {
|
|
1309
|
-
const totalWidth = widths.reduce((result, width) => result + width, 0);
|
|
1310
|
-
const lines = [
|
|
1311
|
-
drawLine(parent, 0, 0, totalWidth, 0),
|
|
1312
|
-
drawLine(parent, 0, 0, 0, height),
|
|
1313
|
-
drawLine(parent, 0, height, totalWidth, height),
|
|
1314
|
-
drawLine(parent, totalWidth, 0, totalWidth, height)
|
|
1315
|
-
];
|
|
1316
|
-
let offsetX = widths[0];
|
|
1317
|
-
for (let i = 1; i < widths.length; i++) {
|
|
1318
|
-
lines.push(drawLine(parent, offsetX, 0, offsetX, height));
|
|
1319
|
-
offsetX += widths[i];
|
|
1320
|
-
}
|
|
1321
|
-
return new RegionView(lines, totalWidth, height);
|
|
1322
|
-
}
|
|
1323
|
-
constructor(lines, width, height) {
|
|
1324
|
-
this.lines = lines;
|
|
1325
|
-
this.width = width;
|
|
1326
|
-
this.height = height;
|
|
1327
|
-
}
|
|
1328
|
-
getClientPosition() {
|
|
1329
|
-
return getAbsolutePosition(this.lines[0]);
|
|
1330
|
-
}
|
|
1331
|
-
resolveClick(click) {
|
|
1332
|
-
const regionPosition = this.getClientPosition();
|
|
1333
|
-
const d = click.position.subtract(regionPosition);
|
|
1334
|
-
return d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale;
|
|
1335
|
-
}
|
|
1336
|
-
setIsSelected(isSelected) {
|
|
1337
|
-
this.lines.forEach(region => {
|
|
1338
|
-
Dom.toggleClass(region, isSelected, 'sqd-selected');
|
|
1339
|
-
});
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
function drawLine(parent, x1, y1, x2, y2) {
|
|
1343
|
-
const line = Dom.svg('line', {
|
|
1344
|
-
class: 'sqd-region',
|
|
1345
|
-
x1,
|
|
1346
|
-
y1,
|
|
1347
|
-
x2,
|
|
1348
|
-
y2
|
|
1349
|
-
});
|
|
1350
|
-
parent.insertBefore(line, parent.firstChild);
|
|
1351
|
-
return line;
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
1349
|
class DefaultSequenceComponentView {
|
|
1355
1350
|
static create(parent, sequenceContext, componentContext) {
|
|
1356
1351
|
const phWidth = componentContext.services.placeholder.gapSize.x;
|
|
@@ -1477,156 +1472,160 @@ class DefaultSequenceComponent {
|
|
|
1477
1472
|
}
|
|
1478
1473
|
}
|
|
1479
1474
|
|
|
1475
|
+
const COMPONENT_CLASS_NAME$2 = 'container';
|
|
1480
1476
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
}
|
|
1523
|
-
};
|
|
1477
|
+
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {
|
|
1478
|
+
const step = stepContext.step;
|
|
1479
|
+
const name = viewContext.getStepName();
|
|
1480
|
+
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, name, 'primary');
|
|
1481
|
+
const sequenceComponent = viewContext.createSequenceComponent(g, step.sequence);
|
|
1482
|
+
const halfOfWidestElement = labelView.width / 2;
|
|
1483
|
+
const offsetLeft = Math.max(halfOfWidestElement - sequenceComponent.view.joinX, 0) + cfg.paddingX;
|
|
1484
|
+
const offsetRight = Math.max(halfOfWidestElement - (sequenceComponent.view.width - sequenceComponent.view.joinX), 0) + cfg.paddingX;
|
|
1485
|
+
const width = offsetLeft + sequenceComponent.view.width + offsetRight;
|
|
1486
|
+
const height = cfg.paddingTop + cfg.label.height + sequenceComponent.view.height;
|
|
1487
|
+
const joinX = sequenceComponent.view.joinX + offsetLeft;
|
|
1488
|
+
Dom.translate(labelView.g, joinX, 0);
|
|
1489
|
+
Dom.translate(sequenceComponent.view.g, offsetLeft, cfg.paddingTop + cfg.label.height);
|
|
1490
|
+
const iconUrl = viewContext.getStepIconUrl();
|
|
1491
|
+
const inputView = InputView.createRectInput(g, joinX, 0, cfg.inputSize, cfg.inputIconSize, iconUrl);
|
|
1492
|
+
JoinView.createStraightJoin(g, new Vector(joinX, 0), cfg.paddingTop);
|
|
1493
|
+
const regionView = regionViewBuilder(g, [width], height);
|
|
1494
|
+
return {
|
|
1495
|
+
g,
|
|
1496
|
+
width,
|
|
1497
|
+
height,
|
|
1498
|
+
joinX,
|
|
1499
|
+
placeholders: null,
|
|
1500
|
+
sequenceComponents: [sequenceComponent],
|
|
1501
|
+
hasOutput: sequenceComponent.hasOutput,
|
|
1502
|
+
getClientPosition() {
|
|
1503
|
+
return regionView.getClientPosition();
|
|
1504
|
+
},
|
|
1505
|
+
resolveClick(click) {
|
|
1506
|
+
const result = regionView.resolveClick(click);
|
|
1507
|
+
return result === true || (result === null && g.contains(click.element)) ? true : result;
|
|
1508
|
+
},
|
|
1509
|
+
setIsDragging(isDragging) {
|
|
1510
|
+
inputView.setIsHidden(isDragging);
|
|
1511
|
+
},
|
|
1512
|
+
setIsSelected(isSelected) {
|
|
1513
|
+
regionView.setIsSelected(isSelected);
|
|
1514
|
+
},
|
|
1515
|
+
setIsDisabled(isDisabled) {
|
|
1516
|
+
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
});
|
|
1524
1520
|
};
|
|
1525
1521
|
|
|
1522
|
+
const COMPONENT_CLASS_NAME$1 = 'switch';
|
|
1526
1523
|
const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1524
|
+
return viewContext.createRegionComponentView(parent, COMPONENT_CLASS_NAME$1, (g, regionViewBuilder) => {
|
|
1525
|
+
const step = stepContext.step;
|
|
1526
|
+
const branchNames = Object.keys(step.branches);
|
|
1527
|
+
const branchComponents = branchNames.map(branchName => {
|
|
1528
|
+
return viewContext.createSequenceComponent(g, step.branches[branchName]);
|
|
1529
|
+
});
|
|
1530
|
+
const branchLabelViews = branchNames.map(branchName => {
|
|
1531
|
+
const labelY = cfg.paddingTop + cfg.nameLabel.height + cfg.connectionHeight;
|
|
1532
|
+
const translatedBranchName = viewContext.i18n(`stepComponent.${step.type}.branchName`, branchName);
|
|
1533
|
+
return LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');
|
|
1534
|
+
});
|
|
1535
|
+
const name = viewContext.getStepName();
|
|
1536
|
+
const nameLabelView = LabelView.create(g, cfg.paddingTop, cfg.nameLabel, name, 'primary');
|
|
1537
|
+
let prevOffsetX = 0;
|
|
1538
|
+
const branchSizes = branchComponents.map((component, i) => {
|
|
1539
|
+
const halfOfWidestBranchElement = Math.max(branchLabelViews[i].width, cfg.minContainerWidth) / 2;
|
|
1540
|
+
const branchOffsetLeft = Math.max(halfOfWidestBranchElement - component.view.joinX, 0) + cfg.paddingX;
|
|
1541
|
+
const branchOffsetRight = Math.max(halfOfWidestBranchElement - (component.view.width - component.view.joinX), 0) + cfg.paddingX;
|
|
1542
|
+
const width = component.view.width + branchOffsetLeft + branchOffsetRight;
|
|
1543
|
+
const joinX = component.view.joinX + branchOffsetLeft;
|
|
1544
|
+
const offsetX = prevOffsetX;
|
|
1545
|
+
prevOffsetX += width;
|
|
1546
|
+
return { width, branchOffsetLeft, offsetX, joinX };
|
|
1547
|
+
});
|
|
1548
|
+
const centerBranchIndex = Math.floor(branchNames.length / 2);
|
|
1549
|
+
const centerBranchSize = branchSizes[centerBranchIndex];
|
|
1550
|
+
let joinX = centerBranchSize.offsetX;
|
|
1551
|
+
if (branchNames.length % 2 !== 0) {
|
|
1552
|
+
joinX += centerBranchSize.joinX;
|
|
1553
|
+
}
|
|
1554
|
+
const totalBranchesWidth = branchSizes.reduce((result, s) => result + s.width, 0);
|
|
1555
|
+
const maxBranchesHeight = Math.max(...branchComponents.map(s => s.view.height));
|
|
1556
|
+
const halfOfWidestSwitchElement = nameLabelView.width / 2 + cfg.paddingX;
|
|
1557
|
+
const switchOffsetLeft = Math.max(halfOfWidestSwitchElement - joinX, 0);
|
|
1558
|
+
const switchOffsetRight = Math.max(halfOfWidestSwitchElement - (totalBranchesWidth - joinX), 0);
|
|
1559
|
+
const viewWidth = switchOffsetLeft + totalBranchesWidth + switchOffsetRight;
|
|
1560
|
+
const viewHeight = maxBranchesHeight + cfg.paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight * 2;
|
|
1561
|
+
const shiftedJoinX = switchOffsetLeft + joinX;
|
|
1562
|
+
Dom.translate(nameLabelView.g, shiftedJoinX, 0);
|
|
1563
|
+
const branchOffsetTop = cfg.paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight;
|
|
1564
|
+
branchComponents.forEach((component, i) => {
|
|
1565
|
+
const branchSize = branchSizes[i];
|
|
1566
|
+
const branchOffsetLeft = switchOffsetLeft + branchSize.offsetX + branchSize.branchOffsetLeft;
|
|
1567
|
+
Dom.translate(branchLabelViews[i].g, switchOffsetLeft + branchSize.offsetX + branchSize.joinX, 0);
|
|
1568
|
+
Dom.translate(component.view.g, branchOffsetLeft, branchOffsetTop);
|
|
1569
|
+
if (component.hasOutput && stepContext.isOutputConnected) {
|
|
1570
|
+
const endOffsetTopOfComponent = cfg.paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight + component.view.height;
|
|
1571
|
+
const missingHeight = viewHeight - endOffsetTopOfComponent - cfg.connectionHeight;
|
|
1572
|
+
if (missingHeight > 0) {
|
|
1573
|
+
JoinView.createStraightJoin(g, new Vector(switchOffsetLeft + branchSize.offsetX + branchSize.joinX, endOffsetTopOfComponent), missingHeight);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
});
|
|
1577
|
+
let inputView = null;
|
|
1578
|
+
if (cfg.inputSize > 0) {
|
|
1579
|
+
const iconUrl = viewContext.getStepIconUrl();
|
|
1580
|
+
inputView = InputView.createRectInput(g, shiftedJoinX, 0, cfg.inputSize, cfg.inputIconSize, iconUrl);
|
|
1581
|
+
}
|
|
1582
|
+
JoinView.createStraightJoin(g, new Vector(shiftedJoinX, 0), cfg.paddingTop);
|
|
1583
|
+
JoinView.createJoins(g, new Vector(shiftedJoinX, cfg.paddingTop + cfg.nameLabel.height), branchSizes.map(o => new Vector(switchOffsetLeft + o.offsetX + o.joinX, cfg.paddingTop + cfg.nameLabel.height + cfg.connectionHeight)));
|
|
1584
|
+
if (stepContext.isOutputConnected) {
|
|
1585
|
+
const ongoingSequenceIndexes = branchComponents
|
|
1586
|
+
.map((component, index) => (component.hasOutput ? index : null))
|
|
1587
|
+
.filter(index => index !== null);
|
|
1588
|
+
const ongoingJoinTargets = ongoingSequenceIndexes.map((i) => new Vector(switchOffsetLeft + branchSizes[i].offsetX + branchSizes[i].joinX, cfg.paddingTop + cfg.connectionHeight + cfg.nameLabel.height + cfg.branchNameLabel.height + maxBranchesHeight));
|
|
1589
|
+
if (ongoingJoinTargets.length > 0) {
|
|
1590
|
+
JoinView.createJoins(g, new Vector(shiftedJoinX, viewHeight), ongoingJoinTargets);
|
|
1576
1591
|
}
|
|
1577
1592
|
}
|
|
1593
|
+
const regions = branchSizes.map(s => s.width);
|
|
1594
|
+
regions[0] += switchOffsetLeft;
|
|
1595
|
+
regions[regions.length - 1] += switchOffsetRight;
|
|
1596
|
+
const regionView = regionViewBuilder(g, regions, viewHeight);
|
|
1597
|
+
return {
|
|
1598
|
+
g,
|
|
1599
|
+
width: viewWidth,
|
|
1600
|
+
height: viewHeight,
|
|
1601
|
+
joinX: shiftedJoinX,
|
|
1602
|
+
placeholders: null,
|
|
1603
|
+
sequenceComponents: branchComponents,
|
|
1604
|
+
hasOutput: branchComponents.some(c => c.hasOutput),
|
|
1605
|
+
getClientPosition() {
|
|
1606
|
+
return regionView.getClientPosition();
|
|
1607
|
+
},
|
|
1608
|
+
resolveClick(click) {
|
|
1609
|
+
const result = regionView.resolveClick(click);
|
|
1610
|
+
return result === true || (result === null && g.contains(click.element)) ? true : result;
|
|
1611
|
+
},
|
|
1612
|
+
setIsDragging(isDragging) {
|
|
1613
|
+
inputView === null || inputView === void 0 ? void 0 : inputView.setIsHidden(isDragging);
|
|
1614
|
+
},
|
|
1615
|
+
setIsSelected(isSelected) {
|
|
1616
|
+
regionView.setIsSelected(isSelected);
|
|
1617
|
+
},
|
|
1618
|
+
setIsDisabled(isDisabled) {
|
|
1619
|
+
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1578
1622
|
});
|
|
1579
|
-
let inputView = null;
|
|
1580
|
-
if (cfg.inputSize > 0) {
|
|
1581
|
-
const iconUrl = viewContext.getStepIconUrl();
|
|
1582
|
-
inputView = InputView.createRectInput(g, shiftedJoinX, 0, cfg.inputSize, cfg.inputIconSize, iconUrl);
|
|
1583
|
-
}
|
|
1584
|
-
JoinView.createStraightJoin(g, new Vector(shiftedJoinX, 0), cfg.paddingTop);
|
|
1585
|
-
JoinView.createJoins(g, new Vector(shiftedJoinX, cfg.paddingTop + cfg.nameLabel.height), branchSizes.map(o => new Vector(switchOffsetLeft + o.offsetX + o.joinX, cfg.paddingTop + cfg.nameLabel.height + cfg.connectionHeight)));
|
|
1586
|
-
if (stepContext.isOutputConnected) {
|
|
1587
|
-
const ongoingSequenceIndexes = branchComponents
|
|
1588
|
-
.map((component, index) => (component.hasOutput ? index : null))
|
|
1589
|
-
.filter(index => index !== null);
|
|
1590
|
-
const ongoingJoinTargets = ongoingSequenceIndexes.map((i) => new Vector(switchOffsetLeft + branchSizes[i].offsetX + branchSizes[i].joinX, cfg.paddingTop + cfg.connectionHeight + cfg.nameLabel.height + cfg.branchNameLabel.height + maxBranchesHeight));
|
|
1591
|
-
if (ongoingJoinTargets.length > 0) {
|
|
1592
|
-
JoinView.createJoins(g, new Vector(shiftedJoinX, viewHeight), ongoingJoinTargets);
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
const regions = branchSizes.map(s => s.width);
|
|
1596
|
-
regions[0] += switchOffsetLeft;
|
|
1597
|
-
regions[regions.length - 1] += switchOffsetRight;
|
|
1598
|
-
const regionView = RegionView.create(g, regions, viewHeight);
|
|
1599
|
-
return {
|
|
1600
|
-
g,
|
|
1601
|
-
width: viewWidth,
|
|
1602
|
-
height: viewHeight,
|
|
1603
|
-
joinX: shiftedJoinX,
|
|
1604
|
-
placeholders: null,
|
|
1605
|
-
sequenceComponents: branchComponents,
|
|
1606
|
-
getClientPosition() {
|
|
1607
|
-
return regionView.getClientPosition();
|
|
1608
|
-
},
|
|
1609
|
-
resolveClick(click) {
|
|
1610
|
-
return regionView.resolveClick(click) || g.contains(click.element) ? true : null;
|
|
1611
|
-
},
|
|
1612
|
-
setIsDragging(isDragging) {
|
|
1613
|
-
inputView === null || inputView === void 0 ? void 0 : inputView.setIsHidden(isDragging);
|
|
1614
|
-
},
|
|
1615
|
-
setIsSelected(isSelected) {
|
|
1616
|
-
regionView.setIsSelected(isSelected);
|
|
1617
|
-
},
|
|
1618
|
-
setIsDisabled(isDisabled) {
|
|
1619
|
-
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1620
|
-
},
|
|
1621
|
-
hasOutput() {
|
|
1622
|
-
return branchComponents.some(c => c.hasOutput);
|
|
1623
|
-
}
|
|
1624
|
-
};
|
|
1625
1623
|
};
|
|
1626
1624
|
|
|
1625
|
+
const COMPONENT_CLASS_NAME = 'task';
|
|
1627
1626
|
const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1628
1627
|
const { step } = stepContext;
|
|
1629
|
-
const g = ComponentDom.stepG(
|
|
1628
|
+
const g = ComponentDom.stepG(COMPONENT_CLASS_NAME, step.type, step.id);
|
|
1630
1629
|
parentElement.appendChild(g);
|
|
1631
1630
|
const boxHeight = cfg.paddingY * 2 + cfg.iconSize;
|
|
1632
1631
|
const text = Dom.svg('text', {
|
|
@@ -1634,7 +1633,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1634
1633
|
y: boxHeight / 2,
|
|
1635
1634
|
class: 'sqd-step-task-text'
|
|
1636
1635
|
});
|
|
1637
|
-
text.textContent =
|
|
1636
|
+
text.textContent = viewContext.getStepName();
|
|
1638
1637
|
g.appendChild(text);
|
|
1639
1638
|
const textWidth = Math.max(text.getBBox().width, cfg.minTextWidth);
|
|
1640
1639
|
const boxWidth = cfg.iconSize + cfg.paddingLeft + cfg.paddingRight + cfg.textMarginLeft + textWidth;
|
|
@@ -1676,9 +1675,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1676
1675
|
joinX: boxWidth / 2,
|
|
1677
1676
|
sequenceComponents: null,
|
|
1678
1677
|
placeholders: null,
|
|
1679
|
-
hasOutput
|
|
1680
|
-
return !!outputView;
|
|
1681
|
-
},
|
|
1678
|
+
hasOutput: !!outputView,
|
|
1682
1679
|
getClientPosition() {
|
|
1683
1680
|
return getAbsolutePosition(rect);
|
|
1684
1681
|
},
|
|
@@ -1967,6 +1964,64 @@ class RectPlaceholder {
|
|
|
1967
1964
|
}
|
|
1968
1965
|
}
|
|
1969
1966
|
|
|
1967
|
+
class DefaultRegionView {
|
|
1968
|
+
static create(parent, widths, height) {
|
|
1969
|
+
const totalWidth = widths.reduce((result, width) => result + width, 0);
|
|
1970
|
+
const lines = [
|
|
1971
|
+
drawLine(parent, 0, 0, totalWidth, 0),
|
|
1972
|
+
drawLine(parent, 0, 0, 0, height),
|
|
1973
|
+
drawLine(parent, 0, height, totalWidth, height),
|
|
1974
|
+
drawLine(parent, totalWidth, 0, totalWidth, height)
|
|
1975
|
+
];
|
|
1976
|
+
let offsetX = widths[0];
|
|
1977
|
+
for (let i = 1; i < widths.length; i++) {
|
|
1978
|
+
lines.push(drawLine(parent, offsetX, 0, offsetX, height));
|
|
1979
|
+
offsetX += widths[i];
|
|
1980
|
+
}
|
|
1981
|
+
return new DefaultRegionView(lines, totalWidth, height);
|
|
1982
|
+
}
|
|
1983
|
+
constructor(lines, width, height) {
|
|
1984
|
+
this.lines = lines;
|
|
1985
|
+
this.width = width;
|
|
1986
|
+
this.height = height;
|
|
1987
|
+
}
|
|
1988
|
+
getClientPosition() {
|
|
1989
|
+
return getAbsolutePosition(this.lines[0]);
|
|
1990
|
+
}
|
|
1991
|
+
resolveClick(click) {
|
|
1992
|
+
const regionPosition = this.getClientPosition();
|
|
1993
|
+
const d = click.position.subtract(regionPosition);
|
|
1994
|
+
if (d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale) {
|
|
1995
|
+
return true;
|
|
1996
|
+
}
|
|
1997
|
+
return null;
|
|
1998
|
+
}
|
|
1999
|
+
setIsSelected(isSelected) {
|
|
2000
|
+
this.lines.forEach(region => {
|
|
2001
|
+
Dom.toggleClass(region, isSelected, 'sqd-selected');
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
function drawLine(parent, x1, y1, x2, y2) {
|
|
2006
|
+
const line = Dom.svg('line', {
|
|
2007
|
+
class: 'sqd-region',
|
|
2008
|
+
x1,
|
|
2009
|
+
y1,
|
|
2010
|
+
x2,
|
|
2011
|
+
y2
|
|
2012
|
+
});
|
|
2013
|
+
parent.insertBefore(line, parent.firstChild);
|
|
2014
|
+
return line;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
class DefaultRegionComponentViewExtension {
|
|
2018
|
+
create(parentElement, componentClassName, stepContext, _, contentFactory) {
|
|
2019
|
+
const g = ComponentDom.stepG(componentClassName, stepContext.step.type, stepContext.step.id);
|
|
2020
|
+
parentElement.appendChild(g);
|
|
2021
|
+
return contentFactory(g, DefaultRegionView.create);
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
|
|
1970
2025
|
function readMousePosition(e) {
|
|
1971
2026
|
return new Vector(e.pageX, e.pageY);
|
|
1972
2027
|
}
|
|
@@ -2468,9 +2523,22 @@ class WorkspaceControllerWrapper {
|
|
|
2468
2523
|
}
|
|
2469
2524
|
}
|
|
2470
2525
|
|
|
2526
|
+
class MemoryPreferenceStorage {
|
|
2527
|
+
constructor() {
|
|
2528
|
+
this.map = {};
|
|
2529
|
+
}
|
|
2530
|
+
setItem(key, value) {
|
|
2531
|
+
this.map[key] = value;
|
|
2532
|
+
}
|
|
2533
|
+
getItem(key) {
|
|
2534
|
+
var _a;
|
|
2535
|
+
return (_a = this.map[key]) !== null && _a !== void 0 ? _a : null;
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2471
2539
|
class DesignerContext {
|
|
2472
2540
|
static create(parent, startDefinition, configuration, services) {
|
|
2473
|
-
var _a, _b, _c;
|
|
2541
|
+
var _a, _b, _c, _d, _e;
|
|
2474
2542
|
const definition = ObjectCloner.deepClone(startDefinition);
|
|
2475
2543
|
const layoutController = new LayoutController(parent);
|
|
2476
2544
|
const isReadonly = !!configuration.isReadonly;
|
|
@@ -2482,22 +2550,25 @@ class DesignerContext {
|
|
|
2482
2550
|
const behaviorController = new BehaviorController();
|
|
2483
2551
|
const stepExtensionResolver = StepExtensionResolver.create(services);
|
|
2484
2552
|
const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new DefinitionWalker();
|
|
2553
|
+
const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
|
|
2485
2554
|
const stateModifier = StateModifier.create(definitionWalker, state, configuration);
|
|
2486
2555
|
const customActionController = new CustomActionController(configuration, state, stateModifier);
|
|
2487
2556
|
let historyController = undefined;
|
|
2488
2557
|
if (configuration.undoStackSize) {
|
|
2489
2558
|
historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
|
|
2490
2559
|
}
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2560
|
+
const preferenceStorage = (_e = configuration.preferenceStorage) !== null && _e !== void 0 ? _e : new MemoryPreferenceStorage();
|
|
2561
|
+
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, i18n, services);
|
|
2562
|
+
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController);
|
|
2493
2563
|
}
|
|
2494
|
-
constructor(theme, state, configuration, services, componentContext, definitionWalker, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController) {
|
|
2564
|
+
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController) {
|
|
2495
2565
|
this.theme = theme;
|
|
2496
2566
|
this.state = state;
|
|
2497
2567
|
this.configuration = configuration;
|
|
2498
2568
|
this.services = services;
|
|
2499
2569
|
this.componentContext = componentContext;
|
|
2500
2570
|
this.definitionWalker = definitionWalker;
|
|
2571
|
+
this.i18n = i18n;
|
|
2501
2572
|
this.stateModifier = stateModifier;
|
|
2502
2573
|
this.layoutController = layoutController;
|
|
2503
2574
|
this.workspaceController = workspaceController;
|
|
@@ -2910,8 +2981,9 @@ class ContextMenuController {
|
|
|
2910
2981
|
}
|
|
2911
2982
|
|
|
2912
2983
|
class ContextMenuItemsBuilder {
|
|
2913
|
-
constructor(viewportApi, stateModifier, state, customMenuItemsProvider) {
|
|
2984
|
+
constructor(viewportApi, i18n, stateModifier, state, customMenuItemsProvider) {
|
|
2914
2985
|
this.viewportApi = viewportApi;
|
|
2986
|
+
this.i18n = i18n;
|
|
2915
2987
|
this.stateModifier = stateModifier;
|
|
2916
2988
|
this.state = state;
|
|
2917
2989
|
this.customMenuItemsProvider = customMenuItemsProvider;
|
|
@@ -2922,15 +2994,16 @@ class ContextMenuItemsBuilder {
|
|
|
2922
2994
|
const ssc = commandOrNull;
|
|
2923
2995
|
const step = ssc.component.step;
|
|
2924
2996
|
const parentSequence = ssc.component.parentSequence;
|
|
2997
|
+
const name = this.i18n(`step.${step.type}.name`, step.name);
|
|
2925
2998
|
items.push({
|
|
2926
|
-
label:
|
|
2999
|
+
label: name,
|
|
2927
3000
|
order: 0
|
|
2928
3001
|
});
|
|
2929
3002
|
this.tryAppendCustomItems(items, step, parentSequence);
|
|
2930
3003
|
if (this.stateModifier.isSelectable(step, parentSequence)) {
|
|
2931
3004
|
if (this.state.selectedStepId === step.id) {
|
|
2932
3005
|
items.push({
|
|
2933
|
-
label:
|
|
3006
|
+
label: this.i18n('contextMenu.unselect', 'Unselect'),
|
|
2934
3007
|
order: 10,
|
|
2935
3008
|
callback: () => {
|
|
2936
3009
|
this.state.setSelectedStepId(null);
|
|
@@ -2939,7 +3012,7 @@ class ContextMenuItemsBuilder {
|
|
|
2939
3012
|
}
|
|
2940
3013
|
else {
|
|
2941
3014
|
items.push({
|
|
2942
|
-
label: 'Select',
|
|
3015
|
+
label: this.i18n('contextMenu.select', 'Select'),
|
|
2943
3016
|
order: 20,
|
|
2944
3017
|
callback: () => {
|
|
2945
3018
|
this.stateModifier.trySelectStepById(step.id);
|
|
@@ -2950,7 +3023,7 @@ class ContextMenuItemsBuilder {
|
|
|
2950
3023
|
if (!this.state.isReadonly) {
|
|
2951
3024
|
if (this.stateModifier.isDeletable(step.id)) {
|
|
2952
3025
|
items.push({
|
|
2953
|
-
label: 'Delete',
|
|
3026
|
+
label: this.i18n('contextMenu.delete', 'Delete'),
|
|
2954
3027
|
order: 30,
|
|
2955
3028
|
callback: () => {
|
|
2956
3029
|
this.stateModifier.tryDelete(step.id);
|
|
@@ -2959,7 +3032,7 @@ class ContextMenuItemsBuilder {
|
|
|
2959
3032
|
}
|
|
2960
3033
|
if (this.stateModifier.isDuplicable(step, parentSequence)) {
|
|
2961
3034
|
items.push({
|
|
2962
|
-
label: 'Duplicate',
|
|
3035
|
+
label: this.i18n('contextMenu.duplicate', 'Duplicate'),
|
|
2963
3036
|
order: 40,
|
|
2964
3037
|
callback: () => {
|
|
2965
3038
|
this.stateModifier.tryDuplicate(step, parentSequence);
|
|
@@ -2972,7 +3045,7 @@ class ContextMenuItemsBuilder {
|
|
|
2972
3045
|
this.tryAppendCustomItems(items, null, this.state.definition.sequence);
|
|
2973
3046
|
}
|
|
2974
3047
|
items.push({
|
|
2975
|
-
label: 'Reset view',
|
|
3048
|
+
label: this.i18n('contextMenu.resetView', 'Reset view'),
|
|
2976
3049
|
order: 50,
|
|
2977
3050
|
callback: () => {
|
|
2978
3051
|
this.viewportApi.resetViewport();
|
|
@@ -2997,7 +3070,7 @@ class Workspace {
|
|
|
2997
3070
|
const view = WorkspaceView.create(parent, designerContext.componentContext);
|
|
2998
3071
|
const clickBehaviorResolver = new ClickBehaviorResolver(designerContext);
|
|
2999
3072
|
const wheelController = designerContext.services.wheelController.create(api.workspace);
|
|
3000
|
-
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
3073
|
+
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
3001
3074
|
? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
|
|
3002
3075
|
: undefined);
|
|
3003
3076
|
const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
|
|
@@ -3244,28 +3317,28 @@ class DefaultDraggedComponentExtension {
|
|
|
3244
3317
|
}
|
|
3245
3318
|
|
|
3246
3319
|
class ControlBarView {
|
|
3247
|
-
static create(parent, isUndoRedoSupported) {
|
|
3320
|
+
static create(parent, isUndoRedoSupported, i18n) {
|
|
3248
3321
|
const root = Dom.element('div', {
|
|
3249
3322
|
class: 'sqd-control-bar'
|
|
3250
3323
|
});
|
|
3251
|
-
const resetButton = createButton(Icons.center, 'Reset view');
|
|
3324
|
+
const resetButton = createButton(Icons.center, i18n('controlBar.resetView', 'Reset view'));
|
|
3252
3325
|
root.appendChild(resetButton);
|
|
3253
|
-
const zoomInButton = createButton(Icons.zoomIn, 'Zoom in');
|
|
3326
|
+
const zoomInButton = createButton(Icons.zoomIn, i18n('controlBar.zoomIn', 'Zoom in'));
|
|
3254
3327
|
root.appendChild(zoomInButton);
|
|
3255
|
-
const zoomOutButton = createButton(Icons.zoomOut, 'Zoom out');
|
|
3328
|
+
const zoomOutButton = createButton(Icons.zoomOut, i18n('controlBar.zoomOut', 'Zoom out'));
|
|
3256
3329
|
root.appendChild(zoomOutButton);
|
|
3257
3330
|
let undoButton = null;
|
|
3258
3331
|
let redoButton = null;
|
|
3259
3332
|
if (isUndoRedoSupported) {
|
|
3260
|
-
undoButton = createButton(Icons.undo, 'Undo');
|
|
3333
|
+
undoButton = createButton(Icons.undo, i18n('controlBar.undo', 'Undo'));
|
|
3261
3334
|
root.appendChild(undoButton);
|
|
3262
|
-
redoButton = createButton(Icons.redo, 'Redo');
|
|
3335
|
+
redoButton = createButton(Icons.redo, i18n('controlBar.redo', 'Redo'));
|
|
3263
3336
|
root.appendChild(redoButton);
|
|
3264
3337
|
}
|
|
3265
|
-
const disableDragButton = createButton(Icons.move, 'Turn on/off drag and drop');
|
|
3338
|
+
const disableDragButton = createButton(Icons.move, i18n('controlBar.turnOnOffDragAndDrop', 'Turn on/off drag and drop'));
|
|
3266
3339
|
disableDragButton.classList.add('sqd-disabled');
|
|
3267
3340
|
root.appendChild(disableDragButton);
|
|
3268
|
-
const deleteButton = createButton(Icons.delete, 'Delete selected step');
|
|
3341
|
+
const deleteButton = createButton(Icons.delete, i18n('controlBar.deleteSelectedStep', 'Delete selected step'));
|
|
3269
3342
|
deleteButton.classList.add('sqd-delete');
|
|
3270
3343
|
deleteButton.classList.add('sqd-hidden');
|
|
3271
3344
|
root.appendChild(deleteButton);
|
|
@@ -3346,7 +3419,7 @@ function createButton(d, title) {
|
|
|
3346
3419
|
class ControlBar {
|
|
3347
3420
|
static create(parent, api) {
|
|
3348
3421
|
const isUndoRedoSupported = api.controlBar.isUndoRedoSupported();
|
|
3349
|
-
const view = ControlBarView.create(parent, isUndoRedoSupported);
|
|
3422
|
+
const view = ControlBarView.create(parent, isUndoRedoSupported, api.i18n);
|
|
3350
3423
|
const bar = new ControlBar(view, api.controlBar, isUndoRedoSupported);
|
|
3351
3424
|
view.bindResetButtonClick(() => bar.onResetButtonClicked());
|
|
3352
3425
|
view.bindZoomInButtonClick(() => bar.onZoomInButtonClicked());
|
|
@@ -3476,19 +3549,16 @@ class KeyboardDaemonExtension {
|
|
|
3476
3549
|
}
|
|
3477
3550
|
|
|
3478
3551
|
class SmartEditorView {
|
|
3479
|
-
static create(parent, api, configuration) {
|
|
3552
|
+
static create(parent, api, i18n, configuration) {
|
|
3480
3553
|
const root = Dom.element('div', {
|
|
3481
3554
|
class: 'sqd-smart-editor'
|
|
3482
3555
|
});
|
|
3483
3556
|
const toggle = Dom.element('div', {
|
|
3484
3557
|
class: 'sqd-smart-editor-toggle',
|
|
3485
|
-
title: 'Toggle editor'
|
|
3558
|
+
title: i18n('smartEditor.toggle', 'Toggle editor')
|
|
3486
3559
|
});
|
|
3487
3560
|
parent.appendChild(toggle);
|
|
3488
3561
|
parent.appendChild(root);
|
|
3489
|
-
if (configuration.globalEditorProvider) {
|
|
3490
|
-
throw new Error('globalEditorProvider is renamed to rootEditorProvider');
|
|
3491
|
-
}
|
|
3492
3562
|
const editor = Editor.create(root, api, 'sqd-editor sqd-step-editor', configuration.stepEditorProvider, 'sqd-editor sqd-root-editor', configuration.rootEditorProvider, null);
|
|
3493
3563
|
return new SmartEditorView(root, toggle, editor);
|
|
3494
3564
|
}
|
|
@@ -3519,7 +3589,7 @@ class SmartEditorView {
|
|
|
3519
3589
|
|
|
3520
3590
|
class SmartEditor {
|
|
3521
3591
|
static create(parent, api, configuration) {
|
|
3522
|
-
const view = SmartEditorView.create(parent, api.editor, configuration);
|
|
3592
|
+
const view = SmartEditorView.create(parent, api.editor, api.i18n, configuration);
|
|
3523
3593
|
const editor = new SmartEditor(view, api.editor, api.workspace);
|
|
3524
3594
|
editor.updateVisibility();
|
|
3525
3595
|
view.bindToggleClick(() => editor.onToggleClicked());
|
|
@@ -3762,7 +3832,7 @@ class ToolboxItem {
|
|
|
3762
3832
|
}
|
|
3763
3833
|
|
|
3764
3834
|
class ToolboxView {
|
|
3765
|
-
static create(parent, api) {
|
|
3835
|
+
static create(parent, api, i18n) {
|
|
3766
3836
|
const root = Dom.element('div', {
|
|
3767
3837
|
class: 'sqd-toolbox'
|
|
3768
3838
|
});
|
|
@@ -3772,14 +3842,14 @@ class ToolboxView {
|
|
|
3772
3842
|
const headerTitle = Dom.element('div', {
|
|
3773
3843
|
class: 'sqd-toolbox-header-title'
|
|
3774
3844
|
});
|
|
3775
|
-
headerTitle.innerText = 'Toolbox';
|
|
3845
|
+
headerTitle.innerText = i18n('toolbox.title', 'Toolbox');
|
|
3776
3846
|
const body = Dom.element('div', {
|
|
3777
3847
|
class: 'sqd-toolbox-body'
|
|
3778
3848
|
});
|
|
3779
3849
|
const filterInput = Dom.element('input', {
|
|
3780
3850
|
class: 'sqd-toolbox-filter',
|
|
3781
3851
|
type: 'text',
|
|
3782
|
-
placeholder: 'Search...'
|
|
3852
|
+
placeholder: i18n('toolbox.search', 'Search...')
|
|
3783
3853
|
});
|
|
3784
3854
|
root.appendChild(header);
|
|
3785
3855
|
root.appendChild(body);
|
|
@@ -3839,9 +3909,9 @@ class ToolboxView {
|
|
|
3839
3909
|
}
|
|
3840
3910
|
|
|
3841
3911
|
class Toolbox {
|
|
3842
|
-
static create(root, api) {
|
|
3912
|
+
static create(root, api, i18n) {
|
|
3843
3913
|
const allGroups = api.getAllGroups();
|
|
3844
|
-
const view = ToolboxView.create(root, api);
|
|
3914
|
+
const view = ToolboxView.create(root, api, i18n);
|
|
3845
3915
|
const toolbox = new Toolbox(view, api, allGroups);
|
|
3846
3916
|
toolbox.render();
|
|
3847
3917
|
toolbox.onIsCollapsedChanged();
|
|
@@ -3876,7 +3946,7 @@ class Toolbox {
|
|
|
3876
3946
|
|
|
3877
3947
|
class ToolboxExtension {
|
|
3878
3948
|
create(root, api) {
|
|
3879
|
-
return Toolbox.create(root, api.toolbox);
|
|
3949
|
+
return Toolbox.create(root, api.toolbox, api.i18n);
|
|
3880
3950
|
}
|
|
3881
3951
|
}
|
|
3882
3952
|
|
|
@@ -3914,7 +3984,7 @@ class DefaultPlaceholderControllerExtension {
|
|
|
3914
3984
|
}
|
|
3915
3985
|
|
|
3916
3986
|
const defaultConfiguration$3 = {
|
|
3917
|
-
gapWidth:
|
|
3987
|
+
gapWidth: 88,
|
|
3918
3988
|
gapHeight: 24,
|
|
3919
3989
|
radius: 6,
|
|
3920
3990
|
iconSize: 16
|
|
@@ -4183,6 +4253,9 @@ function merge(services, extensions) {
|
|
|
4183
4253
|
if (ext.placeholder) {
|
|
4184
4254
|
services.placeholder = ext.placeholder;
|
|
4185
4255
|
}
|
|
4256
|
+
if (ext.regionComponentView) {
|
|
4257
|
+
services.regionComponentView = ext.regionComponentView;
|
|
4258
|
+
}
|
|
4186
4259
|
if (ext.viewportController) {
|
|
4187
4260
|
services.viewportController = ext.viewportController;
|
|
4188
4261
|
}
|
|
@@ -4243,6 +4316,9 @@ function setDefaults(services, configuration) {
|
|
|
4243
4316
|
if (!services.placeholder) {
|
|
4244
4317
|
services.placeholder = RectPlaceholderExtension.create();
|
|
4245
4318
|
}
|
|
4319
|
+
if (!services.regionComponentView) {
|
|
4320
|
+
services.regionComponentView = new DefaultRegionComponentViewExtension();
|
|
4321
|
+
}
|
|
4246
4322
|
if (!services.viewportController) {
|
|
4247
4323
|
services.viewportController = new DefaultViewportControllerExtension();
|
|
4248
4324
|
}
|
|
@@ -4521,4 +4597,4 @@ class StepsDesignerExtension {
|
|
|
4521
4597
|
}
|
|
4522
4598
|
}
|
|
4523
4599
|
|
|
4524
|
-
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView,
|
|
4600
|
+
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, ServicesResolver, SimpleEvent, StepComponent, StepExtensionResolver, StepsDesignerExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|