@finos/legend-extension-dsl-diagram 1.0.4 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/lib/DiagramRenderer.d.ts +6 -6
- package/lib/DiagramRenderer.d.ts.map +1 -1
- package/lib/DiagramRenderer.js +27 -16
- package/lib/DiagramRenderer.js.map +1 -1
- package/lib/components/studio/ClassDiagramPreview.d.ts +1 -0
- package/lib/components/studio/ClassDiagramPreview.d.ts.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 +1 -1
- package/lib/components/studio/DSLDiagram_LegendStudioPlugin.js.map +1 -1
- package/lib/components/studio/DiagramEditor.d.ts +1 -0
- package/lib/components/studio/DiagramEditor.d.ts.map +1 -1
- package/lib/components/studio/DiagramEditor.js +13 -15
- package/lib/components/studio/DiagramEditor.js.map +1 -1
- package/lib/components/studio/InheritanceDiagramRenderer.d.ts +1 -1
- package/lib/components/studio/InheritanceDiagramRenderer.d.ts.map +1 -1
- package/lib/components/studio/InheritanceDiagramRenderer.js +1 -1
- package/lib/components/studio/InheritanceDiagramRenderer.js.map +1 -1
- package/lib/graph/DSLDiagram_PureGraphPlugin.d.ts +1 -2
- package/lib/graph/DSLDiagram_PureGraphPlugin.d.ts.map +1 -1
- package/lib/graph/DSLDiagram_PureGraphPlugin.js +1 -1
- package/lib/graph/DSLDiagram_PureGraphPlugin.js.map +1 -1
- package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.d.ts +1 -2
- package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.d.ts.map +1 -1
- package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.js +1 -1
- package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/AssociationView.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/AssociationView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/AssociationView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/ClassView.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/ClassView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/ClassView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/ClassViewReference.d.ts +1 -2
- package/lib/models/metamodels/pure/packageableElements/diagram/ClassViewReference.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/ClassViewReference.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/Diagram.d.ts +2 -3
- package/lib/models/metamodels/pure/packageableElements/diagram/Diagram.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/Diagram.js +2 -2
- package/lib/models/metamodels/pure/packageableElements/diagram/Diagram.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/GeneralizationView.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/GeneralizationView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/GeneralizationView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/PropertyHolderView.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/PropertyHolderView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/PropertyHolderView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/PropertyView.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/PropertyView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/PropertyView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/RelationshipView.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/RelationshipView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/RelationshipView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/Point.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/Point.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/Point.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/PositionedRectangle.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/PositionedRectangle.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/PositionedRectangle.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/Rectangle.d.ts +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/Rectangle.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/Rectangle.js.map +1 -1
- package/lib/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.d.ts +1 -2
- package/lib/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_ClassView.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_ClassView.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_ClassView.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_Diagram.d.ts +2 -3
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_Diagram.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_Diagram.js +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_Diagram.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_GeneralizationView.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_GeneralizationView.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_GeneralizationView.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_PropertyHolderView.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_PropertyHolderView.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_PropertyHolderView.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_PropertyView.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_PropertyView.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_PropertyView.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_RelationshipView.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_RelationshipView.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/V1_RelationshipView.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_Point.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_Point.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_Point.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_PositionedRectangle.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_PositionedRectangle.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_PositionedRectangle.js.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_Rectangle.d.ts +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_Rectangle.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_Rectangle.js.map +1 -1
- package/lib/stores/studio/DiagramEditorState.d.ts +3 -4
- package/lib/stores/studio/DiagramEditorState.d.ts.map +1 -1
- package/lib/stores/studio/DiagramEditorState.js +5 -3
- package/lib/stores/studio/DiagramEditorState.js.map +1 -1
- package/package.json +20 -20
- package/src/DiagramRenderer.ts +54 -29
- package/src/components/studio/DSLDiagram_LegendStudioPlugin.tsx +15 -15
- package/src/components/studio/DiagramEditor.tsx +34 -34
- package/src/components/studio/InheritanceDiagramRenderer.ts +4 -2
- package/src/graph/DSLDiagram_PureGraphPlugin.ts +5 -5
- package/src/graphManager/DSLDiagram_PureGraphManagerPlugin.ts +4 -4
- package/src/models/metamodels/pure/packageableElements/diagram/AssociationView.ts +1 -2
- package/src/models/metamodels/pure/packageableElements/diagram/ClassView.ts +1 -2
- package/src/models/metamodels/pure/packageableElements/diagram/ClassViewReference.ts +2 -4
- package/src/models/metamodels/pure/packageableElements/diagram/Diagram.ts +10 -4
- package/src/models/metamodels/pure/packageableElements/diagram/GeneralizationView.ts +1 -2
- package/src/models/metamodels/pure/packageableElements/diagram/PropertyHolderView.ts +1 -2
- package/src/models/metamodels/pure/packageableElements/diagram/PropertyView.ts +1 -2
- package/src/models/metamodels/pure/packageableElements/diagram/RelationshipView.ts +1 -2
- package/src/models/metamodels/pure/packageableElements/diagram/geometry/Point.ts +1 -2
- package/src/models/metamodels/pure/packageableElements/diagram/geometry/PositionedRectangle.ts +1 -2
- package/src/models/metamodels/pure/packageableElements/diagram/geometry/Rectangle.ts +1 -2
- package/src/models/protocols/pure/DSLDiagram_PureProtocolProcessorPlugin.ts +9 -12
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/V1_ClassView.ts +1 -2
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/V1_Diagram.ts +5 -4
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/V1_GeneralizationView.ts +1 -2
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/V1_PropertyHolderView.ts +1 -2
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/V1_PropertyView.ts +1 -2
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/V1_RelationshipView.ts +1 -2
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_Point.ts +1 -2
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_PositionedRectangle.ts +1 -2
- package/src/models/protocols/pure/v1/model/packageableElements/diagram/geometry/V1_Rectangle.ts +1 -2
- package/src/stores/studio/DiagramEditorState.ts +15 -10
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-extension-dsl-diagram",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.9",
|
4
4
|
"description": "Legend extension for Diagram DSL",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -27,7 +27,9 @@
|
|
27
27
|
"build": "yarn clean && yarn build:sass && yarn build:tsc",
|
28
28
|
"build:sass": "cross-env INIT_CWD=$INIT_CWD node ../../scripts/workflow/buildSass.js",
|
29
29
|
"build:tsc": "tsc --project ./tsconfig.build.json",
|
30
|
-
"clean": "
|
30
|
+
"clean": "npm-run-all clean:cache clean:lib",
|
31
|
+
"clean:cache": "rimraf \"build\"",
|
32
|
+
"clean:lib": "rimraf \"lib\"",
|
31
33
|
"dev": "npm-run-all --parallel dev:sass dev:tsc",
|
32
34
|
"dev:sass": "sass style lib --watch --load-path=../../node_modules/@finos/legend-art/scss",
|
33
35
|
"dev:tsc": "tsc --watch --preserveWatchOutput",
|
@@ -38,34 +40,32 @@
|
|
38
40
|
"test:watch": "jest --watch"
|
39
41
|
},
|
40
42
|
"dependencies": {
|
41
|
-
"@finos/legend-application": "1.
|
42
|
-
"@finos/legend-art": "0.2
|
43
|
-
"@finos/legend-graph": "0.
|
44
|
-
"@finos/legend-model-storage": "0.0.
|
45
|
-
"@finos/legend-shared": "1.
|
46
|
-
"@finos/legend-studio": "2.
|
47
|
-
"@
|
48
|
-
"
|
49
|
-
"mobx": "
|
50
|
-
"mobx-react-lite": "3.2.2",
|
43
|
+
"@finos/legend-application": "1.1.2",
|
44
|
+
"@finos/legend-art": "0.3.2",
|
45
|
+
"@finos/legend-graph": "1.0.2",
|
46
|
+
"@finos/legend-model-storage": "0.0.15",
|
47
|
+
"@finos/legend-shared": "1.1.1",
|
48
|
+
"@finos/legend-studio": "2.3.2",
|
49
|
+
"@types/react": "17.0.38",
|
50
|
+
"mobx": "6.3.13",
|
51
|
+
"mobx-react-lite": "3.2.3",
|
51
52
|
"react": "17.0.2",
|
52
|
-
"react-dnd": "14.0.
|
53
|
+
"react-dnd": "14.0.5",
|
53
54
|
"react-dom": "17.0.2",
|
54
|
-
"react-
|
55
|
-
"react-resize-detector": "6.7.6",
|
55
|
+
"react-resize-detector": "7.0.0",
|
56
56
|
"serializr": "2.0.5"
|
57
57
|
},
|
58
58
|
"devDependencies": {
|
59
|
-
"@finos/legend-dev-utils": "0.3.
|
59
|
+
"@finos/legend-dev-utils": "0.3.7",
|
60
60
|
"@testing-library/react": "12.1.2",
|
61
61
|
"cross-env": "7.0.3",
|
62
|
-
"eslint": "8.
|
63
|
-
"jest": "27.4.
|
62
|
+
"eslint": "8.7.0",
|
63
|
+
"jest": "27.4.7",
|
64
64
|
"jest-canvas-mock": "2.3.1",
|
65
65
|
"npm-run-all": "4.1.5",
|
66
66
|
"rimraf": "3.0.2",
|
67
|
-
"sass": "1.
|
68
|
-
"typescript": "4.5.
|
67
|
+
"sass": "1.49.0",
|
68
|
+
"typescript": "4.5.5"
|
69
69
|
},
|
70
70
|
"peerDependencies": {
|
71
71
|
"react": "^17.0.0"
|
package/src/DiagramRenderer.ts
CHANGED
@@ -24,8 +24,8 @@ import {
|
|
24
24
|
findLast,
|
25
25
|
uniqBy,
|
26
26
|
} from '@finos/legend-shared';
|
27
|
-
import type { AbstractProperty } from '@finos/legend-graph';
|
28
27
|
import {
|
28
|
+
type AbstractProperty,
|
29
29
|
Class,
|
30
30
|
Enumeration,
|
31
31
|
PrimitiveType,
|
@@ -45,8 +45,10 @@ import { PositionedRectangle } from './models/metamodels/pure/packageableElement
|
|
45
45
|
import { ClassView } from './models/metamodels/pure/packageableElements/diagram/ClassView';
|
46
46
|
import type { PropertyHolderView } from './models/metamodels/pure/packageableElements/diagram/PropertyHolderView';
|
47
47
|
import { GeneralizationView } from './models/metamodels/pure/packageableElements/diagram/GeneralizationView';
|
48
|
-
import
|
49
|
-
|
48
|
+
import {
|
49
|
+
type RelationshipView,
|
50
|
+
manageInsidePointsDynamically,
|
51
|
+
} from './models/metamodels/pure/packageableElements/diagram/RelationshipView';
|
50
52
|
import { PropertyView } from './models/metamodels/pure/packageableElements/diagram/PropertyView';
|
51
53
|
import { getElementPosition } from './helpers/DiagramHelper';
|
52
54
|
import { AssociationView } from './models/metamodels/pure/packageableElements/diagram/AssociationView';
|
@@ -222,9 +224,22 @@ export class DiagramRenderer {
|
|
222
224
|
// interactions
|
223
225
|
onAddClassViewClick: (point: Point) => void = noop();
|
224
226
|
onClassViewRightClick: (classView: ClassView, point: Point) => void = noop();
|
225
|
-
|
226
|
-
|
227
|
-
|
227
|
+
|
228
|
+
onBackgroundDoubleClick?: ((point: Point) => void) | undefined;
|
229
|
+
onClassViewDoubleClick?:
|
230
|
+
| ((classView: ClassView, point: Point) => void)
|
231
|
+
| undefined;
|
232
|
+
onClassNameDoubleClick?:
|
233
|
+
| ((classView: ClassView, point: Point) => void)
|
234
|
+
| undefined;
|
235
|
+
onClassPropertyDoubleClick?:
|
236
|
+
| ((
|
237
|
+
property: AbstractProperty,
|
238
|
+
point: Point,
|
239
|
+
propertyHolderView: PropertyHolderView | undefined,
|
240
|
+
) => void)
|
241
|
+
| undefined;
|
242
|
+
|
228
243
|
handleEditClassView: (classView: ClassView) => void = noop();
|
229
244
|
handleEditProperty: (
|
230
245
|
property: AbstractProperty,
|
@@ -557,11 +572,11 @@ export class DiagramRenderer {
|
|
557
572
|
// Do not allow creating self-inheritance
|
558
573
|
startClassView.class.value !== targetClassView.class.value &&
|
559
574
|
// Avoid creating inhertance that already existed
|
560
|
-
!startClassView.class.value.
|
575
|
+
!startClassView.class.value.allSuperclasses.includes(
|
561
576
|
targetClassView.class.value,
|
562
577
|
) &&
|
563
578
|
// Avoid loop (might be expensive)
|
564
|
-
!targetClassView.class.value.
|
579
|
+
!targetClassView.class.value.allSuperclasses.includes(
|
565
580
|
startClassView.class.value,
|
566
581
|
)
|
567
582
|
) {
|
@@ -2278,7 +2293,7 @@ export class DiagramRenderer {
|
|
2278
2293
|
else if ('ArrowDown' === e.key) {
|
2279
2294
|
const views = uniqBy(
|
2280
2295
|
this.selectedClasses.flatMap((x) =>
|
2281
|
-
x.class.value.
|
2296
|
+
x.class.value.subclasses.flatMap(
|
2282
2297
|
(c) =>
|
2283
2298
|
new ClassView(
|
2284
2299
|
this.diagram,
|
@@ -2477,21 +2492,25 @@ export class DiagramRenderer {
|
|
2477
2492
|
|
2478
2493
|
// Check double click on class property
|
2479
2494
|
if (this.mouseOverClassProperty) {
|
2480
|
-
this.
|
2481
|
-
this.
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2495
|
+
if (this.onClassPropertyDoubleClick) {
|
2496
|
+
this.onClassPropertyDoubleClick(
|
2497
|
+
this.mouseOverClassProperty,
|
2498
|
+
eventPointInModelCoordinate,
|
2499
|
+
undefined,
|
2500
|
+
);
|
2501
|
+
return;
|
2502
|
+
}
|
2486
2503
|
}
|
2487
2504
|
|
2488
2505
|
// Check double click on class name
|
2489
2506
|
if (this.mouseOverClassName) {
|
2490
|
-
this.onClassNameDoubleClick
|
2491
|
-
this.
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2507
|
+
if (this.onClassNameDoubleClick) {
|
2508
|
+
this.onClassNameDoubleClick(
|
2509
|
+
this.mouseOverClassName,
|
2510
|
+
eventPointInModelCoordinate,
|
2511
|
+
);
|
2512
|
+
return;
|
2513
|
+
}
|
2495
2514
|
}
|
2496
2515
|
|
2497
2516
|
// Check double click on class view
|
@@ -2502,22 +2521,28 @@ export class DiagramRenderer {
|
|
2502
2521
|
),
|
2503
2522
|
);
|
2504
2523
|
if (selectedClass) {
|
2505
|
-
this.onClassViewDoubleClick
|
2506
|
-
|
2524
|
+
if (this.onClassViewDoubleClick) {
|
2525
|
+
this.onClassViewDoubleClick(selectedClass, eventPointInModelCoordinate);
|
2526
|
+
return;
|
2527
|
+
}
|
2507
2528
|
}
|
2508
2529
|
|
2509
2530
|
// Check double click on line property label
|
2510
2531
|
if (this.mouseOverPropertyHolderViewLabel) {
|
2511
|
-
this.
|
2512
|
-
this.
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2532
|
+
if (this.onClassPropertyDoubleClick) {
|
2533
|
+
this.onClassPropertyDoubleClick(
|
2534
|
+
this.mouseOverPropertyHolderViewLabel.property.value,
|
2535
|
+
eventPointInModelCoordinate,
|
2536
|
+
this.mouseOverPropertyHolderViewLabel,
|
2537
|
+
);
|
2538
|
+
return;
|
2539
|
+
}
|
2517
2540
|
}
|
2518
2541
|
|
2519
2542
|
// Check double click on background
|
2520
|
-
this.onBackgroundDoubleClick
|
2543
|
+
if (this.onBackgroundDoubleClick) {
|
2544
|
+
this.onBackgroundDoubleClick(eventPointInModelCoordinate);
|
2545
|
+
}
|
2521
2546
|
return;
|
2522
2547
|
}
|
2523
2548
|
|
@@ -15,22 +15,22 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import packageJson from '../../../package.json';
|
18
|
-
import
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
18
|
+
import {
|
19
|
+
LegendStudioPlugin,
|
20
|
+
type NewElementFromStateCreator,
|
21
|
+
type EditorStore,
|
22
|
+
type ElementEditorState,
|
23
|
+
type ElementEditorStateCreator,
|
24
|
+
type ElementTypeGetter,
|
25
|
+
type ElementProjectExplorerDnDTypeGetter,
|
26
|
+
type ElementIconGetter,
|
27
|
+
type ElementEditorRenderer,
|
28
|
+
type DSL_LegendStudioPlugin_Extension,
|
29
|
+
type NewElementState,
|
30
|
+
type ElementEditorPostDeleteAction,
|
31
|
+
type ElementEditorPostRenameAction,
|
32
|
+
type ClassPreviewRenderer,
|
32
33
|
} from '@finos/legend-studio';
|
33
|
-
import { LegendStudioPlugin } from '@finos/legend-studio';
|
34
34
|
import { ShapesIcon } from '@finos/legend-art';
|
35
35
|
import type { Class, PackageableElement } from '@finos/legend-graph';
|
36
36
|
import { Diagram } from '../../models/metamodels/pure/packageableElements/diagram/Diagram';
|
@@ -16,9 +16,7 @@
|
|
16
16
|
|
17
17
|
import { useRef, useState, useEffect, useCallback, Fragment } from 'react';
|
18
18
|
import { useResizeDetector } from 'react-resize-detector';
|
19
|
-
import type
|
20
|
-
import { useDrop } from 'react-dnd';
|
21
|
-
import { FaRegKeyboard } from 'react-icons/fa';
|
19
|
+
import { type DropTargetMonitor, useDrop } from 'react-dnd';
|
22
20
|
import { observer } from 'mobx-react-lite';
|
23
21
|
import {
|
24
22
|
DiagramRenderer,
|
@@ -26,18 +24,16 @@ import {
|
|
26
24
|
DIAGRAM_RELATIONSHIP_EDIT_MODE,
|
27
25
|
DIAGRAM_ZOOM_LEVELS,
|
28
26
|
} from '../../DiagramRenderer';
|
29
|
-
import type {
|
30
|
-
DiagramEditorInlineClassCreatorState,
|
31
|
-
DiagramEditorInlineClassRenamerState,
|
32
|
-
DiagramEditorInlinePropertyEditorState,
|
33
|
-
} from '../../stores/studio/DiagramEditorState';
|
34
27
|
import {
|
28
|
+
type DiagramEditorInlineClassCreatorState,
|
29
|
+
type DiagramEditorInlineClassRenamerState,
|
30
|
+
type DiagramEditorInlinePropertyEditorState,
|
35
31
|
DIAGRAM_EDITOR_SIDE_PANEL_TAB,
|
36
32
|
DiagramEditorClassViewEditorSidePanelState,
|
37
33
|
DiagramEditorState,
|
38
34
|
} from '../../stores/studio/DiagramEditorState';
|
39
|
-
import type { ResizablePanelHandlerProps } from '@finos/legend-art';
|
40
35
|
import {
|
36
|
+
type ResizablePanelHandlerProps,
|
41
37
|
ContextMenu,
|
42
38
|
getControlledResizablePanelProps,
|
43
39
|
BasePopover,
|
@@ -47,6 +43,7 @@ import {
|
|
47
43
|
clsx,
|
48
44
|
createFilter,
|
49
45
|
CustomSelectorInput,
|
46
|
+
KeyboardIcon,
|
50
47
|
DropdownMenu,
|
51
48
|
MenuContent,
|
52
49
|
MenuContentDivider,
|
@@ -56,9 +53,19 @@ import {
|
|
56
53
|
ResizablePanelGroup,
|
57
54
|
ResizablePanelSplitter,
|
58
55
|
ResizablePanel,
|
56
|
+
ResizeIcon,
|
57
|
+
MinusIcon,
|
58
|
+
MousePointerIcon,
|
59
|
+
MoveIcon,
|
60
|
+
PlusCircleIcon,
|
61
|
+
SidebarIcon,
|
62
|
+
TriangleIcon,
|
63
|
+
ZoomInIcon,
|
64
|
+
ZoomOutIcon,
|
65
|
+
Dialog,
|
59
66
|
} from '@finos/legend-art';
|
60
|
-
import type { Type } from '@finos/legend-graph';
|
61
67
|
import {
|
68
|
+
type Type,
|
62
69
|
Class,
|
63
70
|
DerivedProperty,
|
64
71
|
Property,
|
@@ -71,26 +78,16 @@ import {
|
|
71
78
|
isValidPathIdentifier,
|
72
79
|
resolvePackagePathAndElementName,
|
73
80
|
} from '@finos/legend-graph';
|
74
|
-
import {
|
75
|
-
FiMinus,
|
76
|
-
FiMousePointer,
|
77
|
-
FiMove,
|
78
|
-
FiPlusCircle,
|
79
|
-
FiSidebar,
|
80
|
-
FiTriangle,
|
81
|
-
FiZoomIn,
|
82
|
-
FiZoomOut,
|
83
|
-
} from 'react-icons/fi';
|
84
|
-
import { IoResize } from 'react-icons/io5';
|
85
|
-
import { Dialog } from '@material-ui/core';
|
86
81
|
import {
|
87
82
|
guaranteeNonNullable,
|
88
83
|
isNonNullable,
|
89
84
|
prettyCONSTName,
|
90
85
|
} from '@finos/legend-shared';
|
91
86
|
import { flowResult } from 'mobx';
|
92
|
-
import
|
93
|
-
|
87
|
+
import {
|
88
|
+
type PackageableElementOption,
|
89
|
+
useApplicationStore,
|
90
|
+
} from '@finos/legend-application';
|
94
91
|
import {
|
95
92
|
ClassFormEditor,
|
96
93
|
CORE_DND_TYPE,
|
@@ -148,6 +145,9 @@ const DiagramRendererHotkeyInfosModal = observer(
|
|
148
145
|
container: 'editor-modal__container',
|
149
146
|
paper: 'editor-modal__content--scrollable',
|
150
147
|
}}
|
148
|
+
TransitionProps={{
|
149
|
+
appear: false, // disable transition
|
150
|
+
}}
|
151
151
|
>
|
152
152
|
<div className="modal modal--dark modal--scrollable diagram-editor__hotkeys__dialog">
|
153
153
|
<div className="modal__header">
|
@@ -347,7 +347,7 @@ const DiagramEditorToolPanel = observer(
|
|
347
347
|
)}
|
348
348
|
title="View Tool (V)"
|
349
349
|
>
|
350
|
-
<
|
350
|
+
<MousePointerIcon className="diagram-editor__icon--layout" />
|
351
351
|
</button>
|
352
352
|
<button
|
353
353
|
className={clsx('diagram-editor__tool', {
|
@@ -361,7 +361,7 @@ const DiagramEditorToolPanel = observer(
|
|
361
361
|
)}
|
362
362
|
title="Pan Tool (M)"
|
363
363
|
>
|
364
|
-
<
|
364
|
+
<MoveIcon className="diagram-editor__icon--pan" />
|
365
365
|
</button>
|
366
366
|
<button
|
367
367
|
className={clsx('diagram-editor__tool', {
|
@@ -375,7 +375,7 @@ const DiagramEditorToolPanel = observer(
|
|
375
375
|
DIAGRAM_RELATIONSHIP_EDIT_MODE.NONE,
|
376
376
|
)}
|
377
377
|
>
|
378
|
-
<
|
378
|
+
<ZoomInIcon className="diagram-editor__icon--zoom-in" />
|
379
379
|
</button>
|
380
380
|
<button
|
381
381
|
className={clsx('diagram-editor__tool', {
|
@@ -389,7 +389,7 @@ const DiagramEditorToolPanel = observer(
|
|
389
389
|
DIAGRAM_RELATIONSHIP_EDIT_MODE.NONE,
|
390
390
|
)}
|
391
391
|
>
|
392
|
-
<
|
392
|
+
<ZoomOutIcon className="diagram-editor__icon--zoom-out" />
|
393
393
|
</button>
|
394
394
|
<div className="diagram-editor__tools__divider" />
|
395
395
|
<button
|
@@ -408,7 +408,7 @@ const DiagramEditorToolPanel = observer(
|
|
408
408
|
DIAGRAM_RELATIONSHIP_EDIT_MODE.PROPERTY,
|
409
409
|
)}
|
410
410
|
>
|
411
|
-
<
|
411
|
+
<MinusIcon className="diagram-editor__icon--property" />
|
412
412
|
</button>
|
413
413
|
<button
|
414
414
|
className={clsx('diagram-editor__tool', {
|
@@ -426,7 +426,7 @@ const DiagramEditorToolPanel = observer(
|
|
426
426
|
DIAGRAM_RELATIONSHIP_EDIT_MODE.INHERITANCE,
|
427
427
|
)}
|
428
428
|
>
|
429
|
-
<
|
429
|
+
<TriangleIcon className="diagram-editor__icon--inheritance" />
|
430
430
|
</button>
|
431
431
|
<button
|
432
432
|
className={clsx('diagram-editor__tool', {
|
@@ -443,7 +443,7 @@ const DiagramEditorToolPanel = observer(
|
|
443
443
|
// DIAGRAM_RELATIONSHIP_EDIT_MODE.ASSOCIATION,
|
444
444
|
// )}
|
445
445
|
>
|
446
|
-
<
|
446
|
+
<ResizeIcon className="diagram-editor__icon--association" />
|
447
447
|
</button>
|
448
448
|
<button
|
449
449
|
className={clsx('diagram-editor__tool', {
|
@@ -458,7 +458,7 @@ const DiagramEditorToolPanel = observer(
|
|
458
458
|
DIAGRAM_RELATIONSHIP_EDIT_MODE.NONE,
|
459
459
|
)}
|
460
460
|
>
|
461
|
-
<
|
461
|
+
<PlusCircleIcon className="diagram-editor__icon--add-class" />
|
462
462
|
</button>
|
463
463
|
<div className="diagram-editor__tools__divider" />
|
464
464
|
<button
|
@@ -467,7 +467,7 @@ const DiagramEditorToolPanel = observer(
|
|
467
467
|
title="Show Hotkeys"
|
468
468
|
onClick={showDiagramRendererHokeysModal}
|
469
469
|
>
|
470
|
-
<
|
470
|
+
<KeyboardIcon className="diagram-editor__icon--hotkey-info" />
|
471
471
|
</button>
|
472
472
|
<DiagramRendererHotkeyInfosModal
|
473
473
|
open={diagramEditorState.showHotkeyInfosModal}
|
@@ -1297,7 +1297,7 @@ const DiagramEditorHeader = observer(
|
|
1297
1297
|
tabIndex={-1}
|
1298
1298
|
onClick={toggleSidePanel}
|
1299
1299
|
>
|
1300
|
-
<
|
1300
|
+
<SidebarIcon className="diagram-editor__icon--sidebar" />
|
1301
1301
|
</button>
|
1302
1302
|
</div>
|
1303
1303
|
</>
|
@@ -16,8 +16,10 @@
|
|
16
16
|
|
17
17
|
import { DiagramRenderer } from '../../DiagramRenderer';
|
18
18
|
import { uuid } from '@finos/legend-shared';
|
19
|
-
import
|
20
|
-
|
19
|
+
import {
|
20
|
+
type Class,
|
21
|
+
PackageableElementExplicitReference,
|
22
|
+
} from '@finos/legend-graph';
|
21
23
|
import { Diagram } from '../../models/metamodels/pure/packageableElements/diagram/Diagram';
|
22
24
|
import { ClassView } from '../../models/metamodels/pure/packageableElements/diagram/ClassView';
|
23
25
|
|
@@ -16,12 +16,12 @@
|
|
16
16
|
|
17
17
|
import packageJson from '../../package.json';
|
18
18
|
import type { Clazz } from '@finos/legend-shared';
|
19
|
-
import
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
import {
|
20
|
+
PureGraphPlugin,
|
21
|
+
type DeadReferencesCleaner,
|
22
|
+
type PackageableElement,
|
23
|
+
type PureModel,
|
23
24
|
} from '@finos/legend-graph';
|
24
|
-
import { PureGraphPlugin } from '@finos/legend-graph';
|
25
25
|
import { Diagram } from '../models/metamodels/pure/packageableElements/diagram/Diagram';
|
26
26
|
import { cleanUpDeadReferencesInDiagram } from '../helpers/DiagramHelper';
|
27
27
|
|
@@ -15,11 +15,11 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import packageJson from '../../package.json';
|
18
|
-
import
|
19
|
-
|
20
|
-
|
18
|
+
import {
|
19
|
+
PureGraphManagerPlugin,
|
20
|
+
type PackageableElement,
|
21
|
+
type PureGrammarElementLabeler,
|
21
22
|
} from '@finos/legend-graph';
|
22
|
-
import { PureGraphManagerPlugin } from '@finos/legend-graph';
|
23
23
|
import { Diagram } from '../models/metamodels/pure/packageableElements/diagram/Diagram';
|
24
24
|
|
25
25
|
const PURE_GRAMMAR_DIAGRAM_PARSER_NAME = 'Diagram';
|
@@ -15,8 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { computed, makeObservable } from 'mobx';
|
18
|
-
import { hashArray } from '@finos/legend-shared';
|
19
|
-
import type { Hashable } from '@finos/legend-shared';
|
18
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
20
19
|
import { PropertyHolderView } from './PropertyHolderView';
|
21
20
|
import type { ClassView } from './ClassView';
|
22
21
|
import type { Diagram } from './Diagram';
|
@@ -15,8 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { computed, observable, action, makeObservable } from 'mobx';
|
18
|
-
import { hashArray } from '@finos/legend-shared';
|
19
|
-
import type { Hashable } from '@finos/legend-shared';
|
18
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
20
19
|
import { PositionedRectangle } from './geometry/PositionedRectangle';
|
21
20
|
import { Rectangle } from './geometry/Rectangle';
|
22
21
|
import { Point } from './geometry/Point';
|
@@ -20,10 +20,8 @@ import type { ClassView } from './ClassView';
|
|
20
20
|
import {
|
21
21
|
PackageableElementExplicitReference,
|
22
22
|
ReferenceWithOwner,
|
23
|
-
|
24
|
-
|
25
|
-
PackageableElementImplicitReference,
|
26
|
-
PackageableElementReference,
|
23
|
+
type PackageableElementImplicitReference,
|
24
|
+
type PackageableElementReference,
|
27
25
|
} from '@finos/legend-graph';
|
28
26
|
|
29
27
|
export abstract class ClassViewReference extends ReferenceWithOwner {
|
@@ -15,14 +15,20 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { observable, action, makeObservable, override } from 'mobx';
|
18
|
-
import {
|
19
|
-
|
18
|
+
import {
|
19
|
+
hashArray,
|
20
|
+
addUniqueEntry,
|
21
|
+
deleteEntry,
|
22
|
+
type Hashable,
|
23
|
+
} from '@finos/legend-shared';
|
20
24
|
import type { ClassView } from './ClassView';
|
21
25
|
import type { PropertyView } from './PropertyView';
|
22
26
|
import type { GeneralizationView } from './GeneralizationView';
|
23
27
|
import type { AssociationView } from './AssociationView';
|
24
|
-
import
|
25
|
-
|
28
|
+
import {
|
29
|
+
type PackageableElementVisitor,
|
30
|
+
PackageableElement,
|
31
|
+
} from '@finos/legend-graph';
|
26
32
|
import { DIAGRAM_HASH_STRUCTURE } from '../../../../DSLDiagram_ModelUtils';
|
27
33
|
|
28
34
|
export class Diagram extends PackageableElement implements Hashable {
|
@@ -15,8 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { computed, makeObservable } from 'mobx';
|
18
|
-
import { hashArray } from '@finos/legend-shared';
|
19
|
-
import type { Hashable } from '@finos/legend-shared';
|
18
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
20
19
|
import { RelationshipView } from './RelationshipView';
|
21
20
|
import type { Diagram } from './Diagram';
|
22
21
|
import type { ClassView } from './ClassView';
|
@@ -14,8 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { hashArray } from '@finos/legend-shared';
|
18
|
-
import type { Hashable } from '@finos/legend-shared';
|
17
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
19
18
|
import { RelationshipView } from './RelationshipView';
|
20
19
|
import type { ClassView } from './ClassView';
|
21
20
|
import type { Diagram } from './Diagram';
|
@@ -15,8 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { computed, makeObservable } from 'mobx';
|
18
|
-
import { hashArray } from '@finos/legend-shared';
|
19
|
-
import type { Hashable } from '@finos/legend-shared';
|
18
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
20
19
|
import { PropertyHolderView } from './PropertyHolderView';
|
21
20
|
import type { Diagram } from './Diagram';
|
22
21
|
import type { ClassView } from './ClassView';
|
@@ -15,8 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { observable, action, computed, makeObservable } from 'mobx';
|
18
|
-
import { hashArray, changeEntry } from '@finos/legend-shared';
|
19
|
-
import type { Hashable } from '@finos/legend-shared';
|
18
|
+
import { hashArray, changeEntry, type Hashable } from '@finos/legend-shared';
|
20
19
|
import { RelationShipEdgeView as RelationshipEdgeView } from './RelationshipEdgeView';
|
21
20
|
import { Point } from './geometry/Point';
|
22
21
|
import type { ClassView } from './ClassView';
|
@@ -14,8 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { hashArray } from '@finos/legend-shared';
|
18
|
-
import type { Hashable } from '@finos/legend-shared';
|
17
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
19
18
|
import { DIAGRAM_HASH_STRUCTURE } from '../../../../../DSLDiagram_ModelUtils';
|
20
19
|
|
21
20
|
export class Point implements Hashable {
|
package/src/models/metamodels/pure/packageableElements/diagram/geometry/PositionedRectangle.ts
CHANGED
@@ -15,8 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import { observable, action, makeObservable } from 'mobx';
|
18
|
-
import { hashArray } from '@finos/legend-shared';
|
19
|
-
import type { Hashable } from '@finos/legend-shared';
|
18
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
20
19
|
import { Point } from './Point';
|
21
20
|
import { Rectangle } from './Rectangle';
|
22
21
|
import { DIAGRAM_HASH_STRUCTURE } from '../../../../../DSLDiagram_ModelUtils';
|
@@ -14,8 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { hashArray } from '@finos/legend-shared';
|
18
|
-
import type { Hashable } from '@finos/legend-shared';
|
17
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
19
18
|
import { DIAGRAM_HASH_STRUCTURE } from '../../../../../DSLDiagram_ModelUtils';
|
20
19
|
|
21
20
|
export class Rectangle implements Hashable {
|