@aehrc/smart-forms-renderer 0.30.2 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/lib/components/FormComponents/BooleanItem/BooleanField.js +5 -4
- package/lib/components/FormComponents/BooleanItem/BooleanField.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +5 -4
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +5 -4
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/DateTimeItems/index.d.ts +1 -1
- package/lib/components/FormComponents/DateTimeItems/index.js +1 -1
- package/lib/components/FormComponents/DateTimeItems/index.js.map +1 -1
- package/lib/components/FormComponents/DateTimeItems/utils/parseDate.d.ts +5 -0
- package/lib/components/FormComponents/DateTimeItems/utils/parseDate.js +5 -0
- package/lib/components/FormComponents/DateTimeItems/utils/parseDate.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridGroup.d.ts +6 -0
- package/lib/components/FormComponents/GridGroup/GridGroup.js +6 -0
- package/lib/components/FormComponents/GridGroup/GridGroup.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.d.ts +6 -0
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js +6 -0
- package/lib/components/FormComponents/RepeatGroup/RepeatGroup.js.map +1 -1
- package/lib/components/FormComponents/RepeatItem/RepeatItem.d.ts +5 -0
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js +5 -0
- package/lib/components/FormComponents/RepeatItem/RepeatItem.js.map +1 -1
- package/lib/components/FormComponents/SingleItem/SingleItem.d.ts +6 -0
- package/lib/components/FormComponents/SingleItem/SingleItem.js +6 -0
- package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTable.d.ts +6 -0
- package/lib/components/FormComponents/Tables/GroupTable.js +6 -0
- package/lib/components/FormComponents/Tables/GroupTable.js.map +1 -1
- package/lib/components/FormComponents/index.d.ts +6 -6
- package/lib/components/FormComponents/index.js +6 -6
- package/lib/components/FormComponents/index.js.map +1 -1
- package/lib/components/Renderer/BaseRenderer.d.ts +7 -0
- package/lib/components/Renderer/BaseRenderer.js +7 -0
- package/lib/components/Renderer/BaseRenderer.js.map +1 -1
- package/lib/components/Renderer/SmartFormsRenderer.d.ts +22 -1
- package/lib/components/Renderer/SmartFormsRenderer.js +16 -6
- package/lib/components/Renderer/SmartFormsRenderer.js.map +1 -1
- package/lib/components/Renderer/index.d.ts +1 -0
- package/lib/components/Renderer/index.js.map +1 -1
- package/lib/components/index.d.ts +3 -2
- package/lib/components/index.js +2 -2
- package/lib/components/index.js.map +1 -1
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useBuildForm.d.ts +15 -0
- package/lib/hooks/useBuildForm.js +41 -0
- package/lib/hooks/useBuildForm.js.map +1 -0
- package/lib/hooks/useHidden.d.ts +6 -0
- package/lib/hooks/useHidden.js +6 -0
- package/lib/hooks/useHidden.js.map +1 -1
- package/lib/hooks/useInitaliseFhirClient.d.ts +1 -0
- package/lib/hooks/useInitaliseFhirClient.js +55 -0
- package/lib/hooks/useInitaliseFhirClient.js.map +1 -0
- package/lib/hooks/useInitialiseForm.d.ts +20 -0
- package/lib/hooks/useInitialiseForm.js +72 -0
- package/lib/hooks/useInitialiseForm.js.map +1 -0
- package/lib/hooks/useInitialiseRenderer.d.ts +1 -1
- package/lib/hooks/useInitialiseRenderer.js +8 -31
- package/lib/hooks/useInitialiseRenderer.js.map +1 -1
- package/lib/hooks/useRendererQueryClient.d.ts +10 -0
- package/lib/hooks/useRendererQueryClient.js +36 -0
- package/lib/hooks/useRendererQueryClient.js.map +1 -0
- package/lib/hooks/useValueSetCodings.js +1 -0
- package/lib/hooks/useValueSetCodings.js.map +1 -1
- package/lib/index.d.ts +10 -40
- package/lib/index.js +8 -77
- package/lib/index.js.map +1 -1
- package/lib/interfaces/calculatedExpression.interface.d.ts +7 -0
- package/lib/interfaces/calculatedExpression.interface.js +16 -0
- package/lib/interfaces/calculatedExpression.interface.js.map +1 -1
- package/lib/interfaces/enableWhen.interface.d.ts +12 -0
- package/lib/interfaces/index.d.ts +4 -1
- package/lib/interfaces/index.js +16 -0
- package/lib/interfaces/index.js.map +1 -1
- package/lib/interfaces/populate.interface.d.ts +6 -0
- package/lib/interfaces/repopulateItems.interface.d.ts +0 -0
- package/lib/interfaces/repopulateItems.interface.js +2 -0
- package/lib/interfaces/repopulateItems.interface.js.map +1 -0
- package/lib/interfaces/tab.interface.d.ts +10 -0
- package/lib/interfaces/tab.interface.js +16 -0
- package/lib/interfaces/tab.interface.js.map +1 -1
- package/lib/interfaces/variables.interface.d.ts +12 -0
- package/lib/stores/index.d.ts +4 -0
- package/lib/stores/index.js.map +1 -1
- package/lib/stores/questionnaireResponseStore.d.ts +37 -2
- package/lib/stores/questionnaireResponseStore.js +72 -22
- package/lib/stores/questionnaireResponseStore.js.map +1 -1
- package/lib/stores/questionnaireStore.d.ts +59 -3
- package/lib/stores/questionnaireStore.js +18 -0
- package/lib/stores/questionnaireStore.js.map +1 -1
- package/lib/stores/smartConfigStore.d.ts +37 -0
- package/lib/stores/smartConfigStore.js +21 -0
- package/lib/stores/smartConfigStore.js.map +1 -1
- package/lib/stores/terminologyServerStore.d.ts +28 -2
- package/lib/stores/terminologyServerStore.js +16 -0
- package/lib/stores/terminologyServerStore.js.map +1 -1
- package/lib/stories/InitialiseFormWrapperForStorybook.d.ts +29 -0
- package/lib/stories/InitialiseFormWrapperForStorybook.js +65 -0
- package/lib/stories/InitialiseFormWrapperForStorybook.js.map +1 -0
- package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.d.ts +8 -0
- package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.js +44 -0
- package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.js.map +1 -0
- package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.d.ts +18 -0
- package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.js +48 -0
- package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.js.map +1 -0
- package/lib/stories/StorybookWrappers/InitialiseFormWrapperForStorybook.d.ts +31 -0
- package/lib/stories/StorybookWrappers/InitialiseFormWrapperForStorybook.js +67 -0
- package/lib/stories/StorybookWrappers/InitialiseFormWrapperForStorybook.js.map +1 -0
- package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.d.ts +7 -0
- package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.js +32 -0
- package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.js.map +1 -0
- package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.d.ts +21 -0
- package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.js +83 -0
- package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.js.map +1 -0
- package/lib/stories/StorybookWrappers/index.d.ts +3 -0
- package/lib/stories/StorybookWrappers/index.js +20 -0
- package/lib/stories/StorybookWrappers/index.js.map +1 -0
- package/lib/stories/StorybookWrappers/populateCallbackForStorybook.d.ts +8 -0
- package/lib/stories/StorybookWrappers/populateCallbackForStorybook.js +46 -0
- package/lib/stories/StorybookWrappers/populateCallbackForStorybook.js.map +1 -0
- package/lib/stories/index.d.ts +1 -0
- package/lib/stories/index.js +18 -0
- package/lib/stories/index.js.map +1 -0
- package/lib/theme/Theme.d.ts +8 -2
- package/lib/theme/Theme.js +8 -2
- package/lib/theme/Theme.js.map +1 -1
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.js +2 -0
- package/lib/theme/index.js.map +1 -0
- package/lib/utils/enableWhen.d.ts +1 -1
- package/lib/utils/enableWhenExpression.d.ts +1 -1
- package/lib/utils/fhirpath.d.ts +1 -1
- package/lib/utils/index.d.ts +5 -3
- package/lib/utils/index.js +4 -3
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/initialise.d.ts +2 -2
- package/lib/utils/initialise.js +1 -1
- package/lib/utils/manageForm.d.ts +45 -0
- package/lib/utils/manageForm.js +101 -0
- package/lib/utils/manageForm.js.map +1 -0
- package/lib/utils/qItem.d.ts +1 -1
- package/lib/utils/questionnaireStoreUtils/extractOtherExtensions.d.ts +1 -1
- package/lib/utils/removeEmptyAnswers.d.ts +1 -1
- package/lib/utils/repopulateIntoResponse.d.ts +6 -0
- package/lib/utils/repopulateIntoResponse.js +11 -0
- package/lib/utils/repopulateIntoResponse.js.map +1 -1
- package/lib/utils/repopulateItems.d.ts +19 -1
- package/lib/utils/repopulateItems.js +23 -0
- package/lib/utils/repopulateItems.js.map +1 -1
- package/lib/utils/tabs.d.ts +2 -2
- package/lib/utils/tabs.js +1 -1
- package/lib/utils/validateQuestionnaire.d.ts +0 -4
- package/lib/utils/validateQuestionnaire.js +9 -5
- package/lib/utils/validateQuestionnaire.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FormComponents/BooleanItem/BooleanField.tsx +11 -9
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +11 -9
- package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +11 -9
- package/src/components/FormComponents/DateTimeItems/index.ts +1 -1
- package/src/components/FormComponents/DateTimeItems/utils/parseDate.ts +5 -0
- package/src/components/FormComponents/GridGroup/GridGroup.tsx +6 -0
- package/src/components/FormComponents/RepeatGroup/RepeatGroup.tsx +6 -0
- package/src/components/FormComponents/RepeatItem/RepeatItem.tsx +5 -0
- package/src/components/FormComponents/SingleItem/SingleItem.tsx +6 -0
- package/src/components/FormComponents/Tables/GroupTable.tsx +6 -0
- package/src/components/FormComponents/index.ts +6 -6
- package/src/components/Renderer/BaseRenderer.tsx +7 -0
- package/src/components/Renderer/SmartFormsRenderer.tsx +34 -11
- package/src/components/Renderer/index.ts +1 -0
- package/src/components/index.ts +10 -2
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useBuildForm.ts +58 -0
- package/src/hooks/useHidden.ts +6 -0
- package/src/hooks/useInitialiseForm.ts +93 -0
- package/src/hooks/{useQueryClient.ts → useRendererQueryClient.ts} +9 -2
- package/src/hooks/useValueSetCodings.ts +1 -0
- package/src/index.ts +59 -96
- package/src/interfaces/calculatedExpression.interface.ts +24 -0
- package/src/interfaces/enableWhen.interface.ts +12 -0
- package/src/interfaces/index.ts +21 -10
- package/src/interfaces/populate.interface.ts +6 -0
- package/src/interfaces/tab.interface.ts +12 -0
- package/src/interfaces/variables.interface.ts +12 -0
- package/src/stores/index.ts +7 -0
- package/src/stores/questionnaireResponseStore.ts +90 -19
- package/src/stores/questionnaireStore.ts +62 -2
- package/src/stores/smartConfigStore.ts +37 -0
- package/src/stores/terminologyServerStore.ts +28 -1
- package/src/stories/{BuildFormButtonForStorybook.tsx → StorybookWrappers/BuildFormButtonForStorybook.tsx} +12 -5
- package/src/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx +70 -0
- package/src/stories/{BuildFormWrapper.tsx → StorybookWrappers/BuildFormWrapperForStorybook.tsx} +11 -12
- package/src/stories/{BuildFormButtonTesterWrapper.tsx → StorybookWrappers/FormValidationTesterWrapperForStorybook.tsx} +22 -19
- package/src/stories/{useBuildFormForStorybook.ts → StorybookWrappers/FormValidationViewerForStorybook.tsx} +7 -16
- package/src/stories/StorybookWrappers/InitialiseFormWrapperForStorybook.tsx +105 -0
- package/src/stories/{PrePopButtonForStorybook.tsx → StorybookWrappers/PrePopButtonForStorybook.tsx} +12 -10
- package/src/stories/{PrePopWrapper.tsx → StorybookWrappers/PrePopWrapperForStorybook.tsx} +22 -14
- package/src/stories/StorybookWrappers/ValidateFormButtonForStorybook.tsx +41 -0
- package/src/stories/StorybookWrappers/index.ts +20 -0
- package/src/stories/{populateCallbackForStorybook.ts → StorybookWrappers/populateCallbackForStorybook.ts} +8 -2
- package/src/stories/assets/questionnaires/QButtonTester.ts +380 -0
- package/src/stories/assets/questionnaires/QValidateTester.ts +118 -0
- package/src/stories/itemTypes/Attachment.stories.tsx +3 -3
- package/src/stories/itemTypes/Boolean.stories.tsx +3 -3
- package/src/stories/itemTypes/Choice.stories.tsx +3 -3
- package/src/stories/itemTypes/Date.stories.tsx +3 -3
- package/src/stories/itemTypes/DateTime.stories.tsx +3 -3
- package/src/stories/itemTypes/Decimal.stories.tsx +3 -3
- package/src/stories/itemTypes/Display.stories.tsx +3 -3
- package/src/stories/itemTypes/Group.stories.tsx +3 -3
- package/src/stories/itemTypes/Integer.stories.tsx +3 -3
- package/src/stories/itemTypes/OpenChoice.stories.tsx +3 -3
- package/src/stories/itemTypes/Quantity.stories.tsx +3 -3
- package/src/stories/itemTypes/Reference.stories.tsx +3 -3
- package/src/stories/itemTypes/String.stories.tsx +3 -3
- package/src/stories/itemTypes/Text.stories.tsx +3 -3
- package/src/stories/itemTypes/Time.stories.tsx +3 -3
- package/src/stories/itemTypes/Url.stories.tsx +3 -3
- package/src/stories/sdc/AdvancedAdditionalDisplayContent.stories.tsx +3 -3
- package/src/stories/sdc/AdvancedControlAppearance.stories.tsx +3 -3
- package/src/stories/sdc/AdvancedOther.stories.tsx +3 -3
- package/src/stories/sdc/AdvancedTextAppearance.stories.tsx +3 -3
- package/src/stories/sdc/BehaviorCalculations.stories.tsx +3 -3
- package/src/stories/sdc/BehaviorChoiceRestriction.stories.tsx +3 -3
- package/src/stories/sdc/BehaviorOther.stories.tsx +3 -3
- package/src/stories/sdc/BehaviorValueConstraints.stories.tsx +3 -3
- package/src/stories/sdc/FormPopulation.stories.tsx +3 -3
- package/src/stories/sdc/ItemControlDisplay.stories.tsx +3 -3
- package/src/stories/sdc/ItemControlGroup.stories.tsx +3 -3
- package/src/stories/sdc/ItemControlQuestion.stories.tsx +3 -3
- package/src/stories/{rebuildForm/BuildFormTesterWrapper.stories.tsx → testing/BuildFormButtonTesterWrapper.stories.tsx} +6 -9
- package/src/stories/testing/PrePopButtonTesterWrapper.stories.tsx +45 -0
- package/src/stories/testing/ValidateFormTesterWrapper.stories.tsx +39 -0
- package/src/tests/enableWhen.test.ts +6 -2
- package/src/theme/Theme.tsx +8 -2
- package/src/theme/index.ts +1 -0
- package/src/utils/enableWhen.ts +1 -1
- package/src/utils/enableWhenExpression.ts +1 -1
- package/src/utils/fhirpath.ts +1 -1
- package/src/utils/index.ts +5 -7
- package/src/utils/initialise.ts +2 -2
- package/src/utils/manageForm.ts +110 -0
- package/src/utils/qItem.ts +1 -1
- package/src/utils/questionnaireStoreUtils/extractOtherExtensions.ts +1 -1
- package/src/utils/removeEmptyAnswers.ts +1 -1
- package/src/utils/repopulateIntoResponse.ts +17 -0
- package/src/utils/repopulateItems.ts +38 -1
- package/src/utils/tabs.ts +2 -2
- package/src/utils/validateQuestionnaire.ts +12 -17
- package/vite.config.ts +1 -1
- package/src/hooks/useInitialiseRenderer.ts +0 -114
- package/src/stories/assets/questionnaires/QBuildFormButtonTester.ts +0 -270
- package/src/stories/populateUtilsForStorybook.ts +0 -545
- package/src/utils/buildForm.ts +0 -23
- /package/.storybook/{preview.ts → preview.tsx} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
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 { default as InitialiseFormWrapperForStorybook } from './InitialiseFormWrapperForStorybook';
|
|
18
|
+
export { default as BuildFormButtonTesterWrapperForStorybook } from './BuildFormButtonTesterWrapperForStorybook';
|
|
19
|
+
export { default as PrePopWrapperForStorybook } from './PrePopWrapperForStorybook';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/stories/StorybookWrappers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,IAAI,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAE,OAAO,IAAI,wCAAwC,EAAE,MAAM,4CAA4C,CAAC;AACjH,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FetchResourceCallback } from '@aehrc/sdc-populate';
|
|
2
|
+
/**
|
|
3
|
+
* Sample callback function to fetch resources from your source server when using populate() or populateQuestionnaire() from @aehrc/sdc-populate.
|
|
4
|
+
* See https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/PrePopWrapperForStorybook.tsx#L50-L59 for usage.
|
|
5
|
+
*
|
|
6
|
+
* @author Sean Fong
|
|
7
|
+
*/
|
|
8
|
+
export declare const fetchResourceCallback: FetchResourceCallback;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 axios from 'axios';
|
|
18
|
+
const ABSOLUTE_URL_REGEX = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
|
|
19
|
+
/**
|
|
20
|
+
* Sample callback function to fetch resources from your source server when using populate() or populateQuestionnaire() from @aehrc/sdc-populate.
|
|
21
|
+
* See https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/StorybookWrappers/PrePopWrapperForStorybook.tsx#L50-L59 for usage.
|
|
22
|
+
*
|
|
23
|
+
* @author Sean Fong
|
|
24
|
+
*/
|
|
25
|
+
export const fetchResourceCallback = (query, requestConfig) => {
|
|
26
|
+
let { clientEndpoint } = requestConfig;
|
|
27
|
+
const { authToken } = requestConfig;
|
|
28
|
+
const headers = {
|
|
29
|
+
Accept: 'application/json;charset=utf-8'
|
|
30
|
+
};
|
|
31
|
+
if (authToken) {
|
|
32
|
+
headers['Authorization'] = `Bearer ${authToken}`;
|
|
33
|
+
}
|
|
34
|
+
if (!clientEndpoint.endsWith('/')) {
|
|
35
|
+
clientEndpoint += '/';
|
|
36
|
+
}
|
|
37
|
+
if (ABSOLUTE_URL_REGEX.test(query)) {
|
|
38
|
+
return axios.get(query, {
|
|
39
|
+
headers: headers
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return axios.get(clientEndpoint + query, {
|
|
43
|
+
headers: headers
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=populateCallbackForStorybook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populateCallbackForStorybook.js","sourceRoot":"","sources":["../../../src/stories/StorybookWrappers/populateCallbackForStorybook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAOlE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,CAC1D,KAAa,EACb,aAA4B,EAC5B,EAAE;IACF,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC;IACvC,MAAM,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC;IAEpC,MAAM,OAAO,GAAQ;QACnB,MAAM,EAAE,gCAAgC;KACzC,CAAC;IAEF,IAAI,SAAS,EAAE;QACb,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,SAAS,EAAE,CAAC;KAClD;IAED,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACjC,cAAc,IAAI,GAAG,CAAC;KACvB;IAED,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QAClC,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE;YACtB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;KACJ;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,cAAc,GAAG,KAAK,EAAE;QACvC,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as InitialiseFormWrapperForStorybook } from './InitialiseFormWrapperForStorybook';
|
|
@@ -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 { default as InitialiseFormWrapperForStorybook } from './InitialiseFormWrapperForStorybook';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,IAAI,iCAAiC,EAAE,MAAM,qCAAqC,CAAC"}
|
package/lib/theme/Theme.d.ts
CHANGED
|
@@ -32,7 +32,13 @@ declare module '@mui/material/styles' {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
export declare const themeOptions: ThemeOptions;
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Default Material UI theme used by the renderer. You can customise your own theme by defining a new ThemeProvider.
|
|
37
|
+
* @see {@link https://mui.com/material-ui/customization/theming/}
|
|
38
|
+
*
|
|
39
|
+
* @author Sean Fong
|
|
40
|
+
*/
|
|
41
|
+
export declare function RendererThemeProvider({ children }: {
|
|
36
42
|
children: ReactNode;
|
|
37
43
|
}): React.JSX.Element;
|
|
38
|
-
export default
|
|
44
|
+
export default RendererThemeProvider;
|
package/lib/theme/Theme.js
CHANGED
|
@@ -26,7 +26,13 @@ export const themeOptions = {
|
|
|
26
26
|
dropdown: `0 0 2px 0 ${alpha(grey[500], 0.24)}, -20px 20px 40px -4px ${alpha(grey[500], 0.24)}`
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Default Material UI theme used by the renderer. You can customise your own theme by defining a new ThemeProvider.
|
|
31
|
+
* @see {@link https://mui.com/material-ui/customization/theming/}
|
|
32
|
+
*
|
|
33
|
+
* @author Sean Fong
|
|
34
|
+
*/
|
|
35
|
+
export function RendererThemeProvider({ children }) {
|
|
30
36
|
const theme = createTheme(themeOptions);
|
|
31
37
|
theme.components = componentsOverride(theme);
|
|
32
38
|
return (React.createElement(StyledEngineProvider, { injectFirst: true },
|
|
@@ -35,5 +41,5 @@ function ThemeProvider({ children }) {
|
|
|
35
41
|
React.createElement(CustomGlobalStyles, null),
|
|
36
42
|
children)));
|
|
37
43
|
}
|
|
38
|
-
export default
|
|
44
|
+
export default RendererThemeProvider;
|
|
39
45
|
//# sourceMappingURL=Theme.js.map
|
package/lib/theme/Theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.js","sourceRoot":"","sources":["../../src/theme/Theme.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,KAAK,EACL,WAAW,EACX,oBAAoB,EACpB,aAAa,IAAI,gBAAgB,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAsC5C,yEAAyE;AAEzE,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;AAE3C,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,OAAO;IACP,KAAK,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE;IAC1B,UAAU;IACV,aAAa,E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-0,0 +1 @@
|
|
|
1
|
+
export { RendererThemeProvider } from './Theme';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { QuestionnaireItemEnableWhen, QuestionnaireResponse, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
2
|
-
import type { EnableWhenItems, EnableWhenRepeatItemProperties, EnableWhenSingleItemProperties } from '../interfaces';
|
|
2
|
+
import type { EnableWhenItems, EnableWhenRepeatItemProperties, EnableWhenSingleItemProperties } from '../interfaces/enableWhen.interface';
|
|
3
3
|
/**
|
|
4
4
|
* Create a linkedQuestionsMap that contains linked items of enableWhen items
|
|
5
5
|
* mapped to an array containing all its respective enableWhen items' linkIds
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Expression, QuestionnaireResponse, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
-
import type { EnableWhenExpressions, EnableWhenRepeatExpression } from '../interfaces';
|
|
2
|
+
import type { EnableWhenExpressions, EnableWhenRepeatExpression } from '../interfaces/enableWhen.interface';
|
|
3
3
|
interface EvaluateInitialEnableWhenExpressionsParams {
|
|
4
4
|
initialResponse: QuestionnaireResponse;
|
|
5
5
|
initialResponseItemMap: Record<string, QuestionnaireResponseItem[]>;
|
package/lib/utils/fhirpath.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Expression, QuestionnaireResponse, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
2
|
import type { CalculatedExpression } from '../interfaces/calculatedExpression.interface';
|
|
3
|
-
import type { EnableWhenExpressions } from '../interfaces';
|
|
3
|
+
import type { EnableWhenExpressions } from '../interfaces/enableWhen.interface';
|
|
4
4
|
interface EvaluateUpdatedExpressionsParams {
|
|
5
5
|
updatedResponse: QuestionnaireResponse;
|
|
6
6
|
updatedResponseItemMap: Record<string, QuestionnaireResponseItem[]>;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export { buildForm, destroyForm, getResponse, removeEmptyAnswersFromResponse } from './manageForm';
|
|
2
|
+
export { initialiseQuestionnaireResponse } from './initialise';
|
|
1
3
|
export { isSpecificItemControl } from './itemControl';
|
|
2
4
|
export { isRepeatItemAndNotCheckbox } from './qItem';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
5
|
+
export type { ItemToRepopulate } from './repopulateItems';
|
|
6
|
+
export { generateItemsToRepopulate } from './repopulateItems';
|
|
7
|
+
export { repopulateResponse } from './repopulateIntoResponse';
|
package/lib/utils/index.js
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
export { buildForm, destroyForm, getResponse, removeEmptyAnswersFromResponse } from './manageForm';
|
|
18
|
+
export { initialiseQuestionnaireResponse } from './initialise';
|
|
17
19
|
export { isSpecificItemControl } from './itemControl';
|
|
18
20
|
export { isRepeatItemAndNotCheckbox } from './qItem';
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export { buildForm } from './buildForm';
|
|
21
|
+
export { generateItemsToRepopulate } from './repopulateItems';
|
|
22
|
+
export { repopulateResponse } from './repopulateIntoResponse';
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Expression, Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
-
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces';
|
|
2
|
+
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
3
3
|
import type { Tabs } from '../interfaces/tab.interface';
|
|
4
4
|
import type { CalculatedExpression } from '../interfaces/calculatedExpression.interface';
|
|
5
5
|
/**
|
|
6
|
-
* Initialise a
|
|
6
|
+
* Initialise a questionnaireResponse from a given questionnaire
|
|
7
7
|
* optionally takes in an existing questionnaireResponse to be initialised
|
|
8
8
|
*
|
|
9
9
|
* @author Sean Fong
|
package/lib/utils/initialise.js
CHANGED
|
@@ -20,7 +20,7 @@ import { assignPopulatedAnswersToEnableWhen } from './enableWhen';
|
|
|
20
20
|
import { evaluateInitialCalculatedExpressions } from './calculatedExpression';
|
|
21
21
|
import { createQuestionnaireResponseItemMap } from './questionnaireResponseStoreUtils/updatableResponseItems';
|
|
22
22
|
/**
|
|
23
|
-
* Initialise a
|
|
23
|
+
* Initialise a questionnaireResponse from a given questionnaire
|
|
24
24
|
* optionally takes in an existing questionnaireResponse to be initialised
|
|
25
25
|
*
|
|
26
26
|
* @author Sean Fong
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
+
import type Client from 'fhirclient/lib/Client';
|
|
3
|
+
/**
|
|
4
|
+
* Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
|
|
5
|
+
* If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
|
|
6
|
+
* There are other optional properties such as applying readOnly, providing a terminology server url and additional variables.
|
|
7
|
+
*
|
|
8
|
+
* @param questionnaire - Questionnaire to be rendered
|
|
9
|
+
* @param questionnaireResponse - Pre-populated/draft/loaded QuestionnaireResponse to be rendered (optional)
|
|
10
|
+
* @param readOnly - Applies read-only mode to all items in the form view
|
|
11
|
+
* @param terminologyServerUrl - Terminology server url to fetch terminology. If not provided, the default terminology server will be used. (optional)
|
|
12
|
+
* @param additionalVariables - Additional key-value pair of SDC variables `Record<name, variable extension>` for testing (optional)
|
|
13
|
+
*
|
|
14
|
+
* @author Sean Fong
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildForm(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, readOnly?: boolean, terminologyServerUrl?: string, additionalVariables?: Record<string, object>): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Destroy the form to clean up the questionnaire and questionnaireResponse stores.
|
|
19
|
+
*
|
|
20
|
+
* @author Sean Fong
|
|
21
|
+
*/
|
|
22
|
+
export declare function destroyForm(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Initialise the FHIRClient object to make further FHIR calls in the renderer.
|
|
25
|
+
* Note that this does not provide pre-population capabilities.
|
|
26
|
+
*
|
|
27
|
+
* @param fhirClient - FHIRClient object to perform further FHIR calls. At the moment it's only used in answerExpressions
|
|
28
|
+
*
|
|
29
|
+
* @author Sean Fong
|
|
30
|
+
*/
|
|
31
|
+
export declare function initialiseFhirClient(fhirClient: Client): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Get the filled QuestionnaireResponse at its current state.
|
|
34
|
+
* If no changes have been made to the form, the initial QuestionnaireResponse is returned.
|
|
35
|
+
*
|
|
36
|
+
* @author Sean Fong
|
|
37
|
+
*/
|
|
38
|
+
export declare function getResponse(): QuestionnaireResponse;
|
|
39
|
+
/**
|
|
40
|
+
* Remove all hidden answers from the filled QuestionnaireResponse.
|
|
41
|
+
* This takes into account enableWhens, enableWhenExpressions, items without item.answer, empty item.answer arrays and empty strings.
|
|
42
|
+
*
|
|
43
|
+
* @author Sean Fong
|
|
44
|
+
*/
|
|
45
|
+
export declare function removeEmptyAnswersFromResponse(questionnaire: Questionnaire, questionnaireResponse: QuestionnaireResponse): QuestionnaireResponse;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { questionnaireResponseStore, questionnaireStore, smartConfigStore } from '../stores';
|
|
11
|
+
import { initialiseQuestionnaireResponse } from './initialise';
|
|
12
|
+
import { removeEmptyAnswers } from './removeEmptyAnswers';
|
|
13
|
+
import { readEncounter, readPatient, readUser } from '../api/smartClient';
|
|
14
|
+
/**
|
|
15
|
+
* Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
|
|
16
|
+
* If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
|
|
17
|
+
* There are other optional properties such as applying readOnly, providing a terminology server url and additional variables.
|
|
18
|
+
*
|
|
19
|
+
* @param questionnaire - Questionnaire to be rendered
|
|
20
|
+
* @param questionnaireResponse - Pre-populated/draft/loaded QuestionnaireResponse to be rendered (optional)
|
|
21
|
+
* @param readOnly - Applies read-only mode to all items in the form view
|
|
22
|
+
* @param terminologyServerUrl - Terminology server url to fetch terminology. If not provided, the default terminology server will be used. (optional)
|
|
23
|
+
* @param additionalVariables - Additional key-value pair of SDC variables `Record<name, variable extension>` for testing (optional)
|
|
24
|
+
*
|
|
25
|
+
* @author Sean Fong
|
|
26
|
+
*/
|
|
27
|
+
export function buildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
// QR is set to undefined here to prevent it from being initialised twice. This is defined like that for backward compatibility purposes.
|
|
30
|
+
yield questionnaireStore
|
|
31
|
+
.getState()
|
|
32
|
+
.buildSourceQuestionnaire(questionnaire, undefined, additionalVariables, terminologyServerUrl);
|
|
33
|
+
const initialisedQuestionnaireResponse = initialiseQuestionnaireResponse(questionnaire, questionnaireResponse);
|
|
34
|
+
questionnaireResponseStore.getState().buildSourceResponse(initialisedQuestionnaireResponse);
|
|
35
|
+
questionnaireStore.getState().updatePopulatedProperties(initialisedQuestionnaireResponse);
|
|
36
|
+
if (readOnly) {
|
|
37
|
+
questionnaireStore.getState().setFormAsReadOnly(readOnly);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Destroy the form to clean up the questionnaire and questionnaireResponse stores.
|
|
43
|
+
*
|
|
44
|
+
* @author Sean Fong
|
|
45
|
+
*/
|
|
46
|
+
export function destroyForm() {
|
|
47
|
+
questionnaireStore.getState().destroySourceQuestionnaire();
|
|
48
|
+
questionnaireResponseStore.getState().destroySourceResponse();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Initialise the FHIRClient object to make further FHIR calls in the renderer.
|
|
52
|
+
* Note that this does not provide pre-population capabilities.
|
|
53
|
+
*
|
|
54
|
+
* @param fhirClient - FHIRClient object to perform further FHIR calls. At the moment it's only used in answerExpressions
|
|
55
|
+
*
|
|
56
|
+
* @author Sean Fong
|
|
57
|
+
*/
|
|
58
|
+
export function initialiseFhirClient(fhirClient) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
smartConfigStore.getState().setClient(fhirClient);
|
|
61
|
+
const patientPromise = readPatient(fhirClient);
|
|
62
|
+
const userPromise = readUser(fhirClient);
|
|
63
|
+
const encounterPromise = readEncounter(fhirClient);
|
|
64
|
+
const [patient, user, encounter] = yield Promise.all([
|
|
65
|
+
patientPromise,
|
|
66
|
+
userPromise,
|
|
67
|
+
encounterPromise
|
|
68
|
+
]);
|
|
69
|
+
smartConfigStore.getState().setPatient(patient);
|
|
70
|
+
smartConfigStore.getState().setUser(user);
|
|
71
|
+
smartConfigStore.getState().setEncounter(encounter);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get the filled QuestionnaireResponse at its current state.
|
|
76
|
+
* If no changes have been made to the form, the initial QuestionnaireResponse is returned.
|
|
77
|
+
*
|
|
78
|
+
* @author Sean Fong
|
|
79
|
+
*/
|
|
80
|
+
export function getResponse() {
|
|
81
|
+
return questionnaireResponseStore.getState().updatableResponse;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Remove all hidden answers from the filled QuestionnaireResponse.
|
|
85
|
+
* This takes into account enableWhens, enableWhenExpressions, items without item.answer, empty item.answer arrays and empty strings.
|
|
86
|
+
*
|
|
87
|
+
* @author Sean Fong
|
|
88
|
+
*/
|
|
89
|
+
export function removeEmptyAnswersFromResponse(questionnaire, questionnaireResponse) {
|
|
90
|
+
const enableWhenIsActivated = questionnaireStore.getState().enableWhenIsActivated;
|
|
91
|
+
const enableWhenItems = questionnaireStore.getState().enableWhenItems;
|
|
92
|
+
const enableWhenExpressions = questionnaireStore.getState().enableWhenExpressions;
|
|
93
|
+
return removeEmptyAnswers({
|
|
94
|
+
questionnaire,
|
|
95
|
+
questionnaireResponse,
|
|
96
|
+
enableWhenIsActivated,
|
|
97
|
+
enableWhenItems,
|
|
98
|
+
enableWhenExpressions
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=manageForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manageForm.js","sourceRoot":"","sources":["../../src/utils/manageForm.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7F,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG1E;;;;;;;;;;;;GAYG;AACH,MAAM,UAAgB,SAAS,CAC7B,aAA4B,EAC5B,qBAA6C,EAC7C,QAAkB,EAClB,oBAA6B,EAC7B,mBAA4C;;QAE5C,yIAAyI;QACzI,MAAM,kBAAkB;aACrB,QAAQ,EAAE;aACV,wBAAwB,CAAC,aAAa,EAAE,SAAS,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,CAAC;QAEjG,MAAM,gCAAgC,GAAG,+BAA+B,CACtE,aAAa,EACb,qBAAqB,CACtB,CAAC;QACF,0BAA0B,CAAC,QAAQ,EAAE,CAAC,mBAAmB,CAAC,gCAAgC,CAAC,CAAC;QAC5F,kBAAkB,CAAC,QAAQ,EAAE,CAAC,yBAAyB,CAAC,gCAAgC,CAAC,CAAC;QAE1F,IAAI,QAAQ,EAAE;YACZ,kBAAkB,CAAC,QAAQ,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;SAC3D;IACH,CAAC;CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,kBAAkB,CAAC,QAAQ,EAAE,CAAC,0BAA0B,EAAE,CAAC;IAC3D,0BAA0B,CAAC,QAAQ,EAAE,CA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
package/lib/utils/qItem.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Questionnaire, QuestionnaireItem } from 'fhir/r4';
|
|
2
|
-
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces';
|
|
2
|
+
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
3
3
|
interface isHiddenByEnableWhensParams {
|
|
4
4
|
linkId: string;
|
|
5
5
|
enableWhenIsActivated: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Questionnaire, QuestionnaireItem, QuestionnaireItemEnableWhen } from 'fhir/r4';
|
|
2
2
|
import type { CalculatedExpression } from '../../interfaces/calculatedExpression.interface';
|
|
3
|
-
import type { EnableWhenExpressions, EnableWhenItems, EnableWhenRepeatItemProperties, EnableWhenSingleItemProperties } from '../../interfaces';
|
|
3
|
+
import type { EnableWhenExpressions, EnableWhenItems, EnableWhenRepeatItemProperties, EnableWhenSingleItemProperties } from '../../interfaces/enableWhen.interface';
|
|
4
4
|
import type { AnswerExpression } from '../../interfaces/answerExpression.interface';
|
|
5
5
|
import type { ValueSetPromise } from '../../interfaces/valueSet.interface';
|
|
6
6
|
import type { Variables } from '../../interfaces/variables.interface';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
2
|
-
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces';
|
|
2
|
+
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
3
3
|
interface removeEmptyAnswersParams {
|
|
4
4
|
questionnaire: Questionnaire;
|
|
5
5
|
questionnaireResponse: QuestionnaireResponse;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
2
2
|
import type { ItemToRepopulate } from './repopulateItems';
|
|
3
|
+
/**
|
|
4
|
+
* Re-populate checked items in the re-population dialog into the current QuestionnaireResponse
|
|
5
|
+
*
|
|
6
|
+
* @author Sean Fong
|
|
7
|
+
*/
|
|
8
|
+
export declare function repopulateResponse(checkedItemsToRepopulate: Record<string, ItemToRepopulate>): QuestionnaireResponse;
|
|
3
9
|
export declare function repopulateItemsIntoResponse(questionnaire: Questionnaire, updatableResponse: QuestionnaireResponse, checkedItemsToRepopulate: Record<string, ItemToRepopulate>): QuestionnaireResponse;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { getQrItemsIndex, mapQItemsIndex } from './mapItem';
|
|
2
2
|
import { isSpecificItemControl } from './itemControl';
|
|
3
|
+
import { questionnaireResponseStore, questionnaireStore } from '../stores';
|
|
4
|
+
/**
|
|
5
|
+
* Re-populate checked items in the re-population dialog into the current QuestionnaireResponse
|
|
6
|
+
*
|
|
7
|
+
* @author Sean Fong
|
|
8
|
+
*/
|
|
9
|
+
export function repopulateResponse(checkedItemsToRepopulate) {
|
|
10
|
+
const sourceQuestionnaire = questionnaireStore.getState().sourceQuestionnaire;
|
|
11
|
+
const updatableResponse = questionnaireResponseStore.getState().updatableResponse;
|
|
12
|
+
return repopulateItemsIntoResponse(sourceQuestionnaire, updatableResponse, checkedItemsToRepopulate);
|
|
13
|
+
}
|
|
3
14
|
export function repopulateItemsIntoResponse(questionnaire, updatableResponse, checkedItemsToRepopulate) {
|
|
4
15
|
var _a;
|
|
5
16
|
if (!questionnaire.item ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repopulateIntoResponse.js","sourceRoot":"","sources":["../../src/utils/repopulateIntoResponse.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"repopulateIntoResponse.js","sourceRoot":"","sources":["../../src/utils/repopulateIntoResponse.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,cAAc,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AAN,MAAM,CAAE,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,EAAE;QACf,OAAO;YACL,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,mBAAmB;SAC1B,CAAC;KACH;IAED,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,MAAM,CACvD,CAAC,OAAkD,EAAE,IAAI,EAAE,EAAE;QAC3D,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,kBAAkB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QACtD,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAEpE,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,SAAS,CAAC;SAClB;QAED,uCACK,SAAS,KACZ,IAAI,EAAE,kBAAkB,CAAC,IAAI,IAC7B;IACJ,CAAC,CAAC,CAAC;IAEH,uCAAY,MAAM,KAAE,IAAI,EAAE,kBAAkB,IAAG;AACjD,CAAC;AAED,SAAS,oBAAoB,CAC3B,KAAwB,EACxB,OAAoC,EACpC,wBAA0D;IAE1D,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEhE,IAAI,CAAC,gBAAgB,EAAE;QACrB,OAAO,OAAO,CAAC;KAChB;IAED,OAAO,gBAAgB,CAAC,UAAU,CAAC;AACrC,CAAC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { Questionnaire, QuestionnaireItem, QuestionnaireResponse, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
2
|
import type { Tabs } from '../interfaces/tab.interface';
|
|
3
|
-
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces';
|
|
3
|
+
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
4
|
+
/**
|
|
5
|
+
* ItemToRepopulate interface
|
|
6
|
+
*
|
|
7
|
+
* @property qItem - The QuestionnaireItem to repopulate
|
|
8
|
+
* @property heading - The heading of the group to repopulate
|
|
9
|
+
* @property newQRItem - The new QuestionnaireResponseItem to replace the old one
|
|
10
|
+
* @property oldQRItem - The old QuestionnaireResponseItem to be replaced
|
|
11
|
+
* @property newQRItems - The new QuestionnaireResponseItems to replace the old ones
|
|
12
|
+
* @property oldQRItems - The old QuestionnaireResponseItems to be replaced
|
|
13
|
+
*
|
|
14
|
+
* @author Sean Fong
|
|
15
|
+
*/
|
|
4
16
|
export interface ItemToRepopulate {
|
|
5
17
|
qItem: QuestionnaireItem | null;
|
|
6
18
|
heading: string | null;
|
|
@@ -18,5 +30,11 @@ interface getItemsToRepopulateParams {
|
|
|
18
30
|
enableWhenItems: EnableWhenItems;
|
|
19
31
|
enableWhenExpressions: EnableWhenExpressions;
|
|
20
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Compare latest data from the server with the current QuestionnaireResponse and decide items to re-populate
|
|
35
|
+
*
|
|
36
|
+
* @author Sean Fong
|
|
37
|
+
*/
|
|
38
|
+
export declare function generateItemsToRepopulate(populatedResponse: QuestionnaireResponse): Record<string, ItemToRepopulate>;
|
|
21
39
|
export declare function getItemsToRepopulate(params: getItemsToRepopulateParams): Record<string, ItemToRepopulate>;
|
|
22
40
|
export {};
|
|
@@ -19,6 +19,29 @@ import { containsTabs, isTabContainer } from './tabs';
|
|
|
19
19
|
import { getShortText, isSpecificItemControl } from './itemControl';
|
|
20
20
|
import { getQrItemsIndex, mapQItemsIndex } from './mapItem';
|
|
21
21
|
import { isHiddenByEnableWhen } from './qItem';
|
|
22
|
+
import { questionnaireResponseStore, questionnaireStore } from '../stores';
|
|
23
|
+
/**
|
|
24
|
+
* Compare latest data from the server with the current QuestionnaireResponse and decide items to re-populate
|
|
25
|
+
*
|
|
26
|
+
* @author Sean Fong
|
|
27
|
+
*/
|
|
28
|
+
export function generateItemsToRepopulate(populatedResponse) {
|
|
29
|
+
const sourceQuestionnaire = questionnaireStore.getState().sourceQuestionnaire;
|
|
30
|
+
const tabs = questionnaireStore.getState().tabs;
|
|
31
|
+
const updatableResponse = questionnaireResponseStore.getState().updatableResponse;
|
|
32
|
+
const enableWhenIsActivated = questionnaireStore.getState().enableWhenIsActivated;
|
|
33
|
+
const enableWhenItems = questionnaireStore.getState().enableWhenItems;
|
|
34
|
+
const enableWhenExpressions = questionnaireStore.getState().enableWhenExpressions;
|
|
35
|
+
return getItemsToRepopulate({
|
|
36
|
+
sourceQuestionnaire,
|
|
37
|
+
tabs,
|
|
38
|
+
populatedResponse,
|
|
39
|
+
updatableResponse,
|
|
40
|
+
enableWhenIsActivated,
|
|
41
|
+
enableWhenItems,
|
|
42
|
+
enableWhenExpressions
|
|
43
|
+
});
|
|
44
|
+
}
|
|
22
45
|
export function getItemsToRepopulate(params) {
|
|
23
46
|
var _a;
|
|
24
47
|
const { sourceQuestionnaire, tabs, populatedResponse, updatableResponse, enableWhenIsActivated, enableWhenItems, enableWhenExpressions } = params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repopulateItems.js","sourceRoot":"","sources":["../../src/utils/repopulateItems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"repopulateItems.js","sourceRoot":"","sources":["../../src/utils/repopulateItems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GA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EAAE;YACpD,qBAAqB,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;SACrD;aAAM;YACL,mBAAmB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;SAC9C;KACF;IAED,MAAM,+BAA+B,GAAG,CAAC,GAAG,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,2CAA2C;IAC3C,IAAI,+BAA+B,CAAC,MAAM,KAAK,CAAC,EAAE;QAChD,OAAO,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACvC,OAAO;KACR;IAED,iDAAiD;IACjD,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,SAAS,GAAG;QAC1C,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,+BAA+B;KACtC,CAAC;IACF,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,SAAS,GAAG;QAC1C,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,mBAAmB;KAC1B,CAAC;AACJ,CAAC"}
|
package/lib/utils/tabs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Tabs } from '../interfaces/tab.interface';
|
|
2
|
-
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces';
|
|
2
|
+
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
3
3
|
import type { QuestionnaireItem } from 'fhir/r4';
|
|
4
4
|
export declare function getFirstVisibleTab(tabs: Tabs, enableWhenItems: EnableWhenItems, enableWhenExpressions: EnableWhenExpressions): number;
|
|
5
5
|
/**
|
|
@@ -29,7 +29,7 @@ export declare function getTabbedItems(items: QuestionnaireItem[]): Questionnair
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function isTab(item: QuestionnaireItem): boolean;
|
|
31
31
|
/**
|
|
32
|
-
* Create a <linkId, {isComplete: boolean}
|
|
32
|
+
* Create a `Record<linkId, {isComplete: boolean}>` key-value pair for all tabbed items in a qItem array
|
|
33
33
|
*
|
|
34
34
|
* @author Sean Fong
|
|
35
35
|
*/
|