@aehrc/smart-forms-renderer 0.9.2 → 0.10.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/.swcrc +11 -0
- package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.js +5 -5
- package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js +1 -1
- package/lib/components/FormComponents/RepeatItem/RemoveItemButton.d.ts +10 -0
- package/lib/components/FormComponents/RepeatItem/RemoveItemButton.js +30 -0
- package/lib/components/FormComponents/RepeatItem/RemoveItemButton.js.map +1 -0
- package/lib/components/FormComponents/RepeatItem/RepeatField.js +2 -2
- package/lib/components/FormComponents/SingleItem/SingleItem.js +2 -2
- package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTable.d.ts +1 -2
- package/lib/components/FormComponents/Tables/GroupTable.js +44 -59
- package/lib/components/FormComponents/Tables/GroupTable.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTableBody.d.ts +17 -0
- package/lib/components/FormComponents/Tables/GroupTableBody.js +48 -0
- package/lib/components/FormComponents/Tables/GroupTableBody.js.map +1 -0
- package/lib/components/FormComponents/Tables/GroupTableRow.d.ts +18 -5
- package/lib/components/FormComponents/Tables/GroupTableRow.js +17 -25
- package/lib/components/FormComponents/Tables/GroupTableRow.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTableRowCells.d.ts +11 -0
- package/lib/components/FormComponents/Tables/GroupTableRowCells.js +57 -0
- package/lib/components/FormComponents/Tables/GroupTableRowCells.js.map +1 -0
- package/lib/components/FormComponents/Tables/GroupTableRows.d.ts +17 -0
- package/lib/components/FormComponents/Tables/GroupTableRows.js +45 -0
- package/lib/components/FormComponents/Tables/GroupTableRows.js.map +1 -0
- package/lib/components/FormComponents/Tables/GroupTableTestRow.d.ts +22 -0
- package/lib/components/FormComponents/Tables/GroupTableTestRow.js +43 -0
- package/lib/components/FormComponents/Tables/GroupTableTestRow.js.map +1 -0
- package/lib/components/FormComponents/Tables/GroupTableView.d.ts +21 -0
- package/lib/components/FormComponents/Tables/GroupTableView.js +65 -0
- package/lib/components/FormComponents/Tables/GroupTableView.js.map +1 -0
- package/lib/components/FormComponents/Tables/RemoveRowButton.d.ts +10 -0
- package/lib/components/FormComponents/Tables/RemoveRowButton.js +32 -0
- package/lib/components/FormComponents/Tables/RemoveRowButton.js.map +1 -0
- package/lib/components/FormComponents/Tables/SelectRowButton.d.ts +7 -0
- package/lib/components/FormComponents/Tables/SelectRowButton.js +26 -0
- package/lib/components/FormComponents/Tables/SelectRowButton.js.map +1 -0
- package/lib/components/FormComponents/Tables/Table.styles.d.ts +8 -0
- package/lib/components/FormComponents/Tables/Table.styles.js +17 -0
- package/lib/components/FormComponents/Tables/Table.styles.js.map +1 -1
- package/lib/components/Renderer/BaseRenderer.js +5 -6
- package/lib/components/Renderer/BaseRenderer.js.map +1 -1
- package/lib/components/Renderer/FormBodyCollapsible.js +4 -4
- package/lib/components/Renderer/FormBodyCollapsible.js.map +1 -1
- package/lib/components/Renderer/FormBodyTabbed.js +3 -3
- package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
- package/lib/components/Tabs/CompleteTabButton.js +2 -2
- package/lib/components/Tabs/CompleteTabButton.js.map +1 -1
- package/lib/components/Tabs/FormBodySingleTab.js +2 -2
- package/lib/components/Tabs/FormBodySingleTab.js.map +1 -1
- package/lib/components/Tabs/FormBodyTabList.js +4 -4
- package/lib/components/Tabs/FormBodyTabList.js.map +1 -1
- package/lib/hooks/useDecimalCalculatedExpression.js +2 -2
- package/lib/hooks/useDecimalCalculatedExpression.js.map +1 -1
- package/lib/hooks/useHidden.js +4 -4
- package/lib/hooks/useHidden.js.map +1 -1
- package/lib/hooks/useInitialiseGroupTable.d.ts +2 -2
- package/lib/hooks/useInitialiseGroupTable.js.map +1 -1
- package/lib/hooks/useInitialiseRenderer.js +11 -14
- package/lib/hooks/useInitialiseRenderer.js.map +1 -1
- package/lib/hooks/useIntegerCalculatedExpression.js +2 -2
- package/lib/hooks/useIntegerCalculatedExpression.js.map +1 -1
- package/lib/hooks/useMinimalStringCalculatedExpression.js +25 -13
- package/lib/hooks/useStringCalculatedExpression.js +2 -2
- package/lib/hooks/useStringCalculatedExpression.js.map +1 -1
- package/lib/hooks/useTerminologyServerQuery.js +3 -4
- package/lib/hooks/useTerminologyServerQuery.js.map +1 -1
- package/lib/hooks/useValueSetCodings.js +10 -12
- package/lib/hooks/useValueSetCodings.js.map +1 -1
- package/lib/index.js +19 -20
- package/lib/index.js.map +1 -1
- package/lib/interfaces/groupTable.interface.d.ts +1 -1
- package/lib/setup-jest.js +1 -0
- package/lib/setup-jest.js.map +1 -0
- package/lib/stores/index.d.ts +4 -3
- package/lib/stores/index.js +4 -3
- package/lib/stores/index.js.map +1 -1
- package/lib/stores/questionnaireResponseStore.d.ts +28 -0
- package/lib/stores/questionnaireResponseStore.js +64 -0
- package/lib/stores/questionnaireResponseStore.js.map +1 -0
- package/lib/stores/questionnaireStore.d.ts +65 -0
- package/lib/stores/questionnaireStore.js +172 -0
- package/lib/stores/questionnaireStore.js.map +1 -0
- package/lib/stores/smartConfigStore.d.ts +25 -0
- package/lib/stores/smartConfigStore.js +30 -0
- package/lib/stores/smartConfigStore.js.map +1 -0
- package/lib/stores/terminologyServerStore.d.ts +14 -0
- package/lib/stores/terminologyServerStore.js +26 -0
- package/lib/stores/terminologyServerStore.js.map +1 -0
- package/lib/stores/useQuestionnaireResponseStore.d.ts +14 -2
- package/lib/stores/useQuestionnaireResponseStore.js +4 -2
- package/lib/stores/useQuestionnaireResponseStore.js.map +1 -1
- package/lib/stores/useQuestionnaireStore.d.ts +30 -2
- package/lib/stores/useQuestionnaireStore.js +4 -2
- package/lib/stores/useQuestionnaireStore.js.map +1 -1
- package/lib/stories/MedicalHistoryTable.stories.js +49 -0
- package/lib/stories/MedicalHistoryTable.stories.js.map +1 -0
- package/lib/stories/SmartFormsRenderer.stories.js +103 -0
- package/lib/stories/SmartFormsRenderer.stories.js.map +1 -0
- package/lib/theme/overrides/Table.d.ts +1 -0
- package/lib/theme/overrides/Table.js +2 -1
- package/lib/theme/overrides/Table.js.map +1 -1
- package/lib/utils/calculatedExpression.js +1 -2
- package/lib/utils/calculatedExpression.js.map +1 -1
- package/lib/utils/groupTable.d.ts +3 -0
- package/lib/utils/groupTable.js +29 -0
- package/lib/utils/groupTable.js.map +1 -0
- package/package.json +10 -5
- package/src/components/FormComponents/GroupItem/NextTabButtonWrapper.tsx +5 -5
- package/src/components/FormComponents/RepeatGroup/DeleteItemButton.tsx +1 -1
- package/src/components/FormComponents/RepeatItem/{DeleteItemButton.tsx → RemoveItemButton.tsx} +4 -4
- package/src/components/FormComponents/RepeatItem/RepeatField.tsx +2 -2
- package/src/components/FormComponents/SingleItem/SingleItem.tsx +2 -2
- package/src/components/FormComponents/Tables/GroupTable.tsx +71 -120
- package/src/components/FormComponents/Tables/GroupTableBody.tsx +116 -0
- package/src/components/FormComponents/Tables/GroupTableRow.tsx +89 -49
- package/src/components/FormComponents/Tables/GroupTableRowCells.tsx +87 -0
- package/src/components/FormComponents/Tables/GroupTableView.tsx +169 -0
- package/src/components/FormComponents/Tables/{DeleteRowButton.tsx → RemoveRowButton.tsx} +7 -7
- package/src/components/FormComponents/Tables/SelectRowButton.tsx +37 -0
- package/src/components/FormComponents/Tables/Table.styles.tsx +25 -0
- package/src/components/Renderer/BaseRenderer.tsx +5 -6
- package/src/components/Renderer/FormBodyCollapsible.tsx +4 -5
- package/src/components/Renderer/FormBodyTabbed.tsx +3 -3
- package/src/components/Tabs/CompleteTabButton.tsx +2 -2
- package/src/components/Tabs/FormBodySingleTab.tsx +2 -3
- package/src/components/Tabs/FormBodyTabList.tsx +4 -4
- package/src/hooks/useDecimalCalculatedExpression.ts +2 -2
- package/src/hooks/useHidden.ts +4 -4
- package/src/hooks/useInitialiseGroupTable.ts +3 -3
- package/src/hooks/useInitialiseRenderer.ts +17 -18
- package/src/hooks/useIntegerCalculatedExpression.ts +2 -2
- package/src/hooks/useStringCalculatedExpression.ts +2 -2
- package/src/hooks/useTerminologyServerQuery.ts +3 -4
- package/src/hooks/useValueSetCodings.ts +10 -12
- package/src/index.ts +19 -20
- package/src/interfaces/groupTable.interface.ts +1 -1
- package/src/stores/index.ts +7 -3
- package/src/stores/questionnaireResponseStore.ts +83 -0
- package/src/stores/{useQuestionnaireStore.ts → questionnaireStore.ts} +7 -6
- package/src/stores/smartConfigStore.ts +45 -0
- package/src/stores/{useTerminologyServerStore.ts → terminologyServerStore.ts} +5 -4
- package/src/stories/MedicalHistoryTable.stories.tsx +61 -0
- package/src/stories/SmartFormsRenderer.stories.ts +15 -5
- package/src/stories/assets/QItems-and-QRItems/QR_GTableMedicalHistory.json +80 -0
- package/src/stories/assets/QItems-and-QRItems/Q_GTableMedicalHistory.json +109 -0
- package/src/stories/assets/Qs-and-QRs/QDev715.json +16081 -0
- package/src/theme/overrides/Table.ts +2 -1
- package/src/utils/calculatedExpression.ts +1 -2
- package/src/utils/groupTable.ts +37 -0
- package/src/stores/useQuestionnaireResponseStore.ts +0 -63
- package/src/stores/useSmartConfigStore.ts +0 -27
- /package/src/stories/assets/{Q715.json → Qs-and-QRs/Q715.json} +0 -0
- /package/src/stories/assets/{QTestGrid.json → Qs-and-QRs/QTestGrid.json} +0 -0
- /package/src/stories/assets/{R715.json → Qs-and-QRs/R715.json} +0 -0
- /package/src/stories/assets/{RTestGrid.json → Qs-and-QRs/RTestGrid.json} +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
import { createStore } from 'zustand/vanilla';
|
|
27
|
+
import { updateItemAnswer } from '../utils/enableWhen';
|
|
28
|
+
import { evaluateUpdatedExpressions } from '../utils/fhirpath';
|
|
29
|
+
import { evaluateInitialCalculatedExpressions, initialiseCalculatedExpressionValues } from '../utils/calculatedExpression';
|
|
30
|
+
import { createQuestionnaireModel } from '../utils/questionnaireStoreUtils/createQuestionaireModel';
|
|
31
|
+
import { initialiseFormFromResponse } from '../utils/initialiseForm';
|
|
32
|
+
import { emptyQuestionnaire, emptyResponse } from '../utils/emptyResource';
|
|
33
|
+
import cloneDeep from 'lodash.clonedeep';
|
|
34
|
+
import { terminologyServerStore } from './terminologyServerStore';
|
|
35
|
+
import { createSelectors } from './selector';
|
|
36
|
+
export const questionnaireStore = createStore()((set, get) => ({
|
|
37
|
+
sourceQuestionnaire: cloneDeep(emptyQuestionnaire),
|
|
38
|
+
itemTypes: {},
|
|
39
|
+
tabs: {},
|
|
40
|
+
currentTabIndex: 0,
|
|
41
|
+
variables: { fhirPathVariables: {}, xFhirQueryVariables: {} },
|
|
42
|
+
launchContexts: {},
|
|
43
|
+
calculatedExpressions: {},
|
|
44
|
+
enableWhenExpressions: {},
|
|
45
|
+
answerExpressions: {},
|
|
46
|
+
enableWhenItems: {},
|
|
47
|
+
enableWhenLinkedQuestions: {},
|
|
48
|
+
enableWhenIsActivated: true,
|
|
49
|
+
processedValueSetCodings: {},
|
|
50
|
+
processedValueSetUrls: {},
|
|
51
|
+
cachedValueSetCodings: {},
|
|
52
|
+
fhirPathContext: {},
|
|
53
|
+
buildSourceQuestionnaire: (questionnaire, questionnaireResponse = cloneDeep(emptyResponse), additionalVariables = {}, terminologyServerUrl = terminologyServerStore.getState().url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
const questionnaireModel = yield createQuestionnaireModel(questionnaire, additionalVariables, terminologyServerUrl);
|
|
55
|
+
const { initialEnableWhenItems, initialEnableWhenLinkedQuestions, initialEnableWhenExpressions, initialCalculatedExpressions, firstVisibleTab, updatedFhirPathContext } = initialiseFormFromResponse({
|
|
56
|
+
questionnaireResponse,
|
|
57
|
+
enableWhenItems: questionnaireModel.enableWhenItems,
|
|
58
|
+
enableWhenExpressions: questionnaireModel.enableWhenExpressions,
|
|
59
|
+
calculatedExpressions: questionnaireModel.calculatedExpressions,
|
|
60
|
+
variablesFhirPath: questionnaireModel.variables.fhirPathVariables,
|
|
61
|
+
tabs: questionnaireModel.tabs,
|
|
62
|
+
fhirPathContext: questionnaireModel.fhirPathContext
|
|
63
|
+
});
|
|
64
|
+
set({
|
|
65
|
+
sourceQuestionnaire: questionnaire,
|
|
66
|
+
itemTypes: questionnaireModel.itemTypes,
|
|
67
|
+
tabs: questionnaireModel.tabs,
|
|
68
|
+
currentTabIndex: firstVisibleTab,
|
|
69
|
+
variables: questionnaireModel.variables,
|
|
70
|
+
launchContexts: questionnaireModel.launchContexts,
|
|
71
|
+
enableWhenItems: initialEnableWhenItems,
|
|
72
|
+
enableWhenLinkedQuestions: initialEnableWhenLinkedQuestions,
|
|
73
|
+
enableWhenExpressions: initialEnableWhenExpressions,
|
|
74
|
+
calculatedExpressions: initialCalculatedExpressions,
|
|
75
|
+
answerExpressions: questionnaireModel.answerExpressions,
|
|
76
|
+
processedValueSetCodings: questionnaireModel.processedValueSetCodings,
|
|
77
|
+
processedValueSetUrls: questionnaireModel.processedValueSetUrls,
|
|
78
|
+
fhirPathContext: updatedFhirPathContext
|
|
79
|
+
});
|
|
80
|
+
}),
|
|
81
|
+
destroySourceQuestionnaire: () => set({
|
|
82
|
+
sourceQuestionnaire: cloneDeep(emptyQuestionnaire),
|
|
83
|
+
itemTypes: {},
|
|
84
|
+
tabs: {},
|
|
85
|
+
currentTabIndex: 0,
|
|
86
|
+
variables: { fhirPathVariables: {}, xFhirQueryVariables: {} },
|
|
87
|
+
launchContexts: {},
|
|
88
|
+
enableWhenItems: {},
|
|
89
|
+
enableWhenLinkedQuestions: {},
|
|
90
|
+
enableWhenExpressions: {},
|
|
91
|
+
calculatedExpressions: {},
|
|
92
|
+
answerExpressions: {},
|
|
93
|
+
processedValueSetCodings: {},
|
|
94
|
+
processedValueSetUrls: {},
|
|
95
|
+
fhirPathContext: {}
|
|
96
|
+
}),
|
|
97
|
+
switchTab: (newTabIndex) => set(() => ({ currentTabIndex: newTabIndex })),
|
|
98
|
+
markTabAsComplete: (tabLinkId) => {
|
|
99
|
+
const tabs = get().tabs;
|
|
100
|
+
set(() => ({
|
|
101
|
+
tabs: Object.assign(Object.assign({}, tabs), { [tabLinkId]: Object.assign(Object.assign({}, tabs[tabLinkId]), { isComplete: !tabs[tabLinkId].isComplete }) })
|
|
102
|
+
}));
|
|
103
|
+
},
|
|
104
|
+
updateEnableWhenItem: (linkId, newAnswer) => {
|
|
105
|
+
const enableWhenLinkedQuestions = get().enableWhenLinkedQuestions;
|
|
106
|
+
const enableWhenItems = get().enableWhenItems;
|
|
107
|
+
if (!enableWhenLinkedQuestions[linkId]) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const itemLinkedQuestions = enableWhenLinkedQuestions[linkId];
|
|
111
|
+
const updatedEnableWhenItems = updateItemAnswer(Object.assign({}, enableWhenItems), itemLinkedQuestions, linkId, newAnswer);
|
|
112
|
+
set(() => ({
|
|
113
|
+
enableWhenItems: updatedEnableWhenItems
|
|
114
|
+
}));
|
|
115
|
+
},
|
|
116
|
+
toggleEnableWhenActivation: (isActivated) => set(() => ({ enableWhenIsActivated: isActivated })),
|
|
117
|
+
updateExpressions: (updatedResponse) => {
|
|
118
|
+
const { isUpdated, updatedEnableWhenExpressions, updatedCalculatedExpressions, updatedFhirPathContext } = evaluateUpdatedExpressions({
|
|
119
|
+
updatedResponse,
|
|
120
|
+
enableWhenExpressions: get().enableWhenExpressions,
|
|
121
|
+
calculatedExpressions: get().calculatedExpressions,
|
|
122
|
+
variablesFhirPath: get().variables.fhirPathVariables,
|
|
123
|
+
existingFhirPathContext: get().fhirPathContext
|
|
124
|
+
});
|
|
125
|
+
if (isUpdated) {
|
|
126
|
+
set(() => ({
|
|
127
|
+
enableWhenExpressions: updatedEnableWhenExpressions,
|
|
128
|
+
calculatedExpressions: updatedCalculatedExpressions,
|
|
129
|
+
fhirPathContext: updatedFhirPathContext
|
|
130
|
+
}));
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
set(() => ({
|
|
134
|
+
fhirPathContext: updatedFhirPathContext
|
|
135
|
+
}));
|
|
136
|
+
},
|
|
137
|
+
addCodingToCache: (valueSetUrl, codings) => set(() => ({
|
|
138
|
+
cachedValueSetCodings: Object.assign(Object.assign({}, get().cachedValueSetCodings), { [valueSetUrl]: codings })
|
|
139
|
+
})),
|
|
140
|
+
updatePopulatedProperties: (populatedResponse, persistTabIndex) => {
|
|
141
|
+
const evaluateInitialCalculatedExpressionsResult = evaluateInitialCalculatedExpressions({
|
|
142
|
+
initialResponse: populatedResponse,
|
|
143
|
+
calculatedExpressions: get().calculatedExpressions,
|
|
144
|
+
variablesFhirPath: get().variables.fhirPathVariables,
|
|
145
|
+
existingFhirPathContext: get().fhirPathContext
|
|
146
|
+
});
|
|
147
|
+
const { initialCalculatedExpressions } = evaluateInitialCalculatedExpressionsResult;
|
|
148
|
+
let updatedFhirPathContext = evaluateInitialCalculatedExpressionsResult.updatedFhirPathContext;
|
|
149
|
+
const updatedResponse = initialiseCalculatedExpressionValues(get().sourceQuestionnaire, populatedResponse, initialCalculatedExpressions);
|
|
150
|
+
const { initialEnableWhenItems, initialEnableWhenLinkedQuestions, initialEnableWhenExpressions, firstVisibleTab } = initialiseFormFromResponse({
|
|
151
|
+
questionnaireResponse: updatedResponse,
|
|
152
|
+
enableWhenItems: get().enableWhenItems,
|
|
153
|
+
enableWhenExpressions: get().enableWhenExpressions,
|
|
154
|
+
calculatedExpressions: initialCalculatedExpressions,
|
|
155
|
+
variablesFhirPath: get().variables.fhirPathVariables,
|
|
156
|
+
tabs: get().tabs,
|
|
157
|
+
fhirPathContext: updatedFhirPathContext
|
|
158
|
+
});
|
|
159
|
+
updatedFhirPathContext = evaluateInitialCalculatedExpressionsResult.updatedFhirPathContext;
|
|
160
|
+
set(() => ({
|
|
161
|
+
enableWhenItems: initialEnableWhenItems,
|
|
162
|
+
enableWhenLinkedQuestions: initialEnableWhenLinkedQuestions,
|
|
163
|
+
enableWhenExpressions: initialEnableWhenExpressions,
|
|
164
|
+
calculatedExpressions: initialCalculatedExpressions,
|
|
165
|
+
currentTabIndex: persistTabIndex ? get().currentTabIndex : firstVisibleTab,
|
|
166
|
+
fhirPathContext: updatedFhirPathContext
|
|
167
|
+
}));
|
|
168
|
+
return updatedResponse;
|
|
169
|
+
}
|
|
170
|
+
}));
|
|
171
|
+
export const useQuestionnaireStore = createSelectors(questionnaireStore);
|
|
172
|
+
//# sourceMappingURL=questionnaireStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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,eAAe,CAAC;IACzB,CAAC;CACF,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Encounter, Patient, Practitioner } from 'fhir/r4';
|
|
2
|
+
import type Client from 'fhirclient/lib/Client';
|
|
3
|
+
export interface SmartConfigStoreType {
|
|
4
|
+
client: Client | null;
|
|
5
|
+
patient: Patient | null;
|
|
6
|
+
user: Practitioner | null;
|
|
7
|
+
encounter: Encounter | null;
|
|
8
|
+
setClient: (client: Client) => void;
|
|
9
|
+
setPatient: (patient: Patient) => void;
|
|
10
|
+
setUser: (user: Practitioner) => void;
|
|
11
|
+
setEncounter: (encounter: Encounter) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const smartConfigStore: import("zustand/vanilla").StoreApi<SmartConfigStoreType>;
|
|
14
|
+
export declare const useSmartConfigStore: import("zustand/vanilla").StoreApi<SmartConfigStoreType> & {
|
|
15
|
+
use: {
|
|
16
|
+
client: () => Client | null;
|
|
17
|
+
patient: () => Patient | null;
|
|
18
|
+
user: () => Practitioner | null;
|
|
19
|
+
encounter: () => Encounter | null;
|
|
20
|
+
setClient: () => (client: Client) => void;
|
|
21
|
+
setPatient: () => (patient: Patient) => void;
|
|
22
|
+
setUser: () => (user: Practitioner) => void;
|
|
23
|
+
setEncounter: () => (encounter: Encounter) => void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { createStore } from 'zustand/vanilla';
|
|
18
|
+
import { createSelectors } from './selector';
|
|
19
|
+
export const smartConfigStore = createStore()((set) => ({
|
|
20
|
+
client: null,
|
|
21
|
+
patient: null,
|
|
22
|
+
user: null,
|
|
23
|
+
encounter: null,
|
|
24
|
+
setClient: (client) => set(() => ({ client: client })),
|
|
25
|
+
setPatient: (patient) => set(() => ({ patient: patient })),
|
|
26
|
+
setUser: (user) => set(() => ({ user: user })),
|
|
27
|
+
setEncounter: (encounter) => set(() => ({ encounter: encounter }))
|
|
28
|
+
}));
|
|
29
|
+
export const useSmartConfigStore = createSelectors(smartConfigStore);
|
|
30
|
+
//# sourceMappingURL=smartConfigStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartConfigStore.js","sourceRoot":"","sources":["../../src/stores/smartConfigStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAa7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,EAAwB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5E,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9D,UAAU,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACnE,OAAO,EAAE,CAAC,IAAkB,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,YAAY,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;CAC9E,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface TerminologyServerStoreType {
|
|
2
|
+
url: string;
|
|
3
|
+
setUrl: (newUrl: string) => void;
|
|
4
|
+
resetUrl: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const terminologyServerStore: import("zustand/vanilla").StoreApi<TerminologyServerStoreType>;
|
|
7
|
+
export declare const useTerminologyServerStore: import("zustand/vanilla").StoreApi<TerminologyServerStoreType> & {
|
|
8
|
+
use: {
|
|
9
|
+
url: () => string;
|
|
10
|
+
setUrl: () => (newUrl: string) => void;
|
|
11
|
+
resetUrl: () => () => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { createStore } from 'zustand/vanilla';
|
|
18
|
+
import { createSelectors } from './selector';
|
|
19
|
+
const ONTOSERVER_R4 = 'https://r4.ontoserver.csiro.au/fhir';
|
|
20
|
+
export const terminologyServerStore = createStore()((set) => ({
|
|
21
|
+
url: ONTOSERVER_R4,
|
|
22
|
+
setUrl: (newUrl) => set(() => ({ url: newUrl })),
|
|
23
|
+
resetUrl: () => set(() => ({ url: ONTOSERVER_R4 }))
|
|
24
|
+
}));
|
|
25
|
+
export const useTerminologyServerStore = createSelectors(terminologyServerStore);
|
|
26
|
+
//# sourceMappingURL=terminologyServerStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminologyServerStore.js","sourceRoot":"","sources":["../../src/stores/terminologyServerStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,aAAa,GAAG,qCAAqC,CAAC;AAQ5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,EAA8B,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACxF,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;IACxD,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAAC;CACpD,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { QuestionnaireResponse } from 'fhir/r4';
|
|
2
2
|
import type { Diff } from 'deep-diff';
|
|
3
|
-
export interface
|
|
3
|
+
export interface QuestionnaireResponseStoreType {
|
|
4
4
|
sourceResponse: QuestionnaireResponse;
|
|
5
5
|
updatableResponse: QuestionnaireResponse;
|
|
6
6
|
formChangesHistory: (Diff<QuestionnaireResponse, QuestionnaireResponse>[] | null)[];
|
|
@@ -11,5 +11,17 @@ export interface UseQuestionnaireResponseStoreType {
|
|
|
11
11
|
setUpdatableResponseAsEmpty: (clearedResponse: QuestionnaireResponse) => void;
|
|
12
12
|
destroySourceResponse: () => void;
|
|
13
13
|
}
|
|
14
|
-
declare const useQuestionnaireResponseStore: import("zustand").
|
|
14
|
+
declare const useQuestionnaireResponseStore: import("zustand/vanilla").StoreApi<QuestionnaireResponseStoreType> & {
|
|
15
|
+
use: {
|
|
16
|
+
sourceResponse: () => QuestionnaireResponse;
|
|
17
|
+
updatableResponse: () => QuestionnaireResponse;
|
|
18
|
+
formChangesHistory: () => (Diff<QuestionnaireResponse, QuestionnaireResponse>[] | null)[];
|
|
19
|
+
buildSourceResponse: () => (response: QuestionnaireResponse) => void;
|
|
20
|
+
setUpdatableResponseAsPopulated: () => (populatedResponse: QuestionnaireResponse) => void;
|
|
21
|
+
updateResponse: () => (updatedResponse: QuestionnaireResponse) => void;
|
|
22
|
+
setUpdatableResponseAsSaved: () => (savedResponse: QuestionnaireResponse) => void;
|
|
23
|
+
setUpdatableResponseAsEmpty: () => (clearedResponse: QuestionnaireResponse) => void;
|
|
24
|
+
destroySourceResponse: () => () => void;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
15
27
|
export default useQuestionnaireResponseStore;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createStore } from 'zustand/vanilla';
|
|
2
2
|
import { emptyResponse } from '../utils/emptyResource';
|
|
3
3
|
import cloneDeep from 'lodash.clonedeep';
|
|
4
4
|
import { diff } from 'deep-diff';
|
|
5
|
-
|
|
5
|
+
import { createSelectors } from './selector';
|
|
6
|
+
const questionnaireResponseStore = createStore()((set, get) => ({
|
|
6
7
|
sourceResponse: cloneDeep(emptyResponse),
|
|
7
8
|
updatableResponse: cloneDeep(emptyResponse),
|
|
8
9
|
formChangesHistory: [],
|
|
@@ -43,5 +44,6 @@ const useQuestionnaireResponseStore = create()((set, get) => ({
|
|
|
43
44
|
formChangesHistory: []
|
|
44
45
|
}))
|
|
45
46
|
}));
|
|
47
|
+
const useQuestionnaireResponseStore = createSelectors(questionnaireResponseStore);
|
|
46
48
|
export default useQuestionnaireResponseStore;
|
|
47
49
|
//# sourceMappingURL=useQuestionnaireResponseStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQuestionnaireResponseStore.js","sourceRoot":"","sources":["../../src/stores/useQuestionnaireResponseStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useQuestionnaireResponseStore.js","sourceRoot":"","sources":["../../src/stores/useQuestionnaireResponseStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,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,MAAM,0BAA0B,GAAG,WAAW,EAAkC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC9F,cAAc,EAAE,SAAS,CAAC,aAAa,CAAC;IACxC,iBAAiB,EAAE,SAAS,CAAC,aAAa,CAAC;IAC3C,kBAAkB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CAC1B,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACT,cAAc,EAAE,SAAS,CAAC,aAAa,CAAC;QACxC,iBAAiB,EAAE,SAAS,CAAC,aAAa,CAAC;QAC3C,kBAAkB,EAAE,EAAE;KACvB,CAAC,CAAC;CACN,CAAC,CAAC,CAAC;AAEJ,MAAM,6BAA6B,GAAG,eAAe,CAAC,0BAA0B,CAAC,CAAC;AAElF,eAAe,6BAA6B,CAAC"}
|
|
@@ -5,7 +5,7 @@ import type { CalculatedExpression } from '../interfaces/calculatedExpression.in
|
|
|
5
5
|
import type { EnableWhenExpression, EnableWhenItems } from '../interfaces/enableWhen.interface';
|
|
6
6
|
import type { AnswerExpression } from '../interfaces/answerExpression.interface';
|
|
7
7
|
import type { Tabs } from '../interfaces/tab.interface';
|
|
8
|
-
export interface
|
|
8
|
+
export interface QuestionnaireStoreType {
|
|
9
9
|
sourceQuestionnaire: Questionnaire;
|
|
10
10
|
itemTypes: Record<string, string>;
|
|
11
11
|
tabs: Tabs;
|
|
@@ -32,5 +32,33 @@ export interface UseQuestionnaireStoreType {
|
|
|
32
32
|
addCodingToCache: (valueSetUrl: string, codings: Coding[]) => void;
|
|
33
33
|
updatePopulatedProperties: (populatedResponse: QuestionnaireResponse, persistTabIndex?: boolean) => QuestionnaireResponse;
|
|
34
34
|
}
|
|
35
|
-
declare const useQuestionnaireStore: import("zustand").
|
|
35
|
+
declare const useQuestionnaireStore: import("zustand/vanilla").StoreApi<QuestionnaireStoreType> & {
|
|
36
|
+
use: {
|
|
37
|
+
sourceQuestionnaire: () => Questionnaire;
|
|
38
|
+
itemTypes: () => Record<string, string>;
|
|
39
|
+
tabs: () => Tabs;
|
|
40
|
+
currentTabIndex: () => number;
|
|
41
|
+
variables: () => Variables;
|
|
42
|
+
launchContexts: () => Record<string, LaunchContext>;
|
|
43
|
+
enableWhenItems: () => EnableWhenItems;
|
|
44
|
+
enableWhenLinkedQuestions: () => Record<string, string[]>;
|
|
45
|
+
enableWhenIsActivated: () => boolean;
|
|
46
|
+
enableWhenExpressions: () => Record<string, EnableWhenExpression>;
|
|
47
|
+
calculatedExpressions: () => Record<string, CalculatedExpression>;
|
|
48
|
+
answerExpressions: () => Record<string, AnswerExpression>;
|
|
49
|
+
processedValueSetCodings: () => Record<string, Coding[]>;
|
|
50
|
+
processedValueSetUrls: () => Record<string, string>;
|
|
51
|
+
cachedValueSetCodings: () => Record<string, Coding[]>;
|
|
52
|
+
fhirPathContext: () => Record<string, any>;
|
|
53
|
+
buildSourceQuestionnaire: () => (questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, additionalVariables?: Record<string, object>, terminologyServerUrl?: string) => Promise<void>;
|
|
54
|
+
destroySourceQuestionnaire: () => () => void;
|
|
55
|
+
switchTab: () => (newTabIndex: number) => void;
|
|
56
|
+
markTabAsComplete: () => (tabLinkId: string) => void;
|
|
57
|
+
updateEnableWhenItem: () => (linkId: string, newAnswer: QuestionnaireResponseItemAnswer[]) => void;
|
|
58
|
+
toggleEnableWhenActivation: () => (isActivated: boolean) => void;
|
|
59
|
+
updateExpressions: () => (updatedResponse: QuestionnaireResponse) => void;
|
|
60
|
+
addCodingToCache: () => (valueSetUrl: string, codings: Coding[]) => void;
|
|
61
|
+
updatePopulatedProperties: () => (populatedResponse: QuestionnaireResponse, persistTabIndex?: boolean) => QuestionnaireResponse;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
36
64
|
export default useQuestionnaireStore;
|
|
@@ -23,7 +23,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
23
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
import {
|
|
26
|
+
import { createStore } from 'zustand/vanilla';
|
|
27
27
|
import { updateItemAnswer } from '../utils/enableWhen';
|
|
28
28
|
import { evaluateUpdatedExpressions } from '../utils/fhirpath';
|
|
29
29
|
import { evaluateInitialCalculatedExpressions, initialiseCalculatedExpressionValues } from '../utils/calculatedExpression';
|
|
@@ -32,7 +32,8 @@ import { initialiseFormFromResponse } from '../utils/initialiseForm';
|
|
|
32
32
|
import { emptyQuestionnaire, emptyResponse } from '../utils/emptyResource';
|
|
33
33
|
import cloneDeep from 'lodash.clonedeep';
|
|
34
34
|
import useTerminologyServerStore from './useTerminologyServerStore';
|
|
35
|
-
|
|
35
|
+
import { createSelectors } from './selector';
|
|
36
|
+
const QuestionnaireStore = createStore()((set, get) => ({
|
|
36
37
|
sourceQuestionnaire: cloneDeep(emptyQuestionnaire),
|
|
37
38
|
itemTypes: {},
|
|
38
39
|
tabs: {},
|
|
@@ -167,5 +168,6 @@ const useQuestionnaireStore = create()((set, get) => ({
|
|
|
167
168
|
return updatedResponse;
|
|
168
169
|
}
|
|
169
170
|
}));
|
|
171
|
+
const useQuestionnaireStore = createSelectors(QuestionnaireStore);
|
|
170
172
|
export default useQuestionnaireStore;
|
|
171
173
|
//# sourceMappingURL=useQuestionnaireStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQuestionnaireStore.js","sourceRoot":"","sources":["../../src/stores/useQuestionnaireStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useQuestionnaireStore.js","sourceRoot":"","sources":["../../src/stores/useQuestionnaireStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAa9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,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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EACzB,iBAAiB,EACjB,4BAA4B,CAC7B,CAAC;QAEF,MAAM,EACJ,sBAAsB,EACtB,gCAAgC,EAChC,4BAA4B,EAC5B,eAAe,EAChB,GAAG,0BAA0B,CAAC;YAC7B,qBAAqB,EAAE,eAAe;YACtC,eAAe,EAAE,GAAG,EAAE,CAAC,eAAe;YACtC,qBAAqB,EAAE,GAAG,EAAE,CAAC,qBAAqB;YAClD,qBAAqB,EAAE,4BAA4B;YACnD,iBAAiB,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,iBAAiB;YACpD,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI;YAChB,eAAe,EAAE,sBAAsB;SACxC,CAAC,CAAC;QACH,sBAAsB,GAAG,0CAA0C,CAAC,sBAAsB,CAAC;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;SACxC,CAAC,CAAC,CAAC;QAEJ,OAAO,eAAe,CAAC;IACzB,CAAC;CACF,CAAC,CAAC,CAAC;AAEJ,MAAM,qBAAqB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;AAElE,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import ThemeProvider from '../theme/Theme';
|
|
17
|
+
import { GroupTable } from '../components';
|
|
18
|
+
import GTableMedicalHistoryItemJson from './assets/QItems-and-QRItems/Q_GTableMedicalHistory.json';
|
|
19
|
+
import GTableMedicalHistoryAnswersJson from './assets/QItems-and-QRItems/QR_GTableMedicalHistory.json';
|
|
20
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
21
|
+
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
22
|
+
import { DndProvider } from 'react-dnd';
|
|
23
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
24
|
+
const meta = {
|
|
25
|
+
title: 'Component/GroupTable',
|
|
26
|
+
component: GroupTable,
|
|
27
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
28
|
+
tags: [],
|
|
29
|
+
decorators: [
|
|
30
|
+
(Story)=>/*#__PURE__*/ React.createElement(ThemeProvider, null, /*#__PURE__*/ React.createElement(QueryClientProvider, {
|
|
31
|
+
client: new QueryClient()
|
|
32
|
+
}, /*#__PURE__*/ React.createElement(DndProvider, {
|
|
33
|
+
backend: HTML5Backend
|
|
34
|
+
}, Story())))
|
|
35
|
+
]
|
|
36
|
+
};
|
|
37
|
+
const GTableMedicalHistoryItem = GTableMedicalHistoryItemJson;
|
|
38
|
+
const GTableMedicalHistoryAnswers = GTableMedicalHistoryAnswersJson;
|
|
39
|
+
export default meta;
|
|
40
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
41
|
+
export const MedicalHistoryTable = {
|
|
42
|
+
args: {
|
|
43
|
+
qItem: GTableMedicalHistoryItem,
|
|
44
|
+
qrItems: GTableMedicalHistoryAnswers,
|
|
45
|
+
groupCardElevation: 1,
|
|
46
|
+
parentIsReadOnly: false,
|
|
47
|
+
onQrRepeatGroupChange: ()=>{}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/stories/MedicalHistoryTable.stories.tsx"],"sourcesContent":["/*\n * Copyright 2023 Commonwealth Scientific and Industrial Research\n * Organisation (CSIRO) ABN 41 687 119 230.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport ThemeProvider from '../theme/Theme';\nimport type { Meta, StoryObj } from '@storybook/react';\nimport { GroupTable } from '../components';\nimport GTableMedicalHistoryItemJson from './assets/QItems-and-QRItems/Q_GTableMedicalHistory.json';\nimport GTableMedicalHistoryAnswersJson from './assets/QItems-and-QRItems/QR_GTableMedicalHistory.json';\nimport { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { HTML5Backend } from 'react-dnd-html5-backend';\nimport { DndProvider } from 'react-dnd';\n\n// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export\nconst meta = {\n title: 'Component/GroupTable',\n component: GroupTable,\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs\n tags: [],\n decorators: [\n (Story) => (\n <ThemeProvider>\n <QueryClientProvider client={new QueryClient()}>\n <DndProvider backend={HTML5Backend}>{Story()}</DndProvider>\n </QueryClientProvider>\n </ThemeProvider>\n )\n ]\n} satisfies Meta<typeof GroupTable>;\n\nconst GTableMedicalHistoryItem = GTableMedicalHistoryItemJson as QuestionnaireItem;\nconst GTableMedicalHistoryAnswers = GTableMedicalHistoryAnswersJson as QuestionnaireResponseItem[];\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\n// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args\n\nexport const MedicalHistoryTable: Story = {\n args: {\n qItem: GTableMedicalHistoryItem,\n qrItems: GTableMedicalHistoryAnswers,\n groupCardElevation: 1,\n parentIsReadOnly: false,\n onQrRepeatGroupChange: () => {}\n }\n};\n"],"names":["ThemeProvider","GroupTable","GTableMedicalHistoryItemJson","GTableMedicalHistoryAnswersJson","QueryClient","QueryClientProvider","HTML5Backend","DndProvider","meta","title","component","tags","decorators","Story","client","backend","GTableMedicalHistoryItem","GTableMedicalHistoryAnswers","MedicalHistoryTable","args","qItem","qrItems","groupCardElevation","parentIsReadOnly","onQrRepeatGroupChange"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAOA,mBAAmB,iBAAiB;AAE3C,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,OAAOC,kCAAkC,0DAA0D;AACnG,OAAOC,qCAAqC,2DAA2D;AAEvG,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AACzE,SAASC,YAAY,QAAQ,0BAA0B;AACvD,SAASC,WAAW,QAAQ,YAAY;AAExC,oHAAoH;AACpH,MAAMC,OAAO;IACXC,OAAO;IACPC,WAAWT;IACX,gIAAgI;IAChIU,MAAM,EAAE;IACRC,YAAY;QACV,CAACC,sBACC,oBAACb,mCACC,oBAACK;gBAAoBS,QAAQ,IAAIV;6BAC/B,oBAACG;gBAAYQ,SAAST;eAAeO;KAI5C;AACH;AAEA,MAAMG,2BAA2Bd;AACjC,MAAMe,8BAA8Bd;AAEpC,eAAeK,KAAK;AAGpB,8FAA8F;AAE9F,OAAO,MAAMU,sBAA6B;IACxCC,MAAM;QACJC,OAAOJ;QACPK,SAASJ;QACTK,oBAAoB;QACpBC,kBAAkB;QAClBC,uBAAuB,KAAO;IAChC;AACF,EAAE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { SmartFormsRenderer } from '../components';
|
|
17
|
+
import Q715Json from './assets/Qs-and-QRs/Q715.json';
|
|
18
|
+
import R715Json from './assets/Qs-and-QRs/R715.json';
|
|
19
|
+
import QTestGridJson from './assets/Qs-and-QRs/QTestGrid.json';
|
|
20
|
+
import RTestGridJson from './assets/Qs-and-QRs/RTestGrid.json';
|
|
21
|
+
import QDev715Json from './assets/Qs-and-QRs/QDev715.json';
|
|
22
|
+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
23
|
+
const meta = {
|
|
24
|
+
title: 'Component/SmartFormsRenderer',
|
|
25
|
+
component: SmartFormsRenderer,
|
|
26
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
27
|
+
tags: []
|
|
28
|
+
};
|
|
29
|
+
const Q715 = Q715Json;
|
|
30
|
+
const R715 = R715Json;
|
|
31
|
+
const QTestGrid = QTestGridJson;
|
|
32
|
+
const RTestGrid = RTestGridJson;
|
|
33
|
+
const QDev715 = QDev715Json;
|
|
34
|
+
export default meta;
|
|
35
|
+
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
36
|
+
export const Form715 = {
|
|
37
|
+
args: {
|
|
38
|
+
questionnaire: Q715
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export const Form715WithResponse = {
|
|
42
|
+
args: {
|
|
43
|
+
questionnaire: Q715,
|
|
44
|
+
questionnaireResponse: R715
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export const FormDev715 = {
|
|
48
|
+
args: {
|
|
49
|
+
questionnaire: QDev715
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
export const FormTestGrid = {
|
|
53
|
+
args: {
|
|
54
|
+
questionnaire: QTestGrid
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
export const FormTestGridWithResponse = {
|
|
58
|
+
args: {
|
|
59
|
+
questionnaire: QTestGrid,
|
|
60
|
+
questionnaireResponse: RTestGrid,
|
|
61
|
+
additionalVariables: {}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export const QTestGridWithResponseAddFhirPath = {
|
|
65
|
+
args: {
|
|
66
|
+
questionnaire: QTestGrid,
|
|
67
|
+
questionnaireResponse: RTestGrid,
|
|
68
|
+
additionalVariables: {
|
|
69
|
+
addVar1: {
|
|
70
|
+
url: 'http://hl7.org/fhir/StructureDefinition/variable',
|
|
71
|
+
valueExpression: {
|
|
72
|
+
name: 'addVar1',
|
|
73
|
+
language: 'text/fhirpath',
|
|
74
|
+
expression: "%resource.item.where(linkId='grid').item.where(linkId='1').item.where(linkId='1.1').item.where(linkId='1.1.1').answer.value"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export const QTestGridWithResponseAddXFhirQuery = {
|
|
81
|
+
args: {
|
|
82
|
+
questionnaire: QTestGrid,
|
|
83
|
+
questionnaireResponse: RTestGrid,
|
|
84
|
+
additionalVariables: {
|
|
85
|
+
addVar1: {
|
|
86
|
+
url: 'http://hl7.org/fhir/StructureDefinition/variable',
|
|
87
|
+
valueExpression: {
|
|
88
|
+
name: 'addVar1',
|
|
89
|
+
language: 'text/fhirpath',
|
|
90
|
+
expression: "%resource.item.where(linkId='grid').item.where(linkId='1').item.where(linkId='1.1').item.where(linkId='1.1.1').answer.value"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
addVar2: {
|
|
94
|
+
url: 'http://hl7.org/fhir/StructureDefinition/variable',
|
|
95
|
+
valueExpression: {
|
|
96
|
+
name: 'addVar2',
|
|
97
|
+
language: 'application/x-fhir-query',
|
|
98
|
+
expression: 'Condition?patient={{%patient.id}}'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/stories/SmartFormsRenderer.stories.ts"],"sourcesContent":["/*\n * Copyright 2023 Commonwealth Scientific and Industrial Research\n * Organisation (CSIRO) ABN 41 687 119 230.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Meta, StoryObj } from '@storybook/react';\nimport { SmartFormsRenderer } from '../components';\nimport type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';\nimport Q715Json from './assets/Qs-and-QRs/Q715.json';\nimport R715Json from './assets/Qs-and-QRs/R715.json';\nimport QTestGridJson from './assets/Qs-and-QRs/QTestGrid.json';\nimport RTestGridJson from './assets/Qs-and-QRs/RTestGrid.json';\nimport QDev715Json from './assets/Qs-and-QRs/QDev715.json';\n\n// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export\nconst meta = {\n title: 'Component/SmartFormsRenderer',\n component: SmartFormsRenderer,\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs\n tags: []\n} satisfies Meta<typeof SmartFormsRenderer>;\n\nconst Q715 = Q715Json as Questionnaire;\nconst R715 = R715Json as QuestionnaireResponse;\n\nconst QTestGrid = QTestGridJson as Questionnaire;\nconst RTestGrid = RTestGridJson as QuestionnaireResponse;\n\nconst QDev715 = QDev715Json as Questionnaire;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\n// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args\n\nexport const Form715: Story = {\n args: {\n questionnaire: Q715\n }\n};\n\nexport const Form715WithResponse: Story = {\n args: {\n questionnaire: Q715,\n questionnaireResponse: R715\n }\n};\n\nexport const FormDev715: Story = {\n args: {\n questionnaire: QDev715\n }\n};\n\nexport const FormTestGrid: Story = {\n args: {\n questionnaire: QTestGrid\n }\n};\n\nexport const FormTestGridWithResponse: Story = {\n args: {\n questionnaire: QTestGrid,\n questionnaireResponse: RTestGrid,\n additionalVariables: {}\n }\n};\n\nexport const QTestGridWithResponseAddFhirPath: Story = {\n args: {\n questionnaire: QTestGrid,\n questionnaireResponse: RTestGrid,\n additionalVariables: {\n addVar1: {\n url: 'http://hl7.org/fhir/StructureDefinition/variable',\n valueExpression: {\n name: 'addVar1',\n language: 'text/fhirpath',\n expression:\n \"%resource.item.where(linkId='grid').item.where(linkId='1').item.where(linkId='1.1').item.where(linkId='1.1.1').answer.value\"\n }\n }\n }\n }\n};\n\nexport const QTestGridWithResponseAddXFhirQuery: Story = {\n args: {\n questionnaire: QTestGrid,\n questionnaireResponse: RTestGrid,\n additionalVariables: {\n addVar1: {\n url: 'http://hl7.org/fhir/StructureDefinition/variable',\n valueExpression: {\n name: 'addVar1',\n language: 'text/fhirpath',\n expression:\n \"%resource.item.where(linkId='grid').item.where(linkId='1').item.where(linkId='1.1').item.where(linkId='1.1.1').answer.value\"\n }\n },\n addVar2: {\n url: 'http://hl7.org/fhir/StructureDefinition/variable',\n valueExpression: {\n name: 'addVar2',\n language: 'application/x-fhir-query',\n expression: 'Condition?patient={{%patient.id}}'\n }\n }\n }\n }\n};\n"],"names":["SmartFormsRenderer","Q715Json","R715Json","QTestGridJson","RTestGridJson","QDev715Json","meta","title","component","tags","Q715","R715","QTestGrid","RTestGrid","QDev715","Form715","args","questionnaire","Form715WithResponse","questionnaireResponse","FormDev715","FormTestGrid","FormTestGridWithResponse","additionalVariables","QTestGridWithResponseAddFhirPath","addVar1","url","valueExpression","name","language","expression","QTestGridWithResponseAddXFhirQuery","addVar2"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,kBAAkB,QAAQ,gBAAgB;AAEnD,OAAOC,cAAc,gCAAgC;AACrD,OAAOC,cAAc,gCAAgC;AACrD,OAAOC,mBAAmB,qCAAqC;AAC/D,OAAOC,mBAAmB,qCAAqC;AAC/D,OAAOC,iBAAiB,mCAAmC;AAE3D,oHAAoH;AACpH,MAAMC,OAAO;IACXC,OAAO;IACPC,WAAWR;IACX,gIAAgI;IAChIS,MAAM,EAAE;AACV;AAEA,MAAMC,OAAOT;AACb,MAAMU,OAAOT;AAEb,MAAMU,YAAYT;AAClB,MAAMU,YAAYT;AAElB,MAAMU,UAAUT;AAEhB,eAAeC,KAAK;AAGpB,8FAA8F;AAE9F,OAAO,MAAMS,UAAiB;IAC5BC,MAAM;QACJC,eAAeP;IACjB;AACF,EAAE;AAEF,OAAO,MAAMQ,sBAA6B;IACxCF,MAAM;QACJC,eAAeP;QACfS,uBAAuBR;IACzB;AACF,EAAE;AAEF,OAAO,MAAMS,aAAoB;IAC/BJ,MAAM;QACJC,eAAeH;IACjB;AACF,EAAE;AAEF,OAAO,MAAMO,eAAsB;IACjCL,MAAM;QACJC,eAAeL;IACjB;AACF,EAAE;AAEF,OAAO,MAAMU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