@aehrc/smart-forms-renderer 0.34.1 → 0.35.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 (116) hide show
  1. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.js +3 -1
  2. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.js.map +1 -1
  3. package/lib/components/FormComponents/GroupItem/GroupItemView.d.ts +1 -2
  4. package/lib/components/FormComponents/GroupItem/GroupItemView.js +3 -3
  5. package/lib/components/FormComponents/GroupItem/GroupItemView.js.map +1 -1
  6. package/lib/components/FormComponents/RepeatGroup/RepeatGroupView.js +3 -3
  7. package/lib/components/FormComponents/RepeatGroup/RepeatGroupView.js.map +1 -1
  8. package/lib/components/FormComponents/SingleItem/NestedSingleItemAccordion.styles.d.ts +27 -0
  9. package/lib/components/FormComponents/SingleItem/NestedSingleItemAccordion.styles.js +51 -0
  10. package/lib/components/FormComponents/SingleItem/NestedSingleItemAccordion.styles.js.map +1 -0
  11. package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +1 -1
  12. package/lib/components/FormComponents/SingleItem/SingleItem.js +3 -17
  13. package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
  14. package/lib/components/FormComponents/SingleItem/SingleItemView.d.ts +13 -0
  15. package/lib/components/FormComponents/SingleItem/SingleItemView.js +63 -0
  16. package/lib/components/FormComponents/SingleItem/SingleItemView.js.map +1 -0
  17. package/lib/components/FormComponents/SingleItem/StopPropagationWrapper.d.ts +7 -0
  18. package/lib/{stories/index.js → components/FormComponents/SingleItem/StopPropagationWrapper.js} +9 -2
  19. package/lib/components/FormComponents/SingleItem/StopPropagationWrapper.js.map +1 -0
  20. package/lib/components/Renderer/FormTopLevelItem.js +1 -1
  21. package/package.json +1 -1
  22. package/src/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.tsx +3 -1
  23. package/src/components/FormComponents/GroupItem/GroupItemView.tsx +5 -5
  24. package/src/components/FormComponents/RepeatGroup/RepeatGroupView.tsx +3 -3
  25. package/src/components/FormComponents/SingleItem/NestedSingleItemAccordion.styles.ts +54 -0
  26. package/src/components/FormComponents/SingleItem/SingleItem.tsx +15 -51
  27. package/src/components/FormComponents/SingleItem/SingleItemView.tsx +169 -0
  28. package/{lib/hooks/useQueryClient.js → src/components/FormComponents/SingleItem/StopPropagationWrapper.tsx} +21 -12
  29. package/src/components/Renderer/FormTopLevelItem.tsx +1 -1
  30. package/src/stories/assets/questionnaires/QAdvancedControlAppearance.ts +256 -15
  31. package/src/stories/sdc/AdvancedControlAppearance.stories.tsx +23 -9
  32. package/lib/components/FormComponents/ChoiceItems/CheckboxFields.d.ts +0 -11
  33. package/lib/components/FormComponents/ChoiceItems/CheckboxFields.js +0 -41
  34. package/lib/components/FormComponents/ChoiceItems/CheckboxFields.js.map +0 -1
  35. package/lib/components/FormComponents/ChoiceItems/CheckboxOptionFields.d.ts +0 -11
  36. package/lib/components/FormComponents/ChoiceItems/CheckboxOptionFields.js +0 -41
  37. package/lib/components/FormComponents/ChoiceItems/CheckboxOptionFields.js.map +0 -1
  38. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetView.d.ts +0 -13
  39. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetView.js +0 -46
  40. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetView.js.map +0 -1
  41. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxFields.d.ts +0 -11
  42. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxFields.js +0 -41
  43. package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxFields.js.map +0 -1
  44. package/lib/components/FormComponents/DateTimeItem/DateTimeField.d.ts +0 -12
  45. package/lib/components/FormComponents/DateTimeItem/DateTimeField.js +0 -34
  46. package/lib/components/FormComponents/DateTimeItem/DateTimeField.js.map +0 -1
  47. package/lib/components/FormComponents/DateTimeItem/DateTimeItem.d.ts +0 -9
  48. package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js +0 -60
  49. package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js.map +0 -1
  50. package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.d.ts +0 -8
  51. package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.js +0 -57
  52. package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.js.map +0 -1
  53. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.d.ts +0 -8
  54. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js +0 -37
  55. package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js.map +0 -1
  56. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxFields.d.ts +0 -18
  57. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxFields.js +0 -48
  58. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxFields.js.map +0 -1
  59. package/lib/components/StoryWrappers/BuildFormWrapper.d.ts +0 -7
  60. package/lib/components/StoryWrappers/BuildFormWrapper.js +0 -57
  61. package/lib/components/StoryWrappers/BuildFormWrapper.js.map +0 -1
  62. package/lib/hooks/useDisplayCalculatedExpression.d.ts +0 -3
  63. package/lib/hooks/useDisplayCalculatedExpression.js +0 -40
  64. package/lib/hooks/useDisplayCalculatedExpression.js.map +0 -1
  65. package/lib/hooks/useInitaliseFhirClient.d.ts +0 -1
  66. package/lib/hooks/useInitaliseFhirClient.js +0 -55
  67. package/lib/hooks/useInitaliseFhirClient.js.map +0 -1
  68. package/lib/hooks/useInitialiseRenderer.d.ts +0 -4
  69. package/lib/hooks/useInitialiseRenderer.js +0 -62
  70. package/lib/hooks/useInitialiseRenderer.js.map +0 -1
  71. package/lib/hooks/useNextPreviousVisibleTabs.d.ts +0 -6
  72. package/lib/hooks/useNextPreviousVisibleTabs.js +0 -63
  73. package/lib/hooks/useNextPreviousVisibleTabs.js.map +0 -1
  74. package/lib/hooks/useQueryClient.d.ts +0 -3
  75. package/lib/hooks/useQueryClient.js.map +0 -1
  76. package/lib/hooks/useRepeatitemState.d.ts +0 -0
  77. package/lib/hooks/useRepeatitemState.js +0 -2
  78. package/lib/hooks/useRepeatitemState.js.map +0 -1
  79. package/lib/interfaces/repopulateItems.interface.d.ts +0 -0
  80. package/lib/interfaces/repopulateItems.interface.js +0 -2
  81. package/lib/interfaces/repopulateItems.interface.js.map +0 -1
  82. package/lib/setup-jest.js +0 -1
  83. package/lib/stories/InitialiseFormWrapperForStorybook.d.ts +0 -29
  84. package/lib/stories/InitialiseFormWrapperForStorybook.js +0 -65
  85. package/lib/stories/InitialiseFormWrapperForStorybook.js.map +0 -1
  86. package/lib/stories/MedicalHistoryTable.stories.js +0 -45
  87. package/lib/stories/SmartFormsRenderer.stories.js +0 -117
  88. package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.d.ts +0 -8
  89. package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.js +0 -44
  90. package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.js.map +0 -1
  91. package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.d.ts +0 -18
  92. package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.js +0 -48
  93. package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.js.map +0 -1
  94. package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.d.ts +0 -7
  95. package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.js +0 -32
  96. package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.js.map +0 -1
  97. package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.d.ts +0 -21
  98. package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.js +0 -83
  99. package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.js.map +0 -1
  100. package/lib/stories/StorybookWrappers/populateCallbackForStorybook.d.ts +0 -8
  101. package/lib/stories/StorybookWrappers/populateCallbackForStorybook.js +0 -46
  102. package/lib/stories/StorybookWrappers/populateCallbackForStorybook.js.map +0 -1
  103. package/lib/stories/index.d.ts +0 -1
  104. package/lib/stories/index.js.map +0 -1
  105. package/lib/utils/buildForm.d.ts +0 -8
  106. package/lib/utils/buildForm.js +0 -26
  107. package/lib/utils/buildForm.js.map +0 -1
  108. package/lib/utils/buildForms.d.ts +0 -0
  109. package/lib/utils/buildForms.js +0 -2
  110. package/lib/utils/buildForms.js.map +0 -1
  111. /package/lib/stories/{StorybookWrappers → storybookWrappers}/InitialiseFormWrapperForStorybook.d.ts +0 -0
  112. /package/lib/stories/{StorybookWrappers → storybookWrappers}/InitialiseFormWrapperForStorybook.js +0 -0
  113. /package/lib/stories/{StorybookWrappers → storybookWrappers}/InitialiseFormWrapperForStorybook.js.map +0 -0
  114. /package/lib/stories/{StorybookWrappers → storybookWrappers}/index.d.ts +0 -0
  115. /package/lib/stories/{StorybookWrappers → storybookWrappers}/index.js +0 -0
  116. /package/lib/stories/{StorybookWrappers → storybookWrappers}/index.js.map +0 -0
@@ -1,40 +0,0 @@
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 { useQuestionnaireStore } from '../stores';
18
- function useDisplayCalculatedExpression(qItem) {
19
- var _a;
20
- const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
21
- const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item._text');
22
- if (!calcExpression) {
23
- return null;
24
- }
25
- if (typeof calcExpression.value === 'string' ||
26
- typeof calcExpression.value === 'number' ||
27
- calcExpression.value === null) {
28
- // calculatedExpression value is null
29
- if (calcExpression.value === null) {
30
- return '';
31
- }
32
- // calculatedExpression value is string or number
33
- return typeof calcExpression.value === 'string'
34
- ? calcExpression.value
35
- : calcExpression.value.toString();
36
- }
37
- return null;
38
- }
39
- export default useDisplayCalculatedExpression;
40
- //# sourceMappingURL=useDisplayCalculatedExpression.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDisplayCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useDisplayCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAGlD,SAAS,8BAA8B,CAAC,KAAwB;;IAC9D,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAEhF,MAAM,cAAc,GAAG,MAAA,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,IAAI,CAC9D,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY,CACnC,CAAC;IAEF,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IAED,IACE,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;QACxC,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;QACxC,cAAc,CAAC,KAAK,KAAK,IAAI,EAC7B;QACA,qCAAqC;QACrC,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,EAAE;YACjC,OAAO,EAAE,CAAC;SACX;QAED,iDAAiD;QACjD,OAAO,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;YAC7C,CAAC,CAAC,cAAc,CAAC,KAAK;YACtB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;KACrC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,eAAe,8BAA8B,CAAC"}
@@ -1 +0,0 @@
1
- export default useBuildForm;
@@ -1,55 +0,0 @@
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 } from 'react';
18
- import { readEncounter, readPatient, readUser } from '../api/smartClient';
19
- import { useSmartConfigStore } from '../stores';
20
- /**
21
- * React hook wrapping to initialise a FHIRClient object for further FHIR calls in the renderer i.e. AnswerExpression calls
22
- * Note: This does not provide pre-population capabilities
23
- *
24
- * @param questionnaire - Questionnaire to be rendered
25
- * @param questionnaireResponse - Pre-populated/draft/loaded QuestionnaireResponse to be rendered (optional)
26
- * @param readOnly - Applies read-only mode to all items in the form view
27
- * @param terminologyServerUrl - Terminology server url to fetch terminology. If not provided, the default terminology server will be used. (optional)
28
- * @param additionalVariables - Additional key-value pair of SDC variables <name, variable extension> for testing (optional)
29
- *
30
- * @author Sean Fong
31
- */
32
- function useInitaliseFhirClient(fhirClient) {
33
- const setSmartClient = useSmartConfigStore.use.setClient();
34
- const setPatient = useSmartConfigStore.use.setPatient();
35
- const setUser = useSmartConfigStore.use.setUser();
36
- const setEncounter = useSmartConfigStore.use.setEncounter();
37
- useEffect(() => {
38
- // set fhirClient if provided
39
- if (fhirClient) {
40
- setSmartClient(fhirClient);
41
- readPatient(fhirClient).then((patient) => {
42
- setPatient(patient);
43
- });
44
- readUser(fhirClient).then((user) => {
45
- setUser(user);
46
- });
47
- readEncounter(fhirClient).then((encounter) => {
48
- setEncounter(encounter);
49
- });
50
- }
51
- }, [setSmartClient, setPatient, setUser, setEncounter]);
52
- return isBuilding;
53
- }
54
- export default useBuildForm;
55
- //# sourceMappingURL=useInitaliseFhirClient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInitaliseFhirClient.js","sourceRoot":"","sources":["../../src/hooks/useInitaliseFhirClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,SAAS,sBAAsB,CAAC,UAAkB;IAChD,MAAM,cAAc,GAAG,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACxD,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAClD,MAAM,YAAY,GAAG,mBAAmB,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;IAE5D,SAAS,CAAC,GAAG,EAAE;QACb,6BAA6B;QAC7B,IAAI,UAAU,EAAE;YACd,cAAc,CAAC,UAAU,CAAC,CAAC;YAC3B,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;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;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IAExD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,eAAe,YAAY,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
2
- import type Client from 'fhirclient/lib/Client';
3
- declare function useInitialiseRenderer(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, readOnly?: boolean, terminologyServerUrl?: string, additionalVariables?: Record<string, object>, fhirClient?: Client): boolean;
4
- export default useInitialiseRenderer;
@@ -1,62 +0,0 @@
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 { useLayoutEffect, useState } from 'react';
18
- import { buildForm } from '../utils';
19
- import { readEncounter, readPatient, readUser } from '../api/smartClient';
20
- import { useSmartConfigStore } from '../stores';
21
- // Smart Config store are only used in answerExpressions at the moment. If not using answerExpressions, this can be removed.
22
- function useInitialiseRenderer(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, fhirClient) {
23
- const setSmartClient = useSmartConfigStore.use.setClient();
24
- const setPatient = useSmartConfigStore.use.setPatient();
25
- const setUser = useSmartConfigStore.use.setUser();
26
- const setEncounter = useSmartConfigStore.use.setEncounter();
27
- const [loading, setLoading] = useState(true);
28
- useLayoutEffect(() => {
29
- setLoading(true);
30
- // set fhirClient if provided
31
- if (fhirClient) {
32
- setSmartClient(fhirClient);
33
- readPatient(fhirClient).then((patient) => {
34
- setPatient(patient);
35
- });
36
- readUser(fhirClient).then((user) => {
37
- setUser(user);
38
- });
39
- readEncounter(fhirClient).then((encounter) => {
40
- setEncounter(encounter);
41
- });
42
- }
43
- // initialise form including enableWhen, enableWhenExpressions, calculatedExpressions, initialExpressions, answerExpressions, cache answerValueSets
44
- buildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables).then(() => {
45
- setLoading(false);
46
- });
47
- }, [
48
- questionnaire,
49
- questionnaireResponse,
50
- additionalVariables,
51
- terminologyServerUrl,
52
- fhirClient,
53
- readOnly,
54
- setSmartClient,
55
- setPatient,
56
- setUser,
57
- setEncounter
58
- ]);
59
- return loading;
60
- }
61
- export default useInitialiseRenderer;
62
- //# sourceMappingURL=useInitialiseRenderer.js.map
@@ -1 +0,0 @@
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,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,4HAA4H;AAC5H,SAAS,qBAAqB,CAC5B,aAA4B,EAC5B,qBAA6C,EAC7C,QAAkB,EAClB,oBAA6B,EAC7B,mBAA4C,EAC5C,UAAmB;IAEnB,MAAM,cAAc,GAAG,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACxD,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAClD,MAAM,YAAY,GAAG,mBAAmB,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;IAE5D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7C,eAAe,CAAC,GAAG,EAAE;QACnB,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,6BAA6B;QAC7B,IAAI,UAAU,EAAE;YACd,cAAc,CAAC,UAAU,CAAC,CAAC;YAC3B,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;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,mJAAmJ;QACnJ,SAAS,CACP,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,CACpB,CAAC,IAAI,CAAC,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE;QACD,aAAa;QACb,qBAAqB;QACrB,mBAAmB;QACnB,oBAAoB;QACpB,UAAU;QACV,QAAQ;QACR,cAAc;QACd,UAAU;QACV,OAAO;QACP,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,6 +0,0 @@
1
- import { Tabs } from '../interfaces/tab.interface';
2
- declare function useNextPreviousVisibleTabs(currentTabIndex?: number, tabs?: Tabs): {
3
- previousTabIndex: number | null;
4
- nextTabIndex: number | null;
5
- };
6
- export default useNextPreviousVisibleTabs;
@@ -1,63 +0,0 @@
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 { useQuestionnaireStore } from '../stores';
18
- import { constructTabsWithVisibility } from '../utils/tabs';
19
- function useNextPreviousVisibleTabs(currentTabIndex, tabs) {
20
- const enableWhenIsActivated = useQuestionnaireStore.use.enableWhenIsActivated();
21
- const enableWhenItems = useQuestionnaireStore.use.enableWhenItems();
22
- const enableWhenExpressions = useQuestionnaireStore.use.enableWhenExpressions();
23
- const switchTab = useQuestionnaireStore.use.switchTab();
24
- const tabsNotDefined = currentTabIndex === undefined || tabs === undefined;
25
- if (tabsNotDefined) {
26
- return { previousTabIndex: null, nextTabIndex: null };
27
- }
28
- const tabsWithVisibility = constructTabsWithVisibility({
29
- tabs,
30
- enableWhenIsActivated,
31
- enableWhenItems,
32
- enableWhenExpressions
33
- });
34
- return {
35
- previousTabIndex: getPreviousTabIndex(currentTabIndex, tabsWithVisibility),
36
- nextTabIndex: getNextTabIndex(currentTabIndex, tabsWithVisibility)
37
- };
38
- }
39
- function getNextTabIndex(currentTabIndex, tabsWithVisibility) {
40
- const subsequentTabs = tabsWithVisibility.slice(currentTabIndex + 1);
41
- const foundIndex = subsequentTabs.findIndex((tab) => tab.isVisible);
42
- // Next visible tab not found, something is wrong
43
- if (foundIndex === -1) {
44
- return null;
45
- }
46
- return currentTabIndex + foundIndex + 1;
47
- }
48
- function getPreviousTabIndex(currentTabIndex, tabsWithVisibility) {
49
- const previousTabs = tabsWithVisibility.slice(0, currentTabIndex);
50
- const foundIndex = previousTabs.reverse().findIndex((tab) => tab.isVisible);
51
- // Previous visible tab not found
52
- if (foundIndex === -1) {
53
- return null;
54
- }
55
- // Previous visible tab less than 0
56
- const previousTabIndex = currentTabIndex - foundIndex - 1;
57
- if (previousTabIndex < 0) {
58
- return null;
59
- }
60
- return previousTabIndex;
61
- }
62
- export default useNextPreviousVisibleTabs;
63
- //# sourceMappingURL=useNextPreviousVisibleTabs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNextPreviousVisibleTabs.js","sourceRoot":"","sources":["../../src/hooks/useNextPreviousVisibleTabs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAE5D,SAAS,0BAA0B,CACjC,eAAwB,EACxB,IAAW;IAEX,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAChF,MAAM,eAAe,GAAG,qBAAqB,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;IACpE,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAChF,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;IAExD,MAAM,cAAc,GAAG,eAAe,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,CAAC;IAE3E,IAAI,cAAc,EAAE;QAClB,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KACvD;IAED,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;QACrD,IAAI;QACJ,qBAAqB;QACrB,eAAe;QACf,qBAAqB;KACtB,CAAC,CAAC;IAEH,OAAO;QACL,gBAAgB,EAAE,mBAAmB,CAAC,eAAe,EAAE,kBAAkB,CAAC;QAC1E,YAAY,EAAE,eAAe,CAAC,eAAe,EAAE,kBAAkB,CAAC;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACtB,eAAuB,EACvB,kBAA4D;IAE5D,MAAM,cAAc,GAAG,kBAAkB,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEpE,iDAAiD;IACjD,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,eAAe,GAAG,UAAU,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,mBAAmB,CAC1B,eAAuB,EACvB,kBAA4D;IAE5D,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAE5E,iCAAiC;IACjC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC;KACb;IAED,mCAAmC;IACnC,MAAM,gBAAgB,GAAG,eAAe,GAAG,UAAU,GAAG,CAAC,CAAC;IAC1D,IAAI,gBAAgB,GAAG,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,eAAe,0BAA0B,CAAC"}
@@ -1,3 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- declare function useQueryClient(): QueryClient;
3
- export default useQueryClient;
@@ -1 +0,0 @@
1
- {"version":3,"file":"useQueryClient.js","sourceRoot":"","sources":["../../src/hooks/useQueryClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,SAAS,cAAc;IACrB,OAAO,IAAI,WAAW,CAAC;QACrB,cAAc,EAAE;YACd,OAAO,EAAE;gBACP,oBAAoB,EAAE,KAAK;gBAC3B,gBAAgB,EAAE,IAAI;aACvB;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,eAAe,cAAc,CAAC"}
File without changes
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=useRepeatitemState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRepeatitemState.js","sourceRoot":"","sources":["../../src/hooks/useRepeatitemState.ts"],"names":[],"mappings":""}
File without changes
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=repopulateItems.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repopulateItems.interface.js","sourceRoot":"","sources":["../../src/interfaces/repopulateItems.interface.ts"],"names":[],"mappings":""}
package/lib/setup-jest.js DELETED
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
3
- import type Client from 'fhirclient/lib/Client';
4
- interface InitialiseFormWrapperProps {
5
- questionnaire: Questionnaire;
6
- questionnaireResponse?: QuestionnaireResponse;
7
- readOnly?: boolean;
8
- terminologyServerUrl?: string;
9
- additionalVariables?: Record<string, object>;
10
- fhirClient?: Client;
11
- }
12
- /**
13
- * This is a one-to-one replacement for the SmartFormsRenderer for demo purposes.
14
- * Instead of using this React component, define your own wrapper component that uses the BaseRenderer directly.
15
- * Things to note:
16
- * - It is required to wrap the BaseRenderer with the QueryClientProvider to make requests.
17
- * - You can wrap the BaseRenderer with the RendererThemeProvider to apply the default renderer theme used in Smart Forms. Optionally, you can define your own ThemeProvider.
18
- * - Make your buildForm() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form.
19
- * - Make your own initialiseFhirClient() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form.
20
- * - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities.
21
- *
22
- * For button click usage examples of buildForm(), see:
23
- * - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonTesterWrapper.tsx#L47
24
- * - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonForStorybook.tsx
25
- *
26
- * @author Sean Fong
27
- */
28
- declare function InitialiseFormWrapperForStorybook(props: InitialiseFormWrapperProps): React.JSX.Element;
29
- export default InitialiseFormWrapperForStorybook;
@@ -1,65 +0,0 @@
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
- // @ts-ignore
18
- import React from 'react';
19
- import { BaseRenderer } from '../components';
20
- import { QueryClientProvider } from '@tanstack/react-query';
21
- import RendererThemeProvider from '../theme/Theme';
22
- import useRendererQueryClient from '../hooks/useRendererQueryClient';
23
- import useInitialiseForm from '../hooks/useInitialiseForm';
24
- import Box from '@mui/material/Box';
25
- import CircularProgress from '@mui/material/CircularProgress';
26
- import Typography from '@mui/material/Typography';
27
- /**
28
- * This is a one-to-one replacement for the SmartFormsRenderer for demo purposes.
29
- * Instead of using this React component, define your own wrapper component that uses the BaseRenderer directly.
30
- * Things to note:
31
- * - It is required to wrap the BaseRenderer with the QueryClientProvider to make requests.
32
- * - You can wrap the BaseRenderer with the RendererThemeProvider to apply the default renderer theme used in Smart Forms. Optionally, you can define your own ThemeProvider.
33
- * - Make your buildForm() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form.
34
- * - Make your own initialiseFhirClient() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form.
35
- * - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities.
36
- *
37
- * For button click usage examples of buildForm(), see:
38
- * - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonTesterWrapper.tsx#L47
39
- * - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonForStorybook.tsx
40
- *
41
- * @author Sean Fong
42
- */
43
- function InitialiseFormWrapperForStorybook(props) {
44
- const { questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, fhirClient } = props;
45
- // The renderer requires a @tanstack/react-query QueryClientProvider to make requests
46
- const queryClient = useRendererQueryClient();
47
- /**
48
- * The useInitialiseForm hook provides initialisation logic for the form
49
- * Alternatively (and recommended to do so), you can initialise your form via a button click or other event handler.
50
- *
51
- * @see {@link https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonForStorybook.tsx} for button click usage examples.
52
- */
53
- const isInitialising = useInitialiseForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, fhirClient);
54
- // Free feel to customise your loading animation here
55
- if (isInitialising) {
56
- return (React.createElement(Box, { display: "flex", alignItems: "center", columnGap: 2 },
57
- React.createElement(CircularProgress, null),
58
- React.createElement(Typography, null, "Loading questionnaire...")));
59
- }
60
- return (React.createElement(RendererThemeProvider, null,
61
- React.createElement(QueryClientProvider, { client: queryClient },
62
- React.createElement(BaseRenderer, null))));
63
- }
64
- export default InitialiseFormWrapperForStorybook;
65
- //# sourceMappingURL=InitialiseFormWrapperForStorybook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InitialiseFormWrapperForStorybook.js","sourceRoot":"","sources":["../../src/stories/InitialiseFormWrapperForStorybook.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,aAAa;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,qBAAqB,MAAM,gBAAgB,CAAC;AACnD,OAAO,sBAAsB,MAAM,iCAAiC,CAAC;AAErE,OAAO,iBAAiB,MAAM,4BAA4B,CAAC;AAC3D,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAWlD;;;;;;;;;;;;;;;GAeG;AACH,SAAS,iCAAiC,CAAC,KAAiC;IAC1E,MAAM,EACJ,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACX,GAAG,KAAK,CAAC;IAEV,qFAAqF;IACrF,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAC;IAE7C;;;;;OAKG;IACH,MAAM,cAAc,GAAG,iBAAiB,CACtC,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,CACX,CAAC;IAEF,qDAAqD;IACrD,IAAI,cAAc,EAAE;QAClB,OAAO,CACL,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC;YAClD,oBAAC,gBAAgB,OAAG;YACpB,oBAAC,UAAU,mCAAsC,CAC7C,CACP,CAAC;KACH;IAED,OAAO,CACL,oBAAC,qBAAqB;QACpB,oBAAC,mBAAmB,IAAC,MAAM,EAAE,WAAW;YACtC,oBAAC,YAAY,OAAG,CACI,CACA,CACzB,CAAC;AACJ,CAAC;AAED,eAAe,iCAAiC,CAAC"}
@@ -1,45 +0,0 @@
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
- */ import ThemeProvider from '../theme/Theme';
17
- import { GroupTable } from '../components';
18
- import GTableMedicalHistoryItemJson from './assets/QItems-and-QRItems/Q_GTableMedicalHistory.json';
19
- import GTableMedicalHistoryAnswersJson from './assets/QItems-and-QRItems/QR_GTableMedicalHistory.json';
20
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
21
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
22
- const meta = {
23
- title: 'Component/GroupTable',
24
- component: GroupTable,
25
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
26
- tags: [],
27
- decorators: [
28
- (Story)=>/*#__PURE__*/ React.createElement(ThemeProvider, null, /*#__PURE__*/ React.createElement(QueryClientProvider, {
29
- client: new QueryClient()
30
- }, Story()))
31
- ]
32
- };
33
- const GTableMedicalHistoryItem = GTableMedicalHistoryItemJson;
34
- const GTableMedicalHistoryAnswers = GTableMedicalHistoryAnswersJson;
35
- export default meta;
36
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
37
- export const MedicalHistoryTable = {
38
- args: {
39
- qItem: GTableMedicalHistoryItem,
40
- qrItems: GTableMedicalHistoryAnswers,
41
- groupCardElevation: 1,
42
- parentIsReadOnly: false,
43
- onQrRepeatGroupChange: ()=>{}
44
- }
45
- };
@@ -1,117 +0,0 @@
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
- */ import { SmartFormsRenderer } from '../components';
17
- import Q715Json from './assets/Qs-and-QRs/Q715.json';
18
- import R715Json from './assets/Qs-and-QRs/R715.json';
19
- import QTestGridJson from './assets/Qs-and-QRs/QTestGrid.json';
20
- import RTestGridJson from './assets/Qs-and-QRs/RTestGrid.json';
21
- import QDev715Json from './assets/Qs-and-QRs/QDev715.json';
22
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
23
- const meta = {
24
- title: 'Component/SmartFormsRenderer',
25
- component: SmartFormsRenderer,
26
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
27
- tags: []
28
- };
29
- const Q715 = Q715Json;
30
- const R715 = R715Json;
31
- const QTestGrid = QTestGridJson;
32
- const RTestGrid = RTestGridJson;
33
- const QDev715 = QDev715Json;
34
- export default meta;
35
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
36
- export const Form715 = {
37
- args: {
38
- questionnaire: Q715
39
- }
40
- };
41
- export const Form715WithResponse = {
42
- args: {
43
- questionnaire: Q715,
44
- questionnaireResponse: R715
45
- }
46
- };
47
- export const FormDev715 = {
48
- args: {
49
- questionnaire: QDev715
50
- }
51
- };
52
- export const FormTestGrid = {
53
- args: {
54
- questionnaire: QTestGrid
55
- }
56
- };
57
- export const FormTestGridWithResponse = {
58
- args: {
59
- questionnaire: QTestGrid,
60
- questionnaireResponse: RTestGrid,
61
- additionalVariables: {}
62
- }
63
- };
64
- export const QTestGridWithResponseAddFhirPath = {
65
- args: {
66
- questionnaire: QTestGrid,
67
- questionnaireResponse: RTestGrid,
68
- additionalVariables: {
69
- addVar1: {
70
- url: 'http://hl7.org/fhir/StructureDefinition/variable',
71
- valueExpression: {
72
- name: 'addVar1',
73
- language: 'text/fhirpath',
74
- expression: "%resource.item.where(linkId='grid').item.where(linkId='1').item.where(linkId='1.1').item.where(linkId='1.1.1').answer.value"
75
- }
76
- }
77
- }
78
- }
79
- };
80
- export const QTestGridWithResponseAddXFhirQuery = {
81
- args: {
82
- questionnaire: QTestGrid,
83
- questionnaireResponse: RTestGrid,
84
- additionalVariables: {
85
- addVar1: {
86
- url: 'http://hl7.org/fhir/StructureDefinition/variable',
87
- valueExpression: {
88
- name: 'addVar1',
89
- language: 'text/fhirpath',
90
- expression: "%resource.item.where(linkId='grid').item.where(linkId='1').item.where(linkId='1.1').item.where(linkId='1.1.1').answer.value"
91
- }
92
- },
93
- addVar2: {
94
- url: 'http://hl7.org/fhir/StructureDefinition/variable',
95
- valueExpression: {
96
- name: 'addVar2',
97
- language: 'application/x-fhir-query',
98
- expression: 'Condition?patient={{%patient.id}}'
99
- }
100
- }
101
- }
102
- }
103
- };
104
- export const QTestGridWithResponseReadOnly = {
105
- args: {
106
- questionnaire: QTestGrid,
107
- questionnaireResponse: RTestGrid,
108
- readOnly: true
109
- }
110
- };
111
- export const Form715WithResponseReadOnly = {
112
- args: {
113
- questionnaire: Q715,
114
- questionnaireResponse: R715,
115
- readOnly: true
116
- }
117
- };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
3
- interface BuildFormButtonProps {
4
- questionnaire: Questionnaire;
5
- questionnaireResponse?: QuestionnaireResponse;
6
- }
7
- declare function BuildFormButtonForStorybook(props: BuildFormButtonProps): React.JSX.Element;
8
- export default BuildFormButtonForStorybook;
@@ -1,44 +0,0 @@
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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- // @ts-ignore
27
- import React from 'react';
28
- import { Box, IconButton, Tooltip } from '@mui/material';
29
- import Iconify from '../../components/Iconify/Iconify';
30
- import { buildForm } from '../../utils';
31
- function BuildFormButtonForStorybook(props) {
32
- const { questionnaire, questionnaireResponse } = props;
33
- function handleBuildForm() {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- yield buildForm(questionnaire, questionnaireResponse);
36
- });
37
- }
38
- return (React.createElement(Box, { display: "flex", mb: 0.5, alignItems: "center", columnGap: 3 },
39
- React.createElement(Tooltip, { title: "Build form with questionnaire response", placement: "right" },
40
- React.createElement(IconButton, { onClick: handleBuildForm, size: "small", color: "primary" },
41
- React.createElement(Iconify, { icon: "ph:hammer", sx: { mb: 0.5 } })))));
42
- }
43
- export default BuildFormButtonForStorybook;
44
- //# sourceMappingURL=BuildFormButtonForStorybook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildFormButtonForStorybook.js","sourceRoot":"","sources":["../../../src/stories/StorybookWrappers/BuildFormButtonForStorybook.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;AAEH,aAAa;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,OAAO,MAAM,kCAAkC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOxC,SAAS,2BAA2B,CAAC,KAA2B;IAC9D,MAAM,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IAEvD,SAAe,eAAe;;YAC5B,MAAM,SAAS,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;QACxD,CAAC;KAAA;IAED,OAAO,CACL,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,EAAE,EAAE,GAAG,EAAE,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC;QAC3D,oBAAC,OAAO,IAAC,KAAK,EAAC,wCAAwC,EAAC,SAAS,EAAC,OAAO;YACvE,oBAAC,UAAU,IAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,SAAS;gBAChE,oBAAC,OAAO,IAAC,IAAI,EAAC,WAAW,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAI,CAClC,CACL,CACN,CACP,CAAC;AACJ,CAAC;AAED,eAAe,2BAA2B,CAAC"}
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
3
- interface BuildFormButtonTesterWrapperForStorybookProps {
4
- questionnaire: Questionnaire;
5
- questionnaireResponse?: QuestionnaireResponse;
6
- }
7
- /**
8
- * This is a demo wrapper which initialises the BaseRenderer with the passed in questionnaire using useBuildForm.
9
- * It also provides a button to build the form with the passed in questionnaire + questionnaireResponse.
10
- * It was done as a two-step process for demo purposes.
11
- *
12
- * Use this pattern if you already have a pre-populated/pre-filled/draft response.
13
- * If you want to pre-pop on the fly, see https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/PrePopWrapperForStorybook.tsx instead
14
- *
15
- * @author Sean Fong
16
- */
17
- declare function BuildFormButtonTesterWrapperForStorybook(props: BuildFormButtonTesterWrapperForStorybookProps): React.JSX.Element;
18
- export default BuildFormButtonTesterWrapperForStorybook;