@openmrs/esm-form-engine-lib 3.0.0-pre.1616 → 3.0.0-pre.1621
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/package.json +2 -2
- package/src/components/inputs/content-switcher/content-switcher.component.tsx +6 -1
- package/src/components/inputs/multi-select/multi-select.component.tsx +4 -4
- package/src/components/inputs/radio/radio.component.tsx +1 -1
- package/src/components/inputs/select/dropdown.component.tsx +2 -2
- package/src/components/inputs/workspace-launcher/workspace-launcher.component.tsx +3 -1
- package/src/components/value/value.component.tsx +4 -1
- package/translations/en.json +3 -3
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@openmrs/esm-form-engine-lib",
|
3
|
-
"version": "3.0.0-pre.
|
3
|
+
"version": "3.0.0-pre.1621",
|
4
4
|
"description": "React Form Engine for O3",
|
5
5
|
"browser": "dist/openmrs-esm-form-engine-lib.js",
|
6
6
|
"main": "src/index.ts",
|
@@ -74,7 +74,7 @@
|
|
74
74
|
"fork-ts-checker-webpack-plugin": "^6.5.3",
|
75
75
|
"husky": "^8.0.3",
|
76
76
|
"i18next": "^23.11.4",
|
77
|
-
"i18next-parser": "^
|
77
|
+
"i18next-parser": "^9.0.2",
|
78
78
|
"identity-obj-proxy": "^3.0.0",
|
79
79
|
"jest": "^29.7.0",
|
80
80
|
"jest-cli": "^29.7.0",
|
@@ -60,7 +60,12 @@ const ContentSwitcher: React.FC<FormFieldInputProps> = ({ field, value, errors,
|
|
60
60
|
className={styles.selectedOption}
|
61
61
|
size="md">
|
62
62
|
{field.questionOptions.answers.map((option, index) => (
|
63
|
-
<Switch
|
63
|
+
<Switch
|
64
|
+
name={option.concept || option.value}
|
65
|
+
text={t(option.label)}
|
66
|
+
key={index}
|
67
|
+
disabled={field.isDisabled}
|
68
|
+
/>
|
64
69
|
))}
|
65
70
|
</CdsContentSwitcher>
|
66
71
|
</FormGroup>
|
@@ -22,7 +22,7 @@ const MultiSelect: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
|
|
22
22
|
.map((answer, index) => ({
|
23
23
|
id: `${field.id}-${answer.concept}`,
|
24
24
|
concept: answer.concept,
|
25
|
-
label: answer.label,
|
25
|
+
label: t(answer.label),
|
26
26
|
key: index,
|
27
27
|
disabled: answer.disable?.isDisabled,
|
28
28
|
readonly: isTrue(field.readonly),
|
@@ -97,14 +97,14 @@ const MultiSelect: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
|
|
97
97
|
<Layer>
|
98
98
|
{isSearchable ? (
|
99
99
|
<FilterableMultiSelect
|
100
|
+
id={field.id}
|
101
|
+
key={field.id}
|
100
102
|
placeholder={t('search', 'Search') + '...'}
|
101
103
|
onChange={handleSelectItemsChange}
|
102
|
-
id={t(field.label)}
|
103
104
|
items={selectOptions}
|
104
105
|
initialSelectedItems={initiallySelectedQuestionItems}
|
105
106
|
label={''}
|
106
107
|
titleText={label}
|
107
|
-
key={field.id}
|
108
108
|
itemToString={(item) => (item ? item.label : ' ')}
|
109
109
|
disabled={field.isDisabled}
|
110
110
|
invalid={errors.length > 0}
|
@@ -120,7 +120,7 @@ const MultiSelect: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
|
|
120
120
|
<Checkbox
|
121
121
|
key={`${field.id}-${value.concept}`}
|
122
122
|
className={styles.checkbox}
|
123
|
-
labelText={value.label}
|
123
|
+
labelText={t(value.label)}
|
124
124
|
id={`${field.id}-${value.concept}`}
|
125
125
|
onChange={() => {
|
126
126
|
handleSelectCheckbox(value);
|
@@ -50,7 +50,7 @@ const Radio: React.FC<FormFieldInputProps> = ({ field, value, errors, warnings,
|
|
50
50
|
return (
|
51
51
|
<RadioButton
|
52
52
|
id={`${field.id}-${answer.label}`}
|
53
|
-
labelText={answer.label ?? ''}
|
53
|
+
labelText={t(answer.label) ?? ''}
|
54
54
|
value={answer.concept}
|
55
55
|
key={index}
|
56
56
|
onClick={(e) => {
|
@@ -27,9 +27,9 @@ const Dropdown: React.FC<FormFieldInputProps> = ({ field, value, errors, warning
|
|
27
27
|
let answer = field.questionOptions.answers.find((opt) => {
|
28
28
|
return opt.value ? opt.value == item : opt.concept == item;
|
29
29
|
});
|
30
|
-
return answer
|
30
|
+
return answer ? t(answer.label) : '';
|
31
31
|
},
|
32
|
-
[field.questionOptions.answers],
|
32
|
+
[field.questionOptions.answers, t],
|
33
33
|
);
|
34
34
|
|
35
35
|
const items = useMemo(() => {
|
@@ -28,7 +28,9 @@ const WorkspaceLauncher: React.FC<FormFieldInputProps> = ({ field }) => {
|
|
28
28
|
<div>
|
29
29
|
<div className={styles.label}>{t(field.label)}</div>
|
30
30
|
<div className={styles.workspaceButton}>
|
31
|
-
<Button disabled={isTrue(field.readonly)}
|
31
|
+
<Button disabled={isTrue(field.readonly)} onClick={handleLaunchWorkspace}>
|
32
|
+
{t(field.questionOptions?.buttonLabel) ?? t('launchWorkspace', 'Launch Workspace')}
|
33
|
+
</Button>
|
32
34
|
</div>
|
33
35
|
</div>
|
34
36
|
)
|
@@ -1,10 +1,13 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import styles from './value.scss';
|
3
|
+
import { useTranslation } from 'react-i18next';
|
3
4
|
|
4
5
|
export const ValueEmpty = () => {
|
6
|
+
const { t } = useTranslation();
|
7
|
+
|
5
8
|
return (
|
6
9
|
<div>
|
7
|
-
<span className={styles.empty}>(Blank)</span>
|
10
|
+
<span className={styles.empty}>({t('blank', 'Blank')})</span>
|
8
11
|
</div>
|
9
12
|
);
|
10
13
|
};
|
package/translations/en.json
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
"add": "Add",
|
3
3
|
"addCameraImage": "Add camera image",
|
4
4
|
"addFile": "Add files",
|
5
|
+
"blank": "Blank",
|
5
6
|
"cameraCapture": "Camera capture",
|
6
7
|
"cancel": "Cancel",
|
7
8
|
"chooseAnOption": "Choose an option",
|
@@ -17,7 +18,7 @@
|
|
17
18
|
"fileUploadDescriptionAny": "Upload any file type",
|
18
19
|
"invalidWorkspaceName": "Invalid workspace name.",
|
19
20
|
"invalidWorkspaceNameSubtitle": "Please provide a valid workspace name.",
|
20
|
-
"launchWorkspace": "",
|
21
|
+
"launchWorkspace": "Launch Workspace",
|
21
22
|
"loading": "Loading",
|
22
23
|
"notification": "Notification",
|
23
24
|
"nullMandatoryField": "Please fill the required fields",
|
@@ -26,13 +27,12 @@
|
|
26
27
|
"remove": "Remove",
|
27
28
|
"required": "Required",
|
28
29
|
"reuseValue": "Reuse value",
|
29
|
-
"revert": "Revert",
|
30
30
|
"save": "Save",
|
31
31
|
"search": "Search",
|
32
|
+
"searching": "Searching",
|
32
33
|
"submitting": "Submitting",
|
33
34
|
"time": "Time",
|
34
35
|
"unspecified": "Unspecified",
|
35
|
-
"unspecifyAll": "Unspecify All",
|
36
36
|
"upload": "Upload",
|
37
37
|
"uploadedPhoto": "Uploaded photo",
|
38
38
|
"uploadImage": "Upload image",
|