@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
|
@@ -1,2 +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
|
+
*/
|
|
1
17
|
export {};
|
|
2
18
|
//# sourceMappingURL=calculatedExpression.interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculatedExpression.interface.js","sourceRoot":"","sources":["../../src/interfaces/calculatedExpression.interface.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"calculatedExpression.interface.js","sourceRoot":"","sources":["../../src/interfaces/calculatedExpression.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { QuestionnaireItem, QuestionnaireItemEnableWhen, QuestionnaireResponseItemAnswer } from 'fhir/r4';
|
|
2
|
+
/**
|
|
3
|
+
* EnableWhenExpressions interface
|
|
4
|
+
*
|
|
5
|
+
* @property singleExpressions - Key-value pair of non-repeat group enableWhen expressions `Record<linkId, enableWhenExpression properties>`
|
|
6
|
+
* @property repeatExpressions - Key-value pair of repeat group enableWhen expressions `Record<linkId, enableWhenExpression properties>`
|
|
7
|
+
*/
|
|
2
8
|
export interface EnableWhenExpressions {
|
|
3
9
|
singleExpressions: Record<string, EnableWhenSingleExpression>;
|
|
4
10
|
repeatExpressions: Record<string, EnableWhenRepeatExpression>;
|
|
@@ -12,6 +18,12 @@ export interface EnableWhenRepeatExpression {
|
|
|
12
18
|
parentLinkId: string;
|
|
13
19
|
enabledIndexes: boolean[];
|
|
14
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* EnableWhenItems interface
|
|
23
|
+
*
|
|
24
|
+
* @property singleItems - Key-value pair of non-repeat group enableWhen items `Record<linkId, enableWhen properties>`
|
|
25
|
+
* @property repeatItems - Key-value pair of repeat group enableWhen items `Record<linkId, enableWhen properties>`
|
|
26
|
+
*/
|
|
15
27
|
export interface EnableWhenItems {
|
|
16
28
|
singleItems: Record<string, EnableWhenSingleItemProperties>;
|
|
17
29
|
repeatItems: Record<string, EnableWhenRepeatItemProperties>;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export type { Tab, Tabs } from './tab.interface';
|
|
2
|
+
export type { Variables, VariableXFhirQuery } from './variables.interface';
|
|
3
|
+
export type { LaunchContext } from './populate.interface';
|
|
4
|
+
export type { EnableWhenItems, EnableWhenExpressions } from './enableWhen.interface';
|
package/lib/interfaces/index.js
CHANGED
|
@@ -1,2 +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
|
+
*/
|
|
1
17
|
export {};
|
|
2
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Coding, Expression, Extension, Reference } from 'fhir/r4';
|
|
2
|
+
/**
|
|
3
|
+
* LaunchContext interface
|
|
4
|
+
*
|
|
5
|
+
* @property url - Launch context URL
|
|
6
|
+
* @property extension - Possible contents of the launch context as an array of extensions
|
|
7
|
+
*/
|
|
2
8
|
export interface LaunchContext extends Extension {
|
|
3
9
|
url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext';
|
|
4
10
|
extension: LaunchContextExtensions;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repopulateItems.interface.js","sourceRoot":"","sources":["../../src/interfaces/repopulateItems.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tab interface
|
|
3
|
+
*
|
|
4
|
+
* @property tabIndex - The index of the tab
|
|
5
|
+
* @property isComplete - Whether the tab is marked as complete
|
|
6
|
+
* @property isHidden - Whether the tab is hidden
|
|
7
|
+
*/
|
|
1
8
|
export type Tab = {
|
|
2
9
|
tabIndex: number;
|
|
3
10
|
isComplete: boolean;
|
|
4
11
|
isHidden: boolean;
|
|
5
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Key-value pair of tabs `Record<linkId, Tab>`
|
|
15
|
+
*/
|
|
6
16
|
export type Tabs = Record<string, Tab>;
|
|
@@ -1,2 +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
|
+
*/
|
|
1
17
|
export {};
|
|
2
18
|
//# sourceMappingURL=tab.interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.interface.js","sourceRoot":"","sources":["../../src/interfaces/tab.interface.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"tab.interface.js","sourceRoot":"","sources":["../../src/interfaces/tab.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { Expression, FhirResource } from 'fhir/r4';
|
|
2
|
+
/**
|
|
3
|
+
* Variables interface
|
|
4
|
+
*
|
|
5
|
+
* @property fhirPathVariables - Key-value pair of FHIRPath variable expressions in a Questionnaire item `Record<linkId, array of FHIRPath expressions>`
|
|
6
|
+
* @property xFhirQueryVariables - Key-value pair of x-fhir-query variables `Record<variable name, x-fhir-query variable properties>`
|
|
7
|
+
*/
|
|
2
8
|
export interface Variables {
|
|
3
9
|
fhirPathVariables: Record<string, Expression[]>;
|
|
4
10
|
xFhirQueryVariables: Record<string, VariableXFhirQuery>;
|
|
5
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* VariableXFhirQuery interface
|
|
14
|
+
*
|
|
15
|
+
* @property valueExpression - FHIRPath Expression of the variable
|
|
16
|
+
* @property result - FHIR resource result of the executed query
|
|
17
|
+
*/
|
|
6
18
|
export interface VariableXFhirQuery {
|
|
7
19
|
valueExpression: Expression;
|
|
8
20
|
result?: FhirResource;
|
package/lib/stores/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
export type { QuestionnaireStoreType } from './questionnaireStore';
|
|
1
2
|
export { questionnaireStore, useQuestionnaireStore } from './questionnaireStore';
|
|
3
|
+
export type { QuestionnaireResponseStoreType } from './questionnaireResponseStore';
|
|
2
4
|
export { questionnaireResponseStore, useQuestionnaireResponseStore } from './questionnaireResponseStore';
|
|
5
|
+
export type { SmartConfigStoreType } from './smartConfigStore';
|
|
3
6
|
export { smartConfigStore, useSmartConfigStore } from './smartConfigStore';
|
|
7
|
+
export type { TerminologyServerStoreType } from './terminologyServerStore';
|
|
4
8
|
export { terminologyServerStore, useTerminologyServerStore } from './terminologyServerStore';
|
package/lib/stores/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAGjF,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG3E,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import type { OperationOutcome, Questionnaire, QuestionnaireResponse, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
2
|
import type { Diff } from 'deep-diff';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* QuestionnaireResponseStore properties and methods
|
|
5
|
+
* Properties can be accessed for fine-grain details.
|
|
6
|
+
* Methods are usually used internally, using them from an external source is not recommended.
|
|
7
|
+
*
|
|
8
|
+
* @property sourceResponse - The original response created when the form is first initialised i.e. empty, pre-populated, opened saved draft
|
|
9
|
+
* @property updatableResponse - The current state of the response that is being updated via form fields
|
|
10
|
+
* @property updatableResponseItems - Key-value pair of updatableResponse items `Record<linkId, QR.item(s)>`
|
|
11
|
+
* @property formChangesHistory - Array of form changes history in the form of deep-diff objects
|
|
12
|
+
* @property invalidItems - Key-value pair of invalid items based on defined value constraints in the questionnaire `Record<linkId, OperationOutcome>`
|
|
13
|
+
* @property responseIsValid - Whether there are any invalid items in the response
|
|
14
|
+
* @method validateQuestionnaire - Used to validate the questionnaire response based on the questionnaire
|
|
15
|
+
* @method buildSourceResponse - Used to build the source response when the form is first initialised
|
|
16
|
+
* @method setUpdatableResponseAsPopulated - Used to set a pre-populated response as the current response
|
|
17
|
+
* @method updateResponse - Used to update the current response
|
|
18
|
+
* @method setUpdatableResponseAsSaved - Used to set a saved response as the current response
|
|
19
|
+
* @method setUpdatableResponseAsEmpty - Used to set an empty response as the current response
|
|
20
|
+
* @method destroySourceResponse - Used to destroy the source response and reset all properties
|
|
21
|
+
*
|
|
22
|
+
* @author Sean Fong
|
|
23
|
+
*/
|
|
24
|
+
export interface QuestionnaireResponseStoreType {
|
|
4
25
|
sourceResponse: QuestionnaireResponse;
|
|
5
26
|
updatableResponse: QuestionnaireResponse;
|
|
6
27
|
updatableResponseItems: Record<string, QuestionnaireResponseItem[]>;
|
|
@@ -15,7 +36,22 @@ interface QuestionnaireResponseStoreType {
|
|
|
15
36
|
setUpdatableResponseAsEmpty: (clearedResponse: QuestionnaireResponse) => void;
|
|
16
37
|
destroySourceResponse: () => void;
|
|
17
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* QuestionnaireResponse state management store which contains all properties and methods to manage the state of the questionnaireResponse.
|
|
41
|
+
* This is the vanilla version of the store which can be used in non-React environments.
|
|
42
|
+
* @see {QuestionnaireResponseStoreType} for available properties and methods.
|
|
43
|
+
*
|
|
44
|
+
* @author Sean Fong
|
|
45
|
+
*/
|
|
18
46
|
export declare const questionnaireResponseStore: import("zustand/vanilla").StoreApi<QuestionnaireResponseStoreType>;
|
|
47
|
+
/**
|
|
48
|
+
* QuestionnaireResponse state management store which contains all properties and methods to manage the state of the questionnaire.
|
|
49
|
+
* This is the React version of the store which can be used as React hooks in React functional components.
|
|
50
|
+
* @see {QuestionnaireResponseStoreType} for available properties and methods.
|
|
51
|
+
* @see {questionnaireResponseStore} for the vanilla store.
|
|
52
|
+
*
|
|
53
|
+
* @author Sean Fong
|
|
54
|
+
*/
|
|
19
55
|
export declare const useQuestionnaireResponseStore: import("zustand/vanilla").StoreApi<QuestionnaireResponseStoreType> & {
|
|
20
56
|
use: {
|
|
21
57
|
sourceResponse: () => QuestionnaireResponse;
|
|
@@ -33,4 +69,3 @@ export declare const useQuestionnaireResponseStore: import("zustand/vanilla").St
|
|
|
33
69
|
destroySourceResponse: () => () => void;
|
|
34
70
|
};
|
|
35
71
|
};
|
|
36
|
-
export {};
|
|
@@ -22,6 +22,13 @@ import { createSelectors } from './selector';
|
|
|
22
22
|
import { validateQuestionnaire } from '../utils/validateQuestionnaire';
|
|
23
23
|
import { questionnaireStore } from './questionnaireStore';
|
|
24
24
|
import { createQuestionnaireResponseItemMap } from '../utils/questionnaireResponseStoreUtils/updatableResponseItems';
|
|
25
|
+
/**
|
|
26
|
+
* QuestionnaireResponse state management store which contains all properties and methods to manage the state of the questionnaireResponse.
|
|
27
|
+
* This is the vanilla version of the store which can be used in non-React environments.
|
|
28
|
+
* @see {QuestionnaireResponseStoreType} for available properties and methods.
|
|
29
|
+
*
|
|
30
|
+
* @author Sean Fong
|
|
31
|
+
*/
|
|
25
32
|
export const questionnaireResponseStore = createStore()((set, get) => ({
|
|
26
33
|
sourceResponse: cloneDeep(emptyResponse),
|
|
27
34
|
updatableResponse: cloneDeep(emptyResponse),
|
|
@@ -30,15 +37,9 @@ export const questionnaireResponseStore = createStore()((set, get) => ({
|
|
|
30
37
|
invalidItems: {},
|
|
31
38
|
responseIsValid: true,
|
|
32
39
|
validateQuestionnaire: (questionnaire, updatedResponse) => {
|
|
33
|
-
const enableWhenIsActivated = questionnaireStore.getState().enableWhenIsActivated;
|
|
34
|
-
const enableWhenItems = questionnaireStore.getState().enableWhenItems;
|
|
35
|
-
const enableWhenExpressions = questionnaireStore.getState().enableWhenExpressions;
|
|
36
40
|
const updatedInvalidItems = validateQuestionnaire({
|
|
37
41
|
questionnaire,
|
|
38
|
-
questionnaireResponse: updatedResponse
|
|
39
|
-
enableWhenIsActivated,
|
|
40
|
-
enableWhenItems,
|
|
41
|
-
enableWhenExpressions
|
|
42
|
+
questionnaireResponse: updatedResponse
|
|
42
43
|
});
|
|
43
44
|
set(() => ({
|
|
44
45
|
invalidItems: updatedInvalidItems,
|
|
@@ -46,47 +47,96 @@ export const questionnaireResponseStore = createStore()((set, get) => ({
|
|
|
46
47
|
}));
|
|
47
48
|
},
|
|
48
49
|
buildSourceResponse: (questionnaireResponse) => {
|
|
50
|
+
const sourceQuestionnaire = questionnaireStore.getState().sourceQuestionnaire;
|
|
51
|
+
const initialInvalidItems = validateQuestionnaire({
|
|
52
|
+
questionnaire: sourceQuestionnaire,
|
|
53
|
+
questionnaireResponse: questionnaireResponse
|
|
54
|
+
});
|
|
49
55
|
set(() => ({
|
|
50
56
|
sourceResponse: questionnaireResponse,
|
|
51
57
|
updatableResponse: questionnaireResponse,
|
|
52
|
-
updatableResponseItems: createQuestionnaireResponseItemMap(questionnaireResponse)
|
|
58
|
+
updatableResponseItems: createQuestionnaireResponseItemMap(questionnaireResponse),
|
|
59
|
+
invalidItems: initialInvalidItems,
|
|
60
|
+
responseIsValid: Object.keys(initialInvalidItems).length === 0
|
|
53
61
|
}));
|
|
54
62
|
},
|
|
55
63
|
setUpdatableResponseAsPopulated: (populatedResponse) => {
|
|
56
64
|
var _a;
|
|
65
|
+
const sourceQuestionnaire = questionnaireStore.getState().sourceQuestionnaire;
|
|
57
66
|
const formChanges = (_a = diff(get().updatableResponse, populatedResponse)) !== null && _a !== void 0 ? _a : null;
|
|
67
|
+
const updatedInvalidItems = validateQuestionnaire({
|
|
68
|
+
questionnaire: sourceQuestionnaire,
|
|
69
|
+
questionnaireResponse: populatedResponse
|
|
70
|
+
});
|
|
58
71
|
set(() => ({
|
|
59
72
|
updatableResponse: populatedResponse,
|
|
60
73
|
updatableResponseItems: createQuestionnaireResponseItemMap(populatedResponse),
|
|
61
|
-
formChangesHistory: [...get().formChangesHistory, formChanges]
|
|
74
|
+
formChangesHistory: [...get().formChangesHistory, formChanges],
|
|
75
|
+
invalidItems: updatedInvalidItems,
|
|
76
|
+
responseIsValid: Object.keys(updatedInvalidItems).length === 0
|
|
62
77
|
}));
|
|
63
78
|
},
|
|
64
79
|
updateResponse: (updatedResponse) => {
|
|
65
80
|
var _a;
|
|
81
|
+
const sourceQuestionnaire = questionnaireStore.getState().sourceQuestionnaire;
|
|
66
82
|
const formChanges = (_a = diff(get().updatableResponse, updatedResponse)) !== null && _a !== void 0 ? _a : null;
|
|
83
|
+
const updatedInvalidItems = validateQuestionnaire({
|
|
84
|
+
questionnaire: sourceQuestionnaire,
|
|
85
|
+
questionnaireResponse: updatedResponse
|
|
86
|
+
});
|
|
67
87
|
set(() => ({
|
|
68
88
|
updatableResponse: updatedResponse,
|
|
69
89
|
updatableResponseItems: createQuestionnaireResponseItemMap(updatedResponse),
|
|
70
|
-
formChangesHistory: [...get().formChangesHistory, formChanges]
|
|
90
|
+
formChangesHistory: [...get().formChangesHistory, formChanges],
|
|
91
|
+
invalidItems: updatedInvalidItems,
|
|
92
|
+
responseIsValid: Object.keys(updatedInvalidItems).length === 0
|
|
93
|
+
}));
|
|
94
|
+
},
|
|
95
|
+
setUpdatableResponseAsSaved: (savedResponse) => {
|
|
96
|
+
const sourceQuestionnaire = questionnaireStore.getState().sourceQuestionnaire;
|
|
97
|
+
const updatedInvalidItems = validateQuestionnaire({
|
|
98
|
+
questionnaire: sourceQuestionnaire,
|
|
99
|
+
questionnaireResponse: savedResponse
|
|
100
|
+
});
|
|
101
|
+
set(() => ({
|
|
102
|
+
sourceResponse: savedResponse,
|
|
103
|
+
updatableResponse: savedResponse,
|
|
104
|
+
updatableResponseItems: createQuestionnaireResponseItemMap(savedResponse),
|
|
105
|
+
formChangesHistory: [],
|
|
106
|
+
invalidItems: updatedInvalidItems,
|
|
107
|
+
responseIsValid: Object.keys(updatedInvalidItems).length === 0
|
|
108
|
+
}));
|
|
109
|
+
},
|
|
110
|
+
setUpdatableResponseAsEmpty: (clearedResponse) => {
|
|
111
|
+
const sourceQuestionnaire = questionnaireStore.getState().sourceQuestionnaire;
|
|
112
|
+
const updatedInvalidItems = validateQuestionnaire({
|
|
113
|
+
questionnaire: sourceQuestionnaire,
|
|
114
|
+
questionnaireResponse: clearedResponse
|
|
115
|
+
});
|
|
116
|
+
set(() => ({
|
|
117
|
+
updatableResponse: clearedResponse,
|
|
118
|
+
updatableResponseItems: createQuestionnaireResponseItemMap(clearedResponse),
|
|
119
|
+
formChangesHistory: [],
|
|
120
|
+
invalidItems: updatedInvalidItems,
|
|
121
|
+
responseIsValid: Object.keys(updatedInvalidItems).length === 0
|
|
71
122
|
}));
|
|
72
123
|
},
|
|
73
|
-
setUpdatableResponseAsSaved: (savedResponse) => set(() => ({
|
|
74
|
-
sourceResponse: savedResponse,
|
|
75
|
-
updatableResponse: savedResponse,
|
|
76
|
-
updatableResponseItems: createQuestionnaireResponseItemMap(savedResponse),
|
|
77
|
-
formChangesHistory: []
|
|
78
|
-
})),
|
|
79
|
-
setUpdatableResponseAsEmpty: (clearedResponse) => set(() => ({
|
|
80
|
-
updatableResponse: clearedResponse,
|
|
81
|
-
updatableResponseItems: createQuestionnaireResponseItemMap(clearedResponse),
|
|
82
|
-
formChangesHistory: []
|
|
83
|
-
})),
|
|
84
124
|
destroySourceResponse: () => set(() => ({
|
|
85
125
|
sourceResponse: cloneDeep(emptyResponse),
|
|
86
126
|
updatableResponse: cloneDeep(emptyResponse),
|
|
87
127
|
updatableResponseItems: createQuestionnaireResponseItemMap(cloneDeep(emptyResponse)),
|
|
88
|
-
formChangesHistory: []
|
|
128
|
+
formChangesHistory: [],
|
|
129
|
+
invalidItems: {},
|
|
130
|
+
responseIsValid: true
|
|
89
131
|
}))
|
|
90
132
|
}));
|
|
133
|
+
/**
|
|
134
|
+
* QuestionnaireResponse state management store which contains all properties and methods to manage the state of the questionnaire.
|
|
135
|
+
* This is the React version of the store which can be used as React hooks in React functional components.
|
|
136
|
+
* @see {QuestionnaireResponseStoreType} for available properties and methods.
|
|
137
|
+
* @see {questionnaireResponseStore} for the vanilla store.
|
|
138
|
+
*
|
|
139
|
+
* @author Sean Fong
|
|
140
|
+
*/
|
|
91
141
|
export const useQuestionnaireResponseStore = createSelectors(questionnaireResponseStore);
|
|
92
142
|
//# sourceMappingURL=questionnaireResponseStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaireResponseStore.js","sourceRoot":"","sources":["../../src/stores/questionnaireResponseStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kCAAkC,EAAE,MAAM,iEAAiE,CAAC;
|
|
1
|
+
{"version":3,"file":"questionnaireResponseStore.js","sourceRoot":"","sources":["../../src/stores/questionnaireResponseStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kCAAkC,EAAE,MA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,cAAc,EAAE,SAAS,CAAC,aAAa,CAAC;QACxC,iBAAiB,EAAE,SAAS,CAAC,aAAa,CAAC;QAC3C,sBAAsB,EAAE,kCAAkC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACpF,kBAAkB,EAAE,EAAE;QACtB,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC;CACN,CAAC,CACH,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,eAAe,CAAC,0BAA0B,CAAC,CAAC"}
|
|
@@ -2,10 +2,50 @@ import type { Coding, Questionnaire, QuestionnaireResponse, QuestionnaireRespons
|
|
|
2
2
|
import type { Variables } from '../interfaces/variables.interface';
|
|
3
3
|
import type { LaunchContext } from '../interfaces/populate.interface';
|
|
4
4
|
import type { CalculatedExpression } from '../interfaces/calculatedExpression.interface';
|
|
5
|
-
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces';
|
|
5
|
+
import type { EnableWhenExpressions, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
6
6
|
import type { AnswerExpression } from '../interfaces/answerExpression.interface';
|
|
7
7
|
import type { Tabs } from '../interfaces/tab.interface';
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* QuestionnaireStore properties and methods
|
|
10
|
+
* Properties can be accessed for fine-grain details.
|
|
11
|
+
* Methods are usually used internally, using them from an external source is not recommended.
|
|
12
|
+
*
|
|
13
|
+
* @property sourceQuestionnaire - FHIR R4 Questionnaire to render
|
|
14
|
+
* @property itemTypes - Key-value pair of item types `Record<linkId, item.type>`
|
|
15
|
+
* @property tabs - Key-value pair of tabs `Record<linkId, Tab>`
|
|
16
|
+
* @property currentTabIndex - Index of the current tab
|
|
17
|
+
* @property variables - Questionnaire variables object containing FHIRPath and x-fhir-query variables
|
|
18
|
+
* @property launchContexts - Key-value pair of launch contexts `Record<launch context name, launch context properties>`
|
|
19
|
+
* @property enableWhenItems - EnableWhenItems object containing enableWhen items and their linked questions
|
|
20
|
+
* @property enableWhenLinkedQuestions - Key-value pair of linked questions to enableWhen items `Record<linkId, linkIds of linked questions>`
|
|
21
|
+
* @property enableWhenIsActivated - Flag to turn enableWhen checks on/off
|
|
22
|
+
* @property enableWhenExpressions - EnableWhenExpressions object containing enableWhen expressions
|
|
23
|
+
* @property calculatedExpressions - Key-value pair of calculated expressions `Record<linkId, array of calculated expression properties>`
|
|
24
|
+
* @property answerExpressions - Key-value pair of answer expressions `Record<linkId, answer expression properties>`
|
|
25
|
+
* @property processedValueSetCodings - Key-value pair of processed value set codings `Record<valueSetUrl, codings>`
|
|
26
|
+
* @property processedValueSetUrls - Key-value pair of contained value set urls `Record<valueSetName, valueSetUrl>`
|
|
27
|
+
* @property cachedValueSetCodings - Key-value pair of cached value set codings `Record<valueSetUrl, codings>`
|
|
28
|
+
* @property fhirPathContext - Key-value pair of evaluated FHIRPath values `Record<variable name, evaluated value(s)>`
|
|
29
|
+
* @property populatedContext - Key-value pair of one-off pre-populated FHIRPath values `Record<variable/launchContext/sourceQueries batch name, evaluated value(s)>`
|
|
30
|
+
* @property focusedLinkId - LinkId of the currently focused item
|
|
31
|
+
* @property readOnly - Flag to set the form to read-only mode
|
|
32
|
+
* @method buildSourceQuestionnaire - Used to build the source questionnaire with the provided questionnaire and optionally questionnaire response, additional variables, terminology server url and readyOnly flag
|
|
33
|
+
* @method destroySourceQuestionnaire - Used to destroy the source questionnaire and reset all properties
|
|
34
|
+
* @method switchTab - Used to switch the current tab index
|
|
35
|
+
* @method markTabAsComplete - Used to mark a tab index as complete
|
|
36
|
+
* @method updateEnableWhenItem - Used to update linked enableWhen items by updating a question with a new answer
|
|
37
|
+
* @method mutateRepeatEnableWhenItems - Used to add or remove instances of repeating enableWhen items
|
|
38
|
+
* @method toggleEnableWhenActivation - Used to toggle enableWhen checks on/off
|
|
39
|
+
* @method updateExpressions - Used to update all SDC expressions based on the updated questionnaire response
|
|
40
|
+
* @method addCodingToCache - Used to add a coding to the cached value set codings
|
|
41
|
+
* @method updatePopulatedProperties - Used to update all SDC expressions based on a pre-populated questionnaire response
|
|
42
|
+
* @method onFocusLinkId - Used to set the focused linkId
|
|
43
|
+
* @method setPopulatedContext - Used to set the populated contexts (launchContext, sourceQueries, x-fhir-query vars) for debugging purposes
|
|
44
|
+
* @method setFormAsReadOnly - Used to set the form as read-only
|
|
45
|
+
*
|
|
46
|
+
* @author Sean Fong
|
|
47
|
+
*/
|
|
48
|
+
export interface QuestionnaireStoreType {
|
|
9
49
|
sourceQuestionnaire: Questionnaire;
|
|
10
50
|
itemTypes: Record<string, string>;
|
|
11
51
|
tabs: Tabs;
|
|
@@ -37,8 +77,24 @@ interface QuestionnaireStoreType {
|
|
|
37
77
|
updatePopulatedProperties: (populatedResponse: QuestionnaireResponse, populatedContext?: Record<string, any>, persistTabIndex?: boolean) => QuestionnaireResponse;
|
|
38
78
|
onFocusLinkId: (linkId: string) => void;
|
|
39
79
|
setPopulatedContext: (newPopulatedContext: Record<string, any>) => void;
|
|
80
|
+
setFormAsReadOnly: (readOnly: boolean) => void;
|
|
40
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Questionnaire state management store which contains all properties and methods to manage the state of the questionnaire.
|
|
84
|
+
* This is the vanilla version of the store which can be used in non-React environments.
|
|
85
|
+
* @see {QuestionnaireStoreType} for available properties and methods.
|
|
86
|
+
*
|
|
87
|
+
* @author Sean Fong
|
|
88
|
+
*/
|
|
41
89
|
export declare const questionnaireStore: import("zustand/vanilla").StoreApi<QuestionnaireStoreType>;
|
|
90
|
+
/**
|
|
91
|
+
* Questionnaire state management store which contains all properties and methods to manage the state of the questionnaire.
|
|
92
|
+
* This is the React version of the store which can be used as React hooks in React functional components.
|
|
93
|
+
* @see {QuestionnaireStoreType} for available properties and methods.
|
|
94
|
+
* @see {questionnaireStore} for the vanilla store.
|
|
95
|
+
*
|
|
96
|
+
* @author Sean Fong
|
|
97
|
+
*/
|
|
42
98
|
export declare const useQuestionnaireStore: import("zustand/vanilla").StoreApi<QuestionnaireStoreType> & {
|
|
43
99
|
use: {
|
|
44
100
|
sourceQuestionnaire: () => Questionnaire;
|
|
@@ -72,6 +128,6 @@ export declare const useQuestionnaireStore: import("zustand/vanilla").StoreApi<Q
|
|
|
72
128
|
updatePopulatedProperties: () => (populatedResponse: QuestionnaireResponse, populatedContext?: Record<string, any>, persistTabIndex?: boolean) => QuestionnaireResponse;
|
|
73
129
|
onFocusLinkId: () => (linkId: string) => void;
|
|
74
130
|
setPopulatedContext: () => (newPopulatedContext: Record<string, any>) => void;
|
|
131
|
+
setFormAsReadOnly: () => (readOnly: boolean) => void;
|
|
75
132
|
};
|
|
76
133
|
};
|
|
77
|
-
export {};
|
|
@@ -36,6 +36,13 @@ import { createSelectors } from './selector';
|
|
|
36
36
|
import { mutateRepeatEnableWhenExpressionInstances } from '../utils/enableWhenExpression';
|
|
37
37
|
import { questionnaireResponseStore } from './questionnaireResponseStore';
|
|
38
38
|
import { createQuestionnaireResponseItemMap } from '../utils/questionnaireResponseStoreUtils/updatableResponseItems';
|
|
39
|
+
/**
|
|
40
|
+
* Questionnaire state management store which contains all properties and methods to manage the state of the questionnaire.
|
|
41
|
+
* This is the vanilla version of the store which can be used in non-React environments.
|
|
42
|
+
* @see {QuestionnaireStoreType} for available properties and methods.
|
|
43
|
+
*
|
|
44
|
+
* @author Sean Fong
|
|
45
|
+
*/
|
|
39
46
|
export const questionnaireStore = createStore()((set, get) => ({
|
|
40
47
|
sourceQuestionnaire: cloneDeep(emptyQuestionnaire),
|
|
41
48
|
itemTypes: {},
|
|
@@ -205,7 +212,18 @@ export const questionnaireStore = createStore()((set, get) => ({
|
|
|
205
212
|
})),
|
|
206
213
|
setPopulatedContext: (newPopulatedContext) => set(() => ({
|
|
207
214
|
populatedContext: newPopulatedContext
|
|
215
|
+
})),
|
|
216
|
+
setFormAsReadOnly: (readOnly) => set(() => ({
|
|
217
|
+
readOnly: readOnly
|
|
208
218
|
}))
|
|
209
219
|
}));
|
|
220
|
+
/**
|
|
221
|
+
* Questionnaire state management store which contains all properties and methods to manage the state of the questionnaire.
|
|
222
|
+
* This is the React version of the store which can be used as React hooks in React functional components.
|
|
223
|
+
* @see {QuestionnaireStoreType} for available properties and methods.
|
|
224
|
+
* @see {questionnaireStore} for the vanilla store.
|
|
225
|
+
*
|
|
226
|
+
* @author Sean Fong
|
|
227
|
+
*/
|
|
210
228
|
export const useQuestionnaireStore = createSelectors(questionnaireStore);
|
|
211
229
|
//# sourceMappingURL=questionnaireStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionnaireStore.js","sourceRoot":"","sources":["../../src/stores/questionnaireStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAa9C,OAAO,EACL,mCAAmC,EACnC,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EACL,oCAAoC,EACpC,oCAAoC,EACrC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,yCAAyC,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,kCAAkC,EAAE,MAAM,iEAAiE,CAAC;
|
|
1
|
+
{"version":3,"file":"questionnaireStore.js","sourceR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C;QAE3F,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;YACT,eAAe,EAAE,sBAAsB;YACvC,yBAAyB,EAAE,gCAAgC;YAC3D,qBAAqB,EAAE,4BAA4B;YACnD,qBAAqB,EAAE,4BAA4B;YACnD,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe;YAC1E,eAAe,EAAE,sBAAsB;YACvC,gBAAgB,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,GAAG,EAAE,CAAC,gBAAgB;SAC7D,CAAC,CAAC,CAAC;QAEJ,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,aAAa,EAAE,CAAC,MAAc,EAAE,EAAE,CAChC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACT,aAAa,EAAE,MAAM;KACtB,CAAC,CAAC;IACL,mBAAmB,EAAE,CAAC,mBAAwC,EAAE,EAAE,CAChE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACT,gBAAgB,EAAE,mBAAmB;KACtC,CAAC,CAAC;IACL,iBAAiB,EAAE,CAAC,QAAiB,EAAE,EAAE,CACvC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACT,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;CACN,CAAC,CAAC,CAAC;AAEJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import type { Encounter, Patient, Practitioner } from 'fhir/r4';
|
|
2
2
|
import type Client from 'fhirclient/lib/Client';
|
|
3
|
+
/**
|
|
4
|
+
* SmartConfigStore properties and methods
|
|
5
|
+
* Properties can be accessed for fine-grain details.
|
|
6
|
+
* Methods are usually used internally, using them from an external source is not recommended.
|
|
7
|
+
*
|
|
8
|
+
* @property client - The FHIRClient object (https://github.com/smart-on-fhir/client-js)
|
|
9
|
+
* @property patient - The patient resource in context
|
|
10
|
+
* @property user - The user resource in context
|
|
11
|
+
* @property encounter - The encounter resource in context
|
|
12
|
+
* @method setClient - Set the FHIRClient object when launching via SMART App Launch
|
|
13
|
+
* @method setPatient - Set the patient resource in context
|
|
14
|
+
* @method setUser - Set the user resource in context
|
|
15
|
+
* @method setEncounter - Set the encounter resource in context
|
|
16
|
+
*
|
|
17
|
+
* @author Sean Fong
|
|
18
|
+
*/
|
|
3
19
|
export interface SmartConfigStoreType {
|
|
4
20
|
client: Client | null;
|
|
5
21
|
patient: Patient | null;
|
|
@@ -10,7 +26,28 @@ export interface SmartConfigStoreType {
|
|
|
10
26
|
setUser: (user: Practitioner) => void;
|
|
11
27
|
setEncounter: (encounter: Encounter) => void;
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Smart Config state management store. This is only used for answerExpressions.
|
|
31
|
+
* It is recommended to manage the state of the FHIRClient, patient, user, and encounter in the parent application, since the renderer doesn't provide pre-population capabilities.
|
|
32
|
+
* Will be deprecated in version 1.0.0.
|
|
33
|
+
*
|
|
34
|
+
* This is the vanilla version of the store which can be used in non-React environments.
|
|
35
|
+
* @see {SmartConfigStoreType} for available properties and methods.
|
|
36
|
+
*
|
|
37
|
+
* @author Sean Fong
|
|
38
|
+
*/
|
|
13
39
|
export declare const smartConfigStore: import("zustand/vanilla").StoreApi<SmartConfigStoreType>;
|
|
40
|
+
/**
|
|
41
|
+
* Smart Config state management store. This is only used for answerExpressions.
|
|
42
|
+
* It is recommended to manage the state of the FHIRClient, patient, user, and encounter in the parent application, since the renderer doesn't provide pre-population capabilities.
|
|
43
|
+
* Will be deprecated in version 1.0.0.
|
|
44
|
+
*
|
|
45
|
+
* This is the React version of the store which can be used as React hooks in React functional components.
|
|
46
|
+
* @see {SmartConfigStoreType} for available properties and methods.
|
|
47
|
+
* @see {smartConfigStore} for the vanilla store.
|
|
48
|
+
*
|
|
49
|
+
* @author Sean Fong
|
|
50
|
+
*/
|
|
14
51
|
export declare const useSmartConfigStore: import("zustand/vanilla").StoreApi<SmartConfigStoreType> & {
|
|
15
52
|
use: {
|
|
16
53
|
client: () => Client | null;
|