-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds minimum code to register and display the component in Web Forms
- Loading branch information
1 parent
29faa77
commit c7d6bdf
Showing
9 changed files
with
74 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?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>Rank</h:title><model odk:xforms-version="1.0.0"><itext><translation lang="English (en)"><text id="decision_making-0"><value>Health</value></text><text id="decision_making-1"><value>Family and Friends</value></text><text id="decision_making-2"><value>Career Growth and Learning Opportunities</value></text><text id="decision_making-3"><value>Financial Stability</value></text><text id="decision_making-4"><value>Pursuit of Hobbies and Passions</value></text><text id="decision_making-5"><value>Environmental Sustainability</value></text><text id="decision_making-6"><value>Time Management and Work-Life Balance</value></text><text id="decision_making-7"><value>Building a Supportive Community</value></text><text id="decision_making-8"><value>Personal Development and Mindfulness</value></text><text id="decision_making-9"><value>Creativity and Innovation</value></text><text id="/data/priorities:label"><value>What values guide your decision-making?</value></text></translation><translation lang="French (fr)"><text id="decision_making-0"><value>Santé</value></text><text id="decision_making-1"><value>Famille et amis</value></text><text id="decision_making-2"><value>Croissance professionnelle et opportunités d'apprentissage</value></text><text id="decision_making-3"><value>Stabilité financière</value></text><text id="decision_making-4"><value>Poursuite de loisirs et passions</value></text><text id="decision_making-5"><value>Durabilité environnementale</value></text><text id="decision_making-6"><value>Gestion du temps et équilibre vie professionnelle/vie personnelle</value></text><text id="decision_making-7"><value>Construire une communauté solidaire</value></text><text id="decision_making-8"><value>Développement personnel et pleine conscience</value></text><text id="decision_making-9"><value>Créativité et innovation</value></text><text id="/data/priorities:label"><value>Quelles valeurs guident votre prise de décision?</value></text></translation></itext><instance><data id="1_rank" version="2025011401"><priorities/><meta><instanceID/></meta></data></instance><instance id="decision_making"><root><item><itextId>decision_making-0</itextId><name>health</name></item><item><itextId>decision_making-1</itextId><name>family_and_friends</name></item><item><itextId>decision_making-2</itextId><name>career_growth_and_learning_opportunities</name></item><item><itextId>decision_making-3</itextId><name>financial_stability</name></item><item><itextId>decision_making-4</itextId><name>pursuit_of_hobbies_and_passions</name></item><item><itextId>decision_making-5</itextId><name>environmental_sustainability</name></item><item><itextId>decision_making-6</itextId><name>time_management_and_work_life_balance</name></item><item><itextId>decision_making-7</itextId><name>building_a_supportive_community</name></item><item><itextId>decision_making-8</itextId><name>personal_development_and_mindfulness</name></item><item><itextId>decision_making-9</itextId><name>creativity_and_innovation</name></item></root></instance><bind nodeset="/data/priorities" type="odk:rank"/><bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid"/></model></h:head><h:body><odk:rank ref="/data/priorities"><label ref="jr:itext('/data/priorities:label')"/><itemset nodeset="randomize(instance('decision_making')/root/item)"><value ref="name"/><label ref="jr:itext(itextId)"/></itemset></odk:rank></h:body></h:html> | ||
<?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>Rank</h:title><model odk:xforms-version="1.0.0"><itext><translation lang="English (en)"><text id="decision_making-0"><value>Health</value></text><text id="decision_making-1"><value>Family and Friends</value></text><text id="decision_making-2"><value>Career Growth and Learning Opportunities</value></text><text id="decision_making-3"><value>Financial Stability</value></text><text id="decision_making-4"><value>Pursuit of Hobbies and Passions</value></text><text id="decision_making-5"><value>Environmental Sustainability</value></text><text id="decision_making-6"><value>Time Management and Work-Life Balance</value></text><text id="decision_making-7"><value>Building a Supportive Community</value></text><text id="decision_making-8"><value>Personal Development and Mindfulness</value></text><text id="decision_making-9"><value>Creativity and Innovation</value></text><text id="/data/priorities:label"><value>What values guide your decision-making?</value></text></translation><translation lang="French (fr)"><text id="decision_making-0"><value>Santé</value></text><text id="decision_making-1"><value>Famille et amis</value></text><text id="decision_making-2"><value>Croissance professionnelle et opportunités d'apprentissage</value></text><text id="decision_making-3"><value>Stabilité financière</value></text><text id="decision_making-4"><value>Poursuite de loisirs et passions</value></text><text id="decision_making-5"><value>Durabilité environnementale</value></text><text id="decision_making-6"><value>Gestion du temps et équilibre vie professionnelle/vie personnelle</value></text><text id="decision_making-7"><value>Construire une communauté solidaire</value></text><text id="decision_making-8"><value>Développement personnel et pleine conscience</value></text><text id="decision_making-9"><value>Créativité et innovation</value></text><text id="/data/priorities:label"><value>Quelles valeurs guident votre prise de décision?</value></text></translation></itext><instance><data id="1_rank" version="2025011401"><priorities/><meta><instanceID/></meta></data></instance><instance id="decision_making"><root><item><itextId>decision_making-0</itextId><name>health</name></item><item><itextId>decision_making-1</itextId><name>family_and_friends</name></item><item><itextId>decision_making-2</itextId><name>career_growth_and_learning_opportunities</name></item><item><itextId>decision_making-3</itextId><name>financial_stability</name></item><item><itextId>decision_making-4</itextId><name>pursuit_of_hobbies_and_passions</name></item><item><itextId>decision_making-5</itextId><name>environmental_sustainability</name></item><item><itextId>decision_making-6</itextId><name>time_management_and_work_life_balance</name></item><item><itextId>decision_making-7</itextId><name>building_a_supportive_community</name></item><item><itextId>decision_making-8</itextId><name>personal_development_and_mindfulness</name></item><item><itextId>decision_making-9</itextId><name>creativity_and_innovation</name></item></root></instance><bind nodeset="/data/priorities" type="odk:rank"/><bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid"/></model></h:head><h:body><odk:rank ref="/data/priorities"><label ref="jr:itext('/data/priorities:label')"/><itemset nodeset="randomize(instance('decision_making')/root/item)"><value ref="name"/><label ref="jr:itext(itextId)"/></itemset></odk:rank></h:body></h:html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/web-forms/src/components/controls/RankControl.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script setup lang="ts"> | ||
import type { AnyRankNode } from '@getodk/xforms-engine'; | ||
import ControlText from '@/components/ControlText.vue'; | ||
interface RankControlProps { | ||
readonly question: AnyRankNode; | ||
} | ||
// ToDo: remove eslint-disable-next-line comment | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const props = defineProps<RankControlProps>(); | ||
</script> | ||
|
||
<template> | ||
<ControlText :question="question" /> | ||
<p>{{ "Hi rank!" }}</p> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { InputValue } from './InputNode.ts'; | ||
import type { ValueType } from './ValueType.ts'; | ||
import type { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts'; | ||
import { RankControlDefinition } from '../parse/body/control/RankControlDefinition.ts'; | ||
import type { BaseValueNode } from './BaseValueNode.ts'; | ||
|
||
export type RankItemValue<V extends ValueType> = NonNullable<RuntimeValue<V>>; | ||
|
||
export type RankValues<V extends ValueType> = ReadonlyArray<RankItemValue<V>>; | ||
|
||
export interface RankDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> { | ||
readonly bodyElement: RankControlDefinition; | ||
} | ||
|
||
export interface RankNode<V extends ValueType = ValueType> extends BaseValueNode<V, InputValue<V>> { | ||
readonly nodeType: 'rank'; | ||
} | ||
|
||
// prettier-ignore | ||
export type AnyRankNode = RankNode; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { ValueType } from '../client/ValueType.ts'; | ||
import { ValueNode } from './abstract/ValueNode.ts'; | ||
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts'; | ||
import type { ValidationContext } from './internal-api/ValidationContext.ts'; | ||
import type { | ||
ClientReactiveSubmittableValueNode, | ||
} from './internal-api/submission/ClientReactiveSubmittableValueNode.ts'; | ||
import type { | ||
RankDefinition, | ||
RankValues, | ||
RankNode, | ||
} from '../client/RankNode.ts'; | ||
|
||
export class RankControl<V extends ValueType = ValueType> | ||
extends ValueNode<V, RankDefinition<V>, RankValues<V>, RankValues<V>> | ||
implements | ||
RankNode<V>, | ||
XFormsXPathElement, | ||
EvaluationContext, | ||
ValidationContext, | ||
ClientReactiveSubmittableValueNode | ||
{ | ||
|
||
} | ||
|
||
export type AnyRankControl = RankControl<string>; |
9 changes: 0 additions & 9 deletions
9
packages/xforms-engine/src/instance/unsupported/RankControl.ts
This file was deleted.
Oops, something went wrong.