@getodk/xforms-engine 0.2.0 → 0.3.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/body/BodyElementDefinition.d.ts +4 -3
- package/dist/body/RepeatElementDefinition.d.ts +2 -2
- package/dist/body/control/ControlDefinition.d.ts +2 -2
- package/dist/body/control/select/ItemDefinition.d.ts +2 -2
- package/dist/body/control/select/ItemsetDefinition.d.ts +5 -4
- package/dist/body/group/BaseGroupDefinition.d.ts +1 -1
- package/dist/body/group/PresentationGroupDefinition.d.ts +1 -1
- package/dist/client/BaseNode.d.ts +68 -2
- package/dist/client/GroupNode.d.ts +2 -0
- package/dist/client/ModelValueNode.d.ts +37 -0
- package/dist/client/NoteNode.d.ts +53 -0
- package/dist/client/RootNode.d.ts +2 -0
- package/dist/client/SelectNode.d.ts +5 -3
- package/dist/client/StringNode.d.ts +5 -3
- package/dist/client/SubtreeNode.d.ts +2 -0
- package/dist/client/TextRange.d.ts +85 -2
- package/dist/client/constants.d.ts +9 -0
- package/dist/client/hierarchy.d.ts +14 -9
- package/dist/client/node-types.d.ts +2 -1
- package/dist/client/{RepeatRangeNode.d.ts → repeat/BaseRepeatRangeNode.d.ts} +18 -17
- package/dist/client/{RepeatInstanceNode.d.ts → repeat/RepeatInstanceNode.d.ts} +9 -8
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +19 -0
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +20 -0
- package/dist/client/validation.d.ts +163 -0
- package/dist/expression/DependentExpression.d.ts +12 -8
- package/dist/index.d.ts +9 -4
- package/dist/index.js +2635 -678
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +3 -1
- package/dist/instance/ModelValue.d.ts +40 -0
- package/dist/instance/Note.d.ts +42 -0
- package/dist/instance/Root.d.ts +2 -0
- package/dist/instance/SelectField.d.ts +10 -4
- package/dist/instance/StringField.d.ts +11 -5
- package/dist/instance/Subtree.d.ts +2 -0
- package/dist/instance/abstract/DescendantNode.d.ts +5 -6
- package/dist/instance/abstract/InstanceNode.d.ts +2 -0
- package/dist/instance/hierarchy.d.ts +10 -5
- package/dist/instance/internal-api/ValidationContext.d.ts +21 -0
- package/dist/instance/{RepeatRange.d.ts → repeat/BaseRepeatRange.d.ts} +46 -45
- package/dist/instance/{RepeatInstance.d.ts → repeat/RepeatInstance.d.ts} +13 -12
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +16 -0
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +35 -0
- package/dist/instance/text/TextRange.d.ts +4 -4
- package/dist/lib/reactivity/createComputedExpression.d.ts +6 -1
- package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +5 -0
- package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +1 -1
- package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +1 -1
- package/dist/lib/reactivity/text/createFieldHint.d.ts +3 -3
- package/dist/lib/reactivity/text/createNodeLabel.d.ts +2 -2
- package/dist/lib/reactivity/text/createNoteText.d.ts +25 -0
- package/dist/lib/reactivity/text/createTextRange.d.ts +5 -7
- package/dist/lib/reactivity/validation/createAggregatedViolations.d.ts +9 -0
- package/dist/lib/reactivity/validation/createValidation.d.ts +18 -0
- package/dist/model/BindDefinition.d.ts +4 -2
- package/dist/model/BindElement.d.ts +1 -0
- package/dist/model/{ValueNodeDefinition.d.ts → LeafNodeDefinition.d.ts} +2 -2
- package/dist/model/NodeDefinition.d.ts +8 -8
- package/dist/model/RepeatInstanceDefinition.d.ts +2 -2
- package/dist/model/RepeatRangeDefinition.d.ts +14 -4
- package/dist/parse/NoteNodeDefinition.d.ts +31 -0
- package/dist/parse/expression/RepeatCountControlExpression.d.ts +19 -0
- package/dist/parse/text/HintDefinition.d.ts +9 -0
- package/dist/parse/text/ItemLabelDefinition.d.ts +9 -0
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +13 -0
- package/dist/parse/text/LabelDefinition.d.ts +15 -0
- package/dist/parse/text/MessageDefinition.d.ts +15 -0
- package/dist/parse/text/OutputChunkDefinition.d.ts +8 -0
- package/dist/parse/text/ReferenceChunkDefinition.d.ts +8 -0
- package/dist/parse/text/StaticTextChunkDefinition.d.ts +10 -0
- package/dist/parse/text/TranslationChunkDefinition.d.ts +9 -0
- package/dist/parse/text/abstract/TextChunkDefinition.d.ts +18 -0
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +23 -0
- package/dist/parse/text/abstract/TextRangeDefinition.d.ts +35 -0
- package/dist/parse/xpath/dependency-analysis.d.ts +40 -0
- package/dist/parse/xpath/path-resolution.d.ts +70 -0
- package/dist/parse/xpath/predicate-analysis.d.ts +30 -0
- package/dist/parse/xpath/reference-parsing.d.ts +18 -0
- package/dist/parse/xpath/semantic-analysis.d.ts +98 -0
- package/dist/parse/xpath/syntax-traversal.d.ts +69 -0
- package/dist/solid.js +2636 -679
- package/dist/solid.js.map +1 -1
- package/package.json +14 -15
- package/src/body/BodyElementDefinition.ts +4 -3
- package/src/body/RepeatElementDefinition.ts +5 -17
- package/src/body/control/ControlDefinition.ts +4 -3
- package/src/body/control/select/ItemDefinition.ts +3 -3
- package/src/body/control/select/ItemsetDefinition.ts +29 -12
- package/src/body/control/select/ItemsetNodesetExpression.ts +1 -1
- package/src/body/group/BaseGroupDefinition.ts +3 -2
- package/src/body/group/PresentationGroupDefinition.ts +1 -1
- package/src/client/BaseNode.ts +73 -7
- package/src/client/GroupNode.ts +2 -0
- package/src/client/ModelValueNode.ts +40 -0
- package/src/client/NoteNode.ts +74 -0
- package/src/client/README.md +1 -0
- package/src/client/RootNode.ts +2 -0
- package/src/client/SelectNode.ts +5 -3
- package/src/client/StringNode.ts +5 -3
- package/src/client/SubtreeNode.ts +2 -0
- package/src/client/TextRange.ts +99 -2
- package/src/client/constants.ts +10 -0
- package/src/client/hierarchy.ts +30 -14
- package/src/client/node-types.ts +8 -1
- 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/validation.ts +199 -0
- package/src/expression/DependentExpression.ts +45 -27
- package/src/index.ts +15 -8
- 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 +9 -3
- package/src/instance/SelectField.ts +28 -6
- package/src/instance/StringField.ts +35 -9
- package/src/instance/Subtree.ts +9 -3
- package/src/instance/abstract/DescendantNode.ts +6 -7
- package/src/instance/abstract/InstanceNode.ts +20 -6
- package/src/instance/children.ts +42 -15
- package/src/instance/hierarchy.ts +21 -2
- package/src/instance/internal-api/ValidationContext.ts +23 -0
- 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/lib/reactivity/createComputedExpression.ts +22 -24
- package/src/lib/reactivity/createNoteReadonlyThunk.ts +33 -0
- package/src/lib/reactivity/createSelectItems.ts +21 -14
- package/src/lib/reactivity/node-state/createSharedNodeState.ts +1 -1
- package/src/lib/reactivity/text/createFieldHint.ts +9 -7
- package/src/lib/reactivity/text/createNodeLabel.ts +7 -5
- 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 +70 -0
- package/src/lib/reactivity/validation/createValidation.ts +196 -0
- package/src/model/BindComputation.ts +0 -4
- package/src/model/BindDefinition.ts +8 -6
- package/src/model/BindElement.ts +1 -0
- package/src/model/{ValueNodeDefinition.ts → LeafNodeDefinition.ts} +4 -4
- package/src/model/ModelBindMap.ts +4 -0
- package/src/model/NodeDefinition.ts +12 -12
- package/src/model/RepeatInstanceDefinition.ts +2 -2
- package/src/model/RepeatRangeDefinition.ts +49 -8
- package/src/model/RootDefinition.ts +7 -3
- package/src/parse/NoteNodeDefinition.ts +70 -0
- package/src/parse/TODO.md +3 -0
- package/src/parse/expression/RepeatCountControlExpression.ts +44 -0
- 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/OutputChunkDefinition.ts +25 -0
- package/src/parse/text/ReferenceChunkDefinition.ts +14 -0
- package/src/parse/text/StaticTextChunkDefinition.ts +19 -0
- package/src/parse/text/TranslationChunkDefinition.ts +38 -0
- package/src/parse/text/abstract/TextChunkDefinition.ts +38 -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/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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
2
2
|
import { DependencyContext } from '../expression/DependencyContext.ts';
|
|
3
|
+
import { HintDefinition } from '../parse/text/HintDefinition.ts';
|
|
4
|
+
import { ItemLabelDefinition } from '../parse/text/ItemLabelDefinition.ts';
|
|
5
|
+
import { LabelDefinition } from '../parse/text/LabelDefinition.ts';
|
|
3
6
|
import { BodyElementParentContext } from './BodyDefinition.ts';
|
|
4
|
-
import { HintDefinition } from './text/HintDefinition.ts';
|
|
5
|
-
import { LabelDefinition } from './text/LabelDefinition.ts';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* These category names roughly correspond to each of the ODK XForms spec's
|
|
@@ -18,7 +19,7 @@ export declare abstract class BodyElementDefinition<Type extends string> extends
|
|
|
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,8 +1,8 @@
|
|
|
1
1
|
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
2
|
+
import { LabelDefinition } from '../parse/text/LabelDefinition.ts';
|
|
2
3
|
import { BodyElementDefinitionArray, BodyElementParentContext } from './BodyDefinition.ts';
|
|
3
4
|
import { BodyElementDefinition } from './BodyElementDefinition.ts';
|
|
4
5
|
import { StructureElementAppearanceDefinition } from './appearance/structureElementAppearanceParser.ts';
|
|
5
|
-
import { LabelDefinition } from './text/LabelDefinition.ts';
|
|
6
6
|
|
|
7
7
|
export declare class RepeatElementDefinition extends BodyElementDefinition<'repeat'> {
|
|
8
8
|
static isCompatible(localName: string): boolean;
|
|
@@ -12,7 +12,7 @@ export declare class RepeatElementDefinition extends BodyElementDefinition<'repe
|
|
|
12
12
|
readonly appearances: StructureElementAppearanceDefinition;
|
|
13
13
|
readonly label: LabelDefinition | null;
|
|
14
14
|
readonly countExpression: string | null;
|
|
15
|
-
readonly
|
|
15
|
+
readonly noAddRemoveExpression: string | null;
|
|
16
16
|
readonly children: BodyElementDefinitionArray;
|
|
17
17
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
18
18
|
toJSON(): Omit<this, "toJSON" | "form" | "parent" | "isTranslated" | "registerDependentExpression" | "dependencyExpressions">;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
2
|
import { ParsedTokenList } from '../../lib/TokenListParser.ts';
|
|
3
|
+
import { HintDefinition } from '../../parse/text/HintDefinition.ts';
|
|
4
|
+
import { LabelDefinition } from '../../parse/text/LabelDefinition.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
7
|
|
|
8
8
|
type ControlType = 'input' | 'range' | 'rank' | 'select' | 'select1' | 'trigger' | 'upload';
|
|
9
9
|
export declare abstract class ControlDefinition<Type extends ControlType> extends BodyElementDefinition<Type> {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ItemElement } from '../../../lib/dom/query.ts';
|
|
2
|
+
import { ItemLabelDefinition } from '../../../parse/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
6
|
|
|
7
7
|
export declare class ItemDefinition extends BodyElementDefinition<'item'> {
|
|
8
8
|
readonly parent: AnySelectDefinition;
|
|
9
9
|
readonly category = "support";
|
|
10
10
|
readonly type = "item";
|
|
11
|
-
readonly label:
|
|
11
|
+
readonly label: ItemLabelDefinition | null;
|
|
12
12
|
readonly value: string;
|
|
13
13
|
constructor(form: XFormDefinition, parent: AnySelectDefinition, element: ItemElement);
|
|
14
14
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { ItemsetElement } from '../../../lib/dom/query.ts';
|
|
2
1
|
import { XFormDefinition } from '../../../XFormDefinition.ts';
|
|
2
|
+
import { ItemsetElement } from '../../../lib/dom/query.ts';
|
|
3
|
+
import { ItemsetLabelDefinition } from '../../../parse/text/ItemsetLabelDefinition.ts';
|
|
3
4
|
import { BodyElementDefinition } from '../../BodyElementDefinition.ts';
|
|
4
|
-
import { LabelDefinition } from '../../text/LabelDefinition.ts';
|
|
5
5
|
import { ItemsetNodesetExpression } from './ItemsetNodesetExpression.ts';
|
|
6
6
|
import { ItemsetValueExpression } from './ItemsetValueExpression.ts';
|
|
7
7
|
import { AnySelectDefinition } from './SelectDefinition.ts';
|
|
8
8
|
|
|
9
9
|
export declare class ItemsetDefinition extends BodyElementDefinition<'itemset'> {
|
|
10
|
+
readonly parent: AnySelectDefinition;
|
|
10
11
|
readonly category = "support";
|
|
11
12
|
readonly type = "itemset";
|
|
12
13
|
readonly reference: string;
|
|
13
|
-
readonly label:
|
|
14
|
+
readonly label: ItemsetLabelDefinition | null;
|
|
14
15
|
readonly nodes: ItemsetNodesetExpression;
|
|
15
16
|
readonly value: ItemsetValueExpression;
|
|
16
|
-
constructor(form: XFormDefinition,
|
|
17
|
+
constructor(form: XFormDefinition, parent: AnySelectDefinition, element: ItemsetElement);
|
|
17
18
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import { LabelDefinition } from '../../parse/text/LabelDefinition.ts';
|
|
2
3
|
import { BodyElementDefinitionArray, BodyElementParentContext } from '../BodyDefinition.ts';
|
|
3
4
|
import { BodyElementDefinition } from '../BodyElementDefinition.ts';
|
|
4
5
|
import { StructureElementAppearanceDefinition } from '../appearance/structureElementAppearanceParser.ts';
|
|
5
|
-
import { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* These type names are derived from **and expand upon** the language used in
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
+
import { LabelDefinition } from '../../parse/text/LabelDefinition.ts';
|
|
2
3
|
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
3
|
-
import { LabelDefinition } from '../text/LabelDefinition.ts';
|
|
4
4
|
import { BaseGroupDefinition } from './BaseGroupDefinition.ts';
|
|
5
5
|
|
|
6
6
|
export declare class PresentationGroupDefinition extends BaseGroupDefinition<'presentation-group'> {
|
|
@@ -2,6 +2,7 @@ import { AnyNodeDefinition } from '../model/NodeDefinition.ts';
|
|
|
2
2
|
import { NodeAppearances } from './NodeAppearances.ts';
|
|
3
3
|
import { TextRange } from './TextRange.ts';
|
|
4
4
|
import { InstanceNodeType } from './node-types.ts';
|
|
5
|
+
import { NodeValidationState } from './validation.ts';
|
|
5
6
|
|
|
6
7
|
export interface BaseNodeState {
|
|
7
8
|
/**
|
|
@@ -38,6 +39,17 @@ export interface BaseNodeState {
|
|
|
38
39
|
* {@link BaseNode.parent | parent node}.
|
|
39
40
|
*/
|
|
40
41
|
get relevant(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Specifies whether the node must have a non-blank value to be valid (see
|
|
44
|
+
* {@link value} for details).
|
|
45
|
+
*
|
|
46
|
+
* @see {@link https://getodk.github.io/xforms-spec/#bind-attributes}
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*
|
|
50
|
+
* @todo What is the expected behavior of `required` expressions defined for
|
|
51
|
+
* non-leaf/value nodes?
|
|
52
|
+
*/
|
|
41
53
|
get required(): boolean;
|
|
42
54
|
/**
|
|
43
55
|
* Interfaces for nodes which cannot provide a label should override this to
|
|
@@ -91,6 +103,14 @@ export interface BaseNodeState {
|
|
|
91
103
|
*
|
|
92
104
|
* Parent nodes, i.e. nodes which can contain {@link children}, do not store a
|
|
93
105
|
* value state. For those nodes, their value state should always be `null`.
|
|
106
|
+
*
|
|
107
|
+
* A node's value is considered "blank" when its primary instance state is an
|
|
108
|
+
* empty string, and it is considered "non-blank" otherwise. The engine may
|
|
109
|
+
* represent node values according to aspects of the node's definition (such
|
|
110
|
+
* as its defined data type, its associated control type if any). The node's
|
|
111
|
+
* value being blank or non-blank may contribute to satisfying conditions of
|
|
112
|
+
* the node's validity ({@link constraint}, {@link required}). Otherwise, it
|
|
113
|
+
* is an internal engine consideration.
|
|
94
114
|
*/
|
|
95
115
|
get value(): unknown;
|
|
96
116
|
}
|
|
@@ -136,9 +156,55 @@ export interface BaseNode {
|
|
|
136
156
|
*/
|
|
137
157
|
readonly parent: BaseNode | null;
|
|
138
158
|
/**
|
|
139
|
-
* Each node provides a discrete object representing the stateful aspects of
|
|
140
|
-
* that node which will change over time. When a client provides a
|
|
159
|
+
* Each node provides a discrete object representing the stateful aspects\* of
|
|
160
|
+
* that node which will change over time. When a client provides a
|
|
161
|
+
* {@link OpaqueReactiveObjectFactory}, the engine will update the properties
|
|
162
|
+
* of this object as their respective states change, so a client can implement
|
|
163
|
+
* reactive updates that respond to changes as they occur.
|
|
164
|
+
*
|
|
165
|
+
* \* This includes state which is either client-/user-mutable, or state which
|
|
166
|
+
* is computed based on the core XForms computation model. Each node also
|
|
167
|
+
* exposes {@link validationState}, which reflects the validity of the
|
|
168
|
+
* node, or its descendants.
|
|
141
169
|
*/
|
|
142
170
|
readonly currentState: BaseNodeState;
|
|
171
|
+
/**
|
|
172
|
+
* Represents the validation state of a the node itself, or its descendants.
|
|
173
|
+
*
|
|
174
|
+
* @see {@link AncestorNodeValidationState} and
|
|
175
|
+
* {@link LeafNodeValidationState} for additional details.
|
|
176
|
+
*
|
|
177
|
+
* While filling a form (i.e. prior to submission), validation state can be
|
|
178
|
+
* viewed as computed metadata about the form state. The validation conditions
|
|
179
|
+
* and their violation messages produced by a node _may be computed on
|
|
180
|
+
* demand_. Clients should assume:
|
|
181
|
+
*
|
|
182
|
+
* 1. Validation state **will be current** when directly read by the client.
|
|
183
|
+
* Accessing validation state _may_ invoke engine computation of that state
|
|
184
|
+
* _at that time_.
|
|
185
|
+
*
|
|
186
|
+
* It **may** also be pre-computed by the engine so that direct reads are
|
|
187
|
+
* less computationally expensive, but such optimizations cannot be
|
|
188
|
+
* guaranteed by the engine at this time.
|
|
189
|
+
*
|
|
190
|
+
* 2. For clients providing an {@link OpaqueReactiveObjectFactory}, accessing
|
|
191
|
+
* validation state within a reactive context **will produce updates** to
|
|
192
|
+
* the validation state, as long as the client retains a subscription to
|
|
193
|
+
* that state.
|
|
194
|
+
*
|
|
195
|
+
* If it is possible to detect interruption of such client- reactive
|
|
196
|
+
* subscriptions, the engine _may defer computations_ until subsequent
|
|
197
|
+
* client read/re-subscription, in order to reduce unnecessary
|
|
198
|
+
* computational overhead. Again, such optimizations cannot be guaranteed
|
|
199
|
+
* by the engine at this time.
|
|
200
|
+
*
|
|
201
|
+
* @todo it's easier to conceive a reliable, general solution to optimizing
|
|
202
|
+
* the direct read case, than it is for the client-reactive case (largely
|
|
203
|
+
* because our solution for client reactivity is intentionally opaque). If it
|
|
204
|
+
* turns out that such optimizations are crucial for overall usability, the
|
|
205
|
+
* client-reactive case may best be served by additional APIs for reactive
|
|
206
|
+
* clients to explicitly pause and resume recomputation.
|
|
207
|
+
*/
|
|
208
|
+
readonly validationState: NodeValidationState;
|
|
143
209
|
}
|
|
144
210
|
export {};
|
|
@@ -4,6 +4,7 @@ import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
|
4
4
|
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
5
|
import { RootNode } from './RootNode.ts';
|
|
6
6
|
import { GeneralChildNode, GeneralParentNode } from './hierarchy.ts';
|
|
7
|
+
import { AncestorNodeValidationState } from './validation.ts';
|
|
7
8
|
|
|
8
9
|
export interface GroupNodeState extends BaseNodeState {
|
|
9
10
|
get hint(): null;
|
|
@@ -25,4 +26,5 @@ export interface GroupNode extends BaseNode {
|
|
|
25
26
|
readonly root: RootNode;
|
|
26
27
|
readonly parent: GeneralParentNode;
|
|
27
28
|
readonly currentState: GroupNodeState;
|
|
29
|
+
readonly validationState: AncestorNodeValidationState;
|
|
28
30
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LeafNodeDefinition } from '../model/LeafNodeDefinition.ts';
|
|
2
|
+
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
3
|
+
import { GeneralParentNode } from './hierarchy.ts';
|
|
4
|
+
import { RootNode } from './RootNode.ts';
|
|
5
|
+
import { LeafNodeValidationState } from './validation.ts';
|
|
6
|
+
|
|
7
|
+
export interface ModelValueNodeState extends BaseNodeState {
|
|
8
|
+
get label(): null;
|
|
9
|
+
get hint(): null;
|
|
10
|
+
get children(): null;
|
|
11
|
+
get valueOptions(): null;
|
|
12
|
+
/**
|
|
13
|
+
* Reflects the current value of a {@link ModelValueNode}. This value may be
|
|
14
|
+
* populated when a form is loaded, and it may be updated by certain
|
|
15
|
+
* computations defined by the form.
|
|
16
|
+
*/
|
|
17
|
+
get value(): string;
|
|
18
|
+
}
|
|
19
|
+
export interface ModelValueDefinition extends LeafNodeDefinition {
|
|
20
|
+
readonly bodyElement: null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A node which is:
|
|
24
|
+
*
|
|
25
|
+
* - model-only (i.e. it has no corresponding body element)
|
|
26
|
+
* - a leaf/value node (i.e. it has no element children; it may be defined in
|
|
27
|
+
* the form's `<model>` as either an {@link Element} or {@link Attr})
|
|
28
|
+
*/
|
|
29
|
+
export interface ModelValueNode extends BaseNode {
|
|
30
|
+
readonly nodeType: 'model-value';
|
|
31
|
+
readonly appearances: null;
|
|
32
|
+
readonly definition: ModelValueDefinition;
|
|
33
|
+
readonly root: RootNode;
|
|
34
|
+
readonly parent: GeneralParentNode;
|
|
35
|
+
readonly currentState: ModelValueNodeState;
|
|
36
|
+
readonly validationState: LeafNodeValidationState;
|
|
37
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { InputDefinition } from '../body/control/InputDefinition.ts';
|
|
2
|
+
import { LeafNodeDefinition } from '../model/LeafNodeDefinition.ts';
|
|
3
|
+
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
|
+
import { GeneralParentNode } from './hierarchy.ts';
|
|
5
|
+
import { NodeAppearances } from './NodeAppearances.ts';
|
|
6
|
+
import { RootNode } from './RootNode.ts';
|
|
7
|
+
import { TextRange } from './TextRange.ts';
|
|
8
|
+
import { LeafNodeValidationState } from './validation.ts';
|
|
9
|
+
|
|
10
|
+
export interface NoteNodeState extends BaseNodeState {
|
|
11
|
+
/**
|
|
12
|
+
* Note-specific specialization: a note will always have a non-null value in
|
|
13
|
+
* at least one of:
|
|
14
|
+
*
|
|
15
|
+
* - {@link label}
|
|
16
|
+
* - {@link hint}
|
|
17
|
+
*
|
|
18
|
+
* This is an alias to whichever is present, with precedent to {@link label}
|
|
19
|
+
* if both are present.
|
|
20
|
+
*/
|
|
21
|
+
get noteText(): NonNullable<this['label'] | this['hint']>;
|
|
22
|
+
/**
|
|
23
|
+
* A note will **always** be `readonly`.
|
|
24
|
+
*/
|
|
25
|
+
readonly readonly: true;
|
|
26
|
+
get label(): TextRange<'label', 'form'> | null;
|
|
27
|
+
get hint(): TextRange<'hint', 'form'> | null;
|
|
28
|
+
get children(): null;
|
|
29
|
+
get valueOptions(): null;
|
|
30
|
+
/**
|
|
31
|
+
* Reflects the readonly value of a {@link NoteNode}, or `null` if blank.
|
|
32
|
+
*/
|
|
33
|
+
get value(): string | null;
|
|
34
|
+
}
|
|
35
|
+
export interface NoteDefinition extends LeafNodeDefinition {
|
|
36
|
+
readonly bodyElement: InputDefinition;
|
|
37
|
+
}
|
|
38
|
+
export type NoteNodeAppearances = NodeAppearances<NoteDefinition>;
|
|
39
|
+
/**
|
|
40
|
+
* A node which is:
|
|
41
|
+
*
|
|
42
|
+
* - associated with an input, with at least one text element (label or hint)
|
|
43
|
+
* - guaranteed to be {@link NoteNodeState.readonly | readonly}
|
|
44
|
+
*/
|
|
45
|
+
export interface NoteNode extends BaseNode {
|
|
46
|
+
readonly nodeType: 'note';
|
|
47
|
+
readonly appearances: NoteNodeAppearances;
|
|
48
|
+
readonly definition: NoteDefinition;
|
|
49
|
+
readonly root: RootNode;
|
|
50
|
+
readonly parent: GeneralParentNode;
|
|
51
|
+
readonly currentState: NoteNodeState;
|
|
52
|
+
readonly validationState: LeafNodeValidationState;
|
|
53
|
+
}
|
|
@@ -3,6 +3,7 @@ import { RootDefinition } from '../model/RootDefinition.ts';
|
|
|
3
3
|
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
4
|
import { ActiveLanguage, FormLanguage, FormLanguages } from './FormLanguage.ts';
|
|
5
5
|
import { GeneralChildNode } from './hierarchy.ts';
|
|
6
|
+
import { AncestorNodeValidationState } from './validation.ts';
|
|
6
7
|
|
|
7
8
|
export interface RootNodeState extends BaseNodeState {
|
|
8
9
|
/**
|
|
@@ -42,6 +43,7 @@ export interface RootNode extends BaseNode {
|
|
|
42
43
|
readonly root: RootNode;
|
|
43
44
|
readonly parent: null;
|
|
44
45
|
readonly currentState: RootNodeState;
|
|
46
|
+
readonly validationState: AncestorNodeValidationState;
|
|
45
47
|
/**
|
|
46
48
|
* @todo as with {@link RootNodeState.activeLanguage}, this is the most
|
|
47
49
|
* significant break in consistency across node types.
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AnySelectDefinition } from '../body/control/select/SelectDefinition.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { LeafNodeDefinition } from '../model/LeafNodeDefinition.ts';
|
|
3
3
|
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
4
|
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
5
|
import { RootNode } from './RootNode.ts';
|
|
6
6
|
import { TextRange } from './TextRange.ts';
|
|
7
7
|
import { GeneralParentNode } from './hierarchy.ts';
|
|
8
|
+
import { LeafNodeValidationState } from './validation.ts';
|
|
8
9
|
|
|
9
10
|
export interface SelectItem {
|
|
10
11
|
get value(): string;
|
|
11
|
-
get label(): TextRange<'label'> | null;
|
|
12
|
+
get label(): TextRange<'item-label'> | null;
|
|
12
13
|
}
|
|
13
14
|
export interface SelectNodeState extends BaseNodeState {
|
|
14
15
|
get children(): null;
|
|
@@ -30,7 +31,7 @@ export interface SelectNodeState extends BaseNodeState {
|
|
|
30
31
|
*/
|
|
31
32
|
get value(): readonly SelectItem[];
|
|
32
33
|
}
|
|
33
|
-
export interface SelectDefinition extends
|
|
34
|
+
export interface SelectDefinition extends LeafNodeDefinition {
|
|
34
35
|
readonly bodyElement: AnySelectDefinition;
|
|
35
36
|
}
|
|
36
37
|
export type SelectNodeAppearances = NodeAppearances<SelectDefinition>;
|
|
@@ -41,6 +42,7 @@ export interface SelectNode extends BaseNode {
|
|
|
41
42
|
readonly root: RootNode;
|
|
42
43
|
readonly parent: GeneralParentNode;
|
|
43
44
|
readonly currentState: SelectNodeState;
|
|
45
|
+
readonly validationState: LeafNodeValidationState;
|
|
44
46
|
/**
|
|
45
47
|
* For use by a client to update the selection of a select node where:
|
|
46
48
|
*
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { InputDefinition } from '../body/control/InputDefinition.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { LeafNodeDefinition } from '../model/LeafNodeDefinition.ts';
|
|
3
3
|
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
4
|
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
5
|
import { RootNode } from './RootNode.ts';
|
|
6
6
|
import { GeneralParentNode } from './hierarchy.ts';
|
|
7
|
+
import { LeafNodeValidationState } from './validation.ts';
|
|
7
8
|
|
|
8
9
|
export interface StringNodeState extends BaseNodeState {
|
|
9
10
|
get children(): null;
|
|
@@ -16,8 +17,8 @@ export interface StringNodeState extends BaseNodeState {
|
|
|
16
17
|
*/
|
|
17
18
|
get value(): string;
|
|
18
19
|
}
|
|
19
|
-
export interface StringDefinition extends
|
|
20
|
-
readonly bodyElement: InputDefinition
|
|
20
|
+
export interface StringDefinition extends LeafNodeDefinition {
|
|
21
|
+
readonly bodyElement: InputDefinition;
|
|
21
22
|
}
|
|
22
23
|
export type StringNodeAppearances = NodeAppearances<StringDefinition>;
|
|
23
24
|
/**
|
|
@@ -34,6 +35,7 @@ export interface StringNode extends BaseNode {
|
|
|
34
35
|
readonly root: RootNode;
|
|
35
36
|
readonly parent: GeneralParentNode;
|
|
36
37
|
readonly currentState: StringNodeState;
|
|
38
|
+
readonly validationState: LeafNodeValidationState;
|
|
37
39
|
/**
|
|
38
40
|
* For use by a client to update the value of a string node.
|
|
39
41
|
*
|
|
@@ -2,6 +2,7 @@ import { SubtreeDefinition as BaseSubtreeDefinition } from '../model/SubtreeDefi
|
|
|
2
2
|
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
3
3
|
import { RootNode } from './RootNode.ts';
|
|
4
4
|
import { GeneralChildNode, GeneralParentNode } from './hierarchy.ts';
|
|
5
|
+
import { AncestorNodeValidationState } from './validation.ts';
|
|
5
6
|
|
|
6
7
|
export interface SubtreeNodeState extends BaseNodeState {
|
|
7
8
|
get label(): null;
|
|
@@ -51,4 +52,5 @@ export interface SubtreeNode extends BaseNode {
|
|
|
51
52
|
readonly root: RootNode;
|
|
52
53
|
readonly parent: GeneralParentNode;
|
|
53
54
|
readonly currentState: SubtreeNodeState;
|
|
55
|
+
readonly validationState: AncestorNodeValidationState;
|
|
54
56
|
}
|
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
import { ActiveLanguage } from './FormLanguage.ts';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* **COMMENTARY**
|
|
5
|
+
*
|
|
6
|
+
* The spec makes naming and mapping these cases a bit more complex than would
|
|
7
|
+
* be ideal. The intent is to clearly identify distinct text definitions (and
|
|
8
|
+
* sub-structural parts) from a source form, in a way that semantically lines up
|
|
9
|
+
* with the ways they will need to be handled at runtime and conveyed to
|
|
10
|
+
* clients. This is the mapping:
|
|
11
|
+
*
|
|
12
|
+
* - 'output': All output values, i.e.:
|
|
13
|
+
* - `output/@value`
|
|
14
|
+
*
|
|
15
|
+
* - 'translation':
|
|
16
|
+
*
|
|
17
|
+
* - Valid XPath translation expressions, in a context accepting mixed
|
|
18
|
+
* translation/static syntax, i.e.:
|
|
19
|
+
*
|
|
20
|
+
* - `h:head//bind/@jr:constraintMsg[is-translation-expr()]`
|
|
21
|
+
* - `h:head//bind/@jr:requiredMsg[is-translation-expr()]`
|
|
22
|
+
*
|
|
23
|
+
* Here, `is-translation-expr()` is a fictional shorthand for checking
|
|
24
|
+
* that the attribute's value is a valid `jr:itext(...)` FunctionCall
|
|
25
|
+
* expression. Note that, per spec, these attributes **do not accept
|
|
26
|
+
* arbitrary XPath expressions**! The non-translation case is treated as
|
|
27
|
+
* static text, not parsed for e.g. an XPath [string] Literal expression.
|
|
28
|
+
* This is why we have introduced this 'translation' case, distinct from
|
|
29
|
+
* 'reference', which previously handled translated labels and hints.
|
|
30
|
+
*
|
|
31
|
+
* - Valid XPath translation expressions, in a context accepting arbitrary
|
|
32
|
+
* XPath expressions, i.e.:
|
|
33
|
+
*
|
|
34
|
+
* - `h:body//label/@ref[is-translation-expr()]`
|
|
35
|
+
*
|
|
36
|
+
* - 'static':
|
|
37
|
+
* - `h:head//bind/@jr:constraintMsg[not(is-translation-expr())]`
|
|
38
|
+
* - `h:head//bind/@jr:requiredMsg[not(is-translation-expr())]`
|
|
39
|
+
* - `h:body//label/text()`
|
|
40
|
+
* - `h:body//hint/text()`
|
|
41
|
+
*
|
|
42
|
+
* (See notes above for clarification of `is-translation-expr()`.)
|
|
43
|
+
*
|
|
44
|
+
* - 'reference': Any XPath **non-translation** expression defined as a label's
|
|
45
|
+
* (or hint's) `ref` attribute, i.e.
|
|
46
|
+
* - `h:body//label/@ref[not(is-translation-expr())]`
|
|
47
|
+
* - `h:body//hint/@ref[not(is-translation-expr())]`
|
|
48
|
+
*
|
|
49
|
+
* (See notes above for clarification of `is-translation-expr()`.)
|
|
50
|
+
*
|
|
51
|
+
* @todo It's unclear whether this will all become simpler or more compelex when
|
|
52
|
+
* we add support for outputs in translations. In theory, the actual translation
|
|
53
|
+
* `<text>` nodes map quite well to the `TextRange` concept (i.e. they are a
|
|
54
|
+
* range of static and output chunks, just like labels and hints). The potential
|
|
55
|
+
* for complications arise from XPath implementation details being largely
|
|
56
|
+
* opaque (as in, the `jr:itext` implementation is encapsulated in the `xpath`
|
|
57
|
+
* package, and the engine doesn't really deal with itext translations at the
|
|
58
|
+
* node level at all).
|
|
59
|
+
*/
|
|
60
|
+
export type TextChunkSource = 'output' | 'reference' | 'translation' | 'static';
|
|
4
61
|
/**
|
|
5
62
|
* @todo This (and everything else to do with {@link TextRange}s is for
|
|
6
63
|
* illustration purposes, as a starting point where any particular detail is of
|
|
@@ -18,6 +75,31 @@ export interface TextChunk {
|
|
|
18
75
|
get asString(): string;
|
|
19
76
|
get formatted(): unknown;
|
|
20
77
|
}
|
|
78
|
+
export type ElementTextRole = 'hint' | 'label' | 'item-label';
|
|
79
|
+
export type ValidationTextRole = 'constraintMsg' | 'requiredMsg';
|
|
80
|
+
export type TextRole = ElementTextRole | ValidationTextRole;
|
|
81
|
+
/**
|
|
82
|
+
* Specifies the origin of a {@link TextRange}.
|
|
83
|
+
*
|
|
84
|
+
* - 'form': text is computed from the form definition, as specified for the
|
|
85
|
+
* {@link TextRole}. User-facing clients should present text with this origin
|
|
86
|
+
* where appropriate.
|
|
87
|
+
*
|
|
88
|
+
* - 'form-derived': the form definition lacks a text definition for the
|
|
89
|
+
* {@link TextRole}, but an appropriate one has been derived from a related
|
|
90
|
+
* (and semantically appropriate) aspect of the form (example: a select item
|
|
91
|
+
* without a label may derive that label from the item's value). User-facing
|
|
92
|
+
* clients should generally present text with this origin where provided; this
|
|
93
|
+
* origin clarifies the source of such text.
|
|
94
|
+
*
|
|
95
|
+
* - 'engine': the form definition lacks a definition for the {@link TextRole},
|
|
96
|
+
* but provides a constant default in its absence. User facing clients may
|
|
97
|
+
* disregard these constant text values, or may use them where a sensible
|
|
98
|
+
* default is desired. Clients may also use these constants as keys for
|
|
99
|
+
* translation purposes, as appropriate. Non-user facing clients may reference
|
|
100
|
+
* these constants for e.g. testing purposes.
|
|
101
|
+
*/
|
|
102
|
+
export type TextOrigin = 'form' | 'form-derived' | 'engine';
|
|
21
103
|
/**
|
|
22
104
|
* Represents aspects of a form which produce text, which _might_ be:
|
|
23
105
|
*
|
|
@@ -48,7 +130,8 @@ export interface TextChunk {
|
|
|
48
130
|
* a text range's role may correspond to the "short" or "guidance" `form` of a
|
|
49
131
|
* {@link https://getodk.github.io/xforms-spec/#languages | translation}).
|
|
50
132
|
*/
|
|
51
|
-
export interface TextRange<Role extends
|
|
133
|
+
export interface TextRange<Role extends TextRole, Origin extends TextOrigin = TextOrigin> {
|
|
134
|
+
readonly origin: Origin;
|
|
52
135
|
readonly role: Role;
|
|
53
136
|
[Symbol.iterator](): Iterable<TextChunk>;
|
|
54
137
|
get asString(): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValidationTextRole } from './TextRange.ts';
|
|
2
|
+
|
|
3
|
+
export declare const VALIDATION_TEXT: {
|
|
4
|
+
readonly constraintMsg: "Condition not satisfied: constraint";
|
|
5
|
+
readonly requiredMsg: "Condition not satisfied: required";
|
|
6
|
+
};
|
|
7
|
+
type ValidationTextDefaults = typeof VALIDATION_TEXT;
|
|
8
|
+
export type ValidationTextDefault<Role extends ValidationTextRole> = ValidationTextDefaults[Role];
|
|
9
|
+
export {};
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { ExpandUnion } from '../../../common/types/helpers.d.ts';
|
|
2
2
|
import { GroupNode } from './GroupNode.ts';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ModelValueNode } from './ModelValueNode.ts';
|
|
4
|
+
import { NoteNode } from './NoteNode.ts';
|
|
5
|
+
import { RepeatInstanceNode } from './repeat/RepeatInstanceNode.ts';
|
|
6
|
+
import { RepeatRangeControlledNode } from './repeat/RepeatRangeControlledNode.ts';
|
|
7
|
+
import { RepeatRangeUncontrolledNode } from './repeat/RepeatRangeUncontrolledNode.ts';
|
|
5
8
|
import { RootNode } from './RootNode.ts';
|
|
6
9
|
import { SelectNode } from './SelectNode.ts';
|
|
7
10
|
import { StringNode } from './StringNode.ts';
|
|
8
11
|
import { SubtreeNode } from './SubtreeNode.ts';
|
|
9
12
|
|
|
10
|
-
export type
|
|
13
|
+
export type AnyControlNode = NoteNode | SelectNode | StringNode;
|
|
14
|
+
export type AnyLeafNode = AnyControlNode | ModelValueNode;
|
|
15
|
+
export type RepeatRangeNode = RepeatRangeControlledNode | RepeatRangeUncontrolledNode;
|
|
16
|
+
/**
|
|
17
|
+
* Any of the concrete node types which may be a parent of non-repeat instance
|
|
18
|
+
* child nodes.
|
|
19
|
+
*/
|
|
20
|
+
export type GeneralParentNode = RootNode | SubtreeNode | GroupNode | RepeatInstanceNode;
|
|
11
21
|
/**
|
|
12
22
|
* Any of the concrete node types which may be a parent of any other node.
|
|
13
23
|
*
|
|
@@ -17,7 +27,7 @@ export type AnyLeafNode = SelectNode | StringNode;
|
|
|
17
27
|
* - Repeat instances should (continue to) specify {@link RepeatRangeNode}.
|
|
18
28
|
* - All other child nodes should specify {@link GeneralParentNode}.
|
|
19
29
|
*/
|
|
20
|
-
export type AnyParentNode =
|
|
30
|
+
export type AnyParentNode = GeneralParentNode | RepeatRangeNode;
|
|
21
31
|
/**
|
|
22
32
|
* Any of the concrete node types a client may get from the engine's form
|
|
23
33
|
* representation. This union should be updated when any new concrete node type
|
|
@@ -27,11 +37,6 @@ export type AnyParentNode = RootNode | SubtreeNode | GroupNode | RepeatRangeNode
|
|
|
27
37
|
* @see {@link GeneralChildNode}, which is derived from this type
|
|
28
38
|
*/
|
|
29
39
|
export type AnyNode = ExpandUnion<AnyLeafNode | AnyParentNode>;
|
|
30
|
-
/**
|
|
31
|
-
* Any of the concrete node types which may be a parent of non-repeat instance
|
|
32
|
-
* child nodes.
|
|
33
|
-
*/
|
|
34
|
-
export type GeneralParentNode = Exclude<AnyParentNode, RepeatRangeNode>;
|
|
35
40
|
/**
|
|
36
41
|
* Any of the concrete node types which may be a child of any other node.
|
|
37
42
|
*
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type RepeatRangeNodeType = 'repeat-range:controlled' | 'repeat-range:uncontrolled';
|
|
2
|
+
export type InstanceNodeType = 'root' | RepeatRangeNodeType | 'repeat-instance' | 'group' | 'subtree' | 'model-value' | 'note' | 'select' | 'string';
|