@aehrc/smart-forms-renderer 0.44.2 → 1.0.0-alpha.2

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 (137) hide show
  1. package/lib/components/FormComponents/CustomComponent.d.ts +9 -0
  2. package/lib/components/FormComponents/CustomComponent.js +31 -0
  3. package/lib/components/FormComponents/CustomComponent.js.map +1 -0
  4. package/lib/components/FormComponents/CustomComponentWrapper.d.ts +1 -0
  5. package/lib/components/FormComponents/CustomComponentWrapper.js +40 -0
  6. package/lib/components/FormComponents/CustomComponentWrapper.js.map +1 -0
  7. package/lib/components/FormComponents/GroupItem/Collapsible.d.ts +3 -0
  8. package/lib/components/FormComponents/GroupItem/Collapsible.js +6 -0
  9. package/lib/components/FormComponents/GroupItem/Collapsible.js.map +1 -0
  10. package/lib/components/FormComponents/GroupItem/GroupAccordion.d.ts +0 -0
  11. package/lib/components/FormComponents/GroupItem/GroupAccordion.js +2 -0
  12. package/lib/components/FormComponents/GroupItem/GroupAccordion.js.map +1 -0
  13. package/lib/components/FormComponents/GroupItem/GroupItem.d.ts +1 -0
  14. package/lib/components/FormComponents/GroupItem/GroupItem.js +2 -2
  15. package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
  16. package/lib/components/FormComponents/GroupItem/GroupItemView.d.ts +1 -0
  17. package/lib/components/FormComponents/GroupItem/GroupItemView.js +11 -1
  18. package/lib/components/FormComponents/GroupItem/GroupItemView.js.map +1 -1
  19. package/lib/components/FormComponents/GroupItem/PageButtonWrapper.js +7 -0
  20. package/lib/components/FormComponents/GroupItem/PageButtonWrapper.js.map +1 -1
  21. package/lib/components/FormComponents/ItemParts/ItemLabelText.js +4 -1
  22. package/lib/components/FormComponents/ItemParts/ItemLabelText.js.map +1 -1
  23. package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js +6 -5
  24. package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js.map +1 -1
  25. package/lib/components/FormComponents/ItemParts/index.d.ts +1 -0
  26. package/lib/components/FormComponents/ItemParts/index.js +18 -0
  27. package/lib/components/FormComponents/ItemParts/index.js.map +1 -0
  28. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +9 -0
  29. package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
  30. package/lib/components/FormComponents/StringItem/index.d.ts +1 -0
  31. package/lib/components/FormComponents/StringItem/index.js +18 -0
  32. package/lib/components/FormComponents/StringItem/index.js.map +1 -0
  33. package/lib/components/FormComponents/index.d.ts +2 -0
  34. package/lib/components/FormComponents/index.js +3 -0
  35. package/lib/components/FormComponents/index.js.map +1 -1
  36. package/lib/components/Pages/SingleItemPaginated.d.ts +19 -0
  37. package/lib/components/Pages/SingleItemPaginated.js +7 -0
  38. package/lib/components/Pages/SingleItemPaginated.js.map +1 -0
  39. package/lib/components/Renderer/BaseRenderer.js +5 -5
  40. package/lib/components/Renderer/BaseRenderer.js.map +1 -1
  41. package/lib/components/Renderer/FormBodyPaginated.d.ts +9 -0
  42. package/lib/components/Renderer/FormBodyPaginated.js +49 -0
  43. package/lib/components/Renderer/FormBodyPaginated.js.map +1 -0
  44. package/lib/components/Renderer/FormTopLevelItem.js +0 -7
  45. package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
  46. package/lib/components/Renderer/PageItem.d.ts +9 -0
  47. package/lib/components/Renderer/PageItem.js +68 -0
  48. package/lib/components/Renderer/PageItem.js.map +1 -0
  49. package/lib/components/index.d.ts +2 -1
  50. package/lib/components/index.js +3 -1
  51. package/lib/components/index.js.map +1 -1
  52. package/lib/hooks/index.d.ts +4 -0
  53. package/lib/hooks/index.js +5 -0
  54. package/lib/hooks/index.js.map +1 -1
  55. package/lib/hooks/useBuildForm.d.ts +5 -1
  56. package/lib/hooks/useBuildForm.js +20 -3
  57. package/lib/hooks/useBuildForm.js.map +1 -1
  58. package/lib/hooks/useInitialiseGroupTable.d.ts +4 -0
  59. package/lib/hooks/useInitialiseGroupTable.js +36 -0
  60. package/lib/hooks/useInitialiseGroupTable.js.map +1 -0
  61. package/lib/hooks/useNumberInput.d.ts +3 -0
  62. package/lib/hooks/useNumberInput.js +31 -0
  63. package/lib/hooks/useNumberInput.js.map +1 -0
  64. package/lib/hooks/useRepeatGroups.d.ts +4 -0
  65. package/lib/hooks/useRepeatGroups.js +34 -0
  66. package/lib/hooks/useRepeatGroups.js.map +1 -0
  67. package/lib/hooks/useStringInput.d.ts +3 -0
  68. package/lib/hooks/useStringInput.js +32 -0
  69. package/lib/hooks/useStringInput.js.map +1 -0
  70. package/lib/index.d.ts +4 -4
  71. package/lib/index.js +3 -3
  72. package/lib/index.js.map +1 -1
  73. package/lib/interfaces/customComponent.d.ts +9 -0
  74. package/lib/interfaces/customComponent.interface.d.ts +9 -0
  75. package/lib/interfaces/customComponent.interface.js +18 -0
  76. package/lib/interfaces/customComponent.interface.js.map +1 -0
  77. package/lib/interfaces/customComponent.js +18 -0
  78. package/lib/interfaces/customComponent.js.map +1 -0
  79. package/lib/interfaces/index.d.ts +1 -0
  80. package/lib/stores/questionnaireStore.d.ts +6 -2
  81. package/lib/stores/questionnaireStore.js +5 -2
  82. package/lib/stores/questionnaireStore.js.map +1 -1
  83. package/lib/stores/rendererStylingStore.d.ts +28 -0
  84. package/lib/stores/rendererStylingStore.js +38 -0
  85. package/lib/stores/rendererStylingStore.js.map +1 -0
  86. package/lib/stores/stylingStore.d.ts +23 -0
  87. package/lib/stores/stylingStore.js +27 -0
  88. package/lib/stores/stylingStore.js.map +1 -0
  89. package/lib/stories/storybookWrappers/iframeResizerChild.d.ts +1 -0
  90. package/lib/stories/storybookWrappers/iframeResizerChild.js +849 -0
  91. package/lib/stories/storybookWrappers/iframeResizerChild.js.map +1 -0
  92. package/lib/utils/customComponent.d.ts +9 -0
  93. package/lib/utils/customComponent.js +18 -0
  94. package/lib/utils/customComponent.js.map +1 -0
  95. package/lib/utils/index.d.ts +1 -0
  96. package/lib/utils/index.js +1 -0
  97. package/lib/utils/index.js.map +1 -1
  98. package/lib/utils/manageForm.d.ts +3 -1
  99. package/lib/utils/manageForm.js +3 -2
  100. package/lib/utils/manageForm.js.map +1 -1
  101. package/lib/utils/openChoice.js +2 -10
  102. package/lib/utils/openChoice.js.map +1 -1
  103. package/lib/utils/page.d.ts +3 -3
  104. package/lib/utils/page.js +2 -5
  105. package/lib/utils/page.js.map +1 -1
  106. package/lib/utils/questionnaireStoreUtils/extractPages.js +5 -11
  107. package/lib/utils/questionnaireStoreUtils/extractPages.js.map +1 -1
  108. package/package.json +1 -1
  109. package/src/components/FormComponents/GroupItem/GroupItem.tsx +3 -0
  110. package/src/components/FormComponents/GroupItem/GroupItemView.tsx +33 -0
  111. package/src/components/FormComponents/GroupItem/PageButtonWrapper.tsx +8 -0
  112. package/src/components/FormComponents/ItemParts/ItemLabelText.tsx +9 -1
  113. package/src/components/FormComponents/ItemParts/ItemLabelWrapper.tsx +12 -10
  114. package/src/components/FormComponents/ItemParts/index.ts +18 -0
  115. package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +20 -0
  116. package/src/components/FormComponents/StringItem/index.ts +18 -0
  117. package/src/components/FormComponents/index.ts +4 -0
  118. package/src/components/Renderer/BaseRenderer.tsx +5 -5
  119. package/src/components/Renderer/FormBodyPaginated.tsx +127 -0
  120. package/src/components/Renderer/FormTopLevelItem.tsx +0 -17
  121. package/src/components/index.ts +6 -1
  122. package/src/hooks/index.ts +6 -0
  123. package/src/hooks/useBuildForm.ts +27 -3
  124. package/src/index.ts +22 -3
  125. package/src/interfaces/customComponent.interface.ts +27 -0
  126. package/src/interfaces/index.ts +1 -0
  127. package/src/stores/questionnaireStore.ts +11 -3
  128. package/src/stores/rendererStylingStore.ts +75 -0
  129. package/src/stories/assets/questionnaires/QItemControlGroup.ts +772 -0
  130. package/src/stories/sdc/ItemControlGroup.stories.tsx +7 -0
  131. package/src/utils/index.ts +2 -0
  132. package/src/utils/manageForm.ts +12 -2
  133. package/src/utils/openChoice.ts +2 -13
  134. package/src/utils/page.ts +4 -11
  135. package/src/utils/questionnaireStoreUtils/extractPages.ts +5 -12
  136. package/src/components/Renderer/FormBodyPage.tsx +0 -93
  137. package/src/components/Renderer/FormTopLevelPage.tsx +0 -70
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormBodyPaginated.js","sourceRoot":"","sources":["../../../src/components/Renderer/FormBodyPaginated.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAK9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,kBAAkB,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AASzE,mFAAmF;AACnF,wDAAwD;AACxD,iDAAiD;AACjD,SAAS,iBAAiB,CAAC,KAA6B;IACtD,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAEpF,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,qBAAqB,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IACjE,MAAM,eAAe,GAAG,uBAAuB,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC;IAE1E,OAAO,CACL,oBAAC,IAAI,IAAC,SAAS,QAAC,OAAO,EAAE,GAAG;QAC1B,oBAAC,UAAU,IAAC,KAAK,EAAE,WAAW,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 @@
16
16
  */
17
17
  import React from 'react';
18
18
  import FormBodyTabbed from './FormBodyTabbed';
19
- import FormBodyPage from './FormBodyPage';
20
19
  import { containsTabs, isTabContainer } from '../../utils/tabs';
21
- import { containsPages, isPage } from '../../utils/page';
22
20
  import GroupItem from '../FormComponents/GroupItem/GroupItem';
23
21
  import SingleItem from '../FormComponents/SingleItem/SingleItem';
24
22
  import FormBodyCollapsible from './FormBodyCollapsible';
@@ -35,8 +33,6 @@ function FormTopLevelItem(props) {
35
33
  const { topLevelQItem, topLevelQRItemOrItems, parentIsReadOnly, onQrItemChange, onQrRepeatGroupChange } = props;
36
34
  const itemIsTabContainer = isTabContainer(topLevelQItem);
37
35
  const itemContainsTabs = containsTabs(topLevelQItem);
38
- const itemIsPageContainer = isPage(topLevelQItem);
39
- const itemContainsPages = containsPages(topLevelQItem);
40
36
  const isTablet = useResponsive('up', 'md');
41
37
  const itemIsGroup = topLevelQItem.type === 'group';
42
38
  const readOnly = useReadOnly(topLevelQItem, parentIsReadOnly);
@@ -58,9 +54,6 @@ function FormTopLevelItem(props) {
58
54
  }
59
55
  return (React.createElement(FormBodyCollapsible, { key: topLevelQItem.linkId, topLevelQItem: topLevelQItem, topLevelQRItem: topLevelQRItem, parentIsReadOnly: readOnly, onQrItemChange: onQrItemChange }));
60
56
  }
61
- if (itemContainsPages || itemIsPageContainer) {
62
- return (React.createElement(FormBodyPage, { key: topLevelQItem.linkId, topLevelQItem: topLevelQItem, topLevelQRItem: topLevelQRItem, parentIsReadOnly: readOnly, onQrItemChange: onQrItemChange }));
63
- }
64
57
  // If form is untabbed, it is rendered as a regular group
65
58
  if (itemIsGroup) {
66
59
  // Item is 'grid'
@@ -1 +1 @@
1
- {"version":3,"file":"FormTopLevelItem.js","sourceRoot":"","sources":["../../../src/components/Renderer/FormTopLevelItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,cAAc,MA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B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,cAAc,EACtB,kBAAkB,EAAE,CAAC,EACrB,gBAAgB,EAAE,QAAQ,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACE,CACP,CAAC;KACH;IAED,OAAO,CACL,oBAAC,GAAG,IAAC,EAAE,EAAE,CAAC;QACR,oBAAC,UAAU,IACT,GAAG,EAAE,aAAa,CAAC,MAAM,EACzB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,KAAK,EACf,kBAAkB,EAAE,CAAC,EACrB,gBAAgB,EAAE,QAAQ,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACE,CACP,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
3
+ import type { PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../interfaces/renderProps.interface';
4
+ interface PageItemProps extends PropsWithQrItemChangeHandler, PropsWithParentIsReadOnlyAttribute {
5
+ qItem: QuestionnaireItem;
6
+ qrItem: QuestionnaireResponseItem | null;
7
+ }
8
+ declare function PageItem(props: PageItemProps): React.JSX.Element | null;
9
+ export default PageItem;
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import Grid from '@mui/material/Grid';
3
+ import TabContext from '@mui/lab/TabContext';
4
+ import TabPanel from '@mui/lab/TabPanel';
5
+ import GroupItem from '../FormComponents/GroupItem/GroupItem';
6
+ import { SingleItem } from '../FormComponents';
7
+ import PageButtonsWrapper from '../FormComponents/GroupItem/PageButtonWrapper';
8
+ import { QGroupContainerBox } from '../Box.styles';
9
+ import { GroupCard } from '../FormComponents/GroupItem/GroupItem.styles';
10
+ import { isRepeatItemAndNotCheckbox } from '../../utils';
11
+ import { useQuestionnaireStore } from '../../stores';
12
+ import { useRendererStylingStore } from '../../stores/rendererStylingStore';
13
+ // Every group item in here is rendered as a page
14
+ function PageItem(props) {
15
+ var _a, _b;
16
+ const { qItem, qrItem, parentIsReadOnly, onQrItemChange } = props;
17
+ const pages = useQuestionnaireStore.use.pages();
18
+ const currentPage = useQuestionnaireStore.use.currentPageIndex();
19
+ const disableCardView = useRendererStylingStore.use.disablePageCardView();
20
+ const itemIsGroup = qItem.type === 'group';
21
+ const isRepeated = (_a = qItem.repeats) !== null && _a !== void 0 ? _a : false;
22
+ const pageIsMarkedAsComplete = (_b = pages[qItem.linkId].isComplete) !== null && _b !== void 0 ? _b : false;
23
+ if (!isPage || !isNotRepeatGroup) {
24
+ // Something has gone horribly wrong
25
+ return null;
26
+ }
27
+ if (itemIsGroup) {
28
+ return (React.createElement(GroupItem, { qItem: qItem, qrItem: qrItem !== null && qrItem !== void 0 ? qrItem : null, isRepeated: isRepeated, groupCardElevation: 1, disableCardView: disableCardView, pageIsMarkedAsComplete: pageIsMarkedAsComplete, pages: pages, currentPageIndex: currentPage, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
29
+ }
30
+ const itemRepeatsAndIsNotCheckbox = isRepeatItemAndNotCheckbox(qItem);
31
+ if (itemRepeatsAndIsNotCheckbox) {
32
+ return (React.createElement(QGroupContainerBox, { cardElevation: 1, isRepeated: isRepeated, "data-test": "q-item-group-box" }, disableCardView ? (React.createElement(React.Fragment, null,
33
+ React.createElement(SingleItem, { qItem: qItem, qrItem: qrItem !== null && qrItem !== void 0 ? qrItem : null, isRepeated: isRepeated, groupCardElevation: 1, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange, isTabled: false }),
34
+ React.createElement(PageButtonsWrapper, { currentPageIndex: currentPage, pages: pages }))) : (React.createElement(GroupCard, { elevation: 1, isRepeated: isRepeated },
35
+ React.createElement(SingleItem, { qItem: qItem, qrItem: qrItem !== null && qrItem !== void 0 ? qrItem : null, isRepeated: isRepeated, groupCardElevation: 1, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange, isTabled: false }),
36
+ React.createElement(PageButtonsWrapper, { currentPageIndex: currentPage, pages: pages })))));
37
+ }
38
+ return (React.createElement(Grid, { container: true, spacing: 1.5 },
39
+ React.createElement(TabContext, { value: currentPage.toString() },
40
+ React.createElement(Grid, { item: true, xs: 12, md: 12, lg: 12 }, topLevelQItems.map((qItem, i) => {
41
+ var _a, _b;
42
+ const qrItem = topLevelQRItems[i];
43
+ const isNotRepeatGroup = !Array.isArray(qrItem);
44
+ const isPage = !!pages[qItem.linkId];
45
+ const itemIsGroup = qItem.type === 'group';
46
+ if (!isPage || !isNotRepeatGroup) {
47
+ // Something has gone horribly wrong
48
+ return null;
49
+ }
50
+ const isRepeated = (_a = qItem.repeats) !== null && _a !== void 0 ? _a : false;
51
+ const pageIsMarkedAsComplete = (_b = pages[qItem.linkId].isComplete) !== null && _b !== void 0 ? _b : false;
52
+ // Render this page as a group
53
+ if (itemIsGroup) {
54
+ return (React.createElement(TabPanel, { key: qItem.linkId, sx: { p: 0 }, value: i.toString(), "data-test": "renderer-page-panel" },
55
+ React.createElement(GroupItem, { qItem: qItem, qrItem: qrItem !== null && qrItem !== void 0 ? qrItem : null, isRepeated: isRepeated, groupCardElevation: 1, disableCardView: disableCardView, pageIsMarkedAsComplete: pageIsMarkedAsComplete, pages: pages, currentPageIndex: currentPage, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange })));
56
+ }
57
+ // Page consists of a non-group item
58
+ const itemRepeatsAndIsNotCheckbox = isRepeatItemAndNotCheckbox(qItem);
59
+ return (React.createElement(TabPanel, { key: qItem.linkId, sx: { p: 0 }, value: i.toString(), "data-test": "renderer-page-panel" },
60
+ React.createElement(QGroupContainerBox, { cardElevation: 1, isRepeated: isRepeated, "data-test": "q-item-group-box" }, disableCardView ? (React.createElement(React.Fragment, null,
61
+ React.createElement(SingleItem, { qItem: qItem, qrItem: qrItem !== null && qrItem !== void 0 ? qrItem : null, isRepeated: isRepeated, groupCardElevation: 1, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange, isTabled: false }),
62
+ React.createElement(PageButtonsWrapper, { currentPageIndex: currentPage, pages: pages }))) : (React.createElement(GroupCard, { elevation: 1, isRepeated: isRepeated },
63
+ React.createElement(SingleItem, { qItem: qItem, qrItem: qrItem !== null && qrItem !== void 0 ? qrItem : null, isRepeated: isRepeated, groupCardElevation: 1, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange, isTabled: false }),
64
+ React.createElement(PageButtonsWrapper, { currentPageIndex: currentPage, pages: pages }))))));
65
+ })))));
66
+ }
67
+ export default PageItem;
68
+ //# sourceMappingURL=PageItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageItem.js","sourceRoot":"","sources":["../../../src/components/Renderer/PageItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAK9D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,kBAAkB,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAO5E,iDAAiD;AACjD,SAAS,QAAQ,CAAC,KAAoB;;IACpC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAElE,MAAM,KAAK,GAAG,qBAAqB,CAAC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AN,MAAM,GAAI,IAAI,EACtB,UAAU,EAAE,UAAU,EACtB,kBAAkB,EAAE,CAAC,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,KAAK,GACf;wBACF,oBAAC,kBAAkB,IAAC,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,GAAI,CAClE,CACJ,CAAC,CAAC,CAAC,CACF,oBAAC,SAAS,IAAC,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU;wBAC7C,oBAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,EACtB,UAAU,EAAE,UAAU,EACtB,kBAAkB,EAAE,CAAC,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,KAAK,GACf;wBACF,oBAAC,kBAAkB,IAAC,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,GAAI,CACzD,CACb,CACkB,CACZ,CACZ,CAAC;YACJ,CAAC,CAAC,CACG,CACI,CACR,CACR,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export type { SmartFormsRendererProps } from './Renderer';
2
2
  export { SmartFormsRenderer, BaseRenderer } from './Renderer';
3
- export { SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate } from './FormComponents';
3
+ export { SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate, ItemFieldGrid, StringField } from './FormComponents';
4
+ export { FullWidthFormComponentBox } from './Box.styles';
@@ -15,5 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  export { SmartFormsRenderer, BaseRenderer } from './Renderer';
18
- export { SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate } from './FormComponents';
18
+ export { SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate, ItemFieldGrid, StringField } from './FormComponents';
19
+ // Styled MUI components
20
+ export { FullWidthFormComponentBox } from './Box.styles';
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,0BAA0B,EAC3B,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,0BAA0B,EAC1B,aAAa,EACb,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAE1B,wBAAwB;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
@@ -1,3 +1,7 @@
1
1
  export { default as useHidden } from './useHidden';
2
+ export { default as useReadOnly } from './useReadOnly';
2
3
  export { default as useBuildForm } from './useBuildForm';
3
4
  export { default as useRendererQueryClient } from './useRendererQueryClient';
5
+ export { default as useRenderingExtensions } from './useRenderingExtensions';
6
+ export { default as useValidationFeedback } from './useValidationFeedback';
7
+ export { default as useStringCalculatedExpression } from './useStringCalculatedExpression';
@@ -1,4 +1,9 @@
1
1
  export { default as useHidden } from './useHidden';
2
+ export { default as useReadOnly } from './useReadOnly';
2
3
  export { default as useBuildForm } from './useBuildForm';
3
4
  export { default as useRendererQueryClient } from './useRendererQueryClient';
5
+ export { default as useRenderingExtensions } from './useRenderingExtensions';
6
+ export { default as useValidationFeedback } from './useValidationFeedback';
7
+ // CalculatedExpression hooks
8
+ export { default as useStringCalculatedExpression } from './useStringCalculatedExpression';
4
9
  //# sourceMappingURL=index.js.map
@@ -1 +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;AACnD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAE3E,6BAA6B;AAC7B,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1,4 +1,6 @@
1
+ import type { ComponentType } from 'react';
1
2
  import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
3
+ import type { RendererStyling } from '../stores/rendererStylingStore';
2
4
  /**
3
5
  * React hook wrapping around the buildForm() function to build a form from a questionnaire and an optional QuestionnaireResponse.
4
6
  * @see buildForm() for more information.
@@ -8,8 +10,10 @@ import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
8
10
  * @param readOnly - Applies read-only mode to all items in the form view
9
11
  * @param terminologyServerUrl - Terminology server url to fetch terminology. If not provided, the default terminology server will be used. (optional)
10
12
  * @param additionalVariables - Additional key-value pair of SDC variables `Record<name, variable extension>` for testing (optional)
13
+ * @param rendererStylingOptions - Renderer styling to be applied to the form. See docs for styling options. (optional)
14
+ * @param customComponents - FIXME add comment
11
15
  *
12
16
  * @author Sean Fong
13
17
  */
14
- declare function useBuildForm(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, readOnly?: boolean, terminologyServerUrl?: string, additionalVariables?: Record<string, object>): boolean;
18
+ declare function useBuildForm(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, readOnly?: boolean, terminologyServerUrl?: string, additionalVariables?: Record<string, object>, rendererStylingOptions?: RendererStyling, customComponents?: Record<string, ComponentType<any>>): boolean;
15
19
  export default useBuildForm;
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { useLayoutEffect, useState } from 'react';
18
18
  import { buildForm } from '../utils';
19
+ import { useRendererStylingStore } from '../stores/rendererStylingStore';
19
20
  /**
20
21
  * React hook wrapping around the buildForm() function to build a form from a questionnaire and an optional QuestionnaireResponse.
21
22
  * @see buildForm() for more information.
@@ -25,16 +26,32 @@ import { buildForm } from '../utils';
25
26
  * @param readOnly - Applies read-only mode to all items in the form view
26
27
  * @param terminologyServerUrl - Terminology server url to fetch terminology. If not provided, the default terminology server will be used. (optional)
27
28
  * @param additionalVariables - Additional key-value pair of SDC variables `Record<name, variable extension>` for testing (optional)
29
+ * @param rendererStylingOptions - Renderer styling to be applied to the form. See docs for styling options. (optional)
30
+ * @param customComponents - FIXME add comment
28
31
  *
29
32
  * @author Sean Fong
30
33
  */
31
- function useBuildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables) {
34
+ function useBuildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, rendererStylingOptions, customComponents) {
32
35
  const [isBuilding, setIsBuilding] = useState(true);
36
+ const setRendererStyling = useRendererStylingStore.use.setRendererStyling();
33
37
  useLayoutEffect(() => {
34
- buildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables).then(() => {
38
+ // Set optional renderer styling
39
+ if (rendererStylingOptions) {
40
+ setRendererStyling(rendererStylingOptions);
41
+ }
42
+ buildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, customComponents).then(() => {
35
43
  setIsBuilding(false);
36
44
  });
37
- }, [additionalVariables, questionnaire, questionnaireResponse, readOnly, terminologyServerUrl]);
45
+ }, [
46
+ customComponents,
47
+ questionnaire,
48
+ questionnaireResponse,
49
+ readOnly,
50
+ rendererStylingOptions,
51
+ setRendererStyling,
52
+ terminologyServerUrl,
53
+ additionalVariables
54
+ ]);
38
55
  return isBuilding;
39
56
  }
40
57
  export default useBuildForm;
@@ -1 +1 @@
1
- {"version":3,"file":"useBuildForm.js","sourceRoot":"","sources":["../../src/hooks/useBuildForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC;;;;;;;;;;;GAWG;AACH,SAAS,YAAY,CACnB,aAA4B,EAC5B,qBAA6C,EAC7C,QAAkB,EAClB,oBAA6B,EAC7B,mBAA4C;IAE5C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEnD,eAAe,CAAC,GAAG,EAAE;QACnB,SAAS,CACP,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,CACpB,CAAC,IAAI,CAAC,GAAG,EAAE;YACV,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,mBAAmB,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAEhG,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"useBuildForm.js","sourceRoot":"","sources":["../../src/hooks/useBuildForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;;;;;;;;;GAaG;AACH,SAAS,YAAY,CACnB,aAA4B,EAC5B,qBAA6C,EAC7C,QAAkB,EAClB,oBAA6B,EAC7B,mBAA4C,EAC5C,sBAAwC,EACxC,gBAAqD;IAErD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEnD,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;IAE5E,eAAe,CAAC,GAAG,EAAE;QACnB,gCAAgC;QAChC,IAAI,sBAAsB,EAAE;YAC1B,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;SAC5C;QAED,SAAS,CACP,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,CACjB,CAAC,IAAI,CAAC,GAAG,EAAE;YACV,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE;QACD,gBAAgB;QAChB,aAAa;QACb,qBAAqB;QACrB,QAAQ;QACR,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;QACpB,mBAAmB;KACpB,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { QuestionnaireResponseItem } from 'fhir/r4';
2
+ import type { GroupTableRowModel } from '../interfaces/groupTable.interface';
3
+ declare function useInitialiseGroupTable(qrItems: QuestionnaireResponseItem[]): GroupTableRowModel[];
4
+ export default useInitialiseGroupTable;
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { nanoid } from 'nanoid';
18
+ function useInitialiseGroupTable(qrItems) {
19
+ let initialGroupTableRows = [
20
+ {
21
+ nanoId: nanoid(),
22
+ qrItem: null
23
+ }
24
+ ];
25
+ if (qrItems.length > 0) {
26
+ initialGroupTableRows = qrItems.map((qrItem) => {
27
+ return {
28
+ nanoId: nanoid(),
29
+ qrItem
30
+ };
31
+ });
32
+ }
33
+ return initialGroupTableRows;
34
+ }
35
+ export default useInitialiseGroupTable;
36
+ //# sourceMappingURL=useInitialiseGroupTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInitialiseGroupTable.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseGroupTable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,SAAS,uBAAuB,CAAC,OAAoC;IACnE,IAAI,qBAAqB,GAAyB;QAChD;YACE,MAAM,EAAE,MAAM,EAAE;YAChB,MAAM,EAAE,IAAI;SACb;KACF,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACtB,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC7C,OAAO;gBACL,MAAM,EAAE,MAAM,EAAE;gBAChB,MAAM;aACP,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,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 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { useEffect, useState } from 'react';
18
+ function useNumberInput(valueFromProps) {
19
+ const [value, setValue] = useState(valueFromProps);
20
+ useEffect(() => {
21
+ if (value !== valueFromProps) {
22
+ setValue(valueFromProps);
23
+ }
24
+ },
25
+ // Only trigger this effect if prop value changes
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ [valueFromProps]);
28
+ return [value, setValue];
29
+ }
30
+ export default useNumberInput;
31
+ //# sourceMappingURL=useNumberInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumberInput.js","sourceRoot":"","sources":["../../src/hooks/useNumberInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,cAAc,CAAC,cAAsB;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEnD,SAAS,CACP,GAAG,EAAE;QACH,IAAI,KAAK,KAAK,cAAc,EAAE;YAC5B,QAAQ,CAAC,cAAc,CAAC,CAAC;SAC1B;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC3B,CAAC;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import type { RepeatGroupSingle } from '../interfaces/repeatGroup.interface';
3
+ declare function useRepeatGroups(valueFromProps: RepeatGroupSingle[]): [RepeatGroupSingle[], Dispatch<SetStateAction<RepeatGroupSingle[]>>];
4
+ export default useRepeatGroups;
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { useEffect, useState } from 'react';
18
+ import _isEqual from 'lodash/isEqual';
19
+ function useRepeatGroups(valueFromProps) {
20
+ const [repeatGroups, setRepeatGroups] = useState(valueFromProps);
21
+ useEffect(() => {
22
+ const valueFromPropsQRItems = valueFromProps.map((repeatGroupSingle) => repeatGroupSingle.qrItem);
23
+ const repeatGroupsQRItems = repeatGroups.map((repeatGroupSingle) => repeatGroupSingle.qrItem);
24
+ if (!_isEqual(valueFromPropsQRItems, repeatGroupsQRItems)) {
25
+ setRepeatGroups(valueFromProps);
26
+ }
27
+ },
28
+ // Only trigger this effect if prop value changes
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps
30
+ [valueFromProps]);
31
+ return [repeatGroups, setRepeatGroups];
32
+ }
33
+ export default useRepeatGroups;
34
+ //# sourceMappingURL=useRepeatGroups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRepeatGroups.js","sourceRoot":"","sources":["../../src/hooks/useRepeatGroups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,SAAS,eAAe,CACtB,cAAmC;IAEnC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEjE,SAAS,CACP,GAAG,EAAE;QACH,MAAM,qBAAqB,GAAG,cAAc,CAAC,GAAG,CAC9C,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAChD,CAAC;QACF,MAAM,mBAAmB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAE9F,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,EAAE;YACzD,eAAe,CAAC,cAAc,CAAC,CAAC;SACjC;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;AACzC,CAAC;AAED,eAAe,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ declare function useStringInput(valueFromProps: string): [string, Dispatch<SetStateAction<string>>];
3
+ export default useStringInput;
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { useEffect, useState } from 'react';
18
+ // The purpose of this hook to sync the string state from external changes i.e. re-population changes etc.
19
+ function useStringInput(valueFromProps) {
20
+ const [input, setInput] = useState(valueFromProps);
21
+ useEffect(() => {
22
+ if (input !== valueFromProps) {
23
+ setInput(valueFromProps);
24
+ }
25
+ },
26
+ // Only trigger this effect if prop value changes
27
+ // eslint-disable-next-line react-hooks/exhaustive-deps
28
+ [valueFromProps]);
29
+ return [input, setInput];
30
+ }
31
+ export default useStringInput;
32
+ //# sourceMappingURL=useStringInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStringInput.js","sourceRoot":"","sources":["../../src/hooks/useStringInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,0GAA0G;AAC1G,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"}
package/lib/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export type { Tab, Tabs, Variables, VariableXFhirQuery, LaunchContext } from './interfaces';
1
+ export type { Tab, Tabs, Variables, VariableXFhirQuery, LaunchContext, CustomComponentProps } from './interfaces';
2
2
  export type { SmartFormsRendererProps } from './components';
3
- export { SmartFormsRenderer, BaseRenderer, SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate } from './components';
3
+ export { SmartFormsRenderer, BaseRenderer, SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate, ItemFieldGrid, StringField, FullWidthFormComponentBox } from './components';
4
4
  export type { QuestionnaireStoreType, QuestionnaireResponseStoreType, SmartConfigStoreType, TerminologyServerStoreType } from './stores';
5
5
  export { questionnaireStore, useQuestionnaireStore, questionnaireResponseStore, useQuestionnaireResponseStore, smartConfigStore, useSmartConfigStore, terminologyServerStore, useTerminologyServerStore } from './stores';
6
- export { useHidden, useBuildForm, useRendererQueryClient } from './hooks';
6
+ export { useHidden, useReadOnly, useBuildForm, useRendererQueryClient, useRenderingExtensions, useValidationFeedback, useStringCalculatedExpression } from './hooks';
7
7
  export type { ItemToRepopulate } from './utils';
8
- export { buildForm, destroyForm, getResponse, removeEmptyAnswersFromResponse, removeInternalIdsFromResponse, isSpecificItemControl, isRepeatItemAndNotCheckbox, initialiseQuestionnaireResponse, generateItemsToRepopulate, repopulateResponse, extractObservationBased } from './utils';
8
+ export { buildForm, destroyForm, getResponse, removeEmptyAnswersFromResponse, removeInternalIdsFromResponse, createEmptyQrItem, isSpecificItemControl, isRepeatItemAndNotCheckbox, initialiseQuestionnaireResponse, generateItemsToRepopulate, repopulateResponse, extractObservationBased } from './utils';
9
9
  export { RendererThemeProvider } from './theme';
10
10
  export type { InitialiseFormWrapperProps } from './stories/storybookWrappers';
11
11
  export { InitialiseFormWrapperForStorybook } from './stories/storybookWrappers';
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export { SmartFormsRenderer, BaseRenderer, SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate } from './components';
1
+ export { SmartFormsRenderer, BaseRenderer, SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate, ItemFieldGrid, StringField, FullWidthFormComponentBox } from './components';
2
2
  export { questionnaireStore, useQuestionnaireStore, questionnaireResponseStore, useQuestionnaireResponseStore, smartConfigStore, useSmartConfigStore, terminologyServerStore, useTerminologyServerStore } from './stores';
3
3
  // hooks exports
4
- export { useHidden, useBuildForm, useRendererQueryClient } from './hooks';
5
- export { buildForm, destroyForm, getResponse, removeEmptyAnswersFromResponse, removeInternalIdsFromResponse, isSpecificItemControl, isRepeatItemAndNotCheckbox, initialiseQuestionnaireResponse, generateItemsToRepopulate, repopulateResponse, extractObservationBased } from './utils';
4
+ export { useHidden, useReadOnly, useBuildForm, useRendererQueryClient, useRenderingExtensions, useValidationFeedback, useStringCalculatedExpression } from './hooks';
5
+ export { buildForm, destroyForm, getResponse, removeEmptyAnswersFromResponse, removeInternalIdsFromResponse, createEmptyQrItem, isSpecificItemControl, isRepeatItemAndNotCheckbox, initialiseQuestionnaireResponse, generateItemsToRepopulate, repopulateResponse, extractObservationBased } from './utils';
6
6
  // theme provider exports
7
7
  export { RendererThemeProvider } from './theme';
8
8
  export { InitialiseFormWrapperForStorybook } from './stories/storybookWrappers';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,0BAA0B,EAC3B,MAAM,cAAc,CAAC;AAStB,OAAO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B,EAClB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB,yBAAyB;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIhD,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { QuestionnaireItem, type QuestionnaireResponseItem } from 'fhir/r4';
2
+ export interface CustomComponentProps {
3
+ qItem: QuestionnaireItem;
4
+ qrItem: QuestionnaireResponseItem | null;
5
+ isRepeated: boolean;
6
+ isTabled: boolean;
7
+ parentIsReadOnly?: boolean;
8
+ onQrItemChange: (qrItem: QuestionnaireResponseItem) => unknown;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { QuestionnaireItem, type QuestionnaireResponseItem } from 'fhir/r4';
2
+ export interface CustomComponentProps {
3
+ qItem: QuestionnaireItem;
4
+ qrItem: QuestionnaireResponseItem | null;
5
+ isRepeated: boolean;
6
+ isTabled: boolean;
7
+ parentIsReadOnly?: boolean;
8
+ onQrItemChange: (qrItem: QuestionnaireResponseItem) => unknown;
9
+ }
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=customComponent.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customComponent.interface.js","sourceRoot":"","sources":["../../src/interfaces/customComponent.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright 2024 Commonwealth Scientific and Industrial Research
3
+ * Organisation (CSIRO) ABN 41 687 119 230.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=customComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customComponent.js","sourceRoot":"","sources":["../../src/interfaces/customComponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -2,3 +2,4 @@ export type { Tab, Tabs } from './tab.interface';
2
2
  export type { Variables, VariableXFhirQuery } from './variables.interface';
3
3
  export type { LaunchContext } from './populate.interface';
4
4
  export type { EnableWhenItems, EnableWhenExpressions } from './enableWhen.interface';
5
+ export type { CustomComponentProps } from './customComponent.interface';
@@ -7,6 +7,8 @@ import type { AnswerExpression } from '../interfaces/answerExpression.interface'
7
7
  import type { Tabs } from '../interfaces/tab.interface';
8
8
  import type { Pages } from '../interfaces/page.interface';
9
9
  import type { InitialExpression } from '../interfaces/initialExpression.interface';
10
+ import type { CustomComponentProps } from '../interfaces';
11
+ import type { ComponentType } from 'react';
10
12
  /**
11
13
  * QuestionnaireStore properties and methods
12
14
  * Properties can be accessed for fine-grain details.
@@ -74,9 +76,10 @@ export interface QuestionnaireStoreType {
74
76
  cachedValueSetCodings: Record<string, Coding[]>;
75
77
  fhirPathContext: Record<string, any>;
76
78
  populatedContext: Record<string, any>;
79
+ customComponents: Record<string, ComponentType<CustomComponentProps>>;
77
80
  focusedLinkId: string;
78
81
  readOnly: boolean;
79
- buildSourceQuestionnaire: (questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, additionalVariables?: Record<string, object>, terminologyServerUrl?: string, readOnly?: boolean) => Promise<void>;
82
+ buildSourceQuestionnaire: (questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, additionalVariables?: Record<string, object>, terminologyServerUrl?: string, readOnly?: boolean, customComponents?: Record<string, ComponentType<any>>) => Promise<void>;
80
83
  destroySourceQuestionnaire: () => void;
81
84
  switchTab: (newTabIndex: number) => void;
82
85
  switchPage: (newPageIndex: number) => void;
@@ -131,9 +134,10 @@ export declare const useQuestionnaireStore: import("zustand/vanilla").StoreApi<Q
131
134
  cachedValueSetCodings: () => Record<string, Coding[]>;
132
135
  fhirPathContext: () => Record<string, any>;
133
136
  populatedContext: () => Record<string, any>;
137
+ customComponents: () => Record<string, ComponentType<CustomComponentProps>>;
134
138
  focusedLinkId: () => string;
135
139
  readOnly: () => boolean;
136
- buildSourceQuestionnaire: () => (questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, additionalVariables?: Record<string, object>, terminologyServerUrl?: string, readOnly?: boolean) => Promise<void>;
140
+ buildSourceQuestionnaire: () => (questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, additionalVariables?: Record<string, object>, terminologyServerUrl?: string, readOnly?: boolean, customComponents?: Record<string, ComponentType<any>>) => Promise<void>;
137
141
  destroySourceQuestionnaire: () => () => void;
138
142
  switchTab: () => (newTabIndex: number) => void;
139
143
  switchPage: () => (newPageIndex: number) => void;