@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,52 @@
|
|
|
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 { useEffect, useState } from 'react';
|
|
18
|
+
import { useQuestionnaireStore } from '../stores';
|
|
19
|
+
function useBooleanCalculatedExpression(props) {
|
|
20
|
+
const { qItem, booleanValue, onChangeByCalcExpressionBoolean, onChangeByCalcExpressionNull } = props;
|
|
21
|
+
const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
|
|
22
|
+
const [calcExpUpdated, setCalcExpUpdated] = useState(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
var _a;
|
|
25
|
+
const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item');
|
|
26
|
+
if (!calcExpression) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// only update if calculated value is different from current value
|
|
30
|
+
if (calcExpression.value !== booleanValue &&
|
|
31
|
+
(typeof calcExpression.value === 'boolean' || calcExpression.value === null)) {
|
|
32
|
+
// update ui to show calculated value changes
|
|
33
|
+
setCalcExpUpdated(true);
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
setCalcExpUpdated(false);
|
|
36
|
+
}, 500);
|
|
37
|
+
// calculatedExpression value is null
|
|
38
|
+
if (calcExpression.value === null) {
|
|
39
|
+
onChangeByCalcExpressionNull();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// calculatedExpression value is boolean
|
|
43
|
+
onChangeByCalcExpressionBoolean(calcExpression.value);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
// Only trigger this effect if calculatedExpression of item changes
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
[calculatedExpressions]);
|
|
49
|
+
return { calcExpUpdated: calcExpUpdated };
|
|
50
|
+
}
|
|
51
|
+
export default useBooleanCalculatedExpression;
|
|
52
|
+
//# sourceMappingURL=useBooleanCalculatedExpression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBooleanCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useBooleanCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5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,0 +1 @@
|
|
|
1
|
+
export declare function useCalculatedExpressionAnimating(answerKey: string | undefined): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
export function useCalculatedExpressionAnimating(answerKey) {
|
|
3
|
+
const [animating, setAnimating] = useState(false);
|
|
4
|
+
const previousAnswerKey = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (answerKey &&
|
|
7
|
+
answerKey !== previousAnswerKey.current &&
|
|
8
|
+
answerKey.includes('calculatedExpression')) {
|
|
9
|
+
previousAnswerKey.current = answerKey;
|
|
10
|
+
setAnimating(true);
|
|
11
|
+
const timer = setTimeout(() => setAnimating(false), 1000);
|
|
12
|
+
return () => clearTimeout(timer);
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}, [answerKey]);
|
|
16
|
+
return animating;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=useCalculatedExpressionAnimating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCalculatedExpressionAnimating.js","sourceRoot":"","sources":["../../src/hooks/useCalculatedExpressionAnimating.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,MAAM,UAAU,gCAAgC,CAAC,SAA6B;IAC5E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,iBAAiB,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAEtD,SAAS,CAAC,GAAG,EAAE;QACb,IACE,SAAS;YACT,SAAS,KAAK,iBAAiB,CAAC,OAAO;YACvC,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAC1C,CAAC;YACD,iBAAiB,CAAC,OAAO,GAAG,SAAS,CAAC;YACtC,YAAY,CAAC,IAAI,CAAC,CAAC;YAEnB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;YAE1D,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Ignores the initial mount (so it won't re-animate when the user switch between tabs).
|
|
6
6
|
*/
|
|
7
|
-
export declare function useCalculatedExpressionUpdated(answerKey: string | undefined): boolean;
|
|
7
|
+
export declare function useCalculatedExpressionUpdated(answerKey: string | undefined, answerSnapshot?: string | undefined): boolean;
|
|
@@ -5,29 +5,38 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
5
5
|
*
|
|
6
6
|
* Ignores the initial mount (so it won't re-animate when the user switch between tabs).
|
|
7
7
|
*/
|
|
8
|
-
export function useCalculatedExpressionUpdated(answerKey) {
|
|
8
|
+
export function useCalculatedExpressionUpdated(answerKey, answerSnapshot) {
|
|
9
9
|
const [animating, setAnimating] = useState(false);
|
|
10
10
|
const previousAnswerKey = useRef(null);
|
|
11
|
+
const previousAnswerSnapshot = useRef(null);
|
|
11
12
|
const mounted = useRef(false);
|
|
12
13
|
useEffect(() => {
|
|
13
|
-
// Skip the first render — just store the current key
|
|
14
|
+
// Skip the first render — just store the current key/snapshot
|
|
14
15
|
if (!mounted.current) {
|
|
15
16
|
mounted.current = true;
|
|
16
17
|
previousAnswerKey.current = answerKey ?? null;
|
|
18
|
+
previousAnswerSnapshot.current = answerSnapshot ?? null;
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
answerKey.
|
|
24
|
-
|
|
21
|
+
// Determine whether the answer changed. If an answerSnapshot is provided we use
|
|
22
|
+
// that to detect value changes (useful when the answer id stays the same).
|
|
23
|
+
const changed = answerSnapshot !== undefined
|
|
24
|
+
? answerSnapshot !== previousAnswerSnapshot.current
|
|
25
|
+
: !!answerKey && answerKey !== previousAnswerKey.current;
|
|
26
|
+
const isCalculated = !!answerKey && answerKey.includes('calculatedExpression');
|
|
27
|
+
// Answer changed and it is a calculatedExpression
|
|
28
|
+
if (changed && isCalculated) {
|
|
29
|
+
previousAnswerKey.current = answerKey ?? null;
|
|
30
|
+
previousAnswerSnapshot.current = answerSnapshot ?? null;
|
|
25
31
|
setAnimating(true);
|
|
26
32
|
const timer = setTimeout(() => setAnimating(false), 700);
|
|
27
33
|
return () => clearTimeout(timer);
|
|
28
34
|
}
|
|
35
|
+
// Always advance the stored values so we don't re-fire due to transient undefined/null
|
|
36
|
+
previousAnswerKey.current = answerKey ?? null;
|
|
37
|
+
previousAnswerSnapshot.current = answerSnapshot ?? null;
|
|
29
38
|
return undefined;
|
|
30
|
-
}, [answerKey]);
|
|
39
|
+
}, [answerKey, answerSnapshot]);
|
|
31
40
|
return animating;
|
|
32
41
|
}
|
|
33
42
|
//# sourceMappingURL=useCalculatedExpressionUpdated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCalculatedExpressionUpdated.js","sourceRoot":"","sources":["../../src/hooks/useCalculatedExpressionUpdated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,
|
|
1
|
+
{"version":3,"file":"useCalculatedExpressionUpdated.js","sourceRoot":"","sources":["../../src/hooks/useCalculatedExpressionUpdated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAC5C,SAA6B,EAC7B,cAAm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AAiB,CAAC,OAAO,GAAG,SAAS,IAAI,IAAI,CAAC;QAC9C,sBAAsB,CAAC,OAAO,GAAG,cAAc,IAAI,IAAI,CAAC;QAExD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAEhC,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QuestionnaireItem } from 'fhir/r4';
|
|
2
|
+
interface UseDecimalCalculatedExpression {
|
|
3
|
+
calcExpUpdated: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface useDecimalCalculatedExpressionProps {
|
|
6
|
+
qItem: QuestionnaireItem;
|
|
7
|
+
inputValue: string;
|
|
8
|
+
precision: number | null;
|
|
9
|
+
onChangeByCalcExpressionDecimal: (calcExpressionValue: number) => void;
|
|
10
|
+
onChangeByCalcExpressionNull: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare function useDecimalCalculatedExpression(props: useDecimalCalculatedExpressionProps): UseDecimalCalculatedExpression;
|
|
13
|
+
export default useDecimalCalculatedExpression;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { useEffect, useState } from 'react';
|
|
18
|
+
import { useQuestionnaireStore } from '../stores';
|
|
19
|
+
function useDecimalCalculatedExpression(props) {
|
|
20
|
+
const { qItem, inputValue, precision, onChangeByCalcExpressionDecimal, onChangeByCalcExpressionNull } = props;
|
|
21
|
+
const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
|
|
22
|
+
const [calcExpUpdated, setCalcExpUpdated] = useState(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
var _a;
|
|
25
|
+
const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item');
|
|
26
|
+
if (!calcExpression) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// only update if calculated value is different from current value
|
|
30
|
+
if (calcExpression.value !== inputValue &&
|
|
31
|
+
(typeof calcExpression.value === 'number' || calcExpression.value === null)) {
|
|
32
|
+
const calcExpressionValue = typeof calcExpression.value === 'number' && typeof precision === 'number'
|
|
33
|
+
? parseFloat(calcExpression.value.toFixed(precision))
|
|
34
|
+
: calcExpression.value;
|
|
35
|
+
// only update if calculated value is different from current value
|
|
36
|
+
if (calcExpressionValue !== parseFloat(inputValue)) {
|
|
37
|
+
// update ui to show calculated value changes
|
|
38
|
+
setCalcExpUpdated(true);
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
setCalcExpUpdated(false);
|
|
41
|
+
}, 500);
|
|
42
|
+
// calculatedExpression value is null
|
|
43
|
+
if (calcExpressionValue === null) {
|
|
44
|
+
onChangeByCalcExpressionNull();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// calculatedExpression value is a number
|
|
48
|
+
onChangeByCalcExpressionDecimal(calcExpressionValue);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
// Only trigger this effect if calculatedExpression of item changes
|
|
53
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
+
[calculatedExpressions]);
|
|
55
|
+
return { calcExpUpdated: calcExpUpdated };
|
|
56
|
+
}
|
|
57
|
+
export default useDecimalCalculatedExpression;
|
|
58
|
+
//# sourceMappingURL=useDecimalCalculatedExpression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDecimalCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useDecimalCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAclD,SAAS,8BAA8B,CACrC,KAA0C;IAE1C,MAAM,EACJ,KAAK,EACL,UAAU,EACV,SAAS,EACT,+BAA+B,EAC/B,4BAA4B,EAC7B,GAAG,KAAK,CAAC;IAEV,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAEhF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5D,SAAS,CACP,GAAG,EAAE;;QACH,MAAM,cAAc,GAAG,MAAA,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,IAAI,CAC9D,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAC7B,CAAC;QAEF,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,kEAAkE;QAClE,IACE,cAAc,CAAC,KAAK,KAAK,UAAU;YACnC,CAAC,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,CAAC,EAC3E;YACA,MAAM,mBAAmB,GACvB,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,SAAS,KAAK,QAAQ;gBACvE,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBACrD,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;YAE3B,kEAAkE;YAClE,IAAI,mBAAmB,KAAK,UAAU,CAAC,UAAU,CAAC,EAAE;gBAClD,6CAA6C;gBAC7C,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBACxB,UAAU,CAAC,GAAG,EAAE;oBACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAC3B,CAAC,EAAE,GAAG,CAAC,CAAC;gBAER,qCAAqC;gBACrC,IAAI,mBAAmB,KAAK,IAAI,EAAE;oBAChC,4BAA4B,EAAE,CAAC;oBAC/B,OAAO;iBACR;gBAED,yCAAyC;gBACzC,+BAA+B,CAAC,mBAAmB,CAAC,CAAC;aACtD;SACF;IACH,CAAC;IACD,mEAAmE;IACnE,uDAAuD;IACvD,CAAC,qBAAqB,CAAC,CACxB,CAAC;IAEF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC;AAC5C,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
+
import type { GroupTableRowModel } from '../interfaces/groupTable.interface';
|
|
3
|
+
declare function useInitialiseGroupTable(qrItems: QuestionnaireResponseItem[]): GroupTableRowModel[];
|
|
4
|
+
export default useInitialiseGroupTable;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { nanoid } from 'nanoid';
|
|
18
|
+
function useInitialiseGroupTable(qrItems) {
|
|
19
|
+
let initialGroupTableRows = [
|
|
20
|
+
{
|
|
21
|
+
nanoId: nanoid(),
|
|
22
|
+
qrItem: null
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
if (qrItems.length > 0) {
|
|
26
|
+
initialGroupTableRows = qrItems.map((qrItem) => {
|
|
27
|
+
return {
|
|
28
|
+
nanoId: nanoid(),
|
|
29
|
+
qrItem
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return initialGroupTableRows;
|
|
34
|
+
}
|
|
35
|
+
export default useInitialiseGroupTable;
|
|
36
|
+
//# sourceMappingURL=useInitialiseGroupTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInitialiseGroupTable.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseGroupTable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,SAAS,uBAAuB,CAAC,OAAoC;IACnE,IAAI,qBAAqB,GAAyB;QAChD;YACE,MAAM,EAAE,MAAM,EAAE;YAChB,MAAM,EAAE,IAAI;SACb;KACF,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACtB,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC7C,OAAO;gBACL,MAAM,EAAE,MAAM,EAAE;gBAChB,MAAM;aACP,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { QuestionnaireItem } from 'fhir/r4';
|
|
2
|
+
interface UseIntegerCalculatedExpression {
|
|
3
|
+
calcExpUpdated: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface useIntegerCalculatedExpressionProps {
|
|
6
|
+
qItem: QuestionnaireItem;
|
|
7
|
+
inputValue: string;
|
|
8
|
+
onChangeByCalcExpressionInteger: (calcExpressionValue: number) => void;
|
|
9
|
+
onChangeByCalcExpressionNull: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare function useIntegerCalculatedExpression(props: useIntegerCalculatedExpressionProps): UseIntegerCalculatedExpression;
|
|
12
|
+
export default useIntegerCalculatedExpression;
|
|
@@ -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
|
+
import { useEffect, useState } from 'react';
|
|
18
|
+
import { useQuestionnaireStore } from '../stores';
|
|
19
|
+
function useIntegerCalculatedExpression(props) {
|
|
20
|
+
const { qItem, inputValue, onChangeByCalcExpressionInteger, onChangeByCalcExpressionNull } = props;
|
|
21
|
+
const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
|
|
22
|
+
const [calcExpUpdated, setCalcExpUpdated] = useState(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
var _a;
|
|
25
|
+
const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item');
|
|
26
|
+
if (!calcExpression) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// only update if calculated value is different from current value
|
|
30
|
+
if (calcExpression.value !== inputValue &&
|
|
31
|
+
(typeof calcExpression.value === 'number' || calcExpression.value === null)) {
|
|
32
|
+
const calcExpressionValue = calcExpression.value;
|
|
33
|
+
if (calcExpressionValue !== parseInt(inputValue)) {
|
|
34
|
+
// update ui to show calculated value changes
|
|
35
|
+
setCalcExpUpdated(true);
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
setCalcExpUpdated(false);
|
|
38
|
+
}, 500);
|
|
39
|
+
// calculatedExpression value is null
|
|
40
|
+
if (calcExpressionValue === null) {
|
|
41
|
+
onChangeByCalcExpressionNull();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// calculatedExpression value is a number
|
|
45
|
+
onChangeByCalcExpressionInteger(calcExpressionValue);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// Only trigger this effect if calculatedExpression of item changes
|
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
+
[calculatedExpressions]);
|
|
52
|
+
return { calcExpUpdated: calcExpUpdated };
|
|
53
|
+
}
|
|
54
|
+
export default useIntegerCalculatedExpression;
|
|
55
|
+
//# sourceMappingURL=useIntegerCalculatedExpression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIntegerCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useIntegerCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAA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Ac,EAAE,cAAc,EAAE,CAAC;AAC5C,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { useEffect, useState } from 'react';
|
|
18
|
+
function useNumberInput(valueFromProps) {
|
|
19
|
+
const [value, setValue] = useState(valueFromProps);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (value !== valueFromProps) {
|
|
22
|
+
setValue(valueFromProps);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
// Only trigger this effect if prop value changes
|
|
26
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
+
[valueFromProps]);
|
|
28
|
+
return [value, setValue];
|
|
29
|
+
}
|
|
30
|
+
export default useNumberInput;
|
|
31
|
+
//# sourceMappingURL=useNumberInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNumberInput.js","sourceRoot":"","sources":["../../src/hooks/useNumberInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,cAAc,CAAC,cAAsB;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEnD,SAAS,CACP,GAAG,EAAE;QACH,IAAI,KAAK,KAAK,cAAc,EAAE;YAC5B,QAAQ,CAAC,cAAc,CAAC,CAAC;SAC1B;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC3B,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Element } from 'fhir/r4';
|
|
3
3
|
export interface ParsedXhtml {
|
|
4
4
|
content: React.ReactNode;
|
|
5
5
|
styles?: Record<string, string>;
|
|
6
6
|
}
|
|
7
|
-
export declare function useParseXhtml(
|
|
7
|
+
export declare function useParseXhtml(element: Element | undefined, text: string | null | undefined): ParsedXhtml | null;
|
|
8
8
|
export declare function getStylesFromClass(className: string): Record<string, string> | null;
|
|
9
9
|
export declare function convertKebabToCamelCase(property: string): string;
|
|
@@ -16,17 +16,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { useMemo } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { getXHtmlStringFromExtension } from '../utils/extensions';
|
|
20
20
|
import { attributesToProps, default as htmlParse, domToReact } from 'html-react-parser';
|
|
21
|
-
export function useParseXhtml(
|
|
21
|
+
export function useParseXhtml(element, text) {
|
|
22
22
|
return useMemo(() => {
|
|
23
|
-
let xHtmlString =
|
|
23
|
+
let xHtmlString = getXHtmlStringFromExtension(element?.extension || []);
|
|
24
24
|
if (xHtmlString === null || xHtmlString === '') {
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
27
|
// Replace <img with alt text - only if there are no alt tags
|
|
28
28
|
if (!xHtmlString.includes('alt=') && !xHtmlString.includes('alt =')) {
|
|
29
|
-
const altText = `<img alt='${
|
|
29
|
+
const altText = `<img alt='${text}'`;
|
|
30
30
|
xHtmlString = xHtmlString.replace('<img', altText);
|
|
31
31
|
}
|
|
32
32
|
// Extract global styles from the XHTML
|
|
@@ -110,7 +110,7 @@ export function useParseXhtml(qItem) {
|
|
|
110
110
|
content: parsedContent,
|
|
111
111
|
styles: extractedStyles
|
|
112
112
|
};
|
|
113
|
-
}, [
|
|
113
|
+
}, [element, text]);
|
|
114
114
|
}
|
|
115
115
|
export function getStylesFromClass(className) {
|
|
116
116
|
if (!className) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useParseXhtml.js","sourceRoot":"","sources":["../../src/hooks/useParseXhtml.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useParseXhtml.js","sourceRoot":"","sources":["../../src/hooks/useParseXhtml.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAE,OAAO,IAAI,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQxF,MAAM,UAAU,aAAa,CAC3B,OAA4B,EAC5B,IAA+B;IAE/B,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,WAAW,GAAG,2BAA2B,CAAC,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;QAExE,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,6DAA6D;QAC7D,IAAI,CAAC,WAAW,CAAC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BAAuB,CAAC,QAAgB;IACtD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import type { RepeatAnswer } from '../interfaces/repeatItem.interface';
|
|
3
|
+
declare function useRepeatAnswers(valueFromProps: RepeatAnswer[]): [RepeatAnswer[], Dispatch<SetStateAction<RepeatAnswer[]>>];
|
|
4
|
+
export default useRepeatAnswers;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { useEffect, useState } from 'react';
|
|
18
|
+
import _isEqual from 'lodash/isEqual';
|
|
19
|
+
function useRepeatAnswers(valueFromProps) {
|
|
20
|
+
const [repeatAnswers, setRepeatAnswers] = useState(valueFromProps);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const valueFromPropsQRItemAnswers = valueFromProps.map((answer) => answer.answer);
|
|
23
|
+
const repeatAnswersQRItemAnswers = repeatAnswers.map((answer) => answer.answer);
|
|
24
|
+
if (!_isEqual(valueFromPropsQRItemAnswers, repeatAnswersQRItemAnswers)) {
|
|
25
|
+
setRepeatAnswers(valueFromProps);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
// Only trigger this effect if prop value changes
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
[valueFromProps]);
|
|
31
|
+
return [repeatAnswers, setRepeatAnswers];
|
|
32
|
+
}
|
|
33
|
+
export default useRepeatAnswers;
|
|
34
|
+
//# sourceMappingURL=useRepeatAnswers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRepeatAnswers.js","sourceRoot":"","sources":["../../src/hooks/useRepeatAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,SAAS,gBAAgB,CACvB,cAA8B;IAE9B,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEnE,SAAS,CACP,GAAG,EAAE;QACH,MAAM,2BAA2B,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClF,MAAM,0BAA0B,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEhF,IAAI,CAAC,QAAQ,CAAC,2BAA2B,EAAE,0BAA0B,CAAC,EAAE;YACtE,gBAAgB,CAAC,cAAc,CAAC,CAAC;SAClC;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AAC3C,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import type { RepeatGroupSingle } from '../interfaces/repeatGroup.interface';
|
|
3
|
+
declare function useRepeatGroups(valueFromProps: RepeatGroupSingle[]): [RepeatGroupSingle[], Dispatch<SetStateAction<RepeatGroupSingle[]>>];
|
|
4
|
+
export default useRepeatGroups;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { useEffect, useState } from 'react';
|
|
18
|
+
import _isEqual from 'lodash/isEqual';
|
|
19
|
+
function useRepeatGroups(valueFromProps) {
|
|
20
|
+
const [repeatGroups, setRepeatGroups] = useState(valueFromProps);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const valueFromPropsQRItems = valueFromProps.map((repeatGroupSingle) => repeatGroupSingle.qrItem);
|
|
23
|
+
const repeatGroupsQRItems = repeatGroups.map((repeatGroupSingle) => repeatGroupSingle.qrItem);
|
|
24
|
+
if (!_isEqual(valueFromPropsQRItems, repeatGroupsQRItems)) {
|
|
25
|
+
setRepeatGroups(valueFromProps);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
// Only trigger this effect if prop value changes
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
[valueFromProps]);
|
|
31
|
+
return [repeatGroups, setRepeatGroups];
|
|
32
|
+
}
|
|
33
|
+
export default useRepeatGroups;
|
|
34
|
+
//# sourceMappingURL=useRepeatGroups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRepeatGroups.js","sourceRoot":"","sources":["../../src/hooks/useRepeatGroups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,SAAS,eAAe,CACtB,cAAmC;IAEnC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEjE,SAAS,CACP,GAAG,EAAE;QACH,MAAM,qBAAqB,GAAG,cAAc,CAAC,GAAG,CAC9C,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAChD,CAAC;QACF,MAAM,mBAAmB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAE9F,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,EAAE;YACzD,eAAe,CAAC,cAAc,CAAC,CAAC;SACjC;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;AACzC,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom React hook to manage validation feedback visibility based on user interaction with a form field (e.g., input or blur events).
|
|
3
|
+
* Shows feedback after the field has been blurred at least once.
|
|
4
|
+
*/
|
|
5
|
+
declare function useShowFeedback(): {
|
|
6
|
+
showFeedback: boolean;
|
|
7
|
+
setShowFeedback: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
8
|
+
hasBlurred: boolean;
|
|
9
|
+
setHasBlurred: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
10
|
+
};
|
|
11
|
+
export default useShowFeedback;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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 { useState } from 'react';
|
|
18
|
+
/**
|
|
19
|
+
* Custom React hook to manage validation feedback visibility based on user interaction with a form field (e.g., input or blur events).
|
|
20
|
+
* Shows feedback after the field has been blurred at least once.
|
|
21
|
+
*/
|
|
22
|
+
function useShowFeedback() {
|
|
23
|
+
const [showFeedback, setShowFeedback] = useState(true);
|
|
24
|
+
const [hasBlurred, setHasBlurred] = useState(false);
|
|
25
|
+
return {
|
|
26
|
+
showFeedback,
|
|
27
|
+
setShowFeedback,
|
|
28
|
+
hasBlurred,
|
|
29
|
+
setHasBlurred
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default useShowFeedback;
|
|
33
|
+
//# sourceMappingURL=useShowFeedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useShowFeedback.js","sourceRoot":"","sources":["../../src/hooks/useShowFeedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC;;;GAGG;AACH,SAAS,eAAe;IACtB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO;QACL,YAAY;QACZ,eAAe;QACf,UAAU;QACV,aAAa;KACd,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { QuestionnaireItem } from 'fhir/r4';
|
|
2
|
+
interface UseStringCalculatedExpression {
|
|
3
|
+
calculationStatus: 'on' | 'off' | null;
|
|
4
|
+
calcExpUpdated: boolean;
|
|
5
|
+
onChangeCalculationStatus: (status: 'on' | 'off' | null) => void;
|
|
6
|
+
}
|
|
7
|
+
interface useStringCalculatedExpressionProps {
|
|
8
|
+
qItem: QuestionnaireItem;
|
|
9
|
+
inputValue: string;
|
|
10
|
+
onChangeByCalcExpressionString: (newValueString: string) => void;
|
|
11
|
+
onChangeByCalcExpressionNull: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare function useStringCalculatedExpression(props: useStringCalculatedExpressionProps): UseStringCalculatedExpression;
|
|
14
|
+
export default useStringCalculatedExpression;
|