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/dist/index.umd.js
CHANGED
|
@@ -602,13 +602,15 @@
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
class ToolboxDataProvider {
|
|
605
|
-
constructor(iconProvider, configuration) {
|
|
605
|
+
constructor(iconProvider, i18n, configuration) {
|
|
606
606
|
this.iconProvider = iconProvider;
|
|
607
|
+
this.i18n = i18n;
|
|
607
608
|
this.configuration = configuration;
|
|
608
609
|
this.createItemData = (step) => {
|
|
609
610
|
StepTypeValidator.validate(step.type);
|
|
610
611
|
const iconUrl = this.iconProvider.getIconUrl(step);
|
|
611
|
-
const
|
|
612
|
+
const rawLabel = this.configuration && this.configuration.labelProvider ? this.configuration.labelProvider(step) : step.name;
|
|
613
|
+
const label = this.i18n(`toolbox.item.${step.type}.label`, rawLabel);
|
|
612
614
|
const description = this.configuration && this.configuration.descriptionProvider ? this.configuration.descriptionProvider(step) : label;
|
|
613
615
|
const lowerCaseLabel = label.toLowerCase();
|
|
614
616
|
return {
|
|
@@ -706,10 +708,10 @@
|
|
|
706
708
|
const workspace = new WorkspaceApi(context.state, context.workspaceController);
|
|
707
709
|
const viewportController = context.services.viewportController.create(workspace);
|
|
708
710
|
const viewport = new ViewportApi(context.workspaceController, viewportController);
|
|
709
|
-
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.configuration.toolbox);
|
|
710
|
-
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);
|
|
711
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);
|
|
712
|
+
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);
|
|
711
713
|
}
|
|
712
|
-
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker) {
|
|
714
|
+
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
713
715
|
this.controlBar = controlBar;
|
|
714
716
|
this.toolbox = toolbox;
|
|
715
717
|
this.editor = editor;
|
|
@@ -717,6 +719,7 @@
|
|
|
717
719
|
this.viewport = viewport;
|
|
718
720
|
this.pathBar = pathBar;
|
|
719
721
|
this.definitionWalker = definitionWalker;
|
|
722
|
+
this.i18n = i18n;
|
|
720
723
|
}
|
|
721
724
|
}
|
|
722
725
|
|
|
@@ -757,7 +760,7 @@
|
|
|
757
760
|
class Badges {
|
|
758
761
|
static createForStep(stepContext, view, componentContext) {
|
|
759
762
|
const g = createG(view.g);
|
|
760
|
-
const badges = componentContext.services.badges.map(ext => ext.createForStep(g, stepContext, componentContext));
|
|
763
|
+
const badges = componentContext.services.badges.map(ext => ext.createForStep(g, view, stepContext, componentContext));
|
|
761
764
|
const position = new Vector(view.width, 0);
|
|
762
765
|
return new Badges(g, position, badges);
|
|
763
766
|
}
|
|
@@ -831,7 +834,7 @@
|
|
|
831
834
|
class StepComponent {
|
|
832
835
|
static create(view, stepContext, componentContext) {
|
|
833
836
|
const badges = Badges.createForStep(stepContext, view, componentContext);
|
|
834
|
-
return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput
|
|
837
|
+
return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);
|
|
835
838
|
}
|
|
836
839
|
constructor(view, step, parentSequence, hasOutput, badges) {
|
|
837
840
|
this.view = view;
|
|
@@ -917,8 +920,11 @@
|
|
|
917
920
|
|
|
918
921
|
class StepComponentViewContextFactory {
|
|
919
922
|
static create(stepContext, componentContext) {
|
|
923
|
+
const preferenceKeyPrefix = stepContext.step.id + ':';
|
|
920
924
|
return {
|
|
925
|
+
i18n: componentContext.i18n,
|
|
921
926
|
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
927
|
+
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
922
928
|
createSequenceComponent: (parentElement, sequence) => {
|
|
923
929
|
const sequenceContext = {
|
|
924
930
|
sequence,
|
|
@@ -928,7 +934,12 @@
|
|
|
928
934
|
};
|
|
929
935
|
return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
|
|
930
936
|
},
|
|
931
|
-
|
|
937
|
+
createRegionComponentView(parentElement, componentClassName, contentFactory) {
|
|
938
|
+
return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);
|
|
939
|
+
},
|
|
940
|
+
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
941
|
+
getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),
|
|
942
|
+
setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)
|
|
932
943
|
};
|
|
933
944
|
}
|
|
934
945
|
}
|
|
@@ -947,19 +958,22 @@
|
|
|
947
958
|
}
|
|
948
959
|
|
|
949
960
|
class ComponentContext {
|
|
950
|
-
static create(
|
|
951
|
-
const validator = new DefinitionValidator(
|
|
952
|
-
const iconProvider = new IconProvider(
|
|
961
|
+
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, i18n, services) {
|
|
962
|
+
const validator = new DefinitionValidator(configuration.validator, state);
|
|
963
|
+
const iconProvider = new IconProvider(configuration.steps);
|
|
953
964
|
const placeholderController = services.placeholderController.create();
|
|
954
965
|
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
955
|
-
return new ComponentContext(validator, iconProvider, placeholderController, stepComponentFactory, services);
|
|
966
|
+
return new ComponentContext(validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
|
|
956
967
|
}
|
|
957
|
-
constructor(validator, iconProvider, placeholderController, stepComponentFactory, services) {
|
|
968
|
+
constructor(validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
|
|
958
969
|
this.validator = validator;
|
|
959
970
|
this.iconProvider = iconProvider;
|
|
960
971
|
this.placeholderController = placeholderController;
|
|
961
972
|
this.stepComponentFactory = stepComponentFactory;
|
|
973
|
+
this.definitionWalker = definitionWalker;
|
|
962
974
|
this.services = services;
|
|
975
|
+
this.preferenceStorage = preferenceStorage;
|
|
976
|
+
this.i18n = i18n;
|
|
963
977
|
}
|
|
964
978
|
}
|
|
965
979
|
|
|
@@ -1084,13 +1098,41 @@
|
|
|
1084
1098
|
}
|
|
1085
1099
|
}
|
|
1086
1100
|
|
|
1101
|
+
class ValidatorFactory {
|
|
1102
|
+
static createForStep(stepContext, view, componentContext) {
|
|
1103
|
+
return () => {
|
|
1104
|
+
if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {
|
|
1105
|
+
return false;
|
|
1106
|
+
}
|
|
1107
|
+
if (view.haveCollapsedChildren) {
|
|
1108
|
+
let allChildrenValid = true;
|
|
1109
|
+
componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {
|
|
1110
|
+
if (!componentContext.validator.validateStep(step, parentSequence)) {
|
|
1111
|
+
allChildrenValid = false;
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
if (!allChildrenValid) {
|
|
1116
|
+
return false;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
return true;
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
static createForRoot(componentContext) {
|
|
1123
|
+
return () => {
|
|
1124
|
+
return componentContext.validator.validateRoot();
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1087
1129
|
class ValidationErrorBadge {
|
|
1088
|
-
static createForStep(parentElement, stepContext, componentContext, configuration) {
|
|
1089
|
-
const validator =
|
|
1130
|
+
static createForStep(parentElement, view, stepContext, componentContext, configuration) {
|
|
1131
|
+
const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);
|
|
1090
1132
|
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1091
1133
|
}
|
|
1092
1134
|
static createForRoot(parentElement, componentContext, configuration) {
|
|
1093
|
-
const validator = (
|
|
1135
|
+
const validator = ValidatorFactory.createForRoot(componentContext);
|
|
1094
1136
|
return new ValidationErrorBadge(parentElement, validator, configuration);
|
|
1095
1137
|
}
|
|
1096
1138
|
constructor(parentElement, validator, configuration) {
|
|
@@ -1132,8 +1174,8 @@
|
|
|
1132
1174
|
this.id = 'validationError';
|
|
1133
1175
|
this.createStartValue = () => true;
|
|
1134
1176
|
}
|
|
1135
|
-
createForStep(parentElement, stepContext, componentContext) {
|
|
1136
|
-
return ValidationErrorBadge.createForStep(parentElement, stepContext, componentContext, this.configuration.view);
|
|
1177
|
+
createForStep(parentElement, view, stepContext, componentContext) {
|
|
1178
|
+
return ValidationErrorBadge.createForStep(parentElement, view, stepContext, componentContext, this.configuration.view);
|
|
1137
1179
|
}
|
|
1138
1180
|
createForRoot(parentElement, componentContext) {
|
|
1139
1181
|
return ValidationErrorBadge.createForRoot(parentElement, componentContext, this.configuration.view);
|
|
@@ -1307,53 +1349,6 @@
|
|
|
1307
1349
|
}
|
|
1308
1350
|
}
|
|
1309
1351
|
|
|
1310
|
-
class RegionView {
|
|
1311
|
-
static create(parent, widths, height) {
|
|
1312
|
-
const totalWidth = widths.reduce((result, width) => result + width, 0);
|
|
1313
|
-
const lines = [
|
|
1314
|
-
drawLine(parent, 0, 0, totalWidth, 0),
|
|
1315
|
-
drawLine(parent, 0, 0, 0, height),
|
|
1316
|
-
drawLine(parent, 0, height, totalWidth, height),
|
|
1317
|
-
drawLine(parent, totalWidth, 0, totalWidth, height)
|
|
1318
|
-
];
|
|
1319
|
-
let offsetX = widths[0];
|
|
1320
|
-
for (let i = 1; i < widths.length; i++) {
|
|
1321
|
-
lines.push(drawLine(parent, offsetX, 0, offsetX, height));
|
|
1322
|
-
offsetX += widths[i];
|
|
1323
|
-
}
|
|
1324
|
-
return new RegionView(lines, totalWidth, height);
|
|
1325
|
-
}
|
|
1326
|
-
constructor(lines, width, height) {
|
|
1327
|
-
this.lines = lines;
|
|
1328
|
-
this.width = width;
|
|
1329
|
-
this.height = height;
|
|
1330
|
-
}
|
|
1331
|
-
getClientPosition() {
|
|
1332
|
-
return getAbsolutePosition(this.lines[0]);
|
|
1333
|
-
}
|
|
1334
|
-
resolveClick(click) {
|
|
1335
|
-
const regionPosition = this.getClientPosition();
|
|
1336
|
-
const d = click.position.subtract(regionPosition);
|
|
1337
|
-
return d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale;
|
|
1338
|
-
}
|
|
1339
|
-
setIsSelected(isSelected) {
|
|
1340
|
-
this.lines.forEach(region => {
|
|
1341
|
-
Dom.toggleClass(region, isSelected, 'sqd-selected');
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
function drawLine(parent, x1, y1, x2, y2) {
|
|
1346
|
-
const line = Dom.svg('line', {
|
|
1347
|
-
class: 'sqd-region',
|
|
1348
|
-
x1,
|
|
1349
|
-
y1,
|
|
1350
|
-
x2,
|
|
1351
|
-
y2
|
|
1352
|
-
});
|
|
1353
|
-
parent.insertBefore(line, parent.firstChild);
|
|
1354
|
-
return line;
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
1352
|
class DefaultSequenceComponentView {
|
|
1358
1353
|
static create(parent, sequenceContext, componentContext) {
|
|
1359
1354
|
const phWidth = componentContext.services.placeholder.gapSize.x;
|
|
@@ -1480,156 +1475,160 @@
|
|
|
1480
1475
|
}
|
|
1481
1476
|
}
|
|
1482
1477
|
|
|
1478
|
+
const COMPONENT_CLASS_NAME$2 = 'container';
|
|
1483
1479
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
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
|
-
|
|
1524
|
-
|
|
1525
|
-
}
|
|
1526
|
-
};
|
|
1480
|
+
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {
|
|
1481
|
+
const step = stepContext.step;
|
|
1482
|
+
const name = viewContext.getStepName();
|
|
1483
|
+
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, name, 'primary');
|
|
1484
|
+
const sequenceComponent = viewContext.createSequenceComponent(g, step.sequence);
|
|
1485
|
+
const halfOfWidestElement = labelView.width / 2;
|
|
1486
|
+
const offsetLeft = Math.max(halfOfWidestElement - sequenceComponent.view.joinX, 0) + cfg.paddingX;
|
|
1487
|
+
const offsetRight = Math.max(halfOfWidestElement - (sequenceComponent.view.width - sequenceComponent.view.joinX), 0) + cfg.paddingX;
|
|
1488
|
+
const width = offsetLeft + sequenceComponent.view.width + offsetRight;
|
|
1489
|
+
const height = cfg.paddingTop + cfg.label.height + sequenceComponent.view.height;
|
|
1490
|
+
const joinX = sequenceComponent.view.joinX + offsetLeft;
|
|
1491
|
+
Dom.translate(labelView.g, joinX, 0);
|
|
1492
|
+
Dom.translate(sequenceComponent.view.g, offsetLeft, cfg.paddingTop + cfg.label.height);
|
|
1493
|
+
const iconUrl = viewContext.getStepIconUrl();
|
|
1494
|
+
const inputView = InputView.createRectInput(g, joinX, 0, cfg.inputSize, cfg.inputIconSize, iconUrl);
|
|
1495
|
+
JoinView.createStraightJoin(g, new Vector(joinX, 0), cfg.paddingTop);
|
|
1496
|
+
const regionView = regionViewBuilder(g, [width], height);
|
|
1497
|
+
return {
|
|
1498
|
+
g,
|
|
1499
|
+
width,
|
|
1500
|
+
height,
|
|
1501
|
+
joinX,
|
|
1502
|
+
placeholders: null,
|
|
1503
|
+
sequenceComponents: [sequenceComponent],
|
|
1504
|
+
hasOutput: sequenceComponent.hasOutput,
|
|
1505
|
+
getClientPosition() {
|
|
1506
|
+
return regionView.getClientPosition();
|
|
1507
|
+
},
|
|
1508
|
+
resolveClick(click) {
|
|
1509
|
+
const result = regionView.resolveClick(click);
|
|
1510
|
+
return result === true || (result === null && g.contains(click.element)) ? true : result;
|
|
1511
|
+
},
|
|
1512
|
+
setIsDragging(isDragging) {
|
|
1513
|
+
inputView.setIsHidden(isDragging);
|
|
1514
|
+
},
|
|
1515
|
+
setIsSelected(isSelected) {
|
|
1516
|
+
regionView.setIsSelected(isSelected);
|
|
1517
|
+
},
|
|
1518
|
+
setIsDisabled(isDisabled) {
|
|
1519
|
+
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
});
|
|
1527
1523
|
};
|
|
1528
1524
|
|
|
1525
|
+
const COMPONENT_CLASS_NAME$1 = 'switch';
|
|
1529
1526
|
const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
const
|
|
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
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1527
|
+
return viewContext.createRegionComponentView(parent, COMPONENT_CLASS_NAME$1, (g, regionViewBuilder) => {
|
|
1528
|
+
const step = stepContext.step;
|
|
1529
|
+
const branchNames = Object.keys(step.branches);
|
|
1530
|
+
const branchComponents = branchNames.map(branchName => {
|
|
1531
|
+
return viewContext.createSequenceComponent(g, step.branches[branchName]);
|
|
1532
|
+
});
|
|
1533
|
+
const branchLabelViews = branchNames.map(branchName => {
|
|
1534
|
+
const labelY = cfg.paddingTop + cfg.nameLabel.height + cfg.connectionHeight;
|
|
1535
|
+
const translatedBranchName = viewContext.i18n(`stepComponent.${step.type}.branchName`, branchName);
|
|
1536
|
+
return LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');
|
|
1537
|
+
});
|
|
1538
|
+
const name = viewContext.getStepName();
|
|
1539
|
+
const nameLabelView = LabelView.create(g, cfg.paddingTop, cfg.nameLabel, name, 'primary');
|
|
1540
|
+
let prevOffsetX = 0;
|
|
1541
|
+
const branchSizes = branchComponents.map((component, i) => {
|
|
1542
|
+
const halfOfWidestBranchElement = Math.max(branchLabelViews[i].width, cfg.minContainerWidth) / 2;
|
|
1543
|
+
const branchOffsetLeft = Math.max(halfOfWidestBranchElement - component.view.joinX, 0) + cfg.paddingX;
|
|
1544
|
+
const branchOffsetRight = Math.max(halfOfWidestBranchElement - (component.view.width - component.view.joinX), 0) + cfg.paddingX;
|
|
1545
|
+
const width = component.view.width + branchOffsetLeft + branchOffsetRight;
|
|
1546
|
+
const joinX = component.view.joinX + branchOffsetLeft;
|
|
1547
|
+
const offsetX = prevOffsetX;
|
|
1548
|
+
prevOffsetX += width;
|
|
1549
|
+
return { width, branchOffsetLeft, offsetX, joinX };
|
|
1550
|
+
});
|
|
1551
|
+
const centerBranchIndex = Math.floor(branchNames.length / 2);
|
|
1552
|
+
const centerBranchSize = branchSizes[centerBranchIndex];
|
|
1553
|
+
let joinX = centerBranchSize.offsetX;
|
|
1554
|
+
if (branchNames.length % 2 !== 0) {
|
|
1555
|
+
joinX += centerBranchSize.joinX;
|
|
1556
|
+
}
|
|
1557
|
+
const totalBranchesWidth = branchSizes.reduce((result, s) => result + s.width, 0);
|
|
1558
|
+
const maxBranchesHeight = Math.max(...branchComponents.map(s => s.view.height));
|
|
1559
|
+
const halfOfWidestSwitchElement = nameLabelView.width / 2 + cfg.paddingX;
|
|
1560
|
+
const switchOffsetLeft = Math.max(halfOfWidestSwitchElement - joinX, 0);
|
|
1561
|
+
const switchOffsetRight = Math.max(halfOfWidestSwitchElement - (totalBranchesWidth - joinX), 0);
|
|
1562
|
+
const viewWidth = switchOffsetLeft + totalBranchesWidth + switchOffsetRight;
|
|
1563
|
+
const viewHeight = maxBranchesHeight + cfg.paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight * 2;
|
|
1564
|
+
const shiftedJoinX = switchOffsetLeft + joinX;
|
|
1565
|
+
Dom.translate(nameLabelView.g, shiftedJoinX, 0);
|
|
1566
|
+
const branchOffsetTop = cfg.paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight;
|
|
1567
|
+
branchComponents.forEach((component, i) => {
|
|
1568
|
+
const branchSize = branchSizes[i];
|
|
1569
|
+
const branchOffsetLeft = switchOffsetLeft + branchSize.offsetX + branchSize.branchOffsetLeft;
|
|
1570
|
+
Dom.translate(branchLabelViews[i].g, switchOffsetLeft + branchSize.offsetX + branchSize.joinX, 0);
|
|
1571
|
+
Dom.translate(component.view.g, branchOffsetLeft, branchOffsetTop);
|
|
1572
|
+
if (component.hasOutput && stepContext.isOutputConnected) {
|
|
1573
|
+
const endOffsetTopOfComponent = cfg.paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight + component.view.height;
|
|
1574
|
+
const missingHeight = viewHeight - endOffsetTopOfComponent - cfg.connectionHeight;
|
|
1575
|
+
if (missingHeight > 0) {
|
|
1576
|
+
JoinView.createStraightJoin(g, new Vector(switchOffsetLeft + branchSize.offsetX + branchSize.joinX, endOffsetTopOfComponent), missingHeight);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
});
|
|
1580
|
+
let inputView = null;
|
|
1581
|
+
if (cfg.inputSize > 0) {
|
|
1582
|
+
const iconUrl = viewContext.getStepIconUrl();
|
|
1583
|
+
inputView = InputView.createRectInput(g, shiftedJoinX, 0, cfg.inputSize, cfg.inputIconSize, iconUrl);
|
|
1584
|
+
}
|
|
1585
|
+
JoinView.createStraightJoin(g, new Vector(shiftedJoinX, 0), cfg.paddingTop);
|
|
1586
|
+
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)));
|
|
1587
|
+
if (stepContext.isOutputConnected) {
|
|
1588
|
+
const ongoingSequenceIndexes = branchComponents
|
|
1589
|
+
.map((component, index) => (component.hasOutput ? index : null))
|
|
1590
|
+
.filter(index => index !== null);
|
|
1591
|
+
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));
|
|
1592
|
+
if (ongoingJoinTargets.length > 0) {
|
|
1593
|
+
JoinView.createJoins(g, new Vector(shiftedJoinX, viewHeight), ongoingJoinTargets);
|
|
1579
1594
|
}
|
|
1580
1595
|
}
|
|
1596
|
+
const regions = branchSizes.map(s => s.width);
|
|
1597
|
+
regions[0] += switchOffsetLeft;
|
|
1598
|
+
regions[regions.length - 1] += switchOffsetRight;
|
|
1599
|
+
const regionView = regionViewBuilder(g, regions, viewHeight);
|
|
1600
|
+
return {
|
|
1601
|
+
g,
|
|
1602
|
+
width: viewWidth,
|
|
1603
|
+
height: viewHeight,
|
|
1604
|
+
joinX: shiftedJoinX,
|
|
1605
|
+
placeholders: null,
|
|
1606
|
+
sequenceComponents: branchComponents,
|
|
1607
|
+
hasOutput: branchComponents.some(c => c.hasOutput),
|
|
1608
|
+
getClientPosition() {
|
|
1609
|
+
return regionView.getClientPosition();
|
|
1610
|
+
},
|
|
1611
|
+
resolveClick(click) {
|
|
1612
|
+
const result = regionView.resolveClick(click);
|
|
1613
|
+
return result === true || (result === null && g.contains(click.element)) ? true : result;
|
|
1614
|
+
},
|
|
1615
|
+
setIsDragging(isDragging) {
|
|
1616
|
+
inputView === null || inputView === void 0 ? void 0 : inputView.setIsHidden(isDragging);
|
|
1617
|
+
},
|
|
1618
|
+
setIsSelected(isSelected) {
|
|
1619
|
+
regionView.setIsSelected(isSelected);
|
|
1620
|
+
},
|
|
1621
|
+
setIsDisabled(isDisabled) {
|
|
1622
|
+
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1581
1625
|
});
|
|
1582
|
-
let inputView = null;
|
|
1583
|
-
if (cfg.inputSize > 0) {
|
|
1584
|
-
const iconUrl = viewContext.getStepIconUrl();
|
|
1585
|
-
inputView = InputView.createRectInput(g, shiftedJoinX, 0, cfg.inputSize, cfg.inputIconSize, iconUrl);
|
|
1586
|
-
}
|
|
1587
|
-
JoinView.createStraightJoin(g, new Vector(shiftedJoinX, 0), cfg.paddingTop);
|
|
1588
|
-
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)));
|
|
1589
|
-
if (stepContext.isOutputConnected) {
|
|
1590
|
-
const ongoingSequenceIndexes = branchComponents
|
|
1591
|
-
.map((component, index) => (component.hasOutput ? index : null))
|
|
1592
|
-
.filter(index => index !== null);
|
|
1593
|
-
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));
|
|
1594
|
-
if (ongoingJoinTargets.length > 0) {
|
|
1595
|
-
JoinView.createJoins(g, new Vector(shiftedJoinX, viewHeight), ongoingJoinTargets);
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
const regions = branchSizes.map(s => s.width);
|
|
1599
|
-
regions[0] += switchOffsetLeft;
|
|
1600
|
-
regions[regions.length - 1] += switchOffsetRight;
|
|
1601
|
-
const regionView = RegionView.create(g, regions, viewHeight);
|
|
1602
|
-
return {
|
|
1603
|
-
g,
|
|
1604
|
-
width: viewWidth,
|
|
1605
|
-
height: viewHeight,
|
|
1606
|
-
joinX: shiftedJoinX,
|
|
1607
|
-
placeholders: null,
|
|
1608
|
-
sequenceComponents: branchComponents,
|
|
1609
|
-
getClientPosition() {
|
|
1610
|
-
return regionView.getClientPosition();
|
|
1611
|
-
},
|
|
1612
|
-
resolveClick(click) {
|
|
1613
|
-
return regionView.resolveClick(click) || g.contains(click.element) ? true : null;
|
|
1614
|
-
},
|
|
1615
|
-
setIsDragging(isDragging) {
|
|
1616
|
-
inputView === null || inputView === void 0 ? void 0 : inputView.setIsHidden(isDragging);
|
|
1617
|
-
},
|
|
1618
|
-
setIsSelected(isSelected) {
|
|
1619
|
-
regionView.setIsSelected(isSelected);
|
|
1620
|
-
},
|
|
1621
|
-
setIsDisabled(isDisabled) {
|
|
1622
|
-
Dom.toggleClass(g, isDisabled, 'sqd-disabled');
|
|
1623
|
-
},
|
|
1624
|
-
hasOutput() {
|
|
1625
|
-
return branchComponents.some(c => c.hasOutput);
|
|
1626
|
-
}
|
|
1627
|
-
};
|
|
1628
1626
|
};
|
|
1629
1627
|
|
|
1628
|
+
const COMPONENT_CLASS_NAME = 'task';
|
|
1630
1629
|
const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1631
1630
|
const { step } = stepContext;
|
|
1632
|
-
const g = ComponentDom.stepG(
|
|
1631
|
+
const g = ComponentDom.stepG(COMPONENT_CLASS_NAME, step.type, step.id);
|
|
1633
1632
|
parentElement.appendChild(g);
|
|
1634
1633
|
const boxHeight = cfg.paddingY * 2 + cfg.iconSize;
|
|
1635
1634
|
const text = Dom.svg('text', {
|
|
@@ -1637,7 +1636,7 @@
|
|
|
1637
1636
|
y: boxHeight / 2,
|
|
1638
1637
|
class: 'sqd-step-task-text'
|
|
1639
1638
|
});
|
|
1640
|
-
text.textContent =
|
|
1639
|
+
text.textContent = viewContext.getStepName();
|
|
1641
1640
|
g.appendChild(text);
|
|
1642
1641
|
const textWidth = Math.max(text.getBBox().width, cfg.minTextWidth);
|
|
1643
1642
|
const boxWidth = cfg.iconSize + cfg.paddingLeft + cfg.paddingRight + cfg.textMarginLeft + textWidth;
|
|
@@ -1679,9 +1678,7 @@
|
|
|
1679
1678
|
joinX: boxWidth / 2,
|
|
1680
1679
|
sequenceComponents: null,
|
|
1681
1680
|
placeholders: null,
|
|
1682
|
-
hasOutput
|
|
1683
|
-
return !!outputView;
|
|
1684
|
-
},
|
|
1681
|
+
hasOutput: !!outputView,
|
|
1685
1682
|
getClientPosition() {
|
|
1686
1683
|
return getAbsolutePosition(rect);
|
|
1687
1684
|
},
|
|
@@ -1970,6 +1967,64 @@
|
|
|
1970
1967
|
}
|
|
1971
1968
|
}
|
|
1972
1969
|
|
|
1970
|
+
class DefaultRegionView {
|
|
1971
|
+
static create(parent, widths, height) {
|
|
1972
|
+
const totalWidth = widths.reduce((result, width) => result + width, 0);
|
|
1973
|
+
const lines = [
|
|
1974
|
+
drawLine(parent, 0, 0, totalWidth, 0),
|
|
1975
|
+
drawLine(parent, 0, 0, 0, height),
|
|
1976
|
+
drawLine(parent, 0, height, totalWidth, height),
|
|
1977
|
+
drawLine(parent, totalWidth, 0, totalWidth, height)
|
|
1978
|
+
];
|
|
1979
|
+
let offsetX = widths[0];
|
|
1980
|
+
for (let i = 1; i < widths.length; i++) {
|
|
1981
|
+
lines.push(drawLine(parent, offsetX, 0, offsetX, height));
|
|
1982
|
+
offsetX += widths[i];
|
|
1983
|
+
}
|
|
1984
|
+
return new DefaultRegionView(lines, totalWidth, height);
|
|
1985
|
+
}
|
|
1986
|
+
constructor(lines, width, height) {
|
|
1987
|
+
this.lines = lines;
|
|
1988
|
+
this.width = width;
|
|
1989
|
+
this.height = height;
|
|
1990
|
+
}
|
|
1991
|
+
getClientPosition() {
|
|
1992
|
+
return getAbsolutePosition(this.lines[0]);
|
|
1993
|
+
}
|
|
1994
|
+
resolveClick(click) {
|
|
1995
|
+
const regionPosition = this.getClientPosition();
|
|
1996
|
+
const d = click.position.subtract(regionPosition);
|
|
1997
|
+
if (d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale) {
|
|
1998
|
+
return true;
|
|
1999
|
+
}
|
|
2000
|
+
return null;
|
|
2001
|
+
}
|
|
2002
|
+
setIsSelected(isSelected) {
|
|
2003
|
+
this.lines.forEach(region => {
|
|
2004
|
+
Dom.toggleClass(region, isSelected, 'sqd-selected');
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
function drawLine(parent, x1, y1, x2, y2) {
|
|
2009
|
+
const line = Dom.svg('line', {
|
|
2010
|
+
class: 'sqd-region',
|
|
2011
|
+
x1,
|
|
2012
|
+
y1,
|
|
2013
|
+
x2,
|
|
2014
|
+
y2
|
|
2015
|
+
});
|
|
2016
|
+
parent.insertBefore(line, parent.firstChild);
|
|
2017
|
+
return line;
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
class DefaultRegionComponentViewExtension {
|
|
2021
|
+
create(parentElement, componentClassName, stepContext, _, contentFactory) {
|
|
2022
|
+
const g = ComponentDom.stepG(componentClassName, stepContext.step.type, stepContext.step.id);
|
|
2023
|
+
parentElement.appendChild(g);
|
|
2024
|
+
return contentFactory(g, DefaultRegionView.create);
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
|
|
1973
2028
|
const defaultResolvers = [sequentialResolver, branchedResolver];
|
|
1974
2029
|
function branchedResolver(step) {
|
|
1975
2030
|
const branches = step.branches;
|
|
@@ -2654,9 +2709,22 @@
|
|
|
2654
2709
|
}
|
|
2655
2710
|
}
|
|
2656
2711
|
|
|
2712
|
+
class MemoryPreferenceStorage {
|
|
2713
|
+
constructor() {
|
|
2714
|
+
this.map = {};
|
|
2715
|
+
}
|
|
2716
|
+
setItem(key, value) {
|
|
2717
|
+
this.map[key] = value;
|
|
2718
|
+
}
|
|
2719
|
+
getItem(key) {
|
|
2720
|
+
var _a;
|
|
2721
|
+
return (_a = this.map[key]) !== null && _a !== void 0 ? _a : null;
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2657
2725
|
class DesignerContext {
|
|
2658
2726
|
static create(parent, startDefinition, configuration, services) {
|
|
2659
|
-
var _a, _b, _c;
|
|
2727
|
+
var _a, _b, _c, _d, _e;
|
|
2660
2728
|
const definition = ObjectCloner.deepClone(startDefinition);
|
|
2661
2729
|
const layoutController = new LayoutController(parent);
|
|
2662
2730
|
const isReadonly = !!configuration.isReadonly;
|
|
@@ -2668,22 +2736,25 @@
|
|
|
2668
2736
|
const behaviorController = new BehaviorController();
|
|
2669
2737
|
const stepExtensionResolver = StepExtensionResolver.create(services);
|
|
2670
2738
|
const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new DefinitionWalker();
|
|
2739
|
+
const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
|
|
2671
2740
|
const stateModifier = StateModifier.create(definitionWalker, state, configuration);
|
|
2672
2741
|
const customActionController = new CustomActionController(configuration, state, stateModifier);
|
|
2673
2742
|
let historyController = undefined;
|
|
2674
2743
|
if (configuration.undoStackSize) {
|
|
2675
2744
|
historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
|
|
2676
2745
|
}
|
|
2677
|
-
const
|
|
2678
|
-
|
|
2746
|
+
const preferenceStorage = (_e = configuration.preferenceStorage) !== null && _e !== void 0 ? _e : new MemoryPreferenceStorage();
|
|
2747
|
+
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, i18n, services);
|
|
2748
|
+
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController);
|
|
2679
2749
|
}
|
|
2680
|
-
constructor(theme, state, configuration, services, componentContext, definitionWalker, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController) {
|
|
2750
|
+
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController) {
|
|
2681
2751
|
this.theme = theme;
|
|
2682
2752
|
this.state = state;
|
|
2683
2753
|
this.configuration = configuration;
|
|
2684
2754
|
this.services = services;
|
|
2685
2755
|
this.componentContext = componentContext;
|
|
2686
2756
|
this.definitionWalker = definitionWalker;
|
|
2757
|
+
this.i18n = i18n;
|
|
2687
2758
|
this.stateModifier = stateModifier;
|
|
2688
2759
|
this.layoutController = layoutController;
|
|
2689
2760
|
this.workspaceController = workspaceController;
|
|
@@ -3096,8 +3167,9 @@
|
|
|
3096
3167
|
}
|
|
3097
3168
|
|
|
3098
3169
|
class ContextMenuItemsBuilder {
|
|
3099
|
-
constructor(viewportApi, stateModifier, state, customMenuItemsProvider) {
|
|
3170
|
+
constructor(viewportApi, i18n, stateModifier, state, customMenuItemsProvider) {
|
|
3100
3171
|
this.viewportApi = viewportApi;
|
|
3172
|
+
this.i18n = i18n;
|
|
3101
3173
|
this.stateModifier = stateModifier;
|
|
3102
3174
|
this.state = state;
|
|
3103
3175
|
this.customMenuItemsProvider = customMenuItemsProvider;
|
|
@@ -3108,15 +3180,16 @@
|
|
|
3108
3180
|
const ssc = commandOrNull;
|
|
3109
3181
|
const step = ssc.component.step;
|
|
3110
3182
|
const parentSequence = ssc.component.parentSequence;
|
|
3183
|
+
const name = this.i18n(`step.${step.type}.name`, step.name);
|
|
3111
3184
|
items.push({
|
|
3112
|
-
label:
|
|
3185
|
+
label: name,
|
|
3113
3186
|
order: 0
|
|
3114
3187
|
});
|
|
3115
3188
|
this.tryAppendCustomItems(items, step, parentSequence);
|
|
3116
3189
|
if (this.stateModifier.isSelectable(step, parentSequence)) {
|
|
3117
3190
|
if (this.state.selectedStepId === step.id) {
|
|
3118
3191
|
items.push({
|
|
3119
|
-
label:
|
|
3192
|
+
label: this.i18n('contextMenu.unselect', 'Unselect'),
|
|
3120
3193
|
order: 10,
|
|
3121
3194
|
callback: () => {
|
|
3122
3195
|
this.state.setSelectedStepId(null);
|
|
@@ -3125,7 +3198,7 @@
|
|
|
3125
3198
|
}
|
|
3126
3199
|
else {
|
|
3127
3200
|
items.push({
|
|
3128
|
-
label: 'Select',
|
|
3201
|
+
label: this.i18n('contextMenu.select', 'Select'),
|
|
3129
3202
|
order: 20,
|
|
3130
3203
|
callback: () => {
|
|
3131
3204
|
this.stateModifier.trySelectStepById(step.id);
|
|
@@ -3136,7 +3209,7 @@
|
|
|
3136
3209
|
if (!this.state.isReadonly) {
|
|
3137
3210
|
if (this.stateModifier.isDeletable(step.id)) {
|
|
3138
3211
|
items.push({
|
|
3139
|
-
label: 'Delete',
|
|
3212
|
+
label: this.i18n('contextMenu.delete', 'Delete'),
|
|
3140
3213
|
order: 30,
|
|
3141
3214
|
callback: () => {
|
|
3142
3215
|
this.stateModifier.tryDelete(step.id);
|
|
@@ -3145,7 +3218,7 @@
|
|
|
3145
3218
|
}
|
|
3146
3219
|
if (this.stateModifier.isDuplicable(step, parentSequence)) {
|
|
3147
3220
|
items.push({
|
|
3148
|
-
label: 'Duplicate',
|
|
3221
|
+
label: this.i18n('contextMenu.duplicate', 'Duplicate'),
|
|
3149
3222
|
order: 40,
|
|
3150
3223
|
callback: () => {
|
|
3151
3224
|
this.stateModifier.tryDuplicate(step, parentSequence);
|
|
@@ -3158,7 +3231,7 @@
|
|
|
3158
3231
|
this.tryAppendCustomItems(items, null, this.state.definition.sequence);
|
|
3159
3232
|
}
|
|
3160
3233
|
items.push({
|
|
3161
|
-
label: 'Reset view',
|
|
3234
|
+
label: this.i18n('contextMenu.resetView', 'Reset view'),
|
|
3162
3235
|
order: 50,
|
|
3163
3236
|
callback: () => {
|
|
3164
3237
|
this.viewportApi.resetViewport();
|
|
@@ -3183,7 +3256,7 @@
|
|
|
3183
3256
|
const view = WorkspaceView.create(parent, designerContext.componentContext);
|
|
3184
3257
|
const clickBehaviorResolver = new ClickBehaviorResolver(designerContext);
|
|
3185
3258
|
const wheelController = designerContext.services.wheelController.create(api.workspace);
|
|
3186
|
-
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
3259
|
+
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
3187
3260
|
? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
|
|
3188
3261
|
: undefined);
|
|
3189
3262
|
const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
|
|
@@ -3430,28 +3503,28 @@
|
|
|
3430
3503
|
}
|
|
3431
3504
|
|
|
3432
3505
|
class ControlBarView {
|
|
3433
|
-
static create(parent, isUndoRedoSupported) {
|
|
3506
|
+
static create(parent, isUndoRedoSupported, i18n) {
|
|
3434
3507
|
const root = Dom.element('div', {
|
|
3435
3508
|
class: 'sqd-control-bar'
|
|
3436
3509
|
});
|
|
3437
|
-
const resetButton = createButton(Icons.center, 'Reset view');
|
|
3510
|
+
const resetButton = createButton(Icons.center, i18n('controlBar.resetView', 'Reset view'));
|
|
3438
3511
|
root.appendChild(resetButton);
|
|
3439
|
-
const zoomInButton = createButton(Icons.zoomIn, 'Zoom in');
|
|
3512
|
+
const zoomInButton = createButton(Icons.zoomIn, i18n('controlBar.zoomIn', 'Zoom in'));
|
|
3440
3513
|
root.appendChild(zoomInButton);
|
|
3441
|
-
const zoomOutButton = createButton(Icons.zoomOut, 'Zoom out');
|
|
3514
|
+
const zoomOutButton = createButton(Icons.zoomOut, i18n('controlBar.zoomOut', 'Zoom out'));
|
|
3442
3515
|
root.appendChild(zoomOutButton);
|
|
3443
3516
|
let undoButton = null;
|
|
3444
3517
|
let redoButton = null;
|
|
3445
3518
|
if (isUndoRedoSupported) {
|
|
3446
|
-
undoButton = createButton(Icons.undo, 'Undo');
|
|
3519
|
+
undoButton = createButton(Icons.undo, i18n('controlBar.undo', 'Undo'));
|
|
3447
3520
|
root.appendChild(undoButton);
|
|
3448
|
-
redoButton = createButton(Icons.redo, 'Redo');
|
|
3521
|
+
redoButton = createButton(Icons.redo, i18n('controlBar.redo', 'Redo'));
|
|
3449
3522
|
root.appendChild(redoButton);
|
|
3450
3523
|
}
|
|
3451
|
-
const disableDragButton = createButton(Icons.move, 'Turn on/off drag and drop');
|
|
3524
|
+
const disableDragButton = createButton(Icons.move, i18n('controlBar.turnOnOffDragAndDrop', 'Turn on/off drag and drop'));
|
|
3452
3525
|
disableDragButton.classList.add('sqd-disabled');
|
|
3453
3526
|
root.appendChild(disableDragButton);
|
|
3454
|
-
const deleteButton = createButton(Icons.delete, 'Delete selected step');
|
|
3527
|
+
const deleteButton = createButton(Icons.delete, i18n('controlBar.deleteSelectedStep', 'Delete selected step'));
|
|
3455
3528
|
deleteButton.classList.add('sqd-delete');
|
|
3456
3529
|
deleteButton.classList.add('sqd-hidden');
|
|
3457
3530
|
root.appendChild(deleteButton);
|
|
@@ -3532,7 +3605,7 @@
|
|
|
3532
3605
|
class ControlBar {
|
|
3533
3606
|
static create(parent, api) {
|
|
3534
3607
|
const isUndoRedoSupported = api.controlBar.isUndoRedoSupported();
|
|
3535
|
-
const view = ControlBarView.create(parent, isUndoRedoSupported);
|
|
3608
|
+
const view = ControlBarView.create(parent, isUndoRedoSupported, api.i18n);
|
|
3536
3609
|
const bar = new ControlBar(view, api.controlBar, isUndoRedoSupported);
|
|
3537
3610
|
view.bindResetButtonClick(() => bar.onResetButtonClicked());
|
|
3538
3611
|
view.bindZoomInButtonClick(() => bar.onZoomInButtonClicked());
|
|
@@ -3662,19 +3735,16 @@
|
|
|
3662
3735
|
}
|
|
3663
3736
|
|
|
3664
3737
|
class SmartEditorView {
|
|
3665
|
-
static create(parent, api, configuration) {
|
|
3738
|
+
static create(parent, api, i18n, configuration) {
|
|
3666
3739
|
const root = Dom.element('div', {
|
|
3667
3740
|
class: 'sqd-smart-editor'
|
|
3668
3741
|
});
|
|
3669
3742
|
const toggle = Dom.element('div', {
|
|
3670
3743
|
class: 'sqd-smart-editor-toggle',
|
|
3671
|
-
title: 'Toggle editor'
|
|
3744
|
+
title: i18n('smartEditor.toggle', 'Toggle editor')
|
|
3672
3745
|
});
|
|
3673
3746
|
parent.appendChild(toggle);
|
|
3674
3747
|
parent.appendChild(root);
|
|
3675
|
-
if (configuration.globalEditorProvider) {
|
|
3676
|
-
throw new Error('globalEditorProvider is renamed to rootEditorProvider');
|
|
3677
|
-
}
|
|
3678
3748
|
const editor = Editor.create(root, api, 'sqd-editor sqd-step-editor', configuration.stepEditorProvider, 'sqd-editor sqd-root-editor', configuration.rootEditorProvider, null);
|
|
3679
3749
|
return new SmartEditorView(root, toggle, editor);
|
|
3680
3750
|
}
|
|
@@ -3705,7 +3775,7 @@
|
|
|
3705
3775
|
|
|
3706
3776
|
class SmartEditor {
|
|
3707
3777
|
static create(parent, api, configuration) {
|
|
3708
|
-
const view = SmartEditorView.create(parent, api.editor, configuration);
|
|
3778
|
+
const view = SmartEditorView.create(parent, api.editor, api.i18n, configuration);
|
|
3709
3779
|
const editor = new SmartEditor(view, api.editor, api.workspace);
|
|
3710
3780
|
editor.updateVisibility();
|
|
3711
3781
|
view.bindToggleClick(() => editor.onToggleClicked());
|
|
@@ -3948,7 +4018,7 @@
|
|
|
3948
4018
|
}
|
|
3949
4019
|
|
|
3950
4020
|
class ToolboxView {
|
|
3951
|
-
static create(parent, api) {
|
|
4021
|
+
static create(parent, api, i18n) {
|
|
3952
4022
|
const root = Dom.element('div', {
|
|
3953
4023
|
class: 'sqd-toolbox'
|
|
3954
4024
|
});
|
|
@@ -3958,14 +4028,14 @@
|
|
|
3958
4028
|
const headerTitle = Dom.element('div', {
|
|
3959
4029
|
class: 'sqd-toolbox-header-title'
|
|
3960
4030
|
});
|
|
3961
|
-
headerTitle.innerText = 'Toolbox';
|
|
4031
|
+
headerTitle.innerText = i18n('toolbox.title', 'Toolbox');
|
|
3962
4032
|
const body = Dom.element('div', {
|
|
3963
4033
|
class: 'sqd-toolbox-body'
|
|
3964
4034
|
});
|
|
3965
4035
|
const filterInput = Dom.element('input', {
|
|
3966
4036
|
class: 'sqd-toolbox-filter',
|
|
3967
4037
|
type: 'text',
|
|
3968
|
-
placeholder: 'Search...'
|
|
4038
|
+
placeholder: i18n('toolbox.search', 'Search...')
|
|
3969
4039
|
});
|
|
3970
4040
|
root.appendChild(header);
|
|
3971
4041
|
root.appendChild(body);
|
|
@@ -4025,9 +4095,9 @@
|
|
|
4025
4095
|
}
|
|
4026
4096
|
|
|
4027
4097
|
class Toolbox {
|
|
4028
|
-
static create(root, api) {
|
|
4098
|
+
static create(root, api, i18n) {
|
|
4029
4099
|
const allGroups = api.getAllGroups();
|
|
4030
|
-
const view = ToolboxView.create(root, api);
|
|
4100
|
+
const view = ToolboxView.create(root, api, i18n);
|
|
4031
4101
|
const toolbox = new Toolbox(view, api, allGroups);
|
|
4032
4102
|
toolbox.render();
|
|
4033
4103
|
toolbox.onIsCollapsedChanged();
|
|
@@ -4062,7 +4132,7 @@
|
|
|
4062
4132
|
|
|
4063
4133
|
class ToolboxExtension {
|
|
4064
4134
|
create(root, api) {
|
|
4065
|
-
return Toolbox.create(root, api.toolbox);
|
|
4135
|
+
return Toolbox.create(root, api.toolbox, api.i18n);
|
|
4066
4136
|
}
|
|
4067
4137
|
}
|
|
4068
4138
|
|
|
@@ -4100,7 +4170,7 @@
|
|
|
4100
4170
|
}
|
|
4101
4171
|
|
|
4102
4172
|
const defaultConfiguration$3 = {
|
|
4103
|
-
gapWidth:
|
|
4173
|
+
gapWidth: 88,
|
|
4104
4174
|
gapHeight: 24,
|
|
4105
4175
|
radius: 6,
|
|
4106
4176
|
iconSize: 16
|
|
@@ -4369,6 +4439,9 @@
|
|
|
4369
4439
|
if (ext.placeholder) {
|
|
4370
4440
|
services.placeholder = ext.placeholder;
|
|
4371
4441
|
}
|
|
4442
|
+
if (ext.regionComponentView) {
|
|
4443
|
+
services.regionComponentView = ext.regionComponentView;
|
|
4444
|
+
}
|
|
4372
4445
|
if (ext.viewportController) {
|
|
4373
4446
|
services.viewportController = ext.viewportController;
|
|
4374
4447
|
}
|
|
@@ -4429,6 +4502,9 @@
|
|
|
4429
4502
|
if (!services.placeholder) {
|
|
4430
4503
|
services.placeholder = RectPlaceholderExtension.create();
|
|
4431
4504
|
}
|
|
4505
|
+
if (!services.regionComponentView) {
|
|
4506
|
+
services.regionComponentView = new DefaultRegionComponentViewExtension();
|
|
4507
|
+
}
|
|
4432
4508
|
if (!services.viewportController) {
|
|
4433
4509
|
services.viewportController = new DefaultViewportControllerExtension();
|
|
4434
4510
|
}
|
|
@@ -4714,6 +4790,8 @@
|
|
|
4714
4790
|
exports.ComponentDom = ComponentDom;
|
|
4715
4791
|
exports.ControlBarApi = ControlBarApi;
|
|
4716
4792
|
exports.CustomActionController = CustomActionController;
|
|
4793
|
+
exports.DefaultRegionComponentViewExtension = DefaultRegionComponentViewExtension;
|
|
4794
|
+
exports.DefaultRegionView = DefaultRegionView;
|
|
4717
4795
|
exports.DefaultSequenceComponent = DefaultSequenceComponent;
|
|
4718
4796
|
exports.DefaultSequenceComponentView = DefaultSequenceComponentView;
|
|
4719
4797
|
exports.DefaultViewportController = DefaultViewportController;
|
|
@@ -4737,7 +4815,6 @@
|
|
|
4737
4815
|
exports.QuantifiedScaleViewportCalculator = QuantifiedScaleViewportCalculator;
|
|
4738
4816
|
exports.RectPlaceholder = RectPlaceholder;
|
|
4739
4817
|
exports.RectPlaceholderView = RectPlaceholderView;
|
|
4740
|
-
exports.RegionView = RegionView;
|
|
4741
4818
|
exports.ServicesResolver = ServicesResolver;
|
|
4742
4819
|
exports.SimpleEvent = SimpleEvent;
|
|
4743
4820
|
exports.StepComponent = StepComponent;
|