@aehrc/smart-forms-renderer 0.7.2 → 0.8.1
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/Alert.styles.d.ts +2 -7
- package/lib/components/Box.styles.d.ts +6 -21
- package/lib/components/FormComponents/BooleanItem/BooleanItem.d.ts +2 -2
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js +5 -4
- package/lib/components/FormComponents/BooleanItem/BooleanItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js +6 -6
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.d.ts +12 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +39 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js.map +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +17 -29
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.d.ts +13 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +42 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js.map +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.d.ts +4 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +17 -24
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.d.ts +3 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +8 -8
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +12 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +27 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +14 -29
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +14 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +42 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.d.ts +3 -3
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +14 -26
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +11 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +41 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +12 -27
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.d.ts +13 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +42 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -0
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js +13 -22
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/DateItem/DateItem.d.ts +2 -1
- package/lib/components/FormComponents/DateItem/DateItem.js +5 -4
- package/lib/components/FormComponents/DateItem/DateItem.js.map +1 -1
- package/lib/components/FormComponents/DateItem/DatePicker.d.ts +2 -0
- package/lib/components/FormComponents/DateItem/DatePicker.js +42 -0
- package/lib/components/FormComponents/DateItem/DatePicker.js.map +1 -0
- package/lib/components/FormComponents/DateItem/DatePickerField.d.ts +8 -0
- package/{src/components/FormComponents/Typography.styles.ts → lib/components/FormComponents/DateItem/DatePickerField.js} +8 -9
- package/lib/components/FormComponents/DateItem/DatePickerField.js.map +1 -0
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.d.ts +2 -2
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js +5 -4
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js.map +1 -1
- package/lib/components/FormComponents/DecimalItem/DecimalItem.d.ts +2 -2
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js +5 -4
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js.map +1 -1
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.d.ts +1 -0
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.js +2 -2
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.js.map +1 -1
- package/lib/components/FormComponents/DisplayItem/DisplayInstructions.styles.d.ts +2 -7
- package/lib/components/FormComponents/DisplayItem/DisplayItem.js +2 -2
- package/lib/components/FormComponents/DisplayItem/DisplayItem.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridGroup.d.ts +2 -2
- package/lib/components/FormComponents/GridGroup/GridGroup.js +6 -4
- package/lib/components/FormComponents/GridGroup/GridGroup.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridRow.d.ts +2 -1
- package/lib/components/FormComponents/GridGroup/GridRow.js +2 -2
- package/lib/components/FormComponents/GridGroup/GridRow.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridTable.d.ts +2 -1
- package/lib/components/FormComponents/GridGroup/GridTable.js +2 -2
- package/lib/components/FormComponents/GridGroup/GridTable.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupHeading.d.ts +1 -0
- package/lib/components/FormComponents/GroupItem/GroupHeading.js +6 -5
- package/lib/components/FormComponents/GroupItem/GroupHeading.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItem.d.ts +2 -3
- package/lib/components/FormComponents/GroupItem/GroupItem.js +5 -3
- package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItem.styles.d.ts +2 -6
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.d.ts +2 -2
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +12 -12
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/IntegerItem/IntegerItem.d.ts +2 -2
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js +5 -4
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js.map +1 -1
- package/lib/components/FormComponents/Item.styles.d.ts +2 -6
- package/lib/components/FormComponents/Item.styles.js +2 -6
- package/lib/components/FormComponents/Item.styles.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/ItemFieldGrid.d.ts +1 -0
- package/lib/components/FormComponents/ItemParts/ItemFieldGrid.js +3 -3
- package/lib/components/FormComponents/ItemParts/ItemFieldGrid.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/ItemLabelText.d.ts +1 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelText.js +4 -6
- package/lib/components/FormComponents/ItemParts/ItemLabelText.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.d.ts +1 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js +2 -2
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.d.ts +8 -0
- package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js +37 -0
- package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js.map +1 -0
- package/lib/components/FormComponents/ItemParts/RadioButtons.d.ts +8 -0
- package/lib/components/FormComponents/ItemParts/RadioButtons.js +37 -0
- package/lib/components/FormComponents/ItemParts/RadioButtons.js.map +1 -0
- package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.d.ts +8 -0
- package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.js +37 -0
- package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.js.map +1 -0
- package/lib/components/FormComponents/Lists.styles.d.ts +2 -9
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.d.ts +21 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js +48 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js.map +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.d.ts +0 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.js +2 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.js.map +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.d.ts +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js +16 -39
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.d.ts +17 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +42 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js.map +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +27 -39
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.d.ts +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +6 -6
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.d.ts +15 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +29 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.d.ts +3 -3
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +10 -29
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.d.ts +12 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js +14 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js.map +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.d.ts +0 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.js +2 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.js.map +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.d.ts +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js +23 -27
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.d.ts +13 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js +16 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js.map +1 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.d.ts +2 -2
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js +13 -18
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/AddItemButton.d.ts +1 -0
- package/lib/components/FormComponents/RepeatGroup/AddItemButton.js +2 -2
- package/lib/components/FormComponents/RepeatGroup/AddItemButton.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.d.ts +1 -0
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js +2 -2
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.d.ts +2 -2
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js +8 -6
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.d.ts +2 -2
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js +5 -3
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/AddItemButton.d.ts +1 -0
- package/lib/components/FormComponents/RepeatItem/AddItemButton.js +2 -2
- package/lib/components/FormComponents/RepeatItem/AddItemButton.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/DeleteItemButton.d.ts +1 -0
- package/lib/components/FormComponents/RepeatItem/DeleteItemButton.js +2 -2
- package/lib/components/FormComponents/RepeatItem/DeleteItemButton.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatField.d.ts +2 -2
- package/lib/components/FormComponents/RepeatItem/RepeatField.js +5 -3
- package/lib/components/FormComponents/RepeatItem/RepeatField.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatItem.d.ts +2 -2
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js +6 -5
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatItem.styles.d.ts +4 -18
- package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +2 -2
- package/lib/components/FormComponents/SingleItem/SingleItem.js +4 -2
- package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.d.ts +2 -2
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +12 -12
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/StringItem/StringItem.d.ts +2 -2
- package/lib/components/FormComponents/StringItem/StringItem.js +5 -4
- package/lib/components/FormComponents/StringItem/StringItem.js.map +1 -1
- package/lib/components/FormComponents/Tables/AddItemButton.d.ts +8 -0
- package/lib/components/FormComponents/Tables/AddItemButton.js +28 -0
- package/lib/components/FormComponents/Tables/AddItemButton.js.map +1 -0
- package/lib/components/FormComponents/Tables/AddRowButton.d.ts +9 -0
- package/lib/components/FormComponents/Tables/AddRowButton.js +28 -0
- package/lib/components/FormComponents/Tables/AddRowButton.js.map +1 -0
- package/lib/components/FormComponents/Tables/DeleteRowButton.d.ts +1 -0
- package/lib/components/FormComponents/Tables/DeleteRowButton.js +2 -2
- package/lib/components/FormComponents/Tables/DeleteRowButton.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTable.d.ts +10 -0
- package/lib/components/FormComponents/Tables/GroupTable.js +110 -0
- package/lib/components/FormComponents/Tables/GroupTable.js.map +1 -0
- package/lib/components/FormComponents/Tables/GroupTableRow.d.ts +11 -0
- package/lib/components/FormComponents/Tables/GroupTableRow.js +46 -0
- package/lib/components/FormComponents/Tables/GroupTableRow.js.map +1 -0
- package/lib/components/FormComponents/Tables/QItemGroupTable.js +5 -7
- package/lib/components/FormComponents/Tables/QItemGroupTable.js.map +1 -1
- package/lib/components/FormComponents/Tables/QItemGroupTableRow.js +2 -2
- package/lib/components/FormComponents/Tables/QItemGroupTableRow.js.map +1 -1
- package/lib/components/FormComponents/Tables/index.d.ts +1 -1
- package/lib/components/FormComponents/Tables/index.js +1 -1
- package/lib/components/FormComponents/Tables/index.js.map +1 -1
- package/lib/components/FormComponents/TextItem/TextItem.d.ts +2 -2
- package/lib/components/FormComponents/TextItem/TextItem.js +5 -4
- package/lib/components/FormComponents/TextItem/TextItem.js.map +1 -1
- package/lib/components/FormComponents/TimeItem/TimeItem.d.ts +2 -2
- package/lib/components/FormComponents/TimeItem/TimeItem.js +5 -4
- package/lib/components/FormComponents/TimeItem/TimeItem.js.map +1 -1
- package/lib/components/FormComponents/UrlItem/UrlItem.d.ts +2 -2
- package/lib/components/FormComponents/UrlItem/UrlItem.js +5 -4
- package/lib/components/FormComponents/UrlItem/UrlItem.js.map +1 -1
- package/lib/components/Lists.styles.d.ts +2 -9
- package/lib/components/Renderer/FormBodyTabbed.js +1 -1
- package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
- package/lib/components/Renderer/FormTopLevelItem.js +7 -5
- package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
- package/lib/components/Tabs/FormBodySingleTab.js +1 -1
- package/lib/components/Tabs/FormBodyTabList.d.ts +1 -0
- package/lib/components/Tabs/FormBodyTabList.js +3 -4
- package/lib/components/Tabs/FormBodyTabList.js.map +1 -1
- package/lib/components/Tabs/FormBodyTabListWrapper.d.ts +1 -1
- package/lib/components/Tabs/FormBodyTabListWrapper.js +6 -13
- package/lib/components/Tabs/FormBodyTabListWrapper.js.map +1 -1
- package/lib/components/Tabs/ShowCompletedTabsSection.d.ts +7 -0
- package/lib/components/Tabs/ShowCompletedTabsSection.js +34 -0
- package/lib/components/Tabs/ShowCompletedTabsSection.js.map +1 -0
- package/lib/hooks/useContextDisplayItems.d.ts +6 -0
- package/lib/hooks/useContextDisplayItems.js +30 -0
- package/lib/hooks/useContextDisplayItems.js.map +1 -0
- package/lib/hooks/useInitialiseRenderer.js +2 -2
- package/lib/hooks/useInitialiseRenderer.js.map +1 -1
- package/lib/hooks/useInitialiseRepeatGroups.d.ts +1 -1
- package/lib/hooks/useMinimalStringCalculatedExpression.d.ts +11 -0
- package/lib/hooks/useMinimalStringCalculatedExpression.js +37 -0
- package/lib/hooks/useMinimalStringCalculatedExpression.js.map +1 -0
- package/lib/hooks/useNumberInput.d.ts +1 -1
- package/lib/hooks/useNumberInput.js.map +1 -1
- package/lib/hooks/useReadOnly.d.ts +3 -0
- package/lib/hooks/useReadOnly.js +26 -0
- package/lib/hooks/useReadOnly.js.map +1 -0
- package/lib/hooks/useStringInput.d.ts +1 -1
- package/lib/hooks/useStringInput.js.map +1 -1
- package/lib/hooks/useTerminologyServerQuery.js +3 -6
- package/lib/hooks/useTerminologyServerQuery.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/interfaces/calculatedExpression.interface.d.ts +1 -1
- package/lib/interfaces/renderProps.interface.d.ts +6 -0
- package/lib/stores/useQuestionnaireResponseStore.d.ts +2 -1
- package/lib/stores/useQuestionnaireResponseStore.js +5 -3
- package/lib/stores/useQuestionnaireResponseStore.js.map +1 -1
- package/lib/theme/overrides/Typography.d.ts +13 -0
- package/lib/theme/overrides/Typography.js +31 -0
- package/lib/theme/overrides/Typography.js.map +1 -0
- package/lib/theme/typography.d.ts +0 -2
- package/lib/theme/typography.js +3 -5
- package/lib/theme/typography.js.map +1 -1
- package/lib/utils/calculatedExpression.d.ts +12 -0
- package/lib/utils/calculatedExpression.js +54 -8
- package/lib/utils/calculatedExpression.js.map +1 -1
- package/lib/utils/qrItem.d.ts +2 -3
- package/lib/utils/qrItem.js +2 -3
- package/lib/utils/qrItem.js.map +1 -1
- package/lib/utils/repopulateIntoResponse.d.ts +2 -2
- package/lib/utils/repopulateItems.js +0 -1
- package/lib/utils/repopulateItems.js.map +1 -1
- package/package.json +15 -15
- package/src/components/FormComponents/BooleanItem/BooleanItem.tsx +8 -5
- package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +9 -7
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +85 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +48 -60
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +79 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +50 -52
- package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +24 -9
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +48 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +32 -59
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +83 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +37 -56
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +82 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +30 -60
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +98 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +33 -66
- package/src/components/FormComponents/DateItem/DateItem.tsx +8 -6
- package/src/components/FormComponents/DateTimeItem/DateTimeItem.tsx +8 -6
- package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +7 -5
- package/src/components/FormComponents/DisplayItem/DisplayInstructions.tsx +6 -2
- package/src/components/FormComponents/DisplayItem/DisplayItem.tsx +2 -2
- package/src/components/FormComponents/GridGroup/GridGroup.tsx +13 -5
- package/src/components/FormComponents/GridGroup/GridRow.tsx +6 -2
- package/src/components/FormComponents/GridGroup/GridTable.tsx +6 -2
- package/src/components/FormComponents/GroupItem/GroupHeading.tsx +12 -6
- package/src/components/FormComponents/GroupItem/GroupItem.tsx +8 -2
- package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +31 -8
- package/src/components/FormComponents/IntegerItem/IntegerItem.tsx +7 -5
- package/src/components/FormComponents/Item.styles.ts +2 -7
- package/src/components/FormComponents/ItemParts/ItemFieldGrid.tsx +4 -3
- package/src/components/FormComponents/ItemParts/ItemLabelText.tsx +10 -5
- package/src/components/FormComponents/ItemParts/ItemLabelWrapper.tsx +3 -2
- package/src/components/FormComponents/ItemParts/RadioAnswerOptionButtons.tsx +72 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx +137 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +50 -99
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +112 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +72 -80
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +17 -5
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +72 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +23 -67
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +60 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +50 -69
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.tsx +69 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +33 -56
- package/src/components/FormComponents/RepeatGroup/AddItemButton.tsx +3 -2
- package/src/components/FormComponents/RepeatGroup/DeleteItemButton.tsx +3 -2
- package/src/components/FormComponents/RepeatGroup/RepeatGroup.tsx +17 -9
- package/src/components/FormComponents/RepeatGroup/RepeatGroupItem.tsx +13 -2
- package/src/components/FormComponents/RepeatItem/AddItemButton.tsx +3 -2
- package/src/components/FormComponents/RepeatItem/DeleteItemButton.tsx +3 -2
- package/src/components/FormComponents/RepeatItem/RepeatField.tsx +21 -3
- package/src/components/FormComponents/RepeatItem/RepeatItem.tsx +13 -6
- package/src/components/FormComponents/SingleItem/SingleItem.tsx +12 -3
- package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +21 -3
- package/src/components/FormComponents/StringItem/StringItem.tsx +7 -5
- package/src/components/FormComponents/Tables/AddRowButton.tsx +50 -0
- package/src/components/FormComponents/Tables/DeleteRowButton.tsx +3 -2
- package/src/components/FormComponents/Tables/{QItemGroupTable.tsx → GroupTable.tsx} +22 -22
- package/src/components/FormComponents/Tables/{QItemGroupTableRow.tsx → GroupTableRow.tsx} +8 -4
- package/src/components/FormComponents/Tables/index.ts +1 -1
- package/src/components/FormComponents/TextItem/TextItem.tsx +7 -5
- package/src/components/FormComponents/TimeItem/TimeItem.tsx +8 -6
- package/src/components/FormComponents/UrlItem/UrlItem.tsx +7 -5
- package/src/components/Renderer/FormBodyTabbed.tsx +1 -1
- package/src/components/Renderer/FormTopLevelItem.tsx +9 -4
- package/src/components/Tabs/FormBodySingleTab.tsx +1 -1
- package/src/components/Tabs/FormBodyTabList.tsx +5 -8
- package/src/components/Tabs/FormBodyTabListWrapper.tsx +15 -26
- package/src/components/Tabs/ShowCompletedTabsSection.tsx +52 -0
- package/src/hooks/useContextDisplayItems.ts +40 -0
- package/src/hooks/useInitialiseRenderer.ts +2 -2
- package/src/hooks/useInitialiseRepeatGroups.ts +1 -1
- package/src/hooks/useNumberInput.ts +2 -1
- package/src/hooks/useReadOnly.ts +30 -0
- package/src/hooks/useStringInput.ts +2 -1
- package/src/hooks/useTerminologyServerQuery.ts +3 -6
- package/src/index.ts +2 -2
- package/src/interfaces/calculatedExpression.interface.ts +1 -1
- package/src/interfaces/renderProps.interface.ts +8 -0
- package/src/stores/useQuestionnaireResponseStore.ts +5 -4
- package/src/theme/typography.ts +3 -5
- package/src/utils/calculatedExpression.ts +68 -12
- package/src/utils/qrItem.ts +4 -3
- package/src/utils/repopulateIntoResponse.ts +2 -2
- package/src/utils/repopulateItems.ts +0 -1
|
@@ -22,20 +22,22 @@ import { createFhirPathContext } from './fhirpath';
|
|
|
22
22
|
import { getQrItemsIndex, mapQItemsIndex } from './mapItem';
|
|
23
23
|
import { updateQrItemsInGroup } from './qrItem';
|
|
24
24
|
import cloneDeep from 'lodash.clonedeep';
|
|
25
|
+
import dayjs from 'dayjs';
|
|
26
|
+
import moment from 'moment';
|
|
25
27
|
export function evaluateInitialCalculatedExpressions(params) {
|
|
26
28
|
const { initialResponse, calculatedExpressions, variablesFhirPath } = params;
|
|
27
29
|
// Return early if initialResponse is empty
|
|
28
30
|
if (_isEqual(initialResponse, cloneDeep(emptyResponse))) {
|
|
29
31
|
return calculatedExpressions;
|
|
30
32
|
}
|
|
31
|
-
const
|
|
32
|
-
if (Object.keys(
|
|
33
|
+
const initialCalculatedExpressions = Object.assign({}, calculatedExpressions);
|
|
34
|
+
if (Object.keys(initialCalculatedExpressions).length > 0) {
|
|
33
35
|
const fhirPathContext = createFhirPathContext(initialResponse, variablesFhirPath);
|
|
34
|
-
for (const linkId in
|
|
36
|
+
for (const linkId in initialCalculatedExpressions) {
|
|
35
37
|
try {
|
|
36
38
|
const result = fhirpath.evaluate(initialResponse, calculatedExpressions[linkId].expression, fhirPathContext, fhirpath_r4_model);
|
|
37
|
-
if (calculatedExpressions[linkId].value
|
|
38
|
-
|
|
39
|
+
if (!_isEqual(calculatedExpressions[linkId].value, result[0])) {
|
|
40
|
+
initialCalculatedExpressions[linkId].value = result[0];
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
catch (e) {
|
|
@@ -43,7 +45,7 @@ export function evaluateInitialCalculatedExpressions(params) {
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
return
|
|
48
|
+
return initialCalculatedExpressions;
|
|
47
49
|
}
|
|
48
50
|
export function evaluateCalculatedExpressions(fhirPathContext, calculatedExpressions) {
|
|
49
51
|
const updatedCalculatedExpressions = Object.assign({}, calculatedExpressions);
|
|
@@ -52,7 +54,7 @@ export function evaluateCalculatedExpressions(fhirPathContext, calculatedExpress
|
|
|
52
54
|
try {
|
|
53
55
|
const result = fhirpath.evaluate('', calculatedExpressions[linkId].expression, fhirPathContext, fhirpath_r4_model);
|
|
54
56
|
if (result.length > 0) {
|
|
55
|
-
if (calculatedExpressions[linkId].value
|
|
57
|
+
if (!_isEqual(calculatedExpressions[linkId].value, result[0])) {
|
|
56
58
|
isUpdated = true;
|
|
57
59
|
updatedCalculatedExpressions[linkId].value = result[0];
|
|
58
60
|
}
|
|
@@ -168,13 +170,57 @@ function constructSingleItem(qItem, calculatedExpressions) {
|
|
|
168
170
|
answer: [calculatedExpressionAnswer]
|
|
169
171
|
};
|
|
170
172
|
}
|
|
173
|
+
// duplicate functions in sdc-populate
|
|
171
174
|
function parseValueToAnswer(qItem, value) {
|
|
175
|
+
if (qItem.answerOption) {
|
|
176
|
+
const answerOption = qItem.answerOption.find((option) => { var _a; return ((_a = option.valueCoding) === null || _a === void 0 ? void 0 : _a.code) === (value === null || value === void 0 ? void 0 : value.code); });
|
|
177
|
+
if (answerOption) {
|
|
178
|
+
return answerOption;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (typeof value === 'boolean' && qItem.type === 'boolean') {
|
|
182
|
+
return { valueBoolean: value };
|
|
183
|
+
}
|
|
172
184
|
if (typeof value === 'number') {
|
|
185
|
+
if (qItem.type === 'decimal') {
|
|
186
|
+
return { valueDecimal: value };
|
|
187
|
+
}
|
|
173
188
|
if (qItem.type === 'integer') {
|
|
174
189
|
return { valueInteger: value };
|
|
175
190
|
}
|
|
176
|
-
|
|
191
|
+
}
|
|
192
|
+
if (typeof value === 'object') {
|
|
193
|
+
return { valueCoding: value };
|
|
194
|
+
}
|
|
195
|
+
// Value is string at this point
|
|
196
|
+
if (qItem.type === 'date' && checkIsDateTime(value)) {
|
|
197
|
+
return { valueDate: value };
|
|
198
|
+
}
|
|
199
|
+
if (qItem.type === 'dateTime' && checkIsDateTime(value)) {
|
|
200
|
+
return { valueDateTime: value };
|
|
201
|
+
}
|
|
202
|
+
if (qItem.type === 'time' && checkIsTime(value)) {
|
|
203
|
+
return { valueTime: value };
|
|
177
204
|
}
|
|
178
205
|
return { valueString: value };
|
|
179
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Check if an answer is a datetime in the format YYYY, YYYY-MM, YYYY-MM-DD, YYYY-MM-DDThh:mm:ss+zz:zz
|
|
209
|
+
*
|
|
210
|
+
* @author Sean Fong
|
|
211
|
+
*/
|
|
212
|
+
export function checkIsDateTime(value) {
|
|
213
|
+
const acceptedFormats = ['YYYY', 'YYYY-MM', 'YYYY-MM-DD', 'YYYY-MM-DDTHH:mm:ssZ'];
|
|
214
|
+
const formattedDate = dayjs(value).format();
|
|
215
|
+
return moment(formattedDate, acceptedFormats, true).isValid();
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Check if an answer is in a time format - Regex: ([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?
|
|
219
|
+
*
|
|
220
|
+
* @author Sean Fong
|
|
221
|
+
*/
|
|
222
|
+
export function checkIsTime(value) {
|
|
223
|
+
const timeRegex = /^([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?$/;
|
|
224
|
+
return timeRegex.test(value);
|
|
225
|
+
}
|
|
180
226
|
//# sourceMappingURL=calculatedExpression.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculatedExpression.js","sourceRoot":"","sources":["../../src/utils/calculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"calculatedExpression.js","sourceRoot":"","sources":["../../src/utils/calculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,iBAAiB,MAAM,0BAA0B,CAAC;AAUzD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAQ5B,MAAM,UAAU,oCAAoC,CAClD,MAAkD;IAElD,MAAM,EAAE,eAAe,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC;IAE7E,2CAA2C;IAC3C,IAAI,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC,EAAE;QACvD,OAAO,qBAAqB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Ae,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,SAAS,GAAG,4DAA4D,CAAC;IAC/E,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
package/lib/utils/qrItem.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Questionnaire, QuestionnaireItem, QuestionnaireResponse, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
2
|
import type { QrRepeatGroup } from '../interfaces/repeatGroup.interface';
|
|
3
3
|
/**
|
|
4
|
-
* Create
|
|
5
|
-
* A questionnaire form item is the first item of a questionnaire
|
|
4
|
+
* Create an empty questionnaireResponse from a given questionnaire
|
|
6
5
|
*
|
|
7
6
|
* @author Sean Fong
|
|
8
7
|
*/
|
|
9
|
-
export declare function
|
|
8
|
+
export declare function createEmptyQuestionnaireResponse(questionnaire: Questionnaire): QuestionnaireResponse;
|
|
10
9
|
/**
|
|
11
10
|
* Remove items with no answers from a given questionnaireResponse
|
|
12
11
|
* Also remove any starting or trailing whitespace from valueStrings
|
package/lib/utils/qrItem.js
CHANGED
|
@@ -15,12 +15,11 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
|
-
* Create
|
|
19
|
-
* A questionnaire form item is the first item of a questionnaire
|
|
18
|
+
* Create an empty questionnaireResponse from a given questionnaire
|
|
20
19
|
*
|
|
21
20
|
* @author Sean Fong
|
|
22
21
|
*/
|
|
23
|
-
export function
|
|
22
|
+
export function createEmptyQuestionnaireResponse(questionnaire) {
|
|
24
23
|
var _a;
|
|
25
24
|
const questionnaireResponse = {
|
|
26
25
|
resourceType: 'QuestionnaireResponse',
|
package/lib/utils/qrItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qrItem.js","sourceRoot":"","sources":["../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;aACP;SACF;KACF;AACH,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
-
import { ItemToRepopulate } from './repopulateItems';
|
|
1
|
+
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
+
import type { ItemToRepopulate } from './repopulateItems';
|
|
3
3
|
export declare function repopulateItemsIntoResponse(questionnaire: Questionnaire, updatableResponse: QuestionnaireResponse, checkedItemsToRepopulate: Record<string, ItemToRepopulate>): QuestionnaireResponse;
|
|
@@ -65,7 +65,6 @@ function getCorrespondingQuestionnaireItemsRecursive(qItem, heading, tabs, hasTa
|
|
|
65
65
|
heading = (_b = (_a = getShortText(qItem)) !== null && _a !== void 0 ? _a : qItem.text) !== null && _b !== void 0 ? _b : null;
|
|
66
66
|
}
|
|
67
67
|
// TODO it seems like there can only be one answer per linkId, we might need to do repeat groups differently
|
|
68
|
-
// so we need to fix this one first it seems like
|
|
69
68
|
/* Repeat group implementation */
|
|
70
69
|
if (qItem.type === 'group' && qItem.repeats) {
|
|
71
70
|
const isRepeatGroupToRepopulate = checkIsRepeatGroupToRepopulate(qItem, itemsToRepopulate);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repopulateItems.js","sourceRoot":"","sources":["../../src/utils/repopulateItems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC3B,MAAM,yBAAyB,CAAC;AASjC,MAAM,UAAU,oBAAoB,CAClC,mBAAkC,EAClC,SAAiC,EACjC,IAAU,EACV,iBAAwC,EACxC,iBAAwC;;IAExC,IACE,CAAC,mBAAmB,CAAC,IA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ms-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "FHIR Structured Data Captured (SDC) rendering engine for Smart Forms",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/aehrc/smart-forms#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
26
|
+
"deep-diff": "^1.0.2",
|
|
27
27
|
"@iconify/react": "^4.1.1",
|
|
28
|
-
"dayjs": "^1.11.
|
|
28
|
+
"dayjs": "^1.11.10",
|
|
29
29
|
"fhirclient": "^2.5.2",
|
|
30
30
|
"fhirpath": "^3.6.1",
|
|
31
31
|
"html-react-parser": "^4.2.0",
|
|
32
32
|
"lodash.clonedeep": "^4.5.0",
|
|
33
33
|
"lodash.debounce": "^4.0.8",
|
|
34
|
-
"nanoid": "^
|
|
34
|
+
"nanoid": "^5.0.1",
|
|
35
35
|
"@types/fhir": "^0.0.37",
|
|
36
36
|
"zustand": "^4.4.1",
|
|
37
37
|
"react-markdown": "^8.0.7",
|
|
@@ -49,28 +49,28 @@
|
|
|
49
49
|
"react-dom": ">=18.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@babel/core": "^7.
|
|
53
|
-
"@storybook/addon-essentials": "^7.4.
|
|
54
|
-
"@storybook/addon-interactions": "^7.4.
|
|
52
|
+
"@babel/core": "^7.23.0",
|
|
53
|
+
"@storybook/addon-essentials": "^7.4.6",
|
|
54
|
+
"@storybook/addon-interactions": "^7.4.3",
|
|
55
55
|
"@storybook/addon-links": "^7.4.0",
|
|
56
56
|
"@storybook/addon-onboarding": "^1.0.8",
|
|
57
57
|
"@storybook/addon-styling": "^1.3.7",
|
|
58
58
|
"@storybook/blocks": "^7.4.0",
|
|
59
|
-
"@storybook/react": "^7.4.
|
|
60
|
-
"@storybook/react-vite": "^7.4.
|
|
61
|
-
"@storybook/testing-library": "^0.2.
|
|
59
|
+
"@storybook/react": "^7.4.3",
|
|
60
|
+
"@storybook/react-vite": "^7.4.5",
|
|
61
|
+
"@storybook/testing-library": "^0.2.1",
|
|
62
62
|
"@testing-library/jest-dom": "^6.1.2",
|
|
63
63
|
"@testing-library/react": "^14.0.0",
|
|
64
64
|
"@testing-library/react-hooks": "^7.0.2",
|
|
65
|
-
"@types/jest": "^29.5.
|
|
66
|
-
"@types/
|
|
65
|
+
"@types/jest": "^29.5.5",
|
|
66
|
+
"@types/deep-diff": "^1.0.3",
|
|
67
67
|
"@types/react": "^18.2.18",
|
|
68
|
-
"@types/react-dom": "^18.2.
|
|
69
|
-
"jest": "^29.
|
|
68
|
+
"@types/react-dom": "^18.2.9",
|
|
69
|
+
"jest": "^29.7.0",
|
|
70
70
|
"jest-environment-jsdom": "^29.6.4",
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"react-dom": "^18.2.0",
|
|
73
|
-
"storybook": "^7.4.
|
|
73
|
+
"storybook": "^7.4.5",
|
|
74
74
|
"ts-jest": "^29.1.1",
|
|
75
75
|
"tslib": "^2.6.2",
|
|
76
76
|
"typescript": "^5.2.2"
|
|
@@ -19,6 +19,7 @@ import React from 'react';
|
|
|
19
19
|
import type {
|
|
20
20
|
PropsWithIsRepeatedAttribute,
|
|
21
21
|
PropsWithIsTabledAttribute,
|
|
22
|
+
PropsWithParentIsReadOnlyAttribute,
|
|
22
23
|
PropsWithQrItemChangeHandler
|
|
23
24
|
} from '../../../interfaces/renderProps.interface';
|
|
24
25
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
@@ -28,20 +29,22 @@ import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
|
28
29
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
29
30
|
import BooleanField from './BooleanField';
|
|
30
31
|
import Box from '@mui/material/Box';
|
|
32
|
+
import useReadOnly from '../../../hooks/useReadOnly';
|
|
31
33
|
|
|
32
34
|
interface BooleanItemProps
|
|
33
35
|
extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>,
|
|
34
36
|
PropsWithIsRepeatedAttribute,
|
|
35
|
-
PropsWithIsTabledAttribute
|
|
37
|
+
PropsWithIsTabledAttribute,
|
|
38
|
+
PropsWithParentIsReadOnlyAttribute {
|
|
36
39
|
qItem: QuestionnaireItem;
|
|
37
40
|
qrItem: QuestionnaireResponseItem;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
function BooleanItem(props: BooleanItemProps) {
|
|
41
|
-
const { qItem, qrItem, isRepeated, isTabled, onQrItemChange } = props;
|
|
44
|
+
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
const { displayInstructions
|
|
46
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
47
|
+
const { displayInstructions } = useRenderingExtensions(qItem);
|
|
45
48
|
|
|
46
49
|
// Init input value
|
|
47
50
|
let checked = false;
|
|
@@ -72,7 +75,7 @@ function BooleanItem(props: BooleanItemProps) {
|
|
|
72
75
|
}
|
|
73
76
|
return (
|
|
74
77
|
<FullWidthFormComponentBox data-test="q-item-boolean-box">
|
|
75
|
-
<ItemFieldGrid qItem={qItem} displayInstructions={displayInstructions}>
|
|
78
|
+
<ItemFieldGrid qItem={qItem} displayInstructions={displayInstructions} readOnly={readOnly}>
|
|
76
79
|
<BooleanField checked={checked} readOnly={readOnly} onCheckedChange={handleCheckedChange} />
|
|
77
80
|
</ItemFieldGrid>
|
|
78
81
|
</FullWidthFormComponentBox>
|
|
@@ -38,22 +38,25 @@ import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
|
38
38
|
import type {
|
|
39
39
|
PropsWithIsRepeatedAttribute,
|
|
40
40
|
PropsWithIsTabledAttribute,
|
|
41
|
+
PropsWithParentIsReadOnlyAttribute,
|
|
41
42
|
PropsWithQrItemChangeHandler
|
|
42
43
|
} from '../../../interfaces/renderProps.interface';
|
|
43
44
|
import { AUTOCOMPLETE_DEBOUNCE_DURATION } from '../../../utils/debounce';
|
|
44
45
|
import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
45
46
|
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
47
|
+
import useReadOnly from '../../../hooks/useReadOnly';
|
|
46
48
|
|
|
47
49
|
interface ChoiceAutocompleteItemProps
|
|
48
50
|
extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>,
|
|
49
51
|
PropsWithIsRepeatedAttribute,
|
|
50
|
-
PropsWithIsTabledAttribute
|
|
52
|
+
PropsWithIsTabledAttribute,
|
|
53
|
+
PropsWithParentIsReadOnlyAttribute {
|
|
51
54
|
qItem: QuestionnaireItem;
|
|
52
55
|
qrItem: QuestionnaireResponseItem;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
function ChoiceAutocompleteItem(props: ChoiceAutocompleteItemProps) {
|
|
56
|
-
const { qItem, qrItem, isRepeated, isTabled, onQrItemChange } = props;
|
|
59
|
+
const { qItem, qrItem, isRepeated, isTabled, parentIsReadOnly, onQrItemChange } = props;
|
|
57
60
|
const qrChoice = qrItem ?? createEmptyQrItem(qItem);
|
|
58
61
|
|
|
59
62
|
// Init input value
|
|
@@ -62,11 +65,10 @@ function ChoiceAutocompleteItem(props: ChoiceAutocompleteItemProps) {
|
|
|
62
65
|
valueCoding = qrChoice.answer[0].valueCoding;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
const { displayUnit, displayPrompt, displayInstructions,
|
|
68
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
69
|
+
const { displayUnit, displayPrompt, displayInstructions, entryFormat } =
|
|
67
70
|
useRenderingExtensions(qItem);
|
|
68
71
|
|
|
69
|
-
// Query ontoserver for options
|
|
70
72
|
const maxList = 10;
|
|
71
73
|
|
|
72
74
|
const [input, setInput] = useState('');
|
|
@@ -167,11 +169,11 @@ function ChoiceAutocompleteItem(props: ChoiceAutocompleteItemProps) {
|
|
|
167
169
|
<FullWidthFormComponentBox>
|
|
168
170
|
<Grid container columnSpacing={6}>
|
|
169
171
|
<Grid item xs={5}>
|
|
170
|
-
<LabelWrapper qItem={qItem} />
|
|
172
|
+
<LabelWrapper qItem={qItem} readOnly={readOnly} />
|
|
171
173
|
</Grid>
|
|
172
174
|
<Grid item xs={7}>
|
|
173
175
|
{choiceAutocomplete}
|
|
174
|
-
<DisplayInstructions displayInstructions={displayInstructions} />
|
|
176
|
+
<DisplayInstructions displayInstructions={displayInstructions} readOnly={readOnly} />
|
|
175
177
|
</Grid>
|
|
176
178
|
</Grid>
|
|
177
179
|
</FullWidthFormComponentBox>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
20
|
+
import type { QuestionnaireItem, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
21
|
+
import QItemChoiceCheckboxSingle from '../ItemParts/CheckboxSingle';
|
|
22
|
+
import { StyledFormGroup } from '../Item.styles';
|
|
23
|
+
|
|
24
|
+
interface ChoiceCheckboxAnswerOptionFieldsProps {
|
|
25
|
+
qItem: QuestionnaireItem;
|
|
26
|
+
answers: QuestionnaireResponseItemAnswer[];
|
|
27
|
+
orientation: ChoiceItemOrientation;
|
|
28
|
+
readOnly: boolean;
|
|
29
|
+
onCheckedChange: (newValue: string) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function ChoiceCheckboxAnswerOptionFields(props: ChoiceCheckboxAnswerOptionFieldsProps) {
|
|
33
|
+
const { qItem, answers, orientation, readOnly, onCheckedChange } = props;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<StyledFormGroup row={orientation === ChoiceItemOrientation.Horizontal}>
|
|
37
|
+
{qItem.answerOption?.map((option) => {
|
|
38
|
+
if (option['valueCoding']) {
|
|
39
|
+
return (
|
|
40
|
+
<QItemChoiceCheckboxSingle
|
|
41
|
+
key={option.valueCoding.code ?? ''}
|
|
42
|
+
value={option.valueCoding.code ?? ''}
|
|
43
|
+
label={option.valueCoding.display ?? `${option.valueCoding.code}`}
|
|
44
|
+
readOnly={readOnly}
|
|
45
|
+
isChecked={answers.some(
|
|
46
|
+
(answer) => JSON.stringify(answer) === JSON.stringify(option)
|
|
47
|
+
)}
|
|
48
|
+
onCheckedChange={onCheckedChange}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (option['valueString']) {
|
|
54
|
+
return (
|
|
55
|
+
<QItemChoiceCheckboxSingle
|
|
56
|
+
key={option.valueString}
|
|
57
|
+
value={option.valueString}
|
|
58
|
+
label={option.valueString}
|
|
59
|
+
readOnly={readOnly}
|
|
60
|
+
isChecked={answers.some((answer) => answer.valueString === option.valueString)}
|
|
61
|
+
onCheckedChange={onCheckedChange}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (option['valueInteger']) {
|
|
67
|
+
return (
|
|
68
|
+
<QItemChoiceCheckboxSingle
|
|
69
|
+
key={option.valueInteger}
|
|
70
|
+
value={option.valueInteger.toString()}
|
|
71
|
+
label={option.valueInteger.toString()}
|
|
72
|
+
readOnly={readOnly}
|
|
73
|
+
isChecked={answers.some((answer) => answer.valueInteger === option.valueInteger)}
|
|
74
|
+
onCheckedChange={onCheckedChange}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return null;
|
|
80
|
+
})}
|
|
81
|
+
</StyledFormGroup>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default ChoiceCheckboxAnswerOptionFields;
|
|
@@ -17,38 +17,50 @@
|
|
|
17
17
|
|
|
18
18
|
import React from 'react';
|
|
19
19
|
import Grid from '@mui/material/Grid';
|
|
20
|
-
import { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
20
|
+
import type { ChoiceItemOrientation } from '../../../interfaces/choice.enum';
|
|
21
21
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
22
|
-
import QItemChoiceCheckboxSingle from '../ItemParts/CheckboxSingle';
|
|
23
22
|
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
24
|
-
import { QFormGroup } from '../Item.styles';
|
|
25
23
|
import { updateQrCheckboxAnswers } from '../../../utils/choice';
|
|
26
24
|
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
27
25
|
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
28
26
|
import type {
|
|
29
27
|
PropsWithIsRepeatedAttribute,
|
|
30
|
-
|
|
28
|
+
PropsWithParentIsReadOnlyAttribute,
|
|
29
|
+
PropsWithQrItemChangeHandler,
|
|
30
|
+
PropsWithTextShownAttribute
|
|
31
31
|
} from '../../../interfaces/renderProps.interface';
|
|
32
32
|
import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
33
33
|
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
34
|
+
import ChoiceCheckboxAnswerValueSetFields from './ChoiceCheckboxAnswerOptionFields';
|
|
35
|
+
import useReadOnly from '../../../hooks/useReadOnly';
|
|
34
36
|
|
|
35
37
|
interface ChoiceCheckboxAnswerOptionItemProps
|
|
36
38
|
extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>,
|
|
37
|
-
PropsWithIsRepeatedAttribute
|
|
39
|
+
PropsWithIsRepeatedAttribute,
|
|
40
|
+
PropsWithTextShownAttribute,
|
|
41
|
+
PropsWithParentIsReadOnlyAttribute {
|
|
38
42
|
qItem: QuestionnaireItem;
|
|
39
43
|
qrItem: QuestionnaireResponseItem;
|
|
40
44
|
orientation: ChoiceItemOrientation;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
function ChoiceCheckboxAnswerOptionItem(props: ChoiceCheckboxAnswerOptionItemProps) {
|
|
44
|
-
const {
|
|
48
|
+
const {
|
|
49
|
+
qItem,
|
|
50
|
+
qrItem,
|
|
51
|
+
orientation,
|
|
52
|
+
isRepeated,
|
|
53
|
+
textShown = true,
|
|
54
|
+
parentIsReadOnly,
|
|
55
|
+
onQrItemChange
|
|
56
|
+
} = props;
|
|
45
57
|
|
|
46
58
|
// Init input value
|
|
47
59
|
const qrChoiceCheckbox = qrItem ?? createEmptyQrItem(qItem);
|
|
48
60
|
const answers = qrChoiceCheckbox.answer ? qrChoiceCheckbox.answer : [];
|
|
49
61
|
|
|
50
|
-
|
|
51
|
-
const { displayInstructions
|
|
62
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
63
|
+
const { displayInstructions } = useRenderingExtensions(qItem);
|
|
52
64
|
|
|
53
65
|
// Event handlers
|
|
54
66
|
function handleCheckedChange(changedValue: string) {
|
|
@@ -68,63 +80,39 @@ function ChoiceCheckboxAnswerOptionItem(props: ChoiceCheckboxAnswerOptionItemPro
|
|
|
68
80
|
}
|
|
69
81
|
}
|
|
70
82
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
if (textShown) {
|
|
84
|
+
return (
|
|
85
|
+
<FullWidthFormComponentBox data-test="q-item-choice-checkbox-answer-option-box">
|
|
86
|
+
<Grid container columnSpacing={6}>
|
|
87
|
+
<Grid item xs={5}>
|
|
88
|
+
<LabelWrapper qItem={qItem} readOnly={readOnly} />
|
|
89
|
+
</Grid>
|
|
90
|
+
<Grid item xs={7}>
|
|
91
|
+
<ChoiceCheckboxAnswerValueSetFields
|
|
92
|
+
qItem={qItem}
|
|
93
|
+
answers={answers}
|
|
94
|
+
orientation={orientation}
|
|
80
95
|
readOnly={readOnly}
|
|
81
|
-
isChecked={answers.some(
|
|
82
|
-
(answer) => JSON.stringify(answer) === JSON.stringify(option)
|
|
83
|
-
)}
|
|
84
96
|
onCheckedChange={handleCheckedChange}
|
|
85
97
|
/>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
label={option.valueString}
|
|
93
|
-
readOnly={readOnly}
|
|
94
|
-
isChecked={answers.some((answer) => answer.valueString === option.valueString)}
|
|
95
|
-
onCheckedChange={handleCheckedChange}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
} else if (option['valueInteger']) {
|
|
99
|
-
return (
|
|
100
|
-
<QItemChoiceCheckboxSingle
|
|
101
|
-
key={option.valueInteger}
|
|
102
|
-
value={option.valueInteger.toString()}
|
|
103
|
-
label={option.valueInteger.toString()}
|
|
104
|
-
readOnly={readOnly}
|
|
105
|
-
isChecked={answers.some((answer) => answer.valueInteger === option.valueInteger)}
|
|
106
|
-
onCheckedChange={handleCheckedChange}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
109
|
-
} else {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
})}
|
|
113
|
-
</QFormGroup>
|
|
114
|
-
);
|
|
98
|
+
<DisplayInstructions displayInstructions={displayInstructions} readOnly={readOnly} />
|
|
99
|
+
</Grid>
|
|
100
|
+
</Grid>
|
|
101
|
+
</FullWidthFormComponentBox>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
115
104
|
|
|
116
105
|
return (
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
</FullWidthFormComponentBox>
|
|
106
|
+
<>
|
|
107
|
+
<ChoiceCheckboxAnswerValueSetFields
|
|
108
|
+
qItem={qItem}
|
|
109
|
+
answers={answers}
|
|
110
|
+
orientation={orientation}
|
|
111
|
+
readOnly={readOnly}
|
|
112
|
+
onCheckedChange={handleCheckedChange}
|
|
113
|
+
/>
|
|
114
|
+
<DisplayInstructions displayInstructions={displayInstructions} readOnly={readOnly} />
|
|
115
|
+
</>
|
|
128
116
|
);
|
|
129
117
|
}
|
|
130
118
|
|