jupiter-dynamic-forms 1.14.7 → 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/add-column-dialog.d.ts +2 -0
- package/dist/core/add-column-dialog.d.ts.map +1 -1
- package/dist/core/dynamic-form.d.ts +23 -8
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/core/form-field.d.ts.map +1 -1
- package/dist/core/form-section.d.ts +2 -0
- package/dist/core/form-section.d.ts.map +1 -1
- package/dist/index.js +95 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +473 -391
- 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
|
@@ -1082,7 +1082,7 @@ class XBRLFormBuilder {
|
|
|
1082
1082
|
} else if (periodTypes.size === 1 && periodTypes.has("instant")) {
|
|
1083
1083
|
columns2.push({
|
|
1084
1084
|
id: "typed-instant",
|
|
1085
|
-
title: `${axisLabel2}
|
|
1085
|
+
title: `${axisLabel2} `,
|
|
1086
1086
|
description: periodEndDate,
|
|
1087
1087
|
type: "dimension",
|
|
1088
1088
|
dimensionData: {
|
|
@@ -1112,7 +1112,7 @@ class XBRLFormBuilder {
|
|
|
1112
1112
|
} else if (periodTypes.size === 1 && periodTypes.has("duration")) {
|
|
1113
1113
|
columns2.push({
|
|
1114
1114
|
id: "typed-duration",
|
|
1115
|
-
title: `${axisLabel2}
|
|
1115
|
+
title: `${axisLabel2} `,
|
|
1116
1116
|
description: this.formatPeriodDisplay(periodStartDate, periodEndDate),
|
|
1117
1117
|
type: "dimension",
|
|
1118
1118
|
dimensionData: {
|
|
@@ -1142,7 +1142,7 @@ class XBRLFormBuilder {
|
|
|
1142
1142
|
} else {
|
|
1143
1143
|
columns2.push({
|
|
1144
1144
|
id: "typed-duration",
|
|
1145
|
-
title: `${axisLabel2}
|
|
1145
|
+
title: `${axisLabel2} `,
|
|
1146
1146
|
description: this.formatPeriodDisplay(periodStartDate, periodEndDate),
|
|
1147
1147
|
type: "dimension",
|
|
1148
1148
|
dimensionData: {
|
|
@@ -1309,7 +1309,7 @@ class XBRLFormBuilder {
|
|
|
1309
1309
|
typedMemberId: dimension.typedMember.id,
|
|
1310
1310
|
members: [{
|
|
1311
1311
|
id: "[typed]",
|
|
1312
|
-
label: `${axisLabel}
|
|
1312
|
+
label: `${axisLabel}`
|
|
1313
1313
|
}]
|
|
1314
1314
|
};
|
|
1315
1315
|
}
|
|
@@ -2010,6 +2010,241 @@ class DraftStorageService {
|
|
|
2010
2010
|
return { compatible, warnings };
|
|
2011
2011
|
}
|
|
2012
2012
|
}
|
|
2013
|
+
class FactMatcher {
|
|
2014
|
+
/**
|
|
2015
|
+
* Find a matching fact for a given cell context
|
|
2016
|
+
*/
|
|
2017
|
+
static findMatchingFact(facts, context) {
|
|
2018
|
+
if (!facts || facts.length === 0) {
|
|
2019
|
+
return null;
|
|
2020
|
+
}
|
|
2021
|
+
const periodMatchedFacts = facts.filter(
|
|
2022
|
+
(fact) => this.matchesPeriod(fact, context)
|
|
2023
|
+
);
|
|
2024
|
+
if (periodMatchedFacts.length === 0) {
|
|
2025
|
+
return null;
|
|
2026
|
+
}
|
|
2027
|
+
const dimensionMatchedFacts = periodMatchedFacts.filter(
|
|
2028
|
+
(fact) => this.matchesDimensions(fact, context)
|
|
2029
|
+
);
|
|
2030
|
+
if (dimensionMatchedFacts.length === 0) {
|
|
2031
|
+
return null;
|
|
2032
|
+
}
|
|
2033
|
+
if (dimensionMatchedFacts.length > 1 && context.unit) {
|
|
2034
|
+
const unitMatchedFact = dimensionMatchedFacts.find(
|
|
2035
|
+
(fact) => this.matchesUnit(fact, context)
|
|
2036
|
+
);
|
|
2037
|
+
if (unitMatchedFact) {
|
|
2038
|
+
return unitMatchedFact;
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
return dimensionMatchedFacts[0];
|
|
2042
|
+
}
|
|
2043
|
+
/**
|
|
2044
|
+
* Check if fact period matches cell period
|
|
2045
|
+
*/
|
|
2046
|
+
static matchesPeriod(fact, context) {
|
|
2047
|
+
const factPeriod = this.parsePeriod(fact.period);
|
|
2048
|
+
if (context.periodType === "instant" && context.periodInstantDate) {
|
|
2049
|
+
return factPeriod.isInstant && factPeriod.instantDate === context.periodInstantDate;
|
|
2050
|
+
}
|
|
2051
|
+
if (context.periodType === "duration" && context.periodStartDate && context.periodEndDate) {
|
|
2052
|
+
return !factPeriod.isInstant && factPeriod.startDate === context.periodStartDate && factPeriod.endDate === context.periodEndDate;
|
|
2053
|
+
}
|
|
2054
|
+
if (context.periodInstantDate) {
|
|
2055
|
+
return factPeriod.isInstant && factPeriod.instantDate === context.periodInstantDate;
|
|
2056
|
+
}
|
|
2057
|
+
if (context.periodStartDate && context.periodEndDate) {
|
|
2058
|
+
return !factPeriod.isInstant && factPeriod.startDate === context.periodStartDate && factPeriod.endDate === context.periodEndDate;
|
|
2059
|
+
}
|
|
2060
|
+
return true;
|
|
2061
|
+
}
|
|
2062
|
+
/**
|
|
2063
|
+
* Check if fact dimensions match cell dimensions
|
|
2064
|
+
*/
|
|
2065
|
+
static matchesDimensions(fact, context) {
|
|
2066
|
+
const factDimensions = fact.dimensions || [];
|
|
2067
|
+
const cellDimensions = this.extractDimensionsFromContext(context);
|
|
2068
|
+
if (cellDimensions.length === 0) {
|
|
2069
|
+
return factDimensions.length === 0;
|
|
2070
|
+
}
|
|
2071
|
+
if (factDimensions.length === 0 && cellDimensions.length > 0) {
|
|
2072
|
+
return false;
|
|
2073
|
+
}
|
|
2074
|
+
if (factDimensions.length !== cellDimensions.length) {
|
|
2075
|
+
return false;
|
|
2076
|
+
}
|
|
2077
|
+
const allMatch = cellDimensions.every((cellDim) => {
|
|
2078
|
+
return factDimensions.some((factDim) => {
|
|
2079
|
+
const axisMatch = this.normalizeAxisId(factDim.dimension) === this.normalizeAxisId(cellDim.axisId);
|
|
2080
|
+
if (!axisMatch) {
|
|
2081
|
+
return false;
|
|
2082
|
+
}
|
|
2083
|
+
if (factDim.dimensionType === "explicit" && cellDim.memberId) {
|
|
2084
|
+
const memberMatch = this.normalizeMemberId(factDim.member || "") === this.normalizeMemberId(cellDim.memberId);
|
|
2085
|
+
return memberMatch;
|
|
2086
|
+
}
|
|
2087
|
+
if (factDim.dimensionType === "typed" && cellDim.isTyped) {
|
|
2088
|
+
return true;
|
|
2089
|
+
}
|
|
2090
|
+
return false;
|
|
2091
|
+
});
|
|
2092
|
+
});
|
|
2093
|
+
return allMatch;
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Check if fact unit matches cell unit
|
|
2097
|
+
*/
|
|
2098
|
+
static matchesUnit(fact, context) {
|
|
2099
|
+
if (!context.unit || !fact.unitMeasure) {
|
|
2100
|
+
return true;
|
|
2101
|
+
}
|
|
2102
|
+
const factUnit = this.normalizeUnit(fact.unitMeasure);
|
|
2103
|
+
const cellUnit = this.normalizeUnit(context.unit);
|
|
2104
|
+
return factUnit === cellUnit;
|
|
2105
|
+
}
|
|
2106
|
+
/**
|
|
2107
|
+
* Parse period string into structured format
|
|
2108
|
+
*/
|
|
2109
|
+
static parsePeriod(period) {
|
|
2110
|
+
if (period.includes(" / ")) {
|
|
2111
|
+
const [startDate, endDate] = period.split(" / ").map((d2) => d2.trim());
|
|
2112
|
+
return {
|
|
2113
|
+
isInstant: false,
|
|
2114
|
+
startDate,
|
|
2115
|
+
endDate
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
return {
|
|
2119
|
+
isInstant: true,
|
|
2120
|
+
instantDate: period.trim()
|
|
2121
|
+
};
|
|
2122
|
+
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Extract dimensions from cell context
|
|
2125
|
+
*/
|
|
2126
|
+
static extractDimensionsFromContext(context) {
|
|
2127
|
+
if (!context.dimensionData) {
|
|
2128
|
+
return [];
|
|
2129
|
+
}
|
|
2130
|
+
const dimensions = [];
|
|
2131
|
+
if (context.dimensionData.combinations && context.dimensionData.combinations.length > 0) {
|
|
2132
|
+
context.dimensionData.combinations.forEach((combo) => {
|
|
2133
|
+
dimensions.push({
|
|
2134
|
+
axisId: combo.axisId,
|
|
2135
|
+
memberId: combo.memberId
|
|
2136
|
+
});
|
|
2137
|
+
});
|
|
2138
|
+
}
|
|
2139
|
+
if (context.dimensionData.typedMembers && context.dimensionData.typedMembers.length > 0) {
|
|
2140
|
+
context.dimensionData.typedMembers.forEach((typed) => {
|
|
2141
|
+
dimensions.push({
|
|
2142
|
+
axisId: typed.axisId,
|
|
2143
|
+
memberId: "[typed]",
|
|
2144
|
+
isTyped: true
|
|
2145
|
+
});
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
return dimensions;
|
|
2149
|
+
}
|
|
2150
|
+
/**
|
|
2151
|
+
* Normalize axis ID for comparison
|
|
2152
|
+
* Handles both formats: "jenv-bw2-dim:BasisOfPreparationAxis" and "jenv-bw2-dim_BasisOfPreparationAxis"
|
|
2153
|
+
* Returns: "BasisOfPreparationAxis"
|
|
2154
|
+
*/
|
|
2155
|
+
static normalizeAxisId(axisId) {
|
|
2156
|
+
if (!axisId)
|
|
2157
|
+
return "";
|
|
2158
|
+
if (axisId.includes(":")) {
|
|
2159
|
+
const parts = axisId.split(":");
|
|
2160
|
+
return parts[1] || parts[0];
|
|
2161
|
+
}
|
|
2162
|
+
if (axisId.includes("_")) {
|
|
2163
|
+
axisId.split("_");
|
|
2164
|
+
const lastUnderscoreIndex = axisId.lastIndexOf("_");
|
|
2165
|
+
if (lastUnderscoreIndex > 0) {
|
|
2166
|
+
return axisId.substring(lastUnderscoreIndex + 1);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
return axisId;
|
|
2170
|
+
}
|
|
2171
|
+
/**
|
|
2172
|
+
* Normalize member ID for comparison
|
|
2173
|
+
* Handles both formats: "jenv-bw2-dm:CommercialMember" and "jenv-bw2-dm_CommercialMember"
|
|
2174
|
+
* Returns: "CommercialMember"
|
|
2175
|
+
*/
|
|
2176
|
+
static normalizeMemberId(memberId) {
|
|
2177
|
+
if (!memberId)
|
|
2178
|
+
return "";
|
|
2179
|
+
if (memberId.includes(":")) {
|
|
2180
|
+
const parts = memberId.split(":");
|
|
2181
|
+
return parts[1] || parts[0];
|
|
2182
|
+
}
|
|
2183
|
+
if (memberId.includes("_")) {
|
|
2184
|
+
const lastUnderscoreIndex = memberId.lastIndexOf("_");
|
|
2185
|
+
if (lastUnderscoreIndex > 0) {
|
|
2186
|
+
return memberId.substring(lastUnderscoreIndex + 1);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
return memberId;
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Normalize unit for comparison
|
|
2193
|
+
* Converts "iso4217:EUR" to "EUR"
|
|
2194
|
+
*/
|
|
2195
|
+
static normalizeUnit(unit) {
|
|
2196
|
+
if (!unit)
|
|
2197
|
+
return "";
|
|
2198
|
+
const parts = unit.split(":");
|
|
2199
|
+
return parts.length > 1 ? parts[1] : parts[0];
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Extract typed dimension values from facts
|
|
2203
|
+
* Returns a map of axis IDs to typed values
|
|
2204
|
+
*/
|
|
2205
|
+
static extractTypedValues(facts, context) {
|
|
2206
|
+
const typedValues = {};
|
|
2207
|
+
if (!facts || facts.length === 0) {
|
|
2208
|
+
return typedValues;
|
|
2209
|
+
}
|
|
2210
|
+
const matchedFacts = facts.filter(
|
|
2211
|
+
(fact) => this.matchesPeriod(fact, context) && this.matchesDimensions(fact, context)
|
|
2212
|
+
);
|
|
2213
|
+
matchedFacts.forEach((fact) => {
|
|
2214
|
+
if (fact.dimensions) {
|
|
2215
|
+
fact.dimensions.forEach((dim) => {
|
|
2216
|
+
if (dim.dimensionType === "typed" && dim.typedMemberValue) {
|
|
2217
|
+
const axisId = this.normalizeAxisId(dim.dimension);
|
|
2218
|
+
typedValues[axisId] = dim.typedMemberValue;
|
|
2219
|
+
}
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
});
|
|
2223
|
+
return typedValues;
|
|
2224
|
+
}
|
|
2225
|
+
/**
|
|
2226
|
+
* Debug helper: Log matching process
|
|
2227
|
+
*/
|
|
2228
|
+
static debugMatch(facts, context) {
|
|
2229
|
+
console.log("🔍 [FactMatcher] Debug Match");
|
|
2230
|
+
console.log(" Context:", {
|
|
2231
|
+
conceptId: context.conceptId,
|
|
2232
|
+
columnId: context.columnId,
|
|
2233
|
+
period: context.periodType === "instant" ? context.periodInstantDate : `${context.periodStartDate} / ${context.periodEndDate}`,
|
|
2234
|
+
dimensions: this.extractDimensionsFromContext(context)
|
|
2235
|
+
});
|
|
2236
|
+
console.log(" Facts:", facts.map((f2) => {
|
|
2237
|
+
var _a;
|
|
2238
|
+
return {
|
|
2239
|
+
value: f2.value,
|
|
2240
|
+
period: f2.period,
|
|
2241
|
+
dimensions: (_a = f2.dimensions) == null ? void 0 : _a.map((d2) => `${d2.dimension}:${d2.member}`)
|
|
2242
|
+
};
|
|
2243
|
+
}));
|
|
2244
|
+
const match = this.findMatchingFact(facts, context);
|
|
2245
|
+
console.log(" Match Result:", match ? match.value : "No match");
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2013
2248
|
class XBRLValidator {
|
|
2014
2249
|
/**
|
|
2015
2250
|
* Validates a value against XBRL datatype validation rules
|
|
@@ -2506,333 +2741,98 @@ function collectEnumerationsFromChain(baseTypeChain, datatypes) {
|
|
|
2506
2741
|
}
|
|
2507
2742
|
function determineInputTypeFromBaseChain(baseTypeChain, datatypes) {
|
|
2508
2743
|
if (!baseTypeChain || baseTypeChain.length === 0) {
|
|
2509
|
-
return {
|
|
2510
|
-
fieldType: "text",
|
|
2511
|
-
htmlInputType: "text",
|
|
2512
|
-
placeholder: I18n.t("field.enterValue")
|
|
2513
|
-
};
|
|
2514
|
-
}
|
|
2515
|
-
if (datatypes && datatypes.length > 0) {
|
|
2516
|
-
const enumerations = collectEnumerationsFromChain(baseTypeChain, datatypes);
|
|
2517
|
-
if (enumerations && enumerations.length > 0) {
|
|
2518
|
-
return {
|
|
2519
|
-
fieldType: "select",
|
|
2520
|
-
enumerations,
|
|
2521
|
-
placeholder: I18n.t("field.selectOption")
|
|
2522
|
-
};
|
|
2523
|
-
}
|
|
2524
|
-
}
|
|
2525
|
-
const chainLower = baseTypeChain.map((type) => type.toLowerCase());
|
|
2526
|
-
const chainString = chainLower.join("|");
|
|
2527
|
-
if (baseTypeChain.some((type) => type === "nl-types:formattedExplanationItemType") || chainString.includes("formattedexplanation") || chainString.includes("formatted") && chainString.includes("explanation")) {
|
|
2528
|
-
return {
|
|
2529
|
-
fieldType: "textarea",
|
|
2530
|
-
placeholder: I18n.t("field.enterDetailedExplanation")
|
|
2531
|
-
};
|
|
2532
|
-
}
|
|
2533
|
-
if (chainLower.some((type) => type.includes("date"))) {
|
|
2534
|
-
if (chainString.includes("datetime") || chainString.includes("time")) {
|
|
2535
|
-
return {
|
|
2536
|
-
fieldType: "datetime",
|
|
2537
|
-
htmlInputType: "datetime-local"
|
|
2538
|
-
};
|
|
2539
|
-
}
|
|
2540
|
-
return {
|
|
2541
|
-
fieldType: "date",
|
|
2542
|
-
htmlInputType: "date"
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
if (chainLower.some((type) => type.includes("boolean") || type.includes("bool"))) {
|
|
2546
|
-
return {
|
|
2547
|
-
fieldType: "boolean"
|
|
2548
|
-
};
|
|
2549
|
-
}
|
|
2550
|
-
if (chainLower.some((type) => type.includes("integer") || type === "integer")) {
|
|
2551
|
-
const isNonNegative = chainString.includes("nonnegative") || chainString.includes("non-negative");
|
|
2552
|
-
const isPositive = chainString.includes("positive");
|
|
2553
|
-
return {
|
|
2554
|
-
fieldType: "integer",
|
|
2555
|
-
htmlInputType: "number",
|
|
2556
|
-
allowDecimals: false,
|
|
2557
|
-
min: isPositive ? 1 : isNonNegative ? 0 : void 0,
|
|
2558
|
-
step: 1,
|
|
2559
|
-
placeholder: I18n.t("field.enterWholeNumber")
|
|
2560
|
-
};
|
|
2561
|
-
}
|
|
2562
|
-
if (chainLower.some((type) => type.includes("decimal") || type === "decimal")) {
|
|
2563
|
-
if (chainString.includes("monetary") || chainString.includes("currency")) {
|
|
2564
|
-
if (chainString.includes("nodecimals") || chainString.includes("no-decimals") || chainString.includes("nodecimals20")) {
|
|
2565
|
-
return {
|
|
2566
|
-
fieldType: "number",
|
|
2567
|
-
htmlInputType: "number",
|
|
2568
|
-
allowDecimals: false,
|
|
2569
|
-
step: 1,
|
|
2570
|
-
placeholder: I18n.t("field.enterAmountNoDecimals")
|
|
2571
|
-
};
|
|
2572
|
-
}
|
|
2573
|
-
return {
|
|
2574
|
-
fieldType: "currency",
|
|
2575
|
-
htmlInputType: "number",
|
|
2576
|
-
allowDecimals: true,
|
|
2577
|
-
step: 0.01,
|
|
2578
|
-
placeholder: I18n.t("field.enterCurrency")
|
|
2579
|
-
};
|
|
2580
|
-
}
|
|
2581
|
-
return {
|
|
2582
|
-
fieldType: "decimal",
|
|
2583
|
-
htmlInputType: "number",
|
|
2584
|
-
allowDecimals: true,
|
|
2585
|
-
step: "any",
|
|
2586
|
-
placeholder: I18n.t("field.enterDecimalValue")
|
|
2587
|
-
};
|
|
2588
|
-
}
|
|
2589
|
-
if (baseTypeChain.some((type) => type === "xbrli:stringItemType") || chainLower.some((type) => type === "string" || type.includes("stringitem"))) {
|
|
2590
|
-
return {
|
|
2591
|
-
fieldType: "text",
|
|
2592
|
-
htmlInputType: "text",
|
|
2593
|
-
placeholder: I18n.t("field.enterText")
|
|
2594
|
-
};
|
|
2595
|
-
}
|
|
2596
|
-
return {
|
|
2597
|
-
fieldType: "text",
|
|
2598
|
-
htmlInputType: "text",
|
|
2599
|
-
placeholder: I18n.t("field.enterValue")
|
|
2600
|
-
};
|
|
2601
|
-
}
|
|
2602
|
-
class FactMatcher {
|
|
2603
|
-
/**
|
|
2604
|
-
* Find a matching fact for a given cell context
|
|
2605
|
-
*/
|
|
2606
|
-
static findMatchingFact(facts, context) {
|
|
2607
|
-
if (!facts || facts.length === 0) {
|
|
2608
|
-
return null;
|
|
2609
|
-
}
|
|
2610
|
-
const periodMatchedFacts = facts.filter(
|
|
2611
|
-
(fact) => this.matchesPeriod(fact, context)
|
|
2612
|
-
);
|
|
2613
|
-
if (periodMatchedFacts.length === 0) {
|
|
2614
|
-
return null;
|
|
2615
|
-
}
|
|
2616
|
-
const dimensionMatchedFacts = periodMatchedFacts.filter(
|
|
2617
|
-
(fact) => this.matchesDimensions(fact, context)
|
|
2618
|
-
);
|
|
2619
|
-
if (dimensionMatchedFacts.length === 0) {
|
|
2620
|
-
return null;
|
|
2621
|
-
}
|
|
2622
|
-
if (dimensionMatchedFacts.length > 1 && context.unit) {
|
|
2623
|
-
const unitMatchedFact = dimensionMatchedFacts.find(
|
|
2624
|
-
(fact) => this.matchesUnit(fact, context)
|
|
2625
|
-
);
|
|
2626
|
-
if (unitMatchedFact) {
|
|
2627
|
-
return unitMatchedFact;
|
|
2628
|
-
}
|
|
2629
|
-
}
|
|
2630
|
-
return dimensionMatchedFacts[0];
|
|
2631
|
-
}
|
|
2632
|
-
/**
|
|
2633
|
-
* Check if fact period matches cell period
|
|
2634
|
-
*/
|
|
2635
|
-
static matchesPeriod(fact, context) {
|
|
2636
|
-
const factPeriod = this.parsePeriod(fact.period);
|
|
2637
|
-
if (context.periodType === "instant" && context.periodInstantDate) {
|
|
2638
|
-
return factPeriod.isInstant && factPeriod.instantDate === context.periodInstantDate;
|
|
2639
|
-
}
|
|
2640
|
-
if (context.periodType === "duration" && context.periodStartDate && context.periodEndDate) {
|
|
2641
|
-
return !factPeriod.isInstant && factPeriod.startDate === context.periodStartDate && factPeriod.endDate === context.periodEndDate;
|
|
2642
|
-
}
|
|
2643
|
-
if (context.periodInstantDate) {
|
|
2644
|
-
return factPeriod.isInstant && factPeriod.instantDate === context.periodInstantDate;
|
|
2645
|
-
}
|
|
2646
|
-
if (context.periodStartDate && context.periodEndDate) {
|
|
2647
|
-
return !factPeriod.isInstant && factPeriod.startDate === context.periodStartDate && factPeriod.endDate === context.periodEndDate;
|
|
2648
|
-
}
|
|
2649
|
-
return true;
|
|
2650
|
-
}
|
|
2651
|
-
/**
|
|
2652
|
-
* Check if fact dimensions match cell dimensions
|
|
2653
|
-
*/
|
|
2654
|
-
static matchesDimensions(fact, context) {
|
|
2655
|
-
const factDimensions = fact.dimensions || [];
|
|
2656
|
-
const cellDimensions = this.extractDimensionsFromContext(context);
|
|
2657
|
-
if (cellDimensions.length === 0) {
|
|
2658
|
-
return factDimensions.length === 0;
|
|
2659
|
-
}
|
|
2660
|
-
if (factDimensions.length === 0 && cellDimensions.length > 0) {
|
|
2661
|
-
return false;
|
|
2662
|
-
}
|
|
2663
|
-
if (factDimensions.length !== cellDimensions.length) {
|
|
2664
|
-
return false;
|
|
2665
|
-
}
|
|
2666
|
-
const allMatch = cellDimensions.every((cellDim) => {
|
|
2667
|
-
return factDimensions.some((factDim) => {
|
|
2668
|
-
const axisMatch = this.normalizeAxisId(factDim.dimension) === this.normalizeAxisId(cellDim.axisId);
|
|
2669
|
-
if (!axisMatch) {
|
|
2670
|
-
return false;
|
|
2671
|
-
}
|
|
2672
|
-
if (factDim.dimensionType === "explicit" && cellDim.memberId) {
|
|
2673
|
-
const memberMatch = this.normalizeMemberId(factDim.member || "") === this.normalizeMemberId(cellDim.memberId);
|
|
2674
|
-
return memberMatch;
|
|
2675
|
-
}
|
|
2676
|
-
if (factDim.dimensionType === "typed" && cellDim.isTyped) {
|
|
2677
|
-
return true;
|
|
2678
|
-
}
|
|
2679
|
-
return false;
|
|
2680
|
-
});
|
|
2681
|
-
});
|
|
2682
|
-
return allMatch;
|
|
2683
|
-
}
|
|
2684
|
-
/**
|
|
2685
|
-
* Check if fact unit matches cell unit
|
|
2686
|
-
*/
|
|
2687
|
-
static matchesUnit(fact, context) {
|
|
2688
|
-
if (!context.unit || !fact.unitMeasure) {
|
|
2689
|
-
return true;
|
|
2690
|
-
}
|
|
2691
|
-
const factUnit = this.normalizeUnit(fact.unitMeasure);
|
|
2692
|
-
const cellUnit = this.normalizeUnit(context.unit);
|
|
2693
|
-
return factUnit === cellUnit;
|
|
2744
|
+
return {
|
|
2745
|
+
fieldType: "text",
|
|
2746
|
+
htmlInputType: "text",
|
|
2747
|
+
placeholder: I18n.t("field.enterValue")
|
|
2748
|
+
};
|
|
2694
2749
|
}
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
static parsePeriod(period) {
|
|
2699
|
-
if (period.includes(" / ")) {
|
|
2700
|
-
const [startDate, endDate] = period.split(" / ").map((d2) => d2.trim());
|
|
2750
|
+
if (datatypes && datatypes.length > 0) {
|
|
2751
|
+
const enumerations = collectEnumerationsFromChain(baseTypeChain, datatypes);
|
|
2752
|
+
if (enumerations && enumerations.length > 0) {
|
|
2701
2753
|
return {
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2754
|
+
fieldType: "select",
|
|
2755
|
+
enumerations,
|
|
2756
|
+
placeholder: I18n.t("field.selectOption")
|
|
2705
2757
|
};
|
|
2706
2758
|
}
|
|
2759
|
+
}
|
|
2760
|
+
const chainLower = baseTypeChain.map((type) => type.toLowerCase());
|
|
2761
|
+
const chainString = chainLower.join("|");
|
|
2762
|
+
if (baseTypeChain.some((type) => type === "nl-types:formattedExplanationItemType") || chainString.includes("formattedexplanation") || chainString.includes("formatted") && chainString.includes("explanation")) {
|
|
2707
2763
|
return {
|
|
2708
|
-
|
|
2709
|
-
|
|
2764
|
+
fieldType: "textarea",
|
|
2765
|
+
placeholder: I18n.t("field.enterDetailedExplanation")
|
|
2710
2766
|
};
|
|
2711
2767
|
}
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
}
|
|
2719
|
-
const dimensions = [];
|
|
2720
|
-
if (context.dimensionData.combinations && context.dimensionData.combinations.length > 0) {
|
|
2721
|
-
context.dimensionData.combinations.forEach((combo) => {
|
|
2722
|
-
dimensions.push({
|
|
2723
|
-
axisId: combo.axisId,
|
|
2724
|
-
memberId: combo.memberId
|
|
2725
|
-
});
|
|
2726
|
-
});
|
|
2727
|
-
}
|
|
2728
|
-
if (context.dimensionData.typedMembers && context.dimensionData.typedMembers.length > 0) {
|
|
2729
|
-
context.dimensionData.typedMembers.forEach((typed) => {
|
|
2730
|
-
dimensions.push({
|
|
2731
|
-
axisId: typed.axisId,
|
|
2732
|
-
memberId: "[typed]",
|
|
2733
|
-
isTyped: true
|
|
2734
|
-
});
|
|
2735
|
-
});
|
|
2736
|
-
}
|
|
2737
|
-
return dimensions;
|
|
2738
|
-
}
|
|
2739
|
-
/**
|
|
2740
|
-
* Normalize axis ID for comparison
|
|
2741
|
-
* Handles both formats: "jenv-bw2-dim:BasisOfPreparationAxis" and "jenv-bw2-dim_BasisOfPreparationAxis"
|
|
2742
|
-
* Returns: "BasisOfPreparationAxis"
|
|
2743
|
-
*/
|
|
2744
|
-
static normalizeAxisId(axisId) {
|
|
2745
|
-
if (!axisId)
|
|
2746
|
-
return "";
|
|
2747
|
-
if (axisId.includes(":")) {
|
|
2748
|
-
const parts = axisId.split(":");
|
|
2749
|
-
return parts[1] || parts[0];
|
|
2750
|
-
}
|
|
2751
|
-
if (axisId.includes("_")) {
|
|
2752
|
-
axisId.split("_");
|
|
2753
|
-
const lastUnderscoreIndex = axisId.lastIndexOf("_");
|
|
2754
|
-
if (lastUnderscoreIndex > 0) {
|
|
2755
|
-
return axisId.substring(lastUnderscoreIndex + 1);
|
|
2756
|
-
}
|
|
2768
|
+
if (chainLower.some((type) => type.includes("date"))) {
|
|
2769
|
+
if (chainString.includes("datetime") || chainString.includes("time")) {
|
|
2770
|
+
return {
|
|
2771
|
+
fieldType: "datetime",
|
|
2772
|
+
htmlInputType: "datetime-local"
|
|
2773
|
+
};
|
|
2757
2774
|
}
|
|
2758
|
-
return
|
|
2775
|
+
return {
|
|
2776
|
+
fieldType: "date",
|
|
2777
|
+
htmlInputType: "date"
|
|
2778
|
+
};
|
|
2759
2779
|
}
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
*/
|
|
2765
|
-
static normalizeMemberId(memberId) {
|
|
2766
|
-
if (!memberId)
|
|
2767
|
-
return "";
|
|
2768
|
-
if (memberId.includes(":")) {
|
|
2769
|
-
const parts = memberId.split(":");
|
|
2770
|
-
return parts[1] || parts[0];
|
|
2771
|
-
}
|
|
2772
|
-
if (memberId.includes("_")) {
|
|
2773
|
-
const lastUnderscoreIndex = memberId.lastIndexOf("_");
|
|
2774
|
-
if (lastUnderscoreIndex > 0) {
|
|
2775
|
-
return memberId.substring(lastUnderscoreIndex + 1);
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
return memberId;
|
|
2780
|
+
if (chainLower.some((type) => type.includes("boolean") || type.includes("bool"))) {
|
|
2781
|
+
return {
|
|
2782
|
+
fieldType: "boolean"
|
|
2783
|
+
};
|
|
2779
2784
|
}
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2785
|
+
if (chainLower.some((type) => type.includes("integer") || type === "integer")) {
|
|
2786
|
+
const isNonNegative = chainString.includes("nonnegative") || chainString.includes("non-negative");
|
|
2787
|
+
const isPositive = chainString.includes("positive");
|
|
2788
|
+
return {
|
|
2789
|
+
fieldType: "integer",
|
|
2790
|
+
htmlInputType: "number",
|
|
2791
|
+
allowDecimals: false,
|
|
2792
|
+
min: isPositive ? 1 : isNonNegative ? 0 : void 0,
|
|
2793
|
+
step: 1,
|
|
2794
|
+
placeholder: I18n.t("field.enterWholeNumber")
|
|
2795
|
+
};
|
|
2789
2796
|
}
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
(fact) => this.matchesPeriod(fact, context) && this.matchesDimensions(fact, context)
|
|
2801
|
-
);
|
|
2802
|
-
matchedFacts.forEach((fact) => {
|
|
2803
|
-
if (fact.dimensions) {
|
|
2804
|
-
fact.dimensions.forEach((dim) => {
|
|
2805
|
-
if (dim.dimensionType === "typed" && dim.typedMemberValue) {
|
|
2806
|
-
const axisId = this.normalizeAxisId(dim.dimension);
|
|
2807
|
-
typedValues[axisId] = dim.typedMemberValue;
|
|
2808
|
-
}
|
|
2809
|
-
});
|
|
2797
|
+
if (chainLower.some((type) => type.includes("decimal") || type === "decimal")) {
|
|
2798
|
+
if (chainString.includes("monetary") || chainString.includes("currency")) {
|
|
2799
|
+
if (chainString.includes("nodecimals") || chainString.includes("no-decimals") || chainString.includes("nodecimals20")) {
|
|
2800
|
+
return {
|
|
2801
|
+
fieldType: "number",
|
|
2802
|
+
htmlInputType: "number",
|
|
2803
|
+
allowDecimals: false,
|
|
2804
|
+
step: 1,
|
|
2805
|
+
placeholder: I18n.t("field.enterAmountNoDecimals")
|
|
2806
|
+
};
|
|
2810
2807
|
}
|
|
2811
|
-
});
|
|
2812
|
-
return typedValues;
|
|
2813
|
-
}
|
|
2814
|
-
/**
|
|
2815
|
-
* Debug helper: Log matching process
|
|
2816
|
-
*/
|
|
2817
|
-
static debugMatch(facts, context) {
|
|
2818
|
-
console.log("🔍 [FactMatcher] Debug Match");
|
|
2819
|
-
console.log(" Context:", {
|
|
2820
|
-
conceptId: context.conceptId,
|
|
2821
|
-
columnId: context.columnId,
|
|
2822
|
-
period: context.periodType === "instant" ? context.periodInstantDate : `${context.periodStartDate} / ${context.periodEndDate}`,
|
|
2823
|
-
dimensions: this.extractDimensionsFromContext(context)
|
|
2824
|
-
});
|
|
2825
|
-
console.log(" Facts:", facts.map((f2) => {
|
|
2826
|
-
var _a;
|
|
2827
2808
|
return {
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2809
|
+
fieldType: "currency",
|
|
2810
|
+
htmlInputType: "number",
|
|
2811
|
+
allowDecimals: true,
|
|
2812
|
+
step: 0.01,
|
|
2813
|
+
placeholder: I18n.t("field.enterCurrency")
|
|
2831
2814
|
};
|
|
2832
|
-
}
|
|
2833
|
-
|
|
2834
|
-
|
|
2815
|
+
}
|
|
2816
|
+
return {
|
|
2817
|
+
fieldType: "decimal",
|
|
2818
|
+
htmlInputType: "number",
|
|
2819
|
+
allowDecimals: true,
|
|
2820
|
+
step: "any",
|
|
2821
|
+
placeholder: I18n.t("field.enterDecimalValue")
|
|
2822
|
+
};
|
|
2835
2823
|
}
|
|
2824
|
+
if (baseTypeChain.some((type) => type === "xbrli:stringItemType") || chainLower.some((type) => type === "string" || type.includes("stringitem"))) {
|
|
2825
|
+
return {
|
|
2826
|
+
fieldType: "text",
|
|
2827
|
+
htmlInputType: "text",
|
|
2828
|
+
placeholder: I18n.t("field.enterText")
|
|
2829
|
+
};
|
|
2830
|
+
}
|
|
2831
|
+
return {
|
|
2832
|
+
fieldType: "text",
|
|
2833
|
+
htmlInputType: "text",
|
|
2834
|
+
placeholder: I18n.t("field.enterValue")
|
|
2835
|
+
};
|
|
2836
2836
|
}
|
|
2837
2837
|
var __defProp$5 = Object.defineProperty;
|
|
2838
2838
|
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
@@ -3453,7 +3453,8 @@ let JupiterFormField = class extends LitElement {
|
|
|
3453
3453
|
});
|
|
3454
3454
|
}
|
|
3455
3455
|
}
|
|
3456
|
-
const
|
|
3456
|
+
const hasUserValue = this.value !== null && this.value !== void 0;
|
|
3457
|
+
const effectiveValue = isPredefinedValue ? this.masterData[baseConceptId] : hasUserValue ? this.value : factValue;
|
|
3457
3458
|
const effectiveDisabled = isPredefinedValue || this.disabled;
|
|
3458
3459
|
return html`
|
|
3459
3460
|
<div class="field-container">
|
|
@@ -4143,6 +4144,8 @@ let JupiterAddColumnDialog = class extends LitElement {
|
|
|
4143
4144
|
this.periodType = "duration";
|
|
4144
4145
|
this.open = false;
|
|
4145
4146
|
this.availableDimensions = [];
|
|
4147
|
+
this.periodStartDate = "";
|
|
4148
|
+
this.periodEndDate = "";
|
|
4146
4149
|
this._startDate = "";
|
|
4147
4150
|
this._endDate = "";
|
|
4148
4151
|
this._instantDate = "";
|
|
@@ -4245,10 +4248,9 @@ let JupiterAddColumnDialog = class extends LitElement {
|
|
|
4245
4248
|
}
|
|
4246
4249
|
}
|
|
4247
4250
|
_resetForm() {
|
|
4248
|
-
|
|
4249
|
-
this.
|
|
4250
|
-
this.
|
|
4251
|
-
this._instantDate = today;
|
|
4251
|
+
this._startDate = this.periodStartDate || "";
|
|
4252
|
+
this._endDate = this.periodEndDate || "";
|
|
4253
|
+
this._instantDate = this.periodEndDate || this.periodStartDate || "";
|
|
4252
4254
|
this._selectedType = this.periodType === "instant" ? "instant" : "duration";
|
|
4253
4255
|
this._selectedDimensions.clear();
|
|
4254
4256
|
this._autoSelectSingleMemberDimensions();
|
|
@@ -4684,6 +4686,12 @@ __decorateClass$3([
|
|
|
4684
4686
|
__decorateClass$3([
|
|
4685
4687
|
n2({ type: Array })
|
|
4686
4688
|
], JupiterAddColumnDialog.prototype, "availableDimensions", 2);
|
|
4689
|
+
__decorateClass$3([
|
|
4690
|
+
n2({ type: String })
|
|
4691
|
+
], JupiterAddColumnDialog.prototype, "periodStartDate", 2);
|
|
4692
|
+
__decorateClass$3([
|
|
4693
|
+
n2({ type: String })
|
|
4694
|
+
], JupiterAddColumnDialog.prototype, "periodEndDate", 2);
|
|
4687
4695
|
__decorateClass$3([
|
|
4688
4696
|
r()
|
|
4689
4697
|
], JupiterAddColumnDialog.prototype, "_startDate", 2);
|
|
@@ -4729,6 +4737,8 @@ let JupiterFormSection = class extends LitElement {
|
|
|
4729
4737
|
this.availableDimensions = [];
|
|
4730
4738
|
this.hideHeader = false;
|
|
4731
4739
|
this.mode = "inputForm";
|
|
4740
|
+
this.periodStartDate = "";
|
|
4741
|
+
this.periodEndDate = "";
|
|
4732
4742
|
this._expanded = true;
|
|
4733
4743
|
this._showAddColumnDialog = false;
|
|
4734
4744
|
this._sectionPeriodType = "duration";
|
|
@@ -5109,6 +5119,8 @@ let JupiterFormSection = class extends LitElement {
|
|
|
5109
5119
|
.periodType="${this._sectionPeriodType}"
|
|
5110
5120
|
?open="${this._showAddColumnDialog}"
|
|
5111
5121
|
.availableDimensions="${this.availableDimensions}"
|
|
5122
|
+
.periodStartDate="${this.periodStartDate}"
|
|
5123
|
+
.periodEndDate="${this.periodEndDate}"
|
|
5112
5124
|
@dialog-cancel="${this._handleDialogCancel}"
|
|
5113
5125
|
@column-add="${this._handleColumnAdd}"
|
|
5114
5126
|
></jupiter-add-column-dialog>
|
|
@@ -5422,6 +5434,12 @@ __decorateClass$2([
|
|
|
5422
5434
|
__decorateClass$2([
|
|
5423
5435
|
n2({ type: Object })
|
|
5424
5436
|
], JupiterFormSection.prototype, "masterData", 2);
|
|
5437
|
+
__decorateClass$2([
|
|
5438
|
+
n2({ type: String })
|
|
5439
|
+
], JupiterFormSection.prototype, "periodStartDate", 2);
|
|
5440
|
+
__decorateClass$2([
|
|
5441
|
+
n2({ type: String })
|
|
5442
|
+
], JupiterFormSection.prototype, "periodEndDate", 2);
|
|
5425
5443
|
__decorateClass$2([
|
|
5426
5444
|
r()
|
|
5427
5445
|
], JupiterFormSection.prototype, "_expanded", 2);
|
|
@@ -7001,7 +7019,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7001
7019
|
this.language = "en";
|
|
7002
7020
|
this.display = "accordion";
|
|
7003
7021
|
this.mode = "inputForm";
|
|
7004
|
-
this.
|
|
7022
|
+
this.roleFilterAxes = [];
|
|
7005
7023
|
this.defaultUnits = [];
|
|
7006
7024
|
this._formData = {};
|
|
7007
7025
|
this._draftLoaded = false;
|
|
@@ -7067,13 +7085,10 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7067
7085
|
if (changedProperties.has("language")) {
|
|
7068
7086
|
I18n.setLanguage(this.language);
|
|
7069
7087
|
}
|
|
7070
|
-
if (changedProperties.has("financialStatementsTypeAxis")) {
|
|
7071
|
-
console.log("🔄 financialStatementsTypeAxis changed:", this.financialStatementsTypeAxis);
|
|
7072
|
-
}
|
|
7073
7088
|
if ((changedProperties.has("xbrlInput") || changedProperties.has("defaultUnits")) && this.xbrlInput && this.defaultUnits && this.defaultUnits.length > 0) {
|
|
7074
7089
|
this._applyDefaultUnitsToDatatypes();
|
|
7075
7090
|
}
|
|
7076
|
-
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")) {
|
|
7077
7092
|
this._initializeForm();
|
|
7078
7093
|
}
|
|
7079
7094
|
}
|
|
@@ -7121,6 +7136,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7121
7136
|
console.log("📅 Using period dates:", this.periodStartDate, "to", this.periodEndDate);
|
|
7122
7137
|
console.log("🌐 Using language:", this.language);
|
|
7123
7138
|
this._initializePeriodPreferencesFromData();
|
|
7139
|
+
this._applyAxisFilterToPeriodPreferences();
|
|
7124
7140
|
console.log("⚙️ Using period preferences:", this._periodPreferences);
|
|
7125
7141
|
this._currentSchema = XBRLFormBuilder.buildFormSchema(
|
|
7126
7142
|
this.xbrlInput,
|
|
@@ -7145,11 +7161,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7145
7161
|
});
|
|
7146
7162
|
console.log("✅ Custom order applied to _allSections:", this._allSections.map((s2) => s2.title));
|
|
7147
7163
|
}
|
|
7148
|
-
if (this.
|
|
7149
|
-
|
|
7150
|
-
console.log("📊 Sections before filter:", this._allSections.length);
|
|
7151
|
-
this._allSections = this._filterRolesByFinancialStatementsType(this._allSections);
|
|
7152
|
-
console.log("📊 Sections after filter:", this._allSections.length);
|
|
7164
|
+
if (this.roleFilterAxes && this.roleFilterAxes.length > 0) {
|
|
7165
|
+
this._allSections = this._filterRolesByAxisConfig(this._allSections);
|
|
7153
7166
|
}
|
|
7154
7167
|
if (this._selectedRoleIds.length === 0) {
|
|
7155
7168
|
this._selectedRoleIds = this._allSections.map((section2) => section2.id);
|
|
@@ -7413,6 +7426,57 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7413
7426
|
});
|
|
7414
7427
|
this._periodPreferences = preferences;
|
|
7415
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
|
+
}
|
|
7416
7480
|
/**
|
|
7417
7481
|
* Helper method to extract roleIds from _selectedRoleIds
|
|
7418
7482
|
* Handles both legacy string[] and enhanced object[] structure
|
|
@@ -7476,70 +7540,62 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7476
7540
|
return sections;
|
|
7477
7541
|
}
|
|
7478
7542
|
/**
|
|
7479
|
-
* Filter roles based on
|
|
7480
|
-
*
|
|
7481
|
-
*
|
|
7482
|
-
*
|
|
7483
|
-
*
|
|
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.
|
|
7484
7552
|
*/
|
|
7485
|
-
|
|
7553
|
+
_filterRolesByAxisConfig(sections) {
|
|
7486
7554
|
var _a;
|
|
7487
|
-
if (!this.
|
|
7555
|
+
if (!this.roleFilterAxes || this.roleFilterAxes.length === 0) {
|
|
7488
7556
|
return sections;
|
|
7489
7557
|
}
|
|
7490
7558
|
if (!((_a = this.xbrlInput) == null ? void 0 : _a.hypercubes) || this.xbrlInput.hypercubes.length === 0) {
|
|
7491
7559
|
return sections;
|
|
7492
7560
|
}
|
|
7493
7561
|
const hypercubeData = this.xbrlInput.hypercubes[0];
|
|
7494
|
-
const financialStatementsAxisId = "bw2-titel9_FinancialStatementsTypeAxis";
|
|
7495
|
-
console.log("🔍 Filter values:", this.financialStatementsTypeAxis);
|
|
7496
7562
|
return sections.filter((section2) => {
|
|
7497
7563
|
var _a2;
|
|
7498
7564
|
const hypercubeRole = (_a2 = hypercubeData.roles) == null ? void 0 : _a2.find((r2) => r2.roleId === section2.id);
|
|
7499
7565
|
if (!hypercubeRole || !hypercubeRole.items || hypercubeRole.items.length === 0) {
|
|
7500
|
-
console.log(`✅ ${section2.title}: No hypercube entry - INCLUDED`);
|
|
7501
7566
|
return true;
|
|
7502
7567
|
}
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
if (!item.dimensions || item.dimensions.length === 0) {
|
|
7507
|
-
continue;
|
|
7508
|
-
}
|
|
7509
|
-
const financialStatementsTypeDimension = item.dimensions.find(
|
|
7510
|
-
(dim) => {
|
|
7511
|
-
var _a3;
|
|
7512
|
-
return dim.id === financialStatementsAxisId || ((_a3 = dim.conceptName) == null ? void 0 : _a3.includes("FinancialStatementsTypeAxis"));
|
|
7513
|
-
}
|
|
7568
|
+
for (const filterAxis of this.roleFilterAxes) {
|
|
7569
|
+
const availableMemberIds = new Set(
|
|
7570
|
+
filterAxis.members.filter((m) => m.available === true).map((m) => m.id)
|
|
7514
7571
|
);
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
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
|
+
}
|
|
7529
7588
|
}
|
|
7530
|
-
return this.financialStatementsTypeAxis.includes(member.id);
|
|
7531
|
-
});
|
|
7532
|
-
if (itemHasMatch) {
|
|
7533
|
-
hasMatchingMember = true;
|
|
7534
|
-
break;
|
|
7535
7589
|
}
|
|
7590
|
+
if (rolePassesAxis)
|
|
7591
|
+
break;
|
|
7536
7592
|
}
|
|
7537
7593
|
}
|
|
7594
|
+
if (axisApplicable && !rolePassesAxis) {
|
|
7595
|
+
return false;
|
|
7596
|
+
}
|
|
7538
7597
|
}
|
|
7539
|
-
|
|
7540
|
-
return true;
|
|
7541
|
-
}
|
|
7542
|
-
return hasMatchingMember;
|
|
7598
|
+
return true;
|
|
7543
7599
|
});
|
|
7544
7600
|
}
|
|
7545
7601
|
_preserveDataForHiddenSections() {
|
|
@@ -8553,8 +8609,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
8553
8609
|
this._periodPreferences
|
|
8554
8610
|
);
|
|
8555
8611
|
this._allSections = [...this._currentSchema.sections];
|
|
8556
|
-
if (this.
|
|
8557
|
-
this._allSections = this.
|
|
8612
|
+
if (this.roleFilterAxes && this.roleFilterAxes.length > 0) {
|
|
8613
|
+
this._allSections = this._filterRolesByAxisConfig(this._allSections);
|
|
8558
8614
|
}
|
|
8559
8615
|
console.log("✅ Schema rebuilt with restored period preferences");
|
|
8560
8616
|
console.log("🔄 Applying custom period data to schema fields...");
|
|
@@ -9452,7 +9508,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
9452
9508
|
console.warn(`📦 masterData: NOT PROVIDED`);
|
|
9453
9509
|
}
|
|
9454
9510
|
const allFields = [];
|
|
9455
|
-
this._collectAllFields(section2.concepts || [], new Set((section2.columns || []).map((col) => col.id)), allFields);
|
|
9511
|
+
this._collectAllFields(section2.concepts || [], new Set((section2.columns || []).map((col) => col.id)), section2.columns || [], allFields);
|
|
9456
9512
|
console.warn(`📊 Total fields found: ${allFields.length}`);
|
|
9457
9513
|
console.warn(`
|
|
9458
9514
|
📋 FIELD DETAILS:`);
|
|
@@ -9495,30 +9551,52 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
9495
9551
|
this._roleBorderStatuses = new Map(this._roleBorderStatuses);
|
|
9496
9552
|
}
|
|
9497
9553
|
}
|
|
9498
|
-
_collectAllFields(concepts, sectionColumnIds, allFields) {
|
|
9499
|
-
var _a;
|
|
9554
|
+
_collectAllFields(concepts, sectionColumnIds, sectionColumns, allFields) {
|
|
9555
|
+
var _a, _b;
|
|
9500
9556
|
for (const concept of concepts) {
|
|
9501
9557
|
if (concept.abstract) {
|
|
9502
9558
|
if (concept.children && concept.children.length > 0) {
|
|
9503
|
-
this._collectAllFields(concept.children, sectionColumnIds, allFields);
|
|
9559
|
+
this._collectAllFields(concept.children, sectionColumnIds, sectionColumns, allFields);
|
|
9504
9560
|
}
|
|
9505
9561
|
continue;
|
|
9506
9562
|
}
|
|
9507
9563
|
if (concept.fields && concept.fields.length > 0) {
|
|
9508
9564
|
const relevantFields = concept.fields.filter((field2) => sectionColumnIds.has(field2.columnId));
|
|
9509
9565
|
for (const field2 of relevantFields) {
|
|
9510
|
-
const
|
|
9511
|
-
const
|
|
9512
|
-
const isMasterDataField = this.masterData &&
|
|
9566
|
+
const conceptIdWithSuffix = concept.id;
|
|
9567
|
+
const fieldConceptId = field2.conceptId;
|
|
9568
|
+
const isMasterDataField = this.masterData && this.masterData[fieldConceptId] !== void 0;
|
|
9513
9569
|
if (isMasterDataField && this.masterData) {
|
|
9514
|
-
const masterValue = this.masterData[
|
|
9515
|
-
console.warn(` ⏭️ SKIPPING masterData field: ${
|
|
9570
|
+
const masterValue = this.masterData[fieldConceptId];
|
|
9571
|
+
console.warn(` ⏭️ SKIPPING masterData field: ${fieldConceptId} [${field2.columnId}] = ${JSON.stringify(masterValue)}`);
|
|
9516
9572
|
continue;
|
|
9517
9573
|
}
|
|
9518
|
-
|
|
9519
|
-
|
|
9574
|
+
let value = (_a = this._formData[conceptIdWithSuffix]) == null ? void 0 : _a[field2.columnId];
|
|
9575
|
+
if (value === void 0 && conceptIdWithSuffix !== fieldConceptId) {
|
|
9576
|
+
value = (_b = this._formData[fieldConceptId]) == null ? void 0 : _b[field2.columnId];
|
|
9577
|
+
}
|
|
9578
|
+
let isEmpty = value === null || value === void 0 || typeof value === "string" && value.trim() === "";
|
|
9579
|
+
if (isEmpty && concept.facts && concept.facts.length > 0) {
|
|
9580
|
+
const column2 = sectionColumns.find((col) => col.id === field2.columnId);
|
|
9581
|
+
const cellContext = {
|
|
9582
|
+
conceptId: fieldConceptId,
|
|
9583
|
+
columnId: field2.columnId,
|
|
9584
|
+
periodStartDate: field2.periodStartDate || (column2 == null ? void 0 : column2.periodStartDate),
|
|
9585
|
+
periodEndDate: field2.periodEndDate || (column2 == null ? void 0 : column2.periodEndDate),
|
|
9586
|
+
periodInstantDate: field2.periodInstantDate || (field2.periodType === "instant" ? field2.periodEndDate || field2.periodStartDate : void 0),
|
|
9587
|
+
periodType: field2.periodType,
|
|
9588
|
+
dimensionData: column2 == null ? void 0 : column2.dimensionData
|
|
9589
|
+
};
|
|
9590
|
+
const matchedFact = FactMatcher.findMatchingFact(concept.facts, cellContext);
|
|
9591
|
+
if (matchedFact && matchedFact.value !== null && matchedFact.value !== void 0 && matchedFact.value !== "") {
|
|
9592
|
+
value = matchedFact.value;
|
|
9593
|
+
isEmpty = false;
|
|
9594
|
+
console.warn(` ✨ FACT PRE-POPULATED: ${fieldConceptId} [${field2.columnId}] = ${JSON.stringify(value)}`);
|
|
9595
|
+
}
|
|
9596
|
+
}
|
|
9597
|
+
console.warn(` 🔍 Field lookup: concept.id="${conceptIdWithSuffix}", field.conceptId="${fieldConceptId}", value=${JSON.stringify(value)}, isEmpty=${isEmpty}`);
|
|
9520
9598
|
allFields.push({
|
|
9521
|
-
conceptId:
|
|
9599
|
+
conceptId: fieldConceptId,
|
|
9522
9600
|
columnId: field2.columnId,
|
|
9523
9601
|
value,
|
|
9524
9602
|
isEmpty
|
|
@@ -9526,7 +9604,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
9526
9604
|
}
|
|
9527
9605
|
}
|
|
9528
9606
|
if (concept.children && concept.children.length > 0) {
|
|
9529
|
-
this._collectAllFields(concept.children, sectionColumnIds, allFields);
|
|
9607
|
+
this._collectAllFields(concept.children, sectionColumnIds, sectionColumns, allFields);
|
|
9530
9608
|
}
|
|
9531
9609
|
}
|
|
9532
9610
|
}
|
|
@@ -9958,6 +10036,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
9958
10036
|
.availableDimensions="${this._getAvailableDimensionsForSection(section2.id)}"
|
|
9959
10037
|
.mode="${this.mode}"
|
|
9960
10038
|
.masterData="${this.masterData}"
|
|
10039
|
+
.periodStartDate="${this.periodStartDate}"
|
|
10040
|
+
.periodEndDate="${this.periodEndDate}"
|
|
9961
10041
|
@field-change="${this._handleFieldChange}"
|
|
9962
10042
|
@period-change="${this._handlePeriodChange}"
|
|
9963
10043
|
@typed-member-change="${this._handleTypedMemberChange}"
|
|
@@ -10086,6 +10166,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
10086
10166
|
.availableDimensions="${this._getAvailableDimensionsForSection(activeSection.id)}"
|
|
10087
10167
|
.mode="${this.mode}"
|
|
10088
10168
|
.masterData="${this.masterData}"
|
|
10169
|
+
.periodStartDate="${this.periodStartDate}"
|
|
10170
|
+
.periodEndDate="${this.periodEndDate}"
|
|
10089
10171
|
@field-change="${this._handleFieldChange}"
|
|
10090
10172
|
@typed-member-change="${this._handleTypedMemberChange}"
|
|
10091
10173
|
@section-expand="${this._handleSectionExpand}"
|
|
@@ -11015,7 +11097,7 @@ __decorateClass([
|
|
|
11015
11097
|
], JupiterDynamicForm.prototype, "submitButtonLabel", 2);
|
|
11016
11098
|
__decorateClass([
|
|
11017
11099
|
n2({ type: Array })
|
|
11018
|
-
], JupiterDynamicForm.prototype, "
|
|
11100
|
+
], JupiterDynamicForm.prototype, "roleFilterAxes", 2);
|
|
11019
11101
|
__decorateClass([
|
|
11020
11102
|
n2({ type: Array })
|
|
11021
11103
|
], JupiterDynamicForm.prototype, "defaultUnits", 2);
|