@html-graph/html-graph 8.16.0 → 8.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/dist/html-graph.d.ts +20 -1
- package/dist/html-graph.js +201 -232
- package/dist/html-graph.min.js +502 -520
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +201 -232
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -2687,6 +2687,11 @@ class InteractiveEdgeShape {
|
|
|
2687
2687
|
__publicField(this, "line");
|
|
2688
2688
|
__publicField(this, "sourceArrow");
|
|
2689
2689
|
__publicField(this, "targetArrow");
|
|
2690
|
+
// TODO: make private
|
|
2691
|
+
/**
|
|
2692
|
+
* @deprecated
|
|
2693
|
+
* do use shape.svg instead
|
|
2694
|
+
*/
|
|
2690
2695
|
__publicField(this, "handle", createEdgeGroup());
|
|
2691
2696
|
__publicField(this, "onAfterRender");
|
|
2692
2697
|
__publicField(this, "interactiveLine");
|
|
@@ -3300,11 +3305,11 @@ class DraggablePortsConfigurator {
|
|
|
3300
3305
|
}
|
|
3301
3306
|
const target = event.currentTarget;
|
|
3302
3307
|
const portId = this.canvas.graph.findPortIdsByElement(target)[0];
|
|
3303
|
-
const
|
|
3308
|
+
const dragAllowed = this.params.portDragAllowedVerifier(portId, {
|
|
3304
3309
|
x: mouseEvent.clientX,
|
|
3305
3310
|
y: mouseEvent.clientY
|
|
3306
3311
|
});
|
|
3307
|
-
if (!
|
|
3312
|
+
if (!dragAllowed) {
|
|
3308
3313
|
return;
|
|
3309
3314
|
}
|
|
3310
3315
|
event.stopPropagation();
|
|
@@ -3321,8 +3326,8 @@ class DraggablePortsConfigurator {
|
|
|
3321
3326
|
event.clientY
|
|
3322
3327
|
);
|
|
3323
3328
|
if (!isInside) {
|
|
3324
|
-
this.
|
|
3325
|
-
this.
|
|
3329
|
+
this.removeWindowMouseListeners();
|
|
3330
|
+
this.params.onPointerOutside();
|
|
3326
3331
|
return;
|
|
3327
3332
|
}
|
|
3328
3333
|
this.params.onPointerMove({ x: event.clientX, y: event.clientY });
|
|
@@ -3331,8 +3336,8 @@ class DraggablePortsConfigurator {
|
|
|
3331
3336
|
if (!this.params.mouseUpEventVerifier(event)) {
|
|
3332
3337
|
return;
|
|
3333
3338
|
}
|
|
3339
|
+
this.removeWindowMouseListeners();
|
|
3334
3340
|
this.params.onPointerUp({ x: event.clientX, y: event.clientY });
|
|
3335
|
-
this.stopMouseDrag();
|
|
3336
3341
|
});
|
|
3337
3342
|
__publicField(this, "onPortTouchStart", (event) => {
|
|
3338
3343
|
const touchEvent = event;
|
|
@@ -3342,11 +3347,11 @@ class DraggablePortsConfigurator {
|
|
|
3342
3347
|
const touch = touchEvent.touches[0];
|
|
3343
3348
|
const target = event.currentTarget;
|
|
3344
3349
|
const portId = this.canvas.graph.findPortIdsByElement(target)[0];
|
|
3345
|
-
const
|
|
3350
|
+
const dragAllowed = this.params.portDragAllowedVerifier(portId, {
|
|
3346
3351
|
x: touch.clientX,
|
|
3347
3352
|
y: touch.clientY
|
|
3348
3353
|
});
|
|
3349
|
-
if (!
|
|
3354
|
+
if (!dragAllowed) {
|
|
3350
3355
|
return;
|
|
3351
3356
|
}
|
|
3352
3357
|
event.stopPropagation();
|
|
@@ -3367,16 +3372,16 @@ class DraggablePortsConfigurator {
|
|
|
3367
3372
|
touch.clientY
|
|
3368
3373
|
);
|
|
3369
3374
|
if (!isInside) {
|
|
3370
|
-
this.
|
|
3371
|
-
this.
|
|
3375
|
+
this.removeWindowTouchListeners();
|
|
3376
|
+
this.params.onPointerOutside();
|
|
3372
3377
|
return;
|
|
3373
3378
|
}
|
|
3374
3379
|
this.params.onPointerMove({ x: touch.clientX, y: touch.clientY });
|
|
3375
3380
|
});
|
|
3376
3381
|
__publicField(this, "onWindowTouchFinish", (event) => {
|
|
3382
|
+
this.removeWindowTouchListeners();
|
|
3377
3383
|
const touch = event.changedTouches[0];
|
|
3378
3384
|
this.params.onPointerUp({ x: touch.clientX, y: touch.clientY });
|
|
3379
|
-
this.stopTouchDrag();
|
|
3380
3385
|
});
|
|
3381
3386
|
__publicField(this, "reset", () => {
|
|
3382
3387
|
this.canvas.graph.getAllPortIds().forEach((portId) => {
|
|
@@ -3385,10 +3390,9 @@ class DraggablePortsConfigurator {
|
|
|
3385
3390
|
});
|
|
3386
3391
|
});
|
|
3387
3392
|
__publicField(this, "revert", () => {
|
|
3388
|
-
this.params.onStopDrag();
|
|
3389
|
-
this.reset();
|
|
3390
3393
|
this.removeWindowMouseListeners();
|
|
3391
3394
|
this.removeWindowTouchListeners();
|
|
3395
|
+
this.reset();
|
|
3392
3396
|
});
|
|
3393
3397
|
this.canvas = canvas;
|
|
3394
3398
|
this.window = window2;
|
|
@@ -3414,14 +3418,6 @@ class DraggablePortsConfigurator {
|
|
|
3414
3418
|
element.removeEventListener("mousedown", this.onPortMouseDown);
|
|
3415
3419
|
element.removeEventListener("touchstart", this.onPortTouchStart);
|
|
3416
3420
|
}
|
|
3417
|
-
stopMouseDrag() {
|
|
3418
|
-
this.params.onStopDrag();
|
|
3419
|
-
this.removeWindowMouseListeners();
|
|
3420
|
-
}
|
|
3421
|
-
stopTouchDrag() {
|
|
3422
|
-
this.params.onStopDrag();
|
|
3423
|
-
this.removeWindowTouchListeners();
|
|
3424
|
-
}
|
|
3425
3421
|
removeWindowMouseListeners() {
|
|
3426
3422
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
3427
3423
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -3432,47 +3428,6 @@ class DraggablePortsConfigurator {
|
|
|
3432
3428
|
this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
3433
3429
|
}
|
|
3434
3430
|
}
|
|
3435
|
-
class LayoutApplier {
|
|
3436
|
-
constructor(canvas, layoutAlgorithm, params) {
|
|
3437
|
-
this.canvas = canvas;
|
|
3438
|
-
this.layoutAlgorithm = layoutAlgorithm;
|
|
3439
|
-
this.params = params;
|
|
3440
|
-
}
|
|
3441
|
-
apply() {
|
|
3442
|
-
const coords = this.layoutAlgorithm.calculateCoordinates({
|
|
3443
|
-
graph: this.canvas.graph,
|
|
3444
|
-
viewport: this.canvas.viewport
|
|
3445
|
-
});
|
|
3446
|
-
this.params.onBeforeApplied();
|
|
3447
|
-
coords.forEach((point, nodeId) => {
|
|
3448
|
-
if (!this.params.staticNodeResolver(nodeId)) {
|
|
3449
|
-
this.canvas.updateNode(nodeId, point);
|
|
3450
|
-
}
|
|
3451
|
-
});
|
|
3452
|
-
this.params.onAfterApplied();
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
class AnimatedLayoutApplier {
|
|
3456
|
-
constructor(canvas, layoutAlgorithm, params) {
|
|
3457
|
-
this.canvas = canvas;
|
|
3458
|
-
this.layoutAlgorithm = layoutAlgorithm;
|
|
3459
|
-
this.params = params;
|
|
3460
|
-
}
|
|
3461
|
-
apply(dt) {
|
|
3462
|
-
const coords = this.layoutAlgorithm.calculateNextCoordinates({
|
|
3463
|
-
graph: this.canvas.graph,
|
|
3464
|
-
viewport: this.canvas.viewport,
|
|
3465
|
-
dt
|
|
3466
|
-
});
|
|
3467
|
-
this.params.onBeforeApplied();
|
|
3468
|
-
coords.forEach((point, nodeId) => {
|
|
3469
|
-
if (!this.params.staticNodeResolver(nodeId)) {
|
|
3470
|
-
this.canvas.updateNode(nodeId, point);
|
|
3471
|
-
}
|
|
3472
|
-
});
|
|
3473
|
-
this.params.onAfterApplied();
|
|
3474
|
-
}
|
|
3475
|
-
}
|
|
3476
3431
|
class EventTagger {
|
|
3477
3432
|
constructor() {
|
|
3478
3433
|
__publicField(this, "field", "_htmlGraphTags");
|
|
@@ -4367,34 +4322,39 @@ class UserConnectablePortsConfigurator {
|
|
|
4367
4322
|
this.viewportStore,
|
|
4368
4323
|
this.window
|
|
4369
4324
|
);
|
|
4325
|
+
const draggablePortsParams = {
|
|
4326
|
+
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
4327
|
+
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
4328
|
+
portDragAllowedVerifier: (portId, cursor) => {
|
|
4329
|
+
const connectionType = this.params.connectionTypeResolver(portId);
|
|
4330
|
+
if (connectionType === null) {
|
|
4331
|
+
return false;
|
|
4332
|
+
}
|
|
4333
|
+
this.grabPort(portId, cursor, connectionType);
|
|
4334
|
+
return true;
|
|
4335
|
+
},
|
|
4336
|
+
onPointerMove: (cursor) => {
|
|
4337
|
+
this.moveDraggingPort(cursor);
|
|
4338
|
+
},
|
|
4339
|
+
onPointerUp: (cursor) => {
|
|
4340
|
+
this.tryCreateConnection(cursor);
|
|
4341
|
+
this.resetDragState();
|
|
4342
|
+
},
|
|
4343
|
+
onPointerOutside: () => {
|
|
4344
|
+
const staticPortId = this.staticPortId;
|
|
4345
|
+
const isTargetDragging = this.isTargetDragging;
|
|
4346
|
+
this.resetDragState();
|
|
4347
|
+
this.params.onEdgeCreationInterrupted({
|
|
4348
|
+
staticPortId,
|
|
4349
|
+
isDirect: isTargetDragging
|
|
4350
|
+
});
|
|
4351
|
+
}
|
|
4352
|
+
};
|
|
4370
4353
|
DraggablePortsConfigurator.configure(
|
|
4371
4354
|
this.canvas,
|
|
4372
4355
|
this.window,
|
|
4373
4356
|
this.pointInsideVerifier,
|
|
4374
|
-
|
|
4375
|
-
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
4376
|
-
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
4377
|
-
onStopDrag: () => {
|
|
4378
|
-
this.resetDragState();
|
|
4379
|
-
},
|
|
4380
|
-
onPortPointerDown: (portId, cursor) => {
|
|
4381
|
-
const connectionType = this.params.connectionTypeResolver(portId);
|
|
4382
|
-
if (connectionType === null) {
|
|
4383
|
-
return false;
|
|
4384
|
-
}
|
|
4385
|
-
this.grabPort(portId, cursor, connectionType);
|
|
4386
|
-
return true;
|
|
4387
|
-
},
|
|
4388
|
-
onPointerMove: (cursor) => {
|
|
4389
|
-
this.moveDraggingPort(cursor);
|
|
4390
|
-
},
|
|
4391
|
-
onPointerMoveOutside: () => {
|
|
4392
|
-
this.handleEdgeCreationInterrupted();
|
|
4393
|
-
},
|
|
4394
|
-
onPointerUp: (cursor) => {
|
|
4395
|
-
this.tryCreateConnection(cursor);
|
|
4396
|
-
}
|
|
4397
|
-
}
|
|
4357
|
+
draggablePortsParams
|
|
4398
4358
|
);
|
|
4399
4359
|
}
|
|
4400
4360
|
static configure(canvas, overlayLayer, viewportStore, win, pointInsideVerifier, params) {
|
|
@@ -4450,15 +4410,19 @@ class UserConnectablePortsConfigurator {
|
|
|
4450
4410
|
tryCreateConnection(cursor) {
|
|
4451
4411
|
const draggingPortId = findPortAtPoint(this.canvas.graph, cursor);
|
|
4452
4412
|
if (draggingPortId === null) {
|
|
4453
|
-
this.
|
|
4413
|
+
this.params.onEdgeCreationInterrupted({
|
|
4414
|
+
staticPortId: this.staticPortId,
|
|
4415
|
+
isDirect: this.isTargetDragging
|
|
4416
|
+
});
|
|
4454
4417
|
return;
|
|
4455
4418
|
}
|
|
4456
4419
|
const staticPortId = this.staticPortId;
|
|
4457
4420
|
const sourceId = this.isTargetDragging ? staticPortId : draggingPortId;
|
|
4458
4421
|
const targetId = this.isTargetDragging ? draggingPortId : staticPortId;
|
|
4459
4422
|
const request = { from: sourceId, to: targetId };
|
|
4423
|
+
const connectionAllowed = this.params.connectionAllowedVerifier(request);
|
|
4460
4424
|
const processedRequest = this.params.connectionPreprocessor(request);
|
|
4461
|
-
if (processedRequest !== null) {
|
|
4425
|
+
if (connectionAllowed && processedRequest !== null) {
|
|
4462
4426
|
this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated);
|
|
4463
4427
|
this.canvas.addEdge(processedRequest);
|
|
4464
4428
|
this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated);
|
|
@@ -4477,13 +4441,6 @@ class UserConnectablePortsConfigurator {
|
|
|
4477
4441
|
y: nodeContentCoords.y
|
|
4478
4442
|
});
|
|
4479
4443
|
}
|
|
4480
|
-
handleEdgeCreationInterrupted() {
|
|
4481
|
-
const staticPortId = this.staticPortId;
|
|
4482
|
-
this.params.onEdgeCreationInterrupted({
|
|
4483
|
-
staticPortId,
|
|
4484
|
-
isDirect: this.isTargetDragging
|
|
4485
|
-
});
|
|
4486
|
-
}
|
|
4487
4444
|
}
|
|
4488
4445
|
class UserDraggableEdgesConfigurator {
|
|
4489
4446
|
constructor(canvas, overlayLayer, viewportStore, window2, pointInsideVerifier, params) {
|
|
@@ -4505,38 +4462,36 @@ class UserDraggableEdgesConfigurator {
|
|
|
4505
4462
|
this.viewportStore,
|
|
4506
4463
|
this.window
|
|
4507
4464
|
);
|
|
4465
|
+
const draggablePortsParams = {
|
|
4466
|
+
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
4467
|
+
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
4468
|
+
portDragAllowedVerifier: (portId, cursor) => {
|
|
4469
|
+
return this.tryStartEdgeDragging(portId, cursor);
|
|
4470
|
+
},
|
|
4471
|
+
onPointerMove: (cursor) => {
|
|
4472
|
+
this.moveDraggingPort(cursor);
|
|
4473
|
+
},
|
|
4474
|
+
onPointerUp: (cursor) => {
|
|
4475
|
+
this.tryCreateConnection(cursor);
|
|
4476
|
+
this.resetDragState();
|
|
4477
|
+
},
|
|
4478
|
+
onPointerOutside: () => {
|
|
4479
|
+
const edge = this.draggingEdgePayload;
|
|
4480
|
+
this.resetDragState();
|
|
4481
|
+
this.params.onEdgeReattachInterrupted({
|
|
4482
|
+
id: edge.id,
|
|
4483
|
+
from: edge.from,
|
|
4484
|
+
to: edge.to,
|
|
4485
|
+
shape: edge.shape,
|
|
4486
|
+
priority: edge.priority
|
|
4487
|
+
});
|
|
4488
|
+
}
|
|
4489
|
+
};
|
|
4508
4490
|
DraggablePortsConfigurator.configure(
|
|
4509
4491
|
this.canvas,
|
|
4510
4492
|
this.window,
|
|
4511
4493
|
this.pointInsideVerifier,
|
|
4512
|
-
|
|
4513
|
-
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
4514
|
-
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
4515
|
-
onStopDrag: () => {
|
|
4516
|
-
this.resetDragState();
|
|
4517
|
-
},
|
|
4518
|
-
onPortPointerDown: (portId, cursor) => {
|
|
4519
|
-
return this.tryStartEdgeDragging(portId, cursor);
|
|
4520
|
-
},
|
|
4521
|
-
onPointerMove: (cursor) => {
|
|
4522
|
-
this.moveDraggingPort(cursor);
|
|
4523
|
-
},
|
|
4524
|
-
onPointerMoveOutside: () => {
|
|
4525
|
-
const edge = this.draggingEdgePayload;
|
|
4526
|
-
queueMicrotask(() => {
|
|
4527
|
-
this.params.onEdgeReattachInterrupted({
|
|
4528
|
-
id: edge.id,
|
|
4529
|
-
from: edge.from,
|
|
4530
|
-
to: edge.to,
|
|
4531
|
-
shape: edge.shape,
|
|
4532
|
-
priority: edge.priority
|
|
4533
|
-
});
|
|
4534
|
-
});
|
|
4535
|
-
},
|
|
4536
|
-
onPointerUp: (cursor) => {
|
|
4537
|
-
this.tryCreateConnection(cursor);
|
|
4538
|
-
}
|
|
4539
|
-
}
|
|
4494
|
+
draggablePortsParams
|
|
4540
4495
|
);
|
|
4541
4496
|
}
|
|
4542
4497
|
static configure(canvas, overlayLayer, viewportStore, win, pointInsideVerifier, params) {
|
|
@@ -4551,7 +4506,7 @@ class UserDraggableEdgesConfigurator {
|
|
|
4551
4506
|
}
|
|
4552
4507
|
tryStartEdgeDragging(portId, cursor) {
|
|
4553
4508
|
const edgeId = this.params.draggingEdgeResolver(portId);
|
|
4554
|
-
if (edgeId === null
|
|
4509
|
+
if (edgeId === null) {
|
|
4555
4510
|
return false;
|
|
4556
4511
|
}
|
|
4557
4512
|
const edge = this.canvas.graph.getEdge(edgeId);
|
|
@@ -4640,8 +4595,12 @@ class UserDraggableEdgesConfigurator {
|
|
|
4640
4595
|
shape: edge.shape,
|
|
4641
4596
|
priority: edge.priority
|
|
4642
4597
|
};
|
|
4598
|
+
const connectionAllowed = this.params.connectionAllowedVerifier({
|
|
4599
|
+
from,
|
|
4600
|
+
to
|
|
4601
|
+
});
|
|
4643
4602
|
const processedRequest = this.params.connectionPreprocessor(request);
|
|
4644
|
-
if (processedRequest !== null) {
|
|
4603
|
+
if (connectionAllowed && processedRequest !== null) {
|
|
4645
4604
|
this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeReattached);
|
|
4646
4605
|
this.canvas.addEdge(processedRequest);
|
|
4647
4606
|
this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeReattached);
|
|
@@ -4717,6 +4676,26 @@ class TopologyChangeAsyncLayoutApplicationStrategyConfigurator {
|
|
|
4717
4676
|
this.defererFn(this.apply);
|
|
4718
4677
|
}
|
|
4719
4678
|
}
|
|
4679
|
+
class LayoutApplier {
|
|
4680
|
+
constructor(canvas, layoutAlgorithm, params) {
|
|
4681
|
+
this.canvas = canvas;
|
|
4682
|
+
this.layoutAlgorithm = layoutAlgorithm;
|
|
4683
|
+
this.params = params;
|
|
4684
|
+
}
|
|
4685
|
+
apply() {
|
|
4686
|
+
const coords = this.layoutAlgorithm.calculateCoordinates({
|
|
4687
|
+
graph: this.canvas.graph,
|
|
4688
|
+
viewport: this.canvas.viewport
|
|
4689
|
+
});
|
|
4690
|
+
this.params.onBeforeApplied();
|
|
4691
|
+
coords.forEach((point, nodeId) => {
|
|
4692
|
+
if (!this.params.staticNodeResolver(nodeId)) {
|
|
4693
|
+
this.canvas.updateNode(nodeId, point);
|
|
4694
|
+
}
|
|
4695
|
+
});
|
|
4696
|
+
this.params.onAfterApplied();
|
|
4697
|
+
}
|
|
4698
|
+
}
|
|
4720
4699
|
class LayoutConfigurator {
|
|
4721
4700
|
static configure(canvas, params) {
|
|
4722
4701
|
const strategy = params.applyOn;
|
|
@@ -4762,6 +4741,27 @@ class AnimationSeries {
|
|
|
4762
4741
|
this.win.requestAnimationFrame(this.step);
|
|
4763
4742
|
}
|
|
4764
4743
|
}
|
|
4744
|
+
class AnimatedLayoutApplier {
|
|
4745
|
+
constructor(canvas, layoutAlgorithm, params) {
|
|
4746
|
+
this.canvas = canvas;
|
|
4747
|
+
this.layoutAlgorithm = layoutAlgorithm;
|
|
4748
|
+
this.params = params;
|
|
4749
|
+
}
|
|
4750
|
+
apply(dt) {
|
|
4751
|
+
const coords = this.layoutAlgorithm.calculateNextCoordinates({
|
|
4752
|
+
graph: this.canvas.graph,
|
|
4753
|
+
viewport: this.canvas.viewport,
|
|
4754
|
+
dt
|
|
4755
|
+
});
|
|
4756
|
+
this.params.onBeforeApplied();
|
|
4757
|
+
coords.forEach((point, nodeId) => {
|
|
4758
|
+
if (!this.params.staticNodeResolver(nodeId)) {
|
|
4759
|
+
this.canvas.updateNode(nodeId, point);
|
|
4760
|
+
}
|
|
4761
|
+
});
|
|
4762
|
+
this.params.onAfterApplied();
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4765
4765
|
class AnimatedLayoutConfigurator {
|
|
4766
4766
|
constructor(canvas, params, win) {
|
|
4767
4767
|
__publicField(this, "applier");
|
|
@@ -4891,9 +4891,6 @@ class UserSelectableCanvasConfigurator {
|
|
|
4891
4891
|
__publicField(this, "configurator");
|
|
4892
4892
|
__publicField(this, "onCanvasSelected");
|
|
4893
4893
|
__publicField(this, "selectionHandledTag", selectionHandled);
|
|
4894
|
-
__publicField(this, "restore", () => {
|
|
4895
|
-
this.configurator.disable(this.element);
|
|
4896
|
-
});
|
|
4897
4894
|
this.canvas = canvas;
|
|
4898
4895
|
this.element = element;
|
|
4899
4896
|
this.window = window2;
|
|
@@ -4915,7 +4912,9 @@ class UserSelectableCanvasConfigurator {
|
|
|
4915
4912
|
}
|
|
4916
4913
|
);
|
|
4917
4914
|
this.configurator.enable(this.element);
|
|
4918
|
-
this.canvas.onBeforeDestroy.subscribe(
|
|
4915
|
+
this.canvas.onBeforeDestroy.subscribe(() => {
|
|
4916
|
+
this.configurator.disable(this.element);
|
|
4917
|
+
});
|
|
4919
4918
|
}
|
|
4920
4919
|
static configure(canvas, element, window2, pointInsideVerifier, eventTagger, params) {
|
|
4921
4920
|
new UserSelectableCanvasConfigurator(
|
|
@@ -4968,22 +4967,38 @@ class Layers {
|
|
|
4968
4967
|
this.element.removeChild(this.host);
|
|
4969
4968
|
}
|
|
4970
4969
|
}
|
|
4970
|
+
const forceDirectedDefaults = Object.freeze({
|
|
4971
|
+
seed: "HTMLGraph is awesome",
|
|
4972
|
+
maxTimeDeltaSec: 0.01,
|
|
4973
|
+
nodeCharge: 1e5,
|
|
4974
|
+
nodeMass: 1,
|
|
4975
|
+
edgeEquilibriumLength: 300,
|
|
4976
|
+
edgeStiffness: 1e3,
|
|
4977
|
+
dtSec: 0.01,
|
|
4978
|
+
maxIterations: 1e3,
|
|
4979
|
+
convergenceVelocity: 10,
|
|
4980
|
+
maxForce: 1e7,
|
|
4981
|
+
nodeForceCoefficient: 1,
|
|
4982
|
+
barnesHutAreaRadiusThreshold: 0.01,
|
|
4983
|
+
barnesHutTheta: 1
|
|
4984
|
+
});
|
|
4985
|
+
const selectionDefaults = Object.freeze({
|
|
4986
|
+
mouseDownEventVerifier: (event) => event.button === 0,
|
|
4987
|
+
mouseUpEventVerifier: (event) => event.button === 0,
|
|
4988
|
+
movementThreshold: 10
|
|
4989
|
+
});
|
|
4990
|
+
const noopFn = () => {
|
|
4991
|
+
};
|
|
4971
4992
|
const createDraggableNodesParams = (config) => {
|
|
4972
4993
|
var _a, _b, _c, _d, _e, _f;
|
|
4973
|
-
const onNodeDragStarted = ((_a = config.events) == null ? void 0 : _a.onNodeDragStarted) ?? (() => {
|
|
4974
|
-
});
|
|
4975
|
-
const onNodeDrag = ((_b = config.events) == null ? void 0 : _b.onNodeDrag) ?? (() => {
|
|
4976
|
-
});
|
|
4977
4994
|
const nodeDragVerifier = config.nodeDragVerifier ?? (() => true);
|
|
4978
|
-
const onNodeDragFinished = ((_c = config.events) == null ? void 0 : _c.onNodeDragFinished) ?? (() => {
|
|
4979
|
-
});
|
|
4980
4995
|
const moveOnTop = config.moveOnTop !== false;
|
|
4981
4996
|
const moveEdgesOnTop = config.moveEdgesOnTop !== false && moveOnTop;
|
|
4982
|
-
const cursor = (
|
|
4997
|
+
const cursor = (_a = config.mouse) == null ? void 0 : _a.dragCursor;
|
|
4983
4998
|
const dragCursor = cursor !== void 0 ? cursor : "grab";
|
|
4984
|
-
const defaultMouseDownEventVerifier = (
|
|
4999
|
+
const defaultMouseDownEventVerifier = (_b = config.mouse) == null ? void 0 : _b.mouseDownEventVerifier;
|
|
4985
5000
|
const mouseDownEventVerifier = defaultMouseDownEventVerifier !== void 0 ? defaultMouseDownEventVerifier : (event) => event.button === 0;
|
|
4986
|
-
const defaultMouseUpEventVerifier = (
|
|
5001
|
+
const defaultMouseUpEventVerifier = (_c = config.mouse) == null ? void 0 : _c.mouseUpEventVerifier;
|
|
4987
5002
|
const mouseUpEventVerifier = defaultMouseUpEventVerifier !== void 0 ? defaultMouseUpEventVerifier : (event) => event.button === 0;
|
|
4988
5003
|
return {
|
|
4989
5004
|
moveOnTop,
|
|
@@ -4992,10 +5007,10 @@ const createDraggableNodesParams = (config) => {
|
|
|
4992
5007
|
gridSize: config.gridSize ?? null,
|
|
4993
5008
|
mouseDownEventVerifier,
|
|
4994
5009
|
mouseUpEventVerifier,
|
|
4995
|
-
onNodeDragStarted,
|
|
4996
|
-
onNodeDrag,
|
|
5010
|
+
onNodeDragStarted: ((_d = config.events) == null ? void 0 : _d.onNodeDragStarted) ?? noopFn,
|
|
5011
|
+
onNodeDrag: ((_e = config.events) == null ? void 0 : _e.onNodeDrag) ?? noopFn,
|
|
4997
5012
|
nodeDragVerifier,
|
|
4998
|
-
onNodeDragFinished
|
|
5013
|
+
onNodeDragFinished: ((_f = config.events) == null ? void 0 : _f.onNodeDragFinished) ?? noopFn
|
|
4999
5014
|
};
|
|
5000
5015
|
};
|
|
5001
5016
|
const createShiftLimitTransformPreprocessor = (preprocessorParams) => {
|
|
@@ -5113,34 +5128,26 @@ const createTransformableViewportParams = (transformConfig) => {
|
|
|
5113
5128
|
};
|
|
5114
5129
|
}
|
|
5115
5130
|
const shiftCursor = ((_b = transformConfig == null ? void 0 : transformConfig.shift) == null ? void 0 : _b.cursor) !== void 0 ? transformConfig.shift.cursor : "grab";
|
|
5116
|
-
const
|
|
5117
|
-
});
|
|
5118
|
-
const onTransformFinished = ((_d = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _d.onTransformChange) ?? (() => {
|
|
5119
|
-
});
|
|
5120
|
-
const defaultMouseDownEventVerifier = (_e = transformConfig == null ? void 0 : transformConfig.shift) == null ? void 0 : _e.mouseDownEventVerifier;
|
|
5131
|
+
const defaultMouseDownEventVerifier = (_c = transformConfig == null ? void 0 : transformConfig.shift) == null ? void 0 : _c.mouseDownEventVerifier;
|
|
5121
5132
|
const mouseDownEventVerifier = defaultMouseDownEventVerifier !== void 0 ? defaultMouseDownEventVerifier : (event) => event.button === 0;
|
|
5122
|
-
const defaultMouseUpEventVerifier = (
|
|
5133
|
+
const defaultMouseUpEventVerifier = (_d = transformConfig == null ? void 0 : transformConfig.shift) == null ? void 0 : _d.mouseUpEventVerifier;
|
|
5123
5134
|
const mouseUpEventVerifier = defaultMouseUpEventVerifier !== void 0 ? defaultMouseUpEventVerifier : (event) => event.button === 0;
|
|
5124
|
-
const defaultMouseWheelEventVerifier = (
|
|
5135
|
+
const defaultMouseWheelEventVerifier = (_e = transformConfig == null ? void 0 : transformConfig.scale) == null ? void 0 : _e.mouseWheelEventVerifier;
|
|
5125
5136
|
const mouseWheelEventVerifier = defaultMouseWheelEventVerifier !== void 0 ? defaultMouseWheelEventVerifier : () => true;
|
|
5126
5137
|
return {
|
|
5127
5138
|
wheelSensitivity,
|
|
5128
|
-
onTransformStarted: ((
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
onBeforeTransformChange: onBeforeTransformStarted,
|
|
5133
|
-
onTransformChange: onTransformFinished,
|
|
5139
|
+
onTransformStarted: ((_f = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _f.onTransformStarted) ?? noopFn,
|
|
5140
|
+
onTransformFinished: ((_g = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _g.onTransformFinished) ?? noopFn,
|
|
5141
|
+
onBeforeTransformChange: ((_h = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _h.onBeforeTransformChange) ?? noopFn,
|
|
5142
|
+
onTransformChange: ((_i = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _i.onTransformChange) ?? noopFn,
|
|
5134
5143
|
transformPreprocessor,
|
|
5135
5144
|
shiftCursor,
|
|
5136
5145
|
mouseDownEventVerifier,
|
|
5137
5146
|
mouseUpEventVerifier,
|
|
5138
5147
|
mouseWheelEventVerifier,
|
|
5139
5148
|
scaleWheelFinishTimeout: ((_j = transformConfig == null ? void 0 : transformConfig.scale) == null ? void 0 : _j.wheelFinishTimeout) ?? 500,
|
|
5140
|
-
onResizeTransformStarted: ((_k = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _k.onResizeTransformStarted) ??
|
|
5141
|
-
|
|
5142
|
-
onResizeTransformFinished: ((_l = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _l.onResizeTransformFinished) ?? (() => {
|
|
5143
|
-
})
|
|
5149
|
+
onResizeTransformStarted: ((_k = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _k.onResizeTransformStarted) ?? noopFn,
|
|
5150
|
+
onResizeTransformFinished: ((_l = transformConfig == null ? void 0 : transformConfig.events) == null ? void 0 : _l.onResizeTransformFinished) ?? noopFn
|
|
5144
5151
|
};
|
|
5145
5152
|
};
|
|
5146
5153
|
const createContent = (radius, color) => {
|
|
@@ -5248,34 +5255,35 @@ const resolveEdgeShapeFactory = (config) => {
|
|
|
5248
5255
|
});
|
|
5249
5256
|
}
|
|
5250
5257
|
};
|
|
5258
|
+
const defaults$3 = Object.freeze({
|
|
5259
|
+
connectionTypeResolver: () => "direct",
|
|
5260
|
+
connectionPreprocessor: (request) => request,
|
|
5261
|
+
connectionAllowedVerifier: () => true,
|
|
5262
|
+
mouseEventVerifier: (event) => event.button === 0
|
|
5263
|
+
});
|
|
5251
5264
|
const createConnectablePortsParams = (config, defaultEdgeShapeFactory, defaultDragPortDirection) => {
|
|
5252
5265
|
var _a, _b, _c;
|
|
5253
|
-
const defaultConnectionTypeResolver = () => "direct";
|
|
5254
|
-
const defaultConnectionPreprocessor = (request) => request;
|
|
5255
|
-
const defaultMouseEventVerifier = (event) => event.button === 0;
|
|
5256
|
-
const defaultOnAfterEdgeCreated = () => {
|
|
5257
|
-
};
|
|
5258
|
-
const defaultOnAfterEdgeConnectionPrevented = () => {
|
|
5259
|
-
};
|
|
5260
|
-
const defaultOnAfterEdgeConnectionInterrupted = () => {
|
|
5261
|
-
};
|
|
5262
5266
|
return {
|
|
5263
|
-
connectionTypeResolver: config.connectionTypeResolver ??
|
|
5264
|
-
connectionPreprocessor: config.connectionPreprocessor ??
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5267
|
+
connectionTypeResolver: config.connectionTypeResolver ?? defaults$3.connectionTypeResolver,
|
|
5268
|
+
connectionPreprocessor: config.connectionPreprocessor ?? defaults$3.connectionPreprocessor,
|
|
5269
|
+
connectionAllowedVerifier: config.connectionAllowedVerifier ?? defaults$3.connectionAllowedVerifier,
|
|
5270
|
+
mouseDownEventVerifier: config.mouseDownEventVerifier ?? defaults$3.mouseEventVerifier,
|
|
5271
|
+
mouseUpEventVerifier: config.mouseUpEventVerifier ?? defaults$3.mouseEventVerifier,
|
|
5272
|
+
onAfterEdgeCreated: ((_a = config.events) == null ? void 0 : _a.onAfterEdgeCreated) ?? noopFn,
|
|
5273
|
+
onEdgeCreationInterrupted: ((_b = config.events) == null ? void 0 : _b.onEdgeCreationInterrupted) ?? noopFn,
|
|
5274
|
+
onEdgeCreationPrevented: ((_c = config.events) == null ? void 0 : _c.onEdgeCreationPrevented) ?? noopFn,
|
|
5270
5275
|
dragPortDirection: config.dragPortDirection ?? defaultDragPortDirection,
|
|
5271
5276
|
edgeShapeFactory: config.edgeShape !== void 0 ? resolveEdgeShapeFactory(config.edgeShape) : defaultEdgeShapeFactory
|
|
5272
5277
|
};
|
|
5273
5278
|
};
|
|
5279
|
+
const defaults$2 = Object.freeze({
|
|
5280
|
+
connectionAllowedVerifier: () => true,
|
|
5281
|
+
connectionPreprocessor: (request) => request,
|
|
5282
|
+
mouseDownEventVerifier: (event) => event.button === 0 && event.ctrlKey,
|
|
5283
|
+
mouseUpEventVerifier: (event) => event.button === 0
|
|
5284
|
+
});
|
|
5274
5285
|
const createDraggableEdgeParams = (config, graph) => {
|
|
5275
5286
|
var _a, _b, _c;
|
|
5276
|
-
const defaultConnectionPreprocessor = (request) => request;
|
|
5277
|
-
const defaultMouseDownEventVerifier = (event) => event.button === 0 && event.ctrlKey;
|
|
5278
|
-
const defaultMouseUpEventVerifier = (event) => event.button === 0;
|
|
5279
5287
|
const defaultDraggingEdgeResolver = (portId) => {
|
|
5280
5288
|
const edgeIds = graph.getPortAdjacentEdgeIds(portId);
|
|
5281
5289
|
if (edgeIds.length > 0) {
|
|
@@ -5284,21 +5292,16 @@ const createDraggableEdgeParams = (config, graph) => {
|
|
|
5284
5292
|
return null;
|
|
5285
5293
|
}
|
|
5286
5294
|
};
|
|
5287
|
-
const defaultOnAfterEdgeReattached = () => {
|
|
5288
|
-
};
|
|
5289
|
-
const defaultOnAfterEdgeReattachPrevented = () => {
|
|
5290
|
-
};
|
|
5291
|
-
const defaultOnAfterEdgeReattachInterrupted = () => {
|
|
5292
|
-
};
|
|
5293
5295
|
return {
|
|
5294
|
-
connectionPreprocessor: config.connectionPreprocessor ??
|
|
5295
|
-
|
|
5296
|
-
|
|
5296
|
+
connectionPreprocessor: config.connectionPreprocessor ?? defaults$2.connectionPreprocessor,
|
|
5297
|
+
connectionAllowedVerifier: config.connectionAllowedVerifier ?? defaults$2.connectionAllowedVerifier,
|
|
5298
|
+
mouseDownEventVerifier: config.mouseDownEventVerifier ?? defaults$2.mouseDownEventVerifier,
|
|
5299
|
+
mouseUpEventVerifier: config.mouseUpEventVerifier ?? defaults$2.mouseUpEventVerifier,
|
|
5297
5300
|
draggingEdgeResolver: config.draggingEdgeResolver ?? defaultDraggingEdgeResolver,
|
|
5298
5301
|
draggingEdgeShapeFactory: config.draggingEdgeShape !== void 0 ? resolveEdgeShapeFactory(config.draggingEdgeShape) : null,
|
|
5299
|
-
onAfterEdgeReattached: ((_a = config.events) == null ? void 0 : _a.onAfterEdgeReattached) ??
|
|
5300
|
-
onEdgeReattachInterrupted: ((_b = config.events) == null ? void 0 : _b.onEdgeReattachInterrupted) ??
|
|
5301
|
-
onEdgeReattachPrevented: ((_c = config.events) == null ? void 0 : _c.onEdgeReattachPrevented) ??
|
|
5302
|
+
onAfterEdgeReattached: ((_a = config.events) == null ? void 0 : _a.onAfterEdgeReattached) ?? noopFn,
|
|
5303
|
+
onEdgeReattachInterrupted: ((_b = config.events) == null ? void 0 : _b.onEdgeReattachInterrupted) ?? noopFn,
|
|
5304
|
+
onEdgeReattachPrevented: ((_c = config.events) == null ? void 0 : _c.onEdgeReattachPrevented) ?? noopFn
|
|
5302
5305
|
};
|
|
5303
5306
|
};
|
|
5304
5307
|
const createVirtualScrollParams = (config) => {
|
|
@@ -5310,10 +5313,8 @@ const createVirtualScrollParams = (config) => {
|
|
|
5310
5313
|
const createVirtualScrollHtmlViewParams = (config) => {
|
|
5311
5314
|
var _a, _b;
|
|
5312
5315
|
return {
|
|
5313
|
-
onAfterNodeDetached: ((_a = config == null ? void 0 : config.events) == null ? void 0 : _a.onAfterNodeDetached) ??
|
|
5314
|
-
|
|
5315
|
-
onBeforeNodeAttached: ((_b = config == null ? void 0 : config.events) == null ? void 0 : _b.onBeforeNodeAttached) ?? (() => {
|
|
5316
|
-
})
|
|
5316
|
+
onAfterNodeDetached: ((_a = config == null ? void 0 : config.events) == null ? void 0 : _a.onAfterNodeDetached) ?? noopFn,
|
|
5317
|
+
onBeforeNodeAttached: ((_b = config == null ? void 0 : config.events) == null ? void 0 : _b.onBeforeNodeAttached) ?? noopFn
|
|
5317
5318
|
};
|
|
5318
5319
|
};
|
|
5319
5320
|
class CanvasBuilderError extends Error {
|
|
@@ -6324,26 +6325,6 @@ const sfc32 = (a, b, c, d) => {
|
|
|
6324
6325
|
return (t >>> 0) / 4294967296;
|
|
6325
6326
|
};
|
|
6326
6327
|
};
|
|
6327
|
-
const forceDirectedDefaults = Object.freeze({
|
|
6328
|
-
seed: "HTMLGraph is awesome",
|
|
6329
|
-
maxTimeDeltaSec: 0.01,
|
|
6330
|
-
nodeCharge: 1e5,
|
|
6331
|
-
nodeMass: 1,
|
|
6332
|
-
edgeEquilibriumLength: 300,
|
|
6333
|
-
edgeStiffness: 1e3,
|
|
6334
|
-
dtSec: 0.01,
|
|
6335
|
-
maxIterations: 1e3,
|
|
6336
|
-
convergenceVelocity: 10,
|
|
6337
|
-
maxForce: 1e7,
|
|
6338
|
-
nodeForceCoefficient: 1,
|
|
6339
|
-
barnesHutAreaRadiusThreshold: 0.01,
|
|
6340
|
-
barnesHutTheta: 1
|
|
6341
|
-
});
|
|
6342
|
-
const selectionDefaults = Object.freeze({
|
|
6343
|
-
mouseDownEventVerifier: (event) => event.button === 0,
|
|
6344
|
-
mouseUpEventVerifier: (event) => event.button === 0,
|
|
6345
|
-
movementThreshold: 10
|
|
6346
|
-
});
|
|
6347
6328
|
const resolveAnimatedLayoutAlgorithm = (config) => {
|
|
6348
6329
|
var _a, _b;
|
|
6349
6330
|
switch (config == null ? void 0 : config.type) {
|
|
@@ -6370,11 +6351,7 @@ const resolveAnimatedLayoutAlgorithm = (config) => {
|
|
|
6370
6351
|
}
|
|
6371
6352
|
};
|
|
6372
6353
|
const defaults$1 = {
|
|
6373
|
-
staticNodeResolver: () => false
|
|
6374
|
-
onBeforeApplied: () => {
|
|
6375
|
-
},
|
|
6376
|
-
onAfterApplied: () => {
|
|
6377
|
-
}
|
|
6354
|
+
staticNodeResolver: () => false
|
|
6378
6355
|
};
|
|
6379
6356
|
const createAnimatedLayoutParams = (config) => {
|
|
6380
6357
|
var _a, _b;
|
|
@@ -6382,8 +6359,8 @@ const createAnimatedLayoutParams = (config) => {
|
|
|
6382
6359
|
return {
|
|
6383
6360
|
algorithm,
|
|
6384
6361
|
staticNodeResolver: (config == null ? void 0 : config.staticNodeResolver) ?? defaults$1.staticNodeResolver,
|
|
6385
|
-
onBeforeApplied: ((_a = config == null ? void 0 : config.events) == null ? void 0 : _a.onBeforeApplied) ??
|
|
6386
|
-
onAfterApplied: ((_b = config == null ? void 0 : config.events) == null ? void 0 : _b.onAfterApplied) ??
|
|
6362
|
+
onBeforeApplied: ((_a = config == null ? void 0 : config.events) == null ? void 0 : _a.onBeforeApplied) ?? noopFn,
|
|
6363
|
+
onAfterApplied: ((_b = config == null ? void 0 : config.events) == null ? void 0 : _b.onAfterApplied) ?? noopFn
|
|
6387
6364
|
};
|
|
6388
6365
|
};
|
|
6389
6366
|
const resolveLayoutApplyOn = (applyOn) => {
|
|
@@ -6406,10 +6383,6 @@ const resolveLayoutApplyOn = (applyOn) => {
|
|
|
6406
6383
|
};
|
|
6407
6384
|
const defaults = Object.freeze({
|
|
6408
6385
|
staticNodeResolver: () => false,
|
|
6409
|
-
onBeforeApplied: () => {
|
|
6410
|
-
},
|
|
6411
|
-
onAfterApplied: () => {
|
|
6412
|
-
},
|
|
6413
6386
|
hierarchicalLayout: {
|
|
6414
6387
|
layerWidth: 300,
|
|
6415
6388
|
layerSpace: 300
|
|
@@ -6616,8 +6589,8 @@ const createLayoutParams = (config) => {
|
|
|
6616
6589
|
algorithm: resolveLayoutAlgorithm(config.algorithm),
|
|
6617
6590
|
applyOn: resolveLayoutApplyOn(config.applyOn),
|
|
6618
6591
|
staticNodeResolver: config.staticNodeResolver ?? defaults.staticNodeResolver,
|
|
6619
|
-
onBeforeApplied: ((_a = config.events) == null ? void 0 : _a.onBeforeApplied) ??
|
|
6620
|
-
onAfterApplied: ((_b = config.events) == null ? void 0 : _b.onAfterApplied) ??
|
|
6592
|
+
onBeforeApplied: ((_a = config.events) == null ? void 0 : _a.onBeforeApplied) ?? noopFn,
|
|
6593
|
+
onAfterApplied: ((_b = config.events) == null ? void 0 : _b.onAfterApplied) ?? noopFn
|
|
6621
6594
|
};
|
|
6622
6595
|
};
|
|
6623
6596
|
const patchAnimatedLayoutDraggableNodesParams = (params, staticNodes) => {
|
|
@@ -6998,9 +6971,7 @@ class CanvasBuilder {
|
|
|
6998
6971
|
LayoutConfigurator.configure(canvas, layoutParams);
|
|
6999
6972
|
}
|
|
7000
6973
|
if (this.hasAnimatedLayout) {
|
|
7001
|
-
let config = createAnimatedLayoutParams(
|
|
7002
|
-
this.animatedLayoutConfig
|
|
7003
|
-
);
|
|
6974
|
+
let config = createAnimatedLayoutParams(this.animatedLayoutConfig);
|
|
7004
6975
|
if (this.hasDraggableNodes) {
|
|
7005
6976
|
subscribeAnimatedLayoutStaticNodesUpdate(
|
|
7006
6977
|
canvas,
|
|
@@ -7013,11 +6984,9 @@ class CanvasBuilder {
|
|
|
7013
6984
|
}
|
|
7014
6985
|
AnimatedLayoutConfigurator.configure(canvas, config, this.window);
|
|
7015
6986
|
}
|
|
7016
|
-
|
|
6987
|
+
canvas.onBeforeDestroy.subscribe(() => {
|
|
7017
6988
|
layers.destroy();
|
|
7018
|
-
|
|
7019
|
-
};
|
|
7020
|
-
canvas.onBeforeDestroy.subscribe(onBeforeDestroy);
|
|
6989
|
+
});
|
|
7021
6990
|
return canvas;
|
|
7022
6991
|
}
|
|
7023
6992
|
createHtmlView(host, graphStore, viewportStore) {
|