@progress/kendo-react-treeview 10.2.0-develop.6 → 10.2.0-develop.7

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.
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-animation")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-svg-icons","@progress/kendo-react-animation"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactTreeview={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoSvgIcons,e.KendoReactAnimation)}(this,(function(e,t,i,s,n,r){"use strict";function d(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var a=d(t);function o(e,t,i,n,r){switch(n){case s.Keys.left:return s.treeIdUtils.isIdZeroLevel(t)||r.expanded(e)&&s.isEnabledAndAllParentsEnabled(t,i,r)?t:s.treeIdUtils.getDirectParentId(t);case s.Keys.right:return s.isItemExpandedAndWithChildren(e,r)?s.treeIdUtils.getFirstChildId(t):t;case s.Keys.up:return function(){const e=Number(s.treeIdUtils.getShortId(t)),n=s.treeIdUtils.getDirectParentId(t);return e?c(s.treeIdUtils.createId(e-1,n),i,r):s.treeIdUtils.isIdZeroLevel(t)?t:n}();case s.Keys.down:return s.isItemExpandedAndWithChildren(e,r)?s.treeIdUtils.getFirstChildId(t):l(t,i,r)||t;case s.Keys.home:return s.treeIdUtils.ZERO_LEVEL_ZERO_NODE_ID;case s.Keys.end:return function(){let e,t=(i.length-1).toString(),n=i[i.length-1];for(;s.isItemExpandedAndWithChildren(n,r);)e=n[r.getChildrenField()],t=s.treeIdUtils.createId(e.length-1,t),n=e[e.length-1];return t}();default:return t}}function l(e,t,i){const n=s.treeIdUtils.getDirectParentId(e),r=n?s.treeIdUtils.getItemById(n,t,i.getChildrenField()):void 0,d=r?r[i.getChildrenField()]:t,a=Number(s.treeIdUtils.getShortId(e));return a<d.length-1?s.treeIdUtils.createId(a+1,n):r?l(n,t,i):void 0}function c(e,t,i){const n=s.treeIdUtils.getItemById(e,t,i.getChildrenField());return s.isItemExpandedAndWithChildren(n,i)?c(s.treeIdUtils.createId(n[i.getChildrenField()].length-1,e),t,i):e}const h=(e,t)=>{const i=((e,t)=>e===t.length-1)(e,t);return 0!==e||i?i?"bot":"mid":"top"},p="expanded",m="items",u="selected",I="checked",g="checkIndeterminate",f="_kendoItemId",b="_kendoTreeViewGuid",{sizeMap:v}=s.kendoThemeMaps,C=a.createContext((e=>e)),x=class extends a.Component{constructor(){super(...arguments),this.onCheckChange=e=>{this.props.onCheckChange(e,this.item,this.itemId)},this.onExpandChange=e=>{this.props.onExpandChange(e,this.item,this.itemId)},this.onItemClick=e=>{this.props.onItemClick(e,this.item,this.itemId)},this.onPress=e=>{this.props.onPress(e.event,this.item,this.itemId)},this.onDrag=e=>{this.props.onDrag(e.event,this.item,this.itemId)},this.onRelease=e=>{this.props.onRelease(e.event,this.item,this.itemId)},this.onContextMenu=e=>{this.props.onContextMenu(e,this.item,this.itemId)},this.assignDraggableMeta=e=>{e&&(e[f]=this.props.itemId,e[b]=this.props.treeGuid)}}render(){const e=this.renderSubitemsIfApplicable(),t=this.renderItemInPart();return a.createElement("li",{className:s.classNames("k-treeview-item"),tabIndex:this.tabIndex,role:"treeitem","aria-expanded":this.ariaExpanded,"aria-selected":this.ariaSelected,"aria-checked":this.ariaChecked,"aria-disabled":!!this.disabled||void 0,ref:e=>{this.itemElement=e}},a.createElement("span",{className:`k-treeview-${this.props.position}`,ref:this.assignDraggableMeta},this.renderExpandIcon(),this.renderCheckbox(),this.props.draggable?a.createElement(s.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease},t):t),e&&(this.props.animate?a.createElement(r.Reveal,{transitionEnterDuration:200,transitionExitDuration:200,style:{display:"block"},children:e}):e))}componentDidMount(){const e=this.props.focusedItemId,t=this.itemId;e&&e===t&&this.props.onFocusDomElNeeded(this.itemElement),this.checkboxElement&&(this.checkboxElement.indeterminate=this.fieldsSvc.checkIndeterminate(this.item))}componentDidUpdate(e){const t=this.props.focusedItemId;if(t&&t!==e.focusedItemId&&t===this.itemId&&this.props.onFocusDomElNeeded(this.itemElement),this.checkboxElement){const e=this.fieldsSvc.checkIndeterminate(this.item);this.checkboxElement.indeterminate!==e&&(this.checkboxElement.indeterminate=e)}}renderCheckbox(){if(this.props.checkboxes){const e=this.props.size;return a.createElement("span",{className:s.classNames("k-checkbox-wrap")},a.createElement("input",{type:"checkbox",className:s.classNames("k-checkbox k-rounded-md",{[`k-checkbox-${v[e]||e}`]:e,"k-disabled":this.disabled}),"aria-label":this.item.text,checked:!!this.fieldsSvc.checked(this.item),id:this.props.id,tabIndex:-1,onChange:this.onCheckChange,ref:e=>{this.checkboxElement=e}}))}}renderExpandIcon(){return this.props.expandIcons&&(this.fieldsSvc.hasChildren(this.item)||s.hasChildren(this.item,this.fieldsSvc.getChildrenField()))&&a.createElement("span",{className:s.classNames("k-treeview-toggle",{"k-disabled":this.disabled}),onClick:this.onExpandChange},a.createElement(s.IconWrap,{...this.getIconProps()}))}renderSubitemsIfApplicable(){const e=this.fieldsSvc.children(this.item);return s.isItemExpandedAndWithChildren(this.item,this.fieldsSvc)?a.createElement("ul",{className:"k-treeview-group",role:"group"},e.map(((t,i)=>a.createElement(E,{item:t,position:h(i,e),itemId:s.treeIdUtils.createId(i,this.itemId),treeGuid:this.props.treeGuid,animate:this.props.animate,focusedItemId:this.props.focusedItemId,tabbableItemId:this.props.tabbableItemId,fieldsService:this.props.fieldsService,itemUI:this.props.itemUI,checkboxes:this.props.checkboxes,ariaMultiSelectable:this.props.ariaMultiSelectable,onItemClick:this.props.onItemClick,onFocusDomElNeeded:this.props.onFocusDomElNeeded,draggable:this.props.draggable,onPress:this.props.onPress,onDrag:this.props.onDrag,onRelease:this.props.onRelease,expandIcons:this.props.expandIcons,iconField:this.props.iconField,onExpandChange:this.props.onExpandChange,onCheckChange:this.props.onCheckChange,onContextMenu:this.props.onContextMenu,key:i,size:this.props.size,disabled:this.disabled,isRtl:this.props.isRtl})))):void 0}renderItemInPart(){const e=this.props.iconField,t=e&&this.item[e];return a.createElement("span",{className:s.classNames("k-treeview-leaf",{"k-focus":this.props.focusedItemId===this.itemId,"k-selected":this.fieldsSvc.selected(this.item),"k-disabled":this.disabled,"k-touch-action-none":this.props.draggable}),onClick:this.onItemClick,onContextMenu:this.onContextMenu},t&&a.createElement(s.IconWrap,{name:t.name,icon:t}),a.createElement("span",{className:"k-treeview-leaf-text"},this.props.itemUI?a.createElement(this.props.itemUI,{item:this.item,itemHierarchicalIndex:this.itemId}):this.fieldsSvc.text(this.item)))}get fieldsSvc(){return this.props.fieldsService}get itemId(){return this.props.itemId}get item(){return this.props.item}get tabIndex(){return(this.props.focusedItemId||this.props.tabbableItemId)===this.itemId?0:-1}get ariaExpanded(){return this.fieldsSvc.hasChildren(this.item)||s.hasChildren(this.item,this.fieldsSvc.getChildrenField())?!!this.fieldsSvc.expanded(this.item):void 0}get disabled(){return this.props.disabled||this.fieldsSvc.disabled(this.item)}get ariaChecked(){if(this.props.checkboxes)return this.fieldsSvc.checked(this.item)?"true":this.fieldsSvc.checkIndeterminate(this.item)?"mixed":"false"}get ariaSelected(){return!!this.fieldsSvc.selected(this.item)||(this.props.ariaMultiSelectable?!!this.disabled&&void 0:void 0)}getIconProps(){const e=this.fieldsSvc.expanded(this.item);return e&&!s.hasChildren(this.item,this.fieldsSvc.getChildrenField())?{name:"loading"}:e?{name:"caret-alt-down",icon:n.caretAltDownIcon}:{name:this.props.isRtl?"caret-alt-left":"caret-alt-right",icon:this.props.isRtl?n.caretAltLeftIcon:n.caretAltRightIcon}}};x.defaultProps={position:"top",iconField:"svgIcon"};let k=x;const E=s.withIdHOC(a.forwardRef(((e,t)=>{const i=a.useContext(C).call(void 0,e);return a.createElement(k,{ref:t,...i})})));E.displayName="TreeViewItem";const F={name:"@progress/kendo-react-treeview",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"10.2.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},{sizeMap:y}=s.kendoThemeMaps,D=class extends a.Component{constructor(e){super(e),this.state={focusedItemId:void 0,focusedItemPublicId:void 0,tabbableItemId:s.treeIdUtils.ZERO_LEVEL_ZERO_NODE_ID},this.fieldsSvc=null,this.allowExplicitFocus=!1,this.showLicenseWatermark=!1,this._element=null,this.onFocusDomElNeeded=e=>{this.allowExplicitFocus&&this.focusDomItem(e)},this.onCheckChange=(e,t,i)=>{this.setFocus(i),this.dispatchCheckChange(e,t,i)},this.onExpandChange=(e,t,i)=>{this.setFocus(i),this.dispatchExpandChange(e,t,i)},this.onPress=(e,t,i)=>{this.props.onItemDragStart&&this.props.onItemDragStart.call(void 0,{target:this,item:t,itemHierarchicalIndex:i})},this.onDrag=(e,t,i)=>{const{pageX:s,pageY:n,clientX:r,clientY:d}=e;this.props.onItemDragOver&&this.props.onItemDragOver.call(void 0,{target:this,item:t,itemHierarchicalIndex:i,pageX:s,pageY:n,clientX:r,clientY:d})},this.onRelease=(e,t,i)=>{const{pageX:s,pageY:n,clientX:r,clientY:d}=e;this.props.onItemDragEnd&&this.props.onItemDragEnd.call(void 0,{target:this,item:t,itemHierarchicalIndex:i,pageX:s,pageY:n,clientX:r,clientY:d})},this.onItemClick=(e,t,i)=>{this.setFocus(i),this.dispatchItemClick(e,t,i)},this.onFocus=()=>{clearTimeout(this.blurRequest),void 0===this.state.focusedItemId&&this.data.length&&this.setFocus(this.state.tabbableItemId)},this.onBlur=()=>{clearTimeout(this.blurRequest),this.blurRequest=window.setTimeout((()=>this.setFocus(void 0)),0)},this.onKeyDown=e=>{const t=this.getFocusedItem();if(t&&this.fieldsSvc){const i=o(t,this.state.focusedItemId,this.data,e.keyCode,this.fieldsSvc);i!==this.state.focusedItemId&&(e.preventDefault(),this.allowExplicitFocus=!0,this.setFocus(i)),this.dispatchEventsOnKeyDown(e,t)}},this.onContextMenu=(e,t,i)=>{if(this.props.onContextMenu){const s={target:this,syntheticEvent:e,nativeEvent:e.nativeEvent,item:t,itemID:i};this.props.onContextMenu.call(void 0,s)}},this.showLicenseWatermark=!s.validatePackage(F,{component:"TreeView"})}get treeGuid(){return this.props.id+"-accessibility-id"}get element(){return this._element}render(){this.fieldsSvc=new s.TreeFieldsService(this.props);const{size:e,className:t}=this.props;return a.createElement("div",{id:this.props.id,style:{position:"relative",...this.props.style},className:s.classNames("k-treeview",{[`k-treeview-${y[e]||e}`]:e,"k-user-select-none":this.props.draggable,"k-rtl":"rtl"===this.props.dir},t),onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,role:"tree","aria-multiselectable":!!this.ariaMultiSelectable||void 0,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],ref:e=>{this._element=e},tabIndex:this.props.tabIndex},a.createElement("ul",{className:"k-treeview-lines k-treeview-group",role:"group"},this.data.map(((t,i)=>a.createElement(E,{id:this.props.id+"-item-"+i,item:t,position:h(i,this.data),itemId:i.toString(),treeGuid:this.treeGuid,animate:this.props.animate,focusedItemId:this.state.focusedItemId,tabbableItemId:this.state.tabbableItemId,fieldsService:this.fieldsSvc,itemUI:this.props.item,checkboxes:this.props.checkboxes,ariaMultiSelectable:this.ariaMultiSelectable,onItemClick:this.onItemClick,onFocusDomElNeeded:this.onFocusDomElNeeded,draggable:this.props.draggable,onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,expandIcons:this.props.expandIcons,iconField:this.props.iconField,onExpandChange:this.onExpandChange,onCheckChange:this.onCheckChange,onContextMenu:this.onContextMenu,key:i,size:e,isRtl:"rtl"===this.props.dir})))),this.showLicenseWatermark&&a.createElement(s.WatermarkOverlay,null))}componentDidUpdate(){this.allowExplicitFocus=!1,this.refocusDueToFocusIdField()}dispatchEventsOnKeyDown(e,t){if(null===this.fieldsSvc)return;const i=()=>this.fieldsSvc&&s.isEnabledAndAllParentsEnabled(this.state.focusedItemId,this.data,this.fieldsSvc);e.keyCode===s.Keys.left&&this.fieldsSvc.expanded(t)&&i()||e.keyCode===s.Keys.right&&!this.fieldsSvc.expanded(t)&&(this.fieldsSvc.hasChildren(t)||s.hasChildren(t,this.props.childrenField))&&i()?this.dispatchExpandChange(e,t,this.state.focusedItemId):e.keyCode===s.Keys.enter&&i()?this.dispatchItemClick(e,t,this.state.focusedItemId):e.keyCode===s.Keys.space&&i()&&(e.preventDefault(),this.dispatchCheckChange(e,t,this.state.focusedItemId))}setFocus(e){if(e&&this.fieldsSvc)if(this.fieldsSvc.focusIdField){const t=this.getItemById(e);this.setState({focusedItemId:e,focusedItemPublicId:this.fieldsSvc.focusId(t)})}else this.setState({focusedItemId:e});else this.setState((e=>({focusedItemId:void 0,focusedItemPublicId:void 0,tabbableItemId:e.focusedItemId})))}getFocusedItem(){return this.state.focusedItemId?this.getItemById(this.state.focusedItemId):void 0}getItemById(e){return s.treeIdUtils.getItemById(e,this.data,this.props.childrenField||m)}dispatchCheckChange(e,t,i){s.dispatchEvent(this.props.onCheckChange,e,this,{item:t,itemHierarchicalIndex:i})}dispatchExpandChange(e,t,i){s.dispatchEvent(this.props.onExpandChange,e,this,{item:t,itemHierarchicalIndex:i})}dispatchItemClick(e,t,i){s.dispatchEvent(this.props.onItemClick,e,this,{item:t,itemHierarchicalIndex:i})}refocusDueToFocusIdField(){if(this.fieldsSvc&&this.fieldsSvc.focusIdField){const e=this.state.focusedItemPublicId;if(e){const t=this.props.getFocusHierarchicalIndex?this.props.getFocusHierarchicalIndex(e):s.resolveItemId(e,this.fieldsSvc.focusIdField,this.data,this.props.childrenField);t!==this.state.focusedItemId&&(this.allowExplicitFocus=!0,this.setState({focusedItemId:t}))}}}get ariaMultiSelectable(){return!0===this.props["aria-multiselectable"]||"true"===this.props["aria-multiselectable"]}get data(){return this.props.data||[]}focusDomItem(e){e.focus()}get guid(){return this.treeGuid}};D.propTypes={data:i.arrayOf(i.any),animate:i.bool,tabIndex:i.number,focusIdField:i.string,getHierarchicalIndexById:i.func,onExpandChange:i.func,onItemClick:i.func,expandField:i.string,selectField:i.string,iconField:i.string,childrenField:i.string,hasChildrenField:i.string,textField:i.string,disableField:i.string,item:i.any,"aria-multiselectable":(e,t,i)=>void 0!==e[t]&&!0!==e[t]&&!1!==e[t]&&"true"!==e[t]&&"false"!==e[t]?new Error("Invalid prop `"+t+"` supplied to `"+i+"`. Validation failed."):null,"aria-label":i.string,"aria-labelledby":i.string,size:i.oneOf([null,"small","medium","large"]),dir:i.string},D.defaultProps={animate:!0,expandField:p,selectField:u,iconField:"svgIcon",hasChildrenField:"hasChildren",childrenField:m,textField:"text",disableField:"disabled",checkField:I,checkIndeterminateField:g,size:"medium"};let S=D;function w(e,t,i,n,r){if(i){const{ids:d,field:a}=N(i,t);return function(e,t,i,n,r){let d=e;return t.forEach((e=>{d=s.updateItem(d,e,(e=>P(i,e)),n,r)})),d}(e,!s.isArray(i)&&i.idField?s.resolveItemsIds(d,i.idField,e,r):d,a,n,r)}return e}function N(e,t){let i,n;return s.isArray(e)?(i=e,n=t):(i=e.ids||[],n=e.operationField||t),{ids:i,field:n}}function P(e,t){const i=(e||"").split(".");let s=t;for(let e=0;e<i.length;e++){const t=i[e];if(e===i.length-1)s[t]=!0;else{if(void 0===s[t])return;s[t]={...s[t]},s=s[t]}}}function U(e,t,i,n,r){let d=!1;for(let a=0;a<e.length;a++){const o=e[a];if(s.getNestedValue(n,o)){if(!d)for(let e=0;e<t.length;e++)P(r,t[e]);d=!0,o[i]&&U(o[i],[],i,n,r)}else o[i]&&U(o[i],d?[o]:t.concat([o]),i,n,r)}}const R=class extends a.PureComponent{constructor(){super(...arguments),this.state={visible:!1,top:0,left:0,text:"",operationClassName:"cancel"}}render(){const e={top:this.state.top+"px",left:this.state.left+"px"};return this.state.visible&&a.createElement("div",{className:"k-header k-drag-clue",style:{...this.props.style,...e}},a.createElement(s.IconWrap,{className:s.classNames("k-drag-status"),name:this.state.operationClassName&&s.toIconName(this.state.operationClassName),icon:"k-i-plus"===this.state.operationClassName?n.plusIcon:"k-i-insert-up"===this.state.operationClassName?n.insertTopIcon:"k-i-insert-down"===this.state.operationClassName?n.insertBottomIcon:"k-i-insert-middle"===this.state.operationClassName?n.insertMiddleIcon:n.cancelIcon}),this.state.text)}show(e,t,i,s){this.setState({visible:!0,top:e,left:t,text:i,operationClassName:s})}hide(){this.setState({visible:!1})}};R.defaultProps={style:{display:"block",position:"absolute",zIndex:2e4,padding:"4px 6px"}};let T=R;const O=s.withIdHOC(S);O.displayName="KendoReactTreeView",Object.defineProperty(e,"FieldsService",{enumerable:!0,get:function(){return s.TreeFieldsService}}),e.TreeView=O,e.TreeViewClassComponent=S,e.TreeViewDragAnalyzer=class{constructor(e){this.event=e,this.initialized=!1,this.destItemId="",this.destTreeViewGuid="",this.itemId=e.itemHierarchicalIndex,this.treeViewGuid=e.target.guid}init(){return this.initialized||(this.setDestimationMeta(document.elementFromPoint(this.event.clientX,this.event.clientY)),this.initialized=!0),this}get isDropAllowed(){return!!(this.initialized&&this.destItemId&&this.destTreeViewGuid)&&!`${this.destTreeViewGuid}_${this.destItemId}_`.startsWith(`${this.treeViewGuid}_${this.itemId}_`)}get destinationMeta(){return{itemHierarchicalIndex:this.destItemId,treeViewGuid:this.destTreeViewGuid}}getDropOperation(){if(this.initialized&&this.isDropAllowed){const{top:e,height:t}=this.destDomNodeWithMeta.getBoundingClientRect();return e+t-this.event.clientY<6?"after":this.event.clientY-e<6?"before":"child"}}setDestimationMeta(e){let t=e;for(;t&&!t[f];)t=t.parentNode;t&&t[f]&&(this.destDomNodeWithMeta=t,this.destItemId=t[f],this.destTreeViewGuid=t[b])}},e.TreeViewDragClue=T,e.TreeViewItemPropsContext=C,e.getItemIdUponKeyboardNavigation=o,e.handleTreeViewCheckChange=function(e,t,i,n={},r){if(!i||!i.length)return[];const{ids:d,idField:a}=function(e){let t,i;return s.isArray(e)?t=e:(t=e.ids||[],i=e.idField),{ids:t,idField:i}}(t),o=a?s.getNestedValue(a,e.item):e.itemHierarchicalIndex,l=d.indexOf(o),c=-1===l,h=r||m;let p;return n.singleMode?p=c?[o]:[]:(p=d.slice(),c?p.push(o):p.splice(l,1),n.checkChildren&&function(e,t,i,n,r,d){s.getAllDirectIndirectChildrenIds(e,t,r,n).forEach((e=>{i&&-1===d.indexOf(e)?d.push(e):!i&&d.indexOf(e)>-1&&d.splice(d.indexOf(e),1)}))}(e.item,e.itemHierarchicalIndex,c,a,h,p),n.checkParents&&function(e,t,i,n,r,d){const a=h();let o=a.next();function l(){for(;!o.done;){const{id:e,item:t}=o.value;if(-1!==r.indexOf(e)||!s.areAllDirectChildrenChecked(t,e,i,n,r))break;r.push(e),o=a.next()}}function c(){for(;!o.done;){const{id:e}=o.value,t=r.indexOf(e);if(!(t>-1))break;r.splice(t,1),o=a.next()}}function*h(){if(i){const r=s.getAllParents(e,n,d);for(let e=r.length-1;e>-1;e--)yield{id:s.getNestedValue(i,r[e]),item:t?r[e]:void 0}}else{let i=s.treeIdUtils.getDirectParentId(e);for(;i;)yield{id:i,item:t?s.treeIdUtils.getItemById(i,d,n):void 0},i=s.treeIdUtils.getDirectParentId(i)}}t?l():c()}(e.itemHierarchicalIndex,c,a,h,p,i)),s.isArray(t)?p:Object.assign({},t,{ids:p})},e.moveTreeViewItem=function(e,t,i,n,r,d){const a=d||m;if(!function(){if(!t||!t.length||!e||!n||r&&!r.length)return!1;const i=r&&r!==t?r:t;return!!s.treeIdUtils.getItemById(n,i,a)}())return l();const o=s.treeIdUtils.getItemById(e,t,a);if(!o)return l();if(!r||r===t){if(`${n}_`.startsWith(`${e}_`))return l();const d=s.removeItem(e,a,t),c=s.addItem(o,i,a,s.treeIdUtils.getDecrementedItemIdAfterRemoval(e,n),d);return r?{sourceData:c,targetData:c}:c}return{sourceData:s.removeItem(e,a,t),targetData:s.addItem(o,i,a,n,r)};function l(){return r?{sourceData:t,targetData:r}:t}},e.processTreeViewItems=function(e,t){if(!e||!e.length)return[];let i=e;const n=t.cloneField||"cloned",r=t.expandField||p,d=t.selectField||u,a=t.checkField||I,o=t.childrenField||m;return i=w(i,r,t.expand,n,o),i=w(i,d,t.select,n,o),i=w(i,a,t.check,n,o),function(e,t,i){if(i&&!s.isArray(i)&&i.applyCheckIndeterminate){const{field:n}=N(i,I),r=i.checkIndeterminateField||g;for(let i=0;i<e.length;i++){const d=e[i],a=d[t];a&&U(a,s.getNestedValue(n,d)?[]:[d],t,n,r)}}}(i,o,t.check),i}}));
15
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-animation")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-svg-icons","@progress/kendo-react-animation"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactTreeview={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoSvgIcons,e.KendoReactAnimation)}(this,(function(e,t,i,s,n,r){"use strict";function d(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var a=d(t);function o(e,t,i,n,r){switch(n){case s.Keys.left:return s.treeIdUtils.isIdZeroLevel(t)||r.expanded(e)&&s.isEnabledAndAllParentsEnabled(t,i,r)?t:s.treeIdUtils.getDirectParentId(t);case s.Keys.right:return s.isItemExpandedAndWithChildren(e,r)?s.treeIdUtils.getFirstChildId(t):t;case s.Keys.up:return function(){const e=Number(s.treeIdUtils.getShortId(t)),n=s.treeIdUtils.getDirectParentId(t);return e?c(s.treeIdUtils.createId(e-1,n),i,r):s.treeIdUtils.isIdZeroLevel(t)?t:n}();case s.Keys.down:return s.isItemExpandedAndWithChildren(e,r)?s.treeIdUtils.getFirstChildId(t):l(t,i,r)||t;case s.Keys.home:return s.treeIdUtils.ZERO_LEVEL_ZERO_NODE_ID;case s.Keys.end:return function(){let e,t=(i.length-1).toString(),n=i[i.length-1];for(;s.isItemExpandedAndWithChildren(n,r);)e=n[r.getChildrenField()],t=s.treeIdUtils.createId(e.length-1,t),n=e[e.length-1];return t}();default:return t}}function l(e,t,i){const n=s.treeIdUtils.getDirectParentId(e),r=n?s.treeIdUtils.getItemById(n,t,i.getChildrenField()):void 0,d=r?r[i.getChildrenField()]:t,a=Number(s.treeIdUtils.getShortId(e));return a<d.length-1?s.treeIdUtils.createId(a+1,n):r?l(n,t,i):void 0}function c(e,t,i){const n=s.treeIdUtils.getItemById(e,t,i.getChildrenField());return s.isItemExpandedAndWithChildren(n,i)?c(s.treeIdUtils.createId(n[i.getChildrenField()].length-1,e),t,i):e}const h=(e,t)=>{const i=((e,t)=>e===t.length-1)(e,t);return 0!==e||i?i?"bot":"mid":"top"},p="expanded",m="items",u="selected",I="checked",g="checkIndeterminate",f="_kendoItemId",b="_kendoTreeViewGuid",{sizeMap:v}=s.kendoThemeMaps,C=a.createContext((e=>e)),x=class extends a.Component{constructor(){super(...arguments),this.onCheckChange=e=>{this.props.onCheckChange(e,this.item,this.itemId)},this.onExpandChange=e=>{this.props.onExpandChange(e,this.item,this.itemId)},this.onItemClick=e=>{this.props.onItemClick(e,this.item,this.itemId)},this.onPress=e=>{this.props.onPress(e.event,this.item,this.itemId)},this.onDrag=e=>{this.props.onDrag(e.event,this.item,this.itemId)},this.onRelease=e=>{this.props.onRelease(e.event,this.item,this.itemId)},this.onContextMenu=e=>{this.props.onContextMenu(e,this.item,this.itemId)},this.assignDraggableMeta=e=>{e&&(e[f]=this.props.itemId,e[b]=this.props.treeGuid)}}render(){const e=this.renderSubitemsIfApplicable(),t=this.renderItemInPart();return a.createElement("li",{className:s.classNames("k-treeview-item"),tabIndex:this.tabIndex,role:"treeitem","aria-expanded":this.ariaExpanded,"aria-selected":this.ariaSelected,"aria-checked":this.ariaChecked,"aria-disabled":!!this.disabled||void 0,ref:e=>{this.itemElement=e}},a.createElement("span",{className:`k-treeview-${this.props.position}`,ref:this.assignDraggableMeta},this.renderExpandIcon(),this.renderCheckbox(),this.props.draggable?a.createElement(s.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease},t):t),e&&(this.props.animate?a.createElement(r.Reveal,{transitionEnterDuration:200,transitionExitDuration:200,style:{display:"block"},children:e}):e))}componentDidMount(){const e=this.props.focusedItemId,t=this.itemId;e&&e===t&&this.props.onFocusDomElNeeded(this.itemElement),this.checkboxElement&&(this.checkboxElement.indeterminate=this.fieldsSvc.checkIndeterminate(this.item))}componentDidUpdate(e){const t=this.props.focusedItemId;if(t&&t!==e.focusedItemId&&t===this.itemId&&this.props.onFocusDomElNeeded(this.itemElement),this.checkboxElement){const e=this.fieldsSvc.checkIndeterminate(this.item);this.checkboxElement.indeterminate!==e&&(this.checkboxElement.indeterminate=e)}}renderCheckbox(){if(this.props.checkboxes){const e=this.props.size;return a.createElement("span",{className:s.classNames("k-checkbox-wrap")},a.createElement("input",{type:"checkbox",className:s.classNames("k-checkbox k-rounded-md",{[`k-checkbox-${v[e]||e}`]:e,"k-disabled":this.disabled}),"aria-label":this.item.text,checked:!!this.fieldsSvc.checked(this.item),id:this.props.id,tabIndex:-1,onChange:this.onCheckChange,ref:e=>{this.checkboxElement=e}}))}}renderExpandIcon(){return this.props.expandIcons&&(this.fieldsSvc.hasChildren(this.item)||s.hasChildren(this.item,this.fieldsSvc.getChildrenField()))&&a.createElement("span",{className:s.classNames("k-treeview-toggle",{"k-disabled":this.disabled}),onClick:this.onExpandChange},a.createElement(s.IconWrap,{...this.getIconProps()}))}renderSubitemsIfApplicable(){const e=this.fieldsSvc.children(this.item);return s.isItemExpandedAndWithChildren(this.item,this.fieldsSvc)?a.createElement("ul",{className:"k-treeview-group",role:"group"},e.map(((t,i)=>a.createElement(E,{item:t,position:h(i,e),itemId:s.treeIdUtils.createId(i,this.itemId),treeGuid:this.props.treeGuid,animate:this.props.animate,focusedItemId:this.props.focusedItemId,tabbableItemId:this.props.tabbableItemId,fieldsService:this.props.fieldsService,itemUI:this.props.itemUI,checkboxes:this.props.checkboxes,ariaMultiSelectable:this.props.ariaMultiSelectable,onItemClick:this.props.onItemClick,onFocusDomElNeeded:this.props.onFocusDomElNeeded,draggable:this.props.draggable,onPress:this.props.onPress,onDrag:this.props.onDrag,onRelease:this.props.onRelease,expandIcons:this.props.expandIcons,iconField:this.props.iconField,onExpandChange:this.props.onExpandChange,onCheckChange:this.props.onCheckChange,onContextMenu:this.props.onContextMenu,key:i,size:this.props.size,disabled:this.disabled,isRtl:this.props.isRtl})))):void 0}renderItemInPart(){const e=this.props.iconField,t=e&&this.item[e];return a.createElement("span",{className:s.classNames("k-treeview-leaf",{"k-focus":this.props.focusedItemId===this.itemId,"k-selected":this.fieldsSvc.selected(this.item),"k-disabled":this.disabled,"k-touch-action-none":this.props.draggable}),onClick:this.onItemClick,onContextMenu:this.onContextMenu},t&&a.createElement(s.IconWrap,{name:t.name,icon:t}),a.createElement("span",{className:"k-treeview-leaf-text"},this.props.itemUI?a.createElement(this.props.itemUI,{item:this.item,itemHierarchicalIndex:this.itemId}):this.fieldsSvc.text(this.item)))}get fieldsSvc(){return this.props.fieldsService}get itemId(){return this.props.itemId}get item(){return this.props.item}get tabIndex(){return(this.props.focusedItemId||this.props.tabbableItemId)===this.itemId?0:-1}get ariaExpanded(){return this.fieldsSvc.hasChildren(this.item)||s.hasChildren(this.item,this.fieldsSvc.getChildrenField())?!!this.fieldsSvc.expanded(this.item):void 0}get disabled(){return this.props.disabled||this.fieldsSvc.disabled(this.item)}get ariaChecked(){if(this.props.checkboxes)return this.fieldsSvc.checked(this.item)?"true":this.fieldsSvc.checkIndeterminate(this.item)?"mixed":"false"}get ariaSelected(){return!!this.fieldsSvc.selected(this.item)||(this.props.ariaMultiSelectable?!!this.disabled&&void 0:void 0)}getIconProps(){const e=this.fieldsSvc.expanded(this.item);return e&&!s.hasChildren(this.item,this.fieldsSvc.getChildrenField())?{name:"loading"}:e?{name:"caret-alt-down",icon:n.caretAltDownIcon}:{name:this.props.isRtl?"caret-alt-left":"caret-alt-right",icon:this.props.isRtl?n.caretAltLeftIcon:n.caretAltRightIcon}}};x.defaultProps={position:"top",iconField:"svgIcon"};let k=x;const E=s.withIdHOC(a.forwardRef(((e,t)=>{const i=a.useContext(C).call(void 0,e);return a.createElement(k,{ref:t,...i})})));E.displayName="TreeViewItem";const F={name:"@progress/kendo-react-treeview",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"10.2.0-develop.7",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},{sizeMap:y}=s.kendoThemeMaps,D=class extends a.Component{constructor(e){super(e),this.state={focusedItemId:void 0,focusedItemPublicId:void 0,tabbableItemId:s.treeIdUtils.ZERO_LEVEL_ZERO_NODE_ID},this.fieldsSvc=null,this.allowExplicitFocus=!1,this.showLicenseWatermark=!1,this._element=null,this.onFocusDomElNeeded=e=>{this.allowExplicitFocus&&this.focusDomItem(e)},this.onCheckChange=(e,t,i)=>{this.setFocus(i),this.dispatchCheckChange(e,t,i)},this.onExpandChange=(e,t,i)=>{this.setFocus(i),this.dispatchExpandChange(e,t,i)},this.onPress=(e,t,i)=>{this.props.onItemDragStart&&this.props.onItemDragStart.call(void 0,{target:this,item:t,itemHierarchicalIndex:i})},this.onDrag=(e,t,i)=>{const{pageX:s,pageY:n,clientX:r,clientY:d}=e;this.props.onItemDragOver&&this.props.onItemDragOver.call(void 0,{target:this,item:t,itemHierarchicalIndex:i,pageX:s,pageY:n,clientX:r,clientY:d})},this.onRelease=(e,t,i)=>{const{pageX:s,pageY:n,clientX:r,clientY:d}=e;this.props.onItemDragEnd&&this.props.onItemDragEnd.call(void 0,{target:this,item:t,itemHierarchicalIndex:i,pageX:s,pageY:n,clientX:r,clientY:d})},this.onItemClick=(e,t,i)=>{this.setFocus(i),this.dispatchItemClick(e,t,i)},this.onFocus=()=>{clearTimeout(this.blurRequest),void 0===this.state.focusedItemId&&this.data.length&&this.setFocus(this.state.tabbableItemId)},this.onBlur=()=>{clearTimeout(this.blurRequest),this.blurRequest=window.setTimeout((()=>this.setFocus(void 0)),0)},this.onKeyDown=e=>{const t=this.getFocusedItem();if(t&&this.fieldsSvc){const i=o(t,this.state.focusedItemId,this.data,e.keyCode,this.fieldsSvc);i!==this.state.focusedItemId&&(e.preventDefault(),this.allowExplicitFocus=!0,this.setFocus(i)),this.dispatchEventsOnKeyDown(e,t)}},this.onContextMenu=(e,t,i)=>{if(this.props.onContextMenu){const s={target:this,syntheticEvent:e,nativeEvent:e.nativeEvent,item:t,itemID:i};this.props.onContextMenu.call(void 0,s)}},this.showLicenseWatermark=!s.validatePackage(F,{component:"TreeView"})}get treeGuid(){return this.props.id+"-accessibility-id"}get element(){return this._element}render(){this.fieldsSvc=new s.TreeFieldsService(this.props);const{size:e,className:t}=this.props;return a.createElement("div",{id:this.props.id,style:{position:"relative",...this.props.style},className:s.classNames("k-treeview",{[`k-treeview-${y[e]||e}`]:e,"k-user-select-none":this.props.draggable,"k-rtl":"rtl"===this.props.dir},t),onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,role:"tree","aria-multiselectable":!!this.ariaMultiSelectable||void 0,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],ref:e=>{this._element=e},tabIndex:this.props.tabIndex},a.createElement("ul",{className:"k-treeview-lines k-treeview-group",role:"group"},this.data.map(((t,i)=>a.createElement(E,{id:this.props.id+"-item-"+i,item:t,position:h(i,this.data),itemId:i.toString(),treeGuid:this.treeGuid,animate:this.props.animate,focusedItemId:this.state.focusedItemId,tabbableItemId:this.state.tabbableItemId,fieldsService:this.fieldsSvc,itemUI:this.props.item,checkboxes:this.props.checkboxes,ariaMultiSelectable:this.ariaMultiSelectable,onItemClick:this.onItemClick,onFocusDomElNeeded:this.onFocusDomElNeeded,draggable:this.props.draggable,onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,expandIcons:this.props.expandIcons,iconField:this.props.iconField,onExpandChange:this.onExpandChange,onCheckChange:this.onCheckChange,onContextMenu:this.onContextMenu,key:i,size:e,isRtl:"rtl"===this.props.dir})))),this.showLicenseWatermark&&a.createElement(s.WatermarkOverlay,null))}componentDidUpdate(){this.allowExplicitFocus=!1,this.refocusDueToFocusIdField()}dispatchEventsOnKeyDown(e,t){if(null===this.fieldsSvc)return;const i=()=>this.fieldsSvc&&s.isEnabledAndAllParentsEnabled(this.state.focusedItemId,this.data,this.fieldsSvc);e.keyCode===s.Keys.left&&this.fieldsSvc.expanded(t)&&i()||e.keyCode===s.Keys.right&&!this.fieldsSvc.expanded(t)&&(this.fieldsSvc.hasChildren(t)||s.hasChildren(t,this.props.childrenField))&&i()?this.dispatchExpandChange(e,t,this.state.focusedItemId):e.keyCode===s.Keys.enter&&i()?this.dispatchItemClick(e,t,this.state.focusedItemId):e.keyCode===s.Keys.space&&i()&&(e.preventDefault(),this.dispatchCheckChange(e,t,this.state.focusedItemId))}setFocus(e){if(e&&this.fieldsSvc)if(this.fieldsSvc.focusIdField){const t=this.getItemById(e);this.setState({focusedItemId:e,focusedItemPublicId:this.fieldsSvc.focusId(t)})}else this.setState({focusedItemId:e});else this.setState((e=>({focusedItemId:void 0,focusedItemPublicId:void 0,tabbableItemId:e.focusedItemId})))}getFocusedItem(){return this.state.focusedItemId?this.getItemById(this.state.focusedItemId):void 0}getItemById(e){return s.treeIdUtils.getItemById(e,this.data,this.props.childrenField||m)}dispatchCheckChange(e,t,i){s.dispatchEvent(this.props.onCheckChange,e,this,{item:t,itemHierarchicalIndex:i})}dispatchExpandChange(e,t,i){s.dispatchEvent(this.props.onExpandChange,e,this,{item:t,itemHierarchicalIndex:i})}dispatchItemClick(e,t,i){s.dispatchEvent(this.props.onItemClick,e,this,{item:t,itemHierarchicalIndex:i})}refocusDueToFocusIdField(){if(this.fieldsSvc&&this.fieldsSvc.focusIdField){const e=this.state.focusedItemPublicId;if(e){const t=this.props.getFocusHierarchicalIndex?this.props.getFocusHierarchicalIndex(e):s.resolveItemId(e,this.fieldsSvc.focusIdField,this.data,this.props.childrenField);t!==this.state.focusedItemId&&(this.allowExplicitFocus=!0,this.setState({focusedItemId:t}))}}}get ariaMultiSelectable(){return!0===this.props["aria-multiselectable"]||"true"===this.props["aria-multiselectable"]}get data(){return this.props.data||[]}focusDomItem(e){e.focus()}get guid(){return this.treeGuid}};D.propTypes={data:i.arrayOf(i.any),animate:i.bool,tabIndex:i.number,focusIdField:i.string,getHierarchicalIndexById:i.func,onExpandChange:i.func,onItemClick:i.func,expandField:i.string,selectField:i.string,iconField:i.string,childrenField:i.string,hasChildrenField:i.string,textField:i.string,disableField:i.string,item:i.any,"aria-multiselectable":(e,t,i)=>void 0!==e[t]&&!0!==e[t]&&!1!==e[t]&&"true"!==e[t]&&"false"!==e[t]?new Error("Invalid prop `"+t+"` supplied to `"+i+"`. Validation failed."):null,"aria-label":i.string,"aria-labelledby":i.string,size:i.oneOf([null,"small","medium","large"]),dir:i.string},D.defaultProps={animate:!0,expandField:p,selectField:u,iconField:"svgIcon",hasChildrenField:"hasChildren",childrenField:m,textField:"text",disableField:"disabled",checkField:I,checkIndeterminateField:g,size:"medium"};let S=D;function w(e,t,i,n,r){if(i){const{ids:d,field:a}=N(i,t);return function(e,t,i,n,r){let d=e;return t.forEach((e=>{d=s.updateItem(d,e,(e=>P(i,e)),n,r)})),d}(e,!s.isArray(i)&&i.idField?s.resolveItemsIds(d,i.idField,e,r):d,a,n,r)}return e}function N(e,t){let i,n;return s.isArray(e)?(i=e,n=t):(i=e.ids||[],n=e.operationField||t),{ids:i,field:n}}function P(e,t){const i=(e||"").split(".");let s=t;for(let e=0;e<i.length;e++){const t=i[e];if(e===i.length-1)s[t]=!0;else{if(void 0===s[t])return;s[t]={...s[t]},s=s[t]}}}function U(e,t,i,n,r){let d=!1;for(let a=0;a<e.length;a++){const o=e[a];if(s.getNestedValue(n,o)){if(!d)for(let e=0;e<t.length;e++)P(r,t[e]);d=!0,o[i]&&U(o[i],[],i,n,r)}else o[i]&&U(o[i],d?[o]:t.concat([o]),i,n,r)}}const R=class extends a.PureComponent{constructor(){super(...arguments),this.state={visible:!1,top:0,left:0,text:"",operationClassName:"cancel"}}render(){const e={top:this.state.top+"px",left:this.state.left+"px"};return this.state.visible&&a.createElement("div",{className:"k-header k-drag-clue",style:{...this.props.style,...e}},a.createElement(s.IconWrap,{className:s.classNames("k-drag-status"),name:this.state.operationClassName&&s.toIconName(this.state.operationClassName),icon:"k-i-plus"===this.state.operationClassName?n.plusIcon:"k-i-insert-up"===this.state.operationClassName?n.insertTopIcon:"k-i-insert-down"===this.state.operationClassName?n.insertBottomIcon:"k-i-insert-middle"===this.state.operationClassName?n.insertMiddleIcon:n.cancelIcon}),this.state.text)}show(e,t,i,s){this.setState({visible:!0,top:e,left:t,text:i,operationClassName:s})}hide(){this.setState({visible:!1})}};R.defaultProps={style:{display:"block",position:"absolute",zIndex:2e4,padding:"4px 6px"}};let T=R;const O=s.withIdHOC(S);O.displayName="KendoReactTreeView",Object.defineProperty(e,"FieldsService",{enumerable:!0,get:function(){return s.TreeFieldsService}}),e.TreeView=O,e.TreeViewClassComponent=S,e.TreeViewDragAnalyzer=class{constructor(e){this.event=e,this.initialized=!1,this.destItemId="",this.destTreeViewGuid="",this.itemId=e.itemHierarchicalIndex,this.treeViewGuid=e.target.guid}init(){return this.initialized||(this.setDestimationMeta(document.elementFromPoint(this.event.clientX,this.event.clientY)),this.initialized=!0),this}get isDropAllowed(){return!!(this.initialized&&this.destItemId&&this.destTreeViewGuid)&&!`${this.destTreeViewGuid}_${this.destItemId}_`.startsWith(`${this.treeViewGuid}_${this.itemId}_`)}get destinationMeta(){return{itemHierarchicalIndex:this.destItemId,treeViewGuid:this.destTreeViewGuid}}getDropOperation(){if(this.initialized&&this.isDropAllowed){const{top:e,height:t}=this.destDomNodeWithMeta.getBoundingClientRect();return e+t-this.event.clientY<6?"after":this.event.clientY-e<6?"before":"child"}}setDestimationMeta(e){let t=e;for(;t&&!t[f];)t=t.parentNode;t&&t[f]&&(this.destDomNodeWithMeta=t,this.destItemId=t[f],this.destTreeViewGuid=t[b])}},e.TreeViewDragClue=T,e.TreeViewItemPropsContext=C,e.getItemIdUponKeyboardNavigation=o,e.handleTreeViewCheckChange=function(e,t,i,n={},r){if(!i||!i.length)return[];const{ids:d,idField:a}=function(e){let t,i;return s.isArray(e)?t=e:(t=e.ids||[],i=e.idField),{ids:t,idField:i}}(t),o=a?s.getNestedValue(a,e.item):e.itemHierarchicalIndex,l=d.indexOf(o),c=-1===l,h=r||m;let p;return n.singleMode?p=c?[o]:[]:(p=d.slice(),c?p.push(o):p.splice(l,1),n.checkChildren&&function(e,t,i,n,r,d){s.getAllDirectIndirectChildrenIds(e,t,r,n).forEach((e=>{i&&-1===d.indexOf(e)?d.push(e):!i&&d.indexOf(e)>-1&&d.splice(d.indexOf(e),1)}))}(e.item,e.itemHierarchicalIndex,c,a,h,p),n.checkParents&&function(e,t,i,n,r,d){const a=h();let o=a.next();function l(){for(;!o.done;){const{id:e,item:t}=o.value;if(-1!==r.indexOf(e)||!s.areAllDirectChildrenChecked(t,e,i,n,r))break;r.push(e),o=a.next()}}function c(){for(;!o.done;){const{id:e}=o.value,t=r.indexOf(e);if(!(t>-1))break;r.splice(t,1),o=a.next()}}function*h(){if(i){const r=s.getAllParents(e,n,d);for(let e=r.length-1;e>-1;e--)yield{id:s.getNestedValue(i,r[e]),item:t?r[e]:void 0}}else{let i=s.treeIdUtils.getDirectParentId(e);for(;i;)yield{id:i,item:t?s.treeIdUtils.getItemById(i,d,n):void 0},i=s.treeIdUtils.getDirectParentId(i)}}t?l():c()}(e.itemHierarchicalIndex,c,a,h,p,i)),s.isArray(t)?p:Object.assign({},t,{ids:p})},e.moveTreeViewItem=function(e,t,i,n,r,d){const a=d||m;if(!function(){if(!t||!t.length||!e||!n||r&&!r.length)return!1;const i=r&&r!==t?r:t;return!!s.treeIdUtils.getItemById(n,i,a)}())return l();const o=s.treeIdUtils.getItemById(e,t,a);if(!o)return l();if(!r||r===t){if(`${n}_`.startsWith(`${e}_`))return l();const d=s.removeItem(e,a,t),c=s.addItem(o,i,a,s.treeIdUtils.getDecrementedItemIdAfterRemoval(e,n),d);return r?{sourceData:c,targetData:c}:c}return{sourceData:s.removeItem(e,a,t),targetData:s.addItem(o,i,a,n,r)};function l(){return r?{sourceData:t,targetData:r}:t}},e.processTreeViewItems=function(e,t){if(!e||!e.length)return[];let i=e;const n=t.cloneField||"cloned",r=t.expandField||p,d=t.selectField||u,a=t.checkField||I,o=t.childrenField||m;return i=w(i,r,t.expand,n,o),i=w(i,d,t.select,n,o),i=w(i,a,t.check,n,o),function(e,t,i){if(i&&!s.isArray(i)&&i.applyCheckIndeterminate){const{field:n}=N(i,I),r=i.checkIndeterminateField||g;for(let i=0;i<e.length;i++){const d=e[i],a=d[t];a&&U(a,s.getNestedValue(n,d)?[]:[d],t,n,r)}}}(i,o,t.check),i}}));
package/index.d.mts CHANGED
@@ -996,107 +996,243 @@ export declare interface TreeViewOperationDescriptors {
996
996
  */
997
997
  export declare interface TreeViewProps {
998
998
  /**
999
- * Sets a class of the TreeView DOM element.
999
+ * Adds a custom CSS class to the TreeView container element.
1000
+ *
1001
+ * Example:
1002
+ * ```jsx
1003
+ * <TreeView className="custom-treeview-class" />
1004
+ * ```
1000
1005
  */
1001
1006
  className?: string;
1002
1007
  /**
1003
- * Sets an `id` of the TreeView DOM element.
1008
+ * Specifies the `id` attribute of the TreeView container element.
1009
+ *
1010
+ * Example:
1011
+ * ```jsx
1012
+ * <TreeView id="treeview-component" />
1013
+ * ```
1004
1014
  */
1005
1015
  id?: string;
1006
1016
  /**
1007
- * Sets the `style`attribute of the TreeView DOM element.
1017
+ * Sets the inline styles for the TreeView container element.
1018
+ *
1019
+ * Example:
1020
+ * ```jsx
1021
+ * <TreeView style={{ width: '300px', height: '400px' }} />
1022
+ * ```
1008
1023
  */
1009
1024
  style?: CSSProperties;
1010
1025
  /**
1011
- * Sets the data of the TreeView ([more information and examples]({% slug databinding_treeview %})).
1026
+ * Provides the hierarchical data to be displayed in the TreeView.
1027
+ *
1028
+ * Example:
1029
+ * ```jsx
1030
+ * <TreeView data={[{ text: 'Item 1', items: [{ text: 'Sub-item 1' }] }]} />
1031
+ * ```
1012
1032
  */
1013
1033
  data?: any[] | null;
1014
1034
  /**
1015
- * Controls the animation. By default, the expand and collapse animations are enabled.
1035
+ * Enables or disables the expand and collapse animations.
1036
+ *
1037
+ * Example:
1038
+ * ```jsx
1039
+ * <TreeView animate={false} />
1040
+ * ```
1016
1041
  */
1017
1042
  animate?: boolean;
1018
1043
  /**
1019
- * Sets a tabIndex of the TreeView DOM element.
1044
+ * Specifies the `tabIndex` attribute of the TreeView container element.
1045
+ *
1046
+ * Example:
1047
+ * ```jsx
1048
+ * <TreeView tabIndex={0} />
1049
+ * ```
1020
1050
  */
1021
1051
  tabIndex?: number;
1022
1052
  /**
1023
- * The TreeView has a built-in implementation of focusing and keyboard navigation. By default, the component uses hierarchical indices to uniquely match the focused item. You can use the `focusIdField` prop for specifying the name of the field which will uniquely describe an item as an alternative to its hierarchical index ([see example]({% slug datareload_treeview %}#toc-using-item-ids)).
1053
+ * The TreeView has a built-in implementation of focusing and keyboard navigation. By default, the component uses
1054
+ * hierarchical indices to uniquely match the focused item. You can use the `focusIdField` prop for specifying the
1055
+ * name of the field which will uniquely describe an
1056
+ * item as an alternative to its hierarchical index ([see example]({% slug datareload_treeview %}#toc-using-item-ids)).
1057
+ *
1058
+ * Example:
1059
+ * ```jsx
1060
+ * <TreeView focusIdField="id" />
1061
+ * ```
1024
1062
  */
1025
1063
  focusIdField?: string;
1026
1064
  /**
1027
- * When `focusIdField` is set, the TreeView executes a depth-first search on the data to find the currently focused item. The `getFocusHierarchicalIndex` prop specifies the function that will be used as an alternative to the default search algorithm.
1065
+ * When `focusIdField` is set, the TreeView executes a depth-first search on the data to find the currently focused item.
1066
+ * The `getFocusHierarchicalIndex` prop specifies the function that will be used as an alternative to the default search algorithm.
1067
+ *
1068
+ * Example:
1069
+ * ```jsx
1070
+ * <TreeView getFocusHierarchicalIndex={(id) => `custom-index-${id}`} />
1071
+ * ```
1028
1072
  */
1029
1073
  getFocusHierarchicalIndex?: (itemId: any) => string | undefined;
1030
1074
  /**
1031
1075
  * Controls the rendering of the expand (collapse) icons. By default, the icons are not rendered ([see example]({% slug expansion_ways_treeview %})).
1076
+ *
1077
+ * Example:
1078
+ * ```jsx
1079
+ * <TreeView expandIcons={true} />
1080
+ * ```
1032
1081
  */
1033
1082
  expandIcons?: boolean;
1034
1083
  /**
1035
- * Fires when the expanding or collapsing of an item is requested ([see example]({% slug expansion_ways_treeview %})).
1084
+ * Triggered when an item is expanded or collapsed.
1085
+ *
1086
+ * Example:
1087
+ * ```jsx
1088
+ * <TreeView onExpandChange={(event) => console.log(event.item)} />
1089
+ * ```
1036
1090
  */
1037
1091
  onExpandChange?: (event: events.TreeViewExpandChangeEvent) => void;
1038
1092
  /**
1039
1093
  * Fires when an item is clicked or when `Enter` is pressed on a focused item ([see example]({% slug selection_ways_treeview %})).
1094
+ *
1095
+ * Example:
1096
+ * ```jsx
1097
+ * <TreeView onItemClick={(event) => console.log(event.item)} />
1098
+ * ```
1040
1099
  */
1041
1100
  onItemClick?: (event: events.TreeViewItemClickEvent) => void;
1042
1101
  /**
1043
1102
  * Specifies the name of the field which will provide a Boolean representation for the expanded state of the item. Defaults to `expanded`.
1103
+ *
1104
+ * Example:
1105
+ * ```jsx
1106
+ * <TreeView expandField="isExpanded" />
1107
+ * ```
1044
1108
  */
1045
1109
  expandField?: string;
1046
1110
  /**
1047
1111
  * Specifies the name of the field which will provide a Boolean representation for the selected state of the item. Defaults to `selected`.
1112
+ *
1113
+ * Example:
1114
+ * ```jsx
1115
+ * <TreeView selectField="isSelected" />
1116
+ * ```
1048
1117
  */
1049
1118
  selectField?: string;
1050
1119
  /**
1051
1120
  * Specifies the name of the field which will provide an icon for the specific TreeView item. Defaults to `svgIcon`.
1121
+ *
1122
+ * Example:
1123
+ * ```jsx
1124
+ * <TreeView iconField="icon" />
1125
+ * ```
1052
1126
  */
1053
1127
  iconField?: string;
1054
1128
  /**
1055
1129
  * Specifies the name of the field which indicates to the TreeView that an item has children even if the children are not initially passed. Used for implementing the load-on-demand feature ([see example]({% slug databinding_treeview %}#toc-loading-data-on-demand)). Defaults to `hasChildren`.
1130
+ *
1131
+ * Example:
1132
+ * ```jsx
1133
+ * <TreeView hasChildrenField="hasSubItems" />
1134
+ * ```
1056
1135
  */
1057
1136
  hasChildrenField?: string;
1058
1137
  /**
1059
1138
  * Specifies the name of the field which will provide an array representation of the item children.
1139
+ *
1140
+ * Example:
1141
+ * ```jsx
1142
+ * <TreeView childrenField="subItems" />
1143
+ * ```
1060
1144
  */
1061
1145
  childrenField?: string;
1062
1146
  /**
1063
1147
  * Specifies the name of the field which will provide a text representation for the item. Defaults to `text`.
1148
+ *
1149
+ * Example:
1150
+ * ```jsx
1151
+ * <TreeView textField="label" />
1152
+ * ```
1064
1153
  */
1065
1154
  textField?: string;
1066
1155
  /**
1067
1156
  * Specifies the name of the field which will provide a Boolean representation for the disabled state of the item. Defaults to `disabled`.
1157
+ *
1158
+ * Example:
1159
+ * ```jsx
1160
+ * <TreeView disableField="isDisabled" />
1161
+ * ```
1068
1162
  */
1069
1163
  disableField?: string;
1070
1164
  /**
1071
1165
  * Defines the component that will be used for rendering each of the TreeView items ([see example]({% slug rendering_treeview %})).
1166
+ *
1167
+ * Example:
1168
+ * ```jsx
1169
+ * <TreeView item={(props) => <CustomTreeViewItem {...props} />} />
1170
+ * ```
1072
1171
  */
1073
1172
  item?: ComponentType<ItemRenderProps>;
1074
1173
  /**
1075
- * Indicates that the user can select more than one TreeView items. If the TreeView is in a multiple selection mode, set the `aria-multiselectable` prop to `true` ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
1174
+ * Indicates that the user can select more than one TreeView items.
1175
+ * If the TreeView is in a multiple selection mode, set the `aria-multiselectable`
1176
+ * prop to `true` ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
1177
+ *
1178
+ * Example:
1179
+ * ```jsx
1180
+ * <TreeView aria-multiselectable={true} />
1181
+ * ```
1076
1182
  */
1077
1183
  'aria-multiselectable'?: boolean | 'false' | 'true';
1078
1184
  /**
1079
1185
  * Defines a string value that labels the TreeView ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
1186
+ *
1187
+ * Example:
1188
+ * ```jsx
1189
+ * <TreeView aria-label="TreeView Label" />
1190
+ * ```
1080
1191
  */
1081
1192
  'aria-label'?: string;
1082
1193
  /**
1083
1194
  * Identifies the element or elements which will label the TreeView ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
1195
+ *
1196
+ * Example:
1197
+ * ```jsx
1198
+ * <TreeView aria-labelledby="treeview-label" />
1199
+ * ```
1084
1200
  */
1085
1201
  'aria-labelledby'?: string;
1086
1202
  /**
1087
1203
  * Controls the rendering of checkboxes. By default, the checkboxes are not rendered.
1204
+ *
1205
+ * Example:
1206
+ * ```jsx
1207
+ * <TreeView checkboxes={true} />
1208
+ * ```
1088
1209
  */
1089
1210
  checkboxes?: boolean;
1090
1211
  /**
1091
1212
  * Specifies the name of the field which will provide a Boolean representation for the checked state of the item. Defaults to `checked`.
1213
+ *
1214
+ * Example:
1215
+ * ```jsx
1216
+ * <TreeView checkField="isChecked" />
1217
+ * ```
1092
1218
  */
1093
1219
  checkField?: string;
1094
1220
  /**
1095
1221
  * Specifies the name of the field which will provide a Boolean representation for the check indeterminate state of the item. Defaults to `checkIndeterminate`.
1222
+ *
1223
+ * Example:
1224
+ * ```jsx
1225
+ * <TreeView checkIndeterminateField="isPartiallyChecked" />
1226
+ * ```
1096
1227
  */
1097
1228
  checkIndeterminateField?: string;
1098
1229
  /**
1099
1230
  * Fires when a checkbox is clicked or when `Space` is pressed on a focused item.
1231
+ *
1232
+ * Example:
1233
+ * ```jsx
1234
+ * <TreeView onCheckChange={(event) => console.log(event.item)} />
1235
+ * ```
1100
1236
  */
1101
1237
  onCheckChange?: (event: events.TreeViewCheckChangeEvent) => void;
1102
1238
  /**
@@ -1105,14 +1241,29 @@ export declare interface TreeViewProps {
1105
1241
  draggable?: boolean;
1106
1242
  /**
1107
1243
  * Fires when the dragging of an item has started.
1244
+ *
1245
+ * Example:
1246
+ * ```jsx
1247
+ * <TreeView onItemDragStart={(event) => console.log(event.item)} />
1248
+ * ```
1108
1249
  */
1109
1250
  onItemDragStart?: (event: events.TreeViewItemDragStartEvent) => void;
1110
1251
  /**
1111
1252
  * Fires when a dragged item changes its position ([see example]({% slug dragdrop_treeview %})).
1253
+ *
1254
+ * Example:
1255
+ * ```jsx
1256
+ * <TreeView onItemDragOver={(event) => console.log(event.item)} />
1257
+ * ```
1112
1258
  */
1113
1259
  onItemDragOver?: (event: events.TreeViewItemDragOverEvent) => void;
1114
1260
  /**
1115
1261
  * Fires when a dragged item is dropped ([see example]({% slug dragdrop_treeview %})).
1262
+ *
1263
+ * Example:
1264
+ * ```jsx
1265
+ * <TreeView onItemDragEnd={(event) => console.log(event.item)} />
1266
+ * ```
1116
1267
  */
1117
1268
  onItemDragEnd?: (event: events.TreeViewItemDragEndEvent) => void;
1118
1269
  /**
@@ -1125,14 +1276,29 @@ export declare interface TreeViewProps {
1125
1276
  * - null&mdash;Does not set a size `className`.
1126
1277
  *
1127
1278
  * @default `medium`
1279
+ *
1280
+ * Example:
1281
+ * ```jsx
1282
+ * <TreeView size="large" />
1283
+ * ```
1128
1284
  */
1129
1285
  size?: null | 'small' | 'medium' | 'large';
1130
1286
  /**
1131
1287
  * Sets the direction of the component.
1288
+ *
1289
+ * Example:
1290
+ * ```jsx
1291
+ * <TreeView dir="rtl" />
1292
+ * ```
1132
1293
  */
1133
1294
  dir?: string;
1134
1295
  /**
1135
1296
  * The event that is fired when the ContextMenu is activated.
1297
+ *
1298
+ * Example:
1299
+ * ```jsx
1300
+ * <TreeView onContextMenu={(event) => console.log(event.item)} />
1301
+ * ```
1136
1302
  */
1137
1303
  onContextMenu?: (event: TreeViewContextMenuEvent) => void;
1138
1304
  }
package/index.d.ts CHANGED
@@ -996,107 +996,243 @@ export declare interface TreeViewOperationDescriptors {
996
996
  */
997
997
  export declare interface TreeViewProps {
998
998
  /**
999
- * Sets a class of the TreeView DOM element.
999
+ * Adds a custom CSS class to the TreeView container element.
1000
+ *
1001
+ * Example:
1002
+ * ```jsx
1003
+ * <TreeView className="custom-treeview-class" />
1004
+ * ```
1000
1005
  */
1001
1006
  className?: string;
1002
1007
  /**
1003
- * Sets an `id` of the TreeView DOM element.
1008
+ * Specifies the `id` attribute of the TreeView container element.
1009
+ *
1010
+ * Example:
1011
+ * ```jsx
1012
+ * <TreeView id="treeview-component" />
1013
+ * ```
1004
1014
  */
1005
1015
  id?: string;
1006
1016
  /**
1007
- * Sets the `style`attribute of the TreeView DOM element.
1017
+ * Sets the inline styles for the TreeView container element.
1018
+ *
1019
+ * Example:
1020
+ * ```jsx
1021
+ * <TreeView style={{ width: '300px', height: '400px' }} />
1022
+ * ```
1008
1023
  */
1009
1024
  style?: CSSProperties;
1010
1025
  /**
1011
- * Sets the data of the TreeView ([more information and examples]({% slug databinding_treeview %})).
1026
+ * Provides the hierarchical data to be displayed in the TreeView.
1027
+ *
1028
+ * Example:
1029
+ * ```jsx
1030
+ * <TreeView data={[{ text: 'Item 1', items: [{ text: 'Sub-item 1' }] }]} />
1031
+ * ```
1012
1032
  */
1013
1033
  data?: any[] | null;
1014
1034
  /**
1015
- * Controls the animation. By default, the expand and collapse animations are enabled.
1035
+ * Enables or disables the expand and collapse animations.
1036
+ *
1037
+ * Example:
1038
+ * ```jsx
1039
+ * <TreeView animate={false} />
1040
+ * ```
1016
1041
  */
1017
1042
  animate?: boolean;
1018
1043
  /**
1019
- * Sets a tabIndex of the TreeView DOM element.
1044
+ * Specifies the `tabIndex` attribute of the TreeView container element.
1045
+ *
1046
+ * Example:
1047
+ * ```jsx
1048
+ * <TreeView tabIndex={0} />
1049
+ * ```
1020
1050
  */
1021
1051
  tabIndex?: number;
1022
1052
  /**
1023
- * The TreeView has a built-in implementation of focusing and keyboard navigation. By default, the component uses hierarchical indices to uniquely match the focused item. You can use the `focusIdField` prop for specifying the name of the field which will uniquely describe an item as an alternative to its hierarchical index ([see example]({% slug datareload_treeview %}#toc-using-item-ids)).
1053
+ * The TreeView has a built-in implementation of focusing and keyboard navigation. By default, the component uses
1054
+ * hierarchical indices to uniquely match the focused item. You can use the `focusIdField` prop for specifying the
1055
+ * name of the field which will uniquely describe an
1056
+ * item as an alternative to its hierarchical index ([see example]({% slug datareload_treeview %}#toc-using-item-ids)).
1057
+ *
1058
+ * Example:
1059
+ * ```jsx
1060
+ * <TreeView focusIdField="id" />
1061
+ * ```
1024
1062
  */
1025
1063
  focusIdField?: string;
1026
1064
  /**
1027
- * When `focusIdField` is set, the TreeView executes a depth-first search on the data to find the currently focused item. The `getFocusHierarchicalIndex` prop specifies the function that will be used as an alternative to the default search algorithm.
1065
+ * When `focusIdField` is set, the TreeView executes a depth-first search on the data to find the currently focused item.
1066
+ * The `getFocusHierarchicalIndex` prop specifies the function that will be used as an alternative to the default search algorithm.
1067
+ *
1068
+ * Example:
1069
+ * ```jsx
1070
+ * <TreeView getFocusHierarchicalIndex={(id) => `custom-index-${id}`} />
1071
+ * ```
1028
1072
  */
1029
1073
  getFocusHierarchicalIndex?: (itemId: any) => string | undefined;
1030
1074
  /**
1031
1075
  * Controls the rendering of the expand (collapse) icons. By default, the icons are not rendered ([see example]({% slug expansion_ways_treeview %})).
1076
+ *
1077
+ * Example:
1078
+ * ```jsx
1079
+ * <TreeView expandIcons={true} />
1080
+ * ```
1032
1081
  */
1033
1082
  expandIcons?: boolean;
1034
1083
  /**
1035
- * Fires when the expanding or collapsing of an item is requested ([see example]({% slug expansion_ways_treeview %})).
1084
+ * Triggered when an item is expanded or collapsed.
1085
+ *
1086
+ * Example:
1087
+ * ```jsx
1088
+ * <TreeView onExpandChange={(event) => console.log(event.item)} />
1089
+ * ```
1036
1090
  */
1037
1091
  onExpandChange?: (event: events.TreeViewExpandChangeEvent) => void;
1038
1092
  /**
1039
1093
  * Fires when an item is clicked or when `Enter` is pressed on a focused item ([see example]({% slug selection_ways_treeview %})).
1094
+ *
1095
+ * Example:
1096
+ * ```jsx
1097
+ * <TreeView onItemClick={(event) => console.log(event.item)} />
1098
+ * ```
1040
1099
  */
1041
1100
  onItemClick?: (event: events.TreeViewItemClickEvent) => void;
1042
1101
  /**
1043
1102
  * Specifies the name of the field which will provide a Boolean representation for the expanded state of the item. Defaults to `expanded`.
1103
+ *
1104
+ * Example:
1105
+ * ```jsx
1106
+ * <TreeView expandField="isExpanded" />
1107
+ * ```
1044
1108
  */
1045
1109
  expandField?: string;
1046
1110
  /**
1047
1111
  * Specifies the name of the field which will provide a Boolean representation for the selected state of the item. Defaults to `selected`.
1112
+ *
1113
+ * Example:
1114
+ * ```jsx
1115
+ * <TreeView selectField="isSelected" />
1116
+ * ```
1048
1117
  */
1049
1118
  selectField?: string;
1050
1119
  /**
1051
1120
  * Specifies the name of the field which will provide an icon for the specific TreeView item. Defaults to `svgIcon`.
1121
+ *
1122
+ * Example:
1123
+ * ```jsx
1124
+ * <TreeView iconField="icon" />
1125
+ * ```
1052
1126
  */
1053
1127
  iconField?: string;
1054
1128
  /**
1055
1129
  * Specifies the name of the field which indicates to the TreeView that an item has children even if the children are not initially passed. Used for implementing the load-on-demand feature ([see example]({% slug databinding_treeview %}#toc-loading-data-on-demand)). Defaults to `hasChildren`.
1130
+ *
1131
+ * Example:
1132
+ * ```jsx
1133
+ * <TreeView hasChildrenField="hasSubItems" />
1134
+ * ```
1056
1135
  */
1057
1136
  hasChildrenField?: string;
1058
1137
  /**
1059
1138
  * Specifies the name of the field which will provide an array representation of the item children.
1139
+ *
1140
+ * Example:
1141
+ * ```jsx
1142
+ * <TreeView childrenField="subItems" />
1143
+ * ```
1060
1144
  */
1061
1145
  childrenField?: string;
1062
1146
  /**
1063
1147
  * Specifies the name of the field which will provide a text representation for the item. Defaults to `text`.
1148
+ *
1149
+ * Example:
1150
+ * ```jsx
1151
+ * <TreeView textField="label" />
1152
+ * ```
1064
1153
  */
1065
1154
  textField?: string;
1066
1155
  /**
1067
1156
  * Specifies the name of the field which will provide a Boolean representation for the disabled state of the item. Defaults to `disabled`.
1157
+ *
1158
+ * Example:
1159
+ * ```jsx
1160
+ * <TreeView disableField="isDisabled" />
1161
+ * ```
1068
1162
  */
1069
1163
  disableField?: string;
1070
1164
  /**
1071
1165
  * Defines the component that will be used for rendering each of the TreeView items ([see example]({% slug rendering_treeview %})).
1166
+ *
1167
+ * Example:
1168
+ * ```jsx
1169
+ * <TreeView item={(props) => <CustomTreeViewItem {...props} />} />
1170
+ * ```
1072
1171
  */
1073
1172
  item?: ComponentType<ItemRenderProps>;
1074
1173
  /**
1075
- * Indicates that the user can select more than one TreeView items. If the TreeView is in a multiple selection mode, set the `aria-multiselectable` prop to `true` ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
1174
+ * Indicates that the user can select more than one TreeView items.
1175
+ * If the TreeView is in a multiple selection mode, set the `aria-multiselectable`
1176
+ * prop to `true` ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
1177
+ *
1178
+ * Example:
1179
+ * ```jsx
1180
+ * <TreeView aria-multiselectable={true} />
1181
+ * ```
1076
1182
  */
1077
1183
  'aria-multiselectable'?: boolean | 'false' | 'true';
1078
1184
  /**
1079
1185
  * Defines a string value that labels the TreeView ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
1186
+ *
1187
+ * Example:
1188
+ * ```jsx
1189
+ * <TreeView aria-label="TreeView Label" />
1190
+ * ```
1080
1191
  */
1081
1192
  'aria-label'?: string;
1082
1193
  /**
1083
1194
  * Identifies the element or elements which will label the TreeView ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
1195
+ *
1196
+ * Example:
1197
+ * ```jsx
1198
+ * <TreeView aria-labelledby="treeview-label" />
1199
+ * ```
1084
1200
  */
1085
1201
  'aria-labelledby'?: string;
1086
1202
  /**
1087
1203
  * Controls the rendering of checkboxes. By default, the checkboxes are not rendered.
1204
+ *
1205
+ * Example:
1206
+ * ```jsx
1207
+ * <TreeView checkboxes={true} />
1208
+ * ```
1088
1209
  */
1089
1210
  checkboxes?: boolean;
1090
1211
  /**
1091
1212
  * Specifies the name of the field which will provide a Boolean representation for the checked state of the item. Defaults to `checked`.
1213
+ *
1214
+ * Example:
1215
+ * ```jsx
1216
+ * <TreeView checkField="isChecked" />
1217
+ * ```
1092
1218
  */
1093
1219
  checkField?: string;
1094
1220
  /**
1095
1221
  * Specifies the name of the field which will provide a Boolean representation for the check indeterminate state of the item. Defaults to `checkIndeterminate`.
1222
+ *
1223
+ * Example:
1224
+ * ```jsx
1225
+ * <TreeView checkIndeterminateField="isPartiallyChecked" />
1226
+ * ```
1096
1227
  */
1097
1228
  checkIndeterminateField?: string;
1098
1229
  /**
1099
1230
  * Fires when a checkbox is clicked or when `Space` is pressed on a focused item.
1231
+ *
1232
+ * Example:
1233
+ * ```jsx
1234
+ * <TreeView onCheckChange={(event) => console.log(event.item)} />
1235
+ * ```
1100
1236
  */
1101
1237
  onCheckChange?: (event: events.TreeViewCheckChangeEvent) => void;
1102
1238
  /**
@@ -1105,14 +1241,29 @@ export declare interface TreeViewProps {
1105
1241
  draggable?: boolean;
1106
1242
  /**
1107
1243
  * Fires when the dragging of an item has started.
1244
+ *
1245
+ * Example:
1246
+ * ```jsx
1247
+ * <TreeView onItemDragStart={(event) => console.log(event.item)} />
1248
+ * ```
1108
1249
  */
1109
1250
  onItemDragStart?: (event: events.TreeViewItemDragStartEvent) => void;
1110
1251
  /**
1111
1252
  * Fires when a dragged item changes its position ([see example]({% slug dragdrop_treeview %})).
1253
+ *
1254
+ * Example:
1255
+ * ```jsx
1256
+ * <TreeView onItemDragOver={(event) => console.log(event.item)} />
1257
+ * ```
1112
1258
  */
1113
1259
  onItemDragOver?: (event: events.TreeViewItemDragOverEvent) => void;
1114
1260
  /**
1115
1261
  * Fires when a dragged item is dropped ([see example]({% slug dragdrop_treeview %})).
1262
+ *
1263
+ * Example:
1264
+ * ```jsx
1265
+ * <TreeView onItemDragEnd={(event) => console.log(event.item)} />
1266
+ * ```
1116
1267
  */
1117
1268
  onItemDragEnd?: (event: events.TreeViewItemDragEndEvent) => void;
1118
1269
  /**
@@ -1125,14 +1276,29 @@ export declare interface TreeViewProps {
1125
1276
  * - null&mdash;Does not set a size `className`.
1126
1277
  *
1127
1278
  * @default `medium`
1279
+ *
1280
+ * Example:
1281
+ * ```jsx
1282
+ * <TreeView size="large" />
1283
+ * ```
1128
1284
  */
1129
1285
  size?: null | 'small' | 'medium' | 'large';
1130
1286
  /**
1131
1287
  * Sets the direction of the component.
1288
+ *
1289
+ * Example:
1290
+ * ```jsx
1291
+ * <TreeView dir="rtl" />
1292
+ * ```
1132
1293
  */
1133
1294
  dir?: string;
1134
1295
  /**
1135
1296
  * The event that is fired when the ContextMenu is activated.
1297
+ *
1298
+ * Example:
1299
+ * ```jsx
1300
+ * <TreeView onContextMenu={(event) => console.log(event.item)} />
1301
+ * ```
1136
1302
  */
1137
1303
  onContextMenu?: (event: TreeViewContextMenuEvent) => void;
1138
1304
  }
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-treeview",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1744621495,version:"10.2.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-treeview",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1744785678,version:"10.2.0-develop.7",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
@@ -10,8 +10,8 @@ const e = {
10
10
  productName: "KendoReact",
11
11
  productCode: "KENDOUIREACT",
12
12
  productCodes: ["KENDOUIREACT"],
13
- publishDate: 1744621495,
14
- version: "10.2.0-develop.6",
13
+ publishDate: 1744785678,
14
+ version: "10.2.0-develop.7",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
16
16
  };
17
17
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-treeview",
3
- "version": "10.2.0-develop.6",
3
+ "version": "10.2.0-develop.7",
4
4
  "description": "React TreeView displays hierarchical data in a traditional tree structure, supports user interaction. KendoReact TreeView package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -26,8 +26,8 @@
26
26
  "sideEffects": false,
27
27
  "peerDependencies": {
28
28
  "@progress/kendo-licensing": "^1.5.1",
29
- "@progress/kendo-react-animation": "10.2.0-develop.6",
30
- "@progress/kendo-react-common": "10.2.0-develop.6",
29
+ "@progress/kendo-react-animation": "10.2.0-develop.7",
30
+ "@progress/kendo-react-common": "10.2.0-develop.7",
31
31
  "@progress/kendo-svg-icons": "^4.0.0",
32
32
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
33
33
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
@@ -53,7 +53,7 @@
53
53
  "package": {
54
54
  "productName": "KendoReact",
55
55
  "productCode": "KENDOUIREACT",
56
- "publishDate": 1744621495,
56
+ "publishDate": 1744785678,
57
57
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
58
58
  }
59
59
  },