jupiter-dynamic-forms 1.15.0 → 1.15.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
|
@@ -5765,13 +5765,9 @@ let JupiterFilterRolesDialog = class extends LitElement {
|
|
|
5765
5765
|
}));
|
|
5766
5766
|
}
|
|
5767
5767
|
_handleApply() {
|
|
5768
|
-
const
|
|
5769
|
-
const
|
|
5770
|
-
|
|
5771
|
-
const indexB = this.availableRoles.findIndex((r2) => r2.id === b2);
|
|
5772
|
-
return indexA - indexB;
|
|
5773
|
-
});
|
|
5774
|
-
this._chosenRoleOrder = orderedByOriginal;
|
|
5768
|
+
const orderedSelected = this._chosenRoleOrder.filter((id) => this._tempSelectedRoles.has(id));
|
|
5769
|
+
const notInOrder = Array.from(this._tempSelectedRoles).filter((id) => !this._chosenRoleOrder.includes(id));
|
|
5770
|
+
this._chosenRoleOrder = [...orderedSelected, ...notInOrder];
|
|
5775
5771
|
const orderedRolesWithMetadata = this._chosenRoleOrder.map((roleId, index) => {
|
|
5776
5772
|
var _a;
|
|
5777
5773
|
const role = this.availableRoles.find((r2) => r2.id === roleId);
|
|
@@ -7197,6 +7193,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7197
7193
|
console.log("🌐 Using language:", this.language);
|
|
7198
7194
|
this._initializePeriodPreferencesFromData();
|
|
7199
7195
|
this._applyAxisFilterToPeriodPreferences();
|
|
7196
|
+
this._applyDimensionShowPreviousYear();
|
|
7200
7197
|
console.log("⚙️ Using period preferences:", this._periodPreferences);
|
|
7201
7198
|
this._currentSchema = XBRLFormBuilder.buildFormSchema(
|
|
7202
7199
|
this.xbrlInput,
|
|
@@ -7537,6 +7534,41 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7537
7534
|
}
|
|
7538
7535
|
this._periodPreferences = preferences;
|
|
7539
7536
|
}
|
|
7537
|
+
/**
|
|
7538
|
+
* In admin mode, auto-enables showPreviousYear for roles that have at least one dimension
|
|
7539
|
+
* member selected (from roleFilterAxes defaults). This ensures such roles render with a
|
|
7540
|
+
* minimum of two columns (current + previous year) on fresh initialization.
|
|
7541
|
+
*
|
|
7542
|
+
* Skipped when form state is being restored from external props or localStorage so that
|
|
7543
|
+
* the user's previously saved preferences are not overridden.
|
|
7544
|
+
*/
|
|
7545
|
+
_applyDimensionShowPreviousYear() {
|
|
7546
|
+
var _a, _b;
|
|
7547
|
+
if (this.mode !== "admin")
|
|
7548
|
+
return;
|
|
7549
|
+
const hasExternalState = !!(this.dynaformsFacts && this.dynaformsMetadata);
|
|
7550
|
+
const hasLocalDraft = ((_a = this._draftStorageService) == null ? void 0 : _a.hasDraft()) ?? false;
|
|
7551
|
+
if (hasExternalState || hasLocalDraft)
|
|
7552
|
+
return;
|
|
7553
|
+
const updated = { ...this._periodPreferences };
|
|
7554
|
+
let changed = false;
|
|
7555
|
+
for (const roleId of Object.keys(updated)) {
|
|
7556
|
+
const prefs = updated[roleId];
|
|
7557
|
+
if (prefs.showPreviousYear)
|
|
7558
|
+
continue;
|
|
7559
|
+
const hasDimensionMembers = ((_b = prefs.dimensionSelections) == null ? void 0 : _b.some(
|
|
7560
|
+
(ds) => ds.selectedMemberIds && ds.selectedMemberIds.length > 0
|
|
7561
|
+
)) ?? false;
|
|
7562
|
+
if (hasDimensionMembers) {
|
|
7563
|
+
updated[roleId] = { ...prefs, showPreviousYear: true };
|
|
7564
|
+
changed = true;
|
|
7565
|
+
console.log(`📅 [JDF-010] Auto-enabled showPreviousYear for role "${roleId}" (has dimension members)`);
|
|
7566
|
+
}
|
|
7567
|
+
}
|
|
7568
|
+
if (changed) {
|
|
7569
|
+
this._periodPreferences = updated;
|
|
7570
|
+
}
|
|
7571
|
+
}
|
|
7540
7572
|
/**
|
|
7541
7573
|
* Helper method to extract roleIds from _selectedRoleIds
|
|
7542
7574
|
* Handles both legacy string[] and enhanced object[] structure
|