bhl-forms 0.0.45 → 0.0.48

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.
@@ -11184,18 +11184,31 @@ function prepData(formData) {
11184
11184
  };
11185
11185
  return data;
11186
11186
  }
11187
- const isMobile = window.matchMedia("only screen and (max-width: 480px)").matches;
11188
- const fireStepEvent = (formNode) => (stepResult, stepHistory2, stepQueue2) => {
11189
- if (!stepResult) {
11190
- return;
11191
- }
11187
+ window.matchMedia("only screen and (max-width: 480px)").matches;
11188
+ function getCoords(elem) {
11189
+ let box2 = elem.getBoundingClientRect();
11190
+ return {
11191
+ top: box2.top + window.pageYOffset,
11192
+ right: box2.right + window.pageXOffset,
11193
+ bottom: box2.bottom + window.pageYOffset,
11194
+ left: box2.left + window.pageXOffset
11195
+ };
11196
+ }
11197
+ const scrollAnchor = (formNode) => () => {
11192
11198
  const anchorId = formNode.attrs.anchorElement || formNode.id;
11193
- if (anchorId && isMobile) {
11199
+ if (anchorId) {
11194
11200
  const anchor = document.getElementById(anchorId);
11195
11201
  if (anchor) {
11196
- anchor.scrollIntoView(true);
11202
+ const pos = getCoords(anchor);
11203
+ window.scrollTo(pos.right, pos.top);
11197
11204
  }
11198
11205
  }
11206
+ };
11207
+ const fireStepEvent = (formNode) => (stepResult, stepHistory2, stepQueue2) => {
11208
+ if (!stepResult) {
11209
+ return;
11210
+ }
11211
+ scrollAnchor(formNode)();
11199
11212
  var step_values = null;
11200
11213
  if (stepHistory2.value.length > 0) {
11201
11214
  step_values = flattenObj(formNode.value[stepHistory2.value[stepHistory2.value.length - 1]] || {});
@@ -11304,6 +11317,21 @@ var theme = {
11304
11317
  week: textClassification
11305
11318
  };
11306
11319
  var index = "";
11320
+ if (!Object.fromEntries) {
11321
+ Object.defineProperty(Object, "fromEntries", {
11322
+ value(entries) {
11323
+ if (!entries || !entries[Symbol.iterator]) {
11324
+ throw new Error("Object.fromEntries() requires a single iterable argument");
11325
+ }
11326
+ const o2 = {};
11327
+ Object.keys(entries).forEach((key) => {
11328
+ const [k2, v] = entries[key];
11329
+ o2[k2] = v;
11330
+ });
11331
+ return o2;
11332
+ }
11333
+ });
11334
+ }
11307
11335
  function toInteger(dirtyNumber) {
11308
11336
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
11309
11337
  return NaN;
@@ -15593,6 +15621,12 @@ const init = () => {
15593
15621
  data.submitUrl = data.submitUrl || defaultSubmitUrl;
15594
15622
  data.prepData = data.prepData || prepData;
15595
15623
  data.fireStepEvent = data.fireStepEvent || fireStepEvent;
15624
+ data.scrollAnchor = data.scrollAnchor || scrollAnchor;
15625
+ data.onEnter = (callback) => (e2) => {
15626
+ if (e2.key === "Enter" || e2.keyCode === 13) {
15627
+ callback();
15628
+ }
15629
+ };
15596
15630
  const app = createApp(_sfc_main$1, { schema: schemaObj, data }).use(plugin$1, defaultConfig({
15597
15631
  inputs: {
15598
15632
  DatePicker: createInput(_sfc_main)