@ni/spright-components 6.4.19 → 6.4.21

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.
@@ -70221,6 +70221,7 @@ focus outline in that case.
70221
70221
  newState: menuButtonEventDetail.newState,
70222
70222
  oldState: menuButtonEventDetail.oldState,
70223
70223
  recordIds: [this.recordId],
70224
+ operatingRecordId: this.recordId,
70224
70225
  columnId: column.columnId
70225
70226
  };
70226
70227
  this.$emit(eventType, detail);
@@ -72074,7 +72075,8 @@ focus outline in that case.
72074
72075
  'columnWidths',
72075
72076
  'columnDefinition',
72076
72077
  'actionMenuSlots',
72077
- 'selectionMode'
72078
+ 'selectionMode',
72079
+ 'actionMenusPreserveSelection'
72078
72080
  ];
72079
72081
  /**
72080
72082
  * Helper class to track what updates are needed to the table based on configuration
@@ -72113,6 +72115,9 @@ focus outline in that case.
72113
72115
  get updateSelectionMode() {
72114
72116
  return this.isTracked('selectionMode');
72115
72117
  }
72118
+ get updateActionMenusPreserveSelection() {
72119
+ return this.isTracked('actionMenusPreserveSelection');
72120
+ }
72116
72121
  get requiresTanStackUpdate() {
72117
72122
  return (this.isTracked('rowIds')
72118
72123
  || this.isTracked('rowParentIds')
@@ -72191,6 +72196,10 @@ focus outline in that case.
72191
72196
  this.track('selectionMode');
72192
72197
  this.queueUpdate();
72193
72198
  }
72199
+ trackActionMenusPreserveSelectionChanged() {
72200
+ this.track('actionMenusPreserveSelection');
72201
+ this.queueUpdate();
72202
+ }
72194
72203
  queueUpdate() {
72195
72204
  if (!this.table.$fastController.isConnected) {
72196
72205
  return;
@@ -72210,8 +72219,12 @@ focus outline in that case.
72210
72219
  * Abstract base class for handling behavior associated with interactive row selection of the table.
72211
72220
  */
72212
72221
  class SelectionManagerBase {
72213
- constructor(tanStackTable) {
72222
+ constructor(tanStackTable, actionMenusPreserveSelection) {
72214
72223
  this.tanStackTable = tanStackTable;
72224
+ this.actionMenusPreserveSelection = actionMenusPreserveSelection;
72225
+ }
72226
+ updateActionMenusPreserveSelection(actionMenusPreserveSelection) {
72227
+ this.actionMenusPreserveSelection = actionMenusPreserveSelection;
72215
72228
  }
72216
72229
  reset() { }
72217
72230
  toggleIsRowSelected(rowState, isSelecting) {
@@ -72338,6 +72351,9 @@ focus outline in that case.
72338
72351
  return this.selectSingleRow(rowState);
72339
72352
  }
72340
72353
  handleActionMenuOpening(rowState) {
72354
+ if (this.actionMenusPreserveSelection) {
72355
+ return false;
72356
+ }
72341
72357
  if (rowState.selectionState === TableRowSelectionState.selected) {
72342
72358
  return false;
72343
72359
  }
@@ -72424,6 +72440,9 @@ focus outline in that case.
72424
72440
  return this.selectSingleRow(rowState);
72425
72441
  }
72426
72442
  handleActionMenuOpening(rowState) {
72443
+ if (this.actionMenusPreserveSelection) {
72444
+ return false;
72445
+ }
72427
72446
  return this.handleRowClick(rowState, false, false);
72428
72447
  }
72429
72448
  }
@@ -72433,9 +72452,10 @@ focus outline in that case.
72433
72452
  * handling when the selection mode of the table is changed.
72434
72453
  */
72435
72454
  class InteractiveSelectionManager {
72436
- constructor(tanStackTable, selectionMode) {
72455
+ constructor(tanStackTable, selectionMode, actionMenusPreserveSelection) {
72437
72456
  this.tanStackTable = tanStackTable;
72438
- this.selectionManager = this.createSelectionManager(selectionMode);
72457
+ this.actionMenusPreserveSelection = actionMenusPreserveSelection;
72458
+ this.selectionManager = this.createSelectionManager(selectionMode, actionMenusPreserveSelection);
72439
72459
  }
72440
72460
  handleRowSelectionToggle(rowState, isSelecting, shiftKey) {
72441
72461
  if (!rowState) {
@@ -72456,7 +72476,11 @@ focus outline in that case.
72456
72476
  return this.selectionManager.handleActionMenuOpening(rowState);
72457
72477
  }
72458
72478
  handleSelectionModeChanged(selectionMode) {
72459
- this.selectionManager = this.createSelectionManager(selectionMode);
72479
+ this.selectionManager = this.createSelectionManager(selectionMode, this.actionMenusPreserveSelection);
72480
+ }
72481
+ handleActionMenusPreserveSelectionChanged(actionMenusPreserveSelection) {
72482
+ this.actionMenusPreserveSelection = actionMenusPreserveSelection;
72483
+ this.selectionManager.updateActionMenusPreserveSelection(actionMenusPreserveSelection);
72460
72484
  }
72461
72485
  handleSelectionReset() {
72462
72486
  this.selectionManager.reset();
@@ -72474,14 +72498,14 @@ focus outline in that case.
72474
72498
  });
72475
72499
  return selectedRecordIds;
72476
72500
  }
72477
- createSelectionManager(selectionMode) {
72501
+ createSelectionManager(selectionMode, actionMenusPreserveSelection) {
72478
72502
  switch (selectionMode) {
72479
72503
  case TableRowSelectionMode.multiple:
72480
- return new MultiSelectionManager(this.tanStackTable);
72504
+ return new MultiSelectionManager(this.tanStackTable, actionMenusPreserveSelection);
72481
72505
  case TableRowSelectionMode.single:
72482
- return new SingleSelectionManager(this.tanStackTable);
72506
+ return new SingleSelectionManager(this.tanStackTable, actionMenusPreserveSelection);
72483
72507
  case TableRowSelectionMode.none:
72484
- return new DisabledSelectionManager(this.tanStackTable);
72508
+ return new DisabledSelectionManager(this.tanStackTable, actionMenusPreserveSelection);
72485
72509
  default:
72486
72510
  throw new Error('unknown selection mode found');
72487
72511
  }
@@ -73828,6 +73852,7 @@ focus outline in that case.
73828
73852
  constructor() {
73829
73853
  super();
73830
73854
  this.selectionMode = TableRowSelectionMode.none;
73855
+ this.actionMenusPreserveSelection = false;
73831
73856
  /**
73832
73857
  * @internal
73833
73858
  */
@@ -73969,7 +73994,7 @@ focus outline in that case.
73969
73994
  this.layoutManager = new TableLayoutManager(this);
73970
73995
  this.layoutManagerNotifier = Observable.getNotifier(this.layoutManager);
73971
73996
  this.layoutManagerNotifier.subscribe(this, 'isColumnBeingSized');
73972
- this.selectionManager = new InteractiveSelectionManager(this.table, this.selectionMode);
73997
+ this.selectionManager = new InteractiveSelectionManager(this.table, this.selectionMode, this.actionMenusPreserveSelection);
73973
73998
  this.expansionManager = new ExpansionManager(this.table);
73974
73999
  }
73975
74000
  async setData(newData) {
@@ -74215,6 +74240,9 @@ focus outline in that case.
74215
74240
  if (this.tableUpdateTracker.updateActionMenuSlots) {
74216
74241
  this.updateActionMenuSlots();
74217
74242
  }
74243
+ if (this.tableUpdateTracker.updateActionMenusPreserveSelection) {
74244
+ this.selectionManager.handleActionMenusPreserveSelectionChanged(this.actionMenusPreserveSelection);
74245
+ }
74218
74246
  if (this.tableUpdateTracker.updateColumnWidths) {
74219
74247
  this.rowGridColumns = this.layoutManager.getGridTemplateColumns();
74220
74248
  this.visibleColumns = this.columns.filter(column => !column.columnHidden);
@@ -74270,6 +74298,12 @@ focus outline in that case.
74270
74298
  }
74271
74299
  this.tableUpdateTracker.trackSelectionModeChanged();
74272
74300
  }
74301
+ actionMenusPreserveSelectionChanged(_prev, _next) {
74302
+ if (!this.$fastController.isConnected) {
74303
+ return;
74304
+ }
74305
+ this.tableUpdateTracker.trackActionMenusPreserveSelectionChanged();
74306
+ }
74273
74307
  idFieldNameChanged(_prev, _next) {
74274
74308
  if (!this.$fastController.isConnected) {
74275
74309
  return;
@@ -74303,7 +74337,7 @@ focus outline in that case.
74303
74337
  if (selectionChanged) {
74304
74338
  await this.emitSelectionChangeEvent();
74305
74339
  }
74306
- this.openActionMenuRecordId = event.detail.recordIds[0];
74340
+ this.openActionMenuRecordId = event.detail.operatingRecordId;
74307
74341
  this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId);
74308
74342
  const detail = await this.getActionMenuToggleEventDetail(event);
74309
74343
  this.$emit('action-menu-beforetoggle', detail);
@@ -74317,9 +74351,14 @@ focus outline in that case.
74317
74351
  }
74318
74352
  }
74319
74353
  async getActionMenuToggleEventDetail(originalEvent) {
74320
- const recordIds = this.selectionMode === TableRowSelectionMode.multiple
74321
- ? await this.getSelectedRecordIds()
74322
- : [this.openActionMenuRecordId];
74354
+ let recordIds;
74355
+ if (this.selectionMode === TableRowSelectionMode.multiple
74356
+ || this.actionMenusPreserveSelection) {
74357
+ recordIds = await this.getSelectedRecordIds();
74358
+ }
74359
+ else {
74360
+ recordIds = [this.openActionMenuRecordId];
74361
+ }
74323
74362
  return {
74324
74363
  ...originalEvent.detail,
74325
74364
  recordIds
@@ -74685,6 +74724,9 @@ focus outline in that case.
74685
74724
  __decorate([
74686
74725
  attr({ attribute: 'selection-mode' })
74687
74726
  ], Table$1.prototype, "selectionMode", void 0);
74727
+ __decorate([
74728
+ attr({ attribute: 'action-menus-preserve-selection', mode: 'boolean' })
74729
+ ], Table$1.prototype, "actionMenusPreserveSelection", void 0);
74688
74730
  __decorate([
74689
74731
  observable
74690
74732
  ], Table$1.prototype, "tableData", void 0);