@aehrc/smart-forms-renderer 1.3.0 → 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/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/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 +38 -6
- 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/package.json +3 -3
- 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/RepeatGroup/RepeatGroupView.tsx +1 -1
- package/src/components/FormComponents/Tables/GroupTableView.tsx +1 -1
- package/src/components/Renderer/FormBodySingleCollapsible.tsx +1 -1
- package/src/components/Renderer/FormBodyTabbed.tsx +48 -7
- package/src/components/Tabs/FormBodyTabListWrapper.tsx +3 -2
- package/src/hooks/index.ts +3 -0
- 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,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,8BAA8B,CACrC,KAA0C;IAE1C,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,+BAA+B,EAAE,4BAA4B,EAAE,GAC1F,KAAK,CAAC;IAER,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,YAAY;YACrC,CAAC,OAAO,cAAc,CAAC,KAAK,KAAK,SAAS,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,CAAC,EAC5E;YACA,6CAA6C;YAC7C,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACxB,UAAU,CAAC,GAAG,EAAE;gBACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC,EAAE,GAAG,CAAC,CAAC;YAER,qCAAqC;YACrC,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,EAAE;gBACjC,4BAA4B,EAAE,CAAC;gBAC/B,OAAO;aACR;YAED,wCAAwC;YACxC,+BAA+B,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;SACvD;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 +0,0 @@
|
|
|
1
|
-
export declare function useCalculatedExpressionAnimating(answerKey: string | undefined): 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,WAAW,CAAC;AAalD,SAAS,8BAA8B,CACrC,KAA0C;IAE1C,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,+BAA+B,EAAE,4BAA4B,EAAE,GACxF,KAAK,CAAC;IAER,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,GAAG,cAAc,CAAC,KAAK,CAAC;YAEjD,IAAI,mBAAmB,KAAK,QAAQ,CAAC,UAAU,CAAC,EAAE;gBAChD,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,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;
|
|
@@ -1,69 +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 useStringCalculatedExpression(props) {
|
|
20
|
-
const { qItem, inputValue, onChangeByCalcExpressionString, onChangeByCalcExpressionNull } = props;
|
|
21
|
-
const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
|
|
22
|
-
const [calculationStatus, setCalculationStatus] = useState(null);
|
|
23
|
-
const [calcExpUpdated, setCalcExpUpdated] = useState(false);
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
var _a;
|
|
26
|
-
const calcExpression = (_a = calculatedExpressions[qItem.linkId]) === null || _a === void 0 ? void 0 : _a.find((exp) => exp.from === 'item');
|
|
27
|
-
if (!calcExpression || calculationStatus === 'off') {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Calculation was never performed, set it to "on"
|
|
31
|
-
if (calculationStatus === null) {
|
|
32
|
-
setCalculationStatus('on');
|
|
33
|
-
}
|
|
34
|
-
// only update if calculated value is different from current value
|
|
35
|
-
if (calcExpression.value !== inputValue &&
|
|
36
|
-
(typeof calcExpression.value === 'string' ||
|
|
37
|
-
typeof calcExpression.value === 'number' ||
|
|
38
|
-
calcExpression.value === null)) {
|
|
39
|
-
if (inputValue === '' && calcExpression.value === null) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
// Update ui to show calculated value changes
|
|
43
|
-
setCalcExpUpdated(true);
|
|
44
|
-
setTimeout(() => {
|
|
45
|
-
setCalcExpUpdated(false);
|
|
46
|
-
}, 500);
|
|
47
|
-
// calculatedExpression value is null
|
|
48
|
-
if (calcExpression.value === null) {
|
|
49
|
-
onChangeByCalcExpressionNull();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// calculatedExpression value is a string or number
|
|
53
|
-
const newInputValue = typeof calcExpression.value === 'string'
|
|
54
|
-
? calcExpression.value
|
|
55
|
-
: calcExpression.value.toString();
|
|
56
|
-
onChangeByCalcExpressionString(newInputValue);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
// Only trigger this effect if calculatedExpression of item changes
|
|
60
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
-
[calculationStatus, calculatedExpressions]);
|
|
62
|
-
return {
|
|
63
|
-
calculationStatus: calculationStatus,
|
|
64
|
-
calcExpUpdated: calcExpUpdated,
|
|
65
|
-
onChangeCalculationStatus: setCalculationStatus
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export default useStringCalculatedExpression;
|
|
69
|
-
//# sourceMappingURL=useStringCalculatedExpression.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStringCalculatedExpression.js","sourceRoot":"","sources":["../../src/hooks/useStringCalculatedExpression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAelD,SAAS,6BAA6B,CACpC,KAAyC;IAEzC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,GAAG,KAAK,CAAC;IAElG,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAEhF,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAsB,IAAI,CAAC,CAAC;IACtF,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,IAAI,iBAAiB,KAAK,KAAK,EAAE;YAClD,OAAO;SACR;QAED,kDAAkD;QAClD,IAAI,iBAAiB,KAAK,IAAI,EAAE;YAC9B,oBAAoB,CAAC,IAAI,CAAC,CAAC;SAC5B;QAED,kEAAkE;QAClE,IACE,cAAc,CAAC,KAAK,KAAK,UAAU;YACnC,CAAC,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;gBACvC,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;gBACxC,cAAc,CAAC,KAAK,KAAK,IAAI,CAAC,EAChC;YACA,IAAI,UAAU,KAAK,EAAE,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,EAAE;gBACtD,OAAO;aACR;YAED,6CAA6C;YAC7C,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACxB,UAAU,CAAC,GAAG,EAAE;gBACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC,EAAE,GAAG,CAAC,CAAC;YAER,qCAAqC;YACrC,IAAI,cAAc,CAAC,KAAK,KAAK,IAAI,EAAE;gBACjC,4BAA4B,EAAE,CAAC;gBAC/B,OAAO;aACR;YAED,mDAAmD;YACnD,MAAM,aAAa,GACjB,OAAO,cAAc,CAAC,KAAK,KAAK,QAAQ;gBACtC,CAAC,CAAC,cAAc,CAAC,KAAK;gBACtB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YAEtC,8BAA8B,CAAC,aAAa,CAAC,CAAC;SAC/C;IACH,CAAC;IACD,mEAAmE;IACnE,uDAAuD;IACvD,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAC3C,CAAC;IAEF,OAAO;QACL,iBAAiB,EAAE,iBAAiB;QACpC,cAAc,EAAE,cAAc;QAC9B,yBAAyB,EAAE,oBAAoB;KAChD,CAAC;AACJ,CAAC;AAED,eAAe,6BAA6B,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 useStringInput(valueFromProps) {
|
|
19
|
-
const [input, setInput] = useState(valueFromProps);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (input !== valueFromProps) {
|
|
22
|
-
setInput(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 [input, setInput];
|
|
29
|
-
}
|
|
30
|
-
export default useStringInput;
|
|
31
|
-
//# sourceMappingURL=useStringInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStringInput.js","sourceRoot":"","sources":["../../src/hooks/useStringInput.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,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a single step in the path to an item within a nested QuestionnaireResponse.
|
|
3
|
-
* Each step is identified by its `linkId`, and optionally a `repeatIndex` if the item
|
|
4
|
-
* occurs within a repeating group.
|
|
5
|
-
*/
|
|
6
|
-
export interface ItemPathSegment {
|
|
7
|
-
/** The `linkId` of the QuestionnaireResponseItem at this path segment. */
|
|
8
|
-
linkId: string;
|
|
9
|
-
/**
|
|
10
|
-
* The index of the repeated item if this segment occurs within a repeating group.
|
|
11
|
-
* Omitted if the item is not part of a repeating group.
|
|
12
|
-
*/
|
|
13
|
-
repeatIndex?: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Represents a full path from the root of a QuestionnaireResponse to a deeply nested item.
|
|
17
|
-
* Each segment corresponds to one level of the item hierarchy.
|
|
18
|
-
*
|
|
19
|
-
* Example:
|
|
20
|
-
* [
|
|
21
|
-
* { linkId: 'sectionA' },
|
|
22
|
-
* { linkId: 'groupB', repeatIndex: 1 },
|
|
23
|
-
* { linkId: 'questionC' }
|
|
24
|
-
* ]
|
|
25
|
-
*
|
|
26
|
-
* This path navigates through `sectionA`, into the second instance of `groupB`,
|
|
27
|
-
* and finally to `questionC`.
|
|
28
|
-
*
|
|
29
|
-
* @author Sean Fong
|
|
30
|
-
*/
|
|
31
|
-
export type ItemPath = ItemPathSegment[];
|