@aehrc/smart-forms-renderer 1.0.0-alpha.2 → 1.0.0-alpha.4
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/lib/components/FormComponents/DecimalItem/index.d.ts +1 -0
- package/lib/components/FormComponents/DecimalItem/index.js +18 -0
- package/lib/components/FormComponents/DecimalItem/index.js.map +1 -0
- package/lib/components/FormComponents/DisplayItem/DisplayItem.d.ts +2 -1
- package/lib/components/FormComponents/DisplayItem/DisplayItem.js +4 -2
- package/lib/components/FormComponents/DisplayItem/DisplayItem.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemView.js +1 -1
- package/lib/components/FormComponents/GroupItem/GroupItemView.js.map +1 -1
- package/lib/components/FormComponents/ItemParts/FlyoverItem.d.ts +6 -0
- package/lib/components/FormComponents/ItemParts/FlyoverItem.js +45 -0
- package/lib/components/FormComponents/ItemParts/FlyoverItem.js.map +1 -0
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js +6 -20
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupItem.js.map +1 -1
- package/lib/components/FormComponents/SingleItem/SingleItem.js +1 -1
- package/lib/components/FormComponents/SingleItem/SingleItem.js.map +1 -1
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js +6 -7
- package/lib/components/FormComponents/SingleItem/SingleItemSwitcher.js.map +1 -1
- package/lib/hooks/useBuildForm.d.ts +5 -2
- package/lib/hooks/useBuildForm.js +10 -7
- package/lib/hooks/useBuildForm.js.map +1 -1
- package/lib/hooks/useHidden.js +8 -0
- package/lib/hooks/useHidden.js.map +1 -1
- package/lib/hooks/useReadOnly.d.ts +1 -1
- package/lib/hooks/useReadOnly.js +22 -1
- package/lib/hooks/useReadOnly.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interfaces/customOverrideComponent.interface.d.ts +9 -0
- package/lib/interfaces/customOverrideComponent.interface.js +18 -0
- package/lib/interfaces/customOverrideComponent.interface.js.map +1 -0
- package/lib/interfaces/index.d.ts +1 -1
- package/lib/interfaces/overrideComponent.interface.d.ts +12 -0
- package/lib/interfaces/overrideComponent.interface.js +18 -0
- package/lib/interfaces/overrideComponent.interface.js.map +1 -0
- package/lib/interfaces/qItemOverrideComponent.interface.d.ts +9 -0
- package/lib/interfaces/qItemOverrideComponent.interface.js +18 -0
- package/lib/interfaces/qItemOverrideComponent.interface.js.map +1 -0
- package/lib/stores/index.d.ts +2 -0
- package/lib/stores/index.js +1 -0
- package/lib/stores/index.js.map +1 -1
- package/lib/stores/questionnaireStore.d.ts +9 -5
- package/lib/stores/questionnaireStore.js +7 -4
- package/lib/stores/questionnaireStore.js.map +1 -1
- package/lib/stores/rendererStylingStore.d.ts +3 -0
- package/lib/stores/rendererStylingStore.js +5 -3
- package/lib/stores/rendererStylingStore.js.map +1 -1
- package/lib/utils/manageForm.d.ts +5 -3
- package/lib/utils/manageForm.js +4 -3
- package/lib/utils/manageForm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FormComponents/DisplayItem/DisplayItem.tsx +7 -3
- package/src/components/FormComponents/GroupItem/GroupItemView.tsx +1 -1
- package/src/components/FormComponents/ItemParts/FlyoverItem.tsx +61 -0
- package/src/components/FormComponents/ItemParts/ItemLabelWrapper.tsx +15 -36
- package/src/components/FormComponents/RepeatGroup/RepeatGroupItem.tsx +1 -1
- package/src/components/FormComponents/SingleItem/SingleItem.tsx +1 -1
- package/src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx +6 -7
- package/src/hooks/useBuildForm.ts +13 -7
- package/src/hooks/useHidden.ts +12 -0
- package/src/hooks/useReadOnly.ts +32 -1
- package/src/index.ts +8 -3
- package/src/interfaces/index.ts +4 -1
- package/src/interfaces/{customComponent.interface.ts → overrideComponent.interface.ts} +6 -2
- package/src/stores/index.ts +3 -0
- package/src/stores/questionnaireStore.ts +15 -7
- package/src/stores/rendererStylingStore.ts +4 -0
- package/src/stories/assets/questionnaires/QItemControlGroup.ts +0 -772
- package/src/stories/sdc/ItemControlGroup.stories.tsx +0 -7
- package/src/utils/manageForm.ts +8 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DecimalField } from './DecimalField';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { default as DecimalField } from './DecimalField';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/DecimalItem/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { QuestionnaireItem } from 'fhir/r4';
|
|
3
|
-
|
|
3
|
+
import type { PropsWithParentIsReadOnlyAttribute } from '../../../interfaces/renderProps.interface';
|
|
4
|
+
interface DisplayItemProps extends PropsWithParentIsReadOnlyAttribute {
|
|
4
5
|
qItem: QuestionnaireItem;
|
|
5
6
|
}
|
|
6
7
|
declare const DisplayItem: React.NamedExoticComponent<DisplayItemProps>;
|
|
@@ -19,15 +19,17 @@ import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
|
19
19
|
import { isSpecificItemControl } from '../../../utils';
|
|
20
20
|
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
21
21
|
import { useQuestionnaireStore } from '../../../stores';
|
|
22
|
+
import useReadOnly from '../../../hooks/useReadOnly';
|
|
22
23
|
const DisplayItem = memo(function DisplayItem(props) {
|
|
23
|
-
const { qItem } = props;
|
|
24
|
+
const { qItem, parentIsReadOnly } = props;
|
|
25
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
24
26
|
const onFocusLinkId = useQuestionnaireStore.use.onFocusLinkId();
|
|
25
27
|
const isContextDisplay = isSpecificItemControl(qItem, 'context-display');
|
|
26
28
|
if (isContextDisplay) {
|
|
27
29
|
return null;
|
|
28
30
|
}
|
|
29
31
|
return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-display-box", "data-linkid": qItem.linkId, onClick: () => onFocusLinkId(qItem.linkId) },
|
|
30
|
-
React.createElement(LabelWrapper, { qItem: qItem, readOnly:
|
|
32
|
+
React.createElement(LabelWrapper, { qItem: qItem, readOnly: readOnly })));
|
|
31
33
|
});
|
|
32
34
|
export default DisplayItem;
|
|
33
35
|
//# sourceMappingURL=DisplayItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/DisplayItem/DisplayItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,qB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,CAAC"}
|
|
@@ -30,7 +30,7 @@ import { GroupAccordion } from './GroupAccordion.styles';
|
|
|
30
30
|
import PageButtonsWrapper from './PageButtonWrapper';
|
|
31
31
|
function GroupItemView(props) {
|
|
32
32
|
const { qItem, childQItems, qrItemsByIndex, isRepeated, groupCardElevation, disableCardView, tabIsMarkedAsComplete, tabs, currentTabIndex, pageIsMarkedAsComplete, pages, currentPageIndex, parentIsReadOnly, parentIsRepeatGroup, parentRepeatGroupIndex, onQrItemChange, onQrRepeatGroupChange } = props;
|
|
33
|
-
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
33
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly, parentRepeatGroupIndex);
|
|
34
34
|
// Render collapsible group item
|
|
35
35
|
// If group item is a repeating instance, do not render group item as collapsible
|
|
36
36
|
const groupCollapsibleValue = getGroupCollapsible(qItem);
|
|
@@ -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;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;AAqBrD,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,EACJ,KAAK,EACL,WAAW,EACX,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,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;
|
|
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;AAqBrD,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,EACJ,KAA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
|
|
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 Tooltip from '@mui/material/Tooltip';
|
|
19
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
20
|
+
import { useQuestionnaireStore } from '../../../stores';
|
|
21
|
+
function FlyoverItem(props) {
|
|
22
|
+
const { displayFlyover } = props;
|
|
23
|
+
const sdcUiOverrideComponents = useQuestionnaireStore.use.sdcUiOverrideComponents();
|
|
24
|
+
const FlyoverOverrideComponent = sdcUiOverrideComponents['flyover'];
|
|
25
|
+
// If a flyover override component is defined for this item, render it
|
|
26
|
+
if (FlyoverOverrideComponent && typeof FlyoverOverrideComponent === 'function') {
|
|
27
|
+
return React.createElement(FlyoverOverrideComponent, { displayText: displayFlyover });
|
|
28
|
+
}
|
|
29
|
+
return (React.createElement(Tooltip, { title: displayFlyover, placement: "top", slotProps: {
|
|
30
|
+
popper: {
|
|
31
|
+
modifiers: [
|
|
32
|
+
{
|
|
33
|
+
name: 'offset',
|
|
34
|
+
options: {
|
|
35
|
+
offset: [0, -8]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
} },
|
|
41
|
+
React.createElement("span", null,
|
|
42
|
+
React.createElement(InfoOutlinedIcon, { sx: { color: 'text.secondary' }, fontSize: "small" }))));
|
|
43
|
+
}
|
|
44
|
+
export default FlyoverItem;
|
|
45
|
+
//# sourceMappingURL=FlyoverItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlyoverItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ItemParts/FlyoverItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,gBAAgB,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAMxD,SAAS,WAAW,CAAC,KAAuB;IAC1C,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAEjC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC;IACpF,MAAM,wBAAwB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAEpE,sEAAsE;IACtE,IAAI,wBAAwB,IAAI,OAAO,wBAAwB,KAAK,UAAU,EAAE;QAC9E,OAAO,oBAAC,wBAAwB,IAAC,WAAW,EAAE,cAAc,GAAI,CAAC;KAClE;IAED,OAAO,CACL,oBAAC,OAAO,IACN,KAAK,EAAE,cAAc,EACrB,SAAS,EAAC,KAAK,EACf,SAAS,EAAE;YACT,MAAM,EAAE;gBACN,SAAS,EAAE;oBACT;wBACE,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE;4BACP,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;yBAChB;qBACF;iBACF;aACF;SACF;QACD;YACE,oBAAC,gBAAgB,IAAC,EAAE,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,QAAQ,EAAC,OAAO,GAAG,CACjE,CACC,CACX,CAAC;AACJ,CAAC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -19,33 +19,19 @@ import Box from '@mui/material/Box';
|
|
|
19
19
|
import ContextDisplayItem from './ContextDisplayItem';
|
|
20
20
|
import { getContextDisplays } from '../../../utils/tabs';
|
|
21
21
|
import ItemLabelText from './ItemLabelText';
|
|
22
|
-
import Tooltip from '@mui/material/Tooltip';
|
|
23
22
|
import Typography from '@mui/material/Typography';
|
|
24
23
|
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
25
|
-
import
|
|
24
|
+
import FlyoverItem from './FlyoverItem';
|
|
26
25
|
function ItemLabelWrapper(props) {
|
|
27
26
|
const { qItem, readOnly } = props;
|
|
28
27
|
const { required, displayFlyover } = useRenderingExtensions(qItem);
|
|
29
28
|
const contextDisplayItems = getContextDisplays(qItem);
|
|
30
29
|
return (React.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "space-between" },
|
|
31
|
-
React.createElement(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
options: {
|
|
37
|
-
offset: [0, -8]
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
} },
|
|
43
|
-
React.createElement("span", null,
|
|
44
|
-
React.createElement(Box, { position: "relative" },
|
|
45
|
-
required ? (React.createElement(Typography, { color: "red", sx: { position: 'absolute', top: 0, left: -8 } }, "*")) : null,
|
|
46
|
-
React.createElement(Box, { display: "flex", columnGap: 0.5, justifyContent: "space-between", alignItems: "center" },
|
|
47
|
-
React.createElement(ItemLabelText, { qItem: qItem, readOnly: readOnly }),
|
|
48
|
-
displayFlyover !== '' ? (React.createElement(InfoOutlinedIcon, { sx: { color: 'text.secondary' }, fontSize: "small" })) : null)))),
|
|
30
|
+
React.createElement(Box, { position: "relative" },
|
|
31
|
+
required ? (React.createElement(Typography, { color: "red", sx: { position: 'absolute', top: 0, left: -8 } }, "*")) : null,
|
|
32
|
+
React.createElement(Box, { display: "flex", columnGap: 0.75, justifyContent: "space-between", alignItems: "center" },
|
|
33
|
+
React.createElement(ItemLabelText, { qItem: qItem, readOnly: readOnly }),
|
|
34
|
+
displayFlyover !== '' ? React.createElement(FlyoverItem, { displayFlyover: displayFlyover }) : null)),
|
|
49
35
|
React.createElement(Box, { display: "flex", columnGap: 0.5 }, contextDisplayItems.map((item) => {
|
|
50
36
|
return React.createElement(ContextDisplayItem, { key: item.linkId, displayItem: item });
|
|
51
37
|
}))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemLabelWrapper.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ItemParts/ItemLabelWrapper.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"ItemLabelWrapper.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ItemParts/ItemLabelWrapper.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,WAAW,MAAM,eAAe,CAAC;AAOxC,SAAS,gBAAgB,CAAC,KAAwB;IAChD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAElC,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACnE,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAEtD,OAAO,CACL,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,cAAc,EAAC,eAAe;QACpE,oBAAC,GAAG,IAAC,QAAQ,EAAC,UAAU;YACrB,QAAQ,CAAC,CAAC,CAAC,CACV,oBAAC,UAAU,IACT,KAAK,EAAC,KAAK,EACX,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,QAGnC,CACd,CAAC,CAAC,CAAC,IAAI;YACR,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,EAAC,eAAe,EAAC,UAAU,EAAC,QAAQ;gBACrF,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI;gBAClD,cAAc,KAAK,EAAE,CAAC,CAAC,CAAC,oBAAC,WAAW,IAAC,cAAc,EAAE,cAAc,GAAI,CAAC,CAAC,CAAC,IAAI,CAC3E,CACF;QAEN,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAE,GAAG,IAC/B,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAChC,OAAO,oBAAC,kBAAkB,IAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,GAAI,CAAC;QACrE,CAAC,CAAC,CACE,CACF,CACP,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -22,7 +22,7 @@ import DeleteItemButton from './DeleteItemButton';
|
|
|
22
22
|
import useReadOnly from '../../../hooks/useReadOnly';
|
|
23
23
|
function RepeatGroupItem(props) {
|
|
24
24
|
const { qItem, repeatGroupIndex, answeredQrItem, nullableQrItem, numOfRepeatGroups, groupCardElevation, showMinimalView, parentIsReadOnly, onDeleteItem, onQrItemChange } = props;
|
|
25
|
-
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
25
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly, repeatGroupIndex);
|
|
26
26
|
return (React.createElement(RepeatGroupContainerStack, { direction: "row", justifyContent: "end" },
|
|
27
27
|
React.createElement(Box, { sx: { flexGrow: 1 } },
|
|
28
28
|
React.createElement(GroupItem, { qItem: qItem, qrItem: answeredQrItem, isRepeated: true, parentIsRepeatGroup: true, parentRepeatGroupIndex: repeatGroupIndex, parentIsReadOnly: parentIsReadOnly, groupCardElevation: groupCardElevation + 1, onQrItemChange: onQrItemChange })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeatGroupItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/RepeatGroup/RepeatGroupItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAO/C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAerD,SAAS,eAAe,CAAC,KAA2B;IAClD,MAAM,EACJ,KAAK,EACL,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACf,GAAG,KAAK,CAAC;IAEV,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"RepeatGroupItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/RepeatGroup/Repeat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|
@@ -50,7 +50,7 @@ function SingleItem(props) {
|
|
|
50
50
|
onQrItemChange(updatedQrItem);
|
|
51
51
|
}, [qrItem, onQrItemChange]);
|
|
52
52
|
const itemHasNestedItems = useMemo(() => !!qItem.item && qItem.item.length > 0 && shouldRenderNestedItems(qItem), [qItem]);
|
|
53
|
-
const readOnly = useReadOnly(qItem, parentIsReadOnly);
|
|
53
|
+
const readOnly = useReadOnly(qItem, parentIsReadOnly, parentRepeatGroupIndex);
|
|
54
54
|
const itemIsHidden = useHidden(qItem, parentRepeatGroupIndex);
|
|
55
55
|
return (React.createElement(SingleItemView, { qItem: qItem, qrItem: qrItem, itemIsHidden: itemIsHidden, itemHasNestedItems: itemHasNestedItems, isRepeated: isRepeated, isTabled: isTabled, groupCardElevation: groupCardElevation, showMinimalView: showMinimalView, parentIsReadOnly: readOnly, onQrItemChange: handleQrItemChange, onQrItemChangeWithNestedItems: handleQrItemChangeWithNestedItems }));
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/SingleItem/SingleItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAUpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAc9C;;;;;GAKG;AACH,SAAS,UAAU,CAAC,KAAsB;IACxC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,E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AAC,CAAC;
|
|
1
|
+
{"version":3,"file":"SingleItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/SingleItem/SingleItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAUpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAc9C;;;;;GAKG;AACH,SAAS,UAAU,CAAC,KAAsB;IACxC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACf,GAAG,KAAK,CAAC;IAEV,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;IAE9E,MAAM,kBAAkB,GAAG,WAAW,CACpC,CAAC,SAAoC,EAAE,EAAE;QACvC,oBAAoB,CAClB,KAAK,CAAC,MAAM,EACZ,SAAS,CAAC,MAAM,EAChB,mBAAmB,CAAC,CAAC,CAAC,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAC5D,CAAC;QAEF,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACnD,cAAc,iCAAM,SAAS,KAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAG,CAAC;SACrD;aAAM;YACL,cAAc,CAAC,SAAS,CAAC,CAAC;SAC3B;IACH,CAAC,EACD;QACE,MAAM;QACN,oBAAoB;QACpB,KAAK,CAAC,MAAM;QACZ,mBAAmB;QACnB,sBAAsB;QACtB,cAAc;KACf,CACF,CAAC;IAEF,MAAM,iCAAiC,GAAG,WAAW,CACnD,CAAC,SAAoC,EAAE,EAAE;QACvC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,iCAAM,MAAM,KAAE,IAAI,EAAE,SAAS,CAAC,IAAI,IAAG,CAAC,CAAC,SAAS,CAAC;QAC/E,cAAc,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC,EACD,CAAC,MAAM,EAAE,cAAc,CAAC,CACzB,CAAC;IAEF,MAAM,kBAAkB,GAAG,OAAO,CAChC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,uBAAuB,CAAC,KAAK,CAAC,EAC7E,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,CAAC,CAAC;IAC9E,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC;IAE9D,OAAO,CACL,oBAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,QAAQ,EAC1B,cAAc,EAAE,kBAAkB,EAClC,6BAA6B,EAAE,iCAAiC,GAChE,CACH,CAAC;AACJ,CAAC;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -35,17 +35,17 @@ import QuantityItem from '../QuantityItem/QuantityItem';
|
|
|
35
35
|
import { useQuestionnaireStore } from '../../../stores';
|
|
36
36
|
function SingleItemSwitcher(props) {
|
|
37
37
|
const { qItem, qrItem, isRepeated, isTabled, showMinimalView, parentIsReadOnly, onQrItemChange } = props;
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
// If a
|
|
38
|
+
const qItemOverrideComponents = useQuestionnaireStore.use.qItemOverrideComponents();
|
|
39
|
+
const QItemOverrideComponent = qItemOverrideComponents[qItem.linkId];
|
|
40
|
+
// If a qItem override component is defined for this item, render it
|
|
41
41
|
// Don't get too strict with the checks for now
|
|
42
|
-
if (
|
|
43
|
-
return (React.createElement(
|
|
42
|
+
if (QItemOverrideComponent && typeof QItemOverrideComponent === 'function') {
|
|
43
|
+
return (React.createElement(QItemOverrideComponent, { qItem: qItem, qrItem: qrItem, isRepeated: isRepeated, isTabled: isTabled, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
|
|
44
44
|
}
|
|
45
45
|
// Otherwise, render the default form component based on the item type
|
|
46
46
|
switch (qItem.type) {
|
|
47
47
|
case 'display':
|
|
48
|
-
return React.createElement(DisplayItem, { qItem: qItem });
|
|
48
|
+
return React.createElement(DisplayItem, { qItem: qItem, parentIsReadOnly: parentIsReadOnly });
|
|
49
49
|
case 'boolean':
|
|
50
50
|
return (React.createElement(BooleanItem, { qItem: qItem, qrItem: qrItem, isRepeated: isRepeated, isTabled: isTabled, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
|
|
51
51
|
case 'decimal':
|
|
@@ -77,7 +77,6 @@ function SingleItemSwitcher(props) {
|
|
|
77
77
|
// FIXME reference item uses the same component as string item currently
|
|
78
78
|
return (React.createElement(StringItem, { qItem: qItem, qrItem: qrItem, isRepeated: isRepeated, isTabled: isTabled, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
|
|
79
79
|
case 'quantity':
|
|
80
|
-
// FIXME quantity item uses the same component as decimal item currently
|
|
81
80
|
return (React.createElement(QuantityItem, { qItem: qItem, qrItem: qrItem, isRepeated: isRepeated, isTabled: isTabled, parentIsReadOnly: parentIsReadOnly, onQrItemChange: onQrItemChange }));
|
|
82
81
|
default:
|
|
83
82
|
return (React.createElement(Typography, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleItemSwitcher.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/SingleItem/SingleItemSwitcher.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,kBAAkB,MAAM,mCAAmC,CAAC;AAEnE,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAC/E,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAQlD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,kBAAkB,MAAM,wDAAwD,CAAC;AACxF,OAAO,YAAY,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAYxD,SAAS,kBAAkB,CAAC,KAA8B;IACxD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAC9F,KAAK,CAAC;IAER,MAAM,
|
|
1
|
+
{"version":3,"file":"SingleItemSwitcher.js","sourceRoot":"","sources":["../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H,CAAC;QACJ;YACE,OAAO,CACL,oBAAC,UAAU;;gBACC,+BAAI,KAAK,CAAC,IAAI,CAAK;yJAElB,CACd,CAAC;KACL;AACH,CAAC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
|
|
3
3
|
import type { RendererStyling } from '../stores/rendererStylingStore';
|
|
4
|
+
import type { QItemOverrideComponentProps, SdcUiOverrideComponentProps } from '../interfaces';
|
|
4
5
|
/**
|
|
5
6
|
* React hook wrapping around the buildForm() function to build a form from a questionnaire and an optional QuestionnaireResponse.
|
|
6
7
|
* @see buildForm() for more information.
|
|
@@ -11,9 +12,11 @@ import type { RendererStyling } from '../stores/rendererStylingStore';
|
|
|
11
12
|
* @param terminologyServerUrl - Terminology server url to fetch terminology. If not provided, the default terminology server will be used. (optional)
|
|
12
13
|
* @param additionalVariables - Additional key-value pair of SDC variables `Record<name, variable extension>` for testing (optional)
|
|
13
14
|
* @param rendererStylingOptions - Renderer styling to be applied to the form. See docs for styling options. (optional)
|
|
14
|
-
* @param
|
|
15
|
+
* @param qItemOverrideComponents - FIXME add comment
|
|
16
|
+
* @param sdcUiOverrideComponents - FIXME add comment
|
|
17
|
+
*
|
|
15
18
|
*
|
|
16
19
|
* @author Sean Fong
|
|
17
20
|
*/
|
|
18
|
-
declare function useBuildForm(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, readOnly?: boolean, terminologyServerUrl?: string, additionalVariables?: Record<string, object>, rendererStylingOptions?: RendererStyling,
|
|
21
|
+
declare function useBuildForm(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse, readOnly?: boolean, terminologyServerUrl?: string, additionalVariables?: Record<string, object>, rendererStylingOptions?: RendererStyling, qItemOverrideComponents?: Record<string, ComponentType<QItemOverrideComponentProps>>, sdcUiOverrideComponents?: Record<string, ComponentType<SdcUiOverrideComponentProps>>): boolean;
|
|
19
22
|
export default useBuildForm;
|
|
@@ -27,11 +27,13 @@ import { useRendererStylingStore } from '../stores/rendererStylingStore';
|
|
|
27
27
|
* @param terminologyServerUrl - Terminology server url to fetch terminology. If not provided, the default terminology server will be used. (optional)
|
|
28
28
|
* @param additionalVariables - Additional key-value pair of SDC variables `Record<name, variable extension>` for testing (optional)
|
|
29
29
|
* @param rendererStylingOptions - Renderer styling to be applied to the form. See docs for styling options. (optional)
|
|
30
|
-
* @param
|
|
30
|
+
* @param qItemOverrideComponents - FIXME add comment
|
|
31
|
+
* @param sdcUiOverrideComponents - FIXME add comment
|
|
32
|
+
*
|
|
31
33
|
*
|
|
32
34
|
* @author Sean Fong
|
|
33
35
|
*/
|
|
34
|
-
function useBuildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, rendererStylingOptions,
|
|
36
|
+
function useBuildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, rendererStylingOptions, qItemOverrideComponents, sdcUiOverrideComponents) {
|
|
35
37
|
const [isBuilding, setIsBuilding] = useState(true);
|
|
36
38
|
const setRendererStyling = useRendererStylingStore.use.setRendererStyling();
|
|
37
39
|
useLayoutEffect(() => {
|
|
@@ -39,18 +41,19 @@ function useBuildForm(questionnaire, questionnaireResponse, readOnly, terminolog
|
|
|
39
41
|
if (rendererStylingOptions) {
|
|
40
42
|
setRendererStyling(rendererStylingOptions);
|
|
41
43
|
}
|
|
42
|
-
buildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables,
|
|
44
|
+
buildForm(questionnaire, questionnaireResponse, readOnly, terminologyServerUrl, additionalVariables, qItemOverrideComponents, sdcUiOverrideComponents).then(() => {
|
|
43
45
|
setIsBuilding(false);
|
|
44
46
|
});
|
|
45
47
|
}, [
|
|
46
|
-
customComponents,
|
|
47
48
|
questionnaire,
|
|
48
49
|
questionnaireResponse,
|
|
49
50
|
readOnly,
|
|
50
|
-
rendererStylingOptions,
|
|
51
|
-
setRendererStyling,
|
|
52
51
|
terminologyServerUrl,
|
|
53
|
-
additionalVariables
|
|
52
|
+
additionalVariables,
|
|
53
|
+
rendererStylingOptions,
|
|
54
|
+
qItemOverrideComponents,
|
|
55
|
+
sdcUiOverrideComponents,
|
|
56
|
+
setRendererStyling
|
|
54
57
|
]);
|
|
55
58
|
return isBuilding;
|
|
56
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBuildForm.js","sourceRoot":"","sources":["../../src/hooks/useBuildForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"useBuildForm.js","sourceRoot":"","sources":["../../src/hooks/useBuildForm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAGzE;;;;;;;;;;;;;;;GAeG;AACH,SAAS,YAAY,CACnB,aAA4B,EAC5B,qBAA6C,EAC7C,QAAkB,EAClB,oBAA6B,EAC7B,mBAA4C,EAC5C,sBAAwC,EACxC,uBAAoF,EACpF,uBAAoF;IAEpF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEnD,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;IAE5E,eAAe,CAAC,GAAG,EAAE;QACnB,gCAAgC;QAChC,IAAI,sBAAsB,EAAE;YAC1B,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;SAC5C;QAED,SAAS,CACP,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,CACxB,CAAC,IAAI,CAAC,GAAG,EAAE;YACV,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE;QACD,aAAa;QACb,qBAAqB;QACrB,QAAQ;QACR,oBAAoB;QACpB,mBAAmB;QACnB,sBAAsB;QACtB,uBAAuB;QACvB,uBAAuB;QACvB,kBAAkB;KACnB,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,eAAe,YAAY,CAAC"}
|
package/lib/hooks/useHidden.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { useQuestionnaireStore } from '../stores';
|
|
18
18
|
import { isHiddenByEnableWhen } from '../utils/qItem';
|
|
19
19
|
import { structuredDataCapture } from 'fhir-sdc-helpers';
|
|
20
|
+
import { useRendererStylingStore } from '../stores/rendererStylingStore';
|
|
20
21
|
/**
|
|
21
22
|
* React hook to determine if a QuestionnaireItem is hidden via item.hidden, enableWhens, enableWhenExpressions.
|
|
22
23
|
* When checking for repeating group enableWhen items, the parentRepeatGroupIndex should be provided.
|
|
@@ -27,9 +28,16 @@ function useHidden(qItem, parentRepeatGroupIndex) {
|
|
|
27
28
|
const enableWhenIsActivated = useQuestionnaireStore.use.enableWhenIsActivated();
|
|
28
29
|
const enableWhenItems = useQuestionnaireStore.use.enableWhenItems();
|
|
29
30
|
const enableWhenExpressions = useQuestionnaireStore.use.enableWhenExpressions();
|
|
31
|
+
const enableWhenAsReadOnly = useRendererStylingStore.use.enableWhenAsReadOnly();
|
|
30
32
|
if (structuredDataCapture.getHidden(qItem)) {
|
|
31
33
|
return true;
|
|
32
34
|
}
|
|
35
|
+
// If enableWhenAsReadOnly is true, then items hidden by enableWhen should be displayed, but set as readOnly
|
|
36
|
+
// If enableWhenAsReadOnly is 'non-group', then items hidden by enableWhen should be displayed, but set as readOnly - only applies if item.type != group
|
|
37
|
+
if (enableWhenAsReadOnly === true ||
|
|
38
|
+
(enableWhenAsReadOnly === 'non-group' && qItem.type !== 'group')) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
33
41
|
return isHiddenByEnableWhen({
|
|
34
42
|
linkId: qItem.linkId,
|
|
35
43
|
enableWhenIsActivated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHidden.js","sourceRoot":"","sources":["../../src/hooks/useHidden.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"useHidden.js","sourceRoot":"","sources":["../../src/hooks/useHidden.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;;;GAKG;AACH,SAAS,SAAS,CAAC,KAAwB,EAAE,sBAA+B;IAC1E,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAChF,MAAM,eAAe,GAAG,qBAAqB,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;IACpE,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAEhF,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;IAEhF,IAAI,qBAAqB,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QAC1C,OAAO,IAAI,CAAC;KACb;IAED,4GAA4G;IAC5G,wJAAwJ;IACxJ,IACE,oBAAoB,KAAK,IAAI;QAC7B,CAAC,oBAAoB,KAAK,WAAW,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,EAChE;QACA,OAAO,KAAK,CAAC;KACd;IAED,OAAO,oBAAoB,CAAC;QAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,qBAAqB;QACrB,eAAe;QACf,qBAAqB;QACrB,sBAAsB;KACvB,CAAC,CAAC;AACL,CAAC;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { QuestionnaireItem } from 'fhir/r4';
|
|
2
|
-
declare function useReadOnly(qItem: QuestionnaireItem, parentIsReadOnly: boolean | undefined): boolean;
|
|
2
|
+
declare function useReadOnly(qItem: QuestionnaireItem, parentIsReadOnly: boolean | undefined, parentRepeatGroupIndex?: number): boolean;
|
|
3
3
|
export default useReadOnly;
|
package/lib/hooks/useReadOnly.js
CHANGED
|
@@ -15,8 +15,29 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import useRenderingExtensions from './useRenderingExtensions';
|
|
18
|
-
|
|
18
|
+
import { useRendererStylingStore } from '../stores/rendererStylingStore';
|
|
19
|
+
import { isHiddenByEnableWhen } from '../utils/qItem';
|
|
20
|
+
import { useQuestionnaireStore } from '../stores';
|
|
21
|
+
function useReadOnly(qItem, parentIsReadOnly, parentRepeatGroupIndex) {
|
|
19
22
|
let { readOnly } = useRenderingExtensions(qItem);
|
|
23
|
+
const enableWhenIsActivated = useQuestionnaireStore.use.enableWhenIsActivated();
|
|
24
|
+
const enableWhenItems = useQuestionnaireStore.use.enableWhenItems();
|
|
25
|
+
const enableWhenExpressions = useQuestionnaireStore.use.enableWhenExpressions();
|
|
26
|
+
const enableWhenAsReadOnly = useRendererStylingStore.use.enableWhenAsReadOnly();
|
|
27
|
+
// If enableWhenAsReadOnly is true, then items hidden by enableWhen should be displayed, but set as readOnly
|
|
28
|
+
// If enableWhenAsReadOnly is 'non-group', then items hidden by enableWhen should be displayed, but set as readOnly - only applies if item.type != group
|
|
29
|
+
if (!readOnly) {
|
|
30
|
+
if (enableWhenAsReadOnly === true ||
|
|
31
|
+
(enableWhenAsReadOnly === 'non-group' && qItem.type !== 'group')) {
|
|
32
|
+
readOnly = isHiddenByEnableWhen({
|
|
33
|
+
linkId: qItem.linkId,
|
|
34
|
+
enableWhenIsActivated,
|
|
35
|
+
enableWhenItems,
|
|
36
|
+
enableWhenExpressions,
|
|
37
|
+
parentRepeatGroupIndex
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
20
41
|
if (typeof parentIsReadOnly === 'boolean' && parentIsReadOnly) {
|
|
21
42
|
readOnly = parentIsReadOnly;
|
|
22
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReadOnly.js","sourceRoot":"","sources":["../../src/hooks/useReadOnly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"useReadOnly.js","sourceRoot":"","sources":["../../src/hooks/useReadOnly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,SAAS,WAAW,CAClB,KAAwB,EACxB,gBAAqC,EACrC,sBAA+B;IAE/B,IAAI,EAAE,QAAQ,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAEjD,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAChF,MAAM,eAAe,GAAG,qBAAqB,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;IACpE,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAEhF,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;IAEhF,4GAA4G;IAC5G,wJAAwJ;IACxJ,IAAI,CAAC,QAAQ,EAAE;QACb,IACE,oBAAoB,KAAK,IAAI;YAC7B,CAAC,oBAAoB,KAAK,WAAW,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,EAChE;YACA,QAAQ,GAAG,oBAAoB,CAAC;gBAC9B,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,qBAAqB;gBACrB,eAAe;gBACf,qBAAqB;gBACrB,sBAAsB;aACvB,CAAC,CAAC;SACJ;KACF;IAED,IAAI,OAAO,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,EAAE;QAC7D,QAAQ,GAAG,gBAAgB,CAAC;KAC7B;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,eAAe,WAAW,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { Tab, Tabs, Variables, VariableXFhirQuery, LaunchContext,
|
|
1
|
+
export type { Tab, Tabs, Variables, VariableXFhirQuery, LaunchContext, QItemOverrideComponentProps, SdcUiOverrideComponentProps } from './interfaces';
|
|
2
2
|
export type { SmartFormsRendererProps } from './components';
|
|
3
3
|
export { SmartFormsRenderer, BaseRenderer, SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate, ItemFieldGrid, StringField, FullWidthFormComponentBox } from './components';
|
|
4
|
-
export type { QuestionnaireStoreType, QuestionnaireResponseStoreType, SmartConfigStoreType, TerminologyServerStoreType } from './stores';
|
|
5
|
-
export { questionnaireStore, useQuestionnaireStore, questionnaireResponseStore, useQuestionnaireResponseStore, smartConfigStore, useSmartConfigStore, terminologyServerStore, useTerminologyServerStore } from './stores';
|
|
4
|
+
export type { QuestionnaireStoreType, QuestionnaireResponseStoreType, SmartConfigStoreType, TerminologyServerStoreType, RendererStyling, RendererStylingStoreType } from './stores';
|
|
5
|
+
export { questionnaireStore, useQuestionnaireStore, questionnaireResponseStore, useQuestionnaireResponseStore, smartConfigStore, useSmartConfigStore, terminologyServerStore, useTerminologyServerStore, rendererStylingStore, useRendererStylingStore } from './stores';
|
|
6
6
|
export { useHidden, useReadOnly, useBuildForm, useRendererQueryClient, useRenderingExtensions, useValidationFeedback, useStringCalculatedExpression } from './hooks';
|
|
7
7
|
export type { ItemToRepopulate } from './utils';
|
|
8
8
|
export { buildForm, destroyForm, getResponse, removeEmptyAnswersFromResponse, removeInternalIdsFromResponse, createEmptyQrItem, isSpecificItemControl, isRepeatItemAndNotCheckbox, initialiseQuestionnaireResponse, generateItemsToRepopulate, repopulateResponse, extractObservationBased } from './utils';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { SmartFormsRenderer, BaseRenderer, SingleItem, RepeatItem, RepeatGroup, GroupTable, GridGroup, parseFhirDateToDisplayDate, ItemFieldGrid, StringField, FullWidthFormComponentBox } from './components';
|
|
2
|
-
export { questionnaireStore, useQuestionnaireStore, questionnaireResponseStore, useQuestionnaireResponseStore, smartConfigStore, useSmartConfigStore, terminologyServerStore, useTerminologyServerStore } from './stores';
|
|
2
|
+
export { questionnaireStore, useQuestionnaireStore, questionnaireResponseStore, useQuestionnaireResponseStore, smartConfigStore, useSmartConfigStore, terminologyServerStore, useTerminologyServerStore, rendererStylingStore, useRendererStylingStore } from './stores';
|
|
3
3
|
// hooks exports
|
|
4
4
|
export { useHidden, useReadOnly, useBuildForm, useRendererQueryClient, useRenderingExtensions, useValidationFeedback, useStringCalculatedExpression } from './hooks';
|
|
5
5
|
export { buildForm, destroyForm, getResponse, removeEmptyAnswersFromResponse, removeInternalIdsFromResponse, createEmptyQrItem, isSpecificItemControl, isRepeatItemAndNotCheckbox, initialiseQuestionnaireResponse, generateItemsToRepopulate, repopulateResponse, extractObservationBased } from './utils';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,0BAA0B,EAC1B,aAAa,EACb,WAAW,EACX,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAWtB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,0BAA0B,EAC1B,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAElB,gBAAgB;AAChB,OAAO,EACL,SAAS,EACT,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAIjB,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,8BAA8B,EAC9B,6BAA6B,EAC7B,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,+BAA+B,EAC/B,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB,yBAAyB;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAIhD,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QuestionnaireItem, type QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
+
export interface CustomOverrideComponentProps {
|
|
3
|
+
qItem: QuestionnaireItem;
|
|
4
|
+
qrItem: QuestionnaireResponseItem | null;
|
|
5
|
+
isRepeated: boolean;
|
|
6
|
+
isTabled: boolean;
|
|
7
|
+
parentIsReadOnly?: boolean;
|
|
8
|
+
onQrItemChange: (qrItem: QuestionnaireResponseItem) => unknown;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=customOverrideComponent.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customOverrideComponent.interface.js","sourceRoot":"","sources":["../../src/interfaces/customOverrideComponent.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -2,4 +2,4 @@ export type { Tab, Tabs } from './tab.interface';
|
|
|
2
2
|
export type { Variables, VariableXFhirQuery } from './variables.interface';
|
|
3
3
|
export type { LaunchContext } from './populate.interface';
|
|
4
4
|
export type { EnableWhenItems, EnableWhenExpressions } from './enableWhen.interface';
|
|
5
|
-
export type {
|
|
5
|
+
export type { QItemOverrideComponentProps, SdcUiOverrideComponentProps } from './overrideComponent.interface';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
+
export interface QItemOverrideComponentProps {
|
|
3
|
+
qItem: QuestionnaireItem;
|
|
4
|
+
qrItem: QuestionnaireResponseItem | null;
|
|
5
|
+
isRepeated: boolean;
|
|
6
|
+
isTabled: boolean;
|
|
7
|
+
parentIsReadOnly?: boolean;
|
|
8
|
+
onQrItemChange: (qrItem: QuestionnaireResponseItem) => unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface SdcUiOverrideComponentProps {
|
|
11
|
+
displayText: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
+
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=overrideComponent.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overrideComponent.interface.js","sourceRoot":"","sources":["../../src/interfaces/overrideComponent.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { QuestionnaireItem, type QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
+
export interface QItemOverrideComponentProps {
|
|
3
|
+
qItem: QuestionnaireItem;
|
|
4
|
+
qrItem: QuestionnaireResponseItem | null;
|
|
5
|
+
isRepeated: boolean;
|
|
6
|
+
isTabled: boolean;
|
|
7
|
+
parentIsReadOnly?: boolean;
|
|
8
|
+
onQrItemChange: (qrItem: QuestionnaireResponseItem) => unknown;
|
|
9
|
+
}
|