Skip to content

Commit

Permalink
Merge pull request #69 from getodk/features/34_vue_components
Browse files Browse the repository at this point in the history
Vue client of @odk-web-forms/xforms-engine to render Groups, Repeats and Text questions
  • Loading branch information
sadiqkhoja authored Apr 23, 2024
2 parents 30ea4b9 + 959419b commit cf2c5c0
Show file tree
Hide file tree
Showing 51 changed files with 2,342 additions and 97 deletions.
10 changes: 6 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
"editor.formatOnSave": true
},
"[vue]": {
// Vue files are ignored in Prettier. Some formatting **will** be applied
// on save by ESLint (via `editor.codeActionsOnSave` settings above)
"editor.formatOnSave": false
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true
},
// This corresponds to the `lib` we're using everywhere. Setting it here
// helps to address editor-only type errors in tooling files, where VSCode
// doesn't pick up the top-level `tsconfig.tools.json`.
"js/ts.implicitProjectConfig.target": "ES2022"
"js/ts.implicitProjectConfig.target": "ES2022",
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
}
}
6 changes: 6 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ export default tseslint.config(

// Consistent with all other source code
'vue/html-indent': ['error', 'tab'],
// should be based on the printWidth
'vue/max-attributes-per-line': 'off',
'vue/no-undef-components': 'error',
'vue/html-comment-indent': ['error', 'tab'],
'vue/script-indent': ['error', 'tab'],
'vue/no-empty-component-block': 'error',
},
},

Expand Down
138 changes: 138 additions & 0 deletions packages/ui-solid/fixtures/xforms/repeats/08-complex-repeats.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms"
xmlns:odk="http://www.opendatakit.org/xforms">
<h:head>
<h:title>Groups and Repeats</h:title>
<model odk:xforms-version="1.0.0">
<instance>
<data id="groups_and_repeats" version="20240326122412">
<simple_text />
<group_without_label>
<first_name />
</group_without_label>
<repeat_without_anything_count />
<repeat_without_anything jr:template="">
<last_name />
</repeat_without_anything>
<repeat_without_anything>
<last_name />
</repeat_without_anything>
<repeat_with_label jr:template="">
<middle_name />
</repeat_with_label>
<repeat_with_label>
<middle_name />
</repeat_with_label>
<repeat_with_label>
<middle_name />
</repeat_with_label>
<nested_group_without_label_1>
<nested_group_without_label_1_1>
<a_name />
</nested_group_without_label_1_1>
</nested_group_without_label_1>
<repeat_with_child_group_1 jr:template="">
<repeat_with_child_group_1_1>
<b_name />
</repeat_with_child_group_1_1>
</repeat_with_child_group_1>
<repeat_with_child_group_1>
<repeat_with_child_group_1_1>
<b_name />
</repeat_with_child_group_1_1>
</repeat_with_child_group_1>
<repeat_without_parent_group>
<c_name />
</repeat_without_parent_group>
<nested_group_1>
<child_group_1_1>
<d_name />
</child_group_1_1>
</nested_group_1>
<meta>
<instanceID />
</meta>
</data>
</instance>
<bind nodeset="/data/simple_text" type="string" />
<bind nodeset="/data/group_without_label/first_name" type="string" />
<bind nodeset="/data/repeat_without_anything_count" type="string" readonly="true()"
calculate="3" />
<bind nodeset="/data/repeat_without_anything/last_name" type="string" />
<bind nodeset="/data/repeat_with_label/middle_name" type="string" />
<bind nodeset="/data/nested_group_without_label_1/nested_group_without_label_1_1/a_name"
type="string" />
<bind nodeset="/data/repeat_with_child_group_1/repeat_with_child_group_1_1/b_name"
type="string" />
<bind nodeset="/data/repeat_without_parent_group/c_name" type="string" />
<bind nodeset="/data/nested_group_1/child_group_1_1/d_name" type="string" />
<bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid" />
</model>
</h:head>
<h:body>
<input ref="/data/simple_text">
<label>Simple textbox</label>
</input>
<group ref="/data/group_without_label">
<input ref="/data/group_without_label/first_name">
<label>First Name</label>
</input>
</group>
<group ref="/data/repeat_without_anything">
<label></label>
<repeat nodeset="/data/repeat_without_anything"
jr:count=" /data/repeat_without_anything_count ">
<input ref="/data/repeat_without_anything/last_name">
<label>Last Name</label>
</input>
</repeat>
</group>
<group ref="/data/repeat_with_label">
<label>Repeat with label</label>
<repeat nodeset="/data/repeat_with_label">
<input ref="/data/repeat_with_label/middle_name">
<label>Middle Name</label>
</input>
</repeat>
</group>
<group ref="/data/nested_group_without_label_1">
<group ref="/data/nested_group_without_label_1/nested_group_without_label_1_1">
<input
ref="/data/nested_group_without_label_1/nested_group_without_label_1_1/a_name">
<label>A name (I have two group ancestors without labels)</label>
</input>
</group>
</group>
<group ref="/data/repeat_with_child_group_1">
<label>Repeat label</label>
<repeat nodeset="/data/repeat_with_child_group_1">
<group ref="/data/repeat_with_child_group_1/repeat_with_child_group_1_1">
<label>
<output
value=" /data/repeat_with_child_group_1/repeat_with_child_group_1_1/b_name " />
</label>
<input ref="/data/repeat_with_child_group_1/repeat_with_child_group_1_1/b_name">
<label>B Name</label>
</input>
</group>
</repeat>
</group>
<repeat nodeset="/data/repeat_without_parent_group">
<input ref="/data/repeat_without_parent_group/c_name">
<label>C Name</label>
</input>
</repeat>

<group ref="/data/nested_group_1">
<label>Top group label</label>
<group ref="/data/nested_group_1/child_group_1_1">
<label>child group label</label>
<input ref="/data/nested_group_1/child_group_1_1/d_name">
<label>D Name</label>
</input>
</group>
</group>
</h:body>
</h:html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms"
xmlns:odk="http://www.opendatakit.org/xforms">
<h:head>
<h:title>Groups and Repeats</h:title>
<model odk:xforms-version="1.0.0">
<instance>
<data id="groups_and_repeats" version="20240328181053">
<repeat_with_child_group_1 jr:template="">
<repeat_with_child_group_1_1>
<b_name />
</repeat_with_child_group_1_1>
</repeat_with_child_group_1>
<repeat_with_child_group_1>
<repeat_with_child_group_1_1>
<b_name />
</repeat_with_child_group_1_1>
</repeat_with_child_group_1>
<meta>
<instanceID />
</meta>
</data>
</instance>
<bind nodeset="/data/repeat_with_child_group_1/repeat_with_child_group_1_1/b_name"
type="string" />
<bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid" />
</model>
</h:head>
<h:body>
<group ref="/data/repeat_with_child_group_1">
<label>Repeat label</label>
<repeat nodeset="/data/repeat_with_child_group_1">
<group ref="/data/repeat_with_child_group_1/repeat_with_child_group_1_1">
<label>
<output value=" ../repeat_with_child_group_1_1/b_name " />
</label>
<input ref="/data/repeat_with_child_group_1/repeat_with_child_group_1_1/b_name">
<label>B Name</label>
</input>
</group>
</repeat>
</group>
</h:body>
</h:html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms"
xmlns:odk="http://www.opendatakit.org/xforms">
<h:head>
<h:title>Groups and Repeats</h:title>
<model odk:xforms-version="1.0.0">
<instance>
<data id="groups_and_repeats" version="20240328181053">
<repeat_with_child_group_1 jr:template="">
<repeat_with_child_group_1_1>
<b_name />
</repeat_with_child_group_1_1>
<c_name />
</repeat_with_child_group_1>
<repeat_with_child_group_1>
<repeat_with_child_group_1_1>
<b_name />
</repeat_with_child_group_1_1>
<c_name />
</repeat_with_child_group_1>
<meta>
<instanceID />
</meta>
</data>
</instance>
<bind nodeset="/data/repeat_with_child_group_1/repeat_with_child_group_1_1/b_name"
type="string" />
<bind nodeset="/data/repeat_with_child_group_1/c_name"
type="string" />
<bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid" />
</model>
</h:head>
<h:body>
<group ref="/data/repeat_with_child_group_1">
<label>Repeat label</label>
<repeat nodeset="/data/repeat_with_child_group_1">
<group ref="/data/repeat_with_child_group_1/repeat_with_child_group_1_1">
<label>
<output value=" ../repeat_with_child_group_1_1/b_name " />
</label>
<input ref="/data/repeat_with_child_group_1/repeat_with_child_group_1_1/b_name">
<label>B Name</label>
</input>
</group>
<input ref="/data/repeat_with_child_group_1/c_name">
<label>C Name</label>
</input>
</repeat>
</group>
</h:body>
</h:html>
33 changes: 33 additions & 0 deletions packages/ui-solid/fixtures/xforms/repeats/11-dynamic_label.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms"
xmlns:odk="http://www.opendatakit.org/xforms">
<h:head>
<h:title>dynamic_label</h:title>
<model odk:xforms-version="1.0.0">
<instance>
<data id="dynamic_label" version="20240404140744">
<the_group>
<first_name />
</the_group>
<meta>
<instanceID />
</meta>
</data>
</instance>
<bind nodeset="/data/the_group/first_name" type="string" />
<bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid" />
</model>
</h:head>
<h:body>
<group ref="/data/the_group">
<label>
<output value=" /data/the_group/first_name " />
</label>
<input ref="/data/the_group/first_name">
<label>First Name</label>
</input>
</group>
</h:body>
</h:html>
57 changes: 57 additions & 0 deletions packages/ui-solid/fixtures/xforms/repeats/12-NestedRepeat.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms"
xmlns:odk="http://www.opendatakit.org/xforms">
<h:head>
<h:title>NestedRepeat</h:title>
<model odk:xforms-version="1.0.0">
<instance>
<data id="NestedRepeat" version="20240415142016">
<person_repeat jr:template="">
<person_name />
<language_repeat jr:template="">
<language />
</language_repeat>
<country />
</person_repeat>
<person_repeat>
<person_name />
<language_repeat>
<language />
</language_repeat>
<country />
</person_repeat>
<meta>
<instanceID />
</meta>
</data>
</instance>
<bind nodeset="/data/person_repeat/person_name" type="string" />
<bind nodeset="/data/person_repeat/language_repeat/language" type="string" />
<bind nodeset="/data/person_repeat/country" type="string" />
<bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid" />
</model>
</h:head>
<h:body>
<group ref="/data/person_repeat">
<label>Persons</label>
<repeat nodeset="/data/person_repeat">
<input ref="/data/person_repeat/person_name">
<label>Person Name</label>
</input>
<group ref="/data/person_repeat/language_repeat">
<label>Languages</label>
<repeat nodeset="/data/person_repeat/language_repeat">
<input ref="/data/person_repeat/language_repeat/language">
<label>Language</label>
</input>
</repeat>
</group>
<input ref="/data/person_repeat/country">
<label>Country</label>
</input>
</repeat>
</group>
</h:body>
</h:html>
Loading

0 comments on commit cf2c5c0

Please sign in to comment.