sequential-workflow-designer 0.24.5 → 0.24.7
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 +132 -106
- package/lib/cjs/index.cjs +132 -106
- package/lib/esm/index.js +132 -107
- package/lib/index.d.ts +25 -1
- 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.7/css/designer.css" rel="stylesheet">
|
|
107
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.7/css/designer-light.css" rel="stylesheet">
|
|
108
|
+
<link href="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.7/css/designer-dark.css" rel="stylesheet">
|
|
109
|
+
<script src="https://cdn.jsdelivr.net/npm/sequential-workflow-designer@0.24.7/dist/index.umd.js"></script>
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
Call the designer by:
|
package/dist/index.umd.js
CHANGED
|
@@ -1173,7 +1173,7 @@
|
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
1175
|
|
|
1176
|
-
const defaultConfiguration$
|
|
1176
|
+
const defaultConfiguration$6 = {
|
|
1177
1177
|
view: {
|
|
1178
1178
|
size: 22,
|
|
1179
1179
|
iconSize: 12
|
|
@@ -1181,7 +1181,7 @@
|
|
|
1181
1181
|
};
|
|
1182
1182
|
class ValidationErrorBadgeExtension {
|
|
1183
1183
|
static create(configuration) {
|
|
1184
|
-
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
1184
|
+
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$6);
|
|
1185
1185
|
}
|
|
1186
1186
|
constructor(configuration) {
|
|
1187
1187
|
this.configuration = configuration;
|
|
@@ -1481,6 +1481,122 @@
|
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
1483
|
|
|
1484
|
+
class StartStopRootComponentView {
|
|
1485
|
+
static create(parent, sequence, parentPlaceIndicator, context, cfg) {
|
|
1486
|
+
const g = Dom.svg('g', {
|
|
1487
|
+
class: 'sqd-root-start-stop'
|
|
1488
|
+
});
|
|
1489
|
+
parent.appendChild(g);
|
|
1490
|
+
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
1491
|
+
sequence,
|
|
1492
|
+
depth: 0,
|
|
1493
|
+
isInputConnected: true,
|
|
1494
|
+
isOutputConnected: true,
|
|
1495
|
+
isPreview: false
|
|
1496
|
+
}, context);
|
|
1497
|
+
const view = sequenceComponent.view;
|
|
1498
|
+
const x = view.joinX - cfg.size / 2;
|
|
1499
|
+
const endY = cfg.size + view.height;
|
|
1500
|
+
const iconSize = parentPlaceIndicator ? cfg.folderIconSize : cfg.defaultIconSize;
|
|
1501
|
+
const startCircle = createCircle(parentPlaceIndicator ? cfg.folderIconD : cfg.startIconD, cfg.size, iconSize);
|
|
1502
|
+
Dom.translate(startCircle, x, 0);
|
|
1503
|
+
g.appendChild(startCircle);
|
|
1504
|
+
Dom.translate(view.g, 0, cfg.size);
|
|
1505
|
+
const endCircle = createCircle(parentPlaceIndicator ? cfg.folderIconD : cfg.stopIconD, cfg.size, iconSize);
|
|
1506
|
+
Dom.translate(endCircle, x, endY);
|
|
1507
|
+
g.appendChild(endCircle);
|
|
1508
|
+
let startPlaceholder = null;
|
|
1509
|
+
let endPlaceholder = null;
|
|
1510
|
+
if (parentPlaceIndicator) {
|
|
1511
|
+
const size = new Vector(cfg.size, cfg.size);
|
|
1512
|
+
startPlaceholder = context.services.placeholder.createForArea(g, size, exports.PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
1513
|
+
endPlaceholder = context.services.placeholder.createForArea(g, size, exports.PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
1514
|
+
Dom.translate(startPlaceholder.view.g, x, 0);
|
|
1515
|
+
Dom.translate(endPlaceholder.view.g, x, endY);
|
|
1516
|
+
}
|
|
1517
|
+
const badges = Badges.createForRoot(g, new Vector(x + cfg.size, 0), context);
|
|
1518
|
+
return new StartStopRootComponentView(g, view.width, view.height + cfg.size * 2, view.joinX, sequenceComponent, startPlaceholder, endPlaceholder, badges);
|
|
1519
|
+
}
|
|
1520
|
+
constructor(g, width, height, joinX, component, startPlaceholder, endPlaceholder, badges) {
|
|
1521
|
+
this.g = g;
|
|
1522
|
+
this.width = width;
|
|
1523
|
+
this.height = height;
|
|
1524
|
+
this.joinX = joinX;
|
|
1525
|
+
this.component = component;
|
|
1526
|
+
this.startPlaceholder = startPlaceholder;
|
|
1527
|
+
this.endPlaceholder = endPlaceholder;
|
|
1528
|
+
this.badges = badges;
|
|
1529
|
+
}
|
|
1530
|
+
destroy() {
|
|
1531
|
+
var _a;
|
|
1532
|
+
(_a = this.g.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.g);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
function createCircle(d, size, iconSize) {
|
|
1536
|
+
const r = size / 2;
|
|
1537
|
+
const circle = Dom.svg('circle', {
|
|
1538
|
+
class: 'sqd-root-start-stop-circle',
|
|
1539
|
+
cx: r,
|
|
1540
|
+
cy: r,
|
|
1541
|
+
r: r
|
|
1542
|
+
});
|
|
1543
|
+
const g = Dom.svg('g');
|
|
1544
|
+
g.appendChild(circle);
|
|
1545
|
+
const offset = (size - iconSize) / 2;
|
|
1546
|
+
const icon = Icons.appendPath(g, 'sqd-root-start-stop-icon', d, iconSize);
|
|
1547
|
+
Dom.translate(icon, offset, offset);
|
|
1548
|
+
return g;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
class StartStopRootComponent {
|
|
1552
|
+
static create(parentElement, sequence, parentPlaceIndicator, context, viewConfiguration) {
|
|
1553
|
+
const view = StartStopRootComponentView.create(parentElement, sequence, parentPlaceIndicator, context, viewConfiguration);
|
|
1554
|
+
return new StartStopRootComponent(view);
|
|
1555
|
+
}
|
|
1556
|
+
constructor(view) {
|
|
1557
|
+
this.view = view;
|
|
1558
|
+
}
|
|
1559
|
+
resolveClick(click) {
|
|
1560
|
+
return this.view.component.resolveClick(click);
|
|
1561
|
+
}
|
|
1562
|
+
findById(stepId) {
|
|
1563
|
+
return this.view.component.findById(stepId);
|
|
1564
|
+
}
|
|
1565
|
+
resolvePlaceholders(skipComponent, result) {
|
|
1566
|
+
this.view.component.resolvePlaceholders(skipComponent, result);
|
|
1567
|
+
if (this.view.startPlaceholder && this.view.endPlaceholder) {
|
|
1568
|
+
result.placeholders.push(this.view.startPlaceholder);
|
|
1569
|
+
result.placeholders.push(this.view.endPlaceholder);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
updateBadges(result) {
|
|
1573
|
+
this.view.badges.update(result);
|
|
1574
|
+
this.view.component.updateBadges(result);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
const defaultConfiguration$5 = {
|
|
1579
|
+
view: {
|
|
1580
|
+
size: 30,
|
|
1581
|
+
defaultIconSize: 22,
|
|
1582
|
+
folderIconSize: 18,
|
|
1583
|
+
startIconD: Icons.play,
|
|
1584
|
+
stopIconD: Icons.stop,
|
|
1585
|
+
folderIconD: Icons.folder
|
|
1586
|
+
}
|
|
1587
|
+
};
|
|
1588
|
+
class StartStopRootComponentExtension {
|
|
1589
|
+
static create(configuration) {
|
|
1590
|
+
return new StartStopRootComponentExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$5);
|
|
1591
|
+
}
|
|
1592
|
+
constructor(configuration) {
|
|
1593
|
+
this.configuration = configuration;
|
|
1594
|
+
}
|
|
1595
|
+
create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
1596
|
+
return StartStopRootComponent.create(parentElement, sequence, parentPlaceIndicator, context, this.configuration.view);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1484
1600
|
const COMPONENT_CLASS_NAME$2 = 'container';
|
|
1485
1601
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1486
1602
|
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {
|
|
@@ -1706,6 +1822,12 @@
|
|
|
1706
1822
|
|
|
1707
1823
|
class CenteredViewportCalculator {
|
|
1708
1824
|
static center(margin, canvasSize, rootComponentSize) {
|
|
1825
|
+
if (canvasSize.x === 0 || canvasSize.y === 0) {
|
|
1826
|
+
return {
|
|
1827
|
+
position: new Vector(0, 0),
|
|
1828
|
+
scale: 1
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1709
1831
|
const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
|
|
1710
1832
|
const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);
|
|
1711
1833
|
const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);
|
|
@@ -4253,109 +4375,6 @@
|
|
|
4253
4375
|
}
|
|
4254
4376
|
}
|
|
4255
4377
|
|
|
4256
|
-
const SIZE = 30;
|
|
4257
|
-
const DEFAULT_ICON_SIZE = 22;
|
|
4258
|
-
const FOLDER_ICON_SIZE = 18;
|
|
4259
|
-
class StartStopRootComponentView {
|
|
4260
|
-
static create(parent, sequence, parentPlaceIndicator, context) {
|
|
4261
|
-
const g = Dom.svg('g', {
|
|
4262
|
-
class: 'sqd-root-start-stop'
|
|
4263
|
-
});
|
|
4264
|
-
parent.appendChild(g);
|
|
4265
|
-
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
4266
|
-
sequence,
|
|
4267
|
-
depth: 0,
|
|
4268
|
-
isInputConnected: true,
|
|
4269
|
-
isOutputConnected: true,
|
|
4270
|
-
isPreview: false
|
|
4271
|
-
}, context);
|
|
4272
|
-
const view = sequenceComponent.view;
|
|
4273
|
-
const x = view.joinX - SIZE / 2;
|
|
4274
|
-
const endY = SIZE + view.height;
|
|
4275
|
-
const iconSize = parentPlaceIndicator ? FOLDER_ICON_SIZE : DEFAULT_ICON_SIZE;
|
|
4276
|
-
const startCircle = createCircle(parentPlaceIndicator ? Icons.folder : Icons.play, iconSize);
|
|
4277
|
-
Dom.translate(startCircle, x, 0);
|
|
4278
|
-
g.appendChild(startCircle);
|
|
4279
|
-
Dom.translate(view.g, 0, SIZE);
|
|
4280
|
-
const endCircle = createCircle(parentPlaceIndicator ? Icons.folder : Icons.stop, iconSize);
|
|
4281
|
-
Dom.translate(endCircle, x, endY);
|
|
4282
|
-
g.appendChild(endCircle);
|
|
4283
|
-
let startPlaceholder = null;
|
|
4284
|
-
let endPlaceholder = null;
|
|
4285
|
-
if (parentPlaceIndicator) {
|
|
4286
|
-
const size = new Vector(SIZE, SIZE);
|
|
4287
|
-
startPlaceholder = context.services.placeholder.createForArea(g, size, exports.PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
4288
|
-
endPlaceholder = context.services.placeholder.createForArea(g, size, exports.PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
4289
|
-
Dom.translate(startPlaceholder.view.g, x, 0);
|
|
4290
|
-
Dom.translate(endPlaceholder.view.g, x, endY);
|
|
4291
|
-
}
|
|
4292
|
-
const badges = Badges.createForRoot(g, new Vector(x + SIZE, 0), context);
|
|
4293
|
-
return new StartStopRootComponentView(g, view.width, view.height + SIZE * 2, view.joinX, sequenceComponent, startPlaceholder, endPlaceholder, badges);
|
|
4294
|
-
}
|
|
4295
|
-
constructor(g, width, height, joinX, component, startPlaceholder, endPlaceholder, badges) {
|
|
4296
|
-
this.g = g;
|
|
4297
|
-
this.width = width;
|
|
4298
|
-
this.height = height;
|
|
4299
|
-
this.joinX = joinX;
|
|
4300
|
-
this.component = component;
|
|
4301
|
-
this.startPlaceholder = startPlaceholder;
|
|
4302
|
-
this.endPlaceholder = endPlaceholder;
|
|
4303
|
-
this.badges = badges;
|
|
4304
|
-
}
|
|
4305
|
-
destroy() {
|
|
4306
|
-
var _a;
|
|
4307
|
-
(_a = this.g.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.g);
|
|
4308
|
-
}
|
|
4309
|
-
}
|
|
4310
|
-
function createCircle(d, iconSize) {
|
|
4311
|
-
const r = SIZE / 2;
|
|
4312
|
-
const circle = Dom.svg('circle', {
|
|
4313
|
-
class: 'sqd-root-start-stop-circle',
|
|
4314
|
-
cx: r,
|
|
4315
|
-
cy: r,
|
|
4316
|
-
r: r
|
|
4317
|
-
});
|
|
4318
|
-
const g = Dom.svg('g');
|
|
4319
|
-
g.appendChild(circle);
|
|
4320
|
-
const offset = (SIZE - iconSize) / 2;
|
|
4321
|
-
const icon = Icons.appendPath(g, 'sqd-root-start-stop-icon', d, iconSize);
|
|
4322
|
-
Dom.translate(icon, offset, offset);
|
|
4323
|
-
return g;
|
|
4324
|
-
}
|
|
4325
|
-
|
|
4326
|
-
class StartStopRootComponent {
|
|
4327
|
-
static create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
4328
|
-
const view = StartStopRootComponentView.create(parentElement, sequence, parentPlaceIndicator, context);
|
|
4329
|
-
return new StartStopRootComponent(view);
|
|
4330
|
-
}
|
|
4331
|
-
constructor(view) {
|
|
4332
|
-
this.view = view;
|
|
4333
|
-
}
|
|
4334
|
-
resolveClick(click) {
|
|
4335
|
-
return this.view.component.resolveClick(click);
|
|
4336
|
-
}
|
|
4337
|
-
findById(stepId) {
|
|
4338
|
-
return this.view.component.findById(stepId);
|
|
4339
|
-
}
|
|
4340
|
-
resolvePlaceholders(skipComponent, result) {
|
|
4341
|
-
this.view.component.resolvePlaceholders(skipComponent, result);
|
|
4342
|
-
if (this.view.startPlaceholder && this.view.endPlaceholder) {
|
|
4343
|
-
result.placeholders.push(this.view.startPlaceholder);
|
|
4344
|
-
result.placeholders.push(this.view.endPlaceholder);
|
|
4345
|
-
}
|
|
4346
|
-
}
|
|
4347
|
-
updateBadges(result) {
|
|
4348
|
-
this.view.badges.update(result);
|
|
4349
|
-
this.view.component.updateBadges(result);
|
|
4350
|
-
}
|
|
4351
|
-
}
|
|
4352
|
-
|
|
4353
|
-
class StartStopRootComponentExtension {
|
|
4354
|
-
constructor() {
|
|
4355
|
-
this.create = StartStopRootComponent.create;
|
|
4356
|
-
}
|
|
4357
|
-
}
|
|
4358
|
-
|
|
4359
4378
|
const defaultConfiguration$2 = {
|
|
4360
4379
|
view: {
|
|
4361
4380
|
minContainerWidth: 40,
|
|
@@ -4568,7 +4587,7 @@
|
|
|
4568
4587
|
services.grid = LineGridExtension.create();
|
|
4569
4588
|
}
|
|
4570
4589
|
if (!services.rootComponent) {
|
|
4571
|
-
services.rootComponent =
|
|
4590
|
+
services.rootComponent = StartStopRootComponentExtension.create();
|
|
4572
4591
|
}
|
|
4573
4592
|
if (!services.sequenceComponent) {
|
|
4574
4593
|
services.sequenceComponent = new DefaultSequenceComponentExtension();
|
|
@@ -4717,6 +4736,12 @@
|
|
|
4717
4736
|
setViewport(viewport) {
|
|
4718
4737
|
this.state.setViewport(viewport);
|
|
4719
4738
|
}
|
|
4739
|
+
/**
|
|
4740
|
+
* @description Resets the viewport.
|
|
4741
|
+
*/
|
|
4742
|
+
resetViewport() {
|
|
4743
|
+
this.api.viewport.resetViewport();
|
|
4744
|
+
}
|
|
4720
4745
|
/**
|
|
4721
4746
|
* @description Unselects the selected step.
|
|
4722
4747
|
*/
|
|
@@ -4881,6 +4906,7 @@
|
|
|
4881
4906
|
exports.RectPlaceholderView = RectPlaceholderView;
|
|
4882
4907
|
exports.ServicesResolver = ServicesResolver;
|
|
4883
4908
|
exports.SimpleEvent = SimpleEvent;
|
|
4909
|
+
exports.StartStopRootComponentExtension = StartStopRootComponentExtension;
|
|
4884
4910
|
exports.StepComponent = StepComponent;
|
|
4885
4911
|
exports.StepExtensionResolver = StepExtensionResolver;
|
|
4886
4912
|
exports.StepsDesignerExtension = StepsDesignerExtension;
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -1171,7 +1171,7 @@ class ValidationErrorBadge {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
}
|
|
1173
1173
|
|
|
1174
|
-
const defaultConfiguration$
|
|
1174
|
+
const defaultConfiguration$6 = {
|
|
1175
1175
|
view: {
|
|
1176
1176
|
size: 22,
|
|
1177
1177
|
iconSize: 12
|
|
@@ -1179,7 +1179,7 @@ const defaultConfiguration$5 = {
|
|
|
1179
1179
|
};
|
|
1180
1180
|
class ValidationErrorBadgeExtension {
|
|
1181
1181
|
static create(configuration) {
|
|
1182
|
-
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
1182
|
+
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$6);
|
|
1183
1183
|
}
|
|
1184
1184
|
constructor(configuration) {
|
|
1185
1185
|
this.configuration = configuration;
|
|
@@ -1479,6 +1479,122 @@ class DefaultSequenceComponent {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
|
+
class StartStopRootComponentView {
|
|
1483
|
+
static create(parent, sequence, parentPlaceIndicator, context, cfg) {
|
|
1484
|
+
const g = Dom.svg('g', {
|
|
1485
|
+
class: 'sqd-root-start-stop'
|
|
1486
|
+
});
|
|
1487
|
+
parent.appendChild(g);
|
|
1488
|
+
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
1489
|
+
sequence,
|
|
1490
|
+
depth: 0,
|
|
1491
|
+
isInputConnected: true,
|
|
1492
|
+
isOutputConnected: true,
|
|
1493
|
+
isPreview: false
|
|
1494
|
+
}, context);
|
|
1495
|
+
const view = sequenceComponent.view;
|
|
1496
|
+
const x = view.joinX - cfg.size / 2;
|
|
1497
|
+
const endY = cfg.size + view.height;
|
|
1498
|
+
const iconSize = parentPlaceIndicator ? cfg.folderIconSize : cfg.defaultIconSize;
|
|
1499
|
+
const startCircle = createCircle(parentPlaceIndicator ? cfg.folderIconD : cfg.startIconD, cfg.size, iconSize);
|
|
1500
|
+
Dom.translate(startCircle, x, 0);
|
|
1501
|
+
g.appendChild(startCircle);
|
|
1502
|
+
Dom.translate(view.g, 0, cfg.size);
|
|
1503
|
+
const endCircle = createCircle(parentPlaceIndicator ? cfg.folderIconD : cfg.stopIconD, cfg.size, iconSize);
|
|
1504
|
+
Dom.translate(endCircle, x, endY);
|
|
1505
|
+
g.appendChild(endCircle);
|
|
1506
|
+
let startPlaceholder = null;
|
|
1507
|
+
let endPlaceholder = null;
|
|
1508
|
+
if (parentPlaceIndicator) {
|
|
1509
|
+
const size = new Vector(cfg.size, cfg.size);
|
|
1510
|
+
startPlaceholder = context.services.placeholder.createForArea(g, size, exports.PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
1511
|
+
endPlaceholder = context.services.placeholder.createForArea(g, size, exports.PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
1512
|
+
Dom.translate(startPlaceholder.view.g, x, 0);
|
|
1513
|
+
Dom.translate(endPlaceholder.view.g, x, endY);
|
|
1514
|
+
}
|
|
1515
|
+
const badges = Badges.createForRoot(g, new Vector(x + cfg.size, 0), context);
|
|
1516
|
+
return new StartStopRootComponentView(g, view.width, view.height + cfg.size * 2, view.joinX, sequenceComponent, startPlaceholder, endPlaceholder, badges);
|
|
1517
|
+
}
|
|
1518
|
+
constructor(g, width, height, joinX, component, startPlaceholder, endPlaceholder, badges) {
|
|
1519
|
+
this.g = g;
|
|
1520
|
+
this.width = width;
|
|
1521
|
+
this.height = height;
|
|
1522
|
+
this.joinX = joinX;
|
|
1523
|
+
this.component = component;
|
|
1524
|
+
this.startPlaceholder = startPlaceholder;
|
|
1525
|
+
this.endPlaceholder = endPlaceholder;
|
|
1526
|
+
this.badges = badges;
|
|
1527
|
+
}
|
|
1528
|
+
destroy() {
|
|
1529
|
+
var _a;
|
|
1530
|
+
(_a = this.g.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.g);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
function createCircle(d, size, iconSize) {
|
|
1534
|
+
const r = size / 2;
|
|
1535
|
+
const circle = Dom.svg('circle', {
|
|
1536
|
+
class: 'sqd-root-start-stop-circle',
|
|
1537
|
+
cx: r,
|
|
1538
|
+
cy: r,
|
|
1539
|
+
r: r
|
|
1540
|
+
});
|
|
1541
|
+
const g = Dom.svg('g');
|
|
1542
|
+
g.appendChild(circle);
|
|
1543
|
+
const offset = (size - iconSize) / 2;
|
|
1544
|
+
const icon = Icons.appendPath(g, 'sqd-root-start-stop-icon', d, iconSize);
|
|
1545
|
+
Dom.translate(icon, offset, offset);
|
|
1546
|
+
return g;
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
class StartStopRootComponent {
|
|
1550
|
+
static create(parentElement, sequence, parentPlaceIndicator, context, viewConfiguration) {
|
|
1551
|
+
const view = StartStopRootComponentView.create(parentElement, sequence, parentPlaceIndicator, context, viewConfiguration);
|
|
1552
|
+
return new StartStopRootComponent(view);
|
|
1553
|
+
}
|
|
1554
|
+
constructor(view) {
|
|
1555
|
+
this.view = view;
|
|
1556
|
+
}
|
|
1557
|
+
resolveClick(click) {
|
|
1558
|
+
return this.view.component.resolveClick(click);
|
|
1559
|
+
}
|
|
1560
|
+
findById(stepId) {
|
|
1561
|
+
return this.view.component.findById(stepId);
|
|
1562
|
+
}
|
|
1563
|
+
resolvePlaceholders(skipComponent, result) {
|
|
1564
|
+
this.view.component.resolvePlaceholders(skipComponent, result);
|
|
1565
|
+
if (this.view.startPlaceholder && this.view.endPlaceholder) {
|
|
1566
|
+
result.placeholders.push(this.view.startPlaceholder);
|
|
1567
|
+
result.placeholders.push(this.view.endPlaceholder);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
updateBadges(result) {
|
|
1571
|
+
this.view.badges.update(result);
|
|
1572
|
+
this.view.component.updateBadges(result);
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
const defaultConfiguration$5 = {
|
|
1577
|
+
view: {
|
|
1578
|
+
size: 30,
|
|
1579
|
+
defaultIconSize: 22,
|
|
1580
|
+
folderIconSize: 18,
|
|
1581
|
+
startIconD: Icons.play,
|
|
1582
|
+
stopIconD: Icons.stop,
|
|
1583
|
+
folderIconD: Icons.folder
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
class StartStopRootComponentExtension {
|
|
1587
|
+
static create(configuration) {
|
|
1588
|
+
return new StartStopRootComponentExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$5);
|
|
1589
|
+
}
|
|
1590
|
+
constructor(configuration) {
|
|
1591
|
+
this.configuration = configuration;
|
|
1592
|
+
}
|
|
1593
|
+
create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
1594
|
+
return StartStopRootComponent.create(parentElement, sequence, parentPlaceIndicator, context, this.configuration.view);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1482
1598
|
const COMPONENT_CLASS_NAME$2 = 'container';
|
|
1483
1599
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1484
1600
|
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {
|
|
@@ -1704,6 +1820,12 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1704
1820
|
|
|
1705
1821
|
class CenteredViewportCalculator {
|
|
1706
1822
|
static center(margin, canvasSize, rootComponentSize) {
|
|
1823
|
+
if (canvasSize.x === 0 || canvasSize.y === 0) {
|
|
1824
|
+
return {
|
|
1825
|
+
position: new Vector(0, 0),
|
|
1826
|
+
scale: 1
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1707
1829
|
const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
|
|
1708
1830
|
const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);
|
|
1709
1831
|
const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);
|
|
@@ -4068,109 +4190,6 @@ class RectPlaceholderExtension {
|
|
|
4068
4190
|
}
|
|
4069
4191
|
}
|
|
4070
4192
|
|
|
4071
|
-
const SIZE = 30;
|
|
4072
|
-
const DEFAULT_ICON_SIZE = 22;
|
|
4073
|
-
const FOLDER_ICON_SIZE = 18;
|
|
4074
|
-
class StartStopRootComponentView {
|
|
4075
|
-
static create(parent, sequence, parentPlaceIndicator, context) {
|
|
4076
|
-
const g = Dom.svg('g', {
|
|
4077
|
-
class: 'sqd-root-start-stop'
|
|
4078
|
-
});
|
|
4079
|
-
parent.appendChild(g);
|
|
4080
|
-
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
4081
|
-
sequence,
|
|
4082
|
-
depth: 0,
|
|
4083
|
-
isInputConnected: true,
|
|
4084
|
-
isOutputConnected: true,
|
|
4085
|
-
isPreview: false
|
|
4086
|
-
}, context);
|
|
4087
|
-
const view = sequenceComponent.view;
|
|
4088
|
-
const x = view.joinX - SIZE / 2;
|
|
4089
|
-
const endY = SIZE + view.height;
|
|
4090
|
-
const iconSize = parentPlaceIndicator ? FOLDER_ICON_SIZE : DEFAULT_ICON_SIZE;
|
|
4091
|
-
const startCircle = createCircle(parentPlaceIndicator ? Icons.folder : Icons.play, iconSize);
|
|
4092
|
-
Dom.translate(startCircle, x, 0);
|
|
4093
|
-
g.appendChild(startCircle);
|
|
4094
|
-
Dom.translate(view.g, 0, SIZE);
|
|
4095
|
-
const endCircle = createCircle(parentPlaceIndicator ? Icons.folder : Icons.stop, iconSize);
|
|
4096
|
-
Dom.translate(endCircle, x, endY);
|
|
4097
|
-
g.appendChild(endCircle);
|
|
4098
|
-
let startPlaceholder = null;
|
|
4099
|
-
let endPlaceholder = null;
|
|
4100
|
-
if (parentPlaceIndicator) {
|
|
4101
|
-
const size = new Vector(SIZE, SIZE);
|
|
4102
|
-
startPlaceholder = context.services.placeholder.createForArea(g, size, exports.PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
4103
|
-
endPlaceholder = context.services.placeholder.createForArea(g, size, exports.PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
4104
|
-
Dom.translate(startPlaceholder.view.g, x, 0);
|
|
4105
|
-
Dom.translate(endPlaceholder.view.g, x, endY);
|
|
4106
|
-
}
|
|
4107
|
-
const badges = Badges.createForRoot(g, new Vector(x + SIZE, 0), context);
|
|
4108
|
-
return new StartStopRootComponentView(g, view.width, view.height + SIZE * 2, view.joinX, sequenceComponent, startPlaceholder, endPlaceholder, badges);
|
|
4109
|
-
}
|
|
4110
|
-
constructor(g, width, height, joinX, component, startPlaceholder, endPlaceholder, badges) {
|
|
4111
|
-
this.g = g;
|
|
4112
|
-
this.width = width;
|
|
4113
|
-
this.height = height;
|
|
4114
|
-
this.joinX = joinX;
|
|
4115
|
-
this.component = component;
|
|
4116
|
-
this.startPlaceholder = startPlaceholder;
|
|
4117
|
-
this.endPlaceholder = endPlaceholder;
|
|
4118
|
-
this.badges = badges;
|
|
4119
|
-
}
|
|
4120
|
-
destroy() {
|
|
4121
|
-
var _a;
|
|
4122
|
-
(_a = this.g.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.g);
|
|
4123
|
-
}
|
|
4124
|
-
}
|
|
4125
|
-
function createCircle(d, iconSize) {
|
|
4126
|
-
const r = SIZE / 2;
|
|
4127
|
-
const circle = Dom.svg('circle', {
|
|
4128
|
-
class: 'sqd-root-start-stop-circle',
|
|
4129
|
-
cx: r,
|
|
4130
|
-
cy: r,
|
|
4131
|
-
r: r
|
|
4132
|
-
});
|
|
4133
|
-
const g = Dom.svg('g');
|
|
4134
|
-
g.appendChild(circle);
|
|
4135
|
-
const offset = (SIZE - iconSize) / 2;
|
|
4136
|
-
const icon = Icons.appendPath(g, 'sqd-root-start-stop-icon', d, iconSize);
|
|
4137
|
-
Dom.translate(icon, offset, offset);
|
|
4138
|
-
return g;
|
|
4139
|
-
}
|
|
4140
|
-
|
|
4141
|
-
class StartStopRootComponent {
|
|
4142
|
-
static create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
4143
|
-
const view = StartStopRootComponentView.create(parentElement, sequence, parentPlaceIndicator, context);
|
|
4144
|
-
return new StartStopRootComponent(view);
|
|
4145
|
-
}
|
|
4146
|
-
constructor(view) {
|
|
4147
|
-
this.view = view;
|
|
4148
|
-
}
|
|
4149
|
-
resolveClick(click) {
|
|
4150
|
-
return this.view.component.resolveClick(click);
|
|
4151
|
-
}
|
|
4152
|
-
findById(stepId) {
|
|
4153
|
-
return this.view.component.findById(stepId);
|
|
4154
|
-
}
|
|
4155
|
-
resolvePlaceholders(skipComponent, result) {
|
|
4156
|
-
this.view.component.resolvePlaceholders(skipComponent, result);
|
|
4157
|
-
if (this.view.startPlaceholder && this.view.endPlaceholder) {
|
|
4158
|
-
result.placeholders.push(this.view.startPlaceholder);
|
|
4159
|
-
result.placeholders.push(this.view.endPlaceholder);
|
|
4160
|
-
}
|
|
4161
|
-
}
|
|
4162
|
-
updateBadges(result) {
|
|
4163
|
-
this.view.badges.update(result);
|
|
4164
|
-
this.view.component.updateBadges(result);
|
|
4165
|
-
}
|
|
4166
|
-
}
|
|
4167
|
-
|
|
4168
|
-
class StartStopRootComponentExtension {
|
|
4169
|
-
constructor() {
|
|
4170
|
-
this.create = StartStopRootComponent.create;
|
|
4171
|
-
}
|
|
4172
|
-
}
|
|
4173
|
-
|
|
4174
4193
|
const defaultConfiguration$2 = {
|
|
4175
4194
|
view: {
|
|
4176
4195
|
minContainerWidth: 40,
|
|
@@ -4383,7 +4402,7 @@ function setDefaults(services, configuration) {
|
|
|
4383
4402
|
services.grid = LineGridExtension.create();
|
|
4384
4403
|
}
|
|
4385
4404
|
if (!services.rootComponent) {
|
|
4386
|
-
services.rootComponent =
|
|
4405
|
+
services.rootComponent = StartStopRootComponentExtension.create();
|
|
4387
4406
|
}
|
|
4388
4407
|
if (!services.sequenceComponent) {
|
|
4389
4408
|
services.sequenceComponent = new DefaultSequenceComponentExtension();
|
|
@@ -4532,6 +4551,12 @@ class Designer {
|
|
|
4532
4551
|
setViewport(viewport) {
|
|
4533
4552
|
this.state.setViewport(viewport);
|
|
4534
4553
|
}
|
|
4554
|
+
/**
|
|
4555
|
+
* @description Resets the viewport.
|
|
4556
|
+
*/
|
|
4557
|
+
resetViewport() {
|
|
4558
|
+
this.api.viewport.resetViewport();
|
|
4559
|
+
}
|
|
4535
4560
|
/**
|
|
4536
4561
|
* @description Unselects the selected step.
|
|
4537
4562
|
*/
|
|
@@ -4695,6 +4720,7 @@ exports.RectPlaceholder = RectPlaceholder;
|
|
|
4695
4720
|
exports.RectPlaceholderView = RectPlaceholderView;
|
|
4696
4721
|
exports.ServicesResolver = ServicesResolver;
|
|
4697
4722
|
exports.SimpleEvent = SimpleEvent;
|
|
4723
|
+
exports.StartStopRootComponentExtension = StartStopRootComponentExtension;
|
|
4698
4724
|
exports.StepComponent = StepComponent;
|
|
4699
4725
|
exports.StepExtensionResolver = StepExtensionResolver;
|
|
4700
4726
|
exports.StepsDesignerExtension = StepsDesignerExtension;
|
package/lib/esm/index.js
CHANGED
|
@@ -1170,7 +1170,7 @@ class ValidationErrorBadge {
|
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
1172
|
|
|
1173
|
-
const defaultConfiguration$
|
|
1173
|
+
const defaultConfiguration$6 = {
|
|
1174
1174
|
view: {
|
|
1175
1175
|
size: 22,
|
|
1176
1176
|
iconSize: 12
|
|
@@ -1178,7 +1178,7 @@ const defaultConfiguration$5 = {
|
|
|
1178
1178
|
};
|
|
1179
1179
|
class ValidationErrorBadgeExtension {
|
|
1180
1180
|
static create(configuration) {
|
|
1181
|
-
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$
|
|
1181
|
+
return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$6);
|
|
1182
1182
|
}
|
|
1183
1183
|
constructor(configuration) {
|
|
1184
1184
|
this.configuration = configuration;
|
|
@@ -1478,6 +1478,122 @@ class DefaultSequenceComponent {
|
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
1480
|
|
|
1481
|
+
class StartStopRootComponentView {
|
|
1482
|
+
static create(parent, sequence, parentPlaceIndicator, context, cfg) {
|
|
1483
|
+
const g = Dom.svg('g', {
|
|
1484
|
+
class: 'sqd-root-start-stop'
|
|
1485
|
+
});
|
|
1486
|
+
parent.appendChild(g);
|
|
1487
|
+
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
1488
|
+
sequence,
|
|
1489
|
+
depth: 0,
|
|
1490
|
+
isInputConnected: true,
|
|
1491
|
+
isOutputConnected: true,
|
|
1492
|
+
isPreview: false
|
|
1493
|
+
}, context);
|
|
1494
|
+
const view = sequenceComponent.view;
|
|
1495
|
+
const x = view.joinX - cfg.size / 2;
|
|
1496
|
+
const endY = cfg.size + view.height;
|
|
1497
|
+
const iconSize = parentPlaceIndicator ? cfg.folderIconSize : cfg.defaultIconSize;
|
|
1498
|
+
const startCircle = createCircle(parentPlaceIndicator ? cfg.folderIconD : cfg.startIconD, cfg.size, iconSize);
|
|
1499
|
+
Dom.translate(startCircle, x, 0);
|
|
1500
|
+
g.appendChild(startCircle);
|
|
1501
|
+
Dom.translate(view.g, 0, cfg.size);
|
|
1502
|
+
const endCircle = createCircle(parentPlaceIndicator ? cfg.folderIconD : cfg.stopIconD, cfg.size, iconSize);
|
|
1503
|
+
Dom.translate(endCircle, x, endY);
|
|
1504
|
+
g.appendChild(endCircle);
|
|
1505
|
+
let startPlaceholder = null;
|
|
1506
|
+
let endPlaceholder = null;
|
|
1507
|
+
if (parentPlaceIndicator) {
|
|
1508
|
+
const size = new Vector(cfg.size, cfg.size);
|
|
1509
|
+
startPlaceholder = context.services.placeholder.createForArea(g, size, PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
1510
|
+
endPlaceholder = context.services.placeholder.createForArea(g, size, PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
1511
|
+
Dom.translate(startPlaceholder.view.g, x, 0);
|
|
1512
|
+
Dom.translate(endPlaceholder.view.g, x, endY);
|
|
1513
|
+
}
|
|
1514
|
+
const badges = Badges.createForRoot(g, new Vector(x + cfg.size, 0), context);
|
|
1515
|
+
return new StartStopRootComponentView(g, view.width, view.height + cfg.size * 2, view.joinX, sequenceComponent, startPlaceholder, endPlaceholder, badges);
|
|
1516
|
+
}
|
|
1517
|
+
constructor(g, width, height, joinX, component, startPlaceholder, endPlaceholder, badges) {
|
|
1518
|
+
this.g = g;
|
|
1519
|
+
this.width = width;
|
|
1520
|
+
this.height = height;
|
|
1521
|
+
this.joinX = joinX;
|
|
1522
|
+
this.component = component;
|
|
1523
|
+
this.startPlaceholder = startPlaceholder;
|
|
1524
|
+
this.endPlaceholder = endPlaceholder;
|
|
1525
|
+
this.badges = badges;
|
|
1526
|
+
}
|
|
1527
|
+
destroy() {
|
|
1528
|
+
var _a;
|
|
1529
|
+
(_a = this.g.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.g);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
function createCircle(d, size, iconSize) {
|
|
1533
|
+
const r = size / 2;
|
|
1534
|
+
const circle = Dom.svg('circle', {
|
|
1535
|
+
class: 'sqd-root-start-stop-circle',
|
|
1536
|
+
cx: r,
|
|
1537
|
+
cy: r,
|
|
1538
|
+
r: r
|
|
1539
|
+
});
|
|
1540
|
+
const g = Dom.svg('g');
|
|
1541
|
+
g.appendChild(circle);
|
|
1542
|
+
const offset = (size - iconSize) / 2;
|
|
1543
|
+
const icon = Icons.appendPath(g, 'sqd-root-start-stop-icon', d, iconSize);
|
|
1544
|
+
Dom.translate(icon, offset, offset);
|
|
1545
|
+
return g;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
class StartStopRootComponent {
|
|
1549
|
+
static create(parentElement, sequence, parentPlaceIndicator, context, viewConfiguration) {
|
|
1550
|
+
const view = StartStopRootComponentView.create(parentElement, sequence, parentPlaceIndicator, context, viewConfiguration);
|
|
1551
|
+
return new StartStopRootComponent(view);
|
|
1552
|
+
}
|
|
1553
|
+
constructor(view) {
|
|
1554
|
+
this.view = view;
|
|
1555
|
+
}
|
|
1556
|
+
resolveClick(click) {
|
|
1557
|
+
return this.view.component.resolveClick(click);
|
|
1558
|
+
}
|
|
1559
|
+
findById(stepId) {
|
|
1560
|
+
return this.view.component.findById(stepId);
|
|
1561
|
+
}
|
|
1562
|
+
resolvePlaceholders(skipComponent, result) {
|
|
1563
|
+
this.view.component.resolvePlaceholders(skipComponent, result);
|
|
1564
|
+
if (this.view.startPlaceholder && this.view.endPlaceholder) {
|
|
1565
|
+
result.placeholders.push(this.view.startPlaceholder);
|
|
1566
|
+
result.placeholders.push(this.view.endPlaceholder);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
updateBadges(result) {
|
|
1570
|
+
this.view.badges.update(result);
|
|
1571
|
+
this.view.component.updateBadges(result);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
const defaultConfiguration$5 = {
|
|
1576
|
+
view: {
|
|
1577
|
+
size: 30,
|
|
1578
|
+
defaultIconSize: 22,
|
|
1579
|
+
folderIconSize: 18,
|
|
1580
|
+
startIconD: Icons.play,
|
|
1581
|
+
stopIconD: Icons.stop,
|
|
1582
|
+
folderIconD: Icons.folder
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
class StartStopRootComponentExtension {
|
|
1586
|
+
static create(configuration) {
|
|
1587
|
+
return new StartStopRootComponentExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$5);
|
|
1588
|
+
}
|
|
1589
|
+
constructor(configuration) {
|
|
1590
|
+
this.configuration = configuration;
|
|
1591
|
+
}
|
|
1592
|
+
create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
1593
|
+
return StartStopRootComponent.create(parentElement, sequence, parentPlaceIndicator, context, this.configuration.view);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1481
1597
|
const COMPONENT_CLASS_NAME$2 = 'container';
|
|
1482
1598
|
const createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {
|
|
1483
1599
|
return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {
|
|
@@ -1703,6 +1819,12 @@ const createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElemen
|
|
|
1703
1819
|
|
|
1704
1820
|
class CenteredViewportCalculator {
|
|
1705
1821
|
static center(margin, canvasSize, rootComponentSize) {
|
|
1822
|
+
if (canvasSize.x === 0 || canvasSize.y === 0) {
|
|
1823
|
+
return {
|
|
1824
|
+
position: new Vector(0, 0),
|
|
1825
|
+
scale: 1
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1706
1828
|
const canvasSafeWidth = Math.max(canvasSize.x - margin * 2, 0);
|
|
1707
1829
|
const canvasSafeHeight = Math.max(canvasSize.y - margin * 2, 0);
|
|
1708
1830
|
const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);
|
|
@@ -4067,109 +4189,6 @@ class RectPlaceholderExtension {
|
|
|
4067
4189
|
}
|
|
4068
4190
|
}
|
|
4069
4191
|
|
|
4070
|
-
const SIZE = 30;
|
|
4071
|
-
const DEFAULT_ICON_SIZE = 22;
|
|
4072
|
-
const FOLDER_ICON_SIZE = 18;
|
|
4073
|
-
class StartStopRootComponentView {
|
|
4074
|
-
static create(parent, sequence, parentPlaceIndicator, context) {
|
|
4075
|
-
const g = Dom.svg('g', {
|
|
4076
|
-
class: 'sqd-root-start-stop'
|
|
4077
|
-
});
|
|
4078
|
-
parent.appendChild(g);
|
|
4079
|
-
const sequenceComponent = DefaultSequenceComponent.create(g, {
|
|
4080
|
-
sequence,
|
|
4081
|
-
depth: 0,
|
|
4082
|
-
isInputConnected: true,
|
|
4083
|
-
isOutputConnected: true,
|
|
4084
|
-
isPreview: false
|
|
4085
|
-
}, context);
|
|
4086
|
-
const view = sequenceComponent.view;
|
|
4087
|
-
const x = view.joinX - SIZE / 2;
|
|
4088
|
-
const endY = SIZE + view.height;
|
|
4089
|
-
const iconSize = parentPlaceIndicator ? FOLDER_ICON_SIZE : DEFAULT_ICON_SIZE;
|
|
4090
|
-
const startCircle = createCircle(parentPlaceIndicator ? Icons.folder : Icons.play, iconSize);
|
|
4091
|
-
Dom.translate(startCircle, x, 0);
|
|
4092
|
-
g.appendChild(startCircle);
|
|
4093
|
-
Dom.translate(view.g, 0, SIZE);
|
|
4094
|
-
const endCircle = createCircle(parentPlaceIndicator ? Icons.folder : Icons.stop, iconSize);
|
|
4095
|
-
Dom.translate(endCircle, x, endY);
|
|
4096
|
-
g.appendChild(endCircle);
|
|
4097
|
-
let startPlaceholder = null;
|
|
4098
|
-
let endPlaceholder = null;
|
|
4099
|
-
if (parentPlaceIndicator) {
|
|
4100
|
-
const size = new Vector(SIZE, SIZE);
|
|
4101
|
-
startPlaceholder = context.services.placeholder.createForArea(g, size, PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
4102
|
-
endPlaceholder = context.services.placeholder.createForArea(g, size, PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);
|
|
4103
|
-
Dom.translate(startPlaceholder.view.g, x, 0);
|
|
4104
|
-
Dom.translate(endPlaceholder.view.g, x, endY);
|
|
4105
|
-
}
|
|
4106
|
-
const badges = Badges.createForRoot(g, new Vector(x + SIZE, 0), context);
|
|
4107
|
-
return new StartStopRootComponentView(g, view.width, view.height + SIZE * 2, view.joinX, sequenceComponent, startPlaceholder, endPlaceholder, badges);
|
|
4108
|
-
}
|
|
4109
|
-
constructor(g, width, height, joinX, component, startPlaceholder, endPlaceholder, badges) {
|
|
4110
|
-
this.g = g;
|
|
4111
|
-
this.width = width;
|
|
4112
|
-
this.height = height;
|
|
4113
|
-
this.joinX = joinX;
|
|
4114
|
-
this.component = component;
|
|
4115
|
-
this.startPlaceholder = startPlaceholder;
|
|
4116
|
-
this.endPlaceholder = endPlaceholder;
|
|
4117
|
-
this.badges = badges;
|
|
4118
|
-
}
|
|
4119
|
-
destroy() {
|
|
4120
|
-
var _a;
|
|
4121
|
-
(_a = this.g.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.g);
|
|
4122
|
-
}
|
|
4123
|
-
}
|
|
4124
|
-
function createCircle(d, iconSize) {
|
|
4125
|
-
const r = SIZE / 2;
|
|
4126
|
-
const circle = Dom.svg('circle', {
|
|
4127
|
-
class: 'sqd-root-start-stop-circle',
|
|
4128
|
-
cx: r,
|
|
4129
|
-
cy: r,
|
|
4130
|
-
r: r
|
|
4131
|
-
});
|
|
4132
|
-
const g = Dom.svg('g');
|
|
4133
|
-
g.appendChild(circle);
|
|
4134
|
-
const offset = (SIZE - iconSize) / 2;
|
|
4135
|
-
const icon = Icons.appendPath(g, 'sqd-root-start-stop-icon', d, iconSize);
|
|
4136
|
-
Dom.translate(icon, offset, offset);
|
|
4137
|
-
return g;
|
|
4138
|
-
}
|
|
4139
|
-
|
|
4140
|
-
class StartStopRootComponent {
|
|
4141
|
-
static create(parentElement, sequence, parentPlaceIndicator, context) {
|
|
4142
|
-
const view = StartStopRootComponentView.create(parentElement, sequence, parentPlaceIndicator, context);
|
|
4143
|
-
return new StartStopRootComponent(view);
|
|
4144
|
-
}
|
|
4145
|
-
constructor(view) {
|
|
4146
|
-
this.view = view;
|
|
4147
|
-
}
|
|
4148
|
-
resolveClick(click) {
|
|
4149
|
-
return this.view.component.resolveClick(click);
|
|
4150
|
-
}
|
|
4151
|
-
findById(stepId) {
|
|
4152
|
-
return this.view.component.findById(stepId);
|
|
4153
|
-
}
|
|
4154
|
-
resolvePlaceholders(skipComponent, result) {
|
|
4155
|
-
this.view.component.resolvePlaceholders(skipComponent, result);
|
|
4156
|
-
if (this.view.startPlaceholder && this.view.endPlaceholder) {
|
|
4157
|
-
result.placeholders.push(this.view.startPlaceholder);
|
|
4158
|
-
result.placeholders.push(this.view.endPlaceholder);
|
|
4159
|
-
}
|
|
4160
|
-
}
|
|
4161
|
-
updateBadges(result) {
|
|
4162
|
-
this.view.badges.update(result);
|
|
4163
|
-
this.view.component.updateBadges(result);
|
|
4164
|
-
}
|
|
4165
|
-
}
|
|
4166
|
-
|
|
4167
|
-
class StartStopRootComponentExtension {
|
|
4168
|
-
constructor() {
|
|
4169
|
-
this.create = StartStopRootComponent.create;
|
|
4170
|
-
}
|
|
4171
|
-
}
|
|
4172
|
-
|
|
4173
4192
|
const defaultConfiguration$2 = {
|
|
4174
4193
|
view: {
|
|
4175
4194
|
minContainerWidth: 40,
|
|
@@ -4382,7 +4401,7 @@ function setDefaults(services, configuration) {
|
|
|
4382
4401
|
services.grid = LineGridExtension.create();
|
|
4383
4402
|
}
|
|
4384
4403
|
if (!services.rootComponent) {
|
|
4385
|
-
services.rootComponent =
|
|
4404
|
+
services.rootComponent = StartStopRootComponentExtension.create();
|
|
4386
4405
|
}
|
|
4387
4406
|
if (!services.sequenceComponent) {
|
|
4388
4407
|
services.sequenceComponent = new DefaultSequenceComponentExtension();
|
|
@@ -4531,6 +4550,12 @@ class Designer {
|
|
|
4531
4550
|
setViewport(viewport) {
|
|
4532
4551
|
this.state.setViewport(viewport);
|
|
4533
4552
|
}
|
|
4553
|
+
/**
|
|
4554
|
+
* @description Resets the viewport.
|
|
4555
|
+
*/
|
|
4556
|
+
resetViewport() {
|
|
4557
|
+
this.api.viewport.resetViewport();
|
|
4558
|
+
}
|
|
4534
4559
|
/**
|
|
4535
4560
|
* @description Unselects the selected step.
|
|
4536
4561
|
*/
|
|
@@ -4661,4 +4686,4 @@ class StepsDesignerExtension {
|
|
|
4661
4686
|
}
|
|
4662
4687
|
}
|
|
4663
4688
|
|
|
4664
|
-
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, ServicesResolver, SimpleEvent, StepComponent, StepExtensionResolver, StepsDesignerExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
|
4689
|
+
export { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderView, ServicesResolver, SimpleEvent, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };
|
package/lib/index.d.ts
CHANGED
|
@@ -589,6 +589,26 @@ declare class DefaultSequenceComponent implements SequenceComponent {
|
|
|
589
589
|
updateBadges(result: BadgesResult): void;
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
+
interface StartStopRootComponentViewConfiguration {
|
|
593
|
+
size: number;
|
|
594
|
+
defaultIconSize: number;
|
|
595
|
+
folderIconSize: number;
|
|
596
|
+
folderIconD: string;
|
|
597
|
+
startIconD: string;
|
|
598
|
+
stopIconD: string;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
interface StartStopRootComponentExtensionConfiguration {
|
|
602
|
+
view: StartStopRootComponentViewConfiguration;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
declare class StartStopRootComponentExtension implements RootComponentExtension {
|
|
606
|
+
private readonly configuration;
|
|
607
|
+
static create(configuration?: StartStopRootComponentExtensionConfiguration): StartStopRootComponentExtension;
|
|
608
|
+
private constructor();
|
|
609
|
+
create(parentElement: SVGElement, sequence: Sequence, parentPlaceIndicator: SequencePlaceIndicator | null, context: ComponentContext): Component;
|
|
610
|
+
}
|
|
611
|
+
|
|
592
612
|
interface ContainerStepComponentViewConfiguration {
|
|
593
613
|
paddingTop: number;
|
|
594
614
|
paddingX: number;
|
|
@@ -1185,6 +1205,10 @@ declare class Designer<TDefinition extends Definition = Definition> {
|
|
|
1185
1205
|
* @param viewport Viewport.
|
|
1186
1206
|
*/
|
|
1187
1207
|
setViewport(viewport: Viewport): void;
|
|
1208
|
+
/**
|
|
1209
|
+
* @description Resets the viewport.
|
|
1210
|
+
*/
|
|
1211
|
+
resetViewport(): void;
|
|
1188
1212
|
/**
|
|
1189
1213
|
* @description Unselects the selected step.
|
|
1190
1214
|
*/
|
|
@@ -1278,4 +1302,4 @@ declare class StepsDesignerExtension implements DesignerExtension {
|
|
|
1278
1302
|
protected constructor(steps: StepExtension<Step>[]);
|
|
1279
1303
|
}
|
|
1280
1304
|
|
|
1281
|
-
export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentDom, ComponentView, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ContextMenuExtension, ContextMenuItem, ContextMenuItemsProvider, ControlBarApi, CustomAction, CustomActionController, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, FoundPlaceholders, Grid, GridExtension, I18n, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, PreferenceStorage, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionComponentViewContentFactory, RegionComponentViewExtension, RegionView, RegionViewFactory, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SelectedStepIdProvider, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StateModifierDependency, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, 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, getAbsolutePosition, race };
|
|
1305
|
+
export { Attributes, Badge, BadgeExtension, BadgeView, Badges, BadgesResult, BaseClickCommand, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommand, ClickCommandType, ClickDetails, Component, ComponentContext, ComponentDom, ComponentView, ContainerStepComponentViewConfiguration, ContainerStepExtensionConfiguration, ContextMenuExtension, ContextMenuItem, ContextMenuItemsProvider, ControlBarApi, CustomAction, CustomActionController, CustomActionHandler, CustomActionHandlerContext, Daemon, DaemonExtension, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerExtension, DefinitionChangeType, DefinitionChangedEvent, Designer, DesignerApi, DesignerConfiguration, DesignerContext, DesignerExtension, DesignerState, Dom, DraggedComponent, DraggedComponentExtension, Editor, EditorApi, EditorsConfiguration, FoundPlaceholders, Grid, GridExtension, I18n, Icons, InputView, JoinView, KeyboardAction, KeyboardConfiguration, LabelView, LineGridConfiguration, LineGridDesignerExtension, ObjectCloner, OpenFolderClickCommand, OutputView, PathBarApi, Placeholder, PlaceholderController, PlaceholderControllerExtension, PlaceholderDirection, PlaceholderExtension, PlaceholderView, PreferenceStorage, QuantifiedScaleViewportCalculator, RectPlaceholder, RectPlaceholderConfiguration, RectPlaceholderView, RegionComponentViewContentFactory, RegionComponentViewExtension, RegionView, RegionViewFactory, RerenderStepClickCommand, RootComponentExtension, RootEditorContext, RootEditorProvider, RootValidator, SelectStepClickCommand, SelectedStepIdProvider, SequenceComponent, SequenceComponentExtension, SequenceContext, SequencePlaceIndicator, Services, ServicesResolver, SimpleEvent, SimpleEventListener, StartStopRootComponentExtension, StartStopRootComponentExtensionConfiguration, StartStopRootComponentViewConfiguration, StateModifierDependency, StepComponent, StepComponentView, StepComponentViewContext, StepComponentViewFactory, StepComponentViewWrapperExtension, StepContext, StepDefinition, StepDescriptionProvider, StepEditorContext, StepEditorProvider, StepExtension, StepExtensionResolver, StepIconUrlProvider, StepLabelProvider, StepValidator, StepsConfiguration, StepsDesignerExtension, StepsDesignerExtensionConfiguration, SwitchStepComponentViewConfiguration, SwitchStepExtensionConfiguration, 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, getAbsolutePosition, 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.24.
|
|
4
|
+
"version": "0.24.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|