@getodk/web-forms 1.0.2 → 1.0.3

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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as m, openBlock as s, createBlock as f, unref as p, withCtx as n, createElementVNode as t, createElementBlock as l, Fragment as u, renderList as _, normalizeClass as v, createVNode as b, toDisplayString as a } from "vue";
2
- import { s as g, I, _ as k } from "./index-DWj9XRAV.js";
2
+ import { s as g, I, _ as k } from "./index-BfN3Q-uY.js";
3
3
  const x = { class: "odk-form-list" }, B = { class: "action-description" }, C = /* @__PURE__ */ m({
4
4
  __name: "ActionsInfoDialog",
5
5
  props: {
@@ -1,6 +1,6 @@
1
1
  import { resolveComponent as T, openBlock as d, createElementBlock as m, mergeProps as P, createCommentVNode as k, createVNode as C, withCtx as U, Transition as Ue, createElementVNode as L, shallowRef as j, computed as w, onUnmounted as ge, defineComponent as be, inject as ke, ref as S, watch as ye, onBeforeUnmount as Ae, Fragment as Se, normalizeClass as $, unref as a, normalizeStyle as Ve, createBlock as B, useModel as $e, onMounted as Fe, createTextVNode as Ze, toDisplayString as G, renderList as Xe, mergeModels as re } from "vue";
2
- import { A as _e } from "./ActionsInfoDialog-DtAY32vv.js";
3
- import { B as Ne, k as je, l as Ge, O as Ye, m as Ke, C as We, n as ae, r as qe, o as Je, q as Qe, Z as Y, T as Ce, I as x, _ as we, u as en, v as se, j as nn } from "./index-DWj9XRAV.js";
2
+ import { A as _e } from "./ActionsInfoDialog-_u7reYAk.js";
3
+ import { B as Ne, k as je, l as Ge, O as Ye, m as Ke, C as We, n as ae, r as qe, o as Je, q as Qe, Z as Y, T as Ce, I as x, _ as we, u as en, v as se, j as nn } from "./index-BfN3Q-uY.js";
4
4
  var tn = ({ dt: e }) => `
5
5
  .p-colorpicker {
6
6
  display: inline-block;
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as Yn, inject as cn, ref as Se, computed as it, watch as Rt, openBlock as ee, createBlock as rt, Transition as ed, withCtx as We, createElementBlock as me, createElementVNode as N, normalizeClass as Qt, toDisplayString as ne, unref as O, withDirectives as js, vModelText as Ys, createVNode as he, createCommentVNode as Ce, Fragment as Ca, shallowRef as ht, renderList as td, onMounted as nd, onUnmounted as id, nextTick as sd, createTextVNode as rd } from "vue";
2
- import { T as wn, i as od, a as Ul, b as ad, I as Oe, t as Ta, _ as Oi, s as ah, c as Bt, S as Te, g as ld, M as cd, d as hd, e as ud, f as dd, h as fd, p as gd, Q as _d, j as md } from "./index-DWj9XRAV.js";
3
- import { A as pd } from "./ActionsInfoDialog-DtAY32vv.js";
2
+ import { T as wn, i as od, a as Ul, b as ad, I as Oe, t as Ta, _ as Oi, s as ah, c as Bt, S as Te, g as ld, M as cd, d as hd, e as ud, f as dd, h as fd, p as gd, Q as _d, j as md } from "./index-BfN3Q-uY.js";
3
+ import { A as pd } from "./ActionsInfoDialog-_u7reYAk.js";
4
4
  function lh(...i) {
5
5
  console.warn(...i);
6
6
  }
@@ -11498,11 +11498,20 @@ class StringEvaluation extends ValueEvaluation {
11498
11498
  constructor(nr, rr, or = rr === "") {
11499
11499
  super(), this.context = nr, this.value = rr, this.isEmpty = or, this.booleanValue = !or, this.numberValue = or ? NaN : Number(rr), this.stringValue = rr;
11500
11500
  const Ar = nr.functions.getDefaultImplementation("number");
11501
- or ? this.numberValue = NaN : (this.numberValue = Number(rr), Ar != null && (this.numberValue = Ar.call(nr, [
11502
- {
11503
- evaluate: () => this
11501
+ if (or)
11502
+ this.numberValue = NaN;
11503
+ else if (Ar === null)
11504
+ this.numberValue = Number(rr);
11505
+ else
11506
+ try {
11507
+ this.numberValue = Ar.call(nr, [
11508
+ {
11509
+ evaluate: () => this
11510
+ }
11511
+ ]).toNumber();
11512
+ } catch {
11513
+ this.numberValue = Number(rr);
11504
11514
  }
11505
- ]).toNumber()));
11506
11515
  }
11507
11516
  context;
11508
11517
  value;
@@ -11539,19 +11548,7 @@ class NodeEvaluation extends ValueEvaluation {
11539
11548
  if (nr == null) {
11540
11549
  const { context: rr, value: or } = this, Ar = rr.domProvider.getNodeValue(or), ir = trimXMLXPathWhitespace$1(Ar) === "", sr = !ir, lr = rr.functions.getDefaultImplementation("number");
11541
11550
  let dr;
11542
- if (ir)
11543
- dr = NaN;
11544
- else if (lr == null)
11545
- dr = Number(Ar);
11546
- else {
11547
- const cr = new StringEvaluation(rr, Ar);
11548
- dr = lr.call(rr, [
11549
- {
11550
- evaluate: () => cr
11551
- }
11552
- ]).toNumber();
11553
- }
11554
- nr = {
11551
+ ir ? dr = NaN : lr == null ? dr = Number(Ar) : dr = new StringEvaluation(rr, Ar).toNumber(), nr = {
11555
11552
  booleanValue: sr,
11556
11553
  isEmpty: ir,
11557
11554
  numberValue: dr,
@@ -12321,23 +12318,19 @@ const evaluateInt = (er, nr) => parseInt(nr.evaluate(er).toString(), 10), mathAl
12321
12318
  ), round$1 = mathAlias("round"), sum$1 = new NumberFunction(
12322
12319
  "sum",
12323
12320
  [{ arityType: "required" }],
12324
- (er, nr) => {
12325
- if (nr.length === 0)
12326
- return NaN;
12327
- let rr;
12328
- for (const or of nr) {
12329
- const Ar = or.evaluate(er);
12330
- for (const ir of Ar) {
12331
- const sr = ir.toNumber();
12332
- if (Number.isNaN(sr)) {
12333
- rr = NaN;
12334
- break;
12335
- }
12336
- if (rr = rr == null ? sr : rr + sr, Number.isNaN(rr))
12337
- break;
12338
- }
12321
+ (er, [nr]) => {
12322
+ let rr = 0;
12323
+ const or = nr.evaluate(er);
12324
+ for (const Ar of or) {
12325
+ if (Ar.toString().trim() === "")
12326
+ continue;
12327
+ const ir = Ar.toNumber();
12328
+ if (Number.isNaN(ir))
12329
+ return NaN;
12330
+ if (rr += ir, Number.isNaN(rr))
12331
+ return NaN;
12339
12332
  }
12340
- return rr ?? NaN;
12333
+ return rr;
12341
12334
  }
12342
12335
  ), number$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12343
12336
  __proto__: null,
@@ -17615,15 +17608,22 @@ const seededRandomize = (er, nr) => {
17615
17608
  [{ arityType: "optional" }],
17616
17609
  (er, [nr]) => {
17617
17610
  const rr = nr?.evaluate(er) ?? er, or = rr.toNumber(), { type: Ar } = rr;
17611
+ if (Ar === "NUMBER")
17612
+ return rr;
17618
17613
  if (Ar === "NODE" || Ar === "STRING") {
17619
- const ir = rr.toString(), sr = dateTimeFromString(er.timeZone, ir);
17614
+ const ir = rr.toString();
17615
+ let sr;
17616
+ try {
17617
+ sr = dateTimeFromString(er.timeZone, ir);
17618
+ } catch {
17619
+ }
17620
17620
  if (sr != null)
17621
17621
  return new DateTimeLikeEvaluation(er, sr, {
17622
17622
  booleanValue: !0,
17623
17623
  stringValue: String(Math.floor(sr.epochMilliseconds / DAY_MILLISECONDS))
17624
17624
  });
17625
17625
  }
17626
- return Ar === "NUMBER" ? rr : new NumberEvaluation(er, or);
17626
+ return new NumberEvaluation(er, or);
17627
17627
  }
17628
17628
  ), { PI } = Math, pi = new NumberFunction("pi", [], () => PI), pow = math2Alias("pow"), random = new NumberFunction("random", [], Math.random), round = new NumberFunction(
17629
17629
  "round",
@@ -31793,9 +31793,17 @@ class DescendantNode extends InstanceNode {
31793
31793
  class ValueNode extends DescendantNode {
31794
31794
  constructor(nr, rr, or, Ar) {
31795
31795
  super(nr, rr, or), this.instanceNode = rr, this.valueType = or.valueType, this.decodeInstanceValue = Ar.decodeInstanceValue;
31796
- const ir = createInstanceValueState(this), sr = Ar.createRuntimeValueState(ir), [lr] = ir, [, dr] = sr;
31797
- this.getInstanceValue = lr, this.setValueState = dr, this.getXPathValue = () => this.getInstanceValue(), this.valueState = sr, this.validation = createValidationState(this, this.instanceConfig), this.instanceState = createValueNodeInstanceState(this), this.setEncodedValue = (cr) => {
31798
- this.setValueState(Ar.decodeValue(cr));
31796
+ const { valueState: ir, setValueFromAction: sr } = createInstanceValueState(this), [lr] = ir, dr = Ar.createRuntimeValueState(ir), [, cr] = Ar.createRuntimeValueState([
31797
+ lr,
31798
+ sr
31799
+ ]), [, gr] = dr;
31800
+ this.getInstanceValue = lr, this.setValueState = gr, this.getXPathValue = () => this.getInstanceValue(), this.valueState = dr, this.validation = createValidationState(this, this.instanceConfig), this.instanceState = createValueNodeInstanceState(this), this.setEncodedValue = (Ir, pr = !1) => {
31801
+ const Cr = Ar.decodeValue(Ir);
31802
+ if (pr) {
31803
+ cr(Cr);
31804
+ return;
31805
+ }
31806
+ gr(Cr);
31799
31807
  };
31800
31808
  }
31801
31809
  instanceNode;
@@ -31813,6 +31821,7 @@ class ValueNode extends DescendantNode {
31813
31821
  return this.validation.currentState;
31814
31822
  }
31815
31823
  instanceState;
31824
+ // Write path for `xforms-value-changed` actions targeting this node; permitted while readonly too.
31816
31825
  setEncodedValue;
31817
31826
  // ValidationContext
31818
31827
  getViolation() {
@@ -31919,13 +31928,13 @@ const REPEAT_INDEX_REGEX = /([^[]*)(\[[0-9]+\])/g, isInstanceFirstLoad = (er) =>
31919
31928
  const lr = sr[0];
31920
31929
  if ((lr instanceof ValueNode || lr instanceof Attribute) && lr.isAttached() && er.isAttached() && rr !== void 0 && rr !== or && referencesCurrentNode(lr, ir))
31921
31930
  if (Ar.type === "geopoint")
31922
- getGeopointValue(er, (dr) => lr.setEncodedValue(dr));
31931
+ getGeopointValue(er, (dr) => lr.setEncodedValue(dr, !0));
31923
31932
  else {
31924
31933
  const dr = untrack(() => er.evaluator.evaluateString(
31925
31934
  Ar.computation.expression,
31926
31935
  lr
31927
31936
  ));
31928
- lr.setEncodedValue(dr);
31937
+ lr.setEncodedValue(dr, !0);
31929
31938
  }
31930
31939
  }), rr = or;
31931
31940
  });
@@ -31933,7 +31942,10 @@ const REPEAT_INDEX_REGEX = /([^[]*)(\[[0-9]+\])/g, isInstanceFirstLoad = (er) =>
31933
31942
  const nr = getInitialValue(er), rr = createSignal(nr), or = createRelevantValueState(er, rr), [Ar, ir] = or;
31934
31943
  preloadValue(er, ir);
31935
31944
  const { calculate: sr } = er.definition.bind;
31936
- return sr != null && createCalculation(er, ir, sr), registerValueChangedActions(er, Ar), registerSetValueActions(er, ir), guardDownstreamReadonlyWrites(er, or);
31945
+ return sr != null && createCalculation(er, ir, sr), registerValueChangedActions(er, Ar), registerSetValueActions(er, ir), {
31946
+ valueState: guardDownstreamReadonlyWrites(er, or),
31947
+ setValueFromAction: ir
31948
+ };
31937
31949
  });
31938
31950
  class Attribute extends DescendantNode {
31939
31951
  constructor(nr, rr, or) {
@@ -31941,9 +31953,12 @@ class Attribute extends DescendantNode {
31941
31953
  super(nr, or, rr, { computeReference: Ar }), this.owner = nr, this.instanceNode = or;
31942
31954
  const ir = getSharedValueCodec("string");
31943
31955
  this.validationState = { violations: [] }, this.valueType = "string", this.decodeInstanceValue = ir.decodeInstanceValue;
31944
- const sr = createInstanceValueState(this), lr = ir.createRuntimeValueState(sr), [dr] = sr, [, cr] = lr;
31945
- this.getInstanceValue = dr, this.setValueState = cr, this.valueState = lr;
31946
- const gr = createSharedNodeState(
31956
+ const { valueState: sr, setValueFromAction: lr } = createInstanceValueState(this), [dr] = sr, cr = ir.createRuntimeValueState(sr), [, gr] = ir.createRuntimeValueState([
31957
+ dr,
31958
+ lr
31959
+ ]), [, Ir] = cr;
31960
+ this.getInstanceValue = dr, this.setValueState = Ir, this.valueState = cr;
31961
+ const pr = createSharedNodeState(
31947
31962
  nr.scope,
31948
31963
  {
31949
31964
  value: this.valueState,
@@ -31960,8 +31975,13 @@ class Attribute extends DescendantNode {
31960
31975
  },
31961
31976
  this.instanceConfig
31962
31977
  );
31963
- this.state = gr, this.engineState = gr.engineState, this.currentState = gr.currentState, this.instanceState = createAttributeNodeInstanceState(this), this.attributeState = createAttributeState(this.scope), this.getXPathValue = () => this.getInstanceValue(), this.setEncodedValue = (Ir) => {
31964
- this.setValueState(ir.decodeValue(Ir));
31978
+ this.state = pr, this.engineState = pr.engineState, this.currentState = pr.currentState, this.instanceState = createAttributeNodeInstanceState(this), this.attributeState = createAttributeState(this.scope), this.getXPathValue = () => this.getInstanceValue(), this.setEncodedValue = (Cr, mr = !1) => {
31979
+ const Er = ir.decodeValue(Cr);
31980
+ if (mr) {
31981
+ gr(Er);
31982
+ return;
31983
+ }
31984
+ Ir(Er);
31965
31985
  };
31966
31986
  }
31967
31987
  owner;
@@ -39503,7 +39523,7 @@ const _hoisted_1$B = { class: "geo-dialog-header" }, _hoisted_2$j = { class: "ge
39503
39523
  console.warn("Invalid GeoJSON", er);
39504
39524
  return;
39505
39525
  }
39506
- }, cache$1 = { promise: null }, loadMapBlock = () => (cache$1.promise ??= (async () => (await import("./MapBlock-DSTG_Q0I.js")).default)(), cache$1.promise), _hoisted_1$z = { class: "async-loader-container" }, _hoisted_2$h = {
39526
+ }, cache$1 = { promise: null }, loadMapBlock = () => (cache$1.promise ??= (async () => (await import("./MapBlock-D224shNH.js")).default)(), cache$1.promise), _hoisted_1$z = { class: "async-loader-container" }, _hoisted_2$h = {
39507
39527
  key: 0,
39508
39528
  class: "async-loader-error"
39509
39529
  }, _hoisted_3$c = { class: "async-loader-error-message" }, _sfc_main$I = /* @__PURE__ */ defineComponent({
@@ -52663,7 +52683,7 @@ const IMAGE_QUALITY = 0.8, resize = async (er, nr) => {
52663
52683
  }
52664
52684
  }), UploadImageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-4dbe652c"]]), cache = { promise: null }, loadCanvas = (er) => er ? (cache.promise ??= (async () => {
52665
52685
  const { default: nr } = await import("./vue-konva-D0sZ6RWk.js");
52666
- return er.use(nr), (await import("./CanvasBlock-DTqaGXHf.js")).default;
52686
+ return er.use(nr), (await import("./CanvasBlock-p2kclNbH.js")).default;
52667
52687
  })(), cache.promise) : Promise.reject(new Error("No Vue app instance available")), _hoisted_1$5 = {
52668
52688
  key: 0,
52669
52689
  class: "canvas-disabled-overlay"
@@ -68346,7 +68366,7 @@ const ar = {
68346
68366
  },
68347
68367
  emits: ["loaded", "submit", "submitChunked"],
68348
68368
  setup(er, { emit: nr }) {
68349
- const rr = "v1.0.2", or = er, Ar = (Dr) => {
68369
+ const rr = "v1.0.3", or = er, Ar = (Dr) => {
68350
68370
  const kr = async (Lr) => {
68351
68371
  const $r = await Lr, Vr = {
68352
68372
  form: Ir,