@ni/nimble-components 19.0.2 → 19.1.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.
@@ -5413,10 +5413,10 @@ try{t=document.createElement(e)}catch(e){}if(!(t instanceof nw))throw new Error(
5413
5413
  >
5414
5414
  </${e}>
5415
5415
  `)
5416
- class rw{constructor(e){this.uniqueId=Vr("table-column-slot"),this.sortOperation=ew,this.dataRecordFieldNames=[],this.groupingDisabled=!1,this.fractionalWidth=1,this.minPixelWidth=117,this.currentFractionalWidth=1,this.cellRecordFieldNames=e.cellRecordFieldNames,this.cellViewTemplate=sw(e.cellViewTag),this.groupHeaderViewTemplate=ow(e.groupHeaderViewTag),this.delegatedEvents=e.delegatedEvents}fractionalWidthChanged(){this.currentFractionalWidth=this.fractionalWidth}pixelWidthChanged(){this.currentPixelWidth=this.pixelWidth}}e([m],rw.prototype,"columnConfig",void 0),e([m],rw.prototype,"operandDataRecordFieldName",void 0),e([m],rw.prototype,"sortOperation",void 0),e([m],rw.prototype,"dataRecordFieldNames",void 0),e([m],rw.prototype,"groupingDisabled",void 0),e([m],rw.prototype,"groupIndex",void 0),e([m],rw.prototype,"pixelWidth",void 0),e([m],rw.prototype,"fractionalWidth",void 0),e([m],rw.prototype,"minPixelWidth",void 0),e([m],rw.prototype,"currentFractionalWidth",void 0),e([m],rw.prototype,"currentPixelWidth",void 0),e([m],rw.prototype,"currentSortIndex",void 0),e([m],rw.prototype,"currentSortDirection",void 0)
5416
+ class rw{constructor(e){this.uniqueId=Vr("table-column-slot"),this.validConfiguration=!0,this.sortOperation=ew,this.dataRecordFieldNames=[],this.groupingDisabled=!1,this.fractionalWidth=1,this.minPixelWidth=117,this.currentFractionalWidth=1,this.cellRecordFieldNames=e.cellRecordFieldNames,this.cellViewTemplate=sw(e.cellViewTag),this.groupHeaderViewTemplate=ow(e.groupHeaderViewTag),this.delegatedEvents=e.delegatedEvents}fractionalWidthChanged(){this.currentFractionalWidth=this.fractionalWidth}pixelWidthChanged(){this.currentPixelWidth=this.pixelWidth}}e([m],rw.prototype,"columnConfig",void 0),e([m],rw.prototype,"validConfiguration",void 0),e([m],rw.prototype,"operandDataRecordFieldName",void 0),e([m],rw.prototype,"sortOperation",void 0),e([m],rw.prototype,"dataRecordFieldNames",void 0),e([m],rw.prototype,"groupingDisabled",void 0),e([m],rw.prototype,"groupIndex",void 0),e([m],rw.prototype,"pixelWidth",void 0),e([m],rw.prototype,"fractionalWidth",void 0),e([m],rw.prototype,"minPixelWidth",void 0),e([m],rw.prototype,"currentFractionalWidth",void 0),e([m],rw.prototype,"currentPixelWidth",void 0),e([m],rw.prototype,"currentSortIndex",void 0),e([m],rw.prototype,"currentSortDirection",void 0)
5417
5417
  class aw extends Rt{constructor(e){if(super(),this.columnHidden=!1,this.sortDirection=Kb.none,this.sortingDisabled=!1,!e)throw new Error("ColumnInternalsOptions must be provided to constructor")
5418
- this.columnInternals=new rw(e),this.columnInternals.currentSortDirection=this.sortDirection,this.columnInternals.currentSortIndex=this.sortIndex}sortDirectionChanged(){this.sortingDisabled||(this.columnInternals.currentSortDirection=this.sortDirection)}sortIndexChanged(){this.sortingDisabled||(this.columnInternals.currentSortIndex=this.sortIndex)}sortingDisabledChanged(){this.columnInternals&&(this.sortingDisabled?(this.columnInternals.currentSortDirection=Kb.none,this.columnInternals.currentSortIndex=void 0):(this.columnInternals.currentSortDirection=this.sortDirection,this.columnInternals.currentSortIndex=this.sortIndex))}}e([ne({attribute:"column-id"})],aw.prototype,"columnId",void 0),e([ne({attribute:"action-menu-slot"})],aw.prototype,"actionMenuSlot",void 0),e([ne({attribute:"action-menu-label"})],aw.prototype,"actionMenuLabel",void 0),e([ne({attribute:"column-hidden",mode:"boolean"})],aw.prototype,"columnHidden",void 0),e([ne({attribute:"sort-index",converter:ie})],aw.prototype,"sortIndex",void 0),e([ne({attribute:"sort-direction"})],aw.prototype,"sortDirection",void 0),e([ne({attribute:"sorting-disabled",mode:"boolean"})],aw.prototype,"sortingDisabled",void 0)
5419
- class lw{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.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}}isValid(){return Object.values(this.getValidity()).every((e=>!1===e))}areRecordIdsValid(){const e=this.getValidity()
5418
+ this.columnInternals=new rw(e),this.columnInternals.currentSortDirection=this.sortDirection,this.columnInternals.currentSortIndex=this.sortIndex}checkValidity(){return this.columnInternals.validConfiguration}get validity(){return{}}sortDirectionChanged(){this.sortingDisabled||(this.columnInternals.currentSortDirection=this.sortDirection)}sortIndexChanged(){this.sortingDisabled||(this.columnInternals.currentSortIndex=this.sortIndex)}sortingDisabledChanged(){this.columnInternals&&(this.sortingDisabled?(this.columnInternals.currentSortDirection=Kb.none,this.columnInternals.currentSortIndex=void 0):(this.columnInternals.currentSortDirection=this.sortDirection,this.columnInternals.currentSortIndex=this.sortIndex))}}e([ne({attribute:"column-id"})],aw.prototype,"columnId",void 0),e([ne({attribute:"action-menu-slot"})],aw.prototype,"actionMenuSlot",void 0),e([ne({attribute:"action-menu-label"})],aw.prototype,"actionMenuLabel",void 0),e([ne({attribute:"column-hidden",mode:"boolean"})],aw.prototype,"columnHidden",void 0),e([ne({attribute:"sort-index",converter:ie})],aw.prototype,"sortIndex",void 0),e([ne({attribute:"sort-direction"})],aw.prototype,"sortDirection",void 0),e([ne({attribute:"sorting-disabled",mode:"boolean"})],aw.prototype,"sortingDisabled",void 0)
5419
+ class lw{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()
5420
5420
  return!e.duplicateRecordId&&!e.missingRecordId&&!e.invalidRecordId}validateSelectionMode(e,t){return this.idFieldNameNotConfigured=e!==Xb.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
5421
5421
  for(const i of e){if(!Object.prototype.hasOwnProperty.call(i,t)){this.missingRecordId=!0
5422
5422
  continue}const e=i[t]
@@ -5425,7 +5425,7 @@ const t=e.some((e=>e))
5425
5425
  if(!t)return!0
5426
5426
  const i=new Set
5427
5427
  for(const t of e)t?(i.has(t)&&(this.duplicateColumnId=!0),i.add(t)):this.missingColumnId=!0
5428
- return!this.missingColumnId&&!this.duplicateColumnId}validateColumnSortIndices(e){return this.duplicateSortIndex=!this.validateIndicesAreUnique(e),!this.duplicateSortIndex}validateColumnGroupIndices(e){return this.duplicateGroupIndex=!this.validateIndicesAreUnique(e),!this.duplicateGroupIndex}getPresentRecordIds(e){return e.filter((e=>this.recordIds.has(e)))}validateIndicesAreUnique(e){return new Set(e).size===e.length}}const cw=fe`
5428
+ return!this.missingColumnId&&!this.duplicateColumnId}validateColumnSortIndices(e){return this.duplicateSortIndex=!this.validateIndicesAreUnique(e),!this.duplicateSortIndex}validateColumnGroupIndices(e){return this.duplicateGroupIndex=!this.validateIndicesAreUnique(e),!this.duplicateGroupIndex}validateColumnConfigurations(e){return this.invalidColumnConfiguration=e.some((e=>!e.columnInternals.validConfiguration)),!this.invalidColumnConfiguration}getPresentRecordIds(e){return e.filter((e=>this.recordIds.has(e)))}validateIndicesAreUnique(e){return new Set(e).size===e.length}}const cw=fe`
5429
5429
  ${xn("flex")}
5430
5430
 
5431
5431
  :host {
@@ -6184,7 +6184,7 @@ i.state={rowSelection:this.calculateTanStackSelectionState(e)}}this.updateTableO
6184
6184
  const e=this.options.state.rowSelection
6185
6185
  if(!e)return[]
6186
6186
  const t=[]
6187
- return Object.entries(e).forEach((([e,i])=>{i&&t.push(e)})),t}async setSelectedRecordIds(e){await this.processPendingUpdates(),this.selectionMode!==Xb.none&&this.updateTableOptions({state:{rowSelection:this.calculateTanStackSelectionState(e)}})}connectedCallback(){super.connectedCallback(),this.initialize(),this.virtualizer.connectedCallback(),this.viewport.addEventListener("scroll",this.onViewPortScroll,{passive:!0}),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.onKeyUp)}disconnectedCallback(){super.disconnectedCallback(),this.virtualizer.disconnectedCallback(),this.viewport.removeEventListener("scroll",this.onViewPortScroll),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp)}checkValidity(){return this.tableValidator.isValid()}handleChange(e,t){(e instanceof aw||e instanceof rw)&&"string"==typeof t&&this.updateTracker.trackColumnPropertyChanged(t)}onRowSelectionToggle(e,t){t.stopImmediatePropagation()
6187
+ return Object.entries(e).forEach((([e,i])=>{i&&t.push(e)})),t}async setSelectedRecordIds(e){await this.processPendingUpdates(),this.selectionMode!==Xb.none&&this.updateTableOptions({state:{rowSelection:this.calculateTanStackSelectionState(e)}})}connectedCallback(){super.connectedCallback(),this.initialize(),this.virtualizer.connectedCallback(),this.viewport.addEventListener("scroll",this.onViewPortScroll,{passive:!0}),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.onKeyUp)}disconnectedCallback(){super.disconnectedCallback(),this.virtualizer.disconnectedCallback(),this.viewport.removeEventListener("scroll",this.onViewPortScroll),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp)}checkValidity(){return this.tableValidator.isValid()}handleChange(e,t){(e instanceof aw||e instanceof rw)&&"string"==typeof t&&("validConfiguration"===t?this.tableValidator.validateColumnConfigurations(this.columns):this.updateTracker.trackColumnPropertyChanged(t))}onRowSelectionToggle(e,t){t.stopImmediatePropagation()
6188
6188
  this.selectionManager.handleRowSelectionToggle(this.tableData[e],t.detail.newState,this.documentShiftKeyDown)&&this.emitSelectionChangeEvent()}onRowClick(e,t){return this.selectionManager.handleRowClick(this.tableData[e],t.shiftKey,t.ctrlKey||t.metaKey)&&this.emitSelectionChangeEvent(),!0}onAllRowsSelectionChange(e){e.stopPropagation(),this.ignoreSelectionChangeEvents||(this.table.toggleAllRowsSelected(this.selectionCheckbox.checked),this.emitSelectionChangeEvent())}onRowActionMenuBeforeToggle(e,t){t.stopImmediatePropagation(),this.handleActionMenuBeforeToggleEvent(e,t)}onRowActionMenuToggle(e){e.stopImmediatePropagation(),this.handleRowActionMenuToggleEvent(e)}handleCollapseAllGroupRows(){this.collapsedRows.clear(),this.table.getRowModel().flatRows.filter((e=>e.getIsGrouped())).forEach((e=>this.collapsedRows.add(e.id))),this.table.toggleAllRowsExpanded(!1)}handleGroupRowExpanded(e,t){this.toggleGroupExpanded(e),t.stopPropagation()}toggleColumnSort(e,t){if(e.sortingDisabled)return
6189
6189
  const i=this.getColumnsParticipatingInSorting().sort(((e,t)=>e.columnInternals.currentSortIndex-t.columnInternals.currentSortIndex)),o=i.indexOf(e),n=o>-1,s=e.columnInternals.currentSortDirection
6190
6190
  let r=Kb.ascending
@@ -6203,7 +6203,7 @@ v.getNotifier(e.columnInternals).subscribe(this),this.columnNotifiers.push(t)}}g
6203
6203
  await Promise.all(e),this.columns=this.childItems.filter((e=>e instanceof aw))}updateTanStack(){const e={state:{}}
6204
6204
  this.updateTracker.updateColumnSort&&(e.state.sorting=this.calculateTanStackSortState()),this.updateTracker.updateColumnDefinition&&(e.columns=this.calculateTanStackColumns()),this.updateTracker.updateRowIds&&(e.getRowId=this.calculateTanStackRowIdFunction(),e.state.rowSelection={},this.selectionManager.handleSelectionReset()),this.updateTracker.updateSelectionMode&&(e.enableMultiRowSelection=this.selectionMode===Xb.multiple,e.enableSubRowSelection=this.selectionMode===Xb.multiple,e.state.rowSelection={},this.selectionManager.handleSelectionModeChanged(this.selectionMode)),this.updateTracker.requiresTanStackDataReset&&(e.data=[...this.table.options.data]),this.updateTracker.updateGroupRows&&(e.state.grouping=this.calculateTanStackGroupingState(),e.state.expanded=!0,this.collapsedRows.clear()),this.updateTableOptions(e)}updateActionMenuSlots(){const e=new Set
6205
6205
  for(const t of this.columns)t.actionMenuSlot&&e.add(t.actionMenuSlot)
6206
- this.actionMenuSlots=Array.from(e)}updateRowGridColumns(){this.rowGridColumns=Ww.getGridTemplateColumns(this.columns)}validate(){this.tableValidator.validateSelectionMode(this.selectionMode,this.idFieldName),this.tableValidator.validateColumnIds(this.columns.map((e=>e.columnId))),this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map((e=>e.columnInternals.currentSortIndex))),this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map((e=>e.columnInternals.groupIndex))),this.validateWithData(this.table.options.data)}validateWithData(e){this.tableValidator.validateRecordIds(e,this.idFieldName),this.canRenderRows=this.checkValidity()}emitColumnConfigurationChangeEvent(){const e={columns:this.columns.map((e=>({columnId:e.columnId,sortIndex:e.columnInternals.currentSortIndex??void 0,sortDirection:e.columnInternals.currentSortDirection,groupIndex:e.columnInternals.groupIndex,hidden:e.columnHidden,fractionalWidth:e.columnInternals.currentFractionalWidth,pixelWidth:e.columnInternals.currentPixelWidth})))}
6206
+ this.actionMenuSlots=Array.from(e)}updateRowGridColumns(){this.rowGridColumns=Ww.getGridTemplateColumns(this.columns)}validate(){this.tableValidator.validateSelectionMode(this.selectionMode,this.idFieldName),this.tableValidator.validateColumnIds(this.columns.map((e=>e.columnId))),this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map((e=>e.columnInternals.currentSortIndex))),this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map((e=>e.columnInternals.groupIndex))),this.tableValidator.validateColumnConfigurations(this.columns),this.validateWithData(this.table.options.data)}validateWithData(e){this.tableValidator.validateRecordIds(e,this.idFieldName),this.canRenderRows=this.checkValidity()}emitColumnConfigurationChangeEvent(){const e={columns:this.columns.map((e=>({columnId:e.columnId,sortIndex:e.columnInternals.currentSortIndex??void 0,sortDirection:e.columnInternals.currentSortDirection,groupIndex:e.columnInternals.groupIndex,hidden:e.columnHidden,fractionalWidth:e.columnInternals.currentFractionalWidth,pixelWidth:e.columnInternals.currentPixelWidth})))}
6207
6207
  this.$emit("column-configuration-change",e)}async emitSelectionChangeEvent(){const e={selectedRecordIds:await this.getSelectedRecordIds()}
6208
6208
  this.$emit("selection-change",e)}selectionStateChanged(){this.setSelectionCheckboxState()}selectionCheckboxChanged(){this.setSelectionCheckboxState()}setSelectionCheckboxState(){this.selectionCheckbox&&(this.ignoreSelectionChangeEvents=!0,this.selectionCheckbox.checked=this.selectionState===Qb,this.selectionCheckbox.indeterminate=this.selectionState===Jb,this.ignoreSelectionChangeEvents=!1)}refreshRows(){this.selectionState=this.getTableSelectionState()
6209
6209
  const e=this.table.getRowModel().rows