@getodk/xforms-engine 0.5.0 → 0.6.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/README.md +1 -1
- package/dist/client/BaseNode.d.ts +4 -0
- package/dist/client/BaseValueNode.d.ts +1 -1
- package/dist/client/GroupNode.d.ts +1 -0
- package/dist/client/InputNode.d.ts +32 -3
- package/dist/client/ModelValueNode.d.ts +1 -0
- package/dist/client/NoteNode.d.ts +24 -7
- package/dist/client/RangeNode.d.ts +36 -0
- package/dist/client/RankNode.d.ts +46 -0
- package/dist/client/RootNode.d.ts +6 -3
- package/dist/client/SelectNode.d.ts +47 -25
- package/dist/client/SubtreeNode.d.ts +1 -0
- package/dist/client/TriggerNode.d.ts +10 -6
- package/dist/client/hierarchy.d.ts +5 -5
- package/dist/client/node-types.d.ts +2 -2
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +1 -3
- package/dist/error/RankMissingValueError.d.ts +3 -0
- package/dist/error/RankValueTypeError.d.ts +6 -0
- package/dist/error/SelectValueTypeError.d.ts +15 -0
- package/dist/error/XFormsSpecViolationError.d.ts +2 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +5604 -4666
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +1 -0
- package/dist/instance/InputControl.d.ts +5 -3
- package/dist/instance/ModelValue.d.ts +2 -0
- package/dist/instance/Note.d.ts +13 -25
- package/dist/instance/PrimaryInstance.d.ts +1 -0
- package/dist/instance/RangeControl.d.ts +34 -0
- package/dist/instance/RankControl.d.ts +40 -0
- package/dist/instance/Root.d.ts +1 -0
- package/dist/instance/SelectControl.d.ts +66 -0
- package/dist/instance/Subtree.d.ts +1 -0
- package/dist/instance/TriggerControl.d.ts +9 -22
- package/dist/instance/abstract/DescendantNode.d.ts +1 -2
- package/dist/instance/abstract/InstanceNode.d.ts +3 -1
- package/dist/instance/abstract/UnsupportedControl.d.ts +1 -0
- package/dist/instance/abstract/ValueNode.d.ts +0 -1
- package/dist/instance/hierarchy.d.ts +9 -9
- package/dist/instance/internal-api/InstanceValueContext.d.ts +2 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +2 -1
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +2 -1
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +2 -1
- package/dist/instance/repeat/BaseRepeatRange.d.ts +1 -0
- package/dist/instance/repeat/RepeatInstance.d.ts +1 -0
- package/dist/integration/xpath/adapter/names.d.ts +1 -11
- package/dist/integration/xpath/adapter/traversal.d.ts +10 -9
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +10 -3
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +0 -1
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +12 -4
- package/dist/lib/client-reactivity/submission/createRootSubmissionState.d.ts +3 -0
- package/dist/lib/codecs/Geopoint/Geopoint.d.ts +48 -0
- package/dist/lib/codecs/Geopoint/GeopointValueCodec.d.ts +5 -0
- package/dist/lib/codecs/NoteCodec.d.ts +8 -0
- package/dist/lib/codecs/RangeCodec.d.ts +8 -0
- package/dist/lib/codecs/TriggerCodec.d.ts +7 -0
- package/dist/lib/codecs/ValueArrayCodec.d.ts +11 -0
- package/dist/lib/codecs/ValueCodec.d.ts +2 -2
- package/dist/lib/codecs/getNoteCodec.d.ts +3 -0
- package/dist/lib/codecs/getSelectCodec.d.ts +5 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +3 -2
- package/dist/lib/codecs/items/BaseItemCodec.d.ts +9 -0
- package/dist/lib/codecs/items/MultipleValueItemCodec.d.ts +14 -0
- package/dist/lib/codecs/items/SingleValueItemCodec.d.ts +24 -0
- package/dist/lib/dom/query.d.ts +1 -2
- package/dist/lib/names/NamespaceDeclaration.d.ts +45 -0
- package/dist/lib/names/NamespaceDeclarationMap.d.ts +137 -0
- package/dist/lib/names/NamespaceURL.d.ts +30 -0
- package/dist/lib/names/QualifiedName.d.ts +113 -0
- package/dist/lib/number-parsers.d.ts +2 -0
- package/dist/lib/reactivity/createItemCollection.d.ts +21 -0
- package/dist/lib/xml-serialization.d.ts +11 -2
- package/dist/parse/XFormDOM.d.ts +1 -1
- package/dist/parse/body/BodyDefinition.d.ts +2 -2
- package/dist/parse/body/appearance/rangeAppearanceParser.d.ts +3 -0
- package/dist/parse/body/control/InputControlDefinition.d.ts +3 -0
- package/dist/parse/body/control/ItemDefinition.d.ts +14 -0
- package/dist/parse/body/control/ItemsetDefinition.d.ts +18 -0
- package/dist/parse/body/control/RangeControlDefinition.d.ts +31 -2
- package/dist/parse/body/control/RankControlDefinition.d.ts +7 -3
- package/dist/parse/body/control/{select/SelectDefinition.d.ts → SelectControlDefinition.d.ts} +9 -9
- package/dist/parse/expression/ItemsetNodesetExpression.d.ts +1 -1
- package/dist/parse/expression/ItemsetValueExpression.d.ts +1 -1
- package/dist/parse/model/BindDefinition.d.ts +3 -1
- package/dist/parse/model/BindPreloadDefinition.d.ts +42 -0
- package/dist/parse/model/DescendentNodeDefinition.d.ts +4 -13
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +2 -1
- package/dist/parse/model/LeafNodeDefinition.d.ts +7 -4
- package/dist/parse/model/ModelBindMap.d.ts +1 -1
- package/dist/parse/model/NodeDefinition.d.ts +16 -19
- package/dist/parse/model/NoteNodeDefinition.d.ts +6 -5
- package/dist/parse/model/RangeNodeDefinition.d.ts +41 -0
- package/dist/parse/model/RepeatInstanceDefinition.d.ts +7 -4
- package/dist/parse/model/RepeatRangeDefinition.d.ts +7 -4
- package/dist/parse/model/RepeatTemplateDefinition.d.ts +7 -4
- package/dist/parse/model/RootAttributeDefinition.d.ts +24 -0
- package/dist/parse/model/RootAttributeMap.d.ts +23 -0
- package/dist/parse/model/RootDefinition.d.ts +9 -7
- package/dist/parse/model/SubtreeDefinition.d.ts +7 -4
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +2 -3
- package/dist/parse/text/ItemLabelDefinition.d.ts +1 -1
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +2 -2
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +1 -1
- package/dist/parse/xpath/semantic-analysis.d.ts +1 -3
- package/dist/solid.js +5603 -4665
- package/dist/solid.js.map +1 -1
- package/package.json +15 -12
- package/src/client/BaseNode.ts +5 -0
- package/src/client/BaseValueNode.ts +1 -1
- package/src/client/GroupNode.ts +1 -0
- package/src/client/InputNode.ts +38 -2
- package/src/client/ModelValueNode.ts +1 -0
- package/src/client/NoteNode.ts +43 -7
- package/src/client/RangeNode.ts +51 -0
- package/src/client/RankNode.ts +54 -0
- package/src/client/RootNode.ts +11 -5
- package/src/client/SelectNode.ts +53 -26
- package/src/client/SubtreeNode.ts +1 -0
- package/src/client/TriggerNode.ts +12 -6
- package/src/client/hierarchy.ts +7 -8
- package/src/client/node-types.ts +1 -1
- package/src/client/unsupported/UnsupportedControlNode.ts +2 -6
- package/src/error/RankMissingValueError.ts +5 -0
- package/src/error/RankValueTypeError.ts +13 -0
- package/src/error/SelectValueTypeError.ts +22 -0
- package/src/error/XFormsSpecViolationError.ts +1 -0
- package/src/index.ts +2 -12
- package/src/instance/Group.ts +1 -0
- package/src/instance/InputControl.ts +42 -2
- package/src/instance/ModelValue.ts +2 -0
- package/src/instance/Note.ts +34 -59
- package/src/instance/PrimaryInstance.ts +1 -0
- package/src/instance/RangeControl.ts +113 -0
- package/src/instance/RankControl.ts +199 -0
- package/src/instance/Root.ts +3 -2
- package/src/instance/SelectControl.ts +219 -0
- package/src/instance/Subtree.ts +1 -0
- package/src/instance/TriggerControl.ts +36 -75
- package/src/instance/abstract/DescendantNode.ts +1 -6
- package/src/instance/abstract/InstanceNode.ts +10 -2
- package/src/instance/abstract/UnsupportedControl.ts +1 -0
- package/src/instance/abstract/ValueNode.ts +3 -2
- package/src/instance/children.ts +71 -30
- package/src/instance/hierarchy.ts +21 -16
- package/src/instance/internal-api/InstanceValueContext.ts +2 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +2 -1
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +2 -1
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +2 -1
- package/src/instance/repeat/BaseRepeatRange.ts +2 -0
- package/src/instance/repeat/RepeatInstance.ts +1 -0
- package/src/instance/resource.ts +4 -1
- package/src/integration/xpath/adapter/names.ts +66 -17
- package/src/integration/xpath/adapter/traversal.ts +10 -9
- package/src/integration/xpath/static-dom/StaticAttribute.ts +15 -7
- package/src/integration/xpath/static-dom/StaticDocument.ts +0 -2
- package/src/integration/xpath/static-dom/StaticElement.ts +21 -8
- package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +1 -1
- package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +1 -1
- package/src/lib/client-reactivity/submission/createRootSubmissionState.ts +19 -0
- package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +2 -2
- package/src/lib/codecs/Geopoint/Geopoint.ts +150 -0
- package/src/lib/codecs/Geopoint/GeopointValueCodec.ts +20 -0
- package/src/lib/codecs/NoteCodec.ts +32 -0
- package/src/lib/codecs/RangeCodec.ts +65 -0
- package/src/lib/codecs/TriggerCodec.ts +64 -0
- package/src/lib/codecs/ValueArrayCodec.ts +42 -0
- package/src/lib/codecs/ValueCodec.ts +2 -2
- package/src/lib/codecs/getNoteCodec.ts +27 -0
- package/src/lib/codecs/getSelectCodec.ts +27 -0
- package/src/lib/codecs/getSharedValueCodec.ts +5 -3
- package/src/lib/codecs/items/BaseItemCodec.ts +20 -0
- package/src/lib/codecs/items/MultipleValueItemCodec.ts +28 -0
- package/src/lib/codecs/items/SingleValueItemCodec.ts +67 -0
- package/src/lib/dom/query.ts +1 -2
- package/src/lib/names/NamespaceDeclaration.ts +106 -0
- package/src/lib/names/NamespaceDeclarationMap.ts +228 -0
- package/src/lib/names/NamespaceURL.ts +44 -0
- package/src/lib/names/QualifiedName.ts +170 -0
- package/src/lib/number-parsers.ts +25 -0
- package/src/lib/reactivity/createInstanceValueState.ts +50 -0
- package/src/lib/reactivity/{createSelectItems.ts → createItemCollection.ts} +41 -36
- package/src/lib/xml-serialization.ts +76 -9
- package/src/parse/XFormDOM.ts +141 -21
- package/src/parse/XFormDefinition.ts +1 -4
- package/src/parse/body/BodyDefinition.ts +4 -4
- package/src/parse/body/appearance/rangeAppearanceParser.ts +11 -0
- package/src/parse/body/control/InputControlDefinition.ts +9 -0
- package/src/parse/body/control/{select/ItemDefinition.ts → ItemDefinition.ts} +8 -6
- package/src/parse/body/control/{select/ItemsetDefinition.ts → ItemsetDefinition.ts} +11 -9
- package/src/parse/body/control/RangeControlDefinition.ts +91 -6
- package/src/parse/body/control/RankControlDefinition.ts +25 -7
- package/src/parse/body/control/{select/SelectDefinition.ts → SelectControlDefinition.ts} +9 -9
- package/src/parse/expression/ItemsetNodesetExpression.ts +1 -1
- package/src/parse/expression/ItemsetValueExpression.ts +1 -1
- package/src/parse/model/BindDefinition.ts +4 -0
- package/src/parse/model/BindPreloadDefinition.ts +100 -0
- package/src/parse/model/DescendentNodeDefinition.ts +7 -25
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +2 -1
- package/src/parse/model/LeafNodeDefinition.ts +11 -4
- package/src/parse/model/NodeDefinition.ts +24 -45
- package/src/parse/model/NoteNodeDefinition.ts +8 -7
- package/src/parse/model/RangeNodeDefinition.ts +118 -0
- package/src/parse/model/RepeatInstanceDefinition.ts +11 -7
- package/src/parse/model/RepeatRangeDefinition.ts +11 -7
- package/src/parse/model/RepeatTemplateDefinition.ts +11 -7
- package/src/parse/model/RootAttributeDefinition.ts +45 -0
- package/src/parse/model/RootAttributeMap.ts +44 -0
- package/src/parse/model/RootDefinition.ts +29 -28
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +1 -0
- package/src/parse/model/SubtreeDefinition.ts +12 -12
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +3 -3
- package/src/parse/text/ItemLabelDefinition.ts +1 -1
- package/src/parse/text/ItemsetLabelDefinition.ts +2 -2
- package/src/parse/text/abstract/TextElementDefinition.ts +1 -1
- package/src/parse/xpath/semantic-analysis.ts +4 -3
- package/dist/client/unsupported/RangeNode.d.ts +0 -9
- package/dist/client/unsupported/RankNode.d.ts +0 -9
- package/dist/instance/SelectField.d.ts +0 -58
- package/dist/instance/unsupported/RangeControl.d.ts +0 -6
- package/dist/instance/unsupported/RankControl.d.ts +0 -6
- package/dist/integration/xpath/static-dom/StaticNamedNode.d.ts +0 -17
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -16
- package/dist/parse/body/control/select/ItemDefinition.d.ts +0 -13
- package/dist/parse/body/control/select/ItemsetDefinition.d.ts +0 -17
- package/dist/parse/body/control/select/ItemsetNodesetContext.d.ts +0 -9
- package/src/client/unsupported/RangeNode.ts +0 -14
- package/src/client/unsupported/RankNode.ts +0 -14
- package/src/instance/SelectField.ts +0 -263
- package/src/instance/unsupported/RangeControl.ts +0 -9
- package/src/instance/unsupported/RankControl.ts +0 -9
- package/src/integration/xpath/static-dom/StaticNamedNode.ts +0 -45
- package/src/parse/body/control/select/ItemsetNodesetContext.ts +0 -21
|
@@ -4,7 +4,7 @@ import { DependencyContext } from '../expression/abstract/DependencyContext.ts';
|
|
|
4
4
|
import { InputControlDefinition } from './control/InputControlDefinition.ts';
|
|
5
5
|
import { RangeControlDefinition } from './control/RangeControlDefinition.ts';
|
|
6
6
|
import { RankControlDefinition } from './control/RankControlDefinition.ts';
|
|
7
|
-
import {
|
|
7
|
+
import { AnySelectControlDefinition } from './control/SelectControlDefinition.ts';
|
|
8
8
|
import { TriggerControlDefinition } from './control/TriggerControlDefinition.ts';
|
|
9
9
|
import { UploadControlDefinition } from './control/UploadControlDefinition.ts';
|
|
10
10
|
import { LogicalGroupDefinition } from './group/LogicalGroupDefinition.ts';
|
|
@@ -17,7 +17,7 @@ export interface BodyElementParentContext {
|
|
|
17
17
|
readonly reference: string | null;
|
|
18
18
|
readonly element: Element;
|
|
19
19
|
}
|
|
20
|
-
export type ControlElementDefinition =
|
|
20
|
+
export type ControlElementDefinition = AnySelectControlDefinition | InputControlDefinition | RangeControlDefinition | RankControlDefinition | TriggerControlDefinition | UploadControlDefinition;
|
|
21
21
|
type SupportedBodyElementDefinition = RepeatElementDefinition | LogicalGroupDefinition | PresentationGroupDefinition | StructuralGroupDefinition | ControlElementDefinition;
|
|
22
22
|
export type AnyBodyElementDefinition = SupportedBodyElementDefinition | UnsupportedBodyElementDefinition;
|
|
23
23
|
export type BodyElementDefinitionArray = readonly AnyBodyElementDefinition[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ParsedTokenList, TokenListParser } from '../../../lib/TokenListParser.ts';
|
|
2
|
+
export declare const rangeAppearanceParser: TokenListParser<"no-ticks" | "picker" | "rating" | "vertical", "no-ticks" | "picker" | "rating" | "vertical">;
|
|
3
|
+
export type RangeAppearanceDefinition = ParsedTokenList<typeof rangeAppearanceParser>;
|
|
@@ -6,5 +6,8 @@ export declare class InputControlDefinition extends ControlDefinition<'input'> {
|
|
|
6
6
|
static isCompatible(localName: string): boolean;
|
|
7
7
|
readonly type = "input";
|
|
8
8
|
readonly appearances: InputAppearanceDefinition;
|
|
9
|
+
readonly rows: number | null;
|
|
10
|
+
readonly accuracyThreshold: number | null;
|
|
11
|
+
readonly unacceptableAccuracyThreshold: number | null;
|
|
9
12
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
13
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ItemElement } from '../../../lib/dom/query.ts';
|
|
2
|
+
import { ItemLabelDefinition } from '../../text/ItemLabelDefinition.ts';
|
|
3
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
4
|
+
import { BodyElementDefinition } from '../BodyElementDefinition.ts';
|
|
5
|
+
import { AnySelectControlDefinition } from './SelectControlDefinition.ts';
|
|
6
|
+
import { RankControlDefinition } from './RankControlDefinition.ts';
|
|
7
|
+
export declare class ItemDefinition extends BodyElementDefinition<'item'> {
|
|
8
|
+
readonly parent: AnySelectControlDefinition | RankControlDefinition;
|
|
9
|
+
readonly category = "support";
|
|
10
|
+
readonly type = "item";
|
|
11
|
+
readonly label: ItemLabelDefinition | null;
|
|
12
|
+
readonly value: string;
|
|
13
|
+
constructor(form: XFormDefinition, parent: AnySelectControlDefinition | RankControlDefinition, element: ItemElement);
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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';
|
|
5
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
6
|
+
import { BodyElementDefinition } from '../BodyElementDefinition.ts';
|
|
7
|
+
import { AnySelectControlDefinition } from './SelectControlDefinition.ts';
|
|
8
|
+
import { RankControlDefinition } from './RankControlDefinition.ts';
|
|
9
|
+
export declare class ItemsetDefinition extends BodyElementDefinition<'itemset'> {
|
|
10
|
+
readonly parent: AnySelectControlDefinition | RankControlDefinition;
|
|
11
|
+
readonly category = "support";
|
|
12
|
+
readonly type = "itemset";
|
|
13
|
+
readonly reference: string;
|
|
14
|
+
readonly label: ItemsetLabelDefinition | null;
|
|
15
|
+
readonly nodes: ItemsetNodesetExpression;
|
|
16
|
+
readonly value: ItemsetValueExpression;
|
|
17
|
+
constructor(form: XFormDefinition, parent: AnySelectControlDefinition | RankControlDefinition, element: ItemsetElement);
|
|
18
|
+
}
|
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { RangeAppearanceDefinition } from '../appearance/rangeAppearanceParser.ts';
|
|
3
3
|
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
4
|
import { ControlDefinition } from './ControlDefinition.ts';
|
|
5
|
+
type NumericString = `${number}`;
|
|
6
|
+
/**
|
|
7
|
+
* Per
|
|
8
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | ODK XForms spec},
|
|
9
|
+
* the following attributes are required:
|
|
10
|
+
*
|
|
11
|
+
* - `start`
|
|
12
|
+
* - `end`
|
|
13
|
+
* - `step`
|
|
14
|
+
*
|
|
15
|
+
* While we also know that a `<range>` control is expected to have a bind type
|
|
16
|
+
* of either `decimal` or `int`, at this parsing stage we do not yet know which
|
|
17
|
+
* type is associated with the control. So we parse the attributes as strings,
|
|
18
|
+
* checking only that they appear to be numeric values. We also preserve the
|
|
19
|
+
* attributes' names here, for consistency with the spec.
|
|
20
|
+
*
|
|
21
|
+
* Downstream, we parse these to their appropriate numeric runtime types, and
|
|
22
|
+
* alias them to their more conventional names (i.e. "start" -> "min", "end" ->
|
|
23
|
+
* "max").
|
|
24
|
+
*/
|
|
25
|
+
export declare class RangeControlBoundsDefinition {
|
|
26
|
+
readonly start: NumericString;
|
|
27
|
+
readonly end: NumericString;
|
|
28
|
+
readonly step: NumericString;
|
|
29
|
+
static from(element: Element): RangeControlBoundsDefinition;
|
|
30
|
+
constructor(start: NumericString, end: NumericString, step: NumericString);
|
|
31
|
+
}
|
|
5
32
|
export declare class RangeControlDefinition extends ControlDefinition<'range'> {
|
|
6
33
|
static isCompatible(localName: string): boolean;
|
|
7
34
|
readonly type = "range";
|
|
8
|
-
readonly appearances:
|
|
35
|
+
readonly appearances: RangeAppearanceDefinition;
|
|
36
|
+
readonly bounds: RangeControlBoundsDefinition;
|
|
9
37
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
38
|
toJSON(): object;
|
|
11
39
|
}
|
|
40
|
+
export {};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
-
import { UnknownAppearanceDefinition } from '../appearance/unknownAppearanceParser.ts';
|
|
3
2
|
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
3
|
import { ControlDefinition } from './ControlDefinition.ts';
|
|
4
|
+
import { ItemsetDefinition } from './ItemsetDefinition.ts';
|
|
5
|
+
import { ItemDefinition } from './ItemDefinition.ts';
|
|
6
|
+
import { UnknownAppearanceDefinition } from '../appearance/unknownAppearanceParser.ts';
|
|
5
7
|
export declare class RankControlDefinition extends ControlDefinition<'rank'> {
|
|
6
|
-
static isCompatible(localName: string
|
|
8
|
+
static isCompatible(localName: string): boolean;
|
|
7
9
|
readonly type = "rank";
|
|
8
10
|
readonly appearances: UnknownAppearanceDefinition;
|
|
11
|
+
readonly itemset: ItemsetDefinition | null;
|
|
12
|
+
readonly items: readonly ItemDefinition[];
|
|
9
13
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
|
-
toJSON():
|
|
14
|
+
toJSON(): {};
|
|
11
15
|
}
|
package/dist/parse/body/control/{select/SelectDefinition.d.ts → SelectControlDefinition.d.ts}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { CollectionValues } from '
|
|
2
|
-
import { LocalNamedElement } from '
|
|
3
|
-
import { XFormDefinition } from '
|
|
4
|
-
import { SelectAppearanceDefinition } from '
|
|
5
|
-
import { AnyBodyElementDefinition, BodyElementParentContext } from '
|
|
6
|
-
import { ControlDefinition } from '
|
|
1
|
+
import { CollectionValues } from '../../../../../common/types/collections/CollectionValues.ts';
|
|
2
|
+
import { LocalNamedElement } from '../../../../../common/types/dom.ts';
|
|
3
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
4
|
+
import { SelectAppearanceDefinition } from '../appearance/selectAppearanceParser.ts';
|
|
5
|
+
import { AnyBodyElementDefinition, BodyElementParentContext } from '../BodyDefinition.ts';
|
|
6
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
7
7
|
import { ItemDefinition } from './ItemDefinition.ts';
|
|
8
8
|
import { ItemsetDefinition } from './ItemsetDefinition.ts';
|
|
9
9
|
declare const selectLocalNames: Set<"select" | "select1">;
|
|
10
10
|
export type SelectType = CollectionValues<typeof selectLocalNames>;
|
|
11
11
|
export interface SelectElement extends LocalNamedElement<SelectType> {
|
|
12
12
|
}
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class SelectControlDefinition<Type extends SelectType> extends ControlDefinition<Type> {
|
|
14
14
|
static isCompatible(localName: string, element: Element): boolean;
|
|
15
|
-
static isSelect(element: AnyBodyElementDefinition): element is
|
|
15
|
+
static isSelect(element: AnyBodyElementDefinition): element is AnySelectControlDefinition;
|
|
16
16
|
readonly type: Type;
|
|
17
17
|
readonly element: SelectElement;
|
|
18
18
|
readonly appearances: SelectAppearanceDefinition;
|
|
@@ -21,5 +21,5 @@ export declare class SelectDefinition<Type extends SelectType> extends ControlDe
|
|
|
21
21
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
22
22
|
toJSON(): {};
|
|
23
23
|
}
|
|
24
|
-
export type
|
|
24
|
+
export type AnySelectControlDefinition = SelectControlDefinition<SelectType>;
|
|
25
25
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ItemsetDefinition } from '../body/control/
|
|
1
|
+
import { ItemsetDefinition } from '../body/control/ItemsetDefinition.ts';
|
|
2
2
|
import { DependentExpression } from './abstract/DependentExpression.ts';
|
|
3
3
|
export declare class ItemsetNodesetExpression extends DependentExpression<'nodes'> {
|
|
4
4
|
constructor(itemset: ItemsetDefinition, nodesetExpression: string);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ItemsetDefinition } from '../body/control/
|
|
1
|
+
import { ItemsetDefinition } from '../body/control/ItemsetDefinition.ts';
|
|
2
2
|
import { DependentExpression } from './abstract/DependentExpression.ts';
|
|
3
3
|
export declare class ItemsetValueExpression extends DependentExpression<'string'> {
|
|
4
4
|
readonly itemset: ItemsetDefinition;
|
|
@@ -3,6 +3,7 @@ import { BindComputationExpression } from '../expression/BindComputationExpressi
|
|
|
3
3
|
import { MessageDefinition } from '../text/MessageDefinition.ts';
|
|
4
4
|
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
5
5
|
import { BindElement } from './BindElement.ts';
|
|
6
|
+
import { AnyBindPreloadDefinition } from './BindPreloadDefinition.ts';
|
|
6
7
|
import { BindType, BindTypeDefinition } from './BindTypeDefinition.ts';
|
|
7
8
|
import { ModelDefinition } from './ModelDefinition.ts';
|
|
8
9
|
export declare class BindDefinition<T extends BindType = BindType> extends DependencyContext {
|
|
@@ -12,6 +13,7 @@ export declare class BindDefinition<T extends BindType = BindType> extends Depen
|
|
|
12
13
|
readonly bindElement: BindElement;
|
|
13
14
|
readonly type: BindTypeDefinition<T>;
|
|
14
15
|
readonly parentNodeset: string | null;
|
|
16
|
+
readonly preload: AnyBindPreloadDefinition | null;
|
|
15
17
|
readonly calculate: BindComputationExpression<'calculate'> | null;
|
|
16
18
|
readonly readonly: BindComputationExpression<'readonly'>;
|
|
17
19
|
readonly relevant: BindComputationExpression<'relevant'>;
|
|
@@ -34,5 +36,5 @@ export declare class BindDefinition<T extends BindType = BindType> extends Depen
|
|
|
34
36
|
get reference(): string;
|
|
35
37
|
get parentReference(): string | null;
|
|
36
38
|
constructor(form: XFormDefinition, model: ModelDefinition, nodeset: string, bindElement: BindElement);
|
|
37
|
-
toJSON(): Omit<this, "form" | "
|
|
39
|
+
toJSON(): Omit<this, "form" | "model" | "toJSON" | "reference" | "isTranslated" | "parentReference" | "bindElement" | "parentBind">;
|
|
38
40
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PartiallyKnownString } from '../../../../common/types/string/PartiallyKnownString.ts';
|
|
2
|
+
import { BindElement } from './BindElement.ts';
|
|
3
|
+
type PartiallyKnownPreloadParameter<Known extends string> = PartiallyKnownString<NonNullable<Known>> | Extract<Known, null>;
|
|
4
|
+
interface PreloadParametersByType {
|
|
5
|
+
readonly uid: string | null;
|
|
6
|
+
readonly date: PartiallyKnownPreloadParameter<'today'>;
|
|
7
|
+
readonly timestamp: PartiallyKnownPreloadParameter<'end' | 'start'>;
|
|
8
|
+
readonly property: PartiallyKnownPreloadParameter<'deviceid' | 'email' | 'phonenumber' | 'username'>;
|
|
9
|
+
}
|
|
10
|
+
type PreloadType = PartiallyKnownString<keyof PreloadParametersByType>;
|
|
11
|
+
type PreloadParameter<Type extends PreloadType> = Type extends keyof PreloadParametersByType ? PreloadParametersByType[Type] : string | null;
|
|
12
|
+
interface PreloadInput<Type extends PreloadType> {
|
|
13
|
+
readonly type: Type;
|
|
14
|
+
readonly parameter: PreloadParameter<Type>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parsed representation of
|
|
18
|
+
* {@link https://getodk.github.io/xforms-spec/#preload-attributes | Preload Attributes}.
|
|
19
|
+
* If specified on a
|
|
20
|
+
* {@link https://getodk.github.io/xforms-spec/#bindings | binding}, this will
|
|
21
|
+
* be parsed to define:
|
|
22
|
+
*
|
|
23
|
+
* - {@link type}, a `jr:preload`
|
|
24
|
+
* - {@link parameter}, an associated `jr:preloadParams` value
|
|
25
|
+
*
|
|
26
|
+
* @todo It would probably make sense for the _definition_ to also convey:
|
|
27
|
+
*
|
|
28
|
+
* 1. Which {@link https://getodk.github.io/xforms-spec/#events | event} the
|
|
29
|
+
* preload is semantically associated with (noting that the spec may be a tad
|
|
30
|
+
* overzealous about this association).
|
|
31
|
+
*
|
|
32
|
+
* 2. The constant XPath expression (or other computation?) expressed by the
|
|
33
|
+
* combined {@link type} and {@link parameter}.
|
|
34
|
+
*/
|
|
35
|
+
export declare class BindPreloadDefinition<Type extends PreloadType> implements PreloadInput<Type> {
|
|
36
|
+
static from(bindElement: BindElement): AnyBindPreloadDefinition | null;
|
|
37
|
+
readonly type: Type;
|
|
38
|
+
readonly parameter: PreloadParameter<Type>;
|
|
39
|
+
private constructor();
|
|
40
|
+
}
|
|
41
|
+
export type AnyBindPreloadDefinition = BindPreloadDefinition<'uid'> | BindPreloadDefinition<'timestamp'> | BindPreloadDefinition<'property'> | BindPreloadDefinition<string>;
|
|
42
|
+
export {};
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { AnyBodyElementDefinition } from '../body/BodyDefinition.ts';
|
|
2
2
|
import { BindDefinition } from './BindDefinition.ts';
|
|
3
|
-
import {
|
|
3
|
+
import { NodeDefinitionType, ParentNodeDefinition, NodeDefinition } from './NodeDefinition.ts';
|
|
4
4
|
import { RootDefinition } from './RootDefinition.ts';
|
|
5
5
|
export type DescendentNodeType = Exclude<NodeDefinitionType, 'root'>;
|
|
6
6
|
type DescendentNodeBodyElement = AnyBodyElementDefinition;
|
|
7
|
-
export declare abstract class DescendentNodeDefinition<Type extends DescendentNodeType, BodyElement extends DescendentNodeBodyElement | null = DescendentNodeBodyElement | null>
|
|
8
|
-
readonly parent:
|
|
9
|
-
readonly bind: BindDefinition;
|
|
7
|
+
export declare abstract class DescendentNodeDefinition<Type extends DescendentNodeType, BodyElement extends DescendentNodeBodyElement | null = DescendentNodeBodyElement | null> extends NodeDefinition<Type> {
|
|
8
|
+
readonly parent: ParentNodeDefinition;
|
|
10
9
|
readonly bodyElement: BodyElement;
|
|
11
|
-
abstract readonly type: Type;
|
|
12
|
-
abstract readonly children: NodeChildren<Type>;
|
|
13
|
-
abstract readonly instances: NodeInstances<Type>;
|
|
14
|
-
abstract readonly defaultValue: NodeDefaultValue<Type>;
|
|
15
|
-
abstract readonly node: ModelNode<Type>;
|
|
16
|
-
abstract readonly nodeName: string;
|
|
17
10
|
readonly root: RootDefinition;
|
|
18
|
-
readonly nodeset: string;
|
|
19
11
|
readonly isTranslated: boolean;
|
|
20
|
-
constructor(parent:
|
|
12
|
+
constructor(parent: ParentNodeDefinition, bind: BindDefinition, bodyElement: BodyElement);
|
|
21
13
|
}
|
|
22
|
-
export type AnyDescendantNodeDefinition = DescendentNodeDefinition<any, any>;
|
|
23
14
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { XFormsItextTranslationElement, XFORMS_KNOWN_ATTRIBUTE, XFORMS_LOCAL_NAME } from '@getodk/xpath';
|
|
2
2
|
import { StaticElement } from '../../../integration/xpath/static-dom/StaticElement.ts';
|
|
3
|
-
|
|
3
|
+
import { ItextTranslationDefinition } from './ItextTranslationDefinition.ts';
|
|
4
|
+
export declare class ItextTranslationRootDefinition extends StaticElement<ItextTranslationDefinition> implements XFormsItextTranslationElement<ItextTranslationRootDefinition> {
|
|
4
5
|
readonly [XFORMS_LOCAL_NAME] = "translation";
|
|
5
6
|
readonly [XFORMS_KNOWN_ATTRIBUTE] = "lang";
|
|
6
7
|
getAttributeValue(localName: 'lang'): string;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { ValueType } from '../../client/ValueType.ts';
|
|
2
|
+
import { NamespaceDeclarationMap, NamedSubtreeDefinition } from '../../lib/names/NamespaceDeclarationMap.ts';
|
|
3
|
+
import { QualifiedName } from '../../lib/names/QualifiedName.ts';
|
|
2
4
|
import { AnyBodyElementDefinition, ControlElementDefinition } from '../body/BodyDefinition.ts';
|
|
3
5
|
import { BindDefinition } from './BindDefinition.ts';
|
|
4
6
|
import { DescendentNodeDefinition } from './DescendentNodeDefinition.ts';
|
|
5
|
-
import {
|
|
6
|
-
export declare class LeafNodeDefinition<V extends ValueType = ValueType> extends DescendentNodeDefinition<'leaf-node', ControlElementDefinition | null> implements
|
|
7
|
+
import { ParentNodeDefinition } from './NodeDefinition.ts';
|
|
8
|
+
export declare class LeafNodeDefinition<V extends ValueType = ValueType> extends DescendentNodeDefinition<'leaf-node', ControlElementDefinition | null> implements NamedSubtreeDefinition {
|
|
7
9
|
readonly node: Element;
|
|
8
10
|
readonly type = "leaf-node";
|
|
9
11
|
readonly valueType: V;
|
|
10
|
-
readonly
|
|
12
|
+
readonly namespaceDeclarations: NamespaceDeclarationMap;
|
|
13
|
+
readonly qualifiedName: QualifiedName;
|
|
11
14
|
readonly children: null;
|
|
12
15
|
readonly instances: null;
|
|
13
16
|
readonly defaultValue: string;
|
|
14
17
|
constructor(parent: ParentNodeDefinition, bind: BindDefinition, bodyElement: AnyBodyElementDefinition | null, node: Element);
|
|
15
|
-
toJSON(): Omit<this, "parent" | "
|
|
18
|
+
toJSON(): Omit<this, "parent" | "bind" | "toJSON" | "root" | "bodyElement">;
|
|
16
19
|
}
|
|
@@ -10,6 +10,6 @@ export declare class ModelBindMap extends Map<BindNodeset, BindDefinition> {
|
|
|
10
10
|
static fromModel(model: ModelDefinition): ModelBindMap;
|
|
11
11
|
protected constructor(form: XFormDefinition, model: ModelDefinition);
|
|
12
12
|
getOrCreateBindDefinition(nodeset: string): BindDefinition;
|
|
13
|
-
toJSON(): [string, BindDefinition<"string" | "boolean" | "time" | "
|
|
13
|
+
toJSON(): [string, BindDefinition<"string" | "boolean" | "time" | "barcode" | "binary" | "date" | "dateTime" | "decimal" | "geopoint" | "geoshape" | "geotrace" | "int" | "intent">][];
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NamedSubtreeDefinition, NamespaceDeclarationMap } from '../../lib/names/NamespaceDeclarationMap.ts';
|
|
2
|
+
import { QualifiedName } from '../../lib/names/QualifiedName.ts';
|
|
1
3
|
import { AnyBodyElementDefinition } from '../body/BodyDefinition.ts';
|
|
2
4
|
import { RepeatElementDefinition } from '../body/RepeatElementDefinition.ts';
|
|
3
5
|
import { BindDefinition } from './BindDefinition.ts';
|
|
@@ -48,26 +50,21 @@ export type NodeDefinitionType = RootNodeType | RepeatRangeType | RepeatTemplate
|
|
|
48
50
|
export type ParentNodeDefinition = RootDefinition | RepeatTemplateDefinition | RepeatInstanceDefinition | SubtreeDefinition;
|
|
49
51
|
export type ChildNodeDefinition = AnyRepeatRangeDefinition | LeafNodeDefinition | SubtreeDefinition;
|
|
50
52
|
export type ChildNodeInstanceDefinition = RepeatTemplateDefinition | RepeatInstanceDefinition | SubtreeDefinition | LeafNodeDefinition;
|
|
51
|
-
export
|
|
52
|
-
export type NodeInstances<Type extends NodeDefinitionType> = Type extends 'repeat-range' ? readonly RepeatInstanceDefinition[] : null;
|
|
53
|
-
export type NodeParent<Type extends NodeDefinitionType> = Type extends ChildNodeDefinition['type'] | ChildNodeInstanceDefinition['type'] ? ParentNodeDefinition : null;
|
|
54
|
-
export type ModelNode<Type extends NodeDefinitionType> = Type extends 'repeat-range' ? null : Element;
|
|
55
|
-
export type NodeDefaultValue<Type extends NodeDefinitionType> = Type extends 'leaf-node' ? string : null;
|
|
56
|
-
export interface NodeDefinition<Type extends NodeDefinitionType> {
|
|
57
|
-
readonly type: Type;
|
|
53
|
+
export declare abstract class NodeDefinition<Type extends NodeDefinitionType> implements NamedSubtreeDefinition {
|
|
58
54
|
readonly bind: BindDefinition;
|
|
55
|
+
abstract readonly type: Type;
|
|
56
|
+
abstract readonly namespaceDeclarations: NamespaceDeclarationMap;
|
|
57
|
+
abstract readonly qualifiedName: QualifiedName;
|
|
58
|
+
abstract readonly bodyElement: AnyBodyElementDefinition | RepeatElementDefinition | null;
|
|
59
|
+
abstract readonly isTranslated: boolean;
|
|
60
|
+
abstract readonly root: RootDefinition;
|
|
61
|
+
abstract readonly parent: ParentNodeDefinition | null;
|
|
62
|
+
abstract readonly children: readonly ChildNodeDefinition[] | null;
|
|
63
|
+
abstract readonly instances: readonly RepeatInstanceDefinition[] | null;
|
|
64
|
+
abstract readonly defaultValue: string | null;
|
|
65
|
+
/** @todo leaf-node may be Attr */
|
|
66
|
+
abstract readonly node: Element | null;
|
|
59
67
|
readonly nodeset: string;
|
|
60
|
-
|
|
61
|
-
readonly bodyElement: AnyBodyElementDefinition | RepeatElementDefinition | null;
|
|
62
|
-
readonly isTranslated: boolean;
|
|
63
|
-
readonly root: RootDefinition;
|
|
64
|
-
readonly parent: NodeParent<Type>;
|
|
65
|
-
readonly children: NodeChildren<Type>;
|
|
66
|
-
readonly instances: NodeInstances<Type>;
|
|
67
|
-
readonly node: ModelNode<Type>;
|
|
68
|
-
readonly defaultValue: NodeDefaultValue<Type>;
|
|
68
|
+
constructor(bind: BindDefinition);
|
|
69
69
|
}
|
|
70
70
|
export type AnyNodeDefinition = RootDefinition | AnyRepeatRangeDefinition | RepeatTemplateDefinition | RepeatInstanceDefinition | SubtreeDefinition | LeafNodeDefinition;
|
|
71
|
-
export type TypedNodeDefinition<Type> = Extract<AnyNodeDefinition, {
|
|
72
|
-
readonly type: Type;
|
|
73
|
-
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
1
2
|
import { AnyBodyElementDefinition } from '../body/BodyDefinition.ts';
|
|
2
3
|
import { InputControlDefinition } from '../body/control/InputControlDefinition.ts';
|
|
3
4
|
import { BindComputationExpression } from '../expression/BindComputationExpression.ts';
|
|
@@ -8,7 +9,7 @@ import { BindDefinition } from './BindDefinition.ts';
|
|
|
8
9
|
import { LeafNodeDefinition } from './LeafNodeDefinition.ts';
|
|
9
10
|
import { ParentNodeDefinition } from './NodeDefinition.ts';
|
|
10
11
|
export type NoteReadonlyDefinition = BindComputationExpression<'readonly'> & ConstantTruthyDependentExpression;
|
|
11
|
-
export interface NoteBindDefinition extends BindDefinition {
|
|
12
|
+
export interface NoteBindDefinition<V extends ValueType> extends BindDefinition<V> {
|
|
12
13
|
readonly readonly: NoteReadonlyDefinition;
|
|
13
14
|
}
|
|
14
15
|
export type NoteTextDefinition = LabelDefinition | HintDefinition;
|
|
@@ -21,10 +22,10 @@ export type NoteTextDefinition = LabelDefinition | HintDefinition;
|
|
|
21
22
|
* aspects of the node's interface (such as its {@link NoteNode.nodeType} and
|
|
22
23
|
* distinct {@link NoteNode.currentState} types) to handle note-specific logic.
|
|
23
24
|
*/
|
|
24
|
-
export declare class NoteNodeDefinition extends LeafNodeDefinition {
|
|
25
|
-
readonly bind: NoteBindDefinition
|
|
25
|
+
export declare class NoteNodeDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
26
|
+
readonly bind: NoteBindDefinition<V>;
|
|
26
27
|
readonly bodyElement: InputControlDefinition;
|
|
27
28
|
readonly noteTextDefinition: NoteTextDefinition;
|
|
28
|
-
static from(parent: ParentNodeDefinition, bind: BindDefinition
|
|
29
|
-
constructor(parent: ParentNodeDefinition, bind: NoteBindDefinition
|
|
29
|
+
static from<V extends ValueType>(parent: ParentNodeDefinition, bind: BindDefinition<V>, bodyElement: AnyBodyElementDefinition | null, node: Element): NoteNodeDefinition<V> | null;
|
|
30
|
+
constructor(parent: ParentNodeDefinition, bind: NoteBindDefinition<V>, bodyElement: InputControlDefinition, noteTextDefinition: NoteTextDefinition, node: Element);
|
|
30
31
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
2
|
+
import { RuntimeValue } from '../../lib/codecs/getSharedValueCodec.ts';
|
|
3
|
+
import { RangeControlBoundsDefinition, RangeControlDefinition } from '../body/control/RangeControlDefinition.ts';
|
|
4
|
+
import { BindDefinition } from './BindDefinition.ts';
|
|
5
|
+
import { LeafNodeDefinition } from './LeafNodeDefinition.ts';
|
|
6
|
+
import { ParentNodeDefinition } from './NodeDefinition.ts';
|
|
7
|
+
declare const RANGE_VALUE_TYPES: readonly ["decimal", "int"];
|
|
8
|
+
export type RangeValueType = (typeof RANGE_VALUE_TYPES)[number];
|
|
9
|
+
export interface RangeLeafNodeDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
10
|
+
readonly bodyElement: RangeControlDefinition;
|
|
11
|
+
}
|
|
12
|
+
declare class RangeNodeBoundsDefinition<V extends RangeValueType = RangeValueType> {
|
|
13
|
+
readonly min: NonNullable<RuntimeValue<V>>;
|
|
14
|
+
readonly max: NonNullable<RuntimeValue<V>>;
|
|
15
|
+
readonly step: NonNullable<RuntimeValue<V>>;
|
|
16
|
+
static from<V extends RangeValueType>(bounds: RangeControlBoundsDefinition, bind: BindDefinition<V>): RangeNodeBoundsDefinition<V>;
|
|
17
|
+
constructor(min: NonNullable<RuntimeValue<V>>, max: NonNullable<RuntimeValue<V>>, step: NonNullable<RuntimeValue<V>>);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @todo We should really consider making `LeafNodeDefinition` an abstract base
|
|
21
|
+
* class, and each node's definition an explicit concrete subclass of that. It
|
|
22
|
+
* would simplify a lot of things, reduce redundancy (and drift!) between
|
|
23
|
+
* various like `*Definition` types, and allow us to reason more clearly about
|
|
24
|
+
* what parse-product-input is used to construct each primary instance node.
|
|
25
|
+
* Furthermore, it would give us a great deal more flexibility to revisit some
|
|
26
|
+
* of the weaker parts of our current data model (e.g. splitting up selects).
|
|
27
|
+
*
|
|
28
|
+
* I explored this refactor as part of the prerequisite work to support range
|
|
29
|
+
* controls. I eventually backed out because it involved more churn than I felt
|
|
30
|
+
* comfortable with, but I do think we should keep an eye out for other
|
|
31
|
+
* opportunities to take on the churn.
|
|
32
|
+
*/
|
|
33
|
+
export declare class RangeNodeDefinition<V extends RangeValueType = RangeValueType> extends LeafNodeDefinition<V> implements RangeLeafNodeDefinition<V> {
|
|
34
|
+
readonly bind: BindDefinition<V>;
|
|
35
|
+
readonly bodyElement: RangeControlDefinition;
|
|
36
|
+
static from<V extends ValueType>(parent: ParentNodeDefinition, bind: BindDefinition<V>, bodyElement: RangeControlDefinition, node: Element): RangeNodeDefinition<Extract<V, RangeValueType>>;
|
|
37
|
+
readonly bounds: RangeNodeBoundsDefinition<V>;
|
|
38
|
+
private constructor();
|
|
39
|
+
}
|
|
40
|
+
export type AnyRangeNodeDefinition = RangeNodeDefinition<'decimal'> | RangeNodeDefinition<'int'>;
|
|
41
|
+
export {};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { NamespaceDeclarationMap } from '../../lib/names/NamespaceDeclarationMap.ts';
|
|
2
|
+
import { QualifiedName } from '../../lib/names/QualifiedName.ts';
|
|
1
3
|
import { RepeatElementDefinition } from '../body/RepeatElementDefinition.ts';
|
|
2
4
|
import { DescendentNodeDefinition } from './DescendentNodeDefinition.ts';
|
|
3
|
-
import { ChildNodeDefinition
|
|
5
|
+
import { ChildNodeDefinition } from './NodeDefinition.ts';
|
|
4
6
|
import { AnyRepeatRangeDefinition } from './RepeatRangeDefinition.ts';
|
|
5
|
-
export declare class RepeatInstanceDefinition extends DescendentNodeDefinition<'repeat-instance', RepeatElementDefinition>
|
|
7
|
+
export declare class RepeatInstanceDefinition extends DescendentNodeDefinition<'repeat-instance', RepeatElementDefinition> {
|
|
6
8
|
readonly node: Element;
|
|
7
9
|
readonly type = "repeat-instance";
|
|
8
|
-
readonly
|
|
10
|
+
readonly namespaceDeclarations: NamespaceDeclarationMap;
|
|
11
|
+
readonly qualifiedName: QualifiedName;
|
|
9
12
|
readonly children: readonly ChildNodeDefinition[];
|
|
10
13
|
readonly instances: null;
|
|
11
14
|
readonly defaultValue: null;
|
|
12
15
|
constructor(range: AnyRepeatRangeDefinition, node: Element);
|
|
13
|
-
toJSON(): Omit<this, "parent" | "
|
|
16
|
+
toJSON(): Omit<this, "parent" | "bind" | "toJSON" | "root" | "bodyElement">;
|
|
14
17
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { NamespaceDeclarationMap } from '../../lib/names/NamespaceDeclarationMap.ts';
|
|
2
|
+
import { QualifiedName } from '../../lib/names/QualifiedName.ts';
|
|
1
3
|
import { RepeatElementDefinition } from '../body/RepeatElementDefinition.ts';
|
|
2
4
|
import { RepeatCountControlExpression } from '../expression/RepeatCountControlExpression.ts';
|
|
3
5
|
import { BindDefinition } from './BindDefinition.ts';
|
|
4
6
|
import { DescendentNodeDefinition } from './DescendentNodeDefinition.ts';
|
|
5
|
-
import {
|
|
7
|
+
import { ParentNodeDefinition } from './NodeDefinition.ts';
|
|
6
8
|
import { RepeatInstanceDefinition } from './RepeatInstanceDefinition.ts';
|
|
7
9
|
import { RepeatTemplateDefinition } from './RepeatTemplateDefinition.ts';
|
|
8
10
|
export interface ControlledRepeatRangeDefinition extends RepeatRangeDefinition {
|
|
@@ -12,7 +14,7 @@ export interface UncontrolledRepeatRangeDefinition extends RepeatRangeDefinition
|
|
|
12
14
|
readonly count: null;
|
|
13
15
|
}
|
|
14
16
|
export type AnyRepeatRangeDefinition = ControlledRepeatRangeDefinition | UncontrolledRepeatRangeDefinition;
|
|
15
|
-
export declare class RepeatRangeDefinition extends DescendentNodeDefinition<'repeat-range', RepeatElementDefinition>
|
|
17
|
+
export declare class RepeatRangeDefinition extends DescendentNodeDefinition<'repeat-range', RepeatElementDefinition> {
|
|
16
18
|
static from(parent: ParentNodeDefinition, bind: BindDefinition, bodyElement: RepeatElementDefinition, modelNodes: readonly [Element, ...Element[]]): AnyRepeatRangeDefinition;
|
|
17
19
|
readonly type = "repeat-range";
|
|
18
20
|
readonly template: RepeatTemplateDefinition;
|
|
@@ -20,10 +22,11 @@ export declare class RepeatRangeDefinition extends DescendentNodeDefinition<'rep
|
|
|
20
22
|
readonly instances: RepeatInstanceDefinition[];
|
|
21
23
|
readonly count: RepeatCountControlExpression | null;
|
|
22
24
|
readonly node: null;
|
|
23
|
-
readonly
|
|
25
|
+
readonly namespaceDeclarations: NamespaceDeclarationMap;
|
|
26
|
+
readonly qualifiedName: QualifiedName;
|
|
24
27
|
readonly defaultValue: null;
|
|
25
28
|
private constructor();
|
|
26
29
|
isControlled(): this is ControlledRepeatRangeDefinition;
|
|
27
30
|
isUncontrolled(): this is UncontrolledRepeatRangeDefinition;
|
|
28
|
-
toJSON(): Omit<this, "parent" | "
|
|
31
|
+
toJSON(): Omit<this, "parent" | "bind" | "toJSON" | "root" | "bodyElement" | "isControlled" | "isUncontrolled">;
|
|
29
32
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { JAVAROSA_NAMESPACE_URI } from '../../../../common/src/constants/xmlns.ts';
|
|
2
|
+
import { NamespaceDeclarationMap } from '../../lib/names/NamespaceDeclarationMap.ts';
|
|
3
|
+
import { QualifiedName } from '../../lib/names/QualifiedName.ts';
|
|
2
4
|
import { RepeatElementDefinition } from '../body/RepeatElementDefinition.ts';
|
|
3
5
|
import { DescendentNodeDefinition } from './DescendentNodeDefinition.ts';
|
|
4
|
-
import { ChildNodeDefinition
|
|
6
|
+
import { ChildNodeDefinition } from './NodeDefinition.ts';
|
|
5
7
|
import { RepeatRangeDefinition } from './RepeatRangeDefinition.ts';
|
|
6
8
|
interface ExplicitRepeatTemplateElement extends Element {
|
|
7
9
|
getAttributeNS(namespaceURI: typeof JAVAROSA_NAMESPACE_URI, name: 'template'): string;
|
|
@@ -13,16 +15,17 @@ interface ParsedRepeatNodes {
|
|
|
13
15
|
readonly template: RepeatTemplateDefinition;
|
|
14
16
|
readonly instanceNodes: readonly Element[];
|
|
15
17
|
}
|
|
16
|
-
export declare class RepeatTemplateDefinition extends DescendentNodeDefinition<'repeat-template', RepeatElementDefinition>
|
|
18
|
+
export declare class RepeatTemplateDefinition extends DescendentNodeDefinition<'repeat-template', RepeatElementDefinition> {
|
|
17
19
|
protected readonly templateNode: ExplicitRepeatTemplateElement;
|
|
18
20
|
static parseModelNodes(range: RepeatRangeDefinition, modelNodes: readonly [Element, ...Element[]]): ParsedRepeatNodes;
|
|
19
21
|
readonly type = "repeat-template";
|
|
20
22
|
readonly node: Element;
|
|
21
|
-
readonly
|
|
23
|
+
readonly namespaceDeclarations: NamespaceDeclarationMap;
|
|
24
|
+
readonly qualifiedName: QualifiedName;
|
|
22
25
|
readonly children: readonly ChildNodeDefinition[];
|
|
23
26
|
readonly instances: null;
|
|
24
27
|
readonly defaultValue: null;
|
|
25
28
|
protected constructor(range: RepeatRangeDefinition, templateNode: ExplicitRepeatTemplateElement);
|
|
26
|
-
toJSON(): Omit<this, "parent" | "
|
|
29
|
+
toJSON(): Omit<this, "parent" | "bind" | "toJSON" | "root" | "bodyElement">;
|
|
27
30
|
}
|
|
28
31
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NamedNodeDefinition } from '../../lib/names/NamespaceDeclarationMap.ts';
|
|
2
|
+
import { QualifiedName } from '../../lib/names/QualifiedName.ts';
|
|
3
|
+
import { RootDefinition } from './RootDefinition.ts';
|
|
4
|
+
interface RootAttributeSource {
|
|
5
|
+
readonly namespaceURI: string | null;
|
|
6
|
+
readonly nodeName: string;
|
|
7
|
+
readonly prefix: string | null;
|
|
8
|
+
readonly localName: string;
|
|
9
|
+
readonly value: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @todo This class is named and typed to emphasize its intentionally narrow
|
|
13
|
+
* usage and purpose. It **intentionally** avoids addressing the much broader
|
|
14
|
+
* set of concerns around modeling attributes in primary instance/submissions.
|
|
15
|
+
*/
|
|
16
|
+
export declare class RootAttributeDefinition implements NamedNodeDefinition {
|
|
17
|
+
private readonly serializedXML;
|
|
18
|
+
readonly parent: RootDefinition;
|
|
19
|
+
readonly qualifiedName: QualifiedName;
|
|
20
|
+
readonly value: string;
|
|
21
|
+
constructor(root: RootDefinition, source: RootAttributeSource);
|
|
22
|
+
serializeAttributeXML(): string;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QualifiedName } from '../../lib/names/QualifiedName.ts';
|
|
2
|
+
import { RootAttributeDefinition } from './RootAttributeDefinition.ts';
|
|
3
|
+
import { RootDefinition } from './RootDefinition.ts';
|
|
4
|
+
/**
|
|
5
|
+
* @todo This can be trivially expanded to a narrowly general case when we
|
|
6
|
+
* prioritize work to
|
|
7
|
+
* {@link https://github.com/getodk/web-forms/issues/285 | support attributes}
|
|
8
|
+
* (as modeled form nodes on par with elements). It's been deferred here to
|
|
9
|
+
* avoid expanding scope of an already fairly large yak shave.
|
|
10
|
+
*
|
|
11
|
+
* @todo There's a **much more expansive** general case just waiting for a good
|
|
12
|
+
* opportuntity to prioritize it. E.g. a `NamedNodeMap<T>`, where T is any
|
|
13
|
+
* generalized concept of a named node. This expansive generalization would have
|
|
14
|
+
* a ton of value in a variety of known performance optimization
|
|
15
|
+
* targets/solutions (i.e. optimizing the most redundant, suboptimal, frequently
|
|
16
|
+
* performed aspects of any typical XPath expression in a typical XForm).
|
|
17
|
+
*
|
|
18
|
+
* @see {@link QualifiedName} for more detail.
|
|
19
|
+
*/
|
|
20
|
+
export declare class RootAttributeMap extends Map<QualifiedName, RootAttributeDefinition> {
|
|
21
|
+
static from(root: RootDefinition, domRootSourceElement: Element): RootAttributeMap;
|
|
22
|
+
private constructor();
|
|
23
|
+
}
|