@aehrc/smart-forms-renderer 0.35.1 → 0.35.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.
Files changed (68) hide show
  1. package/lib/components/FormComponents/AttachmentItem/AttachmentField.js +4 -4
  2. package/lib/components/FormComponents/AttachmentItem/AttachmentField.js.map +1 -1
  3. package/lib/components/FormComponents/AttachmentItem/AttachmentFileCollector.d.ts +1 -0
  4. package/lib/components/FormComponents/AttachmentItem/AttachmentFileCollector.js +7 -4
  5. package/lib/components/FormComponents/AttachmentItem/AttachmentFileCollector.js.map +1 -1
  6. package/lib/components/FormComponents/AttachmentItem/AttachmentFileDropBox.d.ts +1 -0
  7. package/lib/components/FormComponents/AttachmentItem/AttachmentFileDropBox.js +6 -3
  8. package/lib/components/FormComponents/AttachmentItem/AttachmentFileDropBox.js.map +1 -1
  9. package/lib/components/FormComponents/AttachmentItem/AttachmentUrlField.js +1 -1
  10. package/lib/components/FormComponents/AttachmentItem/AttachmentUrlField.js.map +1 -1
  11. package/lib/components/FormComponents/BooleanItem/BooleanField.js +1 -1
  12. package/lib/components/FormComponents/BooleanItem/BooleanField.js.map +1 -1
  13. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.js +1 -1
  14. package/lib/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.js.map +1 -1
  15. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js +1 -1
  16. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.js.map +1 -1
  17. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js +1 -1
  18. package/lib/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.js.map +1 -1
  19. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js +2 -2
  20. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.js.map +1 -1
  21. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js +2 -2
  22. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.js.map +1 -1
  23. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js +1 -1
  24. package/lib/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.js.map +1 -1
  25. package/lib/components/FormComponents/DateTimeItems/CustomDateItem/CustomDateField.js +1 -1
  26. package/lib/components/FormComponents/DateTimeItems/CustomDateItem/CustomDateField.js.map +1 -1
  27. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.js +1 -1
  28. package/lib/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.js.map +1 -1
  29. package/lib/components/FormComponents/ItemParts/ItemFieldGrid.js +3 -3
  30. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js +1 -1
  31. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.js.map +1 -1
  32. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js +1 -1
  33. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.js.map +1 -1
  34. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetFields.js +1 -1
  35. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetFields.js.map +1 -1
  36. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js +1 -1
  37. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.js.map +1 -1
  38. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js +1 -1
  39. package/lib/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.js.map +1 -1
  40. package/lib/components/FormComponents/UrlItem/UrlItem.js +1 -1
  41. package/lib/components/FormComponents/UrlItem/UrlItem.js.map +1 -1
  42. package/lib/utils/openChoice.js +2 -1
  43. package/lib/utils/openChoice.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/components/FormComponents/AttachmentItem/AttachmentField.tsx +6 -3
  46. package/src/components/FormComponents/AttachmentItem/AttachmentFileCollector.tsx +9 -3
  47. package/src/components/FormComponents/AttachmentItem/AttachmentFileDropBox.tsx +7 -3
  48. package/src/components/FormComponents/AttachmentItem/AttachmentUrlField.tsx +3 -1
  49. package/src/components/FormComponents/BooleanItem/BooleanField.tsx +1 -1
  50. package/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteField.tsx +1 -1
  51. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerOptionFields.tsx +1 -1
  52. package/src/components/FormComponents/ChoiceItems/ChoiceRadioAnswerValueSetFields.tsx +1 -1
  53. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerOptionFields.tsx +1 -2
  54. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetFields.tsx +2 -2
  55. package/src/components/FormComponents/ChoiceItems/ChoiceSelectAnswerValueSetItem.tsx +1 -2
  56. package/src/components/FormComponents/DateTimeItems/CustomDateItem/CustomDateField.tsx +1 -1
  57. package/src/components/FormComponents/DateTimeItems/CustomDateTimeItem/CustomDateTimeItem.tsx +1 -1
  58. package/src/components/FormComponents/ItemParts/ItemFieldGrid.tsx +3 -3
  59. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceAutocompleteField.tsx +1 -1
  60. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerOptionFields.tsx +1 -1
  61. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceRadioAnswerValueSetFields.tsx +1 -1
  62. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerOptionField.tsx +1 -1
  63. package/src/components/FormComponents/OpenChoiceItems/OpenChoiceSelectAnswerValueSetField.tsx +1 -1
  64. package/src/components/FormComponents/UrlItem/UrlItem.tsx +1 -1
  65. package/src/stories/assets/questionnaires/QPrePopTester.ts +201 -0
  66. package/src/stories/testing/BuildFormButtonTesterWrapper.stories.tsx +0 -8
  67. package/src/stories/testing/PrePopButtonTesterWrapper.stories.tsx +12 -2
  68. package/src/utils/openChoice.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"UrlItem.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/UrlItem/UrlItem.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAQ3C,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,qBAAqB,MAAM,sCAAsC,CAAC;AACzE,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAU3D,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAExF,MAAM,aAAa,GAAG,qBAAqB,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;IAEhE,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACtD,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAElF,mBAAmB;IACn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,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,IAAG,CAAC;SACnE;aAAM;YACL,cAAc,CAAC,WAAW,CAAC,CAAC;SAC7B;IACH,CAAC,EAAE,iBAAiB,CAAC,EACrB,CAAC,cAAc,EAAE,KAAK,CAAC,CACxB,CAAC,CAAC,oFAAoF;IAEvF,IAAI,UAAU,EAAE;QACd,OAAO,CACL,oBAAC,QAAQ,IACP,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,YAAY,EAC3B,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;KACH;IACD,OAAO,CACL,oBAAC,yBAAyB,iBACd,gBAAgB,iBACb,KAAK,CAAC,MAAM,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;QAC1C,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ;YAC7C,oBAAC,QAAQ,IACP,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,YAAY,EAC3B,QAAQ,EAAE,QAAQ,GAClB,CACY,CACU,CAC7B,CAAC;AACJ,CAAC;AAED,eAAe,OAAO,CAAC"}
@@ -100,11 +100,12 @@ export function getOpenChoiceControlType(qItem) {
100
100
  * @author Sean Fong
101
101
  */
102
102
  export function getAnswerOptionLabel(option) {
103
+ var _a;
103
104
  if (typeof option === 'string') {
104
105
  return option;
105
106
  }
106
107
  if (option['valueCoding']) {
107
- return `${option.valueCoding.display}`;
108
+ return (_a = option.valueCoding.display) !== null && _a !== void 0 ? _a : `${option.valueCoding.code}`;
108
109
  }
109
110
  else if (option['valueString']) {
110
111
  return option.valueString;
@@ -1 +1 @@
1
- {"version":3,"file":"openChoice.js","sourceRoot":"","sources":["../../src/utils/openChoice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,gBAAyB,EACzB,qBAA6B,EAC7B,OAA0C,EAC1C,OAAwC,EACxC,SAAoC,EACpC,gBAAyB;IAEzB,qEAAqE;IACrE,IAAI,CAAC,gBAAgB,EAAE;QACrB,+EAA+E;QAC/E,IAAI,CAAC,gBAAgB,EAAE;YACrB,uCACK,SAAS,KACZ,MAAM,EAAE,EAAE,IACV;SACH;QAED,oDAAoD;QACpD,6DAA6D;QAC7D,MAAM,cAAc,GAAG,OAAO;aAC3B,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,KAAK,qBAAqB,CAAC;aAChE,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAE9C,wGAAwG;QACxG,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,MAAM,gBAAgB,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnE,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,gBAAgB,CAAC,CAAC;YAEjF,uCACK,SAAS,KACZ,MAAM,EAAE,UAAU,IAClB;S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;QACL,OAAO,EAAE,CAAC;KACX;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aehrc/smart-forms-renderer",
3
- "version": "0.35.1",
3
+ "version": "0.35.3",
4
4
  "description": "FHIR Structured Data Captured (SDC) rendering engine for Smart Forms",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -50,12 +50,13 @@ function AttachmentField(props: AttachmentFieldProps) {
50
50
  return (
51
51
  <>
52
52
  <Stack rowGap={1}>
53
- <Typography variant="subtitle2">
53
+ <Typography variant="subtitle2" color={readOnly ? 'text.disabled' : 'text.primary'}>
54
54
  An attachment must either have a file or a URL, or both.
55
55
  </Typography>
56
56
  <Box>
57
57
  <AttachmentFileCollector
58
58
  uploadedFile={uploadedFile}
59
+ readOnly={readOnly}
59
60
  isTabled={isTabled}
60
61
  onUploadFile={onUploadFile}
61
62
  />
@@ -70,7 +71,9 @@ function AttachmentField(props: AttachmentFieldProps) {
70
71
  />
71
72
 
72
73
  <Box>
73
- <Typography variant="body2">File name (optional)</Typography>
74
+ <Typography variant="body2" color={readOnly ? 'text.disabled' : 'text.primary'}>
75
+ File name (optional)
76
+ </Typography>
74
77
  <StandardTextField
75
78
  fullWidth
76
79
  isTabled={isTabled}
@@ -84,7 +87,7 @@ function AttachmentField(props: AttachmentFieldProps) {
84
87
  </Box>
85
88
 
86
89
  {uploadedFile && url ? (
87
- <Typography variant="subtitle2">
90
+ <Typography variant="subtitle2" color={readOnly ? 'text.disabled' : 'text.primary'}>
88
91
  Ensure that the attached file and URL has the same content.
89
92
  </Typography>
90
93
  ) : null}
@@ -24,16 +24,21 @@ import type { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps
24
24
 
25
25
  interface AttachmentFileCollectorProps extends PropsWithIsTabledAttribute {
26
26
  uploadedFile: File | null;
27
+ readOnly: boolean;
27
28
  onUploadFile: (file: File | null) => void;
28
29
  }
29
30
 
30
31
  const AttachmentFileCollector = memo(function AttachmentFileCollector(
31
32
  props: AttachmentFileCollectorProps
32
33
  ) {
33
- const { uploadedFile, isTabled, onUploadFile } = props;
34
+ const { uploadedFile, readOnly, isTabled, onUploadFile } = props;
34
35
 
35
36
  const handleFileDrop = useCallback(
36
37
  (item: { files: any[] }) => {
38
+ if (readOnly) {
39
+ return;
40
+ }
41
+
37
42
  if (item) {
38
43
  const files = item.files;
39
44
 
@@ -61,12 +66,13 @@ const AttachmentFileCollector = memo(function AttachmentFileCollector(
61
66
  onDrop={handleFileDrop}
62
67
  file={uploadedFile}
63
68
  errorMessage={''}
69
+ readOnly={readOnly}
64
70
  isTabled={isTabled}
65
71
  />
66
72
  <Stack direction="row" justifyContent="space-between" pt={0.5}>
67
73
  <Box>
68
74
  <Tooltip title="Attach file">
69
- <IconButton component="label" size="small">
75
+ <IconButton component="label" size="small" disabled={readOnly}>
70
76
  <Iconify icon="fluent:attach-24-regular" />
71
77
  <input type="file" hidden onChange={handleAttachFile} />
72
78
  </IconButton>
@@ -74,7 +80,7 @@ const AttachmentFileCollector = memo(function AttachmentFileCollector(
74
80
  <Tooltip title="Remove file">
75
81
  <span>
76
82
  <IconButton
77
- disabled={!uploadedFile}
83
+ disabled={!uploadedFile || readOnly}
78
84
  color="error"
79
85
  size="small"
80
86
  onClick={() => onUploadFile(null)}>
@@ -26,17 +26,20 @@ export interface AttachmentFileDropBoxProps extends PropsWithIsTabledAttribute {
26
26
  file: File | null;
27
27
  onDrop: (item: { files: any[] }) => void;
28
28
  errorMessage: string;
29
+ readOnly: boolean;
29
30
  }
30
31
 
31
32
  function AttachmentFileDropBox(props: AttachmentFileDropBoxProps) {
32
- const { file, onDrop, errorMessage, isTabled } = props;
33
+ const { file, onDrop, errorMessage, readOnly, isTabled } = props;
33
34
 
34
35
  const { canDrop, isOver, dropTarget } = useFileDrop(onDrop);
35
36
 
36
37
  const isActive = canDrop && isOver;
37
38
 
38
39
  let boxMessage = 'No file selected';
39
- if (isActive) {
40
+ if (readOnly) {
41
+ boxMessage = 'Item is read only';
42
+ } else if (isActive) {
40
43
  boxMessage = 'Release to drop file';
41
44
  } else if (errorMessage) {
42
45
  boxMessage = errorMessage;
@@ -51,7 +54,8 @@ function AttachmentFileDropBox(props: AttachmentFileDropBoxProps) {
51
54
  isActive={isActive}
52
55
  isTabled={isTabled}>
53
56
  <Box p={1.5}>
54
- <Typography>{boxMessage}</Typography>
57
+ <Typography color={readOnly ? 'text.disabled' : 'text.primary'}>{boxMessage}</Typography>
58
+
55
59
  {file ? (
56
60
  <Box pt={1}>
57
61
  <Typography fontSize={10}>Size: {getFileSize(file.size.toString() ?? '0')}</Typography>
@@ -41,7 +41,9 @@ function AttachmentUrlField(props: AttachmentUrlFieldProps) {
41
41
 
42
42
  return (
43
43
  <Box>
44
- <Typography variant="body2">URL</Typography>
44
+ <Typography variant="body2" color={readOnly ? 'text.disabled' : 'text.primary'}>
45
+ URL
46
+ </Typography>
45
47
  <Stack direction="row" alignItems="center">
46
48
  <StandardTextField
47
49
  fullWidth
@@ -48,9 +48,9 @@ const BooleanField = memo(function BooleanField(props: BooleanFieldProps) {
48
48
  return (
49
49
  <Box display="flex" alignItems="center">
50
50
  <StyledRadioGroup
51
+ id={qItem.linkId}
51
52
  row={orientation === ChoiceItemOrientation.Horizontal}
52
53
  name={qItem.text}
53
- id={qItem.id}
54
54
  onChange={(e) => onCheckedChange(e.target.value)}
55
55
  value={selection}>
56
56
  <ChoiceRadioSingle value="true" label="Yes" readOnly={readOnly} />
@@ -64,7 +64,7 @@ function ChoiceAutocompleteField(props: ChoiceAutocompleteFieldsProps) {
64
64
 
65
65
  return (
66
66
  <Autocomplete
67
- id={qItem.id}
67
+ id={qItem.linkId}
68
68
  value={valueCoding ?? null}
69
69
  options={options}
70
70
  getOptionLabel={(option) => option.display ?? `${option.code}`}
@@ -46,9 +46,9 @@ function ChoiceRadioAnswerOptionFields(props: ChoiceRadioAnswerOptionFieldsProps
46
46
  return (
47
47
  <Box display="flex" alignItems="center">
48
48
  <StyledRadioGroup
49
+ id={qItem.linkId}
49
50
  row={orientation === ChoiceItemOrientation.Horizontal}
50
51
  name={qItem.text}
51
- id={qItem.id}
52
52
  onChange={(e) => onCheckedChange(e.target.value)}
53
53
  value={valueRadio}
54
54
  data-test="q-item-radio-group">
@@ -61,9 +61,9 @@ function ChoiceRadioAnswerValueSetFields(props: ChoiceRadioAnswerValueSetFieldsP
61
61
  return (
62
62
  <Box display="flex" alignItems="center">
63
63
  <StyledRadioGroup
64
+ id={qItem.linkId}
64
65
  row={orientation === ChoiceItemOrientation.Horizontal}
65
66
  name={qItem.text}
66
- id={qItem.id}
67
67
  onChange={(e) => onCheckedChange(e.target.value)}
68
68
  value={valueRadio}
69
69
  data-test="q-item-radio-group">
@@ -41,7 +41,7 @@ function ChoiceSelectAnswerOptionFields(props: ChoiceSelectAnswerOptionFieldsPro
41
41
 
42
42
  return (
43
43
  <Autocomplete
44
- id={qItem.id}
44
+ id={qItem.linkId}
45
45
  value={valueSelect ?? null}
46
46
  options={options}
47
47
  getOptionLabel={(option) => getAnswerOptionLabel(option)}
@@ -68,7 +68,6 @@ function ChoiceSelectAnswerOptionFields(props: ChoiceSelectAnswerOptionFieldsPro
68
68
  </>
69
69
  )
70
70
  }}
71
- data-test="q-item-choice-dropdown-answer-value-set-field"
72
71
  />
73
72
  )}
74
73
  />
@@ -54,7 +54,7 @@ function ChoiceSelectAnswerValueSetFields(props: ChoiceSelectAnswerValueSetField
54
54
  if (codings.length > 0) {
55
55
  return (
56
56
  <Autocomplete
57
- id={qItem.id}
57
+ id={qItem.linkId}
58
58
  options={codings}
59
59
  getOptionLabel={(option) => option.display ?? `${option.code}`}
60
60
  value={valueCoding ?? null}
@@ -80,7 +80,7 @@ function ChoiceSelectAnswerValueSetFields(props: ChoiceSelectAnswerValueSetField
80
80
  </>
81
81
  )
82
82
  }}
83
- data-test="q-item-choice-dropdown-answer-value-set-field"
83
+ data-test="q-item-choice-select-answer-value-set-field"
84
84
  />
85
85
  )}
86
86
  />
@@ -129,8 +129,7 @@ function ChoiceSelectAnswerValueSetItem(props: ChoiceSelectAnswerValueSetItemPro
129
129
 
130
130
  return (
131
131
  <FullWidthFormComponentBox
132
- data-test="q-item-choice-dropdown-answer-value-set-box"
133
- data-linkid={qItem.linkId}
132
+ data-test="q-item-choice-select-answer-value-set-box"
134
133
  onClick={() => onFocusLinkId(qItem.linkId)}>
135
134
  <ItemFieldGrid qItem={qItem} readOnly={readOnly}>
136
135
  <ChoiceSelectAnswerValueSetFields
@@ -58,7 +58,7 @@ function CustomDateField(props: CustomDateFieldProps) {
58
58
  return (
59
59
  <Tooltip title={isTabled ? feedback : ''}>
60
60
  <StandardTextField
61
- id={linkId}
61
+ id={linkId + '-date'}
62
62
  ref={anchorRef}
63
63
  fullWidth
64
64
  isTabled={isTabled}
@@ -197,7 +197,7 @@ function CustomDateTimeItem(props: CustomDateTimeItemProps) {
197
197
 
198
198
  return (
199
199
  <FullWidthFormComponentBox
200
- data-test="q-item-date-box"
200
+ data-test="q-item-datetime-box"
201
201
  data-linkid={qItem.linkId}
202
202
  onClick={() => onFocusLinkId(qItem.linkId)}>
203
203
  <ItemFieldGrid qItem={qItem} readOnly={readOnly}>
@@ -35,11 +35,11 @@ function ItemFieldGrid(props: ItemFieldGridProps) {
35
35
  const { displayInstructions } = useRenderingExtensions(qItem);
36
36
 
37
37
  return (
38
- <Grid container columnSpacing={6}>
39
- <Grid item xs={5}>
38
+ <Grid container columnSpacing={4}>
39
+ <Grid item xs={4}>
40
40
  <LabelWrapper qItem={qItem} readOnly={readOnly} />
41
41
  </Grid>
42
- <Grid item xs={7}>
42
+ <Grid item xs={8}>
43
43
  {children}
44
44
  <DisplayInstructions displayInstructions={displayInstructions} readOnly={readOnly} />
45
45
  </Grid>
@@ -70,7 +70,7 @@ function OpenChoiceAutocompleteField(props: OpenChoiceAutocompleteFieldProps) {
70
70
  return (
71
71
  <Box display="flex">
72
72
  <Autocomplete
73
- id={qItem.id}
73
+ id={qItem.linkId}
74
74
  value={valueAutocomplete}
75
75
  options={options}
76
76
  getOptionLabel={(option) =>
@@ -51,9 +51,9 @@ function OpenChoiceRadioAnswerOptionFields(props: OpenChoiceRadioAnswerOptionFie
51
51
 
52
52
  return (
53
53
  <StyledRadioGroup
54
+ id={qItem.linkId}
54
55
  row={orientation === ChoiceItemOrientation.Horizontal}
55
56
  name={qItem.text}
56
- id={qItem.id}
57
57
  onChange={(e: ChangeEvent<HTMLInputElement>) => onValueChange(e.target.value, null)}
58
58
  value={valueRadio}
59
59
  data-test="q-item-radio-group">
@@ -58,9 +58,9 @@ function OpenChoiceRadioAnswerValueSetFields(props: OpenChoiceRadioAnswerValueSe
58
58
  if (options.length > 0) {
59
59
  return (
60
60
  <StyledRadioGroup
61
+ id={qItem.linkId}
61
62
  row={orientation === ChoiceItemOrientation.Horizontal}
62
63
  name={qItem.text}
63
- id={qItem.id}
64
64
  onChange={(e: ChangeEvent<HTMLInputElement>) => onValueChange(e.target.value, null)}
65
65
  value={valueRadio}
66
66
  data-test="q-item-radio-group">
@@ -26,7 +26,7 @@ function OpenChoiceSelectAnswerOptionField(props: OpenChoiceSelectAnswerOptionFi
26
26
 
27
27
  return (
28
28
  <Autocomplete
29
- id={qItem.id}
29
+ id={qItem.linkId}
30
30
  value={valueSelect ?? null}
31
31
  options={options}
32
32
  getOptionLabel={(option) => getAnswerOptionLabel(option)}
@@ -30,7 +30,7 @@ function OpenChoiceSelectAnswerValueSetField(props: OpenChoiceSelectAnswerValueS
30
30
  return (
31
31
  <>
32
32
  <Autocomplete
33
- id={qItem.id}
33
+ id={qItem.linkId}
34
34
  value={valueSelect ?? null}
35
35
  options={options}
36
36
  getOptionLabel={(option) =>
@@ -97,7 +97,7 @@ function UrlItem(props: UrlItemProps) {
97
97
  }
98
98
  return (
99
99
  <FullWidthFormComponentBox
100
- data-test="q-item-string-box"
100
+ data-test="q-item-url-box"
101
101
  data-linkid={qItem.linkId}
102
102
  onClick={() => onFocusLinkId(qItem.linkId)}>
103
103
  <ItemFieldGrid qItem={qItem} readOnly={readOnly}>
@@ -0,0 +1,201 @@
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
+
18
+ import type { Questionnaire } from 'fhir/r4';
19
+
20
+ export const qSelectivePrePopTester: Questionnaire = {
21
+ resourceType: 'Questionnaire',
22
+ id: 'SelectivePrePopTester',
23
+ name: 'SelectivePrePopTester',
24
+ title: 'Selective Pre-pop Tester',
25
+ version: '0.1.0',
26
+ status: 'draft',
27
+ publisher: 'AEHRC CSIRO',
28
+ date: '2024-05-01',
29
+ url: 'https://smartforms.csiro.au/docs/tester/prepop-1',
30
+ contained: [
31
+ {
32
+ resourceType: 'ValueSet',
33
+ id: 'administrative-gender',
34
+ meta: {
35
+ profile: ['http://hl7.org/fhir/StructureDefinition/shareablevalueset']
36
+ },
37
+ extension: [
38
+ {
39
+ url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-wg',
40
+ valueCode: 'pa'
41
+ },
42
+ {
43
+ url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status',
44
+ valueCode: 'normative'
45
+ },
46
+ {
47
+ url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm',
48
+ valueInteger: 5
49
+ },
50
+ {
51
+ url: 'http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version',
52
+ valueCode: '4.0.0'
53
+ }
54
+ ],
55
+ url: 'http://hl7.org/fhir/ValueSet/administrative-gender',
56
+ identifier: [
57
+ {
58
+ system: 'urn:ietf:rfc:3986',
59
+ value: 'urn:oid:2.16.840.1.113883.4.642.3.1'
60
+ }
61
+ ],
62
+ version: '4.0.1',
63
+ name: 'AdministrativeGender',
64
+ title: 'AdministrativeGender',
65
+ status: 'active',
66
+ experimental: false,
67
+ date: '2019-11-01T09:29:23+11:00',
68
+ publisher: 'HL7 (FHIR Project)',
69
+ contact: [
70
+ {
71
+ telecom: [
72
+ {
73
+ system: 'url',
74
+ value: 'http://hl7.org/fhir'
75
+ },
76
+ {
77
+ system: 'email',
78
+ value: 'fhir@lists.hl7.org'
79
+ }
80
+ ]
81
+ }
82
+ ],
83
+ description: 'The gender of a person used for administrative purposes.',
84
+ immutable: true,
85
+ copyright: 'Copyright © 2011+ HL7. Licensed under Creative Commons "No Rights Reserved".',
86
+ compose: {
87
+ include: [
88
+ {
89
+ system: 'http://hl7.org/fhir/administrative-gender'
90
+ }
91
+ ]
92
+ },
93
+ expansion: {
94
+ identifier: 'urn:uuid:50f050c9-3975-48d6-bdb7-baae4ebc70cd',
95
+ timestamp: '2024-04-05T12:31:27+10:00',
96
+ total: 4,
97
+ parameter: [
98
+ {
99
+ name: 'version',
100
+ valueUri: 'http://hl7.org/fhir/administrative-gender|4.0.1'
101
+ },
102
+ {
103
+ name: 'used-codesystem',
104
+ valueUri: 'http://hl7.org/fhir/administrative-gender|4.0.1'
105
+ }
106
+ ],
107
+ contains: [
108
+ {
109
+ system: 'http://hl7.org/fhir/administrative-gender',
110
+ code: 'female',
111
+ display: 'Female'
112
+ },
113
+ {
114
+ system: 'http://hl7.org/fhir/administrative-gender',
115
+ code: 'male',
116
+ display: 'Male'
117
+ },
118
+ {
119
+ system: 'http://hl7.org/fhir/administrative-gender',
120
+ code: 'other',
121
+ display: 'Other'
122
+ },
123
+ {
124
+ system: 'http://hl7.org/fhir/administrative-gender',
125
+ code: 'unknown',
126
+ display: 'Unknown'
127
+ }
128
+ ]
129
+ }
130
+ }
131
+ ],
132
+ extension: [
133
+ {
134
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext',
135
+ extension: [
136
+ {
137
+ url: 'name',
138
+ valueCoding: {
139
+ system: 'http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext',
140
+ code: 'patient'
141
+ }
142
+ },
143
+ {
144
+ url: 'type',
145
+ valueCode: 'Patient'
146
+ },
147
+ {
148
+ url: 'description',
149
+ valueString: 'The patient that is to be used to pre-populate the form'
150
+ }
151
+ ]
152
+ }
153
+ ],
154
+ item: [
155
+ {
156
+ linkId: 'display-description',
157
+ extension: [
158
+ {
159
+ url: 'http://hl7.org/fhir/StructureDefinition/rendering-xhtml',
160
+ valueString:
161
+ '<div xmlns="http://www.w3.org/1999/xhtml">\r\n <div style="font-size:0.875em"> This questionnaire is used by Playwright to do regression testing of the <pre style="display: inline">@aehrc/sdc-populate</pre> library\'s pre-population logic. Items will be incrementally added as needed.</div><br/></div>'
162
+ }
163
+ ],
164
+ text: "This questionnaire is used by Playwright to do regression testing of the @aehrc/sdc-populate library's pre-population logic. Items will be incrementally added as needed.",
165
+ type: 'display',
166
+ repeats: false
167
+ },
168
+ {
169
+ extension: [
170
+ {
171
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
172
+ valueExpression: {
173
+ language: 'text/fhirpath',
174
+ expression: '%patient.gender'
175
+ }
176
+ }
177
+ ],
178
+ linkId: 'gender-avs-url',
179
+ text: 'Administrative gender (answerValueSet url)',
180
+ type: 'choice',
181
+ repeats: false,
182
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/administrative-gender'
183
+ },
184
+ {
185
+ extension: [
186
+ {
187
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression',
188
+ valueExpression: {
189
+ language: 'text/fhirpath',
190
+ expression: '%patient.gender'
191
+ }
192
+ }
193
+ ],
194
+ linkId: 'gender-avs-contained',
195
+ text: 'Administrative gender (answerValueSet contained)',
196
+ type: 'choice',
197
+ repeats: false,
198
+ answerValueSet: 'http://hl7.org/fhir/ValueSet/administrative-gender'
199
+ }
200
+ ]
201
+ };
@@ -18,7 +18,6 @@
18
18
  import type { Meta, StoryObj } from '@storybook/react';
19
19
  import BuildFormButtonTesterWrapperForStorybook from '../storybookWrappers/BuildFormButtonTesterWrapperForStorybook';
20
20
  import { qButtonTester, qrButtonTesterResponse } from '../assets/questionnaires/QButtonTester';
21
- import { qBooleanBasic, qrBooleanBasicResponse } from '../assets/questionnaires';
22
21
 
23
22
  // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
24
23
  const meta = {
@@ -39,10 +38,3 @@ export const BuildFormButtonTester: Story = {
39
38
  questionnaireResponse: qrButtonTesterResponse
40
39
  }
41
40
  };
42
-
43
- export const BuildFormButtonTesterBoolean: Story = {
44
- args: {
45
- questionnaire: qBooleanBasic,
46
- questionnaireResponse: qrBooleanBasicResponse
47
- }
48
- };
@@ -21,10 +21,11 @@ import { mockFhirClient } from '../assets/fhirClient/mockFhirClient';
21
21
  import { patSmartForm } from '../assets/patients/PatSmartForm';
22
22
  import { pracPrimaryPeter } from '../assets/practitioners/PracPrimaryPeter';
23
23
  import { qButtonTester } from '../assets/questionnaires/QButtonTester';
24
+ import { qSelectivePrePopTester } from '../assets/questionnaires/QPrePopTester';
24
25
 
25
26
  // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
26
27
  const meta = {
27
- title: 'Component/Testing/Pre Pop Button Tester',
28
+ title: 'Component/Testing/Pre Pop Tester',
28
29
  component: PrePopWrapperForStorybook,
29
30
  // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
30
31
  tags: []
@@ -35,7 +36,7 @@ type Story = StoryObj<typeof meta>;
35
36
 
36
37
  // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
37
38
 
38
- export const PrePopButtonTester: Story = {
39
+ export const BasicPrePopTester: Story = {
39
40
  args: {
40
41
  questionnaire: qButtonTester,
41
42
  fhirClient: mockFhirClient,
@@ -43,3 +44,12 @@ export const PrePopButtonTester: Story = {
43
44
  user: pracPrimaryPeter
44
45
  }
45
46
  };
47
+
48
+ export const SelectivePrePopTester: Story = {
49
+ args: {
50
+ questionnaire: qSelectivePrePopTester,
51
+ fhirClient: mockFhirClient,
52
+ patient: patSmartForm,
53
+ user: pracPrimaryPeter
54
+ }
55
+ };
@@ -153,7 +153,7 @@ export function getAnswerOptionLabel(option: QuestionnaireItemAnswerOption | str
153
153
  }
154
154
 
155
155
  if (option['valueCoding']) {
156
- return `${option.valueCoding.display}`;
156
+ return option.valueCoding.display ?? `${option.valueCoding.code}`;
157
157
  } else if (option['valueString']) {
158
158
  return option.valueString;
159
159
  } else if (option['valueInteger']) {