@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.
Files changed (347) hide show
  1. package/README.md +1 -1
  2. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js +1 -2
  3. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.js.map +1 -1
  4. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.d.ts +12 -0
  5. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js +39 -0
  6. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.js.map +1 -0
  7. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.d.ts +3 -3
  8. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js +14 -27
  9. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.js.map +1 -1
  10. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.d.ts +13 -0
  11. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js +42 -0
  12. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.js.map +1 -0
  13. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.d.ts +4 -3
  14. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js +14 -22
  15. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.js.map +1 -1
  16. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.d.ts +2 -2
  17. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js +3 -3
  18. package/lib/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.js.map +1 -1
  19. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.d.ts +12 -0
  20. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +27 -0
  21. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -0
  22. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.d.ts +1 -1
  23. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js +9 -24
  24. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.js.map +1 -1
  25. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.d.ts +14 -0
  26. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +42 -0
  27. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -0
  28. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.d.ts +1 -1
  29. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js +8 -21
  30. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.js.map +1 -1
  31. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.d.ts +10 -0
  32. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +41 -0
  33. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -0
  34. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js +7 -23
  35. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.js.map +1 -1
  36. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.d.ts +12 -0
  37. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +42 -0
  38. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -0
  39. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js +8 -18
  40. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js.map +1 -1
  41. package/lib/components/FormComponents/DecimalItem/DecimalItem.js +3 -2
  42. package/lib/components/FormComponents/DecimalItem/DecimalItem.js.map +1 -1
  43. package/lib/components/FormComponents/GridGroup/GridGroup.js +2 -2
  44. package/lib/components/FormComponents/GridGroup/GridGroup.js.map +1 -1
  45. package/lib/components/FormComponents/GridGroup/GridRow.js +2 -2
  46. package/lib/components/FormComponents/GridGroup/GridRow.js.map +1 -1
  47. package/lib/components/FormComponents/GroupItem/GroupChildItemSwitcher.d.ts +10 -0
  48. package/lib/components/FormComponents/GroupItem/GroupChildItemSwitcher.js +73 -0
  49. package/lib/components/FormComponents/GroupItem/GroupChildItemSwitcher.js.map +1 -0
  50. package/lib/components/FormComponents/GroupItem/GroupItem.js +3 -3
  51. package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
  52. package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js +4 -4
  53. package/lib/components/FormComponents/GroupItem/GroupItemSwitcher.js.map +1 -1
  54. package/lib/components/FormComponents/GroupItem/ItemSwitcher.d.ts +10 -0
  55. package/lib/components/FormComponents/GroupItem/ItemSwitcher.js +81 -0
  56. package/lib/components/FormComponents/GroupItem/ItemSwitcher.js.map +1 -0
  57. package/lib/components/FormComponents/GroupItem/TopLevelGroupItemSwitcher.d.ts +10 -0
  58. package/lib/components/FormComponents/GroupItem/TopLevelGroupItemSwitcher.js +45 -0
  59. package/lib/components/FormComponents/GroupItem/TopLevelGroupItemSwitcher.js.map +1 -0
  60. package/lib/components/FormComponents/IntegerItem/IntegerItem.js +3 -2
  61. package/lib/components/FormComponents/IntegerItem/IntegerItem.js.map +1 -1
  62. package/lib/components/FormComponents/Item.styles.d.ts +2 -2
  63. package/lib/components/FormComponents/Item.styles.js +2 -2
  64. package/lib/components/FormComponents/Item.styles.js.map +1 -1
  65. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.d.ts +8 -0
  66. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js +37 -0
  67. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js.map +1 -0
  68. package/lib/components/FormComponents/ItemParts/RadioButtons.d.ts +8 -0
  69. package/lib/components/FormComponents/ItemParts/RadioButtons.js +37 -0
  70. package/lib/components/FormComponents/ItemParts/RadioButtons.js.map +1 -0
  71. package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.d.ts +8 -0
  72. package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.js +37 -0
  73. package/lib/components/FormComponents/ItemParts/RadioButtonsAnswerOption.js.map +1 -0
  74. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.d.ts +20 -0
  75. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js +49 -0
  76. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js.map +1 -0
  77. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.d.ts +0 -0
  78. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.js +2 -0
  79. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteFieldEndAdornment.js.map +1 -0
  80. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js +11 -35
  81. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.js.map +1 -1
  82. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.d.ts +17 -0
  83. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js +42 -0
  84. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.js.map +1 -0
  85. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.d.ts +3 -3
  86. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js +23 -36
  87. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.js.map +1 -1
  88. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.d.ts +2 -2
  89. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js +3 -3
  90. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.js.map +1 -1
  91. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.d.ts +15 -0
  92. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +29 -0
  93. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -0
  94. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.d.ts +1 -1
  95. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js +3 -23
  96. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.js.map +1 -1
  97. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.d.ts +11 -0
  98. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js +14 -0
  99. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js.map +1 -0
  100. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.d.ts +0 -0
  101. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.js +2 -0
  102. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionFields.js.map +1 -0
  103. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js +18 -23
  104. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.js.map +1 -1
  105. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.d.ts +12 -0
  106. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js +16 -0
  107. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js.map +1 -0
  108. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js +8 -14
  109. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.js.map +1 -1
  110. package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js +4 -3
  111. package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js.map +1 -1
  112. package/lib/components/FormComponents/RepeatGroup/index.d.ts +1 -0
  113. package/lib/components/FormComponents/RepeatGroup/index.js +18 -0
  114. package/lib/components/FormComponents/RepeatGroup/index.js.map +1 -0
  115. package/lib/components/FormComponents/RepeatItem/RepeatItem.js +1 -1
  116. package/lib/components/FormComponents/RepeatItem/RepeatItem.js.map +1 -1
  117. package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +2 -2
  118. package/lib/components/FormComponents/SingleItem/SingleItem.js +2 -2
  119. package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
  120. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.d.ts +2 -2
  121. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +3 -3
  122. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
  123. package/lib/components/FormComponents/SingleItem/index.d.ts +1 -0
  124. package/lib/components/FormComponents/SingleItem/index.js +18 -0
  125. package/lib/components/FormComponents/SingleItem/index.js.map +1 -0
  126. package/lib/components/FormComponents/StringItem/StringItem.js +3 -2
  127. package/lib/components/FormComponents/StringItem/StringItem.js.map +1 -1
  128. package/lib/components/FormComponents/Tables/AddItemButton.d.ts +8 -0
  129. package/lib/components/FormComponents/Tables/AddItemButton.js +28 -0
  130. package/lib/components/FormComponents/Tables/AddItemButton.js.map +1 -0
  131. package/lib/components/FormComponents/Tables/AddRowButton.d.ts +8 -0
  132. package/lib/components/FormComponents/Tables/AddRowButton.js +28 -0
  133. package/lib/components/FormComponents/Tables/AddRowButton.js.map +1 -0
  134. package/lib/components/FormComponents/Tables/GroupTable.d.ts +10 -0
  135. package/lib/components/FormComponents/Tables/GroupTable.js +108 -0
  136. package/lib/components/FormComponents/Tables/GroupTable.js.map +1 -0
  137. package/lib/components/FormComponents/Tables/GroupTableRow.d.ts +10 -0
  138. package/lib/components/FormComponents/Tables/GroupTableRow.js +46 -0
  139. package/lib/components/FormComponents/Tables/GroupTableRow.js.map +1 -0
  140. package/lib/components/FormComponents/Tables/QItemGroupTable.js +7 -5
  141. package/lib/components/FormComponents/Tables/QItemGroupTable.js.map +1 -1
  142. package/lib/components/FormComponents/Tables/QItemGroupTableRow.js +2 -2
  143. package/lib/components/FormComponents/Tables/QItemGroupTableRow.js.map +1 -1
  144. package/lib/components/FormComponents/Tables/index.d.ts +1 -0
  145. package/lib/components/FormComponents/Tables/index.js +18 -0
  146. package/lib/components/FormComponents/Tables/index.js.map +1 -0
  147. package/lib/components/FormComponents/TextItem/TextItem.js +3 -2
  148. package/lib/components/FormComponents/TextItem/TextItem.js.map +1 -1
  149. package/lib/components/FormComponents/index.d.ts +3 -0
  150. package/lib/components/FormComponents/index.js +20 -0
  151. package/lib/components/FormComponents/index.js.map +1 -0
  152. package/lib/components/Renderer/BaseRenderer.js +26 -14
  153. package/lib/components/Renderer/BaseRenderer.js.map +1 -1
  154. package/lib/components/Renderer/FormBodyCollapsible.js +2 -2
  155. package/lib/components/Renderer/FormBodyCollapsible.js.map +1 -1
  156. package/lib/components/Renderer/FormBodyTabbed.js +3 -3
  157. package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
  158. package/lib/components/Renderer/FormTopLevelItem.d.ts +4 -4
  159. package/lib/components/Renderer/FormTopLevelItem.js +14 -1
  160. package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
  161. package/lib/components/Tabs/FormBodySingleTab.js +1 -1
  162. package/lib/components/Tabs/FormBodySingleTab.js.map +1 -1
  163. package/lib/components/Tabs/FormBodyTabList.d.ts +1 -0
  164. package/lib/components/Tabs/FormBodyTabList.js +3 -4
  165. package/lib/components/Tabs/FormBodyTabList.js.map +1 -1
  166. package/lib/components/Tabs/FormBodyTabListWrapper.d.ts +1 -1
  167. package/lib/components/Tabs/FormBodyTabListWrapper.js +6 -13
  168. package/lib/components/Tabs/FormBodyTabListWrapper.js.map +1 -1
  169. package/lib/components/Tabs/ShowCompletedTabsSection.d.ts +7 -0
  170. package/lib/components/Tabs/ShowCompletedTabsSection.js +34 -0
  171. package/lib/components/Tabs/ShowCompletedTabsSection.js.map +1 -0
  172. package/lib/components/index.d.ts +1 -0
  173. package/lib/components/index.js +1 -0
  174. package/lib/components/index.js.map +1 -1
  175. package/lib/hooks/index.d.ts +1 -0
  176. package/lib/hooks/index.js +2 -0
  177. package/lib/hooks/index.js.map +1 -0
  178. package/lib/hooks/useContextDisplayItems.d.ts +6 -0
  179. package/lib/hooks/useContextDisplayItems.js +30 -0
  180. package/lib/hooks/useContextDisplayItems.js.map +1 -0
  181. package/lib/hooks/useDecimalUpdateFromProp.d.ts +2 -0
  182. package/lib/hooks/useDecimalUpdateFromProp.js +29 -0
  183. package/lib/hooks/useDecimalUpdateFromProp.js.map +1 -0
  184. package/lib/hooks/useInitialiseRenderer.js +2 -2
  185. package/lib/hooks/useInitialiseRenderer.js.map +1 -1
  186. package/lib/hooks/useInitialiseRepeatAnswers.d.ts +2 -2
  187. package/lib/hooks/useInitialiseRepeatAnswers.js +21 -15
  188. package/lib/hooks/useInitialiseRepeatAnswers.js.map +1 -1
  189. package/lib/hooks/useInitialiseRepeatGroups.d.ts +2 -1
  190. package/lib/hooks/useInitialiseRepeatGroups.js +21 -15
  191. package/lib/hooks/useInitialiseRepeatGroups.js.map +1 -1
  192. package/lib/hooks/useIntegerUpdateFromProp.d.ts +2 -0
  193. package/lib/hooks/useIntegerUpdateFromProp.js +29 -0
  194. package/lib/hooks/useIntegerUpdateFromProp.js.map +1 -0
  195. package/lib/hooks/useNumberInput.d.ts +3 -0
  196. package/lib/hooks/useNumberInput.js +31 -0
  197. package/lib/hooks/useNumberInput.js.map +1 -0
  198. package/lib/hooks/useNumberUpdateFromProp.d.ts +2 -0
  199. package/lib/hooks/useNumberUpdateFromProp.js +29 -0
  200. package/lib/hooks/useNumberUpdateFromProp.js.map +1 -0
  201. package/lib/hooks/useRepeatItemState.d.ts +5 -0
  202. package/lib/hooks/useRepeatItemState.js +35 -0
  203. package/lib/hooks/useRepeatItemState.js.map +1 -0
  204. package/lib/hooks/useRepeatItemUpdateFromProp.d.ts +2 -0
  205. package/lib/hooks/useRepeatItemUpdateFromProp.js +29 -0
  206. package/lib/hooks/useRepeatItemUpdateFromProp.js.map +1 -0
  207. package/lib/hooks/useStringField.d.ts +2 -0
  208. package/lib/hooks/useStringField.js +29 -0
  209. package/lib/hooks/useStringField.js.map +1 -0
  210. package/lib/hooks/useStringInput.d.ts +3 -0
  211. package/lib/hooks/useStringInput.js +31 -0
  212. package/lib/hooks/useStringInput.js.map +1 -0
  213. package/lib/hooks/useStringUpdateFromProp.d.ts +2 -0
  214. package/lib/hooks/useStringUpdateFromProp.js +29 -0
  215. package/lib/hooks/useStringUpdateFromProp.js.map +1 -0
  216. package/lib/hooks/useTerminologyServerQuery.js +3 -6
  217. package/lib/hooks/useTerminologyServerQuery.js.map +1 -1
  218. package/lib/index.d.ts +16 -0
  219. package/lib/index.js +29 -2
  220. package/lib/index.js.map +1 -1
  221. package/lib/interfaces/questionnaireStore.interface.d.ts +1 -0
  222. package/lib/interfaces/renderProps.interface.d.ts +3 -0
  223. package/lib/stores/useQuestionnaireResponseStore.d.ts +2 -1
  224. package/lib/stores/useQuestionnaireResponseStore.js +17 -10
  225. package/lib/stores/useQuestionnaireResponseStore.js.map +1 -1
  226. package/lib/stores/useQuestionnaireStore.d.ts +2 -1
  227. package/lib/stores/useQuestionnaireStore.js +5 -2
  228. package/lib/stores/useQuestionnaireStore.js.map +1 -1
  229. package/lib/theme/overrides/Overrides.js +1 -2
  230. package/lib/theme/overrides/Overrides.js.map +1 -1
  231. package/lib/utils/calculatedExpression.js +2 -2
  232. package/lib/utils/calculatedExpression.js.map +1 -1
  233. package/lib/utils/formChanges.d.ts +18 -0
  234. package/lib/utils/formChanges.js +91 -0
  235. package/lib/utils/formChanges.js.map +1 -0
  236. package/lib/utils/formChangesOld.d.ts +18 -0
  237. package/lib/utils/formChangesOld.js +91 -0
  238. package/lib/utils/formChangesOld.js.map +1 -0
  239. package/lib/utils/index.d.ts +1 -0
  240. package/lib/utils/index.js +18 -0
  241. package/lib/utils/index.js.map +1 -0
  242. package/lib/utils/mapItem.d.ts +2 -2
  243. package/lib/utils/mapItem.js +3 -3
  244. package/lib/utils/mapItem.js.map +1 -1
  245. package/lib/utils/qItem.d.ts +2 -0
  246. package/lib/utils/qItem.js +22 -0
  247. package/lib/utils/qItem.js.map +1 -1
  248. package/lib/utils/qrItem.d.ts +3 -4
  249. package/lib/utils/qrItem.js +94 -96
  250. package/lib/utils/qrItem.js.map +1 -1
  251. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +4 -0
  252. package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
  253. package/lib/utils/repopulate.d.ts +9 -0
  254. package/lib/utils/repopulate.js +133 -0
  255. package/lib/utils/repopulate.js.map +1 -0
  256. package/lib/utils/repopulateGenerateItems.d.ts +9 -0
  257. package/lib/utils/repopulateGenerateItems.js +133 -0
  258. package/lib/utils/repopulateGenerateItems.js.map +1 -0
  259. package/lib/utils/repopulateIntoResponse.d.ts +3 -0
  260. package/lib/utils/repopulateIntoResponse.js +92 -0
  261. package/lib/utils/repopulateIntoResponse.js.map +1 -0
  262. package/lib/utils/repopulateItems.d.ts +9 -0
  263. package/lib/utils/repopulateItems.js +130 -0
  264. package/lib/utils/repopulateItems.js.map +1 -0
  265. package/lib/utils/repopulateRepeatGroup.d.ts +4 -0
  266. package/lib/utils/repopulateRepeatGroup.js +54 -0
  267. package/lib/utils/repopulateRepeatGroup.js.map +1 -0
  268. package/package.json +7 -5
  269. package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx +1 -2
  270. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionFields.tsx +85 -0
  271. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerOptionItem.tsx +35 -58
  272. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetFields.tsx +79 -0
  273. package/src/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetItem.tsx +37 -50
  274. package/src/components/FormComponents/ChoiceItems/ChoiceItemSwitcher.tsx +10 -5
  275. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +48 -0
  276. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionItem.tsx +25 -53
  277. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +83 -0
  278. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetItem.tsx +27 -49
  279. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +81 -0
  280. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionItem.tsx +19 -54
  281. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +97 -0
  282. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +22 -60
  283. package/src/components/FormComponents/DecimalItem/DecimalItem.tsx +3 -2
  284. package/src/components/FormComponents/GridGroup/GridGroup.tsx +2 -2
  285. package/src/components/FormComponents/GridGroup/GridRow.tsx +2 -2
  286. package/src/components/FormComponents/GroupItem/GroupItem.tsx +3 -3
  287. package/src/components/FormComponents/GroupItem/GroupItemSwitcher.tsx +4 -4
  288. package/src/components/FormComponents/IntegerItem/IntegerItem.tsx +3 -2
  289. package/src/components/FormComponents/Item.styles.ts +2 -2
  290. package/src/components/FormComponents/ItemParts/RadioAnswerOptionButtons.tsx +72 -0
  291. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx +131 -0
  292. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteItem.tsx +38 -93
  293. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionFields.tsx +112 -0
  294. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxAnswerOptionItem.tsx +57 -76
  295. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceItemSwitcher.tsx +8 -5
  296. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +72 -0
  297. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionItem.tsx +12 -59
  298. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +54 -0
  299. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionItem.tsx +40 -64
  300. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.tsx +63 -0
  301. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetItem.tsx +22 -50
  302. package/src/components/FormComponents/RepeatGroup/RepeatGroup.tsx +4 -3
  303. package/src/{theme/overrides/Backdrop.ts → components/FormComponents/RepeatGroup/index.ts} +1 -17
  304. package/src/components/FormComponents/RepeatItem/RepeatItem.tsx +1 -1
  305. package/src/components/FormComponents/SingleItem/SingleItem.tsx +6 -3
  306. package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +7 -3
  307. package/src/components/FormComponents/SingleItem/index.ts +18 -0
  308. package/src/components/FormComponents/StringItem/StringItem.tsx +3 -2
  309. package/src/components/FormComponents/Tables/AddRowButton.tsx +49 -0
  310. package/src/components/FormComponents/Tables/{QItemGroupTable.tsx → GroupTable.tsx} +21 -23
  311. package/src/components/FormComponents/Tables/{QItemGroupTableRow.tsx → GroupTableRow.tsx} +4 -4
  312. package/src/components/FormComponents/Tables/index.ts +18 -0
  313. package/src/components/FormComponents/TextItem/TextItem.tsx +3 -2
  314. package/src/components/FormComponents/index.ts +20 -0
  315. package/src/components/Renderer/BaseRenderer.tsx +39 -18
  316. package/src/components/Renderer/FormBodyCollapsible.tsx +2 -2
  317. package/src/components/Renderer/FormBodyTabbed.tsx +3 -3
  318. package/src/components/Renderer/FormTopLevelItem.tsx +33 -4
  319. package/src/components/Tabs/FormBodySingleTab.tsx +1 -1
  320. package/src/components/Tabs/FormBodyTabList.tsx +5 -8
  321. package/src/components/Tabs/FormBodyTabListWrapper.tsx +15 -26
  322. package/src/components/Tabs/ShowCompletedTabsSection.tsx +52 -0
  323. package/src/components/index.ts +1 -0
  324. package/src/hooks/index.ts +1 -0
  325. package/src/hooks/useContextDisplayItems.ts +40 -0
  326. package/src/hooks/useInitialiseRenderer.ts +2 -2
  327. package/src/hooks/useInitialiseRepeatAnswers.ts +28 -17
  328. package/src/hooks/useInitialiseRepeatGroups.ts +28 -17
  329. package/src/hooks/useNumberInput.ts +38 -0
  330. package/src/hooks/useStringInput.ts +38 -0
  331. package/src/hooks/useTerminologyServerQuery.ts +3 -6
  332. package/src/index.ts +45 -2
  333. package/src/interfaces/questionnaireStore.interface.ts +1 -0
  334. package/src/interfaces/renderProps.interface.ts +4 -0
  335. package/src/stores/useQuestionnaireResponseStore.ts +15 -10
  336. package/src/stores/useQuestionnaireStore.ts +10 -3
  337. package/src/theme/overrides/Overrides.ts +0 -2
  338. package/src/utils/calculatedExpression.ts +2 -2
  339. package/src/utils/formChanges.ts +141 -0
  340. package/src/utils/index.ts +18 -0
  341. package/src/utils/mapItem.ts +6 -4
  342. package/src/utils/qItem.ts +29 -0
  343. package/src/utils/qrItem.ts +108 -97
  344. package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +4 -0
  345. package/src/utils/repopulateIntoResponse.ts +153 -0
  346. package/src/utils/repopulateItems.ts +206 -0
  347. package/src/utils/repopulateRepeatGroup.ts +68 -0
@@ -1 +1 @@
1
- {"version":3,"file":"FormBodySingleTab.js","sourceRoot":"","sources":["../../../src/components/Tabs/FormBodySingleTab.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAC1D,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAElD,OAAO,qBAAqB,MAAM,oCAAoC,CAAC;AAEvE,OAAO,kBAAkB,MAAM,gDAAgD,CAAC;AAShF,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,iBAAiB,CAAC,KAA6B;IACrF,MAAM,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAErE,MAAM,SAAS,GAAG,qBAAqB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAEpE,SAAS,cAAc;QACrB,SAAS,CAAC,SAAS,CAAC,CAAC;QACrB,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,CACL;QACE,oBAAC,cAAc,IACb,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,EAClC,OAAO,EAAE,cAAc;YACvB,oBAAC,YAAY,IACX,OAAO,EACL,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,cAAc,EAAC,eAAe;oBACpE,oBAAC,UAAU,IAAC,OAAO,EAAC,WAAW,IAAE,QAAQ,CAAc;oBACvD,oBAAC,GAAG,IAAC,O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AAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EACnC,OAAO,EAAE,cAAc;YACvB,oBAAC,YAAY,IACX,OAAO,EACL,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,cAAc,EAAC,eAAe;oBACpE,oBAAC,UAAU,IAAC,OAAO,EAAC,WAAW,IAAE,QAAQ,CAAc;oBACvD,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IACnD,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;wBAChC,OAAO,oBAAC,kBAAkB,IAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,GAAI,CAAC;oBACrE,CAAC,CAAC,CACE,CACF,GAER,CACa,CAChB,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
@@ -6,6 +6,7 @@ interface FormBodyTabListProps {
6
6
  currentTabIndex: number;
7
7
  tabs: Tabs;
8
8
  completedTabsCollapsed: boolean;
9
+ allContextDisplayItems: QuestionnaireItem[][];
9
10
  }
10
11
  declare const FormBodyTabList: React.NamedExoticComponent<FormBodyTabListProps>;
11
12
  export default FormBodyTabList;
@@ -14,19 +14,18 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import React, { memo, useMemo } from 'react';
17
+ import React, { memo } from 'react';
18
18
  import Collapse from '@mui/material/Collapse';
19
19
  import { TransitionGroup } from 'react-transition-group';
20
20
  import { getShortText } from '../../utils/itemControl';
21
21
  import FormBodySingleTab from './FormBodySingleTab';
22
22
  import useQuestionnaireStore from '../../stores/useQuestionnaireStore';
23
- import { getContextDisplays, isTabHidden } from '../../utils/tabs';
23
+ import { isTabHidden } from '../../utils/tabs';
24
24
  const FormBodyTabList = memo(function FormBodyTabList(props) {
25
- const { topLevelItems, currentTabIndex, tabs, completedTabsCollapsed } = props;
25
+ const { topLevelItems, currentTabIndex, tabs, completedTabsCollapsed, allContextDisplayItems } = props;
26
26
  const enableWhenIsActivated = useQuestionnaireStore((state) => state.enableWhenIsActivated);
27
27
  const enableWhenItems = useQuestionnaireStore((state) => state.enableWhenItems);
28
28
  const enableWhenExpressions = useQuestionnaireStore((state) => state.enableWhenExpressions);
29
- const allContextDisplayItems = useMemo(() => topLevelItems.map((topLevelItem) => getContextDisplays(topLevelItem)), [topLevelItems]);
30
29
  return (React.createElement(TransitionGroup, null, topLevelItems.map((qItem, i) => {
31
30
  var _a, _b;
32
31
  const contextDisplayItems = allContextDisplayItems[i];
@@ -1 +1 @@
1
- {"version":3,"file":"FormBodyTabList.js","sourceRoot":"","sources":["../../../src/components/Tabs/FormBodyTabList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,OAAO,qBAAqB,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AASnE,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,eAAe,CAAC,KAA2B;IAC/E,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,EAAE,sBAAsB,EAAE,GAAG,KAAK,CAAC;IAE/E,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC5F,MAAM,eAAe,GAAG,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AAK;YACL,mBAAmB;YACnB,KAAK;YACL,qBAAqB;YACrB,eAAe;YACf,qBAAqB;YACrB,sBAAsB;SACvB,CAAC,EACF;YACA,OAAO,IAAI,CAAC;SACb;QAED,MAAM,aAAa,GAAG,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;QAClE,MAAM,QAAQ,GAAG,MAAA,MAAA,YAAY,CAAC,KAAK,CAAC,mCAAI,KAAK,CAAC,IAAI,mCAAI,EAAE,CAAC;QAEzD,OAAO,CACL,oBAAC,QAAQ,IAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG;YACvC,oBAAC,iBAAiB,IAChB,mBAAmB,EAAE,mBAAmB,EACxC,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,CAAC,GACZ,CACO,CACZ,CAAC;IACJ,CAAC,CAAC,CACc,CACnB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { QuestionnaireItem } from 'fhir/r4';
3
3
  import type { Tabs } from '../../interfaces/tab.interface';
4
4
  interface FormBodyTabListWrapperProps {
5
- qFormItems: QuestionnaireItem[];
5
+ topLevelItems: QuestionnaireItem[];
6
6
  currentTabIndex: number;
7
7
  tabs: Tabs;
8
8
  }
@@ -18,27 +18,20 @@ import React, { memo, useState } from 'react';
18
18
  import Box from '@mui/material/Box';
19
19
  import Card from '@mui/material/Card';
20
20
  import { PrimarySelectableList } from '../Lists.styles';
21
- import { IconButton } from '@mui/material';
22
- import ExpandLess from '@mui/icons-material/ExpandLess';
23
- import ExpandMore from '@mui/icons-material/ExpandMore';
24
- import Typography from '@mui/material/Typography';
25
21
  import Divider from '@mui/material/Divider';
26
22
  import FormBodyTabList from './FormBodyTabList';
23
+ import ShowCompletedTabsSection from './ShowCompletedTabsSection';
24
+ import useContextDisplayItems from '../../hooks/useContextDisplayItems';
27
25
  const FormBodyTabListWrapper = memo(function FormBodyTabListWrapper(props) {
28
- const { qFormItems, currentTabIndex, tabs } = props;
26
+ const { topLevelItems, currentTabIndex, tabs } = props;
29
27
  const [completedTabsExpanded, setCompletedTabsExpanded] = useState(true);
28
+ const { allContextDisplayItems, completedDisplayItemExists } = useContextDisplayItems(topLevelItems);
30
29
  return (React.createElement(Card, { sx: { p: 0.75, mb: 2 } },
31
30
  React.createElement(Box, { sx: { flexGrow: 1 } },
32
31
  React.createElement(PrimarySelectableList, { dense: true, disablePadding: true, sx: { mb: 1 }, "data-test": "renderer-tab-list" },
33
- React.createElement(Box, { display: "flex", justifyContent: "center", alignItems: "center", mx: 2, columnGap: 0.5 },
34
- React.createElement(Typography, { variant: "overline", fontSize: 9, color: completedTabsExpanded ? 'text.secondary' : 'text.disabled' },
35
- "Completed tabs ",
36
- completedTabsExpanded ? 'shown' : 'hidden'),
37
- React.createElement(IconButton, { size: "small", onClick: () => {
38
- setCompletedTabsExpanded(!completedTabsExpanded);
39
- } }, completedTabsExpanded ? (React.createElement(ExpandLess, { fontSize: "small" })) : (React.createElement(ExpandMore, { fontSize: "small" })))),
32
+ completedDisplayItemExists ? (React.createElement(ShowCompletedTabsSection, { completedTabsExpanded: completedTabsExpanded, setCompletedTabsExpanded: setCompletedTabsExpanded })) : null,
40
33
  React.createElement(Divider, { sx: { mx: 1 }, light: true }),
41
- React.createElement(FormBodyTabList, { topLevelItems: qFormItems, currentTabIndex: currentTabIndex, tabs: tabs, completedTabsCollapsed: !completedTabsExpanded })))));
34
+ React.createElement(FormBodyTabList, { topLevelItems: topLevelItems, currentTabIndex: currentTabIndex, tabs: tabs, completedTabsCollapsed: !completedTabsExpanded, allContextDisplayItems: allContextDisplayItems })))));
42
35
  });
43
36
  export default FormBodyTabListWrapper;
44
37
  //# sourceMappingURL=FormBodyTabListWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormBodyTabListWrapper.js","sourceRoot":"","sources":["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BAAsB,MAAM,oCAAoC,CAAC;AAQxE,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,sBAAsB,CACjE,KAAkC;IAElC,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAEvD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEzE,MAAM,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,GAC1D,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAExC,OAAO,CACL,oBAAC,IAAI,IAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE;QAC1B,oBAAC,GAAG,IAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;YACtB,oBAAC,qBAAqB,IAAC,KAAK,QAAC,cAAc,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,eAAY,mBAAmB;gBACrF,0BAA0B,CAAC,CAAC,CAAC,CAC5B,oBAAC,wBAAwB,IACvB,qBAAqB,EAAE,qBAAqB,EAC5C,wBAAwB,EAAE,wBAAwB,GAClD,CACH,CAAC,CAAC,CAAC,IAAI;gBACR,oBAAC,OAAO,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,SAAG;gBAChC,oBAAC,eAAe,IACd,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,eAAe,EAChC,IAAI,EAAE,IAAI,EACV,sBAAsB,EAAE,CAAC,qBAAqB,EAC9C,sBAAsB,EAAE,sBAAsB,GAC9C,CACoB,CACpB,CACD,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface ShowCompletedTabsSectionProps {
3
+ completedTabsExpanded: boolean;
4
+ setCompletedTabsExpanded: (newExpanded: boolean) => void;
5
+ }
6
+ declare function ShowCompletedTabsSection(props: ShowCompletedTabsSectionProps): React.JSX.Element;
7
+ export default ShowCompletedTabsSection;
@@ -0,0 +1,34 @@
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 Box from '@mui/material/Box';
19
+ import Typography from '@mui/material/Typography';
20
+ import { IconButton } from '@mui/material';
21
+ import ExpandLess from '@mui/icons-material/ExpandLess';
22
+ import ExpandMore from '@mui/icons-material/ExpandMore';
23
+ function ShowCompletedTabsSection(props) {
24
+ const { completedTabsExpanded, setCompletedTabsExpanded } = props;
25
+ return (React.createElement(Box, { display: "flex", justifyContent: "center", alignItems: "center", mx: 2, columnGap: 0.5 },
26
+ React.createElement(Typography, { variant: "overline", fontSize: 9, color: completedTabsExpanded ? 'text.secondary' : 'text.disabled' },
27
+ "Completed tabs ",
28
+ completedTabsExpanded ? 'shown' : 'hidden'),
29
+ React.createElement(IconButton, { size: "small", onClick: () => {
30
+ setCompletedTabsExpanded(!completedTabsExpanded);
31
+ } }, completedTabsExpanded ? React.createElement(ExpandLess, { fontSize: "small" }) : React.createElement(ExpandMore, { fontSize: "small" }))));
32
+ }
33
+ export default ShowCompletedTabsSection;
34
+ //# sourceMappingURL=ShowCompletedTabsSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShowCompletedTabsSection.js","sourceRoot":"","sources":["../../../src/components/Tabs/ShowCompletedTabsSection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,UAAU,MAAM,gCAAgC,CAAC;AACxD,OAAO,UAAU,MAAM,gCAAgC,CAAC;AAOxD,SAAS,wBAAwB,CAAC,KAAoC;IACpE,MAAM,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,GAAG,KAAK,CAAC;IAElE,OAAO,CACL,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,cAAc,EAAC,QAAQ,EAAC,UAAU,EAAC,QAAQ,EAAC,EAAE,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG;QACnF,oBAAC,UAAU,IACT,OAAO,EAAC,UAAU,EAClB,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe;;YACjD,qBAAqB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAC/C;QACb,oBAAC,UAAU,IACT,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE;gBACZ,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,CAAC;YACnD,CAAC,IACA,qBAAqB,CAAC,CAAC,CAAC,oBAAC,UAAU,IAAC,QAAQ,EAAC,OAAO,GAAG,CAAC,CAAC,CAAC,oBAAC,UAAU,IAAC,QAAQ,EAAC,OAAO,GAAG,CAC/E,CACT,CACP,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from './Renderer';
2
+ export * from './FormComponents';
@@ -15,4 +15,5 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  export * from './Renderer';
18
+ export * from './FormComponents';
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ export { default as useHidden } from './useHidden';
@@ -0,0 +1,2 @@
1
+ export { default as useHidden } from './useHidden';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { QuestionnaireItem } from 'fhir/r4';
2
+ declare function useContextDisplayItems(topLevelItems: QuestionnaireItem[]): {
3
+ allContextDisplayItems: QuestionnaireItem[][];
4
+ completedDisplayItemExists: boolean;
5
+ };
6
+ export default useContextDisplayItems;
@@ -0,0 +1,30 @@
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 { useMemo } from 'react';
18
+ import { getContextDisplays } from '../utils/tabs';
19
+ function useContextDisplayItems(topLevelItems) {
20
+ return useMemo(() => {
21
+ let completedDisplayItemExists = false;
22
+ const allContextDisplayItems = topLevelItems.map((topLevelItem) => getContextDisplays(topLevelItem));
23
+ completedDisplayItemExists = allContextDisplayItems.some((contextDisplayItems) => {
24
+ return contextDisplayItems.some((contextDisplayItem) => contextDisplayItem.text === 'Complete');
25
+ });
26
+ return { allContextDisplayItems, completedDisplayItemExists };
27
+ }, [topLevelItems]);
28
+ }
29
+ export default useContextDisplayItems;
30
+ //# sourceMappingURL=useContextDisplayItems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContextDisplayItems.js","sourceRoot":"","sources":["../../src/hooks/useContextDisplayItems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,SAAS,sBAAsB,CAAC,aAAkC;IAChE,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,0BAA0B,GAAG,KAAK,CAAC;QAEvC,MAAM,sBAAsB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAChE,kBAAkB,CAAC,YAAY,CAAC,CACjC,CAAC;QAEF,0BAA0B,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,EAAE;YAC/E,OAAO,mBAAmB,CAAC,IAAI,CAC7B,CAAC,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,KAAK,UAAU,CAC/D,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,CAAC;IAChE,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;AACtB,CAAC;AAED,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function useIntegerUpdateFromProp(stateValue: string, propValue: number, setInputValue: (value: number) => void): void;
2
+ export default useIntegerUpdateFromProp;
@@ -0,0 +1,29 @@
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 { useEffect } from 'react';
18
+ function useIntegerUpdateFromProp(stateValue, propValue, setInputValue) {
19
+ useEffect(() => {
20
+ if (stateValue !== propValue) {
21
+ setInputValue(propValue);
22
+ }
23
+ },
24
+ // Only trigger this effect if prop value changes
25
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ [propValue]);
27
+ }
28
+ export default useIntegerUpdateFromProp;
29
+ //# sourceMappingURL=useDecimalUpdateFromProp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDecimalUpdateFromProp.js","sourceRoot":"","sources":["../../src/hooks/useDecimalUpdateFromProp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,SAAS,wBAAwB,CAC/B,UAAkB,EAClB,SAAiB,EACjB,aAAsC;IAEtC,SAAS,CACP,GAAG,EAAE;QACH,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,aAAa,CAAC,SAAS,CAAC,CAAC;SAC1B;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,SAAS,CAAC,CACZ,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { useLayoutEffect, useState } from 'react';
18
- import { createQuestionnaireResponse } from '../utils/qrItem';
18
+ import { createEmptyQuestionnaireResponse } from '../utils/qrItem';
19
19
  import useQuestionnaireStore from '../stores/useQuestionnaireStore';
20
20
  import useQuestionnaireResponseStore from '../stores/useQuestionnaireResponseStore';
21
21
  import useSmartConfigStore from '../stores/useSmartConfigStore';
@@ -57,7 +57,7 @@ function useInitialiseRenderer(questionnaire, questionnaireResponse, additionalV
57
57
  }
58
58
  // initialise form including enableWhen, enableWhenExpressions, calculatedExpressions, initialExpressions, answerExpressions, cache answerValueSets
59
59
  buildSourceQuestionnaire(questionnaire, questionnaireResponse, additionalVariables, terminologyServerUrl).then(() => {
60
- buildSourceResponse(createQuestionnaireResponse(questionnaire));
60
+ buildSourceResponse(createEmptyQuestionnaireResponse(questionnaire));
61
61
  if (questionnaireResponse) {
62
62
  const updatedResponse = updatePopulatedProperties(questionnaireResponse);
63
63
  setUpdatableResponseAsPopulated(updatedResponse);
@@ -1 +1 @@
1
- {"version":3,"file":"useInitialiseRenderer.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,qBAAqB,MAAM,iCAAiC,CAAC;AACpE,OAAO,6BAA6B,MAAM,yCAAyC,CAAC;AAEpF,OAAO,mBAAmB,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,yBAAyB,MAAM,qCAAqC,CAAC;AAE5E,SAAS,qBAAqB,CAC5B,aAA4B,EAC5B,qBAA6C,EAC7C,mBAA4C,EAC5C,oBAA6B,EAC7B,UAAmB;IAEnB,MAAM,wBAAwB,GAAG,qBAAqB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,K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AE;gBACvC,UAAU,CAAC,OAAO,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACjC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;YACH,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;gBAC3C,YAAY,CAAC,SAAS,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;SACJ;QAED,gFAAgF;QAChF,IAAI,oBAAoB,EAAE;YACxB,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;SAC/C;aAAM;YACL,yBAAyB,EAAE,CAAC;SAC7B;QAED,mJAAmJ;QACnJ,wBAAwB,CACtB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,CACrB,CAAC,IAAI,CAAC,GAAG,EAAE;YACV,mBAAmB,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC,CAAC;YAEhE,IAAI,qBAAqB,EAAE;gBACzB,MAAM,eAAe,GAAG,yBAAyB,CAAC,qBAAqB,CAAC,CAAC;gBACzE,+BAA+B,CAAC,eAAe,CAAC,CAAC;aAClD;YACD,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE;QACD,aAAa;QACb,qBAAqB;QACrB,wBAAwB;QACxB,mBAAmB;QACnB,+BAA+B;QAC/B,yBAAyB;QACzB,mBAAmB;QACnB,UAAU;QACV,cAAc;QACd,UAAU;QACV,OAAO;QACP,YAAY;QACZ,oBAAoB;QACpB,uBAAuB;KACxB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"useInitialiseRenderer.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAe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,CAAC,qBAAqB,CAAC,CAAC;gBACzE,+BAA+B,CAAC,eAAe,CAAC,CAAC;aAClD;YACD,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE;QACD,aAAa;QACb,qBAAqB;QACrB,wBAAwB;QACxB,mBAAmB;QACnB,+BAA+B;QAC/B,yBAAyB;QACzB,mBAAmB;QACnB,UAAU;QACV,cAAc;QACd,UAAU;QACV,OAAO;QACP,YAAY;QACZ,oBAAoB;QACpB,uBAAuB;KACxB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { QuestionnaireResponseItem } from 'fhir/r4';
1
+ import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
2
2
  import type { RepeatAnswer } from '../interfaces/repeatItem.interface';
3
- declare function useInitialiseRepeatAnswers(qrItem: QuestionnaireResponseItem): RepeatAnswer[];
3
+ declare function useInitialiseRepeatAnswers(qItem: QuestionnaireItem, qrItem: QuestionnaireResponseItem): RepeatAnswer[];
4
4
  export default useInitialiseRepeatAnswers;
@@ -15,22 +15,28 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { nanoid } from 'nanoid';
18
- function useInitialiseRepeatAnswers(qrItem) {
19
- let initialRepeatAnswers = [
20
- {
21
- nanoId: nanoid(),
22
- answer: null
23
- }
24
- ];
25
- if (qrItem === null || qrItem === void 0 ? void 0 : qrItem.answer) {
26
- initialRepeatAnswers = qrItem.answer.map((answer) => {
27
- return {
18
+ import { useMemo } from 'react';
19
+ function useInitialiseRepeatAnswers(qItem, qrItem) {
20
+ return useMemo(() => {
21
+ let initialRepeatAnswers = [
22
+ {
28
23
  nanoId: nanoid(),
29
- answer
30
- };
31
- });
32
- }
33
- return initialRepeatAnswers;
24
+ answer: null
25
+ }
26
+ ];
27
+ if (qrItem === null || qrItem === void 0 ? void 0 : qrItem.answer) {
28
+ initialRepeatAnswers = qrItem.answer.map((answer) => {
29
+ return {
30
+ nanoId: nanoid(),
31
+ answer
32
+ };
33
+ });
34
+ }
35
+ return initialRepeatAnswers;
36
+ },
37
+ // init initialRepeatAnswers on first render only, leave dependency array empty
38
+ // eslint-disable-next-line react-hooks/exhaustive-deps
39
+ [qItem]);
34
40
  }
35
41
  export default useInitialiseRepeatAnswers;
36
42
  //# sourceMappingURL=useInitialiseRepeatAnswers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInitialiseRepeatAnswers.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseRepeatAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,SAAS,0BAA0B,CAAC,MAAiC;IACnE,IAAI,oBAAoB,GAAmB;QACzC;YACE,MAAM,EAAE,MAAM,EAAE;YAChB,MAAM,EAAE,IAAI;SACb;KACF,CAAC;IAEF,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;QAClB,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAClD,OAAO;gBACL,MAAM,EAAE,MAAM,EAAE;gBAChB,MAAM;aACP,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"useInitialiseRepeatAnswers.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseRepeatAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,SAAS,0BAA0B,CACjC,KAAwB,EACxB,MAAiC;IAEjC,OAAO,OAAO,CACZ,GAAG,EAAE;QACH,IAAI,oBAAoB,GAAmB;YACzC;gBACE,MAAM,EAAE,MAAM,EAAE;gBAChB,MAAM,EAAE,IAAI;aACb;SACF,CAAC;QAEF,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;YAClB,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gBAClD,OAAO;oBACL,MAAM,EAAE,MAAM,EAAE;oBAChB,MAAM;iBACP,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IACD,+EAA+E;IAC/E,uDAAuD;IACvD,CAAC,KAAK,CAAC,CACR,CAAC;AACJ,CAAC;AAED,eAAe,0BAA0B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { QuestionnaireResponseItem } from 'fhir/r4';
2
+ import type { QuestionnaireItem } from 'fhir/r4';
2
3
  import type { RepeatGroupSingle } from '../interfaces/repeatGroup.interface';
3
- declare function useInitialiseRepeatGroups(qrItems: QuestionnaireResponseItem[]): RepeatGroupSingle[];
4
+ declare function useInitialiseRepeatGroups(qItem: QuestionnaireItem, qrItems: QuestionnaireResponseItem[]): RepeatGroupSingle[];
4
5
  export default useInitialiseRepeatGroups;
@@ -15,22 +15,28 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { nanoid } from 'nanoid';
18
- function useInitialiseRepeatGroups(qrItems) {
19
- let initialRepeatGroupAnswers = [
20
- {
21
- nanoId: nanoid(),
22
- qrItem: null
23
- }
24
- ];
25
- if (qrItems.length > 0) {
26
- initialRepeatGroupAnswers = qrItems.map((qrItem) => {
27
- return {
18
+ import { useMemo } from 'react';
19
+ function useInitialiseRepeatGroups(qItem, qrItems) {
20
+ return useMemo(() => {
21
+ let initialRepeatGroupAnswers = [
22
+ {
28
23
  nanoId: nanoid(),
29
- qrItem
30
- };
31
- });
32
- }
33
- return initialRepeatGroupAnswers;
24
+ qrItem: null
25
+ }
26
+ ];
27
+ if (qrItems.length > 0) {
28
+ initialRepeatGroupAnswers = qrItems.map((qrItem) => {
29
+ return {
30
+ nanoId: nanoid(),
31
+ qrItem
32
+ };
33
+ });
34
+ }
35
+ return initialRepeatGroupAnswers;
36
+ },
37
+ // init initialRepeatAnswers on first render only, leave dependency array empty
38
+ // eslint-disable-next-line react-hooks/exhaustive-deps
39
+ [qItem]);
34
40
  }
35
41
  export default useInitialiseRepeatGroups;
36
42
  //# sourceMappingURL=useInitialiseRepeatGroups.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInitialiseRepeatGroups.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseRepeatGroups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,SAAS,yBAAyB,CAAC,OAAoC;IACrE,IAAI,yBAAyB,GAAwB;QACnD;YACE,MAAM,EAAE,MAAM,EAAE;YAChB,MAAM,EAAE,IAAI;SACb;KACF,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACtB,yBAAyB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACjD,OAAO;gBACL,MAAM,EAAE,MAAM,EAAE;gBAChB,MAAM;aACP,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,yBAAyB,CAAC;AACnC,CAAC;AAED,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"useInitialiseRepeatGroups.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseRepeatGroups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,SAAS,yBAAyB,CAChC,KAAwB,EACxB,OAAoC;IAEpC,OAAO,OAAO,CACZ,GAAG,EAAE;QACH,IAAI,yBAAyB,GAAwB;YACnD;gBACE,MAAM,EAAE,MAAM,EAAE;gBAChB,MAAM,EAAE,IAAI;aACb;SACF,CAAC;QAEF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACtB,yBAAyB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gBACjD,OAAO;oBACL,MAAM,EAAE,MAAM,EAAE;oBAChB,MAAM;iBACP,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IACD,+EAA+E;IAC/E,uDAAuD;IACvD,CAAC,KAAK,CAAC,CACR,CAAC;AACJ,CAAC;AAED,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function useIntegerUpdateFromProp(stateValue: number, propValue: number, setInputValue: (value: number) => void): void;
2
+ export default useIntegerUpdateFromProp;
@@ -0,0 +1,29 @@
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 { useEffect } from 'react';
18
+ function useIntegerUpdateFromProp(stateValue, propValue, setInputValue) {
19
+ useEffect(() => {
20
+ if (stateValue !== propValue) {
21
+ setInputValue(propValue);
22
+ }
23
+ },
24
+ // Only trigger this effect if prop value changes
25
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ [propValue]);
27
+ }
28
+ export default useIntegerUpdateFromProp;
29
+ //# sourceMappingURL=useIntegerUpdateFromProp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIntegerUpdateFromProp.js","sourceRoot":"","sources":["../../src/hooks/useIntegerUpdateFromProp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,SAAS,wBAAwB,CAC/B,UAAkB,EAClB,SAAiB,EACjB,aAAsC;IAEtC,SAAS,CACP,GAAG,EAAE;QACH,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,aAAa,CAAC,SAAS,CAAC,CAAC;SAC1B;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,SAAS,CAAC,CACZ,CAAC;AACJ,CAAC;AAED,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ declare function useNumberInput(valueFromProps: number): [number, Dispatch<SetStateAction<number>>];
3
+ export default useNumberInput;
@@ -0,0 +1,31 @@
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 { useEffect, useState } from 'react';
18
+ function useNumberInput(valueFromProps) {
19
+ const [value, setValue] = useState(valueFromProps);
20
+ useEffect(() => {
21
+ if (value !== valueFromProps) {
22
+ setValue(valueFromProps);
23
+ }
24
+ },
25
+ // Only trigger this effect if prop value changes
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ [valueFromProps]);
28
+ return [value, setValue];
29
+ }
30
+ export default useNumberInput;
31
+ //# sourceMappingURL=useNumberInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumberInput.js","sourceRoot":"","sources":["../../src/hooks/useNumberInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,cAAc,CAAC,cAAsB;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEnD,SAAS,CACP,GAAG,EAAE;QACH,IAAI,KAAK,KAAK,cAAc,EAAE;YAC5B,QAAQ,CAAC,cAAc,CAAC,CAAC;SAC1B;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC3B,CAAC;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function useNumberUpdateFromProp(stateValue: number, propValue: number, setInputValue: (value: number) => void): void;
2
+ export default useNumberUpdateFromProp;
@@ -0,0 +1,29 @@
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 { useEffect } from 'react';
18
+ function useNumberUpdateFromProp(stateValue, propValue, setInputValue) {
19
+ useEffect(() => {
20
+ if (stateValue !== propValue) {
21
+ setInputValue(propValue);
22
+ }
23
+ },
24
+ // Only trigger this effect if prop value changes
25
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ [propValue]);
27
+ }
28
+ export default useNumberUpdateFromProp;
29
+ //# sourceMappingURL=useNumberUpdateFromProp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumberUpdateFromProp.js","sourceRoot":"","sources":["../../src/hooks/useNumberUpdateFromProp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,SAAS,uBAAuB,CAC9B,UAAkB,EAClB,SAAiB,EACjB,aAAsC;IAEtC,SAAS,CACP,GAAG,EAAE;QACH,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,aAAa,CAAC,SAAS,CAAC,CAAC;SAC1B;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,SAAS,CAAC,CACZ,CAAC;AACJ,CAAC;AAED,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { RepeatAnswer } from '../interfaces/repeatItem.interface';
3
+ import { QuestionnaireResponseItem } from 'fhir/r4';
4
+ declare function useRepeatItemState(qrItem: QuestionnaireResponseItem, initialRepeatAnswers: RepeatAnswer[]): [RepeatAnswer[], Dispatch<SetStateAction<RepeatAnswer[]>>];
5
+ export default useRepeatItemState;
@@ -0,0 +1,35 @@
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 { useEffect, useState } from 'react';
18
+ function useRepeatItemState(qrItem, initialRepeatAnswers) {
19
+ const [repeatAnswers, setRepeatAnswers] = useState(initialRepeatAnswers);
20
+ useEffect(() => {
21
+ var _a;
22
+ if (qrItem === null || qrItem === void 0 ? void 0 : qrItem.answer) {
23
+ if (repeatAnswers.length !== ((_a = qrItem.answer) === null || _a === void 0 ? void 0 : _a.length) &&
24
+ repeatAnswers !== initialRepeatAnswers) {
25
+ setRepeatAnswers(initialRepeatAnswers);
26
+ }
27
+ }
28
+ },
29
+ // Only trigger this effect if prop value changes
30
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31
+ [qrItem]);
32
+ return [repeatAnswers, setRepeatAnswers];
33
+ }
34
+ export default useRepeatItemState;
35
+ //# sourceMappingURL=useRepeatItemState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRepeatItemState.js","sourceRoot":"","sources":["../../src/hooks/useRepeatItemState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA4B,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAItE,SAAS,kBAAkB,CACzB,MAAiC,EACjC,oBAAoC;IAEpC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;IAEzE,SAAS,CACP,GAAG,EAAE;;QACH,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;YAClB,IACE,aAAa,CAAC,MAAM,MAAK,MAAA,MAAM,CAAC,MAAM,0CAAE,MAAM,CAAA;gBAC9C,aAAa,KAAK,oBAAoB,EACtC;gBACA,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;aACxC;SACF;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AAC3C,CAAC;AAED,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function useRepeatItemUpdateFromProp(stateValue: string, propValue: string, setInputValue: (value: string) => void): void;
2
+ export default useRepeatItemUpdateFromProp;