jupiter-dynamic-forms 1.8.1 → 1.8.2

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.mjs CHANGED
@@ -564,7 +564,10 @@ class XBRLFormBuilder {
564
564
  const presentationData = xbrlInput.presentation[0];
565
565
  const hypercubeData = (_a = xbrlInput.hypercubes) == null ? void 0 : _a[0];
566
566
  const sections = [];
567
- presentationData.roles.forEach((role) => {
567
+ const sortedRoles = [...presentationData.roles].sort((a2, b2) => {
568
+ return a2.role.localeCompare(b2.role);
569
+ });
570
+ sortedRoles.forEach((role) => {
568
571
  const section = this.buildSectionFromRole(role, periodStartDate, periodEndDate, hypercubeData);
569
572
  this.assignFieldColumnIds(section);
570
573
  sections.push(section);
@@ -588,20 +591,8 @@ class XBRLFormBuilder {
588
591
  nonAbstractConcepts.filter((concept) => concept.periodType).map((concept) => concept.periodType)
589
592
  );
590
593
  const hypercubeRole = hypercubeData == null ? void 0 : hypercubeData.roles.find((hr) => hr.roleId === role.id);
591
- if (hypercubeRole) {
592
- console.log(`🏷️ Found matching hypercube role "${role.id}"`);
593
- } else {
594
- console.log(`❌ No hypercube role found for "${role.id}"`);
595
- }
596
594
  const columns = this.generateDefaultColumnsForRole(role, periodStartDate || "2025-01-01", periodEndDate || "2025-12-31", hypercubeRole, nonAbstractConcepts, periodTypes);
597
595
  const availableColumnIds = columns.map((col) => col.id);
598
- console.log(`📋 Available column IDs for role "${role.id}":`, availableColumnIds);
599
- if (availableColumnIds.some((id) => id.includes("multi_"))) {
600
- console.log(`🔍 [DEBUG] Multi-dimensional role "${role.role}" - Total columns generated: ${columns.length}`);
601
- columns.forEach((col, index) => {
602
- console.log(` Column ${index}: id=${col.id}, title=${col.title}, type=${col.type}`);
603
- });
604
- }
605
596
  const roleInfo = { periodTypes, availableColumnIds };
606
597
  const conceptTrees = [];
607
598
  if ((_a = role.presentationLinkbase) == null ? void 0 : _a.concepts) {
@@ -836,14 +827,12 @@ class XBRLFormBuilder {
836
827
  * Generate default columns based on period types of non-abstract concepts in a role
837
828
  */
838
829
  static generateDefaultColumnsForRole(role, periodStartDate, periodEndDate, hypercubeRole, nonAbstractConcepts, rolePeriodTypes) {
839
- var _a, _b, _c;
830
+ var _a, _b;
840
831
  const concepts = nonAbstractConcepts || this.getAllNonAbstractConcepts(role);
841
832
  const periodTypes = rolePeriodTypes || new Set(
842
833
  concepts.filter((concept) => concept.periodType).map((concept) => concept.periodType)
843
834
  );
844
- console.log(`📊 Analyzing role "${role.role}" with ${concepts.length} non-abstract concepts`);
845
835
  if (concepts.length === 0) {
846
- console.log("📊 No non-abstract concepts found, using default column");
847
836
  return [{
848
837
  id: "default",
849
838
  title: "Value",
@@ -856,26 +845,18 @@ class XBRLFormBuilder {
856
845
  let dimensionColumns = [];
857
846
  if (((_a = hypercubeRole == null ? void 0 : hypercubeRole.items) == null ? void 0 : _a.length) === 1) {
858
847
  const item = hypercubeRole.items[0];
859
- console.log(`🔍 Processing hypercube item for role "${role.role}":`, {
860
- itemId: item.id,
861
- conceptIds: ((_b = item.conceptIds) == null ? void 0 : _b.length) || 0,
862
- dimensions: item.dimensions.length
863
- });
864
848
  if (item.dimensions.length === 1) {
865
849
  dimensionColumns = this.generateSingleDimensionColumns(item.dimensions[0], periodStartDate, periodEndDate, periodTypes);
866
850
  } else if (item.dimensions.length > 1) {
867
851
  dimensionColumns = this.generateMultiDimensionColumns(item.dimensions, periodStartDate, periodEndDate, periodTypes);
868
852
  }
869
- } else if (((_c = hypercubeRole == null ? void 0 : hypercubeRole.items) == null ? void 0 : _c.length) && hypercubeRole.items.length > 1) {
870
- console.log(`⚠️ Multiple items found (${hypercubeRole.items.length}), skipping for now`);
871
- }
872
- console.log(`📅 Found period types: ${Array.from(periodTypes).join(", ")}`);
853
+ } else if (((_b = hypercubeRole == null ? void 0 : hypercubeRole.items) == null ? void 0 : _b.length) && hypercubeRole.items.length > 1)
854
+ ;
873
855
  const columns = [];
874
856
  if (dimensionColumns.length > 0) {
875
857
  columns.push(...dimensionColumns);
876
858
  } else {
877
859
  if (periodTypes.size === 0) {
878
- console.log("📅 No period types found, using default column");
879
860
  columns.push({
880
861
  id: "default",
881
862
  title: "Value",
@@ -885,7 +866,6 @@ class XBRLFormBuilder {
885
866
  removable: false
886
867
  });
887
868
  } else if (periodTypes.size === 1 && periodTypes.has("instant")) {
888
- console.log("📅 All concepts are instant type, creating single column");
889
869
  columns.push({
890
870
  id: "instant",
891
871
  title: `Current`,
@@ -895,7 +875,6 @@ class XBRLFormBuilder {
895
875
  removable: false
896
876
  });
897
877
  } else if (periodTypes.size === 1 && periodTypes.has("duration")) {
898
- console.log("📅 All concepts are duration type, creating single column with period range");
899
878
  columns.push({
900
879
  id: "duration",
901
880
  title: `Current Period`,
@@ -905,7 +884,6 @@ class XBRLFormBuilder {
905
884
  removable: false
906
885
  });
907
886
  } else {
908
- console.log("📅 Mixed period types found, creating both duration and instant columns");
909
887
  columns.push({
910
888
  id: "duration",
911
889
  title: `Current Period`,
@@ -924,25 +902,15 @@ class XBRLFormBuilder {
924
902
  });
925
903
  }
926
904
  }
927
- console.log(`📊 Generated ${columns.length} columns for role "${role.role}":`, columns.map((c2) => c2.title));
928
905
  return columns;
929
906
  }
930
907
  /**
931
908
  * Generate columns for single dimension scenarios
932
909
  */
933
910
  static generateSingleDimensionColumns(dimension, periodStartDate, periodEndDate, periodTypes) {
934
- var _a, _b, _c, _d, _e;
935
- console.log(`📊 Processing single dimension:`, {
936
- id: dimension.id,
937
- conceptName: dimension.conceptName,
938
- hasMembers: !!(dimension.members && Array.isArray(dimension.members)),
939
- membersCount: ((_a = dimension.members) == null ? void 0 : _a.length) || 0,
940
- hasTypedMember: !!dimension.typedMember,
941
- typedMemberId: (_b = dimension.typedMember) == null ? void 0 : _b.id
942
- });
911
+ var _a, _b, _c;
943
912
  if (dimension.typedMember && (!dimension.members || dimension.members.length === 0)) {
944
- console.log(`🔤 Processing typed dimension: ${dimension.id} with typed member: ${dimension.typedMember.id}`);
945
- const axisLabel2 = ((_c = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _c.label) || dimension.conceptName;
913
+ const axisLabel2 = ((_a = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _a.label) || dimension.conceptName;
946
914
  const dimensionInfo2 = {
947
915
  axisId: dimension.id,
948
916
  axisLabel: axisLabel2,
@@ -950,7 +918,6 @@ class XBRLFormBuilder {
950
918
  dimensionKey: `${axisLabel2} | [Typed Input]`,
951
919
  dimensionIdKey: `${dimension.id}|[typed]`
952
920
  };
953
- console.log(`🔤 Generated typed dimension info:`, dimensionInfo2);
954
921
  const columns2 = [];
955
922
  if (periodTypes.size === 0) {
956
923
  columns2.push({
@@ -1092,24 +1059,17 @@ class XBRLFormBuilder {
1092
1059
  removable: false
1093
1060
  });
1094
1061
  }
1095
- console.log(`🔤 Generated ${columns2.length} typed dimension columns`);
1096
1062
  return columns2;
1097
1063
  }
1098
1064
  if (!dimension.members || !Array.isArray(dimension.members)) {
1099
- console.log(`⚠️ Dimension ${dimension.id} has no members defined and no typed member, skipping column generation`);
1100
1065
  return [];
1101
1066
  }
1102
- console.log(`📊 Found single dimension:`, {
1103
- id: dimension.id,
1104
- conceptName: dimension.conceptName,
1105
- membersCount: dimension.members.length
1106
- });
1107
1067
  if (dimension.members.length === 0) {
1108
1068
  return [];
1109
1069
  }
1110
- const axisLabel = ((_d = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _d.label) || dimension.conceptName;
1070
+ const axisLabel = ((_b = dimension.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _b.label) || dimension.conceptName;
1111
1071
  const firstMember = dimension.members[0];
1112
- const memberLabel = ((_e = firstMember.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _e.label) || firstMember.conceptName;
1072
+ const memberLabel = ((_c = firstMember.labels.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _c.label) || firstMember.conceptName;
1113
1073
  const dimensionInfo = {
1114
1074
  axisId: dimension.id,
1115
1075
  axisLabel,
@@ -1118,7 +1078,6 @@ class XBRLFormBuilder {
1118
1078
  dimensionKey: `${axisLabel} | ${memberLabel}`,
1119
1079
  dimensionIdKey: `${dimension.id} | ${firstMember.id}`
1120
1080
  };
1121
- console.log(`📊 Generated dimension info:`, dimensionInfo);
1122
1081
  const columns = [];
1123
1082
  if (periodTypes.size === 0) {
1124
1083
  columns.push({
@@ -1226,34 +1185,17 @@ class XBRLFormBuilder {
1226
1185
  * Generate columns for multi-dimension scenarios - creates combinations of all dimension members
1227
1186
  */
1228
1187
  static generateMultiDimensionColumns(dimensions, periodStartDate, periodEndDate, periodTypes) {
1229
- console.log(`📊 Processing ${dimensions.length} dimensions for multi-dimensional columns`);
1230
- console.log(`🔍 [DEBUG] Input dimensions:`, dimensions.map((d2) => {
1231
- var _a, _b, _c;
1232
- return {
1233
- id: d2.id,
1234
- label: (_b = (_a = d2.labels) == null ? void 0 : _a.find((l2) => l2.role === "http://www.xbrl.org/2003/role/label")) == null ? void 0 : _b.label,
1235
- membersCount: ((_c = d2.members) == null ? void 0 : _c.length) || 0,
1236
- hasTypedMember: !!d2.typedMember
1237
- };
1238
- }));
1239
- const hasTypedMembers = dimensions.some((dimension) => dimension.typedMember);
1240
- if (hasTypedMembers) {
1241
- console.log(`🔤 Found typed members in dimensions - will indicate in column headers`);
1242
- }
1188
+ dimensions.some((dimension) => dimension.typedMember);
1243
1189
  const validDimensions = dimensions.filter((dimension) => {
1244
1190
  if (dimension.typedMember) {
1245
- console.log(`🔤 Keeping typed dimension: ${dimension.id} with typed member: ${dimension.typedMember.id}`);
1246
1191
  return true;
1247
1192
  }
1248
1193
  if (dimension.members && Array.isArray(dimension.members) && dimension.members.length > 0) {
1249
- console.log(`📂 Keeping domain dimension: ${dimension.id} with ${dimension.members.length} members`);
1250
1194
  return true;
1251
1195
  }
1252
- console.log(`⚠️ Skipping dimension ${dimension.id} - no members or typed member defined`);
1253
1196
  return false;
1254
1197
  });
1255
1198
  if (validDimensions.length === 0) {
1256
- console.log(`⚠️ No valid dimensions with members found, skipping multi-dimensional column generation`);
1257
1199
  return [];
1258
1200
  }
1259
1201
  const dimensionInfos = validDimensions.map((dimension) => {
@@ -1286,27 +1228,11 @@ class XBRLFormBuilder {
1286
1228
  };
1287
1229
  });
1288
1230
  const combinations = this.generateDimensionCombinations(dimensionInfos);
1289
- console.log(`📊 Generated ${combinations.length} dimension combinations`);
1290
- console.log(`🔍 [DEBUG] Generated combinations:`, combinations.map((combo) => ({
1291
- memberLabels: combo.map((c2) => c2.memberLabel),
1292
- axisIds: combo.map((c2) => c2.axisId),
1293
- memberIds: combo.map((c2) => c2.memberId)
1294
- })));
1295
1231
  const columns = [];
1296
1232
  combinations.forEach((combination, index) => {
1297
- var _a, _b;
1298
1233
  const columnTitle = combination.map((c2) => c2.memberLabel).join(" | ");
1299
1234
  const typedMembers = combination.filter((c2) => c2.isTyped);
1300
1235
  const domainMembers = combination.filter((c2) => !c2.isTyped);
1301
- console.log(`🔍 [Column ${index}] Combination analysis:`, {
1302
- totalMembers: combination.length,
1303
- typedMembers: typedMembers.length,
1304
- domainMembers: domainMembers.length,
1305
- hasTypedMembers: typedMembers.length > 0,
1306
- columnTitle,
1307
- memberLabels: combination.map((c2) => c2.memberLabel),
1308
- memberIds: combination.map((c2) => c2.memberId)
1309
- });
1310
1236
  const dimensionData = {
1311
1237
  dimensionId: `multi_${index}`,
1312
1238
  memberValue: columnTitle,
@@ -1333,13 +1259,6 @@ class XBRLFormBuilder {
1333
1259
  ...typedMembers.map((c2) => `${c2.axisId}|[typed]`)
1334
1260
  ].join("::")
1335
1261
  };
1336
- console.log(`🔍 [Column ${index}] Final dimension data:`, {
1337
- dimensionId: dimensionData.dimensionId,
1338
- memberLabel: dimensionData.memberLabel,
1339
- dimensionIdKey: dimensionData.dimensionIdKey,
1340
- combinationsCount: (_a = dimensionData.combinations) == null ? void 0 : _a.length,
1341
- typedMembersCount: (_b = dimensionData.typedMembers) == null ? void 0 : _b.length
1342
- });
1343
1262
  if (periodTypes.size === 0 || periodTypes.size === 1 && periodTypes.has("duration")) {
1344
1263
  columns.push({
1345
1264
  id: `duration_${index}`,
@@ -1393,7 +1312,6 @@ class XBRLFormBuilder {
1393
1312
  });
1394
1313
  }
1395
1314
  });
1396
- console.log(`📊 Generated ${columns.length} multi-dimensional columns`);
1397
1315
  return columns;
1398
1316
  }
1399
1317
  /**
@@ -2110,9 +2028,8 @@ let JupiterAddColumnDialog = class extends LitElement {
2110
2028
  if (changedProperties.has("open") && this.open) {
2111
2029
  this._resetForm();
2112
2030
  }
2113
- if (changedProperties.has("availableDimensions")) {
2114
- console.log(`🎯 Add Column Dialog received ${this.availableDimensions.length} dimensions:`, this.availableDimensions.map((d2) => d2.axisLabel));
2115
- }
2031
+ if (changedProperties.has("availableDimensions"))
2032
+ ;
2116
2033
  }
2117
2034
  connectedCallback() {
2118
2035
  super.connectedCallback();
@@ -2230,7 +2147,6 @@ let JupiterAddColumnDialog = class extends LitElement {
2230
2147
  isTyped: false
2231
2148
  };
2232
2149
  this._selectedDimensions.set(dimension.id, selection);
2233
- console.log(`🎯 Auto-selected single member: ${dimension.axisLabel} -> ${member.label}`);
2234
2150
  } else if (dimension.typedMember && (!dimension.members || dimension.members.length === 0)) {
2235
2151
  const selection = {
2236
2152
  axisId: dimension.id,
@@ -2239,7 +2155,6 @@ let JupiterAddColumnDialog = class extends LitElement {
2239
2155
  // Note: typedValue will be entered in column header, not here
2240
2156
  };
2241
2157
  this._selectedDimensions.set(dimension.id, selection);
2242
- console.log(`🎯 Auto-selected typed dimension: ${dimension.axisLabel} (value will be entered in column header)`);
2243
2158
  }
2244
2159
  });
2245
2160
  }
@@ -2732,12 +2647,6 @@ let JupiterFormSection = class extends LitElement {
2732
2647
  }
2733
2648
  _determinePeriodType() {
2734
2649
  const nonAbstractConcepts = this._getAllNonAbstractConcepts(this.section.concepts);
2735
- console.log(`🔍 Section ${this.section.id} (${this.section.title}): Found ${nonAbstractConcepts.length} non-abstract concepts`);
2736
- console.log(`📝 All concepts in section:`, this.section.concepts.map((c2) => ({
2737
- name: c2.name,
2738
- abstract: c2.abstract,
2739
- periodType: c2.periodType
2740
- })));
2741
2650
  if (nonAbstractConcepts.length === 0) {
2742
2651
  this._sectionPeriodType = "duration";
2743
2652
  console.log(`📊 Section ${this.section.id}: No concepts, defaulting to duration`);
@@ -3415,11 +3324,13 @@ let JupiterFilterRolesDialog = class extends LitElement {
3415
3324
  }
3416
3325
  _updateFilteredRoles() {
3417
3326
  if (!this._searchQuery.trim()) {
3418
- this._filteredRoles = [...this.availableRoles];
3327
+ this._filteredRoles = [...this.availableRoles].sort((a2, b2) => {
3328
+ return a2.title.localeCompare(b2.title);
3329
+ });
3419
3330
  return;
3420
3331
  }
3421
3332
  const query = this._searchQuery.toLowerCase().trim();
3422
- this._filteredRoles = this.availableRoles.filter((role) => {
3333
+ const filtered = this.availableRoles.filter((role) => {
3423
3334
  var _a;
3424
3335
  const titleMatch = role.title.toLowerCase().includes(query);
3425
3336
  const idMatch = role.id.toLowerCase().includes(query);
@@ -3427,6 +3338,9 @@ let JupiterFilterRolesDialog = class extends LitElement {
3427
3338
  const uriMatch = this._searchInRoleURI(role, query);
3428
3339
  return titleMatch || idMatch || descriptionMatch || uriMatch;
3429
3340
  });
3341
+ this._filteredRoles = filtered.sort((a2, b2) => {
3342
+ return a2.title.localeCompare(b2.title);
3343
+ });
3430
3344
  }
3431
3345
  _searchInRoleURI(role, query) {
3432
3346
  var _a;
@@ -4032,16 +3946,12 @@ let JupiterDynamicForm = class extends LitElement {
4032
3946
  console.log("✅ Generated schema with sections:", this._currentSchema.sections.length);
4033
3947
  this._allSections = [...this._currentSchema.sections];
4034
3948
  if (this._selectedRoleIds.length === 0) {
4035
- if (this._allSections.length > 10) {
4036
- this._selectedRoleIds = [];
4037
- this._showFilterDialog = true;
4038
- this._currentSchema = {
4039
- ...this._currentSchema,
4040
- sections: []
4041
- };
4042
- } else {
4043
- this._selectedRoleIds = this._allSections.map((section) => section.id);
4044
- }
3949
+ this._selectedRoleIds = [];
3950
+ this._showFilterDialog = true;
3951
+ this._currentSchema = {
3952
+ ...this._currentSchema,
3953
+ sections: []
3954
+ };
4045
3955
  }
4046
3956
  this._applyRoleFilter();
4047
3957
  this._columns = [
@@ -4186,7 +4096,7 @@ let JupiterDynamicForm = class extends LitElement {
4186
4096
  }
4187
4097
  }
4188
4098
  _shouldShowFilterButton() {
4189
- return this._allSections.length > 10;
4099
+ return true;
4190
4100
  }
4191
4101
  _handleFilterRolesClick() {
4192
4102
  this._showFilterDialog = true;
@@ -4331,7 +4241,6 @@ let JupiterDynamicForm = class extends LitElement {
4331
4241
  console.log("❌ No hypercubes data available");
4332
4242
  return [];
4333
4243
  }
4334
- console.log(`📊 Available hypercube roles:`, this.xbrlInput.hypercubes[0].roles.map((r2) => r2.roleId));
4335
4244
  const hypercubeRole = this.xbrlInput.hypercubes[0].roles.find((hr) => hr.roleId === sectionId);
4336
4245
  if (!((_c = hypercubeRole == null ? void 0 : hypercubeRole.items) == null ? void 0 : _c.length)) {
4337
4246
  console.log(`❌ No hypercube items found for role: ${sectionId}`);
@@ -4628,23 +4537,7 @@ let JupiterDynamicForm = class extends LitElement {
4628
4537
  this._submitted = true;
4629
4538
  this._validateForm();
4630
4539
  const submissionData = this._generateSubmissionData();
4631
- console.log("📊 Generated submission data:", {
4632
- formData: this._formData,
4633
- submissionData,
4634
- submissionDataCount: submissionData.length,
4635
- valid: this._valid,
4636
- errors: this._errors
4637
- });
4638
- submissionData.forEach((entry, index) => {
4639
- console.log(`📋 Submission Entry ${index + 1}:`, {
4640
- conceptId: entry.conceptId,
4641
- value: entry.value,
4642
- period: entry.period,
4643
- dimension: entry.dimension,
4644
- typedMembers: entry.typedMembers,
4645
- hasTypedMembers: !!(entry.typedMembers && Object.keys(entry.typedMembers).length > 0)
4646
- });
4647
- });
4540
+ console.log("📊 Form Submission Data:", JSON.stringify(submissionData, null, 2));
4648
4541
  this.dispatchEvent(new CustomEvent("form-submit", {
4649
4542
  detail: {
4650
4543
  data: this._formData,
@@ -5040,7 +4933,7 @@ let JupiterDynamicForm = class extends LitElement {
5040
4933
  ` : ""}
5041
4934
 
5042
4935
  <!-- Form Sections or No Selection Message -->
5043
- ${schema.sections.length === 0 && this._allSections.length > 10 ? html`
4936
+ ${schema.sections.length === 0 ? html`
5044
4937
  <div class="no-roles-message">
5045
4938
  <h3>No Roles Selected</h3>
5046
4939
  <p>Please use the "Filter Roles" button below to select which sections you want to work with.</p>