@getodk/xforms-engine 0.2.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 +69 -4
- package/dist/client/EngineConfig.d.ts +0 -1
- package/dist/client/GroupNode.d.ts +4 -3
- package/dist/client/ModelValueNode.d.ts +36 -0
- package/dist/client/NodeAppearances.d.ts +1 -2
- package/dist/client/NoteNode.d.ts +52 -0
- package/dist/client/RootNode.d.ts +4 -3
- package/dist/client/SelectNode.d.ts +6 -5
- package/dist/client/StringNode.d.ts +6 -5
- package/dist/client/SubtreeNode.d.ts +3 -2
- package/dist/client/TextRange.d.ts +85 -3
- package/dist/client/TriggerNode.d.ts +25 -0
- package/dist/client/constants.d.ts +8 -0
- package/dist/client/hierarchy.d.ts +19 -10
- package/dist/client/index.d.ts +0 -1
- package/dist/client/node-types.d.ts +3 -1
- package/dist/client/{RepeatRangeNode.d.ts → repeat/BaseRepeatRangeNode.d.ts} +18 -18
- package/dist/client/{RepeatInstanceNode.d.ts → repeat/RepeatInstanceNode.d.ts} +9 -9
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +18 -0
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +19 -0
- 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 +162 -0
- package/dist/index.d.ts +14 -6
- package/dist/index.js +39696 -36151
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +3 -2
- package/dist/instance/ModelValue.d.ts +39 -0
- package/dist/instance/Note.d.ts +41 -0
- package/dist/instance/Root.d.ts +5 -4
- package/dist/instance/SelectField.d.ts +11 -6
- package/dist/instance/StringField.d.ts +12 -7
- package/dist/instance/Subtree.d.ts +2 -1
- package/dist/instance/TriggerControl.d.ts +40 -0
- package/dist/instance/abstract/DescendantNode.d.ts +8 -10
- package/dist/instance/abstract/InstanceNode.d.ts +3 -2
- package/dist/instance/abstract/UnsupportedControl.d.ts +46 -0
- package/dist/instance/children.d.ts +0 -1
- package/dist/instance/hierarchy.d.ts +15 -6
- 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 +28 -0
- package/dist/instance/internal-api/ValueContext.d.ts +3 -4
- package/dist/instance/{RepeatRange.d.ts → repeat/BaseRepeatRange.d.ts} +46 -46
- package/dist/instance/{RepeatInstance.d.ts → repeat/RepeatInstance.d.ts} +13 -13
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +15 -0
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +34 -0
- package/dist/instance/resource.d.ts +0 -1
- package/dist/instance/text/TextChunk.d.ts +0 -1
- package/dist/instance/text/TextRange.d.ts +4 -5
- 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 +7 -3
- package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +4 -0
- 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 +1 -2
- package/dist/lib/reactivity/node-state/createSpecifiedPropertyDescriptor.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +1 -2
- 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 +3 -4
- package/dist/lib/reactivity/text/createNodeLabel.d.ts +3 -4
- package/dist/lib/reactivity/text/createNoteText.d.ts +24 -0
- package/dist/lib/reactivity/text/createTextRange.d.ts +5 -8
- package/dist/lib/reactivity/types.d.ts +0 -1
- package/dist/lib/reactivity/validation/createAggregatedViolations.d.ts +8 -0
- package/dist/lib/reactivity/validation/createValidation.d.ts +17 -0
- 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 +8 -7
- package/dist/{body → parse/body}/RepeatElementDefinition.d.ts +4 -5
- 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 +3 -4
- package/dist/{body → parse/body}/control/select/ItemsetDefinition.d.ts +7 -7
- 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 +18 -0
- 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 +13 -10
- package/dist/parse/expression/abstract/TextChunkExpression.d.ts +17 -0
- package/dist/parse/model/BindDefinition.d.ts +39 -0
- package/dist/{model → parse/model}/BindElement.d.ts +1 -0
- package/dist/{model → parse/model}/DescendentNodeDefinition.d.ts +0 -1
- package/dist/{model/ValueNodeDefinition.d.ts → parse/model/LeafNodeDefinition.d.ts} +3 -4
- 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 +8 -9
- package/dist/parse/model/NoteNodeDefinition.d.ts +30 -0
- package/dist/{model → parse/model}/RepeatInstanceDefinition.d.ts +3 -4
- package/dist/{model → parse/model}/RepeatRangeDefinition.d.ts +14 -5
- 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 +8 -0
- package/dist/parse/text/ItemLabelDefinition.d.ts +8 -0
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +12 -0
- package/dist/parse/text/LabelDefinition.d.ts +14 -0
- package/dist/parse/text/MessageDefinition.d.ts +14 -0
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +22 -0
- package/dist/parse/text/abstract/TextRangeDefinition.d.ts +34 -0
- package/dist/parse/xpath/dependency-analysis.d.ts +40 -0
- package/dist/parse/xpath/path-resolution.d.ts +69 -0
- package/dist/parse/xpath/predicate-analysis.d.ts +29 -0
- package/dist/parse/xpath/reference-parsing.d.ts +17 -0
- package/dist/parse/xpath/semantic-analysis.d.ts +97 -0
- package/dist/parse/xpath/syntax-traversal.d.ts +68 -0
- package/dist/solid.js +8745 -5186
- package/dist/solid.js.map +1 -1
- package/package.json +15 -16
- package/src/client/BaseNode.ts +74 -8
- package/src/client/GroupNode.ts +4 -2
- package/src/client/ModelValueNode.ts +40 -0
- package/src/client/NodeAppearances.ts +1 -1
- package/src/client/NoteNode.ts +74 -0
- package/src/client/README.md +1 -0
- package/src/client/RootNode.ts +4 -2
- package/src/client/SelectNode.ts +6 -4
- package/src/client/StringNode.ts +6 -4
- package/src/client/SubtreeNode.ts +3 -1
- package/src/client/TextRange.ts +98 -2
- package/src/client/TriggerNode.ts +29 -0
- package/src/client/constants.ts +10 -0
- package/src/client/hierarchy.ts +43 -15
- package/src/client/node-types.ts +17 -2
- package/src/client/{RepeatRangeNode.ts → repeat/BaseRepeatRangeNode.ts} +18 -19
- package/src/client/{RepeatInstanceNode.ts → repeat/RepeatInstanceNode.ts} +10 -8
- package/src/client/repeat/RepeatRangeControlledNode.ts +20 -0
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +21 -0
- 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/client/validation.ts +199 -0
- package/src/index.ts +21 -9
- package/src/instance/Group.ts +10 -4
- package/src/instance/ModelValue.ts +104 -0
- package/src/instance/Note.ts +142 -0
- package/src/instance/Root.ts +16 -6
- package/src/instance/SelectField.ts +29 -7
- package/src/instance/StringField.ts +36 -10
- package/src/instance/Subtree.ts +9 -3
- package/src/instance/TriggerControl.ts +134 -0
- package/src/instance/abstract/DescendantNode.ts +9 -10
- package/src/instance/abstract/InstanceNode.ts +29 -7
- package/src/instance/abstract/UnsupportedControl.ts +151 -0
- package/src/instance/children.ts +113 -16
- package/src/instance/hierarchy.ts +42 -5
- package/src/instance/index.ts +1 -1
- package/src/instance/internal-api/EvaluationContext.ts +1 -1
- package/src/instance/internal-api/ValidationContext.ts +32 -0
- package/src/instance/internal-api/ValueContext.ts +3 -3
- package/src/instance/{RepeatRange.ts → repeat/BaseRepeatRange.ts} +114 -99
- package/src/instance/{RepeatInstance.ts → repeat/RepeatInstance.ts} +27 -22
- package/src/instance/repeat/RepeatRangeControlled.ts +82 -0
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +67 -0
- package/src/instance/text/TextRange.ts +10 -4
- 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 +25 -27
- package/src/lib/reactivity/createNoteReadonlyThunk.ts +33 -0
- package/src/lib/reactivity/createSelectItems.ts +23 -16
- package/src/lib/reactivity/createValueState.ts +3 -3
- package/src/lib/reactivity/node-state/createSharedNodeState.ts +1 -1
- package/src/lib/reactivity/node-state/createSpecifiedState.ts +1 -1
- package/src/lib/reactivity/text/createFieldHint.ts +9 -7
- package/src/lib/reactivity/text/createNodeLabel.ts +8 -6
- package/src/lib/reactivity/text/createNoteText.ts +72 -0
- package/src/lib/reactivity/text/createTextRange.ts +17 -90
- package/src/lib/reactivity/validation/createAggregatedViolations.ts +75 -0
- package/src/lib/reactivity/validation/createValidation.ts +196 -0
- 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 +13 -6
- package/src/{body → parse/body}/RepeatElementDefinition.ts +10 -20
- 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 +5 -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 +4 -4
- package/src/parse/body/control/select/ItemsetDefinition.ts +53 -0
- 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 -21
- package/src/{body → parse/body}/group/PresentationGroupDefinition.ts +1 -1
- package/src/{model/BindComputation.ts → parse/expression/BindComputationExpression.ts} +8 -12
- package/src/parse/expression/ItemsetNodesetExpression.ts +8 -0
- package/src/{body/control/select → parse/expression}/ItemsetValueExpression.ts +2 -2
- package/src/parse/expression/RepeatCountControlExpression.ts +44 -0
- package/src/parse/expression/TextLiteralExpression.ts +19 -0
- package/src/parse/expression/TextOutputExpression.ts +25 -0
- package/src/parse/expression/TextReferenceExpression.ts +14 -0
- package/src/parse/expression/TextTranslationExpression.ts +38 -0
- package/src/{expression → parse/expression/abstract}/DependentExpression.ts +46 -28
- package/src/parse/expression/abstract/TextChunkExpression.ts +38 -0
- package/src/{model → parse/model}/BindDefinition.ts +30 -27
- package/src/{model → parse/model}/BindElement.ts +1 -0
- package/src/{model/ValueNodeDefinition.ts → parse/model/LeafNodeDefinition.ts} +4 -4
- package/src/{model → parse/model}/ModelBindMap.ts +4 -0
- package/src/{model → parse/model}/NodeDefinition.ts +12 -12
- package/src/parse/model/NoteNodeDefinition.ts +70 -0
- package/src/{model → parse/model}/RepeatInstanceDefinition.ts +2 -2
- package/src/parse/model/RepeatRangeDefinition.ts +94 -0
- package/src/{model → parse/model}/RootDefinition.ts +8 -4
- package/src/parse/text/HintDefinition.ts +25 -0
- package/src/parse/text/ItemLabelDefinition.ts +25 -0
- package/src/parse/text/ItemsetLabelDefinition.ts +44 -0
- package/src/parse/text/LabelDefinition.ts +61 -0
- package/src/parse/text/MessageDefinition.ts +49 -0
- package/src/parse/text/abstract/TextElementDefinition.ts +71 -0
- package/src/parse/text/abstract/TextRangeDefinition.ts +70 -0
- package/src/parse/xpath/dependency-analysis.ts +105 -0
- package/src/parse/xpath/path-resolution.ts +475 -0
- package/src/parse/xpath/predicate-analysis.ts +61 -0
- package/src/parse/xpath/reference-parsing.ts +90 -0
- package/src/parse/xpath/semantic-analysis.ts +466 -0
- package/src/parse/xpath/syntax-traversal.ts +129 -0
- package/dist/body/text/HintDefinition.d.ts +0 -11
- package/dist/body/text/LabelDefinition.d.ts +0 -22
- package/dist/body/text/TextElementDefinition.d.ts +0 -33
- package/dist/body/text/TextElementOutputPart.d.ts +0 -13
- package/dist/body/text/TextElementPart.d.ts +0 -13
- package/dist/body/text/TextElementReferencePart.d.ts +0 -7
- package/dist/body/text/TextElementStaticPart.d.ts +0 -7
- package/dist/lib/xpath/analysis.d.ts +0 -23
- package/dist/model/BindDefinition.d.ts +0 -32
- package/src/body/control/select/ItemsetDefinition.ts +0 -36
- package/src/body/control/select/ItemsetNodesetExpression.ts +0 -8
- package/src/body/text/HintDefinition.ts +0 -26
- package/src/body/text/LabelDefinition.ts +0 -68
- package/src/body/text/TextElementDefinition.ts +0 -97
- package/src/body/text/TextElementOutputPart.ts +0 -27
- package/src/body/text/TextElementPart.ts +0 -31
- package/src/body/text/TextElementReferencePart.ts +0 -21
- package/src/body/text/TextElementStaticPart.ts +0 -26
- package/src/lib/xpath/analysis.ts +0 -241
- package/src/model/RepeatRangeDefinition.ts +0 -53
- 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}/DescendentNodeDefinition.ts +0 -0
- /package/src/{model → parse/model}/ModelDefinition.ts +0 -0
- /package/src/{model → parse/model}/RepeatTemplateDefinition.ts +0 -0
- /package/src/{model → parse/model}/SubtreeDefinition.ts +0 -0
|
@@ -1,7 +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';
|
|
4
|
-
|
|
3
|
+
import { XFormDOM } from './XFormDOM.ts';
|
|
5
4
|
export declare class XFormDefinition {
|
|
6
5
|
readonly sourceXML: string;
|
|
7
6
|
readonly xformDOM: XFormDOM;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { RepeatElementDefinition } from './RepeatElementDefinition.ts';
|
|
5
|
-
import { UnsupportedBodyElementDefinition } from './UnsupportedBodyElementDefinition.ts';
|
|
1
|
+
import { ParsedTokenList, TokenListParser } from '../../lib/TokenListParser.ts';
|
|
2
|
+
import { XFormDefinition } from '../../parse/XFormDefinition.ts';
|
|
3
|
+
import { DependencyContext } from '../expression/abstract/DependencyContext.ts';
|
|
6
4
|
import { InputDefinition } from './control/InputDefinition.ts';
|
|
5
|
+
import { RangeControlDefinition } from './control/RangeControlDefinition.ts';
|
|
6
|
+
import { RankControlDefinition } from './control/RankControlDefinition.ts';
|
|
7
7
|
import { AnySelectDefinition } from './control/select/SelectDefinition.ts';
|
|
8
|
+
import { TriggerControlDefinition } from './control/TriggerControlDefinition.ts';
|
|
9
|
+
import { UploadControlDefinition } from './control/UploadControlDefinition.ts';
|
|
8
10
|
import { LogicalGroupDefinition } from './group/LogicalGroupDefinition.ts';
|
|
9
11
|
import { PresentationGroupDefinition } from './group/PresentationGroupDefinition.ts';
|
|
10
12
|
import { StructuralGroupDefinition } from './group/StructuralGroupDefinition.ts';
|
|
11
|
-
|
|
13
|
+
import { RepeatElementDefinition } from './RepeatElementDefinition.ts';
|
|
14
|
+
import { UnsupportedBodyElementDefinition } from './UnsupportedBodyElementDefinition.ts';
|
|
12
15
|
export interface BodyElementParentContext {
|
|
16
|
+
readonly body: BodyDefinition;
|
|
13
17
|
readonly reference: string | null;
|
|
14
18
|
readonly element: Element;
|
|
15
19
|
}
|
|
16
|
-
export type ControlElementDefinition = AnySelectDefinition | InputDefinition;
|
|
20
|
+
export type ControlElementDefinition = AnySelectDefinition | InputDefinition | RangeControlDefinition | RankControlDefinition | TriggerControlDefinition | UploadControlDefinition;
|
|
17
21
|
type SupportedBodyElementDefinition = RepeatElementDefinition | LogicalGroupDefinition | PresentationGroupDefinition | StructuralGroupDefinition | ControlElementDefinition;
|
|
18
22
|
export type AnyBodyElementDefinition = SupportedBodyElementDefinition | UnsupportedBodyElementDefinition;
|
|
19
23
|
export type BodyElementDefinitionArray = readonly AnyBodyElementDefinition[];
|
|
@@ -38,9 +42,9 @@ declare class BodyElementMap extends Map<BodyElementReference, AnyBodyElementDef
|
|
|
38
42
|
}
|
|
39
43
|
declare const bodyClassParser: TokenListParser<"pages", "pages">;
|
|
40
44
|
export type BodyClassList = ParsedTokenList<typeof bodyClassParser>;
|
|
41
|
-
export declare class BodyDefinition extends DependencyContext {
|
|
45
|
+
export declare class BodyDefinition extends DependencyContext implements BodyElementParentContext {
|
|
42
46
|
protected readonly form: XFormDefinition;
|
|
43
|
-
|
|
47
|
+
readonly body: BodyDefinition;
|
|
44
48
|
readonly element: Element;
|
|
45
49
|
/**
|
|
46
50
|
* @todo this class is already an oddity in that it's **like** an element
|
|
@@ -65,6 +69,7 @@ export declare class BodyDefinition extends DependencyContext {
|
|
|
65
69
|
readonly reference: string;
|
|
66
70
|
constructor(form: XFormDefinition);
|
|
67
71
|
getBodyElement(reference: string): AnyBodyElementDefinition | null;
|
|
68
|
-
|
|
72
|
+
getChildElementDefinitions(form: XFormDefinition, parent: BodyElementParentContext, parentElement: Element, children?: readonly Element[]): readonly AnyBodyElementDefinition[];
|
|
73
|
+
toJSON(): Omit<this, "form" | "isTranslated" | "toJSON" | "dependencyExpressions" | "registerDependentExpression" | "getBodyElement" | "getChildElementDefinitions">;
|
|
69
74
|
}
|
|
70
75
|
export {};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
import { DependencyContext } from '../expression/abstract/DependencyContext.ts';
|
|
2
|
+
import { HintDefinition } from '../text/HintDefinition.ts';
|
|
3
|
+
import { ItemLabelDefinition } from '../text/ItemLabelDefinition.ts';
|
|
4
|
+
import { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
1
5
|
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
2
|
-
import {
|
|
3
|
-
import { BodyElementParentContext } from './BodyDefinition.ts';
|
|
4
|
-
import { HintDefinition } from './text/HintDefinition.ts';
|
|
5
|
-
import { LabelDefinition } from './text/LabelDefinition.ts';
|
|
6
|
-
|
|
6
|
+
import { BodyDefinition, BodyElementParentContext } from './BodyDefinition.ts';
|
|
7
7
|
/**
|
|
8
8
|
* These category names roughly correspond to each of the ODK XForms spec's
|
|
9
9
|
* {@link https://getodk.github.io/xforms-spec/#body-elements | Body Elements}
|
|
10
10
|
* tables.
|
|
11
11
|
*/
|
|
12
12
|
type BodyElementCategory = 'control' | 'structure' | 'support' | 'UNSUPPORTED';
|
|
13
|
-
export declare abstract class BodyElementDefinition<Type extends string> extends DependencyContext {
|
|
13
|
+
export declare abstract class BodyElementDefinition<Type extends string> extends DependencyContext implements BodyElementParentContext {
|
|
14
14
|
protected readonly form: XFormDefinition;
|
|
15
15
|
readonly parent: BodyElementParentContext;
|
|
16
16
|
readonly element: Element;
|
|
17
17
|
static isCompatible(localName: string, element: Element): boolean;
|
|
18
|
+
readonly body: BodyDefinition;
|
|
18
19
|
abstract readonly category: BodyElementCategory;
|
|
19
20
|
abstract readonly type: Type;
|
|
20
21
|
readonly hint: HintDefinition | null;
|
|
21
|
-
readonly label: LabelDefinition | null;
|
|
22
|
+
readonly label: ItemLabelDefinition | LabelDefinition | null;
|
|
22
23
|
readonly reference: string | null;
|
|
23
24
|
readonly parentReference: string | null;
|
|
24
25
|
protected constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
2
|
-
import { BodyElementDefinitionArray, BodyElementParentContext } from '
|
|
2
|
+
import { BodyElementDefinitionArray, BodyElementParentContext } from '../body/BodyDefinition.ts';
|
|
3
|
+
import { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
3
4
|
import { BodyElementDefinition } from './BodyElementDefinition.ts';
|
|
4
5
|
import { StructureElementAppearanceDefinition } from './appearance/structureElementAppearanceParser.ts';
|
|
5
|
-
import { LabelDefinition } from './text/LabelDefinition.ts';
|
|
6
|
-
|
|
7
6
|
export declare class RepeatElementDefinition extends BodyElementDefinition<'repeat'> {
|
|
8
7
|
static isCompatible(localName: string): boolean;
|
|
9
8
|
readonly category = "structure";
|
|
@@ -12,8 +11,8 @@ export declare class RepeatElementDefinition extends BodyElementDefinition<'repe
|
|
|
12
11
|
readonly appearances: StructureElementAppearanceDefinition;
|
|
13
12
|
readonly label: LabelDefinition | null;
|
|
14
13
|
readonly countExpression: string | null;
|
|
15
|
-
readonly
|
|
14
|
+
readonly noAddRemoveExpression: string | null;
|
|
16
15
|
readonly children: BodyElementDefinitionArray;
|
|
17
16
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
18
|
-
toJSON(): Omit<this, "
|
|
17
|
+
toJSON(): Omit<this, "parent" | "form" | "isTranslated" | "toJSON" | "dependencyExpressions" | "registerDependentExpression">;
|
|
19
18
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
2
2
|
import { BodyElementParentContext } from './BodyDefinition.ts';
|
|
3
3
|
import { BodyElementDefinition } from './BodyElementDefinition.ts';
|
|
4
|
-
|
|
5
4
|
export declare class UnsupportedBodyElementDefinition extends BodyElementDefinition<'UNSUPPORTED'> {
|
|
6
5
|
static isCompatible(): boolean;
|
|
7
6
|
readonly category = "UNSUPPORTED";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TokenListParser, ParsedTokenList } from '
|
|
2
|
-
|
|
1
|
+
import { TokenListParser, ParsedTokenList } from '../../../lib/TokenListParser.ts';
|
|
3
2
|
export declare const inputAppearanceParser: TokenListParser<"multiline" | "numbers" | "url" | "thousand-sep" | "no-calendar" | "month-year" | "year" | "ethiopian" | "coptic" | "islamic" | "bikram-sambat" | "myanmar" | "persian" | "placement-map" | "maps" | "hidden-answer" | "annotate" | "draw" | "signature" | "new-front" | "new" | "front" | "printer" | "masked", "multiline" | "numbers" | "url" | "thousand-sep" | "no-calendar" | "month-year" | "year" | "ethiopian" | "coptic" | "islamic" | "bikram-sambat" | "myanmar" | "persian" | "placement-map" | "maps" | "hidden-answer" | "annotate" | "draw" | "signature" | "new-front" | "new" | "front" | "printer" | "masked">;
|
|
4
3
|
export type InputAppearanceDefinition = ParsedTokenList<typeof inputAppearanceParser>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TokenListParser, ParsedTokenList } from '
|
|
2
|
-
|
|
1
|
+
import { TokenListParser, ParsedTokenList } from '../../../lib/TokenListParser.ts';
|
|
3
2
|
export declare const selectAppearanceParser: TokenListParser<"map" | "label" | "compact" | "horizontal" | "horizontal-compact" | "list-nolabel" | "minimal" | "columns" | "columns-1" | "columns-2" | "columns-3" | "columns-4" | "columns-5" | "columns-pack" | "autocomplete" | "likert" | "quick" | "quickcompact", "autocomplete">;
|
|
4
3
|
export type SelectAppearanceDefinition = ParsedTokenList<typeof selectAppearanceParser>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TokenListParser, ParsedTokenList } from '
|
|
2
|
-
|
|
1
|
+
import { TokenListParser, ParsedTokenList } from '../../../lib/TokenListParser.ts';
|
|
3
2
|
export declare const structureElementAppearanceParser: TokenListParser<"field-list" | "table-list", "field-list" | "table-list">;
|
|
4
3
|
export type StructureElementAppearanceDefinition = ParsedTokenList<typeof structureElementAppearanceParser>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { ParsedTokenList } from '../../../lib/TokenListParser.ts';
|
|
2
|
+
import { HintDefinition } from '../../text/HintDefinition.ts';
|
|
3
|
+
import { LabelDefinition } from '../../text/LabelDefinition.ts';
|
|
1
4
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
-
import { ParsedTokenList } from '../../lib/TokenListParser.ts';
|
|
3
5
|
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
6
|
import { BodyElementDefinition } from '../BodyElementDefinition.ts';
|
|
5
|
-
import { HintDefinition } from '../text/HintDefinition.ts';
|
|
6
|
-
import { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
7
|
-
|
|
8
7
|
type ControlType = 'input' | 'range' | 'rank' | 'select' | 'select1' | 'trigger' | 'upload';
|
|
9
8
|
export declare abstract class ControlDefinition<Type extends ControlType> extends BodyElementDefinition<Type> {
|
|
10
9
|
readonly category = "control";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
-
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
3
2
|
import { InputAppearanceDefinition } from '../appearance/inputAppearanceParser.ts';
|
|
3
|
+
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
4
|
import { ControlDefinition } from './ControlDefinition.ts';
|
|
5
|
-
|
|
6
5
|
export declare class InputDefinition extends ControlDefinition<'input'> {
|
|
7
6
|
static isCompatible(localName: string): boolean;
|
|
8
7
|
readonly type = "input";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import { UnknownAppearanceDefinition } from '../appearance/unknownAppearanceParser.ts';
|
|
3
|
+
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
5
|
+
export declare class RangeControlDefinition extends ControlDefinition<'range'> {
|
|
6
|
+
static isCompatible(localName: string): boolean;
|
|
7
|
+
readonly type = "range";
|
|
8
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
9
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
|
+
toJSON(): object;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import { UnknownAppearanceDefinition } from '../appearance/unknownAppearanceParser.ts';
|
|
3
|
+
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
5
|
+
export declare class RankControlDefinition extends ControlDefinition<'rank'> {
|
|
6
|
+
static isCompatible(localName: string, element: Element): boolean;
|
|
7
|
+
readonly type = "rank";
|
|
8
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
9
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
|
+
toJSON(): object;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import { UnknownAppearanceDefinition } from '../appearance/unknownAppearanceParser.ts';
|
|
3
|
+
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
5
|
+
export declare class TriggerControlDefinition extends ControlDefinition<'trigger'> {
|
|
6
|
+
static isCompatible(localName: string): boolean;
|
|
7
|
+
readonly type = "trigger";
|
|
8
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
9
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
|
+
toJSON(): object;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import { UnknownAppearanceDefinition } from '../appearance/unknownAppearanceParser.ts';
|
|
3
|
+
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
5
|
+
export declare class UploadControlDefinition extends ControlDefinition<'upload'> {
|
|
6
|
+
static isCompatible(localName: string): boolean;
|
|
7
|
+
readonly type = "upload";
|
|
8
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
9
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
|
+
toJSON(): object;
|
|
11
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { ItemElement } from '
|
|
1
|
+
import { ItemElement } from '../../../../lib/dom/query.ts';
|
|
2
|
+
import { ItemLabelDefinition } from '../../../text/ItemLabelDefinition.ts';
|
|
2
3
|
import { XFormDefinition } from '../../../XFormDefinition.ts';
|
|
3
4
|
import { BodyElementDefinition } from '../../BodyElementDefinition.ts';
|
|
4
|
-
import { LabelDefinition } from '../../text/LabelDefinition.ts';
|
|
5
5
|
import { AnySelectDefinition } from './SelectDefinition.ts';
|
|
6
|
-
|
|
7
6
|
export declare class ItemDefinition extends BodyElementDefinition<'item'> {
|
|
8
7
|
readonly parent: AnySelectDefinition;
|
|
9
8
|
readonly category = "support";
|
|
10
9
|
readonly type = "item";
|
|
11
|
-
readonly label:
|
|
10
|
+
readonly label: ItemLabelDefinition | null;
|
|
12
11
|
readonly value: string;
|
|
13
12
|
constructor(form: XFormDefinition, parent: AnySelectDefinition, element: ItemElement);
|
|
14
13
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ItemsetElement } from '
|
|
1
|
+
import { 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';
|
|
2
5
|
import { XFormDefinition } from '../../../XFormDefinition.ts';
|
|
3
6
|
import { BodyElementDefinition } from '../../BodyElementDefinition.ts';
|
|
4
|
-
import { LabelDefinition } from '../../text/LabelDefinition.ts';
|
|
5
|
-
import { ItemsetNodesetExpression } from './ItemsetNodesetExpression.ts';
|
|
6
|
-
import { ItemsetValueExpression } from './ItemsetValueExpression.ts';
|
|
7
7
|
import { AnySelectDefinition } from './SelectDefinition.ts';
|
|
8
|
-
|
|
9
8
|
export declare class ItemsetDefinition extends BodyElementDefinition<'itemset'> {
|
|
9
|
+
readonly parent: AnySelectDefinition;
|
|
10
10
|
readonly category = "support";
|
|
11
11
|
readonly type = "itemset";
|
|
12
12
|
readonly reference: string;
|
|
13
|
-
readonly label:
|
|
13
|
+
readonly label: ItemsetLabelDefinition | null;
|
|
14
14
|
readonly nodes: ItemsetNodesetExpression;
|
|
15
15
|
readonly value: ItemsetValueExpression;
|
|
16
|
-
constructor(form: XFormDefinition,
|
|
16
|
+
constructor(form: XFormDefinition, parent: AnySelectDefinition, element: ItemsetElement);
|
|
17
17
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { DependencyContext } from '../../../expression/DependencyContext.ts';
|
|
2
|
-
import { AnyDependentExpression } from '../../../expression/DependentExpression.ts';
|
|
1
|
+
import { DependencyContext } from '../../../expression/abstract/DependencyContext.ts';
|
|
2
|
+
import { AnyDependentExpression } from '../../../expression/abstract/DependentExpression.ts';
|
|
3
3
|
import { ItemsetDefinition } from './ItemsetDefinition.ts';
|
|
4
|
-
|
|
5
4
|
export declare class ItemsetNodesetContext extends DependencyContext {
|
|
6
5
|
protected readonly itemset: ItemsetDefinition;
|
|
7
6
|
readonly parentReference: null;
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
import { CollectionValues } from '
|
|
2
|
-
import { LocalNamedElement } from '
|
|
1
|
+
import { CollectionValues } from '../../../../../../common/types/collections/CollectionValues.ts';
|
|
2
|
+
import { LocalNamedElement } from '../../../../../../common/types/dom.ts';
|
|
3
3
|
import { XFormDefinition } from '../../../XFormDefinition.ts';
|
|
4
|
-
import { AnyBodyElementDefinition, BodyElementParentContext } from '../../BodyDefinition.ts';
|
|
5
4
|
import { SelectAppearanceDefinition } from '../../appearance/selectAppearanceParser.ts';
|
|
5
|
+
import { AnyBodyElementDefinition, BodyElementParentContext } from '../../BodyDefinition.ts';
|
|
6
6
|
import { ControlDefinition } from '../ControlDefinition.ts';
|
|
7
7
|
import { ItemDefinition } from './ItemDefinition.ts';
|
|
8
8
|
import { ItemsetDefinition } from './ItemsetDefinition.ts';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @todo We were previously a bit overzealous about introducing `<rank>` support
|
|
12
|
-
* here. It'll likely still fit, but we should approach it with more intention.
|
|
13
|
-
*
|
|
14
|
-
* @todo `<trigger>` is *almost* reasonable to support here too. The main
|
|
15
|
-
* hesitation is that its single, implicit "item" does not have a distinct
|
|
16
|
-
* <label>, and presumably has different UX **and translation** considerations.
|
|
17
|
-
*/
|
|
18
9
|
declare const selectLocalNames: Set<"select" | "select1">;
|
|
19
10
|
export type SelectType = CollectionValues<typeof selectLocalNames>;
|
|
20
11
|
export interface SelectElement extends LocalNamedElement<SelectType> {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { LabelDefinition } from '../../text/LabelDefinition.ts';
|
|
1
2
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
3
|
+
import { StructureElementAppearanceDefinition } from '../appearance/structureElementAppearanceParser.ts';
|
|
2
4
|
import { BodyElementDefinitionArray, BodyElementParentContext } from '../BodyDefinition.ts';
|
|
3
5
|
import { BodyElementDefinition } from '../BodyElementDefinition.ts';
|
|
4
|
-
import { StructureElementAppearanceDefinition } from '../appearance/structureElementAppearanceParser.ts';
|
|
5
|
-
import { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* These type names are derived from **and expand upon** the language used in
|
|
9
8
|
* the ODK XForms spec to describe various group usage. Whereas the spec
|
|
@@ -37,6 +36,5 @@ export declare abstract class BaseGroupDefinition<Type extends GroupType> extend
|
|
|
37
36
|
readonly reference: string | null;
|
|
38
37
|
readonly appearances: StructureElementAppearanceDefinition;
|
|
39
38
|
readonly label: LabelDefinition | null;
|
|
40
|
-
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element
|
|
41
|
-
getChildren(element: Element): BodyElementDefinitionArray;
|
|
39
|
+
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
42
40
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { LabelDefinition } from '../../text/LabelDefinition.ts';
|
|
1
2
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
3
|
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
3
|
-
import { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
4
4
|
import { BaseGroupDefinition } from './BaseGroupDefinition.ts';
|
|
5
|
-
|
|
6
5
|
export declare class PresentationGroupDefinition extends BaseGroupDefinition<'presentation-group'> {
|
|
7
6
|
static isCompatible(localName: string, element: Element): boolean;
|
|
8
7
|
readonly type = "presentation-group";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { BindDefinition } from '../model/BindDefinition.ts';
|
|
2
|
+
import { DependentExpression } from './abstract/DependentExpression.ts';
|
|
4
3
|
declare const defaultBindComputationExpressions: {
|
|
5
4
|
readonly calculate: null;
|
|
6
5
|
readonly constraint: "true()";
|
|
@@ -11,7 +10,7 @@ declare const defaultBindComputationExpressions: {
|
|
|
11
10
|
};
|
|
12
11
|
type DefaultBindComputationExpressions = typeof defaultBindComputationExpressions;
|
|
13
12
|
export type BindComputationType = keyof DefaultBindComputationExpressions;
|
|
14
|
-
type BindComputationFactoryResult<Type extends BindComputationType> = DefaultBindComputationExpressions[Type] extends null ?
|
|
13
|
+
type BindComputationFactoryResult<Type extends BindComputationType> = DefaultBindComputationExpressions[Type] extends null ? BindComputationExpression<Type> | null : BindComputationExpression<Type>;
|
|
15
14
|
declare const bindComputationResultTypes: {
|
|
16
15
|
readonly calculate: "string";
|
|
17
16
|
readonly constraint: "boolean";
|
|
@@ -22,9 +21,9 @@ declare const bindComputationResultTypes: {
|
|
|
22
21
|
};
|
|
23
22
|
type BindComputationResultTypes = typeof bindComputationResultTypes;
|
|
24
23
|
export type BindComputationResultType<Computation extends BindComputationType> = BindComputationResultTypes[Computation];
|
|
25
|
-
export declare class
|
|
24
|
+
export declare class BindComputationExpression<Computation extends BindComputationType> extends DependentExpression<BindComputationResultType<Computation>> {
|
|
26
25
|
readonly computation: Computation;
|
|
27
|
-
static
|
|
26
|
+
static forComputation<Type extends BindComputationType>(bind: BindDefinition, computation: Type): BindComputationFactoryResult<Type>;
|
|
28
27
|
readonly isDefaultExpression: boolean;
|
|
29
28
|
protected constructor(bind: BindDefinition, computation: Computation, expression: string | null);
|
|
30
29
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { ItemsetDefinition } from '../body/control/select/ItemsetDefinition.ts';
|
|
2
|
+
import { DependentExpression } from './abstract/DependentExpression.ts';
|
|
4
3
|
export declare class ItemsetNodesetExpression extends DependentExpression<'nodes'> {
|
|
5
4
|
constructor(itemset: ItemsetDefinition, nodesetExpression: string);
|
|
6
5
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { ItemsetDefinition } from '../body/control/select/ItemsetDefinition.ts';
|
|
2
|
+
import { DependentExpression } from './abstract/DependentExpression.ts';
|
|
4
3
|
export declare class ItemsetValueExpression extends DependentExpression<'string'> {
|
|
5
4
|
readonly itemset: ItemsetDefinition;
|
|
6
5
|
constructor(itemset: ItemsetDefinition, expression: string);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RepeatElementDefinition } from '../body/RepeatElementDefinition.ts';
|
|
2
|
+
import { DependentExpression } from './abstract/DependentExpression.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Represents either of these
|
|
5
|
+
* {@link https://getodk.github.io/xforms-spec/#body-attributes | body attributes}:
|
|
6
|
+
*
|
|
7
|
+
* - `jr:count`
|
|
8
|
+
* - `jr:noAddRemove`
|
|
9
|
+
*
|
|
10
|
+
* In both cases, the downstream effect is that the engine is responsible for
|
|
11
|
+
* controlling the count of a repeat range's instances. Representing both cases
|
|
12
|
+
* should simplify client usage, as well as implementation of the internal
|
|
13
|
+
* representation of {@link RepeatRangeControlledNode}.
|
|
14
|
+
*/
|
|
15
|
+
export declare class RepeatCountControlExpression extends DependentExpression<'number'> {
|
|
16
|
+
static from(bodyElement: RepeatElementDefinition, initialCount: number): RepeatCountControlExpression | null;
|
|
17
|
+
private constructor();
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnyTextRangeDefinition } from '../text/abstract/TextRangeDefinition.ts';
|
|
2
|
+
import { TextChunkExpression } from './abstract/TextChunkExpression.ts';
|
|
3
|
+
export type TextLiteralSourceNode = Attr | Text;
|
|
4
|
+
export declare class TextLiteralExpression extends TextChunkExpression<'literal'> {
|
|
5
|
+
readonly stringValue: string;
|
|
6
|
+
static from(context: AnyTextRangeDefinition, stringValue: string): TextLiteralExpression;
|
|
7
|
+
readonly source = "literal";
|
|
8
|
+
private constructor();
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AnyTextRangeDefinition } from '../text/abstract/TextRangeDefinition.ts';
|
|
2
|
+
import { TextChunkExpression } from './abstract/TextChunkExpression.ts';
|
|
3
|
+
export declare class TextOutputExpression extends TextChunkExpression<'output'> {
|
|
4
|
+
static from(context: AnyTextRangeDefinition, element: Element): TextOutputExpression | null;
|
|
5
|
+
readonly source = "output";
|
|
6
|
+
private constructor();
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AnyTextRangeDefinition } from '../text/abstract/TextRangeDefinition.ts';
|
|
2
|
+
import { TextChunkExpression } from './abstract/TextChunkExpression.ts';
|
|
3
|
+
export declare class TextReferenceExpression extends TextChunkExpression<'reference'> {
|
|
4
|
+
static from(context: AnyTextRangeDefinition, refExpression: string): TextReferenceExpression;
|
|
5
|
+
readonly source = "reference";
|
|
6
|
+
private constructor();
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnyTextRangeDefinition } from '../text/abstract/TextRangeDefinition.ts';
|
|
2
|
+
import { TextChunkExpression } from './abstract/TextChunkExpression.ts';
|
|
3
|
+
export declare class TextTranslationExpression extends TextChunkExpression<'translation'> {
|
|
4
|
+
static fromMessage(context: AnyTextRangeDefinition, maybeExpression: string): TextTranslationExpression | null;
|
|
5
|
+
static from(context: AnyTextRangeDefinition, maybeExpression: string): TextTranslationExpression | null;
|
|
6
|
+
readonly source = "translation";
|
|
7
|
+
private constructor();
|
|
8
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { XFormsXPathEvaluator } from '@getodk/xpath';
|
|
2
|
+
import { ConstantExpression, ConstantTruthyExpression } from '../../xpath/semantic-analysis.ts';
|
|
2
3
|
import { DependencyContext } from './DependencyContext.ts';
|
|
3
|
-
|
|
4
4
|
declare const evaluatorMethodsByResultType: {
|
|
5
5
|
readonly boolean: "evaluateBoolean";
|
|
6
6
|
readonly nodes: "evaluateNodes";
|
|
7
|
+
readonly number: "evaluateNumber";
|
|
7
8
|
readonly string: "evaluateString";
|
|
8
9
|
};
|
|
9
10
|
type EvaluatorMethodsByResultType = typeof evaluatorMethodsByResultType;
|
|
@@ -11,10 +12,6 @@ export type DependentExpressionResultType = keyof EvaluatorMethodsByResultType;
|
|
|
11
12
|
export type DependentExpressionEvaluatorMethod<Type extends DependentExpressionResultType> = EvaluatorMethodsByResultType[Type];
|
|
12
13
|
export type DependentExpressionResult<Type extends DependentExpressionResultType> = ReturnType<XFormsXPathEvaluator[DependentExpressionEvaluatorMethod<Type>]>;
|
|
13
14
|
interface SemanticDependencyOptions {
|
|
14
|
-
/**
|
|
15
|
-
* @default false
|
|
16
|
-
*/
|
|
17
|
-
readonly parentContext?: boolean | undefined;
|
|
18
15
|
/**
|
|
19
16
|
* @default false
|
|
20
17
|
*/
|
|
@@ -25,19 +22,25 @@ interface DependentExpressionOptions {
|
|
|
25
22
|
* @default false
|
|
26
23
|
*/
|
|
27
24
|
readonly ignoreContextReference?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* @default true
|
|
30
|
-
*/
|
|
31
|
-
readonly ignoreNullExpressions?: boolean;
|
|
32
25
|
readonly semanticDependencies?: SemanticDependencyOptions;
|
|
33
26
|
}
|
|
34
|
-
export
|
|
27
|
+
export interface ConstantDependentExpression<Type extends DependentExpressionResultType> extends DependentExpression<Type> {
|
|
28
|
+
readonly expression: ConstantExpression;
|
|
29
|
+
}
|
|
30
|
+
export interface ConstantTruthyDependentExpression extends ConstantDependentExpression<'boolean'> {
|
|
31
|
+
readonly expression: ConstantTruthyExpression;
|
|
32
|
+
}
|
|
33
|
+
export declare abstract class DependentExpression<Type extends DependentExpressionResultType> {
|
|
35
34
|
readonly resultType: Type;
|
|
36
35
|
readonly expression: string;
|
|
37
36
|
readonly dependencyReferences: ReadonlySet<string>;
|
|
38
37
|
readonly isTranslated: boolean;
|
|
39
38
|
readonly evaluatorMethod: DependentExpressionEvaluatorMethod<Type>;
|
|
39
|
+
readonly constantExpression: ConstantExpression | null;
|
|
40
|
+
readonly constantTruthyExpression: ConstantTruthyExpression | null;
|
|
40
41
|
constructor(context: DependencyContext, resultType: Type, expression: string, options?: DependentExpressionOptions);
|
|
42
|
+
isConstantExpression(): this is ConstantDependentExpression<Type>;
|
|
43
|
+
isConstantTruthyExpression(): this is ConstantTruthyDependentExpression;
|
|
41
44
|
toString(): string | null;
|
|
42
45
|
}
|
|
43
46
|
export type AnyDependentExpression = DependentExpression<any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TextChunkSource } from '../../../client/TextRange.ts';
|
|
2
|
+
import { AnyTextRangeDefinition } from '../../text/abstract/TextRangeDefinition.ts';
|
|
3
|
+
import { TextLiteralExpression } from '../TextLiteralExpression.ts';
|
|
4
|
+
import { TextOutputExpression } from '../TextOutputExpression.ts';
|
|
5
|
+
import { TextReferenceExpression } from '../TextReferenceExpression.ts';
|
|
6
|
+
import { TextTranslationExpression } from '../TextTranslationExpression.ts';
|
|
7
|
+
import { DependentExpression } from './DependentExpression.ts';
|
|
8
|
+
interface TextChunkExpressionOptions {
|
|
9
|
+
readonly isTranslated?: true;
|
|
10
|
+
}
|
|
11
|
+
export declare abstract class TextChunkExpression<Source extends TextChunkSource> extends DependentExpression<'string'> {
|
|
12
|
+
abstract readonly source: Source;
|
|
13
|
+
readonly stringValue?: string;
|
|
14
|
+
constructor(context: AnyTextRangeDefinition, expression: string, options?: TextChunkExpressionOptions);
|
|
15
|
+
}
|
|
16
|
+
export type AnyTextChunkExpression = TextLiteralExpression | TextOutputExpression | TextReferenceExpression | TextTranslationExpression;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DependencyContext } from '../expression/abstract/DependencyContext.ts';
|
|
2
|
+
import { BindComputationExpression } from '../expression/BindComputationExpression.ts';
|
|
3
|
+
import { MessageDefinition } from '../text/MessageDefinition.ts';
|
|
4
|
+
import { XFormDataType } from '../XFormDataType.ts';
|
|
5
|
+
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
6
|
+
import { BindElement } from './BindElement.ts';
|
|
7
|
+
import { ModelDefinition } from './ModelDefinition.ts';
|
|
8
|
+
export declare class BindDefinition extends DependencyContext {
|
|
9
|
+
readonly form: XFormDefinition;
|
|
10
|
+
protected readonly model: ModelDefinition;
|
|
11
|
+
readonly nodeset: string;
|
|
12
|
+
readonly bindElement: BindElement;
|
|
13
|
+
readonly bindType: string | null;
|
|
14
|
+
readonly dataType: XFormDataType;
|
|
15
|
+
readonly parentNodeset: string | null;
|
|
16
|
+
readonly calculate: BindComputationExpression<'calculate'> | null;
|
|
17
|
+
readonly readonly: BindComputationExpression<'readonly'>;
|
|
18
|
+
readonly relevant: BindComputationExpression<'relevant'>;
|
|
19
|
+
readonly required: BindComputationExpression<'required'>;
|
|
20
|
+
/**
|
|
21
|
+
* Diverges from
|
|
22
|
+
* {@link https://github.com/getodk/javarosa/blob/059321160e6f8dbb3e81d9add61d68dd35b13cc8/dag.md | JavaRosa's},
|
|
23
|
+
* which excludes `constraint` expressions. We compute `constraint`
|
|
24
|
+
* dependencies like the other <bind> computation expressions, but explicitly
|
|
25
|
+
* ignore self-references (this is currently handled by
|
|
26
|
+
* {@link BindComputationExpression}, via its {@link DependentExpression}
|
|
27
|
+
* super class).
|
|
28
|
+
*/
|
|
29
|
+
readonly constraint: BindComputationExpression<'constraint'>;
|
|
30
|
+
readonly constraintMsg: MessageDefinition<'constraintMsg'> | null;
|
|
31
|
+
readonly requiredMsg: MessageDefinition<'requiredMsg'> | null;
|
|
32
|
+
readonly saveIncomplete: BindComputationExpression<'saveIncomplete'>;
|
|
33
|
+
protected _parentBind: BindDefinition | null | undefined;
|
|
34
|
+
get parentBind(): BindDefinition | null;
|
|
35
|
+
get reference(): string;
|
|
36
|
+
get parentReference(): string | null;
|
|
37
|
+
constructor(form: XFormDefinition, model: ModelDefinition, nodeset: string, bindElement: BindElement);
|
|
38
|
+
toJSON(): Omit<this, "reference" | "form" | "isTranslated" | "parentReference" | "toJSON" | "dependencyExpressions" | "registerDependentExpression" | "model" | "bindElement" | "parentBind">;
|
|
39
|
+
}
|
|
@@ -2,7 +2,6 @@ import { AnyBodyElementDefinition } from '../body/BodyDefinition.ts';
|
|
|
2
2
|
import { BindDefinition } from './BindDefinition.ts';
|
|
3
3
|
import { ModelNode, NodeChildren, NodeDefaultValue, NodeDefinition, NodeDefinitionType, NodeInstances, NodeParent } from './NodeDefinition.ts';
|
|
4
4
|
import { RootDefinition } from './RootDefinition.ts';
|
|
5
|
-
|
|
6
5
|
export type DescendentNodeType = Exclude<NodeDefinitionType, 'root'>;
|
|
7
6
|
type DescendentNodeBodyElement = AnyBodyElementDefinition;
|
|
8
7
|
export declare abstract class DescendentNodeDefinition<Type extends DescendentNodeType, BodyElement extends DescendentNodeBodyElement | null = DescendentNodeBodyElement | null> implements NodeDefinition<Type> {
|