sequential-workflow-designer 0.24.4 → 0.24.6
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 +4 -4
- package/dist/index.umd.js +107 -73
- package/lib/cjs/index.cjs +107 -73
- package/lib/esm/index.js +107 -73
- package/lib/index.d.ts +19 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,10 +103,10 @@ Add the below code to your head section in HTML document.
|
|
|
103
103
|
```html
|
|
104
104
|
<head>
|
|
105
105
|
...
|
|
106
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.
|
|
107
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.
|
|
108
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.
|
|
109
|
-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.
|
|
106
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.6/css/designer.css" rel="stylesheet">
|
|
107
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.6/css/designer-light.css" rel="stylesheet">
|
|
108
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.6/css/designer-dark.css" rel="stylesheet">
|
|
109
|
+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.6/dist/index.umd.js"></script>
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
Call the designer by:
|
package/dist/index.umd.js
CHANGED
|
@@ -405,17 +405,19 @@
|
|
|
405
405
|
|
|
406
406
|
class DragStepView {
|
|
407
407
|
static create(step, theme, componentContext) {
|
|
408
|
+
var _a;
|
|
409
|
+
const body = (_a = componentContext.shadowRoot) !== null && _a !== void 0 ? _a : document.body;
|
|
408
410
|
const layer = Dom.element('div', {
|
|
409
411
|
class: `sqd-drag sqd-theme-${theme}`
|
|
410
412
|
});
|
|
411
|
-
|
|
413
|
+
body.appendChild(layer);
|
|
412
414
|
const component = componentContext.services.draggedComponent.create(layer, step, componentContext);
|
|
413
|
-
return new DragStepView(component, layer,
|
|
415
|
+
return new DragStepView(component, layer, body);
|
|
414
416
|
}
|
|
415
|
-
constructor(component, layer,
|
|
417
|
+
constructor(component, layer, body) {
|
|
416
418
|
this.component = component;
|
|
417
419
|
this.layer = layer;
|
|
418
|
-
this.
|
|
420
|
+
this.body = body;
|
|
419
421
|
}
|
|
420
422
|
setPosition(position) {
|
|
421
423
|
this.layer.style.top = position.y + 'px';
|
|
@@ -423,7 +425,7 @@
|
|
|
423
425
|
}
|
|
424
426
|
remove() {
|
|
425
427
|
this.component.destroy();
|
|
426
|
-
this.
|
|
428
|
+
this.body.removeChild(this.layer);
|
|
427
429
|
}
|
|
428
430
|
}
|
|
429
431
|
|
|
@@ -728,11 +730,10 @@
|
|
|
728
730
|
const viewportController = context.services.viewportController.create(workspace);
|
|
729
731
|
const viewport = new ViewportApi(context.workspaceController, viewportController);
|
|
730
732
|
const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);
|
|
731
|
-
return new DesignerApi(context.
|
|
733
|
+
return new DesignerApi(context.configuration.shadowRoot, 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);
|
|
732
734
|
}
|
|
733
|
-
constructor(
|
|
734
|
-
this.
|
|
735
|
-
this.documentBody = documentBody;
|
|
735
|
+
constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {
|
|
736
|
+
this.shadowRoot = shadowRoot;
|
|
736
737
|
this.controlBar = controlBar;
|
|
737
738
|
this.toolbox = toolbox;
|
|
738
739
|
this.editor = editor;
|
|
@@ -971,15 +972,14 @@
|
|
|
971
972
|
}
|
|
972
973
|
|
|
973
974
|
class ComponentContext {
|
|
974
|
-
static create(
|
|
975
|
+
static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {
|
|
975
976
|
const validator = new DefinitionValidator(configuration.validator, state);
|
|
976
977
|
const iconProvider = new IconProvider(configuration.steps);
|
|
977
978
|
const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);
|
|
978
|
-
return new ComponentContext(
|
|
979
|
+
return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);
|
|
979
980
|
}
|
|
980
|
-
constructor(
|
|
981
|
-
this.
|
|
982
|
-
this.documentBody = documentBody;
|
|
981
|
+
constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {
|
|
982
|
+
this.shadowRoot = shadowRoot;
|
|
983
983
|
this.validator = validator;
|
|
984
984
|
this.iconProvider = iconProvider;
|
|
985
985
|
this.placeholderController = placeholderController;
|
|
@@ -1706,6 +1706,12 @@
|
|
|
1706
1706
|
|
|
1707
1707
|
class CenteredViewportCalculator {
|
|
1708
1708
|
static center(margin, canvasSize, rootComponentSize) {
|
|
1709
|
+
if (canvasSize.x === 0 || canvasSize.y === 0) {
|
|
1710
|
+
return {
|
|
1711
|
+
position: new Vector(0, 0),
|
|
1712
|
+
scale: 1
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1709
1715
|
const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
|
|
1710
1716
|
const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);
|
|
1711
1717
|
const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);
|
|
@@ -2237,32 +2243,41 @@
|
|
|
2237
2243
|
passive: false
|
|
2238
2244
|
};
|
|
2239
2245
|
class BehaviorController {
|
|
2240
|
-
|
|
2241
|
-
|
|
2246
|
+
static create(shadowRoot) {
|
|
2247
|
+
return new BehaviorController(shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document, shadowRoot);
|
|
2248
|
+
}
|
|
2249
|
+
constructor(dom, shadowRoot) {
|
|
2250
|
+
this.dom = dom;
|
|
2251
|
+
this.shadowRoot = shadowRoot;
|
|
2242
2252
|
this.onMouseMove = (e) => {
|
|
2243
2253
|
e.preventDefault();
|
|
2254
|
+
e.stopPropagation();
|
|
2244
2255
|
this.move(readMousePosition(e));
|
|
2245
2256
|
};
|
|
2246
2257
|
this.onTouchMove = (e) => {
|
|
2247
2258
|
e.preventDefault();
|
|
2259
|
+
e.stopPropagation();
|
|
2248
2260
|
this.move(readTouchPosition(e));
|
|
2249
2261
|
};
|
|
2250
2262
|
this.onMouseUp = (e) => {
|
|
2251
2263
|
e.preventDefault();
|
|
2264
|
+
e.stopPropagation();
|
|
2252
2265
|
this.stop(false, e.target);
|
|
2253
2266
|
};
|
|
2254
2267
|
this.onTouchEnd = (e) => {
|
|
2255
2268
|
var _a;
|
|
2256
2269
|
e.preventDefault();
|
|
2270
|
+
e.stopPropagation();
|
|
2257
2271
|
if (!this.state) {
|
|
2258
2272
|
throw new Error(notInitializedError);
|
|
2259
2273
|
}
|
|
2260
2274
|
const position = (_a = this.state.lastPosition) !== null && _a !== void 0 ? _a : this.state.startPosition;
|
|
2261
|
-
const element = this.
|
|
2275
|
+
const element = this.dom.elementFromPoint(position.x, position.y);
|
|
2262
2276
|
this.stop(false, element);
|
|
2263
2277
|
};
|
|
2264
2278
|
this.onTouchStart = (e) => {
|
|
2265
2279
|
e.preventDefault();
|
|
2280
|
+
e.stopPropagation();
|
|
2266
2281
|
if (e.touches.length !== 1) {
|
|
2267
2282
|
this.stop(true, null);
|
|
2268
2283
|
}
|
|
@@ -2278,11 +2293,24 @@
|
|
|
2278
2293
|
behavior
|
|
2279
2294
|
};
|
|
2280
2295
|
behavior.onStart(this.state.startPosition);
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2296
|
+
if (this.shadowRoot) {
|
|
2297
|
+
this.bind(this.shadowRoot);
|
|
2298
|
+
}
|
|
2299
|
+
this.bind(window);
|
|
2300
|
+
}
|
|
2301
|
+
bind(target) {
|
|
2302
|
+
target.addEventListener('mousemove', this.onMouseMove, false);
|
|
2303
|
+
target.addEventListener('touchmove', this.onTouchMove, nonPassiveOptions);
|
|
2304
|
+
target.addEventListener('mouseup', this.onMouseUp, false);
|
|
2305
|
+
target.addEventListener('touchend', this.onTouchEnd, nonPassiveOptions);
|
|
2306
|
+
target.addEventListener('touchstart', this.onTouchStart, nonPassiveOptions);
|
|
2307
|
+
}
|
|
2308
|
+
unbind(target) {
|
|
2309
|
+
target.removeEventListener('mousemove', this.onMouseMove, false);
|
|
2310
|
+
target.removeEventListener('touchmove', this.onTouchMove, nonPassiveOptions);
|
|
2311
|
+
target.removeEventListener('mouseup', this.onMouseUp, false);
|
|
2312
|
+
target.removeEventListener('touchend', this.onTouchEnd, nonPassiveOptions);
|
|
2313
|
+
target.removeEventListener('touchstart', this.onTouchStart, nonPassiveOptions);
|
|
2286
2314
|
}
|
|
2287
2315
|
move(position) {
|
|
2288
2316
|
if (!this.state) {
|
|
@@ -2302,11 +2330,10 @@
|
|
|
2302
2330
|
if (!this.state) {
|
|
2303
2331
|
throw new Error(notInitializedError);
|
|
2304
2332
|
}
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
window.removeEventListener('touchstart', this.onTouchStart, nonPassiveOptions);
|
|
2333
|
+
if (this.shadowRoot) {
|
|
2334
|
+
this.unbind(this.shadowRoot);
|
|
2335
|
+
}
|
|
2336
|
+
this.unbind(window);
|
|
2310
2337
|
this.state.behavior.onEnd(interrupt, element);
|
|
2311
2338
|
this.state = undefined;
|
|
2312
2339
|
}
|
|
@@ -2669,11 +2696,11 @@
|
|
|
2669
2696
|
}
|
|
2670
2697
|
|
|
2671
2698
|
class LayoutController {
|
|
2672
|
-
constructor(
|
|
2673
|
-
this.
|
|
2699
|
+
constructor(placeholder) {
|
|
2700
|
+
this.placeholder = placeholder;
|
|
2674
2701
|
}
|
|
2675
2702
|
isMobile() {
|
|
2676
|
-
return this.
|
|
2703
|
+
return this.placeholder.clientWidth < 400; // TODO
|
|
2677
2704
|
}
|
|
2678
2705
|
}
|
|
2679
2706
|
|
|
@@ -2730,18 +2757,18 @@
|
|
|
2730
2757
|
}
|
|
2731
2758
|
|
|
2732
2759
|
class DesignerContext {
|
|
2733
|
-
static create(
|
|
2760
|
+
static create(placeholder, startDefinition, configuration, services) {
|
|
2734
2761
|
var _a, _b, _c, _d, _e;
|
|
2735
2762
|
const definition = ObjectCloner.deepClone(startDefinition);
|
|
2736
|
-
const layoutController = new LayoutController(
|
|
2737
|
-
const isReadonly =
|
|
2763
|
+
const layoutController = new LayoutController(placeholder);
|
|
2764
|
+
const isReadonly = Boolean(configuration.isReadonly);
|
|
2738
2765
|
const isToolboxCollapsed = configuration.toolbox ? (_a = configuration.toolbox.isCollapsed) !== null && _a !== void 0 ? _a : layoutController.isMobile() : false;
|
|
2739
2766
|
const isEditorCollapsed = configuration.editors ? (_b = configuration.editors.isCollapsed) !== null && _b !== void 0 ? _b : layoutController.isMobile() : false;
|
|
2740
2767
|
const theme = configuration.theme || 'light';
|
|
2741
2768
|
const state = new DesignerState(definition, isReadonly, isToolboxCollapsed, isEditorCollapsed);
|
|
2742
2769
|
const workspaceController = new WorkspaceControllerWrapper();
|
|
2743
2770
|
const placeholderController = services.placeholderController.create();
|
|
2744
|
-
const behaviorController =
|
|
2771
|
+
const behaviorController = BehaviorController.create(configuration.shadowRoot);
|
|
2745
2772
|
const stepExtensionResolver = StepExtensionResolver.create(services);
|
|
2746
2773
|
const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new DefinitionWalker();
|
|
2747
2774
|
const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);
|
|
@@ -2752,12 +2779,10 @@
|
|
|
2752
2779
|
historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);
|
|
2753
2780
|
}
|
|
2754
2781
|
const preferenceStorage = (_e = configuration.preferenceStorage) !== null && _e !== void 0 ? _e : new MemoryPreferenceStorage();
|
|
2755
|
-
const componentContext = ComponentContext.create(
|
|
2756
|
-
return new DesignerContext(
|
|
2782
|
+
const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services);
|
|
2783
|
+
return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);
|
|
2757
2784
|
}
|
|
2758
|
-
constructor(
|
|
2759
|
-
this.documentOrShadowRoot = documentOrShadowRoot;
|
|
2760
|
-
this.documentBody = documentBody;
|
|
2785
|
+
constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {
|
|
2761
2786
|
this.theme = theme;
|
|
2762
2787
|
this.state = state;
|
|
2763
2788
|
this.configuration = configuration;
|
|
@@ -2803,8 +2828,8 @@
|
|
|
2803
2828
|
});
|
|
2804
2829
|
}
|
|
2805
2830
|
|
|
2806
|
-
function isElementAttached(
|
|
2807
|
-
return !(
|
|
2831
|
+
function isElementAttached(dom, element) {
|
|
2832
|
+
return !(dom.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_DISCONNECTED);
|
|
2808
2833
|
}
|
|
2809
2834
|
|
|
2810
2835
|
let lastGridPatternId = 0;
|
|
@@ -2838,12 +2863,12 @@
|
|
|
2838
2863
|
canvas.appendChild(foreground);
|
|
2839
2864
|
workspace.appendChild(canvas);
|
|
2840
2865
|
parent.appendChild(workspace);
|
|
2841
|
-
const view = new WorkspaceView(componentContext.
|
|
2866
|
+
const view = new WorkspaceView(componentContext.shadowRoot, workspace, canvas, pattern, gridPattern, foreground, componentContext);
|
|
2842
2867
|
window.addEventListener('resize', view.onResizeHandler, false);
|
|
2843
2868
|
return view;
|
|
2844
2869
|
}
|
|
2845
|
-
constructor(
|
|
2846
|
-
this.
|
|
2870
|
+
constructor(shadowRoot, workspace, canvas, pattern, gridPattern, foreground, context) {
|
|
2871
|
+
this.shadowRoot = shadowRoot;
|
|
2847
2872
|
this.workspace = workspace;
|
|
2848
2873
|
this.canvas = canvas;
|
|
2849
2874
|
this.pattern = pattern;
|
|
@@ -2884,9 +2909,11 @@
|
|
|
2884
2909
|
handler(readMousePosition(e), e.target, e.button, e.altKey);
|
|
2885
2910
|
}, false);
|
|
2886
2911
|
this.canvas.addEventListener('touchstart', e => {
|
|
2912
|
+
var _a;
|
|
2887
2913
|
e.preventDefault();
|
|
2888
2914
|
const clientPosition = readTouchClientPosition(e);
|
|
2889
|
-
const
|
|
2915
|
+
const dom = (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : document;
|
|
2916
|
+
const element = dom.elementFromPoint(clientPosition.x, clientPosition.y);
|
|
2890
2917
|
if (element) {
|
|
2891
2918
|
const position = readTouchPosition(e);
|
|
2892
2919
|
handler(position, element, 0, false);
|
|
@@ -3069,7 +3096,7 @@
|
|
|
3069
3096
|
}
|
|
3070
3097
|
|
|
3071
3098
|
class ContextMenu {
|
|
3072
|
-
static create(
|
|
3099
|
+
static create(shadowRoot, position, theme, items) {
|
|
3073
3100
|
const menu = document.createElement('div');
|
|
3074
3101
|
menu.style.left = `${position.x}px`;
|
|
3075
3102
|
menu.style.top = `${position.y}px`;
|
|
@@ -3089,16 +3116,19 @@
|
|
|
3089
3116
|
elements.push(element);
|
|
3090
3117
|
menu.appendChild(element);
|
|
3091
3118
|
}
|
|
3092
|
-
const
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3119
|
+
const body = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document.body;
|
|
3120
|
+
const dom = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document;
|
|
3121
|
+
const instance = new ContextMenu(body, dom, menu, elements, items, Date.now());
|
|
3122
|
+
dom.addEventListener('mousedown', instance.mouseDown, false);
|
|
3123
|
+
dom.addEventListener('mouseup', instance.mouseUp, false);
|
|
3124
|
+
dom.addEventListener('touchstart', instance.mouseDown, false);
|
|
3125
|
+
dom.addEventListener('touchend', instance.mouseUp, false);
|
|
3126
|
+
body.appendChild(menu);
|
|
3098
3127
|
return instance;
|
|
3099
3128
|
}
|
|
3100
|
-
constructor(
|
|
3101
|
-
this.
|
|
3129
|
+
constructor(body, dom, menu, elements, items, startTime) {
|
|
3130
|
+
this.body = body;
|
|
3131
|
+
this.dom = dom;
|
|
3102
3132
|
this.menu = menu;
|
|
3103
3133
|
this.elements = elements;
|
|
3104
3134
|
this.items = items;
|
|
@@ -3145,19 +3175,18 @@
|
|
|
3145
3175
|
}
|
|
3146
3176
|
tryDestroy() {
|
|
3147
3177
|
if (this.isAttached) {
|
|
3148
|
-
this.
|
|
3149
|
-
this.
|
|
3150
|
-
this.
|
|
3151
|
-
this.
|
|
3152
|
-
this.
|
|
3178
|
+
this.body.removeChild(this.menu);
|
|
3179
|
+
this.dom.removeEventListener('mousedown', this.mouseDown, false);
|
|
3180
|
+
this.dom.removeEventListener('mouseup', this.mouseUp, false);
|
|
3181
|
+
this.dom.removeEventListener('touchstart', this.mouseDown, false);
|
|
3182
|
+
this.dom.removeEventListener('touchend', this.mouseUp, false);
|
|
3153
3183
|
this.isAttached = false;
|
|
3154
3184
|
}
|
|
3155
3185
|
}
|
|
3156
3186
|
}
|
|
3157
3187
|
|
|
3158
3188
|
class ContextMenuController {
|
|
3159
|
-
constructor(
|
|
3160
|
-
this.documentBody = documentBody;
|
|
3189
|
+
constructor(theme, configuration, itemsBuilder) {
|
|
3161
3190
|
this.theme = theme;
|
|
3162
3191
|
this.configuration = configuration;
|
|
3163
3192
|
this.itemsBuilder = itemsBuilder;
|
|
@@ -3171,7 +3200,7 @@
|
|
|
3171
3200
|
this.current.tryDestroy();
|
|
3172
3201
|
}
|
|
3173
3202
|
const items = this.itemsBuilder.build(commandOrNull);
|
|
3174
|
-
this.current = ContextMenu.create(this.
|
|
3203
|
+
this.current = ContextMenu.create(this.configuration.shadowRoot, position, this.theme, items);
|
|
3175
3204
|
}
|
|
3176
3205
|
destroy() {
|
|
3177
3206
|
if (this.current) {
|
|
@@ -3273,7 +3302,7 @@
|
|
|
3273
3302
|
const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)
|
|
3274
3303
|
? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)
|
|
3275
3304
|
: undefined);
|
|
3276
|
-
const contextMenuController = new ContextMenuController(designerContext.
|
|
3305
|
+
const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);
|
|
3277
3306
|
const workspace = new Workspace(view, designerContext.definitionWalker, designerContext.state, designerContext.behaviorController, wheelController, contextMenuController, clickBehaviorResolver, api.viewport, designerContext.services);
|
|
3278
3307
|
setTimeout(() => {
|
|
3279
3308
|
workspace.updateRootComponent();
|
|
@@ -3704,12 +3733,13 @@
|
|
|
3704
3733
|
const ignoreTagNames = ['INPUT', 'TEXTAREA', 'SELECT'];
|
|
3705
3734
|
class KeyboardDaemon {
|
|
3706
3735
|
static create(api, configuration) {
|
|
3707
|
-
const
|
|
3708
|
-
|
|
3736
|
+
const dom = api.shadowRoot || document;
|
|
3737
|
+
const controller = new KeyboardDaemon(dom, api.controlBar, configuration);
|
|
3738
|
+
dom.addEventListener('keyup', controller.onKeyUp, false);
|
|
3709
3739
|
return controller;
|
|
3710
3740
|
}
|
|
3711
|
-
constructor(
|
|
3712
|
-
this.
|
|
3741
|
+
constructor(dom, controlBarApi, configuration) {
|
|
3742
|
+
this.dom = dom;
|
|
3713
3743
|
this.controlBarApi = controlBarApi;
|
|
3714
3744
|
this.configuration = configuration;
|
|
3715
3745
|
this.onKeyUp = (e) => {
|
|
@@ -3733,7 +3763,7 @@
|
|
|
3733
3763
|
};
|
|
3734
3764
|
}
|
|
3735
3765
|
destroy() {
|
|
3736
|
-
this.
|
|
3766
|
+
this.dom.removeEventListener('keyup', this.onKeyUp, false);
|
|
3737
3767
|
}
|
|
3738
3768
|
}
|
|
3739
3769
|
function detectAction(e) {
|
|
@@ -4581,7 +4611,7 @@
|
|
|
4581
4611
|
* @returns An instance of the designer.
|
|
4582
4612
|
*/
|
|
4583
4613
|
static create(placeholder, startDefinition, configuration) {
|
|
4584
|
-
var _a
|
|
4614
|
+
var _a;
|
|
4585
4615
|
if (!placeholder) {
|
|
4586
4616
|
throw new Error('Placeholder is not defined');
|
|
4587
4617
|
}
|
|
@@ -4590,13 +4620,11 @@
|
|
|
4590
4620
|
}
|
|
4591
4621
|
const config = configuration;
|
|
4592
4622
|
validateConfiguration(config);
|
|
4593
|
-
|
|
4594
|
-
const documentBody = (_b = configuration.documentBody) !== null && _b !== void 0 ? _b : document.body;
|
|
4595
|
-
if (!isElementAttached(placeholder, documentBody)) {
|
|
4623
|
+
if (!isElementAttached((_a = config.shadowRoot) !== null && _a !== void 0 ? _a : document, placeholder)) {
|
|
4596
4624
|
throw new Error('Placeholder is not attached to the DOM');
|
|
4597
4625
|
}
|
|
4598
4626
|
const services = ServicesResolver.resolve(configuration.extensions, config);
|
|
4599
|
-
const designerContext = DesignerContext.create(
|
|
4627
|
+
const designerContext = DesignerContext.create(placeholder, startDefinition, config, services);
|
|
4600
4628
|
const designerApi = DesignerApi.create(designerContext);
|
|
4601
4629
|
const view = DesignerView.create(placeholder, designerContext, designerApi);
|
|
4602
4630
|
const designer = new Designer(view, designerContext.state, designerContext.stateModifier, designerContext.definitionWalker, designerContext.historyController, designerApi);
|
|
@@ -4695,6 +4723,12 @@
|
|
|
4695
4723
|
setViewport(viewport) {
|
|
4696
4724
|
this.state.setViewport(viewport);
|
|
4697
4725
|
}
|
|
4726
|
+
/**
|
|
4727
|
+
* @description Resets the viewport.
|
|
4728
|
+
*/
|
|
4729
|
+
resetViewport() {
|
|
4730
|
+
this.api.viewport.resetViewport();
|
|
4731
|
+
}
|
|
4698
4732
|
/**
|
|
4699
4733
|
* @description Unselects the selected step.
|
|
4700
4734
|
*/
|