@getodk/web-forms 0.14.0 → 0.15.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/index.js +167 -99
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10254,7 +10254,32 @@ const isISODateOrDateTimeLike = (eA) => ISO_DATE_OR_DATE_TIME_LIKE_PATTERN.test(
|
|
|
10254
10254
|
), nodeSet = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10255
10255
|
__proto__: null,
|
|
10256
10256
|
itext
|
|
10257
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
10257
|
+
}, Symbol.toStringTag, { value: "Module" })), choiceName = new StringFunction(
|
|
10258
|
+
"choice-name",
|
|
10259
|
+
[
|
|
10260
|
+
{ arityType: "required", typeHint: "string" },
|
|
10261
|
+
{ arityType: "required", typeHint: "string" }
|
|
10262
|
+
],
|
|
10263
|
+
(eA, [tA, AA]) => {
|
|
10264
|
+
const nA = tA.evaluate(eA).toString(), oA = AA.evaluate(eA).toString(), [rA] = eA.contextNodes, { domProvider: iA } = eA;
|
|
10265
|
+
let aA;
|
|
10266
|
+
rA && iA.isElement(rA) ? aA = eA.evaluator.evaluateNodes(oA, { contextNode: rA }) : aA = eA.evaluator.evaluateNodes(oA);
|
|
10267
|
+
const lA = aA?.[0];
|
|
10268
|
+
if (!lA)
|
|
10269
|
+
return "";
|
|
10270
|
+
if (!("getChoiceName" in lA))
|
|
10271
|
+
throw new Error(
|
|
10272
|
+
`Evaluating 'jr:choice-name' on element '${oA}' which has no possible choices.`
|
|
10273
|
+
);
|
|
10274
|
+
return lA.getChoiceName(nA) ?? "";
|
|
10275
|
+
}
|
|
10276
|
+
), select$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10277
|
+
__proto__: null,
|
|
10278
|
+
choiceName
|
|
10279
|
+
}, Symbol.toStringTag, { value: "Module" })), jr$2 = new FunctionLibrary(JAVAROSA_NAMESPACE_URI, [
|
|
10280
|
+
...Object.values(nodeSet),
|
|
10281
|
+
...Object.values(select$1)
|
|
10282
|
+
]), booleanFromString = new BooleanFunction(
|
|
10258
10283
|
"boolean-from-string",
|
|
10259
10284
|
[{ arityType: "required", typeHint: "string" }],
|
|
10260
10285
|
(eA, [tA]) => {
|
|
@@ -14136,14 +14161,24 @@ var encHexExports = requireEncHex();
|
|
|
14136
14161
|
const encHex = /* @__PURE__ */ getDefaultExportFromCjs(encHexExports), hex = /* @__PURE__ */ _mergeNamespaces({
|
|
14137
14162
|
__proto__: null,
|
|
14138
14163
|
default: encHex
|
|
14139
|
-
}, [encHexExports]), toStrings = (eA, tA) => tA.flatMap((AA) => {
|
|
14164
|
+
}, [encHexExports]), base64Decode$1 = (eA) => new TextDecoder().decode(Uint8Array.from(atob(eA), (tA) => tA.charCodeAt(0))), toStrings = (eA, tA) => tA.flatMap((AA) => {
|
|
14140
14165
|
const nA = AA.evaluate(eA);
|
|
14141
14166
|
switch (nA.type) {
|
|
14142
14167
|
case "NODE":
|
|
14143
14168
|
return [...nA].map((oA) => oA.toString());
|
|
14144
14169
|
}
|
|
14145
14170
|
return nA.toString();
|
|
14146
|
-
}),
|
|
14171
|
+
}), base64Decode = new StringFunction(
|
|
14172
|
+
"base64-decode",
|
|
14173
|
+
[{ arityType: "required", typeHint: "string" }],
|
|
14174
|
+
(eA, [tA]) => {
|
|
14175
|
+
try {
|
|
14176
|
+
return base64Decode$1(tA.evaluate(eA).toString());
|
|
14177
|
+
} catch {
|
|
14178
|
+
return "";
|
|
14179
|
+
}
|
|
14180
|
+
}
|
|
14181
|
+
), coalesce = new StringFunction(
|
|
14147
14182
|
"coalesce",
|
|
14148
14183
|
[
|
|
14149
14184
|
{ arityType: "required", typeHint: "string" },
|
|
@@ -14207,6 +14242,18 @@ const encHex = /* @__PURE__ */ getDefaultExportFromCjs(encHexExports), hex = /*
|
|
|
14207
14242
|
const nA = tA.evaluate(eA).toString();
|
|
14208
14243
|
return toStrings(eA, AA).join(nA);
|
|
14209
14244
|
}
|
|
14245
|
+
), pulldata = new StringFunction(
|
|
14246
|
+
"pulldata",
|
|
14247
|
+
[
|
|
14248
|
+
{ arityType: "required", typeHint: "string" },
|
|
14249
|
+
{ arityType: "required", typeHint: "string" },
|
|
14250
|
+
{ arityType: "required", typeHint: "string" },
|
|
14251
|
+
{ arityType: "required", typeHint: "string" }
|
|
14252
|
+
],
|
|
14253
|
+
(eA, [tA, AA, nA, oA]) => {
|
|
14254
|
+
const rA = tA.evaluate(eA).toString(), iA = AA.evaluate(eA).toString(), aA = nA.evaluate(eA).toString(), lA = oA.evaluate(eA).toString(), sA = `instance('${rA}')/root/item[${aA}='${lA}']/${iA}`;
|
|
14255
|
+
return eA.evaluator.evaluateString(sA);
|
|
14256
|
+
}
|
|
14210
14257
|
), regex = new BooleanFunction(
|
|
14211
14258
|
"regex",
|
|
14212
14259
|
[
|
|
@@ -14261,11 +14308,13 @@ const assertCrypto = (eA) => {
|
|
|
14261
14308
|
}
|
|
14262
14309
|
), string = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
14263
14310
|
__proto__: null,
|
|
14311
|
+
base64Decode,
|
|
14264
14312
|
coalesce,
|
|
14265
14313
|
concat,
|
|
14266
14314
|
digest,
|
|
14267
14315
|
endsWith,
|
|
14268
14316
|
join,
|
|
14317
|
+
pulldata,
|
|
14269
14318
|
regex,
|
|
14270
14319
|
substr,
|
|
14271
14320
|
uuid
|
|
@@ -14720,15 +14769,21 @@ const hintLookup = new ScopedElementLookup(":scope > hint", "hint"), itemLookup
|
|
|
14720
14769
|
// conceivable argument, because anything can be cast to a string in XPath
|
|
14721
14770
|
// semantics.
|
|
14722
14771
|
ANY_ARGUMENT_TYPE
|
|
14723
|
-
]),
|
|
14772
|
+
]), findFunctionPrincipalExpressionNode = (eA) => {
|
|
14724
14773
|
let tA;
|
|
14725
14774
|
try {
|
|
14726
14775
|
tA = expressionParser.parse(eA);
|
|
14727
14776
|
} catch {
|
|
14728
|
-
return
|
|
14777
|
+
return null;
|
|
14729
14778
|
}
|
|
14730
14779
|
const AA = findTypedPrincipalExpressionNode(["function_call"], tA.rootNode);
|
|
14731
|
-
return AA
|
|
14780
|
+
return AA ?? null;
|
|
14781
|
+
}, getTranslationExpression = (eA) => {
|
|
14782
|
+
const tA = findFunctionPrincipalExpressionNode(eA);
|
|
14783
|
+
if (!tA || !isTranslationFunctionCall(tA))
|
|
14784
|
+
return null;
|
|
14785
|
+
const AA = tA.children.find((nA) => nA.type === "argument");
|
|
14786
|
+
return AA ? AA.text : null;
|
|
14732
14787
|
}, isCurrentFunctionCall = (eA) => isCallToLocalNamedFunction(eA, "current") && hasCallSignature(eA, []), isCurrentPath = (eA) => {
|
|
14733
14788
|
const [tA] = eA.children, [AA] = tA.children;
|
|
14734
14789
|
return AA.type === "function_call" && isCurrentFunctionCall(AA);
|
|
@@ -14803,14 +14858,8 @@ const hintLookup = new ScopedElementLookup(":scope > hint", "hint"), itemLookup
|
|
|
14803
14858
|
string: "evaluateString"
|
|
14804
14859
|
};
|
|
14805
14860
|
class DependentExpression {
|
|
14806
|
-
constructor(tA, AA
|
|
14807
|
-
this.resultType =
|
|
14808
|
-
const {
|
|
14809
|
-
semanticDependencies: rA = {
|
|
14810
|
-
translations: !1
|
|
14811
|
-
}
|
|
14812
|
-
} = oA;
|
|
14813
|
-
rA.translations && isTranslationExpression(nA) && (this.isTranslated = !0, tA.isTranslated = !0);
|
|
14861
|
+
constructor(tA, AA) {
|
|
14862
|
+
this.resultType = tA, this.expression = AA, tA === "boolean" && isConstantTruthyExpression(AA) ? (this.constantTruthyExpression = AA, this.constantExpression = AA) : isConstantExpression(AA) ? (this.constantTruthyExpression = null, this.constantExpression = AA) : (this.constantTruthyExpression = null, this.constantExpression = null), this.evaluatorMethod = evaluatorMethodsByResultType[tA];
|
|
14814
14863
|
}
|
|
14815
14864
|
isTranslated = !1;
|
|
14816
14865
|
evaluatorMethod;
|
|
@@ -14831,27 +14880,25 @@ class TextChunkExpression extends DependentExpression {
|
|
|
14831
14880
|
source;
|
|
14832
14881
|
// Set for the literal source, blank otherwise
|
|
14833
14882
|
stringValue;
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
translations: rA.isTranslated
|
|
14838
|
-
},
|
|
14839
|
-
ignoreContextReference: !0
|
|
14840
|
-
}), this.source = oA, this.stringValue = iA;
|
|
14883
|
+
resourceType;
|
|
14884
|
+
constructor(tA, AA, nA, oA = "", rA = {}) {
|
|
14885
|
+
super(tA, AA), this.resourceType = rA.type ?? null, this.source = nA, this.stringValue = oA;
|
|
14841
14886
|
}
|
|
14842
|
-
static fromLiteral(tA
|
|
14843
|
-
return new TextChunkExpression(
|
|
14887
|
+
static fromLiteral(tA) {
|
|
14888
|
+
return new TextChunkExpression("string", "null", "literal", tA);
|
|
14844
14889
|
}
|
|
14845
|
-
static fromReference(tA
|
|
14846
|
-
return new TextChunkExpression(
|
|
14890
|
+
static fromReference(tA) {
|
|
14891
|
+
return new TextChunkExpression("string", tA, "reference");
|
|
14847
14892
|
}
|
|
14848
|
-
static fromOutput(tA
|
|
14849
|
-
return isOutputElement(
|
|
14893
|
+
static fromOutput(tA) {
|
|
14894
|
+
return isOutputElement(tA) ? new TextChunkExpression("string", tA.getAttribute("value"), "output") : null;
|
|
14850
14895
|
}
|
|
14851
|
-
static
|
|
14852
|
-
return
|
|
14853
|
-
|
|
14854
|
-
|
|
14896
|
+
static fromResource(tA, AA) {
|
|
14897
|
+
return new TextChunkExpression("string", "null", "literal", tA, { type: AA });
|
|
14898
|
+
}
|
|
14899
|
+
static fromTranslation(tA) {
|
|
14900
|
+
const AA = getTranslationExpression(tA);
|
|
14901
|
+
return AA ? new TextChunkExpression("nodes", AA, "translation") : null;
|
|
14855
14902
|
}
|
|
14856
14903
|
}
|
|
14857
14904
|
const absolutePathNodeList = (eA) => {
|
|
@@ -15028,12 +15075,12 @@ class TextElementDefinition extends TextRangeDefinition {
|
|
|
15028
15075
|
chunks;
|
|
15029
15076
|
constructor(tA, AA, nA) {
|
|
15030
15077
|
super(tA, AA, nA);
|
|
15031
|
-
const oA =
|
|
15032
|
-
if (
|
|
15033
|
-
this.chunks = Array.from(nA.childNodes).flatMap((
|
|
15078
|
+
const oA = parseNodesetReference(AA, nA, "ref");
|
|
15079
|
+
if (oA == null)
|
|
15080
|
+
this.chunks = Array.from(nA.childNodes).flatMap((rA) => isElementNode(rA) ? TextChunkExpression.fromOutput(rA) ?? [] : isTextNode(rA) ? TextChunkExpression.fromLiteral(rA.data) : []);
|
|
15034
15081
|
else {
|
|
15035
|
-
const
|
|
15036
|
-
|
|
15082
|
+
const rA = TextChunkExpression.fromTranslation(oA);
|
|
15083
|
+
rA ? this.chunks = [rA] : this.chunks = [TextChunkExpression.fromReference(oA)];
|
|
15037
15084
|
}
|
|
15038
15085
|
}
|
|
15039
15086
|
}
|
|
@@ -15201,13 +15248,13 @@ class RangeControlDefinition extends ControlDefinition {
|
|
|
15201
15248
|
}
|
|
15202
15249
|
}
|
|
15203
15250
|
class ItemsetNodesetExpression extends DependentExpression {
|
|
15204
|
-
constructor(tA
|
|
15205
|
-
super(
|
|
15251
|
+
constructor(tA) {
|
|
15252
|
+
super("nodes", tA);
|
|
15206
15253
|
}
|
|
15207
15254
|
}
|
|
15208
15255
|
class ItemsetValueExpression extends DependentExpression {
|
|
15209
15256
|
constructor(tA, AA) {
|
|
15210
|
-
super(
|
|
15257
|
+
super("string", AA), this.itemset = tA;
|
|
15211
15258
|
}
|
|
15212
15259
|
}
|
|
15213
15260
|
class ItemsetLabelDefinition extends TextRangeDefinition {
|
|
@@ -15222,15 +15269,15 @@ class ItemsetLabelDefinition extends TextRangeDefinition {
|
|
|
15222
15269
|
const oA = nA.getAttribute("ref");
|
|
15223
15270
|
if (oA == null)
|
|
15224
15271
|
throw new Error("<itemset><label> missing ref attribute");
|
|
15225
|
-
const rA = TextChunkExpression.fromTranslation(
|
|
15226
|
-
rA
|
|
15272
|
+
const rA = TextChunkExpression.fromTranslation(oA);
|
|
15273
|
+
rA ? this.chunks = [rA] : this.chunks = [TextChunkExpression.fromReference(oA)];
|
|
15227
15274
|
}
|
|
15228
15275
|
}
|
|
15229
15276
|
class ItemsetDefinition extends BodyElementDefinition {
|
|
15230
15277
|
constructor(tA, AA, nA) {
|
|
15231
15278
|
super(tA, AA, nA), this.parent = AA;
|
|
15232
15279
|
const oA = parseNodesetReference(AA, nA, "nodeset");
|
|
15233
|
-
this.nodes = new ItemsetNodesetExpression(
|
|
15280
|
+
this.nodes = new ItemsetNodesetExpression(oA), this.reference = oA;
|
|
15234
15281
|
const rA = getValueElement(nA);
|
|
15235
15282
|
if (rA == null)
|
|
15236
15283
|
throw new Error("<itemset> has no <value>");
|
|
@@ -15841,7 +15888,36 @@ const parseNodeName = (eA) => ({
|
|
|
15841
15888
|
...tA,
|
|
15842
15889
|
documentRoot: AA
|
|
15843
15890
|
});
|
|
15844
|
-
},
|
|
15891
|
+
}, JR_RESOURCE_URL_PROTOCOL = "jr:", ALL_RESOURCE_TYPES = ["image", "audio", "video"], isResourceType = (eA) => ALL_RESOURCE_TYPES.includes(eA);
|
|
15892
|
+
class JRResourceURL extends URL {
|
|
15893
|
+
static create(tA, AA) {
|
|
15894
|
+
return new this(`jr://${tA}/${AA}`);
|
|
15895
|
+
}
|
|
15896
|
+
static from(tA) {
|
|
15897
|
+
return new this(tA);
|
|
15898
|
+
}
|
|
15899
|
+
static isJRResourceReference(tA) {
|
|
15900
|
+
return tA?.startsWith(JR_RESOURCE_URL_PROTOCOL) ?? !1;
|
|
15901
|
+
}
|
|
15902
|
+
constructor(tA) {
|
|
15903
|
+
super(tA);
|
|
15904
|
+
}
|
|
15905
|
+
}
|
|
15906
|
+
const generateChunk = (eA) => {
|
|
15907
|
+
if (isElementNode(eA))
|
|
15908
|
+
return TextChunkExpression.fromOutput(eA);
|
|
15909
|
+
if (isTextNode(eA)) {
|
|
15910
|
+
const tA = eA.parentElement.getAttribute("form");
|
|
15911
|
+
return isResourceType(tA) ? TextChunkExpression.fromResource(eA.data, tA) : TextChunkExpression.fromLiteral(eA.data);
|
|
15912
|
+
}
|
|
15913
|
+
return null;
|
|
15914
|
+
}, generateChunksForValues = (eA) => Array.from(eA.childNodes).map((tA) => generateChunk(tA)).filter((tA) => tA !== null), generateChunksForTranslation = (eA) => Array.from(eA.childNodes).flatMap(
|
|
15915
|
+
(tA) => generateChunksForValues(tA)
|
|
15916
|
+
), generateChunksForLanguage = (eA) => new Map(
|
|
15917
|
+
Array.from(eA.children).map((tA) => [tA.getAttribute("id"), generateChunksForTranslation(tA)])
|
|
15918
|
+
), generateItextChunks = (eA) => new Map(
|
|
15919
|
+
eA.map((tA) => [tA.getAttribute("lang"), generateChunksForLanguage(tA)])
|
|
15920
|
+
), assertItextTranslationsDefinitionEntry = ([
|
|
15845
15921
|
eA,
|
|
15846
15922
|
tA
|
|
15847
15923
|
]) => {
|
|
@@ -15878,30 +15954,27 @@ const defaultBindComputationExpressions = {
|
|
|
15878
15954
|
saveIncomplete: "boolean"
|
|
15879
15955
|
};
|
|
15880
15956
|
class BindComputationExpression extends DependentExpression {
|
|
15881
|
-
constructor(tA, AA
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
if (AA === "calculate")
|
|
15957
|
+
constructor(tA, AA) {
|
|
15958
|
+
let nA, oA;
|
|
15959
|
+
if (AA == null) {
|
|
15960
|
+
if (tA === "calculate")
|
|
15886
15961
|
throw new Error("No default expression for calculate");
|
|
15887
|
-
|
|
15962
|
+
oA = defaultBindComputationExpressions[tA], nA = !0;
|
|
15888
15963
|
} else
|
|
15889
|
-
|
|
15890
|
-
super(
|
|
15891
|
-
ignoreContextReference: oA
|
|
15892
|
-
}), this.computation = AA, this.isDefaultExpression = rA;
|
|
15964
|
+
nA = !1, oA = AA;
|
|
15965
|
+
super(bindComputationResultTypes[tA], oA), this.computation = tA, this.isDefaultExpression = nA;
|
|
15893
15966
|
}
|
|
15894
15967
|
static forComputation(tA, AA) {
|
|
15895
15968
|
const nA = tA.bindElement.getAttribute(AA) ?? defaultBindComputationExpressions[AA];
|
|
15896
|
-
return nA == null ? null : new this(
|
|
15969
|
+
return nA == null ? null : new this(AA, nA);
|
|
15897
15970
|
}
|
|
15898
15971
|
isDefaultExpression;
|
|
15899
15972
|
}
|
|
15900
15973
|
class MessageDefinition extends TextRangeDefinition {
|
|
15901
15974
|
constructor(tA, AA, nA) {
|
|
15902
15975
|
super(tA.form, tA, null), this.role = AA;
|
|
15903
|
-
const oA = TextChunkExpression.fromTranslation(
|
|
15904
|
-
oA
|
|
15976
|
+
const oA = TextChunkExpression.fromTranslation(nA);
|
|
15977
|
+
oA ? this.chunks = [oA] : this.chunks = [TextChunkExpression.fromLiteral(nA)];
|
|
15905
15978
|
}
|
|
15906
15979
|
static from(tA, AA) {
|
|
15907
15980
|
const nA = tA.bindElement.getAttributeNS(JAVAROSA_NAMESPACE_URI$1, AA);
|
|
@@ -19868,15 +19941,15 @@ class RepeatCountControlExpression extends DependentExpression {
|
|
|
19868
19941
|
static from(tA, AA) {
|
|
19869
19942
|
const { countExpression: nA, noAddRemoveExpression: oA } = tA;
|
|
19870
19943
|
if (nA != null)
|
|
19871
|
-
return new this(
|
|
19944
|
+
return new this(nA);
|
|
19872
19945
|
if (oA != null && isConstantTruthyExpression(oA)) {
|
|
19873
19946
|
const rA = String(Math.max(AA, 1));
|
|
19874
|
-
return new this(
|
|
19947
|
+
return new this(rA);
|
|
19875
19948
|
}
|
|
19876
19949
|
return null;
|
|
19877
19950
|
}
|
|
19878
|
-
constructor(tA
|
|
19879
|
-
super(
|
|
19951
|
+
constructor(tA) {
|
|
19952
|
+
super("number", tA);
|
|
19880
19953
|
}
|
|
19881
19954
|
}
|
|
19882
19955
|
const isJRTemplateAttributeName = (eA) => eA.localName !== "template" ? !1 : (eA.namespaceURI?.href ?? eA.namespaceURI) === JAVAROSA_NAMESPACE_URI$1, isJRTemplateAttribute = (eA) => isJRTemplateAttributeName(eA.qualifiedName), isExplicitRepeatTemplateElement = (eA) => eA.attributes.some(isJRTemplateAttribute), cloneStaticAttributeOptions = (eA) => ({
|
|
@@ -20039,13 +20112,14 @@ class ModelDefinition {
|
|
|
20039
20112
|
const AA = new SubmissionDefinition(tA.xformDOM);
|
|
20040
20113
|
this.binds = ModelBindMap.fromModel(this), this.instance = parseStaticDocumentFromDOMSubtree(tA.xformDOM.primaryInstanceRoot, {
|
|
20041
20114
|
nodesetPrefix: "/"
|
|
20042
|
-
}), this.root = new RootDefinition(tA, this, AA, tA.body.classes), this.nodes = nodeDefinitionMap(this.root), this.itextTranslations = ItextTranslationsDefinition.from(tA.xformDOM);
|
|
20115
|
+
}), this.root = new RootDefinition(tA, this, AA, tA.body.classes), this.nodes = nodeDefinitionMap(this.root), this.itextTranslations = ItextTranslationsDefinition.from(tA.xformDOM), this.itextChunks = generateItextChunks(tA.xformDOM.itextTranslationElements);
|
|
20043
20116
|
}
|
|
20044
20117
|
binds;
|
|
20045
20118
|
root;
|
|
20046
20119
|
nodes;
|
|
20047
20120
|
instance;
|
|
20048
20121
|
itextTranslations;
|
|
20122
|
+
itextChunks;
|
|
20049
20123
|
getNodeDefinition(tA) {
|
|
20050
20124
|
const AA = this.nodes.get(tA);
|
|
20051
20125
|
if (AA == null)
|
|
@@ -20062,6 +20136,9 @@ class ModelDefinition {
|
|
|
20062
20136
|
const { form: tA, ...AA } = this;
|
|
20063
20137
|
return AA;
|
|
20064
20138
|
}
|
|
20139
|
+
getTranslationChunks(tA, AA) {
|
|
20140
|
+
return this.itextChunks.get(AA.language)?.get(tA) ?? [];
|
|
20141
|
+
}
|
|
20065
20142
|
}
|
|
20066
20143
|
class XFormDefinition {
|
|
20067
20144
|
constructor(tA) {
|
|
@@ -20078,21 +20155,6 @@ class XFormDefinition {
|
|
|
20078
20155
|
body;
|
|
20079
20156
|
model;
|
|
20080
20157
|
}
|
|
20081
|
-
const JR_RESOURCE_URL_PROTOCOL = "jr:";
|
|
20082
|
-
class JRResourceURL extends URL {
|
|
20083
|
-
static create(tA, AA) {
|
|
20084
|
-
return new this(`jr://${tA}/${AA}`);
|
|
20085
|
-
}
|
|
20086
|
-
static from(tA) {
|
|
20087
|
-
return new this(tA);
|
|
20088
|
-
}
|
|
20089
|
-
static isJRResourceReference(tA) {
|
|
20090
|
-
return tA?.startsWith(JR_RESOURCE_URL_PROTOCOL) ?? !1;
|
|
20091
|
-
}
|
|
20092
|
-
constructor(tA) {
|
|
20093
|
-
super(tA);
|
|
20094
|
-
}
|
|
20095
|
-
}
|
|
20096
20158
|
const assertSecondaryInstanceDefinition = ({ root: eA }) => {
|
|
20097
20159
|
if (eA.getAttributeValue("id") == null)
|
|
20098
20160
|
throw new Error();
|
|
@@ -22339,33 +22401,33 @@ class TextRange {
|
|
|
22339
22401
|
}
|
|
22340
22402
|
const createTextChunks = (eA, tA) => createMemo(() => {
|
|
22341
22403
|
const AA = [], nA = {};
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
|
|
22404
|
+
let oA;
|
|
22405
|
+
if (tA.chunks[0]?.source === "translation") {
|
|
22406
|
+
const rA = eA.evaluator.evaluateString(tA.chunks[0].toString(), {
|
|
22407
|
+
contextNode: eA.contextNode
|
|
22408
|
+
});
|
|
22409
|
+
oA = tA.form.model.getTranslationChunks(
|
|
22410
|
+
rA,
|
|
22411
|
+
eA.getActiveLanguage()
|
|
22412
|
+
);
|
|
22413
|
+
} else
|
|
22414
|
+
oA = tA.chunks;
|
|
22415
|
+
return oA.forEach((rA) => {
|
|
22416
|
+
if (rA.resourceType) {
|
|
22417
|
+
nA[rA.resourceType] = JRResourceURL.from(
|
|
22418
|
+
rA.stringValue
|
|
22419
|
+
);
|
|
22345
22420
|
return;
|
|
22346
22421
|
}
|
|
22347
|
-
|
|
22348
|
-
|
|
22349
|
-
AA.push(new TextChunk(eA, oA.source, rA));
|
|
22422
|
+
if (rA.source === "literal") {
|
|
22423
|
+
AA.push(new TextChunk(eA, rA.source, rA.stringValue));
|
|
22350
22424
|
return;
|
|
22351
|
-
}
|
|
22352
|
-
|
|
22353
|
-
|
|
22354
|
-
const aA = iA.getAttributeValue("form");
|
|
22355
|
-
if (aA) {
|
|
22356
|
-
if (["image", "video", "audio"].includes(aA)) {
|
|
22357
|
-
const lA = iA.getXPathValue();
|
|
22358
|
-
JRResourceURL.isJRResourceReference(lA) && (nA[aA] = JRResourceURL.from(lA));
|
|
22359
|
-
}
|
|
22360
|
-
} else {
|
|
22361
|
-
const lA = iA.getXPathValue();
|
|
22362
|
-
AA.push(new TextChunk(eA, oA.source, lA));
|
|
22363
|
-
}
|
|
22364
|
-
}
|
|
22365
|
-
});
|
|
22425
|
+
}
|
|
22426
|
+
const iA = createComputedExpression(eA, rA)();
|
|
22427
|
+
AA.push(new TextChunk(eA, rA.source, iA));
|
|
22366
22428
|
}), { chunks: AA, mediaSources: nA };
|
|
22367
22429
|
}), createTextRange = (eA, tA, AA) => eA.scope.runTask(() => {
|
|
22368
|
-
const nA = createTextChunks(eA, AA
|
|
22430
|
+
const nA = createTextChunks(eA, AA);
|
|
22369
22431
|
return createMemo(() => {
|
|
22370
22432
|
const oA = nA();
|
|
22371
22433
|
return new TextRange("form", tA, oA.chunks, oA.mediaSources);
|
|
@@ -22966,6 +23028,9 @@ let RankControl$1 = class extends ValueNode {
|
|
|
22966
23028
|
throw new RankMissingValueError("There are missing options. Rank should have all options.");
|
|
22967
23029
|
return this.setValueState(tA), this.root;
|
|
22968
23030
|
}
|
|
23031
|
+
getChoiceName(tA) {
|
|
23032
|
+
return this.mapOptionsByValue().get(tA)?.label?.asString ?? null;
|
|
23033
|
+
}
|
|
22969
23034
|
};
|
|
22970
23035
|
const insertAtIndex = (eA, tA, AA) => {
|
|
22971
23036
|
const { length: nA } = eA;
|
|
@@ -23394,6 +23459,9 @@ class SelectControl extends ValueNode {
|
|
|
23394
23459
|
const AA = this.mapOptionsByValue().keys(), nA = this.filterValues(AA, tA);
|
|
23395
23460
|
return this.setValueState(nA), this.root;
|
|
23396
23461
|
}
|
|
23462
|
+
getChoiceName(tA) {
|
|
23463
|
+
return this.mapOptionsByValue().get(tA)?.label?.asString ?? null;
|
|
23464
|
+
}
|
|
23397
23465
|
}
|
|
23398
23466
|
class Subtree extends DescendantNode {
|
|
23399
23467
|
childrenState;
|
|
@@ -42957,7 +43025,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
42957
43025
|
},
|
|
42958
43026
|
emits: ["submit", "submitChunked"],
|
|
42959
43027
|
setup(eA, { emit: tA }) {
|
|
42960
|
-
const AA = "v0.
|
|
43028
|
+
const AA = "v0.15.0", nA = eA, oA = (hA) => {
|
|
42961
43029
|
const EA = async (BA) => {
|
|
42962
43030
|
const bA = await BA;
|
|
42963
43031
|
uA.value = updateSubmittedFormState(bA, hA);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getodk/web-forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "ODK Web Forms",
|
|
6
6
|
"author": "getodk",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@faker-js/faker": "^9.9.0",
|
|
56
56
|
"@fontsource/hanken-grotesk": "^5.2.6",
|
|
57
57
|
"@fontsource/roboto": "^5.2.6",
|
|
58
|
-
"@getodk/xforms-engine": "0.
|
|
58
|
+
"@getodk/xforms-engine": "0.13.0",
|
|
59
59
|
"@playwright/test": "^1.53.2",
|
|
60
60
|
"@types/ramda": "^0.30.2",
|
|
61
61
|
"@vitejs/plugin-vue": "^6.0.0",
|