jupiter-dynamic-forms 1.19.4 → 1.19.6

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
@@ -1732,6 +1732,8 @@ const column$1 = {
1732
1732
  noMembersAvailable: "No members available for this dimension",
1733
1733
  cancel: "Cancel",
1734
1734
  removeColumn: "Remove column",
1735
+ hideColumn: "Hide column",
1736
+ showColumn: "Double-click to show column",
1735
1737
  required: "required"
1736
1738
  };
1737
1739
  const section$1 = {
@@ -1914,6 +1916,8 @@ const column = {
1914
1916
  noMembersAvailable: "Geen leden beschikbaar voor deze dimensie",
1915
1917
  cancel: "Annuleren",
1916
1918
  removeColumn: "Kolom verwijderen",
1919
+ hideColumn: "Kolom verbergen",
1920
+ showColumn: "Dubbelklik om kolom te tonen",
1917
1921
  required: "verplicht"
1918
1922
  };
1919
1923
  const section = {
@@ -2232,7 +2236,7 @@ class DraftStorageService {
2232
2236
  /**
2233
2237
  * Create metadata snapshot from current form state
2234
2238
  */
2235
- createMetadataSnapshot(periodStartDate, periodEndDate, language, selectedRoleIds, allSections, typedMemberData, periodPreferences, periodData, unitData, reportingLanguage = "en", repeatCounts, decimalsData, roleCompletedStates) {
2239
+ createMetadataSnapshot(periodStartDate, periodEndDate, language, selectedRoleIds, allSections, typedMemberData, periodPreferences, periodData, unitData, reportingLanguage = "en", repeatCounts, decimalsData, roleCompletedStates, hiddenColumns) {
2236
2240
  return {
2237
2241
  periodStartDate,
2238
2242
  periodEndDate,
@@ -2248,6 +2252,7 @@ class DraftStorageService {
2248
2252
  decimalsData,
2249
2253
  repeatCounts,
2250
2254
  roleCompletedStates,
2255
+ hiddenColumns,
2251
2256
  schemaVersion: this.STORAGE_VERSION
2252
2257
  };
2253
2258
  }
@@ -4757,6 +4762,7 @@ let JupiterConceptTree = class extends LitElement {
4757
4762
  this.showAddButton = false;
4758
4763
  this.showRemoveButton = false;
4759
4764
  this.language = "en";
4765
+ this.rowFocused = false;
4760
4766
  this._expanded = true;
4761
4767
  }
4762
4768
  connectedCallback() {
@@ -4934,7 +4940,7 @@ let JupiterConceptTree = class extends LitElement {
4934
4940
  const isAbstract = this.concept.abstract || false;
4935
4941
  return html`
4936
4942
  <!-- Concept Name Cell (Left Column) -->
4937
- <td class="concept-name-cell ${isAbstract ? "abstract" : hasChildren ? "" : "leaf"}">
4943
+ <td class="concept-name-cell ${isAbstract ? "abstract" : hasChildren ? "" : "leaf"} ${this.rowFocused ? "row-focused" : ""}">
4938
4944
  <div class="concept-content" style="--level: ${level}">
4939
4945
  <div class="concept-indent"></div>
4940
4946
  <div class="concept-toggle ${hasChildren ? this._expanded ? "expanded" : "" : "no-children"}"
@@ -4965,12 +4971,15 @@ let JupiterConceptTree = class extends LitElement {
4965
4971
  <!-- Input Field Cells (Period Columns) - Only for non-abstract concepts -->
4966
4972
  ${this.columns.map((column2) => {
4967
4973
  var _a, _b, _c, _d, _e;
4974
+ if (column2.hidden) {
4975
+ return html`<td class="field-cell hidden-column"></td>`;
4976
+ }
4968
4977
  const field2 = this._getFieldForColumn(column2.id);
4969
4978
  const shouldShowField = !isAbstract && field2;
4970
4979
  const storedUnit = (_b = (_a = this.unitData) == null ? void 0 : _a[this.concept.id]) == null ? void 0 : _b[column2.id];
4971
4980
  const storedDecimals = (_d = (_c = this.decimalsData) == null ? void 0 : _c[this.concept.id]) == null ? void 0 : _d[column2.id];
4972
4981
  return html`
4973
- <td class="field-cell ${!shouldShowField ? "empty" : ""} ${isAbstract ? "abstract-row" : ""} ${this.highlightType && column2.id === this.highlightColumnId ? "highlight-" + this.highlightType : ""} ${((_e = this.calculationErrorKeys) == null ? void 0 : _e.has(`${this.concept.id}__${column2.id}`)) ? "calc-error" : ""}">
4982
+ <td class="field-cell ${!shouldShowField ? "empty" : ""} ${isAbstract ? "abstract-row" : ""} ${this.highlightType && column2.id === this.highlightColumnId ? "highlight-" + this.highlightType : ""} ${((_e = this.calculationErrorKeys) == null ? void 0 : _e.has(`${this.concept.id}__${column2.id}`)) ? "calc-error" : ""} ${this.rowFocused ? "row-focused" : ""}">
4974
4983
  ${shouldShowField ? html`
4975
4984
  <jupiter-form-field
4976
4985
  .field="${field2}"
@@ -5122,6 +5131,15 @@ JupiterConceptTree.styles = css`
5122
5131
  background: var(--bg-color-2, var(--jupiter-empty-cell-background, #f8f9fa));
5123
5132
  }
5124
5133
 
5134
+ .field-cell.hidden-column {
5135
+ width: 10px;
5136
+ min-width: 10px;
5137
+ max-width: 10px;
5138
+ padding: 0;
5139
+ overflow: hidden;
5140
+ background: var(--jupiter-border-color, #ddd);
5141
+ }
5142
+
5125
5143
  .field-cell.abstract-row {
5126
5144
  background: var(--bg-color-2, var(--jupiter-abstract-cell-background, #f0f2f5));
5127
5145
  }
@@ -5176,6 +5194,18 @@ JupiterConceptTree.styles = css`
5176
5194
  box-shadow: inset 0 0 0 2px var(--jupiter-error-color, #d32f2f);
5177
5195
  }
5178
5196
 
5197
+ /* Row-level highlight while a field in this row has focus. Applied to every
5198
+ cell so the row stays identifiable even after the user scrolls the table
5199
+ horizontally away from the focused input. */
5200
+ .concept-name-cell.row-focused,
5201
+ .field-cell.row-focused {
5202
+ background: var(--jupiter-row-focus-background, rgba(25, 118, 210, 0.14));
5203
+ }
5204
+
5205
+ .concept-name-cell.row-focused {
5206
+ box-shadow: inset 3px 0 0 0 var(--jupiter-primary-color, #1976d2);
5207
+ }
5208
+
5179
5209
  .concept-info-btn {
5180
5210
  flex-shrink: 0;
5181
5211
  width: 22px;
@@ -5296,6 +5326,9 @@ __decorateClass$5([
5296
5326
  __decorateClass$5([
5297
5327
  n2({ type: String })
5298
5328
  ], JupiterConceptTree.prototype, "language", 2);
5329
+ __decorateClass$5([
5330
+ n2({ type: Boolean })
5331
+ ], JupiterConceptTree.prototype, "rowFocused", 2);
5299
5332
  __decorateClass$5([
5300
5333
  r()
5301
5334
  ], JupiterConceptTree.prototype, "_expanded", 2);
@@ -5993,10 +6026,12 @@ let JupiterFormSection = class extends LitElement {
5993
6026
  this._insertAfterColumnId = null;
5994
6027
  this._boundFieldBlur = (e2) => {
5995
6028
  this._clearHighlights();
6029
+ this._focusedConceptId = null;
5996
6030
  };
5997
6031
  this._expandedConcepts = /* @__PURE__ */ new Set();
5998
6032
  this._allTreeExpanded = false;
5999
6033
  this._highlightMap = /* @__PURE__ */ new Map();
6034
+ this._focusedConceptId = null;
6000
6035
  this._calculationErrorKeys = /* @__PURE__ */ new Set();
6001
6036
  this._totalChildrenMap = /* @__PURE__ */ new Map();
6002
6037
  this._memberParentMap = /* @__PURE__ */ new Map();
@@ -6089,6 +6124,25 @@ let JupiterFormSection = class extends LitElement {
6089
6124
  bubbles: true
6090
6125
  }));
6091
6126
  }
6127
+ _handleHideColumn(columnId) {
6128
+ this._openMenuColumnId = null;
6129
+ this.dispatchEvent(new CustomEvent("column-hide", {
6130
+ detail: {
6131
+ columnId,
6132
+ sectionId: this.section.id
6133
+ },
6134
+ bubbles: true
6135
+ }));
6136
+ }
6137
+ _handleShowColumn(columnId) {
6138
+ this.dispatchEvent(new CustomEvent("column-show", {
6139
+ detail: {
6140
+ columnId,
6141
+ sectionId: this.section.id
6142
+ },
6143
+ bubbles: true
6144
+ }));
6145
+ }
6092
6146
  _toggleColumnMenu(columnId, event) {
6093
6147
  event.stopPropagation();
6094
6148
  this._openMenuColumnId = this._openMenuColumnId === columnId ? null : columnId;
@@ -6336,6 +6390,7 @@ let JupiterFormSection = class extends LitElement {
6336
6390
  const columnId = (_b = event.detail) == null ? void 0 : _b.columnId;
6337
6391
  if (!conceptId || !columnId)
6338
6392
  return;
6393
+ this._focusedConceptId = conceptId;
6339
6394
  const newMap = /* @__PURE__ */ new Map();
6340
6395
  const isSelfTotal = this._totalChildrenMap.has(conceptId);
6341
6396
  if (isSelfTotal) {
@@ -6423,6 +6478,7 @@ let JupiterFormSection = class extends LitElement {
6423
6478
  .showRemoveButton="${opts.showRemove || false}"
6424
6479
  .highlightType="${(_a2 = this._highlightMap.get(instanceConcept.id)) == null ? void 0 : _a2.type}"
6425
6480
  .highlightColumnId="${(_b = this._highlightMap.get(instanceConcept.id)) == null ? void 0 : _b.columnId}"
6481
+ .rowFocused="${this._focusedConceptId === instanceConcept.id}"
6426
6482
  .calculationErrorKeys="${this._calculationErrorKeys}"
6427
6483
  @field-change="${this._handleFieldChange}"
6428
6484
  @field-focus="${this._handleFieldFocusForHighlight}"
@@ -6501,14 +6557,20 @@ let JupiterFormSection = class extends LitElement {
6501
6557
  <th class="header-cell concept-column"></th>
6502
6558
  ${this.columns.map((column2) => {
6503
6559
  var _a, _b, _c;
6504
- return html`
6560
+ return column2.hidden ? html`
6561
+ <th
6562
+ class="header-cell hidden-column"
6563
+ title="${I18n.t("column.showColumn")}"
6564
+ @dblclick="${() => this._handleShowColumn(column2.id)}"
6565
+ ></th>
6566
+ ` : html`
6505
6567
  <th class="header-cell ${column2.removable ? "removable" : ""}">
6506
6568
  <div class="column-header-content">
6507
6569
  <div class="column-title">
6508
6570
  ${column2.title}
6509
6571
  ${column2.description ? html`<div style="font-weight: normal; font-size: 12px; color: var(--jupiter-text-secondary, #666);">${column2.description}</div>` : ""}
6510
6572
  </div>
6511
-
6573
+
6512
6574
  <!-- Typed member input fields in column header -->
6513
6575
  ${((_a = column2.dimensionData) == null ? void 0 : _a.hasTypedMembers) ? html`
6514
6576
  <div class="typed-members-header">
@@ -6532,7 +6594,7 @@ let JupiterFormSection = class extends LitElement {
6532
6594
  </div>
6533
6595
  ` : ""}
6534
6596
  </div>
6535
-
6597
+
6536
6598
  <!-- Column menu icon (hidden in readonly mode) -->
6537
6599
  ${this.mode !== "readonly" ? html`
6538
6600
  <div
@@ -6561,6 +6623,17 @@ let JupiterFormSection = class extends LitElement {
6561
6623
  ${I18n.t("column.removeColumn")}
6562
6624
  </button>
6563
6625
  ` : ""}
6626
+ ${!column2.removable && this.columns.filter((c2) => !c2.hidden).length > 1 ? html`
6627
+ <button
6628
+ class="column-context-menu-item remove"
6629
+ @click="${(e2) => {
6630
+ e2.stopPropagation();
6631
+ this._handleHideColumn(column2.id);
6632
+ }}"
6633
+ >
6634
+ ${I18n.t("column.hideColumn")}
6635
+ </button>
6636
+ ` : ""}
6564
6637
  </div>
6565
6638
  ` : ""}
6566
6639
  ` : ""}
@@ -6734,6 +6807,20 @@ JupiterFormSection.styles = css`
6734
6807
  position: relative;
6735
6808
  }
6736
6809
 
6810
+ .header-cell.hidden-column {
6811
+ width: 10px;
6812
+ min-width: 10px;
6813
+ max-width: 10px;
6814
+ padding: 0;
6815
+ overflow: hidden;
6816
+ cursor: pointer;
6817
+ background: var(--jupiter-border-color, #ddd);
6818
+ }
6819
+
6820
+ .header-cell.hidden-column:hover {
6821
+ background: var(--jupiter-text-secondary, #999);
6822
+ }
6823
+
6737
6824
  .column-menu-icon {
6738
6825
  position: absolute;
6739
6826
  top: 8px;
@@ -6960,6 +7047,9 @@ __decorateClass$3([
6960
7047
  __decorateClass$3([
6961
7048
  r()
6962
7049
  ], JupiterFormSection.prototype, "_highlightMap", 2);
7050
+ __decorateClass$3([
7051
+ r()
7052
+ ], JupiterFormSection.prototype, "_focusedConceptId", 2);
6963
7053
  __decorateClass$3([
6964
7054
  r()
6965
7055
  ], JupiterFormSection.prototype, "_calculationErrorKeys", 2);
@@ -8997,6 +9087,7 @@ let JupiterDynamicForm = class extends LitElement {
8997
9087
  this._typedMemberData = {};
8998
9088
  this._preservedTypedMemberData = {};
8999
9089
  this._repeatCounts = {};
9090
+ this._hiddenColumnIds = /* @__PURE__ */ new Map();
9000
9091
  this._columns = [];
9001
9092
  this._errors = [];
9002
9093
  this._touched = /* @__PURE__ */ new Set();
@@ -9750,7 +9841,9 @@ let JupiterDynamicForm = class extends LitElement {
9750
9841
  this._unitData,
9751
9842
  this.reportingLanguage,
9752
9843
  this._repeatCounts,
9753
- this._decimalsData
9844
+ this._decimalsData,
9845
+ void 0,
9846
+ this._getHiddenColumnsForMetadata()
9754
9847
  );
9755
9848
  this._draftStorageService.saveDraft(currentFormData, currentMetadata);
9756
9849
  console.log("✅ Current form data saved to draft storage with NEW preferences");
@@ -10326,6 +10419,52 @@ let JupiterDynamicForm = class extends LitElement {
10326
10419
  bubbles: true
10327
10420
  }));
10328
10421
  }
10422
+ _handleColumnHide(event) {
10423
+ const { columnId, sectionId } = event.detail;
10424
+ if (!sectionId || !columnId)
10425
+ return;
10426
+ if (!this._hiddenColumnIds.has(sectionId)) {
10427
+ this._hiddenColumnIds.set(sectionId, /* @__PURE__ */ new Set());
10428
+ }
10429
+ this._hiddenColumnIds.get(sectionId).add(columnId);
10430
+ this._dirty = true;
10431
+ this.requestUpdate();
10432
+ this.dispatchEvent(new CustomEvent("column-hide", {
10433
+ detail: { columnId, sectionId },
10434
+ bubbles: true
10435
+ }));
10436
+ }
10437
+ _handleColumnShow(event) {
10438
+ var _a;
10439
+ const { columnId, sectionId } = event.detail;
10440
+ if (!sectionId || !columnId)
10441
+ return;
10442
+ (_a = this._hiddenColumnIds.get(sectionId)) == null ? void 0 : _a.delete(columnId);
10443
+ this._dirty = true;
10444
+ this.requestUpdate();
10445
+ this.dispatchEvent(new CustomEvent("column-show", {
10446
+ detail: { columnId, sectionId },
10447
+ bubbles: true
10448
+ }));
10449
+ }
10450
+ _getColumnsWithHiddenFlags(section2) {
10451
+ const columns = section2.columns || this._columns;
10452
+ const hiddenIds = this._hiddenColumnIds.get(section2.id);
10453
+ if (!hiddenIds || hiddenIds.size === 0)
10454
+ return columns;
10455
+ return columns.map((col) => hiddenIds.has(col.id) ? { ...col, hidden: true } : col);
10456
+ }
10457
+ _getHiddenColumnsForMetadata() {
10458
+ if (this._hiddenColumnIds.size === 0)
10459
+ return void 0;
10460
+ const result = {};
10461
+ this._hiddenColumnIds.forEach((ids, sectionId) => {
10462
+ if (ids.size > 0) {
10463
+ result[sectionId] = Array.from(ids);
10464
+ }
10465
+ });
10466
+ return Object.keys(result).length > 0 ? result : void 0;
10467
+ }
10329
10468
  _handleColumnAddRequest(event) {
10330
10469
  const { sectionId, columnRequest, insertAfterColumnId } = event.detail;
10331
10470
  this._addColumnFromRequest(columnRequest, sectionId, insertAfterColumnId);
@@ -10761,7 +10900,8 @@ let JupiterDynamicForm = class extends LitElement {
10761
10900
  this.reportingLanguage,
10762
10901
  this._repeatCounts,
10763
10902
  this._decimalsData,
10764
- roleCompletedStates
10903
+ roleCompletedStates,
10904
+ this._getHiddenColumnsForMetadata()
10765
10905
  );
10766
10906
  const draftPayloadSnapshot = JSON.stringify({
10767
10907
  draftData,
@@ -10895,6 +11035,14 @@ let JupiterDynamicForm = class extends LitElement {
10895
11035
  this._roleCompletedStates = new Map(Object.entries(metadata.roleCompletedStates));
10896
11036
  console.log("🔄 Restored role completed states:", Object.keys(metadata.roleCompletedStates).length, "roles");
10897
11037
  }
11038
+ if (metadata.hiddenColumns) {
11039
+ this._hiddenColumnIds = new Map(
11040
+ Object.entries(metadata.hiddenColumns).map(
11041
+ ([sectionId, columnIds]) => [sectionId, new Set(columnIds)]
11042
+ )
11043
+ );
11044
+ console.log("🔄 Restored hidden columns for", this._hiddenColumnIds.size, "sections");
11045
+ }
10898
11046
  if (metadata.periodPreferences) {
10899
11047
  if (this._skipPeriodPreferencesRestore) {
10900
11048
  console.log("⏭️ Skipping period preferences restoration - using new filter selections");
@@ -12532,7 +12680,7 @@ let JupiterDynamicForm = class extends LitElement {
12532
12680
  <jupiter-form-section
12533
12681
  section-id="${section2.id}"
12534
12682
  .section="${section2}"
12535
- .columns="${section2.columns || this._columns}"
12683
+ .columns="${this._getColumnsWithHiddenFlags(section2)}"
12536
12684
  .datatypes="${section2.datatypes || ((_a = this.xbrlInput) == null ? void 0 : _a.datatypes)}"
12537
12685
  .formData="${this._formData}"
12538
12686
  .periodData="${this._periodData}"
@@ -12562,6 +12710,8 @@ let JupiterDynamicForm = class extends LitElement {
12562
12710
  @section-expand="${this._handleSectionExpand}"
12563
12711
  @concept-expand="${this._handleConceptExpand}"
12564
12712
  @column-remove="${this._handleColumnRemove}"
12713
+ @column-hide="${this._handleColumnHide}"
12714
+ @column-show="${this._handleColumnShow}"
12565
12715
  @column-add-request="${this._handleColumnAddRequest}"
12566
12716
  ></jupiter-form-section>
12567
12717
  `;
@@ -12676,7 +12826,7 @@ let JupiterDynamicForm = class extends LitElement {
12676
12826
  <jupiter-form-section
12677
12827
  section-id="${activeSection.id}"
12678
12828
  .section="${activeSection}"
12679
- .columns="${activeSection.columns || this._columns}"
12829
+ .columns="${this._getColumnsWithHiddenFlags(activeSection)}"
12680
12830
  .datatypes="${activeSection.datatypes || ((_a = this.xbrlInput) == null ? void 0 : _a.datatypes)}"
12681
12831
  .formData="${this._formData}"
12682
12832
  .periodData="${this._periodData}"
@@ -12706,6 +12856,8 @@ let JupiterDynamicForm = class extends LitElement {
12706
12856
  @section-expand="${this._handleSectionExpand}"
12707
12857
  @concept-expand="${this._handleConceptExpand}"
12708
12858
  @column-remove="${this._handleColumnRemove}"
12859
+ @column-hide="${this._handleColumnHide}"
12860
+ @column-show="${this._handleColumnShow}"
12709
12861
  @column-add-request="${this._handleColumnAddRequest}"
12710
12862
  ></jupiter-form-section>
12711
12863
  <div class="role-completion-row">
@@ -14101,6 +14253,9 @@ __decorateClass([
14101
14253
  __decorateClass([
14102
14254
  r()
14103
14255
  ], JupiterDynamicForm.prototype, "_repeatCounts", 2);
14256
+ __decorateClass([
14257
+ r()
14258
+ ], JupiterDynamicForm.prototype, "_hiddenColumnIds", 2);
14104
14259
  __decorateClass([
14105
14260
  r()
14106
14261
  ], JupiterDynamicForm.prototype, "_columns", 2);