@primmel/primmel 1.4.0 → 1.4.1

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.
@@ -1346,6 +1346,7 @@ function parseFormField(name, block, type) {
1346
1346
  enumRef: "",
1347
1347
  pattern: "",
1348
1348
  required: false,
1349
+ requiredWhen: "",
1349
1350
  measurementMethod: "",
1350
1351
  calculationId: null,
1351
1352
  calculationBindings: [],
@@ -1407,6 +1408,10 @@ function parseFormField(name, block, type) {
1407
1408
  field.bind = stripWrapping(t[i++]);
1408
1409
  } else if (cmd === "required") {
1409
1410
  field.required = stripWrapping(t[i++]) === "true";
1411
+ } else if (cmd === "required_when") {
1412
+ const read = readValueToken(t, i);
1413
+ field.requiredWhen = stripWrapping(read.text);
1414
+ i = read.next;
1410
1415
  } else if (cmd === "measurement_method") {
1411
1416
  field.measurementMethod = stripWrapping(t[i++]);
1412
1417
  } else if (cmd === "calculation") {
@@ -1721,6 +1726,9 @@ function dumpFormField(field, indent) {
1721
1726
  if (field.required) {
1722
1727
  inner.push("required true");
1723
1728
  }
1729
+ if (field.requiredWhen) {
1730
+ inner.push("required_when " + dumpBareSafe(field.requiredWhen));
1731
+ }
1724
1732
  if (field.measurementMethod) {
1725
1733
  inner.push("measurement_method " + field.measurementMethod);
1726
1734
  }
@@ -4326,6 +4334,7 @@ function makeSubformRefField(subformId, block) {
4326
4334
  enumRef: "",
4327
4335
  pattern: "",
4328
4336
  required: false,
4337
+ requiredWhen: "",
4329
4338
  measurementMethod: "",
4330
4339
  calculationId: null,
4331
4340
  calculationBindings: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primmel/primmel",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Primmel — parser, types, and serializer for the Primmel modelling language (successor to MMEL)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",