jupiter-dynamic-forms 1.16.0 → 1.16.2
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/core/dynamic-form.d.ts +13 -0
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/index.js +75 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1501,6 +1501,7 @@ const form$1 = {
|
|
|
1501
1501
|
submit: "Validate",
|
|
1502
1502
|
save: "Save",
|
|
1503
1503
|
saveDraft: "Save Draft",
|
|
1504
|
+
savingDraft: "Saving draft",
|
|
1504
1505
|
errors: "Errors",
|
|
1505
1506
|
modified: "Modified",
|
|
1506
1507
|
valid: "Valid",
|
|
@@ -1509,7 +1510,12 @@ const form$1 = {
|
|
|
1509
1510
|
noRoleSelected: "No Role Selected",
|
|
1510
1511
|
pleaseSelectRole: "Please select a role from the list on the left.",
|
|
1511
1512
|
expandPanel: "Expand side panel",
|
|
1512
|
-
collapsePanel: "Collapse side panel"
|
|
1513
|
+
collapsePanel: "Collapse side panel",
|
|
1514
|
+
validate: "Validate",
|
|
1515
|
+
preview: "Preview",
|
|
1516
|
+
cancelValidation: "Cancel Validation",
|
|
1517
|
+
lastValidationResults: "Last Validation Results",
|
|
1518
|
+
validationInProgress: "Validation In Progress"
|
|
1513
1519
|
};
|
|
1514
1520
|
const filter$1 = {
|
|
1515
1521
|
selectRoles: "Select Roles",
|
|
@@ -1641,6 +1647,7 @@ const form = {
|
|
|
1641
1647
|
submit: "Valideren",
|
|
1642
1648
|
save: "Opslaan",
|
|
1643
1649
|
saveDraft: "Concept opslaan",
|
|
1650
|
+
savingDraft: "Concept opslaan...",
|
|
1644
1651
|
errors: "Fouten",
|
|
1645
1652
|
modified: "Gewijzigd",
|
|
1646
1653
|
valid: "Geldig",
|
|
@@ -1649,7 +1656,12 @@ const form = {
|
|
|
1649
1656
|
noRoleSelected: "Geen rol geselecteerd",
|
|
1650
1657
|
pleaseSelectRole: "Selecteer een rol uit de lijst aan de linkerkant.",
|
|
1651
1658
|
expandPanel: "Zijpaneel uitvouwen",
|
|
1652
|
-
collapsePanel: "Zijpaneel inklappen"
|
|
1659
|
+
collapsePanel: "Zijpaneel inklappen",
|
|
1660
|
+
validate: "Valideren",
|
|
1661
|
+
preview: "Voorbeeld",
|
|
1662
|
+
cancelValidation: "Validatie annuleren",
|
|
1663
|
+
lastValidationResults: "Laatste validatieresultaten",
|
|
1664
|
+
validationInProgress: "Validatie bezig"
|
|
1653
1665
|
};
|
|
1654
1666
|
const filter = {
|
|
1655
1667
|
selectRoles: "Rollen selecteren",
|
|
@@ -7161,6 +7173,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7161
7173
|
this.display = "accordion";
|
|
7162
7174
|
this.mode = "inputForm";
|
|
7163
7175
|
this.roleFilterAxes = [];
|
|
7176
|
+
this.showLastValidationResultBtn = false;
|
|
7177
|
+
this.isDraftSaving = false;
|
|
7164
7178
|
this.defaultUnits = [];
|
|
7165
7179
|
this._formData = {};
|
|
7166
7180
|
this._draftLoaded = false;
|
|
@@ -7193,8 +7207,12 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7193
7207
|
this._contextMenuX = 0;
|
|
7194
7208
|
this._contextMenuY = 0;
|
|
7195
7209
|
this._contextMenuRoleId = null;
|
|
7210
|
+
this._validationStatus = "idle";
|
|
7196
7211
|
this._skipDraftLoading = false;
|
|
7197
7212
|
this._skipPeriodPreferencesRestore = false;
|
|
7213
|
+
this._autoSaveTimer = null;
|
|
7214
|
+
this._lastAutoSaveSnapshot = "";
|
|
7215
|
+
this._lastSavedDraftSnapshot = "";
|
|
7198
7216
|
}
|
|
7199
7217
|
connectedCallback() {
|
|
7200
7218
|
super.connectedCallback();
|
|
@@ -7221,8 +7239,29 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7221
7239
|
this.requestUpdate();
|
|
7222
7240
|
}
|
|
7223
7241
|
});
|
|
7242
|
+
this._autoSaveTimer = setInterval(() => {
|
|
7243
|
+
const currentSnapshot = JSON.stringify(this._formData);
|
|
7244
|
+
if (this._lastAutoSaveSnapshot === "") {
|
|
7245
|
+
this._lastAutoSaveSnapshot = currentSnapshot;
|
|
7246
|
+
console.log("ℹ️ [Auto Save] Baseline initialized; no draft save emitted.");
|
|
7247
|
+
return;
|
|
7248
|
+
}
|
|
7249
|
+
if (currentSnapshot !== this._lastAutoSaveSnapshot) {
|
|
7250
|
+
this._lastAutoSaveSnapshot = currentSnapshot;
|
|
7251
|
+
this._handleSaveDraft("auto");
|
|
7252
|
+
} else {
|
|
7253
|
+
console.log("ℹ️ [Auto Save] No form state change detected; skipping draft save emit.");
|
|
7254
|
+
}
|
|
7255
|
+
}, 3e4);
|
|
7224
7256
|
this._initializeForm();
|
|
7225
7257
|
}
|
|
7258
|
+
disconnectedCallback() {
|
|
7259
|
+
super.disconnectedCallback();
|
|
7260
|
+
if (this._autoSaveTimer !== null) {
|
|
7261
|
+
clearInterval(this._autoSaveTimer);
|
|
7262
|
+
this._autoSaveTimer = null;
|
|
7263
|
+
}
|
|
7264
|
+
}
|
|
7226
7265
|
updated(changedProperties) {
|
|
7227
7266
|
if (changedProperties.has("language")) {
|
|
7228
7267
|
I18n.setLanguage(this.language);
|
|
@@ -8641,7 +8680,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
8641
8680
|
this._submitDisabled = false;
|
|
8642
8681
|
}, 1e3);
|
|
8643
8682
|
}
|
|
8644
|
-
_handleSaveDraft() {
|
|
8683
|
+
_handleSaveDraft(source = "manual") {
|
|
8645
8684
|
console.log(`🔵 [Save Draft] Checking for errors...`);
|
|
8646
8685
|
console.log(`🔵 [Save Draft] _xbrlFormErrors.length: ${this._xbrlFormErrors.length}`);
|
|
8647
8686
|
console.log(`🔵 [Save Draft] _xbrlFormErrors:`, this._xbrlFormErrors);
|
|
@@ -8673,6 +8712,15 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
8673
8712
|
this._periodData,
|
|
8674
8713
|
this._unitData
|
|
8675
8714
|
);
|
|
8715
|
+
const draftPayloadSnapshot = JSON.stringify({
|
|
8716
|
+
draftData,
|
|
8717
|
+
metadata
|
|
8718
|
+
});
|
|
8719
|
+
if (draftPayloadSnapshot === this._lastSavedDraftSnapshot) {
|
|
8720
|
+
console.log(`ℹ️ [Save Draft] No draft content change detected (${source}); skipping event emit.`);
|
|
8721
|
+
return;
|
|
8722
|
+
}
|
|
8723
|
+
this._lastSavedDraftSnapshot = draftPayloadSnapshot;
|
|
8676
8724
|
const saved = this._draftStorageService.saveDraft(draftData, metadata);
|
|
8677
8725
|
console.log("💾 [Save Draft] Metadata saved with enhanced selectedRoleIds:", metadata.selectedRoleIds);
|
|
8678
8726
|
this.dynaformsFacts = draftData;
|
|
@@ -8687,7 +8735,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
8687
8735
|
errors: this._errors,
|
|
8688
8736
|
// JSON data ready for external database storage
|
|
8689
8737
|
dynaformsFacts: draftData,
|
|
8690
|
-
dynaformsMetadata: metadata
|
|
8738
|
+
dynaformsMetadata: metadata,
|
|
8739
|
+
source: source == "auto" ? "auto" : "manual"
|
|
8691
8740
|
},
|
|
8692
8741
|
bubbles: true,
|
|
8693
8742
|
composed: true
|
|
@@ -10419,6 +10468,20 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
10419
10468
|
this._validateForm();
|
|
10420
10469
|
return this._valid;
|
|
10421
10470
|
}
|
|
10471
|
+
/**
|
|
10472
|
+
* Updates the validation status and footer UI accordingly.
|
|
10473
|
+
* Called by the hosting application after triggering external validation.
|
|
10474
|
+
* @param status 'inProgress' | 'cancel' | 'complete'
|
|
10475
|
+
*/
|
|
10476
|
+
setValidation(status) {
|
|
10477
|
+
console.log(`🔍 Validation status updated: ${status}`);
|
|
10478
|
+
if (status === "cancel") {
|
|
10479
|
+
this._validationStatus = "idle";
|
|
10480
|
+
} else {
|
|
10481
|
+
this._validationStatus = status;
|
|
10482
|
+
}
|
|
10483
|
+
this.requestUpdate();
|
|
10484
|
+
}
|
|
10422
10485
|
reset() {
|
|
10423
10486
|
this._handleReset();
|
|
10424
10487
|
}
|
|
@@ -10471,16 +10534,39 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
10471
10534
|
<button
|
|
10472
10535
|
class="btn-secondary"
|
|
10473
10536
|
@click="${this._handleSaveDraft}"
|
|
10474
|
-
?disabled="${this.disabled || this.readonly}"
|
|
10537
|
+
?disabled="${this.disabled || this.readonly || this.isDraftSaving}"
|
|
10475
10538
|
>
|
|
10476
|
-
${I18n.t("form.saveDraft")}
|
|
10539
|
+
${this.isDraftSaving ? I18n.t("form.savingDraft") : I18n.t("form.saveDraft")}
|
|
10477
10540
|
</button>
|
|
10478
10541
|
` : ""}
|
|
10479
10542
|
|
|
10543
|
+
|
|
10544
|
+
<!-- Validation state buttons -->
|
|
10545
|
+
${this._validationStatus === "inProgress" ? html`
|
|
10546
|
+
<button
|
|
10547
|
+
class="btn-preview"
|
|
10548
|
+
@click="${() => this.dispatchEvent(new CustomEvent("showPreview", { bubbles: true, composed: true }))}"
|
|
10549
|
+
?disabled="${this.disabled || this.readonly}"
|
|
10550
|
+
>
|
|
10551
|
+
${I18n.t("form.preview")}
|
|
10552
|
+
</button>
|
|
10553
|
+
` : ""}
|
|
10554
|
+
|
|
10555
|
+
${this._validationStatus === "complete" || this.showLastValidationResultBtn ? html`
|
|
10556
|
+
<button
|
|
10557
|
+
class="btn-last-results"
|
|
10558
|
+
@click="${() => this.dispatchEvent(new CustomEvent("show-validation-results", { bubbles: true, composed: true }))}"
|
|
10559
|
+
?disabled="${this.disabled || this.readonly}"
|
|
10560
|
+
>
|
|
10561
|
+
${I18n.t("form.lastValidationResults")}
|
|
10562
|
+
</button>
|
|
10563
|
+
` : ""}
|
|
10564
|
+
|
|
10565
|
+
|
|
10480
10566
|
<button
|
|
10481
10567
|
class="btn-primary"
|
|
10482
10568
|
@click="${this._handleSubmit}"
|
|
10483
|
-
?disabled="${this.disabled || this.readonly || this._submitDisabled}"
|
|
10569
|
+
?disabled="${this.disabled || this.readonly || this._submitDisabled || this._validationStatus === "inProgress"}"
|
|
10484
10570
|
>
|
|
10485
10571
|
${this.submitButtonLabel || (this.mode === "admin" ? I18n.t("form.save") : I18n.t("form.submit"))}
|
|
10486
10572
|
</button>
|
|
@@ -10702,6 +10788,50 @@ JupiterDynamicForm.styles = css`
|
|
|
10702
10788
|
cursor: not-allowed;
|
|
10703
10789
|
}
|
|
10704
10790
|
|
|
10791
|
+
.btn-validate {
|
|
10792
|
+
background: var(--jupiter-validate-color, #388e3c);
|
|
10793
|
+
color: white;
|
|
10794
|
+
display: inline-flex;
|
|
10795
|
+
align-items: center;
|
|
10796
|
+
gap: 8px;
|
|
10797
|
+
}
|
|
10798
|
+
|
|
10799
|
+
.btn-validate:hover:not(:disabled) {
|
|
10800
|
+
background: var(--jupiter-validate-color-dark, #2e7d32);
|
|
10801
|
+
}
|
|
10802
|
+
|
|
10803
|
+
.btn-preview {
|
|
10804
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
10805
|
+
color: white;
|
|
10806
|
+
}
|
|
10807
|
+
.btn-preview:hover:not(:disabled) {
|
|
10808
|
+
background: var(--jupiter-primary-color-dark, #1565c0);
|
|
10809
|
+
}
|
|
10810
|
+
|
|
10811
|
+
.btn-last-results {
|
|
10812
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
10813
|
+
color: white;
|
|
10814
|
+
}
|
|
10815
|
+
.btn-last-results:hover:not(:disabled) {
|
|
10816
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
10817
|
+
color: white;
|
|
10818
|
+
}
|
|
10819
|
+
|
|
10820
|
+
.validation-spinner {
|
|
10821
|
+
display: inline-block;
|
|
10822
|
+
width: 14px;
|
|
10823
|
+
height: 14px;
|
|
10824
|
+
border: 2px solid rgba(255, 255, 255, 0.4);
|
|
10825
|
+
border-top-color: white;
|
|
10826
|
+
border-radius: 50%;
|
|
10827
|
+
animation: spin 0.8s linear infinite;
|
|
10828
|
+
flex-shrink: 0;
|
|
10829
|
+
}
|
|
10830
|
+
|
|
10831
|
+
@keyframes spin {
|
|
10832
|
+
to { transform: rotate(360deg); }
|
|
10833
|
+
}
|
|
10834
|
+
|
|
10705
10835
|
.form-meta {
|
|
10706
10836
|
display: flex;
|
|
10707
10837
|
gap: 16px;
|
|
@@ -11324,6 +11454,12 @@ __decorateClass([
|
|
|
11324
11454
|
__decorateClass([
|
|
11325
11455
|
n2({ type: Array })
|
|
11326
11456
|
], JupiterDynamicForm.prototype, "roleFilterAxes", 2);
|
|
11457
|
+
__decorateClass([
|
|
11458
|
+
n2({ type: Boolean, attribute: "show-last-validation-result-btn" })
|
|
11459
|
+
], JupiterDynamicForm.prototype, "showLastValidationResultBtn", 2);
|
|
11460
|
+
__decorateClass([
|
|
11461
|
+
n2({ type: Boolean, attribute: "is-draft-saving" })
|
|
11462
|
+
], JupiterDynamicForm.prototype, "isDraftSaving", 2);
|
|
11327
11463
|
__decorateClass([
|
|
11328
11464
|
n2({ type: Array })
|
|
11329
11465
|
], JupiterDynamicForm.prototype, "defaultUnits", 2);
|
|
@@ -11435,6 +11571,9 @@ __decorateClass([
|
|
|
11435
11571
|
__decorateClass([
|
|
11436
11572
|
r()
|
|
11437
11573
|
], JupiterDynamicForm.prototype, "_contextMenuRoleId", 2);
|
|
11574
|
+
__decorateClass([
|
|
11575
|
+
r()
|
|
11576
|
+
], JupiterDynamicForm.prototype, "_validationStatus", 2);
|
|
11438
11577
|
JupiterDynamicForm = __decorateClass([
|
|
11439
11578
|
t$1("jupiter-dynamic-form")
|
|
11440
11579
|
], JupiterDynamicForm);
|