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
package/dist/index.mjs
CHANGED
|
@@ -527,14 +527,14 @@ class XBRLFormBuilder {
|
|
|
527
527
|
* Build form schema from XBRL input data
|
|
528
528
|
* Creates accordion sections for each presentation role
|
|
529
529
|
*/
|
|
530
|
-
static buildFormSchema(xbrlInput) {
|
|
530
|
+
static buildFormSchema(xbrlInput, periodStartDate, periodEndDate) {
|
|
531
531
|
if (!xbrlInput.presentation || xbrlInput.presentation.length === 0) {
|
|
532
532
|
throw new Error("XBRL presentation data is required");
|
|
533
533
|
}
|
|
534
534
|
const presentationData = xbrlInput.presentation[0];
|
|
535
535
|
const sections = [];
|
|
536
536
|
presentationData.roles.forEach((role) => {
|
|
537
|
-
const section = this.buildSectionFromRole(role);
|
|
537
|
+
const section = this.buildSectionFromRole(role, periodStartDate, periodEndDate);
|
|
538
538
|
sections.push(section);
|
|
539
539
|
});
|
|
540
540
|
return {
|
|
@@ -548,13 +548,13 @@ class XBRLFormBuilder {
|
|
|
548
548
|
/**
|
|
549
549
|
* Build a form section from a presentation role
|
|
550
550
|
*/
|
|
551
|
-
static buildSectionFromRole(role) {
|
|
551
|
+
static buildSectionFromRole(role, periodStartDate, periodEndDate) {
|
|
552
552
|
var _a;
|
|
553
553
|
const title = this.extractRoleTitle(role.role);
|
|
554
554
|
const conceptTrees = [];
|
|
555
555
|
if ((_a = role.presentationLinkbase) == null ? void 0 : _a.concepts) {
|
|
556
556
|
role.presentationLinkbase.concepts.forEach((concept) => {
|
|
557
|
-
const conceptTree = this.buildConceptTree(concept, 0);
|
|
557
|
+
const conceptTree = this.buildConceptTree(concept, 0, periodStartDate, periodEndDate);
|
|
558
558
|
if (conceptTree) {
|
|
559
559
|
conceptTrees.push(conceptTree);
|
|
560
560
|
}
|
|
@@ -571,11 +571,11 @@ class XBRLFormBuilder {
|
|
|
571
571
|
/**
|
|
572
572
|
* Build concept tree from XBRL presentation concept
|
|
573
573
|
*/
|
|
574
|
-
static buildConceptTree(concept, level) {
|
|
574
|
+
static buildConceptTree(concept, level, periodStartDate, periodEndDate) {
|
|
575
575
|
const label = this.getPreferredLabel(concept.labels);
|
|
576
576
|
const fields = [];
|
|
577
577
|
if (!concept.elementAbstract) {
|
|
578
|
-
const field = this.createFieldFromConcept(concept);
|
|
578
|
+
const field = this.createFieldFromConcept(concept, periodStartDate, periodEndDate);
|
|
579
579
|
if (field) {
|
|
580
580
|
fields.push(field);
|
|
581
581
|
}
|
|
@@ -583,7 +583,7 @@ class XBRLFormBuilder {
|
|
|
583
583
|
const children = [];
|
|
584
584
|
if (concept.children && concept.children.length > 0) {
|
|
585
585
|
concept.children.forEach((child) => {
|
|
586
|
-
const childTree = this.buildConceptTree(child, level + 1);
|
|
586
|
+
const childTree = this.buildConceptTree(child, level + 1, periodStartDate, periodEndDate);
|
|
587
587
|
if (childTree) {
|
|
588
588
|
children.push(childTree);
|
|
589
589
|
}
|
|
@@ -604,10 +604,10 @@ class XBRLFormBuilder {
|
|
|
604
604
|
/**
|
|
605
605
|
* Create form field from XBRL concept
|
|
606
606
|
*/
|
|
607
|
-
static createFieldFromConcept(concept) {
|
|
607
|
+
static createFieldFromConcept(concept, periodStartDate, periodEndDate) {
|
|
608
608
|
const fieldType = this.mapXBRLTypeToFieldType(concept.type);
|
|
609
609
|
const label = this.getPreferredLabel(concept.labels);
|
|
610
|
-
|
|
610
|
+
const field = {
|
|
611
611
|
id: `${concept.id}_field`,
|
|
612
612
|
conceptId: concept.id,
|
|
613
613
|
columnId: "default",
|
|
@@ -620,6 +620,11 @@ class XBRLFormBuilder {
|
|
|
620
620
|
disabled: concept.elementAbstract,
|
|
621
621
|
defaultValue: null
|
|
622
622
|
};
|
|
623
|
+
if (concept.periodType === "duration" || concept.periodType === "instant") {
|
|
624
|
+
field.periodStartDate = periodStartDate || "2025-01-01";
|
|
625
|
+
field.periodEndDate = periodEndDate || "2025-12-31";
|
|
626
|
+
}
|
|
627
|
+
return field;
|
|
623
628
|
}
|
|
624
629
|
/**
|
|
625
630
|
* Map XBRL data type to form field type
|
|
@@ -1568,6 +1573,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
1568
1573
|
this.initialData = {};
|
|
1569
1574
|
this.disabled = false;
|
|
1570
1575
|
this.readonly = false;
|
|
1576
|
+
this.periodStartDate = "2025-01-01";
|
|
1577
|
+
this.periodEndDate = "2025-12-31";
|
|
1571
1578
|
this._formData = {};
|
|
1572
1579
|
this._columns = [];
|
|
1573
1580
|
this._errors = [];
|
|
@@ -1590,7 +1597,12 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
1590
1597
|
if (this.xbrlInput) {
|
|
1591
1598
|
try {
|
|
1592
1599
|
console.log("🔄 Initializing form from XBRL input:", this.xbrlInput);
|
|
1593
|
-
this.
|
|
1600
|
+
console.log("📅 Using period dates:", this.periodStartDate, "to", this.periodEndDate);
|
|
1601
|
+
this._currentSchema = XBRLFormBuilder.buildFormSchema(
|
|
1602
|
+
this.xbrlInput,
|
|
1603
|
+
this.periodStartDate,
|
|
1604
|
+
this.periodEndDate
|
|
1605
|
+
);
|
|
1594
1606
|
console.log("✅ Generated schema with sections:", this._currentSchema.sections.length);
|
|
1595
1607
|
this._columns = [
|
|
1596
1608
|
{
|
|
@@ -1788,7 +1800,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
1788
1800
|
}
|
|
1789
1801
|
render() {
|
|
1790
1802
|
const errorCount = this._errors.filter((e2) => e2.severity === "error").length;
|
|
1791
|
-
const
|
|
1803
|
+
const config = this.config || {};
|
|
1804
|
+
const showValidationSummary = config.showValidationSummary !== false && errorCount > 0 && this._submitted;
|
|
1792
1805
|
const schema = this._currentSchema;
|
|
1793
1806
|
if (!schema) {
|
|
1794
1807
|
return html`<div>Loading form...</div>`;
|
|
@@ -1804,12 +1817,12 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
1804
1817
|
</div>
|
|
1805
1818
|
|
|
1806
1819
|
<!-- Add Column Section -->
|
|
1807
|
-
${
|
|
1820
|
+
${config.enableColumnManagement !== false ? html`
|
|
1808
1821
|
<div class="add-column-container">
|
|
1809
1822
|
<button
|
|
1810
1823
|
class="add-column-btn"
|
|
1811
1824
|
@click="${this._addColumn}"
|
|
1812
|
-
?disabled="${this.disabled || this.readonly ||
|
|
1825
|
+
?disabled="${this.disabled || this.readonly || config.maxColumns && this._columns.length >= config.maxColumns}"
|
|
1813
1826
|
>
|
|
1814
1827
|
Add Dimension Column
|
|
1815
1828
|
</button>
|
|
@@ -1837,8 +1850,8 @@ let JupiterDynamicForm = class extends LitElement {
|
|
|
1837
1850
|
.columns="${this._columns}"
|
|
1838
1851
|
.formData="${this._formData}"
|
|
1839
1852
|
.disabled="${this.disabled || this.readonly}"
|
|
1840
|
-
.collapsible="${
|
|
1841
|
-
.locale="${
|
|
1853
|
+
.collapsible="${config.collapsibleSections !== false}"
|
|
1854
|
+
.locale="${config.locale || "en-US"}"
|
|
1842
1855
|
@field-change="${this._handleFieldChange}"
|
|
1843
1856
|
@section-expand="${this._handleSectionExpand}"
|
|
1844
1857
|
@concept-expand="${this._handleConceptExpand}"
|
|
@@ -2043,6 +2056,12 @@ __decorateClass([
|
|
|
2043
2056
|
__decorateClass([
|
|
2044
2057
|
n2({ type: Boolean })
|
|
2045
2058
|
], JupiterDynamicForm.prototype, "readonly", 2);
|
|
2059
|
+
__decorateClass([
|
|
2060
|
+
n2({ type: String })
|
|
2061
|
+
], JupiterDynamicForm.prototype, "periodStartDate", 2);
|
|
2062
|
+
__decorateClass([
|
|
2063
|
+
n2({ type: String })
|
|
2064
|
+
], JupiterDynamicForm.prototype, "periodEndDate", 2);
|
|
2046
2065
|
__decorateClass([
|
|
2047
2066
|
r()
|
|
2048
2067
|
], JupiterDynamicForm.prototype, "_formData", 2);
|