@ni/nimble-components 21.8.1 → 21.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.
@@ -9999,6 +9999,17 @@ return!this.missingColumnId&&!this.duplicateColumnId}validateColumnSortIndices(t
9999
9999
  height: ${il};
10000
10000
  cursor: col-resize;
10001
10001
  position: absolute;
10002
+ z-index: ${$h};
10003
+ }
10004
+
10005
+ .column-divider:hover,
10006
+ .column-divider.divider-active {
10007
+ border-color: ${qa};
10008
+ }
10009
+
10010
+ .column-divider.column-active,
10011
+ .header-container:hover .column-divider {
10012
+ display: block;
10002
10013
  }
10003
10014
 
10004
10015
  .column-divider::before {
@@ -10015,17 +10026,6 @@ return!this.missingColumnId&&!this.duplicateColumnId}validateColumnSortIndices(t
10015
10026
  );
10016
10027
  }
10017
10028
 
10018
- .column-divider.active {
10019
- display: block;
10020
- z-index: ${$h};
10021
- }
10022
-
10023
- .header-container:hover .column-divider.left,
10024
- .header-container:hover .column-divider.right {
10025
- display: block;
10026
- z-index: ${$h};
10027
- }
10028
-
10029
10029
  .column-divider.left {
10030
10030
  left: -1px;
10031
10031
  }
@@ -10614,8 +10614,14 @@ const lD="nimble-table-group-row",cD=Z`
10614
10614
  ${Ut((t=>t.visibleColumns),Z`
10615
10615
  <div class="header-container">
10616
10616
  ${Ft(((t,e)=>e.index>0),Z`
10617
- <div class="column-divider left ${(t,e)=>""+(e.parent.layoutManager.activeColumnIndex===e.index?"active":"")}"
10618
- @mousedown="${(t,e)=>e.parent.onLeftDividerMouseDown(e.event,e.index)}">
10617
+ <div
10618
+ class="
10619
+ column-divider
10620
+ left
10621
+ ${(t,e)=>""+(e.parent.layoutManager.activeColumnIndex===e.index?"column-active":"")}
10622
+ ${(t,e)=>""+(e.parent.layoutManager.activeColumnDivider===e.parent.getLeftDividerIndex(e.index)?"divider-active":"")}
10623
+ "
10624
+ @mousedown="${(t,e)=>e.parent.onLeftDividerMouseDown(e.event,e.index)}">
10619
10625
  </div>
10620
10626
  `)}
10621
10627
  <${WR}
@@ -10628,7 +10634,13 @@ const lD="nimble-table-group-row",cD=Z`
10628
10634
  <slot name="${t=>t.slot}"></slot>
10629
10635
  </${WR}>
10630
10636
  ${Ft(((t,e)=>e.index<e.length-1),Z`
10631
- <div class="column-divider right ${(t,e)=>""+(e.parent.layoutManager.activeColumnIndex===e.index?"active":"")}"
10637
+ <div
10638
+ class="
10639
+ column-divider
10640
+ right
10641
+ ${(t,e)=>""+(e.parent.layoutManager.activeColumnIndex===e.index?"column-active":"")}
10642
+ ${(t,e)=>""+(e.parent.layoutManager.activeColumnDivider===e.parent.getRightDividerIndex(e.index)?"divider-active":"")}
10643
+ "
10632
10644
  @mousedown="${(t,e)=>e.parent.onRightDividerMouseDown(e.event,e.index)}">
10633
10645
  </div>
10634
10646
  `)}
@@ -10794,7 +10806,7 @@ class SD{constructor(t){this.table=t,this.isColumnBeingSized=!1,this.visibleColu
10794
10806
  for(let t=0;t<this.visibleColumns.length;t++)this.visibleColumns[t].columnInternals.currentPixelWidth=this.initialColumnWidths[t]?.initialPixelWidth
10795
10807
  this.currentTotalDelta=this.getAllowedSizeDelta(e.clientX-this.dragStart),this.performCascadeSizeLeft(this.leftColumnIndex,this.currentTotalDelta),this.performCascadeSizeRight(this.rightColumnIndex,this.currentTotalDelta)
10796
10808
  const n=this.getTotalColumnFixedWidth()-this.initialColumnTotalWidth
10797
- this.table.tableScrollableMinWidth=n>0?this.initialTableScrollableWidth+n:this.initialTableScrollableMinWidth},this.onDividerMouseUp=()=>{document.removeEventListener("mousemove",this.onDividerMouseMove),document.removeEventListener("mouseup",this.onDividerMouseUp),this.resetGridSizedColumns(),this.isColumnBeingSized=!1,this.activeColumnIndex=void 0}}getGridTemplateColumns(){return this.getVisibleColumns().map((t=>{const{minPixelWidth:e,currentPixelWidth:n,currentFractionalWidth:i}=t.columnInternals
10809
+ this.table.tableScrollableMinWidth=n>0?this.initialTableScrollableWidth+n:this.initialTableScrollableMinWidth},this.onDividerMouseUp=()=>{document.removeEventListener("mousemove",this.onDividerMouseMove),document.removeEventListener("mouseup",this.onDividerMouseUp),this.resetGridSizedColumns(),this.isColumnBeingSized=!1,this.activeColumnIndex=void 0,this.activeColumnDivider=void 0}}getGridTemplateColumns(){return this.getVisibleColumns().map((t=>{const{minPixelWidth:e,currentPixelWidth:n,currentFractionalWidth:i}=t.columnInternals
10798
10810
  if(n){return`${Math.max(e,n)}px`}return`minmax(${e}px, ${i}fr)`})).join(" ")}beginColumnInteractiveSize(t,e){this.activeColumnDivider=e,this.leftColumnIndex=this.getLeftColumnIndexFromDivider(this.activeColumnDivider),this.rightColumnIndex=this.leftColumnIndex+1,this.activeColumnIndex=this.leftColumnIndex+this.activeColumnDivider%2,this.dragStart=t,this.currentTotalDelta=0,this.visibleColumns=this.getVisibleColumns(),this.setColumnsToFixedSize(),this.initialTableScrollableWidth=this.table.viewport.scrollWidth,this.initialTableScrollableMinWidth=this.table.tableScrollableMinWidth,this.initialColumnTotalWidth=this.getTotalColumnFixedWidth(),this.isColumnBeingSized=!0,document.addEventListener("mousemove",this.onDividerMouseMove),document.addEventListener("mouseup",this.onDividerMouseUp)}getTotalColumnFixedWidth(){let t=0
10799
10811
  for(const e of this.visibleColumns)t+=e.columnInternals.currentPixelWidth??0
10800
10812
  return t}setColumnsToFixedSize(){this.cacheGridSizedColumns()
@@ -10814,7 +10826,7 @@ for(const t of this.visibleColumns)this.initialColumnWidths.push({initalColumnFr
10814
10826
  const t=this.gridSizedColumns.reduce(((t,e)=>t+e.columnInternals.currentPixelWidth),0),e=t/this.gridSizedColumns.length
10815
10827
  let n=0
10816
10828
  for(let t=0;t<this.visibleColumns.length&&n<this.gridSizedColumns.length;t++){const i=this.visibleColumns[t]
10817
- i===this.gridSizedColumns[n]&&(n+=1,i.columnInternals.currentFractionalWidth=i.columnInternals.currentPixelWidth/e,i.columnInternals.currentPixelWidth=void 0)}}getVisibleColumns(){return this.table.columns.filter((t=>!t.columnHidden))}getLeftColumnIndexFromDivider(t){return Math.floor(t/2)}}t([g],SD.prototype,"isColumnBeingSized",void 0),t([g],SD.prototype,"activeColumnIndex",void 0)
10829
+ i===this.gridSizedColumns[n]&&(n+=1,i.columnInternals.currentFractionalWidth=i.columnInternals.currentPixelWidth/e,i.columnInternals.currentPixelWidth=void 0)}}getVisibleColumns(){return this.table.columns.filter((t=>!t.columnHidden))}getLeftColumnIndexFromDivider(t){return Math.floor(t/2)}}t([g],SD.prototype,"isColumnBeingSized",void 0),t([g],SD.prototype,"activeColumnIndex",void 0),t([g],SD.prototype,"activeColumnDivider",void 0)
10818
10830
  const $D=(t,...e)=>{for(const n of e)if(t===n)return!0
10819
10831
  return!1},MD=["rowIds","rowParentIds","groupRows","columnIds","columnSort","columnWidths","columnDefinition","actionMenuSlots","selectionMode"]
10820
10832
  class _D extends nI{constructor(t){super(MD),this.table=t,this.updateQueued=!1}get updateRowIds(){return this.isTracked("rowIds")}get updateRowParentIds(){return this.isTracked("rowParentIds")}get updateGroupRows(){return this.isTracked("groupRows")}get updateColumnIds(){return this.isTracked("columnIds")}get updateColumnSort(){return this.isTracked("columnSort")}get updateColumnWidths(){return this.isTracked("columnWidths")}get updateColumnDefinition(){return this.isTracked("columnDefinition")}get updateActionMenuSlots(){return this.isTracked("actionMenuSlots")}get updateSelectionMode(){return this.isTracked("selectionMode")}get requiresTanStackUpdate(){return this.isTracked("rowIds")||this.isTracked("rowParentIds")||this.isTracked("columnSort")||this.isTracked("columnDefinition")||this.isTracked("groupRows")||this.isTracked("selectionMode")}get requiresTanStackDataReset(){return this.isTracked("rowIds")||this.isTracked("columnDefinition")||this.isTracked("rowParentIds")}trackAllStateChanged(){this.trackAll(),this.queueUpdate()}get hasPendingUpdates(){return this.updateQueued}trackColumnPropertyChanged(t){$D(t,"columnId")?this.track("columnIds"):LR(t,"operandDataRecordFieldName","sortOperation")?this.track("columnDefinition"):$D(t,"sortingDisabled")||LR(t,"currentSortDirection","currentSortIndex")?this.track("columnSort"):$D(t,"columnHidden")||LR(t,"currentFractionalWidth","currentPixelWidth","minPixelWidth")?this.track("columnWidths"):$D(t,"actionMenuSlot")?this.track("actionMenuSlots"):LR(t,"groupIndex","groupingDisabled")&&this.track("groupRows"),this.queueUpdate()}trackColumnInstancesChanged(){this.track("columnIds"),this.track("columnDefinition"),this.track("columnSort"),this.track("columnWidths"),this.track("actionMenuSlots"),this.track("groupRows"),this.queueUpdate()}trackIdFieldNameChanged(){this.track("rowIds"),this.queueUpdate()}trackParentIdFieldNameChanged(){this.track("rowParentIds"),this.queueUpdate()}trackSelectionModeChanged(){this.track("selectionMode"),this.queueUpdate()}queueUpdate(){this.table.$fastController.isConnected&&(this.updateQueued||(this.updateQueued=!0,u.queueUpdate((()=>{this.table.update(),this.untrackAll(),this.updateQueued=!1}))))}}class ED{constructor(t){this.tanStackTable=t}reset(){}toggleIsRowSelected(t,e){t.isGroupRow&&t.selectionState===IR?this.deselectAllLeafRows(t.id):this.tanStackTable.getRow(t.id).toggleSelected(e,{selectChildren:t.isGroupRow})}selectSingleRow(t){if(t.isGroupRow)throw new Error("function not intended to select grouped rows")
@@ -10890,7 +10902,7 @@ const e=this.calculateTanStackData(t)
10890
10902
  this.updateTableOptions(e)}async getSelectedRecordIds(){return await this.processPendingUpdates(),this.selectionManager.getCurrentSelectedRecordIds()}async setSelectedRecordIds(t){await this.processPendingUpdates(),this.selectionMode!==_R.none&&this.updateTableOptions({state:{rowSelection:this.calculateTanStackSelectionState(t)}})}async setRecordHierarchyOptions(t){await this.processPendingUpdates()
10891
10903
  const e=structuredClone(t),n=this.tableValidator.getOptionsWithPresentIds(e)
10892
10904
  this.expansionManager.setHierarchyOptions(n),this.refreshRows()}connectedCallback(){super.connectedCallback(),this.initialize(),this.virtualizer.connect(),this.viewport.addEventListener("scroll",this.onViewPortScroll,{passive:!0}),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.onKeyUp)}disconnectedCallback(){super.disconnectedCallback(),this.virtualizer.disconnect(),this.viewport.removeEventListener("scroll",this.onViewPortScroll),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp)}checkValidity(){return this.tableValidator.isValid()}handleChange(t,e){(t instanceof FR||t instanceof zR)&&"string"==typeof e?"validConfiguration"===e?this.tableValidator.validateColumnConfigurations(this.columns):this.tableUpdateTracker.trackColumnPropertyChanged(e):t instanceof SD&&"isColumnBeingSized"===e&&!this.layoutManager.isColumnBeingSized&&this.emitColumnConfigurationChangeEvent()}onRowSelectionToggle(t,e){e.stopImmediatePropagation()
10893
- this.selectionManager.handleRowSelectionToggle(this.tableData[t],e.detail.newState,this.documentShiftKeyDown)&&this.emitSelectionChangeEvent()}onRowClick(t,e){return this.selectionManager.handleRowClick(this.tableData[t],e.shiftKey,e.ctrlKey||e.metaKey)&&this.emitSelectionChangeEvent(),!0}onAllRowsSelectionChange(t){t.stopPropagation(),this.ignoreSelectionChangeEvents||(this.table.toggleAllRowsSelected(this.selectionCheckbox.checked),this.emitSelectionChangeEvent())}onRowActionMenuBeforeToggle(t,e){e.stopImmediatePropagation(),this.handleActionMenuBeforeToggleEvent(t,e)}onRowActionMenuToggle(t){t.stopImmediatePropagation(),this.handleRowActionMenuToggleEvent(t)}handleCollapseAllRows(){this.expansionManager.collapseAll()}onRightDividerMouseDown(t,e){0===t.button&&this.layoutManager.beginColumnInteractiveSize(t.clientX,2*e)}onLeftDividerMouseDown(t,e){0===t.button&&this.layoutManager.beginColumnInteractiveSize(t.clientX,2*e-1)}handleGroupRowExpanded(t,e){this.toggleRowExpanded(t),e.stopPropagation()}handleRowExpanded(t){this.toggleRowExpanded(t)}toggleColumnSort(t,e){if(t.sortingDisabled)return
10905
+ this.selectionManager.handleRowSelectionToggle(this.tableData[t],e.detail.newState,this.documentShiftKeyDown)&&this.emitSelectionChangeEvent()}onRowClick(t,e){return this.selectionManager.handleRowClick(this.tableData[t],e.shiftKey,e.ctrlKey||e.metaKey)&&this.emitSelectionChangeEvent(),!0}onAllRowsSelectionChange(t){t.stopPropagation(),this.ignoreSelectionChangeEvents||(this.table.toggleAllRowsSelected(this.selectionCheckbox.checked),this.emitSelectionChangeEvent())}onRowActionMenuBeforeToggle(t,e){e.stopImmediatePropagation(),this.handleActionMenuBeforeToggleEvent(t,e)}onRowActionMenuToggle(t){t.stopImmediatePropagation(),this.handleRowActionMenuToggleEvent(t)}handleCollapseAllRows(){this.expansionManager.collapseAll()}onRightDividerMouseDown(t,e){0===t.button&&this.layoutManager.beginColumnInteractiveSize(t.clientX,this.getRightDividerIndex(e))}onLeftDividerMouseDown(t,e){0===t.button&&this.layoutManager.beginColumnInteractiveSize(t.clientX,this.getLeftDividerIndex(e))}getLeftDividerIndex(t){return 2*t-1}getRightDividerIndex(t){return 2*t}handleGroupRowExpanded(t,e){this.toggleRowExpanded(t),e.stopPropagation()}handleRowExpanded(t){this.toggleRowExpanded(t)}toggleColumnSort(t,e){if(t.sortingDisabled)return
10894
10906
  const n=this.getColumnsParticipatingInSorting().sort(((t,e)=>t.columnInternals.currentSortIndex-e.columnInternals.currentSortIndex)),i=n.indexOf(t),o=i>-1,s=t.columnInternals.currentSortDirection
10895
10907
  let r=MR.ascending
10896
10908
  o?s===MR.descending?(n.splice(i,1),r=MR.none,t.columnInternals.currentSortIndex=void 0):r=MR.descending:n.push(t),t.columnInternals.currentSortDirection=r