@ni/ok-components 0.1.19 → 0.1.21

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.
@@ -11769,7 +11769,7 @@ const n={oldState:t,newState:e}
11769
11769
  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 OL&&"string"==typeof e&&(RL(e,"columnConfig")||RL(e,"dataRecordFieldNames"))&&this.updateCellStates()}getFocusableElements(){return{selectionCheckbox:this.showSelectionCheckbox?this.selectionCheckbox:void 0,cells:Array.from(this.cellContainer.querySelectorAll(KL)).map((t=>({cell:t,actionMenuButton:t.hasActionMenu?t.actionMenuButton:void 0})))}}onRowExpandToggle(t){const e={oldState:this.expanded,newState:!this.expanded,recordId:this.recordId}
11770
11770
  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
11771
11771
  const n={recordId:this.recordId,columnInternalId:t.columnInternals.uniqueId,slots:e.detail.slots}
11772
- this.$emit("row-slots-request",n)}emitActionMenuToggleEvent(t,e,n){const i={newState:e.newState,oldState:e.oldState,recordIds:[this.recordId],columnId:n.columnId}
11772
+ 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}
11773
11773
  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)
11774
11774
  return e.subscribe(this),e}))}updateCellStates(){this.cellStates=this.columns.map((t=>{const e=t.columnInternals.dataRecordFieldNames
11775
11775
  let n
@@ -12247,8 +12247,8 @@ let n=0
12247
12247
  for(let t=0;t<this.visibleColumns.length&&n<this.gridSizedColumns.length;t++){const i=this.visibleColumns[t]
12248
12248
  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],SB.prototype,"isColumnBeingSized",void 0),t([C],SB.prototype,"activeColumnIndex",void 0),t([C],SB.prototype,"activeColumnDivider",void 0)
12249
12249
  const _B=(t,...e)=>{for(const n of e)if(t===n)return!0
12250
- return!1},MB=["rowIds","rowParentIds","groupRows","columnIds","columnHidden","columnSort","columnSortDisabled","columnWidths","columnDefinition","actionMenuSlots","selectionMode"]
12251
- class $B extends PT{constructor(t){super(MB),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){_B(t,"columnId")?this.track("columnIds"):RL(t,"operandDataRecordFieldName","sortOperation")?this.track("columnDefinition"):RL(t,"sortingDisabled")?(this.track("columnSort"),this.track("columnSortDisabled")):RL(t,"currentSortDirection","currentSortIndex")?this.track("columnSort"):RL(t,"currentFractionalWidth","currentPixelWidth","minPixelWidth","resizingDisabled")?this.track("columnWidths"):_B(t,"columnHidden")?(this.track("columnWidths"),this.track("columnHidden")):_B(t,"actionMenuSlot")?this.track("actionMenuSlots"):RL(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 IB{constructor(t){this.tanStackTable=t}reset(){}toggleIsRowSelected(t,e){t.isGroupRow&&t.selectionState===hL?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")
12250
+ return!1},MB=["rowIds","rowParentIds","groupRows","columnIds","columnHidden","columnSort","columnSortDisabled","columnWidths","columnDefinition","actionMenuSlots","selectionMode","actionMenusPreserveSelection"]
12251
+ class $B extends PT{constructor(t){super(MB),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){_B(t,"columnId")?this.track("columnIds"):RL(t,"operandDataRecordFieldName","sortOperation")?this.track("columnDefinition"):RL(t,"sortingDisabled")?(this.track("columnSort"),this.track("columnSortDisabled")):RL(t,"currentSortDirection","currentSortIndex")?this.track("columnSort"):RL(t,"currentFractionalWidth","currentPixelWidth","minPixelWidth","resizingDisabled")?this.track("columnWidths"):_B(t,"columnHidden")?(this.track("columnWidths"),this.track("columnHidden")):_B(t,"actionMenuSlot")?this.track("actionMenuSlots"):RL(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 IB{constructor(t,e){this.tanStackTable=t,this.actionMenusPreserveSelection=e}updateActionMenusPreserveSelection(t){this.actionMenusPreserveSelection=t}reset(){}toggleIsRowSelected(t,e){t.isGroupRow&&t.selectionState===hL?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")
12252
12252
  const e=this.tanStackTable.getState().rowSelection,n=[]
12253
12253
  if(Object.entries(e).forEach((([t,e])=>{e&&n.push(t)})),1===n.length&&n[0]===t.id)return!1
12254
12254
  const i={}
@@ -12260,7 +12260,7 @@ return this.getOrderedRows(t)}getOrderedRows(t){const e=[]
12260
12260
  for(const n of t)e.push(n),n.subRows?.length&&e.push(...this.getOrderedRows(n.subRows))
12261
12261
  return e}}class EB extends IB{handleRowSelectionToggle(t,e,n){return!1}handleRowClick(t,e,n){return!1}handleActionMenuOpening(t){return!1}}class AB extends IB{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
12262
12262
  if(this.tryUpdateRangeSelection(t.id,e))return!0}if(n){const e=t.selectionState!==hL
12263
- 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!==hL&&this.selectSingleRow(t)}reset(){this.shiftSelectStartRowId=void 0,this.previousShiftSelectRowEndId=void 0}tryUpdateRangeSelection(t,e){if(void 0===this.shiftSelectStartRowId)return!1
12263
+ 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!==hL&&this.selectSingleRow(t))}reset(){this.shiftSelectStartRowId=void 0,this.previousShiftSelectRowEndId=void 0}tryUpdateRangeSelection(t,e){if(void 0===this.shiftSelectStartRowId)return!1
12264
12264
  const n=this.getAllOrderedRows(),i=this.getRowIndexForId(this.shiftSelectStartRowId,n)
12265
12265
  if(-1===i)return!1
12266
12266
  let o={}
@@ -12270,12 +12270,12 @@ this.updateSelectionStateForRange(t,n,o,i,!0)}updateSelectionStateForRange(t,e,n
12270
12270
  const s=Math.min(e,n),r=Math.max(e,n)
12271
12271
  for(let e=s;e<=r;e++){const n=i[e]
12272
12272
  n.getIsGrouped()||this.updateSelectionStateForRow(t,n.id,o)}const a=i[n]
12273
- 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 TB extends IB{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 DB{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
12273
+ 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 TB extends IB{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 DB{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
12274
12274
  if(!t)return[]
12275
12275
  const e=[]
12276
- return Object.entries(t).forEach((([t,n])=>{n&&e.push(t)})),e}createSelectionManager(t){switch(t){case cL.multiple:return new AB(this.tanStackTable)
12277
- case cL.single:return new TB(this.tanStackTable)
12278
- case cL.none:return new EB(this.tanStackTable)
12276
+ return Object.entries(t).forEach((([t,n])=>{n&&e.push(t)})),e}createSelectionManager(t,e){switch(t){case cL.multiple:return new AB(this.tanStackTable,e)
12277
+ case cL.single:return new TB(this.tanStackTable,e)
12278
+ case cL.none:return new EB(this.tanStackTable,e)
12279
12279
  default:throw new Error("unknown selection mode found")}}}function OB(t,e){const n=e,i=[],o={},s=new Set
12280
12280
  for(let e=0;e<t.length;e++){const r=t[e],a=r[n.id],l=r[n.parentId]
12281
12281
  Object.prototype.hasOwnProperty.call(o,a)||(o[a]={subRows:[],clientRecord:void 0,originalIndex:void 0}),s&&s.delete(a),o[a].clientRecord=r
@@ -12432,7 +12432,7 @@ const i=e??this.columnIndex,o=n??this.rowIndex
12432
12432
  return i>=0&&i<t.cells.length&&(this.focusType=wL,this.setRowCellFocusState(i,o,!0),!0)}trySetCellContentFocus(t,e,n,i){if(!t)return!1
12433
12433
  const o=n??this.columnIndex,s=i??this.rowIndex
12434
12434
  return o>=0&&o<t.cells.length&&e>=0&&e<t.cells[o].cell.cellView.tabbableChildren.length&&(this.setCellContentFocusState(e,s,o,!0),!0)}trySetCellActionMenuFocus(t,e,n){const i=e??this.columnIndex,o=n??this.rowIndex
12435
- return!!(i>=0&&i<t.cells.length&&t.cells[i].actionMenuButton)&&(this.setCellActionMenuFocusState(o,i,!0),!0)}setCellActionMenuFocusState(t,e,n){this.focusType=xL,this.setRowCellFocusState(e,t,n)}setCellContentFocusState(t,e,n,i){this.focusType=CL,this.cellContentIndex=t,this.setRowCellFocusState(n,e,i)}setRowFocusState(t){this.focusType=bL,void 0!==t&&(this.rowIndex=t)}setCellFocusState(t,e,n){this.focusType=wL,this.setRowCellFocusState(t,e,n)}setRowCellFocusState(t,e,n){this.rowIndex=e,this.columnIndex=t,n&&this.focusCurrentRow(!0)}isResolvedRowType(t){return t instanceof XL||t instanceof nB}}let zB=class extends je{get validity(){return this.tableValidator.getValidity()}get showRowOperationColumn(){return this.selectionMode===cL.multiple||this.showCollapseAll}get collapseButtonVisibility(){return this.canHaveCollapsibleRows?this.showCollapseAll?"visible":"":"hidden-size-reduced"}get rowHeight(){return this._rowHeight}constructor(){super(),this.selectionMode=cL.none,this.tableData=[],this.columns=[],this.childItems=[],this.rowElements=[],this.canRenderRows=!0,this.scrollX=0,this.selectionState=dL,this.showCollapseAll=!1,this.canHaveCollapsibleRows=!1,this.visibleColumns=[],this.tableScrollableMinWidth=0,this.windowShiftKeyDown=!1,this.tableValidator=new NL,this.tableUpdateTracker=new $B(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
12435
+ return!!(i>=0&&i<t.cells.length&&t.cells[i].actionMenuButton)&&(this.setCellActionMenuFocusState(o,i,!0),!0)}setCellActionMenuFocusState(t,e,n){this.focusType=xL,this.setRowCellFocusState(e,t,n)}setCellContentFocusState(t,e,n,i){this.focusType=CL,this.cellContentIndex=t,this.setRowCellFocusState(n,e,i)}setRowFocusState(t){this.focusType=bL,void 0!==t&&(this.rowIndex=t)}setCellFocusState(t,e,n){this.focusType=wL,this.setRowCellFocusState(t,e,n)}setRowCellFocusState(t,e,n){this.rowIndex=e,this.columnIndex=t,n&&this.focusCurrentRow(!0)}isResolvedRowType(t){return t instanceof XL||t instanceof nB}}let zB=class extends je{get validity(){return this.tableValidator.getValidity()}get showRowOperationColumn(){return this.selectionMode===cL.multiple||this.showCollapseAll}get collapseButtonVisibility(){return this.canHaveCollapsibleRows?this.showCollapseAll?"visible":"":"hidden-size-reduced"}get rowHeight(){return this._rowHeight}constructor(){super(),this.selectionMode=cL.none,this.actionMenusPreserveSelection=!1,this.tableData=[],this.columns=[],this.childItems=[],this.rowElements=[],this.canRenderRows=!0,this.scrollX=0,this.selectionState=dL,this.showCollapseAll=!1,this.canHaveCollapsibleRows=!1,this.visibleColumns=[],this.tableScrollableMinWidth=0,this.windowShiftKeyDown=!1,this.tableValidator=new NL,this.tableUpdateTracker=new $B(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
12436
12436
  this.updateTableOptions({state:{rowSelection:e}})},this.handleExpandedChange=t=>{const e=t instanceof Function?t(this.table.getState().expanded):t
12437
12437
  this.updateTableOptions({state:{expanded:e}})},this.options={data:[],onStateChange:t=>{},onRowSelectionChange:this.handleRowSelectionChange,onExpandedChange:this.handleExpandedChange,getCoreRowModel:t=>cN((()=>[t.options.data]),(e=>{const n={rows:[],flatRows:[],rowsById:{}},i=function(e,o,s){void 0===o&&(o=0)
12438
12438
  const r=[]
@@ -12455,7 +12455,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
12455
12455
  o.push(t),null!=(e=t.subRows)&&e.length&&(t.subRows=a(t.subRows))})),e}
12456
12456
  return{rows:a(n.rows),flatRows:o,rowsById:n.rowsById}}),dN(t.options,"debugTable",0,(()=>t._autoResetPageIndex()))),getGroupedRowModel:oL(),getExpandedRowModel:t=>cN((()=>[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
12457
12457
  e.push(t),null!=(i=t.subRows)&&i.length&&t.getIsExpanded()&&t.subRows.forEach(n)}
12458
- return t.rows.forEach(n),{rows:e,flatRows:t.flatRows,rowsById:t.rowsById}}(e):e),dN(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=iL(this.options),this.virtualizer=new wB(this,this.table),this.keyboardNavigationManager=new PB(this,this.virtualizer),this.layoutManager=new SB(this),this.layoutManagerNotifier=x.getNotifier(this.layoutManager),this.layoutManagerNotifier.subscribe(this,"isColumnBeingSized"),this.selectionManager=new DB(this.table,this.selectionMode),this.expansionManager=new NB(this.table)}async setData(t){await this.processPendingUpdates()
12458
+ return t.rows.forEach(n),{rows:e,flatRows:t.flatRows,rowsById:t.rowsById}}(e):e),dN(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=iL(this.options),this.virtualizer=new wB(this,this.table),this.keyboardNavigationManager=new PB(this,this.virtualizer),this.layoutManager=new SB(this),this.layoutManagerNotifier=x.getNotifier(this.layoutManager),this.layoutManagerNotifier.subscribe(this,"isColumnBeingSized"),this.selectionManager=new DB(this.table,this.selectionMode,this.actionMenusPreserveSelection),this.expansionManager=new NB(this.table)}async setData(t){await this.processPendingUpdates()
12459
12459
  const e=t.map((t=>({...t}))),n=this.calculateTanStackData(e)
12460
12460
  this.updateTableOptions(n)}async getSelectedRecordIds(){return await this.processPendingUpdates(),this.selectionManager.getCurrentSelectedRecordIds()}async setSelectedRecordIds(t){await this.processPendingUpdates(),this.selectionMode!==cL.none&&this.updateTableOptions({state:{rowSelection:this.calculateTanStackSelectionState(t)}})}async setRecordHierarchyOptions(t){await this.processPendingUpdates()
12461
12461
  const e=structuredClone(t),n=this.tableValidator.getOptionsWithPresentIds(e)
@@ -12469,20 +12469,20 @@ o?s===lL.descending?(n.splice(i,1),r=lL.none,t.columnInternals.currentSortIndex=
12469
12469
  for(let i=0;i<n.length;i++){const o=n[i]
12470
12470
  e?n[i].columnInternals.currentSortIndex=i:o===t?o.columnInternals.currentSortIndex=0:(o.columnInternals.currentSortIndex=void 0,o.columnInternals.currentSortDirection=lL.none)}this.emitColumnConfigurationChangeEvent()}onHeaderKeyDown(t,e){const n=e.shiftKey
12471
12471
  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))
12472
- 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 cL.multiple:return"true"
12472
+ 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 cL.multiple:return"true"
12473
12473
  case cL.single:return"false"
12474
12474
  default:return null}}getHeaderContainerElements(){return this.columnHeadersContainer.querySelectorAll(".header-container")}calculateTanStackData(t){this.dataHierarchyManager=new FB(t,this.idFieldName,this.parentIdFieldName)
12475
12475
  const e=this.dataHierarchyManager.hierarchicalData
12476
12476
  this.tableValidator.setParentIdConfigurationValidity(this.dataHierarchyManager.parentIdConfigurationValid)
12477
12477
  const n={data:e}
12478
12478
  if(this.validateWithData(t),this.tableValidator.areRecordIdsValid()){const t=this.selectionManager.getCurrentSelectedRecordIds()
12479
- 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}`})
12480
- 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)
12479
+ 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}`})
12480
+ this.refreshRows()}async handleActionMenuBeforeToggleEvent(t,e){this.selectionManager.handleActionMenuOpening(this.tableData[t])&&await this.emitSelectionChangeEvent(),this.openActionMenuRecordId=e.detail.operatingRecordId,this.updateRequestedSlotsForOpeningActionMenu(this.openActionMenuRecordId)
12481
12481
  const n=await this.getActionMenuToggleEventDetail(e)
12482
12482
  this.$emit("action-menu-beforetoggle",n)}async handleRowActionMenuToggleEvent(t){this.keyboardNavigationManager.onRowActionMenuToggle(t)
12483
12483
  const e=await this.getActionMenuToggleEventDetail(t)
12484
- this.$emit("action-menu-toggle",e),t.detail.newState||(this.openActionMenuRecordId=void 0)}async getActionMenuToggleEventDetail(t){const e=this.selectionMode===cL.multiple?await this.getSelectedRecordIds():[this.openActionMenuRecordId]
12485
- 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()
12484
+ this.$emit("action-menu-toggle",e),t.detail.newState||(this.openActionMenuRecordId=void 0)}async getActionMenuToggleEventDetail(t){let e
12485
+ return e=this.selectionMode===cL.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()
12486
12486
  for(const t of this.columns){const e=x.getNotifier(t)
12487
12487
  e.subscribe(this),this.columnNotifiers.push(e)
12488
12488
  const n=x.getNotifier(t.columnInternals)
@@ -12514,7 +12514,7 @@ if("string"==typeof n)return e.clientRecord[n]},sortingFn:xB(t.columnInternals.s
12514
12514
  const e={},n=this.tableValidator.getPresentRecordIds(t)
12515
12515
  for(const t of n)if(e[t]=!0,this.selectionMode===cL.single)break
12516
12516
  return e}updateRowHeight(){this._rowHeight=parseFloat(Pl.getValueFor(this))+2*parseFloat(jl.getValueFor(this)),this.virtualizer?.updateRowHeight()}}
12517
- t([ft({attribute:"id-field-name"})],zB.prototype,"idFieldName",void 0),t([ft({attribute:"parent-id-field-name"})],zB.prototype,"parentIdFieldName",void 0),t([ft({attribute:"selection-mode"})],zB.prototype,"selectionMode",void 0),t([C],zB.prototype,"tableData",void 0),t([C],zB.prototype,"columns",void 0),t([C],zB.prototype,"childItems",void 0),t([C],zB.prototype,"rowElements",void 0),t([C],zB.prototype,"openActionMenuRecordId",void 0),t([C],zB.prototype,"canRenderRows",void 0),t([C],zB.prototype,"scrollX",void 0),t([C],zB.prototype,"rowGridColumns",void 0),t([C],zB.prototype,"selectionState",void 0),t([C],zB.prototype,"selectionCheckbox",void 0),t([C],zB.prototype,"collapseAllButton",void 0),t([C],zB.prototype,"showCollapseAll",void 0),t([C],zB.prototype,"canHaveCollapsibleRows",void 0),t([k],zB.prototype,"collapseButtonVisibility",null),t([C],zB.prototype,"firstSortedColumn",void 0),t([C],zB.prototype,"visibleColumns",void 0),t([C],zB.prototype,"tableScrollableMinWidth",void 0),t([C],zB.prototype,"windowShiftKeyDown",void 0)
12517
+ t([ft({attribute:"id-field-name"})],zB.prototype,"idFieldName",void 0),t([ft({attribute:"parent-id-field-name"})],zB.prototype,"parentIdFieldName",void 0),t([ft({attribute:"selection-mode"})],zB.prototype,"selectionMode",void 0),t([ft({attribute:"action-menus-preserve-selection",mode:"boolean"})],zB.prototype,"actionMenusPreserveSelection",void 0),t([C],zB.prototype,"tableData",void 0),t([C],zB.prototype,"columns",void 0),t([C],zB.prototype,"childItems",void 0),t([C],zB.prototype,"rowElements",void 0),t([C],zB.prototype,"openActionMenuRecordId",void 0),t([C],zB.prototype,"canRenderRows",void 0),t([C],zB.prototype,"scrollX",void 0),t([C],zB.prototype,"rowGridColumns",void 0),t([C],zB.prototype,"selectionState",void 0),t([C],zB.prototype,"selectionCheckbox",void 0),t([C],zB.prototype,"collapseAllButton",void 0),t([C],zB.prototype,"showCollapseAll",void 0),t([C],zB.prototype,"canHaveCollapsibleRows",void 0),t([k],zB.prototype,"collapseButtonVisibility",null),t([C],zB.prototype,"firstSortedColumn",void 0),t([C],zB.prototype,"visibleColumns",void 0),t([C],zB.prototype,"tableScrollableMinWidth",void 0),t([C],zB.prototype,"windowShiftKeyDown",void 0)
12518
12518
  const VB=zB.compose({baseName:"table",template:sB,styles:LL})
12519
12519
  Ei.getOrCreate().withPrefix("nimble").register(VB())
12520
12520
  const HB=$t`