@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,91 @@
|
|
|
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
|
+
export function readFormChanges(formChanges, itemTypes) {
|
|
18
|
+
if (!('item' in formChanges)) {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
const changedItems = {};
|
|
22
|
+
const diffArrays = formChanges.item;
|
|
23
|
+
for (const diffArray of diffArrays) {
|
|
24
|
+
readItemChangesRecursive(diffArray, itemTypes, changedItems);
|
|
25
|
+
}
|
|
26
|
+
return changedItems;
|
|
27
|
+
}
|
|
28
|
+
export function readItemChangesRecursive(diffArray, itemTypes, changedItems) {
|
|
29
|
+
const operator = diffArray[0];
|
|
30
|
+
const diffItem = diffArray[1];
|
|
31
|
+
if (!operator || !diffItem) {
|
|
32
|
+
return changedItems;
|
|
33
|
+
}
|
|
34
|
+
changedItems[diffItem.linkId] = null;
|
|
35
|
+
const childDiffArrays = diffItem.item;
|
|
36
|
+
if (childDiffArrays && childDiffArrays.length > 0) {
|
|
37
|
+
for (const childDiffArray of childDiffArrays) {
|
|
38
|
+
readItemChangesRecursive(childDiffArray, itemTypes, changedItems);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// if (operator !== ' ') {
|
|
42
|
+
// console.log(operator, diffItem);
|
|
43
|
+
// }
|
|
44
|
+
// explore answer diff arrays
|
|
45
|
+
// exmaple: [["+", {"valueString": "test"}], ["-", {"valueString": "test"}]]
|
|
46
|
+
// or it could be a regular answer array
|
|
47
|
+
// exmaple: [{"valueString": "test"}, {"valueString": "test"}]
|
|
48
|
+
const answerDiffArrays = diffItem.answer;
|
|
49
|
+
if (answerDiffArrays && isAnswerDiffArray(answerDiffArrays)) {
|
|
50
|
+
for (const answerDiffArray of answerDiffArrays) {
|
|
51
|
+
getItemChange(diffItem, answerDiffArray, itemTypes, changedItems);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return changedItems;
|
|
55
|
+
}
|
|
56
|
+
function getItemChange(diffItem, answerDiffArray, itemTypes, changedItems) {
|
|
57
|
+
const operator = answerDiffArray[0];
|
|
58
|
+
const answer = answerDiffArray[1];
|
|
59
|
+
if (operator === ' ') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const itemType = itemTypes[diffItem.linkId];
|
|
63
|
+
const operation = answerDiffOperationSwitcher(operator);
|
|
64
|
+
if (operation) {
|
|
65
|
+
changedItems[diffItem.linkId] = {
|
|
66
|
+
linkId: diffItem.linkId,
|
|
67
|
+
itemType: itemType,
|
|
68
|
+
operation: operation,
|
|
69
|
+
value: answer
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function answerDiffOperationSwitcher(operator) {
|
|
74
|
+
switch (operator) {
|
|
75
|
+
case '+':
|
|
76
|
+
return 'add';
|
|
77
|
+
case '-':
|
|
78
|
+
return 'remove';
|
|
79
|
+
case '~':
|
|
80
|
+
return 'update';
|
|
81
|
+
default:
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// type predicates
|
|
86
|
+
function isAnswerDiffArray(answer) {
|
|
87
|
+
return answer.every((answerItem) => Array.isArray(answerItem) &&
|
|
88
|
+
typeof answerItem[0] === 'string' &&
|
|
89
|
+
typeof answerItem[1] === 'object');
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=formChanges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formChanges.js","sourceRoot":"","sources":["../../src/utils/formChanges.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAyBH,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,SAAiC;IACpF,IAAI,CAAC,CAAC,MAAM,IAAI,WAAW,CAAC,EAAE;QAC5B,OAAO,EAAE,CAAC;KACX;IAED,MAAM,YAAY,GAAsC,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,WAAW,CAAC,IAA4C,CAAC;IAC5E,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QAClC,wBAAwB,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;KAC9D;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,SAA6C,EAC7C,SAAiC,EACjC,YAA+C;IAE/C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAE9B,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,E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,KAAK,EAAE,MAAM;SACd,CAAC;KACH;AACH,CAAC;AAED,SAAS,2BAA2B,CAAC,QAA0B;IAC7D,QAAQ,QAAQ,EAAE;QAChB,KAAK,GAAG;YACN,OAAO,KAAK,CAAC;QACf,KAAK,GAAG;YACN,OAAO,QAAQ,CAAC;QAClB,KAAK,GAAG;YACN,OAAO,QAAQ,CAAC;QAClB;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC;AAED,kBAAkB;AAClB,SAAS,iBAAiB,CAAC,MAAa;IACtC,OAAO,MAAM,CAAC,KAAK,CACjB,CAAC,UAAU,EAAE,EAAE,CACb,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QACzB,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ;QACjC,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ,CACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
2
|
+
type JsonDiffOperator = '+' | '-' | '~' | ' ';
|
|
3
|
+
type QuestionnaireResponseItemDiffArray = [JsonDiffOperator, QuestionnaireResponseDiffItem];
|
|
4
|
+
type QuestionnaireResponseItemAnswerDiffArray = [JsonDiffOperator, QuestionnaireResponseItemAnswer];
|
|
5
|
+
interface QuestionnaireResponseDiffItem {
|
|
6
|
+
linkId: string;
|
|
7
|
+
item: QuestionnaireResponseItemDiffArray[] | undefined;
|
|
8
|
+
answer: QuestionnaireResponseItemAnswer[] | QuestionnaireResponseItemAnswerDiffArray[] | undefined;
|
|
9
|
+
}
|
|
10
|
+
interface ItemChange {
|
|
11
|
+
linkId: string;
|
|
12
|
+
itemType: string;
|
|
13
|
+
operation: 'add' | 'remove' | 'update';
|
|
14
|
+
value: QuestionnaireResponseItemAnswer;
|
|
15
|
+
}
|
|
16
|
+
export declare function readFormChanges(formChanges: object, itemTypes: Record<string, string>): Record<string, ItemChange | null>;
|
|
17
|
+
export declare function readItemChangesRecursive(diffArray: QuestionnaireResponseItemDiffArray, itemTypes: Record<string, string>, changedItems: Record<string, ItemChange | null>): Record<string, ItemChange | null>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
export function readFormChanges(formChanges, itemTypes) {
|
|
18
|
+
if (!('item' in formChanges)) {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
const changedItems = {};
|
|
22
|
+
const diffArrays = formChanges.item;
|
|
23
|
+
for (const diffArray of diffArrays) {
|
|
24
|
+
readItemChangesRecursive(diffArray, itemTypes, changedItems);
|
|
25
|
+
}
|
|
26
|
+
return changedItems;
|
|
27
|
+
}
|
|
28
|
+
export function readItemChangesRecursive(diffArray, itemTypes, changedItems) {
|
|
29
|
+
const operator = diffArray[0];
|
|
30
|
+
const diffItem = diffArray[1];
|
|
31
|
+
if (!operator || !diffItem) {
|
|
32
|
+
return changedItems;
|
|
33
|
+
}
|
|
34
|
+
changedItems[diffItem.linkId] = null;
|
|
35
|
+
const childDiffArrays = diffItem.item;
|
|
36
|
+
if (childDiffArrays && childDiffArrays.length > 0) {
|
|
37
|
+
for (const childDiffArray of childDiffArrays) {
|
|
38
|
+
readItemChangesRecursive(childDiffArray, itemTypes, changedItems);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// if (operator !== ' ') {
|
|
42
|
+
// console.log(operator, diffItem);
|
|
43
|
+
// }
|
|
44
|
+
// explore answer diff arrays
|
|
45
|
+
// exmaple: [["+", {"valueString": "test"}], ["-", {"valueString": "test"}]]
|
|
46
|
+
// or it could be a regular answer array
|
|
47
|
+
// exmaple: [{"valueString": "test"}, {"valueString": "test"}]
|
|
48
|
+
const answerDiffArrays = diffItem.answer;
|
|
49
|
+
if (answerDiffArrays && isAnswerDiffArray(answerDiffArrays)) {
|
|
50
|
+
for (const answerDiffArray of answerDiffArrays) {
|
|
51
|
+
getItemChange(diffItem, answerDiffArray, itemTypes, changedItems);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return changedItems;
|
|
55
|
+
}
|
|
56
|
+
function getItemChange(diffItem, answerDiffArray, itemTypes, changedItems) {
|
|
57
|
+
const operator = answerDiffArray[0];
|
|
58
|
+
const answer = answerDiffArray[1];
|
|
59
|
+
if (operator === ' ') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const itemType = itemTypes[diffItem.linkId];
|
|
63
|
+
const operation = answerDiffOperationSwitcher(operator);
|
|
64
|
+
if (operation) {
|
|
65
|
+
changedItems[diffItem.linkId] = {
|
|
66
|
+
linkId: diffItem.linkId,
|
|
67
|
+
itemType: itemType,
|
|
68
|
+
operation: operation,
|
|
69
|
+
value: answer
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function answerDiffOperationSwitcher(operator) {
|
|
74
|
+
switch (operator) {
|
|
75
|
+
case '+':
|
|
76
|
+
return 'add';
|
|
77
|
+
case '-':
|
|
78
|
+
return 'remove';
|
|
79
|
+
case '~':
|
|
80
|
+
return 'update';
|
|
81
|
+
default:
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// type predicates
|
|
86
|
+
function isAnswerDiffArray(answer) {
|
|
87
|
+
return answer.every((answerItem) => Array.isArray(answerItem) &&
|
|
88
|
+
typeof answerItem[0] === 'string' &&
|
|
89
|
+
typeof answerItem[1] === 'object');
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=formChangesOld.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formChangesOld.js","sourceRoot":"","sources":["../../src/utils/formChangesOld.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAyBH,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,SAAiC;IACpF,IAAI,CAAC,CAAC,MAAM,IAAI,WAAW,CAAC,EAAE;QAC5B,OAAO,EAAE,CAAC;KACX;IAED,MAAM,YAAY,GAAsC,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,WAAW,CAAC,IAA4C,CAAC;IAC5E,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QAClC,wBAAwB,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;KAC9D;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,SAA6C,EAC7C,SAAiC,EACjC,YAA+C;IAE/C,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAE9B,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE;QAC1B,OAAO,YAAY,CAAC;KACrB;IAED,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAErC,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC;IACtC,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;QACjD,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE;YAC5C,wBAAwB,CAAC,cAAc,EAAE,SAAS,EAAE,YAAY,CAAC,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B,CAAC,MAAa;IACtC,OAAO,MAAM,CAAC,KAAK,CACjB,CAAC,UAAU,EAAE,EAAE,CACb,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QACzB,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ;QACjC,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,QAAQ,CACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isSpecificItemControl } from './itemControl';
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export { isSpecificItemControl } from './itemControl';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
package/lib/utils/mapItem.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
1
|
+
import type { Questionnaire, QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
2
|
/**
|
|
3
3
|
* Generate an array of QuestionnaireResponseItems corresponding to its QuestionnaireItem indexes an array.
|
|
4
4
|
* QuestionnaireItems without a corresponding QuestionnaireResponseItem is set as undefined.
|
|
@@ -15,4 +15,4 @@ export declare function getQrItemsIndex(qItems: QuestionnaireItem[], qrItems: Qu
|
|
|
15
15
|
*
|
|
16
16
|
* @author Sean Fong
|
|
17
17
|
*/
|
|
18
|
-
export declare function mapQItemsIndex(
|
|
18
|
+
export declare function mapQItemsIndex(questionnaireOrQItem: QuestionnaireItem | Questionnaire): Record<string, number>;
|
package/lib/utils/mapItem.js
CHANGED
|
@@ -67,12 +67,12 @@ export function getQrItemsIndex(qItems, qrItems, qItemsIndexMap) {
|
|
|
67
67
|
*
|
|
68
68
|
* @author Sean Fong
|
|
69
69
|
*/
|
|
70
|
-
export function mapQItemsIndex(
|
|
71
|
-
if (!
|
|
70
|
+
export function mapQItemsIndex(questionnaireOrQItem) {
|
|
71
|
+
if (!questionnaireOrQItem.item) {
|
|
72
72
|
return {};
|
|
73
73
|
}
|
|
74
74
|
// generate a <linkId, QItemIndex> dictionary
|
|
75
|
-
return
|
|
75
|
+
return questionnaireOrQItem.item.reduce((mapping, item, i) => {
|
|
76
76
|
mapping[item.linkId] = i;
|
|
77
77
|
return mapping;
|
|
78
78
|
}, {});
|
package/lib/utils/mapItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapItem.js","sourceRoot":"","sources":["../../src/utils/mapItem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA2B,EAC3B,OAAoC,EACpC,cAAsC;IAEtC,oDAAoD;IACpD,MAAM,gBAAgB,GACpB,EAAE,CAAC;IACL,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;Q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A0D;IAC1D,OAAO,MAAM,CAAC,MAAM,CAClB,CAAC,OAAoE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACjF,MAAM,aAAa,GAAG,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACrD,iFAAiF;QACjF,IAAI,0BAA0B,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;YAC/D,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAClE;aAAM;YACL,OAAO,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC7C;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,oBAAuD;IAEvD,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE;QAC9B,OAAO,EAAE,CAAC;KACX;IAED,6CAA6C;IAC7C,OAAO,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAA+B,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;QACnF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
package/lib/utils/qItem.d.ts
CHANGED
|
@@ -29,4 +29,6 @@ export declare function isHiddenByEnableWhens(params: isHiddenByEnableWhensParam
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function isRepeatItemAndNotCheckbox(qItem: QuestionnaireItem): boolean;
|
|
31
31
|
export declare function getXHtmlStringFromQuestionnaire(questionnaire: Questionnaire): string | null;
|
|
32
|
+
export declare function getLinkIdTypeTuples(questionnaire: Questionnaire): [string, string][];
|
|
33
|
+
export declare function getLinkIdTypeTuplesFromItemRecursive(qItem: QuestionnaireItem): [string, string][];
|
|
32
34
|
export {};
|
package/lib/utils/qItem.js
CHANGED
|
@@ -70,4 +70,26 @@ export function getXHtmlStringFromQuestionnaire(questionnaire) {
|
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
+
export function getLinkIdTypeTuples(questionnaire) {
|
|
74
|
+
if (!questionnaire.item || questionnaire.item.length === 0) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
const linkIds = [];
|
|
78
|
+
for (const topLevelItem of questionnaire.item) {
|
|
79
|
+
linkIds.push(...getLinkIdTypeTuplesFromItemRecursive(topLevelItem));
|
|
80
|
+
}
|
|
81
|
+
return linkIds;
|
|
82
|
+
}
|
|
83
|
+
export function getLinkIdTypeTuplesFromItemRecursive(qItem) {
|
|
84
|
+
const linkIds = [];
|
|
85
|
+
if (qItem.linkId) {
|
|
86
|
+
linkIds.push([qItem.linkId, qItem.type]);
|
|
87
|
+
}
|
|
88
|
+
if (qItem.item) {
|
|
89
|
+
for (const childItem of qItem.item) {
|
|
90
|
+
linkIds.push(...getLinkIdTypeTuplesFromItemRecursive(childItem));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return linkIds;
|
|
94
|
+
}
|
|
73
95
|
//# sourceMappingURL=qItem.js.map
|
package/lib/utils/qItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qItem.js","sourceRoot":"","sources":["../../src/utils/qItem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAUxD;;;;;;GAM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AC1C;IAED,IAAI,KAAK,CAAC,IAAI,EAAE;QACd,KAAK,MAAM,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE;YAClC,OAAO,CAAC,IAAI,CAAC,GAAG,oCAAoC,CAAC,SAAS,CAAC,CAAC,CAAC;SAClE;KACF;IAED,OAAO,OAAO,CAAC;AACjB,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
|
|
@@ -39,4 +38,4 @@ export declare function createEmptyQrItemWithUnit(qItem: QuestionnaireItem, unit
|
|
|
39
38
|
*
|
|
40
39
|
* @author Sean Fong
|
|
41
40
|
*/
|
|
42
|
-
export declare function
|
|
41
|
+
export declare function updateQrItemsInGroup(newQrItem: QuestionnaireResponseItem | null, newQrRepeatGroup: QrRepeatGroup | null, questionnaireResponseOrQrItem: QuestionnaireResponseItem | QuestionnaireResponse, qItemsIndexMap: Record<string, number>): void;
|
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',
|
|
@@ -108,112 +107,111 @@ export function createEmptyQrItemWithUnit(qItem, unit) {
|
|
|
108
107
|
*
|
|
109
108
|
* @author Sean Fong
|
|
110
109
|
*/
|
|
111
|
-
export function
|
|
110
|
+
export function updateQrItemsInGroup(newQrItem, newQrRepeatGroup, questionnaireResponseOrQrItem, qItemsIndexMap) {
|
|
112
111
|
var _a, _b;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
const qrItems = questionnaireResponseOrQrItem.item;
|
|
113
|
+
if (!qrItems) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
// Get actual sequence indexes of qrItems present within a qrGroup
|
|
117
|
+
// e.g. qrGroup has 4 fields but only the 2nd and 3rd field have values - resulting array is [1, 2]
|
|
118
|
+
const qrItemsRealIndexArr = qrItems.map((qrItem) => qItemsIndexMap[qrItem.linkId]);
|
|
119
|
+
if (newQrItem && newQrItem.linkId in qItemsIndexMap) {
|
|
120
|
+
if (qrItems.length === 0) {
|
|
121
|
+
qrItems.push(newQrItem);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
// Get actual sequence index of qrItem within qrGroup
|
|
125
|
+
const newQrItemIndex = qItemsIndexMap[newQrItem.linkId];
|
|
126
|
+
for (let i = 0; i < qrItemsRealIndexArr.length; i++) {
|
|
127
|
+
// Add qrItem at the end of qrGroup if it is larger than the other indexes
|
|
128
|
+
if (newQrItemIndex > qrItemsRealIndexArr[i]) {
|
|
129
|
+
if (i === qrItemsRealIndexArr.length - 1) {
|
|
130
|
+
qrItems.push(newQrItem);
|
|
131
|
+
}
|
|
132
|
+
continue;
|
|
120
133
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (i === qrItemsRealIndexArr.length - 1) {
|
|
128
|
-
qrGroup.item.push(newQrItem);
|
|
129
|
-
}
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
// Replace or delete qrItem at its supposed position if its index is already present within qrGroup
|
|
133
|
-
if (newQrItemIndex === qrItemsRealIndexArr[i]) {
|
|
134
|
-
if (((_a = newQrItem.item) === null || _a === void 0 ? void 0 : _a.length) || ((_b = newQrItem.answer) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
135
|
-
// newQrItem has answer value
|
|
136
|
-
qrGroup.item[i] = newQrItem;
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
// newQrItem has no answer value
|
|
140
|
-
qrGroup.item.splice(i, 1);
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
// Add qrItem at its supposed position if its index is not present within qrGroup
|
|
145
|
-
if (newQrItemIndex < qrItemsRealIndexArr[i]) {
|
|
146
|
-
qrGroup.item.splice(i, 0, newQrItem);
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
134
|
+
// Replace or delete qrItem at its supposed position if its index is already present within qrGroup
|
|
135
|
+
if (newQrItemIndex === qrItemsRealIndexArr[i]) {
|
|
136
|
+
// newQrItem has answer value
|
|
137
|
+
if (((_a = newQrItem.item) === null || _a === void 0 ? void 0 : _a.length) || ((_b = newQrItem.answer) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
138
|
+
qrItems[i] = newQrItem;
|
|
139
|
+
break;
|
|
149
140
|
}
|
|
141
|
+
// newQrItem has no answer value
|
|
142
|
+
qrItems.splice(i, 1);
|
|
143
|
+
break;
|
|
150
144
|
}
|
|
145
|
+
// Add qrItem at its supposed position if its index is not present within qrGroup
|
|
146
|
+
if (newQrItemIndex < qrItemsRealIndexArr[i]) {
|
|
147
|
+
qrItems.splice(i, 0, newQrItem);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (newQrRepeatGroup && newQrRepeatGroup.linkId in qItemsIndexMap) {
|
|
153
|
+
const newQrItems = newQrRepeatGroup.qrItems;
|
|
154
|
+
if (qrItems.length === 0) {
|
|
155
|
+
qrItems.push(...newQrItems);
|
|
156
|
+
return;
|
|
151
157
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
// Get actual sequence index of qrItems within qrGroup
|
|
159
|
+
const newQrItemIndex = qItemsIndexMap[newQrRepeatGroup.linkId];
|
|
160
|
+
for (let i = 0; i < qrItemsRealIndexArr.length; i++) {
|
|
161
|
+
// Add qrItem at the end of qrGroup if it is larger than the other indexes
|
|
162
|
+
if (newQrItemIndex > qrItemsRealIndexArr[i]) {
|
|
163
|
+
if (i === qrItemsRealIndexArr.length - 1) {
|
|
164
|
+
qrItems.push(...newQrItems);
|
|
165
|
+
}
|
|
166
|
+
continue;
|
|
156
167
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
// Replace or delete qrItem at its supposed position if its index is already present within qrGroup
|
|
169
|
+
if (newQrItemIndex === qrItemsRealIndexArr[i]) {
|
|
170
|
+
// Get number of repeatGroupItems that has the same linkId present in qrGroup
|
|
171
|
+
let repeatGroupItemCount = 0;
|
|
172
|
+
while (newQrItemIndex === qrItemsRealIndexArr[i + repeatGroupItemCount]) {
|
|
173
|
+
repeatGroupItemCount++;
|
|
174
|
+
}
|
|
175
|
+
// Replace each repeat group qrItem with their new counterparts
|
|
176
|
+
if (newQrItems.length === repeatGroupItemCount) {
|
|
177
|
+
for (let j = 0; j < newQrItems.length; j++) {
|
|
178
|
+
qrItems[i + j] = newQrItems[j];
|
|
167
179
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (newQrItems.length === repeatGroupItemCount) {
|
|
177
|
-
for (let j = 0; j < newQrItems.length; j++) {
|
|
178
|
-
qrGroup.item[i + j] = newQrItems[j];
|
|
179
|
-
}
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
else if (newQrItems.length > repeatGroupItemCount) {
|
|
183
|
-
// Replace each repeat group qrItem with their new counterparts,
|
|
184
|
-
// followed by adding an extra newQrItem behind the newly replaced qrItems
|
|
185
|
-
for (let j = 0, k = repeatGroupItemCount; j < newQrItems.length; j++, k--) {
|
|
186
|
-
if (k > 0) {
|
|
187
|
-
qrGroup.item[i + j] = newQrItems[j];
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
qrGroup.item.splice(i + j, 0, newQrItems[j]);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
break;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
if (newQrItems.length > repeatGroupItemCount) {
|
|
183
|
+
// Replace each repeat group qrItem with their new counterparts,
|
|
184
|
+
// followed by adding an extra newQrItem behind the newly replaced qrItems
|
|
185
|
+
for (let j = 0, k = repeatGroupItemCount; j < newQrItems.length; j++, k--) {
|
|
186
|
+
if (k > 0) {
|
|
187
|
+
qrItems[i + j] = newQrItems[j];
|
|
194
188
|
}
|
|
195
|
-
else
|
|
196
|
-
|
|
197
|
-
// followed by deleting the last newQrItem which wasn't replaced
|
|
198
|
-
for (let j = 0; j < repeatGroupItemCount; j++) {
|
|
199
|
-
if (j <= newQrItems.length - 1) {
|
|
200
|
-
qrGroup.item[i + j] = newQrItems[j];
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
qrGroup.item.splice(i + j, 1);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
break;
|
|
189
|
+
else {
|
|
190
|
+
qrItems.splice(i + j, 0, newQrItems[j]);
|
|
207
191
|
}
|
|
208
192
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
if (newQrItems.length < repeatGroupItemCount) {
|
|
196
|
+
// Replace each repeat group qrItem with their new counterparts (except the last one),
|
|
197
|
+
// followed by deleting the last newQrItem which wasn't replaced
|
|
198
|
+
for (let j = 0; j < repeatGroupItemCount; j++) {
|
|
199
|
+
if (j <= newQrItems.length - 1) {
|
|
200
|
+
qrItems[i + j] = newQrItems[j];
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
qrItems.splice(i + j, 1);
|
|
213
204
|
}
|
|
214
|
-
break;
|
|
215
205
|
}
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// Add qrItem at its supposed position if its index is not present within qrGroup
|
|
210
|
+
if (newQrItemIndex < qrItemsRealIndexArr[i]) {
|
|
211
|
+
for (let j = 0; j < newQrItems.length; j++) {
|
|
212
|
+
qrItems.splice(i + j, 0, newQrItems[j]);
|
|
216
213
|
}
|
|
214
|
+
break;
|
|
217
215
|
}
|
|
218
216
|
}
|
|
219
217
|
}
|
package/lib/utils/qrItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qrItem.js","sourceRoot":"","sources":["../../src/utils/qrItem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH
|
|
1
|
+
{"version":3,"file":"qrItem.js","sourceRoot":"","sources":["../../src/utils/qrItem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,aAA4B;;IAE5B,MAAM,qBAAqB,GAA0B;QACnD,YAAY,EAAE,uBAAuB;QACrC,MAAM,EAAE,aAAa;KACtB,CAAC;IACF,MAAM,iBAAiB,GAAG,MAAA,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yBAChC;6BAAM;4BACL,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;yBACzC;qBACF;oBACD,MAAM;iBACP;gBAED,IAAI,UAAU,CAAC,MAAM,GAAG,oBAAoB,EAAE;oBAC5C,sFAAsF;oBACtF,gEAAgE;oBAChE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,oBAAoB,EAAE,CAAC,EAAE,EAAE;wBAC7C,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;4BAC9B,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;yBAChC;6BAAM;4BACL,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;yBAC1B;qBACF;oBACD,MAAM;iBACP;aACF;YAED,iFAAiF;YACjF,IAAI,cAAc,GAAG,mBAAmB,CAAC,CAAC,CAAC,EAAE;gBAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAC1C,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;iBACzC;gBACD,MAAM;aACP;SACF;KACF;AACH,CAAC"}
|
|
@@ -30,11 +30,13 @@ import { extractContainedValueSets } from './extractContainedValueSets';
|
|
|
30
30
|
import { extractOtherExtensions } from './extractOtherExtensions';
|
|
31
31
|
import { resolveValueSets } from './resolveValueSets';
|
|
32
32
|
import { addAdditionalVariables } from './addAdditionalVariables';
|
|
33
|
+
import { getLinkIdTypeTuples } from '../qItem';
|
|
33
34
|
export function createQuestionnaireModel(questionnaire, additionalVariables, terminologyServerUrl) {
|
|
34
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
36
|
if (!questionnaire.item) {
|
|
36
37
|
return createEmptyModel();
|
|
37
38
|
}
|
|
39
|
+
const itemTypes = Object.fromEntries(getLinkIdTypeTuples(questionnaire));
|
|
38
40
|
const tabs = extractTabs(questionnaire);
|
|
39
41
|
const launchContexts = extractLaunchContexts(questionnaire);
|
|
40
42
|
let variables = extractQuestionnaireLevelVariables(questionnaire);
|
|
@@ -51,6 +53,7 @@ export function createQuestionnaireModel(questionnaire, additionalVariables, ter
|
|
|
51
53
|
variables = resolveValueSetsResult.variables;
|
|
52
54
|
processedValueSetCodings = resolveValueSetsResult.processedValueSetCodings;
|
|
53
55
|
return {
|
|
56
|
+
itemTypes,
|
|
54
57
|
tabs,
|
|
55
58
|
variables,
|
|
56
59
|
launchContexts,
|
|
@@ -65,6 +68,7 @@ export function createQuestionnaireModel(questionnaire, additionalVariables, ter
|
|
|
65
68
|
}
|
|
66
69
|
function createEmptyModel() {
|
|
67
70
|
return {
|
|
71
|
+
itemTypes: {},
|
|
68
72
|
tabs: {},
|
|
69
73
|
variables: { fhirPathVariables: {}, xFhirQueryVariables: {} },
|
|
70
74
|
launchContexts: {},
|