jupiter-dynamic-forms 1.14.8 → 1.14.9
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 +23 -8
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/index.js +82 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -57
- package/dist/index.mjs.map +1 -1
- package/dist/schema/types.d.ts +11 -0
- package/dist/schema/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7019,7 +7019,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7019
7019
|
this.language = "en";
|
|
7020
7020
|
this.display = "accordion";
|
|
7021
7021
|
this.mode = "inputForm";
|
|
7022
|
-
this.
|
|
7022
|
+
this.roleFilterAxes = [];
|
|
7023
7023
|
this.defaultUnits = [];
|
|
7024
7024
|
this._formData = {};
|
|
7025
7025
|
this._draftLoaded = false;
|
|
@@ -7085,13 +7085,10 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7085
7085
|
if (changedProperties.has("language")) {
|
|
7086
7086
|
I18n.setLanguage(this.language);
|
|
7087
7087
|
}
|
|
7088
|
-
if (changedProperties.has("financialStatementsTypeAxis")) {
|
|
7089
|
-
console.log("🔄 financialStatementsTypeAxis changed:", this.financialStatementsTypeAxis);
|
|
7090
|
-
}
|
|
7091
7088
|
if ((changedProperties.has("xbrlInput") || changedProperties.has("defaultUnits")) && this.xbrlInput && this.defaultUnits && this.defaultUnits.length > 0) {
|
|
7092
7089
|
this._applyDefaultUnitsToDatatypes();
|
|
7093
7090
|
}
|
|
7094
|
-
if (changedProperties.has("xbrlInput") || changedProperties.has("schema") || changedProperties.has("language") || changedProperties.has("periodStartDate") || changedProperties.has("periodEndDate") || changedProperties.has("
|
|
7091
|
+
if (changedProperties.has("xbrlInput") || changedProperties.has("schema") || changedProperties.has("language") || changedProperties.has("periodStartDate") || changedProperties.has("periodEndDate") || changedProperties.has("roleFilterAxes")) {
|
|
7095
7092
|
this._initializeForm();
|
|
7096
7093
|
}
|
|
7097
7094
|
}
|
|
@@ -7139,6 +7136,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7139
7136
|
console.log("📅 Using period dates:", this.periodStartDate, "to", this.periodEndDate);
|
|
7140
7137
|
console.log("🌐 Using language:", this.language);
|
|
7141
7138
|
this._initializePeriodPreferencesFromData();
|
|
7139
|
+
this._applyAxisFilterToPeriodPreferences();
|
|
7142
7140
|
console.log("⚙️ Using period preferences:", this._periodPreferences);
|
|
7143
7141
|
this._currentSchema = XBRLFormBuilder.buildFormSchema(
|
|
7144
7142
|
this.xbrlInput,
|
|
@@ -7163,11 +7161,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7163
7161
|
});
|
|
7164
7162
|
console.log("✅ Custom order applied to _allSections:", this._allSections.map((s2) => s2.title));
|
|
7165
7163
|
}
|
|
7166
|
-
if (this.
|
|
7167
|
-
|
|
7168
|
-
console.log("📊 Sections before filter:", this._allSections.length);
|
|
7169
|
-
this._allSections = this._filterRolesByFinancialStatementsType(this._allSections);
|
|
7170
|
-
console.log("📊 Sections after filter:", this._allSections.length);
|
|
7164
|
+
if (this.roleFilterAxes && this.roleFilterAxes.length > 0) {
|
|
7165
|
+
this._allSections = this._filterRolesByAxisConfig(this._allSections);
|
|
7171
7166
|
}
|
|
7172
7167
|
if (this._selectedRoleIds.length === 0) {
|
|
7173
7168
|
this._selectedRoleIds = this._allSections.map((section2) => section2.id);
|
|
@@ -7431,6 +7426,57 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7431
7426
|
});
|
|
7432
7427
|
this._periodPreferences = preferences;
|
|
7433
7428
|
}
|
|
7429
|
+
/**
|
|
7430
|
+
* Translate roleFilterAxes into dimensionSelections within _periodPreferences so that
|
|
7431
|
+
* buildFormSchema / filterHypercubeDimensionsBySelection picks up the right columns.
|
|
7432
|
+
*
|
|
7433
|
+
* Rules:
|
|
7434
|
+
* - Only runs when roleFilterAxes is non-empty and hypercube data is present.
|
|
7435
|
+
* - For each hypercube role, if no dimensionSelections have been saved yet (fresh start / no
|
|
7436
|
+
* user metadata), derive them from roleFilterAxes: available=true members → selectedMemberIds.
|
|
7437
|
+
* - Skips roles that already have dimensionSelections (user's saved preference takes priority).
|
|
7438
|
+
*/
|
|
7439
|
+
_applyAxisFilterToPeriodPreferences() {
|
|
7440
|
+
var _a, _b, _c, _d;
|
|
7441
|
+
if (!this.roleFilterAxes || this.roleFilterAxes.length === 0)
|
|
7442
|
+
return;
|
|
7443
|
+
if (!((_c = (_b = (_a = this.xbrlInput) == null ? void 0 : _a.hypercubes) == null ? void 0 : _b[0]) == null ? void 0 : _c.roles))
|
|
7444
|
+
return;
|
|
7445
|
+
const hypercubeRoles = this.xbrlInput.hypercubes[0].roles;
|
|
7446
|
+
const preferences = { ...this._periodPreferences };
|
|
7447
|
+
for (const hypercubeRole of hypercubeRoles) {
|
|
7448
|
+
const roleId = hypercubeRole.roleId;
|
|
7449
|
+
const existing = preferences[roleId];
|
|
7450
|
+
if ((existing == null ? void 0 : existing.dimensionSelections) && existing.dimensionSelections.length > 0) {
|
|
7451
|
+
continue;
|
|
7452
|
+
}
|
|
7453
|
+
const dimensionSelections = [];
|
|
7454
|
+
for (const filterAxis of this.roleFilterAxes) {
|
|
7455
|
+
for (const item of hypercubeRole.items || []) {
|
|
7456
|
+
const matchingDim = (_d = item.dimensions) == null ? void 0 : _d.find(
|
|
7457
|
+
(dim) => dim.id === filterAxis.id || filterAxis.conceptName && dim.conceptName === filterAxis.conceptName
|
|
7458
|
+
);
|
|
7459
|
+
if (matchingDim) {
|
|
7460
|
+
dimensionSelections.push({
|
|
7461
|
+
dimensionId: filterAxis.id,
|
|
7462
|
+
dimensionLabel: filterAxis.conceptName || filterAxis.id,
|
|
7463
|
+
selectedMemberIds: filterAxis.members.filter((m) => m.available === true).map((m) => m.id)
|
|
7464
|
+
});
|
|
7465
|
+
break;
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7468
|
+
}
|
|
7469
|
+
if (dimensionSelections.length > 0) {
|
|
7470
|
+
preferences[roleId] = {
|
|
7471
|
+
showDuration: (existing == null ? void 0 : existing.showDuration) ?? true,
|
|
7472
|
+
showInstant: (existing == null ? void 0 : existing.showInstant) ?? true,
|
|
7473
|
+
showPreviousYear: (existing == null ? void 0 : existing.showPreviousYear) ?? false,
|
|
7474
|
+
dimensionSelections
|
|
7475
|
+
};
|
|
7476
|
+
}
|
|
7477
|
+
}
|
|
7478
|
+
this._periodPreferences = preferences;
|
|
7479
|
+
}
|
|
7434
7480
|
/**
|
|
7435
7481
|
* Helper method to extract roleIds from _selectedRoleIds
|
|
7436
7482
|
* Handles both legacy string[] and enhanced object[] structure
|
|
@@ -7494,70 +7540,62 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7494
7540
|
return sections;
|
|
7495
7541
|
}
|
|
7496
7542
|
/**
|
|
7497
|
-
* Filter roles based on
|
|
7498
|
-
*
|
|
7499
|
-
*
|
|
7500
|
-
*
|
|
7501
|
-
*
|
|
7543
|
+
* Filter roles based on roleFilterAxes input property (checkboxes.json format).
|
|
7544
|
+
*
|
|
7545
|
+
* Rules per axis:
|
|
7546
|
+
* 1. If the role has no hypercube entry → always included.
|
|
7547
|
+
* 2. If the axis from the filter config is NOT present in the role's hypercube dimensions → axis is
|
|
7548
|
+
* not applicable to this role → role is not affected by this axis (still included).
|
|
7549
|
+
* 3. If the axis IS present: include the role only if at least one of the role's members for that
|
|
7550
|
+
* axis matches an available=true member in the filter config.
|
|
7551
|
+
* 4. All axes in the config must pass (logical AND). A single failing axis excludes the role.
|
|
7502
7552
|
*/
|
|
7503
|
-
|
|
7553
|
+
_filterRolesByAxisConfig(sections) {
|
|
7504
7554
|
var _a;
|
|
7505
|
-
if (!this.
|
|
7555
|
+
if (!this.roleFilterAxes || this.roleFilterAxes.length === 0) {
|
|
7506
7556
|
return sections;
|
|
7507
7557
|
}
|
|
7508
7558
|
if (!((_a = this.xbrlInput) == null ? void 0 : _a.hypercubes) || this.xbrlInput.hypercubes.length === 0) {
|
|
7509
7559
|
return sections;
|
|
7510
7560
|
}
|
|
7511
7561
|
const hypercubeData = this.xbrlInput.hypercubes[0];
|
|
7512
|
-
const financialStatementsAxisId = "bw2-titel9_FinancialStatementsTypeAxis";
|
|
7513
|
-
console.log("🔍 Filter values:", this.financialStatementsTypeAxis);
|
|
7514
7562
|
return sections.filter((section2) => {
|
|
7515
7563
|
var _a2;
|
|
7516
7564
|
const hypercubeRole = (_a2 = hypercubeData.roles) == null ? void 0 : _a2.find((r2) => r2.roleId === section2.id);
|
|
7517
7565
|
if (!hypercubeRole || !hypercubeRole.items || hypercubeRole.items.length === 0) {
|
|
7518
|
-
console.log(`✅ ${section2.title}: No hypercube entry - INCLUDED`);
|
|
7519
7566
|
return true;
|
|
7520
7567
|
}
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
if (!item.dimensions || item.dimensions.length === 0) {
|
|
7525
|
-
continue;
|
|
7526
|
-
}
|
|
7527
|
-
const financialStatementsTypeDimension = item.dimensions.find(
|
|
7528
|
-
(dim) => {
|
|
7529
|
-
var _a3;
|
|
7530
|
-
return dim.id === financialStatementsAxisId || ((_a3 = dim.conceptName) == null ? void 0 : _a3.includes("FinancialStatementsTypeAxis"));
|
|
7531
|
-
}
|
|
7568
|
+
for (const filterAxis of this.roleFilterAxes) {
|
|
7569
|
+
const availableMemberIds = new Set(
|
|
7570
|
+
filterAxis.members.filter((m) => m.available === true).map((m) => m.id)
|
|
7532
7571
|
);
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7572
|
+
let axisApplicable = false;
|
|
7573
|
+
let rolePassesAxis = false;
|
|
7574
|
+
for (const item of hypercubeRole.items) {
|
|
7575
|
+
if (!item.dimensions || item.dimensions.length === 0)
|
|
7576
|
+
continue;
|
|
7577
|
+
const matchingDim = item.dimensions.find(
|
|
7578
|
+
(dim) => dim.id === filterAxis.id || filterAxis.conceptName && dim.conceptName === filterAxis.conceptName
|
|
7579
|
+
);
|
|
7580
|
+
if (matchingDim) {
|
|
7581
|
+
axisApplicable = true;
|
|
7582
|
+
if (matchingDim.members) {
|
|
7583
|
+
for (const roleMember of matchingDim.members) {
|
|
7584
|
+
if (availableMemberIds.has(roleMember.id)) {
|
|
7585
|
+
rolePassesAxis = true;
|
|
7586
|
+
break;
|
|
7587
|
+
}
|
|
7547
7588
|
}
|
|
7548
|
-
return this.financialStatementsTypeAxis.includes(member.id);
|
|
7549
|
-
});
|
|
7550
|
-
if (itemHasMatch) {
|
|
7551
|
-
hasMatchingMember = true;
|
|
7552
|
-
break;
|
|
7553
7589
|
}
|
|
7590
|
+
if (rolePassesAxis)
|
|
7591
|
+
break;
|
|
7554
7592
|
}
|
|
7555
7593
|
}
|
|
7594
|
+
if (axisApplicable && !rolePassesAxis) {
|
|
7595
|
+
return false;
|
|
7596
|
+
}
|
|
7556
7597
|
}
|
|
7557
|
-
|
|
7558
|
-
return true;
|
|
7559
|
-
}
|
|
7560
|
-
return hasMatchingMember;
|
|
7598
|
+
return true;
|
|
7561
7599
|
});
|
|
7562
7600
|
}
|
|
7563
7601
|
_preserveDataForHiddenSections() {
|
|
@@ -8571,8 +8609,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
8571
8609
|
this._periodPreferences
|
|
8572
8610
|
);
|
|
8573
8611
|
this._allSections = [...this._currentSchema.sections];
|
|
8574
|
-
if (this.
|
|
8575
|
-
this._allSections = this.
|
|
8612
|
+
if (this.roleFilterAxes && this.roleFilterAxes.length > 0) {
|
|
8613
|
+
this._allSections = this._filterRolesByAxisConfig(this._allSections);
|
|
8576
8614
|
}
|
|
8577
8615
|
console.log("✅ Schema rebuilt with restored period preferences");
|
|
8578
8616
|
console.log("🔄 Applying custom period data to schema fields...");
|
|
@@ -11059,7 +11097,7 @@ __decorateClass([
|
|
|
11059
11097
|
], JupiterDynamicForm.prototype, "submitButtonLabel", 2);
|
|
11060
11098
|
__decorateClass([
|
|
11061
11099
|
n2({ type: Array })
|
|
11062
|
-
], JupiterDynamicForm.prototype, "
|
|
11100
|
+
], JupiterDynamicForm.prototype, "roleFilterAxes", 2);
|
|
11063
11101
|
__decorateClass([
|
|
11064
11102
|
n2({ type: Array })
|
|
11065
11103
|
], JupiterDynamicForm.prototype, "defaultUnits", 2);
|