@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.
Files changed (177) hide show
  1. package/lib/components/LegendStudioApplication.js +1 -1
  2. package/lib/components/LegendStudioApplication.js.map +1 -1
  3. package/lib/components/editor/command/project-search.css +1 -1
  4. package/lib/components/editor/command/project-search.css.map +1 -1
  5. package/lib/components/editor/command-center/ProjectSearchCommand.d.ts.map +1 -1
  6. package/lib/components/editor/command-center/ProjectSearchCommand.js +11 -3
  7. package/lib/components/editor/command-center/ProjectSearchCommand.js.map +1 -1
  8. package/lib/components/editor/edit-panel/FunctionEditor.d.ts.map +1 -1
  9. package/lib/components/editor/edit-panel/FunctionEditor.js +41 -34
  10. package/lib/components/editor/edit-panel/FunctionEditor.js.map +1 -1
  11. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.d.ts.map +1 -1
  12. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js +35 -54
  13. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js.map +1 -1
  14. package/lib/components/editor/edit-panel/GrammarTextEditor.d.ts.map +1 -1
  15. package/lib/components/editor/edit-panel/GrammarTextEditor.js +2 -2
  16. package/lib/components/editor/edit-panel/GrammarTextEditor.js.map +1 -1
  17. package/lib/components/editor/edit-panel/RuntimeEditor.d.ts.map +1 -1
  18. package/lib/components/editor/edit-panel/RuntimeEditor.js +11 -20
  19. package/lib/components/editor/edit-panel/RuntimeEditor.js.map +1 -1
  20. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.d.ts.map +1 -1
  21. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js +4 -8
  22. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js.map +1 -1
  23. package/lib/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.js +1 -1
  24. package/lib/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.js.map +1 -1
  25. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.d.ts.map +1 -1
  26. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js +3 -7
  27. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js.map +1 -1
  28. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.d.ts.map +1 -1
  29. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.js +2 -2
  30. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.js.map +1 -1
  31. package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js +1 -1
  32. package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js.map +1 -1
  33. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.d.ts.map +1 -1
  34. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js +2 -9
  35. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js.map +1 -1
  36. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.d.ts.map +1 -1
  37. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.js +3 -4
  38. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.js.map +1 -1
  39. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.d.ts.map +1 -1
  40. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js +3 -10
  41. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  42. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
  43. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js +4 -10
  44. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js.map +1 -1
  45. package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js +7 -9
  46. package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js.map +1 -1
  47. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.d.ts.map +1 -1
  48. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js +3 -6
  49. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js.map +1 -1
  50. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.d.ts.map +1 -1
  51. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.js +7 -8
  52. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.js.map +1 -1
  53. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +2 -2
  54. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
  55. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.d.ts.map +1 -1
  56. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js +5 -7
  57. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js.map +1 -1
  58. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.d.ts.map +1 -1
  59. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.js +3 -4
  60. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.js.map +1 -1
  61. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.d.ts.map +1 -1
  62. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.js +1 -1
  63. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.js.map +1 -1
  64. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
  65. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +3 -5
  66. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
  67. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +1 -1
  68. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
  69. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
  70. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +4 -8
  71. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
  72. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.d.ts.map +1 -1
  73. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +157 -57
  74. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
  75. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.d.ts.map +1 -1
  76. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js +39 -21
  77. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js.map +1 -1
  78. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.d.ts.map +1 -1
  79. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js +62 -9
  80. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js.map +1 -1
  81. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.d.ts.map +1 -1
  82. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.js +4 -8
  83. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.js.map +1 -1
  84. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts +7 -1
  85. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts.map +1 -1
  86. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js +33 -5
  87. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js.map +1 -1
  88. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts +7 -1
  89. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts.map +1 -1
  90. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js +35 -7
  91. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js.map +1 -1
  92. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  93. package/lib/components/editor/side-bar/CreateNewElementModal.js +4 -4
  94. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  95. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  96. package/lib/components/editor/side-bar/Explorer.js +8 -15
  97. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  98. package/lib/components/shared/StudioLambdaEditor.d.ts +1 -0
  99. package/lib/components/shared/StudioLambdaEditor.d.ts.map +1 -1
  100. package/lib/components/shared/StudioLambdaEditor.js +2 -2
  101. package/lib/components/shared/StudioLambdaEditor.js.map +1 -1
  102. package/lib/index.css +2 -2
  103. package/lib/index.css.map +1 -1
  104. package/lib/package.json +5 -5
  105. package/lib/stores/EditorStore.d.ts.map +1 -1
  106. package/lib/stores/EditorStore.js +7 -7
  107. package/lib/stores/EditorStore.js.map +1 -1
  108. package/lib/stores/LegendStudioBaseStore.d.ts +3 -8
  109. package/lib/stores/LegendStudioBaseStore.d.ts.map +1 -1
  110. package/lib/stores/LegendStudioBaseStore.js +9 -105
  111. package/lib/stores/LegendStudioBaseStore.js.map +1 -1
  112. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  113. package/lib/stores/editor/NewElementState.js +8 -2
  114. package/lib/stores/editor/NewElementState.js.map +1 -1
  115. package/lib/stores/editor-state/GenerationSpecificationEditorState.d.ts +0 -2
  116. package/lib/stores/editor-state/GenerationSpecificationEditorState.d.ts.map +1 -1
  117. package/lib/stores/editor-state/GenerationSpecificationEditorState.js +1 -8
  118. package/lib/stores/editor-state/GenerationSpecificationEditorState.js.map +1 -1
  119. package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
  120. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js +2 -4
  121. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
  122. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js +1 -1
  123. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
  124. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js +1 -1
  125. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  126. package/lib/stores/graphModifier/DomainGraphModifierHelper.d.ts +10 -0
  127. package/lib/stores/graphModifier/DomainGraphModifierHelper.d.ts.map +1 -1
  128. package/lib/stores/graphModifier/DomainGraphModifierHelper.js +31 -1
  129. package/lib/stores/graphModifier/DomainGraphModifierHelper.js.map +1 -1
  130. package/lib/stores/shared/DnDUtil.d.ts +1 -2
  131. package/lib/stores/shared/DnDUtil.d.ts.map +1 -1
  132. package/lib/stores/shared/DnDUtil.js +0 -2
  133. package/lib/stores/shared/DnDUtil.js.map +1 -1
  134. package/package.json +13 -13
  135. package/src/components/LegendStudioApplication.tsx +2 -2
  136. package/src/components/editor/command-center/ProjectSearchCommand.tsx +13 -2
  137. package/src/components/editor/edit-panel/FunctionEditor.tsx +220 -152
  138. package/src/components/editor/edit-panel/GenerationSpecificationEditor.tsx +154 -184
  139. package/src/components/editor/edit-panel/GrammarTextEditor.tsx +4 -5
  140. package/src/components/editor/edit-panel/RuntimeEditor.tsx +89 -90
  141. package/src/components/editor/edit-panel/data-editor/DataElementEditor.tsx +57 -40
  142. package/src/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.tsx +1 -1
  143. package/src/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.tsx +50 -45
  144. package/src/components/editor/edit-panel/external-format-editor/BindingElementEditor.tsx +36 -32
  145. package/src/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.tsx +1 -1
  146. package/src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx +46 -41
  147. package/src/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.tsx +9 -7
  148. package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.tsx +18 -21
  149. package/src/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.tsx +39 -29
  150. package/src/components/editor/edit-panel/mapping-editor/MappingExplorer.tsx +39 -39
  151. package/src/components/editor/edit-panel/mapping-editor/MappingTestEditor.tsx +23 -15
  152. package/src/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.tsx +40 -38
  153. package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +2 -2
  154. package/src/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.tsx +48 -45
  155. package/src/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.tsx +12 -8
  156. package/src/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.tsx +2 -3
  157. package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +75 -72
  158. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +1 -1
  159. package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +55 -38
  160. package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +813 -499
  161. package/src/components/editor/edit-panel/uml-editor/EnumerationEditor.tsx +209 -113
  162. package/src/components/editor/edit-panel/uml-editor/ProfileEditor.tsx +184 -52
  163. package/src/components/editor/edit-panel/uml-editor/PropertyEditor.tsx +62 -39
  164. package/src/components/editor/edit-panel/uml-editor/StereotypeSelector.tsx +137 -52
  165. package/src/components/editor/edit-panel/uml-editor/TaggedValueEditor.tsx +171 -88
  166. package/src/components/editor/side-bar/CreateNewElementModal.tsx +4 -2
  167. package/src/components/editor/side-bar/Explorer.tsx +13 -20
  168. package/src/components/shared/StudioLambdaEditor.tsx +3 -0
  169. package/src/stores/EditorStore.ts +7 -6
  170. package/src/stores/LegendStudioBaseStore.ts +20 -147
  171. package/src/stores/editor/NewElementState.ts +8 -2
  172. package/src/stores/editor-state/GenerationSpecificationEditorState.ts +1 -15
  173. package/src/stores/editor-state/element-editor-state/ElementEditorState.ts +2 -3
  174. package/src/stores/editor-state/element-editor-state/mapping/MappingEditorState.ts +1 -1
  175. package/src/stores/editor-state/element-editor-state/mapping/MappingExecutionState.ts +1 -1
  176. package/src/stores/graphModifier/DomainGraphModifierHelper.ts +92 -0
  177. 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 { StereotypeSelector } from './uml-editor/StereotypeSelector.js';
44
- import { TaggedValueEditor } from './uml-editor/TaggedValueEditor.js';
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 { parameter, deleteParameter, isReadOnly } = props;
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-editor">
187
- {isReadOnly && (
188
- <div className="property-basic-editor__lock">
189
- <LockIcon />
190
- </div>
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
- <div className="property-basic-editor__type__label">
228
- {paramType.name}
229
- </div>
230
- <div
231
- className="property-basic-editor__type__label property-basic-editor__type__label--hover"
232
- onClick={(): void => setIsEditingType(true)}
233
- >
234
- Click to edit
235
- </div>
236
- {typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE && (
237
- <button
238
- data-testid={LEGEND_STUDIO_TEST_ID.TYPE_VISIT}
239
- className="property-basic-editor__type__visit-btn"
240
- onClick={openElement}
241
- tabIndex={-1}
242
- title={'Visit element'}
243
- >
244
- <ArrowCircleRightIcon />
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
- </div>
248
- )}
249
- {isReadOnly && (
250
- <div
251
- className={clsx(
252
- 'property-basic-editor__type',
253
- `background--${typeName.toLowerCase()}`,
254
- {
255
- 'property-basic-editor__type--has-visit-btn':
256
- typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE,
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
- {typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE && (
261
- <div className="property-basic-editor__type__abbr">
262
- {getElementIcon(editorStore, paramType)}
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-editor__type__label">
266
- {paramType.name}
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
- {typeName !== FUNCTION_PARAMETER_TYPE.PRIMITIVE && (
367
+ {!isReadOnly && (
269
368
  <button
270
- data-testid={LEGEND_STUDIO_TEST_ID.TYPE_VISIT}
271
- className="property-basic-editor__type__visit-btn"
272
- onClick={openElement}
369
+ className="uml-element-editor__remove-btn"
370
+ disabled={isReadOnly}
371
+ onClick={deleteParameter}
273
372
  tabIndex={-1}
274
- title={'Visit element'}
373
+ title={'Remove'}
275
374
  >
276
- <ArrowCircleRightIcon />
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: ElementDragSource): void => handleDropParameter(item),
538
- collect: (monitor): { isParameterDragOver: boolean } => ({
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: ElementDragSource): void => handleDropTaggedValue(item),
692
- collect: (monitor): { isTaggedValueDragOver: boolean } => ({
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: ElementDragSource): void => handleDropStereotype(item),
715
- collect: (monitor): { isStereotypeDragOver: boolean } => ({
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}