@ni/nimble-components 7.7.0 → 7.8.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.
@@ -1298,14 +1298,14 @@ const td=Zh.compose({baseName:"toggle-button",template:(t,e)=>Y`<div role="butto
1298
1298
  Vs.getOrCreate().withPrefix("nimble").register(td())
1299
1299
  const ed="group-selected"
1300
1300
  var sd
1301
- !function(t){t.All="all",t.LeavesOnly="leaves-only"}(sd||(sd={}))
1301
+ !function(t){t.All="all",t.LeavesOnly="leaves-only",t.None="none"}(sd||(sd={}))
1302
1302
  class id{constructor(t,e){this.cache=new WeakMap,this.ltr=t,this.rtl=e}bind(t){this.attach(t)}unbind(t){const e=this.cache.get(t)
1303
1303
  e&&Ao.unsubscribe(e)}attach(t){const e=this.cache.get(t)||new od(this.ltr,this.rtl,t),s=Ao.getValueFor(t)
1304
1304
  Ao.subscribe(e),e.attach(s),this.cache.set(t,e)}}class od{constructor(t,e,s){this.ltr=t,this.rtl=e,this.source=s,this.attached=null}handleChange({target:t,token:e}){this.attach(e.getValueFor(t))}attach(t){this.attached!==this[t]&&(null!==this.attached&&this.source.$fastController.removeStyles(this.attached),this.attached=this[t],null!==this.attached&&this.source.$fastController.addStyles(this.attached))}}const nd=class extends mi{constructor(){super(),this.treeView=null,this.handleClickOverride=t=>{if(t.composedPath().includes(this.expandCollapseButton))return
1305
1305
  const e=this.getImmediateTreeItem(t.target)
1306
1306
  if(e?.disabled||e!==this)return void t.stopImmediatePropagation()
1307
- const s=this.treeView?.selectionMode===sd.LeavesOnly,i=this.hasChildTreeItems()
1308
- if(s&&!i||!s){const t=this.getImmediateTreeItem(this.treeView?.currentSelected)
1307
+ const s=this.treeView?.selectionMode===sd.LeavesOnly,i=this.treeView?.selectionMode===sd.All,o=this.hasChildTreeItems()
1308
+ if(s&&!o||i){const t=this.getImmediateTreeItem(this.treeView?.currentSelected)
1309
1309
  t&&this!==this.treeView?.currentSelected&&(t.selected=!1),this.selected=!0}else this.expanded=!this.expanded
1310
1310
  t.stopImmediatePropagation()},this.handleSelectedChange=t=>{t.target===this&&this.selected&&this.setGroupSelectionOnRootParentTreeItem(this)},this.addEventListener("click",this.handleClickOverride)}connectedCallback(){super.connectedCallback(),this.addEventListener("selected-change",this.handleSelectedChange),this.treeView=this.getParentTreeView(),this.treeView&&this.selected&&this.setGroupSelectionOnRootParentTreeItem(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClickOverride),this.removeEventListener("selected-change",this.handleSelectedChange),this.treeView=null}hasChildTreeItems(){return null!==this.querySelector('[role="treeitem"]')}clearTreeGroupSelection(){const t=this.treeView?.querySelectorAll("[group-selected]")
1311
1311
  t?.forEach((t=>t.removeAttribute(ed)))}setGroupSelectionOnRootParentTreeItem(t){this.clearTreeGroupSelection()