@ni/ok-components 1.5.0 → 1.5.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.
@@ -19846,7 +19846,7 @@ const K3={off:"off",enabled:"enabled",disabled:"disabled",hit:"hit",conditional:
19846
19846
  }
19847
19847
 
19848
19848
  `
19849
- class t6 extends TP{constructor(){super(...arguments),this.open=!1,this.focusLastItemWhenOpened=!1,this.breakpointEnabledString="Breakpoint enabled",this.breakpointDisabledString="Breakpoint disabled",this.breakpointHitString="Breakpoint hit",this.breakpointConditionalString="Conditional breakpoint",this.breakpointHitDisabledString="Breakpoint hit (disabled)",this.breakpointAddString="Add breakpoint",this.breakpointRemoveString="Remove breakpoint",this.menuChangeHandler=()=>{this.open=!1,this.button?.focus()}}get currentState(){const t=this.cellRecord?.value
19849
+ class t6 extends TP{constructor(){super(...arguments),this.open=!1,this.focusLastItemWhenOpened=!1,this.restoreRowMenuOpenOnClose=!1,this.breakpointEnabledString="Breakpoint enabled",this.breakpointDisabledString="Breakpoint disabled",this.breakpointHitString="Breakpoint hit",this.breakpointConditionalString="Conditional breakpoint",this.breakpointHitDisabledString="Breakpoint hit (disabled)",this.breakpointAddString="Add breakpoint",this.breakpointRemoveString="Remove breakpoint",this.menuChangeHandler=()=>{this.open=!1,this.button?.focus()}}get currentState(){const t=this.cellRecord?.value
19850
19850
  return t&&Object.values(K3).includes(t)?t:K3.off}get tooltipText(){return this.currentState===K3.off?this.breakpointAddString:this.breakpointRemoveString}get ariaLabelText(){switch(this.currentState){case K3.enabled:return this.breakpointEnabledString
19851
19851
  case K3.disabled:return this.breakpointDisabledString
19852
19852
  case K3.hit:return this.breakpointHitString
@@ -19854,7 +19854,8 @@ case K3.conditional:return this.breakpointConditionalString
19854
19854
  case K3.hitDisabled:return this.breakpointHitDisabledString
19855
19855
  default:return this.breakpointAddString}}get menuPosition(){return this.columnConfig?.position??Gy}get tabbableChildren(){return this.button?[this.button]:[]}onButtonClick(t){t.stopPropagation()
19856
19856
  const e=this.currentState,n=e===K3.off?K3.enabled:K3.off
19857
- this.emitToggle(e,n)}onContextMenu(t){t.preventDefault(),t.stopPropagation(),this.requestContextMenu()}onKeyDown(t){return"F10"===t.key&&t.shiftKey||t.key===t6.menuKeyAlias||t.key===t6.contextMenuKeyAlias?(t.preventDefault(),t.stopPropagation(),this.requestContextMenu(),!1):"F9"===t.key||(t.ctrlKey||t.metaKey)&&"b"===t.key.toLowerCase()?(t.preventDefault(),t.stopPropagation(),this.onButtonClick(t),!1):"ArrowDown"===t.key?(t.preventDefault(),t.stopPropagation(),this.focusLastItemWhenOpened=!1,this.requestContextMenu(),!1):"ArrowUp"!==t.key||(t.preventDefault(),t.stopPropagation(),this.focusLastItemWhenOpened=!0,this.requestContextMenu(),!1)}regionLoadedHandler(){this.focusLastItemWhenOpened?(this.focusLastItemWhenOpened=!1,this.focusLastMenuItem()):this.focusMenu()}regionChanged(t,e){t&&t.removeEventListener("change",this.menuChangeHandler,{capture:!0}),this.region&&(this.region.anchorElement=this.button??this,this.region.addEventListener("change",this.menuChangeHandler,{capture:!0}))}buttonChanged(){this.region&&(this.region.anchorElement=this.button??this)}focusoutHandler(t){if(!this.open)return!0
19857
+ this.emitToggle(e,n)}onContextMenu(t){t.preventDefault(),t.stopPropagation(),this.requestContextMenu()}onKeyDown(t){return"F10"===t.key&&t.shiftKey||t.key===t6.menuKeyAlias||t.key===t6.contextMenuKeyAlias?(t.preventDefault(),t.stopPropagation(),this.requestContextMenu(),!1):"F9"===t.key||(t.ctrlKey||t.metaKey)&&"b"===t.key.toLowerCase()?(t.preventDefault(),t.stopPropagation(),this.onButtonClick(t),!1):"ArrowDown"===t.key?(t.preventDefault(),t.stopPropagation(),this.focusLastItemWhenOpened=!1,this.requestContextMenu(),!1):"ArrowUp"!==t.key||(t.preventDefault(),t.stopPropagation(),this.focusLastItemWhenOpened=!0,this.requestContextMenu(),!1)}regionLoadedHandler(){this.focusLastItemWhenOpened?(this.focusLastItemWhenOpened=!1,this.focusLastMenuItem()):this.focusMenu()}regionChanged(t,e){t&&t.removeEventListener("change",this.menuChangeHandler,{capture:!0}),this.region&&(this.region.anchorElement=this.button??this,this.region.addEventListener("change",this.menuChangeHandler,{capture:!0}))}buttonChanged(){this.region&&(this.region.anchorElement=this.button??this)}openChanged(t,e){const n=this.getOwningRow()
19858
+ if(n)return e?(this.restoreRowMenuOpenOnClose=!n.hasAttribute("menu-open"),void(n.menuOpen=!0)):void(this.restoreRowMenuOpenOnClose&&(n.menuOpen=!1,this.restoreRowMenuOpenOnClose=!1))}focusoutHandler(t){if(!this.open)return!0
19858
19859
  const e=t.relatedTarget
19859
19860
  return!!(this.contains(e)||this.region?.contains(e)||this.getMenu()?.contains(e))||(this.open=!1,!1)}contextMenuKeyDownHandler(t){return"Escape"!==t.key||(this.open=!1,this.button?.focus(),!1)}onContextMenuChange(t){const e=this.getRequestedStateFromEvent(t)
19860
19861
  if(!e)return
@@ -19869,7 +19870,14 @@ if(t&&t.length>0){t[t.length-1].focus()}}emitToggle(t,e){const n={recordId:this.
19869
19870
  this.$emit("breakpoint-column-toggle",n)}requestContextMenu(){this.openMenuFromColumnSlot()}openMenuFromColumnSlot(){const t=this.columnConfig?.menuSlot
19870
19871
  if(!t)return
19871
19872
  const e={slots:[{name:t,slot:X3}]}
19872
- this.$emit("cell-view-slots-request",e),this.open=!0}getRequestedStateFromEvent(t){const e=t.target
19873
+ this.$emit("cell-view-slots-request",e),this.open=!0}getOwningRow(){const t=this.getRootNode()
19874
+ if(!(t instanceof ShadowRoot))return
19875
+ const e=t.host
19876
+ if(!(e instanceof HTMLElement))return
19877
+ const n=e.getRootNode()
19878
+ if(!(n instanceof ShadowRoot))return
19879
+ const i=n.host
19880
+ return i instanceof HTMLElement&&"nimble-table-row"===i.localName?i:void 0}getRequestedStateFromEvent(t){const e=t.target
19873
19881
  if(!(e instanceof HTMLElement))return
19874
19882
  const n=e.closest(`[${Y3}]`)
19875
19883
  if(!n)return