sequential-workflow-designer 0.16.8 → 0.16.9

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 CHANGED
@@ -96,10 +96,10 @@ Add the below code to your head section in HTML document.
96
96
  ```html
97
97
  <head>
98
98
  ...
99
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.8/css/designer.css" rel="stylesheet">
100
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.8/css/designer-light.css" rel="stylesheet">
101
- <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.8/css/designer-dark.css" rel="stylesheet">
102
- <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.8/dist/index.umd.js"></script>
99
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.9/css/designer.css" rel="stylesheet">
100
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.9/css/designer-light.css" rel="stylesheet">
101
+ <link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.9/css/designer-dark.css" rel="stylesheet">
102
+ <script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.16.9/dist/index.umd.js"></script>
103
103
  ```
104
104
 
105
105
  Call the designer by:
package/dist/index.umd.js CHANGED
@@ -76,6 +76,10 @@
76
76
  }
77
77
  }
78
78
 
79
+ exports.KeyboardAction = void 0;
80
+ (function (KeyboardAction) {
81
+ KeyboardAction["delete"] = "delete";
82
+ })(exports.KeyboardAction || (exports.KeyboardAction = {}));
79
83
  exports.DefinitionChangeType = void 0;
80
84
  (function (DefinitionChangeType) {
81
85
  DefinitionChangeType[DefinitionChangeType["stepNameChanged"] = 1] = "stepNameChanged";
@@ -3451,23 +3455,27 @@
3451
3455
  }
3452
3456
  }
3453
3457
 
3454
- const supportedKeys = ['Backspace', 'Delete'];
3455
- const ignoreTagNames = ['INPUT', 'TEXTAREA'];
3458
+ const ignoreTagNames = ['INPUT', 'TEXTAREA', 'SELECT'];
3456
3459
  class KeyboardDaemon {
3457
- static create(api) {
3458
- const controller = new KeyboardDaemon(api.controlBar);
3460
+ static create(api, configuration) {
3461
+ const controller = new KeyboardDaemon(api.controlBar, configuration);
3459
3462
  document.addEventListener('keyup', controller.onKeyUp, false);
3460
3463
  return controller;
3461
3464
  }
3462
- constructor(controlBarApi) {
3465
+ constructor(controlBarApi, configuration) {
3463
3466
  this.controlBarApi = controlBarApi;
3467
+ this.configuration = configuration;
3464
3468
  this.onKeyUp = (e) => {
3465
- if (!supportedKeys.includes(e.key)) {
3469
+ const action = detectAction(e);
3470
+ if (!action) {
3466
3471
  return;
3467
3472
  }
3468
3473
  if (document.activeElement && ignoreTagNames.includes(document.activeElement.tagName)) {
3469
3474
  return;
3470
3475
  }
3476
+ if (this.configuration.canHandleKey && !this.configuration.canHandleKey(action, e)) {
3477
+ return;
3478
+ }
3471
3479
  const isDeletable = this.controlBarApi.canDelete();
3472
3480
  if (isDeletable) {
3473
3481
  e.preventDefault();
@@ -3479,11 +3487,26 @@
3479
3487
  destroy() {
3480
3488
  document.removeEventListener('keyup', this.onKeyUp, false);
3481
3489
  }
3490
+ }
3491
+ function detectAction(e) {
3492
+ if (e.key === 'Backspace' || e.key === 'Delete') {
3493
+ return exports.KeyboardAction.delete;
3494
+ }
3495
+ return null;
3482
3496
  }
3483
3497
 
3484
3498
  class KeyboardDaemonExtension {
3485
- constructor() {
3486
- this.create = KeyboardDaemon.create;
3499
+ static create(configuration) {
3500
+ if (configuration === undefined || configuration === true) {
3501
+ configuration = {};
3502
+ }
3503
+ return new KeyboardDaemonExtension(configuration);
3504
+ }
3505
+ constructor(configuration) {
3506
+ this.configuration = configuration;
3507
+ }
3508
+ create(api) {
3509
+ return KeyboardDaemon.create(api, this.configuration);
3487
3510
  }
3488
3511
  }
3489
3512
 
@@ -4263,7 +4286,9 @@
4263
4286
  if (!services.daemons) {
4264
4287
  services.daemons = [];
4265
4288
  }
4266
- services.daemons.push(new KeyboardDaemonExtension());
4289
+ if (configuration.keyboard === undefined || configuration.keyboard) {
4290
+ services.daemons.push(KeyboardDaemonExtension.create(configuration.keyboard));
4291
+ }
4267
4292
  }
4268
4293
 
4269
4294
  function throwDepreciatedError(propertyName, groupName) {
package/lib/cjs/index.cjs CHANGED
@@ -74,6 +74,10 @@ class ControlBarApi {
74
74
  }
75
75
  }
76
76
 
77
+ exports.KeyboardAction = void 0;
78
+ (function (KeyboardAction) {
79
+ KeyboardAction["delete"] = "delete";
80
+ })(exports.KeyboardAction || (exports.KeyboardAction = {}));
77
81
  exports.DefinitionChangeType = void 0;
78
82
  (function (DefinitionChangeType) {
79
83
  DefinitionChangeType[DefinitionChangeType["stepNameChanged"] = 1] = "stepNameChanged";
@@ -3266,23 +3270,27 @@ class ControlBarExtension {
3266
3270
  }
3267
3271
  }
3268
3272
 
3269
- const supportedKeys = ['Backspace', 'Delete'];
3270
- const ignoreTagNames = ['INPUT', 'TEXTAREA'];
3273
+ const ignoreTagNames = ['INPUT', 'TEXTAREA', 'SELECT'];
3271
3274
  class KeyboardDaemon {
3272
- static create(api) {
3273
- const controller = new KeyboardDaemon(api.controlBar);
3275
+ static create(api, configuration) {
3276
+ const controller = new KeyboardDaemon(api.controlBar, configuration);
3274
3277
  document.addEventListener('keyup', controller.onKeyUp, false);
3275
3278
  return controller;
3276
3279
  }
3277
- constructor(controlBarApi) {
3280
+ constructor(controlBarApi, configuration) {
3278
3281
  this.controlBarApi = controlBarApi;
3282
+ this.configuration = configuration;
3279
3283
  this.onKeyUp = (e) => {
3280
- if (!supportedKeys.includes(e.key)) {
3284
+ const action = detectAction(e);
3285
+ if (!action) {
3281
3286
  return;
3282
3287
  }
3283
3288
  if (document.activeElement && ignoreTagNames.includes(document.activeElement.tagName)) {
3284
3289
  return;
3285
3290
  }
3291
+ if (this.configuration.canHandleKey && !this.configuration.canHandleKey(action, e)) {
3292
+ return;
3293
+ }
3286
3294
  const isDeletable = this.controlBarApi.canDelete();
3287
3295
  if (isDeletable) {
3288
3296
  e.preventDefault();
@@ -3294,11 +3302,26 @@ class KeyboardDaemon {
3294
3302
  destroy() {
3295
3303
  document.removeEventListener('keyup', this.onKeyUp, false);
3296
3304
  }
3305
+ }
3306
+ function detectAction(e) {
3307
+ if (e.key === 'Backspace' || e.key === 'Delete') {
3308
+ return exports.KeyboardAction.delete;
3309
+ }
3310
+ return null;
3297
3311
  }
3298
3312
 
3299
3313
  class KeyboardDaemonExtension {
3300
- constructor() {
3301
- this.create = KeyboardDaemon.create;
3314
+ static create(configuration) {
3315
+ if (configuration === undefined || configuration === true) {
3316
+ configuration = {};
3317
+ }
3318
+ return new KeyboardDaemonExtension(configuration);
3319
+ }
3320
+ constructor(configuration) {
3321
+ this.configuration = configuration;
3322
+ }
3323
+ create(api) {
3324
+ return KeyboardDaemon.create(api, this.configuration);
3302
3325
  }
3303
3326
  }
3304
3327
 
@@ -4078,7 +4101,9 @@ function setDefault(services, configuration) {
4078
4101
  if (!services.daemons) {
4079
4102
  services.daemons = [];
4080
4103
  }
4081
- services.daemons.push(new KeyboardDaemonExtension());
4104
+ if (configuration.keyboard === undefined || configuration.keyboard) {
4105
+ services.daemons.push(KeyboardDaemonExtension.create(configuration.keyboard));
4106
+ }
4082
4107
  }
4083
4108
 
4084
4109
  function throwDepreciatedError(propertyName, groupName) {
package/lib/esm/index.js CHANGED
@@ -73,6 +73,10 @@ class ControlBarApi {
73
73
  }
74
74
  }
75
75
 
76
+ var KeyboardAction;
77
+ (function (KeyboardAction) {
78
+ KeyboardAction["delete"] = "delete";
79
+ })(KeyboardAction || (KeyboardAction = {}));
76
80
  var DefinitionChangeType;
77
81
  (function (DefinitionChangeType) {
78
82
  DefinitionChangeType[DefinitionChangeType["stepNameChanged"] = 1] = "stepNameChanged";
@@ -3265,23 +3269,27 @@ class ControlBarExtension {
3265
3269
  }
3266
3270
  }
3267
3271
 
3268
- const supportedKeys = ['Backspace', 'Delete'];
3269
- const ignoreTagNames = ['INPUT', 'TEXTAREA'];
3272
+ const ignoreTagNames = ['INPUT', 'TEXTAREA', 'SELECT'];
3270
3273
  class KeyboardDaemon {
3271
- static create(api) {
3272
- const controller = new KeyboardDaemon(api.controlBar);
3274
+ static create(api, configuration) {
3275
+ const controller = new KeyboardDaemon(api.controlBar, configuration);
3273
3276
  document.addEventListener('keyup', controller.onKeyUp, false);
3274
3277
  return controller;
3275
3278
  }
3276
- constructor(controlBarApi) {
3279
+ constructor(controlBarApi, configuration) {
3277
3280
  this.controlBarApi = controlBarApi;
3281
+ this.configuration = configuration;
3278
3282
  this.onKeyUp = (e) => {
3279
- if (!supportedKeys.includes(e.key)) {
3283
+ const action = detectAction(e);
3284
+ if (!action) {
3280
3285
  return;
3281
3286
  }
3282
3287
  if (document.activeElement && ignoreTagNames.includes(document.activeElement.tagName)) {
3283
3288
  return;
3284
3289
  }
3290
+ if (this.configuration.canHandleKey && !this.configuration.canHandleKey(action, e)) {
3291
+ return;
3292
+ }
3285
3293
  const isDeletable = this.controlBarApi.canDelete();
3286
3294
  if (isDeletable) {
3287
3295
  e.preventDefault();
@@ -3293,11 +3301,26 @@ class KeyboardDaemon {
3293
3301
  destroy() {
3294
3302
  document.removeEventListener('keyup', this.onKeyUp, false);
3295
3303
  }
3304
+ }
3305
+ function detectAction(e) {
3306
+ if (e.key === 'Backspace' || e.key === 'Delete') {
3307
+ return KeyboardAction.delete;
3308
+ }
3309
+ return null;
3296
3310
  }
3297
3311
 
3298
3312
  class KeyboardDaemonExtension {
3299
- constructor() {
3300
- this.create = KeyboardDaemon.create;
3313
+ static create(configuration) {
3314
+ if (configuration === undefined || configuration === true) {
3315
+ configuration = {};
3316
+ }
3317
+ return new KeyboardDaemonExtension(configuration);
3318
+ }
3319
+ constructor(configuration) {
3320
+ this.configuration = configuration;
3321
+ }
3322
+ create(api) {
3323
+ return KeyboardDaemon.create(api, this.configuration);
3301
3324
  }
3302
3325
  }
3303
3326
 
@@ -4077,7 +4100,9 @@ function setDefault(services, configuration) {
4077
4100
  if (!services.daemons) {
4078
4101
  services.daemons = [];
4079
4102
  }
4080
- services.daemons.push(new KeyboardDaemonExtension());
4103
+ if (configuration.keyboard === undefined || configuration.keyboard) {
4104
+ services.daemons.push(KeyboardDaemonExtension.create(configuration.keyboard));
4105
+ }
4081
4106
  }
4082
4107
 
4083
4108
  function throwDepreciatedError(propertyName, groupName) {
@@ -4317,4 +4342,4 @@ class StepsDesignerExtension {
4317
4342
  class StepsExtension extends StepsDesignerExtension {
4318
4343
  }
4319
4344
 
4320
- export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ControlBarApi, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, RegionView, ServicesResolver, SimpleEvent, StepComponent, StepExtensionResolver, StepsDesignerExtension, StepsExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
4345
+ export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ControlBarApi, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, RegionView, ServicesResolver, SimpleEvent, StepComponent, StepExtensionResolver, StepsDesignerExtension, StepsExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
package/lib/index.d.ts CHANGED
@@ -850,6 +850,10 @@ interface DesignerConfiguration<TDefinition extends Definition = Definition> {
850
850
  * @description The configuration of validators.
851
851
  */
852
852
  validator?: ValidatorConfiguration;
853
+ /**
854
+ * @description The configuration of the keyboard shortcuts. By default, the keyboard shortcuts are enabled (`true`). If `false`, the keyboard shortcuts are disabled.
855
+ */
856
+ keyboard?: boolean | KeyboardConfiguration;
853
857
  /**
854
858
  * @description The handler that handles custom actions.
855
859
  */
@@ -932,6 +936,12 @@ interface ValidatorConfiguration {
932
936
  }
933
937
  type StepValidator = (step: Step, parentSequence: Sequence, definition: Definition) => boolean;
934
938
  type RootValidator = (definition: Definition) => boolean;
939
+ interface KeyboardConfiguration {
940
+ canHandleKey?: (action: KeyboardAction, event: KeyboardEvent) => boolean;
941
+ }
942
+ declare enum KeyboardAction {
943
+ delete = "delete"
944
+ }
935
945
  interface EditorsConfiguration<TDefinition extends Definition = Definition> {
936
946
  isCollapsed?: boolean;
937
947
  stepEditorProvider: StepEditorProvider<TDefinition>;
@@ -1169,4 +1179,4 @@ declare class StepsExtension extends StepsDesignerExtension {
1169
1179
  interface StepsExtensionConfiguration extends StepsDesignerExtensionConfiguration {
1170
1180
  }
1171
1181
 
1172
- export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentView, ContainerStep, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ControlBarApi, CustomAction, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, GlobalEditorContext, GlobalEditorProvider, Grid, GridExtension, Icons, InputView, JoinView, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, StepsExtension, StepsExtensionConfiguration, SwitchStep, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStep, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
1182
+ export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentView, ContainerStep, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ControlBarApi, CustomAction, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, GlobalEditorContext, GlobalEditorProvider, Grid, GridExtension, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionView, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, StepsExtension, StepsExtensionConfiguration, SwitchStep, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, TaskStep, TaskStepComponentViewConfiguration, TaskStepExtensionConfiguration, ToolboxApi, ToolboxConfiguration, ToolboxGroupConfiguration, TriggerCustomActionClickCommand, UiComponent, UiComponentExtension, Uid, UidGenerator, UndoStack, UndoStackItem, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sequential-workflow-designer",
3
3
  "description": "Customizable no-code component for building flow-based programming applications.",
4
- "version": "0.16.8",
4
+ "version": "0.16.9",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "types": "./lib/index.d.ts",