@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
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { useState, useEffect, useCallback } from 'react';
|
|
17
|
+
import { useState, useEffect, useCallback, useRef } from 'react';
|
|
18
18
|
import { observer } from 'mobx-react-lite';
|
|
19
19
|
import {
|
|
20
20
|
FunctionEditorState,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
prettyCONSTName,
|
|
30
30
|
UnsupportedOperationError,
|
|
31
31
|
} from '@finos/legend-shared';
|
|
32
|
-
import { useDrop } from 'react-dnd';
|
|
32
|
+
import { useDrag, useDrop } from 'react-dnd';
|
|
33
33
|
import {
|
|
34
34
|
clsx,
|
|
35
35
|
CustomSelectorInput,
|
|
@@ -38,10 +38,20 @@ import {
|
|
|
38
38
|
PlusIcon,
|
|
39
39
|
TimesIcon,
|
|
40
40
|
ArrowCircleRightIcon,
|
|
41
|
+
PanelEntryDragHandle,
|
|
42
|
+
PanelEntryDropZonePlaceholder,
|
|
43
|
+
DragPreviewLayer,
|
|
44
|
+
useDragPreviewLayer,
|
|
41
45
|
} from '@finos/legend-art';
|
|
42
46
|
import { LEGEND_STUDIO_TEST_ID } from '../../LegendStudioTestID.js';
|
|
43
|
-
import {
|
|
44
|
-
|
|
47
|
+
import {
|
|
48
|
+
StereotypeDragPreviewLayer,
|
|
49
|
+
StereotypeSelector,
|
|
50
|
+
} from './uml-editor/StereotypeSelector.js';
|
|
51
|
+
import {
|
|
52
|
+
TaggedValueDragPreviewLayer,
|
|
53
|
+
TaggedValueEditor,
|
|
54
|
+
} from './uml-editor/TaggedValueEditor.js';
|
|
45
55
|
import { flowResult } from 'mobx';
|
|
46
56
|
import { useEditorStore } from '../EditorStoreProvider.js';
|
|
47
57
|
import {
|
|
@@ -81,6 +91,7 @@ import {
|
|
|
81
91
|
annotatedElement_addStereotype,
|
|
82
92
|
annotatedElement_deleteStereotype,
|
|
83
93
|
annotatedElement_deleteTaggedValue,
|
|
94
|
+
function_swapParameters,
|
|
84
95
|
} from '../../../stores/graphModifier/DomainGraphModifierHelper.js';
|
|
85
96
|
import {
|
|
86
97
|
rawVariableExpression_setMultiplicity,
|
|
@@ -111,13 +122,21 @@ export const getFunctionParameterType = (
|
|
|
111
122
|
);
|
|
112
123
|
};
|
|
113
124
|
|
|
125
|
+
type FunctionParameterDragSource = {
|
|
126
|
+
parameter: RawVariableExpression;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const FUNCTION_PARAMETER_DND_TYPE = 'FUNCTION_PARAMETER';
|
|
130
|
+
|
|
114
131
|
const ParameterBasicEditor = observer(
|
|
115
132
|
(props: {
|
|
116
133
|
parameter: RawVariableExpression;
|
|
134
|
+
_func: ConcreteFunctionDefinition;
|
|
117
135
|
deleteParameter: () => void;
|
|
118
136
|
isReadOnly: boolean;
|
|
119
137
|
}) => {
|
|
120
|
-
const
|
|
138
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
139
|
+
const { parameter, _func, deleteParameter, isReadOnly } = props;
|
|
121
140
|
const editorStore = useEditorStore();
|
|
122
141
|
// Name
|
|
123
142
|
const changeValue: React.ChangeEventHandler<HTMLInputElement> = (event) =>
|
|
@@ -182,130 +201,182 @@ const ParameterBasicEditor = observer(
|
|
|
182
201
|
setUpperBound(event.target.value);
|
|
183
202
|
updateMultiplicity(lowerBound, event.target.value);
|
|
184
203
|
};
|
|
204
|
+
|
|
205
|
+
// Drag and Drop
|
|
206
|
+
const handleHover = useCallback(
|
|
207
|
+
(item: FunctionParameterDragSource): void => {
|
|
208
|
+
const draggingParameter = item.parameter;
|
|
209
|
+
const hoveredParameter = parameter;
|
|
210
|
+
function_swapParameters(_func, draggingParameter, hoveredParameter);
|
|
211
|
+
},
|
|
212
|
+
[_func, parameter],
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
const [{ isBeingDraggedParameter }, dropConnector] = useDrop<
|
|
216
|
+
FunctionParameterDragSource,
|
|
217
|
+
void,
|
|
218
|
+
{ isBeingDraggedParameter: RawVariableExpression | undefined }
|
|
219
|
+
>(
|
|
220
|
+
() => ({
|
|
221
|
+
accept: [FUNCTION_PARAMETER_DND_TYPE],
|
|
222
|
+
hover: (item) => handleHover(item),
|
|
223
|
+
collect: (
|
|
224
|
+
monitor,
|
|
225
|
+
): {
|
|
226
|
+
isBeingDraggedParameter: RawVariableExpression | undefined;
|
|
227
|
+
} => ({
|
|
228
|
+
isBeingDraggedParameter:
|
|
229
|
+
monitor.getItem<FunctionParameterDragSource | null>()?.parameter,
|
|
230
|
+
}),
|
|
231
|
+
}),
|
|
232
|
+
[handleHover],
|
|
233
|
+
);
|
|
234
|
+
const isBeingDragged = parameter === isBeingDraggedParameter;
|
|
235
|
+
|
|
236
|
+
const [, dragConnector, dragPreviewConnector] =
|
|
237
|
+
useDrag<FunctionParameterDragSource>(
|
|
238
|
+
() => ({
|
|
239
|
+
type: FUNCTION_PARAMETER_DND_TYPE,
|
|
240
|
+
item: () => ({
|
|
241
|
+
parameter: parameter,
|
|
242
|
+
}),
|
|
243
|
+
}),
|
|
244
|
+
[parameter],
|
|
245
|
+
);
|
|
246
|
+
dragConnector(dropConnector(ref));
|
|
247
|
+
useDragPreviewLayer(dragPreviewConnector);
|
|
248
|
+
|
|
185
249
|
return (
|
|
186
|
-
<div className="property-basic-
|
|
187
|
-
{
|
|
188
|
-
<div className="property-basic-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<input
|
|
193
|
-
className="property-basic-editor__name"
|
|
194
|
-
disabled={isReadOnly}
|
|
195
|
-
value={parameter.name}
|
|
196
|
-
spellCheck={false}
|
|
197
|
-
onChange={changeValue}
|
|
198
|
-
placeholder={`Property name`}
|
|
199
|
-
/>
|
|
200
|
-
{!isReadOnly && isEditingType && (
|
|
201
|
-
<CustomSelectorInput
|
|
202
|
-
className="property-basic-editor__type"
|
|
203
|
-
options={typeOptions}
|
|
204
|
-
onChange={changeType}
|
|
205
|
-
value={selectedType}
|
|
206
|
-
placeholder={'Choose a data type or enumeration'}
|
|
207
|
-
filterOption={filterOption}
|
|
208
|
-
/>
|
|
209
|
-
)}
|
|
210
|
-
{!isReadOnly && !isEditingType && (
|
|
211
|
-
<div
|
|
212
|
-
className={clsx(
|
|
213
|
-
'property-basic-editor__type',
|
|
214
|
-
'property-basic-editor__type--show-click-hint',
|
|
215
|
-
`background--${typeName.toLowerCase()}`,
|
|
216
|
-
{
|
|
217
|
-
'property-basic-editor__type--has-visit-btn':
|
|
218
|
-
typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE,
|
|
219
|
-
},
|
|
220
|
-
)}
|
|
221
|
-
>
|
|
222
|
-
{typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE && (
|
|
223
|
-
<div className="property-basic-editor__type__abbr">
|
|
224
|
-
{getElementIcon(editorStore, paramType)}
|
|
250
|
+
<div ref={ref} className="property-basic-editor__container">
|
|
251
|
+
<PanelEntryDropZonePlaceholder showPlaceholder={isBeingDragged}>
|
|
252
|
+
<div className="property-basic-editor">
|
|
253
|
+
{isReadOnly && (
|
|
254
|
+
<div className="property-basic-editor__lock">
|
|
255
|
+
<LockIcon />
|
|
225
256
|
</div>
|
|
226
257
|
)}
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
{
|
|
237
|
-
<
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
</button>
|
|
258
|
+
<PanelEntryDragHandle />
|
|
259
|
+
<input
|
|
260
|
+
className="property-basic-editor__name"
|
|
261
|
+
disabled={isReadOnly}
|
|
262
|
+
value={parameter.name}
|
|
263
|
+
spellCheck={false}
|
|
264
|
+
onChange={changeValue}
|
|
265
|
+
placeholder={`Parameter name`}
|
|
266
|
+
/>
|
|
267
|
+
{!isReadOnly && isEditingType && (
|
|
268
|
+
<CustomSelectorInput
|
|
269
|
+
className="property-basic-editor__type"
|
|
270
|
+
options={typeOptions}
|
|
271
|
+
onChange={changeType}
|
|
272
|
+
value={selectedType}
|
|
273
|
+
placeholder={'Choose a data type or enumeration'}
|
|
274
|
+
filterOption={filterOption}
|
|
275
|
+
/>
|
|
246
276
|
)}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
277
|
+
{!isReadOnly && !isEditingType && (
|
|
278
|
+
<div
|
|
279
|
+
className={clsx(
|
|
280
|
+
'property-basic-editor__type',
|
|
281
|
+
'property-basic-editor__type--show-click-hint',
|
|
282
|
+
`background--${typeName.toLowerCase()}`,
|
|
283
|
+
{
|
|
284
|
+
'property-basic-editor__type--has-visit-btn':
|
|
285
|
+
typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE,
|
|
286
|
+
},
|
|
287
|
+
)}
|
|
288
|
+
>
|
|
289
|
+
{typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE && (
|
|
290
|
+
<div className="property-basic-editor__type__abbr">
|
|
291
|
+
{getElementIcon(editorStore, paramType)}
|
|
292
|
+
</div>
|
|
293
|
+
)}
|
|
294
|
+
<div className="property-basic-editor__type__label">
|
|
295
|
+
{paramType.name}
|
|
296
|
+
</div>
|
|
297
|
+
<div
|
|
298
|
+
className="property-basic-editor__type__label property-basic-editor__type__label--hover"
|
|
299
|
+
onClick={(): void => setIsEditingType(true)}
|
|
300
|
+
>
|
|
301
|
+
Click to edit
|
|
302
|
+
</div>
|
|
303
|
+
{typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE && (
|
|
304
|
+
<button
|
|
305
|
+
data-testid={LEGEND_STUDIO_TEST_ID.TYPE_VISIT}
|
|
306
|
+
className="property-basic-editor__type__visit-btn"
|
|
307
|
+
onClick={openElement}
|
|
308
|
+
tabIndex={-1}
|
|
309
|
+
title={'Visit element'}
|
|
310
|
+
>
|
|
311
|
+
<ArrowCircleRightIcon />
|
|
312
|
+
</button>
|
|
313
|
+
)}
|
|
314
|
+
</div>
|
|
258
315
|
)}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
316
|
+
{isReadOnly && (
|
|
317
|
+
<div
|
|
318
|
+
className={clsx(
|
|
319
|
+
'property-basic-editor__type',
|
|
320
|
+
`background--${typeName.toLowerCase()}`,
|
|
321
|
+
{
|
|
322
|
+
'property-basic-editor__type--has-visit-btn':
|
|
323
|
+
typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE,
|
|
324
|
+
},
|
|
325
|
+
)}
|
|
326
|
+
>
|
|
327
|
+
{typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE && (
|
|
328
|
+
<div className="property-basic-editor__type__abbr">
|
|
329
|
+
{getElementIcon(editorStore, paramType)}
|
|
330
|
+
</div>
|
|
331
|
+
)}
|
|
332
|
+
<div className="property-basic-editor__type__label">
|
|
333
|
+
{paramType.name}
|
|
334
|
+
</div>
|
|
335
|
+
{typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE && (
|
|
336
|
+
<button
|
|
337
|
+
data-testid={LEGEND_STUDIO_TEST_ID.TYPE_VISIT}
|
|
338
|
+
className="property-basic-editor__type__visit-btn"
|
|
339
|
+
onClick={openElement}
|
|
340
|
+
tabIndex={-1}
|
|
341
|
+
title={'Visit element'}
|
|
342
|
+
>
|
|
343
|
+
<ArrowCircleRightIcon />
|
|
344
|
+
</button>
|
|
345
|
+
)}
|
|
263
346
|
</div>
|
|
264
347
|
)}
|
|
265
|
-
<div className="property-basic-
|
|
266
|
-
|
|
348
|
+
<div className="property-basic-editor__multiplicity">
|
|
349
|
+
<input
|
|
350
|
+
className="property-basic-editor__multiplicity-bound"
|
|
351
|
+
disabled={isReadOnly}
|
|
352
|
+
spellCheck={false}
|
|
353
|
+
value={lowerBound}
|
|
354
|
+
onChange={changeLowerBound}
|
|
355
|
+
/>
|
|
356
|
+
<div className="property-basic-editor__multiplicity__range">
|
|
357
|
+
..
|
|
358
|
+
</div>
|
|
359
|
+
<input
|
|
360
|
+
className="property-basic-editor__multiplicity-bound"
|
|
361
|
+
disabled={isReadOnly}
|
|
362
|
+
spellCheck={false}
|
|
363
|
+
value={upperBound}
|
|
364
|
+
onChange={changeUpperBound}
|
|
365
|
+
/>
|
|
267
366
|
</div>
|
|
268
|
-
{
|
|
367
|
+
{!isReadOnly && (
|
|
269
368
|
<button
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
onClick={
|
|
369
|
+
className="uml-element-editor__remove-btn"
|
|
370
|
+
disabled={isReadOnly}
|
|
371
|
+
onClick={deleteParameter}
|
|
273
372
|
tabIndex={-1}
|
|
274
|
-
title={'
|
|
373
|
+
title={'Remove'}
|
|
275
374
|
>
|
|
276
|
-
<
|
|
375
|
+
<TimesIcon />
|
|
277
376
|
</button>
|
|
278
377
|
)}
|
|
279
378
|
</div>
|
|
280
|
-
|
|
281
|
-
<div className="property-basic-editor__multiplicity">
|
|
282
|
-
<input
|
|
283
|
-
className="property-basic-editor__multiplicity-bound"
|
|
284
|
-
disabled={isReadOnly}
|
|
285
|
-
spellCheck={false}
|
|
286
|
-
value={lowerBound}
|
|
287
|
-
onChange={changeLowerBound}
|
|
288
|
-
/>
|
|
289
|
-
<div className="property-basic-editor__multiplicity__range">..</div>
|
|
290
|
-
<input
|
|
291
|
-
className="property-basic-editor__multiplicity-bound"
|
|
292
|
-
disabled={isReadOnly}
|
|
293
|
-
spellCheck={false}
|
|
294
|
-
value={upperBound}
|
|
295
|
-
onChange={changeUpperBound}
|
|
296
|
-
/>
|
|
297
|
-
</div>
|
|
298
|
-
{!isReadOnly && (
|
|
299
|
-
<button
|
|
300
|
-
className="uml-element-editor__remove-btn"
|
|
301
|
-
disabled={isReadOnly}
|
|
302
|
-
onClick={deleteParameter}
|
|
303
|
-
tabIndex={-1}
|
|
304
|
-
title={'Remove'}
|
|
305
|
-
>
|
|
306
|
-
<TimesIcon />
|
|
307
|
-
</button>
|
|
308
|
-
)}
|
|
379
|
+
</PanelEntryDropZonePlaceholder>
|
|
309
380
|
</div>
|
|
310
381
|
);
|
|
311
382
|
},
|
|
@@ -381,6 +452,7 @@ const ReturnTypeEditor = observer(
|
|
|
381
452
|
setUpperBound(event.target.value);
|
|
382
453
|
updateMultiplicity(lowerBound, event.target.value);
|
|
383
454
|
};
|
|
455
|
+
|
|
384
456
|
return (
|
|
385
457
|
<div className="function-editor__return__type-editor">
|
|
386
458
|
{!isReadOnly && isEditingType && (
|
|
@@ -528,40 +600,23 @@ export const FunctionMainEditor = observer(
|
|
|
528
600
|
},
|
|
529
601
|
[functionElement, isReadOnly],
|
|
530
602
|
);
|
|
531
|
-
const [{ isParameterDragOver }, dropParameterRef] = useDrop
|
|
603
|
+
const [{ isParameterDragOver }, dropParameterRef] = useDrop<
|
|
604
|
+
ElementDragSource,
|
|
605
|
+
void,
|
|
606
|
+
{ isParameterDragOver: boolean }
|
|
607
|
+
>(
|
|
532
608
|
() => ({
|
|
533
609
|
accept: [
|
|
534
610
|
CORE_DND_TYPE.PROJECT_EXPLORER_CLASS,
|
|
535
611
|
CORE_DND_TYPE.PROJECT_EXPLORER_ENUMERATION,
|
|
536
612
|
],
|
|
537
|
-
drop: (item
|
|
538
|
-
collect: (monitor)
|
|
613
|
+
drop: (item) => handleDropParameter(item),
|
|
614
|
+
collect: (monitor) => ({
|
|
539
615
|
isParameterDragOver: monitor.isOver({ shallow: true }),
|
|
540
616
|
}),
|
|
541
617
|
}),
|
|
542
618
|
[handleDropParameter],
|
|
543
619
|
);
|
|
544
|
-
const handleDropReturnType = useCallback(
|
|
545
|
-
(item: UMLEditorElementDropTarget): void => {
|
|
546
|
-
if (!isReadOnly && item.data.packageableElement instanceof Type) {
|
|
547
|
-
function_setReturnType(functionElement, item.data.packageableElement);
|
|
548
|
-
}
|
|
549
|
-
},
|
|
550
|
-
[functionElement, isReadOnly],
|
|
551
|
-
);
|
|
552
|
-
const [{ isReturnTypeDragOver }, dropReturnTypeRef] = useDrop(
|
|
553
|
-
() => ({
|
|
554
|
-
accept: [
|
|
555
|
-
CORE_DND_TYPE.PROJECT_EXPLORER_CLASS,
|
|
556
|
-
CORE_DND_TYPE.PROJECT_EXPLORER_ENUMERATION,
|
|
557
|
-
],
|
|
558
|
-
drop: (item: ElementDragSource): void => handleDropReturnType(item),
|
|
559
|
-
collect: (monitor): { isReturnTypeDragOver: boolean } => ({
|
|
560
|
-
isReturnTypeDragOver: monitor.isOver({ shallow: true }),
|
|
561
|
-
}),
|
|
562
|
-
}),
|
|
563
|
-
[handleDropReturnType],
|
|
564
|
-
);
|
|
565
620
|
|
|
566
621
|
return (
|
|
567
622
|
<div className="panel__content function-editor__element">
|
|
@@ -580,6 +635,12 @@ export const FunctionMainEditor = observer(
|
|
|
580
635
|
<PlusIcon />
|
|
581
636
|
</button>
|
|
582
637
|
</div>
|
|
638
|
+
<DragPreviewLayer
|
|
639
|
+
labelGetter={(item: FunctionParameterDragSource): string =>
|
|
640
|
+
item.parameter.name === '' ? '(unknown)' : item.parameter.name
|
|
641
|
+
}
|
|
642
|
+
types={[FUNCTION_PARAMETER_DND_TYPE]}
|
|
643
|
+
/>
|
|
583
644
|
<div
|
|
584
645
|
ref={dropParameterRef}
|
|
585
646
|
className={clsx('function-editor__element__item__content', {
|
|
@@ -591,6 +652,7 @@ export const FunctionMainEditor = observer(
|
|
|
591
652
|
<ParameterBasicEditor
|
|
592
653
|
key={param._UUID}
|
|
593
654
|
parameter={param}
|
|
655
|
+
_func={functionElement}
|
|
594
656
|
deleteParameter={deleteParameter(param)}
|
|
595
657
|
isReadOnly={isReadOnly}
|
|
596
658
|
/>
|
|
@@ -602,13 +664,7 @@ export const FunctionMainEditor = observer(
|
|
|
602
664
|
<div className="function-editor__element__item__header__title">
|
|
603
665
|
LAMBDA
|
|
604
666
|
</div>
|
|
605
|
-
<div
|
|
606
|
-
ref={dropReturnTypeRef}
|
|
607
|
-
className={clsx('function-editor__element__item__content', {
|
|
608
|
-
'panel__content__lists--dnd-over':
|
|
609
|
-
isReturnTypeDragOver && !isReadOnly,
|
|
610
|
-
})}
|
|
611
|
-
>
|
|
667
|
+
<div className="">
|
|
612
668
|
<ReturnTypeEditor
|
|
613
669
|
functionElement={functionElement}
|
|
614
670
|
isReadOnly={isReadOnly}
|
|
@@ -685,11 +741,15 @@ export const FunctionEditor = observer(() => {
|
|
|
685
741
|
},
|
|
686
742
|
[functionElement, isReadOnly],
|
|
687
743
|
);
|
|
688
|
-
const [{ isTaggedValueDragOver }, dropTaggedValueRef] = useDrop
|
|
744
|
+
const [{ isTaggedValueDragOver }, dropTaggedValueRef] = useDrop<
|
|
745
|
+
ElementDragSource,
|
|
746
|
+
void,
|
|
747
|
+
{ isTaggedValueDragOver: boolean }
|
|
748
|
+
>(
|
|
689
749
|
() => ({
|
|
690
750
|
accept: [CORE_DND_TYPE.PROJECT_EXPLORER_PROFILE],
|
|
691
|
-
drop: (item
|
|
692
|
-
collect: (monitor)
|
|
751
|
+
drop: (item) => handleDropTaggedValue(item),
|
|
752
|
+
collect: (monitor) => ({
|
|
693
753
|
isTaggedValueDragOver: monitor.isOver({ shallow: true }),
|
|
694
754
|
}),
|
|
695
755
|
}),
|
|
@@ -708,11 +768,15 @@ export const FunctionEditor = observer(() => {
|
|
|
708
768
|
},
|
|
709
769
|
[functionElement, isReadOnly],
|
|
710
770
|
);
|
|
711
|
-
const [{ isStereotypeDragOver }, dropStereotypeRef] = useDrop
|
|
771
|
+
const [{ isStereotypeDragOver }, dropStereotypeRef] = useDrop<
|
|
772
|
+
ElementDragSource,
|
|
773
|
+
void,
|
|
774
|
+
{ isStereotypeDragOver: boolean }
|
|
775
|
+
>(
|
|
712
776
|
() => ({
|
|
713
777
|
accept: [CORE_DND_TYPE.PROJECT_EXPLORER_PROFILE],
|
|
714
|
-
drop: (item
|
|
715
|
-
collect: (monitor)
|
|
778
|
+
drop: (item) => handleDropStereotype(item),
|
|
779
|
+
collect: (monitor) => ({
|
|
716
780
|
isStereotypeDragOver: monitor.isOver({ shallow: true }),
|
|
717
781
|
}),
|
|
718
782
|
}),
|
|
@@ -802,8 +866,10 @@ export const FunctionEditor = observer(() => {
|
|
|
802
866
|
isTaggedValueDragOver && !isReadOnly,
|
|
803
867
|
})}
|
|
804
868
|
>
|
|
869
|
+
<TaggedValueDragPreviewLayer />
|
|
805
870
|
{functionElement.taggedValues.map((taggedValue) => (
|
|
806
871
|
<TaggedValueEditor
|
|
872
|
+
annotatedElement={functionElement}
|
|
807
873
|
key={taggedValue._UUID}
|
|
808
874
|
taggedValue={taggedValue}
|
|
809
875
|
deleteValue={_deleteTaggedValue(taggedValue)}
|
|
@@ -820,9 +886,11 @@ export const FunctionEditor = observer(() => {
|
|
|
820
886
|
isStereotypeDragOver && !isReadOnly,
|
|
821
887
|
})}
|
|
822
888
|
>
|
|
889
|
+
<StereotypeDragPreviewLayer />
|
|
823
890
|
{functionElement.stereotypes.map((stereotype) => (
|
|
824
891
|
<StereotypeSelector
|
|
825
892
|
key={stereotype.value._UUID}
|
|
893
|
+
annotatedElement={functionElement}
|
|
826
894
|
stereotype={stereotype}
|
|
827
895
|
deleteStereotype={_deleteStereotype(stereotype)}
|
|
828
896
|
isReadOnly={isReadOnly}
|