@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.47 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import{property as i,subclass as t}from"../../../core/accessorSupport/decorators.js";import s from"../../Widget.js";import{LayerTreeNode as o}from"../support/LayerTreeNode.js";import{loadCalciteComponents as l}from"../../support/componentsUtils.js";import{tsx as n}from"../../support/widget.js";var r;const c={expand:"expand",collapse:"collapse",hideSublayer:"hideSublayer",showSublayer:"showSublayer"},a="esri-building-disciplines-tree-node",d={base:a,label:`${a}__label`};let p=class extends s{static{r=this}constructor(e){super(e),this.messages=c,this.toggleSiblingsVisibility=!1,this._onCheckboxClick=e=>{e.stopPropagation();(e.metaKey||e.ctrlKey)&&this.toggleSiblingsVisibility&&(this.node.toggleVisibility(),this.node.toggleAllSiblingsVisibility())},this._onCheckboxToggle=e=>{this.node.toggleVisibility(e.currentTarget.checked)}}static loadDependencies(){return l({checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),tree:()=>import("@esri/calcite-components/dist/components/calcite-tree"),"tree-item":()=>import("@esri/calcite-components/dist/components/calcite-tree-item")})}loadDependencies(){return r.loadDependencies()}static{this.vnodeSelector="calcite-tree-item"}render(){const{node:e,messages:i}=this;if(e.isDiscipline&&!e.hasChildren)return n("div",{key:`${e.id}-empty`});const t=e.visible,s=!0===t,o=null===t,l=s?i?.hideSublayer:i?.showSublayer;return n("calcite-tree-item",{class:d.base,key:e.id},n("calcite-label",{class:d.label,layout:"inline"},n("calcite-checkbox",{checked:s,indeterminate:o,label:l,onclick:this._onCheckboxClick,title:l,onCalciteCheckboxChange:this._onCheckboxToggle}),e.title),this._renderedChildren)}get _renderedChildren(){const{node:e}=this;if(!e.hasChildren)return null;const{messages:i}=this,{toggleSiblingsVisibility:t}=this;return n("calcite-tree",{lines:!0,selectionMode:"none",slot:"children"},this.node.children.toArray().reverse().map(e=>n(r,{messages:i,node:e,toggleSiblingsVisibility:t})))}};e([i({type:o})],p.prototype,"node",void 0),e([i()],p.prototype,"messages",void 0),e([i({nonNullable:!0})],p.prototype,"toggleSiblingsVisibility",void 0),e([i()],p.prototype,"_renderedChildren",null),p=r=e([t("esri.widgets.BuildingExplorer.BuildingDisciplinesTree.BuildingDisciplinesNode")],p);const h=p;export{h as default};