@ni/nimble-components 30.0.0 → 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 22:15:12 GMT
16336
+ * Generated on Wed, 17 Jul 2024 17:49:16 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -64816,12 +64816,6 @@ img.ProseMirror-separator {
64816
64816
  get tabbableChildren() {
64817
64817
  return [];
64818
64818
  }
64819
- /**
64820
- * Called if an element inside this cell view has focus, and this row/cell is being recycled.
64821
- * Expected implementation is to commit changes as needed, and blur the focusable element (or close
64822
- * the menu/popup/etc).
64823
- */
64824
- focusedRecycleCallback() { }
64825
64819
  columnChanged() {
64826
64820
  for (const eventName of this.delegatedEvents) {
64827
64821
  this.removeEventListener(eventName, this.delegatedEventHandler);
@@ -66067,14 +66061,6 @@ focus outline in that case.
66067
66061
  this.menuOpen = event.detail.newState;
66068
66062
  this.emitActionMenuToggleEvent('row-action-menu-toggle', event.detail, column);
66069
66063
  }
66070
- closeOpenActionMenus() {
66071
- if (this.menuOpen) {
66072
- const cellWithMenuOpen = Array.from(this.cellContainer.children).find(c => c instanceof TableCell && c.menuOpen);
66073
- if (cellWithMenuOpen?.actionMenuButton?.open) {
66074
- cellWithMenuOpen.actionMenuButton.toggleButton.control.click();
66075
- }
66076
- }
66077
- }
66078
66064
  /** @internal */
66079
66065
  handleChange(source, args) {
66080
66066
  if (source instanceof ColumnInternals
@@ -66681,15 +66667,7 @@ focus outline in that case.
66681
66667
  @row-slots-request="${(_, c) => c.parent.onRowSlotsRequest(c.event)}"
66682
66668
  @row-expand-toggle="${(x, c) => c.parent.handleRowExpanded(x.index)}"
66683
66669
  >
66684
- ${when((x, c) => c.parent.openActionMenuRecordId === c.parent.tableData[x.index]?.id, html `
66685
- ${repeat((_, c) => c.parent.actionMenuSlots, html `
66686
- <slot
66687
- name="${x => x}"
66688
- slot="${x => `row-action-menu-${x}`}">
66689
- </slot>
66690
- `)}
66691
- `)}
66692
- ${repeat((x, c) => (c.parent.tableData[x.index]?.slots || []), html `
66670
+ ${repeat((x, c) => (c.parent.tableData[x.index]?.requestedSlots || []), html `
66693
66671
  <slot
66694
66672
  name="${x => x.name}"
66695
66673
  slot="${x => x.slot}"
@@ -67513,7 +67491,6 @@ focus outline in that case.
67513
67491
  };
67514
67492
  }
67515
67493
  handleVirtualizerChange() {
67516
- this.table.handleFocusedCellRecycling();
67517
67494
  const virtualizer = this.virtualizer;
67518
67495
  this.visibleItems = virtualizer.getVirtualItems();
67519
67496
  this.scrollHeight = virtualizer.getTotalSize();
@@ -68831,9 +68808,10 @@ focus outline in that case.
68831
68808
  }
68832
68809
  }
68833
68810
  if (focusRowAndCell) {
68834
- // Focusable elements in cells, and action menus, are both blurred on scroll. To maintain our row/cell focus state,
68835
- // we focus the cell instead here. (We also don't want to refocus the cell content when the focusedRecycleCallback just
68836
- // blurred it.)
68811
+ // We want open action menus to be closed, and focused interactive cell content blurred, on scroll. We also don't want to
68812
+ // refocus the interactive cell content after the scroll, as the element no longer represents the same table data at that
68813
+ // point. So in both those cases, we focus the cell here. This also lets us maintain what row/ cell the user had focused
68814
+ // previously.
68837
68815
  if (this.focusType === TableFocusType.cellActionMenu
68838
68816
  || this.focusType === TableFocusType.cellContent) {
68839
68817
  this.setCellFocusState(this.columnIndex, this.rowIndex, false);
@@ -68860,11 +68838,6 @@ focus outline in that case.
68860
68838
  }
68861
68839
  }
68862
68840
  }
68863
- handleFocusedCellRecycling(hadRowOrCellFocus) {
68864
- if (hadRowOrCellFocus && !this.focusWithinTable) {
68865
- this.focusCurrentRow(false);
68866
- }
68867
- }
68868
68841
  onRowFocusIn(event) {
68869
68842
  if (this.isCurrentlyFocusingElement) {
68870
68843
  return;
@@ -69643,10 +69616,6 @@ focus outline in that case.
69643
69616
  * @internal
69644
69617
  */
69645
69618
  this.rowElements = [];
69646
- /**
69647
- * @internal
69648
- */
69649
- this.actionMenuSlots = [];
69650
69619
  /**
69651
69620
  * @internal
69652
69621
  */
@@ -69685,7 +69654,8 @@ focus outline in that case.
69685
69654
  this.ignoreSelectionChangeEvents = false;
69686
69655
  // Map from the external slot name to the record ID of the row that should have the slot
69687
69656
  // and the unique slot name that the slot should be slotted into.
69688
- this.columnRequestedSlots = new Map();
69657
+ this.requestedSlots = new Map();
69658
+ this.actionMenuSlots = [];
69689
69659
  this.onViewPortScroll = (event) => {
69690
69660
  this.scrollX = event.target.scrollLeft;
69691
69661
  };
@@ -69883,7 +69853,7 @@ focus outline in that case.
69883
69853
  event.stopImmediatePropagation();
69884
69854
  for (const slotMetadata of event.detail.slots) {
69885
69855
  const uniqueSlot = uniquifySlotNameForColumnId(event.detail.columnInternalId, slotMetadata.slot);
69886
- this.columnRequestedSlots.set(slotMetadata.name, {
69856
+ this.requestedSlots.set(slotMetadata.name, {
69887
69857
  recordId: event.detail.recordId,
69888
69858
  uniqueSlot
69889
69859
  });
@@ -70037,29 +70007,6 @@ focus outline in that case.
70037
70007
  }
70038
70008
  return tanStackUpdates;
70039
70009
  }
70040
- /** @internal */
70041
- handleFocusedCellRecycling() {
70042
- const hadActiveRowOrCellFocus = this.keyboardNavigationManager.hasActiveRowOrCellFocus;
70043
- let tableFocusedElement = this.shadowRoot.activeElement;
70044
- while (tableFocusedElement !== null
70045
- && !(tableFocusedElement instanceof TableCellView)) {
70046
- if (tableFocusedElement.shadowRoot) {
70047
- tableFocusedElement = tableFocusedElement.shadowRoot.activeElement;
70048
- }
70049
- else {
70050
- break;
70051
- }
70052
- }
70053
- if (tableFocusedElement instanceof TableCellView) {
70054
- tableFocusedElement.focusedRecycleCallback();
70055
- }
70056
- if (this.openActionMenuRecordId !== undefined) {
70057
- const activeRow = this.rowElements.find(row => row instanceof TableRow
70058
- && row.recordId === this.openActionMenuRecordId);
70059
- activeRow?.closeOpenActionMenus();
70060
- }
70061
- this.keyboardNavigationManager.handleFocusedCellRecycling(hadActiveRowOrCellFocus);
70062
- }
70063
70010
  selectionModeChanged(_prev, _next) {
70064
70011
  if (!this.$fastController.isConnected) {
70065
70012
  return;
@@ -70085,9 +70032,12 @@ focus outline in that case.
70085
70032
  this.observeColumns();
70086
70033
  this.tableUpdateTracker.trackColumnInstancesChanged();
70087
70034
  }
70088
- removeActionMenuSlotsFromColumnRequestedSlots() {
70035
+ updateRequestedSlotsForOpeningActionMenu(openActionMenuRecordId) {
70089
70036
  for (const actionMenuSlot of this.actionMenuSlots) {
70090
- this.columnRequestedSlots.delete(actionMenuSlot);
70037
+ this.requestedSlots.set(actionMenuSlot, {
70038
+ recordId: openActionMenuRecordId,
70039
+ uniqueSlot: `row-action-menu-${actionMenuSlot}`
70040
+ });
70091
70041
  }
70092
70042
  this.refreshRows();
70093
70043
  }
@@ -70097,7 +70047,7 @@ focus outline in that case.
70097
70047
  await this.emitSelectionChangeEvent();
70098
70048
  }
70099
70049
  this.openActionMenuRecordId = event.detail.recordIds[0];
70100
- this.removeActionMenuSlotsFromColumnRequestedSlots();
70050
+ this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId);
70101
70051
  const detail = await this.getActionMenuToggleEventDetail(event);
70102
70052
  this.$emit('action-menu-beforetoggle', detail);
70103
70053
  }
@@ -70225,6 +70175,13 @@ focus outline in that case.
70225
70175
  this.updateTableOptions(updatedOptions);
70226
70176
  }
70227
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
+ }
70228
70185
  const slots = new Set();
70229
70186
  for (const column of this.columns) {
70230
70187
  if (column.actionMenuSlot) {
@@ -70232,6 +70189,11 @@ focus outline in that case.
70232
70189
  }
70233
70190
  }
70234
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
+ }
70235
70197
  }
70236
70198
  validate() {
70237
70199
  this.tableValidator.validateIdFieldConfiguration(this.selectionMode, this.idFieldName, this.parentIdFieldName);
@@ -70316,7 +70278,7 @@ focus outline in that case.
70316
70278
  groupColumn: this.getGroupRowColumn(row),
70317
70279
  resolvedRowIndex: row.index,
70318
70280
  isLoadingChildren: this.expansionManager.isLoadingChildren(row.id),
70319
- slots: slotsByRecordId[row.id] ?? []
70281
+ requestedSlots: slotsByRecordId[row.id] ?? []
70320
70282
  };
70321
70283
  hasDataHierarchy = hasDataHierarchy || isParent;
70322
70284
  return rowState;
@@ -70328,7 +70290,7 @@ focus outline in that case.
70328
70290
  getRequestedSlotsByRecordId() {
70329
70291
  const slotsByRecordId = {};
70330
70292
  for (const [slotName, { recordId, uniqueSlot }] of this
70331
- .columnRequestedSlots) {
70293
+ .requestedSlots) {
70332
70294
  if (!Object.prototype.hasOwnProperty.call(slotsByRecordId, recordId)) {
70333
70295
  slotsByRecordId[recordId] = [];
70334
70296
  }
@@ -70476,9 +70438,6 @@ focus outline in that case.
70476
70438
  __decorate$1([
70477
70439
  observable
70478
70440
  ], Table$1.prototype, "rowElements", void 0);
70479
- __decorate$1([
70480
- observable
70481
- ], Table$1.prototype, "actionMenuSlots", void 0);
70482
70441
  __decorate$1([
70483
70442
  observable
70484
70443
  ], Table$1.prototype, "openActionMenuRecordId", void 0);
@@ -70714,9 +70673,6 @@ focus outline in that case.
70714
70673
  get showAnchor() {
70715
70674
  return typeof this.cellRecord?.href === 'string';
70716
70675
  }
70717
- focusedRecycleCallback() {
70718
- this.anchor?.blur();
70719
- }
70720
70676
  get tabbableChildren() {
70721
70677
  if (this.showAnchor) {
70722
70678
  return [this.anchor];