@ni/nimble-components 34.9.0 → 34.10.0

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 (25) hide show
  1. package/dist/all-components-bundle.js +56 -14
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +16 -16
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/table/components/row/index.js +1 -0
  6. package/dist/esm/table/components/row/index.js.map +1 -1
  7. package/dist/esm/table/index.d.ts +2 -0
  8. package/dist/esm/table/index.js +23 -5
  9. package/dist/esm/table/index.js.map +1 -1
  10. package/dist/esm/table/models/interactive-selection-manager.d.ts +3 -1
  11. package/dist/esm/table/models/interactive-selection-manager.js +12 -7
  12. package/dist/esm/table/models/interactive-selection-manager.js.map +1 -1
  13. package/dist/esm/table/models/selection-managers/multi-selection-manager.js +3 -0
  14. package/dist/esm/table/models/selection-managers/multi-selection-manager.js.map +1 -1
  15. package/dist/esm/table/models/selection-managers/selection-manager-base.d.ts +3 -1
  16. package/dist/esm/table/models/selection-managers/selection-manager-base.js +5 -1
  17. package/dist/esm/table/models/selection-managers/selection-manager-base.js.map +1 -1
  18. package/dist/esm/table/models/selection-managers/single-selection-manager.js +3 -0
  19. package/dist/esm/table/models/selection-managers/single-selection-manager.js.map +1 -1
  20. package/dist/esm/table/models/table-update-tracker.d.ts +3 -1
  21. package/dist/esm/table/models/table-update-tracker.js +9 -1
  22. package/dist/esm/table/models/table-update-tracker.js.map +1 -1
  23. package/dist/esm/table/types.d.ts +1 -0
  24. package/dist/esm/table/types.js.map +1 -1
  25. package/package.json +4 -3
@@ -11765,7 +11765,7 @@ const n={oldState:t,newState:e}
11765
11765
  this.$emit("row-selection-toggle",n)}onCellActionMenuBeforeToggle(t,e){this.currentActionMenuColumn=e,this.emitActionMenuToggleEvent("row-action-menu-beforetoggle",t.detail,e)}onCellActionMenuToggle(t,e){this.menuOpen=t.detail.newState,t.detail.newState||(this.currentActionMenuColumn=void 0),this.emitActionMenuToggleEvent("row-action-menu-toggle",t.detail,e)}handleChange(t,e){t instanceof EL&&"string"==typeof e&&(AL(e,"columnConfig")||AL(e,"dataRecordFieldNames"))&&this.updateCellStates()}getFocusableElements(){return{selectionCheckbox:this.showSelectionCheckbox?this.selectionCheckbox:void 0,cells:Array.from(this.cellContainer.querySelectorAll(jL)).map((t=>({cell:t,actionMenuButton:t.hasActionMenu?t.actionMenuButton:void 0})))}}onRowExpandToggle(t){const e={oldState:this.expanded,newState:!this.expanded,recordId:this.recordId}
11766
11766
  this.$emit("row-expand-toggle",e),t?.stopImmediatePropagation(),this.animationClass="animating",this.expandIcon?.addEventListener("transitionend",this.removeAnimatingClass)}onCellViewSlotsRequest(t,e){if(e.stopImmediatePropagation(),"string"!=typeof this.recordId)return
11767
11767
  const n={recordId:this.recordId,columnInternalId:t.columnInternals.uniqueId,slots:e.detail.slots}
11768
- this.$emit("row-slots-request",n)}emitActionMenuToggleEvent(t,e,n){const i={newState:e.newState,oldState:e.oldState,recordIds:[this.recordId],columnId:n.columnId}
11768
+ this.$emit("row-slots-request",n)}emitActionMenuToggleEvent(t,e,n){const i={newState:e.newState,oldState:e.oldState,recordIds:[this.recordId],operatingRecordId:this.recordId,columnId:n.columnId}
11769
11769
  this.$emit(t,i)}columnsChanged(){this.updateCellIndentLevels(),this.updateCellStates(),this.observeColumns()}dataRecordChanged(){this.updateCellStates()}nestingLevelChanged(){this.updateCellIndentLevels()}updateCellIndentLevels(){this.cellIndentLevels=this.columns.map(((t,e)=>0===e?this.nestingLevel:0))}removeColumnObservers(){this.columnNotifiers.forEach((t=>{t.unsubscribe(this)})),this.columnNotifiers=[]}observeColumns(){this.removeColumnObservers(),this.columnNotifiers=this.columns.map((t=>{const e=x.getNotifier(t.columnInternals)
11770
11770
  return e.subscribe(this),e}))}updateCellStates(){this.cellStates=this.columns.map((t=>{const e=t.columnInternals.dataRecordFieldNames
11771
11771
  let n
@@ -12243,8 +12243,8 @@ let n=0
12243
12243
  for(let t=0;t<this.visibleColumns.length&&n<this.gridSizedColumns.length;t++){const i=this.visibleColumns[t]
12244
12244
  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([C],wB.prototype,"isColumnBeingSized",void 0),t([C],wB.prototype,"activeColumnIndex",void 0),t([C],wB.prototype,"activeColumnDivider",void 0)
12245
12245
  const xB=(t,...e)=>{for(const n of e)if(t===n)return!0
12246
- return!1},CB=["rowIds","rowParentIds","groupRows","columnIds","columnHidden","columnSort","columnSortDisabled","columnWidths","columnDefinition","actionMenuSlots","selectionMode"]
12247
- class kB extends FT{constructor(t){super(CB),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")}get requiresKeyboardFocusReset(){return this.isTracked("columnSortDisabled")||this.isTracked("columnDefinition")||this.isTracked("columnHidden")||this.isTracked("selectionMode")||this.isTracked("actionMenuSlots")}trackAllStateChanged(){this.trackAll(),this.queueUpdate()}get hasPendingUpdates(){return this.updateQueued}trackColumnPropertyChanged(t){xB(t,"columnId")?this.track("columnIds"):AL(t,"operandDataRecordFieldName","sortOperation")?this.track("columnDefinition"):AL(t,"sortingDisabled")?(this.track("columnSort"),this.track("columnSortDisabled")):AL(t,"currentSortDirection","currentSortIndex")?this.track("columnSort"):AL(t,"currentFractionalWidth","currentPixelWidth","minPixelWidth","resizingDisabled")?this.track("columnWidths"):xB(t,"columnHidden")?(this.track("columnWidths"),this.track("columnHidden")):xB(t,"actionMenuSlot")?this.track("actionMenuSlots"):AL(t,"groupIndex","groupingDisabled")&&this.track("groupRows"),this.queueUpdate()}trackColumnInstancesChanged(){this.track("columnIds"),this.track("columnDefinition"),this.track("columnSort"),this.track("columnSortDisabled"),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,b.queueUpdate((()=>{this.table.update(),this.untrackAll(),this.updateQueued=!1}))))}}class SB{constructor(t){this.tanStackTable=t}reset(){}toggleIsRowSelected(t,e){t.isGroupRow&&t.selectionState===aL?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")
12246
+ return!1},CB=["rowIds","rowParentIds","groupRows","columnIds","columnHidden","columnSort","columnSortDisabled","columnWidths","columnDefinition","actionMenuSlots","selectionMode","actionMenusPreserveSelection"]
12247
+ class kB extends FT{constructor(t){super(CB),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 updateActionMenusPreserveSelection(){return this.isTracked("actionMenusPreserveSelection")}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")}get requiresKeyboardFocusReset(){return this.isTracked("columnSortDisabled")||this.isTracked("columnDefinition")||this.isTracked("columnHidden")||this.isTracked("selectionMode")||this.isTracked("actionMenuSlots")}trackAllStateChanged(){this.trackAll(),this.queueUpdate()}get hasPendingUpdates(){return this.updateQueued}trackColumnPropertyChanged(t){xB(t,"columnId")?this.track("columnIds"):AL(t,"operandDataRecordFieldName","sortOperation")?this.track("columnDefinition"):AL(t,"sortingDisabled")?(this.track("columnSort"),this.track("columnSortDisabled")):AL(t,"currentSortDirection","currentSortIndex")?this.track("columnSort"):AL(t,"currentFractionalWidth","currentPixelWidth","minPixelWidth","resizingDisabled")?this.track("columnWidths"):xB(t,"columnHidden")?(this.track("columnWidths"),this.track("columnHidden")):xB(t,"actionMenuSlot")?this.track("actionMenuSlots"):AL(t,"groupIndex","groupingDisabled")&&this.track("groupRows"),this.queueUpdate()}trackColumnInstancesChanged(){this.track("columnIds"),this.track("columnDefinition"),this.track("columnSort"),this.track("columnSortDisabled"),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()}trackActionMenusPreserveSelectionChanged(){this.track("actionMenusPreserveSelection"),this.queueUpdate()}queueUpdate(){this.table.$fastController.isConnected&&(this.updateQueued||(this.updateQueued=!0,b.queueUpdate((()=>{this.table.update(),this.untrackAll(),this.updateQueued=!1}))))}}class SB{constructor(t,e){this.tanStackTable=t,this.actionMenusPreserveSelection=e}updateActionMenusPreserveSelection(t){this.actionMenusPreserveSelection=t}reset(){}toggleIsRowSelected(t,e){t.isGroupRow&&t.selectionState===aL?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")
12248
12248
  const e=this.tanStackTable.getState().rowSelection,n=[]
12249
12249
  if(Object.entries(e).forEach((([t,e])=>{e&&n.push(t)})),1===n.length&&n[0]===t.id)return!1
12250
12250
  const i={}
@@ -12256,7 +12256,7 @@ return this.getOrderedRows(t)}getOrderedRows(t){const e=[]
12256
12256
  for(const n of t)e.push(n),n.subRows?.length&&e.push(...this.getOrderedRows(n.subRows))
12257
12257
  return e}}class _B extends SB{handleRowSelectionToggle(t,e,n){return!1}handleRowClick(t,e,n){return!1}handleActionMenuOpening(t){return!1}}class MB extends SB{handleRowSelectionToggle(t,e,n){return n&&this.tryUpdateRangeSelection(t.id,!0)||(this.shiftSelectStartRowId=e?t.id:void 0,this.previousShiftSelectRowEndId=void 0,this.toggleIsRowSelected(t,e)),!0}handleRowClick(t,e,n){if(e){const e=n
12258
12258
  if(this.tryUpdateRangeSelection(t.id,e))return!0}if(n){const e=t.selectionState!==aL
12259
- return this.shiftSelectStartRowId=e?t.id:void 0,this.previousShiftSelectRowEndId=void 0,this.toggleIsRowSelected(t),!0}return this.shiftSelectStartRowId=t.id,this.previousShiftSelectRowEndId=void 0,this.selectSingleRow(t)}handleActionMenuOpening(t){return t.selectionState!==aL&&this.selectSingleRow(t)}reset(){this.shiftSelectStartRowId=void 0,this.previousShiftSelectRowEndId=void 0}tryUpdateRangeSelection(t,e){if(void 0===this.shiftSelectStartRowId)return!1
12259
+ return this.shiftSelectStartRowId=e?t.id:void 0,this.previousShiftSelectRowEndId=void 0,this.toggleIsRowSelected(t),!0}return this.shiftSelectStartRowId=t.id,this.previousShiftSelectRowEndId=void 0,this.selectSingleRow(t)}handleActionMenuOpening(t){return!this.actionMenusPreserveSelection&&(t.selectionState!==aL&&this.selectSingleRow(t))}reset(){this.shiftSelectStartRowId=void 0,this.previousShiftSelectRowEndId=void 0}tryUpdateRangeSelection(t,e){if(void 0===this.shiftSelectStartRowId)return!1
12260
12260
  const n=this.getAllOrderedRows(),i=this.getRowIndexForId(this.shiftSelectStartRowId,n)
12261
12261
  if(-1===i)return!1
12262
12262
  let o={}
@@ -12266,12 +12266,12 @@ this.updateSelectionStateForRange(t,n,o,i,!0)}updateSelectionStateForRange(t,e,n
12266
12266
  const r=Math.min(e,n),s=Math.max(e,n)
12267
12267
  for(let e=r;e<=s;e++){const n=i[e]
12268
12268
  n.getIsGrouped()||this.updateSelectionStateForRow(t,n.id,o)}const a=i[n]
12269
- a.getIsGrouped()&&this.getAllLeafRowIds(a.id).forEach((e=>this.updateSelectionStateForRow(t,e,o)))}updateSelectionStateForRow(t,e,n){n?t[e]=!0:delete t[e]}getRowIndexForId(t,e){return t?e.findIndex((e=>e.id===t)):-1}}class IB extends SB{handleRowSelectionToggle(t,e,n){return this.toggleIsRowSelected(t,e),!0}handleRowClick(t,e,n){return this.selectSingleRow(t)}handleActionMenuOpening(t){return this.handleRowClick(t,!1,!1)}}class $B{constructor(t,e){this.tanStackTable=t,this.selectionManager=this.createSelectionManager(e)}handleRowSelectionToggle(t,e,n){return!!t&&this.selectionManager.handleRowSelectionToggle(t,e,n)}handleRowClick(t,e,n){return!!t&&this.selectionManager.handleRowClick(t,e,n)}handleActionMenuOpening(t){return!!t&&this.selectionManager.handleActionMenuOpening(t)}handleSelectionModeChanged(t){this.selectionManager=this.createSelectionManager(t)}handleSelectionReset(){this.selectionManager.reset()}getCurrentSelectedRecordIds(){const t=this.tanStackTable.options.state.rowSelection
12269
+ a.getIsGrouped()&&this.getAllLeafRowIds(a.id).forEach((e=>this.updateSelectionStateForRow(t,e,o)))}updateSelectionStateForRow(t,e,n){n?t[e]=!0:delete t[e]}getRowIndexForId(t,e){return t?e.findIndex((e=>e.id===t)):-1}}class IB extends SB{handleRowSelectionToggle(t,e,n){return this.toggleIsRowSelected(t,e),!0}handleRowClick(t,e,n){return this.selectSingleRow(t)}handleActionMenuOpening(t){return!this.actionMenusPreserveSelection&&this.handleRowClick(t,!1,!1)}}class $B{constructor(t,e,n){this.tanStackTable=t,this.actionMenusPreserveSelection=n,this.selectionManager=this.createSelectionManager(e,n)}handleRowSelectionToggle(t,e,n){return!!t&&this.selectionManager.handleRowSelectionToggle(t,e,n)}handleRowClick(t,e,n){return!!t&&this.selectionManager.handleRowClick(t,e,n)}handleActionMenuOpening(t){return!!t&&this.selectionManager.handleActionMenuOpening(t)}handleSelectionModeChanged(t){this.selectionManager=this.createSelectionManager(t,this.actionMenusPreserveSelection)}handleActionMenusPreserveSelectionChanged(t){this.actionMenusPreserveSelection=t,this.selectionManager.updateActionMenusPreserveSelection(t)}handleSelectionReset(){this.selectionManager.reset()}getCurrentSelectedRecordIds(){const t=this.tanStackTable.options.state.rowSelection
12270
12270
  if(!t)return[]
12271
12271
  const e=[]
12272
- return Object.entries(t).forEach((([t,n])=>{n&&e.push(t)})),e}createSelectionManager(t){switch(t){case rL.multiple:return new MB(this.tanStackTable)
12273
- case rL.single:return new IB(this.tanStackTable)
12274
- case rL.none:return new _B(this.tanStackTable)
12272
+ return Object.entries(t).forEach((([t,n])=>{n&&e.push(t)})),e}createSelectionManager(t,e){switch(t){case rL.multiple:return new MB(this.tanStackTable,e)
12273
+ case rL.single:return new IB(this.tanStackTable,e)
12274
+ case rL.none:return new _B(this.tanStackTable,e)
12275
12275
  default:throw new Error("unknown selection mode found")}}}function EB(t,e){const n=e,i=[],o={},r=new Set
12276
12276
  for(let e=0;e<t.length;e++){const s=t[e],a=s[n.id],l=s[n.parentId]
12277
12277
  Object.prototype.hasOwnProperty.call(o,a)||(o[a]={subRows:[],clientRecord:void 0,originalIndex:void 0}),r&&r.delete(a),o[a].clientRecord=s
@@ -12428,7 +12428,7 @@ const i=e??this.columnIndex,o=n??this.rowIndex
12428
12428
  return i>=0&&i<t.cells.length&&(this.focusType=gL,this.setRowCellFocusState(i,o,!0),!0)}trySetCellContentFocus(t,e,n,i){if(!t)return!1
12429
12429
  const o=n??this.columnIndex,r=i??this.rowIndex
12430
12430
  return o>=0&&o<t.cells.length&&e>=0&&e<t.cells[o].cell.cellView.tabbableChildren.length&&(this.setCellContentFocusState(e,r,o,!0),!0)}trySetCellActionMenuFocus(t,e,n){const i=e??this.columnIndex,o=n??this.rowIndex
12431
- return!!(i>=0&&i<t.cells.length&&t.cells[i].actionMenuButton)&&(this.setCellActionMenuFocusState(o,i,!0),!0)}setCellActionMenuFocusState(t,e,n){this.focusType=vL,this.setRowCellFocusState(e,t,n)}setCellContentFocusState(t,e,n,i){this.focusType=bL,this.cellContentIndex=t,this.setRowCellFocusState(n,e,i)}setRowFocusState(t){this.focusType=fL,void 0!==t&&(this.rowIndex=t)}setCellFocusState(t,e,n){this.focusType=gL,this.setRowCellFocusState(t,e,n)}setRowCellFocusState(t,e,n){this.rowIndex=e,this.columnIndex=t,n&&this.focusCurrentRow(!0)}isResolvedRowType(t){return t instanceof GL||t instanceof JL}}let NB=class extends je{get validity(){return this.tableValidator.getValidity()}get showRowOperationColumn(){return this.selectionMode===rL.multiple||this.showCollapseAll}get collapseButtonVisibility(){return this.canHaveCollapsibleRows?this.showCollapseAll?"visible":"":"hidden-size-reduced"}get rowHeight(){return this._rowHeight}constructor(){super(),this.selectionMode=rL.none,this.tableData=[],this.columns=[],this.childItems=[],this.rowElements=[],this.canRenderRows=!0,this.scrollX=0,this.selectionState=sL,this.showCollapseAll=!1,this.canHaveCollapsibleRows=!1,this.visibleColumns=[],this.tableScrollableMinWidth=0,this.windowShiftKeyDown=!1,this.tableValidator=new DL,this.tableUpdateTracker=new kB(this),this.columnNotifiers=[],this._rowHeight=0,this.isInitialized=!1,this.ignoreSelectionChangeEvents=!1,this.requestedSlots=new Map,this.borderWidthSubscriber={handleChange:()=>{this.updateRowHeight()}},this.controlHeightSubscriber={handleChange:()=>{this.updateRowHeight()}},this.actionMenuSlots=[],this.onViewPortScroll=t=>{this.scrollX=t.target.scrollLeft},this.onKeyDown=t=>{this.windowShiftKeyDown=t.shiftKey},this.onKeyUp=t=>{this.windowShiftKeyDown=t.shiftKey},this.onBlur=()=>{this.windowShiftKeyDown=!1},this.getRowCanExpand=t=>this.expansionManager.isRowExpandable(t),this.getIsRowExpanded=t=>this.expansionManager.isRowExpanded(t),this.handleRowSelectionChange=t=>{const e=t instanceof Function?t(this.table.getState().rowSelection):t
12431
+ return!!(i>=0&&i<t.cells.length&&t.cells[i].actionMenuButton)&&(this.setCellActionMenuFocusState(o,i,!0),!0)}setCellActionMenuFocusState(t,e,n){this.focusType=vL,this.setRowCellFocusState(e,t,n)}setCellContentFocusState(t,e,n,i){this.focusType=bL,this.cellContentIndex=t,this.setRowCellFocusState(n,e,i)}setRowFocusState(t){this.focusType=fL,void 0!==t&&(this.rowIndex=t)}setCellFocusState(t,e,n){this.focusType=gL,this.setRowCellFocusState(t,e,n)}setRowCellFocusState(t,e,n){this.rowIndex=e,this.columnIndex=t,n&&this.focusCurrentRow(!0)}isResolvedRowType(t){return t instanceof GL||t instanceof JL}}let NB=class extends je{get validity(){return this.tableValidator.getValidity()}get showRowOperationColumn(){return this.selectionMode===rL.multiple||this.showCollapseAll}get collapseButtonVisibility(){return this.canHaveCollapsibleRows?this.showCollapseAll?"visible":"":"hidden-size-reduced"}get rowHeight(){return this._rowHeight}constructor(){super(),this.selectionMode=rL.none,this.actionMenusPreserveSelection=!1,this.tableData=[],this.columns=[],this.childItems=[],this.rowElements=[],this.canRenderRows=!0,this.scrollX=0,this.selectionState=sL,this.showCollapseAll=!1,this.canHaveCollapsibleRows=!1,this.visibleColumns=[],this.tableScrollableMinWidth=0,this.windowShiftKeyDown=!1,this.tableValidator=new DL,this.tableUpdateTracker=new kB(this),this.columnNotifiers=[],this._rowHeight=0,this.isInitialized=!1,this.ignoreSelectionChangeEvents=!1,this.requestedSlots=new Map,this.borderWidthSubscriber={handleChange:()=>{this.updateRowHeight()}},this.controlHeightSubscriber={handleChange:()=>{this.updateRowHeight()}},this.actionMenuSlots=[],this.onViewPortScroll=t=>{this.scrollX=t.target.scrollLeft},this.onKeyDown=t=>{this.windowShiftKeyDown=t.shiftKey},this.onKeyUp=t=>{this.windowShiftKeyDown=t.shiftKey},this.onBlur=()=>{this.windowShiftKeyDown=!1},this.getRowCanExpand=t=>this.expansionManager.isRowExpandable(t),this.getIsRowExpanded=t=>this.expansionManager.isRowExpanded(t),this.handleRowSelectionChange=t=>{const e=t instanceof Function?t(this.table.getState().rowSelection):t
12432
12432
  this.updateTableOptions({state:{rowSelection:e}})},this.handleExpandedChange=t=>{const e=t instanceof Function?t(this.table.getState().expanded):t
12433
12433
  this.updateTableOptions({state:{expanded:e}})},this.options={data:[],onStateChange:t=>{},onRowSelectionChange:this.handleRowSelectionChange,onExpandedChange:this.handleExpandedChange,getCoreRowModel:t=>rN((()=>[t.options.data]),(e=>{const n={rows:[],flatRows:[],rowsById:{}},i=function(e,o,r){void 0===o&&(o=0)
12434
12434
  const s=[]
@@ -12451,7 +12451,7 @@ d=n&&i?0:n?l:-l}}if(0===d&&(d=a.sortingFn(t,e,o.id)),0!==d)return c&&(d*=-1),a.i
12451
12451
  o.push(t),null!=(e=t.subRows)&&e.length&&(t.subRows=a(t.subRows))})),e}
12452
12452
  return{rows:a(n.rows),flatRows:o,rowsById:n.rowsById}}),sN(t.options,"debugTable",0,(()=>t._autoResetPageIndex()))),getGroupedRowModel:tL(),getExpandedRowModel:t=>rN((()=>[t.getState().expanded,t.getPreExpandedRowModel(),t.options.paginateExpandedRows]),((t,e,n)=>!e.rows.length||!0!==t&&!Object.keys(null!=t?t:{}).length?e:n?function(t){const e=[],n=t=>{var i
12453
12453
  e.push(t),null!=(i=t.subRows)&&i.length&&t.getIsExpanded()&&t.subRows.forEach(n)}
12454
- return t.rows.forEach(n),{rows:e,flatRows:t.flatRows,rowsById:t.rowsById}}(e):e),sN(t.options,"debugTable")),getRowCanExpand:this.getRowCanExpand,getIsRowExpanded:this.getIsRowExpanded,getSubRows:t=>t.subRows,columns:[],state:{rowSelection:{},grouping:[],expanded:!0},enableRowSelection:t=>!t.getIsGrouped(),enableMultiRowSelection:!1,enableSubRowSelection:!1,enableSorting:!0,enableGrouping:!0,renderFallbackValue:null,autoResetAll:!1},this.table=QN(this.options),this.virtualizer=new gB(this,this.table),this.keyboardNavigationManager=new FB(this,this.virtualizer),this.layoutManager=new wB(this),this.layoutManagerNotifier=x.getNotifier(this.layoutManager),this.layoutManagerNotifier.subscribe(this,"isColumnBeingSized"),this.selectionManager=new $B(this.table,this.selectionMode),this.expansionManager=new DB(this.table)}async setData(t){await this.processPendingUpdates()
12454
+ return t.rows.forEach(n),{rows:e,flatRows:t.flatRows,rowsById:t.rowsById}}(e):e),sN(t.options,"debugTable")),getRowCanExpand:this.getRowCanExpand,getIsRowExpanded:this.getIsRowExpanded,getSubRows:t=>t.subRows,columns:[],state:{rowSelection:{},grouping:[],expanded:!0},enableRowSelection:t=>!t.getIsGrouped(),enableMultiRowSelection:!1,enableSubRowSelection:!1,enableSorting:!0,enableGrouping:!0,renderFallbackValue:null,autoResetAll:!1},this.table=QN(this.options),this.virtualizer=new gB(this,this.table),this.keyboardNavigationManager=new FB(this,this.virtualizer),this.layoutManager=new wB(this),this.layoutManagerNotifier=x.getNotifier(this.layoutManager),this.layoutManagerNotifier.subscribe(this,"isColumnBeingSized"),this.selectionManager=new $B(this.table,this.selectionMode,this.actionMenusPreserveSelection),this.expansionManager=new DB(this.table)}async setData(t){await this.processPendingUpdates()
12455
12455
  const e=t.map((t=>({...t}))),n=this.calculateTanStackData(e)
12456
12456
  this.updateTableOptions(n)}async getSelectedRecordIds(){return await this.processPendingUpdates(),this.selectionManager.getCurrentSelectedRecordIds()}async setSelectedRecordIds(t){await this.processPendingUpdates(),this.selectionMode!==rL.none&&this.updateTableOptions({state:{rowSelection:this.calculateTanStackSelectionState(t)}})}async setRecordHierarchyOptions(t){await this.processPendingUpdates()
12457
12457
  const e=structuredClone(t),n=this.tableValidator.getOptionsWithPresentIds(e)
@@ -12465,20 +12465,20 @@ o?r===oL.descending?(n.splice(i,1),s=oL.none,t.columnInternals.currentSortIndex=
12465
12465
  for(let i=0;i<n.length;i++){const o=n[i]
12466
12466
  e?n[i].columnInternals.currentSortIndex=i:o===t?o.columnInternals.currentSortIndex=0:(o.columnInternals.currentSortIndex=void 0,o.columnInternals.currentSortDirection=oL.none)}this.emitColumnConfigurationChangeEvent()}onHeaderKeyDown(t,e){const n=e.shiftKey
12467
12467
  return e.key===dn&&this.toggleColumnSort(t,n),!0}update(){if(this.validate(),this.tableUpdateTracker.requiresTanStackUpdate&&this.updateTanStack(),this.tableUpdateTracker.updateRowParentIds||this.tableUpdateTracker.updateGroupRows){const t=this.isHierarchyEnabled(),e=this.columns.some((t=>!t.columnInternals.groupingDisabled))
12468
- this.canHaveCollapsibleRows=t||e}this.tableUpdateTracker.updateActionMenuSlots&&this.updateActionMenuSlots(),this.tableUpdateTracker.updateColumnWidths&&(this.rowGridColumns=this.layoutManager.getGridTemplateColumns(),this.visibleColumns=this.columns.filter((t=>!t.columnHidden))),this.tableUpdateTracker.requiresKeyboardFocusReset&&this.keyboardNavigationManager.resetFocusState()}get ariaMultiSelectable(){switch(this.selectionMode){case rL.multiple:return"true"
12468
+ this.canHaveCollapsibleRows=t||e}this.tableUpdateTracker.updateActionMenuSlots&&this.updateActionMenuSlots(),this.tableUpdateTracker.updateActionMenusPreserveSelection&&this.selectionManager.handleActionMenusPreserveSelectionChanged(this.actionMenusPreserveSelection),this.tableUpdateTracker.updateColumnWidths&&(this.rowGridColumns=this.layoutManager.getGridTemplateColumns(),this.visibleColumns=this.columns.filter((t=>!t.columnHidden))),this.tableUpdateTracker.requiresKeyboardFocusReset&&this.keyboardNavigationManager.resetFocusState()}get ariaMultiSelectable(){switch(this.selectionMode){case rL.multiple:return"true"
12469
12469
  case rL.single:return"false"
12470
12470
  default:return null}}getHeaderContainerElements(){return this.columnHeadersContainer.querySelectorAll(".header-container")}calculateTanStackData(t){this.dataHierarchyManager=new TB(t,this.idFieldName,this.parentIdFieldName)
12471
12471
  const e=this.dataHierarchyManager.hierarchicalData
12472
12472
  this.tableValidator.setParentIdConfigurationValidity(this.dataHierarchyManager.parentIdConfigurationValid)
12473
12473
  const n={data:e}
12474
12474
  if(this.validateWithData(t),this.tableValidator.areRecordIdsValid()){const t=this.selectionManager.getCurrentSelectedRecordIds()
12475
- n.state={rowSelection:this.calculateTanStackSelectionState(t),expanded:!0}}return n}selectionModeChanged(t,e){this.$fastController.isConnected&&this.tableUpdateTracker.trackSelectionModeChanged()}idFieldNameChanged(t,e){this.$fastController.isConnected&&this.tableUpdateTracker.trackIdFieldNameChanged()}parentIdFieldNameChanged(t,e){this.$fastController.isConnected&&this.tableUpdateTracker.trackParentIdFieldNameChanged()}columnsChanged(t,e){this.$fastController.isConnected&&(this.observeColumns(),this.tableUpdateTracker.trackColumnInstancesChanged())}updateRequestedSlotsForOpeningActionMenu(t){for(const e of this.actionMenuSlots)this.requestedSlots.set(e,{recordId:t,uniqueSlot:`row-action-menu-${e}`})
12476
- this.refreshRows()}async handleActionMenuBeforeToggleEvent(t,e){this.selectionManager.handleActionMenuOpening(this.tableData[t])&&await this.emitSelectionChangeEvent(),this.openActionMenuRecordId=e.detail.recordIds[0],this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId)
12475
+ n.state={rowSelection:this.calculateTanStackSelectionState(t),expanded:!0}}return n}selectionModeChanged(t,e){this.$fastController.isConnected&&this.tableUpdateTracker.trackSelectionModeChanged()}actionMenusPreserveSelectionChanged(t,e){this.$fastController.isConnected&&this.tableUpdateTracker.trackActionMenusPreserveSelectionChanged()}idFieldNameChanged(t,e){this.$fastController.isConnected&&this.tableUpdateTracker.trackIdFieldNameChanged()}parentIdFieldNameChanged(t,e){this.$fastController.isConnected&&this.tableUpdateTracker.trackParentIdFieldNameChanged()}columnsChanged(t,e){this.$fastController.isConnected&&(this.observeColumns(),this.tableUpdateTracker.trackColumnInstancesChanged())}updateRequestedSlotsForOpeningActionMenu(t){for(const e of this.actionMenuSlots)this.requestedSlots.set(e,{recordId:t,uniqueSlot:`row-action-menu-${e}`})
12476
+ this.refreshRows()}async handleActionMenuBeforeToggleEvent(t,e){this.selectionManager.handleActionMenuOpening(this.tableData[t])&&await this.emitSelectionChangeEvent(),this.openActionMenuRecordId=e.detail.operatingRecordId,this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId)
12477
12477
  const n=await this.getActionMenuToggleEventDetail(e)
12478
12478
  this.$emit("action-menu-beforetoggle",n)}async handleRowActionMenuToggleEvent(t){this.keyboardNavigationManager.onRowActionMenuToggle(t)
12479
12479
  const e=await this.getActionMenuToggleEventDetail(t)
12480
- this.$emit("action-menu-toggle",e),t.detail.newState||(this.openActionMenuRecordId=void 0)}async getActionMenuToggleEventDetail(t){const e=this.selectionMode===rL.multiple?await this.getSelectedRecordIds():[this.openActionMenuRecordId]
12481
- return{...t.detail,recordIds:e}}removeColumnObservers(){this.columnNotifiers.forEach((t=>{t.unsubscribe(this)})),this.columnNotifiers=[]}initialize(){this.isInitialized||(this.isInitialized=!0,this.$fastController.onConnectedCallback(),this.tableUpdateTracker.trackAllStateChanged(),this.observeColumns())}async processPendingUpdates(){if(this.initialize(),await b.nextUpdate(),this.tableUpdateTracker.hasPendingUpdates)throw new Error("Expected pending updates to be resolved")}observeColumns(){this.removeColumnObservers()
12480
+ this.$emit("action-menu-toggle",e),t.detail.newState||(this.openActionMenuRecordId=void 0)}async getActionMenuToggleEventDetail(t){let e
12481
+ return e=this.selectionMode===rL.multiple||this.actionMenusPreserveSelection?await this.getSelectedRecordIds():[this.openActionMenuRecordId],{...t.detail,recordIds:e}}removeColumnObservers(){this.columnNotifiers.forEach((t=>{t.unsubscribe(this)})),this.columnNotifiers=[]}initialize(){this.isInitialized||(this.isInitialized=!0,this.$fastController.onConnectedCallback(),this.tableUpdateTracker.trackAllStateChanged(),this.observeColumns())}async processPendingUpdates(){if(this.initialize(),await b.nextUpdate(),this.tableUpdateTracker.hasPendingUpdates)throw new Error("Expected pending updates to be resolved")}observeColumns(){this.removeColumnObservers()
12482
12482
  for(const t of this.columns){const e=x.getNotifier(t)
12483
12483
  e.subscribe(this),this.columnNotifiers.push(e)
12484
12484
  const n=x.getNotifier(t.columnInternals)
@@ -12510,7 +12510,7 @@ if("string"==typeof n)return e.clientRecord[n]},sortingFn:vB(t.columnInternals.s
12510
12510
  const e={},n=this.tableValidator.getPresentRecordIds(t)
12511
12511
  for(const t of n)if(e[t]=!0,this.selectionMode===rL.single)break
12512
12512
  return e}updateRowHeight(){this._rowHeight=parseFloat(Ll.getValueFor(this))+2*parseFloat(Ul.getValueFor(this)),this.virtualizer?.updateRowHeight()}}
12513
- t([ft({attribute:"id-field-name"})],NB.prototype,"idFieldName",void 0),t([ft({attribute:"parent-id-field-name"})],NB.prototype,"parentIdFieldName",void 0),t([ft({attribute:"selection-mode"})],NB.prototype,"selectionMode",void 0),t([C],NB.prototype,"tableData",void 0),t([C],NB.prototype,"columns",void 0),t([C],NB.prototype,"childItems",void 0),t([C],NB.prototype,"rowElements",void 0),t([C],NB.prototype,"openActionMenuRecordId",void 0),t([C],NB.prototype,"canRenderRows",void 0),t([C],NB.prototype,"scrollX",void 0),t([C],NB.prototype,"rowGridColumns",void 0),t([C],NB.prototype,"selectionState",void 0),t([C],NB.prototype,"selectionCheckbox",void 0),t([C],NB.prototype,"collapseAllButton",void 0),t([C],NB.prototype,"showCollapseAll",void 0),t([C],NB.prototype,"canHaveCollapsibleRows",void 0),t([k],NB.prototype,"collapseButtonVisibility",null),t([C],NB.prototype,"firstSortedColumn",void 0),t([C],NB.prototype,"visibleColumns",void 0),t([C],NB.prototype,"tableScrollableMinWidth",void 0),t([C],NB.prototype,"windowShiftKeyDown",void 0)
12513
+ t([ft({attribute:"id-field-name"})],NB.prototype,"idFieldName",void 0),t([ft({attribute:"parent-id-field-name"})],NB.prototype,"parentIdFieldName",void 0),t([ft({attribute:"selection-mode"})],NB.prototype,"selectionMode",void 0),t([ft({attribute:"action-menus-preserve-selection",mode:"boolean"})],NB.prototype,"actionMenusPreserveSelection",void 0),t([C],NB.prototype,"tableData",void 0),t([C],NB.prototype,"columns",void 0),t([C],NB.prototype,"childItems",void 0),t([C],NB.prototype,"rowElements",void 0),t([C],NB.prototype,"openActionMenuRecordId",void 0),t([C],NB.prototype,"canRenderRows",void 0),t([C],NB.prototype,"scrollX",void 0),t([C],NB.prototype,"rowGridColumns",void 0),t([C],NB.prototype,"selectionState",void 0),t([C],NB.prototype,"selectionCheckbox",void 0),t([C],NB.prototype,"collapseAllButton",void 0),t([C],NB.prototype,"showCollapseAll",void 0),t([C],NB.prototype,"canHaveCollapsibleRows",void 0),t([k],NB.prototype,"collapseButtonVisibility",null),t([C],NB.prototype,"firstSortedColumn",void 0),t([C],NB.prototype,"visibleColumns",void 0),t([C],NB.prototype,"tableScrollableMinWidth",void 0),t([C],NB.prototype,"windowShiftKeyDown",void 0)
12514
12514
  const LB=NB.compose({baseName:"table",template:eB,styles:OL})
12515
12515
  Ei.getOrCreate().withPrefix("nimble").register(LB())
12516
12516
  const BB=It`