@ni/nimble-components 30.0.2 → 30.0.4

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.
@@ -16333,7 +16333,7 @@
16333
16333
 
16334
16334
  /**
16335
16335
  * Do not edit directly
16336
- * Generated on Wed, 17 Jul 2024 17:49:16 GMT
16336
+ * Generated on Wed, 17 Jul 2024 21:04:43 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -65282,12 +65282,21 @@ focus outline in that case.
65282
65282
  grid-template-columns: var(--ni-private-table-row-grid-columns) auto;
65283
65283
  }
65284
65284
 
65285
+ .collapse-all-button-container {
65286
+ display: flex;
65287
+ min-width: ${mediumPadding};
65288
+ }
65289
+
65285
65290
  .collapse-all-button {
65286
65291
  height: ${controlSlimHeight};
65287
65292
  margin-left: ${mediumPadding};
65288
65293
  visibility: hidden;
65289
65294
  }
65290
65295
 
65296
+ .collapse-all-button.hidden-size-reduced {
65297
+ display: none;
65298
+ }
65299
+
65291
65300
  .collapse-all-button.visible {
65292
65301
  visibility: visible;
65293
65302
  }
@@ -65650,7 +65659,7 @@ focus outline in that case.
65650
65659
  flex: 0 0 auto;
65651
65660
  }
65652
65661
 
65653
- .row-front-spacer.top-level-parent {
65662
+ .row-front-spacer.reduced-size-spacer {
65654
65663
  width: ${mediumPadding};
65655
65664
  }
65656
65665
 
@@ -65903,7 +65912,7 @@ focus outline in that case.
65903
65912
  `)}
65904
65913
  </span>
65905
65914
  `)}
65906
- <span class="row-front-spacer ${x => (x.isTopLevelParentRow ? 'top-level-parent' : '')}"></span>
65915
+ <span class="row-front-spacer ${x => (x.isTopLevelParentRow || !x.reserveCollapseSpace ? 'reduced-size-spacer' : '')}"></span>
65907
65916
  ${when(x => x.isParentRow, html `
65908
65917
  ${when(x => x.loading, html `
65909
65918
  <span class="spinner-container">
@@ -65981,6 +65990,7 @@ focus outline in that case.
65981
65990
  this.selected = false;
65982
65991
  this.hideSelection = false;
65983
65992
  this.expanded = false;
65993
+ this.reserveCollapseSpace = false;
65984
65994
  /**
65985
65995
  * @internal
65986
65996
  * */
@@ -66205,6 +66215,9 @@ focus outline in that case.
66205
66215
  __decorate$1([
66206
66216
  attr({ mode: 'boolean' })
66207
66217
  ], TableRow.prototype, "expanded", void 0);
66218
+ __decorate$1([
66219
+ attr({ attribute: 'reserve-collapse-space', mode: 'boolean' })
66220
+ ], TableRow.prototype, "reserveCollapseSpace", void 0);
66208
66221
  __decorate$1([
66209
66222
  observable
66210
66223
  ], TableRow.prototype, "dataRecord", void 0);
@@ -66547,7 +66560,7 @@ focus outline in that case.
66547
66560
  ${ref('selectionCheckbox')}
66548
66561
  ${'' /* tabindex managed dynamically by KeyboardNavigationManager */}
66549
66562
  tabindex="-1"
66550
- class="${x => `selection-checkbox ${x.selectionMode ? x.selectionMode : ''}`}"
66563
+ class="selection-checkbox"
66551
66564
  @change="${(x, c) => x.onAllRowsSelectionChange(c.event)}"
66552
66565
  title="${x => tableSelectAllLabel.getValueFor(x)}"
66553
66566
  aria-label="${x => tableSelectAllLabel.getValueFor(x)}"
@@ -66555,19 +66568,21 @@ focus outline in that case.
66555
66568
  </${checkboxTag}>
66556
66569
  </span>
66557
66570
  `)}
66558
- <${buttonTag}
66559
- ${ref('collapseAllButton')}
66560
- ${'' /* tabindex managed dynamically by KeyboardNavigationManager */}
66561
- tabindex="-1"
66562
- class="collapse-all-button ${x => `${x.showCollapseAll ? 'visible' : ''}`}"
66563
- content-hidden
66564
- appearance="${ButtonAppearance.ghost}"
66565
- title="${x => tableCollapseAllLabel.getValueFor(x)}"
66566
- @click="${x => x.handleCollapseAllRows()}"
66567
- >
66568
- <${iconTriangleTwoLinesHorizontalTag} slot="start"></${iconTriangleTwoLinesHorizontalTag}>
66569
- ${x => tableCollapseAllLabel.getValueFor(x)}
66570
- </${buttonTag}>
66571
+ <span class="collapse-all-button-container">
66572
+ <${buttonTag}
66573
+ ${ref('collapseAllButton')}
66574
+ ${'' /* tabindex managed dynamically by KeyboardNavigationManager */}
66575
+ tabindex="-1"
66576
+ class="collapse-all-button ${x => x.collapseButtonVisibility}"
66577
+ content-hidden
66578
+ appearance="${ButtonAppearance.ghost}"
66579
+ title="${x => tableCollapseAllLabel.getValueFor(x)}"
66580
+ @click="${x => x.handleCollapseAllRows()}"
66581
+ >
66582
+ <${iconTriangleTwoLinesHorizontalTag} slot="start"></${iconTriangleTwoLinesHorizontalTag}>
66583
+ ${x => tableCollapseAllLabel.getValueFor(x)}
66584
+ </${buttonTag}>
66585
+ </span>
66571
66586
  </span>
66572
66587
  <span class="column-headers-container" ${ref('columnHeadersContainer')}>
66573
66588
  ${repeat(x => x.visibleColumns, html `
@@ -66651,6 +66666,7 @@ focus outline in that case.
66651
66666
  ?selected="${(x, c) => c.parent.tableData[x.index]?.selectionState === TableRowSelectionState.selected}"
66652
66667
  ?expanded="${(x, c) => c.parent.tableData[x.index]?.isExpanded}"
66653
66668
  ?hide-selection="${(_, c) => c.parent.selectionMode !== TableRowSelectionMode.multiple}"
66669
+ ?reserve-collapse-space="${(_, c) => c.parent.canHaveCollapsibleRows}"
66654
66670
  :dataRecord="${(x, c) => c.parent.tableData[x.index]?.record}"
66655
66671
  :columns="${(_, c) => c.parent.columns}"
66656
66672
  :isParentRow="${(x, c) => c.parent.tableData[x.index]?.isParentRow}"
@@ -68106,29 +68122,31 @@ focus outline in that case.
68106
68122
  class MultiSelectionManager extends SelectionManagerBase {
68107
68123
  handleRowSelectionToggle(rowState, isSelecting, shiftKey) {
68108
68124
  if (shiftKey) {
68109
- if (this.tryUpdateRangeSelection(rowState.id)) {
68125
+ if (this.tryUpdateRangeSelection(rowState.id, true)) {
68110
68126
  // Made a range selection
68111
68127
  return true;
68112
68128
  }
68113
68129
  }
68114
- this.shiftSelectStartRowId = rowState.id;
68130
+ this.shiftSelectStartRowId = isSelecting ? rowState.id : undefined;
68115
68131
  this.previousShiftSelectRowEndId = undefined;
68116
68132
  this.toggleIsRowSelected(rowState, isSelecting);
68117
68133
  return true;
68118
68134
  }
68119
68135
  handleRowClick(rowState, shiftKey, ctrlKey) {
68120
- if (ctrlKey) {
68121
- this.shiftSelectStartRowId = rowState.id;
68122
- this.previousShiftSelectRowEndId = undefined;
68123
- this.toggleIsRowSelected(rowState);
68124
- return true;
68125
- }
68126
68136
  if (shiftKey) {
68127
- if (this.tryUpdateRangeSelection(rowState.id)) {
68137
+ const additiveSelection = ctrlKey;
68138
+ if (this.tryUpdateRangeSelection(rowState.id, additiveSelection)) {
68128
68139
  // Made a range selection
68129
68140
  return true;
68130
68141
  }
68131
68142
  }
68143
+ if (ctrlKey) {
68144
+ const isSelecting = rowState.selectionState !== TableRowSelectionState.selected;
68145
+ this.shiftSelectStartRowId = isSelecting ? rowState.id : undefined;
68146
+ this.previousShiftSelectRowEndId = undefined;
68147
+ this.toggleIsRowSelected(rowState);
68148
+ return true;
68149
+ }
68132
68150
  this.shiftSelectStartRowId = rowState.id;
68133
68151
  this.previousShiftSelectRowEndId = undefined;
68134
68152
  return this.selectSingleRow(rowState);
@@ -68143,7 +68161,7 @@ focus outline in that case.
68143
68161
  this.shiftSelectStartRowId = undefined;
68144
68162
  this.previousShiftSelectRowEndId = undefined;
68145
68163
  }
68146
- tryUpdateRangeSelection(rowId) {
68164
+ tryUpdateRangeSelection(rowId, additiveSelection) {
68147
68165
  if (this.shiftSelectStartRowId === undefined) {
68148
68166
  return false;
68149
68167
  }
@@ -68152,8 +68170,14 @@ focus outline in that case.
68152
68170
  if (selectionStartIndex === -1) {
68153
68171
  return false;
68154
68172
  }
68155
- const selectionState = this.tanStackTable.getState().rowSelection;
68156
- this.removePreviousRangeSelection(selectionState, selectionStartIndex, allRows);
68173
+ let selectionState = {};
68174
+ if (additiveSelection) {
68175
+ // If the range selection is additive to the existing selection, start with the initial selection state
68176
+ // and remove the previous range selection, if any. Otherwise, the range selection will start empty and
68177
+ // only contain the new range selection.
68178
+ selectionState = this.tanStackTable.getState().rowSelection;
68179
+ this.removePreviousRangeSelection(selectionState, selectionStartIndex, allRows);
68180
+ }
68157
68181
  this.addNewRangeSelection(selectionState, rowId, selectionStartIndex, allRows);
68158
68182
  this.previousShiftSelectRowEndId = rowId;
68159
68183
  this.tanStackTable.setRowSelection(selectionState);
@@ -69597,6 +69621,18 @@ focus outline in that case.
69597
69621
  return (this.selectionMode === TableRowSelectionMode.multiple
69598
69622
  || this.showCollapseAll);
69599
69623
  }
69624
+ /**
69625
+ * @internal
69626
+ */
69627
+ get collapseButtonVisibility() {
69628
+ if (!this.canHaveCollapsibleRows) {
69629
+ return 'hidden-size-reduced';
69630
+ }
69631
+ if (this.showCollapseAll) {
69632
+ return 'visible';
69633
+ }
69634
+ return '';
69635
+ }
69600
69636
  constructor() {
69601
69637
  super();
69602
69638
  this.selectionMode = TableRowSelectionMode.none;
@@ -69632,6 +69668,10 @@ focus outline in that case.
69632
69668
  * @internal
69633
69669
  */
69634
69670
  this.showCollapseAll = false;
69671
+ /**
69672
+ * @internal
69673
+ */
69674
+ this.canHaveCollapsibleRows = false;
69635
69675
  /**
69636
69676
  * @internal
69637
69677
  */
@@ -69955,6 +69995,12 @@ focus outline in that case.
69955
69995
  if (this.tableUpdateTracker.requiresTanStackUpdate) {
69956
69996
  this.updateTanStack();
69957
69997
  }
69998
+ if (this.tableUpdateTracker.updateRowParentIds
69999
+ || this.tableUpdateTracker.updateGroupRows) {
70000
+ const hierarchyEnabled = this.isHierarchyEnabled();
70001
+ const hasGroupableColumns = this.columns.some(x => !x.columnInternals.groupingDisabled);
70002
+ this.canHaveCollapsibleRows = hierarchyEnabled || hasGroupableColumns;
70003
+ }
69958
70004
  if (this.tableUpdateTracker.updateActionMenuSlots) {
69959
70005
  this.updateActionMenuSlots();
69960
70006
  }
@@ -70462,6 +70508,12 @@ focus outline in that case.
70462
70508
  __decorate$1([
70463
70509
  observable
70464
70510
  ], Table$1.prototype, "showCollapseAll", void 0);
70511
+ __decorate$1([
70512
+ observable
70513
+ ], Table$1.prototype, "canHaveCollapsibleRows", void 0);
70514
+ __decorate$1([
70515
+ volatile
70516
+ ], Table$1.prototype, "collapseButtonVisibility", null);
70465
70517
  __decorate$1([
70466
70518
  observable
70467
70519
  ], Table$1.prototype, "firstSortedColumn", void 0);