@ni/spright-components 6.4.18 → 6.4.20

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.
@@ -26095,6 +26095,18 @@ so this becomes the fallback color for the slot */ ''}
26095
26095
  * Base class for mapping configuration elements
26096
26096
  */
26097
26097
  let Mapping$1 = class Mapping extends FoundationElement {
26098
+ /**
26099
+ * Getter for the `key` property for environments that do not support properties named "key"
26100
+ */
26101
+ get keyValue() {
26102
+ return this.key;
26103
+ }
26104
+ /**
26105
+ * Setter for the `key` property for environments that do not support properties named "key"
26106
+ */
26107
+ set keyValue(value) {
26108
+ this.key = value;
26109
+ }
26098
26110
  };
26099
26111
  __decorate([
26100
26112
  attr()
@@ -70209,6 +70221,7 @@ focus outline in that case.
70209
70221
  newState: menuButtonEventDetail.newState,
70210
70222
  oldState: menuButtonEventDetail.oldState,
70211
70223
  recordIds: [this.recordId],
70224
+ operatingRecordId: this.recordId,
70212
70225
  columnId: column.columnId
70213
70226
  };
70214
70227
  this.$emit(eventType, detail);
@@ -72062,7 +72075,8 @@ focus outline in that case.
72062
72075
  'columnWidths',
72063
72076
  'columnDefinition',
72064
72077
  'actionMenuSlots',
72065
- 'selectionMode'
72078
+ 'selectionMode',
72079
+ 'actionMenusPreserveSelection'
72066
72080
  ];
72067
72081
  /**
72068
72082
  * Helper class to track what updates are needed to the table based on configuration
@@ -72101,6 +72115,9 @@ focus outline in that case.
72101
72115
  get updateSelectionMode() {
72102
72116
  return this.isTracked('selectionMode');
72103
72117
  }
72118
+ get updateActionMenusPreserveSelection() {
72119
+ return this.isTracked('actionMenusPreserveSelection');
72120
+ }
72104
72121
  get requiresTanStackUpdate() {
72105
72122
  return (this.isTracked('rowIds')
72106
72123
  || this.isTracked('rowParentIds')
@@ -72179,6 +72196,10 @@ focus outline in that case.
72179
72196
  this.track('selectionMode');
72180
72197
  this.queueUpdate();
72181
72198
  }
72199
+ trackActionMenusPreserveSelectionChanged() {
72200
+ this.track('actionMenusPreserveSelection');
72201
+ this.queueUpdate();
72202
+ }
72182
72203
  queueUpdate() {
72183
72204
  if (!this.table.$fastController.isConnected) {
72184
72205
  return;
@@ -72198,8 +72219,12 @@ focus outline in that case.
72198
72219
  * Abstract base class for handling behavior associated with interactive row selection of the table.
72199
72220
  */
72200
72221
  class SelectionManagerBase {
72201
- constructor(tanStackTable) {
72222
+ constructor(tanStackTable, actionMenusPreserveSelection) {
72202
72223
  this.tanStackTable = tanStackTable;
72224
+ this.actionMenusPreserveSelection = actionMenusPreserveSelection;
72225
+ }
72226
+ updateActionMenusPreserveSelection(actionMenusPreserveSelection) {
72227
+ this.actionMenusPreserveSelection = actionMenusPreserveSelection;
72203
72228
  }
72204
72229
  reset() { }
72205
72230
  toggleIsRowSelected(rowState, isSelecting) {
@@ -72326,6 +72351,9 @@ focus outline in that case.
72326
72351
  return this.selectSingleRow(rowState);
72327
72352
  }
72328
72353
  handleActionMenuOpening(rowState) {
72354
+ if (this.actionMenusPreserveSelection) {
72355
+ return false;
72356
+ }
72329
72357
  if (rowState.selectionState === TableRowSelectionState.selected) {
72330
72358
  return false;
72331
72359
  }
@@ -72412,6 +72440,9 @@ focus outline in that case.
72412
72440
  return this.selectSingleRow(rowState);
72413
72441
  }
72414
72442
  handleActionMenuOpening(rowState) {
72443
+ if (this.actionMenusPreserveSelection) {
72444
+ return false;
72445
+ }
72415
72446
  return this.handleRowClick(rowState, false, false);
72416
72447
  }
72417
72448
  }
@@ -72421,9 +72452,10 @@ focus outline in that case.
72421
72452
  * handling when the selection mode of the table is changed.
72422
72453
  */
72423
72454
  class InteractiveSelectionManager {
72424
- constructor(tanStackTable, selectionMode) {
72455
+ constructor(tanStackTable, selectionMode, actionMenusPreserveSelection) {
72425
72456
  this.tanStackTable = tanStackTable;
72426
- this.selectionManager = this.createSelectionManager(selectionMode);
72457
+ this.actionMenusPreserveSelection = actionMenusPreserveSelection;
72458
+ this.selectionManager = this.createSelectionManager(selectionMode, actionMenusPreserveSelection);
72427
72459
  }
72428
72460
  handleRowSelectionToggle(rowState, isSelecting, shiftKey) {
72429
72461
  if (!rowState) {
@@ -72444,7 +72476,11 @@ focus outline in that case.
72444
72476
  return this.selectionManager.handleActionMenuOpening(rowState);
72445
72477
  }
72446
72478
  handleSelectionModeChanged(selectionMode) {
72447
- 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);
72448
72484
  }
72449
72485
  handleSelectionReset() {
72450
72486
  this.selectionManager.reset();
@@ -72462,14 +72498,14 @@ focus outline in that case.
72462
72498
  });
72463
72499
  return selectedRecordIds;
72464
72500
  }
72465
- createSelectionManager(selectionMode) {
72501
+ createSelectionManager(selectionMode, actionMenusPreserveSelection) {
72466
72502
  switch (selectionMode) {
72467
72503
  case TableRowSelectionMode.multiple:
72468
- return new MultiSelectionManager(this.tanStackTable);
72504
+ return new MultiSelectionManager(this.tanStackTable, actionMenusPreserveSelection);
72469
72505
  case TableRowSelectionMode.single:
72470
- return new SingleSelectionManager(this.tanStackTable);
72506
+ return new SingleSelectionManager(this.tanStackTable, actionMenusPreserveSelection);
72471
72507
  case TableRowSelectionMode.none:
72472
- return new DisabledSelectionManager(this.tanStackTable);
72508
+ return new DisabledSelectionManager(this.tanStackTable, actionMenusPreserveSelection);
72473
72509
  default:
72474
72510
  throw new Error('unknown selection mode found');
72475
72511
  }
@@ -73816,6 +73852,7 @@ focus outline in that case.
73816
73852
  constructor() {
73817
73853
  super();
73818
73854
  this.selectionMode = TableRowSelectionMode.none;
73855
+ this.actionMenusPreserveSelection = false;
73819
73856
  /**
73820
73857
  * @internal
73821
73858
  */
@@ -73957,7 +73994,7 @@ focus outline in that case.
73957
73994
  this.layoutManager = new TableLayoutManager(this);
73958
73995
  this.layoutManagerNotifier = Observable.getNotifier(this.layoutManager);
73959
73996
  this.layoutManagerNotifier.subscribe(this, 'isColumnBeingSized');
73960
- this.selectionManager = new InteractiveSelectionManager(this.table, this.selectionMode);
73997
+ this.selectionManager = new InteractiveSelectionManager(this.table, this.selectionMode, this.actionMenusPreserveSelection);
73961
73998
  this.expansionManager = new ExpansionManager(this.table);
73962
73999
  }
73963
74000
  async setData(newData) {
@@ -74203,6 +74240,9 @@ focus outline in that case.
74203
74240
  if (this.tableUpdateTracker.updateActionMenuSlots) {
74204
74241
  this.updateActionMenuSlots();
74205
74242
  }
74243
+ if (this.tableUpdateTracker.updateActionMenusPreserveSelection) {
74244
+ this.selectionManager.handleActionMenusPreserveSelectionChanged(this.actionMenusPreserveSelection);
74245
+ }
74206
74246
  if (this.tableUpdateTracker.updateColumnWidths) {
74207
74247
  this.rowGridColumns = this.layoutManager.getGridTemplateColumns();
74208
74248
  this.visibleColumns = this.columns.filter(column => !column.columnHidden);
@@ -74258,6 +74298,12 @@ focus outline in that case.
74258
74298
  }
74259
74299
  this.tableUpdateTracker.trackSelectionModeChanged();
74260
74300
  }
74301
+ actionMenusPreserveSelectionChanged(_prev, _next) {
74302
+ if (!this.$fastController.isConnected) {
74303
+ return;
74304
+ }
74305
+ this.tableUpdateTracker.trackActionMenusPreserveSelectionChanged();
74306
+ }
74261
74307
  idFieldNameChanged(_prev, _next) {
74262
74308
  if (!this.$fastController.isConnected) {
74263
74309
  return;
@@ -74291,7 +74337,7 @@ focus outline in that case.
74291
74337
  if (selectionChanged) {
74292
74338
  await this.emitSelectionChangeEvent();
74293
74339
  }
74294
- this.openActionMenuRecordId = event.detail.recordIds[0];
74340
+ this.openActionMenuRecordId = event.detail.operatingRecordId;
74295
74341
  this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId);
74296
74342
  const detail = await this.getActionMenuToggleEventDetail(event);
74297
74343
  this.$emit('action-menu-beforetoggle', detail);
@@ -74305,9 +74351,14 @@ focus outline in that case.
74305
74351
  }
74306
74352
  }
74307
74353
  async getActionMenuToggleEventDetail(originalEvent) {
74308
- const recordIds = this.selectionMode === TableRowSelectionMode.multiple
74309
- ? await this.getSelectedRecordIds()
74310
- : [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
+ }
74311
74362
  return {
74312
74363
  ...originalEvent.detail,
74313
74364
  recordIds
@@ -74673,6 +74724,9 @@ focus outline in that case.
74673
74724
  __decorate([
74674
74725
  attr({ attribute: 'selection-mode' })
74675
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);
74676
74730
  __decorate([
74677
74731
  observable
74678
74732
  ], Table$1.prototype, "tableData", void 0);