Skip to content

Commit

Permalink
Update documentation and add renderer theme provider to live editor
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed Sep 25, 2024
1 parent 5078af4 commit 2d6a2ce
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 106 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Function: removeInternalIdsFromResponse()

> **removeInternalIdsFromResponse**(`questionnaire`, `questionnaireResponse`): `QuestionnaireResponse`
Remove all instances of item.answer.id from the filled QuestionnaireResponse.
These IDs are used internally for rendering repeating items, and can be safely left out of the final response.

## Parameters

| Parameter | Type |
| :------ | :------ |
| `questionnaire` | `Questionnaire` |
| `questionnaireResponse` | `QuestionnaireResponse` |

## Returns

`QuestionnaireResponse`
1 change: 1 addition & 0 deletions documentation/docs/api/smart-forms-renderer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
| [isSpecificItemControl](functions/isSpecificItemControl.md) | Check if the extension has an itemControl code equal to the given itemControlCode |
| [parseFhirDateToDisplayDate](functions/parseFhirDateToDisplayDate.md) | Parse a FHIR date string to a date to be consumed and displayed by the DateItem component. |
| [removeEmptyAnswersFromResponse](functions/removeEmptyAnswersFromResponse.md) | Remove all empty/hidden answers from the filled QuestionnaireResponse. |
| [removeInternalIdsFromResponse](functions/removeInternalIdsFromResponse.md) | Remove all instances of item.answer.id from the filled QuestionnaireResponse. |
| [repopulateResponse](functions/repopulateResponse.md) | Re-populate checked items in the re-population dialog into the current QuestionnaireResponse |
| [useBuildForm](functions/useBuildForm.md) | React hook wrapping around the buildForm() function to build a form from a questionnaire and an optional QuestionnaireResponse. |
| [useHidden](functions/useHidden.md) | React hook to determine if a QuestionnaireItem is hidden via item.hidden, enableWhens, enableWhenExpressions. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ Key-value pair of invalid items based on defined value constraints in the questi

***

### key

> **key**: `string`
The React key of the questionnaireResponse, used internally for refreshing the BaseRenderer

***

### responseIsValid

> **responseIsValid**: `boolean`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ const typedocSidebar = { items: [
"id": "api/smart-forms-renderer/functions/removeEmptyAnswersFromResponse",
"label": "removeEmptyAnswersFromResponse"
},
{
"type": "doc",
"id": "api/smart-forms-renderer/functions/removeInternalIdsFromResponse",
"label": "removeInternalIdsFromResponse"
},
{
"type": "doc",
"id": "api/smart-forms-renderer/functions/repopulateResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ This is the React version of the store which can be used as React hooks in React

`Record`\<`string`, `OperationOutcome`\>

### use.key()

> **key**: () => `string`
#### Returns

`string`

### use.responseIsValid()

> **responseIsValid**: () => `boolean`
Expand Down
11 changes: 8 additions & 3 deletions documentation/src/theme/ReactLiveScope/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import {
BaseRenderer,
getResponse,
RendererThemeProvider,
useBuildForm,
useQuestionnaireResponseStore,
useQuestionnaireStore,
Expand Down Expand Up @@ -33,9 +34,13 @@ function YourBaseRendererWrapper(props: {
}

return (
<QueryClientProvider client={queryClient}>
<BaseRenderer />
</QueryClientProvider>
<RendererThemeProvider>
<QueryClientProvider client={queryClient}>
<div style={{ padding: '0 12px' }}>
<BaseRenderer />
</div>
</QueryClientProvider>
</RendererThemeProvider>
);
}

Expand Down
105 changes: 2 additions & 103 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d6a2ce

Please sign in to comment.