rsuite 4.10.7 → 4.10.10
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/CHANGELOG.md +29 -0
- package/dist/rsuite.js +3 -3
- package/dist/rsuite.min.js +3 -3
- package/dist/rsuite.min.js.map +1 -1
- package/es/CheckTreePicker/CheckTreePicker.js +23 -26
- package/es/SelectPicker/SelectPicker.d.ts +1 -1
- package/es/SelectPicker/SelectPicker.js +36 -35
- package/lib/CheckTreePicker/CheckTreePicker.js +23 -26
- package/lib/SelectPicker/SelectPicker.d.ts +1 -1
- package/lib/SelectPicker/SelectPicker.js +36 -35
- package/package.json +2 -2
- package/src/CheckTreePicker/CheckTreePicker.tsx +2 -3
- package/src/CheckTreePicker/test/CheckTreePickerSpec.js +42 -1
- package/src/SelectPicker/SelectPicker.d.ts +1 -1
- package/src/SelectPicker/SelectPicker.tsx +1 -1
- package/src/SelectPicker/test/SelectPickerSpec.js +67 -1
package/dist/rsuite.js
CHANGED
|
@@ -5086,7 +5086,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
|
5086
5086
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5087
5087
|
|
|
5088
5088
|
"use strict";
|
|
5089
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ \"./node_modules/rsuite-table/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/rsuite-table/node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ \"./node_modules/rsuite-table/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isFunction */ \"./node_modules/rsuite-table/node_modules/lodash/isFunction.js\");\n/* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash/flatten */ \"./node_modules/rsuite-table/node_modules/lodash/flatten.js\");\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash_flatten__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/rsuite-table/node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! lodash/isEqual */ \"./node_modules/rsuite-table/node_modules/lodash/isEqual.js\");\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(lodash_isEqual__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var lodash_eq__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! lodash/eq */ \"./node_modules/rsuite-table/node_modules/lodash/eq.js\");\n/* harmony import */ var lodash_eq__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(lodash_eq__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! lodash/omit */ \"./node_modules/rsuite-table/node_modules/lodash/omit.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/rsuite-table/node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_12__);\n/* harmony import */ var element_resize_event__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! element-resize-event */ \"./node_modules/element-resize-event/index.js\");\n/* harmony import */ var element_resize_event__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(element_resize_event__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var dom_lib_lib_transition_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! dom-lib/lib/transition/translateDOMPositionXY */ \"./node_modules/dom-lib/lib/transition/translateDOMPositionXY.js\");\n/* harmony import */ var dom_lib_lib_transition_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(dom_lib_lib_transition_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_14__);\n/* harmony import */ var dom_lib__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! dom-lib */ \"./node_modules/dom-lib/es/index.js\");\n/* harmony import */ var _Row__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Row */ \"./node_modules/rsuite-table/es/Row.js\");\n/* harmony import */ var _CellGroup__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./CellGroup */ \"./node_modules/rsuite-table/es/CellGroup.js\");\n/* harmony import */ var _Scrollbar__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Scrollbar */ \"./node_modules/rsuite-table/es/Scrollbar.js\");\n/* harmony import */ var _TableContext__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./TableContext */ \"./node_modules/rsuite-table/es/TableContext.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./utils */ \"./node_modules/rsuite-table/es/utils/index.js\");\n/* harmony import */ var _ColumnGroup__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ColumnGroup */ \"./node_modules/rsuite-table/es/ColumnGroup.js\");\n/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! react-is */ \"./node_modules/rsuite-table/node_modules/react-is/index.js\");\n/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(react_is__WEBPACK_IMPORTED_MODULE_23__);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar SORT_TYPE = {\n DESC: 'desc',\n ASC: 'asc'\n};\nvar propTypes = {\n autoHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n affixHeader: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number]),\n affixHorizontalScrollbar: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number]),\n bordered: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n bodyRef: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n className: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string,\n classPrefix: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string,\n children: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.any,\n cellBordered: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n data: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.object),\n defaultExpandAllRows: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n defaultExpandedRowKeys: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number])),\n defaultSortType: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string]),\n disabledScroll: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n expandedRowKeys: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number])),\n hover: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n height: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n headerHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n locale: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.object,\n loading: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n loadAnimation: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n minHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n rowKey: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number]),\n rowHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func]),\n renderTreeToggle: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n renderRowExpanded: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n rowExpandedHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n renderEmpty: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n renderLoading: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n rowClassName: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string]),\n rtl: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n style: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.object,\n sortColumn: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string,\n sortType: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string]),\n showHeader: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n shouldUpdateScroll: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n translate3d: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n wordWrap: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n width: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n virtualized: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n isTree: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n onRowClick: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onRowContextMenu: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onScroll: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onSortColumn: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onExpandChange: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onTouchStart: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onTouchMove: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onDataUpdated: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func\n};\n\nvar Table = /*#__PURE__*/function (_React$Component) {\n Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(Table, _React$Component);\n\n Table.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {\n if (props.data !== state.cacheData || props.isTree !== state.isTree) {\n return {\n cacheData: props.data,\n isTree: props.isTree,\n data: props.isTree ? Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"flattenData\"])(props.data) : props.data\n };\n }\n\n return null;\n };\n\n function Table(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.translateDOMPositionXY = null;\n _this.scrollListener = null;\n _this.tableRef = void 0;\n _this.scrollbarYRef = void 0;\n _this.scrollbarXRef = void 0;\n _this.tableBodyRef = void 0;\n _this.affixHeaderWrapperRef = void 0;\n _this.mouseAreaRef = void 0;\n _this.headerWrapperRef = void 0;\n _this.tableHeaderRef = void 0;\n _this.wheelWrapperRef = void 0;\n _this.tableRows = {};\n _this.mounted = false;\n _this.disableEventsTimeoutId = null;\n _this.scrollY = 0;\n _this.scrollX = 0;\n _this.wheelHandler = void 0;\n _this.minScrollY = void 0;\n _this.minScrollX = void 0;\n _this.mouseArea = void 0;\n _this.touchX = void 0;\n _this.touchY = void 0;\n _this.wheelListener = void 0;\n _this.touchStartListener = void 0;\n _this.touchMoveListener = void 0;\n _this._cacheCells = null;\n _this._cacheChildrenSize = 0;\n _this._visibleRows = [];\n\n _this.listenWheel = function (deltaX, deltaY) {\n var _this$scrollbarXRef$c, _this$scrollbarXRef$c2, _this$scrollbarYRef$c, _this$scrollbarYRef$c2;\n\n _this.handleWheel(deltaX, deltaY);\n\n (_this$scrollbarXRef$c = _this.scrollbarXRef.current) === null || _this$scrollbarXRef$c === void 0 ? void 0 : (_this$scrollbarXRef$c2 = _this$scrollbarXRef$c.onWheelScroll) === null || _this$scrollbarXRef$c2 === void 0 ? void 0 : _this$scrollbarXRef$c2.call(_this$scrollbarXRef$c, deltaX);\n (_this$scrollbarYRef$c = _this.scrollbarYRef.current) === null || _this$scrollbarYRef$c === void 0 ? void 0 : (_this$scrollbarYRef$c2 = _this$scrollbarYRef$c.onWheelScroll) === null || _this$scrollbarYRef$c2 === void 0 ? void 0 : _this$scrollbarYRef$c2.call(_this$scrollbarYRef$c, deltaY);\n };\n\n _this.setOffsetByAffix = function () {\n var _this$headerWrapperRe, _this$tableRef;\n\n var _this$props = _this.props,\n affixHeader = _this$props.affixHeader,\n affixHorizontalScrollbar = _this$props.affixHorizontalScrollbar;\n var headerNode = (_this$headerWrapperRe = _this.headerWrapperRef) === null || _this$headerWrapperRe === void 0 ? void 0 : _this$headerWrapperRe.current;\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHeader) && headerNode) {\n _this.setState(function () {\n return {\n headerOffset: Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getOffset\"])(headerNode)\n };\n });\n }\n\n var tableNode = (_this$tableRef = _this.tableRef) === null || _this$tableRef === void 0 ? void 0 : _this$tableRef.current;\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHorizontalScrollbar) && tableNode) {\n _this.setState(function () {\n return {\n tableOffset: Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getOffset\"])(tableNode)\n };\n });\n }\n };\n\n _this.handleWindowScroll = function () {\n var _this$props2 = _this.props,\n affixHeader = _this$props2.affixHeader,\n affixHorizontalScrollbar = _this$props2.affixHorizontalScrollbar;\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHeader)) {\n _this.affixTableHeader();\n }\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHorizontalScrollbar)) {\n _this.affixHorizontalScrollbar();\n }\n };\n\n _this.affixHorizontalScrollbar = function () {\n var _this$scrollbarXRef, _this$scrollbarXRef$c3, _this$scrollbarXRef$c4;\n\n var scrollY = window.scrollY || window.pageYOffset;\n var windowHeight = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getHeight\"])(window);\n\n var height = _this.getTableHeight();\n\n var _this$state = _this.state,\n tableOffset = _this$state.tableOffset,\n fixedHorizontalScrollbar = _this$state.fixedHorizontalScrollbar;\n var affixHorizontalScrollbar = _this.props.affixHorizontalScrollbar;\n\n var headerHeight = _this.getTableHeaderHeight();\n\n var bottom = typeof affixHorizontalScrollbar === 'number' ? affixHorizontalScrollbar : 0;\n var fixedScrollbar = scrollY + windowHeight < height + (tableOffset.top + bottom) && scrollY + windowHeight - headerHeight > tableOffset.top + bottom;\n\n if ((_this$scrollbarXRef = _this.scrollbarXRef) !== null && _this$scrollbarXRef !== void 0 && (_this$scrollbarXRef$c3 = _this$scrollbarXRef.current) !== null && _this$scrollbarXRef$c3 !== void 0 && (_this$scrollbarXRef$c4 = _this$scrollbarXRef$c3.barRef) !== null && _this$scrollbarXRef$c4 !== void 0 && _this$scrollbarXRef$c4.current && fixedHorizontalScrollbar !== fixedScrollbar) {\n _this.setState({\n fixedHorizontalScrollbar: fixedScrollbar\n });\n }\n };\n\n _this.affixTableHeader = function () {\n var affixHeader = _this.props.affixHeader;\n var top = typeof affixHeader === 'number' ? affixHeader : 0;\n var _this$state2 = _this.state,\n headerOffset = _this$state2.headerOffset,\n contentHeight = _this$state2.contentHeight;\n var scrollY = window.scrollY || window.pageYOffset;\n var fixedHeader = scrollY - (headerOffset.top - top) >= 0 && scrollY < headerOffset.top - top + contentHeight;\n\n if (_this.affixHeaderWrapperRef.current) {\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"toggleClass\"])(_this.affixHeaderWrapperRef.current, 'fixed', fixedHeader);\n }\n };\n\n _this.handleSortColumn = function (dataKey) {\n var _this$props$onSortCol, _this$props3;\n\n var sortType = _this.getSortType();\n\n if (_this.props.sortColumn === dataKey) {\n sortType = sortType === SORT_TYPE.ASC ? SORT_TYPE.DESC : SORT_TYPE.ASC;\n\n _this.setState({\n sortType: sortType\n });\n }\n\n (_this$props$onSortCol = (_this$props3 = _this.props).onSortColumn) === null || _this$props$onSortCol === void 0 ? void 0 : _this$props$onSortCol.call(_this$props3, dataKey, sortType);\n };\n\n _this.handleColumnResizeEnd = function (columnWidth, _cursorDelta, dataKey, index) {\n var _this$setState;\n\n _this._cacheCells = null;\n\n _this.setState((_this$setState = {\n isColumnResizing: false\n }, _this$setState[dataKey + \"_\" + index + \"_width\"] = columnWidth, _this$setState));\n\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(_this.mouseAreaRef.current, {\n display: 'none'\n });\n };\n\n _this.handleColumnResizeStart = function (width, left, fixed) {\n _this.setState({\n isColumnResizing: true\n });\n\n _this.handleColumnResizeMove(width, left, fixed);\n };\n\n _this.handleColumnResizeMove = function (width, left, fixed) {\n var _addStyle;\n\n var mouseAreaLeft = width + left;\n var x = mouseAreaLeft;\n var dir = 'left';\n\n if (_this.isRTL()) {\n mouseAreaLeft += _this.minScrollX + _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"];\n dir = 'right';\n }\n\n if (!fixed) {\n x = mouseAreaLeft + (_this.isRTL() ? -_this.scrollX : _this.scrollX);\n }\n\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(_this.mouseAreaRef.current, (_addStyle = {\n display: 'block'\n }, _addStyle[dir] = x + \"px\", _addStyle));\n };\n\n _this.handleTreeToggle = function (rowKey, _rowIndex, rowData) {\n var _this$props$onExpandC, _this$props4;\n\n var expandedRowKeys = _this.getExpandedRowKeys();\n\n var open = false;\n var nextExpandedRowKeys = [];\n\n for (var i = 0; i < expandedRowKeys.length; i++) {\n var _key = expandedRowKeys[i];\n\n if (_key === rowKey) {\n open = true;\n } else {\n nextExpandedRowKeys.push(_key);\n }\n }\n\n if (!open) {\n nextExpandedRowKeys.push(rowKey);\n }\n\n _this.setState({\n expandedRowKeys: nextExpandedRowKeys\n });\n\n (_this$props$onExpandC = (_this$props4 = _this.props).onExpandChange) === null || _this$props$onExpandC === void 0 ? void 0 : _this$props$onExpandC.call(_this$props4, !open, rowData);\n };\n\n _this.handleScrollX = function (delta) {\n _this.handleWheel(delta, 0);\n };\n\n _this.handleScrollY = function (delta) {\n _this.handleWheel(0, delta);\n };\n\n _this.handleWheel = function (deltaX, deltaY) {\n var _this$props5 = _this.props,\n onScroll = _this$props5.onScroll,\n virtualized = _this$props5.virtualized;\n var _this$state3 = _this.state,\n contentWidth = _this$state3.contentWidth,\n width = _this$state3.width;\n\n if (!_this.tableRef.current) {\n return;\n }\n\n var nextScrollX = contentWidth <= width ? 0 : _this.scrollX - deltaX;\n var nextScrollY = _this.scrollY - deltaY;\n _this.scrollY = Math.min(0, nextScrollY < _this.minScrollY ? _this.minScrollY : nextScrollY);\n _this.scrollX = Math.min(0, nextScrollX < _this.minScrollX ? _this.minScrollX : nextScrollX);\n\n _this.updatePosition();\n\n onScroll === null || onScroll === void 0 ? void 0 : onScroll(_this.scrollX, _this.scrollY);\n\n if (virtualized) {\n _this.setState({\n isScrolling: true,\n scrollY: _this.scrollY\n });\n\n if (_this.disableEventsTimeoutId) {\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"cancelAnimationTimeout\"])(_this.disableEventsTimeoutId);\n }\n\n _this.disableEventsTimeoutId = Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"requestAnimationTimeout\"])(_this.debounceScrollEndedCallback, 150);\n }\n };\n\n _this.debounceScrollEndedCallback = function () {\n _this.disableEventsTimeoutId = null;\n\n _this.setState({\n isScrolling: false\n });\n };\n\n _this.handleTouchStart = function (event) {\n var _this$props$onTouchSt, _this$props6;\n\n if (event.touches) {\n var _event$touches$ = event.touches[0],\n pageX = _event$touches$.pageX,\n pageY = _event$touches$.pageY;\n _this.touchX = pageX;\n _this.touchY = pageY;\n }\n\n (_this$props$onTouchSt = (_this$props6 = _this.props).onTouchStart) === null || _this$props$onTouchSt === void 0 ? void 0 : _this$props$onTouchSt.call(_this$props6, event);\n };\n\n _this.handleTouchMove = function (event) {\n var _this$props$onTouchMo, _this$props7;\n\n var autoHeight = _this.props.autoHeight;\n\n if (event.touches) {\n var _event$preventDefault, _this$scrollbarXRef$c5, _this$scrollbarXRef$c6, _this$scrollbarYRef$c3, _this$scrollbarYRef$c4;\n\n var _event$touches$2 = event.touches[0],\n pageX = _event$touches$2.pageX,\n pageY = _event$touches$2.pageY;\n var deltaX = _this.touchX - pageX;\n var deltaY = autoHeight ? 0 : _this.touchY - pageY;\n\n if (!_this.shouldHandleWheelY(deltaY) && !_this.shouldHandleWheelX(deltaX)) {\n return;\n }\n\n (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);\n\n _this.handleWheel(deltaX, deltaY);\n\n (_this$scrollbarXRef$c5 = _this.scrollbarXRef.current) === null || _this$scrollbarXRef$c5 === void 0 ? void 0 : (_this$scrollbarXRef$c6 = _this$scrollbarXRef$c5.onWheelScroll) === null || _this$scrollbarXRef$c6 === void 0 ? void 0 : _this$scrollbarXRef$c6.call(_this$scrollbarXRef$c5, deltaX);\n (_this$scrollbarYRef$c3 = _this.scrollbarYRef.current) === null || _this$scrollbarYRef$c3 === void 0 ? void 0 : (_this$scrollbarYRef$c4 = _this$scrollbarYRef$c3.onWheelScroll) === null || _this$scrollbarYRef$c4 === void 0 ? void 0 : _this$scrollbarYRef$c4.call(_this$scrollbarYRef$c3, deltaY);\n _this.touchX = pageX;\n _this.touchY = pageY;\n }\n\n (_this$props$onTouchMo = (_this$props7 = _this.props).onTouchMove) === null || _this$props$onTouchMo === void 0 ? void 0 : _this$props$onTouchMo.call(_this$props7, event);\n };\n\n _this.handleBodyScroll = function (event) {\n if (event.target !== _this.tableBodyRef.current) {\n return;\n }\n\n var left = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"scrollLeft\"])(event.target);\n var top = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"scrollTop\"])(event.target);\n\n if (top === 0 && left === 0) {\n return;\n }\n\n _this.listenWheel(left, top);\n\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"scrollLeft\"])(event.target, 0);\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"scrollTop\"])(event.target, 0);\n };\n\n _this.shouldHandleWheelX = function (delta) {\n var _this$props8 = _this.props,\n disabledScroll = _this$props8.disabledScroll,\n loading = _this$props8.loading;\n\n if (delta === 0 || disabledScroll || loading) {\n return false;\n }\n\n return true;\n };\n\n _this.shouldHandleWheelY = function (delta) {\n var _this$props9 = _this.props,\n disabledScroll = _this$props9.disabledScroll,\n loading = _this$props9.loading;\n\n if (delta === 0 || disabledScroll || loading) {\n return false;\n }\n\n return delta >= 0 && _this.scrollY > _this.minScrollY || delta < 0 && _this.scrollY < 0;\n };\n\n _this.addPrefix = function (name) {\n return Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"prefix\"])(_this.props.classPrefix)(name);\n };\n\n _this.calculateTableWidth = function () {\n var _this$tableRef2;\n\n var table = (_this$tableRef2 = _this.tableRef) === null || _this$tableRef2 === void 0 ? void 0 : _this$tableRef2.current;\n var width = _this.state.width;\n\n if (table) {\n var nextWidth = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getWidth\"])(table);\n\n if (width !== nextWidth) {\n var _this$scrollbarXRef2, _this$scrollbarXRef2$;\n\n _this.scrollX = 0;\n (_this$scrollbarXRef2 = _this.scrollbarXRef) === null || _this$scrollbarXRef2 === void 0 ? void 0 : (_this$scrollbarXRef2$ = _this$scrollbarXRef2.current) === null || _this$scrollbarXRef2$ === void 0 ? void 0 : _this$scrollbarXRef2$.resetScrollBarPosition();\n }\n\n _this._cacheCells = null;\n\n _this.setState({\n width: nextWidth\n });\n }\n\n _this.setOffsetByAffix();\n };\n\n _this.scrollTop = function (top) {\n var _this$scrollbarYRef, _this$scrollbarYRef$c5, _this$scrollbarYRef$c6;\n\n if (top === void 0) {\n top = 0;\n }\n\n var _this$getControlledSc = _this.getControlledScrollTopValue(top),\n scrollY = _this$getControlledSc[0],\n handleScrollY = _this$getControlledSc[1];\n\n _this.scrollY = scrollY;\n (_this$scrollbarYRef = _this.scrollbarYRef) === null || _this$scrollbarYRef === void 0 ? void 0 : (_this$scrollbarYRef$c5 = _this$scrollbarYRef.current) === null || _this$scrollbarYRef$c5 === void 0 ? void 0 : (_this$scrollbarYRef$c6 = _this$scrollbarYRef$c5.resetScrollBarPosition) === null || _this$scrollbarYRef$c6 === void 0 ? void 0 : _this$scrollbarYRef$c6.call(_this$scrollbarYRef$c5, handleScrollY);\n\n _this.updatePosition();\n /**\n * 当开启 virtualized,调用 scrollTop 后会出现白屏现象,\n * 原因是直接操作 DOM 的坐标,但是组件没有重新渲染,需要调用 forceUpdate 重新进入 render。\n * Fix: rsuite#1044\n */\n\n\n if (_this.props.virtualized && _this.state.contentHeight > _this.props.height) {\n _this.forceUpdate();\n }\n };\n\n _this.scrollLeft = function (left) {\n var _this$scrollbarXRef3, _this$scrollbarXRef3$, _this$scrollbarXRef3$2;\n\n if (left === void 0) {\n left = 0;\n }\n\n var _this$getControlledSc2 = _this.getControlledScrollLeftValue(left),\n scrollX = _this$getControlledSc2[0],\n handleScrollX = _this$getControlledSc2[1];\n\n _this.scrollX = scrollX;\n (_this$scrollbarXRef3 = _this.scrollbarXRef) === null || _this$scrollbarXRef3 === void 0 ? void 0 : (_this$scrollbarXRef3$ = _this$scrollbarXRef3.current) === null || _this$scrollbarXRef3$ === void 0 ? void 0 : (_this$scrollbarXRef3$2 = _this$scrollbarXRef3$.resetScrollBarPosition) === null || _this$scrollbarXRef3$2 === void 0 ? void 0 : _this$scrollbarXRef3$2.call(_this$scrollbarXRef3$, handleScrollX);\n\n _this.updatePosition();\n };\n\n _this.scrollTo = function (coord) {\n var _ref = coord || {},\n x = _ref.x,\n y = _ref.y;\n\n if (typeof x === 'number') {\n _this.scrollLeft(x);\n }\n\n if (typeof y === 'number') {\n _this.scrollTop(y);\n }\n };\n\n _this.bindTableRowsRef = function (index, rowData) {\n return function (ref) {\n if (ref) {\n _this.tableRows[index] = [ref, rowData];\n }\n };\n };\n\n _this.bindRowClick = function (rowData) {\n return function (event) {\n var _this$props$onRowClic, _this$props10;\n\n (_this$props$onRowClic = (_this$props10 = _this.props).onRowClick) === null || _this$props$onRowClic === void 0 ? void 0 : _this$props$onRowClic.call(_this$props10, rowData, event);\n };\n };\n\n _this.bindRowContextMenu = function (rowData) {\n return function (event) {\n var _this$props$onRowCont, _this$props11;\n\n (_this$props$onRowCont = (_this$props11 = _this.props).onRowContextMenu) === null || _this$props$onRowCont === void 0 ? void 0 : _this$props$onRowCont.call(_this$props11, rowData, event);\n };\n };\n\n var _width = props.width,\n data = props.data,\n _rowKey = props.rowKey,\n defaultExpandAllRows = props.defaultExpandAllRows,\n renderRowExpanded = props.renderRowExpanded,\n defaultExpandedRowKeys = props.defaultExpandedRowKeys,\n _props$children = props.children,\n children = _props$children === void 0 ? [] : _props$children,\n isTree = props.isTree,\n defaultSortType = props.defaultSortType;\n\n var _expandedRowKeys = defaultExpandAllRows ? Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"findRowKeys\"])(data, _rowKey, lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(renderRowExpanded)) : defaultExpandedRowKeys || [];\n\n var shouldFixedColumn = Array.from(lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(children)).some(function (child) {\n return child && child.props && child.props.fixed;\n });\n\n if (isTree && !_rowKey) {\n throw new Error('The `rowKey` is required when set isTree');\n }\n\n _this.state = {\n isTree: isTree,\n expandedRowKeys: _expandedRowKeys,\n shouldFixedColumn: shouldFixedColumn,\n cacheData: data,\n data: isTree ? Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"flattenData\"])(data) : data,\n width: _width || 0,\n columnWidth: 0,\n dataKey: 0,\n contentHeight: 0,\n contentWidth: 0,\n tableRowsMaxHeight: [],\n sortType: defaultSortType,\n scrollY: 0,\n isScrolling: false,\n fixedHeader: false\n };\n _this.scrollY = 0;\n _this.scrollX = 0;\n _this.wheelHandler = new dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"WheelHandler\"](_this.listenWheel, _this.shouldHandleWheelX, _this.shouldHandleWheelY, false);\n _this._cacheChildrenSize = lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(children).length;\n _this.translateDOMPositionXY = Object(dom_lib_lib_transition_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_14__[\"getTranslateDOMPositionXY\"])({\n enable3DTransform: props.translate3d\n });\n _this.tableRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.scrollbarYRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.scrollbarXRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.tableBodyRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.affixHeaderWrapperRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.mouseAreaRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.headerWrapperRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.wheelWrapperRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.tableHeaderRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n return _this;\n }\n\n var _proto = Table.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n var _this$props13, _this$props13$bodyRef;\n\n this.calculateTableWidth();\n this.calculateTableContextHeight();\n this.calculateRowMaxHeight();\n this.setOffsetByAffix();\n this.initPosition();\n element_resize_event__WEBPACK_IMPORTED_MODULE_13___default()(this.tableRef.current, lodash_debounce__WEBPACK_IMPORTED_MODULE_8___default()(this.calculateTableWidth, 400));\n var options = {\n passive: false\n };\n var tableBody = this.tableBodyRef.current;\n\n if (tableBody) {\n this.wheelListener = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"on\"])(tableBody, 'wheel', this.wheelHandler.onWheel, options);\n this.touchStartListener = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"on\"])(tableBody, 'touchstart', this.handleTouchStart, options);\n this.touchMoveListener = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"on\"])(tableBody, 'touchmove', this.handleTouchMove, options);\n }\n\n var _this$props12 = this.props,\n affixHeader = _this$props12.affixHeader,\n affixHorizontalScrollbar = _this$props12.affixHorizontalScrollbar;\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHeader) || Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHorizontalScrollbar)) {\n this.scrollListener = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"on\"])(window, 'scroll', this.handleWindowScroll);\n }\n\n (_this$props13 = this.props) === null || _this$props13 === void 0 ? void 0 : (_this$props13$bodyRef = _this$props13.bodyRef) === null || _this$props13$bodyRef === void 0 ? void 0 : _this$props13$bodyRef.call(_this$props13, this.wheelWrapperRef.current);\n };\n\n _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {\n var _cacheChildrenSize = lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(nextProps.children || []).length;\n /**\n * 单元格列的信息在初始化后会被缓存,在某些属性被更新以后,需要清除缓存。\n */\n\n if (_cacheChildrenSize !== this._cacheChildrenSize) {\n this._cacheChildrenSize = _cacheChildrenSize;\n this._cacheCells = null;\n } else if (this.props.children !== nextProps.children || this.props.sortColumn !== nextProps.sortColumn || this.props.sortType !== nextProps.sortType) {\n this._cacheCells = null;\n }\n\n return !lodash_eq__WEBPACK_IMPORTED_MODULE_10___default()(this.props, nextProps) || !lodash_isEqual__WEBPACK_IMPORTED_MODULE_9___default()(this.state, nextState);\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n var rowHeight = prevProps.rowHeight,\n data = prevProps.data,\n height = prevProps.height;\n\n if (data !== this.props.data) {\n var _this$props$onDataUpd, _this$props14;\n\n this.calculateRowMaxHeight();\n (_this$props$onDataUpd = (_this$props14 = this.props).onDataUpdated) === null || _this$props$onDataUpd === void 0 ? void 0 : _this$props$onDataUpd.call(_this$props14, this.props.data, this.scrollTo);\n var maxHeight = this.props.data.length * (typeof rowHeight === 'function' ? rowHeight(null) : rowHeight); // 当开启允许更新滚动条,或者滚动条位置大于表格的最大高度,则初始滚动条位置\n\n if (this.props.shouldUpdateScroll || Math.abs(this.scrollY) > maxHeight) {\n this.scrollTo({\n x: 0,\n y: 0\n });\n }\n } else {\n this.updatePosition();\n }\n\n if ( // 当 Table 的 data 发生变化,需要重新计算高度\n data !== this.props.data || // 当 Table 的 height 属性发生变化,需要重新计算 Table 高度\n height !== this.props.height || // 当 Table 内容区的高度发生变化需要重新计算\n prevState.contentHeight !== this.state.contentHeight || // 当 expandedRowKeys 发生变化,需要重新计算 Table 高度,如果重算会导致滚动条不显示。\n prevState.expandedRowKeys !== this.state.expandedRowKeys || prevProps.expandedRowKeys !== this.props.expandedRowKeys) {\n this.calculateTableContextHeight(prevProps);\n }\n\n this.calculateTableContentWidth(prevProps);\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n var _this$wheelListener, _this$touchStartListe, _this$touchMoveListen, _this$scrollListener;\n\n this.wheelHandler = null;\n\n if (this.tableRef.current) {\n Object(element_resize_event__WEBPACK_IMPORTED_MODULE_13__[\"unbind\"])(this.tableRef.current);\n }\n\n (_this$wheelListener = this.wheelListener) === null || _this$wheelListener === void 0 ? void 0 : _this$wheelListener.off();\n (_this$touchStartListe = this.touchStartListener) === null || _this$touchStartListe === void 0 ? void 0 : _this$touchStartListe.off();\n (_this$touchMoveListen = this.touchMoveListener) === null || _this$touchMoveListen === void 0 ? void 0 : _this$touchMoveListen.off();\n (_this$scrollListener = this.scrollListener) === null || _this$scrollListener === void 0 ? void 0 : _this$scrollListener.off();\n };\n\n _proto.getExpandedRowKeys = function getExpandedRowKeys() {\n var expandedRowKeys = this.props.expandedRowKeys;\n return typeof expandedRowKeys === 'undefined' ? this.state.expandedRowKeys : expandedRowKeys;\n };\n\n _proto.getSortType = function getSortType() {\n var sortType = this.props.sortType;\n return typeof sortType === 'undefined' ? this.state.sortType : sortType;\n };\n\n _proto.getScrollCellGroups = function getScrollCellGroups() {\n var _this$tableRef$curren;\n\n return (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.querySelectorAll(\".\" + this.addPrefix('cell-group-scroll'));\n };\n\n _proto.getFixedLeftCellGroups = function getFixedLeftCellGroups() {\n var _this$tableRef$curren2;\n\n return (_this$tableRef$curren2 = this.tableRef.current) === null || _this$tableRef$curren2 === void 0 ? void 0 : _this$tableRef$curren2.querySelectorAll(\".\" + this.addPrefix('cell-group-fixed-left'));\n };\n\n _proto.getFixedRightCellGroups = function getFixedRightCellGroups() {\n var _this$tableRef$curren3;\n\n return (_this$tableRef$curren3 = this.tableRef.current) === null || _this$tableRef$curren3 === void 0 ? void 0 : _this$tableRef$curren3.querySelectorAll(\".\" + this.addPrefix('cell-group-fixed-right'));\n };\n\n _proto.isRTL = function isRTL() {\n return this.props.rtl || Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isRTL\"])();\n };\n\n _proto.getRowHeight = function getRowHeight(rowData) {\n if (rowData === void 0) {\n rowData = {};\n }\n\n var rowHeight = this.props.rowHeight;\n return typeof rowHeight === 'function' ? rowHeight(rowData) : rowHeight;\n }\n /**\n * 获取表头高度\n */\n ;\n\n _proto.getTableHeaderHeight = function getTableHeaderHeight() {\n var _this$props15 = this.props,\n headerHeight = _this$props15.headerHeight,\n showHeader = _this$props15.showHeader;\n return showHeader ? headerHeight : 0;\n }\n /**\n * 获取 Table 需要渲染的高度\n */\n ;\n\n _proto.getTableHeight = function getTableHeight() {\n var contentHeight = this.state.contentHeight;\n var _this$props16 = this.props,\n minHeight = _this$props16.minHeight,\n height = _this$props16.height,\n autoHeight = _this$props16.autoHeight,\n data = _this$props16.data;\n var headerHeight = this.getTableHeaderHeight();\n\n if (data.length === 0 && autoHeight) {\n return height;\n }\n\n return autoHeight ? Math.max(headerHeight + contentHeight, minHeight) : height;\n }\n /**\n * 获取 columns ReactElement 数组\n * - 处理 children 中存在 <Column> 数组的情况\n * - 过滤 children 中的空项\n */\n ;\n\n _proto.getTableColumns = function getTableColumns(children) {\n if (!Array.isArray(children)) {\n if (Object(react_is__WEBPACK_IMPORTED_MODULE_23__[\"isFragment\"])(children)) {\n return this.getTableColumns(children.props.children);\n }\n\n return children;\n }\n\n var flattenColumns = lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(children).map(function (column) {\n if ((column === null || column === void 0 ? void 0 : column.type) === _ColumnGroup__WEBPACK_IMPORTED_MODULE_22__[\"default\"]) {\n var _column$props = column === null || column === void 0 ? void 0 : column.props,\n header = _column$props.header,\n childColumns = _column$props.children,\n align = _column$props.align,\n fixed = _column$props.fixed,\n verticalAlign = _column$props.verticalAlign;\n\n return childColumns.map(function (childColumn, index) {\n // 把 ColumnGroup 设置的属性覆盖到 Column\n var groupCellProps = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, childColumn === null || childColumn === void 0 ? void 0 : childColumn.props, {\n align: align,\n fixed: fixed,\n verticalAlign: verticalAlign\n });\n /**\n * 为分组中的第一列设置属性:\n * groupCount: 分组子项个数\n * groupHeader: 分组标题\n * resizable: 设置为不可自定义列宽\n */\n\n\n if (index === 0) {\n groupCellProps.groupCount = childColumns.length;\n groupCellProps.groupHeader = header;\n groupCellProps.resizable = false;\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"cloneElement\"](childColumn, groupCellProps);\n });\n }\n\n return column;\n }); // 把 Columns 中的数组,展平为一维数组,计算 lastColumn 与 firstColumn。\n\n return lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(flattenColumns).filter(function (col) {\n return col;\n });\n };\n\n _proto.getCellDescriptor = function getCellDescriptor() {\n var _this2 = this;\n\n if (this._cacheCells) {\n return this._cacheCells;\n }\n\n var hasCustomTreeCol = false;\n var left = 0; // Cell left margin\n\n var headerCells = []; // Table header cell\n\n var bodyCells = []; // Table body cell\n\n var children = this.props.children;\n\n if (!children) {\n this._cacheCells = {\n headerCells: headerCells,\n bodyCells: bodyCells,\n hasCustomTreeCol: hasCustomTreeCol,\n allColumnsWidth: left\n };\n return this._cacheCells;\n }\n\n var columns = this.getTableColumns(children);\n var tableWidth = this.state.width;\n var _this$props17 = this.props,\n sortColumn = _this$props17.sortColumn,\n rowHeight = _this$props17.rowHeight,\n showHeader = _this$props17.showHeader;\n\n var _getTotalByColumns = Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"getTotalByColumns\"])(columns),\n totalFlexGrow = _getTotalByColumns.totalFlexGrow,\n totalWidth = _getTotalByColumns.totalWidth;\n\n var headerHeight = this.getTableHeaderHeight();\n react__WEBPACK_IMPORTED_MODULE_3__[\"Children\"].forEach(columns, function (column, index) {\n if ( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"isValidElement\"](column)) {\n var columnChildren = column.props.children;\n var _column$props2 = column.props,\n width = _column$props2.width,\n resizable = _column$props2.resizable,\n flexGrow = _column$props2.flexGrow,\n minWidth = _column$props2.minWidth,\n onResize = _column$props2.onResize,\n treeCol = _column$props2.treeCol;\n\n if (treeCol) {\n hasCustomTreeCol = true;\n }\n\n if (resizable && flexGrow) {\n console.warn(\"Cannot set 'resizable' and 'flexGrow' together in <Column>, column index: \" + index);\n }\n\n if (columnChildren.length !== 2) {\n throw new Error(\"Component <HeaderCell> and <Cell> is required, column index: \" + index + \" \");\n }\n\n var nextWidth = _this2.state[columnChildren[1].props.dataKey + \"_\" + index + \"_width\"] || width || 0;\n\n if (tableWidth && flexGrow && totalFlexGrow) {\n nextWidth = Math.max((tableWidth - totalWidth) / totalFlexGrow * flexGrow, minWidth || 60);\n }\n\n var cellProps = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, lodash_omit__WEBPACK_IMPORTED_MODULE_11___default()(column.props, ['children']), {\n 'aria-colindex': index + 1,\n left: left,\n headerHeight: headerHeight,\n key: index,\n width: nextWidth,\n height: rowHeight,\n firstColumn: index === 0,\n lastColumn: index === columns.length - 1\n });\n\n if (showHeader && headerHeight) {\n var headerCellProps = {\n // index 用于拖拽列宽时候(Resizable column),定义的序号\n index: index,\n dataKey: columnChildren[1].props.dataKey,\n isHeaderCell: true,\n sortable: column.props.sortable,\n onSortColumn: _this2.handleSortColumn,\n sortType: _this2.getSortType(),\n sortColumn: sortColumn,\n flexGrow: flexGrow\n };\n\n if (resizable) {\n lodash_merge__WEBPACK_IMPORTED_MODULE_12___default()(headerCellProps, {\n onResize: onResize,\n onColumnResizeEnd: _this2.handleColumnResizeEnd,\n onColumnResizeStart: _this2.handleColumnResizeStart,\n onColumnResizeMove: _this2.handleColumnResizeMove\n });\n }\n\n headerCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"cloneElement\"](columnChildren[0], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, cellProps, headerCellProps)));\n }\n\n bodyCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"cloneElement\"](columnChildren[1], cellProps));\n left += nextWidth;\n }\n });\n return this._cacheCells = {\n headerCells: headerCells,\n bodyCells: bodyCells,\n allColumnsWidth: left,\n hasCustomTreeCol: hasCustomTreeCol\n };\n };\n\n _proto.initPosition = function initPosition() {\n var _this3 = this;\n\n if (this.isRTL()) {\n setTimeout(function () {\n var _this3$scrollbarXRef, _this3$scrollbarXRef$, _this3$scrollbarXRef$2;\n\n var _this3$state = _this3.state,\n contentWidth = _this3$state.contentWidth,\n width = _this3$state.width;\n _this3.scrollX = width - contentWidth - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"];\n\n _this3.updatePosition();\n\n (_this3$scrollbarXRef = _this3.scrollbarXRef) === null || _this3$scrollbarXRef === void 0 ? void 0 : (_this3$scrollbarXRef$ = _this3$scrollbarXRef.current) === null || _this3$scrollbarXRef$ === void 0 ? void 0 : (_this3$scrollbarXRef$2 = _this3$scrollbarXRef$.resetScrollBarPosition) === null || _this3$scrollbarXRef$2 === void 0 ? void 0 : _this3$scrollbarXRef$2.call(_this3$scrollbarXRef$, -_this3.scrollX);\n }, 0);\n }\n };\n\n _proto.updatePosition = function updatePosition() {\n var _this$tableHeaderRef;\n\n /**\n * 当存在锁定列情况处理\n */\n if (this.state.shouldFixedColumn) {\n this.updatePositionByFixedCell();\n } else {\n var _this$wheelWrapperRef, _this$headerWrapperRe2, _this$affixHeaderWrap, _affixHeaderElement$h;\n\n var wheelStyle = {};\n var headerStyle = {};\n this.translateDOMPositionXY(wheelStyle, this.scrollX, this.scrollY);\n this.translateDOMPositionXY(headerStyle, this.scrollX, 0);\n var wheelElement = (_this$wheelWrapperRef = this.wheelWrapperRef) === null || _this$wheelWrapperRef === void 0 ? void 0 : _this$wheelWrapperRef.current;\n var headerElement = (_this$headerWrapperRe2 = this.headerWrapperRef) === null || _this$headerWrapperRe2 === void 0 ? void 0 : _this$headerWrapperRe2.current;\n var affixHeaderElement = (_this$affixHeaderWrap = this.affixHeaderWrapperRef) === null || _this$affixHeaderWrap === void 0 ? void 0 : _this$affixHeaderWrap.current;\n wheelElement && Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(wheelElement, wheelStyle);\n headerElement && Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(headerElement, headerStyle);\n\n if (affixHeaderElement !== null && affixHeaderElement !== void 0 && (_affixHeaderElement$h = affixHeaderElement.hasChildNodes) !== null && _affixHeaderElement$h !== void 0 && _affixHeaderElement$h.call(affixHeaderElement)) {\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(affixHeaderElement.firstChild, headerStyle);\n }\n }\n\n if ((_this$tableHeaderRef = this.tableHeaderRef) !== null && _this$tableHeaderRef !== void 0 && _this$tableHeaderRef.current) {\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"toggleClass\"])(this.tableHeaderRef.current, this.addPrefix('cell-group-shadow'), this.scrollY < 0);\n }\n };\n\n _proto.updatePositionByFixedCell = function updatePositionByFixedCell() {\n var _this$wheelWrapperRef2;\n\n var wheelGroupStyle = {};\n var wheelStyle = {};\n var scrollGroups = this.getScrollCellGroups();\n var fixedLeftGroups = this.getFixedLeftCellGroups();\n var fixedRightGroups = this.getFixedRightCellGroups();\n var _this$state4 = this.state,\n contentWidth = _this$state4.contentWidth,\n width = _this$state4.width;\n this.translateDOMPositionXY(wheelGroupStyle, this.scrollX, 0);\n this.translateDOMPositionXY(wheelStyle, 0, this.scrollY);\n var scrollArrayGroups = Array.from(scrollGroups);\n\n for (var i = 0; i < scrollArrayGroups.length; i++) {\n var group = scrollArrayGroups[i];\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(group, wheelGroupStyle);\n }\n\n if ((_this$wheelWrapperRef2 = this.wheelWrapperRef) !== null && _this$wheelWrapperRef2 !== void 0 && _this$wheelWrapperRef2.current) {\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(this.wheelWrapperRef.current, wheelStyle);\n }\n\n var leftShadowClassName = this.addPrefix('cell-group-left-shadow');\n var rightShadowClassName = this.addPrefix('cell-group-right-shadow');\n var showLeftShadow = this.scrollX < 0;\n var showRightShadow = width - contentWidth - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"] !== this.scrollX;\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"toggleClass\"])(fixedLeftGroups, leftShadowClassName, showLeftShadow);\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"toggleClass\"])(fixedRightGroups, rightShadowClassName, showRightShadow);\n };\n\n _proto.shouldRenderExpandedRow = function shouldRenderExpandedRow(rowData) {\n var _this$props18 = this.props,\n rowKey = _this$props18.rowKey,\n renderRowExpanded = _this$props18.renderRowExpanded,\n isTree = _this$props18.isTree;\n var expandedRowKeys = this.getExpandedRowKeys() || [];\n return lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(renderRowExpanded) && !isTree && expandedRowKeys.some(function (key) {\n return key === rowData[rowKey];\n });\n };\n\n _proto.calculateRowMaxHeight = function calculateRowMaxHeight() {\n var wordWrap = this.props.wordWrap;\n\n if (wordWrap) {\n var tableRowsMaxHeight = [];\n var tableRows = Object.values(this.tableRows);\n\n for (var i = 0; i < tableRows.length; i++) {\n var _tableRows$i = tableRows[i],\n row = _tableRows$i[0];\n\n if (row) {\n var cells = row.querySelectorAll(\".\" + this.addPrefix('cell-wrap')) || [];\n var cellArray = Array.from(cells);\n var maxHeight = 0;\n\n for (var j = 0; j < cellArray.length; j++) {\n var cell = cellArray[j];\n var h = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getHeight\"])(cell);\n maxHeight = Math.max(maxHeight, h);\n }\n\n tableRowsMaxHeight.push(maxHeight);\n }\n }\n\n this.setState({\n tableRowsMaxHeight: tableRowsMaxHeight\n });\n }\n };\n\n _proto.calculateTableContentWidth = function calculateTableContentWidth(prevProps) {\n var _this$tableRef3;\n\n var table = (_this$tableRef3 = this.tableRef) === null || _this$tableRef3 === void 0 ? void 0 : _this$tableRef3.current;\n var row = table.querySelector(\".\" + this.addPrefix('row') + \":not(.virtualized)\");\n var contentWidth = row ? Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getWidth\"])(row) : 0;\n this.setState({\n contentWidth: contentWidth\n }); // 这里 -SCROLLBAR_WIDTH 是为了让滚动条不挡住内容部分\n\n this.minScrollX = -(contentWidth - this.state.width) - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"];\n /**\n * 1.判断 Table 列数是否发生变化\n * 2.判断 Table 内容区域是否宽度有变化\n *\n * 满足 1 和 2 则更新横向滚动条位置\n */\n\n if (lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(this.props.children).length !== lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(prevProps.children).length && this.state.contentWidth !== contentWidth) {\n this.scrollLeft(0);\n }\n };\n\n _proto.calculateTableContextHeight = function calculateTableContextHeight(prevProps) {\n var table = this.tableRef.current;\n var rows = table.querySelectorAll(\".\" + this.addPrefix('row')) || [];\n var _this$props19 = this.props,\n height = _this$props19.height,\n autoHeight = _this$props19.autoHeight,\n rowHeight = _this$props19.rowHeight,\n affixHeader = _this$props19.affixHeader;\n var headerHeight = this.getTableHeaderHeight();\n var contentHeight = rows.length ? Array.from(rows).map(function (row) {\n return Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getHeight\"])(row) || rowHeight;\n }).reduce(function (x, y) {\n return x + y;\n }) : 0; // 当设置 affixHeader 属性后要减掉两个 header 的高度\n\n var nextContentHeight = contentHeight - (affixHeader ? headerHeight * 2 : headerHeight);\n\n if (nextContentHeight !== this.state.contentHeight) {\n this.setState({\n contentHeight: nextContentHeight\n });\n }\n\n if (prevProps && ( // 当 data 更新,或者表格高度更新,则更新滚动条\n prevProps.height !== height || prevProps.data !== this.props.data) && this.scrollY !== 0) {\n this.scrollTop(Math.abs(this.scrollY));\n this.updatePosition();\n }\n\n if (!autoHeight) {\n // 这里 -SCROLLBAR_WIDTH 是为了让滚动条不挡住内容部分\n this.minScrollY = -(contentHeight - height) - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"];\n } // 如果内容区域的高度小于表格的高度,则重置 Y 坐标滚动条\n\n\n if (contentHeight < height) {\n this.scrollTop(0);\n } // 如果 scrollTop 的值大于可以滚动的范围 ,则重置 Y 坐标滚动条\n // 当 Table 为 virtualized 时, wheel 事件触发每次都会进入该逻辑, 避免在滚动到底部后滚动条重置, +SCROLLBAR_WIDTH\n\n\n if (Math.abs(this.scrollY) + height - headerHeight > nextContentHeight + _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"]) {\n this.scrollTop(this.scrollY);\n }\n };\n\n _proto.getControlledScrollTopValue = function getControlledScrollTopValue(value) {\n if (this.props.autoHeight) {\n return [0, 0];\n }\n\n var contentHeight = this.state.contentHeight;\n var headerHeight = this.getTableHeaderHeight();\n var height = this.getTableHeight(); // 滚动值的最大范围判断\n\n value = Math.min(value, Math.max(0, contentHeight - (height - headerHeight))); // value 值是表格理论滚动位置的一个值,通过 value 计算出 scrollY 坐标值与滚动条位置的值\n\n return [-value, value / contentHeight * (height - headerHeight)];\n };\n\n _proto.getControlledScrollLeftValue = function getControlledScrollLeftValue(value) {\n var _this$state5 = this.state,\n contentWidth = _this$state5.contentWidth,\n width = _this$state5.width; // 滚动值的最大范围判断\n\n value = Math.min(value, Math.max(0, contentWidth - width));\n return [-value, value / contentWidth * width];\n }\n /**\n * public method\n */\n ;\n\n _proto.renderRowData = function renderRowData(bodyCells, rowData, props, shouldRenderExpandedRow) {\n var _this$props20 = this.props,\n renderTreeToggle = _this$props20.renderTreeToggle,\n rowKey = _this$props20.rowKey,\n wordWrap = _this$props20.wordWrap,\n isTree = _this$props20.isTree;\n var hasChildren = isTree && rowData.children && Array.isArray(rowData.children);\n var nextRowKey = typeof rowData[rowKey] !== 'undefined' ? rowData[rowKey] : props.key;\n\n var rowProps = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, props, {\n key: nextRowKey,\n 'aria-rowindex': props.key + 2,\n rowRef: this.bindTableRowsRef(props.key, rowData),\n onClick: this.bindRowClick(rowData),\n onContextMenu: this.bindRowContextMenu(rowData)\n });\n\n var expandedRowKeys = this.getExpandedRowKeys() || [];\n var expanded = expandedRowKeys.some(function (key) {\n return key === rowData[rowKey];\n });\n var cells = [];\n\n for (var i = 0; i < bodyCells.length; i++) {\n var cell = bodyCells[i];\n cells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"cloneElement\"](cell, {\n hasChildren: hasChildren,\n rowData: rowData,\n wordWrap: wordWrap,\n renderTreeToggle: renderTreeToggle,\n height: props.height,\n rowIndex: props.key,\n depth: props.depth,\n onTreeToggle: this.handleTreeToggle,\n rowKey: nextRowKey,\n expanded: expanded\n }));\n }\n\n return this.renderRow(rowProps, cells, shouldRenderExpandedRow, rowData);\n };\n\n _proto.renderRow = function renderRow(props, cells, shouldRenderExpandedRow, rowData) {\n var rowClassName = this.props.rowClassName;\n var _this$state6 = this.state,\n shouldFixedColumn = _this$state6.shouldFixedColumn,\n width = _this$state6.width,\n contentWidth = _this$state6.contentWidth;\n\n var depth = props.depth,\n restRowProps = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(props, [\"depth\"]);\n\n if (typeof rowClassName === 'function') {\n restRowProps.className = rowClassName(rowData);\n } else {\n restRowProps.className = rowClassName;\n }\n\n var rowStyles = {};\n var rowRight = 0;\n\n if (this.isRTL() && contentWidth > width) {\n rowRight = width - contentWidth;\n rowStyles.right = rowRight;\n } // IF there are fixed columns, add a fixed group\n\n\n if (shouldFixedColumn && contentWidth > width) {\n var fixedLeftCells = [];\n var fixedRightCells = [];\n var scrollCells = [];\n var fixedLeftCellGroupWidth = 0;\n var fixedRightCellGroupWidth = 0;\n\n for (var i = 0; i < cells.length; i++) {\n var cell = cells[i];\n var _cell$props = cell.props,\n fixed = _cell$props.fixed,\n _width2 = _cell$props.width;\n var isFixedStart = fixed === 'left' || fixed === true;\n var isFixedEnd = fixed === 'right';\n\n if (this.isRTL()) {\n isFixedStart = fixed === 'right';\n isFixedEnd = fixed === 'left' || fixed === true;\n }\n\n if (isFixedStart) {\n fixedLeftCells.push(cell);\n fixedLeftCellGroupWidth += _width2;\n } else if (isFixedEnd) {\n fixedRightCells.push(cell);\n fixedRightCellGroupWidth += _width2;\n } else {\n scrollCells.push(cell);\n }\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Row__WEBPACK_IMPORTED_MODULE_16__[\"default\"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, restRowProps, {\n \"data-depth\": depth,\n style: rowStyles\n }), fixedLeftCellGroupWidth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_CellGroup__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n fixed: \"left\",\n height: props.isHeaderRow ? props.headerHeight : props.height,\n width: fixedLeftCellGroupWidth,\n style: this.isRTL() ? {\n right: width - fixedLeftCellGroupWidth - rowRight\n } : null\n }, Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"mergeCells\"])(Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"resetLeftForCells\"])(fixedLeftCells))) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_CellGroup__WEBPACK_IMPORTED_MODULE_17__[\"default\"], null, Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"mergeCells\"])(scrollCells)), fixedRightCellGroupWidth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_CellGroup__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n fixed: \"right\",\n style: this.isRTL() ? {\n right: 0 - rowRight\n } : {\n left: width - fixedRightCellGroupWidth - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"]\n },\n height: props.isHeaderRow ? props.headerHeight : props.height,\n width: fixedRightCellGroupWidth + _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"]\n }, Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"mergeCells\"])(Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"resetLeftForCells\"])(fixedRightCells, _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"]))) : null, shouldRenderExpandedRow && this.renderRowExpanded(rowData));\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Row__WEBPACK_IMPORTED_MODULE_16__[\"default\"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, restRowProps, {\n \"data-depth\": depth,\n style: rowStyles\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_CellGroup__WEBPACK_IMPORTED_MODULE_17__[\"default\"], null, Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"mergeCells\"])(cells)), shouldRenderExpandedRow && this.renderRowExpanded(rowData));\n };\n\n _proto.renderRowExpanded = function renderRowExpanded(rowData) {\n var _this$props21 = this.props,\n renderRowExpanded = _this$props21.renderRowExpanded,\n rowExpandedHeight = _this$props21.rowExpandedHeight;\n var styles = {\n height: rowExpandedHeight\n };\n\n if (typeof renderRowExpanded === 'function') {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: this.addPrefix('row-expanded'),\n style: styles\n }, renderRowExpanded(rowData));\n }\n\n return null;\n };\n\n _proto.renderMouseArea = function renderMouseArea() {\n var headerHeight = this.getTableHeaderHeight();\n var styles = {\n height: this.getTableHeight()\n };\n var spanStyles = {\n height: headerHeight - 1\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n ref: this.mouseAreaRef,\n className: this.addPrefix('mouse-area'),\n style: styles\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"span\", {\n style: spanStyles\n }));\n };\n\n _proto.renderTableHeader = function renderTableHeader(headerCells, rowWidth) {\n var affixHeader = this.props.affixHeader;\n var tableWidth = this.state.width;\n var top = typeof affixHeader === 'number' ? affixHeader : 0;\n var headerHeight = this.getTableHeaderHeight();\n var rowProps = {\n 'aria-rowindex': 1,\n rowRef: this.tableHeaderRef,\n width: rowWidth,\n height: this.getRowHeight(),\n headerHeight: headerHeight,\n isHeaderRow: true,\n top: 0\n };\n var fixedStyle = {\n position: 'fixed',\n overflow: 'hidden',\n height: this.getTableHeaderHeight(),\n width: tableWidth,\n top: top\n }; // Affix header\n\n var header = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: classnames__WEBPACK_IMPORTED_MODULE_5___default()(this.addPrefix('affix-header')),\n style: fixedStyle,\n ref: this.affixHeaderWrapperRef\n }, this.renderRow(rowProps, headerCells));\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_3__[\"Fragment\"], null, (affixHeader === 0 || affixHeader) && header, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n role: \"rowgroup\",\n className: this.addPrefix('header-row-wrapper'),\n ref: this.headerWrapperRef\n }, this.renderRow(rowProps, headerCells)));\n };\n\n _proto.renderTableBody = function renderTableBody(bodyCells, rowWidth) {\n var _this$props22 = this.props,\n rowExpandedHeight = _this$props22.rowExpandedHeight,\n renderRowExpanded = _this$props22.renderRowExpanded,\n isTree = _this$props22.isTree,\n rowKey = _this$props22.rowKey,\n wordWrap = _this$props22.wordWrap,\n virtualized = _this$props22.virtualized,\n rowHeight = _this$props22.rowHeight;\n var headerHeight = this.getTableHeaderHeight();\n var _this$state7 = this.state,\n tableRowsMaxHeight = _this$state7.tableRowsMaxHeight,\n isScrolling = _this$state7.isScrolling,\n data = _this$state7.data;\n var height = this.getTableHeight();\n var bodyHeight = height - headerHeight;\n var bodyStyles = {\n top: headerHeight,\n height: bodyHeight\n };\n var contentHeight = 0;\n var topHideHeight = 0;\n var bottomHideHeight = 0;\n this._visibleRows = [];\n\n if (data) {\n var top = 0; // Row position\n\n var minTop = Math.abs(this.scrollY);\n var maxTop = minTop + height + rowExpandedHeight;\n var isCustomRowHeight = typeof rowHeight === 'function';\n var isUncertainHeight = !!(renderRowExpanded || isCustomRowHeight || isTree);\n /**\n 如果开启了 virtualized 同时 Table 中的的行高是可变的,\n 则需要循环遍历 data, 获取每一行的高度。\n */\n\n if (isUncertainHeight && virtualized || !virtualized) {\n for (var index = 0; index < data.length; index++) {\n var rowData = data[index];\n var maxHeight = tableRowsMaxHeight[index];\n var shouldRenderExpandedRow = this.shouldRenderExpandedRow(rowData);\n var nextRowHeight = 0;\n var depth = 0;\n\n if (typeof rowHeight === 'function') {\n nextRowHeight = rowHeight(rowData);\n } else {\n nextRowHeight = maxHeight ? Math.max(maxHeight + _constants__WEBPACK_IMPORTED_MODULE_20__[\"CELL_PADDING_HEIGHT\"], rowHeight) : rowHeight;\n\n if (shouldRenderExpandedRow) {\n nextRowHeight += rowExpandedHeight;\n }\n }\n\n if (isTree) {\n var parents = Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"findAllParents\"])(rowData, rowKey);\n var expandedRowKeys = this.getExpandedRowKeys();\n depth = parents.length; // 如果是 Tree Table, 判断当前的行是否展开/折叠,如果是折叠则不显示该行。\n\n if (!Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"shouldShowRowByExpanded\"])(expandedRowKeys, parents)) {\n continue;\n }\n }\n\n contentHeight += nextRowHeight;\n var rowProps = {\n key: index,\n top: top,\n width: rowWidth,\n depth: depth,\n height: nextRowHeight\n };\n top += nextRowHeight;\n\n if (virtualized && !wordWrap) {\n if (top + nextRowHeight < minTop) {\n topHideHeight += nextRowHeight;\n continue;\n } else if (top > maxTop) {\n bottomHideHeight += nextRowHeight;\n continue;\n }\n }\n\n this._visibleRows.push(this.renderRowData(bodyCells, rowData, rowProps, shouldRenderExpandedRow));\n }\n } else {\n /**\n 如果 Table 的行高是固定的,则直接通过行高与行数进行计算,\n 减少遍历所有 data 带来的性能消耗\n */\n var _nextRowHeight = this.getRowHeight();\n\n var startIndex = Math.max(Math.floor(minTop / _nextRowHeight), 0);\n var endIndex = Math.min(startIndex + Math.ceil(bodyHeight / _nextRowHeight), data.length);\n contentHeight = data.length * _nextRowHeight;\n topHideHeight = startIndex * _nextRowHeight;\n bottomHideHeight = (data.length - endIndex) * _nextRowHeight;\n\n for (var _index = startIndex; _index < endIndex; _index++) {\n var _rowData = data[_index];\n var _rowProps = {\n key: _index,\n top: _index * _nextRowHeight,\n width: rowWidth,\n height: _nextRowHeight\n };\n\n this._visibleRows.push(this.renderRowData(bodyCells, _rowData, _rowProps, false));\n }\n }\n }\n\n var wheelStyles = {\n position: 'absolute',\n height: contentHeight,\n minHeight: height,\n pointerEvents: isScrolling ? 'none' : undefined\n };\n var topRowStyles = {\n height: topHideHeight\n };\n var bottomRowStyles = {\n height: bottomHideHeight\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n ref: this.tableBodyRef,\n role: \"rowgroup\",\n className: this.addPrefix('body-row-wrapper'),\n style: bodyStyles,\n onScroll: this.handleBodyScroll\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n style: wheelStyles,\n className: this.addPrefix('body-wheel-area'),\n ref: this.wheelWrapperRef\n }, topHideHeight ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Row__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n style: topRowStyles,\n className: \"virtualized\"\n }) : null, this._visibleRows, bottomHideHeight ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Row__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n style: bottomRowStyles,\n className: \"virtualized\"\n }) : null), this.renderInfo(), this.renderScrollbar(), this.renderLoading());\n };\n\n _proto.renderInfo = function renderInfo() {\n var _this$props23 = this.props,\n locale = _this$props23.locale,\n renderEmpty = _this$props23.renderEmpty,\n loading = _this$props23.loading;\n\n if (this._visibleRows.length || loading) {\n return null;\n }\n\n var emptyMessage = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: this.addPrefix('body-info')\n }, locale.emptyMessage);\n return renderEmpty ? renderEmpty(emptyMessage) : emptyMessage;\n };\n\n _proto.renderScrollbar = function renderScrollbar() {\n var _this$props24 = this.props,\n disabledScroll = _this$props24.disabledScroll,\n affixHorizontalScrollbar = _this$props24.affixHorizontalScrollbar,\n id = _this$props24.id;\n var _this$state8 = this.state,\n contentWidth = _this$state8.contentWidth,\n contentHeight = _this$state8.contentHeight,\n width = _this$state8.width,\n fixedHorizontalScrollbar = _this$state8.fixedHorizontalScrollbar;\n var bottom = typeof affixHorizontalScrollbar === 'number' ? affixHorizontalScrollbar : 0;\n var headerHeight = this.getTableHeaderHeight();\n var height = this.getTableHeight();\n\n if (disabledScroll) {\n return null;\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Scrollbar__WEBPACK_IMPORTED_MODULE_18__[\"default\"], {\n tableId: id,\n className: classnames__WEBPACK_IMPORTED_MODULE_5___default()({\n fixed: fixedHorizontalScrollbar\n }),\n style: {\n width: width,\n bottom: fixedHorizontalScrollbar ? bottom : undefined\n },\n length: this.state.width,\n onScroll: this.handleScrollX,\n scrollLength: contentWidth,\n ref: this.scrollbarXRef\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Scrollbar__WEBPACK_IMPORTED_MODULE_18__[\"default\"], {\n vertical: true,\n tableId: id,\n length: height - headerHeight,\n scrollLength: contentHeight,\n onScroll: this.handleScrollY,\n ref: this.scrollbarYRef\n }));\n }\n /**\n * show loading\n */\n ;\n\n _proto.renderLoading = function renderLoading() {\n var _this$props25 = this.props,\n locale = _this$props25.locale,\n loading = _this$props25.loading,\n loadAnimation = _this$props25.loadAnimation,\n renderLoading = _this$props25.renderLoading;\n\n if (!loadAnimation && !loading) {\n return null;\n }\n\n var loadingElement = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: this.addPrefix('loader-wrapper')\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: this.addPrefix('loader')\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"i\", {\n className: this.addPrefix('loader-icon')\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"span\", {\n className: this.addPrefix('loader-text')\n }, locale.loading)));\n return renderLoading ? renderLoading(loadingElement) : loadingElement;\n };\n\n _proto.render = function render() {\n var _classNames;\n\n var _this$props26 = this.props,\n children = _this$props26.children,\n className = _this$props26.className,\n data = _this$props26.data,\n _this$props26$width = _this$props26.width,\n width = _this$props26$width === void 0 ? 0 : _this$props26$width,\n style = _this$props26.style,\n isTree = _this$props26.isTree,\n hover = _this$props26.hover,\n bordered = _this$props26.bordered,\n cellBordered = _this$props26.cellBordered,\n wordWrap = _this$props26.wordWrap,\n classPrefix = _this$props26.classPrefix,\n loading = _this$props26.loading,\n showHeader = _this$props26.showHeader,\n rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(_this$props26, [\"children\", \"className\", \"data\", \"width\", \"style\", \"isTree\", \"hover\", \"bordered\", \"cellBordered\", \"wordWrap\", \"classPrefix\", \"loading\", \"showHeader\"]);\n\n var isColumnResizing = this.state.isColumnResizing;\n\n var _this$getCellDescript = this.getCellDescriptor(),\n headerCells = _this$getCellDescript.headerCells,\n bodyCells = _this$getCellDescript.bodyCells,\n allColumnsWidth = _this$getCellDescript.allColumnsWidth,\n hasCustomTreeCol = _this$getCellDescript.hasCustomTreeCol;\n\n var rowWidth = allColumnsWidth > width ? allColumnsWidth : width;\n var clesses = classnames__WEBPACK_IMPORTED_MODULE_5___default()(classPrefix, className, (_classNames = {}, _classNames[this.addPrefix('word-wrap')] = wordWrap, _classNames[this.addPrefix('treetable')] = isTree, _classNames[this.addPrefix('bordered')] = bordered, _classNames[this.addPrefix('cell-bordered')] = cellBordered, _classNames[this.addPrefix('column-resizing')] = isColumnResizing, _classNames[this.addPrefix('hover')] = hover, _classNames[this.addPrefix('loading')] = loading, _classNames));\n\n var styles = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n width: width || 'auto',\n height: this.getTableHeight()\n }, style);\n\n var unhandled = Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"getUnhandledProps\"])(propTypes, rest);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_TableContext__WEBPACK_IMPORTED_MODULE_19__[\"default\"].Provider, {\n value: {\n translateDOMPositionXY: this.translateDOMPositionXY,\n rtl: this.isRTL(),\n isTree: isTree,\n hasCustomTreeCol: hasCustomTreeCol\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n role: isTree ? 'treegrid' : 'grid' // The aria-rowcount is specified on the element with the table.\n // Its value is an integer equal to the total number of rows available, including header rows.\n ,\n \"aria-rowcount\": data.length + 1,\n \"aria-colcount\": this._cacheChildrenSize\n }, unhandled, {\n className: clesses,\n style: styles,\n ref: this.tableRef\n }), showHeader && this.renderTableHeader(headerCells, rowWidth), children && this.renderTableBody(bodyCells, rowWidth), showHeader && this.renderMouseArea()));\n };\n\n return Table;\n}(react__WEBPACK_IMPORTED_MODULE_3__[\"Component\"]);\n\nTable.propTypes = propTypes;\nTable.defaultProps = {\n classPrefix: Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"defaultClassPrefix\"])('table'),\n data: [],\n defaultSortType: SORT_TYPE.DESC,\n height: 200,\n rowHeight: 46,\n headerHeight: 40,\n minHeight: 0,\n rowExpandedHeight: 100,\n hover: true,\n showHeader: true,\n rowKey: 'key',\n translate3d: true,\n shouldUpdateScroll: true,\n locale: {\n emptyMessage: 'No data found',\n loading: 'Loading...'\n }\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (Table);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/Table.js?");
|
|
5089
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ \"./node_modules/rsuite-table/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/rsuite-table/node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ \"./node_modules/rsuite-table/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isFunction */ \"./node_modules/rsuite-table/node_modules/lodash/isFunction.js\");\n/* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash/flatten */ \"./node_modules/rsuite-table/node_modules/lodash/flatten.js\");\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash_flatten__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/rsuite-table/node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! lodash/isEqual */ \"./node_modules/rsuite-table/node_modules/lodash/isEqual.js\");\n/* harmony import */ var lodash_isEqual__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(lodash_isEqual__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var lodash_eq__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! lodash/eq */ \"./node_modules/rsuite-table/node_modules/lodash/eq.js\");\n/* harmony import */ var lodash_eq__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(lodash_eq__WEBPACK_IMPORTED_MODULE_10__);\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! lodash/omit */ \"./node_modules/rsuite-table/node_modules/lodash/omit.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_11__);\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/rsuite-table/node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_12__);\n/* harmony import */ var element_resize_event__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! element-resize-event */ \"./node_modules/element-resize-event/index.js\");\n/* harmony import */ var element_resize_event__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(element_resize_event__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var dom_lib_lib_transition_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! dom-lib/lib/transition/translateDOMPositionXY */ \"./node_modules/dom-lib/lib/transition/translateDOMPositionXY.js\");\n/* harmony import */ var dom_lib_lib_transition_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(dom_lib_lib_transition_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_14__);\n/* harmony import */ var dom_lib__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! dom-lib */ \"./node_modules/dom-lib/es/index.js\");\n/* harmony import */ var _Row__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Row */ \"./node_modules/rsuite-table/es/Row.js\");\n/* harmony import */ var _CellGroup__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./CellGroup */ \"./node_modules/rsuite-table/es/CellGroup.js\");\n/* harmony import */ var _Scrollbar__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Scrollbar */ \"./node_modules/rsuite-table/es/Scrollbar.js\");\n/* harmony import */ var _TableContext__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./TableContext */ \"./node_modules/rsuite-table/es/TableContext.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./utils */ \"./node_modules/rsuite-table/es/utils/index.js\");\n/* harmony import */ var _ColumnGroup__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ColumnGroup */ \"./node_modules/rsuite-table/es/ColumnGroup.js\");\n/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! react-is */ \"./node_modules/rsuite-table/node_modules/react-is/index.js\");\n/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(react_is__WEBPACK_IMPORTED_MODULE_23__);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar SORT_TYPE = {\n DESC: 'desc',\n ASC: 'asc'\n};\nvar propTypes = {\n autoHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n affixHeader: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number]),\n affixHorizontalScrollbar: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number]),\n bordered: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n bodyRef: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n className: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string,\n classPrefix: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string,\n children: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.any,\n cellBordered: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n data: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.object),\n defaultExpandAllRows: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n defaultExpandedRowKeys: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number])),\n defaultSortType: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string]),\n disabledScroll: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n expandedRowKeys: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number])),\n hover: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n height: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n headerHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n locale: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.object,\n loading: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n loadAnimation: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n minHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n rowKey: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number]),\n rowHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func]),\n renderTreeToggle: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n renderRowExpanded: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n rowExpandedHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n renderEmpty: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n renderLoading: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n rowClassName: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string]),\n rtl: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n style: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.object,\n sortColumn: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string,\n sortType: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool, prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.string]),\n showHeader: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n shouldUpdateScroll: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n translate3d: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n wordWrap: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n width: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.number,\n virtualized: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n isTree: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.bool,\n onRowClick: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onRowContextMenu: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onScroll: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onSortColumn: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onExpandChange: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onTouchStart: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onTouchMove: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func,\n onDataUpdated: prop_types__WEBPACK_IMPORTED_MODULE_4___default.a.func\n};\n\nvar Table = /*#__PURE__*/function (_React$Component) {\n Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(Table, _React$Component);\n\n Table.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {\n if (props.data !== state.cacheData || props.isTree !== state.isTree) {\n return {\n cacheData: props.data,\n isTree: props.isTree,\n data: props.isTree ? Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"flattenData\"])(props.data) : props.data\n };\n }\n\n return null;\n };\n\n function Table(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.translateDOMPositionXY = null;\n _this.scrollListener = null;\n _this.tableRef = void 0;\n _this.scrollbarYRef = void 0;\n _this.scrollbarXRef = void 0;\n _this.tableBodyRef = void 0;\n _this.affixHeaderWrapperRef = void 0;\n _this.mouseAreaRef = void 0;\n _this.headerWrapperRef = void 0;\n _this.tableHeaderRef = void 0;\n _this.wheelWrapperRef = void 0;\n _this.tableRows = {};\n _this.mounted = false;\n _this.disableEventsTimeoutId = null;\n _this.scrollY = 0;\n _this.scrollX = 0;\n _this.wheelHandler = void 0;\n _this.minScrollY = void 0;\n _this.minScrollX = void 0;\n _this.mouseArea = void 0;\n _this.touchX = void 0;\n _this.touchY = void 0;\n _this.wheelListener = void 0;\n _this.touchStartListener = void 0;\n _this.touchMoveListener = void 0;\n _this._cacheCells = null;\n _this._cacheChildrenSize = 0;\n _this._visibleRows = [];\n\n _this.listenWheel = function (deltaX, deltaY) {\n var _this$scrollbarXRef$c, _this$scrollbarXRef$c2, _this$scrollbarYRef$c, _this$scrollbarYRef$c2;\n\n _this.handleWheel(deltaX, deltaY);\n\n (_this$scrollbarXRef$c = _this.scrollbarXRef.current) === null || _this$scrollbarXRef$c === void 0 ? void 0 : (_this$scrollbarXRef$c2 = _this$scrollbarXRef$c.onWheelScroll) === null || _this$scrollbarXRef$c2 === void 0 ? void 0 : _this$scrollbarXRef$c2.call(_this$scrollbarXRef$c, deltaX);\n (_this$scrollbarYRef$c = _this.scrollbarYRef.current) === null || _this$scrollbarYRef$c === void 0 ? void 0 : (_this$scrollbarYRef$c2 = _this$scrollbarYRef$c.onWheelScroll) === null || _this$scrollbarYRef$c2 === void 0 ? void 0 : _this$scrollbarYRef$c2.call(_this$scrollbarYRef$c, deltaY);\n };\n\n _this.setOffsetByAffix = function () {\n var _this$headerWrapperRe, _this$tableRef;\n\n var _this$props = _this.props,\n affixHeader = _this$props.affixHeader,\n affixHorizontalScrollbar = _this$props.affixHorizontalScrollbar;\n var headerNode = (_this$headerWrapperRe = _this.headerWrapperRef) === null || _this$headerWrapperRe === void 0 ? void 0 : _this$headerWrapperRe.current;\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHeader) && headerNode) {\n _this.setState(function () {\n return {\n headerOffset: Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getOffset\"])(headerNode)\n };\n });\n }\n\n var tableNode = (_this$tableRef = _this.tableRef) === null || _this$tableRef === void 0 ? void 0 : _this$tableRef.current;\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHorizontalScrollbar) && tableNode) {\n _this.setState(function () {\n return {\n tableOffset: Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getOffset\"])(tableNode)\n };\n });\n }\n };\n\n _this.handleWindowScroll = function () {\n var _this$props2 = _this.props,\n affixHeader = _this$props2.affixHeader,\n affixHorizontalScrollbar = _this$props2.affixHorizontalScrollbar;\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHeader)) {\n _this.affixTableHeader();\n }\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHorizontalScrollbar)) {\n _this.affixHorizontalScrollbar();\n }\n };\n\n _this.affixHorizontalScrollbar = function () {\n var _this$scrollbarXRef, _this$scrollbarXRef$c3, _this$scrollbarXRef$c4;\n\n var scrollY = window.scrollY || window.pageYOffset;\n var windowHeight = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getHeight\"])(window);\n\n var height = _this.getTableHeight();\n\n var _this$state = _this.state,\n tableOffset = _this$state.tableOffset,\n fixedHorizontalScrollbar = _this$state.fixedHorizontalScrollbar;\n var affixHorizontalScrollbar = _this.props.affixHorizontalScrollbar;\n\n var headerHeight = _this.getTableHeaderHeight();\n\n var bottom = typeof affixHorizontalScrollbar === 'number' ? affixHorizontalScrollbar : 0;\n var fixedScrollbar = scrollY + windowHeight < height + (tableOffset.top + bottom) && scrollY + windowHeight - headerHeight > tableOffset.top + bottom;\n\n if ((_this$scrollbarXRef = _this.scrollbarXRef) !== null && _this$scrollbarXRef !== void 0 && (_this$scrollbarXRef$c3 = _this$scrollbarXRef.current) !== null && _this$scrollbarXRef$c3 !== void 0 && (_this$scrollbarXRef$c4 = _this$scrollbarXRef$c3.barRef) !== null && _this$scrollbarXRef$c4 !== void 0 && _this$scrollbarXRef$c4.current && fixedHorizontalScrollbar !== fixedScrollbar) {\n _this.setState({\n fixedHorizontalScrollbar: fixedScrollbar\n });\n }\n };\n\n _this.affixTableHeader = function () {\n var affixHeader = _this.props.affixHeader;\n var top = typeof affixHeader === 'number' ? affixHeader : 0;\n var _this$state2 = _this.state,\n headerOffset = _this$state2.headerOffset,\n contentHeight = _this$state2.contentHeight;\n var scrollY = window.scrollY || window.pageYOffset;\n var fixedHeader = scrollY - (headerOffset.top - top) >= 0 && scrollY < headerOffset.top - top + contentHeight;\n\n if (_this.affixHeaderWrapperRef.current) {\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"toggleClass\"])(_this.affixHeaderWrapperRef.current, 'fixed', fixedHeader);\n }\n };\n\n _this.handleSortColumn = function (dataKey) {\n var _this$props$onSortCol, _this$props3;\n\n var sortType = _this.getSortType();\n\n if (_this.props.sortColumn === dataKey) {\n sortType = sortType === SORT_TYPE.ASC ? SORT_TYPE.DESC : SORT_TYPE.ASC;\n\n _this.setState({\n sortType: sortType\n });\n }\n\n (_this$props$onSortCol = (_this$props3 = _this.props).onSortColumn) === null || _this$props$onSortCol === void 0 ? void 0 : _this$props$onSortCol.call(_this$props3, dataKey, sortType);\n };\n\n _this.handleColumnResizeEnd = function (columnWidth, _cursorDelta, dataKey, index) {\n var _this$setState;\n\n _this._cacheCells = null;\n\n _this.setState((_this$setState = {\n isColumnResizing: false\n }, _this$setState[dataKey + \"_\" + index + \"_width\"] = columnWidth, _this$setState));\n\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(_this.mouseAreaRef.current, {\n display: 'none'\n });\n };\n\n _this.handleColumnResizeStart = function (width, left, fixed) {\n _this.setState({\n isColumnResizing: true\n });\n\n _this.handleColumnResizeMove(width, left, fixed);\n };\n\n _this.handleColumnResizeMove = function (width, left, fixed) {\n var _addStyle;\n\n var mouseAreaLeft = width + left;\n var x = mouseAreaLeft;\n var dir = 'left';\n\n if (_this.isRTL()) {\n mouseAreaLeft += _this.minScrollX + _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"];\n dir = 'right';\n }\n\n if (!fixed) {\n x = mouseAreaLeft + (_this.isRTL() ? -_this.scrollX : _this.scrollX);\n }\n\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(_this.mouseAreaRef.current, (_addStyle = {\n display: 'block'\n }, _addStyle[dir] = x + \"px\", _addStyle));\n };\n\n _this.handleTreeToggle = function (rowKey, _rowIndex, rowData) {\n var _this$props$onExpandC, _this$props4;\n\n var expandedRowKeys = _this.getExpandedRowKeys();\n\n var open = false;\n var nextExpandedRowKeys = [];\n\n for (var i = 0; i < expandedRowKeys.length; i++) {\n var _key = expandedRowKeys[i];\n\n if (_key === rowKey) {\n open = true;\n } else {\n nextExpandedRowKeys.push(_key);\n }\n }\n\n if (!open) {\n nextExpandedRowKeys.push(rowKey);\n }\n\n _this.setState({\n expandedRowKeys: nextExpandedRowKeys\n });\n\n (_this$props$onExpandC = (_this$props4 = _this.props).onExpandChange) === null || _this$props$onExpandC === void 0 ? void 0 : _this$props$onExpandC.call(_this$props4, !open, rowData);\n };\n\n _this.handleScrollX = function (delta) {\n _this.handleWheel(delta, 0);\n };\n\n _this.handleScrollY = function (delta) {\n _this.handleWheel(0, delta);\n };\n\n _this.handleWheel = function (deltaX, deltaY) {\n var _this$props5 = _this.props,\n onScroll = _this$props5.onScroll,\n virtualized = _this$props5.virtualized;\n var _this$state3 = _this.state,\n contentWidth = _this$state3.contentWidth,\n width = _this$state3.width;\n\n if (!_this.tableRef.current) {\n return;\n }\n\n var nextScrollX = contentWidth <= width ? 0 : _this.scrollX - deltaX;\n var nextScrollY = _this.scrollY - deltaY;\n _this.scrollY = Math.min(0, nextScrollY < _this.minScrollY ? _this.minScrollY : nextScrollY);\n _this.scrollX = Math.min(0, nextScrollX < _this.minScrollX ? _this.minScrollX : nextScrollX);\n\n _this.updatePosition();\n\n onScroll === null || onScroll === void 0 ? void 0 : onScroll(_this.scrollX, _this.scrollY);\n\n if (virtualized) {\n _this.setState({\n isScrolling: true,\n scrollY: _this.scrollY\n });\n\n if (_this.disableEventsTimeoutId) {\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"cancelAnimationTimeout\"])(_this.disableEventsTimeoutId);\n }\n\n _this.disableEventsTimeoutId = Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"requestAnimationTimeout\"])(_this.debounceScrollEndedCallback, 150);\n }\n };\n\n _this.debounceScrollEndedCallback = function () {\n _this.disableEventsTimeoutId = null;\n\n _this.setState({\n isScrolling: false\n });\n };\n\n _this.handleTouchStart = function (event) {\n var _this$props$onTouchSt, _this$props6;\n\n if (event.touches) {\n var _event$touches$ = event.touches[0],\n pageX = _event$touches$.pageX,\n pageY = _event$touches$.pageY;\n _this.touchX = pageX;\n _this.touchY = pageY;\n }\n\n (_this$props$onTouchSt = (_this$props6 = _this.props).onTouchStart) === null || _this$props$onTouchSt === void 0 ? void 0 : _this$props$onTouchSt.call(_this$props6, event);\n };\n\n _this.handleTouchMove = function (event) {\n var _this$props$onTouchMo, _this$props7;\n\n var autoHeight = _this.props.autoHeight;\n\n if (event.touches) {\n var _event$preventDefault, _this$scrollbarXRef$c5, _this$scrollbarXRef$c6, _this$scrollbarYRef$c3, _this$scrollbarYRef$c4;\n\n var _event$touches$2 = event.touches[0],\n pageX = _event$touches$2.pageX,\n pageY = _event$touches$2.pageY;\n var deltaX = _this.touchX - pageX;\n var deltaY = autoHeight ? 0 : _this.touchY - pageY;\n\n if (!_this.shouldHandleWheelY(deltaY) && !_this.shouldHandleWheelX(deltaX)) {\n return;\n }\n\n (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);\n\n _this.handleWheel(deltaX, deltaY);\n\n (_this$scrollbarXRef$c5 = _this.scrollbarXRef.current) === null || _this$scrollbarXRef$c5 === void 0 ? void 0 : (_this$scrollbarXRef$c6 = _this$scrollbarXRef$c5.onWheelScroll) === null || _this$scrollbarXRef$c6 === void 0 ? void 0 : _this$scrollbarXRef$c6.call(_this$scrollbarXRef$c5, deltaX);\n (_this$scrollbarYRef$c3 = _this.scrollbarYRef.current) === null || _this$scrollbarYRef$c3 === void 0 ? void 0 : (_this$scrollbarYRef$c4 = _this$scrollbarYRef$c3.onWheelScroll) === null || _this$scrollbarYRef$c4 === void 0 ? void 0 : _this$scrollbarYRef$c4.call(_this$scrollbarYRef$c3, deltaY);\n _this.touchX = pageX;\n _this.touchY = pageY;\n }\n\n (_this$props$onTouchMo = (_this$props7 = _this.props).onTouchMove) === null || _this$props$onTouchMo === void 0 ? void 0 : _this$props$onTouchMo.call(_this$props7, event);\n };\n\n _this.handleBodyScroll = function (event) {\n if (event.target !== _this.tableBodyRef.current) {\n return;\n }\n\n var left = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"scrollLeft\"])(event.target);\n var top = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"scrollTop\"])(event.target);\n\n if (top === 0 && left === 0) {\n return;\n }\n\n _this.listenWheel(left, top);\n\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"scrollLeft\"])(event.target, 0);\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"scrollTop\"])(event.target, 0);\n };\n\n _this.shouldHandleWheelX = function (delta) {\n var _this$props8 = _this.props,\n disabledScroll = _this$props8.disabledScroll,\n loading = _this$props8.loading;\n\n if (delta === 0 || disabledScroll || loading) {\n return false;\n }\n\n return true;\n };\n\n _this.shouldHandleWheelY = function (delta) {\n var _this$props9 = _this.props,\n disabledScroll = _this$props9.disabledScroll,\n loading = _this$props9.loading;\n\n if (delta === 0 || disabledScroll || loading) {\n return false;\n }\n\n return delta >= 0 && _this.scrollY > _this.minScrollY || delta < 0 && _this.scrollY < 0;\n };\n\n _this.addPrefix = function (name) {\n return Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"prefix\"])(_this.props.classPrefix)(name);\n };\n\n _this.calculateTableWidth = function () {\n var _this$tableRef2;\n\n var table = (_this$tableRef2 = _this.tableRef) === null || _this$tableRef2 === void 0 ? void 0 : _this$tableRef2.current;\n var width = _this.state.width;\n\n if (table) {\n var nextWidth = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getWidth\"])(table);\n\n if (width !== nextWidth) {\n var _this$scrollbarXRef2, _this$scrollbarXRef2$;\n\n _this.scrollX = 0;\n (_this$scrollbarXRef2 = _this.scrollbarXRef) === null || _this$scrollbarXRef2 === void 0 ? void 0 : (_this$scrollbarXRef2$ = _this$scrollbarXRef2.current) === null || _this$scrollbarXRef2$ === void 0 ? void 0 : _this$scrollbarXRef2$.resetScrollBarPosition();\n }\n\n _this._cacheCells = null;\n\n _this.setState({\n width: nextWidth\n });\n }\n\n _this.setOffsetByAffix();\n };\n\n _this.scrollTop = function (top) {\n var _this$scrollbarYRef, _this$scrollbarYRef$c5, _this$scrollbarYRef$c6;\n\n if (top === void 0) {\n top = 0;\n }\n\n var _this$getControlledSc = _this.getControlledScrollTopValue(top),\n scrollY = _this$getControlledSc[0],\n handleScrollY = _this$getControlledSc[1];\n\n _this.scrollY = scrollY;\n (_this$scrollbarYRef = _this.scrollbarYRef) === null || _this$scrollbarYRef === void 0 ? void 0 : (_this$scrollbarYRef$c5 = _this$scrollbarYRef.current) === null || _this$scrollbarYRef$c5 === void 0 ? void 0 : (_this$scrollbarYRef$c6 = _this$scrollbarYRef$c5.resetScrollBarPosition) === null || _this$scrollbarYRef$c6 === void 0 ? void 0 : _this$scrollbarYRef$c6.call(_this$scrollbarYRef$c5, handleScrollY);\n\n _this.updatePosition();\n /**\n * 当开启 virtualized,调用 scrollTop 后会出现白屏现象,\n * 原因是直接操作 DOM 的坐标,但是组件没有重新渲染,需要调用 forceUpdate 重新进入 render。\n * Fix: rsuite#1044\n */\n\n\n if (_this.props.virtualized && _this.state.contentHeight > _this.props.height) {\n _this.forceUpdate();\n }\n };\n\n _this.scrollLeft = function (left) {\n var _this$scrollbarXRef3, _this$scrollbarXRef3$, _this$scrollbarXRef3$2;\n\n if (left === void 0) {\n left = 0;\n }\n\n var _this$getControlledSc2 = _this.getControlledScrollLeftValue(left),\n scrollX = _this$getControlledSc2[0],\n handleScrollX = _this$getControlledSc2[1];\n\n _this.scrollX = scrollX;\n (_this$scrollbarXRef3 = _this.scrollbarXRef) === null || _this$scrollbarXRef3 === void 0 ? void 0 : (_this$scrollbarXRef3$ = _this$scrollbarXRef3.current) === null || _this$scrollbarXRef3$ === void 0 ? void 0 : (_this$scrollbarXRef3$2 = _this$scrollbarXRef3$.resetScrollBarPosition) === null || _this$scrollbarXRef3$2 === void 0 ? void 0 : _this$scrollbarXRef3$2.call(_this$scrollbarXRef3$, handleScrollX);\n\n _this.updatePosition();\n };\n\n _this.scrollTo = function (coord) {\n var _ref = coord || {},\n x = _ref.x,\n y = _ref.y;\n\n if (typeof x === 'number') {\n _this.scrollLeft(x);\n }\n\n if (typeof y === 'number') {\n _this.scrollTop(y);\n }\n };\n\n _this.bindTableRowsRef = function (index, rowData) {\n return function (ref) {\n if (ref) {\n _this.tableRows[index] = [ref, rowData];\n }\n };\n };\n\n _this.bindRowClick = function (rowData) {\n return function (event) {\n var _this$props$onRowClic, _this$props10;\n\n (_this$props$onRowClic = (_this$props10 = _this.props).onRowClick) === null || _this$props$onRowClic === void 0 ? void 0 : _this$props$onRowClic.call(_this$props10, rowData, event);\n };\n };\n\n _this.bindRowContextMenu = function (rowData) {\n return function (event) {\n var _this$props$onRowCont, _this$props11;\n\n (_this$props$onRowCont = (_this$props11 = _this.props).onRowContextMenu) === null || _this$props$onRowCont === void 0 ? void 0 : _this$props$onRowCont.call(_this$props11, rowData, event);\n };\n };\n\n var _width = props.width,\n data = props.data,\n _rowKey = props.rowKey,\n defaultExpandAllRows = props.defaultExpandAllRows,\n renderRowExpanded = props.renderRowExpanded,\n defaultExpandedRowKeys = props.defaultExpandedRowKeys,\n _props$children = props.children,\n children = _props$children === void 0 ? [] : _props$children,\n isTree = props.isTree,\n defaultSortType = props.defaultSortType;\n\n var _expandedRowKeys = defaultExpandAllRows ? Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"findRowKeys\"])(data, _rowKey, lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(renderRowExpanded)) : defaultExpandedRowKeys || [];\n\n var shouldFixedColumn = Array.from(lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(Object(react_is__WEBPACK_IMPORTED_MODULE_23__[\"isFragment\"])(children) ? children.props.children : children)).some(function (child) {\n return child && child.props && child.props.fixed;\n });\n\n if (isTree && !_rowKey) {\n throw new Error('The `rowKey` is required when set isTree');\n }\n\n _this.state = {\n isTree: isTree,\n expandedRowKeys: _expandedRowKeys,\n shouldFixedColumn: shouldFixedColumn,\n cacheData: data,\n data: isTree ? Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"flattenData\"])(data) : data,\n width: _width || 0,\n columnWidth: 0,\n dataKey: 0,\n contentHeight: 0,\n contentWidth: 0,\n tableRowsMaxHeight: [],\n sortType: defaultSortType,\n scrollY: 0,\n isScrolling: false,\n fixedHeader: false\n };\n _this.scrollY = 0;\n _this.scrollX = 0;\n _this.wheelHandler = new dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"WheelHandler\"](_this.listenWheel, _this.shouldHandleWheelX, _this.shouldHandleWheelY, false);\n _this._cacheChildrenSize = lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(children).length;\n _this.translateDOMPositionXY = Object(dom_lib_lib_transition_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_14__[\"getTranslateDOMPositionXY\"])({\n enable3DTransform: props.translate3d\n });\n _this.tableRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.scrollbarYRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.scrollbarXRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.tableBodyRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.affixHeaderWrapperRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.mouseAreaRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.headerWrapperRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.wheelWrapperRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n _this.tableHeaderRef = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createRef\"]();\n return _this;\n }\n\n var _proto = Table.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n var _this$props13, _this$props13$bodyRef;\n\n this.calculateTableWidth();\n this.calculateTableContextHeight();\n this.calculateRowMaxHeight();\n this.setOffsetByAffix();\n this.initPosition();\n element_resize_event__WEBPACK_IMPORTED_MODULE_13___default()(this.tableRef.current, lodash_debounce__WEBPACK_IMPORTED_MODULE_8___default()(this.calculateTableWidth, 400));\n var options = {\n passive: false\n };\n var tableBody = this.tableBodyRef.current;\n\n if (tableBody) {\n this.wheelListener = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"on\"])(tableBody, 'wheel', this.wheelHandler.onWheel, options);\n this.touchStartListener = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"on\"])(tableBody, 'touchstart', this.handleTouchStart, options);\n this.touchMoveListener = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"on\"])(tableBody, 'touchmove', this.handleTouchMove, options);\n }\n\n var _this$props12 = this.props,\n affixHeader = _this$props12.affixHeader,\n affixHorizontalScrollbar = _this$props12.affixHorizontalScrollbar;\n\n if (Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHeader) || Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isNumberOrTrue\"])(affixHorizontalScrollbar)) {\n this.scrollListener = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"on\"])(window, 'scroll', this.handleWindowScroll);\n }\n\n (_this$props13 = this.props) === null || _this$props13 === void 0 ? void 0 : (_this$props13$bodyRef = _this$props13.bodyRef) === null || _this$props13$bodyRef === void 0 ? void 0 : _this$props13$bodyRef.call(_this$props13, this.wheelWrapperRef.current);\n };\n\n _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {\n var _cacheChildrenSize = lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(nextProps.children || []).length;\n /**\n * 单元格列的信息在初始化后会被缓存,在某些属性被更新以后,需要清除缓存。\n */\n\n if (_cacheChildrenSize !== this._cacheChildrenSize) {\n this._cacheChildrenSize = _cacheChildrenSize;\n this._cacheCells = null;\n } else if (this.props.children !== nextProps.children || this.props.sortColumn !== nextProps.sortColumn || this.props.sortType !== nextProps.sortType) {\n this._cacheCells = null;\n }\n\n return !lodash_eq__WEBPACK_IMPORTED_MODULE_10___default()(this.props, nextProps) || !lodash_isEqual__WEBPACK_IMPORTED_MODULE_9___default()(this.state, nextState);\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n var rowHeight = prevProps.rowHeight,\n data = prevProps.data,\n height = prevProps.height;\n\n if (data !== this.props.data) {\n var _this$props$onDataUpd, _this$props14;\n\n this.calculateRowMaxHeight();\n (_this$props$onDataUpd = (_this$props14 = this.props).onDataUpdated) === null || _this$props$onDataUpd === void 0 ? void 0 : _this$props$onDataUpd.call(_this$props14, this.props.data, this.scrollTo);\n var maxHeight = this.props.data.length * (typeof rowHeight === 'function' ? rowHeight(null) : rowHeight); // 当开启允许更新滚动条,或者滚动条位置大于表格的最大高度,则初始滚动条位置\n\n if (this.props.shouldUpdateScroll || Math.abs(this.scrollY) > maxHeight) {\n this.scrollTo({\n x: 0,\n y: 0\n });\n }\n } else {\n this.updatePosition();\n }\n\n if ( // 当 Table 的 data 发生变化,需要重新计算高度\n data !== this.props.data || // 当 Table 的 height 属性发生变化,需要重新计算 Table 高度\n height !== this.props.height || // 当 Table 内容区的高度发生变化需要重新计算\n prevState.contentHeight !== this.state.contentHeight || // 当 expandedRowKeys 发生变化,需要重新计算 Table 高度,如果重算会导致滚动条不显示。\n prevState.expandedRowKeys !== this.state.expandedRowKeys || prevProps.expandedRowKeys !== this.props.expandedRowKeys) {\n this.calculateTableContextHeight(prevProps);\n }\n\n this.calculateTableContentWidth(prevProps);\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n var _this$wheelListener, _this$touchStartListe, _this$touchMoveListen, _this$scrollListener;\n\n this.wheelHandler = null;\n\n if (this.tableRef.current) {\n Object(element_resize_event__WEBPACK_IMPORTED_MODULE_13__[\"unbind\"])(this.tableRef.current);\n }\n\n (_this$wheelListener = this.wheelListener) === null || _this$wheelListener === void 0 ? void 0 : _this$wheelListener.off();\n (_this$touchStartListe = this.touchStartListener) === null || _this$touchStartListe === void 0 ? void 0 : _this$touchStartListe.off();\n (_this$touchMoveListen = this.touchMoveListener) === null || _this$touchMoveListen === void 0 ? void 0 : _this$touchMoveListen.off();\n (_this$scrollListener = this.scrollListener) === null || _this$scrollListener === void 0 ? void 0 : _this$scrollListener.off();\n };\n\n _proto.getExpandedRowKeys = function getExpandedRowKeys() {\n var expandedRowKeys = this.props.expandedRowKeys;\n return typeof expandedRowKeys === 'undefined' ? this.state.expandedRowKeys : expandedRowKeys;\n };\n\n _proto.getSortType = function getSortType() {\n var sortType = this.props.sortType;\n return typeof sortType === 'undefined' ? this.state.sortType : sortType;\n };\n\n _proto.getScrollCellGroups = function getScrollCellGroups() {\n var _this$tableRef$curren;\n\n return (_this$tableRef$curren = this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.querySelectorAll(\".\" + this.addPrefix('cell-group-scroll'));\n };\n\n _proto.getFixedLeftCellGroups = function getFixedLeftCellGroups() {\n var _this$tableRef$curren2;\n\n return (_this$tableRef$curren2 = this.tableRef.current) === null || _this$tableRef$curren2 === void 0 ? void 0 : _this$tableRef$curren2.querySelectorAll(\".\" + this.addPrefix('cell-group-fixed-left'));\n };\n\n _proto.getFixedRightCellGroups = function getFixedRightCellGroups() {\n var _this$tableRef$curren3;\n\n return (_this$tableRef$curren3 = this.tableRef.current) === null || _this$tableRef$curren3 === void 0 ? void 0 : _this$tableRef$curren3.querySelectorAll(\".\" + this.addPrefix('cell-group-fixed-right'));\n };\n\n _proto.isRTL = function isRTL() {\n return this.props.rtl || Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"isRTL\"])();\n };\n\n _proto.getRowHeight = function getRowHeight(rowData) {\n if (rowData === void 0) {\n rowData = {};\n }\n\n var rowHeight = this.props.rowHeight;\n return typeof rowHeight === 'function' ? rowHeight(rowData) : rowHeight;\n }\n /**\n * 获取表头高度\n */\n ;\n\n _proto.getTableHeaderHeight = function getTableHeaderHeight() {\n var _this$props15 = this.props,\n headerHeight = _this$props15.headerHeight,\n showHeader = _this$props15.showHeader;\n return showHeader ? headerHeight : 0;\n }\n /**\n * 获取 Table 需要渲染的高度\n */\n ;\n\n _proto.getTableHeight = function getTableHeight() {\n var contentHeight = this.state.contentHeight;\n var _this$props16 = this.props,\n minHeight = _this$props16.minHeight,\n height = _this$props16.height,\n autoHeight = _this$props16.autoHeight,\n data = _this$props16.data;\n var headerHeight = this.getTableHeaderHeight();\n\n if (data.length === 0 && autoHeight) {\n return height;\n }\n\n return autoHeight ? Math.max(headerHeight + contentHeight, minHeight) : height;\n }\n /**\n * 获取 columns ReactElement 数组\n * - 处理 children 中存在 <Column> 数组的情况\n * - 过滤 children 中的空项\n */\n ;\n\n _proto.getTableColumns = function getTableColumns(children) {\n if (!Array.isArray(children)) {\n if (Object(react_is__WEBPACK_IMPORTED_MODULE_23__[\"isFragment\"])(children)) {\n return this.getTableColumns(children.props.children);\n }\n\n return children;\n }\n\n var flattenColumns = lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(children).map(function (column) {\n if ((column === null || column === void 0 ? void 0 : column.type) === _ColumnGroup__WEBPACK_IMPORTED_MODULE_22__[\"default\"]) {\n var _column$props = column === null || column === void 0 ? void 0 : column.props,\n header = _column$props.header,\n childColumns = _column$props.children,\n align = _column$props.align,\n fixed = _column$props.fixed,\n verticalAlign = _column$props.verticalAlign;\n\n return childColumns.map(function (childColumn, index) {\n // 把 ColumnGroup 设置的属性覆盖到 Column\n var groupCellProps = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, childColumn === null || childColumn === void 0 ? void 0 : childColumn.props, {\n align: align,\n fixed: fixed,\n verticalAlign: verticalAlign\n });\n /**\n * 为分组中的第一列设置属性:\n * groupCount: 分组子项个数\n * groupHeader: 分组标题\n * resizable: 设置为不可自定义列宽\n */\n\n\n if (index === 0) {\n groupCellProps.groupCount = childColumns.length;\n groupCellProps.groupHeader = header;\n groupCellProps.resizable = false;\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"cloneElement\"](childColumn, groupCellProps);\n });\n }\n\n return column;\n }); // 把 Columns 中的数组,展平为一维数组,计算 lastColumn 与 firstColumn。\n\n return lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(flattenColumns).filter(function (col) {\n return col;\n });\n };\n\n _proto.getCellDescriptor = function getCellDescriptor() {\n var _this2 = this;\n\n if (this._cacheCells) {\n return this._cacheCells;\n }\n\n var hasCustomTreeCol = false;\n var left = 0; // Cell left margin\n\n var headerCells = []; // Table header cell\n\n var bodyCells = []; // Table body cell\n\n var children = this.props.children;\n\n if (!children) {\n this._cacheCells = {\n headerCells: headerCells,\n bodyCells: bodyCells,\n hasCustomTreeCol: hasCustomTreeCol,\n allColumnsWidth: left\n };\n return this._cacheCells;\n }\n\n var columns = this.getTableColumns(children);\n var tableWidth = this.state.width;\n var _this$props17 = this.props,\n sortColumn = _this$props17.sortColumn,\n rowHeight = _this$props17.rowHeight,\n showHeader = _this$props17.showHeader;\n\n var _getTotalByColumns = Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"getTotalByColumns\"])(columns),\n totalFlexGrow = _getTotalByColumns.totalFlexGrow,\n totalWidth = _getTotalByColumns.totalWidth;\n\n var headerHeight = this.getTableHeaderHeight();\n react__WEBPACK_IMPORTED_MODULE_3__[\"Children\"].forEach(columns, function (column, index) {\n if ( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"isValidElement\"](column)) {\n var columnChildren = column.props.children;\n var _column$props2 = column.props,\n width = _column$props2.width,\n resizable = _column$props2.resizable,\n flexGrow = _column$props2.flexGrow,\n minWidth = _column$props2.minWidth,\n onResize = _column$props2.onResize,\n treeCol = _column$props2.treeCol;\n\n if (treeCol) {\n hasCustomTreeCol = true;\n }\n\n if (resizable && flexGrow) {\n console.warn(\"Cannot set 'resizable' and 'flexGrow' together in <Column>, column index: \" + index);\n }\n\n if (columnChildren.length !== 2) {\n throw new Error(\"Component <HeaderCell> and <Cell> is required, column index: \" + index + \" \");\n }\n\n var nextWidth = _this2.state[columnChildren[1].props.dataKey + \"_\" + index + \"_width\"] || width || 0;\n\n if (tableWidth && flexGrow && totalFlexGrow) {\n nextWidth = Math.max((tableWidth - totalWidth) / totalFlexGrow * flexGrow, minWidth || 60);\n }\n\n var cellProps = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, lodash_omit__WEBPACK_IMPORTED_MODULE_11___default()(column.props, ['children']), {\n 'aria-colindex': index + 1,\n left: left,\n headerHeight: headerHeight,\n key: index,\n width: nextWidth,\n height: rowHeight,\n firstColumn: index === 0,\n lastColumn: index === columns.length - 1\n });\n\n if (showHeader && headerHeight) {\n var headerCellProps = {\n // index 用于拖拽列宽时候(Resizable column),定义的序号\n index: index,\n dataKey: columnChildren[1].props.dataKey,\n isHeaderCell: true,\n sortable: column.props.sortable,\n onSortColumn: _this2.handleSortColumn,\n sortType: _this2.getSortType(),\n sortColumn: sortColumn,\n flexGrow: flexGrow\n };\n\n if (resizable) {\n lodash_merge__WEBPACK_IMPORTED_MODULE_12___default()(headerCellProps, {\n onResize: onResize,\n onColumnResizeEnd: _this2.handleColumnResizeEnd,\n onColumnResizeStart: _this2.handleColumnResizeStart,\n onColumnResizeMove: _this2.handleColumnResizeMove\n });\n }\n\n headerCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"cloneElement\"](columnChildren[0], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, cellProps, headerCellProps)));\n }\n\n bodyCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"cloneElement\"](columnChildren[1], cellProps));\n left += nextWidth;\n }\n });\n return this._cacheCells = {\n headerCells: headerCells,\n bodyCells: bodyCells,\n allColumnsWidth: left,\n hasCustomTreeCol: hasCustomTreeCol\n };\n };\n\n _proto.initPosition = function initPosition() {\n var _this3 = this;\n\n if (this.isRTL()) {\n setTimeout(function () {\n var _this3$scrollbarXRef, _this3$scrollbarXRef$, _this3$scrollbarXRef$2;\n\n var _this3$state = _this3.state,\n contentWidth = _this3$state.contentWidth,\n width = _this3$state.width;\n _this3.scrollX = width - contentWidth - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"];\n\n _this3.updatePosition();\n\n (_this3$scrollbarXRef = _this3.scrollbarXRef) === null || _this3$scrollbarXRef === void 0 ? void 0 : (_this3$scrollbarXRef$ = _this3$scrollbarXRef.current) === null || _this3$scrollbarXRef$ === void 0 ? void 0 : (_this3$scrollbarXRef$2 = _this3$scrollbarXRef$.resetScrollBarPosition) === null || _this3$scrollbarXRef$2 === void 0 ? void 0 : _this3$scrollbarXRef$2.call(_this3$scrollbarXRef$, -_this3.scrollX);\n }, 0);\n }\n };\n\n _proto.updatePosition = function updatePosition() {\n var _this$tableHeaderRef;\n\n /**\n * 当存在锁定列情况处理\n */\n if (this.state.shouldFixedColumn) {\n this.updatePositionByFixedCell();\n } else {\n var _this$wheelWrapperRef, _this$headerWrapperRe2, _this$affixHeaderWrap, _affixHeaderElement$h;\n\n var wheelStyle = {};\n var headerStyle = {};\n this.translateDOMPositionXY(wheelStyle, this.scrollX, this.scrollY);\n this.translateDOMPositionXY(headerStyle, this.scrollX, 0);\n var wheelElement = (_this$wheelWrapperRef = this.wheelWrapperRef) === null || _this$wheelWrapperRef === void 0 ? void 0 : _this$wheelWrapperRef.current;\n var headerElement = (_this$headerWrapperRe2 = this.headerWrapperRef) === null || _this$headerWrapperRe2 === void 0 ? void 0 : _this$headerWrapperRe2.current;\n var affixHeaderElement = (_this$affixHeaderWrap = this.affixHeaderWrapperRef) === null || _this$affixHeaderWrap === void 0 ? void 0 : _this$affixHeaderWrap.current;\n wheelElement && Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(wheelElement, wheelStyle);\n headerElement && Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(headerElement, headerStyle);\n\n if (affixHeaderElement !== null && affixHeaderElement !== void 0 && (_affixHeaderElement$h = affixHeaderElement.hasChildNodes) !== null && _affixHeaderElement$h !== void 0 && _affixHeaderElement$h.call(affixHeaderElement)) {\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(affixHeaderElement.firstChild, headerStyle);\n }\n }\n\n if ((_this$tableHeaderRef = this.tableHeaderRef) !== null && _this$tableHeaderRef !== void 0 && _this$tableHeaderRef.current) {\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"toggleClass\"])(this.tableHeaderRef.current, this.addPrefix('cell-group-shadow'), this.scrollY < 0);\n }\n };\n\n _proto.updatePositionByFixedCell = function updatePositionByFixedCell() {\n var _this$wheelWrapperRef2;\n\n var wheelGroupStyle = {};\n var wheelStyle = {};\n var scrollGroups = this.getScrollCellGroups();\n var fixedLeftGroups = this.getFixedLeftCellGroups();\n var fixedRightGroups = this.getFixedRightCellGroups();\n var _this$state4 = this.state,\n contentWidth = _this$state4.contentWidth,\n width = _this$state4.width;\n this.translateDOMPositionXY(wheelGroupStyle, this.scrollX, 0);\n this.translateDOMPositionXY(wheelStyle, 0, this.scrollY);\n var scrollArrayGroups = Array.from(scrollGroups);\n\n for (var i = 0; i < scrollArrayGroups.length; i++) {\n var group = scrollArrayGroups[i];\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(group, wheelGroupStyle);\n }\n\n if ((_this$wheelWrapperRef2 = this.wheelWrapperRef) !== null && _this$wheelWrapperRef2 !== void 0 && _this$wheelWrapperRef2.current) {\n Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"addStyle\"])(this.wheelWrapperRef.current, wheelStyle);\n }\n\n var leftShadowClassName = this.addPrefix('cell-group-left-shadow');\n var rightShadowClassName = this.addPrefix('cell-group-right-shadow');\n var showLeftShadow = this.scrollX < 0;\n var showRightShadow = width - contentWidth - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"] !== this.scrollX;\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"toggleClass\"])(fixedLeftGroups, leftShadowClassName, showLeftShadow);\n Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"toggleClass\"])(fixedRightGroups, rightShadowClassName, showRightShadow);\n };\n\n _proto.shouldRenderExpandedRow = function shouldRenderExpandedRow(rowData) {\n var _this$props18 = this.props,\n rowKey = _this$props18.rowKey,\n renderRowExpanded = _this$props18.renderRowExpanded,\n isTree = _this$props18.isTree;\n var expandedRowKeys = this.getExpandedRowKeys() || [];\n return lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(renderRowExpanded) && !isTree && expandedRowKeys.some(function (key) {\n return key === rowData[rowKey];\n });\n };\n\n _proto.calculateRowMaxHeight = function calculateRowMaxHeight() {\n var wordWrap = this.props.wordWrap;\n\n if (wordWrap) {\n var tableRowsMaxHeight = [];\n var tableRows = Object.values(this.tableRows);\n\n for (var i = 0; i < tableRows.length; i++) {\n var _tableRows$i = tableRows[i],\n row = _tableRows$i[0];\n\n if (row) {\n var cells = row.querySelectorAll(\".\" + this.addPrefix('cell-wrap')) || [];\n var cellArray = Array.from(cells);\n var maxHeight = 0;\n\n for (var j = 0; j < cellArray.length; j++) {\n var cell = cellArray[j];\n var h = Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getHeight\"])(cell);\n maxHeight = Math.max(maxHeight, h);\n }\n\n tableRowsMaxHeight.push(maxHeight);\n }\n }\n\n this.setState({\n tableRowsMaxHeight: tableRowsMaxHeight\n });\n }\n };\n\n _proto.calculateTableContentWidth = function calculateTableContentWidth(prevProps) {\n var _this$tableRef3;\n\n var table = (_this$tableRef3 = this.tableRef) === null || _this$tableRef3 === void 0 ? void 0 : _this$tableRef3.current;\n var row = table.querySelector(\".\" + this.addPrefix('row') + \":not(.virtualized)\");\n var contentWidth = row ? Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getWidth\"])(row) : 0;\n this.setState({\n contentWidth: contentWidth\n }); // 这里 -SCROLLBAR_WIDTH 是为了让滚动条不挡住内容部分\n\n this.minScrollX = -(contentWidth - this.state.width) - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"];\n /**\n * 1.判断 Table 列数是否发生变化\n * 2.判断 Table 内容区域是否宽度有变化\n *\n * 满足 1 和 2 则更新横向滚动条位置\n */\n\n if (lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(this.props.children).length !== lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(prevProps.children).length && this.state.contentWidth !== contentWidth) {\n this.scrollLeft(0);\n }\n };\n\n _proto.calculateTableContextHeight = function calculateTableContextHeight(prevProps) {\n var table = this.tableRef.current;\n var rows = table.querySelectorAll(\".\" + this.addPrefix('row')) || [];\n var _this$props19 = this.props,\n height = _this$props19.height,\n autoHeight = _this$props19.autoHeight,\n rowHeight = _this$props19.rowHeight,\n affixHeader = _this$props19.affixHeader;\n var headerHeight = this.getTableHeaderHeight();\n var contentHeight = rows.length ? Array.from(rows).map(function (row) {\n return Object(dom_lib__WEBPACK_IMPORTED_MODULE_15__[\"getHeight\"])(row) || rowHeight;\n }).reduce(function (x, y) {\n return x + y;\n }) : 0; // 当设置 affixHeader 属性后要减掉两个 header 的高度\n\n var nextContentHeight = contentHeight - (affixHeader ? headerHeight * 2 : headerHeight);\n\n if (nextContentHeight !== this.state.contentHeight) {\n this.setState({\n contentHeight: nextContentHeight\n });\n }\n\n if (prevProps && ( // 当 data 更新,或者表格高度更新,则更新滚动条\n prevProps.height !== height || prevProps.data !== this.props.data) && this.scrollY !== 0) {\n this.scrollTop(Math.abs(this.scrollY));\n this.updatePosition();\n }\n\n if (!autoHeight) {\n // 这里 -SCROLLBAR_WIDTH 是为了让滚动条不挡住内容部分\n this.minScrollY = -(contentHeight - height) - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"];\n } // 如果内容区域的高度小于表格的高度,则重置 Y 坐标滚动条\n\n\n if (contentHeight < height) {\n this.scrollTop(0);\n } // 如果 scrollTop 的值大于可以滚动的范围 ,则重置 Y 坐标滚动条\n // 当 Table 为 virtualized 时, wheel 事件触发每次都会进入该逻辑, 避免在滚动到底部后滚动条重置, +SCROLLBAR_WIDTH\n\n\n if (Math.abs(this.scrollY) + height - headerHeight > nextContentHeight + _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"]) {\n this.scrollTop(this.scrollY);\n }\n };\n\n _proto.getControlledScrollTopValue = function getControlledScrollTopValue(value) {\n if (this.props.autoHeight) {\n return [0, 0];\n }\n\n var contentHeight = this.state.contentHeight;\n var headerHeight = this.getTableHeaderHeight();\n var height = this.getTableHeight(); // 滚动值的最大范围判断\n\n value = Math.min(value, Math.max(0, contentHeight - (height - headerHeight))); // value 值是表格理论滚动位置的一个值,通过 value 计算出 scrollY 坐标值与滚动条位置的值\n\n return [-value, value / contentHeight * (height - headerHeight)];\n };\n\n _proto.getControlledScrollLeftValue = function getControlledScrollLeftValue(value) {\n var _this$state5 = this.state,\n contentWidth = _this$state5.contentWidth,\n width = _this$state5.width; // 滚动值的最大范围判断\n\n value = Math.min(value, Math.max(0, contentWidth - width));\n return [-value, value / contentWidth * width];\n }\n /**\n * public method\n */\n ;\n\n _proto.renderRowData = function renderRowData(bodyCells, rowData, props, shouldRenderExpandedRow) {\n var _this$props20 = this.props,\n renderTreeToggle = _this$props20.renderTreeToggle,\n rowKey = _this$props20.rowKey,\n wordWrap = _this$props20.wordWrap,\n isTree = _this$props20.isTree;\n var hasChildren = isTree && rowData.children && Array.isArray(rowData.children);\n var nextRowKey = typeof rowData[rowKey] !== 'undefined' ? rowData[rowKey] : props.key;\n\n var rowProps = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, props, {\n key: nextRowKey,\n 'aria-rowindex': props.key + 2,\n rowRef: this.bindTableRowsRef(props.key, rowData),\n onClick: this.bindRowClick(rowData),\n onContextMenu: this.bindRowContextMenu(rowData)\n });\n\n var expandedRowKeys = this.getExpandedRowKeys() || [];\n var expanded = expandedRowKeys.some(function (key) {\n return key === rowData[rowKey];\n });\n var cells = [];\n\n for (var i = 0; i < bodyCells.length; i++) {\n var cell = bodyCells[i];\n cells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"cloneElement\"](cell, {\n hasChildren: hasChildren,\n rowData: rowData,\n wordWrap: wordWrap,\n renderTreeToggle: renderTreeToggle,\n height: props.height,\n rowIndex: props.key,\n depth: props.depth,\n onTreeToggle: this.handleTreeToggle,\n rowKey: nextRowKey,\n expanded: expanded\n }));\n }\n\n return this.renderRow(rowProps, cells, shouldRenderExpandedRow, rowData);\n };\n\n _proto.renderRow = function renderRow(props, cells, shouldRenderExpandedRow, rowData) {\n var rowClassName = this.props.rowClassName;\n var _this$state6 = this.state,\n shouldFixedColumn = _this$state6.shouldFixedColumn,\n width = _this$state6.width,\n contentWidth = _this$state6.contentWidth;\n\n var depth = props.depth,\n restRowProps = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(props, [\"depth\"]);\n\n if (typeof rowClassName === 'function') {\n restRowProps.className = rowClassName(rowData);\n } else {\n restRowProps.className = rowClassName;\n }\n\n var rowStyles = {};\n var rowRight = 0;\n\n if (this.isRTL() && contentWidth > width) {\n rowRight = width - contentWidth;\n rowStyles.right = rowRight;\n } // IF there are fixed columns, add a fixed group\n\n\n if (shouldFixedColumn && contentWidth > width) {\n var fixedLeftCells = [];\n var fixedRightCells = [];\n var scrollCells = [];\n var fixedLeftCellGroupWidth = 0;\n var fixedRightCellGroupWidth = 0;\n\n for (var i = 0; i < cells.length; i++) {\n var cell = cells[i];\n var _cell$props = cell.props,\n fixed = _cell$props.fixed,\n _width2 = _cell$props.width;\n var isFixedStart = fixed === 'left' || fixed === true;\n var isFixedEnd = fixed === 'right';\n\n if (this.isRTL()) {\n isFixedStart = fixed === 'right';\n isFixedEnd = fixed === 'left' || fixed === true;\n }\n\n if (isFixedStart) {\n fixedLeftCells.push(cell);\n fixedLeftCellGroupWidth += _width2;\n } else if (isFixedEnd) {\n fixedRightCells.push(cell);\n fixedRightCellGroupWidth += _width2;\n } else {\n scrollCells.push(cell);\n }\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Row__WEBPACK_IMPORTED_MODULE_16__[\"default\"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, restRowProps, {\n \"data-depth\": depth,\n style: rowStyles\n }), fixedLeftCellGroupWidth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_CellGroup__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n fixed: \"left\",\n height: props.isHeaderRow ? props.headerHeight : props.height,\n width: fixedLeftCellGroupWidth,\n style: this.isRTL() ? {\n right: width - fixedLeftCellGroupWidth - rowRight\n } : null\n }, Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"mergeCells\"])(Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"resetLeftForCells\"])(fixedLeftCells))) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_CellGroup__WEBPACK_IMPORTED_MODULE_17__[\"default\"], null, Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"mergeCells\"])(scrollCells)), fixedRightCellGroupWidth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_CellGroup__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n fixed: \"right\",\n style: this.isRTL() ? {\n right: 0 - rowRight\n } : {\n left: width - fixedRightCellGroupWidth - _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"]\n },\n height: props.isHeaderRow ? props.headerHeight : props.height,\n width: fixedRightCellGroupWidth + _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"]\n }, Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"mergeCells\"])(Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"resetLeftForCells\"])(fixedRightCells, _constants__WEBPACK_IMPORTED_MODULE_20__[\"SCROLLBAR_WIDTH\"]))) : null, shouldRenderExpandedRow && this.renderRowExpanded(rowData));\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Row__WEBPACK_IMPORTED_MODULE_16__[\"default\"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({}, restRowProps, {\n \"data-depth\": depth,\n style: rowStyles\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_CellGroup__WEBPACK_IMPORTED_MODULE_17__[\"default\"], null, Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"mergeCells\"])(cells)), shouldRenderExpandedRow && this.renderRowExpanded(rowData));\n };\n\n _proto.renderRowExpanded = function renderRowExpanded(rowData) {\n var _this$props21 = this.props,\n renderRowExpanded = _this$props21.renderRowExpanded,\n rowExpandedHeight = _this$props21.rowExpandedHeight;\n var styles = {\n height: rowExpandedHeight\n };\n\n if (typeof renderRowExpanded === 'function') {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: this.addPrefix('row-expanded'),\n style: styles\n }, renderRowExpanded(rowData));\n }\n\n return null;\n };\n\n _proto.renderMouseArea = function renderMouseArea() {\n var headerHeight = this.getTableHeaderHeight();\n var styles = {\n height: this.getTableHeight()\n };\n var spanStyles = {\n height: headerHeight - 1\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n ref: this.mouseAreaRef,\n className: this.addPrefix('mouse-area'),\n style: styles\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"span\", {\n style: spanStyles\n }));\n };\n\n _proto.renderTableHeader = function renderTableHeader(headerCells, rowWidth) {\n var affixHeader = this.props.affixHeader;\n var tableWidth = this.state.width;\n var top = typeof affixHeader === 'number' ? affixHeader : 0;\n var headerHeight = this.getTableHeaderHeight();\n var rowProps = {\n 'aria-rowindex': 1,\n rowRef: this.tableHeaderRef,\n width: rowWidth,\n height: this.getRowHeight(),\n headerHeight: headerHeight,\n isHeaderRow: true,\n top: 0\n };\n var fixedStyle = {\n position: 'fixed',\n overflow: 'hidden',\n height: this.getTableHeaderHeight(),\n width: tableWidth,\n top: top\n }; // Affix header\n\n var header = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: classnames__WEBPACK_IMPORTED_MODULE_5___default()(this.addPrefix('affix-header')),\n style: fixedStyle,\n ref: this.affixHeaderWrapperRef\n }, this.renderRow(rowProps, headerCells));\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_3__[\"Fragment\"], null, (affixHeader === 0 || affixHeader) && header, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n role: \"rowgroup\",\n className: this.addPrefix('header-row-wrapper'),\n ref: this.headerWrapperRef\n }, this.renderRow(rowProps, headerCells)));\n };\n\n _proto.renderTableBody = function renderTableBody(bodyCells, rowWidth) {\n var _this$props22 = this.props,\n rowExpandedHeight = _this$props22.rowExpandedHeight,\n renderRowExpanded = _this$props22.renderRowExpanded,\n isTree = _this$props22.isTree,\n rowKey = _this$props22.rowKey,\n wordWrap = _this$props22.wordWrap,\n virtualized = _this$props22.virtualized,\n rowHeight = _this$props22.rowHeight;\n var headerHeight = this.getTableHeaderHeight();\n var _this$state7 = this.state,\n tableRowsMaxHeight = _this$state7.tableRowsMaxHeight,\n isScrolling = _this$state7.isScrolling,\n data = _this$state7.data;\n var height = this.getTableHeight();\n var bodyHeight = height - headerHeight;\n var bodyStyles = {\n top: headerHeight,\n height: bodyHeight\n };\n var contentHeight = 0;\n var topHideHeight = 0;\n var bottomHideHeight = 0;\n this._visibleRows = [];\n\n if (data) {\n var top = 0; // Row position\n\n var minTop = Math.abs(this.scrollY);\n var maxTop = minTop + height + rowExpandedHeight;\n var isCustomRowHeight = typeof rowHeight === 'function';\n var isUncertainHeight = !!(renderRowExpanded || isCustomRowHeight || isTree);\n /**\n 如果开启了 virtualized 同时 Table 中的的行高是可变的,\n 则需要循环遍历 data, 获取每一行的高度。\n */\n\n if (isUncertainHeight && virtualized || !virtualized) {\n for (var index = 0; index < data.length; index++) {\n var rowData = data[index];\n var maxHeight = tableRowsMaxHeight[index];\n var shouldRenderExpandedRow = this.shouldRenderExpandedRow(rowData);\n var nextRowHeight = 0;\n var depth = 0;\n\n if (typeof rowHeight === 'function') {\n nextRowHeight = rowHeight(rowData);\n } else {\n nextRowHeight = maxHeight ? Math.max(maxHeight + _constants__WEBPACK_IMPORTED_MODULE_20__[\"CELL_PADDING_HEIGHT\"], rowHeight) : rowHeight;\n\n if (shouldRenderExpandedRow) {\n nextRowHeight += rowExpandedHeight;\n }\n }\n\n if (isTree) {\n var parents = Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"findAllParents\"])(rowData, rowKey);\n var expandedRowKeys = this.getExpandedRowKeys();\n depth = parents.length; // 如果是 Tree Table, 判断当前的行是否展开/折叠,如果是折叠则不显示该行。\n\n if (!Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"shouldShowRowByExpanded\"])(expandedRowKeys, parents)) {\n continue;\n }\n }\n\n contentHeight += nextRowHeight;\n var rowProps = {\n key: index,\n top: top,\n width: rowWidth,\n depth: depth,\n height: nextRowHeight\n };\n top += nextRowHeight;\n\n if (virtualized && !wordWrap) {\n if (top + nextRowHeight < minTop) {\n topHideHeight += nextRowHeight;\n continue;\n } else if (top > maxTop) {\n bottomHideHeight += nextRowHeight;\n continue;\n }\n }\n\n this._visibleRows.push(this.renderRowData(bodyCells, rowData, rowProps, shouldRenderExpandedRow));\n }\n } else {\n /**\n 如果 Table 的行高是固定的,则直接通过行高与行数进行计算,\n 减少遍历所有 data 带来的性能消耗\n */\n var _nextRowHeight = this.getRowHeight();\n\n var startIndex = Math.max(Math.floor(minTop / _nextRowHeight), 0);\n var endIndex = Math.min(startIndex + Math.ceil(bodyHeight / _nextRowHeight), data.length);\n contentHeight = data.length * _nextRowHeight;\n topHideHeight = startIndex * _nextRowHeight;\n bottomHideHeight = (data.length - endIndex) * _nextRowHeight;\n\n for (var _index = startIndex; _index < endIndex; _index++) {\n var _rowData = data[_index];\n var _rowProps = {\n key: _index,\n top: _index * _nextRowHeight,\n width: rowWidth,\n height: _nextRowHeight\n };\n\n this._visibleRows.push(this.renderRowData(bodyCells, _rowData, _rowProps, false));\n }\n }\n }\n\n var wheelStyles = {\n position: 'absolute',\n height: contentHeight,\n minHeight: height,\n pointerEvents: isScrolling ? 'none' : undefined\n };\n var topRowStyles = {\n height: topHideHeight\n };\n var bottomRowStyles = {\n height: bottomHideHeight\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n ref: this.tableBodyRef,\n role: \"rowgroup\",\n className: this.addPrefix('body-row-wrapper'),\n style: bodyStyles,\n onScroll: this.handleBodyScroll\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n style: wheelStyles,\n className: this.addPrefix('body-wheel-area'),\n ref: this.wheelWrapperRef\n }, topHideHeight ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Row__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n style: topRowStyles,\n className: \"virtualized\"\n }) : null, this._visibleRows, bottomHideHeight ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Row__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n style: bottomRowStyles,\n className: \"virtualized\"\n }) : null), this.renderInfo(), this.renderScrollbar(), this.renderLoading());\n };\n\n _proto.renderInfo = function renderInfo() {\n var _this$props23 = this.props,\n locale = _this$props23.locale,\n renderEmpty = _this$props23.renderEmpty,\n loading = _this$props23.loading;\n\n if (this._visibleRows.length || loading) {\n return null;\n }\n\n var emptyMessage = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: this.addPrefix('body-info')\n }, locale.emptyMessage);\n return renderEmpty ? renderEmpty(emptyMessage) : emptyMessage;\n };\n\n _proto.renderScrollbar = function renderScrollbar() {\n var _this$props24 = this.props,\n disabledScroll = _this$props24.disabledScroll,\n affixHorizontalScrollbar = _this$props24.affixHorizontalScrollbar,\n id = _this$props24.id;\n var _this$state8 = this.state,\n contentWidth = _this$state8.contentWidth,\n contentHeight = _this$state8.contentHeight,\n width = _this$state8.width,\n fixedHorizontalScrollbar = _this$state8.fixedHorizontalScrollbar;\n var bottom = typeof affixHorizontalScrollbar === 'number' ? affixHorizontalScrollbar : 0;\n var headerHeight = this.getTableHeaderHeight();\n var height = this.getTableHeight();\n\n if (disabledScroll) {\n return null;\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Scrollbar__WEBPACK_IMPORTED_MODULE_18__[\"default\"], {\n tableId: id,\n className: classnames__WEBPACK_IMPORTED_MODULE_5___default()({\n fixed: fixedHorizontalScrollbar\n }),\n style: {\n width: width,\n bottom: fixedHorizontalScrollbar ? bottom : undefined\n },\n length: this.state.width,\n onScroll: this.handleScrollX,\n scrollLength: contentWidth,\n ref: this.scrollbarXRef\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_Scrollbar__WEBPACK_IMPORTED_MODULE_18__[\"default\"], {\n vertical: true,\n tableId: id,\n length: height - headerHeight,\n scrollLength: contentHeight,\n onScroll: this.handleScrollY,\n ref: this.scrollbarYRef\n }));\n }\n /**\n * show loading\n */\n ;\n\n _proto.renderLoading = function renderLoading() {\n var _this$props25 = this.props,\n locale = _this$props25.locale,\n loading = _this$props25.loading,\n loadAnimation = _this$props25.loadAnimation,\n renderLoading = _this$props25.renderLoading;\n\n if (!loadAnimation && !loading) {\n return null;\n }\n\n var loadingElement = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: this.addPrefix('loader-wrapper')\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", {\n className: this.addPrefix('loader')\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"i\", {\n className: this.addPrefix('loader-icon')\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"span\", {\n className: this.addPrefix('loader-text')\n }, locale.loading)));\n return renderLoading ? renderLoading(loadingElement) : loadingElement;\n };\n\n _proto.render = function render() {\n var _classNames;\n\n var _this$props26 = this.props,\n children = _this$props26.children,\n className = _this$props26.className,\n data = _this$props26.data,\n _this$props26$width = _this$props26.width,\n width = _this$props26$width === void 0 ? 0 : _this$props26$width,\n style = _this$props26.style,\n isTree = _this$props26.isTree,\n hover = _this$props26.hover,\n bordered = _this$props26.bordered,\n cellBordered = _this$props26.cellBordered,\n wordWrap = _this$props26.wordWrap,\n classPrefix = _this$props26.classPrefix,\n loading = _this$props26.loading,\n showHeader = _this$props26.showHeader,\n rest = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(_this$props26, [\"children\", \"className\", \"data\", \"width\", \"style\", \"isTree\", \"hover\", \"bordered\", \"cellBordered\", \"wordWrap\", \"classPrefix\", \"loading\", \"showHeader\"]);\n\n var isColumnResizing = this.state.isColumnResizing;\n\n var _this$getCellDescript = this.getCellDescriptor(),\n headerCells = _this$getCellDescript.headerCells,\n bodyCells = _this$getCellDescript.bodyCells,\n allColumnsWidth = _this$getCellDescript.allColumnsWidth,\n hasCustomTreeCol = _this$getCellDescript.hasCustomTreeCol;\n\n var rowWidth = allColumnsWidth > width ? allColumnsWidth : width;\n var clesses = classnames__WEBPACK_IMPORTED_MODULE_5___default()(classPrefix, className, (_classNames = {}, _classNames[this.addPrefix('word-wrap')] = wordWrap, _classNames[this.addPrefix('treetable')] = isTree, _classNames[this.addPrefix('bordered')] = bordered, _classNames[this.addPrefix('cell-bordered')] = cellBordered, _classNames[this.addPrefix('column-resizing')] = isColumnResizing, _classNames[this.addPrefix('hover')] = hover, _classNames[this.addPrefix('loading')] = loading, _classNames));\n\n var styles = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n width: width || 'auto',\n height: this.getTableHeight()\n }, style);\n\n var unhandled = Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"getUnhandledProps\"])(propTypes, rest);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](_TableContext__WEBPACK_IMPORTED_MODULE_19__[\"default\"].Provider, {\n value: {\n translateDOMPositionXY: this.translateDOMPositionXY,\n rtl: this.isRTL(),\n isTree: isTree,\n hasCustomTreeCol: hasCustomTreeCol\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__[\"createElement\"](\"div\", Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])({\n role: isTree ? 'treegrid' : 'grid' // The aria-rowcount is specified on the element with the table.\n // Its value is an integer equal to the total number of rows available, including header rows.\n ,\n \"aria-rowcount\": data.length + 1,\n \"aria-colcount\": this._cacheChildrenSize\n }, unhandled, {\n className: clesses,\n style: styles,\n ref: this.tableRef\n }), showHeader && this.renderTableHeader(headerCells, rowWidth), children && this.renderTableBody(bodyCells, rowWidth), showHeader && this.renderMouseArea()));\n };\n\n return Table;\n}(react__WEBPACK_IMPORTED_MODULE_3__[\"Component\"]);\n\nTable.propTypes = propTypes;\nTable.defaultProps = {\n classPrefix: Object(_utils__WEBPACK_IMPORTED_MODULE_21__[\"defaultClassPrefix\"])('table'),\n data: [],\n defaultSortType: SORT_TYPE.DESC,\n height: 200,\n rowHeight: 46,\n headerHeight: 40,\n minHeight: 0,\n rowExpandedHeight: 100,\n hover: true,\n showHeader: true,\n rowKey: 'key',\n translate3d: true,\n shouldUpdateScroll: true,\n locale: {\n emptyMessage: 'No data found',\n loading: 'Loading...'\n }\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (Table);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/Table.js?");
|
|
5090
5090
|
|
|
5091
5091
|
/***/ }),
|
|
5092
5092
|
|
|
@@ -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: 1073\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 _this$state2 = this.state,\n searchKeyword = _this$state2.searchKeyword,\n expandItemValues = _this$state2.expandItemValues;\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 expand: expandItemValues\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$state3 = this.state,\n data = _this$state3.data,\n selectedValues = _this$state3.selectedValues,\n expandItemValues = _this$state3.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$state4 = this.state,\n data = _this$state4.data,\n selectedValues = _this$state4.selectedValues,\n expandItemValues = _this$state4.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: 925\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: 934\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$state5 = this.state,\n activeNode = _this$state5.activeNode,\n searchKeyword = _this$state5.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: 1005\n },\n __self: this\n }, React.createElement(_CheckTreeNode.default, (0, _extends2.default)({}, props, {\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1006\n },\n __self: this\n })), React.createElement(\"div\", {\n className: this.addTreePrefix('children'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1007\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: 1014\n },\n __self: this\n }));\n };\n\n _proto.renderVirtualNode = function renderVirtualNode(node, options) {\n var _this$state6 = this.state,\n activeNode = _this$state6.activeNode,\n expandAll = _this$state6.expandAll,\n searchKeyword = _this$state6.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: 1059\n },\n __self: this\n }));\n };\n\n _proto.renderCheckTree = function renderCheckTree() {\n var _classNames2,\n _this11 = this,\n _classNames3;\n\n var _this$state7 = this.state,\n filterData = _this$state7.filterData,\n isSomeNodeHasChildren = _this$state7.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: 1107\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: 1112\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: 1126\n },\n __self: this\n }, React.createElement(\"div\", {\n className: treeNodesClass,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1133\n },\n __self: this\n }, virtualized ? React.createElement(_AutoSizer.default, {\n defaultHeight: listHeight,\n defaultWidth: treeWidth,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1135\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: 1137\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$state8 = this.state,\n hasValue = _this$state8.hasValue,\n selectedValues = _this$state8.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: 1188\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: 1219\n },\n __self: this\n }, React.createElement(\"div\", {\n className: classes,\n style: style,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 1227\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: 1228\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: 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?");
|
|
7652
7652
|
|
|
7653
7653
|
/***/ }),
|
|
7654
7654
|
|
|
@@ -9772,7 +9772,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
|
|
|
9772
9772
|
/***/ (function(module, exports, __webpack_require__) {
|
|
9773
9773
|
|
|
9774
9774
|
"use strict";
|
|
9775
|
-
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 _isFunction2 = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _isNil2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _omit2 = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _pick2 = _interopRequireDefault(__webpack_require__(/*! lodash/pick */ \"./node_modules/lodash/pick.js\"));\n\nvar _isUndefined2 = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.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 _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Picker = __webpack_require__(/*! ../Picker */ \"./src/Picker/index.ts\");\n\nvar _DropdownMenu = _interopRequireWildcard(__webpack_require__(/*! ../Picker/DropdownMenu */ \"./src/Picker/DropdownMenu.tsx\"));\n\nvar _propTypes2 = __webpack_require__(/*! ../Picker/propTypes */ \"./src/Picker/propTypes.ts\");\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/SelectPicker/SelectPicker.tsx\";\n\nvar SelectPicker =\n/*#__PURE__*/\nfunction (_React$Component) {\n (0, _inheritsLoose2.default)(SelectPicker, _React$Component);\n\n function SelectPicker(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.positionRef = void 0;\n _this.menuContainerRef = void 0;\n _this.searchBarContainerRef = void 0;\n _this.toggleRef = void 0;\n _this.triggerRef = void 0;\n\n _this.getFocusableMenuItems = function () {\n var menuItems = _this.menuContainerRef.current.menuItems;\n\n if (!menuItems) {\n return [];\n }\n\n var items = Object.values(menuItems).map(function (item) {\n return item.props.getItemData();\n });\n return (0, _treeUtils.filterNodesOfTree)(items, function (item) {\n return _this.shouldDisplay(item);\n });\n };\n\n _this.getToggleInstance = function () {\n return _this.toggleRef.current;\n };\n\n _this.getPositionInstance = function () {\n return _this.positionRef.current;\n };\n\n _this.focusNextMenuItem = function () {\n var valueKey = _this.props.valueKey;\n\n _this.findNode(function (items, index) {\n var focusItem = items[index + 1];\n\n if (!(0, _isUndefined2.default)(focusItem)) {\n _this.setState({\n focusItemValue: focusItem[valueKey]\n });\n }\n });\n };\n\n _this.focusPrevMenuItem = function () {\n var valueKey = _this.props.valueKey;\n\n _this.findNode(function (items, index) {\n var focusItem = items[index - 1];\n\n if (!(0, _isUndefined2.default)(focusItem)) {\n _this.setState({\n focusItemValue: focusItem[valueKey]\n });\n }\n });\n };\n\n _this.selectFocusMenuItem = function (event) {\n var focusItemValue = _this.state.focusItemValue;\n var _this$props = _this.props,\n data = _this$props.data,\n valueKey = _this$props.valueKey;\n\n if (!focusItemValue) {\n return;\n } // Find active `MenuItem` by `value`\n\n\n var focusItem = (0, _treeUtils.findNodeOfTree)(data, function (item) {\n return (0, _shallowEqual.default)(item[valueKey], focusItemValue);\n });\n\n _this.setState({\n value: focusItemValue\n });\n\n _this.handleSelect(focusItemValue, focusItem, event);\n\n _this.handleChange(focusItemValue, event);\n\n _this.handleCloseDropdown();\n };\n\n _this.handleKeyDown = function (event) {\n var _this$toggleRef, _this$toggleRef$curre, _this$toggleRef$curre2;\n\n var _this$state = _this.state,\n focusItemValue = _this$state.focusItemValue,\n active = _this$state.active; // enter\n\n if ((!focusItemValue || !active) && event.keyCode === 13) {\n _this.handleToggleDropdown();\n } // delete\n\n\n if (event.keyCode === 8 && event.target === ((_this$toggleRef = _this.toggleRef) === null || _this$toggleRef === void 0 ? void 0 : (_this$toggleRef$curre = _this$toggleRef.current) === null || _this$toggleRef$curre === void 0 ? void 0 : (_this$toggleRef$curre2 = _this$toggleRef$curre.getToggleNode) === null || _this$toggleRef$curre2 === void 0 ? void 0 : _this$toggleRef$curre2.call(_this$toggleRef$curre))) {\n _this.handleClean(event);\n }\n\n if (!_this.menuContainerRef.current) {\n return;\n }\n\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextMenuItem,\n up: _this.focusPrevMenuItem,\n enter: _this.selectFocusMenuItem,\n esc: _this.handleCloseDropdown\n });\n };\n\n _this.handleItemSelect = function (value, item, event) {\n var nextState = {\n value: value,\n focusItemValue: value\n };\n\n _this.setState(nextState);\n\n _this.handleSelect(value, item, event);\n\n _this.handleChange(value, event);\n\n _this.handleCloseDropdown();\n };\n\n _this.handleSelect = function (value, item, event) {\n var _this$props$onSelect, _this$props2, _this$toggleRef$curre3;\n\n (_this$props$onSelect = (_this$props2 = _this.props).onSelect) === null || _this$props$onSelect === void 0 ? void 0 : _this$props$onSelect.call(_this$props2, value, item, event);\n (_this$toggleRef$curre3 = _this.toggleRef.current) === null || _this$toggleRef$curre3 === void 0 ? void 0 : _this$toggleRef$curre3.onFocus();\n };\n\n _this.handleSearch = function (searchKeyword, event) {\n var _filteredData$;\n\n var _this$props3 = _this.props,\n onSearch = _this$props3.onSearch,\n valueKey = _this$props3.valueKey,\n data = _this$props3.data;\n var filteredData = (0, _treeUtils.filterNodesOfTree)(data, function (item) {\n return _this.shouldDisplay(item, searchKeyword);\n });\n\n _this.setState({\n searchKeyword: searchKeyword,\n focusItemValue: filteredData === null || filteredData === void 0 ? void 0 : (_filteredData$ = filteredData[0]) === null || _filteredData$ === void 0 ? void 0 : _filteredData$[valueKey]\n });\n\n onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchKeyword, event);\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.handleChange = function (value, event) {\n var _this$props$onChange, _this$props4;\n\n (_this$props$onChange = (_this$props4 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props4, value, event);\n };\n\n _this.handleClean = function (event) {\n var _this$props5 = _this.props,\n disabled = _this$props5.disabled,\n cleanable = _this$props5.cleanable;\n\n if (disabled || !cleanable) {\n return;\n }\n\n var nextState = {\n value: null,\n focusItemValue: null\n };\n\n _this.setState(nextState);\n\n _this.handleChange(null, event);\n };\n\n _this.handleExit = function () {\n var _this$props$onClose, _this$props6;\n\n _this.setState({\n searchKeyword: '',\n active: false\n });\n\n (_this$props$onClose = (_this$props6 = _this.props).onClose) === null || _this$props$onClose === void 0 ? void 0 : _this$props$onClose.call(_this$props6);\n };\n\n _this.handleOpen = function () {\n var _this$props$onOpen, _this$props7;\n\n var value = _this.getValue();\n\n _this.setState({\n active: true,\n focusItemValue: value\n });\n\n (_this$props$onOpen = (_this$props7 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props7);\n };\n\n _this.addPrefix = function (name) {\n return (0, _utils.prefix)(_this.props.classPrefix)(name);\n };\n\n var _value = props.value,\n defaultValue = props.defaultValue,\n groupBy = props.groupBy,\n _valueKey = props.valueKey,\n labelKey = props.labelKey;\n var nextValue = _value || defaultValue;\n _this.state = {\n value: nextValue,\n focusItemValue: nextValue,\n searchKeyword: ''\n };\n _this.positionRef = React.createRef();\n _this.menuContainerRef = React.createRef();\n _this.toggleRef = React.createRef();\n _this.triggerRef = React.createRef(); // for test\n\n _this.searchBarContainerRef = React.createRef();\n\n if (groupBy === _valueKey || groupBy === labelKey) {\n throw Error('`groupBy` can not be equal to `valueKey` and `labelKey`');\n }\n\n return _this;\n }\n\n var _proto = SelectPicker.prototype;\n\n _proto.getValue = function getValue() {\n var value = this.props.value;\n return (0, _isUndefined2.default)(value) ? this.state.value : value;\n };\n\n /**\n * Index of keyword in `label`\n * @param {node} label\n */\n _proto.shouldDisplay = function shouldDisplay(item, word) {\n var _this$props8 = this.props,\n searchBy = _this$props8.searchBy,\n labelKey = _this$props8.labelKey;\n var label = item === null || item === void 0 ? void 0 : item[labelKey];\n var searchKeyword = typeof word === 'undefined' ? this.state.searchKeyword : word;\n\n if (typeof searchBy === 'function') {\n return searchBy(searchKeyword, label, item);\n }\n\n return (0, _Picker.shouldDisplay)(label, searchKeyword);\n };\n\n _proto.findNode = function findNode(focus) {\n var items = this.getFocusableMenuItems();\n var valueKey = this.props.valueKey;\n var focusItemValue = this.state.focusItemValue;\n\n for (var i = 0; i < items.length; i += 1) {\n if ((0, _shallowEqual.default)(focusItemValue, items[i][valueKey])) {\n focus(items, i);\n return;\n }\n }\n\n focus(items, -1);\n };\n\n _proto.renderDropdownMenu = function renderDropdownMenu() {\n var _this4 = this;\n\n var _this$props9 = this.props,\n data = _this$props9.data,\n groupBy = _this$props9.groupBy,\n searchable = _this$props9.searchable,\n locale = _this$props9.locale,\n renderMenu = _this$props9.renderMenu,\n renderExtraFooter = _this$props9.renderExtraFooter,\n menuClassName = _this$props9.menuClassName,\n menuStyle = _this$props9.menuStyle,\n menuAutoWidth = _this$props9.menuAutoWidth,\n sort = _this$props9.sort,\n virtualized = _this$props9.virtualized;\n var focusItemValue = this.state.focusItemValue;\n var classes = (0, _classnames.default)(this.addPrefix('select-menu'), menuClassName);\n var filteredData = (0, _treeUtils.filterNodesOfTree)(data, function (item) {\n return _this4.shouldDisplay(item);\n }); // Create a tree structure data when set `groupBy`\n\n if (groupBy) {\n filteredData = (0, _utils.getDataGroupBy)(filteredData, groupBy, sort);\n } else if (typeof sort === 'function') {\n filteredData = filteredData.sort(sort(false));\n }\n\n var menuProps = (0, _pick2.default)(this.props, Object.keys((0, _omit2.default)(_DropdownMenu.dropdownMenuPropTypes, ['className', 'style', 'classPrefix'])));\n var menu = filteredData.length ? React.createElement(_DropdownMenu.default, (0, _extends2.default)({}, menuProps, {\n classPrefix: this.addPrefix('select-menu'),\n dropdownMenuItemClassPrefix: this.addPrefix('select-menu-item'),\n dropdownMenuItemComponentClass: _Picker.DropdownMenuItem,\n ref: this.menuContainerRef,\n activeItemValues: [this.getValue()],\n focusItemValue: focusItemValue,\n data: filteredData,\n group: !(0, _isUndefined2.default)(groupBy),\n onSelect: this.handleItemSelect,\n virtualized: virtualized,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 335\n },\n __self: this\n })) : React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 349\n },\n __self: this\n }, locale.noResultsText);\n return React.createElement(_Picker.MenuWrapper, {\n autoWidth: menuAutoWidth,\n className: classes,\n style: menuStyle,\n onKeyDown: this.handleKeyDown,\n getToggleInstance: this.getToggleInstance,\n getPositionInstance: this.getPositionInstance,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 353\n },\n __self: this\n }, searchable && React.createElement(_Picker.SearchBar, {\n ref: this.searchBarContainerRef,\n placeholder: locale.searchPlaceholder,\n onChange: this.handleSearch,\n value: this.state.searchKeyword,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 362\n },\n __self: this\n }), renderMenu ? renderMenu(menu) : menu, renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());\n };\n\n _proto.render = function render() {\n var _this$props10 = this.props,\n data = _this$props10.data,\n valueKey = _this$props10.valueKey,\n labelKey = _this$props10.labelKey,\n placeholder = _this$props10.placeholder,\n renderValue = _this$props10.renderValue,\n disabled = _this$props10.disabled,\n cleanable = _this$props10.cleanable,\n locale = _this$props10.locale,\n toggleComponentClass = _this$props10.toggleComponentClass,\n style = _this$props10.style,\n onEntered = _this$props10.onEntered,\n onExited = _this$props10.onExited,\n onClean = _this$props10.onClean,\n positionRef = _this$props10.positionRef,\n rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props10, [\"data\", \"valueKey\", \"labelKey\", \"placeholder\", \"renderValue\", \"disabled\", \"cleanable\", \"locale\", \"toggleComponentClass\", \"style\", \"onEntered\", \"onExited\", \"onClean\", \"positionRef\"]);\n var unhandled = (0, _utils.getUnhandledProps)(SelectPicker, rest);\n var value = this.getValue(); // Find active `MenuItem` by `value`\n\n var activeItem = (0, _treeUtils.findNodeOfTree)(data, function (item) {\n return (0, _shallowEqual.default)(item[valueKey], value);\n });\n /**\n * 1.Have a value and the value is valid.\n * 2.Regardless of whether the value is valid, as long as renderValue is set, it is judged to have a value.\n */\n\n var hasValue = !!activeItem || !(0, _isNil2.default)(value) && (0, _isFunction2.default)(renderValue);\n var selectedElement = placeholder;\n\n if (activeItem === null || activeItem === void 0 ? void 0 : activeItem[labelKey]) {\n selectedElement = activeItem[labelKey];\n }\n\n if (!(0, _isNil2.default)(value) && (0, _isFunction2.default)(renderValue)) {\n selectedElement = renderValue(value, activeItem, selectedElement);\n\n if ((0, _isNil2.default)(selectedElement)) {\n hasValue = false;\n }\n }\n\n var classes = (0, _Picker.getToggleWrapperClassName)('select', this.addPrefix, this.props, hasValue);\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.handleOpen, onEntered),\n onExited: (0, _utils.createChainedFunction)(this.handleExit, onExited),\n speaker: this.renderDropdownMenu(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 423\n },\n __self: this\n }, React.createElement(\"div\", {\n className: classes,\n style: style,\n tabIndex: -1,\n role: \"menu\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 431\n },\n __self: this\n }, React.createElement(_Picker.PickerToggle, (0, _extends2.default)({}, unhandled, {\n ref: this.toggleRef,\n onClean: (0, _utils.createChainedFunction)(this.handleClean, onClean),\n onKeyDown: this.handleKeyDown,\n componentClass: toggleComponentClass,\n cleanable: cleanable && !disabled,\n hasValue: hasValue,\n active: this.state.active,\n \"aria-disabled\": disabled,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 432\n },\n __self: this\n }), selectedElement || locale.placeholder)));\n };\n\n return SelectPicker;\n}(React.Component);\n\nSelectPicker.propTypes = (0, _extends2.default)({}, _propTypes2.listPickerPropTypes, {\n menuAutoWidth: _propTypes.default.bool,\n maxHeight: _propTypes.default.number,\n renderMenu: _propTypes.default.func,\n renderMenuItem: _propTypes.default.func,\n renderMenuGroup: _propTypes.default.func,\n onSelect: _propTypes.default.func,\n onGroupTitleClick: _propTypes.default.func,\n onSearch: _propTypes.default.func,\n\n /**\n * group by key in `data`\n */\n groupBy: _propTypes.default.any,\n sort: _propTypes.default.func,\n searchable: _propTypes.default.bool,\n virtualized: _propTypes.default.bool,\n searchBy: _propTypes.default.func\n});\nSelectPicker.defaultProps = (0, _extends2.default)({}, _propTypes2.listPickerDefaultProps, {\n searchable: true,\n menuAutoWidth: true,\n virtualized: true,\n maxHeight: 320,\n locale: {\n placeholder: 'Select',\n searchPlaceholder: 'Search',\n noResultsText: 'No results found'\n }\n});\n\nvar _default = (0, _utils.defaultProps)({\n classPrefix: 'picker'\n})(SelectPicker);\n\nexports.default = _default;\nmodule.exports = exports.default;\n\n//# sourceURL=webpack://rsuite/./src/SelectPicker/SelectPicker.tsx?");
|
|
9775
|
+
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 _isFunction2 = _interopRequireDefault(__webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\"));\n\nvar _isNil2 = _interopRequireDefault(__webpack_require__(/*! lodash/isNil */ \"./node_modules/lodash/isNil.js\"));\n\nvar _omit2 = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _pick2 = _interopRequireDefault(__webpack_require__(/*! lodash/pick */ \"./node_modules/lodash/pick.js\"));\n\nvar _isUndefined2 = _interopRequireDefault(__webpack_require__(/*! lodash/isUndefined */ \"./node_modules/lodash/isUndefined.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 _shallowEqual = _interopRequireDefault(__webpack_require__(/*! ../utils/shallowEqual */ \"./src/utils/shallowEqual.ts\"));\n\nvar _treeUtils = __webpack_require__(/*! ../utils/treeUtils */ \"./src/utils/treeUtils.ts\");\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Picker = __webpack_require__(/*! ../Picker */ \"./src/Picker/index.ts\");\n\nvar _DropdownMenu = _interopRequireWildcard(__webpack_require__(/*! ../Picker/DropdownMenu */ \"./src/Picker/DropdownMenu.tsx\"));\n\nvar _propTypes2 = __webpack_require__(/*! ../Picker/propTypes */ \"./src/Picker/propTypes.ts\");\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/SelectPicker/SelectPicker.tsx\";\n\nvar SelectPicker =\n/*#__PURE__*/\nfunction (_React$Component) {\n (0, _inheritsLoose2.default)(SelectPicker, _React$Component);\n\n function SelectPicker(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.positionRef = void 0;\n _this.menuContainerRef = void 0;\n _this.searchBarContainerRef = void 0;\n _this.toggleRef = void 0;\n _this.triggerRef = void 0;\n\n _this.getFocusableMenuItems = function () {\n var menuItems = _this.menuContainerRef.current.menuItems;\n\n if (!menuItems) {\n return [];\n }\n\n var items = Object.values(menuItems).map(function (item) {\n return item.props.getItemData();\n });\n return (0, _treeUtils.filterNodesOfTree)(items, function (item) {\n return _this.shouldDisplay(item);\n });\n };\n\n _this.getToggleInstance = function () {\n return _this.toggleRef.current;\n };\n\n _this.getPositionInstance = function () {\n return _this.positionRef.current;\n };\n\n _this.focusNextMenuItem = function () {\n var valueKey = _this.props.valueKey;\n\n _this.findNode(function (items, index) {\n var focusItem = items[index + 1];\n\n if (!(0, _isUndefined2.default)(focusItem)) {\n _this.setState({\n focusItemValue: focusItem[valueKey]\n });\n }\n });\n };\n\n _this.focusPrevMenuItem = function () {\n var valueKey = _this.props.valueKey;\n\n _this.findNode(function (items, index) {\n var focusItem = items[index - 1];\n\n if (!(0, _isUndefined2.default)(focusItem)) {\n _this.setState({\n focusItemValue: focusItem[valueKey]\n });\n }\n });\n };\n\n _this.selectFocusMenuItem = function (event) {\n var focusItemValue = _this.state.focusItemValue;\n var _this$props = _this.props,\n data = _this$props.data,\n valueKey = _this$props.valueKey;\n\n if (!focusItemValue) {\n return;\n } // Find active `MenuItem` by `value`\n\n\n var focusItem = (0, _treeUtils.findNodeOfTree)(data, function (item) {\n return (0, _shallowEqual.default)(item[valueKey], focusItemValue);\n });\n\n _this.setState({\n value: focusItemValue\n });\n\n _this.handleSelect(focusItemValue, focusItem, event);\n\n _this.handleChange(focusItemValue, event);\n\n _this.handleCloseDropdown();\n };\n\n _this.handleKeyDown = function (event) {\n var _this$toggleRef, _this$toggleRef$curre, _this$toggleRef$curre2;\n\n var _this$state = _this.state,\n focusItemValue = _this$state.focusItemValue,\n active = _this$state.active; // enter\n\n if ((!focusItemValue || !active) && event.keyCode === 13) {\n _this.handleToggleDropdown();\n } // delete\n\n\n if (event.keyCode === 8 && event.target === ((_this$toggleRef = _this.toggleRef) === null || _this$toggleRef === void 0 ? void 0 : (_this$toggleRef$curre = _this$toggleRef.current) === null || _this$toggleRef$curre === void 0 ? void 0 : (_this$toggleRef$curre2 = _this$toggleRef$curre.getToggleNode) === null || _this$toggleRef$curre2 === void 0 ? void 0 : _this$toggleRef$curre2.call(_this$toggleRef$curre))) {\n _this.handleClean(event);\n }\n\n if (!_this.menuContainerRef.current) {\n return;\n }\n\n (0, _Picker.onMenuKeyDown)(event, {\n down: _this.focusNextMenuItem,\n up: _this.focusPrevMenuItem,\n enter: _this.selectFocusMenuItem,\n esc: _this.handleCloseDropdown\n });\n };\n\n _this.handleItemSelect = function (value, item, event) {\n var nextState = {\n value: value,\n focusItemValue: value\n };\n\n _this.setState(nextState);\n\n _this.handleSelect(value, item, event);\n\n _this.handleChange(value, event);\n\n _this.handleCloseDropdown();\n };\n\n _this.handleSelect = function (value, item, event) {\n var _this$props$onSelect, _this$props2, _this$toggleRef$curre3;\n\n (_this$props$onSelect = (_this$props2 = _this.props).onSelect) === null || _this$props$onSelect === void 0 ? void 0 : _this$props$onSelect.call(_this$props2, value, item, event);\n (_this$toggleRef$curre3 = _this.toggleRef.current) === null || _this$toggleRef$curre3 === void 0 ? void 0 : _this$toggleRef$curre3.onFocus();\n };\n\n _this.handleSearch = function (searchKeyword, event) {\n var _filteredData$;\n\n var _this$props3 = _this.props,\n onSearch = _this$props3.onSearch,\n valueKey = _this$props3.valueKey,\n data = _this$props3.data;\n var filteredData = (0, _treeUtils.filterNodesOfTree)(data, function (item) {\n return _this.shouldDisplay(item, searchKeyword);\n });\n\n _this.setState({\n searchKeyword: searchKeyword,\n focusItemValue: filteredData === null || filteredData === void 0 ? void 0 : (_filteredData$ = filteredData[0]) === null || _filteredData$ === void 0 ? void 0 : _filteredData$[valueKey]\n });\n\n onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchKeyword, event);\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.handleChange = function (value, event) {\n var _this$props$onChange, _this$props4;\n\n (_this$props$onChange = (_this$props4 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props4, value, event);\n };\n\n _this.handleClean = function (event) {\n var _this$props5 = _this.props,\n disabled = _this$props5.disabled,\n cleanable = _this$props5.cleanable;\n\n if (disabled || !cleanable) {\n return;\n }\n\n var nextState = {\n value: null,\n focusItemValue: null\n };\n\n _this.setState(nextState);\n\n _this.handleChange(null, event);\n };\n\n _this.handleExit = function () {\n var _this$props$onSearch, _this$props6, _this$props$onClose, _this$props7;\n\n _this.setState({\n searchKeyword: '',\n active: false\n });\n\n (_this$props$onSearch = (_this$props6 = _this.props).onSearch) === null || _this$props$onSearch === void 0 ? void 0 : _this$props$onSearch.call(_this$props6, '');\n (_this$props$onClose = (_this$props7 = _this.props).onClose) === null || _this$props$onClose === void 0 ? void 0 : _this$props$onClose.call(_this$props7);\n };\n\n _this.handleOpen = function () {\n var _this$props$onOpen, _this$props8;\n\n var value = _this.getValue();\n\n _this.setState({\n active: true,\n focusItemValue: value\n });\n\n (_this$props$onOpen = (_this$props8 = _this.props).onOpen) === null || _this$props$onOpen === void 0 ? void 0 : _this$props$onOpen.call(_this$props8);\n };\n\n _this.addPrefix = function (name) {\n return (0, _utils.prefix)(_this.props.classPrefix)(name);\n };\n\n var _value = props.value,\n defaultValue = props.defaultValue,\n groupBy = props.groupBy,\n _valueKey = props.valueKey,\n labelKey = props.labelKey;\n var nextValue = _value || defaultValue;\n _this.state = {\n value: nextValue,\n focusItemValue: nextValue,\n searchKeyword: ''\n };\n _this.positionRef = React.createRef();\n _this.menuContainerRef = React.createRef();\n _this.toggleRef = React.createRef();\n _this.triggerRef = React.createRef(); // for test\n\n _this.searchBarContainerRef = React.createRef();\n\n if (groupBy === _valueKey || groupBy === labelKey) {\n throw Error('`groupBy` can not be equal to `valueKey` and `labelKey`');\n }\n\n return _this;\n }\n\n var _proto = SelectPicker.prototype;\n\n _proto.getValue = function getValue() {\n var value = this.props.value;\n return (0, _isUndefined2.default)(value) ? this.state.value : value;\n };\n\n /**\n * Index of keyword in `label`\n * @param {node} label\n */\n _proto.shouldDisplay = function shouldDisplay(item, word) {\n var _this$props9 = this.props,\n searchBy = _this$props9.searchBy,\n labelKey = _this$props9.labelKey;\n var label = item === null || item === void 0 ? void 0 : item[labelKey];\n var searchKeyword = typeof word === 'undefined' ? this.state.searchKeyword : word;\n\n if (typeof searchBy === 'function') {\n return searchBy(searchKeyword, label, item);\n }\n\n return (0, _Picker.shouldDisplay)(label, searchKeyword);\n };\n\n _proto.findNode = function findNode(focus) {\n var items = this.getFocusableMenuItems();\n var valueKey = this.props.valueKey;\n var focusItemValue = this.state.focusItemValue;\n\n for (var i = 0; i < items.length; i += 1) {\n if ((0, _shallowEqual.default)(focusItemValue, items[i][valueKey])) {\n focus(items, i);\n return;\n }\n }\n\n focus(items, -1);\n };\n\n _proto.renderDropdownMenu = function renderDropdownMenu() {\n var _this4 = this;\n\n var _this$props10 = this.props,\n data = _this$props10.data,\n groupBy = _this$props10.groupBy,\n searchable = _this$props10.searchable,\n locale = _this$props10.locale,\n renderMenu = _this$props10.renderMenu,\n renderExtraFooter = _this$props10.renderExtraFooter,\n menuClassName = _this$props10.menuClassName,\n menuStyle = _this$props10.menuStyle,\n menuAutoWidth = _this$props10.menuAutoWidth,\n sort = _this$props10.sort,\n virtualized = _this$props10.virtualized;\n var focusItemValue = this.state.focusItemValue;\n var classes = (0, _classnames.default)(this.addPrefix('select-menu'), menuClassName);\n var filteredData = (0, _treeUtils.filterNodesOfTree)(data, function (item) {\n return _this4.shouldDisplay(item);\n }); // Create a tree structure data when set `groupBy`\n\n if (groupBy) {\n filteredData = (0, _utils.getDataGroupBy)(filteredData, groupBy, sort);\n } else if (typeof sort === 'function') {\n filteredData = filteredData.sort(sort(false));\n }\n\n var menuProps = (0, _pick2.default)(this.props, Object.keys((0, _omit2.default)(_DropdownMenu.dropdownMenuPropTypes, ['className', 'style', 'classPrefix'])));\n var menu = filteredData.length ? React.createElement(_DropdownMenu.default, (0, _extends2.default)({}, menuProps, {\n classPrefix: this.addPrefix('select-menu'),\n dropdownMenuItemClassPrefix: this.addPrefix('select-menu-item'),\n dropdownMenuItemComponentClass: _Picker.DropdownMenuItem,\n ref: this.menuContainerRef,\n activeItemValues: [this.getValue()],\n focusItemValue: focusItemValue,\n data: filteredData,\n group: !(0, _isUndefined2.default)(groupBy),\n onSelect: this.handleItemSelect,\n virtualized: virtualized,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 335\n },\n __self: this\n })) : React.createElement(\"div\", {\n className: this.addPrefix('none'),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 349\n },\n __self: this\n }, locale.noResultsText);\n return React.createElement(_Picker.MenuWrapper, {\n autoWidth: menuAutoWidth,\n className: classes,\n style: menuStyle,\n onKeyDown: this.handleKeyDown,\n getToggleInstance: this.getToggleInstance,\n getPositionInstance: this.getPositionInstance,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 353\n },\n __self: this\n }, searchable && React.createElement(_Picker.SearchBar, {\n ref: this.searchBarContainerRef,\n placeholder: locale.searchPlaceholder,\n onChange: this.handleSearch,\n value: this.state.searchKeyword,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 362\n },\n __self: this\n }), renderMenu ? renderMenu(menu) : menu, renderExtraFooter === null || renderExtraFooter === void 0 ? void 0 : renderExtraFooter());\n };\n\n _proto.render = function render() {\n var _this$props11 = this.props,\n data = _this$props11.data,\n valueKey = _this$props11.valueKey,\n labelKey = _this$props11.labelKey,\n placeholder = _this$props11.placeholder,\n renderValue = _this$props11.renderValue,\n disabled = _this$props11.disabled,\n cleanable = _this$props11.cleanable,\n locale = _this$props11.locale,\n toggleComponentClass = _this$props11.toggleComponentClass,\n style = _this$props11.style,\n onEntered = _this$props11.onEntered,\n onExited = _this$props11.onExited,\n onClean = _this$props11.onClean,\n positionRef = _this$props11.positionRef,\n rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props11, [\"data\", \"valueKey\", \"labelKey\", \"placeholder\", \"renderValue\", \"disabled\", \"cleanable\", \"locale\", \"toggleComponentClass\", \"style\", \"onEntered\", \"onExited\", \"onClean\", \"positionRef\"]);\n var unhandled = (0, _utils.getUnhandledProps)(SelectPicker, rest);\n var value = this.getValue(); // Find active `MenuItem` by `value`\n\n var activeItem = (0, _treeUtils.findNodeOfTree)(data, function (item) {\n return (0, _shallowEqual.default)(item[valueKey], value);\n });\n /**\n * 1.Have a value and the value is valid.\n * 2.Regardless of whether the value is valid, as long as renderValue is set, it is judged to have a value.\n */\n\n var hasValue = !!activeItem || !(0, _isNil2.default)(value) && (0, _isFunction2.default)(renderValue);\n var selectedElement = placeholder;\n\n if (activeItem === null || activeItem === void 0 ? void 0 : activeItem[labelKey]) {\n selectedElement = activeItem[labelKey];\n }\n\n if (!(0, _isNil2.default)(value) && (0, _isFunction2.default)(renderValue)) {\n selectedElement = renderValue(value, activeItem, selectedElement);\n\n if ((0, _isNil2.default)(selectedElement)) {\n hasValue = false;\n }\n }\n\n var classes = (0, _Picker.getToggleWrapperClassName)('select', this.addPrefix, this.props, hasValue);\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.handleOpen, onEntered),\n onExited: (0, _utils.createChainedFunction)(this.handleExit, onExited),\n speaker: this.renderDropdownMenu(),\n __source: {\n fileName: _jsxFileName,\n lineNumber: 423\n },\n __self: this\n }, React.createElement(\"div\", {\n className: classes,\n style: style,\n tabIndex: -1,\n role: \"menu\",\n __source: {\n fileName: _jsxFileName,\n lineNumber: 431\n },\n __self: this\n }, React.createElement(_Picker.PickerToggle, (0, _extends2.default)({}, unhandled, {\n ref: this.toggleRef,\n onClean: (0, _utils.createChainedFunction)(this.handleClean, onClean),\n onKeyDown: this.handleKeyDown,\n componentClass: toggleComponentClass,\n cleanable: cleanable && !disabled,\n hasValue: hasValue,\n active: this.state.active,\n \"aria-disabled\": disabled,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 432\n },\n __self: this\n }), selectedElement || locale.placeholder)));\n };\n\n return SelectPicker;\n}(React.Component);\n\nSelectPicker.propTypes = (0, _extends2.default)({}, _propTypes2.listPickerPropTypes, {\n menuAutoWidth: _propTypes.default.bool,\n maxHeight: _propTypes.default.number,\n renderMenu: _propTypes.default.func,\n renderMenuItem: _propTypes.default.func,\n renderMenuGroup: _propTypes.default.func,\n onSelect: _propTypes.default.func,\n onGroupTitleClick: _propTypes.default.func,\n onSearch: _propTypes.default.func,\n\n /**\n * group by key in `data`\n */\n groupBy: _propTypes.default.any,\n sort: _propTypes.default.func,\n searchable: _propTypes.default.bool,\n virtualized: _propTypes.default.bool,\n searchBy: _propTypes.default.func\n});\nSelectPicker.defaultProps = (0, _extends2.default)({}, _propTypes2.listPickerDefaultProps, {\n searchable: true,\n menuAutoWidth: true,\n virtualized: true,\n maxHeight: 320,\n locale: {\n placeholder: 'Select',\n searchPlaceholder: 'Search',\n noResultsText: 'No results found'\n }\n});\n\nvar _default = (0, _utils.defaultProps)({\n classPrefix: 'picker'\n})(SelectPicker);\n\nexports.default = _default;\nmodule.exports = exports.default;\n\n//# sourceURL=webpack://rsuite/./src/SelectPicker/SelectPicker.tsx?");
|
|
9776
9776
|
|
|
9777
9777
|
/***/ }),
|
|
9778
9778
|
|