@aehrc/smart-forms-renderer 1.2.11 → 1.2.13
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/AttachmentItem.js +2 -2
- package/lib/components/FormComponents/AttachmentItem/AttachmentItem.js.map +1 -1
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js +2 -2
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/CheckboxOptionList.js +2 -1
- package/lib/components/FormComponents/ChoiceItems/CheckboxOptionList.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.d.ts +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.js +3 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js +5 -6
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioSingle.d.ts +2 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +61 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +5 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/DateTimeItems/CustomDateItem/CustomDateItem.js +2 -2
- package/lib/components/FormComponents/DateTimeItems/CustomDateItem/CustomDateItem.js.map +1 -1
- package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.js +2 -2
- package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.js.map +1 -1
- package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomTimeField.js +3 -3
- package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomTimeField.js.map +1 -1
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js +2 -2
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemView.js +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemView.js.map +1 -1
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js +2 -2
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/CheckboxSingle.d.ts +3 -1
- package/lib/components/FormComponents/ItemParts/CheckboxSingle.js +2 -2
- package/lib/components/FormComponents/ItemParts/CheckboxSingle.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/FadingCheckIcon.d.ts +7 -0
- package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js +26 -0
- package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js.map +1 -0
- package/lib/components/FormComponents/ItemParts/ItemLabel.js +1 -7
- package/lib/components/FormComponents/ItemParts/ItemLabel.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/ItemLabelText.d.ts +8 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelText.js +63 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelText.js.map +1 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.d.ts +8 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js +53 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js.map +1 -0
- package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.d.ts +7 -0
- package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.js +39 -0
- package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.js.map +1 -0
- package/lib/components/FormComponents/ItemParts/ItemTextSwitcher.js +3 -19
- package/lib/components/FormComponents/ItemParts/ItemTextSwitcher.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/RadioOptionList.js +2 -1
- package/lib/components/FormComponents/ItemParts/RadioOptionList.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/StyledText.d.ts +8 -0
- package/lib/components/FormComponents/ItemParts/StyledText.js +30 -0
- package/lib/components/FormComponents/ItemParts/StyledText.js.map +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.d.ts +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js +3 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js +5 -5
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetItem.js +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetItem.js +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.d.ts +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js +71 -4
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js +5 -6
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.d.ts +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js +3 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js +5 -6
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/QuantityItem/QuantityItem.js +2 -2
- package/lib/components/FormComponents/QuantityItem/QuantityItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.d.ts +10 -0
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js +30 -0
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js.map +1 -0
- package/lib/components/FormComponents/SliderItem/Slider.styles.d.ts +1 -1
- package/lib/components/FormComponents/SliderItem/SliderItem.js +2 -2
- package/lib/components/FormComponents/SliderItem/SliderItem.js.map +1 -1
- package/lib/components/FormComponents/StringItem/StringItem.js +2 -2
- package/lib/components/FormComponents/StringItem/StringItem.js.map +1 -1
- package/lib/components/FormComponents/TextItem/TextItem.js +2 -2
- package/lib/components/FormComponents/TextItem/TextItem.js.map +1 -1
- package/lib/components/FormComponents/TimeItem/TimeItem.js +2 -2
- package/lib/components/FormComponents/TimeItem/TimeItem.js.map +1 -1
- package/lib/components/FormComponents/UrlItem/UrlItem.js +2 -2
- package/lib/components/FormComponents/UrlItem/UrlItem.js.map +1 -1
- package/lib/components/Iconify/Iconify.d.ts +10 -0
- package/lib/components/Iconify/Iconify.js +26 -0
- package/lib/components/Iconify/Iconify.js.map +1 -0
- package/lib/components/Renderer/FormBodyPage.d.ts +9 -0
- package/lib/components/Renderer/FormBodyPage.js +43 -0
- package/lib/components/Renderer/FormBodyPage.js.map +1 -0
- package/lib/components/Renderer/FormTitle.d.ts +7 -0
- package/lib/components/Renderer/FormTitle.js +30 -0
- package/lib/components/Renderer/FormTitle.js.map +1 -0
- package/lib/components/Renderer/FormTopLevelPage.d.ts +9 -0
- package/lib/components/Renderer/FormTopLevelPage.js +29 -0
- package/lib/components/Renderer/FormTopLevelPage.js.map +1 -0
- package/lib/hooks/useBooleanCalculatedExpression.d.ts +12 -0
- package/lib/hooks/useBooleanCalculatedExpression.js +52 -0
- package/lib/hooks/useBooleanCalculatedExpression.js.map +1 -0
- package/lib/hooks/useCalculatedExpressionAnimating.d.ts +1 -0
- package/lib/hooks/useCalculatedExpressionAnimating.js +18 -0
- package/lib/hooks/useCalculatedExpressionAnimating.js.map +1 -0
- package/lib/hooks/useCalculatedExpressionUpdated.d.ts +1 -1
- package/lib/hooks/useCalculatedExpressionUpdated.js +18 -9
- package/lib/hooks/useCalculatedExpressionUpdated.js.map +1 -1
- package/lib/hooks/useDecimalCalculatedExpression.d.ts +13 -0
- package/lib/hooks/useDecimalCalculatedExpression.js +58 -0
- package/lib/hooks/useDecimalCalculatedExpression.js.map +1 -0
- package/lib/hooks/useInitialiseGroupTable.d.ts +4 -0
- package/lib/hooks/useInitialiseGroupTable.js +36 -0
- package/lib/hooks/useInitialiseGroupTable.js.map +1 -0
- package/lib/hooks/useIntegerCalculatedExpression.d.ts +12 -0
- package/lib/hooks/useIntegerCalculatedExpression.js +55 -0
- package/lib/hooks/useIntegerCalculatedExpression.js.map +1 -0
- package/lib/hooks/useNumberInput.d.ts +3 -0
- package/lib/hooks/useNumberInput.js +31 -0
- package/lib/hooks/useNumberInput.js.map +1 -0
- package/lib/hooks/useParseXhtml.d.ts +2 -2
- package/lib/hooks/useParseXhtml.js +5 -5
- package/lib/hooks/useParseXhtml.js.map +1 -1
- package/lib/hooks/useRepeatAnswers.d.ts +4 -0
- package/lib/hooks/useRepeatAnswers.js +34 -0
- package/lib/hooks/useRepeatAnswers.js.map +1 -0
- package/lib/hooks/useRepeatGroups.d.ts +4 -0
- package/lib/hooks/useRepeatGroups.js +34 -0
- package/lib/hooks/useRepeatGroups.js.map +1 -0
- package/lib/hooks/useShowFeedback.d.ts +11 -0
- package/lib/hooks/useShowFeedback.js +33 -0
- package/lib/hooks/useShowFeedback.js.map +1 -0
- package/lib/hooks/useStringCalculatedExpression.d.ts +14 -0
- package/lib/hooks/useStringCalculatedExpression.js +69 -0
- package/lib/hooks/useStringCalculatedExpression.js.map +1 -0
- package/lib/hooks/useStringInput.d.ts +3 -0
- package/lib/hooks/useStringInput.js +31 -0
- package/lib/hooks/useStringInput.js.map +1 -0
- package/lib/interfaces/itemPath.interface.d.ts +31 -0
- package/lib/interfaces/itemPath.interface.js +2 -0
- package/lib/interfaces/itemPath.interface.js.map +1 -0
- package/lib/interfaces/repeatItem.interface.d.ts +5 -0
- package/lib/interfaces/repeatItem.interface.js +2 -0
- package/lib/interfaces/repeatItem.interface.js.map +1 -0
- package/lib/stores/questionnaireStore.js +15 -2
- package/lib/stores/questionnaireStore.js.map +1 -1
- package/lib/stores/rendererStylingStore.d.ts +144 -0
- package/lib/stores/rendererStylingStore.js +68 -0
- package/lib/stores/rendererStylingStore.js.map +1 -0
- package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.d.ts +30 -0
- package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.js +46 -0
- package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.js.map +1 -0
- package/lib/stories/storybookWrappers/index.d.ts +2 -0
- package/lib/stories/storybookWrappers/index.js +18 -0
- package/lib/stories/storybookWrappers/index.js.map +1 -0
- package/lib/stories/testUtils.d.ts +23 -0
- package/lib/stories/testUtils.js +249 -0
- package/lib/stories/testUtils.js.map +1 -0
- package/lib/theme/Theme.d.ts +44 -0
- package/lib/theme/Theme.js +45 -0
- package/lib/theme/Theme.js.map +1 -0
- package/lib/theme/customGlobalStyles.d.ts +2 -0
- package/lib/theme/customGlobalStyles.js +61 -0
- package/lib/theme/customGlobalStyles.js.map +1 -0
- package/lib/theme/overrides/Accordion.d.ts +14 -0
- package/lib/theme/overrides/Accordion.js +32 -0
- package/lib/theme/overrides/Accordion.js.map +1 -0
- package/lib/theme/overrides/Autocomplete.d.ts +10 -0
- package/lib/theme/overrides/Autocomplete.js +28 -0
- package/lib/theme/overrides/Autocomplete.js.map +1 -0
- package/lib/theme/overrides/Button.d.ts +33 -0
- package/lib/theme/overrides/Button.js +52 -0
- package/lib/theme/overrides/Button.js.map +1 -0
- package/lib/theme/overrides/Card.d.ts +35 -0
- package/lib/theme/overrides/Card.js +49 -0
- package/lib/theme/overrides/Card.js.map +1 -0
- package/lib/theme/overrides/Input.d.ts +64 -0
- package/lib/theme/overrides/Input.js +81 -0
- package/lib/theme/overrides/Input.js.map +1 -0
- package/lib/theme/overrides/Overrides.d.ts +3 -0
- package/lib/theme/overrides/Overrides.js +29 -0
- package/lib/theme/overrides/Overrides.js.map +1 -0
- package/lib/theme/overrides/Paper.d.ts +12 -0
- package/lib/theme/overrides/Paper.js +31 -0
- package/lib/theme/overrides/Paper.js.map +1 -0
- package/lib/theme/overrides/SpeedDial.d.ts +16 -0
- package/lib/theme/overrides/SpeedDial.js +34 -0
- package/lib/theme/overrides/SpeedDial.js.map +1 -0
- package/lib/theme/overrides/Table.d.ts +12 -0
- package/lib/theme/overrides/Table.js +30 -0
- package/lib/theme/overrides/Table.js.map +1 -0
- package/lib/theme/palette.d.ts +27 -0
- package/lib/theme/palette.js +67 -0
- package/lib/theme/palette.js.map +1 -0
- package/lib/theme/shadows.d.ts +2 -0
- package/lib/theme/shadows.js +52 -0
- package/lib/theme/shadows.js.map +1 -0
- package/lib/utils/answerExpression.d.ts +18 -0
- package/lib/utils/answerExpression.js +133 -0
- package/lib/utils/answerExpression.js.map +1 -0
- package/lib/utils/calculatedExpression.js +1 -5
- package/lib/utils/calculatedExpression.js.map +1 -1
- package/lib/utils/dayjsExtend.d.ts +1 -0
- package/lib/utils/dayjsExtend.js +22 -0
- package/lib/utils/dayjsExtend.js.map +1 -0
- package/lib/utils/dynamicValueSet.d.ts +5 -0
- package/lib/utils/dynamicValueSet.js +96 -0
- package/lib/utils/dynamicValueSet.js.map +1 -0
- package/lib/utils/extensions.d.ts +2 -2
- package/lib/utils/extensions.js +2 -2
- package/lib/utils/extensions.js.map +1 -1
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.d.ts +14 -0
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.js +639 -0
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.js.map +1 -0
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.d.ts +3 -0
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.js +41 -0
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.js.map +1 -0
- package/lib/utils/itemControl.d.ts +97 -0
- package/lib/utils/itemControl.js +336 -0
- package/lib/utils/itemControl.js.map +1 -0
- package/lib/utils/itemPath.d.ts +57 -0
- package/lib/utils/itemPath.js +75 -0
- package/lib/utils/itemPath.js.map +1 -0
- package/lib/utils/manageForm.js +5 -4
- package/lib/utils/manageForm.js.map +1 -1
- package/lib/utils/qrItem.d.ts +6 -0
- package/lib/utils/qrItem.js +11 -0
- package/lib/utils/qrItem.js.map +1 -1
- package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.d.ts +2 -0
- package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js +43 -0
- package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js.map +1 -0
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.d.ts +3 -0
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +101 -0
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -0
- package/lib/utils/validateQuestionnaire.d.ts +66 -0
- package/lib/utils/validateQuestionnaire.js +559 -0
- package/lib/utils/validateQuestionnaire.js.map +1 -0
- package/package.json +2 -2
- package/src/components/FormComponents/AttachmentItem/AttachmentItem.tsx +2 -2
- package/src/components/FormComponents/BooleanItem/BooleanItem.tsx +2 -2
- package/src/components/FormComponents/ChoiceItems/CheckboxOptionList.tsx +5 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.tsx +5 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +6 -4
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +2 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +2 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +2 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +2 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioSingle.tsx +1 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +93 -4
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +2 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +4 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +2 -2
- package/src/components/FormComponents/DateTimeItems/CustomDateItem/CustomDateItem.tsx +2 -2
- package/src/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.tsx +2 -2
- package/src/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomTimeField.tsx +3 -1
- package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +2 -2
- package/src/components/FormComponents/GroupItem/GroupItemView.tsx +1 -1
- package/src/components/FormComponents/IntegerItem/IntegerItem.tsx +2 -2
- package/src/components/FormComponents/ItemParts/CheckboxSingle.tsx +4 -2
- package/src/components/FormComponents/ItemParts/ItemLabel.tsx +1 -8
- package/src/components/FormComponents/ItemParts/ItemTextSwitcher.tsx +3 -25
- package/src/components/FormComponents/ItemParts/RadioOptionList.tsx +4 -1
- package/src/components/FormComponents/ItemParts/StyledText.tsx +46 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx +4 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +6 -3
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +2 -2
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerValueSetItem.tsx +2 -2
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +2 -2
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetItem.tsx +2 -2
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +86 -3
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +6 -4
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.tsx +4 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +6 -4
- package/src/components/FormComponents/QuantityItem/QuantityItem.tsx +2 -2
- package/src/components/FormComponents/SliderItem/SliderItem.tsx +2 -2
- package/src/components/FormComponents/StringItem/StringItem.tsx +2 -2
- package/src/components/FormComponents/TextItem/TextItem.tsx +2 -2
- package/src/components/FormComponents/TimeItem/TimeItem.tsx +2 -2
- package/src/components/FormComponents/UrlItem/UrlItem.tsx +2 -2
- package/src/hooks/useCalculatedExpressionUpdated.ts +25 -11
- package/src/hooks/useParseXhtml.tsx +9 -6
- package/src/stores/questionnaireStore.ts +23 -0
- package/src/utils/calculatedExpression.ts +1 -5
- package/src/utils/extensions.ts +9 -3
- package/src/utils/manageForm.ts +10 -9
- package/src/utils/qrItem.ts +12 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Coding, OperationOutcome } from 'fhir/r4b';
|
|
2
|
+
export declare function CreateOperationOutcome(severity: 'error' | 'fatal' | 'warning' | 'information', code: 'invalid' | 'structure' | 'required' | 'value' | 'invariant' | 'security' | 'login' | 'unknown' | 'expired' | 'forbidden' | 'suppressed' | 'processing' | 'not-supported' | 'duplicate' | 'multiple-matches' | 'not-found' | 'deleted' | 'too-long' | 'code-invalid' | 'extension' | 'too-costly' | 'business-rule' | 'conflict' | 'transient' | 'lock-error' | 'no-store' | 'exception' | 'timeout' | 'incomplete' | 'throttled' | 'informational', message: string, coding?: Coding, diagnostics?: string): fhir4b.OperationOutcome;
|
|
3
|
+
export declare function logMessage(enabled: boolean, outcome: OperationOutcome, message: string, data?: any): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// --------------------------------------------------------------------------
|
|
2
|
+
// From: https://github.com/brianpos/fhirpathjs-async-poc/commit/950475900d09bf399574c24f142f3eeae1552fe6
|
|
3
|
+
// Forked from: https://github.com/brianpos/fhirpathjs-async-poc
|
|
4
|
+
// --------------------------------------------------------------------------
|
|
5
|
+
export function CreateOperationOutcome(severity, code, message, coding, diagnostics) {
|
|
6
|
+
const result = {
|
|
7
|
+
resourceType: 'OperationOutcome',
|
|
8
|
+
issue: []
|
|
9
|
+
};
|
|
10
|
+
const issue = {
|
|
11
|
+
severity: severity,
|
|
12
|
+
code: code,
|
|
13
|
+
details: { text: message }
|
|
14
|
+
};
|
|
15
|
+
if (coding && issue.details)
|
|
16
|
+
issue.details.coding = [coding];
|
|
17
|
+
if (diagnostics)
|
|
18
|
+
issue.diagnostics = diagnostics;
|
|
19
|
+
result.issue.push(issue);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
export function logMessage(enabled, outcome, message, data) {
|
|
23
|
+
if (enabled) {
|
|
24
|
+
// and append it into the outcome issues
|
|
25
|
+
const issue = {
|
|
26
|
+
severity: 'information',
|
|
27
|
+
code: 'informational',
|
|
28
|
+
details: { text: message }
|
|
29
|
+
};
|
|
30
|
+
outcome.issue.push(issue);
|
|
31
|
+
if (typeof data === 'string' || typeof data === 'number' || typeof data === 'boolean')
|
|
32
|
+
issue.details.text += '' + data;
|
|
33
|
+
if (data) {
|
|
34
|
+
if (typeof data === 'string')
|
|
35
|
+
issue.diagnostics = data;
|
|
36
|
+
else
|
|
37
|
+
issue.diagnostics = JSON.stringify(data);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=outcome-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome-utils.js","sourceRoot":"","sources":["../../../src/utils/fhirpathAsyncUtils/outcome-utils.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,yGAAyG;AACzG,gEAAgE;AAChE,6EAA6E;AAE7E,MAAM,UAAU,sBAAsB,CACpC,QAAuD,EACvD,IA+BmB,EACnB,OAAe,EACf,MAAe,EACf,WAAoB;IAEpB,MAAM,MAAM,GAA4B;QACtC,YAA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/regex.interface';
|
|
3
|
+
export declare function shouldRenderNestedItems(qItem: QuestionnaireItem): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Check if the extension has an itemControl code equal to the given itemControlCode
|
|
6
|
+
*
|
|
7
|
+
* @author Sean Fong
|
|
8
|
+
*/
|
|
9
|
+
export declare function isSpecificItemControl(qItem: QuestionnaireItem, itemControlCode: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Check if the extension has an displayCategory code equal to the given displayCategory
|
|
12
|
+
*
|
|
13
|
+
* @author Sean Fong
|
|
14
|
+
*/
|
|
15
|
+
export declare function isSpecificDisplayCategory(qItem: QuestionnaireItem, itemControlCode: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Check if the extension has url for items that use shortText
|
|
18
|
+
*
|
|
19
|
+
* @author Sean Fong
|
|
20
|
+
*/
|
|
21
|
+
export declare function getShortText(qItem: QuestionnaireItem): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Check if the extension has url for hidden questions
|
|
24
|
+
*
|
|
25
|
+
* @author Sean Fong
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasHiddenExtension(qItem: QuestionnaireItem): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Check if the extension has url for items that use open label
|
|
30
|
+
*
|
|
31
|
+
* @author Sean Fong
|
|
32
|
+
*/
|
|
33
|
+
export declare function getOpenLabelText(qItem: QuestionnaireItem): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Check if the decimal value has a quantity precision for the decimal value
|
|
36
|
+
*
|
|
37
|
+
* @author Sean Fong
|
|
38
|
+
*/
|
|
39
|
+
export declare function getDecimalPrecision(qItem: QuestionnaireItem): number | null;
|
|
40
|
+
/**
|
|
41
|
+
* Check if the extension has a url for xhtml rendering
|
|
42
|
+
*
|
|
43
|
+
* @author Sean Fong
|
|
44
|
+
*/
|
|
45
|
+
export declare function getXHtmlString(qItem: QuestionnaireItem): string | null;
|
|
46
|
+
export declare function getXHtmlStringFromExtension(extensions: Extension[]): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Check if the item label (text) has a valueMarkdown extension
|
|
49
|
+
*
|
|
50
|
+
* @author Sean Fong
|
|
51
|
+
*/
|
|
52
|
+
export declare function getMarkdownString(qItem: QuestionnaireItem): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Get text display prompt for items with itemControlCode prompt and has a prompt childItem
|
|
55
|
+
*
|
|
56
|
+
* @author Sean Fong
|
|
57
|
+
*/
|
|
58
|
+
export declare function getTextDisplayPrompt(qItem: QuestionnaireItem): string;
|
|
59
|
+
/**
|
|
60
|
+
* Get decimal text display unit for items with itemControlCode unit and has a unit childItem
|
|
61
|
+
*
|
|
62
|
+
* @author Sean Fong
|
|
63
|
+
*/
|
|
64
|
+
export declare function getTextDisplayUnit(qItem: QuestionnaireItem): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get text display lower bound for items with itemControlCode "lower" and has a "lower" childItem
|
|
67
|
+
*
|
|
68
|
+
* @author Sean Fong
|
|
69
|
+
*/
|
|
70
|
+
export declare function getTextDisplayLower(qItem: QuestionnaireItem): string;
|
|
71
|
+
/**
|
|
72
|
+
* Get text display upper bound for items with itemControlCode "upper" and has a "upper" childItem
|
|
73
|
+
*
|
|
74
|
+
* @author Sean Fong
|
|
75
|
+
*/
|
|
76
|
+
export declare function getTextDisplayUpper(qItem: QuestionnaireItem): string;
|
|
77
|
+
/**
|
|
78
|
+
* Get text display instructions for items with itemControlCode instructions and has an instructions childItem
|
|
79
|
+
*
|
|
80
|
+
* @author Sean Fong
|
|
81
|
+
*/
|
|
82
|
+
export declare function getTextDisplayInstructions(qItem: QuestionnaireItem): string;
|
|
83
|
+
/**
|
|
84
|
+
* Get text display flyover for items with itemControlCode flyover and has an flyover childItem
|
|
85
|
+
*
|
|
86
|
+
* @author Sean Fong
|
|
87
|
+
*/
|
|
88
|
+
export declare function getTextDisplayFlyover(qItem: QuestionnaireItem): string;
|
|
89
|
+
/**
|
|
90
|
+
* Get regex validation for items with regex extensions
|
|
91
|
+
*
|
|
92
|
+
* @author Sean Fong
|
|
93
|
+
*/
|
|
94
|
+
export declare function getRegexValidation(qItem: QuestionnaireItem): RegexValidation | undefined;
|
|
95
|
+
export declare function getRegexString(qItem: QuestionnaireItem): string | null;
|
|
96
|
+
export declare function getMinValue(qItem: QuestionnaireItem): string | number | undefined;
|
|
97
|
+
export declare function getMaxValue(qItem: QuestionnaireItem): string | number | undefined;
|
|
@@ -0,0 +1,336 @@
|
|
|
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
|
+
import { structuredDataCapture } from 'fhir-sdc-helpers';
|
|
18
|
+
function hasDisplayCategory(qItem) {
|
|
19
|
+
var _a;
|
|
20
|
+
return !!((_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.some((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory'));
|
|
21
|
+
}
|
|
22
|
+
function hasItemControl(qItem) {
|
|
23
|
+
var _a;
|
|
24
|
+
return !!((_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.some((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl'));
|
|
25
|
+
}
|
|
26
|
+
// If all nested items are of type display and have itemControl, then they should not be rendered
|
|
27
|
+
export function shouldRenderNestedItems(qItem) {
|
|
28
|
+
var _a;
|
|
29
|
+
return !((_a = qItem.item) === null || _a === void 0 ? void 0 : _a.every((childItem) => childItem.type === 'display' && (hasDisplayCategory(childItem) || hasItemControl(childItem))));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if the extension has an itemControl code equal to the given itemControlCode
|
|
33
|
+
*
|
|
34
|
+
* @author Sean Fong
|
|
35
|
+
*/
|
|
36
|
+
export function isSpecificItemControl(qItem, itemControlCode) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
const itemControl = (_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl');
|
|
39
|
+
if (itemControl) {
|
|
40
|
+
const code = (_c = (_b = itemControl.valueCodeableConcept) === null || _b === void 0 ? void 0 : _b.coding) === null || _c === void 0 ? void 0 : _c.find((coding) => coding.code === itemControlCode);
|
|
41
|
+
if (code) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check if the extension has an displayCategory code equal to the given displayCategory
|
|
49
|
+
*
|
|
50
|
+
* @author Sean Fong
|
|
51
|
+
*/
|
|
52
|
+
export function isSpecificDisplayCategory(qItem, itemControlCode) {
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
const displayCategory = (_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory');
|
|
55
|
+
if (displayCategory) {
|
|
56
|
+
const code = (_c = (_b = displayCategory.valueCodeableConcept) === null || _b === void 0 ? void 0 : _b.coding) === null || _c === void 0 ? void 0 : _c.find((coding) => coding.code === itemControlCode);
|
|
57
|
+
if (code) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Check if the extension has url for items that use shortText
|
|
65
|
+
*
|
|
66
|
+
* @author Sean Fong
|
|
67
|
+
*/
|
|
68
|
+
export function getShortText(qItem) {
|
|
69
|
+
var _a;
|
|
70
|
+
const itemControl = (_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-shortText');
|
|
71
|
+
if (itemControl) {
|
|
72
|
+
if (itemControl.valueString) {
|
|
73
|
+
return itemControl.valueString;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if the extension has url for hidden questions
|
|
80
|
+
*
|
|
81
|
+
* @author Sean Fong
|
|
82
|
+
*/
|
|
83
|
+
export function hasHiddenExtension(qItem) {
|
|
84
|
+
var _a;
|
|
85
|
+
const itemControl = (_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-hidden');
|
|
86
|
+
if (itemControl) {
|
|
87
|
+
if (itemControl.valueBoolean) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Check if the extension has url for items that use open label
|
|
95
|
+
*
|
|
96
|
+
* @author Sean Fong
|
|
97
|
+
*/
|
|
98
|
+
export function getOpenLabelText(qItem) {
|
|
99
|
+
var _a;
|
|
100
|
+
const itemControl = (_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-openLabel');
|
|
101
|
+
if (itemControl) {
|
|
102
|
+
if (itemControl.valueString) {
|
|
103
|
+
return itemControl.valueString;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check if the decimal value has a quantity precision for the decimal value
|
|
110
|
+
*
|
|
111
|
+
* @author Sean Fong
|
|
112
|
+
*/
|
|
113
|
+
export function getDecimalPrecision(qItem) {
|
|
114
|
+
var _a;
|
|
115
|
+
const itemControl = (_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/quantity-precision');
|
|
116
|
+
if (itemControl) {
|
|
117
|
+
if (itemControl.valueInteger) {
|
|
118
|
+
return itemControl.valueInteger;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Check if the extension has a url for xhtml rendering
|
|
125
|
+
*
|
|
126
|
+
* @author Sean Fong
|
|
127
|
+
*/
|
|
128
|
+
export function getXHtmlString(qItem) {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
let xHtmlString = null;
|
|
131
|
+
if (qItem.extension) {
|
|
132
|
+
xHtmlString = getXHtmlStringFromExtension(qItem.extension);
|
|
133
|
+
if (xHtmlString) {
|
|
134
|
+
return xHtmlString;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if ((_a = qItem._text) === null || _a === void 0 ? void 0 : _a.extension) {
|
|
138
|
+
xHtmlString = getXHtmlStringFromExtension((_b = qItem._text) === null || _b === void 0 ? void 0 : _b.extension);
|
|
139
|
+
if (xHtmlString) {
|
|
140
|
+
return xHtmlString;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
export function getXHtmlStringFromExtension(extensions) {
|
|
146
|
+
const itemControl = extensions === null || extensions === void 0 ? void 0 : extensions.find((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml');
|
|
147
|
+
if (itemControl) {
|
|
148
|
+
if (itemControl.valueString) {
|
|
149
|
+
return itemControl.valueString;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Check if the item label (text) has a valueMarkdown extension
|
|
156
|
+
*
|
|
157
|
+
* @author Sean Fong
|
|
158
|
+
*/
|
|
159
|
+
export function getMarkdownString(qItem) {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
const itemControl = (_b = (_a = qItem._text) === null || _a === void 0 ? void 0 : _a.extension) === null || _b === void 0 ? void 0 : _b.find((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/rendering-markdown');
|
|
162
|
+
if (itemControl) {
|
|
163
|
+
if (itemControl.valueMarkdown) {
|
|
164
|
+
return itemControl.valueMarkdown;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get text display prompt for items with itemControlCode prompt and has a prompt childItem
|
|
171
|
+
*
|
|
172
|
+
* @author Sean Fong
|
|
173
|
+
*/
|
|
174
|
+
export function getTextDisplayPrompt(qItem) {
|
|
175
|
+
if (qItem.item) {
|
|
176
|
+
for (const childItem of qItem.item) {
|
|
177
|
+
if (childItem.type === 'display' && isSpecificItemControl(childItem, 'prompt')) {
|
|
178
|
+
const promptText = `${childItem.text}`;
|
|
179
|
+
return promptText[0].toUpperCase() + promptText.substring(1);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return '';
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get decimal text display unit for items with itemControlCode unit and has a unit childItem
|
|
187
|
+
*
|
|
188
|
+
* @author Sean Fong
|
|
189
|
+
*/
|
|
190
|
+
export function getTextDisplayUnit(qItem) {
|
|
191
|
+
var _a, _b;
|
|
192
|
+
// Check if the item has a display unit childItem
|
|
193
|
+
if (qItem.item) {
|
|
194
|
+
for (const childItem of qItem.item) {
|
|
195
|
+
if (childItem.type === 'display' && isSpecificItemControl(childItem, 'unit')) {
|
|
196
|
+
return `${childItem.text}`;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// Otherwise, check if the item has a unit extension
|
|
201
|
+
const itemControl = (_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit');
|
|
202
|
+
if (itemControl && itemControl.valueCoding) {
|
|
203
|
+
return (_b = itemControl.valueCoding.display) !== null && _b !== void 0 ? _b : '';
|
|
204
|
+
}
|
|
205
|
+
return '';
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get text display lower bound for items with itemControlCode "lower" and has a "lower" childItem
|
|
209
|
+
*
|
|
210
|
+
* @author Sean Fong
|
|
211
|
+
*/
|
|
212
|
+
export function getTextDisplayLower(qItem) {
|
|
213
|
+
if (qItem.item) {
|
|
214
|
+
for (const childItem of qItem.item) {
|
|
215
|
+
if (childItem.type === 'display' && isSpecificItemControl(childItem, 'lower')) {
|
|
216
|
+
return `${childItem.text}`;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return '';
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Get text display upper bound for items with itemControlCode "upper" and has a "upper" childItem
|
|
224
|
+
*
|
|
225
|
+
* @author Sean Fong
|
|
226
|
+
*/
|
|
227
|
+
export function getTextDisplayUpper(qItem) {
|
|
228
|
+
if (qItem.item) {
|
|
229
|
+
for (const childItem of qItem.item) {
|
|
230
|
+
if (childItem.type === 'display' && isSpecificItemControl(childItem, 'upper')) {
|
|
231
|
+
return `${childItem.text}`;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return '';
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Get text display instructions for items with itemControlCode instructions and has an instructions childItem
|
|
239
|
+
*
|
|
240
|
+
* @author Sean Fong
|
|
241
|
+
*/
|
|
242
|
+
export function getTextDisplayInstructions(qItem) {
|
|
243
|
+
if (qItem.item) {
|
|
244
|
+
for (const childItem of qItem.item) {
|
|
245
|
+
if (childItem.type === 'display' && isSpecificDisplayCategory(childItem, 'instructions')) {
|
|
246
|
+
return `${childItem.text}`;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return '';
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Get text display flyover for items with itemControlCode flyover and has an flyover childItem
|
|
254
|
+
*
|
|
255
|
+
* @author Sean Fong
|
|
256
|
+
*/
|
|
257
|
+
export function getTextDisplayFlyover(qItem) {
|
|
258
|
+
if (qItem.item) {
|
|
259
|
+
for (const childItem of qItem.item) {
|
|
260
|
+
if (childItem.type === 'display' && isSpecificItemControl(childItem, 'flyover')) {
|
|
261
|
+
return `${childItem.text}`;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return '';
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Get regex validation for items with regex extensions
|
|
269
|
+
*
|
|
270
|
+
* @author Sean Fong
|
|
271
|
+
*/
|
|
272
|
+
export function getRegexValidation(qItem) {
|
|
273
|
+
// Get regex expression from extension
|
|
274
|
+
const regexString = getRegexString(qItem);
|
|
275
|
+
if (regexString) {
|
|
276
|
+
return { expression: new RegExp(regexString), feedback: null };
|
|
277
|
+
}
|
|
278
|
+
// Get regex expression from item types if regex extensions not present
|
|
279
|
+
if (qItem.type === 'url') {
|
|
280
|
+
return { expression: new RegExp(/^\S*$/), feedback: 'URLs should not contain any whitespaces' };
|
|
281
|
+
}
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
export function getRegexString(qItem) {
|
|
285
|
+
var _a;
|
|
286
|
+
const itemControl = (_a = qItem.extension) === null || _a === void 0 ? void 0 : _a.find((extension) => extension.url === 'http://hl7.org/fhir/StructureDefinition/regex');
|
|
287
|
+
if (itemControl) {
|
|
288
|
+
const extensionString = itemControl.valueString;
|
|
289
|
+
if (extensionString) {
|
|
290
|
+
let regexString;
|
|
291
|
+
if (extensionString.includes('matches(')) {
|
|
292
|
+
regexString = extensionString.substring(extensionString.indexOf("matches('") + "matches('".length, extensionString.lastIndexOf("')"));
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
regexString = extensionString;
|
|
296
|
+
}
|
|
297
|
+
return regexString;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
export function getMinValue(qItem) {
|
|
303
|
+
var _a, _b;
|
|
304
|
+
switch (qItem.type) {
|
|
305
|
+
case 'integer':
|
|
306
|
+
return structuredDataCapture.getMinValueAsInteger(qItem);
|
|
307
|
+
case 'decimal':
|
|
308
|
+
// In the case for decimals, permit minValue to be a decimal or integer
|
|
309
|
+
return ((_a = structuredDataCapture.getMinValueAsDecimal(qItem)) !== null && _a !== void 0 ? _a : structuredDataCapture.getMinValueAsInteger(qItem));
|
|
310
|
+
case 'date':
|
|
311
|
+
return structuredDataCapture.getMinValueAsDate(qItem);
|
|
312
|
+
case 'dateTime':
|
|
313
|
+
// In the case for dateTime, permit minValue to be a dateTime or date
|
|
314
|
+
return ((_b = structuredDataCapture.getMinValueAsDateTime(qItem)) !== null && _b !== void 0 ? _b : structuredDataCapture.getMinValueAsDate(qItem));
|
|
315
|
+
default:
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
export function getMaxValue(qItem) {
|
|
320
|
+
var _a, _b;
|
|
321
|
+
switch (qItem.type) {
|
|
322
|
+
case 'integer':
|
|
323
|
+
return structuredDataCapture.getMaxValueAsInteger(qItem);
|
|
324
|
+
case 'decimal':
|
|
325
|
+
// In the case for decimals, permit maxValue to be a decimal or integer
|
|
326
|
+
return ((_a = structuredDataCapture.getMaxValueAsDecimal(qItem)) !== null && _a !== void 0 ? _a : structuredDataCapture.getMaxValueAsInteger(qItem));
|
|
327
|
+
case 'date':
|
|
328
|
+
return structuredDataCapture.getMaxValueAsDate(qItem);
|
|
329
|
+
case 'dateTime':
|
|
330
|
+
// In the case for dateTime, permit maxValue to be a dateTime or date
|
|
331
|
+
return ((_b = structuredDataCapture.getMaxValueAsDateTime(qItem)) !== null && _b !== void 0 ? _b : structuredDataCapture.getMaxValueAsDate(qItem));
|
|
332
|
+
default:
|
|
333
|
+
return undefined;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=itemControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"itemControl.js","sourceRoot":"","sources":["../../src/utils/itemControl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,SAAS,kBAAkB,CAAC,KAAwB;;IAClD,OAAO,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,IAAI,CAC5B,CAAC,SAAoB,EAAE,EAAE,CACvB,SAAS,CAAC,GAAG,KAAK,uEAAuE,CAC5F,CAAA,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAwB;;IAC9C,OAAO,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,IAAI,CAC5B,CAAC,SAAoB,EAAE,EAAE,CACvB,SAAS,CAAC,GAAG,KAAK,mEAAmE,CACxF,CAAA,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,uBAAuB,CAAC,KAAwB;;IAC9D,OAAO,CAAC,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,KAAK,CACvB,CAAC,SAAS,EAAE,EAAE,CACZ,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC,CAC/F,CAAA,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAwB,EAAE,eAAuB;;IACrF,MAAM,WAAW,GAAG,MAAA,KAAK,CAAC,SAAS,0CAAE,IAA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C,CAAC;QACJ;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAwB;;IAClD,QAAQ,KAAK,CAAC,IAAI,EAAE;QAClB,KAAK,SAAS;YACZ,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC3D,KAAK,SAAS;YACZ,uEAAuE;YACvE,OAAO,CACL,MAAA,qBAAqB,CAAC,oBAAoB,CAAC,KAAK,CAAC,mCACjD,qBAAqB,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAClD,CAAC;QACJ,KAAK,MAAM;YACT,OAAO,qBAAqB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACxD,KAAK,UAAU;YACb,qEAAqE;YACrE,OAAO,CACL,MAAA,qBAAqB,CAAC,qBAAqB,CAAC,KAAK,CAAC,mCAClD,qBAAqB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAC/C,CAAC;QACJ;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ItemPath } from '../interfaces/itemPath.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an `ItemPath` containing a single segment for the given `linkId`.
|
|
4
|
+
* This is useful when you want to construct a path to a specific item without referencing its ancestry,
|
|
5
|
+
* such as when working with top-level items or when only the item's identity is relevant.
|
|
6
|
+
*
|
|
7
|
+
* @param linkId - The `linkId` of the item.
|
|
8
|
+
* @param repeatIndex - (Optional) If the item is part of a repeating group, specify its index.
|
|
9
|
+
* @returns An `ItemPath` containing one segment.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const path = createSingleItemPath('question-1');
|
|
14
|
+
* // Output: [{ linkId: 'question-1' }]
|
|
15
|
+
*
|
|
16
|
+
* const pathWithRepeat = createSingleItemPath('question-1', 2);
|
|
17
|
+
* // Output: [{ linkId: 'question-1', repeatIndex: 2 }]
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function createSingleItemPath(linkId: string, repeatIndex?: number): ItemPath;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new `ItemPath` by extending the given path with a new segment for the provided `linkId`.
|
|
23
|
+
* This version does NOT include a `repeatIndex`. If repeat handling is needed,
|
|
24
|
+
* use `appendRepeatIndexToLastSegment` after extending.
|
|
25
|
+
*
|
|
26
|
+
* @param currentPath - The existing item path.
|
|
27
|
+
* @param linkId - The `linkId` to use in the new path segment.
|
|
28
|
+
* @returns A new `ItemPath` with the added segment.
|
|
29
|
+
*/
|
|
30
|
+
export declare function extendItemPath(currentPath: ItemPath, linkId: string): ItemPath;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a new `ItemPath` with a `repeatIndex` applied to the last segment.
|
|
33
|
+
* Useful for denoting which repetition of a group is being accessed.
|
|
34
|
+
*
|
|
35
|
+
* @param path - The item path to modify.
|
|
36
|
+
* @param repeatIndex - The index to assign to the final segment.
|
|
37
|
+
* @returns A new `ItemPath` with the last segment modified to include `repeatIndex`.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* const basePath = [{ linkId: 'groupA' }, { linkId: 'groupB' }];
|
|
41
|
+
* appendRepeatIndexToLastSegment(basePath, 2);
|
|
42
|
+
* // → [{ linkId: 'groupA' }, { linkId: 'groupB', repeatIndex: 2 }]
|
|
43
|
+
*/
|
|
44
|
+
export declare function appendRepeatIndexToLastSegment(path: ItemPath, repeatIndex: number): ItemPath;
|
|
45
|
+
/**
|
|
46
|
+
* Converts an `ItemPath` to a FHIRPath-compatible string.
|
|
47
|
+
*
|
|
48
|
+
* For example, the path:
|
|
49
|
+
* [
|
|
50
|
+
* { linkId: 'groupA' },
|
|
51
|
+
* { linkId: 'repeatingGroup', repeatIndex: 1 },
|
|
52
|
+
* { linkId: 'questionB' }
|
|
53
|
+
* ]
|
|
54
|
+
*
|
|
55
|
+
* Returns: "item.where(linkId='groupA').item.where(linkId='repeatingGroup')[1].item.where(linkId='questionB')"
|
|
56
|
+
*/
|
|
57
|
+
export declare function itemPathToFhirPathString(path: ItemPath): string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an `ItemPath` containing a single segment for the given `linkId`.
|
|
3
|
+
* This is useful when you want to construct a path to a specific item without referencing its ancestry,
|
|
4
|
+
* such as when working with top-level items or when only the item's identity is relevant.
|
|
5
|
+
*
|
|
6
|
+
* @param linkId - The `linkId` of the item.
|
|
7
|
+
* @param repeatIndex - (Optional) If the item is part of a repeating group, specify its index.
|
|
8
|
+
* @returns An `ItemPath` containing one segment.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const path = createSingleItemPath('question-1');
|
|
13
|
+
* // Output: [{ linkId: 'question-1' }]
|
|
14
|
+
*
|
|
15
|
+
* const pathWithRepeat = createSingleItemPath('question-1', 2);
|
|
16
|
+
* // Output: [{ linkId: 'question-1', repeatIndex: 2 }]
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export function createSingleItemPath(linkId, repeatIndex) {
|
|
20
|
+
return repeatIndex !== undefined ? [{ linkId, repeatIndex }] : [{ linkId }];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new `ItemPath` by extending the given path with a new segment for the provided `linkId`.
|
|
24
|
+
* This version does NOT include a `repeatIndex`. If repeat handling is needed,
|
|
25
|
+
* use `appendRepeatIndexToLastSegment` after extending.
|
|
26
|
+
*
|
|
27
|
+
* @param currentPath - The existing item path.
|
|
28
|
+
* @param linkId - The `linkId` to use in the new path segment.
|
|
29
|
+
* @returns A new `ItemPath` with the added segment.
|
|
30
|
+
*/
|
|
31
|
+
export function extendItemPath(currentPath, linkId) {
|
|
32
|
+
return [...currentPath, { linkId }];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns a new `ItemPath` with a `repeatIndex` applied to the last segment.
|
|
36
|
+
* Useful for denoting which repetition of a group is being accessed.
|
|
37
|
+
*
|
|
38
|
+
* @param path - The item path to modify.
|
|
39
|
+
* @param repeatIndex - The index to assign to the final segment.
|
|
40
|
+
* @returns A new `ItemPath` with the last segment modified to include `repeatIndex`.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const basePath = [{ linkId: 'groupA' }, { linkId: 'groupB' }];
|
|
44
|
+
* appendRepeatIndexToLastSegment(basePath, 2);
|
|
45
|
+
* // → [{ linkId: 'groupA' }, { linkId: 'groupB', repeatIndex: 2 }]
|
|
46
|
+
*/
|
|
47
|
+
export function appendRepeatIndexToLastSegment(path, repeatIndex) {
|
|
48
|
+
if (path.length === 0)
|
|
49
|
+
return [];
|
|
50
|
+
const newPath = [...path];
|
|
51
|
+
newPath[path.length - 1] = Object.assign(Object.assign({}, newPath[path.length - 1]), { repeatIndex });
|
|
52
|
+
return newPath;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Converts an `ItemPath` to a FHIRPath-compatible string.
|
|
56
|
+
*
|
|
57
|
+
* For example, the path:
|
|
58
|
+
* [
|
|
59
|
+
* { linkId: 'groupA' },
|
|
60
|
+
* { linkId: 'repeatingGroup', repeatIndex: 1 },
|
|
61
|
+
* { linkId: 'questionB' }
|
|
62
|
+
* ]
|
|
63
|
+
*
|
|
64
|
+
* Returns: "item.where(linkId='groupA').item.where(linkId='repeatingGroup')[1].item.where(linkId='questionB')"
|
|
65
|
+
*/
|
|
66
|
+
export function itemPathToFhirPathString(path) {
|
|
67
|
+
return path
|
|
68
|
+
.map((segment, index) => {
|
|
69
|
+
const base = `where(linkId='${segment.linkId}')`;
|
|
70
|
+
const repeat = segment.repeatIndex !== undefined ? `[${segment.repeatIndex}]` : '';
|
|
71
|
+
return (index === 0 ? 'item.' : '') + base + repeat;
|
|
72
|
+
})
|
|
73
|
+
.join('.item.');
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=itemPath.js.map
|
|
@@ -0,0 +1 @@
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AC,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IACtD,CAAC,CAAC;SACD,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC"}
|
package/lib/utils/manageForm.js
CHANGED
|
@@ -34,13 +34,14 @@ export async function buildForm(params) {
|
|
|
34
34
|
else {
|
|
35
35
|
terminologyServerStore.getState().resetUrl();
|
|
36
36
|
}
|
|
37
|
+
// QR is set to undefined here to prevent it from being initialised twice. This is defined like that for backward compatibility purposes.
|
|
38
|
+
// Warning: setting the QR here breaks pre-pop. For initialisation logic, do it in questionnaireStore.getState().updateExpressions() with isInitialUpdate=true.
|
|
39
|
+
await questionnaireStore
|
|
40
|
+
.getState()
|
|
41
|
+
.buildSourceQuestionnaire(questionnaire, undefined, additionalContext, terminologyServerUrl, readOnly, qItemOverrideComponents, sdcUiOverrideComponents);
|
|
37
42
|
// Initialise an empty questionnaireResponse from a given questionnaire
|
|
38
43
|
// Optionally takes in an existing questionnaireResponse to be initialised
|
|
39
44
|
const initialisedQuestionnaireResponse = initialiseQuestionnaireResponse(questionnaire, questionnaireResponse);
|
|
40
|
-
// The buildSourceQuestionnaire function now takes the initialisedQuestionnaireResponse, which includes item.initial values from the Questionnaire.
|
|
41
|
-
await questionnaireStore
|
|
42
|
-
.getState()
|
|
43
|
-
.buildSourceQuestionnaire(questionnaire, initialisedQuestionnaireResponse, additionalContext, terminologyServerUrl, readOnly, qItemOverrideComponents, sdcUiOverrideComponents);
|
|
44
45
|
// Set initialised QuestionnaireResponse as the source response in the store
|
|
45
46
|
questionnaireResponseStore.getState().buildSourceResponse(initialisedQuestionnaireResponse);
|
|
46
47
|
// Process expressions asynchronously
|