@aehrc/smart-forms-renderer 0.6.0 → 0.6.3
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/README.md +59 -0
- package/lib/components/FormComponents/TextItem/MuiTextField.d.ts +3 -0
- package/lib/components/{FormRenderer/index.js → FormComponents/TextItem/MuiTextField.js} +4 -3
- package/lib/components/FormComponents/TextItem/MuiTextField.js.map +1 -0
- package/lib/components/FormComponents/TextItem/TextField.js +2 -1
- package/lib/components/FormComponents/TextItem/TextField.js.map +1 -1
- package/lib/components/Renderer/FormBodyTabbed.js +2 -1
- package/lib/components/Renderer/FormBodyTabbed.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/theme/Theme.js +2 -2
- package/lib/theme/Theme.js.map +1 -1
- package/lib/theme/customGlobalStyles.d.ts +2 -0
- package/lib/theme/{globalStyles.js → customGlobalStyles.js} +4 -4
- package/lib/theme/customGlobalStyles.js.map +1 -0
- package/package.json +15 -4
- package/{lib/hooks/useTestContext.js → src/components/FormComponents/TextItem/MuiTextField.ts} +6 -11
- package/src/components/FormComponents/TextItem/TextField.tsx +2 -1
- package/src/components/Renderer/FormBodyTabbed.tsx +2 -1
- package/src/index.ts +1 -1
- package/src/theme/Theme.tsx +2 -2
- package/src/theme/{globalStyles.tsx → customGlobalStyles.tsx} +3 -3
- package/lib/api/populate.d.ts +0 -8
- package/lib/api/populate.js +0 -63
- package/lib/api/populate.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadio.d.ts +0 -8
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadio.js +0 -25
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadio.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioButton.d.ts +0 -8
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioButton.js +0 -25
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioButton.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioSingleItem.d.ts +0 -8
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioSingleItem.js +0 -25
- package/lib/components/FormComponents/ChoiceItems/ChoiceRadioSingleItem.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoice.d.ts +0 -9
- package/lib/components/FormComponents/ChoiceItems/QItemChoice.js +0 -61
- package/lib/components/FormComponents/ChoiceItems/QItemChoice.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceAutocomplete.d.ts +0 -9
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceAutocomplete.js +0 -89
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceAutocomplete.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceCheckboxAnswerOption.d.ts +0 -11
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceCheckboxAnswerOption.js +0 -70
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceCheckboxAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceCheckboxAnswerValueSet.d.ts +0 -11
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceCheckboxAnswerValueSet.js +0 -67
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceCheckboxAnswerValueSet.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioAnswerOption.d.ts +0 -11
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioAnswerOption.js +0 -70
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioAnswerValueSet.d.ts +0 -11
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioAnswerValueSet.js +0 -72
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioAnswerValueSet.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioSingle.d.ts +0 -8
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioSingle.js +0 -25
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceRadioSingle.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceSelectAnswerOption.d.ts +0 -9
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceSelectAnswerOption.js +0 -73
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceSelectAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceSelectAnswerValueSet.d.ts +0 -9
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceSelectAnswerValueSet.js +0 -82
- package/lib/components/FormComponents/ChoiceItems/QItemChoiceSelectAnswerValueSet.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/CheckboxWithOpenLabel.d.ts +0 -10
- package/lib/components/FormComponents/ItemParts/CheckboxWithOpenLabel.js +0 -35
- package/lib/components/FormComponents/ItemParts/CheckboxWithOpenLabel.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/QItemCheckboxSingle.d.ts +0 -10
- package/lib/components/FormComponents/ItemParts/QItemCheckboxSingle.js +0 -25
- package/lib/components/FormComponents/ItemParts/QItemCheckboxSingle.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/QItemCheckboxSingleWithOpenLabel.d.ts +0 -10
- package/lib/components/FormComponents/ItemParts/QItemCheckboxSingleWithOpenLabel.js +0 -35
- package/lib/components/FormComponents/ItemParts/QItemCheckboxSingleWithOpenLabel.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/QItemRadioButtonWithOpenLabel.d.ts +0 -10
- package/lib/components/FormComponents/ItemParts/QItemRadioButtonWithOpenLabel.js +0 -31
- package/lib/components/FormComponents/ItemParts/QItemRadioButtonWithOpenLabel.js.map +0 -1
- package/lib/components/FormComponents/ItemParts/RadioButtonItemWithOpenLabel.d.ts +0 -10
- package/lib/components/FormComponents/ItemParts/RadioButtonItemWithOpenLabel.js +0 -31
- package/lib/components/FormComponents/ItemParts/RadioButtonItemWithOpenLabel.js.map +0 -1
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoice.d.ts +0 -9
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoice.js +0 -49
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoice.js.map +0 -1
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceAutocomplete.d.ts +0 -9
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceAutocomplete.js +0 -109
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceAutocomplete.js.map +0 -1
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceCheckboxAnswerOption.d.ts +0 -11
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceCheckboxAnswerOption.js +0 -105
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceCheckboxAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceRadioAnswerOption.d.ts +0 -11
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceRadioAnswerOption.js +0 -116
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceRadioAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceSelectAnswerOption.d.ts +0 -9
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceSelectAnswerOption.js +0 -75
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceSelectAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceSelectAnswerValueSet.d.ts +0 -9
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceSelectAnswerValueSet.js +0 -68
- package/lib/components/FormComponents/OpenChoiceItems/QItemOpenChoiceSelectAnswerValueSet.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoice.d.ts +0 -9
- package/lib/components/FormComponents/QItemChoice/QItemChoice.js +0 -61
- package/lib/components/FormComponents/QItemChoice/QItemChoice.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoiceAutocomplete.d.ts +0 -9
- package/lib/components/FormComponents/QItemChoice/QItemChoiceAutocomplete.js +0 -89
- package/lib/components/FormComponents/QItemChoice/QItemChoiceAutocomplete.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerOption.d.ts +0 -11
- package/lib/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerOption.js +0 -70
- package/lib/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerValueSet.d.ts +0 -11
- package/lib/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerValueSet.js +0 -67
- package/lib/components/FormComponents/QItemChoice/QItemChoiceCheckboxAnswerValueSet.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerOption.d.ts +0 -11
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerOption.js +0 -70
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerValueSet.d.ts +0 -11
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerValueSet.js +0 -72
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioAnswerValueSet.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioSingle.d.ts +0 -8
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioSingle.js +0 -25
- package/lib/components/FormComponents/QItemChoice/QItemChoiceRadioSingle.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerOption.d.ts +0 -9
- package/lib/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerOption.js +0 -73
- package/lib/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerValueSet.d.ts +0 -9
- package/lib/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerValueSet.js +0 -82
- package/lib/components/FormComponents/QItemChoice/QItemChoiceSelectAnswerValueSet.js.map +0 -1
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoice.d.ts +0 -9
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoice.js +0 -49
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoice.js.map +0 -1
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceAutocomplete.d.ts +0 -9
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceAutocomplete.js +0 -109
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceAutocomplete.js.map +0 -1
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceCheckboxAnswerOption.d.ts +0 -11
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceCheckboxAnswerOption.js +0 -105
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceCheckboxAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceRadioAnswerOption.d.ts +0 -11
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceRadioAnswerOption.js +0 -116
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceRadioAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerOption.d.ts +0 -9
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerOption.js +0 -75
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerOption.js.map +0 -1
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerValueSet.d.ts +0 -9
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerValueSet.js +0 -68
- package/lib/components/FormComponents/QItemOpenChoice/QItemOpenChoiceSelectAnswerValueSet.js.map +0 -1
- package/lib/components/FormRenderer/BaseRenderer.d.ts +0 -3
- package/lib/components/FormRenderer/BaseRenderer.js +0 -54
- package/lib/components/FormRenderer/BaseRenderer.js.map +0 -1
- package/lib/components/FormRenderer/FormBodyCollapsible.d.ts +0 -9
- package/lib/components/FormRenderer/FormBodyCollapsible.js +0 -57
- package/lib/components/FormRenderer/FormBodyCollapsible.js.map +0 -1
- package/lib/components/FormRenderer/FormBodySingleCollapsible.d.ts +0 -12
- package/lib/components/FormRenderer/FormBodySingleCollapsible.js +0 -39
- package/lib/components/FormRenderer/FormBodySingleCollapsible.js.map +0 -1
- package/lib/components/FormRenderer/FormBodySingleCollapsibleWrapper.d.ts +0 -12
- package/lib/components/FormRenderer/FormBodySingleCollapsibleWrapper.js +0 -31
- package/lib/components/FormRenderer/FormBodySingleCollapsibleWrapper.js.map +0 -1
- package/lib/components/FormRenderer/FormBodyTabbed.d.ts +0 -9
- package/lib/components/FormRenderer/FormBodyTabbed.js +0 -60
- package/lib/components/FormRenderer/FormBodyTabbed.js.map +0 -1
- package/lib/components/FormRenderer/FormRenderer.d.ts +0 -3
- package/lib/components/FormRenderer/FormRenderer.js +0 -54
- package/lib/components/FormRenderer/FormRenderer.js.map +0 -1
- package/lib/components/FormRenderer/FormTitle.d.ts +0 -7
- package/lib/components/FormRenderer/FormTitle.js +0 -30
- package/lib/components/FormRenderer/FormTitle.js.map +0 -1
- package/lib/components/FormRenderer/FormTopLevelItem.d.ts +0 -9
- package/lib/components/FormRenderer/FormTopLevelItem.js +0 -45
- package/lib/components/FormRenderer/FormTopLevelItem.js.map +0 -1
- package/lib/components/FormRenderer/SmartFormsRenderer.d.ts +0 -9
- package/lib/components/FormRenderer/SmartFormsRenderer.js +0 -39
- package/lib/components/FormRenderer/SmartFormsRenderer.js.map +0 -1
- package/lib/components/FormRenderer/index.d.ts +0 -2
- package/lib/components/FormRenderer/index.js.map +0 -1
- package/lib/contexts/TestContext.d.ts +0 -11
- package/lib/contexts/TestContext.js +0 -32
- package/lib/contexts/TestContext.js.map +0 -1
- package/lib/contexts/index.d.ts +0 -1
- package/lib/contexts/index.js +0 -2
- package/lib/contexts/index.js.map +0 -1
- package/lib/hooks/useTestContext.d.ts +0 -5
- package/lib/hooks/useTestContext.js.map +0 -1
- package/lib/stores/useConfigStore.d.ts +0 -18
- package/lib/stores/useConfigStore.js +0 -17
- package/lib/stores/useConfigStore.js.map +0 -1
- package/lib/stores/useSmartClientStore.d.ts +0 -7
- package/lib/stores/useSmartClientStore.js +0 -7
- package/lib/stores/useSmartClientStore.js.map +0 -1
- package/lib/theme/globalStyles.d.ts +0 -2
- package/lib/theme/globalStyles.js.map +0 -1
- package/lib/utils/populate.d.ts +0 -16
- package/lib/utils/populate.js +0 -78
- package/lib/utils/populate.js.map +0 -1
- package/lib/utils/populateCallback.d.ts +0 -6
- package/lib/utils/populateCallback.js +0 -40
- package/lib/utils/populateCallback.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QItemChoice.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/QItemChoice.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,6BAA6B,MAAM,iCAAiC,CAAC;AAC5E,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAChF,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,+BAA+B,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,8BAA8B,MAAM,kCAAkC,CAAC;AAC9E,OAAO,iCAAiC,MAAM,qCAAqC,CAAC;AA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AY;YAClC,OAAO,CACL,oBAAC,uBAAuB,IACtB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;QACJ,KAAK,kBAAkB,CAAC,MAAM;YAC5B,IAAI,KAAK,CAAC,YAAY,EAAE;gBACtB,OAAO,CACL,oBAAC,6BAA6B,IAC5B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;iBAAM;gBACL,OAAO,CACL,oBAAC,+BAA+B,IAC9B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;aACH;QACH;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
3
|
-
import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
4
|
-
interface QItemChoiceAutocompleteProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute {
|
|
5
|
-
qItem: QuestionnaireItem;
|
|
6
|
-
qrItem: QuestionnaireResponseItem;
|
|
7
|
-
}
|
|
8
|
-
declare function QItemChoiceAutocomplete(props: QItemChoiceAutocompleteProps): React.JSX.Element | null;
|
|
9
|
-
export default QItemChoiceAutocomplete;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 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, { useState } from 'react';
|
|
18
|
-
import Autocomplete from '@mui/material/Autocomplete';
|
|
19
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
|
20
|
-
import Fade from '@mui/material/Fade';
|
|
21
|
-
import Grid from '@mui/material/Grid';
|
|
22
|
-
import Tooltip from '@mui/material/Tooltip';
|
|
23
|
-
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
24
|
-
import { StandardTextField } from '../Textfield.styles';
|
|
25
|
-
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
26
|
-
import SearchIcon from '@mui/icons-material/Search';
|
|
27
|
-
import useDebounce from '../../../hooks/useDebounce';
|
|
28
|
-
import useTerminologyServerQuery from '../../../hooks/useTerminologyServerQuery';
|
|
29
|
-
import InfoIcon from '@mui/icons-material/Info';
|
|
30
|
-
import WarningAmberIcon from '@mui/icons-material/WarningAmber';
|
|
31
|
-
import DoneIcon from '@mui/icons-material/Done';
|
|
32
|
-
import ErrorIcon from '@mui/icons-material/Error';
|
|
33
|
-
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
34
|
-
import { getTerminologyServerUrl } from '../../../utils/valueSet';
|
|
35
|
-
import { AUTOCOMPLETE_DEBOUNCE_DURATION } from '../../../utils/debounce';
|
|
36
|
-
import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
37
|
-
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
38
|
-
function QItemChoiceAutocomplete(props) {
|
|
39
|
-
const { qItem, qrItem, isRepeated, isTabled, onQrItemChange } = props;
|
|
40
|
-
const qrChoice = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
|
|
41
|
-
// Init input value
|
|
42
|
-
let valueCoding;
|
|
43
|
-
if (qrChoice.answer) {
|
|
44
|
-
valueCoding = qrChoice.answer[0].valueCoding;
|
|
45
|
-
}
|
|
46
|
-
// Get additional rendering extensions
|
|
47
|
-
const { displayUnit, displayPrompt, displayInstructions, readOnly, entryFormat } = useRenderingExtensions(qItem);
|
|
48
|
-
// Query ontoserver for options
|
|
49
|
-
const maxList = 10;
|
|
50
|
-
const [input, setInput] = useState('');
|
|
51
|
-
const debouncedInput = useDebounce(input, AUTOCOMPLETE_DEBOUNCE_DURATION);
|
|
52
|
-
const answerValueSetUrl = qItem.answerValueSet;
|
|
53
|
-
const terminologyServerUrl = getTerminologyServerUrl(qItem);
|
|
54
|
-
const { options, loading, feedback } = useTerminologyServerQuery(answerValueSetUrl, maxList, input, debouncedInput, terminologyServerUrl);
|
|
55
|
-
if (!answerValueSetUrl)
|
|
56
|
-
return null;
|
|
57
|
-
// Event handlers
|
|
58
|
-
function handleValueChange(_, newValue) {
|
|
59
|
-
if (newValue === null) {
|
|
60
|
-
setInput('');
|
|
61
|
-
onQrItemChange(createEmptyQrItem(qItem));
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueCoding: newValue }] }));
|
|
65
|
-
}
|
|
66
|
-
const choiceAutocomplete = (React.createElement(React.Fragment, null,
|
|
67
|
-
React.createElement(Autocomplete, { id: qItem.id, value: valueCoding !== null && valueCoding !== void 0 ? valueCoding : null, placeholder: entryFormat, options: options, getOptionLabel: (option) => `${option.display}`, isOptionEqualToValue: (option, value) => option.id === value.id, loading: loading, loadingText: 'Fetching results...', clearOnEscape: true, autoHighlight: true, onChange: handleValueChange, sx: { maxWidth: !isTabled ? 280 : 3000, minWidth: 160, flexGrow: 1 }, filterOptions: (x) => x, renderInput: (params) => (React.createElement(StandardTextField, Object.assign({}, params, { onChange: (e) => setInput(e.target.value), isTabled: isTabled, disabled: readOnly, label: displayPrompt, size: "small", InputProps: Object.assign(Object.assign({}, params.InputProps), { startAdornment: (React.createElement(React.Fragment, null,
|
|
68
|
-
!valueCoding ? React.createElement(SearchIcon, { fontSize: "small", sx: { ml: 0.5 } }) : null,
|
|
69
|
-
params.InputProps.startAdornment)), endAdornment: (React.createElement(React.Fragment, null,
|
|
70
|
-
loading ? (React.createElement(CircularProgress, { color: "inherit", size: 16 })) : feedback ? (React.createElement(Fade, { in: !!feedback, timeout: 300 },
|
|
71
|
-
React.createElement(Tooltip, { title: feedback.message, arrow: true, sx: { ml: 1 } }, {
|
|
72
|
-
info: React.createElement(InfoIcon, { fontSize: "small", color: "info" }),
|
|
73
|
-
warning: React.createElement(WarningAmberIcon, { fontSize: "small", color: "warning" }),
|
|
74
|
-
success: React.createElement(DoneIcon, { fontSize: "small", color: "success" }),
|
|
75
|
-
error: React.createElement(ErrorIcon, { fontSize: "small", color: "error" })
|
|
76
|
-
}[feedback.color]))) : null,
|
|
77
|
-
params.InputProps.endAdornment,
|
|
78
|
-
displayUnit)) }) }))) })));
|
|
79
|
-
const renderQItemChoiceAutocomplete = isRepeated ? (React.createElement(React.Fragment, null, choiceAutocomplete)) : (React.createElement(FullWidthFormComponentBox, null,
|
|
80
|
-
React.createElement(Grid, { container: true, columnSpacing: 6 },
|
|
81
|
-
React.createElement(Grid, { item: true, xs: 5 },
|
|
82
|
-
React.createElement(LabelWrapper, { qItem: qItem })),
|
|
83
|
-
React.createElement(Grid, { item: true, xs: 7 },
|
|
84
|
-
choiceAutocomplete,
|
|
85
|
-
React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
|
|
86
|
-
return React.createElement(React.Fragment, null, renderQItemChoiceAutocomplete);
|
|
87
|
-
}
|
|
88
|
-
export default QItemChoiceAutocomplete;
|
|
89
|
-
//# sourceMappingURL=QItemChoiceAutocomplete.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QItemChoiceAutocomplete.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/QItemChoiceAutocomplete.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAG5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,UAAU,MAAM,4BAA4B,CAAC;AACpD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,yBAAyB,MAAM,0CAA0C,CAAC;AACjF,OAAO,QAAQ,MAAM,0BAA0B,CAAC;AAChD,OAAO,gBAAgB,MAAM,kCAAkC,CAAC;AAChE,OAAO,QAAQ,MAAM,0BAA0B,CAAC;AAChD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAMlE,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,mBAAmB,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;QACxB,oBAAC,IAAI,IAAC,SAAS,QAAC,aAAa,EAAE,CAAC;YAC9B,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACd,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,CACzB;YACP,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACb,kBAAkB;gBACnB,oBAAC,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,GAAI,CAC5D,CACF,CACmB,CAC7B,CAAC;IACF,OAAO,0CAAG,6BAA6B,CAAI,CAAC;AAC9C,CAAC;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { QItemChoiceOrientation } from '../../../interfaces/choice.enum';
|
|
3
|
-
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
4
|
-
import type { PropsWithIsRepeatedAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
5
|
-
interface QItemChoiceCheckboxProps extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute {
|
|
6
|
-
qItem: QuestionnaireItem;
|
|
7
|
-
qrItem: QuestionnaireResponseItem;
|
|
8
|
-
orientation: QItemChoiceOrientation;
|
|
9
|
-
}
|
|
10
|
-
declare function QItemChoiceCheckboxAnswerOption(props: QItemChoiceCheckboxProps): React.JSX.Element;
|
|
11
|
-
export default QItemChoiceCheckboxAnswerOption;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import Grid from '@mui/material/Grid';
|
|
19
|
-
import { QItemChoiceOrientation } from '../../../interfaces/choice.enum';
|
|
20
|
-
import QItemChoiceCheckboxSingle from '../ItemParts/QItemCheckboxSingle';
|
|
21
|
-
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
22
|
-
import { QFormGroup } from '../Item.styles';
|
|
23
|
-
import { updateQrCheckboxAnswers } from '../../../utils/choice';
|
|
24
|
-
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
25
|
-
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
26
|
-
import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
27
|
-
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
28
|
-
function QItemChoiceCheckboxAnswerOption(props) {
|
|
29
|
-
var _a;
|
|
30
|
-
const { qItem, qrItem, isRepeated, onQrItemChange, orientation } = props;
|
|
31
|
-
// Init input value
|
|
32
|
-
const qrChoiceCheckbox = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
|
|
33
|
-
const answers = qrChoiceCheckbox.answer ? qrChoiceCheckbox.answer : [];
|
|
34
|
-
// Get additional rendering extensions
|
|
35
|
-
const { displayInstructions, readOnly } = useRenderingExtensions(qItem);
|
|
36
|
-
// Event handlers
|
|
37
|
-
function handleCheckedChange(changedValue) {
|
|
38
|
-
const answerOptions = qItem.answerOption;
|
|
39
|
-
if (!answerOptions)
|
|
40
|
-
return null;
|
|
41
|
-
const updatedQrChoiceCheckbox = updateQrCheckboxAnswers(changedValue, answers, answerOptions, qrChoiceCheckbox, isRepeated);
|
|
42
|
-
if (updatedQrChoiceCheckbox) {
|
|
43
|
-
onQrItemChange(updatedQrChoiceCheckbox);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const choiceCheckbox = (React.createElement(QFormGroup, { row: orientation === QItemChoiceOrientation.Horizontal }, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 : _a.map((option) => {
|
|
47
|
-
var _a, _b, _c;
|
|
48
|
-
if (option['valueCoding']) {
|
|
49
|
-
return (React.createElement(QItemChoiceCheckboxSingle, { key: (_a = option.valueCoding.code) !== null && _a !== void 0 ? _a : '', value: (_b = option.valueCoding.code) !== null && _b !== void 0 ? _b : '', label: (_c = option.valueCoding.display) !== null && _c !== void 0 ? _c : `${option.valueCoding.code}`, readOnly: readOnly, isChecked: answers.some((answer) => JSON.stringify(answer) === JSON.stringify(option)), onCheckedChange: handleCheckedChange }));
|
|
50
|
-
}
|
|
51
|
-
else if (option['valueString']) {
|
|
52
|
-
return (React.createElement(QItemChoiceCheckboxSingle, { key: option.valueString, value: option.valueString, label: option.valueString, readOnly: readOnly, isChecked: answers.some((answer) => answer.valueString === option.valueString), onCheckedChange: handleCheckedChange }));
|
|
53
|
-
}
|
|
54
|
-
else if (option['valueInteger']) {
|
|
55
|
-
return (React.createElement(QItemChoiceCheckboxSingle, { key: option.valueInteger, value: option.valueInteger.toString(), label: option.valueInteger.toString(), readOnly: readOnly, isChecked: answers.some((answer) => answer.valueInteger === option.valueInteger), onCheckedChange: handleCheckedChange }));
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
})));
|
|
61
|
-
return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-checkbox-answer-option-box" },
|
|
62
|
-
React.createElement(Grid, { container: true, columnSpacing: 6 },
|
|
63
|
-
React.createElement(Grid, { item: true, xs: 5 },
|
|
64
|
-
React.createElement(LabelWrapper, { qItem: qItem })),
|
|
65
|
-
React.createElement(Grid, { item: true, xs: 7 },
|
|
66
|
-
choiceCheckbox,
|
|
67
|
-
React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
|
|
68
|
-
}
|
|
69
|
-
export default QItemChoiceCheckboxAnswerOption;
|
|
70
|
-
//# sourceMappingURL=QItemChoiceCheckboxAnswerOption.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QItemChoiceCheckboxAnswerOption.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/QItemChoiceCheckboxAnswerOption.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,yBAAyB,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAK3E,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAUzD,SAAS,+BAA+B,CAAC,KAA+B;;IACtE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAEzE,mBAAmB;IACnB,MAAM,gBAAgB,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC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 -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
3
|
-
import { QItemChoiceOrientation } from '../../../interfaces/choice.enum';
|
|
4
|
-
import type { PropsWithIsRepeatedAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
5
|
-
interface Props extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute {
|
|
6
|
-
qItem: QuestionnaireItem;
|
|
7
|
-
qrItem: QuestionnaireResponseItem;
|
|
8
|
-
orientation: QItemChoiceOrientation;
|
|
9
|
-
}
|
|
10
|
-
declare function QItemChoiceCheckboxAnswerValueSet(props: Props): React.JSX.Element;
|
|
11
|
-
export default QItemChoiceCheckboxAnswerValueSet;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import Grid from '@mui/material/Grid';
|
|
19
|
-
import Typography from '@mui/material/Typography';
|
|
20
|
-
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
21
|
-
import useValueSetCodings from '../../../hooks/useValueSetCodings';
|
|
22
|
-
import { QItemChoiceOrientation } from '../../../interfaces/choice.enum';
|
|
23
|
-
import { mapCodingsToOptions, updateQrCheckboxAnswers } from '../../../utils/choice';
|
|
24
|
-
import QItemCheckboxSingle from '../ItemParts/QItemCheckboxSingle';
|
|
25
|
-
import { QFormGroup } from '../Item.styles';
|
|
26
|
-
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
27
|
-
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
28
|
-
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
29
|
-
import { StyledAlert } from '../../Alert.styles';
|
|
30
|
-
import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
31
|
-
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
32
|
-
function QItemChoiceCheckboxAnswerValueSet(props) {
|
|
33
|
-
const { qItem, qrItem, isRepeated, onQrItemChange, orientation } = props;
|
|
34
|
-
// Init input value
|
|
35
|
-
const qrChoiceCheckbox = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
|
|
36
|
-
const answers = qrChoiceCheckbox.answer ? qrChoiceCheckbox.answer : [];
|
|
37
|
-
// Get additional rendering extensions
|
|
38
|
-
const { displayInstructions, readOnly } = useRenderingExtensions(qItem);
|
|
39
|
-
// Get codings/options from valueSet
|
|
40
|
-
const { codings, serverError } = useValueSetCodings(qItem);
|
|
41
|
-
// Event handlers
|
|
42
|
-
function handleCheckedChange(changedValue) {
|
|
43
|
-
if (codings.length < 1)
|
|
44
|
-
return null;
|
|
45
|
-
const updatedQrChoiceCheckbox = updateQrCheckboxAnswers(changedValue, answers, mapCodingsToOptions(codings), qrChoiceCheckbox, isRepeated);
|
|
46
|
-
if (updatedQrChoiceCheckbox) {
|
|
47
|
-
onQrItemChange(updatedQrChoiceCheckbox);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const choiceCheckbox = codings.length > 0 ? (React.createElement(QFormGroup, { row: orientation === QItemChoiceOrientation.Horizontal }, codings.map((coding) => {
|
|
51
|
-
var _a, _b, _c;
|
|
52
|
-
return (React.createElement(QItemCheckboxSingle, { key: (_a = coding.code) !== null && _a !== void 0 ? _a : '', value: (_b = coding.code) !== null && _b !== void 0 ? _b : '', label: (_c = coding.display) !== null && _c !== void 0 ? _c : `${coding.code}`, readOnly: readOnly, isChecked: answers.some((answer) => JSON.stringify(answer.valueCoding) === JSON.stringify(coding)), onCheckedChange: handleCheckedChange }));
|
|
53
|
-
}))) : serverError ? (React.createElement(StyledAlert, { color: "error" },
|
|
54
|
-
React.createElement(ErrorOutlineIcon, { color: "error", sx: { pr: 0.75 } }),
|
|
55
|
-
React.createElement(Typography, { variant: "subtitle2" }, "There was an error fetching options from the terminology server"))) : (React.createElement(StyledAlert, { color: "error" },
|
|
56
|
-
React.createElement(ErrorOutlineIcon, { color: "error", sx: { pr: 0.75 } }),
|
|
57
|
-
React.createElement(Typography, { variant: "subtitle2" }, "Unable to fetch options from the questionnaire or launch context")));
|
|
58
|
-
return (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-checkbox-answer-value-set-box" },
|
|
59
|
-
React.createElement(Grid, { container: true, columnSpacing: 6 },
|
|
60
|
-
React.createElement(Grid, { item: true, xs: 5 },
|
|
61
|
-
React.createElement(LabelWrapper, { qItem: qItem })),
|
|
62
|
-
React.createElement(Grid, { item: true, xs: 7 },
|
|
63
|
-
choiceCheckbox,
|
|
64
|
-
React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
|
|
65
|
-
}
|
|
66
|
-
export default QItemChoiceCheckboxAnswerValueSet;
|
|
67
|
-
//# sourceMappingURL=QItemChoiceCheckboxAnswerValueSet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QItemChoiceCheckboxAnswerValueSet.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/QItemChoiceCheckboxAnswerValueSet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK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AAW,sEAElB,CACD,CACf,CAAC,CAAC,CAAC,CACF,oBAAC,WAAW,IAAC,KAAK,EAAC,OAAO;QACxB,oBAAC,gBAAgB,IAAC,KAAK,EAAC,OAAO,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAI;QACpD,oBAAC,UAAU,IAAC,OAAO,EAAC,WAAW,uEAElB,CACD,CACf,CAAC;IAEJ,OAAO,CACL,oBAAC,yBAAyB,iBAAW,6CAA6C;QAChF,oBAAC,IAAI,IAAC,SAAS,QAAC,aAAa,EAAE,CAAC;YAC9B,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACd,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,CACzB;YACP,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACb,cAAc;gBACf,oBAAC,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,GAAI,CAC5D,CACF,CACmB,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,iCAAiC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { QItemChoiceOrientation } from '../../../interfaces/choice.enum';
|
|
3
|
-
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
4
|
-
import type { PropsWithIsRepeatedAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
5
|
-
interface Props extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute {
|
|
6
|
-
qItem: QuestionnaireItem;
|
|
7
|
-
qrItem: QuestionnaireResponseItem;
|
|
8
|
-
orientation: QItemChoiceOrientation;
|
|
9
|
-
}
|
|
10
|
-
declare function QItemChoiceRadioAnswerOption(props: Props): React.JSX.Element;
|
|
11
|
-
export default QItemChoiceRadioAnswerOption;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import Grid from '@mui/material/Grid';
|
|
19
|
-
import { QItemChoiceOrientation } from '../../../interfaces/choice.enum';
|
|
20
|
-
import { findInAnswerOptions, getQrChoiceValue } from '../../../utils/choice';
|
|
21
|
-
import QItemChoiceRadioSingle from './QItemChoiceRadioSingle';
|
|
22
|
-
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
23
|
-
import { QRadioGroup } from '../Item.styles';
|
|
24
|
-
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
25
|
-
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
26
|
-
import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
27
|
-
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
28
|
-
function QItemChoiceRadioAnswerOption(props) {
|
|
29
|
-
var _a;
|
|
30
|
-
const { qItem, qrItem, isRepeated, onQrItemChange, orientation } = props;
|
|
31
|
-
// Init input value
|
|
32
|
-
const qrChoiceRadio = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
|
|
33
|
-
const valueRadio = getQrChoiceValue(qrChoiceRadio);
|
|
34
|
-
// Get additional rendering extensions
|
|
35
|
-
const { displayInstructions, readOnly } = useRenderingExtensions(qItem);
|
|
36
|
-
// Event handlers
|
|
37
|
-
function handleChange(e) {
|
|
38
|
-
if (qItem.answerOption) {
|
|
39
|
-
const qrAnswer = findInAnswerOptions(qItem.answerOption, e.target.value);
|
|
40
|
-
if (qrAnswer) {
|
|
41
|
-
onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [qrAnswer] }));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const choiceRadio = (React.createElement(QRadioGroup, { row: orientation === QItemChoiceOrientation.Horizontal, name: qItem.text, id: qItem.id, onChange: handleChange, value: valueRadio, "data-test": "q-item-radio-group" }, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 : _a.map((option) => {
|
|
46
|
-
var _a, _b, _c;
|
|
47
|
-
if (option['valueCoding']) {
|
|
48
|
-
return (React.createElement(QItemChoiceRadioSingle, { key: (_a = option.valueCoding.code) !== null && _a !== void 0 ? _a : '', value: (_b = option.valueCoding.code) !== null && _b !== void 0 ? _b : '', label: (_c = option.valueCoding.display) !== null && _c !== void 0 ? _c : `${option.valueCoding.code}`, readOnly: readOnly }));
|
|
49
|
-
}
|
|
50
|
-
else if (option['valueString']) {
|
|
51
|
-
return (React.createElement(QItemChoiceRadioSingle, { key: option.valueString, value: option.valueString, label: option.valueString, readOnly: readOnly }));
|
|
52
|
-
}
|
|
53
|
-
else if (option['valueInteger']) {
|
|
54
|
-
return (React.createElement(QItemChoiceRadioSingle, { key: option.valueInteger, value: option.valueInteger.toString(), label: option.valueInteger.toString(), readOnly: readOnly }));
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
})));
|
|
60
|
-
const renderQItemChoiceRadio = isRepeated ? (React.createElement(React.Fragment, null, choiceRadio)) : (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-radio-answer-option-box" },
|
|
61
|
-
React.createElement(Grid, { container: true, columnSpacing: 6 },
|
|
62
|
-
React.createElement(Grid, { item: true, xs: 5 },
|
|
63
|
-
React.createElement(LabelWrapper, { qItem: qItem })),
|
|
64
|
-
React.createElement(Grid, { item: true, xs: 7 },
|
|
65
|
-
choiceRadio,
|
|
66
|
-
React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
|
|
67
|
-
return React.createElement(React.Fragment, null, renderQItemChoiceRadio);
|
|
68
|
-
}
|
|
69
|
-
export default QItemChoiceRadioAnswerOption;
|
|
70
|
-
//# sourceMappingURL=QItemChoiceRadioAnswerOption.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QItemChoiceRadioAnswerOption.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/QItemChoiceRadioAnswerOption.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAK3E,OAAO,mBAAmB,MAAM,oCAAoC,CAAC;AACrE,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAUzD,SAAS,4BAA4B,CAAC,KAAY;;IAChD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAEzE,mBAAmB;IACnB,MAAM,aAAa,GAAG,MAAM,aAAN,MAAM,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AAC,EAAE;YAChC,OAAO,CACL,oBAAC,sBAAsB,IACrB,GAAG,EAAE,MAAM,CAAC,WAAW,EACvB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,KAAK,EAAE,MAAM,CAAC,WAAW,EACzB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;aAAM,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE;YACjC,OAAO,CACL,oBAAC,sBAAsB,IACrB,GAAG,EAAE,MAAM,CAAC,YAAY,EACxB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EACrC,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;SACH;aAAM;YACL,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC,CACU,CACf,CAAC;IAEF,MAAM,sBAAsB,GAAG,UAAU,CAAC,CAAC,CAAC,CAC1C,0CAAG,WAAW,CAAI,CACnB,CAAC,CAAC,CAAC,CACF,oBAAC,yBAAyB,iBAAW,uCAAuC;QAC1E,oBAAC,IAAI,IAAC,SAAS,QAAC,aAAa,EAAE,CAAC;YAC9B,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACd,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,CACzB;YACP,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACb,WAAW;gBACZ,oBAAC,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,GAAI,CAC5D,CACF,CACmB,CAC7B,CAAC;IACF,OAAO,0CAAG,sBAAsB,CAAI,CAAC;AACvC,CAAC;AAED,eAAe,4BAA4B,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { QItemChoiceOrientation } from '../../../interfaces/choice.enum';
|
|
3
|
-
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
4
|
-
import type { PropsWithIsRepeatedAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
5
|
-
interface Props extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute {
|
|
6
|
-
qItem: QuestionnaireItem;
|
|
7
|
-
qrItem: QuestionnaireResponseItem;
|
|
8
|
-
orientation: QItemChoiceOrientation;
|
|
9
|
-
}
|
|
10
|
-
declare function QItemChoiceRadioAnswerValueSet(props: Props): React.JSX.Element;
|
|
11
|
-
export default QItemChoiceRadioAnswerValueSet;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import Grid from '@mui/material/Grid';
|
|
19
|
-
import Typography from '@mui/material/Typography';
|
|
20
|
-
import { QItemChoiceOrientation } from '../../../interfaces/choice.enum';
|
|
21
|
-
import { findInAnswerValueSetCodings } from '../../../utils/choice';
|
|
22
|
-
import QItemChoiceRadioSingle from './QItemChoiceRadioSingle';
|
|
23
|
-
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
24
|
-
import { QRadioGroup } from '../Item.styles';
|
|
25
|
-
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
26
|
-
import useValueSetCodings from '../../../hooks/useValueSetCodings';
|
|
27
|
-
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
28
|
-
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
|
|
29
|
-
import { StyledAlert } from '../../Alert.styles';
|
|
30
|
-
import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
31
|
-
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
32
|
-
function QItemChoiceRadioAnswerValueSet(props) {
|
|
33
|
-
var _a;
|
|
34
|
-
const { qItem, qrItem, isRepeated, onQrItemChange, orientation } = props;
|
|
35
|
-
// Init input value
|
|
36
|
-
const qrChoiceRadio = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
|
|
37
|
-
let valueRadio;
|
|
38
|
-
if (qrChoiceRadio.answer) {
|
|
39
|
-
valueRadio = (_a = qrChoiceRadio.answer[0].valueCoding) === null || _a === void 0 ? void 0 : _a.code;
|
|
40
|
-
}
|
|
41
|
-
// Get additional rendering extensions
|
|
42
|
-
const { displayInstructions, readOnly } = useRenderingExtensions(qItem);
|
|
43
|
-
console.log(qItem);
|
|
44
|
-
// Get codings/options from valueSet
|
|
45
|
-
const { codings, serverError } = useValueSetCodings(qItem);
|
|
46
|
-
function handleChange(event) {
|
|
47
|
-
if (codings.length > 0) {
|
|
48
|
-
const qrAnswer = findInAnswerValueSetCodings(codings, event.target.value);
|
|
49
|
-
if (qrAnswer) {
|
|
50
|
-
onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [{ valueCoding: qrAnswer }] }));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const choiceRadio = codings.length > 0 ? (React.createElement(QRadioGroup, { row: orientation === QItemChoiceOrientation.Horizontal, name: qItem.text, id: qItem.id, onChange: handleChange, value: valueRadio !== null && valueRadio !== void 0 ? valueRadio : null }, codings.map((coding) => {
|
|
55
|
-
var _a, _b, _c;
|
|
56
|
-
return (React.createElement(QItemChoiceRadioSingle, { key: (_a = coding.code) !== null && _a !== void 0 ? _a : '', value: (_b = coding.code) !== null && _b !== void 0 ? _b : '', label: (_c = coding.display) !== null && _c !== void 0 ? _c : `${coding.code}`, readOnly: readOnly }));
|
|
57
|
-
}))) : serverError ? (React.createElement(StyledAlert, { color: "error" },
|
|
58
|
-
React.createElement(ErrorOutlineIcon, { color: "error", sx: { pr: 0.75 } }),
|
|
59
|
-
React.createElement(Typography, { variant: "subtitle2" }, "There was an error fetching options from the terminology server"))) : (React.createElement(StyledAlert, { color: "error" },
|
|
60
|
-
React.createElement(ErrorOutlineIcon, { color: "error", sx: { pr: 0.75 } }),
|
|
61
|
-
React.createElement(Typography, { variant: "subtitle2" }, "Unable to fetch options from the questionnaire or launch context")));
|
|
62
|
-
const renderQItemChoiceRadio = isRepeated ? (React.createElement(React.Fragment, null, choiceRadio)) : (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-radio-answer-value-set-box" },
|
|
63
|
-
React.createElement(Grid, { container: true, columnSpacing: 6 },
|
|
64
|
-
React.createElement(Grid, { item: true, xs: 5 },
|
|
65
|
-
React.createElement(LabelWrapper, { qItem: qItem })),
|
|
66
|
-
React.createElement(Grid, { item: true, xs: 7 },
|
|
67
|
-
choiceRadio,
|
|
68
|
-
React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
|
|
69
|
-
return React.createElement(React.Fragment, null, renderQItemChoiceRadio);
|
|
70
|
-
}
|
|
71
|
-
export default QItemChoiceRadioAnswerValueSet;
|
|
72
|
-
//# sourceMappingURL=QItemChoiceRadioAnswerValueSet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QItemChoiceRadioAnswerValueSet.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/QItemChoiceRadioAnswerValueSet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,MAA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E,GAAI;QACpD,oBAAC,UAAU,IAAC,OAAO,EAAC,WAAW,sEAElB,CACD,CACf,CAAC,CAAC,CAAC,CACF,oBAAC,WAAW,IAAC,KAAK,EAAC,OAAO;QACxB,oBAAC,gBAAgB,IAAC,KAAK,EAAC,OAAO,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAI;QACpD,oBAAC,UAAU,IAAC,OAAO,EAAC,WAAW,uEAElB,CACD,CACf,CAAC;IAEJ,MAAM,sBAAsB,GAAG,UAAU,CAAC,CAAC,CAAC,CAC1C,0CAAG,WAAW,CAAI,CACnB,CAAC,CAAC,CAAC,CACF,oBAAC,yBAAyB,iBAAW,0CAA0C;QAC7E,oBAAC,IAAI,IAAC,SAAS,QAAC,aAAa,EAAE,CAAC;YAC9B,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACd,oBAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,CACzB;YACP,oBAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,CAAC;gBACb,WAAW;gBACZ,oBAAC,mBAAmB,IAAC,mBAAmB,EAAE,mBAAmB,GAAI,CAC5D,CACF,CACmB,CAC7B,CAAC;IACF,OAAO,0CAAG,sBAAsB,CAAI,CAAC;AACvC,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Commonwealth Scientific and Industrial Research
|
|
3
|
-
* Organisation (CSIRO) ABN 41 687 119 230.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import React from 'react';
|
|
18
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
19
|
-
import Radio from '@mui/material/Radio';
|
|
20
|
-
function QItemChoiceRadioSingle(props) {
|
|
21
|
-
const { value, label, readOnly } = props;
|
|
22
|
-
return (React.createElement(FormControlLabel, { disabled: readOnly, value: value, control: React.createElement(Radio, { size: "small" }), label: label, sx: { mr: 3 } }));
|
|
23
|
-
}
|
|
24
|
-
export default QItemChoiceRadioSingle;
|
|
25
|
-
//# sourceMappingURL=QItemChoiceRadioSingle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QItemChoiceRadioSingle.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/ChoiceItems/QItemChoiceRadioSingle.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,MAAM,qBAAqB,CAAC;AAQxC,SAAS,sBAAsB,CAAC,KAAY;IAC1C,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEzC,OAAO,CACL,oBAAC,gBAAgB,IACf,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,oBAAC,KAAK,IAAC,IAAI,EAAC,OAAO,GAAG,EAC/B,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GACb,CACH,CAAC;AACJ,CAAC;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { QuestionnaireItem, QuestionnaireResponseItem } from 'fhir/r4';
|
|
3
|
-
import type { PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute, PropsWithQrItemChangeHandler } from '../../../interfaces/renderProps.interface';
|
|
4
|
-
interface Props extends PropsWithQrItemChangeHandler<QuestionnaireResponseItem>, PropsWithIsRepeatedAttribute, PropsWithIsTabledAttribute {
|
|
5
|
-
qItem: QuestionnaireItem;
|
|
6
|
-
qrItem: QuestionnaireResponseItem;
|
|
7
|
-
}
|
|
8
|
-
declare function QItemChoiceSelectAnswerOption(props: Props): React.JSX.Element;
|
|
9
|
-
export default QItemChoiceSelectAnswerOption;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 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, { Fragment } from 'react';
|
|
18
|
-
import Grid from '@mui/material/Grid';
|
|
19
|
-
import InputAdornment from '@mui/material/InputAdornment';
|
|
20
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
21
|
-
import Select from '@mui/material/Select';
|
|
22
|
-
import { findInAnswerOptions, getQrChoiceValue } from '../../../utils/choice';
|
|
23
|
-
import { createEmptyQrItem } from '../../../utils/qrItem';
|
|
24
|
-
import { FullWidthFormComponentBox } from '../../Box.styles';
|
|
25
|
-
import useRenderingExtensions from '../../../hooks/useRenderingExtensions';
|
|
26
|
-
import DisplayInstructions from '../DisplayItem/DisplayInstructions';
|
|
27
|
-
import LabelWrapper from '../ItemParts/ItemLabelWrapper';
|
|
28
|
-
function QItemChoiceSelectAnswerOption(props) {
|
|
29
|
-
var _a;
|
|
30
|
-
const { qItem, qrItem, isRepeated, isTabled, onQrItemChange } = props;
|
|
31
|
-
// Init input value
|
|
32
|
-
const qrChoiceSelect = qrItem !== null && qrItem !== void 0 ? qrItem : createEmptyQrItem(qItem);
|
|
33
|
-
let valueSelect = getQrChoiceValue(qrChoiceSelect);
|
|
34
|
-
if (valueSelect === null) {
|
|
35
|
-
valueSelect = '';
|
|
36
|
-
}
|
|
37
|
-
// Get additional rendering extensions
|
|
38
|
-
const { displayUnit, displayPrompt, displayInstructions, readOnly, entryFormat } = useRenderingExtensions(qItem);
|
|
39
|
-
// Event handlers
|
|
40
|
-
function handleChange(e) {
|
|
41
|
-
if (qItem.answerOption) {
|
|
42
|
-
const qrAnswer = findInAnswerOptions(qItem.answerOption, e.target.value);
|
|
43
|
-
if (qrAnswer) {
|
|
44
|
-
onQrItemChange(Object.assign(Object.assign({}, createEmptyQrItem(qItem)), { answer: [qrAnswer] }));
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
onQrItemChange(createEmptyQrItem(qItem));
|
|
49
|
-
}
|
|
50
|
-
const choiceSelectAnswerOption = (React.createElement(Select, { id: qItem.id, name: qItem.text, value: valueSelect, disabled: readOnly, fullWidth: true, placeholder: entryFormat, label: displayPrompt, endAdornment: React.createElement(InputAdornment, { position: 'end' }, displayUnit), sx: { maxWidth: !isTabled ? 280 : 3000, minWidth: 160 }, size: "small", onChange: handleChange }, (_a = qItem.answerOption) === null || _a === void 0 ? void 0 : _a.map((option, index) => {
|
|
51
|
-
var _a;
|
|
52
|
-
if (option['valueCoding']) {
|
|
53
|
-
return (React.createElement(MenuItem, { key: option.valueCoding.code, value: option.valueCoding.code }, (_a = option.valueCoding.display) !== null && _a !== void 0 ? _a : option.valueCoding.code));
|
|
54
|
-
}
|
|
55
|
-
if (option['valueString']) {
|
|
56
|
-
return (React.createElement(MenuItem, { key: option.valueString, value: option.valueString }, option.valueString));
|
|
57
|
-
}
|
|
58
|
-
if (option['valueInteger']) {
|
|
59
|
-
return (React.createElement(MenuItem, { key: option.valueInteger, value: option.valueInteger.toString() }, option.valueInteger));
|
|
60
|
-
}
|
|
61
|
-
return React.createElement(Fragment, { key: index });
|
|
62
|
-
})));
|
|
63
|
-
const renderQItemChoiceSelectAnswerOption = isRepeated ? (React.createElement(React.Fragment, null, choiceSelectAnswerOption)) : (React.createElement(FullWidthFormComponentBox, { "data-test": "q-item-choice-select-answer-option-box" },
|
|
64
|
-
React.createElement(Grid, { container: true, columnSpacing: 6 },
|
|
65
|
-
React.createElement(Grid, { item: true, xs: 5 },
|
|
66
|
-
React.createElement(LabelWrapper, { qItem: qItem })),
|
|
67
|
-
React.createElement(Grid, { item: true, xs: 7 },
|
|
68
|
-
choiceSelectAnswerOption,
|
|
69
|
-
React.createElement(DisplayInstructions, { displayInstructions: displayInstructions })))));
|
|
70
|
-
return React.createElement(React.Fragment, null, renderQItemChoiceSelectAnswerOption);
|
|
71
|
-
}
|
|
72
|
-
export default QItemChoiceSelectAnswerOption;
|
|
73
|
-
//# sourceMappingURL=QItemChoiceSelectAnswerOption.js.map
|