@openmrs/esm-form-builder-app 2.0.2-pre.574 → 2.0.2-pre.586
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/README.md +43 -17
- package/dist/127.js +1 -1
- package/dist/127.js.map +1 -1
- package/dist/150.js +1 -1
- package/dist/150.js.map +1 -1
- package/dist/153.js +1 -1
- package/dist/153.js.map +1 -1
- package/dist/164.js +1 -1
- package/dist/256.js +1 -1
- package/dist/319.js +1 -1
- package/dist/447.js +1 -1
- package/dist/447.js.map +1 -1
- package/dist/515.js +2 -0
- package/dist/{773.js.LICENSE.txt → 515.js.LICENSE.txt} +9 -0
- package/dist/515.js.map +1 -0
- package/dist/527.js +1 -0
- package/dist/527.js.map +1 -0
- package/dist/574.js +1 -1
- package/dist/757.js +1 -1
- package/dist/788.js +1 -1
- package/dist/800.js +1 -1
- package/dist/800.js.map +1 -1
- package/dist/807.js +1 -1
- package/dist/833.js +1 -1
- package/dist/878.js +2 -0
- package/dist/{208.js.LICENSE.txt → 878.js.LICENSE.txt} +2 -1
- package/dist/878.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-form-builder-app.js +1 -1
- package/dist/openmrs-esm-form-builder-app.js.buildmanifest.json +154 -175
- package/dist/openmrs-esm-form-builder-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +35 -32
- package/src/components/action-buttons/action-buttons.component.tsx +65 -101
- package/src/components/dashboard/dashboard.component.tsx +98 -174
- package/src/components/dashboard/dashboard.test.tsx +51 -81
- package/src/components/empty-state/empty-data-illustration.component.tsx +4 -16
- package/src/components/empty-state/empty-state.component.tsx +11 -15
- package/src/components/error-state/error-state.component.tsx +11 -13
- package/src/components/form-editor/form-editor.component.tsx +97 -128
- package/src/components/form-renderer/form-renderer.component.tsx +30 -41
- package/src/components/interactive-builder/add-question-modal.component.tsx +129 -167
- package/src/components/interactive-builder/delete-page-modal.component.tsx +24 -37
- package/src/components/interactive-builder/delete-question-modal.component.tsx +25 -47
- package/src/components/interactive-builder/delete-section-modal.component.tsx +24 -37
- package/src/components/interactive-builder/draggable-question.component.tsx +21 -34
- package/src/components/interactive-builder/droppable-container.component.tsx +5 -5
- package/src/components/interactive-builder/edit-question-modal.component.tsx +191 -233
- package/src/components/interactive-builder/editable-value.component.tsx +12 -17
- package/src/components/interactive-builder/interactive-builder.component.tsx +134 -184
- package/src/components/interactive-builder/new-form-modal.component.tsx +35 -49
- package/src/components/interactive-builder/page-modal.component.tsx +29 -45
- package/src/components/interactive-builder/question-modal.scss +7 -0
- package/src/components/interactive-builder/section-modal.component.tsx +29 -40
- package/src/components/interactive-builder/value-editor.component.tsx +11 -16
- package/src/components/modals/save-form-modal.component.tsx +112 -165
- package/src/components/pagination/index.ts +2 -2
- package/src/components/pagination/pagination.component.tsx +8 -13
- package/src/components/pagination/usePaginationInfo.ts +4 -9
- package/src/components/schema-editor/schema-editor.component.tsx +11 -17
- package/src/config-schema.ts +28 -30
- package/src/declarations.d.ts +4 -3
- package/src/form-builder-admin-card-link.component.tsx +7 -11
- package/src/forms.resource.ts +66 -87
- package/src/hooks/useClobdata.ts +10 -12
- package/src/hooks/useConceptLookup.ts +5 -8
- package/src/hooks/useConceptName.ts +6 -9
- package/src/hooks/useEncounterTypes.ts +8 -8
- package/src/hooks/useForm.ts +7 -7
- package/src/hooks/useForms.ts +5 -8
- package/src/index.ts +11 -23
- package/src/root.component.tsx +4 -4
- package/src/setup-tests.ts +1 -9
- package/src/test-helpers.tsx +8 -15
- package/src/types.ts +16 -8
- package/dist/208.js +0 -2
- package/dist/208.js.map +0 -1
- package/dist/536.js +0 -1
- package/dist/536.js.map +0 -1
- package/dist/62.js +0 -1
- package/dist/62.js.map +0 -1
- package/dist/773.js +0 -2
- package/dist/773.js.map +0 -1
- package/src/constants.ts +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { useTranslation } from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
5
|
ComposedModal,
|
|
@@ -10,26 +10,21 @@ import {
|
|
|
10
10
|
ModalHeader,
|
|
11
11
|
Stack,
|
|
12
12
|
TextInput,
|
|
13
|
-
} from
|
|
14
|
-
import { showToast, showNotification } from
|
|
15
|
-
import type { Schema } from
|
|
13
|
+
} from '@carbon/react';
|
|
14
|
+
import { showToast, showNotification } from '@openmrs/esm-framework';
|
|
15
|
+
import type { Schema } from '../../types';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
interface NewFormModalProps {
|
|
18
18
|
schema: Schema;
|
|
19
19
|
onSchemaChange: (schema: Schema) => void;
|
|
20
20
|
onModalChange: (showModal: boolean) => void;
|
|
21
21
|
showModal: boolean;
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
23
|
|
|
24
|
-
const NewFormModal: React.FC<NewFormModalProps> = ({
|
|
25
|
-
schema,
|
|
26
|
-
onSchemaChange,
|
|
27
|
-
showModal,
|
|
28
|
-
onModalChange,
|
|
29
|
-
}) => {
|
|
24
|
+
const NewFormModal: React.FC<NewFormModalProps> = ({ schema, onSchemaChange, showModal, onModalChange }) => {
|
|
30
25
|
const { t } = useTranslation();
|
|
31
|
-
const [formName, setFormName] = useState(
|
|
32
|
-
const [formDescription, setFormDescription] = useState(
|
|
26
|
+
const [formName, setFormName] = useState('');
|
|
27
|
+
const [formDescription, setFormDescription] = useState('');
|
|
33
28
|
|
|
34
29
|
const updateSchema = (updates: Partial<Schema>) => {
|
|
35
30
|
try {
|
|
@@ -37,18 +32,20 @@ const NewFormModal: React.FC<NewFormModalProps> = ({
|
|
|
37
32
|
onSchemaChange(updatedSchema);
|
|
38
33
|
|
|
39
34
|
showToast({
|
|
40
|
-
title: t(
|
|
41
|
-
kind:
|
|
35
|
+
title: t('success', 'Success!'),
|
|
36
|
+
kind: 'success',
|
|
42
37
|
critical: true,
|
|
43
|
-
description: t(
|
|
38
|
+
description: t('formCreated', 'New form created'),
|
|
44
39
|
});
|
|
45
40
|
} catch (error) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
if (error instanceof Error) {
|
|
42
|
+
showNotification({
|
|
43
|
+
title: t('errorCreatingForm', 'Error creating form'),
|
|
44
|
+
kind: 'error',
|
|
45
|
+
critical: true,
|
|
46
|
+
description: error?.message,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
52
49
|
}
|
|
53
50
|
};
|
|
54
51
|
|
|
@@ -64,41 +61,30 @@ const NewFormModal: React.FC<NewFormModalProps> = ({
|
|
|
64
61
|
};
|
|
65
62
|
|
|
66
63
|
return (
|
|
67
|
-
<ComposedModal
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
preventCloseOnClickOutside
|
|
71
|
-
>
|
|
72
|
-
<ModalHeader title={t("createNewForm", "Create a new form")} />
|
|
73
|
-
<Form onSubmit={(event) => event.preventDefault()}>
|
|
64
|
+
<ComposedModal open={showModal} onClose={() => onModalChange(false)} preventCloseOnClickOutside>
|
|
65
|
+
<ModalHeader title={t('createNewForm', 'Create a new form')} />
|
|
66
|
+
<Form onSubmit={(event: React.SyntheticEvent) => event.preventDefault()}>
|
|
74
67
|
<ModalBody>
|
|
75
68
|
<Stack gap={5}>
|
|
76
|
-
<FormGroup legendText={
|
|
69
|
+
<FormGroup legendText={''}>
|
|
77
70
|
<TextInput
|
|
78
71
|
id="formName"
|
|
79
|
-
labelText={t(
|
|
80
|
-
placeholder={t(
|
|
81
|
-
"formNamePlaceholder",
|
|
82
|
-
"What the form is called in the system"
|
|
83
|
-
)}
|
|
72
|
+
labelText={t('formName', 'Form name')}
|
|
73
|
+
placeholder={t('namePlaceholder', 'What the form is called in the system')}
|
|
84
74
|
value={formName}
|
|
85
|
-
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
|
86
|
-
setFormName(event.target.value)
|
|
87
|
-
}
|
|
75
|
+
onChange={(event: React.ChangeEvent<HTMLInputElement>) => setFormName(event.target.value)}
|
|
88
76
|
/>
|
|
89
77
|
</FormGroup>
|
|
90
|
-
<FormGroup legendText={
|
|
78
|
+
<FormGroup legendText={''}>
|
|
91
79
|
<TextInput
|
|
92
80
|
id="formDescription"
|
|
93
|
-
labelText={t(
|
|
81
|
+
labelText={t('formDescription', 'Form description')}
|
|
94
82
|
placeholder={t(
|
|
95
|
-
|
|
96
|
-
|
|
83
|
+
'formDescriptionPlaceholder',
|
|
84
|
+
'A short description of the form e.g. A form for collecting COVID-19 symptoms',
|
|
97
85
|
)}
|
|
98
86
|
value={formDescription}
|
|
99
|
-
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
|
100
|
-
setFormDescription(event.target.value)
|
|
101
|
-
}
|
|
87
|
+
onChange={(event: React.ChangeEvent<HTMLInputElement>) => setFormDescription(event.target.value)}
|
|
102
88
|
/>
|
|
103
89
|
</FormGroup>
|
|
104
90
|
</Stack>
|
|
@@ -106,10 +92,10 @@ const NewFormModal: React.FC<NewFormModalProps> = ({
|
|
|
106
92
|
</Form>
|
|
107
93
|
<ModalFooter>
|
|
108
94
|
<Button kind="secondary" onClick={() => onModalChange(false)}>
|
|
109
|
-
{t(
|
|
95
|
+
{t('cancel', 'Cancel')}
|
|
110
96
|
</Button>
|
|
111
97
|
<Button disabled={!formName} onClick={handleCreateForm}>
|
|
112
|
-
<span>{t(
|
|
98
|
+
<span>{t('createForm', 'Create Form')}</span>
|
|
113
99
|
</Button>
|
|
114
100
|
</ModalFooter>
|
|
115
101
|
</ComposedModal>
|
|
@@ -1,33 +1,19 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { useTranslation } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Form,
|
|
7
|
-
FormGroup,
|
|
8
|
-
ModalBody,
|
|
9
|
-
ModalFooter,
|
|
10
|
-
ModalHeader,
|
|
11
|
-
TextInput,
|
|
12
|
-
} from "@carbon/react";
|
|
13
|
-
import { showToast, showNotification } from "@openmrs/esm-framework";
|
|
14
|
-
import type { Schema } from "../../types";
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Button, ComposedModal, Form, FormGroup, ModalBody, ModalFooter, ModalHeader, TextInput } from '@carbon/react';
|
|
4
|
+
import { showToast, showNotification } from '@openmrs/esm-framework';
|
|
5
|
+
import type { Schema } from '../../types';
|
|
15
6
|
|
|
16
|
-
|
|
7
|
+
interface PageModalProps {
|
|
17
8
|
schema: Schema;
|
|
18
9
|
onSchemaChange: (schema: Schema) => void;
|
|
19
10
|
showModal: boolean;
|
|
20
11
|
onModalChange: (showModal: boolean) => void;
|
|
21
|
-
}
|
|
12
|
+
}
|
|
22
13
|
|
|
23
|
-
const PageModal: React.FC<PageModalProps> = ({
|
|
24
|
-
schema,
|
|
25
|
-
onSchemaChange,
|
|
26
|
-
showModal,
|
|
27
|
-
onModalChange,
|
|
28
|
-
}) => {
|
|
14
|
+
const PageModal: React.FC<PageModalProps> = ({ schema, onSchemaChange, showModal, onModalChange }) => {
|
|
29
15
|
const { t } = useTranslation();
|
|
30
|
-
const [pageTitle, setPageTitle] = useState(
|
|
16
|
+
const [pageTitle, setPageTitle] = useState('');
|
|
31
17
|
|
|
32
18
|
const handleUpdatePageTitle = () => {
|
|
33
19
|
updatePages();
|
|
@@ -43,49 +29,47 @@ const PageModal: React.FC<PageModalProps> = ({
|
|
|
43
29
|
});
|
|
44
30
|
|
|
45
31
|
onSchemaChange({ ...schema });
|
|
46
|
-
setPageTitle(
|
|
32
|
+
setPageTitle('');
|
|
47
33
|
}
|
|
48
34
|
showToast({
|
|
49
|
-
title: t(
|
|
50
|
-
kind:
|
|
35
|
+
title: t('success', 'Success!'),
|
|
36
|
+
kind: 'success',
|
|
51
37
|
critical: true,
|
|
52
|
-
description: t(
|
|
38
|
+
description: t('pageCreated', 'New page created'),
|
|
53
39
|
});
|
|
54
40
|
} catch (error) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
if (error instanceof Error) {
|
|
42
|
+
showNotification({
|
|
43
|
+
title: t('errorCreatingPage', 'Error creating page'),
|
|
44
|
+
kind: 'error',
|
|
45
|
+
critical: true,
|
|
46
|
+
description: error?.message,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
61
49
|
}
|
|
62
50
|
};
|
|
63
51
|
|
|
64
52
|
return (
|
|
65
|
-
<ComposedModal
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
preventCloseOnClickOutside
|
|
69
|
-
>
|
|
70
|
-
<ModalHeader title={t("createNewPage", "Create a new page")} />
|
|
71
|
-
<Form onSubmit={(event) => event.preventDefault()}>
|
|
53
|
+
<ComposedModal open={showModal} onClose={() => onModalChange(false)} preventCloseOnClickOutside>
|
|
54
|
+
<ModalHeader title={t('createNewPage', 'Create a new page')} />
|
|
55
|
+
<Form onSubmit={(event: React.SyntheticEvent) => event.preventDefault()}>
|
|
72
56
|
<ModalBody>
|
|
73
|
-
<FormGroup legendText={
|
|
57
|
+
<FormGroup legendText={''}>
|
|
74
58
|
<TextInput
|
|
75
59
|
id="pageTitle"
|
|
76
|
-
labelText={t(
|
|
60
|
+
labelText={t('enterPageTitle', 'Enter a title for your new page')}
|
|
77
61
|
value={pageTitle}
|
|
78
|
-
onChange={(event) => setPageTitle(event.target.value)}
|
|
62
|
+
onChange={(event: React.ChangeEvent<HTMLInputElement>) => setPageTitle(event.target.value)}
|
|
79
63
|
/>
|
|
80
64
|
</FormGroup>
|
|
81
65
|
</ModalBody>
|
|
82
66
|
</Form>
|
|
83
67
|
<ModalFooter>
|
|
84
68
|
<Button onClick={() => onModalChange(false)} kind="secondary">
|
|
85
|
-
{t(
|
|
69
|
+
{t('cancel', 'Cancel')}
|
|
86
70
|
</Button>
|
|
87
71
|
<Button disabled={!pageTitle} onClick={handleUpdatePageTitle}>
|
|
88
|
-
<span>{t(
|
|
72
|
+
<span>{t('save', 'Save')}</span>
|
|
89
73
|
</Button>
|
|
90
74
|
</ModalFooter>
|
|
91
75
|
</ComposedModal>
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { useTranslation } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Form,
|
|
7
|
-
FormGroup,
|
|
8
|
-
ModalBody,
|
|
9
|
-
ModalFooter,
|
|
10
|
-
ModalHeader,
|
|
11
|
-
TextInput,
|
|
12
|
-
} from "@carbon/react";
|
|
13
|
-
import { showToast, showNotification } from "@openmrs/esm-framework";
|
|
14
|
-
import type { Schema } from "../../types";
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Button, ComposedModal, Form, FormGroup, ModalBody, ModalFooter, ModalHeader, TextInput } from '@carbon/react';
|
|
4
|
+
import { showToast, showNotification } from '@openmrs/esm-framework';
|
|
5
|
+
import type { Schema } from '../../types';
|
|
15
6
|
|
|
16
|
-
|
|
7
|
+
interface SectionModalProps {
|
|
17
8
|
schema: Schema;
|
|
18
9
|
onSchemaChange: (schema: Schema) => void;
|
|
19
10
|
pageIndex: number;
|
|
20
11
|
resetIndices: () => void;
|
|
21
12
|
showModal: boolean;
|
|
22
13
|
onModalChange: (showModal: boolean) => void;
|
|
23
|
-
}
|
|
14
|
+
}
|
|
24
15
|
|
|
25
16
|
const SectionModal: React.FC<SectionModalProps> = ({
|
|
26
17
|
schema,
|
|
@@ -31,7 +22,7 @@ const SectionModal: React.FC<SectionModalProps> = ({
|
|
|
31
22
|
onModalChange,
|
|
32
23
|
}) => {
|
|
33
24
|
const { t } = useTranslation();
|
|
34
|
-
const [sectionTitle, setSectionTitle] = useState(
|
|
25
|
+
const [sectionTitle, setSectionTitle] = useState('');
|
|
35
26
|
|
|
36
27
|
const handleUpdatePageSections = () => {
|
|
37
28
|
updateSections();
|
|
@@ -42,54 +33,52 @@ const SectionModal: React.FC<SectionModalProps> = ({
|
|
|
42
33
|
try {
|
|
43
34
|
schema.pages[pageIndex]?.sections?.push({
|
|
44
35
|
label: sectionTitle,
|
|
45
|
-
isExpanded:
|
|
36
|
+
isExpanded: 'true',
|
|
46
37
|
questions: [],
|
|
47
38
|
});
|
|
48
39
|
onSchemaChange({ ...schema });
|
|
49
|
-
setSectionTitle(
|
|
40
|
+
setSectionTitle('');
|
|
50
41
|
resetIndices();
|
|
51
42
|
|
|
52
43
|
showToast({
|
|
53
|
-
title: t(
|
|
54
|
-
kind:
|
|
44
|
+
title: t('success', 'Success!'),
|
|
45
|
+
kind: 'success',
|
|
55
46
|
critical: true,
|
|
56
|
-
description: t(
|
|
47
|
+
description: t('sectionCreated', 'New section created'),
|
|
57
48
|
});
|
|
58
49
|
} catch (error) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
if (error instanceof Error) {
|
|
51
|
+
showNotification({
|
|
52
|
+
title: t('errorCreatingSection', 'Error creating section'),
|
|
53
|
+
kind: 'error',
|
|
54
|
+
critical: true,
|
|
55
|
+
description: error?.message,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
65
58
|
}
|
|
66
59
|
};
|
|
67
60
|
|
|
68
61
|
return (
|
|
69
|
-
<ComposedModal
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
preventCloseOnClickOutside
|
|
73
|
-
>
|
|
74
|
-
<ModalHeader title={t("createNewSection", "Create a new section")} />
|
|
75
|
-
<Form onSubmit={(event) => event.preventDefault()}>
|
|
62
|
+
<ComposedModal open={showModal} onClose={() => onModalChange(false)} preventCloseOnClickOutside>
|
|
63
|
+
<ModalHeader title={t('createNewSection', 'Create a new section')} />
|
|
64
|
+
<Form onSubmit={(event: React.SyntheticEvent) => event.preventDefault()}>
|
|
76
65
|
<ModalBody>
|
|
77
|
-
<FormGroup legendText={
|
|
66
|
+
<FormGroup legendText={''}>
|
|
78
67
|
<TextInput
|
|
79
68
|
id="sectionTitle"
|
|
80
|
-
labelText={t(
|
|
69
|
+
labelText={t('enterSectionTitle', 'Enter a section title')}
|
|
81
70
|
value={sectionTitle}
|
|
82
|
-
onChange={(event) => setSectionTitle(event.target.value)}
|
|
71
|
+
onChange={(event: React.ChangeEvent<HTMLInputElement>) => setSectionTitle(event.target.value)}
|
|
83
72
|
/>
|
|
84
73
|
</FormGroup>
|
|
85
74
|
</ModalBody>
|
|
86
75
|
</Form>
|
|
87
76
|
<ModalFooter>
|
|
88
77
|
<Button onClick={() => onModalChange(false)} kind="secondary">
|
|
89
|
-
{t(
|
|
78
|
+
{t('cancel', 'Cancel')}
|
|
90
79
|
</Button>
|
|
91
80
|
<Button disabled={!sectionTitle} onClick={handleUpdatePageSections}>
|
|
92
|
-
<span>{t(
|
|
81
|
+
<span>{t('save', 'Save')}</span>
|
|
93
82
|
</Button>
|
|
94
83
|
</ModalFooter>
|
|
95
84
|
</ComposedModal>
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { useTranslation } from
|
|
3
|
-
import { Button, TextInput } from
|
|
4
|
-
import { Close, Save } from
|
|
5
|
-
import styles from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Button, TextInput } from '@carbon/react';
|
|
4
|
+
import { Close, Save } from '@carbon/react/icons';
|
|
5
|
+
import styles from './value-editor.scss';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface ValueEditorProps {
|
|
8
8
|
id: string;
|
|
9
9
|
handleCancel: () => void;
|
|
10
10
|
handleSave: (value: string) => void;
|
|
11
11
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
12
|
value: string;
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
const ValueEditor: React.FC<ValueEditorProps> = ({
|
|
16
|
-
id,
|
|
17
|
-
handleCancel,
|
|
18
|
-
handleSave,
|
|
19
|
-
value,
|
|
20
|
-
}) => {
|
|
15
|
+
const ValueEditor: React.FC<ValueEditorProps> = ({ id, handleCancel, handleSave, value }) => {
|
|
21
16
|
const { t } = useTranslation();
|
|
22
17
|
const [tmpValue, setTmpValue] = useState(value);
|
|
23
18
|
|
|
@@ -27,7 +22,7 @@ const ValueEditor: React.FC<ValueEditorProps> = ({
|
|
|
27
22
|
id={id}
|
|
28
23
|
labelText=""
|
|
29
24
|
value={tmpValue}
|
|
30
|
-
onChange={(event) => setTmpValue(event.target.value)}
|
|
25
|
+
onChange={(event: React.ChangeEvent<HTMLInputElement>) => setTmpValue(event.target.value)}
|
|
31
26
|
/>
|
|
32
27
|
<div className={styles.actionButtons}>
|
|
33
28
|
<Button
|
|
@@ -36,7 +31,7 @@ const ValueEditor: React.FC<ValueEditorProps> = ({
|
|
|
36
31
|
kind="primary"
|
|
37
32
|
onClick={() => handleSave(tmpValue)}
|
|
38
33
|
>
|
|
39
|
-
{t(
|
|
34
|
+
{t('saveButtonText', 'Save')}
|
|
40
35
|
</Button>
|
|
41
36
|
<Button
|
|
42
37
|
size="md"
|
|
@@ -44,7 +39,7 @@ const ValueEditor: React.FC<ValueEditorProps> = ({
|
|
|
44
39
|
kind="secondary"
|
|
45
40
|
onClick={handleCancel}
|
|
46
41
|
>
|
|
47
|
-
{t(
|
|
42
|
+
{t('cancelButtonText', 'Cancel')}
|
|
48
43
|
</Button>
|
|
49
44
|
</div>
|
|
50
45
|
</>
|