12a3a28d8cd6cd7f9b7516879ded9d16.json
31.2 KB
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\n/**\n * Handle virtual list of the TreeNodes.\n */\n\nimport * as React from 'react';\nimport VirtualList from 'rc-virtual-list';\nimport MotionTreeNode from './MotionTreeNode';\nimport { findExpandedKeys, getExpandRange } from './utils/diffUtil';\nimport { getTreeNodeProps, getKey } from './utils/treeUtil';\nvar HIDDEN_STYLE = {\n width: 0,\n height: 0,\n display: 'flex',\n overflow: 'hidden',\n opacity: 0,\n border: 0,\n padding: 0,\n margin: 0\n};\n\nvar noop = function noop() {};\n\nexport var MOTION_KEY = \"RC_TREE_MOTION_\".concat(Math.random());\nvar MotionNode = {\n key: MOTION_KEY\n};\nexport var MotionEntity = {\n key: MOTION_KEY,\n level: 0,\n index: 0,\n pos: '0',\n node: MotionNode\n};\nvar MotionFlattenData = {\n parent: null,\n children: [],\n pos: MotionEntity.pos,\n data: MotionNode,\n\n /** Hold empty list here since we do not use it */\n isStart: [],\n isEnd: []\n};\n/**\n * We only need get visible content items to play the animation.\n */\n\nexport function getMinimumRangeTransitionRange(list, virtual, height, itemHeight) {\n if (virtual === false || !height) {\n return list;\n }\n\n return list.slice(0, Math.ceil(height / itemHeight) + 1);\n}\n\nfunction itemKey(item) {\n var key = item.data.key,\n pos = item.pos;\n return getKey(key, pos);\n}\n\nfunction getAccessibilityPath(item) {\n var path = String(item.data.key);\n var current = item;\n\n while (current.parent) {\n current = current.parent;\n path = \"\".concat(current.data.key, \" > \").concat(path);\n }\n\n return path;\n}\n\nvar RefNodeList = function RefNodeList(props, ref) {\n var prefixCls = props.prefixCls,\n data = props.data,\n selectable = props.selectable,\n checkable = props.checkable,\n expandedKeys = props.expandedKeys,\n selectedKeys = props.selectedKeys,\n checkedKeys = props.checkedKeys,\n loadedKeys = props.loadedKeys,\n loadingKeys = props.loadingKeys,\n halfCheckedKeys = props.halfCheckedKeys,\n keyEntities = props.keyEntities,\n disabled = props.disabled,\n dragging = props.dragging,\n dragOverNodeKey = props.dragOverNodeKey,\n dropPosition = props.dropPosition,\n motion = props.motion,\n height = props.height,\n itemHeight = props.itemHeight,\n virtual = props.virtual,\n focusable = props.focusable,\n activeItem = props.activeItem,\n focused = props.focused,\n tabIndex = props.tabIndex,\n onKeyDown = props.onKeyDown,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n onActiveChange = props.onActiveChange,\n onListChangeStart = props.onListChangeStart,\n onListChangeEnd = props.onListChangeEnd,\n domProps = _objectWithoutProperties(props, [\"prefixCls\", \"data\", \"selectable\", \"checkable\", \"expandedKeys\", \"selectedKeys\", \"checkedKeys\", \"loadedKeys\", \"loadingKeys\", \"halfCheckedKeys\", \"keyEntities\", \"disabled\", \"dragging\", \"dragOverNodeKey\", \"dropPosition\", \"motion\", \"height\", \"itemHeight\", \"virtual\", \"focusable\", \"activeItem\", \"focused\", \"tabIndex\", \"onKeyDown\", \"onFocus\", \"onBlur\", \"onActiveChange\", \"onListChangeStart\", \"onListChangeEnd\"]); // =============================== Ref ================================\n\n\n var listRef = React.useRef(null);\n var indentMeasurerRef = React.useRef(null);\n React.useImperativeHandle(ref, function () {\n return {\n scrollTo: function scrollTo(scroll) {\n listRef.current.scrollTo(scroll);\n },\n getIndentWidth: function getIndentWidth() {\n return indentMeasurerRef.current.offsetWidth;\n }\n };\n }); // ============================== Motion ==============================\n\n var _React$useState = React.useState(expandedKeys),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n prevExpandedKeys = _React$useState2[0],\n setPrevExpandedKeys = _React$useState2[1];\n\n var _React$useState3 = React.useState(data),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n prevData = _React$useState4[0],\n setPrevData = _React$useState4[1];\n\n var _React$useState5 = React.useState(data),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n transitionData = _React$useState6[0],\n setTransitionData = _React$useState6[1];\n\n var _React$useState7 = React.useState([]),\n _React$useState8 = _slicedToArray(_React$useState7, 2),\n transitionRange = _React$useState8[0],\n setTransitionRange = _React$useState8[1];\n\n var _React$useState9 = React.useState(null),\n _React$useState10 = _slicedToArray(_React$useState9, 2),\n motionType = _React$useState10[0],\n setMotionType = _React$useState10[1];\n\n function onMotionEnd() {\n setPrevData(data);\n setTransitionData(data);\n setTransitionRange([]);\n setMotionType(null);\n onListChangeEnd();\n } // Do animation if expanded keys changed\n\n\n React.useEffect(function () {\n setPrevExpandedKeys(expandedKeys);\n var diffExpanded = findExpandedKeys(prevExpandedKeys, expandedKeys);\n\n if (diffExpanded.key !== null) {\n if (diffExpanded.add) {\n var keyIndex = prevData.findIndex(function (_ref) {\n var key = _ref.data.key;\n return key === diffExpanded.key;\n });\n var rangeNodes = getMinimumRangeTransitionRange(getExpandRange(prevData, data, diffExpanded.key), virtual, height, itemHeight);\n var newTransitionData = prevData.slice();\n newTransitionData.splice(keyIndex + 1, 0, MotionFlattenData);\n setTransitionData(newTransitionData);\n setTransitionRange(rangeNodes);\n setMotionType('show');\n } else {\n var _keyIndex = data.findIndex(function (_ref2) {\n var key = _ref2.data.key;\n return key === diffExpanded.key;\n });\n\n var _rangeNodes = getMinimumRangeTransitionRange(getExpandRange(data, prevData, diffExpanded.key), virtual, height, itemHeight);\n\n var _newTransitionData = data.slice();\n\n _newTransitionData.splice(_keyIndex + 1, 0, MotionFlattenData);\n\n setTransitionData(_newTransitionData);\n setTransitionRange(_rangeNodes);\n setMotionType('hide');\n }\n } else if (prevData !== data) {\n // If whole data changed, we just refresh the list\n setPrevData(data);\n setTransitionData(data);\n }\n }, [expandedKeys, data]); // We should clean up motion if is changed by dragging\n\n React.useEffect(function () {\n if (!dragging) {\n onMotionEnd();\n }\n }, [dragging]);\n var mergedData = motion ? transitionData : data;\n var treeNodeRequiredProps = {\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 return /*#__PURE__*/React.createElement(React.Fragment, null, focused && activeItem && /*#__PURE__*/React.createElement(\"span\", {\n style: HIDDEN_STYLE,\n \"aria-live\": \"assertive\"\n }, getAccessibilityPath(activeItem)), /*#__PURE__*/React.createElement(\"div\", {\n role: \"tree\"\n }, /*#__PURE__*/React.createElement(\"input\", {\n style: HIDDEN_STYLE,\n disabled: focusable === false || disabled,\n tabIndex: focusable !== false ? tabIndex : null,\n onKeyDown: onKeyDown,\n onFocus: onFocus,\n onBlur: onBlur,\n value: \"\",\n onChange: noop\n })), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-treenode\"),\n \"aria-hidden\": true,\n style: {\n position: 'absolute',\n pointerEvents: 'none',\n visibility: 'hidden',\n height: 0,\n overflow: 'hidden'\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-indent\")\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: indentMeasurerRef,\n className: \"\".concat(prefixCls, \"-indent-unit\")\n }))), /*#__PURE__*/React.createElement(VirtualList, Object.assign({}, domProps, {\n data: mergedData,\n itemKey: itemKey,\n height: height,\n fullHeight: false,\n virtual: virtual,\n itemHeight: itemHeight,\n prefixCls: \"\".concat(prefixCls, \"-list\"),\n ref: listRef\n }), function (treeNode) {\n var pos = treeNode.pos,\n _treeNode$data = treeNode.data,\n key = _treeNode$data.key,\n restProps = _objectWithoutProperties(_treeNode$data, [\"key\"]),\n isStart = treeNode.isStart,\n isEnd = treeNode.isEnd;\n\n var mergedKey = getKey(key, pos);\n delete restProps.children;\n var treeNodeProps = getTreeNodeProps(mergedKey, treeNodeRequiredProps);\n return /*#__PURE__*/React.createElement(MotionTreeNode, Object.assign({}, restProps, treeNodeProps, {\n active: !!activeItem && key === activeItem.data.key,\n pos: pos,\n data: treeNode.data,\n isStart: isStart,\n isEnd: isEnd,\n motion: motion,\n motionNodes: key === MOTION_KEY ? transitionRange : null,\n motionType: motionType,\n onMotionStart: onListChangeStart,\n onMotionEnd: onMotionEnd,\n treeNodeRequiredProps: treeNodeRequiredProps,\n onMouseMove: function onMouseMove() {\n onActiveChange(null);\n }\n }));\n }));\n};\n\nvar NodeList = /*#__PURE__*/React.forwardRef(RefNodeList);\nNodeList.displayName = 'NodeList';\nexport default NodeList;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-tree/es/NodeList.js"],"names":["_slicedToArray","_objectWithoutProperties","React","VirtualList","MotionTreeNode","findExpandedKeys","getExpandRange","getTreeNodeProps","getKey","HIDDEN_STYLE","width","height","display","overflow","opacity","border","padding","margin","noop","MOTION_KEY","concat","Math","random","MotionNode","key","MotionEntity","level","index","pos","node","MotionFlattenData","parent","children","data","isStart","isEnd","getMinimumRangeTransitionRange","list","virtual","itemHeight","slice","ceil","itemKey","item","getAccessibilityPath","path","String","current","RefNodeList","props","ref","prefixCls","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd","domProps","listRef","useRef","indentMeasurerRef","useImperativeHandle","scrollTo","scroll","getIndentWidth","offsetWidth","_React$useState","useState","_React$useState2","prevExpandedKeys","setPrevExpandedKeys","_React$useState3","_React$useState4","prevData","setPrevData","_React$useState5","_React$useState6","transitionData","setTransitionData","_React$useState7","_React$useState8","transitionRange","setTransitionRange","_React$useState9","_React$useState10","motionType","setMotionType","onMotionEnd","useEffect","diffExpanded","add","keyIndex","findIndex","_ref","rangeNodes","newTransitionData","splice","_keyIndex","_ref2","_rangeNodes","_newTransitionData","mergedData","treeNodeRequiredProps","createElement","Fragment","style","role","value","onChange","className","position","pointerEvents","visibility","Object","assign","fullHeight","treeNode","_treeNode$data","restProps","mergedKey","treeNodeProps","active","motionNodes","onMotionStart","onMouseMove","NodeList","forwardRef","displayName"],"mappings":"AAAA,OAAOA,cAAP,MAA2B,0CAA3B;AACA,OAAOC,wBAAP,MAAqC,oDAArC;AAEA;AACA;AACA;;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,SAASC,gBAAT,EAA2BC,cAA3B,QAAiD,kBAAjD;AACA,SAASC,gBAAT,EAA2BC,MAA3B,QAAyC,kBAAzC;AACA,IAAIC,YAAY,GAAG;AACjBC,EAAAA,KAAK,EAAE,CADU;AAEjBC,EAAAA,MAAM,EAAE,CAFS;AAGjBC,EAAAA,OAAO,EAAE,MAHQ;AAIjBC,EAAAA,QAAQ,EAAE,QAJO;AAKjBC,EAAAA,OAAO,EAAE,CALQ;AAMjBC,EAAAA,MAAM,EAAE,CANS;AAOjBC,EAAAA,OAAO,EAAE,CAPQ;AAQjBC,EAAAA,MAAM,EAAE;AARS,CAAnB;;AAWA,IAAIC,IAAI,GAAG,SAASA,IAAT,GAAgB,CAAE,CAA7B;;AAEA,OAAO,IAAIC,UAAU,GAAG,kBAAkBC,MAAlB,CAAyBC,IAAI,CAACC,MAAL,EAAzB,CAAjB;AACP,IAAIC,UAAU,GAAG;AACfC,EAAAA,GAAG,EAAEL;AADU,CAAjB;AAGA,OAAO,IAAIM,YAAY,GAAG;AACxBD,EAAAA,GAAG,EAAEL,UADmB;AAExBO,EAAAA,KAAK,EAAE,CAFiB;AAGxBC,EAAAA,KAAK,EAAE,CAHiB;AAIxBC,EAAAA,GAAG,EAAE,GAJmB;AAKxBC,EAAAA,IAAI,EAAEN;AALkB,CAAnB;AAOP,IAAIO,iBAAiB,GAAG;AACtBC,EAAAA,MAAM,EAAE,IADc;AAEtBC,EAAAA,QAAQ,EAAE,EAFY;AAGtBJ,EAAAA,GAAG,E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,GAAGpI,gBAAgB,CAACmI,SAAD,EAAYjB,qBAAZ,CAApC;AACA,WAAO,aAAavH,KAAK,CAACwH,aAAN,CAAoBtH,cAApB,EAAoCgI,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBI,SAAlB,EAA6BE,aAA7B,EAA4C;AAClGC,MAAAA,MAAM,EAAE,CAAC,CAACzE,UAAF,IAAgB3C,GAAG,KAAK2C,UAAU,CAAClC,IAAX,CAAgBT,GADkD;AAElGI,MAAAA,GAAG,EAAEA,GAF6F;AAGlGK,MAAAA,IAAI,EAAEsG,QAAQ,CAACtG,IAHmF;AAIlGC,MAAAA,OAAO,EAAEA,OAJyF;AAKlGC,MAAAA,KAAK,EAAEA,KAL2F;AAMlG8B,MAAAA,MAAM,EAAEA,MAN0F;AAOlG4E,MAAAA,WAAW,EAAErH,GAAG,KAAKL,UAAR,GAAqBiF,eAArB,GAAuC,IAP8C;AAQlGI,MAAAA,UAAU,EAAEA,UARsF;AASlGsC,MAAAA,aAAa,EAAEpE,iBATmF;AAUlGgC,MAAAA,WAAW,EAAEA,WAVqF;AAWlGe,MAAAA,qBAAqB,EAAEA,qBAX2E;AAYlGsB,MAAAA,WAAW,EAAE,SAASA,WAAT,GAAuB;AAClCtE,QAAAA,cAAc,CAAC,IAAD,CAAd;AACD;AAdiG,KAA5C,CAApC,CAApB;AAgBD,GApCkB,CA7BC,CAApB;AAkED,CA1MD;;AA4MA,IAAIuE,QAAQ,GAAG,aAAa9I,KAAK,CAAC+I,UAAN,CAAiBjG,WAAjB,CAA5B;AACAgG,QAAQ,CAACE,WAAT,GAAuB,UAAvB;AACA,eAAeF,QAAf","sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\n\n/**\n * Handle virtual list of the TreeNodes.\n */\nimport * as React from 'react';\nimport VirtualList from 'rc-virtual-list';\nimport MotionTreeNode from './MotionTreeNode';\nimport { findExpandedKeys, getExpandRange } from './utils/diffUtil';\nimport { getTreeNodeProps, getKey } from './utils/treeUtil';\nvar HIDDEN_STYLE = {\n width: 0,\n height: 0,\n display: 'flex',\n overflow: 'hidden',\n opacity: 0,\n border: 0,\n padding: 0,\n margin: 0\n};\n\nvar noop = function noop() {};\n\nexport var MOTION_KEY = \"RC_TREE_MOTION_\".concat(Math.random());\nvar MotionNode = {\n key: MOTION_KEY\n};\nexport var MotionEntity = {\n key: MOTION_KEY,\n level: 0,\n index: 0,\n pos: '0',\n node: MotionNode\n};\nvar MotionFlattenData = {\n parent: null,\n children: [],\n pos: MotionEntity.pos,\n data: MotionNode,\n\n /** Hold empty list here since we do not use it */\n isStart: [],\n isEnd: []\n};\n/**\n * We only need get visible content items to play the animation.\n */\n\nexport function getMinimumRangeTransitionRange(list, virtual, height, itemHeight) {\n if (virtual === false || !height) {\n return list;\n }\n\n return list.slice(0, Math.ceil(height / itemHeight) + 1);\n}\n\nfunction itemKey(item) {\n var key = item.data.key,\n pos = item.pos;\n return getKey(key, pos);\n}\n\nfunction getAccessibilityPath(item) {\n var path = String(item.data.key);\n var current = item;\n\n while (current.parent) {\n current = current.parent;\n path = \"\".concat(current.data.key, \" > \").concat(path);\n }\n\n return path;\n}\n\nvar RefNodeList = function RefNodeList(props, ref) {\n var prefixCls = props.prefixCls,\n data = props.data,\n selectable = props.selectable,\n checkable = props.checkable,\n expandedKeys = props.expandedKeys,\n selectedKeys = props.selectedKeys,\n checkedKeys = props.checkedKeys,\n loadedKeys = props.loadedKeys,\n loadingKeys = props.loadingKeys,\n halfCheckedKeys = props.halfCheckedKeys,\n keyEntities = props.keyEntities,\n disabled = props.disabled,\n dragging = props.dragging,\n dragOverNodeKey = props.dragOverNodeKey,\n dropPosition = props.dropPosition,\n motion = props.motion,\n height = props.height,\n itemHeight = props.itemHeight,\n virtual = props.virtual,\n focusable = props.focusable,\n activeItem = props.activeItem,\n focused = props.focused,\n tabIndex = props.tabIndex,\n onKeyDown = props.onKeyDown,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n onActiveChange = props.onActiveChange,\n onListChangeStart = props.onListChangeStart,\n onListChangeEnd = props.onListChangeEnd,\n domProps = _objectWithoutProperties(props, [\"prefixCls\", \"data\", \"selectable\", \"checkable\", \"expandedKeys\", \"selectedKeys\", \"checkedKeys\", \"loadedKeys\", \"loadingKeys\", \"halfCheckedKeys\", \"keyEntities\", \"disabled\", \"dragging\", \"dragOverNodeKey\", \"dropPosition\", \"motion\", \"height\", \"itemHeight\", \"virtual\", \"focusable\", \"activeItem\", \"focused\", \"tabIndex\", \"onKeyDown\", \"onFocus\", \"onBlur\", \"onActiveChange\", \"onListChangeStart\", \"onListChangeEnd\"]); // =============================== Ref ================================\n\n\n var listRef = React.useRef(null);\n var indentMeasurerRef = React.useRef(null);\n React.useImperativeHandle(ref, function () {\n return {\n scrollTo: function scrollTo(scroll) {\n listRef.current.scrollTo(scroll);\n },\n getIndentWidth: function getIndentWidth() {\n return indentMeasurerRef.current.offsetWidth;\n }\n };\n }); // ============================== Motion ==============================\n\n var _React$useState = React.useState(expandedKeys),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n prevExpandedKeys = _React$useState2[0],\n setPrevExpandedKeys = _React$useState2[1];\n\n var _React$useState3 = React.useState(data),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n prevData = _React$useState4[0],\n setPrevData = _React$useState4[1];\n\n var _React$useState5 = React.useState(data),\n _React$useState6 = _slicedToArray(_React$useState5, 2),\n transitionData = _React$useState6[0],\n setTransitionData = _React$useState6[1];\n\n var _React$useState7 = React.useState([]),\n _React$useState8 = _slicedToArray(_React$useState7, 2),\n transitionRange = _React$useState8[0],\n setTransitionRange = _React$useState8[1];\n\n var _React$useState9 = React.useState(null),\n _React$useState10 = _slicedToArray(_React$useState9, 2),\n motionType = _React$useState10[0],\n setMotionType = _React$useState10[1];\n\n function onMotionEnd() {\n setPrevData(data);\n setTransitionData(data);\n setTransitionRange([]);\n setMotionType(null);\n onListChangeEnd();\n } // Do animation if expanded keys changed\n\n\n React.useEffect(function () {\n setPrevExpandedKeys(expandedKeys);\n var diffExpanded = findExpandedKeys(prevExpandedKeys, expandedKeys);\n\n if (diffExpanded.key !== null) {\n if (diffExpanded.add) {\n var keyIndex = prevData.findIndex(function (_ref) {\n var key = _ref.data.key;\n return key === diffExpanded.key;\n });\n var rangeNodes = getMinimumRangeTransitionRange(getExpandRange(prevData, data, diffExpanded.key), virtual, height, itemHeight);\n var newTransitionData = prevData.slice();\n newTransitionData.splice(keyIndex + 1, 0, MotionFlattenData);\n setTransitionData(newTransitionData);\n setTransitionRange(rangeNodes);\n setMotionType('show');\n } else {\n var _keyIndex = data.findIndex(function (_ref2) {\n var key = _ref2.data.key;\n return key === diffExpanded.key;\n });\n\n var _rangeNodes = getMinimumRangeTransitionRange(getExpandRange(data, prevData, diffExpanded.key), virtual, height, itemHeight);\n\n var _newTransitionData = data.slice();\n\n _newTransitionData.splice(_keyIndex + 1, 0, MotionFlattenData);\n\n setTransitionData(_newTransitionData);\n setTransitionRange(_rangeNodes);\n setMotionType('hide');\n }\n } else if (prevData !== data) {\n // If whole data changed, we just refresh the list\n setPrevData(data);\n setTransitionData(data);\n }\n }, [expandedKeys, data]); // We should clean up motion if is changed by dragging\n\n React.useEffect(function () {\n if (!dragging) {\n onMotionEnd();\n }\n }, [dragging]);\n var mergedData = motion ? transitionData : data;\n var treeNodeRequiredProps = {\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 return /*#__PURE__*/React.createElement(React.Fragment, null, focused && activeItem && /*#__PURE__*/React.createElement(\"span\", {\n style: HIDDEN_STYLE,\n \"aria-live\": \"assertive\"\n }, getAccessibilityPath(activeItem)), /*#__PURE__*/React.createElement(\"div\", {\n role: \"tree\"\n }, /*#__PURE__*/React.createElement(\"input\", {\n style: HIDDEN_STYLE,\n disabled: focusable === false || disabled,\n tabIndex: focusable !== false ? tabIndex : null,\n onKeyDown: onKeyDown,\n onFocus: onFocus,\n onBlur: onBlur,\n value: \"\",\n onChange: noop\n })), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-treenode\"),\n \"aria-hidden\": true,\n style: {\n position: 'absolute',\n pointerEvents: 'none',\n visibility: 'hidden',\n height: 0,\n overflow: 'hidden'\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-indent\")\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: indentMeasurerRef,\n className: \"\".concat(prefixCls, \"-indent-unit\")\n }))), /*#__PURE__*/React.createElement(VirtualList, Object.assign({}, domProps, {\n data: mergedData,\n itemKey: itemKey,\n height: height,\n fullHeight: false,\n virtual: virtual,\n itemHeight: itemHeight,\n prefixCls: \"\".concat(prefixCls, \"-list\"),\n ref: listRef\n }), function (treeNode) {\n var pos = treeNode.pos,\n _treeNode$data = treeNode.data,\n key = _treeNode$data.key,\n restProps = _objectWithoutProperties(_treeNode$data, [\"key\"]),\n isStart = treeNode.isStart,\n isEnd = treeNode.isEnd;\n\n var mergedKey = getKey(key, pos);\n delete restProps.children;\n var treeNodeProps = getTreeNodeProps(mergedKey, treeNodeRequiredProps);\n return /*#__PURE__*/React.createElement(MotionTreeNode, Object.assign({}, restProps, treeNodeProps, {\n active: !!activeItem && key === activeItem.data.key,\n pos: pos,\n data: treeNode.data,\n isStart: isStart,\n isEnd: isEnd,\n motion: motion,\n motionNodes: key === MOTION_KEY ? transitionRange : null,\n motionType: motionType,\n onMotionStart: onListChangeStart,\n onMotionEnd: onMotionEnd,\n treeNodeRequiredProps: treeNodeRequiredProps,\n onMouseMove: function onMouseMove() {\n onActiveChange(null);\n }\n }));\n }));\n};\n\nvar NodeList = /*#__PURE__*/React.forwardRef(RefNodeList);\nNodeList.displayName = 'NodeList';\nexport default NodeList;"]},"metadata":{},"sourceType":"module"}