jupiter-dynamic-forms 1.1.0 → 1.4.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/index.js CHANGED
@@ -1,27 +1,29 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("lit"),t=e=>(t,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},r=globalThis,i=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;
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(),n=new WeakMap;
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2017 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
- */let a=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==o)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(i&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&s.set(t,e))}return e}toString(){return this.cssText}};const n=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new a("string"==typeof e?e:e+"",void 0,o))(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:"",v=m.reactiveElementPolyfillSupport,y=(e,t)=>e,g={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 r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(i){r=null}}return r}},x=(e,t)=>!l(e,t),_={attribute:!0,type:String,converter:g,reflect:!1,useDefault:!1,hasChanged:x};
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: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}},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")),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=_){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 r=Symbol(),i=this.getPropertyDescriptor(e,r,t);void 0!==i&&d(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:o}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const s=null==i?void 0:i.call(this);null==o||o.call(this,t),this.requestUpdate(e,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(y("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(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,t=[...p(e),...h(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const e=this._$Eu(t,r);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(n(e))}else void 0!==e&&t.push(n(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"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 r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(i)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const i of t){const t=document.createElement("style"),o=r.litNonce;void 0!==o&&t.setAttribute("nonce",o),t.textContent=i.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,r){this._$AK(e,r)}_$ET(e,t){var r;const i=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,i);if(void 0!==o&&!0===i.reflect){const s=(void 0!==(null==(r=i.converter)?void 0:r.toAttribute)?i.converter:g).toAttribute(t,i.type);this._$Em=e,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(e,t){var r,i;const o=this.constructor,s=o._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=o.getPropertyOptions(s),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null==(r=e.converter)?void 0:r.fromAttribute)?e.converter:g;this._$Em=s;const n=a.fromAttribute(t,e.type);this[s]=n??(null==(i=this._$Ej)?void 0:i.get(s))??n,this._$Em=null}}requestUpdate(e,t,r){var i;if(void 0!==e){const o=this.constructor,s=this[e];if(r??(r=o.getPropertyOptions(e)),!((r.hasChanged??x)(s,t)||r.useDefault&&r.reflect&&s===(null==(i=this._$Ej)?void 0:i.get(e))&&!this.hasAttribute(o._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==o||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===i&&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,r]of e){const{wrapped:e}=r,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,r,i)}}let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),null==(e=this._$EO)||e.forEach(e=>{var t;return null==(t=e.hostUpdate)?void 0:t.call(e)}),this.update(r)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(r)}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"},$[y("elementProperties")]=new Map,$[y("finalized")]=new Map,null==v||v({ReactiveElement:$}),(m.reactiveElementVersions??(m.reactiveElementVersions=[])).push("2.1.1");
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=_){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),...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 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:$}),(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 w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,r)=>{const{kind:i,metadata:o}=r;let s=globalThis.litPropertyMetadata.get(o);if(void 0===s&&globalThis.litPropertyMetadata.set(o,s=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),s.set(r.name,e),"accessor"===i){const{name:i}=r;return{set(r){const o=t.get.call(this);t.set.call(this,r),this.requestUpdate(i,o,e)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=r;return function(r){const o=this[i];t.call(this,r),this.requestUpdate(i,o,e)}}throw Error("Unsupported decorator location: "+i)};function S(e){return(t,r)=>"object"==typeof r?E(e,t,r):((e,t,r)=>{const i=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),i?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}
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 C(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 F(e){return S({...e,state:!0,attribute:!1})}class j{static validateField(e,t,r,i,o,s=[]){const a=[];for(const n of s){const s=this.validateRule(e,t,r,i,o,n);s&&a.push(s)}return a}static validateRule(e,t,r,i,o,s){const a=null==i||""===i;switch(s.type){case"required":if(a)return this.createError(e,t,r,s);break;case"min":if(!a&&"number"==typeof i&&i<s.value)return this.createError(e,t,r,s);break;case"max":if(!a&&"number"==typeof i&&i>s.value)return this.createError(e,t,r,s);break;case"minLength":if(!a&&"string"==typeof i&&i.length<s.value)return this.createError(e,t,r,s);break;case"maxLength":if(!a&&"string"==typeof i&&i.length>s.value)return this.createError(e,t,r,s);break;case"pattern":if(!a&&"string"==typeof i){if(!new RegExp(s.value).test(i))return this.createError(e,t,r,s)}break;case"email":if(!a&&"string"==typeof i){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i))return this.createError(e,t,r,s)}break;case"url":if(!a&&"string"==typeof i)try{new URL(i)}catch{return this.createError(e,t,r,s)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${s.type}`)}return null}static createError(e,t,r,i){return{fieldId:e,conceptId:t,columnId:r,message:i.message,severity:i.severity||"error",rule:i}}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,r="en-US"){if(null==e)return"";switch(t){case"number":return new Intl.NumberFormat(r).format(Number(e));case"decimal":return new Intl.NumberFormat(r,{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(e));case"currency":return new Intl.NumberFormat(r,{style:"currency",currency:"USD"}).format(Number(e));case"percentage":return new Intl.NumberFormat(r,{style:"percent",minimumFractionDigits:2}).format(Number(e)/100);case"date":return new Date(e).toLocaleDateString(r);case"datetime":return new Date(e).toLocaleString(r);default:return String(e)}}}class k{static buildFormSchema(e,t,r){if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const i=e.presentation[0],o=[];return i.roles.forEach(e=>{const i=this.buildSectionFromRole(e,t,r);o.push(i)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(i.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:o}}static buildSectionFromRole(e,t,r){var i;const o=this.extractRoleTitle(e.role),s=[];return(null==(i=e.presentationLinkbase)?void 0:i.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{const i=this.buildConceptTree(e,0,t,r);i&&s.push(i)}),{id:e.id,title:o,description:`Section for ${o}`,concepts:s,expanded:!1}}static buildConceptTree(e,t,r,i){const o=this.getPreferredLabel(e.labels),s=[];if(!e.elementAbstract){const t=this.createFieldFromConcept(e,r,i);t&&s.push(t)}const a=[];return e.children&&e.children.length>0&&e.children.forEach(e=>{const o=this.buildConceptTree(e,t+1,r,i);o&&a.push(o)}),{id:e.id,name:e.conceptName,label:o,description:`${e.conceptName} (${e.type})`,level:t,children:a,fields:s,collapsed:t>0}}static createFieldFromConcept(e,t,r){const i=this.mapXBRLTypeToFieldType(e.type),o=this.getPreferredLabel(e.labels),s={id:`${e.id}_field`,conceptId:e.id,columnId:"default",type:i,label:o,placeholder:`Enter ${o.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null};return"duration"!==e.periodType&&"instant"!==e.periodType||(s.periodStartDate=t||"2025-01-01",s.periodEndDate=r||"2025-12-31"),s}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 r=e.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(r)return r.label;const i=e.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return i?i.label:e[0].label}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 C=Object.defineProperty,D=Object.getOwnPropertyDescriptor,I=(e,t,r,i)=>{for(var o,s=i>1?void 0:i?D(t,r):t,a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i?o(t,r,s):o(s))||s);return i&&s&&C(t,r,s),s};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.value=null,this.disabled=!1,this.locale="en-US",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=j.validateField(this.field.id,this.conceptId,this.columnId,this.value,this.field.type,this.field.validation))}_handleInput(e){const t=e.target;let r=t.value;"number"===this.field.type||"decimal"===this.field.type?r=""===r?null:Number(r):"boolean"===this.field.type&&(r=t.checked),this.value=r,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:r,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 r=this._errors.some(e=>"error"===e.severity),i=this._errors.some(e=>"warning"===e.severity),o="field-input "+(r?"error":i?"warning":"");switch(this.field.type){case"textarea":return e.html`
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`
23
23
  <textarea
24
- class="${o}"
24
+ id="${n}"
25
+ name="${s}"
26
+ class="${r}"
25
27
  .value="${this.value||""}"
26
28
  ?disabled="${this.disabled||this.field.disabled}"
27
29
  placeholder="${this.field.placeholder||""}"
@@ -31,7 +33,9 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
31
33
  ></textarea>
32
34
  `;case"select":return e.html`
33
35
  <select
34
- class="${o}"
36
+ id="${n}"
37
+ name="${s}"
38
+ class="${r}"
35
39
  .value="${this.value||""}"
36
40
  ?disabled="${this.disabled||this.field.disabled}"
37
41
  @change="${this._handleInput}"
@@ -52,6 +56,8 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
52
56
  `;case"boolean":return e.html`
53
57
  <div class="checkbox-container">
54
58
  <input
59
+ id="${n}"
60
+ name="${s}"
55
61
  type="checkbox"
56
62
  class="field-input"
57
63
  .checked="${Boolean(this.value)}"
@@ -64,8 +70,10 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
64
70
  </div>
65
71
  `;default:return e.html`
66
72
  <input
73
+ id="${n}"
74
+ name="${s}"
67
75
  type="${this._getInputType()}"
68
- class="${o}"
76
+ class="${r}"
69
77
  .value="${this.value||""}"
70
78
  ?disabled="${this.disabled||this.field.disabled}"
71
79
  placeholder="${this.field.placeholder||""}"
@@ -73,7 +81,7 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
73
81
  @focus="${this._handleFocus}"
74
82
  @blur="${this._handleBlur}"
75
83
  />
76
- `}}_getInputType(){switch(this.field.type){case"number":case"decimal":case"currency":case"percentage":return"number";case"date":return"date";case"datetime":return"datetime-local";case"email":return"email";case"url":return"url";case"tel":return"tel";default:return"text"}}render(){const t="boolean"!==this.field.type;return e.html`
84
+ `}}_getInputType(){switch(this.field.type){case"number":case"decimal":case"currency":case"percentage":return"number";case"date":return"date";case"datetime":return"datetime-local";case"email":return"email";case"url":return"url";case"tel":return"tel";default:return"text"}}render(){const t=!this.hideLabel&&"boolean"!==this.field.type;return e.html`
77
85
  <div class="field-container">
78
86
  ${t?e.html`
79
87
  <label class="field-label ${this.field.required?"required":""}">
@@ -96,7 +104,11 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
96
104
  `}},exports.JupiterFormField.styles=e.css`
97
105
  :host {
98
106
  display: block;
99
- margin-bottom: 8px;
107
+ margin-bottom: 0px; /* Remove bottom margin for table layout */
108
+ }
109
+
110
+ :host([hideLabel]) {
111
+ margin-bottom: 0px;
100
112
  }
101
113
 
102
114
  .field-container {
@@ -118,10 +130,10 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
118
130
 
119
131
  .field-input {
120
132
  width: 100%;
121
- padding: 8px 12px;
133
+ padding: 6px 8px; /* Reduced padding for table cells */
122
134
  border: 1px solid var(--jupiter-border-color, #ddd);
123
135
  border-radius: 4px;
124
- font-size: 14px;
136
+ font-size: 13px; /* Slightly smaller font for table */
125
137
  font-family: inherit;
126
138
  background: var(--jupiter-input-background, #fff);
127
139
  color: var(--jupiter-text-primary, #333);
@@ -194,95 +206,95 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
194
206
  margin: 0;
195
207
  width: auto;
196
208
  }
197
- `,I([S({type:Object})],exports.JupiterFormField.prototype,"field",2),I([S({type:String})],exports.JupiterFormField.prototype,"conceptId",2),I([S({type:String})],exports.JupiterFormField.prototype,"columnId",2),I([S()],exports.JupiterFormField.prototype,"value",2),I([S({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),I([S({type:String})],exports.JupiterFormField.prototype,"locale",2),I([F()],exports.JupiterFormField.prototype,"_errors",2),I([F()],exports.JupiterFormField.prototype,"_touched",2),exports.JupiterFormField=I([t("jupiter-form-field")],exports.JupiterFormField);var P=Object.defineProperty,O=Object.getOwnPropertyDescriptor,J=(e,t,r,i)=>{for(var o,s=i>1?void 0:i?O(t,r):t,a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i?o(t,r,s):o(s))||s);return i&&s&&P(t,r,s),s};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.disabled=!1,this.locale="en-US",this._expanded=!0}connectedCallback(){super.connectedCallback(),this._expanded=!this.concept.collapsed}_toggleExpanded(){this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("concept-expand",{detail:{conceptId:this.concept.id,expanded:this._expanded},bubbles:!0}))}_getFieldForColumn(e){return this.concept.fields.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,r=this.concept.level||0;return e.html`
198
- <div class="concept-row" style="--level: ${r}">
199
- <!-- Concept Label Column -->
200
- <div class="concept-header" @click="${this._toggleExpanded}">
209
+ `,k([C({type:Object})],exports.JupiterFormField.prototype,"field",2),k([C({type:String})],exports.JupiterFormField.prototype,"conceptId",2),k([C({type:String})],exports.JupiterFormField.prototype,"columnId",2),k([C()],exports.JupiterFormField.prototype,"value",2),k([C({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),k([C({type:String})],exports.JupiterFormField.prototype,"locale",2),k([C({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),k([S()],exports.JupiterFormField.prototype,"_errors",2),k([S()],exports.JupiterFormField.prototype,"_touched",2),exports.JupiterFormField=k([t("jupiter-form-field")],exports.JupiterFormField);var j=Object.defineProperty,A=Object.getOwnPropertyDescriptor,P=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?A(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
+ <!-- Concept Name Cell (Left Column) -->
211
+ <td class="concept-name-cell ${o?"abstract":t?"":"leaf"}">
212
+ <div class="concept-content" style="--level: ${i}">
201
213
  <div class="concept-indent"></div>
202
- <div class="concept-toggle ${t?this._expanded?"expanded":"":"no-children"}">
214
+ <div class="concept-toggle ${t?this._expanded?"expanded":"":"no-children"}"
215
+ @click="${this._toggleExpanded}">
203
216
  ${t?"▶":""}
204
217
  </div>
205
- <div class="concept-label">
218
+ <div class="concept-label"
219
+ @click="${this._toggleExpanded}"
220
+ title="${this.concept.id}${this.concept.description?" - "+this.concept.description:""}">
206
221
  ${this.concept.label}
207
- ${this.concept.description?e.html`
208
- <span class="concept-description">${this.concept.description}</span>
209
- `:""}
210
222
  </div>
211
223
  </div>
212
-
213
- <!-- Field Columns -->
214
- ${this.columns.map(t=>{const r=this._getFieldForColumn(t.id);return e.html`
215
- <div class="field-cell ${r?"":"empty"}">
216
- ${r?e.html`
217
- <jupiter-form-field
218
- .field="${r}"
219
- .conceptId="${this.concept.id}"
220
- .columnId="${t.id}"
221
- .value="${this._getFieldValue(r)}"
222
- .disabled="${this.disabled}"
223
- .locale="${this.locale}"
224
- @field-change="${this._handleFieldChange}"
225
- ></jupiter-form-field>
226
- `:""}
227
- </div>
228
- `})}
229
- </div>
230
-
231
- <!-- Children Concepts -->
232
- ${t?e.html`
233
- <div class="children ${this._expanded?"":"collapsed"}">
234
- ${this.concept.children.map(t=>e.html`
235
- <jupiter-concept-tree
236
- .concept="${t}"
237
- .columns="${this.columns}"
238
- .formData="${this.formData}"
239
- .disabled="${this.disabled}"
240
- .locale="${this.locale}"
241
- @field-change="${this._handleFieldChange}"
242
- @concept-expand="${e=>{e.stopPropagation(),this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}}"
243
- ></jupiter-concept-tree>
244
- `)}
245
- </div>
246
- `:""}
224
+ </td>
225
+
226
+ <!-- Input Field Cells (Period Columns) - Only for non-abstract concepts -->
227
+ ${this.columns.map(t=>{const i=this._getFieldForColumn(t.id),r=!o&&i;return e.html`
228
+ <td class="field-cell ${r?"":"empty"} ${o?"abstract-row":""}">
229
+ ${r?e.html`
230
+ <jupiter-form-field
231
+ .field="${i}"
232
+ .conceptId="${this.concept.id}"
233
+ .columnId="${t.id}"
234
+ .value="${this._getFieldValue(i)}"
235
+ .disabled="${this.disabled}"
236
+ .locale="${this.locale}"
237
+ .hideLabel="${!0}"
238
+ @field-change="${this._handleFieldChange}"
239
+ ></jupiter-form-field>
240
+ `:""}
241
+ </td>
242
+ `})}
247
243
  `}},exports.JupiterConceptTree.styles=e.css`
248
244
  :host {
249
- display: block;
250
- }
251
-
252
- .concept-row {
245
+ /* Component renders table cells directly */
253
246
  display: contents;
254
247
  }
255
248
 
256
- .concept-header {
257
- display: flex;
258
- align-items: center;
259
- padding: 8px 12px;
260
- background: var(--jupiter-concept-background, #f8f9fa);
249
+ .concept-name-cell {
250
+ vertical-align: top;
251
+ padding: 2px 4px;
261
252
  border: 1px solid var(--jupiter-border-color, #ddd);
262
253
  border-bottom: none;
263
- font-weight: 500;
264
- cursor: pointer;
265
- user-select: none;
254
+ background: var(--jupiter-concept-background, #f8f9fa);
255
+ position: sticky;
256
+ left: 0;
257
+ z-index: 1;
258
+ width: 300px;
259
+ min-width: 300px;
260
+ max-width: 300px;
266
261
  }
267
262
 
268
- .concept-header:hover {
269
- background: var(--jupiter-concept-hover-background, #e9ecef);
263
+ .concept-name-cell.abstract {
264
+ background: var(--jupiter-abstract-background, #f0f2f5);
265
+ font-weight: 600;
266
+ }
267
+
268
+ .concept-name-cell.leaf {
269
+ background: var(--jupiter-leaf-background, #fff);
270
+ font-weight: 400;
271
+ }
272
+
273
+ .concept-content {
274
+ display: flex;
275
+ align-items: center;
276
+ min-height: 28px;
277
+ font-size: 13px;
278
+ line-height: 1.3;
279
+ width: 100%;
280
+ overflow: hidden;
270
281
  }
271
282
 
272
283
  .concept-indent {
273
- width: calc(var(--level, 0) * 20px);
284
+ width: calc(var(--level, 0) * 16px);
274
285
  flex-shrink: 0;
275
286
  }
276
287
 
277
288
  .concept-toggle {
278
- width: 16px;
279
- height: 16px;
280
- margin-right: 8px;
289
+ width: 14px;
290
+ height: 14px;
291
+ margin-right: 6px;
281
292
  display: flex;
282
293
  align-items: center;
283
294
  justify-content: center;
284
- font-size: 12px;
295
+ font-size: 10px;
285
296
  transition: transform 0.2s ease;
297
+ cursor: pointer;
286
298
  }
287
299
 
288
300
  .concept-toggle.expanded {
@@ -296,50 +308,247 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
296
308
  .concept-label {
297
309
  flex: 1;
298
310
  color: var(--jupiter-text-primary, #333);
311
+ cursor: pointer;
312
+ word-wrap: break-word;
313
+ overflow-wrap: break-word;
314
+ hyphens: auto;
315
+ line-height: 1.3;
316
+ min-width: 0; /* Allows flex item to shrink below content size */
299
317
  }
300
318
 
301
- .concept-description {
302
- font-size: 12px;
319
+ .field-cell {
320
+ vertical-align: middle;
321
+ padding: 2px 6px;
322
+ border: 1px solid var(--jupiter-border-color, #ddd);
323
+ border-bottom: none;
324
+ background: var(--jupiter-cell-background, #fff);
325
+ min-height: 28px;
326
+ text-align: center;
327
+ min-width: 180px;
328
+ width: 180px;
329
+ }
330
+
331
+ .field-cell.empty {
332
+ background: var(--jupiter-empty-cell-background, #f8f9fa);
333
+ }
334
+
335
+ .field-cell.abstract-row {
336
+ background: var(--jupiter-abstract-cell-background, #f0f2f5);
337
+ }
338
+
339
+ /* Children are rendered as separate table rows, not nested */
340
+ .children-wrapper {
341
+ display: none;
342
+ }
343
+ `,P([C({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),P([C({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),P([C({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),P([C({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),P([C({type:String})],exports.JupiterConceptTree.prototype,"locale",2),P([C({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),P([S()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=P([t("jupiter-concept-tree")],exports.JupiterConceptTree);var L=Object.defineProperty,J=Object.getOwnPropertyDescriptor,O=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?J(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&&L(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
+ <div class="dialog" @click="${e=>e.stopPropagation()}">
345
+ <div class="dialog-header">
346
+ <h2 class="dialog-title">Add Column</h2>
347
+ <p class="dialog-description">
348
+ ${"instant"===this.periodType?"Add a new instant period column by specifying the date.":"duration"===this.periodType?"Add a new duration period column by specifying the start and end dates.":"This section contains both instant and duration concepts. Choose the type of column to add."}
349
+ </p>
350
+ </div>
351
+
352
+ <div class="dialog-content">
353
+ ${"mixed"===this.periodType?e.html`
354
+ <div class="form-group">
355
+ <label class="form-label required">Column Type</label>
356
+ <select
357
+ class="form-input"
358
+ .value="${this._selectedType}"
359
+ @change="${this._handleSelectedTypeChange}"
360
+ required
361
+ >
362
+ <option value="instant">Instant (single date)</option>
363
+ <option value="duration">Duration (start and end dates)</option>
364
+ </select>
365
+ </div>
366
+ `:""}
367
+
368
+ ${"instant"===this.periodType||"mixed"===this.periodType&&"instant"===this._selectedType?e.html`
369
+ <div class="form-group">
370
+ <label class="form-label required">Instant Date</label>
371
+ <input
372
+ type="date"
373
+ class="form-input"
374
+ .value="${this._instantDate}"
375
+ @change="${this._handleInstantDateChange}"
376
+ required
377
+ />
378
+ </div>
379
+ `:e.html`
380
+ <div class="form-group">
381
+ <label class="form-label required">Start Period Date</label>
382
+ <input
383
+ type="date"
384
+ class="form-input"
385
+ .value="${this._startDate}"
386
+ @change="${this._handleStartDateChange}"
387
+ required
388
+ />
389
+ </div>
390
+ <div class="form-group">
391
+ <label class="form-label required">End Period Date</label>
392
+ <input
393
+ type="date"
394
+ class="form-input"
395
+ .value="${this._endDate}"
396
+ @change="${this._handleEndDateChange}"
397
+ required
398
+ />
399
+ </div>
400
+ `}
401
+ </div>
402
+
403
+ <div class="dialog-actions">
404
+ <button class="btn btn-cancel" @click="${this._handleCancel}">
405
+ Cancel
406
+ </button>
407
+ <button
408
+ class="btn btn-primary"
409
+ ?disabled="${!t}"
410
+ @click="${this._handleConfirm}"
411
+ >
412
+ Add Column
413
+ </button>
414
+ </div>
415
+ </div>
416
+ `}},exports.JupiterAddColumnDialog.styles=e.css`
417
+ :host {
418
+ position: fixed;
419
+ top: 0;
420
+ left: 0;
421
+ width: 100%;
422
+ height: 100%;
423
+ background: rgba(0, 0, 0, 0.5);
424
+ z-index: 1000;
425
+ display: flex;
426
+ align-items: center;
427
+ justify-content: center;
428
+ opacity: 0;
429
+ visibility: hidden;
430
+ transition: opacity 0.3s ease, visibility 0.3s ease;
431
+ }
432
+
433
+ :host([open]) {
434
+ opacity: 1;
435
+ visibility: visible;
436
+ }
437
+
438
+ .dialog {
439
+ background: white;
440
+ border-radius: 8px;
441
+ padding: 24px;
442
+ min-width: 400px;
443
+ max-width: 500px;
444
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
445
+ transform: scale(0.9);
446
+ transition: transform 0.3s ease;
447
+ }
448
+
449
+ :host([open]) .dialog {
450
+ transform: scale(1);
451
+ }
452
+
453
+ .dialog-header {
454
+ margin-bottom: 20px;
455
+ }
456
+
457
+ .dialog-title {
458
+ font-size: 20px;
459
+ font-weight: 600;
460
+ color: var(--jupiter-text-primary, #333);
461
+ margin: 0 0 8px 0;
462
+ }
463
+
464
+ .dialog-description {
465
+ font-size: 14px;
303
466
  color: var(--jupiter-text-secondary, #666);
304
- font-weight: normal;
305
- margin-left: 8px;
467
+ margin: 0;
306
468
  }
307
469
 
308
- .concept-fields {
309
- display: contents;
470
+ .dialog-content {
471
+ margin-bottom: 24px;
310
472
  }
311
473
 
312
- .field-cell {
474
+ .form-group {
475
+ margin-bottom: 16px;
476
+ }
477
+
478
+ .form-label {
479
+ display: block;
480
+ font-weight: 500;
481
+ margin-bottom: 6px;
482
+ color: var(--jupiter-text-primary, #333);
483
+ font-size: 14px;
484
+ }
485
+
486
+ .form-label.required::after {
487
+ content: ' *';
488
+ color: var(--jupiter-error-color, #d32f2f);
489
+ }
490
+
491
+ .form-input {
492
+ width: 100%;
493
+ box-sizing: border-box;
494
+ padding: 10px 12px;
313
495
  border: 1px solid var(--jupiter-border-color, #ddd);
314
- border-bottom: none;
315
- padding: 8px;
316
- background: var(--jupiter-cell-background, #fff);
317
- min-height: 40px;
496
+ border-radius: 4px;
497
+ font-size: 14px;
498
+ font-family: inherit;
499
+ transition: border-color 0.2s ease;
500
+ }
501
+
502
+ .form-input:focus {
503
+ outline: none;
504
+ border-color: var(--jupiter-primary-color, #007bff);
505
+ box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
506
+ }
507
+
508
+ select.form-input {
509
+ cursor: pointer;
510
+ background-color: white;
511
+ }
512
+
513
+ .dialog-actions {
318
514
  display: flex;
319
- align-items: center;
515
+ gap: 12px;
516
+ justify-content: flex-end;
320
517
  }
321
518
 
322
- .field-cell:last-child {
323
- border-right: 1px solid var(--jupiter-border-color, #ddd);
519
+ .btn {
520
+ padding: 10px 20px;
521
+ border: none;
522
+ border-radius: 4px;
523
+ font-size: 14px;
524
+ font-weight: 500;
525
+ cursor: pointer;
526
+ transition: background-color 0.2s ease;
324
527
  }
325
528
 
326
- .field-cell.empty {
327
- background: var(--jupiter-empty-cell-background, #f8f9fa);
529
+ .btn-cancel {
530
+ background: var(--jupiter-neutral-background, #f5f5f5);
531
+ color: var(--jupiter-text-primary, #333);
328
532
  }
329
533
 
330
- .children {
331
- display: contents;
534
+ .btn-cancel:hover {
535
+ background: var(--jupiter-neutral-background-hover, #e0e0e0);
332
536
  }
333
537
 
334
- .children.collapsed {
335
- display: none;
538
+ .btn-primary {
539
+ background: var(--jupiter-primary-color, #667eea);
540
+ color: white;
336
541
  }
337
542
 
338
- .concept-row:last-of-type .concept-header,
339
- .concept-row:last-of-type .field-cell {
340
- border-bottom: 1px solid var(--jupiter-border-color, #ddd);
543
+ .btn-primary:hover {
544
+ background: var(--jupiter-primary-color-dark, #5a6fd8);
545
+ }
546
+
547
+ .btn-primary:disabled {
548
+ background: var(--jupiter-disabled-background, #ccc);
549
+ cursor: not-allowed;
341
550
  }
342
- `,J([S({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),J([S({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),J([S({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),J([S({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),J([S({type:String})],exports.JupiterConceptTree.prototype,"locale",2),J([F()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=J([t("jupiter-concept-tree")],exports.JupiterConceptTree);var T=Object.defineProperty,U=Object.getOwnPropertyDescriptor,R=(e,t,r,i)=>{for(var o,s=i>1?void 0:i?U(t,r):t,a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i?o(t,r,s):o(s))||s);return i&&s&&T(t,r,s),s};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}connectedCallback(){super.connectedCallback(),this._expanded=!1!==this.section.expanded}_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},bubbles:!0}))}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}_handleConceptExpand(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}render(){return this.section.concepts&&0!==this.section.concepts.length?e.html`
551
+ `,O([C({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),O([C({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),O([S()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),O([S()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),O([S()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),O([S()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),exports.JupiterAddColumnDialog=O([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var z=Object.defineProperty,U=Object.getOwnPropertyDescriptor,N=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?U(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._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}))}render(){return this.section.concepts&&0!==this.section.concepts.length?e.html`
343
552
  <div class="section-header ${this.collapsible?"":"not-collapsible"}"
344
553
  @click="${this._toggleExpanded}">
345
554
  <div>
@@ -357,7 +566,7 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
357
566
  <div class="table-container">
358
567
  <table class="form-table">
359
568
  <thead class="table-header">
360
- <tr>
569
+ <tr class="header-row">
361
570
  <th class="header-cell concept-column">Concept</th>
362
571
  ${this.columns.map(t=>e.html`
363
572
  <th class="header-cell ${t.removable?"removable":""}">
@@ -372,24 +581,40 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
372
581
  `:""}
373
582
  </th>
374
583
  `)}
584
+ <th class="header-cell">
585
+ <button class="add-column-btn" @click="${e=>{e.stopPropagation(),this._handleAddColumn()}}" title="Add Column">
586
+ + Add Column
587
+ </button>
588
+ </th>
375
589
  </tr>
376
590
  </thead>
377
591
  <tbody class="table-body">
378
- ${this.section.concepts.map(t=>e.html`
379
- <jupiter-concept-tree
380
- .concept="${t}"
381
- .columns="${this.columns}"
382
- .formData="${this.formData}"
383
- .disabled="${this.disabled}"
384
- .locale="${this.locale}"
385
- @field-change="${this._handleFieldChange}"
386
- @concept-expand="${this._handleConceptExpand}"
387
- ></jupiter-concept-tree>
592
+ ${this._flattenConcepts(this.section.concepts,this._expandedConcepts).map(t=>e.html`
593
+ <tr>
594
+ <jupiter-concept-tree
595
+ .concept="${t}"
596
+ .columns="${this.columns}"
597
+ .formData="${this.formData}"
598
+ .disabled="${this.disabled}"
599
+ .locale="${this.locale}"
600
+ .expandedConcepts="${this._expandedConcepts}"
601
+ @field-change="${this._handleFieldChange}"
602
+ @concept-expand="${this._handleConceptExpand}"
603
+ ></jupiter-concept-tree>
604
+ </tr>
388
605
  `)}
389
606
  </tbody>
390
607
  </table>
391
608
  </div>
392
609
  </div>
610
+
611
+ <!-- Add Column Dialog -->
612
+ <jupiter-add-column-dialog
613
+ .periodType="${this._sectionPeriodType}"
614
+ ?open="${this._showAddColumnDialog}"
615
+ @dialog-cancel="${this._handleDialogCancel}"
616
+ @column-add="${this._handleColumnAdd}"
617
+ ></jupiter-add-column-dialog>
393
618
  `:e.html`
394
619
  <div class="section-header ${this.collapsible?"":"not-collapsible"}"
395
620
  @click="${this._toggleExpanded}">
@@ -489,7 +714,8 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
489
714
 
490
715
  .form-table {
491
716
  width: 100%;
492
- border-collapse: collapse;
717
+ border-collapse: separate;
718
+ border-spacing: 0;
493
719
  background: var(--jupiter-table-background, #fff);
494
720
  }
495
721
 
@@ -500,18 +726,27 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
500
726
  z-index: 1;
501
727
  }
502
728
 
729
+ .header-row {
730
+ /* Table row - no special display needed */
731
+ }
732
+
503
733
  .header-cell {
504
- padding: 12px;
734
+ padding: 8px 12px;
505
735
  text-align: left;
506
736
  font-weight: 600;
507
737
  color: var(--jupiter-text-primary, #333);
508
738
  border: 1px solid var(--jupiter-border-color, #ddd);
509
739
  background: var(--jupiter-header-background, #f8f9fa);
510
- min-width: 150px;
740
+ min-width: 180px;
741
+ width: 180px;
742
+ font-size: 14px;
743
+ vertical-align: middle;
511
744
  }
512
745
 
513
746
  .header-cell.concept-column {
747
+ width: 300px;
514
748
  min-width: 300px;
749
+ max-width: 300px;
515
750
  position: sticky;
516
751
  left: 0;
517
752
  z-index: 2;
@@ -542,8 +777,19 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
542
777
  background: var(--jupiter-error-color-dark, #b71c1c);
543
778
  }
544
779
 
545
- .table-body {
546
- display: table-row-group;
780
+ .add-column-btn {
781
+ background: var(--jupiter-primary-color, #667eea);
782
+ color: white;
783
+ border: none;
784
+ padding: 8px 16px;
785
+ border-radius: 4px;
786
+ cursor: pointer;
787
+ font-size: 12px;
788
+ margin: 8px;
789
+ }
790
+
791
+ .add-column-btn:hover {
792
+ background: var(--jupiter-primary-color-dark, #5a6fd8);
547
793
  }
548
794
 
549
795
  .empty-section {
@@ -552,33 +798,20 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
552
798
  color: var(--jupiter-text-secondary, #666);
553
799
  font-style: italic;
554
800
  }
555
- `,R([S({type:Object})],exports.JupiterFormSection.prototype,"section",2),R([S({type:Array})],exports.JupiterFormSection.prototype,"columns",2),R([S({type:Object})],exports.JupiterFormSection.prototype,"formData",2),R([S({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),R([S({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),R([S({type:String})],exports.JupiterFormSection.prototype,"locale",2),R([F()],exports.JupiterFormSection.prototype,"_expanded",2),exports.JupiterFormSection=R([t("jupiter-form-section")],exports.JupiterFormSection);var L=Object.defineProperty,z=Object.getOwnPropertyDescriptor,A=(e,t,r,i)=>{for(var o,s=i>1?void 0:i?z(t,r):t,a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i?o(t,r,s):o(s))||s);return i&&s&&L(t,r,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._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=k.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=[],r=this._currentSchema;if(r){for(const i of r.sections)for(const r of i.concepts)for(const i of r.fields){const o=null==(e=this._formData[r.id])?void 0:e[i.columnId],s=j.validateField(i.id,r.id,i.columnId,o,i.type,i.validation||[]);t.push(...s)}this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleFieldChange(e){const{fieldId:t,conceptId:r,columnId:i,value:o}=e.detail;this._formData[r]||(this._formData[r]={});const s=this._formData[r][i];this._formData[r][i]=o,this._touched.add(`${r}-${i}`),this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:r,columnId:i,value:o,oldValue:s},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}=e.detail;this._columns=this._columns.filter(e=>e.id!==t);for(const r in this._formData)void 0!==this._formData[r][t]&&delete this._formData[r][t];this._dirty=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:t},bubbles:!0}))}_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(),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,valid:this._valid,errors:this._errors},bubbles:!0}))}_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,r=this.config||{},i=!1!==r.showValidationSummary&&t>0&&this._submitted,o=this._currentSchema;return o?e.html`
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`
556
802
  <div class="form-container">
557
803
  <!-- Form Header -->
558
804
  <div class="form-header">
559
- <h1 class="form-title">${o.title}</h1>
560
- ${o.description?e.html`
561
- <p class="form-description">${o.description}</p>
805
+ <h1 class="form-title">${r.title}</h1>
806
+ ${r.description?e.html`
807
+ <p class="form-description">${r.description}</p>
562
808
  `:""}
563
809
  </div>
564
810
 
565
- <!-- Add Column Section -->
566
- ${!1!==r.enableColumnManagement?e.html`
567
- <div class="add-column-container">
568
- <button
569
- class="add-column-btn"
570
- @click="${this._addColumn}"
571
- ?disabled="${this.disabled||this.readonly||r.maxColumns&&this._columns.length>=r.maxColumns}"
572
- >
573
- Add Dimension Column
574
- </button>
575
- </div>
576
- `:""}
577
-
578
811
  <!-- Form Content -->
579
812
  <div class="form-sections">
580
813
  <!-- Validation Summary -->
581
- ${i?e.html`
814
+ ${o?e.html`
582
815
  <div class="validation-summary">
583
816
  <h4 class="validation-summary-title">Please fix the following errors:</h4>
584
817
  <ul class="validation-summary-list">
@@ -590,38 +823,39 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
590
823
  `:""}
591
824
 
592
825
  <!-- Form Sections -->
593
- ${o.sections.map(t=>e.html`
826
+ ${r.sections.map(t=>e.html`
594
827
  <jupiter-form-section
595
828
  .section="${t}"
596
- .columns="${this._columns}"
829
+ .columns="${t.columns||this._columns}"
597
830
  .formData="${this._formData}"
598
831
  .disabled="${this.disabled||this.readonly}"
599
- .collapsible="${!1!==r.collapsibleSections}"
600
- .locale="${r.locale||"en-US"}"
832
+ .collapsible="${!1!==i.collapsibleSections}"
833
+ .locale="${i.locale||"en-US"}"
601
834
  @field-change="${this._handleFieldChange}"
602
835
  @section-expand="${this._handleSectionExpand}"
603
836
  @concept-expand="${this._handleConceptExpand}"
604
837
  @column-remove="${this._handleColumnRemove}"
838
+ @column-add-request="${this._handleColumnAddRequest}"
605
839
  ></jupiter-form-section>
606
840
  `)}
607
841
  </div>
608
842
 
609
- <!-- Form Actions -->
843
+ <!-- Form Actions - Fixed Footer -->
610
844
  <div class="form-actions">
611
845
  <button
612
- class="btn-primary"
613
- @click="${this._handleSubmit}"
846
+ class="btn-secondary"
847
+ @click="${this._handleSaveDraft}"
614
848
  ?disabled="${this.disabled||this.readonly}"
615
849
  >
616
- Submit
850
+ Save Draft
617
851
  </button>
618
852
 
619
853
  <button
620
- class="btn-outline"
621
- @click="${this._handleReset}"
622
- ?disabled="${this.disabled||!this._dirty}"
854
+ class="btn-primary"
855
+ @click="${this._handleSubmit}"
856
+ ?disabled="${this.disabled||this.readonly}"
623
857
  >
624
- Reset
858
+ Submit
625
859
  </button>
626
860
 
627
861
  <div class="form-meta">
@@ -666,42 +900,23 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
666
900
  }
667
901
 
668
902
  .form-actions {
903
+ position: fixed;
904
+ bottom: 0;
905
+ left: 0;
906
+ right: 0;
669
907
  padding: 16px 24px;
670
908
  border-top: 1px solid var(--jupiter-border-color, #ddd);
671
909
  background: var(--jupiter-form-actions-background, #f8f9fa);
672
910
  display: flex;
673
911
  gap: 12px;
674
912
  align-items: center;
675
- }
676
-
677
- .add-column-container {
678
- padding: 16px 24px;
679
- border-bottom: 1px solid var(--jupiter-border-color, #ddd);
680
- background: var(--jupiter-form-actions-background, #f8f9fa);
681
- }
682
-
683
- .add-column-btn {
684
- padding: 8px 16px;
685
- background: var(--jupiter-primary-color, #1976d2);
686
- color: white;
687
- border: none;
688
- border-radius: 4px;
689
- cursor: pointer;
690
- font-size: 14px;
691
- font-weight: 500;
692
- }
693
-
694
- .add-column-btn:hover {
695
- background: var(--jupiter-primary-color-dark, #1565c0);
696
- }
697
-
698
- .add-column-btn:disabled {
699
- background: var(--jupiter-disabled-background, #ccc);
700
- cursor: not-allowed;
913
+ z-index: 1000;
914
+ box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
701
915
  }
702
916
 
703
917
  .form-sections {
704
918
  padding: 24px;
919
+ padding-bottom: 100px; /* Add space for fixed footer */
705
920
  }
706
921
 
707
922
  .validation-summary {
@@ -780,5 +995,5 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
780
995
  color: var(--jupiter-text-secondary, #666);
781
996
  margin-left: auto;
782
997
  }
783
- `,A([S({type:Object})],exports.JupiterDynamicForm.prototype,"schema",2),A([S({type:Object})],exports.JupiterDynamicForm.prototype,"xbrlInput",2),A([S({type:Object})],exports.JupiterDynamicForm.prototype,"config",2),A([S({type:Object})],exports.JupiterDynamicForm.prototype,"initialData",2),A([S({type:Boolean})],exports.JupiterDynamicForm.prototype,"disabled",2),A([S({type:Boolean})],exports.JupiterDynamicForm.prototype,"readonly",2),A([S({type:String})],exports.JupiterDynamicForm.prototype,"periodStartDate",2),A([S({type:String})],exports.JupiterDynamicForm.prototype,"periodEndDate",2),A([F()],exports.JupiterDynamicForm.prototype,"_formData",2),A([F()],exports.JupiterDynamicForm.prototype,"_columns",2),A([F()],exports.JupiterDynamicForm.prototype,"_errors",2),A([F()],exports.JupiterDynamicForm.prototype,"_touched",2),A([F()],exports.JupiterDynamicForm.prototype,"_dirty",2),A([F()],exports.JupiterDynamicForm.prototype,"_valid",2),A([F()],exports.JupiterDynamicForm.prototype,"_submitted",2),A([F()],exports.JupiterDynamicForm.prototype,"_currentSchema",2),exports.JupiterDynamicForm=A([t("jupiter-dynamic-form")],exports.JupiterDynamicForm);exports.FormValidator=j,exports.version="1.0.0";
998
+ `,V([C({type:Object})],exports.JupiterDynamicForm.prototype,"schema",2),V([C({type:Object})],exports.JupiterDynamicForm.prototype,"xbrlInput",2),V([C({type:Object})],exports.JupiterDynamicForm.prototype,"config",2),V([C({type:Object})],exports.JupiterDynamicForm.prototype,"initialData",2),V([C({type:Boolean})],exports.JupiterDynamicForm.prototype,"disabled",2),V([C({type:Boolean})],exports.JupiterDynamicForm.prototype,"readonly",2),V([C({type:String})],exports.JupiterDynamicForm.prototype,"periodStartDate",2),V([C({type:String})],exports.JupiterDynamicForm.prototype,"periodEndDate",2),V([S()],exports.JupiterDynamicForm.prototype,"_formData",2),V([S()],exports.JupiterDynamicForm.prototype,"_columns",2),V([S()],exports.JupiterDynamicForm.prototype,"_errors",2),V([S()],exports.JupiterDynamicForm.prototype,"_touched",2),V([S()],exports.JupiterDynamicForm.prototype,"_dirty",2),V([S()],exports.JupiterDynamicForm.prototype,"_valid",2),V([S()],exports.JupiterDynamicForm.prototype,"_submitted",2),V([S()],exports.JupiterDynamicForm.prototype,"_currentSchema",2),exports.JupiterDynamicForm=V([t("jupiter-dynamic-form")],exports.JupiterDynamicForm);exports.FormValidator=E,exports.version="1.0.0";
784
999
  //# sourceMappingURL=index.js.map