Skip to content

Commit

Permalink
Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
holubv committed May 21, 2021
1 parent 5097b28 commit d9fdfd1
Show file tree
Hide file tree
Showing 4 changed files with 103,087 additions and 118 deletions.
13 changes: 13 additions & 0 deletions example/ExampleApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import "intelligent-tree-select/lib/styles.css"
const componentMapping = SmartComponents.getComponentMapping();

const exampleForm = require('./example_form.json');
const exampleFormTC = require('./example_turisticky_cil.json');

const modalProps = {
onHide: () => {
Expand Down Expand Up @@ -63,7 +64,19 @@ class ExampleApp extends React.Component {
isFormValid={(isFormValid) => this.setState({isFormValid})}
componentMapRules={componentMapping}
/>
<button
disabled={!this.state.isFormValid}
style={{width: '100px', margin: '8px 16px', position: 'relative', left: '50%'}}
onClick={() => {
this.setState((prevState) => (
{selectedForm: prevState.selectedForm === exampleFormTC ? exampleForm : exampleFormTC}
));
}}
>
Switch form
</button>
</div>

);
}
}
Expand Down
132 changes: 15 additions & 117 deletions example/example_form.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,53 +183,26 @@
}
]
},
{
"@id": "_:b0",
"accepts-answer-value": true,
"has-tested-question": "show-advanced-fields-4248"
},
{
"@id": "_:b1",
"accepts-non-empty-answer-value": true,
"has-tested-question": "test-2-8331"
},
{
"@id": "_:b2",
"accepts-answer-value": true,
"has-tested-question": "show-advanced-fields-4248"
},
{
"@id": "_:b3",
"accepts-non-empty-answer-value": true,
"has-tested-question": "test-3-8331"
},
{
"@id": "age-1063",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"has-datatype": "xsd:int",
"has-unit": "years",
"label": "Age"
"label": "Age",
"initial-input-length": 5
},
{
"@id": "cena-6557",
"@type": "doc:question",
"has-unit-of-measure-question": "mena-8088",
"has-layout-class": "text",
"has-datatype": "xsd:int",
"has-preceding-question": "age-1063",
"label": "cena",
"label": "Cena",
"description" : "Tohle je cena s měnou"
},
{
"@id": "first-name-6663",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"has-datatype": "foaf:givenName",
"requires-answer": true,
"label": "First name"
},
{
"@id": "first-name-9402",
"@type": "doc:question",
Expand All @@ -246,9 +219,6 @@
"has_related_question": [
"provozovatel-section-666",
"age-1063",
"first-name-6663",
"middle-name-4161",
"last-name-1495",
"cena-6557",
"mena-8088",
"parent-section-1590",
Expand All @@ -262,8 +232,7 @@
"has_related_question": [
"ps-type-1",
"ps-type-2",
"as-show-advanced-888",
"as-checkbox-452"
"ps-name-452"
],
"has-type-question": [
"ps-type-1",
Expand Down Expand Up @@ -305,30 +274,12 @@
"show-advanced-question": true
},
{
"@id": "as-checkbox-452",
"@id": "ps-name-452",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"label": "Jméno"
},
{
"@id": "checkbox-test-452",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "checkbox",
"has-preceding-question": "test-3-8331",
"label": "checkbox-test"
},
{
"@id": "last-name-1495",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"has-datatype": "foaf:familyName",
"has-preceding-question": "middle-name-4161",
"requires-answer": true,
"label": "Příjmení"
},
{
"@id": "last-name-6610",
"@type": "doc:question",
Expand All @@ -343,15 +294,7 @@
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"label": "mena"
},
{
"@id": "middle-name-4161",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"has-preceding-question": "first-name-6663",
"label": "Middle name"
"label": "Měna"
},
{
"@id": "parent-section-1590",
Expand All @@ -365,7 +308,7 @@
],
"has-layout-class": "section",
"has-preceding-question": "cena-6557",
"label": "Historické místo"
"label": "Vlastník"
},
{
"@id": "sectionfoo-1592",
Expand All @@ -376,8 +319,8 @@
"last-name-6610"
],
"has-layout-class": "name",
"--has-composite-pattern": "?1 ?2 ?3",
"--has-composite-variables": [
"has-composite-pattern": "?1 ?2 ?3",
"has-composite-variables": [
"title-7183",
"first-name-9402",
"last-name-6610"
Expand All @@ -388,69 +331,25 @@
"requires-answer": true,
"label": "Celé jméno"
},
{
"@id": "show-advanced-fields-4248",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "checkbox",
"show-advanced-question": true,
"label": "Show advanced questions"
},
{
"@id": "test-2-8331",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": [
"text",
"emphasise-on-relevant"
],
"has-preceding-question": "test-5278",
"is-relevant-if": [
"_:b0",
"_:b1"
],
"label": "test 2 advanced"
},
{
"@id": "test-3-8331",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": [
"text",
"advanced-question",
"emphasise-on-relevant"
],
"has-preceding-question": "test-2-8331",
"is-relevant-if": [
"_:b2",
"_:b3"
],
"label": "test 3 advanced"
},
{
"@id": "test-5278",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"has-preceding-question": "show-advanced-fields-4248",
"label": "test"
"label": "Identifikátor"
},
{
"@id": "test-field-3887",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"label": "Název"
"label": "Popis vlastníka"
},
{
"@id": "test-section-666",
"@type": "doc:question",
"has_related_question": [
"show-advanced-fields-4248",
"test-5278",
"test-2-8331",
"test-3-8331",
"checkbox-test-452"
"test-5278"
],
"has-layout-class": [
"answerable",
Expand All @@ -462,15 +361,14 @@
],
"description": "test",
"has-preceding-question": "parent-section-1590",
"label": "testSection"
"label": "Sekce s identifikátorem"
},
{
"@id": "title-7183",
"@type": "doc:question",
"has_related_question": [],
"has-layout-class": "text",
"label": "Titul",
"initial-input-length": 5
"label": "Titul"
}
]
}

0 comments on commit d9fdfd1

Please sign in to comment.