sequential-workflow-designer 0.16.10 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/index.umd.js +30 -27
- package/lib/cjs/index.cjs +30 -27
- package/lib/esm/index.js +30 -27
- package/lib/index.d.ts +10 -13
- package/package.json +1 -1
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.
|
|
100
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
101
|
-
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
102
|
-
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.
|
|
99
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.17.0/css/designer.css" rel="stylesheet">
|
|
100
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.17.0/css/designer-light.css" rel="stylesheet">
|
|
101
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.17.0/css/designer-dark.css" rel="stylesheet">
|
|
102
|
+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.17.0/dist/index.umd.js"></script>
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
Call the designer by:
|
|
@@ -120,10 +120,10 @@ const placeholder = document.getElementById('placeholder');
|
|
|
120
120
|
const definition = {
|
|
121
121
|
properties: {
|
|
122
122
|
'myProperty': 'my-value',
|
|
123
|
-
//
|
|
123
|
+
// root properties...
|
|
124
124
|
},
|
|
125
125
|
sequence: [
|
|
126
|
-
//
|
|
126
|
+
// steps...
|
|
127
127
|
]
|
|
128
128
|
};
|
|
129
129
|
|
|
@@ -190,12 +190,12 @@ const configuration = {
|
|
|
190
190
|
|
|
191
191
|
editors: {
|
|
192
192
|
isCollapsed: false,
|
|
193
|
-
|
|
193
|
+
rootEditorProvider: (definition, rootContext, isReadonly) => {
|
|
194
194
|
const editor = document.createElement('div');
|
|
195
195
|
// ...
|
|
196
196
|
return editor;
|
|
197
197
|
},
|
|
198
|
-
stepEditorProvider: (step, stepContext, definition) => {
|
|
198
|
+
stepEditorProvider: (step, stepContext, definition, isReadonly) => {
|
|
199
199
|
const editor = document.createElement('div');
|
|
200
200
|
// ...
|
|
201
201
|
return editor;
|
package/dist/index.umd.js
CHANGED
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
DefinitionChangeType[DefinitionChangeType["stepDeleted"] = 4] = "stepDeleted";
|
|
89
89
|
DefinitionChangeType[DefinitionChangeType["stepMoved"] = 5] = "stepMoved";
|
|
90
90
|
DefinitionChangeType[DefinitionChangeType["stepInserted"] = 6] = "stepInserted";
|
|
91
|
-
DefinitionChangeType[DefinitionChangeType["
|
|
91
|
+
DefinitionChangeType[DefinitionChangeType["rootPropertyChanged"] = 7] = "rootPropertyChanged";
|
|
92
92
|
DefinitionChangeType[DefinitionChangeType["rootReplaced"] = 8] = "rootReplaced";
|
|
93
93
|
})(exports.DefinitionChangeType || (exports.DefinitionChangeType = {}));
|
|
94
94
|
|
|
@@ -271,10 +271,10 @@
|
|
|
271
271
|
|
|
272
272
|
class EditorRenderer {
|
|
273
273
|
static create(state, definitionWalker, handler) {
|
|
274
|
-
const raceEvent = race(0, state.onDefinitionChanged, state.onSelectedStepIdChanged);
|
|
274
|
+
const raceEvent = race(0, state.onDefinitionChanged, state.onSelectedStepIdChanged, state.onIsReadonlyChanged);
|
|
275
275
|
const listener = new EditorRenderer(state, definitionWalker, handler, raceEvent);
|
|
276
276
|
raceEvent.subscribe(listener.raceEventHandler);
|
|
277
|
-
listener.
|
|
277
|
+
listener.renderIfStepChanged(state.selectedStepId);
|
|
278
278
|
return listener;
|
|
279
279
|
}
|
|
280
280
|
constructor(state, definitionWalker, handler, raceEvent) {
|
|
@@ -283,12 +283,20 @@
|
|
|
283
283
|
this.handler = handler;
|
|
284
284
|
this.raceEvent = raceEvent;
|
|
285
285
|
this.currentStepId = undefined;
|
|
286
|
-
this.raceEventHandler = ([definitionChanged, selectedStepId]) => {
|
|
287
|
-
if (
|
|
288
|
-
this.
|
|
286
|
+
this.raceEventHandler = ([definitionChanged, selectedStepId, isReadonlyChanged]) => {
|
|
287
|
+
if (isReadonlyChanged !== undefined) {
|
|
288
|
+
this.render(this.state.selectedStepId);
|
|
289
|
+
}
|
|
290
|
+
else if (definitionChanged) {
|
|
291
|
+
if (definitionChanged.changeType === exports.DefinitionChangeType.rootReplaced) {
|
|
292
|
+
this.render(this.state.selectedStepId);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
this.renderIfStepChanged(this.state.selectedStepId);
|
|
296
|
+
}
|
|
289
297
|
}
|
|
290
298
|
else if (selectedStepId !== undefined) {
|
|
291
|
-
this.
|
|
299
|
+
this.renderIfStepChanged(selectedStepId);
|
|
292
300
|
}
|
|
293
301
|
};
|
|
294
302
|
}
|
|
@@ -300,22 +308,11 @@
|
|
|
300
308
|
this.currentStepId = stepId;
|
|
301
309
|
this.handler(step);
|
|
302
310
|
}
|
|
303
|
-
|
|
311
|
+
renderIfStepChanged(stepId) {
|
|
304
312
|
if (this.currentStepId !== stepId) {
|
|
305
313
|
this.render(stepId);
|
|
306
314
|
}
|
|
307
315
|
}
|
|
308
|
-
onDefinitionChanged(event) {
|
|
309
|
-
if (event.changeType === exports.DefinitionChangeType.rootReplaced) {
|
|
310
|
-
this.render(this.state.selectedStepId);
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
this.tryRender(this.state.selectedStepId);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
onSelectedStepIdChanged(stepId) {
|
|
317
|
-
this.tryRender(stepId);
|
|
318
|
-
}
|
|
319
316
|
}
|
|
320
317
|
|
|
321
318
|
class EditorApi {
|
|
@@ -327,6 +324,9 @@
|
|
|
327
324
|
isCollapsed() {
|
|
328
325
|
return this.state.isEditorCollapsed;
|
|
329
326
|
}
|
|
327
|
+
isReadonly() {
|
|
328
|
+
return this.state.isReadonly;
|
|
329
|
+
}
|
|
330
330
|
toggleIsCollapsed() {
|
|
331
331
|
this.state.setIsEditorCollapsed(!this.state.isEditorCollapsed);
|
|
332
332
|
}
|
|
@@ -356,10 +356,10 @@
|
|
|
356
356
|
}
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
createRootEditorContext() {
|
|
360
360
|
return {
|
|
361
361
|
notifyPropertiesChanged: () => {
|
|
362
|
-
this.state.notifyDefinitionChanged(exports.DefinitionChangeType.
|
|
362
|
+
this.state.notifyDefinitionChanged(exports.DefinitionChangeType.rootPropertyChanged, null);
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
365
|
}
|
|
@@ -976,7 +976,7 @@
|
|
|
976
976
|
}
|
|
977
977
|
|
|
978
978
|
class Editor {
|
|
979
|
-
static create(parent, api, stepEditorClassName, stepEditorProvider,
|
|
979
|
+
static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider) {
|
|
980
980
|
const view = EditorView.create(parent);
|
|
981
981
|
function render(step) {
|
|
982
982
|
const definition = api.getDefinition();
|
|
@@ -984,13 +984,13 @@
|
|
|
984
984
|
let className;
|
|
985
985
|
if (step) {
|
|
986
986
|
const stepContext = api.createStepEditorContext(step.id);
|
|
987
|
-
content = stepEditorProvider(step, stepContext, definition);
|
|
987
|
+
content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
|
|
988
988
|
className = stepEditorClassName;
|
|
989
989
|
}
|
|
990
990
|
else {
|
|
991
|
-
const
|
|
992
|
-
content =
|
|
993
|
-
className =
|
|
991
|
+
const rootContext = api.createRootEditorContext();
|
|
992
|
+
content = rootEditorProvider(definition, rootContext, api.isReadonly());
|
|
993
|
+
className = rootEditorClassName;
|
|
994
994
|
}
|
|
995
995
|
view.setContent(content, className);
|
|
996
996
|
}
|
|
@@ -3523,7 +3523,10 @@
|
|
|
3523
3523
|
});
|
|
3524
3524
|
parent.appendChild(toggle);
|
|
3525
3525
|
parent.appendChild(root);
|
|
3526
|
-
|
|
3526
|
+
if (configuration.globalEditorProvider) {
|
|
3527
|
+
throw new Error('globalEditorProvider is renamed to rootEditorProvider');
|
|
3528
|
+
}
|
|
3529
|
+
const editor = Editor.create(root, api, 'sqd-editor sqd-step-editor', configuration.stepEditorProvider, 'sqd-editor sqd-root-editor', configuration.rootEditorProvider);
|
|
3527
3530
|
return new SmartEditorView(root, toggle, editor);
|
|
3528
3531
|
}
|
|
3529
3532
|
constructor(root, toggle, editor) {
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -86,7 +86,7 @@ exports.DefinitionChangeType = void 0;
|
|
|
86
86
|
DefinitionChangeType[DefinitionChangeType["stepDeleted"] = 4] = "stepDeleted";
|
|
87
87
|
DefinitionChangeType[DefinitionChangeType["stepMoved"] = 5] = "stepMoved";
|
|
88
88
|
DefinitionChangeType[DefinitionChangeType["stepInserted"] = 6] = "stepInserted";
|
|
89
|
-
DefinitionChangeType[DefinitionChangeType["
|
|
89
|
+
DefinitionChangeType[DefinitionChangeType["rootPropertyChanged"] = 7] = "rootPropertyChanged";
|
|
90
90
|
DefinitionChangeType[DefinitionChangeType["rootReplaced"] = 8] = "rootReplaced";
|
|
91
91
|
})(exports.DefinitionChangeType || (exports.DefinitionChangeType = {}));
|
|
92
92
|
|
|
@@ -269,10 +269,10 @@ function race(timeout, a, b, c) {
|
|
|
269
269
|
|
|
270
270
|
class EditorRenderer {
|
|
271
271
|
static create(state, definitionWalker, handler) {
|
|
272
|
-
const raceEvent = race(0, state.onDefinitionChanged, state.onSelectedStepIdChanged);
|
|
272
|
+
const raceEvent = race(0, state.onDefinitionChanged, state.onSelectedStepIdChanged, state.onIsReadonlyChanged);
|
|
273
273
|
const listener = new EditorRenderer(state, definitionWalker, handler, raceEvent);
|
|
274
274
|
raceEvent.subscribe(listener.raceEventHandler);
|
|
275
|
-
listener.
|
|
275
|
+
listener.renderIfStepChanged(state.selectedStepId);
|
|
276
276
|
return listener;
|
|
277
277
|
}
|
|
278
278
|
constructor(state, definitionWalker, handler, raceEvent) {
|
|
@@ -281,12 +281,20 @@ class EditorRenderer {
|
|
|
281
281
|
this.handler = handler;
|
|
282
282
|
this.raceEvent = raceEvent;
|
|
283
283
|
this.currentStepId = undefined;
|
|
284
|
-
this.raceEventHandler = ([definitionChanged, selectedStepId]) => {
|
|
285
|
-
if (
|
|
286
|
-
this.
|
|
284
|
+
this.raceEventHandler = ([definitionChanged, selectedStepId, isReadonlyChanged]) => {
|
|
285
|
+
if (isReadonlyChanged !== undefined) {
|
|
286
|
+
this.render(this.state.selectedStepId);
|
|
287
|
+
}
|
|
288
|
+
else if (definitionChanged) {
|
|
289
|
+
if (definitionChanged.changeType === exports.DefinitionChangeType.rootReplaced) {
|
|
290
|
+
this.render(this.state.selectedStepId);
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
this.renderIfStepChanged(this.state.selectedStepId);
|
|
294
|
+
}
|
|
287
295
|
}
|
|
288
296
|
else if (selectedStepId !== undefined) {
|
|
289
|
-
this.
|
|
297
|
+
this.renderIfStepChanged(selectedStepId);
|
|
290
298
|
}
|
|
291
299
|
};
|
|
292
300
|
}
|
|
@@ -298,22 +306,11 @@ class EditorRenderer {
|
|
|
298
306
|
this.currentStepId = stepId;
|
|
299
307
|
this.handler(step);
|
|
300
308
|
}
|
|
301
|
-
|
|
309
|
+
renderIfStepChanged(stepId) {
|
|
302
310
|
if (this.currentStepId !== stepId) {
|
|
303
311
|
this.render(stepId);
|
|
304
312
|
}
|
|
305
313
|
}
|
|
306
|
-
onDefinitionChanged(event) {
|
|
307
|
-
if (event.changeType === exports.DefinitionChangeType.rootReplaced) {
|
|
308
|
-
this.render(this.state.selectedStepId);
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
this.tryRender(this.state.selectedStepId);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
onSelectedStepIdChanged(stepId) {
|
|
315
|
-
this.tryRender(stepId);
|
|
316
|
-
}
|
|
317
314
|
}
|
|
318
315
|
|
|
319
316
|
class EditorApi {
|
|
@@ -325,6 +322,9 @@ class EditorApi {
|
|
|
325
322
|
isCollapsed() {
|
|
326
323
|
return this.state.isEditorCollapsed;
|
|
327
324
|
}
|
|
325
|
+
isReadonly() {
|
|
326
|
+
return this.state.isReadonly;
|
|
327
|
+
}
|
|
328
328
|
toggleIsCollapsed() {
|
|
329
329
|
this.state.setIsEditorCollapsed(!this.state.isEditorCollapsed);
|
|
330
330
|
}
|
|
@@ -354,10 +354,10 @@ class EditorApi {
|
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
createRootEditorContext() {
|
|
358
358
|
return {
|
|
359
359
|
notifyPropertiesChanged: () => {
|
|
360
|
-
this.state.notifyDefinitionChanged(exports.DefinitionChangeType.
|
|
360
|
+
this.state.notifyDefinitionChanged(exports.DefinitionChangeType.rootPropertyChanged, null);
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
363
|
}
|
|
@@ -974,7 +974,7 @@ class EditorView {
|
|
|
974
974
|
}
|
|
975
975
|
|
|
976
976
|
class Editor {
|
|
977
|
-
static create(parent, api, stepEditorClassName, stepEditorProvider,
|
|
977
|
+
static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider) {
|
|
978
978
|
const view = EditorView.create(parent);
|
|
979
979
|
function render(step) {
|
|
980
980
|
const definition = api.getDefinition();
|
|
@@ -982,13 +982,13 @@ class Editor {
|
|
|
982
982
|
let className;
|
|
983
983
|
if (step) {
|
|
984
984
|
const stepContext = api.createStepEditorContext(step.id);
|
|
985
|
-
content = stepEditorProvider(step, stepContext, definition);
|
|
985
|
+
content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
|
|
986
986
|
className = stepEditorClassName;
|
|
987
987
|
}
|
|
988
988
|
else {
|
|
989
|
-
const
|
|
990
|
-
content =
|
|
991
|
-
className =
|
|
989
|
+
const rootContext = api.createRootEditorContext();
|
|
990
|
+
content = rootEditorProvider(definition, rootContext, api.isReadonly());
|
|
991
|
+
className = rootEditorClassName;
|
|
992
992
|
}
|
|
993
993
|
view.setContent(content, className);
|
|
994
994
|
}
|
|
@@ -3338,7 +3338,10 @@ class SmartEditorView {
|
|
|
3338
3338
|
});
|
|
3339
3339
|
parent.appendChild(toggle);
|
|
3340
3340
|
parent.appendChild(root);
|
|
3341
|
-
|
|
3341
|
+
if (configuration.globalEditorProvider) {
|
|
3342
|
+
throw new Error('globalEditorProvider is renamed to rootEditorProvider');
|
|
3343
|
+
}
|
|
3344
|
+
const editor = Editor.create(root, api, 'sqd-editor sqd-step-editor', configuration.stepEditorProvider, 'sqd-editor sqd-root-editor', configuration.rootEditorProvider);
|
|
3342
3345
|
return new SmartEditorView(root, toggle, editor);
|
|
3343
3346
|
}
|
|
3344
3347
|
constructor(root, toggle, editor) {
|
package/lib/esm/index.js
CHANGED
|
@@ -85,7 +85,7 @@ var DefinitionChangeType;
|
|
|
85
85
|
DefinitionChangeType[DefinitionChangeType["stepDeleted"] = 4] = "stepDeleted";
|
|
86
86
|
DefinitionChangeType[DefinitionChangeType["stepMoved"] = 5] = "stepMoved";
|
|
87
87
|
DefinitionChangeType[DefinitionChangeType["stepInserted"] = 6] = "stepInserted";
|
|
88
|
-
DefinitionChangeType[DefinitionChangeType["
|
|
88
|
+
DefinitionChangeType[DefinitionChangeType["rootPropertyChanged"] = 7] = "rootPropertyChanged";
|
|
89
89
|
DefinitionChangeType[DefinitionChangeType["rootReplaced"] = 8] = "rootReplaced";
|
|
90
90
|
})(DefinitionChangeType || (DefinitionChangeType = {}));
|
|
91
91
|
|
|
@@ -268,10 +268,10 @@ function race(timeout, a, b, c) {
|
|
|
268
268
|
|
|
269
269
|
class EditorRenderer {
|
|
270
270
|
static create(state, definitionWalker, handler) {
|
|
271
|
-
const raceEvent = race(0, state.onDefinitionChanged, state.onSelectedStepIdChanged);
|
|
271
|
+
const raceEvent = race(0, state.onDefinitionChanged, state.onSelectedStepIdChanged, state.onIsReadonlyChanged);
|
|
272
272
|
const listener = new EditorRenderer(state, definitionWalker, handler, raceEvent);
|
|
273
273
|
raceEvent.subscribe(listener.raceEventHandler);
|
|
274
|
-
listener.
|
|
274
|
+
listener.renderIfStepChanged(state.selectedStepId);
|
|
275
275
|
return listener;
|
|
276
276
|
}
|
|
277
277
|
constructor(state, definitionWalker, handler, raceEvent) {
|
|
@@ -280,12 +280,20 @@ class EditorRenderer {
|
|
|
280
280
|
this.handler = handler;
|
|
281
281
|
this.raceEvent = raceEvent;
|
|
282
282
|
this.currentStepId = undefined;
|
|
283
|
-
this.raceEventHandler = ([definitionChanged, selectedStepId]) => {
|
|
284
|
-
if (
|
|
285
|
-
this.
|
|
283
|
+
this.raceEventHandler = ([definitionChanged, selectedStepId, isReadonlyChanged]) => {
|
|
284
|
+
if (isReadonlyChanged !== undefined) {
|
|
285
|
+
this.render(this.state.selectedStepId);
|
|
286
|
+
}
|
|
287
|
+
else if (definitionChanged) {
|
|
288
|
+
if (definitionChanged.changeType === DefinitionChangeType.rootReplaced) {
|
|
289
|
+
this.render(this.state.selectedStepId);
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
this.renderIfStepChanged(this.state.selectedStepId);
|
|
293
|
+
}
|
|
286
294
|
}
|
|
287
295
|
else if (selectedStepId !== undefined) {
|
|
288
|
-
this.
|
|
296
|
+
this.renderIfStepChanged(selectedStepId);
|
|
289
297
|
}
|
|
290
298
|
};
|
|
291
299
|
}
|
|
@@ -297,22 +305,11 @@ class EditorRenderer {
|
|
|
297
305
|
this.currentStepId = stepId;
|
|
298
306
|
this.handler(step);
|
|
299
307
|
}
|
|
300
|
-
|
|
308
|
+
renderIfStepChanged(stepId) {
|
|
301
309
|
if (this.currentStepId !== stepId) {
|
|
302
310
|
this.render(stepId);
|
|
303
311
|
}
|
|
304
312
|
}
|
|
305
|
-
onDefinitionChanged(event) {
|
|
306
|
-
if (event.changeType === DefinitionChangeType.rootReplaced) {
|
|
307
|
-
this.render(this.state.selectedStepId);
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
this.tryRender(this.state.selectedStepId);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
onSelectedStepIdChanged(stepId) {
|
|
314
|
-
this.tryRender(stepId);
|
|
315
|
-
}
|
|
316
313
|
}
|
|
317
314
|
|
|
318
315
|
class EditorApi {
|
|
@@ -324,6 +321,9 @@ class EditorApi {
|
|
|
324
321
|
isCollapsed() {
|
|
325
322
|
return this.state.isEditorCollapsed;
|
|
326
323
|
}
|
|
324
|
+
isReadonly() {
|
|
325
|
+
return this.state.isReadonly;
|
|
326
|
+
}
|
|
327
327
|
toggleIsCollapsed() {
|
|
328
328
|
this.state.setIsEditorCollapsed(!this.state.isEditorCollapsed);
|
|
329
329
|
}
|
|
@@ -353,10 +353,10 @@ class EditorApi {
|
|
|
353
353
|
}
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
createRootEditorContext() {
|
|
357
357
|
return {
|
|
358
358
|
notifyPropertiesChanged: () => {
|
|
359
|
-
this.state.notifyDefinitionChanged(DefinitionChangeType.
|
|
359
|
+
this.state.notifyDefinitionChanged(DefinitionChangeType.rootPropertyChanged, null);
|
|
360
360
|
}
|
|
361
361
|
};
|
|
362
362
|
}
|
|
@@ -973,7 +973,7 @@ class EditorView {
|
|
|
973
973
|
}
|
|
974
974
|
|
|
975
975
|
class Editor {
|
|
976
|
-
static create(parent, api, stepEditorClassName, stepEditorProvider,
|
|
976
|
+
static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider) {
|
|
977
977
|
const view = EditorView.create(parent);
|
|
978
978
|
function render(step) {
|
|
979
979
|
const definition = api.getDefinition();
|
|
@@ -981,13 +981,13 @@ class Editor {
|
|
|
981
981
|
let className;
|
|
982
982
|
if (step) {
|
|
983
983
|
const stepContext = api.createStepEditorContext(step.id);
|
|
984
|
-
content = stepEditorProvider(step, stepContext, definition);
|
|
984
|
+
content = stepEditorProvider(step, stepContext, definition, api.isReadonly());
|
|
985
985
|
className = stepEditorClassName;
|
|
986
986
|
}
|
|
987
987
|
else {
|
|
988
|
-
const
|
|
989
|
-
content =
|
|
990
|
-
className =
|
|
988
|
+
const rootContext = api.createRootEditorContext();
|
|
989
|
+
content = rootEditorProvider(definition, rootContext, api.isReadonly());
|
|
990
|
+
className = rootEditorClassName;
|
|
991
991
|
}
|
|
992
992
|
view.setContent(content, className);
|
|
993
993
|
}
|
|
@@ -3337,7 +3337,10 @@ class SmartEditorView {
|
|
|
3337
3337
|
});
|
|
3338
3338
|
parent.appendChild(toggle);
|
|
3339
3339
|
parent.appendChild(root);
|
|
3340
|
-
|
|
3340
|
+
if (configuration.globalEditorProvider) {
|
|
3341
|
+
throw new Error('globalEditorProvider is renamed to rootEditorProvider');
|
|
3342
|
+
}
|
|
3343
|
+
const editor = Editor.create(root, api, 'sqd-editor sqd-step-editor', configuration.stepEditorProvider, 'sqd-editor sqd-root-editor', configuration.rootEditorProvider);
|
|
3341
3344
|
return new SmartEditorView(root, toggle, editor);
|
|
3342
3345
|
}
|
|
3343
3346
|
constructor(root, toggle, editor) {
|
package/lib/index.d.ts
CHANGED
|
@@ -367,10 +367,8 @@ declare class EditorRenderer {
|
|
|
367
367
|
private constructor();
|
|
368
368
|
destroy(): void;
|
|
369
369
|
private render;
|
|
370
|
-
private
|
|
370
|
+
private renderIfStepChanged;
|
|
371
371
|
private readonly raceEventHandler;
|
|
372
|
-
private onDefinitionChanged;
|
|
373
|
-
private onSelectedStepIdChanged;
|
|
374
372
|
}
|
|
375
373
|
|
|
376
374
|
declare class EditorApi {
|
|
@@ -379,12 +377,13 @@ declare class EditorApi {
|
|
|
379
377
|
private readonly definitionModifier;
|
|
380
378
|
constructor(state: DesignerState, definitionWalker: DefinitionWalker, definitionModifier: DefinitionModifier);
|
|
381
379
|
isCollapsed(): boolean;
|
|
380
|
+
isReadonly(): boolean;
|
|
382
381
|
toggleIsCollapsed(): void;
|
|
383
382
|
subscribeIsCollapsed(listener: SimpleEventListener<boolean>): void;
|
|
384
383
|
getDefinition(): Definition;
|
|
385
384
|
runRenderer(rendererHandler: EditorRendererHandler): EditorRenderer;
|
|
386
385
|
createStepEditorContext(stepId: string): StepEditorContext;
|
|
387
|
-
|
|
386
|
+
createRootEditorContext(): RootEditorContext;
|
|
388
387
|
}
|
|
389
388
|
|
|
390
389
|
declare class PathBarApi {
|
|
@@ -947,20 +946,18 @@ declare enum KeyboardAction {
|
|
|
947
946
|
interface EditorsConfiguration<TDefinition extends Definition = Definition> {
|
|
948
947
|
isCollapsed?: boolean;
|
|
949
948
|
stepEditorProvider: StepEditorProvider<TDefinition>;
|
|
950
|
-
|
|
949
|
+
rootEditorProvider: RootEditorProvider<TDefinition>;
|
|
951
950
|
}
|
|
952
951
|
interface StepEditorContext {
|
|
953
952
|
notifyNameChanged(): void;
|
|
954
953
|
notifyPropertiesChanged(): void;
|
|
955
954
|
notifyChildrenChanged(): void;
|
|
956
955
|
}
|
|
957
|
-
type StepEditorProvider<TDefinition extends Definition = Definition> = (step: Step, context: StepEditorContext, definition: TDefinition) => HTMLElement;
|
|
958
|
-
interface
|
|
956
|
+
type StepEditorProvider<TDefinition extends Definition = Definition> = (step: Step, context: StepEditorContext, definition: TDefinition, isReadonly: boolean) => HTMLElement;
|
|
957
|
+
interface RootEditorContext {
|
|
959
958
|
notifyPropertiesChanged(): void;
|
|
960
959
|
}
|
|
961
|
-
type
|
|
962
|
-
type GlobalEditorProvider<TDefinition extends Definition = Definition> = (definition: TDefinition, context: GlobalEditorContext) => HTMLElement;
|
|
963
|
-
type RootEditorProvider = GlobalEditorProvider;
|
|
960
|
+
type RootEditorProvider<TDefinition extends Definition = Definition> = (definition: TDefinition, context: RootEditorContext, isReadonly: boolean) => HTMLElement;
|
|
964
961
|
interface UndoStack {
|
|
965
962
|
index: number;
|
|
966
963
|
items: UndoStackItem[];
|
|
@@ -977,7 +974,7 @@ declare enum DefinitionChangeType {
|
|
|
977
974
|
stepDeleted = 4,
|
|
978
975
|
stepMoved = 5,
|
|
979
976
|
stepInserted = 6,
|
|
980
|
-
|
|
977
|
+
rootPropertyChanged = 7,
|
|
981
978
|
rootReplaced = 8
|
|
982
979
|
}
|
|
983
980
|
|
|
@@ -1024,7 +1021,7 @@ declare class ControlBarApi {
|
|
|
1024
1021
|
declare class Editor {
|
|
1025
1022
|
private readonly view;
|
|
1026
1023
|
private readonly renderer;
|
|
1027
|
-
static create(parent: HTMLElement, api: EditorApi, stepEditorClassName: string, stepEditorProvider: StepEditorProvider,
|
|
1024
|
+
static create(parent: HTMLElement, api: EditorApi, stepEditorClassName: string, stepEditorProvider: StepEditorProvider, rootEditorClassName: string, rootEditorProvider: RootEditorProvider): Editor;
|
|
1028
1025
|
private constructor();
|
|
1029
1026
|
destroy(): void;
|
|
1030
1027
|
}
|
|
@@ -1194,4 +1191,4 @@ declare class StepsExtension extends StepsDesignerExtension {
|
|
|
1194
1191
|
interface StepsExtensionConfiguration extends StepsDesignerExtensionConfiguration {
|
|
1195
1192
|
}
|
|
1196
1193
|
|
|
1197
|
-
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,
|
|
1194
|
+
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, 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.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|