@ni/nimble-components 30.0.3 → 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 20:01:55 GMT
16336
+ * Generated on Wed, 17 Jul 2024 21:04:43 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -68122,29 +68122,31 @@ focus outline in that case.
68122
68122
  class MultiSelectionManager extends SelectionManagerBase {
68123
68123
  handleRowSelectionToggle(rowState, isSelecting, shiftKey) {
68124
68124
  if (shiftKey) {
68125
- if (this.tryUpdateRangeSelection(rowState.id)) {
68125
+ if (this.tryUpdateRangeSelection(rowState.id, true)) {
68126
68126
  // Made a range selection
68127
68127
  return true;
68128
68128
  }
68129
68129
  }
68130
- this.shiftSelectStartRowId = rowState.id;
68130
+ this.shiftSelectStartRowId = isSelecting ? rowState.id : undefined;
68131
68131
  this.previousShiftSelectRowEndId = undefined;
68132
68132
  this.toggleIsRowSelected(rowState, isSelecting);
68133
68133
  return true;
68134
68134
  }
68135
68135
  handleRowClick(rowState, shiftKey, ctrlKey) {
68136
- if (ctrlKey) {
68137
- this.shiftSelectStartRowId = rowState.id;
68138
- this.previousShiftSelectRowEndId = undefined;
68139
- this.toggleIsRowSelected(rowState);
68140
- return true;
68141
- }
68142
68136
  if (shiftKey) {
68143
- if (this.tryUpdateRangeSelection(rowState.id)) {
68137
+ const additiveSelection = ctrlKey;
68138
+ if (this.tryUpdateRangeSelection(rowState.id, additiveSelection)) {
68144
68139
  // Made a range selection
68145
68140
  return true;
68146
68141
  }
68147
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
+ }
68148
68150
  this.shiftSelectStartRowId = rowState.id;
68149
68151
  this.previousShiftSelectRowEndId = undefined;
68150
68152
  return this.selectSingleRow(rowState);
@@ -68159,7 +68161,7 @@ focus outline in that case.
68159
68161
  this.shiftSelectStartRowId = undefined;
68160
68162
  this.previousShiftSelectRowEndId = undefined;
68161
68163
  }
68162
- tryUpdateRangeSelection(rowId) {
68164
+ tryUpdateRangeSelection(rowId, additiveSelection) {
68163
68165
  if (this.shiftSelectStartRowId === undefined) {
68164
68166
  return false;
68165
68167
  }
@@ -68168,8 +68170,14 @@ focus outline in that case.
68168
68170
  if (selectionStartIndex === -1) {
68169
68171
  return false;
68170
68172
  }
68171
- const selectionState = this.tanStackTable.getState().rowSelection;
68172
- 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
+ }
68173
68181
  this.addNewRangeSelection(selectionState, rowId, selectionStartIndex, allRows);
68174
68182
  this.previousShiftSelectRowEndId = rowId;
68175
68183
  this.tanStackTable.setRowSelection(selectionState);