@ni/nimble-components 18.12.4 → 18.12.5

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 (30) hide show
  1. package/dist/all-components-bundle.js +82 -14
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +679 -646
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/table/components/cell/styles.js +3 -6
  6. package/dist/esm/table/components/cell/styles.js.map +1 -1
  7. package/dist/esm/table/components/header/index.d.ts +1 -0
  8. package/dist/esm/table/components/header/index.js +5 -1
  9. package/dist/esm/table/components/header/index.js.map +1 -1
  10. package/dist/esm/table/components/header/styles.js +4 -2
  11. package/dist/esm/table/components/header/styles.js.map +1 -1
  12. package/dist/esm/table/components/header/template.js +4 -0
  13. package/dist/esm/table/components/header/template.js.map +1 -1
  14. package/dist/esm/table/components/row/index.js +1 -1
  15. package/dist/esm/table/components/row/index.js.map +1 -1
  16. package/dist/esm/table/components/row/styles.js +5 -0
  17. package/dist/esm/table/components/row/styles.js.map +1 -1
  18. package/dist/esm/table/components/row/template.js +3 -0
  19. package/dist/esm/table/components/row/template.js.map +1 -1
  20. package/dist/esm/table/index.d.ts +7 -1
  21. package/dist/esm/table/index.js +19 -0
  22. package/dist/esm/table/index.js.map +1 -1
  23. package/dist/esm/table/styles.js +13 -1
  24. package/dist/esm/table/styles.js.map +1 -1
  25. package/dist/esm/table/template.js +15 -2
  26. package/dist/esm/table/template.js.map +1 -1
  27. package/dist/esm/table-column/base/types.d.ts +1 -1
  28. package/dist/esm/table-column/base/types.js +14 -1
  29. package/dist/esm/table-column/base/types.js.map +1 -1
  30. package/package.json +1 -1
@@ -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 Tue, 25 Apr 2023 20:25:48 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
  /**
@@ -27834,7 +27834,20 @@
27834
27834
  */
27835
27835
  localeAwareCaseSensitive: 'localeAwareCaseSensitive'
27836
27836
  };
27837
- const defaultMinPixelWidth = 88;
27837
+ const groupIconSize = 16;
27838
+ const sortIconSize = 16;
27839
+ const spacing = 8;
27840
+ const menuDropdownSize = 24;
27841
+ const oneCharPlusEllipsisSize = 21;
27842
+ const defaultMinPixelWidth = spacing
27843
+ + oneCharPlusEllipsisSize
27844
+ + spacing
27845
+ + sortIconSize
27846
+ + spacing
27847
+ + groupIconSize
27848
+ + spacing
27849
+ + menuDropdownSize
27850
+ + spacing;
27838
27851
  const defaultFractionalWidth = 1;
27839
27852
 
27840
27853
  /**
@@ -28194,6 +28207,7 @@
28194
28207
  width: fit-content;
28195
28208
  min-width: 100%;
28196
28209
  left: var(--ni-private-table-scroll-x);
28210
+ align-items: center;
28197
28211
  }
28198
28212
 
28199
28213
  .column-header-container {
@@ -28202,6 +28216,17 @@
28202
28216
  grid-template-columns: var(--ni-private-table-row-grid-columns) auto;
28203
28217
  }
28204
28218
 
28219
+ .collapse-all-button {
28220
+ width: ${controlSlimHeight};
28221
+ height: ${controlSlimHeight};
28222
+ margin-left: calc(${smallPadding} * 2);
28223
+ visibility: hidden;
28224
+ }
28225
+
28226
+ .collapse-all-button.visible {
28227
+ visibility: visible;
28228
+ }
28229
+
28205
28230
  .header-scrollbar-spacer {
28206
28231
  width: var(--ni-private-table-header-scrollbar-spacer-width);
28207
28232
  }
@@ -28250,10 +28275,12 @@
28250
28275
  color: ${tableHeaderFontColor};
28251
28276
  ${iconColor.cssCustomProperty}: ${tableHeaderFontColor};
28252
28277
  text-transform: uppercase;
28278
+ gap: calc(${standardPadding} / 2);
28253
28279
  }
28254
28280
 
28255
- .sort-indicator {
28256
- padding: 0px calc(${standardPadding} / 2);
28281
+ .sort-indicator,
28282
+ .grouped-indicator {
28283
+ flex: 0 0 auto;
28257
28284
  }
28258
28285
  `;
28259
28286
 
@@ -28268,6 +28295,9 @@
28268
28295
  ${when(x => x.sortDirection === TableColumnSortDirection.descending, html `
28269
28296
  <${iconArrowDownTag} class="sort-indicator" aria-hidden="true"></${iconArrowDownTag}>
28270
28297
  `)}
28298
+ ${when(x => x.isGrouped, html `
28299
+ <${iconTwoSquaresInBracketsTag} class="grouped-indicator"></${iconTwoSquaresInBracketsTag}>
28300
+ `)}
28271
28301
  </template>
28272
28302
  `;
28273
28303
 
@@ -28280,6 +28310,7 @@
28280
28310
  super(...arguments);
28281
28311
  this.sortDirection = TableColumnSortDirection.none;
28282
28312
  this.firstSortedColumn = false;
28313
+ this.isGrouped = false;
28283
28314
  }
28284
28315
  sortDirectionChanged(_prev, _next) {
28285
28316
  this.updateAriaSort();
@@ -28306,6 +28337,9 @@
28306
28337
  __decorate$1([
28307
28338
  attr({ attribute: 'first-sorted-column', mode: 'boolean' })
28308
28339
  ], TableHeader.prototype, "firstSortedColumn", void 0);
28340
+ __decorate$1([
28341
+ observable
28342
+ ], TableHeader.prototype, "isGrouped", void 0);
28309
28343
  const nimbleTableHeader = TableHeader.compose({
28310
28344
  baseName: 'table-header',
28311
28345
  template: template$c,
@@ -28361,6 +28395,11 @@
28361
28395
  padding-left: 0px;
28362
28396
  }
28363
28397
 
28398
+ .row-front-spacer {
28399
+ width: ${controlHeight};
28400
+ flex: 0 0 auto;
28401
+ }
28402
+
28364
28403
  .cell-container {
28365
28404
  display: grid;
28366
28405
  width: 100%;
@@ -28405,11 +28444,8 @@
28405
28444
  --ni-private-table-cell-nesting-level: 0;
28406
28445
  padding: 0px calc(${standardPadding} / 2);
28407
28446
  padding-left: calc(
28408
- ${standardPadding} / 2 +
28409
- (
28410
- var(--ni-private-table-cell-nesting-level) *
28411
- ${standardPadding} * 2
28412
- )
28447
+ ${smallPadding} * 2 + ${standardPadding} * 2 *
28448
+ var(--ni-private-table-cell-nesting-level)
28413
28449
  );
28414
28450
  align-self: center;
28415
28451
  height: 100%;
@@ -28510,6 +28546,9 @@
28510
28546
  </${checkboxTag}>
28511
28547
  </span>
28512
28548
  `)}
28549
+ ${'' /* This is needed to help align the cell widths exactly with the column headers, due to the space reserved for
28550
+ the collapse-all button in the header. */}
28551
+ <span class="row-front-spacer"></span>
28513
28552
 
28514
28553
  <span ${ref('cellContainer')} class="cell-container">
28515
28554
  ${repeat(x => x.columnStates, html `
@@ -28579,7 +28618,7 @@
28579
28618
  columnConfig: {}
28580
28619
  };
28581
28620
  }
28582
- const cellIndentLevel = i === 0 ? this.nestingLevel : 0;
28621
+ const cellIndentLevel = i === 0 && this.nestingLevel > 0 ? this.nestingLevel - 1 : 0;
28583
28622
  return { column, cellState, cellIndentLevel };
28584
28623
  });
28585
28624
  }
@@ -28926,7 +28965,7 @@
28926
28965
  --ni-private-table-header-scrollbar-spacer-width: ${x => x.virtualizer.headerContainerMarginRight}px;
28927
28966
  --ni-private-table-scroll-height: ${x => x.virtualizer.allRowsHeight}px;
28928
28967
  --ni-private-table-row-container-top: ${x => x.virtualizer.rowContainerYOffset}px;
28929
- --ni-private-table-row-grid-columns: ${x => x.rowGridColumns ?? ''}
28968
+ --ni-private-table-row-grid-columns: ${x => x.rowGridColumns ?? ''};
28930
28969
  ">
28931
28970
  <div role="rowgroup" class="header-container">
28932
28971
  <div class="header-row" role="row">
@@ -28940,7 +28979,16 @@
28940
28979
  </${checkboxTag}>
28941
28980
  </span>
28942
28981
  `)}
28943
-
28982
+ <span role="gridcell">
28983
+ <${buttonTag}
28984
+ class="collapse-all-button ${x => `${x.showCollapseAll ? 'visible' : ''}`}"
28985
+ content-hidden
28986
+ appearance="${ButtonAppearance.ghost}"
28987
+ @click="${x => x.handleCollapseAllGroupRows()}"
28988
+ >
28989
+ <${iconTriangleTwoLinesHorizontalTag} slot="start"></${iconTriangleTwoLinesHorizontalTag}>
28990
+ </${buttonTag}>
28991
+ </span>
28944
28992
  <span class="column-header-container">
28945
28993
  ${repeat(x => x.columns, html `
28946
28994
  ${when(x => !x.columnHidden, html `
@@ -28948,6 +28996,7 @@
28948
28996
  class="header"
28949
28997
  sort-direction="${x => (typeof x.sortIndex === 'number' ? x.sortDirection : TableColumnSortDirection.none)}"
28950
28998
  ?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
28999
+ :isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
28951
29000
  >
28952
29001
  <slot name="${x => x.slot}"></slot>
28953
29002
  </${tableHeaderTag}>
@@ -29977,6 +30026,10 @@
29977
30026
  * @internal
29978
30027
  */
29979
30028
  this.selectionState = TableRowSelectionState.notSelected;
30029
+ /**
30030
+ * @internal
30031
+ */
30032
+ this.showCollapseAll = false;
29980
30033
  this.tableValidator = new TableValidator();
29981
30034
  this.updateTracker = new UpdateTracker(this);
29982
30035
  this.columnNotifiers = [];
@@ -30196,6 +30249,15 @@
30196
30249
  }
30197
30250
  }
30198
30251
  /** @internal */
30252
+ handleCollapseAllGroupRows() {
30253
+ this.collapsedRows.clear();
30254
+ this.table
30255
+ .getRowModel()
30256
+ .flatRows.filter(row => row.getIsGrouped())
30257
+ .forEach(row => this.collapsedRows.add(row.id));
30258
+ this.table.toggleAllRowsExpanded(false);
30259
+ }
30260
+ /** @internal */
30199
30261
  handleGroupRowExpanded(rowIndex, event) {
30200
30262
  this.toggleGroupExpanded(rowIndex);
30201
30263
  event.stopPropagation();
@@ -30214,6 +30276,9 @@
30214
30276
  if (this.updateTracker.updateColumnWidths) {
30215
30277
  this.updateRowGridColumns();
30216
30278
  }
30279
+ if (this.updateTracker.updateGroupRows) {
30280
+ this.showCollapseAll = this.getColumnsParticipatingInGrouping().length > 0;
30281
+ }
30217
30282
  }
30218
30283
  get ariaMultiSelectable() {
30219
30284
  switch (this.selectionMode) {
@@ -30595,6 +30660,9 @@
30595
30660
  __decorate$1([
30596
30661
  observable
30597
30662
  ], Table.prototype, "selectionCheckbox", void 0);
30663
+ __decorate$1([
30664
+ observable
30665
+ ], Table.prototype, "showCollapseAll", void 0);
30598
30666
  __decorate$1([
30599
30667
  observable
30600
30668
  ], Table.prototype, "firstSortedColumn", void 0);