jupiter-dynamic-forms 1.9.0 β†’ 1.9.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/README.md CHANGED
@@ -118,6 +118,114 @@ For complex XBRL taxonomies with many presentation roles, Jupiter Dynamic Forms
118
118
  - **Automatic Activation**: Filter button appears when more than 10 roles/sections are detected
119
119
  - **Smart Defaults**: First 10 roles are selected by default for optimal performance
120
120
  - **Interactive Dialog**: Easy-to-use modal for selecting which roles to display
121
+
122
+ ### 🌐 Multi-Language Support (New in v1.9.0)
123
+
124
+ Jupiter Dynamic Forms provides comprehensive multi-language support with intelligent fallback mechanisms:
125
+
126
+ #### Static Language Configuration
127
+ Set the language once during initialization:
128
+
129
+ ```html
130
+ <!-- Vanilla HTML -->
131
+ <jupiter-dynamic-form
132
+ language="nl"
133
+ period-start-date="2024-01-01"
134
+ period-end-date="2024-12-31">
135
+ </jupiter-dynamic-form>
136
+ ```
137
+
138
+ ```typescript
139
+ // Angular
140
+ @Component({
141
+ template: `
142
+ <jupiter-dynamic-form
143
+ [attr.language]="'nl'"
144
+ [attr.period-start-date]="periodStart"
145
+ [attr.period-end-date]="periodEnd">
146
+ </jupiter-dynamic-form>
147
+ `
148
+ })
149
+ export class MyComponent {
150
+ periodStart = '2024-01-01';
151
+ periodEnd = '2024-12-31';
152
+ }
153
+ ```
154
+
155
+ #### Dynamic Language Switching
156
+ Change language at runtime while preserving all form data:
157
+
158
+ ```html
159
+ <!-- HTML with language dropdown -->
160
+ <select id="language-select">
161
+ <option value="en">English</option>
162
+ <option value="nl">Nederlands</option>
163
+ <option value="de">Deutsch</option>
164
+ <option value="fr">FranΓ§ais</option>
165
+ </select>
166
+
167
+ <jupiter-dynamic-form id="my-form"></jupiter-dynamic-form>
168
+
169
+ <script type="module">
170
+ const form = document.getElementById('my-form');
171
+ const languageSelect = document.getElementById('language-select');
172
+
173
+ // Method 1: Using the public API (recommended)
174
+ languageSelect.addEventListener('change', (e) => {
175
+ form.changeLanguage(e.target.value);
176
+ });
177
+
178
+ // Method 2: Setting the property directly
179
+ languageSelect.addEventListener('change', (e) => {
180
+ form.language = e.target.value; // Also works!
181
+ });
182
+ </script>
183
+ ```
184
+
185
+ ```typescript
186
+ // Angular with dynamic language switching
187
+ @Component({
188
+ template: `
189
+ <select [(ngModel)]="currentLanguage">
190
+ <option value="en">English</option>
191
+ <option value="nl">Nederlands</option>
192
+ <option value="de">Deutsch</option>
193
+ </select>
194
+
195
+ <jupiter-dynamic-form
196
+ #form
197
+ [attr.language]="currentLanguage">
198
+ </jupiter-dynamic-form>
199
+
200
+ <button (click)="changeToGerman()">Switch to German</button>
201
+ `
202
+ })
203
+ export class MyComponent {
204
+ @ViewChild('form') formElement!: ElementRef;
205
+ currentLanguage = 'en';
206
+
207
+ changeToGerman() {
208
+ // Option 1: Change property (triggers re-render automatically)
209
+ this.currentLanguage = 'de';
210
+
211
+ // Option 2: Use public API
212
+ // this.formElement.nativeElement.changeLanguage('de');
213
+ }
214
+ }
215
+ ```
216
+
217
+ #### Key Features
218
+ - **Data Preservation**: Form values are preserved when switching languages
219
+ - **Automatic Fallback**: Falls back to English if label not found in target language
220
+ - **Reactive Updates**: Labels update immediately when language changes
221
+ - **No Data Loss**: User input remains intact during language switches
222
+ - **Supported Languages**: Any ISO language code (en, nl, de, fr, es, it, pt, etc.)
223
+
224
+ #### Smart Label Selection
225
+ The system intelligently selects labels from XBRL taxonomy data:
226
+ 1. **Primary**: Labels matching the specified language (e.g., `lang="nl"`)
227
+ 2. **Fallback 1**: English labels (`lang="en"`)
228
+ 3. **Fallback 2**: First available label in any language
121
229
  - **Bulk Actions**: "Select All", "Select None", and "Reset" options
122
230
  - **Live Updates**: Form sections update immediately when filter is applied
123
231
  - **Role Count Badge**: Visual indicator showing selected vs. total roles (e.g., "8/15")
@@ -363,6 +471,7 @@ The component uses CSS custom properties for theming:
363
471
  | `validate()` | `boolean` | Validate form and return result |
364
472
  | `reset()` | `void` | Reset form to initial state |
365
473
  | `getState()` | `FormState` | Get complete form state |
474
+ | `changeLanguage(lang)` | `void` | Change language and re-render labels while preserving data |
366
475
 
367
476
  ### Events
368
477
 
@@ -40,6 +40,10 @@ export declare class JupiterDynamicForm extends LitElement {
40
40
  disconnectedCallback(): void;
41
41
  private _disposeServices;
42
42
  willUpdate(changedProperties: Map<string, any>): void;
43
+ /**
44
+ * Handle language change - rebuild schema with new language while preserving form data
45
+ */
46
+ private _handleLanguageChange;
43
47
  private _initializeForm;
44
48
  private _getDefaultSchema;
45
49
  private _getDefaultColumns;
@@ -64,6 +68,11 @@ export declare class JupiterDynamicForm extends LitElement {
64
68
  setData(data: FormData): void;
65
69
  reset(): void;
66
70
  validate(): boolean;
71
+ /**
72
+ * Change the form language and re-render labels while preserving data
73
+ * @param newLanguage - ISO language code (e.g., 'en', 'nl', 'de')
74
+ */
75
+ changeLanguage(newLanguage: string): void;
67
76
  static styles: import('lit').CSSResult;
68
77
  render(): import('lit-html').TemplateResult<1>;
69
78
  private _renderFormHeader;
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicFormRefactored.d.ts","sourceRoot":"","sources":["../../src/core/DynamicFormRefactored.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EACL,cAAc,EACd,QAAQ,EAER,eAAe,EACf,SAAS,EACT,eAAe,EAOhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AASrD,OAAO,gBAAgB,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAE/B;;;;;;;;;GASG;AACH,qBACa,kBAAmB,SAAQ,UAAU;IAIpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAM;IAC7B,WAAW,EAAE,QAAQ,CAAM;IAC1B,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAClB,e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O,CAAC,mBAAmB;IAY3B,OAAO,CAAC,0BAA0B;IA6BlC,iBAAiB;IAKjB,oBAAoB;IAKpB,OAAO,CAAC,gBAAgB;IAiBxB,UAAU,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAsB9C;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAyC7B,OAAO,CAAC,eAAe;IAsCvB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,gBAAgB;IA6DxB,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,gBAAgB;IA2BxB,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,uBAAuB;IASxB,OAAO,IAAI,QAAQ;IAInB,QAAQ,IAAI,SAAS;IAIrB,SAAS,IAAI,eAAe,EAAE;IAI9B,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAI7B,KAAK,IAAI,IAAI;IAIb,QAAQ,IAAI,OAAO;IAK1B;;;OAGG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAehD,MAAM,CAAC,MAAM,0BAqJX;IAMF,MAAM;IAsBN,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,mBAAmB;IAiC3B,OAAO,CAAC,kBAAkB;IA+B1B,OAAO,CAAC,mBAAmB;CAY5B"}
@@ -29,6 +29,10 @@ export declare class JupiterDynamicForm extends LitElement {
29
29
  static styles: import('lit').CSSResult;
30
30
  connectedCallback(): void;
31
31
  updated(changedProperties: Map<string, any>): void;
32
+ /**
33
+ * Handle language change - rebuild schema with new language while preserving form data
34
+ */
35
+ private _handleLanguageChange;
32
36
  private _initializeForm;
33
37
  private _getDefaultSchema;
34
38
  private _getDefaultColumns;
@@ -92,6 +96,11 @@ export declare class JupiterDynamicForm extends LitElement {
92
96
  validate(): boolean;
93
97
  reset(): void;
94
98
  getState(): FormState;
99
+ /**
100
+ * Change the form language and re-render labels while preserving data
101
+ * @param newLanguage - ISO language code (e.g., 'en', 'nl', 'de')
102
+ */
103
+ changeLanguage(newLanguage: string): void;
95
104
  render(): import('lit-html').TemplateResult<1>;
96
105
  }
97
106
  //# sourceMappingURL=dynamic-form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../src/core/dynamic-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EACL,cAAc,EACd,QAAQ,EAGR,SAAS,EACT,eAAe,EAOhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO,gBAAgB,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAE/B,qBACa,kBAAmB,SAAQ,UAAU;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAM;IAC7B,WAAW,EAAE,QAAQ,CAAM;IAC1B,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAClB,eAAe,SAAgB;IAC/B,aAAa,SAAgB;IAC7B,QAAQ,SAAQ;IAEnC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,kBAAkB,CAAgB;IAC1C,OAAO,CAAC,gBAAgB,CAA4D;IACpF,OAAO,CAAC,yBAAyB,CAA4D;IAC7F,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,OAAO,CAAyB;IACxC,OAA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,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,mBAAmB;IAmC3B,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,iCAAiC;IA6DzC,OAAO,CAAC,qBAAqB;IA0K7B,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,6BAA6B;IAmBrC,OAAO,CAAC,4BAA4B;IAmBpC,OAAO,CAAC,4BAA4B;IAYpC,OAAO,CAAC,0BAA0B;IA0DlC,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,aAAa;IAwBrB,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,uBAAuB;IAqB/B,OAAO,CAAC,iCAAiC;IAsBzC,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,2BAA2B;IA+BnC,OAAO,CAAC,4BAA4B;IAYpC,OAAO,CAAC,2BAA2B;IAgBnC,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,0BAA0B;IA+BlC,OAAO,CAAC,iCAAiC;IAiCzC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IA4BrC,OAAO,CAAC,6BAA6B;IA+HrC,OAAO,CAAC,YAAY;IAqBpB,OAAO,CAAC,aAAa;IAYd,OAAO,IAAI,QAAQ;IAInB,OAAO,CAAC,IAAI,EAAE,QAAQ;IAOtB,QAAQ,IAAI,OAAO;IAKnB,KAAK;IAIL,QAAQ,IAAI,SAAS;IAI5B;;;OAGG;IACI,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAWhD,MAAM;CAwHP"}
package/dist/index.js CHANGED
@@ -206,7 +206,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
206
206
  margin: 0;
207
207
  width: auto;
208
208
  }
209
- `,k([w({type:Object})],exports.JupiterFormField.prototype,"field",2),k([w({type:String})],exports.JupiterFormField.prototype,"conceptId",2),k([w({type:String})],exports.JupiterFormField.prototype,"columnId",2),k([w()],exports.JupiterFormField.prototype,"value",2),k([w({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),k([w({type:String})],exports.JupiterFormField.prototype,"locale",2),k([w({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),k([S()],exports.JupiterFormField.prototype,"_errors",2),k([S()],exports.JupiterFormField.prototype,"_touched",2),exports.JupiterFormField=k([t("jupiter-form-field")],exports.JupiterFormField);var j=Object.defineProperty,L=Object.getOwnPropertyDescriptor,A=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?L(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&j(t,i,s),s};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.disabled=!1,this.locale="en-US",this.expandedConcepts=new Set,this._expanded=!0}connectedCallback(){super.connectedCallback(),this._expanded=this.expandedConcepts.has(this.concept.id)}willUpdate(e){super.willUpdate(e),e.has("expandedConcepts")&&(this._expanded=this.expandedConcepts.has(this.concept.id))}_toggleExpanded(){this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("concept-expand",{detail:{conceptId:this.concept.id,expanded:this._expanded},bubbles:!0}))}_getFieldForColumn(e){var t;return null==(t=this.concept.fields)?void 0:t.find(t=>t.columnId===e)}_getFieldValue(e){var t;return null==(t=this.formData[this.concept.id])?void 0:t[e.columnId]}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}render(){const t=this.concept.children&&this.concept.children.length>0,i=this.concept.level||0,o=this.concept.abstract||!1;return e.html`
209
+ `,k([w({type:Object})],exports.JupiterFormField.prototype,"field",2),k([w({type:String})],exports.JupiterFormField.prototype,"conceptId",2),k([w({type:String})],exports.JupiterFormField.prototype,"columnId",2),k([w()],exports.JupiterFormField.prototype,"value",2),k([w({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),k([w({type:String})],exports.JupiterFormField.prototype,"locale",2),k([w({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),k([S()],exports.JupiterFormField.prototype,"_errors",2),k([S()],exports.JupiterFormField.prototype,"_touched",2),exports.JupiterFormField=k([t("jupiter-form-field")],exports.JupiterFormField);var j=Object.defineProperty,L=Object.getOwnPropertyDescriptor,R=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?L(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&j(t,i,s),s};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.disabled=!1,this.locale="en-US",this.expandedConcepts=new Set,this._expanded=!0}connectedCallback(){super.connectedCallback(),this._expanded=this.expandedConcepts.has(this.concept.id)}willUpdate(e){super.willUpdate(e),e.has("expandedConcepts")&&(this._expanded=this.expandedConcepts.has(this.concept.id))}_toggleExpanded(){this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("concept-expand",{detail:{conceptId:this.concept.id,expanded:this._expanded},bubbles:!0}))}_getFieldForColumn(e){var t;return null==(t=this.concept.fields)?void 0:t.find(t=>t.columnId===e)}_getFieldValue(e){var t;return null==(t=this.formData[this.concept.id])?void 0:t[e.columnId]}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}render(){const t=this.concept.children&&this.concept.children.length>0,i=this.concept.level||0,o=this.concept.abstract||!1;return e.html`
210
210
  <!-- Concept Name Cell (Left Column) -->
211
211
  <td class="concept-name-cell ${o?"abstract":t?"":"leaf"}">
212
212
  <div class="concept-content" style="--level: ${i}">
@@ -342,7 +342,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
342
342
  }
343
343
 
344
344
 
345
- `,A([w({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),A([w({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),A([w({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),A([w({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),A([w({type:String})],exports.JupiterConceptTree.prototype,"locale",2),A([w({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),A([S()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=A([t("jupiter-concept-tree")],exports.JupiterConceptTree);var R=Object.defineProperty,M=Object.getOwnPropertyDescriptor,P=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?M(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&R(t,i,s),s};exports.JupiterAddColumnDialog=class extends e.LitElement{constructor(){super(...arguments),this.periodType="duration",this.open=!1,this.availableDimensions=[],this._startDate="",this._endDate="",this._instantDate="",this._selectedType="duration",this._selectedDimensions=new Map}updated(e){e.has("open")&&this.open&&this._resetForm(),e.has("availableDimensions")}connectedCallback(){super.connectedCallback(),this._resetForm()}willUpdate(e){super.willUpdate(e),e.has("open")&&this.open&&this._resetForm()}_handleCancel(){this.open=!1,this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleConfirm(){if(!this._isFormValid())return;const e={periodType:"mixed"===this.periodType?this._selectedType:this.periodType};"instant"===this.periodType||"mixed"===this.periodType&&"instant"===this._selectedType?e.instantDate=this._instantDate:(e.startDate=this._startDate,e.endDate=this._endDate),this._selectedDimensions.size>0&&(e.selectedDimensions=Array.from(this._selectedDimensions.values())),this.dispatchEvent(new CustomEvent("column-add",{detail:e,bubbles:!0}))}_isFormValid(){return"mixed"===this.periodType?"instant"===this._selectedType?!!this._instantDate:!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"duration"===this.periodType?!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"instant"===this.periodType&&!!this._instantDate}_handleStartDateChange(e){this._startDate=e.target.value}_handleEndDateChange(e){this._endDate=e.target.value}_handleSelectedTypeChange(e){this._selectedType=e.target.value}_handleInstantDateChange(e){this._instantDate=e.target.value}_handleDimensionToggle(e,t){if(t.target.checked){const t=this.availableDimensions.find(t=>t.id===e);if(t){const i={axisId:t.id,axisLabel:t.axisLabel,isTyped:!(!t.typedMember||t.members&&0!==t.members.length)};this._selectedDimensions.set(e,i)}}else this._selectedDimensions.delete(e);this.requestUpdate()}_handleMemberSelection(e,t,i){const o=this._selectedDimensions.get(e);o&&(o.memberId=t,o.memberLabel=i,this._selectedDimensions.set(e,o),this.requestUpdate())}_handleTypedValueChange(e,t){const i=t.target,o=this._selectedDimensions.get(e);o&&(o.typedValue=i.value,this._selectedDimensions.set(e,o))}_resetForm(){const e=(new Date).toISOString().split("T")[0];this._startDate=e,this._endDate=e,this._instantDate=e,this._selectedType="instant"===this.periodType?"instant":"duration",this._selectedDimensions.clear(),this._autoSelectSingleMemberDimensions(),this.requestUpdate()}_autoSelectSingleMemberDimensions(){this.availableDimensions.forEach(e=>{if(e.members&&1===e.members.length){const t=e.members[0],i={axisId:e.id,axisLabel:e.axisLabel,memberId:t.id,memberLabel:t.label,isTyped:!1};this._selectedDimensions.set(e.id,i)}else if(e.typedMember&&(!e.members||0===e.members.length)){const t={axisId:e.id,axisLabel:e.axisLabel,isTyped:!0};this._selectedDimensions.set(e.id,t)}})}render(){if(!this.open)return e.html``;const t=this._isFormValid();return e.html`
345
+ `,R([w({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),R([w({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),R([w({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),R([w({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),R([w({type:String})],exports.JupiterConceptTree.prototype,"locale",2),R([w({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),R([S()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=R([t("jupiter-concept-tree")],exports.JupiterConceptTree);var A=Object.defineProperty,M=Object.getOwnPropertyDescriptor,P=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?M(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&A(t,i,s),s};exports.JupiterAddColumnDialog=class extends e.LitElement{constructor(){super(...arguments),this.periodType="duration",this.open=!1,this.availableDimensions=[],this._startDate="",this._endDate="",this._instantDate="",this._selectedType="duration",this._selectedDimensions=new Map}updated(e){e.has("open")&&this.open&&this._resetForm(),e.has("availableDimensions")}connectedCallback(){super.connectedCallback(),this._resetForm()}willUpdate(e){super.willUpdate(e),e.has("open")&&this.open&&this._resetForm()}_handleCancel(){this.open=!1,this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleConfirm(){if(!this._isFormValid())return;const e={periodType:"mixed"===this.periodType?this._selectedType:this.periodType};"instant"===this.periodType||"mixed"===this.periodType&&"instant"===this._selectedType?e.instantDate=this._instantDate:(e.startDate=this._startDate,e.endDate=this._endDate),this._selectedDimensions.size>0&&(e.selectedDimensions=Array.from(this._selectedDimensions.values())),this.dispatchEvent(new CustomEvent("column-add",{detail:e,bubbles:!0}))}_isFormValid(){return"mixed"===this.periodType?"instant"===this._selectedType?!!this._instantDate:!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"duration"===this.periodType?!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"instant"===this.periodType&&!!this._instantDate}_handleStartDateChange(e){this._startDate=e.target.value}_handleEndDateChange(e){this._endDate=e.target.value}_handleSelectedTypeChange(e){this._selectedType=e.target.value}_handleInstantDateChange(e){this._instantDate=e.target.value}_handleDimensionToggle(e,t){if(t.target.checked){const t=this.availableDimensions.find(t=>t.id===e);if(t){const i={axisId:t.id,axisLabel:t.axisLabel,isTyped:!(!t.typedMember||t.members&&0!==t.members.length)};this._selectedDimensions.set(e,i)}}else this._selectedDimensions.delete(e);this.requestUpdate()}_handleMemberSelection(e,t,i){const o=this._selectedDimensions.get(e);o&&(o.memberId=t,o.memberLabel=i,this._selectedDimensions.set(e,o),this.requestUpdate())}_handleTypedValueChange(e,t){const i=t.target,o=this._selectedDimensions.get(e);o&&(o.typedValue=i.value,this._selectedDimensions.set(e,o))}_resetForm(){const e=(new Date).toISOString().split("T")[0];this._startDate=e,this._endDate=e,this._instantDate=e,this._selectedType="instant"===this.periodType?"instant":"duration",this._selectedDimensions.clear(),this._autoSelectSingleMemberDimensions(),this.requestUpdate()}_autoSelectSingleMemberDimensions(){this.availableDimensions.forEach(e=>{if(e.members&&1===e.members.length){const t=e.members[0],i={axisId:e.id,axisLabel:e.axisLabel,memberId:t.id,memberLabel:t.label,isTyped:!1};this._selectedDimensions.set(e.id,i)}else if(e.typedMember&&(!e.members||0===e.members.length)){const t={axisId:e.id,axisLabel:e.axisLabel,isTyped:!0};this._selectedDimensions.set(e.id,t)}})}render(){if(!this.open)return e.html``;const t=this._isFormValid();return e.html`
346
346
  <div class="dialog" @click="${e=>e.stopPropagation()}">
347
347
  <div class="dialog-header">
348
348
  <h2 class="dialog-title">Add Column</h2>
@@ -1534,7 +1534,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
1534
1534
  opacity: 0.6;
1535
1535
  cursor: not-allowed;
1536
1536
  }
1537
- `,V([w({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),V([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),V([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),V([S()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),V([S()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),V([S()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),exports.JupiterFilterRolesDialog=V([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var q=Object.defineProperty,K=Object.getOwnPropertyDescriptor,B=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?K(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&q(t,i,s),s};exports.JupiterDynamicForm=class extends e.LitElement{constructor(){super(...arguments),this.config={},this.initialData={},this.disabled=!1,this.readonly=!1,this.periodStartDate="2025-01-01",this.periodEndDate="2025-12-31",this.language="en",this._formData={},this._preservedFormData={},this._typedMemberData={},this._preservedTypedMemberData={},this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._allSections=[],this._selectedRoleIds=[],this._showFilterDialog=!1}connectedCallback(){super.connectedCallback(),this._initializeForm()}updated(e){(e.has("xbrlInput")||e.has("schema"))&&this._initializeForm()}_initializeForm(){var e;if(this.xbrlInput)try{console.log("πŸ”„ Initializing form from XBRL input:",this.xbrlInput),console.log("πŸ“… Using period dates:",this.periodStartDate,"to",this.periodEndDate),console.log("🌐 Using language:",this.language),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language),console.log("βœ… Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],0===this._selectedRoleIds.length&&(this._selectedRoleIds=[],this._showFilterDialog=!0,this._currentSchema={...this._currentSchema,sections:[]}),this._applyRoleFilter(),this._columns=[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}catch(t){console.error("❌ Error building form from XBRL input:",t),this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns()}else this.schema?(this._currentSchema=this.schema,this._allSections=[...this.schema.sections],this._selectedRoleIds=this._allSections.map(e=>e.id),this._columns=this._getDefaultColumns()):(this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns());this._formData={...this.initialData},(null==(e=this.xbrlInput)?void 0:e.initialData)&&(this._formData={...this._formData,...this.xbrlInput.initialData}),this._validateForm()}_getDefaultSchema(){return{version:"1.0",formId:"default-form",title:"Dynamic Form",description:"Please provide form schema or XBRL input data",sections:[]}}_getDefaultColumns(){return[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}_applyRoleFilter(){if(!this._currentSchema||!this._allSections.length)return;if(console.log(`πŸ” Applying role filter: ${this._selectedRoleIds.length} selected out of ${this._allSections.length} total`),0===this._selectedRoleIds.length)return console.log("πŸ“ No roles selected - showing empty form"),void(this._currentSchema={...this._currentSchema,sections:[]});this._preserveDataForHiddenSections();const e=this._allSections.filter(e=>this._selectedRoleIds.includes(e.id));this._restoreDataForVisibleSections(e),this._currentSchema={...this._currentSchema,sections:e}}_preserveDataForHiddenSections(){var e;const t=((null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[]).filter(e=>!this._selectedRoleIds.includes(e));t.forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(t)}),console.log(`πŸ“¦ Preserved data for ${t.length} hidden sections:`,t)}_restoreDataForVisibleSections(e){e.forEach(e=>{this._restoreSectionData(e)}),console.log(`πŸ”„ Restored data for ${e.length} visible sections`)}_preserveSectionData(e){e.concepts.forEach(e=>{this._preserveConceptData(e)})}_preserveConceptData(e){this._formData[e.id]&&(this._preservedFormData[e.id]={...this._formData[e.id]},console.log(`πŸ’Ύ Preserved form data for concept: ${e.id}`)),e.fields.forEach(e=>{this._typedMemberData[e.columnId]&&(this._preservedTypedMemberData[e.columnId]={...this._typedMemberData[e.columnId]},console.log(`πŸ’Ύ Preserved typed data for column: ${e.columnId}`))}),e.children&&e.children.forEach(e=>{this._preserveConceptData(e)})}_restoreSectionData(e){e.concepts.forEach(e=>{this._restoreConceptData(e)})}_restoreConceptData(e){this._preservedFormData[e.id]&&(this._formData[e.id]={...this._preservedFormData[e.id]},console.log(`πŸ”„ Restored form data for concept: ${e.id}`)),e.fields.forEach(e=>{this._preservedTypedMemberData[e.columnId]&&(this._typedMemberData[e.columnId]={...this._preservedTypedMemberData[e.columnId]},console.log(`πŸ”„ Restored typed data for column: ${e.columnId}`))}),e.children&&e.children.forEach(e=>{this._restoreConceptData(e)})}_shouldShowFilterButton(){return!0}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleFilterDialogCancel(){this._showFilterDialog=!1,console.log(`🚫 Filter dialog cancelled. Current selection: ${this._selectedRoleIds.length}/${this._allSections.length}`)}_handleRoleFilterApply(e){const{selectedRoleIds:t}=e.detail;this._selectedRoleIds=t,this._applyRoleFilter(),this._showFilterDialog=!1,console.log(`🎯 Applied role filter: ${t.length}/${this._allSections.length} roles selected`),this.dispatchEvent(new CustomEvent("roles-filter-changed",{detail:{selectedRoleIds:t,totalRoles:this._allSections.length,visibleRoles:t.length},bubbles:!0}))}_validateForm(){var e;const t=[],i=this._currentSchema;if(i){for(const o of i.sections)for(const i of o.concepts)for(const o of i.fields){const r=null==(e=this._formData[i.id])?void 0:e[o.columnId],s=C.validateField(o.id,i.id,o.columnId,r,o.type,o.validation||[]);t.push(...s)}this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleFieldChange(e){const{fieldId:t,conceptId:i,columnId:o,value:r}=e.detail,s={...this._formData};s[i]||(s[i]={});const n=s[i][o];s[i]={...s[i],[o]:r},this._formData=s,this._touched.add(`${i}-${o}`),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:i,columnId:o,value:r,oldValue:n},bubbles:!0}))}_generateUniqueConceptKey(e,t){return`${e}::${t}`}_extractOriginalConceptId(e){const t=e.split("::");return t.length>1?t[1]:e}_handleTypedMemberChange(e){const{columnId:t,axisId:i,value:o}=e.detail;console.log(`πŸ” [DynamicForm] Typed member change: columnId=${t}, axisId=${i}, value=${o}`);const r={...this._typedMemberData};r[t]||(r[t]={}),r[t]={...r[t],[i]:o},this._typedMemberData=r,this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}_handleSectionExpand(e){this.dispatchEvent(new CustomEvent("section-expand",{detail:e.detail,bubbles:!0}))}_handleConceptExpand(e){this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_handleColumnRemove(e){const{columnId:t,sectionId:i}=e.detail;if(this._currentSchema&&i){const e=this._currentSchema.sections.find(e=>e.id===i);e&&e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))}else this._columns=this._columns.filter(e=>e.id!==t),this._currentSchema&&this._currentSchema.sections.forEach(e=>{e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))});this._removeColumnData(t,i),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:t,sectionId:i},bubbles:!0}))}_handleColumnAddRequest(e){const{sectionId:t,columnRequest:i}=e.detail;this._addColumnFromRequest(i,t)}_getAvailableDimensionsForSection(e){var t,i,o;if(console.log(`πŸ” Getting dimensions for section: ${e}`),!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return console.log("❌ No hypercubes data available"),[];const r=this.xbrlInput.hypercubes[0].roles.find(t=>t.roleId===e);if(!(null==(o=null==r?void 0:r.items)?void 0:o.length))return console.log(`❌ No hypercube items found for role: ${e}`),[];console.log(`βœ… Found hypercube role with ${r.items.length} items`);const s=[];return r.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{var t;if(!s.find(t=>t.id===e.id)){const i=(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName,o={id:e.id,conceptName:e.conceptName,axisLabel:i};e.members&&e.members.length>0&&(o.members=e.members.map(e=>{var t,i;return{id:e.id,label:(null==(i=null==(t=e.labels)?void 0:t.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:i.label)||e.conceptName||e.id}})),e.typedMember&&(o.typedMember={id:e.typedMember.id,dataType:"string"}),s.push(o)}})}),console.log(`πŸ“ˆ Found ${s.length} dimensions for section ${e}:`,s.map(e=>e.axisLabel)),s}_addColumnFromRequest(e,t){var i,o,r,s,n;const a=`col-${Date.now()}`;let l="",d="";"instant"===e.periodType?(l="Current",d=`Values as of ${e.instantDate}`):"duration"!==e.periodType&&"mixed"!==e.periodType||(l="Current Period",d=`Period: ${e.startDate} to ${e.endDate}`);let c={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:l};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t=[],i=[];for(const r of e.selectedDimensions)r.isTyped&&r.typedValue?(t.push(`${r.axisLabel}: ${r.typedValue}`),i.push(`${r.axisId}|${r.typedValue}`)):r.memberId&&r.memberLabel&&(t.push(r.memberLabel),i.push(`${r.axisId}|${r.memberId}`));const o="instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`;t.length>0&&(l=`${t.join(" | ")} ${o}`,c={dimensionId:a,memberValue:t.join(" | "),memberLabel:t.join(" | "),memberKey:t.join(" | "),dimensionIdKey:i.join("::"),selectedDimensions:e.selectedDimensions},console.log(`πŸ“Š Applied selected dimensions to new column: ${c.memberKey}`))}else if(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(r=null==i?void 0:i.items)?void 0:r.length)){const t=i.items[0];if(1===t.dimensions.length){const i=t.dimensions[0];if(i.members&&i.members.length>0){const t=(null==(s=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||i.conceptName,o=i.members[0],r=(null==(n=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||o.conceptName;l=`${r} ${"instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`}`,c={dimensionId:a,axisId:i.id,memberId:o.id,memberValue:r,memberLabel:r,axis:t,axisLabel:t,memberKey:`${t} | ${r}`,dimensionIdKey:`${i.id} | ${o.id}`},console.log(`πŸ“Š Applied hypercube dimension to new column: ${c.memberKey}`)}}}}const p={id:a,title:l,description:d,type:(c.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:c};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t={};let i=!1;for(const o of e.selectedDimensions)o.isTyped&&(t[o.axisId]=o.typedValue||"",i=!0,console.log(`πŸ’Ύ Initializing typed member data: ${o.axisLabel} = "${o.typedValue||"(empty - will be entered in column header)"}"`));i&&(this._typedMemberData[a]=t,p.dimensionData&&(p.dimensionData.hasTypedMembers=!0,p.dimensionData.typedMembers=e.selectedDimensions.filter(e=>e.isTyped).map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.axisId,memberLabel:e.axisLabel})),console.log("οΏ½ Added typed members to column dimension data:",p.dimensionData.typedMembers)),console.log(`οΏ½ Initialized typed member data for column ${a}:`,t))}if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);e&&(e.columns||(e.columns=[...this._columns]),e.columns=[...e.columns,p])}this._replicateFieldsForNewColumn(a,e,t),this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:p},bubbles:!0}))}_removeColumnData(e,t){if(this._currentSchema)if(t){const i=this._currentSchema.sections.find(e=>e.id===t);i&&this._removeColumnDataFromConcepts(i.concepts,e)}else for(const i in this._formData)void 0!==this._formData[i][e]&&delete this._formData[i][e]}_removeColumnDataFromConcepts(e,t){e.forEach(e=>{this._formData[e.id]&&void 0!==this._formData[e.id][t]&&delete this._formData[e.id][t],e.fields&&(e.fields=e.fields.filter(e=>e.columnId!==t)),e.children&&this._removeColumnDataFromConcepts(e.children,t)})}_shouldCreateFieldForConcept(e,t){if(e.abstract)return!1;if(e.periodType){if("instant"===t.periodType&&"instant"!==e.periodType)return!1;if("duration"===t.periodType&&"duration"!==e.periodType)return!1}return!0}_replicateFieldsForNewColumn(e,t,i){if(!this._currentSchema)return;const o=new F,r=this._currentSchema.sections.find(e=>e.id===i);r&&this._replicateFieldsForSection(r.concepts,e,t,o)}_replicateFieldsForSection(e,t,i,o){e.forEach(e=>{var r;if(this._shouldCreateFieldForConcept(e,i)){const o=null==(r=e.fields)?void 0:r[0];let s;s=o?{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:o.type,label:o.label,placeholder:o.placeholder,required:o.required,disabled:o.disabled,validation:o.validation,defaultValue:o.defaultValue,periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate}:{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:"text",label:e.label||e.name,placeholder:`Enter ${e.name}`,required:!1,disabled:!1,validation:[],defaultValue:"",periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate},e.fields||(e.fields=[]),e.fields.push(s)}e.children&&this._replicateFieldsForSection(e.children,t,i,o)})}_addColumn(){const e={id:`dim-${Date.now()}`,title:`Dimension ${this._columns.length}`,description:"Additional dimension column",type:"dimension",order:this._columns.length,removable:!0,dimensionData:{dimensionId:"custom",memberValue:"default",memberLabel:"Default Member"}};this._columns=[...this._columns,e],this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:e},bubbles:!0}))}_handleSubmit(){console.log("πŸ“ Form submission started..."),this._submitted=!0,this._validateForm();const e=this._generateSubmissionData();console.log("πŸ“Š Form Submission Data:",JSON.stringify(e,null,2)),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors},bubbles:!0})),console.log("βœ… Form submit event dispatched")}_handleSaveDraft(){const e=this._generateSubmissionData();this.dispatchEvent(new CustomEvent("form-save-draft",{detail:{data:this._formData,draftData:e,valid:this._valid,errors:this._errors},bubbles:!0}))}_generateSubmissionData(){const e=[];if(!this._currentSchema)return e;this._currentSchema.sections.forEach(t=>{this._processConceptsForSubmission(t.concepts,e,t)}),this._includePreservedDataInSubmission(e);return this._removeDuplicateSubmissions(e)}_includePreservedDataInSubmission(e){Object.keys(this._preservedFormData).forEach(t=>{const i=this._preservedFormData[t];i&&Object.keys(i).forEach(o=>{const r=i[o];if(null!=r&&""!==r){const i=this._findConceptInAllSections(t);if(i){const s=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,o,r,e,s||void 0)}}})}),console.log(`πŸ“€ Included preserved data in submission. Total entries: ${e.length}`)}_findConceptInAllSections(e){for(const t of this._allSections){const i=this._findConceptInSection(t.concepts,e);if(i)return i}return null}_findConceptInSection(e,t){for(const i of e){if(i.id===t)return i;if(i.children){const e=this._findConceptInSection(i.children,t);if(e)return e}}return null}_findSectionForConcept(e){for(const t of this._allSections){if(this._findConceptInSection(t.concepts,e))return t}return null}_addConceptDataToSubmission(e,t,i,o,r){var s;const n=e.fields.find(e=>e.columnId===t);if(!n)return;const a="instant"===e.periodType,l={conceptId:e.originalConceptId||e.id,value:i,period:{type:e.periodType||"duration",...a?{date:n.periodStartDate||this.periodStartDate}:{startDate:n.periodStartDate||this.periodStartDate,endDate:n.periodEndDate||this.periodEndDate}}},d=this._findColumnByIdInAllSections(t);(null==(s=null==d?void 0:d.dimensionData)?void 0:s.memberLabel)&&(l.dimension=d.dimensionData.memberLabel),o.push(l)}_findColumnByIdInAllSections(e){for(const t of this._allSections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_removeDuplicateSubmissions(e){const t=new Map;return e.forEach(e=>{const i=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}`;t.has(i)||t.set(i,e)}),Array.from(t.values())}_findColumnById(e){if(this._currentSchema)for(const t of this._currentSchema.sections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_findColumnByIdInSection(e,t){if(null==t?void 0:t.columns)return t.columns.find(t=>t.id===e)}_getTypedMemberNameForAxis(e,t){var i,o,r,s;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]))return null;const n=null==t?void 0:t.id;if(!n)return null;const a=null==(r=this.xbrlInput.hypercubes[0].roles)?void 0:r.find(e=>e.roleId===n);if(!(null==a?void 0:a.items))return null;for(const l of a.items)if(l.dimensions){const t=l.dimensions.find(t=>t.id===e);if(null==(s=null==t?void 0:t.typedMember)?void 0:s.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var o,r,s;if(!(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]))return!1;const n=null==t?void 0:t.id;if(!n)return!1;const a=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===n);if(!(null==(s=null==a?void 0:a.items)?void 0:s.length))return!1;for(const l of a.items){const t=e.originalConceptId||e.id;if(l.conceptIds&&l.conceptIds.includes(t)){const e=l.dimensions.some(e=>e.typedMember);return console.log(`πŸ” [DynamicForm] Concept ${t} found in hypercube item. Has typed dimensions:`,e),e}}return console.log(`πŸ” [DynamicForm] Concept ${e.originalConceptId||e.id} not found in any hypercube items for role ${n}`),!1}_getApplicableTypedDimensions(e,t){var i,o,r;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0])||!(null==t?void 0:t.id))return[];const s=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(r=null==s?void 0:s.items)?void 0:r.length))return[];const n=e.originalConceptId||e.id;for(const a of s.items)if(a.conceptIds&&a.conceptIds.includes(n)){const e=a.dimensions.filter(e=>e.typedMember).map(e=>e.id);return console.log(`πŸ” [DynamicForm] Found applicable typed dimensions for concept ${n}:`,e),e}return[]}_processConceptsForSubmission(e,t,i){const o="Toelichting op de geconsolideerde jaarrekening - FinanciΓ«le vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie",r=(null==i?void 0:i.title)||"Unknown";e.forEach(e=>{r===o&&(console.warn(`[DUPLICATE DEBUG] Processing concept ${e.originalConceptId||e.id} in target role`),e.fields&&(console.warn(`[DUPLICATE DEBUG] Concept has ${e.fields.length} fields`),e.fields.forEach((t,i)=>{var o;console.warn(`[DUPLICATE DEBUG] Field ${i}: columnId=${t.columnId}, current value=${null==(o=this._formData[e.id])?void 0:o[t.columnId]}`)}))),e.fields&&e.fields.length>1&&(console.log(`πŸ” [DEBUG] Processing concept ${e.originalConceptId}, fields count: ${e.fields.length}`),e.fields.forEach((t,i)=>{var o;console.log(` Field ${i}: columnId=${t.columnId}, value=${null==(o=this._formData[e.id])?void 0:o[t.columnId]}`)})),e.fields&&e.fields.length>0&&e.fields.forEach(s=>{var n,a;const l=this._formData[e.id],d=null==l?void 0:l[s.columnId];if(null!=d&&""!==d){r===o&&console.warn(`[DUPLICATE DEBUG] Creating submission entry for concept ${e.originalConceptId||e.id}, field columnId=${s.columnId}, value=${d}`);const l=this._findColumnByIdInSection(s.columnId,i);console.log(`πŸ” [DynamicForm] Processing field for concept ${e.originalConceptId||e.id}, field columnId: ${s.columnId}, found column in section ${null==i?void 0:i.id}: ${!!l}, column title: ${null==l?void 0:l.title}`);const c={conceptId:e.id,value:d,period:{type:e.periodType||"duration"}};if("instant"===e.periodType?c.period.date=s.periodStartDate||this.periodStartDate:(c.period.startDate=s.periodStartDate||this.periodStartDate,c.period.endDate=s.periodEndDate||this.periodEndDate),"dimension"===(null==l?void 0:l.type)&&(null==(n=l.dimensionData)?void 0:n.dimensionIdKey)?(c.dimension=l.dimensionData.dimensionIdKey,console.log(`πŸ” [DynamicForm] Using dimension key from field's column (${s.columnId}):`,l.dimensionData.dimensionIdKey)):console.log(`πŸ” [DynamicForm] No dimension data found for field column ${s.columnId}. Column type: ${null==l?void 0:l.type}, has dimensionData: ${!!(null==l?void 0:l.dimensionData)}`),this._typedMemberData[s.columnId]){const t=this._getApplicableTypedDimensions(e,i);if(console.log(`πŸ” [DynamicForm] Concept ${e.id} applicable typed dimensions:`,t),t.length>0){const e={},o=this._typedMemberData[s.columnId];t.forEach(t=>{if(o[t]){const r=this._getTypedMemberNameForAxis(t,i);e[t]={value:o[t],memberName:r||"Unknown"}}}),Object.keys(e).length>0?(c.typedMembers=e,console.log("πŸ” [DynamicForm] Adding filtered typed members to submission:",e)):console.log("πŸ” [DynamicForm] No typed member values found for applicable dimensions:",t)}else console.log(`πŸ” [DynamicForm] Skipping typed members for concept ${e.id} - not applicable to this hypercube`)}else console.log(`πŸ” [DynamicForm] No typed member data found for column ${s.columnId}. Available columns:`,Object.keys(this._typedMemberData)),l&&console.log("πŸ” [DynamicForm] Column details:",{id:l.id,type:l.type,hasTypedMembers:null==(a=l.dimensionData)?void 0:a.hasTypedMembers,dimensionData:l.dimensionData});r===o&&console.warn("[DUPLICATE DEBUG] Final submission entry:",c),t.push(c)}}),e.children&&this._processConceptsForSubmission(e.children,t,i)})}_handleReset(){this._formData={...this.initialData},this._touched.clear(),this._dirty=!1,this._submitted=!1,this._preservedFormData={},this._preservedTypedMemberData={},console.log("πŸ”„ Form reset - all data and preserved data cleared"),this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("form-reset",{detail:{},bubbles:!0}))}_getFormState(){return{data:this._formData,errors:this._errors,touched:this._touched,dirty:this._dirty,valid:this._valid,submitted:this._submitted}}getData(){return{...this._formData}}setData(e){this._formData={...e},this._dirty=!0,this._validateForm(),this.requestUpdate()}validate(){return this._validateForm(),this._valid}reset(){this._handleReset()}getState(){return this._getFormState()}render(){const t=this._errors.filter(e=>"error"===e.severity).length,i=this.config||{},o=!1!==i.showValidationSummary&&t>0&&this._submitted,r=this._currentSchema;return r?e.html`
1537
+ `,V([w({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),V([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),V([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),V([S()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),V([S()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),V([S()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),exports.JupiterFilterRolesDialog=V([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var q=Object.defineProperty,K=Object.getOwnPropertyDescriptor,B=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?K(t,i):t,n=e.length-1;n>=0;n--)(r=e[n])&&(s=(o?r(t,i,s):r(s))||s);return o&&s&&q(t,i,s),s};exports.JupiterDynamicForm=class extends e.LitElement{constructor(){super(...arguments),this.config={},this.initialData={},this.disabled=!1,this.readonly=!1,this.periodStartDate="2025-01-01",this.periodEndDate="2025-12-31",this.language="en",this._formData={},this._preservedFormData={},this._typedMemberData={},this._preservedTypedMemberData={},this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._allSections=[],this._selectedRoleIds=[],this._showFilterDialog=!1}connectedCallback(){super.connectedCallback(),this._initializeForm()}updated(e){e.has("xbrlInput")||e.has("schema")?this._initializeForm():e.has("language")&&(console.log("🌐 Language changed from",e.get("language"),"to",this.language),this._handleLanguageChange())}_handleLanguageChange(){if(this.xbrlInput)try{const e={...this._formData},t={...this._preservedFormData},i={...this._typedMemberData},o={...this._preservedTypedMemberData},r=[...this._selectedRoleIds];console.log("πŸ’Ύ Preserving form data during language change:",e),console.log("πŸ”„ Rebuilding form schema with language:",this.language),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language),this._allSections=[...this._currentSchema.sections],this._selectedRoleIds=r,this._applyRoleFilter(),this._formData=e,this._preservedFormData=t,this._typedMemberData=i,this._preservedTypedMemberData=o,console.log("βœ… Language changed successfully, form data preserved"),this.requestUpdate()}catch(e){console.error("❌ Error changing language:",e)}else console.warn("⚠️ Cannot change language without XBRL input data")}_initializeForm(){var e;if(this.xbrlInput)try{console.log("πŸ”„ Initializing form from XBRL input:",this.xbrlInput),console.log("πŸ“… Using period dates:",this.periodStartDate,"to",this.periodEndDate),console.log("🌐 Using language:",this.language),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language),console.log("βœ… Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],0===this._selectedRoleIds.length&&(this._selectedRoleIds=[],this._showFilterDialog=!0,this._currentSchema={...this._currentSchema,sections:[]}),this._applyRoleFilter(),this._columns=[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}catch(t){console.error("❌ Error building form from XBRL input:",t),this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns()}else this.schema?(this._currentSchema=this.schema,this._allSections=[...this.schema.sections],this._selectedRoleIds=this._allSections.map(e=>e.id),this._columns=this._getDefaultColumns()):(this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns());this._formData={...this.initialData},(null==(e=this.xbrlInput)?void 0:e.initialData)&&(this._formData={...this._formData,...this.xbrlInput.initialData}),this._validateForm()}_getDefaultSchema(){return{version:"1.0",formId:"default-form",title:"Dynamic Form",description:"Please provide form schema or XBRL input data",sections:[]}}_getDefaultColumns(){return[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}_applyRoleFilter(){if(!this._currentSchema||!this._allSections.length)return;if(console.log(`πŸ” Applying role filter: ${this._selectedRoleIds.length} selected out of ${this._allSections.length} total`),0===this._selectedRoleIds.length)return console.log("πŸ“ No roles selected - showing empty form"),void(this._currentSchema={...this._currentSchema,sections:[]});this._preserveDataForHiddenSections();const e=this._allSections.filter(e=>this._selectedRoleIds.includes(e.id));this._restoreDataForVisibleSections(e),this._currentSchema={...this._currentSchema,sections:e}}_preserveDataForHiddenSections(){var e;const t=((null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[]).filter(e=>!this._selectedRoleIds.includes(e));t.forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(t)}),console.log(`πŸ“¦ Preserved data for ${t.length} hidden sections:`,t)}_restoreDataForVisibleSections(e){e.forEach(e=>{this._restoreSectionData(e)}),console.log(`πŸ”„ Restored data for ${e.length} visible sections`)}_preserveSectionData(e){e.concepts.forEach(e=>{this._preserveConceptData(e)})}_preserveConceptData(e){this._formData[e.id]&&(this._preservedFormData[e.id]={...this._formData[e.id]},console.log(`πŸ’Ύ Preserved form data for concept: ${e.id}`)),e.fields.forEach(e=>{this._typedMemberData[e.columnId]&&(this._preservedTypedMemberData[e.columnId]={...this._typedMemberData[e.columnId]},console.log(`πŸ’Ύ Preserved typed data for column: ${e.columnId}`))}),e.children&&e.children.forEach(e=>{this._preserveConceptData(e)})}_restoreSectionData(e){e.concepts.forEach(e=>{this._restoreConceptData(e)})}_restoreConceptData(e){this._preservedFormData[e.id]&&(this._formData[e.id]={...this._preservedFormData[e.id]},console.log(`πŸ”„ Restored form data for concept: ${e.id}`)),e.fields.forEach(e=>{this._preservedTypedMemberData[e.columnId]&&(this._typedMemberData[e.columnId]={...this._preservedTypedMemberData[e.columnId]},console.log(`πŸ”„ Restored typed data for column: ${e.columnId}`))}),e.children&&e.children.forEach(e=>{this._restoreConceptData(e)})}_shouldShowFilterButton(){return!0}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleFilterDialogCancel(){this._showFilterDialog=!1,console.log(`🚫 Filter dialog cancelled. Current selection: ${this._selectedRoleIds.length}/${this._allSections.length}`)}_handleRoleFilterApply(e){const{selectedRoleIds:t}=e.detail;this._selectedRoleIds=t,this._applyRoleFilter(),this._showFilterDialog=!1,console.log(`🎯 Applied role filter: ${t.length}/${this._allSections.length} roles selected`),this.dispatchEvent(new CustomEvent("roles-filter-changed",{detail:{selectedRoleIds:t,totalRoles:this._allSections.length,visibleRoles:t.length},bubbles:!0}))}_validateForm(){var e;const t=[],i=this._currentSchema;if(i){for(const o of i.sections)for(const i of o.concepts)for(const o of i.fields){const r=null==(e=this._formData[i.id])?void 0:e[o.columnId],s=C.validateField(o.id,i.id,o.columnId,r,o.type,o.validation||[]);t.push(...s)}this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleFieldChange(e){const{fieldId:t,conceptId:i,columnId:o,value:r}=e.detail,s={...this._formData};s[i]||(s[i]={});const n=s[i][o];s[i]={...s[i],[o]:r},this._formData=s,this._touched.add(`${i}-${o}`),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:i,columnId:o,value:r,oldValue:n},bubbles:!0}))}_generateUniqueConceptKey(e,t){return`${e}::${t}`}_extractOriginalConceptId(e){const t=e.split("::");return t.length>1?t[1]:e}_handleTypedMemberChange(e){const{columnId:t,axisId:i,value:o}=e.detail;console.log(`πŸ” [DynamicForm] Typed member change: columnId=${t}, axisId=${i}, value=${o}`);const r={...this._typedMemberData};r[t]||(r[t]={}),r[t]={...r[t],[i]:o},this._typedMemberData=r,this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}_handleSectionExpand(e){this.dispatchEvent(new CustomEvent("section-expand",{detail:e.detail,bubbles:!0}))}_handleConceptExpand(e){this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_handleColumnRemove(e){const{columnId:t,sectionId:i}=e.detail;if(this._currentSchema&&i){const e=this._currentSchema.sections.find(e=>e.id===i);e&&e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))}else this._columns=this._columns.filter(e=>e.id!==t),this._currentSchema&&this._currentSchema.sections.forEach(e=>{e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))});this._removeColumnData(t,i),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:t,sectionId:i},bubbles:!0}))}_handleColumnAddRequest(e){const{sectionId:t,columnRequest:i}=e.detail;this._addColumnFromRequest(i,t)}_getAvailableDimensionsForSection(e){var t,i,o;if(console.log(`πŸ” Getting dimensions for section: ${e}`),!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return console.log("❌ No hypercubes data available"),[];const r=this.xbrlInput.hypercubes[0].roles.find(t=>t.roleId===e);if(!(null==(o=null==r?void 0:r.items)?void 0:o.length))return console.log(`❌ No hypercube items found for role: ${e}`),[];console.log(`βœ… Found hypercube role with ${r.items.length} items`);const s=[];return r.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{var t;if(!s.find(t=>t.id===e.id)){const i=(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName,o={id:e.id,conceptName:e.conceptName,axisLabel:i};e.members&&e.members.length>0&&(o.members=e.members.map(e=>{var t,i;return{id:e.id,label:(null==(i=null==(t=e.labels)?void 0:t.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:i.label)||e.conceptName||e.id}})),e.typedMember&&(o.typedMember={id:e.typedMember.id,dataType:"string"}),s.push(o)}})}),console.log(`πŸ“ˆ Found ${s.length} dimensions for section ${e}:`,s.map(e=>e.axisLabel)),s}_addColumnFromRequest(e,t){var i,o,r,s,n;const a=`col-${Date.now()}`;let l="",d="";"instant"===e.periodType?(l="Current",d=`Values as of ${e.instantDate}`):"duration"!==e.periodType&&"mixed"!==e.periodType||(l="Current Period",d=`Period: ${e.startDate} to ${e.endDate}`);let c={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:l};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t=[],i=[];for(const r of e.selectedDimensions)r.isTyped&&r.typedValue?(t.push(`${r.axisLabel}: ${r.typedValue}`),i.push(`${r.axisId}|${r.typedValue}`)):r.memberId&&r.memberLabel&&(t.push(r.memberLabel),i.push(`${r.axisId}|${r.memberId}`));const o="instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`;t.length>0&&(l=`${t.join(" | ")} ${o}`,c={dimensionId:a,memberValue:t.join(" | "),memberLabel:t.join(" | "),memberKey:t.join(" | "),dimensionIdKey:i.join("::"),selectedDimensions:e.selectedDimensions},console.log(`πŸ“Š Applied selected dimensions to new column: ${c.memberKey}`))}else if(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(r=null==i?void 0:i.items)?void 0:r.length)){const t=i.items[0];if(1===t.dimensions.length){const i=t.dimensions[0];if(i.members&&i.members.length>0){const t=(null==(s=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||i.conceptName,o=i.members[0],r=(null==(n=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||o.conceptName;l=`${r} ${"instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`}`,c={dimensionId:a,axisId:i.id,memberId:o.id,memberValue:r,memberLabel:r,axis:t,axisLabel:t,memberKey:`${t} | ${r}`,dimensionIdKey:`${i.id} | ${o.id}`},console.log(`πŸ“Š Applied hypercube dimension to new column: ${c.memberKey}`)}}}}const p={id:a,title:l,description:d,type:(c.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:c};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t={};let i=!1;for(const o of e.selectedDimensions)o.isTyped&&(t[o.axisId]=o.typedValue||"",i=!0,console.log(`πŸ’Ύ Initializing typed member data: ${o.axisLabel} = "${o.typedValue||"(empty - will be entered in column header)"}"`));i&&(this._typedMemberData[a]=t,p.dimensionData&&(p.dimensionData.hasTypedMembers=!0,p.dimensionData.typedMembers=e.selectedDimensions.filter(e=>e.isTyped).map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.axisId,memberLabel:e.axisLabel})),console.log("οΏ½ Added typed members to column dimension data:",p.dimensionData.typedMembers)),console.log(`οΏ½ Initialized typed member data for column ${a}:`,t))}if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);e&&(e.columns||(e.columns=[...this._columns]),e.columns=[...e.columns,p])}this._replicateFieldsForNewColumn(a,e,t),this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:p},bubbles:!0}))}_removeColumnData(e,t){if(this._currentSchema)if(t){const i=this._currentSchema.sections.find(e=>e.id===t);i&&this._removeColumnDataFromConcepts(i.concepts,e)}else for(const i in this._formData)void 0!==this._formData[i][e]&&delete this._formData[i][e]}_removeColumnDataFromConcepts(e,t){e.forEach(e=>{this._formData[e.id]&&void 0!==this._formData[e.id][t]&&delete this._formData[e.id][t],e.fields&&(e.fields=e.fields.filter(e=>e.columnId!==t)),e.children&&this._removeColumnDataFromConcepts(e.children,t)})}_shouldCreateFieldForConcept(e,t){if(e.abstract)return!1;if(e.periodType){if("instant"===t.periodType&&"instant"!==e.periodType)return!1;if("duration"===t.periodType&&"duration"!==e.periodType)return!1}return!0}_replicateFieldsForNewColumn(e,t,i){if(!this._currentSchema)return;const o=new F,r=this._currentSchema.sections.find(e=>e.id===i);r&&this._replicateFieldsForSection(r.concepts,e,t,o)}_replicateFieldsForSection(e,t,i,o){e.forEach(e=>{var r;if(this._shouldCreateFieldForConcept(e,i)){const o=null==(r=e.fields)?void 0:r[0];let s;s=o?{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:o.type,label:o.label,placeholder:o.placeholder,required:o.required,disabled:o.disabled,validation:o.validation,defaultValue:o.defaultValue,periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate}:{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:"text",label:e.label||e.name,placeholder:`Enter ${e.name}`,required:!1,disabled:!1,validation:[],defaultValue:"",periodStartDate:"instant"===i.periodType?i.instantDate:i.startDate,periodEndDate:"instant"===i.periodType?i.instantDate:i.endDate},e.fields||(e.fields=[]),e.fields.push(s)}e.children&&this._replicateFieldsForSection(e.children,t,i,o)})}_addColumn(){const e={id:`dim-${Date.now()}`,title:`Dimension ${this._columns.length}`,description:"Additional dimension column",type:"dimension",order:this._columns.length,removable:!0,dimensionData:{dimensionId:"custom",memberValue:"default",memberLabel:"Default Member"}};this._columns=[...this._columns,e],this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:e},bubbles:!0}))}_handleSubmit(){console.log("πŸ“ Form submission started..."),this._submitted=!0,this._validateForm();const e=this._generateSubmissionData();console.log("πŸ“Š Form Submission Data:",JSON.stringify(e,null,2)),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors},bubbles:!0})),console.log("βœ… Form submit event dispatched")}_handleSaveDraft(){const e=this._generateSubmissionData();this.dispatchEvent(new CustomEvent("form-save-draft",{detail:{data:this._formData,draftData:e,valid:this._valid,errors:this._errors},bubbles:!0}))}_generateSubmissionData(){const e=[];if(!this._currentSchema)return e;this._currentSchema.sections.forEach(t=>{this._processConceptsForSubmission(t.concepts,e,t)}),this._includePreservedDataInSubmission(e);return this._removeDuplicateSubmissions(e)}_includePreservedDataInSubmission(e){Object.keys(this._preservedFormData).forEach(t=>{const i=this._preservedFormData[t];i&&Object.keys(i).forEach(o=>{const r=i[o];if(null!=r&&""!==r){const i=this._findConceptInAllSections(t);if(i){const s=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,o,r,e,s||void 0)}}})}),console.log(`πŸ“€ Included preserved data in submission. Total entries: ${e.length}`)}_findConceptInAllSections(e){for(const t of this._allSections){const i=this._findConceptInSection(t.concepts,e);if(i)return i}return null}_findConceptInSection(e,t){for(const i of e){if(i.id===t)return i;if(i.children){const e=this._findConceptInSection(i.children,t);if(e)return e}}return null}_findSectionForConcept(e){for(const t of this._allSections){if(this._findConceptInSection(t.concepts,e))return t}return null}_addConceptDataToSubmission(e,t,i,o,r){var s;const n=e.fields.find(e=>e.columnId===t);if(!n)return;const a="instant"===e.periodType,l={conceptId:e.originalConceptId||e.id,value:i,period:{type:e.periodType||"duration",...a?{date:n.periodStartDate||this.periodStartDate}:{startDate:n.periodStartDate||this.periodStartDate,endDate:n.periodEndDate||this.periodEndDate}}},d=this._findColumnByIdInAllSections(t);(null==(s=null==d?void 0:d.dimensionData)?void 0:s.memberLabel)&&(l.dimension=d.dimensionData.memberLabel),o.push(l)}_findColumnByIdInAllSections(e){for(const t of this._allSections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_removeDuplicateSubmissions(e){const t=new Map;return e.forEach(e=>{const i=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}`;t.has(i)||t.set(i,e)}),Array.from(t.values())}_findColumnById(e){if(this._currentSchema)for(const t of this._currentSchema.sections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_findColumnByIdInSection(e,t){if(null==t?void 0:t.columns)return t.columns.find(t=>t.id===e)}_getTypedMemberNameForAxis(e,t){var i,o,r,s;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]))return null;const n=null==t?void 0:t.id;if(!n)return null;const a=null==(r=this.xbrlInput.hypercubes[0].roles)?void 0:r.find(e=>e.roleId===n);if(!(null==a?void 0:a.items))return null;for(const l of a.items)if(l.dimensions){const t=l.dimensions.find(t=>t.id===e);if(null==(s=null==t?void 0:t.typedMember)?void 0:s.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var o,r,s;if(!(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]))return!1;const n=null==t?void 0:t.id;if(!n)return!1;const a=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===n);if(!(null==(s=null==a?void 0:a.items)?void 0:s.length))return!1;for(const l of a.items){const t=e.originalConceptId||e.id;if(l.conceptIds&&l.conceptIds.includes(t)){const e=l.dimensions.some(e=>e.typedMember);return console.log(`πŸ” [DynamicForm] Concept ${t} found in hypercube item. Has typed dimensions:`,e),e}}return console.log(`πŸ” [DynamicForm] Concept ${e.originalConceptId||e.id} not found in any hypercube items for role ${n}`),!1}_getApplicableTypedDimensions(e,t){var i,o,r;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0])||!(null==t?void 0:t.id))return[];const s=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(r=null==s?void 0:s.items)?void 0:r.length))return[];const n=e.originalConceptId||e.id;for(const a of s.items)if(a.conceptIds&&a.conceptIds.includes(n)){const e=a.dimensions.filter(e=>e.typedMember).map(e=>e.id);return console.log(`πŸ” [DynamicForm] Found applicable typed dimensions for concept ${n}:`,e),e}return[]}_processConceptsForSubmission(e,t,i){const o="Toelichting op de geconsolideerde jaarrekening - FinanciΓ«le vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie",r=(null==i?void 0:i.title)||"Unknown";e.forEach(e=>{r===o&&(console.warn(`[DUPLICATE DEBUG] Processing concept ${e.originalConceptId||e.id} in target role`),e.fields&&(console.warn(`[DUPLICATE DEBUG] Concept has ${e.fields.length} fields`),e.fields.forEach((t,i)=>{var o;console.warn(`[DUPLICATE DEBUG] Field ${i}: columnId=${t.columnId}, current value=${null==(o=this._formData[e.id])?void 0:o[t.columnId]}`)}))),e.fields&&e.fields.length>1&&(console.log(`πŸ” [DEBUG] Processing concept ${e.originalConceptId}, fields count: ${e.fields.length}`),e.fields.forEach((t,i)=>{var o;console.log(` Field ${i}: columnId=${t.columnId}, value=${null==(o=this._formData[e.id])?void 0:o[t.columnId]}`)})),e.fields&&e.fields.length>0&&e.fields.forEach(s=>{var n,a;const l=this._formData[e.id],d=null==l?void 0:l[s.columnId];if(null!=d&&""!==d){r===o&&console.warn(`[DUPLICATE DEBUG] Creating submission entry for concept ${e.originalConceptId||e.id}, field columnId=${s.columnId}, value=${d}`);const l=this._findColumnByIdInSection(s.columnId,i);console.log(`πŸ” [DynamicForm] Processing field for concept ${e.originalConceptId||e.id}, field columnId: ${s.columnId}, found column in section ${null==i?void 0:i.id}: ${!!l}, column title: ${null==l?void 0:l.title}`);const c={conceptId:e.id,value:d,period:{type:e.periodType||"duration"}};if("instant"===e.periodType?c.period.date=s.periodStartDate||this.periodStartDate:(c.period.startDate=s.periodStartDate||this.periodStartDate,c.period.endDate=s.periodEndDate||this.periodEndDate),"dimension"===(null==l?void 0:l.type)&&(null==(n=l.dimensionData)?void 0:n.dimensionIdKey)?(c.dimension=l.dimensionData.dimensionIdKey,console.log(`πŸ” [DynamicForm] Using dimension key from field's column (${s.columnId}):`,l.dimensionData.dimensionIdKey)):console.log(`πŸ” [DynamicForm] No dimension data found for field column ${s.columnId}. Column type: ${null==l?void 0:l.type}, has dimensionData: ${!!(null==l?void 0:l.dimensionData)}`),this._typedMemberData[s.columnId]){const t=this._getApplicableTypedDimensions(e,i);if(console.log(`πŸ” [DynamicForm] Concept ${e.id} applicable typed dimensions:`,t),t.length>0){const e={},o=this._typedMemberData[s.columnId];t.forEach(t=>{if(o[t]){const r=this._getTypedMemberNameForAxis(t,i);e[t]={value:o[t],memberName:r||"Unknown"}}}),Object.keys(e).length>0?(c.typedMembers=e,console.log("πŸ” [DynamicForm] Adding filtered typed members to submission:",e)):console.log("πŸ” [DynamicForm] No typed member values found for applicable dimensions:",t)}else console.log(`πŸ” [DynamicForm] Skipping typed members for concept ${e.id} - not applicable to this hypercube`)}else console.log(`πŸ” [DynamicForm] No typed member data found for column ${s.columnId}. Available columns:`,Object.keys(this._typedMemberData)),l&&console.log("πŸ” [DynamicForm] Column details:",{id:l.id,type:l.type,hasTypedMembers:null==(a=l.dimensionData)?void 0:a.hasTypedMembers,dimensionData:l.dimensionData});r===o&&console.warn("[DUPLICATE DEBUG] Final submission entry:",c),t.push(c)}}),e.children&&this._processConceptsForSubmission(e.children,t,i)})}_handleReset(){this._formData={...this.initialData},this._touched.clear(),this._dirty=!1,this._submitted=!1,this._preservedFormData={},this._preservedTypedMemberData={},console.log("πŸ”„ Form reset - all data and preserved data cleared"),this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("form-reset",{detail:{},bubbles:!0}))}_getFormState(){return{data:this._formData,errors:this._errors,touched:this._touched,dirty:this._dirty,valid:this._valid,submitted:this._submitted}}getData(){return{...this._formData}}setData(e){this._formData={...e},this._dirty=!0,this._validateForm(),this.requestUpdate()}validate(){return this._validateForm(),this._valid}reset(){this._handleReset()}getState(){return this._getFormState()}changeLanguage(e){this.language!==e?(console.log("🌐 Changing language from",this.language,"to",e),this.language=e):console.log("🌐 Language already set to",e)}render(){const t=this._errors.filter(e=>"error"===e.severity).length,i=this.config||{},o=!1!==i.showValidationSummary&&t>0&&this._submitted,r=this._currentSchema;return r?e.html`
1538
1538
  <div class="form-container">
1539
1539
  <!-- Form Header -->
1540
1540
  <div class="form-header">