@ni/nimble-components 30.0.1 → 30.0.3

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 20:01:55 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -65282,12 +65282,21 @@ focus outline in that case.
65282
65282
  grid-template-columns: var(--ni-private-table-row-grid-columns) auto;
65283
65283
  }
65284
65284
 
65285
+ .collapse-all-button-container {
65286
+ display: flex;
65287
+ min-width: ${mediumPadding};
65288
+ }
65289
+
65285
65290
  .collapse-all-button {
65286
65291
  height: ${controlSlimHeight};
65287
65292
  margin-left: ${mediumPadding};
65288
65293
  visibility: hidden;
65289
65294
  }
65290
65295
 
65296
+ .collapse-all-button.hidden-size-reduced {
65297
+ display: none;
65298
+ }
65299
+
65291
65300
  .collapse-all-button.visible {
65292
65301
  visibility: visible;
65293
65302
  }
@@ -65650,7 +65659,7 @@ focus outline in that case.
65650
65659
  flex: 0 0 auto;
65651
65660
  }
65652
65661
 
65653
- .row-front-spacer.top-level-parent {
65662
+ .row-front-spacer.reduced-size-spacer {
65654
65663
  width: ${mediumPadding};
65655
65664
  }
65656
65665
 
@@ -65903,7 +65912,7 @@ focus outline in that case.
65903
65912
  `)}
65904
65913
  </span>
65905
65914
  `)}
65906
- <span class="row-front-spacer ${x => (x.isTopLevelParentRow ? 'top-level-parent' : '')}"></span>
65915
+ <span class="row-front-spacer ${x => (x.isTopLevelParentRow || !x.reserveCollapseSpace ? 'reduced-size-spacer' : '')}"></span>
65907
65916
  ${when(x => x.isParentRow, html `
65908
65917
  ${when(x => x.loading, html `
65909
65918
  <span class="spinner-container">
@@ -65981,6 +65990,7 @@ focus outline in that case.
65981
65990
  this.selected = false;
65982
65991
  this.hideSelection = false;
65983
65992
  this.expanded = false;
65993
+ this.reserveCollapseSpace = false;
65984
65994
  /**
65985
65995
  * @internal
65986
65996
  * */
@@ -66205,6 +66215,9 @@ focus outline in that case.
66205
66215
  __decorate$1([
66206
66216
  attr({ mode: 'boolean' })
66207
66217
  ], TableRow.prototype, "expanded", void 0);
66218
+ __decorate$1([
66219
+ attr({ attribute: 'reserve-collapse-space', mode: 'boolean' })
66220
+ ], TableRow.prototype, "reserveCollapseSpace", void 0);
66208
66221
  __decorate$1([
66209
66222
  observable
66210
66223
  ], TableRow.prototype, "dataRecord", void 0);
@@ -66547,7 +66560,7 @@ focus outline in that case.
66547
66560
  ${ref('selectionCheckbox')}
66548
66561
  ${'' /* tabindex managed dynamically by KeyboardNavigationManager */}
66549
66562
  tabindex="-1"
66550
- class="${x => `selection-checkbox ${x.selectionMode ? x.selectionMode : ''}`}"
66563
+ class="selection-checkbox"
66551
66564
  @change="${(x, c) => x.onAllRowsSelectionChange(c.event)}"
66552
66565
  title="${x => tableSelectAllLabel.getValueFor(x)}"
66553
66566
  aria-label="${x => tableSelectAllLabel.getValueFor(x)}"
@@ -66555,19 +66568,21 @@ focus outline in that case.
66555
66568
  </${checkboxTag}>
66556
66569
  </span>
66557
66570
  `)}
66558
- <${buttonTag}
66559
- ${ref('collapseAllButton')}
66560
- ${'' /* tabindex managed dynamically by KeyboardNavigationManager */}
66561
- tabindex="-1"
66562
- class="collapse-all-button ${x => `${x.showCollapseAll ? 'visible' : ''}`}"
66563
- content-hidden
66564
- appearance="${ButtonAppearance.ghost}"
66565
- title="${x => tableCollapseAllLabel.getValueFor(x)}"
66566
- @click="${x => x.handleCollapseAllRows()}"
66567
- >
66568
- <${iconTriangleTwoLinesHorizontalTag} slot="start"></${iconTriangleTwoLinesHorizontalTag}>
66569
- ${x => tableCollapseAllLabel.getValueFor(x)}
66570
- </${buttonTag}>
66571
+ <span class="collapse-all-button-container">
66572
+ <${buttonTag}
66573
+ ${ref('collapseAllButton')}
66574
+ ${'' /* tabindex managed dynamically by KeyboardNavigationManager */}
66575
+ tabindex="-1"
66576
+ class="collapse-all-button ${x => x.collapseButtonVisibility}"
66577
+ content-hidden
66578
+ appearance="${ButtonAppearance.ghost}"
66579
+ title="${x => tableCollapseAllLabel.getValueFor(x)}"
66580
+ @click="${x => x.handleCollapseAllRows()}"
66581
+ >
66582
+ <${iconTriangleTwoLinesHorizontalTag} slot="start"></${iconTriangleTwoLinesHorizontalTag}>
66583
+ ${x => tableCollapseAllLabel.getValueFor(x)}
66584
+ </${buttonTag}>
66585
+ </span>
66571
66586
  </span>
66572
66587
  <span class="column-headers-container" ${ref('columnHeadersContainer')}>
66573
66588
  ${repeat(x => x.visibleColumns, html `
@@ -66651,6 +66666,7 @@ focus outline in that case.
66651
66666
  ?selected="${(x, c) => c.parent.tableData[x.index]?.selectionState === TableRowSelectionState.selected}"
66652
66667
  ?expanded="${(x, c) => c.parent.tableData[x.index]?.isExpanded}"
66653
66668
  ?hide-selection="${(_, c) => c.parent.selectionMode !== TableRowSelectionMode.multiple}"
66669
+ ?reserve-collapse-space="${(_, c) => c.parent.canHaveCollapsibleRows}"
66654
66670
  :dataRecord="${(x, c) => c.parent.tableData[x.index]?.record}"
66655
66671
  :columns="${(_, c) => c.parent.columns}"
66656
66672
  :isParentRow="${(x, c) => c.parent.tableData[x.index]?.isParentRow}"
@@ -66667,15 +66683,7 @@ focus outline in that case.
66667
66683
  @row-slots-request="${(_, c) => c.parent.onRowSlotsRequest(c.event)}"
66668
66684
  @row-expand-toggle="${(x, c) => c.parent.handleRowExpanded(x.index)}"
66669
66685
  >
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 `
66686
+ ${repeat((x, c) => (c.parent.tableData[x.index]?.requestedSlots || []), html `
66679
66687
  <slot
66680
66688
  name="${x => x.name}"
66681
66689
  slot="${x => x.slot}"
@@ -69605,6 +69613,18 @@ focus outline in that case.
69605
69613
  return (this.selectionMode === TableRowSelectionMode.multiple
69606
69614
  || this.showCollapseAll);
69607
69615
  }
69616
+ /**
69617
+ * @internal
69618
+ */
69619
+ get collapseButtonVisibility() {
69620
+ if (!this.canHaveCollapsibleRows) {
69621
+ return 'hidden-size-reduced';
69622
+ }
69623
+ if (this.showCollapseAll) {
69624
+ return 'visible';
69625
+ }
69626
+ return '';
69627
+ }
69608
69628
  constructor() {
69609
69629
  super();
69610
69630
  this.selectionMode = TableRowSelectionMode.none;
@@ -69624,10 +69644,6 @@ focus outline in that case.
69624
69644
  * @internal
69625
69645
  */
69626
69646
  this.rowElements = [];
69627
- /**
69628
- * @internal
69629
- */
69630
- this.actionMenuSlots = [];
69631
69647
  /**
69632
69648
  * @internal
69633
69649
  */
@@ -69644,6 +69660,10 @@ focus outline in that case.
69644
69660
  * @internal
69645
69661
  */
69646
69662
  this.showCollapseAll = false;
69663
+ /**
69664
+ * @internal
69665
+ */
69666
+ this.canHaveCollapsibleRows = false;
69647
69667
  /**
69648
69668
  * @internal
69649
69669
  */
@@ -69666,7 +69686,8 @@ focus outline in that case.
69666
69686
  this.ignoreSelectionChangeEvents = false;
69667
69687
  // Map from the external slot name to the record ID of the row that should have the slot
69668
69688
  // and the unique slot name that the slot should be slotted into.
69669
- this.columnRequestedSlots = new Map();
69689
+ this.requestedSlots = new Map();
69690
+ this.actionMenuSlots = [];
69670
69691
  this.onViewPortScroll = (event) => {
69671
69692
  this.scrollX = event.target.scrollLeft;
69672
69693
  };
@@ -69864,7 +69885,7 @@ focus outline in that case.
69864
69885
  event.stopImmediatePropagation();
69865
69886
  for (const slotMetadata of event.detail.slots) {
69866
69887
  const uniqueSlot = uniquifySlotNameForColumnId(event.detail.columnInternalId, slotMetadata.slot);
69867
- this.columnRequestedSlots.set(slotMetadata.name, {
69888
+ this.requestedSlots.set(slotMetadata.name, {
69868
69889
  recordId: event.detail.recordId,
69869
69890
  uniqueSlot
69870
69891
  });
@@ -69966,6 +69987,12 @@ focus outline in that case.
69966
69987
  if (this.tableUpdateTracker.requiresTanStackUpdate) {
69967
69988
  this.updateTanStack();
69968
69989
  }
69990
+ if (this.tableUpdateTracker.updateRowParentIds
69991
+ || this.tableUpdateTracker.updateGroupRows) {
69992
+ const hierarchyEnabled = this.isHierarchyEnabled();
69993
+ const hasGroupableColumns = this.columns.some(x => !x.columnInternals.groupingDisabled);
69994
+ this.canHaveCollapsibleRows = hierarchyEnabled || hasGroupableColumns;
69995
+ }
69969
69996
  if (this.tableUpdateTracker.updateActionMenuSlots) {
69970
69997
  this.updateActionMenuSlots();
69971
69998
  }
@@ -70043,9 +70070,12 @@ focus outline in that case.
70043
70070
  this.observeColumns();
70044
70071
  this.tableUpdateTracker.trackColumnInstancesChanged();
70045
70072
  }
70046
- removeActionMenuSlotsFromColumnRequestedSlots() {
70073
+ updateRequestedSlotsForOpeningActionMenu(openActionMenuRecordId) {
70047
70074
  for (const actionMenuSlot of this.actionMenuSlots) {
70048
- this.columnRequestedSlots.delete(actionMenuSlot);
70075
+ this.requestedSlots.set(actionMenuSlot, {
70076
+ recordId: openActionMenuRecordId,
70077
+ uniqueSlot: `row-action-menu-${actionMenuSlot}`
70078
+ });
70049
70079
  }
70050
70080
  this.refreshRows();
70051
70081
  }
@@ -70055,7 +70085,7 @@ focus outline in that case.
70055
70085
  await this.emitSelectionChangeEvent();
70056
70086
  }
70057
70087
  this.openActionMenuRecordId = event.detail.recordIds[0];
70058
- this.removeActionMenuSlotsFromColumnRequestedSlots();
70088
+ this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId);
70059
70089
  const detail = await this.getActionMenuToggleEventDetail(event);
70060
70090
  this.$emit('action-menu-beforetoggle', detail);
70061
70091
  }
@@ -70183,6 +70213,13 @@ focus outline in that case.
70183
70213
  this.updateTableOptions(updatedOptions);
70184
70214
  }
70185
70215
  updateActionMenuSlots() {
70216
+ if (this.openActionMenuRecordId !== undefined) {
70217
+ // If the action menu is open, delete all the slots associated
70218
+ // with the old action menu slots.
70219
+ for (const actionMenuSlot of this.actionMenuSlots) {
70220
+ this.requestedSlots.delete(actionMenuSlot);
70221
+ }
70222
+ }
70186
70223
  const slots = new Set();
70187
70224
  for (const column of this.columns) {
70188
70225
  if (column.actionMenuSlot) {
@@ -70190,6 +70227,11 @@ focus outline in that case.
70190
70227
  }
70191
70228
  }
70192
70229
  this.actionMenuSlots = Array.from(slots);
70230
+ if (this.openActionMenuRecordId !== undefined) {
70231
+ // If the action menu is open, create slots for all the new
70232
+ // action menu slots.
70233
+ this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId);
70234
+ }
70193
70235
  }
70194
70236
  validate() {
70195
70237
  this.tableValidator.validateIdFieldConfiguration(this.selectionMode, this.idFieldName, this.parentIdFieldName);
@@ -70274,7 +70316,7 @@ focus outline in that case.
70274
70316
  groupColumn: this.getGroupRowColumn(row),
70275
70317
  resolvedRowIndex: row.index,
70276
70318
  isLoadingChildren: this.expansionManager.isLoadingChildren(row.id),
70277
- slots: slotsByRecordId[row.id] ?? []
70319
+ requestedSlots: slotsByRecordId[row.id] ?? []
70278
70320
  };
70279
70321
  hasDataHierarchy = hasDataHierarchy || isParent;
70280
70322
  return rowState;
@@ -70286,7 +70328,7 @@ focus outline in that case.
70286
70328
  getRequestedSlotsByRecordId() {
70287
70329
  const slotsByRecordId = {};
70288
70330
  for (const [slotName, { recordId, uniqueSlot }] of this
70289
- .columnRequestedSlots) {
70331
+ .requestedSlots) {
70290
70332
  if (!Object.prototype.hasOwnProperty.call(slotsByRecordId, recordId)) {
70291
70333
  slotsByRecordId[recordId] = [];
70292
70334
  }
@@ -70434,9 +70476,6 @@ focus outline in that case.
70434
70476
  __decorate$1([
70435
70477
  observable
70436
70478
  ], Table$1.prototype, "rowElements", void 0);
70437
- __decorate$1([
70438
- observable
70439
- ], Table$1.prototype, "actionMenuSlots", void 0);
70440
70479
  __decorate$1([
70441
70480
  observable
70442
70481
  ], Table$1.prototype, "openActionMenuRecordId", void 0);
@@ -70461,6 +70500,12 @@ focus outline in that case.
70461
70500
  __decorate$1([
70462
70501
  observable
70463
70502
  ], Table$1.prototype, "showCollapseAll", void 0);
70503
+ __decorate$1([
70504
+ observable
70505
+ ], Table$1.prototype, "canHaveCollapsibleRows", void 0);
70506
+ __decorate$1([
70507
+ volatile
70508
+ ], Table$1.prototype, "collapseButtonVisibility", null);
70464
70509
  __decorate$1([
70465
70510
  observable
70466
70511
  ], Table$1.prototype, "firstSortedColumn", void 0);