jupiter-dynamic-forms 1.19.2 → 1.19.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.
package/dist/index.mjs CHANGED
@@ -12786,7 +12786,7 @@ let JupiterDynamicForm = class extends LitElement {
12786
12786
  })) == null ? void 0 : _a.id;
12787
12787
  }
12788
12788
  async scrollToConcept(conceptName, dimensions, match) {
12789
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12789
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
12790
12790
  console.log(`[scrollToConcept] ▶ START conceptName=${conceptName} value=${match == null ? void 0 : match.value} dims=${JSON.stringify(dimensions)}`);
12791
12791
  let targetSection = null;
12792
12792
  let targetConcept = null;
@@ -12960,12 +12960,36 @@ let JupiterDynamicForm = class extends LitElement {
12960
12960
  return;
12961
12961
  }
12962
12962
  console.log(`[scrollToConcept] ✅ HIGHLIGHTING conceptId=${targetFieldEl.conceptId} columnId=${targetFieldEl.columnId} value=${targetFieldEl.value}`);
12963
- targetFieldEl.scrollIntoView({ behavior: "smooth", block: "center" });
12963
+ const fieldRect = targetFieldEl.getBoundingClientRect();
12964
+ const root = this.shadowRoot;
12965
+ const potentialContainer = root ? root.querySelector(".side-panel-content") ?? root.querySelector(".form-container") : null;
12966
+ const scrollContainer = potentialContainer && potentialContainer.scrollHeight > potentialContainer.clientHeight ? potentialContainer : null;
12967
+ if (scrollContainer) {
12968
+ const containerRect = scrollContainer.getBoundingClientRect();
12969
+ const targetScrollTop = Math.max(
12970
+ 0,
12971
+ fieldRect.top - containerRect.top + scrollContainer.scrollTop - scrollContainer.clientHeight / 2 + fieldRect.height / 2
12972
+ );
12973
+ scrollContainer.scrollTo({ top: targetScrollTop, behavior: "smooth" });
12974
+ } else {
12975
+ targetFieldEl.scrollIntoView({ behavior: "smooth", block: "center" });
12976
+ }
12977
+ const tableContainer = (_k = targetSectionEl == null ? void 0 : targetSectionEl.shadowRoot) == null ? void 0 : _k.querySelector(".table-container");
12978
+ if (tableContainer && tableContainer.scrollWidth > tableContainer.clientWidth) {
12979
+ const tableRect = tableContainer.getBoundingClientRect();
12980
+ const targetScrollLeft = Math.max(
12981
+ 0,
12982
+ fieldRect.left - tableRect.left + tableContainer.scrollLeft - tableContainer.clientWidth / 2 + fieldRect.width / 2
12983
+ );
12984
+ tableContainer.scrollTo({ left: targetScrollLeft, behavior: "smooth" });
12985
+ }
12964
12986
  targetFieldEl.classList.add("concept-highlight");
12965
- const focusTarget = (_k = targetFieldEl.shadowRoot) == null ? void 0 : _k.querySelector(
12987
+ const focusTarget = (_l = targetFieldEl.shadowRoot) == null ? void 0 : _l.querySelector(
12966
12988
  'input:not([type="hidden"]), select, textarea, button, [tabindex]:not([tabindex="-1"])'
12967
12989
  );
12968
- focusTarget == null ? void 0 : focusTarget.focus({ preventScroll: true });
12990
+ if (focusTarget) {
12991
+ setTimeout(() => focusTarget.focus({ preventScroll: true }), 450);
12992
+ }
12969
12993
  setTimeout(() => targetFieldEl.classList.remove("concept-highlight"), 5e3);
12970
12994
  }
12971
12995
  render() {