@openmrs/esm-form-builder-app 2.6.1-pre.1105 → 2.6.1-pre.1111

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.
@@ -242,7 +242,7 @@ const InteractiveBuilder: React.FC<InteractiveBuilderProps> = ({
242
242
  );
243
243
 
244
244
  const handleDragEnd = (event: DragEndEvent) => {
245
- const { active, delta } = event;
245
+ const { active, over } = event;
246
246
 
247
247
  if (active) {
248
248
  // Get the source information
@@ -251,11 +251,15 @@ const InteractiveBuilder: React.FC<InteractiveBuilderProps> = ({
251
251
  const sourceSectionIndex = parseInt(activeIdParts[2]);
252
252
  const sourceQuestionIndex = parseInt(activeIdParts[3]);
253
253
 
254
+ // Get the destination information
255
+ const destination = over.id.toString().split('-');
256
+ const destinationQuestionIndex = parseInt(destination[4]);
257
+
254
258
  // Move the question within the same section
255
259
  const questions = schema.pages[sourcePageIndex].sections[sourceSectionIndex].questions;
256
260
  const questionToMove = questions[sourceQuestionIndex];
257
261
  questions.splice(sourceQuestionIndex, 1);
258
- questions.splice(sourceQuestionIndex + delta.y, 0, questionToMove);
262
+ questions.splice(destinationQuestionIndex, 0, questionToMove);
259
263
 
260
264
  const updatedSchema = {
261
265
  ...schema,