@aehrc/smart-forms-renderer 0.16.2 → 0.17.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/AttachmentItem/AttachmentFieldWrapper.js +3 -1
- package/lib/components/FormComponents/AttachmentItem/AttachmentFieldWrapper.js.map +1 -1
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js +3 -1
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js +3 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +3 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +3 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +3 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +3 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +3 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js +3 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/CustomDateItem/CustomDateItem.js +3 -1
- package/lib/components/FormComponents/CustomDateItem/CustomDateItem.js.map +1 -1
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js +3 -1
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js.map +1 -1
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js +3 -1
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js.map +1 -1
- package/lib/components/FormComponents/DisplayItem/DisplayItem.js +3 -1
- package/lib/components/FormComponents/DisplayItem/DisplayItem.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridGroup.js +3 -1
- package/lib/components/FormComponents/GridGroup/GridGroup.js.map +1 -1
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js +3 -1
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js +3 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +3 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +3 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js +3 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js +3 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js +3 -1
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js.map +1 -1
- package/lib/components/FormComponents/SliderItem/SliderItem.js +3 -1
- package/lib/components/FormComponents/SliderItem/SliderItem.js.map +1 -1
- package/lib/components/FormComponents/StringItem/StringItem.js +3 -1
- package/lib/components/FormComponents/StringItem/StringItem.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTableView.js +3 -1
- package/lib/components/FormComponents/Tables/GroupTableView.js.map +1 -1
- package/lib/components/FormComponents/TextItem/TextItem.js +3 -1
- package/lib/components/FormComponents/TextItem/TextItem.js.map +1 -1
- package/lib/components/FormComponents/TimeItem/TimeItem.js +3 -1
- package/lib/components/FormComponents/TimeItem/TimeItem.js.map +1 -1
- package/lib/components/FormComponents/UrlItem/UrlItem.js +3 -1
- package/lib/components/FormComponents/UrlItem/UrlItem.js.map +1 -1
- package/lib/stores/questionnaireStore.d.ts +4 -0
- package/lib/stores/questionnaireStore.js +5 -1
- package/lib/stores/questionnaireStore.js.map +1 -1
- package/lib/utils/fhirpath.js +3 -1
- package/lib/utils/fhirpath.js.map +1 -1
- package/package.json +2 -2
- package/src/components/FormComponents/AttachmentItem/AttachmentFieldWrapper.tsx +7 -1
- package/src/components/FormComponents/BooleanItem/BooleanItem.tsx +7 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +5 -1
- package/src/components/FormComponents/CustomDateItem/CustomDateItem.tsx +7 -1
- package/src/components/FormComponents/DateTimeItem/DateTimeItem.tsx +7 -1
- package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +7 -1
- package/src/components/FormComponents/DisplayItem/DisplayItem.tsx +7 -1
- package/src/components/FormComponents/GridGroup/GridGroup.tsx +5 -1
- package/src/components/FormComponents/IntegerItem/IntegerItem.tsx +7 -1
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +5 -1
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +5 -1
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +5 -1
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +5 -1
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +5 -1
- package/src/components/FormComponents/RepeatItem/RepeatItem.tsx +7 -1
- package/src/components/FormComponents/SliderItem/SliderItem.tsx +7 -1
- package/src/components/FormComponents/StringItem/StringItem.tsx +7 -1
- package/src/components/FormComponents/Tables/GroupTableView.tsx +5 -1
- package/src/components/FormComponents/TextItem/TextItem.tsx +7 -1
- package/src/components/FormComponents/TimeItem/TimeItem.tsx +7 -1
- package/src/components/FormComponents/UrlItem/UrlItem.tsx +7 -1
- package/src/stores/questionnaireStore.ts +8 -1
- package/src/utils/fhirpath.ts +4 -1
|
@@ -29,6 +29,7 @@ import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
|
29
29
|
import BooleanField from './BooleanField';
|
|
30
30
|
import Box from '@mui/material/Box';
|
|
31
31
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
32
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
32
33
|
|
|
33
34
|
interface BooleanItemProps
|
|
34
35
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -42,6 +43,8 @@ interface BooleanItemProps
|
|
|
42
43
|
function BooleanItem(props: BooleanItemProps) {
|
|
43
44
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
44
45
|
|
|
46
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
47
|
+
|
|
45
48
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
46
49
|
|
|
47
50
|
// Init input value
|
|
@@ -72,7 +75,10 @@ function BooleanItem(props: BooleanItemProps) {
|
|
|
72
75
|
);
|
|
73
76
|
}
|
|
74
77
|
return (
|
|
75
|
-
<FullWidthFormComponentBox
|
|
78
|
+
<FullWidthFormComponentBox
|
|
79
|
+
data-test="q-item-boolean-box"
|
|
80
|
+
data-linkid={qItem.linkId}
|
|
81
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
76
82
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
77
83
|
<BooleanField checked={checked} readOnly={readOnly} onCheckedChange={handleCheckedChange} />
|
|
78
84
|
</ItemFieldGrid>
|
|
@@ -32,6 +32,7 @@ import { AUTOCOMPLETE_DEBOUNCE_DURATION } from '../../../utils/debounce';
|
|
|
32
32
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
33
33
|
import ChoiceAutocompleteField from './ChoiceAutocompleteField';
|
|
34
34
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
35
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
35
36
|
|
|
36
37
|
interface ChoiceAutocompleteItemProps
|
|
37
38
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -46,6 +47,8 @@ function ChoiceAutocompleteItem(props: ChoiceAutocompleteItemProps) {
|
|
|
46
47
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
47
48
|
const qrChoice = qrItem ?? createEmptyQrItem(qItem);
|
|
48
49
|
|
|
50
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
51
|
+
|
|
49
52
|
// Init input value
|
|
50
53
|
let valueCoding: Coding | undefined;
|
|
51
54
|
if (qrChoice.answer) {
|
|
@@ -103,7 +106,8 @@ function ChoiceAutocompleteItem(props: ChoiceAutocompleteItemProps) {
|
|
|
103
106
|
return (
|
|
104
107
|
<FullWidthFormComponentBox
|
|
105
108
|
data-test="q-item-choice-autocomplete-box"
|
|
106
|
-
data-linkid={qItem.linkId}
|
|
109
|
+
data-linkid={qItem.linkId}
|
|
110
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
107
111
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
108
112
|
<ChoiceAutocompleteField
|
|
109
113
|
qItem={qItem}
|
|
@@ -32,6 +32,7 @@ import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
|
32
32
|
import ChoiceCheckboxAnswerValueSetFields from './ChoiceCheckboxAnswerOptionFields';
|
|
33
33
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
34
34
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
35
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
35
36
|
|
|
36
37
|
interface ChoiceCheckboxAnswerOptionItemProps
|
|
37
38
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -54,6 +55,8 @@ function ChoiceCheckboxAnswerOptionItem(props: ChoiceCheckboxAnswerOptionItemPro
|
|
|
54
55
|
onQrItemChange
|
|
55
56
|
} = props;
|
|
56
57
|
|
|
58
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
59
|
+
|
|
57
60
|
// Init input value
|
|
58
61
|
const qrChoiceCheckbox = qrItem ?? createEmptyQrItem(qItem);
|
|
59
62
|
const answers = qrChoiceCheckbox.answer ? qrChoiceCheckbox.answer : [];
|
|
@@ -97,7 +100,8 @@ function ChoiceCheckboxAnswerOptionItem(props: ChoiceCheckboxAnswerOptionItemPro
|
|
|
97
100
|
return (
|
|
98
101
|
<FullWidthFormComponentBox
|
|
99
102
|
data-test="q-item-choice-checkbox-answer-option-box"
|
|
100
|
-
data-linkid={qItem.linkId}
|
|
103
|
+
data-linkid={qItem.linkId}
|
|
104
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
101
105
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
102
106
|
<ChoiceCheckboxAnswerValueSetFields
|
|
103
107
|
qItem={qItem}
|
|
@@ -33,6 +33,7 @@ import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
|
33
33
|
import ChoiceCheckboxAnswerValueSetFields from './ChoiceCheckboxAnswerValueSetFields';
|
|
34
34
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
35
35
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
36
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
36
37
|
|
|
37
38
|
interface ChoiceCheckboxAnswerValueSetItemProps
|
|
38
39
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -56,6 +57,8 @@ function ChoiceCheckboxAnswerValueSetItem(props: ChoiceCheckboxAnswerValueSetIte
|
|
|
56
57
|
onQrItemChange
|
|
57
58
|
} = props;
|
|
58
59
|
|
|
60
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
61
|
+
|
|
59
62
|
// Init input value
|
|
60
63
|
const qrChoiceCheckbox = qrItem ?? createEmptyQrItem(qItem);
|
|
61
64
|
const answers = qrChoiceCheckbox.answer ? qrChoiceCheckbox.answer : [];
|
|
@@ -102,7 +105,8 @@ function ChoiceCheckboxAnswerValueSetItem(props: ChoiceCheckboxAnswerValueSetIte
|
|
|
102
105
|
return (
|
|
103
106
|
<FullWidthFormComponentBox
|
|
104
107
|
data-test="q-item-choice-checkbox-answer-value-set-box"
|
|
105
|
-
data-linkid={qItem.linkId}
|
|
108
|
+
data-linkid={qItem.linkId}
|
|
109
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
106
110
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
107
111
|
<ChoiceCheckboxAnswerValueSetFields
|
|
108
112
|
codings={codings}
|
|
@@ -29,6 +29,7 @@ import type {
|
|
|
29
29
|
import ChoiceRadioAnswerOptionFields from './ChoiceRadioAnswerOptionFields';
|
|
30
30
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
31
31
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
32
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
32
33
|
|
|
33
34
|
interface ChoiceRadioAnswerOptionItemProps
|
|
34
35
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -42,6 +43,8 @@ interface ChoiceRadioAnswerOptionItemProps
|
|
|
42
43
|
function ChoiceRadioAnswerOptionItem(props: ChoiceRadioAnswerOptionItemProps) {
|
|
43
44
|
const { qItem, qrItem, orientation, isRepeated, parentIsReadOnly, onQrItemChange } = props;
|
|
44
45
|
|
|
46
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
47
|
+
|
|
45
48
|
// Init input value
|
|
46
49
|
const qrChoiceRadio = qrItem ?? createEmptyQrItem(qItem);
|
|
47
50
|
const valueRadio = getQrChoiceValue(qrChoiceRadio);
|
|
@@ -73,7 +76,8 @@ function ChoiceRadioAnswerOptionItem(props: ChoiceRadioAnswerOptionItemProps) {
|
|
|
73
76
|
return (
|
|
74
77
|
<FullWidthFormComponentBox
|
|
75
78
|
data-test="q-item-choice-radio-answer-option-box"
|
|
76
|
-
data-linkid={qItem.linkId}
|
|
79
|
+
data-linkid={qItem.linkId}
|
|
80
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
77
81
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
78
82
|
<ChoiceRadioAnswerOptionFields
|
|
79
83
|
qItem={qItem}
|
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
import ChoiceRadioAnswerValueSetFields from './ChoiceRadioAnswerValueSetFields';
|
|
31
31
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
32
32
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
33
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
33
34
|
|
|
34
35
|
interface ChoiceRadioAnswerValueSetItemProps
|
|
35
36
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -43,6 +44,8 @@ interface ChoiceRadioAnswerValueSetItemProps
|
|
|
43
44
|
function ChoiceRadioAnswerValueSetItem(props: ChoiceRadioAnswerValueSetItemProps) {
|
|
44
45
|
const { qItem, qrItem, orientation, isRepeated, parentIsReadOnly, onQrItemChange } = props;
|
|
45
46
|
|
|
47
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
48
|
+
|
|
46
49
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
47
50
|
|
|
48
51
|
// Init input value
|
|
@@ -85,7 +88,8 @@ function ChoiceRadioAnswerValueSetItem(props: ChoiceRadioAnswerValueSetItemProps
|
|
|
85
88
|
return (
|
|
86
89
|
<FullWidthFormComponentBox
|
|
87
90
|
data-test="q-item-choice-radio-answer-value-set-box"
|
|
88
|
-
data-linkid={qItem.linkId}
|
|
91
|
+
data-linkid={qItem.linkId}
|
|
92
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
89
93
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
90
94
|
<ChoiceRadioAnswerValueSetFields
|
|
91
95
|
qItem={qItem}
|
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
import ChoiceSelectAnswerOptionFields from './ChoiceSelectAnswerOptionFields';
|
|
31
31
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
32
32
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
33
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
33
34
|
|
|
34
35
|
interface ChoiceSelectAnswerOptionItemProps
|
|
35
36
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -43,6 +44,8 @@ interface ChoiceSelectAnswerOptionItemProps
|
|
|
43
44
|
function ChoiceSelectAnswerOptionItem(props: ChoiceSelectAnswerOptionItemProps) {
|
|
44
45
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
45
46
|
|
|
47
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
48
|
+
|
|
46
49
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
47
50
|
|
|
48
51
|
// Init input value
|
|
@@ -79,7 +82,8 @@ function ChoiceSelectAnswerOptionItem(props: ChoiceSelectAnswerOptionItemProps)
|
|
|
79
82
|
return (
|
|
80
83
|
<FullWidthFormComponentBox
|
|
81
84
|
data-test="q-item-choice-select-answer-option-box"
|
|
82
|
-
data-linkid={qItem.linkId}
|
|
85
|
+
data-linkid={qItem.linkId}
|
|
86
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
83
87
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
84
88
|
<ChoiceSelectAnswerOptionFields
|
|
85
89
|
qItem={qItem}
|
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
import ChoiceSelectAnswerValueSetFields from './ChoiceSelectAnswerValueSetFields';
|
|
31
31
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
32
32
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
33
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
33
34
|
|
|
34
35
|
interface ChoiceSelectAnswerValueSetItemProps
|
|
35
36
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -43,6 +44,8 @@ interface ChoiceSelectAnswerValueSetItemProps
|
|
|
43
44
|
function ChoiceSelectAnswerValueSetItem(props: ChoiceSelectAnswerValueSetItemProps) {
|
|
44
45
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
45
46
|
|
|
47
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
48
|
+
|
|
46
49
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
47
50
|
|
|
48
51
|
// Init input value
|
|
@@ -105,7 +108,8 @@ function ChoiceSelectAnswerValueSetItem(props: ChoiceSelectAnswerValueSetItemPro
|
|
|
105
108
|
return (
|
|
106
109
|
<FullWidthFormComponentBox
|
|
107
110
|
data-test="q-item-choice-dropdown-answer-value-set-box"
|
|
108
|
-
data-linkid={qItem.linkId}
|
|
111
|
+
data-linkid={qItem.linkId}
|
|
112
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
109
113
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
110
114
|
<ChoiceSelectAnswerValueSetFields
|
|
111
115
|
qItem={qItem}
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
36
36
|
import useDateValidation from '../../../hooks/useDateValidation';
|
|
37
37
|
import CustomDateField from './customDateTimePicker/CustomDateField';
|
|
38
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
38
39
|
|
|
39
40
|
interface CustomDateItemProps
|
|
40
41
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -48,6 +49,8 @@ interface CustomDateItemProps
|
|
|
48
49
|
function CustomDateItem(props: CustomDateItemProps) {
|
|
49
50
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
50
51
|
|
|
52
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
53
|
+
|
|
51
54
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
52
55
|
const { displayPrompt, entryFormat } = useRenderingExtensions(qItem);
|
|
53
56
|
|
|
@@ -116,7 +119,10 @@ function CustomDateItem(props: CustomDateItemProps) {
|
|
|
116
119
|
}
|
|
117
120
|
|
|
118
121
|
return (
|
|
119
|
-
<FullWidthFormComponentBox
|
|
122
|
+
<FullWidthFormComponentBox
|
|
123
|
+
data-test="q-item-date-box"
|
|
124
|
+
data-linkid={qItem.linkId}
|
|
125
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
120
126
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
121
127
|
<CustomDateField
|
|
122
128
|
linkId={qItem.linkId}
|
|
@@ -31,6 +31,7 @@ import DateTimeField from './DateTimeField';
|
|
|
31
31
|
import type { Dayjs } from 'dayjs';
|
|
32
32
|
import dayjs from 'dayjs';
|
|
33
33
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
34
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
34
35
|
|
|
35
36
|
interface DateTimeItemProps
|
|
36
37
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -44,6 +45,8 @@ interface DateTimeItemProps
|
|
|
44
45
|
function DateTimeItem(props: DateTimeItemProps) {
|
|
45
46
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
46
47
|
|
|
48
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
49
|
+
|
|
47
50
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
48
51
|
const { displayPrompt, entryFormat } = useRenderingExtensions(qItem);
|
|
49
52
|
|
|
@@ -82,7 +85,10 @@ function DateTimeItem(props: DateTimeItemProps) {
|
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
return (
|
|
85
|
-
<FullWidthFormComponentBox
|
|
88
|
+
<FullWidthFormComponentBox
|
|
89
|
+
data-test="q-item-date-time-box"
|
|
90
|
+
data-linkid={qItem.linkId}
|
|
91
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
86
92
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
87
93
|
<DateTimeField
|
|
88
94
|
value={dateTimeDayJs}
|
|
@@ -39,6 +39,7 @@ import { getDecimalPrecision } from '../../../utils/itemControl';
|
|
|
39
39
|
import useDecimalCalculatedExpression from '../../../hooks/useDecimalCalculatedExpression';
|
|
40
40
|
import useStringInput from '../../../hooks/useStringInput';
|
|
41
41
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
42
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
42
43
|
|
|
43
44
|
interface DecimalItemProps
|
|
44
45
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -52,6 +53,8 @@ interface DecimalItemProps
|
|
|
52
53
|
function DecimalItem(props: DecimalItemProps) {
|
|
53
54
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
54
55
|
|
|
56
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
57
|
+
|
|
55
58
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
56
59
|
const precision = getDecimalPrecision(qItem);
|
|
57
60
|
const { displayUnit, displayPrompt, entryFormat, regexValidation, minLength, maxLength } =
|
|
@@ -126,7 +129,10 @@ function DecimalItem(props: DecimalItemProps) {
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
return (
|
|
129
|
-
<FullWidthFormComponentBox
|
|
132
|
+
<FullWidthFormComponentBox
|
|
133
|
+
data-test="q-item-decimal-box"
|
|
134
|
+
data-linkid={qItem.linkId}
|
|
135
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
130
136
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
131
137
|
<DecimalField
|
|
132
138
|
linkId={qItem.linkId}
|
|
@@ -20,6 +20,7 @@ import type { QuestionnaireItem } from 'fhir/r4';
|
|
|
20
20
|
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
21
21
|
import { isSpecificItemControl } from '../../../utils';
|
|
22
22
|
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
23
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
23
24
|
|
|
24
25
|
interface DisplayItemProps {
|
|
25
26
|
qItem: QuestionnaireItem;
|
|
@@ -28,13 +29,18 @@ interface DisplayItemProps {
|
|
|
28
29
|
const DisplayItem = memo(function DisplayItem(props: DisplayItemProps) {
|
|
29
30
|
const { qItem } = props;
|
|
30
31
|
|
|
32
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
33
|
+
|
|
31
34
|
const isContextDisplay = isSpecificItemControl(qItem, 'context-display');
|
|
32
35
|
if (isContextDisplay) {
|
|
33
36
|
return null;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
return (
|
|
37
|
-
<FullWidthFormComponentBox
|
|
40
|
+
<FullWidthFormComponentBox
|
|
41
|
+
data-test="q-item-display-box"
|
|
42
|
+
data-linkid={qItem.linkId}
|
|
43
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
38
44
|
<LabelWrapper qItem={qItem} readOnly={false} />
|
|
39
45
|
</FullWidthFormComponentBox>
|
|
40
46
|
);
|
|
@@ -33,6 +33,7 @@ import { mapQItemsIndex } from '../../../utils/mapItem';
|
|
|
33
33
|
import GridTable from './GridTable';
|
|
34
34
|
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
35
35
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
36
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
36
37
|
|
|
37
38
|
interface GridGroupProps
|
|
38
39
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -47,6 +48,8 @@ function GridGroup(props: GridGroupProps) {
|
|
|
47
48
|
const { qItem, qrItem, groupCardElevation, showMinimalView, parentIsReadOnly, onQrItemChange } =
|
|
48
49
|
props;
|
|
49
50
|
|
|
51
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
52
|
+
|
|
50
53
|
const qRowItems = qItem.item;
|
|
51
54
|
const qrGroup = qrItem && qrItem.item ? qrItem : createEmptyQrGroup(qItem);
|
|
52
55
|
const qrRowItems = qrGroup.item;
|
|
@@ -103,7 +106,8 @@ function GridGroup(props: GridGroupProps) {
|
|
|
103
106
|
cardElevation={groupCardElevation}
|
|
104
107
|
isRepeated={false}
|
|
105
108
|
py={3}
|
|
106
|
-
data-linkid={qItem.linkId}
|
|
109
|
+
data-linkid={qItem.linkId}
|
|
110
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
107
111
|
{qItem.text ? (
|
|
108
112
|
<>
|
|
109
113
|
<Typography
|
|
@@ -35,6 +35,7 @@ import { parseValidInteger } from '../../../utils/parseInputs';
|
|
|
35
35
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
36
36
|
import useNumberInput from '../../../hooks/useNumberInput';
|
|
37
37
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
38
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
38
39
|
|
|
39
40
|
interface IntegerItemProps
|
|
40
41
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -48,6 +49,8 @@ interface IntegerItemProps
|
|
|
48
49
|
function IntegerItem(props: IntegerItemProps) {
|
|
49
50
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
50
51
|
|
|
52
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
53
|
+
|
|
51
54
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
52
55
|
const { displayUnit, displayPrompt, entryFormat, regexValidation, minLength, maxLength } =
|
|
53
56
|
useRenderingExtensions(qItem);
|
|
@@ -114,7 +117,10 @@ function IntegerItem(props: IntegerItemProps) {
|
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
return (
|
|
117
|
-
<FullWidthFormComponentBox
|
|
120
|
+
<FullWidthFormComponentBox
|
|
121
|
+
data-test="q-item-integer-box"
|
|
122
|
+
data-linkid={qItem.linkId}
|
|
123
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
118
124
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
119
125
|
<IntegerField
|
|
120
126
|
linkId={qItem.linkId}
|
|
@@ -33,6 +33,7 @@ import { AUTOCOMPLETE_DEBOUNCE_DURATION } from '../../../utils/debounce';
|
|
|
33
33
|
import OpenChoiceAutocompleteField from './OpenChoiceAutocompleteField';
|
|
34
34
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
35
35
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
36
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
36
37
|
|
|
37
38
|
interface OpenChoiceAutocompleteItemProps
|
|
38
39
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -46,6 +47,8 @@ interface OpenChoiceAutocompleteItemProps
|
|
|
46
47
|
function OpenChoiceAutocompleteItem(props: OpenChoiceAutocompleteItemProps) {
|
|
47
48
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
48
49
|
|
|
50
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
51
|
+
|
|
49
52
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
50
53
|
|
|
51
54
|
const qrOpenChoice = qrItem ?? createEmptyQrItem(qItem);
|
|
@@ -132,7 +135,8 @@ function OpenChoiceAutocompleteItem(props: OpenChoiceAutocompleteItemProps) {
|
|
|
132
135
|
return (
|
|
133
136
|
<FullWidthFormComponentBox
|
|
134
137
|
data-test="q-item-open-choice-autocomplete-box"
|
|
135
|
-
data-linkid={qItem.linkId}
|
|
138
|
+
data-linkid={qItem.linkId}
|
|
139
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
136
140
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
137
141
|
<OpenChoiceAutocompleteField
|
|
138
142
|
qItem={qItem}
|
package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx
CHANGED
|
@@ -39,6 +39,7 @@ import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
|
39
39
|
import OpenChoiceCheckboxAnswerOptionFields from './OpenChoiceCheckboxAnswerOptionFields';
|
|
40
40
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
41
41
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
42
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
42
43
|
|
|
43
44
|
interface OpenChoiceCheckboxAnswerOptionItemProps
|
|
44
45
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -61,6 +62,8 @@ function OpenChoiceCheckboxAnswerOptionItem(props: OpenChoiceCheckboxAnswerOptio
|
|
|
61
62
|
onQrItemChange
|
|
62
63
|
} = props;
|
|
63
64
|
|
|
65
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
66
|
+
|
|
64
67
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
65
68
|
const openLabelText = getOpenLabelText(qItem);
|
|
66
69
|
const { displayInstructions } = useRenderingExtensions(qItem);
|
|
@@ -159,7 +162,8 @@ function OpenChoiceCheckboxAnswerOptionItem(props: OpenChoiceCheckboxAnswerOptio
|
|
|
159
162
|
return (
|
|
160
163
|
<FullWidthFormComponentBox
|
|
161
164
|
data-test="q-item-open-choice-checkbox-answer-option-box"
|
|
162
|
-
data-linkid={qItem.linkId}
|
|
165
|
+
data-linkid={qItem.linkId}
|
|
166
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
163
167
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
164
168
|
<OpenChoiceCheckboxAnswerOptionFields
|
|
165
169
|
qItem={qItem}
|
|
@@ -31,6 +31,7 @@ import type {
|
|
|
31
31
|
import OpenChoiceRadioAnswerOptionFields from './OpenChoiceRadioAnswerOptionFields';
|
|
32
32
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
33
33
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
34
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
34
35
|
|
|
35
36
|
interface OpenChoiceRadioAnswerOptionItemProps
|
|
36
37
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -44,6 +45,8 @@ interface OpenChoiceRadioAnswerOptionItemProps
|
|
|
44
45
|
function OpenChoiceRadioAnswerOptionItem(props: OpenChoiceRadioAnswerOptionItemProps) {
|
|
45
46
|
const { qItem, qrItem, orientation, parentIsReadOnly, onQrItemChange } = props;
|
|
46
47
|
|
|
48
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
49
|
+
|
|
47
50
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
48
51
|
const openLabelText = getOpenLabelText(qItem);
|
|
49
52
|
|
|
@@ -118,7 +121,8 @@ function OpenChoiceRadioAnswerOptionItem(props: OpenChoiceRadioAnswerOptionItemP
|
|
|
118
121
|
return (
|
|
119
122
|
<FullWidthFormComponentBox
|
|
120
123
|
data-test="q-item-open-choice-radio-answer-option-box"
|
|
121
|
-
data-linkid={qItem.linkId}
|
|
124
|
+
data-linkid={qItem.linkId}
|
|
125
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
122
126
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
123
127
|
<OpenChoiceRadioAnswerOptionFields
|
|
124
128
|
qItem={qItem}
|
|
@@ -32,6 +32,7 @@ import type {
|
|
|
32
32
|
import OpenChoiceSelectAnswerOptionField from './OpenChoiceSelectAnswerOptionField';
|
|
33
33
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
34
34
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
35
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
35
36
|
|
|
36
37
|
interface OpenChoiceSelectAnswerOptionItemProps
|
|
37
38
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -45,6 +46,8 @@ interface OpenChoiceSelectAnswerOptionItemProps
|
|
|
45
46
|
function OpenChoiceSelectAnswerOptionItem(props: OpenChoiceSelectAnswerOptionItemProps) {
|
|
46
47
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
47
48
|
|
|
49
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
50
|
+
|
|
48
51
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
49
52
|
|
|
50
53
|
// Init input value
|
|
@@ -106,7 +109,8 @@ function OpenChoiceSelectAnswerOptionItem(props: OpenChoiceSelectAnswerOptionIte
|
|
|
106
109
|
return (
|
|
107
110
|
<FullWidthFormComponentBox
|
|
108
111
|
data-test="q-item-open-choice-select-answer-option-box"
|
|
109
|
-
data-linkid={qItem.linkId}
|
|
112
|
+
data-linkid={qItem.linkId}
|
|
113
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
110
114
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
111
115
|
<OpenChoiceSelectAnswerOptionField
|
|
112
116
|
qItem={qItem}
|
package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx
CHANGED
|
@@ -29,6 +29,7 @@ import type {
|
|
|
29
29
|
import OpenChoiceSelectAnswerValueSetField from './OpenChoiceSelectAnswerValueSetField';
|
|
30
30
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
31
31
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
32
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
32
33
|
|
|
33
34
|
interface OpenChoiceSelectAnswerValueSetItemProps
|
|
34
35
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -42,6 +43,8 @@ interface OpenChoiceSelectAnswerValueSetItemProps
|
|
|
42
43
|
function OpenChoiceSelectAnswerValueSetItem(props: OpenChoiceSelectAnswerValueSetItemProps) {
|
|
43
44
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
44
45
|
|
|
46
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
47
|
+
|
|
45
48
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
46
49
|
|
|
47
50
|
// Init input value
|
|
@@ -90,7 +93,8 @@ function OpenChoiceSelectAnswerValueSetItem(props: OpenChoiceSelectAnswerValueSe
|
|
|
90
93
|
return (
|
|
91
94
|
<FullWidthFormComponentBox
|
|
92
95
|
data-test="q-item-open-choice-select-answer-value-set-box"
|
|
93
|
-
data-linkid={qItem.linkId}
|
|
96
|
+
data-linkid={qItem.linkId}
|
|
97
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
94
98
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
95
99
|
<OpenChoiceSelectAnswerValueSetField
|
|
96
100
|
qItem={qItem}
|
|
@@ -32,6 +32,7 @@ import Collapse from '@mui/material/Collapse';
|
|
|
32
32
|
import useInitialiseRepeatAnswers from '../../../hooks/useInitialiseRepeatAnswers';
|
|
33
33
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
34
34
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
35
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
35
36
|
|
|
36
37
|
interface RepeatItemProps
|
|
37
38
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -46,6 +47,8 @@ function RepeatItem(props: RepeatItemProps) {
|
|
|
46
47
|
const { qItem, qrItem, groupCardElevation, showMinimalView, parentIsReadOnly, onQrItemChange } =
|
|
47
48
|
props;
|
|
48
49
|
|
|
50
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
51
|
+
|
|
49
52
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
50
53
|
|
|
51
54
|
const initialRepeatAnswers = useInitialiseRepeatAnswers(qItem, qrItem);
|
|
@@ -119,7 +122,10 @@ function RepeatItem(props: RepeatItemProps) {
|
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
return (
|
|
122
|
-
<FullWidthFormComponentBox
|
|
125
|
+
<FullWidthFormComponentBox
|
|
126
|
+
data-test="q-item-repeat-box"
|
|
127
|
+
data-linkid={qItem.linkId}
|
|
128
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
123
129
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
124
130
|
<TransitionGroup>
|
|
125
131
|
{repeatAnswers.map(({ nanoId, answer }, index) => {
|
|
@@ -30,6 +30,7 @@ import useReadOnly from '../../../hooks/useReadOnly';
|
|
|
30
30
|
import SliderField from './SliderField';
|
|
31
31
|
import useSliderExtensions from '../../../hooks/useSliderExtensions';
|
|
32
32
|
import Box from '@mui/material/Box';
|
|
33
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
33
34
|
|
|
34
35
|
interface SliderItemProps
|
|
35
36
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -43,6 +44,8 @@ interface SliderItemProps
|
|
|
43
44
|
function SliderItem(props: SliderItemProps) {
|
|
44
45
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
45
46
|
|
|
47
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
48
|
+
|
|
46
49
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
47
50
|
const { minValue, maxValue, stepValue, minLabel, maxLabel } = useSliderExtensions(qItem);
|
|
48
51
|
|
|
@@ -88,7 +91,10 @@ function SliderItem(props: SliderItemProps) {
|
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
return (
|
|
91
|
-
<FullWidthFormComponentBox
|
|
94
|
+
<FullWidthFormComponentBox
|
|
95
|
+
data-test="q-item-slider-box"
|
|
96
|
+
data-linkid={qItem.linkId}
|
|
97
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
92
98
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
93
99
|
<Box px={4}>
|
|
94
100
|
<SliderField
|
|
@@ -34,6 +34,7 @@ import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
|
34
34
|
import useStringCalculatedExpression from '../../../hooks/useStringCalculatedExpression';
|
|
35
35
|
import useStringInput from '../../../hooks/useStringInput';
|
|
36
36
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
37
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
37
38
|
|
|
38
39
|
interface StringItemProps
|
|
39
40
|
extends PropsWithQrItemChangeHandler,
|
|
@@ -46,6 +47,8 @@ interface StringItemProps
|
|
|
46
47
|
function StringItem(props: StringItemProps) {
|
|
47
48
|
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
48
49
|
|
|
50
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
51
|
+
|
|
49
52
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
50
53
|
const { displayUnit, displayPrompt, entryFormat, regexValidation, minLength, maxLength } =
|
|
51
54
|
useRenderingExtensions(qItem);
|
|
@@ -106,7 +109,10 @@ function StringItem(props: StringItemProps) {
|
|
|
106
109
|
);
|
|
107
110
|
}
|
|
108
111
|
return (
|
|
109
|
-
<FullWidthFormComponentBox
|
|
112
|
+
<FullWidthFormComponentBox
|
|
113
|
+
data-test="q-item-string-box"
|
|
114
|
+
data-linkid={qItem.linkId}
|
|
115
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
110
116
|
<ItemFieldGrid qItem={qItem} readOnly={readOnly}>
|
|
111
117
|
<StringField
|
|
112
118
|
linkId={qItem.linkId}
|
|
@@ -37,6 +37,7 @@ import type {
|
|
|
37
37
|
import type { GroupTableRowModel } from '../../../interfaces/groupTable.interface';
|
|
38
38
|
import GroupTableBody from './GroupTableBody';
|
|
39
39
|
import Checkbox from '@mui/material/Checkbox';
|
|
40
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
40
41
|
|
|
41
42
|
interface GroupTableViewProps
|
|
42
43
|
extends PropsWithShowMinimalViewAttribute,
|
|
@@ -75,6 +76,8 @@ function GroupTableView(props: GroupTableViewProps) {
|
|
|
75
76
|
onReorderRows
|
|
76
77
|
} = props;
|
|
77
78
|
|
|
79
|
+
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
80
|
+
|
|
78
81
|
if (showMinimalView) {
|
|
79
82
|
return (
|
|
80
83
|
<QGroupContainerBox cardElevation={groupCardElevation} isRepeated={false} py={1}>
|
|
@@ -116,7 +119,8 @@ function GroupTableView(props: GroupTableViewProps) {
|
|
|
116
119
|
cardElevation={groupCardElevation}
|
|
117
120
|
isRepeated={false}
|
|
118
121
|
py={3}
|
|
119
|
-
data-linkid={qItem.linkId}
|
|
122
|
+
data-linkid={qItem.linkId}
|
|
123
|
+
onClick={() => onFocusLinkId(qItem.linkId)}>
|
|
120
124
|
{groupCardElevation !== 1 ? (
|
|
121
125
|
<>
|
|
122
126
|
<Typography
|