rsuite 4.10.10 → 4.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/rsuite.js CHANGED
@@ -7648,7 +7648,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
7648
7648
  /***/ (function(module, exports, __webpack_require__) {
7649
7649
 
7650
7650
  "use strict";
7651
- eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _inheritsLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ \"./node_modules/@babel/runtime/helpers/inheritsLoose.js\"));\n\nvar _isNil2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isFunction2 = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _isNumber2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNumber */ \"./node_modules/lodash/isNumber.js\"));\n\nvar _isString2 = _interopRequireDefault(__webpack_require__(/*! lodash/isString */ \"./node_modules/lodash/isString.js\"));\n\nvar _isEmpty2 = _interopRequireDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\n\nvar _isUndefined2 = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _isArray2 = _interopRequireDefault(__webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\"));\n\nvar React = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _classnames = _interopRequireDefault(__webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\"));\n\nvar _List = _interopRequireDefault(__webpack_require__(/*! react-virtualized/dist/commonjs/List */ \"./node_modules/react-virtualized/dist/commonjs/List/index.js\"));\n\nvar _AutoSizer = _interopRequireDefault(__webpack_require__(/*! react-virtualized/dist/commonjs/AutoSizer */ \"./node_modules/react-virtualized/dist/commonjs/AutoSizer/index.js\"));\n\nvar _CellMeasurer = __webpack_require__(/*! react-virtualized/dist/commonjs/CellMeasurer */ \"./node_modules/react-virtualized/dist/commonjs/CellMeasurer/index.js\");\n\nvar _reactLifecyclesCompat = __webpack_require__(/*! react-lifecycles-compat */ \"./node_modules/react-lifecycles-compat/react-lifecycles-compat.es.js\");\n\nvar _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _CheckTreeNode = _interopRequireDefault(__webpack_require__(/*! ./CheckTreeNode */ \"./src/CheckTreePicker/CheckTreeNode.tsx\"));\n\nvar _constants = __webpack_require__(/*! ../constants */ \"./src/constants.ts\");\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Picker = __webpack_require__(/*! ../Picker */ \"./src/Picker/index.ts\");\n\nvar _utils2 = __webpack_require__(/*! ./utils */ \"./src/CheckTreePicker/utils.ts\");\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _propTypes2 = __webpack_require__(/*! ../Picker/propTypes */ \"./src/Picker/propTypes.ts\");\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/CheckTreePicker/CheckTreePicker.tsx\";\n// default value for virtualized\nvar defaultHeight = 360;\nvar defaultWidth = 200;\n\nvar CheckTreePicker =\n/*#__PURE__*/\nfunction (_React$Component) {\n (0, _inheritsLoose2.default)(CheckTreePicker, _React$Component);\n\n function CheckTreePicker(_props) {\n var _this;\n\n _this = _React$Component.call(this, _props) || this;\n _this.menuRef = void 0;\n _this.treeViewRef = void 0;\n _this.positionRef = void 0;\n _this.listRef = void 0;\n _this.triggerRef = void 0;\n _this.toggleRef = void 0;\n\n _this.getValue = function (props) {\n if (props === void 0) {\n props = _this.props;\n }\n\n var _props2 = props,\n value = _props2.value,\n defaultValue = _props2.defaultValue,\n _props2$uncheckableIt = _props2.uncheckableItemValues,\n uncheckableItemValues = _props2$uncheckableIt === void 0 ? [] : _props2$uncheckableIt;\n\n if (value && value.length) {\n return value.filter(function (v) {\n return !uncheckableItemValues.includes(v);\n });\n }\n\n if (defaultValue && defaultValue.length > 0) {\n return defaultValue.filter(function (v) {\n return !uncheckableItemValues.includes(v);\n });\n }\n\n return [];\n };\n\n _this.getElementByDataKey = function (dataKey) {\n var ele = _this.nodeRefs[dataKey];\n\n if (ele instanceof Element) {\n return ele.querySelector(\".\" + _this.addTreePrefix('node-label'));\n }\n\n return null;\n };\n\n _this.getFocusableMenuItems = function () {\n var filterData = _this.state.filterData;\n var childrenKey = _this.props.childrenKey;\n var items = [];\n\n var loop = function loop(treeNodes) {\n treeNodes.forEach(function (node) {\n var nodeData = (0, _extends2.default)({}, node, {}, _this.nodes[node.refKey]);\n\n if (!(0, _utils2.getDisabledState)(_this.nodes, node, _this.props) && node.visible) {\n items.push(node);\n }\n\n if (node[childrenKey] && (0, _treeUtils.getExpandState)(nodeData, _this.props)) {\n loop(node[childrenKey]);\n }\n });\n };\n\n loop(filterData);\n return items;\n };\n\n _this.nodes = {};\n _this.activeNode = null;\n _this.cache = new _CellMeasurer.CellMeasurerCache({\n fixedWidth: true,\n minHeight: 20\n });\n _this.nodeRefs = {};\n\n _this.bindNodeRefs = function (refKey, ref) {\n _this.nodeRefs[refKey] = ref;\n };\n\n _this.getPositionInstance = function () {\n return _this.positionRef.current;\n };\n\n _this.getToggleInstance = function () {\n return _this.toggleRef.current;\n };\n\n _this.selectActiveItem = function (event) {\n var _this$getActiveItem = _this.getActiveItem(),\n nodeData = _this$getActiveItem.nodeData;\n\n _this.handleSelect(nodeData, event);\n };\n\n _this.focusNextItem = function () {\n var _node$focus;\n\n var _this$getItemsAndActi = _this.getItemsAndActiveIndex(),\n items = _this$getItemsAndActi.items,\n activeIndex = _this$getItemsAndActi.activeIndex;\n\n if (items.length === 0) {\n return;\n }\n\n var nextIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1;\n\n var node = _this.getElementByDataKey(items[nextIndex].refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus = node.focus) === null || _node$focus === void 0 ? void 0 : _node$focus.call(node);\n };\n\n _this.focusPreviousItem = function () {\n var _node$focus2;\n\n var _this$getItemsAndActi2 = _this.getItemsAndActiveIndex(),\n items = _this$getItemsAndActi2.items,\n activeIndex = _this$getItemsAndActi2.activeIndex;\n\n if (items.length === 0) {\n return;\n }\n\n var prevIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1;\n prevIndex = prevIndex >= 0 ? prevIndex : 0;\n\n var node = _this.getElementByDataKey(items[prevIndex].refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus2 = node.focus) === null || _node$focus2 === void 0 ? void 0 : _node$focus2.call(node);\n };\n\n _this.handleCloseDropdown = function () {\n var _this$triggerRef$curr, _this$triggerRef$curr2;\n\n (_this$triggerRef$curr = _this.triggerRef.current) === null || _this$triggerRef$curr === void 0 ? void 0 : (_this$triggerRef$curr2 = _this$triggerRef$curr.hide) === null || _this$triggerRef$curr2 === void 0 ? void 0 : _this$triggerRef$curr2.call(_this$triggerRef$curr);\n };\n\n _this.handleOpenDropdown = function () {\n var _this$triggerRef$curr3, _this$triggerRef$curr4;\n\n (_this$triggerRef$curr3 = _this.triggerRef.current) === null || _this$triggerRef$curr3 === void 0 ? void 0 : (_this$triggerRef$curr4 = _this$triggerRef$curr3.show) === null || _this$triggerRef$curr4 === void 0 ? void 0 : _this$triggerRef$curr4.call(_this$triggerRef$curr3);\n };\n\n _this.open = function () {\n var _this$handleOpenDropd, _this2;\n\n (_this$handleOpenDropd = (_this2 = _this).handleOpenDropdown) === null || _this$handleOpenDropd === void 0 ? void 0 : _this$handleOpenDropd.call(_this2);\n };\n\n _this.close = function () {\n var _this$handleCloseDrop, _this3;\n\n (_this$handleCloseDrop = (_this3 = _this).handleCloseDropdown) === null || _this$handleCloseDrop === void 0 ? void 0 : _this$handleCloseDrop.call(_this3);\n };\n\n _this.handleToggleDropdown = function () {\n var active = _this.state.active;\n\n if (active) {\n _this.handleCloseDropdown();\n\n return;\n }\n\n _this.handleOpenDropdown();\n };\n\n _this.everyChildChecked = function (nodes, node) {\n var list = [];\n Object.keys(nodes).forEach(function (refKey) {\n var _curNode$parentNode;\n\n var curNode = nodes[refKey];\n\n if (((_curNode$parentNode = curNode.parentNode) === null || _curNode$parentNode === void 0 ? void 0 : _curNode$parentNode.refKey) === node.refKey && !curNode.uncheckable) {\n list.push(curNode);\n }\n });\n return list.every(function (l) {\n return l.check;\n });\n };\n\n _this.addPrefix = function (name) {\n return (0, _utils.prefix)(_this.props.classPrefix)(name);\n };\n\n _this.addTreePrefix = function (name) {\n return (0, _utils.prefix)((0, _utils.defaultClassPrefix)('check-tree'))(name);\n };\n\n _this.handleSelect = function (activeNode, event) {\n var _this$props = _this.props,\n onChange = _this$props.onChange,\n onSelect = _this$props.onSelect,\n value = _this$props.value;\n\n var selectedValues = _this.toggleChecked(activeNode, !_this.nodes[activeNode.refKey].check);\n\n if (!(0, _isUndefined2.default)(value)) {\n _this.activeNode = activeNode;\n } else {\n _this.unserializeLists({\n check: selectedValues\n });\n\n _this.setState({\n activeNode: activeNode,\n selectedValues: selectedValues,\n hasValue: !!selectedValues.length\n });\n }\n\n onChange === null || onChange === void 0 ? void 0 : onChange(selectedValues, event);\n onSelect === null || onSelect === void 0 ? void 0 : onSelect(activeNode, selectedValues, event);\n };\n\n _this.handleToggle = function (node) {\n var _this$props2 = _this.props,\n valueKey = _this$props2.valueKey,\n childrenKey = _this$props2.childrenKey,\n onExpand = _this$props2.onExpand,\n expandItemValues = _this$props2.expandItemValues;\n\n var nextExpandItemValues = _this.toggleExpand(node, !node.expand);\n\n if ((0, _isUndefined2.default)(expandItemValues)) {\n _this.unserializeLists({\n expand: nextExpandItemValues\n });\n\n _this.setState({\n expandItemValues: nextExpandItemValues\n });\n }\n\n onExpand === null || onExpand === void 0 ? void 0 : onExpand(nextExpandItemValues, node, (0, _Picker.createConcatChildrenFunction)(node, node[valueKey], {\n valueKey: valueKey,\n childrenKey: childrenKey\n }));\n };\n\n _this.handleKeyDown = function (event) {\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextItem,\n up: _this.focusPreviousItem,\n enter: _this.selectActiveItem,\n del: _this.handleClean\n });\n };\n\n _this.handleToggleKeyDown = function (event) {\n var _this$state = _this.state,\n activeNode = _this$state.activeNode,\n active = _this$state.active; // enter\n\n if ((!activeNode || !active) && event.keyCode === 13) {\n _this.handleToggleDropdown();\n } // delete\n\n\n if (event.keyCode === 8) {\n _this.handleClean(event);\n }\n\n if (!_this.treeViewRef.current) {\n return;\n }\n\n if (event.target instanceof HTMLElement) {\n var className = event.target.className;\n\n if (className.includes(_this.addPrefix('toggle')) || className.includes(_this.addPrefix('toggle-custom')) || className.includes(_this.addPrefix('search-bar-input'))) {\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextItem\n });\n }\n }\n };\n\n _this.handleSearch = function (value, event) {\n var filterData = _this.state.filterData;\n var _this$props3 = _this.props,\n onSearch = _this$props3.onSearch,\n searchKeyword = _this$props3.searchKeyword;\n\n if ((0, _isUndefined2.default)(searchKeyword)) {\n _this.setState({\n filterData: _this.getFilterData(value, filterData),\n searchKeyword: value\n });\n }\n\n onSearch === null || onSearch === void 0 ? void 0 : onSearch(value, event);\n };\n\n _this.handleClean = function (evnet) {\n var _this$props$onChange, _this$props4;\n\n _this.setState({\n selectedValues: [],\n hasValue: false,\n activeNode: {}\n });\n\n _this.unserializeLists({\n check: []\n });\n\n (_this$props$onChange = (_this$props4 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props4, [], evnet);\n };\n\n _this.handleOnOpen = function () {\n var _this$props$onOpen, _this$props5;\n\n var activeNode = _this.state.activeNode;\n\n if (activeNode) {\n var _node$focus3;\n\n var node = _this.getElementByDataKey(activeNode.refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus3 = node.focus) === null || _node$focus3 === void 0 ? void 0 : _node$focus3.call(node);\n }\n\n (_this$props$onOpen = (_this$props5 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props5);\n\n _this.setState({\n active: true\n });\n };\n\n _this.handleOnClose = function () {\n var filterData = _this.state.filterData;\n var _this$props6 = _this.props,\n onClose = _this$props6.onClose,\n searchKeyword = _this$props6.searchKeyword;\n\n if ((0, _isUndefined2.default)(searchKeyword)) {\n _this.setState({\n filterData: _this.getFilterData('', filterData),\n searchKeyword: ''\n });\n }\n\n onClose === null || onClose === void 0 ? void 0 : onClose();\n\n _this.setState({\n active: false\n });\n };\n\n _this.measureRowRenderer = function (nodes) {\n return function (_ref) {\n var key = _ref.key,\n index = _ref.index,\n style = _ref.style,\n parent = _ref.parent;\n var node = nodes[index];\n return React.createElement(_CellMeasurer.CellMeasurer, {\n cache: _this.cache,\n columnIndex: 0,\n key: key,\n rowIndex: index,\n parent: parent,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1072\n },\n __self: this\n }, function () {\n return _this.renderVirtualNode(node, {\n key: key,\n style: style\n });\n });\n };\n };\n\n var _value = _props.value,\n data = _props.data,\n cascade = _props.cascade,\n _childrenKey = _props.childrenKey,\n _searchKeyword = _props.searchKeyword;\n _this.nodes = {};\n\n var nextValue = _this.getValue(_props);\n\n var _nextExpandItemValues = (0, _treeUtils.getExpandItemValues)(_props);\n\n var nextData = [].concat(data);\n\n _this.flattenNodes(nextData, _props);\n\n _this.unserializeLists({\n check: nextValue,\n expand: _nextExpandItemValues\n }, _props);\n\n _this.state = {\n data: data,\n value: _value,\n cascade: cascade,\n hasValue: _this.hasValue(nextValue),\n expandAll: (0, _treeUtils.getExpandAll)(_props),\n filterData: _this.getFilterData(_searchKeyword, nextData, _props),\n searchKeyword: _searchKeyword || '',\n selectedValues: nextValue,\n expandItemValues: _this.serializeList('expand'),\n uncheckableItemValues: _props.uncheckableItemValues,\n isSomeNodeHasChildren: (0, _utils2.isSomeNodeHasChildren)(data, _childrenKey)\n };\n _this.treeViewRef = React.createRef();\n _this.positionRef = React.createRef();\n _this.listRef = React.createRef();\n _this.triggerRef = React.createRef();\n _this.toggleRef = React.createRef(); // for test\n\n _this.menuRef = React.createRef();\n (0, _treeUtils.treeDeprecatedWarning)(_props, ['expandAll']);\n return _this;\n }\n\n CheckTreePicker.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {\n var value = nextProps.value,\n data = nextProps.data,\n cascade = nextProps.cascade,\n expandAll = nextProps.expandAll,\n searchKeyword = nextProps.searchKeyword,\n uncheckableItemValues = nextProps.uncheckableItemValues,\n expandItemValues = nextProps.expandItemValues;\n var nextState = {};\n\n if ((0, _isArray2.default)(data) && (0, _isArray2.default)(prevState.data) && prevState.data !== data) {\n nextState.data = data;\n }\n\n if ((0, _treeUtils.compareArray)(value, prevState.value)) {\n nextState.value = value;\n }\n\n if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues) && (0, _isArray2.default)(expandItemValues)) {\n nextState.expandItemValues = expandItemValues;\n }\n\n if ((0, _treeUtils.compareArray)(uncheckableItemValues, prevState.uncheckableItemValues) && (0, _isArray2.default)(uncheckableItemValues)) {\n nextState.uncheckableItemValues = uncheckableItemValues;\n }\n\n if (!(0, _isUndefined2.default)(searchKeyword) && searchKeyword !== prevState.searchKeyword) {\n nextState.searchKeyword = searchKeyword;\n }\n\n if (cascade !== prevState.cascade) {\n nextState.cascade = cascade;\n }\n\n if (expandAll !== prevState.expandAll) {\n nextState.expandAll = expandAll;\n }\n\n return Object.keys(nextState).length ? nextState : null;\n };\n\n var _proto = CheckTreePicker.prototype;\n\n _proto.componentDidUpdate = function componentDidUpdate(_prevProps, prevState) {\n this.updateDataChange(prevState);\n this.updateValueChange(prevState);\n this.updateExpandItemValuesChange(prevState);\n this.updateUncheckableItemValuesChange(prevState);\n this.updateCascadeChange(prevState);\n this.updateSearchKeywordChange(prevState);\n\n if (this.listRef.current) {\n this.listRef.current.forceUpdateGrid();\n }\n };\n\n _proto.updateDataChange = function updateDataChange(prevState) {\n var searchKeyword = this.state.searchKeyword;\n var _this$props7 = this.props,\n _this$props7$data = _this$props7.data,\n data = _this$props7$data === void 0 ? [] : _this$props7$data,\n childrenKey = _this$props7.childrenKey;\n\n if (prevState.data !== data) {\n var nextData = [].concat(data);\n this.nodes = {};\n this.flattenNodes(nextData);\n this.unserializeLists({\n check: this.getValue()\n });\n this.setState({\n data: nextData,\n filterData: this.getFilterData(searchKeyword, nextData),\n isSomeNodeHasChildren: (0, _utils2.isSomeNodeHasChildren)(nextData, childrenKey),\n hasValue: this.hasValue(),\n expandItemValues: this.serializeList('expand')\n });\n }\n };\n\n _proto.updateValueChange = function updateValueChange(prevState) {\n var expandItemValues = this.state.expandItemValues;\n var value = this.props.value;\n\n if ((0, _treeUtils.compareArray)(value, prevState.value)) {\n this.unserializeLists({\n check: value !== null && value !== void 0 ? value : [],\n expand: expandItemValues\n });\n this.setState({\n selectedValues: value,\n hasValue: this.hasValue(value),\n activeNode: value.length ? this.activeNode : null\n });\n }\n };\n\n _proto.updateExpandItemValuesChange = function updateExpandItemValuesChange(prevState) {\n var expandItemValues = this.props.expandItemValues;\n\n if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues) && (0, _isArray2.default)(expandItemValues)) {\n this.unserializeLists({\n expand: expandItemValues\n });\n this.setState({\n expandItemValues: expandItemValues\n });\n }\n };\n\n _proto.updateUncheckableItemValuesChange = function updateUncheckableItemValuesChange(prevState) {\n var _this$state2 = this.state,\n data = _this$state2.data,\n selectedValues = _this$state2.selectedValues,\n expandItemValues = _this$state2.expandItemValues;\n var uncheckableItemValues = this.props.uncheckableItemValues;\n\n if ((0, _treeUtils.compareArray)(uncheckableItemValues, prevState.uncheckableItemValues) && (0, _isArray2.default)(uncheckableItemValues)) {\n this.flattenNodes(data);\n this.unserializeLists({\n check: selectedValues,\n expand: expandItemValues\n });\n this.setState({\n hasValue: this.hasValue()\n });\n }\n };\n\n _proto.updateCascadeChange = function updateCascadeChange(prevState) {\n var _this$state3 = this.state,\n data = _this$state3.data,\n selectedValues = _this$state3.selectedValues,\n expandItemValues = _this$state3.expandItemValues;\n var cascade = this.props.cascade; // cascade 改变时,重新初始化\n\n if (cascade !== prevState.cascade && cascade) {\n this.flattenNodes(data);\n this.unserializeLists({\n check: selectedValues,\n expand: expandItemValues\n });\n this.setState({\n cascade: cascade\n });\n }\n };\n\n _proto.updateSearchKeywordChange = function updateSearchKeywordChange(prevState) {\n var filterData = this.state.filterData;\n var searchKeyword = this.props.searchKeyword;\n\n if (!(0, _isUndefined2.default)(searchKeyword) && prevState.searchKeyword !== searchKeyword) {\n this.setState({\n filterData: this.getFilterData(searchKeyword, filterData)\n });\n }\n };\n\n _proto.getNodeCheckState = function getNodeCheckState(node, cascade) {\n var childrenKey = this.props.childrenKey;\n\n if (!node[childrenKey] || !node[childrenKey].length || !cascade) {\n this.nodes[node.refKey].checkAll = false;\n return node.check ? _constants.CHECK_STATE.CHECK : _constants.CHECK_STATE.UNCHECK;\n }\n\n if ((0, _utils2.isEveryChildChecked)(node, this.nodes, this.props)) {\n this.nodes[node.refKey].checkAll = true;\n this.nodes[node.refKey].check = true;\n return _constants.CHECK_STATE.CHECK;\n }\n\n if ((0, _utils2.isSomeChildChecked)(node, this.nodes, this.props)) {\n this.nodes[node.refKey].checkAll = false;\n return _constants.CHECK_STATE.INDETERMINATE;\n }\n\n return _constants.CHECK_STATE.UNCHECK;\n };\n\n _proto.getFilterData = function getFilterData(searchKeyword, data, props) {\n if (searchKeyword === void 0) {\n searchKeyword = '';\n }\n\n if (props === void 0) {\n props = this.props;\n }\n\n var _props3 = props,\n labelKey = _props3.labelKey,\n childrenKey = _props3.childrenKey,\n searchBy = _props3.searchBy;\n\n var setVisible = function setVisible(nodes) {\n if (nodes === void 0) {\n nodes = [];\n }\n\n return nodes.forEach(function (item) {\n item.visible = searchBy ? searchBy(searchKeyword, item[labelKey], item) : (0, _Picker.shouldDisplay)(item[labelKey], searchKeyword);\n\n if ((0, _isArray2.default)(item[childrenKey])) {\n setVisible(item[childrenKey]);\n item[childrenKey].forEach(function (child) {\n if (child.visible) {\n item.visible = child.visible;\n }\n });\n }\n });\n };\n\n setVisible(data);\n return data;\n };\n\n _proto.getActiveElementOption = function getActiveElementOption(options, refKey) {\n var childrenKey = this.props.childrenKey;\n\n for (var i = 0; i < options.length; i += 1) {\n var _options$i$childrenKe;\n\n if (options[i].refKey === refKey) {\n return options[i];\n } else if ((_options$i$childrenKe = options[i][childrenKey]) === null || _options$i$childrenKe === void 0 ? void 0 : _options$i$childrenKe.length) {\n var active = this.getActiveElementOption(options[i][childrenKey], refKey);\n\n if (!(0, _isEmpty2.default)(active)) {\n return active;\n }\n }\n }\n\n return {};\n };\n\n _proto.getFlattenTreeData = function getFlattenTreeData(nodes) {\n var _this4 = this;\n\n var expandItemValues = this.state.expandItemValues;\n var _this$props8 = this.props,\n childrenKey = _this$props8.childrenKey,\n valueKey = _this$props8.valueKey;\n return (0, _treeUtils.flattenTree)(nodes, childrenKey, function (node) {\n var formatted = {};\n var curNode = _this4.nodes[node.refKey];\n var parentKeys = (0, _treeUtils.getNodeParents)(curNode, 'parentNode', valueKey);\n\n if (curNode) {\n formatted = (0, _extends2.default)({}, node, {\n check: curNode.check,\n expand: curNode.expand,\n uncheckable: curNode.uncheckable,\n layer: curNode.layer,\n parentNode: curNode.parentNode,\n showNode: (0, _treeUtils.shouldShowNodeByExpanded)(expandItemValues, parentKeys)\n });\n }\n\n return formatted;\n });\n };\n\n _proto.getItemsAndActiveIndex = function getItemsAndActiveIndex() {\n var items = this.getFocusableMenuItems();\n var activeIndex = -1;\n items.forEach(function (item, index) {\n if (document.activeElement !== null) {\n if (item.refKey === document.activeElement.getAttribute('data-key')) {\n activeIndex = index;\n }\n }\n });\n return {\n items: items,\n activeIndex: activeIndex\n };\n };\n\n _proto.getActiveItem = function getActiveItem() {\n var filterData = this.state.filterData;\n var activeItem = document.activeElement;\n\n if (activeItem !== null) {\n var _activeItem$dataset, _activeItem$dataset2, _this$nodes$nodeData$, _this$nodes$nodeData$2;\n\n var key = activeItem === null || activeItem === void 0 ? void 0 : (_activeItem$dataset = activeItem.dataset) === null || _activeItem$dataset === void 0 ? void 0 : _activeItem$dataset.key;\n var layer = activeItem === null || activeItem === void 0 ? void 0 : (_activeItem$dataset2 = activeItem.dataset) === null || _activeItem$dataset2 === void 0 ? void 0 : _activeItem$dataset2.layer;\n var nodeData = this.getActiveElementOption(filterData, key);\n nodeData.check = !((_this$nodes$nodeData$ = this.nodes[nodeData.refKey]) === null || _this$nodes$nodeData$ === void 0 ? void 0 : _this$nodes$nodeData$.check);\n nodeData.parentNode = (_this$nodes$nodeData$2 = this.nodes[nodeData.refKey]) === null || _this$nodes$nodeData$2 === void 0 ? void 0 : _this$nodes$nodeData$2.parentNode;\n return {\n nodeData: nodeData,\n layer: layer\n };\n }\n\n return {};\n }\n /**\n * 获取已选择的items,用于显示在placeholder\n */\n ;\n\n _proto.getSelectedItems = function getSelectedItems(selectedValues) {\n var _this5 = this;\n\n var valueKey = this.props.valueKey;\n var checkItems = [];\n Object.keys(this.nodes).map(function (refKey) {\n var node = _this5.nodes[refKey];\n\n if (selectedValues.some(function (value) {\n return (0, _shallowEqual.default)(node[valueKey], value);\n })) {\n checkItems.push(node);\n }\n });\n return checkItems;\n }\n /**\n * 判断传入的 value 是否存在于data 中\n * @param {*} values\n */\n ;\n\n _proto.hasValue = function hasValue(values) {\n var _this6 = this;\n\n if (values === void 0) {\n values = this.state.selectedValues;\n }\n\n var valueKey = this.props.valueKey;\n var selectedValues = Object.keys(this.nodes).map(function (refKey) {\n return _this6.nodes[refKey][valueKey];\n }).filter(function (item) {\n return values.some(function (v) {\n return (0, _shallowEqual.default)(v, item);\n });\n });\n return !!selectedValues.length;\n }\n /**\n * 拍平数组,将tree 转换为一维对象\n * @param {*} nodes tree data\n * @param {*} ref 当前层级\n */\n ;\n\n _proto.flattenNodes = function flattenNodes(nodes, props, ref, parentNode, layer) {\n var _this7 = this;\n\n if (ref === void 0) {\n ref = '0';\n }\n\n if (layer === void 0) {\n layer = 0;\n }\n\n var _ref2 = props || this.props,\n labelKey = _ref2.labelKey,\n valueKey = _ref2.valueKey,\n childrenKey = _ref2.childrenKey;\n\n if (!Array.isArray(nodes) || nodes.length === 0) {\n return;\n }\n\n nodes.forEach(function (node, index) {\n var _this7$nodes$refKey;\n\n var refKey = ref + \"-\" + index;\n node.refKey = refKey;\n _this7.nodes[refKey] = (_this7$nodes$refKey = {\n layer: layer\n }, _this7$nodes$refKey[labelKey] = node[labelKey], _this7$nodes$refKey[valueKey] = node[valueKey], _this7$nodes$refKey.expand = (0, _treeUtils.getExpandState)(node, props || _this7.props), _this7$nodes$refKey.uncheckable = (0, _utils2.getUncheckableState)(node, props || _this7.props), _this7$nodes$refKey.refKey = refKey, _this7$nodes$refKey);\n\n if (parentNode) {\n _this7.nodes[refKey].parentNode = parentNode;\n }\n\n _this7.flattenNodes(node[childrenKey], props, refKey, _this7.nodes[refKey], layer + 1);\n });\n }\n /**\n * 过滤选中的 values 中不包含 uncheckableItemValues 的那些值\n * @param {*} values\n */\n ;\n\n _proto.filterSelectedValues = function filterSelectedValues(values) {\n var _this$props$uncheckab = this.props.uncheckableItemValues,\n uncheckableItemValues = _this$props$uncheckab === void 0 ? [] : _this$props$uncheckab;\n return values.filter(function (value) {\n return !uncheckableItemValues.includes(value);\n });\n };\n\n _proto.serializeList = function serializeList(key, nodes) {\n if (nodes === void 0) {\n nodes = this.nodes;\n }\n\n var valueKey = this.props.valueKey;\n var list = [];\n Object.keys(nodes).forEach(function (refKey) {\n if (nodes[refKey][key]) {\n list.push(nodes[refKey][valueKey]);\n }\n });\n return list;\n };\n\n _proto.serializeListOnlyParent = function serializeListOnlyParent(key, nodes) {\n if (nodes === void 0) {\n nodes = this.nodes;\n }\n\n var valueKey = this.props.valueKey;\n var list = [];\n Object.keys(nodes).forEach(function (refKey) {\n var currentNode = nodes[refKey];\n\n if (currentNode.parentNode) {\n var _currentNode$parentNo;\n\n var parentNode = nodes[(_currentNode$parentNo = currentNode.parentNode) === null || _currentNode$parentNo === void 0 ? void 0 : _currentNode$parentNo.refKey];\n\n if (currentNode[key]) {\n if (!(parentNode === null || parentNode === void 0 ? void 0 : parentNode.checkAll)) {\n list.push(nodes[refKey][valueKey]);\n } else if (parentNode === null || parentNode === void 0 ? void 0 : parentNode.uncheckable) {\n list.push(nodes[refKey][valueKey]);\n }\n }\n } else {\n if (currentNode[key]) {\n list.push(nodes[refKey][valueKey]);\n }\n }\n });\n return list;\n };\n\n _proto.unserializeLists = function unserializeLists(lists, nextProps) {\n var _this8 = this;\n\n if (nextProps === void 0) {\n nextProps = this.props;\n }\n\n var _nextProps = nextProps,\n valueKey = _nextProps.valueKey,\n cascade = _nextProps.cascade,\n _nextProps$uncheckabl = _nextProps.uncheckableItemValues,\n uncheckableItemValues = _nextProps$uncheckabl === void 0 ? [] : _nextProps$uncheckabl;\n var expandAll = (0, _treeUtils.getExpandAll)(nextProps); // Reset values to false\n\n Object.keys(this.nodes).forEach(function (refKey) {\n Object.keys(lists).forEach(function (listKey) {\n if (listKey === 'check') {\n var node = _this8.nodes[refKey];\n\n if (cascade && 'parentNode' in node) {\n node[listKey] = node.parentNode[listKey];\n } else {\n node[listKey] = false;\n }\n\n lists[listKey].forEach(function (value) {\n if ((0, _shallowEqual.default)(_this8.nodes[refKey][valueKey], value) && !uncheckableItemValues.some(function (uncheckableValue) {\n return (0, _shallowEqual.default)(value, uncheckableValue);\n })) {\n _this8.nodes[refKey][listKey] = true;\n }\n });\n }\n\n if (listKey === 'expand') {\n _this8.nodes[refKey][listKey] = false;\n\n if (lists[listKey].length) {\n lists[listKey].forEach(function (value) {\n if ((0, _shallowEqual.default)(_this8.nodes[refKey][valueKey], value)) {\n _this8.nodes[refKey][listKey] = true;\n }\n });\n } else {\n _this8.nodes[refKey][listKey] = expandAll;\n }\n }\n });\n });\n };\n\n _proto.toggleChecked = function toggleChecked(node, isChecked) {\n var nodes = (0, _utils.clone)(this.nodes);\n this.toggleDownChecked(nodes, node, isChecked);\n node.parentNode && this.toggleUpChecked(nodes, node.parentNode, isChecked);\n var values = this.serializeListOnlyParent('check', nodes);\n return this.filterSelectedValues(values);\n };\n\n _proto.toggleUpChecked = function toggleUpChecked(nodes, node, checked) {\n var cascade = this.props.cascade;\n var currentNode = nodes[node.refKey];\n\n if (cascade) {\n if (!checked) {\n currentNode.check = checked;\n currentNode.checkAll = checked;\n } else {\n if (this.everyChildChecked(nodes, node)) {\n currentNode.check = true;\n currentNode.checkAll = true;\n } else {\n currentNode.check = false;\n currentNode.checkAll = false;\n }\n }\n\n if (node.parentNode) {\n this.toggleUpChecked(nodes, node.parentNode, checked);\n }\n }\n };\n\n _proto.toggleDownChecked = function toggleDownChecked(nodes, node, isChecked) {\n var _this9 = this;\n\n var _this$props9 = this.props,\n childrenKey = _this$props9.childrenKey,\n cascade = _this$props9.cascade;\n nodes[node.refKey].check = isChecked;\n\n if (!node[childrenKey] || !node[childrenKey].length || !cascade) {\n nodes[node.refKey].checkAll = false;\n } else {\n nodes[node.refKey].checkAll = isChecked;\n node[childrenKey].forEach(function (child) {\n _this9.toggleDownChecked(nodes, child, isChecked);\n });\n }\n };\n\n _proto.toggleNode = function toggleNode(key, node, toggleValue) {\n // 如果该节点处于 disabledCheckbox,则忽略该值\n if (!node.uncheckable) {\n this.nodes[node.refKey][key] = toggleValue;\n }\n };\n\n _proto.toggleExpand = function toggleExpand(node, isExpand) {\n var valueKey = this.props.valueKey;\n var expandItemValues = new Set(this.serializeList('expand'));\n\n if (isExpand) {\n expandItemValues.add(node[valueKey]);\n } else {\n expandItemValues.delete(node[valueKey]);\n }\n\n return Array.from(expandItemValues);\n };\n\n _proto.renderDropdownMenu = function renderDropdownMenu() {\n var _this$props10 = this.props,\n _this$props10$height = _this$props10.height,\n height = _this$props10$height === void 0 ? defaultHeight : _this$props10$height,\n locale = _this$props10.locale,\n menuStyle = _this$props10.menuStyle,\n searchable = _this$props10.searchable,\n renderMenu = _this$props10.renderMenu,\n virtualized = _this$props10.virtualized,\n searchKeyword = _this$props10.searchKeyword,\n renderExtraFooter = _this$props10.renderExtraFooter,\n menuClassName = _this$props10.menuClassName,\n menuAutoWidth = _this$props10.menuAutoWidth;\n var keyword = !(0, _isUndefined2.default)(searchKeyword) ? searchKeyword : this.state.searchKeyword;\n var classes = (0, _classnames.default)(menuClassName, this.addPrefix('check-tree-menu'));\n var menu = this.renderCheckTree();\n var styles = virtualized ? (0, _extends2.default)({\n height: height\n }, menuStyle) : menuStyle;\n return React.createElement(_Picker.MenuWrapper, {\n autoWidth: menuAutoWidth,\n className: classes,\n style: styles,\n ref: this.menuRef,\n getToggleInstance: this.getToggleInstance,\n getPositionInstance: this.getPositionInstance,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 924\n },\n __self: this\n }, searchable ? React.createElement(_Picker.SearchBar, {\n placeholder: locale.searchPlaceholder,\n key: \"searchBar\",\n onChange: this.handleSearch,\n value: keyword,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 933\n },\n __self: this\n }) : null, renderMenu ? renderMenu(menu) : menu, renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());\n };\n\n _proto.renderNode = function renderNode(node, layer) {\n var _this10 = this;\n\n var _this$state4 = this.state,\n activeNode = _this$state4.activeNode,\n searchKeyword = _this$state4.searchKeyword;\n var _this$props11 = this.props,\n valueKey = _this$props11.valueKey,\n labelKey = _this$props11.labelKey,\n childrenKey = _this$props11.childrenKey,\n renderTreeNode = _this$props11.renderTreeNode,\n renderTreeIcon = _this$props11.renderTreeIcon,\n cascade = _this$props11.cascade,\n locale = _this$props11.locale;\n var visible = node.visible,\n refKey = node.refKey; // 当处于搜索时,需要将所有节点都展开\n\n var expand = (0, _treeUtils.getExpandWhenSearching)(searchKeyword, node.expand);\n\n if (!visible) {\n return null;\n }\n\n var key = (0, _isString2.default)(node[valueKey]) || (0, _isNumber2.default)(node[valueKey]) ? node[valueKey] : refKey;\n var children = node[childrenKey]; // 当用户进行搜索时,hasChildren的判断要变成判断是否存在 visible 为 true 的子节点\n\n var visibleChildren = (0, _isUndefined2.default)(searchKeyword) || searchKeyword.length === 0 ? !!children : (0, _treeUtils.hasVisibleChildren)(node, childrenKey);\n var props = {\n value: node[valueKey],\n label: node[labelKey],\n layer: layer,\n expand: expand,\n rtl: locale.rtl,\n focus: activeNode ? (0, _shallowEqual.default)(activeNode[valueKey], node[valueKey]) : false,\n visible: node.visible,\n disabled: (0, _utils2.getDisabledState)(this.nodes, node, this.props),\n nodeData: node,\n checkState: this.getNodeCheckState(node, cascade),\n hasChildren: visibleChildren,\n uncheckable: node.uncheckable,\n allUncheckable: (0, _utils2.getSiblingNodeUncheckable)(node, this.nodes),\n onSelect: this.handleSelect,\n onTreeToggle: this.handleToggle,\n onRenderTreeNode: renderTreeNode,\n onRenderTreeIcon: renderTreeIcon\n };\n\n if (props.hasChildren) {\n var _classNames;\n\n layer += 1; // 是否展开树节点且子节点不为空\n\n var openClass = this.addTreePrefix('open');\n var childrenClass = (0, _classnames.default)(this.addTreePrefix('node-children'), (_classNames = {}, _classNames[openClass] = expand && visibleChildren, _classNames));\n var nodes = children || [];\n return React.createElement(\"div\", {\n className: childrenClass,\n key: key,\n ref: this.bindNodeRefs.bind(this, refKey),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1004\n },\n __self: this\n }, React.createElement(_CheckTreeNode.default, (0, _extends2.default)({}, props, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1005\n },\n __self: this\n })), React.createElement(\"div\", {\n className: this.addTreePrefix('children'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1006\n },\n __self: this\n }, nodes.map(function (child) {\n return _this10.renderNode(child, layer);\n })));\n }\n\n return React.createElement(_CheckTreeNode.default, (0, _extends2.default)({\n key: key,\n innerRef: this.bindNodeRefs.bind(this, refKey)\n }, props, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1013\n },\n __self: this\n }));\n };\n\n _proto.renderVirtualNode = function renderVirtualNode(node, options) {\n var _this$state5 = this.state,\n activeNode = _this$state5.activeNode,\n expandAll = _this$state5.expandAll,\n searchKeyword = _this$state5.searchKeyword;\n var _this$props12 = this.props,\n valueKey = _this$props12.valueKey,\n labelKey = _this$props12.labelKey,\n childrenKey = _this$props12.childrenKey,\n renderTreeNode = _this$props12.renderTreeNode,\n renderTreeIcon = _this$props12.renderTreeIcon,\n cascade = _this$props12.cascade,\n locale = _this$props12.locale;\n var key = options.key,\n style = options.style;\n var layer = node.layer,\n refKey = node.refKey,\n showNode = node.showNode;\n var expand = (0, _treeUtils.getExpandWhenSearching)(searchKeyword, node.expand);\n var children = node[childrenKey];\n var props = {\n value: node[valueKey],\n label: node[labelKey],\n layer: layer,\n expand: expand,\n rtl: locale.rtl,\n focus: activeNode ? (0, _shallowEqual.default)(activeNode[valueKey], node[valueKey]) : false,\n visible: node.visible,\n disabled: (0, _utils2.getDisabledState)(this.nodes, node, this.props),\n nodeData: node,\n children: children,\n expandAll: expandAll,\n checkState: this.getNodeCheckState(node, cascade),\n parentNode: node.parentNode,\n hasChildren: !!children,\n uncheckable: node.uncheckable,\n allUncheckable: (0, _utils2.getSiblingNodeUncheckable)(node, this.nodes),\n onSelect: this.handleSelect,\n onTreeToggle: this.handleToggle,\n onRenderTreeNode: renderTreeNode,\n onRenderTreeIcon: renderTreeIcon\n };\n return showNode && React.createElement(_CheckTreeNode.default, (0, _extends2.default)({\n style: style,\n key: key,\n innerRef: this.bindNodeRefs.bind(this, refKey)\n }, props, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1058\n },\n __self: this\n }));\n };\n\n _proto.renderCheckTree = function renderCheckTree() {\n var _classNames2,\n _this11 = this,\n _classNames3;\n\n var _this$state6 = this.state,\n filterData = _this$state6.filterData,\n isSomeNodeHasChildren = _this$state6.isSomeNodeHasChildren;\n var _this$props13 = this.props,\n inline = _this$props13.inline,\n style = _this$props13.style,\n height = _this$props13.height,\n className = _this$props13.className,\n onScroll = _this$props13.onScroll,\n locale = _this$props13.locale,\n virtualized = _this$props13.virtualized,\n searchable = _this$props13.searchable; // 树节点的层级\n\n var layer = 0;\n var classes = (0, _classnames.default)((0, _utils.defaultClassPrefix)('check-tree'), (_classNames2 = {}, _classNames2[className] = inline, _classNames2['without-children'] = !isSomeNodeHasChildren, _classNames2));\n var formattedNodes = [];\n\n if (!virtualized) {\n formattedNodes = (0, _utils2.getFormattedTree)(filterData, this.nodes, this.props).map(function (node) {\n return _this11.renderNode(node, layer);\n });\n\n if (!formattedNodes.some(function (v) {\n return v !== null;\n })) {\n return React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1106\n },\n __self: this\n }, locale.noResultsText);\n }\n } else {\n formattedNodes = this.getFlattenTreeData(filterData).filter(function (n) {\n return n.showNode && n.visible;\n });\n\n if (!formattedNodes.length) {\n return React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1111\n },\n __self: this\n }, locale.noResultsText);\n }\n } // 当未定义 height 且 设置了 virtualized 为 true,treeHeight 设置默认高度\n\n\n var treeHeight = (0, _isUndefined2.default)(height) && virtualized ? defaultHeight : height;\n var treeWidth = (0, _isUndefined2.default)(style === null || style === void 0 ? void 0 : style.width) ? defaultWidth : style.width;\n var styles = inline ? (0, _extends2.default)({\n height: treeHeight\n }, style) : {};\n var treeNodesClass = (0, _classnames.default)(this.addTreePrefix('nodes'), (_classNames3 = {}, _classNames3[this.addTreePrefix('all-uncheckable')] = (0, _utils2.getEveryFisrtLevelNodeUncheckable)(this.nodes), _classNames3));\n var listHeight = (0, _treeUtils.getVirtualLisHeight)(inline, searchable, treeHeight);\n return React.createElement(\"div\", {\n ref: this.treeViewRef,\n className: classes,\n style: styles,\n onScroll: onScroll,\n onKeyDown: this.handleKeyDown,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1125\n },\n __self: this\n }, React.createElement(\"div\", {\n className: treeNodesClass,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1132\n },\n __self: this\n }, virtualized ? React.createElement(_AutoSizer.default, {\n defaultHeight: listHeight,\n defaultWidth: treeWidth,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1134\n },\n __self: this\n }, function (_ref3) {\n var height = _ref3.height,\n width = _ref3.width;\n return React.createElement(_List.default, {\n ref: _this11.listRef,\n width: width || treeWidth,\n height: height || listHeight,\n rowHeight: 36,\n rowCount: formattedNodes.length,\n rowRenderer: _this11.measureRowRenderer(formattedNodes),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1136\n },\n __self: this\n });\n }) : formattedNodes));\n };\n\n _proto.render = function render() {\n var _this$props14 = this.props,\n cascade = _this$props14.cascade,\n style = _this$props14.style,\n locale = _this$props14.locale,\n inline = _this$props14.inline,\n disabled = _this$props14.disabled,\n valueKey = _this$props14.valueKey,\n labelKey = _this$props14.labelKey,\n cleanable = _this$props14.cleanable,\n countable = _this$props14.countable,\n placeholder = _this$props14.placeholder,\n toggleComponentClass = _this$props14.toggleComponentClass,\n onExited = _this$props14.onExited,\n onEntered = _this$props14.onEntered,\n onClean = _this$props14.onClean,\n renderValue = _this$props14.renderValue,\n positionRef = _this$props14.positionRef,\n rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props14, [\"cascade\", \"style\", \"locale\", \"inline\", \"disabled\", \"valueKey\", \"labelKey\", \"cleanable\", \"countable\", \"placeholder\", \"toggleComponentClass\", \"onExited\", \"onEntered\", \"onClean\", \"renderValue\", \"positionRef\"]);\n var _this$state7 = this.state,\n hasValue = _this$state7.hasValue,\n selectedValues = _this$state7.selectedValues;\n var hasValidValue = hasValue || selectedValues.length > 0 && (0, _isFunction2.default)(renderValue);\n var selectedItems = this.getSelectedItems(selectedValues);\n var selectedElement = placeholder;\n /**\n * if value is invalid and renderValue is undefined, then using placeholder.\n * if value is valid and renderValue is't undefined, then using renderValue()\n */\n\n if (selectedValues.length) {\n if (hasValue) {\n selectedElement = React.createElement(_Picker.SelectedElement, {\n selectedItems: selectedItems,\n countable: countable,\n valueKey: valueKey,\n labelKey: labelKey,\n prefix: this.addPrefix,\n cascade: cascade,\n locale: locale,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1187\n },\n __self: this\n });\n }\n\n if ((0, _isFunction2.default)(renderValue)) {\n selectedElement = renderValue(selectedValues, selectedItems, selectedElement);\n\n if ((0, _isNil2.default)(selectedElement)) {\n hasValidValue = false;\n }\n }\n }\n\n var unhandled = (0, _utils.getUnhandledProps)(CheckTreePicker, rest);\n var classes = (0, _Picker.getToggleWrapperClassName)('check-tree', this.addPrefix, this.props, hasValidValue);\n\n if (inline) {\n return this.renderCheckTree();\n }\n\n return React.createElement(_Picker.PickerToggleTrigger, {\n pickerProps: this.props,\n ref: this.triggerRef,\n positionRef: (0, _utils.mergeRefs)(this.positionRef, positionRef),\n onEntered: (0, _utils.createChainedFunction)(this.handleOnOpen, onEntered),\n onExited: (0, _utils.createChainedFunction)(this.handleOnClose, onExited),\n speaker: this.renderDropdownMenu(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1218\n },\n __self: this\n }, React.createElement(\"div\", {\n className: classes,\n style: style,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1226\n },\n __self: this\n }, React.createElement(_Picker.PickerToggle, (0, _extends2.default)({}, unhandled, {\n ref: this.toggleRef,\n onKeyDown: this.handleToggleKeyDown,\n onClean: (0, _utils.createChainedFunction)(this.handleClean, onClean),\n componentClass: toggleComponentClass,\n cleanable: cleanable && !disabled,\n hasValue: hasValidValue,\n active: this.state.active,\n \"aria-disabled\": disabled,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1227\n },\n __self: this\n }), selectedElement || locale.placeholder)));\n };\n\n return CheckTreePicker;\n}(React.Component);\n\nCheckTreePicker.propTypes = (0, _extends2.default)({}, _propTypes2.listPickerPropTypes, {\n height: _propTypes.default.number,\n inline: _propTypes.default.bool,\n cascade: _propTypes.default.bool,\n countable: _propTypes.default.bool,\n expandAll: _propTypes.default.bool,\n searchable: _propTypes.default.bool,\n virtualized: _propTypes.default.bool,\n searchKeyword: _propTypes.default.string,\n menuAutoWidth: _propTypes.default.bool,\n defaultExpandAll: _propTypes.default.bool,\n containerPadding: _propTypes.default.number,\n disabledItemValues: _propTypes.default.array,\n expandItemValues: _propTypes.default.array,\n defaultExpandItemValues: _propTypes.default.array,\n uncheckableItemValues: _propTypes.default.array,\n onSearch: _propTypes.default.func,\n onExpand: _propTypes.default.func,\n onSelect: _propTypes.default.func,\n onScroll: _propTypes.default.func,\n renderMenu: _propTypes.default.func,\n renderTreeNode: _propTypes.default.func,\n renderTreeIcon: _propTypes.default.func,\n searchBy: _propTypes.default.func\n});\nCheckTreePicker.defaultProps = (0, _extends2.default)({}, _propTypes2.listPickerDefaultProps, {\n cascade: true,\n countable: true,\n searchable: true,\n menuAutoWidth: true,\n defaultValue: [],\n uncheckableItemValues: [],\n locale: {\n placeholder: 'Select',\n searchPlaceholder: 'Search',\n noResultsText: 'No results found',\n checkAll: 'All'\n }\n});\n(0, _reactLifecyclesCompat.polyfill)(CheckTreePicker);\n\nvar _default = (0, _utils.defaultProps)({\n classPrefix: 'picker'\n})(CheckTreePicker);\n\nexports.default = _default;\nmodule.exports = exports.default;\n\n//# sourceURL=webpack://rsuite/./src/CheckTreePicker/CheckTreePicker.tsx?");
7651
+ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _inheritsLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ \"./node_modules/@babel/runtime/helpers/inheritsLoose.js\"));\n\nvar _isNil2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isFunction2 = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _isNumber2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNumber */ \"./node_modules/lodash/isNumber.js\"));\n\nvar _isString2 = _interopRequireDefault(__webpack_require__(/*! lodash/isString */ \"./node_modules/lodash/isString.js\"));\n\nvar _isEmpty2 = _interopRequireDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\n\nvar _isUndefined2 = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _isArray2 = _interopRequireDefault(__webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\"));\n\nvar React = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _classnames = _interopRequireDefault(__webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\"));\n\nvar _List = _interopRequireDefault(__webpack_require__(/*! react-virtualized/dist/commonjs/List */ \"./node_modules/react-virtualized/dist/commonjs/List/index.js\"));\n\nvar _AutoSizer = _interopRequireDefault(__webpack_require__(/*! react-virtualized/dist/commonjs/AutoSizer */ \"./node_modules/react-virtualized/dist/commonjs/AutoSizer/index.js\"));\n\nvar _CellMeasurer = __webpack_require__(/*! react-virtualized/dist/commonjs/CellMeasurer */ \"./node_modules/react-virtualized/dist/commonjs/CellMeasurer/index.js\");\n\nvar _reactLifecyclesCompat = __webpack_require__(/*! react-lifecycles-compat */ \"./node_modules/react-lifecycles-compat/react-lifecycles-compat.es.js\");\n\nvar _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _CheckTreeNode = _interopRequireDefault(__webpack_require__(/*! ./CheckTreeNode */ \"./src/CheckTreePicker/CheckTreeNode.tsx\"));\n\nvar _constants = __webpack_require__(/*! ../constants */ \"./src/constants.ts\");\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Picker = __webpack_require__(/*! ../Picker */ \"./src/Picker/index.ts\");\n\nvar _utils2 = __webpack_require__(/*! ./utils */ \"./src/CheckTreePicker/utils.ts\");\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _propTypes2 = __webpack_require__(/*! ../Picker/propTypes */ \"./src/Picker/propTypes.ts\");\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/CheckTreePicker/CheckTreePicker.tsx\";\n// default value for virtualized\nvar defaultHeight = 360;\nvar defaultWidth = 200;\n\nvar CheckTreePicker =\n/*#__PURE__*/\nfunction (_React$Component) {\n (0, _inheritsLoose2.default)(CheckTreePicker, _React$Component);\n\n function CheckTreePicker(_props) {\n var _this;\n\n _this = _React$Component.call(this, _props) || this;\n _this.menuRef = void 0;\n _this.treeViewRef = void 0;\n _this.positionRef = void 0;\n _this.listRef = void 0;\n _this.triggerRef = void 0;\n _this.toggleRef = void 0;\n\n _this.getValue = function (props) {\n if (props === void 0) {\n props = _this.props;\n }\n\n var _props2 = props,\n value = _props2.value,\n defaultValue = _props2.defaultValue,\n _props2$uncheckableIt = _props2.uncheckableItemValues,\n uncheckableItemValues = _props2$uncheckableIt === void 0 ? [] : _props2$uncheckableIt;\n\n if (value && value.length) {\n return value.filter(function (v) {\n return !uncheckableItemValues.includes(v);\n });\n }\n\n if (defaultValue && defaultValue.length > 0) {\n return defaultValue.filter(function (v) {\n return !uncheckableItemValues.includes(v);\n });\n }\n\n return [];\n };\n\n _this.getElementByDataKey = function (dataKey) {\n var ele = _this.nodeRefs[dataKey];\n\n if (ele instanceof Element) {\n return ele.querySelector(\".\" + _this.addTreePrefix('node-label'));\n }\n\n return null;\n };\n\n _this.getFocusableMenuItems = function () {\n var filterData = _this.state.filterData;\n var childrenKey = _this.props.childrenKey;\n var items = [];\n\n var loop = function loop(treeNodes) {\n treeNodes.forEach(function (node) {\n var nodeData = (0, _extends2.default)({}, node, {}, _this.nodes[node.refKey]);\n\n if (!(0, _utils2.getDisabledState)(_this.nodes, node, _this.props) && node.visible) {\n items.push(node);\n }\n\n if (node[childrenKey] && (0, _treeUtils.getExpandState)(nodeData, _this.props)) {\n loop(node[childrenKey]);\n }\n });\n };\n\n loop(filterData);\n return items;\n };\n\n _this.nodes = {};\n _this.activeNode = null;\n _this.cache = new _CellMeasurer.CellMeasurerCache({\n fixedWidth: true,\n minHeight: 20\n });\n _this.nodeRefs = {};\n\n _this.bindNodeRefs = function (refKey, ref) {\n _this.nodeRefs[refKey] = ref;\n };\n\n _this.getPositionInstance = function () {\n return _this.positionRef.current;\n };\n\n _this.getToggleInstance = function () {\n return _this.toggleRef.current;\n };\n\n _this.selectActiveItem = function (event) {\n var _this$getActiveItem = _this.getActiveItem(),\n nodeData = _this$getActiveItem.nodeData;\n\n _this.handleSelect(nodeData, event);\n };\n\n _this.focusNextItem = function () {\n var _node$focus;\n\n var _this$getItemsAndActi = _this.getItemsAndActiveIndex(),\n items = _this$getItemsAndActi.items,\n activeIndex = _this$getItemsAndActi.activeIndex;\n\n if (items.length === 0) {\n return;\n }\n\n var nextIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1;\n\n var node = _this.getElementByDataKey(items[nextIndex].refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus = node.focus) === null || _node$focus === void 0 ? void 0 : _node$focus.call(node);\n };\n\n _this.focusPreviousItem = function () {\n var _node$focus2;\n\n var _this$getItemsAndActi2 = _this.getItemsAndActiveIndex(),\n items = _this$getItemsAndActi2.items,\n activeIndex = _this$getItemsAndActi2.activeIndex;\n\n if (items.length === 0) {\n return;\n }\n\n var prevIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1;\n prevIndex = prevIndex >= 0 ? prevIndex : 0;\n\n var node = _this.getElementByDataKey(items[prevIndex].refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus2 = node.focus) === null || _node$focus2 === void 0 ? void 0 : _node$focus2.call(node);\n };\n\n _this.handleCloseDropdown = function () {\n var _this$triggerRef$curr, _this$triggerRef$curr2;\n\n (_this$triggerRef$curr = _this.triggerRef.current) === null || _this$triggerRef$curr === void 0 ? void 0 : (_this$triggerRef$curr2 = _this$triggerRef$curr.hide) === null || _this$triggerRef$curr2 === void 0 ? void 0 : _this$triggerRef$curr2.call(_this$triggerRef$curr);\n };\n\n _this.handleOpenDropdown = function () {\n var _this$triggerRef$curr3, _this$triggerRef$curr4;\n\n (_this$triggerRef$curr3 = _this.triggerRef.current) === null || _this$triggerRef$curr3 === void 0 ? void 0 : (_this$triggerRef$curr4 = _this$triggerRef$curr3.show) === null || _this$triggerRef$curr4 === void 0 ? void 0 : _this$triggerRef$curr4.call(_this$triggerRef$curr3);\n };\n\n _this.open = function () {\n var _this$handleOpenDropd, _this2;\n\n (_this$handleOpenDropd = (_this2 = _this).handleOpenDropdown) === null || _this$handleOpenDropd === void 0 ? void 0 : _this$handleOpenDropd.call(_this2);\n };\n\n _this.close = function () {\n var _this$handleCloseDrop, _this3;\n\n (_this$handleCloseDrop = (_this3 = _this).handleCloseDropdown) === null || _this$handleCloseDrop === void 0 ? void 0 : _this$handleCloseDrop.call(_this3);\n };\n\n _this.handleToggleDropdown = function () {\n var active = _this.state.active;\n\n if (active) {\n _this.handleCloseDropdown();\n\n return;\n }\n\n _this.handleOpenDropdown();\n };\n\n _this.everyChildChecked = function (nodes, node) {\n var list = [];\n Object.keys(nodes).forEach(function (refKey) {\n var _curNode$parentNode;\n\n var curNode = nodes[refKey];\n\n if (((_curNode$parentNode = curNode.parentNode) === null || _curNode$parentNode === void 0 ? void 0 : _curNode$parentNode.refKey) === node.refKey && !curNode.uncheckable) {\n list.push(curNode);\n }\n });\n return list.every(function (l) {\n return l.check;\n });\n };\n\n _this.addPrefix = function (name) {\n return (0, _utils.prefix)(_this.props.classPrefix)(name);\n };\n\n _this.addTreePrefix = function (name) {\n return (0, _utils.prefix)((0, _utils.defaultClassPrefix)('check-tree'))(name);\n };\n\n _this.handleSelect = function (activeNode, event) {\n var _this$props = _this.props,\n onChange = _this$props.onChange,\n onSelect = _this$props.onSelect,\n value = _this$props.value;\n\n var selectedValues = _this.toggleChecked(activeNode, !_this.nodes[activeNode.refKey].check);\n\n if (!(0, _isUndefined2.default)(value)) {\n _this.activeNode = activeNode;\n } else {\n _this.unserializeLists({\n check: selectedValues\n });\n\n _this.setState({\n activeNode: activeNode,\n selectedValues: selectedValues,\n hasValue: !!selectedValues.length\n });\n }\n\n onChange === null || onChange === void 0 ? void 0 : onChange(selectedValues, event);\n onSelect === null || onSelect === void 0 ? void 0 : onSelect(activeNode, selectedValues, event);\n };\n\n _this.handleToggle = function (node) {\n var _this$props2 = _this.props,\n valueKey = _this$props2.valueKey,\n childrenKey = _this$props2.childrenKey,\n onExpand = _this$props2.onExpand,\n expandItemValues = _this$props2.expandItemValues;\n\n var nextExpandItemValues = _this.toggleExpand(node, !node.expand);\n\n if ((0, _isUndefined2.default)(expandItemValues)) {\n _this.unserializeLists({\n expand: nextExpandItemValues\n });\n\n _this.setState({\n expandItemValues: nextExpandItemValues\n });\n }\n\n onExpand === null || onExpand === void 0 ? void 0 : onExpand(nextExpandItemValues, node, (0, _Picker.createConcatChildrenFunction)(node, node[valueKey], {\n valueKey: valueKey,\n childrenKey: childrenKey\n }));\n };\n\n _this.handleKeyDown = function (event) {\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextItem,\n up: _this.focusPreviousItem,\n enter: _this.selectActiveItem,\n del: _this.handleClean\n });\n };\n\n _this.handleToggleKeyDown = function (event) {\n var _this$state = _this.state,\n activeNode = _this$state.activeNode,\n active = _this$state.active; // enter\n\n if ((!activeNode || !active) && event.keyCode === 13) {\n _this.handleToggleDropdown();\n } // delete\n\n\n if (event.keyCode === 8) {\n _this.handleClean(event);\n }\n\n if (!_this.treeViewRef.current) {\n return;\n }\n\n if (event.target instanceof HTMLElement) {\n var className = event.target.className;\n\n if (className.includes(_this.addPrefix('toggle')) || className.includes(_this.addPrefix('toggle-custom')) || className.includes(_this.addPrefix('search-bar-input'))) {\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextItem\n });\n }\n }\n };\n\n _this.handleSearch = function (value, event) {\n var filterData = _this.state.filterData;\n var _this$props3 = _this.props,\n onSearch = _this$props3.onSearch,\n searchKeyword = _this$props3.searchKeyword;\n\n if ((0, _isUndefined2.default)(searchKeyword)) {\n _this.setState({\n filterData: _this.getFilterData(value, filterData),\n searchKeyword: value\n });\n }\n\n onSearch === null || onSearch === void 0 ? void 0 : onSearch(value, event);\n };\n\n _this.handleClean = function (evnet) {\n var _this$props$onChange, _this$props4;\n\n _this.setState({\n selectedValues: [],\n hasValue: false,\n activeNode: {}\n });\n\n _this.unserializeLists({\n check: []\n });\n\n (_this$props$onChange = (_this$props4 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props4, [], evnet);\n };\n\n _this.handleOnOpen = function () {\n var _this$props$onOpen, _this$props5;\n\n var activeNode = _this.state.activeNode;\n\n if (activeNode) {\n var _node$focus3;\n\n var node = _this.getElementByDataKey(activeNode.refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus3 = node.focus) === null || _node$focus3 === void 0 ? void 0 : _node$focus3.call(node);\n }\n\n (_this$props$onOpen = (_this$props5 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props5);\n\n _this.setState({\n active: true\n });\n };\n\n _this.handleOnClose = function () {\n var filterData = _this.state.filterData;\n var _this$props6 = _this.props,\n onClose = _this$props6.onClose,\n searchKeyword = _this$props6.searchKeyword;\n\n if ((0, _isUndefined2.default)(searchKeyword)) {\n _this.setState({\n filterData: _this.getFilterData('', filterData),\n searchKeyword: ''\n });\n }\n\n onClose === null || onClose === void 0 ? void 0 : onClose();\n\n _this.setState({\n active: false\n });\n };\n\n _this.measureRowRenderer = function (nodes) {\n return function (_ref) {\n var key = _ref.key,\n index = _ref.index,\n style = _ref.style,\n parent = _ref.parent;\n var node = nodes[index];\n return React.createElement(_CellMeasurer.CellMeasurer, {\n cache: _this.cache,\n columnIndex: 0,\n key: key,\n rowIndex: index,\n parent: parent,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1070\n },\n __self: this\n }, function () {\n return _this.renderVirtualNode(node, {\n key: key,\n style: style\n });\n });\n };\n };\n\n var _value = _props.value,\n data = _props.data,\n cascade = _props.cascade,\n _childrenKey = _props.childrenKey,\n _searchKeyword = _props.searchKeyword;\n _this.nodes = {};\n\n var nextValue = _this.getValue(_props);\n\n var _nextExpandItemValues = (0, _treeUtils.getExpandItemValues)(_props);\n\n var nextData = [].concat(data);\n\n _this.flattenNodes(nextData, _props);\n\n _this.unserializeLists({\n check: nextValue,\n expand: _nextExpandItemValues\n }, _props, true);\n\n _this.state = {\n data: data,\n value: _value,\n cascade: cascade,\n hasValue: _this.hasValue(nextValue),\n expandAll: (0, _treeUtils.getExpandAll)(_props),\n filterData: _this.getFilterData(_searchKeyword, nextData, _props),\n searchKeyword: _searchKeyword || '',\n selectedValues: nextValue,\n expandItemValues: _this.serializeList('expand'),\n uncheckableItemValues: _props.uncheckableItemValues,\n isSomeNodeHasChildren: (0, _utils2.isSomeNodeHasChildren)(data, _childrenKey)\n };\n _this.treeViewRef = React.createRef();\n _this.positionRef = React.createRef();\n _this.listRef = React.createRef();\n _this.triggerRef = React.createRef();\n _this.toggleRef = React.createRef(); // for test\n\n _this.menuRef = React.createRef();\n (0, _treeUtils.treeDeprecatedWarning)(_props, ['expandAll']);\n return _this;\n }\n\n CheckTreePicker.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {\n var value = nextProps.value,\n data = nextProps.data,\n cascade = nextProps.cascade,\n expandAll = nextProps.expandAll,\n searchKeyword = nextProps.searchKeyword,\n uncheckableItemValues = nextProps.uncheckableItemValues,\n expandItemValues = nextProps.expandItemValues;\n var nextState = {};\n\n if ((0, _isArray2.default)(data) && (0, _isArray2.default)(prevState.data) && prevState.data !== data) {\n nextState.data = data;\n }\n\n if ((0, _treeUtils.compareArray)(value, prevState.value)) {\n nextState.value = value;\n }\n\n if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues) && (0, _isArray2.default)(expandItemValues)) {\n nextState.expandItemValues = expandItemValues;\n }\n\n if ((0, _treeUtils.compareArray)(uncheckableItemValues, prevState.uncheckableItemValues) && (0, _isArray2.default)(uncheckableItemValues)) {\n nextState.uncheckableItemValues = uncheckableItemValues;\n }\n\n if (!(0, _isUndefined2.default)(searchKeyword) && searchKeyword !== prevState.searchKeyword) {\n nextState.searchKeyword = searchKeyword;\n }\n\n if (cascade !== prevState.cascade) {\n nextState.cascade = cascade;\n }\n\n if (expandAll !== prevState.expandAll) {\n nextState.expandAll = expandAll;\n }\n\n return Object.keys(nextState).length ? nextState : null;\n };\n\n var _proto = CheckTreePicker.prototype;\n\n _proto.componentDidUpdate = function componentDidUpdate(_prevProps, prevState) {\n this.updateDataChange(prevState);\n this.updateValueChange(prevState);\n this.updateExpandItemValuesChange(prevState);\n this.updateUncheckableItemValuesChange(prevState);\n this.updateCascadeChange(prevState);\n this.updateSearchKeywordChange(prevState);\n\n if (this.listRef.current) {\n this.listRef.current.forceUpdateGrid();\n }\n };\n\n _proto.updateDataChange = function updateDataChange(prevState) {\n var searchKeyword = this.state.searchKeyword;\n var _this$props7 = this.props,\n _this$props7$data = _this$props7.data,\n data = _this$props7$data === void 0 ? [] : _this$props7$data,\n childrenKey = _this$props7.childrenKey;\n\n if (prevState.data !== data) {\n var nextData = [].concat(data);\n this.nodes = {};\n this.flattenNodes(nextData);\n this.unserializeLists({\n check: this.getValue()\n });\n this.setState({\n data: nextData,\n filterData: this.getFilterData(searchKeyword, nextData),\n isSomeNodeHasChildren: (0, _utils2.isSomeNodeHasChildren)(nextData, childrenKey),\n hasValue: this.hasValue(),\n expandItemValues: this.serializeList('expand')\n });\n }\n };\n\n _proto.updateValueChange = function updateValueChange(prevState) {\n var expandItemValues = this.state.expandItemValues;\n var value = this.props.value;\n\n if ((0, _treeUtils.compareArray)(value, prevState.value)) {\n this.unserializeLists({\n check: value !== null && value !== void 0 ? value : [],\n expand: expandItemValues\n });\n this.setState({\n selectedValues: value,\n hasValue: this.hasValue(value),\n activeNode: value.length ? this.activeNode : null\n });\n }\n };\n\n _proto.updateExpandItemValuesChange = function updateExpandItemValuesChange(prevState) {\n var expandItemValues = this.props.expandItemValues;\n\n if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues) && (0, _isArray2.default)(expandItemValues)) {\n this.unserializeLists({\n expand: expandItemValues\n });\n this.setState({\n expandItemValues: expandItemValues\n });\n }\n };\n\n _proto.updateUncheckableItemValuesChange = function updateUncheckableItemValuesChange(prevState) {\n var _this$state2 = this.state,\n data = _this$state2.data,\n selectedValues = _this$state2.selectedValues,\n expandItemValues = _this$state2.expandItemValues;\n var uncheckableItemValues = this.props.uncheckableItemValues;\n\n if ((0, _treeUtils.compareArray)(uncheckableItemValues, prevState.uncheckableItemValues) && (0, _isArray2.default)(uncheckableItemValues)) {\n this.flattenNodes(data);\n this.unserializeLists({\n check: selectedValues,\n expand: expandItemValues\n });\n this.setState({\n hasValue: this.hasValue()\n });\n }\n };\n\n _proto.updateCascadeChange = function updateCascadeChange(prevState) {\n var _this$state3 = this.state,\n data = _this$state3.data,\n selectedValues = _this$state3.selectedValues,\n expandItemValues = _this$state3.expandItemValues;\n var cascade = this.props.cascade; // cascade 改变时,重新初始化\n\n if (cascade !== prevState.cascade && cascade) {\n this.flattenNodes(data);\n this.unserializeLists({\n check: selectedValues,\n expand: expandItemValues\n });\n this.setState({\n cascade: cascade\n });\n }\n };\n\n _proto.updateSearchKeywordChange = function updateSearchKeywordChange(prevState) {\n var filterData = this.state.filterData;\n var searchKeyword = this.props.searchKeyword;\n\n if (!(0, _isUndefined2.default)(searchKeyword) && prevState.searchKeyword !== searchKeyword) {\n this.setState({\n filterData: this.getFilterData(searchKeyword, filterData)\n });\n }\n };\n\n _proto.getNodeCheckState = function getNodeCheckState(node, cascade) {\n var childrenKey = this.props.childrenKey;\n\n if (!node[childrenKey] || !node[childrenKey].length || !cascade) {\n this.nodes[node.refKey].checkAll = false;\n return node.check ? _constants.CHECK_STATE.CHECK : _constants.CHECK_STATE.UNCHECK;\n }\n\n if ((0, _utils2.isEveryChildChecked)(node, this.nodes, this.props)) {\n this.nodes[node.refKey].checkAll = true;\n this.nodes[node.refKey].check = true;\n return _constants.CHECK_STATE.CHECK;\n }\n\n if ((0, _utils2.isSomeChildChecked)(node, this.nodes, this.props)) {\n this.nodes[node.refKey].checkAll = false;\n return _constants.CHECK_STATE.INDETERMINATE;\n }\n\n return _constants.CHECK_STATE.UNCHECK;\n };\n\n _proto.getFilterData = function getFilterData(searchKeyword, data, props) {\n if (searchKeyword === void 0) {\n searchKeyword = '';\n }\n\n if (props === void 0) {\n props = this.props;\n }\n\n var _props3 = props,\n labelKey = _props3.labelKey,\n childrenKey = _props3.childrenKey,\n searchBy = _props3.searchBy;\n\n var setVisible = function setVisible(nodes) {\n if (nodes === void 0) {\n nodes = [];\n }\n\n return nodes.forEach(function (item) {\n item.visible = searchBy ? searchBy(searchKeyword, item[labelKey], item) : (0, _Picker.shouldDisplay)(item[labelKey], searchKeyword);\n\n if ((0, _isArray2.default)(item[childrenKey])) {\n setVisible(item[childrenKey]);\n item[childrenKey].forEach(function (child) {\n if (child.visible) {\n item.visible = child.visible;\n }\n });\n }\n });\n };\n\n setVisible(data);\n return data;\n };\n\n _proto.getActiveElementOption = function getActiveElementOption(options, refKey) {\n var childrenKey = this.props.childrenKey;\n\n for (var i = 0; i < options.length; i += 1) {\n var _options$i$childrenKe;\n\n if (options[i].refKey === refKey) {\n return options[i];\n } else if ((_options$i$childrenKe = options[i][childrenKey]) === null || _options$i$childrenKe === void 0 ? void 0 : _options$i$childrenKe.length) {\n var active = this.getActiveElementOption(options[i][childrenKey], refKey);\n\n if (!(0, _isEmpty2.default)(active)) {\n return active;\n }\n }\n }\n\n return {};\n };\n\n _proto.getFlattenTreeData = function getFlattenTreeData(nodes) {\n var _this4 = this;\n\n var expandItemValues = this.state.expandItemValues;\n var _this$props8 = this.props,\n childrenKey = _this$props8.childrenKey,\n valueKey = _this$props8.valueKey;\n return (0, _treeUtils.flattenTree)(nodes, childrenKey, function (node) {\n var formatted = {};\n var curNode = _this4.nodes[node.refKey];\n var parentKeys = (0, _treeUtils.getNodeParents)(curNode, 'parentNode', valueKey);\n\n if (curNode) {\n formatted = (0, _extends2.default)({}, node, {\n check: curNode.check,\n expand: curNode.expand,\n uncheckable: curNode.uncheckable,\n layer: curNode.layer,\n parentNode: curNode.parentNode,\n showNode: (0, _treeUtils.shouldShowNodeByExpanded)(expandItemValues, parentKeys)\n });\n }\n\n return formatted;\n });\n };\n\n _proto.getItemsAndActiveIndex = function getItemsAndActiveIndex() {\n var items = this.getFocusableMenuItems();\n var activeIndex = -1;\n items.forEach(function (item, index) {\n if (document.activeElement !== null) {\n if (item.refKey === document.activeElement.getAttribute('data-key')) {\n activeIndex = index;\n }\n }\n });\n return {\n items: items,\n activeIndex: activeIndex\n };\n };\n\n _proto.getActiveItem = function getActiveItem() {\n var filterData = this.state.filterData;\n var activeItem = document.activeElement;\n\n if (activeItem !== null) {\n var _activeItem$dataset, _activeItem$dataset2, _this$nodes$nodeData$, _this$nodes$nodeData$2;\n\n var key = activeItem === null || activeItem === void 0 ? void 0 : (_activeItem$dataset = activeItem.dataset) === null || _activeItem$dataset === void 0 ? void 0 : _activeItem$dataset.key;\n var layer = activeItem === null || activeItem === void 0 ? void 0 : (_activeItem$dataset2 = activeItem.dataset) === null || _activeItem$dataset2 === void 0 ? void 0 : _activeItem$dataset2.layer;\n var nodeData = this.getActiveElementOption(filterData, key);\n nodeData.check = !((_this$nodes$nodeData$ = this.nodes[nodeData.refKey]) === null || _this$nodes$nodeData$ === void 0 ? void 0 : _this$nodes$nodeData$.check);\n nodeData.parentNode = (_this$nodes$nodeData$2 = this.nodes[nodeData.refKey]) === null || _this$nodes$nodeData$2 === void 0 ? void 0 : _this$nodes$nodeData$2.parentNode;\n return {\n nodeData: nodeData,\n layer: layer\n };\n }\n\n return {};\n }\n /**\n * 获取已选择的items,用于显示在placeholder\n */\n ;\n\n _proto.getSelectedItems = function getSelectedItems(selectedValues) {\n var _this5 = this;\n\n var valueKey = this.props.valueKey;\n var checkItems = [];\n Object.keys(this.nodes).map(function (refKey) {\n var node = _this5.nodes[refKey];\n\n if (selectedValues.some(function (value) {\n return (0, _shallowEqual.default)(node[valueKey], value);\n })) {\n checkItems.push(node);\n }\n });\n return checkItems;\n }\n /**\n * 判断传入的 value 是否存在于data 中\n * @param {*} values\n */\n ;\n\n _proto.hasValue = function hasValue(values) {\n var _this6 = this;\n\n if (values === void 0) {\n values = this.state.selectedValues;\n }\n\n var valueKey = this.props.valueKey;\n var selectedValues = Object.keys(this.nodes).map(function (refKey) {\n return _this6.nodes[refKey][valueKey];\n }).filter(function (item) {\n return values.some(function (v) {\n return (0, _shallowEqual.default)(v, item);\n });\n });\n return !!selectedValues.length;\n }\n /**\n * 拍平数组,将tree 转换为一维对象\n * @param {*} nodes tree data\n * @param {*} ref 当前层级\n */\n ;\n\n _proto.flattenNodes = function flattenNodes(nodes, props, ref, parentNode, layer) {\n var _this7 = this;\n\n if (ref === void 0) {\n ref = '0';\n }\n\n if (layer === void 0) {\n layer = 0;\n }\n\n var _ref2 = props || this.props,\n labelKey = _ref2.labelKey,\n valueKey = _ref2.valueKey,\n childrenKey = _ref2.childrenKey;\n\n if (!Array.isArray(nodes) || nodes.length === 0) {\n return;\n }\n\n nodes.forEach(function (node, index) {\n var _this7$nodes$refKey;\n\n var refKey = ref + \"-\" + index;\n node.refKey = refKey;\n _this7.nodes[refKey] = (_this7$nodes$refKey = {\n layer: layer\n }, _this7$nodes$refKey[labelKey] = node[labelKey], _this7$nodes$refKey[valueKey] = node[valueKey], _this7$nodes$refKey.expand = (0, _treeUtils.getExpandState)(node, props || _this7.props), _this7$nodes$refKey.uncheckable = (0, _utils2.getUncheckableState)(node, props || _this7.props), _this7$nodes$refKey.refKey = refKey, _this7$nodes$refKey);\n\n if (parentNode) {\n _this7.nodes[refKey].parentNode = parentNode;\n }\n\n _this7.flattenNodes(node[childrenKey], props, refKey, _this7.nodes[refKey], layer + 1);\n });\n }\n /**\n * 过滤选中的 values 中不包含 uncheckableItemValues 的那些值\n * @param {*} values\n */\n ;\n\n _proto.filterSelectedValues = function filterSelectedValues(values) {\n var _this$props$uncheckab = this.props.uncheckableItemValues,\n uncheckableItemValues = _this$props$uncheckab === void 0 ? [] : _this$props$uncheckab;\n return values.filter(function (value) {\n return !uncheckableItemValues.includes(value);\n });\n };\n\n _proto.serializeList = function serializeList(key, nodes) {\n if (nodes === void 0) {\n nodes = this.nodes;\n }\n\n var valueKey = this.props.valueKey;\n var list = [];\n Object.keys(nodes).forEach(function (refKey) {\n if (nodes[refKey][key]) {\n list.push(nodes[refKey][valueKey]);\n }\n });\n return list;\n };\n\n _proto.serializeListOnlyParent = function serializeListOnlyParent(key, nodes) {\n if (nodes === void 0) {\n nodes = this.nodes;\n }\n\n var valueKey = this.props.valueKey;\n var list = [];\n Object.keys(nodes).forEach(function (refKey) {\n var currentNode = nodes[refKey];\n\n if (currentNode.parentNode) {\n var _currentNode$parentNo;\n\n var parentNode = nodes[(_currentNode$parentNo = currentNode.parentNode) === null || _currentNode$parentNo === void 0 ? void 0 : _currentNode$parentNo.refKey];\n\n if (currentNode[key]) {\n if (!(parentNode === null || parentNode === void 0 ? void 0 : parentNode.checkAll)) {\n list.push(nodes[refKey][valueKey]);\n } else if (parentNode === null || parentNode === void 0 ? void 0 : parentNode.uncheckable) {\n list.push(nodes[refKey][valueKey]);\n }\n }\n } else {\n if (currentNode[key]) {\n list.push(nodes[refKey][valueKey]);\n }\n }\n });\n return list;\n };\n\n _proto.unserializeLists = function unserializeLists(lists, nextProps, initial) {\n var _this8 = this;\n\n if (nextProps === void 0) {\n nextProps = this.props;\n }\n\n if (initial === void 0) {\n initial = false;\n }\n\n var _nextProps = nextProps,\n valueKey = _nextProps.valueKey,\n cascade = _nextProps.cascade,\n _nextProps$uncheckabl = _nextProps.uncheckableItemValues,\n uncheckableItemValues = _nextProps$uncheckabl === void 0 ? [] : _nextProps$uncheckabl;\n var expandAll = (0, _treeUtils.getExpandAll)(nextProps); // Reset values to false\n\n Object.keys(this.nodes).forEach(function (refKey) {\n Object.keys(lists).forEach(function (listKey) {\n if (listKey === 'check') {\n var node = _this8.nodes[refKey];\n\n if (cascade && 'parentNode' in node) {\n node[listKey] = node.parentNode[listKey];\n } else {\n node[listKey] = false;\n }\n\n lists[listKey].forEach(function (value) {\n if ((0, _shallowEqual.default)(_this8.nodes[refKey][valueKey], value) && !uncheckableItemValues.some(function (uncheckableValue) {\n return (0, _shallowEqual.default)(value, uncheckableValue);\n })) {\n _this8.nodes[refKey][listKey] = true;\n }\n });\n }\n\n if (listKey === 'expand') {\n _this8.nodes[refKey][listKey] = false;\n\n if (lists[listKey].length) {\n lists[listKey].forEach(function (value) {\n if ((0, _shallowEqual.default)(_this8.nodes[refKey][valueKey], value)) {\n _this8.nodes[refKey][listKey] = true;\n }\n });\n } else {\n _this8.nodes[refKey][listKey] = initial ? expandAll : false;\n }\n }\n });\n });\n };\n\n _proto.toggleChecked = function toggleChecked(node, isChecked) {\n var nodes = (0, _utils.clone)(this.nodes);\n this.toggleDownChecked(nodes, node, isChecked);\n node.parentNode && this.toggleUpChecked(nodes, node.parentNode, isChecked);\n var values = this.serializeListOnlyParent('check', nodes);\n return this.filterSelectedValues(values);\n };\n\n _proto.toggleUpChecked = function toggleUpChecked(nodes, node, checked) {\n var cascade = this.props.cascade;\n var currentNode = nodes[node.refKey];\n\n if (cascade) {\n if (!checked) {\n currentNode.check = checked;\n currentNode.checkAll = checked;\n } else {\n if (this.everyChildChecked(nodes, node)) {\n currentNode.check = true;\n currentNode.checkAll = true;\n } else {\n currentNode.check = false;\n currentNode.checkAll = false;\n }\n }\n\n if (node.parentNode) {\n this.toggleUpChecked(nodes, node.parentNode, checked);\n }\n }\n };\n\n _proto.toggleDownChecked = function toggleDownChecked(nodes, node, isChecked) {\n var _this9 = this;\n\n var _this$props9 = this.props,\n childrenKey = _this$props9.childrenKey,\n cascade = _this$props9.cascade;\n nodes[node.refKey].check = isChecked;\n\n if (!node[childrenKey] || !node[childrenKey].length || !cascade) {\n nodes[node.refKey].checkAll = false;\n } else {\n nodes[node.refKey].checkAll = isChecked;\n node[childrenKey].forEach(function (child) {\n _this9.toggleDownChecked(nodes, child, isChecked);\n });\n }\n };\n\n _proto.toggleNode = function toggleNode(key, node, toggleValue) {\n // 如果该节点处于 disabledCheckbox,则忽略该值\n if (!node.uncheckable) {\n this.nodes[node.refKey][key] = toggleValue;\n }\n };\n\n _proto.toggleExpand = function toggleExpand(node, isExpand) {\n var valueKey = this.props.valueKey;\n var expandItemValues = new Set(this.serializeList('expand'));\n\n if (isExpand) {\n expandItemValues.add(node[valueKey]);\n } else {\n expandItemValues.delete(node[valueKey]);\n }\n\n return Array.from(expandItemValues);\n };\n\n _proto.renderDropdownMenu = function renderDropdownMenu() {\n var _this$props10 = this.props,\n locale = _this$props10.locale,\n menuStyle = _this$props10.menuStyle,\n searchable = _this$props10.searchable,\n renderMenu = _this$props10.renderMenu,\n searchKeyword = _this$props10.searchKeyword,\n renderExtraFooter = _this$props10.renderExtraFooter,\n menuClassName = _this$props10.menuClassName,\n menuAutoWidth = _this$props10.menuAutoWidth;\n var keyword = !(0, _isUndefined2.default)(searchKeyword) ? searchKeyword : this.state.searchKeyword;\n var classes = (0, _classnames.default)(menuClassName, this.addPrefix('check-tree-menu'));\n var menu = this.renderCheckTree();\n return React.createElement(_Picker.MenuWrapper, {\n autoWidth: menuAutoWidth,\n className: classes,\n style: menuStyle,\n ref: this.menuRef,\n getToggleInstance: this.getToggleInstance,\n getPositionInstance: this.getPositionInstance,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 922\n },\n __self: this\n }, searchable ? React.createElement(_Picker.SearchBar, {\n placeholder: locale.searchPlaceholder,\n key: \"searchBar\",\n onChange: this.handleSearch,\n value: keyword,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 931\n },\n __self: this\n }) : null, renderMenu ? renderMenu(menu) : menu, renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());\n };\n\n _proto.renderNode = function renderNode(node, layer) {\n var _this10 = this;\n\n var _this$state4 = this.state,\n activeNode = _this$state4.activeNode,\n searchKeyword = _this$state4.searchKeyword;\n var _this$props11 = this.props,\n valueKey = _this$props11.valueKey,\n labelKey = _this$props11.labelKey,\n childrenKey = _this$props11.childrenKey,\n renderTreeNode = _this$props11.renderTreeNode,\n renderTreeIcon = _this$props11.renderTreeIcon,\n cascade = _this$props11.cascade,\n locale = _this$props11.locale;\n var visible = node.visible,\n refKey = node.refKey; // 当处于搜索时,需要将所有节点都展开\n\n var expand = (0, _treeUtils.getExpandWhenSearching)(searchKeyword, node.expand);\n\n if (!visible) {\n return null;\n }\n\n var key = (0, _isString2.default)(node[valueKey]) || (0, _isNumber2.default)(node[valueKey]) ? node[valueKey] : refKey;\n var children = node[childrenKey]; // 当用户进行搜索时,hasChildren的判断要变成判断是否存在 visible 为 true 的子节点\n\n var visibleChildren = (0, _isUndefined2.default)(searchKeyword) || searchKeyword.length === 0 ? !!children : (0, _treeUtils.hasVisibleChildren)(node, childrenKey);\n var props = {\n value: node[valueKey],\n label: node[labelKey],\n layer: layer,\n expand: expand,\n rtl: locale.rtl,\n focus: activeNode ? (0, _shallowEqual.default)(activeNode[valueKey], node[valueKey]) : false,\n visible: node.visible,\n disabled: (0, _utils2.getDisabledState)(this.nodes, node, this.props),\n nodeData: node,\n checkState: this.getNodeCheckState(node, cascade),\n hasChildren: visibleChildren,\n uncheckable: node.uncheckable,\n allUncheckable: (0, _utils2.getSiblingNodeUncheckable)(node, this.nodes),\n onSelect: this.handleSelect,\n onTreeToggle: this.handleToggle,\n onRenderTreeNode: renderTreeNode,\n onRenderTreeIcon: renderTreeIcon\n };\n\n if (props.hasChildren) {\n var _classNames;\n\n layer += 1; // 是否展开树节点且子节点不为空\n\n var openClass = this.addTreePrefix('open');\n var childrenClass = (0, _classnames.default)(this.addTreePrefix('node-children'), (_classNames = {}, _classNames[openClass] = expand && visibleChildren, _classNames));\n var nodes = children || [];\n return React.createElement(\"div\", {\n className: childrenClass,\n key: key,\n ref: this.bindNodeRefs.bind(this, refKey),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1002\n },\n __self: this\n }, React.createElement(_CheckTreeNode.default, (0, _extends2.default)({}, props, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1003\n },\n __self: this\n })), React.createElement(\"div\", {\n className: this.addTreePrefix('children'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1004\n },\n __self: this\n }, nodes.map(function (child) {\n return _this10.renderNode(child, layer);\n })));\n }\n\n return React.createElement(_CheckTreeNode.default, (0, _extends2.default)({\n key: key,\n innerRef: this.bindNodeRefs.bind(this, refKey)\n }, props, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1011\n },\n __self: this\n }));\n };\n\n _proto.renderVirtualNode = function renderVirtualNode(node, options) {\n var _this$state5 = this.state,\n activeNode = _this$state5.activeNode,\n expandAll = _this$state5.expandAll,\n searchKeyword = _this$state5.searchKeyword;\n var _this$props12 = this.props,\n valueKey = _this$props12.valueKey,\n labelKey = _this$props12.labelKey,\n childrenKey = _this$props12.childrenKey,\n renderTreeNode = _this$props12.renderTreeNode,\n renderTreeIcon = _this$props12.renderTreeIcon,\n cascade = _this$props12.cascade,\n locale = _this$props12.locale;\n var key = options.key,\n style = options.style;\n var layer = node.layer,\n refKey = node.refKey,\n showNode = node.showNode;\n var expand = (0, _treeUtils.getExpandWhenSearching)(searchKeyword, node.expand);\n var children = node[childrenKey];\n var props = {\n value: node[valueKey],\n label: node[labelKey],\n layer: layer,\n expand: expand,\n rtl: locale.rtl,\n focus: activeNode ? (0, _shallowEqual.default)(activeNode[valueKey], node[valueKey]) : false,\n visible: node.visible,\n disabled: (0, _utils2.getDisabledState)(this.nodes, node, this.props),\n nodeData: node,\n children: children,\n expandAll: expandAll,\n checkState: this.getNodeCheckState(node, cascade),\n parentNode: node.parentNode,\n hasChildren: !!children,\n uncheckable: node.uncheckable,\n allUncheckable: (0, _utils2.getSiblingNodeUncheckable)(node, this.nodes),\n onSelect: this.handleSelect,\n onTreeToggle: this.handleToggle,\n onRenderTreeNode: renderTreeNode,\n onRenderTreeIcon: renderTreeIcon\n };\n return showNode && React.createElement(_CheckTreeNode.default, (0, _extends2.default)({\n style: style,\n key: key,\n innerRef: this.bindNodeRefs.bind(this, refKey)\n }, props, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1056\n },\n __self: this\n }));\n };\n\n _proto.renderCheckTree = function renderCheckTree() {\n var _classNames2,\n _this11 = this,\n _classNames3;\n\n var _this$state6 = this.state,\n filterData = _this$state6.filterData,\n isSomeNodeHasChildren = _this$state6.isSomeNodeHasChildren;\n var _this$props13 = this.props,\n inline = _this$props13.inline,\n style = _this$props13.style,\n height = _this$props13.height,\n className = _this$props13.className,\n onScroll = _this$props13.onScroll,\n locale = _this$props13.locale,\n virtualized = _this$props13.virtualized; // 树节点的层级\n\n var layer = 0;\n var classes = (0, _classnames.default)((0, _utils.defaultClassPrefix)('check-tree'), (_classNames2 = {}, _classNames2[className] = inline, _classNames2['without-children'] = !isSomeNodeHasChildren, _classNames2));\n var formattedNodes = [];\n\n if (!virtualized) {\n formattedNodes = (0, _utils2.getFormattedTree)(filterData, this.nodes, this.props).map(function (node) {\n return _this11.renderNode(node, layer);\n });\n\n if (!formattedNodes.some(function (v) {\n return v !== null;\n })) {\n return React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1094\n },\n __self: this\n }, locale.noResultsText);\n }\n } else {\n formattedNodes = this.getFlattenTreeData(filterData).filter(function (n) {\n return n.showNode && n.visible;\n });\n\n if (!formattedNodes.length) {\n return React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1099\n },\n __self: this\n }, locale.noResultsText);\n }\n } // The height of virtualized tree should be subtract the value of paddingBottom\n\n\n var treeHeight = height - 12;\n var treeWidth = (0, _isUndefined2.default)(style === null || style === void 0 ? void 0 : style.width) ? defaultWidth : style.width;\n var listStyles = inline ? (0, _extends2.default)({\n height: height\n }, style) : style;\n var treeNodesClass = (0, _classnames.default)(this.addTreePrefix('nodes'), (_classNames3 = {}, _classNames3[this.addTreePrefix('all-uncheckable')] = (0, _utils2.getEveryFisrtLevelNodeUncheckable)(this.nodes), _classNames3));\n return React.createElement(\"div\", {\n ref: this.treeViewRef,\n className: classes,\n style: listStyles,\n onScroll: onScroll,\n onKeyDown: this.handleKeyDown,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1112\n },\n __self: this\n }, React.createElement(\"div\", {\n className: treeNodesClass,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1119\n },\n __self: this\n }, virtualized ? React.createElement(_AutoSizer.default, {\n defaultHeight: treeHeight,\n defaultWidth: treeWidth,\n style: {\n width: 'auto',\n height: 'auto'\n },\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1121\n },\n __self: this\n }, function (_ref3) {\n var height = _ref3.height,\n width = _ref3.width;\n return React.createElement(_List.default, {\n ref: _this11.listRef,\n width: width || treeWidth,\n height: height,\n rowHeight: 36,\n rowCount: formattedNodes.length,\n rowRenderer: _this11.measureRowRenderer(formattedNodes),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1127\n },\n __self: this\n });\n }) : formattedNodes));\n };\n\n _proto.render = function render() {\n var _this$props14 = this.props,\n cascade = _this$props14.cascade,\n style = _this$props14.style,\n locale = _this$props14.locale,\n inline = _this$props14.inline,\n disabled = _this$props14.disabled,\n valueKey = _this$props14.valueKey,\n labelKey = _this$props14.labelKey,\n cleanable = _this$props14.cleanable,\n countable = _this$props14.countable,\n placeholder = _this$props14.placeholder,\n toggleComponentClass = _this$props14.toggleComponentClass,\n onExited = _this$props14.onExited,\n onEntered = _this$props14.onEntered,\n onClean = _this$props14.onClean,\n renderValue = _this$props14.renderValue,\n positionRef = _this$props14.positionRef,\n rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props14, [\"cascade\", \"style\", \"locale\", \"inline\", \"disabled\", \"valueKey\", \"labelKey\", \"cleanable\", \"countable\", \"placeholder\", \"toggleComponentClass\", \"onExited\", \"onEntered\", \"onClean\", \"renderValue\", \"positionRef\"]);\n var _this$state7 = this.state,\n hasValue = _this$state7.hasValue,\n selectedValues = _this$state7.selectedValues;\n var hasValidValue = hasValue || selectedValues.length > 0 && (0, _isFunction2.default)(renderValue);\n var selectedItems = this.getSelectedItems(selectedValues);\n var selectedElement = placeholder;\n /**\n * if value is invalid and renderValue is undefined, then using placeholder.\n * if value is valid and renderValue is't undefined, then using renderValue()\n */\n\n if (selectedValues.length) {\n if (hasValue) {\n selectedElement = React.createElement(_Picker.SelectedElement, {\n selectedItems: selectedItems,\n countable: countable,\n valueKey: valueKey,\n labelKey: labelKey,\n prefix: this.addPrefix,\n cascade: cascade,\n locale: locale,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1178\n },\n __self: this\n });\n }\n\n if ((0, _isFunction2.default)(renderValue)) {\n selectedElement = renderValue(selectedValues, selectedItems, selectedElement);\n\n if ((0, _isNil2.default)(selectedElement)) {\n hasValidValue = false;\n }\n }\n }\n\n var unhandled = (0, _utils.getUnhandledProps)(CheckTreePicker, rest);\n var classes = (0, _Picker.getToggleWrapperClassName)('check-tree', this.addPrefix, this.props, hasValidValue);\n\n if (inline) {\n return this.renderCheckTree();\n }\n\n return React.createElement(_Picker.PickerToggleTrigger, {\n pickerProps: this.props,\n ref: this.triggerRef,\n positionRef: (0, _utils.mergeRefs)(this.positionRef, positionRef),\n onEntered: (0, _utils.createChainedFunction)(this.handleOnOpen, onEntered),\n onExited: (0, _utils.createChainedFunction)(this.handleOnClose, onExited),\n speaker: this.renderDropdownMenu(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1209\n },\n __self: this\n }, React.createElement(\"div\", {\n className: classes,\n style: style,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1217\n },\n __self: this\n }, React.createElement(_Picker.PickerToggle, (0, _extends2.default)({}, unhandled, {\n ref: this.toggleRef,\n onKeyDown: this.handleToggleKeyDown,\n onClean: (0, _utils.createChainedFunction)(this.handleClean, onClean),\n componentClass: toggleComponentClass,\n cleanable: cleanable && !disabled,\n hasValue: hasValidValue,\n active: this.state.active,\n \"aria-disabled\": disabled,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1218\n },\n __self: this\n }), selectedElement || locale.placeholder)));\n };\n\n return CheckTreePicker;\n}(React.Component);\n\nCheckTreePicker.propTypes = (0, _extends2.default)({}, _propTypes2.listPickerPropTypes, {\n height: _propTypes.default.number,\n inline: _propTypes.default.bool,\n cascade: _propTypes.default.bool,\n countable: _propTypes.default.bool,\n expandAll: _propTypes.default.bool,\n searchable: _propTypes.default.bool,\n virtualized: _propTypes.default.bool,\n searchKeyword: _propTypes.default.string,\n menuAutoWidth: _propTypes.default.bool,\n defaultExpandAll: _propTypes.default.bool,\n containerPadding: _propTypes.default.number,\n disabledItemValues: _propTypes.default.array,\n expandItemValues: _propTypes.default.array,\n defaultExpandItemValues: _propTypes.default.array,\n uncheckableItemValues: _propTypes.default.array,\n onSearch: _propTypes.default.func,\n onExpand: _propTypes.default.func,\n onSelect: _propTypes.default.func,\n onScroll: _propTypes.default.func,\n renderMenu: _propTypes.default.func,\n renderTreeNode: _propTypes.default.func,\n renderTreeIcon: _propTypes.default.func,\n searchBy: _propTypes.default.func\n});\nCheckTreePicker.defaultProps = (0, _extends2.default)({}, _propTypes2.listPickerDefaultProps, {\n height: defaultHeight,\n cascade: true,\n countable: true,\n searchable: true,\n menuAutoWidth: true,\n defaultValue: [],\n uncheckableItemValues: [],\n locale: {\n placeholder: 'Select',\n searchPlaceholder: 'Search',\n noResultsText: 'No results found',\n checkAll: 'All'\n }\n});\n(0, _reactLifecyclesCompat.polyfill)(CheckTreePicker);\n\nvar _default = (0, _utils.defaultProps)({\n classPrefix: 'picker'\n})(CheckTreePicker);\n\nexports.default = _default;\nmodule.exports = exports.default;\n\n//# sourceURL=webpack://rsuite/./src/CheckTreePicker/CheckTreePicker.tsx?");
7652
7652
 
7653
7653
  /***/ }),
7654
7654
 
@@ -10204,7 +10204,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
10204
10204
  /***/ (function(module, exports, __webpack_require__) {
10205
10205
 
10206
10206
  "use strict";
10207
- eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _extends3 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _inheritsLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ \"./node_modules/@babel/runtime/helpers/inheritsLoose.js\"));\n\nvar _isNil2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isFunction2 = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _isNumber2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNumber */ \"./node_modules/lodash/isNumber.js\"));\n\nvar _isString2 = _interopRequireDefault(__webpack_require__(/*! lodash/isString */ \"./node_modules/lodash/isString.js\"));\n\nvar _omit2 = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _get3 = _interopRequireDefault(__webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\"));\n\nvar _isEmpty2 = _interopRequireDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\n\nvar _isUndefined2 = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _isArray2 = _interopRequireDefault(__webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\"));\n\nvar React = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _classnames = _interopRequireDefault(__webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\"));\n\nvar _List = _interopRequireDefault(__webpack_require__(/*! react-virtualized/dist/commonjs/List */ \"./node_modules/react-virtualized/dist/commonjs/List/index.js\"));\n\nvar _AutoSizer = _interopRequireDefault(__webpack_require__(/*! react-virtualized/dist/commonjs/AutoSizer */ \"./node_modules/react-virtualized/dist/commonjs/AutoSizer/index.js\"));\n\nvar _CellMeasurer = __webpack_require__(/*! react-virtualized/dist/commonjs/CellMeasurer */ \"./node_modules/react-virtualized/dist/commonjs/CellMeasurer/index.js\");\n\nvar _reactLifecyclesCompat = __webpack_require__(/*! react-lifecycles-compat */ \"./node_modules/react-lifecycles-compat/react-lifecycles-compat.es.js\");\n\nvar _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _TreeNode = _interopRequireDefault(__webpack_require__(/*! ./TreeNode */ \"./src/TreePicker/TreeNode.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _Picker = __webpack_require__(/*! ../Picker */ \"./src/Picker/index.ts\");\n\nvar _constants = __webpack_require__(/*! ../constants */ \"./src/constants.ts\");\n\nvar _propTypes2 = __webpack_require__(/*! ../Picker/propTypes */ \"./src/Picker/propTypes.ts\");\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/TreePicker/TreePicker.tsx\";\n// default value for virtualized\nvar defaultHeight = 360;\nvar defaultWidth = 200;\n\nvar TreePicker =\n/*#__PURE__*/\nfunction (_React$Component) {\n (0, _inheritsLoose2.default)(TreePicker, _React$Component);\n\n function TreePicker(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.menuRef = void 0;\n _this.treeViewRef = void 0;\n _this.positionRef = void 0;\n _this.listRef = void 0;\n _this.triggerRef = void 0;\n _this.toggleRef = void 0;\n\n _this.getFocusableMenuItems = function () {\n var filterData = _this.state.filterData;\n var _this$props = _this.props,\n childrenKey = _this$props.childrenKey,\n _this$props$disabledI = _this$props.disabledItemValues,\n disabledItemValues = _this$props$disabledI === void 0 ? [] : _this$props$disabledI,\n valueKey = _this$props.valueKey;\n var items = [];\n\n var loop = function loop(nodes) {\n nodes.forEach(function (node) {\n var nodeData = (0, _extends3.default)({}, node, {}, _this.nodes[node.refKey]);\n var disabled = disabledItemValues.some(function (disabledItem) {\n return (0, _shallowEqual.default)(disabledItem, node[valueKey]);\n });\n\n if (!disabled) {\n items.push(node);\n }\n\n if (node[childrenKey] && (0, _treeUtils.getExpandState)(nodeData, _this.props)) {\n loop(node[childrenKey]);\n }\n });\n };\n\n loop(filterData);\n return items;\n };\n\n _this.getElementByDataKey = function (dataKey) {\n var ele = _this.nodeRefs[dataKey];\n\n if (ele instanceof Element) {\n return ele.querySelector(\".\" + _this.addTreePrefix('node-label'));\n }\n\n return null;\n };\n\n _this.nodes = {};\n _this.node = null;\n _this.cache = new _CellMeasurer.CellMeasurerCache({\n fixedWidth: true,\n minHeight: 20\n });\n _this.nodeRefs = {};\n _this.dragNode = null;\n\n _this.bindNodeRefs = function (refKey, ref) {\n _this.nodeRefs[refKey] = ref;\n };\n\n _this.getPositionInstance = function () {\n return _this.positionRef.current;\n };\n\n _this.getToggleInstance = function () {\n return _this.toggleRef.current;\n };\n\n _this.addPrefix = function (name) {\n return (0, _utils.prefix)(_this.props.classPrefix)(name);\n };\n\n _this.addTreePrefix = function (name) {\n return (0, _utils.prefix)((0, _utils.defaultClassPrefix)('tree'))(name);\n };\n\n _this.selectActiveItem = function (event) {\n var _this$getActiveItem = _this.getActiveItem(),\n nodeData = _this$getActiveItem.nodeData;\n\n _this.handleSelect(nodeData, event);\n };\n\n _this.focusNextItem = function () {\n var _node$focus;\n\n var _this$getItemsAndActi = _this.getItemsAndActiveIndex(),\n items = _this$getItemsAndActi.items,\n activeIndex = _this$getItemsAndActi.activeIndex;\n\n if (items.length === 0) {\n return;\n }\n\n var nextIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1;\n\n var node = _this.getElementByDataKey(items[nextIndex].refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus = node.focus) === null || _node$focus === void 0 ? void 0 : _node$focus.call(node);\n };\n\n _this.focusPreviousItem = function () {\n var _node$focus2;\n\n var _this$getItemsAndActi2 = _this.getItemsAndActiveIndex(),\n items = _this$getItemsAndActi2.items,\n activeIndex = _this$getItemsAndActi2.activeIndex;\n\n if (items.length === 0) {\n return;\n }\n\n var prevIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1;\n prevIndex = prevIndex >= 0 ? prevIndex : 0;\n\n var node = _this.getElementByDataKey(items[prevIndex].refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus2 = node.focus) === null || _node$focus2 === void 0 ? void 0 : _node$focus2.call(node);\n };\n\n _this.handleCloseDropdown = function () {\n var _this$triggerRef$curr, _this$triggerRef$curr2;\n\n (_this$triggerRef$curr = _this.triggerRef.current) === null || _this$triggerRef$curr === void 0 ? void 0 : (_this$triggerRef$curr2 = _this$triggerRef$curr.hide) === null || _this$triggerRef$curr2 === void 0 ? void 0 : _this$triggerRef$curr2.call(_this$triggerRef$curr);\n };\n\n _this.handleOpenDropdown = function () {\n var _this$triggerRef$curr3, _this$triggerRef$curr4;\n\n (_this$triggerRef$curr3 = _this.triggerRef.current) === null || _this$triggerRef$curr3 === void 0 ? void 0 : (_this$triggerRef$curr4 = _this$triggerRef$curr3.show) === null || _this$triggerRef$curr4 === void 0 ? void 0 : _this$triggerRef$curr4.call(_this$triggerRef$curr3);\n };\n\n _this.open = function () {\n var _this$handleOpenDropd, _this2;\n\n (_this$handleOpenDropd = (_this2 = _this).handleOpenDropdown) === null || _this$handleOpenDropd === void 0 ? void 0 : _this$handleOpenDropd.call(_this2);\n };\n\n _this.close = function () {\n var _this$handleCloseDrop, _this3;\n\n (_this$handleCloseDrop = (_this3 = _this).handleCloseDropdown) === null || _this$handleCloseDrop === void 0 ? void 0 : _this$handleCloseDrop.call(_this3);\n };\n\n _this.handleToggleDropdown = function () {\n var active = _this.state.active;\n\n if (active) {\n _this.handleCloseDropdown();\n\n return;\n }\n\n _this.handleOpenDropdown();\n };\n\n _this.handleToggle = function (nodeData) {\n var _this$props2 = _this.props,\n valueKey = _this$props2.valueKey,\n childrenKey = _this$props2.childrenKey,\n onExpand = _this$props2.onExpand,\n expandItemValues = _this$props2.expandItemValues;\n\n var nextExpandItemValues = _this.toggleExpand(nodeData, !nodeData.expand);\n\n if ((0, _isUndefined2.default)(expandItemValues)) {\n _this.unserializeLists('expand', nextExpandItemValues);\n\n _this.setState({\n expandItemValues: nextExpandItemValues\n });\n }\n\n onExpand === null || onExpand === void 0 ? void 0 : onExpand(nextExpandItemValues, nodeData, (0, _Picker.createConcatChildrenFunction)(nodeData, nodeData[valueKey], {\n valueKey: valueKey,\n childrenKey: childrenKey\n }));\n };\n\n _this.handleSelect = function (nodeData, event) {\n var _this$toggleRef$curre;\n\n var _this$props3 = _this.props,\n valueKey = _this$props3.valueKey,\n onChange = _this$props3.onChange,\n onSelect = _this$props3.onSelect,\n value = _this$props3.value;\n _this.node = nodeData;\n\n if ((0, _isUndefined2.default)(value)) {\n _this.setState({\n activeNode: nodeData,\n selectedValue: nodeData[valueKey]\n });\n }\n\n onChange === null || onChange === void 0 ? void 0 : onChange(nodeData[valueKey], event);\n onSelect === null || onSelect === void 0 ? void 0 : onSelect(nodeData, nodeData[valueKey], event);\n\n _this.handleCloseDropdown();\n\n (_this$toggleRef$curre = _this.toggleRef.current) === null || _this$toggleRef$curre === void 0 ? void 0 : _this$toggleRef$curre.onFocus();\n };\n\n _this.handleKeyDown = function (event) {\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextItem,\n up: _this.focusPreviousItem,\n enter: _this.selectActiveItem,\n del: _this.handleClean\n });\n };\n\n _this.handleToggleKeyDown = function (event) {\n var _this$state = _this.state,\n activeNode = _this$state.activeNode,\n active = _this$state.active; // enter\n\n if ((!activeNode || !active) && event.keyCode === 13) {\n _this.handleToggleDropdown();\n } // delete\n\n\n if (event.keyCode === 8) {\n _this.handleClean(event);\n }\n\n if (!_this.treeViewRef.current) {\n return;\n }\n\n if (event.target instanceof HTMLElement) {\n var className = event.target.className;\n\n if (className.includes(_this.addPrefix('toggle')) || className.includes(_this.addPrefix('toggle-custom')) || className.includes(_this.addPrefix('search-bar-input'))) {\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextItem\n });\n }\n }\n };\n\n _this.handleSearch = function (value, event) {\n var filterData = _this.state.filterData;\n var _this$props4 = _this.props,\n onSearch = _this$props4.onSearch,\n searchKeyword = _this$props4.searchKeyword;\n\n if ((0, _isUndefined2.default)(searchKeyword)) {\n _this.setState({\n searchKeyword: value,\n filterData: _this.getFilterData(filterData, value)\n });\n }\n\n onSearch === null || onSearch === void 0 ? void 0 : onSearch(value, event);\n };\n\n _this.handleClean = function (event) {\n var _this$props$onChange, _this$props5;\n\n _this.setState({\n activeNode: null,\n selectedValue: null\n });\n\n _this.node = null;\n (_this$props$onChange = (_this$props5 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props5, null, event);\n };\n\n _this.handleOnOpen = function () {\n var _this$props$onOpen, _this$props6;\n\n var activeNode = _this.state.activeNode;\n\n if (activeNode) {\n var _node$focus3;\n\n var node = _this.getElementByDataKey(activeNode.refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus3 = node.focus) === null || _node$focus3 === void 0 ? void 0 : _node$focus3.call(node);\n }\n\n (_this$props$onOpen = (_this$props6 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props6);\n\n _this.setState({\n active: true\n });\n };\n\n _this.handleOnClose = function () {\n var filterData = _this.state.filterData;\n var _this$props7 = _this.props,\n searchKeyword = _this$props7.searchKeyword,\n onClose = _this$props7.onClose;\n\n if ((0, _isUndefined2.default)(searchKeyword)) {\n _this.setState({\n searchKeyword: '',\n filterData: _this.getFilterData(filterData, '')\n });\n }\n\n onClose === null || onClose === void 0 ? void 0 : onClose();\n\n _this.setState({\n active: false\n });\n };\n\n _this.handleDragStart = function (nodeData, event) {\n var _this$props8 = _this.props,\n valueKey = _this$props8.valueKey,\n childrenKey = _this$props8.childrenKey,\n onDragStart = _this$props8.onDragStart,\n draggable = _this$props8.draggable;\n\n if (draggable) {\n _this.setState({\n dragging: true,\n dragNodeKeys: (0, _treeUtils.getDragNodeKeys)(nodeData, childrenKey, valueKey)\n });\n\n _this.dragNode = _this.nodes[nodeData.refKey];\n onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(nodeData, event);\n }\n };\n\n _this.handleDragEnter = function (nodeData, event) {\n var _this$state2 = _this.state,\n dragging = _this$state2.dragging,\n dragNodeKeys = _this$state2.dragNodeKeys;\n var _this$props9 = _this.props,\n valueKey = _this$props9.valueKey,\n onDragEnter = _this$props9.onDragEnter;\n\n if (dragNodeKeys.some(function (d) {\n return (0, _shallowEqual.default)(d, nodeData[valueKey]);\n })) {\n return;\n }\n\n if (dragging && _this.dragNode) {\n var dropNodePosition = (0, _treeUtils.calDropNodePosition)(event, _this.nodeRefs[nodeData.refKey]);\n\n _this.setState({\n dragOverNodeKey: nodeData[valueKey],\n dropNodePosition: dropNodePosition\n });\n }\n\n onDragEnter === null || onDragEnter === void 0 ? void 0 : onDragEnter(nodeData, event);\n };\n\n _this.handleDragOver = function (nodeData, event) {\n var _this$state3 = _this.state,\n dragNodeKeys = _this$state3.dragNodeKeys,\n dragOverNodeKey = _this$state3.dragOverNodeKey,\n dropNodePosition = _this$state3.dropNodePosition;\n var _this$props10 = _this.props,\n valueKey = _this$props10.valueKey,\n onDragOver = _this$props10.onDragOver;\n\n if (dragNodeKeys.some(function (d) {\n return (0, _shallowEqual.default)(d, nodeData[valueKey]);\n })) {\n return;\n }\n\n if (_this.dragNode && (0, _shallowEqual.default)(nodeData[valueKey], dragOverNodeKey)) {\n var lastDropNodePosition = (0, _treeUtils.calDropNodePosition)(event, _this.nodeRefs[nodeData.refKey]);\n if (lastDropNodePosition === dropNodePosition) return;\n\n _this.setState({\n dropNodePosition: lastDropNodePosition\n });\n }\n\n onDragOver === null || onDragOver === void 0 ? void 0 : onDragOver(nodeData, event);\n };\n\n _this.handleDragLeave = function (nodeData, event) {\n var onDragLeave = _this.props.onDragLeave;\n onDragLeave === null || onDragLeave === void 0 ? void 0 : onDragLeave(nodeData, event);\n };\n\n _this.handleDragEnd = function (nodeData, event) {\n var onDragEnd = _this.props.onDragEnd;\n\n _this.setState({\n dragging: false,\n dragNodeKeys: [],\n dragOverNodeKey: null\n });\n\n onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(nodeData, event);\n };\n\n _this.handleDrop = function (nodeData, event) {\n var dragNodeKeys = _this.state.dragNodeKeys;\n var _this$props11 = _this.props,\n valueKey = _this$props11.valueKey,\n onDrop = _this$props11.onDrop;\n\n if (dragNodeKeys.some(function (d) {\n return (0, _shallowEqual.default)(d, nodeData[valueKey]);\n })) {\n console.error('Cannot drag a node to itself and its children');\n } else {\n var dropData = _this.getDropData(nodeData);\n\n onDrop === null || onDrop === void 0 ? void 0 : onDrop(dropData, event);\n }\n\n _this.setState({\n dragging: false,\n dragNodeKeys: [],\n dragOverNodeKey: null,\n dropNodePosition: null\n });\n\n _this.dragNode = null;\n };\n\n _this.measureRowRenderer = function (nodes) {\n return function (_ref) {\n var key = _ref.key,\n index = _ref.index,\n style = _ref.style,\n parent = _ref.parent;\n var node = nodes[index];\n return React.createElement(_CellMeasurer.CellMeasurer, {\n cache: _this.cache,\n columnIndex: 0,\n key: key,\n rowIndex: index,\n parent: parent,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 972\n },\n __self: this\n }, function () {\n return _this.renderVirtualNode(node, {\n key: key,\n style: style\n });\n });\n };\n };\n\n var _value = props.value,\n data = props.data,\n _valueKey = props.valueKey,\n _props$searchKeyword = props.searchKeyword,\n _searchKeyword = _props$searchKeyword === void 0 ? '' : _props$searchKeyword;\n\n var nextData = [].concat(data);\n\n var _nextExpandItemValues = (0, _treeUtils.getExpandItemValues)(props);\n\n _this.flattenNodes(nextData);\n\n _this.unserializeLists('expand', _nextExpandItemValues, props);\n\n _this.state = {\n data: data,\n value: _value,\n dragging: false,\n selectedValue: _this.getValue(props),\n expandAll: (0, _treeUtils.getExpandAll)(props),\n filterData: _this.getFilterData(nextData, _searchKeyword, props),\n activeNode: _this.getActiveNode(_this.getValue(props), _valueKey),\n searchKeyword: _searchKeyword,\n expandItemValues: _this.serializeList('expand'),\n dragNodeKeys: [],\n dragOverNodeKey: null,\n dropNodePosition: null\n };\n _this.treeViewRef = React.createRef();\n _this.positionRef = React.createRef();\n _this.listRef = React.createRef();\n _this.triggerRef = React.createRef();\n _this.toggleRef = React.createRef(); // for test\n\n _this.menuRef = React.createRef();\n (0, _treeUtils.treeDeprecatedWarning)(props, ['expandAll']);\n return _this;\n }\n\n var _proto = TreePicker.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n var activeNode = this.state.activeNode;\n this.focusNode(activeNode);\n };\n\n TreePicker.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {\n var value = nextProps.value,\n data = nextProps.data,\n expandAll = nextProps.expandAll,\n searchKeyword = nextProps.searchKeyword,\n expandItemValues = nextProps.expandItemValues;\n var nextState = {};\n\n if ((0, _isArray2.default)(data) && (0, _isArray2.default)(prevState.data) && prevState.data !== data) {\n nextState.data = data;\n }\n\n if (!(0, _shallowEqual.default)(value, prevState.value)) {\n nextState.value = value;\n nextState.selectedValue = value;\n }\n\n if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues)) {\n nextState.expandItemValues = expandItemValues;\n }\n\n if (!(0, _isUndefined2.default)(searchKeyword) && searchKeyword !== prevState.searchKeyword) {\n nextState.searchKeyword = searchKeyword;\n }\n\n if (expandAll !== prevState.expandAll) {\n nextState.expandAll = expandAll;\n }\n\n return Object.keys(nextState).length ? nextState : null;\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(_prevProps, prevState) {\n this.updateDataChange(prevState);\n this.updateValueChange(prevState);\n this.updateExpandItemValuesChange(prevState);\n this.updateSearchKeywordChange(prevState);\n\n if (this.listRef.current) {\n this.listRef.current.forceUpdateGrid();\n }\n };\n\n _proto.updateDataChange = function updateDataChange(prevState) {\n var _this$state4 = this.state,\n searchKeyword = _this$state4.searchKeyword,\n expandItemValues = _this$state4.expandItemValues;\n var data = this.props.data;\n\n if (prevState.data !== data) {\n var nextData = [].concat(data);\n this.flattenNodes(nextData);\n var filterData = this.getFilterData(nextData, searchKeyword);\n var activeNode = this.getActiveNode(this.getValue());\n this.focusNode(activeNode);\n this.unserializeLists('expand', expandItemValues);\n var newState = {};\n\n if (activeNode) {\n newState = {\n activeNode: activeNode\n };\n }\n\n this.setState((0, _extends3.default)({}, {\n data: nextData,\n filterData: filterData,\n expandItemValues: this.serializeList('expand')\n }, {}, newState));\n }\n };\n\n _proto.updateValueChange = function updateValueChange(prevState) {\n var _this$props12 = this.props,\n value = _this$props12.value,\n valueKey = _this$props12.valueKey;\n\n if (!(0, _shallowEqual.default)(prevState.value, value)) {\n var activeNode = null;\n\n if (this.node === null) {\n activeNode = this.getActiveNode(value);\n }\n\n if (value !== null && this.node !== null) {\n activeNode = (0, _shallowEqual.default)(this.node[valueKey], value) ? this.node : this.getActiveNode(value);\n }\n\n var nextState = {\n value: value,\n activeNode: activeNode\n };\n\n if (value === null) {\n nextState.activeNode = null;\n this.node = null;\n }\n\n if (activeNode !== null) {\n this.focusNode(activeNode);\n }\n\n this.setState(nextState);\n }\n };\n\n _proto.updateExpandItemValuesChange = function updateExpandItemValuesChange(prevState) {\n var expandItemValues = this.props.expandItemValues;\n\n if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues)) {\n this.unserializeLists('expand', expandItemValues);\n this.setState({\n expandItemValues: expandItemValues\n });\n }\n };\n\n _proto.updateSearchKeywordChange = function updateSearchKeywordChange(prevState) {\n var filterData = this.state.filterData;\n\n if (!(0, _isUndefined2.default)(this.props.searchKeyword) && prevState.searchKeyword !== this.props.searchKeyword) {\n this.setState({\n filterData: this.getFilterData(filterData, this.props.searchKeyword)\n });\n }\n };\n\n _proto.getValue = function getValue(props) {\n if (props === void 0) {\n props = this.props;\n }\n\n var _props = props,\n value = _props.value,\n defaultValue = _props.defaultValue;\n return !(0, _isUndefined2.default)(value) ? value : defaultValue;\n };\n\n _proto.getActiveNode = function getActiveNode(value, valueKey) {\n var _this4 = this;\n\n if (valueKey === void 0) {\n valueKey = this.props.valueKey;\n }\n\n var activeNode = null;\n\n if (!(0, _isUndefined2.default)(value)) {\n Object.keys(this.nodes).forEach(function (refKey) {\n if ((0, _shallowEqual.default)(_this4.nodes[refKey][valueKey], value)) {\n activeNode = _this4.nodes[refKey];\n }\n });\n }\n\n return activeNode;\n };\n\n _proto.getActiveElementOption = function getActiveElementOption(options, value) {\n var childrenKey = this.props.childrenKey;\n\n for (var i = 0; i < options.length; i += 1) {\n var _options$i$childrenKe;\n\n if (options[i].value === value) {\n return options[i];\n } else if ((_options$i$childrenKe = options[i][childrenKey]) === null || _options$i$childrenKe === void 0 ? void 0 : _options$i$childrenKe.length) {\n var active = this.getActiveElementOption(options[i][childrenKey], value);\n\n if (!(0, _isEmpty2.default)(active)) {\n return active;\n }\n }\n }\n\n return {};\n };\n\n _proto.getItemsAndActiveIndex = function getItemsAndActiveIndex() {\n var items = this.getFocusableMenuItems();\n var activeIndex = -1;\n items.forEach(function (item, index) {\n if (document.activeElement !== null) {\n if (item.refKey === document.activeElement.getAttribute('data-key')) {\n activeIndex = index;\n }\n }\n });\n return {\n items: items,\n activeIndex: activeIndex\n };\n };\n\n _proto.getActiveItem = function getActiveItem() {\n var nodeData = {};\n var activeItem = document.activeElement;\n\n if (activeItem !== null) {\n var _get2 = (0, _get3.default)(activeItem, 'dataset'),\n key = _get2.key,\n layer = _get2.layer;\n\n var activeNode = this.nodes[key];\n\n if (activeNode) {\n nodeData = activeNode;\n }\n\n return {\n nodeData: nodeData,\n layer: layer\n };\n }\n\n return {};\n };\n\n _proto.getFilterData = function getFilterData(data, word, props) {\n if (word === void 0) {\n word = '';\n }\n\n var _ref2 = props || this.props,\n labelKey = _ref2.labelKey,\n childrenKey = _ref2.childrenKey,\n searchBy = _ref2.searchBy;\n\n var setVisible = function setVisible(nodes) {\n if (nodes === void 0) {\n nodes = [];\n }\n\n return nodes.forEach(function (item) {\n item.visible = searchBy ? searchBy(word, item[labelKey], item) : (0, _Picker.shouldDisplay)(item[labelKey], word);\n\n if ((0, _isArray2.default)(item[childrenKey])) {\n setVisible(item[childrenKey]);\n item[childrenKey].forEach(function (child) {\n if (child.visible) {\n item.visible = child.visible;\n }\n });\n }\n });\n };\n\n if (!(0, _isUndefined2.default)(word)) {\n setVisible(data);\n }\n\n return data;\n };\n\n _proto.getFlattenTreeData = function getFlattenTreeData(nodes) {\n var _this5 = this;\n\n var expandItemValues = this.state.expandItemValues;\n var _this$props13 = this.props,\n childrenKey = _this$props13.childrenKey,\n valueKey = _this$props13.valueKey;\n return (0, _treeUtils.flattenTree)(nodes, childrenKey, function (node) {\n var formatted = {};\n var curNode = _this5.nodes[node.refKey];\n var parentKeys = (0, _treeUtils.getNodeParents)(curNode, 'parentNode', valueKey);\n\n if (curNode) {\n formatted = (0, _extends3.default)({}, node, {\n expand: curNode.expand,\n layer: curNode.layer,\n parentNode: curNode.parentNode,\n showNode: (0, _treeUtils.shouldShowNodeByExpanded)(expandItemValues, parentKeys)\n });\n }\n\n return formatted;\n });\n };\n\n _proto.getTreeNodeProps = function getTreeNodeProps(node, layer, index) {\n var _this$state5 = this.state,\n dragOverNodeKey = _this$state5.dragOverNodeKey,\n selectedValue = _this$state5.selectedValue,\n dropNodePosition = _this$state5.dropNodePosition;\n var dragNode = this.dragNode || {};\n var _this$props14 = this.props,\n locale = _this$props14.locale,\n valueKey = _this$props14.valueKey,\n labelKey = _this$props14.labelKey,\n draggable = _this$props14.draggable,\n childrenKey = _this$props14.childrenKey,\n _this$props14$disable = _this$props14.disabledItemValues,\n disabledItemValues = _this$props14$disable === void 0 ? [] : _this$props14$disable,\n renderTreeNode = _this$props14.renderTreeNode,\n renderTreeIcon = _this$props14.renderTreeIcon;\n return {\n rtl: locale.rtl,\n value: node[valueKey],\n label: node[labelKey],\n index: index,\n layer: layer,\n expand: node.expand,\n active: (0, _shallowEqual.default)(node[valueKey], selectedValue),\n visible: node.visible,\n draggable: draggable,\n dragging: (0, _shallowEqual.default)(node[valueKey], dragNode[valueKey]),\n children: node[childrenKey],\n nodeData: node,\n disabled: disabledItemValues.some(function (disabledItem) {\n return (0, _shallowEqual.default)(disabledItem, node[valueKey]);\n }),\n dragOver: (0, _shallowEqual.default)(node[valueKey], dragOverNodeKey) && dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER,\n dragOverTop: (0, _shallowEqual.default)(node[valueKey], dragOverNodeKey) && dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_TOP,\n dragOverBottom: (0, _shallowEqual.default)(node[valueKey], dragOverNodeKey) && dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_BOTTOM,\n onSelect: this.handleSelect,\n onDragStart: this.handleDragStart,\n onDragEnter: this.handleDragEnter,\n onDragOver: this.handleDragOver,\n onDragLeave: this.handleDragLeave,\n onDragEnd: this.handleDragEnd,\n onDrop: this.handleDrop,\n onTreeToggle: this.handleToggle,\n onRenderTreeNode: renderTreeNode,\n onRenderTreeIcon: renderTreeIcon\n };\n }\n /**\n * 获取 onDrop 的回调数据\n */\n ;\n\n _proto.getDropData = function getDropData(nodeData) {\n var dropNodePosition = this.state.dropNodePosition;\n var _this$props15 = this.props,\n valueKey = _this$props15.valueKey,\n childrenKey = _this$props15.childrenKey;\n var options = {\n valueKey: valueKey,\n childrenKey: childrenKey\n };\n var dragNode = (0, _omit2.default)(this.dragNode, 'parentNode');\n return {\n /** 拖拽节点 */\n dragNode: dragNode,\n\n /** 释放所在节点的父节点 */\n dropNode: nodeData,\n\n /** 拖拽节点的类型 */\n dropNodePosition: dropNodePosition,\n createUpdateDataFunction: (0, _treeUtils.createUpdateTreeDataFunction)({\n /** 拖拽节点 */\n dragNode: dragNode,\n\n /** 释放所在节点的父节点 */\n dropNode: nodeData,\n\n /** 拖拽节点的类型 */\n dropNodePosition: dropNodePosition\n }, options)\n };\n };\n\n _proto.focusNode = function focusNode(activeNode) {\n var inline = this.props.inline;\n\n if (activeNode && inline) {\n var _node$focus4;\n\n var node = this.getElementByDataKey(activeNode.refKey);\n node === null || node === void 0 ? void 0 : (_node$focus4 = node.focus) === null || _node$focus4 === void 0 ? void 0 : _node$focus4.call(node);\n }\n };\n\n _proto.flattenNodes = function flattenNodes(nodes, props, ref, parentNode, layer) {\n var _this6 = this;\n\n if (ref === void 0) {\n ref = '0';\n }\n\n if (layer === void 0) {\n layer = 0;\n }\n\n var _ref3 = props || this.props,\n labelKey = _ref3.labelKey,\n valueKey = _ref3.valueKey,\n childrenKey = _ref3.childrenKey;\n\n if (!Array.isArray(nodes) || nodes.length === 0) {\n return [];\n }\n\n nodes.map(function (node, index) {\n var _extends2;\n\n var refKey = ref + \"-\" + index;\n node.refKey = refKey;\n _this6.nodes[refKey] = (0, _extends3.default)((_extends2 = {\n layer: layer\n }, _extends2[labelKey] = node[labelKey], _extends2[valueKey] = node[valueKey], _extends2.expand = (0, _treeUtils.getExpandState)(node, props || _this6.props), _extends2.refKey = refKey, _extends2), node);\n\n if (parentNode) {\n _this6.nodes[refKey].parentNode = parentNode;\n }\n\n _this6.flattenNodes(node[childrenKey], props, refKey, _this6.nodes[refKey], layer + 1);\n });\n };\n\n _proto.serializeList = function serializeList(key, nodes) {\n if (nodes === void 0) {\n nodes = this.nodes;\n }\n\n var valueKey = this.props.valueKey;\n var list = [];\n Object.keys(nodes).forEach(function (refKey) {\n if (nodes[refKey][key]) {\n list.push(nodes[refKey][valueKey]);\n }\n });\n return list;\n };\n\n _proto.unserializeLists = function unserializeLists(key, value, props) {\n var _this7 = this;\n\n if (value === void 0) {\n value = [];\n }\n\n if (props === void 0) {\n props = this.props;\n }\n\n var _props2 = props,\n valueKey = _props2.valueKey;\n var expandAll = (0, _treeUtils.getExpandAll)(props);\n Object.keys(this.nodes).forEach(function (refKey) {\n _this7.nodes[refKey][key] = false;\n\n if (value.length) {\n value.forEach(function (value) {\n if ((0, _shallowEqual.default)(_this7.nodes[refKey][valueKey], value)) {\n _this7.nodes[refKey][key] = true;\n }\n });\n } else {\n _this7.nodes[refKey][key] = expandAll;\n }\n });\n };\n\n _proto.toggleExpand = function toggleExpand(node, isExpand) {\n var valueKey = this.props.valueKey;\n var expandItemValues = new Set(this.serializeList('expand'));\n\n if (isExpand) {\n expandItemValues.add(node[valueKey]);\n } else {\n expandItemValues.delete(node[valueKey]);\n }\n\n return Array.from(expandItemValues);\n };\n\n _proto.renderDropdownMenu = function renderDropdownMenu() {\n var _this$props16 = this.props,\n _this$props16$height = _this$props16.height,\n height = _this$props16$height === void 0 ? defaultHeight : _this$props16$height,\n searchable = _this$props16.searchable,\n searchKeyword = _this$props16.searchKeyword,\n renderExtraFooter = _this$props16.renderExtraFooter,\n locale = _this$props16.locale,\n renderMenu = _this$props16.renderMenu,\n menuStyle = _this$props16.menuStyle,\n virtualized = _this$props16.virtualized,\n menuClassName = _this$props16.menuClassName,\n menuAutoWidth = _this$props16.menuAutoWidth;\n var keyword = !(0, _isUndefined2.default)(searchKeyword) ? searchKeyword : this.state.searchKeyword;\n var classes = (0, _classnames.default)(menuClassName, this.addPrefix('tree-menu'));\n var styles = virtualized ? (0, _extends3.default)({\n height: height\n }, menuStyle) : menuStyle;\n return React.createElement(_Picker.MenuWrapper, {\n autoWidth: menuAutoWidth,\n className: classes,\n style: styles,\n ref: this.menuRef,\n getToggleInstance: this.getToggleInstance,\n getPositionInstance: this.getPositionInstance,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 878\n },\n __self: this\n }, searchable ? React.createElement(_Picker.SearchBar, {\n placeholder: locale.searchPlaceholder,\n key: \"searchBar\",\n onChange: this.handleSearch,\n value: keyword,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 887\n },\n __self: this\n }) : null, renderMenu ? renderMenu(this.renderTree()) : this.renderTree(), renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());\n };\n\n _proto.renderNode = function renderNode(node, index, layer) {\n var _this8 = this;\n\n var searchKeyword = this.state.searchKeyword;\n var _this$props17 = this.props,\n valueKey = _this$props17.valueKey,\n childrenKey = _this$props17.childrenKey;\n\n if (!node.visible) {\n return null;\n }\n\n var refKey = node.refKey;\n var expand = (0, _treeUtils.getExpandWhenSearching)(searchKeyword, this.nodes[refKey].expand);\n var key = (0, _isString2.default)(node[valueKey]) || (0, _isNumber2.default)(node[valueKey]) ? node[valueKey] : refKey;\n var children = node[childrenKey]; // 当用户进行搜索时,hasChildren的判断要变成判断是否存在 visible 为 true 的子节点\n\n var visibleChildren = (0, _isUndefined2.default)(searchKeyword) || searchKeyword.length === 0 ? !!children : (0, _treeUtils.hasVisibleChildren)(node, childrenKey);\n var nodeProps = (0, _extends3.default)({}, this.getTreeNodeProps((0, _extends3.default)({}, node, {\n expand: expand\n }), layer, index), {\n hasChildren: visibleChildren\n });\n\n if (nodeProps.hasChildren) {\n var _classNames;\n\n layer += 1; // 是否展开树节点且子节点不为空\n\n var openClass = this.addTreePrefix('open');\n var childrenClass = (0, _classnames.default)(this.addTreePrefix('node-children'), (_classNames = {}, _classNames[openClass] = expand && visibleChildren, _classNames));\n var nodes = children || [];\n return React.createElement(\"div\", {\n className: childrenClass,\n key: key,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 933\n },\n __self: this\n }, React.createElement(_TreeNode.default, (0, _extends3.default)({}, nodeProps, {\n innerRef: this.bindNodeRefs.bind(this, refKey),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 934\n },\n __self: this\n })), React.createElement(\"div\", {\n className: this.addTreePrefix('children'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 935\n },\n __self: this\n }, nodes.map(function (child, i) {\n return _this8.renderNode(child, i, layer);\n })));\n }\n\n return React.createElement(_TreeNode.default, (0, _extends3.default)({\n key: key,\n innerRef: this.bindNodeRefs.bind(this, refKey)\n }, nodeProps, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 942\n },\n __self: this\n }));\n };\n\n _proto.renderVirtualNode = function renderVirtualNode(node, options) {\n var searchKeyword = this.state.searchKeyword;\n var childrenKey = this.props.childrenKey;\n var key = options.key,\n style = options.style;\n var layer = node.layer,\n refKey = node.refKey,\n showNode = node.showNode;\n var expand = (0, _treeUtils.getExpandWhenSearching)(searchKeyword, this.nodes[refKey].expand);\n\n if (!node.visible) {\n return null;\n }\n\n var nodeProps = (0, _extends3.default)({}, this.getTreeNodeProps((0, _extends3.default)({}, node, {\n expand: expand\n }), layer), {\n style: style,\n hasChildren: !!node[childrenKey]\n });\n return showNode && React.createElement(_TreeNode.default, (0, _extends3.default)({\n key: key,\n innerRef: this.bindNodeRefs.bind(this, refKey)\n }, nodeProps, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 964\n },\n __self: this\n }));\n };\n\n _proto.renderTree = function renderTree() {\n var _classNames2,\n _this9 = this;\n\n var filterData = this.state.filterData;\n var _this$props18 = this.props,\n height = _this$props18.height,\n className = _this$props18.className,\n inline = _this$props18.inline,\n style = _this$props18.style,\n locale = _this$props18.locale,\n virtualized = _this$props18.virtualized,\n searchable = _this$props18.searchable;\n var layer = 0;\n var classes = (0, _classnames.default)((0, _utils.defaultClassPrefix)('tree'), (_classNames2 = {}, _classNames2[className] = inline, _classNames2));\n var nodes = [];\n\n if (!virtualized) {\n nodes = filterData.map(function (dataItem, index) {\n return _this9.renderNode(dataItem, index, layer);\n });\n\n if (!nodes.some(function (v) {\n return v !== null;\n })) {\n return React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 993\n },\n __self: this\n }, locale.noResultsText);\n }\n } else {\n nodes = this.getFlattenTreeData(filterData).filter(function (n) {\n return n.showNode && n.visible;\n });\n\n if (!nodes.length) {\n return React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 998\n },\n __self: this\n }, locale.noResultsText);\n }\n } // 当未定义 height 且 设置了 virtualized 为 true,treeHeight 设置默认高度\n\n\n var treeHeight = (0, _isUndefined2.default)(height) && virtualized ? defaultHeight : height;\n var treeWidth = (0, _isUndefined2.default)(style === null || style === void 0 ? void 0 : style.width) ? defaultWidth : style.width;\n var styles = inline ? (0, _extends3.default)({\n height: treeHeight\n }, style) : {};\n var listHeight = (0, _treeUtils.getVirtualLisHeight)(inline, searchable, treeHeight);\n return React.createElement(React.Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1010\n },\n __self: this\n }, React.createElement(\"div\", {\n ref: this.treeViewRef,\n className: classes,\n style: styles,\n onKeyDown: this.handleKeyDown,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1011\n },\n __self: this\n }, React.createElement(\"div\", {\n className: this.addTreePrefix('nodes'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1017\n },\n __self: this\n }, virtualized ? React.createElement(_AutoSizer.default, {\n defaultHeight: listHeight,\n defaultWidth: treeWidth,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1019\n },\n __self: this\n }, function (_ref4) {\n var height = _ref4.height,\n width = _ref4.width;\n return React.createElement(_List.default, {\n ref: _this9.listRef,\n width: width || treeWidth,\n height: height || listHeight,\n rowHeight: 38,\n rowCount: nodes.length,\n rowRenderer: _this9.measureRowRenderer(nodes),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1021\n },\n __self: this\n });\n }) : nodes)), this.renderDragNode());\n };\n\n _proto.renderDragNode = function renderDragNode() {\n var _this$props19 = this.props,\n labelKey = _this$props19.labelKey,\n draggable = _this$props19.draggable,\n renderDragNode = _this$props19.renderDragNode;\n var dragNode = this.dragNode || {};\n\n if (draggable) {\n var dragNodeContent = dragNode[labelKey];\n\n if ((0, _isFunction2.default)(renderDragNode)) {\n dragNodeContent = renderDragNode(dragNode);\n }\n\n return React.createElement(\"span\", {\n id: \"drag-node\",\n className: this.addTreePrefix('drag-node-mover'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1050\n },\n __self: this\n }, dragNodeContent);\n }\n\n return null;\n };\n\n _proto.render = function render() {\n var _this$props20 = this.props,\n inline = _this$props20.inline,\n locale = _this$props20.locale,\n disabled = _this$props20.disabled,\n toggleComponentClass = _this$props20.toggleComponentClass,\n placeholder = _this$props20.placeholder,\n cleanable = _this$props20.cleanable,\n renderValue = _this$props20.renderValue,\n labelKey = _this$props20.labelKey,\n onEntered = _this$props20.onEntered,\n onExited = _this$props20.onExited,\n onClean = _this$props20.onClean,\n style = _this$props20.style,\n positionRef = _this$props20.positionRef,\n rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props20, [\"inline\", \"locale\", \"disabled\", \"toggleComponentClass\", \"placeholder\", \"cleanable\", \"renderValue\", \"labelKey\", \"onEntered\", \"onExited\", \"onClean\", \"style\", \"positionRef\"]);\n var _this$state6 = this.state,\n selectedValue = _this$state6.selectedValue,\n activeNode = _this$state6.activeNode;\n var hasValidValue = !(0, _isNil2.default)(activeNode) || !(0, _isNil2.default)(selectedValue) && (0, _isFunction2.default)(renderValue);\n var selectedElement = placeholder;\n var hasValue = !!activeNode;\n /**\n * if value is invalid and renderValue is undefined, then using placeholder.\n * if value is valid and renderValue is't undefined, then using renderValue()\n */\n\n if (!(0, _isNil2.default)(selectedValue)) {\n if (hasValue) {\n selectedElement = activeNode[labelKey];\n }\n\n if ((0, _isFunction2.default)(renderValue)) {\n var node = activeNode !== null && activeNode !== void 0 ? activeNode : {};\n selectedElement = renderValue(selectedValue, node, selectedElement);\n\n if ((0, _isNil2.default)(selectedElement)) {\n hasValidValue = false;\n }\n }\n }\n\n var unhandled = (0, _utils.getUnhandledProps)(TreePicker, rest);\n var classes = (0, _Picker.getToggleWrapperClassName)('tree', this.addPrefix, this.props, hasValidValue);\n\n if (inline) {\n return this.renderTree();\n }\n\n return React.createElement(_Picker.PickerToggleTrigger, {\n pickerProps: this.props,\n ref: this.triggerRef,\n positionRef: (0, _utils.mergeRefs)(this.positionRef, positionRef),\n onEntered: (0, _utils.createChainedFunction)(this.handleOnOpen, onEntered),\n onExited: (0, _utils.createChainedFunction)(this.handleOnClose, onExited),\n speaker: this.renderDropdownMenu(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1108\n },\n __self: this\n }, React.createElement(\"div\", {\n className: classes,\n style: style,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1116\n },\n __self: this\n }, React.createElement(_Picker.PickerToggle, (0, _extends3.default)({}, unhandled, {\n ref: this.toggleRef,\n onKeyDown: this.handleToggleKeyDown,\n onClean: (0, _utils.createChainedFunction)(this.handleClean, onClean),\n cleanable: cleanable && !disabled,\n componentClass: toggleComponentClass,\n hasValue: hasValidValue,\n active: this.state.active,\n \"aria-disabled\": disabled,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1117\n },\n __self: this\n }), selectedElement || locale.placeholder)));\n };\n\n return TreePicker;\n}(React.Component);\n\nTreePicker.propTypes = (0, _extends3.default)({}, _propTypes2.listPickerPropTypes, {\n height: _propTypes.default.number,\n inline: _propTypes.default.bool,\n draggable: _propTypes.default.bool,\n expandAll: _propTypes.default.bool,\n virtualized: _propTypes.default.bool,\n searchable: _propTypes.default.bool,\n menuAutoWidth: _propTypes.default.bool,\n searchKeyword: _propTypes.default.string,\n defaultExpandAll: _propTypes.default.bool,\n expandItemValues: _propTypes.default.array,\n defaultExpandItemValues: _propTypes.default.array,\n onSearch: _propTypes.default.func,\n onExpand: _propTypes.default.func,\n onSelect: _propTypes.default.func,\n renderMenu: _propTypes.default.func,\n renderTreeNode: _propTypes.default.func,\n renderTreeIcon: _propTypes.default.func,\n renderExtraFooter: _propTypes.default.func,\n renderDragNode: _propTypes.default.func,\n searchBy: _propTypes.default.func\n});\nTreePicker.defaultProps = (0, _extends3.default)({}, _propTypes2.listPickerDefaultProps, {\n searchable: true,\n menuAutoWidth: true,\n locale: {\n placeholder: 'Select',\n searchPlaceholder: 'Search',\n noResultsText: 'No results found'\n }\n});\n(0, _reactLifecyclesCompat.polyfill)(TreePicker);\n\nvar _default = (0, _utils.defaultProps)({\n classPrefix: 'picker'\n})(TreePicker);\n\nexports.default = _default;\nmodule.exports = exports.default;\n\n//# sourceURL=webpack://rsuite/./src/TreePicker/TreePicker.tsx?");
10207
+ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ \"./node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _extends3 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _inheritsLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ \"./node_modules/@babel/runtime/helpers/inheritsLoose.js\"));\n\nvar _isNil2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isFunction2 = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _isNumber2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNumber */ \"./node_modules/lodash/isNumber.js\"));\n\nvar _isString2 = _interopRequireDefault(__webpack_require__(/*! lodash/isString */ \"./node_modules/lodash/isString.js\"));\n\nvar _omit2 = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _get3 = _interopRequireDefault(__webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\"));\n\nvar _isEmpty2 = _interopRequireDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\n\nvar _isUndefined2 = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _isArray2 = _interopRequireDefault(__webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\"));\n\nvar React = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _classnames = _interopRequireDefault(__webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\"));\n\nvar _List = _interopRequireDefault(__webpack_require__(/*! react-virtualized/dist/commonjs/List */ \"./node_modules/react-virtualized/dist/commonjs/List/index.js\"));\n\nvar _AutoSizer = _interopRequireDefault(__webpack_require__(/*! react-virtualized/dist/commonjs/AutoSizer */ \"./node_modules/react-virtualized/dist/commonjs/AutoSizer/index.js\"));\n\nvar _CellMeasurer = __webpack_require__(/*! react-virtualized/dist/commonjs/CellMeasurer */ \"./node_modules/react-virtualized/dist/commonjs/CellMeasurer/index.js\");\n\nvar _reactLifecyclesCompat = __webpack_require__(/*! react-lifecycles-compat */ \"./node_modules/react-lifecycles-compat/react-lifecycles-compat.es.js\");\n\nvar _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _TreeNode = _interopRequireDefault(__webpack_require__(/*! ./TreeNode */ \"./src/TreePicker/TreeNode.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _Picker = __webpack_require__(/*! ../Picker */ \"./src/Picker/index.ts\");\n\nvar _constants = __webpack_require__(/*! ../constants */ \"./src/constants.ts\");\n\nvar _propTypes2 = __webpack_require__(/*! ../Picker/propTypes */ \"./src/Picker/propTypes.ts\");\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/TreePicker/TreePicker.tsx\";\n// default value for virtualized\nvar defaultHeight = 360;\nvar defaultWidth = 200;\n\nvar TreePicker =\n/*#__PURE__*/\nfunction (_React$Component) {\n (0, _inheritsLoose2.default)(TreePicker, _React$Component);\n\n function TreePicker(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.menuRef = void 0;\n _this.treeViewRef = void 0;\n _this.positionRef = void 0;\n _this.listRef = void 0;\n _this.triggerRef = void 0;\n _this.toggleRef = void 0;\n\n _this.getFocusableMenuItems = function () {\n var filterData = _this.state.filterData;\n var _this$props = _this.props,\n childrenKey = _this$props.childrenKey,\n _this$props$disabledI = _this$props.disabledItemValues,\n disabledItemValues = _this$props$disabledI === void 0 ? [] : _this$props$disabledI,\n valueKey = _this$props.valueKey;\n var items = [];\n\n var loop = function loop(nodes) {\n nodes.forEach(function (node) {\n var nodeData = (0, _extends3.default)({}, node, {}, _this.nodes[node.refKey]);\n var disabled = disabledItemValues.some(function (disabledItem) {\n return (0, _shallowEqual.default)(disabledItem, node[valueKey]);\n });\n\n if (!disabled) {\n items.push(node);\n }\n\n if (node[childrenKey] && (0, _treeUtils.getExpandState)(nodeData, _this.props)) {\n loop(node[childrenKey]);\n }\n });\n };\n\n loop(filterData);\n return items;\n };\n\n _this.getElementByDataKey = function (dataKey) {\n var ele = _this.nodeRefs[dataKey];\n\n if (ele instanceof Element) {\n return ele.querySelector(\".\" + _this.addTreePrefix('node-label'));\n }\n\n return null;\n };\n\n _this.nodes = {};\n _this.node = null;\n _this.cache = new _CellMeasurer.CellMeasurerCache({\n fixedWidth: true,\n minHeight: 20\n });\n _this.nodeRefs = {};\n _this.dragNode = null;\n\n _this.bindNodeRefs = function (refKey, ref) {\n _this.nodeRefs[refKey] = ref;\n };\n\n _this.getPositionInstance = function () {\n return _this.positionRef.current;\n };\n\n _this.getToggleInstance = function () {\n return _this.toggleRef.current;\n };\n\n _this.addPrefix = function (name) {\n return (0, _utils.prefix)(_this.props.classPrefix)(name);\n };\n\n _this.addTreePrefix = function (name) {\n return (0, _utils.prefix)((0, _utils.defaultClassPrefix)('tree'))(name);\n };\n\n _this.selectActiveItem = function (event) {\n var _this$getActiveItem = _this.getActiveItem(),\n nodeData = _this$getActiveItem.nodeData;\n\n _this.handleSelect(nodeData, event);\n };\n\n _this.focusNextItem = function () {\n var _node$focus;\n\n var _this$getItemsAndActi = _this.getItemsAndActiveIndex(),\n items = _this$getItemsAndActi.items,\n activeIndex = _this$getItemsAndActi.activeIndex;\n\n if (items.length === 0) {\n return;\n }\n\n var nextIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1;\n\n var node = _this.getElementByDataKey(items[nextIndex].refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus = node.focus) === null || _node$focus === void 0 ? void 0 : _node$focus.call(node);\n };\n\n _this.focusPreviousItem = function () {\n var _node$focus2;\n\n var _this$getItemsAndActi2 = _this.getItemsAndActiveIndex(),\n items = _this$getItemsAndActi2.items,\n activeIndex = _this$getItemsAndActi2.activeIndex;\n\n if (items.length === 0) {\n return;\n }\n\n var prevIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1;\n prevIndex = prevIndex >= 0 ? prevIndex : 0;\n\n var node = _this.getElementByDataKey(items[prevIndex].refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus2 = node.focus) === null || _node$focus2 === void 0 ? void 0 : _node$focus2.call(node);\n };\n\n _this.handleCloseDropdown = function () {\n var _this$triggerRef$curr, _this$triggerRef$curr2;\n\n (_this$triggerRef$curr = _this.triggerRef.current) === null || _this$triggerRef$curr === void 0 ? void 0 : (_this$triggerRef$curr2 = _this$triggerRef$curr.hide) === null || _this$triggerRef$curr2 === void 0 ? void 0 : _this$triggerRef$curr2.call(_this$triggerRef$curr);\n };\n\n _this.handleOpenDropdown = function () {\n var _this$triggerRef$curr3, _this$triggerRef$curr4;\n\n (_this$triggerRef$curr3 = _this.triggerRef.current) === null || _this$triggerRef$curr3 === void 0 ? void 0 : (_this$triggerRef$curr4 = _this$triggerRef$curr3.show) === null || _this$triggerRef$curr4 === void 0 ? void 0 : _this$triggerRef$curr4.call(_this$triggerRef$curr3);\n };\n\n _this.open = function () {\n var _this$handleOpenDropd, _this2;\n\n (_this$handleOpenDropd = (_this2 = _this).handleOpenDropdown) === null || _this$handleOpenDropd === void 0 ? void 0 : _this$handleOpenDropd.call(_this2);\n };\n\n _this.close = function () {\n var _this$handleCloseDrop, _this3;\n\n (_this$handleCloseDrop = (_this3 = _this).handleCloseDropdown) === null || _this$handleCloseDrop === void 0 ? void 0 : _this$handleCloseDrop.call(_this3);\n };\n\n _this.handleToggleDropdown = function () {\n var active = _this.state.active;\n\n if (active) {\n _this.handleCloseDropdown();\n\n return;\n }\n\n _this.handleOpenDropdown();\n };\n\n _this.handleToggle = function (nodeData) {\n var _this$props2 = _this.props,\n valueKey = _this$props2.valueKey,\n childrenKey = _this$props2.childrenKey,\n onExpand = _this$props2.onExpand,\n expandItemValues = _this$props2.expandItemValues;\n\n var nextExpandItemValues = _this.toggleExpand(nodeData, !nodeData.expand);\n\n if ((0, _isUndefined2.default)(expandItemValues)) {\n _this.unserializeLists('expand', nextExpandItemValues);\n\n _this.setState({\n expandItemValues: nextExpandItemValues\n });\n }\n\n onExpand === null || onExpand === void 0 ? void 0 : onExpand(nextExpandItemValues, nodeData, (0, _Picker.createConcatChildrenFunction)(nodeData, nodeData[valueKey], {\n valueKey: valueKey,\n childrenKey: childrenKey\n }));\n };\n\n _this.handleSelect = function (nodeData, event) {\n var _this$toggleRef$curre;\n\n var _this$props3 = _this.props,\n valueKey = _this$props3.valueKey,\n onChange = _this$props3.onChange,\n onSelect = _this$props3.onSelect,\n value = _this$props3.value;\n _this.node = nodeData;\n\n if ((0, _isUndefined2.default)(value)) {\n _this.setState({\n activeNode: nodeData,\n selectedValue: nodeData[valueKey]\n });\n }\n\n onChange === null || onChange === void 0 ? void 0 : onChange(nodeData[valueKey], event);\n onSelect === null || onSelect === void 0 ? void 0 : onSelect(nodeData, nodeData[valueKey], event);\n\n _this.handleCloseDropdown();\n\n (_this$toggleRef$curre = _this.toggleRef.current) === null || _this$toggleRef$curre === void 0 ? void 0 : _this$toggleRef$curre.onFocus();\n };\n\n _this.handleKeyDown = function (event) {\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextItem,\n up: _this.focusPreviousItem,\n enter: _this.selectActiveItem,\n del: _this.handleClean\n });\n };\n\n _this.handleToggleKeyDown = function (event) {\n var _this$state = _this.state,\n activeNode = _this$state.activeNode,\n active = _this$state.active; // enter\n\n if ((!activeNode || !active) && event.keyCode === 13) {\n _this.handleToggleDropdown();\n } // delete\n\n\n if (event.keyCode === 8) {\n _this.handleClean(event);\n }\n\n if (!_this.treeViewRef.current) {\n return;\n }\n\n if (event.target instanceof HTMLElement) {\n var className = event.target.className;\n\n if (className.includes(_this.addPrefix('toggle')) || className.includes(_this.addPrefix('toggle-custom')) || className.includes(_this.addPrefix('search-bar-input'))) {\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextItem\n });\n }\n }\n };\n\n _this.handleSearch = function (value, event) {\n var filterData = _this.state.filterData;\n var _this$props4 = _this.props,\n onSearch = _this$props4.onSearch,\n searchKeyword = _this$props4.searchKeyword;\n\n if ((0, _isUndefined2.default)(searchKeyword)) {\n _this.setState({\n searchKeyword: value,\n filterData: _this.getFilterData(filterData, value)\n });\n }\n\n onSearch === null || onSearch === void 0 ? void 0 : onSearch(value, event);\n };\n\n _this.handleClean = function (event) {\n var _this$props$onChange, _this$props5;\n\n _this.setState({\n activeNode: null,\n selectedValue: null\n });\n\n _this.node = null;\n (_this$props$onChange = (_this$props5 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props5, null, event);\n };\n\n _this.handleOnOpen = function () {\n var _this$props$onOpen, _this$props6;\n\n var activeNode = _this.state.activeNode;\n\n if (activeNode) {\n var _node$focus3;\n\n var node = _this.getElementByDataKey(activeNode.refKey);\n\n node === null || node === void 0 ? void 0 : (_node$focus3 = node.focus) === null || _node$focus3 === void 0 ? void 0 : _node$focus3.call(node);\n }\n\n (_this$props$onOpen = (_this$props6 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props6);\n\n _this.setState({\n active: true\n });\n };\n\n _this.handleOnClose = function () {\n var filterData = _this.state.filterData;\n var _this$props7 = _this.props,\n searchKeyword = _this$props7.searchKeyword,\n onClose = _this$props7.onClose;\n\n if ((0, _isUndefined2.default)(searchKeyword)) {\n _this.setState({\n searchKeyword: '',\n filterData: _this.getFilterData(filterData, '')\n });\n }\n\n onClose === null || onClose === void 0 ? void 0 : onClose();\n\n _this.setState({\n active: false\n });\n };\n\n _this.handleDragStart = function (nodeData, event) {\n var _this$props8 = _this.props,\n valueKey = _this$props8.valueKey,\n childrenKey = _this$props8.childrenKey,\n onDragStart = _this$props8.onDragStart,\n draggable = _this$props8.draggable;\n\n if (draggable) {\n _this.setState({\n dragging: true,\n dragNodeKeys: (0, _treeUtils.getDragNodeKeys)(nodeData, childrenKey, valueKey)\n });\n\n _this.dragNode = _this.nodes[nodeData.refKey];\n onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(nodeData, event);\n }\n };\n\n _this.handleDragEnter = function (nodeData, event) {\n var _this$state2 = _this.state,\n dragging = _this$state2.dragging,\n dragNodeKeys = _this$state2.dragNodeKeys;\n var _this$props9 = _this.props,\n valueKey = _this$props9.valueKey,\n onDragEnter = _this$props9.onDragEnter;\n\n if (dragNodeKeys.some(function (d) {\n return (0, _shallowEqual.default)(d, nodeData[valueKey]);\n })) {\n return;\n }\n\n if (dragging && _this.dragNode) {\n var dropNodePosition = (0, _treeUtils.calDropNodePosition)(event, _this.nodeRefs[nodeData.refKey]);\n\n _this.setState({\n dragOverNodeKey: nodeData[valueKey],\n dropNodePosition: dropNodePosition\n });\n }\n\n onDragEnter === null || onDragEnter === void 0 ? void 0 : onDragEnter(nodeData, event);\n };\n\n _this.handleDragOver = function (nodeData, event) {\n var _this$state3 = _this.state,\n dragNodeKeys = _this$state3.dragNodeKeys,\n dragOverNodeKey = _this$state3.dragOverNodeKey,\n dropNodePosition = _this$state3.dropNodePosition;\n var _this$props10 = _this.props,\n valueKey = _this$props10.valueKey,\n onDragOver = _this$props10.onDragOver;\n\n if (dragNodeKeys.some(function (d) {\n return (0, _shallowEqual.default)(d, nodeData[valueKey]);\n })) {\n return;\n }\n\n if (_this.dragNode && (0, _shallowEqual.default)(nodeData[valueKey], dragOverNodeKey)) {\n var lastDropNodePosition = (0, _treeUtils.calDropNodePosition)(event, _this.nodeRefs[nodeData.refKey]);\n if (lastDropNodePosition === dropNodePosition) return;\n\n _this.setState({\n dropNodePosition: lastDropNodePosition\n });\n }\n\n onDragOver === null || onDragOver === void 0 ? void 0 : onDragOver(nodeData, event);\n };\n\n _this.handleDragLeave = function (nodeData, event) {\n var onDragLeave = _this.props.onDragLeave;\n onDragLeave === null || onDragLeave === void 0 ? void 0 : onDragLeave(nodeData, event);\n };\n\n _this.handleDragEnd = function (nodeData, event) {\n var onDragEnd = _this.props.onDragEnd;\n\n _this.setState({\n dragging: false,\n dragNodeKeys: [],\n dragOverNodeKey: null\n });\n\n onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(nodeData, event);\n };\n\n _this.handleDrop = function (nodeData, event) {\n var dragNodeKeys = _this.state.dragNodeKeys;\n var _this$props11 = _this.props,\n valueKey = _this$props11.valueKey,\n onDrop = _this$props11.onDrop;\n\n if (dragNodeKeys.some(function (d) {\n return (0, _shallowEqual.default)(d, nodeData[valueKey]);\n })) {\n console.error('Cannot drag a node to itself and its children');\n } else {\n var dropData = _this.getDropData(nodeData);\n\n onDrop === null || onDrop === void 0 ? void 0 : onDrop(dropData, event);\n }\n\n _this.setState({\n dragging: false,\n dragNodeKeys: [],\n dragOverNodeKey: null,\n dropNodePosition: null\n });\n\n _this.dragNode = null;\n };\n\n _this.measureRowRenderer = function (nodes) {\n return function (_ref) {\n var key = _ref.key,\n index = _ref.index,\n style = _ref.style,\n parent = _ref.parent;\n var node = nodes[index];\n return React.createElement(_CellMeasurer.CellMeasurer, {\n cache: _this.cache,\n columnIndex: 0,\n key: key,\n rowIndex: index,\n parent: parent,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 974\n },\n __self: this\n }, function () {\n return _this.renderVirtualNode(node, {\n key: key,\n style: style\n });\n });\n };\n };\n\n var _value = props.value,\n data = props.data,\n _valueKey = props.valueKey,\n _props$searchKeyword = props.searchKeyword,\n _searchKeyword = _props$searchKeyword === void 0 ? '' : _props$searchKeyword;\n\n var nextData = [].concat(data);\n\n var _nextExpandItemValues = (0, _treeUtils.getExpandItemValues)(props);\n\n _this.flattenNodes(nextData);\n\n _this.unserializeLists('expand', _nextExpandItemValues, props);\n\n _this.state = {\n data: data,\n value: _value,\n dragging: false,\n selectedValue: _this.getValue(props),\n expandAll: (0, _treeUtils.getExpandAll)(props),\n filterData: _this.getFilterData(nextData, _searchKeyword, props),\n activeNode: _this.getActiveNode(_this.getValue(props), _valueKey),\n searchKeyword: _searchKeyword,\n expandItemValues: _this.serializeList('expand'),\n dragNodeKeys: [],\n dragOverNodeKey: null,\n dropNodePosition: null\n };\n _this.treeViewRef = React.createRef();\n _this.positionRef = React.createRef();\n _this.listRef = React.createRef();\n _this.triggerRef = React.createRef();\n _this.toggleRef = React.createRef(); // for test\n\n _this.menuRef = React.createRef();\n (0, _treeUtils.treeDeprecatedWarning)(props, ['expandAll']);\n return _this;\n }\n\n var _proto = TreePicker.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n var activeNode = this.state.activeNode;\n this.focusNode(activeNode);\n };\n\n TreePicker.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {\n var value = nextProps.value,\n data = nextProps.data,\n expandAll = nextProps.expandAll,\n searchKeyword = nextProps.searchKeyword,\n expandItemValues = nextProps.expandItemValues;\n var nextState = {};\n\n if ((0, _isArray2.default)(data) && (0, _isArray2.default)(prevState.data) && prevState.data !== data) {\n nextState.data = data;\n }\n\n if (!(0, _shallowEqual.default)(value, prevState.value)) {\n nextState.value = value;\n nextState.selectedValue = value;\n }\n\n if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues) && Array.isArray(expandItemValues)) {\n nextState.expandItemValues = expandItemValues;\n }\n\n if (!(0, _isUndefined2.default)(searchKeyword) && searchKeyword !== prevState.searchKeyword) {\n nextState.searchKeyword = searchKeyword;\n }\n\n if (expandAll !== prevState.expandAll) {\n nextState.expandAll = expandAll;\n }\n\n return Object.keys(nextState).length ? nextState : null;\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(_prevProps, prevState) {\n this.updateDataChange(prevState);\n this.updateValueChange(prevState);\n this.updateExpandItemValuesChange(prevState);\n this.updateSearchKeywordChange(prevState);\n\n if (this.listRef.current) {\n this.listRef.current.forceUpdateGrid();\n }\n };\n\n _proto.updateDataChange = function updateDataChange(prevState) {\n var _this$state4 = this.state,\n searchKeyword = _this$state4.searchKeyword,\n expandItemValues = _this$state4.expandItemValues;\n var data = this.props.data;\n\n if (prevState.data !== data) {\n var nextData = [].concat(data);\n this.flattenNodes(nextData);\n var filterData = this.getFilterData(nextData, searchKeyword);\n var activeNode = this.getActiveNode(this.getValue());\n this.focusNode(activeNode);\n this.unserializeLists('expand', expandItemValues);\n var newState = {};\n\n if (activeNode) {\n newState = {\n activeNode: activeNode\n };\n }\n\n this.setState((0, _extends3.default)({}, {\n data: nextData,\n filterData: filterData,\n expandItemValues: this.serializeList('expand')\n }, {}, newState));\n }\n };\n\n _proto.updateValueChange = function updateValueChange(prevState) {\n var _this$props12 = this.props,\n value = _this$props12.value,\n valueKey = _this$props12.valueKey;\n\n if (!(0, _shallowEqual.default)(prevState.value, value)) {\n var activeNode = null;\n\n if (this.node === null) {\n activeNode = this.getActiveNode(value);\n }\n\n if (value !== null && this.node !== null) {\n activeNode = (0, _shallowEqual.default)(this.node[valueKey], value) ? this.node : this.getActiveNode(value);\n }\n\n var nextState = {\n value: value,\n activeNode: activeNode\n };\n\n if (value === null) {\n nextState.activeNode = null;\n this.node = null;\n }\n\n if (activeNode !== null) {\n this.focusNode(activeNode);\n }\n\n this.setState(nextState);\n }\n };\n\n _proto.updateExpandItemValuesChange = function updateExpandItemValuesChange(prevState) {\n var expandItemValues = this.props.expandItemValues;\n\n if ((0, _treeUtils.compareArray)(expandItemValues, prevState.expandItemValues) && Array.isArray(expandItemValues)) {\n this.unserializeLists('expand', expandItemValues);\n this.setState({\n expandItemValues: expandItemValues\n });\n }\n };\n\n _proto.updateSearchKeywordChange = function updateSearchKeywordChange(prevState) {\n var filterData = this.state.filterData;\n\n if (!(0, _isUndefined2.default)(this.props.searchKeyword) && prevState.searchKeyword !== this.props.searchKeyword) {\n this.setState({\n filterData: this.getFilterData(filterData, this.props.searchKeyword)\n });\n }\n };\n\n _proto.getValue = function getValue(props) {\n if (props === void 0) {\n props = this.props;\n }\n\n var _props = props,\n value = _props.value,\n defaultValue = _props.defaultValue;\n return !(0, _isUndefined2.default)(value) ? value : defaultValue;\n };\n\n _proto.getActiveNode = function getActiveNode(value, valueKey) {\n var _this4 = this;\n\n if (valueKey === void 0) {\n valueKey = this.props.valueKey;\n }\n\n var activeNode = null;\n\n if (!(0, _isUndefined2.default)(value)) {\n Object.keys(this.nodes).forEach(function (refKey) {\n if ((0, _shallowEqual.default)(_this4.nodes[refKey][valueKey], value)) {\n activeNode = _this4.nodes[refKey];\n }\n });\n }\n\n return activeNode;\n };\n\n _proto.getActiveElementOption = function getActiveElementOption(options, value) {\n var childrenKey = this.props.childrenKey;\n\n for (var i = 0; i < options.length; i += 1) {\n var _options$i$childrenKe;\n\n if (options[i].value === value) {\n return options[i];\n } else if ((_options$i$childrenKe = options[i][childrenKey]) === null || _options$i$childrenKe === void 0 ? void 0 : _options$i$childrenKe.length) {\n var active = this.getActiveElementOption(options[i][childrenKey], value);\n\n if (!(0, _isEmpty2.default)(active)) {\n return active;\n }\n }\n }\n\n return {};\n };\n\n _proto.getItemsAndActiveIndex = function getItemsAndActiveIndex() {\n var items = this.getFocusableMenuItems();\n var activeIndex = -1;\n items.forEach(function (item, index) {\n if (document.activeElement !== null) {\n if (item.refKey === document.activeElement.getAttribute('data-key')) {\n activeIndex = index;\n }\n }\n });\n return {\n items: items,\n activeIndex: activeIndex\n };\n };\n\n _proto.getActiveItem = function getActiveItem() {\n var nodeData = {};\n var activeItem = document.activeElement;\n\n if (activeItem !== null) {\n var _get2 = (0, _get3.default)(activeItem, 'dataset'),\n key = _get2.key,\n layer = _get2.layer;\n\n var activeNode = this.nodes[key];\n\n if (activeNode) {\n nodeData = activeNode;\n }\n\n return {\n nodeData: nodeData,\n layer: layer\n };\n }\n\n return {};\n };\n\n _proto.getFilterData = function getFilterData(data, word, props) {\n if (word === void 0) {\n word = '';\n }\n\n var _ref2 = props || this.props,\n labelKey = _ref2.labelKey,\n childrenKey = _ref2.childrenKey,\n searchBy = _ref2.searchBy;\n\n var setVisible = function setVisible(nodes) {\n if (nodes === void 0) {\n nodes = [];\n }\n\n return nodes.forEach(function (item) {\n item.visible = searchBy ? searchBy(word, item[labelKey], item) : (0, _Picker.shouldDisplay)(item[labelKey], word);\n\n if ((0, _isArray2.default)(item[childrenKey])) {\n setVisible(item[childrenKey]);\n item[childrenKey].forEach(function (child) {\n if (child.visible) {\n item.visible = child.visible;\n }\n });\n }\n });\n };\n\n if (!(0, _isUndefined2.default)(word)) {\n setVisible(data);\n }\n\n return data;\n };\n\n _proto.getFlattenTreeData = function getFlattenTreeData(nodes) {\n var _this5 = this;\n\n var expandItemValues = this.state.expandItemValues;\n var _this$props13 = this.props,\n childrenKey = _this$props13.childrenKey,\n valueKey = _this$props13.valueKey;\n return (0, _treeUtils.flattenTree)(nodes, childrenKey, function (node) {\n var formatted = {};\n var curNode = _this5.nodes[node.refKey];\n var parentKeys = (0, _treeUtils.getNodeParents)(curNode, 'parentNode', valueKey);\n\n if (curNode) {\n formatted = (0, _extends3.default)({}, node, {\n expand: curNode.expand,\n layer: curNode.layer,\n parentNode: curNode.parentNode,\n showNode: (0, _treeUtils.shouldShowNodeByExpanded)(expandItemValues, parentKeys)\n });\n }\n\n return formatted;\n });\n };\n\n _proto.getTreeNodeProps = function getTreeNodeProps(node, layer, index) {\n var _this$state5 = this.state,\n dragOverNodeKey = _this$state5.dragOverNodeKey,\n selectedValue = _this$state5.selectedValue,\n dropNodePosition = _this$state5.dropNodePosition;\n var dragNode = this.dragNode || {};\n var _this$props14 = this.props,\n locale = _this$props14.locale,\n valueKey = _this$props14.valueKey,\n labelKey = _this$props14.labelKey,\n draggable = _this$props14.draggable,\n childrenKey = _this$props14.childrenKey,\n _this$props14$disable = _this$props14.disabledItemValues,\n disabledItemValues = _this$props14$disable === void 0 ? [] : _this$props14$disable,\n renderTreeNode = _this$props14.renderTreeNode,\n renderTreeIcon = _this$props14.renderTreeIcon;\n return {\n rtl: locale.rtl,\n value: node[valueKey],\n label: node[labelKey],\n index: index,\n layer: layer,\n expand: node.expand,\n active: (0, _shallowEqual.default)(node[valueKey], selectedValue),\n visible: node.visible,\n draggable: draggable,\n dragging: (0, _shallowEqual.default)(node[valueKey], dragNode[valueKey]),\n children: node[childrenKey],\n nodeData: node,\n disabled: disabledItemValues.some(function (disabledItem) {\n return (0, _shallowEqual.default)(disabledItem, node[valueKey]);\n }),\n dragOver: (0, _shallowEqual.default)(node[valueKey], dragOverNodeKey) && dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER,\n dragOverTop: (0, _shallowEqual.default)(node[valueKey], dragOverNodeKey) && dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_TOP,\n dragOverBottom: (0, _shallowEqual.default)(node[valueKey], dragOverNodeKey) && dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_BOTTOM,\n onSelect: this.handleSelect,\n onDragStart: this.handleDragStart,\n onDragEnter: this.handleDragEnter,\n onDragOver: this.handleDragOver,\n onDragLeave: this.handleDragLeave,\n onDragEnd: this.handleDragEnd,\n onDrop: this.handleDrop,\n onTreeToggle: this.handleToggle,\n onRenderTreeNode: renderTreeNode,\n onRenderTreeIcon: renderTreeIcon\n };\n }\n /**\n * 获取 onDrop 的回调数据\n */\n ;\n\n _proto.getDropData = function getDropData(nodeData) {\n var dropNodePosition = this.state.dropNodePosition;\n var _this$props15 = this.props,\n valueKey = _this$props15.valueKey,\n childrenKey = _this$props15.childrenKey;\n var options = {\n valueKey: valueKey,\n childrenKey: childrenKey\n };\n var dragNode = (0, _omit2.default)(this.dragNode, 'parentNode');\n return {\n /** 拖拽节点 */\n dragNode: dragNode,\n\n /** 释放所在节点的父节点 */\n dropNode: nodeData,\n\n /** 拖拽节点的类型 */\n dropNodePosition: dropNodePosition,\n createUpdateDataFunction: (0, _treeUtils.createUpdateTreeDataFunction)({\n /** 拖拽节点 */\n dragNode: dragNode,\n\n /** 释放所在节点的父节点 */\n dropNode: nodeData,\n\n /** 拖拽节点的类型 */\n dropNodePosition: dropNodePosition\n }, options)\n };\n };\n\n _proto.focusNode = function focusNode(activeNode) {\n var inline = this.props.inline;\n\n if (activeNode && inline) {\n var _node$focus4;\n\n var node = this.getElementByDataKey(activeNode.refKey);\n node === null || node === void 0 ? void 0 : (_node$focus4 = node.focus) === null || _node$focus4 === void 0 ? void 0 : _node$focus4.call(node);\n }\n };\n\n _proto.flattenNodes = function flattenNodes(nodes, props, ref, parentNode, layer) {\n var _this6 = this;\n\n if (ref === void 0) {\n ref = '0';\n }\n\n if (layer === void 0) {\n layer = 0;\n }\n\n var _ref3 = props || this.props,\n labelKey = _ref3.labelKey,\n valueKey = _ref3.valueKey,\n childrenKey = _ref3.childrenKey;\n\n if (!Array.isArray(nodes) || nodes.length === 0) {\n return [];\n }\n\n nodes.map(function (node, index) {\n var _extends2;\n\n var refKey = ref + \"-\" + index;\n node.refKey = refKey;\n _this6.nodes[refKey] = (0, _extends3.default)((_extends2 = {\n layer: layer\n }, _extends2[labelKey] = node[labelKey], _extends2[valueKey] = node[valueKey], _extends2.expand = (0, _treeUtils.getExpandState)(node, props || _this6.props), _extends2.refKey = refKey, _extends2), node);\n\n if (parentNode) {\n _this6.nodes[refKey].parentNode = parentNode;\n }\n\n _this6.flattenNodes(node[childrenKey], props, refKey, _this6.nodes[refKey], layer + 1);\n });\n };\n\n _proto.serializeList = function serializeList(key, nodes) {\n if (nodes === void 0) {\n nodes = this.nodes;\n }\n\n var valueKey = this.props.valueKey;\n var list = [];\n Object.keys(nodes).forEach(function (refKey) {\n if (nodes[refKey][key]) {\n list.push(nodes[refKey][valueKey]);\n }\n });\n return list;\n };\n\n _proto.unserializeLists = function unserializeLists(key, value, props) {\n var _this7 = this;\n\n if (value === void 0) {\n value = [];\n }\n\n if (props === void 0) {\n props = this.props;\n }\n\n var _props2 = props,\n valueKey = _props2.valueKey;\n var expandAll = (0, _treeUtils.getExpandAll)(props);\n Object.keys(this.nodes).forEach(function (refKey) {\n _this7.nodes[refKey][key] = false;\n\n if (value.length) {\n value.forEach(function (value) {\n if ((0, _shallowEqual.default)(_this7.nodes[refKey][valueKey], value)) {\n _this7.nodes[refKey][key] = true;\n }\n });\n } else {\n _this7.nodes[refKey][key] = expandAll;\n }\n });\n };\n\n _proto.toggleExpand = function toggleExpand(node, isExpand) {\n var valueKey = this.props.valueKey;\n var expandItemValues = new Set(this.serializeList('expand'));\n\n if (isExpand) {\n expandItemValues.add(node[valueKey]);\n } else {\n expandItemValues.delete(node[valueKey]);\n }\n\n return Array.from(expandItemValues);\n };\n\n _proto.renderDropdownMenu = function renderDropdownMenu() {\n var _this$props16 = this.props,\n searchable = _this$props16.searchable,\n searchKeyword = _this$props16.searchKeyword,\n renderExtraFooter = _this$props16.renderExtraFooter,\n locale = _this$props16.locale,\n renderMenu = _this$props16.renderMenu,\n menuStyle = _this$props16.menuStyle,\n menuClassName = _this$props16.menuClassName,\n menuAutoWidth = _this$props16.menuAutoWidth;\n var keyword = !(0, _isUndefined2.default)(searchKeyword) ? searchKeyword : this.state.searchKeyword;\n var classes = (0, _classnames.default)(menuClassName, this.addPrefix('tree-menu'));\n return React.createElement(_Picker.MenuWrapper, {\n autoWidth: menuAutoWidth,\n className: classes,\n style: menuStyle,\n ref: this.menuRef,\n getToggleInstance: this.getToggleInstance,\n getPositionInstance: this.getPositionInstance,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 880\n },\n __self: this\n }, searchable ? React.createElement(_Picker.SearchBar, {\n placeholder: locale.searchPlaceholder,\n key: \"searchBar\",\n onChange: this.handleSearch,\n value: keyword,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 889\n },\n __self: this\n }) : null, renderMenu ? renderMenu(this.renderTree()) : this.renderTree(), renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());\n };\n\n _proto.renderNode = function renderNode(node, index, layer) {\n var _this8 = this;\n\n var searchKeyword = this.state.searchKeyword;\n var _this$props17 = this.props,\n valueKey = _this$props17.valueKey,\n childrenKey = _this$props17.childrenKey;\n\n if (!node.visible) {\n return null;\n }\n\n var refKey = node.refKey;\n var expand = (0, _treeUtils.getExpandWhenSearching)(searchKeyword, this.nodes[refKey].expand);\n var key = (0, _isString2.default)(node[valueKey]) || (0, _isNumber2.default)(node[valueKey]) ? node[valueKey] : refKey;\n var children = node[childrenKey]; // 当用户进行搜索时,hasChildren的判断要变成判断是否存在 visible 为 true 的子节点\n\n var visibleChildren = (0, _isUndefined2.default)(searchKeyword) || searchKeyword.length === 0 ? !!children : (0, _treeUtils.hasVisibleChildren)(node, childrenKey);\n var nodeProps = (0, _extends3.default)({}, this.getTreeNodeProps((0, _extends3.default)({}, node, {\n expand: expand\n }), layer, index), {\n hasChildren: visibleChildren\n });\n\n if (nodeProps.hasChildren) {\n var _classNames;\n\n layer += 1; // 是否展开树节点且子节点不为空\n\n var openClass = this.addTreePrefix('open');\n var childrenClass = (0, _classnames.default)(this.addTreePrefix('node-children'), (_classNames = {}, _classNames[openClass] = expand && visibleChildren, _classNames));\n var nodes = children || [];\n return React.createElement(\"div\", {\n className: childrenClass,\n key: key,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 935\n },\n __self: this\n }, React.createElement(_TreeNode.default, (0, _extends3.default)({}, nodeProps, {\n innerRef: this.bindNodeRefs.bind(this, refKey),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 936\n },\n __self: this\n })), React.createElement(\"div\", {\n className: this.addTreePrefix('children'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 937\n },\n __self: this\n }, nodes.map(function (child, i) {\n return _this8.renderNode(child, i, layer);\n })));\n }\n\n return React.createElement(_TreeNode.default, (0, _extends3.default)({\n key: key,\n innerRef: this.bindNodeRefs.bind(this, refKey)\n }, nodeProps, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 944\n },\n __self: this\n }));\n };\n\n _proto.renderVirtualNode = function renderVirtualNode(node, options) {\n var searchKeyword = this.state.searchKeyword;\n var childrenKey = this.props.childrenKey;\n var key = options.key,\n style = options.style;\n var layer = node.layer,\n refKey = node.refKey,\n showNode = node.showNode;\n var expand = (0, _treeUtils.getExpandWhenSearching)(searchKeyword, this.nodes[refKey].expand);\n\n if (!node.visible) {\n return null;\n }\n\n var nodeProps = (0, _extends3.default)({}, this.getTreeNodeProps((0, _extends3.default)({}, node, {\n expand: expand\n }), layer), {\n style: style,\n hasChildren: !!node[childrenKey]\n });\n return showNode && React.createElement(_TreeNode.default, (0, _extends3.default)({\n key: key,\n innerRef: this.bindNodeRefs.bind(this, refKey)\n }, nodeProps, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 966\n },\n __self: this\n }));\n };\n\n _proto.renderTree = function renderTree() {\n var _classNames2,\n _this9 = this;\n\n var filterData = this.state.filterData;\n var _this$props18 = this.props,\n height = _this$props18.height,\n className = _this$props18.className,\n inline = _this$props18.inline,\n style = _this$props18.style,\n locale = _this$props18.locale,\n virtualized = _this$props18.virtualized;\n var layer = 0;\n var classes = (0, _classnames.default)((0, _utils.defaultClassPrefix)('tree'), (_classNames2 = {}, _classNames2[className] = inline, _classNames2));\n var nodes = [];\n\n if (!virtualized) {\n nodes = filterData.map(function (dataItem, index) {\n return _this9.renderNode(dataItem, index, layer);\n });\n\n if (!nodes.some(function (v) {\n return v !== null;\n })) {\n return React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 995\n },\n __self: this\n }, locale.noResultsText);\n }\n } else {\n nodes = this.getFlattenTreeData(filterData).filter(function (n) {\n return n.showNode && n.visible;\n });\n\n if (!nodes.length) {\n return React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1000\n },\n __self: this\n }, locale.noResultsText);\n }\n } // The height of virtualized tree should be subtract the value of paddingBottom\n\n\n var treeHeight = height - 12;\n var treeWidth = (0, _isUndefined2.default)(style === null || style === void 0 ? void 0 : style.width) ? defaultWidth : style.width;\n var listStyles = inline ? (0, _extends3.default)({\n height: height\n }, style) : style;\n return React.createElement(React.Fragment, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1010\n },\n __self: this\n }, React.createElement(\"div\", {\n ref: this.treeViewRef,\n className: classes,\n style: listStyles,\n onKeyDown: this.handleKeyDown,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1011\n },\n __self: this\n }, React.createElement(\"div\", {\n className: this.addTreePrefix('nodes'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1017\n },\n __self: this\n }, virtualized ? React.createElement(_AutoSizer.default, {\n defaultHeight: treeHeight,\n defaultWidth: treeWidth,\n style: {\n width: 'auto',\n height: 'auto'\n },\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1019\n },\n __self: this\n }, function (_ref4) {\n var height = _ref4.height,\n width = _ref4.width;\n return React.createElement(_List.default, {\n ref: _this9.listRef,\n width: width || treeWidth,\n height: height,\n rowHeight: 36,\n rowCount: nodes.length,\n rowRenderer: _this9.measureRowRenderer(nodes),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1025\n },\n __self: this\n });\n }) : nodes)), this.renderDragNode());\n };\n\n _proto.renderDragNode = function renderDragNode() {\n var _this$props19 = this.props,\n labelKey = _this$props19.labelKey,\n draggable = _this$props19.draggable,\n renderDragNode = _this$props19.renderDragNode;\n var dragNode = this.dragNode || {};\n\n if (draggable) {\n var dragNodeContent = dragNode[labelKey];\n\n if ((0, _isFunction2.default)(renderDragNode)) {\n dragNodeContent = renderDragNode(dragNode);\n }\n\n return React.createElement(\"span\", {\n id: \"drag-node\",\n className: this.addTreePrefix('drag-node-mover'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1054\n },\n __self: this\n }, dragNodeContent);\n }\n\n return null;\n };\n\n _proto.render = function render() {\n var _this$props20 = this.props,\n inline = _this$props20.inline,\n locale = _this$props20.locale,\n disabled = _this$props20.disabled,\n toggleComponentClass = _this$props20.toggleComponentClass,\n placeholder = _this$props20.placeholder,\n cleanable = _this$props20.cleanable,\n renderValue = _this$props20.renderValue,\n labelKey = _this$props20.labelKey,\n onEntered = _this$props20.onEntered,\n onExited = _this$props20.onExited,\n onClean = _this$props20.onClean,\n style = _this$props20.style,\n positionRef = _this$props20.positionRef,\n rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props20, [\"inline\", \"locale\", \"disabled\", \"toggleComponentClass\", \"placeholder\", \"cleanable\", \"renderValue\", \"labelKey\", \"onEntered\", \"onExited\", \"onClean\", \"style\", \"positionRef\"]);\n var _this$state6 = this.state,\n selectedValue = _this$state6.selectedValue,\n activeNode = _this$state6.activeNode;\n var hasValidValue = !(0, _isNil2.default)(activeNode) || !(0, _isNil2.default)(selectedValue) && (0, _isFunction2.default)(renderValue);\n var selectedElement = placeholder;\n var hasValue = !!activeNode;\n /**\n * if value is invalid and renderValue is undefined, then using placeholder.\n * if value is valid and renderValue is't undefined, then using renderValue()\n */\n\n if (!(0, _isNil2.default)(selectedValue)) {\n if (hasValue) {\n selectedElement = activeNode[labelKey];\n }\n\n if ((0, _isFunction2.default)(renderValue)) {\n var node = activeNode !== null && activeNode !== void 0 ? activeNode : {};\n selectedElement = renderValue(selectedValue, node, selectedElement);\n\n if ((0, _isNil2.default)(selectedElement)) {\n hasValidValue = false;\n }\n }\n }\n\n var unhandled = (0, _utils.getUnhandledProps)(TreePicker, rest);\n var classes = (0, _Picker.getToggleWrapperClassName)('tree', this.addPrefix, this.props, hasValidValue);\n\n if (inline) {\n return this.renderTree();\n }\n\n return React.createElement(_Picker.PickerToggleTrigger, {\n pickerProps: this.props,\n ref: this.triggerRef,\n positionRef: (0, _utils.mergeRefs)(this.positionRef, positionRef),\n onEntered: (0, _utils.createChainedFunction)(this.handleOnOpen, onEntered),\n onExited: (0, _utils.createChainedFunction)(this.handleOnClose, onExited),\n speaker: this.renderDropdownMenu(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1112\n },\n __self: this\n }, React.createElement(\"div\", {\n className: classes,\n style: style,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1120\n },\n __self: this\n }, React.createElement(_Picker.PickerToggle, (0, _extends3.default)({}, unhandled, {\n ref: this.toggleRef,\n onKeyDown: this.handleToggleKeyDown,\n onClean: (0, _utils.createChainedFunction)(this.handleClean, onClean),\n cleanable: cleanable && !disabled,\n componentClass: toggleComponentClass,\n hasValue: hasValidValue,\n active: this.state.active,\n \"aria-disabled\": disabled,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1121\n },\n __self: this\n }), selectedElement || locale.placeholder)));\n };\n\n return TreePicker;\n}(React.Component);\n\nTreePicker.propTypes = (0, _extends3.default)({}, _propTypes2.listPickerPropTypes, {\n height: _propTypes.default.number,\n inline: _propTypes.default.bool,\n draggable: _propTypes.default.bool,\n expandAll: _propTypes.default.bool,\n virtualized: _propTypes.default.bool,\n searchable: _propTypes.default.bool,\n menuAutoWidth: _propTypes.default.bool,\n searchKeyword: _propTypes.default.string,\n defaultExpandAll: _propTypes.default.bool,\n expandItemValues: _propTypes.default.array,\n defaultExpandItemValues: _propTypes.default.array,\n onSearch: _propTypes.default.func,\n onExpand: _propTypes.default.func,\n onSelect: _propTypes.default.func,\n renderMenu: _propTypes.default.func,\n renderTreeNode: _propTypes.default.func,\n renderTreeIcon: _propTypes.default.func,\n renderExtraFooter: _propTypes.default.func,\n renderDragNode: _propTypes.default.func,\n searchBy: _propTypes.default.func\n});\nTreePicker.defaultProps = (0, _extends3.default)({}, _propTypes2.listPickerDefaultProps, {\n height: defaultHeight,\n searchable: true,\n menuAutoWidth: true,\n locale: {\n placeholder: 'Select',\n searchPlaceholder: 'Search',\n noResultsText: 'No results found'\n }\n});\n(0, _reactLifecyclesCompat.polyfill)(TreePicker);\n\nvar _default = (0, _utils.defaultProps)({\n classPrefix: 'picker'\n})(TreePicker);\n\nexports.default = _default;\nmodule.exports = exports.default;\n\n//# sourceURL=webpack://rsuite/./src/TreePicker/TreePicker.tsx?");
10208
10208
 
10209
10209
  /***/ }),
10210
10210
 
@@ -10744,7 +10744,7 @@ eval("\n\nvar _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/h
10744
10744
  /***/ (function(module, exports, __webpack_require__) {
10745
10745
 
10746
10746
  "use strict";
10747
- eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nexports.__esModule = true;\nexports.shouldShowNodeByExpanded = shouldShowNodeByExpanded;\nexports.flattenTree = flattenTree;\nexports.getNodeParents = getNodeParents;\nexports.getVirtualLisHeight = getVirtualLisHeight;\nexports.hasVisibleChildren = hasVisibleChildren;\nexports.treeDeprecatedWarning = treeDeprecatedWarning;\nexports.compareArray = compareArray;\nexports.getExpandAll = getExpandAll;\nexports.getExpandItemValues = getExpandItemValues;\nexports.getExpandState = getExpandState;\nexports.getDragNodeKeys = getDragNodeKeys;\nexports.calDropNodePosition = calDropNodePosition;\nexports.removeDragNode = removeDragNode;\nexports.createUpdateTreeDataFunction = createUpdateTreeDataFunction;\nexports.findNodeOfTree = findNodeOfTree;\nexports.filterNodesOfTree = filterNodesOfTree;\nexports.getExpandWhenSearching = getExpandWhenSearching;\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _isEmpty2 = _interopRequireDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\n\nvar _clone2 = _interopRequireDefault(__webpack_require__(/*! lodash/clone */ \"./node_modules/lodash/clone.js\"));\n\nvar _isNil2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isUndefined2 = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _isArray2 = _interopRequireDefault(__webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\"));\n\nvar _intersection2 = _interopRequireDefault(__webpack_require__(/*! lodash/intersection */ \"./node_modules/lodash/intersection.js\"));\n\nvar _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _shallowEqualArray = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqualArray */ \"./src/utils/shallowEqualArray.ts\"));\n\nvar _constants = __webpack_require__(/*! ../constants */ \"./src/constants.ts\");\n\nvar SEARCH_BAR_HEIGHT = 48;\nvar MENU_PADDING = 12; // Tree Node 之间的 间隔\n\nvar TREE_NODE_GAP = 4;\n/**\n * 判断当前节点是否应该显示\n * @param {*} expandItemValues\n * @param {*} parentKeys\n */\n\nfunction shouldShowNodeByExpanded(expandItemValues, parentKeys) {\n if (expandItemValues === void 0) {\n expandItemValues = [];\n }\n\n if (parentKeys === void 0) {\n parentKeys = [];\n }\n\n var intersectionKeys = (0, _intersection2.default)(expandItemValues, parentKeys);\n\n if (intersectionKeys.length === parentKeys.length) {\n return true;\n }\n\n return false;\n}\n/**\n * 拍平树结构为数组\n * @param {*} tree\n * @param {*} childrenKey\n * @param {*} executor\n */\n\n\nfunction flattenTree(tree, childrenKey, executor) {\n if (childrenKey === void 0) {\n childrenKey = 'children';\n }\n\n var flattenData = [];\n\n var traverse = function traverse(data, parent) {\n if (!(0, _isArray2.default)(data)) {\n return;\n }\n\n data.forEach(function (item, index) {\n var node = typeof executor === 'function' ? executor(item, index) : item;\n node.parent = parent;\n flattenData.push((0, _extends2.default)({}, node));\n\n if (item[childrenKey]) {\n traverse(item[childrenKey], item);\n }\n });\n };\n\n traverse(tree, null);\n return flattenData;\n}\n/**\n * 获取树节点所有的祖先节点\n * @param {*} node\n */\n\n\nfunction getNodeParents(node, parentKey, valueKey) {\n if (parentKey === void 0) {\n parentKey = 'parent';\n }\n\n var parents = [];\n\n var traverse = function traverse(node) {\n if (node === null || node === void 0 ? void 0 : node[parentKey]) {\n traverse(node[parentKey]);\n\n if (valueKey) {\n parents.push(node[parentKey][valueKey]);\n } else {\n parents.push(node[parentKey]);\n }\n }\n };\n\n traverse(node);\n return parents;\n}\n/**\n * 获取 VirtualList 的高度\n * @param {*} inline\n * @param {*} height\n */\n\n\nfunction getVirtualLisHeight(inline, searchable, height) {\n if (height === void 0) {\n height = 0;\n }\n\n var searchBarHeight = searchable ? SEARCH_BAR_HEIGHT : 0;\n return inline ? height - MENU_PADDING * 2 : height - searchBarHeight - MENU_PADDING * 2;\n}\n/**\n * 判断节点是否存在可见的子节点。\n * @param node\n */\n\n\nfunction hasVisibleChildren(node, childrenKey) {\n if (!Array.isArray(node[childrenKey])) {\n return false;\n }\n\n return node[childrenKey].some(function (child) {\n return child.visible;\n });\n}\n/**\n * 废弃 prop warning\n * @param prop\n */\n\n\nfunction treeDeprecatedWarning(props, keys) {\n if (keys === void 0) {\n keys = [];\n }\n\n keys.forEach(function (key) {\n if (!(0, _isUndefined2.default)(props[key])) {\n console.warn(\"'Warning: \" + key + \" is deprecated and will be removed in a future release.'\");\n }\n });\n}\n/**\n * 浅比较两个数组是否不一样\n * @param a\n * @param b\n */\n\n\nfunction compareArray(a, b) {\n if (!((0, _isArray2.default)(a) && (0, _isArray2.default)(b))) {\n return a !== b;\n }\n\n return !(0, _shallowEqualArray.default)(a, b);\n}\n/**\n * 获取 expandAll 的 value\n * @param props\n */\n\n\nfunction getExpandAll(props) {\n var expandAll = props.expandAll,\n defaultExpandAll = props.defaultExpandAll;\n return !(0, _isUndefined2.default)(expandAll) ? expandAll : defaultExpandAll;\n}\n/**\n * 获取 expandItemValues 的 value\n * @param props\n */\n\n\nfunction getExpandItemValues(props) {\n var expandItemValues = props.expandItemValues,\n defaultExpandItemValues = props.defaultExpandItemValues;\n\n if (!(0, _isUndefined2.default)(expandItemValues) && Array.isArray(expandItemValues)) {\n return expandItemValues;\n }\n\n if (!(0, _isUndefined2.default)(defaultExpandItemValues) && Array.isArray(defaultExpandItemValues)) {\n return defaultExpandItemValues;\n }\n\n return [];\n}\n/**\n * 获取节点展开状态\n * @param node\n * @param props\n */\n\n\nfunction getExpandState(node, props) {\n var _node$childrenKey;\n\n var valueKey = props.valueKey,\n childrenKey = props.childrenKey,\n expandItemValues = props.expandItemValues;\n var expandAll = getExpandAll(props);\n var expand = getExpandItemValues(props).some(function (value) {\n return (0, _shallowEqual.default)(node[valueKey], value);\n });\n\n if (!(0, _isUndefined2.default)(expandItemValues)) {\n return expand;\n } else if ((_node$childrenKey = node[childrenKey]) === null || _node$childrenKey === void 0 ? void 0 : _node$childrenKey.length) {\n if (!(0, _isNil2.default)(node.expand)) {\n return !!node.expand;\n } else if (expandAll) {\n return true;\n }\n\n return false;\n }\n\n return false;\n}\n/**\n * 获取拖拽节点及子节点的key\n * @param node\n * @param childrenKey\n * @param valueKey\n */\n\n\nfunction getDragNodeKeys(dragNode, childrenKey, valueKey) {\n var dragNodeKeys = [dragNode[valueKey]];\n\n var traverse = function traverse(data) {\n if ((data === null || data === void 0 ? void 0 : data.length) > 0) {\n data.forEach(function (node) {\n dragNodeKeys = dragNodeKeys.concat([node[valueKey]]);\n\n if (node[childrenKey]) {\n traverse(node[childrenKey]);\n }\n });\n }\n };\n\n traverse(dragNode[childrenKey]);\n return dragNodeKeys;\n}\n\nfunction calDropNodePosition(event, treeNodeElement) {\n var clientY = event.clientY;\n\n var _treeNodeElement$getB = treeNodeElement.getBoundingClientRect(),\n top = _treeNodeElement$getB.top,\n bottom = _treeNodeElement$getB.bottom;\n\n var gap = TREE_NODE_GAP; // 处于节点下方\n\n if (clientY >= bottom - gap && clientY <= bottom) {\n return _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_BOTTOM;\n } // 处于节点上方\n\n\n if (clientY <= top + gap && clientY >= top) {\n return _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_TOP;\n }\n\n if (clientY >= top + gap && clientY <= bottom - gap) {\n return _constants.TREE_NODE_DROP_POSITION.DRAG_OVER;\n }\n\n return -1;\n}\n\nfunction removeDragNode(data, params, _ref) {\n var valueKey = _ref.valueKey,\n childrenKey = _ref.childrenKey;\n var dragNode = params.dragNode;\n\n var traverse = function traverse(items, parent) {\n for (var _index = 0; _index < items.length; _index += 1) {\n var item = items[_index];\n\n if ((0, _shallowEqual.default)(item[valueKey], dragNode[valueKey])) {\n items.splice(_index, 1); // 当 children 为空,需要删除 children 属性,不显示角标\n\n if (items.length === 0 && parent) {\n delete parent.children;\n }\n\n break;\n }\n\n if (Array.isArray(item[childrenKey])) {\n traverse(item[childrenKey], item);\n }\n }\n };\n\n traverse(data);\n}\n/**\n * 移动节点valueKey,先删除 dragNode 原本所在的数据,再将 dragNode 移动到拖动的位置\n * @param data\n * @param params\n */\n\n\nfunction createUpdateTreeDataFunction(params, _ref2) {\n var valueKey = _ref2.valueKey,\n childrenKey = _ref2.childrenKey;\n return function (tree) {\n var data = [].concat(tree);\n var dragNode = params.dragNode,\n dropNode = params.dropNode,\n dropNodePosition = params.dropNodePosition;\n removeDragNode(data, params, {\n valueKey: valueKey,\n childrenKey: childrenKey\n });\n\n var updateTree = function updateTree(items) {\n for (var _index2 = 0; _index2 < items.length; _index2 += 1) {\n var item = items[_index2];\n\n if ((0, _shallowEqual.default)(item[valueKey], dropNode[valueKey])) {\n // 拖拽到 dropNode内,作为 dropNode 的子节点\n if (dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER) {\n item[childrenKey] = (0, _isNil2.default)(item[childrenKey]) ? [] : item[childrenKey];\n item[childrenKey].push(dragNode);\n break;\n } else if (dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_TOP) {\n // 拖拽到 dropNode 的上面\n items.splice(_index2, 0, dragNode);\n break;\n } else if (dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_BOTTOM) {\n // 拖拽到 dropNode 的下面\n items.splice(_index2 + 1, 0, dragNode);\n break;\n }\n }\n\n if (Array.isArray(item[childrenKey]) && item[childrenKey].length > 0) {\n updateTree(item[childrenKey]);\n }\n }\n };\n\n updateTree(data);\n return [].concat(data);\n };\n}\n\nfunction findNodeOfTree(data, check) {\n var findNode = function findNode(nodes) {\n if (nodes === void 0) {\n nodes = [];\n }\n\n for (var i = 0; i < nodes.length; i += 1) {\n var item = nodes[i];\n\n if ((0, _isArray2.default)(item.children)) {\n var _node = findNode(item.children);\n\n if (_node) {\n return _node;\n }\n }\n\n if (check(item)) {\n return item;\n }\n }\n\n return undefined;\n };\n\n return findNode(data);\n}\n\nfunction filterNodesOfTree(data, check) {\n var findNodes = function findNodes(nodes) {\n if (nodes === void 0) {\n nodes = [];\n }\n\n var nextNodes = [];\n\n for (var i = 0; i < nodes.length; i += 1) {\n if ((0, _isArray2.default)(nodes[i].children)) {\n var nextChildren = findNodes(nodes[i].children);\n\n if (nextChildren.length) {\n var item = (0, _clone2.default)(nodes[i]);\n item.children = nextChildren;\n nextNodes.push(item);\n continue;\n }\n }\n\n if (check(nodes[i])) {\n nextNodes.push(nodes[i]);\n }\n }\n\n return nextNodes;\n };\n\n return findNodes(data);\n}\n/**\n * 根据是否处于搜索状态来返回 expand 的值。如果处于搜索状态下,则展开所有的节点\n * @param searchKeyword\n * @param expand\n */\n\n\nfunction getExpandWhenSearching(searchKeyword, expand) {\n return !(0, _isEmpty2.default)(searchKeyword) ? true : expand;\n}\n\n//# sourceURL=webpack://rsuite/./src/utils/treeUtils.ts?");
10747
+ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nexports.__esModule = true;\nexports.shouldShowNodeByExpanded = shouldShowNodeByExpanded;\nexports.flattenTree = flattenTree;\nexports.getNodeParents = getNodeParents;\nexports.hasVisibleChildren = hasVisibleChildren;\nexports.treeDeprecatedWarning = treeDeprecatedWarning;\nexports.compareArray = compareArray;\nexports.getExpandAll = getExpandAll;\nexports.getExpandItemValues = getExpandItemValues;\nexports.getExpandState = getExpandState;\nexports.getDragNodeKeys = getDragNodeKeys;\nexports.calDropNodePosition = calDropNodePosition;\nexports.removeDragNode = removeDragNode;\nexports.createUpdateTreeDataFunction = createUpdateTreeDataFunction;\nexports.findNodeOfTree = findNodeOfTree;\nexports.filterNodesOfTree = filterNodesOfTree;\nexports.getExpandWhenSearching = getExpandWhenSearching;\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _isEmpty2 = _interopRequireDefault(__webpack_require__(/*! lodash/isEmpty */ \"./node_modules/lodash/isEmpty.js\"));\n\nvar _clone2 = _interopRequireDefault(__webpack_require__(/*! lodash/clone */ \"./node_modules/lodash/clone.js\"));\n\nvar _isNil2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _isUndefined2 = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.js\"));\n\nvar _isArray2 = _interopRequireDefault(__webpack_require__(/*! lodash/isArray */ \"./node_modules/lodash/isArray.js\"));\n\nvar _intersection2 = _interopRequireDefault(__webpack_require__(/*! lodash/intersection */ \"./node_modules/lodash/intersection.js\"));\n\nvar _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _shallowEqualArray = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqualArray */ \"./src/utils/shallowEqualArray.ts\"));\n\nvar _constants = __webpack_require__(/*! ../constants */ \"./src/constants.ts\");\n\n// Tree Node 之间的 间隔\nvar TREE_NODE_GAP = 4;\n/**\n * Whether current node is visible\n * when all the parents of the current node is expanded, the current node should be visible\n * @param {*} expandItemValues\n * @param {*} parentKeys\n */\n\nfunction shouldShowNodeByExpanded(expandItemValues, parentKeys) {\n if (expandItemValues === void 0) {\n expandItemValues = [];\n }\n\n if (parentKeys === void 0) {\n parentKeys = [];\n }\n\n var intersectionKeys = (0, _intersection2.default)(expandItemValues, parentKeys);\n\n if (intersectionKeys.length === parentKeys.length) {\n return true;\n }\n\n return false;\n}\n/**\n * 拍平树结构为数组\n * @param {*} tree\n * @param {*} childrenKey\n * @param {*} executor\n */\n\n\nfunction flattenTree(tree, childrenKey, executor) {\n if (childrenKey === void 0) {\n childrenKey = 'children';\n }\n\n var flattenData = [];\n\n var traverse = function traverse(data, parent) {\n if (!(0, _isArray2.default)(data)) {\n return;\n }\n\n data.forEach(function (item, index) {\n var node = typeof executor === 'function' ? executor(item, index) : item;\n node.parent = parent;\n flattenData.push((0, _extends2.default)({}, node));\n\n if (item[childrenKey]) {\n traverse(item[childrenKey], item);\n }\n });\n };\n\n traverse(tree, null);\n return flattenData;\n}\n/**\n * 获取树节点所有的祖先节点\n * @param {*} node\n */\n\n\nfunction getNodeParents(node, parentKey, valueKey) {\n if (parentKey === void 0) {\n parentKey = 'parent';\n }\n\n var parents = [];\n\n var traverse = function traverse(node) {\n if (node === null || node === void 0 ? void 0 : node[parentKey]) {\n traverse(node[parentKey]);\n\n if (valueKey) {\n parents.push(node[parentKey][valueKey]);\n } else {\n parents.push(node[parentKey]);\n }\n }\n };\n\n traverse(node);\n return parents;\n}\n/**\n * 判断节点是否存在可见的子节点。\n * @param node\n */\n\n\nfunction hasVisibleChildren(node, childrenKey) {\n if (!Array.isArray(node[childrenKey])) {\n return false;\n }\n\n return node[childrenKey].some(function (child) {\n return child.visible;\n });\n}\n/**\n * 废弃 prop warning\n * @param prop\n */\n\n\nfunction treeDeprecatedWarning(props, keys) {\n if (keys === void 0) {\n keys = [];\n }\n\n keys.forEach(function (key) {\n if (!(0, _isUndefined2.default)(props[key])) {\n console.warn(\"'Warning: \" + key + \" is deprecated and will be removed in a future release.'\");\n }\n });\n}\n/**\n * 浅比较两个数组是否不一样\n * @param a\n * @param b\n */\n\n\nfunction compareArray(a, b) {\n if (!((0, _isArray2.default)(a) && (0, _isArray2.default)(b))) {\n return a !== b;\n }\n\n return !(0, _shallowEqualArray.default)(a, b);\n}\n/**\n * 获取 expandAll 的 value\n * @param props\n */\n\n\nfunction getExpandAll(props) {\n var expandAll = props.expandAll,\n defaultExpandAll = props.defaultExpandAll;\n return !(0, _isUndefined2.default)(expandAll) ? expandAll : defaultExpandAll;\n}\n/**\n * 获取 expandItemValues 的 value\n * @param props\n */\n\n\nfunction getExpandItemValues(props) {\n var expandItemValues = props.expandItemValues,\n defaultExpandItemValues = props.defaultExpandItemValues;\n\n if (!(0, _isUndefined2.default)(expandItemValues) && Array.isArray(expandItemValues)) {\n return expandItemValues;\n }\n\n if (!(0, _isUndefined2.default)(defaultExpandItemValues) && Array.isArray(defaultExpandItemValues)) {\n return defaultExpandItemValues;\n }\n\n return [];\n}\n/**\n * 获取节点展开状态\n * @param node\n * @param props\n */\n\n\nfunction getExpandState(node, props) {\n var _node$childrenKey;\n\n var valueKey = props.valueKey,\n childrenKey = props.childrenKey,\n expandItemValues = props.expandItemValues;\n var expandAll = getExpandAll(props);\n var expand = getExpandItemValues(props).some(function (value) {\n return (0, _shallowEqual.default)(node[valueKey], value);\n });\n\n if (!(0, _isUndefined2.default)(expandItemValues)) {\n return expand;\n } else if ((_node$childrenKey = node[childrenKey]) === null || _node$childrenKey === void 0 ? void 0 : _node$childrenKey.length) {\n if (!(0, _isNil2.default)(node.expand)) {\n return !!node.expand;\n } else if (expandAll) {\n return true;\n }\n\n return false;\n }\n\n return false;\n}\n/**\n * 获取拖拽节点及子节点的key\n * @param node\n * @param childrenKey\n * @param valueKey\n */\n\n\nfunction getDragNodeKeys(dragNode, childrenKey, valueKey) {\n var dragNodeKeys = [dragNode[valueKey]];\n\n var traverse = function traverse(data) {\n if ((data === null || data === void 0 ? void 0 : data.length) > 0) {\n data.forEach(function (node) {\n dragNodeKeys = dragNodeKeys.concat([node[valueKey]]);\n\n if (node[childrenKey]) {\n traverse(node[childrenKey]);\n }\n });\n }\n };\n\n traverse(dragNode[childrenKey]);\n return dragNodeKeys;\n}\n\nfunction calDropNodePosition(event, treeNodeElement) {\n var clientY = event.clientY;\n\n var _treeNodeElement$getB = treeNodeElement.getBoundingClientRect(),\n top = _treeNodeElement$getB.top,\n bottom = _treeNodeElement$getB.bottom;\n\n var gap = TREE_NODE_GAP; // 处于节点下方\n\n if (clientY >= bottom - gap && clientY <= bottom) {\n return _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_BOTTOM;\n } // 处于节点上方\n\n\n if (clientY <= top + gap && clientY >= top) {\n return _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_TOP;\n }\n\n if (clientY >= top + gap && clientY <= bottom - gap) {\n return _constants.TREE_NODE_DROP_POSITION.DRAG_OVER;\n }\n\n return -1;\n}\n\nfunction removeDragNode(data, params, _ref) {\n var valueKey = _ref.valueKey,\n childrenKey = _ref.childrenKey;\n var dragNode = params.dragNode;\n\n var traverse = function traverse(items, parent) {\n for (var _index = 0; _index < items.length; _index += 1) {\n var item = items[_index];\n\n if ((0, _shallowEqual.default)(item[valueKey], dragNode[valueKey])) {\n items.splice(_index, 1); // 当 children 为空,需要删除 children 属性,不显示角标\n\n if (items.length === 0 && parent) {\n delete parent.children;\n }\n\n break;\n }\n\n if (Array.isArray(item[childrenKey])) {\n traverse(item[childrenKey], item);\n }\n }\n };\n\n traverse(data);\n}\n/**\n * 移动节点valueKey,先删除 dragNode 原本所在的数据,再将 dragNode 移动到拖动的位置\n * @param data\n * @param params\n */\n\n\nfunction createUpdateTreeDataFunction(params, _ref2) {\n var valueKey = _ref2.valueKey,\n childrenKey = _ref2.childrenKey;\n return function (tree) {\n var data = [].concat(tree);\n var dragNode = params.dragNode,\n dropNode = params.dropNode,\n dropNodePosition = params.dropNodePosition;\n removeDragNode(data, params, {\n valueKey: valueKey,\n childrenKey: childrenKey\n });\n\n var updateTree = function updateTree(items) {\n for (var _index2 = 0; _index2 < items.length; _index2 += 1) {\n var item = items[_index2];\n\n if ((0, _shallowEqual.default)(item[valueKey], dropNode[valueKey])) {\n // 拖拽到 dropNode内,作为 dropNode 的子节点\n if (dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER) {\n item[childrenKey] = (0, _isNil2.default)(item[childrenKey]) ? [] : item[childrenKey];\n item[childrenKey].push(dragNode);\n break;\n } else if (dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_TOP) {\n // 拖拽到 dropNode 的上面\n items.splice(_index2, 0, dragNode);\n break;\n } else if (dropNodePosition === _constants.TREE_NODE_DROP_POSITION.DRAG_OVER_BOTTOM) {\n // 拖拽到 dropNode 的下面\n items.splice(_index2 + 1, 0, dragNode);\n break;\n }\n }\n\n if (Array.isArray(item[childrenKey]) && item[childrenKey].length > 0) {\n updateTree(item[childrenKey]);\n }\n }\n };\n\n updateTree(data);\n return [].concat(data);\n };\n}\n\nfunction findNodeOfTree(data, check) {\n var findNode = function findNode(nodes) {\n if (nodes === void 0) {\n nodes = [];\n }\n\n for (var i = 0; i < nodes.length; i += 1) {\n var item = nodes[i];\n\n if ((0, _isArray2.default)(item.children)) {\n var _node = findNode(item.children);\n\n if (_node) {\n return _node;\n }\n }\n\n if (check(item)) {\n return item;\n }\n }\n\n return undefined;\n };\n\n return findNode(data);\n}\n\nfunction filterNodesOfTree(data, check) {\n var findNodes = function findNodes(nodes) {\n if (nodes === void 0) {\n nodes = [];\n }\n\n var nextNodes = [];\n\n for (var i = 0; i < nodes.length; i += 1) {\n if ((0, _isArray2.default)(nodes[i].children)) {\n var nextChildren = findNodes(nodes[i].children);\n\n if (nextChildren.length) {\n var item = (0, _clone2.default)(nodes[i]);\n item.children = nextChildren;\n nextNodes.push(item);\n continue;\n }\n }\n\n if (check(nodes[i])) {\n nextNodes.push(nodes[i]);\n }\n }\n\n return nextNodes;\n };\n\n return findNodes(data);\n}\n/**\n * 根据是否处于搜索状态来返回 expand 的值。如果处于搜索状态下,则展开所有的节点\n * @param searchKeyword\n * @param expand\n */\n\n\nfunction getExpandWhenSearching(searchKeyword, expand) {\n return !(0, _isEmpty2.default)(searchKeyword) ? true : expand;\n}\n\n//# sourceURL=webpack://rsuite/./src/utils/treeUtils.ts?");
10748
10748
 
10749
10749
  /***/ }),
10750
10750