@aehrc/smart-forms-renderer 0.34.1 → 0.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/lib/components/FormComponents/ChoiceItems/CheckboxFields.d.ts +0 -11
- package/lib/components/FormComponents/ChoiceItems/CheckboxFields.js +0 -41
- package/lib/components/FormComponents/ChoiceItems/CheckboxFields.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/CheckboxOptionFields.d.ts +0 -11
- package/lib/components/FormComponents/ChoiceItems/CheckboxOptionFields.js +0 -41
- package/lib/components/FormComponents/ChoiceItems/CheckboxOptionFields.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetView.d.ts +0 -13
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetView.js +0 -46
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxAnswerValueSetView.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxFields.d.ts +0 -11
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxFields.js +0 -41
- package/lib/components/FormComponents/ChoiceItems/ChoiceCheckboxFields.js.map +0 -1
- package/lib/components/FormComponents/DateTimeItem/DateTimeField.d.ts +0 -12
- package/lib/components/FormComponents/DateTimeItem/DateTimeField.js +0 -34
- package/lib/components/FormComponents/DateTimeItem/DateTimeField.js.map +0 -1
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.d.ts +0 -9
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js +0 -60
- package/lib/components/FormComponents/DateTimeItem/DateTimeItem.js.map +0 -1
- package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.d.ts +0 -8
- package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.js +0 -57
- package/lib/components/FormComponents/GroupItem/NextTabButtonWrapper.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.d.ts +0 -8
- package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js +0 -37
- package/lib/components/FormComponents/ItemParts/RadioAnswerOptionButtons.js.map +0 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxFields.d.ts +0 -18
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxFields.js +0 -48
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceCheckboxFields.js.map +0 -1
- package/lib/components/StoryWrappers/BuildFormWrapper.d.ts +0 -7
- package/lib/components/StoryWrappers/BuildFormWrapper.js +0 -57
- package/lib/components/StoryWrappers/BuildFormWrapper.js.map +0 -1
- package/lib/hooks/useDisplayCalculatedExpression.d.ts +0 -3
- package/lib/hooks/useDisplayCalculatedExpression.js +0 -40
- package/lib/hooks/useDisplayCalculatedExpression.js.map +0 -1
- package/lib/hooks/useInitaliseFhirClient.d.ts +0 -1
- package/lib/hooks/useInitaliseFhirClient.js +0 -55
- package/lib/hooks/useInitaliseFhirClient.js.map +0 -1
- package/lib/hooks/useInitialiseRenderer.d.ts +0 -4
- package/lib/hooks/useInitialiseRenderer.js +0 -62
- package/lib/hooks/useInitialiseRenderer.js.map +0 -1
- package/lib/hooks/useNextPreviousVisibleTabs.d.ts +0 -6
- package/lib/hooks/useNextPreviousVisibleTabs.js +0 -63
- package/lib/hooks/useNextPreviousVisibleTabs.js.map +0 -1
- package/lib/hooks/useQueryClient.d.ts +0 -3
- package/lib/hooks/useQueryClient.js +0 -29
- package/lib/hooks/useQueryClient.js.map +0 -1
- package/lib/hooks/useRepeatitemState.d.ts +0 -0
- package/lib/hooks/useRepeatitemState.js +0 -2
- package/lib/hooks/useRepeatitemState.js.map +0 -1
- package/lib/interfaces/repopulateItems.interface.d.ts +0 -0
- package/lib/interfaces/repopulateItems.interface.js +0 -2
- package/lib/interfaces/repopulateItems.interface.js.map +0 -1
- package/lib/setup-jest.js +0 -1
- package/lib/stories/InitialiseFormWrapperForStorybook.d.ts +0 -29
- package/lib/stories/InitialiseFormWrapperForStorybook.js +0 -65
- package/lib/stories/InitialiseFormWrapperForStorybook.js.map +0 -1
- package/lib/stories/MedicalHistoryTable.stories.js +0 -45
- package/lib/stories/SmartFormsRenderer.stories.js +0 -117
- package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.d.ts +0 -8
- package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.js +0 -44
- package/lib/stories/StorybookWrappers/BuildFormButtonForStorybook.js.map +0 -1
- package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.d.ts +0 -18
- package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.js +0 -48
- package/lib/stories/StorybookWrappers/BuildFormButtonTesterWrapperForStorybook.js.map +0 -1
- package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.d.ts +0 -7
- package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.js +0 -32
- package/lib/stories/StorybookWrappers/PrePopButtonForStorybook.js.map +0 -1
- package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.d.ts +0 -21
- package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.js +0 -83
- package/lib/stories/StorybookWrappers/PrePopWrapperForStorybook.js.map +0 -1
- package/lib/stories/StorybookWrappers/populateCallbackForStorybook.d.ts +0 -8
- package/lib/stories/StorybookWrappers/populateCallbackForStorybook.js +0 -46
- package/lib/stories/StorybookWrappers/populateCallbackForStorybook.js.map +0 -1
- package/lib/stories/index.d.ts +0 -1
- package/lib/stories/index.js +0 -18
- package/lib/stories/index.js.map +0 -1
- package/lib/utils/buildForm.d.ts +0 -8
- package/lib/utils/buildForm.js +0 -26
- package/lib/utils/buildForm.js.map +0 -1
- package/lib/utils/buildForms.d.ts +0 -0
- package/lib/utils/buildForms.js +0 -2
- package/lib/utils/buildForms.js.map +0 -1
- /package/lib/stories/{StorybookWrappers → storybookWrappers}/InitialiseFormWrapperForStorybook.d.ts +0 -0
- /package/lib/stories/{StorybookWrappers → storybookWrappers}/InitialiseFormWrapperForStorybook.js +0 -0
- /package/lib/stories/{StorybookWrappers → storybookWrappers}/InitialiseFormWrapperForStorybook.js.map +0 -0
- /package/lib/stories/{StorybookWrappers → storybookWrappers}/index.d.ts +0 -0
- /package/lib/stories/{StorybookWrappers → storybookWrappers}/index.js +0 -0
- /package/lib/stories/{StorybookWrappers → storybookWrappers}/index.js.map +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/*
|
|
18
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
19
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
20
|
-
*
|
|
21
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
22
|
-
* you may not use this file except in compliance with the License.
|
|
23
|
-
* You may obtain a copy of the License at
|
|
24
|
-
*
|
|
25
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
-
*
|
|
27
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
28
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30
|
-
* See the License for the specific language governing permissions and
|
|
31
|
-
* limitations under the License.
|
|
32
|
-
*/
|
|
33
|
-
import React, { useLayoutEffect, useState } from 'react';
|
|
34
|
-
import { BaseRenderer } from '../index';
|
|
35
|
-
import { QueryClientProvider } from '@tanstack/react-query';
|
|
36
|
-
import ThemeProvider from '../../theme/Theme';
|
|
37
|
-
import useQueryClient from '../../hooks/useQueryClient';
|
|
38
|
-
import { buildForm } from '../../utils';
|
|
39
|
-
function BuildFormWrapper(props) {
|
|
40
|
-
const { questionnaire } = props;
|
|
41
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
42
|
-
useLayoutEffect(() => {
|
|
43
|
-
buildForm(questionnaire).then(() => {
|
|
44
|
-
setIsLoading(false);
|
|
45
|
-
});
|
|
46
|
-
}, [questionnaire]);
|
|
47
|
-
const queryClient = useQueryClient();
|
|
48
|
-
// const isLoading = useInitialiseRenderer(questionnaire);
|
|
49
|
-
if (isLoading) {
|
|
50
|
-
return React.createElement("div", null, "Loading...");
|
|
51
|
-
}
|
|
52
|
-
return (React.createElement(ThemeProvider, null,
|
|
53
|
-
React.createElement(QueryClientProvider, { client: queryClient },
|
|
54
|
-
React.createElement(BaseRenderer, null))));
|
|
55
|
-
}
|
|
56
|
-
export default BuildFormWrapper;
|
|
57
|
-
//# sourceMappingURL=BuildFormWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildFormWrapper.js","sourceRoot":"","sources":["../../../src/components/StoryWrappers/BuildFormWrapper.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,SAAS,gBAAgB,CAAC,KAA4B;IACpD,MAAM,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAEhC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEjD,eAAe,CAAC,GAAG,EAAE;QACnB,SAAS,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACjC,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,0DAA0D;IAE1D,IAAI,SAAS,EAAE;QACb,OAAO,8CAAqB,CAAC;KAC9B;IAED,OAAO,CACL,oBAAC,aAAa;QACZ,oBAAC,mBAAmB,IAAC,MAAM,EAAE,WAAW;YACtC,oBAAC,YAAY,OAAG,CACI,CACR,CACjB,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useQuestionnaireStore } from '../stores';
|
|
18
|
-
function useDisplayCalculatedExpression(qItem) {
|
|
19
|
-
var _a;
|
|
20
|
-
const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
|
|
21
|
-
const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item._text');
|
|
22
|
-
if (!calcExpression) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
if (typeof calcExpression.value === 'string' ||
|
|
26
|
-
typeof calcExpression.value === 'number' ||
|
|
27
|
-
calcExpression.value === null) {
|
|
28
|
-
// calculatedExpression value is null
|
|
29
|
-
if (calcExpression.value === null) {
|
|
30
|
-
return '';
|
|
31
|
-
}
|
|
32
|
-
// calculatedExpression value is string or number
|
|
33
|
-
return typeof calcExpression.value === 'string'
|
|
34
|
-
? calcExpression.value
|
|
35
|
-
: calcExpression.value.toString();
|
|
36
|
-
}
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
export default useDisplayCalculatedExpression;
|
|
40
|
-
//# sourceMappingURL=useDisplayCalculatedExpression.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDisplayCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useDisplayCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAGlD,SAAS,8BAA8B,CAAC,KAAwB;;IAC9D,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAEhF,MAAM,cAAc,GAAG,MAAA,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,IAAI,CAC9D,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY,CACnC,CAAC;IAEF,IAAI,CAAC,cAAc,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IAED,IACE,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;QACxC,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;QACxC,cAAc,CAAC,KAAK,KAAK,IAAI,EAC7B;QACA,qCAAqC;QACrC,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,EAAE;YACjC,OAAO,EAAE,CAAC;SACX;QAED,iDAAiD;QACjD,OAAO,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;YAC7C,CAAC,CAAC,cAAc,CAAC,KAAK;YACtB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;KACrC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default useBuildForm;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useEffect } from 'react';
|
|
18
|
-
import { readEncounter, readPatient, readUser } from '../api/smartClient';
|
|
19
|
-
import { useSmartConfigStore } from '../stores';
|
|
20
|
-
/**
|
|
21
|
-
* React hook wrapping to initialise a FHIRClient object for further FHIR calls in the renderer i.e. AnswerExpression calls
|
|
22
|
-
* Note: This does not provide pre-population capabilities
|
|
23
|
-
*
|
|
24
|
-
* @param questionnaire - Questionnaire to be rendered
|
|
25
|
-
* @param questionnaireResponse - Pre-populated/draft/loaded QuestionnaireResponse to be rendered (optional)
|
|
26
|
-
* @param readOnly - Applies read-only mode to all items in the form view
|
|
27
|
-
* @param terminologyServerUrl - Terminology server url to fetch terminology. If not provided, the default terminology server will be used. (optional)
|
|
28
|
-
* @param additionalVariables - Additional key-value pair of SDC variables <name, variable extension> for testing (optional)
|
|
29
|
-
*
|
|
30
|
-
* @author Sean Fong
|
|
31
|
-
*/
|
|
32
|
-
function useInitaliseFhirClient(fhirClient) {
|
|
33
|
-
const setSmartClient = useSmartConfigStore.use.setClient();
|
|
34
|
-
const setPatient = useSmartConfigStore.use.setPatient();
|
|
35
|
-
const setUser = useSmartConfigStore.use.setUser();
|
|
36
|
-
const setEncounter = useSmartConfigStore.use.setEncounter();
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
// set fhirClient if provided
|
|
39
|
-
if (fhirClient) {
|
|
40
|
-
setSmartClient(fhirClient);
|
|
41
|
-
readPatient(fhirClient).then((patient) => {
|
|
42
|
-
setPatient(patient);
|
|
43
|
-
});
|
|
44
|
-
readUser(fhirClient).then((user) => {
|
|
45
|
-
setUser(user);
|
|
46
|
-
});
|
|
47
|
-
readEncounter(fhirClient).then((encounter) => {
|
|
48
|
-
setEncounter(encounter);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}, [setSmartClient, setPatient, setUser, setEncounter]);
|
|
52
|
-
return isBuilding;
|
|
53
|
-
}
|
|
54
|
-
export default useBuildForm;
|
|
55
|
-
//# sourceMappingURL=useInitaliseFhirClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInitaliseFhirClient.js","sourceRoot":"","sources":["../../src/hooks/useInitaliseFhirClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE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from 'fhirclient/lib/Client';
|
|
3
|
-
declare function useInitialiseRenderer(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, readOnly?: boolean, terminologyServerUrl?: string, additionalVariables?: Record<string, object>, fhirClient?: Client): boolean;
|
|
4
|
-
export default useInitialiseRenderer;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useLayoutEffect, useState } from 'react';
|
|
18
|
-
import { buildForm } from '../utils';
|
|
19
|
-
import { readEncounter, readPatient, readUser } from '../api/smartClient';
|
|
20
|
-
import { useSmartConfigStore } from '../stores';
|
|
21
|
-
// Smart Config store are only used in answerExpressions at the moment. If not using answerExpressions, this can be removed.
|
|
22
|
-
function useInitialiseRenderer(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, fhirClient) {
|
|
23
|
-
const setSmartClient = useSmartConfigStore.use.setClient();
|
|
24
|
-
const setPatient = useSmartConfigStore.use.setPatient();
|
|
25
|
-
const setUser = useSmartConfigStore.use.setUser();
|
|
26
|
-
const setEncounter = useSmartConfigStore.use.setEncounter();
|
|
27
|
-
const [loading, setLoading] = useState(true);
|
|
28
|
-
useLayoutEffect(() => {
|
|
29
|
-
setLoading(true);
|
|
30
|
-
// set fhirClient if provided
|
|
31
|
-
if (fhirClient) {
|
|
32
|
-
setSmartClient(fhirClient);
|
|
33
|
-
readPatient(fhirClient).then((patient) => {
|
|
34
|
-
setPatient(patient);
|
|
35
|
-
});
|
|
36
|
-
readUser(fhirClient).then((user) => {
|
|
37
|
-
setUser(user);
|
|
38
|
-
});
|
|
39
|
-
readEncounter(fhirClient).then((encounter) => {
|
|
40
|
-
setEncounter(encounter);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
// initialise form including enableWhen, enableWhenExpressions, calculatedExpressions, initialExpressions, answerExpressions, cache answerValueSets
|
|
44
|
-
buildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables).then(() => {
|
|
45
|
-
setLoading(false);
|
|
46
|
-
});
|
|
47
|
-
}, [
|
|
48
|
-
questionnaire,
|
|
49
|
-
questionnaireResponse,
|
|
50
|
-
additionalVariables,
|
|
51
|
-
terminologyServerUrl,
|
|
52
|
-
fhirClient,
|
|
53
|
-
readOnly,
|
|
54
|
-
setSmartClient,
|
|
55
|
-
setPatient,
|
|
56
|
-
setUser,
|
|
57
|
-
setEncounter
|
|
58
|
-
]);
|
|
59
|
-
return loading;
|
|
60
|
-
}
|
|
61
|
-
export default useInitialiseRenderer;
|
|
62
|
-
//# sourceMappingURL=useInitialiseRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInitialiseRenderer.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;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,EAAE;QACD,aAAa;QACb,qBAAqB;QACrB,mBAAmB;QACnB,oBAAoB;QACpB,UAAU;QACV,QAAQ;QACR,cAAc;QACd,UAAU;QACV,OAAO;QACP,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useQuestionnaireStore } from '../stores';
|
|
18
|
-
import { constructTabsWithVisibility } from '../utils/tabs';
|
|
19
|
-
function useNextPreviousVisibleTabs(currentTabIndex, tabs) {
|
|
20
|
-
const enableWhenIsActivated = useQuestionnaireStore.use.enableWhenIsActivated();
|
|
21
|
-
const enableWhenItems = useQuestionnaireStore.use.enableWhenItems();
|
|
22
|
-
const enableWhenExpressions = useQuestionnaireStore.use.enableWhenExpressions();
|
|
23
|
-
const switchTab = useQuestionnaireStore.use.switchTab();
|
|
24
|
-
const tabsNotDefined = currentTabIndex === undefined || tabs === undefined;
|
|
25
|
-
if (tabsNotDefined) {
|
|
26
|
-
return { previousTabIndex: null, nextTabIndex: null };
|
|
27
|
-
}
|
|
28
|
-
const tabsWithVisibility = constructTabsWithVisibility({
|
|
29
|
-
tabs,
|
|
30
|
-
enableWhenIsActivated,
|
|
31
|
-
enableWhenItems,
|
|
32
|
-
enableWhenExpressions
|
|
33
|
-
});
|
|
34
|
-
return {
|
|
35
|
-
previousTabIndex: getPreviousTabIndex(currentTabIndex, tabsWithVisibility),
|
|
36
|
-
nextTabIndex: getNextTabIndex(currentTabIndex, tabsWithVisibility)
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function getNextTabIndex(currentTabIndex, tabsWithVisibility) {
|
|
40
|
-
const subsequentTabs = tabsWithVisibility.slice(currentTabIndex + 1);
|
|
41
|
-
const foundIndex = subsequentTabs.findIndex((tab) => tab.isVisible);
|
|
42
|
-
// Next visible tab not found, something is wrong
|
|
43
|
-
if (foundIndex === -1) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return currentTabIndex + foundIndex + 1;
|
|
47
|
-
}
|
|
48
|
-
function getPreviousTabIndex(currentTabIndex, tabsWithVisibility) {
|
|
49
|
-
const previousTabs = tabsWithVisibility.slice(0, currentTabIndex);
|
|
50
|
-
const foundIndex = previousTabs.reverse().findIndex((tab) => tab.isVisible);
|
|
51
|
-
// Previous visible tab not found
|
|
52
|
-
if (foundIndex === -1) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
// Previous visible tab less than 0
|
|
56
|
-
const previousTabIndex = currentTabIndex - foundIndex - 1;
|
|
57
|
-
if (previousTabIndex < 0) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
return previousTabIndex;
|
|
61
|
-
}
|
|
62
|
-
export default useNextPreviousVisibleTabs;
|
|
63
|
-
//# sourceMappingURL=useNextPreviousVisibleTabs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNextPreviousVisibleTabs.js","sourceRoot":"","sources":["../../src/hooks/useNextPreviousVisibleTabs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,qBAAq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AED,SAAS,mBAAmB,CAC1B,eAAuB,EACvB,kBAA4D;IAE5D,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAE5E,iCAAiC;IACjC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC;KACb;IAED,mCAAmC;IACnC,MAAM,gBAAgB,GAAG,eAAe,GAAG,UAAU,GAAG,CAAC,CAAC;IAC1D,IAAI,gBAAgB,GAAG,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { QueryClient } from '@tanstack/react-query';
|
|
18
|
-
function useQueryClient() {
|
|
19
|
-
return new QueryClient({
|
|
20
|
-
defaultOptions: {
|
|
21
|
-
queries: {
|
|
22
|
-
refetchOnWindowFocus: false,
|
|
23
|
-
keepPreviousData: true
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
export default useQueryClient;
|
|
29
|
-
//# sourceMappingURL=useQueryClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useQueryClient.js","sourceRoot":"","sources":["../../src/hooks/useQueryClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,SAAS,cAAc;IACrB,OAAO,IAAI,WAAW,CAAC;QACrB,cAAc,EAAE;YACd,OAAO,EAAE;gBACP,oBAAoB,EAAE,KAAK;gBAC3B,gBAAgB,EAAE,IAAI;aACvB;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRepeatitemState.js","sourceRoot":"","sources":["../../src/hooks/useRepeatitemState.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repopulateItems.interface.js","sourceRoot":"","sources":["../../src/interfaces/repopulateItems.interface.ts"],"names":[],"mappings":""}
|
package/lib/setup-jest.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
3
|
-
import type Client from 'fhirclient/lib/Client';
|
|
4
|
-
interface InitialiseFormWrapperProps {
|
|
5
|
-
questionnaire: Questionnaire;
|
|
6
|
-
questionnaireResponse?: QuestionnaireResponse;
|
|
7
|
-
readOnly?: boolean;
|
|
8
|
-
terminologyServerUrl?: string;
|
|
9
|
-
additionalVariables?: Record<string, object>;
|
|
10
|
-
fhirClient?: Client;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* This is a one-to-one replacement for the SmartFormsRenderer for demo purposes.
|
|
14
|
-
* Instead of using this React component, define your own wrapper component that uses the BaseRenderer directly.
|
|
15
|
-
* Things to note:
|
|
16
|
-
* - It is required to wrap the BaseRenderer with the QueryClientProvider to make requests.
|
|
17
|
-
* - You can wrap the BaseRenderer with the RendererThemeProvider to apply the default renderer theme used in Smart Forms. Optionally, you can define your own ThemeProvider.
|
|
18
|
-
* - Make your buildForm() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form.
|
|
19
|
-
* - Make your own initialiseFhirClient() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form.
|
|
20
|
-
* - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities.
|
|
21
|
-
*
|
|
22
|
-
* For button click usage examples of buildForm(), see:
|
|
23
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonTesterWrapper.tsx#L47
|
|
24
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonForStorybook.tsx
|
|
25
|
-
*
|
|
26
|
-
* @author Sean Fong
|
|
27
|
-
*/
|
|
28
|
-
declare function InitialiseFormWrapperForStorybook(props: InitialiseFormWrapperProps): React.JSX.Element;
|
|
29
|
-
export default InitialiseFormWrapperForStorybook;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
import React from 'react';
|
|
19
|
-
import { BaseRenderer } from '../components';
|
|
20
|
-
import { QueryClientProvider } from '@tanstack/react-query';
|
|
21
|
-
import RendererThemeProvider from '../theme/Theme';
|
|
22
|
-
import useRendererQueryClient from '../hooks/useRendererQueryClient';
|
|
23
|
-
import useInitialiseForm from '../hooks/useInitialiseForm';
|
|
24
|
-
import Box from '@mui/material/Box';
|
|
25
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
|
26
|
-
import Typography from '@mui/material/Typography';
|
|
27
|
-
/**
|
|
28
|
-
* This is a one-to-one replacement for the SmartFormsRenderer for demo purposes.
|
|
29
|
-
* Instead of using this React component, define your own wrapper component that uses the BaseRenderer directly.
|
|
30
|
-
* Things to note:
|
|
31
|
-
* - It is required to wrap the BaseRenderer with the QueryClientProvider to make requests.
|
|
32
|
-
* - You can wrap the BaseRenderer with the RendererThemeProvider to apply the default renderer theme used in Smart Forms. Optionally, you can define your own ThemeProvider.
|
|
33
|
-
* - Make your buildForm() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form.
|
|
34
|
-
* - Make your own initialiseFhirClient() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form.
|
|
35
|
-
* - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities.
|
|
36
|
-
*
|
|
37
|
-
* For button click usage examples of buildForm(), see:
|
|
38
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonTesterWrapper.tsx#L47
|
|
39
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonForStorybook.tsx
|
|
40
|
-
*
|
|
41
|
-
* @author Sean Fong
|
|
42
|
-
*/
|
|
43
|
-
function InitialiseFormWrapperForStorybook(props) {
|
|
44
|
-
const { questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, fhirClient } = props;
|
|
45
|
-
// The renderer requires a @tanstack/react-query QueryClientProvider to make requests
|
|
46
|
-
const queryClient = useRendererQueryClient();
|
|
47
|
-
/**
|
|
48
|
-
* The useInitialiseForm hook provides initialisation logic for the form
|
|
49
|
-
* Alternatively (and recommended to do so), you can initialise your form via a button click or other event handler.
|
|
50
|
-
*
|
|
51
|
-
* @see {@link https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/BuildFormButtonForStorybook.tsx} for button click usage examples.
|
|
52
|
-
*/
|
|
53
|
-
const isInitialising = useInitialiseForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, fhirClient);
|
|
54
|
-
// Free feel to customise your loading animation here
|
|
55
|
-
if (isInitialising) {
|
|
56
|
-
return (React.createElement(Box, { display: "flex", alignItems: "center", columnGap: 2 },
|
|
57
|
-
React.createElement(CircularProgress, null),
|
|
58
|
-
React.createElement(Typography, null, "Loading questionnaire...")));
|
|
59
|
-
}
|
|
60
|
-
return (React.createElement(RendererThemeProvider, null,
|
|
61
|
-
React.createElement(QueryClientProvider, { client: queryClient },
|
|
62
|
-
React.createElement(BaseRenderer, null))));
|
|
63
|
-
}
|
|
64
|
-
export default InitialiseFormWrapperForStorybook;
|
|
65
|
-
//# sourceMappingURL=InitialiseFormWrapperForStorybook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InitialiseFormWrapperForStorybook.js","sourceRoot":"","sources":["../../src/stories/InitialiseFormWrapperForStorybook.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,aAAa;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,qBAAqB,MAAM,gBAAgB,CAAC;AACnD,OAAO,sBAAsB,MAAM,iCAAiC,CAAC;AAErE,OAAO,iBAAiB,MAAM,4BAA4B,CAAC;AAC3D,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAWlD;;;;;;;;;;;;;;;GAeG;AACH,SAAS,iCAAiC,CAAC,KAAiC;IAC1E,MAAM,EACJ,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACX,GAAG,KAAK,CAAC;IAEV,qFAAqF;IACrF,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAC;IAE7C;;;;;OAKG;IACH,MAAM,cAAc,GAAG,iBAAiB,CACtC,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,CACX,CAAC;IAEF,qDAAqD;IACrD,IAAI,cAAc,EAAE;QAClB,OAAO,CACL,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC;YAClD,oBAAC,gBAAgB,OAAG;YACpB,oBAAC,UAAU,mCAAsC,CAC7C,CACP,CAAC;KACH;IAED,OAAO,CACL,oBAAC,qBAAqB;QACpB,oBAAC,mBAAmB,IAAC,MAAM,EAAE,WAAW;YACtC,oBAAC,YAAY,OAAG,CACI,CACA,CACzB,CAAC;AACJ,CAAC;AAED,eAAe,iCAAiC,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/ import ThemeProvider from '../theme/Theme';
|
|
17
|
-
import { GroupTable } from '../components';
|
|
18
|
-
import GTableMedicalHistoryItemJson from './assets/QItems-and-QRItems/Q_GTableMedicalHistory.json';
|
|
19
|
-
import GTableMedicalHistoryAnswersJson from './assets/QItems-and-QRItems/QR_GTableMedicalHistory.json';
|
|
20
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
21
|
-
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
22
|
-
const meta = {
|
|
23
|
-
title: 'Component/GroupTable',
|
|
24
|
-
component: GroupTable,
|
|
25
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
|
|
26
|
-
tags: [],
|
|
27
|
-
decorators: [
|
|
28
|
-
(Story)=>/*#__PURE__*/ React.createElement(ThemeProvider, null, /*#__PURE__*/ React.createElement(QueryClientProvider, {
|
|
29
|
-
client: new QueryClient()
|
|
30
|
-
}, Story()))
|
|
31
|
-
]
|
|
32
|
-
};
|
|
33
|
-
const GTableMedicalHistoryItem = GTableMedicalHistoryItemJson;
|
|
34
|
-
const GTableMedicalHistoryAnswers = GTableMedicalHistoryAnswersJson;
|
|
35
|
-
export default meta;
|
|
36
|
-
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
|
|
37
|
-
export const MedicalHistoryTable = {
|
|
38
|
-
args: {
|
|
39
|
-
qItem: GTableMedicalHistoryItem,
|
|
40
|
-
qrItems: GTableMedicalHistoryAnswers,
|
|
41
|
-
groupCardElevation: 1,
|
|
42
|
-
parentIsReadOnly: false,
|
|
43
|
-
onQrRepeatGroupChange: ()=>{}
|
|
44
|
-
}
|
|
45
|
-
};
|