jupiter-dynamic-forms 1.16.0 → 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
@@ -1509,7 +1509,12 @@ const form$1 = {
1509
1509
  noRoleSelected: "No Role Selected",
1510
1510
  pleaseSelectRole: "Please select a role from the list on the left.",
1511
1511
  expandPanel: "Expand side panel",
1512
- 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"
1513
1518
  };
1514
1519
  const filter$1 = {
1515
1520
  selectRoles: "Select Roles",
@@ -1649,7 +1654,12 @@ const form = {
1649
1654
  noRoleSelected: "Geen rol geselecteerd",
1650
1655
  pleaseSelectRole: "Selecteer een rol uit de lijst aan de linkerkant.",
1651
1656
  expandPanel: "Zijpaneel uitvouwen",
1652
- 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"
1653
1663
  };
1654
1664
  const filter = {
1655
1665
  selectRoles: "Rollen selecteren",
@@ -7161,6 +7171,7 @@ let JupiterDynamicForm = class extends LitElement {
7161
7171
  this.display = "accordion";
7162
7172
  this.mode = "inputForm";
7163
7173
  this.roleFilterAxes = [];
7174
+ this.showLastValidationResultBtn = false;
7164
7175
  this.defaultUnits = [];
7165
7176
  this._formData = {};
7166
7177
  this._draftLoaded = false;
@@ -7193,6 +7204,7 @@ let JupiterDynamicForm = class extends LitElement {
7193
7204
  this._contextMenuX = 0;
7194
7205
  this._contextMenuY = 0;
7195
7206
  this._contextMenuRoleId = null;
7207
+ this._validationStatus = "idle";
7196
7208
  this._skipDraftLoading = false;
7197
7209
  this._skipPeriodPreferencesRestore = false;
7198
7210
  }
@@ -10419,6 +10431,20 @@ let JupiterDynamicForm = class extends LitElement {
10419
10431
  this._validateForm();
10420
10432
  return this._valid;
10421
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
+ }
10422
10448
  reset() {
10423
10449
  this._handleReset();
10424
10450
  }
@@ -10477,10 +10503,41 @@ let JupiterDynamicForm = class extends LitElement {
10477
10503
  </button>
10478
10504
  ` : ""}
10479
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
+
10480
10537
  <button
10481
10538
  class="btn-primary"
10482
10539
  @click="${this._handleSubmit}"
10483
- ?disabled="${this.disabled || this.readonly || this._submitDisabled}"
10540
+ ?disabled="${this.disabled || this.readonly || this._submitDisabled || this._validationStatus === "inProgress"}"
10484
10541
  >
10485
10542
  ${this.submitButtonLabel || (this.mode === "admin" ? I18n.t("form.save") : I18n.t("form.submit"))}
10486
10543
  </button>
@@ -10702,6 +10759,59 @@ JupiterDynamicForm.styles = css`
10702
10759
  cursor: not-allowed;
10703
10760
  }
10704
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
+
10705
10815
  .form-meta {
10706
10816
  display: flex;
10707
10817
  gap: 16px;
@@ -11324,6 +11434,9 @@ __decorateClass([
11324
11434
  __decorateClass([
11325
11435
  n2({ type: Array })
11326
11436
  ], JupiterDynamicForm.prototype, "roleFilterAxes", 2);
11437
+ __decorateClass([
11438
+ n2({ type: Boolean, attribute: "show-last-validation-result-btn" })
11439
+ ], JupiterDynamicForm.prototype, "showLastValidationResultBtn", 2);
11327
11440
  __decorateClass([
11328
11441
  n2({ type: Array })
11329
11442
  ], JupiterDynamicForm.prototype, "defaultUnits", 2);
@@ -11435,6 +11548,9 @@ __decorateClass([
11435
11548
  __decorateClass([
11436
11549
  r()
11437
11550
  ], JupiterDynamicForm.prototype, "_contextMenuRoleId", 2);
11551
+ __decorateClass([
11552
+ r()
11553
+ ], JupiterDynamicForm.prototype, "_validationStatus", 2);
11438
11554
  JupiterDynamicForm = __decorateClass([
11439
11555
  t$1("jupiter-dynamic-form")
11440
11556
  ], JupiterDynamicForm);