@finos/legend-application-studio 13.0.1 → 13.1.0

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 (189) hide show
  1. package/lib/components/editor/command/project-search.css +1 -1
  2. package/lib/components/editor/command/project-search.css.map +1 -1
  3. package/lib/components/editor/command-center/ProjectSearchCommand.d.ts.map +1 -1
  4. package/lib/components/editor/command-center/ProjectSearchCommand.js +11 -3
  5. package/lib/components/editor/command-center/ProjectSearchCommand.js.map +1 -1
  6. package/lib/components/editor/edit-panel/FunctionEditor.d.ts.map +1 -1
  7. package/lib/components/editor/edit-panel/FunctionEditor.js +41 -34
  8. package/lib/components/editor/edit-panel/FunctionEditor.js.map +1 -1
  9. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.d.ts.map +1 -1
  10. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js +35 -54
  11. package/lib/components/editor/edit-panel/GenerationSpecificationEditor.js.map +1 -1
  12. package/lib/components/editor/edit-panel/GrammarTextEditor.d.ts.map +1 -1
  13. package/lib/components/editor/edit-panel/GrammarTextEditor.js +2 -2
  14. package/lib/components/editor/edit-panel/GrammarTextEditor.js.map +1 -1
  15. package/lib/components/editor/edit-panel/RuntimeEditor.d.ts.map +1 -1
  16. package/lib/components/editor/edit-panel/RuntimeEditor.js +11 -20
  17. package/lib/components/editor/edit-panel/RuntimeEditor.js.map +1 -1
  18. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.d.ts.map +1 -1
  19. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js +4 -8
  20. package/lib/components/editor/edit-panel/data-editor/DataElementEditor.js.map +1 -1
  21. package/lib/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.js +1 -1
  22. package/lib/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.js.map +1 -1
  23. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.d.ts.map +1 -1
  24. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js +3 -7
  25. package/lib/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.js.map +1 -1
  26. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.d.ts.map +1 -1
  27. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.js +2 -2
  28. package/lib/components/editor/edit-panel/external-format-editor/BindingElementEditor.js.map +1 -1
  29. package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js +1 -1
  30. package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js.map +1 -1
  31. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.d.ts.map +1 -1
  32. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js +2 -9
  33. package/lib/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.js.map +1 -1
  34. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.d.ts.map +1 -1
  35. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.js +3 -4
  36. package/lib/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.js.map +1 -1
  37. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.d.ts.map +1 -1
  38. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js +3 -10
  39. package/lib/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.js.map +1 -1
  40. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.d.ts.map +1 -1
  41. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js +4 -10
  42. package/lib/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.js.map +1 -1
  43. package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js +7 -9
  44. package/lib/components/editor/edit-panel/mapping-editor/MappingExplorer.js.map +1 -1
  45. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.d.ts.map +1 -1
  46. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js +9 -12
  47. package/lib/components/editor/edit-panel/mapping-editor/MappingTestEditor.js.map +1 -1
  48. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.d.ts.map +1 -1
  49. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.js +12 -10
  50. package/lib/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.js.map +1 -1
  51. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js +2 -2
  52. package/lib/components/editor/edit-panel/mapping-editor/NewMappingElementModal.js.map +1 -1
  53. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.d.ts.map +1 -1
  54. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js +5 -7
  55. package/lib/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.js.map +1 -1
  56. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.d.ts.map +1 -1
  57. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.js +3 -4
  58. package/lib/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.js.map +1 -1
  59. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.d.ts.map +1 -1
  60. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.js +1 -1
  61. package/lib/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.js.map +1 -1
  62. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
  63. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +3 -5
  64. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
  65. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.d.ts.map +1 -1
  66. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js +9 -6
  67. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.js.map +1 -1
  68. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +1 -1
  69. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
  70. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
  71. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +4 -8
  72. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
  73. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.d.ts.map +1 -1
  74. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js +157 -57
  75. package/lib/components/editor/edit-panel/uml-editor/ClassEditor.js.map +1 -1
  76. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.d.ts.map +1 -1
  77. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js +39 -21
  78. package/lib/components/editor/edit-panel/uml-editor/EnumerationEditor.js.map +1 -1
  79. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.d.ts.map +1 -1
  80. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js +62 -9
  81. package/lib/components/editor/edit-panel/uml-editor/ProfileEditor.js.map +1 -1
  82. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.d.ts.map +1 -1
  83. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.js +4 -8
  84. package/lib/components/editor/edit-panel/uml-editor/PropertyEditor.js.map +1 -1
  85. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts +7 -1
  86. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.d.ts.map +1 -1
  87. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js +33 -5
  88. package/lib/components/editor/edit-panel/uml-editor/StereotypeSelector.js.map +1 -1
  89. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts +7 -1
  90. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.d.ts.map +1 -1
  91. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js +35 -7
  92. package/lib/components/editor/edit-panel/uml-editor/TaggedValueEditor.js.map +1 -1
  93. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  94. package/lib/components/editor/side-bar/CreateNewElementModal.js +4 -4
  95. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  96. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  97. package/lib/components/editor/side-bar/Explorer.js +8 -15
  98. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  99. package/lib/components/shared/StudioLambdaEditor.d.ts +1 -0
  100. package/lib/components/shared/StudioLambdaEditor.d.ts.map +1 -1
  101. package/lib/components/shared/StudioLambdaEditor.js +2 -2
  102. package/lib/components/shared/StudioLambdaEditor.js.map +1 -1
  103. package/lib/components/workspace-setup/WorkspaceSetup.js +1 -1
  104. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  105. package/lib/index.css +2 -2
  106. package/lib/index.css.map +1 -1
  107. package/lib/package.json +5 -5
  108. package/lib/stores/EditorStore.d.ts.map +1 -1
  109. package/lib/stores/EditorStore.js +7 -7
  110. package/lib/stores/EditorStore.js.map +1 -1
  111. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  112. package/lib/stores/editor/NewElementState.js +8 -2
  113. package/lib/stores/editor/NewElementState.js.map +1 -1
  114. package/lib/stores/editor-state/GenerationSpecificationEditorState.d.ts +0 -2
  115. package/lib/stores/editor-state/GenerationSpecificationEditorState.d.ts.map +1 -1
  116. package/lib/stores/editor-state/GenerationSpecificationEditorState.js +1 -8
  117. package/lib/stores/editor-state/GenerationSpecificationEditorState.js.map +1 -1
  118. package/lib/stores/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
  119. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js +2 -4
  120. package/lib/stores/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
  121. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js +1 -1
  122. package/lib/stores/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
  123. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js +1 -1
  124. package/lib/stores/editor-state/element-editor-state/mapping/MappingExecutionState.js.map +1 -1
  125. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.d.ts +4 -1
  126. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.d.ts.map +1 -1
  127. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js +31 -15
  128. package/lib/stores/editor-state/element-editor-state/mapping/MappingTestState.js.map +1 -1
  129. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts +6 -3
  130. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
  131. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +30 -17
  132. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  133. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.js +1 -1
  134. package/lib/stores/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  135. package/lib/stores/graphModifier/DomainGraphModifierHelper.d.ts +10 -0
  136. package/lib/stores/graphModifier/DomainGraphModifierHelper.d.ts.map +1 -1
  137. package/lib/stores/graphModifier/DomainGraphModifierHelper.js +31 -1
  138. package/lib/stores/graphModifier/DomainGraphModifierHelper.js.map +1 -1
  139. package/lib/stores/shared/DnDUtil.d.ts +1 -2
  140. package/lib/stores/shared/DnDUtil.d.ts.map +1 -1
  141. package/lib/stores/shared/DnDUtil.js +0 -2
  142. package/lib/stores/shared/DnDUtil.js.map +1 -1
  143. package/package.json +13 -13
  144. package/src/components/editor/command-center/ProjectSearchCommand.tsx +13 -2
  145. package/src/components/editor/edit-panel/FunctionEditor.tsx +220 -152
  146. package/src/components/editor/edit-panel/GenerationSpecificationEditor.tsx +154 -184
  147. package/src/components/editor/edit-panel/GrammarTextEditor.tsx +4 -5
  148. package/src/components/editor/edit-panel/RuntimeEditor.tsx +89 -90
  149. package/src/components/editor/edit-panel/data-editor/DataElementEditor.tsx +57 -40
  150. package/src/components/editor/edit-panel/data-editor/RelationalCSVDataEditor.tsx +1 -1
  151. package/src/components/editor/edit-panel/element-generation-editor/FileGenerationEditor.tsx +50 -45
  152. package/src/components/editor/edit-panel/external-format-editor/BindingElementEditor.tsx +36 -32
  153. package/src/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.tsx +1 -1
  154. package/src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx +46 -41
  155. package/src/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.tsx +9 -7
  156. package/src/components/editor/edit-panel/mapping-editor/InstanceSetImplementationEditor.tsx +18 -21
  157. package/src/components/editor/edit-panel/mapping-editor/MappingExecutionBuilder.tsx +39 -29
  158. package/src/components/editor/edit-panel/mapping-editor/MappingExplorer.tsx +39 -39
  159. package/src/components/editor/edit-panel/mapping-editor/MappingTestEditor.tsx +82 -58
  160. package/src/components/editor/edit-panel/mapping-editor/MappingTestsExplorer.tsx +66 -50
  161. package/src/components/editor/edit-panel/mapping-editor/NewMappingElementModal.tsx +2 -2
  162. package/src/components/editor/edit-panel/mapping-editor/OperationSetImplementationEditor.tsx +48 -45
  163. package/src/components/editor/edit-panel/mapping-editor/PurePropertyMappingEditor.tsx +12 -8
  164. package/src/components/editor/edit-panel/mapping-editor/relational/RelationalPropertyMappingEditor.tsx +2 -3
  165. package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +75 -72
  166. package/src/components/editor/edit-panel/service-editor/ServiceExecutionQueryEditor.tsx +63 -43
  167. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +1 -1
  168. package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +55 -38
  169. package/src/components/editor/edit-panel/uml-editor/ClassEditor.tsx +813 -499
  170. package/src/components/editor/edit-panel/uml-editor/EnumerationEditor.tsx +209 -113
  171. package/src/components/editor/edit-panel/uml-editor/ProfileEditor.tsx +184 -52
  172. package/src/components/editor/edit-panel/uml-editor/PropertyEditor.tsx +62 -39
  173. package/src/components/editor/edit-panel/uml-editor/StereotypeSelector.tsx +137 -52
  174. package/src/components/editor/edit-panel/uml-editor/TaggedValueEditor.tsx +171 -88
  175. package/src/components/editor/side-bar/CreateNewElementModal.tsx +4 -2
  176. package/src/components/editor/side-bar/Explorer.tsx +13 -20
  177. package/src/components/shared/StudioLambdaEditor.tsx +3 -0
  178. package/src/components/workspace-setup/WorkspaceSetup.tsx +1 -1
  179. package/src/stores/EditorStore.ts +7 -6
  180. package/src/stores/editor/NewElementState.ts +8 -2
  181. package/src/stores/editor-state/GenerationSpecificationEditorState.ts +1 -15
  182. package/src/stores/editor-state/element-editor-state/ElementEditorState.ts +2 -3
  183. package/src/stores/editor-state/element-editor-state/mapping/MappingEditorState.ts +1 -1
  184. package/src/stores/editor-state/element-editor-state/mapping/MappingExecutionState.ts +1 -1
  185. package/src/stores/editor-state/element-editor-state/mapping/MappingTestState.ts +46 -29
  186. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +39 -20
  187. package/src/stores/editor-state/element-editor-state/service/ServiceRegistrationState.ts +1 -1
  188. package/src/stores/graphModifier/DomainGraphModifierHelper.ts +92 -0
  189. 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}