@ni/nimble-components 29.8.0 → 29.8.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.
Files changed (38) hide show
  1. package/dist/all-components-bundle.js +55 -33
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +4264 -4255
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/table/components/header/index.d.ts +2 -1
  6. package/dist/esm/table/components/header/index.js +5 -1
  7. package/dist/esm/table/components/header/index.js.map +1 -1
  8. package/dist/esm/table/components/header/styles.js +10 -3
  9. package/dist/esm/table/components/header/styles.js.map +1 -1
  10. package/dist/esm/table/components/header/template.js +2 -1
  11. package/dist/esm/table/components/header/template.js.map +1 -1
  12. package/dist/esm/table/index.d.ts +2 -1
  13. package/dist/esm/table/index.js +15 -14
  14. package/dist/esm/table/index.js.map +1 -1
  15. package/dist/esm/table/template.js +2 -1
  16. package/dist/esm/table/template.js.map +1 -1
  17. package/dist/esm/table/testing/table.pageobject.js +10 -4
  18. package/dist/esm/table/testing/table.pageobject.js.map +1 -1
  19. package/dist/esm/table/types.d.ts +11 -0
  20. package/dist/esm/table/types.js +9 -0
  21. package/dist/esm/table/types.js.map +1 -1
  22. package/dist/esm/table-column/base/models/column-internals.d.ts +5 -1
  23. package/dist/esm/table-column/base/models/column-internals.js +8 -1
  24. package/dist/esm/table-column/base/models/column-internals.js.map +1 -1
  25. package/dist/esm/table-column/number-text/cell-view/index.js +2 -2
  26. package/dist/esm/table-column/number-text/cell-view/index.js.map +1 -1
  27. package/dist/esm/table-column/number-text/index.d.ts +2 -3
  28. package/dist/esm/table-column/number-text/index.js +6 -5
  29. package/dist/esm/table-column/number-text/index.js.map +1 -1
  30. package/dist/esm/table-column/text-base/cell-view/index.d.ts +2 -3
  31. package/dist/esm/table-column/text-base/cell-view/index.js +2 -2
  32. package/dist/esm/table-column/text-base/cell-view/index.js.map +1 -1
  33. package/dist/esm/table-column/text-base/cell-view/template.js +2 -2
  34. package/dist/esm/table-column/text-base/cell-view/template.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/esm/table-column/text-base/cell-view/types.d.ts +0 -8
  37. package/dist/esm/table-column/text-base/cell-view/types.js +0 -8
  38. package/dist/esm/table-column/text-base/cell-view/types.js.map +0 -1
@@ -16333,7 +16333,7 @@
16333
16333
 
16334
16334
  /**
16335
16335
  * Do not edit directly
16336
- * Generated on Wed, 10 Jul 2024 16:10:17 GMT
16336
+ * Generated on Thu, 11 Jul 2024 21:51:38 GMT
16337
16337
  */
16338
16338
 
16339
16339
  const Information100DarkUi = "#a46eff";
@@ -16755,7 +16755,6 @@
16755
16755
  const keyFunction2 = "F2";
16756
16756
  const keyPageDown = "PageDown";
16757
16757
  const keyPageUp = "PageUp";
16758
- const keyShift = "Shift";
16759
16758
  const keySpace = " ";
16760
16759
  const keyTab = "Tab";
16761
16760
 
@@ -64560,6 +64559,15 @@ img.ProseMirror-separator {
64560
64559
  selected: 'selected',
64561
64560
  partiallySelected: 'partially-selected'
64562
64561
  };
64562
+ /**
64563
+ * @internal
64564
+ *
64565
+ * Alignment of column content
64566
+ */
64567
+ const TableColumnAlignment = {
64568
+ left: 'left',
64569
+ right: 'right'
64570
+ };
64563
64571
  /**
64564
64572
  * Table keyboard focus types
64565
64573
  */
@@ -64786,6 +64794,10 @@ img.ProseMirror-separator {
64786
64794
  * when the column is grouped or sorted.
64787
64795
  */
64788
64796
  this.hideHeaderIndicators = false;
64797
+ /**
64798
+ * How to align the header content.
64799
+ */
64800
+ this.headerAlignment = TableColumnAlignment.left;
64789
64801
  /**
64790
64802
  * @internal Do not write to this value directly. It is used by the Table in order to store
64791
64803
  * the resolved value of the fractionalWidth after updates programmatic or interactive updates.
@@ -64850,6 +64862,9 @@ img.ProseMirror-separator {
64850
64862
  __decorate$1([
64851
64863
  observable
64852
64864
  ], ColumnInternals.prototype, "hideHeaderIndicators", void 0);
64865
+ __decorate$1([
64866
+ observable
64867
+ ], ColumnInternals.prototype, "headerAlignment", void 0);
64853
64868
  __decorate$1([
64854
64869
  observable
64855
64870
  ], ColumnInternals.prototype, "currentFractionalWidth", void 0);
@@ -65262,15 +65277,22 @@ focus outline in that case.
65262
65277
  :host {
65263
65278
  height: ${controlHeight};
65264
65279
  align-items: center;
65265
- padding: 0px ${mediumPadding};
65280
+ padding-left: ${mediumPadding};
65281
+ padding-right: ${smallPadding};
65266
65282
  font: ${tableHeaderFont};
65267
65283
  color: ${tableHeaderFontColor};
65268
65284
  ${iconColor.cssCustomProperty}: ${tableHeaderFontColor};
65269
65285
  text-transform: uppercase;
65270
- gap: ${mediumPadding};
65286
+ gap: ${smallPadding};
65271
65287
  cursor: default;
65272
65288
  }
65273
65289
 
65290
+ :host(.right-align) {
65291
+ flex-direction: row-reverse;
65292
+ padding-left: ${smallPadding};
65293
+ padding-right: ${mediumPadding};
65294
+ }
65295
+
65274
65296
  :host(${focusVisible}) {
65275
65297
  outline: calc(2 * ${borderWidth}) solid ${borderHoverColor};
65276
65298
  outline-offset: calc(-2 * ${borderWidth});
@@ -65285,6 +65307,7 @@ focus outline in that case.
65285
65307
  // prettier-ignore
65286
65308
  const template$k = html `
65287
65309
  <template role="columnheader"
65310
+ class="${x => (x.alignment === TableColumnAlignment.right ? 'right-align' : '')}"
65288
65311
  aria-sort="${x => x.ariaSort}"
65289
65312
  ${'' /* Prevent header double clicks from selecting text */}
65290
65313
  @mousedown="${(_x, c) => !(c.event.detail > 1)}"
@@ -65329,6 +65352,7 @@ focus outline in that case.
65329
65352
  this.sortDirection = TableColumnSortDirection.none;
65330
65353
  this.firstSortedColumn = false;
65331
65354
  this.indicatorsHidden = false;
65355
+ this.alignment = TableColumnAlignment.left;
65332
65356
  this.isGrouped = false;
65333
65357
  }
65334
65358
  sortDirectionChanged(_prev, _next) {
@@ -65359,6 +65383,9 @@ focus outline in that case.
65359
65383
  __decorate$1([
65360
65384
  attr({ attribute: 'indicators-hidden', mode: 'boolean' })
65361
65385
  ], TableHeader.prototype, "indicatorsHidden", void 0);
65386
+ __decorate$1([
65387
+ observable
65388
+ ], TableHeader.prototype, "alignment", void 0);
65362
65389
  __decorate$1([
65363
65390
  observable
65364
65391
  ], TableHeader.prototype, "isGrouped", void 0);
@@ -66361,7 +66388,7 @@ focus outline in that case.
66361
66388
  aria-multiselectable="${x => x.ariaMultiSelectable}"
66362
66389
  ${children$1({ property: 'childItems', filter: elements() })}
66363
66390
  >
66364
- <div class="table-container ${x => (x.documentShiftKeyDown ? 'disable-select' : '')}"
66391
+ <div class="table-container ${x => (x.windowShiftKeyDown ? 'disable-select' : '')}"
66365
66392
  style="
66366
66393
  --ni-private-table-scroll-x: -${x => x.scrollX}px;
66367
66394
  --ni-private-table-header-container-margin-right: ${x => x.virtualizer.headerContainerMarginRight}px;
@@ -66432,6 +66459,7 @@ focus outline in that case.
66432
66459
  ?indicators-hidden="${x => x.columnInternals.hideHeaderIndicators}"
66433
66460
  @keydown="${(x, c) => c.parent.onHeaderKeyDown(x, c.event)}"
66434
66461
  @click="${(x, c) => c.parent.toggleColumnSort(x, c.event.shiftKey)}"
66462
+ :alignment="${x => x.columnInternals.headerAlignment}"
66435
66463
  :isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
66436
66464
  >
66437
66465
  <slot name="${x => x.slot}"></slot>
@@ -69498,7 +69526,7 @@ focus outline in that case.
69498
69526
  * space through a column resize operation.
69499
69527
  */
69500
69528
  this.tableScrollableMinWidth = 0;
69501
- this.documentShiftKeyDown = false;
69529
+ this.windowShiftKeyDown = false;
69502
69530
  this.tableValidator = new TableValidator();
69503
69531
  this.tableUpdateTracker = new TableUpdateTracker(this);
69504
69532
  this.columnNotifiers = [];
@@ -69515,14 +69543,13 @@ focus outline in that case.
69515
69543
  this.scrollX = event.target.scrollLeft;
69516
69544
  };
69517
69545
  this.onKeyDown = (event) => {
69518
- if (event.key === keyShift) {
69519
- this.documentShiftKeyDown = true;
69520
- }
69546
+ this.windowShiftKeyDown = event.shiftKey;
69521
69547
  };
69522
69548
  this.onKeyUp = (event) => {
69523
- if (event.key === keyShift) {
69524
- this.documentShiftKeyDown = false;
69525
- }
69549
+ this.windowShiftKeyDown = event.shiftKey;
69550
+ };
69551
+ this.onBlur = () => {
69552
+ this.windowShiftKeyDown = false;
69526
69553
  };
69527
69554
  this.getRowCanExpand = (row) => {
69528
69555
  return this.expansionManager.isRowExpandable(row);
@@ -69620,16 +69647,18 @@ focus outline in that case.
69620
69647
  passive: true
69621
69648
  });
69622
69649
  this.keyboardNavigationManager.connect();
69623
- document.addEventListener('keydown', this.onKeyDown);
69624
- document.addEventListener('keyup', this.onKeyUp);
69650
+ window.addEventListener('keydown', this.onKeyDown);
69651
+ window.addEventListener('keyup', this.onKeyUp);
69652
+ window.addEventListener('blur', this.onBlur);
69625
69653
  }
69626
69654
  disconnectedCallback() {
69627
69655
  super.disconnectedCallback();
69628
69656
  this.virtualizer.disconnect();
69629
69657
  this.keyboardNavigationManager.disconnect();
69630
69658
  this.viewport.removeEventListener('scroll', this.onViewPortScroll);
69631
- document.removeEventListener('keydown', this.onKeyDown);
69632
- document.removeEventListener('keyup', this.onKeyUp);
69659
+ window.removeEventListener('keydown', this.onKeyDown);
69660
+ window.removeEventListener('keyup', this.onKeyUp);
69661
+ window.removeEventListener('blur', this.onBlur);
69633
69662
  }
69634
69663
  checkValidity() {
69635
69664
  return this.tableValidator.isValid();
@@ -69662,7 +69691,7 @@ focus outline in that case.
69662
69691
  /** @internal */
69663
69692
  onRowSelectionToggle(rowIndex, event) {
69664
69693
  event.stopImmediatePropagation();
69665
- const selectionChanged = this.selectionManager.handleRowSelectionToggle(this.tableData[rowIndex], event.detail.newState, this.documentShiftKeyDown);
69694
+ const selectionChanged = this.selectionManager.handleRowSelectionToggle(this.tableData[rowIndex], event.detail.newState, this.windowShiftKeyDown);
69666
69695
  if (selectionChanged) {
69667
69696
  void this.emitSelectionChangeEvent();
69668
69697
  }
@@ -70338,7 +70367,7 @@ focus outline in that case.
70338
70367
  ], Table$1.prototype, "tableScrollableMinWidth", void 0);
70339
70368
  __decorate$1([
70340
70369
  observable
70341
- ], Table$1.prototype, "documentShiftKeyDown", void 0);
70370
+ ], Table$1.prototype, "windowShiftKeyDown", void 0);
70342
70371
  const nimbleTable = Table$1.compose({
70343
70372
  baseName: 'table',
70344
70373
  template: template$g,
@@ -70903,19 +70932,11 @@ focus outline in that case.
70903
70932
  .register(tableColumnDateTextGroupHeaderView());
70904
70933
  const tableColumnDateTextGroupHeaderViewTag = 'nimble-table-column-date-text-group-header-view';
70905
70934
 
70906
- /**
70907
- * The aligment of the value in a TableColumnTextCellViewBase instance.
70908
- */
70909
- const TextCellViewBaseAlignment = {
70910
- left: 'left',
70911
- right: 'right'
70912
- };
70913
-
70914
70935
  // prettier-ignore
70915
70936
  const template$c = html `
70916
70937
  <template
70917
70938
  class="
70918
- ${x => (x.alignment === TextCellViewBaseAlignment.right ? 'right-align' : '')}
70939
+ ${x => (x.alignment === TableColumnAlignment.right ? 'right-align' : '')}
70919
70940
  ${x => (x.isPlaceholder ? 'placeholder' : '')}
70920
70941
  "
70921
70942
  >
@@ -70968,7 +70989,7 @@ focus outline in that case.
70968
70989
  /**
70969
70990
  * The alignment of the text within the cell.
70970
70991
  */
70971
- this.alignment = TextCellViewBaseAlignment.left;
70992
+ this.alignment = TableColumnAlignment.left;
70972
70993
  /**
70973
70994
  * Whether or not the text being displayed in the cell view is a placeholder.
70974
70995
  */
@@ -72256,7 +72277,7 @@ focus outline in that case.
72256
72277
  class TableColumnNumberTextCellView extends TableColumnTextCellViewBase {
72257
72278
  columnConfigChanged() {
72258
72279
  super.columnConfigChanged();
72259
- this.alignment = this.columnConfig?.alignment ?? TextCellViewBaseAlignment.left;
72280
+ this.alignment = this.columnConfig?.alignment ?? TableColumnAlignment.left;
72260
72281
  }
72261
72282
  updateText() {
72262
72283
  this.text = this.columnConfig?.formatter?.format(this.cellRecord?.value) ?? '';
@@ -72749,6 +72770,7 @@ focus outline in that case.
72749
72770
  alignment: this.determineCellContentAlignment(),
72750
72771
  placeholder: this.placeholder
72751
72772
  };
72773
+ this.columnInternals.headerAlignment = columnConfig.alignment;
72752
72774
  this.columnInternals.columnConfig = columnConfig;
72753
72775
  }
72754
72776
  else {
@@ -72768,18 +72790,18 @@ focus outline in that case.
72768
72790
  }
72769
72791
  determineCellContentAlignment() {
72770
72792
  if (this.alignment === NumberTextAlignment.left) {
72771
- return TextCellViewBaseAlignment.left;
72793
+ return TableColumnAlignment.left;
72772
72794
  }
72773
72795
  if (this.alignment === NumberTextAlignment.right) {
72774
- return TextCellViewBaseAlignment.right;
72796
+ return TableColumnAlignment.right;
72775
72797
  }
72776
72798
  // Look at format and decimal max digits and unit to determine the default alignment
72777
72799
  if (this.format === NumberTextFormat.decimal
72778
72800
  && typeof this.decimalMaximumDigits !== 'number'
72779
72801
  && !this.unit) {
72780
- return TextCellViewBaseAlignment.right;
72802
+ return TableColumnAlignment.right;
72781
72803
  }
72782
- return TextCellViewBaseAlignment.left;
72804
+ return TableColumnAlignment.left;
72783
72805
  }
72784
72806
  }
72785
72807
  __decorate$1([