jupiter-dynamic-forms 1.20.7 → 1.20.8
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 +11 -0
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11633,6 +11633,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
11633
11633
|
this._skipPeriodPreferencesRestore = false;
|
|
11634
11634
|
this._autoSaveTimer = null;
|
|
11635
11635
|
this._lastAutoSaveSnapshot = "";
|
|
11636
|
+
this._autoSaveBaselineSeeded = false;
|
|
11636
11637
|
this._lastSavedDraftSnapshot = "";
|
|
11637
11638
|
}
|
|
11638
11639
|
connectedCallback() {
|
|
@@ -11687,9 +11688,10 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
11687
11688
|
});
|
|
11688
11689
|
this._autoSaveTimer = setInterval(() => {
|
|
11689
11690
|
const currentSnapshot = JSON.stringify(this._formData);
|
|
11690
|
-
if (this.
|
|
11691
|
+
if (!this._autoSaveBaselineSeeded) {
|
|
11691
11692
|
this._lastAutoSaveSnapshot = currentSnapshot;
|
|
11692
|
-
|
|
11693
|
+
this._autoSaveBaselineSeeded = true;
|
|
11694
|
+
console.log("ℹ️ [Auto Save] Baseline initialized on first tick (fallback); no draft save emitted.");
|
|
11693
11695
|
return;
|
|
11694
11696
|
}
|
|
11695
11697
|
if (currentSnapshot !== this._lastAutoSaveSnapshot) {
|
|
@@ -11708,6 +11710,20 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
11708
11710
|
this._autoSaveTimer = null;
|
|
11709
11711
|
}
|
|
11710
11712
|
}
|
|
11713
|
+
/**
|
|
11714
|
+
* Capture the current _formData as the auto-save baseline.
|
|
11715
|
+
*
|
|
11716
|
+
* Must be called once the form has finished populating _formData on load
|
|
11717
|
+
* (after _loadDraftIfExists() resolves). Seeding here — rather than lazily on
|
|
11718
|
+
* the first 30s timer tick — ensures edits made within the first 30 seconds are
|
|
11719
|
+
* detected as changes and auto-saved, instead of being silently folded into the
|
|
11720
|
+
* baseline and never persisted.
|
|
11721
|
+
*/
|
|
11722
|
+
_seedAutoSaveBaseline() {
|
|
11723
|
+
this._lastAutoSaveSnapshot = JSON.stringify(this._formData);
|
|
11724
|
+
this._autoSaveBaselineSeeded = true;
|
|
11725
|
+
console.log("ℹ️ [Auto Save] Baseline seeded from loaded form state.");
|
|
11726
|
+
}
|
|
11711
11727
|
updated(changedProperties) {
|
|
11712
11728
|
if (changedProperties.has("hasUnsavedChanges")) {
|
|
11713
11729
|
this.dispatchEvent(new CustomEvent("has-unsaved-changes-change", {
|
|
@@ -11840,12 +11856,15 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
11840
11856
|
this._extractTypedMembersFromFacts();
|
|
11841
11857
|
if (!this._skipDraftLoading) {
|
|
11842
11858
|
this._loadDraftIfExists().then(() => {
|
|
11859
|
+
this._seedAutoSaveBaseline();
|
|
11843
11860
|
this._analyzeAllVisibleRoles();
|
|
11844
11861
|
}).catch(() => {
|
|
11862
|
+
this._seedAutoSaveBaseline();
|
|
11845
11863
|
this._analyzeAllVisibleRoles();
|
|
11846
11864
|
});
|
|
11847
11865
|
} else {
|
|
11848
11866
|
console.log("⏭️ Skipping draft loading during preference update");
|
|
11867
|
+
this._seedAutoSaveBaseline();
|
|
11849
11868
|
this._analyzeAllVisibleRoles();
|
|
11850
11869
|
}
|
|
11851
11870
|
this._validateForm();
|
|
@@ -12429,6 +12448,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
12429
12448
|
console.log("📊 Section IDs:", (_b = this._currentSchema) == null ? void 0 : _b.sections.map((s2) => s2.id));
|
|
12430
12449
|
console.log("📥 Restoring form data from draft after reinitialization...");
|
|
12431
12450
|
this._loadDraftIfExists().then(() => {
|
|
12451
|
+
this._seedAutoSaveBaseline();
|
|
12432
12452
|
console.log("✅ Form data restored successfully after reinitialization");
|
|
12433
12453
|
}).catch((error2) => {
|
|
12434
12454
|
console.error("❌ Error restoring form data after reinitialization:", error2);
|