Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderTreeNode = (child, index, level = 0) => {
const {
keyEntities,
expandedKeys = [], selectedKeys = [], halfCheckedKeys = [],
loadedKeys = [], loadingKeys = [],
dragOverNodeKey, dropPosition,
} = this.data;
const pos = getPosition(level, index);
const key = child.key || pos;
if (!keyEntities[key]) {
warnOnlyTreeNode();
return null;
}
const r = omi.cloneElement(child, {
key,
eventKey: key,
expanded: expandedKeys.indexOf(key) !== -1,
selected: selectedKeys.indexOf(key) !== -1,
loaded: loadedKeys.indexOf(key) !== -1,
loading: loadingKeys.indexOf(key) !== -1,
checked: this.isKeyChecked(key),
halfChecked: halfCheckedKeys.indexOf(key) !== -1,
pos,
// [Legacy] Drag props
dragOver: dragOverNodeKey === key && dropPosition === 0,
dragOverGapTop: dragOverNodeKey === key && dropPosition === -1,
dragOverGapBottom: dragOverNodeKey === key && dropPosition === 1,
});
return r
render(props) {
var a = cloneElement(props.children[0], {
onTouchStart: this._handleTouchStart,
onTouchMove: this._handleTouchMove,
onTouchCancel: this._handleTouchCancel,
onTouchEnd: this._handleTouchEnd
})
return a
}
}