@getodk/xforms-engine 0.16.1 → 0.17.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/InputNode.d.ts +8 -4
- package/dist/client/MarkdownNode.d.ts +3 -0
- package/dist/client/NoteNode.d.ts +6 -2
- package/dist/client/form/FormInstanceConfig.d.ts +4 -0
- package/dist/client/form/LoadFormResult.d.ts +5 -14
- package/dist/client/form/ResetFormInstance.d.ts +13 -0
- package/dist/entrypoints/FormResult/BaseFormResult.d.ts +1 -0
- package/dist/entrypoints/FormResult/BaseInstantiableFormResult.d.ts +2 -0
- package/dist/entrypoints/FormResult/FormFailureResult.d.ts +2 -0
- package/dist/entrypoints/createPotentiallyClientOwnedReactiveScope.d.ts +19 -0
- package/dist/index.js +21681 -25500
- package/dist/index.js.map +1 -1
- package/dist/instance/PrimaryInstance.d.ts +4 -1
- package/dist/instance/internal-api/AttributeContext.d.ts +1 -0
- package/dist/instance/internal-api/InstanceConfig.d.ts +2 -1
- package/dist/instance/internal-api/InstanceValueContext.d.ts +1 -0
- package/dist/instance/markdown/MarkdownNode.d.ts +14 -9
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +2 -0
- package/dist/lib/codecs/{Geopoint/Geopoint.d.ts → geolocation/Geolocation.d.ts} +11 -15
- package/dist/lib/codecs/geolocation/Geopoint.d.ts +7 -0
- package/dist/lib/codecs/geolocation/Geoshape.d.ts +7 -0
- package/dist/lib/codecs/geolocation/Geotrace.d.ts +7 -0
- package/dist/lib/codecs/geolocation/createGeolocationValueCodec.d.ts +3 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +7 -5
- package/dist/lib/reactivity/text/createTextRange.d.ts +0 -2
- package/dist/parse/XFormDOM.d.ts +7 -1
- package/dist/parse/body/appearance/inputAppearanceParser.d.ts +1 -1
- package/dist/parse/model/ActionDefinition.d.ts +1 -1
- package/dist/parse/model/BindPreloadDefinition.d.ts +2 -1
- package/dist/parse/model/ModelActionMap.d.ts +3 -2
- package/dist/parse/model/ModelDefinition.d.ts +3 -5
- package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +0 -17
- package/dist/parse/model/SecondaryInstance/sources/external-instance-csv-parser.d.ts +8 -0
- package/dist/parse/model/TranslationDefinitionMap.d.ts +4 -0
- package/dist/solid.js +21407 -25226
- package/dist/solid.js.map +1 -1
- package/package.json +2 -2
- package/src/client/InputNode.ts +11 -3
- package/src/client/MarkdownNode.ts +3 -0
- package/src/client/NoteNode.ts +9 -1
- package/src/client/form/FormInstanceConfig.ts +6 -0
- package/src/client/form/LoadFormResult.ts +5 -17
- package/src/client/form/ResetFormInstance.ts +17 -0
- package/src/entrypoints/FormInstance.ts +2 -0
- package/src/entrypoints/FormResult/BaseFormResult.ts +1 -0
- package/src/entrypoints/FormResult/BaseInstantiableFormResult.ts +10 -1
- package/src/entrypoints/FormResult/FormFailureResult.ts +3 -0
- package/src/entrypoints/createPotentiallyClientOwnedReactiveScope.ts +30 -0
- package/src/entrypoints/loadForm.ts +1 -31
- package/src/instance/InputControl.ts +3 -5
- package/src/instance/PrimaryInstance.ts +17 -2
- package/src/instance/attachments/buildAttributes.ts +21 -1
- package/src/instance/internal-api/AttributeContext.ts +1 -0
- package/src/instance/internal-api/InstanceConfig.ts +3 -0
- package/src/instance/internal-api/InstanceValueContext.ts +1 -0
- package/src/instance/markdown/MarkdownNode.ts +19 -7
- package/src/instance/text/markdownFormat.ts +4 -3
- package/src/integration/xpath/static-dom/StaticDocument.ts +2 -0
- package/src/lib/codecs/{Geopoint/Geopoint.ts → geolocation/Geolocation.ts} +43 -24
- package/src/lib/codecs/geolocation/Geopoint.ts +15 -0
- package/src/lib/codecs/geolocation/Geoshape.ts +36 -0
- package/src/lib/codecs/geolocation/Geotrace.ts +36 -0
- package/src/lib/codecs/geolocation/createGeolocationValueCodec.ts +18 -0
- package/src/lib/codecs/getSharedValueCodec.ts +37 -11
- package/src/lib/reactivity/createInstanceValueState.ts +64 -34
- package/src/lib/reactivity/text/createTextRange.ts +71 -45
- package/src/parse/XFormDOM.ts +22 -2
- package/src/parse/model/ActionDefinition.ts +6 -6
- package/src/parse/model/BindDefinition.ts +1 -1
- package/src/parse/model/BindPreloadDefinition.ts +21 -14
- package/src/parse/model/ModelActionMap.ts +30 -13
- package/src/parse/model/ModelDefinition.ts +5 -10
- package/src/parse/model/RootDefinition.ts +2 -1
- package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +2 -184
- package/src/parse/model/SecondaryInstance/sources/external-instance-csv-parser.ts +185 -0
- package/src/parse/model/TranslationDefinitionMap.ts +23 -0
- package/dist/lib/codecs/Geopoint/GeopointValueCodec.d.ts +0 -5
- package/dist/parse/model/generateItextChunks.d.ts +0 -5
- package/src/lib/codecs/Geopoint/GeopointValueCodec.ts +0 -20
- package/src/parse/model/generateItextChunks.ts +0 -61
|
@@ -45,12 +45,13 @@ interface PrimaryInstanceStateSpec {
|
|
|
45
45
|
}
|
|
46
46
|
interface PrimaryInstanceStateInputByMode {
|
|
47
47
|
readonly create: null;
|
|
48
|
+
readonly reset: null;
|
|
48
49
|
readonly edit: InitialInstanceState;
|
|
49
50
|
readonly restore: InitialInstanceState;
|
|
50
51
|
}
|
|
51
52
|
export type PrimaryInstanceInitialState<Mode extends FormInstanceInitializationMode> = PrimaryInstanceStateInputByMode[Mode];
|
|
52
53
|
export interface BasePrimaryInstanceOptions {
|
|
53
|
-
|
|
54
|
+
scope: ReactiveScope;
|
|
54
55
|
readonly model: ModelDefinition;
|
|
55
56
|
readonly secondaryInstances: SecondaryInstancesDefinition;
|
|
56
57
|
}
|
|
@@ -74,6 +75,7 @@ export declare class PrimaryInstance<Mode extends FormInstanceInitializationMode
|
|
|
74
75
|
readonly isReadonly: () => boolean;
|
|
75
76
|
readonly hasNonRelevantAncestor: () => boolean;
|
|
76
77
|
readonly isRelevant: () => boolean;
|
|
78
|
+
private geolocationProvider;
|
|
77
79
|
private readonly setActiveLanguage;
|
|
78
80
|
readonly [XPathNodeKindKey] = "document";
|
|
79
81
|
readonly nodeType = "primary-instance";
|
|
@@ -112,5 +114,6 @@ export declare class PrimaryInstance<Mode extends FormInstanceInitializationMode
|
|
|
112
114
|
*/
|
|
113
115
|
setLanguage(language: FormLanguage): FormLanguage;
|
|
114
116
|
prepareInstancePayload<PayloadType extends InstancePayloadType = 'monolithic'>(options?: InstancePayloadOptions<PayloadType>): Promise<InstancePayload<PayloadType>>;
|
|
117
|
+
getBackgroundGeopoint(): Promise<string>;
|
|
115
118
|
}
|
|
116
119
|
export {};
|
|
@@ -10,6 +10,7 @@ import { InstanceConfig } from './InstanceConfig.ts';
|
|
|
10
10
|
export interface InstanceAttributeContextDocument {
|
|
11
11
|
readonly initializationMode: FormInstanceInitializationMode;
|
|
12
12
|
readonly isAttached: Accessor<boolean>;
|
|
13
|
+
getBackgroundGeopoint: Accessor<Promise<string>>;
|
|
13
14
|
}
|
|
14
15
|
export type DecodeInstanceValue = (value: string) => string;
|
|
15
16
|
interface InstanceAttributeContextDefinitionBind {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InstanceAttachmentFileNameFactory } from '../../client/attachments/InstanceAttachmentsConfig.ts';
|
|
2
|
-
import { PreloadProperties } from '../../client/form/FormInstanceConfig.ts';
|
|
2
|
+
import { GeolocationProvider, PreloadProperties } from '../../client/form/FormInstanceConfig.ts';
|
|
3
3
|
import { OpaqueReactiveObjectFactory } from '../../client/OpaqueReactiveObjectFactory.ts';
|
|
4
4
|
export interface InstanceConfig {
|
|
5
5
|
/**
|
|
@@ -8,4 +8,5 @@ export interface InstanceConfig {
|
|
|
8
8
|
readonly clientStateFactory: OpaqueReactiveObjectFactory;
|
|
9
9
|
readonly computeAttachmentName: InstanceAttachmentFileNameFactory;
|
|
10
10
|
readonly preloadProperties: PreloadProperties;
|
|
11
|
+
readonly geolocationProvider: GeolocationProvider | undefined;
|
|
11
12
|
}
|
|
@@ -10,6 +10,7 @@ import { InstanceConfig } from './InstanceConfig.ts';
|
|
|
10
10
|
export interface InstanceValueContextDocument {
|
|
11
11
|
readonly initializationMode: FormInstanceInitializationMode;
|
|
12
12
|
readonly isAttached: Accessor<boolean>;
|
|
13
|
+
getBackgroundGeopoint: Accessor<Promise<string>>;
|
|
13
14
|
}
|
|
14
15
|
export type DecodeInstanceValue = (value: string) => string;
|
|
15
16
|
interface InstanceValueContextDefinitionBind {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { AnchorMarkdownNode, ChildMarkdownNode as ClientChildMarkdownNode, HtmlMarkdownNode as ClientHtmlMarkdownNode, ParentMarkdownNode as ClientParentMarkdownNode, StyledMarkdownNode as ClientStyledMarkdownNode, ElementName,
|
|
2
|
-
declare abstract class
|
|
3
|
-
readonly
|
|
1
|
+
import { AnchorMarkdownNode, ChildMarkdownNode as ClientChildMarkdownNode, HtmlMarkdownNode as ClientHtmlMarkdownNode, MarkdownNode as ClientMarkdownNode, ParentMarkdownNode as ClientParentMarkdownNode, StyledMarkdownNode as ClientStyledMarkdownNode, ElementName, MarkdownProperty } from '../../client';
|
|
2
|
+
declare abstract class MarkdownNode {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
declare abstract class ParentMarkdownNode extends MarkdownNode implements ClientParentMarkdownNode {
|
|
7
|
+
readonly children: ClientMarkdownNode[];
|
|
4
8
|
readonly role = "parent";
|
|
5
9
|
abstract elementName: ElementName;
|
|
6
|
-
constructor(children:
|
|
10
|
+
constructor(children: ClientMarkdownNode[]);
|
|
7
11
|
}
|
|
8
12
|
export declare class Heading1 extends ParentMarkdownNode {
|
|
9
13
|
readonly elementName = "h1";
|
|
@@ -44,14 +48,15 @@ export declare class ListItem extends ParentMarkdownNode {
|
|
|
44
48
|
export declare class Anchor extends ParentMarkdownNode implements AnchorMarkdownNode {
|
|
45
49
|
readonly elementName = "a";
|
|
46
50
|
readonly url: string;
|
|
47
|
-
constructor(children:
|
|
51
|
+
constructor(children: ClientMarkdownNode[], url: string);
|
|
48
52
|
}
|
|
49
53
|
declare abstract class StyledMarkdownNode implements ClientParentMarkdownNode {
|
|
50
|
-
readonly
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly children: ClientMarkdownNode[];
|
|
51
56
|
readonly role = "parent";
|
|
52
57
|
abstract elementName: ElementName;
|
|
53
58
|
readonly properties: MarkdownProperty | undefined;
|
|
54
|
-
constructor(children:
|
|
59
|
+
constructor(children: ClientMarkdownNode[], properties: MarkdownProperty | undefined);
|
|
55
60
|
}
|
|
56
61
|
export declare class Paragraph extends StyledMarkdownNode implements ClientStyledMarkdownNode {
|
|
57
62
|
readonly elementName = "p";
|
|
@@ -62,12 +67,12 @@ export declare class Span extends StyledMarkdownNode implements ClientStyledMark
|
|
|
62
67
|
export declare class Div extends StyledMarkdownNode implements ClientStyledMarkdownNode {
|
|
63
68
|
readonly elementName = "div";
|
|
64
69
|
}
|
|
65
|
-
export declare class ChildMarkdownNode implements ClientChildMarkdownNode {
|
|
70
|
+
export declare class ChildMarkdownNode extends MarkdownNode implements ClientChildMarkdownNode {
|
|
66
71
|
readonly role = "child";
|
|
67
72
|
readonly value: string;
|
|
68
73
|
constructor(value: string);
|
|
69
74
|
}
|
|
70
|
-
export declare class Html implements ClientHtmlMarkdownNode {
|
|
75
|
+
export declare class Html extends MarkdownNode implements ClientHtmlMarkdownNode {
|
|
71
76
|
readonly role = "html";
|
|
72
77
|
readonly unsafeHtml: string;
|
|
73
78
|
constructor(unsafeHtml: string);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { XFormsXPathDocument } from '../adapter/XFormsXPathNode.ts';
|
|
2
|
+
import { StaticAttribute } from './StaticAttribute.ts';
|
|
2
3
|
import { StaticElementOptions, StaticElement } from './StaticElement.ts';
|
|
3
4
|
import { StaticParentNode } from './StaticParentNode.ts';
|
|
4
5
|
interface StaticDocumentOptions {
|
|
@@ -12,6 +13,7 @@ export declare class StaticDocument extends StaticParentNode<'document'> impleme
|
|
|
12
13
|
readonly nodeset: string;
|
|
13
14
|
readonly children: readonly [root: StaticElement];
|
|
14
15
|
readonly childElements: readonly [root: StaticElement];
|
|
16
|
+
readonly attributes: readonly StaticAttribute[];
|
|
15
17
|
constructor(options: StaticDocumentOptions);
|
|
16
18
|
getXPathValue(): string;
|
|
17
19
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This abstract class defines the minimal behavior for a default geopoint.
|
|
3
|
-
* It can be expanded later to support units (e.g., degrees or meters),
|
|
4
|
-
* which would also serve as documentation to clarify what each value represents.
|
|
5
|
-
*/
|
|
6
1
|
declare abstract class SemanticValue<Semantic extends string, Value extends number | null> {
|
|
7
2
|
readonly value: Value;
|
|
8
3
|
abstract readonly semantic: Semantic;
|
|
@@ -20,29 +15,30 @@ declare class Altitude<Value extends number | null = number> extends SemanticVal
|
|
|
20
15
|
declare class Accuracy<Value extends number | null = number> extends SemanticValue<'accuracy', Value> {
|
|
21
16
|
readonly semantic = "accuracy";
|
|
22
17
|
}
|
|
23
|
-
export interface
|
|
18
|
+
export interface LocationPoint {
|
|
24
19
|
readonly latitude: number;
|
|
25
20
|
readonly longitude: number;
|
|
26
21
|
readonly altitude: number | null;
|
|
27
22
|
readonly accuracy: number | null;
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
export type GeopointInputValue = GeopointRuntimeValue | string;
|
|
31
|
-
type GeopointTuple = readonly [
|
|
24
|
+
type LocationPointTuple = readonly [
|
|
32
25
|
latitude: Latitude,
|
|
33
26
|
longitude: Longitude,
|
|
34
27
|
altitude: Altitude<null> | Altitude<number>,
|
|
35
28
|
accuracy: Accuracy
|
|
36
29
|
] | readonly [latitude: Latitude, longitude: Longitude, altitude: Altitude] | readonly [latitude: Latitude, longitude: Longitude];
|
|
37
|
-
export declare
|
|
30
|
+
export declare const SEGMENT_SEPARATOR = ";";
|
|
31
|
+
export declare class Geolocation {
|
|
38
32
|
private readonly internalValue;
|
|
39
|
-
constructor(coordinates:
|
|
40
|
-
getTuple():
|
|
41
|
-
getRuntimeValue():
|
|
33
|
+
constructor(coordinates: LocationPoint);
|
|
34
|
+
getTuple(): LocationPointTuple;
|
|
35
|
+
getRuntimeValue(): LocationPoint | null;
|
|
42
36
|
private isValidDegrees;
|
|
43
37
|
private isValidNumber;
|
|
44
38
|
private static isNullLocation;
|
|
45
|
-
static parseString(value: string):
|
|
46
|
-
static toCoordinatesString(value:
|
|
39
|
+
static parseString(value: string): LocationPoint | null;
|
|
40
|
+
static toCoordinatesString(value: LocationPoint | string | null): string;
|
|
41
|
+
static isClosedShape(points: LocationPoint[]): boolean;
|
|
42
|
+
static getSegments(value: string): string[] | null;
|
|
47
43
|
}
|
|
48
44
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Geolocation, LocationPoint } from './Geolocation.ts';
|
|
2
|
+
export type GeopointRuntimeValue = LocationPoint | null;
|
|
3
|
+
export type GeopointInputValue = GeopointRuntimeValue | string;
|
|
4
|
+
export declare class Geopoint extends Geolocation {
|
|
5
|
+
static parseStringToGeopoint(value: string): GeopointRuntimeValue;
|
|
6
|
+
static parseGeopointToString(value: GeopointInputValue): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Geolocation, LocationPoint } from './Geolocation.ts';
|
|
2
|
+
export type GeoshapeRuntimeValue = LocationPoint[] | null;
|
|
3
|
+
export type GeoshapeInputValue = GeoshapeRuntimeValue | string;
|
|
4
|
+
export declare class Geoshape extends Geolocation {
|
|
5
|
+
static parseStringToGeoshape(value: string): GeoshapeRuntimeValue;
|
|
6
|
+
static parseGeoshapeString(points: GeoshapeInputValue): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Geolocation, LocationPoint } from './Geolocation.ts';
|
|
2
|
+
export type GeotraceRuntimeValue = LocationPoint[] | null;
|
|
3
|
+
export type GeotraceInputValue = GeotraceRuntimeValue | string;
|
|
4
|
+
export declare class Geotrace extends Geolocation {
|
|
5
|
+
static parseStringToGeotrace(value: string): GeotraceRuntimeValue;
|
|
6
|
+
static parseGeotraceString(points: GeotraceInputValue): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ValueType } from '../../../client';
|
|
2
|
+
import { CodecDecoder, CodecEncoder, ValueCodec } from '../ValueCodec.ts';
|
|
3
|
+
export declare function createGeolocationValueCodec<V extends ValueType, RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue>(valueType: V, encodeValue: CodecEncoder<RuntimeInputValue>, decodeValue: CodecDecoder<RuntimeValue>): ValueCodec<V, RuntimeValue, RuntimeInputValue>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ValueType } from '../../client/ValueType.ts';
|
|
2
2
|
import { DatetimeInputValue, DatetimeRuntimeValue } from './DateValueCodec.ts';
|
|
3
3
|
import { DecimalInputValue, DecimalRuntimeValue } from './DecimalValueCodec.ts';
|
|
4
|
-
import { GeopointInputValue, GeopointRuntimeValue } from './
|
|
4
|
+
import { GeopointInputValue, GeopointRuntimeValue } from './geolocation/Geopoint.ts';
|
|
5
|
+
import { GeoshapeInputValue, GeoshapeRuntimeValue } from './geolocation/Geoshape.ts';
|
|
6
|
+
import { GeotraceInputValue, GeotraceRuntimeValue } from './geolocation/Geotrace.ts';
|
|
5
7
|
import { IntInputValue, IntRuntimeValue } from './IntValueCodec.ts';
|
|
6
8
|
import { ValueCodec } from './ValueCodec.ts';
|
|
7
9
|
interface RuntimeValuesByType {
|
|
@@ -13,8 +15,8 @@ interface RuntimeValuesByType {
|
|
|
13
15
|
readonly time: string;
|
|
14
16
|
readonly dateTime: string;
|
|
15
17
|
readonly geopoint: GeopointRuntimeValue;
|
|
16
|
-
readonly geotrace:
|
|
17
|
-
readonly geoshape:
|
|
18
|
+
readonly geotrace: GeotraceRuntimeValue;
|
|
19
|
+
readonly geoshape: GeoshapeRuntimeValue;
|
|
18
20
|
readonly binary: string;
|
|
19
21
|
readonly barcode: string;
|
|
20
22
|
readonly intent: string;
|
|
@@ -29,8 +31,8 @@ interface RuntimeInputValuesByType {
|
|
|
29
31
|
readonly time: string;
|
|
30
32
|
readonly dateTime: string;
|
|
31
33
|
readonly geopoint: GeopointInputValue;
|
|
32
|
-
readonly geotrace:
|
|
33
|
-
readonly geoshape:
|
|
34
|
+
readonly geotrace: GeotraceInputValue;
|
|
35
|
+
readonly geoshape: GeoshapeInputValue;
|
|
34
36
|
readonly binary: string;
|
|
35
37
|
readonly barcode: string;
|
|
36
38
|
readonly intent: string;
|
|
@@ -9,8 +9,6 @@ type ComputedFormTextRange<Role extends TextRole> = Accessor<TextRange<Role, 'fo
|
|
|
9
9
|
*
|
|
10
10
|
* - The form's current language (e.g. `<label ref="jr:itext('text-id')" />`)
|
|
11
11
|
* - Direct `<output>` references within the label's children
|
|
12
|
-
*
|
|
13
|
-
* @todo This does not yet handle itext translations **with** outputs!
|
|
14
12
|
*/
|
|
15
13
|
export declare const createTextRange: <Role extends TextRole>(context: EvaluationContext, role: Role, definition: TextRangeDefinition<Role>) => ComputedFormTextRange<Role>;
|
|
16
14
|
export {};
|
package/dist/parse/XFormDOM.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { KnownAttributeLocalNamedElement } from '../../../common/types/dom.ts';
|
|
2
|
+
export declare const SET_VALUE_LOCAL_NAME = "setvalue";
|
|
3
|
+
export declare const SET_GEOPOINT_LOCAL_NAME = "odk:setgeopoint";
|
|
2
4
|
interface DOMBindElement extends KnownAttributeLocalNamedElement<'bind', 'nodeset'> {
|
|
3
5
|
}
|
|
4
|
-
interface DOMSetValueElement extends KnownAttributeLocalNamedElement<'setvalue', 'event'> {
|
|
6
|
+
export interface DOMSetValueElement extends KnownAttributeLocalNamedElement<'setvalue', 'event'> {
|
|
7
|
+
}
|
|
8
|
+
export interface DOMSetGeopointElement extends KnownAttributeLocalNamedElement<'odk:setgeopoint', 'event'> {
|
|
5
9
|
}
|
|
6
10
|
export interface DOMItextTranslationElement extends KnownAttributeLocalNamedElement<'translation', 'lang'> {
|
|
7
11
|
}
|
|
@@ -18,6 +22,7 @@ interface XFormDOMOptions {
|
|
|
18
22
|
export declare class XFormDOM {
|
|
19
23
|
protected readonly sourceXML: string;
|
|
20
24
|
static from(sourceXML: string): XFormDOM;
|
|
25
|
+
isInstanceID: (nodeset: string) => boolean | null;
|
|
21
26
|
protected readonly normalizedXML: string;
|
|
22
27
|
readonly xformDocument: XMLDocument;
|
|
23
28
|
readonly html: Element;
|
|
@@ -26,6 +31,7 @@ export declare class XFormDOM {
|
|
|
26
31
|
readonly model: Element;
|
|
27
32
|
readonly binds: readonly DOMBindElement[];
|
|
28
33
|
readonly setValues: readonly DOMSetValueElement[];
|
|
34
|
+
readonly setGeopoints: readonly DOMSetGeopointElement[];
|
|
29
35
|
readonly primaryInstance: Element;
|
|
30
36
|
readonly primaryInstanceRoot: Element;
|
|
31
37
|
readonly itextTranslationElements: readonly DOMItextTranslationElement[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TokenListParser, ParsedTokenList } from '../../../lib/TokenListParser.ts';
|
|
2
|
-
export declare const inputAppearanceParser: TokenListParser<"multiline" | "numbers" | "url" | "thousands-sep" | "no-calendar" | "month-year" | "
|
|
2
|
+
export declare const inputAppearanceParser: TokenListParser<"year" | "multiline" | "numbers" | "url" | "thousands-sep" | "no-calendar" | "month-year" | "ethiopian" | "coptic" | "islamic" | "bikram-sambat" | "myanmar" | "persian" | "placement-map" | "maps" | "hidden-answer" | "annotate" | "draw" | "signature" | "new-front" | "new" | "front" | "printer" | "masked", "year" | "multiline" | "numbers" | "url" | "thousands-sep" | "no-calendar" | "month-year" | "ethiopian" | "coptic" | "islamic" | "bikram-sambat" | "myanmar" | "persian" | "placement-map" | "maps" | "hidden-answer" | "annotate" | "draw" | "signature" | "new-front" | "new" | "front" | "printer" | "masked">;
|
|
3
3
|
export type InputAppearanceDefinition = ParsedTokenList<typeof inputAppearanceParser>;
|
|
@@ -3,7 +3,7 @@ import { XFormEvent } from './Event.ts';
|
|
|
3
3
|
import { ModelDefinition } from './ModelDefinition.ts';
|
|
4
4
|
export declare class ActionDefinition {
|
|
5
5
|
readonly element: Element;
|
|
6
|
-
static getRef(model: ModelDefinition,
|
|
6
|
+
static getRef(model: ModelDefinition, element: Element): string | null;
|
|
7
7
|
static getValue(element: Element): string;
|
|
8
8
|
static isKnownEvent: (event: XFormEvent) => event is XFormEvent;
|
|
9
9
|
static getEvents(element: Element): XFormEvent[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PartiallyKnownString } from '../../../../common/types/string/PartiallyKnownString.ts';
|
|
2
2
|
import { AttributeContext } from '../../instance/internal-api/AttributeContext.ts';
|
|
3
3
|
import { InstanceValueContext } from '../../instance/internal-api/InstanceValueContext.ts';
|
|
4
|
+
import { BindDefinition } from './BindDefinition.ts';
|
|
4
5
|
import { BindElement } from './BindElement.ts';
|
|
5
6
|
import { XFormEvent } from './Event.ts';
|
|
6
7
|
type PartiallyKnownPreloadParameter<Known extends string> = PartiallyKnownString<NonNullable<Known>>;
|
|
@@ -27,10 +28,10 @@ interface PreloadInput<Type extends PreloadType> {
|
|
|
27
28
|
* - {@link parameter}, an associated `jr:preloadParams` value
|
|
28
29
|
*/
|
|
29
30
|
export declare class BindPreloadDefinition<Type extends PreloadType> implements PreloadInput<Type> {
|
|
30
|
-
static from(bindElement: BindElement): AnyBindPreloadDefinition | null;
|
|
31
31
|
readonly type: Type;
|
|
32
32
|
readonly parameter: PreloadParameter<Type>;
|
|
33
33
|
readonly event: XFormEvent;
|
|
34
|
+
static from(definition: BindDefinition, bindElement: BindElement): AnyBindPreloadDefinition | null;
|
|
34
35
|
getValue(context: AttributeContext | InstanceValueContext): string | undefined;
|
|
35
36
|
private constructor();
|
|
36
37
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ActionDefinition } from './ActionDefinition.ts';
|
|
2
2
|
import { ModelDefinition } from './ModelDefinition.ts';
|
|
3
|
-
export declare class ModelActionMap extends Map<string, ActionDefinition> {
|
|
3
|
+
export declare class ModelActionMap extends Map<string, ActionDefinition[]> {
|
|
4
4
|
static fromModel(model: ModelDefinition): ModelActionMap;
|
|
5
5
|
static getKey(ref: string): string;
|
|
6
6
|
protected constructor(model: ModelDefinition);
|
|
7
|
-
get(ref: string): ActionDefinition | undefined;
|
|
7
|
+
get(ref: string): ActionDefinition[] | undefined;
|
|
8
|
+
private addAll;
|
|
8
9
|
add(action: ActionDefinition): void;
|
|
9
10
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ActiveLanguage } from '../../client/FormLanguage.ts';
|
|
2
2
|
import { StaticDocument } from '../../integration/xpath/static-dom/StaticDocument.ts';
|
|
3
|
-
import { TextChunkExpression } from '../expression/TextChunkExpression.ts';
|
|
4
3
|
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
5
|
-
import { ChunkExpressionsByItextId } from './generateItextChunks.ts';
|
|
6
4
|
import { ItextTranslationsDefinition } from './ItextTranslationsDefinition.ts';
|
|
7
5
|
import { ModelActionMap } from './ModelActionMap.ts';
|
|
8
6
|
import { ModelBindMap } from './ModelBindMap.ts';
|
|
@@ -18,14 +16,14 @@ export declare class ModelDefinition {
|
|
|
18
16
|
readonly nodes: NodeDefinitionMap;
|
|
19
17
|
readonly instance: StaticDocument;
|
|
20
18
|
readonly itextTranslations: ItextTranslationsDefinition;
|
|
21
|
-
readonly
|
|
19
|
+
readonly itextElements: Map<string, Map<string, Element>>;
|
|
22
20
|
readonly xformsRevalidateListeners: Map<string, XformsRevalidateListener>;
|
|
23
21
|
constructor(form: XFormDefinition);
|
|
24
22
|
getNodeDefinition(nodeset: string): AnyNodeDefinition;
|
|
25
23
|
getRootDefinition(instance: StaticDocument): RootDefinition;
|
|
26
24
|
registerXformsRevalidateListener(ref: string, listener: XformsRevalidateListener): void;
|
|
27
25
|
triggerXformsRevalidateListeners(): void;
|
|
28
|
-
|
|
29
|
-
toJSON(): Omit<this, "form" | "toJSON" | "getNodeDefinition" | "getRootDefinition" | "registerXformsRevalidateListener" | "triggerXformsRevalidateListeners" | "
|
|
26
|
+
getItextElement(activeLanguage: ActiveLanguage, itextId: string): Element | undefined;
|
|
27
|
+
toJSON(): Omit<this, "form" | "toJSON" | "getNodeDefinition" | "getRootDefinition" | "registerXformsRevalidateListener" | "triggerXformsRevalidateListeners" | "getItextElement">;
|
|
30
28
|
}
|
|
31
29
|
export {};
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { SecondaryInstanceDefinition } from '../SecondaryInstancesDefinition.ts';
|
|
2
2
|
import { ExternalSecondaryInstanceSource } from './ExternalSecondaryInstanceSource.ts';
|
|
3
3
|
export declare class CSVExternalSecondaryInstanceSource extends ExternalSecondaryInstanceSource<'csv'> {
|
|
4
|
-
/**
|
|
5
|
-
* Based on
|
|
6
|
-
* {@link https://github.com/getodk/central-frontend/blob/42c9277709e593480d1462e28b4be5f1364532b7/src/util/csv.js#L79} (and {@link https://github.com/getodk/central-frontend/blob/42c9277709e593480d1462e28b4be5f1364532b7/src/util/csv.js#L13}).
|
|
7
|
-
*
|
|
8
|
-
* The most significant deviations at time of writing:
|
|
9
|
-
*
|
|
10
|
-
* - we have already retrieved the CSV resource, so we are parsing the raw CSV data directly.
|
|
11
|
-
* - we have no need for asynchronous/streaming parsing at this point in the
|
|
12
|
-
* form initialization process, so we can dispense with those details of the
|
|
13
|
-
* {@link papa | papaparse} API/config.
|
|
14
|
-
*/
|
|
15
|
-
private parseCSVHeader;
|
|
16
|
-
/**
|
|
17
|
-
* Largely based on {@link https://github.com/getodk/central-frontend/blob/42c9277709e593480d1462e28b4be5f1364532b7/src/util/csv.js#L170}
|
|
18
|
-
*/
|
|
19
|
-
private parseCSVRows;
|
|
20
|
-
private toItems;
|
|
21
4
|
parseDefinition(): SecondaryInstanceDefinition;
|
|
22
5
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JRResourceURL } from '../../../../../../common/src/jr-resources/JRResourceURL';
|
|
2
|
+
interface CSVExternalSecondaryInstanceItemColumn {
|
|
3
|
+
readonly columnName: string;
|
|
4
|
+
readonly cellValue: string;
|
|
5
|
+
}
|
|
6
|
+
type CSVExternalSecondaryInstanceItem = readonly CSVExternalSecondaryInstanceItemColumn[];
|
|
7
|
+
export declare const parseItems: (resourceURL: JRResourceURL, data: string) => readonly CSVExternalSecondaryInstanceItem[];
|
|
8
|
+
export {};
|