@ni/nimble-components 19.8.1 → 19.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 (29) hide show
  1. package/dist/all-components-bundle.js +418 -141
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +2008 -1899
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/src/table/index.d.ts +28 -1
  6. package/dist/esm/src/table/models/table-layout-manager.d.ts +42 -0
  7. package/dist/esm/src/table/models/virtualizer.d.ts +1 -1
  8. package/dist/esm/src/table/testing/table.pageobject.d.ts +17 -1
  9. package/dist/esm/table/index.d.ts +28 -1
  10. package/dist/esm/table/index.js +33 -6
  11. package/dist/esm/table/index.js.map +1 -1
  12. package/dist/esm/table/models/table-layout-manager.d.ts +42 -0
  13. package/dist/esm/table/models/table-layout-manager.js +186 -0
  14. package/dist/esm/table/models/table-layout-manager.js.map +1 -0
  15. package/dist/esm/table/models/virtualizer.d.ts +1 -1
  16. package/dist/esm/table/models/virtualizer.js +3 -3
  17. package/dist/esm/table/models/virtualizer.js.map +1 -1
  18. package/dist/esm/table/styles.js +96 -27
  19. package/dist/esm/table/styles.js.map +1 -1
  20. package/dist/esm/table/template.js +103 -86
  21. package/dist/esm/table/template.js.map +1 -1
  22. package/dist/esm/table/testing/table.pageobject.d.ts +17 -1
  23. package/dist/esm/table/testing/table.pageobject.js +81 -17
  24. package/dist/esm/table/testing/table.pageobject.js.map +1 -1
  25. package/package.json +1 -1
  26. package/dist/esm/src/table/models/table-layout-helper.d.ts +0 -8
  27. package/dist/esm/table/models/table-layout-helper.d.ts +0 -8
  28. package/dist/esm/table/models/table-layout-helper.js +0 -20
  29. package/dist/esm/table/models/table-layout-helper.js.map +0 -1
@@ -16232,7 +16232,7 @@
16232
16232
 
16233
16233
  /**
16234
16234
  * Do not edit directly
16235
- * Generated on Tue, 18 Jul 2023 18:36:51 GMT
16235
+ * Generated on Wed, 19 Jul 2023 17:17:21 GMT
16236
16236
  */
16237
16237
  const Information100DarkUi = "#a46eff";
16238
16238
  const Information100LightUi = "#804ad9";
@@ -28779,6 +28779,8 @@
28779
28779
 
28780
28780
  :host {
28781
28781
  height: 480px;
28782
+ --ni-private-column-divider-width: 2px;
28783
+ --ni-private-column-divider-padding: 3px;
28782
28784
  }
28783
28785
 
28784
28786
  .disable-select {
@@ -28792,32 +28794,17 @@
28792
28794
  width: 100%;
28793
28795
  font: ${bodyFont};
28794
28796
  color: ${bodyFontColor};
28797
+ cursor: var(--ni-private-table-cursor-override);
28795
28798
  }
28796
28799
 
28797
- .table-viewport {
28798
- overflow: auto;
28799
- display: block;
28800
- height: 100%;
28801
- position: relative;
28802
- }
28803
-
28804
- .table-scroll {
28805
- pointer-events: none;
28806
- position: absolute;
28807
- top: 0px;
28800
+ .glass-overlay {
28808
28801
  width: 100%;
28809
- height: var(--ni-private-table-scroll-height);
28810
- }
28811
-
28812
- .table-row-container {
28813
- width: fit-content;
28814
- min-width: 100%;
28815
- position: relative;
28816
- top: var(--ni-private-table-row-container-top);
28817
- background-color: ${tableRowBorderColor};
28802
+ height: 100%;
28803
+ display: contents;
28804
+ pointer-events: var(--ni-private-glass-overlay-pointer-events);
28818
28805
  }
28819
28806
 
28820
- .header-container {
28807
+ .header-row-container {
28821
28808
  position: sticky;
28822
28809
  top: 0;
28823
28810
  }
@@ -28827,12 +28814,26 @@
28827
28814
  background: ${applicationBackgroundColor};
28828
28815
  position: relative;
28829
28816
  width: fit-content;
28830
- min-width: 100%;
28817
+ min-width: max(
28818
+ 100%,
28819
+ calc(
28820
+ var(--ni-private-table-scrollable-min-width) +
28821
+ var(--ni-private-table-header-container-margin-right)
28822
+ )
28823
+ );
28831
28824
  left: var(--ni-private-table-scroll-x);
28832
28825
  align-items: center;
28833
28826
  }
28834
28827
 
28835
- .column-header-container {
28828
+ .header-row-action-container {
28829
+ display: flex;
28830
+ }
28831
+
28832
+ .checkbox-container {
28833
+ display: flex;
28834
+ }
28835
+
28836
+ .column-headers-container {
28836
28837
  display: grid;
28837
28838
  width: 100%;
28838
28839
  grid-template-columns: var(--ni-private-table-row-grid-columns) auto;
@@ -28848,16 +28849,84 @@
28848
28849
  visibility: visible;
28849
28850
  }
28850
28851
 
28852
+ .header-container {
28853
+ display: flex;
28854
+ align-items: center;
28855
+ position: relative;
28856
+ }
28857
+
28851
28858
  .header-scrollbar-spacer {
28852
- width: var(--ni-private-table-header-scrollbar-spacer-width);
28859
+ width: var(--ni-private-table-header-container-margin-right);
28853
28860
  }
28854
28861
 
28855
28862
  .header {
28856
28863
  flex: 1;
28864
+ overflow: hidden;
28857
28865
  }
28858
28866
 
28859
- .checkbox-container {
28860
- display: flex;
28867
+ .column-divider {
28868
+ border-left: var(--ni-private-column-divider-width) solid
28869
+ ${popupBorderColor};
28870
+ display: none;
28871
+ height: ${controlSlimHeight};
28872
+ cursor: col-resize;
28873
+ position: absolute;
28874
+ }
28875
+
28876
+ .column-divider::before {
28877
+ content: '';
28878
+ position: absolute;
28879
+ width: calc(
28880
+ var(--ni-private-column-divider-width) +
28881
+ (2 * var(--ni-private-column-divider-padding))
28882
+ );
28883
+ height: 100%;
28884
+ left: calc(
28885
+ -1 * (var(--ni-private-column-divider-width) +
28886
+ var(--ni-private-column-divider-padding))
28887
+ );
28888
+ }
28889
+
28890
+ .column-divider.active {
28891
+ display: block;
28892
+ z-index: 1;
28893
+ }
28894
+
28895
+ .header-container:hover .column-divider.left,
28896
+ .header-container:hover .column-divider.right {
28897
+ display: block;
28898
+ z-index: 1;
28899
+ }
28900
+
28901
+ .column-divider.left {
28902
+ left: -1px;
28903
+ }
28904
+
28905
+ .column-divider.right {
28906
+ left: calc(100% - 1px);
28907
+ }
28908
+
28909
+ .table-viewport {
28910
+ overflow: auto;
28911
+ display: block;
28912
+ height: 100%;
28913
+ position: relative;
28914
+ }
28915
+
28916
+ .table-scroll {
28917
+ pointer-events: none;
28918
+ position: absolute;
28919
+ top: 0px;
28920
+ width: 100%;
28921
+ height: var(--ni-private-table-scroll-height);
28922
+ }
28923
+
28924
+ .table-row-container {
28925
+ width: fit-content;
28926
+ min-width: max(100%, var(--ni-private-table-scrollable-min-width));
28927
+ position: relative;
28928
+ top: var(--ni-private-table-row-container-top);
28929
+ background-color: ${tableRowBorderColor};
28861
28930
  }
28862
28931
 
28863
28932
  .selection-checkbox {
@@ -29623,101 +29692,118 @@
29623
29692
  <div class="table-container ${x => (x.documentShiftKeyDown ? 'disable-select' : '')}"
29624
29693
  style="
29625
29694
  --ni-private-table-scroll-x: -${x => x.scrollX}px;
29626
- --ni-private-table-header-scrollbar-spacer-width: ${x => x.virtualizer.headerContainerMarginRight}px;
29627
- --ni-private-table-scroll-height: ${x => x.virtualizer.allRowsHeight}px;
29695
+ --ni-private-table-header-container-margin-right: ${x => x.virtualizer.headerContainerMarginRight}px;
29696
+ --ni-private-table-scroll-height: ${x => x.virtualizer.scrollHeight}px;
29628
29697
  --ni-private-table-row-container-top: ${x => x.virtualizer.rowContainerYOffset}px;
29629
29698
  --ni-private-table-row-grid-columns: ${x => x.rowGridColumns ?? ''};
29699
+ --ni-private-table-cursor-override: ${x => (x.layoutManager.isColumnBeingSized ? 'col-resize' : 'default')};
29700
+ --ni-private-table-scrollable-min-width: ${x => x.tableScrollableMinWidth}px;
29701
+ --ni-private-glass-overlay-pointer-events: ${x => (x.layoutManager.isColumnBeingSized ? 'none' : 'default')};
29630
29702
  ">
29631
- <div role="rowgroup" class="header-container">
29632
- <div class="header-row" role="row">
29633
- ${when(x => x.selectionMode === TableRowSelectionMode.multiple, html `
29634
- <span role="columnheader" class="checkbox-container">
29635
- <${checkboxTag}
29636
- ${ref('selectionCheckbox')}
29637
- class="${x => `selection-checkbox ${x.selectionMode ?? ''}`}"
29638
- @change="${(x, c) => x.onAllRowsSelectionChange(c.event)}"
29639
- >
29640
- </${checkboxTag}>
29641
- </span>
29642
- `)}
29643
- <span role="gridcell">
29644
- <${buttonTag}
29645
- class="collapse-all-button ${x => `${x.showCollapseAll ? 'visible' : ''}`}"
29646
- content-hidden
29647
- appearance="${ButtonAppearance.ghost}"
29648
- title="${x => tableGroupsCollapseAllLabel.getValueFor(x)}"
29649
- @click="${x => x.handleCollapseAllGroupRows()}"
29650
- >
29651
- <${iconTriangleTwoLinesHorizontalTag} slot="start"></${iconTriangleTwoLinesHorizontalTag}>
29652
- ${x => tableGroupsCollapseAllLabel.getValueFor(x)}
29653
- </${buttonTag}>
29654
- </span>
29655
- <span class="column-header-container">
29656
- ${repeat(x => x.columns, html `
29657
- ${when(x => !x.columnHidden, html `
29658
- <${tableHeaderTag}
29659
- class="header"
29660
- sort-direction="${x => (typeof x.columnInternals.currentSortIndex === 'number' ? x.columnInternals.currentSortDirection : TableColumnSortDirection.none)}"
29661
- ?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
29662
- @click="${(x, c) => c.parent.toggleColumnSort(x, c.event.shiftKey)}"
29663
- :isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
29664
- >
29665
- <slot name="${x => x.slot}"></slot>
29666
- </${tableHeaderTag}>
29667
- `)}
29668
- `)}
29669
- <div class="header-scrollbar-spacer"></div>
29670
- </span>
29671
- </div>
29672
- </div>
29673
- <div class="table-viewport" ${ref('viewport')}>
29674
- <div class="table-scroll"></div>
29675
- <div class="table-row-container" ${children$1({ property: 'rowElements', filter: elements(tableRowTag) })}
29676
- role="rowgroup">
29677
- ${when(x => x.columns.length > 0 && x.canRenderRows, html `
29678
- ${repeat(x => x.virtualizer.visibleItems, html `
29679
- ${when((x, c) => c.parent.tableData[x.index]?.isGrouped, html `
29680
- <${tableGroupRowTag}
29681
- class="group-row"
29682
- :groupRowValue="${(x, c) => c.parent.tableData[x.index]?.groupRowValue}"
29683
- ?expanded="${(x, c) => c.parent.tableData[x.index]?.isExpanded}"
29684
- :nestingLevel="${(x, c) => c.parent.tableData[x.index]?.nestingLevel}"
29685
- :leafItemCount="${(x, c) => c.parent.tableData[x.index]?.leafItemCount}"
29686
- :groupColumn="${(x, c) => c.parent.tableData[x.index]?.groupColumn}"
29687
- ?selectable="${(_, c) => c.parent.selectionMode === TableRowSelectionMode.multiple}"
29688
- selection-state="${(x, c) => c.parent.tableData[x.index]?.selectionState}"
29689
- @group-selection-toggle="${(x, c) => c.parent.onRowSelectionToggle(x.index, c.event)}"
29690
- @group-expand-toggle="${(x, c) => c.parent.handleGroupRowExpanded(x.index, c.event)}"
29691
- >
29692
- </${tableGroupRowTag}>
29703
+ <div class="glass-overlay">
29704
+ <div role="rowgroup" class="header-row-container">
29705
+ <div class="header-row" role="row">
29706
+ <span class="header-row-action-container" ${ref('headerRowActionContainer')}>
29707
+ ${when(x => x.selectionMode === TableRowSelectionMode.multiple, html `
29708
+ <span role="columnheader" class="checkbox-container">
29709
+ <${checkboxTag}
29710
+ ${ref('selectionCheckbox')}
29711
+ class="${x => `selection-checkbox ${x.selectionMode ?? ''}`}"
29712
+ @change="${(x, c) => x.onAllRowsSelectionChange(c.event)}"
29713
+ >
29714
+ </${checkboxTag}>
29715
+ </span>
29693
29716
  `)}
29694
- ${when((x, c) => !c.parent.tableData[x.index]?.isGrouped, html `
29695
- <${tableRowTag}
29696
- class="row"
29697
- record-id="${(x, c) => c.parent.tableData[x.index]?.id}"
29698
- ?selectable="${(_, c) => c.parent.selectionMode !== TableRowSelectionMode.none}"
29699
- ?selected="${(x, c) => c.parent.tableData[x.index]?.selectionState === TableRowSelectionState.selected}"
29700
- ?hide-selection="${(_, c) => c.parent.selectionMode !== TableRowSelectionMode.multiple}"
29701
- :dataRecord="${(x, c) => c.parent.tableData[x.index]?.record}"
29702
- :columns="${(_, c) => c.parent.columns}"
29703
- :nestingLevel="${(x, c) => c.parent.tableData[x.index]?.nestingLevel}"
29704
- @click="${(x, c) => c.parent.onRowClick(x.index, c.event)}"
29705
- @row-selection-toggle="${(x, c) => c.parent.onRowSelectionToggle(x.index, c.event)}"
29706
- @row-action-menu-beforetoggle="${(x, c) => c.parent.onRowActionMenuBeforeToggle(x.index, c.event)}"
29707
- @row-action-menu-toggle="${(_, c) => c.parent.onRowActionMenuToggle(c.event)}"
29717
+ <span role="gridcell">
29718
+ <${buttonTag}
29719
+ class="collapse-all-button ${x => `${x.showCollapseAll ? 'visible' : ''}`}"
29720
+ content-hidden
29721
+ appearance="${ButtonAppearance.ghost}"
29722
+ title="${x => tableGroupsCollapseAllLabel.getValueFor(x)}"
29723
+ @click="${x => x.handleCollapseAllGroupRows()}"
29708
29724
  >
29709
- ${when((x, c) => c.parent.openActionMenuRecordId === c.parent.tableData[x.index]?.id, html `
29710
- ${repeat((_, c) => c.parent.actionMenuSlots, html `
29711
- <slot
29712
- name="${x => x}"
29713
- slot="${x => `row-action-menu-${x}`}">
29714
- </slot>
29725
+ <${iconTriangleTwoLinesHorizontalTag} slot="start"></${iconTriangleTwoLinesHorizontalTag}>
29726
+ ${x => tableGroupsCollapseAllLabel.getValueFor(x)}
29727
+ </${buttonTag}>
29728
+ </span>
29729
+ </span>
29730
+ <span class="column-headers-container" ${ref('columnHeadersContainer')}>
29731
+ ${repeat(x => x.visibleColumns, html `
29732
+ <div class="header-container">
29733
+ ${when((_, c) => c.index > 0, html `
29734
+ <div class="column-divider left ${(_, c) => `${c.parent.layoutManager.activeColumnIndex === c.index ? 'active' : ''}`}"
29735
+ @mousedown="${(_, c) => c.parent.onLeftDividerMouseDown(c.event, c.index)}">
29736
+ </div>
29737
+ `)}
29738
+ <${tableHeaderTag}
29739
+ class="header"
29740
+ sort-direction="${x => (typeof x.columnInternals.currentSortIndex === 'number' ? x.columnInternals.currentSortDirection : TableColumnSortDirection.none)}"
29741
+ ?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
29742
+ @click="${(x, c) => c.parent.toggleColumnSort(x, c.event.shiftKey)}"
29743
+ :isGrouped=${x => (typeof x.columnInternals.groupIndex === 'number' && !x.columnInternals.groupingDisabled)}
29744
+ >
29745
+ <slot name="${x => x.slot}"></slot>
29746
+ </${tableHeaderTag}>
29747
+ ${when((_, c) => c.index < c.length - 1, html `
29748
+ <div class="column-divider right ${(_, c) => `${c.parent.layoutManager.activeColumnIndex === c.index ? 'active' : ''}`}"
29749
+ @mousedown="${(_, c) => c.parent.onRightDividerMouseDown(c.event, c.index)}">
29750
+ </div>
29751
+ `)}
29752
+ </div>
29753
+ `, { positioning: true })}
29754
+ <div class="header-scrollbar-spacer"></div>
29755
+ </span>
29756
+ </div>
29757
+ </div>
29758
+ <div class="table-viewport" ${ref('viewport')}>
29759
+ <div class="table-scroll"></div>
29760
+ <div class="table-row-container" ${children$1({ property: 'rowElements', filter: elements(tableRowTag) })}
29761
+ role="rowgroup">
29762
+ ${when(x => x.columns.length > 0 && x.canRenderRows, html `
29763
+ ${repeat(x => x.virtualizer.visibleItems, html `
29764
+ ${when((x, c) => c.parent.tableData[x.index]?.isGrouped, html `
29765
+ <${tableGroupRowTag}
29766
+ class="group-row"
29767
+ :groupRowValue="${(x, c) => c.parent.tableData[x.index]?.groupRowValue}"
29768
+ ?expanded="${(x, c) => c.parent.tableData[x.index]?.isExpanded}"
29769
+ :nestingLevel="${(x, c) => c.parent.tableData[x.index]?.nestingLevel}"
29770
+ :leafItemCount="${(x, c) => c.parent.tableData[x.index]?.leafItemCount}"
29771
+ :groupColumn="${(x, c) => c.parent.tableData[x.index]?.groupColumn}"
29772
+ ?selectable="${(_, c) => c.parent.selectionMode === TableRowSelectionMode.multiple}"
29773
+ selection-state="${(x, c) => c.parent.tableData[x.index]?.selectionState}"
29774
+ @group-selection-toggle="${(x, c) => c.parent.onRowSelectionToggle(x.index, c.event)}"
29775
+ @group-expand-toggle="${(x, c) => c.parent.handleGroupRowExpanded(x.index, c.event)}"
29776
+ >
29777
+ </${tableGroupRowTag}>
29778
+ `)}
29779
+ ${when((x, c) => !c.parent.tableData[x.index]?.isGrouped, html `
29780
+ <${tableRowTag}
29781
+ class="row"
29782
+ record-id="${(x, c) => c.parent.tableData[x.index]?.id}"
29783
+ ?selectable="${(_, c) => c.parent.selectionMode !== TableRowSelectionMode.none}"
29784
+ ?selected="${(x, c) => c.parent.tableData[x.index]?.selectionState === TableRowSelectionState.selected}"
29785
+ ?hide-selection="${(_, c) => c.parent.selectionMode !== TableRowSelectionMode.multiple}"
29786
+ :dataRecord="${(x, c) => c.parent.tableData[x.index]?.record}"
29787
+ :columns="${(_, c) => c.parent.columns}"
29788
+ :nestingLevel="${(x, c) => c.parent.tableData[x.index]?.nestingLevel}"
29789
+ @click="${(x, c) => c.parent.onRowClick(x.index, c.event)}"
29790
+ @row-selection-toggle="${(x, c) => c.parent.onRowSelectionToggle(x.index, c.event)}"
29791
+ @row-action-menu-beforetoggle="${(x, c) => c.parent.onRowActionMenuBeforeToggle(x.index, c.event)}"
29792
+ @row-action-menu-toggle="${(_, c) => c.parent.onRowActionMenuToggle(c.event)}"
29793
+ >
29794
+ ${when((x, c) => c.parent.openActionMenuRecordId === c.parent.tableData[x.index]?.id, html `
29795
+ ${repeat((_, c) => c.parent.actionMenuSlots, html `
29796
+ <slot
29797
+ name="${x => x}"
29798
+ slot="${x => `row-action-menu-${x}`}">
29799
+ </slot>
29800
+ `)}
29715
29801
  `)}
29802
+ </${tableRowTag}>
29716
29803
  `)}
29717
- </${tableRowTag}>
29718
29804
  `)}
29719
29805
  `)}
29720
- `)}
29806
+ </div>
29721
29807
  </div>
29722
29808
  </div>
29723
29809
  </div>
@@ -30357,7 +30443,7 @@
30357
30443
  class Virtualizer {
30358
30444
  constructor(table, tanStackTable) {
30359
30445
  this.visibleItems = [];
30360
- this.allRowsHeight = 0;
30446
+ this.scrollHeight = 0;
30361
30447
  this.headerContainerMarginRight = 0;
30362
30448
  this.rowContainerYOffset = 0;
30363
30449
  this.table = table;
@@ -30417,7 +30503,7 @@
30417
30503
  this.notifyFocusedCellRecycling();
30418
30504
  const virtualizer = this.virtualizer;
30419
30505
  this.visibleItems = virtualizer.getVirtualItems();
30420
- this.allRowsHeight = virtualizer.getTotalSize();
30506
+ this.scrollHeight = virtualizer.getTotalSize();
30421
30507
  // We're using a separate div ('table-scroll') to represent the full height of all rows, and
30422
30508
  // the row container's height is only big enough to hold the virtualized rows. So we don't
30423
30509
  // use the TanStackVirtual-provided 'start' offset (which is in terms of the full height)
@@ -30454,7 +30540,7 @@
30454
30540
  ], Virtualizer.prototype, "visibleItems", void 0);
30455
30541
  __decorate$1([
30456
30542
  observable
30457
- ], Virtualizer.prototype, "allRowsHeight", void 0);
30543
+ ], Virtualizer.prototype, "scrollHeight", void 0);
30458
30544
  __decorate$1([
30459
30545
  observable
30460
30546
  ], Virtualizer.prototype, "headerContainerMarginRight", void 0);
@@ -30496,6 +30582,190 @@
30496
30582
  return 1;
30497
30583
  }
30498
30584
 
30585
+ /**
30586
+ * This class manages the layout of columns within a Table.
30587
+ * @interal
30588
+ */
30589
+ class TableLayoutManager {
30590
+ constructor(table) {
30591
+ this.table = table;
30592
+ this.isColumnBeingSized = false;
30593
+ this.visibleColumns = [];
30594
+ this.currentTotalDelta = 0;
30595
+ this.dragStart = 0;
30596
+ this.initialColumnPixelWidths = [];
30597
+ this.onDividerMouseMove = (event) => {
30598
+ const mouseEvent = event;
30599
+ for (let i = 0; i < this.visibleColumns.length; i++) {
30600
+ this.visibleColumns[i].columnInternals.currentPixelWidth = this.initialColumnPixelWidths[i]?.initialPixelWidth;
30601
+ }
30602
+ this.currentTotalDelta = this.getAllowedSizeDelta(mouseEvent.clientX - this.dragStart);
30603
+ this.performCascadeSizeLeft(this.leftColumnIndex, this.currentTotalDelta);
30604
+ this.performCascadeSizeRight(this.rightColumnIndex, this.currentTotalDelta);
30605
+ const totalColumnWidthDelta = this.getTotalColumnFixedWidth() - this.initialColumnTotalWidth;
30606
+ if (totalColumnWidthDelta > 0) {
30607
+ this.table.tableScrollableMinWidth = this.initialTableScrollableWidth + totalColumnWidthDelta;
30608
+ }
30609
+ else {
30610
+ this.table.tableScrollableMinWidth = this.initialTableScrollableMinWidth;
30611
+ }
30612
+ };
30613
+ this.onDividerMouseUp = () => {
30614
+ document.removeEventListener('mousemove', this.onDividerMouseMove);
30615
+ document.removeEventListener('mouseup', this.onDividerMouseUp);
30616
+ this.resetGridSizedColumns();
30617
+ this.isColumnBeingSized = false;
30618
+ this.activeColumnIndex = undefined;
30619
+ };
30620
+ }
30621
+ getGridTemplateColumns() {
30622
+ return this.getVisibleColumns()
30623
+ .map(column => {
30624
+ const { minPixelWidth, currentPixelWidth, currentFractionalWidth } = column.columnInternals;
30625
+ if (currentPixelWidth) {
30626
+ const coercedPixelWidth = Math.max(minPixelWidth, currentPixelWidth);
30627
+ return `${coercedPixelWidth}px`;
30628
+ }
30629
+ return `minmax(${minPixelWidth}px, ${currentFractionalWidth}fr)`;
30630
+ })
30631
+ .join(' ');
30632
+ }
30633
+ /**
30634
+ * Sets up state related to interactively sizing a column.
30635
+ * @param dragStart The x-position from which a column size was started
30636
+ * @param activeColumnDivider The divider that was clicked on
30637
+ */
30638
+ beginColumnInteractiveSize(dragStart, activeColumnDivider) {
30639
+ this.activeColumnDivider = activeColumnDivider;
30640
+ this.leftColumnIndex = this.getLeftColumnIndexFromDivider(this.activeColumnDivider);
30641
+ this.rightColumnIndex = this.leftColumnIndex + 1;
30642
+ this.activeColumnIndex = this.leftColumnIndex + (this.activeColumnDivider % 2);
30643
+ this.dragStart = dragStart;
30644
+ this.currentTotalDelta = 0;
30645
+ this.visibleColumns = this.getVisibleColumns();
30646
+ this.setColumnsToFixedSize();
30647
+ this.initialTableScrollableWidth = this.table.viewport.scrollWidth;
30648
+ this.initialTableScrollableMinWidth = this.table.tableScrollableMinWidth;
30649
+ this.initialColumnTotalWidth = this.getTotalColumnFixedWidth();
30650
+ this.isColumnBeingSized = true;
30651
+ document.addEventListener('mousemove', this.onDividerMouseMove);
30652
+ document.addEventListener('mouseup', this.onDividerMouseUp);
30653
+ }
30654
+ getTotalColumnFixedWidth() {
30655
+ let totalColumnFixedWidth = 0;
30656
+ for (const column of this.visibleColumns) {
30657
+ totalColumnFixedWidth
30658
+ += column.columnInternals.currentPixelWidth ?? 0;
30659
+ }
30660
+ return totalColumnFixedWidth;
30661
+ }
30662
+ setColumnsToFixedSize() {
30663
+ this.cacheGridSizedColumns();
30664
+ const headers = this.table.getHeaderContainerElements();
30665
+ for (let i = 0; i < headers.length; i++) {
30666
+ this.visibleColumns[i].columnInternals.currentPixelWidth = headers[i].getBoundingClientRect().width;
30667
+ }
30668
+ this.cacheColumnInitialPixelWidths();
30669
+ }
30670
+ getAllowedSizeDelta(requestedResizeAmount) {
30671
+ let availableSpace = 0;
30672
+ if (requestedResizeAmount > 0) {
30673
+ // size right
30674
+ return requestedResizeAmount;
30675
+ }
30676
+ // size left
30677
+ let currentIndex = this.leftColumnIndex;
30678
+ while (currentIndex >= 0) {
30679
+ const columnInitialWidths = this.initialColumnPixelWidths[currentIndex];
30680
+ availableSpace
30681
+ += columnInitialWidths.initialPixelWidth
30682
+ - columnInitialWidths.minPixelWidth;
30683
+ currentIndex -= 1;
30684
+ }
30685
+ return Math.max(requestedResizeAmount, -availableSpace);
30686
+ }
30687
+ performCascadeSizeLeft(leftColumnIndex, delta) {
30688
+ let currentDelta = delta;
30689
+ const leftColumnInitialWidths = this.initialColumnPixelWidths[leftColumnIndex];
30690
+ const allowedDelta = delta < 0
30691
+ ? Math.max(leftColumnInitialWidths.minPixelWidth
30692
+ - leftColumnInitialWidths.initialPixelWidth, currentDelta)
30693
+ : delta;
30694
+ const actualDelta = Math.round(allowedDelta);
30695
+ const leftColumn = this.visibleColumns[leftColumnIndex];
30696
+ leftColumn.columnInternals.currentPixelWidth += actualDelta;
30697
+ if (actualDelta > currentDelta && leftColumnIndex > 0 && delta < 0) {
30698
+ currentDelta -= allowedDelta;
30699
+ this.performCascadeSizeLeft(leftColumnIndex - 1, currentDelta);
30700
+ }
30701
+ }
30702
+ performCascadeSizeRight(rightColumnIndex, delta) {
30703
+ let currentDelta = delta;
30704
+ const rightColumnInitialWidths = this.initialColumnPixelWidths[rightColumnIndex];
30705
+ const allowedDelta = delta > 0
30706
+ ? Math.min(rightColumnInitialWidths.initialPixelWidth
30707
+ - rightColumnInitialWidths.minPixelWidth, currentDelta)
30708
+ : delta;
30709
+ const actualDelta = Math.round(allowedDelta);
30710
+ const rightColumn = this.visibleColumns[rightColumnIndex];
30711
+ rightColumn.columnInternals.currentPixelWidth -= actualDelta;
30712
+ if (actualDelta < currentDelta
30713
+ && rightColumnIndex < this.visibleColumns.length - 1
30714
+ && delta > 0) {
30715
+ currentDelta -= allowedDelta;
30716
+ this.performCascadeSizeRight(rightColumnIndex + 1, currentDelta);
30717
+ }
30718
+ }
30719
+ cacheGridSizedColumns() {
30720
+ this.gridSizedColumns = [];
30721
+ for (const column of this.visibleColumns) {
30722
+ if (column.columnInternals.currentPixelWidth === undefined) {
30723
+ this.gridSizedColumns.push(column);
30724
+ }
30725
+ }
30726
+ }
30727
+ cacheColumnInitialPixelWidths() {
30728
+ this.initialColumnPixelWidths = [];
30729
+ for (const column of this.visibleColumns) {
30730
+ this.initialColumnPixelWidths.push({
30731
+ initalColumnFractionalWidth: column.columnInternals.currentFractionalWidth,
30732
+ initialPixelWidth: column.columnInternals.currentPixelWidth,
30733
+ minPixelWidth: column.columnInternals.minPixelWidth
30734
+ });
30735
+ }
30736
+ }
30737
+ resetGridSizedColumns() {
30738
+ if (!this.gridSizedColumns) {
30739
+ return;
30740
+ }
30741
+ let gridColumnIndex = 0;
30742
+ for (let i = 0; i < this.visibleColumns.length
30743
+ && gridColumnIndex < this.gridSizedColumns.length; i++) {
30744
+ const column = this.visibleColumns[i];
30745
+ if (column === this.gridSizedColumns[gridColumnIndex]) {
30746
+ gridColumnIndex += 1;
30747
+ column.columnInternals.currentFractionalWidth = (column.columnInternals.currentPixelWidth
30748
+ / this.initialColumnPixelWidths[i].initialPixelWidth)
30749
+ * this.initialColumnPixelWidths[i]
30750
+ .initalColumnFractionalWidth;
30751
+ column.columnInternals.currentPixelWidth = undefined;
30752
+ }
30753
+ }
30754
+ }
30755
+ getVisibleColumns() {
30756
+ return this.table.columns.filter(column => !column.columnHidden);
30757
+ }
30758
+ getLeftColumnIndexFromDivider(dividerIndex) {
30759
+ return Math.floor(dividerIndex / 2);
30760
+ }
30761
+ }
30762
+ __decorate$1([
30763
+ observable
30764
+ ], TableLayoutManager.prototype, "isColumnBeingSized", void 0);
30765
+ __decorate$1([
30766
+ observable
30767
+ ], TableLayoutManager.prototype, "activeColumnIndex", void 0);
30768
+
30499
30769
  /**
30500
30770
  * Generic Tracker which sets or resets provided flags
30501
30771
  */
@@ -30684,26 +30954,6 @@
30684
30954
  }
30685
30955
  }
30686
30956
 
30687
- /**
30688
- * This class provides helper methods for managing the layout of cells within
30689
- * a Table.
30690
- */
30691
- class TableLayoutHelper {
30692
- static getGridTemplateColumns(columns) {
30693
- return columns
30694
- ?.filter(column => !column.columnHidden)
30695
- .map(column => {
30696
- const { minPixelWidth, currentPixelWidth, currentFractionalWidth } = column.columnInternals;
30697
- if (currentPixelWidth) {
30698
- const coercedPixelWidth = Math.max(minPixelWidth, currentPixelWidth);
30699
- return `${coercedPixelWidth}px`;
30700
- }
30701
- return `minmax(${minPixelWidth}px, ${currentFractionalWidth}fr)`;
30702
- })
30703
- .join(' ');
30704
- }
30705
- }
30706
-
30707
30957
  /**
30708
30958
  * Abstract base class for handling behavior associated with interactive row selection of the table.
30709
30959
  */
@@ -31009,6 +31259,13 @@
31009
31259
  /**
31010
31260
  * @internal
31011
31261
  */
31262
+ this.visibleColumns = [];
31263
+ /**
31264
+ * @internal
31265
+ * This value determines the size of the viewport area when a user has created horizontal scrollable
31266
+ * space through a column resize operation.
31267
+ */
31268
+ this.tableScrollableMinWidth = 0;
31012
31269
  this.documentShiftKeyDown = false;
31013
31270
  this.tableValidator = new TableValidator();
31014
31271
  this.tableUpdateTracker = new TableUpdateTracker(this);
@@ -31092,6 +31349,7 @@
31092
31349
  };
31093
31350
  this.table = createTable(this.options);
31094
31351
  this.virtualizer = new Virtualizer(this, this.table);
31352
+ this.layoutManager = new TableLayoutManager(this);
31095
31353
  this.selectionManager = new InteractiveSelectionManager(this.table, this.selectionMode);
31096
31354
  }
31097
31355
  get validity() {
@@ -31225,6 +31483,18 @@
31225
31483
  this.table.toggleAllRowsExpanded(false);
31226
31484
  }
31227
31485
  /** @internal */
31486
+ onRightDividerMouseDown(event, columnIndex) {
31487
+ if (event.button === 0) {
31488
+ this.layoutManager.beginColumnInteractiveSize(event.clientX, columnIndex * 2);
31489
+ }
31490
+ }
31491
+ /** @internal */
31492
+ onLeftDividerMouseDown(event, columnIndex) {
31493
+ if (event.button === 0) {
31494
+ this.layoutManager.beginColumnInteractiveSize(event.clientX, columnIndex * 2 - 1);
31495
+ }
31496
+ }
31497
+ /** @internal */
31228
31498
  handleGroupRowExpanded(rowIndex, event) {
31229
31499
  this.toggleGroupExpanded(rowIndex);
31230
31500
  event.stopPropagation();
@@ -31283,7 +31553,8 @@
31283
31553
  this.updateActionMenuSlots();
31284
31554
  }
31285
31555
  if (this.tableUpdateTracker.updateColumnWidths) {
31286
- this.updateRowGridColumns();
31556
+ this.rowGridColumns = this.layoutManager.getGridTemplateColumns();
31557
+ this.visibleColumns = this.columns.filter(column => !column.columnHidden);
31287
31558
  }
31288
31559
  if (this.tableUpdateTracker.updateGroupRows) {
31289
31560
  this.showCollapseAll = this.getColumnsParticipatingInGrouping().length > 0;
@@ -31299,6 +31570,12 @@
31299
31570
  return null;
31300
31571
  }
31301
31572
  }
31573
+ /**
31574
+ * @internal
31575
+ */
31576
+ getHeaderContainerElements() {
31577
+ return this.columnHeadersContainer.querySelectorAll('.header-container');
31578
+ }
31302
31579
  selectionModeChanged(_prev, _next) {
31303
31580
  if (!this.$fastController.isConnected) {
31304
31581
  return;
@@ -31438,9 +31715,6 @@
31438
31715
  }
31439
31716
  this.actionMenuSlots = Array.from(slots);
31440
31717
  }
31441
- updateRowGridColumns() {
31442
- this.rowGridColumns = TableLayoutHelper.getGridTemplateColumns(this.columns);
31443
- }
31444
31718
  validate() {
31445
31719
  this.tableValidator.validateSelectionMode(this.selectionMode, this.idFieldName);
31446
31720
  this.tableValidator.validateColumnIds(this.columns.map(x => x.columnId));
@@ -31690,7 +31964,10 @@
31690
31964
  ], Table.prototype, "firstSortedColumn", void 0);
31691
31965
  __decorate$1([
31692
31966
  observable
31693
- ], Table.prototype, "documentShiftKeyDown", void 0);
31967
+ ], Table.prototype, "visibleColumns", void 0);
31968
+ __decorate$1([
31969
+ observable
31970
+ ], Table.prototype, "tableScrollableMinWidth", void 0);
31694
31971
  const nimbleTable = Table.compose({
31695
31972
  baseName: 'table',
31696
31973
  template: template$9,