@getodk/xforms-engine 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/client/BaseNode.d.ts +8 -4
- package/dist/client/BaseValueNode.d.ts +8 -4
- package/dist/client/GroupNode.d.ts +1 -0
- package/dist/client/InputNode.d.ts +32 -3
- package/dist/client/ModelValueNode.d.ts +1 -0
- package/dist/client/NoteNode.d.ts +24 -7
- package/dist/client/RangeNode.d.ts +36 -0
- package/dist/client/RankNode.d.ts +46 -0
- package/dist/client/RootNode.d.ts +21 -14
- package/dist/client/SelectNode.d.ts +47 -25
- package/dist/client/SubtreeNode.d.ts +1 -0
- package/dist/client/TriggerNode.d.ts +10 -6
- package/dist/client/constants.d.ts +11 -12
- package/dist/client/form/CreateFormInstance.d.ts +14 -0
- package/dist/client/form/EditFormInstance.d.ts +62 -0
- package/dist/client/form/FormInstance.d.ts +104 -0
- package/dist/client/form/FormInstanceConfig.d.ts +17 -0
- package/dist/client/form/FormResource.d.ts +1 -0
- package/dist/client/form/LoadForm.d.ts +79 -0
- package/dist/client/form/LoadFormResult.d.ts +67 -0
- package/dist/client/form/RestoreFormInstance.d.ts +8 -0
- package/dist/client/hierarchy.d.ts +5 -5
- package/dist/client/index.d.ts +37 -11
- package/dist/client/node-types.d.ts +2 -2
- package/dist/client/repeat/BaseRepeatRangeNode.d.ts +3 -4
- package/dist/client/repeat/RepeatInstanceNode.d.ts +4 -5
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +2 -2
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +2 -2
- package/dist/client/resources.d.ts +1 -1
- package/dist/client/serialization/InstanceData.d.ts +12 -0
- package/dist/client/serialization/InstanceFile.d.ts +6 -0
- package/dist/client/serialization/InstancePayload.d.ts +93 -0
- package/dist/client/serialization/InstancePayloadOptions.d.ts +23 -0
- package/dist/client/serialization/InstanceState.d.ts +12 -0
- package/dist/client/submission/{SubmissionDefinition.d.ts → SubmissionMeta.d.ts} +1 -1
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +1 -3
- package/dist/entrypoints/FormInstance.d.ts +20 -0
- package/dist/entrypoints/FormResult/BaseFormResult.d.ts +22 -0
- package/dist/entrypoints/FormResult/BaseInstantiableFormResult.d.ts +25 -0
- package/dist/entrypoints/FormResult/FormFailureResult.d.ts +17 -0
- package/dist/entrypoints/FormResult/FormSuccessResult.d.ts +15 -0
- package/dist/entrypoints/FormResult/FormWarningResult.d.ts +15 -0
- package/dist/entrypoints/createInstance.d.ts +9 -0
- package/dist/entrypoints/editInstance.d.ts +9 -0
- package/dist/entrypoints/index.d.ts +4 -0
- package/dist/entrypoints/loadForm.d.ts +4 -0
- package/dist/entrypoints/restoreInstance.d.ts +9 -0
- package/dist/error/LoadFormFailureError.d.ts +9 -0
- package/dist/error/MalformedInstanceDataError.d.ts +3 -0
- package/dist/error/RankMissingValueError.d.ts +3 -0
- package/dist/error/RankValueTypeError.d.ts +6 -0
- package/dist/error/SelectValueTypeError.d.ts +15 -0
- package/dist/error/TemplatedNodeAttributeSerializationError.d.ts +22 -0
- package/dist/error/XFormsSpecViolationError.d.ts +2 -0
- package/dist/index.d.ts +2 -34
- package/dist/index.js +7274 -5840
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +7 -5
- package/dist/instance/InputControl.d.ts +9 -6
- package/dist/instance/ModelValue.d.ts +7 -4
- package/dist/instance/Note.d.ts +14 -25
- package/dist/instance/PrimaryInstance.d.ts +36 -8
- package/dist/instance/RangeControl.d.ts +35 -0
- package/dist/instance/RankControl.d.ts +41 -0
- package/dist/instance/Root.d.ts +8 -9
- package/dist/instance/SelectControl.d.ts +67 -0
- package/dist/instance/Subtree.d.ts +7 -5
- package/dist/instance/TriggerControl.d.ts +10 -22
- package/dist/instance/abstract/DescendantNode.d.ts +11 -3
- package/dist/instance/abstract/InstanceNode.d.ts +10 -5
- package/dist/instance/abstract/ValueNode.d.ts +7 -6
- package/dist/instance/children/DescendantNodeInitOptions.d.ts +32 -0
- package/dist/instance/{children.d.ts → children/buildChildren.d.ts} +1 -1
- package/dist/instance/children/childrenInitOptions.d.ts +9 -0
- package/dist/instance/children/normalizeChildInitOptions.d.ts +2 -0
- package/dist/instance/hierarchy.d.ts +9 -9
- package/dist/instance/input/InitialInstanceState.d.ts +13 -0
- package/dist/instance/input/InstanceAttachmentMap.d.ts +19 -0
- package/dist/instance/internal-api/InstanceConfig.d.ts +2 -9
- package/dist/instance/internal-api/InstanceValueContext.d.ts +10 -1
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableInstance.d.ts +14 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableLeafNode.d.ts +32 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableParentNode.d.ts +18 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.d.ts +13 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableValueNode.d.ts +21 -0
- package/dist/instance/repeat/BaseRepeatRange.d.ts +11 -8
- package/dist/instance/repeat/RepeatInstance.d.ts +11 -7
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +27 -3
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +4 -3
- package/dist/instance/resource.d.ts +5 -1
- package/dist/instance/unsupported/UploadControl.d.ts +32 -4
- package/dist/integration/xpath/EngineXPathEvaluator.d.ts +2 -2
- package/dist/integration/xpath/adapter/kind.d.ts +4 -10
- package/dist/integration/xpath/adapter/names.d.ts +1 -11
- package/dist/integration/xpath/adapter/traversal.d.ts +10 -9
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +10 -4
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +13 -11
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +25 -18
- package/dist/integration/xpath/static-dom/StaticNode.d.ts +1 -1
- package/dist/integration/xpath/static-dom/StaticParentNode.d.ts +13 -0
- package/dist/integration/xpath/static-dom/staticNodeName.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createNodeRangeInstanceState.d.ts +4 -0
- package/dist/lib/client-reactivity/instance-state/createParentNodeInstanceState.d.ts +4 -0
- package/dist/lib/client-reactivity/instance-state/createPrimaryInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createRootInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.d.ts +6 -0
- package/dist/lib/client-reactivity/instance-state/createValueNodeInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/prepareInstancePayload.d.ts +8 -0
- package/dist/lib/codecs/Geopoint/Geopoint.d.ts +48 -0
- package/dist/lib/codecs/Geopoint/GeopointValueCodec.d.ts +5 -0
- package/dist/lib/codecs/NoteCodec.d.ts +8 -0
- package/dist/lib/codecs/RangeCodec.d.ts +8 -0
- package/dist/lib/codecs/TempUnsupportedControlCodec.d.ts +7 -0
- package/dist/lib/codecs/TriggerCodec.d.ts +7 -0
- package/dist/lib/codecs/ValueArrayCodec.d.ts +11 -0
- package/dist/lib/codecs/ValueCodec.d.ts +2 -2
- package/dist/lib/codecs/getNoteCodec.d.ts +3 -0
- package/dist/lib/codecs/getSelectCodec.d.ts +5 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +3 -2
- package/dist/lib/codecs/items/BaseItemCodec.d.ts +9 -0
- package/dist/lib/codecs/items/MultipleValueItemCodec.d.ts +14 -0
- package/dist/lib/codecs/items/SingleValueItemCodec.d.ts +24 -0
- package/dist/lib/dom/query.d.ts +1 -2
- package/dist/lib/names/NamespaceDeclaration.d.ts +45 -0
- package/dist/lib/names/NamespaceDeclarationMap.d.ts +137 -0
- package/dist/lib/names/NamespaceURL.d.ts +30 -0
- package/dist/lib/names/QualifiedName.d.ts +113 -0
- package/dist/lib/names/UnprefixedXFormsName.d.ts +4 -0
- package/dist/lib/number-parsers.d.ts +2 -0
- package/dist/lib/reactivity/createInstanceValueState.d.ts +2 -27
- package/dist/lib/reactivity/createItemCollection.d.ts +21 -0
- package/dist/lib/xml-serialization.d.ts +11 -2
- package/dist/parse/XFormDOM.d.ts +1 -1
- package/dist/parse/body/BodyDefinition.d.ts +2 -2
- package/dist/parse/body/appearance/rangeAppearanceParser.d.ts +3 -0
- package/dist/parse/body/control/InputControlDefinition.d.ts +3 -0
- package/dist/parse/body/control/ItemDefinition.d.ts +14 -0
- package/dist/parse/body/control/ItemsetDefinition.d.ts +18 -0
- package/dist/parse/body/control/RangeControlDefinition.d.ts +31 -2
- package/dist/parse/body/control/RankControlDefinition.d.ts +7 -3
- package/dist/parse/body/control/{select/SelectDefinition.d.ts → SelectControlDefinition.d.ts} +9 -9
- package/dist/parse/expression/ItemsetNodesetExpression.d.ts +1 -1
- package/dist/parse/expression/ItemsetValueExpression.d.ts +1 -1
- package/dist/parse/model/BindDefinition.d.ts +3 -1
- package/dist/parse/model/BindPreloadDefinition.d.ts +42 -0
- package/dist/parse/model/DescendentNodeDefinition.d.ts +4 -13
- package/dist/parse/model/ItextTranslationsDefinition.d.ts +18 -0
- package/dist/parse/model/LeafNodeDefinition.d.ts +9 -7
- package/dist/parse/model/ModelDefinition.d.ts +9 -2
- package/dist/parse/model/NodeDefinition.d.ts +30 -45
- package/dist/parse/model/NoteNodeDefinition.d.ts +7 -5
- package/dist/parse/model/RangeNodeDefinition.d.ts +42 -0
- package/dist/parse/model/RepeatDefinition.d.ts +62 -0
- package/dist/parse/model/RootAttributeDefinition.d.ts +21 -0
- package/dist/parse/model/RootAttributeMap.d.ts +24 -0
- package/dist/parse/model/RootDefinition.d.ts +15 -14
- package/dist/parse/model/SecondaryInstance/SecondaryInstancesDefinition.d.ts +15 -2
- package/dist/parse/model/SecondaryInstance/assertSecondaryInstanceDefinition.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/defineSecondaryInstance.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.d.ts +1 -7
- package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/{FormSubmissionDefinition.d.ts → SubmissionDefinition.d.ts} +2 -2
- package/dist/parse/model/SubtreeDefinition.d.ts +9 -7
- package/dist/parse/model/nodeDefinitionMap.d.ts +5 -0
- package/dist/parse/shared/parseInstanceXML.d.ts +21 -0
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +4 -22
- package/dist/parse/text/ItemLabelDefinition.d.ts +1 -1
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +2 -2
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +1 -1
- package/dist/parse/xpath/semantic-analysis.d.ts +1 -3
- package/dist/solid.js +7247 -5813
- package/dist/solid.js.map +1 -1
- package/package.json +15 -12
- package/src/client/BaseNode.ts +9 -4
- package/src/client/BaseValueNode.ts +8 -4
- package/src/client/GroupNode.ts +1 -0
- package/src/client/InputNode.ts +38 -2
- package/src/client/ModelValueNode.ts +1 -0
- package/src/client/NoteNode.ts +43 -7
- package/src/client/RangeNode.ts +51 -0
- package/src/client/RankNode.ts +54 -0
- package/src/client/RootNode.ts +30 -16
- package/src/client/SelectNode.ts +53 -26
- package/src/client/SubtreeNode.ts +1 -0
- package/src/client/TriggerNode.ts +12 -6
- package/src/client/constants.ts +12 -14
- package/src/client/form/CreateFormInstance.ts +19 -0
- package/src/client/form/EditFormInstance.ts +93 -0
- package/src/client/form/FormInstance.ts +114 -0
- package/src/client/form/FormInstanceConfig.ts +18 -0
- package/src/client/form/FormResource.ts +1 -0
- package/src/client/form/LoadForm.ts +92 -0
- package/src/client/form/LoadFormResult.ts +103 -0
- package/src/client/form/RestoreFormInstance.ts +14 -0
- package/src/client/hierarchy.ts +7 -8
- package/src/client/index.ts +47 -29
- package/src/client/node-types.ts +3 -5
- package/src/client/repeat/BaseRepeatRangeNode.ts +3 -4
- package/src/client/repeat/RepeatInstanceNode.ts +4 -8
- package/src/client/repeat/RepeatRangeControlledNode.ts +2 -2
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +2 -2
- package/src/client/resources.ts +2 -2
- package/src/client/serialization/InstanceData.ts +16 -0
- package/src/client/serialization/InstanceFile.ts +9 -0
- package/src/client/serialization/InstancePayload.ts +126 -0
- package/src/client/serialization/InstancePayloadOptions.ts +28 -0
- package/src/client/serialization/InstanceState.ts +14 -0
- package/src/client/submission/{SubmissionDefinition.ts → SubmissionMeta.ts} +1 -1
- package/src/client/unsupported/UnsupportedControlNode.ts +2 -6
- package/src/entrypoints/FormInstance.ts +55 -0
- package/src/entrypoints/FormResult/BaseFormResult.ts +40 -0
- package/src/entrypoints/FormResult/BaseInstantiableFormResult.ts +109 -0
- package/src/entrypoints/FormResult/FormFailureResult.ts +44 -0
- package/src/entrypoints/FormResult/FormSuccessResult.ts +25 -0
- package/src/entrypoints/FormResult/FormWarningResult.ts +25 -0
- package/src/entrypoints/createInstance.ts +23 -0
- package/src/entrypoints/editInstance.ts +24 -0
- package/src/entrypoints/index.ts +4 -0
- package/src/entrypoints/loadForm.ts +154 -0
- package/src/entrypoints/restoreInstance.ts +27 -0
- package/src/error/LoadFormFailureError.ts +114 -0
- package/src/error/MalformedInstanceDataError.ts +3 -0
- package/src/error/RankMissingValueError.ts +5 -0
- package/src/error/RankValueTypeError.ts +13 -0
- package/src/error/SelectValueTypeError.ts +22 -0
- package/src/error/TemplatedNodeAttributeSerializationError.ts +24 -0
- package/src/error/XFormsSpecViolationError.ts +1 -0
- package/src/index.ts +2 -56
- package/src/instance/Group.ts +17 -15
- package/src/instance/InputControl.ts +58 -12
- package/src/instance/ModelValue.ts +19 -11
- package/src/instance/Note.ts +40 -64
- package/src/instance/PrimaryInstance.ts +70 -31
- package/src/instance/RangeControl.ts +119 -0
- package/src/instance/RankControl.ts +208 -0
- package/src/instance/Root.ts +21 -31
- package/src/instance/SelectControl.ts +228 -0
- package/src/instance/Subtree.ts +17 -15
- package/src/instance/TriggerControl.ts +50 -80
- package/src/instance/abstract/DescendantNode.ts +13 -8
- package/src/instance/abstract/InstanceNode.ts +19 -7
- package/src/instance/abstract/ValueNode.ts +14 -15
- package/src/instance/children/DescendantNodeInitOptions.ts +35 -0
- package/src/instance/children/buildChildren.ts +206 -0
- package/src/instance/children/childrenInitOptions.ts +117 -0
- package/src/instance/children/normalizeChildInitOptions.ts +332 -0
- package/src/instance/hierarchy.ts +21 -16
- package/src/instance/input/InitialInstanceState.ts +108 -0
- package/src/instance/input/InstanceAttachmentMap.ts +142 -0
- package/src/instance/internal-api/InstanceConfig.ts +3 -10
- package/src/instance/internal-api/InstanceValueContext.ts +11 -1
- package/src/instance/internal-api/serialization/ClientReactiveSerializableInstance.ts +20 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableLeafNode.ts +43 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableParentNode.ts +26 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.ts +24 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableValueNode.ts +28 -0
- package/src/instance/repeat/BaseRepeatRange.ts +21 -24
- package/src/instance/repeat/RepeatInstance.ts +27 -19
- package/src/instance/repeat/RepeatRangeControlled.ts +90 -17
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +10 -9
- package/src/instance/resource.ts +18 -2
- package/src/instance/unsupported/UploadControl.ts +116 -5
- package/src/integration/xpath/EngineXPathEvaluator.ts +2 -2
- package/src/integration/xpath/adapter/kind.ts +1 -28
- package/src/integration/xpath/adapter/names.ts +66 -17
- package/src/integration/xpath/adapter/traversal.ts +12 -11
- package/src/integration/xpath/static-dom/StaticAttribute.ts +16 -7
- package/src/integration/xpath/static-dom/StaticDocument.ts +17 -18
- package/src/integration/xpath/static-dom/StaticElement.ts +211 -52
- package/src/integration/xpath/static-dom/StaticNode.ts +1 -1
- package/src/integration/xpath/static-dom/StaticParentNode.ts +22 -0
- package/src/integration/xpath/static-dom/staticNodeName.ts +20 -0
- package/src/lib/client-reactivity/instance-state/createNodeRangeInstanceState.ts +17 -0
- package/src/lib/client-reactivity/instance-state/createParentNodeInstanceState.ts +22 -0
- package/src/lib/client-reactivity/instance-state/createPrimaryInstanceState.ts +12 -0
- package/src/lib/client-reactivity/instance-state/createRootInstanceState.ts +19 -0
- package/src/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.ts +31 -0
- package/src/lib/client-reactivity/instance-state/createValueNodeInstanceState.ts +21 -0
- package/src/lib/client-reactivity/instance-state/prepareInstancePayload.ts +173 -0
- package/src/lib/codecs/Geopoint/Geopoint.ts +150 -0
- package/src/lib/codecs/Geopoint/GeopointValueCodec.ts +20 -0
- package/src/lib/codecs/NoteCodec.ts +32 -0
- package/src/lib/codecs/RangeCodec.ts +65 -0
- package/src/lib/codecs/TempUnsupportedControlCodec.ts +32 -0
- package/src/lib/codecs/TriggerCodec.ts +64 -0
- package/src/lib/codecs/ValueArrayCodec.ts +42 -0
- package/src/lib/codecs/ValueCodec.ts +2 -2
- package/src/lib/codecs/getNoteCodec.ts +27 -0
- package/src/lib/codecs/getSelectCodec.ts +27 -0
- package/src/lib/codecs/getSharedValueCodec.ts +5 -3
- package/src/lib/codecs/items/BaseItemCodec.ts +20 -0
- package/src/lib/codecs/items/MultipleValueItemCodec.ts +28 -0
- package/src/lib/codecs/items/SingleValueItemCodec.ts +67 -0
- package/src/lib/dom/query.ts +1 -2
- package/src/lib/names/NamespaceDeclaration.ts +106 -0
- package/src/lib/names/NamespaceDeclarationMap.ts +228 -0
- package/src/lib/names/NamespaceURL.ts +44 -0
- package/src/lib/names/QualifiedName.ts +170 -0
- package/src/lib/names/UnprefixedXFormsName.ts +12 -0
- package/src/lib/number-parsers.ts +25 -0
- package/src/lib/reactivity/createInstanceValueState.ts +69 -43
- package/src/lib/reactivity/{createSelectItems.ts → createItemCollection.ts} +41 -36
- package/src/lib/xml-serialization.ts +76 -9
- package/src/parse/XFormDOM.ts +141 -21
- package/src/parse/XFormDefinition.ts +1 -4
- package/src/parse/body/BodyDefinition.ts +4 -4
- package/src/parse/body/appearance/rangeAppearanceParser.ts +11 -0
- package/src/parse/body/control/InputControlDefinition.ts +9 -0
- package/src/parse/body/control/{select/ItemDefinition.ts → ItemDefinition.ts} +8 -6
- package/src/parse/body/control/{select/ItemsetDefinition.ts → ItemsetDefinition.ts} +11 -9
- package/src/parse/body/control/RangeControlDefinition.ts +91 -6
- package/src/parse/body/control/RankControlDefinition.ts +25 -7
- package/src/parse/body/control/{select/SelectDefinition.ts → SelectControlDefinition.ts} +9 -9
- package/src/parse/expression/ItemsetNodesetExpression.ts +1 -1
- package/src/parse/expression/ItemsetValueExpression.ts +1 -1
- package/src/parse/model/BindDefinition.ts +4 -0
- package/src/parse/model/BindPreloadDefinition.ts +100 -0
- package/src/parse/model/DescendentNodeDefinition.ts +7 -25
- package/src/parse/model/ItextTranslationsDefinition.ts +79 -0
- package/src/parse/model/LeafNodeDefinition.ts +13 -8
- package/src/parse/model/ModelDefinition.ts +36 -3
- package/src/parse/model/NodeDefinition.ts +38 -85
- package/src/parse/model/NoteNodeDefinition.ts +12 -10
- package/src/parse/model/RangeNodeDefinition.ts +119 -0
- package/src/parse/model/RepeatDefinition.ts +382 -0
- package/src/parse/model/RootAttributeDefinition.ts +44 -0
- package/src/parse/model/RootAttributeMap.ts +49 -0
- package/src/parse/model/RootDefinition.ts +42 -43
- package/src/parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts +23 -2
- package/src/parse/model/SecondaryInstance/assertSecondaryInstanceDefinition.ts +14 -0
- package/src/parse/model/SecondaryInstance/defineSecondaryInstance.ts +32 -0
- package/src/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.ts +3 -24
- package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +33 -86
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +64 -136
- package/src/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.ts +9 -7
- package/src/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.ts +1 -1
- package/src/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.ts +7 -7
- package/src/parse/model/{FormSubmissionDefinition.ts → SubmissionDefinition.ts} +2 -2
- package/src/parse/model/SubtreeDefinition.ts +15 -16
- package/src/parse/model/nodeDefinitionMap.ts +34 -0
- package/src/parse/shared/parseInstanceXML.ts +79 -0
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +46 -131
- package/src/parse/text/ItemLabelDefinition.ts +1 -1
- package/src/parse/text/ItemsetLabelDefinition.ts +2 -2
- package/src/parse/text/abstract/TextElementDefinition.ts +1 -1
- package/src/parse/xpath/semantic-analysis.ts +4 -3
- package/dist/client/EngineConfig.d.ts +0 -79
- package/dist/client/submission/SubmissionData.d.ts +0 -7
- package/dist/client/submission/SubmissionInstanceFile.d.ts +0 -6
- package/dist/client/submission/SubmissionOptions.d.ts +0 -23
- package/dist/client/submission/SubmissionResult.d.ts +0 -91
- package/dist/client/submission/SubmissionState.d.ts +0 -12
- package/dist/client/unsupported/RangeNode.d.ts +0 -9
- package/dist/client/unsupported/RankNode.d.ts +0 -9
- package/dist/instance/SelectField.d.ts +0 -58
- package/dist/instance/abstract/UnsupportedControl.d.ts +0 -53
- package/dist/instance/index.d.ts +0 -8
- package/dist/instance/internal-api/ValueContext.d.ts +0 -23
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +0 -14
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +0 -31
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +0 -18
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +0 -17
- package/dist/instance/unsupported/RangeControl.d.ts +0 -6
- package/dist/instance/unsupported/RankControl.d.ts +0 -6
- package/dist/integration/xpath/static-dom/StaticNamedNode.d.ts +0 -17
- package/dist/lib/client-reactivity/submission/createInstanceSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createLeafNodeSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createNodeRangeSubmissionState.d.ts +0 -4
- package/dist/lib/client-reactivity/submission/createParentNodeSubmissionState.d.ts +0 -4
- package/dist/lib/client-reactivity/submission/createValueNodeSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/prepareSubmission.d.ts +0 -8
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -16
- package/dist/lib/reactivity/createValueState.d.ts +0 -40
- package/dist/parse/body/control/select/ItemDefinition.d.ts +0 -13
- package/dist/parse/body/control/select/ItemsetDefinition.d.ts +0 -17
- package/dist/parse/body/control/select/ItemsetNodesetContext.d.ts +0 -9
- package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +0 -4
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +0 -8
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +0 -8
- package/dist/parse/model/RepeatInstanceDefinition.d.ts +0 -14
- package/dist/parse/model/RepeatRangeDefinition.d.ts +0 -29
- package/dist/parse/model/RepeatTemplateDefinition.d.ts +0 -28
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceDefinition.d.ts +0 -4
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.d.ts +0 -7
- package/src/client/EngineConfig.ts +0 -84
- package/src/client/submission/SubmissionData.ts +0 -12
- package/src/client/submission/SubmissionInstanceFile.ts +0 -9
- package/src/client/submission/SubmissionOptions.ts +0 -28
- package/src/client/submission/SubmissionResult.ts +0 -124
- package/src/client/submission/SubmissionState.ts +0 -14
- package/src/client/unsupported/RangeNode.ts +0 -14
- package/src/client/unsupported/RankNode.ts +0 -14
- package/src/instance/SelectField.ts +0 -263
- package/src/instance/abstract/UnsupportedControl.ts +0 -174
- package/src/instance/children.ts +0 -158
- package/src/instance/index.ts +0 -55
- package/src/instance/internal-api/ValueContext.ts +0 -28
- package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +0 -20
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +0 -42
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +0 -25
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +0 -23
- package/src/instance/unsupported/RangeControl.ts +0 -9
- package/src/instance/unsupported/RankControl.ts +0 -9
- package/src/integration/xpath/static-dom/StaticNamedNode.ts +0 -45
- package/src/lib/client-reactivity/submission/createInstanceSubmissionState.ts +0 -12
- package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +0 -20
- package/src/lib/client-reactivity/submission/createNodeRangeSubmissionState.ts +0 -17
- package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +0 -22
- package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +0 -21
- package/src/lib/client-reactivity/submission/prepareSubmission.ts +0 -172
- package/src/lib/reactivity/createValueState.ts +0 -200
- package/src/parse/body/control/select/ItemsetNodesetContext.ts +0 -21
- package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +0 -4
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +0 -41
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +0 -31
- package/src/parse/model/RepeatInstanceDefinition.ts +0 -34
- package/src/parse/model/RepeatRangeDefinition.ts +0 -94
- package/src/parse/model/RepeatTemplateDefinition.ts +0 -145
- package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +0 -4
- package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +0 -12
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { JAVAROSA_NAMESPACE_URI } from '../../../../common/src/constants/xmlns.ts';
|
|
2
|
-
import { RepeatElementDefinition } from '../body/RepeatElementDefinition.ts';
|
|
3
|
-
import { DescendentNodeDefinition } from './DescendentNodeDefinition.ts';
|
|
4
|
-
import { ChildNodeDefinition, NodeDefinition } from './NodeDefinition.ts';
|
|
5
|
-
import { RepeatRangeDefinition } from './RepeatRangeDefinition.ts';
|
|
6
|
-
interface ExplicitRepeatTemplateElement extends Element {
|
|
7
|
-
getAttributeNS(namespaceURI: typeof JAVAROSA_NAMESPACE_URI, name: 'template'): string;
|
|
8
|
-
getAttributeNS(namespaceURI: string | null, name: string): string | null;
|
|
9
|
-
hasAttributeNS(namespaceURI: typeof JAVAROSA_NAMESPACE_URI, name: 'template'): true;
|
|
10
|
-
(namespaceURI: string | null, name: string): boolean;
|
|
11
|
-
}
|
|
12
|
-
interface ParsedRepeatNodes {
|
|
13
|
-
readonly template: RepeatTemplateDefinition;
|
|
14
|
-
readonly instanceNodes: readonly Element[];
|
|
15
|
-
}
|
|
16
|
-
export declare class RepeatTemplateDefinition extends DescendentNodeDefinition<'repeat-template', RepeatElementDefinition> implements NodeDefinition<'repeat-template'> {
|
|
17
|
-
protected readonly templateNode: ExplicitRepeatTemplateElement;
|
|
18
|
-
static parseModelNodes(range: RepeatRangeDefinition, modelNodes: readonly [Element, ...Element[]]): ParsedRepeatNodes;
|
|
19
|
-
readonly type = "repeat-template";
|
|
20
|
-
readonly node: Element;
|
|
21
|
-
readonly nodeName: string;
|
|
22
|
-
readonly children: readonly ChildNodeDefinition[];
|
|
23
|
-
readonly instances: null;
|
|
24
|
-
readonly defaultValue: null;
|
|
25
|
-
protected constructor(range: RepeatRangeDefinition, templateNode: ExplicitRepeatTemplateElement);
|
|
26
|
-
toJSON(): Omit<this, "parent" | "toJSON" | "bind" | "root" | "bodyElement">;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { StaticDocument } from '../../../integration/xpath/static-dom/StaticDocument.ts';
|
|
2
|
-
import { SecondaryInstanceRootDefinition } from './SecondaryInstanceRootDefinition.ts';
|
|
3
|
-
export declare class SecondaryInstanceDefinition extends StaticDocument<SecondaryInstanceRootDefinition> {
|
|
4
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { XFormsSecondaryInstanceElement, XFORMS_KNOWN_ATTRIBUTE, XFORMS_LOCAL_NAME } from '@getodk/xpath';
|
|
2
|
-
import { StaticElement } from '../../../integration/xpath/static-dom/StaticElement.ts';
|
|
3
|
-
import { SecondaryInstanceDefinition } from './SecondaryInstanceDefinition.ts';
|
|
4
|
-
export declare class SecondaryInstanceRootDefinition extends StaticElement<SecondaryInstanceDefinition> implements XFormsSecondaryInstanceElement<StaticElement> {
|
|
5
|
-
readonly [XFORMS_LOCAL_NAME] = "instance";
|
|
6
|
-
readonly [XFORMS_KNOWN_ATTRIBUTE] = "id";
|
|
7
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { initializeForm } from '../instance/index.ts';
|
|
2
|
-
import type { MissingResourceBehavior, MissingResourceBehaviorDefault } from './constants.ts';
|
|
3
|
-
import type { OpaqueReactiveObjectFactory } from './OpaqueReactiveObjectFactory.ts';
|
|
4
|
-
import type { FetchFormAttachment, FetchResource } from './resources.ts';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Options provided by a client to specify certain aspects of engine runtime
|
|
8
|
-
* behavior. These options will generally be intended to facilitate cooperation
|
|
9
|
-
* where there is mixed responsibility between a client and the engine, or where
|
|
10
|
-
* the engine may provide sensible defaults which a client could be expected to
|
|
11
|
-
* override or augment.
|
|
12
|
-
*/
|
|
13
|
-
export interface EngineConfig {
|
|
14
|
-
/**
|
|
15
|
-
* A client may specify a generic function for constructing stateful objects.
|
|
16
|
-
* The only hard requirement of this function is that it accepts an **object**
|
|
17
|
-
* and returns an object of the same shape. The engine will use this function
|
|
18
|
-
* to initialize client-facing state, and will mutate properties of the object
|
|
19
|
-
* when their corresponding state is changed.
|
|
20
|
-
*
|
|
21
|
-
* A client may use this function to provide its own implementation of
|
|
22
|
-
* reactivity with semantics like those described above. The mechanism of
|
|
23
|
-
* reactivity, if any, is at the discretion of the client. It is expected
|
|
24
|
-
* that clients providing this function will use a reactive subscribe-on-read
|
|
25
|
-
* mechanism to handle state updates conveyed by the engine.
|
|
26
|
-
*/
|
|
27
|
-
readonly stateFactory?: OpaqueReactiveObjectFactory;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* A client may specify an arbitrary {@link fetch}-like function for retrieving an XML XForm form
|
|
32
|
-
* definition.
|
|
33
|
-
*
|
|
34
|
-
* Notes:
|
|
35
|
-
*
|
|
36
|
-
* - This configuration will only be consuled for calls to
|
|
37
|
-
* {@link initializeForm} with a URL referencing an XML XForm definition. It
|
|
38
|
-
* will be ignored for calls passing an XML XForm form definition directly.
|
|
39
|
-
*
|
|
40
|
-
* - For calls to {@link initializeForm} with a URL, if this configuration is
|
|
41
|
-
* not specified it will default to the global {@link fetch} function (if
|
|
42
|
-
* one is defined).
|
|
43
|
-
*/
|
|
44
|
-
readonly fetchFormDefinition?: FetchResource;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* A client may specify an arbitrary {@link fetch}-like function to retrieve a
|
|
48
|
-
* form's attachments, i.e. any `jr:` URL referenced by the form (as specified
|
|
49
|
-
* by {@link https://getodk.github.io/xforms-spec/ | ODK XForms}).
|
|
50
|
-
*
|
|
51
|
-
* Notes:
|
|
52
|
-
*
|
|
53
|
-
* - This configuration will be consulted for all supported form attachments,
|
|
54
|
-
* as a part of {@link initializeForm | form initialization}.
|
|
55
|
-
*
|
|
56
|
-
* - If this configuration is not specified it will default to the global
|
|
57
|
-
* {@link fetch} function (if one is defined).
|
|
58
|
-
*
|
|
59
|
-
* This default behavior will typically result in failure to load form
|
|
60
|
-
* attachments—and in most cases this will also cause
|
|
61
|
-
* {@link initializeForm | form initialization} to fail overall—with the
|
|
62
|
-
* following exceptions:
|
|
63
|
-
*
|
|
64
|
-
* - **CLIENT-SPECIFIC:** Usage in coordination with a client-implemented
|
|
65
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API | Serivce Worker},
|
|
66
|
-
* which can intercept network requests **generally**. Clients already using
|
|
67
|
-
* a Service Worker may opt for the convenience of handling network requests
|
|
68
|
-
* for `jr:` URLs along with any other network interception logic. Client
|
|
69
|
-
* implementors should be warned, however, that such `jr:` URLs are not
|
|
70
|
-
* namespaced or otherwise scoped to a particular form; such a client would
|
|
71
|
-
* therefore inherently need to coordinate state between the Service Worker
|
|
72
|
-
* and the main thread (or whatever other realm calls
|
|
73
|
-
* {@link initializeForm}).
|
|
74
|
-
*/
|
|
75
|
-
readonly fetchFormAttachment?: FetchFormAttachment;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @see {@link MissingResourceBehavior}
|
|
79
|
-
* @see {@link MissingResourceBehaviorDefault}
|
|
80
|
-
*
|
|
81
|
-
* @default MissingResourceBehaviorDefault
|
|
82
|
-
*/
|
|
83
|
-
readonly missingResourceBehavior?: MissingResourceBehavior;
|
|
84
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
SubmissionInstanceFile,
|
|
3
|
-
SubmissionInstanceFileName,
|
|
4
|
-
} from './SubmissionInstanceFile.ts';
|
|
5
|
-
|
|
6
|
-
export interface SubmissionData extends FormData {
|
|
7
|
-
get(name: SubmissionInstanceFileName): SubmissionInstanceFile;
|
|
8
|
-
get(name: string): FormDataEntryValue | null;
|
|
9
|
-
|
|
10
|
-
has(name: SubmissionInstanceFileName): true;
|
|
11
|
-
has(name: string): boolean;
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SubmissionInstanceFileName, SubmissionInstanceFileType } from '../constants.ts';
|
|
2
|
-
|
|
3
|
-
// Re-export for convenient `SubmissionInstanceFile` construction/access flows
|
|
4
|
-
export type { SubmissionInstanceFileName, SubmissionInstanceFileType };
|
|
5
|
-
|
|
6
|
-
export interface SubmissionInstanceFile extends File {
|
|
7
|
-
readonly name: SubmissionInstanceFileName;
|
|
8
|
-
readonly type: SubmissionInstanceFileType;
|
|
9
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type SubmissionChunkedType = 'chunked' | 'monolithic';
|
|
2
|
-
|
|
3
|
-
interface BaseSubmissionOptions<ChunkedType extends SubmissionChunkedType> {
|
|
4
|
-
readonly chunked?: ChunkedType | undefined;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* As described in the
|
|
8
|
-
* {@link https://docs.getodk.org/openrosa-form-submission/#extended-transmission-considerations | OpenRosa Form Submission API},
|
|
9
|
-
* clients may obtain this value from an OpenRosa server's
|
|
10
|
-
* `X-OpenRosa-Accept-Content-Length` header.
|
|
11
|
-
*/
|
|
12
|
-
readonly maxSize?: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface ChunkedSubmissionOptions extends BaseSubmissionOptions<'chunked'> {
|
|
16
|
-
readonly maxSize: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface MonolithicSubmissionOptions extends BaseSubmissionOptions<'monolithic'> {
|
|
20
|
-
readonly chunked?: 'monolithic' | undefined;
|
|
21
|
-
readonly maxSize?: never;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// prettier-ignore
|
|
25
|
-
export type SubmissionOptions<ChunkedType extends SubmissionChunkedType = 'monolithic'> = {
|
|
26
|
-
chunked: ChunkedSubmissionOptions;
|
|
27
|
-
monolithic: MonolithicSubmissionOptions;
|
|
28
|
-
}[ChunkedType];
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import type { AnyViolation, DescendantNodeViolationReference } from '../validation.ts';
|
|
2
|
-
import type { SubmissionData } from './SubmissionData.ts';
|
|
3
|
-
import type { SubmissionDefinition } from './SubmissionDefinition.ts';
|
|
4
|
-
import type { SubmissionChunkedType, SubmissionOptions } from './SubmissionOptions.ts';
|
|
5
|
-
|
|
6
|
-
// prettier-ignore
|
|
7
|
-
export type SubmissionResultStatus =
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/sort-type-constituents
|
|
9
|
-
| 'pending'
|
|
10
|
-
| 'max-size-exceeded'
|
|
11
|
-
| 'ready';
|
|
12
|
-
|
|
13
|
-
// prettier-ignore
|
|
14
|
-
type SubmissionResultData<ChunkedType extends SubmissionChunkedType> = {
|
|
15
|
-
chunked: readonly [SubmissionData, ...SubmissionData[]];
|
|
16
|
-
monolithic: SubmissionData;
|
|
17
|
-
}[ChunkedType];
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Provides detail about an individual submission attachment {@link File}s which
|
|
21
|
-
* exceeds the client-specified {@link maxSize} for a
|
|
22
|
-
* {@link SubmissionResult<'chunked'> | chunked submission result}. Clients may
|
|
23
|
-
* use this value to provide guidance to users.
|
|
24
|
-
*
|
|
25
|
-
* @todo We may want to consider (a) making {@link maxSize} a configuration the
|
|
26
|
-
* client can provide when initializing a form instance, rather than only on
|
|
27
|
-
* submission; and then (b) treating a maximum size violation as another kind of
|
|
28
|
-
* node-level violation. This would go beyond the kinds of validation specified
|
|
29
|
-
* by ODK XForms, but it would make a lot of _conceptual sense_.
|
|
30
|
-
*
|
|
31
|
-
* It would almost certainly be helpful to alert users to violations as the
|
|
32
|
-
* occur, rather than only at submission time (where they have likely already
|
|
33
|
-
* moved on). This is something clients can do without engine support, but it
|
|
34
|
-
* would likely promote good usability patterns if the engine makes it an
|
|
35
|
-
* obvious and uniform option at the main engine/client entrypoint.
|
|
36
|
-
*
|
|
37
|
-
* @todo If we consider the above, we'd want to reframe _this interface_ to
|
|
38
|
-
* match the shape of other {@link AnyViolation | violations} (adding it as a
|
|
39
|
-
* member of that union). We'd also likely eliminate
|
|
40
|
-
* {@link MaxSizeExceededResult} in the process, since
|
|
41
|
-
* {@link PendingSubmissionResult} would then cover the case.
|
|
42
|
-
*/
|
|
43
|
-
interface MaxSizeViolation {
|
|
44
|
-
/**
|
|
45
|
-
* Specifies the index of
|
|
46
|
-
* {@link SubmissionResultData<'chunked'> | chunked submission data} where a
|
|
47
|
-
* submission attachment {@link File} exceeds the client-specified
|
|
48
|
-
* {@link maxSize}.
|
|
49
|
-
*/
|
|
50
|
-
readonly dataIndex: number;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Specifies the name of the file which exceeds the client-specified
|
|
54
|
-
* {@link maxSize}. This name can also be used as a key to access the
|
|
55
|
-
* violating {@link File}/submission attachment, in the {@link SubmissionData}
|
|
56
|
-
* at the specified {@link dataIndex}.
|
|
57
|
-
*/
|
|
58
|
-
readonly fileName: string;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Reflects the client-specified maximum size for each chunk of a
|
|
62
|
-
* {@link SubmissionResult<'chunked'> | chunked submission result}.
|
|
63
|
-
*/
|
|
64
|
-
readonly maxSize: number;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Details the actual size of the violating {@link File}/submission
|
|
68
|
-
* attachment. Along with {@link maxSize}. Clients may use the delta between
|
|
69
|
-
* this value and {@link maxSize} to provide detailed guidance to users.
|
|
70
|
-
*/
|
|
71
|
-
readonly actualSize: number;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// prettier-ignore
|
|
75
|
-
type SubmissionResultViolation =
|
|
76
|
-
| DescendantNodeViolationReference
|
|
77
|
-
| MaxSizeViolation;
|
|
78
|
-
|
|
79
|
-
interface BaseSubmissionResult<ChunkedType extends SubmissionChunkedType> {
|
|
80
|
-
readonly status: SubmissionResultStatus;
|
|
81
|
-
readonly definition: SubmissionDefinition;
|
|
82
|
-
get violations(): readonly SubmissionResultViolation[] | null;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Submission data may be chunked according to the
|
|
86
|
-
* {@link SubmissionOptions.maxSize | maxSize submission option}
|
|
87
|
-
*/
|
|
88
|
-
readonly data: SubmissionResultData<ChunkedType>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
interface PendingSubmissionResult<ChunkedType extends SubmissionChunkedType>
|
|
92
|
-
extends BaseSubmissionResult<ChunkedType> {
|
|
93
|
-
readonly status: 'pending';
|
|
94
|
-
get violations(): readonly DescendantNodeViolationReference[];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
interface MaxSizeExceededResult extends BaseSubmissionResult<'chunked'> {
|
|
98
|
-
readonly status: 'max-size-exceeded';
|
|
99
|
-
get violations(): readonly MaxSizeViolation[];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
interface ReadySubmissionResult<ChunkedType extends SubmissionChunkedType>
|
|
103
|
-
extends BaseSubmissionResult<ChunkedType> {
|
|
104
|
-
readonly status: 'ready';
|
|
105
|
-
get violations(): null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// prettier-ignore
|
|
109
|
-
type CommonSubmissionResult<ChunkedType extends SubmissionChunkedType> =
|
|
110
|
-
| PendingSubmissionResult<ChunkedType>
|
|
111
|
-
| ReadySubmissionResult<ChunkedType>;
|
|
112
|
-
|
|
113
|
-
// prettier-ignore
|
|
114
|
-
export type ChunkedSubmissionResult =
|
|
115
|
-
| CommonSubmissionResult<'chunked'>
|
|
116
|
-
| MaxSizeExceededResult;
|
|
117
|
-
|
|
118
|
-
export type MonolithicSubmissionResult = CommonSubmissionResult<'monolithic'>;
|
|
119
|
-
|
|
120
|
-
// prettier-ignore
|
|
121
|
-
export type SubmissionResult<ChunkedType extends SubmissionChunkedType> = {
|
|
122
|
-
chunked: ChunkedSubmissionResult;
|
|
123
|
-
monolithic: MonolithicSubmissionResult;
|
|
124
|
-
}[ChunkedType];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RootNode } from '../RootNode.ts';
|
|
2
|
-
|
|
3
|
-
export interface SubmissionState {
|
|
4
|
-
/**
|
|
5
|
-
* Represents the serialized XML state of a given node, as it will be prepared
|
|
6
|
-
* for submission. The value produced in {@link RootNode.submissionState} is
|
|
7
|
-
* the same serialization which will be produced for the complete submission.
|
|
8
|
-
*
|
|
9
|
-
* @todo Note that this particular aspect of the design doesn't yet address
|
|
10
|
-
* production of unique file names. As such, this may change as we introduce
|
|
11
|
-
* affected data types (and their supporting nodes).
|
|
12
|
-
*/
|
|
13
|
-
get submissionXML(): string;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RangeControlDefinition } from '../../parse/body/control/RangeControlDefinition.ts';
|
|
2
|
-
import type {
|
|
3
|
-
UnsupportedControlDefinition,
|
|
4
|
-
UnsupportedControlNode,
|
|
5
|
-
} from './UnsupportedControlNode.ts';
|
|
6
|
-
|
|
7
|
-
export interface RangeNodeDefinition extends UnsupportedControlDefinition {
|
|
8
|
-
readonly bodyElement: RangeControlDefinition;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface RangeNode extends UnsupportedControlNode {
|
|
12
|
-
readonly nodeType: 'range';
|
|
13
|
-
readonly definition: RangeNodeDefinition;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RankControlDefinition } from '../../parse/body/control/RankControlDefinition.ts';
|
|
2
|
-
import type {
|
|
3
|
-
UnsupportedControlDefinition,
|
|
4
|
-
UnsupportedControlNode,
|
|
5
|
-
} from './UnsupportedControlNode.ts';
|
|
6
|
-
|
|
7
|
-
export interface RankNodeDefinition extends UnsupportedControlDefinition {
|
|
8
|
-
readonly bodyElement: RankControlDefinition;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface RankNode extends UnsupportedControlNode {
|
|
12
|
-
readonly nodeType: 'rank';
|
|
13
|
-
readonly definition: RankNodeDefinition;
|
|
14
|
-
}
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { xmlXPathWhitespaceSeparatedList } from '@getodk/common/lib/string/whitespace.ts';
|
|
2
|
-
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
3
|
-
import type { Accessor } from 'solid-js';
|
|
4
|
-
import { createMemo, untrack } from 'solid-js';
|
|
5
|
-
import type { SelectItem, SelectNode, SelectNodeAppearances } from '../client/SelectNode.ts';
|
|
6
|
-
import type { TextRange } from '../client/TextRange.ts';
|
|
7
|
-
import type { SubmissionState } from '../client/submission/SubmissionState.ts';
|
|
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';
|
|
11
|
-
import { createSelectItems } from '../lib/reactivity/createSelectItems.ts';
|
|
12
|
-
import { createValueState } from '../lib/reactivity/createValueState.ts';
|
|
13
|
-
import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
|
|
14
|
-
import type { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
|
|
15
|
-
import type { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
16
|
-
import { createSharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
17
|
-
import { createFieldHint } from '../lib/reactivity/text/createFieldHint.ts';
|
|
18
|
-
import { createNodeLabel } from '../lib/reactivity/text/createNodeLabel.ts';
|
|
19
|
-
import type { SimpleAtomicState } from '../lib/reactivity/types.ts';
|
|
20
|
-
import type { SharedValidationState } from '../lib/reactivity/validation/createValidation.ts';
|
|
21
|
-
import { createValidationState } from '../lib/reactivity/validation/createValidation.ts';
|
|
22
|
-
import type { AnySelectDefinition } from '../parse/body/control/select/SelectDefinition.ts';
|
|
23
|
-
import type { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
24
|
-
import type { Root } from './Root.ts';
|
|
25
|
-
import type { DescendantNodeStateSpec } from './abstract/DescendantNode.ts';
|
|
26
|
-
import { DescendantNode } from './abstract/DescendantNode.ts';
|
|
27
|
-
import type { GeneralParentNode } from './hierarchy.ts';
|
|
28
|
-
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
29
|
-
import type { ValidationContext } from './internal-api/ValidationContext.ts';
|
|
30
|
-
import type { ValueContext } from './internal-api/ValueContext.ts';
|
|
31
|
-
import type { ClientReactiveSubmittableLeafNode } from './internal-api/submission/ClientReactiveSubmittableLeafNode.ts';
|
|
32
|
-
|
|
33
|
-
export interface SelectFieldDefinition extends LeafNodeDefinition {
|
|
34
|
-
readonly bodyElement: AnySelectDefinition;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface SelectFieldStateSpec extends DescendantNodeStateSpec<readonly SelectItem[]> {
|
|
38
|
-
readonly label: Accessor<TextRange<'label'> | null>;
|
|
39
|
-
readonly hint: Accessor<TextRange<'hint'> | null>;
|
|
40
|
-
readonly children: null;
|
|
41
|
-
readonly value: SimpleAtomicState<readonly SelectItem[]>;
|
|
42
|
-
readonly valueOptions: Accessor<readonly SelectItem[]>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class SelectField
|
|
46
|
-
extends DescendantNode<SelectFieldDefinition, SelectFieldStateSpec, GeneralParentNode, null>
|
|
47
|
-
implements
|
|
48
|
-
SelectNode,
|
|
49
|
-
XFormsXPathElement,
|
|
50
|
-
EvaluationContext,
|
|
51
|
-
ValidationContext,
|
|
52
|
-
ValueContext<readonly SelectItem[]>,
|
|
53
|
-
ClientReactiveSubmittableLeafNode<readonly SelectItem[]>
|
|
54
|
-
{
|
|
55
|
-
private readonly selectExclusive: boolean;
|
|
56
|
-
private readonly validation: SharedValidationState;
|
|
57
|
-
|
|
58
|
-
// XFormsXPathElement
|
|
59
|
-
override readonly [XPathNodeKindKey] = 'element';
|
|
60
|
-
|
|
61
|
-
// InstanceNode
|
|
62
|
-
protected readonly state: SharedNodeState<SelectFieldStateSpec>;
|
|
63
|
-
protected override engineState: EngineState<SelectFieldStateSpec>;
|
|
64
|
-
|
|
65
|
-
// SelectNode
|
|
66
|
-
readonly nodeType = 'select';
|
|
67
|
-
readonly appearances: SelectNodeAppearances;
|
|
68
|
-
readonly currentState: CurrentState<SelectFieldStateSpec>;
|
|
69
|
-
|
|
70
|
-
get validationState(): LeafNodeValidationState {
|
|
71
|
-
return this.validation.currentState;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
readonly submissionState: SubmissionState;
|
|
75
|
-
|
|
76
|
-
// ValueContext
|
|
77
|
-
override readonly contextNode = this;
|
|
78
|
-
|
|
79
|
-
readonly encodeValue = (runtimeValue: readonly SelectItem[]): string => {
|
|
80
|
-
const itemValues = new Set(runtimeValue.map(({ value }) => value));
|
|
81
|
-
const selectedItems = this.getValueOptions().filter(({ value }) => {
|
|
82
|
-
return itemValues.has(value);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
return selectedItems.map(({ value }) => value).join(' ');
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
readonly decodeValue = (instanceValue: string): readonly SelectItem[] => {
|
|
89
|
-
const itemValues = new Set(
|
|
90
|
-
xmlXPathWhitespaceSeparatedList(instanceValue, {
|
|
91
|
-
ignoreEmpty: true,
|
|
92
|
-
})
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
// TODO: also want set-like behavior, probably?
|
|
96
|
-
return this.getValueOptions().filter((option) => {
|
|
97
|
-
return itemValues.has(option.value);
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
protected readonly getValueOptions: Accessor<readonly SelectItem[]>;
|
|
102
|
-
protected readonly getValue: Accessor<readonly SelectItem[]>;
|
|
103
|
-
|
|
104
|
-
constructor(parent: GeneralParentNode, definition: SelectFieldDefinition) {
|
|
105
|
-
super(parent, definition);
|
|
106
|
-
|
|
107
|
-
this.appearances = definition.bodyElement.appearances;
|
|
108
|
-
this.selectExclusive = definition.bodyElement.type === 'select1';
|
|
109
|
-
|
|
110
|
-
const valueOptions = createSelectItems(this);
|
|
111
|
-
|
|
112
|
-
this.getValueOptions = valueOptions;
|
|
113
|
-
|
|
114
|
-
const [baseGetValue, setValue] = createValueState(this);
|
|
115
|
-
|
|
116
|
-
const getValue = this.scope.runTask(() => {
|
|
117
|
-
const selectItemsByValue = createMemo((): ReadonlyMap<string, SelectItem> => {
|
|
118
|
-
return new Map(valueOptions().map((item) => [item.value, item]));
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
return createMemo(() => {
|
|
122
|
-
const items = selectItemsByValue();
|
|
123
|
-
|
|
124
|
-
return baseGetValue().filter((item) => {
|
|
125
|
-
return items.has(item.value);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
this.getValue = getValue;
|
|
131
|
-
|
|
132
|
-
const valueState: SimpleAtomicState<readonly SelectItem[]> = [getValue, setValue];
|
|
133
|
-
|
|
134
|
-
const sharedStateOptions = {
|
|
135
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const state = createSharedNodeState(
|
|
139
|
-
this.scope,
|
|
140
|
-
{
|
|
141
|
-
reference: this.contextReference,
|
|
142
|
-
readonly: this.isReadonly,
|
|
143
|
-
relevant: this.isRelevant,
|
|
144
|
-
required: this.isRequired,
|
|
145
|
-
|
|
146
|
-
label: createNodeLabel(this, definition),
|
|
147
|
-
hint: createFieldHint(this, definition),
|
|
148
|
-
children: null,
|
|
149
|
-
value: valueState,
|
|
150
|
-
valueOptions,
|
|
151
|
-
},
|
|
152
|
-
sharedStateOptions
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
this.state = state;
|
|
156
|
-
this.engineState = state.engineState;
|
|
157
|
-
this.currentState = state.currentState;
|
|
158
|
-
this.validation = createValidationState(this, sharedStateOptions);
|
|
159
|
-
this.submissionState = createLeafNodeSubmissionState(this);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
protected getSelectItemsByValue(
|
|
163
|
-
valueOptions: readonly SelectItem[] = this.getValueOptions()
|
|
164
|
-
): ReadonlyMap<string, SelectItem> {
|
|
165
|
-
return new Map(
|
|
166
|
-
valueOptions.map((item) => {
|
|
167
|
-
return [item.value, item];
|
|
168
|
-
})
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
protected updateSelectedItemValues(values: readonly string[]) {
|
|
173
|
-
const itemsByValue = untrack(() => this.getSelectItemsByValue());
|
|
174
|
-
|
|
175
|
-
const items = values.flatMap((value) => {
|
|
176
|
-
const item = itemsByValue.get(value);
|
|
177
|
-
|
|
178
|
-
if (item == null) {
|
|
179
|
-
return [];
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return item ?? [];
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
this.state.setProperty('value', items);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
protected setSelectedItemValue(value: string | null) {
|
|
189
|
-
if (value == null) {
|
|
190
|
-
this.state.setProperty('value', []);
|
|
191
|
-
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
this.updateSelectedItemValues([value]);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// XFormsXPathElement
|
|
199
|
-
override getXPathValue(): string {
|
|
200
|
-
return this.encodeValue(this.engineState.value);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// SelectNode
|
|
204
|
-
select(selectedItem: SelectItem): Root {
|
|
205
|
-
const { engineState, root } = this;
|
|
206
|
-
|
|
207
|
-
if (this.selectExclusive) {
|
|
208
|
-
this.setSelectedItemValue(selectedItem.value);
|
|
209
|
-
|
|
210
|
-
return root;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const currentValues = engineState.value.map(({ value }) => {
|
|
214
|
-
return value;
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
const selectedValue = selectedItem.value;
|
|
218
|
-
|
|
219
|
-
if (currentValues.includes(selectedValue)) {
|
|
220
|
-
return root;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
this.updateSelectedItemValues(currentValues.concat(selectedValue));
|
|
224
|
-
|
|
225
|
-
return root;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
deselect(deselectedItem: SelectItem): Root {
|
|
229
|
-
const { engineState, root } = this;
|
|
230
|
-
|
|
231
|
-
const currentValues = engineState.value.map(({ value }) => {
|
|
232
|
-
return value;
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
const selectedValue = deselectedItem.value;
|
|
236
|
-
|
|
237
|
-
if (!currentValues.includes(selectedValue)) {
|
|
238
|
-
return root;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const updatedValues = currentValues.filter((value) => {
|
|
242
|
-
return value !== selectedValue;
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
this.updateSelectedItemValues(updatedValues);
|
|
246
|
-
|
|
247
|
-
return root;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// InstanceNode
|
|
251
|
-
getChildren(): readonly [] {
|
|
252
|
-
return [];
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// ValidationContext
|
|
256
|
-
getViolation(): AnyViolation | null {
|
|
257
|
-
return this.validation.engineState.violation;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
isBlank(): boolean {
|
|
261
|
-
return this.engineState.value.length === 0;
|
|
262
|
-
}
|
|
263
|
-
}
|