f612765fe681b4f449527143c9adfecf.json
122 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\"; // TODO: https://www.w3.org/TR/2017/NOTE-wai-aria-practices-1.1-20171214/examples/treeview/treeview-2/treeview-2a.html\n// Fully accessibility support\n\nimport * as React from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport warning from \"rc-util/es/warning\";\nimport classNames from 'classnames';\nimport { TreeContext } from './contextTypes';\nimport { getDataAndAria, getDragChildrenKeys, parseCheckedKeys, conductExpandParent, calcSelectedKeys, calcDropPosition, arrAdd, arrDel, posToArr } from './util';\nimport { flattenTreeData, convertTreeToData, convertDataToEntities, warningWithoutKey, convertNodePropsToEventData, getTreeNodeProps } from './utils/treeUtil';\nimport NodeList, { MOTION_KEY, MotionEntity } from './NodeList';\nimport TreeNode from './TreeNode';\nimport { conductCheck } from './utils/conductUtil';\nimport DropIndicator from './DropIndicator';\n\nvar Tree = /*#__PURE__*/function (_React$Component) {\n _inherits(Tree, _React$Component);\n\n var _super = _createSuper(Tree);\n\n function Tree() {\n var _this;\n\n _classCallCheck(this, Tree);\n\n _this = _super.apply(this, arguments);\n _this.destroyed = false;\n _this.state = {\n keyEntities: {},\n indent: null,\n selectedKeys: [],\n checkedKeys: [],\n halfCheckedKeys: [],\n loadedKeys: [],\n loadingKeys: [],\n expandedKeys: [],\n dragging: false,\n dragChildrenKeys: [],\n // dropTargetKey is the key of abstract-drop-node\n // the abstract-drop-node is the real drop node when drag and drop\n // not the DOM drag over node\n dropTargetKey: null,\n dropPosition: null,\n dropContainerKey: null,\n dropLevelOffset: null,\n dropTargetPos: null,\n dropAllowed: true,\n // the abstract-drag-over-node\n // if mouse is on the bottom of top dom node or no the top of the bottom dom node\n // abstract-drag-over-node is the top node\n dragOverNodeKey: null,\n treeData: [],\n flattenNodes: [],\n focused: false,\n activeKey: null,\n listChanging: false,\n prevProps: null\n };\n _this.dragStartMousePosition = null;\n _this.listRef = /*#__PURE__*/React.createRef();\n\n _this.onNodeDragStart = function (event, node) {\n var _this$state = _this.state,\n expandedKeys = _this$state.expandedKeys,\n keyEntities = _this$state.keyEntities;\n var onDragStart = _this.props.onDragStart;\n var eventKey = node.props.eventKey;\n _this.dragNode = node;\n _this.dragStartMousePosition = {\n x: event.clientX,\n y: event.clientY\n };\n var newExpandedKeys = arrDel(expandedKeys, eventKey);\n\n _this.setState({\n dragging: true,\n dragChildrenKeys: getDragChildrenKeys(eventKey, keyEntities),\n indent: _this.listRef.current.getIndentWidth()\n });\n\n _this.setExpandedKeys(newExpandedKeys);\n\n window.addEventListener('dragend', _this.onWindowDragEnd);\n\n if (onDragStart) {\n onDragStart({\n event: event,\n node: convertNodePropsToEventData(node.props)\n });\n }\n };\n /**\n * [Legacy] Select handler is smaller than node,\n * so that this will trigger when drag enter node or select handler.\n * This is a little tricky if customize css without padding.\n * Better for use mouse move event to refresh drag state.\n * But let's just keep it to avoid event trigger logic change.\n */\n\n\n _this.onNodeDragEnter = function (event, node) {\n var _this$state2 = _this.state,\n expandedKeys = _this$state2.expandedKeys,\n keyEntities = _this$state2.keyEntities,\n dragChildrenKeys = _this$state2.dragChildrenKeys,\n flattenNodes = _this$state2.flattenNodes,\n indent = _this$state2.indent;\n var _this$props = _this.props,\n onDragEnter = _this$props.onDragEnter,\n onExpand = _this$props.onExpand,\n allowDrop = _this$props.allowDrop,\n direction = _this$props.direction;\n var pos = node.props.pos;\n\n var _assertThisInitialize = _assertThisInitialized(_this),\n dragNode = _assertThisInitialize.dragNode;\n\n var _calcDropPosition = calcDropPosition(event, node, indent, _this.dragStartMousePosition, allowDrop, flattenNodes, keyEntities, expandedKeys, direction),\n dropPosition = _calcDropPosition.dropPosition,\n dropLevelOffset = _calcDropPosition.dropLevelOffset,\n dropTargetKey = _calcDropPosition.dropTargetKey,\n dropContainerKey = _calcDropPosition.dropContainerKey,\n dropTargetPos = _calcDropPosition.dropTargetPos,\n dropAllowed = _calcDropPosition.dropAllowed,\n dragOverNodeKey = _calcDropPosition.dragOverNodeKey;\n\n if (!dragNode || // don't allow drop inside its children\n dragChildrenKeys.indexOf(dropTargetKey) !== -1 || // don't allow drop when drop is not allowed caculated by calcDropPosition\n !dropAllowed) {\n _this.setState({\n dragOverNodeKey: null,\n dropPosition: null,\n dropLevelOffset: null,\n dropTargetKey: null,\n dropContainerKey: null,\n dropTargetPos: null,\n dropAllowed: false\n });\n\n return;\n } // Side effect for delay drag\n\n\n if (!_this.delayedDragEnterLogic) {\n _this.delayedDragEnterLogic = {};\n }\n\n Object.keys(_this.delayedDragEnterLogic).forEach(function (key) {\n clearTimeout(_this.delayedDragEnterLogic[key]);\n });\n\n if (dragNode.props.eventKey !== node.props.eventKey) {\n // hoist expand logic here\n // since if logic is on the bottom\n // it will be blocked by abstract dragover node check\n // => if you dragenter from top, you mouse will still be consider as in the top node\n event.persist();\n _this.delayedDragEnterLogic[pos] = window.setTimeout(function () {\n if (!_this.state.dragging) return;\n\n var newExpandedKeys = _toConsumableArray(expandedKeys);\n\n var entity = keyEntities[node.props.eventKey];\n\n if (entity && (entity.children || []).length) {\n newExpandedKeys = arrAdd(expandedKeys, node.props.eventKey);\n }\n\n if (!('expandedKeys' in _this.props)) {\n _this.setExpandedKeys(newExpandedKeys);\n }\n\n if (onExpand) {\n onExpand(newExpandedKeys, {\n node: convertNodePropsToEventData(node.props),\n expanded: true,\n nativeEvent: event.nativeEvent\n });\n }\n }, 800);\n } // Skip if drag node is self\n\n\n if (dragNode.props.eventKey === dropTargetKey && dropLevelOffset === 0) {\n _this.setState({\n dragOverNodeKey: null,\n dropPosition: null,\n dropLevelOffset: null,\n dropTargetKey: null,\n dropContainerKey: null,\n dropTargetPos: null,\n dropAllowed: false\n });\n\n return;\n } // Update drag over node and drag state\n\n\n _this.setState({\n dragOverNodeKey: dragOverNodeKey,\n dropPosition: dropPosition,\n dropLevelOffset: dropLevelOffset,\n dropTargetKey: dropTargetKey,\n dropContainerKey: dropContainerKey,\n dropTargetPos: dropTargetPos,\n dropAllowed: dropAllowed\n });\n\n if (onDragEnter) {\n onDragEnter({\n event: event,\n node: convertNodePropsToEventData(node.props),\n expandedKeys: expandedKeys\n });\n }\n };\n\n _this.onNodeDragOver = function (event, node) {\n var _this$state3 = _this.state,\n dragChildrenKeys = _this$state3.dragChildrenKeys,\n flattenNodes = _this$state3.flattenNodes,\n keyEntities = _this$state3.keyEntities,\n expandedKeys = _this$state3.expandedKeys,\n indent = _this$state3.indent;\n var _this$props2 = _this.props,\n onDragOver = _this$props2.onDragOver,\n allowDrop = _this$props2.allowDrop,\n direction = _this$props2.direction;\n\n var _assertThisInitialize2 = _assertThisInitialized(_this),\n dragNode = _assertThisInitialize2.dragNode;\n\n var _calcDropPosition2 = calcDropPosition(event, node, indent, _this.dragStartMousePosition, allowDrop, flattenNodes, keyEntities, expandedKeys, direction),\n dropPosition = _calcDropPosition2.dropPosition,\n dropLevelOffset = _calcDropPosition2.dropLevelOffset,\n dropTargetKey = _calcDropPosition2.dropTargetKey,\n dropContainerKey = _calcDropPosition2.dropContainerKey,\n dropAllowed = _calcDropPosition2.dropAllowed,\n dropTargetPos = _calcDropPosition2.dropTargetPos,\n dragOverNodeKey = _calcDropPosition2.dragOverNodeKey;\n\n if (!dragNode || dragChildrenKeys.indexOf(dropTargetKey) !== -1 || !dropAllowed) {\n // don't allow drop inside its children\n // don't allow drop when drop is not allowed caculated by calcDropPosition\n return;\n } // Update drag position\n\n\n if (dragNode.props.eventKey === dropTargetKey && dropLevelOffset === 0) {\n if (!(_this.state.dropPosition === null && _this.state.dropLevelOffset === null && _this.state.dropTargetKey === null && _this.state.dropContainerKey === null && _this.state.dropTargetPos === null && _this.state.dropAllowed === false && _this.state.dragOverNodeKey === null)) {\n _this.setState({\n dropPosition: null,\n dropLevelOffset: null,\n dropTargetKey: null,\n dropContainerKey: null,\n dropTargetPos: null,\n dropAllowed: false,\n dragOverNodeKey: null\n });\n }\n } else if (!(dropPosition === _this.state.dropPosition && dropLevelOffset === _this.state.dropLevelOffset && dropTargetKey === _this.state.dropTargetKey && dropContainerKey === _this.state.dropContainerKey && dropTargetPos === _this.state.dropTargetPos && dropAllowed === _this.state.dropAllowed && dragOverNodeKey === _this.state.dragOverNodeKey)) {\n _this.setState({\n dropPosition: dropPosition,\n dropLevelOffset: dropLevelOffset,\n dropTargetKey: dropTargetKey,\n dropContainerKey: dropContainerKey,\n dropTargetPos: dropTargetPos,\n dropAllowed: dropAllowed,\n dragOverNodeKey: dragOverNodeKey\n });\n }\n\n if (onDragOver) {\n onDragOver({\n event: event,\n node: convertNodePropsToEventData(node.props)\n });\n }\n };\n\n _this.onNodeDragLeave = function (event, node) {\n var onDragLeave = _this.props.onDragLeave;\n\n if (onDragLeave) {\n onDragLeave({\n event: event,\n node: convertNodePropsToEventData(node.props)\n });\n }\n }; // since stopPropagation() is called in treeNode\n // if onWindowDrag is called, whice means state is keeped, drag state should be cleared\n\n\n _this.onWindowDragEnd = function (event) {\n _this.onNodeDragEnd(event, null, true);\n\n window.removeEventListener('dragend', _this.onWindowDragEnd);\n }; // if onNodeDragEnd is called, onWindowDragEnd won't be called since stopPropagation() is called\n\n\n _this.onNodeDragEnd = function (event, node) {\n var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var onDragEnd = _this.props.onDragEnd;\n\n _this.setState({\n dragOverNodeKey: null\n });\n\n _this.cleanDragState();\n\n if (onDragEnd && !outsideTree) {\n onDragEnd({\n event: event,\n node: convertNodePropsToEventData(node.props)\n });\n }\n\n _this.dragNode = null;\n };\n\n _this.onNodeDrop = function (event, node) {\n var _this$getActiveItem;\n\n var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var _this$state4 = _this.state,\n dragChildrenKeys = _this$state4.dragChildrenKeys,\n dropPosition = _this$state4.dropPosition,\n dropTargetKey = _this$state4.dropTargetKey,\n dropTargetPos = _this$state4.dropTargetPos,\n dropAllowed = _this$state4.dropAllowed;\n if (!dropAllowed) return;\n var onDrop = _this.props.onDrop;\n\n _this.setState({\n dragOverNodeKey: null\n });\n\n _this.cleanDragState();\n\n if (dropTargetKey === null) return;\n\n var abstractDropNodeProps = _objectSpread(_objectSpread({}, getTreeNodeProps(dropTargetKey, _this.getTreeNodeRequiredProps())), {}, {\n active: ((_this$getActiveItem = _this.getActiveItem()) === null || _this$getActiveItem === void 0 ? void 0 : _this$getActiveItem.data.key) === dropTargetKey,\n data: _this.state.keyEntities[dropTargetKey].node\n });\n\n var dropToChild = dragChildrenKeys.indexOf(dropTargetKey) !== -1;\n warning(!dropToChild, \"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.\");\n var posArr = posToArr(dropTargetPos);\n var dropResult = {\n event: event,\n node: convertNodePropsToEventData(abstractDropNodeProps),\n dragNode: _this.dragNode ? convertNodePropsToEventData(_this.dragNode.props) : null,\n dragNodesKeys: [_this.dragNode.props.eventKey].concat(dragChildrenKeys),\n dropToGap: dropPosition !== 0,\n dropPosition: dropPosition + Number(posArr[posArr.length - 1])\n };\n\n if (onDrop && !outsideTree) {\n onDrop(dropResult);\n }\n\n _this.dragNode = null;\n };\n\n _this.cleanDragState = function () {\n var dragging = _this.state.dragging;\n\n if (dragging) {\n _this.setState({\n dragging: false,\n dropPosition: null,\n dropContainerKey: null,\n dropTargetKey: null,\n dropLevelOffset: null,\n dropAllowed: true,\n dragOverNodeKey: null\n });\n }\n\n _this.dragStartMousePosition = null;\n };\n\n _this.onNodeClick = function (e, treeNode) {\n var onClick = _this.props.onClick;\n\n if (onClick) {\n onClick(e, treeNode);\n }\n };\n\n _this.onNodeDoubleClick = function (e, treeNode) {\n var onDoubleClick = _this.props.onDoubleClick;\n\n if (onDoubleClick) {\n onDoubleClick(e, treeNode);\n }\n };\n\n _this.onNodeSelect = function (e, treeNode) {\n var selectedKeys = _this.state.selectedKeys;\n var keyEntities = _this.state.keyEntities;\n var _this$props3 = _this.props,\n onSelect = _this$props3.onSelect,\n multiple = _this$props3.multiple;\n var selected = treeNode.selected,\n key = treeNode.key;\n var targetSelected = !selected; // Update selected keys\n\n if (!targetSelected) {\n selectedKeys = arrDel(selectedKeys, key);\n } else if (!multiple) {\n selectedKeys = [key];\n } else {\n selectedKeys = arrAdd(selectedKeys, key);\n } // [Legacy] Not found related usage in doc or upper libs\n\n\n var selectedNodes = selectedKeys.map(function (selectedKey) {\n var entity = keyEntities[selectedKey];\n if (!entity) return null;\n return entity.node;\n }).filter(function (node) {\n return node;\n });\n\n _this.setUncontrolledState({\n selectedKeys: selectedKeys\n });\n\n if (onSelect) {\n onSelect(selectedKeys, {\n event: 'select',\n selected: targetSelected,\n node: treeNode,\n selectedNodes: selectedNodes,\n nativeEvent: e.nativeEvent\n });\n }\n };\n\n _this.onNodeCheck = function (e, treeNode, checked) {\n var _this$state5 = _this.state,\n keyEntities = _this$state5.keyEntities,\n oriCheckedKeys = _this$state5.checkedKeys,\n oriHalfCheckedKeys = _this$state5.halfCheckedKeys;\n var _this$props4 = _this.props,\n checkStrictly = _this$props4.checkStrictly,\n onCheck = _this$props4.onCheck;\n var key = treeNode.key; // Prepare trigger arguments\n\n var checkedObj;\n var eventObj = {\n event: 'check',\n node: treeNode,\n checked: checked,\n nativeEvent: e.nativeEvent\n };\n\n if (checkStrictly) {\n var checkedKeys = checked ? arrAdd(oriCheckedKeys, key) : arrDel(oriCheckedKeys, key);\n var halfCheckedKeys = arrDel(oriHalfCheckedKeys, key);\n checkedObj = {\n checked: checkedKeys,\n halfChecked: halfCheckedKeys\n };\n eventObj.checkedNodes = checkedKeys.map(function (checkedKey) {\n return keyEntities[checkedKey];\n }).filter(function (entity) {\n return entity;\n }).map(function (entity) {\n return entity.node;\n });\n\n _this.setUncontrolledState({\n checkedKeys: checkedKeys\n });\n } else {\n // Always fill first\n var _conductCheck = conductCheck([].concat(_toConsumableArray(oriCheckedKeys), [key]), true, keyEntities),\n _checkedKeys = _conductCheck.checkedKeys,\n _halfCheckedKeys = _conductCheck.halfCheckedKeys; // If remove, we do it again to correction\n\n\n if (!checked) {\n var keySet = new Set(_checkedKeys);\n keySet.delete(key);\n\n var _conductCheck2 = conductCheck(Array.from(keySet), {\n checked: false,\n halfCheckedKeys: _halfCheckedKeys\n }, keyEntities);\n\n _checkedKeys = _conductCheck2.checkedKeys;\n _halfCheckedKeys = _conductCheck2.halfCheckedKeys;\n }\n\n checkedObj = _checkedKeys; // [Legacy] This is used for `rc-tree-select`\n\n eventObj.checkedNodes = [];\n eventObj.checkedNodesPositions = [];\n eventObj.halfCheckedKeys = _halfCheckedKeys;\n\n _checkedKeys.forEach(function (checkedKey) {\n var entity = keyEntities[checkedKey];\n if (!entity) return;\n var node = entity.node,\n pos = entity.pos;\n eventObj.checkedNodes.push(node);\n eventObj.checkedNodesPositions.push({\n node: node,\n pos: pos\n });\n });\n\n _this.setUncontrolledState({\n checkedKeys: _checkedKeys\n }, false, {\n halfCheckedKeys: _halfCheckedKeys\n });\n }\n\n if (onCheck) {\n onCheck(checkedObj, eventObj);\n }\n };\n\n _this.onNodeLoad = function (treeNode) {\n return new Promise(function (resolve) {\n // We need to get the latest state of loading/loaded keys\n _this.setState(function (_ref) {\n var _ref$loadedKeys = _ref.loadedKeys,\n loadedKeys = _ref$loadedKeys === void 0 ? [] : _ref$loadedKeys,\n _ref$loadingKeys = _ref.loadingKeys,\n loadingKeys = _ref$loadingKeys === void 0 ? [] : _ref$loadingKeys;\n var _this$props5 = _this.props,\n loadData = _this$props5.loadData,\n onLoad = _this$props5.onLoad;\n var key = treeNode.key;\n\n if (!loadData || loadedKeys.indexOf(key) !== -1 || loadingKeys.indexOf(key) !== -1) {\n // react 15 will warn if return null\n return {};\n } // Process load data\n\n\n var promise = loadData(treeNode);\n promise.then(function () {\n var _this$state6 = _this.state,\n currentLoadedKeys = _this$state6.loadedKeys,\n currentLoadingKeys = _this$state6.loadingKeys;\n var newLoadedKeys = arrAdd(currentLoadedKeys, key);\n var newLoadingKeys = arrDel(currentLoadingKeys, key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice.\n // https://github.com/ant-design/ant-design/issues/12464\n\n if (onLoad) {\n onLoad(newLoadedKeys, {\n event: 'load',\n node: treeNode\n });\n }\n\n _this.setUncontrolledState({\n loadedKeys: newLoadedKeys\n });\n\n _this.setState({\n loadingKeys: newLoadingKeys\n });\n\n resolve();\n });\n return {\n loadingKeys: arrAdd(loadingKeys, key)\n };\n });\n });\n };\n\n _this.onNodeMouseEnter = function (event, node) {\n var onMouseEnter = _this.props.onMouseEnter;\n\n if (onMouseEnter) {\n onMouseEnter({\n event: event,\n node: node\n });\n }\n };\n\n _this.onNodeMouseLeave = function (event, node) {\n var onMouseLeave = _this.props.onMouseLeave;\n\n if (onMouseLeave) {\n onMouseLeave({\n event: event,\n node: node\n });\n }\n };\n\n _this.onNodeContextMenu = function (event, node) {\n var onRightClick = _this.props.onRightClick;\n\n if (onRightClick) {\n event.preventDefault();\n onRightClick({\n event: event,\n node: node\n });\n }\n };\n\n _this.onFocus = function () {\n var onFocus = _this.props.onFocus;\n\n _this.setState({\n focused: true\n });\n\n if (onFocus) {\n onFocus.apply(void 0, arguments);\n }\n };\n\n _this.onBlur = function () {\n var onBlur = _this.props.onBlur;\n\n _this.setState({\n focused: false\n });\n\n _this.onActiveChange(null);\n\n if (onBlur) {\n onBlur.apply(void 0, arguments);\n }\n };\n\n _this.getTreeNodeRequiredProps = function () {\n var _this$state7 = _this.state,\n expandedKeys = _this$state7.expandedKeys,\n selectedKeys = _this$state7.selectedKeys,\n loadedKeys = _this$state7.loadedKeys,\n loadingKeys = _this$state7.loadingKeys,\n checkedKeys = _this$state7.checkedKeys,\n halfCheckedKeys = _this$state7.halfCheckedKeys,\n dragOverNodeKey = _this$state7.dragOverNodeKey,\n dropPosition = _this$state7.dropPosition,\n keyEntities = _this$state7.keyEntities;\n return {\n expandedKeys: expandedKeys || [],\n selectedKeys: selectedKeys || [],\n loadedKeys: loadedKeys || [],\n loadingKeys: loadingKeys || [],\n checkedKeys: checkedKeys || [],\n halfCheckedKeys: halfCheckedKeys || [],\n dragOverNodeKey: dragOverNodeKey,\n dropPosition: dropPosition,\n keyEntities: keyEntities\n };\n }; // =========================== Expanded ===========================\n\n /** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */\n\n\n _this.setExpandedKeys = function (expandedKeys) {\n var treeData = _this.state.treeData;\n var flattenNodes = flattenTreeData(treeData, expandedKeys);\n\n _this.setUncontrolledState({\n expandedKeys: expandedKeys,\n flattenNodes: flattenNodes\n }, true);\n };\n\n _this.onNodeExpand = function (e, treeNode) {\n var expandedKeys = _this.state.expandedKeys;\n var listChanging = _this.state.listChanging;\n var _this$props6 = _this.props,\n onExpand = _this$props6.onExpand,\n loadData = _this$props6.loadData;\n var key = treeNode.key,\n expanded = treeNode.expanded; // Do nothing when motion is in progress\n\n if (listChanging) {\n return;\n } // Update selected keys\n\n\n var index = expandedKeys.indexOf(key);\n var targetExpanded = !expanded;\n warning(expanded && index !== -1 || !expanded && index === -1, 'Expand state not sync with index check');\n\n if (targetExpanded) {\n expandedKeys = arrAdd(expandedKeys, key);\n } else {\n expandedKeys = arrDel(expandedKeys, key);\n }\n\n _this.setExpandedKeys(expandedKeys);\n\n if (onExpand) {\n onExpand(expandedKeys, {\n node: treeNode,\n expanded: targetExpanded,\n nativeEvent: e.nativeEvent\n });\n } // Async Load data\n\n\n if (targetExpanded && loadData) {\n var loadPromise = _this.onNodeLoad(treeNode);\n\n if (loadPromise) {\n loadPromise.then(function () {\n // [Legacy] Refresh logic\n var newFlattenTreeData = flattenTreeData(_this.state.treeData, expandedKeys);\n\n _this.setUncontrolledState({\n flattenNodes: newFlattenTreeData\n });\n });\n }\n }\n };\n\n _this.onListChangeStart = function () {\n _this.setUncontrolledState({\n listChanging: true\n });\n };\n\n _this.onListChangeEnd = function () {\n setTimeout(function () {\n _this.setUncontrolledState({\n listChanging: false\n });\n });\n }; // =========================== Keyboard ===========================\n\n\n _this.onActiveChange = function (newActiveKey) {\n var activeKey = _this.state.activeKey;\n var onActiveChange = _this.props.onActiveChange;\n\n if (activeKey === newActiveKey) {\n return;\n }\n\n _this.setState({\n activeKey: newActiveKey\n });\n\n if (newActiveKey !== null) {\n _this.scrollTo({\n key: newActiveKey\n });\n }\n\n if (onActiveChange) {\n onActiveChange(newActiveKey);\n }\n };\n\n _this.getActiveItem = function () {\n var _this$state8 = _this.state,\n activeKey = _this$state8.activeKey,\n flattenNodes = _this$state8.flattenNodes;\n\n if (activeKey === null) {\n return null;\n }\n\n return flattenNodes.find(function (_ref2) {\n var key = _ref2.data.key;\n return key === activeKey;\n }) || null;\n };\n\n _this.offsetActiveKey = function (offset) {\n var _this$state9 = _this.state,\n flattenNodes = _this$state9.flattenNodes,\n activeKey = _this$state9.activeKey;\n var index = flattenNodes.findIndex(function (_ref3) {\n var key = _ref3.data.key;\n return key === activeKey;\n }); // Align with index\n\n if (index === -1 && offset < 0) {\n index = flattenNodes.length;\n }\n\n index = (index + offset + flattenNodes.length) % flattenNodes.length;\n var item = flattenNodes[index];\n\n if (item) {\n var key = item.data.key;\n\n _this.onActiveChange(key);\n } else {\n _this.onActiveChange(null);\n }\n };\n\n _this.onKeyDown = function (event) {\n var _this$state10 = _this.state,\n activeKey = _this$state10.activeKey,\n expandedKeys = _this$state10.expandedKeys,\n checkedKeys = _this$state10.checkedKeys;\n var _this$props7 = _this.props,\n onKeyDown = _this$props7.onKeyDown,\n checkable = _this$props7.checkable,\n selectable = _this$props7.selectable; // >>>>>>>>>> Direction\n\n switch (event.which) {\n case KeyCode.UP:\n {\n _this.offsetActiveKey(-1);\n\n event.preventDefault();\n break;\n }\n\n case KeyCode.DOWN:\n {\n _this.offsetActiveKey(1);\n\n event.preventDefault();\n break;\n }\n } // >>>>>>>>>> Expand & Selection\n\n\n var activeItem = _this.getActiveItem();\n\n if (activeItem && activeItem.data) {\n var treeNodeRequiredProps = _this.getTreeNodeRequiredProps();\n\n var expandable = activeItem.data.isLeaf === false || !!(activeItem.data.children || []).length;\n var eventNode = convertNodePropsToEventData(_objectSpread(_objectSpread({}, getTreeNodeProps(activeKey, treeNodeRequiredProps)), {}, {\n data: activeItem.data,\n active: true\n }));\n\n switch (event.which) {\n // >>> Expand\n case KeyCode.LEFT:\n {\n // Collapse if possible\n if (expandable && expandedKeys.includes(activeKey)) {\n _this.onNodeExpand({}, eventNode);\n } else if (activeItem.parent) {\n _this.onActiveChange(activeItem.parent.data.key);\n }\n\n event.preventDefault();\n break;\n }\n\n case KeyCode.RIGHT:\n {\n // Expand if possible\n if (expandable && !expandedKeys.includes(activeKey)) {\n _this.onNodeExpand({}, eventNode);\n } else if (activeItem.children && activeItem.children.length) {\n _this.onActiveChange(activeItem.children[0].data.key);\n }\n\n event.preventDefault();\n break;\n }\n // Selection\n\n case KeyCode.ENTER:\n case KeyCode.SPACE:\n {\n if (checkable && !eventNode.disabled && eventNode.checkable !== false && !eventNode.disableCheckbox) {\n _this.onNodeCheck({}, eventNode, !checkedKeys.includes(activeKey));\n } else if (!checkable && selectable && !eventNode.disabled && eventNode.selectable !== false) {\n _this.onNodeSelect({}, eventNode);\n }\n\n break;\n }\n }\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n /**\n * Only update the value which is not in props\n */\n\n\n _this.setUncontrolledState = function (state) {\n var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var forceState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n if (_this.destroyed) {\n return;\n }\n\n var needSync = false;\n var allPassed = true;\n var newState = {};\n Object.keys(state).forEach(function (name) {\n if (name in _this.props) {\n allPassed = false;\n return;\n }\n\n needSync = true;\n newState[name] = state[name];\n });\n\n if (needSync && (!atomic || allPassed)) {\n _this.setState(_objectSpread(_objectSpread({}, newState), forceState));\n }\n };\n\n _this.scrollTo = function (scroll) {\n _this.listRef.current.scrollTo(scroll);\n };\n\n return _this;\n }\n\n _createClass(Tree, [{\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n window.removeEventListener('dragend', this.onWindowDragEnd);\n this.destroyed = true;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _classNames;\n\n var _this$state11 = this.state,\n focused = _this$state11.focused,\n flattenNodes = _this$state11.flattenNodes,\n keyEntities = _this$state11.keyEntities,\n dragging = _this$state11.dragging,\n activeKey = _this$state11.activeKey,\n dropLevelOffset = _this$state11.dropLevelOffset,\n dropContainerKey = _this$state11.dropContainerKey,\n dropTargetKey = _this$state11.dropTargetKey,\n dropPosition = _this$state11.dropPosition,\n dragOverNodeKey = _this$state11.dragOverNodeKey,\n indent = _this$state11.indent;\n var _this$props8 = this.props,\n prefixCls = _this$props8.prefixCls,\n className = _this$props8.className,\n style = _this$props8.style,\n showLine = _this$props8.showLine,\n focusable = _this$props8.focusable,\n _this$props8$tabIndex = _this$props8.tabIndex,\n tabIndex = _this$props8$tabIndex === void 0 ? 0 : _this$props8$tabIndex,\n selectable = _this$props8.selectable,\n showIcon = _this$props8.showIcon,\n icon = _this$props8.icon,\n switcherIcon = _this$props8.switcherIcon,\n draggable = _this$props8.draggable,\n checkable = _this$props8.checkable,\n checkStrictly = _this$props8.checkStrictly,\n disabled = _this$props8.disabled,\n motion = _this$props8.motion,\n loadData = _this$props8.loadData,\n filterTreeNode = _this$props8.filterTreeNode,\n height = _this$props8.height,\n itemHeight = _this$props8.itemHeight,\n virtual = _this$props8.virtual,\n titleRender = _this$props8.titleRender,\n dropIndicatorRender = _this$props8.dropIndicatorRender,\n onContextMenu = _this$props8.onContextMenu,\n direction = _this$props8.direction;\n var domProps = getDataAndAria(this.props);\n return /*#__PURE__*/React.createElement(TreeContext.Provider, {\n value: {\n prefixCls: prefixCls,\n selectable: selectable,\n showIcon: showIcon,\n icon: icon,\n switcherIcon: switcherIcon,\n draggable: draggable,\n checkable: checkable,\n checkStrictly: checkStrictly,\n disabled: disabled,\n keyEntities: keyEntities,\n dropLevelOffset: dropLevelOffset,\n dropContainerKey: dropContainerKey,\n dropTargetKey: dropTargetKey,\n dropPosition: dropPosition,\n dragOverNodeKey: dragOverNodeKey,\n indent: indent,\n direction: direction,\n dropIndicatorRender: dropIndicatorRender,\n loadData: loadData,\n filterTreeNode: filterTreeNode,\n titleRender: titleRender,\n onNodeClick: this.onNodeClick,\n onNodeDoubleClick: this.onNodeDoubleClick,\n onNodeExpand: this.onNodeExpand,\n onNodeSelect: this.onNodeSelect,\n onNodeCheck: this.onNodeCheck,\n onNodeLoad: this.onNodeLoad,\n onNodeMouseEnter: this.onNodeMouseEnter,\n onNodeMouseLeave: this.onNodeMouseLeave,\n onNodeContextMenu: this.onNodeContextMenu,\n onNodeDragStart: this.onNodeDragStart,\n onNodeDragEnter: this.onNodeDragEnter,\n onNodeDragOver: this.onNodeDragOver,\n onNodeDragLeave: this.onNodeDragLeave,\n onNodeDragEnd: this.onNodeDragEnd,\n onNodeDrop: this.onNodeDrop\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: classNames(prefixCls, className, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-show-line\"), showLine), _defineProperty(_classNames, \"\".concat(prefixCls, \"-focused\"), focused), _defineProperty(_classNames, \"\".concat(prefixCls, \"-active-focused\"), activeKey !== null), _classNames))\n }, /*#__PURE__*/React.createElement(NodeList, Object.assign({\n ref: this.listRef,\n prefixCls: prefixCls,\n style: style,\n data: flattenNodes,\n disabled: disabled,\n selectable: selectable,\n checkable: !!checkable,\n motion: motion,\n dragging: dragging,\n height: height,\n itemHeight: itemHeight,\n virtual: virtual,\n focusable: focusable,\n focused: focused,\n tabIndex: tabIndex,\n activeItem: this.getActiveItem(),\n onFocus: this.onFocus,\n onBlur: this.onBlur,\n onKeyDown: this.onKeyDown,\n onActiveChange: this.onActiveChange,\n onListChangeStart: this.onListChangeStart,\n onListChangeEnd: this.onListChangeEnd,\n onContextMenu: onContextMenu\n }, this.getTreeNodeRequiredProps(), domProps))));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(props, prevState) {\n var prevProps = prevState.prevProps;\n var newState = {\n prevProps: props\n };\n\n function needSync(name) {\n return !prevProps && name in props || prevProps && prevProps[name] !== props[name];\n } // ================== Tree Node ==================\n\n\n var treeData; // Check if `treeData` or `children` changed and save into the state.\n\n if (needSync('treeData')) {\n treeData = props.treeData;\n } else if (needSync('children')) {\n warning(false, '`children` of Tree is deprecated. Please use `treeData` instead.');\n treeData = convertTreeToData(props.children);\n } // Save flatten nodes info and convert `treeData` into keyEntities\n\n\n if (treeData) {\n newState.treeData = treeData;\n var entitiesMap = convertDataToEntities(treeData);\n newState.keyEntities = _objectSpread(_defineProperty({}, MOTION_KEY, MotionEntity), entitiesMap.keyEntities); // Warning if treeNode not provide key\n\n if (process.env.NODE_ENV !== 'production') {\n warningWithoutKey(treeData);\n }\n }\n\n var keyEntities = newState.keyEntities || prevState.keyEntities; // ================ expandedKeys =================\n\n if (needSync('expandedKeys') || prevProps && needSync('autoExpandParent')) {\n newState.expandedKeys = props.autoExpandParent || !prevProps && props.defaultExpandParent ? conductExpandParent(props.expandedKeys, keyEntities) : props.expandedKeys;\n } else if (!prevProps && props.defaultExpandAll) {\n var cloneKeyEntities = _objectSpread({}, keyEntities);\n\n delete cloneKeyEntities[MOTION_KEY];\n newState.expandedKeys = Object.keys(cloneKeyEntities).map(function (key) {\n return cloneKeyEntities[key].key;\n });\n } else if (!prevProps && props.defaultExpandedKeys) {\n newState.expandedKeys = props.autoExpandParent || props.defaultExpandParent ? conductExpandParent(props.defaultExpandedKeys, keyEntities) : props.defaultExpandedKeys;\n }\n\n if (!newState.expandedKeys) {\n delete newState.expandedKeys;\n } // ================ flattenNodes =================\n\n\n if (treeData || newState.expandedKeys) {\n var flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys);\n newState.flattenNodes = flattenNodes;\n } // ================ selectedKeys =================\n\n\n if (props.selectable) {\n if (needSync('selectedKeys')) {\n newState.selectedKeys = calcSelectedKeys(props.selectedKeys, props);\n } else if (!prevProps && props.defaultSelectedKeys) {\n newState.selectedKeys = calcSelectedKeys(props.defaultSelectedKeys, props);\n }\n } // ================= checkedKeys =================\n\n\n if (props.checkable) {\n var checkedKeyEntity;\n\n if (needSync('checkedKeys')) {\n checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {};\n } else if (!prevProps && props.defaultCheckedKeys) {\n checkedKeyEntity = parseCheckedKeys(props.defaultCheckedKeys) || {};\n } else if (treeData) {\n // If `treeData` changed, we also need check it\n checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {\n checkedKeys: prevState.checkedKeys,\n halfCheckedKeys: prevState.halfCheckedKeys\n };\n }\n\n if (checkedKeyEntity) {\n var _checkedKeyEntity = checkedKeyEntity,\n _checkedKeyEntity$che = _checkedKeyEntity.checkedKeys,\n checkedKeys = _checkedKeyEntity$che === void 0 ? [] : _checkedKeyEntity$che,\n _checkedKeyEntity$hal = _checkedKeyEntity.halfCheckedKeys,\n halfCheckedKeys = _checkedKeyEntity$hal === void 0 ? [] : _checkedKeyEntity$hal;\n\n if (!props.checkStrictly) {\n var conductKeys = conductCheck(checkedKeys, true, keyEntities);\n checkedKeys = conductKeys.checkedKeys;\n halfCheckedKeys = conductKeys.halfCheckedKeys;\n }\n\n newState.checkedKeys = checkedKeys;\n newState.halfCheckedKeys = halfCheckedKeys;\n }\n } // ================= loadedKeys ==================\n\n\n if (needSync('loadedKeys')) {\n newState.loadedKeys = props.loadedKeys;\n }\n\n return newState;\n }\n }]);\n\n return Tree;\n}(React.Component);\n\nTree.defaultProps = {\n prefixCls: 'rc-tree',\n showLine: false,\n showIcon: true,\n selectable: true,\n multiple: false,\n checkable: false,\n disabled: false,\n checkStrictly: false,\n draggable: false,\n defaultExpandParent: true,\n autoExpandParent: false,\n defaultExpandAll: false,\n defaultExpandedKeys: [],\n defaultCheckedKeys: [],\n defaultSelectedKeys: [],\n dropIndicatorRender: DropIndicator,\n allowDrop: function allowDrop() {\n return true;\n }\n};\nTree.TreeNode = TreeNode;\nexport default Tree;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-tree/es/Tree.js"],"names":["_defineProperty","_objectSpread","_toConsumableArray","_classCallCheck","_createClass","_assertThisInitialized","_inherits","_createSuper","React","KeyCode","warning","classNames","TreeContext","getDataAndAria","getDragChildrenKeys","parseCheckedKeys","conductExpandParent","calcSelectedKeys","calcDropPosition","arrAdd","arrDel","posToArr","flattenTreeData","convertTreeToData","convertDataToEntities","warningWithoutKey","convertNodePropsToEventData","getTreeNodeProps","NodeList","MOTION_KEY","MotionEntity","TreeNode","conductCheck","DropIndicator","Tree","_React$Component","_super","_this","apply","arguments","destroyed","state","keyEntities","indent","selectedKeys","checkedKeys","halfCheckedKeys","loadedKeys","loadingKeys","expandedKeys","dragging","dragChildrenKeys","dropTargetKey","dropPosition","dropContainerKey","dropLevelOffset","dropTargetPos","dropAllowed","dragOverNodeKey","treeData","flattenNodes","focused","activeKey","listChanging","prevProps","dragStartMousePosition","listRef","createRef","onNodeDragStart","event","node","_this$state","onDragStart","props","eventKey","dragNode","x","clientX","y","clientY","newExpandedKeys","setState","current","getIndentWidth","setExpandedKeys","window","addEventListener","onWindowDragEnd","onNodeDragEnter","_this$state2","_this$props","onDragEnter","onExpand","allowDrop","direction","pos","_assertThisInitialize","_calcDropPosition","indexOf","delayedDragEnterLogic","Object","keys","forEach","key","clearTimeout","persist","setTimeout","entity","children","length","expanded","nativeEvent","onNodeDragOver","_this$state3","_this$props2","onDragOver","_assertThisInitialize2","_calcDropPosition2","onNodeDragLeave","onDragLeave","onNodeDragEnd","removeEventListener","outsideTree","undefined","onDragEnd","cleanDragState","onNodeDrop","_this$getActiveItem","_this$state4","onDrop","abstractDropNodeProps","getTreeNodeRequiredProps","active","getActiveItem","data","dropToChild","posArr","dropResult","dragNodesKeys","concat","dropToGap","Number","onNodeClick","e","treeNode","onClick","onNodeDoubleClick","onDoubleClick","onNodeSelect","_this$props3","onSelect","multiple","selected","targetSelected","selectedNodes","map","selectedKey","filter","setUncontrolledState","onNodeCheck","checked","_this$state5","oriCheckedKeys","oriHalfCheckedKeys","_this$props4","checkStrictly","onCheck","checkedObj","eventObj","halfChecked","checkedNodes","checkedKey","_conductCheck","_checkedKeys","_halfCheckedKeys","keySet","Set","delete","_conductCheck2","Array","from","checkedNodesPositions","push","onNodeLoad","Promise","resolve","_ref","_ref$loadedKeys","_ref$loadingKeys","_this$props5","loadData","onLoad","promise","then","_this$state6","currentLoadedKeys","currentLoadingKeys","newLoadedKeys","newLoadingKeys","onNodeMouseEnter","onMouseEnter","onNodeMouseLeave","onMouseLeave","onNodeContextMenu","onRightClick","preventDefault","onFocus","onBlur","onActiveChange","_this$state7","onNodeExpand","_this$props6","index","targetExpanded","loadPromise","newFlattenTreeData","onListChangeStart","onListChangeEnd","newActiveKey","scrollTo","_this$state8","find","_ref2","offsetActiveKey","offset","_this$state9","findIndex","_ref3","item","onKeyDown","_this$state10","_this$props7","checkable","selectable","which","UP","DOWN","activeItem","treeNodeRequiredProps","expandable","isLeaf","eventNode","LEFT","includes","parent","RIGHT","ENTER","SPACE","disabled","disableCheckbox","atomic","forceState","needSync","allPassed","newState","name","scroll","value","componentWillUnmount","render","_classNames","_this$state11","_this$props8","prefixCls","className","style","showLine","focusable","_this$props8$tabIndex","tabIndex","showIcon","icon","switcherIcon","draggable","motion","filterTreeNode","height","itemHeight","virtual","titleRender","dropIndicatorRender","onContextMenu","domProps","createElement","Provider","assign","ref","getDerivedStateFromProps","prevState","entitiesMap","process","env","NODE_ENV","autoExpandParent","defaultExpandParent","defaultExpandAll","cloneKeyEntities","defaultExpandedKeys","defaultSelectedKeys","checkedKeyEntity","defaultCheckedKeys","_checkedKeyEntity","_checkedKeyEntity$che","_checkedKeyEntity$hal","conductKeys","Component","defaultProps"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,2CAA5B;AACA,OAAOC,aAAP,MAA0B,0CAA1B;AACA,OAAOC,kBAAP,MAA+B,8CAA/B;AACA,OAAOC,eAAP,MAA4B,2CAA5B;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAOC,sBAAP,MAAmC,kDAAnC;AACA,OAAOC,SAAP,MAAsB,qCAAtB;AACA,OAAOC,YAAP,MAAyB,wCAAzB,C,CACA;AACA;;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,WAAT,QAA4B,gBAA5B;AACA,SAASC,cAAT,EAAyBC,mBAAzB,EAA8CC,gBAA9C,EAAgEC,mBAAhE,EAAqFC,gBAArF,EAAuGC,gBAAvG,EAAyHC,MAAzH,EAAiIC,MAAjI,EAAyIC,QAAzI,QAAyJ,QAAzJ;AACA,SAASC,eAAT,EAA0BC,iBAA1B,EAA6CC,qBAA7C,EAAoEC,iBAApE,EAAuFC,2BAAvF,EAAoHC,gBAApH,QAA4I,kBAA5I;AACA,OAAOC,QAAP,IAAmBC,UAAnB,EAA+BC,YAA/B,QAAmD,YAAnD;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,YAAT,QAA6B,qBAA7B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;;AAEA,IAAIC,IAAI,GAAG,aAAa,UAAUC,gBAAV,EAA4B;AAClD7B,EAAAA,SAAS,CAAC4B,IAAD,EAAOC,gBAAP,CAAT;;AAEA,MAAIC,MAAM,GAAG7B,YAAY,CAAC2B,IAAD,CAAzB;;AAEA,WAASA,IAAT,GAAgB;AACd,QAAI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gB,EAAE,KAXA;AAYlBE,EAAAA,gBAAgB,EAAE,KAZA;AAalBE,EAAAA,mBAAmB,EAAE,EAbH;AAclBG,EAAAA,kBAAkB,EAAE,EAdF;AAelBF,EAAAA,mBAAmB,EAAE,EAfH;AAgBlBlB,EAAAA,mBAAmB,EAAEvP,aAhBH;AAiBlB4D,EAAAA,SAAS,EAAE,SAASA,SAAT,GAAqB;AAC9B,WAAO,IAAP;AACD;AAnBiB,CAApB;AAqBA3D,IAAI,CAACH,QAAL,GAAgBA,QAAhB;AACA,eAAeG,IAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\n// TODO: https://www.w3.org/TR/2017/NOTE-wai-aria-practices-1.1-20171214/examples/treeview/treeview-2/treeview-2a.html\n// Fully accessibility support\nimport * as React from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport warning from \"rc-util/es/warning\";\nimport classNames from 'classnames';\nimport { TreeContext } from './contextTypes';\nimport { getDataAndAria, getDragChildrenKeys, parseCheckedKeys, conductExpandParent, calcSelectedKeys, calcDropPosition, arrAdd, arrDel, posToArr } from './util';\nimport { flattenTreeData, convertTreeToData, convertDataToEntities, warningWithoutKey, convertNodePropsToEventData, getTreeNodeProps } from './utils/treeUtil';\nimport NodeList, { MOTION_KEY, MotionEntity } from './NodeList';\nimport TreeNode from './TreeNode';\nimport { conductCheck } from './utils/conductUtil';\nimport DropIndicator from './DropIndicator';\n\nvar Tree = /*#__PURE__*/function (_React$Component) {\n _inherits(Tree, _React$Component);\n\n var _super = _createSuper(Tree);\n\n function Tree() {\n var _this;\n\n _classCallCheck(this, Tree);\n\n _this = _super.apply(this, arguments);\n _this.destroyed = false;\n _this.state = {\n keyEntities: {},\n indent: null,\n selectedKeys: [],\n checkedKeys: [],\n halfCheckedKeys: [],\n loadedKeys: [],\n loadingKeys: [],\n expandedKeys: [],\n dragging: false,\n dragChildrenKeys: [],\n // dropTargetKey is the key of abstract-drop-node\n // the abstract-drop-node is the real drop node when drag and drop\n // not the DOM drag over node\n dropTargetKey: null,\n dropPosition: null,\n dropContainerKey: null,\n dropLevelOffset: null,\n dropTargetPos: null,\n dropAllowed: true,\n // the abstract-drag-over-node\n // if mouse is on the bottom of top dom node or no the top of the bottom dom node\n // abstract-drag-over-node is the top node\n dragOverNodeKey: null,\n treeData: [],\n flattenNodes: [],\n focused: false,\n activeKey: null,\n listChanging: false,\n prevProps: null\n };\n _this.dragStartMousePosition = null;\n _this.listRef = /*#__PURE__*/React.createRef();\n\n _this.onNodeDragStart = function (event, node) {\n var _this$state = _this.state,\n expandedKeys = _this$state.expandedKeys,\n keyEntities = _this$state.keyEntities;\n var onDragStart = _this.props.onDragStart;\n var eventKey = node.props.eventKey;\n _this.dragNode = node;\n _this.dragStartMousePosition = {\n x: event.clientX,\n y: event.clientY\n };\n var newExpandedKeys = arrDel(expandedKeys, eventKey);\n\n _this.setState({\n dragging: true,\n dragChildrenKeys: getDragChildrenKeys(eventKey, keyEntities),\n indent: _this.listRef.current.getIndentWidth()\n });\n\n _this.setExpandedKeys(newExpandedKeys);\n\n window.addEventListener('dragend', _this.onWindowDragEnd);\n\n if (onDragStart) {\n onDragStart({\n event: event,\n node: convertNodePropsToEventData(node.props)\n });\n }\n };\n /**\n * [Legacy] Select handler is smaller than node,\n * so that this will trigger when drag enter node or select handler.\n * This is a little tricky if customize css without padding.\n * Better for use mouse move event to refresh drag state.\n * But let's just keep it to avoid event trigger logic change.\n */\n\n\n _this.onNodeDragEnter = function (event, node) {\n var _this$state2 = _this.state,\n expandedKeys = _this$state2.expandedKeys,\n keyEntities = _this$state2.keyEntities,\n dragChildrenKeys = _this$state2.dragChildrenKeys,\n flattenNodes = _this$state2.flattenNodes,\n indent = _this$state2.indent;\n var _this$props = _this.props,\n onDragEnter = _this$props.onDragEnter,\n onExpand = _this$props.onExpand,\n allowDrop = _this$props.allowDrop,\n direction = _this$props.direction;\n var pos = node.props.pos;\n\n var _assertThisInitialize = _assertThisInitialized(_this),\n dragNode = _assertThisInitialize.dragNode;\n\n var _calcDropPosition = calcDropPosition(event, node, indent, _this.dragStartMousePosition, allowDrop, flattenNodes, keyEntities, expandedKeys, direction),\n dropPosition = _calcDropPosition.dropPosition,\n dropLevelOffset = _calcDropPosition.dropLevelOffset,\n dropTargetKey = _calcDropPosition.dropTargetKey,\n dropContainerKey = _calcDropPosition.dropContainerKey,\n dropTargetPos = _calcDropPosition.dropTargetPos,\n dropAllowed = _calcDropPosition.dropAllowed,\n dragOverNodeKey = _calcDropPosition.dragOverNodeKey;\n\n if (!dragNode || // don't allow drop inside its children\n dragChildrenKeys.indexOf(dropTargetKey) !== -1 || // don't allow drop when drop is not allowed caculated by calcDropPosition\n !dropAllowed) {\n _this.setState({\n dragOverNodeKey: null,\n dropPosition: null,\n dropLevelOffset: null,\n dropTargetKey: null,\n dropContainerKey: null,\n dropTargetPos: null,\n dropAllowed: false\n });\n\n return;\n } // Side effect for delay drag\n\n\n if (!_this.delayedDragEnterLogic) {\n _this.delayedDragEnterLogic = {};\n }\n\n Object.keys(_this.delayedDragEnterLogic).forEach(function (key) {\n clearTimeout(_this.delayedDragEnterLogic[key]);\n });\n\n if (dragNode.props.eventKey !== node.props.eventKey) {\n // hoist expand logic here\n // since if logic is on the bottom\n // it will be blocked by abstract dragover node check\n // => if you dragenter from top, you mouse will still be consider as in the top node\n event.persist();\n _this.delayedDragEnterLogic[pos] = window.setTimeout(function () {\n if (!_this.state.dragging) return;\n\n var newExpandedKeys = _toConsumableArray(expandedKeys);\n\n var entity = keyEntities[node.props.eventKey];\n\n if (entity && (entity.children || []).length) {\n newExpandedKeys = arrAdd(expandedKeys, node.props.eventKey);\n }\n\n if (!('expandedKeys' in _this.props)) {\n _this.setExpandedKeys(newExpandedKeys);\n }\n\n if (onExpand) {\n onExpand(newExpandedKeys, {\n node: convertNodePropsToEventData(node.props),\n expanded: true,\n nativeEvent: event.nativeEvent\n });\n }\n }, 800);\n } // Skip if drag node is self\n\n\n if (dragNode.props.eventKey === dropTargetKey && dropLevelOffset === 0) {\n _this.setState({\n dragOverNodeKey: null,\n dropPosition: null,\n dropLevelOffset: null,\n dropTargetKey: null,\n dropContainerKey: null,\n dropTargetPos: null,\n dropAllowed: false\n });\n\n return;\n } // Update drag over node and drag state\n\n\n _this.setState({\n dragOverNodeKey: dragOverNodeKey,\n dropPosition: dropPosition,\n dropLevelOffset: dropLevelOffset,\n dropTargetKey: dropTargetKey,\n dropContainerKey: dropContainerKey,\n dropTargetPos: dropTargetPos,\n dropAllowed: dropAllowed\n });\n\n if (onDragEnter) {\n onDragEnter({\n event: event,\n node: convertNodePropsToEventData(node.props),\n expandedKeys: expandedKeys\n });\n }\n };\n\n _this.onNodeDragOver = function (event, node) {\n var _this$state3 = _this.state,\n dragChildrenKeys = _this$state3.dragChildrenKeys,\n flattenNodes = _this$state3.flattenNodes,\n keyEntities = _this$state3.keyEntities,\n expandedKeys = _this$state3.expandedKeys,\n indent = _this$state3.indent;\n var _this$props2 = _this.props,\n onDragOver = _this$props2.onDragOver,\n allowDrop = _this$props2.allowDrop,\n direction = _this$props2.direction;\n\n var _assertThisInitialize2 = _assertThisInitialized(_this),\n dragNode = _assertThisInitialize2.dragNode;\n\n var _calcDropPosition2 = calcDropPosition(event, node, indent, _this.dragStartMousePosition, allowDrop, flattenNodes, keyEntities, expandedKeys, direction),\n dropPosition = _calcDropPosition2.dropPosition,\n dropLevelOffset = _calcDropPosition2.dropLevelOffset,\n dropTargetKey = _calcDropPosition2.dropTargetKey,\n dropContainerKey = _calcDropPosition2.dropContainerKey,\n dropAllowed = _calcDropPosition2.dropAllowed,\n dropTargetPos = _calcDropPosition2.dropTargetPos,\n dragOverNodeKey = _calcDropPosition2.dragOverNodeKey;\n\n if (!dragNode || dragChildrenKeys.indexOf(dropTargetKey) !== -1 || !dropAllowed) {\n // don't allow drop inside its children\n // don't allow drop when drop is not allowed caculated by calcDropPosition\n return;\n } // Update drag position\n\n\n if (dragNode.props.eventKey === dropTargetKey && dropLevelOffset === 0) {\n if (!(_this.state.dropPosition === null && _this.state.dropLevelOffset === null && _this.state.dropTargetKey === null && _this.state.dropContainerKey === null && _this.state.dropTargetPos === null && _this.state.dropAllowed === false && _this.state.dragOverNodeKey === null)) {\n _this.setState({\n dropPosition: null,\n dropLevelOffset: null,\n dropTargetKey: null,\n dropContainerKey: null,\n dropTargetPos: null,\n dropAllowed: false,\n dragOverNodeKey: null\n });\n }\n } else if (!(dropPosition === _this.state.dropPosition && dropLevelOffset === _this.state.dropLevelOffset && dropTargetKey === _this.state.dropTargetKey && dropContainerKey === _this.state.dropContainerKey && dropTargetPos === _this.state.dropTargetPos && dropAllowed === _this.state.dropAllowed && dragOverNodeKey === _this.state.dragOverNodeKey)) {\n _this.setState({\n dropPosition: dropPosition,\n dropLevelOffset: dropLevelOffset,\n dropTargetKey: dropTargetKey,\n dropContainerKey: dropContainerKey,\n dropTargetPos: dropTargetPos,\n dropAllowed: dropAllowed,\n dragOverNodeKey: dragOverNodeKey\n });\n }\n\n if (onDragOver) {\n onDragOver({\n event: event,\n node: convertNodePropsToEventData(node.props)\n });\n }\n };\n\n _this.onNodeDragLeave = function (event, node) {\n var onDragLeave = _this.props.onDragLeave;\n\n if (onDragLeave) {\n onDragLeave({\n event: event,\n node: convertNodePropsToEventData(node.props)\n });\n }\n }; // since stopPropagation() is called in treeNode\n // if onWindowDrag is called, whice means state is keeped, drag state should be cleared\n\n\n _this.onWindowDragEnd = function (event) {\n _this.onNodeDragEnd(event, null, true);\n\n window.removeEventListener('dragend', _this.onWindowDragEnd);\n }; // if onNodeDragEnd is called, onWindowDragEnd won't be called since stopPropagation() is called\n\n\n _this.onNodeDragEnd = function (event, node) {\n var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var onDragEnd = _this.props.onDragEnd;\n\n _this.setState({\n dragOverNodeKey: null\n });\n\n _this.cleanDragState();\n\n if (onDragEnd && !outsideTree) {\n onDragEnd({\n event: event,\n node: convertNodePropsToEventData(node.props)\n });\n }\n\n _this.dragNode = null;\n };\n\n _this.onNodeDrop = function (event, node) {\n var _this$getActiveItem;\n\n var outsideTree = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var _this$state4 = _this.state,\n dragChildrenKeys = _this$state4.dragChildrenKeys,\n dropPosition = _this$state4.dropPosition,\n dropTargetKey = _this$state4.dropTargetKey,\n dropTargetPos = _this$state4.dropTargetPos,\n dropAllowed = _this$state4.dropAllowed;\n if (!dropAllowed) return;\n var onDrop = _this.props.onDrop;\n\n _this.setState({\n dragOverNodeKey: null\n });\n\n _this.cleanDragState();\n\n if (dropTargetKey === null) return;\n\n var abstractDropNodeProps = _objectSpread(_objectSpread({}, getTreeNodeProps(dropTargetKey, _this.getTreeNodeRequiredProps())), {}, {\n active: ((_this$getActiveItem = _this.getActiveItem()) === null || _this$getActiveItem === void 0 ? void 0 : _this$getActiveItem.data.key) === dropTargetKey,\n data: _this.state.keyEntities[dropTargetKey].node\n });\n\n var dropToChild = dragChildrenKeys.indexOf(dropTargetKey) !== -1;\n warning(!dropToChild, \"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.\");\n var posArr = posToArr(dropTargetPos);\n var dropResult = {\n event: event,\n node: convertNodePropsToEventData(abstractDropNodeProps),\n dragNode: _this.dragNode ? convertNodePropsToEventData(_this.dragNode.props) : null,\n dragNodesKeys: [_this.dragNode.props.eventKey].concat(dragChildrenKeys),\n dropToGap: dropPosition !== 0,\n dropPosition: dropPosition + Number(posArr[posArr.length - 1])\n };\n\n if (onDrop && !outsideTree) {\n onDrop(dropResult);\n }\n\n _this.dragNode = null;\n };\n\n _this.cleanDragState = function () {\n var dragging = _this.state.dragging;\n\n if (dragging) {\n _this.setState({\n dragging: false,\n dropPosition: null,\n dropContainerKey: null,\n dropTargetKey: null,\n dropLevelOffset: null,\n dropAllowed: true,\n dragOverNodeKey: null\n });\n }\n\n _this.dragStartMousePosition = null;\n };\n\n _this.onNodeClick = function (e, treeNode) {\n var onClick = _this.props.onClick;\n\n if (onClick) {\n onClick(e, treeNode);\n }\n };\n\n _this.onNodeDoubleClick = function (e, treeNode) {\n var onDoubleClick = _this.props.onDoubleClick;\n\n if (onDoubleClick) {\n onDoubleClick(e, treeNode);\n }\n };\n\n _this.onNodeSelect = function (e, treeNode) {\n var selectedKeys = _this.state.selectedKeys;\n var keyEntities = _this.state.keyEntities;\n var _this$props3 = _this.props,\n onSelect = _this$props3.onSelect,\n multiple = _this$props3.multiple;\n var selected = treeNode.selected,\n key = treeNode.key;\n var targetSelected = !selected; // Update selected keys\n\n if (!targetSelected) {\n selectedKeys = arrDel(selectedKeys, key);\n } else if (!multiple) {\n selectedKeys = [key];\n } else {\n selectedKeys = arrAdd(selectedKeys, key);\n } // [Legacy] Not found related usage in doc or upper libs\n\n\n var selectedNodes = selectedKeys.map(function (selectedKey) {\n var entity = keyEntities[selectedKey];\n if (!entity) return null;\n return entity.node;\n }).filter(function (node) {\n return node;\n });\n\n _this.setUncontrolledState({\n selectedKeys: selectedKeys\n });\n\n if (onSelect) {\n onSelect(selectedKeys, {\n event: 'select',\n selected: targetSelected,\n node: treeNode,\n selectedNodes: selectedNodes,\n nativeEvent: e.nativeEvent\n });\n }\n };\n\n _this.onNodeCheck = function (e, treeNode, checked) {\n var _this$state5 = _this.state,\n keyEntities = _this$state5.keyEntities,\n oriCheckedKeys = _this$state5.checkedKeys,\n oriHalfCheckedKeys = _this$state5.halfCheckedKeys;\n var _this$props4 = _this.props,\n checkStrictly = _this$props4.checkStrictly,\n onCheck = _this$props4.onCheck;\n var key = treeNode.key; // Prepare trigger arguments\n\n var checkedObj;\n var eventObj = {\n event: 'check',\n node: treeNode,\n checked: checked,\n nativeEvent: e.nativeEvent\n };\n\n if (checkStrictly) {\n var checkedKeys = checked ? arrAdd(oriCheckedKeys, key) : arrDel(oriCheckedKeys, key);\n var halfCheckedKeys = arrDel(oriHalfCheckedKeys, key);\n checkedObj = {\n checked: checkedKeys,\n halfChecked: halfCheckedKeys\n };\n eventObj.checkedNodes = checkedKeys.map(function (checkedKey) {\n return keyEntities[checkedKey];\n }).filter(function (entity) {\n return entity;\n }).map(function (entity) {\n return entity.node;\n });\n\n _this.setUncontrolledState({\n checkedKeys: checkedKeys\n });\n } else {\n // Always fill first\n var _conductCheck = conductCheck([].concat(_toConsumableArray(oriCheckedKeys), [key]), true, keyEntities),\n _checkedKeys = _conductCheck.checkedKeys,\n _halfCheckedKeys = _conductCheck.halfCheckedKeys; // If remove, we do it again to correction\n\n\n if (!checked) {\n var keySet = new Set(_checkedKeys);\n keySet.delete(key);\n\n var _conductCheck2 = conductCheck(Array.from(keySet), {\n checked: false,\n halfCheckedKeys: _halfCheckedKeys\n }, keyEntities);\n\n _checkedKeys = _conductCheck2.checkedKeys;\n _halfCheckedKeys = _conductCheck2.halfCheckedKeys;\n }\n\n checkedObj = _checkedKeys; // [Legacy] This is used for `rc-tree-select`\n\n eventObj.checkedNodes = [];\n eventObj.checkedNodesPositions = [];\n eventObj.halfCheckedKeys = _halfCheckedKeys;\n\n _checkedKeys.forEach(function (checkedKey) {\n var entity = keyEntities[checkedKey];\n if (!entity) return;\n var node = entity.node,\n pos = entity.pos;\n eventObj.checkedNodes.push(node);\n eventObj.checkedNodesPositions.push({\n node: node,\n pos: pos\n });\n });\n\n _this.setUncontrolledState({\n checkedKeys: _checkedKeys\n }, false, {\n halfCheckedKeys: _halfCheckedKeys\n });\n }\n\n if (onCheck) {\n onCheck(checkedObj, eventObj);\n }\n };\n\n _this.onNodeLoad = function (treeNode) {\n return new Promise(function (resolve) {\n // We need to get the latest state of loading/loaded keys\n _this.setState(function (_ref) {\n var _ref$loadedKeys = _ref.loadedKeys,\n loadedKeys = _ref$loadedKeys === void 0 ? [] : _ref$loadedKeys,\n _ref$loadingKeys = _ref.loadingKeys,\n loadingKeys = _ref$loadingKeys === void 0 ? [] : _ref$loadingKeys;\n var _this$props5 = _this.props,\n loadData = _this$props5.loadData,\n onLoad = _this$props5.onLoad;\n var key = treeNode.key;\n\n if (!loadData || loadedKeys.indexOf(key) !== -1 || loadingKeys.indexOf(key) !== -1) {\n // react 15 will warn if return null\n return {};\n } // Process load data\n\n\n var promise = loadData(treeNode);\n promise.then(function () {\n var _this$state6 = _this.state,\n currentLoadedKeys = _this$state6.loadedKeys,\n currentLoadingKeys = _this$state6.loadingKeys;\n var newLoadedKeys = arrAdd(currentLoadedKeys, key);\n var newLoadingKeys = arrDel(currentLoadingKeys, key); // onLoad should trigger before internal setState to avoid `loadData` trigger twice.\n // https://github.com/ant-design/ant-design/issues/12464\n\n if (onLoad) {\n onLoad(newLoadedKeys, {\n event: 'load',\n node: treeNode\n });\n }\n\n _this.setUncontrolledState({\n loadedKeys: newLoadedKeys\n });\n\n _this.setState({\n loadingKeys: newLoadingKeys\n });\n\n resolve();\n });\n return {\n loadingKeys: arrAdd(loadingKeys, key)\n };\n });\n });\n };\n\n _this.onNodeMouseEnter = function (event, node) {\n var onMouseEnter = _this.props.onMouseEnter;\n\n if (onMouseEnter) {\n onMouseEnter({\n event: event,\n node: node\n });\n }\n };\n\n _this.onNodeMouseLeave = function (event, node) {\n var onMouseLeave = _this.props.onMouseLeave;\n\n if (onMouseLeave) {\n onMouseLeave({\n event: event,\n node: node\n });\n }\n };\n\n _this.onNodeContextMenu = function (event, node) {\n var onRightClick = _this.props.onRightClick;\n\n if (onRightClick) {\n event.preventDefault();\n onRightClick({\n event: event,\n node: node\n });\n }\n };\n\n _this.onFocus = function () {\n var onFocus = _this.props.onFocus;\n\n _this.setState({\n focused: true\n });\n\n if (onFocus) {\n onFocus.apply(void 0, arguments);\n }\n };\n\n _this.onBlur = function () {\n var onBlur = _this.props.onBlur;\n\n _this.setState({\n focused: false\n });\n\n _this.onActiveChange(null);\n\n if (onBlur) {\n onBlur.apply(void 0, arguments);\n }\n };\n\n _this.getTreeNodeRequiredProps = function () {\n var _this$state7 = _this.state,\n expandedKeys = _this$state7.expandedKeys,\n selectedKeys = _this$state7.selectedKeys,\n loadedKeys = _this$state7.loadedKeys,\n loadingKeys = _this$state7.loadingKeys,\n checkedKeys = _this$state7.checkedKeys,\n halfCheckedKeys = _this$state7.halfCheckedKeys,\n dragOverNodeKey = _this$state7.dragOverNodeKey,\n dropPosition = _this$state7.dropPosition,\n keyEntities = _this$state7.keyEntities;\n return {\n expandedKeys: expandedKeys || [],\n selectedKeys: selectedKeys || [],\n loadedKeys: loadedKeys || [],\n loadingKeys: loadingKeys || [],\n checkedKeys: checkedKeys || [],\n halfCheckedKeys: halfCheckedKeys || [],\n dragOverNodeKey: dragOverNodeKey,\n dropPosition: dropPosition,\n keyEntities: keyEntities\n };\n }; // =========================== Expanded ===========================\n\n /** Set uncontrolled `expandedKeys`. This will also auto update `flattenNodes`. */\n\n\n _this.setExpandedKeys = function (expandedKeys) {\n var treeData = _this.state.treeData;\n var flattenNodes = flattenTreeData(treeData, expandedKeys);\n\n _this.setUncontrolledState({\n expandedKeys: expandedKeys,\n flattenNodes: flattenNodes\n }, true);\n };\n\n _this.onNodeExpand = function (e, treeNode) {\n var expandedKeys = _this.state.expandedKeys;\n var listChanging = _this.state.listChanging;\n var _this$props6 = _this.props,\n onExpand = _this$props6.onExpand,\n loadData = _this$props6.loadData;\n var key = treeNode.key,\n expanded = treeNode.expanded; // Do nothing when motion is in progress\n\n if (listChanging) {\n return;\n } // Update selected keys\n\n\n var index = expandedKeys.indexOf(key);\n var targetExpanded = !expanded;\n warning(expanded && index !== -1 || !expanded && index === -1, 'Expand state not sync with index check');\n\n if (targetExpanded) {\n expandedKeys = arrAdd(expandedKeys, key);\n } else {\n expandedKeys = arrDel(expandedKeys, key);\n }\n\n _this.setExpandedKeys(expandedKeys);\n\n if (onExpand) {\n onExpand(expandedKeys, {\n node: treeNode,\n expanded: targetExpanded,\n nativeEvent: e.nativeEvent\n });\n } // Async Load data\n\n\n if (targetExpanded && loadData) {\n var loadPromise = _this.onNodeLoad(treeNode);\n\n if (loadPromise) {\n loadPromise.then(function () {\n // [Legacy] Refresh logic\n var newFlattenTreeData = flattenTreeData(_this.state.treeData, expandedKeys);\n\n _this.setUncontrolledState({\n flattenNodes: newFlattenTreeData\n });\n });\n }\n }\n };\n\n _this.onListChangeStart = function () {\n _this.setUncontrolledState({\n listChanging: true\n });\n };\n\n _this.onListChangeEnd = function () {\n setTimeout(function () {\n _this.setUncontrolledState({\n listChanging: false\n });\n });\n }; // =========================== Keyboard ===========================\n\n\n _this.onActiveChange = function (newActiveKey) {\n var activeKey = _this.state.activeKey;\n var onActiveChange = _this.props.onActiveChange;\n\n if (activeKey === newActiveKey) {\n return;\n }\n\n _this.setState({\n activeKey: newActiveKey\n });\n\n if (newActiveKey !== null) {\n _this.scrollTo({\n key: newActiveKey\n });\n }\n\n if (onActiveChange) {\n onActiveChange(newActiveKey);\n }\n };\n\n _this.getActiveItem = function () {\n var _this$state8 = _this.state,\n activeKey = _this$state8.activeKey,\n flattenNodes = _this$state8.flattenNodes;\n\n if (activeKey === null) {\n return null;\n }\n\n return flattenNodes.find(function (_ref2) {\n var key = _ref2.data.key;\n return key === activeKey;\n }) || null;\n };\n\n _this.offsetActiveKey = function (offset) {\n var _this$state9 = _this.state,\n flattenNodes = _this$state9.flattenNodes,\n activeKey = _this$state9.activeKey;\n var index = flattenNodes.findIndex(function (_ref3) {\n var key = _ref3.data.key;\n return key === activeKey;\n }); // Align with index\n\n if (index === -1 && offset < 0) {\n index = flattenNodes.length;\n }\n\n index = (index + offset + flattenNodes.length) % flattenNodes.length;\n var item = flattenNodes[index];\n\n if (item) {\n var key = item.data.key;\n\n _this.onActiveChange(key);\n } else {\n _this.onActiveChange(null);\n }\n };\n\n _this.onKeyDown = function (event) {\n var _this$state10 = _this.state,\n activeKey = _this$state10.activeKey,\n expandedKeys = _this$state10.expandedKeys,\n checkedKeys = _this$state10.checkedKeys;\n var _this$props7 = _this.props,\n onKeyDown = _this$props7.onKeyDown,\n checkable = _this$props7.checkable,\n selectable = _this$props7.selectable; // >>>>>>>>>> Direction\n\n switch (event.which) {\n case KeyCode.UP:\n {\n _this.offsetActiveKey(-1);\n\n event.preventDefault();\n break;\n }\n\n case KeyCode.DOWN:\n {\n _this.offsetActiveKey(1);\n\n event.preventDefault();\n break;\n }\n } // >>>>>>>>>> Expand & Selection\n\n\n var activeItem = _this.getActiveItem();\n\n if (activeItem && activeItem.data) {\n var treeNodeRequiredProps = _this.getTreeNodeRequiredProps();\n\n var expandable = activeItem.data.isLeaf === false || !!(activeItem.data.children || []).length;\n var eventNode = convertNodePropsToEventData(_objectSpread(_objectSpread({}, getTreeNodeProps(activeKey, treeNodeRequiredProps)), {}, {\n data: activeItem.data,\n active: true\n }));\n\n switch (event.which) {\n // >>> Expand\n case KeyCode.LEFT:\n {\n // Collapse if possible\n if (expandable && expandedKeys.includes(activeKey)) {\n _this.onNodeExpand({}, eventNode);\n } else if (activeItem.parent) {\n _this.onActiveChange(activeItem.parent.data.key);\n }\n\n event.preventDefault();\n break;\n }\n\n case KeyCode.RIGHT:\n {\n // Expand if possible\n if (expandable && !expandedKeys.includes(activeKey)) {\n _this.onNodeExpand({}, eventNode);\n } else if (activeItem.children && activeItem.children.length) {\n _this.onActiveChange(activeItem.children[0].data.key);\n }\n\n event.preventDefault();\n break;\n }\n // Selection\n\n case KeyCode.ENTER:\n case KeyCode.SPACE:\n {\n if (checkable && !eventNode.disabled && eventNode.checkable !== false && !eventNode.disableCheckbox) {\n _this.onNodeCheck({}, eventNode, !checkedKeys.includes(activeKey));\n } else if (!checkable && selectable && !eventNode.disabled && eventNode.selectable !== false) {\n _this.onNodeSelect({}, eventNode);\n }\n\n break;\n }\n }\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n /**\n * Only update the value which is not in props\n */\n\n\n _this.setUncontrolledState = function (state) {\n var atomic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var forceState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n if (_this.destroyed) {\n return;\n }\n\n var needSync = false;\n var allPassed = true;\n var newState = {};\n Object.keys(state).forEach(function (name) {\n if (name in _this.props) {\n allPassed = false;\n return;\n }\n\n needSync = true;\n newState[name] = state[name];\n });\n\n if (needSync && (!atomic || allPassed)) {\n _this.setState(_objectSpread(_objectSpread({}, newState), forceState));\n }\n };\n\n _this.scrollTo = function (scroll) {\n _this.listRef.current.scrollTo(scroll);\n };\n\n return _this;\n }\n\n _createClass(Tree, [{\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n window.removeEventListener('dragend', this.onWindowDragEnd);\n this.destroyed = true;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _classNames;\n\n var _this$state11 = this.state,\n focused = _this$state11.focused,\n flattenNodes = _this$state11.flattenNodes,\n keyEntities = _this$state11.keyEntities,\n dragging = _this$state11.dragging,\n activeKey = _this$state11.activeKey,\n dropLevelOffset = _this$state11.dropLevelOffset,\n dropContainerKey = _this$state11.dropContainerKey,\n dropTargetKey = _this$state11.dropTargetKey,\n dropPosition = _this$state11.dropPosition,\n dragOverNodeKey = _this$state11.dragOverNodeKey,\n indent = _this$state11.indent;\n var _this$props8 = this.props,\n prefixCls = _this$props8.prefixCls,\n className = _this$props8.className,\n style = _this$props8.style,\n showLine = _this$props8.showLine,\n focusable = _this$props8.focusable,\n _this$props8$tabIndex = _this$props8.tabIndex,\n tabIndex = _this$props8$tabIndex === void 0 ? 0 : _this$props8$tabIndex,\n selectable = _this$props8.selectable,\n showIcon = _this$props8.showIcon,\n icon = _this$props8.icon,\n switcherIcon = _this$props8.switcherIcon,\n draggable = _this$props8.draggable,\n checkable = _this$props8.checkable,\n checkStrictly = _this$props8.checkStrictly,\n disabled = _this$props8.disabled,\n motion = _this$props8.motion,\n loadData = _this$props8.loadData,\n filterTreeNode = _this$props8.filterTreeNode,\n height = _this$props8.height,\n itemHeight = _this$props8.itemHeight,\n virtual = _this$props8.virtual,\n titleRender = _this$props8.titleRender,\n dropIndicatorRender = _this$props8.dropIndicatorRender,\n onContextMenu = _this$props8.onContextMenu,\n direction = _this$props8.direction;\n var domProps = getDataAndAria(this.props);\n return /*#__PURE__*/React.createElement(TreeContext.Provider, {\n value: {\n prefixCls: prefixCls,\n selectable: selectable,\n showIcon: showIcon,\n icon: icon,\n switcherIcon: switcherIcon,\n draggable: draggable,\n checkable: checkable,\n checkStrictly: checkStrictly,\n disabled: disabled,\n keyEntities: keyEntities,\n dropLevelOffset: dropLevelOffset,\n dropContainerKey: dropContainerKey,\n dropTargetKey: dropTargetKey,\n dropPosition: dropPosition,\n dragOverNodeKey: dragOverNodeKey,\n indent: indent,\n direction: direction,\n dropIndicatorRender: dropIndicatorRender,\n loadData: loadData,\n filterTreeNode: filterTreeNode,\n titleRender: titleRender,\n onNodeClick: this.onNodeClick,\n onNodeDoubleClick: this.onNodeDoubleClick,\n onNodeExpand: this.onNodeExpand,\n onNodeSelect: this.onNodeSelect,\n onNodeCheck: this.onNodeCheck,\n onNodeLoad: this.onNodeLoad,\n onNodeMouseEnter: this.onNodeMouseEnter,\n onNodeMouseLeave: this.onNodeMouseLeave,\n onNodeContextMenu: this.onNodeContextMenu,\n onNodeDragStart: this.onNodeDragStart,\n onNodeDragEnter: this.onNodeDragEnter,\n onNodeDragOver: this.onNodeDragOver,\n onNodeDragLeave: this.onNodeDragLeave,\n onNodeDragEnd: this.onNodeDragEnd,\n onNodeDrop: this.onNodeDrop\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: classNames(prefixCls, className, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-show-line\"), showLine), _defineProperty(_classNames, \"\".concat(prefixCls, \"-focused\"), focused), _defineProperty(_classNames, \"\".concat(prefixCls, \"-active-focused\"), activeKey !== null), _classNames))\n }, /*#__PURE__*/React.createElement(NodeList, Object.assign({\n ref: this.listRef,\n prefixCls: prefixCls,\n style: style,\n data: flattenNodes,\n disabled: disabled,\n selectable: selectable,\n checkable: !!checkable,\n motion: motion,\n dragging: dragging,\n height: height,\n itemHeight: itemHeight,\n virtual: virtual,\n focusable: focusable,\n focused: focused,\n tabIndex: tabIndex,\n activeItem: this.getActiveItem(),\n onFocus: this.onFocus,\n onBlur: this.onBlur,\n onKeyDown: this.onKeyDown,\n onActiveChange: this.onActiveChange,\n onListChangeStart: this.onListChangeStart,\n onListChangeEnd: this.onListChangeEnd,\n onContextMenu: onContextMenu\n }, this.getTreeNodeRequiredProps(), domProps))));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(props, prevState) {\n var prevProps = prevState.prevProps;\n var newState = {\n prevProps: props\n };\n\n function needSync(name) {\n return !prevProps && name in props || prevProps && prevProps[name] !== props[name];\n } // ================== Tree Node ==================\n\n\n var treeData; // Check if `treeData` or `children` changed and save into the state.\n\n if (needSync('treeData')) {\n treeData = props.treeData;\n } else if (needSync('children')) {\n warning(false, '`children` of Tree is deprecated. Please use `treeData` instead.');\n treeData = convertTreeToData(props.children);\n } // Save flatten nodes info and convert `treeData` into keyEntities\n\n\n if (treeData) {\n newState.treeData = treeData;\n var entitiesMap = convertDataToEntities(treeData);\n newState.keyEntities = _objectSpread(_defineProperty({}, MOTION_KEY, MotionEntity), entitiesMap.keyEntities); // Warning if treeNode not provide key\n\n if (process.env.NODE_ENV !== 'production') {\n warningWithoutKey(treeData);\n }\n }\n\n var keyEntities = newState.keyEntities || prevState.keyEntities; // ================ expandedKeys =================\n\n if (needSync('expandedKeys') || prevProps && needSync('autoExpandParent')) {\n newState.expandedKeys = props.autoExpandParent || !prevProps && props.defaultExpandParent ? conductExpandParent(props.expandedKeys, keyEntities) : props.expandedKeys;\n } else if (!prevProps && props.defaultExpandAll) {\n var cloneKeyEntities = _objectSpread({}, keyEntities);\n\n delete cloneKeyEntities[MOTION_KEY];\n newState.expandedKeys = Object.keys(cloneKeyEntities).map(function (key) {\n return cloneKeyEntities[key].key;\n });\n } else if (!prevProps && props.defaultExpandedKeys) {\n newState.expandedKeys = props.autoExpandParent || props.defaultExpandParent ? conductExpandParent(props.defaultExpandedKeys, keyEntities) : props.defaultExpandedKeys;\n }\n\n if (!newState.expandedKeys) {\n delete newState.expandedKeys;\n } // ================ flattenNodes =================\n\n\n if (treeData || newState.expandedKeys) {\n var flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys);\n newState.flattenNodes = flattenNodes;\n } // ================ selectedKeys =================\n\n\n if (props.selectable) {\n if (needSync('selectedKeys')) {\n newState.selectedKeys = calcSelectedKeys(props.selectedKeys, props);\n } else if (!prevProps && props.defaultSelectedKeys) {\n newState.selectedKeys = calcSelectedKeys(props.defaultSelectedKeys, props);\n }\n } // ================= checkedKeys =================\n\n\n if (props.checkable) {\n var checkedKeyEntity;\n\n if (needSync('checkedKeys')) {\n checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {};\n } else if (!prevProps && props.defaultCheckedKeys) {\n checkedKeyEntity = parseCheckedKeys(props.defaultCheckedKeys) || {};\n } else if (treeData) {\n // If `treeData` changed, we also need check it\n checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {\n checkedKeys: prevState.checkedKeys,\n halfCheckedKeys: prevState.halfCheckedKeys\n };\n }\n\n if (checkedKeyEntity) {\n var _checkedKeyEntity = checkedKeyEntity,\n _checkedKeyEntity$che = _checkedKeyEntity.checkedKeys,\n checkedKeys = _checkedKeyEntity$che === void 0 ? [] : _checkedKeyEntity$che,\n _checkedKeyEntity$hal = _checkedKeyEntity.halfCheckedKeys,\n halfCheckedKeys = _checkedKeyEntity$hal === void 0 ? [] : _checkedKeyEntity$hal;\n\n if (!props.checkStrictly) {\n var conductKeys = conductCheck(checkedKeys, true, keyEntities);\n checkedKeys = conductKeys.checkedKeys;\n halfCheckedKeys = conductKeys.halfCheckedKeys;\n }\n\n newState.checkedKeys = checkedKeys;\n newState.halfCheckedKeys = halfCheckedKeys;\n }\n } // ================= loadedKeys ==================\n\n\n if (needSync('loadedKeys')) {\n newState.loadedKeys = props.loadedKeys;\n }\n\n return newState;\n }\n }]);\n\n return Tree;\n}(React.Component);\n\nTree.defaultProps = {\n prefixCls: 'rc-tree',\n showLine: false,\n showIcon: true,\n selectable: true,\n multiple: false,\n checkable: false,\n disabled: false,\n checkStrictly: false,\n draggable: false,\n defaultExpandParent: true,\n autoExpandParent: false,\n defaultExpandAll: false,\n defaultExpandedKeys: [],\n defaultCheckedKeys: [],\n defaultSelectedKeys: [],\n dropIndicatorRender: DropIndicator,\n allowDrop: function allowDrop() {\n return true;\n }\n};\nTree.TreeNode = TreeNode;\nexport default Tree;"]},"metadata":{},"sourceType":"module"}