@ni/nimble-components 34.9.1 → 34.10.0

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