Skip to content

Commit

Permalink
Merge pull request #791 from aehrc/issue/692
Browse files Browse the repository at this point in the history
Issue/692
  • Loading branch information
fongsean authored May 16, 2024
2 parents 2d561ad + 28b4763 commit ea5d8bf
Show file tree
Hide file tree
Showing 35 changed files with 1,161 additions and 451 deletions.
2 changes: 1 addition & 1 deletion apps/smart-forms-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dependencies": {
"@aehrc/sdc-assemble": "^1.2.0",
"@aehrc/sdc-populate": "^1.8.0",
"@aehrc/smart-forms-renderer": "^0.27.4",
"@aehrc/smart-forms-renderer": "^0.28.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@fontsource/material-icons": "^5.0.16",
Expand Down
40 changes: 0 additions & 40 deletions apps/smart-forms-app/src/features/renderer/types/choice.enum.ts

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions apps/smart-forms-app/src/features/renderer/types/regex.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions apps/smart-forms-app/src/features/renderer/types/tab.interface.ts

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion documentation/docs/components/open-choice.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ If there are any advanced usage scenarios you'd like to see, feel free to [let u
| enableWhenExpression | http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression |
| openLabel | http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-openLabel<br/>- OpenLabel is only supported on [itemControl](https://hl7.org/fhir/extensions/CodeSystem-questionnaire-item-control.html) "radio-button" and "check-box" extensions |
| hidden | http://hl7.org/fhir/StructureDefinition/questionnaire-hidden |
| itemControl | http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl<br/>Supports:<br/>- autocomplete<br/>- drop-down<br/>- check-box<br/>- radio-button |
| itemControl | http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl<br/>Supports:<br/>- autocomplete<br/>- check-box<br/>- radio-button |
| choiceOrientation | http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation<br/>- ChoiceOrientation is only supported on [itemControl](https://hl7.org/fhir/extensions/CodeSystem-questionnaire-item-control.html) "radio-button" and "check-box" extensions |
| required | item.required |
| repeats | item.repeats |
Expand Down
13 changes: 0 additions & 13 deletions documentation/docs/sdc/advanced/common.mdx

This file was deleted.

145 changes: 145 additions & 0 deletions documentation/docs/sdc/advanced/constraint.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
sidebar_position: 5
---

import IframeContainer from '../../../src/react/IframeContainer';

# Value Constraints

This subsection consists of extensions related to value constraints and form validation.

The elements/extensions that fall under this subsection are:

**From Core Questionnaire**

- [required](https://www.hl7.org/fhir/r4/questionnaire-definitions.html#Questionnaire.item.required)

**From SDC**

- [maxLength](http://hl7.org/fhir/uv/sdc/behavior.html#maxLength)
- [minLength](http://hl7.org/fhir/uv/sdc/behavior.html#minLength)
- [regex](http://hl7.org/fhir/uv/sdc/behavior.html#regex)
- [minValue](http://hl7.org/fhir/uv/sdc/behavior.html#minValue)
- [maxValue](http://hl7.org/fhir/uv/sdc/behavior.html#maxValue)
- [maxDecimalPlaces](http://hl7.org/fhir/uv/sdc/behavior.html#maxDecimalPlaces)

[//]: # 'FIXME dev docs reference'

:::tip
Elements/extensions in this subsection invokes form validation in the renderer. OperationOutcome resources are generated when the current state of the form does not meet the constraints defined in the Questionnaire.

For more information, refer to developer usage.

:::

### Required

An indication, if true, that the item must be present in a "completed" QuestionnaireResponse. If false, the item may be skipped when answering the questionnaire.

Also appears in the [Fundamental Elements](/smart-forms/docs/sdc/advanced/fundamental) subsection.

#### Basic Usage

<IframeContainer storyUrl="https://smartforms.csiro.au/storybook/index.html?path=/story/component-sdc-8-1-4-advanced-other--required">
<iframe
src="https://smartforms.csiro.au/storybook/iframe.html?args=&id=component-sdc-8-1-4-advanced-other--required"
width="100%"
height="100"
/>
</IframeContainer>

### MaxLength

The maximum length of the string value of the answer to this question.

MaxLength is only supported on **decimal**, **integer**, **string** and **text** "text-field"-based items.

#### Basic Usage

<IframeContainer storyUrl="https://smartforms.csiro.au/storybook/index.html?path=/story/component-sdc-9-1-1-form-behavior-value-constraints--max-length">
<iframe
src="https://smartforms.csiro.au/storybook/iframe.html?args=&id=component-sdc-9-1-1-form-behavior-value-constraints--max-length"
width="100%"
height="240"
/>
</IframeContainer>

### MinLength

The minimum length of the string value of the answer to this question.

MinLength is only supported on **decimal**, **integer**, **string** and **text** "text-field"-based items.

#### Basic Usage

<IframeContainer storyUrl="https://smartforms.csiro.au/storybook/index.html?path=/story/component-sdc-9-1-1-form-behavior-value-constraints--min-length">
<iframe
src="https://smartforms.csiro.au/storybook/iframe.html?args=&id=component-sdc-9-1-1-form-behavior-value-constraints--min-length"
width="100%"
height="240"
/>
</IframeContainer>

### Regex

A [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) constraint for the string value of the answer to this question.

Regex is only supported on **decimal**, **integer**, **string** and **text** "text-field"-based items.

#### Basic Usage

<IframeContainer storyUrl="https://smartforms.csiro.au/storybook/index.html?path=/story/component-sdc-9-1-1-form-behavior-value-constraints--regex">
<iframe
src="https://smartforms.csiro.au/storybook/iframe.html?args=&id=component-sdc-9-1-1-form-behavior-value-constraints--regex"
width="100%"
height="240"
/>
</IframeContainer>

### MinValue

The minimum value of the quantifiable answer to this question.

MinValue is only supported on **decimal**, **integer**, **string** and **text** "text-field"-based items.

#### Basic Usage

<IframeContainer storyUrl="https://smartforms.csiro.au/storybook/index.html?path=/story/component-sdc-9-1-1-form-behavior-value-constraints--min-value">
<iframe
src="https://smartforms.csiro.au/storybook/iframe.html?args=&id=component-sdc-9-1-1-form-behavior-value-constraints--min-value"
width="100%"
height="240"
/>
</IframeContainer>

### MaxValue

The maximum value of the quantifiable answer to this question.

MaxValue is only supported on **decimal**, **integer**, **string** and **text** "text-field"-based items.

#### Basic Usage

<IframeContainer storyUrl="https://smartforms.csiro.au/storybook/index.html?path=/story/component-sdc-9-1-1-form-behavior-value-constraints--max-value">
<iframe
src="https://smartforms.csiro.au/storybook/iframe.html?args=&id=component-sdc-9-1-1-form-behavior-value-constraints--max-value"
width="100%"
height="240"
/>
</IframeContainer>

### MaxDecimalPlaces

The maximum number of decimal places allowed in the numeric answer to this question.

MaxDecimalPlaces is only supported on **decimal** items.

#### Basic Usage

<IframeContainer storyUrl="https://smartforms.csiro.au/storybook/index.html?path=/story/component-sdc-9-1-1-form-behavior-value-constraints--max-decimal-places">
<iframe
src="https://smartforms.csiro.au/storybook/iframe.html?args=&id=component-sdc-9-1-1-form-behavior-value-constraints--max-decimal-places"
width="100%"
height="240"
/>
</IframeContainer>
Loading

0 comments on commit ea5d8bf

Please sign in to comment.