jupiter-dynamic-forms 1.19.8 → 1.19.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
@@ -10757,6 +10757,52 @@ let JupiterDynamicForm = class extends LitElement {
10757
10757
  }
10758
10758
  return instantDate || endDate || startDate || "2025-01-01";
10759
10759
  }
10760
+ /**
10761
+ * JDF-037: Self-heals legacy periodStartLabel instant dates.
10762
+ * Drafts saved before JDF-024 have periodStartLabel concepts with the instant date
10763
+ * set to the column's own year instead of one day before periodStartDate. Reuses
10764
+ * _resolveInstantDate (no new date math) to correct both _periodData and the live
10765
+ * field.periodInstantDate so UI and saved output never disagree. Idempotent: only
10766
+ * writes when the stored value actually differs from the corrected one.
10767
+ */
10768
+ _correctLegacyPeriodStartInstantDates() {
10769
+ this._allSections.forEach((section2) => {
10770
+ this._correctPeriodStartInstantDatesInConcepts(section2.concepts, section2);
10771
+ });
10772
+ }
10773
+ _correctPeriodStartInstantDatesInConcepts(concepts, section2) {
10774
+ concepts.forEach((concept) => {
10775
+ var _a, _b;
10776
+ if (((_a = concept.preferredLabel) == null ? void 0 : _a.includes("periodStartLabel")) && concept.periodType === "instant" && ((_b = concept.fields) == null ? void 0 : _b.length)) {
10777
+ concept.fields.forEach((field2) => {
10778
+ this._correctFieldPeriodStartInstantDate(concept, field2, concept.id, section2);
10779
+ const repeatCount = this._repeatCounts[concept.id] || 0;
10780
+ for (let n3 = 1; n3 <= repeatCount; n3++) {
10781
+ this._correctFieldPeriodStartInstantDate(concept, field2, `${concept.id}__repeat_${n3}`, section2);
10782
+ }
10783
+ });
10784
+ }
10785
+ if (concept.children) {
10786
+ this._correctPeriodStartInstantDatesInConcepts(concept.children, section2);
10787
+ }
10788
+ });
10789
+ }
10790
+ _correctFieldPeriodStartInstantDate(concept, field2, periodDataKey, section2) {
10791
+ var _a;
10792
+ const column2 = this._findColumnByIdInSection(field2.columnId, section2);
10793
+ const fieldPeriodData = (_a = this._periodData[periodDataKey]) == null ? void 0 : _a[field2.columnId];
10794
+ const periodStartDate = (fieldPeriodData == null ? void 0 : fieldPeriodData.startDate) || (column2 == null ? void 0 : column2.periodStartDate) || field2.periodStartDate || this.periodStartDate;
10795
+ const periodEndDate = (fieldPeriodData == null ? void 0 : fieldPeriodData.endDate) || (column2 == null ? void 0 : column2.periodEndDate) || field2.periodEndDate || this.periodEndDate;
10796
+ const correctedInstantDate = this._resolveInstantDate(concept.preferredLabel, void 0, periodStartDate, periodEndDate);
10797
+ if (fieldPeriodData && fieldPeriodData.instantDate !== correctedInstantDate) {
10798
+ console.log(`🩹 [Legacy Period Correction] ${periodDataKey}/${field2.columnId}: instantDate ${fieldPeriodData.instantDate} → ${correctedInstantDate}`);
10799
+ fieldPeriodData.instantDate = correctedInstantDate;
10800
+ }
10801
+ if (field2.periodInstantDate !== correctedInstantDate) {
10802
+ console.log(`🩹 [Legacy Period Correction] field ${concept.id}/${field2.columnId}: periodInstantDate ${field2.periodInstantDate} → ${correctedInstantDate}`);
10803
+ field2.periodInstantDate = correctedInstantDate;
10804
+ }
10805
+ }
10760
10806
  _addColumnFromRequest(request, sectionId, insertAfterColumnId) {
10761
10807
  var _a, _b, _c, _d, _e;
10762
10808
  const timestamp = Date.now();
@@ -11056,6 +11102,7 @@ let JupiterDynamicForm = class extends LitElement {
11056
11102
  this.requestUpdate();
11057
11103
  return;
11058
11104
  }
11105
+ this._correctLegacyPeriodStartInstantDates();
11059
11106
  const submissionData = this._generateSubmissionData();
11060
11107
  console.log("📊 Form Submission Data:", JSON.stringify(submissionData, null, 2));
11061
11108
  console.log("📊 Submission Data Summary:");
@@ -11091,6 +11138,7 @@ let JupiterDynamicForm = class extends LitElement {
11091
11138
  console.log("💾 Raw form data before submission generation:", this._formData);
11092
11139
  console.log("🏷️ Unit data before submission generation:", this._unitData);
11093
11140
  console.log("📋 Enhanced selectedRoleIds with roleURI and order:", this._selectedRoleIds);
11141
+ this._correctLegacyPeriodStartInstantDates();
11094
11142
  const draftData = this._generateSubmissionData();
11095
11143
  console.log("📤 Generated submission data:", draftData);
11096
11144
  console.log("📊 Submission data breakdown:");
@@ -11349,6 +11397,7 @@ let JupiterDynamicForm = class extends LitElement {
11349
11397
  };
11350
11398
  console.log(`🏷️ [Unit Restore] Merged unit data: ${Object.keys(this._unitData).length} concepts with custom units`);
11351
11399
  console.log(`🏷️ [Unit Restore] Full _unitData after merge:`, JSON.stringify(this._unitData, null, 2));
11400
+ this._correctLegacyPeriodStartInstantDates();
11352
11401
  if (this._selectedRoleIds.length > 0) {
11353
11402
  this._applyRoleFilter();
11354
11403
  }