jupiter-dynamic-forms 1.14.9 → 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/core/dynamic-form.d.ts +9 -0
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/core/filter-roles-dialog.d.ts.map +1 -1
- package/dist/core/form-field.d.ts +6 -0
- package/dist/core/form-field.d.ts.map +1 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -26
- package/dist/index.mjs.map +1 -1
- package/dist/utils/xbrl-validation.d.ts +1 -1
- package/dist/utils/xbrl-validation.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1593,7 +1593,21 @@ const admin$1 = {
|
|
|
1593
1593
|
};
|
|
1594
1594
|
const validation$1 = {
|
|
1595
1595
|
summary: "Please fix the following errors before submitting:",
|
|
1596
|
-
errorsFound: "errors found"
|
|
1596
|
+
errorsFound: "errors found",
|
|
1597
|
+
unitRequired: "Unit is required. Please select a unit via the period icon."
|
|
1598
|
+
};
|
|
1599
|
+
const xbrlValidation$1 = {
|
|
1600
|
+
patternMismatch: "Value does not match required pattern: {{pattern}}",
|
|
1601
|
+
invalidPattern: "Invalid pattern configuration: {{pattern}}",
|
|
1602
|
+
exactLength: "Value must be exactly {{required}} characters (current: {{current}})",
|
|
1603
|
+
minLength: "Value must be at least {{required}} characters (current: {{current}})",
|
|
1604
|
+
maxLength: "Value must not exceed {{required}} characters (current: {{current}})",
|
|
1605
|
+
totalDigits: "Value must not exceed {{required}} total digits (current: {{current}})",
|
|
1606
|
+
ruleSummaryPattern: "Must match pattern: {{pattern}}",
|
|
1607
|
+
ruleSummaryExactLength: "Must be exactly {{required}} characters",
|
|
1608
|
+
ruleSummaryMinLength: "Minimum {{required}} characters",
|
|
1609
|
+
ruleSummaryMaxLength: "Maximum {{required}} characters",
|
|
1610
|
+
ruleSummaryTotalDigits: "Maximum {{required}} total digits"
|
|
1597
1611
|
};
|
|
1598
1612
|
const error$1 = {
|
|
1599
1613
|
popup: {
|
|
@@ -1614,6 +1628,7 @@ const enTranslations = {
|
|
|
1614
1628
|
field: field$1,
|
|
1615
1629
|
admin: admin$1,
|
|
1616
1630
|
validation: validation$1,
|
|
1631
|
+
xbrlValidation: xbrlValidation$1,
|
|
1617
1632
|
error: error$1
|
|
1618
1633
|
};
|
|
1619
1634
|
const form = {
|
|
@@ -1717,7 +1732,21 @@ const admin = {
|
|
|
1717
1732
|
};
|
|
1718
1733
|
const validation = {
|
|
1719
1734
|
summary: "Corrigeer de volgende fouten voordat u indient:",
|
|
1720
|
-
errorsFound: "fouten gevonden"
|
|
1735
|
+
errorsFound: "fouten gevonden",
|
|
1736
|
+
unitRequired: "Eenheid is verplicht. Selecteer een eenheid via het periodeicoon."
|
|
1737
|
+
};
|
|
1738
|
+
const xbrlValidation = {
|
|
1739
|
+
patternMismatch: "Waarde voldoet niet aan het vereiste patroon: {{pattern}}",
|
|
1740
|
+
invalidPattern: "Ongeldige patternconfiguratie: {{pattern}}",
|
|
1741
|
+
exactLength: "Waarde moet exact {{required}} tekens bevatten (huidig: {{current}})",
|
|
1742
|
+
minLength: "Waarde moet minimaal {{required}} tekens bevatten (huidig: {{current}})",
|
|
1743
|
+
maxLength: "Waarde mag niet meer dan {{required}} tekens bevatten (huidig: {{current}})",
|
|
1744
|
+
totalDigits: "Waarde mag niet meer dan {{required}} cijfers bevatten (huidig: {{current}})",
|
|
1745
|
+
ruleSummaryPattern: "Moet overeenkomen met patroon: {{pattern}}",
|
|
1746
|
+
ruleSummaryExactLength: "Moet exact {{required}} tekens bevatten",
|
|
1747
|
+
ruleSummaryMinLength: "Minimaal {{required}} tekens",
|
|
1748
|
+
ruleSummaryMaxLength: "Maximaal {{required}} tekens",
|
|
1749
|
+
ruleSummaryTotalDigits: "Maximaal {{required}} cijfers"
|
|
1721
1750
|
};
|
|
1722
1751
|
const error = {
|
|
1723
1752
|
popup: {
|
|
@@ -1738,6 +1767,7 @@ const nlTranslations = {
|
|
|
1738
1767
|
field,
|
|
1739
1768
|
admin,
|
|
1740
1769
|
validation,
|
|
1770
|
+
xbrlValidation,
|
|
1741
1771
|
error
|
|
1742
1772
|
};
|
|
1743
1773
|
const translations = {
|
|
@@ -2338,7 +2368,7 @@ class XBRLValidator {
|
|
|
2338
2368
|
if (!regex.test(value)) {
|
|
2339
2369
|
return {
|
|
2340
2370
|
type: "pattern",
|
|
2341
|
-
message:
|
|
2371
|
+
message: I18n.t("xbrlValidation.patternMismatch", { pattern }),
|
|
2342
2372
|
expectedValue: pattern,
|
|
2343
2373
|
actualValue: value
|
|
2344
2374
|
};
|
|
@@ -2347,7 +2377,7 @@ class XBRLValidator {
|
|
|
2347
2377
|
console.error(`Invalid regex pattern: ${pattern}`, error2);
|
|
2348
2378
|
return {
|
|
2349
2379
|
type: "pattern",
|
|
2350
|
-
message:
|
|
2380
|
+
message: I18n.t("xbrlValidation.invalidPattern", { pattern }),
|
|
2351
2381
|
expectedValue: pattern,
|
|
2352
2382
|
actualValue: value
|
|
2353
2383
|
};
|
|
@@ -2361,7 +2391,7 @@ class XBRLValidator {
|
|
|
2361
2391
|
if (value.length !== requiredLength) {
|
|
2362
2392
|
return {
|
|
2363
2393
|
type: "length",
|
|
2364
|
-
message:
|
|
2394
|
+
message: I18n.t("xbrlValidation.exactLength", { required: requiredLength, current: value.length }),
|
|
2365
2395
|
expectedValue: requiredLength,
|
|
2366
2396
|
actualValue: value.length
|
|
2367
2397
|
};
|
|
@@ -2375,7 +2405,7 @@ class XBRLValidator {
|
|
|
2375
2405
|
if (value.length < minLength) {
|
|
2376
2406
|
return {
|
|
2377
2407
|
type: "minLength",
|
|
2378
|
-
message:
|
|
2408
|
+
message: I18n.t("xbrlValidation.minLength", { required: minLength, current: value.length }),
|
|
2379
2409
|
expectedValue: minLength,
|
|
2380
2410
|
actualValue: value.length
|
|
2381
2411
|
};
|
|
@@ -2389,7 +2419,7 @@ class XBRLValidator {
|
|
|
2389
2419
|
if (value.length > maxLength) {
|
|
2390
2420
|
return {
|
|
2391
2421
|
type: "maxLength",
|
|
2392
|
-
message:
|
|
2422
|
+
message: I18n.t("xbrlValidation.maxLength", { required: maxLength, current: value.length }),
|
|
2393
2423
|
expectedValue: maxLength,
|
|
2394
2424
|
actualValue: value.length
|
|
2395
2425
|
};
|
|
@@ -2404,7 +2434,7 @@ class XBRLValidator {
|
|
|
2404
2434
|
if (digitsOnly.length > totalDigits) {
|
|
2405
2435
|
return {
|
|
2406
2436
|
type: "totalDigits",
|
|
2407
|
-
message:
|
|
2437
|
+
message: I18n.t("xbrlValidation.totalDigits", { required: totalDigits, current: digitsOnly.length }),
|
|
2408
2438
|
expectedValue: totalDigits,
|
|
2409
2439
|
actualValue: digitsOnly.length
|
|
2410
2440
|
};
|
|
@@ -2426,19 +2456,19 @@ class XBRLValidator {
|
|
|
2426
2456
|
const validation2 = datatype.validation;
|
|
2427
2457
|
const rules = [];
|
|
2428
2458
|
if (validation2.pattern) {
|
|
2429
|
-
rules.push(
|
|
2459
|
+
rules.push(I18n.t("xbrlValidation.ruleSummaryPattern", { pattern: validation2.pattern }));
|
|
2430
2460
|
}
|
|
2431
2461
|
if (validation2.length !== void 0) {
|
|
2432
|
-
rules.push(
|
|
2462
|
+
rules.push(I18n.t("xbrlValidation.ruleSummaryExactLength", { required: validation2.length }));
|
|
2433
2463
|
}
|
|
2434
2464
|
if (validation2.minLength !== void 0) {
|
|
2435
|
-
rules.push(
|
|
2465
|
+
rules.push(I18n.t("xbrlValidation.ruleSummaryMinLength", { required: validation2.minLength }));
|
|
2436
2466
|
}
|
|
2437
2467
|
if (validation2.maxLength !== void 0) {
|
|
2438
|
-
rules.push(
|
|
2468
|
+
rules.push(I18n.t("xbrlValidation.ruleSummaryMaxLength", { required: validation2.maxLength }));
|
|
2439
2469
|
}
|
|
2440
2470
|
if (validation2.totalDigits !== void 0) {
|
|
2441
|
-
rules.push(
|
|
2471
|
+
rules.push(I18n.t("xbrlValidation.ruleSummaryTotalDigits", { required: validation2.totalDigits }));
|
|
2442
2472
|
}
|
|
2443
2473
|
return rules;
|
|
2444
2474
|
}
|
|
@@ -2931,6 +2961,7 @@ let JupiterFormField = class extends LitElement {
|
|
|
2931
2961
|
_handleBlur() {
|
|
2932
2962
|
this._touched = true;
|
|
2933
2963
|
this._validateXBRLDatatype();
|
|
2964
|
+
this._validateUnitSelection();
|
|
2934
2965
|
console.log(`🟦 [FormField] Blur event - fieldId: ${this.field.id}, conceptId: ${this.conceptId}, columnId: ${this.columnId}`);
|
|
2935
2966
|
console.log(`🟦 [FormField] Current _xbrlErrors:`, this._xbrlErrors);
|
|
2936
2967
|
console.log(`🟦 [FormField] Current value:`, this.value);
|
|
@@ -3029,6 +3060,32 @@ let JupiterFormField = class extends LitElement {
|
|
|
3029
3060
|
console.log(`✅ [FormField] XBRL Validation passed for ${this.conceptId}`);
|
|
3030
3061
|
}
|
|
3031
3062
|
}
|
|
3063
|
+
/**
|
|
3064
|
+
* Validates that a unit is selected when units are available and a value has been entered.
|
|
3065
|
+
* Appends a unit error to _xbrlErrors if validation fails.
|
|
3066
|
+
* Called after _validateXBRLDatatype() so it can append to existing errors.
|
|
3067
|
+
*/
|
|
3068
|
+
_validateUnitSelection() {
|
|
3069
|
+
if (this.value === null || this.value === void 0 || this.value === "") {
|
|
3070
|
+
return;
|
|
3071
|
+
}
|
|
3072
|
+
const availableUnits = this._collectUnitsForConceptType();
|
|
3073
|
+
if (availableUnits.length === 0) {
|
|
3074
|
+
return;
|
|
3075
|
+
}
|
|
3076
|
+
if (!this.unit) {
|
|
3077
|
+
this._xbrlErrors = [
|
|
3078
|
+
...this._xbrlErrors,
|
|
3079
|
+
{
|
|
3080
|
+
type: "unit",
|
|
3081
|
+
message: I18n.t("validation.unitRequired"),
|
|
3082
|
+
expectedValue: availableUnits.map((u2) => u2.label).join(", "),
|
|
3083
|
+
actualValue: ""
|
|
3084
|
+
}
|
|
3085
|
+
];
|
|
3086
|
+
console.log(`❌ [FormField] Unit validation failed for ${this.conceptId}: unit is required but not selected`);
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3032
3089
|
_handlePeriodIconClick() {
|
|
3033
3090
|
this._availableUnits = this._collectUnitsForConceptType();
|
|
3034
3091
|
console.log(`📊 [FormField] Collected ${this._availableUnits.length} units for concept ${this.conceptId}:`, this._availableUnits);
|
|
@@ -5708,13 +5765,9 @@ let JupiterFilterRolesDialog = class extends LitElement {
|
|
|
5708
5765
|
}));
|
|
5709
5766
|
}
|
|
5710
5767
|
_handleApply() {
|
|
5711
|
-
const
|
|
5712
|
-
const
|
|
5713
|
-
|
|
5714
|
-
const indexB = this.availableRoles.findIndex((r2) => r2.id === b2);
|
|
5715
|
-
return indexA - indexB;
|
|
5716
|
-
});
|
|
5717
|
-
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];
|
|
5718
5771
|
const orderedRolesWithMetadata = this._chosenRoleOrder.map((roleId, index) => {
|
|
5719
5772
|
var _a;
|
|
5720
5773
|
const role = this.availableRoles.find((r2) => r2.id === roleId);
|
|
@@ -6336,6 +6389,9 @@ let JupiterFilterRolesDialog = class extends LitElement {
|
|
|
6336
6389
|
${dimensions.map((dimension) => {
|
|
6337
6390
|
var _a2, _b;
|
|
6338
6391
|
const allMembers = this._getAllDimensionMembers(dimension.members);
|
|
6392
|
+
if (allMembers.length === 0) {
|
|
6393
|
+
return html``;
|
|
6394
|
+
}
|
|
6339
6395
|
const dimensionLabel = ((_b = (_a2 = dimension.labels) == null ? void 0 : _a2.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _b.label) || dimension.conceptName;
|
|
6340
6396
|
const isSingleMember = this._isSingleMemberDimension(dimension);
|
|
6341
6397
|
return html`
|
|
@@ -7137,6 +7193,7 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7137
7193
|
console.log("🌐 Using language:", this.language);
|
|
7138
7194
|
this._initializePeriodPreferencesFromData();
|
|
7139
7195
|
this._applyAxisFilterToPeriodPreferences();
|
|
7196
|
+
this._applyDimensionShowPreviousYear();
|
|
7140
7197
|
console.log("⚙️ Using period preferences:", this._periodPreferences);
|
|
7141
7198
|
this._currentSchema = XBRLFormBuilder.buildFormSchema(
|
|
7142
7199
|
this.xbrlInput,
|
|
@@ -7477,6 +7534,41 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
7477
7534
|
}
|
|
7478
7535
|
this._periodPreferences = preferences;
|
|
7479
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
|
+
}
|
|
7480
7572
|
/**
|
|
7481
7573
|
* Helper method to extract roleIds from _selectedRoleIds
|
|
7482
7574
|
* Handles both legacy string[] and enhanced object[] structure
|
|
@@ -10300,16 +10392,21 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
10300
10392
|
<div class="error-popup-content">
|
|
10301
10393
|
<p>${I18n.t("error.popup.message")}</p>
|
|
10302
10394
|
<ul class="error-list">
|
|
10303
|
-
${this._xbrlFormErrors.map((error2) =>
|
|
10395
|
+
${this._xbrlFormErrors.map((error2) => {
|
|
10396
|
+
const concept = this._findConceptInAllSections(error2.conceptId);
|
|
10397
|
+
const column2 = this._findColumnById(error2.columnId);
|
|
10398
|
+
const fieldLabel = (concept == null ? void 0 : concept.label) || error2.conceptId;
|
|
10399
|
+
const columnTitle = (column2 == null ? void 0 : column2.title) || error2.columnId;
|
|
10400
|
+
return html`
|
|
10304
10401
|
<li>
|
|
10305
|
-
<strong>${I18n.t("error.popup.field")}</strong>
|
|
10306
|
-
<a
|
|
10307
|
-
href="javascript:void(0)"
|
|
10402
|
+
<strong>${I18n.t("error.popup.field")}</strong>
|
|
10403
|
+
<a
|
|
10404
|
+
href="javascript:void(0)"
|
|
10308
10405
|
class="error-field-link"
|
|
10309
10406
|
@click="${() => this._handleErrorFieldClick(error2.conceptId, error2.columnId, error2.sectionId)}"
|
|
10310
10407
|
title="${I18n.t("error.popup.clickToFocus")}"
|
|
10311
10408
|
>
|
|
10312
|
-
${
|
|
10409
|
+
${fieldLabel} (${columnTitle})
|
|
10313
10410
|
</a><br>
|
|
10314
10411
|
<strong>${I18n.t("error.popup.value")}</strong> ${error2.value}<br>
|
|
10315
10412
|
<strong>${I18n.t("error.popup.errors")}</strong>
|
|
@@ -10317,7 +10414,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
10317
10414
|
${error2.errors.map((err) => html`<li>${err.message}</li>`)}
|
|
10318
10415
|
</ul>
|
|
10319
10416
|
</li>
|
|
10320
|
-
|
|
10417
|
+
`;
|
|
10418
|
+
})}
|
|
10321
10419
|
</ul>
|
|
10322
10420
|
</div>
|
|
10323
10421
|
<div class="error-popup-footer">
|