jupiter-dynamic-forms 1.9.8 β 1.9.10
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 +1 -0
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -41,6 +41,7 @@ export declare class JupiterDynamicForm extends LitElement {
|
|
|
41
41
|
/**
|
|
42
42
|
* Initialize period preferences from presentation data
|
|
43
43
|
* Reads showPreviousYear, instant, and duration attributes from each role to set initial preferences
|
|
44
|
+
* Only sets defaults for roles that don't have existing user preferences
|
|
44
45
|
*/
|
|
45
46
|
private _initializePeriodPreferencesFromData;
|
|
46
47
|
private _applyRoleFilter;
|
|
@@ -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;IAChB,OAAO,EAAE,WAAW,GAAG,WAAW,CAAe;IACjD,IAAI,EAAE,WAAW,GAAG,OAA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,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,uBAAuB;IA8D/B,OAAO,CAAC,0BAA0B;IAWlC,OAAO,CAAC,sBAAsB;IA0D9B,OAAO,CAAC,sBAAsB;IAmD9B,OAAO,CAAC,sBAAsB;IA+EvB,OAAO,IAAI,QAAQ;IAInB,OAAO,CAAC,IAAI,EAAE,QAAQ;IAOtB,QAAQ,IAAI,OAAO;IAKnB,KAAK;IAIL,QAAQ,IAAI,SAAS;IAI5B,MAAM;CAkFP"}
|
package/dist/index.js
CHANGED
|
@@ -1581,7 +1581,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},I=(e=D,t,
|
|
|
1581
1581
|
opacity: 0.6;
|
|
1582
1582
|
cursor: not-allowed;
|
|
1583
1583
|
}
|
|
1584
|
-
`,H([w({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),H([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),H([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),H([w({type:Object})],exports.JupiterFilterRolesDialog.prototype,"periodPreferences",2),H([S()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),H([S()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),H([S()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),H([S()],exports.JupiterFilterRolesDialog.prototype,"_tempPeriodPreferences",2),exports.JupiterFilterRolesDialog=H([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var Q=Object.defineProperty,G=Object.getOwnPropertyDescriptor,X=(e,t,i,r)=>{for(var o,n=r>1?void 0:r?G(t,i):t,s=e.length-1;s>=0;s--)(o=e[s])&&(n=(r?o(t,i,n):o(n))||n);return r&&n&&Q(t,i,n),n};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.display="accordion",this.mode="inputForm",this.financialStatementsTypeAxis=[],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,this._periodPreferences={},this._activeSidePanelRoleId=null,this._adminRoleConfigs={}}connectedCallback(){super.connectedCallback(),this._initializeForm()}updated(e){e.has("financialStatementsTypeAxis")&&console.log("π financialStatementsTypeAxis changed:",this.financialStatementsTypeAxis),(e.has("xbrlInput")||e.has("schema")||e.has("language")||e.has("periodStartDate")||e.has("periodEndDate")||e.has("financialStatementsTypeAxis"))&&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._initializePeriodPreferencesFromData(),console.log("βοΈ Using period preferences:",this._periodPreferences),this._currentSchema=T.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),console.log("β
Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],this.financialStatementsTypeAxis&&this.financialStatementsTypeAxis.length>0&&(console.log("π Applying financialStatementsTypeAxis filter:",this.financialStatementsTypeAxis),console.log("π Sections before filter:",this._allSections.length),this._allSections=this._filterRolesByFinancialStatementsType(this._allSections),console.log("π Sections after filter:",this._allSections.length)),0===this._selectedRoleIds.length&&(this._selectedRoleIds=this._allSections.map(e=>e.id),console.log("β
Auto-selected all roles:",this._selectedRoleIds.length)),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}]}_initializePeriodPreferencesFromData(){var e,t,i;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.presentation)?void 0:t[0])?void 0:i.roles))return;const r={};this.xbrlInput.presentation[0].roles.forEach(e=>{const t=!0===e.showPreviousYear,i=void 0===e.instant||!0===e.instant,o=void 0===e.duration||!0===e.duration;r[e.id]={showDuration:o,showInstant:i,showPreviousYear:t}}),this._periodPreferences=r}_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"),this._currentSchema={...this._currentSchema,sections:[]},void this.requestUpdate();this._preserveDataForHiddenSections();const e=this._allSections.filter(e=>this._selectedRoleIds.includes(e.id));console.log(`π Filtered sections: ${e.length} (IDs: ${e.map(e=>e.id).join(", ")})`),this._restoreDataForVisibleSections(e),this._currentSchema={...this._currentSchema,sections:e},console.log(`β
Schema updated. Current sections count: ${this._currentSchema.sections.length}`),this.requestUpdate()}_filterRolesByFinancialStatementsType(e){var t;if(!this.financialStatementsTypeAxis||0===this.financialStatementsTypeAxis.length)return e;if(!(null==(t=this.xbrlInput)?void 0:t.hypercubes)||0===this.xbrlInput.hypercubes.length)return e;const i=this.xbrlInput.hypercubes[0];return console.log("π Filter values:",this.financialStatementsTypeAxis),e.filter(e=>{var t;const r=null==(t=i.roles)?void 0:t.find(t=>t.roleId===e.id);if(!r||!r.items||0===r.items.length)return console.log(`β
${e.title}: No hypercube entry - INCLUDED`),!0;let o=!1,n=!1;for(const i of r.items){if(!i.dimensions||0===i.dimensions.length)continue;const e=i.dimensions.find(e=>{var t;return"bw2-titel9_FinancialStatementsTypeAxis"===e.id||(null==(t=e.conceptName)?void 0:t.includes("FinancialStatementsTypeAxis"))});if(e&&(o=!0,e.members&&e.members.length>0)){if(e.members.some(e=>{if(e.conceptName){const t=e.conceptName.split(":"),i=t.length>1?t[1]:e.conceptName;return this.financialStatementsTypeAxis.some(e=>{const t=e.split(":"),r=t.length>1?t[1]:e;return i===r})}return this.financialStatementsTypeAxis.includes(e.id)})){n=!0;break}}}return!o||n})}_preserveDataForHiddenSections(){var e;((null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[]).filter(e=>!this._selectedRoleIds.includes(e)).forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(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]}),e.fields.forEach(e=>{this._typedMemberData[e.columnId]&&(this._preservedTypedMemberData[e.columnId]={...this._typedMemberData[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]}),e.fields.forEach(e=>{this._preservedTypedMemberData[e.columnId]&&(this._typedMemberData[e.columnId]={...this._preservedTypedMemberData[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,periodPreferences:i}=e.detail;this._selectedRoleIds=t;JSON.stringify(this._periodPreferences)!==JSON.stringify(i)?(this._periodPreferences=i,console.log("π Period preferences updated:",this._periodPreferences),this._initializeForm()):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,periodPreferences:i},bubbles:!0}))}_validateForm(){var e;const t=[],i=this._currentSchema;if(i){for(const r of i.sections)for(const i of r.concepts)for(const r of i.fields){const o=null==(e=this._formData[i.id])?void 0:e[r.columnId],n=C.validateField(r.id,i.id,r.columnId,o,r.type,r.validation||[]);t.push(...n)}this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleFieldChange(e){const{fieldId:t,conceptId:i,columnId:r,value:o}=e.detail,n={...this._formData};n[i]||(n[i]={});const s=n[i][r];n[i]={...n[i],[r]:o},this._formData=n,this._touched.add(`${i}-${r}`),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:i,columnId:r,value:o,oldValue:s},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:r}=e.detail;console.log(`π [DynamicForm] Typed member change: columnId=${t}, axisId=${i}, value=${r}`);const o={...this._typedMemberData};o[t]||(o[t]={}),o[t]={...o[t],[i]:r},this._typedMemberData=o,this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:r},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,r;if(!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return[];const o=this.xbrlInput.hypercubes[0].roles.find(t=>t.roleId===e);if(!(null==(r=null==o?void 0:o.items)?void 0:r.length))return console.log(`β No hypercube items found for role: ${e}`),[];const n=[];return o.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{var t;if(!n.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,r={id:e.id,conceptName:e.conceptName,axisLabel:i};e.members&&e.members.length>0&&(r.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&&(r.typedMember={id:e.typedMember.id,dataType:"string"}),n.push(r)}})}),n}_addColumnFromRequest(e,t){var i,r,o,n,s;const a=`col-${Date.now()}`;let l="",d="";"instant"===e.periodType?(l=e.instantDate||"",d=""):"duration"!==e.periodType&&"mixed"!==e.periodType||(l=`${e.startDate} / ${e.endDate}`,d="");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 o of e.selectedDimensions)o.isTyped&&o.typedValue?(t.push(`${o.axisLabel}: ${o.typedValue}`),i.push(`${o.axisId}|${o.typedValue}`)):o.memberId&&o.memberLabel&&(t.push(o.memberLabel),i.push(`${o.axisId}|${o.memberId}`));const r="instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`;t.length>0&&(l=`${t.join(" | ")} ${r}`,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==(r=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:r[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(o=null==i?void 0:i.items)?void 0:o.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==(n=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||i.conceptName,r=i.members[0],o=(null==(s=r.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||r.conceptName;l=`${o} ${"instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`}`,c={dimensionId:a,axisId:i.id,memberId:r.id,memberValue:o,memberLabel:o,axis:t,axisLabel:t,memberKey:`${t} | ${o}`,dimensionIdKey:`${i.id} | ${r.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 r of e.selectedDimensions)r.isTyped&&(t[r.axisId]=r.typedValue||"",i=!0);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}))))}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 r=new T,o=this._currentSchema.sections.find(e=>e.id===i);o&&this._replicateFieldsForSection(o.concepts,e,t,r)}_replicateFieldsForSection(e,t,i,r){e.forEach(e=>{var o;if(this._shouldCreateFieldForConcept(e,i)){const r=null==(o=e.fields)?void 0:o[0];let n;n=r?{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:r.type,label:r.label,placeholder:r.placeholder,required:r.required,disabled:r.disabled,validation:r.validation,defaultValue:r.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(n)}e.children&&this._replicateFieldsForSection(e.children,t,i,r)})}_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(){if(console.log("π Form submission started..."),this._submitted=!0,"admin"===this.mode)return void this._handleAdminModeSubmit();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(r=>{const o=i[r];if(null!=o&&""!==o){const i=this._findConceptInAllSections(t);if(i){const n=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,r,o,e,n||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,r,o){var n;const s=e.fields.find(e=>e.columnId===t);if(!s)return;const a="instant"===e.periodType,l=this._findColumnByIdInAllSections(t);alert("hi"),console.log(`π [Submission] Concept: ${e.id}, Column: ${t}, Column Period: ${(null==l?void 0:l.periodStartDate)||"none"} - ${(null==l?void 0:l.periodEndDate)||"none"}`);const d={conceptId:e.originalConceptId||e.id,value:i,period:{type:e.periodType||"duration",...a?{date:(null==l?void 0:l.periodEndDate)||s.periodStartDate||this.periodStartDate}:{startDate:(null==l?void 0:l.periodStartDate)||s.periodStartDate||this.periodStartDate,endDate:(null==l?void 0:l.periodEndDate)||s.periodEndDate||this.periodEndDate}}};(null==(n=null==l?void 0:l.dimensionData)?void 0:n.memberLabel)&&(d.dimension=l.dimensionData.memberLabel),r.push(d)}_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="instant"===e.period.type?e.period.date:`${e.period.startDate}_${e.period.endDate}`,r=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}_${i}`;t.has(r)||t.set(r,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,r,o,n;if(!(null==(r=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:r[0]))return null;const s=null==t?void 0:t.id;if(!s)return null;const a=null==(o=this.xbrlInput.hypercubes[0].roles)?void 0:o.find(e=>e.roleId===s);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==(n=null==t?void 0:t.typedMember)?void 0:n.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var r,o,n;if(!(null==(o=null==(r=this.xbrlInput)?void 0:r.hypercubes)?void 0:o[0]))return!1;const s=null==t?void 0:t.id;if(!s)return!1;const a=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===s);if(!(null==(n=null==a?void 0:a.items)?void 0:n.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 ${s}`),!1}_getApplicableTypedDimensions(e,t){var i,r,o;if(!(null==(r=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:r[0])||!(null==t?void 0:t.id))return[];const n=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(o=null==n?void 0:n.items)?void 0:o.length))return[];const s=e.originalConceptId||e.id;for(const a of n.items)if(a.conceptIds&&a.conceptIds.includes(s)){const e=a.dimensions.filter(e=>e.typedMember).map(e=>e.id);return console.log(`π [DynamicForm] Found applicable typed dimensions for concept ${s}:`,e),e}return[]}_processConceptsForSubmission(e,t,i){const r="Toelichting op de geconsolideerde jaarrekening - FinanciΓ«le vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie",o=(null==i?void 0:i.title)||"Unknown";e.forEach(e=>{o===r&&(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 r;console.warn(`[DUPLICATE DEBUG] Field ${i}: columnId=${t.columnId}, current value=${null==(r=this._formData[e.id])?void 0:r[t.columnId]}`)}))),e.fields&&e.fields.length>1&&e.fields.forEach((e,t)=>{}),e.fields&&e.fields.length>0&&e.fields.forEach(n=>{var s,a;const l=this._formData[e.id],d=null==l?void 0:l[n.columnId];if(null!=d&&""!==d){const l=this._findColumnByIdInSection(n.columnId,i),c={conceptId:e.id,value:d,period:{type:e.periodType||"duration"}};if("instant"===e.periodType?c.period.date=(null==l?void 0:l.periodEndDate)||n.periodStartDate||this.periodStartDate:(c.period.startDate=(null==l?void 0:l.periodStartDate)||n.periodStartDate||this.periodStartDate,c.period.endDate=(null==l?void 0:l.periodEndDate)||n.periodEndDate||this.periodEndDate),console.log(`π [Submission] Concept: ${e.id}, Column: ${n.columnId}, Column Period: ${(null==l?void 0:l.periodStartDate)||"none"} - ${(null==l?void 0:l.periodEndDate)||"none"}, Used Period: ${"instant"===c.period.type?c.period.date:`${c.period.startDate} - ${c.period.endDate}`}`),"dimension"===(null==l?void 0:l.type)&&(null==(s=l.dimensionData)?void 0:s.dimensionIdKey)?(c.dimension=l.dimensionData.dimensionIdKey,console.log(`π [DynamicForm] Using dimension key from field's column (${n.columnId}):`,l.dimensionData.dimensionIdKey)):console.log(`π [DynamicForm] No dimension data found for field column ${n.columnId}. Column type: ${null==l?void 0:l.type}, has dimensionData: ${!!(null==l?void 0:l.dimensionData)}`),this._typedMemberData[n.columnId]){const t=this._getApplicableTypedDimensions(e,i);if(console.log(`π [DynamicForm] Concept ${e.id} applicable typed dimensions:`,t),t.length>0){const e={},r=this._typedMemberData[n.columnId];t.forEach(t=>{if(r[t]){const o=this._getTypedMemberNameForAxis(t,i);e[t]={value:r[t],memberName:o||"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 ${n.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});o===r&&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}}_handleSidePanelRoleClick(e){this._activeSidePanelRoleId=e}_renderAdminModeContent(t){var i,r,o;if(!t)return e.html`
|
|
1584
|
+
`,H([w({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),H([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),H([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),H([w({type:Object})],exports.JupiterFilterRolesDialog.prototype,"periodPreferences",2),H([S()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),H([S()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),H([S()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),H([S()],exports.JupiterFilterRolesDialog.prototype,"_tempPeriodPreferences",2),exports.JupiterFilterRolesDialog=H([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var Q=Object.defineProperty,G=Object.getOwnPropertyDescriptor,X=(e,t,i,r)=>{for(var o,n=r>1?void 0:r?G(t,i):t,s=e.length-1;s>=0;s--)(o=e[s])&&(n=(r?o(t,i,n):o(n))||n);return r&&n&&Q(t,i,n),n};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.display="accordion",this.mode="inputForm",this.financialStatementsTypeAxis=[],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,this._periodPreferences={},this._activeSidePanelRoleId=null,this._adminRoleConfigs={}}connectedCallback(){super.connectedCallback(),this._initializeForm()}updated(e){e.has("financialStatementsTypeAxis")&&console.log("π financialStatementsTypeAxis changed:",this.financialStatementsTypeAxis),(e.has("xbrlInput")||e.has("schema")||e.has("language")||e.has("periodStartDate")||e.has("periodEndDate")||e.has("financialStatementsTypeAxis"))&&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._initializePeriodPreferencesFromData(),console.log("βοΈ Using period preferences:",this._periodPreferences),this._currentSchema=T.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),console.log("β
Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],this.financialStatementsTypeAxis&&this.financialStatementsTypeAxis.length>0&&(console.log("π Applying financialStatementsTypeAxis filter:",this.financialStatementsTypeAxis),console.log("π Sections before filter:",this._allSections.length),this._allSections=this._filterRolesByFinancialStatementsType(this._allSections),console.log("π Sections after filter:",this._allSections.length)),0===this._selectedRoleIds.length&&(this._selectedRoleIds=this._allSections.map(e=>e.id),console.log("β
Auto-selected all roles:",this._selectedRoleIds.length)),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}]}_initializePeriodPreferencesFromData(){var e,t,i;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.presentation)?void 0:t[0])?void 0:i.roles))return;const r={...this._periodPreferences};this.xbrlInput.presentation[0].roles.forEach(e=>{if(!r[e.id]){const t=!0===e.showPreviousYear,i=void 0===e.instant||!0===e.instant,o=void 0===e.duration||!0===e.duration;r[e.id]={showDuration:o,showInstant:i,showPreviousYear:t}}}),this._periodPreferences=r}_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"),this._currentSchema={...this._currentSchema,sections:[]},void this.requestUpdate();this._preserveDataForHiddenSections();const e=this._allSections.filter(e=>this._selectedRoleIds.includes(e.id));console.log(`π Filtered sections: ${e.length} (IDs: ${e.map(e=>e.id).join(", ")})`),this._restoreDataForVisibleSections(e),this._currentSchema={...this._currentSchema,sections:e},console.log(`β
Schema updated. Current sections count: ${this._currentSchema.sections.length}`),this.requestUpdate()}_filterRolesByFinancialStatementsType(e){var t;if(!this.financialStatementsTypeAxis||0===this.financialStatementsTypeAxis.length)return e;if(!(null==(t=this.xbrlInput)?void 0:t.hypercubes)||0===this.xbrlInput.hypercubes.length)return e;const i=this.xbrlInput.hypercubes[0];return console.log("π Filter values:",this.financialStatementsTypeAxis),e.filter(e=>{var t;const r=null==(t=i.roles)?void 0:t.find(t=>t.roleId===e.id);if(!r||!r.items||0===r.items.length)return console.log(`β
${e.title}: No hypercube entry - INCLUDED`),!0;let o=!1,n=!1;for(const i of r.items){if(!i.dimensions||0===i.dimensions.length)continue;const e=i.dimensions.find(e=>{var t;return"bw2-titel9_FinancialStatementsTypeAxis"===e.id||(null==(t=e.conceptName)?void 0:t.includes("FinancialStatementsTypeAxis"))});if(e&&(o=!0,e.members&&e.members.length>0)){if(e.members.some(e=>{if(e.conceptName){const t=e.conceptName.split(":"),i=t.length>1?t[1]:e.conceptName;return this.financialStatementsTypeAxis.some(e=>{const t=e.split(":"),r=t.length>1?t[1]:e;return i===r})}return this.financialStatementsTypeAxis.includes(e.id)})){n=!0;break}}}return!o||n})}_preserveDataForHiddenSections(){var e;((null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[]).filter(e=>!this._selectedRoleIds.includes(e)).forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(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]}),e.fields.forEach(e=>{this._typedMemberData[e.columnId]&&(this._preservedTypedMemberData[e.columnId]={...this._typedMemberData[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]}),e.fields.forEach(e=>{this._preservedTypedMemberData[e.columnId]&&(this._typedMemberData[e.columnId]={...this._preservedTypedMemberData[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,periodPreferences:i}=e.detail;this._selectedRoleIds=t;JSON.stringify(this._periodPreferences)!==JSON.stringify(i)?(this._periodPreferences=i,console.log("π Period preferences updated:",this._periodPreferences),this._initializeForm()):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,periodPreferences:i},bubbles:!0}))}_validateForm(){var e;const t=[],i=this._currentSchema;if(i){for(const r of i.sections)for(const i of r.concepts)for(const r of i.fields){const o=null==(e=this._formData[i.id])?void 0:e[r.columnId],n=C.validateField(r.id,i.id,r.columnId,o,r.type,r.validation||[]);t.push(...n)}this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleFieldChange(e){const{fieldId:t,conceptId:i,columnId:r,value:o}=e.detail,n={...this._formData};n[i]||(n[i]={});const s=n[i][r];n[i]={...n[i],[r]:o},this._formData=n,this._touched.add(`${i}-${r}`),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:i,columnId:r,value:o,oldValue:s},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:r}=e.detail;console.log(`π [DynamicForm] Typed member change: columnId=${t}, axisId=${i}, value=${r}`);const o={...this._typedMemberData};o[t]||(o[t]={}),o[t]={...o[t],[i]:r},this._typedMemberData=o,this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:r},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,r;if(!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return[];const o=this.xbrlInput.hypercubes[0].roles.find(t=>t.roleId===e);if(!(null==(r=null==o?void 0:o.items)?void 0:r.length))return console.log(`β No hypercube items found for role: ${e}`),[];const n=[];return o.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{var t;if(!n.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,r={id:e.id,conceptName:e.conceptName,axisLabel:i};e.members&&e.members.length>0&&(r.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&&(r.typedMember={id:e.typedMember.id,dataType:"string"}),n.push(r)}})}),n}_addColumnFromRequest(e,t){var i,r,o,n,s;const a=`col-${Date.now()}`;let l="",d="";"instant"===e.periodType?(l=e.instantDate||"",d=""):"duration"!==e.periodType&&"mixed"!==e.periodType||(l=`${e.startDate} / ${e.endDate}`,d="");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 o of e.selectedDimensions)o.isTyped&&o.typedValue?(t.push(`${o.axisLabel}: ${o.typedValue}`),i.push(`${o.axisId}|${o.typedValue}`)):o.memberId&&o.memberLabel&&(t.push(o.memberLabel),i.push(`${o.axisId}|${o.memberId}`));const r="instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`;t.length>0&&(l=`${t.join(" | ")} ${r}`,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==(r=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:r[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(o=null==i?void 0:i.items)?void 0:o.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==(n=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||i.conceptName,r=i.members[0],o=(null==(s=r.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||r.conceptName;l=`${o} ${"instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`}`,c={dimensionId:a,axisId:i.id,memberId:r.id,memberValue:o,memberLabel:o,axis:t,axisLabel:t,memberKey:`${t} | ${o}`,dimensionIdKey:`${i.id} | ${r.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 r of e.selectedDimensions)r.isTyped&&(t[r.axisId]=r.typedValue||"",i=!0);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}))))}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 r=new T,o=this._currentSchema.sections.find(e=>e.id===i);o&&this._replicateFieldsForSection(o.concepts,e,t,r)}_replicateFieldsForSection(e,t,i,r){e.forEach(e=>{var o;if(this._shouldCreateFieldForConcept(e,i)){const r=null==(o=e.fields)?void 0:o[0];let n;n=r?{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:r.type,label:r.label,placeholder:r.placeholder,required:r.required,disabled:r.disabled,validation:r.validation,defaultValue:r.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(n)}e.children&&this._replicateFieldsForSection(e.children,t,i,r)})}_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(){if(console.log("π Form submission started..."),this._submitted=!0,"admin"===this.mode)return void this._handleAdminModeSubmit();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(r=>{const o=i[r];if(null!=o&&""!==o){const i=this._findConceptInAllSections(t);if(i){const n=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,r,o,e,n||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,r,o){var n;const s=e.fields.find(e=>e.columnId===t);if(!s)return;const a="instant"===e.periodType,l=this._findColumnByIdInAllSections(t);alert("hi"),console.log(`π [Submission] Concept: ${e.id}, Column: ${t}, Column Period: ${(null==l?void 0:l.periodStartDate)||"none"} - ${(null==l?void 0:l.periodEndDate)||"none"}`);const d={conceptId:e.originalConceptId||e.id,value:i,period:{type:e.periodType||"duration",...a?{date:(null==l?void 0:l.periodEndDate)||s.periodStartDate||this.periodStartDate}:{startDate:(null==l?void 0:l.periodStartDate)||s.periodStartDate||this.periodStartDate,endDate:(null==l?void 0:l.periodEndDate)||s.periodEndDate||this.periodEndDate}}};(null==(n=null==l?void 0:l.dimensionData)?void 0:n.memberLabel)&&(d.dimension=l.dimensionData.memberLabel),r.push(d)}_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="instant"===e.period.type?e.period.date:`${e.period.startDate}_${e.period.endDate}`,r=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}_${i}`;t.has(r)||t.set(r,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,r,o,n;if(!(null==(r=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:r[0]))return null;const s=null==t?void 0:t.id;if(!s)return null;const a=null==(o=this.xbrlInput.hypercubes[0].roles)?void 0:o.find(e=>e.roleId===s);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==(n=null==t?void 0:t.typedMember)?void 0:n.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var r,o,n;if(!(null==(o=null==(r=this.xbrlInput)?void 0:r.hypercubes)?void 0:o[0]))return!1;const s=null==t?void 0:t.id;if(!s)return!1;const a=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===s);if(!(null==(n=null==a?void 0:a.items)?void 0:n.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 ${s}`),!1}_getApplicableTypedDimensions(e,t){var i,r,o;if(!(null==(r=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:r[0])||!(null==t?void 0:t.id))return[];const n=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(o=null==n?void 0:n.items)?void 0:o.length))return[];const s=e.originalConceptId||e.id;for(const a of n.items)if(a.conceptIds&&a.conceptIds.includes(s)){const e=a.dimensions.filter(e=>e.typedMember).map(e=>e.id);return console.log(`π [DynamicForm] Found applicable typed dimensions for concept ${s}:`,e),e}return[]}_processConceptsForSubmission(e,t,i){const r="Toelichting op de geconsolideerde jaarrekening - FinanciΓ«le vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie",o=(null==i?void 0:i.title)||"Unknown";e.forEach(e=>{o===r&&(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 r;console.warn(`[DUPLICATE DEBUG] Field ${i}: columnId=${t.columnId}, current value=${null==(r=this._formData[e.id])?void 0:r[t.columnId]}`)}))),e.fields&&e.fields.length>1&&e.fields.forEach((e,t)=>{}),e.fields&&e.fields.length>0&&e.fields.forEach(n=>{var s,a;const l=this._formData[e.id],d=null==l?void 0:l[n.columnId];if(null!=d&&""!==d){const l=this._findColumnByIdInSection(n.columnId,i),c={conceptId:e.id,value:d,period:{type:e.periodType||"duration"}};if("instant"===e.periodType?c.period.date=(null==l?void 0:l.periodEndDate)||n.periodStartDate||this.periodStartDate:(c.period.startDate=(null==l?void 0:l.periodStartDate)||n.periodStartDate||this.periodStartDate,c.period.endDate=(null==l?void 0:l.periodEndDate)||n.periodEndDate||this.periodEndDate),console.log(`π [Submission] Concept: ${e.id}, Column: ${n.columnId}, Column Period: ${(null==l?void 0:l.periodStartDate)||"none"} - ${(null==l?void 0:l.periodEndDate)||"none"}, Used Period: ${"instant"===c.period.type?c.period.date:`${c.period.startDate} - ${c.period.endDate}`}`),"dimension"===(null==l?void 0:l.type)&&(null==(s=l.dimensionData)?void 0:s.dimensionIdKey)?(c.dimension=l.dimensionData.dimensionIdKey,console.log(`π [DynamicForm] Using dimension key from field's column (${n.columnId}):`,l.dimensionData.dimensionIdKey)):console.log(`π [DynamicForm] No dimension data found for field column ${n.columnId}. Column type: ${null==l?void 0:l.type}, has dimensionData: ${!!(null==l?void 0:l.dimensionData)}`),this._typedMemberData[n.columnId]){const t=this._getApplicableTypedDimensions(e,i);if(console.log(`π [DynamicForm] Concept ${e.id} applicable typed dimensions:`,t),t.length>0){const e={},r=this._typedMemberData[n.columnId];t.forEach(t=>{if(r[t]){const o=this._getTypedMemberNameForAxis(t,i);e[t]={value:r[t],memberName:o||"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 ${n.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});o===r&&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}}_handleSidePanelRoleClick(e){this._activeSidePanelRoleId=e}_renderAdminModeContent(t){var i,r,o;if(!t)return e.html`
|
|
1585
1585
|
<div class="admin-mode-container">
|
|
1586
1586
|
<p>No role selected</p>
|
|
1587
1587
|
</div>
|