jupiter-dynamic-forms 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/dynamic-form.d.ts +2 -0
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/core/form-section.d.ts +2 -0
- package/dist/core/form-section.d.ts.map +1 -1
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +548 -90
- package/dist/index.mjs.map +1 -1
- package/dist/schema/types.d.ts +1 -0
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/xbrl-types.d.ts +4 -0
- package/dist/schema/xbrl-types.d.ts.map +1 -1
- package/dist/utils/xbrl-form-builder.d.ts +16 -0
- package/dist/utils/xbrl-form-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ export declare class JupiterDynamicForm extends LitElement {
|
|
|
19
19
|
private _valid;
|
|
20
20
|
private _submitted;
|
|
21
21
|
private _currentSchema?;
|
|
22
|
+
private _typedMemberValues;
|
|
22
23
|
static styles: import('lit').CSSResult;
|
|
23
24
|
connectedCallback(): void;
|
|
24
25
|
updated(changedProperties: Map<string, any>): void;
|
|
@@ -27,6 +28,7 @@ export declare class JupiterDynamicForm extends LitElement {
|
|
|
27
28
|
private _getDefaultColumns;
|
|
28
29
|
private _validateForm;
|
|
29
30
|
private _handleFieldChange;
|
|
31
|
+
private _handleTypedMemberChange;
|
|
30
32
|
private _handleSectionExpand;
|
|
31
33
|
private _handleConceptExpand;
|
|
32
34
|
private _handleColumnRemove;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../src/core/dynamic-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EACL,cAAc,EACd,QAAQ,EAGR,SAAS,EACT,eAAe,EAMhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO,gBAAgB,CAAC;AAExB,qBACa,kBAAmB,SAAQ,UAAU;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAM;IAC7B,WAAW,EAAE,QAAQ,CAAM;IAC1B,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAClB,eAAe,SAAgB;IAC/B,aAAa,SAAgB;IAEhD,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAC,CAAiB;
|
|
1
|
+
{"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../src/core/dynamic-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EACL,cAAc,EACd,QAAQ,EAGR,SAAS,EACT,eAAe,EAMhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIrD,OAAO,gBAAgB,CAAC;AAExB,qBACa,kBAAmB,SAAQ,UAAU;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAM;IAC7B,WAAW,EAAE,QAAQ,CAAM;IAC1B,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAClB,eAAe,SAAgB;IAC/B,aAAa,SAAgB;IAEhD,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAC,CAAiB;IACxC,OAAO,CAAC,kBAAkB,CAA8B;IAEjE,MAAM,CAAC,MAAM,0BAkIX;IAEF,iBAAiB;IAKjB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAM3C,OAAO,CAAC,eAAe;IA+CvB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,kBAAkB;IA2B1B,OAAO,CAAC,wBAAwB;IAmBhC,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,mBAAmB;IAmC3B,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,qBAAqB;IA+H7B,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,6BAA6B;IAmBrC,OAAO,CAAC,4BAA4B;IAmBpC,OAAO,CAAC,4BAA4B;IAYpC,OAAO,CAAC,0BAA0B;IA0DlC,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,6BAA6B;IA8FrC,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,aAAa;IAYd,OAAO,IAAI,QAAQ;IAInB,OAAO,CAAC,IAAI,EAAE,QAAQ;IAOtB,QAAQ,IAAI,OAAO;IAKnB,KAAK;IAIL,QAAQ,IAAI,SAAS;IAI5B,MAAM;CAoFP"}
|
|
@@ -11,6 +11,7 @@ export declare class JupiterFormSection extends LitElement {
|
|
|
11
11
|
private _expanded;
|
|
12
12
|
private _showAddColumnDialog;
|
|
13
13
|
private _sectionPeriodType;
|
|
14
|
+
private _typedMemberValues;
|
|
14
15
|
static styles: import('lit').CSSResult;
|
|
15
16
|
connectedCallback(): void;
|
|
16
17
|
private _determinePeriodType;
|
|
@@ -23,6 +24,7 @@ export declare class JupiterFormSection extends LitElement {
|
|
|
23
24
|
private _handleDialogCancel;
|
|
24
25
|
private _handleColumnAdd;
|
|
25
26
|
private _handleFieldChange;
|
|
27
|
+
private _handleTypedMemberValueChange;
|
|
26
28
|
private _flattenConcepts;
|
|
27
29
|
private _expandedConcepts;
|
|
28
30
|
private _handleConceptExpand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-section.d.ts","sourceRoot":"","sources":["../../src/core/form-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAe,MAAM,iBAAiB,CAAC;AACvE,OAAO,gBAAgB,CAAC;AACxB,OAAO,qBAAqB,CAAC;AAG7B,qBACa,kBAAmB,SAAQ,UAAU;IACpB,OAAO,EAAG,WAAW,CAAC;IACvB,OAAO,EAAE,UAAU,EAAE,CAAM;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAClC,QAAQ,UAAS;IACjB,WAAW,UAAQ;IACpB,MAAM,SAAW;IAEpC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,kBAAkB,CAAgD;
|
|
1
|
+
{"version":3,"file":"form-section.d.ts","sourceRoot":"","sources":["../../src/core/form-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAe,MAAM,iBAAiB,CAAC;AACvE,OAAO,gBAAgB,CAAC;AACxB,OAAO,qBAAqB,CAAC;AAG7B,qBACa,kBAAmB,SAAQ,UAAU;IACpB,OAAO,EAAG,WAAW,CAAC;IACvB,OAAO,EAAE,UAAU,EAAE,CAAM;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAClC,QAAQ,UAAS;IACjB,WAAW,UAAQ;IACpB,MAAM,SAAW;IAEpC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,kBAAkB,CAAgD;IAC1E,OAAO,CAAC,kBAAkB,CAA8B;IAEjE,MAAM,CAAC,MAAM,0BAoKX;IAEF,iBAAiB;IAMjB,OAAO,CAAC,oBAAoB;IAwC5B,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,mBAAmB;IAU3B,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,0BAA0B;IA2BlC,OAAO,CAAC,sBAAsB;IAkB9B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,6BAA6B;IAYrC,OAAO,CAAC,gBAAgB;IAgBf,OAAO,CAAC,iBAAiB,CAAqB;IAEvD,OAAO,CAAC,oBAAoB;IAmB5B,MAAM;CA8GP"}
|
package/dist/index.js
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/let s=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=n.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&n.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 s("string"==typeof e?e:e+"",void 0,r))(t)})(e):e,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:
|
|
6
|
+
*/let s=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=n.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&n.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 s("string"==typeof e?e:e+"",void 0,r))(t)})(e):e,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:u}=Object,h=globalThis,b=h.trustedTypes,f=b?b.emptyScript:"",y=h.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}},x=(e,t)=>!l(e,t),_={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:x};
|
|
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")),h.litPropertyMetadata??(h.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=_){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 n=null==o?void 0:o.call(this);null==r||r.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}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),...m(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 n=(void 0!==(null==(i=o.converter)?void 0:i.toAttribute)?o.converter:v).toAttribute(t,o.type);this._$Em=e,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){var i,o;const r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){const e=r.getPropertyOptions(n),s="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null==(i=e.converter)?void 0:i.fromAttribute)?e.converter:v;this._$Em=n;const a=s.fromAttribute(t,e.type);this[n]=a??(null==(o=this._$Ej)?void 0:o.get(n))??a,this._$Em=null}}requestUpdate(e,t,i){var o;if(void 0!==e){const r=this.constructor,n=this[e];if(i??(i=r.getPropertyOptions(e)),!((i.hasChanged??x)(n,t)||i.useDefault&&i.reflect&&n===(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},n){i&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,n??t??this[e]),!0!==r||void 0!==n)||(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:$}),(h.reactiveElementVersions??(h.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 D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,i)=>{const{kind:o,metadata:r}=i;let n=globalThis.litPropertyMetadata.get(r);if(void 0===n&&globalThis.litPropertyMetadata.set(r,n=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),n.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
|
|
17
|
+
const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,i)=>{const{kind:o,metadata:r}=i;let n=globalThis.litPropertyMetadata.get(r);if(void 0===n&&globalThis.litPropertyMetadata.set(r,n=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),n.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 I(e){return(t,i)=>"object"==typeof i?w(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 S(e){return C({...e,state:!0,attribute:!1})}class E{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={periodTypes:a},d=[];(null==(r=e.presentationLinkbase)?void 0:r.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{const o=this.buildConceptTree(e,0,t,i,l);o&&d.push(o)});const c=null==o?void 0:o.roles.find(t=>t.roleId===e.id);c?console.log(`🏷️ Found matching hypercube role "${e.id}"`):console.log(`❌ No hypercube role found for "${e.id}"`);const p=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",c,s,a);return{id:e.id,title:n,description:`Section for ${n}`,concepts:d,columns:p,expanded:!1}}static buildConceptTree(e,t,i,o,r){const n=this.getPreferredLabel(e.labels),s=[];if(!e.elementAbstract){let t=!0;if((null==r?void 0:r.periodTypes)&&r.periodTypes.size>1&&"instant"===e.periodType&&(t=!1),t){let t;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":"period":"default";const n=this.createFieldFromConcept(e,i,o,t);n&&s.push(n)}}const a=[];return e.children&&e.children.length>0&&e.children.forEach(e=>{const n=this.buildConceptTree(e,t+1,i,o,r);n&&a.push(n)}),{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}}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,d,c;const p=r||this.getAllNonAbstractConcepts(e),h=n||new Set(p.filter(e=>e.periodType).map(e=>e.periodType));if(console.log(`📊 Analyzing role "${e.role}" with ${p.length} non-abstract concepts`),0===p.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 u=null;if(1===(null==(s=null==o?void 0:o.items)?void 0:s.length)){const t=o.items[0];if(console.log(`🔍 Processing hypercube item for role "${e.role}":`,{itemId:t.id,conceptIds:(null==(a=t.conceptIds)?void 0:a.length)||0,dimensions:t.dimensions.length}),1===t.dimensions.length){const e=t.dimensions[0];if(console.log("📊 Found single dimension:",{id:e.id,conceptName:e.conceptName,membersCount:e.members.length}),e.members.length>0){const t=(null==(l=e.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:l.label)||e.conceptName,i=e.members[0],o=(null==(d=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:d.label)||i.conceptName;u={axisId:e.id,axisLabel:t,memberId:i.id,memberLabel:o,dimensionKey:`${t} | ${o}`,dimensionIdKey:`${e.id} | ${i.id}`},console.log("📊 Generated dimension info:",u)}}else console.log(`⚠️ Multiple dimensions found (${t.dimensions.length}), skipping for now`)}else(null==(c=null==o?void 0:o.items)?void 0:c.length)&&o.items.length>1&&console.log(`⚠️ Multiple items found (${o.items.length}), skipping for now`);console.log(`📅 Found period types: ${Array.from(h).join(", ")}`);const m=[];if(0===h.size){console.log("📅 No period types found, using default column");const e=u?`${u.memberLabel}`:"Value";m.push({id:"default",title:e,description:"Default value column",type:u?"dimension":"base",dimensionData:u?{dimensionId:"default",axisId:u.axisId,memberId:u.memberId,memberValue:u.memberLabel,memberLabel:u.memberLabel,axis:u.axisLabel,axisLabel:u.axisLabel,memberKey:u.dimensionKey,dimensionIdKey:u.dimensionIdKey}:void 0,order:0,removable:!1})}else if(1===h.size&&h.has("instant")){console.log("📅 All concepts are instant type, creating single column");const e=u?`${u.memberLabel} (${this.formatDateForDisplay(t)})`:`As of ${this.formatDateForDisplay(t)}`;m.push({id:"instant",title:e,description:`Values as of ${t}`,type:u?"dimension":"base",dimensionData:u?{dimensionId:"instant",axisId:u.axisId,memberId:u.memberId,memberValue:u.memberLabel,memberLabel:u.memberLabel,axis:u.axisLabel,axisLabel:u.axisLabel,memberKey:u.dimensionKey,dimensionIdKey:u.dimensionIdKey}:void 0,order:0,removable:!1})}else if(1===h.size&&h.has("duration")){console.log("📅 All concepts are duration type, creating single column with period range");const e=u?`${u.memberLabel} (${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)})`:`${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)}`;m.push({id:"duration",title:e,description:`Period: ${t} to ${i}`,type:u?"dimension":"base",dimensionData:u?{dimensionId:"duration",axisId:u.axisId,memberId:u.memberId,memberValue:u.memberLabel,memberLabel:u.memberLabel,axis:u.axisLabel,axisLabel:u.axisLabel,memberKey:u.dimensionKey,dimensionIdKey:u.dimensionIdKey}:void 0,order:0,removable:!1}),console.log("📅 Created duration column:",m.map(e=>({id:e.id,title:e.title})))}else{console.log("📅 Mixed period types found, creating single column with period range");const e=u?`${u.memberLabel} (${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)})`:`${this.formatDateForDisplay(t)} / ${this.formatDateForDisplay(i)}`;m.push({id:"period",title:e,description:`Period: ${t} to ${i}`,type:u?"dimension":"base",dimensionData:u?{dimensionId:"period",axisId:u.axisId,memberId:u.memberId,memberValue:u.memberLabel,memberLabel:u.memberLabel,axis:u.axisLabel,axisLabel:u.axisLabel,memberKey:u.dimensionKey,dimensionIdKey:u.dimensionIdKey}:void 0,order:0,removable:!1})}return u&&console.log(`📊 Applied dimension to ${m.length} columns: ${u.dimensionKey}`),console.log(`📊 Generated ${m.length} columns for role "${e.role}":`,m.map(e=>e.title)),m}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 I=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&&I(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=E.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 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`
|
|
23
23
|
<textarea
|
|
24
24
|
id="${n}"
|
|
25
25
|
name="${s}"
|
|
@@ -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
|
-
`,k([
|
|
209
|
+
`,k([I({type:Object})],exports.JupiterFormField.prototype,"field",2),k([I({type:String})],exports.JupiterFormField.prototype,"conceptId",2),k([I({type:String})],exports.JupiterFormField.prototype,"columnId",2),k([I()],exports.JupiterFormField.prototype,"value",2),k([I({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),k([I({type:String})],exports.JupiterFormField.prototype,"locale",2),k([I({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),k([C()],exports.JupiterFormField.prototype,"_errors",2),k([C()],exports.JupiterFormField.prototype,"_touched",2),exports.JupiterFormField=k([t("jupiter-form-field")],exports.JupiterFormField);var j=Object.defineProperty,L=Object.getOwnPropertyDescriptor,A=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?L(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&&j(t,i,n),n};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,7 @@ 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
|
+
`,A([I({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),A([I({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),A([I({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),A([I({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),A([I({type:String})],exports.JupiterConceptTree.prototype,"locale",2),A([I({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),A([C()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=A([t("jupiter-concept-tree")],exports.JupiterConceptTree);var P=Object.defineProperty,M=Object.getOwnPropertyDescriptor,J=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?M(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&&P(t,i,n),n};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
344
|
<div class="dialog" @click="${e=>e.stopPropagation()}">
|
|
345
345
|
<div class="dialog-header">
|
|
346
346
|
<h2 class="dialog-title">Add Column</h2>
|
|
@@ -548,7 +548,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
548
548
|
background: var(--jupiter-disabled-background, #ccc);
|
|
549
549
|
cursor: not-allowed;
|
|
550
550
|
}
|
|
551
|
-
`,
|
|
551
|
+
`,J([I({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),J([I({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),J([C()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),J([C()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),J([C()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),J([C()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),exports.JupiterAddColumnDialog=J([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var z=Object.defineProperty,V=Object.getOwnPropertyDescriptor,U=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?V(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&&z(t,i,n),n};exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.disabled=!1,this.collapsible=!0,this.locale="en-US",this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._typedMemberValues={},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}))}_handleTypedMemberValueChange(e,t){this._typedMemberValues[e]=t,this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:e,value:t,sectionId:this.section.id},bubbles:!0})),this.requestUpdate()}_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}))}render(){return this.section.concepts&&0!==this.section.concepts.length?e.html`
|
|
552
552
|
<div class="section-header ${this.collapsible?"":"not-collapsible"}"
|
|
553
553
|
@click="${this._toggleExpanded}">
|
|
554
554
|
<div>
|
|
@@ -568,10 +568,21 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
568
568
|
<thead class="table-header">
|
|
569
569
|
<tr class="header-row">
|
|
570
570
|
<th class="header-cell concept-column">Concept</th>
|
|
571
|
-
${this.columns.map(t=>e.html`
|
|
571
|
+
${this.columns.map(t=>{var i;return e.html`
|
|
572
572
|
<th class="header-cell ${t.removable?"removable":""}">
|
|
573
573
|
${t.title}
|
|
574
574
|
${t.description?e.html`<div style="font-weight: normal; font-size: 12px; color: var(--jupiter-text-secondary, #666);">${t.description}</div>`:""}
|
|
575
|
+
${(null==(i=t.dimensionData)?void 0:i.isTypedMember)?e.html`
|
|
576
|
+
<div style="margin-top: 8px;">
|
|
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
|
+
/>
|
|
584
|
+
</div>
|
|
585
|
+
`:""}
|
|
575
586
|
${t.removable?e.html`
|
|
576
587
|
<button
|
|
577
588
|
class="remove-column-btn"
|
|
@@ -580,7 +591,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
580
591
|
>×</button>
|
|
581
592
|
`:""}
|
|
582
593
|
</th>
|
|
583
|
-
`)}
|
|
594
|
+
`})}
|
|
584
595
|
<th class="header-cell">
|
|
585
596
|
<button class="add-column-btn" @click="${e=>{e.stopPropagation(),this._handleAddColumn()}}" title="Add Column">
|
|
586
597
|
+ Add Column
|
|
@@ -798,7 +809,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
798
809
|
color: var(--jupiter-text-secondary, #666);
|
|
799
810
|
font-style: italic;
|
|
800
811
|
}
|
|
801
|
-
`,N([C({type:Object})],exports.JupiterFormSection.prototype,"section",2),N([C({type:Array})],exports.JupiterFormSection.prototype,"columns",2),N([C({type:Object})],exports.JupiterFormSection.prototype,"formData",2),N([C({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),N([C({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),N([C({type:String})],exports.JupiterFormSection.prototype,"locale",2),N([S()],exports.JupiterFormSection.prototype,"_expanded",2),N([S()],exports.JupiterFormSection.prototype,"_showAddColumnDialog",2),N([S()],exports.JupiterFormSection.prototype,"_sectionPeriodType",2),N([S()],exports.JupiterFormSection.prototype,"_expandedConcepts",2),exports.JupiterFormSection=N([t("jupiter-form-section")],exports.JupiterFormSection);var R=Object.defineProperty,q=Object.getOwnPropertyDescriptor,V=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?q(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&&R(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}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=E.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}))}_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;const a=`col-${Date.now()}`;let l="",d="";"instant"===e.periodType?(l=e.instantDate||"Instant Date",d=`Instant period: ${e.instantDate}`):"duration"!==e.periodType&&"mixed"!==e.periodType||(l=`${e.startDate} / ${e.endDate}`,d=`Duration 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.length>0){const t=(null==(n=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||i.conceptName,o=i.members[0],r=(null==(s=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.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 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;const a=this._formData[e.id],l=null==a?void 0:a[o.columnId];if(null!=l&&""!==l){const a=this._findColumnById(o.columnId),d={conceptId:e.id,value:l,period:{type:e.periodType||"duration"}};if("instant"===e.periodType?d.period.date=o.periodStartDate||this.periodStartDate:(d.period.startDate=o.periodStartDate||this.periodStartDate,d.period.endDate=o.periodEndDate||this.periodEndDate),"dimension"===(null==a?void 0:a.type)&&(null==(r=a.dimensionData)?void 0:r.dimensionIdKey))d.dimension=a.dimensionData.dimensionIdKey;else if(null==(n=null==i?void 0:i.columns)?void 0:n.length){const e=i.columns.find(e=>{var t;return"dimension"===e.type&&(null==(t=e.dimensionData)?void 0:t.dimensionIdKey)});(null==(s=null==e?void 0:e.dimensionData)?void 0:s.dimensionIdKey)&&(d.dimension=e.dimensionData.dimensionIdKey)}t.push(d)}}),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`
|
|
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`
|
|
802
813
|
<div class="form-container">
|
|
803
814
|
<!-- Form Header -->
|
|
804
815
|
<div class="form-header">
|
|
@@ -832,6 +843,7 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
832
843
|
.collapsible="${!1!==i.collapsibleSections}"
|
|
833
844
|
.locale="${i.locale||"en-US"}"
|
|
834
845
|
@field-change="${this._handleFieldChange}"
|
|
846
|
+
@typed-member-change="${this._handleTypedMemberChange}"
|
|
835
847
|
@section-expand="${this._handleSectionExpand}"
|
|
836
848
|
@concept-expand="${this._handleConceptExpand}"
|
|
837
849
|
@column-remove="${this._handleColumnRemove}"
|
|
@@ -995,5 +1007,5 @@ const D={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:x},w=(e=D,t,
|
|
|
995
1007
|
color: var(--jupiter-text-secondary, #666);
|
|
996
1008
|
margin-left: auto;
|
|
997
1009
|
}
|
|
998
|
-
`,
|
|
1010
|
+
`,R([I({type:Object})],exports.JupiterDynamicForm.prototype,"schema",2),R([I({type:Object})],exports.JupiterDynamicForm.prototype,"xbrlInput",2),R([I({type:Object})],exports.JupiterDynamicForm.prototype,"config",2),R([I({type:Object})],exports.JupiterDynamicForm.prototype,"initialData",2),R([I({type:Boolean})],exports.JupiterDynamicForm.prototype,"disabled",2),R([I({type:Boolean})],exports.JupiterDynamicForm.prototype,"readonly",2),R([I({type:String})],exports.JupiterDynamicForm.prototype,"periodStartDate",2),R([I({type:String})],exports.JupiterDynamicForm.prototype,"periodEndDate",2),R([C()],exports.JupiterDynamicForm.prototype,"_formData",2),R([C()],exports.JupiterDynamicForm.prototype,"_columns",2),R([C()],exports.JupiterDynamicForm.prototype,"_errors",2),R([C()],exports.JupiterDynamicForm.prototype,"_touched",2),R([C()],exports.JupiterDynamicForm.prototype,"_dirty",2),R([C()],exports.JupiterDynamicForm.prototype,"_valid",2),R([C()],exports.JupiterDynamicForm.prototype,"_submitted",2),R([C()],exports.JupiterDynamicForm.prototype,"_currentSchema",2),R([C()],exports.JupiterDynamicForm.prototype,"_typedMemberValues",2),exports.JupiterDynamicForm=R([t("jupiter-dynamic-form")],exports.JupiterDynamicForm);exports.FormValidator=S,exports.version="1.0.0";
|
|
999
1011
|
//# sourceMappingURL=index.js.map
|