@finos/legend-extension-dsl-diagram 8.1.195 → 8.1.196
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 +1 -2
- package/package.json +3 -4
- 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":"index.d.ts","sourceRoot":"","sources":["../../../src/components/studio/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAE3G,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -1,18 +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
|
-
export { DSL_Diagram_LegendStudioApplicationPlugin } from './DSL_Diagram_LegendStudioApplicationPlugin.js';
|
|
17
|
-
export { DiagramEditorState } from '../../stores/studio/DiagramEditorState.js';
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/studio/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAE3G,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -1,57 +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
|
-
import type { AssociationView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_AssociationView.js';
|
|
17
|
-
import type { ClassView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_ClassView.js';
|
|
18
|
-
import type { Diagram } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_Diagram.js';
|
|
19
|
-
import type { GeneralizationView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_GeneralizationView.js';
|
|
20
|
-
import type { PropertyView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_PropertyView.js';
|
|
21
|
-
import type { RelationshipViewEnd } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipViewEnd.js';
|
|
22
|
-
import type { RelationshipView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipView.js';
|
|
23
|
-
import type { Point } from '../../graph/metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_Point.js';
|
|
24
|
-
import type { PositionedRectangle } from '../../graph/metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_PositionedRectangle.js';
|
|
25
|
-
import type { Rectangle } from '../../graph/metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_Rectangle.js';
|
|
26
|
-
export declare const diagram_setClassViews: (diagram: Diagram, val: ClassView[]) => void;
|
|
27
|
-
export declare const diagram_addClassView: (diagram: Diagram, val: ClassView) => void;
|
|
28
|
-
export declare const diagram_deleteClassView: (diagram: Diagram, val: ClassView) => void;
|
|
29
|
-
export declare const diagram_setAssociationViews: (diagram: Diagram, val: AssociationView[]) => void;
|
|
30
|
-
export declare const diagram_deleteAssociationView: (diagram: Diagram, val: AssociationView) => void;
|
|
31
|
-
export declare const diagram_setGeneralizationViews: (diagram: Diagram, val: GeneralizationView[]) => void;
|
|
32
|
-
export declare const diagram_addGeneralizationView: (diagram: Diagram, val: GeneralizationView) => void;
|
|
33
|
-
export declare const diagram_deleteGeneralizationView: (diagram: Diagram, val: GeneralizationView) => void;
|
|
34
|
-
export declare const diagram_setPropertyViews: (diagram: Diagram, val: PropertyView[]) => void;
|
|
35
|
-
export declare const diagram_addPropertyView: (diagram: Diagram, val: PropertyView) => void;
|
|
36
|
-
export declare const diagram_deletePropertyView: (diagram: Diagram, val: PropertyView) => void;
|
|
37
|
-
export declare const classView_setHideProperties: (cv: ClassView, val: boolean) => void;
|
|
38
|
-
export declare const classView_setHideStereotypes: (cv: ClassView, val: boolean) => void;
|
|
39
|
-
export declare const classView_setHideTaggedValues: (cv: ClassView, val: boolean) => void;
|
|
40
|
-
export declare const relationshipEdgeView_setOffsetX: (r: RelationshipViewEnd, val: number) => void;
|
|
41
|
-
export declare const relationshipEdgeView_setOffsetY: (r: RelationshipViewEnd, val: number) => void;
|
|
42
|
-
export declare const relationshipView_changePoint: (v: RelationshipView, val: Point, newVal: Point) => void;
|
|
43
|
-
export declare const relationshipView_simplifyPath: (relationshipView: RelationshipView) => void;
|
|
44
|
-
export declare const findOrBuildPoint: (relationshipView: RelationshipView, x: number, y: number, zoom: number, allowChange: boolean) => Point | undefined;
|
|
45
|
-
export declare const relationshipView_setPath: (relationshipView: RelationshipView, val: Point[]) => void;
|
|
46
|
-
export declare const positionedRectangle_setRectangle: (pR: PositionedRectangle, value: Rectangle) => void;
|
|
47
|
-
export declare const positionedRectangle_setPosition: (pR: PositionedRectangle, value: Point) => void;
|
|
48
|
-
/**
|
|
49
|
-
* NOTE: Having `position` and `rectangle` as observables compromises the performance of diagram
|
|
50
|
-
* so we want to have a way to refresh the hash for change detection to pick up new hash when we resize
|
|
51
|
-
* the class view box or move it.
|
|
52
|
-
*
|
|
53
|
-
* We should re-consider the usefulness of this method, maybe it's more worthwhile to recompute hash
|
|
54
|
-
* for the whole diagram instead?
|
|
55
|
-
*/
|
|
56
|
-
export declare const positionedRectangle_forceRefreshHash: (pR: PositionedRectangle) => void;
|
|
57
|
-
//# sourceMappingURL=DSL_Diagram_GraphModifierHelper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSL_Diagram_GraphModifierHelper.d.ts","sourceRoot":"","sources":["../../../src/stores/studio/DSL_Diagram_GraphModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uFAAuF,CAAC;AAC7H,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iFAAiF,CAAC;AACjH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+EAA+E,CAAC;AAC7G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0FAA0F,CAAC;AAMnI,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oFAAoF,CAAC;AACvH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2FAA2F,CAAC;AACrI,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wFAAwF,CAAC;AAC/H,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sFAAsF,CAAC;AAClH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oGAAoG,CAAC;AAC9I,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0FAA0F,CAAC;AAQ1H,eAAO,MAAM,qBAAqB,YACtB,OAAO,OAAO,SAAS,EAAE,KA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B,qHAA4B,CAAC;AAC1D,eAAO,MAAM,wBAAwB,4DAAoC,CAAC;AAG1E,eAAO,MAAM,gCAAgC,OACtC,mBAAmB,SAAS,SAAS,KAAG,IAG9C,CAAC;AAGF,eAAO,MAAM,+BAA+B,OACrC,mBAAmB,SAAS,KAAK,KAAG,IAG1C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC,OAC1C,mBAAmB,KAAG,IAG5B,CAAC"}
|
|
@@ -1,94 +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
|
-
import { addUniqueEntry, changeEntry, deleteEntry } from '@finos/legend-shared';
|
|
17
|
-
import { action } from 'mobx';
|
|
18
|
-
import { _findOrBuildPoint, _relationshipView_simplifyPath, _relationshipView_setPath, } from '../../graph/helpers/DSL_Diagram_Helper.js';
|
|
19
|
-
import { observe_AssociationView, observe_ClassView, observe_GeneralizationView, observe_PropertyView, } from '../../graph-manager/action/changeDetection/DSL_Diagram_ObserverHelper.js';
|
|
20
|
-
export const diagram_setClassViews = action((diagram, val) => {
|
|
21
|
-
diagram.classViews = val.map(observe_ClassView);
|
|
22
|
-
});
|
|
23
|
-
export const diagram_addClassView = action((diagram, val) => {
|
|
24
|
-
addUniqueEntry(diagram.classViews, observe_ClassView(val));
|
|
25
|
-
});
|
|
26
|
-
export const diagram_deleteClassView = action((diagram, val) => {
|
|
27
|
-
deleteEntry(diagram.classViews, val);
|
|
28
|
-
});
|
|
29
|
-
export const diagram_setAssociationViews = action((diagram, val) => {
|
|
30
|
-
diagram.associationViews = val.map(observe_AssociationView);
|
|
31
|
-
});
|
|
32
|
-
export const diagram_deleteAssociationView = action((diagram, val) => {
|
|
33
|
-
deleteEntry(diagram.associationViews, val);
|
|
34
|
-
});
|
|
35
|
-
export const diagram_setGeneralizationViews = action((diagram, val) => {
|
|
36
|
-
diagram.generalizationViews = val.map(observe_GeneralizationView);
|
|
37
|
-
});
|
|
38
|
-
export const diagram_addGeneralizationView = action((diagram, val) => {
|
|
39
|
-
addUniqueEntry(diagram.generalizationViews, observe_GeneralizationView(val));
|
|
40
|
-
});
|
|
41
|
-
export const diagram_deleteGeneralizationView = action((diagram, val) => {
|
|
42
|
-
deleteEntry(diagram.generalizationViews, val);
|
|
43
|
-
});
|
|
44
|
-
export const diagram_setPropertyViews = action((diagram, val) => {
|
|
45
|
-
diagram.propertyViews = val.map(observe_PropertyView);
|
|
46
|
-
});
|
|
47
|
-
export const diagram_addPropertyView = action((diagram, val) => {
|
|
48
|
-
addUniqueEntry(diagram.propertyViews, observe_PropertyView(val));
|
|
49
|
-
});
|
|
50
|
-
export const diagram_deletePropertyView = action((diagram, val) => {
|
|
51
|
-
deleteEntry(diagram.propertyViews, val);
|
|
52
|
-
});
|
|
53
|
-
export const classView_setHideProperties = action((cv, val) => {
|
|
54
|
-
cv.hideProperties = val;
|
|
55
|
-
});
|
|
56
|
-
export const classView_setHideStereotypes = action((cv, val) => {
|
|
57
|
-
cv.hideStereotypes = val;
|
|
58
|
-
});
|
|
59
|
-
export const classView_setHideTaggedValues = action((cv, val) => {
|
|
60
|
-
cv.hideTaggedValues = val;
|
|
61
|
-
});
|
|
62
|
-
export const relationshipEdgeView_setOffsetX = action((r, val) => {
|
|
63
|
-
r._offsetX = val;
|
|
64
|
-
});
|
|
65
|
-
export const relationshipEdgeView_setOffsetY = action((r, val) => {
|
|
66
|
-
r._offsetY = val;
|
|
67
|
-
});
|
|
68
|
-
// NOTE: To optimize performance, for now, we will not observe point (path)
|
|
69
|
-
export const relationshipView_changePoint = action((v, val, newVal) => {
|
|
70
|
-
changeEntry(v.path, val, newVal);
|
|
71
|
-
});
|
|
72
|
-
export const relationshipView_simplifyPath = action(_relationshipView_simplifyPath);
|
|
73
|
-
export const findOrBuildPoint = action(_findOrBuildPoint);
|
|
74
|
-
export const relationshipView_setPath = action(_relationshipView_setPath);
|
|
75
|
-
// NOTE: To optimize performance, for now, we will not observe rectangle
|
|
76
|
-
export const positionedRectangle_setRectangle = action((pR, value) => {
|
|
77
|
-
pR.rectangle = value;
|
|
78
|
-
});
|
|
79
|
-
// NOTE: To optimize performance, for now, we will not observe point (path)
|
|
80
|
-
export const positionedRectangle_setPosition = action((pR, value) => {
|
|
81
|
-
pR.position = value;
|
|
82
|
-
});
|
|
83
|
-
/**
|
|
84
|
-
* NOTE: Having `position` and `rectangle` as observables compromises the performance of diagram
|
|
85
|
-
* so we want to have a way to refresh the hash for change detection to pick up new hash when we resize
|
|
86
|
-
* the class view box or move it.
|
|
87
|
-
*
|
|
88
|
-
* We should re-consider the usefulness of this method, maybe it's more worthwhile to recompute hash
|
|
89
|
-
* for the whole diagram instead?
|
|
90
|
-
*/
|
|
91
|
-
export const positionedRectangle_forceRefreshHash = action((pR) => {
|
|
92
|
-
pR._dummyObservable = {};
|
|
93
|
-
});
|
|
94
|
-
//# sourceMappingURL=DSL_Diagram_GraphModifierHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSL_Diagram_GraphModifierHelper.js","sourceRoot":"","sources":["../../../src/stores/studio/DSL_Diagram_GraphModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChF,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CACnD,CAAC,EAAuB,EAAE,KAAY,EAAQ,EAAE;IAC9C,EAAE,CAAC,QAAQ,GAAG,KAAK,CAAC;AACtB,CAAC,CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CACxD,CAAC,EAAuB,EAAQ,EAAE;IAChC,EAAE,CAAC,gBAAgB,GAAG,EAAE,CAAC;AAC3B,CAAC,CACF,CAAC"}
|
|
@@ -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
|
-
import { type DiagramRenderer } from '../../components/DiagramRenderer.js';
|
|
17
|
-
import { PanelDisplayState } from '@finos/legend-art';
|
|
18
|
-
import { type PackageableElement, type AbstractProperty, type PropertyReference } from '@finos/legend-graph';
|
|
19
|
-
import { type EditorStore, ClassEditorState, ElementEditorState } from '@finos/legend-application-studio';
|
|
20
|
-
import type { ClassView } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_ClassView.js';
|
|
21
|
-
import type { Point } from '../../graph/metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_Point.js';
|
|
22
|
-
import { Diagram } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_Diagram.js';
|
|
23
|
-
import type { CommandRegistrar } from '@finos/legend-application';
|
|
24
|
-
export declare abstract class DiagramEditorSidePanelState {
|
|
25
|
-
readonly uuid: string;
|
|
26
|
-
editorStore: EditorStore;
|
|
27
|
-
diagramEditorState: DiagramEditorState;
|
|
28
|
-
constructor(editorStore: EditorStore, diagramEditorState: DiagramEditorState);
|
|
29
|
-
}
|
|
30
|
-
export declare enum DIAGRAM_EDITOR_SIDE_PANEL_TAB {
|
|
31
|
-
ELEMENT = "ELEMENT",
|
|
32
|
-
VIEW = "VIEW"
|
|
33
|
-
}
|
|
34
|
-
export declare class DiagramEditorClassViewEditorSidePanelState extends DiagramEditorSidePanelState {
|
|
35
|
-
classEditorState: ClassEditorState;
|
|
36
|
-
classView: ClassView;
|
|
37
|
-
selectedTab: DIAGRAM_EDITOR_SIDE_PANEL_TAB;
|
|
38
|
-
constructor(editorStore: EditorStore, diagramEditorState: DiagramEditorState, classView: ClassView);
|
|
39
|
-
setSelectedTab(val: DIAGRAM_EDITOR_SIDE_PANEL_TAB): void;
|
|
40
|
-
}
|
|
41
|
-
export declare class DiagramEditorInlineClassCreatorState {
|
|
42
|
-
diagramEditorState: DiagramEditorState;
|
|
43
|
-
point: Point;
|
|
44
|
-
constructor(diagramEditorState: DiagramEditorState, point: Point);
|
|
45
|
-
}
|
|
46
|
-
export declare class DiagramEditorInlineClassRenamerState {
|
|
47
|
-
diagramEditorState: DiagramEditorState;
|
|
48
|
-
classView: ClassView;
|
|
49
|
-
point: Point;
|
|
50
|
-
constructor(diagramEditorState: DiagramEditorState, classView: ClassView, point: Point);
|
|
51
|
-
}
|
|
52
|
-
export declare class DiagramEditorInlinePropertyEditorState {
|
|
53
|
-
diagramEditorState: DiagramEditorState;
|
|
54
|
-
property: PropertyReference;
|
|
55
|
-
point: Point;
|
|
56
|
-
isEditingPropertyView: boolean;
|
|
57
|
-
constructor(diagramEditorState: DiagramEditorState, property: AbstractProperty, point: Point, isEditingPropertyView: boolean);
|
|
58
|
-
}
|
|
59
|
-
export declare class DiagramEditorState extends ElementEditorState implements CommandRegistrar {
|
|
60
|
-
_renderer?: DiagramRenderer | undefined;
|
|
61
|
-
showHotkeyInfosModal: boolean;
|
|
62
|
-
sidePanelDisplayState: PanelDisplayState;
|
|
63
|
-
sidePanelState?: DiagramEditorSidePanelState | undefined;
|
|
64
|
-
inlinePropertyEditorState?: DiagramEditorInlinePropertyEditorState | undefined;
|
|
65
|
-
inlineClassCreatorState?: DiagramEditorInlineClassCreatorState | undefined;
|
|
66
|
-
inlineClassRenamerState?: DiagramEditorInlineClassRenamerState | undefined;
|
|
67
|
-
showContextMenu: boolean;
|
|
68
|
-
contextMenuClassView?: ClassView | undefined;
|
|
69
|
-
constructor(editorStore: EditorStore, element: PackageableElement);
|
|
70
|
-
get diagram(): Diagram;
|
|
71
|
-
get renderer(): DiagramRenderer;
|
|
72
|
-
get isDiagramRendererInitialized(): boolean;
|
|
73
|
-
get diagramCursorClass(): string;
|
|
74
|
-
setRenderer(val: DiagramRenderer): void;
|
|
75
|
-
setShowHotkeyInfosModal(val: boolean): void;
|
|
76
|
-
setSidePanelState(val: DiagramEditorSidePanelState | undefined): void;
|
|
77
|
-
setInlinePropertyEditorState(val: DiagramEditorInlinePropertyEditorState | undefined): void;
|
|
78
|
-
setInlineClassRenamerState(val: DiagramEditorInlineClassRenamerState | undefined): void;
|
|
79
|
-
setInlineClassCreatorState(val: DiagramEditorInlineClassCreatorState | undefined): void;
|
|
80
|
-
setShowContextMenu(val: boolean): void;
|
|
81
|
-
setContextMenuClassView(val: ClassView | undefined): void;
|
|
82
|
-
closeContextMenu(): void;
|
|
83
|
-
setupRenderer(): void;
|
|
84
|
-
registerCommands(): void;
|
|
85
|
-
deregisterCommands(): void;
|
|
86
|
-
reprocess(newElement: PackageableElement, editorStore: EditorStore): ElementEditorState;
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=DiagramEditorState.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DiagramEditorState.d.ts","sourceRoot":"","sources":["../../../src/stores/studio/D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,GAAG,SAAS,GAAG,IAAI;IAIrE,4BAA4B,CAC1B,GAAG,EAAE,sCAAsC,GAAG,SAAS,GACtD,IAAI;IAIP,0BAA0B,CACxB,GAAG,EAAE,oCAAoC,GAAG,SAAS,GACpD,IAAI;IAIP,0BAA0B,CACxB,GAAG,EAAE,oCAAoC,GAAG,SAAS,GACpD,IAAI;IAIP,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAItC,uBAAuB,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI;IAIzD,gBAAgB,IAAI,IAAI;IAIxB,aAAa,IAAI,IAAI;IA6ErB,gBAAgB,IAAI,IAAI;IAuDxB,kBAAkB,IAAI,IAAI;IAiB1B,SAAS,CACP,UAAU,EAAE,kBAAkB,EAC9B,WAAW,EAAE,WAAW,GACvB,kBAAkB;CAItB"}
|
|
@@ -1,341 +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
|
-
import { computed, action, makeObservable, observable } from 'mobx';
|
|
17
|
-
import { guaranteeNonNullable, guaranteeType, isType, uuid, } from '@finos/legend-shared';
|
|
18
|
-
import { DIAGRAM_INTERACTION_MODE, } from '../../components/DiagramRenderer.js';
|
|
19
|
-
import { PanelDisplayState } from '@finos/legend-art';
|
|
20
|
-
import { GenericTypeExplicitReference, Property, GenericType, PropertyExplicitReference, isElementReadOnly, Multiplicity, PrimitiveType, } from '@finos/legend-graph';
|
|
21
|
-
import { ClassEditorState, ElementEditorState, class_addProperty, } from '@finos/legend-application-studio';
|
|
22
|
-
import { Diagram } from '../../graph/metamodel/pure/packageableElements/diagram/DSL_Diagram_Diagram.js';
|
|
23
|
-
import { DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY } from '../../__lib__/studio/DSL_Diagram_LegendStudioCommand.js';
|
|
24
|
-
export class DiagramEditorSidePanelState {
|
|
25
|
-
uuid = uuid();
|
|
26
|
-
editorStore;
|
|
27
|
-
diagramEditorState;
|
|
28
|
-
constructor(editorStore, diagramEditorState) {
|
|
29
|
-
this.editorStore = editorStore;
|
|
30
|
-
this.diagramEditorState = diagramEditorState;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export var DIAGRAM_EDITOR_SIDE_PANEL_TAB;
|
|
34
|
-
(function (DIAGRAM_EDITOR_SIDE_PANEL_TAB) {
|
|
35
|
-
DIAGRAM_EDITOR_SIDE_PANEL_TAB["ELEMENT"] = "ELEMENT";
|
|
36
|
-
DIAGRAM_EDITOR_SIDE_PANEL_TAB["VIEW"] = "VIEW";
|
|
37
|
-
})(DIAGRAM_EDITOR_SIDE_PANEL_TAB || (DIAGRAM_EDITOR_SIDE_PANEL_TAB = {}));
|
|
38
|
-
export class DiagramEditorClassViewEditorSidePanelState extends DiagramEditorSidePanelState {
|
|
39
|
-
classEditorState;
|
|
40
|
-
classView;
|
|
41
|
-
selectedTab = DIAGRAM_EDITOR_SIDE_PANEL_TAB.ELEMENT;
|
|
42
|
-
constructor(editorStore, diagramEditorState, classView) {
|
|
43
|
-
super(editorStore, diagramEditorState);
|
|
44
|
-
makeObservable(this, {
|
|
45
|
-
selectedTab: observable,
|
|
46
|
-
setSelectedTab: action,
|
|
47
|
-
});
|
|
48
|
-
this.classView = classView;
|
|
49
|
-
this.classEditorState = guaranteeType(this.editorStore.tabManagerState.tabs.find((elementState) => isType(elementState, ClassEditorState) &&
|
|
50
|
-
elementState.element === classView.class.value) ?? new ClassEditorState(this.editorStore, classView.class.value), ClassEditorState);
|
|
51
|
-
}
|
|
52
|
-
setSelectedTab(val) {
|
|
53
|
-
this.selectedTab = val;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export class DiagramEditorInlineClassCreatorState {
|
|
57
|
-
diagramEditorState;
|
|
58
|
-
point;
|
|
59
|
-
constructor(diagramEditorState, point) {
|
|
60
|
-
this.diagramEditorState = diagramEditorState;
|
|
61
|
-
this.point = point;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export class DiagramEditorInlineClassRenamerState {
|
|
65
|
-
diagramEditorState;
|
|
66
|
-
classView;
|
|
67
|
-
point;
|
|
68
|
-
constructor(diagramEditorState, classView, point) {
|
|
69
|
-
this.diagramEditorState = diagramEditorState;
|
|
70
|
-
this.classView = classView;
|
|
71
|
-
this.point = point;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
export class DiagramEditorInlinePropertyEditorState {
|
|
75
|
-
diagramEditorState;
|
|
76
|
-
property;
|
|
77
|
-
point;
|
|
78
|
-
isEditingPropertyView;
|
|
79
|
-
constructor(diagramEditorState, property, point, isEditingPropertyView) {
|
|
80
|
-
this.diagramEditorState = diagramEditorState;
|
|
81
|
-
this.property = PropertyExplicitReference.create(property);
|
|
82
|
-
this.point = point;
|
|
83
|
-
this.isEditingPropertyView = isEditingPropertyView;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export class DiagramEditorState extends ElementEditorState {
|
|
87
|
-
_renderer;
|
|
88
|
-
showHotkeyInfosModal = false;
|
|
89
|
-
sidePanelDisplayState = new PanelDisplayState({
|
|
90
|
-
initial: 0,
|
|
91
|
-
default: 500,
|
|
92
|
-
snap: 100,
|
|
93
|
-
});
|
|
94
|
-
sidePanelState;
|
|
95
|
-
inlinePropertyEditorState;
|
|
96
|
-
inlineClassCreatorState;
|
|
97
|
-
inlineClassRenamerState;
|
|
98
|
-
showContextMenu = false;
|
|
99
|
-
contextMenuClassView;
|
|
100
|
-
constructor(editorStore, element) {
|
|
101
|
-
super(editorStore, element);
|
|
102
|
-
makeObservable(this, {
|
|
103
|
-
_renderer: observable,
|
|
104
|
-
showHotkeyInfosModal: observable,
|
|
105
|
-
sidePanelDisplayState: observable,
|
|
106
|
-
sidePanelState: observable,
|
|
107
|
-
inlinePropertyEditorState: observable,
|
|
108
|
-
inlineClassCreatorState: observable,
|
|
109
|
-
inlineClassRenamerState: observable,
|
|
110
|
-
showContextMenu: observable,
|
|
111
|
-
contextMenuClassView: observable,
|
|
112
|
-
renderer: computed,
|
|
113
|
-
diagram: computed,
|
|
114
|
-
isDiagramRendererInitialized: computed,
|
|
115
|
-
setShowHotkeyInfosModal: action,
|
|
116
|
-
setRenderer: action,
|
|
117
|
-
setSidePanelState: action,
|
|
118
|
-
setInlinePropertyEditorState: action,
|
|
119
|
-
setInlineClassCreatorState: action,
|
|
120
|
-
setInlineClassRenamerState: action,
|
|
121
|
-
setShowContextMenu: action,
|
|
122
|
-
setContextMenuClassView: action,
|
|
123
|
-
reprocess: action,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
get diagram() {
|
|
127
|
-
return guaranteeType(this.element, Diagram, 'Element inside diagram editor state must be a diagram');
|
|
128
|
-
}
|
|
129
|
-
get renderer() {
|
|
130
|
-
return guaranteeNonNullable(this._renderer, `Diagram renderer must be initialized (this is likely caused by calling this method at the wrong place)`);
|
|
131
|
-
}
|
|
132
|
-
get isDiagramRendererInitialized() {
|
|
133
|
-
return Boolean(this._renderer);
|
|
134
|
-
}
|
|
135
|
-
// NOTE: we have tried to use React to control the cursor and
|
|
136
|
-
// could not overcome the jank/lag problem, so we settle with CSS-based approach
|
|
137
|
-
// See https://css-tricks.com/using-css-cursors/
|
|
138
|
-
// See https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
|
|
139
|
-
get diagramCursorClass() {
|
|
140
|
-
if (!this.isDiagramRendererInitialized) {
|
|
141
|
-
return '';
|
|
142
|
-
}
|
|
143
|
-
if (this.renderer.middleClick || this.renderer.rightClick) {
|
|
144
|
-
return 'diagram-editor__cursor--grabbing';
|
|
145
|
-
}
|
|
146
|
-
switch (this.renderer.interactionMode) {
|
|
147
|
-
case DIAGRAM_INTERACTION_MODE.ADD_CLASS: {
|
|
148
|
-
return !this.isReadOnly ? 'diagram-editor__cursor--add' : '';
|
|
149
|
-
}
|
|
150
|
-
case DIAGRAM_INTERACTION_MODE.PAN: {
|
|
151
|
-
return this.renderer.leftClick
|
|
152
|
-
? 'diagram-editor__cursor--grabbing'
|
|
153
|
-
: 'diagram-editor__cursor--grab';
|
|
154
|
-
}
|
|
155
|
-
case DIAGRAM_INTERACTION_MODE.ZOOM_IN: {
|
|
156
|
-
return 'diagram-editor__cursor--zoom-in';
|
|
157
|
-
}
|
|
158
|
-
case DIAGRAM_INTERACTION_MODE.ZOOM_OUT: {
|
|
159
|
-
return 'diagram-editor__cursor--zoom-out';
|
|
160
|
-
}
|
|
161
|
-
case DIAGRAM_INTERACTION_MODE.ADD_RELATIONSHIP: {
|
|
162
|
-
if (this.isReadOnly) {
|
|
163
|
-
return '';
|
|
164
|
-
}
|
|
165
|
-
if (this.renderer.mouseOverClassView && this.renderer.selectionStart) {
|
|
166
|
-
return 'diagram-editor__cursor--add';
|
|
167
|
-
}
|
|
168
|
-
return 'diagram-editor__cursor--crosshair';
|
|
169
|
-
}
|
|
170
|
-
case DIAGRAM_INTERACTION_MODE.LAYOUT: {
|
|
171
|
-
if (this.renderer.selectionStart) {
|
|
172
|
-
return 'diagram-editor__cursor--crosshair';
|
|
173
|
-
}
|
|
174
|
-
else if (this.renderer.mouseOverClassCorner ||
|
|
175
|
-
this.renderer.selectedClassCorner) {
|
|
176
|
-
return 'diagram-editor__cursor--resize';
|
|
177
|
-
}
|
|
178
|
-
else if (this.renderer.mouseOverClassProperty) {
|
|
179
|
-
return this.isReadOnly ||
|
|
180
|
-
isElementReadOnly(this.renderer.mouseOverClassProperty._OWNER)
|
|
181
|
-
? 'diagram-editor__cursor--not-allowed'
|
|
182
|
-
: 'diagram-editor__cursor--text';
|
|
183
|
-
}
|
|
184
|
-
else if (this.renderer.mouseOverPropertyHolderViewLabel) {
|
|
185
|
-
return this.isReadOnly ||
|
|
186
|
-
isElementReadOnly(this.renderer.mouseOverPropertyHolderViewLabel.property.value
|
|
187
|
-
._OWNER)
|
|
188
|
-
? 'diagram-editor__cursor--not-allowed'
|
|
189
|
-
: 'diagram-editor__cursor--text';
|
|
190
|
-
}
|
|
191
|
-
else if (this.renderer.mouseOverClassName) {
|
|
192
|
-
return this.isReadOnly ||
|
|
193
|
-
isElementReadOnly(this.renderer.mouseOverClassName.class.value)
|
|
194
|
-
? 'diagram-editor__cursor--not-allowed'
|
|
195
|
-
: 'diagram-editor__cursor--text';
|
|
196
|
-
}
|
|
197
|
-
else if (this.renderer.mouseOverClassView) {
|
|
198
|
-
return 'diagram-editor__cursor--pointer';
|
|
199
|
-
}
|
|
200
|
-
return '';
|
|
201
|
-
}
|
|
202
|
-
default:
|
|
203
|
-
return '';
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
setRenderer(val) {
|
|
207
|
-
this._renderer = val;
|
|
208
|
-
}
|
|
209
|
-
setShowHotkeyInfosModal(val) {
|
|
210
|
-
this.showHotkeyInfosModal = val;
|
|
211
|
-
}
|
|
212
|
-
setSidePanelState(val) {
|
|
213
|
-
this.sidePanelState = val;
|
|
214
|
-
}
|
|
215
|
-
setInlinePropertyEditorState(val) {
|
|
216
|
-
this.inlinePropertyEditorState = val;
|
|
217
|
-
}
|
|
218
|
-
setInlineClassRenamerState(val) {
|
|
219
|
-
this.inlineClassRenamerState = val;
|
|
220
|
-
}
|
|
221
|
-
setInlineClassCreatorState(val) {
|
|
222
|
-
this.inlineClassCreatorState = val;
|
|
223
|
-
}
|
|
224
|
-
setShowContextMenu(val) {
|
|
225
|
-
this.showContextMenu = val;
|
|
226
|
-
}
|
|
227
|
-
setContextMenuClassView(val) {
|
|
228
|
-
this.contextMenuClassView = val;
|
|
229
|
-
}
|
|
230
|
-
closeContextMenu() {
|
|
231
|
-
this.setShowContextMenu(false);
|
|
232
|
-
}
|
|
233
|
-
setupRenderer() {
|
|
234
|
-
this.renderer.setIsReadOnly(this.isReadOnly);
|
|
235
|
-
const handleEditClassView = (classView) => {
|
|
236
|
-
this.setSidePanelState(new DiagramEditorClassViewEditorSidePanelState(this.editorStore, this, classView));
|
|
237
|
-
this.sidePanelDisplayState.open();
|
|
238
|
-
};
|
|
239
|
-
this.renderer.onClassViewDoubleClick = handleEditClassView;
|
|
240
|
-
this.renderer.handleEditClassView = handleEditClassView;
|
|
241
|
-
const createNewClassView = (point) => {
|
|
242
|
-
if (!this.isReadOnly) {
|
|
243
|
-
this.setInlineClassCreatorState(new DiagramEditorInlineClassCreatorState(this, point));
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
this.renderer.onBackgroundDoubleClick = createNewClassView;
|
|
247
|
-
this.renderer.onAddClassViewClick = createNewClassView;
|
|
248
|
-
this.renderer.onClassViewRightClick = (classView, point) => {
|
|
249
|
-
this.setShowContextMenu(true);
|
|
250
|
-
this.setContextMenuClassView(classView);
|
|
251
|
-
};
|
|
252
|
-
this.renderer.onClassNameDoubleClick = (classView, point) => {
|
|
253
|
-
if (!this.isReadOnly && !isElementReadOnly(classView.class.value)) {
|
|
254
|
-
this.setInlineClassRenamerState(new DiagramEditorInlineClassRenamerState(this, classView, point));
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
const editProperty = (property, point, propertyHolderView) => {
|
|
258
|
-
if (!this.isReadOnly && !isElementReadOnly(property._OWNER)) {
|
|
259
|
-
this.setInlinePropertyEditorState(new DiagramEditorInlinePropertyEditorState(this, property, point, Boolean(propertyHolderView)));
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
this.renderer.onClassPropertyDoubleClick = editProperty;
|
|
263
|
-
this.renderer.handleEditProperty = editProperty;
|
|
264
|
-
this.renderer.handleAddSimpleProperty = (classView) => {
|
|
265
|
-
if (!this.isReadOnly && !isElementReadOnly(classView.class.value)) {
|
|
266
|
-
const _class = classView.class.value;
|
|
267
|
-
class_addProperty(_class, new Property(`property_${_class.properties.length + 1}`, Multiplicity.ONE, GenericTypeExplicitReference.create(new GenericType(PrimitiveType.STRING)), _class));
|
|
268
|
-
this.renderer.render();
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
registerCommands() {
|
|
273
|
-
const DEFAULT_TRIGGER = () =>
|
|
274
|
-
// make sure the current active editor is this diagram editor
|
|
275
|
-
this.editorStore.tabManagerState.currentTab === this &&
|
|
276
|
-
// make sure the renderer is initialized
|
|
277
|
-
this.isDiagramRendererInitialized &&
|
|
278
|
-
// since we use hotkeys that can be easily in text input
|
|
279
|
-
// we would need to do this check to make sure we don't accidentally
|
|
280
|
-
// trigger hotkeys when the user is typing
|
|
281
|
-
(!document.activeElement ||
|
|
282
|
-
!['input', 'textarea', 'select'].includes(document.activeElement.tagName.toLowerCase()));
|
|
283
|
-
this.editorStore.applicationStore.commandService.registerCommand({
|
|
284
|
-
key: DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.RECENTER,
|
|
285
|
-
trigger: this.editorStore.createEditorCommandTrigger(DEFAULT_TRIGGER),
|
|
286
|
-
action: () => this.renderer.recenter(),
|
|
287
|
-
});
|
|
288
|
-
this.editorStore.applicationStore.commandService.registerCommand({
|
|
289
|
-
key: DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_ZOOM_TOOL,
|
|
290
|
-
trigger: this.editorStore.createEditorCommandTrigger(DEFAULT_TRIGGER),
|
|
291
|
-
action: () => this.renderer.switchToZoomMode(),
|
|
292
|
-
});
|
|
293
|
-
this.editorStore.applicationStore.commandService.registerCommand({
|
|
294
|
-
key: DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_VIEW_TOOL,
|
|
295
|
-
trigger: this.editorStore.createEditorCommandTrigger(DEFAULT_TRIGGER),
|
|
296
|
-
action: () => this.renderer.switchToViewMode(),
|
|
297
|
-
});
|
|
298
|
-
this.editorStore.applicationStore.commandService.registerCommand({
|
|
299
|
-
key: DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_PAN_TOOL,
|
|
300
|
-
trigger: this.editorStore.createEditorCommandTrigger(DEFAULT_TRIGGER),
|
|
301
|
-
action: () => this.renderer.switchToPanMode(),
|
|
302
|
-
});
|
|
303
|
-
this.editorStore.applicationStore.commandService.registerCommand({
|
|
304
|
-
key: DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_PROPERTY_TOOL,
|
|
305
|
-
trigger: this.editorStore.createEditorCommandTrigger(DEFAULT_TRIGGER),
|
|
306
|
-
action: () => this.renderer.switchToAddPropertyMode(),
|
|
307
|
-
});
|
|
308
|
-
this.editorStore.applicationStore.commandService.registerCommand({
|
|
309
|
-
key: DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_INHERITANCE_TOOL,
|
|
310
|
-
trigger: this.editorStore.createEditorCommandTrigger(DEFAULT_TRIGGER),
|
|
311
|
-
action: () => this.renderer.switchToAddInheritanceMode(),
|
|
312
|
-
});
|
|
313
|
-
this.editorStore.applicationStore.commandService.registerCommand({
|
|
314
|
-
key: DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.ADD_CLASS,
|
|
315
|
-
trigger: this.editorStore.createEditorCommandTrigger(DEFAULT_TRIGGER),
|
|
316
|
-
action: () => this.renderer.switchToAddClassMode(),
|
|
317
|
-
});
|
|
318
|
-
this.editorStore.applicationStore.commandService.registerCommand({
|
|
319
|
-
key: DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.EJECT_PROPERTY,
|
|
320
|
-
trigger: this.editorStore.createEditorCommandTrigger(DEFAULT_TRIGGER),
|
|
321
|
-
action: () => this.renderer.ejectProperty(),
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
deregisterCommands() {
|
|
325
|
-
[
|
|
326
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.RECENTER,
|
|
327
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_ZOOM_TOOL,
|
|
328
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_VIEW_TOOL,
|
|
329
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_PAN_TOOL,
|
|
330
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_PROPERTY_TOOL,
|
|
331
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.USE_INHERITANCE_TOOL,
|
|
332
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.ADD_CLASS,
|
|
333
|
-
DSL_DIAGRAM_LEGEND_STUDIO_COMMAND_KEY.EJECT_PROPERTY,
|
|
334
|
-
].forEach((commandKey) => this.editorStore.applicationStore.commandService.deregisterCommand(commandKey));
|
|
335
|
-
}
|
|
336
|
-
reprocess(newElement, editorStore) {
|
|
337
|
-
const diagramEditorState = new DiagramEditorState(editorStore, newElement);
|
|
338
|
-
return diagramEditorState;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
//# sourceMappingURL=DiagramEditorState.js.map
|