@getodk/xforms-engine 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/BaseNode.d.ts +1 -2
- package/dist/client/EngineConfig.d.ts +0 -1
- package/dist/client/GroupNode.d.ts +2 -3
- package/dist/client/ModelValueNode.d.ts +1 -2
- package/dist/client/NodeAppearances.d.ts +1 -2
- package/dist/client/NoteNode.d.ts +2 -3
- package/dist/client/RootNode.d.ts +2 -3
- package/dist/client/SelectNode.d.ts +2 -3
- package/dist/client/StringNode.d.ts +2 -3
- package/dist/client/SubtreeNode.d.ts +1 -2
- package/dist/client/TextRange.d.ts +3 -4
- package/dist/client/TriggerNode.d.ts +25 -0
- package/dist/client/constants.d.ts +0 -1
- package/dist/client/hierarchy.d.ts +7 -3
- package/dist/client/index.d.ts +0 -1
- package/dist/client/node-types.d.ts +2 -1
- package/dist/client/repeat/BaseRepeatRangeNode.d.ts +1 -2
- package/dist/client/repeat/RepeatInstanceNode.d.ts +2 -3
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +1 -2
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +1 -2
- package/dist/client/unsupported/RangeNode.d.ts +9 -0
- package/dist/client/unsupported/RankNode.d.ts +9 -0
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +32 -0
- package/dist/client/unsupported/UploadNode.d.ts +9 -0
- package/dist/client/validation.d.ts +0 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +39029 -37441
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +0 -1
- package/dist/instance/ModelValue.d.ts +1 -2
- package/dist/instance/Note.d.ts +1 -2
- package/dist/instance/Root.d.ts +3 -4
- package/dist/instance/SelectField.d.ts +3 -4
- package/dist/instance/StringField.d.ts +2 -3
- package/dist/instance/Subtree.d.ts +0 -1
- package/dist/instance/TriggerControl.d.ts +40 -0
- package/dist/instance/abstract/DescendantNode.d.ts +4 -5
- package/dist/instance/abstract/InstanceNode.d.ts +1 -2
- package/dist/instance/abstract/UnsupportedControl.d.ts +46 -0
- package/dist/instance/children.d.ts +0 -1
- package/dist/instance/hierarchy.d.ts +9 -5
- package/dist/instance/index.d.ts +0 -1
- package/dist/instance/internal-api/EvaluationContext.d.ts +0 -1
- package/dist/instance/internal-api/InstanceConfig.d.ts +0 -1
- package/dist/instance/internal-api/SubscribableDependency.d.ts +0 -1
- package/dist/instance/internal-api/TranslationContext.d.ts +0 -1
- package/dist/instance/internal-api/ValidationContext.d.ts +11 -4
- package/dist/instance/internal-api/ValueContext.d.ts +3 -4
- package/dist/instance/repeat/BaseRepeatRange.d.ts +1 -2
- package/dist/instance/repeat/RepeatInstance.d.ts +0 -1
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +1 -2
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +1 -2
- package/dist/instance/resource.d.ts +0 -1
- package/dist/instance/text/TextChunk.d.ts +0 -1
- package/dist/instance/text/TextRange.d.ts +0 -1
- package/dist/instance/unsupported/RangeControl.d.ts +4 -0
- package/dist/instance/unsupported/RankControl.d.ts +4 -0
- package/dist/instance/unsupported/UploadControl.d.ts +4 -0
- package/dist/lib/TokenListParser.d.ts +3 -3
- package/dist/lib/dom/query.d.ts +1 -2
- package/dist/lib/reactivity/createChildrenState.d.ts +0 -1
- package/dist/lib/reactivity/createComputedExpression.d.ts +1 -2
- package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +2 -3
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -1
- package/dist/lib/reactivity/createValueState.d.ts +0 -1
- package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createClientState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createCurrentState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createEngineState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedPropertyDescriptor.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/representations.d.ts +0 -1
- package/dist/lib/reactivity/scope.d.ts +0 -1
- package/dist/lib/reactivity/text/createFieldHint.d.ts +1 -2
- package/dist/lib/reactivity/text/createNodeLabel.d.ts +1 -2
- package/dist/lib/reactivity/text/createNoteText.d.ts +1 -2
- package/dist/lib/reactivity/text/createTextRange.d.ts +0 -1
- package/dist/lib/reactivity/types.d.ts +0 -1
- package/dist/lib/reactivity/validation/createAggregatedViolations.d.ts +0 -1
- package/dist/lib/reactivity/validation/createValidation.d.ts +0 -1
- package/dist/{XFormDOM.d.ts → parse/XFormDOM.d.ts} +1 -2
- package/dist/{XFormDataType.d.ts → parse/XFormDataType.d.ts} +2 -4
- package/dist/{XFormDefinition.d.ts → parse/XFormDefinition.d.ts} +2 -3
- package/dist/{body → parse/body}/BodyDefinition.d.ts +15 -10
- package/dist/{body → parse/body}/BodyElementDefinition.d.ts +7 -7
- package/dist/{body → parse/body}/RepeatElementDefinition.d.ts +3 -4
- package/dist/{body → parse/body}/UnsupportedBodyElementDefinition.d.ts +0 -1
- package/dist/{body → parse/body}/appearance/inputAppearanceParser.d.ts +1 -2
- package/dist/{body → parse/body}/appearance/selectAppearanceParser.d.ts +1 -2
- package/dist/{body → parse/body}/appearance/structureElementAppearanceParser.d.ts +1 -2
- package/dist/parse/body/appearance/unknownAppearanceParser.d.ts +3 -0
- package/dist/{body → parse/body}/control/ControlDefinition.d.ts +3 -4
- package/dist/{body → parse/body}/control/InputDefinition.d.ts +1 -2
- package/dist/parse/body/control/RangeControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/RankControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/TriggerControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/UploadControlDefinition.d.ts +11 -0
- package/dist/{body → parse/body}/control/select/ItemDefinition.d.ts +2 -3
- package/dist/{body → parse/body}/control/select/ItemsetDefinition.d.ts +4 -5
- package/dist/{body → parse/body}/control/select/ItemsetNodesetContext.d.ts +2 -3
- package/dist/{body → parse/body}/control/select/SelectDefinition.d.ts +3 -12
- package/dist/{body → parse/body}/group/BaseGroupDefinition.d.ts +3 -5
- package/dist/{body → parse/body}/group/LogicalGroupDefinition.d.ts +0 -1
- package/dist/{body → parse/body}/group/PresentationGroupDefinition.d.ts +1 -2
- package/dist/{body → parse/body}/group/StructuralGroupDefinition.d.ts +0 -1
- package/dist/{model/BindComputation.d.ts → parse/expression/BindComputationExpression.d.ts} +5 -6
- package/dist/{body/control/select → parse/expression}/ItemsetNodesetExpression.d.ts +2 -3
- package/dist/{body/control/select → parse/expression}/ItemsetValueExpression.d.ts +2 -3
- package/dist/parse/expression/RepeatCountControlExpression.d.ts +2 -3
- package/dist/parse/expression/TextLiteralExpression.d.ts +9 -0
- package/dist/parse/expression/TextOutputExpression.d.ts +7 -0
- package/dist/parse/expression/TextReferenceExpression.d.ts +7 -0
- package/dist/parse/expression/TextTranslationExpression.d.ts +8 -0
- package/dist/{expression → parse/expression/abstract}/DependencyContext.d.ts +0 -1
- package/dist/{expression → parse/expression/abstract}/DependentExpression.d.ts +2 -3
- package/dist/parse/expression/abstract/TextChunkExpression.d.ts +17 -0
- package/dist/parse/model/BindDefinition.d.ts +39 -0
- package/dist/{model → parse/model}/DescendentNodeDefinition.d.ts +0 -1
- package/dist/{model → parse/model}/LeafNodeDefinition.d.ts +1 -2
- package/dist/{model → parse/model}/ModelBindMap.d.ts +0 -1
- package/dist/{model → parse/model}/ModelDefinition.d.ts +1 -2
- package/dist/{model → parse/model}/NodeDefinition.d.ts +0 -1
- package/dist/parse/{NoteNodeDefinition.d.ts → model/NoteNodeDefinition.d.ts} +8 -9
- package/dist/{model → parse/model}/RepeatInstanceDefinition.d.ts +1 -2
- package/dist/{model → parse/model}/RepeatRangeDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/RepeatTemplateDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/RootDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/SubtreeDefinition.d.ts +1 -2
- package/dist/parse/text/HintDefinition.d.ts +2 -3
- package/dist/parse/text/ItemLabelDefinition.d.ts +2 -3
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +3 -4
- package/dist/parse/text/LabelDefinition.d.ts +5 -6
- package/dist/parse/text/MessageDefinition.d.ts +4 -5
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +8 -9
- package/dist/parse/text/abstract/TextRangeDefinition.d.ts +5 -6
- package/dist/parse/xpath/path-resolution.d.ts +0 -1
- package/dist/parse/xpath/predicate-analysis.d.ts +0 -1
- package/dist/parse/xpath/reference-parsing.d.ts +0 -1
- package/dist/parse/xpath/semantic-analysis.d.ts +0 -1
- package/dist/parse/xpath/syntax-traversal.d.ts +0 -1
- package/dist/solid.js +6849 -5247
- package/dist/solid.js.map +1 -1
- package/package.json +11 -11
- package/src/client/BaseNode.ts +1 -1
- package/src/client/GroupNode.ts +2 -2
- package/src/client/ModelValueNode.ts +1 -1
- package/src/client/NodeAppearances.ts +1 -1
- package/src/client/NoteNode.ts +2 -2
- package/src/client/RootNode.ts +2 -2
- package/src/client/SelectNode.ts +2 -2
- package/src/client/StringNode.ts +2 -2
- package/src/client/SubtreeNode.ts +1 -1
- package/src/client/TextRange.ts +4 -5
- package/src/client/TriggerNode.ts +29 -0
- package/src/client/hierarchy.ts +13 -1
- package/src/client/node-types.ts +9 -1
- package/src/client/repeat/BaseRepeatRangeNode.ts +1 -1
- package/src/client/repeat/RepeatInstanceNode.ts +2 -2
- package/src/client/repeat/RepeatRangeControlledNode.ts +1 -1
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +1 -1
- package/src/client/unsupported/RangeNode.ts +14 -0
- package/src/client/unsupported/RankNode.ts +14 -0
- package/src/client/unsupported/UnsupportedControlNode.ts +40 -0
- package/src/client/unsupported/UploadNode.ts +14 -0
- package/src/index.ts +6 -1
- package/src/instance/ModelValue.ts +2 -2
- package/src/instance/Note.ts +2 -2
- package/src/instance/Root.ts +7 -3
- package/src/instance/SelectField.ts +6 -6
- package/src/instance/StringField.ts +3 -3
- package/src/instance/TriggerControl.ts +134 -0
- package/src/instance/abstract/DescendantNode.ts +4 -4
- package/src/instance/abstract/InstanceNode.ts +9 -1
- package/src/instance/abstract/UnsupportedControl.ts +151 -0
- package/src/instance/children.ts +75 -5
- package/src/instance/hierarchy.ts +22 -4
- package/src/instance/index.ts +1 -1
- package/src/instance/internal-api/EvaluationContext.ts +1 -1
- package/src/instance/internal-api/ValidationContext.ts +12 -3
- package/src/instance/internal-api/ValueContext.ts +3 -3
- package/src/instance/repeat/BaseRepeatRange.ts +1 -1
- package/src/instance/repeat/RepeatRangeControlled.ts +1 -1
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +1 -1
- package/src/instance/unsupported/RangeControl.ts +5 -0
- package/src/instance/unsupported/RankControl.ts +5 -0
- package/src/instance/unsupported/UploadControl.ts +5 -0
- package/src/lib/TokenListParser.ts +11 -7
- package/src/lib/dom/query.ts +1 -1
- package/src/lib/reactivity/createComputedExpression.ts +3 -3
- package/src/lib/reactivity/createNoteReadonlyThunk.ts +2 -2
- package/src/lib/reactivity/createSelectItems.ts +3 -3
- package/src/lib/reactivity/createValueState.ts +3 -3
- package/src/lib/reactivity/node-state/createSpecifiedState.ts +1 -1
- package/src/lib/reactivity/text/createFieldHint.ts +1 -1
- package/src/lib/reactivity/text/createNodeLabel.ts +1 -1
- package/src/lib/reactivity/text/createNoteText.ts +1 -1
- package/src/lib/reactivity/text/createTextRange.ts +4 -4
- package/src/lib/reactivity/validation/createAggregatedViolations.ts +8 -3
- package/src/lib/reactivity/validation/createValidation.ts +1 -1
- package/src/{XFormDataType.ts → parse/XFormDataType.ts} +1 -3
- package/src/{XFormDefinition.ts → parse/XFormDefinition.ts} +2 -2
- package/src/{body → parse/body}/BodyDefinition.ts +44 -27
- package/src/{body → parse/body}/BodyElementDefinition.ts +12 -6
- package/src/{body → parse/body}/RepeatElementDefinition.ts +7 -5
- package/src/{body → parse/body}/appearance/inputAppearanceParser.ts +1 -1
- package/src/{body → parse/body}/appearance/selectAppearanceParser.ts +1 -1
- package/src/{body → parse/body}/appearance/structureElementAppearanceParser.ts +1 -1
- package/src/parse/body/appearance/unknownAppearanceParser.ts +5 -0
- package/src/{body → parse/body}/control/ControlDefinition.ts +4 -4
- package/src/parse/body/control/RangeControlDefinition.ts +26 -0
- package/src/parse/body/control/RankControlDefinition.ts +27 -0
- package/src/parse/body/control/TriggerControlDefinition.ts +26 -0
- package/src/parse/body/control/UploadControlDefinition.ts +26 -0
- package/src/{body → parse/body}/control/select/ItemDefinition.ts +2 -2
- package/src/{body → parse/body}/control/select/ItemsetDefinition.ts +5 -5
- package/src/{body → parse/body}/control/select/ItemsetNodesetContext.ts +2 -2
- package/src/{body → parse/body}/control/select/SelectDefinition.ts +3 -11
- package/src/{body → parse/body}/group/BaseGroupDefinition.ts +11 -22
- package/src/{body → parse/body}/group/PresentationGroupDefinition.ts +1 -1
- package/src/{model/BindComputation.ts → parse/expression/BindComputationExpression.ts} +8 -8
- package/src/{body/control/select → parse/expression}/ItemsetNodesetExpression.ts +2 -2
- package/src/{body/control/select → parse/expression}/ItemsetValueExpression.ts +2 -2
- package/src/parse/expression/RepeatCountControlExpression.ts +2 -2
- package/src/parse/expression/TextLiteralExpression.ts +19 -0
- package/src/parse/{text/OutputChunkDefinition.ts → expression/TextOutputExpression.ts} +4 -4
- package/src/parse/{text/ReferenceChunkDefinition.ts → expression/TextReferenceExpression.ts} +4 -4
- package/src/parse/{text/TranslationChunkDefinition.ts → expression/TextTranslationExpression.ts} +4 -4
- package/src/{expression → parse/expression/abstract}/DependentExpression.ts +4 -4
- package/src/parse/expression/abstract/TextChunkExpression.ts +38 -0
- package/src/{model → parse/model}/BindDefinition.ts +23 -22
- package/src/parse/{NoteNodeDefinition.ts → model/NoteNodeDefinition.ts} +9 -9
- package/src/{model → parse/model}/RepeatRangeDefinition.ts +1 -1
- package/src/{model → parse/model}/RootDefinition.ts +2 -2
- package/src/parse/text/HintDefinition.ts +2 -2
- package/src/parse/text/ItemLabelDefinition.ts +2 -2
- package/src/parse/text/ItemsetLabelDefinition.ts +7 -7
- package/src/parse/text/LabelDefinition.ts +5 -5
- package/src/parse/text/MessageDefinition.ts +7 -7
- package/src/parse/text/abstract/TextElementDefinition.ts +14 -14
- package/src/parse/text/abstract/TextRangeDefinition.ts +5 -5
- package/dist/model/BindDefinition.d.ts +0 -34
- package/dist/parse/text/OutputChunkDefinition.d.ts +0 -8
- package/dist/parse/text/ReferenceChunkDefinition.d.ts +0 -8
- package/dist/parse/text/StaticTextChunkDefinition.d.ts +0 -10
- package/dist/parse/text/TranslationChunkDefinition.d.ts +0 -9
- package/dist/parse/text/abstract/TextChunkDefinition.d.ts +0 -18
- package/src/parse/TODO.md +0 -3
- package/src/parse/text/StaticTextChunkDefinition.ts +0 -19
- package/src/parse/text/abstract/TextChunkDefinition.ts +0 -38
- package/dist/{model → parse/model}/BindElement.d.ts +0 -0
- package/src/{XFormDOM.ts → parse/XFormDOM.ts} +0 -0
- package/src/{body → parse/body}/UnsupportedBodyElementDefinition.ts +0 -0
- package/src/{body → parse/body}/control/InputDefinition.ts +1 -1
- /package/src/{body → parse/body}/group/LogicalGroupDefinition.ts +0 -0
- /package/src/{body → parse/body}/group/StructuralGroupDefinition.ts +0 -0
- /package/src/{expression → parse/expression/abstract}/DependencyContext.ts +0 -0
- /package/src/{model → parse/model}/BindElement.ts +0 -0
- /package/src/{model → parse/model}/DescendentNodeDefinition.ts +0 -0
- /package/src/{model → parse/model}/LeafNodeDefinition.ts +0 -0
- /package/src/{model → parse/model}/ModelBindMap.ts +0 -0
- /package/src/{model → parse/model}/ModelDefinition.ts +0 -0
- /package/src/{model → parse/model}/NodeDefinition.ts +0 -0
- /package/src/{model → parse/model}/RepeatInstanceDefinition.ts +0 -0
- /package/src/{model → parse/model}/RepeatTemplateDefinition.ts +0 -0
- /package/src/{model → parse/model}/SubtreeDefinition.ts +0 -0
package/src/lib/dom/query.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
KnownAttributeLocalNamedElement,
|
|
4
4
|
LocalNamedElement,
|
|
5
5
|
} from '@getodk/common/types/dom.ts';
|
|
6
|
-
import type { SelectElement } from '../../body/control/select/SelectDefinition';
|
|
6
|
+
import type { SelectElement } from '../../parse/body/control/select/SelectDefinition';
|
|
7
7
|
|
|
8
8
|
const hintLookup = new ScopedElementLookup(':scope > hint', 'hint');
|
|
9
9
|
const itemLookup = new ScopedElementLookup(':scope > item', 'item');
|
|
@@ -2,12 +2,12 @@ import { UnreachableError } from '@getodk/common/lib/error/UnreachableError.ts';
|
|
|
2
2
|
import type { XFormsXPathEvaluator } from '@getodk/xpath';
|
|
3
3
|
import type { Accessor } from 'solid-js';
|
|
4
4
|
import { createMemo } from 'solid-js';
|
|
5
|
+
import type { EvaluationContext } from '../../instance/internal-api/EvaluationContext.ts';
|
|
6
|
+
import type { SubscribableDependency } from '../../instance/internal-api/SubscribableDependency.ts';
|
|
5
7
|
import type {
|
|
6
8
|
DependentExpression,
|
|
7
9
|
DependentExpressionResultType,
|
|
8
|
-
} from '../../expression/DependentExpression.ts';
|
|
9
|
-
import type { EvaluationContext } from '../../instance/internal-api/EvaluationContext.ts';
|
|
10
|
-
import type { SubscribableDependency } from '../../instance/internal-api/SubscribableDependency.ts';
|
|
10
|
+
} from '../../parse/expression/abstract/DependentExpression.ts';
|
|
11
11
|
import { isConstantExpression } from '../../parse/xpath/semantic-analysis.ts';
|
|
12
12
|
|
|
13
13
|
interface ComputedExpressionResults {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Accessor } from 'solid-js';
|
|
2
2
|
import type { EvaluationContext } from '../../instance/internal-api/EvaluationContext.ts';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BindComputationExpression } from '../../parse/expression/BindComputationExpression.ts';
|
|
4
4
|
import { createComputedExpression } from './createComputedExpression.ts';
|
|
5
5
|
|
|
6
6
|
export const createNoteReadonlyThunk = (
|
|
7
7
|
context: EvaluationContext,
|
|
8
|
-
readonlyDefinition:
|
|
8
|
+
readonlyDefinition: BindComputationExpression<'readonly'>
|
|
9
9
|
): Accessor<true> => {
|
|
10
10
|
if (!readonlyDefinition.isConstantTruthyExpression()) {
|
|
11
11
|
throw new Error('Expected a static readonly expression');
|
|
@@ -2,8 +2,6 @@ import { UpsertableMap } from '@getodk/common/lib/collections/UpsertableMap.ts';
|
|
|
2
2
|
import type { XFormsXPathEvaluator } from '@getodk/xpath';
|
|
3
3
|
import type { Accessor } from 'solid-js';
|
|
4
4
|
import { createMemo } from 'solid-js';
|
|
5
|
-
import type { ItemDefinition } from '../../body/control/select/ItemDefinition.ts';
|
|
6
|
-
import type { ItemsetDefinition } from '../../body/control/select/ItemsetDefinition.ts';
|
|
7
5
|
import type { TextRange as ClientTextRange } from '../../client/TextRange.ts';
|
|
8
6
|
import type { SelectItem } from '../../index.ts';
|
|
9
7
|
import type { SelectField } from '../../instance/SelectField.ts';
|
|
@@ -14,6 +12,8 @@ import type {
|
|
|
14
12
|
import type { SubscribableDependency } from '../../instance/internal-api/SubscribableDependency.ts';
|
|
15
13
|
import { TextChunk } from '../../instance/text/TextChunk.ts';
|
|
16
14
|
import { TextRange } from '../../instance/text/TextRange.ts';
|
|
15
|
+
import type { ItemDefinition } from '../../parse/body/control/select/ItemDefinition.ts';
|
|
16
|
+
import type { ItemsetDefinition } from '../../parse/body/control/select/ItemsetDefinition.ts';
|
|
17
17
|
import { createComputedExpression } from './createComputedExpression.ts';
|
|
18
18
|
import type { ReactiveScope } from './scope.ts';
|
|
19
19
|
import { createTextRange } from './text/createTextRange.ts';
|
|
@@ -21,7 +21,7 @@ import { createTextRange } from './text/createTextRange.ts';
|
|
|
21
21
|
type DerivedItemLabel = ClientTextRange<'item-label', 'form-derived'>;
|
|
22
22
|
|
|
23
23
|
const derivedItemLabel = (context: EvaluationContext, value: string): DerivedItemLabel => {
|
|
24
|
-
const chunk = new TextChunk(context.root, '
|
|
24
|
+
const chunk = new TextChunk(context.root, 'literal', value);
|
|
25
25
|
|
|
26
26
|
return new TextRange('form-derived', 'item-label', [chunk]);
|
|
27
27
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createComputed, createMemo, createSignal, untrack } from 'solid-js';
|
|
2
|
-
import type { DependentExpression } from '../../expression/DependentExpression.ts';
|
|
3
2
|
import type { SubscribableDependency } from '../../instance/internal-api/SubscribableDependency.ts';
|
|
4
3
|
import type { ValueContext } from '../../instance/internal-api/ValueContext.ts';
|
|
5
|
-
import type {
|
|
4
|
+
import type { BindComputationExpression } from '../../parse/expression/BindComputationExpression.ts';
|
|
5
|
+
import type { DependentExpression } from '../../parse/expression/abstract/DependentExpression.ts';
|
|
6
6
|
import { createComputedExpression } from './createComputedExpression.ts';
|
|
7
7
|
import type { SimpleAtomicState, SimpleAtomicStateSetter } from './types.ts';
|
|
8
8
|
|
|
@@ -209,7 +209,7 @@ const guardDownstreamReadonlyWrites = <RuntimeValue>(
|
|
|
209
209
|
const createCalculation = <RuntimeValue>(
|
|
210
210
|
context: ValueContext<RuntimeValue>,
|
|
211
211
|
setValue: SimpleAtomicStateSetter<RuntimeValue>,
|
|
212
|
-
calculateDefinition:
|
|
212
|
+
calculateDefinition: BindComputationExpression<'calculate'>
|
|
213
213
|
): void => {
|
|
214
214
|
context.scope.runTask(() => {
|
|
215
215
|
const calculate = createComputedExpression(context, calculateDefinition);
|
|
@@ -80,7 +80,7 @@ export type ComputedPropertySpec<T> = Accessor<T>;
|
|
|
80
80
|
/**
|
|
81
81
|
* @see {@link StaticPropertySpec}
|
|
82
82
|
*/
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/no-explicit-any
|
|
84
84
|
type NonStaticValue = Function | Signal<any> | SimpleAtomicState<any>;
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Accessor } from 'solid-js';
|
|
2
2
|
import type { TextRange } from '../../../client/TextRange.ts';
|
|
3
3
|
import type { EvaluationContext } from '../../../instance/internal-api/EvaluationContext.ts';
|
|
4
|
-
import type { LeafNodeDefinition } from '../../../model/LeafNodeDefinition.ts';
|
|
4
|
+
import type { LeafNodeDefinition } from '../../../parse/model/LeafNodeDefinition.ts';
|
|
5
5
|
import { createTextRange } from './createTextRange.ts';
|
|
6
6
|
|
|
7
7
|
export const createFieldHint = (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Accessor } from 'solid-js';
|
|
2
2
|
import type { TextRange } from '../../../client/TextRange.ts';
|
|
3
3
|
import type { EvaluationContext } from '../../../instance/internal-api/EvaluationContext.ts';
|
|
4
|
-
import type { AnyNodeDefinition } from '../../../model/NodeDefinition.ts';
|
|
4
|
+
import type { AnyNodeDefinition } from '../../../parse/model/NodeDefinition.ts';
|
|
5
5
|
import { createTextRange } from './createTextRange.ts';
|
|
6
6
|
|
|
7
7
|
export const createNodeLabel = (
|
|
@@ -2,7 +2,7 @@ import { UnreachableError } from '@getodk/common/lib/error/UnreachableError.ts';
|
|
|
2
2
|
import type { Accessor } from 'solid-js';
|
|
3
3
|
import type { TextRange } from '../../../client/TextRange.ts';
|
|
4
4
|
import type { EvaluationContext } from '../../../instance/internal-api/EvaluationContext.ts';
|
|
5
|
-
import type { NoteTextDefinition } from '../../../parse/NoteNodeDefinition.ts';
|
|
5
|
+
import type { NoteTextDefinition } from '../../../parse/model/NoteNodeDefinition.ts';
|
|
6
6
|
import { createTextRange } from './createTextRange.ts';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/sort-type-constituents
|
|
@@ -4,7 +4,7 @@ import type { TextChunkSource, TextRole } from '../../../client/TextRange.ts';
|
|
|
4
4
|
import type { EvaluationContext } from '../../../instance/internal-api/EvaluationContext.ts';
|
|
5
5
|
import { TextChunk } from '../../../instance/text/TextChunk.ts';
|
|
6
6
|
import { TextRange } from '../../../instance/text/TextRange.ts';
|
|
7
|
-
import type {
|
|
7
|
+
import type { AnyTextChunkExpression } from '../../../parse/expression/abstract/TextChunkExpression.ts';
|
|
8
8
|
import type { TextRangeDefinition } from '../../../parse/text/abstract/TextRangeDefinition.ts';
|
|
9
9
|
import { createComputedExpression } from '../createComputedExpression.ts';
|
|
10
10
|
|
|
@@ -15,11 +15,11 @@ interface TextChunkComputation {
|
|
|
15
15
|
|
|
16
16
|
const createComputedTextChunk = (
|
|
17
17
|
context: EvaluationContext,
|
|
18
|
-
textSource:
|
|
18
|
+
textSource: AnyTextChunkExpression
|
|
19
19
|
): TextChunkComputation => {
|
|
20
20
|
const { source } = textSource;
|
|
21
21
|
|
|
22
|
-
if (source === '
|
|
22
|
+
if (source === 'literal') {
|
|
23
23
|
const { stringValue } = textSource;
|
|
24
24
|
|
|
25
25
|
return {
|
|
@@ -40,7 +40,7 @@ const createComputedTextChunk = (
|
|
|
40
40
|
|
|
41
41
|
const createTextChunks = (
|
|
42
42
|
context: EvaluationContext,
|
|
43
|
-
textSources: readonly
|
|
43
|
+
textSources: readonly AnyTextChunkExpression[]
|
|
44
44
|
): Accessor<readonly TextChunk[]> => {
|
|
45
45
|
return context.scope.runTask(() => {
|
|
46
46
|
const { root } = context;
|
|
@@ -4,10 +4,11 @@ import type {
|
|
|
4
4
|
AncestorNodeValidationState,
|
|
5
5
|
DescendantNodeViolationReference,
|
|
6
6
|
} from '../../../client/validation.ts';
|
|
7
|
-
import type { AnyParentNode
|
|
7
|
+
import type { AnyParentNode } from '../../../instance/hierarchy.ts';
|
|
8
|
+
import type { ValidationContext } from '../../../instance/internal-api/ValidationContext.ts';
|
|
8
9
|
import { createSharedNodeState } from '../node-state/createSharedNodeState.ts';
|
|
9
10
|
|
|
10
|
-
const violationReference = (node:
|
|
11
|
+
const violationReference = (node: ValidationContext): DescendantNodeViolationReference | null => {
|
|
11
12
|
const violation = node.getViolation();
|
|
12
13
|
|
|
13
14
|
if (violation == null) {
|
|
@@ -33,7 +34,11 @@ const collectViolationReferences = (
|
|
|
33
34
|
case 'model-value':
|
|
34
35
|
case 'note':
|
|
35
36
|
case 'string':
|
|
36
|
-
case 'select':
|
|
37
|
+
case 'select':
|
|
38
|
+
case 'range':
|
|
39
|
+
case 'rank':
|
|
40
|
+
case 'trigger':
|
|
41
|
+
case 'upload': {
|
|
37
42
|
const reference = violationReference(child);
|
|
38
43
|
|
|
39
44
|
if (reference == null) {
|
|
@@ -33,7 +33,7 @@ const engineViolationMessage = <Role extends ValidationTextRole>(
|
|
|
33
33
|
role: Role
|
|
34
34
|
): Accessor<EngineViolationMessage<Role>> => {
|
|
35
35
|
const messageText = VALIDATION_TEXT[role];
|
|
36
|
-
const chunk = new TextChunk(context.root, '
|
|
36
|
+
const chunk = new TextChunk(context.root, 'literal', messageText);
|
|
37
37
|
const message = new TextRange('engine', role, [chunk]);
|
|
38
38
|
|
|
39
39
|
return () => message;
|
|
@@ -10,9 +10,7 @@ export type UnsupportedDataType = typeof UNSUPPORTED_DATA_TYPE;
|
|
|
10
10
|
/**
|
|
11
11
|
* Like JavaRosa. Presumably for e.g. groups with explicit binds (`relevant` etc)?
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export type NullDataType = typeof NULL_DATA_TYPE;
|
|
13
|
+
export type NullDataType = 'NULL';
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* As in ODK XForms Spec.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BodyDefinition } from './body/BodyDefinition.ts';
|
|
1
|
+
import { BodyDefinition } from '../parse/body/BodyDefinition.ts';
|
|
3
2
|
import { ModelDefinition } from './model/ModelDefinition.ts';
|
|
3
|
+
import { XFormDOM } from './XFormDOM.ts';
|
|
4
4
|
|
|
5
5
|
export class XFormDefinition {
|
|
6
6
|
readonly xformDOM: XFormDOM;
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import { RepeatElementDefinition } from './RepeatElementDefinition.ts';
|
|
6
|
-
import { UnsupportedBodyElementDefinition } from './UnsupportedBodyElementDefinition.ts';
|
|
1
|
+
import type { ParsedTokenList } from '../../lib/TokenListParser.ts';
|
|
2
|
+
import { TokenListParser } from '../../lib/TokenListParser.ts';
|
|
3
|
+
import type { XFormDefinition } from '../../parse/XFormDefinition.ts';
|
|
4
|
+
import { DependencyContext } from '../expression/abstract/DependencyContext.ts';
|
|
7
5
|
import { ControlDefinition } from './control/ControlDefinition.ts';
|
|
8
6
|
import { InputDefinition } from './control/InputDefinition.ts';
|
|
7
|
+
import { RangeControlDefinition } from './control/RangeControlDefinition.ts';
|
|
8
|
+
import { RankControlDefinition } from './control/RankControlDefinition.ts';
|
|
9
9
|
import type { AnySelectDefinition } from './control/select/SelectDefinition.ts';
|
|
10
10
|
import { SelectDefinition } from './control/select/SelectDefinition.ts';
|
|
11
|
+
import { TriggerControlDefinition } from './control/TriggerControlDefinition.ts';
|
|
12
|
+
import { UploadControlDefinition } from './control/UploadControlDefinition.ts';
|
|
11
13
|
import { LogicalGroupDefinition } from './group/LogicalGroupDefinition.ts';
|
|
12
14
|
import { PresentationGroupDefinition } from './group/PresentationGroupDefinition.ts';
|
|
13
15
|
import { StructuralGroupDefinition } from './group/StructuralGroupDefinition.ts';
|
|
16
|
+
import { RepeatElementDefinition } from './RepeatElementDefinition.ts';
|
|
17
|
+
import { UnsupportedBodyElementDefinition } from './UnsupportedBodyElementDefinition.ts';
|
|
14
18
|
|
|
15
19
|
export interface BodyElementParentContext {
|
|
20
|
+
readonly body: BodyDefinition;
|
|
16
21
|
readonly reference: string | null;
|
|
17
22
|
readonly element: Element;
|
|
18
23
|
}
|
|
@@ -20,7 +25,11 @@ export interface BodyElementParentContext {
|
|
|
20
25
|
// prettier-ignore
|
|
21
26
|
export type ControlElementDefinition =
|
|
22
27
|
| AnySelectDefinition
|
|
23
|
-
| InputDefinition
|
|
28
|
+
| InputDefinition
|
|
29
|
+
| RangeControlDefinition
|
|
30
|
+
| RankControlDefinition
|
|
31
|
+
| TriggerControlDefinition
|
|
32
|
+
| UploadControlDefinition;
|
|
24
33
|
|
|
25
34
|
type SupportedBodyElementDefinition =
|
|
26
35
|
// eslint-disable-next-line @typescript-eslint/sort-type-constituents
|
|
@@ -40,6 +49,10 @@ const BodyElementDefinitionConstructors = [
|
|
|
40
49
|
StructuralGroupDefinition,
|
|
41
50
|
InputDefinition,
|
|
42
51
|
SelectDefinition,
|
|
52
|
+
RangeControlDefinition,
|
|
53
|
+
RankControlDefinition,
|
|
54
|
+
TriggerControlDefinition,
|
|
55
|
+
UploadControlDefinition,
|
|
43
56
|
] as const satisfies readonly BodyElementDefinitionConstructor[];
|
|
44
57
|
|
|
45
58
|
export type AnyBodyElementDefinition =
|
|
@@ -145,25 +158,8 @@ const bodyClassParser = new TokenListParser(['pages' /*, 'theme-grid' */]);
|
|
|
145
158
|
|
|
146
159
|
export type BodyClassList = ParsedTokenList<typeof bodyClassParser>;
|
|
147
160
|
|
|
148
|
-
export class BodyDefinition extends DependencyContext {
|
|
149
|
-
|
|
150
|
-
form: XFormDefinition,
|
|
151
|
-
parent: BodyElementParentContext,
|
|
152
|
-
parentElement: Element,
|
|
153
|
-
children: readonly Element[] = Array.from(parentElement.children)
|
|
154
|
-
): readonly AnyBodyElementDefinition[] {
|
|
155
|
-
return Array.from(children).map((element) => {
|
|
156
|
-
const { localName } = element;
|
|
157
|
-
|
|
158
|
-
for (const Constructor of BodyElementDefinitionConstructors) {
|
|
159
|
-
if (Constructor.isCompatible(localName, element)) {
|
|
160
|
-
return new Constructor(form, parent, element);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return new UnsupportedBodyElementDefinition(form, parent, element);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
161
|
+
export class BodyDefinition extends DependencyContext implements BodyElementParentContext {
|
|
162
|
+
readonly body: BodyDefinition;
|
|
167
163
|
|
|
168
164
|
readonly element: Element;
|
|
169
165
|
|
|
@@ -196,12 +192,14 @@ export class BodyDefinition extends DependencyContext {
|
|
|
196
192
|
constructor(protected readonly form: XFormDefinition) {
|
|
197
193
|
super();
|
|
198
194
|
|
|
195
|
+
this.body = this;
|
|
196
|
+
|
|
199
197
|
const { body: element } = form.xformDOM;
|
|
200
198
|
|
|
201
199
|
this.reference = form.rootReference;
|
|
202
200
|
this.element = element;
|
|
203
201
|
this.classes = bodyClassParser.parseFrom(element, 'class');
|
|
204
|
-
this.elements =
|
|
202
|
+
this.elements = this.getChildElementDefinitions(form, this, element);
|
|
205
203
|
this.elementsByReference = new BodyElementMap(this.elements);
|
|
206
204
|
}
|
|
207
205
|
|
|
@@ -209,6 +207,25 @@ export class BodyDefinition extends DependencyContext {
|
|
|
209
207
|
return this.elementsByReference.get(reference) ?? null;
|
|
210
208
|
}
|
|
211
209
|
|
|
210
|
+
getChildElementDefinitions(
|
|
211
|
+
form: XFormDefinition,
|
|
212
|
+
parent: BodyElementParentContext,
|
|
213
|
+
parentElement: Element,
|
|
214
|
+
children: readonly Element[] = Array.from(parentElement.children)
|
|
215
|
+
): readonly AnyBodyElementDefinition[] {
|
|
216
|
+
return Array.from(children).map((element) => {
|
|
217
|
+
const { localName } = element;
|
|
218
|
+
|
|
219
|
+
for (const Constructor of BodyElementDefinitionConstructors) {
|
|
220
|
+
if (Constructor.isCompatible(localName, element)) {
|
|
221
|
+
return new Constructor(form, parent, element);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return new UnsupportedBodyElementDefinition(form, parent, element);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
212
229
|
toJSON() {
|
|
213
230
|
const { form, ...rest } = this;
|
|
214
231
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { DependencyContext } from '../expression/abstract/DependencyContext.ts';
|
|
2
|
+
import type { HintDefinition } from '../text/HintDefinition.ts';
|
|
3
|
+
import type { ItemLabelDefinition } from '../text/ItemLabelDefinition.ts';
|
|
4
|
+
import type { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
1
5
|
import type { XFormDefinition } from '../XFormDefinition.ts';
|
|
2
|
-
import {
|
|
3
|
-
import type { HintDefinition } from '../parse/text/HintDefinition.ts';
|
|
4
|
-
import type { ItemLabelDefinition } from '../parse/text/ItemLabelDefinition.ts';
|
|
5
|
-
import type { LabelDefinition } from '../parse/text/LabelDefinition.ts';
|
|
6
|
-
import type { BodyElementParentContext } from './BodyDefinition.ts';
|
|
6
|
+
import type { BodyDefinition, BodyElementParentContext } from './BodyDefinition.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* These category names roughly correspond to each of the ODK XForms spec's
|
|
@@ -12,7 +12,10 @@ import type { BodyElementParentContext } from './BodyDefinition.ts';
|
|
|
12
12
|
*/
|
|
13
13
|
type BodyElementCategory = 'control' | 'structure' | 'support' | 'UNSUPPORTED';
|
|
14
14
|
|
|
15
|
-
export abstract class BodyElementDefinition<Type extends string>
|
|
15
|
+
export abstract class BodyElementDefinition<Type extends string>
|
|
16
|
+
extends DependencyContext
|
|
17
|
+
implements BodyElementParentContext
|
|
18
|
+
{
|
|
16
19
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17
20
|
// @ts-ignore
|
|
18
21
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -20,6 +23,8 @@ export abstract class BodyElementDefinition<Type extends string> extends Depende
|
|
|
20
23
|
throw new Error('Must be overridden by BodyElementDefinition subclass');
|
|
21
24
|
}
|
|
22
25
|
|
|
26
|
+
readonly body: BodyDefinition;
|
|
27
|
+
|
|
23
28
|
abstract readonly category: BodyElementCategory;
|
|
24
29
|
abstract readonly type: Type;
|
|
25
30
|
readonly hint: HintDefinition | null = null;
|
|
@@ -34,6 +39,7 @@ export abstract class BodyElementDefinition<Type extends string> extends Depende
|
|
|
34
39
|
readonly element: Element
|
|
35
40
|
) {
|
|
36
41
|
super();
|
|
42
|
+
this.body = parent.body;
|
|
37
43
|
this.parentReference = parent.reference;
|
|
38
44
|
}
|
|
39
45
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { JAVAROSA_NAMESPACE_URI } from '@getodk/common/constants/xmlns.ts';
|
|
2
2
|
import type { XFormDefinition } from '../XFormDefinition.ts';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import type {
|
|
4
|
+
BodyElementDefinitionArray,
|
|
5
|
+
BodyElementParentContext,
|
|
6
|
+
} from '../body/BodyDefinition.ts';
|
|
7
|
+
import { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
8
|
+
import { parseNodesetReference } from '../xpath/reference-parsing.ts';
|
|
7
9
|
import { BodyElementDefinition } from './BodyElementDefinition.ts';
|
|
8
10
|
import type { StructureElementAppearanceDefinition } from './appearance/structureElementAppearanceParser.ts';
|
|
9
11
|
import { structureElementAppearanceParser } from './appearance/structureElementAppearanceParser.ts';
|
|
@@ -45,7 +47,7 @@ export class RepeatElementDefinition extends BodyElementDefinition<'repeat'> {
|
|
|
45
47
|
|
|
46
48
|
return localName !== 'label' && localName !== 'group-label';
|
|
47
49
|
});
|
|
48
|
-
const children =
|
|
50
|
+
const children = this.body.getChildElementDefinitions(form, this, element, childElements);
|
|
49
51
|
|
|
50
52
|
this.children = children;
|
|
51
53
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TokenListParser, type ParsedTokenList } from '
|
|
1
|
+
import { TokenListParser, type ParsedTokenList } from '../../../lib/TokenListParser.ts';
|
|
2
2
|
|
|
3
3
|
export const structureElementAppearanceParser = new TokenListParser(['field-list', 'table-list']);
|
|
4
4
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { ParsedTokenList } from '../../../lib/TokenListParser.ts';
|
|
2
|
+
import { HintDefinition } from '../../text/HintDefinition.ts';
|
|
3
|
+
import { LabelDefinition } from '../../text/LabelDefinition.ts';
|
|
1
4
|
import type { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
-
import
|
|
3
|
-
import { HintDefinition } from '../../parse/text/HintDefinition.ts';
|
|
4
|
-
import { LabelDefinition } from '../../parse/text/LabelDefinition.ts';
|
|
5
|
-
import { parseNodesetReference } from '../../parse/xpath/reference-parsing.ts';
|
|
5
|
+
import { parseNodesetReference } from '../../xpath/reference-parsing.ts';
|
|
6
6
|
import type { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
7
7
|
import { BodyElementDefinition } from '../BodyElementDefinition.ts';
|
|
8
8
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import {
|
|
3
|
+
unknownAppearanceParser,
|
|
4
|
+
type UnknownAppearanceDefinition,
|
|
5
|
+
} from '../appearance/unknownAppearanceParser.ts';
|
|
6
|
+
import type { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
7
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
8
|
+
|
|
9
|
+
export class RangeControlDefinition extends ControlDefinition<'range'> {
|
|
10
|
+
static override isCompatible(localName: string): boolean {
|
|
11
|
+
return localName === 'range';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
readonly type = 'range';
|
|
15
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
16
|
+
|
|
17
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element) {
|
|
18
|
+
super(form, parent, element);
|
|
19
|
+
|
|
20
|
+
this.appearances = unknownAppearanceParser.parseFrom(element, 'appearance');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override toJSON(): object {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ODK_NAMESPACE_URI } from '@getodk/common/constants/xmlns.ts';
|
|
2
|
+
import type { XFormDefinition } from '../../XFormDefinition.ts';
|
|
3
|
+
import {
|
|
4
|
+
unknownAppearanceParser,
|
|
5
|
+
type UnknownAppearanceDefinition,
|
|
6
|
+
} from '../appearance/unknownAppearanceParser.ts';
|
|
7
|
+
import type { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
8
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
9
|
+
|
|
10
|
+
export class RankControlDefinition extends ControlDefinition<'rank'> {
|
|
11
|
+
static override isCompatible(localName: string, element: Element): boolean {
|
|
12
|
+
return localName === 'rank' && element.namespaceURI === ODK_NAMESPACE_URI;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
readonly type = 'rank';
|
|
16
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
17
|
+
|
|
18
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element) {
|
|
19
|
+
super(form, parent, element);
|
|
20
|
+
|
|
21
|
+
this.appearances = unknownAppearanceParser.parseFrom(element, 'appearance');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override toJSON(): object {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import {
|
|
3
|
+
unknownAppearanceParser,
|
|
4
|
+
type UnknownAppearanceDefinition,
|
|
5
|
+
} from '../appearance/unknownAppearanceParser.ts';
|
|
6
|
+
import type { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
7
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
8
|
+
|
|
9
|
+
export class TriggerControlDefinition extends ControlDefinition<'trigger'> {
|
|
10
|
+
static override isCompatible(localName: string): boolean {
|
|
11
|
+
return localName === 'trigger';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
readonly type = 'trigger';
|
|
15
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
16
|
+
|
|
17
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element) {
|
|
18
|
+
super(form, parent, element);
|
|
19
|
+
|
|
20
|
+
this.appearances = unknownAppearanceParser.parseFrom(element, 'appearance');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override toJSON(): object {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import {
|
|
3
|
+
unknownAppearanceParser,
|
|
4
|
+
type UnknownAppearanceDefinition,
|
|
5
|
+
} from '../appearance/unknownAppearanceParser.ts';
|
|
6
|
+
import type { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
7
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
8
|
+
|
|
9
|
+
export class UploadControlDefinition extends ControlDefinition<'upload'> {
|
|
10
|
+
static override isCompatible(localName: string): boolean {
|
|
11
|
+
return localName === 'upload';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
readonly type = 'upload';
|
|
15
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
16
|
+
|
|
17
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element) {
|
|
18
|
+
super(form, parent, element);
|
|
19
|
+
|
|
20
|
+
this.appearances = unknownAppearanceParser.parseFrom(element, 'appearance');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override toJSON(): object {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getValueElement, type ItemElement } from '
|
|
2
|
-
import { ItemLabelDefinition } from '../../../
|
|
1
|
+
import { getValueElement, type ItemElement } from '../../../../lib/dom/query.ts';
|
|
2
|
+
import { ItemLabelDefinition } from '../../../text/ItemLabelDefinition.ts';
|
|
3
3
|
import type { XFormDefinition } from '../../../XFormDefinition.ts';
|
|
4
4
|
import { BodyElementDefinition } from '../../BodyElementDefinition.ts';
|
|
5
5
|
import type { AnySelectDefinition } from './SelectDefinition.ts';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { getValueElement, type ItemsetElement } from '../../../../lib/dom/query.ts';
|
|
2
|
+
import { ItemsetNodesetExpression } from '../../../expression/ItemsetNodesetExpression.ts';
|
|
3
|
+
import { ItemsetValueExpression } from '../../../expression/ItemsetValueExpression.ts';
|
|
4
|
+
import { ItemsetLabelDefinition } from '../../../text/ItemsetLabelDefinition.ts';
|
|
1
5
|
import type { XFormDefinition } from '../../../XFormDefinition.ts';
|
|
2
|
-
import {
|
|
3
|
-
import { ItemsetLabelDefinition } from '../../../parse/text/ItemsetLabelDefinition.ts';
|
|
4
|
-
import { parseNodesetReference } from '../../../parse/xpath/reference-parsing.ts';
|
|
6
|
+
import { parseNodesetReference } from '../../../xpath/reference-parsing.ts';
|
|
5
7
|
import { BodyElementDefinition } from '../../BodyElementDefinition.ts';
|
|
6
|
-
import { ItemsetNodesetExpression } from './ItemsetNodesetExpression.ts';
|
|
7
|
-
import { ItemsetValueExpression } from './ItemsetValueExpression.ts';
|
|
8
8
|
import type { AnySelectDefinition } from './SelectDefinition.ts';
|
|
9
9
|
|
|
10
10
|
export class ItemsetDefinition extends BodyElementDefinition<'itemset'> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DependencyContext } from '../../../expression/DependencyContext.ts';
|
|
2
|
-
import type { AnyDependentExpression } from '../../../expression/DependentExpression.ts';
|
|
1
|
+
import { DependencyContext } from '../../../expression/abstract/DependencyContext.ts';
|
|
2
|
+
import type { AnyDependentExpression } from '../../../expression/abstract/DependentExpression.ts';
|
|
3
3
|
import type { ItemsetDefinition } from './ItemsetDefinition.ts';
|
|
4
4
|
|
|
5
5
|
export class ItemsetNodesetContext extends DependencyContext {
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import type { CollectionValues } from '@getodk/common/types/collections/CollectionValues.ts';
|
|
2
2
|
import type { LocalNamedElement } from '@getodk/common/types/dom.ts';
|
|
3
|
+
import { getItemElements, getItemsetElement } from '../../../../lib/dom/query.ts';
|
|
3
4
|
import type { XFormDefinition } from '../../../XFormDefinition.ts';
|
|
4
|
-
import { getItemElements, getItemsetElement } from '../../../lib/dom/query.ts';
|
|
5
|
-
import type { AnyBodyElementDefinition, BodyElementParentContext } from '../../BodyDefinition.ts';
|
|
6
5
|
import type { SelectAppearanceDefinition } from '../../appearance/selectAppearanceParser.ts';
|
|
7
6
|
import { selectAppearanceParser } from '../../appearance/selectAppearanceParser.ts';
|
|
7
|
+
import type { AnyBodyElementDefinition, BodyElementParentContext } from '../../BodyDefinition.ts';
|
|
8
8
|
import { ControlDefinition } from '../ControlDefinition.ts';
|
|
9
9
|
import { ItemDefinition } from './ItemDefinition.ts';
|
|
10
10
|
import { ItemsetDefinition } from './ItemsetDefinition.ts';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
* @todo We were previously a bit overzealous about introducing `<rank>` support
|
|
14
|
-
* here. It'll likely still fit, but we should approach it with more intention.
|
|
15
|
-
*
|
|
16
|
-
* @todo `<trigger>` is *almost* reasonable to support here too. The main
|
|
17
|
-
* hesitation is that its single, implicit "item" does not have a distinct
|
|
18
|
-
* <label>, and presumably has different UX **and translation** considerations.
|
|
19
|
-
*/
|
|
20
|
-
const selectLocalNames = new Set([/* 'rank', */ 'select', 'select1'] as const);
|
|
12
|
+
const selectLocalNames = new Set(['select', 'select1'] as const);
|
|
21
13
|
|
|
22
14
|
export type SelectType = CollectionValues<typeof selectLocalNames>;
|
|
23
15
|
|