jupiter-dynamic-forms 1.18.7 → 1.18.8

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
@@ -12681,7 +12681,8 @@ let JupiterDynamicForm = class extends LitElement {
12681
12681
  })) == null ? void 0 : _a.id;
12682
12682
  }
12683
12683
  async scrollToConcept(conceptName, dimensions, match) {
12684
- var _a, _b, _c, _d, _e, _f;
12684
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12685
+ console.log(`[scrollToConcept] ▶ START conceptName=${conceptName} value=${match == null ? void 0 : match.value} dims=${JSON.stringify(dimensions)}`);
12685
12686
  let targetSection = null;
12686
12687
  let targetConcept = null;
12687
12688
  const sectionsToSearch = [
@@ -12691,18 +12692,35 @@ let JupiterDynamicForm = class extends LitElement {
12691
12692
  return !((_a2 = this._currentSchema) == null ? void 0 : _a2.sections.find((cs) => cs.id === s2.id));
12692
12693
  })
12693
12694
  ];
12695
+ console.log(`[scrollToConcept] Searching ${sectionsToSearch.length} sections`);
12694
12696
  for (const section2 of sectionsToSearch) {
12695
12697
  const found = this._findConceptByName(section2.concepts, conceptName);
12696
12698
  if (found) {
12697
- targetSection = section2;
12698
- targetConcept = found;
12699
- break;
12699
+ if (dimensions == null ? void 0 : dimensions.length) {
12700
+ const cols = section2.columns ?? this._columns;
12701
+ const colId = this._findColumnByDimensions(cols, dimensions);
12702
+ console.log(`[scrollToConcept] Section "${section2.id}" has concept "${found.id}" | colMatch=${colId ?? "null"} | cols=${cols.map((c2) => c2.id).join(",")}`);
12703
+ if (colId) {
12704
+ targetSection = section2;
12705
+ targetConcept = found;
12706
+ break;
12707
+ } else if (!targetSection) {
12708
+ targetSection = section2;
12709
+ targetConcept = found;
12710
+ }
12711
+ } else {
12712
+ console.log(`[scrollToConcept] Section "${section2.id}" has concept "${found.id}" (no dims, taking first)`);
12713
+ targetSection = section2;
12714
+ targetConcept = found;
12715
+ break;
12716
+ }
12700
12717
  }
12701
12718
  }
12702
12719
  if (!targetSection || !targetConcept) {
12703
12720
  console.warn(`[scrollToConcept] Concept not found: ${conceptName}`);
12704
12721
  return;
12705
12722
  }
12723
+ console.log(`[scrollToConcept] → targetSection="${targetSection.id}" targetConceptId="${targetConcept.id}"`);
12706
12724
  targetSection.expanded = true;
12707
12725
  if (this.display === "sidePanel" && this._activeSidePanelRoleId !== targetSection.id) {
12708
12726
  this._activeSidePanelRoleId = targetSection.id;
@@ -12716,10 +12734,12 @@ let JupiterDynamicForm = class extends LitElement {
12716
12734
  } else if (!hasValueMatch) {
12717
12735
  targetColumnId = ((_b = columns[0]) == null ? void 0 : _b.id) ?? null;
12718
12736
  }
12737
+ console.log(`[scrollToConcept] targetColumnId=${targetColumnId} hasValueMatch=${hasValueMatch} targetValue=${targetValue}`);
12719
12738
  this.requestUpdate();
12720
12739
  await this.updateComplete;
12721
12740
  await new Promise((resolve) => setTimeout(resolve, 300));
12722
12741
  const sectionElements = (_c = this.shadowRoot) == null ? void 0 : _c.querySelectorAll("jupiter-form-section");
12742
+ console.log(`[scrollToConcept] DOM: found ${(sectionElements == null ? void 0 : sectionElements.length) ?? 0} jupiter-form-section elements`);
12723
12743
  let targetSectionEl = null;
12724
12744
  sectionElements == null ? void 0 : sectionElements.forEach((el) => {
12725
12745
  var _a2;
@@ -12732,8 +12752,13 @@ let JupiterDynamicForm = class extends LitElement {
12732
12752
  }
12733
12753
  await targetSectionEl.updateComplete;
12734
12754
  const conceptTrees = (_d = targetSectionEl.shadowRoot) == null ? void 0 : _d.querySelectorAll("jupiter-concept-tree");
12755
+ console.log(`[scrollToConcept] conceptTrees in targetSection: ${(conceptTrees == null ? void 0 : conceptTrees.length) ?? 0}`);
12735
12756
  let targetFieldEl = null;
12736
12757
  const conceptId = targetConcept.id;
12758
+ const conceptIdBase = conceptId.includes("__") ? conceptId.split("__")[0] : conceptId;
12759
+ console.log(`[scrollToConcept] conceptId="${conceptId}" conceptIdBase="${conceptIdBase}"`);
12760
+ const sameBaseConcept = (fieldConceptId) => fieldConceptId === conceptId || fieldConceptId.includes("__") && fieldConceptId.split("__")[0] === conceptIdBase;
12761
+ let phase1FieldCount = 0;
12737
12762
  conceptTrees == null ? void 0 : conceptTrees.forEach((ct) => {
12738
12763
  var _a2;
12739
12764
  if (targetFieldEl)
@@ -12744,31 +12769,72 @@ let JupiterDynamicForm = class extends LitElement {
12744
12769
  return;
12745
12770
  const columnMatch = targetColumnId ? fieldEl.conceptId === conceptId && fieldEl.columnId === targetColumnId : fieldEl.conceptId === conceptId;
12746
12771
  const valueMatch = !hasValueMatch || String(fieldEl.value ?? "") === targetValue;
12772
+ if (columnMatch) {
12773
+ phase1FieldCount++;
12774
+ console.log(`[scrollToConcept] Phase1 candidate: conceptId=${fieldEl.conceptId} columnId=${fieldEl.columnId} value=${fieldEl.value} valueMatch=${valueMatch}`);
12775
+ }
12747
12776
  if (columnMatch && valueMatch)
12748
12777
  targetFieldEl = fieldEl;
12749
12778
  });
12750
12779
  });
12751
- if (!targetFieldEl && hasValueMatch && !targetColumnId) {
12752
- for (const ct of Array.from(conceptTrees ?? [])) {
12780
+ console.log(`[scrollToConcept] Phase1: scanned ${phase1FieldCount} candidates, found=${!!targetFieldEl}`);
12781
+ if (!targetFieldEl && hasValueMatch) {
12782
+ console.log(`[scrollToConcept] Phase2: searching ALL sections by base concept name + value`);
12783
+ const allSectionEls = ((_e = this.shadowRoot) == null ? void 0 : _e.querySelectorAll("jupiter-form-section")) ?? [];
12784
+ for (const secEl of Array.from(allSectionEls)) {
12753
12785
  if (targetFieldEl)
12754
12786
  break;
12755
- const fields = (_e = ct.shadowRoot) == null ? void 0 : _e.querySelectorAll("jupiter-form-field");
12756
- fields == null ? void 0 : fields.forEach((fieldEl) => {
12787
+ const cts = ((_f = secEl.shadowRoot) == null ? void 0 : _f.querySelectorAll("jupiter-concept-tree")) ?? [];
12788
+ for (const ct of Array.from(cts)) {
12757
12789
  if (targetFieldEl)
12758
- return;
12759
- const columnMatch = targetColumnId ? fieldEl.conceptId === conceptId && fieldEl.columnId === targetColumnId : fieldEl.conceptId === conceptId;
12760
- if (columnMatch)
12761
- targetFieldEl = fieldEl;
12762
- });
12790
+ break;
12791
+ const fields = ((_g = ct.shadowRoot) == null ? void 0 : _g.querySelectorAll("jupiter-form-field")) ?? [];
12792
+ fields.forEach((fieldEl) => {
12793
+ if (targetFieldEl)
12794
+ return;
12795
+ const baseMatch = sameBaseConcept(fieldEl.conceptId);
12796
+ const valMatch = String(fieldEl.value ?? "") === targetValue;
12797
+ if (baseMatch) {
12798
+ console.log(`[scrollToConcept] Phase2 candidate: conceptId=${fieldEl.conceptId} value=${fieldEl.value} valMatch=${valMatch}`);
12799
+ }
12800
+ if (baseMatch && valMatch) {
12801
+ console.log(`[scrollToConcept] Phase2 ✅ MATCH: conceptId=${fieldEl.conceptId} columnId=${fieldEl.columnId} value=${fieldEl.value}`);
12802
+ targetFieldEl = fieldEl;
12803
+ }
12804
+ });
12805
+ }
12806
+ }
12807
+ }
12808
+ if (!targetFieldEl) {
12809
+ const allSectionEls = ((_h = this.shadowRoot) == null ? void 0 : _h.querySelectorAll("jupiter-form-section")) ?? [];
12810
+ for (const secEl of Array.from(allSectionEls)) {
12811
+ if (targetFieldEl)
12812
+ break;
12813
+ const cts = ((_i = secEl.shadowRoot) == null ? void 0 : _i.querySelectorAll("jupiter-concept-tree")) ?? [];
12814
+ for (const ct of Array.from(cts)) {
12815
+ if (targetFieldEl)
12816
+ break;
12817
+ const fields = ((_j = ct.shadowRoot) == null ? void 0 : _j.querySelectorAll("jupiter-form-field")) ?? [];
12818
+ fields.forEach((fieldEl) => {
12819
+ if (targetFieldEl)
12820
+ return;
12821
+ const columnMatch = targetColumnId ? sameBaseConcept(fieldEl.conceptId) && fieldEl.columnId === targetColumnId : sameBaseConcept(fieldEl.conceptId);
12822
+ if (columnMatch) {
12823
+ console.log(`[scrollToConcept] Phase3 ✅ fallback: conceptId=${fieldEl.conceptId} columnId=${fieldEl.columnId} value=${fieldEl.value}`);
12824
+ targetFieldEl = fieldEl;
12825
+ }
12826
+ });
12827
+ }
12763
12828
  }
12764
12829
  }
12765
12830
  if (!targetFieldEl) {
12766
12831
  console.warn(`[scrollToConcept] Field element not found for concept: ${conceptName}`);
12767
12832
  return;
12768
12833
  }
12834
+ console.log(`[scrollToConcept] ✅ HIGHLIGHTING conceptId=${targetFieldEl.conceptId} columnId=${targetFieldEl.columnId} value=${targetFieldEl.value}`);
12769
12835
  targetFieldEl.scrollIntoView({ behavior: "smooth", block: "center" });
12770
12836
  targetFieldEl.classList.add("concept-highlight");
12771
- const focusTarget = (_f = targetFieldEl.shadowRoot) == null ? void 0 : _f.querySelector(
12837
+ const focusTarget = (_k = targetFieldEl.shadowRoot) == null ? void 0 : _k.querySelector(
12772
12838
  'input:not([type="hidden"]), select, textarea, button, [tabindex]:not([tabindex="-1"])'
12773
12839
  );
12774
12840
  focusTarget == null ? void 0 : focusTarget.focus({ preventScroll: true });