bhl-forms 0.0.41 → 0.0.42
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 +44 -17
- package/dist/bhl-forms.iife.js +3 -3
- package/dist/bhl-forms.modern.es.js +45 -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 +9 -7
- package/dist/forms/childAndFamily.iife.js +1 -1
- package/dist/forms/childAndFamily.json +1 -1
- package/dist/forms/generalLegal.es.js +33 -31
- package/dist/forms/generalLegal.iife.js +1 -1
- package/dist/forms/generalLegal.json +1 -1
- package/dist/forms/testForm.es.js +1 -1
- package/dist/main.css +1 -1
- package/package.json +2 -2
package/dist/bhl-forms.es.js
CHANGED
|
@@ -5333,15 +5333,24 @@ const handleSubmitError = (err, node) => {
|
|
|
5333
5333
|
node.setErrors(err.toString());
|
|
5334
5334
|
return true;
|
|
5335
5335
|
};
|
|
5336
|
-
const
|
|
5336
|
+
const getKey = (d2, path) => {
|
|
5337
|
+
if (typeof path === "string") {
|
|
5338
|
+
path = path.split(".");
|
|
5339
|
+
}
|
|
5340
|
+
return path.reduce((x2, y) => x2[y], d2);
|
|
5341
|
+
};
|
|
5342
|
+
const keyValOverlap = (o1, o2) => {
|
|
5337
5343
|
let result = null;
|
|
5338
|
-
for (var
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5344
|
+
for (var key of Object.keys(o2)) {
|
|
5345
|
+
if (key === "*") {
|
|
5346
|
+
continue;
|
|
5347
|
+
}
|
|
5348
|
+
const o1_value = getKey(o1, key);
|
|
5349
|
+
if (!o1_value) {
|
|
5350
|
+
continue;
|
|
5351
|
+
}
|
|
5352
|
+
if (o2[key][o1_value]) {
|
|
5353
|
+
result = o2[key][o1_value];
|
|
5345
5354
|
break;
|
|
5346
5355
|
}
|
|
5347
5356
|
}
|
|
@@ -5353,12 +5362,6 @@ const keyValOverlap = (o1, o2, multiple = true) => {
|
|
|
5353
5362
|
}
|
|
5354
5363
|
return result;
|
|
5355
5364
|
};
|
|
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
5365
|
const strSubUrl = (str, obj) => str.replace(/\${(.*?)}/g, (x2, g2) => encodeURIComponent(getKey(obj, g2)));
|
|
5363
5366
|
function useSteps() {
|
|
5364
5367
|
const activeStep2 = ref("");
|
|
@@ -5369,6 +5372,19 @@ function useSteps() {
|
|
|
5369
5372
|
const lastItem = (x2) => {
|
|
5370
5373
|
return x2.value[x2.value.length - 1];
|
|
5371
5374
|
};
|
|
5375
|
+
const findFirstInput = (n2) => {
|
|
5376
|
+
for (var i2 = 0; i2 < n2.children.length; i2++) {
|
|
5377
|
+
const child = n2.children[i2];
|
|
5378
|
+
if ((child.type === "input" || child.type === "list") && !(child.context.type === "hidden")) {
|
|
5379
|
+
return child;
|
|
5380
|
+
}
|
|
5381
|
+
const res = findFirstInput(child);
|
|
5382
|
+
if (res) {
|
|
5383
|
+
return res;
|
|
5384
|
+
}
|
|
5385
|
+
}
|
|
5386
|
+
return null;
|
|
5387
|
+
};
|
|
5372
5388
|
const firstStep2 = () => {
|
|
5373
5389
|
if (stepHistory2.value.length > 0) {
|
|
5374
5390
|
return stepHistory2.value[0];
|
|
@@ -5408,9 +5424,9 @@ function useSteps() {
|
|
|
5408
5424
|
}
|
|
5409
5425
|
};
|
|
5410
5426
|
const getNextStepsFromMap = (node, nextStepMap) => {
|
|
5411
|
-
return keyValOverlap(node.value, nextStepMap
|
|
5427
|
+
return keyValOverlap(node.value, nextStepMap);
|
|
5412
5428
|
};
|
|
5413
|
-
const setStep2 = ({ nextStep = 1, validate: validate2 = true } = {}) => {
|
|
5429
|
+
const setStep2 = ({ nextStep = 1, validate: validate2 = true, autoFocus = true } = {}) => {
|
|
5414
5430
|
const node = steps2[activeStep2.value].node;
|
|
5415
5431
|
if (validate2) {
|
|
5416
5432
|
node.walk((n2) => {
|
|
@@ -5435,6 +5451,17 @@ function useSteps() {
|
|
|
5435
5451
|
} else {
|
|
5436
5452
|
throw Error("Unexpected value for nextStep: " + nextStep);
|
|
5437
5453
|
}
|
|
5454
|
+
if (autoFocus) {
|
|
5455
|
+
const newNode = steps2[activeStep2.value].node;
|
|
5456
|
+
setTimeout(function() {
|
|
5457
|
+
const firstInput = findFirstInput(newNode);
|
|
5458
|
+
if (!firstInput) {
|
|
5459
|
+
return;
|
|
5460
|
+
}
|
|
5461
|
+
const elem = document.getElementById(firstInput.context.id);
|
|
5462
|
+
elem.focus();
|
|
5463
|
+
}, 300);
|
|
5464
|
+
}
|
|
5438
5465
|
return true;
|
|
5439
5466
|
};
|
|
5440
5467
|
const setNextStep2 = (callback) => {
|
|
@@ -5539,7 +5566,7 @@ const dataDefaults = {
|
|
|
5539
5566
|
if (!node || !node.props.attrs.redirectMap) {
|
|
5540
5567
|
return;
|
|
5541
5568
|
}
|
|
5542
|
-
return keyValOverlap(formData, node.props.attrs.redirectMap
|
|
5569
|
+
return keyValOverlap(formData, node.props.attrs.redirectMap);
|
|
5543
5570
|
},
|
|
5544
5571
|
submit: (postUrl, prepData2 = null, redirectUrl = null) => (formData, node) => __async(this, null, function* () {
|
|
5545
5572
|
if (prepData2 && prepData2 != "null") {
|