jupiter-dynamic-forms 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/dynamic-form.d.ts +2 -0
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -15
- package/dist/index.mjs.map +1 -1
- package/dist/schema/types.d.ts +2 -0
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/utils/xbrl-form-builder.d.ts +1 -1
- package/dist/utils/xbrl-form-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../src/core/dynamic-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EACL,cAAc,EACd,QAAQ,EAGR,SAAS,EACT,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,gBAAgB,CAAC;AAExB,qBACa,kBAAmB,SAAQ,UAAU;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAM;IAC7B,WAAW,EAAE,QAAQ,CAAM;IAC1B,QAAQ,UAAS;IACjB,QAAQ,UAAS;
|
|
1
|
+
{"version":3,"file":"dynamic-form.d.ts","sourceRoot":"","sources":["../../src/core/dynamic-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EACL,cAAc,EACd,QAAQ,EAGR,SAAS,EACT,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,gBAAgB,CAAC;AAExB,qBACa,kBAAmB,SAAQ,UAAU;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAM;IAC7B,WAAW,EAAE,QAAQ,CAAM;IAC1B,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAClB,eAAe,SAAgB;IAC/B,aAAa,SAAgB;IAEhD,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,QAAQ,CAAqB;IACrC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAC,CAAiB;IAEjD,MAAM,CAAC,MAAM,0BAqJX;IAEF,iBAAiB;IAKjB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAM3C,OAAO,CAAC,eAAe;IA+CvB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,kBAAkB;IA2B1B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,aAAa;IAYd,OAAO,IAAI,QAAQ;IAInB,OAAO,CAAC,IAAI,EAAE,QAAQ;IAOtB,QAAQ,IAAI,OAAO;IAKnB,KAAK;IAIL,QAAQ,IAAI,SAAS;IAI5B,MAAM;CA+FP"}
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
|
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/function
|
|
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`
|
|
23
23
|
<textarea
|
|
24
24
|
class="${o}"
|
|
25
25
|
.value="${this.value||""}"
|
|
@@ -194,7 +194,7 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
|
|
|
194
194
|
margin: 0;
|
|
195
195
|
width: auto;
|
|
196
196
|
}
|
|
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([
|
|
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
198
|
<div class="concept-row" style="--level: ${r}">
|
|
199
199
|
<!-- Concept Label Column -->
|
|
200
200
|
<div class="concept-header" @click="${this._toggleExpanded}">
|
|
@@ -339,7 +339,7 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
|
|
|
339
339
|
.concept-row:last-of-type .field-cell {
|
|
340
340
|
border-bottom: 1px solid var(--jupiter-border-color, #ddd);
|
|
341
341
|
}
|
|
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([
|
|
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`
|
|
343
343
|
<div class="section-header ${this.collapsible?"":"not-collapsible"}"
|
|
344
344
|
@click="${this._toggleExpanded}">
|
|
345
345
|
<div>
|
|
@@ -552,23 +552,23 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
|
|
|
552
552
|
color: var(--jupiter-text-secondary, #666);
|
|
553
553
|
font-style: italic;
|
|
554
554
|
}
|
|
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([
|
|
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`
|
|
556
556
|
<div class="form-container">
|
|
557
557
|
<!-- Form Header -->
|
|
558
558
|
<div class="form-header">
|
|
559
|
-
<h1 class="form-title">${
|
|
560
|
-
${
|
|
561
|
-
<p class="form-description">${
|
|
559
|
+
<h1 class="form-title">${o.title}</h1>
|
|
560
|
+
${o.description?e.html`
|
|
561
|
+
<p class="form-description">${o.description}</p>
|
|
562
562
|
`:""}
|
|
563
563
|
</div>
|
|
564
564
|
|
|
565
565
|
<!-- Add Column Section -->
|
|
566
|
-
${!1!==
|
|
566
|
+
${!1!==r.enableColumnManagement?e.html`
|
|
567
567
|
<div class="add-column-container">
|
|
568
568
|
<button
|
|
569
569
|
class="add-column-btn"
|
|
570
570
|
@click="${this._addColumn}"
|
|
571
|
-
?disabled="${this.disabled||this.readonly||
|
|
571
|
+
?disabled="${this.disabled||this.readonly||r.maxColumns&&this._columns.length>=r.maxColumns}"
|
|
572
572
|
>
|
|
573
573
|
Add Dimension Column
|
|
574
574
|
</button>
|
|
@@ -578,7 +578,7 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
|
|
|
578
578
|
<!-- Form Content -->
|
|
579
579
|
<div class="form-sections">
|
|
580
580
|
<!-- Validation Summary -->
|
|
581
|
-
${
|
|
581
|
+
${i?e.html`
|
|
582
582
|
<div class="validation-summary">
|
|
583
583
|
<h4 class="validation-summary-title">Please fix the following errors:</h4>
|
|
584
584
|
<ul class="validation-summary-list">
|
|
@@ -590,14 +590,14 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
|
|
|
590
590
|
`:""}
|
|
591
591
|
|
|
592
592
|
<!-- Form Sections -->
|
|
593
|
-
${
|
|
593
|
+
${o.sections.map(t=>e.html`
|
|
594
594
|
<jupiter-form-section
|
|
595
595
|
.section="${t}"
|
|
596
596
|
.columns="${this._columns}"
|
|
597
597
|
.formData="${this._formData}"
|
|
598
598
|
.disabled="${this.disabled||this.readonly}"
|
|
599
|
-
.collapsible="${!1!==
|
|
600
|
-
.locale="${
|
|
599
|
+
.collapsible="${!1!==r.collapsibleSections}"
|
|
600
|
+
.locale="${r.locale||"en-US"}"
|
|
601
601
|
@field-change="${this._handleFieldChange}"
|
|
602
602
|
@section-expand="${this._handleSectionExpand}"
|
|
603
603
|
@concept-expand="${this._handleConceptExpand}"
|
|
@@ -780,5 +780,5 @@ const w={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:x},E=(e=w,t,
|
|
|
780
780
|
color: var(--jupiter-text-secondary, #666);
|
|
781
781
|
margin-left: auto;
|
|
782
782
|
}
|
|
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([
|
|
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";
|
|
784
784
|
//# sourceMappingURL=index.js.map
|