sequential-workflow-designer 0.15.2
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/LICENSE +9 -0
- package/README.md +228 -0
- package/css/.gitkeep +0 -0
- package/css/designer-dark.css +192 -0
- package/css/designer-light.css +192 -0
- package/css/designer-theme.css +1 -0
- package/css/designer.css +284 -0
- package/dist/index.umd.js +4497 -0
- package/lib/cjs/index.cjs +4315 -0
- package/lib/esm/index.js +4266 -0
- package/lib/index.d.ts +1129 -0
- package/package.json +107 -0
- package/sass/designer-dark.scss +68 -0
- package/sass/designer-light.scss +20 -0
- package/sass/designer-theme.scss +378 -0
- package/sass/designer.scss +257 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,1129 @@
|
|
|
1
|
+
import { Step, BranchedStep, SequentialStep, Definition, Sequence, ComponentType, DefinitionWalker, StepOrName } from 'sequential-workflow-model';
|
|
2
|
+
export * from 'sequential-workflow-model';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use {@link Step} instead.
|
|
6
|
+
*/
|
|
7
|
+
interface TaskStep extends Step {
|
|
8
|
+
componentType: 'task';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use {@link BranchedStep} instead.
|
|
12
|
+
*/
|
|
13
|
+
interface SwitchStep extends BranchedStep {
|
|
14
|
+
componentType: 'switch';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use {@link SequentialStep} instead.
|
|
18
|
+
*/
|
|
19
|
+
interface ContainerStep extends SequentialStep {
|
|
20
|
+
componentType: 'container';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare class Vector {
|
|
24
|
+
readonly x: number;
|
|
25
|
+
readonly y: number;
|
|
26
|
+
constructor(x: number, y: number);
|
|
27
|
+
add(v: Vector): Vector;
|
|
28
|
+
subtract(v: Vector): Vector;
|
|
29
|
+
multiplyByScalar(s: number): Vector;
|
|
30
|
+
divideByScalar(s: number): Vector;
|
|
31
|
+
round(): Vector;
|
|
32
|
+
distance(): number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Behavior {
|
|
36
|
+
onStart(position: Vector): void;
|
|
37
|
+
onMove(delta: Vector): Behavior | void;
|
|
38
|
+
onEnd(interrupt: boolean, element: Element | null): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare class BehaviorController {
|
|
42
|
+
private state?;
|
|
43
|
+
start(startPosition: Vector, behavior: Behavior): void;
|
|
44
|
+
private readonly onMouseMove;
|
|
45
|
+
private readonly onTouchMove;
|
|
46
|
+
private readonly onMouseUp;
|
|
47
|
+
private readonly onTouchEnd;
|
|
48
|
+
private readonly onTouchStart;
|
|
49
|
+
private move;
|
|
50
|
+
private stop;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare class SimpleEvent<T> {
|
|
54
|
+
private readonly listeners;
|
|
55
|
+
subscribe(listener: SimpleEventListener<T>): void;
|
|
56
|
+
unsubscribe(listener: SimpleEventListener<T>): void;
|
|
57
|
+
forward(value: T): void;
|
|
58
|
+
count(): number;
|
|
59
|
+
}
|
|
60
|
+
type SimpleEventListener<T> = (value: T) => void;
|
|
61
|
+
|
|
62
|
+
interface DefinitionChangedEvent {
|
|
63
|
+
changeType: DefinitionChangeType;
|
|
64
|
+
stepId: string | null;
|
|
65
|
+
}
|
|
66
|
+
declare enum DefinitionChangeType {
|
|
67
|
+
stepNameChanged = 1,
|
|
68
|
+
stepPropertyChanged = 2,
|
|
69
|
+
stepChildrenChanged = 3,
|
|
70
|
+
stepDeleted = 4,
|
|
71
|
+
stepMoved = 5,
|
|
72
|
+
stepInserted = 6,
|
|
73
|
+
globalPropertyChanged = 7,
|
|
74
|
+
rootReplaced = 8
|
|
75
|
+
}
|
|
76
|
+
declare class DesignerState {
|
|
77
|
+
definition: Definition;
|
|
78
|
+
isReadonly: boolean;
|
|
79
|
+
isToolboxCollapsed: boolean;
|
|
80
|
+
isEditorCollapsed: boolean;
|
|
81
|
+
readonly onViewportChanged: SimpleEvent<Viewport>;
|
|
82
|
+
readonly onSelectedStepIdChanged: SimpleEvent<string | null>;
|
|
83
|
+
readonly onFolderPathChanged: SimpleEvent<string[]>;
|
|
84
|
+
readonly onIsReadonlyChanged: SimpleEvent<boolean>;
|
|
85
|
+
readonly onIsDraggingChanged: SimpleEvent<boolean>;
|
|
86
|
+
readonly onIsDragDisabledChanged: SimpleEvent<boolean>;
|
|
87
|
+
readonly onDefinitionChanged: SimpleEvent<DefinitionChangedEvent>;
|
|
88
|
+
readonly onIsToolboxCollapsedChanged: SimpleEvent<boolean>;
|
|
89
|
+
readonly onIsEditorCollapsedChanged: SimpleEvent<boolean>;
|
|
90
|
+
viewport: Viewport;
|
|
91
|
+
selectedStepId: string | null;
|
|
92
|
+
folderPath: string[];
|
|
93
|
+
isDragging: boolean;
|
|
94
|
+
isDragDisabled: boolean;
|
|
95
|
+
constructor(definition: Definition, isReadonly: boolean, isToolboxCollapsed: boolean, isEditorCollapsed: boolean);
|
|
96
|
+
setSelectedStepId(stepId: string | null): void;
|
|
97
|
+
pushStepIdToFolderPath(stepId: string): void;
|
|
98
|
+
setFolderPath(path: string[]): void;
|
|
99
|
+
tryGetLastStepIdFromFolderPath(): string | null;
|
|
100
|
+
setDefinition(definition: Definition): void;
|
|
101
|
+
notifyDefinitionChanged(changeType: DefinitionChangeType, stepId: string | null): void;
|
|
102
|
+
setViewport(viewport: Viewport): void;
|
|
103
|
+
setIsReadonly(isReadonly: boolean): void;
|
|
104
|
+
setIsDragging(isDragging: boolean): void;
|
|
105
|
+
toggleIsDragDisabled(): void;
|
|
106
|
+
setIsToolboxCollapsed(isCollapsed: boolean): void;
|
|
107
|
+
setIsEditorCollapsed(isCollapsed: boolean): void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare class DefinitionValidator {
|
|
111
|
+
private readonly configuration;
|
|
112
|
+
private readonly state;
|
|
113
|
+
constructor(configuration: ValidatorConfiguration | undefined, state: DesignerState);
|
|
114
|
+
validateStep(step: Step, parentSequence: Sequence): boolean;
|
|
115
|
+
validateRoot(): boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare class IconProvider {
|
|
119
|
+
private readonly configuration;
|
|
120
|
+
constructor(configuration: StepsConfiguration);
|
|
121
|
+
getIconUrl(step: StepDefinition): string | null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type Services = Required<DesignerExtension>;
|
|
125
|
+
declare class ServicesResolver {
|
|
126
|
+
static resolve(extensions: DesignerExtension[] | undefined, configuration: DesignerConfiguration): Services;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare class StepExtensionResolver {
|
|
130
|
+
private readonly dict;
|
|
131
|
+
static create(services: Services): StepExtensionResolver;
|
|
132
|
+
private constructor();
|
|
133
|
+
resolve(componentType: ComponentType): StepExtension<Step>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface Component {
|
|
137
|
+
view: ComponentView;
|
|
138
|
+
findById(stepId: string): StepComponent | null;
|
|
139
|
+
resolveClick(click: ClickDetails): ClickCommand | null;
|
|
140
|
+
getPlaceholders(result: Placeholder[]): void;
|
|
141
|
+
setIsDragging(isDragging: boolean): void;
|
|
142
|
+
updateBadges(result: BadgesResult): void;
|
|
143
|
+
}
|
|
144
|
+
interface ComponentView {
|
|
145
|
+
g: SVGGElement;
|
|
146
|
+
width: number;
|
|
147
|
+
height: number;
|
|
148
|
+
joinX: number;
|
|
149
|
+
}
|
|
150
|
+
interface StepComponentView extends ComponentView {
|
|
151
|
+
sequenceComponents: SequenceComponent[] | null;
|
|
152
|
+
placeholders: Placeholder[] | null;
|
|
153
|
+
hasOutput(): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* @param click Details about the click.
|
|
156
|
+
* @returns `true` if selected a step, a click command if clicked a specific action, `null` if not clicked at this view.
|
|
157
|
+
*/
|
|
158
|
+
resolveClick(click: ClickDetails): true | ClickCommand | null;
|
|
159
|
+
setIsDragging(isDragging: boolean): void;
|
|
160
|
+
setIsSelected(isSelected: boolean): void;
|
|
161
|
+
setIsDisabled(isDisabled: boolean): void;
|
|
162
|
+
getClientPosition(): Vector;
|
|
163
|
+
}
|
|
164
|
+
interface SequenceComponent extends Component {
|
|
165
|
+
hasOutput: boolean;
|
|
166
|
+
}
|
|
167
|
+
interface ClickDetails {
|
|
168
|
+
element: Element;
|
|
169
|
+
position: Vector;
|
|
170
|
+
scale: number;
|
|
171
|
+
}
|
|
172
|
+
type ClickCommand = SelectStepClickCommand | RerenderStepClickCommand | OpenFolderClickCommand | TriggerCustomActionClickCommand;
|
|
173
|
+
interface BaseClickCommand {
|
|
174
|
+
type: ClickCommandType;
|
|
175
|
+
}
|
|
176
|
+
interface SelectStepClickCommand extends BaseClickCommand {
|
|
177
|
+
type: ClickCommandType.selectStep;
|
|
178
|
+
component: StepComponent;
|
|
179
|
+
}
|
|
180
|
+
interface RerenderStepClickCommand extends BaseClickCommand {
|
|
181
|
+
type: ClickCommandType.rerenderStep;
|
|
182
|
+
step: Step;
|
|
183
|
+
}
|
|
184
|
+
interface OpenFolderClickCommand extends BaseClickCommand {
|
|
185
|
+
type: ClickCommandType.openFolder;
|
|
186
|
+
step: Step;
|
|
187
|
+
}
|
|
188
|
+
interface TriggerCustomActionClickCommand extends BaseClickCommand {
|
|
189
|
+
type: ClickCommandType.triggerCustomAction;
|
|
190
|
+
step: Step | null;
|
|
191
|
+
sequence: Sequence;
|
|
192
|
+
action: CustomAction;
|
|
193
|
+
}
|
|
194
|
+
declare enum ClickCommandType {
|
|
195
|
+
selectStep = 1,
|
|
196
|
+
rerenderStep = 2,
|
|
197
|
+
openFolder = 3,
|
|
198
|
+
triggerCustomAction = 4
|
|
199
|
+
}
|
|
200
|
+
interface BadgeView {
|
|
201
|
+
g: SVGGElement;
|
|
202
|
+
width: number;
|
|
203
|
+
height: number;
|
|
204
|
+
}
|
|
205
|
+
interface Badge {
|
|
206
|
+
view: BadgeView | null;
|
|
207
|
+
update(result: unknown): unknown;
|
|
208
|
+
resolveClick(click: ClickDetails): ClickCommand | null;
|
|
209
|
+
}
|
|
210
|
+
type BadgesResult = unknown[];
|
|
211
|
+
interface Placeholder {
|
|
212
|
+
view: PlaceholderView;
|
|
213
|
+
parentSequence: Sequence;
|
|
214
|
+
index: number;
|
|
215
|
+
getClientRect(): DOMRect;
|
|
216
|
+
setIsHover(isHover: boolean): void;
|
|
217
|
+
setIsVisible(isVisible: boolean): void;
|
|
218
|
+
resolveClick(click: ClickDetails): ClickCommand | null;
|
|
219
|
+
}
|
|
220
|
+
declare enum PlaceholderDirection {
|
|
221
|
+
none = 0,
|
|
222
|
+
in = 1,
|
|
223
|
+
out = 2
|
|
224
|
+
}
|
|
225
|
+
interface PlaceholderView {
|
|
226
|
+
g: SVGGElement;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
declare class StepComponent implements Component {
|
|
230
|
+
readonly view: StepComponentView;
|
|
231
|
+
readonly step: Step;
|
|
232
|
+
readonly parentSequence: Sequence;
|
|
233
|
+
readonly hasOutput: boolean;
|
|
234
|
+
private readonly badges;
|
|
235
|
+
static create(view: StepComponentView, stepContext: StepContext, componentContext: ComponentContext): StepComponent;
|
|
236
|
+
private isDisabled;
|
|
237
|
+
private constructor();
|
|
238
|
+
findById(stepId: string): StepComponent | null;
|
|
239
|
+
resolveClick(click: ClickDetails): ClickCommand | null;
|
|
240
|
+
getPlaceholders(result: Placeholder[]): void;
|
|
241
|
+
setIsDragging(isDragging: boolean): void;
|
|
242
|
+
setIsSelected(isSelected: boolean): void;
|
|
243
|
+
setIsDisabled(isDisabled: boolean): void;
|
|
244
|
+
updateBadges(result: BadgesResult): void;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare class StepComponentFactory {
|
|
248
|
+
private readonly stepExtensionResolver;
|
|
249
|
+
constructor(stepExtensionResolver: StepExtensionResolver);
|
|
250
|
+
create(parentElement: SVGElement, stepContext: StepContext, componentContext: ComponentContext): StepComponent;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
declare class ComponentContext {
|
|
254
|
+
readonly validator: DefinitionValidator;
|
|
255
|
+
readonly iconProvider: IconProvider;
|
|
256
|
+
readonly placeholderController: PlaceholderController;
|
|
257
|
+
readonly stepComponentFactory: StepComponentFactory;
|
|
258
|
+
readonly services: Services;
|
|
259
|
+
static create(stepsConfiguration: StepsConfiguration, validatorConfiguration: ValidatorConfiguration | undefined, state: DesignerState, stepExtensionResolver: StepExtensionResolver, services: Services): ComponentContext;
|
|
260
|
+
private constructor();
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
declare class HistoryController {
|
|
264
|
+
private readonly state;
|
|
265
|
+
private readonly definitionModifier;
|
|
266
|
+
private readonly stackSize;
|
|
267
|
+
static create(state: DesignerState, definitionModifier: DefinitionModifier, configuration: DesignerConfiguration): HistoryController;
|
|
268
|
+
private readonly stack;
|
|
269
|
+
private currentIndex;
|
|
270
|
+
constructor(state: DesignerState, definitionModifier: DefinitionModifier, stackSize: number);
|
|
271
|
+
canUndo(): boolean;
|
|
272
|
+
undo(): void;
|
|
273
|
+
canRedo(): boolean;
|
|
274
|
+
redo(): void;
|
|
275
|
+
private remember;
|
|
276
|
+
private commit;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
declare class LayoutController {
|
|
280
|
+
private readonly parent;
|
|
281
|
+
constructor(parent: HTMLElement);
|
|
282
|
+
isMobile(): boolean;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
declare class Icons {
|
|
286
|
+
static folderIn: string;
|
|
287
|
+
static folderOut: string;
|
|
288
|
+
static center: string;
|
|
289
|
+
static zoomIn: string;
|
|
290
|
+
static zoomOut: string;
|
|
291
|
+
static undo: string;
|
|
292
|
+
static redo: string;
|
|
293
|
+
static move: string;
|
|
294
|
+
static delete: string;
|
|
295
|
+
static folderUp: string;
|
|
296
|
+
static close: string;
|
|
297
|
+
static options: string;
|
|
298
|
+
static expand: string;
|
|
299
|
+
static alert: string;
|
|
300
|
+
static play: string;
|
|
301
|
+
static stop: string;
|
|
302
|
+
static folder: string;
|
|
303
|
+
static appendPath(parent: SVGElement, pathClassName: string, d: string, size: number): SVGGElement;
|
|
304
|
+
static createSvg(className: string, d: string): SVGElement;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare class ObjectCloner {
|
|
308
|
+
static deepClone<T>(instance: T): T;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
interface Attributes {
|
|
312
|
+
[name: string]: string | number;
|
|
313
|
+
}
|
|
314
|
+
declare class Dom {
|
|
315
|
+
static svg<K extends keyof SVGElementTagNameMap>(name: K, attributes?: Attributes): SVGElementTagNameMap[K];
|
|
316
|
+
static translate(element: SVGElement, x: number, y: number): void;
|
|
317
|
+
static attrs(element: Element, attributes: Attributes): void;
|
|
318
|
+
static element<T extends keyof HTMLElementTagNameMap>(name: T, attributes?: Attributes): HTMLElementTagNameMap[T];
|
|
319
|
+
static toggleClass(element: Element, isEnabled: boolean, className: string): void;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
declare class Uid {
|
|
323
|
+
static next(): string;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
declare function race<A, B, C>(timeout: number, a: SimpleEvent<A>, b: SimpleEvent<B>, c?: SimpleEvent<C>): SimpleEvent<[A?, B?, C?]>;
|
|
327
|
+
|
|
328
|
+
interface WorkspaceController {
|
|
329
|
+
getPlaceholders(): Placeholder[];
|
|
330
|
+
getComponentByStepId(stepId: string): StepComponent;
|
|
331
|
+
getCanvasPosition(): Vector;
|
|
332
|
+
getCanvasSize(): Vector;
|
|
333
|
+
getRootComponentSize(): Vector;
|
|
334
|
+
updateBadges(): void;
|
|
335
|
+
updateRootComponent(): void;
|
|
336
|
+
updateCanvasSize(): void;
|
|
337
|
+
}
|
|
338
|
+
declare class WorkspaceControllerWrapper implements WorkspaceController {
|
|
339
|
+
private controller?;
|
|
340
|
+
set(controller: WorkspaceController): void;
|
|
341
|
+
private get;
|
|
342
|
+
getPlaceholders(): Placeholder[];
|
|
343
|
+
getComponentByStepId(stepId: string): StepComponent;
|
|
344
|
+
getCanvasPosition(): Vector;
|
|
345
|
+
getCanvasSize(): Vector;
|
|
346
|
+
getRootComponentSize(): Vector;
|
|
347
|
+
updateBadges(): void;
|
|
348
|
+
updateRootComponent(): void;
|
|
349
|
+
updateCanvasSize(): void;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
declare class DesignerContext {
|
|
353
|
+
readonly theme: string;
|
|
354
|
+
readonly state: DesignerState;
|
|
355
|
+
readonly configuration: DesignerConfiguration;
|
|
356
|
+
readonly services: Services;
|
|
357
|
+
readonly componentContext: ComponentContext;
|
|
358
|
+
readonly definitionWalker: DefinitionWalker;
|
|
359
|
+
readonly definitionModifier: DefinitionModifier;
|
|
360
|
+
readonly layoutController: LayoutController;
|
|
361
|
+
readonly workspaceController: WorkspaceControllerWrapper;
|
|
362
|
+
readonly behaviorController: BehaviorController;
|
|
363
|
+
readonly historyController: HistoryController | undefined;
|
|
364
|
+
static create(parent: HTMLElement, startDefinition: Definition, configuration: DesignerConfiguration, services: Services): DesignerContext;
|
|
365
|
+
constructor(theme: string, state: DesignerState, configuration: DesignerConfiguration, services: Services, componentContext: ComponentContext, definitionWalker: DefinitionWalker, definitionModifier: DefinitionModifier, layoutController: LayoutController, workspaceController: WorkspaceControllerWrapper, behaviorController: BehaviorController, historyController: HistoryController | undefined);
|
|
366
|
+
setWorkspaceController(controller: WorkspaceController): void;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
type EditorRendererHandler = (step: Step | null) => void;
|
|
370
|
+
declare class EditorRenderer {
|
|
371
|
+
private readonly state;
|
|
372
|
+
private readonly definitionWalker;
|
|
373
|
+
private readonly handler;
|
|
374
|
+
static create(state: DesignerState, definitionWalker: DefinitionWalker, handler: EditorRendererHandler): EditorRenderer;
|
|
375
|
+
private currentStepId;
|
|
376
|
+
private constructor();
|
|
377
|
+
destroy(): void;
|
|
378
|
+
private render;
|
|
379
|
+
private tryRender;
|
|
380
|
+
private onDefinitionChanged;
|
|
381
|
+
private onSelectedStepIdChanged;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
declare class EditorApi {
|
|
385
|
+
private readonly state;
|
|
386
|
+
private readonly definitionWalker;
|
|
387
|
+
private readonly definitionModifier;
|
|
388
|
+
constructor(state: DesignerState, definitionWalker: DefinitionWalker, definitionModifier: DefinitionModifier);
|
|
389
|
+
isCollapsed(): boolean;
|
|
390
|
+
toggleIsCollapsed(): void;
|
|
391
|
+
subscribeIsCollapsed(listener: SimpleEventListener<boolean>): void;
|
|
392
|
+
getDefinition(): Definition;
|
|
393
|
+
runRenderer(rendererHandler: EditorRendererHandler): EditorRenderer;
|
|
394
|
+
createStepEditorContext(stepId: string): StepEditorContext;
|
|
395
|
+
createGlobalEditorContext(): GlobalEditorContext;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
declare class PathBarApi {
|
|
399
|
+
private readonly state;
|
|
400
|
+
private readonly definitionWalker;
|
|
401
|
+
constructor(state: DesignerState, definitionWalker: DefinitionWalker);
|
|
402
|
+
/**
|
|
403
|
+
* @deprecated Don't use this method
|
|
404
|
+
*/
|
|
405
|
+
subscribe(handler: () => void): void;
|
|
406
|
+
setFolderPath(path: string[]): void;
|
|
407
|
+
getFolderPath(): string[];
|
|
408
|
+
getFolderPathStepNames(): string[];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
declare class ToolboxApi {
|
|
412
|
+
private readonly state;
|
|
413
|
+
private readonly designerContext;
|
|
414
|
+
private readonly behaviorController;
|
|
415
|
+
private readonly iconProvider;
|
|
416
|
+
private readonly configuration;
|
|
417
|
+
private readonly uidGenerator;
|
|
418
|
+
constructor(state: DesignerState, designerContext: DesignerContext, behaviorController: BehaviorController, iconProvider: IconProvider, configuration: ToolboxConfiguration | false, uidGenerator: UidGenerator | undefined);
|
|
419
|
+
isCollapsed(): boolean;
|
|
420
|
+
toggleIsCollapsed(): void;
|
|
421
|
+
subscribeIsCollapsed(listener: SimpleEventListener<boolean>): void;
|
|
422
|
+
tryGetIconUrl(step: StepDefinition): string | null;
|
|
423
|
+
getLabel(step: StepDefinition): string;
|
|
424
|
+
filterGroups(filter: string | undefined): ToolboxGroupConfiguration[];
|
|
425
|
+
/**
|
|
426
|
+
* @param position Mouse or touch position.
|
|
427
|
+
* @param step Step definition.
|
|
428
|
+
* @returns If started dragging returns true, otherwise returns false.
|
|
429
|
+
*/
|
|
430
|
+
tryDrag(position: Vector, step: StepDefinition): boolean;
|
|
431
|
+
private activateStep;
|
|
432
|
+
private getConfiguration;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
declare class ViewportApi {
|
|
436
|
+
private readonly workspaceController;
|
|
437
|
+
private readonly viewportController;
|
|
438
|
+
constructor(workspaceController: WorkspaceControllerWrapper, viewportController: ViewportController);
|
|
439
|
+
resetViewport(): void;
|
|
440
|
+
zoom(direction: boolean): void;
|
|
441
|
+
moveViewportToStep(stepId: string): void;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
declare class WorkspaceApi {
|
|
445
|
+
private readonly state;
|
|
446
|
+
private readonly workspaceController;
|
|
447
|
+
constructor(state: DesignerState, workspaceController: WorkspaceControllerWrapper);
|
|
448
|
+
getCanvasPosition(): Vector;
|
|
449
|
+
getCanvasSize(): Vector;
|
|
450
|
+
getRootComponentSize(): Vector;
|
|
451
|
+
getViewport(): Viewport;
|
|
452
|
+
setViewport(viewport: Viewport): void;
|
|
453
|
+
updateRootComponent(): void;
|
|
454
|
+
updateBadges(): void;
|
|
455
|
+
updateCanvasSize(): void;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
declare class DesignerApi {
|
|
459
|
+
readonly controlBar: ControlBarApi;
|
|
460
|
+
readonly toolbox: ToolboxApi;
|
|
461
|
+
readonly editor: EditorApi;
|
|
462
|
+
readonly workspace: WorkspaceApi;
|
|
463
|
+
readonly viewport: ViewportApi;
|
|
464
|
+
readonly pathBar: PathBarApi;
|
|
465
|
+
static create(context: DesignerContext): DesignerApi;
|
|
466
|
+
private constructor();
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
declare class Badges {
|
|
470
|
+
private readonly g;
|
|
471
|
+
private readonly position;
|
|
472
|
+
private readonly badges;
|
|
473
|
+
static createForStep(stepContext: StepContext, view: StepComponentView, componentContext: ComponentContext): Badges;
|
|
474
|
+
static createForRoot(parentElement: SVGGElement, position: Vector, componentContext: ComponentContext): Badges;
|
|
475
|
+
private constructor();
|
|
476
|
+
update(result: BadgesResult): void;
|
|
477
|
+
resolveClick(click: ClickDetails): ClickCommand | null;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
interface ValidationErrorBadgeViewConfiguration {
|
|
481
|
+
size: number;
|
|
482
|
+
iconSize: number;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
interface ValidationErrorBadgeExtensionConfiguration {
|
|
486
|
+
view: ValidationErrorBadgeViewConfiguration;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
declare class ValidationErrorBadgeExtension implements BadgeExtension {
|
|
490
|
+
private readonly configuration;
|
|
491
|
+
static create(configuration?: ValidationErrorBadgeExtensionConfiguration): ValidationErrorBadgeExtension;
|
|
492
|
+
readonly id = "validationError";
|
|
493
|
+
private constructor();
|
|
494
|
+
createForStep(parentElement: SVGElement, stepContext: StepContext<Step>, componentContext: ComponentContext): Badge;
|
|
495
|
+
createForRoot(parentElement: SVGElement, componentContext: ComponentContext): Badge;
|
|
496
|
+
readonly createStartValue: () => boolean;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
declare class InputView {
|
|
500
|
+
private readonly root;
|
|
501
|
+
static createRectInput(parent: SVGElement, x: number, y: number, size: number, iconSize: number, iconUrl: string | null): InputView;
|
|
502
|
+
static createRoundInput(parent: SVGElement, x: number, y: number, size: number): InputView;
|
|
503
|
+
private constructor();
|
|
504
|
+
setIsHidden(isHidden: boolean): void;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
declare class JoinView {
|
|
508
|
+
static createStraightJoin(parent: SVGElement, start: Vector, height: number): void;
|
|
509
|
+
static createJoins(parent: SVGElement, start: Vector, targets: Vector[]): void;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
interface LabelViewConfiguration {
|
|
513
|
+
minWidth: number;
|
|
514
|
+
height: number;
|
|
515
|
+
paddingX: number;
|
|
516
|
+
radius: number;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
declare class LabelView {
|
|
520
|
+
readonly g: SVGGElement;
|
|
521
|
+
readonly width: number;
|
|
522
|
+
readonly height: number;
|
|
523
|
+
static create(parent: SVGElement, y: number, cfg: LabelViewConfiguration, text: string, theme: 'primary' | 'secondary'): LabelView;
|
|
524
|
+
constructor(g: SVGGElement, width: number, height: number);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare class OutputView {
|
|
528
|
+
private readonly root;
|
|
529
|
+
static create(parent: SVGElement, x: number, y: number, size: number): OutputView;
|
|
530
|
+
constructor(root: SVGElement);
|
|
531
|
+
setIsHidden(isHidden: boolean): void;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
declare class RegionView {
|
|
535
|
+
private readonly lines;
|
|
536
|
+
private readonly width;
|
|
537
|
+
private readonly height;
|
|
538
|
+
static create(parent: SVGElement, widths: number[], height: number): RegionView;
|
|
539
|
+
constructor(lines: SVGLineElement[], width: number, height: number);
|
|
540
|
+
getClientPosition(): Vector;
|
|
541
|
+
resolveClick(click: ClickDetails): boolean;
|
|
542
|
+
setIsSelected(isSelected: boolean): void;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
declare class RectPlaceholderView implements PlaceholderView {
|
|
546
|
+
readonly rect: SVGElement;
|
|
547
|
+
readonly g: SVGGElement;
|
|
548
|
+
static create(parent: SVGElement, width: number, height: number, radius: number, iconSize: number, direction: PlaceholderDirection): RectPlaceholderView;
|
|
549
|
+
private constructor();
|
|
550
|
+
setIsHover(isHover: boolean): void;
|
|
551
|
+
setIsVisible(isVisible: boolean): void;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
declare class DefaultSequenceComponentView implements ComponentView {
|
|
555
|
+
readonly g: SVGGElement;
|
|
556
|
+
readonly width: number;
|
|
557
|
+
readonly height: number;
|
|
558
|
+
readonly joinX: number;
|
|
559
|
+
readonly placeholders: Placeholder[];
|
|
560
|
+
readonly components: StepComponent[];
|
|
561
|
+
static create(parent: SVGElement, sequenceContext: SequenceContext, componentContext: ComponentContext): DefaultSequenceComponentView;
|
|
562
|
+
private constructor();
|
|
563
|
+
setIsDragging(isDragging: boolean): void;
|
|
564
|
+
hasOutput(): boolean;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
declare class DefaultSequenceComponent implements SequenceComponent {
|
|
568
|
+
readonly view: DefaultSequenceComponentView;
|
|
569
|
+
readonly hasOutput: boolean;
|
|
570
|
+
static create(parentElement: SVGElement, sequenceContext: SequenceContext, context: ComponentContext): DefaultSequenceComponent;
|
|
571
|
+
private constructor();
|
|
572
|
+
resolveClick(click: ClickDetails): ClickCommand | null;
|
|
573
|
+
findById(stepId: string): StepComponent | null;
|
|
574
|
+
getPlaceholders(result: Placeholder[]): void;
|
|
575
|
+
setIsDragging(isDragging: boolean): void;
|
|
576
|
+
updateBadges(result: BadgesResult): void;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
interface ContainerStepComponentViewConfiguration {
|
|
580
|
+
paddingTop: number;
|
|
581
|
+
paddingX: number;
|
|
582
|
+
inputSize: number;
|
|
583
|
+
inputIconSize: number;
|
|
584
|
+
label: LabelViewConfiguration;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
interface ContainerStepExtensionConfiguration {
|
|
588
|
+
view: ContainerStepComponentViewConfiguration;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
declare const createContainerStepComponentViewFactory: (cfg: ContainerStepComponentViewConfiguration) => StepComponentViewFactory;
|
|
592
|
+
|
|
593
|
+
interface LineGridConfiguration {
|
|
594
|
+
gridSizeX: number;
|
|
595
|
+
gridSizeY: number;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
interface SwitchStepComponentViewConfiguration {
|
|
599
|
+
minContainerWidth: number;
|
|
600
|
+
paddingX: number;
|
|
601
|
+
paddingTop: number;
|
|
602
|
+
connectionHeight: number;
|
|
603
|
+
inputSize: number;
|
|
604
|
+
inputIconSize: number;
|
|
605
|
+
nameLabel: LabelViewConfiguration;
|
|
606
|
+
branchNameLabel: LabelViewConfiguration;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
declare const createSwitchStepComponentViewFactory: (cfg: SwitchStepComponentViewConfiguration) => StepComponentViewFactory;
|
|
610
|
+
|
|
611
|
+
interface SwitchStepExtensionConfiguration {
|
|
612
|
+
view: SwitchStepComponentViewConfiguration;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
interface TaskStepComponentViewConfiguration {
|
|
616
|
+
paddingLeft: number;
|
|
617
|
+
paddingRight: number;
|
|
618
|
+
paddingY: number;
|
|
619
|
+
textMarginLeft: number;
|
|
620
|
+
minTextWidth: number;
|
|
621
|
+
iconSize: number;
|
|
622
|
+
radius: number;
|
|
623
|
+
inputSize: number;
|
|
624
|
+
outputSize: number;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
declare const createTaskStepComponentViewFactory: (isInterrupted: boolean, cfg: TaskStepComponentViewConfiguration) => StepComponentViewFactory;
|
|
628
|
+
|
|
629
|
+
interface TaskStepExtensionConfiguration {
|
|
630
|
+
view: TaskStepComponentViewConfiguration;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
declare class CenteredViewportCalculator {
|
|
634
|
+
static center(margin: number, canvasSize: Vector, rootComponentSize: Vector): Viewport;
|
|
635
|
+
static focusOnComponent(canvasSize: Vector, viewport: Viewport, componentPosition: Vector, componentSize: Vector): Viewport;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
declare class ClassicWheelController implements WheelController {
|
|
639
|
+
private readonly api;
|
|
640
|
+
static create(api: WorkspaceApi): ClassicWheelController;
|
|
641
|
+
private constructor();
|
|
642
|
+
onWheel(e: WheelEvent): void;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
declare class ClassicWheelControllerExtension implements WheelControllerExtension {
|
|
646
|
+
readonly create: typeof ClassicWheelController.create;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
declare class QuantifiedScaleViewportCalculator {
|
|
650
|
+
static zoom(current: Viewport, direction: boolean): Viewport;
|
|
651
|
+
static zoomByWheel(current: Viewport, e: WheelEvent, canvasPosition: Vector): Viewport | null;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
declare class DefaultViewportController implements ViewportController {
|
|
655
|
+
private readonly api;
|
|
656
|
+
static create(api: WorkspaceApi): DefaultViewportController;
|
|
657
|
+
private readonly animator;
|
|
658
|
+
private constructor();
|
|
659
|
+
setDefault(): void;
|
|
660
|
+
zoom(direction: boolean): void;
|
|
661
|
+
focusOnComponent(componentPosition: Vector, componentSize: Vector): void;
|
|
662
|
+
animateTo(viewport: Viewport): void;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
declare class DefaultViewportControllerExtension implements ViewportControllerExtension {
|
|
666
|
+
readonly create: typeof DefaultViewportController.create;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
interface RectPlaceholderConfiguration {
|
|
670
|
+
gapWidth: number;
|
|
671
|
+
gapHeight: number;
|
|
672
|
+
radius: number;
|
|
673
|
+
iconSize: number;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
declare class RectPlaceholder implements Placeholder {
|
|
677
|
+
readonly view: RectPlaceholderView;
|
|
678
|
+
readonly parentSequence: Sequence;
|
|
679
|
+
readonly index: number;
|
|
680
|
+
static create(parent: SVGElement, size: Vector, direction: PlaceholderDirection, sequence: Sequence, index: number, configuration: RectPlaceholderConfiguration): RectPlaceholder;
|
|
681
|
+
constructor(view: RectPlaceholderView, parentSequence: Sequence, index: number);
|
|
682
|
+
getClientRect(): DOMRect;
|
|
683
|
+
setIsHover(isHover: boolean): void;
|
|
684
|
+
setIsVisible(isVisible: boolean): void;
|
|
685
|
+
resolveClick(): null;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
interface DesignerExtension {
|
|
689
|
+
steps?: StepExtension[];
|
|
690
|
+
stepComponentViewWrapper?: StepComponentViewWrapperExtension;
|
|
691
|
+
badges?: BadgeExtension[];
|
|
692
|
+
uiComponents?: UiComponentExtension[];
|
|
693
|
+
draggedComponent?: DraggedComponentExtension;
|
|
694
|
+
wheelController?: WheelControllerExtension;
|
|
695
|
+
viewportController?: ViewportControllerExtension;
|
|
696
|
+
placeholderController?: PlaceholderControllerExtension;
|
|
697
|
+
placeholder?: PlaceholderExtension;
|
|
698
|
+
grid?: GridExtension;
|
|
699
|
+
rootComponent?: RootComponentExtension;
|
|
700
|
+
sequenceComponent?: SequenceComponentExtension;
|
|
701
|
+
daemons?: DaemonExtension[];
|
|
702
|
+
}
|
|
703
|
+
interface StepExtension<S extends Step = Step> {
|
|
704
|
+
componentType: ComponentType;
|
|
705
|
+
createComponentView(parentElement: SVGElement, stepContext: StepContext<S>, viewContext: StepComponentViewContext): StepComponentView;
|
|
706
|
+
}
|
|
707
|
+
type StepComponentViewFactory = StepExtension['createComponentView'];
|
|
708
|
+
interface StepComponentViewContext {
|
|
709
|
+
getStepIconUrl(): string | null;
|
|
710
|
+
createSequenceComponent(parentElement: SVGElement, sequence: Sequence): SequenceComponent;
|
|
711
|
+
createPlaceholderForArea(parentElement: SVGElement, size: Vector, direction: PlaceholderDirection, sequence: Sequence, index: number): Placeholder;
|
|
712
|
+
}
|
|
713
|
+
interface StepContext<S extends Step = Step> {
|
|
714
|
+
parentSequence: Sequence;
|
|
715
|
+
step: S;
|
|
716
|
+
depth: number;
|
|
717
|
+
position: number;
|
|
718
|
+
isInputConnected: boolean;
|
|
719
|
+
isOutputConnected: boolean;
|
|
720
|
+
}
|
|
721
|
+
interface SequenceContext {
|
|
722
|
+
sequence: Sequence;
|
|
723
|
+
depth: number;
|
|
724
|
+
isInputConnected: boolean;
|
|
725
|
+
isOutputConnected: boolean;
|
|
726
|
+
}
|
|
727
|
+
interface StepComponentViewWrapperExtension {
|
|
728
|
+
wrap(view: StepComponentView, stepContext: StepContext): StepComponentView;
|
|
729
|
+
}
|
|
730
|
+
interface BadgeExtension {
|
|
731
|
+
id: string;
|
|
732
|
+
createForStep(parentElement: SVGElement, stepContext: StepContext, componentContext: ComponentContext): Badge;
|
|
733
|
+
createForRoot?: (parentElement: SVGElement, componentContext: ComponentContext) => Badge;
|
|
734
|
+
createStartValue(): unknown;
|
|
735
|
+
}
|
|
736
|
+
interface WheelControllerExtension {
|
|
737
|
+
create(api: WorkspaceApi): WheelController;
|
|
738
|
+
}
|
|
739
|
+
interface WheelController {
|
|
740
|
+
onWheel(e: WheelEvent): void;
|
|
741
|
+
}
|
|
742
|
+
interface UiComponentExtension {
|
|
743
|
+
create(root: HTMLElement, api: DesignerApi): UiComponent;
|
|
744
|
+
}
|
|
745
|
+
interface UiComponent {
|
|
746
|
+
destroy(): void;
|
|
747
|
+
}
|
|
748
|
+
interface DraggedComponentExtension {
|
|
749
|
+
create(parentElement: HTMLElement, step: Step, componentContext: ComponentContext): DraggedComponent;
|
|
750
|
+
}
|
|
751
|
+
interface DraggedComponent {
|
|
752
|
+
width: number;
|
|
753
|
+
height: number;
|
|
754
|
+
destroy(): void;
|
|
755
|
+
}
|
|
756
|
+
interface GridExtension {
|
|
757
|
+
create(): Grid;
|
|
758
|
+
}
|
|
759
|
+
interface Grid {
|
|
760
|
+
size: Vector;
|
|
761
|
+
element: SVGElement;
|
|
762
|
+
setScale(scale: number, scaledSize: Vector): void;
|
|
763
|
+
}
|
|
764
|
+
interface RootComponentExtension {
|
|
765
|
+
create(parentElement: SVGElement, sequence: Sequence, parentPlaceIndicator: SequencePlaceIndicator | null, context: ComponentContext): Component;
|
|
766
|
+
}
|
|
767
|
+
interface SequencePlaceIndicator {
|
|
768
|
+
sequence: Sequence;
|
|
769
|
+
index: number;
|
|
770
|
+
}
|
|
771
|
+
interface SequenceComponentExtension {
|
|
772
|
+
create(parentElement: SVGElement, sequenceContext: SequenceContext, componentContext: ComponentContext): SequenceComponent;
|
|
773
|
+
}
|
|
774
|
+
interface PlaceholderControllerExtension {
|
|
775
|
+
create(): PlaceholderController;
|
|
776
|
+
}
|
|
777
|
+
interface PlaceholderController {
|
|
778
|
+
canCreate(sequence: Sequence, index: number): boolean;
|
|
779
|
+
}
|
|
780
|
+
interface PlaceholderExtension {
|
|
781
|
+
gapSize: Vector;
|
|
782
|
+
createForGap(parentElement: SVGElement, sequence: Sequence, index: number): Placeholder;
|
|
783
|
+
createForArea(parentElement: SVGElement, size: Vector, direction: PlaceholderDirection, sequence: Sequence, index: number): Placeholder;
|
|
784
|
+
}
|
|
785
|
+
interface ViewportControllerExtension {
|
|
786
|
+
create(api: WorkspaceApi): ViewportController;
|
|
787
|
+
}
|
|
788
|
+
interface ViewportController {
|
|
789
|
+
setDefault(): void;
|
|
790
|
+
zoom(direction: boolean): void;
|
|
791
|
+
focusOnComponent(componentPosition: Vector, componentSize: Vector): void;
|
|
792
|
+
}
|
|
793
|
+
interface Viewport {
|
|
794
|
+
position: Vector;
|
|
795
|
+
scale: number;
|
|
796
|
+
}
|
|
797
|
+
interface DaemonExtension {
|
|
798
|
+
create(api: DesignerApi): Daemon;
|
|
799
|
+
}
|
|
800
|
+
interface Daemon {
|
|
801
|
+
destroy(): void;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
interface DesignerConfiguration<TDefinition extends Definition = Definition> {
|
|
805
|
+
/**
|
|
806
|
+
* @description The theme of the designer.
|
|
807
|
+
* @default `light`
|
|
808
|
+
*/
|
|
809
|
+
theme?: string;
|
|
810
|
+
/**
|
|
811
|
+
* @description The readonly mode of the designer.
|
|
812
|
+
*/
|
|
813
|
+
isReadonly?: boolean;
|
|
814
|
+
/**
|
|
815
|
+
* @description The depth of the undo stack. If not set, undo/redo feature will be disabled.
|
|
816
|
+
*/
|
|
817
|
+
undoStackSize?: number;
|
|
818
|
+
/**
|
|
819
|
+
* @description The common configuration of the steps.
|
|
820
|
+
*/
|
|
821
|
+
steps: StepsConfiguration;
|
|
822
|
+
/**
|
|
823
|
+
* @description The configuration of the toolbox. If not set, the toolbox will be hidden.
|
|
824
|
+
*/
|
|
825
|
+
toolbox: false | ToolboxConfiguration;
|
|
826
|
+
/**
|
|
827
|
+
* @description The configuration of the smart editor. If not set, the smart editor will be hidden.
|
|
828
|
+
*/
|
|
829
|
+
editors: false | EditorsConfiguration<TDefinition>;
|
|
830
|
+
/**
|
|
831
|
+
* @description If true, the control bar will be displayed. In the next version, this property will be required.
|
|
832
|
+
*/
|
|
833
|
+
controlBar: boolean;
|
|
834
|
+
/**
|
|
835
|
+
* @description If false, the context menu will be disabled. By default, the context menu is enabled.
|
|
836
|
+
*/
|
|
837
|
+
contextMenu?: boolean;
|
|
838
|
+
/**
|
|
839
|
+
* @description The configuration of validators.
|
|
840
|
+
*/
|
|
841
|
+
validator?: ValidatorConfiguration;
|
|
842
|
+
/**
|
|
843
|
+
* @description The handler that handles custom actions.
|
|
844
|
+
*/
|
|
845
|
+
customActionHandler?: CustomActionHandler;
|
|
846
|
+
/**
|
|
847
|
+
* @description The extensions of the designer.
|
|
848
|
+
*/
|
|
849
|
+
extensions?: DesignerExtension[];
|
|
850
|
+
/**
|
|
851
|
+
* @description Custom definition walker.
|
|
852
|
+
*/
|
|
853
|
+
definitionWalker?: DefinitionWalker;
|
|
854
|
+
/**
|
|
855
|
+
* @description Custom generator of unique identifiers.
|
|
856
|
+
*/
|
|
857
|
+
uidGenerator?: UidGenerator;
|
|
858
|
+
}
|
|
859
|
+
type UidGenerator = () => string;
|
|
860
|
+
type CustomActionHandler = (action: CustomAction, step: Step | null, sequence: Sequence, context: CustomActionHandlerContext) => void;
|
|
861
|
+
interface CustomAction {
|
|
862
|
+
type: string;
|
|
863
|
+
}
|
|
864
|
+
interface CustomActionHandlerContext {
|
|
865
|
+
/**
|
|
866
|
+
* @description Notifies the designer that the name of the step has changed.
|
|
867
|
+
* @param stepId The id of the step whose name has changed.
|
|
868
|
+
*/
|
|
869
|
+
notifyStepNameChanged(stepId: string): void;
|
|
870
|
+
/**
|
|
871
|
+
* @description Notifies the designer that the properties of the step have changed.
|
|
872
|
+
* @param stepId The id of the step whose properties have changed.
|
|
873
|
+
*/
|
|
874
|
+
notifyStepPropertiesChanged(stepId: string): void;
|
|
875
|
+
/**
|
|
876
|
+
* @description Notifies the designer that the step has been inserted.
|
|
877
|
+
* @param stepId The id of the inserted step.
|
|
878
|
+
*/
|
|
879
|
+
notifyStepInserted(stepId: string): void;
|
|
880
|
+
/**
|
|
881
|
+
* @description Notifies the designer that the step has been moved.
|
|
882
|
+
* @param stepId The id of the moved step.
|
|
883
|
+
*/
|
|
884
|
+
notifyStepMoved(stepId: string): void;
|
|
885
|
+
/**
|
|
886
|
+
* @description Notifies the designer that the step has been deleted.
|
|
887
|
+
* @param stepId The id of the deleted step.
|
|
888
|
+
*/
|
|
889
|
+
notifyStepDeleted(stepId: string): void;
|
|
890
|
+
}
|
|
891
|
+
interface ToolboxConfiguration {
|
|
892
|
+
labelProvider?: StepLabelProvider;
|
|
893
|
+
isCollapsed?: boolean;
|
|
894
|
+
groups: ToolboxGroupConfiguration[];
|
|
895
|
+
}
|
|
896
|
+
type StepDefinition = Omit<Step, 'id'>;
|
|
897
|
+
type StepLabelProvider = (step: StepDefinition) => string;
|
|
898
|
+
interface ToolboxGroupConfiguration {
|
|
899
|
+
name: string;
|
|
900
|
+
steps: StepDefinition[];
|
|
901
|
+
}
|
|
902
|
+
interface StepsConfiguration {
|
|
903
|
+
canInsertStep?: (step: Step, targetSequence: Sequence, targetIndex: number) => boolean;
|
|
904
|
+
isDraggable?: (step: Step, parentSequence: Sequence) => boolean;
|
|
905
|
+
canMoveStep?: (sourceSequence: Sequence, step: Step, targetSequence: Sequence, targetIndex: number) => boolean;
|
|
906
|
+
isDeletable?: (step: Step, parentSequence: Sequence) => boolean;
|
|
907
|
+
canDeleteStep?: (step: Step, parentSequence: Sequence) => boolean;
|
|
908
|
+
isDuplicable?: (step: Step, parentSequence: Sequence) => boolean;
|
|
909
|
+
iconUrlProvider?: StepIconUrlProvider;
|
|
910
|
+
}
|
|
911
|
+
type StepIconUrlProvider = (componentType: ComponentType, type: string) => string | null;
|
|
912
|
+
interface ValidatorConfiguration {
|
|
913
|
+
step?: StepValidator;
|
|
914
|
+
root?: RootValidator;
|
|
915
|
+
}
|
|
916
|
+
type StepValidator = (step: Step, parentSequence: Sequence, definition: Definition) => boolean;
|
|
917
|
+
type RootValidator = (definition: Definition) => boolean;
|
|
918
|
+
interface EditorsConfiguration<TDefinition extends Definition = Definition> {
|
|
919
|
+
isCollapsed?: boolean;
|
|
920
|
+
stepEditorProvider: StepEditorProvider<TDefinition>;
|
|
921
|
+
globalEditorProvider: GlobalEditorProvider<TDefinition>;
|
|
922
|
+
}
|
|
923
|
+
interface StepEditorContext {
|
|
924
|
+
notifyNameChanged(): void;
|
|
925
|
+
notifyPropertiesChanged(): void;
|
|
926
|
+
notifyChildrenChanged(): void;
|
|
927
|
+
}
|
|
928
|
+
type StepEditorProvider<TDefinition extends Definition = Definition> = (step: Step, context: StepEditorContext, definition: TDefinition) => HTMLElement;
|
|
929
|
+
interface GlobalEditorContext {
|
|
930
|
+
notifyPropertiesChanged(): void;
|
|
931
|
+
}
|
|
932
|
+
type GlobalEditorProvider<TDefinition extends Definition = Definition> = (definition: TDefinition, context: GlobalEditorContext) => HTMLElement;
|
|
933
|
+
|
|
934
|
+
declare class DefinitionModifier {
|
|
935
|
+
private readonly definitionWalker;
|
|
936
|
+
private readonly state;
|
|
937
|
+
private readonly configuration;
|
|
938
|
+
constructor(definitionWalker: DefinitionWalker, state: DesignerState, configuration: DesignerConfiguration);
|
|
939
|
+
isDeletable(stepId: string): boolean;
|
|
940
|
+
tryDelete(stepId: string): boolean;
|
|
941
|
+
tryInsert(step: Step, targetSequence: Sequence, targetIndex: number): boolean;
|
|
942
|
+
isDraggable(step: Step, parentSequence: Sequence): boolean;
|
|
943
|
+
tryMove(sourceSequence: Sequence, step: Step, targetSequence: Sequence, targetIndex: number): boolean;
|
|
944
|
+
isDuplicable(step: Step, parentSequence: Sequence): boolean;
|
|
945
|
+
tryDuplicate(step: Step, parentSequence: Sequence): boolean;
|
|
946
|
+
replaceDefinition(definition: Definition): void;
|
|
947
|
+
updateDependantFields(): void;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
declare class ControlBarApi {
|
|
951
|
+
private readonly state;
|
|
952
|
+
private readonly historyController;
|
|
953
|
+
private readonly definitionModifier;
|
|
954
|
+
private readonly viewportApi;
|
|
955
|
+
constructor(state: DesignerState, historyController: HistoryController | undefined, definitionModifier: DefinitionModifier, viewportApi: ViewportApi);
|
|
956
|
+
/**
|
|
957
|
+
* @deprecated Don't use this method
|
|
958
|
+
*/
|
|
959
|
+
subscribe(handler: () => void): void;
|
|
960
|
+
resetViewport(): void;
|
|
961
|
+
zoomIn(): void;
|
|
962
|
+
zoomOut(): void;
|
|
963
|
+
isDragDisabled(): boolean;
|
|
964
|
+
toggleIsDragDisabled(): void;
|
|
965
|
+
isUndoRedoSupported(): boolean;
|
|
966
|
+
tryUndo(): boolean;
|
|
967
|
+
canUndo(): boolean;
|
|
968
|
+
tryRedo(): boolean;
|
|
969
|
+
canRedo(): boolean;
|
|
970
|
+
tryDelete(): boolean;
|
|
971
|
+
canDelete(): boolean;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
declare class Editor {
|
|
975
|
+
private readonly view;
|
|
976
|
+
private readonly renderer;
|
|
977
|
+
static create(parent: HTMLElement, api: EditorApi, stepEditorClassName: string, stepEditorProvider: StepEditorProvider, globalEditorClassName: string, globalEditorProvider: GlobalEditorProvider): Editor;
|
|
978
|
+
private constructor();
|
|
979
|
+
destroy(): void;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
declare class Designer<TDefinition extends Definition = Definition> {
|
|
983
|
+
private readonly view;
|
|
984
|
+
private readonly state;
|
|
985
|
+
private readonly walker;
|
|
986
|
+
private readonly api;
|
|
987
|
+
/**
|
|
988
|
+
* Creates a designer.
|
|
989
|
+
* @param placeholder Placeholder where the designer will be attached.
|
|
990
|
+
* @param startDefinition Start definition of a flow.
|
|
991
|
+
* @param configuration Designer's configuration.
|
|
992
|
+
* @returns An instance of the designer.
|
|
993
|
+
*/
|
|
994
|
+
static create<TDef extends Definition>(placeholder: HTMLElement, startDefinition: TDef, configuration: DesignerConfiguration<TDef>): Designer<TDef>;
|
|
995
|
+
private constructor();
|
|
996
|
+
/**
|
|
997
|
+
* @description Fires when the designer is initialized and ready to use.
|
|
998
|
+
*/
|
|
999
|
+
readonly onReady: SimpleEvent<void>;
|
|
1000
|
+
/**
|
|
1001
|
+
* @description Fires when the definition has changed.
|
|
1002
|
+
*/
|
|
1003
|
+
readonly onDefinitionChanged: SimpleEvent<TDefinition>;
|
|
1004
|
+
/**
|
|
1005
|
+
* @description Fires when the selected step has changed.
|
|
1006
|
+
*/
|
|
1007
|
+
readonly onSelectedStepIdChanged: SimpleEvent<string | null>;
|
|
1008
|
+
/**
|
|
1009
|
+
* @description Fires when the toolbox is collapsed or expanded.
|
|
1010
|
+
*/
|
|
1011
|
+
readonly onIsToolboxCollapsedChanged: SimpleEvent<boolean>;
|
|
1012
|
+
/**
|
|
1013
|
+
* @description Fires when the editor is collapsed or expanded.
|
|
1014
|
+
*/
|
|
1015
|
+
readonly onIsEditorCollapsedChanged: SimpleEvent<boolean>;
|
|
1016
|
+
/**
|
|
1017
|
+
* @returns the current definition of the workflow.
|
|
1018
|
+
*/
|
|
1019
|
+
getDefinition(): TDefinition;
|
|
1020
|
+
/**
|
|
1021
|
+
* @returns the validation result of the current definition.
|
|
1022
|
+
*/
|
|
1023
|
+
isValid(): boolean;
|
|
1024
|
+
/**
|
|
1025
|
+
* @returns the readonly flag.
|
|
1026
|
+
*/
|
|
1027
|
+
isReadonly(): boolean;
|
|
1028
|
+
/**
|
|
1029
|
+
* @description Changes the readonly flag.
|
|
1030
|
+
*/
|
|
1031
|
+
setIsReadonly(isReadonly: boolean): void;
|
|
1032
|
+
/**
|
|
1033
|
+
* @returns current selected step id or `null` if nothing is selected.
|
|
1034
|
+
*/
|
|
1035
|
+
getSelectedStepId(): string | null;
|
|
1036
|
+
/**
|
|
1037
|
+
* @description Selects a step by the id.
|
|
1038
|
+
*/
|
|
1039
|
+
selectStepById(stepId: string): void;
|
|
1040
|
+
/**
|
|
1041
|
+
* @description Unselects the selected step.
|
|
1042
|
+
*/
|
|
1043
|
+
clearSelectedStep(): void;
|
|
1044
|
+
/**
|
|
1045
|
+
* @description Moves the viewport to the step with the animation.
|
|
1046
|
+
*/
|
|
1047
|
+
moveViewportToStep(stepId: string): void;
|
|
1048
|
+
/**
|
|
1049
|
+
* @deprecated Use `moveViewportToStep` instead.
|
|
1050
|
+
*/
|
|
1051
|
+
moveViewPortToStep(stepId: string): void;
|
|
1052
|
+
/**
|
|
1053
|
+
* @description Rerender the root component and all its children.
|
|
1054
|
+
*/
|
|
1055
|
+
updateRootComponent(): void;
|
|
1056
|
+
/**
|
|
1057
|
+
* @description Updates all badges.
|
|
1058
|
+
*/
|
|
1059
|
+
updateBadges(): void;
|
|
1060
|
+
/**
|
|
1061
|
+
* @returns a flag that indicates whether the toolbox is collapsed.
|
|
1062
|
+
*/
|
|
1063
|
+
isToolboxCollapsed(): boolean;
|
|
1064
|
+
/**
|
|
1065
|
+
* @description Sets a flag that indicates whether the toolbox is collapsed.
|
|
1066
|
+
*/
|
|
1067
|
+
setIsToolboxCollapsed(isCollapsed: boolean): void;
|
|
1068
|
+
/**
|
|
1069
|
+
* @returns a flag that indicates whether the editor is collapsed.
|
|
1070
|
+
*/
|
|
1071
|
+
isEditorCollapsed(): boolean;
|
|
1072
|
+
/**
|
|
1073
|
+
* @description Sets a flag that indicates whether the editor is collapsed.
|
|
1074
|
+
*/
|
|
1075
|
+
setIsEditorCollapsed(isCollapsed: boolean): void;
|
|
1076
|
+
/**
|
|
1077
|
+
* @param needle A step, a sequence or a step id.
|
|
1078
|
+
* @returns parent steps and branch names.
|
|
1079
|
+
*/
|
|
1080
|
+
getStepParents(needle: Sequence | Step | string): StepOrName[];
|
|
1081
|
+
/**
|
|
1082
|
+
* @description Destroys the designer and deletes all nodes from the placeholder.
|
|
1083
|
+
*/
|
|
1084
|
+
destroy(): void;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
declare class LineGrid implements Grid {
|
|
1088
|
+
readonly size: Vector;
|
|
1089
|
+
readonly element: SVGPathElement;
|
|
1090
|
+
static create(size: Vector): LineGrid;
|
|
1091
|
+
private constructor();
|
|
1092
|
+
setScale(_: number, scaledSize: Vector): void;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
declare class LineGridExtension implements GridExtension {
|
|
1096
|
+
private readonly configuration;
|
|
1097
|
+
static create(configuration?: LineGridConfiguration): LineGridExtension;
|
|
1098
|
+
private constructor();
|
|
1099
|
+
create(): LineGrid;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
declare class LineGridDesignerExtension implements DesignerExtension {
|
|
1103
|
+
readonly grid: LineGridExtension;
|
|
1104
|
+
static create(configuration?: LineGridConfiguration): DesignerExtension;
|
|
1105
|
+
private constructor();
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
interface StepsDesignerExtensionConfiguration {
|
|
1109
|
+
container?: ContainerStepExtensionConfiguration;
|
|
1110
|
+
switch?: SwitchStepExtensionConfiguration;
|
|
1111
|
+
task?: TaskStepExtensionConfiguration;
|
|
1112
|
+
}
|
|
1113
|
+
declare class StepsDesignerExtension implements DesignerExtension {
|
|
1114
|
+
readonly steps: StepExtension<Step>[];
|
|
1115
|
+
static create(configuration: StepsDesignerExtensionConfiguration): StepsDesignerExtension;
|
|
1116
|
+
protected constructor(steps: StepExtension<Step>[]);
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* @deprecated Use `StepsDesignerExtension` instead.
|
|
1120
|
+
*/
|
|
1121
|
+
declare class StepsExtension extends StepsDesignerExtension {
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* @deprecated Use `StepsDesignerExtensionConfiguration` instead.
|
|
1125
|
+
*/
|
|
1126
|
+
interface StepsExtensionConfiguration extends StepsDesignerExtensionConfiguration {
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
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, RootValidator, SelectStepClickCommand, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, 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, ValidationErrorBadgeExtension, ValidationErrorBadgeExtensionConfiguration, ValidationErrorBadgeViewConfiguration, ValidatorConfiguration, Vector, Viewport, ViewportController, ViewportControllerExtension, WheelController, WheelControllerExtension, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, race };
|