@finos/legend-application-studio 13.0.2 → 13.1.1
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/LegendStudioApplication.js +1 -1
- package/lib/components/LegendStudioApplication.js.map +1 -1
- package/lib/components/editor/command/project-search.css +1 -1
- package/lib/components/editor/command/project-search.css.map +1 -1
- package/lib/components/editor/command-center/ProjectSearchCommand.d.ts.map +1 -1
- package/lib/components/editor/command-center/ProjectSearchCommand.js +11 -3
- package/lib/components/editor/command-center/ProjectSearchCommand.js.map +1 -1
- package/lib/components/editor/edit-panel/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/FunctionEditor.js +41 -34
- package/lib/components/editor/edit-panel/FunctionEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/GenerationSpecificationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js +35 -54
- package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/GrammarTextEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/GrammarTextEditor.js +2 -2
- package/lib/components/editor/edit-panel/GrammarTextEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/RuntimeEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/RuntimeEditor.js +11 -20
- package/lib/components/editor/edit-panel/RuntimeEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/data-editor/DataElementEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js +4 -8
- package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.js +1 -1
- package/lib/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js +3 -7
- package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.js +2 -2
- package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js +2 -9
- package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.js +3 -4
- package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js +3 -10
- package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js +4 -10
- package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js +7 -9
- package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js +3 -6
- package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.js +7 -8
- package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +2 -2
- package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js +5 -7
- package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.js +3 -4
- package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.js +1 -1
- package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +3 -5
- package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +1 -1
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +4 -8
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/ClassEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +157 -57
- package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js +39 -21
- package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js +62 -9
- package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.js +4 -8
- package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts +7 -1
- package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js +33 -5
- package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts +7 -1
- package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js +35 -7
- package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js +4 -4
- package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +8 -15
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/components/shared/StudioLambdaEditor.d.ts +1 -0
- package/lib/components/shared/StudioLambdaEditor.d.ts.map +1 -1
- package/lib/components/shared/StudioLambdaEditor.js +2 -2
- package/lib/components/shared/StudioLambdaEditor.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +5 -5
- package/lib/stores/EditorStore.d.ts.map +1 -1
- package/lib/stores/EditorStore.js +7 -7
- package/lib/stores/EditorStore.js.map +1 -1
- package/lib/stores/LegendStudioBaseStore.d.ts +3 -8
- package/lib/stores/LegendStudioBaseStore.d.ts.map +1 -1
- package/lib/stores/LegendStudioBaseStore.js +9 -105
- package/lib/stores/LegendStudioBaseStore.js.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +8 -2
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor-state/GenerationSpecificationEditorState.d.ts +0 -2
- package/lib/stores/editor-state/GenerationSpecificationEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/GenerationSpecificationEditorState.js +1 -8
- package/lib/stores/editor-state/GenerationSpecificationEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/ElementEditorState.js +2 -4
- package/lib/stores/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js +1 -1
- package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js +1 -1
- package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
- package/lib/stores/graphModifier/DomainGraphModifierHelper.d.ts +10 -0
- package/lib/stores/graphModifier/DomainGraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graphModifier/DomainGraphModifierHelper.js +31 -1
- package/lib/stores/graphModifier/DomainGraphModifierHelper.js.map +1 -1
- package/lib/stores/shared/DnDUtil.d.ts +1 -2
- package/lib/stores/shared/DnDUtil.d.ts.map +1 -1
- package/lib/stores/shared/DnDUtil.js +0 -2
- package/lib/stores/shared/DnDUtil.js.map +1 -1
- package/package.json +13 -13
- package/src/components/LegendStudioApplication.tsx +2 -2
- package/src/components/editor/command-center/ProjectSearchCommand.tsx +13 -2
- package/src/components/editor/edit-panel/FunctionEditor.tsx +220 -152
- package/src/components/editor/edit-panel/GenerationSpecificationEditor.tsx +154 -184
- package/src/components/editor/edit-panel/GrammarTextEditor.tsx +4 -5
- package/src/components/editor/edit-panel/RuntimeEditor.tsx +89 -90
- package/src/components/editor/edit-panel/data-editor/DataElementEditor.tsx +57 -40
- package/src/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.tsx +1 -1
- package/src/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.tsx +50 -45
- package/src/components/editor/edit-panel/external-format-editor/BindingElementEditor.tsx +36 -32
- package/src/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.tsx +1 -1
- package/src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx +46 -41
- package/src/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.tsx +9 -7
- package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.tsx +18 -21
- package/src/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.tsx +39 -29
- package/src/components/editor/edit-panel/mapping-editor/MappingExplorer.tsx +39 -39
- package/src/components/editor/edit-panel/mapping-editor/MappingTestEditor.tsx +23 -15
- package/src/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.tsx +40 -38
- package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +2 -2
- package/src/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.tsx +48 -45
- package/src/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.tsx +12 -8
- package/src/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.tsx +2 -3
- package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +75 -72
- package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +1 -1
- package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +55 -38
- package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +813 -499
- package/src/components/editor/edit-panel/uml-editor/EnumerationEditor.tsx +209 -113
- package/src/components/editor/edit-panel/uml-editor/ProfileEditor.tsx +184 -52
- package/src/components/editor/edit-panel/uml-editor/PropertyEditor.tsx +62 -39
- package/src/components/editor/edit-panel/uml-editor/StereotypeSelector.tsx +137 -52
- package/src/components/editor/edit-panel/uml-editor/TaggedValueEditor.tsx +171 -88
- package/src/components/editor/side-bar/CreateNewElementModal.tsx +4 -2
- package/src/components/editor/side-bar/Explorer.tsx +13 -20
- package/src/components/shared/StudioLambdaEditor.tsx +3 -0
- package/src/stores/EditorStore.ts +7 -6
- package/src/stores/LegendStudioBaseStore.ts +20 -147
- package/src/stores/editor/NewElementState.ts +8 -2
- package/src/stores/editor-state/GenerationSpecificationEditorState.ts +1 -15
- package/src/stores/editor-state/element-editor-state/ElementEditorState.ts +2 -3
- package/src/stores/editor-state/element-editor-state/mapping/MappingEditorState.ts +1 -1
- package/src/stores/editor-state/element-editor-state/mapping/MappingExecutionState.ts +1 -1
- package/src/stores/graphModifier/DomainGraphModifierHelper.ts +92 -0
- package/src/stores/shared/DnDUtil.ts +0 -2
|
@@ -26,15 +26,19 @@ import {
|
|
|
26
26
|
PlusIcon,
|
|
27
27
|
TimesIcon,
|
|
28
28
|
LockIcon,
|
|
29
|
+
PanelEntryDragHandle,
|
|
30
|
+
PanelEntryDropZonePlaceholder,
|
|
31
|
+
DragPreviewLayer,
|
|
32
|
+
useDragPreviewLayer,
|
|
29
33
|
} from '@finos/legend-art';
|
|
30
34
|
import { LEGEND_STUDIO_TEST_ID } from '../../../LegendStudioTestID.js';
|
|
31
35
|
import { useEditorStore } from '../../EditorStoreProvider.js';
|
|
32
36
|
import {
|
|
33
37
|
type Profile,
|
|
34
|
-
type Tag,
|
|
35
38
|
type Stereotype,
|
|
36
39
|
stub_Tag,
|
|
37
40
|
stub_Stereotype,
|
|
41
|
+
type Tag,
|
|
38
42
|
} from '@finos/legend-graph';
|
|
39
43
|
import {
|
|
40
44
|
profile_addTag,
|
|
@@ -42,55 +46,122 @@ import {
|
|
|
42
46
|
profile_deleteTag,
|
|
43
47
|
profile_deleteStereotype,
|
|
44
48
|
tagStereotype_setValue,
|
|
49
|
+
profile_swapTags,
|
|
50
|
+
profile_swapStereotypes,
|
|
45
51
|
} from '../../../../stores/graphModifier/DomainGraphModifierHelper.js';
|
|
46
52
|
import { useApplicationNavigationContext } from '@finos/legend-application';
|
|
47
53
|
import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../stores/LegendStudioApplicationNavigationContext.js';
|
|
54
|
+
import { useRef, useCallback } from 'react';
|
|
55
|
+
import { useDrop, useDrag } from 'react-dnd';
|
|
56
|
+
|
|
57
|
+
type TagDragSource = {
|
|
58
|
+
tag: Tag;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const TAG_DND_TYPE = 'TAG';
|
|
48
62
|
|
|
49
63
|
const TagBasicEditor = observer(
|
|
50
|
-
(props: {
|
|
51
|
-
|
|
64
|
+
(props: {
|
|
65
|
+
tag: Tag;
|
|
66
|
+
deleteValue: () => void;
|
|
67
|
+
_profile: Profile;
|
|
68
|
+
isReadOnly: boolean;
|
|
69
|
+
}) => {
|
|
70
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
71
|
+
const { tag, _profile, deleteValue, isReadOnly } = props;
|
|
52
72
|
const changeValue: React.ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
53
73
|
tagStereotype_setValue(tag, event.target.value);
|
|
54
74
|
};
|
|
55
75
|
const isTagDuplicated = (val: Tag): boolean =>
|
|
56
76
|
tag._OWNER.p_tags.filter((t) => t.value === val.value).length >= 2;
|
|
57
77
|
|
|
78
|
+
// Drag and Drop
|
|
79
|
+
const handleHover = useCallback(
|
|
80
|
+
(item: TagDragSource): void => {
|
|
81
|
+
const draggingTag = item.tag;
|
|
82
|
+
const hoveredTag = tag;
|
|
83
|
+
profile_swapTags(_profile, draggingTag, hoveredTag);
|
|
84
|
+
},
|
|
85
|
+
[_profile, tag],
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const [{ isBeingDraggedTag }, dropConnector] = useDrop<
|
|
89
|
+
TagDragSource,
|
|
90
|
+
void,
|
|
91
|
+
{ isBeingDraggedTag: Tag | undefined }
|
|
92
|
+
>(
|
|
93
|
+
() => ({
|
|
94
|
+
accept: [TAG_DND_TYPE],
|
|
95
|
+
hover: (item) => handleHover(item),
|
|
96
|
+
collect: (monitor) => ({
|
|
97
|
+
isBeingDraggedTag: monitor.getItem<TagDragSource | null>()?.tag,
|
|
98
|
+
}),
|
|
99
|
+
}),
|
|
100
|
+
[handleHover],
|
|
101
|
+
);
|
|
102
|
+
const isBeingDragged = tag === isBeingDraggedTag;
|
|
103
|
+
|
|
104
|
+
const [, dragConnector, dragPreviewConnector] = useDrag<TagDragSource>(
|
|
105
|
+
() => ({
|
|
106
|
+
type: TAG_DND_TYPE,
|
|
107
|
+
item: () => ({
|
|
108
|
+
tag: tag,
|
|
109
|
+
}),
|
|
110
|
+
}),
|
|
111
|
+
[tag],
|
|
112
|
+
);
|
|
113
|
+
dragConnector(dropConnector(ref));
|
|
114
|
+
useDragPreviewLayer(dragPreviewConnector);
|
|
115
|
+
|
|
58
116
|
return (
|
|
59
|
-
<div className="tag-basic-
|
|
60
|
-
<
|
|
61
|
-
className="tag-basic-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
117
|
+
<div ref={ref} className="tag-basic-editor__container">
|
|
118
|
+
<PanelEntryDropZonePlaceholder showPlaceholder={isBeingDragged}>
|
|
119
|
+
<div className="tag-basic-editor">
|
|
120
|
+
<PanelEntryDragHandle />
|
|
121
|
+
<InputWithInlineValidation
|
|
122
|
+
className="tag-basic-editor__value input-group__input"
|
|
123
|
+
spellCheck={false}
|
|
124
|
+
disabled={isReadOnly}
|
|
125
|
+
value={tag.value}
|
|
126
|
+
onChange={changeValue}
|
|
127
|
+
placeholder={`Tag value`}
|
|
128
|
+
validationErrorMessage={
|
|
129
|
+
isTagDuplicated(tag) ? 'Duplicated tag' : undefined
|
|
130
|
+
}
|
|
131
|
+
/>
|
|
132
|
+
{!isReadOnly && (
|
|
133
|
+
<button
|
|
134
|
+
className="uml-element-editor__remove-btn"
|
|
135
|
+
disabled={isReadOnly}
|
|
136
|
+
onClick={deleteValue}
|
|
137
|
+
tabIndex={-1}
|
|
138
|
+
title={'Remove'}
|
|
139
|
+
>
|
|
140
|
+
<TimesIcon />
|
|
141
|
+
</button>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
144
|
+
</PanelEntryDropZonePlaceholder>
|
|
82
145
|
</div>
|
|
83
146
|
);
|
|
84
147
|
},
|
|
85
148
|
);
|
|
86
149
|
|
|
150
|
+
type StereotypeDragSource = {
|
|
151
|
+
stereotype: Stereotype;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const STEREOTYPE_DND_TYPE = 'STEREOTYPE';
|
|
155
|
+
|
|
87
156
|
const StereotypeBasicEditor = observer(
|
|
88
157
|
(props: {
|
|
89
158
|
stereotype: Stereotype;
|
|
90
159
|
deleteStereotype: () => void;
|
|
160
|
+
_profile: Profile;
|
|
91
161
|
isReadOnly: boolean;
|
|
92
162
|
}) => {
|
|
93
|
-
const
|
|
163
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
164
|
+
const { stereotype, _profile, deleteStereotype, isReadOnly } = props;
|
|
94
165
|
const changeValue: React.ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
95
166
|
tagStereotype_setValue(stereotype, event.target.value);
|
|
96
167
|
};
|
|
@@ -98,32 +169,77 @@ const StereotypeBasicEditor = observer(
|
|
|
98
169
|
stereotype._OWNER.p_stereotypes.filter((s) => s.value === val.value)
|
|
99
170
|
.length >= 2;
|
|
100
171
|
|
|
172
|
+
// Drag and Drop
|
|
173
|
+
const handleHover = useCallback(
|
|
174
|
+
(item: StereotypeDragSource): void => {
|
|
175
|
+
const draggingTag = item.stereotype;
|
|
176
|
+
const hoveredTag = stereotype;
|
|
177
|
+
profile_swapStereotypes(_profile, draggingTag, hoveredTag);
|
|
178
|
+
},
|
|
179
|
+
[_profile, stereotype],
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
const [{ isBeingDraggedTag }, dropConnector] = useDrop<
|
|
183
|
+
StereotypeDragSource,
|
|
184
|
+
void,
|
|
185
|
+
{ isBeingDraggedTag: Tag | undefined }
|
|
186
|
+
>(
|
|
187
|
+
() => ({
|
|
188
|
+
accept: [STEREOTYPE_DND_TYPE],
|
|
189
|
+
hover: (item) => handleHover(item),
|
|
190
|
+
collect: (monitor) => ({
|
|
191
|
+
isBeingDraggedTag: monitor.getItem<StereotypeDragSource | null>()
|
|
192
|
+
?.stereotype,
|
|
193
|
+
}),
|
|
194
|
+
}),
|
|
195
|
+
[handleHover],
|
|
196
|
+
);
|
|
197
|
+
const isBeingDragged = stereotype === isBeingDraggedTag;
|
|
198
|
+
|
|
199
|
+
const [, dragConnector, dragPreviewConnector] =
|
|
200
|
+
useDrag<StereotypeDragSource>(
|
|
201
|
+
() => ({
|
|
202
|
+
type: STEREOTYPE_DND_TYPE,
|
|
203
|
+
item: () => ({
|
|
204
|
+
stereotype: stereotype,
|
|
205
|
+
}),
|
|
206
|
+
}),
|
|
207
|
+
[stereotype],
|
|
208
|
+
);
|
|
209
|
+
dragConnector(dropConnector(ref));
|
|
210
|
+
useDragPreviewLayer(dragPreviewConnector);
|
|
211
|
+
|
|
101
212
|
return (
|
|
102
|
-
<div className="stereotype-basic-
|
|
103
|
-
<
|
|
104
|
-
className="stereotype-basic-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
213
|
+
<div ref={ref} className="stereotype-basic-editor__container">
|
|
214
|
+
<PanelEntryDropZonePlaceholder showPlaceholder={isBeingDragged}>
|
|
215
|
+
<div className="stereotype-basic-editor">
|
|
216
|
+
<PanelEntryDragHandle />
|
|
217
|
+
<InputWithInlineValidation
|
|
218
|
+
className="stereotype-basic-editor__value input-group__input"
|
|
219
|
+
spellCheck={false}
|
|
220
|
+
disabled={isReadOnly}
|
|
221
|
+
value={stereotype.value}
|
|
222
|
+
onChange={changeValue}
|
|
223
|
+
placeholder={`Stereotype value`}
|
|
224
|
+
validationErrorMessage={
|
|
225
|
+
isStereotypeDuplicated(stereotype)
|
|
226
|
+
? 'Duplicated stereotype'
|
|
227
|
+
: undefined
|
|
228
|
+
}
|
|
229
|
+
/>
|
|
230
|
+
{!isReadOnly && (
|
|
231
|
+
<button
|
|
232
|
+
className="uml-element-editor__remove-btn"
|
|
233
|
+
disabled={isReadOnly}
|
|
234
|
+
onClick={deleteStereotype}
|
|
235
|
+
tabIndex={-1}
|
|
236
|
+
title={'Remove'}
|
|
237
|
+
>
|
|
238
|
+
<TimesIcon />
|
|
239
|
+
</button>
|
|
240
|
+
)}
|
|
241
|
+
</div>
|
|
242
|
+
</PanelEntryDropZonePlaceholder>
|
|
127
243
|
</div>
|
|
128
244
|
);
|
|
129
245
|
},
|
|
@@ -221,10 +337,17 @@ export const ProfileEditor = observer((props: { profile: Profile }) => {
|
|
|
221
337
|
<div className="panel__content">
|
|
222
338
|
{selectedTab === UML_EDITOR_TAB.TAGS && (
|
|
223
339
|
<div className="panel__content__lists">
|
|
340
|
+
<DragPreviewLayer
|
|
341
|
+
labelGetter={(item: TagDragSource): string =>
|
|
342
|
+
item.tag.value === '' ? '(unknown)' : item.tag.value
|
|
343
|
+
}
|
|
344
|
+
types={[TAG_DND_TYPE]}
|
|
345
|
+
/>
|
|
224
346
|
{profile.p_tags.map((tag) => (
|
|
225
347
|
<TagBasicEditor
|
|
226
348
|
key={tag._UUID}
|
|
227
349
|
tag={tag}
|
|
350
|
+
_profile={profile}
|
|
228
351
|
deleteValue={deleteTag(tag)}
|
|
229
352
|
isReadOnly={isReadOnly}
|
|
230
353
|
/>
|
|
@@ -233,9 +356,18 @@ export const ProfileEditor = observer((props: { profile: Profile }) => {
|
|
|
233
356
|
)}
|
|
234
357
|
{selectedTab === UML_EDITOR_TAB.STEREOTYPES && (
|
|
235
358
|
<div className="panel__content__lists">
|
|
359
|
+
<DragPreviewLayer
|
|
360
|
+
labelGetter={(item: StereotypeDragSource): string =>
|
|
361
|
+
item.stereotype.value === ''
|
|
362
|
+
? '(unknown)'
|
|
363
|
+
: item.stereotype.value
|
|
364
|
+
}
|
|
365
|
+
types={[STEREOTYPE_DND_TYPE]}
|
|
366
|
+
/>
|
|
236
367
|
{profile.p_stereotypes.map((stereotype) => (
|
|
237
368
|
<StereotypeBasicEditor
|
|
238
369
|
key={stereotype._UUID}
|
|
370
|
+
_profile={profile}
|
|
239
371
|
stereotype={stereotype}
|
|
240
372
|
deleteStereotype={deleteStereotype(stereotype)}
|
|
241
373
|
isReadOnly={isReadOnly}
|
|
@@ -22,9 +22,21 @@ import {
|
|
|
22
22
|
type ElementDragSource,
|
|
23
23
|
type UMLEditorElementDropTarget,
|
|
24
24
|
} from '../../../../stores/shared/DnDUtil.js';
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
import {
|
|
26
|
+
clsx,
|
|
27
|
+
LockIcon,
|
|
28
|
+
PanelDropZone,
|
|
29
|
+
PlusIcon,
|
|
30
|
+
TimesIcon,
|
|
31
|
+
} from '@finos/legend-art';
|
|
32
|
+
import {
|
|
33
|
+
StereotypeSelector,
|
|
34
|
+
StereotypeDragPreviewLayer,
|
|
35
|
+
} from './StereotypeSelector.js';
|
|
36
|
+
import {
|
|
37
|
+
TaggedValueDragPreviewLayer,
|
|
38
|
+
TaggedValueEditor,
|
|
39
|
+
} from './TaggedValueEditor.js';
|
|
28
40
|
import { LEGEND_STUDIO_TEST_ID } from '../../../LegendStudioTestID.js';
|
|
29
41
|
import { prettyCONSTName } from '@finos/legend-shared';
|
|
30
42
|
import { UML_EDITOR_TAB } from '../../../../stores/editor-state/element-editor-state/UMLEditorState.js';
|
|
@@ -109,11 +121,15 @@ export const PropertyEditor = observer(
|
|
|
109
121
|
},
|
|
110
122
|
[isReadOnly, property],
|
|
111
123
|
);
|
|
112
|
-
const [{ isTaggedValueDragOver }, dropTaggedValueRef] = useDrop
|
|
124
|
+
const [{ isTaggedValueDragOver }, dropTaggedValueRef] = useDrop<
|
|
125
|
+
ElementDragSource,
|
|
126
|
+
void,
|
|
127
|
+
{ isTaggedValueDragOver: boolean }
|
|
128
|
+
>(
|
|
113
129
|
() => ({
|
|
114
130
|
accept: [CORE_DND_TYPE.PROJECT_EXPLORER_PROFILE],
|
|
115
|
-
drop: (item
|
|
116
|
-
collect: (monitor)
|
|
131
|
+
drop: (item) => handleDropTaggedValue(item),
|
|
132
|
+
collect: (monitor) => ({
|
|
117
133
|
isTaggedValueDragOver: monitor.isOver({ shallow: true }),
|
|
118
134
|
}),
|
|
119
135
|
}),
|
|
@@ -132,16 +148,21 @@ export const PropertyEditor = observer(
|
|
|
132
148
|
},
|
|
133
149
|
[isReadOnly, property],
|
|
134
150
|
);
|
|
135
|
-
const [{ isStereotypeDragOver }, dropStereotypeRef] = useDrop
|
|
151
|
+
const [{ isStereotypeDragOver }, dropStereotypeRef] = useDrop<
|
|
152
|
+
ElementDragSource,
|
|
153
|
+
void,
|
|
154
|
+
{ isStereotypeDragOver: boolean }
|
|
155
|
+
>(
|
|
136
156
|
() => ({
|
|
137
157
|
accept: [CORE_DND_TYPE.PROJECT_EXPLORER_PROFILE],
|
|
138
|
-
drop: (item
|
|
139
|
-
collect: (monitor)
|
|
158
|
+
drop: (item) => handleDropStereotype(item),
|
|
159
|
+
collect: (monitor) => ({
|
|
140
160
|
isStereotypeDragOver: monitor.isOver({ shallow: true }),
|
|
141
161
|
}),
|
|
142
162
|
}),
|
|
143
163
|
[handleDropStereotype],
|
|
144
164
|
);
|
|
165
|
+
|
|
145
166
|
return (
|
|
146
167
|
<div className="uml-element-editor property-editor">
|
|
147
168
|
<div data-testid={LEGEND_STUDIO_TEST_ID.PANEL} className="panel">
|
|
@@ -196,40 +217,42 @@ export const PropertyEditor = observer(
|
|
|
196
217
|
</div>
|
|
197
218
|
<div className="panel__content">
|
|
198
219
|
{selectedTab === UML_EDITOR_TAB.TAGGED_VALUES && (
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
'panel__content__lists--dnd-over':
|
|
203
|
-
isTaggedValueDragOver && !isReadOnly,
|
|
204
|
-
})}
|
|
220
|
+
<PanelDropZone
|
|
221
|
+
isDragOver={isTaggedValueDragOver && !isReadOnly}
|
|
222
|
+
dropTargetConnector={dropTaggedValueRef}
|
|
205
223
|
>
|
|
206
|
-
|
|
207
|
-
<
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
224
|
+
<div className="panel__content__lists">
|
|
225
|
+
<TaggedValueDragPreviewLayer />
|
|
226
|
+
{property.taggedValues.map((taggedValue) => (
|
|
227
|
+
<TaggedValueEditor
|
|
228
|
+
annotatedElement={property}
|
|
229
|
+
key={taggedValue._UUID}
|
|
230
|
+
taggedValue={taggedValue}
|
|
231
|
+
deleteValue={_deleteTaggedValue(taggedValue)}
|
|
232
|
+
isReadOnly={isReadOnly}
|
|
233
|
+
/>
|
|
234
|
+
))}
|
|
235
|
+
</div>
|
|
236
|
+
</PanelDropZone>
|
|
215
237
|
)}
|
|
216
238
|
{selectedTab === UML_EDITOR_TAB.STEREOTYPES && (
|
|
217
|
-
<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
'panel__content__lists--dnd-over':
|
|
221
|
-
isStereotypeDragOver && !isReadOnly,
|
|
222
|
-
})}
|
|
239
|
+
<PanelDropZone
|
|
240
|
+
isDragOver={isStereotypeDragOver && !isReadOnly}
|
|
241
|
+
dropTargetConnector={dropStereotypeRef}
|
|
223
242
|
>
|
|
224
|
-
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
243
|
+
<div className="panel__content__lists">
|
|
244
|
+
<StereotypeDragPreviewLayer />
|
|
245
|
+
{property.stereotypes.map((stereotype) => (
|
|
246
|
+
<StereotypeSelector
|
|
247
|
+
key={stereotype.value._UUID}
|
|
248
|
+
annotatedElement={property}
|
|
249
|
+
stereotype={stereotype}
|
|
250
|
+
deleteStereotype={_deleteStereotype(stereotype)}
|
|
251
|
+
isReadOnly={isReadOnly}
|
|
252
|
+
/>
|
|
253
|
+
))}
|
|
254
|
+
</div>
|
|
255
|
+
</PanelDropZone>
|
|
233
256
|
)}
|
|
234
257
|
</div>
|
|
235
258
|
</div>
|