sequential-workflow-designer 0.19.3 → 0.20.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 +106 -92
- package/lib/cjs/index.cjs +106 -92
- package/lib/esm/index.js +106 -93
- package/lib/index.d.ts +28 -13
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -600,13 +600,15 @@ class StepTypeValidator {
|
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
class ToolboxDataProvider {
|
|
603
|
-
constructor(iconProvider, configuration) {
|
|
603
|
+
constructor(iconProvider, i18n, configuration) {
|
|
604
604
|
this.iconProvider = iconProvider;
|
|
605
|
+
this.i18n = i18n;
|
|
605
606
|
this.configuration = configuration;
|
|
606
607
|
this.createItemData = (step) => {
|
|
607
608
|
StepTypeValidator.validate(step.type);
|
|
608
609
|
const iconUrl = this.iconProvider.getIconUrl(step);
|
|
609
|
-
const
|
|
610
|
+
const rawLabel = this.configuration && this.configuration.labelProvider ? this.configuration.labelProvider(step) : step.name;
|
|
611
|
+
const label = this.i18n(`toolbox.item.${step.type}.label`, rawLabel);
|
|
610
612
|
const description = this.configuration && this.configuration.descriptionProvider ? this.configuration.descriptionProvider(step) : label;
|
|
611
613
|
const lowerCaseLabel = label.toLowerCase();
|
|
612
614
|
return {
|
|
@@ -704,10 +706,10 @@ class DesignerApi {
|
|
|
704
706
|
const workspace = new WorkspaceApi(context.state, context.workspaceController);
|
|
705
707
|
const viewportController = context.services.viewportController.create(workspace);
|
|
706
708
|
const viewport = new ViewportApi(context.workspaceController, viewportController);
|
|
707
|
-
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.configuration.toolbox);
|
|
708
|
-
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);
|
|
709
|
+
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, 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, context.i18n);
|
|
709
711
|
}
|
|
710
|
-
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker) {
|
|
712
|
+
constructor(controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
711
713
|
this.controlBar = controlBar;
|
|
712
714
|
this.toolbox = toolbox;
|
|
713
715
|
this.editor = editor;
|
|
@@ -715,6 +717,7 @@ class DesignerApi {
|
|
|
715
717
|
this.viewport = viewport;
|
|
716
718
|
this.pathBar = pathBar;
|
|
717
719
|
this.definitionWalker = definitionWalker;
|
|
720
|
+
this.i18n = i18n;
|
|
718
721
|
}
|
|
719
722
|
}
|
|
720
723
|
|
|
@@ -917,6 +920,7 @@ class StepComponentViewContextFactory {
|
|
|
917
920
|
static create(stepContext, componentContext) {
|
|
918
921
|
return {
|
|
919
922
|
getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),
|
|
923
|
+
getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),
|
|
920
924
|
createSequenceComponent: (parentElement, sequence) => {
|
|
921
925
|
const sequenceContext = {
|
|
922
926
|
sequence,
|
|
@@ -926,7 +930,8 @@ class StepComponentViewContextFactory {
|
|
|
926
930
|
};
|
|
927
931
|
return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);
|
|
928
932
|
},
|
|
929
|
-
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder)
|
|
933
|
+
createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),
|
|
934
|
+
i18n: componentContext.i18n
|
|
930
935
|
};
|
|
931
936
|
}
|
|
932
937
|
}
|
|
@@ -945,18 +950,19 @@ class StepComponentFactory {
|
|
|
945
950
|
}
|
|
946
951
|
|
|
947
952
|
class ComponentContext {
|
|
948
|
-
static create(stepsConfiguration, validatorConfiguration, state, stepExtensionResolver, services) {
|
|
953
|
+
static create(stepsConfiguration, validatorConfiguration, state, stepExtensionResolver, i18n, services) {
|
|
949
954
|
const validator = new DefinitionValidator(validatorConfiguration, state);
|
|
950
955
|
const iconProvider = new IconProvider(stepsConfiguration);
|
|
951
956
|
const placeholderController = services.placeholderController.create();
|
|
952
957
|
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
953
|
-
return new ComponentContext(validator, iconProvider, placeholderController, stepComponentFactory, services);
|
|
958
|
+
return new ComponentContext(validator, iconProvider, placeholderController, stepComponentFactory, i18n, services);
|
|
954
959
|
}
|
|
955
|
-
constructor(validator, iconProvider, placeholderController, stepComponentFactory, services) {
|
|
960
|
+
constructor(validator, iconProvider, placeholderController, stepComponentFactory, i18n, services) {
|
|
956
961
|
this.validator = validator;
|
|
957
962
|
this.iconProvider = iconProvider;
|
|
958
963
|
this.placeholderController = placeholderController;
|
|
959
964
|
this.stepComponentFactory = stepComponentFactory;
|
|
965
|
+
this.i18n = i18n;
|
|
960
966
|
this.services = services;
|
|
961
967
|
}
|
|
962
968
|
}
|
|
@@ -1138,6 +1144,15 @@ class ValidationErrorBadgeExtension {
|
|
|
1138
1144
|
}
|
|
1139
1145
|
}
|
|
1140
1146
|
|
|
1147
|
+
class ComponentDom {
|
|
1148
|
+
static stepG(componentClassName, type, id) {
|
|
1149
|
+
return Dom.svg('g', {
|
|
1150
|
+
class: `sqd-step-${componentClassName} sqd-type-${type}`,
|
|
1151
|
+
'data-step-id': id
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1141
1156
|
class InputView {
|
|
1142
1157
|
static createRectInput(parent, x, y, size, iconSize, iconUrl) {
|
|
1143
1158
|
const g = Dom.svg('g');
|
|
@@ -1343,43 +1358,6 @@ function drawLine(parent, x1, y1, x2, y2) {
|
|
|
1343
1358
|
return line;
|
|
1344
1359
|
}
|
|
1345
1360
|
|
|
1346
|
-
class RectPlaceholderView {
|
|
1347
|
-
static create(parent, width, height, radius, iconSize, direction) {
|
|
1348
|
-
const g = Dom.svg('g', {
|
|
1349
|
-
visibility: 'hidden',
|
|
1350
|
-
class: 'sqd-placeholder'
|
|
1351
|
-
});
|
|
1352
|
-
parent.appendChild(g);
|
|
1353
|
-
const rect = Dom.svg('rect', {
|
|
1354
|
-
class: 'sqd-placeholder-rect',
|
|
1355
|
-
width,
|
|
1356
|
-
height,
|
|
1357
|
-
rx: radius,
|
|
1358
|
-
ry: radius
|
|
1359
|
-
});
|
|
1360
|
-
g.appendChild(rect);
|
|
1361
|
-
if (direction) {
|
|
1362
|
-
const iconD = direction === exports.PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;
|
|
1363
|
-
const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);
|
|
1364
|
-
Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);
|
|
1365
|
-
}
|
|
1366
|
-
parent.appendChild(g);
|
|
1367
|
-
return new RectPlaceholderView(rect, g);
|
|
1368
|
-
}
|
|
1369
|
-
constructor(rect, g) {
|
|
1370
|
-
this.rect = rect;
|
|
1371
|
-
this.g = g;
|
|
1372
|
-
}
|
|
1373
|
-
setIsHover(isHover) {
|
|
1374
|
-
Dom.toggleClass(this.g, isHover, 'sqd-hover');
|
|
1375
|
-
}
|
|
1376
|
-
setIsVisible(isVisible) {
|
|
1377
|
-
Dom.attrs(this.g, {
|
|
1378
|
-
visibility: isVisible ? 'visible' : 'hidden'
|
|
1379
|
-
});
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
1361
|
class DefaultSequenceComponentView {
|
|
1384
1362
|
static create(parent, sequenceContext, componentContext) {
|
|
1385
1363
|
const phWidth = componentContext.services.placeholder.gapSize.x;
|
|
@@ -1508,11 +1486,10 @@ class DefaultSequenceComponent {
|
|
|
1508
1486
|
|
|
1509
1487
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1510
1488
|
const { step } = stepContext;
|
|
1511
|
-
const g =
|
|
1512
|
-
class: `sqd-step-container sqd-type-${step.type}`
|
|
1513
|
-
});
|
|
1489
|
+
const g = ComponentDom.stepG('container', step.type, step.id);
|
|
1514
1490
|
parentElement.appendChild(g);
|
|
1515
|
-
const
|
|
1491
|
+
const name = viewContext.getStepName();
|
|
1492
|
+
const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, name, 'primary');
|
|
1516
1493
|
const sequenceComponent = viewContext.createSequenceComponent(g, step.sequence);
|
|
1517
1494
|
const halfOfWidestElement = labelView.width / 2;
|
|
1518
1495
|
const offsetLeft = Math.max(halfOfWidestElement - sequenceComponent.view.joinX, 0) + cfg.paddingX;
|
|
@@ -1556,9 +1533,7 @@ const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepCon
|
|
|
1556
1533
|
|
|
1557
1534
|
const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {
|
|
1558
1535
|
const { step } = stepContext;
|
|
1559
|
-
const g =
|
|
1560
|
-
class: `sqd-step-switch sqd-type-${step.type}`
|
|
1561
|
-
});
|
|
1536
|
+
const g = ComponentDom.stepG('switch', step.type, step.id);
|
|
1562
1537
|
parent.appendChild(g);
|
|
1563
1538
|
const branchNames = Object.keys(step.branches);
|
|
1564
1539
|
const branchComponents = branchNames.map(branchName => {
|
|
@@ -1566,9 +1541,11 @@ const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, view
|
|
|
1566
1541
|
});
|
|
1567
1542
|
const branchLabelViews = branchNames.map(branchName => {
|
|
1568
1543
|
const labelY = cfg.paddingTop + cfg.nameLabel.height + cfg.connectionHeight;
|
|
1569
|
-
|
|
1544
|
+
const translatedBranchName = viewContext.i18n(`stepComponent.${step.type}.branchName`, branchName);
|
|
1545
|
+
return LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');
|
|
1570
1546
|
});
|
|
1571
|
-
const
|
|
1547
|
+
const name = viewContext.getStepName();
|
|
1548
|
+
const nameLabelView = LabelView.create(g, cfg.paddingTop, cfg.nameLabel, name, 'primary');
|
|
1572
1549
|
let prevOffsetX = 0;
|
|
1573
1550
|
const branchSizes = branchComponents.map((component, i) => {
|
|
1574
1551
|
const halfOfWidestBranchElement = Math.max(branchLabelViews[i].width, cfg.minContainerWidth) / 2;
|
|
@@ -1659,9 +1636,7 @@ const createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, view
|
|
|
1659
1636
|
|
|
1660
1637
|
const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElement, stepContext, viewContext) => {
|
|
1661
1638
|
const { step } = stepContext;
|
|
1662
|
-
const g =
|
|
1663
|
-
class: `sqd-step-task sqd-type-${step.type}`
|
|
1664
|
-
});
|
|
1639
|
+
const g = ComponentDom.stepG('task', step.type, step.id);
|
|
1665
1640
|
parentElement.appendChild(g);
|
|
1666
1641
|
const boxHeight = cfg.paddingY * 2 + cfg.iconSize;
|
|
1667
1642
|
const text = Dom.svg('text', {
|
|
@@ -1669,7 +1644,7 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1669
1644
|
y: boxHeight / 2,
|
|
1670
1645
|
class: 'sqd-step-task-text'
|
|
1671
1646
|
});
|
|
1672
|
-
text.textContent =
|
|
1647
|
+
text.textContent = viewContext.getStepName();
|
|
1673
1648
|
g.appendChild(text);
|
|
1674
1649
|
const textWidth = Math.max(text.getBBox().width, cfg.minTextWidth);
|
|
1675
1650
|
const boxWidth = cfg.iconSize + cfg.paddingLeft + cfg.paddingRight + cfg.textMarginLeft + textWidth;
|
|
@@ -1941,6 +1916,43 @@ class StepExtensionResolver {
|
|
|
1941
1916
|
}
|
|
1942
1917
|
}
|
|
1943
1918
|
|
|
1919
|
+
class RectPlaceholderView {
|
|
1920
|
+
static create(parent, width, height, radius, iconSize, direction) {
|
|
1921
|
+
const g = Dom.svg('g', {
|
|
1922
|
+
visibility: 'hidden',
|
|
1923
|
+
class: 'sqd-placeholder'
|
|
1924
|
+
});
|
|
1925
|
+
parent.appendChild(g);
|
|
1926
|
+
const rect = Dom.svg('rect', {
|
|
1927
|
+
class: 'sqd-placeholder-rect',
|
|
1928
|
+
width,
|
|
1929
|
+
height,
|
|
1930
|
+
rx: radius,
|
|
1931
|
+
ry: radius
|
|
1932
|
+
});
|
|
1933
|
+
g.appendChild(rect);
|
|
1934
|
+
if (direction) {
|
|
1935
|
+
const iconD = direction === exports.PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;
|
|
1936
|
+
const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);
|
|
1937
|
+
Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);
|
|
1938
|
+
}
|
|
1939
|
+
parent.appendChild(g);
|
|
1940
|
+
return new RectPlaceholderView(rect, g);
|
|
1941
|
+
}
|
|
1942
|
+
constructor(rect, g) {
|
|
1943
|
+
this.rect = rect;
|
|
1944
|
+
this.g = g;
|
|
1945
|
+
}
|
|
1946
|
+
setIsHover(isHover) {
|
|
1947
|
+
Dom.toggleClass(this.g, isHover, 'sqd-hover');
|
|
1948
|
+
}
|
|
1949
|
+
setIsVisible(isVisible) {
|
|
1950
|
+
Dom.attrs(this.g, {
|
|
1951
|
+
visibility: isVisible ? 'visible' : 'hidden'
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1944
1956
|
class RectPlaceholder {
|
|
1945
1957
|
static create(parent, size, direction, sequence, index, configuration) {
|
|
1946
1958
|
const view = RectPlaceholderView.create(parent, size.x, size.y, configuration.radius, configuration.iconSize, direction);
|
|
@@ -2468,7 +2480,7 @@ class WorkspaceControllerWrapper {
|
|
|
2468
2480
|
|
|
2469
2481
|
class DesignerContext {
|
|
2470
2482
|
static create(parent, startDefinition, configuration, services) {
|
|
2471
|
-
var _a, _b, _c;
|
|
2483
|
+
var _a, _b, _c, _d;
|
|
2472
2484
|
const definition = ObjectCloner.deepClone(startDefinition);
|
|
2473
2485
|
const layoutController = new LayoutController(parent);
|
|
2474
2486
|
const isReadonly = !!configuration.isReadonly;
|
|
@@ -2480,22 +2492,24 @@ class DesignerContext {
|
|
|
2480
2492
|
const behaviorController = new BehaviorController();
|
|
2481
2493
|
const stepExtensionResolver = StepExtensionResolver.create(services);
|
|
2482
2494
|
const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new sequentialWorkflowModel.DefinitionWalker();
|
|
2495
|
+
const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
|
|
2483
2496
|
const stateModifier = StateModifier.create(definitionWalker, state, configuration);
|
|
2484
2497
|
const customActionController = new CustomActionController(configuration, state, stateModifier);
|
|
2485
2498
|
let historyController = undefined;
|
|
2486
2499
|
if (configuration.undoStackSize) {
|
|
2487
2500
|
historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
|
|
2488
2501
|
}
|
|
2489
|
-
const componentContext = ComponentContext.create(configuration.steps, configuration.validator, state, stepExtensionResolver, services);
|
|
2490
|
-
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController);
|
|
2502
|
+
const componentContext = ComponentContext.create(configuration.steps, configuration.validator, state, stepExtensionResolver, i18n, services);
|
|
2503
|
+
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController);
|
|
2491
2504
|
}
|
|
2492
|
-
constructor(theme, state, configuration, services, componentContext, definitionWalker, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController) {
|
|
2505
|
+
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, behaviorController, customActionController, historyController) {
|
|
2493
2506
|
this.theme = theme;
|
|
2494
2507
|
this.state = state;
|
|
2495
2508
|
this.configuration = configuration;
|
|
2496
2509
|
this.services = services;
|
|
2497
2510
|
this.componentContext = componentContext;
|
|
2498
2511
|
this.definitionWalker = definitionWalker;
|
|
2512
|
+
this.i18n = i18n;
|
|
2499
2513
|
this.stateModifier = stateModifier;
|
|
2500
2514
|
this.layoutController = layoutController;
|
|
2501
2515
|
this.workspaceController = workspaceController;
|
|
@@ -2908,8 +2922,9 @@ class ContextMenuController {
|
|
|
2908
2922
|
}
|
|
2909
2923
|
|
|
2910
2924
|
class ContextMenuItemsBuilder {
|
|
2911
|
-
constructor(viewportApi, stateModifier, state, customMenuItemsProvider) {
|
|
2925
|
+
constructor(viewportApi, i18n, stateModifier, state, customMenuItemsProvider) {
|
|
2912
2926
|
this.viewportApi = viewportApi;
|
|
2927
|
+
this.i18n = i18n;
|
|
2913
2928
|
this.stateModifier = stateModifier;
|
|
2914
2929
|
this.state = state;
|
|
2915
2930
|
this.customMenuItemsProvider = customMenuItemsProvider;
|
|
@@ -2920,15 +2935,16 @@ class ContextMenuItemsBuilder {
|
|
|
2920
2935
|
const ssc = commandOrNull;
|
|
2921
2936
|
const step = ssc.component.step;
|
|
2922
2937
|
const parentSequence = ssc.component.parentSequence;
|
|
2938
|
+
const name = this.i18n(`step.${step.type}.name`, step.name);
|
|
2923
2939
|
items.push({
|
|
2924
|
-
label:
|
|
2940
|
+
label: name,
|
|
2925
2941
|
order: 0
|
|
2926
2942
|
});
|
|
2927
2943
|
this.tryAppendCustomItems(items, step, parentSequence);
|
|
2928
2944
|
if (this.stateModifier.isSelectable(step, parentSequence)) {
|
|
2929
2945
|
if (this.state.selectedStepId === step.id) {
|
|
2930
2946
|
items.push({
|
|
2931
|
-
label:
|
|
2947
|
+
label: this.i18n('contextMenu.unselect', 'Unselect'),
|
|
2932
2948
|
order: 10,
|
|
2933
2949
|
callback: () => {
|
|
2934
2950
|
this.state.setSelectedStepId(null);
|
|
@@ -2937,7 +2953,7 @@ class ContextMenuItemsBuilder {
|
|
|
2937
2953
|
}
|
|
2938
2954
|
else {
|
|
2939
2955
|
items.push({
|
|
2940
|
-
label: 'Select',
|
|
2956
|
+
label: this.i18n('contextMenu.select', 'Select'),
|
|
2941
2957
|
order: 20,
|
|
2942
2958
|
callback: () => {
|
|
2943
2959
|
this.stateModifier.trySelectStepById(step.id);
|
|
@@ -2948,7 +2964,7 @@ class ContextMenuItemsBuilder {
|
|
|
2948
2964
|
if (!this.state.isReadonly) {
|
|
2949
2965
|
if (this.stateModifier.isDeletable(step.id)) {
|
|
2950
2966
|
items.push({
|
|
2951
|
-
label: 'Delete',
|
|
2967
|
+
label: this.i18n('contextMenu.delete', 'Delete'),
|
|
2952
2968
|
order: 30,
|
|
2953
2969
|
callback: () => {
|
|
2954
2970
|
this.stateModifier.tryDelete(step.id);
|
|
@@ -2957,7 +2973,7 @@ class ContextMenuItemsBuilder {
|
|
|
2957
2973
|
}
|
|
2958
2974
|
if (this.stateModifier.isDuplicable(step, parentSequence)) {
|
|
2959
2975
|
items.push({
|
|
2960
|
-
label: 'Duplicate',
|
|
2976
|
+
label: this.i18n('contextMenu.duplicate', 'Duplicate'),
|
|
2961
2977
|
order: 40,
|
|
2962
2978
|
callback: () => {
|
|
2963
2979
|
this.stateModifier.tryDuplicate(step, parentSequence);
|
|
@@ -2970,7 +2986,7 @@ class ContextMenuItemsBuilder {
|
|
|
2970
2986
|
this.tryAppendCustomItems(items, null, this.state.definition.sequence);
|
|
2971
2987
|
}
|
|
2972
2988
|
items.push({
|
|
2973
|
-
label: 'Reset view',
|
|
2989
|
+
label: this.i18n('contextMenu.resetView', 'Reset view'),
|
|
2974
2990
|
order: 50,
|
|
2975
2991
|
callback: () => {
|
|
2976
2992
|
this.viewportApi.resetViewport();
|
|
@@ -2995,7 +3011,7 @@ class Workspace {
|
|
|
2995
3011
|
const view = WorkspaceView.create(parent, designerContext.componentContext);
|
|
2996
3012
|
const clickBehaviorResolver = new ClickBehaviorResolver(designerContext);
|
|
2997
3013
|
const wheelController = designerContext.services.wheelController.create(api.workspace);
|
|
2998
|
-
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
3014
|
+
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
2999
3015
|
? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
|
|
3000
3016
|
: undefined);
|
|
3001
3017
|
const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
|
|
@@ -3242,28 +3258,28 @@ class DefaultDraggedComponentExtension {
|
|
|
3242
3258
|
}
|
|
3243
3259
|
|
|
3244
3260
|
class ControlBarView {
|
|
3245
|
-
static create(parent, isUndoRedoSupported) {
|
|
3261
|
+
static create(parent, isUndoRedoSupported, i18n) {
|
|
3246
3262
|
const root = Dom.element('div', {
|
|
3247
3263
|
class: 'sqd-control-bar'
|
|
3248
3264
|
});
|
|
3249
|
-
const resetButton = createButton(Icons.center, 'Reset view');
|
|
3265
|
+
const resetButton = createButton(Icons.center, i18n('controlBar.resetView', 'Reset view'));
|
|
3250
3266
|
root.appendChild(resetButton);
|
|
3251
|
-
const zoomInButton = createButton(Icons.zoomIn, 'Zoom in');
|
|
3267
|
+
const zoomInButton = createButton(Icons.zoomIn, i18n('controlBar.zoomIn', 'Zoom in'));
|
|
3252
3268
|
root.appendChild(zoomInButton);
|
|
3253
|
-
const zoomOutButton = createButton(Icons.zoomOut, 'Zoom out');
|
|
3269
|
+
const zoomOutButton = createButton(Icons.zoomOut, i18n('controlBar.zoomOut', 'Zoom out'));
|
|
3254
3270
|
root.appendChild(zoomOutButton);
|
|
3255
3271
|
let undoButton = null;
|
|
3256
3272
|
let redoButton = null;
|
|
3257
3273
|
if (isUndoRedoSupported) {
|
|
3258
|
-
undoButton = createButton(Icons.undo, 'Undo');
|
|
3274
|
+
undoButton = createButton(Icons.undo, i18n('controlBar.undo', 'Undo'));
|
|
3259
3275
|
root.appendChild(undoButton);
|
|
3260
|
-
redoButton = createButton(Icons.redo, 'Redo');
|
|
3276
|
+
redoButton = createButton(Icons.redo, i18n('controlBar.redo', 'Redo'));
|
|
3261
3277
|
root.appendChild(redoButton);
|
|
3262
3278
|
}
|
|
3263
|
-
const disableDragButton = createButton(Icons.move, 'Turn on/off drag and drop');
|
|
3279
|
+
const disableDragButton = createButton(Icons.move, i18n('controlBar.turnOnOffDragAndDrop', 'Turn on/off drag and drop'));
|
|
3264
3280
|
disableDragButton.classList.add('sqd-disabled');
|
|
3265
3281
|
root.appendChild(disableDragButton);
|
|
3266
|
-
const deleteButton = createButton(Icons.delete, 'Delete selected step');
|
|
3282
|
+
const deleteButton = createButton(Icons.delete, i18n('controlBar.deleteSelectedStep', 'Delete selected step'));
|
|
3267
3283
|
deleteButton.classList.add('sqd-delete');
|
|
3268
3284
|
deleteButton.classList.add('sqd-hidden');
|
|
3269
3285
|
root.appendChild(deleteButton);
|
|
@@ -3344,7 +3360,7 @@ function createButton(d, title) {
|
|
|
3344
3360
|
class ControlBar {
|
|
3345
3361
|
static create(parent, api) {
|
|
3346
3362
|
const isUndoRedoSupported = api.controlBar.isUndoRedoSupported();
|
|
3347
|
-
const view = ControlBarView.create(parent, isUndoRedoSupported);
|
|
3363
|
+
const view = ControlBarView.create(parent, isUndoRedoSupported, api.i18n);
|
|
3348
3364
|
const bar = new ControlBar(view, api.controlBar, isUndoRedoSupported);
|
|
3349
3365
|
view.bindResetButtonClick(() => bar.onResetButtonClicked());
|
|
3350
3366
|
view.bindZoomInButtonClick(() => bar.onZoomInButtonClicked());
|
|
@@ -3474,19 +3490,16 @@ class KeyboardDaemonExtension {
|
|
|
3474
3490
|
}
|
|
3475
3491
|
|
|
3476
3492
|
class SmartEditorView {
|
|
3477
|
-
static create(parent, api, configuration) {
|
|
3493
|
+
static create(parent, api, i18n, configuration) {
|
|
3478
3494
|
const root = Dom.element('div', {
|
|
3479
3495
|
class: 'sqd-smart-editor'
|
|
3480
3496
|
});
|
|
3481
3497
|
const toggle = Dom.element('div', {
|
|
3482
3498
|
class: 'sqd-smart-editor-toggle',
|
|
3483
|
-
title: 'Toggle editor'
|
|
3499
|
+
title: i18n('smartEditor.toggle', 'Toggle editor')
|
|
3484
3500
|
});
|
|
3485
3501
|
parent.appendChild(toggle);
|
|
3486
3502
|
parent.appendChild(root);
|
|
3487
|
-
if (configuration.globalEditorProvider) {
|
|
3488
|
-
throw new Error('globalEditorProvider is renamed to rootEditorProvider');
|
|
3489
|
-
}
|
|
3490
3503
|
const editor = Editor.create(root, api, 'sqd-editor sqd-step-editor', configuration.stepEditorProvider, 'sqd-editor sqd-root-editor', configuration.rootEditorProvider, null);
|
|
3491
3504
|
return new SmartEditorView(root, toggle, editor);
|
|
3492
3505
|
}
|
|
@@ -3517,7 +3530,7 @@ class SmartEditorView {
|
|
|
3517
3530
|
|
|
3518
3531
|
class SmartEditor {
|
|
3519
3532
|
static create(parent, api, configuration) {
|
|
3520
|
-
const view = SmartEditorView.create(parent, api.editor, configuration);
|
|
3533
|
+
const view = SmartEditorView.create(parent, api.editor, api.i18n, configuration);
|
|
3521
3534
|
const editor = new SmartEditor(view, api.editor, api.workspace);
|
|
3522
3535
|
editor.updateVisibility();
|
|
3523
3536
|
view.bindToggleClick(() => editor.onToggleClicked());
|
|
@@ -3760,7 +3773,7 @@ class ToolboxItem {
|
|
|
3760
3773
|
}
|
|
3761
3774
|
|
|
3762
3775
|
class ToolboxView {
|
|
3763
|
-
static create(parent, api) {
|
|
3776
|
+
static create(parent, api, i18n) {
|
|
3764
3777
|
const root = Dom.element('div', {
|
|
3765
3778
|
class: 'sqd-toolbox'
|
|
3766
3779
|
});
|
|
@@ -3770,14 +3783,14 @@ class ToolboxView {
|
|
|
3770
3783
|
const headerTitle = Dom.element('div', {
|
|
3771
3784
|
class: 'sqd-toolbox-header-title'
|
|
3772
3785
|
});
|
|
3773
|
-
headerTitle.innerText = 'Toolbox';
|
|
3786
|
+
headerTitle.innerText = i18n('toolbox.title', 'Toolbox');
|
|
3774
3787
|
const body = Dom.element('div', {
|
|
3775
3788
|
class: 'sqd-toolbox-body'
|
|
3776
3789
|
});
|
|
3777
3790
|
const filterInput = Dom.element('input', {
|
|
3778
3791
|
class: 'sqd-toolbox-filter',
|
|
3779
3792
|
type: 'text',
|
|
3780
|
-
placeholder: 'Search...'
|
|
3793
|
+
placeholder: i18n('toolbox.search', 'Search...')
|
|
3781
3794
|
});
|
|
3782
3795
|
root.appendChild(header);
|
|
3783
3796
|
root.appendChild(body);
|
|
@@ -3837,9 +3850,9 @@ class ToolboxView {
|
|
|
3837
3850
|
}
|
|
3838
3851
|
|
|
3839
3852
|
class Toolbox {
|
|
3840
|
-
static create(root, api) {
|
|
3853
|
+
static create(root, api, i18n) {
|
|
3841
3854
|
const allGroups = api.getAllGroups();
|
|
3842
|
-
const view = ToolboxView.create(root, api);
|
|
3855
|
+
const view = ToolboxView.create(root, api, i18n);
|
|
3843
3856
|
const toolbox = new Toolbox(view, api, allGroups);
|
|
3844
3857
|
toolbox.render();
|
|
3845
3858
|
toolbox.onIsCollapsedChanged();
|
|
@@ -3874,7 +3887,7 @@ class Toolbox {
|
|
|
3874
3887
|
|
|
3875
3888
|
class ToolboxExtension {
|
|
3876
3889
|
create(root, api) {
|
|
3877
|
-
return Toolbox.create(root, api.toolbox);
|
|
3890
|
+
return Toolbox.create(root, api.toolbox, api.i18n);
|
|
3878
3891
|
}
|
|
3879
3892
|
}
|
|
3880
3893
|
|
|
@@ -4523,6 +4536,7 @@ exports.Badges = Badges;
|
|
|
4523
4536
|
exports.CenteredViewportCalculator = CenteredViewportCalculator;
|
|
4524
4537
|
exports.ClassicWheelControllerExtension = ClassicWheelControllerExtension;
|
|
4525
4538
|
exports.ComponentContext = ComponentContext;
|
|
4539
|
+
exports.ComponentDom = ComponentDom;
|
|
4526
4540
|
exports.ControlBarApi = ControlBarApi;
|
|
4527
4541
|
exports.CustomActionController = CustomActionController;
|
|
4528
4542
|
exports.DefaultSequenceComponent = DefaultSequenceComponent;
|