@aehrc/smart-forms-renderer 1.2.14 → 1.3.1
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/ChoiceItems/ChoiceAutocompleteField.js +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +1 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -1
- package/lib/components/FormComponents/GridGroup/GridRow.js +1 -1
- package/lib/components/FormComponents/GridGroup/GridRow.js.map +1 -1
- package/lib/components/FormComponents/GroupItem/GroupAccordion.d.ts +10 -0
- package/lib/components/FormComponents/GroupItem/GroupAccordion.js +71 -0
- package/lib/components/FormComponents/GroupItem/GroupAccordion.js.map +1 -0
- package/lib/components/FormComponents/GroupItem/GroupAccordion.styles.d.ts +1 -1
- package/lib/components/FormComponents/GroupItem/GroupAccordion.styles.js +1 -1
- package/lib/components/FormComponents/GroupItem/GroupAccordion.styles.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/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js +1 -1
- package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js.map +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupView.js +1 -1
- package/lib/components/FormComponents/RepeatGroup/RepeatGroupView.js.map +1 -1
- package/lib/components/FormComponents/Tables/GroupTableView.js +1 -1
- package/lib/components/FormComponents/Tables/GroupTableView.js.map +1 -1
- package/lib/components/Renderer/FormBodySingleCollapsible.js +1 -1
- package/lib/components/Renderer/FormBodySingleCollapsible.js.map +1 -1
- package/lib/components/Renderer/FormBodyTabbed.js +57 -4
- package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
- package/lib/components/Tabs/FormBodyTabListWrapper.d.ts +1 -0
- package/lib/components/Tabs/FormBodyTabListWrapper.js +2 -2
- package/lib/components/Tabs/FormBodyTabListWrapper.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useValueSetCodings.js +2 -1
- package/lib/hooks/useValueSetCodings.js.map +1 -1
- package/lib/stores/rendererConfigStore.d.ts +7 -0
- package/lib/stores/rendererConfigStore.js +2 -0
- package/lib/stores/rendererConfigStore.js.map +1 -1
- package/lib/stores/smartConfigStore.d.ts +7 -1
- package/lib/stores/smartConfigStore.js +3 -1
- package/lib/stores/smartConfigStore.js.map +1 -1
- package/lib/utils/populateContexts.js +2 -14
- package/lib/utils/populateContexts.js.map +1 -1
- package/lib/utils/valueSet.d.ts +1 -1
- package/lib/utils/valueSet.js +2 -2
- package/lib/utils/valueSet.js.map +1 -1
- package/package.json +3 -3
- package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.tsx +1 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +1 -1
- package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +1 -1
- package/src/components/FormComponents/GridGroup/GridRow.tsx +6 -1
- package/src/components/FormComponents/GroupItem/GroupAccordion.styles.ts +1 -1
- package/src/components/FormComponents/GroupItem/GroupAccordion.tsx +93 -0
- package/src/components/FormComponents/GroupItem/GroupItemView.tsx +1 -1
- package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +1 -1
- package/src/components/FormComponents/RepeatGroup/RepeatGroupView.tsx +1 -1
- package/src/components/FormComponents/Tables/GroupTableView.tsx +1 -1
- package/src/components/Renderer/FormBodySingleCollapsible.tsx +2 -1
- package/src/components/Renderer/FormBodyTabbed.tsx +67 -5
- package/src/components/Tabs/FormBodyTabListWrapper.tsx +3 -2
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useValueSetCodings.ts +8 -1
- package/src/stores/rendererConfigStore.ts +8 -0
- package/src/stores/smartConfigStore.ts +11 -2
- package/src/utils/populateContexts.ts +2 -16
- package/src/utils/valueSet.ts +3 -2
- package/lib/components/FormComponents/ItemParts/FadingCheckIcon.d.ts +0 -7
- package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js +0 -26
- package/lib/components/FormComponents/ItemParts/FadingCheckIcon.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/ItemLabelText.d.ts +0 -8
- package/lib/components/FormComponents/ItemParts/ItemLabelText.js +0 -63
- package/lib/components/FormComponents/ItemParts/ItemLabelText.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.d.ts +0 -8
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js +0 -53
- package/lib/components/FormComponents/ItemParts/ItemLabelWrapper.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.d.ts +0 -7
- package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.js +0 -39
- package/lib/components/FormComponents/ItemParts/ItemTextSwitcher copy.js.map +0 -1
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.d.ts +0 -10
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js +0 -30
- package/lib/components/FormComponents/RepeatGroup/DeleteItemButton.js.map +0 -1
- package/lib/components/Iconify/Iconify.d.ts +0 -10
- package/lib/components/Iconify/Iconify.js +0 -26
- package/lib/components/Iconify/Iconify.js.map +0 -1
- package/lib/components/Renderer/FormBodyPage.d.ts +0 -9
- package/lib/components/Renderer/FormBodyPage.js +0 -43
- package/lib/components/Renderer/FormBodyPage.js.map +0 -1
- package/lib/components/Renderer/FormTitle.d.ts +0 -7
- package/lib/components/Renderer/FormTitle.js +0 -30
- package/lib/components/Renderer/FormTitle.js.map +0 -1
- package/lib/components/Renderer/FormTopLevelPage.d.ts +0 -9
- package/lib/components/Renderer/FormTopLevelPage.js +0 -29
- package/lib/components/Renderer/FormTopLevelPage.js.map +0 -1
- package/lib/hooks/useBooleanCalculatedExpression.d.ts +0 -12
- package/lib/hooks/useBooleanCalculatedExpression.js +0 -52
- package/lib/hooks/useBooleanCalculatedExpression.js.map +0 -1
- package/lib/hooks/useCalculatedExpressionAnimating.d.ts +0 -1
- package/lib/hooks/useCalculatedExpressionAnimating.js +0 -18
- package/lib/hooks/useCalculatedExpressionAnimating.js.map +0 -1
- package/lib/hooks/useDecimalCalculatedExpression.d.ts +0 -13
- package/lib/hooks/useDecimalCalculatedExpression.js +0 -58
- package/lib/hooks/useDecimalCalculatedExpression.js.map +0 -1
- package/lib/hooks/useInitialiseGroupTable.d.ts +0 -4
- package/lib/hooks/useInitialiseGroupTable.js +0 -36
- package/lib/hooks/useInitialiseGroupTable.js.map +0 -1
- package/lib/hooks/useIntegerCalculatedExpression.d.ts +0 -12
- package/lib/hooks/useIntegerCalculatedExpression.js +0 -55
- package/lib/hooks/useIntegerCalculatedExpression.js.map +0 -1
- package/lib/hooks/useNumberInput.d.ts +0 -3
- package/lib/hooks/useNumberInput.js +0 -31
- package/lib/hooks/useNumberInput.js.map +0 -1
- package/lib/hooks/useRepeatAnswers.d.ts +0 -4
- package/lib/hooks/useRepeatAnswers.js +0 -34
- package/lib/hooks/useRepeatAnswers.js.map +0 -1
- package/lib/hooks/useRepeatGroups.d.ts +0 -4
- package/lib/hooks/useRepeatGroups.js +0 -34
- package/lib/hooks/useRepeatGroups.js.map +0 -1
- package/lib/hooks/useShowFeedback.d.ts +0 -11
- package/lib/hooks/useShowFeedback.js +0 -33
- package/lib/hooks/useShowFeedback.js.map +0 -1
- package/lib/hooks/useStringCalculatedExpression.d.ts +0 -14
- package/lib/hooks/useStringCalculatedExpression.js +0 -69
- package/lib/hooks/useStringCalculatedExpression.js.map +0 -1
- package/lib/hooks/useStringInput.d.ts +0 -3
- package/lib/hooks/useStringInput.js +0 -31
- package/lib/hooks/useStringInput.js.map +0 -1
- package/lib/interfaces/itemPath.interface.d.ts +0 -31
- package/lib/interfaces/itemPath.interface.js +0 -2
- package/lib/interfaces/itemPath.interface.js.map +0 -1
- package/lib/interfaces/repeatItem.interface.d.ts +0 -5
- package/lib/interfaces/repeatItem.interface.js +0 -2
- package/lib/interfaces/repeatItem.interface.js.map +0 -1
- package/lib/stores/rendererStylingStore.d.ts +0 -144
- package/lib/stores/rendererStylingStore.js +0 -68
- package/lib/stores/rendererStylingStore.js.map +0 -1
- package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.d.ts +0 -30
- package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.js +0 -46
- package/lib/stories/storybookWrappers/InitialiseFormWrapperForStorybook.js.map +0 -1
- package/lib/stories/storybookWrappers/index.d.ts +0 -2
- package/lib/stories/storybookWrappers/index.js +0 -18
- package/lib/stories/storybookWrappers/index.js.map +0 -1
- package/lib/stories/testUtils.d.ts +0 -23
- package/lib/stories/testUtils.js +0 -249
- package/lib/stories/testUtils.js.map +0 -1
- package/lib/theme/Theme.d.ts +0 -44
- package/lib/theme/Theme.js +0 -45
- package/lib/theme/Theme.js.map +0 -1
- package/lib/theme/customGlobalStyles.d.ts +0 -2
- package/lib/theme/customGlobalStyles.js +0 -61
- package/lib/theme/customGlobalStyles.js.map +0 -1
- package/lib/theme/overrides/Accordion.d.ts +0 -14
- package/lib/theme/overrides/Accordion.js +0 -32
- package/lib/theme/overrides/Accordion.js.map +0 -1
- package/lib/theme/overrides/Autocomplete.d.ts +0 -10
- package/lib/theme/overrides/Autocomplete.js +0 -28
- package/lib/theme/overrides/Autocomplete.js.map +0 -1
- package/lib/theme/overrides/Button.d.ts +0 -33
- package/lib/theme/overrides/Button.js +0 -52
- package/lib/theme/overrides/Button.js.map +0 -1
- package/lib/theme/overrides/Card.d.ts +0 -35
- package/lib/theme/overrides/Card.js +0 -49
- package/lib/theme/overrides/Card.js.map +0 -1
- package/lib/theme/overrides/Input.d.ts +0 -64
- package/lib/theme/overrides/Input.js +0 -81
- package/lib/theme/overrides/Input.js.map +0 -1
- package/lib/theme/overrides/Overrides.d.ts +0 -3
- package/lib/theme/overrides/Overrides.js +0 -29
- package/lib/theme/overrides/Overrides.js.map +0 -1
- package/lib/theme/overrides/Paper.d.ts +0 -12
- package/lib/theme/overrides/Paper.js +0 -31
- package/lib/theme/overrides/Paper.js.map +0 -1
- package/lib/theme/overrides/SpeedDial.d.ts +0 -16
- package/lib/theme/overrides/SpeedDial.js +0 -34
- package/lib/theme/overrides/SpeedDial.js.map +0 -1
- package/lib/theme/overrides/Table.d.ts +0 -12
- package/lib/theme/overrides/Table.js +0 -30
- package/lib/theme/overrides/Table.js.map +0 -1
- package/lib/theme/palette.d.ts +0 -27
- package/lib/theme/palette.js +0 -67
- package/lib/theme/palette.js.map +0 -1
- package/lib/theme/shadows.d.ts +0 -2
- package/lib/theme/shadows.js +0 -52
- package/lib/theme/shadows.js.map +0 -1
- package/lib/utils/answerExpression.d.ts +0 -18
- package/lib/utils/answerExpression.js +0 -133
- package/lib/utils/answerExpression.js.map +0 -1
- package/lib/utils/dayjsExtend.d.ts +0 -1
- package/lib/utils/dayjsExtend.js +0 -22
- package/lib/utils/dayjsExtend.js.map +0 -1
- package/lib/utils/dynamicValueSet.d.ts +0 -5
- package/lib/utils/dynamicValueSet.js +0 -96
- package/lib/utils/dynamicValueSet.js.map +0 -1
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.d.ts +0 -14
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.js +0 -639
- package/lib/utils/fhirpathAsyncUtils/fhirpath-async.js.map +0 -1
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.d.ts +0 -3
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.js +0 -41
- package/lib/utils/fhirpathAsyncUtils/outcome-utils.js.map +0 -1
- package/lib/utils/itemControl.d.ts +0 -97
- package/lib/utils/itemControl.js +0 -336
- package/lib/utils/itemControl.js.map +0 -1
- package/lib/utils/itemPath.d.ts +0 -57
- package/lib/utils/itemPath.js +0 -75
- package/lib/utils/itemPath.js.map +0 -1
- package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.d.ts +0 -2
- package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js +0 -43
- package/lib/utils/questionnaireStoreUtils/addAdditionalVariables.js.map +0 -1
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.d.ts +0 -3
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js +0 -101
- package/lib/utils/questionnaireStoreUtils/createQuestionaireModel.js.map +0 -1
- package/lib/utils/validateQuestionnaire.d.ts +0 -66
- package/lib/utils/validateQuestionnaire.js +0 -559
- package/lib/utils/validateQuestionnaire.js.map +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import React, { memo } from 'react';
|
|
18
|
-
import parse from 'html-react-parser';
|
|
19
|
-
import { getXHtmlStringFromQuestionnaire } from '../../utils/qItem';
|
|
20
|
-
import { FormTitleWrapper } from '../Box.styles';
|
|
21
|
-
import Typography from '@mui/material/Typography';
|
|
22
|
-
const FormTitle = memo(function FormTitle(props) {
|
|
23
|
-
const { questionnaire } = props;
|
|
24
|
-
const xHtmlString = getXHtmlStringFromQuestionnaire(questionnaire);
|
|
25
|
-
const formTitle = xHtmlString ? parse(xHtmlString) : questionnaire.title;
|
|
26
|
-
return (React.createElement(FormTitleWrapper, null,
|
|
27
|
-
React.createElement(Typography, { variant: "h3", "data-test": "form-heading" }, formTitle)));
|
|
28
|
-
});
|
|
29
|
-
export default FormTitle;
|
|
30
|
-
//# sourceMappingURL=FormTitle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormTitle.js","sourceRoot":"","sources":["../../../src/components/Renderer/FormTitle.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAMlD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,SAAS,CAAC,KAAqB;IAC7D,MAAM,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAEhC,MAAM,WAAW,GAAG,+BAA+B,CAAC,aAAa,CAAC,CAAC;IACnE,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;IAEzE,OAAO,CACL,oBAAC,gBAAgB;QACf,oBAAC,UAAU,IAAC,OAAO,EAAC,IAAI,eAAW,cAAc,IAC9C,SAAS,CACC,CACI,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,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,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { QuestionnaireItem } from 'fhir/r4';
|
|
2
|
-
interface UseBooleanCalculatedExpression {
|
|
3
|
-
calcExpUpdated: boolean;
|
|
4
|
-
}
|
|
5
|
-
interface UseBooleanCalculatedExpressionProps {
|
|
6
|
-
qItem: QuestionnaireItem;
|
|
7
|
-
booleanValue: boolean | undefined;
|
|
8
|
-
onChangeByCalcExpressionBoolean: (newValueBoolean: boolean) => void;
|
|
9
|
-
onChangeByCalcExpressionNull: () => void;
|
|
10
|
-
}
|
|
11
|
-
declare function useBooleanCalculatedExpression(props: UseBooleanCalculatedExpressionProps): UseBooleanCalculatedExpression;
|
|
12
|
-
export default useBooleanCalculatedExpression;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useEffect, useState } from 'react';
|
|
18
|
-
import { useQuestionnaireStore } from '../stores';
|
|
19
|
-
function useBooleanCalculatedExpression(props) {
|
|
20
|
-
const { qItem, booleanValue, onChangeByCalcExpressionBoolean, onChangeByCalcExpressionNull } = props;
|
|
21
|
-
const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
|
|
22
|
-
const [calcExpUpdated, setCalcExpUpdated] = useState(false);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
var _a;
|
|
25
|
-
const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item');
|
|
26
|
-
if (!calcExpression) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// only update if calculated value is different from current value
|
|
30
|
-
if (calcExpression.value !== booleanValue &&
|
|
31
|
-
(typeof calcExpression.value === 'boolean' || calcExpression.value === null)) {
|
|
32
|
-
// update ui to show calculated value changes
|
|
33
|
-
setCalcExpUpdated(true);
|
|
34
|
-
setTimeout(() => {
|
|
35
|
-
setCalcExpUpdated(false);
|
|
36
|
-
}, 500);
|
|
37
|
-
// calculatedExpression value is null
|
|
38
|
-
if (calcExpression.value === null) {
|
|
39
|
-
onChangeByCalcExpressionNull();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
// calculatedExpression value is boolean
|
|
43
|
-
onChangeByCalcExpressionBoolean(calcExpression.value);
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
// Only trigger this effect if calculatedExpression of item changes
|
|
47
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
-
[calculatedExpressions]);
|
|
49
|
-
return { calcExpUpdated: calcExpUpdated };
|
|
50
|
-
}
|
|
51
|
-
export default useBooleanCalculatedExpression;
|
|
52
|
-
//# sourceMappingURL=useBooleanCalculatedExpression.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBooleanCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useBooleanCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAalD,SAAS,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ined): boolean;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
export function useCalculatedExpressionAnimating(answerKey) {
|
|
3
|
-
const [animating, setAnimating] = useState(false);
|
|
4
|
-
const previousAnswerKey = useRef(null);
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
if (answerKey &&
|
|
7
|
-
answerKey !== previousAnswerKey.current &&
|
|
8
|
-
answerKey.includes('calculatedExpression')) {
|
|
9
|
-
previousAnswerKey.current = answerKey;
|
|
10
|
-
setAnimating(true);
|
|
11
|
-
const timer = setTimeout(() => setAnimating(false), 1000);
|
|
12
|
-
return () => clearTimeout(timer);
|
|
13
|
-
}
|
|
14
|
-
return undefined;
|
|
15
|
-
}, [answerKey]);
|
|
16
|
-
return animating;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=useCalculatedExpressionAnimating.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCalculatedExpressionAnimating.js","sourceRoot":"","sources":["../../src/hooks/useCalculatedExpressionAnimating.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,MAAM,UAAU,gCAAgC,CAAC,SAA6B;IAC5E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,iBAAiB,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAEtD,SAAS,CAAC,GAAG,EAAE;QACb,IACE,SAAS;YACT,SAAS,KAAK,iBAAiB,CAAC,OAAO;YACvC,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAC1C,CAAC;YACD,iBAAiB,CAAC,OAAO,GAAG,SAAS,CAAC;YACtC,YAAY,CAAC,IAAI,CAAC,CAAC;YAEnB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;YAE1D,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { QuestionnaireItem } from 'fhir/r4';
|
|
2
|
-
interface UseDecimalCalculatedExpression {
|
|
3
|
-
calcExpUpdated: boolean;
|
|
4
|
-
}
|
|
5
|
-
interface useDecimalCalculatedExpressionProps {
|
|
6
|
-
qItem: QuestionnaireItem;
|
|
7
|
-
inputValue: string;
|
|
8
|
-
precision: number | null;
|
|
9
|
-
onChangeByCalcExpressionDecimal: (calcExpressionValue: number) => void;
|
|
10
|
-
onChangeByCalcExpressionNull: () => void;
|
|
11
|
-
}
|
|
12
|
-
declare function useDecimalCalculatedExpression(props: useDecimalCalculatedExpressionProps): UseDecimalCalculatedExpression;
|
|
13
|
-
export default useDecimalCalculatedExpression;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useEffect, useState } from 'react';
|
|
18
|
-
import { useQuestionnaireStore } from '../stores';
|
|
19
|
-
function useDecimalCalculatedExpression(props) {
|
|
20
|
-
const { qItem, inputValue, precision, onChangeByCalcExpressionDecimal, onChangeByCalcExpressionNull } = props;
|
|
21
|
-
const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
|
|
22
|
-
const [calcExpUpdated, setCalcExpUpdated] = useState(false);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
var _a;
|
|
25
|
-
const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item');
|
|
26
|
-
if (!calcExpression) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// only update if calculated value is different from current value
|
|
30
|
-
if (calcExpression.value !== inputValue &&
|
|
31
|
-
(typeof calcExpression.value === 'number' || calcExpression.value === null)) {
|
|
32
|
-
const calcExpressionValue = typeof calcExpression.value === 'number' && typeof precision === 'number'
|
|
33
|
-
? parseFloat(calcExpression.value.toFixed(precision))
|
|
34
|
-
: calcExpression.value;
|
|
35
|
-
// only update if calculated value is different from current value
|
|
36
|
-
if (calcExpressionValue !== parseFloat(inputValue)) {
|
|
37
|
-
// update ui to show calculated value changes
|
|
38
|
-
setCalcExpUpdated(true);
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
setCalcExpUpdated(false);
|
|
41
|
-
}, 500);
|
|
42
|
-
// calculatedExpression value is null
|
|
43
|
-
if (calcExpressionValue === null) {
|
|
44
|
-
onChangeByCalcExpressionNull();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
// calculatedExpression value is a number
|
|
48
|
-
onChangeByCalcExpressionDecimal(calcExpressionValue);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
// Only trigger this effect if calculatedExpression of item changes
|
|
53
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
-
[calculatedExpressions]);
|
|
55
|
-
return { calcExpUpdated: calcExpUpdated };
|
|
56
|
-
}
|
|
57
|
-
export default useDecimalCalculatedExpression;
|
|
58
|
-
//# sourceMappingURL=useDecimalCalculatedExpression.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDecimalCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useDecimalCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAclD,SAAS,8BAA8B,CACrC,KAA0C;IAE1C,MAAM,EACJ,KAAK,EACL,UAAU,EACV,SAAS,EACT,+BAA+B,EAC/B,4BAA4B,EAC7B,GAAG,KAAK,CAAC;IAEV,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAEhF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5D,SAAS,CACP,GAAG,EAAE;;QACH,MAAM,cAAc,GAAG,MAAA,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,0CAAE,IAAI,CAC9D,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAC7B,CAAC;QAEF,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,kEAAkE;QAClE,IACE,cAAc,CAAC,KAAK,KAAK,UAAU;YACnC,CAAC,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,CAAC,EAC3E;YACA,MAAM,mBAAmB,GACvB,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,SAAS,KAAK,QAAQ;gBACvE,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBACrD,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;YAE3B,kEAAkE;YAClE,IAAI,mBAAmB,KAAK,UAAU,CAAC,UAAU,CAAC,EAAE;gBAClD,6CAA6C;gBAC7C,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBACxB,UAAU,CAAC,GAAG,EAAE;oBACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAC3B,CAAC,EAAE,GAAG,CAAC,CAAC;gBAER,qCAAqC;gBACrC,IAAI,mBAAmB,KAAK,IAAI,EAAE;oBAChC,4BAA4B,EAAE,CAAC;oBAC/B,OAAO;iBACR;gBAED,yCAAyC;gBACzC,+BAA+B,CAAC,mBAAmB,CAAC,CAAC;aACtD;SACF;IACH,CAAC;IACD,mEAAmE;IACnE,uDAAuD;IACvD,CAAC,qBAAqB,CAAC,CACxB,CAAC;IAEF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC;AAC5C,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { QuestionnaireResponseItem } from 'fhir/r4';
|
|
2
|
-
import type { GroupTableRowModel } from '../interfaces/groupTable.interface';
|
|
3
|
-
declare function useInitialiseGroupTable(qrItems: QuestionnaireResponseItem[]): GroupTableRowModel[];
|
|
4
|
-
export default useInitialiseGroupTable;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { nanoid } from 'nanoid';
|
|
18
|
-
function useInitialiseGroupTable(qrItems) {
|
|
19
|
-
let initialGroupTableRows = [
|
|
20
|
-
{
|
|
21
|
-
nanoId: nanoid(),
|
|
22
|
-
qrItem: null
|
|
23
|
-
}
|
|
24
|
-
];
|
|
25
|
-
if (qrItems.length > 0) {
|
|
26
|
-
initialGroupTableRows = qrItems.map((qrItem) => {
|
|
27
|
-
return {
|
|
28
|
-
nanoId: nanoid(),
|
|
29
|
-
qrItem
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return initialGroupTableRows;
|
|
34
|
-
}
|
|
35
|
-
export default useInitialiseGroupTable;
|
|
36
|
-
//# sourceMappingURL=useInitialiseGroupTable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInitialiseGroupTable.js","sourceRoot":"","sources":["../../src/hooks/useInitialiseGroupTable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,SAAS,uBAAuB,CAAC,OAAoC;IACnE,IAAI,qBAAqB,GAAyB;QAChD;YACE,MAAM,EAAE,MAAM,EAAE;YAChB,MAAM,EAAE,IAAI;SACb;KACF,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACtB,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC7C,OAAO;gBACL,MAAM,EAAE,MAAM,EAAE;gBAChB,MAAM;aACP,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { QuestionnaireItem } from 'fhir/r4';
|
|
2
|
-
interface UseIntegerCalculatedExpression {
|
|
3
|
-
calcExpUpdated: boolean;
|
|
4
|
-
}
|
|
5
|
-
interface useIntegerCalculatedExpressionProps {
|
|
6
|
-
qItem: QuestionnaireItem;
|
|
7
|
-
inputValue: string;
|
|
8
|
-
onChangeByCalcExpressionInteger: (calcExpressionValue: number) => void;
|
|
9
|
-
onChangeByCalcExpressionNull: () => void;
|
|
10
|
-
}
|
|
11
|
-
declare function useIntegerCalculatedExpression(props: useIntegerCalculatedExpressionProps): UseIntegerCalculatedExpression;
|
|
12
|
-
export default useIntegerCalculatedExpression;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useEffect, useState } from 'react';
|
|
18
|
-
import { useQuestionnaireStore } from '../stores';
|
|
19
|
-
function useIntegerCalculatedExpression(props) {
|
|
20
|
-
const { qItem, inputValue, onChangeByCalcExpressionInteger, onChangeByCalcExpressionNull } = props;
|
|
21
|
-
const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
|
|
22
|
-
const [calcExpUpdated, setCalcExpUpdated] = useState(false);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
var _a;
|
|
25
|
-
const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item');
|
|
26
|
-
if (!calcExpression) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// only update if calculated value is different from current value
|
|
30
|
-
if (calcExpression.value !== inputValue &&
|
|
31
|
-
(typeof calcExpression.value === 'number' || calcExpression.value === null)) {
|
|
32
|
-
const calcExpressionValue = calcExpression.value;
|
|
33
|
-
if (calcExpressionValue !== parseInt(inputValue)) {
|
|
34
|
-
// update ui to show calculated value changes
|
|
35
|
-
setCalcExpUpdated(true);
|
|
36
|
-
setTimeout(() => {
|
|
37
|
-
setCalcExpUpdated(false);
|
|
38
|
-
}, 500);
|
|
39
|
-
// calculatedExpression value is null
|
|
40
|
-
if (calcExpressionValue === null) {
|
|
41
|
-
onChangeByCalcExpressionNull();
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
// calculatedExpression value is a number
|
|
45
|
-
onChangeByCalcExpressionInteger(calcExpressionValue);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
// Only trigger this effect if calculatedExpression of item changes
|
|
50
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
-
[calculatedExpressions]);
|
|
52
|
-
return { calcExpUpdated: calcExpUpdated };
|
|
53
|
-
}
|
|
54
|
-
export default useIntegerCalculatedExpression;
|
|
55
|
-
//# sourceMappingURL=useIntegerCalculatedExpression.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIntegerCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useIntegerCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WA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AAc,EAAE,CAAC;AAC5C,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useEffect, useState } from 'react';
|
|
18
|
-
function useNumberInput(valueFromProps) {
|
|
19
|
-
const [value, setValue] = useState(valueFromProps);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (value !== valueFromProps) {
|
|
22
|
-
setValue(valueFromProps);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
// Only trigger this effect if prop value changes
|
|
26
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
-
[valueFromProps]);
|
|
28
|
-
return [value, setValue];
|
|
29
|
-
}
|
|
30
|
-
export default useNumberInput;
|
|
31
|
-
//# sourceMappingURL=useNumberInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNumberInput.js","sourceRoot":"","sources":["../../src/hooks/useNumberInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,cAAc,CAAC,cAAsB;IAC5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEnD,SAAS,CACP,GAAG,EAAE;QACH,IAAI,KAAK,KAAK,cAAc,EAAE;YAC5B,QAAQ,CAAC,cAAc,CAAC,CAAC;SAC1B;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC3B,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import type { RepeatAnswer } from '../interfaces/repeatItem.interface';
|
|
3
|
-
declare function useRepeatAnswers(valueFromProps: RepeatAnswer[]): [RepeatAnswer[], Dispatch<SetStateAction<RepeatAnswer[]>>];
|
|
4
|
-
export default useRepeatAnswers;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useEffect, useState } from 'react';
|
|
18
|
-
import _isEqual from 'lodash/isEqual';
|
|
19
|
-
function useRepeatAnswers(valueFromProps) {
|
|
20
|
-
const [repeatAnswers, setRepeatAnswers] = useState(valueFromProps);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const valueFromPropsQRItemAnswers = valueFromProps.map((answer) => answer.answer);
|
|
23
|
-
const repeatAnswersQRItemAnswers = repeatAnswers.map((answer) => answer.answer);
|
|
24
|
-
if (!_isEqual(valueFromPropsQRItemAnswers, repeatAnswersQRItemAnswers)) {
|
|
25
|
-
setRepeatAnswers(valueFromProps);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
// Only trigger this effect if prop value changes
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
-
[valueFromProps]);
|
|
31
|
-
return [repeatAnswers, setRepeatAnswers];
|
|
32
|
-
}
|
|
33
|
-
export default useRepeatAnswers;
|
|
34
|
-
//# sourceMappingURL=useRepeatAnswers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRepeatAnswers.js","sourceRoot":"","sources":["../../src/hooks/useRepeatAnswers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,SAAS,gBAAgB,CACvB,cAA8B;IAE9B,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEnE,SAAS,CACP,GAAG,EAAE;QACH,MAAM,2BAA2B,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClF,MAAM,0BAA0B,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEhF,IAAI,CAAC,QAAQ,CAAC,2BAA2B,EAAE,0BAA0B,CAAC,EAAE;YACtE,gBAAgB,CAAC,cAAc,CAAC,CAAC;SAClC;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AAC3C,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import type { RepeatGroupSingle } from '../interfaces/repeatGroup.interface';
|
|
3
|
-
declare function useRepeatGroups(valueFromProps: RepeatGroupSingle[]): [RepeatGroupSingle[], Dispatch<SetStateAction<RepeatGroupSingle[]>>];
|
|
4
|
-
export default useRepeatGroups;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { useEffect, useState } from 'react';
|
|
18
|
-
import _isEqual from 'lodash/isEqual';
|
|
19
|
-
function useRepeatGroups(valueFromProps) {
|
|
20
|
-
const [repeatGroups, setRepeatGroups] = useState(valueFromProps);
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const valueFromPropsQRItems = valueFromProps.map((repeatGroupSingle) => repeatGroupSingle.qrItem);
|
|
23
|
-
const repeatGroupsQRItems = repeatGroups.map((repeatGroupSingle) => repeatGroupSingle.qrItem);
|
|
24
|
-
if (!_isEqual(valueFromPropsQRItems, repeatGroupsQRItems)) {
|
|
25
|
-
setRepeatGroups(valueFromProps);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
// Only trigger this effect if prop value changes
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
-
[valueFromProps]);
|
|
31
|
-
return [repeatGroups, setRepeatGroups];
|
|
32
|
-
}
|
|
33
|
-
export default useRepeatGroups;
|
|
34
|
-
//# sourceMappingURL=useRepeatGroups.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRepeatGroups.js","sourceRoot":"","sources":["../../src/hooks/useRepeatGroups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,SAAS,eAAe,CACtB,cAAmC;IAEnC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEjE,SAAS,CACP,GAAG,EAAE;QACH,MAAM,qBAAqB,GAAG,cAAc,CAAC,GAAG,CAC9C,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAChD,CAAC;QACF,MAAM,mBAAmB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAE9F,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,EAAE;YACzD,eAAe,CAAC,cAAc,CAAC,CAAC;SACjC;IACH,CAAC;IACD,iDAAiD;IACjD,uDAAuD;IACvD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;AACzC,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom React hook to manage validation feedback visibility based on user interaction with a form field (e.g., input or blur events).
|
|
3
|
-
* Shows feedback after the field has been blurred at least once.
|
|
4
|
-
*/
|
|
5
|
-
declare function useShowFeedback(): {
|
|
6
|
-
showFeedback: boolean;
|
|
7
|
-
setShowFeedback: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
8
|
-
hasBlurred: boolean;
|
|
9
|
-
setHasBlurred: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
10
|
-
};
|
|
11
|
-
export default useShowFeedback;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 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 { useState } from 'react';
|
|
18
|
-
/**
|
|
19
|
-
* Custom React hook to manage validation feedback visibility based on user interaction with a form field (e.g., input or blur events).
|
|
20
|
-
* Shows feedback after the field has been blurred at least once.
|
|
21
|
-
*/
|
|
22
|
-
function useShowFeedback() {
|
|
23
|
-
const [showFeedback, setShowFeedback] = useState(true);
|
|
24
|
-
const [hasBlurred, setHasBlurred] = useState(false);
|
|
25
|
-
return {
|
|
26
|
-
showFeedback,
|
|
27
|
-
setShowFeedback,
|
|
28
|
-
hasBlurred,
|
|
29
|
-
setHasBlurred
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export default useShowFeedback;
|
|
33
|
-
//# sourceMappingURL=useShowFeedback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useShowFeedback.js","sourceRoot":"","sources":["../../src/hooks/useShowFeedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC;;;GAGG;AACH,SAAS,eAAe;IACtB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO;QACL,YAAY;QACZ,eAAe;QACf,UAAU;QACV,aAAa;KACd,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { QuestionnaireItem } from 'fhir/r4';
|
|
2
|
-
interface UseStringCalculatedExpression {
|
|
3
|
-
calculationStatus: 'on' | 'off' | null;
|
|
4
|
-
calcExpUpdated: boolean;
|
|
5
|
-
onChangeCalculationStatus: (status: 'on' | 'off' | null) => void;
|
|
6
|
-
}
|
|
7
|
-
interface useStringCalculatedExpressionProps {
|
|
8
|
-
qItem: QuestionnaireItem;
|
|
9
|
-
inputValue: string;
|
|
10
|
-
onChangeByCalcExpressionString: (newValueString: string) => void;
|
|
11
|
-
onChangeByCalcExpressionNull: () => void;
|
|
12
|
-
}
|
|
13
|
-
declare function useStringCalculatedExpression(props: useStringCalculatedExpressionProps): UseStringCalculatedExpression;
|
|
14
|
-
export default useStringCalculatedExpression;
|