@ni/nimble-components 18.12.4 → 18.12.6

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 (32) hide show
  1. package/dist/all-components-bundle.js +84 -14
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +681 -646
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/spinner/styles.js +2 -0
  6. package/dist/esm/spinner/styles.js.map +1 -1
  7. package/dist/esm/table/components/cell/styles.js +3 -6
  8. package/dist/esm/table/components/cell/styles.js.map +1 -1
  9. package/dist/esm/table/components/header/index.d.ts +1 -0
  10. package/dist/esm/table/components/header/index.js +5 -1
  11. package/dist/esm/table/components/header/index.js.map +1 -1
  12. package/dist/esm/table/components/header/styles.js +4 -2
  13. package/dist/esm/table/components/header/styles.js.map +1 -1
  14. package/dist/esm/table/components/header/template.js +4 -0
  15. package/dist/esm/table/components/header/template.js.map +1 -1
  16. package/dist/esm/table/components/row/index.js +1 -1
  17. package/dist/esm/table/components/row/index.js.map +1 -1
  18. package/dist/esm/table/components/row/styles.js +5 -0
  19. package/dist/esm/table/components/row/styles.js.map +1 -1
  20. package/dist/esm/table/components/row/template.js +3 -0
  21. package/dist/esm/table/components/row/template.js.map +1 -1
  22. package/dist/esm/table/index.d.ts +7 -1
  23. package/dist/esm/table/index.js +19 -0
  24. package/dist/esm/table/index.js.map +1 -1
  25. package/dist/esm/table/styles.js +13 -1
  26. package/dist/esm/table/styles.js.map +1 -1
  27. package/dist/esm/table/template.js +15 -2
  28. package/dist/esm/table/template.js.map +1 -1
  29. package/dist/esm/table-column/base/types.d.ts +1 -1
  30. package/dist/esm/table-column/base/types.js +14 -1
  31. package/dist/esm/table-column/base/types.js.map +1 -1
  32. package/package.json +2 -2
@@ -16356,7 +16356,7 @@
16356
16356
 
16357
16357
  /**
16358
16358
  * Do not edit directly
16359
- * Generated on Tue, 25 Apr 2023 17:52:52 GMT
16359
+ * Generated on Wed, 26 Apr 2023 17:25:12 GMT
16360
16360
  */
16361
16361
  const Information100DarkUi = "#a46eff";
16362
16362
  const Information100LightUi = "#804ad9";
@@ -22934,7 +22934,7 @@
22934
22934
  }
22935
22935
  }
22936
22936
  registerIcon('icon-triangle-two-lines-horizontal', IconTriangleTwoLinesHorizontal);
22937
- DesignSystem.tagFor(IconTriangleTwoLinesHorizontal);
22937
+ const iconTriangleTwoLinesHorizontalTag = DesignSystem.tagFor(IconTriangleTwoLinesHorizontal);
22938
22938
 
22939
22939
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22940
22940
  /**
@@ -22958,7 +22958,7 @@
22958
22958
  }
22959
22959
  }
22960
22960
  registerIcon('icon-two-squares-in-brackets', IconTwoSquaresInBrackets);
22961
- DesignSystem.tagFor(IconTwoSquaresInBrackets);
22961
+ const iconTwoSquaresInBracketsTag = DesignSystem.tagFor(IconTwoSquaresInBrackets);
22962
22962
 
22963
22963
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22964
22964
  /**
@@ -24174,6 +24174,7 @@
24174
24174
  :host {
24175
24175
  height: ${spinnerSmallHeight};
24176
24176
  aspect-ratio: 1 / 1;
24177
+ --ni-private-spinner-animation-play-state: running;
24177
24178
  }
24178
24179
 
24179
24180
  div.container {
@@ -24199,6 +24200,7 @@
24199
24200
  margin: auto;
24200
24201
  animation-duration: 1600ms;
24201
24202
  animation-iteration-count: infinite;
24203
+ animation-play-state: var(--ni-private-spinner-animation-play-state);
24202
24204
  animation-timing-function: cubic-bezier(0.65, 0, 0.35, 0);
24203
24205
  }
24204
24206
 
@@ -27834,7 +27836,20 @@
27834
27836
  */
27835
27837
  localeAwareCaseSensitive: 'localeAwareCaseSensitive'
27836
27838
  };
27837
- const defaultMinPixelWidth = 88;
27839
+ const groupIconSize = 16;
27840
+ const sortIconSize = 16;
27841
+ const spacing = 8;
27842
+ const menuDropdownSize = 24;
27843
+ const oneCharPlusEllipsisSize = 21;
27844
+ const defaultMinPixelWidth = spacing
27845
+ + oneCharPlusEllipsisSize
27846
+ + spacing
27847
+ + sortIconSize
27848
+ + spacing
27849
+ + groupIconSize
27850
+ + spacing
27851
+ + menuDropdownSize
27852
+ + spacing;
27838
27853
  const defaultFractionalWidth = 1;
27839
27854
 
27840
27855
  /**
@@ -28194,6 +28209,7 @@
28194
28209
  width: fit-content;
28195
28210
  min-width: 100%;
28196
28211
  left: var(--ni-private-table-scroll-x);
28212
+ align-items: center;
28197
28213
  }
28198
28214
 
28199
28215
  .column-header-container {
@@ -28202,6 +28218,17 @@
28202
28218
  grid-template-columns: var(--ni-private-table-row-grid-columns) auto;
28203
28219
  }
28204
28220
 
28221
+ .collapse-all-button {
28222
+ width: ${controlSlimHeight};
28223
+ height: ${controlSlimHeight};
28224
+ margin-left: calc(${smallPadding} * 2);
28225
+ visibility: hidden;
28226
+ }
28227
+
28228
+ .collapse-all-button.visible {
28229
+ visibility: visible;
28230
+ }
28231
+
28205
28232
  .header-scrollbar-spacer {
28206
28233
  width: var(--ni-private-table-header-scrollbar-spacer-width);
28207
28234
  }
@@ -28250,10 +28277,12 @@
28250
28277
  color: ${tableHeaderFontColor};
28251
28278
  ${iconColor.cssCustomProperty}: ${tableHeaderFontColor};
28252
28279
  text-transform: uppercase;
28280
+ gap: calc(${standardPadding} / 2);
28253
28281
  }
28254
28282
 
28255
- .sort-indicator {
28256
- padding: 0px calc(${standardPadding} / 2);
28283
+ .sort-indicator,
28284
+ .grouped-indicator {
28285
+ flex: 0 0 auto;
28257
28286
  }
28258
28287
  `;
28259
28288
 
@@ -28268,6 +28297,9 @@
28268
28297
  ${when(x => x.sortDirection === TableColumnSortDirection.descending, html `
28269
28298
  <${iconArrowDownTag} class="sort-indicator" aria-hidden="true"></${iconArrowDownTag}>
28270
28299
  `)}
28300
+ ${when(x => x.isGrouped, html `
28301
+ <${iconTwoSquaresInBracketsTag} class="grouped-indicator"></${iconTwoSquaresInBracketsTag}>
28302
+ `)}
28271
28303
  </template>
28272
28304
  `;
28273
28305
 
@@ -28280,6 +28312,7 @@
28280
28312
  super(...arguments);
28281
28313
  this.sortDirection = TableColumnSortDirection.none;
28282
28314
  this.firstSortedColumn = false;
28315
+ this.isGrouped = false;
28283
28316
  }
28284
28317
  sortDirectionChanged(_prev, _next) {
28285
28318
  this.updateAriaSort();
@@ -28306,6 +28339,9 @@
28306
28339
  __decorate$1([
28307
28340
  attr({ attribute: 'first-sorted-column', mode: 'boolean' })
28308
28341
  ], TableHeader.prototype, "firstSortedColumn", void 0);
28342
+ __decorate$1([
28343
+ observable
28344
+ ], TableHeader.prototype, "isGrouped", void 0);
28309
28345
  const nimbleTableHeader = TableHeader.compose({
28310
28346
  baseName: 'table-header',
28311
28347
  template: template$c,
@@ -28361,6 +28397,11 @@
28361
28397
  padding-left: 0px;
28362
28398
  }
28363
28399
 
28400
+ .row-front-spacer {
28401
+ width: ${controlHeight};
28402
+ flex: 0 0 auto;
28403
+ }
28404
+
28364
28405
  .cell-container {
28365
28406
  display: grid;
28366
28407
  width: 100%;
@@ -28405,11 +28446,8 @@
28405
28446
  --ni-private-table-cell-nesting-level: 0;
28406
28447
  padding: 0px calc(${standardPadding} / 2);
28407
28448
  padding-left: calc(
28408
- ${standardPadding} / 2 +
28409
- (
28410
- var(--ni-private-table-cell-nesting-level) *
28411
- ${standardPadding} * 2
28412
- )
28449
+ ${smallPadding} * 2 + ${standardPadding} * 2 *
28450
+ var(--ni-private-table-cell-nesting-level)
28413
28451
  );
28414
28452
  align-self: center;
28415
28453
  height: 100%;
@@ -28510,6 +28548,9 @@
28510
28548
  </${checkboxTag}>
28511
28549
  </span>
28512
28550
  `)}
28551
+ ${'' /* This is needed to help align the cell widths exactly with the column headers, due to the space reserved for
28552
+ the collapse-all button in the header. */}
28553
+ <span class="row-front-spacer"></span>
28513
28554
 
28514
28555
  <span ${ref('cellContainer')} class="cell-container">
28515
28556
  ${repeat(x => x.columnStates, html `
@@ -28579,7 +28620,7 @@
28579
28620
  columnConfig: {}
28580
28621
  };
28581
28622
  }
28582
- const cellIndentLevel = i === 0 ? this.nestingLevel : 0;
28623
+ const cellIndentLevel = i === 0 && this.nestingLevel > 0 ? this.nestingLevel - 1 : 0;
28583
28624
  return { column, cellState, cellIndentLevel };
28584
28625
  });
28585
28626
  }
@@ -28926,7 +28967,7 @@
28926
28967
  --ni-private-table-header-scrollbar-spacer-width: ${x => x.virtualizer.headerContainerMarginRight}px;
28927
28968
  --ni-private-table-scroll-height: ${x => x.virtualizer.allRowsHeight}px;
28928
28969
  --ni-private-table-row-container-top: ${x => x.virtualizer.rowContainerYOffset}px;
28929
- --ni-private-table-row-grid-columns: ${x => x.rowGridColumns ?? ''}
28970
+ --ni-private-table-row-grid-columns: ${x => x.rowGridColumns ?? ''};
28930
28971
  ">
28931
28972
  <div role="rowgroup" class="header-container">
28932
28973
  <div class="header-row" role="row">
@@ -28940,7 +28981,16 @@
28940
28981
  </${checkboxTag}>
28941
28982
  </span>
28942
28983
  `)}
28943
-
28984
+ <span role="gridcell">
28985
+ <${buttonTag}
28986
+ class="collapse-all-button ${x => `${x.showCollapseAll ? 'visible' : ''}`}"
28987
+ content-hidden
28988
+ appearance="${ButtonAppearance.ghost}"
28989
+ @click="${x => x.handleCollapseAllGroupRows()}"
28990
+ >
28991
+ <${iconTriangleTwoLinesHorizontalTag} slot="start"></${iconTriangleTwoLinesHorizontalTag}>
28992
+ </${buttonTag}>
28993
+ </span>
28944
28994
  <span class="column-header-container">
28945
28995
  ${repeat(x => x.columns, html `
28946
28996
  ${when(x => !x.columnHidden, html `
@@ -28948,6 +28998,7 @@
28948
28998
  class="header"
28949
28999
  sort-direction="${x => (typeof x.sortIndex === 'number' ? x.sortDirection : TableColumnSortDirection.none)}"
28950
29000
  ?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
29001
+ :isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
28951
29002
  >
28952
29003
  <slot name="${x => x.slot}"></slot>
28953
29004
  </${tableHeaderTag}>
@@ -29977,6 +30028,10 @@
29977
30028
  * @internal
29978
30029
  */
29979
30030
  this.selectionState = TableRowSelectionState.notSelected;
30031
+ /**
30032
+ * @internal
30033
+ */
30034
+ this.showCollapseAll = false;
29980
30035
  this.tableValidator = new TableValidator();
29981
30036
  this.updateTracker = new UpdateTracker(this);
29982
30037
  this.columnNotifiers = [];
@@ -30196,6 +30251,15 @@
30196
30251
  }
30197
30252
  }
30198
30253
  /** @internal */
30254
+ handleCollapseAllGroupRows() {
30255
+ this.collapsedRows.clear();
30256
+ this.table
30257
+ .getRowModel()
30258
+ .flatRows.filter(row => row.getIsGrouped())
30259
+ .forEach(row => this.collapsedRows.add(row.id));
30260
+ this.table.toggleAllRowsExpanded(false);
30261
+ }
30262
+ /** @internal */
30199
30263
  handleGroupRowExpanded(rowIndex, event) {
30200
30264
  this.toggleGroupExpanded(rowIndex);
30201
30265
  event.stopPropagation();
@@ -30214,6 +30278,9 @@
30214
30278
  if (this.updateTracker.updateColumnWidths) {
30215
30279
  this.updateRowGridColumns();
30216
30280
  }
30281
+ if (this.updateTracker.updateGroupRows) {
30282
+ this.showCollapseAll = this.getColumnsParticipatingInGrouping().length > 0;
30283
+ }
30217
30284
  }
30218
30285
  get ariaMultiSelectable() {
30219
30286
  switch (this.selectionMode) {
@@ -30595,6 +30662,9 @@
30595
30662
  __decorate$1([
30596
30663
  observable
30597
30664
  ], Table.prototype, "selectionCheckbox", void 0);
30665
+ __decorate$1([
30666
+ observable
30667
+ ], Table.prototype, "showCollapseAll", void 0);
30598
30668
  __decorate$1([
30599
30669
  observable
30600
30670
  ], Table.prototype, "firstSortedColumn", void 0);