@finos/legend-extension-dsl-diagram 8.1.195 → 8.1.197
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/lib/components/DiagramRenderer.d.ts +39 -2
- package/lib/components/DiagramRenderer.d.ts.map +1 -1
- package/lib/components/DiagramRenderer.js +83 -61
- package/lib/components/DiagramRenderer.js.map +1 -1
- package/lib/components/DiagramViewer.d.ts +39 -0
- package/lib/components/DiagramViewer.d.ts.map +1 -0
- package/lib/components/DiagramViewer.js +170 -0
- package/lib/components/DiagramViewer.js.map +1 -0
- package/lib/components/DiagramViewerState.d.ts +44 -0
- package/lib/components/DiagramViewerState.d.ts.map +1 -0
- package/lib/components/DiagramViewerState.js +136 -0
- package/lib/components/DiagramViewerState.js.map +1 -0
- package/lib/components/index.d.ts +4 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +4 -1
- package/lib/components/index.js.map +1 -1
- package/lib/graph-manager/index.d.ts +3 -0
- package/lib/graph-manager/index.d.ts.map +1 -1
- package/lib/graph-manager/index.js +3 -0
- package/lib/graph-manager/index.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +4 -5
- package/package.json +8 -9
- package/src/components/DiagramRenderer.ts +221 -103
- package/src/components/DiagramViewer.tsx +650 -0
- package/src/components/DiagramViewerState.ts +171 -0
- package/src/components/index.ts +4 -0
- package/src/graph-manager/index.ts +3 -0
- package/src/index.ts +0 -1
- package/tsconfig.json +2 -12
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.d.ts +0 -19
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.d.ts.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.js +0 -20
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.js.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.d.ts +0 -20
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.d.ts.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.js +0 -81
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.js.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioCommand.d.ts +0 -28
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioCommand.d.ts.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioCommand.js +0 -62
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioCommand.js.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.d.ts +0 -20
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.d.ts.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.js +0 -21
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.js.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioTesting.d.ts +0 -20
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioTesting.d.ts.map +0 -1
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioTesting.js +0 -21
- package/lib/__lib__/studio/DSL_Diagram_LegendStudioTesting.js.map +0 -1
- package/lib/components/studio/ClassDiagramPreview.d.ts +0 -22
- package/lib/components/studio/ClassDiagramPreview.d.ts.map +0 -1
- package/lib/components/studio/ClassDiagramPreview.js +0 -64
- package/lib/components/studio/ClassDiagramPreview.js.map +0 -1
- package/lib/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.d.ts +0 -42
- package/lib/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.d.ts.map +0 -1
- package/lib/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.js +0 -216
- package/lib/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.js.map +0 -1
- package/lib/components/studio/DiagramEditor.d.ts +0 -19
- package/lib/components/studio/DiagramEditor.d.ts.map +0 -1
- package/lib/components/studio/DiagramEditor.js +0 -436
- package/lib/components/studio/DiagramEditor.js.map +0 -1
- package/lib/components/studio/InheritanceDiagramRenderer.d.ts +0 -22
- package/lib/components/studio/InheritanceDiagramRenderer.d.ts.map +0 -1
- package/lib/components/studio/InheritanceDiagramRenderer.js +0 -34
- package/lib/components/studio/InheritanceDiagramRenderer.js.map +0 -1
- package/lib/components/studio/index.d.ts +0 -18
- package/lib/components/studio/index.d.ts.map +0 -1
- package/lib/components/studio/index.js +0 -18
- package/lib/components/studio/index.js.map +0 -1
- package/lib/stores/studio/DSL_Diagram_GraphModifierHelper.d.ts +0 -57
- package/lib/stores/studio/DSL_Diagram_GraphModifierHelper.d.ts.map +0 -1
- package/lib/stores/studio/DSL_Diagram_GraphModifierHelper.js +0 -94
- package/lib/stores/studio/DSL_Diagram_GraphModifierHelper.js.map +0 -1
- package/lib/stores/studio/DiagramEditorState.d.ts +0 -88
- package/lib/stores/studio/DiagramEditorState.d.ts.map +0 -1
- package/lib/stores/studio/DiagramEditorState.js +0 -341
- package/lib/stores/studio/DiagramEditorState.js.map +0 -1
- package/src/__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.ts +0 -19
- package/src/__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.ts +0 -88
- package/src/__lib__/studio/DSL_Diagram_LegendStudioCommand.ts +0 -64
- package/src/__lib__/studio/DSL_Diagram_LegendStudioDocumentation.ts +0 -20
- package/src/__lib__/studio/DSL_Diagram_LegendStudioTesting.ts +0 -20
- package/src/components/studio/ClassDiagramPreview.tsx +0 -83
- package/src/components/studio/DSL_Diagram_LegendStudioApplicationPlugin.tsx +0 -313
- package/src/components/studio/DiagramEditor.tsx +0 -1514
- package/src/components/studio/InheritanceDiagramRenderer.ts +0 -50
- package/src/components/studio/index.ts +0 -19
- package/src/stores/studio/DSL_Diagram_GraphModifierHelper.ts +0 -166
- package/src/stores/studio/DiagramEditorState.ts +0 -487
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DiagramEditorState.js","sourceRoot":"","sources":["../../../src/stores/studio/DiagramEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,MAAM,EACN,IAAI,GACL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAIL,4BAA4B,EAC5B,QAAQ,EACR,WAAW,EACX,yBAAyB,EACzB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,+EAA+E,CAAC;AAExG,OAAO,EAAE,qCAAqC,EAAE,MAAM,yDAAyD,CAAC;AAGhH,MAAM,OAAgB,2BAA2B;IACtC,IAAI,GAAG,IAAI,EAAE,CAAC;IACvB,WAAW,CAAc;IACzB,kBAAkB,CAAqB;IAEvC,YACE,WAAwB,EACxB,kBAAsC;QAEtC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,CAAN,IAAY,6BAGX;AAHD,WAAY,6BAA6B;IACvC,oDAAmB,CAAA;IACnB,8CAAa,CAAA;AACf,CAAC,EAHW,6BAA6B,KAA7B,6BAA6B,QAGxC;AAED,MAAM,OAAO,0CAA2C,SAAQ,2BAA2B;IACzF,g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C,CAAC,aAAa;YACnD,qCAAqC,CAAC,aAAa;YACnD,qCAAqC,CAAC,YAAY;YAClD,qCAAqC,CAAC,iBAAiB;YACvD,qCAAqC,CAAC,oBAAoB;YAC1D,qCAAqC,CAAC,SAAS;YAC/C,qCAAqC,CAAC,cAAc;SACrD,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CACvB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,cAAc,CAAC,iBAAiB,CAChE,UAAU,CACX,CACF,CAAC;IACJ,CAAC;IAED,SAAS,CACP,UAA8B,EAC9B,WAAwB;QAExB,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAC3E,OAAO,kBAAkB,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export enum DSL_DIAGRAM_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY {
|
|
18
|
-
DIAGRAM_EDITOR = 'dsl-diagram.studio.editor.diagram-editor',
|
|
19
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { uuid } from '@finos/legend-shared';
|
|
18
|
-
|
|
19
|
-
export const EMPTY_DIAGRAM_SNIPPET = `Diagram \${1:model::NewDiagram}
|
|
20
|
-
{
|
|
21
|
-
\${2:// diagram content: it is highly recommended to create diagrams using\n // diagram editor as it gives better visual guidance and less error-prone}
|
|
22
|
-
}`;
|
|
23
|
-
|
|
24
|
-
export const getDiagramSnippetWithOneClassView =
|
|
25
|
-
(): string => `Diagram \${1:model::NewDiagram}
|
|
26
|
-
{
|
|
27
|
-
classView ${uuid()}
|
|
28
|
-
{
|
|
29
|
-
class: \${2:model::SomeClass};
|
|
30
|
-
position: (0.0,0.0);
|
|
31
|
-
rectangle: (10.0, 10.0);
|
|
32
|
-
}
|
|
33
|
-
}`;
|
|
34
|
-
|
|
35
|
-
export const getDiagramSnippetWithPropertyView = (): string => {
|
|
36
|
-
const classId1 = uuid();
|
|
37
|
-
const classId2 = uuid();
|
|
38
|
-
|
|
39
|
-
return `Diagram \${1:model::NewDiagram}
|
|
40
|
-
{
|
|
41
|
-
classView ${classId1}
|
|
42
|
-
{
|
|
43
|
-
class: \${2:model::Class1};
|
|
44
|
-
position: (0.0,0.0);
|
|
45
|
-
rectangle: (10.0, 10.0);
|
|
46
|
-
}
|
|
47
|
-
classView ${classId2}
|
|
48
|
-
{
|
|
49
|
-
class: \${3:model::Class2};
|
|
50
|
-
position: (0.0,0.0);
|
|
51
|
-
rectangle: (10.0, 10.0);
|
|
52
|
-
}
|
|
53
|
-
propertyView
|
|
54
|
-
{
|
|
55
|
-
property: \${4:model::Class1.prop1};
|
|
56
|
-
source: ${classId1};
|
|
57
|
-
target: ${classId2};
|
|
58
|
-
points: [];
|
|
59
|
-
}
|
|
60
|
-
}`;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const getDiagramSnippetWithGeneralizationView = (): string => {
|
|
64
|
-
const classId1 = uuid();
|
|
65
|
-
const classId2 = uuid();
|
|
66
|
-
|
|
67
|
-
return `Diagram \${1:model::NewDiagram}
|
|
68
|
-
{
|
|
69
|
-
classView ${classId1}
|
|
70
|
-
{
|
|
71
|
-
class: \${2:model::Class1};
|
|
72
|
-
position: (0.0,0.0);
|
|
73
|
-
rectangle: (10.0, 10.0);
|
|
74
|
-
}
|
|
75
|
-
classView ${classId2}
|
|
76
|
-
{
|
|
77
|
-
class: \${3:model::Class2};
|
|
78
|
-
position: (0.0,0.0);
|
|
79
|
-
rectangle: (10.0, 10.0);
|
|
80
|
-
}
|
|
81
|
-
generalizationView
|
|
82
|
-
{
|
|
83
|
-
source: ${classId1};
|
|
84
|
-
target: ${classId2};
|
|
85
|
-
points: [];
|
|
86
|
-
}
|
|
87
|
-
}`;
|
|
88
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import type { CommandConfigData } from '@finos/legend-application';
|
|
18
|
-
|
|
19
|
-
export enum DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY {
|
|
20
|
-
RECENTER = 'dsl-diagram.diagram-editor.recenter',
|
|
21
|
-
USE_ZOOM_TOOL = 'dsl-diagram.diagram-editor.use-zoom-tool',
|
|
22
|
-
USE_VIEW_TOOL = 'dsl-diagram.diagram-editor.use-view-tool',
|
|
23
|
-
USE_PAN_TOOL = 'dsl-diagram.diagram-editor.use-pan-tool',
|
|
24
|
-
USE_PROPERTY_TOOL = 'dsl-diagram.diagram-editor.use-property-tool',
|
|
25
|
-
USE_INHERITANCE_TOOL = 'dsl-diagram.diagram-editor.use-inheritance-tool',
|
|
26
|
-
ADD_CLASS = 'dsl-diagram.diagram-editor.add-class',
|
|
27
|
-
EJECT_PROPERTY = 'dsl-diagram.diagram-editor.eject-property',
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_CONFIG: CommandConfigData = {
|
|
31
|
-
[DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.RECENTER]: {
|
|
32
|
-
title: 'Diagram Editor: Recenter',
|
|
33
|
-
defaultKeyboardShortcut: 'KeyR',
|
|
34
|
-
},
|
|
35
|
-
[DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_ZOOM_TOOL]: {
|
|
36
|
-
title: 'Diagram Editor: Use zoom tool',
|
|
37
|
-
defaultKeyboardShortcut: 'KeyZ',
|
|
38
|
-
},
|
|
39
|
-
[DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_VIEW_TOOL]: {
|
|
40
|
-
title: 'Diagram Editor: Use view tool',
|
|
41
|
-
defaultKeyboardShortcut: 'KeyV',
|
|
42
|
-
},
|
|
43
|
-
[DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_PAN_TOOL]: {
|
|
44
|
-
title: 'Diagram Editor: Use pan tool',
|
|
45
|
-
defaultKeyboardShortcut: 'KeyM',
|
|
46
|
-
},
|
|
47
|
-
[DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_PROPERTY_TOOL]: {
|
|
48
|
-
title: 'Diagram Editor: Use property tool',
|
|
49
|
-
defaultKeyboardShortcut: 'KeyP',
|
|
50
|
-
},
|
|
51
|
-
[DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_INHERITANCE_TOOL]: {
|
|
52
|
-
title: 'Diagram Editor: Use inheritance tool',
|
|
53
|
-
defaultKeyboardShortcut: 'KeyI',
|
|
54
|
-
},
|
|
55
|
-
[DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.ADD_CLASS]: {
|
|
56
|
-
title: 'Diagram Editor: Add class',
|
|
57
|
-
defaultKeyboardShortcut: 'KeyC',
|
|
58
|
-
},
|
|
59
|
-
[DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.EJECT_PROPERTY]: {
|
|
60
|
-
title: 'Diagram Editor: Eject Property',
|
|
61
|
-
defaultKeyboardShortcut: 'ArrowRight',
|
|
62
|
-
when: 'When hovering on a class property',
|
|
63
|
-
},
|
|
64
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export enum DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY {
|
|
18
|
-
GRAMMAR_PARSER = 'dsl-diagram.grammar.parser',
|
|
19
|
-
CONCEPT_ELEMENT_DIAGRAM = 'dsl-diagram.concept.element.diagram',
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export enum DSL_DIAGRAM_TEST_ID {
|
|
18
|
-
CLASS_DIAGRAM_PREVIEW = 'class-diagram-preview',
|
|
19
|
-
DIAGRAM_EDITOR = 'diagram-editor',
|
|
20
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
18
|
-
import { observer } from 'mobx-react-lite';
|
|
19
|
-
import { useApplicationStore } from '@finos/legend-application';
|
|
20
|
-
import { type Class, isElementReadOnly } from '@finos/legend-graph';
|
|
21
|
-
import { InheritanceDiagramRenderer } from './InheritanceDiagramRenderer.js';
|
|
22
|
-
import { DSL_DIAGRAM_TEST_ID } from '../../__lib__/studio/DSL_Diagram_LegendStudioTesting.js';
|
|
23
|
-
import { useResizeDetector } from '@finos/legend-art';
|
|
24
|
-
|
|
25
|
-
export const ClassDiagramPreview = observer((props: { _class: Class }) => {
|
|
26
|
-
const { _class } = props;
|
|
27
|
-
const applicationStore = useApplicationStore();
|
|
28
|
-
const classHash = isElementReadOnly(_class)
|
|
29
|
-
? undefined
|
|
30
|
-
: applicationStore.notificationService.notifyAndReturnAlternativeOnError(
|
|
31
|
-
() => _class.hashCode,
|
|
32
|
-
undefined,
|
|
33
|
-
); // attempting to read the hashCode of immutable element will throw an error
|
|
34
|
-
const [diagramRenderer, setDiagramRenderer] =
|
|
35
|
-
useState<InheritanceDiagramRenderer>();
|
|
36
|
-
const canvas = useRef<HTMLDivElement>(null);
|
|
37
|
-
const resizeDiagram = useCallback((): void => {
|
|
38
|
-
if (diagramRenderer) {
|
|
39
|
-
diagramRenderer.refresh();
|
|
40
|
-
diagramRenderer.autoRecenter();
|
|
41
|
-
}
|
|
42
|
-
}, [diagramRenderer]);
|
|
43
|
-
const { ref, height, width } = useResizeDetector<HTMLDivElement>({
|
|
44
|
-
refreshMode: 'debounce',
|
|
45
|
-
refreshRate: 50,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
resizeDiagram();
|
|
50
|
-
}, [resizeDiagram, height, width]);
|
|
51
|
-
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (canvas.current) {
|
|
54
|
-
let currentRenderer = diagramRenderer;
|
|
55
|
-
if (!currentRenderer) {
|
|
56
|
-
const newRender = new InheritanceDiagramRenderer(
|
|
57
|
-
canvas.current,
|
|
58
|
-
_class,
|
|
59
|
-
);
|
|
60
|
-
setDiagramRenderer(newRender);
|
|
61
|
-
currentRenderer = newRender;
|
|
62
|
-
}
|
|
63
|
-
currentRenderer.render({ initial: true });
|
|
64
|
-
}
|
|
65
|
-
}, [diagramRenderer, _class]);
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (diagramRenderer) {
|
|
69
|
-
diagramRenderer.loadClass(_class);
|
|
70
|
-
diagramRenderer.render({ initial: true });
|
|
71
|
-
}
|
|
72
|
-
}, [_class, classHash, diagramRenderer]);
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<div
|
|
76
|
-
ref={ref}
|
|
77
|
-
className="class-editor__diagram-preview"
|
|
78
|
-
data-testid={DSL_DIAGRAM_TEST_ID.CLASS_DIAGRAM_PREVIEW}
|
|
79
|
-
>
|
|
80
|
-
<div ref={canvas} className="diagram-canvas" tabIndex={0} />
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
});
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import packageJson from '../../../package.json' with { type: 'json' };
|
|
18
|
-
import {
|
|
19
|
-
LegendStudioApplicationPlugin,
|
|
20
|
-
type NewElementFromStateCreator,
|
|
21
|
-
type EditorStore,
|
|
22
|
-
type ElementEditorState,
|
|
23
|
-
type ElementEditorStateCreator,
|
|
24
|
-
type ElementClassifier,
|
|
25
|
-
type DragElementClassifier,
|
|
26
|
-
type ElementIconGetter,
|
|
27
|
-
type ElementEditorRenderer,
|
|
28
|
-
type DSL_LegendStudioApplicationPlugin_Extension,
|
|
29
|
-
type NewElementState,
|
|
30
|
-
type ElementEditorPostDeleteAction,
|
|
31
|
-
type ElementEditorPostRenameAction,
|
|
32
|
-
type ClassPreviewRenderer,
|
|
33
|
-
type PureGrammarParserDocumentationGetter,
|
|
34
|
-
type PureGrammarParserElementDocumentationGetter,
|
|
35
|
-
type PureGrammarParserKeywordSuggestionGetter,
|
|
36
|
-
type PureGrammarParserElementSnippetSuggestionsGetter,
|
|
37
|
-
PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY,
|
|
38
|
-
} from '@finos/legend-application-studio';
|
|
39
|
-
import { ShapesIcon } from '@finos/legend-art';
|
|
40
|
-
import type { Class, PackageableElement } from '@finos/legend-graph';
|
|
41
|
-
import { Diagram } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_Diagram.js';
|
|
42
|
-
import { DiagramEditorState } from '../../stores/studio/DiagramEditorState.js';
|
|
43
|
-
import { DiagramEditor } from './DiagramEditor.js';
|
|
44
|
-
import { ClassDiagramPreview } from './ClassDiagramPreview.js';
|
|
45
|
-
import { DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY } from '../../__lib__/studio/DSL_Diagram_LegendStudioDocumentation.js';
|
|
46
|
-
import {
|
|
47
|
-
EMPTY_DIAGRAM_SNIPPET,
|
|
48
|
-
getDiagramSnippetWithGeneralizationView,
|
|
49
|
-
getDiagramSnippetWithOneClassView,
|
|
50
|
-
getDiagramSnippetWithPropertyView,
|
|
51
|
-
} from '../../__lib__/studio/DSL_Diagram_LegendStudioCodeSnippet.js';
|
|
52
|
-
import {
|
|
53
|
-
collectKeyedCommandConfigEntriesFromConfig,
|
|
54
|
-
type KeyedCommandConfigEntry,
|
|
55
|
-
} from '@finos/legend-application';
|
|
56
|
-
import { DSL_DIAGRAM_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../__lib__/studio/DSL_Diagram_LegendStudioApplicationNavigationContext.js';
|
|
57
|
-
import { DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_CONFIG } from '../../__lib__/studio/DSL_Diagram_LegendStudioCommand.js';
|
|
58
|
-
import type { PureGrammarTextSuggestion } from '@finos/legend-code-editor';
|
|
59
|
-
import type { DocumentationEntry } from '@finos/legend-shared';
|
|
60
|
-
|
|
61
|
-
const DIAGRAM_ELEMENT_TYPE = 'DIAGRAM';
|
|
62
|
-
const DIAGRAM_ELEMENT_PROJECT_EXPLORER_DND_TYPE = 'PROJECT_EXPLORER_DIAGRAM';
|
|
63
|
-
|
|
64
|
-
const PURE_GRAMMAR_DIAGRAM_PARSER_NAME = 'Diagram';
|
|
65
|
-
const PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL = 'Diagram';
|
|
66
|
-
|
|
67
|
-
export class DSL_Diagram_LegendStudioApplicationPlugin
|
|
68
|
-
extends LegendStudioApplicationPlugin
|
|
69
|
-
implements DSL_LegendStudioApplicationPlugin_Extension
|
|
70
|
-
{
|
|
71
|
-
constructor() {
|
|
72
|
-
super(packageJson.extensions.applicationStudioPlugin, packageJson.version);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
override getExtraKeyedCommandConfigEntries(): KeyedCommandConfigEntry[] {
|
|
76
|
-
return collectKeyedCommandConfigEntriesFromConfig(
|
|
77
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_CONFIG,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
override getExtraRequiredDocumentationKeys(): string[] {
|
|
82
|
-
return [
|
|
83
|
-
DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.CONCEPT_ELEMENT_DIAGRAM,
|
|
84
|
-
DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER,
|
|
85
|
-
];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
override getExtraClassPreviewRenderers(): ClassPreviewRenderer[] {
|
|
89
|
-
return [
|
|
90
|
-
(_class: Class): React.ReactNode => (
|
|
91
|
-
<ClassDiagramPreview _class={_class} />
|
|
92
|
-
),
|
|
93
|
-
];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
override getExtraAccessEventLoggingApplicationContextKeys(): string[] {
|
|
97
|
-
return [
|
|
98
|
-
DSL_DIAGRAM_LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.DIAGRAM_EDITOR,
|
|
99
|
-
];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
getExtraPureGrammarKeywords(): string[] {
|
|
103
|
-
return [PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
getExtraSupportedElementTypes(): string[] {
|
|
107
|
-
return [DIAGRAM_ELEMENT_TYPE];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
getExtraSupportedElementTypesWithCategory?(): Map<string, string[]> {
|
|
111
|
-
const elementTypesWithCategoryMap = new Map<string, string[]>();
|
|
112
|
-
elementTypesWithCategoryMap.set(
|
|
113
|
-
PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.MODEL,
|
|
114
|
-
[DIAGRAM_ELEMENT_TYPE],
|
|
115
|
-
);
|
|
116
|
-
return elementTypesWithCategoryMap;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
getExtraElementClassifiers(): ElementClassifier[] {
|
|
120
|
-
return [
|
|
121
|
-
(element: PackageableElement): string | undefined => {
|
|
122
|
-
if (element instanceof Diagram) {
|
|
123
|
-
return DIAGRAM_ELEMENT_TYPE;
|
|
124
|
-
}
|
|
125
|
-
return undefined;
|
|
126
|
-
},
|
|
127
|
-
];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
getExtraElementIconGetters(): ElementIconGetter[] {
|
|
131
|
-
return [
|
|
132
|
-
(type: string): React.ReactNode | undefined => {
|
|
133
|
-
if (type === DIAGRAM_ELEMENT_TYPE) {
|
|
134
|
-
return (
|
|
135
|
-
<div className="icon color--diagram">
|
|
136
|
-
<ShapesIcon />
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
return undefined;
|
|
141
|
-
},
|
|
142
|
-
];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
getExtraElementEditorRenderers(): ElementEditorRenderer[] {
|
|
146
|
-
return [
|
|
147
|
-
(elementEditorState: ElementEditorState): React.ReactNode | undefined => {
|
|
148
|
-
if (elementEditorState instanceof DiagramEditorState) {
|
|
149
|
-
return <DiagramEditor key={elementEditorState.uuid} />;
|
|
150
|
-
}
|
|
151
|
-
return undefined;
|
|
152
|
-
},
|
|
153
|
-
];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
getExtraNewElementFromStateCreators(): NewElementFromStateCreator[] {
|
|
157
|
-
return [
|
|
158
|
-
(
|
|
159
|
-
type: string,
|
|
160
|
-
name: string,
|
|
161
|
-
state: NewElementState,
|
|
162
|
-
): PackageableElement | undefined => {
|
|
163
|
-
if (type === DIAGRAM_ELEMENT_TYPE) {
|
|
164
|
-
return new Diagram(name);
|
|
165
|
-
}
|
|
166
|
-
return undefined;
|
|
167
|
-
},
|
|
168
|
-
];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
getExtraElementEditorStateCreators(): ElementEditorStateCreator[] {
|
|
172
|
-
return [
|
|
173
|
-
(
|
|
174
|
-
editorStore: EditorStore,
|
|
175
|
-
element: PackageableElement,
|
|
176
|
-
): ElementEditorState | undefined => {
|
|
177
|
-
if (element instanceof Diagram) {
|
|
178
|
-
return new DiagramEditorState(editorStore, element);
|
|
179
|
-
}
|
|
180
|
-
return undefined;
|
|
181
|
-
},
|
|
182
|
-
];
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
getExtraDragElementClassifiers(): DragElementClassifier[] {
|
|
186
|
-
return [
|
|
187
|
-
(element: PackageableElement): string | undefined => {
|
|
188
|
-
if (element instanceof Diagram) {
|
|
189
|
-
return DIAGRAM_ELEMENT_PROJECT_EXPLORER_DND_TYPE;
|
|
190
|
-
}
|
|
191
|
-
return undefined;
|
|
192
|
-
},
|
|
193
|
-
];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
getExtraPureGrammarTextEditorDragElementTypes(): string[] {
|
|
197
|
-
return [DIAGRAM_ELEMENT_PROJECT_EXPLORER_DND_TYPE];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
getExtraElementEditorPostRenameActions(): ElementEditorPostRenameAction[] {
|
|
201
|
-
return [
|
|
202
|
-
(editorStore: EditorStore, element: PackageableElement): void => {
|
|
203
|
-
// rerender currently opened diagram
|
|
204
|
-
if (
|
|
205
|
-
editorStore.tabManagerState.currentTab instanceof DiagramEditorState
|
|
206
|
-
) {
|
|
207
|
-
editorStore.tabManagerState.currentTab.renderer.render();
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
getExtraElementEditorPostDeleteActions(): ElementEditorPostDeleteAction[] {
|
|
214
|
-
return [
|
|
215
|
-
(editorStore: EditorStore, element: PackageableElement): void => {
|
|
216
|
-
// rerender currently opened diagram
|
|
217
|
-
if (
|
|
218
|
-
editorStore.tabManagerState.currentTab instanceof DiagramEditorState
|
|
219
|
-
) {
|
|
220
|
-
editorStore.tabManagerState.currentTab.renderer.render();
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
];
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
getExtraPureGrammarParserElementDocumentationGetters(): PureGrammarParserElementDocumentationGetter[] {
|
|
227
|
-
return [
|
|
228
|
-
(
|
|
229
|
-
editorStore: EditorStore,
|
|
230
|
-
parserKeyword: string,
|
|
231
|
-
elementKeyword: string,
|
|
232
|
-
): DocumentationEntry | undefined => {
|
|
233
|
-
if (parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME) {
|
|
234
|
-
if (elementKeyword === PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL) {
|
|
235
|
-
return editorStore.applicationStore.documentationService.getDocEntry(
|
|
236
|
-
DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.CONCEPT_ELEMENT_DIAGRAM,
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return undefined;
|
|
241
|
-
},
|
|
242
|
-
];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
getExtraPureGrammarParserDocumentationGetters(): PureGrammarParserDocumentationGetter[] {
|
|
246
|
-
return [
|
|
247
|
-
(
|
|
248
|
-
editorStore: EditorStore,
|
|
249
|
-
parserKeyword: string,
|
|
250
|
-
): DocumentationEntry | undefined => {
|
|
251
|
-
if (parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME) {
|
|
252
|
-
return editorStore.applicationStore.documentationService.getDocEntry(
|
|
253
|
-
DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER,
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
return undefined;
|
|
257
|
-
},
|
|
258
|
-
];
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
getExtraPureGrammarParserKeywordSuggestionGetters(): PureGrammarParserKeywordSuggestionGetter[] {
|
|
262
|
-
return [
|
|
263
|
-
(editorStore: EditorStore): PureGrammarTextSuggestion[] => [
|
|
264
|
-
{
|
|
265
|
-
text: PURE_GRAMMAR_DIAGRAM_PARSER_NAME,
|
|
266
|
-
description: `(dsl)`,
|
|
267
|
-
documentation:
|
|
268
|
-
editorStore.applicationStore.documentationService.getDocEntry(
|
|
269
|
-
DSL_DIAGRAM_LEGEND_STUDIO_DOCUMENTATION_KEY.GRAMMAR_PARSER,
|
|
270
|
-
),
|
|
271
|
-
insertText: PURE_GRAMMAR_DIAGRAM_PARSER_NAME,
|
|
272
|
-
},
|
|
273
|
-
],
|
|
274
|
-
];
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
getExtraPureGrammarParserElementSnippetSuggestionsGetters(): PureGrammarParserElementSnippetSuggestionsGetter[] {
|
|
278
|
-
return [
|
|
279
|
-
(
|
|
280
|
-
editorStore: EditorStore,
|
|
281
|
-
parserKeyword: string,
|
|
282
|
-
): PureGrammarTextSuggestion[] | undefined =>
|
|
283
|
-
parserKeyword === PURE_GRAMMAR_DIAGRAM_PARSER_NAME
|
|
284
|
-
? [
|
|
285
|
-
{
|
|
286
|
-
text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
|
|
287
|
-
description: '(blank)',
|
|
288
|
-
insertText: EMPTY_DIAGRAM_SNIPPET,
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
|
|
292
|
-
description: 'with class',
|
|
293
|
-
insertText: getDiagramSnippetWithOneClassView(),
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
|
|
297
|
-
description: 'with inheritance',
|
|
298
|
-
insertText: getDiagramSnippetWithGeneralizationView(),
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
text: PURE_GRAMMAR_DIAGRAM_ELEMENT_TYPE_LABEL,
|
|
302
|
-
description: 'with composition',
|
|
303
|
-
insertText: getDiagramSnippetWithPropertyView(),
|
|
304
|
-
},
|
|
305
|
-
]
|
|
306
|
-
: undefined,
|
|
307
|
-
];
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
getExtraGrammarTextEditorAutoFoldingElementCreatorKeywords(): string[] {
|
|
311
|
-
return [PURE_GRAMMAR_DIAGRAM_PARSER_NAME];
|
|
312
|
-
}
|
|
313
|
-
}
|