@ni/spright-components 2.0.0 → 2.0.1

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.
@@ -10243,7 +10243,7 @@ try{e=document.createElement(t)}catch(t){}if(!(e instanceof _R))throw new Error(
10243
10243
  >
10244
10244
  </${t}>
10245
10245
  `)
10246
- class MR extends We{constructor(){super(...arguments),this.delegatedEvents=[],this.delegatedEventHandler=()=>{}}get tabbableChildren(){return[]}focusedRecycleCallback(){}columnChanged(){for(const t of this.delegatedEvents)this.removeEventListener(t,this.delegatedEventHandler)
10246
+ class MR extends We{constructor(){super(...arguments),this.delegatedEvents=[],this.delegatedEventHandler=()=>{}}get tabbableChildren(){return[]}columnChanged(){for(const t of this.delegatedEvents)this.removeEventListener(t,this.delegatedEventHandler)
10247
10247
  if(this.delegatedEvents=[],this.delegatedEventHandler=()=>{},this.column){this.delegatedEvents=this.column.columnInternals.delegatedEvents,this.delegatedEventHandler=t=>{this.recordId&&this.column?.dispatchEvent(new CustomEvent("delegated-event",{detail:{originalEvent:t,recordId:this.recordId}}))}
10248
10248
  for(const t of this.delegatedEvents)this.addEventListener(t,this.delegatedEventHandler)}}}function $R(t,e){return`${t}-${e}`}function ER(t,e){return $R(t.columnInternals.uniqueId,e)}t([C],MR.prototype,"cellRecord",void 0),t([C],MR.prototype,"columnConfig",void 0),t([C],MR.prototype,"column",void 0),t([C],MR.prototype,"recordId",void 0)
10249
10249
  const DR=t=>((t=>{let e
@@ -10898,8 +10898,7 @@ class KR extends We{constructor(){super(...arguments),this.selectable=!1,this.se
10898
10898
  const e=t.target.checked
10899
10899
  this.onSelectionChange(!e,e)}onSelectionChange(t,e){this.selected=e
10900
10900
  const n={oldState:t,newState:e}
10901
- 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,this.emitActionMenuToggleEvent("row-action-menu-toggle",t.detail,e)}closeOpenActionMenus(){if(this.menuOpen){const t=Array.from(this.cellContainer.children).find((t=>t instanceof jR&&t.menuOpen))
10902
- t?.actionMenuButton?.open&&t.actionMenuButton.toggleButton.control.click()}}handleChange(t,e){t instanceof AR&&"string"==typeof e&&(TR(e,"columnConfig")||TR(e,"dataRecordFieldNames"))&&this.updateCellStates()}getFocusableElements(){return{selectionCheckbox:this.showSelectionCheckbox?this.selectionCheckbox:void 0,cells:Array.from(this.cellContainer.querySelectorAll(GR)).map((t=>({cell:t,actionMenuButton:t.hasActionMenu?t.actionMenuButton:void 0})))}}onRowExpandToggle(t){const e={oldState:this.expanded,newState:!this.expanded,recordId:this.recordId}
10901
+ 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,this.emitActionMenuToggleEvent("row-action-menu-toggle",t.detail,e)}handleChange(t,e){t instanceof AR&&"string"==typeof e&&(TR(e,"columnConfig")||TR(e,"dataRecordFieldNames"))&&this.updateCellStates()}getFocusableElements(){return{selectionCheckbox:this.showSelectionCheckbox?this.selectionCheckbox:void 0,cells:Array.from(this.cellContainer.querySelectorAll(GR)).map((t=>({cell:t,actionMenuButton:t.hasActionMenu?t.actionMenuButton:void 0})))}}onRowExpandToggle(t){const e={oldState:this.expanded,newState:!this.expanded,recordId:this.recordId}
10903
10902
  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
10904
10903
  const n={recordId:this.recordId,columnInternalId:t.columnInternals.uniqueId,slots:e.detail.slots}
10905
10904
  this.$emit("row-slots-request",n)}emitActionMenuToggleEvent(t,e,n){const i={newState:e.newState,oldState:e.oldState,recordIds:[this.recordId],columnId:n.columnId}
@@ -11325,8 +11324,7 @@ const e=this.getMeasurements()
11325
11324
  let n
11326
11325
  return n=0===e.length?this.options.paddingStart:1===this.options.lanes?(null==(t=e[e.length-1])?void 0:t.end)??0:Math.max(...e.slice(-this.options.lanes).map((t=>t.end))),n-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(t,{adjustments:e,behavior:n})=>{this.options.scrollToFn(t,{behavior:n,adjustments:e},this)},this.measure=()=>{var t,e
11327
11326
  this.itemSizeCache=new Map,null==(e=(t=this.options).onChange)||e.call(t,this,!1)},this.setOptions(t)}}(t),this.virtualizer._willUpdate(),this.handleVirtualizerChange()}createVirtualizerOptions(){const t=this.rowHeight
11328
- return{count:this.tanStackTable.getRowModel().rows.length,getScrollElement:()=>this.table.viewport,estimateSize:e=>t,enableSmoothScroll:!0,overscan:3,scrollingDelay:5,scrollToFn:fF,observeElementOffset:uF,observeElementRect:cF,onChange:()=>this.handleVirtualizerChange()}}handleVirtualizerChange(){this.table.handleFocusedCellRecycling()
11329
- const t=this.virtualizer
11327
+ return{count:this.tanStackTable.getRowModel().rows.length,getScrollElement:()=>this.table.viewport,estimateSize:e=>t,enableSmoothScroll:!0,overscan:3,scrollingDelay:5,scrollToFn:fF,observeElementOffset:uF,observeElementRect:cF,onChange:()=>this.handleVirtualizerChange()}}handleVirtualizerChange(){const t=this.virtualizer
11330
11328
  this.visibleItems=t.getVirtualItems(),this.scrollHeight=t.getTotalSize()
11331
11329
  let e=0
11332
11330
  if(this.visibleItems.length>0){e=this.visibleItems[0].start}this.rowContainerYOffset=e}updatePageSize(){this._pageSize=Math.round(this.table.viewport.clientHeight/this.rowHeight)}}function vF(t){switch(t){case xR:return yF
@@ -11464,7 +11462,7 @@ else if(t===this.table&&"rowElements"===e){for(const t of this.visibleRowNotifie
11464
11462
  this.visibleRowNotifiers=[]
11465
11463
  for(const t of this.table.rowElements){x.getNotifier(t).subscribe(this,"resolvedRowIndex"),t.resolvedRowIndex===this.rowIndex&&(n=!0)}}else"resolvedRowIndex"===e&&this.isResolvedRowType(t)&&t.resolvedRowIndex===this.rowIndex&&(n=!0)
11466
11464
  if(n&&(this.focusType!==yR&&this.focusType!==wR||this.setCellFocusState(this.columnIndex,this.rowIndex,!1),this.inNavigationMode&&this.hasRowOrCellFocusType())){if(this.rowIndex>this.table.tableData.length-1){if(!(this.table.tableData.length>0))return void(this.focusWithinTable?this.setDefaultFocus():this.focusType=pR)
11467
- this.rowIndex=0}this.focusWithinTable&&this.focusCurrentRow(!1)}}handleFocusedCellRecycling(t){t&&!this.focusWithinTable&&this.focusCurrentRow(!1)}onRowFocusIn(t){if(this.isCurrentlyFocusingElement)return
11465
+ this.rowIndex=0}this.focusWithinTable&&this.focusCurrentRow(!1)}}onRowFocusIn(t){if(this.isCurrentlyFocusingElement)return
11468
11466
  const e=t.target
11469
11467
  this.isResolvedRowType(e)&&this.rowIndex!==e.resolvedRowIndex&&this.setRowFocusState(e.resolvedRowIndex)}onRowBlur(t){const e=t.target
11470
11468
  this.isResolvedRowType(e)&&this.setElementFocusable(e,!1)}onRowActionMenuToggle(t){if(t.detail.newState){const e=t.target,n=this.table.visibleColumns.findIndex((e=>e.columnId===t.detail.columnId))
@@ -11598,11 +11596,7 @@ const e=this.dataHierarchyManager.hierarchicalData
11598
11596
  this.tableValidator.setParentIdConfigurationValidity(this.dataHierarchyManager.parentIdConfigurationValid)
11599
11597
  const n={data:e}
11600
11598
  if(this.validateWithData(t),this.tableValidator.areRecordIdsValid()){const t=this.selectionManager.getCurrentSelectedRecordIds()
11601
- n.state={rowSelection:this.calculateTanStackSelectionState(t),expanded:!0}}return n}handleFocusedCellRecycling(){const t=this.keyboardNavigationManager.hasActiveRowOrCellFocus
11602
- let e=this.shadowRoot.activeElement
11603
- for(;null!==e&&!(e instanceof MR)&&e.shadowRoot;)e=e.shadowRoot.activeElement
11604
- if(e instanceof MR&&e.focusedRecycleCallback(),void 0!==this.openActionMenuRecordId){const t=this.rowElements.find((t=>t instanceof KR&&t.recordId===this.openActionMenuRecordId))
11605
- t?.closeOpenActionMenus()}this.keyboardNavigationManager.handleFocusedCellRecycling(t)}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())}removeActionMenuSlotsFromColumnRequestedSlots(){for(const t of this.actionMenuSlots)this.columnRequestedSlots.delete(t)
11599
+ 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())}removeActionMenuSlotsFromColumnRequestedSlots(){for(const t of this.actionMenuSlots)this.columnRequestedSlots.delete(t)
11606
11600
  this.refreshRows()}async handleActionMenuBeforeToggleEvent(t,e){this.selectionManager.handleActionMenuOpening(this.tableData[t])&&await this.emitSelectionChangeEvent(),this.openActionMenuRecordId=e.detail.recordIds[0],this.removeActionMenuSlotsFromColumnRequestedSlots()
11607
11601
  const n=await this.getActionMenuToggleEventDetail(e)
11608
11602
  this.$emit("action-menu-beforetoggle",n)}async handleRowActionMenuToggleEvent(t){this.keyboardNavigationManager.onRowActionMenuToggle(t)
@@ -11721,7 +11715,7 @@ function zF(t){class e extends t{fractionalWidthChanged(){this.columnInternals.f
11721
11715
  </template>
11722
11716
  `
11723
11717
  class jF extends MR{constructor(){super(...arguments),this.hasOverflow=!1,this.isPlaceholder=!1}get text(){const t=this.cellRecord?.label??this.cellRecord?.href
11724
- return null==t&&this.columnConfig?.placeholder?(this.isPlaceholder=!0,this.columnConfig.placeholder):(this.isPlaceholder=!1,"string"==typeof this.cellRecord?.label?this.cellRecord.label:"string"==typeof this.cellRecord?.href?this.cellRecord.href:"")}get showAnchor(){return"string"==typeof this.cellRecord?.href}focusedRecycleCallback(){this.anchor?.blur()}get tabbableChildren(){return this.showAnchor?[this.anchor]:[]}}t([C],jF.prototype,"hasOverflow",void 0),t([C],jF.prototype,"isPlaceholder",void 0),t([k],jF.prototype,"text",null),t([k],jF.prototype,"showAnchor",null)
11718
+ return null==t&&this.columnConfig?.placeholder?(this.isPlaceholder=!0,this.columnConfig.placeholder):(this.isPlaceholder=!1,"string"==typeof this.cellRecord?.label?this.cellRecord.label:"string"==typeof this.cellRecord?.href?this.cellRecord.href:"")}get showAnchor(){return"string"==typeof this.cellRecord?.href}get tabbableChildren(){return this.showAnchor?[this.anchor]:[]}}t([C],jF.prototype,"hasOverflow",void 0),t([C],jF.prototype,"isPlaceholder",void 0),t([k],jF.prototype,"text",null),t([k],jF.prototype,"showAnchor",null)
11725
11719
  const WF=jF.compose({baseName:"table-column-anchor-cell-view",template:qF,styles:UF})
11726
11720
  _i.getOrCreate().withPrefix("nimble").register(WF())
11727
11721
  class GF extends _R{constructor(){super(...arguments),this.hasOverflow=!1,this.text=zv.getValueFor(this),this.noValuePlaceholderLabelSubscriber={handleChange:()=>{this.applyPlaceholderTextIfNeeded()}},this.emptyPlaceholderLabelSubscriber={handleChange:()=>{this.applyPlaceholderTextIfNeeded()}}}connectedCallback(){super.connectedCallback(),zv.subscribe(this.noValuePlaceholderLabelSubscriber,this),Vv.subscribe(this.emptyPlaceholderLabelSubscriber,this),this.applyPlaceholderTextIfNeeded()}disconnectedCallback(){super.disconnectedCallback(),zv.unsubscribe(this.noValuePlaceholderLabelSubscriber),Vv.unsubscribe(this.emptyPlaceholderLabelSubscriber)}columnConfigChanged(){this.applyPlaceholderTextIfNeeded()||this.updateText()}groupHeaderValueChanged(){this.applyPlaceholderTextIfNeeded()||this.updateText()}applyPlaceholderTextIfNeeded(){return null===this.groupHeaderValue||void 0===this.groupHeaderValue?(this.text=zv.getValueFor(this),!0):""===this.groupHeaderValue&&(this.text=Vv.getValueFor(this),!0)}}t([C],GF.prototype,"hasOverflow",void 0),t([C],GF.prototype,"text",void 0)