Skip to content

Commit d128322

Browse files
committed
feat: update fhirformjs to 0.6.0
1 parent 3b29766 commit d128322

File tree

5 files changed

+42
-14
lines changed

5 files changed

+42
-14
lines changed

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "firefox",
9+
"request": "launch",
10+
"reAttach": true,
11+
"firefoxExecutable": "D:\\ChocolateyInstalls\\firefox\\firefox.exe",
12+
"name": "Launch Firefox against localhost",
13+
"url": "http://localhost:3000",
14+
"webRoot": "${workspaceFolder}/src",
15+
"pathMappings": [
16+
{
17+
"url": "http://localhost:3000/scratch/beapen/fhir-questionnaire-render-react/src",
18+
"path": "${workspaceFolder}/src"
19+
}
20+
]
21+
}
22+
]
23+
}

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@
1111
"**/public/*/**": true,
1212
"**/.venv/**": true,
1313
"**/conda/**": true
14-
}
14+
},
15+
"cSpell.words": [
16+
"Fhir",
17+
"fhirformjs",
18+
"jsoneditor"
19+
]
1520
}

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React, { useState} from 'react';
22
import Form from "@rjsf/core";
33
// import axios from 'axios';
44
import { FhirJsonForm, FhirJsonResp } from 'fhirformjs'
5-
import { Testq1 } from './testq1';
5+
import { TestQuestionnaire1 } from './testQuestionnaire1';
66
import { JsonEditor as Editor } from 'jsoneditor-react';
77
import 'jsoneditor-react/es/editor.min.css';
88
import logo from './logo.svg';
99
import './App.css';
1010

1111
function App() {
12-
const [schema, setData] = useState(Testq1);
12+
const [schemaState, setData] = useState(TestQuestionnaire1);
1313

1414
// You may be fetching data from an endpoint as below
1515

@@ -34,7 +34,7 @@ function App() {
3434
let formData = {}
3535
let respData = {}
3636
function handleSubmit(data){
37-
respData = FhirJsonResp(JSON.parse(FhirJsonForm(schema)).model, data)
37+
respData = FhirJsonResp(FhirJsonForm(schemaState).model, data)
3838
console.log(respData)
3939
}
4040
function handleChange(data) {
@@ -44,14 +44,14 @@ function App() {
4444
<div className="App">
4545
<header className="App-header">
4646
<img src={logo} className="App-logo" alt="logo" />
47-
<Form schema={JSON.parse(FhirJsonForm(schema)).schema}
48-
uiSchema={JSON.parse(FhirJsonForm(schema)).uischema}
47+
<Form schema={FhirJsonForm(schemaState).schema}
48+
uiSchema={FhirJsonForm(schemaState).uiSchema}
4949
formData={formData}
5050
onSubmit={e => handleSubmit(e.formData)}
5151
/>
5252
<h2>Edit FHIR Questionnaire below (Change IDs if you duplicate an element)</h2>
5353
<Editor
54-
value={schema}
54+
value={schemaState}
5555
onChange={e => handleChange(e)}
5656
/>
5757
</header>

src/testq1.js renamed to src/testQuestionnaire1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const Testq1 = {
1+
export const TestQuestionnaire1 = {
22
resourceType: 'Questionnaire',
33
id: 'f201',
44
text: {

0 commit comments

Comments
 (0)