@aehrc/smart-forms-renderer 0.17.0 → 0.19.0
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/lib/components/FormComponents/BooleanItem/BooleanField.d.ts +7 -3
- package/lib/components/FormComponents/BooleanItem/BooleanField.js +26 -4
- package/lib/components/FormComponents/BooleanItem/BooleanField.js.map +1 -1
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js +19 -10
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.d.ts +0 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +5 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.d.ts +0 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.d.ts +2 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +4 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.d.ts +0 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +5 -6
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +0 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +4 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.d.ts +0 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +0 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +4 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.d.ts +0 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItem.d.ts +2 -1
- package/lib/components/FormComponents/GroupItem/GroupItem.js +3 -3
- package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.d.ts +2 -1
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +4 -4
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.d.ts +0 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +6 -4
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.d.ts +0 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +2 -4
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.d.ts +0 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +4 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.d.ts +0 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.d.ts +2 -2
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js +8 -2
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.d.ts +1 -0
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js +2 -2
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js.map +1 -1
- package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +2 -2
- package/lib/components/FormComponents/SingleItem/SingleItem.js +11 -6
- package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
- package/lib/hooks/useHidden.d.ts +1 -1
- package/lib/hooks/useHidden.js +3 -2
- package/lib/hooks/useHidden.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/interfaces/enableWhen.interface.d.ts +20 -5
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/interfaces/index.js +2 -0
- package/lib/interfaces/index.js.map +1 -0
- package/lib/interfaces/questionnaireStore.interface.d.ts +2 -2
- package/lib/interfaces/renderProps.interface.d.ts +4 -0
- package/lib/stores/questionnaireStore.d.ts +5 -3
- package/lib/stores/questionnaireStore.js +12 -5
- package/lib/stores/questionnaireStore.js.map +1 -1
- package/lib/utils/choice.d.ts +1 -1
- package/lib/utils/choice.js +1 -1
- package/lib/utils/choice.js.map +1 -1
- package/lib/utils/enableWhen.d.ts +11 -4
- package/lib/utils/enableWhen.js +130 -53
- package/lib/utils/enableWhen.js.map +1 -1
- package/lib/utils/enableWhenExpression.d.ts +1 -1
- package/lib/utils/enableWhenExpression.js +26 -7
- package/lib/utils/enableWhenExpression.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/misc.d.ts +5 -0
- package/lib/utils/misc.js +116 -0
- package/lib/utils/misc.js.map +1 -0
- package/lib/utils/qItem.d.ts +2 -1
- package/lib/utils/qItem.js +19 -7
- package/lib/utils/qItem.js.map +1 -1
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +1 -1
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
- package/lib/utils/questionnaireStoreUtils/extractOtherExtensions.d.ts +13 -3
- package/lib/utils/questionnaireStoreUtils/extractOtherExtensions.js +81 -18
- package/lib/utils/questionnaireStoreUtils/extractOtherExtensions.js.map +1 -1
- package/lib/utils/tabs.d.ts +1 -1
- package/lib/utils/tabs.js +5 -3
- package/lib/utils/tabs.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FormComponents/BooleanItem/BooleanField.tsx +53 -17
- package/src/components/FormComponents/BooleanItem/BooleanItem.tsx +47 -13
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +4 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +0 -5
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +6 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +2 -5
- package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +1 -6
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +4 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +1 -5
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +4 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +1 -5
- package/src/components/FormComponents/GroupItem/GroupItem.tsx +8 -2
- package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +10 -2
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +3 -2
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +0 -5
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +0 -5
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +3 -2
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +1 -4
- package/src/components/FormComponents/RepeatGroup/RepeatGroup.tsx +13 -2
- package/src/components/FormComponents/RepeatGroup/RepeatGroupItem.tsx +4 -0
- package/src/components/FormComponents/SingleItem/SingleItem.tsx +19 -6
- package/src/hooks/useHidden.ts +3 -2
- package/src/index.ts +1 -0
- package/src/interfaces/enableWhen.interface.ts +24 -5
- package/src/interfaces/index.ts +8 -0
- package/src/interfaces/questionnaireStore.interface.ts +2 -2
- package/src/interfaces/renderProps.interface.ts +4 -0
- package/src/stores/questionnaireStore.ts +45 -8
- package/src/utils/choice.ts +4 -2
- package/src/utils/enableWhen.ts +194 -55
- package/src/utils/enableWhenExpression.ts +35 -8
- package/src/utils/index.ts +5 -0
- package/src/utils/misc.ts +160 -0
- package/src/utils/qItem.ts +31 -8
- package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +1 -1
- package/src/utils/questionnaireStoreUtils/extractOtherExtensions.ts +122 -25
- package/src/utils/tabs.ts +7 -4
|
@@ -47,31 +47,58 @@ function BooleanItem(props: BooleanItemProps) {
|
|
|
47
47
|
|
|
48
48
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
let checked = false;
|
|
52
|
-
if (qrItem?.answer && qrItem.answer[0].valueBoolean) {
|
|
53
|
-
checked = qrItem.answer[0].valueBoolean;
|
|
54
|
-
}
|
|
50
|
+
const valueBoolean = qrItem?.answer && qrItem.answer[0].valueBoolean;
|
|
55
51
|
|
|
56
52
|
// Event handlers
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
function handleValueChange(newValue: string) {
|
|
54
|
+
switch (newValue) {
|
|
55
|
+
case 'true':
|
|
56
|
+
onQrItemChange({
|
|
57
|
+
...createEmptyQrItem(qItem),
|
|
58
|
+
answer: [{ valueBoolean: true }]
|
|
59
|
+
});
|
|
60
|
+
break;
|
|
61
|
+
case 'false':
|
|
62
|
+
onQrItemChange({
|
|
63
|
+
...createEmptyQrItem(qItem),
|
|
64
|
+
answer: [{ valueBoolean: false }]
|
|
65
|
+
});
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
onQrItemChange(createEmptyQrItem(qItem));
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function handleClear() {
|
|
74
|
+
onQrItemChange(createEmptyQrItem(qItem));
|
|
62
75
|
}
|
|
63
76
|
|
|
64
77
|
if (isTabled) {
|
|
65
78
|
return (
|
|
66
79
|
<Box display="flex" justifyContent="center">
|
|
67
|
-
<BooleanField
|
|
80
|
+
<BooleanField
|
|
81
|
+
qItem={qItem}
|
|
82
|
+
readOnly={readOnly}
|
|
83
|
+
isTabled={isTabled}
|
|
84
|
+
valueBoolean={valueBoolean}
|
|
85
|
+
onCheckedChange={handleValueChange}
|
|
86
|
+
onClear={handleClear}
|
|
87
|
+
/>
|
|
68
88
|
</Box>
|
|
69
89
|
);
|
|
70
90
|
}
|
|
71
91
|
|
|
72
92
|
if (isRepeated) {
|
|
73
93
|
return (
|
|
74
|
-
<BooleanField
|
|
94
|
+
<BooleanField
|
|
95
|
+
qItem={qItem}
|
|
96
|
+
readOnly={readOnly}
|
|
97
|
+
isTabled={isTabled}
|
|
98
|
+
valueBoolean={valueBoolean}
|
|
99
|
+
onCheckedChange={handleValueChange}
|
|
100
|
+
onClear={handleClear}
|
|
101
|
+
/>
|
|
75
102
|
);
|
|
76
103
|
}
|
|
77
104
|
return (
|
|
@@ -80,7 +107,14 @@ function BooleanItem(props: BooleanItemProps) {
|
|
|
80
107
|
data-linkid={qItem.linkId}
|
|
81
108
|
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
82
109
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
83
|
-
<BooleanField
|
|
110
|
+
<BooleanField
|
|
111
|
+
qItem={qItem}
|
|
112
|
+
readOnly={readOnly}
|
|
113
|
+
isTabled={isTabled}
|
|
114
|
+
valueBoolean={valueBoolean}
|
|
115
|
+
onCheckedChange={handleValueChange}
|
|
116
|
+
onClear={handleClear}
|
|
117
|
+
/>
|
|
84
118
|
</ItemFieldGrid>
|
|
85
119
|
</FullWidthFormComponentBox>
|
|
86
120
|
);
|
|
@@ -20,17 +20,19 @@ import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
|
20
20
|
import type { QuestionnaireItem, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
21
21
|
import QItemChoiceCheckboxSingle from '../ItemParts/CheckboxSingle';
|
|
22
22
|
import { StyledFormGroup } from '../Item.styles';
|
|
23
|
+
import { getChoiceOrientation } from '../../../utils/choice';
|
|
23
24
|
|
|
24
25
|
interface ChoiceCheckboxAnswerOptionFieldsProps {
|
|
25
26
|
qItem: QuestionnaireItem;
|
|
26
27
|
answers: QuestionnaireResponseItemAnswer[];
|
|
27
|
-
orientation: ChoiceItemOrientation;
|
|
28
28
|
readOnly: boolean;
|
|
29
29
|
onCheckedChange: (newValue: string) => void;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function ChoiceCheckboxAnswerOptionFields(props: ChoiceCheckboxAnswerOptionFieldsProps) {
|
|
33
|
-
const { qItem, answers,
|
|
33
|
+
const { qItem, answers, readOnly, onCheckedChange } = props;
|
|
34
|
+
|
|
35
|
+
const orientation = getChoiceOrientation(qItem) ?? ChoiceItemOrientation.Vertical;
|
|
34
36
|
|
|
35
37
|
return (
|
|
36
38
|
<StyledFormGroup row={orientation === ChoiceItemOrientation.Horizontal}>
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import React from 'react';
|
|
19
|
-
import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
20
19
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
21
20
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
22
21
|
import { updateQrCheckboxAnswers } from '../../../utils/choice';
|
|
@@ -41,14 +40,12 @@ interface ChoiceCheckboxAnswerOptionItemProps
|
|
|
41
40
|
PropsWithParentIsReadOnlyAttribute {
|
|
42
41
|
qItem: QuestionnaireItem;
|
|
43
42
|
qrItem: QuestionnaireResponseItem | null;
|
|
44
|
-
orientation: ChoiceItemOrientation;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
function ChoiceCheckboxAnswerOptionItem(props: ChoiceCheckboxAnswerOptionItemProps) {
|
|
48
46
|
const {
|
|
49
47
|
qItem,
|
|
50
48
|
qrItem,
|
|
51
|
-
orientation,
|
|
52
49
|
isRepeated,
|
|
53
50
|
showMinimalView = false,
|
|
54
51
|
parentIsReadOnly,
|
|
@@ -88,7 +85,6 @@ function ChoiceCheckboxAnswerOptionItem(props: ChoiceCheckboxAnswerOptionItemPro
|
|
|
88
85
|
<ChoiceCheckboxAnswerValueSetFields
|
|
89
86
|
qItem={qItem}
|
|
90
87
|
answers={answers}
|
|
91
|
-
orientation={orientation}
|
|
92
88
|
readOnly={readOnly}
|
|
93
89
|
onCheckedChange={handleCheckedChange}
|
|
94
90
|
/>
|
|
@@ -106,7 +102,6 @@ function ChoiceCheckboxAnswerOptionItem(props: ChoiceCheckboxAnswerOptionItemPro
|
|
|
106
102
|
<ChoiceCheckboxAnswerValueSetFields
|
|
107
103
|
qItem={qItem}
|
|
108
104
|
answers={answers}
|
|
109
|
-
orientation={orientation}
|
|
110
105
|
readOnly={readOnly}
|
|
111
106
|
onCheckedChange={handleCheckedChange}
|
|
112
107
|
/>
|
|
@@ -17,25 +17,28 @@
|
|
|
17
17
|
|
|
18
18
|
import React from 'react';
|
|
19
19
|
import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
20
|
-
import type { Coding, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
20
|
+
import type { Coding, QuestionnaireItem, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
21
21
|
import CheckboxSingle from '../ItemParts/CheckboxSingle';
|
|
22
22
|
import { StyledFormGroup } from '../Item.styles';
|
|
23
23
|
import { StyledAlert } from '../../Alert.styles';
|
|
24
24
|
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
25
25
|
import Typography from '@mui/material/Typography';
|
|
26
26
|
import type { TerminologyError } from '../../../hooks/useValueSetCodings';
|
|
27
|
+
import { getChoiceOrientation } from '../../../utils/choice';
|
|
27
28
|
|
|
28
29
|
interface ChoiceCheckboxAnswerValueSetFieldsProps {
|
|
30
|
+
qItem: QuestionnaireItem;
|
|
29
31
|
codings: Coding[];
|
|
30
32
|
answers: QuestionnaireResponseItemAnswer[];
|
|
31
|
-
orientation: ChoiceItemOrientation;
|
|
32
33
|
readOnly: boolean;
|
|
33
34
|
terminologyError: TerminologyError;
|
|
34
35
|
onCheckedChange: (newValue: string) => void;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
function ChoiceCheckboxAnswerValueSetFields(props: ChoiceCheckboxAnswerValueSetFieldsProps) {
|
|
38
|
-
const { codings, answers,
|
|
39
|
+
const { qItem, codings, answers, readOnly, terminologyError, onCheckedChange } = props;
|
|
40
|
+
|
|
41
|
+
const orientation = getChoiceOrientation(qItem) ?? ChoiceItemOrientation.Vertical;
|
|
39
42
|
|
|
40
43
|
if (codings.length > 0) {
|
|
41
44
|
return (
|
|
@@ -19,7 +19,6 @@ import React from 'react';
|
|
|
19
19
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
20
20
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
21
21
|
import useValueSetCodings from '../../../hooks/useValueSetCodings';
|
|
22
|
-
import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
23
22
|
import { mapCodingsToOptions, updateQrCheckboxAnswers } from '../../../utils/choice';
|
|
24
23
|
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
25
24
|
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
@@ -42,7 +41,6 @@ interface ChoiceCheckboxAnswerValueSetItemProps
|
|
|
42
41
|
PropsWithParentIsReadOnlyAttribute {
|
|
43
42
|
qItem: QuestionnaireItem;
|
|
44
43
|
qrItem: QuestionnaireResponseItem | null;
|
|
45
|
-
orientation: ChoiceItemOrientation;
|
|
46
44
|
showText?: boolean;
|
|
47
45
|
}
|
|
48
46
|
|
|
@@ -50,7 +48,6 @@ function ChoiceCheckboxAnswerValueSetItem(props: ChoiceCheckboxAnswerValueSetIte
|
|
|
50
48
|
const {
|
|
51
49
|
qItem,
|
|
52
50
|
qrItem,
|
|
53
|
-
orientation,
|
|
54
51
|
isRepeated,
|
|
55
52
|
showMinimalView = false,
|
|
56
53
|
parentIsReadOnly,
|
|
@@ -90,9 +87,9 @@ function ChoiceCheckboxAnswerValueSetItem(props: ChoiceCheckboxAnswerValueSetIte
|
|
|
90
87
|
return (
|
|
91
88
|
<>
|
|
92
89
|
<ChoiceCheckboxAnswerValueSetFields
|
|
90
|
+
qItem={qItem}
|
|
93
91
|
codings={codings}
|
|
94
92
|
answers={answers}
|
|
95
|
-
orientation={orientation}
|
|
96
93
|
readOnly={readOnly}
|
|
97
94
|
terminologyError={terminologyError}
|
|
98
95
|
onCheckedChange={handleCheckedChange}
|
|
@@ -109,9 +106,9 @@ function ChoiceCheckboxAnswerValueSetItem(props: ChoiceCheckboxAnswerValueSetIte
|
|
|
109
106
|
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
110
107
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
111
108
|
<ChoiceCheckboxAnswerValueSetFields
|
|
109
|
+
qItem={qItem}
|
|
112
110
|
codings={codings}
|
|
113
111
|
answers={answers}
|
|
114
|
-
orientation={orientation}
|
|
115
112
|
readOnly={readOnly}
|
|
116
113
|
terminologyError={terminologyError}
|
|
117
114
|
onCheckedChange={handleCheckedChange}
|
|
@@ -23,7 +23,7 @@ import ChoiceSelectAnswerOptionItem from './ChoiceSelectAnswerOptionItem';
|
|
|
23
23
|
import ChoiceCheckboxAnswerOptionItem from './ChoiceCheckboxAnswerOptionItem';
|
|
24
24
|
import ChoiceAutocompleteItem from './ChoiceAutocompleteItem';
|
|
25
25
|
import ChoiceSelectAnswerValueSetItem from './ChoiceSelectAnswerValueSetItem';
|
|
26
|
-
import { getChoiceControlType
|
|
26
|
+
import { getChoiceControlType } from '../../../utils/choice';
|
|
27
27
|
import ChoiceRadioAnswerValueSetItem from './ChoiceRadioAnswerValueSetItem';
|
|
28
28
|
import ChoiceCheckboxAnswerValueSetItem from './ChoiceCheckboxAnswerValueSetItem';
|
|
29
29
|
import type {
|
|
@@ -48,7 +48,6 @@ function ChoiceItemSwitcher(props: ChoiceItemSwitcherProps) {
|
|
|
48
48
|
const { qItem, qrItem, isRepeated, isTabled, showMinimalView, parentIsReadOnly, onQrItemChange } =
|
|
49
49
|
props;
|
|
50
50
|
|
|
51
|
-
const orientation = getChoiceOrientation(qItem);
|
|
52
51
|
const choiceControlType = getChoiceControlType(qItem);
|
|
53
52
|
|
|
54
53
|
switch (choiceControlType) {
|
|
@@ -58,7 +57,6 @@ function ChoiceItemSwitcher(props: ChoiceItemSwitcherProps) {
|
|
|
58
57
|
<ChoiceRadioAnswerOptionItem
|
|
59
58
|
qItem={qItem}
|
|
60
59
|
qrItem={qrItem}
|
|
61
|
-
orientation={orientation}
|
|
62
60
|
isRepeated={isRepeated}
|
|
63
61
|
parentIsReadOnly={parentIsReadOnly}
|
|
64
62
|
onQrItemChange={onQrItemChange}
|
|
@@ -69,7 +67,6 @@ function ChoiceItemSwitcher(props: ChoiceItemSwitcherProps) {
|
|
|
69
67
|
<ChoiceRadioAnswerValueSetItem
|
|
70
68
|
qItem={qItem}
|
|
71
69
|
qrItem={qrItem}
|
|
72
|
-
orientation={orientation}
|
|
73
70
|
isRepeated={isRepeated}
|
|
74
71
|
parentIsReadOnly={parentIsReadOnly}
|
|
75
72
|
onQrItemChange={onQrItemChange}
|
|
@@ -82,7 +79,6 @@ function ChoiceItemSwitcher(props: ChoiceItemSwitcherProps) {
|
|
|
82
79
|
<ChoiceCheckboxAnswerOptionItem
|
|
83
80
|
qItem={qItem}
|
|
84
81
|
qrItem={qrItem}
|
|
85
|
-
orientation={orientation}
|
|
86
82
|
isRepeated={qItem.repeats ?? false}
|
|
87
83
|
showMinimalView={showMinimalView}
|
|
88
84
|
parentIsReadOnly={parentIsReadOnly}
|
|
@@ -95,7 +91,6 @@ function ChoiceItemSwitcher(props: ChoiceItemSwitcherProps) {
|
|
|
95
91
|
qItem={qItem}
|
|
96
92
|
qrItem={qrItem}
|
|
97
93
|
isRepeated={qItem.repeats ?? false}
|
|
98
|
-
orientation={orientation}
|
|
99
94
|
showMinimalView={showMinimalView}
|
|
100
95
|
parentIsReadOnly={parentIsReadOnly}
|
|
101
96
|
onQrItemChange={onQrItemChange}
|
|
@@ -20,17 +20,19 @@ import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
|
20
20
|
import type { QuestionnaireItem } from 'fhir/r4';
|
|
21
21
|
import RadioAnswerOptionButtons from '../ItemParts/RadioAnswerOptionButtons';
|
|
22
22
|
import { StyledRadioGroup } from '../Item.styles';
|
|
23
|
+
import { getChoiceOrientation } from '../../../utils/choice';
|
|
23
24
|
|
|
24
25
|
interface ChoiceRadioAnswerOptionFieldsProps {
|
|
25
26
|
qItem: QuestionnaireItem;
|
|
26
27
|
valueRadio: string | null;
|
|
27
|
-
orientation: ChoiceItemOrientation;
|
|
28
28
|
readOnly: boolean;
|
|
29
29
|
onCheckedChange: (newValue: string) => void;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function ChoiceRadioAnswerOptionFields(props: ChoiceRadioAnswerOptionFieldsProps) {
|
|
33
|
-
const { qItem, valueRadio,
|
|
33
|
+
const { qItem, valueRadio, readOnly, onCheckedChange } = props;
|
|
34
|
+
|
|
35
|
+
const orientation = getChoiceOrientation(qItem) ?? ChoiceItemOrientation.Vertical;
|
|
34
36
|
|
|
35
37
|
return (
|
|
36
38
|
<StyledRadioGroup
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import React from 'react';
|
|
19
|
-
import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
20
19
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
21
20
|
import { findInAnswerOptions, getQrChoiceValue } from '../../../utils/choice';
|
|
22
21
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
@@ -37,11 +36,10 @@ interface ChoiceRadioAnswerOptionItemProps
|
|
|
37
36
|
PropsWithParentIsReadOnlyAttribute {
|
|
38
37
|
qItem: QuestionnaireItem;
|
|
39
38
|
qrItem: QuestionnaireResponseItem | null;
|
|
40
|
-
orientation: ChoiceItemOrientation;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
function ChoiceRadioAnswerOptionItem(props: ChoiceRadioAnswerOptionItemProps) {
|
|
44
|
-
const { qItem, qrItem,
|
|
42
|
+
const { qItem, qrItem, isRepeated, parentIsReadOnly, onQrItemChange } = props;
|
|
45
43
|
|
|
46
44
|
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
47
45
|
|
|
@@ -66,7 +64,6 @@ function ChoiceRadioAnswerOptionItem(props: ChoiceRadioAnswerOptionItemProps) {
|
|
|
66
64
|
<ChoiceRadioAnswerOptionFields
|
|
67
65
|
qItem={qItem}
|
|
68
66
|
valueRadio={valueRadio}
|
|
69
|
-
orientation={orientation}
|
|
70
67
|
readOnly={readOnly}
|
|
71
68
|
onCheckedChange={handleChange}
|
|
72
69
|
/>
|
|
@@ -82,7 +79,6 @@ function ChoiceRadioAnswerOptionItem(props: ChoiceRadioAnswerOptionItemProps) {
|
|
|
82
79
|
<ChoiceRadioAnswerOptionFields
|
|
83
80
|
qItem={qItem}
|
|
84
81
|
valueRadio={valueRadio}
|
|
85
|
-
orientation={orientation}
|
|
86
82
|
readOnly={readOnly}
|
|
87
83
|
onCheckedChange={handleChange}
|
|
88
84
|
/>
|
|
@@ -24,20 +24,21 @@ import { StyledRadioGroup } from '../Item.styles';
|
|
|
24
24
|
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
25
25
|
import { StyledAlert } from '../../Alert.styles';
|
|
26
26
|
import type { TerminologyError } from '../../../hooks/useValueSetCodings';
|
|
27
|
+
import { getChoiceOrientation } from '../../../utils/choice';
|
|
27
28
|
|
|
28
29
|
interface ChoiceRadioAnswerValueSetFieldsProps {
|
|
29
30
|
qItem: QuestionnaireItem;
|
|
30
31
|
codings: Coding[];
|
|
31
32
|
valueRadio: string | null;
|
|
32
|
-
orientation: ChoiceItemOrientation;
|
|
33
33
|
readOnly: boolean;
|
|
34
34
|
terminologyError: TerminologyError;
|
|
35
35
|
onCheckedChange: (newValue: string) => void;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function ChoiceRadioAnswerValueSetFields(props: ChoiceRadioAnswerValueSetFieldsProps) {
|
|
39
|
-
const { qItem, codings, valueRadio,
|
|
40
|
-
|
|
39
|
+
const { qItem, codings, valueRadio, readOnly, terminologyError, onCheckedChange } = props;
|
|
40
|
+
|
|
41
|
+
const orientation = getChoiceOrientation(qItem) ?? ChoiceItemOrientation.Vertical;
|
|
41
42
|
|
|
42
43
|
if (codings.length > 0) {
|
|
43
44
|
return (
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import React from 'react';
|
|
19
|
-
import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
20
19
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
21
20
|
import { findInAnswerValueSetCodings } from '../../../utils/choice';
|
|
22
21
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
@@ -38,11 +37,10 @@ interface ChoiceRadioAnswerValueSetItemProps
|
|
|
38
37
|
PropsWithParentIsReadOnlyAttribute {
|
|
39
38
|
qItem: QuestionnaireItem;
|
|
40
39
|
qrItem: QuestionnaireResponseItem | null;
|
|
41
|
-
orientation: ChoiceItemOrientation;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
function ChoiceRadioAnswerValueSetItem(props: ChoiceRadioAnswerValueSetItemProps) {
|
|
45
|
-
const { qItem, qrItem,
|
|
43
|
+
const { qItem, qrItem, isRepeated, parentIsReadOnly, onQrItemChange } = props;
|
|
46
44
|
|
|
47
45
|
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
48
46
|
|
|
@@ -77,7 +75,6 @@ function ChoiceRadioAnswerValueSetItem(props: ChoiceRadioAnswerValueSetItemProps
|
|
|
77
75
|
qItem={qItem}
|
|
78
76
|
codings={codings}
|
|
79
77
|
valueRadio={valueRadio}
|
|
80
|
-
orientation={orientation}
|
|
81
78
|
readOnly={readOnly}
|
|
82
79
|
terminologyError={terminologyError}
|
|
83
80
|
onCheckedChange={handleChange}
|
|
@@ -95,7 +92,6 @@ function ChoiceRadioAnswerValueSetItem(props: ChoiceRadioAnswerValueSetItemProps
|
|
|
95
92
|
qItem={qItem}
|
|
96
93
|
codings={codings}
|
|
97
94
|
valueRadio={valueRadio}
|
|
98
|
-
orientation={orientation}
|
|
99
95
|
readOnly={readOnly}
|
|
100
96
|
terminologyError={terminologyError}
|
|
101
97
|
onCheckedChange={handleChange}
|
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
PropsWithParentIsReadOnlyAttribute,
|
|
26
26
|
PropsWithQrItemChangeHandler
|
|
27
27
|
} from '../../../interfaces/renderProps.interface';
|
|
28
|
+
import type { PropsWithParentIsRepeatGroupAttribute } from '../../../interfaces/renderProps.interface';
|
|
28
29
|
import type { QrRepeatGroup } from '../../../interfaces/repeatGroup.interface';
|
|
29
30
|
import useHidden from '../../../hooks/useHidden';
|
|
30
31
|
import type { Tabs } from '../../../interfaces/tab.interface';
|
|
@@ -37,7 +38,8 @@ import useReadOnly from '../../../hooks/useReadOnly';
|
|
|
37
38
|
interface GroupItemProps
|
|
38
39
|
extends PropsWithQrItemChangeHandler,
|
|
39
40
|
PropsWithIsRepeatedAttribute,
|
|
40
|
-
PropsWithParentIsReadOnlyAttribute
|
|
41
|
+
PropsWithParentIsReadOnlyAttribute,
|
|
42
|
+
PropsWithParentIsRepeatGroupAttribute {
|
|
41
43
|
qItem: QuestionnaireItem;
|
|
42
44
|
qrItem: QuestionnaireResponseItem | null;
|
|
43
45
|
groupCardElevation: number;
|
|
@@ -56,13 +58,15 @@ function GroupItem(props: GroupItemProps) {
|
|
|
56
58
|
tabs,
|
|
57
59
|
currentTabIndex,
|
|
58
60
|
parentIsReadOnly,
|
|
61
|
+
parentIsRepeatGroup,
|
|
62
|
+
parentRepeatGroupIndex,
|
|
59
63
|
onQrItemChange
|
|
60
64
|
} = props;
|
|
61
65
|
|
|
62
66
|
const qItemsIndexMap = useMemo(() => mapQItemsIndex(qItem), [qItem]);
|
|
63
67
|
|
|
64
68
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
65
|
-
const itemIsHidden = useHidden(qItem);
|
|
69
|
+
const itemIsHidden = useHidden(qItem, parentRepeatGroupIndex);
|
|
66
70
|
if (itemIsHidden) {
|
|
67
71
|
return null;
|
|
68
72
|
}
|
|
@@ -113,6 +117,8 @@ function GroupItem(props: GroupItemProps) {
|
|
|
113
117
|
qrItemOrItems={qrItemOrItems}
|
|
114
118
|
groupCardElevation={groupCardElevation}
|
|
115
119
|
parentIsReadOnly={readOnly}
|
|
120
|
+
parentIsRepeatGroup={parentIsRepeatGroup}
|
|
121
|
+
parentRepeatGroupIndex={parentRepeatGroupIndex}
|
|
116
122
|
onQrItemChange={handleQrItemChange}
|
|
117
123
|
onQrRepeatGroupChange={handleQrRepeatGroupChange}
|
|
118
124
|
/>
|
|
@@ -21,6 +21,7 @@ import type {
|
|
|
21
21
|
PropsWithQrItemChangeHandler,
|
|
22
22
|
PropsWithQrRepeatGroupChangeHandler
|
|
23
23
|
} from '../../../interfaces/renderProps.interface';
|
|
24
|
+
import type { PropsWithParentIsRepeatGroupAttribute } from '../../../interfaces/renderProps.interface';
|
|
24
25
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
25
26
|
import { isRepeatItemAndNotCheckbox, isSpecificItemControl } from '../../../utils';
|
|
26
27
|
import GroupTable from '../Tables/GroupTable';
|
|
@@ -34,7 +35,8 @@ import GridGroup from '../GridGroup/GridGroup';
|
|
|
34
35
|
interface GroupItemSwitcherProps
|
|
35
36
|
extends PropsWithQrItemChangeHandler,
|
|
36
37
|
PropsWithQrRepeatGroupChangeHandler,
|
|
37
|
-
PropsWithParentIsReadOnlyAttribute
|
|
38
|
+
PropsWithParentIsReadOnlyAttribute,
|
|
39
|
+
PropsWithParentIsRepeatGroupAttribute {
|
|
38
40
|
qItem: QuestionnaireItem;
|
|
39
41
|
qrItemOrItems: QuestionnaireResponseItem | QuestionnaireResponseItem[] | undefined;
|
|
40
42
|
groupCardElevation: number;
|
|
@@ -46,11 +48,13 @@ function GroupItemSwitcher(props: GroupItemSwitcherProps) {
|
|
|
46
48
|
qrItemOrItems,
|
|
47
49
|
groupCardElevation,
|
|
48
50
|
parentIsReadOnly,
|
|
51
|
+
parentIsRepeatGroup,
|
|
52
|
+
parentRepeatGroupIndex,
|
|
49
53
|
onQrItemChange,
|
|
50
54
|
onQrRepeatGroupChange
|
|
51
55
|
} = props;
|
|
52
56
|
|
|
53
|
-
const itemIsHidden = useHidden(qItem);
|
|
57
|
+
const itemIsHidden = useHidden(qItem, parentRepeatGroupIndex);
|
|
54
58
|
if (itemIsHidden) {
|
|
55
59
|
return null;
|
|
56
60
|
}
|
|
@@ -152,6 +156,8 @@ function GroupItemSwitcher(props: GroupItemSwitcherProps) {
|
|
|
152
156
|
isRepeated={false}
|
|
153
157
|
groupCardElevation={groupCardElevation + 1}
|
|
154
158
|
parentIsReadOnly={parentIsReadOnly}
|
|
159
|
+
parentIsRepeatGroup={parentIsRepeatGroup}
|
|
160
|
+
parentRepeatGroupIndex={parentRepeatGroupIndex}
|
|
155
161
|
onQrItemChange={onQrItemChange}
|
|
156
162
|
/>
|
|
157
163
|
);
|
|
@@ -166,6 +172,8 @@ function GroupItemSwitcher(props: GroupItemSwitcherProps) {
|
|
|
166
172
|
isTabled={false}
|
|
167
173
|
groupCardElevation={groupCardElevation + 1}
|
|
168
174
|
parentIsReadOnly={parentIsReadOnly}
|
|
175
|
+
parentIsRepeatGroup={parentIsRepeatGroup}
|
|
176
|
+
parentRepeatGroupIndex={parentRepeatGroupIndex}
|
|
169
177
|
onQrItemChange={onQrItemChange}
|
|
170
178
|
/>
|
|
171
179
|
);
|
package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
|
21
21
|
import CheckboxSingle from '../ItemParts/CheckboxSingle';
|
|
22
22
|
import CheckboxSingleWithOpenLabel from '../ItemParts/CheckboxSingleWithOpenLabel';
|
|
23
23
|
import type { QuestionnaireItem, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
24
|
+
import { getChoiceOrientation } from '../../../utils/choice';
|
|
24
25
|
|
|
25
26
|
interface OpenChoiceCheckboxAnswerOptionFieldsProps {
|
|
26
27
|
qItem: QuestionnaireItem;
|
|
@@ -29,7 +30,6 @@ interface OpenChoiceCheckboxAnswerOptionFieldsProps {
|
|
|
29
30
|
openLabelValue: string;
|
|
30
31
|
openLabelChecked: boolean;
|
|
31
32
|
readOnly: boolean;
|
|
32
|
-
orientation: ChoiceItemOrientation;
|
|
33
33
|
onValueChange: (changedOptionValue: string | null, changedOpenLabelValue: string | null) => void;
|
|
34
34
|
onOpenLabelCheckedChange: (checked: boolean) => void;
|
|
35
35
|
onOpenLabelInputChange: (input: string) => void;
|
|
@@ -43,12 +43,13 @@ function OpenChoiceCheckboxAnswerOptionFields(props: OpenChoiceCheckboxAnswerOpt
|
|
|
43
43
|
openLabelValue,
|
|
44
44
|
openLabelChecked,
|
|
45
45
|
readOnly,
|
|
46
|
-
orientation,
|
|
47
46
|
onValueChange,
|
|
48
47
|
onOpenLabelCheckedChange,
|
|
49
48
|
onOpenLabelInputChange
|
|
50
49
|
} = props;
|
|
51
50
|
|
|
51
|
+
const orientation = getChoiceOrientation(qItem) ?? ChoiceItemOrientation.Vertical;
|
|
52
|
+
|
|
52
53
|
return (
|
|
53
54
|
<StyledFormGroup row={orientation === ChoiceItemOrientation.Horizontal}>
|
|
54
55
|
{qItem.answerOption?.map((option) => {
|
package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
19
|
-
import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
20
19
|
import { CheckBoxOption } from '../../../interfaces/choice.enum';
|
|
21
20
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
22
21
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
@@ -48,14 +47,12 @@ interface OpenChoiceCheckboxAnswerOptionItemProps
|
|
|
48
47
|
PropsWithParentIsReadOnlyAttribute {
|
|
49
48
|
qItem: QuestionnaireItem;
|
|
50
49
|
qrItem: QuestionnaireResponseItem | null;
|
|
51
|
-
orientation: ChoiceItemOrientation;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
function OpenChoiceCheckboxAnswerOptionItem(props: OpenChoiceCheckboxAnswerOptionItemProps) {
|
|
55
53
|
const {
|
|
56
54
|
qItem,
|
|
57
55
|
qrItem,
|
|
58
|
-
orientation,
|
|
59
56
|
isRepeated,
|
|
60
57
|
showMinimalView = false,
|
|
61
58
|
parentIsReadOnly,
|
|
@@ -149,7 +146,6 @@ function OpenChoiceCheckboxAnswerOptionItem(props: OpenChoiceCheckboxAnswerOptio
|
|
|
149
146
|
openLabelValue={openLabelValue}
|
|
150
147
|
openLabelChecked={openLabelChecked}
|
|
151
148
|
readOnly={readOnly}
|
|
152
|
-
orientation={orientation}
|
|
153
149
|
onValueChange={handleValueChange}
|
|
154
150
|
onOpenLabelCheckedChange={handleOpenLabelCheckedChange}
|
|
155
151
|
onOpenLabelInputChange={handleOpenLabelInputChange}
|
|
@@ -172,7 +168,6 @@ function OpenChoiceCheckboxAnswerOptionItem(props: OpenChoiceCheckboxAnswerOptio
|
|
|
172
168
|
openLabelValue={openLabelValue}
|
|
173
169
|
openLabelChecked={openLabelChecked}
|
|
174
170
|
readOnly={readOnly}
|
|
175
|
-
orientation={orientation}
|
|
176
171
|
onValueChange={handleValueChange}
|
|
177
172
|
onOpenLabelCheckedChange={handleOpenLabelCheckedChange}
|
|
178
173
|
onOpenLabelInputChange={handleOpenLabelInputChange}
|
|
@@ -22,7 +22,6 @@ import OpenChoiceSelectAnswerOptionItem from './OpenChoiceSelectAnswerOptionItem
|
|
|
22
22
|
import OpenChoiceSelectAnswerValueSetItem from './OpenChoiceSelectAnswerValueSetItem';
|
|
23
23
|
import OpenChoiceAutocompleteItem from './OpenChoiceAutocompleteItem';
|
|
24
24
|
import { getOpenChoiceControlType } from '../../../utils/openChoice';
|
|
25
|
-
import { getChoiceOrientation } from '../../../utils/choice';
|
|
26
25
|
import OpenChoiceCheckboxAnswerOptionItem from './OpenChoiceCheckboxAnswerOptionItem';
|
|
27
26
|
import OpenChoiceRadioAnswerOptionItem from './OpenChoiceRadioAnswerOptionItem';
|
|
28
27
|
import type {
|
|
@@ -47,15 +46,12 @@ function OpenChoiceItemSwitcher(props: OpenChoiceItemSwitcherProps) {
|
|
|
47
46
|
const { qItem, qrItem, isRepeated, isTabled, showMinimalView, parentIsReadOnly, onQrItemChange } =
|
|
48
47
|
props;
|
|
49
48
|
|
|
50
|
-
const orientation = getChoiceOrientation(qItem);
|
|
51
|
-
|
|
52
49
|
switch (getOpenChoiceControlType(qItem)) {
|
|
53
50
|
case OpenChoiceItemControl.Checkbox:
|
|
54
51
|
return (
|
|
55
52
|
<OpenChoiceCheckboxAnswerOptionItem
|
|
56
53
|
qItem={qItem}
|
|
57
54
|
qrItem={qrItem}
|
|
58
|
-
orientation={orientation}
|
|
59
55
|
isRepeated={qItem['repeats'] ?? false}
|
|
60
56
|
showMinimalView={showMinimalView}
|
|
61
57
|
parentIsReadOnly={parentIsReadOnly}
|
|
@@ -67,7 +63,6 @@ function OpenChoiceItemSwitcher(props: OpenChoiceItemSwitcherProps) {
|
|
|
67
63
|
<OpenChoiceRadioAnswerOptionItem
|
|
68
64
|
qItem={qItem}
|
|
69
65
|
qrItem={qrItem}
|
|
70
|
-
orientation={orientation}
|
|
71
66
|
isRepeated={qItem['repeats'] ?? false}
|
|
72
67
|
parentIsReadOnly={parentIsReadOnly}
|
|
73
68
|
onQrItemChange={onQrItemChange}
|
|
@@ -22,6 +22,7 @@ import type { QuestionnaireItem } from 'fhir/r4';
|
|
|
22
22
|
import { StyledRadioGroup } from '../Item.styles';
|
|
23
23
|
import RadioButtonWithOpenLabel from '../ItemParts/RadioButtonWithOpenLabel';
|
|
24
24
|
import RadioAnswerOptionButtons from '../ItemParts/RadioAnswerOptionButtons';
|
|
25
|
+
import { getChoiceOrientation } from '../../../utils/choice';
|
|
25
26
|
|
|
26
27
|
interface OpenChoiceRadioAnswerOptionFieldsProps {
|
|
27
28
|
qItem: QuestionnaireItem;
|
|
@@ -29,7 +30,6 @@ interface OpenChoiceRadioAnswerOptionFieldsProps {
|
|
|
29
30
|
openLabelText: string | null;
|
|
30
31
|
openLabelValue: string | null;
|
|
31
32
|
openLabelSelected: boolean;
|
|
32
|
-
orientation: ChoiceItemOrientation;
|
|
33
33
|
readOnly: boolean;
|
|
34
34
|
onValueChange: (changedOptionValue: string | null, changedOpenLabelValue: string | null) => void;
|
|
35
35
|
}
|
|
@@ -41,11 +41,12 @@ function OpenChoiceRadioAnswerOptionFields(props: OpenChoiceRadioAnswerOptionFie
|
|
|
41
41
|
openLabelText,
|
|
42
42
|
openLabelValue,
|
|
43
43
|
openLabelSelected,
|
|
44
|
-
orientation,
|
|
45
44
|
readOnly,
|
|
46
45
|
onValueChange
|
|
47
46
|
} = props;
|
|
48
47
|
|
|
48
|
+
const orientation = getChoiceOrientation(qItem) ?? ChoiceItemOrientation.Vertical;
|
|
49
|
+
|
|
49
50
|
return (
|
|
50
51
|
<StyledRadioGroup
|
|
51
52
|
row={orientation === ChoiceItemOrientation.Horizontal}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import React, { useState } from 'react';
|
|
19
|
-
import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
20
19
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
21
20
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
22
21
|
import { getOpenLabelText } from '../../../utils/itemControl';
|
|
@@ -39,11 +38,10 @@ interface OpenChoiceRadioAnswerOptionItemProps
|
|
|
39
38
|
PropsWithParentIsReadOnlyAttribute {
|
|
40
39
|
qItem: QuestionnaireItem;
|
|
41
40
|
qrItem: QuestionnaireResponseItem | null;
|
|
42
|
-
orientation: ChoiceItemOrientation;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
function OpenChoiceRadioAnswerOptionItem(props: OpenChoiceRadioAnswerOptionItemProps) {
|
|
46
|
-
const { qItem, qrItem,
|
|
44
|
+
const { qItem, qrItem, parentIsReadOnly, onQrItemChange } = props;
|
|
47
45
|
|
|
48
46
|
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
49
47
|
|
|
@@ -130,7 +128,6 @@ function OpenChoiceRadioAnswerOptionItem(props: OpenChoiceRadioAnswerOptionItemP
|
|
|
130
128
|
openLabelText={openLabelText}
|
|
131
129
|
openLabelValue={openLabelValue}
|
|
132
130
|
openLabelSelected={openLabelSelected}
|
|
133
|
-
orientation={orientation}
|
|
134
131
|
readOnly={readOnly}
|
|
135
132
|
onValueChange={handleValueChange}
|
|
136
133
|
/>
|