@aehrc/smart-forms-renderer 0.36.0 → 0.37.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/CHANGELOG.md +40 -0
- package/lib/components/FormComponents/Button.styles.d.ts +4 -0
- package/lib/components/FormComponents/Button.styles.js +10 -0
- package/lib/components/FormComponents/Button.styles.js.map +1 -0
- package/lib/components/FormComponents/GroupItem/GroupHeading.d.ts +1 -0
- package/lib/components/FormComponents/GroupItem/GroupHeading.js +3 -2
- package/lib/components/FormComponents/GroupItem/GroupHeading.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItem.d.ts +4 -0
- package/lib/components/FormComponents/GroupItem/GroupItem.js +3 -3
- package/lib/components/FormComponents/GroupItem/GroupItem.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemView.d.ts +4 -0
- package/lib/components/FormComponents/GroupItem/GroupItemView.js +8 -5
- package/lib/components/FormComponents/GroupItem/GroupItemView.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/NextPageButton.d.ts +7 -0
- package/lib/components/FormComponents/GroupItem/NextPageButton.js +26 -0
- package/lib/components/FormComponents/GroupItem/NextPageButton.js.map +1 -0
- package/lib/components/FormComponents/GroupItem/PageButtonWrapper.d.ts +8 -0
- package/lib/components/FormComponents/GroupItem/PageButtonWrapper.js +46 -0
- package/lib/components/FormComponents/GroupItem/PageButtonWrapper.js.map +1 -0
- package/lib/components/FormComponents/GroupItem/PreviousPageButton.d.ts +7 -0
- package/lib/components/FormComponents/GroupItem/PreviousPageButton.js +26 -0
- package/lib/components/FormComponents/GroupItem/PreviousPageButton.js.map +1 -0
- package/lib/components/Renderer/BaseRenderer.js +8 -0
- package/lib/components/Renderer/BaseRenderer.js.map +1 -1
- package/lib/components/Renderer/FormBodyPage.d.ts +9 -0
- package/lib/components/Renderer/FormBodyPage.js +43 -0
- package/lib/components/Renderer/FormBodyPage.js.map +1 -0
- package/lib/components/Renderer/FormTopLevelItem.js +7 -0
- package/lib/components/Renderer/FormTopLevelItem.js.map +1 -1
- package/lib/components/Renderer/FormTopLevelPage.d.ts +9 -0
- package/lib/components/Renderer/FormTopLevelPage.js +29 -0
- package/lib/components/Renderer/FormTopLevelPage.js.map +1 -0
- package/lib/hooks/useCodingCalculatedExpression.js +11 -0
- package/lib/hooks/useCodingCalculatedExpression.js.map +1 -1
- package/lib/hooks/useNextAndPreviousVisiblePages.d.ts +7 -0
- package/lib/hooks/useNextAndPreviousVisiblePages.js +47 -0
- package/lib/hooks/useNextAndPreviousVisiblePages.js.map +1 -0
- package/lib/interfaces/page.interface.d.ts +16 -0
- package/lib/interfaces/page.interface.js +2 -0
- package/lib/interfaces/page.interface.js.map +1 -0
- package/lib/interfaces/questionnaireStore.interface.d.ts +2 -0
- package/lib/stores/questionnaireStore.d.ts +13 -0
- package/lib/stores/questionnaireStore.js +19 -3
- package/lib/stores/questionnaireStore.js.map +1 -1
- package/lib/utils/calculatedExpression.js +1 -1
- package/lib/utils/calculatedExpression.js.map +1 -1
- package/lib/utils/fhirpath.js +0 -4
- package/lib/utils/fhirpath.js.map +1 -1
- package/lib/utils/initialise.d.ts +3 -0
- package/lib/utils/initialise.js +6 -1
- package/lib/utils/initialise.js.map +1 -1
- package/lib/utils/page.d.ts +43 -0
- package/lib/utils/page.js +101 -0
- package/lib/utils/page.js.map +1 -0
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +4 -0
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +1 -1
- package/lib/utils/questionnaireStoreUtils/extractPages.d.ts +3 -0
- package/lib/utils/questionnaireStoreUtils/extractPages.js +18 -0
- package/lib/utils/questionnaireStoreUtils/extractPages.js.map +1 -0
- package/package.json +4 -4
- package/src/components/FormComponents/Button.styles.ts +10 -0
- package/src/components/FormComponents/GroupItem/GroupHeading.tsx +5 -3
- package/src/components/FormComponents/GroupItem/GroupItem.tsx +11 -1
- package/src/components/FormComponents/GroupItem/GroupItemView.tsx +12 -0
- package/src/components/FormComponents/GroupItem/NextPageButton.tsx +37 -0
- package/src/components/FormComponents/GroupItem/PageButtonWrapper.tsx +78 -0
- package/src/components/FormComponents/GroupItem/PreviousPageButton.tsx +41 -0
- package/src/components/Renderer/BaseRenderer.tsx +21 -0
- package/src/components/Renderer/FormBodyPage.tsx +93 -0
- package/src/components/Renderer/FormTopLevelItem.tsx +17 -0
- package/src/components/Renderer/FormTopLevelPage.tsx +70 -0
- package/src/hooks/useCodingCalculatedExpression.ts +14 -1
- package/src/hooks/useNextAndPreviousVisiblePages.ts +69 -0
- package/src/interfaces/page.interface.ts +13 -0
- package/src/interfaces/questionnaireStore.interface.ts +2 -0
- package/src/stores/questionnaireStore.ts +33 -2
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreAllergyIntolerance.json +209 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreCondition.json +220 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreEncounter.json +299 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreImmunization.json +175 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreMedicationRequest.json +229 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBP.json +359 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBodyHeight.json +195 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationBodyWeight.json +195 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationHeartRate.json +195 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreObservationSmokingStatus.json +174 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePatient.json +495 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePractitioner.json +139 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCorePractitionerRole.json +216 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreProcedure.json +199 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreRespirationRate.json +195 -0
- package/src/stories/assets/questionnaires/AuCoreTestingJson/AuCoreWaistCircumference.json +195 -0
- package/src/stories/assets/questionnaires/QAuCoreTesting.ts +3796 -0
- package/src/stories/assets/questionnaires/QItemControlGroup.ts +673 -0
- package/src/stories/assets/questionnaires/QPrePopTester.ts +266 -71
- package/src/stories/sdc/ItemControlGroup.stories.tsx +22 -1
- package/src/stories/testing/AuCoreTester.stories.tsx +196 -0
- package/src/utils/calculatedExpression.ts +1 -1
- package/src/utils/fhirpath.ts +0 -5
- package/src/utils/initialise.ts +11 -0
- package/src/utils/page.ts +134 -0
- package/src/utils/questionnaireStoreUtils/createQuestionaireModel.ts +5 -0
- package/src/utils/questionnaireStoreUtils/extractPages.ts +24 -0
- package/stats.html +0 -4842
- package/stats1.html +0 -4842
- package/stats3.html +0 -4842
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#### 0.36.1 (2024-07-23)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* Add changelog_guide.md to .gitignore ([ca2a8558](https://github.com/aehrc/smart-forms/commit/ca2a85587592f681cb9db6501bafff3c663a7bd6))
|
|
6
|
+
|
|
7
|
+
##### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* retrieve new encounter for re-population ([652b2d03](https://github.com/aehrc/smart-forms/commit/652b2d03cd9eb500bd2182be6236a1c920e9bc66))
|
|
10
|
+
|
|
11
|
+
##### Other Changes
|
|
12
|
+
|
|
13
|
+
* //smartforms.csiro.au/api/fhir' env to deployed $assemble ([dfef7f57](https://github.com/aehrc/smart-forms/commit/dfef7f57259ff80ad3b94bcd0ac0792ff6c28ab2))
|
|
14
|
+
* disable Format JSON button when editor is not in view ([d7792c35](https://github.com/aehrc/smart-forms/commit/d7792c359742302baf939b4bd7a2c8e5298139d1))
|
|
15
|
+
* true to renderer ([82fc29b5](https://github.com/aehrc/smart-forms/commit/82fc29b5bf9a87176d57a6661a330b7a61bbace5))
|
|
16
|
+
* true ([c5cfb692](https://github.com/aehrc/smart-forms/commit/c5cfb6923d97358b1f6e5f376360d29fca5bb1e6))
|
|
17
|
+
* //jira.hl7.org/browse/FHIR-41279 ([8c44bb8b](https://github.com/aehrc/smart-forms/commit/8c44bb8b62486c30df94c97e9b757eb2abc1a9cf))
|
|
18
|
+
* 3000 cypress tests ([c62388f3](https://github.com/aehrc/smart-forms/commit/c62388f385afa2f8901a306c42ccc13211f242b1))
|
|
19
|
+
* 3000 ([9934f7b9](https://github.com/aehrc/smart-forms/commit/9934f7b9cf74be622314f9b51113ef92d2ae0886))
|
|
20
|
+
* 3001 ([e701352b](https://github.com/aehrc/smart-forms/commit/e701352b7123e91cea8646648e0dd8cefbe0ed71))
|
|
21
|
+
* Remove out-of-place-looking debug bar label ([b4990852](https://github.com/aehrc/smart-forms/commit/b4990852d7f24289bda7b9a59b4c020fad68e0cf))
|
|
22
|
+
* Fix form rendering ([36baf7b1](https://github.com/aehrc/smart-forms/commit/36baf7b14df73f1c998fad08ee0d4e42e026536a))
|
|
23
|
+
* Testfeature enableWhen checks toggle ([160635a3](https://github.com/aehrc/smart-forms/commit/160635a303e02f4442cf6e8a8e1c00bebf18b151))
|
|
24
|
+
* Add text display prompt and instructions functionality ([67d67452](https://github.com/aehrc/smart-forms/commit/67d6745204832934d26a138f5ecc277448411873))
|
|
25
|
+
* Feature enablewhen ([b79c9190](https://github.com/aehrc/smart-forms/commit/b79c919048075ecd3bc45ba3e54aa034433f2c24))
|
|
26
|
+
* Feature calculated expressions ([065db5cb](https://github.com/aehrc/smart-forms/commit/065db5cbaa9d6cadb9090e8ba9e1c73d5ecadcd8))
|
|
27
|
+
* Feature smart launch from launch route ([1fc1aad3](https://github.com/aehrc/smart-forms/commit/1fc1aad375ff315e2183888b1235e261638c2ef8))
|
|
28
|
+
* Refactor form components ([1ec14063](https://github.com/aehrc/smart-forms/commit/1ec140633cffa9a8aed98d4520c0b2314dff4186))
|
|
29
|
+
* Refactor form components ([a9cdd6dc](https://github.com/aehrc/smart-forms/commit/a9cdd6dc9056ad325174f07b9c5dc6123a38c4e8))
|
|
30
|
+
* Feature tabs v2 ([c94a5739](https://github.com/aehrc/smart-forms/commit/c94a5739c073b1959c6536c1a060121392fdb43a))
|
|
31
|
+
* Add QItemTime form component ([a6594ac7](https://github.com/aehrc/smart-forms/commit/a6594ac75bd3c70e9f9a341284cacdba1c36c910))
|
|
32
|
+
* Fix use fhir r5 specification ([d7985657](https://github.com/aehrc/smart-forms/commit/d798565725b528539fc1afa01aa7da10ed80e232))
|
|
33
|
+
* Fix base Choice form component pass orientation props ([64481d0e](https://github.com/aehrc/smart-forms/commit/64481d0e1f2c6420c29c15ea19c3ddad1231de3a))
|
|
34
|
+
* Implement choice orientation ([c668add9](https://github.com/aehrc/smart-forms/commit/c668add9e6ecb326e7ac8499ab994fd394679d4c))
|
|
35
|
+
* Feature hidden questions ([83e978ea](https://github.com/aehrc/smart-forms/commit/83e978eaa1ee831e7a7406e7bb8e1d9d62812916))
|
|
36
|
+
* Feature repeats ([13acda31](https://github.com/aehrc/smart-forms/commit/13acda310dd997c9368aad0413e8b57794dc7338))
|
|
37
|
+
* Feature form components ([975ad066](https://github.com/aehrc/smart-forms/commit/975ad06649ed300b299831e95ffe265766fa7495))
|
|
38
|
+
* Fix write questionnaire response ([aae2595d](https://github.com/aehrc/smart-forms/commit/aae2595d722e6522fb992a90ccf0df09b91410f0))
|
|
39
|
+
* Feature read write questionnaire response ([cc851a35](https://github.com/aehrc/smart-forms/commit/cc851a3534ea7073c5a4438590e8a7dd8231f922))
|
|
40
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SecondaryFab: import("@emotion/styled").StyledComponent<import("@mui/material/Fab").FabOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
4
|
+
}, "disabled" | "style" | "color" | "children" | "href" | "className" | "tabIndex" | "sx" | "classes" | "action" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
|
+
import Fab from '@mui/material/Fab';
|
|
3
|
+
export const SecondaryFab = styled(Fab)(({ theme }) => ({
|
|
4
|
+
color: '#fff',
|
|
5
|
+
background: theme.palette.secondary.main,
|
|
6
|
+
'&:hover': {
|
|
7
|
+
background: theme.palette.secondary.dark
|
|
8
|
+
}
|
|
9
|
+
}));
|
|
10
|
+
//# sourceMappingURL=Button.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.styles.js","sourceRoot":"","sources":["../../../src/components/FormComponents/Button.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,GAAG,MAAM,mBAAmB,CAAC;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACtD,KAAK,EAAE,MAAM;IACb,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI;IACxC,SAAS,EAAE;QACT,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI;KACzC;CACF,CAAC,CAAC,CAAC"}
|
|
@@ -5,6 +5,7 @@ interface GroupHeadingProps extends PropsWithIsRepeatedAttribute {
|
|
|
5
5
|
qItem: QuestionnaireItem;
|
|
6
6
|
readOnly: boolean;
|
|
7
7
|
tabIsMarkedAsComplete?: boolean;
|
|
8
|
+
pageIsMarkedAsComplete?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const GroupHeading: React.NamedExoticComponent<GroupHeadingProps>;
|
|
10
11
|
export default GroupHeading;
|
|
@@ -22,15 +22,16 @@ import { getContextDisplays } from '../../../utils/tabs';
|
|
|
22
22
|
import ContextDisplayItem from '../ItemParts/ContextDisplayItem';
|
|
23
23
|
import ItemLabelText from '../ItemParts/ItemLabelText';
|
|
24
24
|
const GroupHeading = memo(function GroupHeading(props) {
|
|
25
|
-
const { qItem, readOnly, tabIsMarkedAsComplete, isRepeated } = props;
|
|
25
|
+
const { qItem, readOnly, tabIsMarkedAsComplete, pageIsMarkedAsComplete, isRepeated } = props;
|
|
26
26
|
const contextDisplayItems = getContextDisplays(qItem);
|
|
27
27
|
if (isRepeated) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
const isTabHeading = tabIsMarkedAsComplete !== undefined;
|
|
31
|
+
const isPageHeading = pageIsMarkedAsComplete !== undefined;
|
|
31
32
|
return (React.createElement(React.Fragment, null,
|
|
32
33
|
React.createElement(Box, { display: "flex", alignItems: "center", width: "100%" },
|
|
33
|
-
React.createElement(Typography, { variant: "h6", fontSize: isTabHeading ? 16 : 15, color: readOnly && !isTabHeading ? 'text.secondary' : 'text.primary' },
|
|
34
|
+
React.createElement(Typography, { variant: "h6", fontSize: isTabHeading || isPageHeading ? 16 : 15, color: readOnly && (!isTabHeading || !isPageHeading) ? 'text.secondary' : 'text.primary' },
|
|
34
35
|
React.createElement(ItemLabelText, { qItem: qItem })),
|
|
35
36
|
React.createElement(Box, { flexGrow: 1 }),
|
|
36
37
|
React.createElement(Box, { display: "flex", columnGap: 0.5, mx: 1 }, contextDisplayItems.map((item) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupHeading.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupHeading.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,kBAAkB,MAAM,iCAAiC,CAAC;AACjE,OAAO,aAAa,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"GroupHeading.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupHeading.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,kBAAkB,MAAM,iCAAiC,CAAC;AACjE,OAAO,aAAa,MAAM,4BAA4B,CAAC;AASvD,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,YAAY,CAAC,KAAwB;IACtE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAE7F,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAEtD,IAAI,UAAU,EAAE;QACd,OAAO,IAAI,CAAC;KACb;IAED,MAAM,YAAY,GAAG,qBAAqB,KAAK,SAAS,CAAC;IACzD,MAAM,aAAa,GAAG,sBAAsB,KAAK,SAAS,CAAC;IAE3D,OAAO,CACL;QACE,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,KAAK,EAAC,MAAM;YAClD,oBAAC,UAAU,IACT,OAAO,EAAC,IAAI,EACZ,QAAQ,EAAE,YAAY,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EACjD,KAAK,EAAE,QAAQ,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc;gBACxF,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK,GAAI,CACpB;YACb,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,GAAI;YACpB,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,IACtC,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBAChC,OAAO,oBAAC,kBAAkB,IAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,GAAI,CAAC;YACrE,CAAC,CAAC,CACE,CACF;QACL,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,OAAO,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,KAAK,SAAG,CAAC,CAAC,CAAC,IAAI,CAC7D,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
3
3
|
import type { PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithParentIsRepeatGroupAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
4
4
|
import type { Tabs } from '../../../interfaces/tab.interface';
|
|
5
|
+
import type { Pages } from '../../../interfaces/page.interface';
|
|
5
6
|
interface GroupItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithParentIsRepeatGroupAttribute {
|
|
6
7
|
qItem: QuestionnaireItem;
|
|
7
8
|
qrItem: QuestionnaireResponseItem | null;
|
|
@@ -9,6 +10,9 @@ interface GroupItemProps extends PropsWithQrItemChangeHandler, PropsWithIsRepeat
|
|
|
9
10
|
tabIsMarkedAsComplete?: boolean;
|
|
10
11
|
tabs?: Tabs;
|
|
11
12
|
currentTabIndex?: number;
|
|
13
|
+
pageIsMarkedAsComplete?: boolean;
|
|
14
|
+
pages?: Pages;
|
|
15
|
+
currentPageIndex?: number;
|
|
12
16
|
}
|
|
13
17
|
declare function GroupItem(props: GroupItemProps): React.JSX.Element | null;
|
|
14
18
|
export default GroupItem;
|
|
@@ -20,7 +20,7 @@ import { createEmptyQrGroup, updateQrItemsInGroup } from '../../../utils/qrItem'
|
|
|
20
20
|
import useHidden from '../../../hooks/useHidden';
|
|
21
21
|
import GroupItemView from './GroupItemView';
|
|
22
22
|
function GroupItem(props) {
|
|
23
|
-
const { qItem, qrItem, isRepeated, groupCardElevation, tabIsMarkedAsComplete, tabs, currentTabIndex, parentIsReadOnly, parentIsRepeatGroup, parentRepeatGroupIndex, onQrItemChange } = props;
|
|
23
|
+
const { qItem, qrItem, isRepeated, groupCardElevation, tabIsMarkedAsComplete, tabs, currentTabIndex, pageIsMarkedAsComplete, pages, currentPageIndex, parentIsReadOnly, parentIsRepeatGroup, parentRepeatGroupIndex, onQrItemChange } = props;
|
|
24
24
|
const qItemsIndexMap = useMemo(() => mapQItemsIndex(qItem), [qItem]);
|
|
25
25
|
const itemIsHidden = useHidden(qItem, parentRepeatGroupIndex);
|
|
26
26
|
if (itemIsHidden) {
|
|
@@ -41,11 +41,11 @@ function GroupItem(props) {
|
|
|
41
41
|
onQrItemChange(updatedQrGroup);
|
|
42
42
|
}
|
|
43
43
|
if (!qItems || !qrItems) {
|
|
44
|
-
return React.createElement(React.Fragment, null, "Unable to load group, something has gone terribly wrong.");
|
|
44
|
+
return React.createElement(React.Fragment, null, "Group Item: Unable to load group, something has gone terribly wrong.");
|
|
45
45
|
}
|
|
46
46
|
// If an item has multiple answers, it is a repeat group
|
|
47
47
|
const qrItemsByIndex = getQrItemsIndex(qItems, qrItems, qItemsIndexMap);
|
|
48
|
-
return (React.createElement(GroupItemView, { qItem: qItem, childQItems: qItems, qrItemsByIndex: qrItemsByIndex, isRepeated: isRepeated, groupCardElevation: groupCardElevation, tabIsMarkedAsComplete: tabIsMarkedAsComplete, tabs: tabs, currentTabIndex: currentTabIndex, parentIsReadOnly: parentIsReadOnly, parentIsRepeatGroup: parentIsRepeatGroup, parentRepeatGroupIndex: parentRepeatGroupIndex, onQrItemChange: handleQrItemChange, onQrRepeatGroupChange: handleQrRepeatGroupChange }));
|
|
48
|
+
return (React.createElement(GroupItemView, { qItem: qItem, childQItems: qItems, qrItemsByIndex: qrItemsByIndex, isRepeated: isRepeated, groupCardElevation: groupCardElevation, tabIsMarkedAsComplete: tabIsMarkedAsComplete, tabs: tabs, currentTabIndex: currentTabIndex, pageIsMarkedAsComplete: pageIsMarkedAsComplete, pages: pages, currentPageIndex: currentPageIndex, parentIsReadOnly: parentIsReadOnly, parentIsRepeatGroup: parentIsRepeatGroup, parentRepeatGroupIndex: parentRepeatGroupIndex, onQrItemChange: handleQrItemChange, onQrRepeatGroupChange: handleQrRepeatGroupChange }));
|
|
49
49
|
}
|
|
50
50
|
export default GroupItem;
|
|
51
51
|
//# sourceMappingURL=GroupItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAe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+2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
3
3
|
import type { PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithParentIsRepeatGroupAttribute, PropsWithQrItemChangeHandler, PropsWithQrRepeatGroupChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
4
4
|
import type { Tabs } from '../../../interfaces/tab.interface';
|
|
5
|
+
import type { Pages } from '../../../interfaces/page.interface';
|
|
5
6
|
interface GroupItemViewProps extends PropsWithQrItemChangeHandler, PropsWithQrRepeatGroupChangeHandler, PropsWithIsRepeatedAttribute, PropsWithParentIsReadOnlyAttribute, PropsWithParentIsRepeatGroupAttribute {
|
|
6
7
|
qItem: QuestionnaireItem;
|
|
7
8
|
childQItems: QuestionnaireItem[];
|
|
@@ -10,6 +11,9 @@ interface GroupItemViewProps extends PropsWithQrItemChangeHandler, PropsWithQrRe
|
|
|
10
11
|
tabIsMarkedAsComplete?: boolean;
|
|
11
12
|
tabs?: Tabs;
|
|
12
13
|
currentTabIndex?: number;
|
|
14
|
+
pageIsMarkedAsComplete?: boolean;
|
|
15
|
+
pages?: Pages;
|
|
16
|
+
currentPageIndex?: number;
|
|
13
17
|
}
|
|
14
18
|
declare function GroupItemView(props: GroupItemViewProps): React.JSX.Element;
|
|
15
19
|
export default GroupItemView;
|
|
@@ -27,8 +27,9 @@ import Divider from '@mui/material/Divider';
|
|
|
27
27
|
import { getGroupCollapsible } from '../../../utils/qItem';
|
|
28
28
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
29
29
|
import { GroupAccordion } from './GroupAccordion.styles';
|
|
30
|
+
import PageButtonsWrapper from './PageButtonWrapper';
|
|
30
31
|
function GroupItemView(props) {
|
|
31
|
-
const { qItem, childQItems, qrItemsByIndex, isRepeated, groupCardElevation, tabIsMarkedAsComplete, tabs, currentTabIndex, parentIsReadOnly, parentIsRepeatGroup, parentRepeatGroupIndex, onQrItemChange, onQrRepeatGroupChange } = props;
|
|
32
|
+
const { qItem, childQItems, qrItemsByIndex, isRepeated, groupCardElevation, tabIsMarkedAsComplete, tabs, currentTabIndex, pageIsMarkedAsComplete, pages, currentPageIndex, parentIsReadOnly, parentIsRepeatGroup, parentRepeatGroupIndex, onQrItemChange, onQrRepeatGroupChange } = props;
|
|
32
33
|
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
33
34
|
// Render collapsible group item
|
|
34
35
|
// If group item is a repeating instance, do not render group item as collapsible
|
|
@@ -39,7 +40,7 @@ function GroupItemView(props) {
|
|
|
39
40
|
transition: { unmountOnExit: true, timeout: 250 }
|
|
40
41
|
} },
|
|
41
42
|
React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, null), sx: { minHeight: '28px' } },
|
|
42
|
-
React.createElement(GroupHeading, { qItem: qItem, readOnly: readOnly, tabIsMarkedAsComplete: tabIsMarkedAsComplete, isRepeated: isRepeated })),
|
|
43
|
+
React.createElement(GroupHeading, { qItem: qItem, readOnly: readOnly, tabIsMarkedAsComplete: tabIsMarkedAsComplete, pageIsMarkedAsComplete: pageIsMarkedAsComplete, isRepeated: isRepeated })),
|
|
43
44
|
React.createElement(AccordionDetails, { sx: { pt: 0 } },
|
|
44
45
|
qItem.text ? React.createElement(Divider, { sx: { mb: 1.5 }, light: true }) : null,
|
|
45
46
|
React.createElement(React.Fragment, null,
|
|
@@ -47,16 +48,18 @@ function GroupItemView(props) {
|
|
|
47
48
|
const qrItemOrItems = qrItemsByIndex[i];
|
|
48
49
|
return (React.createElement(GroupItemSwitcher, { key: qItem.linkId, qItem: qItem, qrItemOrItems: qrItemOrItems, groupCardElevation: groupCardElevation, parentIsReadOnly: readOnly, parentIsRepeatGroup: parentIsRepeatGroup, parentRepeatGroupIndex: parentRepeatGroupIndex, onQrItemChange: onQrItemChange, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
49
50
|
}),
|
|
50
|
-
React.createElement(TabButtonsWrapper, { currentTabIndex: currentTabIndex, tabs: tabs })
|
|
51
|
+
React.createElement(TabButtonsWrapper, { currentTabIndex: currentTabIndex, tabs: tabs }),
|
|
52
|
+
React.createElement(PageButtonsWrapper, { currentPageIndex: currentPageIndex, pages: pages })))));
|
|
51
53
|
}
|
|
52
54
|
return (React.createElement(QGroupContainerBox, { cardElevation: groupCardElevation, isRepeated: isRepeated, "data-test": "q-item-group-box" },
|
|
53
55
|
React.createElement(GroupCard, { elevation: groupCardElevation, isRepeated: isRepeated },
|
|
54
|
-
React.createElement(GroupHeading, { qItem: qItem, readOnly: readOnly, tabIsMarkedAsComplete: tabIsMarkedAsComplete, isRepeated: isRepeated }),
|
|
56
|
+
React.createElement(GroupHeading, { qItem: qItem, readOnly: readOnly, tabIsMarkedAsComplete: tabIsMarkedAsComplete, pageIsMarkedAsComplete: pageIsMarkedAsComplete, isRepeated: isRepeated }),
|
|
55
57
|
childQItems.map((qItem, i) => {
|
|
56
58
|
const qrItemOrItems = qrItemsByIndex[i];
|
|
57
59
|
return (React.createElement(GroupItemSwitcher, { key: qItem.linkId, qItem: qItem, qrItemOrItems: qrItemOrItems, groupCardElevation: groupCardElevation, parentIsReadOnly: readOnly, parentIsRepeatGroup: parentIsRepeatGroup, parentRepeatGroupIndex: parentRepeatGroupIndex, onQrItemChange: onQrItemChange, onQrRepeatGroupChange: onQrRepeatGroupChange }));
|
|
58
60
|
}),
|
|
59
|
-
React.createElement(TabButtonsWrapper, { currentTabIndex: currentTabIndex, tabs: tabs })
|
|
61
|
+
React.createElement(TabButtonsWrapper, { currentTabIndex: currentTabIndex, tabs: tabs }),
|
|
62
|
+
React.createElement(PageButtonsWrapper, { currentPageIndex: currentPageIndex, pages: pages }))));
|
|
60
63
|
}
|
|
61
64
|
export default GroupItemView;
|
|
62
65
|
//# sourceMappingURL=GroupItemView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupItemView.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupItemView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"GroupItemView.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/GroupItemView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAUtD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,cAAc,MAAM,gCAAgC,CAAC;AAC5D,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,kBAAkB,MAAM,qBAAqB,CAAC;AAoBrD,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,EACJ,KAAK,EACL,WAAW,EACX,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,IAAI,EACJ,eAAe,EACf,sBAAsB,EACtB,KAAK,EACL,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACtB,GAAG,KAAK,CAAC;IAEV,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;I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AAI,CAC9D,CACO,CACtB,CAAC;AACJ,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 React from 'react';
|
|
18
|
+
import Iconify from '../../Iconify/Iconify';
|
|
19
|
+
import { SecondaryFab } from '../Button.styles';
|
|
20
|
+
function NextPageButton(props) {
|
|
21
|
+
const { isDisabled, onNextPageClick } = props;
|
|
22
|
+
return (React.createElement(SecondaryFab, { size: "small", "aria-label": "next", disabled: isDisabled, onClick: onNextPageClick },
|
|
23
|
+
React.createElement(Iconify, { icon: "material-symbols:chevron-right-rounded" })));
|
|
24
|
+
}
|
|
25
|
+
export default NextPageButton;
|
|
26
|
+
//# sourceMappingURL=NextPageButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NextPageButton.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/NextPageButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOhD,SAAS,cAAc,CAAC,KAA0B;IAChD,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAE9C,OAAO,CACL,oBAAC,YAAY,IAAC,IAAI,EAAC,OAAO,gBAAY,MAAM,EAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe;QACzF,oBAAC,OAAO,IAAC,IAAI,EAAC,wCAAwC,GAAG,CAC5C,CAChB,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Pages } from '../../../interfaces/page.interface';
|
|
3
|
+
interface PageButtonsWrapperProps {
|
|
4
|
+
currentPageIndex?: number;
|
|
5
|
+
pages?: Pages;
|
|
6
|
+
}
|
|
7
|
+
declare const PageButtonsWrapper: React.NamedExoticComponent<PageButtonsWrapperProps>;
|
|
8
|
+
export default PageButtonsWrapper;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
5
|
+
import NextPageButton from './NextPageButton';
|
|
6
|
+
import PreviousPageButton from './PreviousPageButton';
|
|
7
|
+
import useNextAndPreviousVisiblePages from '../../../hooks/useNextAndPreviousVisiblePages';
|
|
8
|
+
const PageButtonsWrapper = memo(function PageButtonsWrapper(props) {
|
|
9
|
+
const { currentPageIndex, pages } = props;
|
|
10
|
+
const switchPage = useQuestionnaireStore.use.switchPage();
|
|
11
|
+
const { previousPageIndex, nextPageIndex, numOfVisiblePages } = useNextAndPreviousVisiblePages(currentPageIndex, pages);
|
|
12
|
+
const pagesNotDefined = currentPageIndex === undefined || pages === undefined;
|
|
13
|
+
// Event handlers
|
|
14
|
+
function handlePreviousPageButtonClick() {
|
|
15
|
+
if (previousPageIndex === null) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
switchPage(previousPageIndex);
|
|
19
|
+
// Scroll to top of page
|
|
20
|
+
window.scrollTo(0, 0);
|
|
21
|
+
}
|
|
22
|
+
function handleNextPageButtonClick() {
|
|
23
|
+
if (nextPageIndex === null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
switchPage(nextPageIndex);
|
|
27
|
+
// Scroll to top of page
|
|
28
|
+
window.scrollTo(0, 0);
|
|
29
|
+
}
|
|
30
|
+
if (pagesNotDefined) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const previousPageButtonHidden = previousPageIndex === null;
|
|
34
|
+
const nextPageButtonHidden = nextPageIndex === null;
|
|
35
|
+
// This is more of a fallback check to prevent the user from navigating to an invisble page if buttons are visble for some reason
|
|
36
|
+
const pageButtonsDisabled = numOfVisiblePages <= 1;
|
|
37
|
+
return (React.createElement(Box, { display: "flex", mt: 3, gap: 2, alignItems: "center" },
|
|
38
|
+
React.createElement(Box, { flexGrow: 1 }),
|
|
39
|
+
React.createElement(Typography, { variant: "subtitle2", color: "text.secondary" },
|
|
40
|
+
"Page ",
|
|
41
|
+
`${currentPageIndex + 1} / ${numOfVisiblePages}`),
|
|
42
|
+
React.createElement(PreviousPageButton, { isDisabled: pageButtonsDisabled || previousPageButtonHidden, onPreviousPageClick: handlePreviousPageButtonClick }),
|
|
43
|
+
React.createElement(NextPageButton, { isDisabled: pageButtonsDisabled || nextPageButtonHidden, onNextPageClick: handleNextPageButtonClick })));
|
|
44
|
+
});
|
|
45
|
+
export default PageButtonsWrapper;
|
|
46
|
+
//# sourceMappingURL=PageButtonWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageButtonWrapper.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/PageButtonWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,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B,GAAG,iBAAiB,IAAI,CAAC,CAAC;IAEnD,OAAO,CACL,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAC,QAAQ;QACpD,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,GAAI;QACpB,oBAAC,UAAU,IAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,gBAAgB;;YAC9C,GAAG,gBAAgB,GAAG,CAAC,MAAM,iBAAiB,EAAE,CAC3C;QACb,oBAAC,kBAAkB,IACjB,UAAU,EAAE,mBAAmB,IAAI,wBAAwB,EAC3D,mBAAmB,EAAE,6BAA6B,GAClD;QACF,oBAAC,cAAc,IACb,UAAU,EAAE,mBAAmB,IAAI,oBAAoB,EACvD,eAAe,EAAE,yBAAyB,GAC1C,CACE,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 React from 'react';
|
|
18
|
+
import Iconify from '../../Iconify/Iconify';
|
|
19
|
+
import { SecondaryFab } from '../Button.styles';
|
|
20
|
+
function PreviousPageButton(props) {
|
|
21
|
+
const { isDisabled, onPreviousPageClick } = props;
|
|
22
|
+
return (React.createElement(SecondaryFab, { size: "small", "aria-label": "back", disabled: isDisabled, onClick: onPreviousPageClick },
|
|
23
|
+
React.createElement(Iconify, { icon: "material-symbols:chevron-left-rounded" })));
|
|
24
|
+
}
|
|
25
|
+
export default PreviousPageButton;
|
|
26
|
+
//# sourceMappingURL=PreviousPageButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviousPageButton.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/GroupItem/PreviousPageButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOhD,SAAS,kBAAkB,CAAC,KAA8B;IACxD,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IAElD,OAAO,CACL,oBAAC,YAAY,IACX,IAAI,EAAC,OAAO,gBACD,MAAM,EACjB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,mBAAmB;QAC5B,oBAAC,OAAO,IAAC,IAAI,EAAC,uCAAuC,GAAG,CAC3C,CAChB,CAAC;AACJ,CAAC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -22,6 +22,8 @@ import { useQuestionnaireResponseStore, useQuestionnaireStore } from '../../stor
|
|
|
22
22
|
import cloneDeep from 'lodash.clonedeep';
|
|
23
23
|
import { getQrItemsIndex, mapQItemsIndex } from '../../utils/mapItem';
|
|
24
24
|
import { updateQrItemsInGroup } from '../../utils/qrItem';
|
|
25
|
+
import { everyIsPages } from '../../utils/page';
|
|
26
|
+
import FormTopLevelPage from './FormTopLevelPage';
|
|
25
27
|
/**
|
|
26
28
|
* Main component of the form-rendering engine.
|
|
27
29
|
* Renders the Questionnaire and QuestionnaireResponse defined in the state management stores QuestionnaireStore and QuestionnaireResponseStore respectively.
|
|
@@ -59,6 +61,12 @@ function BaseRenderer() {
|
|
|
59
61
|
}
|
|
60
62
|
// If an item has multiple answers, it is a repeat group
|
|
61
63
|
const topLevelQRItemsByIndex = getQrItemsIndex(topLevelQItems, topLevelQRItems, qItemsIndexMap);
|
|
64
|
+
const everyItemIsPage = everyIsPages(topLevelQItems);
|
|
65
|
+
if (everyItemIsPage) {
|
|
66
|
+
return (React.createElement(Fade, { in: true, timeout: 500 },
|
|
67
|
+
React.createElement(Container, { maxWidth: "xl" },
|
|
68
|
+
React.createElement(FormTopLevelPage, { topLevelQItems: topLevelQItems, topLevelQRItems: topLevelQRItemsByIndex, parentIsReadOnly: readOnly, onQrItemChange: (newTopLevelQRItem) => handleTopLevelQRItemSingleChange(newTopLevelQRItem) }))));
|
|
69
|
+
}
|
|
62
70
|
return (React.createElement(Fade, { in: true, timeout: 500 },
|
|
63
71
|
React.createElement(Container, { maxWidth: "xl" }, topLevelQItems.map((qItem, index) => {
|
|
64
72
|
const qrItemOrItems = topLevelQRItemsByIndex[index];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseRenderer.js","sourceRoot":"","sources":["../../../src/components/Renderer/BaseRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oB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,CAAC,iBAAiB,EAAE,EAAE,CACpC,gCAAgC,CAAC,iBAAiB,CAAC,GAErD,CACQ,CACP,CACR,CAAC;KACH;IAED,OAAO,CACL,oBAAC,IAAI,IAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG;QAC1B,oBAAC,SAAS,IAAC,QAAQ,EAAC,IAAI,IACrB,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACnC,MAAM,aAAa,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAEpD,OAAO,CACL,oBAAC,gBAAgB,IACf,GAAG,EAAE,KAAK,CAAC,MAAM,EACjB,aAAa,EAAE,KAAK,EACpB,qBAAqB,EAAE,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,IAAI,EAC5C,gBAAgB,EAAE,QAAQ,EAC1B,cAAc,EAAE,CAAC,iBAAiB,EAAE,EAAE,CACpC,gCAAgC,CAAC,iBAAiB,CAAC,EAErD,qBAAqB,EAAE,CAAC,kBAAkB,EAAE,EAAE,CAC5C,kCAAkC,CAAC,kBAAkB,CAAC,GAExD,CACH,CAAC;QACJ,CAAC,CAAC,CACQ,CACP,CACR,CAAC;AACJ,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
3
|
+
import type { PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../interfaces/renderProps.interface';
|
|
4
|
+
interface FormBodyPageProps extends PropsWithQrItemChangeHandler, PropsWithParentIsReadOnlyAttribute {
|
|
5
|
+
topLevelQItem: QuestionnaireItem;
|
|
6
|
+
topLevelQRItem: QuestionnaireResponseItem | null;
|
|
7
|
+
}
|
|
8
|
+
declare function FormBodyPage(props: FormBodyPageProps): React.JSX.Element;
|
|
9
|
+
export default FormBodyPage;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import Grid from '@mui/material/Grid';
|
|
3
|
+
import TabContext from '@mui/lab/TabContext';
|
|
4
|
+
import TabPanel from '@mui/lab/TabPanel';
|
|
5
|
+
import GroupItem from '../FormComponents/GroupItem/GroupItem';
|
|
6
|
+
import { useQuestionnaireStore } from '../../stores';
|
|
7
|
+
import { getQrItemsIndex, mapQItemsIndex } from '../../utils/mapItem';
|
|
8
|
+
import { createEmptyQrGroup, updateQrItemsInGroup } from '../../utils/qrItem';
|
|
9
|
+
function FormBodyPage(props) {
|
|
10
|
+
const { topLevelQItem, topLevelQRItem, parentIsReadOnly, onQrItemChange } = props;
|
|
11
|
+
const pages = useQuestionnaireStore.use.pages();
|
|
12
|
+
const currentPage = useQuestionnaireStore.use.currentPageIndex();
|
|
13
|
+
const indexMap = useMemo(() => mapQItemsIndex(topLevelQItem), [topLevelQItem]);
|
|
14
|
+
const nonNullTopLevelQRItem = topLevelQRItem !== null && topLevelQRItem !== void 0 ? topLevelQRItem : createEmptyQrGroup(topLevelQItem);
|
|
15
|
+
const qItems = topLevelQItem.item;
|
|
16
|
+
const qrItems = nonNullTopLevelQRItem.item;
|
|
17
|
+
function handleQrGroupChange(qrItem) {
|
|
18
|
+
updateQrItemsInGroup(qrItem, null, nonNullTopLevelQRItem, indexMap);
|
|
19
|
+
onQrItemChange(nonNullTopLevelQRItem);
|
|
20
|
+
}
|
|
21
|
+
if (!qItems || !qrItems) {
|
|
22
|
+
return React.createElement(React.Fragment, null, "Unable to load form");
|
|
23
|
+
}
|
|
24
|
+
const qrItemsByIndex = getQrItemsIndex(qItems, qrItems, indexMap);
|
|
25
|
+
return (React.createElement(Grid, { container: true, spacing: 1.5 },
|
|
26
|
+
React.createElement(TabContext, { value: currentPage.toString() },
|
|
27
|
+
React.createElement(Grid, { item: true, xs: 12, md: 12, lg: 12 }, qItems.map((qItem, i) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const qrItem = qrItemsByIndex[i];
|
|
30
|
+
const isNotRepeatGroup = !Array.isArray(qrItem);
|
|
31
|
+
const isPage = !!pages[qItem.linkId];
|
|
32
|
+
if (!isPage || !isNotRepeatGroup) {
|
|
33
|
+
// Something has gone horribly wrong
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const isRepeated = (_a = qItem.repeats) !== null && _a !== void 0 ? _a : false;
|
|
37
|
+
const pageIsMarkedAsComplete = (_b = pages[qItem.linkId].isComplete) !== null && _b !== void 0 ? _b : false;
|
|
38
|
+
return (React.createElement(TabPanel, { key: qItem.linkId, sx: { p: 0 }, value: i.toString(), "data-test": "renderer-page-panel" },
|
|
39
|
+
React.createElement(GroupItem, { qItem: qItem, qrItem: qrItem !== null && qrItem !== void 0 ? qrItem : null, isRepeated: isRepeated, groupCardElevation: 1, pageIsMarkedAsComplete: pageIsMarkedAsComplete, pages: pages, currentPageIndex: currentPage, parentIsReadOnly: parentIsReadOnly, onQrItemChange: handleQrGroupChange })));
|
|
40
|
+
})))));
|
|
41
|
+
}
|
|
42
|
+
export default FormBodyPage;
|
|
43
|
+
//# sourceMappingURL=FormBodyPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormBodyPage.js","sourceRoot":"","sources":["../../../src/components/Renderer/FormBodyPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAK9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AA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CAAC,CAAC,CAAC;gBAEjC,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAChD,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAErC,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,EAAE;oBAChC,oCAAoC;oBACpC,OAAO,IAAI,CAAC;iBACb;gBAED,MAAM,UAAU,GAAG,MAAA,KAAK,CAAC,OAAO,mCAAI,KAAK,CAAC;gBAC1C,MAAM,sBAAsB,GAAG,MAAA,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,UAAU,mCAAI,KAAK,CAAC;gBAEvE,OAAO,CACL,oBAAC,QAAQ,IACP,GAAG,EAAE,KAAK,CAAC,MAAM,EACjB,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EACZ,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,eACT,qBAAqB;oBAC/B,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,EACtB,UAAU,EAAE,UAAU,EACtB,kBAAkB,EAAE,CAAC,EACrB,sBAAsB,EAAE,sBAAsB,EAC9C,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,WAAW,EAC7B,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,mBAAmB,GACnC,CACO,CACZ,CAAC;YACJ,CAAC,CAAC,CACG,CACI,CACR,CACR,CAAC;AACJ,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import FormBodyTabbed from './FormBodyTabbed';
|
|
19
|
+
import FormBodyPage from './FormBodyPage';
|
|
19
20
|
import { containsTabs, isTabContainer } from '../../utils/tabs';
|
|
21
|
+
import { containsPages, isPage } from '../../utils/page';
|
|
20
22
|
import GroupItem from '../FormComponents/GroupItem/GroupItem';
|
|
21
23
|
import SingleItem from '../FormComponents/SingleItem/SingleItem';
|
|
22
24
|
import FormBodyCollapsible from './FormBodyCollapsible';
|
|
@@ -29,6 +31,8 @@ function FormTopLevelItem(props) {
|
|
|
29
31
|
const { topLevelQItem, topLevelQRItemOrItems, parentIsReadOnly, onQrItemChange, onQrRepeatGroupChange } = props;
|
|
30
32
|
const itemIsTabContainer = isTabContainer(topLevelQItem);
|
|
31
33
|
const itemContainsTabs = containsTabs(topLevelQItem);
|
|
34
|
+
const itemIsPageContainer = isPage(topLevelQItem);
|
|
35
|
+
const itemContainsPages = containsPages(topLevelQItem);
|
|
32
36
|
const isTablet = useResponsive('up', 'md');
|
|
33
37
|
const itemIsGroup = topLevelQItem.type === 'group';
|
|
34
38
|
const readOnly = useReadOnly(topLevelQItem, parentIsReadOnly);
|
|
@@ -50,6 +54,9 @@ function FormTopLevelItem(props) {
|
|
|
50
54
|
}
|
|
51
55
|
return (React.createElement(FormBodyCollapsible, { key: topLevelQItem.linkId, topLevelQItem: topLevelQItem, topLevelQRItem: topLevelQRItem, parentIsReadOnly: readOnly, onQrItemChange: onQrItemChange }));
|
|
52
56
|
}
|
|
57
|
+
if (itemContainsPages || itemIsPageContainer) {
|
|
58
|
+
return (React.createElement(FormBodyPage, { key: topLevelQItem.linkId, topLevelQItem: topLevelQItem, topLevelQRItem: topLevelQRItem, parentIsReadOnly: readOnly, onQrItemChange: onQrItemChange }));
|
|
59
|
+
}
|
|
53
60
|
// If form is untabbed, it is rendered as a regular group
|
|
54
61
|
if (itemIsGroup) {
|
|
55
62
|
return (React.createElement(GroupItem, { key: topLevelQItem.linkId, qItem: topLevelQItem, qrItem: topLevelQRItem, groupCardElevation: 1, isRepeated: false, parentIsReadOnly: readOnly, onQrItemChange: onQrItemChange }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormTopLevelItem.js","sourceRoot":"","sources":["../../../src/components/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9B,gBAAgB,EAAE,QAAQ,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;KACH;IAED,yDAAyD;IACzD,IAAI,WAAW,EAAE;QACf,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,aAAa,CAAC,MAAM,EACzB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,cAAc,EACtB,kBAAkB,EAAE,CAAC,EACrB,UAAU,EAAE,KAAK,EACjB,gBAAgB,EAAE,QAAQ,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;KACH;IAED,gDAAgD;IAChD,OAAO,CACL,oBAAC,GAAG,IAAC,EAAE,EAAE,CAAC;QACR,oBAAC,UAAU,IACT,GAAG,EAAE,aAAa,CAAC,MAAM,EACzB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,KAAK,EACf,kBAAkB,EAAE,CAAC,EACrB,gBAAgB,EAAE,QAAQ,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACE,CACP,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
3
|
+
import type { PropsWithParentIsReadOnlyAttribute, PropsWithQrItemChangeHandler } from '../../interfaces/renderProps.interface';
|
|
4
|
+
interface FormTopLevelPageProps extends PropsWithQrItemChangeHandler, PropsWithParentIsReadOnlyAttribute {
|
|
5
|
+
topLevelQItems: QuestionnaireItem[];
|
|
6
|
+
topLevelQRItems: (QuestionnaireResponseItem | QuestionnaireResponseItem[] | undefined)[];
|
|
7
|
+
}
|
|
8
|
+
declare function FormTopLevelPage(props: FormTopLevelPageProps): React.JSX.Element;
|
|
9
|
+
export default FormTopLevelPage;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Grid from '@mui/material/Grid';
|
|
3
|
+
import TabContext from '@mui/lab/TabContext';
|
|
4
|
+
import TabPanel from '@mui/lab/TabPanel';
|
|
5
|
+
import GroupItem from '../FormComponents/GroupItem/GroupItem';
|
|
6
|
+
import { useQuestionnaireStore } from '../../stores';
|
|
7
|
+
function FormTopLevelPage(props) {
|
|
8
|
+
const { topLevelQItems, topLevelQRItems, parentIsReadOnly, onQrItemChange } = props;
|
|
9
|
+
const pages = useQuestionnaireStore.use.pages();
|
|
10
|
+
const currentPage = useQuestionnaireStore.use.currentPageIndex();
|
|
11
|
+
return (React.createElement(Grid, { container: true, spacing: 1.5 },
|
|
12
|
+
React.createElement(TabContext, { value: currentPage.toString() },
|
|
13
|
+
React.createElement(Grid, { item: true, xs: 12, md: 12, lg: 12 }, topLevelQItems.map((qItem, i) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const qrItem = topLevelQRItems[i];
|
|
16
|
+
const isNotRepeatGroup = !Array.isArray(qrItem);
|
|
17
|
+
const isPage = !!pages[qItem.linkId];
|
|
18
|
+
if (!isPage || !isNotRepeatGroup) {
|
|
19
|
+
// Something has gone horribly wrong
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const isRepeated = (_a = qItem.repeats) !== null && _a !== void 0 ? _a : false;
|
|
23
|
+
const pageIsMarkedAsComplete = (_b = pages[qItem.linkId].isComplete) !== null && _b !== void 0 ? _b : false;
|
|
24
|
+
return (React.createElement(TabPanel, { key: qItem.linkId, sx: { p: 0 }, value: i.toString(), "data-test": "renderer-page-panel" },
|
|
25
|
+
React.createElement(GroupItem, { qItem: qItem, qrItem: qrItem !== null && qrItem !== void 0 ? qrItem : null, isRepeated: isRepeated, groupCardElevation: 1, pageIsMarkedAsComplete: pageIsMarkedAsComplete, pages: pages, currentPageIndex: currentPage, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange })));
|
|
26
|
+
})))));
|
|
27
|
+
}
|
|
28
|
+
export default FormTopLevelPage;
|
|
29
|
+
//# sourceMappingURL=FormTopLevelPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTopLevelPage.js","sourceRoot":"","sources":["../../../src/components/Renderer/FormTopLevelPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAK9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AASrD,SAAS,gBAAgB,CAAC,KAA4B;IACpD,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAEpF,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,qBAAqB,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAEjE,OAAO,CACL,oBAAC,IAAI,IAAC,SAAS,QAAC,OAAO,EAAE,GAAG;QAC1B,oBAAC,UAAU,IAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;YACvC,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAC9B,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;;gBAC/B,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;gBAElC,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAChD,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAErC,IAAI,CAAC,MAAM,IAAI,CAAC,gBAAgB,E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