jupiter-dynamic-forms 1.18.3 → 1.18.5

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
@@ -4553,6 +4553,15 @@ JupiterFormField.styles = css`
4553
4553
  color: var(--jupiter-text-secondary, #999);
4554
4554
  font-style: italic;
4555
4555
  }
4556
+
4557
+ @keyframes concept-highlight-pulse {
4558
+ 0% { box-shadow: 0 0 0 3px #fbbf24; background-color: #fef9c3; }
4559
+ 60% { box-shadow: 0 0 0 3px #fbbf24; background-color: #fef9c3; }
4560
+ 100% { box-shadow: 0 0 0 0px transparent; background-color: transparent; }
4561
+ }
4562
+ :host(.concept-highlight) {
4563
+ animation: concept-highlight-pulse 5s ease-out forwards;
4564
+ }
4556
4565
  `;
4557
4566
  __decorateClass$6([
4558
4567
  n2({ type: Object })
@@ -12546,6 +12555,133 @@ let JupiterDynamicForm = class extends LitElement {
12546
12555
  getState() {
12547
12556
  return this._getFormState();
12548
12557
  }
12558
+ _findConceptByName(concepts, name) {
12559
+ var _a;
12560
+ const localName = name.includes(":") ? name.split(":").pop() : name;
12561
+ for (const c2 of concepts) {
12562
+ if (c2.name === name)
12563
+ return c2;
12564
+ const cLocal = c2.name.includes(":") ? c2.name.split(":").pop() : c2.name;
12565
+ if (cLocal === localName)
12566
+ return c2;
12567
+ if ((_a = c2.children) == null ? void 0 : _a.length) {
12568
+ const hit = this._findConceptByName(c2.children, name);
12569
+ if (hit)
12570
+ return hit;
12571
+ }
12572
+ }
12573
+ return null;
12574
+ }
12575
+ _findColumnByDimensions(columns, dims) {
12576
+ var _a;
12577
+ return (_a = columns.find((col) => {
12578
+ if (col.type !== "dimension" || !col.dimensionData)
12579
+ return false;
12580
+ const combos = col.dimensionData.combinations;
12581
+ if (combos == null ? void 0 : combos.length) {
12582
+ return dims.every(
12583
+ (d2) => combos.some(
12584
+ (c2) => this._normalizeAxisId(c2.axisId) === this._normalizeAxisId(d2.axis) && this._normalizeMemberId(c2.memberId) === this._normalizeMemberId(d2.member)
12585
+ )
12586
+ );
12587
+ }
12588
+ return dims.length === 1 && this._normalizeAxisId(col.dimensionData.axisId ?? "") === this._normalizeAxisId(dims[0].axis) && this._normalizeMemberId(col.dimensionData.memberId ?? "") === this._normalizeMemberId(dims[0].member);
12589
+ })) == null ? void 0 : _a.id;
12590
+ }
12591
+ async scrollToConcept(conceptName, dimensions, match) {
12592
+ var _a, _b, _c, _d, _e, _f;
12593
+ let targetSection = null;
12594
+ let targetConcept = null;
12595
+ const sectionsToSearch = [
12596
+ ...((_a = this._currentSchema) == null ? void 0 : _a.sections) ?? [],
12597
+ ...this._allSections.filter((s2) => {
12598
+ var _a2;
12599
+ return !((_a2 = this._currentSchema) == null ? void 0 : _a2.sections.find((cs) => cs.id === s2.id));
12600
+ })
12601
+ ];
12602
+ for (const section2 of sectionsToSearch) {
12603
+ const found = this._findConceptByName(section2.concepts, conceptName);
12604
+ if (found) {
12605
+ targetSection = section2;
12606
+ targetConcept = found;
12607
+ break;
12608
+ }
12609
+ }
12610
+ if (!targetSection || !targetConcept) {
12611
+ console.warn(`[scrollToConcept] Concept not found: ${conceptName}`);
12612
+ return;
12613
+ }
12614
+ targetSection.expanded = true;
12615
+ if (this.display === "sidePanel" && this._activeSidePanelRoleId !== targetSection.id) {
12616
+ this._activeSidePanelRoleId = targetSection.id;
12617
+ }
12618
+ const columns = targetSection.columns ?? this._columns;
12619
+ let targetColumnId = null;
12620
+ const hasValueMatch = (match == null ? void 0 : match.value) !== void 0 && (match == null ? void 0 : match.value) !== null;
12621
+ const targetValue = hasValueMatch ? String(match.value) : null;
12622
+ if (dimensions == null ? void 0 : dimensions.length) {
12623
+ targetColumnId = this._findColumnByDimensions(columns, dimensions) ?? null;
12624
+ } else if (!hasValueMatch) {
12625
+ targetColumnId = ((_b = columns[0]) == null ? void 0 : _b.id) ?? null;
12626
+ }
12627
+ this.requestUpdate();
12628
+ await this.updateComplete;
12629
+ await new Promise((resolve) => setTimeout(resolve, 300));
12630
+ const sectionElements = (_c = this.shadowRoot) == null ? void 0 : _c.querySelectorAll("jupiter-form-section");
12631
+ let targetSectionEl = null;
12632
+ sectionElements == null ? void 0 : sectionElements.forEach((el) => {
12633
+ var _a2;
12634
+ if (((_a2 = el.section) == null ? void 0 : _a2.id) === targetSection.id)
12635
+ targetSectionEl = el;
12636
+ });
12637
+ if (!targetSectionEl) {
12638
+ console.warn(`[scrollToConcept] Section element not found: ${targetSection.id}`);
12639
+ return;
12640
+ }
12641
+ await targetSectionEl.updateComplete;
12642
+ const conceptTrees = (_d = targetSectionEl.shadowRoot) == null ? void 0 : _d.querySelectorAll("jupiter-concept-tree");
12643
+ let targetFieldEl = null;
12644
+ const conceptId = targetConcept.id;
12645
+ conceptTrees == null ? void 0 : conceptTrees.forEach((ct) => {
12646
+ var _a2;
12647
+ if (targetFieldEl)
12648
+ return;
12649
+ const fields = (_a2 = ct.shadowRoot) == null ? void 0 : _a2.querySelectorAll("jupiter-form-field");
12650
+ fields == null ? void 0 : fields.forEach((fieldEl) => {
12651
+ if (targetFieldEl)
12652
+ return;
12653
+ const columnMatch = targetColumnId ? fieldEl.conceptId === conceptId && fieldEl.columnId === targetColumnId : fieldEl.conceptId === conceptId;
12654
+ const valueMatch = !hasValueMatch || String(fieldEl.value ?? "") === targetValue;
12655
+ if (columnMatch && valueMatch)
12656
+ targetFieldEl = fieldEl;
12657
+ });
12658
+ });
12659
+ if (!targetFieldEl && hasValueMatch && !targetColumnId) {
12660
+ for (const ct of Array.from(conceptTrees ?? [])) {
12661
+ if (targetFieldEl)
12662
+ break;
12663
+ const fields = (_e = ct.shadowRoot) == null ? void 0 : _e.querySelectorAll("jupiter-form-field");
12664
+ fields == null ? void 0 : fields.forEach((fieldEl) => {
12665
+ if (targetFieldEl)
12666
+ return;
12667
+ const columnMatch = targetColumnId ? fieldEl.conceptId === conceptId && fieldEl.columnId === targetColumnId : fieldEl.conceptId === conceptId;
12668
+ if (columnMatch)
12669
+ targetFieldEl = fieldEl;
12670
+ });
12671
+ }
12672
+ }
12673
+ if (!targetFieldEl) {
12674
+ console.warn(`[scrollToConcept] Field element not found for concept: ${conceptName}`);
12675
+ return;
12676
+ }
12677
+ targetFieldEl.scrollIntoView({ behavior: "smooth", block: "center" });
12678
+ targetFieldEl.classList.add("concept-highlight");
12679
+ const focusTarget = (_f = targetFieldEl.shadowRoot) == null ? void 0 : _f.querySelector(
12680
+ 'input:not([type="hidden"]), select, textarea, button, [tabindex]:not([tabindex="-1"])'
12681
+ );
12682
+ focusTarget == null ? void 0 : focusTarget.focus({ preventScroll: true });
12683
+ setTimeout(() => targetFieldEl.classList.remove("concept-highlight"), 5e3);
12684
+ }
12549
12685
  render() {
12550
12686
  var _a;
12551
12687
  const errorCount = this._errors.filter((e2) => e2.severity === "error").length;