@finos/legend-extension-dsl-diagram 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/DiagramRenderer.d.ts +11 -0
- package/lib/DiagramRenderer.d.ts.map +1 -1
- package/lib/DiagramRenderer.js +112 -0
- package/lib/DiagramRenderer.js.map +1 -1
- package/lib/components/studio/DSLDiagram_LegendStudioDocumentation.d.ts +0 -2
- package/lib/components/studio/DSLDiagram_LegendStudioDocumentation.d.ts.map +1 -1
- package/lib/components/studio/DSLDiagram_LegendStudioDocumentation.js +0 -14
- package/lib/components/studio/DSLDiagram_LegendStudioDocumentation.js.map +1 -1
- package/lib/components/studio/DSLDiagram_LegendStudioPlugin.d.ts +1 -2
- package/lib/components/studio/DSLDiagram_LegendStudioPlugin.d.ts.map +1 -1
- package/lib/components/studio/DSLDiagram_LegendStudioPlugin.js +6 -4
- package/lib/components/studio/DSLDiagram_LegendStudioPlugin.js.map +1 -1
- package/lib/components/studio/DiagramEditor.d.ts.map +1 -1
- package/lib/components/studio/DiagramEditor.js +4 -3
- package/lib/components/studio/DiagramEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.js +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.js +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.js.map +1 -1
- package/lib/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.d.ts +0 -1
- package/lib/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.js +0 -7
- package/lib/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.js +2 -2
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.js.map +1 -1
- package/lib/package.json +3 -3
- package/package.json +10 -10
- package/src/DiagramRenderer.ts +192 -0
- package/src/components/studio/DSLDiagram_LegendStudioDocumentation.ts +0 -20
- package/src/components/studio/DSLDiagram_LegendStudioPlugin.tsx +7 -13
- package/src/components/studio/DiagramEditor.tsx +111 -0
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.ts +1 -1
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.ts +1 -1
- package/src/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.ts +0 -8
- package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.ts +1 -2
package/lib/DiagramRenderer.d.ts
CHANGED
@@ -35,6 +35,16 @@ export declare enum DIAGRAM_RELATIONSHIP_EDIT_MODE {
|
|
35
35
|
INHERITANCE = 1,
|
36
36
|
NONE = 2
|
37
37
|
}
|
38
|
+
export declare enum ALIGNER_OPERATOR {
|
39
|
+
ALIGN_LEFT = 0,
|
40
|
+
ALIGN_CENTER = 1,
|
41
|
+
ALIGN_RIGHT = 2,
|
42
|
+
ALIGN_TOP = 3,
|
43
|
+
ALIGN_MIDDLE = 4,
|
44
|
+
ALIGN_BOTTOM = 5,
|
45
|
+
SPACE_HORIZONTALLY = 6,
|
46
|
+
SPACE_VERTICALLY = 7
|
47
|
+
}
|
38
48
|
export declare const DIAGRAM_ZOOM_LEVELS: number[];
|
39
49
|
export declare class DiagramRenderer {
|
40
50
|
diagram: Diagram;
|
@@ -178,6 +188,7 @@ export declare class DiagramRenderer {
|
|
178
188
|
*/
|
179
189
|
private recenter;
|
180
190
|
changeMode(editMode: DIAGRAM_INTERACTION_MODE, relationshipMode: DIAGRAM_RELATIONSHIP_EDIT_MODE): void;
|
191
|
+
align(op: ALIGNER_OPERATOR): void;
|
181
192
|
truncateTextWithEllipsis(val: string, limit?: number): string;
|
182
193
|
canvasCoordinateToModelCoordinate(point: Point): Point;
|
183
194
|
modelCoordinateToCanvasCoordinate(point: Point): Point;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DiagramRenderer.d.ts","sourceRoot":"","sources":["../src/DiagramRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,EAcN,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4EAA4E,CAAC;AAC1G,OAAO,EAAE,SAAS,EAAE,MAAM,uFAAuF,CAAC;AAClH,OAAO,EAAE,KAAK,EAAE,MAAM,mFAAmF,CAAC;AAC1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,iGAAiG,CAAC;AACtI,OAAO,EAAE,SAAS,EAAE,MAAM,8EAA8E,CAAC;AACzG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uFAAuF,CAAC;AAChI,OAAO,EAAE,kBAAkB,EAAE,MAAM,uFAAuF,CAAC;AAC3H,OAAO,EAAE,gBAAgB,EAAE,MAAM,qFAAqF,CAAC;AAsCvH,oBAAY,wBAAwB;IAClC,MAAM,IAAA;IACN,GAAG,IAAA;IACH,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,gBAAgB,IAAA;IAChB,SAAS,IAAA;CACV;AAED,oBAAY,8BAA8B;IAExC,QAAQ,IAAA;IACR,WAAW,IAAA;IACX,IAAI,IAAA;CACL;AAID,eAAO,MAAM,mBAAmB,UAE/B,CAAC;AAKF,qBAAa,eAAe;IAC1B,OAAO,EAAE,OAAO,CAAC;IAEjB,UAAU,EAAE,OAAO,CAAC;IAEpB,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,GAAG,EAAE,wBAAwB,CAAC;IAG9B,eAAe,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ONSHIP_EDIT_MODE["NONE"] = 2] = "NONE";
|
45
45
|
})(DIAGRAM_RELATIONSHIP_EDIT_MODE = DIAGRAM_RELATIONSHIP_EDIT_MODE || (DIAGRAM_RELATIONSHIP_EDIT_MODE = {}));
|
46
|
+
export var ALIGNER_OPERATOR;
|
47
|
+
(function (ALIGNER_OPERATOR) {
|
48
|
+
ALIGNER_OPERATOR[ALIGNER_OPERATOR["ALIGN_LEFT"] = 0] = "ALIGN_LEFT";
|
49
|
+
ALIGNER_OPERATOR[ALIGNER_OPERATOR["ALIGN_CENTER"] = 1] = "ALIGN_CENTER";
|
50
|
+
ALIGNER_OPERATOR[ALIGNER_OPERATOR["ALIGN_RIGHT"] = 2] = "ALIGN_RIGHT";
|
51
|
+
ALIGNER_OPERATOR[ALIGNER_OPERATOR["ALIGN_TOP"] = 3] = "ALIGN_TOP";
|
52
|
+
ALIGNER_OPERATOR[ALIGNER_OPERATOR["ALIGN_MIDDLE"] = 4] = "ALIGN_MIDDLE";
|
53
|
+
ALIGNER_OPERATOR[ALIGNER_OPERATOR["ALIGN_BOTTOM"] = 5] = "ALIGN_BOTTOM";
|
54
|
+
ALIGNER_OPERATOR[ALIGNER_OPERATOR["SPACE_HORIZONTALLY"] = 6] = "SPACE_HORIZONTALLY";
|
55
|
+
ALIGNER_OPERATOR[ALIGNER_OPERATOR["SPACE_VERTICALLY"] = 7] = "SPACE_VERTICALLY";
|
56
|
+
})(ALIGNER_OPERATOR = ALIGNER_OPERATOR || (ALIGNER_OPERATOR = {}));
|
46
57
|
const MIN_ZOOM_LEVEL = 0.05; // 5%
|
47
58
|
const FIT_ZOOM_PADDING = 10;
|
48
59
|
export const DIAGRAM_ZOOM_LEVELS = [
|
@@ -212,6 +223,7 @@ export class DiagramRenderer {
|
|
212
223
|
setMiddleClick: action,
|
213
224
|
setRightClick: action,
|
214
225
|
setZoomLevel: action,
|
226
|
+
align: action,
|
215
227
|
});
|
216
228
|
this.diagram = diagram;
|
217
229
|
// Container and canvas
|
@@ -460,6 +472,106 @@ export class DiagramRenderer {
|
|
460
472
|
}
|
461
473
|
}
|
462
474
|
}
|
475
|
+
align(op) {
|
476
|
+
if (this.selectedClasses.length < 2) {
|
477
|
+
return;
|
478
|
+
}
|
479
|
+
switch (op) {
|
480
|
+
case ALIGNER_OPERATOR.ALIGN_LEFT: {
|
481
|
+
const leftBound = this.selectedClasses.reduce((val, view) => Math.min(val, view.position.x), Number.MAX_SAFE_INTEGER);
|
482
|
+
this.selectedClasses.forEach((view) => positionedRectangle_setPosition(view, new Point(leftBound, view.position.y)));
|
483
|
+
break;
|
484
|
+
}
|
485
|
+
case ALIGNER_OPERATOR.ALIGN_CENTER: {
|
486
|
+
const center = this.selectedClasses.reduce((val, view) => val + view.position.x + view.rectangle.width, 0) / this.selectedClasses.length;
|
487
|
+
this.selectedClasses.forEach((view) => positionedRectangle_setPosition(view, new Point(center - view.rectangle.width / 2, view.position.y)));
|
488
|
+
break;
|
489
|
+
}
|
490
|
+
case ALIGNER_OPERATOR.ALIGN_RIGHT: {
|
491
|
+
const rightBound = this.selectedClasses.reduce((val, view) => Math.max(val, view.position.x + view.rectangle.width), -Number.MAX_SAFE_INTEGER);
|
492
|
+
this.selectedClasses.forEach((view) => positionedRectangle_setPosition(view, new Point(rightBound - view.rectangle.width, view.position.y)));
|
493
|
+
break;
|
494
|
+
}
|
495
|
+
case ALIGNER_OPERATOR.ALIGN_TOP: {
|
496
|
+
const topBound = this.selectedClasses.reduce((val, view) => Math.min(val, view.position.y), Number.MAX_SAFE_INTEGER);
|
497
|
+
this.selectedClasses.forEach((view) => positionedRectangle_setPosition(view, new Point(view.position.x, topBound)));
|
498
|
+
break;
|
499
|
+
}
|
500
|
+
case ALIGNER_OPERATOR.ALIGN_MIDDLE: {
|
501
|
+
const middle = this.selectedClasses.reduce((val, view) => val + view.position.y + view.rectangle.height, 0) / this.selectedClasses.length;
|
502
|
+
this.selectedClasses.forEach((view) => positionedRectangle_setPosition(view, new Point(view.position.x, middle - view.rectangle.height / 2)));
|
503
|
+
break;
|
504
|
+
}
|
505
|
+
case ALIGNER_OPERATOR.ALIGN_BOTTOM: {
|
506
|
+
const bottomBound = this.selectedClasses.reduce((val, view) => Math.max(val, view.position.y + view.rectangle.height), -Number.MAX_SAFE_INTEGER);
|
507
|
+
this.selectedClasses.forEach((view) => positionedRectangle_setPosition(view, new Point(view.position.x, bottomBound - view.rectangle.height)));
|
508
|
+
break;
|
509
|
+
}
|
510
|
+
case ALIGNER_OPERATOR.SPACE_HORIZONTALLY: {
|
511
|
+
const sorted = this.selectedClasses
|
512
|
+
.slice()
|
513
|
+
.sort((a, b) => a.position.x - b.position.x);
|
514
|
+
// NOTE: handle special case where there are only 2 views, make them adjacent
|
515
|
+
if (sorted.length === 2) {
|
516
|
+
const previousView = sorted[0];
|
517
|
+
const currentView = sorted[1];
|
518
|
+
positionedRectangle_setPosition(currentView, new Point(previousView.position.x + previousView.rectangle.width, currentView.position.y));
|
519
|
+
}
|
520
|
+
else {
|
521
|
+
const spacings = [];
|
522
|
+
for (let idx = 1; idx < sorted.length; idx++) {
|
523
|
+
const previousView = sorted[idx - 1];
|
524
|
+
const currentView = sorted[idx];
|
525
|
+
spacings.push(currentView.position.x -
|
526
|
+
(previousView.position.x + previousView.rectangle.width));
|
527
|
+
}
|
528
|
+
const averageSpacing = spacings.reduce((val, distance) => val + distance, 0) /
|
529
|
+
spacings.length;
|
530
|
+
for (let idx = 1; idx < sorted.length; idx++) {
|
531
|
+
const previousView = sorted[idx - 1];
|
532
|
+
const currentView = sorted[idx];
|
533
|
+
positionedRectangle_setPosition(currentView, new Point(previousView.position.x +
|
534
|
+
previousView.rectangle.width +
|
535
|
+
averageSpacing, currentView.position.y));
|
536
|
+
}
|
537
|
+
}
|
538
|
+
break;
|
539
|
+
}
|
540
|
+
case ALIGNER_OPERATOR.SPACE_VERTICALLY: {
|
541
|
+
const sorted = this.selectedClasses
|
542
|
+
.slice()
|
543
|
+
.sort((a, b) => a.position.y - b.position.y);
|
544
|
+
// NOTE: handle special case where there are only 2 views, make them adjacent
|
545
|
+
if (sorted.length === 2) {
|
546
|
+
const previousView = sorted[0];
|
547
|
+
const currentView = sorted[1];
|
548
|
+
positionedRectangle_setPosition(currentView, new Point(currentView.position.x, previousView.position.y + previousView.rectangle.height));
|
549
|
+
}
|
550
|
+
else {
|
551
|
+
const spacings = [];
|
552
|
+
for (let idx = 1; idx < sorted.length; idx++) {
|
553
|
+
const previousView = sorted[idx - 1];
|
554
|
+
const currentView = sorted[idx];
|
555
|
+
spacings.push(currentView.position.y -
|
556
|
+
(previousView.position.y + previousView.rectangle.height));
|
557
|
+
}
|
558
|
+
const averageSpacing = spacings.reduce((val, distance) => val + distance, 0) /
|
559
|
+
spacings.length;
|
560
|
+
for (let idx = 1; idx < sorted.length; idx++) {
|
561
|
+
const previousView = sorted[idx - 1];
|
562
|
+
const currentView = sorted[idx];
|
563
|
+
positionedRectangle_setPosition(currentView, new Point(currentView.position.x, previousView.position.y +
|
564
|
+
previousView.rectangle.height +
|
565
|
+
averageSpacing));
|
566
|
+
}
|
567
|
+
}
|
568
|
+
break;
|
569
|
+
}
|
570
|
+
default:
|
571
|
+
break;
|
572
|
+
}
|
573
|
+
this.drawScreen();
|
574
|
+
}
|
463
575
|
truncateTextWithEllipsis(val, limit = this.maxLineLength) {
|
464
576
|
const ellipsis = '...';
|
465
577
|
return val.length > limit
|