jupiter-dynamic-forms 1.17.2 → 1.17.3
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/form-section.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-section.d.ts","sourceRoot":"","sources":["../../src/core/form-section.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAe,MAAM,iBAAiB,CAAC;AAEvE,OAAO,gBAAgB,CAAC;AACxB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAoB,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,qBACa,kBAAmB,SAAQ,UAAU;IACpB,OAAO,EAAG,WAAW,CAAC;IACvB,OAAO,EAAE,UAAU,EAAE,CAAM;IAC3B,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAM;IACrD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAM;IACtD,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAM;IAC7D,YAAY,EAAE;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAM;IACpD,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAM;IAC/C,QAAQ,UAAS;IACjB,WAAW,UA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;IA2BlC,OAAO,CAAC,sBAAsB;IAkB9B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,gBAAgB;IAgBf,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,aAAa,CAA0E;IAC/F,OAAO,CAAC,qBAAqB,CAA0B;IAChE,OAAO,CAAC,iBAAiB,CAAoC;IAC7D,OAAO,CAAC,gBAAgB,CAAkC;IAC1D,OAAO,CAAC,gBAAgB,CAAuC;IAC/D,OAAO,CAAC,sBAAsB,CAAyC;IAEvE;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,oBAAoB;IAyC5B,OAAO,CAAC,oBAAoB;IAsC5B,OAAO,CAAC,MAAM,CAAC,WAAW;IAmB1B,OAAO,CAAC,6BAA6B;IA4BrC,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,0BAA0B;IAKlC,OAAO,CAAC,8BAA8B;IAiBtC,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,mBAAmB;IAQ3B,8GAA8G;IAC9G,OAAO,CAAC,kBAAkB;IAwD1B,MAAM;CA8IP"}
|
package/dist/index.js
CHANGED
|
@@ -1281,7 +1281,7 @@ const $={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},I=(e=$,t,
|
|
|
1281
1281
|
margin: 0 0 12px 0;
|
|
1282
1282
|
line-height: 1.4;
|
|
1283
1283
|
}
|
|
1284
|
-
`,G([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),G([S({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),G([S({type:Array})],exports.JupiterAddColumnDialog.prototype,"availableDimensions",2),G([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodStartDate",2),G([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodEndDate",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_selectedDimensions",2),exports.JupiterAddColumnDialog=G([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var W=Object.defineProperty,X=Object.getOwnPropertyDescriptor,Z=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?X(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&&W(t,i,n),n};exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.typedMemberData={},this.repeatCounts={},this.defaultUnits=[],this.disabled=!1,this.collapsible=!0,this.locale="en-US",this.isFirstSection=!1,this.availableDimensions=[],this.hideHeader=!1,this.mode="inputForm",this.showFactsOnly=!1,this.periodStartDate="",this.periodEndDate="",this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._openMenuColumnId=null,this._insertAfterColumnId=null,this._boundFieldBlur=e=>{this._clearHighlights()
|
|
1284
|
+
`,G([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),G([S({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),G([S({type:Array})],exports.JupiterAddColumnDialog.prototype,"availableDimensions",2),G([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodStartDate",2),G([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodEndDate",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),G([w()],exports.JupiterAddColumnDialog.prototype,"_selectedDimensions",2),exports.JupiterAddColumnDialog=G([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var W=Object.defineProperty,X=Object.getOwnPropertyDescriptor,Z=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?X(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&&W(t,i,n),n};exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.typedMemberData={},this.repeatCounts={},this.defaultUnits=[],this.disabled=!1,this.collapsible=!0,this.locale="en-US",this.isFirstSection=!1,this.availableDimensions=[],this.hideHeader=!1,this.mode="inputForm",this.showFactsOnly=!1,this.periodStartDate="",this.periodEndDate="",this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._openMenuColumnId=null,this._insertAfterColumnId=null,this._boundFieldBlur=e=>{this._clearHighlights()},this._expandedConcepts=new Set,this._allTreeExpanded=!1,this._highlightMap=new Map,this._calculationErrorKeys=new Set,this._totalChildrenMap=new Map,this._memberParentMap=new Map,this._totalConceptMap=new Map,this._totalChildConceptsMap=new Map}connectedCallback(){super.connectedCallback(),this._expanded=!1!==this.section.expanded,this._determinePeriodType(),this._checkAndExpandFirstSection(),document.addEventListener("click",()=>this._closeColumnMenu()),this.addEventListener("field-blur",this._boundFieldBlur)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",()=>this._closeColumnMenu()),this.removeEventListener("field-blur",this._boundFieldBlur)}updated(e){var t;super.updated(e),(e.has("isFirstSection")||e.has("section"))&&this._checkAndExpandFirstSection(),e.has("section")&&(null==(t=this.section)?void 0:t.concepts)&&this._buildTotalMaps(this.section.concepts)}_checkAndExpandFirstSection(){this.isFirstSection&&this.section&&this.section.concepts&&(this._expanded=!0,setTimeout(()=>{this._expandAllTrees(),console.log("🎯 First section detected - expanded section and tree by default")},0))}_determinePeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(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(0===t.size)this._sectionPeriodType="duration";else if(1===t.size){const e=Array.from(t)[0];this._sectionPeriodType="instant"===e?"instant":"duration"}else this._sectionPeriodType="mixed"}_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._expanded&&this._expandAllTrees(),this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:this._expanded},bubbles:!0})))}_handleRemoveColumn(e){this._openMenuColumnId=null,this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_toggleColumnMenu(e,t){t.stopPropagation(),this._openMenuColumnId=this._openMenuColumnId===e?null:e}_closeColumnMenu(){this._openMenuColumnId=null}_handleAddColumnFromMenu(e,t){t.stopPropagation(),this._openMenuColumnId=null,this._insertAfterColumnId=e,this._handleAddColumn()}_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,insertAfterColumnId:this._insertAfterColumnId},bubbles:!0})),this._insertAfterColumnId=null}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0,composed:!0}))}_handlePeriodChange(e){console.log("📋 [FormSection] Received period-change event:",e.detail),e.stopPropagation(),this.dispatchEvent(new CustomEvent("period-change",{detail:e.detail,bubbles:!0,composed:!0})),console.log("📋 [FormSection] Forwarded period-change event to dynamic-form")}_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}_isConceptRowBlank(e){var t;for(const i of this.columns){const o=null==(t=this.formData[e.id])?void 0:t[i.id];if(null!=o&&""!==o)return!1}return!0}_getAllConceptIds(e){const t=[];for(const i of e)i.children&&i.children.length>0&&(t.push(i.id),t.push(...this._getAllConceptIds(i.children)));return t}_expandAllTrees(){const e=this._getAllConceptIds(this.section.concepts||[]);this._expandedConcepts=new Set([...this._expandedConcepts,...e]),this._allTreeExpanded=!0}_collapseAllTrees(){this._expandedConcepts=new Set,this._allTreeExpanded=!1}_handleConceptExpand(e){e.stopPropagation();const{conceptId:t,expanded:i}=e.detail,o=new Set(this._expandedConcepts);i?o.add(t):o.delete(t),this._expandedConcepts=o;const r=this._getAllConceptIds(this.section.concepts||[]);this._allTreeExpanded=r.length>0&&r.every(e=>o.has(e)),this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_buildTotalMaps(e){this._totalChildrenMap.clear(),this._memberParentMap.clear(),this._totalConceptMap.clear(),this._totalChildConceptsMap.clear(),this._traverseTotalGroups(e)}_traverseTotalGroups(e){var t,i,o,r;for(let n=0;n<e.length;n++){const s=e[n];if(null==(t=s.preferredLabel)?void 0:t.includes("totalLabel"))if(null==(i=s.children)?void 0:i.length){const e=s.children.map(e=>e.id);this._totalChildrenMap.set(s.id,e),this._totalConceptMap.set(s.id,s),this._totalChildConceptsMap.set(s.id,s.children);for(const t of e)this._memberParentMap.set(t,s.id)}else{let t=-1;for(let r=n-1;r>=0;r--)if(null==(o=e[r].preferredLabel)?void 0:o.includes("totalLabel")){t=r;break}const i=e.slice(t+1,n);if(i.length>0){const e=i.map(e=>e.id);this._totalChildrenMap.set(s.id,e),this._totalConceptMap.set(s.id,s),this._totalChildConceptsMap.set(s.id,i);for(const t of e)this._memberParentMap.set(t,s.id)}}(null==(r=s.children)?void 0:r.length)&&this._traverseTotalGroups(s.children)}}_runCalculationCheck(e,t){var i;const o=this._totalConceptMap.has(e)?e:this._memberParentMap.get(e);if(!o)return;const r=this._totalConceptMap.get(o),n=null==(i=this.formData[o])?void 0:i[t],s=`${o}__${t}`;if(null==n||""===n){if(this._calculationErrorKeys.has(s)){const e=new Set(this._calculationErrorKeys);e.delete(s),this._calculationErrorKeys=e}return}const a=parseFloat(n);if(isNaN(a))return;const l=(this._totalChildConceptsMap.get(o)||[]).map(e=>{var i;return{value:null==(i=this.formData[e.id])?void 0:i[t],balance:e.balance}}),d=exports.JupiterFormSection._checkTotal(a,l,r.balance),c=new Set(this._calculationErrorKeys);d?c.delete(s):c.add(s),this._calculationErrorKeys=c}static _checkTotal(e,t,i){let o=0,r=!1;for(const n of t){const e=parseFloat(n.value);if(isNaN(e))continue;r=!0;o+=(i&&n.balance&&i!==n.balance?-1:1)*e}return!r||Math.abs(o-e)<.01}_handleFieldFocusForHighlight(e){var t,i;const o=null==(t=e.detail)?void 0:t.conceptId,r=null==(i=e.detail)?void 0:i.columnId;if(!o||!r)return;const n=new Map;if(this._totalChildrenMap.has(o)){n.set(o,{type:"total",columnId:r});for(const e of this._totalChildrenMap.get(o))n.set(e,{type:"member",columnId:r})}else{const e=this._memberParentMap.get(o);if(e){n.set(e,{type:"total",columnId:r});for(const t of this._totalChildrenMap.get(e))n.set(t,{type:"member",columnId:r})}}this._highlightMap=n}_clearHighlights(){this._highlightMap.size>0&&(this._highlightMap=new Map)}_getTypedMemberHeaderValue(e,t){var i;return(null==(i=this.typedMemberData[e])?void 0:i[t])||""}_handleTypedMemberHeaderChange(e,t,i){const o=e.target.value;console.log(`🔍 [FormSection] Typed member header change: columnId=${t}, axisId=${i}, value=${o}`),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}_handleAddRepeat(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("add-concept-repeat",{detail:e.detail,bubbles:!0}))}_handleRemoveRepeat(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("remove-concept-repeat",{detail:e.detail,bubbles:!0}))}_renderConceptRows(t){var i;const o="readonly"!==this.mode&&!t.abstract&&(null==(i=t.fields)?void 0:i.some(e=>{var t;return(null==(t=e.crossRoleTypedMembers)?void 0:t.length)>0})),r=o&&this.repeatCounts[t.id]||0,n=(t,i)=>{var o,r;return e.html`
|
|
1285
1285
|
<jupiter-concept-tree
|
|
1286
1286
|
.concept="${t}"
|
|
1287
1287
|
.columns="${this.columns}"
|