@aehrc/smart-forms-renderer 0.31.6 → 0.32.0
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 +3 -101
- package/lib/components/Renderer/SmartFormsRenderer.d.ts +1 -1
- package/lib/components/Renderer/SmartFormsRenderer.js +1 -1
- package/lib/stories/StorybookWrappers/InitialiseFormWrapperForStorybook.d.ts +4 -4
- package/lib/stories/StorybookWrappers/InitialiseFormWrapperForStorybook.js +4 -4
- package/lib/theme/Theme.d.ts +1 -1
- package/lib/theme/Theme.js +1 -1
- package/lib/utils/manageForm.d.ts +2 -1
- package/lib/utils/manageForm.js +2 -1
- package/lib/utils/manageForm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Renderer/SmartFormsRenderer.tsx +1 -1
- package/src/stories/storybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx +1 -1
- package/src/stories/storybookWrappers/InitialiseFormWrapperForStorybook.tsx +4 -4
- package/src/stories/storybookWrappers/PrePopWrapperForStorybook.tsx +1 -1
- package/src/stories/storybookWrappers/populateCallbackForStorybook.ts +1 -1
- package/src/theme/Theme.tsx +1 -1
- package/src/utils/manageForm.ts +2 -1
package/README.md
CHANGED
|
@@ -1,108 +1,10 @@
|
|
|
1
1
|
# Smart Forms Renderer
|
|
2
|
-
This React-based package acts as the rendering engine for the [Smart Forms app](https://github.com/aehrc/smart-forms).
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
A React-based library that contains the Questionnaire renderer used in the Smart Forms app.
|
|
4
|
+
It acts as a reference implementation for the [SDC Form Filler](https://hl7.org/fhir/uv/sdc/CapabilityStatement-sdc-form-filler.html).
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @aehrc/smart-forms-renderer
|
|
9
|
-
```
|
|
6
|
+
<h4><a href="https://smartforms.csiro.au/docs/devUsage">Check out the documentation 📚</a></h4>
|
|
10
7
|
|
|
11
|
-
## Basic Usage
|
|
12
|
-
|
|
13
|
-
```typescript jsx
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import { SmartFormsRenderer, getResponse } from '@aehrc/smart-forms-renderer';
|
|
16
|
-
|
|
17
|
-
export default function App () {
|
|
18
|
-
const questionnaire = {...} // FHIR R4.Questionnaire
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div>
|
|
22
|
-
<SmartFormsRenderer questionnaire={questionnaire}/>
|
|
23
|
-
<button onClick={() => {
|
|
24
|
-
const response = getResponse()
|
|
25
|
-
// Do something with the questionnaire response
|
|
26
|
-
}}/>
|
|
27
|
-
</div>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
Note: The SmartFormsRenderer component trades customisability for simplicity. If you need more control over the rendering engine, refer to the Advanced Usage section.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### SmartFormsRenderer Props
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
| Name | Type | Description | Required? |
|
|
38
|
-
|-----------------------|-------------------------------|---------------------------------------------------------------------------------------------------------------------|-----------|
|
|
39
|
-
| questionnaire | FHIR R4.Questionnaire | Questionnaire to be rendered | Required |
|
|
40
|
-
| questionnaireResponse | FHIR R4.QuestionnaireResponse | Pre-populated QuestionnaireResponse to be rendered | Optional |
|
|
41
|
-
| additionalVariables | `Record<string, Extension>` | Key-value pair of [SDC variables](http://hl7.org/fhir/R4/extension-variable.html) `Record<name, variable extension>` | Optional |
|
|
42
|
-
| terminologyServerUrl | string | Terminology server url to fetch terminology | Optional |
|
|
43
|
-
|
|
44
|
-
The below props are not supported at the moment, but will be in the future.
|
|
45
|
-
|
|
46
|
-
| Name | Type | Description |
|
|
47
|
-
|----------------------|------------------------------------------------------|---------------------------------------------|
|
|
48
|
-
| fhirClient | [Client](https://github.com/smart-on-fhir/client-js) | FhirClient to perform further FHIR calls |
|
|
49
|
-
|
|
50
|
-
### Functions
|
|
51
|
-
|
|
52
|
-
```javascript
|
|
53
|
-
/**
|
|
54
|
-
* Get the filled QuestionnaireResponse at its current state.
|
|
55
|
-
* If no changes have been made to the form, the initial or an empty QuestionnaireResponse is returned.
|
|
56
|
-
*
|
|
57
|
-
* @returns {FHIR R4.QuestionnaireResponse} The filled QuestionnaireResponse
|
|
58
|
-
*/
|
|
59
|
-
function getResponse() {}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
## Advanced Usage (If basic usage does not suffice)
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
/* Components */
|
|
67
|
-
// A self-initialising wrapper around the rendering engine. This is sufficient for most use cases.
|
|
68
|
-
|
|
69
|
-
function SmartFormsRenderer(props: {
|
|
70
|
-
questionnaire: Questionnaire,
|
|
71
|
-
questionnaireResponse?: QuestionnaireResponse,
|
|
72
|
-
additionalVariables?: Record<string, Extension>,
|
|
73
|
-
terminologyServerUrl?: string,
|
|
74
|
-
}): JSX.Element {}
|
|
75
|
-
|
|
76
|
-
// BaseRenderer underneath the SmartFormsRenderer wrapper. Requires buildForm() to initialise form.
|
|
77
|
-
function BaseRenderer(): JSX.Element {}
|
|
78
|
-
|
|
79
|
-
/* Functions */
|
|
80
|
-
// Get the filled QuestionnaireResponse at its current state.
|
|
81
|
-
// If no changes have been made to the form, the initial QuestionnaireResponse is returned.
|
|
82
|
-
function getResponse(): QuestionnaireResponse {}
|
|
83
|
-
|
|
84
|
-
// Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
|
|
85
|
-
// If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
|
|
86
|
-
async function buildForm(
|
|
87
|
-
questionnaire: Questionnaire,
|
|
88
|
-
questionnaireResponse?: QuestionnaireResponse
|
|
89
|
-
): Promise<void> {}
|
|
90
|
-
|
|
91
|
-
// Destroy the form to clean up the questionnaire and questionnaireResponse stores.
|
|
92
|
-
function destroyForm(): void {}
|
|
93
|
-
|
|
94
|
-
// Remove all hidden answers from the filled QuestionnaireResponse.
|
|
95
|
-
// This takes into account the questionnaire-hidden extension, enableWhens and enableWhenExpressions.
|
|
96
|
-
function removeHiddenAnswersFromResponse(
|
|
97
|
-
questionnaire: Questionnaire,
|
|
98
|
-
questionnaireResponse: QuestionnaireResponse
|
|
99
|
-
): QuestionnaireResponse {}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
The Smart Forms app uses a even finer-grained control which directly interacts with the state management stores.
|
|
103
|
-
|
|
104
|
-
At the moment there are no plans to document state management methods, but happy to do so if there is demand for it.
|
|
105
|
-
Raise a request in https://github.com/aehrc/smart-forms/issues if you want to see it happen!
|
|
106
8
|
|
|
107
9
|
---
|
|
108
10
|
|
|
@@ -24,7 +24,7 @@ export interface SmartFormsRendererProps {
|
|
|
24
24
|
/**
|
|
25
25
|
* A self-initialising wrapper around the BaseRenderer rendering engine.
|
|
26
26
|
* Will be deprecated in version 1.0.0. For alternative usage, see:
|
|
27
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
27
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/InitialiseFormWrapperForStorybook.tsx#L40-L57
|
|
28
28
|
*
|
|
29
29
|
* @see SmartFormsRendererProps for props.
|
|
30
30
|
*
|
|
@@ -27,7 +27,7 @@ import BaseRenderer from './BaseRenderer';
|
|
|
27
27
|
/**
|
|
28
28
|
* A self-initialising wrapper around the BaseRenderer rendering engine.
|
|
29
29
|
* Will be deprecated in version 1.0.0. For alternative usage, see:
|
|
30
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
30
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/InitialiseFormWrapperForStorybook.tsx#L40-L57
|
|
31
31
|
*
|
|
32
32
|
* @see SmartFormsRendererProps for props.
|
|
33
33
|
*
|
|
@@ -20,10 +20,10 @@ export interface InitialiseFormWrapperProps {
|
|
|
20
20
|
* - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities.
|
|
21
21
|
*
|
|
22
22
|
* For button click usage examples of buildForm(), see:
|
|
23
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
24
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
25
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
26
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
23
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx
|
|
24
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/BuildFormButtonForStorybook.tsx
|
|
25
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/PrePopWrapperForStorybook.tsx
|
|
26
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/PrePopButtonForStorybook.tsx
|
|
27
27
|
*
|
|
28
28
|
* @author Sean Fong
|
|
29
29
|
*/
|
|
@@ -35,10 +35,10 @@ import Typography from '@mui/material/Typography';
|
|
|
35
35
|
* - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities.
|
|
36
36
|
*
|
|
37
37
|
* For button click usage examples of buildForm(), see:
|
|
38
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
39
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
40
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
41
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
38
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx
|
|
39
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/BuildFormButtonForStorybook.tsx
|
|
40
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/PrePopWrapperForStorybook.tsx
|
|
41
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/PrePopButtonForStorybook.tsx
|
|
42
42
|
*
|
|
43
43
|
* @author Sean Fong
|
|
44
44
|
*/
|
package/lib/theme/Theme.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare module '@mui/material/styles' {
|
|
|
33
33
|
}
|
|
34
34
|
export declare const themeOptions: ThemeOptions;
|
|
35
35
|
/**
|
|
36
|
-
* Default
|
|
36
|
+
* Default theme used by the renderer using Material UI. You can customise your own theme by defining a new ThemeProvider.
|
|
37
37
|
* @see {@link https://mui.com/material-ui/customization/theming/}
|
|
38
38
|
*
|
|
39
39
|
* @author Sean Fong
|
package/lib/theme/Theme.js
CHANGED
|
@@ -27,7 +27,7 @@ export const themeOptions = {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
* Default
|
|
30
|
+
* Default theme used by the renderer using Material UI. You can customise your own theme by defining a new ThemeProvider.
|
|
31
31
|
* @see {@link https://mui.com/material-ui/customization/theming/}
|
|
32
32
|
*
|
|
33
33
|
* @author Sean Fong
|
|
@@ -37,8 +37,9 @@ export declare function initialiseFhirClient(fhirClient: Client): Promise<void>;
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function getResponse(): QuestionnaireResponse;
|
|
39
39
|
/**
|
|
40
|
-
* Remove all hidden answers from the filled QuestionnaireResponse.
|
|
40
|
+
* Remove all empty/hidden answers from the filled QuestionnaireResponse.
|
|
41
41
|
* This takes into account enableWhens, enableWhenExpressions, items without item.answer, empty item.answer arrays and empty strings.
|
|
42
|
+
* This does not remove items that are hidden by the http://hl7.org/fhir/StructureDefinition/questionnaire-hidden extension.
|
|
42
43
|
*
|
|
43
44
|
* @author Sean Fong
|
|
44
45
|
*/
|
package/lib/utils/manageForm.js
CHANGED
|
@@ -87,8 +87,9 @@ export function getResponse() {
|
|
|
87
87
|
return questionnaireResponseStore.getState().updatableResponse;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
* Remove all hidden answers from the filled QuestionnaireResponse.
|
|
90
|
+
* Remove all empty/hidden answers from the filled QuestionnaireResponse.
|
|
91
91
|
* This takes into account enableWhens, enableWhenExpressions, items without item.answer, empty item.answer arrays and empty strings.
|
|
92
|
+
* This does not remove items that are hidden by the http://hl7.org/fhir/StructureDefinition/questionnaire-hidden extension.
|
|
92
93
|
*
|
|
93
94
|
* @author Sean Fong
|
|
94
95
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manageForm.js","sourceRoot":"","sources":["../../src/utils/manageForm.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG1E;;;;;;;;;;;;GAYG;AACH,MAAM,UAAgB,SAAS,CAC7B,aAA4B,EAC5B,qBAA6C,EAC7C,QAAkB,EAClB,oBAA6B,EAC7B,mBAA4C;;QAE5C,IAAI,oBAAoB,EAAE;YACxB,sBAAsB,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;SAChE;aAAM;YACL,sBAAsB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CA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MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC;IACtE,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,QAAQ,EAAE,CAAC,qBAAqB,CAAC;IAElF,OAAO,kBAAkB,CAAC;QACxB,aAAa;QACb,qBAAqB;QACrB,qBAAqB;QACrB,eAAe;QACf,qBAAqB;KACtB,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -54,7 +54,7 @@ export interface SmartFormsRendererProps {
|
|
|
54
54
|
/**
|
|
55
55
|
* A self-initialising wrapper around the BaseRenderer rendering engine.
|
|
56
56
|
* Will be deprecated in version 1.0.0. For alternative usage, see:
|
|
57
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
57
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/InitialiseFormWrapperForStorybook.tsx#L40-L57
|
|
58
58
|
*
|
|
59
59
|
* @see SmartFormsRendererProps for props.
|
|
60
60
|
*
|
|
@@ -35,7 +35,7 @@ interface BuildFormButtonTesterWrapperForStorybookProps {
|
|
|
35
35
|
* It was done as a two-step process for demo purposes.
|
|
36
36
|
*
|
|
37
37
|
* Use this pattern if you already have a pre-populated/pre-filled/draft response.
|
|
38
|
-
* If you want to pre-pop on the fly, see https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
38
|
+
* If you want to pre-pop on the fly, see https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/PrePopWrapperForStorybook.tsx instead
|
|
39
39
|
*
|
|
40
40
|
* @author Sean Fong
|
|
41
41
|
*/
|
|
@@ -48,10 +48,10 @@ export interface InitialiseFormWrapperProps {
|
|
|
48
48
|
* - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities.
|
|
49
49
|
*
|
|
50
50
|
* For button click usage examples of buildForm(), see:
|
|
51
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
52
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
53
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
54
|
-
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
51
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx
|
|
52
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/BuildFormButtonForStorybook.tsx
|
|
53
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/PrePopWrapperForStorybook.tsx
|
|
54
|
+
* - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/PrePopButtonForStorybook.tsx
|
|
55
55
|
*
|
|
56
56
|
* @author Sean Fong
|
|
57
57
|
*/
|
|
@@ -41,7 +41,7 @@ interface PrePopWrapperForStorybookProps {
|
|
|
41
41
|
* This does in-app population and you have to define your own callback function to retrieve resources from your source server.
|
|
42
42
|
*
|
|
43
43
|
* Use this pattern if you do not have a pre-populated/pre-filled/draft response and want to pre-populate on the fly.
|
|
44
|
-
* If you already have a questionnaireResponse, see https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
44
|
+
* If you already have a questionnaireResponse, see https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/BuildFormButtonTesterWrapperForStorybook.tsx instead
|
|
45
45
|
*
|
|
46
46
|
* @author Sean Fong
|
|
47
47
|
*/
|
|
@@ -27,7 +27,7 @@ interface RequestConfig {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Sample callback function to fetch resources from your source server when using populate() or populateQuestionnaire() from @aehrc/sdc-populate.
|
|
30
|
-
* See https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/
|
|
30
|
+
* See https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/PrePopWrapperForStorybook.tsx for usage.
|
|
31
31
|
*
|
|
32
32
|
* @author Sean Fong
|
|
33
33
|
*/
|
package/src/theme/Theme.tsx
CHANGED
|
@@ -90,7 +90,7 @@ export const themeOptions: ThemeOptions = {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* Default
|
|
93
|
+
* Default theme used by the renderer using Material UI. You can customise your own theme by defining a new ThemeProvider.
|
|
94
94
|
* @see {@link https://mui.com/material-ui/customization/theming/}
|
|
95
95
|
*
|
|
96
96
|
* @author Sean Fong
|
package/src/utils/manageForm.ts
CHANGED
|
@@ -98,8 +98,9 @@ export function getResponse(): QuestionnaireResponse {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
* Remove all hidden answers from the filled QuestionnaireResponse.
|
|
101
|
+
* Remove all empty/hidden answers from the filled QuestionnaireResponse.
|
|
102
102
|
* This takes into account enableWhens, enableWhenExpressions, items without item.answer, empty item.answer arrays and empty strings.
|
|
103
|
+
* This does not remove items that are hidden by the http://hl7.org/fhir/StructureDefinition/questionnaire-hidden extension.
|
|
103
104
|
*
|
|
104
105
|
* @author Sean Fong
|
|
105
106
|
*/
|