jupiter-dynamic-forms 1.18.7 → 1.18.9

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
@@ -3242,7 +3242,7 @@ let JupiterFormField = class extends LitElement {
3242
3242
  }
3243
3243
  if (this._isPercentItemType() && this.value !== null && this.value !== void 0) {
3244
3244
  const numVal = Number(this.value);
3245
- if (!isNaN(numVal) && Math.abs(numVal) >= 1) {
3245
+ if (!isNaN(numVal) && Math.abs(numVal) > 1) {
3246
3246
  this.value = numVal / 100;
3247
3247
  const oldValue = numVal;
3248
3248
  this.dispatchEvent(new CustomEvent("field-change", {
@@ -3892,6 +3892,7 @@ let JupiterFormField = class extends LitElement {
3892
3892
  <path fill="currentColor" d="M19 4h-1V2h-2v2H8V2H6v2H5
3893
3893
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
3894
3894
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
3895
+ </svg>
3895
3896
  </div>
3896
3897
  </div>
3897
3898
  `;
@@ -3899,17 +3900,18 @@ let JupiterFormField = class extends LitElement {
3899
3900
  return html`
3900
3901
  <div class="period-controls">
3901
3902
  <label>From:</label>
3902
- <div class="date-wrapper">
3903
- <input
3904
- type="date"
3905
- .value="${this.periodStartDate || this.field.periodStartDate || ""}"
3906
- @change="${(e2) => this._handlePeriodChange(e2, "start")}"
3907
- ?disabled="${this.disabled}"
3908
- />
3909
- <svg class="calendar-icon-svg" viewBox="0 0 24 24">
3903
+ <div class="date-wrapper">
3904
+ <input
3905
+ type="date"
3906
+ .value="${this.periodStartDate || this.field.periodStartDate || ""}"
3907
+ @change="${(e2) => this._handlePeriodChange(e2, "start")}"
3908
+ ?disabled="${this.disabled}"
3909
+ />
3910
+ <svg class="calendar-icon-svg" viewBox="0 0 24 24">
3910
3911
  <path fill="currentColor" d="M19 4h-1V2h-2v2H8V2H6v2H5
3911
3912
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
3912
3913
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
3914
+ </svg>
3913
3915
  </div>
3914
3916
  <label>To:</label>
3915
3917
  <div class="date-wrapper">
@@ -3923,6 +3925,7 @@ let JupiterFormField = class extends LitElement {
3923
3925
  <path fill="currentColor" d="M19 4h-1V2h-2v2H8V2H6v2H5
3924
3926
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
3925
3927
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
3928
+ </svg>
3926
3929
  </div>
3927
3930
  </div>
3928
3931
  `;
@@ -3955,6 +3958,7 @@ let JupiterFormField = class extends LitElement {
3955
3958
  <path fill="currentColor" d="M19 4h-1V2h-2v2H8V2H6v2H5
3956
3959
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
3957
3960
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
3961
+ </svg>
3958
3962
  </div>
3959
3963
  </div>
3960
3964
  ` : html`
@@ -3967,12 +3971,13 @@ let JupiterFormField = class extends LitElement {
3967
3971
  @change="${(e2) => this._handlePeriodChange(e2, "start")}"
3968
3972
  ?disabled="${this.disabled}"
3969
3973
  />
3970
- <svg class="calendar-icon-svg" viewBox="0 0 24 24">
3974
+ <svg class="calendar-icon-svg" viewBox="0 0 24 24">
3971
3975
  <path
3972
3976
  fill="currentColor"
3973
3977
  d="M19 4h-1V2h-2v2H8V2H6v2H5
3974
3978
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
3975
3979
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
3980
+ </svg>
3976
3981
  </div>
3977
3982
  </div>
3978
3983
  <div class="period-controls">
@@ -3988,6 +3993,7 @@ let JupiterFormField = class extends LitElement {
3988
3993
  <path fill="currentColor" d="M19 4h-1V2h-2v2H8V2H6v2H5
3989
3994
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
3990
3995
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
3996
+ </svg>
3991
3997
  </div>
3992
3998
  </div>
3993
3999
  `}
@@ -4011,7 +4017,7 @@ let JupiterFormField = class extends LitElement {
4011
4017
  </div>
4012
4018
  ` : ""}
4013
4019
 
4014
- ${this._isMonetaryType() || this._isPercentItemType() ? html`
4020
+ ${this._isMonetaryType() ? html`
4015
4021
  <div class="period-controls">
4016
4022
  <label>${I18n.t("field.scale")}:</label>
4017
4023
  <input
@@ -4019,7 +4025,7 @@ let JupiterFormField = class extends LitElement {
4019
4025
  min="0"
4020
4026
  class="typed-member-input"
4021
4027
  placeholder="Leave blank for INF"
4022
- .value="${this.decimals !== void 0 && this.decimals !== null && this.decimals !== "" ? this.decimals : this._isPercentItemType() ? "4" : this.globalDecimals !== "INF" ? this.globalDecimals : ""}"
4028
+ .value="${this.decimals !== void 0 && this.decimals !== null && this.decimals !== "" ? this.decimals : this.globalDecimals !== "INF" ? this.globalDecimals : ""}"
4023
4029
  @input="${this._handleDecimalsChange}"
4024
4030
  ?disabled="${this.disabled}"
4025
4031
  />
@@ -4298,20 +4304,26 @@ JupiterFormField.styles = css`
4298
4304
  width: min-content;
4299
4305
  }
4300
4306
 
4301
- /* hide native icon */
4307
+ .date-wrapper input[type="date"] {
4308
+ appearance: none;
4309
+ -webkit-appearance: none;
4310
+ padding-right: 34px;
4311
+ }
4312
+
4313
+ /* Chrome/Edge/Safari: hide the native calendar picker indicator and use custom SVG */
4302
4314
  input[type="date"]::-webkit-calendar-picker-indicator {
4303
4315
  opacity: 0;
4304
4316
  position: absolute;
4305
- right: 10px;
4306
- width: 20px;
4307
- height: 20px;
4317
+ right: 0;
4318
+ width: 34px;
4319
+ height: 100%;
4308
4320
  cursor: pointer;
4309
4321
  }
4310
4322
 
4311
- .calendar-icon-svg {
4323
+ .calendar-icon-svg {
4312
4324
  position: absolute;
4313
- right: 3px;
4314
- top: 18px;
4325
+ right: 8px;
4326
+ top: 50%;
4315
4327
  transform: translateY(-50%);
4316
4328
  width: 20px;
4317
4329
  height: 20px;
@@ -4319,6 +4331,17 @@ JupiterFormField.styles = css`
4319
4331
  pointer-events: none;
4320
4332
  }
4321
4333
 
4334
+ /* Firefox: cannot hide native calendar icon via pseudo-element;
4335
+ hide our custom SVG so only the native icon shows (no duplication) */
4336
+ @supports (-moz-appearance: none) {
4337
+ .calendar-icon-svg {
4338
+ display: none;
4339
+ }
4340
+ .date-wrapper input[type="date"] {
4341
+ padding-right: 10px;
4342
+ }
4343
+ }
4344
+
4322
4345
  .period-popup-content .period-controls input[type="date"] {
4323
4346
  padding: 8px 10px;
4324
4347
  font-size: 14px;
@@ -5434,6 +5457,7 @@ let JupiterAddColumnDialog = class extends LitElement {
5434
5457
  <path fill="currentColor" d="M19 4h-1V2h-2v2H8V2H6v2H5
5435
5458
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
5436
5459
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
5460
+ </svg>
5437
5461
  </div>
5438
5462
  </div>
5439
5463
  ` : html`
@@ -5452,6 +5476,7 @@ let JupiterAddColumnDialog = class extends LitElement {
5452
5476
  <path fill="currentColor" d="M19 4h-1V2h-2v2H8V2H6v2H5
5453
5477
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
5454
5478
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
5479
+ </svg>
5455
5480
  </div>
5456
5481
  </div>
5457
5482
  <div class="date-field">
@@ -5468,6 +5493,7 @@ let JupiterAddColumnDialog = class extends LitElement {
5468
5493
  <path fill="currentColor" d="M19 4h-1V2h-2v2H8V2H6v2H5
5469
5494
  a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
5470
5495
  a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
5496
+ </svg>
5471
5497
  </div>
5472
5498
  </div>
5473
5499
  </div>
@@ -5633,20 +5659,26 @@ JupiterAddColumnDialog.styles = css`
5633
5659
  width: min-content;
5634
5660
  }
5635
5661
 
5636
- /* hide native icon */
5662
+ .date-wrapper input[type="date"] {
5663
+ appearance: none;
5664
+ -webkit-appearance: none;
5665
+ padding-right: 34px;
5666
+ }
5667
+
5668
+ /* Chrome/Edge/Safari: hide the native calendar picker indicator and use custom SVG */
5637
5669
  input[type="date"]::-webkit-calendar-picker-indicator {
5638
5670
  opacity: 0;
5639
5671
  position: absolute;
5640
- right: 10px;
5641
- width: 20px;
5642
- height: 20px;
5672
+ right: 0;
5673
+ width: 34px;
5674
+ height: 100%;
5643
5675
  cursor: pointer;
5644
5676
  }
5645
-
5646
- .calendar-icon-svg {
5677
+
5678
+ .calendar-icon-svg {
5647
5679
  position: absolute;
5648
- right: 3px;
5649
- top: 18px;
5680
+ right: 8px;
5681
+ top: 50%;
5650
5682
  transform: translateY(-50%);
5651
5683
  width: 20px;
5652
5684
  height: 20px;
@@ -5654,6 +5686,17 @@ JupiterAddColumnDialog.styles = css`
5654
5686
  pointer-events: none;
5655
5687
  }
5656
5688
 
5689
+ /* Firefox: cannot hide native calendar icon via pseudo-element;
5690
+ hide our custom SVG so only the native icon shows (no duplication) */
5691
+ @supports (-moz-appearance: none) {
5692
+ .calendar-icon-svg {
5693
+ display: none;
5694
+ }
5695
+ .date-wrapper input[type="date"] {
5696
+ padding-right: 10px;
5697
+ }
5698
+ }
5699
+
5657
5700
  .form-group {
5658
5701
  margin-bottom: 16px;
5659
5702
  }
@@ -11306,7 +11349,7 @@ let JupiterDynamicForm = class extends LitElement {
11306
11349
  return null;
11307
11350
  }
11308
11351
  _addConceptDataToSubmission(concept, columnId, value, submissionData, section2) {
11309
- var _a, _b, _c, _d, _e, _f, _g;
11352
+ var _a, _b, _c, _d, _e, _f;
11310
11353
  const field2 = concept.fields.find((f2) => f2.columnId === columnId);
11311
11354
  if (!field2)
11312
11355
  return;
@@ -11341,15 +11384,13 @@ let JupiterDynamicForm = class extends LitElement {
11341
11384
  console.log(`✅ [Submission] Adding unit to entry: ${fieldUnit} for ${concept.id}/${columnId}`);
11342
11385
  }
11343
11386
  const isMonetary = (_d = concept.type) == null ? void 0 : _d.toLowerCase().includes("monetary");
11344
- const isPercent = (_e = concept.type) == null ? void 0 : _e.toLowerCase().includes("percentitemtype");
11345
- const fieldDecimals = (_f = this._decimalsData[concept.id]) == null ? void 0 : _f[columnId];
11346
- const globalFallback = isPercent ? "4" : this.decimals !== "INF" ? this.decimals : void 0;
11347
- const decimalsValue = fieldDecimals || globalFallback;
11348
- if ((isMonetary || isPercent) && decimalsValue) {
11387
+ const fieldDecimals = (_e = this._decimalsData[concept.id]) == null ? void 0 : _e[columnId];
11388
+ const decimalsValue = fieldDecimals || (this.decimals !== "INF" ? this.decimals : void 0);
11389
+ if (isMonetary && decimalsValue) {
11349
11390
  const parsed = parseFloat(decimalsValue);
11350
11391
  entry.decimals = isNaN(parsed) ? decimalsValue : String(-Math.abs(parsed));
11351
11392
  }
11352
- if ((_g = column2 == null ? void 0 : column2.dimensionData) == null ? void 0 : _g.memberLabel) {
11393
+ if ((_f = column2 == null ? void 0 : column2.dimensionData) == null ? void 0 : _f.memberLabel) {
11353
11394
  entry.dimension = column2.dimensionData.memberLabel;
11354
11395
  }
11355
11396
  console.log(`📤 [Submission Entry] Created entry:`, JSON.stringify(entry, null, 2));
@@ -11487,7 +11528,7 @@ let JupiterDynamicForm = class extends LitElement {
11487
11528
  }
11488
11529
  if (concept.fields && concept.fields.length > 0) {
11489
11530
  concept.fields.forEach((field2) => {
11490
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11531
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
11491
11532
  const conceptData = this._formData[concept.id];
11492
11533
  let fieldValue = conceptData == null ? void 0 : conceptData[field2.columnId];
11493
11534
  const baseConceptId = field2.conceptId || concept.id.split("__").slice(0, -1).join("__") || concept.id;
@@ -11542,15 +11583,13 @@ let JupiterDynamicForm = class extends LitElement {
11542
11583
  console.log(`⚠️ [Submission] No unit found in _unitData for ${concept.id}/${field2.columnId}. _unitData state:`, JSON.stringify(this._unitData, null, 2));
11543
11584
  }
11544
11585
  const isMonetary = (_e = concept.type) == null ? void 0 : _e.toLowerCase().includes("monetary");
11545
- const isPercent = (_f = concept.type) == null ? void 0 : _f.toLowerCase().includes("percentitemtype");
11546
- const fieldDecimals = (_g = this._decimalsData[concept.id]) == null ? void 0 : _g[field2.columnId];
11547
- const globalFallback = isPercent ? "4" : this.decimals !== "INF" ? this.decimals : void 0;
11548
- const decimalsValue = fieldDecimals || globalFallback;
11549
- if ((isMonetary || isPercent) && decimalsValue) {
11586
+ const fieldDecimals = (_f = this._decimalsData[concept.id]) == null ? void 0 : _f[field2.columnId];
11587
+ const decimalsValue = fieldDecimals || (this.decimals !== "INF" ? this.decimals : void 0);
11588
+ if (isMonetary && decimalsValue) {
11550
11589
  const parsed = parseFloat(decimalsValue);
11551
11590
  submissionEntry.decimals = isNaN(parsed) ? decimalsValue : String(-Math.abs(parsed));
11552
11591
  }
11553
- if ((column2 == null ? void 0 : column2.type) === "dimension" && ((_h = column2.dimensionData) == null ? void 0 : _h.dimensionIdKey)) {
11592
+ if ((column2 == null ? void 0 : column2.type) === "dimension" && ((_g = column2.dimensionData) == null ? void 0 : _g.dimensionIdKey)) {
11554
11593
  submissionEntry.dimension = column2.dimensionData.dimensionIdKey;
11555
11594
  console.log(`🔍 [DynamicForm] Using dimension key from field's column (${field2.columnId}):`, column2.dimensionData.dimensionIdKey);
11556
11595
  } else {
@@ -11586,12 +11625,12 @@ let JupiterDynamicForm = class extends LitElement {
11586
11625
  console.log(`🔍 [DynamicForm] Column details:`, {
11587
11626
  id: column2.id,
11588
11627
  type: column2.type,
11589
- hasTypedMembers: (_i = column2.dimensionData) == null ? void 0 : _i.hasTypedMembers,
11628
+ hasTypedMembers: (_h = column2.dimensionData) == null ? void 0 : _h.hasTypedMembers,
11590
11629
  dimensionData: column2.dimensionData
11591
11630
  });
11592
11631
  }
11593
11632
  }
11594
- if (!submissionEntry.typedMembers && ((_j = field2.crossRoleTypedMembers) == null ? void 0 : _j.length)) {
11633
+ if (!submissionEntry.typedMembers && ((_i = field2.crossRoleTypedMembers) == null ? void 0 : _i.length)) {
11595
11634
  const crossRoleKey = `${concept.id}__${field2.columnId}`;
11596
11635
  const crossRoleValues = this._typedMemberData[crossRoleKey];
11597
11636
  if (crossRoleValues) {
@@ -12681,7 +12720,8 @@ let JupiterDynamicForm = class extends LitElement {
12681
12720
  })) == null ? void 0 : _a.id;
12682
12721
  }
12683
12722
  async scrollToConcept(conceptName, dimensions, match) {
12684
- var _a, _b, _c, _d, _e, _f;
12723
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12724
+ console.log(`[scrollToConcept] ▶ START conceptName=${conceptName} value=${match == null ? void 0 : match.value} dims=${JSON.stringify(dimensions)}`);
12685
12725
  let targetSection = null;
12686
12726
  let targetConcept = null;
12687
12727
  const sectionsToSearch = [
@@ -12691,18 +12731,35 @@ let JupiterDynamicForm = class extends LitElement {
12691
12731
  return !((_a2 = this._currentSchema) == null ? void 0 : _a2.sections.find((cs) => cs.id === s2.id));
12692
12732
  })
12693
12733
  ];
12734
+ console.log(`[scrollToConcept] Searching ${sectionsToSearch.length} sections`);
12694
12735
  for (const section2 of sectionsToSearch) {
12695
12736
  const found = this._findConceptByName(section2.concepts, conceptName);
12696
12737
  if (found) {
12697
- targetSection = section2;
12698
- targetConcept = found;
12699
- break;
12738
+ if (dimensions == null ? void 0 : dimensions.length) {
12739
+ const cols = section2.columns ?? this._columns;
12740
+ const colId = this._findColumnByDimensions(cols, dimensions);
12741
+ console.log(`[scrollToConcept] Section "${section2.id}" has concept "${found.id}" | colMatch=${colId ?? "null"} | cols=${cols.map((c2) => c2.id).join(",")}`);
12742
+ if (colId) {
12743
+ targetSection = section2;
12744
+ targetConcept = found;
12745
+ break;
12746
+ } else if (!targetSection) {
12747
+ targetSection = section2;
12748
+ targetConcept = found;
12749
+ }
12750
+ } else {
12751
+ console.log(`[scrollToConcept] Section "${section2.id}" has concept "${found.id}" (no dims, taking first)`);
12752
+ targetSection = section2;
12753
+ targetConcept = found;
12754
+ break;
12755
+ }
12700
12756
  }
12701
12757
  }
12702
12758
  if (!targetSection || !targetConcept) {
12703
12759
  console.warn(`[scrollToConcept] Concept not found: ${conceptName}`);
12704
12760
  return;
12705
12761
  }
12762
+ console.log(`[scrollToConcept] → targetSection="${targetSection.id}" targetConceptId="${targetConcept.id}"`);
12706
12763
  targetSection.expanded = true;
12707
12764
  if (this.display === "sidePanel" && this._activeSidePanelRoleId !== targetSection.id) {
12708
12765
  this._activeSidePanelRoleId = targetSection.id;
@@ -12716,10 +12773,12 @@ let JupiterDynamicForm = class extends LitElement {
12716
12773
  } else if (!hasValueMatch) {
12717
12774
  targetColumnId = ((_b = columns[0]) == null ? void 0 : _b.id) ?? null;
12718
12775
  }
12776
+ console.log(`[scrollToConcept] targetColumnId=${targetColumnId} hasValueMatch=${hasValueMatch} targetValue=${targetValue}`);
12719
12777
  this.requestUpdate();
12720
12778
  await this.updateComplete;
12721
12779
  await new Promise((resolve) => setTimeout(resolve, 300));
12722
12780
  const sectionElements = (_c = this.shadowRoot) == null ? void 0 : _c.querySelectorAll("jupiter-form-section");
12781
+ console.log(`[scrollToConcept] DOM: found ${(sectionElements == null ? void 0 : sectionElements.length) ?? 0} jupiter-form-section elements`);
12723
12782
  let targetSectionEl = null;
12724
12783
  sectionElements == null ? void 0 : sectionElements.forEach((el) => {
12725
12784
  var _a2;
@@ -12732,8 +12791,36 @@ let JupiterDynamicForm = class extends LitElement {
12732
12791
  }
12733
12792
  await targetSectionEl.updateComplete;
12734
12793
  const conceptTrees = (_d = targetSectionEl.shadowRoot) == null ? void 0 : _d.querySelectorAll("jupiter-concept-tree");
12794
+ console.log(`[scrollToConcept] conceptTrees in targetSection: ${(conceptTrees == null ? void 0 : conceptTrees.length) ?? 0}`);
12735
12795
  let targetFieldEl = null;
12736
12796
  const conceptId = targetConcept.id;
12797
+ const conceptIdBase = conceptId.includes("__") ? conceptId.split("__")[0] : conceptId;
12798
+ console.log(`[scrollToConcept] conceptId="${conceptId}" conceptIdBase="${conceptIdBase}"`);
12799
+ const sameBaseConcept = (fieldConceptId) => fieldConceptId === conceptId || fieldConceptId.includes("__") && fieldConceptId.split("__")[0] === conceptIdBase;
12800
+ const getFieldScaleFactor = (fieldEl) => {
12801
+ const effectiveDecimals = fieldEl.decimals || (fieldEl.globalDecimals !== void 0 && fieldEl.globalDecimals !== "INF" ? fieldEl.globalDecimals : null);
12802
+ if (!effectiveDecimals)
12803
+ return 1;
12804
+ const scale = parseFloat(String(effectiveDecimals));
12805
+ if (isNaN(scale) || scale <= 0)
12806
+ return 1;
12807
+ return Math.pow(10, scale);
12808
+ };
12809
+ const valueMatchesTarget = (fieldEl, targetVal) => {
12810
+ if (String(fieldEl.value ?? "") === targetVal)
12811
+ return true;
12812
+ const targetNum = Number(targetVal);
12813
+ const fieldNum = Number(fieldEl.value);
12814
+ if (!isNaN(targetNum) && !isNaN(fieldNum) && fieldNum !== 0) {
12815
+ const scaleFactor = getFieldScaleFactor(fieldEl);
12816
+ if (scaleFactor !== 1) {
12817
+ if (Math.abs(fieldNum * scaleFactor - targetNum) < 1e-4)
12818
+ return true;
12819
+ }
12820
+ }
12821
+ return false;
12822
+ };
12823
+ let phase1FieldCount = 0;
12737
12824
  conceptTrees == null ? void 0 : conceptTrees.forEach((ct) => {
12738
12825
  var _a2;
12739
12826
  if (targetFieldEl)
@@ -12743,32 +12830,73 @@ let JupiterDynamicForm = class extends LitElement {
12743
12830
  if (targetFieldEl)
12744
12831
  return;
12745
12832
  const columnMatch = targetColumnId ? fieldEl.conceptId === conceptId && fieldEl.columnId === targetColumnId : fieldEl.conceptId === conceptId;
12746
- const valueMatch = !hasValueMatch || String(fieldEl.value ?? "") === targetValue;
12833
+ const valueMatch = !hasValueMatch || valueMatchesTarget(fieldEl, targetValue);
12834
+ if (columnMatch) {
12835
+ phase1FieldCount++;
12836
+ console.log(`[scrollToConcept] Phase1 candidate: conceptId=${fieldEl.conceptId} columnId=${fieldEl.columnId} value=${fieldEl.value} scale=${getFieldScaleFactor(fieldEl)} valueMatch=${valueMatch}`);
12837
+ }
12747
12838
  if (columnMatch && valueMatch)
12748
12839
  targetFieldEl = fieldEl;
12749
12840
  });
12750
12841
  });
12751
- if (!targetFieldEl && hasValueMatch && !targetColumnId) {
12752
- for (const ct of Array.from(conceptTrees ?? [])) {
12842
+ console.log(`[scrollToConcept] Phase1: scanned ${phase1FieldCount} candidates, found=${!!targetFieldEl}`);
12843
+ if (!targetFieldEl && hasValueMatch) {
12844
+ console.log(`[scrollToConcept] Phase2: searching ALL sections by base concept name + value`);
12845
+ const allSectionEls = ((_e = this.shadowRoot) == null ? void 0 : _e.querySelectorAll("jupiter-form-section")) ?? [];
12846
+ for (const secEl of Array.from(allSectionEls)) {
12753
12847
  if (targetFieldEl)
12754
12848
  break;
12755
- const fields = (_e = ct.shadowRoot) == null ? void 0 : _e.querySelectorAll("jupiter-form-field");
12756
- fields == null ? void 0 : fields.forEach((fieldEl) => {
12849
+ const cts = ((_f = secEl.shadowRoot) == null ? void 0 : _f.querySelectorAll("jupiter-concept-tree")) ?? [];
12850
+ for (const ct of Array.from(cts)) {
12757
12851
  if (targetFieldEl)
12758
- return;
12759
- const columnMatch = targetColumnId ? fieldEl.conceptId === conceptId && fieldEl.columnId === targetColumnId : fieldEl.conceptId === conceptId;
12760
- if (columnMatch)
12761
- targetFieldEl = fieldEl;
12762
- });
12852
+ break;
12853
+ const fields = ((_g = ct.shadowRoot) == null ? void 0 : _g.querySelectorAll("jupiter-form-field")) ?? [];
12854
+ fields.forEach((fieldEl) => {
12855
+ if (targetFieldEl)
12856
+ return;
12857
+ const baseMatch = sameBaseConcept(fieldEl.conceptId);
12858
+ const valMatch = valueMatchesTarget(fieldEl, targetValue);
12859
+ if (baseMatch) {
12860
+ console.log(`[scrollToConcept] Phase2 candidate: conceptId=${fieldEl.conceptId} value=${fieldEl.value} scale=${getFieldScaleFactor(fieldEl)} valMatch=${valMatch}`);
12861
+ }
12862
+ if (baseMatch && valMatch) {
12863
+ console.log(`[scrollToConcept] Phase2 ✅ MATCH: conceptId=${fieldEl.conceptId} columnId=${fieldEl.columnId} value=${fieldEl.value}`);
12864
+ targetFieldEl = fieldEl;
12865
+ }
12866
+ });
12867
+ }
12868
+ }
12869
+ }
12870
+ if (!targetFieldEl) {
12871
+ const allSectionEls = ((_h = this.shadowRoot) == null ? void 0 : _h.querySelectorAll("jupiter-form-section")) ?? [];
12872
+ for (const secEl of Array.from(allSectionEls)) {
12873
+ if (targetFieldEl)
12874
+ break;
12875
+ const cts = ((_i = secEl.shadowRoot) == null ? void 0 : _i.querySelectorAll("jupiter-concept-tree")) ?? [];
12876
+ for (const ct of Array.from(cts)) {
12877
+ if (targetFieldEl)
12878
+ break;
12879
+ const fields = ((_j = ct.shadowRoot) == null ? void 0 : _j.querySelectorAll("jupiter-form-field")) ?? [];
12880
+ fields.forEach((fieldEl) => {
12881
+ if (targetFieldEl)
12882
+ return;
12883
+ const columnMatch = targetColumnId ? sameBaseConcept(fieldEl.conceptId) && fieldEl.columnId === targetColumnId : sameBaseConcept(fieldEl.conceptId);
12884
+ if (columnMatch) {
12885
+ console.log(`[scrollToConcept] Phase3 ✅ fallback: conceptId=${fieldEl.conceptId} columnId=${fieldEl.columnId} value=${fieldEl.value}`);
12886
+ targetFieldEl = fieldEl;
12887
+ }
12888
+ });
12889
+ }
12763
12890
  }
12764
12891
  }
12765
12892
  if (!targetFieldEl) {
12766
12893
  console.warn(`[scrollToConcept] Field element not found for concept: ${conceptName}`);
12767
12894
  return;
12768
12895
  }
12896
+ console.log(`[scrollToConcept] ✅ HIGHLIGHTING conceptId=${targetFieldEl.conceptId} columnId=${targetFieldEl.columnId} value=${targetFieldEl.value}`);
12769
12897
  targetFieldEl.scrollIntoView({ behavior: "smooth", block: "center" });
12770
12898
  targetFieldEl.classList.add("concept-highlight");
12771
- const focusTarget = (_f = targetFieldEl.shadowRoot) == null ? void 0 : _f.querySelector(
12899
+ const focusTarget = (_k = targetFieldEl.shadowRoot) == null ? void 0 : _k.querySelector(
12772
12900
  'input:not([type="hidden"]), select, textarea, button, [tabindex]:not([tabindex="-1"])'
12773
12901
  );
12774
12902
  focusTarget == null ? void 0 : focusTarget.focus({ preventScroll: true });