jupiter-dynamic-forms 1.6.0 β 1.6.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 +20 -0
- package/dist/core/DynamicFormRefactored.d.ts +73 -0
- package/dist/core/DynamicFormRefactored.d.ts.map +1 -0
- package/dist/core/concept-tree.d.ts.map +1 -1
- package/dist/core/dynamic-form.d.ts +39 -1
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/core/filter-roles-dialog.d.ts +36 -0
- package/dist/core/filter-roles-dialog.d.ts.map +1 -0
- package/dist/core/form-section.d.ts +3 -2
- package/dist/core/form-section.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +614 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1917 -391
- package/dist/index.mjs.map +1 -1
- package/dist/schema/types.d.ts +21 -1
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/xbrl-types.d.ts +3 -2
- package/dist/schema/xbrl-types.d.ts.map +1 -1
- package/dist/utils/xbrl-form-builder.d.ts +4 -0
- package/dist/utils/xbrl-form-builder.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("lit"),t=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},i=globalThis,o=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("lit"),t=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},i=globalThis,o=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),s=new WeakMap;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/let
|
|
6
|
+
*/let n=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(o&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(t,e))}return e}toString(){return this.cssText}};const a=o?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new n("string"==typeof e?e:e+"",void 0,r))(t)})(e):e,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:h,getPrototypeOf:u}=Object,m=globalThis,b=m.trustedTypes,f=b?b.emptyScript:"",y=m.reactiveElementPolyfillSupport,g=(e,t)=>e,v={toAttribute(e,t){switch(t){case Boolean:e=e?f:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(o){i=null}}return i}},_=(e,t)=>!l(e,t),x={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:_};
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/Symbol.metadata??(Symbol.metadata=Symbol("metadata")),
|
|
11
|
+
*/Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);class $ extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=x){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(e,i,t);void 0!==o&&d(this.prototype,e,o)}}static getPropertyDescriptor(e,t,i){const{get:o,set:r}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:o,set(t){const s=null==o?void 0:o.call(this);null==r||r.call(this,t),this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??x}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const e=u(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const e=this.properties,t=[...p(e),...h(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const e=this._$Eu(t,i);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(a(e))}else void 0!==e&&t.push(a(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),null==(e=this.constructor.l)||e.forEach(e=>e(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),void 0!==this.renderRoot&&this.isConnected&&(null==(t=e.hostConnected)||t.call(e))}removeController(e){var t;null==(t=this._$EO)||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(o)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const o of t){const t=document.createElement("style"),r=i.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=o.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(e=this._$EO)||e.forEach(e=>{var t;return null==(t=e.hostConnected)?void 0:t.call(e)})}enableUpdating(e){}disconnectedCallback(){var e;null==(e=this._$EO)||e.forEach(e=>{var t;return null==(t=e.hostDisconnected)?void 0:t.call(e)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){var i;const o=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,o);if(void 0!==r&&!0===o.reflect){const s=(void 0!==(null==(i=o.converter)?void 0:i.toAttribute)?o.converter:v).toAttribute(t,o.type);this._$Em=e,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(e,t){var i,o;const r=this.constructor,s=r._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=r.getPropertyOptions(s),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null==(i=e.converter)?void 0:i.fromAttribute)?e.converter:v;this._$Em=s;const a=n.fromAttribute(t,e.type);this[s]=a??(null==(o=this._$Ej)?void 0:o.get(s))??a,this._$Em=null}}requestUpdate(e,t,i){var o;if(void 0!==e){const r=this.constructor,s=this[e];if(i??(i=r.getPropertyOptions(e)),!((i.hasChanged??_)(s,t)||i.useDefault&&i.reflect&&s===(null==(o=this._$Ej)?void 0:o.get(e))&&!this.hasAttribute(r._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:o,wrapped:r},s){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==r||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===o&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,o=this[t];!0!==e||this._$AL.has(t)||void 0===o||this.C(t,void 0,i,o)}}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),null==(e=this._$EO)||e.forEach(e=>{var t;return null==(t=e.hostUpdate)?void 0:t.call(e)}),this.update(i)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;null==(t=this._$EO)||t.forEach(e=>{var t;return null==(t=e.hostUpdated)?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}}$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[g("elementProperties")]=new Map,$[g("finalized")]=new Map,null==y||y({ReactiveElement:$}),(m.reactiveElementVersions??(m.reactiveElementVersions=[])).push("2.1.1");
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const I={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:_},D=(e=I,t,i)=>{const{kind:o,metadata:r}=i;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),s.set(i.name,e),"accessor"===o){const{name:o}=i;return{set(i){const r=t.get.call(this);t.set.call(this,i),this.requestUpdate(o,r,e)},init(t){return void 0!==t&&this.C(o,void 0,e,t),t}}}if("setter"===o){const{name:o}=i;return function(i){const r=this[o];t.call(this,i),this.requestUpdate(o,r,e)}}throw Error("Unsupported decorator location: "+o)};function w(e){return(t,i)=>"object"==typeof i?D(e,t,i):((e,t,i)=>{const o=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),o?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/function C(e){return I({...e,state:!0,attribute:!1})}class S{static validateField(e,t,i,o,r,n=[]){const s=[];for(const a of n){const n=this.validateRule(e,t,i,o,r,a);n&&s.push(n)}return s}static validateRule(e,t,i,o,r,n){const s=null==o||""===o;switch(n.type){case"required":if(s)return this.createError(e,t,i,n);break;case"min":if(!s&&"number"==typeof o&&o<n.value)return this.createError(e,t,i,n);break;case"max":if(!s&&"number"==typeof o&&o>n.value)return this.createError(e,t,i,n);break;case"minLength":if(!s&&"string"==typeof o&&o.length<n.value)return this.createError(e,t,i,n);break;case"maxLength":if(!s&&"string"==typeof o&&o.length>n.value)return this.createError(e,t,i,n);break;case"pattern":if(!s&&"string"==typeof o){if(!new RegExp(n.value).test(o))return this.createError(e,t,i,n)}break;case"email":if(!s&&"string"==typeof o){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))return this.createError(e,t,i,n)}break;case"url":if(!s&&"string"==typeof o)try{new URL(o)}catch{return this.createError(e,t,i,n)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${n.type}`)}return null}static createError(e,t,i,o){return{fieldId:e,conceptId:t,columnId:i,message:o.message,severity:o.severity||"error",rule:o}}static validateDataType(e,t){if(null==e||""===e)return{valid:!0,convertedValue:e};switch(t){case"number":case"decimal":case"currency":case"percentage":{const t=Number(e);return isNaN(t)?{valid:!1,error:"Invalid number format"}:{valid:!0,convertedValue:t}}case"date":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid date format"}:{valid:!0,convertedValue:t.toISOString().split("T")[0]}}case"datetime":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid datetime format"}:{valid:!0,convertedValue:t.toISOString()}}case"boolean":if("boolean"==typeof e)return{valid:!0,convertedValue:e};if("string"==typeof e){const t=e.toLowerCase();if("true"===t||"1"===t)return{valid:!0,convertedValue:!0};if("false"===t||"0"===t)return{valid:!0,convertedValue:!1}}return{valid:!1,error:"Invalid boolean format"};case"text":case"textarea":case"email":case"url":case"tel":return{valid:!0,convertedValue:String(e)};default:return{valid:!0,convertedValue:e}}}static formatValue(e,t,i="en-US"){if(null==e)return"";switch(t){case"number":return new Intl.NumberFormat(i).format(Number(e));case"decimal":return new Intl.NumberFormat(i,{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(e));case"currency":return new Intl.NumberFormat(i,{style:"currency",currency:"USD"}).format(Number(e));case"percentage":return new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:2}).format(Number(e)/100);case"date":return new Date(e).toLocaleDateString(i);case"datetime":return new Date(e).toLocaleString(i);default:return String(e)}}}class F{static createUniqueConceptId(e){if(e.preferredLabel&&""!==e.preferredLabel.trim()){const t=e.preferredLabel.match(/\/([^\/]+)$/),i=t?t[1]:e.preferredLabel.replace(/[^a-zA-Z0-9]/g,"_");return`${e.id}_${i}`}return e.id}static buildFormSchema(e,t,i){var o;if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const r=e.presentation[0],n=null==(o=e.hypercubes)?void 0:o[0],s=[];return r.roles.forEach(e=>{const o=this.buildSectionFromRole(e,t,i,n);this.assignFieldColumnIds(o),s.push(o)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(r.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:s}}static buildSectionFromRole(e,t,i,o){var r;const n=this.extractRoleTitle(e.role),s=this.getAllNonAbstractConcepts(e),a=new Set(s.filter(e=>e.periodType).map(e=>e.periodType)),l=null==o?void 0:o.roles.find(t=>t.roleId===e.id);l?console.log(`π·οΈ Found matching hypercube role "${e.id}"`):console.log(`β No hypercube role found for "${e.id}"`);const d=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",l,s,a),c=d.map(e=>e.id);console.log(`π Available column IDs for role "${e.id}":`,c);const p={periodTypes:a,availableColumnIds:c},m=[];return(null==(r=e.presentationLinkbase)?void 0:r.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{const o=this.buildConceptTree(e,0,t,i,p);o&&m.push(o)}),{id:e.id,title:n,description:"",concepts:m,columns:d,expanded:!1}}static buildConceptTree(e,t,i,o,r){const n=this.getPreferredLabel(e.labels),s=[];if(!e.elementAbstract){let t=[];(null==r?void 0:r.availableColumnIds)&&r.availableColumnIds.length>0?(t=r.availableColumnIds.filter(t=>"instant"===e.periodType?t.includes("instant")||"instant"===t:"duration"!==e.periodType||(t.includes("duration")||"duration"===t)),0===t.length&&(t=r.availableColumnIds)):t=(null==r?void 0:r.periodTypes)&&0!==r.periodTypes.size?1===r.periodTypes.size&&r.periodTypes.has("instant")?["instant"]:1===r.periodTypes.size&&r.periodTypes.has("duration")?["duration"]:"instant"===e.periodType?["instant"]:"duration"===e.periodType?["duration"]:["duration","instant"]:["default"],t.forEach(t=>{const r=this.createFieldFromConcept(e,i,o,t);r&&s.push(r)})}const a=[];e.children&&e.children.length>0&&e.children.forEach(e=>{const n=this.buildConceptTree(e,t+1,i,o,r);n&&a.push(n)});return s.length>0||a.length>0?{id:this.createUniqueConceptId(e),originalConceptId:e.id,name:e.conceptName,label:n,description:`${e.conceptName} (${e.type})`,level:t,children:a,fields:s,collapsed:t>0,abstract:e.elementAbstract,periodType:e.periodType}:null}static createFieldFromConcept(e,t,i,o){const r=this.mapXBRLTypeToFieldType(e.type),n=this.getPreferredLabel(e.labels);let s;s=o||("instant"===e.periodType?"instant":"duration"===e.periodType?"duration":"default");const a={id:`${e.id}_${s}_field`,conceptId:e.id,columnId:s,type:r,label:n,placeholder:`Enter ${n.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null};return"duration"!==e.periodType&&"instant"!==e.periodType||(a.periodStartDate=t||"2025-01-01",a.periodEndDate=i||"2025-12-31"),a}static mapXBRLTypeToFieldType(e){return{"xbrli:stringItemType":"text","xbrli:monetaryItemType":"currency","xbrli:integerItemType":"number","xbrli:decimalItemType":"decimal","xbrli:percentItemType":"percentage","xbrli:dateItemType":"date","xbrli:booleanItemType":"boolean","dtr-types:domainItemType":"select","bw2-titel9:chamberOfCommerceRegistrationNumberItemType":"text"}[e]||"text"}static getPreferredLabel(e){if(!e||0===e.length)return"Unnamed Concept";const t=e.find(e=>e.preferredLabel);if(t)return t.label;const i=e.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(i)return i.label;const o=e.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return o?o.label:e[0].label}static assignFieldColumnIds(e){if(!e.columns||0===e.columns.length)return;const t=e.columns.map(e=>e.id);e.concepts.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static assignColumnIdsToConceptFields(e,t){e.fields=e.fields.filter(e=>t.includes(e.columnId)),e.children&&e.children.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static countFieldsInTree(e){let t=e.fields.length;return e.children&&e.children.forEach(e=>{t+=this.countFieldsInTree(e)}),t}static getAllNonAbstractConcepts(e){var t;const i=[];return(null==(t=e.presentationLinkbase)?void 0:t.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{this.collectNonAbstractConcepts(e,i)}),i}static collectNonAbstractConcepts(e,t){e.elementAbstract||t.push(e),e.children&&e.children.length>0&&e.children.forEach(e=>{this.collectNonAbstractConcepts(e,t)})}static generateDefaultColumnsForRole(e,t,i,o,r,n){var s,a,l;const d=r||this.getAllNonAbstractConcepts(e),c=n||new Set(d.filter(e=>e.periodType).map(e=>e.periodType));if(console.log(`π Analyzing role "${e.role}" with ${d.length} non-abstract concepts`),0===d.length)return console.log("π No non-abstract concepts found, using default column"),[{id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1}];let p=[];if(1===(null==(s=null==o?void 0:o.items)?void 0:s.length)){const r=o.items[0];console.log(`π Processing hypercube item for role "${e.role}":`,{itemId:r.id,conceptIds:(null==(a=r.conceptIds)?void 0:a.length)||0,dimensions:r.dimensions.length}),1===r.dimensions.length?p=this.generateSingleDimensionColumns(r.dimensions[0],t,i,c):r.dimensions.length>1&&(p=this.generateMultiDimensionColumns(r.dimensions,t,i,c))}else(null==(l=null==o?void 0:o.items)?void 0:l.length)&&o.items.length>1&&console.log(`β οΈ Multiple items found (${o.items.length}), skipping for now`);console.log(`π
Found period types: ${Array.from(c).join(", ")}`);const m=[];return p.length>0?m.push(...p):0===c.size?(console.log("π
No period types found, using default column"),m.push({id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1})):1===c.size&&c.has("instant")?(console.log("π
All concepts are instant type, creating single column"),m.push({id:"instant",title:`As of ${this.formatDateForDisplay(t)}`,description:`Values as of ${t}`,type:"base",order:0,removable:!1})):1===c.size&&c.has("duration")?(console.log("π
All concepts are duration type, creating single column with period range"),m.push({id:"duration",title:`${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)}`,description:`Period: ${t} to ${i}`,type:"base",order:0,removable:!1})):(console.log("π
Mixed period types found, creating both duration and instant columns"),m.push({id:"duration",title:`${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)}`,description:`Period: ${t} to ${i}`,type:"base",order:0,removable:!1}),m.push({id:"instant",title:`As of ${this.formatDateForDisplay(t)}`,description:`Values as of ${t}`,type:"base",order:1,removable:!1})),console.log(`π Generated ${m.length} columns for role "${e.role}":`,m.map(e=>e.title)),m}static generateSingleDimensionColumns(e,t,i,o){var r,n,s;if(e.typedMember){console.log("π Found typed member dimension:",{id:e.id,conceptName:e.conceptName,typedMemberId:e.typedMember.id});const n=(null==(r=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||e.conceptName,s=e.typedMember.id.split("_").pop()||"TypedMember",a={axisId:e.id,axisLabel:n,memberId:e.typedMember.id,memberLabel:s,dimensionKey:`${n} | ${s}`,dimensionIdKey:`${e.id} | ${e.typedMember.id}`};console.log("π Generated typed dimension info:",a);const l=[];if(0===o.size){const e={id:"default",title:a.memberLabel,description:"Default typed dimension column",type:"dimension",dimensionData:{dimensionId:"default",axisId:a.axisId,memberId:a.memberId,memberValue:a.memberLabel,axisLabel:a.axisLabel,memberLabel:a.memberLabel,isTypedMember:!0,dimensionIdKey:a.dimensionIdKey},order:0,removable:!1};console.log("π Generated typed member column:",e),l.push(e)}else o.has("instant")&&l.push({id:`instant_${a.axisId}_${a.memberId}`,title:`${a.memberLabel} (Instant)`,description:`${t}`,type:"dimension",dimensionData:{dimensionId:`instant_${a.axisId}_${a.memberId}`,axisId:a.axisId,memberId:a.memberId,memberValue:a.memberLabel,axisLabel:a.axisLabel,memberLabel:a.memberLabel,isTypedMember:!0,dimensionIdKey:a.dimensionIdKey},order:0,removable:!1}),o.has("duration")&&l.push({id:`duration_${a.axisId}_${a.memberId}`,title:`${a.memberLabel} (Duration)`,description:`${t} / ${i}`,type:"dimension",dimensionData:{dimensionId:`duration_${a.axisId}_${a.memberId}`,axisId:a.axisId,memberId:a.memberId,memberValue:a.memberLabel,axisLabel:a.axisLabel,memberLabel:a.memberLabel,isTypedMember:!0,dimensionIdKey:a.dimensionIdKey},order:1,removable:!1});return l}if(!e.members||!Array.isArray(e.members))return console.log(`β οΈ Dimension ${e.id} has no members defined, skipping column generation`),[];if(console.log("π Found single dimension:",{id:e.id,conceptName:e.conceptName,membersCount:e.members.length}),0===e.members.length)return[];const a=(null==(n=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||e.conceptName,l=e.members[0],d=(null==(s=l.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||l.conceptName,c={axisId:e.id,axisLabel:a,memberId:l.id,memberLabel:d,dimensionKey:`${a} | ${d}`,dimensionIdKey:`${e.id} | ${l.id}`};console.log("π Generated dimension info:",c);const p=[];return 0===o.size?p.push({id:"default",title:c.memberLabel,description:"Default value column",type:"dimension",dimensionData:{dimensionId:"default",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1}):1===o.size&&o.has("instant")?p.push({id:"instant",title:`${c.memberLabel} (${this.formatDateForDisplay(t)})`,description:`Values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"instant",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1}):1===o.size&&o.has("duration")?p.push({id:"duration",title:`${c.memberLabel} (${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)})`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1}):(p.push({id:"duration",title:`${c.memberLabel} (${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)})`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:0,removable:!1}),p.push({id:"instant",title:`${c.memberLabel} (${this.formatDateForDisplay(t)})`,description:`Values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"instant",axisId:c.axisId,memberId:c.memberId,memberValue:c.memberLabel,memberLabel:c.memberLabel,axis:c.axisLabel,axisLabel:c.axisLabel,memberKey:c.dimensionKey,dimensionIdKey:c.dimensionIdKey},order:1,removable:!1})),p}static generateMultiDimensionColumns(e,t,i,o){console.log(`π Processing ${e.length} dimensions for multi-dimensional columns`);const r=e.filter(e=>!!e.typedMember||(!(!e.members||!Array.isArray(e.members)||0===e.members.length)||(console.log(`β οΈ Skipping dimension ${e.id} - no members defined`),!1)));if(0===r.length)return console.log("β οΈ No valid dimensions with members found, skipping multi-dimensional column generation"),[];const n=r.map(e=>{var t;const i=(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName;if(e.typedMember){const t=e.typedMember.id.split("_").pop()||"TypedMember";return{id:e.id,axisLabel:i,isTypedDimension:!0,members:[{id:e.typedMember.id,label:t,isTypedMember:!0}]}}const o=this.getAllDimensionMembers(e.members);return{id:e.id,axisLabel:i,members:o.map(e=>{var t;return{id:e.id,label:(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName}})}}),s=this.generateDimensionCombinations(n);console.log(`π Generated ${s.length} dimension combinations`);const a=[];return s.forEach((e,r)=>{const n=e.map(e=>e.memberLabel).join(" | "),s={dimensionId:`multi_${r}`,memberValue:n,memberLabel:n,isTypedMember:e.some(e=>e.isTypedMember),combinations:e.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,memberId:e.memberId,memberLabel:e.memberLabel,isTypedMember:e.isTypedMember||!1})),memberKey:n,dimensionIdKey:e.map(e=>`${e.axisId}|${e.memberId}`).join("::")};0===o.size||1===o.size&&o.has("duration")?a.push({id:`duration_${r}`,title:`${n} (${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)})`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{...s,dimensionId:`duration_${r}`},order:2*r,removable:!1}):1===o.size&&o.has("instant")?a.push({id:`instant_${r}`,title:`${n} (${this.formatDateForDisplay(t)})`,description:`Values as of ${t}`,type:"dimension",dimensionData:{...s,dimensionId:`instant_${r}`},order:2*r,removable:!1}):(a.push({id:`duration_${r}`,title:`${n} (${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)})`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{...s,dimensionId:`duration_${r}`},order:2*r,removable:!1}),a.push({id:`instant_${r}`,title:`${n} (${this.formatDateForDisplay(t)})`,description:`Values as of ${t}`,type:"dimension",dimensionData:{...s,dimensionId:`instant_${r}`},order:2*r+1,removable:!1}))}),console.log(`π Generated ${a.length} multi-dimensional columns`),a}static getAllDimensionMembers(e){if(!e||!Array.isArray(e))return[];const t=[];return e.forEach(e=>{t.push(e),e.children&&e.children.length>0&&t.push(...this.getAllDimensionMembers(e.children))}),t}static generateDimensionCombinations(e){if(0===e.length)return[];if(1===e.length)return e[0].members.map(t=>[{axisId:e[0].id,axisLabel:e[0].axisLabel,memberId:t.id,memberLabel:t.label}]);const[t,...i]=e,o=this.generateDimensionCombinations(i),r=[];return t.members.forEach(e=>{0===o.length?r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label}]):o.forEach(i=>{r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label},...i])})}),r}static formatDateForDisplay(e){try{return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return e}}static extractEntityName(e){try{const t=new URL(e).pathname.split("/");return t[t.length-1].replace(".xsd","").replace(/[^a-zA-Z0-9]/g," ").trim()||"Entity"}catch{return"Entity"}}static extractRoleTitle(e){const t=e.match(/^\[[\d]+\]\s*(.+)$/);return t?t[1].trim():e}static extractRoleOrder(e){const t=e.match(/^\[([\d]+)\]/);return t?parseInt(t[1],10):0}static buildColumnsFromHypercubes(){return[{id:"default",label:"Values",type:"data"}]}}var E=Object.defineProperty,T=Object.getOwnPropertyDescriptor,k=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?T(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&E(t,i,n),n};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.value=null,this.disabled=!1,this.locale="en-US",this.hideLabel=!1,this._errors=[],this._touched=!1}willUpdate(e){(e.has("value")||e.has("field"))&&this._validateField()}_validateField(){var e;(null==(e=this.field)?void 0:e.validation)&&(this._errors=S.validateField(this.field.id,this.conceptId,this.columnId,this.value,this.field.type,this.field.validation))}_handleInput(e){const t=e.target;let i=t.value;"number"===this.field.type||"decimal"===this.field.type?i=""===i?null:Number(i):"boolean"===this.field.type&&(i=t.checked),this.value=i,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:i,oldValue:this.value},bubbles:!0}))}_handleFocus(){this.dispatchEvent(new CustomEvent("field-focus",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_handleBlur(){this._touched=!0,this.dispatchEvent(new CustomEvent("field-blur",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_renderInput(){var t;const i=this._errors.some(e=>"error"===e.severity),o=this._errors.some(e=>"warning"===e.severity),r="field-input "+(i?"error":o?"warning":""),n=`${this.conceptId}__${this.columnId}`,s=`data[${this.conceptId}][${this.columnId}]`;switch(this.field.type){case"textarea":return e.html`
|
|
22
|
+
*/function C(e){return w({...e,state:!0,attribute:!1})}class S{static validateField(e,t,i,o,r,s=[]){const n=[];for(const a of s){const s=this.validateRule(e,t,i,o,r,a);s&&n.push(s)}return n}static validateRule(e,t,i,o,r,s){const n=null==o||""===o;switch(s.type){case"required":if(n)return this.createError(e,t,i,s);break;case"min":if(!n&&"number"==typeof o&&o<s.value)return this.createError(e,t,i,s);break;case"max":if(!n&&"number"==typeof o&&o>s.value)return this.createError(e,t,i,s);break;case"minLength":if(!n&&"string"==typeof o&&o.length<s.value)return this.createError(e,t,i,s);break;case"maxLength":if(!n&&"string"==typeof o&&o.length>s.value)return this.createError(e,t,i,s);break;case"pattern":if(!n&&"string"==typeof o){if(!new RegExp(s.value).test(o))return this.createError(e,t,i,s)}break;case"email":if(!n&&"string"==typeof o){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))return this.createError(e,t,i,s)}break;case"url":if(!n&&"string"==typeof o)try{new URL(o)}catch{return this.createError(e,t,i,s)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${s.type}`)}return null}static createError(e,t,i,o){return{fieldId:e,conceptId:t,columnId:i,message:o.message,severity:o.severity||"error",rule:o}}static validateDataType(e,t){if(null==e||""===e)return{valid:!0,convertedValue:e};switch(t){case"number":case"decimal":case"currency":case"percentage":{const t=Number(e);return isNaN(t)?{valid:!1,error:"Invalid number format"}:{valid:!0,convertedValue:t}}case"date":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid date format"}:{valid:!0,convertedValue:t.toISOString().split("T")[0]}}case"datetime":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid datetime format"}:{valid:!0,convertedValue:t.toISOString()}}case"boolean":if("boolean"==typeof e)return{valid:!0,convertedValue:e};if("string"==typeof e){const t=e.toLowerCase();if("true"===t||"1"===t)return{valid:!0,convertedValue:!0};if("false"===t||"0"===t)return{valid:!0,convertedValue:!1}}return{valid:!1,error:"Invalid boolean format"};case"text":case"textarea":case"email":case"url":case"tel":return{valid:!0,convertedValue:String(e)};default:return{valid:!0,convertedValue:e}}}static formatValue(e,t,i="en-US"){if(null==e)return"";switch(t){case"number":return new Intl.NumberFormat(i).format(Number(e));case"decimal":return new Intl.NumberFormat(i,{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(e));case"currency":return new Intl.NumberFormat(i,{style:"currency",currency:"USD"}).format(Number(e));case"percentage":return new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:2}).format(Number(e)/100);case"date":return new Date(e).toLocaleDateString(i);case"datetime":return new Date(e).toLocaleString(i);default:return String(e)}}}class A{static createUniqueConceptId(e,t){let i=e.id;if(e.preferredLabel&&""!==e.preferredLabel.trim()){const t=e.preferredLabel.match(/\/([^\/]+)$/),o=t?t[1]:e.preferredLabel.replace(/[^a-zA-Z0-9]/g,"_");i=`${e.id}_${o}`}if(t){return`${i}__${this.createSectionHash(t)}`}return i}static createSectionHash(e){let t=0;for(let i=0;i<e.length;i++){t=(t<<5)-t+e.charCodeAt(i),t&=t}return Math.abs(t).toString(36).substr(0,6)}static buildFormSchema(e,t,i){var o;if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const r=e.presentation[0],s=null==(o=e.hypercubes)?void 0:o[0],n=[];return r.roles.forEach(e=>{const o=this.buildSectionFromRole(e,t,i,s);this.assignFieldColumnIds(o),n.push(o)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(r.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:n}}static buildSectionFromRole(e,t,i,o){var r;const s=this.extractRoleTitle(e.role),n=this.getAllNonAbstractConcepts(e),a=new Set(n.filter(e=>e.periodType).map(e=>e.periodType)),l=null==o?void 0:o.roles.find(t=>t.roleId===e.id);l?console.log(`π·οΈ Found matching hypercube role "${e.id}"`):console.log(`β No hypercube role found for "${e.id}"`);const d=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",l,n,a),c=d.map(e=>e.id);console.log(`π Available column IDs for role "${e.id}":`,c),c.some(e=>e.includes("multi_"))&&(console.log(`π [DEBUG] Multi-dimensional role "${e.role}" - Total columns generated: ${d.length}`),d.forEach((e,t)=>{console.log(` Column ${t}: id=${e.id}, title=${e.title}, type=${e.type}`)}));const p={periodTypes:a,availableColumnIds:c},h=[];return(null==(r=e.presentationLinkbase)?void 0:r.concepts)&&e.presentationLinkbase.concepts.forEach(o=>{const r=this.buildConceptTree(o,0,t,i,p,e.id);r&&h.push(r)}),{id:e.id,title:s,description:e.description||`Section for ${s}`,concepts:h,columns:d,expanded:!1,metadata:{roleURI:e.roleURI,originalRole:e.role}}}static buildConceptTree(e,t,i,o,r,s){const n=this.getPreferredLabel(e.labels),a=[];if(!e.elementAbstract){let t=[];(null==r?void 0:r.availableColumnIds)&&r.availableColumnIds.length>0?(t=r.availableColumnIds.filter(t=>"instant"===e.periodType?t.includes("instant")||"instant"===t:"duration"!==e.periodType||(t.includes("duration")||"duration"===t)),0===t.length&&(t=r.availableColumnIds)):t=(null==r?void 0:r.periodTypes)&&0!==r.periodTypes.size?1===r.periodTypes.size&&r.periodTypes.has("instant")?["instant"]:1===r.periodTypes.size&&r.periodTypes.has("duration")?["duration"]:"instant"===e.periodType?["instant"]:"duration"===e.periodType?["duration"]:["duration","instant"]:["default"],t.forEach(t=>{const r=this.createFieldFromConcept(e,i,o,t);r&&a.push(r)})}const l=[];e.children&&e.children.length>0&&e.children.forEach(e=>{const n=this.buildConceptTree(e,t+1,i,o,r,s);n&&l.push(n)});return a.length>0||l.length>0?{id:this.createUniqueConceptId(e,s),originalConceptId:e.id,name:e.conceptName,label:n,description:`${e.conceptName} (${e.type})`,level:t,children:l,fields:a,collapsed:t>0,abstract:e.elementAbstract,periodType:e.periodType}:null}static createFieldFromConcept(e,t,i,o){const r=this.mapXBRLTypeToFieldType(e.type),s=this.getPreferredLabel(e.labels);let n;n=o||("instant"===e.periodType?"instant":"duration"===e.periodType?"duration":"default");const a={id:`${e.id}_${n}_field`,conceptId:e.id,columnId:n,type:r,label:s,placeholder:`Enter ${s.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null};return"duration"!==e.periodType&&"instant"!==e.periodType||(a.periodStartDate=t||"2025-01-01",a.periodEndDate=i||"2025-12-31"),a}static mapXBRLTypeToFieldType(e){return{"xbrli:stringItemType":"text","xbrli:monetaryItemType":"currency","xbrli:integerItemType":"number","xbrli:decimalItemType":"decimal","xbrli:percentItemType":"percentage","xbrli:dateItemType":"date","xbrli:booleanItemType":"boolean","dtr-types:domainItemType":"select","bw2-titel9:chamberOfCommerceRegistrationNumberItemType":"text"}[e]||"text"}static getPreferredLabel(e){if(!e||0===e.length)return"Unnamed Concept";const t=e.find(e=>e.preferredLabel);if(t)return t.label;const i=e.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(i)return i.label;const o=e.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return o?o.label:e[0].label}static assignFieldColumnIds(e){if(!e.columns||0===e.columns.length)return;const t=e.columns.map(e=>e.id);e.concepts.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static assignColumnIdsToConceptFields(e,t){e.fields=e.fields.filter(e=>t.includes(e.columnId)),e.children&&e.children.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static countFieldsInTree(e){let t=e.fields.length;return e.children&&e.children.forEach(e=>{t+=this.countFieldsInTree(e)}),t}static getAllNonAbstractConcepts(e){var t;const i=[];return(null==(t=e.presentationLinkbase)?void 0:t.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{this.collectNonAbstractConcepts(e,i)}),i}static collectNonAbstractConcepts(e,t){e.elementAbstract||t.push(e),e.children&&e.children.length>0&&e.children.forEach(e=>{this.collectNonAbstractConcepts(e,t)})}static generateDefaultColumnsForRole(e,t,i,o,r,s){var n,a,l;const d=r||this.getAllNonAbstractConcepts(e),c=s||new Set(d.filter(e=>e.periodType).map(e=>e.periodType));if(console.log(`π Analyzing role "${e.role}" with ${d.length} non-abstract concepts`),0===d.length)return console.log("π No non-abstract concepts found, using default column"),[{id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1}];let p=[];if(1===(null==(n=null==o?void 0:o.items)?void 0:n.length)){const r=o.items[0];console.log(`π Processing hypercube item for role "${e.role}":`,{itemId:r.id,conceptIds:(null==(a=r.conceptIds)?void 0:a.length)||0,dimensions:r.dimensions.length}),1===r.dimensions.length?p=this.generateSingleDimensionColumns(r.dimensions[0],t,i,c):r.dimensions.length>1&&(p=this.generateMultiDimensionColumns(r.dimensions,t,i,c))}else(null==(l=null==o?void 0:o.items)?void 0:l.length)&&o.items.length>1&&console.log(`β οΈ Multiple items found (${o.items.length}), skipping for now`);console.log(`π
Found period types: ${Array.from(c).join(", ")}`);const h=[];return p.length>0?h.push(...p):0===c.size?(console.log("π
No period types found, using default column"),h.push({id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1})):1===c.size&&c.has("instant")?(console.log("π
All concepts are instant type, creating single column"),h.push({id:"instant",title:"Current",description:`Values as of ${t}`,type:"base",order:0,removable:!1})):1===c.size&&c.has("duration")?(console.log("π
All concepts are duration type, creating single column with period range"),h.push({id:"duration",title:"Current Period",description:`Period: ${t} to ${i}`,type:"base",order:0,removable:!1})):(console.log("π
Mixed period types found, creating both duration and instant columns"),h.push({id:"duration",title:"Current Period",description:`Period: ${t} to ${i}`,type:"base",order:0,removable:!1}),h.push({id:"instant",title:"Current",description:`Values as of ${t}`,type:"base",order:1,removable:!1})),console.log(`π Generated ${h.length} columns for role "${e.role}":`,h.map(e=>e.title)),h}static generateSingleDimensionColumns(e,t,i,o){var r,s,n,a,l;if(console.log("π Processing single dimension:",{id:e.id,conceptName:e.conceptName,hasMembers:!(!e.members||!Array.isArray(e.members)),membersCount:(null==(r=e.members)?void 0:r.length)||0,hasTypedMember:!!e.typedMember,typedMemberId:null==(s=e.typedMember)?void 0:s.id}),e.typedMember&&(!e.members||0===e.members.length)){console.log(`π€ Processing typed dimension: ${e.id} with typed member: ${e.typedMember.id}`);const r=(null==(n=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||e.conceptName,s={axisId:e.id,axisLabel:r,typedMemberId:e.typedMember.id,dimensionKey:`${r} | [Typed Input]`,dimensionIdKey:`${e.id}|[typed]`};console.log("π€ Generated typed dimension info:",s);const a=[];return 0===o.size?a.push({id:"typed-default",title:r,description:"Typed dimension input column",type:"dimension",dimensionData:{dimensionId:"typed-default",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):1===o.size&&o.has("instant")?a.push({id:"typed-instant",title:`${r} [Typed Input Available]`,description:`Typed values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"typed-instant",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):1===o.size&&o.has("duration")?a.push({id:"typed-duration",title:`${r} [Typed Input Available]`,description:`Typed values for period ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"typed-duration",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}):(a.push({id:"typed-duration",title:`${r} [Typed Input Available]`,description:`Typed values for period ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"typed-duration",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:0,removable:!1}),a.push({id:"typed-instant",title:`${r} [Typed Input Available]`,description:`Typed values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"typed-instant",axisId:s.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:s.axisLabel,axisLabel:s.axisLabel,memberKey:s.dimensionKey,dimensionIdKey:s.dimensionIdKey,hasTypedMembers:!0,typedMemberId:s.typedMemberId,typedMembers:[{axisId:s.axisId,axisLabel:s.axisLabel,typedMemberId:s.typedMemberId,memberLabel:s.axisLabel}]},order:1,removable:!1})),console.log(`π€ Generated ${a.length} typed dimension columns`),a}if(!e.members||!Array.isArray(e.members))return console.log(`β οΈ Dimension ${e.id} has no members defined and no typed member, skipping column generation`),[];if(console.log("π Found single dimension:",{id:e.id,conceptName:e.conceptName,membersCount:e.members.length}),0===e.members.length)return[];const d=(null==(a=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:a.label)||e.conceptName,c=e.members[0],p=(null==(l=c.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:l.label)||c.conceptName,h={axisId:e.id,axisLabel:d,memberId:c.id,memberLabel:p,dimensionKey:`${d} | ${p}`,dimensionIdKey:`${e.id} | ${c.id}`};console.log("π Generated dimension info:",h);const u=[];return 0===o.size?u.push({id:"default",title:h.memberLabel,description:"Default value column",type:"dimension",dimensionData:{dimensionId:"default",axisId:h.axisId,memberId:h.memberId,memberValue:h.memberLabel,memberLabel:h.memberLabel,axis:h.axisLabel,axisLabel:h.axisLabel,memberKey:h.dimensionKey,dimensionIdKey:h.dimensionIdKey},order:0,removable:!1}):1===o.size&&o.has("instant")?u.push({id:"instant",title:`${h.memberLabel}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"instant",axisId:h.axisId,memberId:h.memberId,memberValue:h.memberLabel,memberLabel:h.memberLabel,axis:h.axisLabel,axisLabel:h.axisLabel,memberKey:h.dimensionKey,dimensionIdKey:h.dimensionIdKey},order:0,removable:!1}):1===o.size&&o.has("duration")?u.push({id:"duration",title:`${h.memberLabel}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:h.axisId,memberId:h.memberId,memberValue:h.memberLabel,memberLabel:h.memberLabel,axis:h.axisLabel,axisLabel:h.axisLabel,memberKey:h.dimensionKey,dimensionIdKey:h.dimensionIdKey},order:0,removable:!1}):(u.push({id:"duration",title:`${h.memberLabel}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:h.axisId,memberId:h.memberId,memberValue:h.memberLabel,memberLabel:h.memberLabel,axis:h.axisLabel,axisLabel:h.axisLabel,memberKey:h.dimensionKey,dimensionIdKey:h.dimensionIdKey},order:0,removable:!1}),u.push({id:"instant",title:`${h.memberLabel}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{dimensionId:"instant",axisId:h.axisId,memberId:h.memberId,memberValue:h.memberLabel,memberLabel:h.memberLabel,axis:h.axisLabel,axisLabel:h.axisLabel,memberKey:h.dimensionKey,dimensionIdKey:h.dimensionIdKey},order:1,removable:!1})),u}static generateMultiDimensionColumns(e,t,i,o){console.log(`π Processing ${e.length} dimensions for multi-dimensional columns`),console.log("π [DEBUG] Input dimensions:",e.map(e=>{var t,i,o;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,membersCount:(null==(o=e.members)?void 0:o.length)||0,hasTypedMember:!!e.typedMember}}));e.some(e=>e.typedMember)&&console.log("π€ Found typed members in dimensions - will indicate in column headers");const r=e.filter(e=>e.typedMember?(console.log(`π€ Keeping typed dimension: ${e.id} with typed member: ${e.typedMember.id}`),!0):e.members&&Array.isArray(e.members)&&e.members.length>0?(console.log(`π Keeping domain dimension: ${e.id} with ${e.members.length} members`),!0):(console.log(`β οΈ Skipping dimension ${e.id} - no members or typed member defined`),!1));if(0===r.length)return console.log("β οΈ No valid dimensions with members found, skipping multi-dimensional column generation"),[];const s=r.map(e=>{var t;const i=(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName;if(e.typedMember)return{id:e.id,axisLabel:i,isTyped:!0,typedMemberId:e.typedMember.id,members:[{id:"[typed]",label:`${i} [Typed Input Available]`}]};const o=this.getAllDimensionMembers(e.members);return{id:e.id,axisLabel:i,isTyped:!1,members:o.map(e=>{var t;return{id:e.id,label:(null==(t=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:t.label)||e.conceptName}})}}),n=this.generateDimensionCombinations(s);console.log(`π Generated ${n.length} dimension combinations`),console.log("π [DEBUG] Generated combinations:",n.map(e=>({memberLabels:e.map(e=>e.memberLabel),axisIds:e.map(e=>e.axisId),memberIds:e.map(e=>e.memberId)})));const a=[];return n.forEach((e,r)=>{var s,n;const l=e.map(e=>e.memberLabel).join(" | "),d=e.filter(e=>e.isTyped),c=e.filter(e=>!e.isTyped);console.log(`π [Column ${r}] Combination analysis:`,{totalMembers:e.length,typedMembers:d.length,domainMembers:c.length,hasTypedMembers:d.length>0,columnTitle:l,memberLabels:e.map(e=>e.memberLabel),memberIds:e.map(e=>e.memberId)});const p={dimensionId:`multi_${r}`,memberValue:l,memberLabel:l,combinations:c.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,memberId:e.memberId,memberLabel:e.memberLabel})),typedMembers:d.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.typedMemberId,memberLabel:e.memberLabel})),hasTypedMembers:d.length>0,memberKey:l,dimensionIdKey:[...c.map(e=>`${e.axisId}|${e.memberId}`),...d.map(e=>`${e.axisId}|[typed]`)].join("::")};console.log(`π [Column ${r}] Final dimension data:`,{dimensionId:p.dimensionId,memberLabel:p.memberLabel,dimensionIdKey:p.dimensionIdKey,combinationsCount:null==(s=p.combinations)?void 0:s.length,typedMembersCount:null==(n=p.typedMembers)?void 0:n.length}),0===o.size||1===o.size&&o.has("duration")?a.push({id:`duration_${r}`,title:`${l}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{...p,dimensionId:`duration_${r}`},order:2*r,removable:!1}):1===o.size&&o.has("instant")?a.push({id:`instant_${r}`,title:`${l}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{...p,dimensionId:`instant_${r}`},order:2*r,removable:!1}):(a.push({id:`duration_${r}`,title:`${l}`,description:`Period: ${t} to ${i}`,type:"dimension",dimensionData:{...p,dimensionId:`duration_${r}`},order:2*r,removable:!1}),a.push({id:`instant_${r}`,title:`${l}`,description:`Values as of ${t}`,type:"dimension",dimensionData:{...p,dimensionId:`instant_${r}`},order:2*r+1,removable:!1}))}),console.log(`π Generated ${a.length} multi-dimensional columns`),a}static getAllDimensionMembers(e){if(!e||!Array.isArray(e))return[];const t=[];return e.forEach(e=>{t.push(e),e.children&&e.children.length>0&&t.push(...this.getAllDimensionMembers(e.children))}),t}static generateDimensionCombinations(e){if(0===e.length)return[];if(1===e.length)return e[0].members.map(t=>[{axisId:e[0].id,axisLabel:e[0].axisLabel,memberId:t.id,memberLabel:t.label,isTyped:e[0].isTyped||!1,typedMemberId:e[0].typedMemberId}]);const[t,...i]=e,o=this.generateDimensionCombinations(i),r=[];return t.members.forEach(e=>{0===o.length?r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId}]):o.forEach(i=>{r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId},...i])})}),r}static formatDateForDisplay(e){try{return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return e}}static extractEntityName(e){try{const t=new URL(e).pathname.split("/");return t[t.length-1].replace(".xsd","").replace(/[^a-zA-Z0-9]/g," ").trim()||"Entity"}catch{return"Entity"}}static extractRoleTitle(e){const t=e.match(/^\[[\d]+\]\s*(.+)$/);return t?t[1].trim():e}static extractRoleOrder(e){const t=e.match(/^\[([\d]+)\]/);return t?parseInt(t[1],10):0}static buildColumnsFromHypercubes(){return[{id:"default",label:"Values",type:"data"}]}}var T=Object.defineProperty,F=Object.getOwnPropertyDescriptor,E=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?F(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&&T(t,i,s),s};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.value=null,this.disabled=!1,this.locale="en-US",this.hideLabel=!1,this._errors=[],this._touched=!1}willUpdate(e){(e.has("value")||e.has("field"))&&this._validateField()}_validateField(){var e;(null==(e=this.field)?void 0:e.validation)&&(this._errors=S.validateField(this.field.id,this.conceptId,this.columnId,this.value,this.field.type,this.field.validation))}_handleInput(e){const t=e.target;let i=t.value;"number"===this.field.type||"decimal"===this.field.type?i=""===i?null:Number(i):"boolean"===this.field.type&&(i=t.checked),this.value=i,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:i,oldValue:this.value},bubbles:!0}))}_handleFocus(){this.dispatchEvent(new CustomEvent("field-focus",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_handleBlur(){this._touched=!0,this.dispatchEvent(new CustomEvent("field-blur",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_renderInput(){var t;const i=this._errors.some(e=>"error"===e.severity),o=this._errors.some(e=>"warning"===e.severity),r="field-input "+(i?"error":o?"warning":""),s=`${this.conceptId}__${this.columnId}`,n=`data[${this.conceptId}][${this.columnId}]`;switch(this.field.type){case"textarea":return e.html`
|
|
23
23
|
<textarea
|
|
24
|
-
id="${
|
|
25
|
-
name="${
|
|
24
|
+
id="${s}"
|
|
25
|
+
name="${n}"
|
|
26
26
|
class="${r}"
|
|
27
27
|
.value="${this.value||""}"
|
|
28
28
|
?disabled="${this.disabled||this.field.disabled}"
|
|
@@ -33,8 +33,8 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
33
33
|
></textarea>
|
|
34
34
|
`;case"select":return e.html`
|
|
35
35
|
<select
|
|
36
|
-
id="${
|
|
37
|
-
name="${
|
|
36
|
+
id="${s}"
|
|
37
|
+
name="${n}"
|
|
38
38
|
class="${r}"
|
|
39
39
|
.value="${this.value||""}"
|
|
40
40
|
?disabled="${this.disabled||this.field.disabled}"
|
|
@@ -56,8 +56,8 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
56
56
|
`;case"boolean":return e.html`
|
|
57
57
|
<div class="checkbox-container">
|
|
58
58
|
<input
|
|
59
|
-
id="${
|
|
60
|
-
name="${
|
|
59
|
+
id="${s}"
|
|
60
|
+
name="${n}"
|
|
61
61
|
type="checkbox"
|
|
62
62
|
class="field-input"
|
|
63
63
|
.checked="${Boolean(this.value)}"
|
|
@@ -70,8 +70,8 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
70
70
|
</div>
|
|
71
71
|
`;default:return e.html`
|
|
72
72
|
<input
|
|
73
|
-
id="${
|
|
74
|
-
name="${
|
|
73
|
+
id="${s}"
|
|
74
|
+
name="${n}"
|
|
75
75
|
type="${this._getInputType()}"
|
|
76
76
|
class="${r}"
|
|
77
77
|
.value="${this.value||""}"
|
|
@@ -206,7 +206,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
206
206
|
margin: 0;
|
|
207
207
|
width: auto;
|
|
208
208
|
}
|
|
209
|
-
`,
|
|
209
|
+
`,E([w({type:Object})],exports.JupiterFormField.prototype,"field",2),E([w({type:String})],exports.JupiterFormField.prototype,"conceptId",2),E([w({type:String})],exports.JupiterFormField.prototype,"columnId",2),E([w()],exports.JupiterFormField.prototype,"value",2),E([w({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),E([w({type:String})],exports.JupiterFormField.prototype,"locale",2),E([w({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),E([C()],exports.JupiterFormField.prototype,"_errors",2),E([C()],exports.JupiterFormField.prototype,"_touched",2),exports.JupiterFormField=E([t("jupiter-form-field")],exports.JupiterFormField);var k=Object.defineProperty,j=Object.getOwnPropertyDescriptor,L=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?j(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&&k(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}">
|
|
@@ -340,7 +340,9 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
340
340
|
.children-wrapper {
|
|
341
341
|
display: none;
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
`,L([w({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),L([w({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),L([w({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),L([w({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),L([w({type:String})],exports.JupiterConceptTree.prototype,"locale",2),L([w({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),L([C()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=L([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._startDate="",this._endDate="",this._instantDate="",this._selectedType="duration"}updated(e){e.has("open")&&this.open&&this._resetForm()}connectedCallback(){super.connectedCallback(),this._resetForm()}willUpdate(e){super.willUpdate(e),e.has("open")&&this.open&&this._resetForm()}_resetForm(){const e=(new Date).toISOString().split("T")[0];this._startDate=e,this._endDate=e,this._instantDate=e,this._selectedType="duration"}_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.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}render(){if(!this.open)return e.html``;const t=this._isFormValid();return e.html`
|
|
344
346
|
<div class="dialog" @click="${e=>e.stopPropagation()}">
|
|
345
347
|
<div class="dialog-header">
|
|
346
348
|
<h2 class="dialog-title">Add Column</h2>
|
|
@@ -548,7 +550,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
548
550
|
background: var(--jupiter-disabled-background, #ccc);
|
|
549
551
|
cursor: not-allowed;
|
|
550
552
|
}
|
|
551
|
-
`,
|
|
553
|
+
`,P([w({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),P([w({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),P([C()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),exports.JupiterAddColumnDialog=P([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var U=Object.defineProperty,N=Object.getOwnPropertyDescriptor,z=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?N(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&&U(t,i,s),s};exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.typedMemberData={},this.disabled=!1,this.collapsible=!0,this.locale="en-US",this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._expandedConcepts=new Set}connectedCallback(){super.connectedCallback(),this._expanded=!1!==this.section.expanded,this._determinePeriodType()}_determinePeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(console.log(`π Section ${this.section.id} (${this.section.title}): Found ${e.length} non-abstract concepts`),console.log("π All concepts in section:",this.section.concepts.map(e=>({name:e.name,abstract:e.abstract,periodType:e.periodType}))),0===e.length)return this._sectionPeriodType="duration",void console.log(`π Section ${this.section.id}: No concepts, defaulting to duration`);const t=new Set(e.map(e=>e.periodType).filter(Boolean));if(console.log(`π·οΈ Section ${this.section.id}: Found period types:`,Array.from(t)),console.log(`π Section ${this.section.id}: Non-abstract concepts and their period types:`,e.map(e=>({name:e.name,periodType:e.periodType,abstract:e.abstract}))),0===t.size)this._sectionPeriodType="duration",console.log(`π Section ${this.section.id}: No period types defined, defaulting to duration`);else if(1===t.size){const e=Array.from(t)[0];this._sectionPeriodType="instant"===e?"instant":"duration",console.log(`π Section ${this.section.id}: Single period type '${e}', setting to '${this._sectionPeriodType}'`)}else this._sectionPeriodType="mixed",console.log(`π Section ${this.section.id}: Mixed period types, setting to 'mixed'`);console.log(`β
Section ${this.section.id}: Final period type: ${this._sectionPeriodType}`)}_getAllNonAbstractConcepts(e){const t=[];for(const i of e)i.abstract||t.push(i),i.children&&t.push(...this._getAllNonAbstractConcepts(i.children));return t}_toggleExpanded(){this.collapsible&&(this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:this._expanded},bubbles:!0})))}_handleRemoveColumn(e){this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_handleAddColumn(){const e=this._determineButtonPeriodType();this._sectionPeriodType=e,this._showAddColumnDialog=!0}_determineButtonPeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(0===e.length)return"duration";const t=new Set(e.map(e=>e.periodType).filter(e=>null!=e));if(0===t.size)return"duration";if(1===t.size){return"instant"===Array.from(t)[0]?"instant":"duration"}return"mixed"}_getConceptsWithFields(e){const t=[];for(const i of e)!i.abstract&&i.fields&&i.fields.length>0&&t.push(i),i.children&&t.push(...this._getConceptsWithFields(i.children));return t}_handleDialogCancel(){this._showAddColumnDialog=!1}_handleColumnAdd(e){e.stopPropagation(),this._showAddColumnDialog=!1,this.dispatchEvent(new CustomEvent("column-add-request",{detail:{sectionId:this.section.id,columnRequest:e.detail},bubbles:!0}))}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}_flattenConcepts(e,t=new Set){const i=[];for(const o of e)if(i.push(o),o.children&&o.children.length>0&&t.has(o.id)){const e=this._flattenConcepts(o.children,t);i.push(...e)}return i}_handleConceptExpand(e){e.stopPropagation();const{conceptId:t,expanded:i}=e.detail;i?this._expandedConcepts.add(t):this._expandedConcepts.delete(t),this.requestUpdate(),this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_getTypedMemberHeaderValue(e,t){var i;return(null==(i=this.typedMemberData[e])?void 0:i[t])||""}_handleTypedMemberHeaderChange(e,t,i){const o=e.target.value;console.log(`π [FormSection] Typed member header change: columnId=${t}, axisId=${i}, value=${o}`),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}render(){return this.section.concepts&&0!==this.section.concepts.length?e.html`
|
|
552
554
|
<div class="section-header ${this.collapsible?"":"not-collapsible"}"
|
|
553
555
|
@click="${this._toggleExpanded}">
|
|
554
556
|
<div>
|
|
@@ -568,28 +570,39 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
568
570
|
<thead class="table-header">
|
|
569
571
|
<tr class="header-row">
|
|
570
572
|
<th class="header-cell concept-column">Concept</th>
|
|
571
|
-
${this.columns.map(t=>{var i;return e.html`
|
|
573
|
+
${this.columns.map(t=>{var i,o,r;return e.html`
|
|
572
574
|
<th class="header-cell ${t.removable?"removable":""}">
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
<input
|
|
578
|
-
type="text"
|
|
579
|
-
placeholder="Enter typed member value"
|
|
580
|
-
.value="${this._typedMemberValues[t.id]||""}"
|
|
581
|
-
@input="${e=>this._handleTypedMemberValueChange(t.id,e.target.value)}"
|
|
582
|
-
style="width: 100%; padding: 4px; border: 1px solid #ccc; border-radius: 3px; font-size: 12px;"
|
|
583
|
-
/>
|
|
575
|
+
<div class="column-header-content">
|
|
576
|
+
<div class="column-title">
|
|
577
|
+
${t.title}
|
|
578
|
+
${t.description?e.html`<div style="font-weight: normal; font-size: 12px; color: var(--jupiter-text-secondary, #666);">${t.description}</div>`:""}
|
|
584
579
|
</div>
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
class="
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
580
|
+
|
|
581
|
+
<!-- Typed member input fields in column header -->
|
|
582
|
+
${(null==(i=t.dimensionData)?void 0:i.hasTypedMembers)?e.html`
|
|
583
|
+
<div class="typed-members-header">
|
|
584
|
+
${null==(r=null==(o=t.dimensionData)?void 0:o.typedMembers)?void 0:r.map(i=>e.html`
|
|
585
|
+
<div class="typed-member-header-input">
|
|
586
|
+
<input
|
|
587
|
+
type="text"
|
|
588
|
+
class="typed-member-header-field"
|
|
589
|
+
placeholder="Enter ${i.axisLabel}"
|
|
590
|
+
.value="${this._getTypedMemberHeaderValue(t.id,i.axisId)}"
|
|
591
|
+
@input="${e=>this._handleTypedMemberHeaderChange(e,t.id,i.axisId)}"
|
|
592
|
+
/>
|
|
593
|
+
</div>
|
|
594
|
+
`)}
|
|
595
|
+
</div>
|
|
596
|
+
`:""}
|
|
597
|
+
|
|
598
|
+
${t.removable?e.html`
|
|
599
|
+
<button
|
|
600
|
+
class="remove-column-btn"
|
|
601
|
+
@click="${e=>{e.stopPropagation(),this._handleRemoveColumn(t.id)}}"
|
|
602
|
+
title="Remove column"
|
|
603
|
+
>Γ</button>
|
|
604
|
+
`:""}
|
|
605
|
+
</div>
|
|
593
606
|
</th>
|
|
594
607
|
`})}
|
|
595
608
|
<th class="header-cell">
|
|
@@ -803,13 +816,507 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
803
816
|
background: var(--jupiter-primary-color-dark, #5a6fd8);
|
|
804
817
|
}
|
|
805
818
|
|
|
819
|
+
/* Column header content styling */
|
|
820
|
+
.column-header-content {
|
|
821
|
+
display: flex;
|
|
822
|
+
flex-direction: column;
|
|
823
|
+
gap: 8px;
|
|
824
|
+
align-items: center;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
.column-title {
|
|
828
|
+
text-align: center;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/* Typed member header input styles */
|
|
832
|
+
.typed-members-header {
|
|
833
|
+
display: flex;
|
|
834
|
+
flex-direction: column;
|
|
835
|
+
gap: 4px;
|
|
836
|
+
width: 100%;
|
|
837
|
+
padding: 8px;
|
|
838
|
+
background: var(--jupiter-typed-member-header-background, #f8f9fa);
|
|
839
|
+
border-radius: 4px;
|
|
840
|
+
border: 1px solid var(--jupiter-border-color, #e0e0e0);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
.typed-member-header-input {
|
|
844
|
+
display: flex;
|
|
845
|
+
flex-direction: column;
|
|
846
|
+
gap: 2px;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.typed-member-header-label {
|
|
850
|
+
font-size: 11px;
|
|
851
|
+
font-weight: 500;
|
|
852
|
+
color: var(--jupiter-text-secondary, #666);
|
|
853
|
+
text-align: left;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
.typed-member-header-field {
|
|
857
|
+
width: 100%;
|
|
858
|
+
padding: 4px 6px;
|
|
859
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
860
|
+
border-radius: 3px;
|
|
861
|
+
font-size: 12px;
|
|
862
|
+
background: var(--jupiter-input-background, #fff);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
.typed-member-header-field:focus {
|
|
866
|
+
outline: none;
|
|
867
|
+
border-color: var(--jupiter-primary-color, #1976d2);
|
|
868
|
+
box-shadow: 0 0 0 1px var(--jupiter-primary-color, #1976d2);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
.typed-member-header-field::placeholder {
|
|
872
|
+
color: var(--jupiter-text-placeholder, #999);
|
|
873
|
+
font-size: 11px;
|
|
874
|
+
}
|
|
875
|
+
|
|
806
876
|
.empty-section {
|
|
807
877
|
padding: 24px;
|
|
808
878
|
text-align: center;
|
|
809
879
|
color: var(--jupiter-text-secondary, #666);
|
|
810
880
|
font-style: italic;
|
|
811
881
|
}
|
|
812
|
-
`,U([I({type:Object})],exports.JupiterFormSection.prototype,"section",2),U([I({type:Array})],exports.JupiterFormSection.prototype,"columns",2),U([I({type:Object})],exports.JupiterFormSection.prototype,"formData",2),U([I({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),U([I({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),U([I({type:String})],exports.JupiterFormSection.prototype,"locale",2),U([C()],exports.JupiterFormSection.prototype,"_expanded",2),U([C()],exports.JupiterFormSection.prototype,"_showAddColumnDialog",2),U([C()],exports.JupiterFormSection.prototype,"_sectionPeriodType",2),U([C()],exports.JupiterFormSection.prototype,"_typedMemberValues",2),U([C()],exports.JupiterFormSection.prototype,"_expandedConcepts",2),exports.JupiterFormSection=U([t("jupiter-form-section")],exports.JupiterFormSection);var N=Object.defineProperty,O=Object.getOwnPropertyDescriptor,R=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?O(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&N(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._formData={},this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._typedMemberValues={}}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),this._currentSchema=F.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate),console.log("β
Generated schema with sections:",this._currentSchema.sections.length),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._columns=this._getDefaultColumns()}else this.schema?(this._currentSchema=this.schema,this._columns=this._getDefaultColumns()):(this._currentSchema=this._getDefaultSchema(),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}]}_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],n=S.validateField(o.id,i.id,o.columnId,r,o.type,o.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:o,value:r}=e.detail;this._formData[i]||(this._formData[i]={});const n=this._formData[i][o];this._formData[i][o]=r,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}))}_handleTypedMemberChange(e){const{columnId:t,value:i,sectionId:o}=e.detail;this._typedMemberValues[t]=i,this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,value:i,sectionId: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)}_addColumnFromRequest(e,t){var i,o,r,n,s,a;const l=`col-${Date.now()}`;let d="",c="";"instant"===e.periodType?(d=e.instantDate||"Instant Date",c=`Instant period: ${e.instantDate}`):"duration"!==e.periodType&&"mixed"!==e.periodType||(d=`${e.startDate} / ${e.endDate}`,c=`Duration period: ${e.startDate} to ${e.endDate}`);let p={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:d};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.typedMember){const t=(null==(n=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||i.conceptName,o=i.typedMember.id.split("_").pop()||"TypedMember";d=`${o} ${"instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`}`,p={dimensionId:l,axisId:i.id,memberId:i.typedMember.id,memberValue:o,memberLabel:o,axis:t,axisLabel:t,memberKey:`${t} | ${o}`,dimensionIdKey:`${i.id} | ${i.typedMember.id}`,isTypedMember:!0},console.log(`π Applied typed member dimension to new column: ${p.memberKey}`)}else 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==(a=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:a.label)||o.conceptName;d=`${r} ${"instant"===e.periodType?`(${e.instantDate})`:`(${e.startDate} / ${e.endDate})`}`,p={dimensionId:l,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: ${p.memberKey}`)}}}}const m={id:l,title:d,description:c,type:(p.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:p};if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);e&&(e.columns||(e.columns=[...this._columns]),e.columns=[...e.columns,m])}this._replicateFieldsForNewColumn(l,e,t),this._dirty=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:m},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 n;n=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(n)}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(){this._submitted=!0,this._validateForm();const e=this._generateSubmissionData();this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors},bubbles:!0}))}_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=[];return this._currentSchema?(this._currentSchema.sections.forEach(t=>{this._processConceptsForSubmission(t.concepts,e,t)}),e):e}_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}}_processConceptsForSubmission(e,t,i){e.forEach(e=>{e.fields&&e.fields.length>0&&e.fields.forEach(o=>{var r,n,s,a;const l=this._formData[e.id],d=null==l?void 0:l[o.columnId];if(null!=d&&""!==d){const l=this._findColumnById(o.columnId);console.log(`π Processing field for concept ${e.id}:`,{fieldColumnId:o.columnId,foundColumn:l,columnType:null==l?void 0:l.type,dimensionData:null==l?void 0:l.dimensionData,isTypedMember:null==(r=null==l?void 0:l.dimensionData)?void 0:r.isTypedMember});const c={conceptId:e.id,value:d,period:{type:e.periodType||"duration"}};if("instant"===e.periodType?c.period.date=o.periodStartDate||this.periodStartDate:(c.period.startDate=o.periodStartDate||this.periodStartDate,c.period.endDate=o.periodEndDate||this.periodEndDate),"dimension"===(null==l?void 0:l.type)&&(null==(n=l.dimensionData)?void 0:n.dimensionIdKey))console.log("β
Found column dimension data:",l.dimensionData),l.dimensionData.isTypedMember?(c.dimension=l.dimensionData.dimensionIdKey,c.typedDimension=!0,c.typedMemberValue=this._typedMemberValues[l.id]||""):c.dimension=l.dimensionData.dimensionIdKey;else if(null==(s=null==i?void 0:i.columns)?void 0:s.length){console.log("π Checking section columns for dimension data:",{sectionId:i.id,columnsCount:i.columns.length,columns:i.columns.map(e=>{var t,i;return{id:e.id,type:e.type,hasDimensionData:!!e.dimensionData,dimensionIdKey:null==(t=e.dimensionData)?void 0:t.dimensionIdKey,isTypedMember:null==(i=e.dimensionData)?void 0:i.isTypedMember}})});const e=i.columns.find(e=>{var t;return"dimension"===e.type&&(null==(t=e.dimensionData)?void 0:t.dimensionIdKey)});(null==(a=null==e?void 0:e.dimensionData)?void 0:a.dimensionIdKey)&&(console.log("β
Found section dimension data:",e.dimensionData),e.dimensionData.isTypedMember?(c.dimension=e.dimensionData.dimensionIdKey,c.typedDimension=!0,c.typedMemberValue=this._typedMemberValues[e.id]||""):c.dimension=e.dimensionData.dimensionIdKey)}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._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`
|
|
882
|
+
`,z([w({type:Object})],exports.JupiterFormSection.prototype,"section",2),z([w({type:Array})],exports.JupiterFormSection.prototype,"columns",2),z([w({type:Object})],exports.JupiterFormSection.prototype,"formData",2),z([w({type:Object})],exports.JupiterFormSection.prototype,"typedMemberData",2),z([w({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),z([w({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),z([w({type:String})],exports.JupiterFormSection.prototype,"locale",2),z([C()],exports.JupiterFormSection.prototype,"_expanded",2),z([C()],exports.JupiterFormSection.prototype,"_showAddColumnDialog",2),z([C()],exports.JupiterFormSection.prototype,"_sectionPeriodType",2),z([C()],exports.JupiterFormSection.prototype,"_expandedConcepts",2),exports.JupiterFormSection=z([t("jupiter-form-section")],exports.JupiterFormSection);
|
|
883
|
+
/**
|
|
884
|
+
* @license
|
|
885
|
+
* Copyright 2017 Google LLC
|
|
886
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
887
|
+
*/
|
|
888
|
+
const J=globalThis,O=J.trustedTypes,V=O?O.createPolicy("lit-html",{createHTML:e=>e}):void 0,K="$lit$",B=`lit$${Math.random().toFixed(9).slice(2)}$`,q="?"+B,H=`<${q}>`,G=document,Q=()=>G.createComment(""),W=e=>null===e||"object"!=typeof e&&"function"!=typeof e,X=Array.isArray,Y="[ \t\n\f\r]",Z=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ee=/-->/g,te=/>/g,ie=RegExp(`>|${Y}(?:([^\\s"'>=/]+)(${Y}*=${Y}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),oe=/'/g,re=/"/g,se=/^(?:script|style|textarea|title)$/i,ne=Symbol.for("lit-noChange"),ae=Symbol.for("lit-nothing"),le=new WeakMap,de=G.createTreeWalker(G,129);function ce(e,t){if(!X(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==V?V.createHTML(t):t}class pe{constructor({strings:e,_$litType$:t},i){let o;this.parts=[];let r=0,s=0;const n=e.length-1,a=this.parts,[l,d]=((e,t)=>{const i=e.length-1,o=[];let r,s=2===t?"<svg>":3===t?"<math>":"",n=Z;for(let a=0;a<i;a++){const t=e[a];let i,l,d=-1,c=0;for(;c<t.length&&(n.lastIndex=c,l=n.exec(t),null!==l);)c=n.lastIndex,n===Z?"!--"===l[1]?n=ee:void 0!==l[1]?n=te:void 0!==l[2]?(se.test(l[2])&&(r=RegExp("</"+l[2],"g")),n=ie):void 0!==l[3]&&(n=ie):n===ie?">"===l[0]?(n=r??Z,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,i=l[1],n=void 0===l[3]?ie:'"'===l[3]?re:oe):n===re||n===oe?n=ie:n===ee||n===te?n=Z:(n=ie,r=void 0);const p=n===ie&&e[a+1].startsWith("/>")?" ":"";s+=n===Z?t+H:d>=0?(o.push(i),t.slice(0,d)+K+t.slice(d)+B+p):t+B+(-2===d?a:p)}return[ce(e,s+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),o]})(e,t);if(this.el=pe.createElement(l,i),de.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(o=de.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes())for(const e of o.getAttributeNames())if(e.endsWith(K)){const t=d[s++],i=o.getAttribute(e).split(B),n=/([.?@])?(.*)/.exec(t);a.push({type:1,index:r,name:n[2],strings:i,ctor:"."===n[1]?fe:"?"===n[1]?ye:"@"===n[1]?ge:be}),o.removeAttribute(e)}else e.startsWith(B)&&(a.push({type:6,index:r}),o.removeAttribute(e));if(se.test(o.tagName)){const e=o.textContent.split(B),t=e.length-1;if(t>0){o.textContent=O?O.emptyScript:"";for(let i=0;i<t;i++)o.append(e[i],Q()),de.nextNode(),a.push({type:2,index:++r});o.append(e[t],Q())}}}else if(8===o.nodeType)if(o.data===q)a.push({type:2,index:r});else{let e=-1;for(;-1!==(e=o.data.indexOf(B,e+1));)a.push({type:7,index:r}),e+=B.length-1}r++}}static createElement(e,t){const i=G.createElement("template");return i.innerHTML=e,i}}function he(e,t,i=e,o){var r,s;if(t===ne)return t;let n=void 0!==o?null==(r=i._$Co)?void 0:r[o]:i._$Cl;const a=W(t)?void 0:t._$litDirective$;return(null==n?void 0:n.constructor)!==a&&(null==(s=null==n?void 0:n._$AO)||s.call(n,!1),void 0===a?n=void 0:(n=new a(e),n._$AT(e,i,o)),void 0!==o?(i._$Co??(i._$Co=[]))[o]=n:i._$Cl=n),void 0!==n&&(t=he(e,n._$AS(e,t.values),n,o)),t}class ue{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,o=((null==e?void 0:e.creationScope)??G).importNode(t,!0);de.currentNode=o;let r=de.nextNode(),s=0,n=0,a=i[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new me(r,r.nextSibling,this,e):1===a.type?t=new a.ctor(r,a.name,a.strings,this,e):6===a.type&&(t=new ve(r,this,e)),this._$AV.push(t),a=i[++n]}s!==(null==a?void 0:a.index)&&(r=de.nextNode(),s++)}return de.currentNode=G,o}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class me{get _$AU(){var e;return(null==(e=this._$AM)?void 0:e._$AU)??this._$Cv}constructor(e,t,i,o){this.type=2,this._$AH=ae,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=o,this._$Cv=(null==o?void 0:o.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=he(this,e,t),W(e)?e===ae||null==e||""===e?(this._$AH!==ae&&this._$AR(),this._$AH=ae):e!==this._$AH&&e!==ne&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>X(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]))(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ae&&W(this._$AH)?this._$AA.nextSibling.data=e:this.T(G.createTextNode(e)),this._$AH=e}$(e){var t;const{values:i,_$litType$:o}=e,r="number"==typeof o?this._$AC(e):(void 0===o.el&&(o.el=pe.createElement(ce(o.h,o.h[0]),this.options)),o);if((null==(t=this._$AH)?void 0:t._$AD)===r)this._$AH.p(i);else{const e=new ue(r,this),t=e.u(this.options);e.p(i),this.T(t),this._$AH=e}}_$AC(e){let t=le.get(e.strings);return void 0===t&&le.set(e.strings,t=new pe(e)),t}k(e){X(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,o=0;for(const r of e)o===t.length?t.push(i=new me(this.O(Q()),this.O(Q()),this,this.options)):i=t[o],i._$AI(r),o++;o<t.length&&(this._$AR(i&&i._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){var i;for(null==(i=this._$AP)||i.call(this,!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cv=e,null==(t=this._$AP)||t.call(this,e))}}class be{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,o,r){this.type=1,this._$AH=ae,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=ae}_$AI(e,t=this,i,o){const r=this.strings;let s=!1;if(void 0===r)e=he(this,e,t,0),s=!W(e)||e!==this._$AH&&e!==ne,s&&(this._$AH=e);else{const o=e;let n,a;for(e=r[0],n=0;n<r.length-1;n++)a=he(this,o[i+n],t,n),a===ne&&(a=this._$AH[n]),s||(s=!W(a)||a!==this._$AH[n]),a===ae?e=ae:e!==ae&&(e+=(a??"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.j(e)}j(e){e===ae?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class fe extends be{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ae?void 0:e}}class ye extends be{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ae)}}class ge extends be{constructor(e,t,i,o,r){super(e,t,i,o,r),this.type=5}_$AI(e,t=this){if((e=he(this,e,t,0)??ae)===ne)return;const i=this._$AH,o=e===ae&&i!==ae||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==ae&&(i===ae||o);o&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;"function"==typeof this._$AH?this._$AH.call((null==(t=this.options)?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class ve{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){he(this,e)}}const _e=J.litHtmlPolyfillSupport;null==_e||_e(pe,me),(J.litHtmlVersions??(J.litHtmlVersions=[])).push("3.3.1");
|
|
889
|
+
/**
|
|
890
|
+
* @license
|
|
891
|
+
* Copyright 2017 Google LLC
|
|
892
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
893
|
+
*/
|
|
894
|
+
const xe=2;class $e{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}
|
|
895
|
+
/**
|
|
896
|
+
* @license
|
|
897
|
+
* Copyright 2017 Google LLC
|
|
898
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
899
|
+
*/class Ie extends $e{constructor(e){if(super(e),this.it=ae,e.type!==xe)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===ae||null==e)return this._t=void 0,this.it=e;if(e===ne)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Ie.directiveName="unsafeHTML",Ie.resultType=1;const De=(we=Ie,(...e)=>({_$litDirective$:we,values:e}));var we,Ce=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,Ae=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?Se(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&&Ce(t,i,s),s};exports.JupiterFilterRolesDialog=class extends e.LitElement{constructor(){super(...arguments),this.open=!1,this.availableRoles=[],this.selectedRoleIds=[],this._tempSelectedRoles=new Set,this._searchQuery="",this._filteredRoles=[]}connectedCallback(){super.connectedCallback(),this._initializeTempSelection()}updated(e){(e.has("selectedRoleIds")||e.has("open"))&&this._initializeTempSelection(),(e.has("availableRoles")||e.has("_searchQuery"))&&this._updateFilteredRoles()}_updateFilteredRoles(){if(!this._searchQuery.trim())return void(this._filteredRoles=[...this.availableRoles]);const e=this._searchQuery.toLowerCase().trim();this._filteredRoles=this.availableRoles.filter(t=>{var i;const o=t.title.toLowerCase().includes(e),r=t.id.toLowerCase().includes(e),s=(null==(i=t.description)?void 0:i.toLowerCase().includes(e))||!1,n=this._searchInRoleURI(t,e);return o||r||s||n})}_searchInRoleURI(e,t){var i;if(null==(i=e.metadata)?void 0:i.roleURI)return e.metadata.roleURI.toLowerCase().includes(t);const o=/https?:\/\/[^\s]+/i,r=o.test(e.title),s=o.test(e.id);return r||s?e.title.toLowerCase().includes(t)||e.id.toLowerCase().includes(t):!!(e.id.includes(".")||e.id.includes("/")||e.id.includes(":"))&&e.id.toLowerCase().includes(t)}_handleSearchInput(e){const t=e.target;this._searchQuery=t.value}_clearSearch(){var e;this._searchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".search-input");t&&(t.value="",t.focus())}_highlightSearchTerm(e){if(!this._searchQuery.trim())return e;const t=this._searchQuery.trim(),i=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(i,"<mark>$1</mark>")}_getSelectedFilteredCount(){return this._filteredRoles.filter(e=>this._tempSelectedRoles.has(e.id)).length}_initializeTempSelection(){this._tempSelectedRoles=new Set(this.selectedRoleIds)}_handleCheckboxChange(e,t){const i=e.target,o=new Set(this._tempSelectedRoles);i.checked?o.add(t):o.delete(t),this._tempSelectedRoles=o,this.requestUpdate()}_selectAll(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.add(t.id)),this._tempSelectedRoles=e,this.requestUpdate()}_selectNone(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.delete(t.id)),this._tempSelectedRoles=e,this.requestUpdate()}_selectAllGlobal(){this._tempSelectedRoles=new Set(this.availableRoles.map(e=>e.id)),this.requestUpdate()}_selectNoneGlobal(){this._tempSelectedRoles=new Set,this.requestUpdate()}_resetToOriginal(){this._tempSelectedRoles=new Set(this.selectedRoleIds),this.requestUpdate()}_handleCancel(){this._initializeTempSelection(),this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleApply(){const e=Array.from(this._tempSelectedRoles);this.dispatchEvent(new CustomEvent("roles-filter-apply",{detail:{selectedRoleIds:e},bubbles:!0}))}_handleBackdropClick(e){e.target===this&&this._handleCancel()}render(){const t=this._tempSelectedRoles.size,i=this.availableRoles.length,o=this._filteredRoles.length,r=this._searchQuery.trim().length>0;return e.html`
|
|
900
|
+
<div class="dialog" @click="${e=>e.stopPropagation()}">
|
|
901
|
+
<!-- Dialog Header -->
|
|
902
|
+
<div class="dialog-header">
|
|
903
|
+
<svg class="filter-icon" viewBox="0 0 24 24">
|
|
904
|
+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
905
|
+
</svg>
|
|
906
|
+
<h2 class="dialog-title">Filter Roles</h2>
|
|
907
|
+
<button class="close-button" @click="${this._handleCancel}">Γ</button>
|
|
908
|
+
</div>
|
|
909
|
+
|
|
910
|
+
<!-- Dialog Content -->
|
|
911
|
+
<div class="dialog-content">
|
|
912
|
+
<p class="description">
|
|
913
|
+
Select the roles you want to display in the form. You can search and choose specific roles
|
|
914
|
+
to focus on or manage all ${i} available roles.
|
|
915
|
+
</p>
|
|
916
|
+
|
|
917
|
+
<!-- Search Input -->
|
|
918
|
+
<div class="search-container">
|
|
919
|
+
<input
|
|
920
|
+
type="text"
|
|
921
|
+
class="search-input"
|
|
922
|
+
placeholder="Search roles by name, ID, or URI..."
|
|
923
|
+
.value="${this._searchQuery}"
|
|
924
|
+
@input="${this._handleSearchInput}"
|
|
925
|
+
/>
|
|
926
|
+
${this._searchQuery?e.html`
|
|
927
|
+
<button class="clear-search" @click="${this._clearSearch}" title="Clear search">
|
|
928
|
+
Γ
|
|
929
|
+
</button>
|
|
930
|
+
`:e.html`
|
|
931
|
+
<svg class="search-icon" viewBox="0 0 24 24">
|
|
932
|
+
<path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
|
|
933
|
+
</svg>
|
|
934
|
+
`}
|
|
935
|
+
</div>
|
|
936
|
+
|
|
937
|
+
<!-- Search Results Info -->
|
|
938
|
+
${r?e.html`
|
|
939
|
+
<div class="search-results-info">
|
|
940
|
+
Showing ${o} of ${i} roles
|
|
941
|
+
${o!==i?e.html`matching "${this._searchQuery}"`:""}
|
|
942
|
+
</div>
|
|
943
|
+
`:""}
|
|
944
|
+
|
|
945
|
+
<!-- Selection Controls -->
|
|
946
|
+
<div class="selection-controls">
|
|
947
|
+
${r?e.html`
|
|
948
|
+
<button class="selection-control" @click="${this._selectAll}">
|
|
949
|
+
Select Filtered (${o})
|
|
950
|
+
</button>
|
|
951
|
+
<button class="selection-control" @click="${this._selectNone}">
|
|
952
|
+
Deselect Filtered
|
|
953
|
+
</button>
|
|
954
|
+
<button class="selection-control" @click="${this._selectAllGlobal}">
|
|
955
|
+
Select All (${i})
|
|
956
|
+
</button>
|
|
957
|
+
<button class="selection-control" @click="${this._selectNoneGlobal}">
|
|
958
|
+
Deselect All
|
|
959
|
+
</button>
|
|
960
|
+
`:e.html`
|
|
961
|
+
<button class="selection-control" @click="${this._selectAll}">
|
|
962
|
+
Select All
|
|
963
|
+
</button>
|
|
964
|
+
<button class="selection-control" @click="${this._selectNone}">
|
|
965
|
+
Select None
|
|
966
|
+
</button>
|
|
967
|
+
`}
|
|
968
|
+
<button class="selection-control" @click="${this._resetToOriginal}">
|
|
969
|
+
Reset
|
|
970
|
+
</button>
|
|
971
|
+
</div>
|
|
972
|
+
|
|
973
|
+
<!-- Roles List -->
|
|
974
|
+
<div class="roles-list">
|
|
975
|
+
${0===this._filteredRoles.length?e.html`
|
|
976
|
+
<div class="no-results">
|
|
977
|
+
${r?e.html`
|
|
978
|
+
No roles found matching "${this._searchQuery}".<br>
|
|
979
|
+
Try a different search term or clear the search.
|
|
980
|
+
`:e.html`
|
|
981
|
+
No roles available.
|
|
982
|
+
`}
|
|
983
|
+
</div>
|
|
984
|
+
`:e.html`
|
|
985
|
+
${this._filteredRoles.map(t=>{var i;const o=this._tempSelectedRoles.has(t.id);return e.html`
|
|
986
|
+
<div class="role-item">
|
|
987
|
+
<input
|
|
988
|
+
type="checkbox"
|
|
989
|
+
class="role-checkbox"
|
|
990
|
+
.checked="${o}"
|
|
991
|
+
@change="${e=>this._handleCheckboxChange(e,t.id)}"
|
|
992
|
+
/>
|
|
993
|
+
<div class="role-info">
|
|
994
|
+
<h4 class="role-title">${De(this._highlightSearchTerm(t.title))}</h4>
|
|
995
|
+
${t.description?e.html`
|
|
996
|
+
<p class="role-description">${De(this._highlightSearchTerm(t.description))}</p>
|
|
997
|
+
`:""}
|
|
998
|
+
${t.id!==t.title?e.html`
|
|
999
|
+
<p class="role-description">ID: ${De(this._highlightSearchTerm(t.id))}</p>
|
|
1000
|
+
`:""}
|
|
1001
|
+
${(null==(i=t.metadata)?void 0:i.roleURI)?e.html`
|
|
1002
|
+
<p class="role-description">URI: ${De(this._highlightSearchTerm(t.metadata.roleURI))}</p>
|
|
1003
|
+
`:""}
|
|
1004
|
+
</div>
|
|
1005
|
+
</div>
|
|
1006
|
+
`})}
|
|
1007
|
+
`}
|
|
1008
|
+
</div>
|
|
1009
|
+
|
|
1010
|
+
<div class="selected-count">
|
|
1011
|
+
${t} of ${i} roles selected
|
|
1012
|
+
${r&&o!==i?e.html`
|
|
1013
|
+
<br><small>(${this._getSelectedFilteredCount()} of ${o} filtered roles selected)</small>
|
|
1014
|
+
`:""}
|
|
1015
|
+
</div>
|
|
1016
|
+
</div>
|
|
1017
|
+
|
|
1018
|
+
<!-- Dialog Actions -->
|
|
1019
|
+
<div class="dialog-actions">
|
|
1020
|
+
<button class="btn-secondary" @click="${this._handleCancel}">
|
|
1021
|
+
Cancel
|
|
1022
|
+
</button>
|
|
1023
|
+
<button
|
|
1024
|
+
class="btn-primary"
|
|
1025
|
+
@click="${this._handleApply}"
|
|
1026
|
+
?disabled="${0===t}"
|
|
1027
|
+
>
|
|
1028
|
+
Apply Filter (${t})
|
|
1029
|
+
</button>
|
|
1030
|
+
</div>
|
|
1031
|
+
</div>
|
|
1032
|
+
`}},exports.JupiterFilterRolesDialog.styles=e.css`
|
|
1033
|
+
:host {
|
|
1034
|
+
position: fixed;
|
|
1035
|
+
top: 0;
|
|
1036
|
+
left: 0;
|
|
1037
|
+
right: 0;
|
|
1038
|
+
bottom: 0;
|
|
1039
|
+
z-index: 10000;
|
|
1040
|
+
display: none;
|
|
1041
|
+
align-items: center;
|
|
1042
|
+
justify-content: center;
|
|
1043
|
+
background: rgba(0, 0, 0, 0.5);
|
|
1044
|
+
font-family: var(--jupiter-font-family, system-ui, -apple-system, sans-serif);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
:host([open]) {
|
|
1048
|
+
display: flex;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
.dialog {
|
|
1052
|
+
background: var(--jupiter-background, #fff);
|
|
1053
|
+
border-radius: 8px;
|
|
1054
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
1055
|
+
|
|
1056
|
+
width: 90vw;
|
|
1057
|
+
max-height: 80vh;
|
|
1058
|
+
display: flex;
|
|
1059
|
+
flex-direction: column;
|
|
1060
|
+
overflow: hidden;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.dialog-header {
|
|
1064
|
+
padding: 20px 24px 16px;
|
|
1065
|
+
border-bottom: 1px solid var(--jupiter-border-color, #ddd);
|
|
1066
|
+
display: flex;
|
|
1067
|
+
align-items: center;
|
|
1068
|
+
gap: 12px;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
.dialog-title {
|
|
1072
|
+
font-size: 18px;
|
|
1073
|
+
font-weight: 600;
|
|
1074
|
+
margin: 0;
|
|
1075
|
+
color: var(--jupiter-text-primary, #333);
|
|
1076
|
+
flex: 1;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
.filter-icon {
|
|
1080
|
+
width: 20px;
|
|
1081
|
+
height: 20px;
|
|
1082
|
+
fill: var(--jupiter-primary-color, #1976d2);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
.close-button {
|
|
1086
|
+
background: none;
|
|
1087
|
+
border: none;
|
|
1088
|
+
font-size: 24px;
|
|
1089
|
+
cursor: pointer;
|
|
1090
|
+
padding: 4px;
|
|
1091
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1092
|
+
border-radius: 4px;
|
|
1093
|
+
transition: background-color 0.2s ease;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
.close-button:hover {
|
|
1097
|
+
background: var(--jupiter-hover-background, #f5f5f5);
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
.dialog-content {
|
|
1101
|
+
flex: 1;
|
|
1102
|
+
overflow-y: auto;
|
|
1103
|
+
padding: 20px 24px;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
.description {
|
|
1107
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1108
|
+
font-size: 14px;
|
|
1109
|
+
margin: 0 0 20px 0;
|
|
1110
|
+
line-height: 1.5;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
.selection-controls {
|
|
1114
|
+
display: flex;
|
|
1115
|
+
gap: 12px;
|
|
1116
|
+
margin-bottom: 20px;
|
|
1117
|
+
flex-wrap: wrap;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
.search-container {
|
|
1121
|
+
margin-bottom: 16px;
|
|
1122
|
+
position: relative;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
.search-input {
|
|
1126
|
+
width: 100%;
|
|
1127
|
+
padding: 10px 40px 10px 12px;
|
|
1128
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1129
|
+
border-radius: 4px;
|
|
1130
|
+
font-size: 14px;
|
|
1131
|
+
font-family: inherit;
|
|
1132
|
+
background: var(--jupiter-background, #fff);
|
|
1133
|
+
color: var(--jupiter-text-primary, #333);
|
|
1134
|
+
transition: border-color 0.2s ease;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
.search-input:focus {
|
|
1138
|
+
outline: none;
|
|
1139
|
+
border-color: var(--jupiter-primary-color, #1976d2);
|
|
1140
|
+
box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
.search-input::placeholder {
|
|
1144
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
.search-icon {
|
|
1148
|
+
position: absolute;
|
|
1149
|
+
right: 12px;
|
|
1150
|
+
top: 50%;
|
|
1151
|
+
transform: translateY(-50%);
|
|
1152
|
+
width: 16px;
|
|
1153
|
+
height: 16px;
|
|
1154
|
+
fill: var(--jupiter-text-secondary, #666);
|
|
1155
|
+
pointer-events: none;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
.clear-search {
|
|
1159
|
+
position: absolute;
|
|
1160
|
+
right: 12px;
|
|
1161
|
+
top: 50%;
|
|
1162
|
+
transform: translateY(-50%);
|
|
1163
|
+
background: none;
|
|
1164
|
+
border: none;
|
|
1165
|
+
cursor: pointer;
|
|
1166
|
+
padding: 2px;
|
|
1167
|
+
border-radius: 2px;
|
|
1168
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1169
|
+
font-size: 16px;
|
|
1170
|
+
line-height: 1;
|
|
1171
|
+
transition: color 0.2s ease;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
.clear-search:hover {
|
|
1175
|
+
color: var(--jupiter-text-primary, #333);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
.search-results-info {
|
|
1179
|
+
font-size: 12px;
|
|
1180
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1181
|
+
margin-bottom: 8px;
|
|
1182
|
+
text-align: center;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
.no-results {
|
|
1186
|
+
text-align: center;
|
|
1187
|
+
padding: 40px 20px;
|
|
1188
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1189
|
+
font-style: italic;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
mark {
|
|
1193
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
1194
|
+
color: white;
|
|
1195
|
+
padding: 1px 2px;
|
|
1196
|
+
border-radius: 2px;
|
|
1197
|
+
font-weight: 500;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
.selection-control {
|
|
1201
|
+
background: none;
|
|
1202
|
+
border: 1px solid var(--jupiter-primary-color, #1976d2);
|
|
1203
|
+
color: var(--jupiter-primary-color, #1976d2);
|
|
1204
|
+
padding: 6px 12px;
|
|
1205
|
+
border-radius: 4px;
|
|
1206
|
+
font-size: 12px;
|
|
1207
|
+
cursor: pointer;
|
|
1208
|
+
transition: all 0.2s ease;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
.selection-control:hover {
|
|
1212
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
1213
|
+
color: white;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
.roles-list {
|
|
1217
|
+
display: flex;
|
|
1218
|
+
flex-direction: column;
|
|
1219
|
+
gap: 8px;
|
|
1220
|
+
max-height: 300px;
|
|
1221
|
+
overflow-y: auto;
|
|
1222
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1223
|
+
border-radius: 4px;
|
|
1224
|
+
padding: 12px;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
.role-item {
|
|
1228
|
+
display: flex;
|
|
1229
|
+
align-items: flex-start;
|
|
1230
|
+
gap: 12px;
|
|
1231
|
+
padding: 8px;
|
|
1232
|
+
border-radius: 4px;
|
|
1233
|
+
transition: background-color 0.2s ease;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
.role-item:hover {
|
|
1237
|
+
background: var(--jupiter-hover-background, #f5f5f5);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
.role-checkbox {
|
|
1241
|
+
margin-top: 2px;
|
|
1242
|
+
cursor: pointer;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
.role-info {
|
|
1246
|
+
flex: 1;
|
|
1247
|
+
min-width: 0;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
.role-title {
|
|
1251
|
+
font-weight: 500;
|
|
1252
|
+
color: var(--jupiter-text-primary, #333);
|
|
1253
|
+
margin: 0 0 4px 0;
|
|
1254
|
+
word-wrap: break-word;
|
|
1255
|
+
line-height: 1.3;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
.role-description {
|
|
1259
|
+
font-size: 13px;
|
|
1260
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1261
|
+
margin: 0;
|
|
1262
|
+
line-height: 1.4;
|
|
1263
|
+
word-break: break-all; /* Allow URI breaking */
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
.role-description:last-child {
|
|
1267
|
+
margin-bottom: 4px;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
.selected-count {
|
|
1271
|
+
font-size: 13px;
|
|
1272
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1273
|
+
margin-top: 16px;
|
|
1274
|
+
text-align: center;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
.dialog-actions {
|
|
1278
|
+
padding: 16px 24px;
|
|
1279
|
+
border-top: 1px solid var(--jupiter-border-color, #ddd);
|
|
1280
|
+
display: flex;
|
|
1281
|
+
gap: 12px;
|
|
1282
|
+
justify-content: flex-end;
|
|
1283
|
+
background: var(--jupiter-form-actions-background, #f8f9fa);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
.dialog-actions button {
|
|
1287
|
+
padding: 10px 20px;
|
|
1288
|
+
border: none;
|
|
1289
|
+
border-radius: 4px;
|
|
1290
|
+
font-size: 14px;
|
|
1291
|
+
font-weight: 500;
|
|
1292
|
+
cursor: pointer;
|
|
1293
|
+
transition: background-color 0.2s ease;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
.btn-primary {
|
|
1297
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
1298
|
+
color: white;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
.btn-primary:hover:not(:disabled) {
|
|
1302
|
+
background: var(--jupiter-primary-color-dark, #1565c0);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
.btn-secondary {
|
|
1306
|
+
background: transparent;
|
|
1307
|
+
color: var(--jupiter-text-secondary, #666);
|
|
1308
|
+
border: 1px solid var(--jupiter-border-color, #ddd);
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
.btn-secondary:hover:not(:disabled) {
|
|
1312
|
+
background: var(--jupiter-hover-background, #f5f5f5);
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
button:disabled {
|
|
1316
|
+
opacity: 0.6;
|
|
1317
|
+
cursor: not-allowed;
|
|
1318
|
+
}
|
|
1319
|
+
`,Ae([w({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),Ae([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),Ae([w({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),Ae([C()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),Ae([C()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),Ae([C()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),exports.JupiterFilterRolesDialog=Ae([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var Te=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ee=(e,t,i,o)=>{for(var r,s=o>1?void 0:o?Fe(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&&Te(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._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),this._currentSchema=A.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate),console.log("β
Generated schema with sections:",this._currentSchema.sections.length),this._allSections=[...this._currentSchema.sections],this._allSections.length>10&&0===this._selectedRoleIds.length?this._selectedRoleIds=this._allSections.slice(0,10).map(e=>e.id):0===this._selectedRoleIds.length&&(this._selectedRoleIds=this._allSections.map(e=>e.id)),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;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 this._allSections.length>10}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleFilterDialogCancel(){this._showFilterDialog=!1}_handleRoleFilterApply(e){const{selectedRoleIds:t}=e.detail;this._selectedRoleIds=t,this._applyRoleFilter(),this._showFilterDialog=!1,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=S.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)}_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(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(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 A,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(){this._submitted=!0,this._validateForm();const e=this._generateSubmissionData();this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors},bubbles:!0}))}_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`
|
|
813
1320
|
<div class="form-container">
|
|
814
1321
|
<!-- Form Header -->
|
|
815
1322
|
<div class="form-header">
|
|
@@ -839,6 +1346,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
839
1346
|
.section="${t}"
|
|
840
1347
|
.columns="${t.columns||this._columns}"
|
|
841
1348
|
.formData="${this._formData}"
|
|
1349
|
+
.typedMemberData="${this._typedMemberData}"
|
|
842
1350
|
.disabled="${this.disabled||this.readonly}"
|
|
843
1351
|
.collapsible="${!1!==i.collapsibleSections}"
|
|
844
1352
|
.locale="${i.locale||"en-US"}"
|
|
@@ -854,6 +1362,21 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
854
1362
|
|
|
855
1363
|
<!-- Form Actions - Fixed Footer -->
|
|
856
1364
|
<div class="form-actions">
|
|
1365
|
+
<!-- Filter Roles Button (shown when more than 10 roles) -->
|
|
1366
|
+
${this._shouldShowFilterButton()?e.html`
|
|
1367
|
+
<button
|
|
1368
|
+
class="filter-roles-button"
|
|
1369
|
+
@click="${this._handleFilterRolesClick}"
|
|
1370
|
+
?disabled="${this.disabled||this.readonly}"
|
|
1371
|
+
>
|
|
1372
|
+
<svg class="filter-icon" viewBox="0 0 24 24">
|
|
1373
|
+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
1374
|
+
</svg>
|
|
1375
|
+
Filter Roles
|
|
1376
|
+
<span class="roles-count">${this._selectedRoleIds.length}/${this._allSections.length}</span>
|
|
1377
|
+
</button>
|
|
1378
|
+
`:""}
|
|
1379
|
+
|
|
857
1380
|
<button
|
|
858
1381
|
class="btn-secondary"
|
|
859
1382
|
@click="${this._handleSaveDraft}"
|
|
@@ -876,6 +1399,18 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
876
1399
|
<span>Valid: ${this._valid?"Yes":"No"}</span>
|
|
877
1400
|
</div>
|
|
878
1401
|
</div>
|
|
1402
|
+
|
|
1403
|
+
<!-- Filter Roles Dialog -->
|
|
1404
|
+
${this._showFilterDialog?e.html`
|
|
1405
|
+
<jupiter-filter-roles-dialog
|
|
1406
|
+
?open="${this._showFilterDialog}"
|
|
1407
|
+
.availableRoles="${this._allSections}"
|
|
1408
|
+
.selectedRoleIds="${this._selectedRoleIds}"
|
|
1409
|
+
@dialog-cancel="${this._handleFilterDialogCancel}"
|
|
1410
|
+
@roles-filter-apply="${this._handleRoleFilterApply}"
|
|
1411
|
+
@click="${this._handleFilterDialogCancel}"
|
|
1412
|
+
></jupiter-filter-roles-dialog>
|
|
1413
|
+
`:""}
|
|
879
1414
|
</div>
|
|
880
1415
|
`:e.html`<div>Loading form...</div>`}},exports.JupiterDynamicForm.styles=e.css`
|
|
881
1416
|
:host {
|
|
@@ -1007,5 +1542,46 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
1007
1542
|
color: var(--jupiter-text-secondary, #666);
|
|
1008
1543
|
margin-left: auto;
|
|
1009
1544
|
}
|
|
1010
|
-
|
|
1545
|
+
|
|
1546
|
+
.filter-roles-button {
|
|
1547
|
+
display: flex;
|
|
1548
|
+
align-items: center;
|
|
1549
|
+
gap: 8px;
|
|
1550
|
+
padding: 8px 16px;
|
|
1551
|
+
background: transparent;
|
|
1552
|
+
border: 1px solid var(--jupiter-primary-color, #1976d2);
|
|
1553
|
+
color: var(--jupiter-primary-color, #1976d2);
|
|
1554
|
+
border-radius: 4px;
|
|
1555
|
+
font-size: 13px;
|
|
1556
|
+
font-weight: 500;
|
|
1557
|
+
cursor: pointer;
|
|
1558
|
+
transition: all 0.2s ease;
|
|
1559
|
+
margin-right: auto;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
.filter-roles-button:hover:not(:disabled) {
|
|
1563
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
1564
|
+
color: white;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
.filter-roles-button .filter-icon {
|
|
1568
|
+
width: 16px;
|
|
1569
|
+
height: 16px;
|
|
1570
|
+
fill: currentColor;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.roles-count {
|
|
1574
|
+
display: inline-flex;
|
|
1575
|
+
align-items: center;
|
|
1576
|
+
background: var(--jupiter-primary-color, #1976d2);
|
|
1577
|
+
color: white;
|
|
1578
|
+
border-radius: 10px;
|
|
1579
|
+
font-size: 11px;
|
|
1580
|
+
font-weight: 600;
|
|
1581
|
+
padding: 2px 6px;
|
|
1582
|
+
margin-left: 4px;
|
|
1583
|
+
min-width: 18px;
|
|
1584
|
+
justify-content: center;
|
|
1585
|
+
}
|
|
1586
|
+
`,Ee([w({type:Object})],exports.JupiterDynamicForm.prototype,"schema",2),Ee([w({type:Object})],exports.JupiterDynamicForm.prototype,"xbrlInput",2),Ee([w({type:Object})],exports.JupiterDynamicForm.prototype,"config",2),Ee([w({type:Object})],exports.JupiterDynamicForm.prototype,"initialData",2),Ee([w({type:Boolean})],exports.JupiterDynamicForm.prototype,"disabled",2),Ee([w({type:Boolean})],exports.JupiterDynamicForm.prototype,"readonly",2),Ee([w({type:String})],exports.JupiterDynamicForm.prototype,"periodStartDate",2),Ee([w({type:String})],exports.JupiterDynamicForm.prototype,"periodEndDate",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_formData",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_preservedFormData",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_typedMemberData",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_preservedTypedMemberData",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_columns",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_errors",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_touched",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_dirty",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_valid",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_submitted",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_currentSchema",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_allSections",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_selectedRoleIds",2),Ee([C()],exports.JupiterDynamicForm.prototype,"_showFilterDialog",2),exports.JupiterDynamicForm=Ee([t("jupiter-dynamic-form")],exports.JupiterDynamicForm);exports.FormValidator=S,exports.version="1.5.0";
|
|
1011
1587
|
//# sourceMappingURL=index.js.map
|