@openmrs/esm-form-builder-app 2.0.2-pre.563 → 2.0.2-pre.570
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/150.js +1 -1
- package/dist/150.js.map +1 -1
- package/dist/153.js +1 -1
- package/dist/252.js +2 -0
- package/dist/252.js.map +1 -0
- package/dist/256.js +1 -1
- package/dist/256.js.map +1 -1
- package/dist/447.js +1 -1
- package/dist/447.js.map +1 -1
- package/dist/879.js +2 -0
- package/dist/879.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/openmrs-esm-form-builder-app.js.buildmanifest.json +198 -198
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/components/dashboard/dashboard.scss +5 -5
- package/src/components/empty-state/empty-state.scss +7 -7
- package/src/components/error-state/error-state.scss +6 -6
- package/src/components/form-editor/form-editor.component.tsx +9 -8
- package/src/components/form-editor/form-editor.scss +3 -3
- package/src/components/form-renderer/form-renderer.scss +3 -3
- package/src/components/interactive-builder/draggable-question.component.tsx +22 -23
- package/src/components/interactive-builder/draggable-question.scss +5 -9
- package/src/components/interactive-builder/edit-question-modal.component.tsx +308 -317
- package/src/components/interactive-builder/editable-value.scss +1 -1
- package/src/components/interactive-builder/interactive-builder.component.tsx +27 -29
- package/src/components/interactive-builder/interactive-builder.scss +3 -3
- package/src/components/interactive-builder/question-modal.scss +2 -2
- package/src/components/pagination/pagination.scss +4 -4
- package/src/components/schema-editor/schema-editor.scss +2 -2
- package/dist/682.js +0 -2
- package/dist/682.js.map +0 -1
- package/dist/990.js +0 -2
- package/dist/990.js.map +0 -1
- /package/dist/{682.js.LICENSE.txt → 252.js.LICENSE.txt} +0 -0
- /package/dist/{990.js.LICENSE.txt → 879.js.LICENSE.txt} +0 -0
|
@@ -2,24 +2,24 @@ import React from "react";
|
|
|
2
2
|
import { useDraggable } from "@dnd-kit/core";
|
|
3
3
|
import { CSS } from "@dnd-kit/utilities";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { Button } from "@carbon/react";
|
|
6
|
-
import {
|
|
5
|
+
import { Button, CopyButton } from "@carbon/react";
|
|
6
|
+
import { Draggable, Edit, TrashCan } from "@carbon/react/icons";
|
|
7
7
|
import type { Question } from "../../types";
|
|
8
8
|
import styles from "./draggable-question.scss";
|
|
9
9
|
|
|
10
10
|
type DraggableQuestionProps = {
|
|
11
|
-
allQuestions: Array<Question>;
|
|
12
11
|
question: Question;
|
|
13
12
|
pageIndex: number;
|
|
14
13
|
sectionIndex: number;
|
|
15
14
|
questionIndex: number;
|
|
16
|
-
|
|
15
|
+
handleDuplicateQuestion: (
|
|
17
16
|
question: Question,
|
|
18
17
|
pageId: number,
|
|
19
18
|
sectionId: number
|
|
20
19
|
) => void;
|
|
21
20
|
handleEditButtonClick: (question: Question) => void;
|
|
22
21
|
handleDeleteButtonClick: (question: Question) => void;
|
|
22
|
+
questionCount: number;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export const DraggableQuestion: React.FC<DraggableQuestionProps> = ({
|
|
@@ -27,10 +27,10 @@ export const DraggableQuestion: React.FC<DraggableQuestionProps> = ({
|
|
|
27
27
|
pageIndex,
|
|
28
28
|
sectionIndex,
|
|
29
29
|
questionIndex,
|
|
30
|
-
|
|
30
|
+
handleDuplicateQuestion,
|
|
31
31
|
handleDeleteButtonClick,
|
|
32
32
|
handleEditButtonClick,
|
|
33
|
-
|
|
33
|
+
questionCount,
|
|
34
34
|
}) => {
|
|
35
35
|
const { t } = useTranslation();
|
|
36
36
|
const draggableId = `question-${pageIndex}-${sectionIndex}-${questionIndex}`;
|
|
@@ -38,8 +38,9 @@ export const DraggableQuestion: React.FC<DraggableQuestionProps> = ({
|
|
|
38
38
|
const { attributes, listeners, transform, isDragging, setNodeRef } =
|
|
39
39
|
useDraggable({
|
|
40
40
|
id: draggableId,
|
|
41
|
-
disabled:
|
|
41
|
+
disabled: questionCount <= 1,
|
|
42
42
|
});
|
|
43
|
+
|
|
43
44
|
const style = {
|
|
44
45
|
transform: CSS.Translate.toString(transform),
|
|
45
46
|
};
|
|
@@ -60,40 +61,38 @@ export const DraggableQuestion: React.FC<DraggableQuestionProps> = ({
|
|
|
60
61
|
<p className={styles.questionLabel}>{question.label}</p>
|
|
61
62
|
</div>
|
|
62
63
|
<div className={styles.buttonsContainer}>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
<CopyButton
|
|
65
|
+
align="top"
|
|
66
|
+
className="cds--btn--sm"
|
|
67
|
+
feedback={t("duplicated", "Duplicated") + "!"}
|
|
67
68
|
iconDescription={t("duplicateQuestion", "Duplicate question")}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
renderIcon={(props) => <Replicate size={16} {...props} />}
|
|
74
|
-
hasIconOnly
|
|
69
|
+
kind="ghost"
|
|
70
|
+
onClick={() =>
|
|
71
|
+
!isDragging &&
|
|
72
|
+
handleDuplicateQuestion(question, pageIndex, sectionIndex)
|
|
73
|
+
}
|
|
75
74
|
/>
|
|
76
75
|
<Button
|
|
77
|
-
kind="ghost"
|
|
78
|
-
size="sm"
|
|
79
76
|
enterDelayMs={300}
|
|
77
|
+
hasIconOnly
|
|
80
78
|
iconDescription={t("editQuestion", "Edit question")}
|
|
79
|
+
kind="ghost"
|
|
81
80
|
onClick={() => {
|
|
82
81
|
if (!isDragging) {
|
|
83
82
|
handleEditButtonClick(question);
|
|
84
83
|
}
|
|
85
84
|
}}
|
|
86
85
|
renderIcon={(props) => <Edit size={16} {...props} />}
|
|
87
|
-
|
|
86
|
+
size="md"
|
|
88
87
|
/>
|
|
89
88
|
<Button
|
|
90
|
-
hasIconOnly
|
|
91
89
|
enterDelayMs={300}
|
|
90
|
+
hasIconOnly
|
|
92
91
|
iconDescription={t("deleteQuestion", "Delete question")}
|
|
93
92
|
kind="ghost"
|
|
94
93
|
onClick={handleDeleteButtonClick}
|
|
95
94
|
renderIcon={(props) => <TrashCan size={16} {...props} />}
|
|
96
|
-
size="
|
|
95
|
+
size="md"
|
|
97
96
|
/>
|
|
98
97
|
</div>
|
|
99
98
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@use '@carbon/
|
|
2
|
-
@use '@carbon/
|
|
3
|
-
@use
|
|
1
|
+
@use '@carbon/colors';
|
|
2
|
+
@use '@carbon/layout';
|
|
3
|
+
@use "@carbon/type";
|
|
4
4
|
|
|
5
5
|
.buttonsContainer {
|
|
6
6
|
display: flex;
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
width: 100%;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.normal:hover {
|
|
28
|
-
background-color: colors.$gray-70;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
27
|
.isDragged {
|
|
32
28
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
33
29
|
background-color: rgba(255, 255, 255, 0.552);
|
|
@@ -42,10 +38,10 @@
|
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
.dragIcon {
|
|
45
|
-
margin: 0
|
|
41
|
+
margin: 0 layout.$spacing-03;
|
|
46
42
|
padding: 0.25rem;
|
|
47
43
|
color: colors.$gray-50;
|
|
48
|
-
margin-top: 0.
|
|
44
|
+
margin-top: 0.25rem;
|
|
49
45
|
width: 1.5rem;
|
|
50
46
|
height: 1.5rem;
|
|
51
47
|
border-radius: 0.25rem;
|