@ni/nimble-components 30.0.1 → 30.0.2

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 Tue, 16 Jul 2024 23:38:17 GMT
16336
+ * Generated on Wed, 17 Jul 2024 17:49:16 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -66667,15 +66667,7 @@ focus outline in that case.
66667
66667
  @row-slots-request="${(_, c) => c.parent.onRowSlotsRequest(c.event)}"
66668
66668
  @row-expand-toggle="${(x, c) => c.parent.handleRowExpanded(x.index)}"
66669
66669
  >
66670
- ${when((x, c) => c.parent.openActionMenuRecordId === c.parent.tableData[x.index]?.id, html `
66671
- ${repeat((_, c) => c.parent.actionMenuSlots, html `
66672
- <slot
66673
- name="${x => x}"
66674
- slot="${x => `row-action-menu-${x}`}">
66675
- </slot>
66676
- `)}
66677
- `)}
66678
- ${repeat((x, c) => (c.parent.tableData[x.index]?.slots || []), html `
66670
+ ${repeat((x, c) => (c.parent.tableData[x.index]?.requestedSlots || []), html `
66679
66671
  <slot
66680
66672
  name="${x => x.name}"
66681
66673
  slot="${x => x.slot}"
@@ -69624,10 +69616,6 @@ focus outline in that case.
69624
69616
  * @internal
69625
69617
  */
69626
69618
  this.rowElements = [];
69627
- /**
69628
- * @internal
69629
- */
69630
- this.actionMenuSlots = [];
69631
69619
  /**
69632
69620
  * @internal
69633
69621
  */
@@ -69666,7 +69654,8 @@ focus outline in that case.
69666
69654
  this.ignoreSelectionChangeEvents = false;
69667
69655
  // Map from the external slot name to the record ID of the row that should have the slot
69668
69656
  // and the unique slot name that the slot should be slotted into.
69669
- this.columnRequestedSlots = new Map();
69657
+ this.requestedSlots = new Map();
69658
+ this.actionMenuSlots = [];
69670
69659
  this.onViewPortScroll = (event) => {
69671
69660
  this.scrollX = event.target.scrollLeft;
69672
69661
  };
@@ -69864,7 +69853,7 @@ focus outline in that case.
69864
69853
  event.stopImmediatePropagation();
69865
69854
  for (const slotMetadata of event.detail.slots) {
69866
69855
  const uniqueSlot = uniquifySlotNameForColumnId(event.detail.columnInternalId, slotMetadata.slot);
69867
- this.columnRequestedSlots.set(slotMetadata.name, {
69856
+ this.requestedSlots.set(slotMetadata.name, {
69868
69857
  recordId: event.detail.recordId,
69869
69858
  uniqueSlot
69870
69859
  });
@@ -70043,9 +70032,12 @@ focus outline in that case.
70043
70032
  this.observeColumns();
70044
70033
  this.tableUpdateTracker.trackColumnInstancesChanged();
70045
70034
  }
70046
- removeActionMenuSlotsFromColumnRequestedSlots() {
70035
+ updateRequestedSlotsForOpeningActionMenu(openActionMenuRecordId) {
70047
70036
  for (const actionMenuSlot of this.actionMenuSlots) {
70048
- this.columnRequestedSlots.delete(actionMenuSlot);
70037
+ this.requestedSlots.set(actionMenuSlot, {
70038
+ recordId: openActionMenuRecordId,
70039
+ uniqueSlot: `row-action-menu-${actionMenuSlot}`
70040
+ });
70049
70041
  }
70050
70042
  this.refreshRows();
70051
70043
  }
@@ -70055,7 +70047,7 @@ focus outline in that case.
70055
70047
  await this.emitSelectionChangeEvent();
70056
70048
  }
70057
70049
  this.openActionMenuRecordId = event.detail.recordIds[0];
70058
- this.removeActionMenuSlotsFromColumnRequestedSlots();
70050
+ this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId);
70059
70051
  const detail = await this.getActionMenuToggleEventDetail(event);
70060
70052
  this.$emit('action-menu-beforetoggle', detail);
70061
70053
  }
@@ -70183,6 +70175,13 @@ focus outline in that case.
70183
70175
  this.updateTableOptions(updatedOptions);
70184
70176
  }
70185
70177
  updateActionMenuSlots() {
70178
+ if (this.openActionMenuRecordId !== undefined) {
70179
+ // If the action menu is open, delete all the slots associated
70180
+ // with the old action menu slots.
70181
+ for (const actionMenuSlot of this.actionMenuSlots) {
70182
+ this.requestedSlots.delete(actionMenuSlot);
70183
+ }
70184
+ }
70186
70185
  const slots = new Set();
70187
70186
  for (const column of this.columns) {
70188
70187
  if (column.actionMenuSlot) {
@@ -70190,6 +70189,11 @@ focus outline in that case.
70190
70189
  }
70191
70190
  }
70192
70191
  this.actionMenuSlots = Array.from(slots);
70192
+ if (this.openActionMenuRecordId !== undefined) {
70193
+ // If the action menu is open, create slots for all the new
70194
+ // action menu slots.
70195
+ this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId);
70196
+ }
70193
70197
  }
70194
70198
  validate() {
70195
70199
  this.tableValidator.validateIdFieldConfiguration(this.selectionMode, this.idFieldName, this.parentIdFieldName);
@@ -70274,7 +70278,7 @@ focus outline in that case.
70274
70278
  groupColumn: this.getGroupRowColumn(row),
70275
70279
  resolvedRowIndex: row.index,
70276
70280
  isLoadingChildren: this.expansionManager.isLoadingChildren(row.id),
70277
- slots: slotsByRecordId[row.id] ?? []
70281
+ requestedSlots: slotsByRecordId[row.id] ?? []
70278
70282
  };
70279
70283
  hasDataHierarchy = hasDataHierarchy || isParent;
70280
70284
  return rowState;
@@ -70286,7 +70290,7 @@ focus outline in that case.
70286
70290
  getRequestedSlotsByRecordId() {
70287
70291
  const slotsByRecordId = {};
70288
70292
  for (const [slotName, { recordId, uniqueSlot }] of this
70289
- .columnRequestedSlots) {
70293
+ .requestedSlots) {
70290
70294
  if (!Object.prototype.hasOwnProperty.call(slotsByRecordId, recordId)) {
70291
70295
  slotsByRecordId[recordId] = [];
70292
70296
  }
@@ -70434,9 +70438,6 @@ focus outline in that case.
70434
70438
  __decorate$1([
70435
70439
  observable
70436
70440
  ], Table$1.prototype, "rowElements", void 0);
70437
- __decorate$1([
70438
- observable
70439
- ], Table$1.prototype, "actionMenuSlots", void 0);
70440
70441
  __decorate$1([
70441
70442
  observable
70442
70443
  ], Table$1.prototype, "openActionMenuRecordId", void 0);