UNPKG

azure-devops-ui

Version:

React components for building web UI in Azure DevOps

1 lines 2.24 kB
import{__extends}from"tslib";import"../../CommonImports";import"../../Core/core.css";import"./Tree.css";import"./TreeExpand.css";import*as React from"react";import{FixedHeightList}from"../../List";import{UncheckedObserver}from"../../Observer";var FixedHeightTree=function(e){function t(){var o=null!==e&&e.apply(this,arguments)||this;return o.list=React.createRef(),o.onActivateExpand=function(e,t){!e.defaultPrevented&&t.data.underlyingItem.childItems&&(o.props.onToggle&&o.props.onToggle(e,t.data),e.preventDefault())},o.renderRow=function(t,r,e){var i;return o.props.renderRow&&e.data?(i={ariaRowOffset:e.ariaRowOffset,eventDispatch:e.eventDispatch,data:e.data,itemProvider:o.props.itemProvider,listProps:e.listProps,onFocusItem:e.onFocusItem},React.createElement(UncheckedObserver,{data:r.underlyingItem.data},function(e){return e.data?(r.onToggle=r.underlyingItem.childItems?o.props.onToggle:void 0,(r.underlyingItem.data.renderRow||o.props.renderRow)(t,r,i)):(e=o.props.renderLoadingRow)?e(t,i):React.createElement("div",{className:"bolt-list-row-loading"},React.createElement("div",{className:"shimmer shimmer-line",style:{width:80*Math.random()+20+"%"}}," "))})):React.createElement("div",null)},o}return __extends(t,e),t.prototype.render=function(){var e=this.props.role;return React.createElement(FixedHeightList,{className:this.props.className,eventDispatch:this.props.eventDispatch,focuszoneProps:this.props.focuszoneProps,id:this.props.id,itemProvider:this.props.itemProvider,maxHeight:this.props.maxHeight,onActivate:this.onActivateExpand,onFocus:this.props.onFocus,onSelect:this.props.onSelect,pageSize:this.props.pageSize,renderRow:this.renderRow,role:void 0===e?"tree":e,rowHeight:this.props.rowHeight,ref:this.list,selection:this.props.selection,singleClickActivation:this.props.singleClickActivation||!0,width:this.props.width||"100%"})},t.prototype.getFocusIndex=function(){return this.list.current?this.list.current.getFocusIndex():-1},t.prototype.getStats=function(){return this.list.current?this.list.current.getStats():{firstMaterialized:-1,lastMaterialized:-1}},t.prototype.scrollIntoView=function(e,t){if(this.list.current)return this.list.current.scrollIntoView(e,t)},t}(React.Component);export{FixedHeightTree};