jupiter-dynamic-forms 1.15.9 → 1.16.1

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
@@ -624,7 +624,7 @@ class XBRLFormBuilder {
624
624
  }
625
625
  const columns = this.generateDefaultColumnsForRole(role, periodStartDate || "2025-01-01", periodEndDate || "2025-12-31", hypercubeRole, nonAbstractConcepts, periodTypes, rolePreferences);
626
626
  const availableColumnIds = columns.map((col) => col.id);
627
- const roleInfo = { periodTypes, availableColumnIds };
627
+ const roleInfo = { periodTypes, availableColumnIds, availableColumns: columns };
628
628
  const conceptTrees = [];
629
629
  if ((_a = role.presentationLinkbase) == null ? void 0 : _a.concepts) {
630
630
  role.presentationLinkbase.concepts.forEach((concept) => {
@@ -668,7 +668,11 @@ class XBRLFormBuilder {
668
668
  columnIds = ["duration"];
669
669
  }
670
670
  columnIds.forEach((columnId) => {
671
- const field2 = this.createFieldFromConcept(concept, periodStartDate, periodEndDate, columnId);
671
+ var _a;
672
+ const column2 = (_a = roleInfo == null ? void 0 : roleInfo.availableColumns) == null ? void 0 : _a.find((c2) => c2.id === columnId);
673
+ const colStartDate = (column2 == null ? void 0 : column2.periodStartDate) || periodStartDate;
674
+ const colEndDate = (column2 == null ? void 0 : column2.periodEndDate) || periodEndDate;
675
+ const field2 = this.createFieldFromConcept(concept, colStartDate, colEndDate, columnId);
672
676
  if (field2)
673
677
  fields.push(field2);
674
678
  });
@@ -1505,7 +1509,12 @@ const form$1 = {
1505
1509
  noRoleSelected: "No Role Selected",
1506
1510
  pleaseSelectRole: "Please select a role from the list on the left.",
1507
1511
  expandPanel: "Expand side panel",
1508
- collapsePanel: "Collapse side panel"
1512
+ collapsePanel: "Collapse side panel",
1513
+ validate: "Validate",
1514
+ preview: "Preview",
1515
+ cancelValidation: "Cancel Validation",
1516
+ lastValidationResults: "Last Validation Results",
1517
+ validationInProgress: "Validation In Progress"
1509
1518
  };
1510
1519
  const filter$1 = {
1511
1520
  selectRoles: "Select Roles",
@@ -1645,7 +1654,12 @@ const form = {
1645
1654
  noRoleSelected: "Geen rol geselecteerd",
1646
1655
  pleaseSelectRole: "Selecteer een rol uit de lijst aan de linkerkant.",
1647
1656
  expandPanel: "Zijpaneel uitvouwen",
1648
- collapsePanel: "Zijpaneel inklappen"
1657
+ collapsePanel: "Zijpaneel inklappen",
1658
+ validate: "Valideren",
1659
+ preview: "Voorbeeld",
1660
+ cancelValidation: "Validatie annuleren",
1661
+ lastValidationResults: "Laatste validatieresultaten",
1662
+ validationInProgress: "Validatie bezig"
1649
1663
  };
1650
1664
  const filter = {
1651
1665
  selectRoles: "Rollen selecteren",
@@ -7157,6 +7171,7 @@ let JupiterDynamicForm = class extends LitElement {
7157
7171
  this.display = "accordion";
7158
7172
  this.mode = "inputForm";
7159
7173
  this.roleFilterAxes = [];
7174
+ this.showLastValidationResultBtn = false;
7160
7175
  this.defaultUnits = [];
7161
7176
  this._formData = {};
7162
7177
  this._draftLoaded = false;
@@ -7189,6 +7204,7 @@ let JupiterDynamicForm = class extends LitElement {
7189
7204
  this._contextMenuX = 0;
7190
7205
  this._contextMenuY = 0;
7191
7206
  this._contextMenuRoleId = null;
7207
+ this._validationStatus = "idle";
7192
7208
  this._skipDraftLoading = false;
7193
7209
  this._skipPeriodPreferencesRestore = false;
7194
7210
  }
@@ -10415,6 +10431,20 @@ let JupiterDynamicForm = class extends LitElement {
10415
10431
  this._validateForm();
10416
10432
  return this._valid;
10417
10433
  }
10434
+ /**
10435
+ * Updates the validation status and footer UI accordingly.
10436
+ * Called by the hosting application after triggering external validation.
10437
+ * @param status 'inProgress' | 'cancel' | 'complete'
10438
+ */
10439
+ setValidation(status) {
10440
+ console.log(`🔍 Validation status updated: ${status}`);
10441
+ if (status === "cancel") {
10442
+ this._validationStatus = "idle";
10443
+ } else {
10444
+ this._validationStatus = status;
10445
+ }
10446
+ this.requestUpdate();
10447
+ }
10418
10448
  reset() {
10419
10449
  this._handleReset();
10420
10450
  }
@@ -10473,10 +10503,41 @@ let JupiterDynamicForm = class extends LitElement {
10473
10503
  </button>
10474
10504
  ` : ""}
10475
10505
 
10506
+
10507
+ <!-- Validation state buttons -->
10508
+ ${this._validationStatus === "inProgress" ? html`
10509
+ <button
10510
+ class="btn-preview"
10511
+ @click="${() => this.dispatchEvent(new CustomEvent("showPreview", { bubbles: true, composed: true }))}"
10512
+ ?disabled="${this.disabled || this.readonly}"
10513
+ >
10514
+ ${I18n.t("form.preview")}
10515
+ </button>
10516
+
10517
+ <button
10518
+ class="btn-cancel-validation"
10519
+ @click="${() => this.dispatchEvent(new CustomEvent("validationCancel", { bubbles: true, composed: true }))}"
10520
+ ?disabled="${this.disabled || this.readonly}"
10521
+ >
10522
+ ${I18n.t("form.cancelValidation")}
10523
+ </button>
10524
+ ` : ""}
10525
+
10526
+ ${this._validationStatus === "complete" || this.showLastValidationResultBtn ? html`
10527
+ <button
10528
+ class="btn-last-results"
10529
+ @click="${() => this.dispatchEvent(new CustomEvent("show-validation-results", { bubbles: true, composed: true }))}"
10530
+ ?disabled="${this.disabled || this.readonly}"
10531
+ >
10532
+ ${I18n.t("form.lastValidationResults")}
10533
+ </button>
10534
+ ` : ""}
10535
+
10536
+
10476
10537
  <button
10477
10538
  class="btn-primary"
10478
10539
  @click="${this._handleSubmit}"
10479
- ?disabled="${this.disabled || this.readonly || this._submitDisabled}"
10540
+ ?disabled="${this.disabled || this.readonly || this._submitDisabled || this._validationStatus === "inProgress"}"
10480
10541
  >
10481
10542
  ${this.submitButtonLabel || (this.mode === "admin" ? I18n.t("form.save") : I18n.t("form.submit"))}
10482
10543
  </button>
@@ -10698,6 +10759,59 @@ JupiterDynamicForm.styles = css`
10698
10759
  cursor: not-allowed;
10699
10760
  }
10700
10761
 
10762
+ .btn-validate {
10763
+ background: var(--jupiter-validate-color, #388e3c);
10764
+ color: white;
10765
+ display: inline-flex;
10766
+ align-items: center;
10767
+ gap: 8px;
10768
+ }
10769
+
10770
+ .btn-validate:hover:not(:disabled) {
10771
+ background: var(--jupiter-validate-color-dark, #2e7d32);
10772
+ }
10773
+
10774
+ .btn-preview {
10775
+ background: var(--jupiter-primary-color, #1976d2);
10776
+ color: white;
10777
+ }
10778
+ .btn-preview:hover:not(:disabled) {
10779
+ background: var(--jupiter-primary-color-dark, #1565c0);
10780
+ }
10781
+
10782
+ .btn-cancel-validation {
10783
+ background: var(--jupiter-primary-color, #1976d2);
10784
+ color: white;
10785
+ }
10786
+ .btn-cancel-validation:hover:not(:disabled) {
10787
+ background: var(--jupiter-primary-color, #1976d2);
10788
+ color: white;
10789
+ }
10790
+
10791
+ .btn-last-results {
10792
+ background: var(--jupiter-primary-color, #1976d2);
10793
+ color: white;
10794
+ }
10795
+ .btn-last-results:hover:not(:disabled) {
10796
+ background: var(--jupiter-primary-color, #1976d2);
10797
+ color: white;
10798
+ }
10799
+
10800
+ .validation-spinner {
10801
+ display: inline-block;
10802
+ width: 14px;
10803
+ height: 14px;
10804
+ border: 2px solid rgba(255, 255, 255, 0.4);
10805
+ border-top-color: white;
10806
+ border-radius: 50%;
10807
+ animation: spin 0.8s linear infinite;
10808
+ flex-shrink: 0;
10809
+ }
10810
+
10811
+ @keyframes spin {
10812
+ to { transform: rotate(360deg); }
10813
+ }
10814
+
10701
10815
  .form-meta {
10702
10816
  display: flex;
10703
10817
  gap: 16px;
@@ -11320,6 +11434,9 @@ __decorateClass([
11320
11434
  __decorateClass([
11321
11435
  n2({ type: Array })
11322
11436
  ], JupiterDynamicForm.prototype, "roleFilterAxes", 2);
11437
+ __decorateClass([
11438
+ n2({ type: Boolean, attribute: "show-last-validation-result-btn" })
11439
+ ], JupiterDynamicForm.prototype, "showLastValidationResultBtn", 2);
11323
11440
  __decorateClass([
11324
11441
  n2({ type: Array })
11325
11442
  ], JupiterDynamicForm.prototype, "defaultUnits", 2);
@@ -11431,6 +11548,9 @@ __decorateClass([
11431
11548
  __decorateClass([
11432
11549
  r()
11433
11550
  ], JupiterDynamicForm.prototype, "_contextMenuRoleId", 2);
11551
+ __decorateClass([
11552
+ r()
11553
+ ], JupiterDynamicForm.prototype, "_validationStatus", 2);
11434
11554
  JupiterDynamicForm = __decorateClass([
11435
11555
  t$1("jupiter-dynamic-form")
11436
11556
  ], JupiterDynamicForm);