@getodk/xforms-engine 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/BaseNode.d.ts +15 -5
- package/dist/client/BaseValueNode.d.ts +32 -0
- package/dist/client/EngineConfig.d.ts +49 -49
- package/dist/client/GroupNode.d.ts +2 -3
- package/dist/client/InputNode.d.ts +53 -0
- package/dist/client/ModelValueNode.d.ts +13 -9
- package/dist/client/NodeAppearances.d.ts +1 -2
- package/dist/client/NoteNode.d.ts +3 -4
- package/dist/client/RootNode.d.ts +36 -10
- package/dist/client/SelectNode.d.ts +4 -5
- package/dist/client/SubtreeNode.d.ts +1 -2
- package/dist/client/TextRange.d.ts +3 -4
- package/dist/client/TriggerNode.d.ts +25 -0
- package/dist/client/ValueType.d.ts +3 -0
- package/dist/client/constants.d.ts +50 -1
- package/dist/client/hierarchy.d.ts +9 -5
- package/dist/client/identity.d.ts +14 -0
- package/dist/client/index.d.ts +0 -1
- package/dist/client/node-types.d.ts +3 -1
- package/dist/client/repeat/BaseRepeatRangeNode.d.ts +1 -2
- package/dist/client/repeat/RepeatInstanceNode.d.ts +2 -3
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +1 -2
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +1 -2
- package/dist/client/resources.d.ts +93 -0
- package/dist/client/submission/SubmissionData.d.ts +7 -0
- package/dist/client/submission/SubmissionDefinition.d.ts +14 -0
- package/dist/client/submission/SubmissionInstanceFile.d.ts +6 -0
- package/dist/client/submission/SubmissionOptions.d.ts +23 -0
- package/dist/client/submission/SubmissionResult.d.ts +91 -0
- package/dist/client/submission/SubmissionState.d.ts +12 -0
- package/dist/client/unsupported/RangeNode.d.ts +9 -0
- package/dist/client/unsupported/RankNode.d.ts +9 -0
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +32 -0
- package/dist/client/unsupported/UploadNode.d.ts +9 -0
- package/dist/client/validation.d.ts +2 -3
- package/dist/error/ErrorProductionDesignPendingError.d.ts +7 -0
- package/dist/error/ValueTypeInvariantError.d.ts +17 -0
- package/dist/error/XPathFunctionalityError.d.ts +14 -0
- package/dist/error/XPathFunctionalityNotSupportedError.d.ts +7 -0
- package/dist/error/XPathFunctionalityPendingError.d.ts +7 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.js +8559 -4700
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +9 -5
- package/dist/instance/InputControl.d.ts +36 -0
- package/dist/instance/ModelValue.d.ts +16 -27
- package/dist/instance/Note.d.ts +11 -5
- package/dist/instance/PrimaryInstance.d.ts +84 -0
- package/dist/instance/Root.d.ts +31 -28
- package/dist/instance/SelectField.d.ts +13 -6
- package/dist/instance/Subtree.d.ts +10 -6
- package/dist/instance/TriggerControl.d.ts +47 -0
- package/dist/instance/abstract/DescendantNode.d.ts +33 -26
- package/dist/instance/abstract/InstanceNode.d.ts +50 -31
- package/dist/instance/abstract/UnsupportedControl.d.ts +53 -0
- package/dist/instance/abstract/ValueNode.d.ts +48 -0
- package/dist/instance/children.d.ts +0 -1
- package/dist/instance/hierarchy.d.ts +13 -8
- package/dist/instance/identity.d.ts +2 -7
- package/dist/instance/index.d.ts +0 -1
- package/dist/instance/internal-api/EvaluationContext.d.ts +53 -13
- package/dist/instance/internal-api/InstanceConfig.d.ts +8 -3
- package/dist/instance/internal-api/InstanceValueContext.d.ts +20 -0
- package/dist/instance/internal-api/PrimaryInstanceDocument.d.ts +36 -0
- package/dist/instance/internal-api/TranslationContext.d.ts +3 -3
- package/dist/instance/internal-api/ValidationContext.d.ts +12 -6
- package/dist/instance/internal-api/ValueContext.d.ts +5 -5
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +14 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +31 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +18 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +17 -0
- package/dist/instance/repeat/BaseRepeatRange.d.ts +40 -85
- package/dist/instance/repeat/RepeatInstance.d.ts +11 -30
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +3 -4
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +3 -4
- package/dist/instance/resource.d.ts +1 -2
- package/dist/instance/text/TextChunk.d.ts +0 -1
- package/dist/instance/text/TextRange.d.ts +1 -2
- package/dist/instance/unsupported/RangeControl.d.ts +6 -0
- package/dist/instance/unsupported/RankControl.d.ts +6 -0
- package/dist/instance/unsupported/UploadControl.d.ts +6 -0
- package/dist/integration/xpath/EngineXPathEvaluator.d.ts +14 -0
- package/dist/integration/xpath/adapter/XFormsXPathNode.d.ts +71 -0
- package/dist/integration/xpath/adapter/engineDOMAdapter.d.ts +5 -0
- package/dist/integration/xpath/adapter/kind.d.ts +32 -0
- package/dist/integration/xpath/adapter/names.d.ts +16 -0
- package/dist/integration/xpath/adapter/traversal.d.ts +25 -0
- package/dist/integration/xpath/adapter/values.d.ts +2 -0
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +19 -0
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +16 -0
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +40 -0
- package/dist/integration/xpath/static-dom/StaticNamedNode.d.ts +17 -0
- package/dist/integration/xpath/static-dom/StaticNode.d.ts +33 -0
- package/dist/integration/xpath/static-dom/StaticText.d.ts +16 -0
- package/dist/lib/TokenListParser.d.ts +3 -3
- package/dist/lib/client-reactivity/submission/createInstanceSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/createLeafNodeSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/createNodeRangeSubmissionState.d.ts +4 -0
- package/dist/lib/client-reactivity/submission/createParentNodeSubmissionState.d.ts +4 -0
- package/dist/lib/client-reactivity/submission/createValueNodeSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/prepareSubmission.d.ts +8 -0
- package/dist/lib/codecs/DecimalValueCodec.d.ts +6 -0
- package/dist/lib/codecs/IntValueCodec.d.ts +6 -0
- package/dist/lib/codecs/StringValueCodec.d.ts +4 -0
- package/dist/lib/codecs/ValueCodec.d.ts +30 -0
- package/dist/lib/codecs/ValueTypePlaceholderCodec.d.ts +12 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +47 -0
- package/dist/lib/dom/query.d.ts +4 -2
- package/dist/lib/reactivity/createChildrenState.d.ts +7 -6
- package/dist/lib/reactivity/createComputedExpression.d.ts +19 -7
- package/dist/lib/reactivity/createInstanceValueState.d.ts +40 -0
- package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +2 -3
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -1
- package/dist/lib/reactivity/createTranslationState.d.ts +19 -0
- package/dist/lib/reactivity/createValueState.d.ts +6 -11
- package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +4 -5
- package/dist/lib/reactivity/node-state/createClientState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createCurrentState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createEngineState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedPropertyDescriptor.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/representations.d.ts +0 -1
- package/dist/lib/reactivity/scope.d.ts +0 -1
- package/dist/lib/reactivity/text/createFieldHint.d.ts +1 -2
- package/dist/lib/reactivity/text/createNodeLabel.d.ts +1 -2
- package/dist/lib/reactivity/text/createNoteText.d.ts +1 -2
- package/dist/lib/reactivity/text/createTextRange.d.ts +0 -1
- package/dist/lib/reactivity/types.d.ts +0 -1
- package/dist/lib/reactivity/validation/createAggregatedViolations.d.ts +0 -1
- package/dist/lib/reactivity/validation/createValidation.d.ts +0 -1
- package/dist/lib/xml-serialization.d.ts +41 -0
- package/dist/parse/XFormDOM.d.ts +42 -0
- package/dist/{XFormDefinition.d.ts → parse/XFormDefinition.d.ts} +3 -5
- package/dist/parse/attachments/FormAttachmentResource.d.ts +27 -0
- package/dist/{body → parse/body}/BodyDefinition.d.ts +16 -11
- package/dist/{body → parse/body}/BodyElementDefinition.d.ts +7 -7
- package/dist/{body → parse/body}/RepeatElementDefinition.d.ts +3 -4
- package/dist/{body → parse/body}/UnsupportedBodyElementDefinition.d.ts +0 -1
- package/dist/parse/body/appearance/inputAppearanceParser.d.ts +3 -0
- package/dist/{body → parse/body}/appearance/selectAppearanceParser.d.ts +1 -2
- package/dist/{body → parse/body}/appearance/structureElementAppearanceParser.d.ts +1 -2
- package/dist/parse/body/appearance/unknownAppearanceParser.d.ts +3 -0
- package/dist/{body → parse/body}/control/ControlDefinition.d.ts +3 -4
- package/dist/{body/control/InputDefinition.d.ts → parse/body/control/InputControlDefinition.d.ts} +2 -3
- package/dist/parse/body/control/RangeControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/RankControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/TriggerControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/UploadControlDefinition.d.ts +11 -0
- package/dist/{body → parse/body}/control/select/ItemDefinition.d.ts +2 -3
- package/dist/{body → parse/body}/control/select/ItemsetDefinition.d.ts +4 -5
- package/dist/{body → parse/body}/control/select/ItemsetNodesetContext.d.ts +1 -4
- package/dist/{body → parse/body}/control/select/SelectDefinition.d.ts +3 -12
- package/dist/{body → parse/body}/group/BaseGroupDefinition.d.ts +3 -5
- package/dist/{body → parse/body}/group/LogicalGroupDefinition.d.ts +0 -1
- package/dist/{body → parse/body}/group/PresentationGroupDefinition.d.ts +1 -2
- package/dist/{body → parse/body}/group/StructuralGroupDefinition.d.ts +0 -1
- package/dist/{model/BindComputation.d.ts → parse/expression/BindComputationExpression.d.ts} +5 -6
- package/dist/{body/control/select → parse/expression}/ItemsetNodesetExpression.d.ts +2 -3
- package/dist/{body/control/select → parse/expression}/ItemsetValueExpression.d.ts +2 -3
- package/dist/parse/expression/RepeatCountControlExpression.d.ts +2 -3
- package/dist/parse/expression/TextLiteralExpression.d.ts +9 -0
- package/dist/parse/expression/TextOutputExpression.d.ts +7 -0
- package/dist/parse/expression/TextReferenceExpression.d.ts +7 -0
- package/dist/parse/expression/TextTranslationExpression.d.ts +8 -0
- package/dist/parse/expression/abstract/DependencyContext.d.ts +7 -0
- package/dist/{expression → parse/expression/abstract}/DependentExpression.d.ts +4 -6
- package/dist/parse/expression/abstract/TextChunkExpression.d.ts +17 -0
- package/dist/parse/model/BindDefinition.d.ts +38 -0
- package/dist/parse/model/BindTypeDefinition.d.ts +20 -0
- package/dist/{model → parse/model}/DescendentNodeDefinition.d.ts +0 -2
- package/dist/parse/model/FormSubmissionDefinition.d.ts +8 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +4 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +8 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +8 -0
- package/dist/{model → parse/model}/LeafNodeDefinition.d.ts +4 -3
- package/dist/{model → parse/model}/ModelBindMap.d.ts +1 -2
- package/dist/{model → parse/model}/ModelDefinition.d.ts +3 -2
- package/dist/{model → parse/model}/NodeDefinition.d.ts +0 -2
- package/dist/parse/{NoteNodeDefinition.d.ts → model/NoteNodeDefinition.d.ts} +12 -13
- package/dist/{model → parse/model}/RepeatInstanceDefinition.d.ts +1 -2
- package/dist/{model → parse/model}/RepeatRangeDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/RepeatTemplateDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/RootDefinition.d.ts +5 -5
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceDefinition.d.ts +4 -0
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.d.ts +7 -0
- package/dist/parse/model/SecondaryInstance/SecondaryInstancesDefinition.d.ts +13 -0
- package/dist/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.d.ts +14 -0
- package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +22 -0
- package/dist/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.d.ts +23 -0
- package/dist/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceSource.d.ts +9 -0
- package/dist/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.d.ts +7 -0
- package/dist/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.d.ts +13 -0
- package/dist/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.d.ts +12 -0
- package/dist/{model → parse/model}/SubtreeDefinition.d.ts +1 -2
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +24 -0
- package/dist/parse/text/HintDefinition.d.ts +2 -3
- package/dist/parse/text/ItemLabelDefinition.d.ts +2 -3
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +3 -4
- package/dist/parse/text/LabelDefinition.d.ts +5 -6
- package/dist/parse/text/MessageDefinition.d.ts +4 -5
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +8 -9
- package/dist/parse/text/abstract/TextRangeDefinition.d.ts +4 -7
- package/dist/parse/xpath/path-resolution.d.ts +0 -1
- package/dist/parse/xpath/predicate-analysis.d.ts +0 -1
- package/dist/parse/xpath/reference-parsing.d.ts +0 -1
- package/dist/parse/xpath/semantic-analysis.d.ts +5 -1
- package/dist/parse/xpath/syntax-traversal.d.ts +0 -1
- package/dist/solid.js +8398 -4543
- package/dist/solid.js.map +1 -1
- package/package.json +14 -12
- package/src/client/BaseNode.ts +17 -7
- package/src/client/BaseValueNode.ts +35 -0
- package/src/client/EngineConfig.ts +52 -51
- package/src/client/GroupNode.ts +2 -2
- package/src/client/InputNode.ts +77 -0
- package/src/client/ModelValueNode.ts +31 -8
- package/src/client/NodeAppearances.ts +1 -1
- package/src/client/NoteNode.ts +3 -3
- package/src/client/RootNode.ts +39 -9
- package/src/client/SelectNode.ts +5 -5
- package/src/client/SubtreeNode.ts +1 -1
- package/src/client/TextRange.ts +4 -5
- package/src/client/TriggerNode.ts +29 -0
- package/src/client/ValueType.ts +4 -0
- package/src/client/constants.ts +67 -0
- package/src/client/hierarchy.ts +16 -4
- package/src/client/identity.ts +16 -0
- package/src/client/node-types.ts +19 -5
- package/src/client/repeat/BaseRepeatRangeNode.ts +1 -1
- package/src/client/repeat/RepeatInstanceNode.ts +2 -2
- package/src/client/repeat/RepeatRangeControlledNode.ts +1 -1
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +1 -1
- package/src/client/resources.ts +118 -0
- package/src/client/submission/SubmissionData.ts +12 -0
- package/src/client/submission/SubmissionDefinition.ts +16 -0
- package/src/client/submission/SubmissionInstanceFile.ts +9 -0
- package/src/client/submission/SubmissionOptions.ts +28 -0
- package/src/client/submission/SubmissionResult.ts +124 -0
- package/src/client/submission/SubmissionState.ts +14 -0
- package/src/client/unsupported/RangeNode.ts +14 -0
- package/src/client/unsupported/RankNode.ts +14 -0
- package/src/client/unsupported/UnsupportedControlNode.ts +40 -0
- package/src/client/unsupported/UploadNode.ts +14 -0
- package/src/client/validation.ts +2 -2
- package/src/error/ErrorProductionDesignPendingError.ts +6 -0
- package/src/error/ValueTypeInvariantError.ts +22 -0
- package/src/error/XPathFunctionalityError.ts +26 -0
- package/src/error/XPathFunctionalityNotSupportedError.ts +18 -0
- package/src/error/XPathFunctionalityPendingError.ts +18 -0
- package/src/index.ts +16 -2
- package/src/instance/Group.ts +17 -5
- package/src/instance/InputControl.ts +119 -0
- package/src/instance/ModelValue.ts +47 -54
- package/src/instance/Note.ts +26 -10
- package/src/instance/PrimaryInstance.ts +244 -0
- package/src/instance/Root.ts +64 -132
- package/src/instance/SelectField.ts +62 -25
- package/src/instance/Subtree.ts +19 -7
- package/src/instance/{StringField.ts → TriggerControl.ts} +61 -30
- package/src/instance/abstract/DescendantNode.ts +92 -47
- package/src/instance/abstract/InstanceNode.ts +104 -98
- package/src/instance/abstract/UnsupportedControl.ts +174 -0
- package/src/instance/abstract/ValueNode.ts +127 -0
- package/src/instance/children.ts +83 -14
- package/src/instance/hierarchy.ts +36 -14
- package/src/instance/identity.ts +3 -9
- package/src/instance/index.ts +26 -8
- package/src/instance/internal-api/EvaluationContext.ts +61 -14
- package/src/instance/internal-api/InstanceConfig.ts +9 -2
- package/src/instance/internal-api/InstanceValueContext.ts +24 -0
- package/src/instance/internal-api/PrimaryInstanceDocument.ts +53 -0
- package/src/instance/internal-api/TranslationContext.ts +3 -2
- package/src/instance/internal-api/ValidationContext.ts +13 -5
- package/src/instance/internal-api/ValueContext.ts +5 -4
- package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +20 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +42 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +25 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +23 -0
- package/src/instance/repeat/BaseRepeatRange.ts +51 -132
- package/src/instance/repeat/RepeatInstance.ts +20 -46
- package/src/instance/repeat/RepeatRangeControlled.ts +6 -6
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +3 -5
- package/src/instance/resource.ts +1 -1
- package/src/instance/text/TextChunk.ts +1 -1
- package/src/instance/unsupported/RangeControl.ts +9 -0
- package/src/instance/unsupported/RankControl.ts +9 -0
- package/src/instance/unsupported/UploadControl.ts +9 -0
- package/src/integration/xpath/EngineXPathEvaluator.ts +22 -0
- package/src/integration/xpath/adapter/XFormsXPathNode.ts +126 -0
- package/src/integration/xpath/adapter/engineDOMAdapter.ts +57 -0
- package/src/integration/xpath/adapter/kind.ts +114 -0
- package/src/integration/xpath/adapter/names.ts +99 -0
- package/src/integration/xpath/adapter/traversal.ts +228 -0
- package/src/integration/xpath/adapter/values.ts +5 -0
- package/src/integration/xpath/static-dom/StaticAttribute.ts +33 -0
- package/src/integration/xpath/static-dom/StaticDocument.ts +38 -0
- package/src/integration/xpath/static-dom/StaticElement.ts +106 -0
- package/src/integration/xpath/static-dom/StaticNamedNode.ts +45 -0
- package/src/integration/xpath/static-dom/StaticNode.ts +68 -0
- package/src/integration/xpath/static-dom/StaticText.ts +28 -0
- package/src/lib/TokenListParser.ts +11 -7
- package/src/lib/client-reactivity/README.md +0 -0
- package/src/lib/client-reactivity/submission/createInstanceSubmissionState.ts +12 -0
- package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +20 -0
- package/src/lib/client-reactivity/submission/createNodeRangeSubmissionState.ts +17 -0
- package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +22 -0
- package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +21 -0
- package/src/lib/client-reactivity/submission/prepareSubmission.ts +172 -0
- package/src/lib/codecs/DecimalValueCodec.ts +46 -0
- package/src/lib/codecs/IntValueCodec.ts +100 -0
- package/src/lib/codecs/StringValueCodec.ts +11 -0
- package/src/lib/codecs/ValueCodec.ts +106 -0
- package/src/lib/codecs/ValueTypePlaceholderCodec.ts +19 -0
- package/src/lib/codecs/getSharedValueCodec.ts +77 -0
- package/src/lib/dom/query.ts +8 -1
- package/src/lib/reactivity/createChildrenState.ts +8 -6
- package/src/lib/reactivity/createComputedExpression.ts +59 -36
- package/src/lib/reactivity/createInstanceValueState.ts +166 -0
- package/src/lib/reactivity/createNoteReadonlyThunk.ts +12 -7
- package/src/lib/reactivity/createSelectItems.ts +23 -23
- package/src/lib/reactivity/createTranslationState.ts +61 -0
- package/src/lib/reactivity/createValueState.ts +64 -122
- package/src/lib/reactivity/materializeCurrentStateChildren.ts +7 -7
- package/src/lib/reactivity/node-state/createSpecifiedState.ts +1 -1
- package/src/lib/reactivity/text/createFieldHint.ts +1 -1
- package/src/lib/reactivity/text/createNodeLabel.ts +1 -1
- package/src/lib/reactivity/text/createNoteText.ts +1 -1
- package/src/lib/reactivity/text/createTextRange.ts +8 -7
- package/src/lib/reactivity/validation/createAggregatedViolations.ts +9 -4
- package/src/lib/reactivity/validation/createValidation.ts +2 -3
- package/src/lib/xml-serialization.ts +96 -0
- package/src/{XFormDOM.ts → parse/XFormDOM.ts} +110 -75
- package/src/{XFormDefinition.ts → parse/XFormDefinition.ts} +3 -8
- package/src/parse/attachments/FormAttachmentResource.ts +40 -0
- package/src/{body → parse/body}/BodyDefinition.ts +46 -29
- package/src/{body → parse/body}/BodyElementDefinition.ts +12 -6
- package/src/{body → parse/body}/RepeatElementDefinition.ts +7 -5
- package/src/{body → parse/body}/appearance/inputAppearanceParser.ts +2 -2
- package/src/{body → parse/body}/appearance/selectAppearanceParser.ts +1 -1
- package/src/{body → parse/body}/appearance/structureElementAppearanceParser.ts +1 -1
- package/src/parse/body/appearance/unknownAppearanceParser.ts +5 -0
- package/src/{body → parse/body}/control/ControlDefinition.ts +4 -4
- package/src/{body/control/InputDefinition.ts → parse/body/control/InputControlDefinition.ts} +3 -5
- package/src/parse/body/control/RangeControlDefinition.ts +26 -0
- package/src/parse/body/control/RankControlDefinition.ts +27 -0
- package/src/parse/body/control/TriggerControlDefinition.ts +26 -0
- package/src/parse/body/control/UploadControlDefinition.ts +26 -0
- package/src/{body → parse/body}/control/select/ItemDefinition.ts +2 -2
- package/src/{body → parse/body}/control/select/ItemsetDefinition.ts +5 -5
- package/src/{body → parse/body}/control/select/ItemsetNodesetContext.ts +1 -6
- package/src/{body → parse/body}/control/select/SelectDefinition.ts +3 -11
- package/src/{body → parse/body}/group/BaseGroupDefinition.ts +11 -22
- package/src/{body → parse/body}/group/PresentationGroupDefinition.ts +1 -1
- package/src/{model/BindComputation.ts → parse/expression/BindComputationExpression.ts} +8 -8
- package/src/{body/control/select → parse/expression}/ItemsetNodesetExpression.ts +2 -2
- package/src/{body/control/select → parse/expression}/ItemsetValueExpression.ts +2 -2
- package/src/parse/expression/RepeatCountControlExpression.ts +2 -2
- package/src/parse/expression/TextLiteralExpression.ts +19 -0
- package/src/parse/{text/OutputChunkDefinition.ts → expression/TextOutputExpression.ts} +4 -4
- package/src/parse/{text/ReferenceChunkDefinition.ts → expression/TextReferenceExpression.ts} +4 -4
- package/src/parse/{text/TranslationChunkDefinition.ts → expression/TextTranslationExpression.ts} +4 -4
- package/src/{expression → parse/expression/abstract}/DependencyContext.ts +0 -26
- package/src/{expression → parse/expression/abstract}/DependentExpression.ts +5 -16
- package/src/parse/expression/abstract/TextChunkExpression.ts +38 -0
- package/src/parse/model/BindDefinition.ts +104 -0
- package/src/parse/model/BindTypeDefinition.ts +175 -0
- package/src/{model → parse/model}/DescendentNodeDefinition.ts +0 -6
- package/src/parse/model/FormSubmissionDefinition.ts +44 -0
- package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +4 -0
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +41 -0
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +31 -0
- package/src/{model → parse/model}/LeafNodeDefinition.ts +4 -1
- package/src/{model → parse/model}/ModelBindMap.ts +6 -8
- package/src/parse/model/ModelDefinition.ts +24 -0
- package/src/{model → parse/model}/NodeDefinition.ts +0 -3
- package/src/parse/{NoteNodeDefinition.ts → model/NoteNodeDefinition.ts} +12 -12
- package/src/{model → parse/model}/RepeatRangeDefinition.ts +1 -1
- package/src/{model → parse/model}/RootDefinition.ts +4 -3
- package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +4 -0
- package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +12 -0
- package/src/parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts +102 -0
- package/src/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.ts +40 -0
- package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +288 -0
- package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.ts +222 -0
- package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceSource.ts +22 -0
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +414 -0
- package/src/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.ts +19 -0
- package/src/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.ts +29 -0
- package/src/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.ts +32 -0
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +149 -0
- package/src/parse/text/HintDefinition.ts +2 -2
- package/src/parse/text/ItemLabelDefinition.ts +2 -2
- package/src/parse/text/ItemsetLabelDefinition.ts +7 -7
- package/src/parse/text/LabelDefinition.ts +5 -5
- package/src/parse/text/MessageDefinition.ts +7 -7
- package/src/parse/text/abstract/TextElementDefinition.ts +14 -14
- package/src/parse/text/abstract/TextRangeDefinition.ts +4 -10
- package/src/parse/xpath/semantic-analysis.ts +29 -0
- package/dist/XFormDOM.d.ts +0 -32
- package/dist/XFormDataType.d.ts +0 -27
- package/dist/body/appearance/inputAppearanceParser.d.ts +0 -4
- package/dist/client/StringNode.d.ts +0 -47
- package/dist/expression/DependencyContext.d.ts +0 -13
- package/dist/instance/StringField.d.ts +0 -45
- package/dist/instance/internal-api/SubscribableDependency.d.ts +0 -60
- package/dist/model/BindDefinition.d.ts +0 -34
- package/dist/parse/text/OutputChunkDefinition.d.ts +0 -8
- package/dist/parse/text/ReferenceChunkDefinition.d.ts +0 -8
- package/dist/parse/text/StaticTextChunkDefinition.d.ts +0 -10
- package/dist/parse/text/TranslationChunkDefinition.d.ts +0 -9
- package/dist/parse/text/abstract/TextChunkDefinition.d.ts +0 -18
- package/src/XFormDataType.ts +0 -64
- package/src/client/StringNode.ts +0 -52
- package/src/instance/internal-api/SubscribableDependency.ts +0 -61
- package/src/model/BindDefinition.ts +0 -106
- package/src/model/ModelDefinition.ts +0 -19
- package/src/parse/TODO.md +0 -3
- package/src/parse/text/StaticTextChunkDefinition.ts +0 -19
- package/src/parse/text/abstract/TextChunkDefinition.ts +0 -38
- /package/dist/{model → parse/model}/BindElement.d.ts +0 -0
- /package/src/{body → parse/body}/UnsupportedBodyElementDefinition.ts +0 -0
- /package/src/{body → parse/body}/group/LogicalGroupDefinition.ts +0 -0
- /package/src/{body → parse/body}/group/StructuralGroupDefinition.ts +0 -0
- /package/src/{model → parse/model}/BindElement.ts +0 -0
- /package/src/{model → parse/model}/RepeatInstanceDefinition.ts +0 -0
- /package/src/{model → parse/model}/RepeatTemplateDefinition.ts +0 -0
- /package/src/{model → parse/model}/SubtreeDefinition.ts +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AnyFunction, ExpandUnion } from '@getodk/common/types/helpers.js';
|
|
2
|
+
import type { XPathDOMAdapter, XPathNode } from '@getodk/xpath';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @todo this is general enough to go in `@getodk/common`. Holding off until
|
|
6
|
+
* it's clear we actually benefit from this particular type gymnastic.
|
|
7
|
+
*/
|
|
8
|
+
// prettier-ignore
|
|
9
|
+
type MethodNameOf<T> = {
|
|
10
|
+
[K in keyof T]:
|
|
11
|
+
T[K] extends AnyFunction
|
|
12
|
+
? K
|
|
13
|
+
: never;
|
|
14
|
+
}[keyof T];
|
|
15
|
+
|
|
16
|
+
// prettier-ignore
|
|
17
|
+
export type XPathFunctionalityErrorCategory = ExpandUnion<
|
|
18
|
+
| MethodNameOf<XPathDOMAdapter<XPathNode>>
|
|
19
|
+
| 'processing-instruction'
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
export abstract class XPathFunctionalityError extends Error {
|
|
23
|
+
constructor(functionalityMessagePrefix: string, category: XPathFunctionalityErrorCategory) {
|
|
24
|
+
super(`${functionalityMessagePrefix}${category}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { XPathFunctionalityErrorCategory } from './XPathFunctionalityError.ts';
|
|
2
|
+
import { XPathFunctionalityError } from './XPathFunctionalityError.ts';
|
|
3
|
+
|
|
4
|
+
type XPathFunctionalityNotSupportedStub = () => never;
|
|
5
|
+
|
|
6
|
+
export class XPathFunctionalityNotSupportedError extends XPathFunctionalityError {
|
|
7
|
+
static createStubImplementation(
|
|
8
|
+
category: XPathFunctionalityErrorCategory
|
|
9
|
+
): XPathFunctionalityNotSupportedStub {
|
|
10
|
+
return () => {
|
|
11
|
+
throw new this(category);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private constructor(category: XPathFunctionalityErrorCategory) {
|
|
16
|
+
super('XPath functionality not supported: ', category);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { XPathFunctionalityErrorCategory } from './XPathFunctionalityError.ts';
|
|
2
|
+
import { XPathFunctionalityError } from './XPathFunctionalityError.ts';
|
|
3
|
+
|
|
4
|
+
type XPathFunctionalityPendingStub = () => never;
|
|
5
|
+
|
|
6
|
+
export class XPathFunctionalityPendingError extends XPathFunctionalityError {
|
|
7
|
+
static createStubImplementation(
|
|
8
|
+
category: XPathFunctionalityErrorCategory
|
|
9
|
+
): XPathFunctionalityPendingStub {
|
|
10
|
+
return () => {
|
|
11
|
+
throw new this(category);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private constructor(category: XPathFunctionalityErrorCategory) {
|
|
16
|
+
super('XPath functionality pending: ', category);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { initializeForm as engine__initializeForm } from './instance/index.ts';
|
|
|
3
3
|
|
|
4
4
|
export const initializeForm: InitializeForm = engine__initializeForm;
|
|
5
5
|
|
|
6
|
+
export type * from './client/constants.ts';
|
|
6
7
|
export * as constants from './client/constants.ts';
|
|
7
8
|
export type * from './client/EngineConfig.ts';
|
|
8
9
|
export type * from './client/FormLanguage.ts';
|
|
@@ -13,23 +14,36 @@ export type {
|
|
|
13
14
|
AnyLeafNode,
|
|
14
15
|
AnyNode,
|
|
15
16
|
AnyParentNode,
|
|
17
|
+
AnyUnsupportedControlNode,
|
|
16
18
|
GeneralChildNode,
|
|
17
19
|
GeneralParentNode,
|
|
18
20
|
RepeatRangeNode,
|
|
19
21
|
} from './client/hierarchy.ts';
|
|
20
22
|
export type * from './client/index.ts';
|
|
23
|
+
export type * from './client/InputNode.ts';
|
|
21
24
|
export type * from './client/ModelValueNode.ts';
|
|
22
25
|
export type * from './client/NoteNode.ts';
|
|
23
26
|
export type * from './client/OpaqueReactiveObjectFactory.ts';
|
|
24
27
|
export type * from './client/repeat/RepeatInstanceNode.ts';
|
|
25
28
|
export type * from './client/repeat/RepeatRangeControlledNode.ts';
|
|
26
29
|
export type * from './client/repeat/RepeatRangeUncontrolledNode.ts';
|
|
30
|
+
export type * from './client/resources.ts';
|
|
27
31
|
export type * from './client/RootNode.ts';
|
|
28
32
|
export type * from './client/SelectNode.ts';
|
|
29
|
-
export type * from './client/
|
|
33
|
+
export type * from './client/submission/SubmissionData.ts';
|
|
34
|
+
export type * from './client/submission/SubmissionDefinition.ts';
|
|
35
|
+
export type * from './client/submission/SubmissionInstanceFile.ts';
|
|
36
|
+
export type * from './client/submission/SubmissionOptions.ts';
|
|
37
|
+
export type * from './client/submission/SubmissionResult.ts';
|
|
38
|
+
export type * from './client/submission/SubmissionState.ts';
|
|
30
39
|
export type * from './client/SubtreeNode.ts';
|
|
31
40
|
export type * from './client/TextRange.ts';
|
|
41
|
+
export type * from './client/TriggerNode.ts';
|
|
42
|
+
export type * from './client/unsupported/RangeNode.ts';
|
|
43
|
+
export type * from './client/unsupported/RankNode.ts';
|
|
44
|
+
export type * from './client/unsupported/UploadNode.ts';
|
|
32
45
|
export type * from './client/validation.ts';
|
|
46
|
+
export type * from './client/ValueType.ts';
|
|
33
47
|
|
|
34
48
|
// TODO: notwithstanding potential conflicts with parallel work on `web-forms`
|
|
35
49
|
// (former `ui-vue`), these are the last remaining references **outside of
|
|
@@ -39,4 +53,4 @@ export type * from './client/validation.ts';
|
|
|
39
53
|
export type {
|
|
40
54
|
AnySelectDefinition,
|
|
41
55
|
SelectDefinition,
|
|
42
|
-
} from './body/control/select/SelectDefinition.ts';
|
|
56
|
+
} from './parse/body/control/select/SelectDefinition.ts';
|
package/src/instance/Group.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
1
2
|
import type { Accessor } from 'solid-js';
|
|
2
3
|
import type { GroupDefinition, GroupNode, GroupNodeAppearances } from '../client/GroupNode.ts';
|
|
4
|
+
import type { FormNodeID } from '../client/identity.ts';
|
|
5
|
+
import type { SubmissionState } from '../client/submission/SubmissionState.ts';
|
|
3
6
|
import type { TextRange } from '../client/TextRange.ts';
|
|
4
7
|
import type { AncestorNodeValidationState } from '../client/validation.ts';
|
|
8
|
+
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
9
|
+
import { createParentNodeSubmissionState } from '../lib/client-reactivity/submission/createParentNodeSubmissionState.ts';
|
|
5
10
|
import type { ChildrenState } from '../lib/reactivity/createChildrenState.ts';
|
|
6
11
|
import { createChildrenState } from '../lib/reactivity/createChildrenState.ts';
|
|
7
12
|
import type { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
|
|
@@ -16,25 +21,30 @@ import type { DescendantNodeSharedStateSpec } from './abstract/DescendantNode.ts
|
|
|
16
21
|
import { DescendantNode } from './abstract/DescendantNode.ts';
|
|
17
22
|
import { buildChildren } from './children.ts';
|
|
18
23
|
import type { GeneralChildNode, GeneralParentNode } from './hierarchy.ts';
|
|
19
|
-
import type { NodeID } from './identity.ts';
|
|
20
24
|
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
21
|
-
import type {
|
|
25
|
+
import type { ClientReactiveSubmittableParentNode } from './internal-api/submission/ClientReactiveSubmittableParentNode.ts';
|
|
22
26
|
|
|
23
27
|
// prettier-ignore
|
|
24
28
|
interface GroupStateSpec extends DescendantNodeSharedStateSpec {
|
|
25
29
|
readonly label: Accessor<TextRange<'label'> | null>;
|
|
26
30
|
readonly hint: null;
|
|
27
|
-
readonly children: Accessor<readonly
|
|
31
|
+
readonly children: Accessor<readonly FormNodeID[]>;
|
|
28
32
|
readonly valueOptions: null;
|
|
29
33
|
readonly value: null;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
export class Group
|
|
33
|
-
extends DescendantNode<GroupDefinition, GroupStateSpec, GeneralChildNode>
|
|
34
|
-
implements
|
|
37
|
+
extends DescendantNode<GroupDefinition, GroupStateSpec, GeneralParentNode, GeneralChildNode>
|
|
38
|
+
implements
|
|
39
|
+
GroupNode,
|
|
40
|
+
XFormsXPathElement,
|
|
41
|
+
EvaluationContext,
|
|
42
|
+
ClientReactiveSubmittableParentNode<GeneralChildNode>
|
|
35
43
|
{
|
|
36
44
|
private readonly childrenState: ChildrenState<GeneralChildNode>;
|
|
37
45
|
|
|
46
|
+
override readonly [XPathNodeKindKey] = 'element';
|
|
47
|
+
|
|
38
48
|
// InstanceNode
|
|
39
49
|
protected readonly state: SharedNodeState<GroupStateSpec>;
|
|
40
50
|
protected override engineState: EngineState<GroupStateSpec>;
|
|
@@ -44,6 +54,7 @@ export class Group
|
|
|
44
54
|
readonly appearances: GroupNodeAppearances;
|
|
45
55
|
readonly currentState: MaterializedChildren<CurrentState<GroupStateSpec>, GeneralChildNode>;
|
|
46
56
|
readonly validationState: AncestorNodeValidationState;
|
|
57
|
+
readonly submissionState: SubmissionState;
|
|
47
58
|
|
|
48
59
|
constructor(parent: GeneralParentNode, definition: GroupDefinition) {
|
|
49
60
|
super(parent, definition);
|
|
@@ -85,6 +96,7 @@ export class Group
|
|
|
85
96
|
|
|
86
97
|
childrenState.setChildren(buildChildren(this));
|
|
87
98
|
this.validationState = createAggregatedViolations(this, sharedStateOptions);
|
|
99
|
+
this.submissionState = createParentNodeSubmissionState(this);
|
|
88
100
|
}
|
|
89
101
|
|
|
90
102
|
getChildren(): readonly GeneralChildNode[] {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import type { Accessor } from 'solid-js';
|
|
3
|
+
import type {
|
|
4
|
+
InputDefinition,
|
|
5
|
+
InputNode,
|
|
6
|
+
InputNodeAppearances,
|
|
7
|
+
InputNodeInputValue,
|
|
8
|
+
} from '../client/InputNode.ts';
|
|
9
|
+
import type { TextRange } from '../client/TextRange.ts';
|
|
10
|
+
import type { ValueType } from '../client/ValueType.ts';
|
|
11
|
+
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
12
|
+
import type { RuntimeInputValue, RuntimeValue } from '../lib/codecs/getSharedValueCodec.ts';
|
|
13
|
+
import { getSharedValueCodec } from '../lib/codecs/getSharedValueCodec.ts';
|
|
14
|
+
import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
|
|
15
|
+
import type { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
|
|
16
|
+
import type { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
17
|
+
import { createSharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
18
|
+
import { createFieldHint } from '../lib/reactivity/text/createFieldHint.ts';
|
|
19
|
+
import { createNodeLabel } from '../lib/reactivity/text/createNodeLabel.ts';
|
|
20
|
+
import type { Root } from './Root.ts';
|
|
21
|
+
import { ValueNode, type ValueNodeStateSpec } from './abstract/ValueNode.ts';
|
|
22
|
+
import type { GeneralParentNode } from './hierarchy.ts';
|
|
23
|
+
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
24
|
+
import type { ValidationContext } from './internal-api/ValidationContext.ts';
|
|
25
|
+
import type { ClientReactiveSubmittableValueNode } from './internal-api/submission/ClientReactiveSubmittableValueNode.ts';
|
|
26
|
+
|
|
27
|
+
export type AnyInputDefinition = {
|
|
28
|
+
[V in ValueType]: InputDefinition<V>;
|
|
29
|
+
}[ValueType];
|
|
30
|
+
|
|
31
|
+
interface InputControlStateSpec<V extends ValueType> extends ValueNodeStateSpec<RuntimeValue<V>> {
|
|
32
|
+
readonly label: Accessor<TextRange<'label'> | null>;
|
|
33
|
+
readonly hint: Accessor<TextRange<'hint'> | null>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class InputControl<V extends ValueType = ValueType>
|
|
37
|
+
extends ValueNode<V, InputDefinition<V>, RuntimeValue<V>, RuntimeInputValue<V>>
|
|
38
|
+
implements
|
|
39
|
+
InputNode<V>,
|
|
40
|
+
XFormsXPathElement,
|
|
41
|
+
EvaluationContext,
|
|
42
|
+
ValidationContext,
|
|
43
|
+
ClientReactiveSubmittableValueNode
|
|
44
|
+
{
|
|
45
|
+
static from(parent: GeneralParentNode, definition: InputDefinition): AnyInputControl;
|
|
46
|
+
static from<V extends ValueType>(
|
|
47
|
+
parent: GeneralParentNode,
|
|
48
|
+
definition: InputDefinition<V>
|
|
49
|
+
): InputControl<V> {
|
|
50
|
+
return new this(parent, definition);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// XFormsXPathElement
|
|
54
|
+
override readonly [XPathNodeKindKey] = 'element';
|
|
55
|
+
|
|
56
|
+
// InstanceNode
|
|
57
|
+
protected readonly state: SharedNodeState<InputControlStateSpec<V>>;
|
|
58
|
+
protected readonly engineState: EngineState<InputControlStateSpec<V>>;
|
|
59
|
+
|
|
60
|
+
// InputNode
|
|
61
|
+
readonly nodeType = 'input';
|
|
62
|
+
readonly appearances: InputNodeAppearances;
|
|
63
|
+
readonly currentState: CurrentState<InputControlStateSpec<V>>;
|
|
64
|
+
|
|
65
|
+
constructor(parent: GeneralParentNode, definition: InputDefinition<V>) {
|
|
66
|
+
const codec = getSharedValueCodec(definition.valueType);
|
|
67
|
+
|
|
68
|
+
super(parent, definition, codec);
|
|
69
|
+
|
|
70
|
+
this.appearances = definition.bodyElement.appearances;
|
|
71
|
+
|
|
72
|
+
const sharedStateOptions = {
|
|
73
|
+
clientStateFactory: this.engineConfig.stateFactory,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const state = createSharedNodeState(
|
|
77
|
+
this.scope,
|
|
78
|
+
{
|
|
79
|
+
reference: this.contextReference,
|
|
80
|
+
readonly: this.isReadonly,
|
|
81
|
+
relevant: this.isRelevant,
|
|
82
|
+
required: this.isRequired,
|
|
83
|
+
|
|
84
|
+
label: createNodeLabel(this, definition),
|
|
85
|
+
hint: createFieldHint(this, definition),
|
|
86
|
+
children: null,
|
|
87
|
+
valueOptions: null,
|
|
88
|
+
value: this.valueState,
|
|
89
|
+
instanceValue: this.getInstanceValue,
|
|
90
|
+
},
|
|
91
|
+
sharedStateOptions
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
this.state = state;
|
|
95
|
+
this.engineState = state.engineState;
|
|
96
|
+
this.currentState = state.currentState;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
setValue(value: InputNodeInputValue<V>): Root {
|
|
100
|
+
this.setValueState(value);
|
|
101
|
+
|
|
102
|
+
return this.root;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type AnyInputControl =
|
|
107
|
+
| InputControl<'barcode'>
|
|
108
|
+
| InputControl<'binary'>
|
|
109
|
+
| InputControl<'boolean'>
|
|
110
|
+
| InputControl<'date'>
|
|
111
|
+
| InputControl<'dateTime'>
|
|
112
|
+
| InputControl<'decimal'>
|
|
113
|
+
| InputControl<'geopoint'>
|
|
114
|
+
| InputControl<'geoshape'>
|
|
115
|
+
| InputControl<'geotrace'>
|
|
116
|
+
| InputControl<'int'>
|
|
117
|
+
| InputControl<'intent'>
|
|
118
|
+
| InputControl<'string'>
|
|
119
|
+
| InputControl<'time'>;
|
|
@@ -1,65 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ModelValueNode } from '../client/ModelValueNode.ts';
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import type { ModelValueDefinition, ModelValueNode } from '../client/ModelValueNode.ts';
|
|
3
|
+
import type { ValueType } from '../client/ValueType.ts';
|
|
4
|
+
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
5
|
+
import type { RuntimeInputValue, RuntimeValue } from '../lib/codecs/getSharedValueCodec.ts';
|
|
6
|
+
import { getSharedValueCodec } from '../lib/codecs/getSharedValueCodec.ts';
|
|
5
7
|
import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
|
|
6
8
|
import type { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
|
|
7
9
|
import type { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
8
10
|
import { createSharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
9
|
-
import type
|
|
10
|
-
import type { SharedValidationState } from '../lib/reactivity/validation/createValidation.ts';
|
|
11
|
-
import { createValidationState } from '../lib/reactivity/validation/createValidation.ts';
|
|
12
|
-
import type { LeafNodeDefinition } from '../model/LeafNodeDefinition.ts';
|
|
13
|
-
import type { DescendantNodeStateSpec } from './abstract/DescendantNode.ts';
|
|
14
|
-
import { DescendantNode } from './abstract/DescendantNode.ts';
|
|
11
|
+
import { ValueNode, type ValueNodeStateSpec } from './abstract/ValueNode.ts';
|
|
15
12
|
import type { GeneralParentNode } from './hierarchy.ts';
|
|
16
13
|
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
17
|
-
import type { SubscribableDependency } from './internal-api/SubscribableDependency.ts';
|
|
18
14
|
import type { ValidationContext } from './internal-api/ValidationContext.ts';
|
|
19
|
-
import type {
|
|
15
|
+
import type { ClientReactiveSubmittableValueNode } from './internal-api/submission/ClientReactiveSubmittableValueNode.ts';
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
readonly bodyElement: null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface ModelValueStateSpec extends DescendantNodeStateSpec<string> {
|
|
17
|
+
interface ModelValueStateSpec<V extends ValueType> extends ValueNodeStateSpec<RuntimeValue<V>> {
|
|
26
18
|
readonly label: null;
|
|
27
19
|
readonly hint: null;
|
|
28
|
-
readonly children: null;
|
|
29
|
-
readonly value: SimpleAtomicState<string>;
|
|
30
|
-
readonly valueOptions: null;
|
|
31
20
|
}
|
|
32
21
|
|
|
33
|
-
export class ModelValue
|
|
34
|
-
extends
|
|
22
|
+
export class ModelValue<V extends ValueType = ValueType>
|
|
23
|
+
extends ValueNode<V, ModelValueDefinition<V>, RuntimeValue<V>, RuntimeInputValue<V>>
|
|
35
24
|
implements
|
|
36
|
-
ModelValueNode
|
|
25
|
+
ModelValueNode<V>,
|
|
26
|
+
XFormsXPathElement,
|
|
37
27
|
EvaluationContext,
|
|
38
|
-
SubscribableDependency,
|
|
39
28
|
ValidationContext,
|
|
40
|
-
|
|
29
|
+
ClientReactiveSubmittableValueNode
|
|
41
30
|
{
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
static from(parent: GeneralParentNode, definition: ModelValueDefinition): AnyModelValue;
|
|
32
|
+
static from<V extends ValueType>(
|
|
33
|
+
parent: GeneralParentNode,
|
|
34
|
+
definition: ModelValueDefinition<V>
|
|
35
|
+
): ModelValue<V> {
|
|
36
|
+
return new this(parent, definition);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// XFormsXPathElement
|
|
40
|
+
override readonly [XPathNodeKindKey] = 'element';
|
|
44
41
|
|
|
45
42
|
// InstanceNode
|
|
46
|
-
protected
|
|
43
|
+
protected readonly state: SharedNodeState<ModelValueStateSpec<V>>;
|
|
44
|
+
protected readonly engineState: EngineState<ModelValueStateSpec<V>>;
|
|
47
45
|
|
|
48
46
|
// ModelValueNode
|
|
49
47
|
readonly nodeType = 'model-value';
|
|
50
48
|
readonly appearances = null;
|
|
51
|
-
readonly currentState: CurrentState<ModelValueStateSpec
|
|
49
|
+
readonly currentState: CurrentState<ModelValueStateSpec<V>>;
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// ValueContext
|
|
58
|
-
readonly encodeValue = identity<string>;
|
|
59
|
-
readonly decodeValue = identity<string>;
|
|
51
|
+
constructor(parent: GeneralParentNode, definition: ModelValueDefinition<V>) {
|
|
52
|
+
const codec = getSharedValueCodec(definition.valueType);
|
|
60
53
|
|
|
61
|
-
|
|
62
|
-
super(parent, definition);
|
|
54
|
+
super(parent, definition, codec);
|
|
63
55
|
|
|
64
56
|
const sharedStateOptions = {
|
|
65
57
|
clientStateFactory: this.engineConfig.stateFactory,
|
|
@@ -77,7 +69,8 @@ export class ModelValue
|
|
|
77
69
|
hint: null,
|
|
78
70
|
children: null,
|
|
79
71
|
valueOptions: null,
|
|
80
|
-
value:
|
|
72
|
+
value: this.valueState,
|
|
73
|
+
instanceValue: this.getInstanceValue,
|
|
81
74
|
},
|
|
82
75
|
sharedStateOptions
|
|
83
76
|
);
|
|
@@ -85,20 +78,20 @@ export class ModelValue
|
|
|
85
78
|
this.state = state;
|
|
86
79
|
this.engineState = state.engineState;
|
|
87
80
|
this.currentState = state.currentState;
|
|
88
|
-
this.validation = createValidationState(this, sharedStateOptions);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
getViolation(): AnyViolation | null {
|
|
92
|
-
return this.validation.engineState.violation;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// ValidationContext
|
|
96
|
-
isBlank(): boolean {
|
|
97
|
-
return this.engineState.value === '';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// InstanceNode
|
|
101
|
-
getChildren(): readonly [] {
|
|
102
|
-
return [];
|
|
103
81
|
}
|
|
104
82
|
}
|
|
83
|
+
|
|
84
|
+
export type AnyModelValue =
|
|
85
|
+
| ModelValue<'barcode'>
|
|
86
|
+
| ModelValue<'binary'>
|
|
87
|
+
| ModelValue<'boolean'>
|
|
88
|
+
| ModelValue<'date'>
|
|
89
|
+
| ModelValue<'dateTime'>
|
|
90
|
+
| ModelValue<'decimal'>
|
|
91
|
+
| ModelValue<'geopoint'>
|
|
92
|
+
| ModelValue<'geoshape'>
|
|
93
|
+
| ModelValue<'geotrace'>
|
|
94
|
+
| ModelValue<'int'>
|
|
95
|
+
| ModelValue<'intent'>
|
|
96
|
+
| ModelValue<'string'>
|
|
97
|
+
| ModelValue<'time'>;
|
package/src/instance/Note.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { UnreachableError } from '@getodk/common/lib/error/UnreachableError.ts';
|
|
2
2
|
import { identity } from '@getodk/common/lib/identity.ts';
|
|
3
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
3
4
|
import type { Accessor } from 'solid-js';
|
|
4
5
|
import type { NoteNode, NoteNodeAppearances } from '../client/NoteNode.ts';
|
|
6
|
+
import type { SubmissionState } from '../client/submission/SubmissionState.ts';
|
|
5
7
|
import type { TextRange } from '../client/TextRange.ts';
|
|
6
8
|
import type { AnyViolation, LeafNodeValidationState } from '../client/validation.ts';
|
|
9
|
+
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
10
|
+
import { createLeafNodeSubmissionState } from '../lib/client-reactivity/submission/createLeafNodeSubmissionState.ts';
|
|
7
11
|
import { createNoteReadonlyThunk } from '../lib/reactivity/createNoteReadonlyThunk.ts';
|
|
8
12
|
import { createValueState } from '../lib/reactivity/createValueState.ts';
|
|
9
13
|
import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
|
|
@@ -16,12 +20,12 @@ import { createNoteText, type ComputedNoteText } from '../lib/reactivity/text/cr
|
|
|
16
20
|
import type { SimpleAtomicState } from '../lib/reactivity/types.ts';
|
|
17
21
|
import type { SharedValidationState } from '../lib/reactivity/validation/createValidation.ts';
|
|
18
22
|
import { createValidationState } from '../lib/reactivity/validation/createValidation.ts';
|
|
19
|
-
import type { NoteNodeDefinition } from '../parse/NoteNodeDefinition.ts';
|
|
23
|
+
import type { NoteNodeDefinition } from '../parse/model/NoteNodeDefinition.ts';
|
|
20
24
|
import type { DescendantNodeStateSpec } from './abstract/DescendantNode.ts';
|
|
21
25
|
import { DescendantNode } from './abstract/DescendantNode.ts';
|
|
22
26
|
import type { GeneralParentNode } from './hierarchy.ts';
|
|
23
27
|
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
24
|
-
import type {
|
|
28
|
+
import type { ClientReactiveSubmittableLeafNode } from './internal-api/submission/ClientReactiveSubmittableLeafNode.ts';
|
|
25
29
|
import type { ValidationContext } from './internal-api/ValidationContext.ts';
|
|
26
30
|
import type { ValueContext } from './internal-api/ValueContext.ts';
|
|
27
31
|
|
|
@@ -36,19 +40,23 @@ interface NoteStateSpec extends DescendantNodeStateSpec<string> {
|
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
export class Note
|
|
39
|
-
extends DescendantNode<NoteNodeDefinition, NoteStateSpec, null>
|
|
43
|
+
extends DescendantNode<NoteNodeDefinition, NoteStateSpec, GeneralParentNode, null>
|
|
40
44
|
implements
|
|
41
45
|
NoteNode,
|
|
46
|
+
XFormsXPathElement,
|
|
42
47
|
EvaluationContext,
|
|
43
|
-
SubscribableDependency,
|
|
44
48
|
ValidationContext,
|
|
45
|
-
ValueContext<string
|
|
49
|
+
ValueContext<string>,
|
|
50
|
+
ClientReactiveSubmittableLeafNode<string>
|
|
46
51
|
{
|
|
47
52
|
private readonly validation: SharedValidationState;
|
|
48
|
-
|
|
53
|
+
|
|
54
|
+
// XFormsXPathElement
|
|
55
|
+
override readonly [XPathNodeKindKey] = 'element';
|
|
49
56
|
|
|
50
57
|
// InstanceNode
|
|
51
|
-
protected
|
|
58
|
+
protected readonly state: SharedNodeState<NoteStateSpec>;
|
|
59
|
+
protected readonly engineState: EngineState<NoteStateSpec>;
|
|
52
60
|
|
|
53
61
|
// NoteNode
|
|
54
62
|
readonly nodeType = 'note';
|
|
@@ -59,9 +67,11 @@ export class Note
|
|
|
59
67
|
return this.validation.currentState;
|
|
60
68
|
}
|
|
61
69
|
|
|
70
|
+
readonly submissionState: SubmissionState;
|
|
71
|
+
|
|
62
72
|
// ValueContext
|
|
73
|
+
override readonly contextNode = this;
|
|
63
74
|
readonly encodeValue = identity<string>;
|
|
64
|
-
|
|
65
75
|
readonly decodeValue = identity<string>;
|
|
66
76
|
|
|
67
77
|
constructor(parent: GeneralParentNode, definition: NoteNodeDefinition) {
|
|
@@ -73,7 +83,7 @@ export class Note
|
|
|
73
83
|
clientStateFactory: this.engineConfig.stateFactory,
|
|
74
84
|
};
|
|
75
85
|
|
|
76
|
-
const isReadonly = createNoteReadonlyThunk(this, definition
|
|
86
|
+
const isReadonly = createNoteReadonlyThunk(this, definition);
|
|
77
87
|
const noteTextComputation = createNoteText(this, definition.noteTextDefinition);
|
|
78
88
|
|
|
79
89
|
let noteText: ComputedNoteText;
|
|
@@ -124,13 +134,19 @@ export class Note
|
|
|
124
134
|
this.engineState = state.engineState;
|
|
125
135
|
this.currentState = state.currentState;
|
|
126
136
|
this.validation = createValidationState(this, sharedStateOptions);
|
|
137
|
+
this.submissionState = createLeafNodeSubmissionState(this);
|
|
127
138
|
}
|
|
128
139
|
|
|
140
|
+
// XFormsXPathElement
|
|
141
|
+
override getXPathValue(): string {
|
|
142
|
+
return this.engineState.value;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ValidationContext
|
|
129
146
|
getViolation(): AnyViolation | null {
|
|
130
147
|
return this.validation.engineState.violation;
|
|
131
148
|
}
|
|
132
149
|
|
|
133
|
-
// ValidationContext
|
|
134
150
|
isBlank(): boolean {
|
|
135
151
|
return this.engineState.value === '';
|
|
136
152
|
}
|