bhl-forms 0.0.40 → 0.0.43
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/bhl-forms.es.js +57 -17
- package/dist/bhl-forms.iife.js +3 -3
- package/dist/bhl-forms.modern.es.js +58 -18
- package/dist/bhl-forms.modern.iife.js +6 -6
- package/dist/bhl-forms.modern.umd.js +6 -6
- package/dist/bhl-forms.umd.js +3 -3
- package/dist/forms/childAndFamily.es.js +79 -51
- package/dist/forms/childAndFamily.iife.js +1 -1
- package/dist/forms/childAndFamily.json +1 -1
- package/dist/forms/generalLegal.es.js +97 -74
- package/dist/forms/generalLegal.iife.js +1 -1
- package/dist/forms/generalLegal.json +1 -1
- package/dist/forms/testForm.es.js +35 -24
- package/dist/forms/testForm.iife.js +1 -1
- package/dist/forms/testForm.json +1 -1
- package/dist/main.css +1 -1
- package/package.json +2 -2
package/dist/bhl-forms.es.js
CHANGED
|
@@ -4431,6 +4431,19 @@ function usePrepop() {
|
|
|
4431
4431
|
value = urlParams2.get(node.name);
|
|
4432
4432
|
}
|
|
4433
4433
|
if (value) {
|
|
4434
|
+
if (node.props.options) {
|
|
4435
|
+
let found = false;
|
|
4436
|
+
for (var i2 = 0; i2 < node.props.options.length; i2++) {
|
|
4437
|
+
if (node.props.options[i2].value == value) {
|
|
4438
|
+
found = true;
|
|
4439
|
+
break;
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
if (!found) {
|
|
4443
|
+
console.debug("Prepop option not found for:", node.name, value);
|
|
4444
|
+
return;
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4434
4447
|
console.debug("Setting prepop value for:", node.name, value);
|
|
4435
4448
|
node.input(value);
|
|
4436
4449
|
}
|
|
@@ -5333,15 +5346,24 @@ const handleSubmitError = (err, node) => {
|
|
|
5333
5346
|
node.setErrors(err.toString());
|
|
5334
5347
|
return true;
|
|
5335
5348
|
};
|
|
5336
|
-
const
|
|
5349
|
+
const getKey = (d2, path) => {
|
|
5350
|
+
if (typeof path === "string") {
|
|
5351
|
+
path = path.split(".");
|
|
5352
|
+
}
|
|
5353
|
+
return path.reduce((x2, y) => x2[y], d2);
|
|
5354
|
+
};
|
|
5355
|
+
const keyValOverlap = (o1, o2) => {
|
|
5337
5356
|
let result = null;
|
|
5338
|
-
for (var
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5357
|
+
for (var key of Object.keys(o2)) {
|
|
5358
|
+
if (key === "*") {
|
|
5359
|
+
continue;
|
|
5360
|
+
}
|
|
5361
|
+
const o1_value = getKey(o1, key);
|
|
5362
|
+
if (!o1_value) {
|
|
5363
|
+
continue;
|
|
5364
|
+
}
|
|
5365
|
+
if (o2[key][o1_value]) {
|
|
5366
|
+
result = o2[key][o1_value];
|
|
5345
5367
|
break;
|
|
5346
5368
|
}
|
|
5347
5369
|
}
|
|
@@ -5353,12 +5375,6 @@ const keyValOverlap = (o1, o2, multiple = true) => {
|
|
|
5353
5375
|
}
|
|
5354
5376
|
return result;
|
|
5355
5377
|
};
|
|
5356
|
-
const getKey = (d2, path) => {
|
|
5357
|
-
if (typeof path === "string") {
|
|
5358
|
-
path = path.split(".");
|
|
5359
|
-
}
|
|
5360
|
-
return path.reduce((x2, y) => x2[y], d2);
|
|
5361
|
-
};
|
|
5362
5378
|
const strSubUrl = (str, obj) => str.replace(/\${(.*?)}/g, (x2, g2) => encodeURIComponent(getKey(obj, g2)));
|
|
5363
5379
|
function useSteps() {
|
|
5364
5380
|
const activeStep2 = ref("");
|
|
@@ -5369,6 +5385,19 @@ function useSteps() {
|
|
|
5369
5385
|
const lastItem = (x2) => {
|
|
5370
5386
|
return x2.value[x2.value.length - 1];
|
|
5371
5387
|
};
|
|
5388
|
+
const findFirstInput = (n2) => {
|
|
5389
|
+
for (var i2 = 0; i2 < n2.children.length; i2++) {
|
|
5390
|
+
const child = n2.children[i2];
|
|
5391
|
+
if ((child.type === "input" || child.type === "list") && !(child.context.type === "hidden")) {
|
|
5392
|
+
return child;
|
|
5393
|
+
}
|
|
5394
|
+
const res = findFirstInput(child);
|
|
5395
|
+
if (res) {
|
|
5396
|
+
return res;
|
|
5397
|
+
}
|
|
5398
|
+
}
|
|
5399
|
+
return null;
|
|
5400
|
+
};
|
|
5372
5401
|
const firstStep2 = () => {
|
|
5373
5402
|
if (stepHistory2.value.length > 0) {
|
|
5374
5403
|
return stepHistory2.value[0];
|
|
@@ -5408,9 +5437,9 @@ function useSteps() {
|
|
|
5408
5437
|
}
|
|
5409
5438
|
};
|
|
5410
5439
|
const getNextStepsFromMap = (node, nextStepMap) => {
|
|
5411
|
-
return keyValOverlap(node.value, nextStepMap
|
|
5440
|
+
return keyValOverlap(node.value, nextStepMap);
|
|
5412
5441
|
};
|
|
5413
|
-
const setStep2 = ({ nextStep = 1, validate: validate2 = true } = {}) => {
|
|
5442
|
+
const setStep2 = ({ nextStep = 1, validate: validate2 = true, autoFocus = true } = {}) => {
|
|
5414
5443
|
const node = steps2[activeStep2.value].node;
|
|
5415
5444
|
if (validate2) {
|
|
5416
5445
|
node.walk((n2) => {
|
|
@@ -5435,6 +5464,17 @@ function useSteps() {
|
|
|
5435
5464
|
} else {
|
|
5436
5465
|
throw Error("Unexpected value for nextStep: " + nextStep);
|
|
5437
5466
|
}
|
|
5467
|
+
if (autoFocus) {
|
|
5468
|
+
const newNode = steps2[activeStep2.value].node;
|
|
5469
|
+
setTimeout(function() {
|
|
5470
|
+
const firstInput = findFirstInput(newNode);
|
|
5471
|
+
if (!firstInput) {
|
|
5472
|
+
return;
|
|
5473
|
+
}
|
|
5474
|
+
const elem = document.getElementById(firstInput.context.id);
|
|
5475
|
+
elem.focus();
|
|
5476
|
+
}, 400);
|
|
5477
|
+
}
|
|
5438
5478
|
return true;
|
|
5439
5479
|
};
|
|
5440
5480
|
const setNextStep2 = (callback) => {
|
|
@@ -5539,7 +5579,7 @@ const dataDefaults = {
|
|
|
5539
5579
|
if (!node || !node.props.attrs.redirectMap) {
|
|
5540
5580
|
return;
|
|
5541
5581
|
}
|
|
5542
|
-
return keyValOverlap(formData, node.props.attrs.redirectMap
|
|
5582
|
+
return keyValOverlap(formData, node.props.attrs.redirectMap);
|
|
5543
5583
|
},
|
|
5544
5584
|
submit: (postUrl, prepData2 = null, redirectUrl = null) => (formData, node) => __async(this, null, function* () {
|
|
5545
5585
|
if (prepData2 && prepData2 != "null") {
|