@ni/nimble-components 20.14.6 → 20.14.7

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.
@@ -9050,8 +9050,8 @@ return!1}e([m],cN.prototype,"columnConfig",void 0),e([m],cN.prototype,"validConf
9050
9050
  class hN extends Pt{constructor(){super(...arguments),this.columnInternals=new cN(this.getColumnInternalsOptions()),this.columnHidden=!1,this.sortDirection=YF.none,this.sortingDisabled=!1,this.hasOverflow=!1}checkValidity(){return this.columnInternals.validConfiguration}get validity(){return{}}get headerTextContent(){return this.contentSlot.assignedNodes().map((e=>e.textContent?.trim())).join(" ")}connectedCallback(){super.connectedCallback(),this.setAttribute("slot",this.columnInternals.uniqueId)}sortDirectionChanged(){this.sortingDisabled||(this.columnInternals.currentSortDirection=this.sortDirection)}sortIndexChanged(){this.sortingDisabled||(this.columnInternals.currentSortIndex=this.sortIndex)}sortingDisabledChanged(){this.sortingDisabled?(this.columnInternals.currentSortDirection=YF.none,this.columnInternals.currentSortIndex=void 0):(this.columnInternals.currentSortDirection=this.sortDirection,this.columnInternals.currentSortIndex=this.sortIndex)}}e([se({attribute:"column-id"})],hN.prototype,"columnId",void 0),e([se({attribute:"action-menu-slot"})],hN.prototype,"actionMenuSlot",void 0),e([se({attribute:"action-menu-label"})],hN.prototype,"actionMenuLabel",void 0),e([se({attribute:"column-hidden",mode:"boolean"})],hN.prototype,"columnHidden",void 0),e([se({attribute:"sort-index",converter:oe})],hN.prototype,"sortIndex",void 0),e([se({attribute:"sort-direction"})],hN.prototype,"sortDirection",void 0),e([se({attribute:"sorting-disabled",mode:"boolean"})],hN.prototype,"sortingDisabled",void 0),e([m],hN.prototype,"hasOverflow",void 0)
9051
9051
  class uN{constructor(){this.duplicateRecordId=!1,this.missingRecordId=!1,this.invalidRecordId=!1,this.duplicateColumnId=!1,this.missingColumnId=!1,this.duplicateSortIndex=!1,this.duplicateGroupIndex=!1,this.idFieldNameNotConfigured=!1,this.invalidColumnConfiguration=!1,this.recordIds=new Set}getValidity(){return{duplicateRecordId:this.duplicateRecordId,missingRecordId:this.missingRecordId,invalidRecordId:this.invalidRecordId,duplicateColumnId:this.duplicateColumnId,missingColumnId:this.missingColumnId,duplicateSortIndex:this.duplicateSortIndex,duplicateGroupIndex:this.duplicateGroupIndex,idFieldNameNotConfigured:this.idFieldNameNotConfigured,invalidColumnConfiguration:this.invalidColumnConfiguration}}isValid(){return Object.values(this.getValidity()).every((e=>!1===e))}areRecordIdsValid(){const e=this.getValidity()
9052
9052
  return!e.duplicateRecordId&&!e.missingRecordId&&!e.invalidRecordId}validateSelectionMode(e,t){return this.idFieldNameNotConfigured=e!==QF.none&&"string"!=typeof t,!this.idFieldNameNotConfigured}validateRecordIds(e,t){if(this.duplicateRecordId=!1,this.missingRecordId=!1,this.invalidRecordId=!1,this.recordIds.clear(),"string"!=typeof t)return!0
9053
- for(const n of e){if(!Object.prototype.hasOwnProperty.call(n,t)){this.missingRecordId=!0
9054
- continue}const e=n[t]
9053
+ for(const n of e){if(!Object.prototype.hasOwnProperty.call(n.clientRecord,t)){this.missingRecordId=!0
9054
+ continue}const e=n.clientRecord[t]
9055
9055
  "string"==typeof e?(this.recordIds.has(e)&&(this.duplicateRecordId=!0),this.recordIds.add(e)):this.invalidRecordId=!0}return!this.missingRecordId&&!this.invalidRecordId&&!this.duplicateRecordId}validateColumnIds(e){this.missingColumnId=!1,this.duplicateColumnId=!1
9056
9056
  const t=e.some((e=>e))
9057
9057
  if(!t)return!0
@@ -9964,7 +9964,7 @@ return null!=(t=e.options.debugAll)?t:e.options.debugTable},onChange:()=>{e._aut
9964
9964
  t.push(e),null!=(i=e.subRows)&&i.length&&e.getIsExpanded()&&e.subRows.forEach(n)}
9965
9965
  return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}(t):t),{key:!1,debug:()=>{var t
9966
9966
  return null!=(t=e.options.debugAll)?t:e.options.debugTable}}),getIsRowExpanded:this.getIsRowExpanded,columns:[],state:{rowSelection:{},grouping:[],expanded:!0},enableRowSelection:e=>!e.getIsGrouped(),enableMultiRowSelection:!1,enableSubRowSelection:!1,enableSorting:!0,enableGrouping:!0,renderFallbackValue:null,autoResetAll:!1},this.table=KF(this.options),this.virtualizer=new UN(this,this.table),this.layoutManager=new JN(this),this.layoutManagerNotifier=g.getNotifier(this.layoutManager),this.layoutManagerNotifier.subscribe(this,"isColumnBeingSized"),this.selectionManager=new sL(this.table,this.selectionMode)}get validity(){return this.tableValidator.getValidity()}get showRowOperationColumn(){return this.selectionMode===QF.multiple||this.showCollapseAll}async setData(e){await this.processPendingUpdates()
9967
- const t=e.map((e=>({...e}))),n={data:t}
9967
+ const t=e.map((e=>({clientRecord:{...e}}))),n={data:t}
9968
9968
  if(this.validateWithData(t),this.tableValidator.areRecordIdsValid()){const e=await this.getSelectedRecordIds()
9969
9969
  n.state={rowSelection:this.calculateTanStackSelectionState(e)}}this.updateTableOptions(n)}async getSelectedRecordIds(){await this.processPendingUpdates()
9970
9970
  const e=this.options.state.rowSelection
@@ -9994,7 +9994,7 @@ this.actionMenuSlots=Array.from(e)}validate(){this.tableValidator.validateSelect
9994
9994
  this.$emit("column-configuration-change",e)}async emitSelectionChangeEvent(){const e={selectedRecordIds:await this.getSelectedRecordIds()}
9995
9995
  this.$emit("selection-change",e)}selectionStateChanged(){this.setSelectionCheckboxState()}selectionCheckboxChanged(){this.setSelectionCheckboxState()}setSelectionCheckboxState(){this.selectionCheckbox&&(this.ignoreSelectionChangeEvents=!0,this.selectionCheckbox.checked=this.selectionState===tN,this.selectionCheckbox.indeterminate=this.selectionState===nN,this.ignoreSelectionChangeEvents=!1)}refreshRows(){this.selectionState=this.getTableSelectionState()
9996
9996
  const e=this.table.getRowModel().rows
9997
- this.tableData=e.map((e=>({record:e.original,id:e.id,selectionState:this.getRowSelectionState(e),isGrouped:e.getIsGrouped(),isExpanded:e.getIsExpanded(),groupRowValue:e.getIsGrouped()?e.getValue(e.groupingColumnId):void 0,nestingLevel:e.depth,leafItemCount:e.getLeafRows().filter((e=>0===e.getLeafRows().length)).length,groupColumn:this.getGroupRowColumn(e)}))),this.virtualizer.dataChanged()}getTableSelectionState(){return this.table.getIsAllRowsSelected()?tN:this.table.getIsSomeRowsSelected()?nN:eN}getRowSelectionState(e){return e.getIsGrouped()?this.getGroupedRowSelectionState(e):e.getIsSelected()?tN:eN}getGroupedRowSelectionState(e){const t=e.subRows??[]
9997
+ this.tableData=e.map((e=>({record:e.original.clientRecord,id:e.id,selectionState:this.getRowSelectionState(e),isGrouped:e.getIsGrouped(),isExpanded:e.getIsExpanded(),groupRowValue:e.getIsGrouped()?e.getValue(e.groupingColumnId):void 0,nestingLevel:e.depth,leafItemCount:e.getLeafRows().filter((e=>0===e.getLeafRows().length)).length,groupColumn:this.getGroupRowColumn(e)}))),this.virtualizer.dataChanged()}getTableSelectionState(){return this.table.getIsAllRowsSelected()?tN:this.table.getIsSomeRowsSelected()?nN:eN}getRowSelectionState(e){return e.getIsGrouped()?this.getGroupedRowSelectionState(e):e.getIsSelected()?tN:eN}getGroupedRowSelectionState(e){const t=e.subRows??[]
9998
9998
  let n=!1,i=!1
9999
9999
  for(const e of t){if(e.getIsGrouped()){switch(this.getGroupedRowSelectionState(e)){case eN:i=!0
10000
10000
  break
@@ -10004,8 +10004,8 @@ default:return nN}}else e.getIsSelected()?n=!0:i=!0
10004
10004
  if(n&&i)return nN}return n?tN:eN}getGroupRowColumn(e){const t=e.groupingColumnId
10005
10005
  if(void 0!==t)return this.columns.find((e=>e.columnInternals.uniqueId===t))}updateTableOptions(e){this.options={...this.options,...e,state:{...this.options.state,...e.state}},this.table.setOptions(this.options),this.refreshRows()}toggleGroupExpanded(e){const t=this.table.getRowModel().rows[e]
10006
10006
  t.getIsExpanded()?this.collapsedRows.add(t.id):this.collapsedRows.delete(t.id),t.toggleExpanded()}calculateTanStackSortState(){const e=this.getColumnsParticipatingInSorting().sort(((e,t)=>e.columnInternals.currentSortIndex-t.columnInternals.currentSortIndex))
10007
- return this.firstSortedColumn=e.length?e[0]:void 0,e.map((e=>({id:e.columnInternals.uniqueId,desc:e.columnInternals.currentSortDirection===YF.descending})))}calculateTanStackGroupingState(){return this.getColumnsParticipatingInGrouping().sort(((e,t)=>e.columnInternals.groupIndex-t.columnInternals.groupIndex)).map((e=>e.columnInternals.uniqueId))}calculateTanStackRowIdFunction(){return null===this.idFieldName||void 0===this.idFieldName?void 0:e=>e[this.idFieldName]}calculateTanStackColumns(){return this.columns.map((e=>({id:e.columnInternals.uniqueId,accessorFn:t=>{const n=e.columnInternals.operandDataRecordFieldName
10008
- if("string"==typeof n)return t[n]},sortingFn:WN(e.columnInternals.sortOperation),sortUndefined:!1})))}calculateTanStackSelectionState(e){if(this.selectionMode===QF.none)return{}
10007
+ return this.firstSortedColumn=e.length?e[0]:void 0,e.map((e=>({id:e.columnInternals.uniqueId,desc:e.columnInternals.currentSortDirection===YF.descending})))}calculateTanStackGroupingState(){return this.getColumnsParticipatingInGrouping().sort(((e,t)=>e.columnInternals.groupIndex-t.columnInternals.groupIndex)).map((e=>e.columnInternals.uniqueId))}calculateTanStackRowIdFunction(){return null===this.idFieldName||void 0===this.idFieldName?void 0:e=>e.clientRecord[this.idFieldName]}calculateTanStackColumns(){return this.columns.map((e=>({id:e.columnInternals.uniqueId,accessorFn:t=>{const n=e.columnInternals.operandDataRecordFieldName
10008
+ if("string"==typeof n)return t.clientRecord[n]},sortingFn:WN(e.columnInternals.sortOperation),sortUndefined:!1})))}calculateTanStackSelectionState(e){if(this.selectionMode===QF.none)return{}
10009
10009
  const t={},n=this.tableValidator.getPresentRecordIds(e)
10010
10010
  for(const e of n)if(t[e]=!0,this.selectionMode===QF.single)break
10011
10011
  return t}}e([se({attribute:"id-field-name"})],aL.prototype,"idFieldName",void 0),e([se({attribute:"selection-mode"})],aL.prototype,"selectionMode",void 0),e([m],aL.prototype,"tableData",void 0),e([m],aL.prototype,"columns",void 0),e([m],aL.prototype,"childItems",void 0),e([m],aL.prototype,"rowElements",void 0),e([m],aL.prototype,"actionMenuSlots",void 0),e([m],aL.prototype,"openActionMenuRecordId",void 0),e([m],aL.prototype,"canRenderRows",void 0),e([m],aL.prototype,"scrollX",void 0),e([m],aL.prototype,"rowGridColumns",void 0),e([m],aL.prototype,"selectionState",void 0),e([m],aL.prototype,"selectionCheckbox",void 0),e([m],aL.prototype,"showCollapseAll",void 0),e([m],aL.prototype,"firstSortedColumn",void 0),e([m],aL.prototype,"visibleColumns",void 0),e([m],aL.prototype,"tableScrollableMinWidth",void 0),e([m],aL.prototype,"documentShiftKeyDown",void 0)