@aehrc/smart-forms-renderer 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js +1 -2
- 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 +14 -27
- 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 +14 -22
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.d.ts +2 -2
- package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +3 -3
- 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 +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +9 -24
- 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 +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +8 -21
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +10 -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.js +7 -23
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.d.ts +12 -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.js +8 -18
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js +3 -2
- package/lib/components/FormComponents/DecimalItem/DecimalItem.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridGroup.js +2 -2
- package/lib/components/FormComponents/GridGroup/GridGroup.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridRow.js +2 -2
- package/lib/components/FormComponents/GridGroup/GridRow.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupChildItemSwitcher.d.ts +10 -0
- package/lib/components/FormComponents/GroupItem/GroupChildItemSwitcher.js +73 -0
- package/lib/components/FormComponents/GroupItem/GroupChildItemSwitcher.js.map +1 -0
- package/lib/components/FormComponents/GroupItem/GroupItem.js +3 -3
- package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +4 -4
- package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/ItemSwitcher.d.ts +10 -0
- package/lib/components/FormComponents/GroupItem/ItemSwitcher.js +81 -0
- package/lib/components/FormComponents/GroupItem/ItemSwitcher.js.map +1 -0
- package/lib/components/FormComponents/GroupItem/TopLevelGroupItemSwitcher.d.ts +10 -0
- package/lib/components/FormComponents/GroupItem/TopLevelGroupItemSwitcher.js +45 -0
- package/lib/components/FormComponents/GroupItem/TopLevelGroupItemSwitcher.js.map +1 -0
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js +3 -2
- package/lib/components/FormComponents/IntegerItem/IntegerItem.js.map +1 -1
- package/lib/components/FormComponents/Item.styles.d.ts +2 -2
- package/lib/components/FormComponents/Item.styles.js +2 -2
- package/lib/components/FormComponents/Item.styles.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/OpenChoiceItems/OpenChoiceAutocompleteField.d.ts +20 -0
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js +49 -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.js +11 -35
- 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 +23 -36
- 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 +3 -3
- 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 +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +3 -23
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.d.ts +11 -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.js +18 -23
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js.map +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.d.ts +12 -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.js +8 -14
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js +4 -3
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/index.d.ts +1 -0
- package/lib/components/FormComponents/RepeatGroup/index.js +18 -0
- package/lib/components/FormComponents/RepeatGroup/index.js.map +1 -0
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js.map +1 -1
- package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +2 -2
- package/lib/components/FormComponents/SingleItem/SingleItem.js +2 -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 +3 -3
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
- package/lib/components/FormComponents/SingleItem/index.d.ts +1 -0
- package/lib/components/FormComponents/SingleItem/index.js +18 -0
- package/lib/components/FormComponents/SingleItem/index.js.map +1 -0
- package/lib/components/FormComponents/StringItem/StringItem.js +3 -2
- 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 +8 -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/GroupTable.d.ts +10 -0
- package/lib/components/FormComponents/Tables/GroupTable.js +108 -0
- package/lib/components/FormComponents/Tables/GroupTable.js.map +1 -0
- package/lib/components/FormComponents/Tables/GroupTableRow.d.ts +10 -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 +7 -5
- 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 -0
- package/lib/components/FormComponents/Tables/index.js +18 -0
- package/lib/components/FormComponents/Tables/index.js.map +1 -0
- package/lib/components/FormComponents/TextItem/TextItem.js +3 -2
- package/lib/components/FormComponents/TextItem/TextItem.js.map +1 -1
- package/lib/components/FormComponents/index.d.ts +3 -0
- package/lib/components/FormComponents/index.js +20 -0
- package/lib/components/FormComponents/index.js.map +1 -0
- package/lib/components/Renderer/BaseRenderer.js +26 -14
- package/lib/components/Renderer/BaseRenderer.js.map +1 -1
- package/lib/components/Renderer/FormBodyCollapsible.js +2 -2
- package/lib/components/Renderer/FormBodyCollapsible.js.map +1 -1
- package/lib/components/Renderer/FormBodyTabbed.js +3 -3
- package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
- package/lib/components/Renderer/FormTopLevelItem.d.ts +4 -4
- package/lib/components/Renderer/FormTopLevelItem.js +14 -1
- package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
- package/lib/components/Tabs/FormBodySingleTab.js +1 -1
- package/lib/components/Tabs/FormBodySingleTab.js.map +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/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/index.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/useDecimalUpdateFromProp.d.ts +2 -0
- package/lib/hooks/useDecimalUpdateFromProp.js +29 -0
- package/lib/hooks/useDecimalUpdateFromProp.js.map +1 -0
- package/lib/hooks/useInitialiseRenderer.js +2 -2
- package/lib/hooks/useInitialiseRenderer.js.map +1 -1
- package/lib/hooks/useInitialiseRepeatAnswers.d.ts +2 -2
- package/lib/hooks/useInitialiseRepeatAnswers.js +21 -15
- package/lib/hooks/useInitialiseRepeatAnswers.js.map +1 -1
- package/lib/hooks/useInitialiseRepeatGroups.d.ts +2 -1
- package/lib/hooks/useInitialiseRepeatGroups.js +21 -15
- package/lib/hooks/useInitialiseRepeatGroups.js.map +1 -1
- package/lib/hooks/useIntegerUpdateFromProp.d.ts +2 -0
- package/lib/hooks/useIntegerUpdateFromProp.js +29 -0
- package/lib/hooks/useIntegerUpdateFromProp.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/useNumberUpdateFromProp.d.ts +2 -0
- package/lib/hooks/useNumberUpdateFromProp.js +29 -0
- package/lib/hooks/useNumberUpdateFromProp.js.map +1 -0
- package/lib/hooks/useRepeatItemState.d.ts +5 -0
- package/lib/hooks/useRepeatItemState.js +35 -0
- package/lib/hooks/useRepeatItemState.js.map +1 -0
- package/lib/hooks/useRepeatItemUpdateFromProp.d.ts +2 -0
- package/lib/hooks/useRepeatItemUpdateFromProp.js +29 -0
- package/lib/hooks/useRepeatItemUpdateFromProp.js.map +1 -0
- package/lib/hooks/useStringField.d.ts +2 -0
- package/lib/hooks/useStringField.js +29 -0
- package/lib/hooks/useStringField.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/hooks/useStringUpdateFromProp.d.ts +2 -0
- package/lib/hooks/useStringUpdateFromProp.js +29 -0
- package/lib/hooks/useStringUpdateFromProp.js.map +1 -0
- package/lib/hooks/useTerminologyServerQuery.js +3 -6
- package/lib/hooks/useTerminologyServerQuery.js.map +1 -1
- package/lib/index.d.ts +16 -0
- package/lib/index.js +29 -2
- package/lib/index.js.map +1 -1
- package/lib/interfaces/questionnaireStore.interface.d.ts +1 -0
- package/lib/interfaces/renderProps.interface.d.ts +3 -0
- package/lib/stores/useQuestionnaireResponseStore.d.ts +2 -1
- package/lib/stores/useQuestionnaireResponseStore.js +17 -10
- package/lib/stores/useQuestionnaireResponseStore.js.map +1 -1
- package/lib/stores/useQuestionnaireStore.d.ts +2 -1
- package/lib/stores/useQuestionnaireStore.js +5 -2
- package/lib/stores/useQuestionnaireStore.js.map +1 -1
- package/lib/theme/overrides/Overrides.js +1 -2
- package/lib/theme/overrides/Overrides.js.map +1 -1
- package/lib/utils/calculatedExpression.js +2 -2
- package/lib/utils/calculatedExpression.js.map +1 -1
- package/lib/utils/formChanges.d.ts +18 -0
- package/lib/utils/formChanges.js +91 -0
- package/lib/utils/formChanges.js.map +1 -0
- package/lib/utils/formChangesOld.d.ts +18 -0
- package/lib/utils/formChangesOld.js +91 -0
- package/lib/utils/formChangesOld.js.map +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +18 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/mapItem.d.ts +2 -2
- package/lib/utils/mapItem.js +3 -3
- package/lib/utils/mapItem.js.map +1 -1
- package/lib/utils/qItem.d.ts +2 -0
- package/lib/utils/qItem.js +22 -0
- package/lib/utils/qItem.js.map +1 -1
- package/lib/utils/qrItem.d.ts +3 -4
- package/lib/utils/qrItem.js +94 -96
- package/lib/utils/qrItem.js.map +1 -1
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +4 -0
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
- package/lib/utils/repopulate.d.ts +9 -0
- package/lib/utils/repopulate.js +133 -0
- package/lib/utils/repopulate.js.map +1 -0
- package/lib/utils/repopulateGenerateItems.d.ts +9 -0
- package/lib/utils/repopulateGenerateItems.js +133 -0
- package/lib/utils/repopulateGenerateItems.js.map +1 -0
- package/lib/utils/repopulateIntoResponse.d.ts +3 -0
- package/lib/utils/repopulateIntoResponse.js +92 -0
- package/lib/utils/repopulateIntoResponse.js.map +1 -0
- package/lib/utils/repopulateItems.d.ts +9 -0
- package/lib/utils/repopulateItems.js +130 -0
- package/lib/utils/repopulateItems.js.map +1 -0
- package/lib/utils/repopulateRepeatGroup.d.ts +4 -0
- package/lib/utils/repopulateRepeatGroup.js +54 -0
- package/lib/utils/repopulateRepeatGroup.js.map +1 -0
- package/package.json +7 -5
- package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +1 -2
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +85 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +35 -58
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +79 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +37 -50
- package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +10 -5
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +48 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +25 -53
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +83 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +27 -49
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +81 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +19 -54
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +97 -0
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +22 -60
- package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +3 -2
- package/src/components/FormComponents/GridGroup/GridGroup.tsx +2 -2
- package/src/components/FormComponents/GridGroup/GridRow.tsx +2 -2
- package/src/components/FormComponents/GroupItem/GroupItem.tsx +3 -3
- package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +4 -4
- package/src/components/FormComponents/IntegerItem/IntegerItem.tsx +3 -2
- package/src/components/FormComponents/Item.styles.ts +2 -2
- package/src/components/FormComponents/ItemParts/RadioAnswerOptionButtons.tsx +72 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx +131 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +38 -93
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +112 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +57 -76
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +8 -5
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +72 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +12 -59
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +54 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +40 -64
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.tsx +63 -0
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +22 -50
- package/src/components/FormComponents/RepeatGroup/RepeatGroup.tsx +4 -3
- package/src/{theme/overrides/Backdrop.ts → components/FormComponents/RepeatGroup/index.ts} +1 -17
- package/src/components/FormComponents/RepeatItem/RepeatItem.tsx +1 -1
- package/src/components/FormComponents/SingleItem/SingleItem.tsx +6 -3
- package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +7 -3
- package/src/components/FormComponents/SingleItem/index.ts +18 -0
- package/src/components/FormComponents/StringItem/StringItem.tsx +3 -2
- package/src/components/FormComponents/Tables/AddRowButton.tsx +49 -0
- package/src/components/FormComponents/Tables/{QItemGroupTable.tsx → GroupTable.tsx} +21 -23
- package/src/components/FormComponents/Tables/{QItemGroupTableRow.tsx → GroupTableRow.tsx} +4 -4
- package/src/components/FormComponents/Tables/index.ts +18 -0
- package/src/components/FormComponents/TextItem/TextItem.tsx +3 -2
- package/src/components/FormComponents/index.ts +20 -0
- package/src/components/Renderer/BaseRenderer.tsx +39 -18
- package/src/components/Renderer/FormBodyCollapsible.tsx +2 -2
- package/src/components/Renderer/FormBodyTabbed.tsx +3 -3
- package/src/components/Renderer/FormTopLevelItem.tsx +33 -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/components/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useContextDisplayItems.ts +40 -0
- package/src/hooks/useInitialiseRenderer.ts +2 -2
- package/src/hooks/useInitialiseRepeatAnswers.ts +28 -17
- package/src/hooks/useInitialiseRepeatGroups.ts +28 -17
- package/src/hooks/useNumberInput.ts +38 -0
- package/src/hooks/useStringInput.ts +38 -0
- package/src/hooks/useTerminologyServerQuery.ts +3 -6
- package/src/index.ts +45 -2
- package/src/interfaces/questionnaireStore.interface.ts +1 -0
- package/src/interfaces/renderProps.interface.ts +4 -0
- package/src/stores/useQuestionnaireResponseStore.ts +15 -10
- package/src/stores/useQuestionnaireStore.ts +10 -3
- package/src/theme/overrides/Overrides.ts +0 -2
- package/src/utils/calculatedExpression.ts +2 -2
- package/src/utils/formChanges.ts +141 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/mapItem.ts +6 -4
- package/src/utils/qItem.ts +29 -0
- package/src/utils/qrItem.ts +108 -97
- package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +4 -0
- package/src/utils/repopulateIntoResponse.ts +153 -0
- package/src/utils/repopulateItems.ts +206 -0
- package/src/utils/repopulateRepeatGroup.ts +68 -0
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
import React from 'react';
|
|
18
|
+
import { isSpecificItemControl } from '../../../utils/itemControl';
|
|
19
|
+
import QItemGroupTable from '../Tables/QItemGroupTable';
|
|
20
|
+
import RepeatGroup from '../RepeatGroup/RepeatGroup';
|
|
21
|
+
import { isRepeatItemAndNotCheckbox } from '../../../utils/qItem';
|
|
22
|
+
import RepeatItem from '../RepeatItem/RepeatItem';
|
|
23
|
+
import SingleItem from '../SingleItem/SingleItem';
|
|
24
|
+
import useHidden from '../../../hooks/useHidden';
|
|
25
|
+
import GroupItem from './GroupItem';
|
|
26
|
+
import GridGroup from '../GridGroup/GridGroup';
|
|
27
|
+
function GroupChildItemSwitcher(props) {
|
|
28
|
+
const { qItem, qrItemOrItems, groupCardElevation, onQrItemChange, onQrRepeatGroupChange } = props;
|
|
29
|
+
const itemIsHidden = useHidden(qItem);
|
|
30
|
+
if (itemIsHidden) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
// If there are multiple answers
|
|
34
|
+
const hasMultipleAnswers = Array.isArray(qrItemOrItems);
|
|
35
|
+
if (hasMultipleAnswers) {
|
|
36
|
+
const qrItems = qrItemOrItems;
|
|
37
|
+
// qItem should always be either a repeatGroup or a groupTable item
|
|
38
|
+
// groupTables item have qItem.repeats = true and qItem.type = 'group' as well
|
|
39
|
+
if (!qItem.repeats || qItem.type !== 'group') {
|
|
40
|
+
return React.createElement(React.Fragment, null, "Something went wrong here");
|
|
41
|
+
}
|
|
42
|
+
if (isSpecificItemControl(qItem, 'gtable')) {
|
|
43
|
+
return (React.createElement(QItemGroupTable, { qItem: qItem, qrItems: qrItems, groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
44
|
+
}
|
|
45
|
+
return (React.createElement(RepeatGroup, { qItem: qItem, qrItems: qrItems, groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
46
|
+
}
|
|
47
|
+
// If there is only one answer
|
|
48
|
+
const qrItem = qrItemOrItems;
|
|
49
|
+
const itemIsGrid = isSpecificItemControl(qItem, 'grid');
|
|
50
|
+
if (itemIsGrid) {
|
|
51
|
+
return (React.createElement(GridGroup, { qItem: qItem, qrItem: qrItem, groupCardElevation: groupCardElevation, onQrItemChange: onQrItemChange }));
|
|
52
|
+
}
|
|
53
|
+
const itemRepeatsAndIsNotCheckbox = isRepeatItemAndNotCheckbox(qItem);
|
|
54
|
+
if (itemRepeatsAndIsNotCheckbox) {
|
|
55
|
+
if (qItem.type === 'group') {
|
|
56
|
+
// If qItem is RepeatGroup or a groupTable item in this decision branch,
|
|
57
|
+
// their qrItem array should always be empty
|
|
58
|
+
if (isSpecificItemControl(qItem, 'gtable')) {
|
|
59
|
+
return (React.createElement(QItemGroupTable, { qItem: qItem, qrItems: [], groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
60
|
+
}
|
|
61
|
+
return (React.createElement(RepeatGroup, { qItem: qItem, qrItems: [], groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
62
|
+
}
|
|
63
|
+
return React.createElement(RepeatItem, { qItem: qItem, qrItem: qrItem, onQrItemChange: onQrItemChange });
|
|
64
|
+
}
|
|
65
|
+
// if qItem is not a repeating question or is a checkbox
|
|
66
|
+
if (qItem.type === 'group') {
|
|
67
|
+
return (React.createElement(GroupItem, { qItem: qItem, qrItem: qrItem, isRepeated: false, groupCardElevation: groupCardElevation + 1, onQrItemChange: onQrItemChange }));
|
|
68
|
+
}
|
|
69
|
+
// Defaults to a normal QItemSwitcher
|
|
70
|
+
return (React.createElement(SingleItem, { qItem: qItem, qrItem: qrItem, isRepeated: false, isTabled: false, onQrItemChange: onQrItemChange }));
|
|
71
|
+
}
|
|
72
|
+
export default GroupChildItemSwitcher;
|
|
73
|
+
//# sourceMappingURL=GroupChildItemSwitcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupChildItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupChildItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,WAAW,MAAM,4BAA4B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KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,KAAK,EACf,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import React, { useMemo } from 'react';
|
|
18
18
|
import { getQrItemsIndex, mapQItemsIndex } from '../../../utils/mapItem';
|
|
19
|
-
import { createQrGroup,
|
|
19
|
+
import { createQrGroup, updateQrItemsInGroup } from '../../../utils/qrItem';
|
|
20
20
|
import { QGroupContainerBox } from '../../Box.styles';
|
|
21
21
|
import useHidden from '../../../hooks/useHidden';
|
|
22
22
|
import GroupHeading from './GroupHeading';
|
|
@@ -36,12 +36,12 @@ function GroupItem(props) {
|
|
|
36
36
|
// Event Handlers
|
|
37
37
|
function handleQrItemChange(newQrItem) {
|
|
38
38
|
const updatedQrGroup = Object.assign({}, qrGroup);
|
|
39
|
-
|
|
39
|
+
updateQrItemsInGroup(newQrItem, null, updatedQrGroup, qItemsIndexMap);
|
|
40
40
|
onQrItemChange(updatedQrGroup);
|
|
41
41
|
}
|
|
42
42
|
function handleQrRepeatGroupChange(qrRepeatGroup) {
|
|
43
43
|
const updatedQrGroup = Object.assign({}, qrGroup);
|
|
44
|
-
|
|
44
|
+
updateQrItemsInGroup(null, qrRepeatGroup, updatedQrGroup, qItemsIndexMap);
|
|
45
45
|
onQrItemChange(updatedQrGroup);
|
|
46
46
|
}
|
|
47
47
|
if (!qItems || !qrItems) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,w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;YAGF,oBAAC,oBAAoB,IAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,GAAI,CAC5D,CACO,CACtB,CAAC;AACJ,CAAC;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import React from 'react';
|
|
18
|
-
import { isSpecificItemControl } from '../../../utils
|
|
19
|
-
import
|
|
18
|
+
import { isSpecificItemControl } from '../../../utils';
|
|
19
|
+
import GroupTable from '../Tables/GroupTable';
|
|
20
20
|
import RepeatGroup from '../RepeatGroup/RepeatGroup';
|
|
21
21
|
import { isRepeatItemAndNotCheckbox } from '../../../utils/qItem';
|
|
22
22
|
import RepeatItem from '../RepeatItem/RepeatItem';
|
|
@@ -40,7 +40,7 @@ function GroupItemSwitcher(props) {
|
|
|
40
40
|
return React.createElement(React.Fragment, null, "Something went wrong here");
|
|
41
41
|
}
|
|
42
42
|
if (isSpecificItemControl(qItem, 'gtable')) {
|
|
43
|
-
return (React.createElement(
|
|
43
|
+
return (React.createElement(GroupTable, { qItem: qItem, qrItems: qrItems, groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
44
44
|
}
|
|
45
45
|
return (React.createElement(RepeatGroup, { qItem: qItem, qrItems: qrItems, groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
46
46
|
}
|
|
@@ -56,7 +56,7 @@ function GroupItemSwitcher(props) {
|
|
|
56
56
|
// If qItem is RepeatGroup or a groupTable item in this decision branch,
|
|
57
57
|
// their qrItem array should always be empty
|
|
58
58
|
if (isSpecificItemControl(qItem, 'gtable')) {
|
|
59
|
-
return (React.createElement(
|
|
59
|
+
return (React.createElement(GroupTable, { qItem: qItem, qrItems: [], groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
60
60
|
}
|
|
61
61
|
return (React.createElement(RepeatGroup, { qItem: qItem, qrItems: [], groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
62
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"GroupItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAU/C,SAAS,iBAAiB,CAAC,KAA6B;IACtD,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IAElG,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,YAAY,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IAED,gCAAgC;IAChC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACxD,IAAI,kBAAkB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AqB,EAAE,qBAAqB,GAC5C,CACH,CAAC;aACH;YAED,OAAO,CACL,oBAAC,WAAW,IACV,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,EAAE,EACX,kBAAkB,EAAE,kBAAkB,GAAG,CAAC,EAC1C,qBAAqB,EAAE,qBAAqB,GAC5C,CACH,CAAC;SACH;QAED,OAAO,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAI,CAAC;KACrF;IAED,wDAAwD;IACxD,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;QAC1B,OAAO,CACL,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,KAAK,EACjB,kBAAkB,EAAE,kBAAkB,GAAG,CAAC,EAC1C,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;KACH;IAED,qCAAqC;IACrC,OAAO,CACL,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,KAAK,EACf,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PropsWithQrItemChangeHandler, PropsWithQrRepeatGroupChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
3
|
+
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
4
|
+
interface GroupItemSwitcherProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithQrRepeatGroupChangeHandler {
|
|
5
|
+
qItem: QuestionnaireItem;
|
|
6
|
+
qrItemOrItems: QuestionnaireResponseItem | QuestionnaireResponseItem[];
|
|
7
|
+
groupCardElevation: number;
|
|
8
|
+
}
|
|
9
|
+
declare function ItemSwitcher(props: GroupItemSwitcherProps): React.JSX.Element | null;
|
|
10
|
+
export default ItemSwitcher;
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
import React from 'react';
|
|
18
|
+
import { isSpecificItemControl } from '../../../utils/itemControl';
|
|
19
|
+
import QItemGroupTable from '../Tables/QItemGroupTable';
|
|
20
|
+
import RepeatGroup from '../RepeatGroup/RepeatGroup';
|
|
21
|
+
import { isRepeatItemAndNotCheckbox } from '../../../utils/qItem';
|
|
22
|
+
import RepeatItem from '../RepeatItem/RepeatItem';
|
|
23
|
+
import SingleItem from '../SingleItem/SingleItem';
|
|
24
|
+
import useHidden from '../../../hooks/useHidden';
|
|
25
|
+
import GroupItem from './GroupItem';
|
|
26
|
+
import GridGroup from '../GridGroup/GridGroup';
|
|
27
|
+
function ItemSwitcher(props) {
|
|
28
|
+
const { qItem, qrItemOrItems, groupCardElevation, onQrItemChange, onQrRepeatGroupChange } = props;
|
|
29
|
+
if (qItem.linkId === 'meds') {
|
|
30
|
+
console.log(qItem);
|
|
31
|
+
}
|
|
32
|
+
const itemIsHidden = useHidden(qItem);
|
|
33
|
+
if (itemIsHidden) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if (qItem.linkId === 'meds') {
|
|
37
|
+
console.log(qItem);
|
|
38
|
+
}
|
|
39
|
+
// If there are multiple answers
|
|
40
|
+
const hasMultipleAnswers = Array.isArray(qrItemOrItems);
|
|
41
|
+
if (hasMultipleAnswers) {
|
|
42
|
+
const qrItems = qrItemOrItems;
|
|
43
|
+
// qItem should always be either a repeatGroup or a groupTable item
|
|
44
|
+
// groupTables item have qItem.repeats = true and qItem.type = 'group' as well
|
|
45
|
+
if (!qItem.repeats || qItem.type !== 'group') {
|
|
46
|
+
return React.createElement(React.Fragment, null, "Something went wrong here");
|
|
47
|
+
}
|
|
48
|
+
if (isSpecificItemControl(qItem, 'gtable')) {
|
|
49
|
+
return (React.createElement(QItemGroupTable, { qItem: qItem, qrItems: qrItems, groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
50
|
+
}
|
|
51
|
+
return (React.createElement(RepeatGroup, { qItem: qItem, qrItems: qrItems, groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
52
|
+
}
|
|
53
|
+
// If there is only one answer
|
|
54
|
+
const qrItem = qrItemOrItems;
|
|
55
|
+
const itemIsGrid = isSpecificItemControl(qItem, 'grid');
|
|
56
|
+
if (itemIsGrid) {
|
|
57
|
+
return (React.createElement(GridGroup, { qItem: qItem, qrItem: qrItem, groupCardElevation: groupCardElevation, onQrItemChange: onQrItemChange }));
|
|
58
|
+
}
|
|
59
|
+
// console.log(qItem);
|
|
60
|
+
const itemRepeatsAndIsNotCheckbox = isRepeatItemAndNotCheckbox(qItem);
|
|
61
|
+
if (itemRepeatsAndIsNotCheckbox) {
|
|
62
|
+
if (qItem.type === 'group') {
|
|
63
|
+
console.log(qItem);
|
|
64
|
+
// If qItem is RepeatGroup or a groupTable item in this decision branch,
|
|
65
|
+
// their qrItem array should always be empty
|
|
66
|
+
if (isSpecificItemControl(qItem, 'gtable')) {
|
|
67
|
+
return (React.createElement(QItemGroupTable, { qItem: qItem, qrItems: [], groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
68
|
+
}
|
|
69
|
+
return (React.createElement(RepeatGroup, { qItem: qItem, qrItems: [], groupCardElevation: groupCardElevation + 1, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
70
|
+
}
|
|
71
|
+
return React.createElement(RepeatItem, { qItem: qItem, qrItem: qrItem, onQrItemChange: onQrItemChange });
|
|
72
|
+
}
|
|
73
|
+
// if qItem is not a repeating question or is a checkbox
|
|
74
|
+
if (qItem.type === 'group') {
|
|
75
|
+
return (React.createElement(GroupItem, { qItem: qItem, qrItem: qrItem, isRepeated: false, groupCardElevation: groupCardElevation + 1, onQrItemChange: onQrItemChange }));
|
|
76
|
+
}
|
|
77
|
+
// Defaults to a normal QItemSwitcher
|
|
78
|
+
return (React.createElement(SingleItem, { qItem: qItem, qrItem: qrItem, isRepeated: false, isTabled: false, onQrItemChange: onQrItemChange }));
|
|
79
|
+
}
|
|
80
|
+
export default ItemSwitcher;
|
|
81
|
+
//# sourceMappingURL=ItemSwitcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/ItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,eAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,SAAS,MAAM,aAAa,CAAC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AAqC;IACrC,OAAO,CACL,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,KAAK,EACf,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
3
|
+
import type { PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
4
|
+
interface TopLevelGroupItemSwitcherProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem> {
|
|
5
|
+
qItem: QuestionnaireItem;
|
|
6
|
+
qrItem: QuestionnaireResponseItem;
|
|
7
|
+
groupCardElevation: number;
|
|
8
|
+
}
|
|
9
|
+
declare function TopLevelGroupItemSwitcher(props: TopLevelGroupItemSwitcherProps): React.JSX.Element;
|
|
10
|
+
export default TopLevelGroupItemSwitcher;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
import React, { useMemo } from 'react';
|
|
18
|
+
import { getQrItemsIndex, mapQItemsIndex } from '../../../utils/mapItem';
|
|
19
|
+
import { createQrGroup, updateQrGroup } from '../../../utils/qrItem';
|
|
20
|
+
import GroupItemSwitcher from './GroupItemSwitcher';
|
|
21
|
+
function TopLevelGroupItemSwitcher(props) {
|
|
22
|
+
const { qItem, qrItem, groupCardElevation, onQrItemChange } = props;
|
|
23
|
+
const qItemsIndexMap = useMemo(() => mapQItemsIndex(qItem), [qItem]);
|
|
24
|
+
const qItems = qItem.item;
|
|
25
|
+
const qrGroup = qrItem && qrItem.item ? qrItem : createQrGroup(qItem);
|
|
26
|
+
const qrItems = qrGroup.item;
|
|
27
|
+
// Event Handlers
|
|
28
|
+
function handleQrItemChange(newQrItem) {
|
|
29
|
+
const updatedQrGroup = Object.assign({}, qrGroup);
|
|
30
|
+
updateQrGroup(newQrItem, null, updatedQrGroup, qItemsIndexMap);
|
|
31
|
+
onQrItemChange(updatedQrGroup);
|
|
32
|
+
}
|
|
33
|
+
function handleQrRepeatGroupChange(qrRepeatGroup) {
|
|
34
|
+
const updatedQrGroup = Object.assign({}, qrGroup);
|
|
35
|
+
updateQrGroup(null, qrRepeatGroup, updatedQrGroup, qItemsIndexMap);
|
|
36
|
+
onQrItemChange(updatedQrGroup);
|
|
37
|
+
}
|
|
38
|
+
if (!qItems || !qrItems) {
|
|
39
|
+
return React.createElement(React.Fragment, null, "Unable to load group, something has gone terribly wrong.");
|
|
40
|
+
}
|
|
41
|
+
const qrItemsByIndex = getQrItemsIndex(qItems, qrItems, qItemsIndexMap);
|
|
42
|
+
return (React.createElement(GroupItemSwitcher, { key: qItem.linkId, qItem: qItem, qrItemOrItems: qrItemsByIndex, groupCardElevation: groupCardElevation, onQrItemChange: handleQrItemChange, onQrRepeatGroupChange: handleQrRepeatGroupChange }));
|
|
43
|
+
}
|
|
44
|
+
export default TopLevelGroupItemSwitcher;
|
|
45
|
+
//# sourceMappingURL=TopLevelGroupItemSwitcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopLevelGroupItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/TopLevelGroupItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAUpD,SAAS,yBAAyB,CAAC,KAAqC;IACtE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAEpE,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;IAC1B,MAAM,OAAO,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7B,iBAAiB;IACjB,SAAS,kBAAkB,CAAC,SAAoC;QAC9D,MAAM,cAAc,qBAAmC,OAAO,CAAE,CAAC;QACjE,aAAa,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;QAC/D,cAAc,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,yBAAyB,CAAC,aAA4B;QAC7D,MAAM,cAAc,qBAAmC,OAAO,CAAE,CAAC;QACjE,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;QACnE,cAAc,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE;QACvB,OAAO,qGAA6D,CAAC;KACtE;IAED,MAAM,cAAc,GAClB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAEnD,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,KAAK,CAAC,MAAM,EACjB,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,cAAc,EAC7B,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,kBAAkB,EAClC,qBAAqB,EAAE,yBAAyB,GAChD,CACH,CAAC;AACJ,CAAC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import React, { useCallback
|
|
17
|
+
import React, { useCallback } from 'react';
|
|
18
18
|
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
19
19
|
import useValidationError from '../../../hooks/useValidationError';
|
|
20
20
|
import debounce from 'lodash.debounce';
|
|
@@ -25,6 +25,7 @@ import IntegerField from './IntegerField';
|
|
|
25
25
|
import useIntegerCalculatedExpression from '../../../hooks/useIntegerCalculatedExpression';
|
|
26
26
|
import { parseValidInteger } from '../../../utils/parseInputs';
|
|
27
27
|
import ItemFieldGrid from '../ItemParts/ItemFieldGrid';
|
|
28
|
+
import useNumberInput from '../../../hooks/useNumberInput';
|
|
28
29
|
function IntegerItem(props) {
|
|
29
30
|
const { qItem, qrItem, isRepeated, isTabled, onQrItemChange } = props;
|
|
30
31
|
// Get additional rendering extensions
|
|
@@ -39,7 +40,7 @@ function IntegerItem(props) {
|
|
|
39
40
|
valueInteger = Math.round(qrItem.answer[0].valueDecimal);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
const [value, setValue] =
|
|
43
|
+
const [value, setValue] = useNumberInput(valueInteger);
|
|
43
44
|
// Perform validation checks
|
|
44
45
|
const feedback = useValidationError(value.toString(), regexValidation, maxLength);
|
|
45
46
|
// Process calculated expressions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntegerItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/IntegerItem/IntegerItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"IntegerItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/IntegerItem/IntegerItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAO3C,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,kBAAkB,MAAM,mCAAmC,CAAC;AACnE,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,8BAA8B,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAU3D,SAAS,WAAW,CAAC,KAAuB;IAC1C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAEtE,sCAAsC;IACtC,MAAM,EACJ,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,eAAe,EACf,SAAS,EACV,GAAG,sBAAsB,CAAC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AC,QAAgB,EAAE,EAAE;QAC5B,cAAc,iCACT,yBAAyB,CAAC,KAAK,EAAE,WAAW,CAAC,KAChD,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,IACpC,CAAC;IACL,CAAC,EAAE,iBAAiB,CAAC,EACrB,CAAC,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CACrC,CAAC,CAAC,oFAAoF;IAEvF,IAAI,UAAU,EAAE;QACd,OAAO,CACL,oBAAC,YAAY,IACX,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,iBAAiB,GAChC,CACH,CAAC;KACH;IAED,OAAO,CACL,oBAAC,yBAAyB,iBAAW,oBAAoB;QACvD,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,mBAAmB;YACnE,oBAAC,YAAY,IACX,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,iBAAiB,GAChC,CACY,CACU,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const StyledFormGroup: import("@emotion/styled").StyledComponent<import("@mui/material/FormGroup").FormGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
3
|
+
export declare const StyledRadioGroup: import("@emotion/styled").StyledComponent<import("@mui/material/RadioGroup").RadioGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
4
4
|
export declare const QItemTypography: import("@emotion/styled").StyledComponent<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
5
5
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
6
6
|
}, "display" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "style" | "className" | "children" | "sx" | "classes" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -18,10 +18,10 @@ import FormGroup from '@mui/material/FormGroup';
|
|
|
18
18
|
import RadioGroup from '@mui/material/RadioGroup';
|
|
19
19
|
import Typography from '@mui/material/Typography';
|
|
20
20
|
import { styled } from '@mui/material/styles';
|
|
21
|
-
export const
|
|
21
|
+
export const StyledFormGroup = styled(FormGroup)(() => ({
|
|
22
22
|
marginBottom: 4
|
|
23
23
|
}));
|
|
24
|
-
export const
|
|
24
|
+
export const StyledRadioGroup = styled(RadioGroup)(() => ({
|
|
25
25
|
marginBottom: 4
|
|
26
26
|
}));
|
|
27
27
|
export const QItemTypography = styled(Typography)(() => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.styles.js","sourceRoot":"","sources":["../../../src/components/FormComponents/Item.styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"Item.styles.js","sourceRoot":"","sources":["../../../src/components/FormComponents/Item.styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACtD,YAAY,EAAE,CAAC;CAChB,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACxD,YAAY,EAAE,CAAC;CAChB,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,SAAS,EAAE,CAAC;CACb,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QuestionnaireItem } from 'fhir/r4';
|
|
3
|
+
interface RadioAnswerOptionButtonsProps {
|
|
4
|
+
qItem: QuestionnaireItem;
|
|
5
|
+
readOnly: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function RadioAnswerOptionButtons(props: RadioAnswerOptionButtonsProps): React.JSX.Element;
|
|
8
|
+
export default RadioAnswerOptionButtons;
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import React from 'react';
|
|
18
|
+
import ChoiceRadioSingle from '../ChoiceItems/ChoiceRadioSingle';
|
|
19
|
+
function RadioAnswerOptionButtons(props) {
|
|
20
|
+
var _a;
|
|
21
|
+
const { qItem, readOnly } = props;
|
|
22
|
+
return (React.createElement(React.Fragment, null, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 : _a.map((option) => {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
if (option['valueCoding']) {
|
|
25
|
+
return (React.createElement(ChoiceRadioSingle, { key: (_a = option.valueCoding.code) !== null && _a !== void 0 ? _a : '', value: (_b = option.valueCoding.code) !== null && _b !== void 0 ? _b : '', label: (_c = option.valueCoding.display) !== null && _c !== void 0 ? _c : `${option.valueCoding.code}`, readOnly: readOnly }));
|
|
26
|
+
}
|
|
27
|
+
if (option['valueString']) {
|
|
28
|
+
return (React.createElement(ChoiceRadioSingle, { key: option.valueString, value: option.valueString, label: option.valueString, readOnly: readOnly }));
|
|
29
|
+
}
|
|
30
|
+
if (option['valueInteger']) {
|
|
31
|
+
return (React.createElement(ChoiceRadioSingle, { key: option.valueInteger, value: option.valueInteger.toString(), label: option.valueInteger.toString(), readOnly: readOnly }));
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
export default RadioAnswerOptionButtons;
|
|
37
|
+
//# sourceMappingURL=RadioAnswerOptionButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioAnswerOptionButtons.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ItemParts/RadioAnswerOptionButtons.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAQjE,SAAS,wBAAwB,CAAC,KAAoC;;IACpE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAElC,OAAO,CACL,0CACG,MAAA,KAAK,CAAC,YAAY,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;;QAClC,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,IAAI,mCAAI,EAAE,EAClC,KAAK,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,IAAI,mCAAI,EAAE,EACpC,KAAK,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,OAAO,mCAAI,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,EACjE,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE;YAC1B,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAM,CAAC,YAAY,EACxB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QuestionnaireItem } from 'fhir/r4';
|
|
3
|
+
interface RadioButtonsProps {
|
|
4
|
+
qItem: QuestionnaireItem;
|
|
5
|
+
readOnly: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function RadioButtons(props: RadioButtonsProps): React.JSX.Element;
|
|
8
|
+
export default RadioButtons;
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import React from 'react';
|
|
18
|
+
import ChoiceRadioSingle from '../ChoiceItems/ChoiceRadioSingle';
|
|
19
|
+
function RadioButtons(props) {
|
|
20
|
+
var _a;
|
|
21
|
+
const { qItem, readOnly } = props;
|
|
22
|
+
return (React.createElement(React.Fragment, null, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 : _a.map((option) => {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
if (option['valueCoding']) {
|
|
25
|
+
return (React.createElement(ChoiceRadioSingle, { key: (_a = option.valueCoding.code) !== null && _a !== void 0 ? _a : '', value: (_b = option.valueCoding.code) !== null && _b !== void 0 ? _b : '', label: (_c = option.valueCoding.display) !== null && _c !== void 0 ? _c : `${option.valueCoding.code}`, readOnly: readOnly }));
|
|
26
|
+
}
|
|
27
|
+
if (option['valueString']) {
|
|
28
|
+
return (React.createElement(ChoiceRadioSingle, { key: option.valueString, value: option.valueString, label: option.valueString, readOnly: readOnly }));
|
|
29
|
+
}
|
|
30
|
+
if (option['valueInteger']) {
|
|
31
|
+
return (React.createElement(ChoiceRadioSingle, { key: option.valueInteger, value: option.valueInteger.toString(), label: option.valueInteger.toString(), readOnly: readOnly }));
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
export default RadioButtons;
|
|
37
|
+
//# sourceMappingURL=RadioButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButtons.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ItemParts/RadioButtons.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAQjE,SAAS,YAAY,CAAC,KAAwB;;IAC5C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAElC,OAAO,CACL,0CACG,MAAA,KAAK,CAAC,YAAY,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;;QAClC,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,IAAI,mCAAI,EAAE,EAClC,KAAK,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,IAAI,mCAAI,EAAE,EACpC,KAAK,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,OAAO,mCAAI,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,EACjE,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE;YAC1B,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAM,CAAC,YAAY,EACxB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QuestionnaireItem } from 'fhir/r4';
|
|
3
|
+
interface RadioButtonsProps {
|
|
4
|
+
qItem: QuestionnaireItem;
|
|
5
|
+
readOnly: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function RadioButtonsAnswerOption(props: RadioButtonsProps): React.JSX.Element;
|
|
8
|
+
export default RadioButtonsAnswerOption;
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import React from 'react';
|
|
18
|
+
import ChoiceRadioSingle from '../ChoiceItems/ChoiceRadioSingle';
|
|
19
|
+
function RadioButtonsAnswerOption(props) {
|
|
20
|
+
var _a;
|
|
21
|
+
const { qItem, readOnly } = props;
|
|
22
|
+
return (React.createElement(React.Fragment, null, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 : _a.map((option) => {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
if (option['valueCoding']) {
|
|
25
|
+
return (React.createElement(ChoiceRadioSingle, { key: (_a = option.valueCoding.code) !== null && _a !== void 0 ? _a : '', value: (_b = option.valueCoding.code) !== null && _b !== void 0 ? _b : '', label: (_c = option.valueCoding.display) !== null && _c !== void 0 ? _c : `${option.valueCoding.code}`, readOnly: readOnly }));
|
|
26
|
+
}
|
|
27
|
+
if (option['valueString']) {
|
|
28
|
+
return (React.createElement(ChoiceRadioSingle, { key: option.valueString, value: option.valueString, label: option.valueString, readOnly: readOnly }));
|
|
29
|
+
}
|
|
30
|
+
if (option['valueInteger']) {
|
|
31
|
+
return (React.createElement(ChoiceRadioSingle, { key: option.valueInteger, value: option.valueInteger.toString(), label: option.valueInteger.toString(), readOnly: readOnly }));
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
export default RadioButtonsAnswerOption;
|
|
37
|
+
//# sourceMappingURL=RadioButtonsAnswerOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButtonsAnswerOption.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ItemParts/RadioButtonsAnswerOption.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAQjE,SAAS,wBAAwB,CAAC,KAAwB;;IACxD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAElC,OAAO,CACL,0CACG,MAAA,KAAK,CAAC,YAAY,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;;QAClC,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,IAAI,mCAAI,EAAE,EAClC,KAAK,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,IAAI,mCAAI,EAAE,EACpC,KAAK,EAAE,MAAA,MAAM,CAAC,WAAW,CAAC,OAAO,mCAAI,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,EACjE,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE;YAC1B,OAAO,CACL,oBAAC,iBAAiB,IAChB,GAAG,EAAE,MAAM,CAAC,YAAY,EACxB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Coding, QuestionnaireItem } from 'fhir/r4';
|
|
3
|
+
import type { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps.interface';
|
|
4
|
+
import type { AlertColor } from '@mui/material/Alert';
|
|
5
|
+
interface OpenChoiceAutocompleteFieldProps extends PropsWithIsTabledAttribute {
|
|
6
|
+
qItem: QuestionnaireItem;
|
|
7
|
+
options: Coding[];
|
|
8
|
+
valueAutocomplete: string | Coding;
|
|
9
|
+
input: string;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
feedback: {
|
|
12
|
+
message: string;
|
|
13
|
+
color: AlertColor;
|
|
14
|
+
} | null;
|
|
15
|
+
onInputChange: (newInput: string) => void;
|
|
16
|
+
onValueChange: (newValue: Coding | string | null) => void;
|
|
17
|
+
onUnfocus: () => void;
|
|
18
|
+
}
|
|
19
|
+
declare function OpenChoiceAutocompleteField(props: OpenChoiceAutocompleteFieldProps): React.JSX.Element;
|
|
20
|
+
export default OpenChoiceAutocompleteField;
|