@aehrc/smart-forms-renderer 0.6.3 → 0.6.5
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 +49 -4
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/src/hooks/index.ts +0 -1
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@ This React-based package acts as the rendering engine for the [Smart Forms app](
|
|
|
6
6
|
npm install @aehrc/smart-forms-renderer
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
## Usage
|
|
9
|
+
## Basic Usage
|
|
10
10
|
|
|
11
|
-
```
|
|
11
|
+
```typescript jsx
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { SmartFormsRenderer, getResponse } from 'aehrc/smart-forms-renderer';
|
|
14
14
|
|
|
@@ -43,7 +43,7 @@ The below props are not supported at the moment, but will be in the future.
|
|
|
43
43
|
| fhirClient | [Client](https://github.com/smart-on-fhir/client-js) | FhirClient to perform further FHIR calls |
|
|
44
44
|
| terminologyServerUrl | string | Terminology server url to fetch terminology |
|
|
45
45
|
|
|
46
|
-
###
|
|
46
|
+
### Functions
|
|
47
47
|
|
|
48
48
|
```javascript
|
|
49
49
|
/**
|
|
@@ -56,4 +56,49 @@ function getResponse() {}
|
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## Advanced Usage (If basic usage does not suffice)
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
/* Components */
|
|
63
|
+
// A self-initialising wrapper around the rendering engine. This is sufficient for most use cases.
|
|
64
|
+
|
|
65
|
+
function SmartFormsRenderer(props: {
|
|
66
|
+
questionnaire: Questionnaire,
|
|
67
|
+
questionnaireResponse?: QuestionnaireResponse,
|
|
68
|
+
additionalVariables?: Record<string, Extension>
|
|
69
|
+
}): JSX.Element {}
|
|
70
|
+
|
|
71
|
+
// BaseRenderer underneath the SmartFormsRenderer wrapper. Requires buildForm() to initialise form.
|
|
72
|
+
function BaseRenderer(): JSX.Element {}
|
|
73
|
+
|
|
74
|
+
/* Functions */
|
|
75
|
+
// Get the filled QuestionnaireResponse at its current state.
|
|
76
|
+
// If no changes have been made to the form, the initial QuestionnaireResponse is returned.
|
|
77
|
+
function getResponse(): QuestionnaireResponse {}
|
|
78
|
+
|
|
79
|
+
// Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
|
|
80
|
+
// If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
|
|
81
|
+
async function buildForm(
|
|
82
|
+
questionnaire: Questionnaire,
|
|
83
|
+
questionnaireResponse?: QuestionnaireResponse
|
|
84
|
+
): Promise<void> {}
|
|
85
|
+
|
|
86
|
+
// Destroy the form to clean up the questionnaire and questionnaireResponse stores.
|
|
87
|
+
function destroyForm(): void {}
|
|
88
|
+
|
|
89
|
+
// Remove all hidden answers from the filled QuestionnaireResponse.
|
|
90
|
+
// This takes into account the questionnaire-hidden extension, enableWhens and enableWhenExpressions.
|
|
91
|
+
function removeHiddenAnswersFromResponse(
|
|
92
|
+
questionnaire: Questionnaire,
|
|
93
|
+
questionnaireResponse: QuestionnaireResponse
|
|
94
|
+
): QuestionnaireResponse {}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The Smart Forms app uses a even finer-grained control which directly interacts with the state management stores.
|
|
98
|
+
|
|
99
|
+
At the moment there are no plans to document it, but I am happy to do so if there is demand for it.
|
|
100
|
+
Raise a request in https://github.com/aehrc/smart-forms/issues if you want to see it happen!
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
Copyright © 2022, Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230. All rights reserved.
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -12,7 +12,6 @@ import { createQuestionnaireResponse } from './utils/qrItem';
|
|
|
12
12
|
import useQuestionnaireResponseStore from './stores/useQuestionnaireResponseStore';
|
|
13
13
|
import { removeHiddenAnswers } from './utils/removeHidden';
|
|
14
14
|
export * from './components';
|
|
15
|
-
export * from './hooks';
|
|
16
15
|
export * from './stores';
|
|
17
16
|
/**
|
|
18
17
|
* Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,qBAAqB,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,6BAA6B,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,qBAAqB,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,6BAA6B,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,UAAgB,SAAS,CAC7B,aAA4B,EAC5B,qBAA6C;;QAE7C,MAAM,qBAAqB,CAAC,QAAQ,EAAE,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAE/E,IAAI,CAAC,qBAAqB,EAAE;YAC1B,6BAA6B;iBAC1B,QAAQ,EAAE;iBACV,mBAAmB,CAAC,2BAA2B,CAAC,aAAa,CAAC,CAAC,CAAC;YACnE,OAAO;SACR;QAED,6BAA6B,CAAC,QAAQ,EAAE,CAAC,mBAAmB,C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