@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.
- package/dist/300.js +1 -1
- package/dist/916.js +1 -1
- package/dist/916.js.map +1 -1
- package/dist/openmrs-esm-form-builder-app.js.buildmanifest.json +8 -8
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/components/interactive-builder/draggable-question.component.tsx +18 -11
- package/src/components/interactive-builder/draggable-question.scss +5 -3
- package/src/components/interactive-builder/droppable-container.scss +2 -2
- package/src/components/interactive-builder/interactive-builder.component.tsx +6 -2
|
@@ -242,7 +242,7 @@ const InteractiveBuilder: React.FC<InteractiveBuilderProps> = ({
|
|
|
242
242
|
);
|
|
243
243
|
|
|
244
244
|
const handleDragEnd = (event: DragEndEvent) => {
|
|
245
|
-
const { active,
|
|
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(
|
|
262
|
+
questions.splice(destinationQuestionIndex, 0, questionToMove);
|
|
259
263
|
|
|
260
264
|
const updatedSchema = {
|
|
261
265
|
...schema,
|