@getodk/xforms-engine 0.6.0 → 0.8.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 +4 -4
- package/dist/client/BaseValueNode.d.ts +7 -3
- package/dist/client/RootNode.d.ts +20 -16
- package/dist/client/UploadNode.d.ts +53 -0
- package/dist/client/attachments/InstanceAttachmentMeta.d.ts +8 -0
- package/dist/client/attachments/InstanceAttachmentsConfig.d.ts +8 -0
- 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 +19 -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 +4 -5
- package/dist/client/index.d.ts +40 -11
- package/dist/client/node-types.d.ts +2 -3
- 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 +14 -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 +24 -0
- package/dist/client/serialization/InstanceState.d.ts +12 -0
- package/dist/client/submission/{SubmissionDefinition.d.ts → SubmissionMeta.d.ts} +1 -1
- 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/TemplatedNodeAttributeSerializationError.d.ts +22 -0
- package/dist/error/UploadValueTypeError.d.ts +8 -0
- package/dist/index.d.ts +2 -33
- package/dist/index.js +8280 -6779
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +6 -5
- package/dist/instance/InputControl.d.ts +5 -4
- package/dist/instance/ModelValue.d.ts +5 -4
- package/dist/instance/Note.d.ts +4 -3
- package/dist/instance/PrimaryInstance.d.ts +34 -8
- package/dist/instance/RangeControl.d.ts +5 -4
- package/dist/instance/RankControl.d.ts +6 -5
- package/dist/instance/Root.d.ts +7 -9
- package/dist/instance/SelectControl.d.ts +4 -3
- package/dist/instance/Subtree.d.ts +6 -5
- package/dist/instance/TriggerControl.d.ts +4 -3
- package/dist/instance/UploadControl.d.ts +58 -0
- package/dist/instance/abstract/DescendantNode.d.ts +10 -1
- package/dist/instance/abstract/InstanceNode.d.ts +7 -4
- package/dist/instance/abstract/ValueNode.d.ts +7 -5
- package/dist/instance/attachments/InstanceAttachment.d.ts +42 -0
- package/dist/instance/attachments/InstanceAttachmentsState.d.ts +9 -0
- 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 +6 -7
- package/dist/instance/input/InitialInstanceState.d.ts +13 -0
- package/dist/instance/input/InstanceAttachmentMap.d.ts +19 -0
- package/dist/instance/internal-api/InstanceAttachmentContext.d.ts +19 -0
- package/dist/instance/internal-api/InstanceConfig.d.ts +4 -9
- package/dist/instance/internal-api/InstanceValueContext.d.ts +8 -1
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableInstance.d.ts +16 -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 +10 -8
- package/dist/instance/repeat/RepeatInstance.d.ts +10 -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/integration/xpath/EngineXPathEvaluator.d.ts +2 -2
- package/dist/integration/xpath/adapter/kind.d.ts +4 -10
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +4 -5
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +13 -10
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +21 -22
- 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/names/UnprefixedXFormsName.d.ts +4 -0
- package/dist/lib/reactivity/createInstanceAttachment.d.ts +8 -0
- package/dist/lib/reactivity/createInstanceValueState.d.ts +2 -27
- package/dist/lib/resource-helpers.d.ts +2 -0
- package/dist/parse/XFormDOM.d.ts +1 -1
- package/dist/parse/body/BodyDefinition.d.ts +2 -1
- package/dist/parse/body/control/UploadControlDefinition.d.ts +2 -0
- package/dist/parse/model/BindDefinition.d.ts +1 -1
- package/dist/parse/model/BindTypeDefinition.d.ts +2 -7
- package/dist/parse/model/ItextTranslationsDefinition.d.ts +18 -0
- package/dist/parse/model/LeafNodeDefinition.d.ts +4 -5
- package/dist/parse/model/ModelBindMap.d.ts +1 -1
- package/dist/parse/model/ModelDefinition.d.ts +9 -2
- package/dist/parse/model/NodeDefinition.d.ts +18 -30
- package/dist/parse/model/NoteNodeDefinition.d.ts +3 -2
- package/dist/parse/model/RangeNodeDefinition.d.ts +2 -1
- package/dist/parse/model/RepeatDefinition.d.ts +62 -0
- package/dist/parse/model/RootAttributeDefinition.d.ts +1 -4
- package/dist/parse/model/RootAttributeMap.d.ts +2 -1
- package/dist/parse/model/RootDefinition.d.ts +7 -8
- 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 +4 -5
- 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 -21
- package/dist/solid.js +8251 -6751
- package/dist/solid.js.map +1 -1
- package/package.json +15 -14
- package/src/client/BaseNode.ts +4 -4
- package/src/client/BaseValueNode.ts +7 -3
- package/src/client/RootNode.ts +32 -19
- package/src/client/UploadNode.ts +78 -0
- package/src/client/attachments/InstanceAttachmentMeta.ts +10 -0
- package/src/client/attachments/InstanceAttachmentsConfig.ts +13 -0
- 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 +21 -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 +5 -8
- package/src/client/index.ts +49 -29
- package/src/client/node-types.ts +3 -8
- 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 +24 -0
- package/src/client/serialization/InstanceFile.ts +9 -0
- package/src/client/serialization/InstancePayload.ts +126 -0
- package/src/client/serialization/InstancePayloadOptions.ts +29 -0
- package/src/client/serialization/InstanceState.ts +14 -0
- package/src/client/submission/{SubmissionDefinition.ts → SubmissionMeta.ts} +1 -1
- package/src/entrypoints/FormInstance.ts +56 -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/TemplatedNodeAttributeSerializationError.ts +24 -0
- package/src/error/UploadValueTypeError.ts +13 -0
- package/src/index.ts +2 -46
- package/src/instance/Group.ts +16 -15
- package/src/instance/InputControl.ts +17 -11
- package/src/instance/ModelValue.ts +17 -11
- package/src/instance/Note.ts +10 -9
- package/src/instance/PrimaryInstance.ts +68 -31
- package/src/instance/RangeControl.ts +17 -11
- package/src/instance/RankControl.ts +28 -19
- package/src/instance/Root.ts +20 -31
- package/src/instance/SelectControl.ts +21 -12
- package/src/instance/Subtree.ts +16 -15
- package/src/instance/TriggerControl.ts +21 -12
- package/src/instance/UploadControl.ts +184 -0
- package/src/instance/abstract/DescendantNode.ts +12 -2
- package/src/instance/abstract/InstanceNode.ts +9 -5
- package/src/instance/abstract/ValueNode.ts +11 -13
- package/src/instance/attachments/InstanceAttachment.ts +69 -0
- package/src/instance/attachments/InstanceAttachmentsState.ts +18 -0
- package/src/instance/children/DescendantNodeInitOptions.ts +35 -0
- package/src/instance/{children.ts → children/buildChildren.ts} +57 -53
- package/src/instance/children/childrenInitOptions.ts +117 -0
- package/src/instance/children/normalizeChildInitOptions.ts +332 -0
- package/src/instance/hierarchy.ts +6 -9
- package/src/instance/input/InitialInstanceState.ts +108 -0
- package/src/instance/input/InstanceAttachmentMap.ts +154 -0
- package/src/instance/internal-api/InstanceAttachmentContext.ts +20 -0
- package/src/instance/internal-api/InstanceConfig.ts +6 -10
- package/src/instance/internal-api/InstanceValueContext.ts +9 -1
- package/src/instance/internal-api/serialization/ClientReactiveSerializableInstance.ts +22 -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 +19 -24
- package/src/instance/repeat/RepeatInstance.ts +26 -19
- package/src/instance/repeat/RepeatRangeControlled.ts +90 -17
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +10 -9
- package/src/instance/resource.ts +14 -1
- package/src/integration/xpath/EngineXPathEvaluator.ts +2 -2
- package/src/integration/xpath/adapter/kind.ts +1 -28
- package/src/integration/xpath/adapter/traversal.ts +2 -2
- package/src/integration/xpath/static-dom/StaticAttribute.ts +6 -5
- package/src/integration/xpath/static-dom/StaticDocument.ts +17 -16
- package/src/integration/xpath/static-dom/StaticElement.ts +196 -50
- 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/{submission/createRootSubmissionState.ts → instance-state/createRootInstanceState.ts} +4 -4
- 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 +237 -0
- package/src/lib/names/UnprefixedXFormsName.ts +12 -0
- package/src/lib/reactivity/createInstanceAttachment.ts +212 -0
- package/src/lib/reactivity/createInstanceValueState.ts +27 -51
- package/src/lib/resource-helpers.ts +33 -0
- package/src/parse/XFormDOM.ts +1 -3
- package/src/parse/body/BodyDefinition.ts +4 -0
- package/src/parse/body/control/UploadControlDefinition.ts +42 -0
- package/src/parse/model/BindDefinition.ts +1 -1
- package/src/parse/model/BindTypeDefinition.ts +68 -26
- package/src/parse/model/ItextTranslationsDefinition.ts +79 -0
- package/src/parse/model/LeafNodeDefinition.ts +3 -5
- package/src/parse/model/ModelBindMap.ts +0 -5
- package/src/parse/model/ModelDefinition.ts +36 -3
- package/src/parse/model/NodeDefinition.ts +19 -45
- package/src/parse/model/NoteNodeDefinition.ts +4 -3
- package/src/parse/model/RangeNodeDefinition.ts +3 -2
- package/src/parse/model/RepeatDefinition.ts +382 -0
- package/src/parse/model/RootAttributeDefinition.ts +6 -7
- package/src/parse/model/RootAttributeMap.ts +15 -10
- package/src/parse/model/RootDefinition.ts +17 -19
- 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/ExternalSecondaryInstanceResource.ts +1 -30
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +64 -137
- 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 +4 -5
- package/src/parse/model/nodeDefinitionMap.ts +34 -0
- package/src/parse/shared/parseInstanceXML.ts +79 -0
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +45 -130
- 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/UnsupportedControlNode.d.ts +0 -30
- package/dist/client/unsupported/UploadNode.d.ts +0 -9
- package/dist/instance/abstract/UnsupportedControl.d.ts +0 -54
- 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 -32
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +0 -19
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +0 -18
- package/dist/instance/unsupported/UploadControl.d.ts +0 -6
- 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/createRootSubmissionState.d.ts +0 -3
- 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/createValueState.d.ts +0 -40
- package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +0 -4
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +0 -9
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +0 -8
- package/dist/parse/model/RepeatInstanceDefinition.d.ts +0 -17
- package/dist/parse/model/RepeatRangeDefinition.d.ts +0 -32
- package/dist/parse/model/RepeatTemplateDefinition.d.ts +0 -31
- 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/UnsupportedControlNode.ts +0 -36
- package/src/client/unsupported/UploadNode.ts +0 -14
- package/src/instance/abstract/UnsupportedControl.ts +0 -175
- 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 -43
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +0 -26
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +0 -24
- package/src/instance/unsupported/UploadControl.ts +0 -9
- 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/model/ItextTranslation/ItextTranslationDefinition.ts +0 -4
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +0 -42
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +0 -31
- package/src/parse/model/RepeatInstanceDefinition.ts +0 -38
- package/src/parse/model/RepeatRangeDefinition.ts +0 -98
- package/src/parse/model/RepeatTemplateDefinition.ts +0 -149
- package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +0 -4
- package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +0 -12
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import type { FormInstanceInitializationMode } from '../../client/index.ts';
|
|
2
|
+
import type { StaticLeafElement } from '../../integration/xpath/static-dom/StaticElement.ts';
|
|
1
3
|
import type { ReactiveScope } from '../../lib/reactivity/scope.ts';
|
|
2
4
|
import type { BindComputationExpression } from '../../parse/expression/BindComputationExpression.ts';
|
|
3
5
|
import type { AnyBindPreloadDefinition } from '../../parse/model/BindPreloadDefinition.ts';
|
|
4
6
|
import type { EvaluationContext } from './EvaluationContext.ts';
|
|
5
7
|
|
|
8
|
+
export interface InstanceValueContextDocument {
|
|
9
|
+
readonly initializationMode: FormInstanceInitializationMode;
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
export type DecodeInstanceValue = (value: string) => string;
|
|
7
13
|
|
|
8
14
|
interface InstanceValueContextDefinitionBind {
|
|
@@ -13,12 +19,14 @@ interface InstanceValueContextDefinitionBind {
|
|
|
13
19
|
|
|
14
20
|
export interface InstanceValueContextDefinition {
|
|
15
21
|
readonly bind: InstanceValueContextDefinitionBind;
|
|
16
|
-
readonly
|
|
22
|
+
readonly template: StaticLeafElement;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
export interface InstanceValueContext extends EvaluationContext {
|
|
20
26
|
readonly scope: ReactiveScope;
|
|
27
|
+
readonly rootDocument: InstanceValueContextDocument;
|
|
21
28
|
readonly definition: InstanceValueContextDefinition;
|
|
29
|
+
readonly instanceNode: StaticLeafElement | null;
|
|
22
30
|
readonly decodeInstanceValue: DecodeInstanceValue;
|
|
23
31
|
|
|
24
32
|
isReadonly(): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SubmissionMeta } from '../../../client/submission/SubmissionMeta.ts';
|
|
2
|
+
import type { AncestorNodeValidationState } from '../../../client/validation.ts';
|
|
3
|
+
import type { InstanceAttachmentsState } from '../../attachments/InstanceAttachmentsState.ts';
|
|
4
|
+
import type { Root } from '../../Root.ts';
|
|
5
|
+
import type {
|
|
6
|
+
ClientReactiveSerializableParentNode,
|
|
7
|
+
ClientReactiveSerializableParentNodeDefinition,
|
|
8
|
+
} from './ClientReactiveSerializableParentNode.ts';
|
|
9
|
+
|
|
10
|
+
interface ClientReactiveSerializableInstanceDefinition
|
|
11
|
+
extends ClientReactiveSerializableParentNodeDefinition {
|
|
12
|
+
readonly submission: SubmissionMeta;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ClientReactiveSerializableInstance
|
|
16
|
+
extends ClientReactiveSerializableParentNode<Root> {
|
|
17
|
+
readonly definition: ClientReactiveSerializableInstanceDefinition;
|
|
18
|
+
readonly root: Root;
|
|
19
|
+
readonly parent: null;
|
|
20
|
+
readonly attachments: InstanceAttachmentsState;
|
|
21
|
+
readonly validationState: AncestorNodeValidationState;
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { InstanceState } from '../../../client/serialization/InstanceState.ts';
|
|
2
|
+
import type { QualifiedName } from '../../../lib/names/QualifiedName.ts';
|
|
3
|
+
import type { EscapedXMLText } from '../../../lib/xml-serialization.ts';
|
|
4
|
+
import type {
|
|
5
|
+
ClientReactiveSerializableChildNode,
|
|
6
|
+
ClientReactiveSerializableParentNode,
|
|
7
|
+
} from './ClientReactiveSerializableParentNode.ts';
|
|
8
|
+
|
|
9
|
+
interface ClientReactiveSerializableLeafNodeCurrentState<RuntimeValue> {
|
|
10
|
+
get relevant(): boolean;
|
|
11
|
+
get value(): RuntimeValue;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type SerializedInstanceValue = string;
|
|
15
|
+
|
|
16
|
+
interface ClientReactiveSerializableLeafNodeDefinition {
|
|
17
|
+
readonly qualifiedName: QualifiedName;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ClientReactiveSerializableLeafNode<RuntimeValue> {
|
|
21
|
+
readonly definition: ClientReactiveSerializableLeafNodeDefinition;
|
|
22
|
+
readonly parent: ClientReactiveSerializableParentNode<ClientReactiveSerializableChildNode>;
|
|
23
|
+
readonly currentState: ClientReactiveSerializableLeafNodeCurrentState<RuntimeValue>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A client-reactive serializble leaf node is responsible for producing a
|
|
27
|
+
* string representation of its value state, suitable for instance
|
|
28
|
+
* serialization. It **MUST NOT** perform any further instance
|
|
29
|
+
* serialization-specific serialization duties: in particular, the value
|
|
30
|
+
* **MUST NOT** be escaped for XML. This responsibility is delegated up the
|
|
31
|
+
* stack, to avoid repeat escaping.
|
|
32
|
+
*
|
|
33
|
+
* Note: excluding {@link EscapedXMLText} here does not have an effect on the
|
|
34
|
+
* type system, it is a documentation-only hint, to help guard against future
|
|
35
|
+
* double-escaping mistakes.
|
|
36
|
+
*/
|
|
37
|
+
readonly encodeValue: (
|
|
38
|
+
this: unknown,
|
|
39
|
+
runtimeValue: RuntimeValue
|
|
40
|
+
) => Exclude<string, EscapedXMLText>;
|
|
41
|
+
|
|
42
|
+
readonly instanceState: InstanceState;
|
|
43
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { InstanceState } from '../../../client/serialization/InstanceState.ts';
|
|
2
|
+
import type { QualifiedName } from '../../../lib/names/QualifiedName.ts';
|
|
3
|
+
|
|
4
|
+
export interface ClientReactiveSerializableChildNode {
|
|
5
|
+
readonly instanceState: InstanceState;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ClientReactiveSerializableParentNodeCurrentState<
|
|
9
|
+
Child extends ClientReactiveSerializableChildNode,
|
|
10
|
+
> {
|
|
11
|
+
get relevant(): boolean;
|
|
12
|
+
get children(): readonly Child[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ClientReactiveSerializableParentNodeDefinition {
|
|
16
|
+
readonly qualifiedName: QualifiedName;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ClientReactiveSerializableParentNode<
|
|
20
|
+
Child extends ClientReactiveSerializableChildNode,
|
|
21
|
+
> {
|
|
22
|
+
readonly definition: ClientReactiveSerializableParentNodeDefinition;
|
|
23
|
+
readonly parent: ClientReactiveSerializableParentNode<ClientReactiveSerializableChildNode> | null;
|
|
24
|
+
readonly currentState: ClientReactiveSerializableParentNodeCurrentState<Child>;
|
|
25
|
+
readonly instanceState: InstanceState;
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TemplatedNodeAttributeSerializationError } from '../../../error/TemplatedNodeAttributeSerializationError.ts';
|
|
2
|
+
import type { StaticElement } from '../../../integration/xpath/static-dom/StaticElement.ts';
|
|
3
|
+
import type { GeneralChildNode } from '../../hierarchy.ts';
|
|
4
|
+
import type {
|
|
5
|
+
ClientReactiveSerializableParentNode,
|
|
6
|
+
ClientReactiveSerializableParentNodeCurrentState,
|
|
7
|
+
ClientReactiveSerializableParentNodeDefinition,
|
|
8
|
+
} from './ClientReactiveSerializableParentNode.ts';
|
|
9
|
+
|
|
10
|
+
export interface ClientReactiveSerializableTemplatedNodeCurrentState
|
|
11
|
+
extends ClientReactiveSerializableParentNodeCurrentState<GeneralChildNode> {
|
|
12
|
+
/** @see {@link TemplatedNodeAttributeSerializationError} */
|
|
13
|
+
get attributes(): unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ClientReactiveSerializableTemplatedNodeDefinition
|
|
17
|
+
extends ClientReactiveSerializableParentNodeDefinition {
|
|
18
|
+
readonly template: StaticElement;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ClientReactiveSerializableTemplatedNode
|
|
22
|
+
extends ClientReactiveSerializableParentNode<GeneralChildNode> {
|
|
23
|
+
readonly currentState: ClientReactiveSerializableTemplatedNodeCurrentState;
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InstanceState } from '../../../client/serialization/InstanceState.ts';
|
|
2
|
+
import type { QualifiedName } from '../../../lib/names/QualifiedName.ts';
|
|
3
|
+
import type {
|
|
4
|
+
ClientReactiveSerializableChildNode,
|
|
5
|
+
ClientReactiveSerializableParentNode,
|
|
6
|
+
} from './ClientReactiveSerializableParentNode.ts';
|
|
7
|
+
|
|
8
|
+
export type SerializedInstanceValue = string;
|
|
9
|
+
|
|
10
|
+
interface ClientReactiveSerializableValueNodeCurrentState {
|
|
11
|
+
get relevant(): boolean;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @todo Consider moving into {@link InstanceState}
|
|
15
|
+
*/
|
|
16
|
+
get instanceValue(): SerializedInstanceValue;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ClientReactiveSerializableValueNodeDefinition {
|
|
20
|
+
readonly qualifiedName: QualifiedName;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ClientReactiveSerializableValueNode {
|
|
24
|
+
readonly definition: ClientReactiveSerializableValueNodeDefinition;
|
|
25
|
+
readonly parent: ClientReactiveSerializableParentNode<ClientReactiveSerializableChildNode>;
|
|
26
|
+
readonly currentState: ClientReactiveSerializableValueNodeCurrentState;
|
|
27
|
+
readonly instanceState: InstanceState;
|
|
28
|
+
}
|
|
@@ -4,9 +4,10 @@ import type { Accessor } from 'solid-js';
|
|
|
4
4
|
import { untrack } from 'solid-js';
|
|
5
5
|
import type { RepeatRangeNode } from '../../client/hierarchy.ts';
|
|
6
6
|
import type { FormNodeID } from '../../client/identity.ts';
|
|
7
|
+
import type { AnyRepeatDefinition } from '../../client/index.ts';
|
|
7
8
|
import type { NodeAppearances } from '../../client/NodeAppearances.ts';
|
|
8
9
|
import type { BaseRepeatRangeNode } from '../../client/repeat/BaseRepeatRangeNode.ts';
|
|
9
|
-
import type {
|
|
10
|
+
import type { InstanceState } from '../../client/serialization/InstanceState.ts';
|
|
10
11
|
import type { TextRange } from '../../client/TextRange.ts';
|
|
11
12
|
import type { AncestorNodeValidationState } from '../../client/validation.ts';
|
|
12
13
|
import type {
|
|
@@ -14,7 +15,8 @@ import type {
|
|
|
14
15
|
XFormsXPathNodeRangeKind,
|
|
15
16
|
} from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
16
17
|
import { XFORMS_XPATH_NODE_RANGE_KIND } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
17
|
-
import {
|
|
18
|
+
import type { StaticElement } from '../../integration/xpath/static-dom/StaticElement.ts';
|
|
19
|
+
import { createNodeRangeInstanceState } from '../../lib/client-reactivity/instance-state/createNodeRangeInstanceState.ts';
|
|
18
20
|
import type { ChildrenState } from '../../lib/reactivity/createChildrenState.ts';
|
|
19
21
|
import { createChildrenState } from '../../lib/reactivity/createChildrenState.ts';
|
|
20
22
|
import type { MaterializedChildren } from '../../lib/reactivity/materializeCurrentStateChildren.ts';
|
|
@@ -24,10 +26,7 @@ import type { EngineState } from '../../lib/reactivity/node-state/createEngineSt
|
|
|
24
26
|
import type { SharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
25
27
|
import { createSharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
26
28
|
import { createNodeLabel } from '../../lib/reactivity/text/createNodeLabel.ts';
|
|
27
|
-
import type {
|
|
28
|
-
AnyRepeatRangeDefinition,
|
|
29
|
-
ControlledRepeatRangeDefinition,
|
|
30
|
-
} from '../../parse/model/RepeatRangeDefinition.ts';
|
|
29
|
+
import type { ControlledRepeatDefinition } from '../../parse/model/RepeatDefinition.ts';
|
|
31
30
|
import type {
|
|
32
31
|
AnyDescendantNode,
|
|
33
32
|
DescendantNodeSharedStateSpec,
|
|
@@ -35,8 +34,8 @@ import type {
|
|
|
35
34
|
import { DescendantNode } from '../abstract/DescendantNode.ts';
|
|
36
35
|
import type { GeneralParentNode, RepeatRange } from '../hierarchy.ts';
|
|
37
36
|
import type { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
38
|
-
import type {
|
|
39
|
-
import { RepeatInstance
|
|
37
|
+
import type { ClientReactiveSerializableParentNode } from '../internal-api/serialization/ClientReactiveSerializableParentNode.ts';
|
|
38
|
+
import { RepeatInstance } from './RepeatInstance.ts';
|
|
40
39
|
|
|
41
40
|
interface RepeatRangeStateSpec extends DescendantNodeSharedStateSpec {
|
|
42
41
|
readonly hint: null;
|
|
@@ -47,18 +46,18 @@ interface RepeatRangeStateSpec extends DescendantNodeSharedStateSpec {
|
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
// prettier-ignore
|
|
50
|
-
type BaseRepeatRangeNodeType<Definition extends
|
|
51
|
-
Definition extends
|
|
49
|
+
type BaseRepeatRangeNodeType<Definition extends AnyRepeatDefinition> =
|
|
50
|
+
Definition extends ControlledRepeatDefinition
|
|
52
51
|
? 'repeat-range:controlled'
|
|
53
52
|
: 'repeat-range:uncontrolled';
|
|
54
53
|
|
|
55
|
-
export abstract class BaseRepeatRange<Definition extends
|
|
54
|
+
export abstract class BaseRepeatRange<Definition extends AnyRepeatDefinition>
|
|
56
55
|
extends DescendantNode<Definition, RepeatRangeStateSpec, GeneralParentNode, RepeatInstance>
|
|
57
56
|
implements
|
|
58
57
|
BaseRepeatRangeNode,
|
|
59
58
|
XFormsXPathNodeRange,
|
|
60
59
|
EvaluationContext,
|
|
61
|
-
|
|
60
|
+
ClientReactiveSerializableParentNode<RepeatInstance>
|
|
62
61
|
{
|
|
63
62
|
protected readonly childrenState: ChildrenState<RepeatInstance>;
|
|
64
63
|
|
|
@@ -149,10 +148,10 @@ export abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinitio
|
|
|
149
148
|
|
|
150
149
|
abstract override readonly validationState: AncestorNodeValidationState;
|
|
151
150
|
|
|
152
|
-
readonly
|
|
151
|
+
readonly instanceState: InstanceState;
|
|
153
152
|
|
|
154
153
|
constructor(parent: GeneralParentNode, definition: Definition) {
|
|
155
|
-
super(parent, definition);
|
|
154
|
+
super(parent, definition.template, definition);
|
|
156
155
|
|
|
157
156
|
const repeatRange = this as AnyDescendantNode as RepeatRange;
|
|
158
157
|
|
|
@@ -160,10 +159,6 @@ export abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinitio
|
|
|
160
159
|
|
|
161
160
|
this.childrenState = childrenState;
|
|
162
161
|
|
|
163
|
-
const sharedStateOptions = {
|
|
164
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
165
|
-
};
|
|
166
|
-
|
|
167
162
|
const state = createSharedNodeState(
|
|
168
163
|
this.scope,
|
|
169
164
|
{
|
|
@@ -178,7 +173,7 @@ export abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinitio
|
|
|
178
173
|
valueOptions: null,
|
|
179
174
|
value: null,
|
|
180
175
|
},
|
|
181
|
-
|
|
176
|
+
this.instanceConfig
|
|
182
177
|
);
|
|
183
178
|
|
|
184
179
|
this.state = state;
|
|
@@ -188,7 +183,7 @@ export abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinitio
|
|
|
188
183
|
state.currentState,
|
|
189
184
|
childrenState
|
|
190
185
|
);
|
|
191
|
-
this.
|
|
186
|
+
this.instanceState = createNodeRangeInstanceState(this);
|
|
192
187
|
}
|
|
193
188
|
|
|
194
189
|
protected getLastIndex(): number {
|
|
@@ -201,7 +196,7 @@ export abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinitio
|
|
|
201
196
|
|
|
202
197
|
private createChildren(
|
|
203
198
|
afterIndex: number,
|
|
204
|
-
|
|
199
|
+
instanceNodes: readonly StaticElement[]
|
|
205
200
|
): readonly RepeatInstance[] {
|
|
206
201
|
return this.scope.runTask(() => {
|
|
207
202
|
let initialPrecedingInstance: RepeatInstance | null;
|
|
@@ -220,7 +215,7 @@ export abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinitio
|
|
|
220
215
|
|
|
221
216
|
const repeatRange = this as AnyDescendantNode as RepeatRange;
|
|
222
217
|
|
|
223
|
-
return
|
|
218
|
+
return instanceNodes.reduce<RepeatInstance[]>((acc, definition) => {
|
|
224
219
|
const precedingInstance = acc[acc.length - 1] ?? initialPrecedingInstance;
|
|
225
220
|
const newInstance = new RepeatInstance(repeatRange, definition, {
|
|
226
221
|
precedingInstance,
|
|
@@ -235,11 +230,11 @@ export abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinitio
|
|
|
235
230
|
|
|
236
231
|
protected addChildren(
|
|
237
232
|
afterIndex: number,
|
|
238
|
-
|
|
233
|
+
instanceNodes: readonly StaticElement[]
|
|
239
234
|
): readonly RepeatInstance[] {
|
|
240
235
|
return this.scope.runTask(() => {
|
|
241
236
|
const initialIndex = afterIndex + 1;
|
|
242
|
-
const newInstances = this.createChildren(afterIndex,
|
|
237
|
+
const newInstances = this.createChildren(afterIndex, instanceNodes);
|
|
243
238
|
|
|
244
239
|
return this.childrenState.setChildren((currentInstances) => {
|
|
245
240
|
return insertAtIndex(currentInstances, initialIndex, newInstances);
|
|
@@ -3,15 +3,17 @@ import type { Accessor } from 'solid-js';
|
|
|
3
3
|
import { createComputed, createSignal, on } from 'solid-js';
|
|
4
4
|
import type { FormNodeID } from '../../client/identity.ts';
|
|
5
5
|
import type {
|
|
6
|
-
|
|
6
|
+
AnyRepeatDefinition,
|
|
7
7
|
RepeatInstanceNode,
|
|
8
8
|
RepeatInstanceNodeAppearances,
|
|
9
9
|
} from '../../client/repeat/RepeatInstanceNode.ts';
|
|
10
|
-
import type {
|
|
10
|
+
import type { InstanceState } from '../../client/serialization/InstanceState.ts';
|
|
11
11
|
import type { TextRange } from '../../client/TextRange.ts';
|
|
12
12
|
import type { AncestorNodeValidationState } from '../../client/validation.ts';
|
|
13
|
+
import type { TemplatedNodeAttributeSerializationError } from '../../error/TemplatedNodeAttributeSerializationError.ts';
|
|
13
14
|
import type { XFormsXPathElement } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
14
|
-
import {
|
|
15
|
+
import type { StaticElement } from '../../integration/xpath/static-dom/StaticElement.ts';
|
|
16
|
+
import { createTemplatedNodeInstanceState } from '../../lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.ts';
|
|
15
17
|
import type { ChildrenState } from '../../lib/reactivity/createChildrenState.ts';
|
|
16
18
|
import { createChildrenState } from '../../lib/reactivity/createChildrenState.ts';
|
|
17
19
|
import type { MaterializedChildren } from '../../lib/reactivity/materializeCurrentStateChildren.ts';
|
|
@@ -24,16 +26,18 @@ import { createNodeLabel } from '../../lib/reactivity/text/createNodeLabel.ts';
|
|
|
24
26
|
import { createAggregatedViolations } from '../../lib/reactivity/validation/createAggregatedViolations.ts';
|
|
25
27
|
import type { DescendantNodeSharedStateSpec } from '../abstract/DescendantNode.ts';
|
|
26
28
|
import { DescendantNode } from '../abstract/DescendantNode.ts';
|
|
27
|
-
import { buildChildren } from '../children.ts';
|
|
29
|
+
import { buildChildren } from '../children/buildChildren.ts';
|
|
28
30
|
import type { GeneralChildNode, RepeatRange } from '../hierarchy.ts';
|
|
29
31
|
import type { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
30
|
-
import type {
|
|
31
|
-
|
|
32
|
-
export type { RepeatDefinition };
|
|
32
|
+
import type { ClientReactiveSerializableTemplatedNode } from '../internal-api/serialization/ClientReactiveSerializableTemplatedNode.ts';
|
|
33
33
|
|
|
34
34
|
interface RepeatInstanceStateSpec extends DescendantNodeSharedStateSpec {
|
|
35
35
|
readonly label: Accessor<TextRange<'label'> | null>;
|
|
36
36
|
readonly hint: null;
|
|
37
|
+
|
|
38
|
+
/** @see {@link TemplatedNodeAttributeSerializationError} */
|
|
39
|
+
readonly attributes: null;
|
|
40
|
+
|
|
37
41
|
readonly children: Accessor<readonly FormNodeID[]>;
|
|
38
42
|
readonly valueOptions: null;
|
|
39
43
|
readonly value: null;
|
|
@@ -44,12 +48,17 @@ interface RepeatInstanceOptions {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
export class RepeatInstance
|
|
47
|
-
extends DescendantNode<
|
|
51
|
+
extends DescendantNode<
|
|
52
|
+
AnyRepeatDefinition,
|
|
53
|
+
RepeatInstanceStateSpec,
|
|
54
|
+
RepeatRange,
|
|
55
|
+
GeneralChildNode
|
|
56
|
+
>
|
|
48
57
|
implements
|
|
49
58
|
RepeatInstanceNode,
|
|
50
59
|
XFormsXPathElement,
|
|
51
60
|
EvaluationContext,
|
|
52
|
-
|
|
61
|
+
ClientReactiveSerializableTemplatedNode
|
|
53
62
|
{
|
|
54
63
|
private readonly childrenState: ChildrenState<GeneralChildNode>;
|
|
55
64
|
private readonly currentIndex: Accessor<number>;
|
|
@@ -99,19 +108,20 @@ export class RepeatInstance
|
|
|
99
108
|
GeneralChildNode
|
|
100
109
|
>;
|
|
101
110
|
readonly validationState: AncestorNodeValidationState;
|
|
102
|
-
readonly
|
|
111
|
+
readonly instanceState: InstanceState;
|
|
103
112
|
|
|
104
113
|
constructor(
|
|
105
114
|
override readonly parent: RepeatRange,
|
|
106
|
-
|
|
115
|
+
instanceNode: StaticElement | null,
|
|
107
116
|
options: RepeatInstanceOptions
|
|
108
117
|
) {
|
|
118
|
+
const { definition } = parent;
|
|
109
119
|
const { precedingInstance } = options;
|
|
110
120
|
const precedingIndex = precedingInstance?.currentIndex ?? (() => -1);
|
|
111
121
|
const initialIndex = precedingIndex() + 1;
|
|
112
122
|
const [currentIndex, setCurrentIndex] = createSignal(initialIndex);
|
|
113
123
|
|
|
114
|
-
super(parent, definition, {
|
|
124
|
+
super(parent, instanceNode, definition, {
|
|
115
125
|
computeReference: (): string => {
|
|
116
126
|
const currentPosition = currentIndex() + 1;
|
|
117
127
|
|
|
@@ -126,10 +136,6 @@ export class RepeatInstance
|
|
|
126
136
|
this.childrenState = childrenState;
|
|
127
137
|
this.currentIndex = currentIndex;
|
|
128
138
|
|
|
129
|
-
const sharedStateOptions = {
|
|
130
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
131
|
-
};
|
|
132
|
-
|
|
133
139
|
const state = createSharedNodeState(
|
|
134
140
|
this.scope,
|
|
135
141
|
{
|
|
@@ -141,11 +147,12 @@ export class RepeatInstance
|
|
|
141
147
|
// TODO: only-child <group><label>
|
|
142
148
|
label: createNodeLabel(this, definition),
|
|
143
149
|
hint: null,
|
|
150
|
+
attributes: null,
|
|
144
151
|
children: childrenState.childIds,
|
|
145
152
|
valueOptions: null,
|
|
146
153
|
value: null,
|
|
147
154
|
},
|
|
148
|
-
|
|
155
|
+
this.instanceConfig
|
|
149
156
|
);
|
|
150
157
|
|
|
151
158
|
this.state = state;
|
|
@@ -178,8 +185,8 @@ export class RepeatInstance
|
|
|
178
185
|
});
|
|
179
186
|
|
|
180
187
|
childrenState.setChildren(buildChildren(this));
|
|
181
|
-
this.validationState = createAggregatedViolations(this,
|
|
182
|
-
this.
|
|
188
|
+
this.validationState = createAggregatedViolations(this, this.instanceConfig);
|
|
189
|
+
this.instanceState = createTemplatedNodeInstanceState(this);
|
|
183
190
|
}
|
|
184
191
|
|
|
185
192
|
getChildren(): readonly GeneralChildNode[] {
|
|
@@ -1,45 +1,69 @@
|
|
|
1
1
|
import { createComputed } from 'solid-js';
|
|
2
|
+
import type { LoadFormWarnings } from '../../client/form/LoadFormResult.ts';
|
|
2
3
|
import type { RepeatRangeNodeAppearances } from '../../client/repeat/BaseRepeatRangeNode.ts';
|
|
3
4
|
import type { RepeatRangeControlledNode } from '../../client/repeat/RepeatRangeControlledNode.ts';
|
|
4
5
|
import type { AncestorNodeValidationState } from '../../client/validation.ts';
|
|
5
6
|
import type { XFormsXPathNodeRange } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
7
|
+
import type { StaticElement } from '../../integration/xpath/static-dom/StaticElement.ts';
|
|
6
8
|
import { createComputedExpression } from '../../lib/reactivity/createComputedExpression.ts';
|
|
7
9
|
import { createAggregatedViolations } from '../../lib/reactivity/validation/createAggregatedViolations.ts';
|
|
8
|
-
import type {
|
|
10
|
+
import type { ControlledRepeatDefinition } from '../../parse/model/RepeatDefinition.ts';
|
|
9
11
|
import type { GeneralParentNode } from '../hierarchy.ts';
|
|
10
12
|
import type { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
11
13
|
import { BaseRepeatRange } from './BaseRepeatRange.ts';
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
// prettier-ignore
|
|
16
|
+
type RepeatCountControlType =
|
|
17
|
+
| 'REPEAT_COUNT_CONTROL_DYNAMIC'
|
|
18
|
+
| 'REPEAT_COUNT_CONTROL_FIXED';
|
|
13
19
|
|
|
14
20
|
export class RepeatRangeControlled
|
|
15
|
-
extends BaseRepeatRange<
|
|
21
|
+
extends BaseRepeatRange<ControlledRepeatDefinition>
|
|
16
22
|
implements RepeatRangeControlledNode, XFormsXPathNodeRange, EvaluationContext
|
|
17
23
|
{
|
|
24
|
+
private readonly isInstanceCreation: boolean;
|
|
25
|
+
private readonly countControlType: RepeatCountControlType;
|
|
26
|
+
|
|
18
27
|
// RepeatRangeControlledNode
|
|
19
28
|
readonly nodeType = 'repeat-range:controlled';
|
|
20
29
|
readonly appearances: RepeatRangeNodeAppearances;
|
|
21
30
|
readonly validationState: AncestorNodeValidationState;
|
|
22
31
|
|
|
23
|
-
constructor(
|
|
32
|
+
constructor(
|
|
33
|
+
parent: GeneralParentNode,
|
|
34
|
+
instanceNodes: readonly StaticElement[],
|
|
35
|
+
definition: ControlledRepeatDefinition
|
|
36
|
+
) {
|
|
24
37
|
super(parent, definition);
|
|
25
38
|
|
|
39
|
+
this.isInstanceCreation = parent.rootDocument.initializationMode === 'create';
|
|
26
40
|
this.appearances = definition.bodyElement.appearances;
|
|
27
41
|
|
|
28
|
-
|
|
42
|
+
if (definition.count.isConstantExpression()) {
|
|
43
|
+
this.countControlType = 'REPEAT_COUNT_CONTROL_FIXED';
|
|
44
|
+
} else {
|
|
45
|
+
this.countControlType = 'REPEAT_COUNT_CONTROL_DYNAMIC';
|
|
46
|
+
}
|
|
29
47
|
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
this.initializeControlledChildrenState(definition, instanceNodes);
|
|
49
|
+
|
|
50
|
+
this.validationState = createAggregatedViolations(this, this.instanceConfig);
|
|
33
51
|
}
|
|
34
52
|
|
|
35
|
-
private initializeControlledChildrenState(
|
|
53
|
+
private initializeControlledChildrenState(
|
|
54
|
+
definition: ControlledRepeatDefinition,
|
|
55
|
+
instanceNodes: readonly StaticElement[]
|
|
56
|
+
): void {
|
|
36
57
|
this.scope.runTask(() => {
|
|
37
|
-
const { count,
|
|
58
|
+
const { count, template } = definition;
|
|
59
|
+
const repeatInstanceNodes = definition.omitTemplate(instanceNodes);
|
|
38
60
|
const computeCount = createComputedExpression(this, count, {
|
|
39
61
|
defaultValue: 0,
|
|
40
62
|
});
|
|
41
63
|
|
|
42
|
-
createComputed
|
|
64
|
+
createComputed((previousCountComputation: number | null = null): number => {
|
|
65
|
+
const previousCount = previousCountComputation ?? 0;
|
|
66
|
+
|
|
43
67
|
let currentCount = computeCount();
|
|
44
68
|
|
|
45
69
|
if (Number.isFinite(currentCount) && currentCount < 0) {
|
|
@@ -58,17 +82,19 @@ export class RepeatRangeControlled
|
|
|
58
82
|
return previousCount;
|
|
59
83
|
}
|
|
60
84
|
|
|
85
|
+
this.warnDroppedInstanceNodes(repeatInstanceNodes, previousCountComputation, currentCount);
|
|
86
|
+
|
|
61
87
|
if (currentCount > previousCount) {
|
|
62
88
|
const delta = currentCount - previousCount;
|
|
63
|
-
const
|
|
64
|
-
.fill(
|
|
65
|
-
.map((
|
|
89
|
+
const inputNodes = Array(delta)
|
|
90
|
+
.fill(null)
|
|
91
|
+
.map((_, index) => {
|
|
66
92
|
const instanceIndex = previousCount + index;
|
|
67
93
|
|
|
68
|
-
return
|
|
94
|
+
return repeatInstanceNodes[instanceIndex] ?? template;
|
|
69
95
|
});
|
|
70
96
|
|
|
71
|
-
this.addChildren(previousCount - 1,
|
|
97
|
+
this.addChildren(previousCount - 1, inputNodes);
|
|
72
98
|
} else {
|
|
73
99
|
const delta = previousCount - currentCount;
|
|
74
100
|
|
|
@@ -76,7 +102,54 @@ export class RepeatRangeControlled
|
|
|
76
102
|
}
|
|
77
103
|
|
|
78
104
|
return currentCount;
|
|
79
|
-
}
|
|
105
|
+
});
|
|
80
106
|
});
|
|
81
107
|
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Note: we do not warn about dropping "excess" repeat instances...
|
|
111
|
+
*
|
|
112
|
+
* - ... after the instance is fully loaded: dropping repeat instances after
|
|
113
|
+
* that point is an expected behavior of _dynamically-controlled repeats_
|
|
114
|
+
* (i.e. those defined with `jr:count`), and it does not occur for
|
|
115
|
+
* _fixed-controlled repeats_ (i.e. defined with `jr:noAddRemove`);
|
|
116
|
+
*
|
|
117
|
+
* - ... for dynamic (`jr:count`) repeats _in newly created form instances_, i.e. instances whose input instance
|
|
118
|
+
* nodes are derived from the _form definition_: those form-defined repeat
|
|
119
|
+
* instances are not "dropped", instead they're retained in memory to be
|
|
120
|
+
* added as count is recomputed to a larger value.
|
|
121
|
+
*
|
|
122
|
+
* @todo ^ it is pretty likely that retain-in-memory behavior also applies to
|
|
123
|
+
* instance state which has been serialized and restored as well! In this way,
|
|
124
|
+
* it's possible we're not really "dropping" those nodes, only deferring their
|
|
125
|
+
* restoration. Is this what we want?
|
|
126
|
+
*
|
|
127
|
+
* @todo Design and produce {@link LoadFormWarnings | warnings} as values!
|
|
128
|
+
*/
|
|
129
|
+
private warnDroppedInstanceNodes(
|
|
130
|
+
repeatInstanceNodes: readonly StaticElement[],
|
|
131
|
+
previousCountComputation: number | null,
|
|
132
|
+
initialCount: number
|
|
133
|
+
): void {
|
|
134
|
+
// See this method's JSDoc notes for reasoning!
|
|
135
|
+
if (this.isInstanceCreation) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// See this method's JSDoc notes for reasoning!
|
|
140
|
+
const isInstanceLoad = previousCountComputation == null;
|
|
141
|
+
|
|
142
|
+
if (isInstanceLoad && this.countControlType === 'REPEAT_COUNT_CONTROL_DYNAMIC') {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const droppedCount = repeatInstanceNodes.length - initialCount;
|
|
147
|
+
|
|
148
|
+
if (droppedCount > 0) {
|
|
149
|
+
// eslint-disable-next-line no-console
|
|
150
|
+
console.warn(
|
|
151
|
+
`Dropped ${droppedCount} repeat instances for repeat range ${this.contextReference()}`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
82
155
|
}
|
|
@@ -2,8 +2,9 @@ import type { RepeatRangeNodeAppearances } from '../../client/repeat/BaseRepeatR
|
|
|
2
2
|
import type { RepeatRangeUncontrolledNode } from '../../client/repeat/RepeatRangeUncontrolledNode.ts';
|
|
3
3
|
import type { AncestorNodeValidationState } from '../../client/validation.ts';
|
|
4
4
|
import type { XFormsXPathNodeRange } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
5
|
+
import type { StaticElement } from '../../integration/xpath/static-dom/StaticElement.ts';
|
|
5
6
|
import { createAggregatedViolations } from '../../lib/reactivity/validation/createAggregatedViolations.ts';
|
|
6
|
-
import type {
|
|
7
|
+
import type { UncontrolledRepeatDefinition } from '../../parse/model/RepeatDefinition.ts';
|
|
7
8
|
import type { GeneralParentNode } from '../hierarchy.ts';
|
|
8
9
|
import type { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
9
10
|
import type { Root } from '../Root.ts';
|
|
@@ -11,7 +12,7 @@ import { BaseRepeatRange } from './BaseRepeatRange.ts';
|
|
|
11
12
|
import { RepeatInstance } from './RepeatInstance.ts';
|
|
12
13
|
|
|
13
14
|
export class RepeatRangeUncontrolled
|
|
14
|
-
extends BaseRepeatRange<
|
|
15
|
+
extends BaseRepeatRange<UncontrolledRepeatDefinition>
|
|
15
16
|
implements RepeatRangeUncontrolledNode, XFormsXPathNodeRange, EvaluationContext
|
|
16
17
|
{
|
|
17
18
|
// RepeatRangeUncontrolledNode
|
|
@@ -19,16 +20,16 @@ export class RepeatRangeUncontrolled
|
|
|
19
20
|
readonly appearances: RepeatRangeNodeAppearances;
|
|
20
21
|
readonly validationState: AncestorNodeValidationState;
|
|
21
22
|
|
|
22
|
-
constructor(
|
|
23
|
+
constructor(
|
|
24
|
+
parent: GeneralParentNode,
|
|
25
|
+
instanceNodes: readonly StaticElement[],
|
|
26
|
+
definition: UncontrolledRepeatDefinition
|
|
27
|
+
) {
|
|
23
28
|
super(parent, definition);
|
|
24
29
|
|
|
25
30
|
this.appearances = definition.bodyElement.appearances;
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
this.validationState = createAggregatedViolations(this, {
|
|
30
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
31
|
-
});
|
|
31
|
+
this.addChildren(-1, definition.omitTemplate(instanceNodes));
|
|
32
|
+
this.validationState = createAggregatedViolations(this, this.instanceConfig);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
// RepeatRangeUncontrolledNode
|