@openmrs/esm-form-builder-app 2.0.2-pre.559 → 2.0.2-pre.568

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.
@@ -45,7 +45,7 @@ const EditableValue: React.FC<EditableValueProps> = ({
45
45
  <Button
46
46
  kind="ghost"
47
47
  size="sm"
48
- enterDelayMs={200}
48
+ enterDelayMs={300}
49
49
  iconDescription={t("editButton", "Edit {elementType}", {
50
50
  elementType: elementType,
51
51
  })}
@@ -1,10 +1,5 @@
1
1
  import React, { useCallback, useState } from "react";
2
2
  import { useTranslation } from "react-i18next";
3
- import { Accordion, AccordionItem, Button, InlineLoading } from "@carbon/react";
4
- import { Add, TrashCan } from "@carbon/react/icons";
5
- import { useParams } from "react-router-dom";
6
- import { showToast, showNotification } from "@openmrs/esm-framework";
7
- import { OHRIFormSchema } from "@openmrs/openmrs-form-engine-lib";
8
3
  import {
9
4
  DndContext,
10
5
  KeyboardSensor,
@@ -12,6 +7,11 @@ import {
12
7
  useSensor,
13
8
  useSensors,
14
9
  } from "@dnd-kit/core";
10
+ import { Accordion, AccordionItem, Button, InlineLoading } from "@carbon/react";
11
+ import { Add, TrashCan } from "@carbon/react/icons";
12
+ import { useParams } from "react-router-dom";
13
+ import { showToast, showNotification } from "@openmrs/esm-framework";
14
+ import { OHRIFormSchema } from "@openmrs/openmrs-form-engine-lib";
15
15
 
16
16
  import type { Question, RouteParams, Schema } from "../../types";
17
17
  import AddQuestionModal from "./add-question-modal.component";
@@ -279,19 +279,6 @@ const InteractiveBuilder: React.FC<InteractiveBuilderProps> = ({
279
279
  setShowDeleteQuestionModal(true);
280
280
  };
281
281
 
282
- const draggable = (question: Question, section, questionIndex) => (
283
- <DraggableQuestion
284
- key={question.id}
285
- question={question}
286
- pageIndex={pageIndex}
287
- sectionIndex={sectionIndex}
288
- questionIndex={questionIndex}
289
- duplicateQuestion={duplicateQuestion}
290
- handleEditButtonClick={handleEditButtonClick}
291
- handleDeleteButtonClick={handleDeleteButtonClick}
292
- allQuestions={section.questions}
293
- />
294
- );
295
282
  return (
296
283
  <div className={styles.container}>
297
284
  {isLoading ? (
@@ -456,6 +443,7 @@ const InteractiveBuilder: React.FC<InteractiveBuilderProps> = ({
456
443
  </Button>
457
444
  </div>
458
445
  )}
446
+
459
447
  <DndContext onDragEnd={(event) => handleDragEnd(event)} sensors={sensors}>
460
448
  {schema?.pages?.length
461
449
  ? schema.pages.map((page, pageIndex) => (
@@ -471,7 +459,7 @@ const InteractiveBuilder: React.FC<InteractiveBuilderProps> = ({
471
459
  </div>
472
460
  <Button
473
461
  hasIconOnly
474
- enterDelayMs={200}
462
+ enterDelayMs={300}
475
463
  iconDescription={t("deletePage", "Delete page")}
476
464
  kind="ghost"
477
465
  onClick={() => {
@@ -511,7 +499,7 @@ const InteractiveBuilder: React.FC<InteractiveBuilderProps> = ({
511
499
  </div>
512
500
  <Button
513
501
  hasIconOnly
514
- enterDelayMs={200}
502
+ enterDelayMs={300}
515
503
  iconDescription={t(
516
504
  "deleteSection",
517
505
  "Delete section"
@@ -532,17 +520,27 @@ const InteractiveBuilder: React.FC<InteractiveBuilderProps> = ({
532
520
  {section.questions?.length ? (
533
521
  section.questions.map(
534
522
  (question, questionIndex) => (
535
- <>
536
- <Droppable
537
- id={`droppable-question-${pageIndex}-${sectionIndex}-${questionIndex}`}
538
- >
539
- {draggable(
540
- question,
541
- section,
542
- questionIndex
543
- )}
544
- </Droppable>
545
- </>
523
+ <Droppable
524
+ id={`droppable-question-${pageIndex}-${sectionIndex}-${questionIndex}`}
525
+ >
526
+ <DraggableQuestion
527
+ key={question.id}
528
+ question={question}
529
+ pageIndex={pageIndex}
530
+ sectionIndex={sectionIndex}
531
+ questionIndex={questionIndex}
532
+ handleDuplicateQuestion={
533
+ duplicateQuestion
534
+ }
535
+ handleEditButtonClick={
536
+ handleEditButtonClick
537
+ }
538
+ handleDeleteButtonClick={
539
+ handleDeleteButtonClick
540
+ }
541
+ questionCount={section.questions.length}
542
+ />
543
+ </Droppable>
546
544
  )
547
545
  )
548
546
  ) : (