sequential-workflow-designer 0.38.2 → 0.39.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 +13 -13
- package/dist/index.umd.js +116 -73
- package/lib/cjs/index.cjs +116 -73
- package/lib/esm/index.js +116 -73
- package/lib/index.d.ts +68 -34
- package/package.json +1 -1
package/lib/esm/index.js
CHANGED
|
@@ -200,15 +200,17 @@ function race(timeout, a, b, c, d) {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
class ControlBarApi {
|
|
203
|
-
static create(state, historyController, stateModifier) {
|
|
204
|
-
const api = new ControlBarApi(state, historyController, stateModifier);
|
|
203
|
+
static create(state, historyController, customActionController, stateModifier, configuration) {
|
|
204
|
+
const api = new ControlBarApi(state, historyController, customActionController, stateModifier, configuration);
|
|
205
205
|
race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.emit);
|
|
206
206
|
return api;
|
|
207
207
|
}
|
|
208
|
-
constructor(state, historyController, stateModifier) {
|
|
208
|
+
constructor(state, historyController, customActionController, stateModifier, configuration) {
|
|
209
209
|
this.state = state;
|
|
210
210
|
this.historyController = historyController;
|
|
211
|
+
this.customActionController = customActionController;
|
|
211
212
|
this.stateModifier = stateModifier;
|
|
213
|
+
this.configuration = configuration;
|
|
212
214
|
this.onStateChanged = new SimpleEvent();
|
|
213
215
|
}
|
|
214
216
|
isDragDisabled() {
|
|
@@ -255,6 +257,16 @@ class ControlBarApi {
|
|
|
255
257
|
!this.state.isDragging &&
|
|
256
258
|
this.stateModifier.isDeletableById(this.state.selectedStepId));
|
|
257
259
|
}
|
|
260
|
+
getButtons() {
|
|
261
|
+
return typeof this.configuration === 'boolean' ? null : this.configuration.buttons || null;
|
|
262
|
+
}
|
|
263
|
+
triggerButtonClick(id) {
|
|
264
|
+
const action = {
|
|
265
|
+
type: 'controlBarButtonClicked',
|
|
266
|
+
id
|
|
267
|
+
};
|
|
268
|
+
this.customActionController.trigger(action, null, this.state.definition.sequence);
|
|
269
|
+
}
|
|
258
270
|
}
|
|
259
271
|
|
|
260
272
|
var KeyboardAction;
|
|
@@ -825,7 +837,7 @@ class DesignerApi {
|
|
|
825
837
|
const workspace = new WorkspaceApi(context.state, context.definitionWalker, context.workspaceController);
|
|
826
838
|
const viewportController = context.services.viewportController.create(workspace);
|
|
827
839
|
const toolboxDataProvider = new ToolboxDataProvider(context.i18n, context.componentContext.iconProvider, context.configuration.toolbox);
|
|
828
|
-
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.stateModifier), workspace, new ViewportApi(context.state, context.workspaceController, viewportController), new PathBarApi(context.state, context.definitionWalker), context.definitionWalker, context.i18n);
|
|
840
|
+
return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.customActionController, context.stateModifier, context.configuration.controlBar), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.stateModifier), workspace, new ViewportApi(context.state, context.workspaceController, viewportController), new PathBarApi(context.state, context.definitionWalker), context.definitionWalker, context.i18n);
|
|
829
841
|
}
|
|
830
842
|
constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
831
843
|
this.shadowRoot = shadowRoot;
|
|
@@ -3787,6 +3799,7 @@ class ContextMenuController {
|
|
|
3787
3799
|
this.itemsBuilder = itemsBuilder;
|
|
3788
3800
|
}
|
|
3789
3801
|
tryOpen(position, commandOrNull) {
|
|
3802
|
+
var _a, _b;
|
|
3790
3803
|
if (this.configuration.contextMenu === false) {
|
|
3791
3804
|
// Context menu is disabled.
|
|
3792
3805
|
return;
|
|
@@ -3794,8 +3807,11 @@ class ContextMenuController {
|
|
|
3794
3807
|
if (this.current) {
|
|
3795
3808
|
this.current.tryDestroy();
|
|
3796
3809
|
}
|
|
3797
|
-
const
|
|
3798
|
-
|
|
3810
|
+
const isResetViewDisabled = this.configuration.contextMenu === true ? false : (_b = (_a = this.configuration.contextMenu) === null || _a === void 0 ? void 0 : _a.isResetViewDisabled) !== null && _b !== void 0 ? _b : false;
|
|
3811
|
+
const items = this.itemsBuilder.build(commandOrNull, isResetViewDisabled);
|
|
3812
|
+
if (items.length > 0) {
|
|
3813
|
+
this.current = ContextMenu.create(this.configuration.shadowRoot, position, this.theme, items);
|
|
3814
|
+
}
|
|
3799
3815
|
}
|
|
3800
3816
|
destroy() {
|
|
3801
3817
|
if (this.current) {
|
|
@@ -3813,7 +3829,7 @@ class ContextMenuItemsBuilder {
|
|
|
3813
3829
|
this.state = state;
|
|
3814
3830
|
this.customMenuItemsProvider = customMenuItemsProvider;
|
|
3815
3831
|
}
|
|
3816
|
-
build(commandOrNull) {
|
|
3832
|
+
build(commandOrNull, isResetViewDisabled) {
|
|
3817
3833
|
const items = [];
|
|
3818
3834
|
if (commandOrNull && commandOrNull.type === ClickCommandType.selectStep) {
|
|
3819
3835
|
const ssc = commandOrNull;
|
|
@@ -3870,13 +3886,15 @@ class ContextMenuItemsBuilder {
|
|
|
3870
3886
|
const rootSequence = this.workspaceApi.getRootSequence();
|
|
3871
3887
|
this.tryAppendCustomItems(items, null, rootSequence.sequence);
|
|
3872
3888
|
}
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3889
|
+
if (!isResetViewDisabled) {
|
|
3890
|
+
items.push({
|
|
3891
|
+
label: this.i18n('contextMenu.resetView', 'Reset view'),
|
|
3892
|
+
order: 50,
|
|
3893
|
+
callback: () => {
|
|
3894
|
+
this.viewportApi.resetViewport();
|
|
3895
|
+
}
|
|
3896
|
+
});
|
|
3897
|
+
}
|
|
3880
3898
|
items.sort((a, b) => a.order - b.order);
|
|
3881
3899
|
return items;
|
|
3882
3900
|
}
|
|
@@ -4235,7 +4253,7 @@ class DefaultDraggedComponentExtension {
|
|
|
4235
4253
|
}
|
|
4236
4254
|
|
|
4237
4255
|
class ControlBarView {
|
|
4238
|
-
static create(parent, isUndoRedoSupported, i18n) {
|
|
4256
|
+
static create(parent, isUndoRedoSupported, buttons, i18n) {
|
|
4239
4257
|
const root = Dom.element('div', {
|
|
4240
4258
|
class: 'sqd-control-bar'
|
|
4241
4259
|
});
|
|
@@ -4260,10 +4278,19 @@ class ControlBarView {
|
|
|
4260
4278
|
deleteButton.classList.add('sqd-delete');
|
|
4261
4279
|
deleteButton.classList.add('sqd-hidden');
|
|
4262
4280
|
root.appendChild(deleteButton);
|
|
4281
|
+
const customButtons = [];
|
|
4282
|
+
if (buttons) {
|
|
4283
|
+
for (const customButton of buttons) {
|
|
4284
|
+
const button = createButton(customButton.iconD, customButton.label);
|
|
4285
|
+
button.setAttribute('data-id', customButton.id);
|
|
4286
|
+
root.appendChild(button);
|
|
4287
|
+
customButtons.push(button);
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4263
4290
|
parent.appendChild(root);
|
|
4264
|
-
return new ControlBarView(resetButton, zoomInButton, zoomOutButton, undoButton, redoButton, disableDragButton, deleteButton);
|
|
4291
|
+
return new ControlBarView(resetButton, zoomInButton, zoomOutButton, undoButton, redoButton, disableDragButton, deleteButton, customButtons);
|
|
4265
4292
|
}
|
|
4266
|
-
constructor(resetButton, zoomInButton, zoomOutButton, undoButton, redoButton, disableDragButton, deleteButton) {
|
|
4293
|
+
constructor(resetButton, zoomInButton, zoomOutButton, undoButton, redoButton, disableDragButton, deleteButton, customButtons) {
|
|
4267
4294
|
this.resetButton = resetButton;
|
|
4268
4295
|
this.zoomInButton = zoomInButton;
|
|
4269
4296
|
this.zoomOutButton = zoomOutButton;
|
|
@@ -4271,6 +4298,7 @@ class ControlBarView {
|
|
|
4271
4298
|
this.redoButton = redoButton;
|
|
4272
4299
|
this.disableDragButton = disableDragButton;
|
|
4273
4300
|
this.deleteButton = deleteButton;
|
|
4301
|
+
this.customButtons = customButtons;
|
|
4274
4302
|
}
|
|
4275
4303
|
bindResetButtonClick(handler) {
|
|
4276
4304
|
bindClick(this.resetButton, handler);
|
|
@@ -4299,6 +4327,14 @@ class ControlBarView {
|
|
|
4299
4327
|
bindDeleteButtonClick(handler) {
|
|
4300
4328
|
bindClick(this.deleteButton, handler);
|
|
4301
4329
|
}
|
|
4330
|
+
bindCustomButtonClick(handler) {
|
|
4331
|
+
for (const customButton of this.customButtons) {
|
|
4332
|
+
const id = customButton.getAttribute('data-id');
|
|
4333
|
+
if (id) {
|
|
4334
|
+
bindClick(customButton, () => handler(id));
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
}
|
|
4302
4338
|
setIsDeleteButtonHidden(isHidden) {
|
|
4303
4339
|
Dom.toggleClass(this.deleteButton, isHidden, 'sqd-hidden');
|
|
4304
4340
|
}
|
|
@@ -4337,17 +4373,21 @@ function createButton(d, title) {
|
|
|
4337
4373
|
class ControlBar {
|
|
4338
4374
|
static create(parent, api) {
|
|
4339
4375
|
const isUndoRedoSupported = api.controlBar.isUndoRedoSupported();
|
|
4340
|
-
const
|
|
4376
|
+
const customButtons = api.controlBar.getButtons();
|
|
4377
|
+
const view = ControlBarView.create(parent, isUndoRedoSupported, customButtons, api.i18n);
|
|
4341
4378
|
const bar = new ControlBar(view, api.controlBar, api.viewport, isUndoRedoSupported);
|
|
4342
|
-
view.bindResetButtonClick(
|
|
4343
|
-
view.bindZoomInButtonClick(
|
|
4344
|
-
view.bindZoomOutButtonClick(
|
|
4345
|
-
view.bindDisableDragButtonClick(
|
|
4346
|
-
view.bindDeleteButtonClick(
|
|
4347
|
-
api.controlBar.onStateChanged.subscribe(
|
|
4379
|
+
view.bindResetButtonClick(bar.onResetButtonClicked);
|
|
4380
|
+
view.bindZoomInButtonClick(bar.onZoomInButtonClicked);
|
|
4381
|
+
view.bindZoomOutButtonClick(bar.onZoomOutButtonClicked);
|
|
4382
|
+
view.bindDisableDragButtonClick(bar.onMoveButtonClicked);
|
|
4383
|
+
view.bindDeleteButtonClick(bar.onDeleteButtonClicked);
|
|
4384
|
+
api.controlBar.onStateChanged.subscribe(bar.refreshButtons);
|
|
4348
4385
|
if (isUndoRedoSupported) {
|
|
4349
|
-
view.bindUndoButtonClick(
|
|
4350
|
-
view.bindRedoButtonClick(
|
|
4386
|
+
view.bindUndoButtonClick(bar.onUndoButtonClicked);
|
|
4387
|
+
view.bindRedoButtonClick(bar.onRedoButtonClicked);
|
|
4388
|
+
}
|
|
4389
|
+
if (customButtons) {
|
|
4390
|
+
view.bindCustomButtonClick(bar.onCustomButtonClicked);
|
|
4351
4391
|
}
|
|
4352
4392
|
bar.refreshButtons();
|
|
4353
4393
|
return bar;
|
|
@@ -4357,6 +4397,37 @@ class ControlBar {
|
|
|
4357
4397
|
this.controlBarApi = controlBarApi;
|
|
4358
4398
|
this.viewportApi = viewportApi;
|
|
4359
4399
|
this.isUndoRedoSupported = isUndoRedoSupported;
|
|
4400
|
+
this.onResetButtonClicked = () => {
|
|
4401
|
+
this.viewportApi.resetViewport();
|
|
4402
|
+
};
|
|
4403
|
+
this.onZoomInButtonClicked = () => {
|
|
4404
|
+
this.viewportApi.zoom(true);
|
|
4405
|
+
};
|
|
4406
|
+
this.onZoomOutButtonClicked = () => {
|
|
4407
|
+
this.viewportApi.zoom(false);
|
|
4408
|
+
};
|
|
4409
|
+
this.onMoveButtonClicked = () => {
|
|
4410
|
+
this.controlBarApi.toggleIsDragDisabled();
|
|
4411
|
+
};
|
|
4412
|
+
this.onUndoButtonClicked = () => {
|
|
4413
|
+
this.controlBarApi.tryUndo();
|
|
4414
|
+
};
|
|
4415
|
+
this.onRedoButtonClicked = () => {
|
|
4416
|
+
this.controlBarApi.tryRedo();
|
|
4417
|
+
};
|
|
4418
|
+
this.onDeleteButtonClicked = () => {
|
|
4419
|
+
this.controlBarApi.tryDelete();
|
|
4420
|
+
};
|
|
4421
|
+
this.refreshButtons = () => {
|
|
4422
|
+
this.refreshDeleteButtonVisibility();
|
|
4423
|
+
this.refreshIsDragDisabled();
|
|
4424
|
+
if (this.isUndoRedoSupported) {
|
|
4425
|
+
this.refreshUndoRedoAvailability();
|
|
4426
|
+
}
|
|
4427
|
+
};
|
|
4428
|
+
this.onCustomButtonClicked = (id) => {
|
|
4429
|
+
this.controlBarApi.triggerButtonClick(id);
|
|
4430
|
+
};
|
|
4360
4431
|
}
|
|
4361
4432
|
updateLayout() {
|
|
4362
4433
|
//
|
|
@@ -4364,34 +4435,6 @@ class ControlBar {
|
|
|
4364
4435
|
destroy() {
|
|
4365
4436
|
//
|
|
4366
4437
|
}
|
|
4367
|
-
onResetButtonClicked() {
|
|
4368
|
-
this.viewportApi.resetViewport();
|
|
4369
|
-
}
|
|
4370
|
-
onZoomInButtonClicked() {
|
|
4371
|
-
this.viewportApi.zoom(true);
|
|
4372
|
-
}
|
|
4373
|
-
onZoomOutButtonClicked() {
|
|
4374
|
-
this.viewportApi.zoom(false);
|
|
4375
|
-
}
|
|
4376
|
-
onMoveButtonClicked() {
|
|
4377
|
-
this.controlBarApi.toggleIsDragDisabled();
|
|
4378
|
-
}
|
|
4379
|
-
onUndoButtonClicked() {
|
|
4380
|
-
this.controlBarApi.tryUndo();
|
|
4381
|
-
}
|
|
4382
|
-
onRedoButtonClicked() {
|
|
4383
|
-
this.controlBarApi.tryRedo();
|
|
4384
|
-
}
|
|
4385
|
-
onDeleteButtonClicked() {
|
|
4386
|
-
this.controlBarApi.tryDelete();
|
|
4387
|
-
}
|
|
4388
|
-
refreshButtons() {
|
|
4389
|
-
this.refreshDeleteButtonVisibility();
|
|
4390
|
-
this.refreshIsDragDisabled();
|
|
4391
|
-
if (this.isUndoRedoSupported) {
|
|
4392
|
-
this.refreshUndoRedoAvailability();
|
|
4393
|
-
}
|
|
4394
|
-
}
|
|
4395
4438
|
//
|
|
4396
4439
|
refreshIsDragDisabled() {
|
|
4397
4440
|
const isDragDisabled = this.controlBarApi.isDragDisabled();
|
|
@@ -5066,8 +5109,8 @@ class Designer {
|
|
|
5066
5109
|
/**
|
|
5067
5110
|
* Creates a designer.
|
|
5068
5111
|
* @param placeholder Placeholder where the designer will be attached.
|
|
5069
|
-
* @param startDefinition
|
|
5070
|
-
* @param configuration
|
|
5112
|
+
* @param startDefinition Initial definition of the workflow.
|
|
5113
|
+
* @param configuration The designer configuration.
|
|
5071
5114
|
* @returns An instance of the designer.
|
|
5072
5115
|
*/
|
|
5073
5116
|
static create(placeholder, startDefinition, configuration) {
|
|
@@ -5154,37 +5197,37 @@ class Designer {
|
|
|
5154
5197
|
this.onPreferencesChanged = new SimpleEvent();
|
|
5155
5198
|
}
|
|
5156
5199
|
/**
|
|
5157
|
-
* @returns
|
|
5200
|
+
* @returns The current definition of the workflow.
|
|
5158
5201
|
*/
|
|
5159
5202
|
getDefinition() {
|
|
5160
5203
|
return this.state.definition;
|
|
5161
5204
|
}
|
|
5162
5205
|
/**
|
|
5163
|
-
* @returns
|
|
5206
|
+
* @returns The validation result of the current definition.
|
|
5164
5207
|
*/
|
|
5165
5208
|
isValid() {
|
|
5166
5209
|
return this.view.workspace.isValid;
|
|
5167
5210
|
}
|
|
5168
5211
|
/**
|
|
5169
|
-
* @returns
|
|
5212
|
+
* @returns The read-only flag.
|
|
5170
5213
|
*/
|
|
5171
5214
|
isReadonly() {
|
|
5172
5215
|
return this.state.isReadonly;
|
|
5173
5216
|
}
|
|
5174
5217
|
/**
|
|
5175
|
-
* @description Changes the
|
|
5218
|
+
* @description Changes the read-only flag.
|
|
5176
5219
|
*/
|
|
5177
5220
|
setIsReadonly(isReadonly) {
|
|
5178
5221
|
this.state.setIsReadonly(isReadonly);
|
|
5179
5222
|
}
|
|
5180
5223
|
/**
|
|
5181
|
-
* @returns
|
|
5224
|
+
* @returns The currently selected step id, or `null` if nothing is selected.
|
|
5182
5225
|
*/
|
|
5183
5226
|
getSelectedStepId() {
|
|
5184
5227
|
return this.state.selectedStepId;
|
|
5185
5228
|
}
|
|
5186
5229
|
/**
|
|
5187
|
-
* @description Selects a step by
|
|
5230
|
+
* @description Selects a step by id.
|
|
5188
5231
|
*/
|
|
5189
5232
|
selectStepById(stepId) {
|
|
5190
5233
|
this.state.setSelectedStepId(stepId);
|
|
@@ -5196,7 +5239,7 @@ class Designer {
|
|
|
5196
5239
|
this.state.setSelectedStepId(null);
|
|
5197
5240
|
}
|
|
5198
5241
|
/**
|
|
5199
|
-
* @returns
|
|
5242
|
+
* @returns The current viewport.
|
|
5200
5243
|
*/
|
|
5201
5244
|
getViewport() {
|
|
5202
5245
|
return this.state.viewport;
|
|
@@ -5215,13 +5258,13 @@ class Designer {
|
|
|
5215
5258
|
this.api.viewport.resetViewport();
|
|
5216
5259
|
}
|
|
5217
5260
|
/**
|
|
5218
|
-
* @description Moves the viewport to the step with
|
|
5261
|
+
* @description Moves the viewport to the step with animation.
|
|
5219
5262
|
*/
|
|
5220
5263
|
moveViewportToStep(stepId) {
|
|
5221
5264
|
this.api.viewport.moveViewportToStep(stepId);
|
|
5222
5265
|
}
|
|
5223
5266
|
/**
|
|
5224
|
-
* @description
|
|
5267
|
+
* @description Rerenders the root component and all its children.
|
|
5225
5268
|
*/
|
|
5226
5269
|
updateRootComponent() {
|
|
5227
5270
|
this.api.workspace.updateRootComponent();
|
|
@@ -5240,37 +5283,37 @@ class Designer {
|
|
|
5240
5283
|
this.api.workspace.updateBadges();
|
|
5241
5284
|
}
|
|
5242
5285
|
/**
|
|
5243
|
-
* @returns
|
|
5286
|
+
* @returns A flag that indicates whether the toolbox is collapsed.
|
|
5244
5287
|
*/
|
|
5245
5288
|
isToolboxCollapsed() {
|
|
5246
5289
|
return this.state.isToolboxCollapsed;
|
|
5247
5290
|
}
|
|
5248
5291
|
/**
|
|
5249
|
-
* @description Sets
|
|
5292
|
+
* @description Sets the flag that indicates whether the toolbox is collapsed.
|
|
5250
5293
|
*/
|
|
5251
5294
|
setIsToolboxCollapsed(isCollapsed) {
|
|
5252
5295
|
this.state.setIsToolboxCollapsed(isCollapsed);
|
|
5253
5296
|
}
|
|
5254
5297
|
/**
|
|
5255
|
-
* @returns
|
|
5298
|
+
* @returns A flag that indicates whether the editor is collapsed.
|
|
5256
5299
|
*/
|
|
5257
5300
|
isEditorCollapsed() {
|
|
5258
5301
|
return this.state.isEditorCollapsed;
|
|
5259
5302
|
}
|
|
5260
5303
|
/**
|
|
5261
|
-
* @returns
|
|
5304
|
+
* @returns A flag that indicates whether a step is being dragged.
|
|
5262
5305
|
*/
|
|
5263
5306
|
isDragging() {
|
|
5264
5307
|
return this.state.isDragging;
|
|
5265
5308
|
}
|
|
5266
5309
|
/**
|
|
5267
|
-
* @description Sets
|
|
5310
|
+
* @description Sets the flag that indicates whether the editor is collapsed.
|
|
5268
5311
|
*/
|
|
5269
5312
|
setIsEditorCollapsed(isCollapsed) {
|
|
5270
5313
|
this.state.setIsEditorCollapsed(isCollapsed);
|
|
5271
5314
|
}
|
|
5272
5315
|
/**
|
|
5273
|
-
* @description
|
|
5316
|
+
* @description Dumps the undo stack.
|
|
5274
5317
|
*/
|
|
5275
5318
|
dumpUndoStack() {
|
|
5276
5319
|
return this.getHistoryController().dump();
|
|
@@ -5290,13 +5333,13 @@ class Designer {
|
|
|
5290
5333
|
}
|
|
5291
5334
|
/**
|
|
5292
5335
|
* @param needle A step, a sequence or a step id.
|
|
5293
|
-
* @returns
|
|
5336
|
+
* @returns Parent steps and branch names.
|
|
5294
5337
|
*/
|
|
5295
5338
|
getStepParents(needle) {
|
|
5296
5339
|
return this.walker.getParents(this.state.definition, needle);
|
|
5297
5340
|
}
|
|
5298
5341
|
/**
|
|
5299
|
-
* @returns
|
|
5342
|
+
* @returns The definition walker.
|
|
5300
5343
|
*/
|
|
5301
5344
|
getWalker() {
|
|
5302
5345
|
return this.walker;
|
package/lib/index.d.ts
CHANGED
|
@@ -1029,11 +1029,11 @@ interface DesignerConfiguration<TDefinition extends Definition = Definition> {
|
|
|
1029
1029
|
*/
|
|
1030
1030
|
theme?: string;
|
|
1031
1031
|
/**
|
|
1032
|
-
* @description The
|
|
1032
|
+
* @description The read-only mode of the designer.
|
|
1033
1033
|
*/
|
|
1034
1034
|
isReadonly?: boolean;
|
|
1035
1035
|
/**
|
|
1036
|
-
* @description The depth of the undo stack. If not set, undo/redo feature will be disabled.
|
|
1036
|
+
* @description The depth of the undo stack. If not set, the undo/redo feature will be disabled.
|
|
1037
1037
|
*/
|
|
1038
1038
|
undoStackSize?: number;
|
|
1039
1039
|
/**
|
|
@@ -1041,7 +1041,7 @@ interface DesignerConfiguration<TDefinition extends Definition = Definition> {
|
|
|
1041
1041
|
*/
|
|
1042
1042
|
undoStack?: UndoStack;
|
|
1043
1043
|
/**
|
|
1044
|
-
* @description The common configuration
|
|
1044
|
+
* @description The common configuration for steps.
|
|
1045
1045
|
*/
|
|
1046
1046
|
steps: StepsConfiguration;
|
|
1047
1047
|
/**
|
|
@@ -1057,15 +1057,15 @@ interface DesignerConfiguration<TDefinition extends Definition = Definition> {
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
editors: false | EditorsConfiguration<TDefinition>;
|
|
1059
1059
|
/**
|
|
1060
|
-
* @description If
|
|
1060
|
+
* @description If set to `true` or a configuration object, the control bar will be displayed.
|
|
1061
1061
|
*/
|
|
1062
|
-
controlBar: boolean;
|
|
1062
|
+
controlBar: boolean | ControlBarConfiguration;
|
|
1063
1063
|
/**
|
|
1064
|
-
* @description If false
|
|
1064
|
+
* @description If set to `false`, the context menu will be disabled. By default, the context menu is enabled.
|
|
1065
1065
|
*/
|
|
1066
|
-
contextMenu?: boolean;
|
|
1066
|
+
contextMenu?: boolean | ContextMenuConfiguration;
|
|
1067
1067
|
/**
|
|
1068
|
-
* @description The configuration of validators.
|
|
1068
|
+
* @description The configuration of the validators.
|
|
1069
1069
|
*/
|
|
1070
1070
|
validator?: ValidatorConfiguration;
|
|
1071
1071
|
/**
|
|
@@ -1085,11 +1085,11 @@ interface DesignerConfiguration<TDefinition extends Definition = Definition> {
|
|
|
1085
1085
|
*/
|
|
1086
1086
|
definitionWalker?: DefinitionWalker;
|
|
1087
1087
|
/**
|
|
1088
|
-
* @description Custom preference storage. By default, all preferences are stored in
|
|
1088
|
+
* @description Custom preference storage. By default, all preferences are stored in memory.
|
|
1089
1089
|
*/
|
|
1090
1090
|
preferenceStorage?: PreferenceStorage;
|
|
1091
1091
|
/**
|
|
1092
|
-
* @description Custom
|
|
1092
|
+
* @description Custom unique identifier generator.
|
|
1093
1093
|
*/
|
|
1094
1094
|
uidGenerator?: UidGenerator;
|
|
1095
1095
|
/**
|
|
@@ -1097,11 +1097,11 @@ interface DesignerConfiguration<TDefinition extends Definition = Definition> {
|
|
|
1097
1097
|
*/
|
|
1098
1098
|
i18n?: I18n;
|
|
1099
1099
|
/**
|
|
1100
|
-
* @description Custom text width measurer. By default, the designer uses `getBBox()` method to measure the width of the text.
|
|
1100
|
+
* @description Custom text width measurer. By default, the designer uses the `getBBox()` method to measure the width of the text.
|
|
1101
1101
|
*/
|
|
1102
1102
|
textWidthMeasurer?: TextWidthMeasurer;
|
|
1103
1103
|
/**
|
|
1104
|
-
* @description Pass the shadow root
|
|
1104
|
+
* @description Pass the shadow root to the designer if the designer is placed inside the shadow DOM.
|
|
1105
1105
|
*/
|
|
1106
1106
|
shadowRoot?: ShadowRoot;
|
|
1107
1107
|
}
|
|
@@ -1111,6 +1111,10 @@ type CustomActionHandler = (action: CustomAction, step: Step | null, sequence: S
|
|
|
1111
1111
|
interface CustomAction {
|
|
1112
1112
|
type: string;
|
|
1113
1113
|
}
|
|
1114
|
+
interface ControlBarButtonClickedCustomAction extends CustomAction {
|
|
1115
|
+
type: 'controlBarButtonClicked';
|
|
1116
|
+
id: string;
|
|
1117
|
+
}
|
|
1114
1118
|
interface CustomActionHandlerContext {
|
|
1115
1119
|
/**
|
|
1116
1120
|
* @description Notifies the designer that the name of the step has changed.
|
|
@@ -1166,7 +1170,7 @@ interface StepsConfiguration {
|
|
|
1166
1170
|
canMoveStep?: (sourceSequence: Sequence, step: Step, targetSequence: Sequence, targetIndex: number) => boolean;
|
|
1167
1171
|
canDeleteStep?: (step: Step, parentSequence: Sequence) => boolean;
|
|
1168
1172
|
/**
|
|
1169
|
-
* @description The designer automatically selects the step after it is dropped. If true
|
|
1173
|
+
* @description The designer automatically selects the step after it is dropped. If `true`, the step will not be selected.
|
|
1170
1174
|
*/
|
|
1171
1175
|
isAutoSelectDisabled?: boolean;
|
|
1172
1176
|
iconUrlProvider?: StepIconUrlProvider;
|
|
@@ -1182,6 +1186,32 @@ interface ValidatorConfiguration {
|
|
|
1182
1186
|
}
|
|
1183
1187
|
type StepValidator = (step: Step, parentSequence: Sequence, definition: Definition) => boolean;
|
|
1184
1188
|
type RootValidator = (definition: Definition) => boolean;
|
|
1189
|
+
interface ControlBarConfiguration {
|
|
1190
|
+
/**
|
|
1191
|
+
* @description Custom buttons displayed in the control bar.
|
|
1192
|
+
*/
|
|
1193
|
+
buttons?: ControlBarButton[];
|
|
1194
|
+
}
|
|
1195
|
+
interface ControlBarButton {
|
|
1196
|
+
/**
|
|
1197
|
+
* @description The unique identifier of the custom button.
|
|
1198
|
+
*/
|
|
1199
|
+
id: string;
|
|
1200
|
+
/**
|
|
1201
|
+
* @description The SVG path data used as the button icon.
|
|
1202
|
+
*/
|
|
1203
|
+
iconD: string;
|
|
1204
|
+
/**
|
|
1205
|
+
* @description The button label, used as the button title.
|
|
1206
|
+
*/
|
|
1207
|
+
label: string;
|
|
1208
|
+
}
|
|
1209
|
+
interface ContextMenuConfiguration {
|
|
1210
|
+
/**
|
|
1211
|
+
* @description If set to `true`, the default "Reset view" item will be hidden.
|
|
1212
|
+
*/
|
|
1213
|
+
isResetViewDisabled?: boolean;
|
|
1214
|
+
}
|
|
1185
1215
|
interface KeyboardConfiguration {
|
|
1186
1216
|
canHandleKey?: (action: KeyboardAction, event: KeyboardEvent) => boolean;
|
|
1187
1217
|
}
|
|
@@ -1276,8 +1306,10 @@ declare class StateModifier {
|
|
|
1276
1306
|
declare class ControlBarApi {
|
|
1277
1307
|
private readonly state;
|
|
1278
1308
|
private readonly historyController;
|
|
1309
|
+
private readonly customActionController;
|
|
1279
1310
|
private readonly stateModifier;
|
|
1280
|
-
|
|
1311
|
+
private readonly configuration;
|
|
1312
|
+
static create(state: DesignerState, historyController: HistoryController | undefined, customActionController: CustomActionController, stateModifier: StateModifier, configuration: ControlBarConfiguration | boolean): ControlBarApi;
|
|
1281
1313
|
private constructor();
|
|
1282
1314
|
readonly onStateChanged: SimpleEvent<unknown>;
|
|
1283
1315
|
isDragDisabled(): boolean;
|
|
@@ -1290,6 +1322,8 @@ declare class ControlBarApi {
|
|
|
1290
1322
|
canRedo(): boolean;
|
|
1291
1323
|
tryDelete(): boolean;
|
|
1292
1324
|
canDelete(): boolean;
|
|
1325
|
+
getButtons(): ControlBarButton[] | null;
|
|
1326
|
+
triggerButtonClick(id: string): void;
|
|
1293
1327
|
}
|
|
1294
1328
|
|
|
1295
1329
|
declare class DefaultViewportControllerDesignerExtension implements DesignerExtension {
|
|
@@ -1360,8 +1394,8 @@ declare class Designer<TDefinition extends Definition = Definition> {
|
|
|
1360
1394
|
/**
|
|
1361
1395
|
* Creates a designer.
|
|
1362
1396
|
* @param placeholder Placeholder where the designer will be attached.
|
|
1363
|
-
* @param startDefinition
|
|
1364
|
-
* @param configuration
|
|
1397
|
+
* @param startDefinition Initial definition of the workflow.
|
|
1398
|
+
* @param configuration The designer configuration.
|
|
1365
1399
|
* @returns An instance of the designer.
|
|
1366
1400
|
*/
|
|
1367
1401
|
static create<TDef extends Definition>(placeholder: HTMLElement, startDefinition: TDef, configuration: DesignerConfiguration<TDef>): Designer<TDef>;
|
|
@@ -1407,27 +1441,27 @@ declare class Designer<TDefinition extends Definition = Definition> {
|
|
|
1407
1441
|
*/
|
|
1408
1442
|
readonly onPreferencesChanged: SimpleEvent<PreferencesChangedEvent>;
|
|
1409
1443
|
/**
|
|
1410
|
-
* @returns
|
|
1444
|
+
* @returns The current definition of the workflow.
|
|
1411
1445
|
*/
|
|
1412
1446
|
getDefinition(): TDefinition;
|
|
1413
1447
|
/**
|
|
1414
|
-
* @returns
|
|
1448
|
+
* @returns The validation result of the current definition.
|
|
1415
1449
|
*/
|
|
1416
1450
|
isValid(): boolean;
|
|
1417
1451
|
/**
|
|
1418
|
-
* @returns
|
|
1452
|
+
* @returns The read-only flag.
|
|
1419
1453
|
*/
|
|
1420
1454
|
isReadonly(): boolean;
|
|
1421
1455
|
/**
|
|
1422
|
-
* @description Changes the
|
|
1456
|
+
* @description Changes the read-only flag.
|
|
1423
1457
|
*/
|
|
1424
1458
|
setIsReadonly(isReadonly: boolean): void;
|
|
1425
1459
|
/**
|
|
1426
|
-
* @returns
|
|
1460
|
+
* @returns The currently selected step id, or `null` if nothing is selected.
|
|
1427
1461
|
*/
|
|
1428
1462
|
getSelectedStepId(): string | null;
|
|
1429
1463
|
/**
|
|
1430
|
-
* @description Selects a step by
|
|
1464
|
+
* @description Selects a step by id.
|
|
1431
1465
|
*/
|
|
1432
1466
|
selectStepById(stepId: string): void;
|
|
1433
1467
|
/**
|
|
@@ -1435,7 +1469,7 @@ declare class Designer<TDefinition extends Definition = Definition> {
|
|
|
1435
1469
|
*/
|
|
1436
1470
|
clearSelectedStep(): void;
|
|
1437
1471
|
/**
|
|
1438
|
-
* @returns
|
|
1472
|
+
* @returns The current viewport.
|
|
1439
1473
|
*/
|
|
1440
1474
|
getViewport(): Viewport;
|
|
1441
1475
|
/**
|
|
@@ -1448,11 +1482,11 @@ declare class Designer<TDefinition extends Definition = Definition> {
|
|
|
1448
1482
|
*/
|
|
1449
1483
|
resetViewport(): void;
|
|
1450
1484
|
/**
|
|
1451
|
-
* @description Moves the viewport to the step with
|
|
1485
|
+
* @description Moves the viewport to the step with animation.
|
|
1452
1486
|
*/
|
|
1453
1487
|
moveViewportToStep(stepId: string): void;
|
|
1454
1488
|
/**
|
|
1455
|
-
* @description
|
|
1489
|
+
* @description Rerenders the root component and all its children.
|
|
1456
1490
|
*/
|
|
1457
1491
|
updateRootComponent(): void;
|
|
1458
1492
|
/**
|
|
@@ -1464,27 +1498,27 @@ declare class Designer<TDefinition extends Definition = Definition> {
|
|
|
1464
1498
|
*/
|
|
1465
1499
|
updateBadges(): void;
|
|
1466
1500
|
/**
|
|
1467
|
-
* @returns
|
|
1501
|
+
* @returns A flag that indicates whether the toolbox is collapsed.
|
|
1468
1502
|
*/
|
|
1469
1503
|
isToolboxCollapsed(): boolean;
|
|
1470
1504
|
/**
|
|
1471
|
-
* @description Sets
|
|
1505
|
+
* @description Sets the flag that indicates whether the toolbox is collapsed.
|
|
1472
1506
|
*/
|
|
1473
1507
|
setIsToolboxCollapsed(isCollapsed: boolean): void;
|
|
1474
1508
|
/**
|
|
1475
|
-
* @returns
|
|
1509
|
+
* @returns A flag that indicates whether the editor is collapsed.
|
|
1476
1510
|
*/
|
|
1477
1511
|
isEditorCollapsed(): boolean;
|
|
1478
1512
|
/**
|
|
1479
|
-
* @returns
|
|
1513
|
+
* @returns A flag that indicates whether a step is being dragged.
|
|
1480
1514
|
*/
|
|
1481
1515
|
isDragging(): boolean;
|
|
1482
1516
|
/**
|
|
1483
|
-
* @description Sets
|
|
1517
|
+
* @description Sets the flag that indicates whether the editor is collapsed.
|
|
1484
1518
|
*/
|
|
1485
1519
|
setIsEditorCollapsed(isCollapsed: boolean): void;
|
|
1486
1520
|
/**
|
|
1487
|
-
* @description
|
|
1521
|
+
* @description Dumps the undo stack.
|
|
1488
1522
|
*/
|
|
1489
1523
|
dumpUndoStack(): UndoStack;
|
|
1490
1524
|
/**
|
|
@@ -1494,11 +1528,11 @@ declare class Designer<TDefinition extends Definition = Definition> {
|
|
|
1494
1528
|
replaceDefinition(definition: TDefinition): Promise<void>;
|
|
1495
1529
|
/**
|
|
1496
1530
|
* @param needle A step, a sequence or a step id.
|
|
1497
|
-
* @returns
|
|
1531
|
+
* @returns Parent steps and branch names.
|
|
1498
1532
|
*/
|
|
1499
1533
|
getStepParents(needle: Sequence | Step | string): StepOrName[];
|
|
1500
1534
|
/**
|
|
1501
|
-
* @returns
|
|
1535
|
+
* @returns The definition walker.
|
|
1502
1536
|
*/
|
|
1503
1537
|
getWalker(): DefinitionWalker;
|
|
1504
1538
|
/**
|
|
@@ -1509,4 +1543,4 @@ declare class Designer<TDefinition extends Definition = Definition> {
|
|
|
1509
1543
|
}
|
|
1510
1544
|
|
|
1511
1545
|
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerDesignerExtension, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderController, PlaceholderDirection, PlaceholderGapOrientation, RectPlaceholder, RectPlaceholderDesignerExtension, RectPlaceholderView, SelectStepBehaviorEndToken, ServicesResolver, SimpleEvent, StartStopRootComponentDesignerExtension, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, TYPE, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, ViewportApi, WorkspaceApi, createContainerStepComponentViewFactory, createLaunchPadStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
|
1512
|
-
export type { Attributes, Badge, BadgeExtension, BadgeView, BadgesDecorator, BadgesResult, BaseClickCommand, Behavior, BehaviorEndToken, BranchNameLabelResolver, BranchNamesResolver, ClickBehaviorWrapper, ClickBehaviorWrapperExtension, ClickCommand, ClickDetails, Component, ComponentView, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ContextMenuExtension, ContextMenuItem, ContextMenuItemsProvider, CustomAction, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultViewportControllerConfiguration, DefaultViewportControllerExtensionConfiguration, DefinitionChangedEvent, DefinitionChangedEventDetails, DesignerConfiguration, DesignerExtension, DraggedComponent, DraggedComponentExtension, DuplicatedStepId, EditorsConfiguration, FoundPlaceholders, Grid, GridExtension, I18n, KeyboardConfiguration, LaunchPadStepComponentViewConfiguration, LaunchPadStepExtensionConfiguration, LineGridConfiguration, NextScale, OpenFolderClickCommand, Placeholder, PlaceholderConfiguration, PlaceholderExtension, PlaceholderView, PreferenceChange, PreferenceStorage, PreferencesChangedEvent, RectPlaceholderConfiguration, RegionComponentViewContentFactory, RegionComponentViewExtension, RegionView, RegionViewFactory, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SelectedStepIdProvider, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, SetPreferencesClickCommand, SimpleEventListener, StartStopRootComponentExtensionConfiguration, StartStopRootComponentViewConfiguration, StateModifierDependency, StepBadgesDecoratorExtension, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtensionConfiguration, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, TextWidthMeasurer, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceRootSequence };
|
|
1546
|
+
export type { Attributes, Badge, BadgeExtension, BadgeView, BadgesDecorator, BadgesResult, BaseClickCommand, Behavior, BehaviorEndToken, BranchNameLabelResolver, BranchNamesResolver, ClickBehaviorWrapper, ClickBehaviorWrapperExtension, ClickCommand, ClickDetails, Component, ComponentView, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ContextMenuConfiguration, ContextMenuExtension, ContextMenuItem, ContextMenuItemsProvider, ControlBarButton, ControlBarButtonClickedCustomAction, ControlBarConfiguration, CustomAction, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultViewportControllerConfiguration, DefaultViewportControllerExtensionConfiguration, DefinitionChangedEvent, DefinitionChangedEventDetails, DesignerConfiguration, DesignerExtension, DraggedComponent, DraggedComponentExtension, DuplicatedStepId, EditorsConfiguration, FoundPlaceholders, Grid, GridExtension, I18n, KeyboardConfiguration, LaunchPadStepComponentViewConfiguration, LaunchPadStepExtensionConfiguration, LineGridConfiguration, NextScale, OpenFolderClickCommand, Placeholder, PlaceholderConfiguration, PlaceholderExtension, PlaceholderView, PreferenceChange, PreferenceStorage, PreferencesChangedEvent, RectPlaceholderConfiguration, RegionComponentViewContentFactory, RegionComponentViewExtension, RegionView, RegionViewFactory, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SelectedStepIdProvider, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, SetPreferencesClickCommand, SimpleEventListener, StartStopRootComponentExtensionConfiguration, StartStopRootComponentViewConfiguration, StateModifierDependency, StepBadgesDecoratorExtension, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtensionConfiguration, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, TextWidthMeasurer, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceRootSequence };
|