@ni/nimble-components 18.12.3 → 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 (33) hide show
  1. package/dist/all-components-bundle.js +153 -70
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +1768 -1720
  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/group-row/styles.js +29 -7
  8. package/dist/esm/table/components/group-row/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 +50 -4
  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 +19 -47
  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/dist/esm/theme-provider/design-tokens.js +1 -1
  33. package/package.json +1 -1
@@ -16356,7 +16356,7 @@
16356
16356
 
16357
16357
  /**
16358
16358
  * Do not edit directly
16359
- * Generated on Fri, 21 Apr 2023 15:58:04 GMT
16359
+ * Generated on Tue, 25 Apr 2023 20:25:48 GMT
16360
16360
  */
16361
16361
  const Information100DarkUi = "#a46eff";
16362
16362
  const Information100LightUi = "#804ad9";
@@ -16834,7 +16834,7 @@
16834
16834
  DesignToken.create(styleNameFromTokenName(tokenNames.modalBackdropColor)).withDefault((element) => getModalBackdropForTheme(element));
16835
16835
  const popupBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.popupBorderColor)).withDefault((element) => hexToRgbaCssColor(getColorForTheme(element, Black91, Black15, White), 0.3));
16836
16836
  DesignToken.create(styleNameFromTokenName(tokenNames.tooltipBackgroundColor)).withDefault((element) => getColorForTheme(element, Black15, Black85, ForestGreen));
16837
- const tableRowBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.tableRowBorderColor)).withDefault((element) => getColorForTheme(element, Black15, Black88, ForestGreen));
16837
+ const tableRowBorderColor = DesignToken.create(styleNameFromTokenName(tokenNames.tableRowBorderColor)).withDefault((element) => getColorForTheme(element, Black15, Black80, ForestGreen));
16838
16838
  // Component Sizing Tokens
16839
16839
  const controlHeight = DesignToken.create(styleNameFromTokenName(tokenNames.controlHeight)).withDefault('32px');
16840
16840
  const controlSlimHeight = DesignToken.create(styleNameFromTokenName(tokenNames.controlSlimHeight)).withDefault('24px');
@@ -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
  /**
@@ -28179,6 +28192,7 @@
28179
28192
  width: 100%;
28180
28193
  position: relative;
28181
28194
  top: var(--ni-private-table-row-container-top);
28195
+ background-color: ${tableRowBorderColor};
28182
28196
  }
28183
28197
 
28184
28198
  .header-container {
@@ -28193,6 +28207,7 @@
28193
28207
  width: fit-content;
28194
28208
  min-width: 100%;
28195
28209
  left: var(--ni-private-table-scroll-x);
28210
+ align-items: center;
28196
28211
  }
28197
28212
 
28198
28213
  .column-header-container {
@@ -28201,6 +28216,17 @@
28201
28216
  grid-template-columns: var(--ni-private-table-row-grid-columns) auto;
28202
28217
  }
28203
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
+
28204
28230
  .header-scrollbar-spacer {
28205
28231
  width: var(--ni-private-table-header-scrollbar-spacer-width);
28206
28232
  }
@@ -28221,61 +28247,20 @@
28221
28247
  padding-left: 0px;
28222
28248
  }
28223
28249
 
28224
- .row {
28225
- background: ${applicationBackgroundColor};
28250
+ .group-row {
28226
28251
  position: relative;
28227
- box-sizing: border-box;
28228
28252
  }
28229
28253
 
28230
- .row::before {
28231
- content: '';
28232
- width: 100%;
28233
- height: 100%;
28234
- position: absolute;
28235
- pointer-events: none;
28236
- }
28237
-
28238
- :host([selection-mode='single']) .row:hover::before,
28239
- :host([selection-mode='multiple']) .row:hover::before {
28240
- background: ${fillHoverColor};
28241
- }
28242
-
28243
- :host([selection-mode='single']) .row[selected]::before,
28244
- :host([selection-mode='multiple']) .row[selected]::before {
28245
- background: ${fillSelectedColor};
28246
- }
28247
-
28248
- :host([selection-mode='single']) .row[selected]:hover::before,
28249
- :host([selection-mode='multiple']) .row[selected]:hover::before {
28250
- background: ${fillHoverSelectedColor};
28254
+ .row {
28255
+ position: relative;
28251
28256
  }
28252
28257
  `.withBehaviors(themeBehavior(Theme.color, css `
28253
- .header-row::before {
28258
+ .table-row-container::before {
28254
28259
  content: '';
28255
28260
  width: 100%;
28256
28261
  height: 100%;
28262
+ background-color: ${hexToRgbaCssColor(White, 0.1)};
28257
28263
  position: absolute;
28258
- background: ${fillHoverColor};
28259
- pointer-events: none;
28260
- }
28261
-
28262
- .row::before {
28263
- background: ${fillHoverColor};
28264
- }
28265
-
28266
- :host([selection-mode='single']) .row:hover::before,
28267
- :host([selection-mode='multiple']) .row:hover::before {
28268
- background: ${hexToRgbaCssColor(White, 0.15)};
28269
- }
28270
-
28271
- :host([selection-mode='single']) .row[selected]::before,
28272
- :host([selection-mode='multiple']) .row[selected]::before {
28273
- background: ${hexToRgbaCssColor(White, 0.25)};
28274
- }
28275
-
28276
- :host([selection-mode='single']) .row[selected]:hover::before,
28277
- :host([selection-mode='multiple']) .row[selected]:hover::before {
28278
- background: ${hexToRgbaCssColor(White, 0.2)};
28279
28264
  }
28280
28265
  `));
28281
28266
 
@@ -28290,10 +28275,12 @@
28290
28275
  color: ${tableHeaderFontColor};
28291
28276
  ${iconColor.cssCustomProperty}: ${tableHeaderFontColor};
28292
28277
  text-transform: uppercase;
28278
+ gap: calc(${standardPadding} / 2);
28293
28279
  }
28294
28280
 
28295
- .sort-indicator {
28296
- padding: 0px calc(${standardPadding} / 2);
28281
+ .sort-indicator,
28282
+ .grouped-indicator {
28283
+ flex: 0 0 auto;
28297
28284
  }
28298
28285
  `;
28299
28286
 
@@ -28308,6 +28295,9 @@
28308
28295
  ${when(x => x.sortDirection === TableColumnSortDirection.descending, html `
28309
28296
  <${iconArrowDownTag} class="sort-indicator" aria-hidden="true"></${iconArrowDownTag}>
28310
28297
  `)}
28298
+ ${when(x => x.isGrouped, html `
28299
+ <${iconTwoSquaresInBracketsTag} class="grouped-indicator"></${iconTwoSquaresInBracketsTag}>
28300
+ `)}
28311
28301
  </template>
28312
28302
  `;
28313
28303
 
@@ -28320,6 +28310,7 @@
28320
28310
  super(...arguments);
28321
28311
  this.sortDirection = TableColumnSortDirection.none;
28322
28312
  this.firstSortedColumn = false;
28313
+ this.isGrouped = false;
28323
28314
  }
28324
28315
  sortDirectionChanged(_prev, _next) {
28325
28316
  this.updateAriaSort();
@@ -28346,6 +28337,9 @@
28346
28337
  __decorate$1([
28347
28338
  attr({ attribute: 'first-sorted-column', mode: 'boolean' })
28348
28339
  ], TableHeader.prototype, "firstSortedColumn", void 0);
28340
+ __decorate$1([
28341
+ observable
28342
+ ], TableHeader.prototype, "isGrouped", void 0);
28349
28343
  const nimbleTableHeader = TableHeader.compose({
28350
28344
  baseName: 'table-header',
28351
28345
  template: template$c,
@@ -28358,10 +28352,35 @@
28358
28352
  ${display('flex')}
28359
28353
 
28360
28354
  :host {
28361
- height: calc(${controlHeight} + 2 * ${borderWidth});
28362
- border-top: calc(2 * ${borderWidth}) solid ${tableRowBorderColor};
28363
28355
  width: fit-content;
28364
28356
  min-width: 100%;
28357
+ background-color: ${applicationBackgroundColor};
28358
+ height: calc(${controlHeight} + 2 * ${borderWidth});
28359
+ border-top: calc(2 * ${borderWidth}) solid transparent;
28360
+ box-sizing: border-box;
28361
+ background-clip: padding-box;
28362
+ }
28363
+
28364
+ :host::before {
28365
+ content: '';
28366
+ width: 100%;
28367
+ height: ${controlHeight};
28368
+ pointer-events: none;
28369
+ box-sizing: border-box;
28370
+ bottom: 0px;
28371
+ position: absolute;
28372
+ }
28373
+
28374
+ :host([selectable]:not([selected]):hover)::before {
28375
+ background-color: ${fillHoverColor};
28376
+ }
28377
+
28378
+ :host([selected])::before {
28379
+ background-color: ${fillSelectedColor};
28380
+ }
28381
+
28382
+ :host([selected]:hover)::before {
28383
+ background-color: ${fillHoverSelectedColor};
28365
28384
  }
28366
28385
 
28367
28386
  .checkbox-container {
@@ -28376,6 +28395,11 @@
28376
28395
  padding-left: 0px;
28377
28396
  }
28378
28397
 
28398
+ .row-front-spacer {
28399
+ width: ${controlHeight};
28400
+ flex: 0 0 auto;
28401
+ }
28402
+
28379
28403
  .cell-container {
28380
28404
  display: grid;
28381
28405
  width: 100%;
@@ -28399,7 +28423,19 @@
28399
28423
  :host([selected]) nimble-table-cell {
28400
28424
  --ni-private-table-cell-action-menu-display: block;
28401
28425
  }
28402
- `;
28426
+ `.withBehaviors(themeBehavior(Theme.color, css `
28427
+ :host([selectable]:not([selected]):hover)::before {
28428
+ background-color: ${hexToRgbaCssColor(White, 0.05)};
28429
+ }
28430
+
28431
+ :host([selected])::before {
28432
+ background-color: ${hexToRgbaCssColor(White, 0.25)};
28433
+ }
28434
+
28435
+ :host([selected]:hover)::before {
28436
+ background-color: ${hexToRgbaCssColor(White, 0.2)};
28437
+ }
28438
+ `));
28403
28439
 
28404
28440
  const styles$d = css `
28405
28441
  ${display('grid')}
@@ -28408,11 +28444,8 @@
28408
28444
  --ni-private-table-cell-nesting-level: 0;
28409
28445
  padding: 0px calc(${standardPadding} / 2);
28410
28446
  padding-left: calc(
28411
- ${standardPadding} / 2 +
28412
- (
28413
- var(--ni-private-table-cell-nesting-level) *
28414
- ${standardPadding} * 2
28415
- )
28447
+ ${smallPadding} * 2 + ${standardPadding} * 2 *
28448
+ var(--ni-private-table-cell-nesting-level)
28416
28449
  );
28417
28450
  align-self: center;
28418
28451
  height: 100%;
@@ -28513,6 +28546,9 @@
28513
28546
  </${checkboxTag}>
28514
28547
  </span>
28515
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>
28516
28552
 
28517
28553
  <span ${ref('cellContainer')} class="cell-container">
28518
28554
  ${repeat(x => x.columnStates, html `
@@ -28582,7 +28618,7 @@
28582
28618
  columnConfig: {}
28583
28619
  };
28584
28620
  }
28585
- const cellIndentLevel = i === 0 ? this.nestingLevel : 0;
28621
+ const cellIndentLevel = i === 0 && this.nestingLevel > 0 ? this.nestingLevel - 1 : 0;
28586
28622
  return { column, cellState, cellIndentLevel };
28587
28623
  });
28588
28624
  }
@@ -28695,11 +28731,8 @@
28695
28731
  :host {
28696
28732
  align-items: center;
28697
28733
  height: calc(${controlHeight} + 2 * ${borderWidth});
28698
- border-top: calc(2 * ${borderWidth}) solid ${tableRowBorderColor};
28699
- }
28700
-
28701
- :host(:hover) {
28702
- background: ${fillHoverColor};
28734
+ border-top: calc(2 * ${borderWidth}) solid ${applicationBackgroundColor};
28735
+ box-sizing: border-box;
28703
28736
  }
28704
28737
 
28705
28738
  :host([expanded]) .animating,
@@ -28707,6 +28740,19 @@
28707
28740
  transition: ${mediumDelay} ease-in-out;
28708
28741
  }
28709
28742
 
28743
+ :host::before {
28744
+ content: '';
28745
+ width: 100%;
28746
+ height: ${controlHeight};
28747
+ pointer-events: none;
28748
+ bottom: 0px;
28749
+ position: absolute;
28750
+ }
28751
+
28752
+ :host(:hover)::before {
28753
+ background-color: ${fillHoverColor};
28754
+ }
28755
+
28710
28756
  .expand-collapse-button {
28711
28757
  margin-left: calc(
28712
28758
  ${smallPadding} * 2 + ${standardPadding} * 2 *
@@ -28760,7 +28806,15 @@
28760
28806
  .selection-checkbox::part(label) {
28761
28807
  padding-left: 0px;
28762
28808
  }
28763
- `;
28809
+ `.withBehaviors(themeBehavior(Theme.color, css `
28810
+ :host(:hover)::before {
28811
+ background-color: ${hexToRgbaCssColor(White, 0.05)};
28812
+ }
28813
+ `), themeBehavior(Theme.dark, css `
28814
+ :host(:hover)::before {
28815
+ background-color: ${hexToRgbaCssColor(White, 0.1)};
28816
+ }
28817
+ `));
28764
28818
 
28765
28819
  /* eslint-disable @typescript-eslint/indent */
28766
28820
  // prettier-ignore
@@ -28911,7 +28965,7 @@
28911
28965
  --ni-private-table-header-scrollbar-spacer-width: ${x => x.virtualizer.headerContainerMarginRight}px;
28912
28966
  --ni-private-table-scroll-height: ${x => x.virtualizer.allRowsHeight}px;
28913
28967
  --ni-private-table-row-container-top: ${x => x.virtualizer.rowContainerYOffset}px;
28914
- --ni-private-table-row-grid-columns: ${x => x.rowGridColumns ?? ''}
28968
+ --ni-private-table-row-grid-columns: ${x => x.rowGridColumns ?? ''};
28915
28969
  ">
28916
28970
  <div role="rowgroup" class="header-container">
28917
28971
  <div class="header-row" role="row">
@@ -28925,7 +28979,16 @@
28925
28979
  </${checkboxTag}>
28926
28980
  </span>
28927
28981
  `)}
28928
-
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>
28929
28992
  <span class="column-header-container">
28930
28993
  ${repeat(x => x.columns, html `
28931
28994
  ${when(x => !x.columnHidden, html `
@@ -28933,6 +28996,7 @@
28933
28996
  class="header"
28934
28997
  sort-direction="${x => (typeof x.sortIndex === 'number' ? x.sortDirection : TableColumnSortDirection.none)}"
28935
28998
  ?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
28999
+ :isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
28936
29000
  >
28937
29001
  <slot name="${x => x.slot}"></slot>
28938
29002
  </${tableHeaderTag}>
@@ -29962,6 +30026,10 @@
29962
30026
  * @internal
29963
30027
  */
29964
30028
  this.selectionState = TableRowSelectionState.notSelected;
30029
+ /**
30030
+ * @internal
30031
+ */
30032
+ this.showCollapseAll = false;
29965
30033
  this.tableValidator = new TableValidator();
29966
30034
  this.updateTracker = new UpdateTracker(this);
29967
30035
  this.columnNotifiers = [];
@@ -30181,6 +30249,15 @@
30181
30249
  }
30182
30250
  }
30183
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 */
30184
30261
  handleGroupRowExpanded(rowIndex, event) {
30185
30262
  this.toggleGroupExpanded(rowIndex);
30186
30263
  event.stopPropagation();
@@ -30199,6 +30276,9 @@
30199
30276
  if (this.updateTracker.updateColumnWidths) {
30200
30277
  this.updateRowGridColumns();
30201
30278
  }
30279
+ if (this.updateTracker.updateGroupRows) {
30280
+ this.showCollapseAll = this.getColumnsParticipatingInGrouping().length > 0;
30281
+ }
30202
30282
  }
30203
30283
  get ariaMultiSelectable() {
30204
30284
  switch (this.selectionMode) {
@@ -30580,6 +30660,9 @@
30580
30660
  __decorate$1([
30581
30661
  observable
30582
30662
  ], Table.prototype, "selectionCheckbox", void 0);
30663
+ __decorate$1([
30664
+ observable
30665
+ ], Table.prototype, "showCollapseAll", void 0);
30583
30666
  __decorate$1([
30584
30667
  observable
30585
30668
  ], Table.prototype, "firstSortedColumn", void 0);