-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #950 from konsulin-id/issue/639
Issue/639
- Loading branch information
Showing
25 changed files
with
1,253 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...art-forms-renderer/src/components/FormComponents/QuantityItem/QuantityComparatorField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import Autocomplete from '@mui/material/Autocomplete'; | ||
import type { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps.interface'; | ||
import MuiTextField from '../TextItem/MuiTextField'; | ||
import Box from '@mui/material/Box'; | ||
import Typography from '@mui/material/Typography'; | ||
import type { Quantity } from 'fhir/r4'; | ||
|
||
interface QuantityComparatorFieldProps extends PropsWithIsTabledAttribute { | ||
linkId: string; | ||
options: Quantity['comparator'][]; | ||
valueSelect: Quantity['comparator'] | null; | ||
readOnly: boolean; | ||
onChange: (newValue: Quantity['comparator'] | null) => void; | ||
} | ||
|
||
function QuantityComparatorField(props: QuantityComparatorFieldProps) { | ||
const { linkId, options, valueSelect, readOnly, onChange } = props; | ||
|
||
return ( | ||
<Box> | ||
<Autocomplete | ||
id={linkId + '-comparator'} | ||
value={valueSelect ?? null} | ||
options={options} | ||
onChange={(_, newValue) => onChange(newValue as Quantity['comparator'])} | ||
autoHighlight | ||
sx={{ width: 88 }} | ||
disabled={readOnly} | ||
size="small" | ||
renderInput={(params) => <MuiTextField sx={{ width: 88 }} {...params} />} | ||
/> | ||
<Typography variant="caption" color="text.secondary"> | ||
Symbol (optional) | ||
</Typography> | ||
</Box> | ||
); | ||
} | ||
|
||
export default QuantityComparatorField; |
60 changes: 60 additions & 0 deletions
60
packages/smart-forms-renderer/src/components/FormComponents/QuantityItem/QuantityField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React from 'react'; | ||
import InputAdornment from '@mui/material/InputAdornment'; | ||
import FadingCheckIcon from '../ItemParts/FadingCheckIcon'; | ||
import { StandardTextField } from '../Textfield.styles'; | ||
import type { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps.interface'; | ||
|
||
interface QuantityFieldProps extends PropsWithIsTabledAttribute { | ||
linkId: string; | ||
input: string; | ||
feedback: string; | ||
displayPrompt: string; | ||
displayUnit: string; | ||
entryFormat: string; | ||
readOnly: boolean; | ||
calcExpUpdated: boolean; | ||
onInputChange: (value: string) => void; | ||
} | ||
|
||
function QuantityField(props: QuantityFieldProps) { | ||
const { | ||
linkId, | ||
input, | ||
feedback, | ||
displayPrompt, | ||
displayUnit, | ||
entryFormat, | ||
readOnly, | ||
calcExpUpdated, | ||
isTabled, | ||
onInputChange | ||
} = props; | ||
|
||
return ( | ||
<StandardTextField | ||
id={linkId} | ||
value={input} | ||
error={!!feedback} | ||
onChange={(event) => onInputChange(event.target.value)} | ||
disabled={readOnly} | ||
label={displayPrompt} | ||
placeholder={entryFormat === '' ? '0.0' : entryFormat} | ||
fullWidth | ||
isTabled={isTabled} | ||
size="small" | ||
inputProps={{ inputMode: 'numeric', pattern: '[0-9]*' }} | ||
InputProps={{ | ||
endAdornment: ( | ||
<InputAdornment position={'end'}> | ||
<FadingCheckIcon fadeIn={calcExpUpdated} disabled={readOnly} /> | ||
{displayUnit} | ||
</InputAdornment> | ||
) | ||
}} | ||
helperText={feedback} | ||
data-test="q-item-quantity-field" | ||
/> | ||
); | ||
} | ||
|
||
export default QuantityField; |
Oops, something went wrong.