@aehrc/smart-forms-renderer 0.27.2 → 0.27.4
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/.storybook/main.ts +2 -1
- package/.storybook/preview.ts +6 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.d.ts +3 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +9 -17
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +12 -9
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +7 -9
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +12 -8
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +6 -4
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +5 -7
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +4 -4
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +2 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +5 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.js.map +1 -1
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js +1 -1
- package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js +20 -20
- package/lib/components/FormComponents/GroupItem/TabButtonsWrapper.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.d.ts +3 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +7 -19
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +40 -40
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +15 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.d.ts +2 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +27 -26
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/StringItem/StringField.js +1 -1
- package/lib/components/FormComponents/StringItem/StringField.js.map +1 -1
- package/lib/hooks/useInitialiseRenderer.js +1 -1
- package/lib/hooks/useInitialiseRenderer.js.map +1 -1
- package/lib/hooks/useNextAndPreviousVisibleTabs.d.ts +7 -0
- package/lib/hooks/useNextAndPreviousVisibleTabs.js +63 -0
- package/lib/hooks/useNextAndPreviousVisibleTabs.js.map +1 -0
- package/lib/hooks/useNextPreviousVisibleTabs.d.ts +6 -0
- package/lib/hooks/useNextPreviousVisibleTabs.js +63 -0
- package/lib/hooks/useNextPreviousVisibleTabs.js.map +1 -0
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -24
- package/lib/index.js.map +1 -1
- package/lib/utils/choice.d.ts +1 -7
- package/lib/utils/choice.js +10 -20
- package/lib/utils/choice.js.map +1 -1
- package/lib/utils/enableWhen.js +5 -7
- package/lib/utils/enableWhen.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/openChoice.d.ts +9 -4
- package/lib/utils/openChoice.js +47 -78
- package/lib/utils/openChoice.js.map +1 -1
- package/lib/utils/tabs.d.ts +0 -21
- package/lib/utils/tabs.js +0 -51
- package/lib/utils/tabs.js.map +1 -1
- package/package.json +4 -4
- package/src/components/FormComponents/ChoiceItems/CheckboxOptionList.tsx +82 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +23 -52
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +15 -9
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +17 -19
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +13 -8
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +5 -4
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +6 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionView.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +9 -16
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +4 -4
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +4 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +5 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionView.tsx +5 -1
- package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +1 -1
- package/src/components/FormComponents/GroupItem/TabButtonsWrapper.tsx +28 -25
- package/src/components/FormComponents/ItemParts/{RadioAnswerOptionButtons.tsx → RadioOptionList.tsx} +7 -7
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +18 -50
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +70 -68
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetFields.tsx +110 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetItem.tsx +188 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +46 -19
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +5 -3
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +37 -29
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetFields.tsx +104 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetItem.tsx +156 -0
- package/src/components/FormComponents/StringItem/StringField.tsx +1 -1
- package/src/hooks/useInitialiseRenderer.ts +1 -1
- package/src/hooks/useNextAndPreviousVisibleTabs.ts +86 -0
- package/src/hooks/useOpenLabel.ts +43 -0
- package/src/index.ts +0 -21
- package/src/stories/BuildFormWrapper.tsx +57 -0
- package/src/stories/assets/questionnaires/QAdvancedAdditionalDisplayContent.ts +83 -0
- package/src/stories/assets/questionnaires/QAdvancedControlAppearance.ts +294 -0
- package/src/stories/assets/questionnaires/QAdvancedOther.ts +495 -0
- package/src/stories/assets/questionnaires/QAdvancedTextApperance.ts +188 -0
- package/src/stories/assets/questionnaires/QAttachment.ts +38 -0
- package/src/stories/assets/questionnaires/QBehaviorCalculations.ts +645 -0
- package/src/stories/assets/questionnaires/QBehaviorChoiceRestriction.ts +281 -0
- package/src/stories/assets/questionnaires/QBehaviorOther.ts +1149 -0
- package/src/stories/assets/questionnaires/QBehaviorValueConstraints.ts +508 -0
- package/src/stories/assets/questionnaires/QBoolean.ts +130 -0
- package/src/stories/assets/questionnaires/QChoice.ts +137 -0
- package/src/stories/assets/questionnaires/QDate.ts +56 -0
- package/src/stories/assets/questionnaires/QDateTime.ts +56 -0
- package/src/stories/assets/questionnaires/QDecimal.ts +56 -0
- package/src/stories/assets/questionnaires/QDisplay.ts +38 -0
- package/src/stories/assets/questionnaires/QGroup.ts +52 -0
- package/src/stories/assets/questionnaires/QInteger.ts +119 -0
- package/src/stories/assets/questionnaires/QItemControlDisplay.ts +114 -0
- package/src/stories/assets/questionnaires/QItemControlGroup.ts +419 -0
- package/src/stories/assets/questionnaires/QItemControlQuestion.ts +1271 -0
- package/src/stories/assets/questionnaires/QOpenChoice.ts +151 -0
- package/src/stories/assets/questionnaires/QQuantity.ts +38 -0
- package/src/stories/assets/questionnaires/QReference.ts +38 -0
- package/src/stories/assets/questionnaires/QSingleItems.ts +251 -0
- package/src/stories/assets/questionnaires/QString.ts +131 -0
- package/src/stories/assets/questionnaires/QText.ts +169 -0
- package/src/stories/assets/questionnaires/QTime.ts +38 -0
- package/src/stories/assets/questionnaires/QUrl.ts +38 -0
- package/src/stories/assets/questionnaires/index.ts +44 -0
- package/src/stories/itemTypes/Attachment.stories.tsx +39 -0
- package/src/stories/itemTypes/Boolean.stories.tsx +72 -0
- package/src/stories/{MedicalHistoryTable.stories.tsx → itemTypes/Choice.stories.tsx} +32 -26
- package/src/stories/itemTypes/Date.stories.tsx +46 -0
- package/src/stories/itemTypes/DateTime.stories.tsx +45 -0
- package/src/stories/itemTypes/Decimal.stories.tsx +56 -0
- package/src/stories/itemTypes/Display.stories.tsx +39 -0
- package/src/stories/itemTypes/Group.stories.tsx +39 -0
- package/src/stories/itemTypes/Integer.stories.tsx +55 -0
- package/src/stories/itemTypes/OpenChoice.stories.tsx +64 -0
- package/src/stories/itemTypes/Quantity.stories.tsx +39 -0
- package/src/stories/itemTypes/Reference.stories.tsx +39 -0
- package/src/stories/itemTypes/String.stories.tsx +51 -0
- package/src/stories/itemTypes/Text.stories.tsx +51 -0
- package/src/stories/itemTypes/Time.stories.tsx +39 -0
- package/src/stories/itemTypes/Url.stories.tsx +39 -0
- package/src/stories/sdc/AdvancedAdditionalDisplayContent.stories.tsx +45 -0
- package/src/stories/sdc/AdvancedControlAppearance.stories.tsx +51 -0
- package/src/stories/sdc/AdvancedOther.stories.tsx +76 -0
- package/src/stories/sdc/AdvancedTextAppearance.stories.tsx +69 -0
- package/src/stories/sdc/BehaviorCalculations.stories.tsx +69 -0
- package/src/stories/sdc/BehaviorChoiceRestriction.stories.tsx +76 -0
- package/src/stories/sdc/BehaviorOther.stories.tsx +90 -0
- package/src/stories/sdc/BehaviorValueConstraints.stories.tsx +88 -0
- package/src/stories/sdc/ItemControlDisplay.stories.tsx +39 -0
- package/src/stories/sdc/ItemControlGroup.stories.tsx +55 -0
- package/src/stories/sdc/ItemControlQuestion.stories.tsx +118 -0
- package/src/utils/buildForm.ts +23 -0
- package/src/utils/choice.ts +16 -23
- package/src/utils/enableWhen.ts +5 -7
- package/src/utils/index.ts +1 -0
- package/src/utils/openChoice.ts +83 -98
- package/src/utils/tabs.ts +0 -75
- package/vite.config.ts +23 -0
- package/doctor-storybook.log +0 -18
- package/src/stories/SmartFormsRenderer.stories.ts +0 -139
- package/src/stories/assets/QItems-and-QRItems/QR_GTableMedicalHistory.json +0 -80
- package/src/stories/assets/QItems-and-QRItems/Q_GTableMedicalHistory.json +0 -109
- package/src/stories/assets/Qs-and-QRs/Q715.json +0 -15086
- package/src/stories/assets/Qs-and-QRs/QDev715.json +0 -16081
- package/src/stories/assets/Qs-and-QRs/QTestGrid.json +0 -411
- package/src/stories/assets/Qs-and-QRs/R715.json +0 -311
- package/src/stories/assets/Qs-and-QRs/RTestGrid.json +0 -34
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
19
|
+
import BuildFormWrapper from '../BuildFormWrapper';
|
|
20
|
+
import {
|
|
21
|
+
qCalculatedExpressionBMICalculator,
|
|
22
|
+
qCalculatedExpressionCvdRiskCalculator,
|
|
23
|
+
qInitialExpression,
|
|
24
|
+
qLaunchContext,
|
|
25
|
+
qVariable
|
|
26
|
+
} from '../assets/questionnaires';
|
|
27
|
+
|
|
28
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
29
|
+
const meta = {
|
|
30
|
+
title: 'Component/SDC/9.1.3 Form Behavior Calculations',
|
|
31
|
+
component: BuildFormWrapper,
|
|
32
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
33
|
+
tags: []
|
|
34
|
+
} satisfies Meta<typeof BuildFormWrapper>;
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
40
|
+
|
|
41
|
+
export const LaunchContext: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
questionnaire: qLaunchContext
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Variable: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
questionnaire: qVariable
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const InitialExpression: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
questionnaire: qInitialExpression
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const CalculatedExpressionBMICalculator: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
questionnaire: qCalculatedExpressionBMICalculator
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const CalculatedExpressionCvdRiskCalculator: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
questionnaire: qCalculatedExpressionCvdRiskCalculator
|
|
68
|
+
}
|
|
69
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
19
|
+
import BuildFormWrapper from '../BuildFormWrapper';
|
|
20
|
+
import {
|
|
21
|
+
qAnswerExpression,
|
|
22
|
+
qAnswerOption,
|
|
23
|
+
qAnswerValueSet,
|
|
24
|
+
qReadOnlyDuplicate,
|
|
25
|
+
qRepeatsDuplicate,
|
|
26
|
+
qRequiredDuplicate
|
|
27
|
+
} from '../assets/questionnaires';
|
|
28
|
+
|
|
29
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
30
|
+
const meta = {
|
|
31
|
+
title: 'Component/SDC/9.1.2 Form Behavior Choice Restriction',
|
|
32
|
+
component: BuildFormWrapper,
|
|
33
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
34
|
+
tags: ['autodocs']
|
|
35
|
+
} satisfies Meta<typeof BuildFormWrapper>;
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
type Story = StoryObj<typeof meta>;
|
|
39
|
+
|
|
40
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
41
|
+
|
|
42
|
+
export const AnswerOption: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
questionnaire: qAnswerOption
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const AnswerValueSet: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
questionnaire: qAnswerValueSet
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const AnswerExpression: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
questionnaire: qAnswerExpression
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Required: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
questionnaire: qRequiredDuplicate
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Repeats: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
questionnaire: qRepeatsDuplicate
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const ReadOnly: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
questionnaire: qReadOnlyDuplicate
|
|
75
|
+
}
|
|
76
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
19
|
+
import BuildFormWrapper from '../BuildFormWrapper';
|
|
20
|
+
import {
|
|
21
|
+
qEnableBehaviorAll,
|
|
22
|
+
qEnableBehaviorAny,
|
|
23
|
+
qEnableWhen,
|
|
24
|
+
qEnableWhenExpressionSimple,
|
|
25
|
+
qEnableWhenExpressionTabs,
|
|
26
|
+
qInitialRepeats,
|
|
27
|
+
qInitialSingle,
|
|
28
|
+
qText
|
|
29
|
+
} from '../assets/questionnaires'; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
30
|
+
|
|
31
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
32
|
+
const meta = {
|
|
33
|
+
title: 'Component/SDC/9.1.4 Form Behavior Other Control',
|
|
34
|
+
component: BuildFormWrapper,
|
|
35
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
36
|
+
tags: []
|
|
37
|
+
} satisfies Meta<typeof BuildFormWrapper>;
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof meta>;
|
|
41
|
+
|
|
42
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
43
|
+
|
|
44
|
+
export const InitialSingle: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
questionnaire: qInitialSingle
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const InitialRepeats: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
questionnaire: qInitialRepeats
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const EnableWhen: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
questionnaire: qEnableWhen
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const EnableBehaviorAll: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
questionnaire: qEnableBehaviorAll
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const EnableBehaviorAny: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
questionnaire: qEnableBehaviorAny
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const EnableWhenExpressionSimple: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
questionnaire: qEnableWhenExpressionSimple
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const EnableWhenExpressionTabs: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
questionnaire: qEnableWhenExpressionTabs
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const Text: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
questionnaire: qText
|
|
89
|
+
}
|
|
90
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
19
|
+
import BuildFormWrapper from '../BuildFormWrapper';
|
|
20
|
+
import {
|
|
21
|
+
qMaxDecimalPlaces,
|
|
22
|
+
qMaxLength,
|
|
23
|
+
qMaxValue,
|
|
24
|
+
qMinLength,
|
|
25
|
+
qMinValue,
|
|
26
|
+
qRegex,
|
|
27
|
+
qrMaxDecimalPlaces,
|
|
28
|
+
qrMaxLength,
|
|
29
|
+
qrMaxValue,
|
|
30
|
+
qrMinLength,
|
|
31
|
+
qrMinValue,
|
|
32
|
+
qrRegex
|
|
33
|
+
} from '../assets/questionnaires'; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
34
|
+
|
|
35
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
36
|
+
const meta = {
|
|
37
|
+
title: 'Component/SDC/9.1.1 Form Behavior Value Constraints',
|
|
38
|
+
component: BuildFormWrapper,
|
|
39
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
40
|
+
tags: []
|
|
41
|
+
} satisfies Meta<typeof BuildFormWrapper>;
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
type Story = StoryObj<typeof meta>;
|
|
45
|
+
|
|
46
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
47
|
+
|
|
48
|
+
export const MaxLength: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
questionnaire: qMaxLength,
|
|
51
|
+
questionnaireResponse: qrMaxLength
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const MinLength: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
questionnaire: qMinLength,
|
|
58
|
+
questionnaireResponse: qrMinLength
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Regex: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
questionnaire: qRegex,
|
|
65
|
+
questionnaireResponse: qrRegex
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const MinValue: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
questionnaire: qMinValue,
|
|
72
|
+
questionnaireResponse: qrMinValue
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const MaxValue: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
questionnaire: qMaxValue,
|
|
79
|
+
questionnaireResponse: qrMaxValue
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const MaxDecimalPlaces: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
questionnaire: qMaxDecimalPlaces,
|
|
86
|
+
questionnaireResponse: qrMaxDecimalPlaces
|
|
87
|
+
}
|
|
88
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
19
|
+
import BuildFormWrapper from '../BuildFormWrapper';
|
|
20
|
+
import { qItemControlDisplayLowerAndUpper } from '../assets/questionnaires'; // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
21
|
+
|
|
22
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
23
|
+
const meta = {
|
|
24
|
+
title: 'Component/SDC/8.1.2 Advanced Control Appearance - Item Control Display',
|
|
25
|
+
component: BuildFormWrapper,
|
|
26
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
27
|
+
tags: []
|
|
28
|
+
} satisfies Meta<typeof BuildFormWrapper>;
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
|
|
33
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
34
|
+
|
|
35
|
+
export const LowerAndUpper: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
questionnaire: qItemControlDisplayLowerAndUpper
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
19
|
+
import BuildFormWrapper from '../BuildFormWrapper';
|
|
20
|
+
import {
|
|
21
|
+
qItemControlDisplayTabContainer,
|
|
22
|
+
qItemControlGroupGrid,
|
|
23
|
+
qItemControlGroupGTable
|
|
24
|
+
} from '../assets/questionnaires';
|
|
25
|
+
|
|
26
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
27
|
+
const meta = {
|
|
28
|
+
title: 'Component/SDC/8.1.2 Advanced Control Appearance - Item Control Group',
|
|
29
|
+
component: BuildFormWrapper,
|
|
30
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
31
|
+
tags: []
|
|
32
|
+
} satisfies Meta<typeof BuildFormWrapper>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
38
|
+
|
|
39
|
+
export const Gtable: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
questionnaire: qItemControlGroupGTable
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Grid: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
questionnaire: qItemControlGroupGrid
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const TabContainer: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
questionnaire: qItemControlDisplayTabContainer
|
|
54
|
+
}
|
|
55
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
19
|
+
import BuildFormWrapper from '../BuildFormWrapper';
|
|
20
|
+
import {
|
|
21
|
+
qChoiceCheckboxAnswerOption,
|
|
22
|
+
qChoiceCheckboxAnswerValueSet,
|
|
23
|
+
qChoiceDropDownAnswerOption,
|
|
24
|
+
qChoiceDropDownAnswerValueSet,
|
|
25
|
+
qChoiceRadioAnswerOption,
|
|
26
|
+
qChoiceRadioAnswerValueSet,
|
|
27
|
+
qOpenChoiceAutocomplete,
|
|
28
|
+
qOpenChoiceCheckboxAnswerOption,
|
|
29
|
+
qOpenChoiceCheckboxAnswerValueSet,
|
|
30
|
+
qOpenChoiceRadioAnswerOption,
|
|
31
|
+
qOpenChoiceRadioAnswerValueSet,
|
|
32
|
+
qSliderStepValue
|
|
33
|
+
} from '../assets/questionnaires';
|
|
34
|
+
|
|
35
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
36
|
+
const meta = {
|
|
37
|
+
title: 'Component/SDC/8.1.2 Advanced Control Appearance - Item Control Question',
|
|
38
|
+
component: BuildFormWrapper,
|
|
39
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
40
|
+
tags: []
|
|
41
|
+
} satisfies Meta<typeof BuildFormWrapper>;
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
type Story = StoryObj<typeof meta>;
|
|
45
|
+
|
|
46
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
47
|
+
|
|
48
|
+
export const AutocompleteOpenChoice: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
questionnaire: qOpenChoiceAutocomplete
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const DropDownChoiceAnswerOption: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
questionnaire: qChoiceDropDownAnswerOption
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const DropDownChoiceAnswerValueSet: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
questionnaire: qChoiceDropDownAnswerValueSet
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const CheckboxChoiceAnswerOption: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
questionnaire: qChoiceCheckboxAnswerOption
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const CheckboxChoiceAnswerValueSet: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
questionnaire: qChoiceCheckboxAnswerValueSet
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const CheckboxOpenChoiceAnswerOption: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
questionnaire: qOpenChoiceCheckboxAnswerOption
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const CheckboxOpenChoiceAnswerValueSet: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
questionnaire: qOpenChoiceCheckboxAnswerValueSet
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const RadioChoiceAnswerOption: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
questionnaire: qChoiceRadioAnswerOption
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const RadioChoiceAnswerValueSet: Story = {
|
|
97
|
+
args: {
|
|
98
|
+
questionnaire: qChoiceRadioAnswerValueSet
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const RadioOpenChoiceAnswerOption: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
questionnaire: qOpenChoiceRadioAnswerOption
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const RadioOpenChoiceAnswerValueSet: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
questionnaire: qOpenChoiceRadioAnswerValueSet
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const SliderInteger: Story = {
|
|
115
|
+
args: {
|
|
116
|
+
questionnaire: qSliderStepValue
|
|
117
|
+
}
|
|
118
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
+
import { questionnaireResponseStore, questionnaireStore } from '../stores';
|
|
3
|
+
import { initialiseQuestionnaireResponse } from './initialise';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
|
|
7
|
+
* If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
|
|
8
|
+
*
|
|
9
|
+
* @author Sean Fong
|
|
10
|
+
*/
|
|
11
|
+
export async function buildForm(
|
|
12
|
+
questionnaire: Questionnaire,
|
|
13
|
+
questionnaireResponse?: QuestionnaireResponse
|
|
14
|
+
): Promise<void> {
|
|
15
|
+
await questionnaireStore.getState().buildSourceQuestionnaire(questionnaire);
|
|
16
|
+
|
|
17
|
+
const initialisedQuestionnaireResponse = initialiseQuestionnaireResponse(
|
|
18
|
+
questionnaire,
|
|
19
|
+
questionnaireResponse
|
|
20
|
+
);
|
|
21
|
+
questionnaireResponseStore.getState().buildSourceResponse(initialisedQuestionnaireResponse);
|
|
22
|
+
questionnaireStore.getState().updatePopulatedProperties(initialisedQuestionnaireResponse);
|
|
23
|
+
}
|
package/src/utils/choice.ts
CHANGED
|
@@ -149,17 +149,20 @@ export function getQrChoiceValue(
|
|
|
149
149
|
*
|
|
150
150
|
* @author Sean Fong
|
|
151
151
|
*/
|
|
152
|
-
export function
|
|
152
|
+
export function updateChoiceCheckboxAnswers(
|
|
153
153
|
changedValue: string,
|
|
154
154
|
answers: QuestionnaireResponseItemAnswer[],
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
options: QuestionnaireItemAnswerOption[],
|
|
156
|
+
oldQrItem: QuestionnaireResponseItem,
|
|
157
157
|
isMultiSelection: boolean
|
|
158
158
|
): QuestionnaireResponseItem | null {
|
|
159
159
|
// search for answer item of changedValue from list of answer options
|
|
160
|
-
const newAnswer = findInAnswerOptions(
|
|
161
|
-
if (!newAnswer)
|
|
160
|
+
const newAnswer = findInAnswerOptions(options, changedValue);
|
|
161
|
+
if (!newAnswer) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
162
164
|
|
|
165
|
+
// Process multi-selection
|
|
163
166
|
if (isMultiSelection && answers.length > 0) {
|
|
164
167
|
// check and filter if new answer exists in existing qrAnswers
|
|
165
168
|
const updatedAnswers = answers.filter(
|
|
@@ -171,12 +174,15 @@ export function updateQrCheckboxAnswers(
|
|
|
171
174
|
updatedAnswers.push(newAnswer);
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
return { ...
|
|
175
|
-
} else {
|
|
176
|
-
return answers.some((answer) => JSON.stringify(answer) === JSON.stringify(newAnswer))
|
|
177
|
-
? { ...qrChoiceCheckbox, answer: [] }
|
|
178
|
-
: { ...qrChoiceCheckbox, answer: [newAnswer] };
|
|
177
|
+
return { ...oldQrItem, answer: updatedAnswers };
|
|
179
178
|
}
|
|
179
|
+
|
|
180
|
+
// Process single selection
|
|
181
|
+
// If answer already exists, remove it from the array. Otherwise, add it to the array
|
|
182
|
+
const answerExists = answers.some(
|
|
183
|
+
(answer) => JSON.stringify(answer) === JSON.stringify(newAnswer)
|
|
184
|
+
);
|
|
185
|
+
return answerExists ? { ...oldQrItem, answer: [] } : { ...oldQrItem, answer: [newAnswer] };
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
/**
|
|
@@ -203,16 +209,3 @@ export function getChoiceOrientation(qItem: QuestionnaireItem): ChoiceItemOrient
|
|
|
203
209
|
|
|
204
210
|
return null;
|
|
205
211
|
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Converts an array of codings to an array of valueCodings which can use the QuestionnaireItemAnswerOption type
|
|
209
|
-
*
|
|
210
|
-
* @author Sean Fong
|
|
211
|
-
*/
|
|
212
|
-
export function mapCodingsToOptions(codings: Coding[]): QuestionnaireItemAnswerOption[] {
|
|
213
|
-
return codings.map((coding) => {
|
|
214
|
-
return {
|
|
215
|
-
valueCoding: coding
|
|
216
|
-
};
|
|
217
|
-
});
|
|
218
|
-
}
|
package/src/utils/enableWhen.ts
CHANGED
|
@@ -349,18 +349,16 @@ export function checkItemIsEnabledSingle(
|
|
|
349
349
|
);
|
|
350
350
|
|
|
351
351
|
// In a repeat item, if at least one answer satisfies the condition, the item is enabled
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
352
|
+
// FIXME need to look further at this
|
|
353
|
+
checkedIsEnabledItems.push(isEnabledForThisLinkedItem);
|
|
354
|
+
break;
|
|
356
355
|
}
|
|
357
356
|
continue;
|
|
358
357
|
}
|
|
359
358
|
|
|
360
359
|
// Linked item doesn't have any answers, but we still have to check for unanswered booleans
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
360
|
+
const checkedNonExistentAnswer = evaluateNonExistentAnswers(linkedItem.enableWhen);
|
|
361
|
+
checkedIsEnabledItems.push(checkedNonExistentAnswer);
|
|
364
362
|
}
|
|
365
363
|
|
|
366
364
|
if (checkedIsEnabledItems.length === 0) {
|
package/src/utils/index.ts
CHANGED