rsuite 5.17.1 → 5.18.0
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 +16 -0
- package/CheckTreePicker/styles/index.less +1 -1
- package/DatePicker/styles/index.less +4 -0
- package/Form/styles/mixin.less +0 -1
- package/FormControl/styles/index.less +10 -4
- package/Uploader/styles/index.less +0 -15
- package/cjs/DatePicker/Toolbar.js +1 -0
- package/cjs/Dropdown/DropdownMenu.js +4 -4
- package/cjs/List/helper/useSortHelper.js +16 -11
- package/cjs/Uploader/UploadTrigger.d.ts +2 -1
- package/cjs/Uploader/UploadTrigger.js +5 -11
- package/cjs/Uploader/Uploader.d.ts +2 -1
- package/cjs/Uploader/test/Uploader.test.d.ts +1 -0
- package/cjs/Uploader/test/Uploader.test.js +26 -0
- package/dist/rsuite-rtl.css +8 -202
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +8 -202
- package/dist/rsuite.js +9 -9
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/DatePicker/Toolbar.js +1 -0
- package/esm/Dropdown/DropdownMenu.js +4 -4
- package/esm/List/helper/useSortHelper.js +15 -11
- package/esm/Uploader/UploadTrigger.d.ts +2 -1
- package/esm/Uploader/UploadTrigger.js +3 -10
- package/esm/Uploader/Uploader.d.ts +2 -1
- package/esm/Uploader/test/Uploader.test.d.ts +1 -0
- package/esm/Uploader/test/Uploader.test.js +21 -0
- package/package.json +2 -2
package/dist/rsuite.js
CHANGED
|
@@ -2452,7 +2452,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
|
|
|
2452
2452
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2453
2453
|
|
|
2454
2454
|
"use strict";
|
|
2455
|
-
eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireDefault(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _Button = _interopRequireDefault(__webpack_require__(/*! ../Button */ \"./src/Button/index.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _PredefinedRanges = _interopRequireDefault(__webpack_require__(/*! ./PredefinedRanges */ \"./src/DatePicker/PredefinedRanges.tsx\"));\n\nvar _Stack = _interopRequireDefault(__webpack_require__(/*! ../Stack */ \"./src/Stack/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/DatePicker/Toolbar.tsx\",\n _this = void 0;\n\nvar SubmitButton = function SubmitButton(_ref) {\n var hide = _ref.hide,\n disabledOkBtn = _ref.disabledOkBtn,\n calendarDate = _ref.calendarDate,\n onOk = _ref.onOk,\n children = _ref.children;\n\n if (hide) {\n return null;\n }\n\n var disabled = disabledOkBtn === null || disabledOkBtn === void 0 ? void 0 : disabledOkBtn(calendarDate);\n return /*#__PURE__*/_react.default.createElement(_Button.default, {\n appearance: \"primary\",\n size: \"sm\",\n disabled: disabled,\n onClick: disabled ? undefined : onOk,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36,\n columnNumber: 5\n }\n }, children);\n};\n/**\n * Toolbar for DatePicker and DateRangePicker\n */\n\n\nvar Toolbar = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var className = props.className,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'picker-toolbar' : _props$classPrefix,\n disabledOkBtn = props.disabledOkBtn,\n disabledShortcut = props.disabledShortcut,\n hideOkBtn = props.hideOkBtn,\n onOk = props.onOk,\n onClickShortcut = props.onClickShortcut,\n calendarDate = props.calendarDate,\n ranges = props.ranges,\n locale = props.locale,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"className\", \"classPrefix\", \"disabledOkBtn\", \"disabledShortcut\", \"hideOkBtn\", \"onOk\", \"onClickShortcut\", \"calendarDate\", \"ranges\", \"locale\"]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n prefix = _useClassNames.prefix,\n withClassPrefix = _useClassNames.withClassPrefix;\n\n if (hideOkBtn && (ranges === null || ranges === void 0 ? void 0 : ranges.length) === 0) {\n return null;\n }\n\n var classes = merge(className, withClassPrefix());\n return /*#__PURE__*/_react.default.createElement(_Stack.default, (0, _extends2.default)({\n ref: ref,\n className: classes,\n justifyContent: \"space-between\",\n alignItems: \"flex-start\"\n }, rest, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 5\n }\n }), /*#__PURE__*/_react.default.createElement(_PredefinedRanges.default, {\n className: prefix('ranges'),\n ranges: ranges,\n calendarDate: calendarDate,\n locale: locale,\n disabledShortcut: disabledShortcut,\n onClickShortcut: onClickShortcut,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 7\n }\n }), /*#__PURE__*/_react.default.createElement(\"div\", {\n className: prefix('right'),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber:
|
|
2455
|
+
eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireDefault(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _Button = _interopRequireDefault(__webpack_require__(/*! ../Button */ \"./src/Button/index.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _PredefinedRanges = _interopRequireDefault(__webpack_require__(/*! ./PredefinedRanges */ \"./src/DatePicker/PredefinedRanges.tsx\"));\n\nvar _Stack = _interopRequireDefault(__webpack_require__(/*! ../Stack */ \"./src/Stack/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/DatePicker/Toolbar.tsx\",\n _this = void 0;\n\nvar SubmitButton = function SubmitButton(_ref) {\n var hide = _ref.hide,\n disabledOkBtn = _ref.disabledOkBtn,\n calendarDate = _ref.calendarDate,\n onOk = _ref.onOk,\n children = _ref.children;\n\n if (hide) {\n return null;\n }\n\n var disabled = disabledOkBtn === null || disabledOkBtn === void 0 ? void 0 : disabledOkBtn(calendarDate);\n return /*#__PURE__*/_react.default.createElement(_Button.default, {\n appearance: \"primary\",\n size: \"sm\",\n disabled: disabled,\n onClick: disabled ? undefined : onOk,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 36,\n columnNumber: 5\n }\n }, children);\n};\n/**\n * Toolbar for DatePicker and DateRangePicker\n */\n\n\nvar Toolbar = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var className = props.className,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'picker-toolbar' : _props$classPrefix,\n disabledOkBtn = props.disabledOkBtn,\n disabledShortcut = props.disabledShortcut,\n hideOkBtn = props.hideOkBtn,\n onOk = props.onOk,\n onClickShortcut = props.onClickShortcut,\n calendarDate = props.calendarDate,\n ranges = props.ranges,\n locale = props.locale,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"className\", \"classPrefix\", \"disabledOkBtn\", \"disabledShortcut\", \"hideOkBtn\", \"onOk\", \"onClickShortcut\", \"calendarDate\", \"ranges\", \"locale\"]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n prefix = _useClassNames.prefix,\n withClassPrefix = _useClassNames.withClassPrefix;\n\n if (hideOkBtn && (ranges === null || ranges === void 0 ? void 0 : ranges.length) === 0) {\n return null;\n }\n\n var classes = merge(className, withClassPrefix());\n return /*#__PURE__*/_react.default.createElement(_Stack.default, (0, _extends2.default)({\n ref: ref,\n className: classes,\n justifyContent: \"space-between\",\n alignItems: \"flex-start\"\n }, rest, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 5\n }\n }), /*#__PURE__*/_react.default.createElement(_PredefinedRanges.default, {\n wrap: true,\n className: prefix('ranges'),\n ranges: ranges,\n calendarDate: calendarDate,\n locale: locale,\n disabledShortcut: disabledShortcut,\n onClickShortcut: onClickShortcut,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 81,\n columnNumber: 7\n }\n }), /*#__PURE__*/_react.default.createElement(\"div\", {\n className: prefix('right'),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 7\n }\n }, /*#__PURE__*/_react.default.createElement(SubmitButton, {\n disabledOkBtn: disabledOkBtn,\n hide: hideOkBtn,\n calendarDate: calendarDate,\n onOk: onOk,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 9\n }\n }, locale === null || locale === void 0 ? void 0 : locale.ok)));\n});\n\nToolbar.displayName = 'Toolbar';\nToolbar.propTypes = {\n ranges: _propTypes.default.array,\n className: _propTypes.default.string,\n classPrefix: _propTypes.default.string,\n calendarDate: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.arrayOf(_propTypes.default.instanceOf(Date))]).isRequired,\n onClickShortcut: _propTypes.default.func,\n onOk: _propTypes.default.func,\n disabledShortcut: _propTypes.default.func,\n disabledOkBtn: _propTypes.default.func,\n hideOkBtn: _propTypes.default.bool\n};\nvar _default = Toolbar;\nexports.default = _default;\n\n//# sourceURL=webpack://rsuite/./src/DatePicker/Toolbar.tsx?");
|
|
2456
2456
|
|
|
2457
2457
|
/***/ }),
|
|
2458
2458
|
|
|
@@ -2683,7 +2683,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
|
|
|
2683
2683
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2684
2684
|
|
|
2685
2685
|
"use strict";
|
|
2686
|
-
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 _taggedTemplateLiteralLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteralLoose */ \"./node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _omit2 = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _Menu = _interopRequireDefault(__webpack_require__(/*! ../Menu/Menu */ \"./src/Menu/Menu.tsx\"));\n\nvar _MenuItem = _interopRequireDefault(__webpack_require__(/*! ../Menu/MenuItem */ \"./src/Menu/MenuItem.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _AngleLeft = _interopRequireDefault(__webpack_require__(/*! @rsuite/icons/legacy/AngleLeft */ \"./node_modules/@rsuite/icons/legacy/AngleLeft.js\"));\n\nvar _AngleRight = _interopRequireDefault(__webpack_require__(/*! @rsuite/icons/legacy/AngleRight */ \"./node_modules/@rsuite/icons/legacy/AngleRight.js\"));\n\nvar _useCustom2 = _interopRequireDefault(__webpack_require__(/*! ../utils/useCustom */ \"./src/utils/useCustom.ts\"));\n\nvar _DropdownContext = _interopRequireDefault(__webpack_require__(/*! ./DropdownContext */ \"./src/Dropdown/DropdownContext.ts\"));\n\nvar _Menubar = _interopRequireDefault(__webpack_require__(/*! ../Menu/Menubar */ \"./src/Menu/Menubar.tsx\"));\n\nvar _Nav = _interopRequireDefault(__webpack_require__(/*! ../Nav */ \"./src/Nav/index.tsx\"));\n\nvar _NavContext = _interopRequireDefault(__webpack_require__(/*! ../Nav/NavContext */ \"./src/Nav/NavContext.ts\"));\n\nvar _warnOnce = _interopRequireDefault(__webpack_require__(/*! ../utils/warnOnce */ \"./src/utils/warnOnce.ts\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Dropdown/DropdownMenu.tsx\",\n _this = void 0,\n _templateObject,\n _templateObject2;\n\n/**\n * The <Dropdown.Menu> API\n *\n * @description\n * Note the difference between this component and <Menu> component:\n * <Menu> is used for ARIA menu control logic and is used internally only.\n * This component is only used for supporting submenu syntax and is\n * assigned to Dropdown.Menu\n *\n * @example\n *\n * <Dropdown>\n * <Dropdown.Item>Item 1</Dropdown.Item>\n * <Dropdown.Menu title=\"Submenu\">\n * <Dropdown.Item>Sub item</Dropdown.Item>\n * </Dropdown.Menu>\n * </Dropdown>\n */\nvar DropdownMenu = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var onToggle = props.onToggle,\n eventKey = props.eventKey,\n title = props.title,\n activeKey = props.activeKey,\n onSelect = props.onSelect,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'dropdown-menu' : _props$classPrefix,\n children = props.children,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"onToggle\", \"eventKey\", \"title\", \"activeKey\", \"onSelect\", \"classPrefix\", \"children\"]);\n var nav = (0, _react.useContext)(_NavContext.default);\n var dropdown = (0, _react.useContext)(_DropdownContext.default);\n\n var _useCustom = (0, _useCustom2.default)('DropdownMenu'),\n rtl = _useCustom.rtl;\n\n var handleToggleSubmenu = (0, _react.useCallback)(function (_, event) {\n onToggle === null || onToggle === void 0 ? void 0 : onToggle(eventKey, event);\n }, [eventKey, onToggle]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n prefix = _useClassNames.prefix,\n withClassPrefix = _useClassNames.withClassPrefix;\n\n var _useClassNames2 = (0, _utils.useClassNames)('dropdown-menu'),\n withMenuClassPrefix = _useClassNames2.withClassPrefix,\n mergeMenuClassName = _useClassNames2.merge;\n\n var _useClassNames3 = (0, _utils.useClassNames)('dropdown-item'),\n mergeItemClassNames = _useClassNames3.merge,\n withItemClassPrefix = _useClassNames3.withClassPrefix,\n prefixItemClassName = _useClassNames3.prefix;\n\n var contextValue = (0, _react.useMemo)(function () {\n return {\n activeKey: activeKey,\n onSelect: onSelect\n };\n }, [activeKey, onSelect]); // If rendered within a <Nav>\n // Suggest <Nav.Menu>\n\n if (nav) {\n (0, _warnOnce.default)('Usage of <Dropdown.Menu> within <Nav> is deprecated. Replace with <Nav.Menu>');\n return /*#__PURE__*/_react.default.createElement(_Nav.default.Menu, (0, _extends2.default)({\n ref: ref\n }, props, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 12\n }\n }));\n } // <Dropdown.Menu> is used outside of <Dropdown>\n // renders a vertical `menubar`\n\n\n if (!dropdown) {\n var classes = merge(props.className, withClassPrefix());\n return /*#__PURE__*/_react.default.createElement(_DropdownContext.default.Provider, {\n value: contextValue,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 7\n }\n }, /*#__PURE__*/_react.default.createElement(_Menubar.default, {\n vertical: true,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 116,\n columnNumber: 9\n }\n }, function (menubar, menubarRef) {\n return /*#__PURE__*/_react.default.createElement(\"ul\", (0, _extends2.default)({\n ref: (0, _utils.mergeRefs)(menubarRef, ref),\n className: classes\n }, menubar, rest, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 13\n }\n }), children);\n }));\n } // Parent menu exists. This is a submenu.\n // Should render a `menuitem` that controls this submenu.\n\n\n var _omit = (0, _omit2.default)(rest, ['trigger']),\n icon = _omit.icon,\n className = _omit.className,\n disabled = _omit.disabled,\n menuProps = (0, _objectWithoutPropertiesLoose2.default)(_omit, [\"icon\", \"className\", \"disabled\"]);\n\n var Icon = rtl ? _AngleLeft.default : _AngleRight.default;\n return /*#__PURE__*/_react.default.createElement(_Menu.default, {\n openMenuOn: ['mouseover', 'click'],\n renderMenuButton: function renderMenuButton(_ref, buttonRef) {\n var open = _ref.open,\n menuButtonProps = (0, _objectWithoutPropertiesLoose2.default)(_ref, [\"open\"]);\n return /*#__PURE__*/_react.default.createElement(_MenuItem.default, {\n disabled: disabled,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 137,\n columnNumber: 9\n }\n }, function (_ref2, menuitemRef) {\n var selected = _ref2.selected,\n active = _ref2.active,\n menuitem = (0, _objectWithoutPropertiesLoose2.default)(_ref2, [\"selected\", \"active\"]);\n var classes = mergeItemClassNames(className, prefixItemClassName(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)([\"toggle\"]))), withItemClassPrefix({\n 'with-icon': icon,\n open: open,\n active: selected,\n disabled: disabled,\n focus: active\n }));\n return /*#__PURE__*/_react.default.createElement(\"div\", (0, _extends2.default)({\n ref: (0, _utils.mergeRefs)(buttonRef, menuitemRef),\n className: classes,\n \"data-event-key\": eventKey,\n \"data-event-key-type\": typeof eventKey\n }, menuitem, (0, _omit2.default)(menuButtonProps, ['role']), {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 152,\n columnNumber: 15\n }\n }), icon && /*#__PURE__*/_react.default.cloneElement(icon, {\n className: prefix('menu-icon')\n }), title, /*#__PURE__*/_react.default.createElement(Icon, {\n className: prefix(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)([\"toggle-icon\"]))),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 162,\n columnNumber: 17\n }\n }));\n });\n },\n renderMenuPopup: function renderMenuPopup(_ref3, popupRef) {\n var open = _ref3.open,\n popupProps = (0, _objectWithoutPropertiesLoose2.default)(_ref3, [\"open\"]);\n var menuClassName = mergeMenuClassName(className, withMenuClassPrefix());\n return /*#__PURE__*/_react.default.createElement(\"ul\", (0, _extends2.default)({\n ref: popupRef,\n className: menuClassName,\n hidden: !open\n }, popupProps, menuProps, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 172,\n columnNumber: 11\n }\n }), children);\n },\n onToggleMenu: handleToggleSubmenu,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 134,\n columnNumber: 5\n }\n }, function (_ref4, menuContainerRef) {\n var open = _ref4.open,\n menuContainer = (0, _objectWithoutPropertiesLoose2.default)(_ref4, [\"open\"]);\n var classes = mergeItemClassNames(className, withItemClassPrefix({\n disabled: disabled,\n open: open,\n submenu: true\n }));\n return /*#__PURE__*/_react.default.createElement(\"li\", (0, _extends2.default)({\n ref: (0, _utils.mergeRefs)(ref, menuContainerRef),\n className: classes\n }, menuContainer, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 195,\n columnNumber: 11\n }\n }));\n });\n});\n\nDropdownMenu.displayName = 'Dropdown.Menu';\nDropdownMenu.propTypes = {\n active: _propTypes.default.bool,\n activeKey: _propTypes.default.any,\n className: _propTypes.default.string,\n children: _propTypes.default.node,\n icon: _propTypes.default.any,\n classPrefix: _propTypes.default.string,\n pullLeft: _propTypes.default.bool,\n title: _propTypes.default.node,\n open: _propTypes.default.bool,\n trigger: _propTypes.default.oneOf(['click', 'hover']),\n eventKey: _propTypes.default.any,\n expanded: _propTypes.default.bool,\n collapsible: _propTypes.default.bool,\n onSelect: _propTypes.default.func,\n onToggle: _propTypes.default.func\n};\nvar _default = DropdownMenu;\nexports.default = _default;\n\n//# sourceURL=webpack://rsuite/./src/Dropdown/DropdownMenu.tsx?");
|
|
2686
|
+
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 _taggedTemplateLiteralLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteralLoose */ \"./node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js\"));\n\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\"));\n\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _omit2 = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\"));\n\nvar _Menu = _interopRequireDefault(__webpack_require__(/*! ../Menu/Menu */ \"./src/Menu/Menu.tsx\"));\n\nvar _MenuItem = _interopRequireDefault(__webpack_require__(/*! ../Menu/MenuItem */ \"./src/Menu/MenuItem.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _AngleLeft = _interopRequireDefault(__webpack_require__(/*! @rsuite/icons/legacy/AngleLeft */ \"./node_modules/@rsuite/icons/legacy/AngleLeft.js\"));\n\nvar _AngleRight = _interopRequireDefault(__webpack_require__(/*! @rsuite/icons/legacy/AngleRight */ \"./node_modules/@rsuite/icons/legacy/AngleRight.js\"));\n\nvar _useCustom2 = _interopRequireDefault(__webpack_require__(/*! ../utils/useCustom */ \"./src/utils/useCustom.ts\"));\n\nvar _DropdownContext = _interopRequireDefault(__webpack_require__(/*! ./DropdownContext */ \"./src/Dropdown/DropdownContext.ts\"));\n\nvar _Menubar = _interopRequireDefault(__webpack_require__(/*! ../Menu/Menubar */ \"./src/Menu/Menubar.tsx\"));\n\nvar _Nav = _interopRequireDefault(__webpack_require__(/*! ../Nav */ \"./src/Nav/index.tsx\"));\n\nvar _NavContext = _interopRequireDefault(__webpack_require__(/*! ../Nav/NavContext */ \"./src/Nav/NavContext.ts\"));\n\nvar _warnOnce = _interopRequireDefault(__webpack_require__(/*! ../utils/warnOnce */ \"./src/utils/warnOnce.ts\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Dropdown/DropdownMenu.tsx\",\n _this = void 0,\n _templateObject,\n _templateObject2;\n\n/**\n * The <Dropdown.Menu> API\n *\n * @description\n * Note the difference between this component and <Menu> component:\n * <Menu> is used for ARIA menu control logic and is used internally only.\n * This component is only used for supporting submenu syntax and is\n * assigned to Dropdown.Menu\n *\n * @example\n *\n * <Dropdown>\n * <Dropdown.Item>Item 1</Dropdown.Item>\n * <Dropdown.Menu title=\"Submenu\">\n * <Dropdown.Item>Sub item</Dropdown.Item>\n * </Dropdown.Menu>\n * </Dropdown>\n */\nvar DropdownMenu = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var onToggle = props.onToggle,\n eventKey = props.eventKey,\n title = props.title,\n activeKey = props.activeKey,\n onSelect = props.onSelect,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'dropdown-menu' : _props$classPrefix,\n className = props.className,\n children = props.children,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"onToggle\", \"eventKey\", \"title\", \"activeKey\", \"onSelect\", \"classPrefix\", \"className\", \"children\"]);\n var nav = (0, _react.useContext)(_NavContext.default);\n var dropdown = (0, _react.useContext)(_DropdownContext.default);\n\n var _useCustom = (0, _useCustom2.default)('DropdownMenu'),\n rtl = _useCustom.rtl;\n\n var handleToggleSubmenu = (0, _react.useCallback)(function (_, event) {\n onToggle === null || onToggle === void 0 ? void 0 : onToggle(eventKey, event);\n }, [eventKey, onToggle]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n prefix = _useClassNames.prefix,\n withClassPrefix = _useClassNames.withClassPrefix;\n\n var _useClassNames2 = (0, _utils.useClassNames)('dropdown-menu'),\n withMenuClassPrefix = _useClassNames2.withClassPrefix,\n mergeMenuClassName = _useClassNames2.merge;\n\n var _useClassNames3 = (0, _utils.useClassNames)('dropdown-item'),\n mergeItemClassNames = _useClassNames3.merge,\n withItemClassPrefix = _useClassNames3.withClassPrefix,\n prefixItemClassName = _useClassNames3.prefix;\n\n var contextValue = (0, _react.useMemo)(function () {\n return {\n activeKey: activeKey,\n onSelect: onSelect\n };\n }, [activeKey, onSelect]); // If rendered within a <Nav>\n // Suggest <Nav.Menu>\n\n if (nav) {\n (0, _warnOnce.default)('Usage of <Dropdown.Menu> within <Nav> is deprecated. Replace with <Nav.Menu>');\n return /*#__PURE__*/_react.default.createElement(_Nav.default.Menu, (0, _extends2.default)({\n ref: ref\n }, props, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 12\n }\n }));\n } // <Dropdown.Menu> is used outside of <Dropdown>\n // renders a vertical `menubar`\n\n\n if (!dropdown) {\n var classes = merge(className, withClassPrefix());\n return /*#__PURE__*/_react.default.createElement(_DropdownContext.default.Provider, {\n value: contextValue,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 116,\n columnNumber: 7\n }\n }, /*#__PURE__*/_react.default.createElement(_Menubar.default, {\n vertical: true,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 117,\n columnNumber: 9\n }\n }, function (menubar, menubarRef) {\n return /*#__PURE__*/_react.default.createElement(\"ul\", (0, _extends2.default)({\n ref: (0, _utils.mergeRefs)(menubarRef, ref),\n className: classes\n }, menubar, rest, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 119,\n columnNumber: 13\n }\n }), children);\n }));\n } // Parent menu exists. This is a submenu.\n // Should render a `menuitem` that controls this submenu.\n\n\n var _omit = (0, _omit2.default)(rest, ['trigger']),\n icon = _omit.icon,\n disabled = _omit.disabled,\n menuProps = (0, _objectWithoutPropertiesLoose2.default)(_omit, [\"icon\", \"disabled\"]);\n\n var Icon = rtl ? _AngleLeft.default : _AngleRight.default;\n return /*#__PURE__*/_react.default.createElement(_Menu.default, {\n openMenuOn: ['mouseover', 'click'],\n renderMenuButton: function renderMenuButton(_ref, buttonRef) {\n var open = _ref.open,\n menuButtonProps = (0, _objectWithoutPropertiesLoose2.default)(_ref, [\"open\"]);\n return /*#__PURE__*/_react.default.createElement(_MenuItem.default, {\n disabled: disabled,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 138,\n columnNumber: 9\n }\n }, function (_ref2, menuitemRef) {\n var selected = _ref2.selected,\n active = _ref2.active,\n menuitem = (0, _objectWithoutPropertiesLoose2.default)(_ref2, [\"selected\", \"active\"]);\n var classes = mergeItemClassNames(className, prefixItemClassName(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2.default)([\"toggle\"]))), withItemClassPrefix({\n 'with-icon': icon,\n open: open,\n active: selected,\n disabled: disabled,\n focus: active\n }));\n return /*#__PURE__*/_react.default.createElement(\"div\", (0, _extends2.default)({\n ref: (0, _utils.mergeRefs)(buttonRef, menuitemRef),\n className: classes,\n \"data-event-key\": eventKey,\n \"data-event-key-type\": typeof eventKey\n }, menuitem, (0, _omit2.default)(menuButtonProps, ['role']), {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 153,\n columnNumber: 15\n }\n }), icon && /*#__PURE__*/_react.default.cloneElement(icon, {\n className: prefix('menu-icon')\n }), title, /*#__PURE__*/_react.default.createElement(Icon, {\n className: prefix(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteralLoose2.default)([\"toggle-icon\"]))),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 163,\n columnNumber: 17\n }\n }));\n });\n },\n renderMenuPopup: function renderMenuPopup(_ref3, popupRef) {\n var open = _ref3.open,\n popupProps = (0, _objectWithoutPropertiesLoose2.default)(_ref3, [\"open\"]);\n var menuClassName = mergeMenuClassName(className, withMenuClassPrefix());\n return /*#__PURE__*/_react.default.createElement(\"ul\", (0, _extends2.default)({\n ref: popupRef,\n className: menuClassName,\n hidden: !open\n }, popupProps, menuProps, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 173,\n columnNumber: 11\n }\n }), children);\n },\n onToggleMenu: handleToggleSubmenu,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 135,\n columnNumber: 5\n }\n }, function (_ref4, menuContainerRef) {\n var open = _ref4.open,\n menuContainer = (0, _objectWithoutPropertiesLoose2.default)(_ref4, [\"open\"]);\n var classes = mergeItemClassNames(className, withItemClassPrefix({\n disabled: disabled,\n open: open,\n submenu: true\n }));\n return /*#__PURE__*/_react.default.createElement(\"li\", (0, _extends2.default)({\n ref: (0, _utils.mergeRefs)(ref, menuContainerRef),\n className: classes\n }, menuContainer, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 196,\n columnNumber: 11\n }\n }));\n });\n});\n\nDropdownMenu.displayName = 'Dropdown.Menu';\nDropdownMenu.propTypes = {\n active: _propTypes.default.bool,\n activeKey: _propTypes.default.any,\n className: _propTypes.default.string,\n children: _propTypes.default.node,\n icon: _propTypes.default.any,\n classPrefix: _propTypes.default.string,\n pullLeft: _propTypes.default.bool,\n title: _propTypes.default.node,\n open: _propTypes.default.bool,\n trigger: _propTypes.default.oneOf(['click', 'hover']),\n eventKey: _propTypes.default.any,\n expanded: _propTypes.default.bool,\n collapsible: _propTypes.default.bool,\n onSelect: _propTypes.default.func,\n onToggle: _propTypes.default.func\n};\nvar _default = DropdownMenu;\nexports.default = _default;\n\n//# sourceURL=webpack://rsuite/./src/Dropdown/DropdownMenu.tsx?");
|
|
2687
2687
|
|
|
2688
2688
|
/***/ }),
|
|
2689
2689
|
|
|
@@ -3222,7 +3222,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
|
|
|
3222
3222
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3223
3223
|
|
|
3224
3224
|
"use strict";
|
|
3225
|
-
eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _on = _interopRequireDefault(__webpack_require__(/*! dom-lib/on */ \"./node_modules/dom-lib/esm/on.js\"));\n\nvar _react = __webpack_require__(/*! react */ \"react\");\n\nvar _AutoScroller = _interopRequireDefault(__webpack_require__(/*! ./AutoScroller */ \"./src/List/helper/AutoScroller.ts\"));\n\nvar _utils = __webpack_require__(/*! ./utils */ \"./src/List/helper/utils.ts\");\n\nvar _utils2 = __webpack_require__(/*! ../../utils */ \"./src/utils/index.ts\");\n\nvar _useManager2 = _interopRequireDefault(__webpack_require__(/*! ./useManager */ \"./src/List/helper/useManager.ts\"));\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nvar useSortHelper = function useSortHelper(config) {\n var autoScroll = config.autoScroll,\n pressDelay = config.pressDelay,\n transitionDuration = config.transitionDuration,\n onSort = config.onSort,\n onSortEnd = config.onSortEnd,\n onSortMove = config.onSortMove,\n onSortStart = config.onSortStart;\n\n var _useState = (0, _react.useState)(false),\n sorting = _useState[0],\n setSorting = _useState[1];\n\n var containerRef = (0, _react.useRef)(null);\n var pressTimer = (0, _react.useRef)();\n\n var _useManager = (0, _useManager2.default)(),\n listItemRegister = _useManager.listItemRegister,\n getManagedItem = _useManager.getManagedItem,\n getOrderedItems = _useManager.getOrderedItems;\n\n var isMounted = (0, _utils2.useIsMounted)();\n /**\n * start dragging\n * */\n\n var handlePress = (0, _react.useCallback)(function (mouseDownEvent, targetNode, curManagedItem) {\n var _curManagedItem$info$, _curManagedItem$info$2, _activeNodeHelper;\n\n if (!isMounted()) return;\n var listItemBaseClassName = targetNode.classList[0]; // get list item base className\n\n var helperElementClass = listItemBaseClassName + \"-helper\";\n var holderElementClass = listItemBaseClassName + \"-holder\"; // data\n\n var containerElement = containerRef.current;\n var activeNode = curManagedItem.node;\n var activeNodeOldIndex = (_curManagedItem$info$ = curManagedItem.info.index) !== null && _curManagedItem$info$ !== void 0 ? _curManagedItem$info$ : 0;\n var activeNodeNextIndex = (_curManagedItem$info$2 = curManagedItem.info.index) !== null && _curManagedItem$info$2 !== void 0 ? _curManagedItem$info$2 : 0;\n var activeNodeHolderTranslate = {\n x: 0,\n y: 0\n };\n var animatedNodesOffset = []; // all list item offset\n // init scroller\n\n var scrollContainer = (0, _utils.getScrollingParent)(containerElement) || containerElement;\n var initScroll = {\n x: scrollContainer.scrollLeft,\n y: scrollContainer.scrollTop\n };\n var autoScroller = new _AutoScroller.default(scrollContainer, function (offset) {\n activeNodeHolderTranslate.x += offset.left;\n activeNodeHolderTranslate.y += offset.top;\n });\n var activeNodeBoundingClientRect = activeNode.getBoundingClientRect();\n var activeNodeOffsetEdge = (0, _utils.getEdgeOffset)(activeNode, containerElement);\n var activeNodeStyle = getComputedStyle(activeNode);\n var activeNodeHelper = activeNode.cloneNode(true);\n (_activeNodeHelper = activeNodeHelper) === null || _activeNodeHelper === void 0 ? void 0 : _activeNodeHelper.classList.add(helperElementClass);\n (0, _utils.setInlineStyles)(activeNodeHelper, {\n position: 'fixed',\n width: activeNodeBoundingClientRect.width + \"px\",\n height: activeNodeBoundingClientRect.height + \"px\",\n left: activeNodeBoundingClientRect.left - parseFloat(activeNodeStyle.marginLeft) + \"px\",\n top: activeNodeBoundingClientRect.top - parseFloat(activeNodeStyle.marginTop) + \"px\"\n });\n activeNode.classList.add(holderElementClass);\n document.body.appendChild(activeNodeHelper);\n\n var getContainerScrollDelta = function getContainerScrollDelta() {\n return {\n left: scrollContainer.scrollLeft - initScroll.x,\n top: scrollContainer.scrollTop - initScroll.y\n };\n };\n\n var getHolderTranslate = function getHolderTranslate() {\n return animatedNodesOffset.reduce(function (acc, item) {\n return {\n x: acc.x + item.x,\n y: acc.y + item.y\n };\n }, {\n x: 0,\n y: 0\n });\n };\n\n var sortMouseMoveListener = (0, _on.default)(window, 'mousemove', function (mouseOverEvent) {\n // Update helper position\n var offset = {\n x: (mouseOverEvent === null || mouseOverEvent === void 0 ? void 0 : mouseOverEvent.pageX) || 0,\n y: (mouseOverEvent === null || mouseOverEvent === void 0 ? void 0 : mouseOverEvent.pageY) || 0\n };\n var containerScrollDelta = getContainerScrollDelta();\n var containerBoundingRect = scrollContainer.getBoundingClientRect();\n activeNodeHolderTranslate = {\n x: offset.x - mouseDownEvent.pageX,\n y: offset.y - mouseDownEvent.pageY\n };\n\n if (activeNodeHelper) {\n (0, _utils.setTranslate3d)(activeNodeHelper, activeNodeHolderTranslate);\n } // animate\n\n\n activeNodeNextIndex = -1;\n var listItemManagerRefs = getOrderedItems(curManagedItem.info.collection);\n var aTop = activeNodeOffsetEdge.top || 0;\n var cTop = containerScrollDelta.top || 0;\n var sortingOffsetY = aTop + activeNodeHolderTranslate.y + cTop;\n var activeNodeHeight = parseFloat(activeNodeStyle.height) || 0;\n\n for (var i = 0, len = listItemManagerRefs.length; i < len; i++) {\n var _listItemManagerRefs$;\n\n var currentNode = listItemManagerRefs[i].node;\n var currentNodeIndex = (_listItemManagerRefs$ = listItemManagerRefs[i].info.index) !== null && _listItemManagerRefs$ !== void 0 ? _listItemManagerRefs$ : 0;\n var offsetY = activeNodeBoundingClientRect.height > currentNode.offsetHeight ? currentNode.offsetHeight / 2 : activeNodeBoundingClientRect.height / 2;\n var translate = {\n x: 0,\n y: 0\n }; // If we haven't cached the node's offsetTop / offsetLeft value\n\n var curEdgeOffset = listItemManagerRefs[i].edgeOffset || (0, _utils.getEdgeOffset)(currentNode, containerElement);\n listItemManagerRefs[i].edgeOffset = curEdgeOffset; // Get a reference to the next node\n\n var prvNode = i > 0 && listItemManagerRefs[i - 1];\n var nextNode = i < len - 1 && listItemManagerRefs[i + 1]; // Also cache the node's edge offset if needed.\n\n if (prvNode && !prvNode.edgeOffset) {\n prvNode.edgeOffset = (0, _utils.getEdgeOffset)(prvNode.node, containerElement);\n }\n\n if (nextNode && !nextNode.edgeOffset) {\n nextNode.edgeOffset = (0, _utils.getEdgeOffset)(nextNode.node, containerElement);\n } // If the node is the one we're currently animating, skip it\n\n\n if (currentNodeIndex === activeNodeOldIndex) {\n continue;\n }\n\n var curEdgeOffsetTop = curEdgeOffset.top || 0;\n\n if (prvNode && currentNodeIndex > activeNodeOldIndex && sortingOffsetY + offsetY >= curEdgeOffsetTop) {\n translate.y = -activeNodeHeight;\n animatedNodesOffset[currentNodeIndex] = {\n x: 0,\n y: currentNode.offsetHeight\n };\n activeNodeNextIndex = currentNodeIndex;\n } else if (nextNode && currentNodeIndex < activeNodeOldIndex && sortingOffsetY <= curEdgeOffsetTop + offsetY) {\n translate.y = activeNodeHeight;\n animatedNodesOffset[currentNodeIndex] = {\n x: 0,\n y: -currentNode.offsetHeight\n };\n\n if (activeNodeNextIndex === -1) {\n activeNodeNextIndex = currentNodeIndex;\n }\n } else {\n animatedNodesOffset[currentNodeIndex] = {\n x: 0,\n y: 0\n };\n }\n\n (0, _utils.setTransitionDuration)(currentNode, transitionDuration);\n (0, _utils.setTranslate3d)(currentNode, translate); // translate holder\n\n (0, _utils.setTranslate3d)(activeNode, getHolderTranslate());\n }\n\n if (activeNodeNextIndex === -1) {\n activeNodeNextIndex = activeNodeOldIndex;\n } // auto scroll\n\n\n if (autoScroll) {\n autoScroller.update({\n width: activeNodeBoundingClientRect.width,\n height: activeNodeBoundingClientRect.height,\n translate: activeNodeHolderTranslate,\n maxTranslate: {\n x: 0,\n y: containerBoundingRect.top + containerBoundingRect.height - activeNodeBoundingClientRect.top - activeNodeBoundingClientRect.height / 2\n },\n minTranslate: {\n x: 0,\n y: containerBoundingRect.top - activeNodeBoundingClientRect.top - activeNodeBoundingClientRect.height / 2\n }\n });\n }\n\n onSortMove === null || onSortMove === void 0 ? void 0 : onSortMove({\n collection: curManagedItem.info.collection,\n node: activeNode,\n oldIndex: activeNodeOldIndex,\n newIndex: activeNodeNextIndex\n }, mouseOverEvent);\n }, {\n passive: false\n });\n var sortMouseEndListener = (0, _on.default)(window, 'mouseup', function (event) {\n // Remove the event listeners\n sortMouseMoveListener.off();\n sortMouseEndListener.off();\n var holderTranslate = getHolderTranslate();\n var containerScrollDelta = getContainerScrollDelta();\n\n if (activeNodeHelper) {\n (0, _utils.setTranslate3d)(activeNodeHelper, {\n x: holderTranslate.x - (containerScrollDelta.left || 0),\n y: holderTranslate.y - (containerScrollDelta.top || 0)\n });\n (0, _utils.setTransitionDuration)(activeNodeHelper, transitionDuration);\n } // wait for animation\n\n\n setTimeout(function () {\n var _activeNodeHelper2, _activeNodeHelper2$pa;\n\n if (!isMounted()) return; // Remove the helper from the DOM\n\n (_activeNodeHelper2 = activeNodeHelper) === null || _activeNodeHelper2 === void 0 ? void 0 : (_activeNodeHelper2$pa = _activeNodeHelper2.parentNode) === null || _activeNodeHelper2$pa === void 0 ? void 0 : _activeNodeHelper2$pa.removeChild(activeNodeHelper);\n activeNodeHelper = null; // Remove redundant styles\n\n activeNode.classList.remove(holderElementClass);\n (0, _utils.setTranslate3d)(activeNode, null);\n animatedNodesOffset = [];\n\n for (var _iterator = _createForOfIteratorHelperLoose(getOrderedItems(curManagedItem.info.collection)), _step; !(_step = _iterator()).done;) {\n var item = _step.value;\n // Clear the cached offsetTop / offsetLeft value\n item.edgeOffset = null; // Remove the transforms / transitions\n\n var el = item.node;\n (0, _utils.setTranslate3d)(el, null);\n (0, _utils.setTransitionDuration)(el, null);\n } // Stop autoScroll\n\n\n autoScroller.clear(); // Update manager state\n\n setSorting(false); // callbacks\n\n var callbackPayload = {\n collection: curManagedItem.info.collection,\n node: curManagedItem.node,\n newIndex: activeNodeNextIndex,\n oldIndex: activeNodeOldIndex\n };\n onSortEnd === null || onSortEnd === void 0 ? void 0 : onSortEnd(callbackPayload, event);\n onSort === null || onSort === void 0 ? void 0 : onSort(callbackPayload, event);\n }, transitionDuration);\n }, {\n passive: false\n });\n setSorting(true); // start callback\n\n onSortStart === null || onSortStart === void 0 ? void 0 : onSortStart({\n collection: curManagedItem.info.collection,\n node: activeNode,\n oldIndex: activeNodeOldIndex,\n newIndex: activeNodeNextIndex\n }, mouseDownEvent.nativeEvent);\n }, [autoScroll, getOrderedItems, isMounted, onSort, onSortEnd, onSortMove, onSortStart, transitionDuration]);\n /**\n * Determine whether to start dragging\n * */\n\n var handleStart = (0, _react.useCallback)(function (mouseDownEvent) {\n var triggeredNode = mouseDownEvent.target;\n var targetNode = (0, _utils.closestNode)(triggeredNode, function (el) {\n return Boolean(getManagedItem(el));\n });\n var curManagedItem = getManagedItem(targetNode);\n\n if ( // is not secondary button pressed\n mouseDownEvent.button !== 2 && // is list item\n Boolean(curManagedItem) && !curManagedItem.info.disabled && // is not sorting\n !sorting && // is valid node\n targetNode instanceof HTMLElement && // excludes interactive elements\n !targetNode.contains((0, _utils.closestNode)(triggeredNode, _utils.isContainInteractiveElement))) {\n mouseDownEvent.preventDefault();\n pressTimer.current = setTimeout(handlePress, pressDelay, mouseDownEvent, targetNode, curManagedItem);\n }\n }, [getManagedItem, handlePress, pressDelay, sorting]);\n /**\n * Clear timer after drag\n * */\n\n var handleEnd = (0, _react.useCallback)(function () {\n return clearTimeout(pressTimer.current);\n }, []);\n return {\n handleStart: handleStart,\n handleEnd: handleEnd,\n containerRef: containerRef,\n sorting: sorting,\n register: listItemRegister\n };\n};\n\nvar _default = useSortHelper;\nexports.default = _default;\n\n//# sourceURL=webpack://rsuite/./src/List/helper/useSortHelper.ts?");
|
|
3225
|
+
eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _on = _interopRequireDefault(__webpack_require__(/*! dom-lib/on */ \"./node_modules/dom-lib/esm/on.js\"));\n\nvar _react = __webpack_require__(/*! react */ \"react\");\n\nvar _AutoScroller = _interopRequireDefault(__webpack_require__(/*! ./AutoScroller */ \"./src/List/helper/AutoScroller.ts\"));\n\nvar _utils = __webpack_require__(/*! ./utils */ \"./src/List/helper/utils.ts\");\n\nvar _utils2 = __webpack_require__(/*! ../../utils */ \"./src/utils/index.ts\");\n\nvar _useManager2 = _interopRequireDefault(__webpack_require__(/*! ./useManager */ \"./src/List/helper/useManager.ts\"));\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nvar helperElementClass = 'rs-list-item-helper';\nvar holderElementClass = 'rs-list-item-holder';\n\nvar useSortHelper = function useSortHelper(config) {\n var autoScroll = config.autoScroll,\n pressDelay = config.pressDelay,\n transitionDuration = config.transitionDuration,\n onSort = config.onSort,\n onSortEnd = config.onSortEnd,\n onSortMove = config.onSortMove,\n onSortStart = config.onSortStart;\n\n var _useState = (0, _react.useState)(false),\n sorting = _useState[0],\n setSorting = _useState[1];\n\n var containerRef = (0, _react.useRef)(null);\n var pressTimer = (0, _react.useRef)();\n\n var _useManager = (0, _useManager2.default)(),\n listItemRegister = _useManager.listItemRegister,\n getManagedItem = _useManager.getManagedItem,\n getOrderedItems = _useManager.getOrderedItems;\n\n var isMounted = (0, _utils2.useIsMounted)();\n /**\n * start dragging\n * */\n\n var handlePress = (0, _react.useCallback)(function (mouseDownEvent, _targetNode, curManagedItem) {\n var _curManagedItem$info$, _curManagedItem$info$2, _activeNodeHelper;\n\n if (!isMounted()) return; // data\n\n var containerElement = containerRef.current;\n var activeNode = curManagedItem.node;\n var activeNodeOldIndex = (_curManagedItem$info$ = curManagedItem.info.index) !== null && _curManagedItem$info$ !== void 0 ? _curManagedItem$info$ : 0;\n var activeNodeNextIndex = (_curManagedItem$info$2 = curManagedItem.info.index) !== null && _curManagedItem$info$2 !== void 0 ? _curManagedItem$info$2 : 0;\n var activeNodeHolderTranslate = {\n x: 0,\n y: 0\n };\n var animatedNodesOffset = []; // all list item offset\n // init scroller\n\n var scrollContainer = (0, _utils.getScrollingParent)(containerElement) || containerElement;\n var initScroll = {\n x: scrollContainer.scrollLeft,\n y: scrollContainer.scrollTop\n };\n var autoScroller = new _AutoScroller.default(scrollContainer, function (offset) {\n activeNodeHolderTranslate.x += offset.left;\n activeNodeHolderTranslate.y += offset.top;\n });\n var activeNodeBoundingClientRect = activeNode.getBoundingClientRect();\n var activeNodeOffsetEdge = (0, _utils.getEdgeOffset)(activeNode, containerElement);\n var activeNodeStyle = getComputedStyle(activeNode);\n var activeNodeHelper = activeNode.cloneNode(true);\n (_activeNodeHelper = activeNodeHelper) === null || _activeNodeHelper === void 0 ? void 0 : _activeNodeHelper.classList.add(helperElementClass);\n (0, _utils.setInlineStyles)(activeNodeHelper, {\n position: 'fixed',\n width: activeNodeBoundingClientRect.width + \"px\",\n height: activeNodeBoundingClientRect.height + \"px\",\n left: activeNodeBoundingClientRect.left - parseFloat(activeNodeStyle.marginLeft) + \"px\",\n top: activeNodeBoundingClientRect.top - parseFloat(activeNodeStyle.marginTop) + \"px\"\n });\n activeNode.classList.add(holderElementClass);\n document.body.appendChild(activeNodeHelper);\n\n var getContainerScrollDelta = function getContainerScrollDelta() {\n return {\n left: scrollContainer.scrollLeft - initScroll.x,\n top: scrollContainer.scrollTop - initScroll.y\n };\n };\n\n var getHolderTranslate = function getHolderTranslate() {\n return animatedNodesOffset.reduce(function (acc, item) {\n return {\n x: acc.x + item.x,\n y: acc.y + item.y\n };\n }, {\n x: 0,\n y: 0\n });\n };\n\n var sortMouseMoveListener = (0, _on.default)(window, 'mousemove', function (mouseOverEvent) {\n // Update helper position\n var offset = {\n x: (mouseOverEvent === null || mouseOverEvent === void 0 ? void 0 : mouseOverEvent.pageX) || 0,\n y: (mouseOverEvent === null || mouseOverEvent === void 0 ? void 0 : mouseOverEvent.pageY) || 0\n };\n var containerScrollDelta = getContainerScrollDelta();\n var containerBoundingRect = scrollContainer.getBoundingClientRect();\n activeNodeHolderTranslate = {\n x: offset.x - mouseDownEvent.pageX,\n y: offset.y - mouseDownEvent.pageY\n };\n\n if (activeNodeHelper) {\n (0, _utils.setTranslate3d)(activeNodeHelper, activeNodeHolderTranslate);\n } // animate\n\n\n activeNodeNextIndex = -1;\n var listItemManagerRefs = getOrderedItems(curManagedItem.info.collection);\n var aTop = activeNodeOffsetEdge.top || 0;\n var cTop = containerScrollDelta.top || 0;\n var sortingOffsetY = aTop + activeNodeHolderTranslate.y + cTop;\n\n for (var i = 0, len = listItemManagerRefs.length; i < len; i++) {\n var _listItemManagerRefs$;\n\n var currentNode = listItemManagerRefs[i].node;\n var currentNodeIndex = (_listItemManagerRefs$ = listItemManagerRefs[i].info.index) !== null && _listItemManagerRefs$ !== void 0 ? _listItemManagerRefs$ : 0;\n var offsetY = activeNodeBoundingClientRect.height > currentNode.offsetHeight ? currentNode.offsetHeight / 2 : activeNodeBoundingClientRect.height / 2;\n var translate = {\n x: 0,\n y: 0\n }; // If we haven't cached the node's offsetTop / offsetLeft value\n\n var curEdgeOffset = listItemManagerRefs[i].edgeOffset || (0, _utils.getEdgeOffset)(currentNode, containerElement);\n listItemManagerRefs[i].edgeOffset = curEdgeOffset; // Get a reference to the next node\n\n var prvNode = i > 0 && listItemManagerRefs[i - 1];\n var nextNode = i < len - 1 && listItemManagerRefs[i + 1]; // Also cache the node's edge offset if needed.\n\n if (prvNode && !prvNode.edgeOffset) {\n prvNode.edgeOffset = (0, _utils.getEdgeOffset)(prvNode.node, containerElement);\n }\n\n if (nextNode && !nextNode.edgeOffset) {\n nextNode.edgeOffset = (0, _utils.getEdgeOffset)(nextNode.node, containerElement);\n } // If the node is the one we're currently animating, skip it\n\n\n if (currentNodeIndex === activeNodeOldIndex) {\n continue;\n }\n\n var curEdgeOffsetTop = curEdgeOffset.top || 0;\n\n if (prvNode && currentNodeIndex > activeNodeOldIndex && sortingOffsetY + offsetY >= curEdgeOffsetTop) {\n var _prvNode$edgeOffset;\n\n var yOffset = (((_prvNode$edgeOffset = prvNode.edgeOffset) === null || _prvNode$edgeOffset === void 0 ? void 0 : _prvNode$edgeOffset.top) || 0) - curEdgeOffsetTop;\n translate.y = yOffset;\n animatedNodesOffset[currentNodeIndex] = {\n x: 0,\n y: -yOffset\n };\n activeNodeNextIndex = currentNodeIndex;\n } else if (nextNode && currentNodeIndex < activeNodeOldIndex && sortingOffsetY <= curEdgeOffsetTop + offsetY) {\n var _nextNode$edgeOffset;\n\n var _yOffset = (((_nextNode$edgeOffset = nextNode.edgeOffset) === null || _nextNode$edgeOffset === void 0 ? void 0 : _nextNode$edgeOffset.top) || 0) - curEdgeOffsetTop;\n\n translate.y = _yOffset;\n animatedNodesOffset[currentNodeIndex] = {\n x: 0,\n y: -_yOffset\n };\n\n if (activeNodeNextIndex === -1) {\n activeNodeNextIndex = currentNodeIndex;\n }\n } else {\n animatedNodesOffset[currentNodeIndex] = {\n x: 0,\n y: 0\n };\n }\n\n (0, _utils.setTransitionDuration)(currentNode, transitionDuration);\n (0, _utils.setTranslate3d)(currentNode, translate); // translate holder\n\n (0, _utils.setTranslate3d)(activeNode, getHolderTranslate());\n }\n\n if (activeNodeNextIndex === -1) {\n activeNodeNextIndex = activeNodeOldIndex;\n } // auto scroll\n\n\n if (autoScroll) {\n autoScroller.update({\n width: activeNodeBoundingClientRect.width,\n height: activeNodeBoundingClientRect.height,\n translate: activeNodeHolderTranslate,\n maxTranslate: {\n x: 0,\n y: containerBoundingRect.top + containerBoundingRect.height - activeNodeBoundingClientRect.top - activeNodeBoundingClientRect.height / 2\n },\n minTranslate: {\n x: 0,\n y: containerBoundingRect.top - activeNodeBoundingClientRect.top - activeNodeBoundingClientRect.height / 2\n }\n });\n }\n\n onSortMove === null || onSortMove === void 0 ? void 0 : onSortMove({\n collection: curManagedItem.info.collection,\n node: activeNode,\n oldIndex: activeNodeOldIndex,\n newIndex: activeNodeNextIndex\n }, mouseOverEvent);\n }, {\n passive: false\n });\n var sortMouseEndListener = (0, _on.default)(window, 'mouseup', function (event) {\n // Remove the event listeners\n sortMouseMoveListener.off();\n sortMouseEndListener.off();\n var holderTranslate = getHolderTranslate();\n var containerScrollDelta = getContainerScrollDelta();\n\n if (activeNodeHelper) {\n (0, _utils.setTranslate3d)(activeNodeHelper, {\n x: holderTranslate.x - (containerScrollDelta.left || 0),\n y: holderTranslate.y - (containerScrollDelta.top || 0)\n });\n (0, _utils.setTransitionDuration)(activeNodeHelper, transitionDuration);\n } // wait for animation\n\n\n setTimeout(function () {\n var _activeNodeHelper2, _activeNodeHelper2$pa;\n\n if (!isMounted()) return; // Remove the helper from the DOM\n\n (_activeNodeHelper2 = activeNodeHelper) === null || _activeNodeHelper2 === void 0 ? void 0 : (_activeNodeHelper2$pa = _activeNodeHelper2.parentNode) === null || _activeNodeHelper2$pa === void 0 ? void 0 : _activeNodeHelper2$pa.removeChild(activeNodeHelper);\n activeNodeHelper = null; // Remove redundant styles\n\n activeNode.classList.remove(holderElementClass);\n (0, _utils.setTranslate3d)(activeNode, null);\n animatedNodesOffset = [];\n\n for (var _iterator = _createForOfIteratorHelperLoose(getOrderedItems(curManagedItem.info.collection)), _step; !(_step = _iterator()).done;) {\n var item = _step.value;\n // Clear the cached offsetTop / offsetLeft value\n item.edgeOffset = null; // Remove the transforms / transitions\n\n var el = item.node;\n (0, _utils.setTranslate3d)(el, null);\n (0, _utils.setTransitionDuration)(el, null);\n } // Stop autoScroll\n\n\n autoScroller.clear(); // Update manager state\n\n setSorting(false); // callbacks\n\n var callbackPayload = {\n collection: curManagedItem.info.collection,\n node: curManagedItem.node,\n newIndex: activeNodeNextIndex,\n oldIndex: activeNodeOldIndex\n };\n onSortEnd === null || onSortEnd === void 0 ? void 0 : onSortEnd(callbackPayload, event);\n onSort === null || onSort === void 0 ? void 0 : onSort(callbackPayload, event);\n }, transitionDuration);\n }, {\n passive: false\n });\n setSorting(true); // start callback\n\n onSortStart === null || onSortStart === void 0 ? void 0 : onSortStart({\n collection: curManagedItem.info.collection,\n node: activeNode,\n oldIndex: activeNodeOldIndex,\n newIndex: activeNodeNextIndex\n }, mouseDownEvent.nativeEvent);\n }, [autoScroll, getOrderedItems, isMounted, onSort, onSortEnd, onSortMove, onSortStart, transitionDuration]);\n /**\n * Determine whether to start dragging\n * */\n\n var handleStart = (0, _react.useCallback)(function (mouseDownEvent) {\n var triggeredNode = mouseDownEvent.target;\n var targetNode = (0, _utils.closestNode)(triggeredNode, function (el) {\n return Boolean(getManagedItem(el));\n });\n var curManagedItem = getManagedItem(targetNode);\n\n if ( // is not secondary button pressed\n mouseDownEvent.button !== 2 && // is list item\n Boolean(curManagedItem) && !curManagedItem.info.disabled && // is not sorting\n !sorting && // is valid node\n targetNode instanceof HTMLElement && // excludes interactive elements\n !targetNode.contains((0, _utils.closestNode)(triggeredNode, _utils.isContainInteractiveElement))) {\n mouseDownEvent.preventDefault();\n pressTimer.current = setTimeout(handlePress, pressDelay, mouseDownEvent, targetNode, curManagedItem);\n }\n }, [getManagedItem, handlePress, pressDelay, sorting]);\n /**\n * Clear timer after drag\n * */\n\n var handleEnd = (0, _react.useCallback)(function () {\n return clearTimeout(pressTimer.current);\n }, []);\n return {\n handleStart: handleStart,\n handleEnd: handleEnd,\n containerRef: containerRef,\n sorting: sorting,\n register: listItemRegister\n };\n};\n\nvar _default = useSortHelper;\nexports.default = _default;\n\n//# sourceURL=webpack://rsuite/./src/List/helper/useSortHelper.ts?");
|
|
3226
3226
|
|
|
3227
3227
|
/***/ }),
|
|
3228
3228
|
|
|
@@ -5048,7 +5048,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
|
|
|
5048
5048
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5049
5049
|
|
|
5050
5050
|
"use strict";
|
|
5051
|
-
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
|
|
5051
|
+
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 _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/extends.js\"));\n\nvar _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.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 _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Button = _interopRequireDefault(__webpack_require__(/*! ../Button */ \"./src/Button/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Uploader/UploadTrigger.tsx\",\n _this = void 0;\n\nvar UploadTrigger = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var _props$as = props.as,\n Component = _props$as === void 0 ? _Button.default : _props$as,\n name = props.name,\n accept = props.accept,\n multiple = props.multiple,\n disabled = props.disabled,\n readOnly = props.readOnly,\n children = props.children,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'uploader-trigger' : _props$classPrefix,\n className = props.className,\n draggable = props.draggable,\n locale = props.locale,\n onChange = props.onChange,\n onDragEnter = props.onDragEnter,\n onDragLeave = props.onDragLeave,\n onDragOver = props.onDragOver,\n onDrop = props.onDrop,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"as\", \"name\", \"accept\", \"multiple\", \"disabled\", \"readOnly\", \"children\", \"classPrefix\", \"className\", \"draggable\", \"locale\", \"onChange\", \"onDragEnter\", \"onDragLeave\", \"onDragOver\", \"onDrop\"]);\n var rootRef = (0, _react.useRef)(null);\n\n var _useState = (0, _react.useState)(false),\n dragOver = _useState[0],\n setDragOver = _useState[1];\n\n var inputRef = (0, _react.useRef)(null);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n withClassPrefix = _useClassNames.withClassPrefix,\n prefix = _useClassNames.prefix;\n\n var classes = merge(className, withClassPrefix({\n disabled: disabled,\n customize: children,\n 'drag-over': dragOver\n }));\n var handleClick = (0, _react.useCallback)(function () {\n var _inputRef$current;\n\n (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.click();\n }, []);\n var handleClearInput = (0, _react.useCallback)(function () {\n if (inputRef.current) {\n inputRef.current.value = '';\n }\n }, []);\n var handleDragEnter = (0, _react.useCallback)(function (event) {\n if (draggable) {\n event.preventDefault();\n setDragOver(true);\n }\n\n onDragEnter === null || onDragEnter === void 0 ? void 0 : onDragEnter(event);\n }, [draggable, onDragEnter]);\n var handleDragLeave = (0, _react.useCallback)(function (event) {\n if (draggable) {\n event.preventDefault();\n setDragOver(false);\n }\n\n onDragLeave === null || onDragLeave === void 0 ? void 0 : onDragLeave(event);\n }, [draggable, onDragLeave]);\n var handleDragOver = (0, _react.useCallback)(function (event) {\n draggable && event.preventDefault();\n onDragOver === null || onDragOver === void 0 ? void 0 : onDragOver(event);\n }, [draggable, onDragOver]);\n var handleDrop = (0, _react.useCallback)(function (event) {\n if (draggable) {\n event.preventDefault();\n setDragOver(false);\n onChange === null || onChange === void 0 ? void 0 : onChange(event);\n }\n\n onDrop === null || onDrop === void 0 ? void 0 : onDrop(event);\n }, [draggable, onChange, onDrop]);\n var handleChange = (0, _react.useCallback)(function (event) {\n if ((0, _utils.isIE11)()) {\n var _event$target, _event$target$files;\n\n /**\n * IE11 triggers onChange event of file input when element.value is assigned\n * https://github.com/facebook/react/issues/8793\n */\n if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : (_event$target$files = _event$target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files.length) > 0) {\n onChange === null || onChange === void 0 ? void 0 : onChange(event);\n }\n\n return;\n }\n\n onChange === null || onChange === void 0 ? void 0 : onChange(event);\n }, [onChange]);\n (0, _react.useImperativeHandle)(ref, function () {\n return {\n root: rootRef.current,\n clearInput: handleClearInput\n };\n });\n var buttonProps = (0, _extends2.default)({}, rest, {\n disabled: disabled,\n className: prefix('btn')\n });\n\n if (!disabled && !readOnly) {\n buttonProps.onClick = handleClick;\n buttonProps.onDragEnter = handleDragEnter;\n buttonProps.onDragLeave = handleDragLeave;\n buttonProps.onDragOver = handleDragOver;\n buttonProps.onDrop = handleDrop;\n }\n\n var trigger = children ? /*#__PURE__*/_react.default.cloneElement(_react.default.Children.only(children), buttonProps) : /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, buttonProps, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 151,\n columnNumber: 5\n }\n }), locale === null || locale === void 0 ? void 0 : locale.upload);\n return /*#__PURE__*/_react.default.createElement(\"div\", {\n ref: rootRef,\n className: classes,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 155,\n columnNumber: 5\n }\n }, /*#__PURE__*/_react.default.createElement(\"input\", {\n type: \"file\",\n name: name,\n multiple: multiple,\n disabled: disabled,\n readOnly: readOnly,\n accept: accept,\n ref: inputRef,\n onChange: handleChange,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 156,\n columnNumber: 7\n }\n }), trigger);\n});\n\nUploadTrigger.displayName = 'UploadTrigger';\nUploadTrigger.propTypes = {\n locale: _propTypes.default.any,\n name: _propTypes.default.string,\n multiple: _propTypes.default.bool,\n disabled: _propTypes.default.bool,\n readOnly: _propTypes.default.bool,\n accept: _propTypes.default.string,\n onChange: _propTypes.default.func,\n classPrefix: _propTypes.default.string,\n className: _propTypes.default.string,\n children: _propTypes.default.node,\n draggable: _propTypes.default.bool,\n onDragEnter: _propTypes.default.func,\n onDragLeave: _propTypes.default.func,\n onDragOver: _propTypes.default.func,\n onDrop: _propTypes.default.func\n};\nvar _default = UploadTrigger;\nexports.default = _default;\n\n//# sourceURL=webpack://rsuite/./src/Uploader/UploadTrigger.tsx?");
|
|
5052
5052
|
|
|
5053
5053
|
/***/ }),
|
|
5054
5054
|
|
|
@@ -5059,7 +5059,7 @@ eval("\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/he
|
|
|
5059
5059
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5060
5060
|
|
|
5061
5061
|
"use strict";
|
|
5062
|
-
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 _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _find = _interopRequireDefault(__webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\"));\n\nvar _UploadFileItem = _interopRequireDefault(__webpack_require__(/*! ./UploadFileItem */ \"./src/Uploader/UploadFileItem.tsx\"));\n\nvar _UploadTrigger = _interopRequireDefault(__webpack_require__(/*! ./UploadTrigger */ \"./src/Uploader/UploadTrigger.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Plaintext = _interopRequireDefault(__webpack_require__(/*! ../Plaintext */ \"./src/Plaintext/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Uploader/Uploader.tsx\",\n _this = void 0;\n\nvar getFiles = function getFiles(event) {\n if (typeof (event === null || event === void 0 ? void 0 : event['dataTransfer']) === 'object') {\n var _event$dataTransfer;\n\n return event === null || event === void 0 ? void 0 : (_event$dataTransfer = event['dataTransfer']) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.files;\n }\n\n if (event.target) {\n return event.target['files'];\n }\n\n return [];\n};\n\nvar createFile = function createFile(file) {\n var fileKey = file.fileKey;\n return (0, _extends2.default)({}, file, {\n fileKey: fileKey || (0, _utils.guid)(),\n progress: 0\n });\n};\n\nfunction fileListReducer(files, action) {\n var _action$files;\n\n switch (action.type) {\n // Add one or more files\n case 'push':\n return [].concat(files, action.files);\n // Remove a file by `fileKey`\n\n case 'remove':\n return files.filter(function (f) {\n return f.fileKey !== action.fileKey;\n });\n // Update a file\n\n case 'updateFile':\n return files.map(function (file) {\n return file.fileKey === action.file.fileKey ? action.file : file;\n });\n // Initialization file list\n\n case 'init':\n return ((_action$files = action.files) === null || _action$files === void 0 ? void 0 : _action$files.map(function (file) {\n // The state of the file needs to be preserved when the `fileList` is controlled.\n return files.find(function (f) {\n return f.fileKey === file.fileKey;\n }) || createFile(file);\n })) || [];\n\n default:\n throw new Error();\n }\n}\n\nvar useFileList = function useFileList(defaultFileList) {\n if (defaultFileList === void 0) {\n defaultFileList = [];\n }\n\n var fileListRef = (0, _react.useRef)(defaultFileList.map(createFile));\n var fileListUpdateCallback = (0, _react.useRef)();\n\n var _useReducer = (0, _react.useReducer)(fileListReducer, fileListRef.current),\n fileList = _useReducer[0],\n dispatch = _useReducer[1];\n\n fileListRef.current = fileList;\n (0, _react.useEffect)(function () {\n var _fileListUpdateCallba;\n\n (_fileListUpdateCallba = fileListUpdateCallback.current) === null || _fileListUpdateCallba === void 0 ? void 0 : _fileListUpdateCallba.call(fileListUpdateCallback, fileList);\n fileListUpdateCallback.current = null;\n }, [fileList]);\n (0, _utils.useWillUnmount)(function () {\n fileListUpdateCallback.current = null;\n });\n var dispatchCallback = (0, _react.useCallback)(function (action, callback) {\n dispatch(action);\n fileListUpdateCallback.current = callback;\n }, []);\n return [fileListRef, dispatchCallback];\n};\n\nvar Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var _props$as = props.as,\n Component = _props$as === void 0 ? 'div' : _props$as,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'uploader' : _props$classPrefix,\n className = props.className,\n _props$listType = props.listType,\n listType = _props$listType === void 0 ? 'text' : _props$listType,\n defaultFileList = props.defaultFileList,\n fileListProp = props.fileList,\n _props$fileListVisibl = props.fileListVisible,\n fileListVisible = _props$fileListVisibl === void 0 ? true : _props$fileListVisibl,\n localeProp = props.locale,\n style = props.style,\n draggable = props.draggable,\n _props$name = props.name,\n name = _props$name === void 0 ? 'file' : _props$name,\n _props$multiple = props.multiple,\n multiple = _props$multiple === void 0 ? false : _props$multiple,\n _props$disabled = props.disabled,\n disabled = _props$disabled === void 0 ? false : _props$disabled,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n accept = props.accept,\n children = props.children,\n toggleAs = props.toggleAs,\n _props$removable = props.removable,\n removable = _props$removable === void 0 ? true : _props$removable,\n disabledFileItem = props.disabledFileItem,\n maxPreviewFileSize = props.maxPreviewFileSize,\n _props$method = props.method,\n method = _props$method === void 0 ? 'POST' : _props$method,\n _props$autoUpload = props.autoUpload,\n autoUpload = _props$autoUpload === void 0 ? true : _props$autoUpload,\n action = props.action,\n headers = props.headers,\n _props$withCredential = props.withCredentials,\n withCredentials = _props$withCredential === void 0 ? false : _props$withCredential,\n disableMultipart = props.disableMultipart,\n _props$timeout = props.timeout,\n timeout = _props$timeout === void 0 ? 0 : _props$timeout,\n _props$data = props.data,\n data = _props$data === void 0 ? {} : _props$data,\n onRemove = props.onRemove,\n onUpload = props.onUpload,\n shouldUpload = props.shouldUpload,\n shouldQueueUpdate = props.shouldQueueUpdate,\n renderFileInfo = props.renderFileInfo,\n renderThumbnail = props.renderThumbnail,\n onPreview = props.onPreview,\n onChange = props.onChange,\n onSuccess = props.onSuccess,\n onError = props.onError,\n onProgress = props.onProgress,\n onReupload = props.onReupload,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"as\", \"classPrefix\", \"className\", \"listType\", \"defaultFileList\", \"fileList\", \"fileListVisible\", \"locale\", \"style\", \"draggable\", \"name\", \"multiple\", \"disabled\", \"readOnly\", \"plaintext\", \"accept\", \"children\", \"toggleAs\", \"removable\", \"disabledFileItem\", \"maxPreviewFileSize\", \"method\", \"autoUpload\", \"action\", \"headers\", \"withCredentials\", \"disableMultipart\", \"timeout\", \"data\", \"onRemove\", \"onUpload\", \"shouldUpload\", \"shouldQueueUpdate\", \"renderFileInfo\", \"renderThumbnail\", \"onPreview\", \"onChange\", \"onSuccess\", \"onError\", \"onProgress\", \"onReupload\"]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n withClassPrefix = _useClassNames.withClassPrefix,\n prefix = _useClassNames.prefix;\n\n var classes = merge(className, withClassPrefix(listType, {\n draggable: draggable\n }));\n\n var _useCustom = (0, _utils.useCustom)('Uploader', localeProp),\n locale = _useCustom.locale;\n\n var rootRef = (0, _react.useRef)();\n var xhrs = (0, _react.useRef)({});\n var trigger = (0, _react.useRef)();\n\n var _useFileList = useFileList(fileListProp || defaultFileList),\n fileList = _useFileList[0],\n dispatch = _useFileList[1];\n\n (0, _react.useEffect)(function () {\n if (typeof fileListProp !== 'undefined') {\n // Force reset fileList in reducer, when `fileListProp` is updated\n dispatch({\n type: 'init',\n files: fileListProp\n });\n }\n }, [dispatch, fileListProp]);\n var updateFileStatus = (0, _react.useCallback)(function (nextFile) {\n dispatch({\n type: 'updateFile',\n file: nextFile\n });\n }, [dispatch]);\n /**\n * Clear the value in input.\n */\n\n var cleanInputValue = (0, _react.useCallback)(function () {\n var _trigger$current;\n\n (_trigger$current = trigger.current) === null || _trigger$current === void 0 ? void 0 : _trigger$current.clearInput();\n }, []);\n /**\n * Callback for successful file upload.\n * @param file\n * @param response\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadSuccess = (0, _react.useCallback)(function (file, response, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'finished',\n progress: 100\n });\n updateFileStatus(nextFile);\n onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response, nextFile, event, xhr);\n }, [onSuccess, updateFileStatus]);\n /**\n * Callback for file upload error.\n * @param file\n * @param status\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadError = (0, _react.useCallback)(function (file, status, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'error'\n });\n updateFileStatus(nextFile);\n onError === null || onError === void 0 ? void 0 : onError(status, nextFile, event, xhr);\n }, [onError, updateFileStatus]);\n /**\n * Callback for file upload progress update.\n * @param file\n * @param percent\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadProgress = (0, _react.useCallback)(function (file, percent, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'uploading',\n progress: percent\n });\n updateFileStatus(nextFile);\n onProgress === null || onProgress === void 0 ? void 0 : onProgress(percent, nextFile, event, xhr);\n }, [onProgress, updateFileStatus]);\n /**\n * Upload a single file.\n * @param file\n */\n\n var handleUploadFile = (0, _react.useCallback)(function (file) {\n var _ajaxUpload = (0, _utils.ajaxUpload)({\n name: name,\n timeout: timeout,\n headers: headers,\n data: data,\n method: method,\n withCredentials: withCredentials,\n disableMultipart: disableMultipart,\n file: file.blobFile,\n url: action,\n onError: handleAjaxUploadError.bind(null, file),\n onSuccess: handleAjaxUploadSuccess.bind(null, file),\n onProgress: handleAjaxUploadProgress.bind(null, file)\n }),\n xhr = _ajaxUpload.xhr,\n uploadData = _ajaxUpload.data;\n\n updateFileStatus((0, _extends2.default)({}, file, {\n status: 'uploading'\n }));\n\n if (file.fileKey) {\n xhrs.current[file.fileKey] = xhr;\n }\n\n onUpload === null || onUpload === void 0 ? void 0 : onUpload(file, uploadData, xhr);\n }, [name, timeout, headers, data, method, withCredentials, disableMultipart, action, handleAjaxUploadError, handleAjaxUploadSuccess, handleAjaxUploadProgress, updateFileStatus, onUpload]);\n var handleAjaxUpload = (0, _react.useCallback)(function () {\n fileList.current.forEach(function (file) {\n var checkState = shouldUpload === null || shouldUpload === void 0 ? void 0 : shouldUpload(file);\n\n if (checkState instanceof Promise) {\n checkState.then(function (res) {\n if (res) {\n handleUploadFile(file);\n }\n });\n return;\n } else if (checkState === false) {\n return;\n }\n\n if (file.status === 'inited') {\n handleUploadFile(file);\n }\n });\n cleanInputValue();\n }, [cleanInputValue, fileList, handleUploadFile, shouldUpload]);\n\n var handleUploadTriggerChange = function handleUploadTriggerChange(event) {\n var files = getFiles(event);\n var newFileList = [];\n Array.from(files).forEach(function (file) {\n newFileList.push({\n blobFile: file,\n name: file.name,\n status: 'inited',\n fileKey: (0, _utils.guid)()\n });\n });\n var nextFileList = [].concat(fileList.current, newFileList);\n var checkState = shouldQueueUpdate === null || shouldQueueUpdate === void 0 ? void 0 : shouldQueueUpdate(nextFileList, newFileList);\n\n if (checkState === false) {\n cleanInputValue();\n return;\n }\n\n var upload = function upload() {\n onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);\n dispatch({\n type: 'push',\n files: newFileList\n }, function () {\n autoUpload && handleAjaxUpload();\n });\n };\n\n if (checkState instanceof Promise) {\n checkState.then(function (res) {\n res && upload();\n });\n return;\n }\n\n upload();\n };\n\n var handleRemoveFile = function handleRemoveFile(fileKey) {\n var _xhrs$current, _xhrs$current$file$fi;\n\n var file = (0, _find.default)(fileList.current, function (f) {\n return f.fileKey === fileKey;\n });\n var nextFileList = fileList.current.filter(function (f) {\n return f.fileKey !== fileKey;\n });\n\n if (((_xhrs$current = xhrs.current) === null || _xhrs$current === void 0 ? void 0 : (_xhrs$current$file$fi = _xhrs$current[file.fileKey]) === null || _xhrs$current$file$fi === void 0 ? void 0 : _xhrs$current$file$fi.readyState) !== 4) {\n var _xhrs$current$file$fi2;\n\n (_xhrs$current$file$fi2 = xhrs.current[file.fileKey]) === null || _xhrs$current$file$fi2 === void 0 ? void 0 : _xhrs$current$file$fi2.abort();\n }\n\n dispatch({\n type: 'remove',\n fileKey: fileKey\n });\n onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);\n onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);\n cleanInputValue();\n };\n\n var handleReupload = function handleReupload(file) {\n autoUpload && handleUploadFile(file);\n onReupload === null || onReupload === void 0 ? void 0 : onReupload(file);\n }; // public API\n\n\n var start = function start(file) {\n if (file) {\n handleUploadFile(file);\n return;\n }\n\n handleAjaxUpload();\n };\n\n (0, _react.useImperativeHandle)(ref, function () {\n return {\n root: rootRef.current,\n start: start\n };\n });\n var renderList = [/*#__PURE__*/_react.default.createElement(_UploadTrigger.default, (0, _extends2.default)({}, rest, {\n locale: locale,\n name: name,\n key: \"trigger\",\n multiple: multiple,\n draggable: draggable,\n disabled: disabled,\n readOnly: readOnly,\n accept: accept,\n ref: trigger,\n onChange: handleUploadTriggerChange,\n as: toggleAs,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 524,\n columnNumber: 5\n }\n }), children)];\n\n if (fileListVisible) {\n renderList.push( /*#__PURE__*/_react.default.createElement(\"div\", {\n key: \"items\",\n className: prefix('file-items'),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 544,\n columnNumber: 7\n }\n }, fileList.current.map(function (file, index) {\n return /*#__PURE__*/_react.default.createElement(_UploadFileItem.default, {\n locale: locale,\n key: file.fileKey || index,\n file: file,\n maxPreviewFileSize: maxPreviewFileSize,\n listType: listType,\n disabled: disabledFileItem,\n onPreview: onPreview,\n onReupload: handleReupload,\n onCancel: handleRemoveFile,\n renderFileInfo: renderFileInfo,\n renderThumbnail: renderThumbnail,\n removable: removable && !readOnly && !plaintext,\n allowReupload: !readOnly && !plaintext,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 546,\n columnNumber: 11\n }\n });\n })));\n }\n\n if (plaintext) {\n return /*#__PURE__*/_react.default.createElement(_Plaintext.default, {\n localeKey: \"notUploaded\",\n className: withClassPrefix(listType),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 568,\n columnNumber: 7\n }\n }, fileList.current.length ? renderList[1] : null);\n }\n\n if (listType === 'picture') {\n renderList.reverse();\n }\n\n return /*#__PURE__*/_react.default.createElement(Component, {\n ref: rootRef,\n className: classes,\n style: style,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 579,\n columnNumber: 5\n }\n }, renderList);\n});\n\nUploader.displayName = 'Uploader';\nUploader.propTypes = {\n action: _propTypes.default.string.isRequired,\n accept: _propTypes.default.string,\n autoUpload: _propTypes.default.bool,\n children: _propTypes.default.node,\n className: _propTypes.default.string,\n classPrefix: _propTypes.default.string,\n defaultFileList: _propTypes.default.array,\n fileList: _propTypes.default.array,\n data: _propTypes.default.object,\n multiple: _propTypes.default.bool,\n disabled: _propTypes.default.bool,\n disabledFileItem: _propTypes.default.bool,\n name: _propTypes.default.string,\n timeout: _propTypes.default.number,\n withCredentials: _propTypes.default.bool,\n headers: _propTypes.default.object,\n locale: _propTypes.default.any,\n listType: _propTypes.default.oneOf(['text', 'picture-text', 'picture']),\n shouldQueueUpdate: _propTypes.default.func,\n shouldUpload: _propTypes.default.func,\n onChange: _propTypes.default.func,\n onUpload: _propTypes.default.func,\n onReupload: _propTypes.default.func,\n onPreview: _propTypes.default.func,\n onError: _propTypes.default.func,\n onSuccess: _propTypes.default.func,\n onProgress: _propTypes.default.func,\n onRemove: _propTypes.default.func,\n maxPreviewFileSize: _propTypes.default.number,\n method: _propTypes.default.string,\n style: _propTypes.default.object,\n renderFileInfo: _propTypes.default.func,\n renderThumbnail: _propTypes.default.func,\n removable: _propTypes.default.bool,\n fileListVisible: _propTypes.default.bool,\n draggable: _propTypes.default.bool,\n disableMultipart: _propTypes.default.bool\n};\nvar _default = Uploader;\nexports.default = _default;\n\n//# sourceURL=webpack://rsuite/./src/Uploader/Uploader.tsx?");
|
|
5062
|
+
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 _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"react\"));\n\nvar _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\"));\n\nvar _find = _interopRequireDefault(__webpack_require__(/*! lodash/find */ \"./node_modules/lodash/find.js\"));\n\nvar _UploadFileItem = _interopRequireDefault(__webpack_require__(/*! ./UploadFileItem */ \"./src/Uploader/UploadFileItem.tsx\"));\n\nvar _UploadTrigger = _interopRequireDefault(__webpack_require__(/*! ./UploadTrigger */ \"./src/Uploader/UploadTrigger.tsx\"));\n\nvar _utils = __webpack_require__(/*! ../utils */ \"./src/utils/index.ts\");\n\nvar _Plaintext = _interopRequireDefault(__webpack_require__(/*! ../Plaintext */ \"./src/Plaintext/index.tsx\"));\n\nvar _jsxFileName = \"/home/runner/work/rsuite/rsuite/src/Uploader/Uploader.tsx\",\n _this = void 0;\n\nvar getFiles = function getFiles(event) {\n if (typeof (event === null || event === void 0 ? void 0 : event['dataTransfer']) === 'object') {\n var _event$dataTransfer;\n\n return event === null || event === void 0 ? void 0 : (_event$dataTransfer = event['dataTransfer']) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.files;\n }\n\n if (event.target) {\n return event.target['files'];\n }\n\n return [];\n};\n\nvar createFile = function createFile(file) {\n var fileKey = file.fileKey;\n return (0, _extends2.default)({}, file, {\n fileKey: fileKey || (0, _utils.guid)(),\n progress: 0\n });\n};\n\nfunction fileListReducer(files, action) {\n var _action$files;\n\n switch (action.type) {\n // Add one or more files\n case 'push':\n return [].concat(files, action.files);\n // Remove a file by `fileKey`\n\n case 'remove':\n return files.filter(function (f) {\n return f.fileKey !== action.fileKey;\n });\n // Update a file\n\n case 'updateFile':\n return files.map(function (file) {\n return file.fileKey === action.file.fileKey ? action.file : file;\n });\n // Initialization file list\n\n case 'init':\n return ((_action$files = action.files) === null || _action$files === void 0 ? void 0 : _action$files.map(function (file) {\n // The state of the file needs to be preserved when the `fileList` is controlled.\n return files.find(function (f) {\n return f.fileKey === file.fileKey;\n }) || createFile(file);\n })) || [];\n\n default:\n throw new Error();\n }\n}\n\nvar useFileList = function useFileList(defaultFileList) {\n if (defaultFileList === void 0) {\n defaultFileList = [];\n }\n\n var fileListRef = (0, _react.useRef)(defaultFileList.map(createFile));\n var fileListUpdateCallback = (0, _react.useRef)();\n\n var _useReducer = (0, _react.useReducer)(fileListReducer, fileListRef.current),\n fileList = _useReducer[0],\n dispatch = _useReducer[1];\n\n fileListRef.current = fileList;\n (0, _react.useEffect)(function () {\n var _fileListUpdateCallba;\n\n (_fileListUpdateCallba = fileListUpdateCallback.current) === null || _fileListUpdateCallba === void 0 ? void 0 : _fileListUpdateCallba.call(fileListUpdateCallback, fileList);\n fileListUpdateCallback.current = null;\n }, [fileList]);\n (0, _utils.useWillUnmount)(function () {\n fileListUpdateCallback.current = null;\n });\n var dispatchCallback = (0, _react.useCallback)(function (action, callback) {\n dispatch(action);\n fileListUpdateCallback.current = callback;\n }, []);\n return [fileListRef, dispatchCallback];\n};\n\nvar Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {\n var _props$as = props.as,\n Component = _props$as === void 0 ? 'div' : _props$as,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'uploader' : _props$classPrefix,\n className = props.className,\n _props$listType = props.listType,\n listType = _props$listType === void 0 ? 'text' : _props$listType,\n defaultFileList = props.defaultFileList,\n fileListProp = props.fileList,\n _props$fileListVisibl = props.fileListVisible,\n fileListVisible = _props$fileListVisibl === void 0 ? true : _props$fileListVisibl,\n localeProp = props.locale,\n style = props.style,\n draggable = props.draggable,\n _props$name = props.name,\n name = _props$name === void 0 ? 'file' : _props$name,\n _props$multiple = props.multiple,\n multiple = _props$multiple === void 0 ? false : _props$multiple,\n _props$disabled = props.disabled,\n disabled = _props$disabled === void 0 ? false : _props$disabled,\n readOnly = props.readOnly,\n plaintext = props.plaintext,\n accept = props.accept,\n children = props.children,\n toggleAs = props.toggleAs,\n _props$removable = props.removable,\n removable = _props$removable === void 0 ? true : _props$removable,\n disabledFileItem = props.disabledFileItem,\n maxPreviewFileSize = props.maxPreviewFileSize,\n _props$method = props.method,\n method = _props$method === void 0 ? 'POST' : _props$method,\n _props$autoUpload = props.autoUpload,\n autoUpload = _props$autoUpload === void 0 ? true : _props$autoUpload,\n action = props.action,\n headers = props.headers,\n _props$withCredential = props.withCredentials,\n withCredentials = _props$withCredential === void 0 ? false : _props$withCredential,\n disableMultipart = props.disableMultipart,\n _props$timeout = props.timeout,\n timeout = _props$timeout === void 0 ? 0 : _props$timeout,\n _props$data = props.data,\n data = _props$data === void 0 ? {} : _props$data,\n onRemove = props.onRemove,\n onUpload = props.onUpload,\n shouldUpload = props.shouldUpload,\n shouldQueueUpdate = props.shouldQueueUpdate,\n renderFileInfo = props.renderFileInfo,\n renderThumbnail = props.renderThumbnail,\n onPreview = props.onPreview,\n onChange = props.onChange,\n onSuccess = props.onSuccess,\n onError = props.onError,\n onProgress = props.onProgress,\n onReupload = props.onReupload,\n rest = (0, _objectWithoutPropertiesLoose2.default)(props, [\"as\", \"classPrefix\", \"className\", \"listType\", \"defaultFileList\", \"fileList\", \"fileListVisible\", \"locale\", \"style\", \"draggable\", \"name\", \"multiple\", \"disabled\", \"readOnly\", \"plaintext\", \"accept\", \"children\", \"toggleAs\", \"removable\", \"disabledFileItem\", \"maxPreviewFileSize\", \"method\", \"autoUpload\", \"action\", \"headers\", \"withCredentials\", \"disableMultipart\", \"timeout\", \"data\", \"onRemove\", \"onUpload\", \"shouldUpload\", \"shouldQueueUpdate\", \"renderFileInfo\", \"renderThumbnail\", \"onPreview\", \"onChange\", \"onSuccess\", \"onError\", \"onProgress\", \"onReupload\"]);\n\n var _useClassNames = (0, _utils.useClassNames)(classPrefix),\n merge = _useClassNames.merge,\n withClassPrefix = _useClassNames.withClassPrefix,\n prefix = _useClassNames.prefix;\n\n var classes = merge(className, withClassPrefix(listType, {\n draggable: draggable\n }));\n\n var _useCustom = (0, _utils.useCustom)('Uploader', localeProp),\n locale = _useCustom.locale;\n\n var rootRef = (0, _react.useRef)();\n var xhrs = (0, _react.useRef)({});\n var trigger = (0, _react.useRef)();\n\n var _useFileList = useFileList(fileListProp || defaultFileList),\n fileList = _useFileList[0],\n dispatch = _useFileList[1];\n\n (0, _react.useEffect)(function () {\n if (typeof fileListProp !== 'undefined') {\n // Force reset fileList in reducer, when `fileListProp` is updated\n dispatch({\n type: 'init',\n files: fileListProp\n });\n }\n }, [dispatch, fileListProp]);\n var updateFileStatus = (0, _react.useCallback)(function (nextFile) {\n dispatch({\n type: 'updateFile',\n file: nextFile\n });\n }, [dispatch]);\n /**\n * Clear the value in input.\n */\n\n var cleanInputValue = (0, _react.useCallback)(function () {\n var _trigger$current;\n\n (_trigger$current = trigger.current) === null || _trigger$current === void 0 ? void 0 : _trigger$current.clearInput();\n }, []);\n /**\n * Callback for successful file upload.\n * @param file\n * @param response\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadSuccess = (0, _react.useCallback)(function (file, response, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'finished',\n progress: 100\n });\n updateFileStatus(nextFile);\n onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response, nextFile, event, xhr);\n }, [onSuccess, updateFileStatus]);\n /**\n * Callback for file upload error.\n * @param file\n * @param status\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadError = (0, _react.useCallback)(function (file, status, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'error'\n });\n updateFileStatus(nextFile);\n onError === null || onError === void 0 ? void 0 : onError(status, nextFile, event, xhr);\n }, [onError, updateFileStatus]);\n /**\n * Callback for file upload progress update.\n * @param file\n * @param percent\n * @param event\n * @param xhr\n */\n\n var handleAjaxUploadProgress = (0, _react.useCallback)(function (file, percent, event, xhr) {\n var nextFile = (0, _extends2.default)({}, file, {\n status: 'uploading',\n progress: percent\n });\n updateFileStatus(nextFile);\n onProgress === null || onProgress === void 0 ? void 0 : onProgress(percent, nextFile, event, xhr);\n }, [onProgress, updateFileStatus]);\n /**\n * Upload a single file.\n * @param file\n */\n\n var handleUploadFile = (0, _react.useCallback)(function (file) {\n var _ajaxUpload = (0, _utils.ajaxUpload)({\n name: name,\n timeout: timeout,\n headers: headers,\n data: data,\n method: method,\n withCredentials: withCredentials,\n disableMultipart: disableMultipart,\n file: file.blobFile,\n url: action,\n onError: handleAjaxUploadError.bind(null, file),\n onSuccess: handleAjaxUploadSuccess.bind(null, file),\n onProgress: handleAjaxUploadProgress.bind(null, file)\n }),\n xhr = _ajaxUpload.xhr,\n uploadData = _ajaxUpload.data;\n\n updateFileStatus((0, _extends2.default)({}, file, {\n status: 'uploading'\n }));\n\n if (file.fileKey) {\n xhrs.current[file.fileKey] = xhr;\n }\n\n onUpload === null || onUpload === void 0 ? void 0 : onUpload(file, uploadData, xhr);\n }, [name, timeout, headers, data, method, withCredentials, disableMultipart, action, handleAjaxUploadError, handleAjaxUploadSuccess, handleAjaxUploadProgress, updateFileStatus, onUpload]);\n var handleAjaxUpload = (0, _react.useCallback)(function () {\n fileList.current.forEach(function (file) {\n var checkState = shouldUpload === null || shouldUpload === void 0 ? void 0 : shouldUpload(file);\n\n if (checkState instanceof Promise) {\n checkState.then(function (res) {\n if (res) {\n handleUploadFile(file);\n }\n });\n return;\n } else if (checkState === false) {\n return;\n }\n\n if (file.status === 'inited') {\n handleUploadFile(file);\n }\n });\n cleanInputValue();\n }, [cleanInputValue, fileList, handleUploadFile, shouldUpload]);\n\n var handleUploadTriggerChange = function handleUploadTriggerChange(event) {\n var files = getFiles(event);\n var newFileList = [];\n Array.from(files).forEach(function (file) {\n newFileList.push({\n blobFile: file,\n name: file.name,\n status: 'inited',\n fileKey: (0, _utils.guid)()\n });\n });\n var nextFileList = [].concat(fileList.current, newFileList);\n var checkState = shouldQueueUpdate === null || shouldQueueUpdate === void 0 ? void 0 : shouldQueueUpdate(nextFileList, newFileList);\n\n if (checkState === false) {\n cleanInputValue();\n return;\n }\n\n var upload = function upload() {\n onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);\n dispatch({\n type: 'push',\n files: newFileList\n }, function () {\n autoUpload && handleAjaxUpload();\n });\n };\n\n if (checkState instanceof Promise) {\n checkState.then(function (res) {\n res && upload();\n });\n return;\n }\n\n upload();\n };\n\n var handleRemoveFile = function handleRemoveFile(fileKey) {\n var _xhrs$current, _xhrs$current$file$fi;\n\n var file = (0, _find.default)(fileList.current, function (f) {\n return f.fileKey === fileKey;\n });\n var nextFileList = fileList.current.filter(function (f) {\n return f.fileKey !== fileKey;\n });\n\n if (((_xhrs$current = xhrs.current) === null || _xhrs$current === void 0 ? void 0 : (_xhrs$current$file$fi = _xhrs$current[file.fileKey]) === null || _xhrs$current$file$fi === void 0 ? void 0 : _xhrs$current$file$fi.readyState) !== 4) {\n var _xhrs$current$file$fi2;\n\n (_xhrs$current$file$fi2 = xhrs.current[file.fileKey]) === null || _xhrs$current$file$fi2 === void 0 ? void 0 : _xhrs$current$file$fi2.abort();\n }\n\n dispatch({\n type: 'remove',\n fileKey: fileKey\n });\n onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);\n onChange === null || onChange === void 0 ? void 0 : onChange(nextFileList);\n cleanInputValue();\n };\n\n var handleReupload = function handleReupload(file) {\n autoUpload && handleUploadFile(file);\n onReupload === null || onReupload === void 0 ? void 0 : onReupload(file);\n }; // public API\n\n\n var start = function start(file) {\n if (file) {\n handleUploadFile(file);\n return;\n }\n\n handleAjaxUpload();\n };\n\n (0, _react.useImperativeHandle)(ref, function () {\n return {\n root: rootRef.current,\n start: start\n };\n });\n var renderList = [/*#__PURE__*/_react.default.createElement(_UploadTrigger.default, (0, _extends2.default)({}, rest, {\n locale: locale,\n name: name,\n key: \"trigger\",\n multiple: multiple,\n draggable: draggable,\n disabled: disabled,\n readOnly: readOnly,\n accept: accept,\n ref: trigger,\n onChange: handleUploadTriggerChange,\n as: toggleAs,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 526,\n columnNumber: 5\n }\n }), children)];\n\n if (fileListVisible) {\n renderList.push( /*#__PURE__*/_react.default.createElement(\"div\", {\n key: \"items\",\n className: prefix('file-items'),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 546,\n columnNumber: 7\n }\n }, fileList.current.map(function (file, index) {\n return /*#__PURE__*/_react.default.createElement(_UploadFileItem.default, {\n locale: locale,\n key: file.fileKey || index,\n file: file,\n maxPreviewFileSize: maxPreviewFileSize,\n listType: listType,\n disabled: disabledFileItem,\n onPreview: onPreview,\n onReupload: handleReupload,\n onCancel: handleRemoveFile,\n renderFileInfo: renderFileInfo,\n renderThumbnail: renderThumbnail,\n removable: removable && !readOnly && !plaintext,\n allowReupload: !readOnly && !plaintext,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 548,\n columnNumber: 11\n }\n });\n })));\n }\n\n if (plaintext) {\n return /*#__PURE__*/_react.default.createElement(_Plaintext.default, {\n localeKey: \"notUploaded\",\n className: withClassPrefix(listType),\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 570,\n columnNumber: 7\n }\n }, fileList.current.length ? renderList[1] : null);\n }\n\n if (listType === 'picture') {\n renderList.reverse();\n }\n\n return /*#__PURE__*/_react.default.createElement(Component, {\n ref: rootRef,\n className: classes,\n style: style,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 581,\n columnNumber: 5\n }\n }, renderList);\n});\n\nUploader.displayName = 'Uploader';\nUploader.propTypes = {\n action: _propTypes.default.string.isRequired,\n accept: _propTypes.default.string,\n autoUpload: _propTypes.default.bool,\n children: _propTypes.default.node,\n className: _propTypes.default.string,\n classPrefix: _propTypes.default.string,\n defaultFileList: _propTypes.default.array,\n fileList: _propTypes.default.array,\n data: _propTypes.default.object,\n multiple: _propTypes.default.bool,\n disabled: _propTypes.default.bool,\n disabledFileItem: _propTypes.default.bool,\n name: _propTypes.default.string,\n timeout: _propTypes.default.number,\n withCredentials: _propTypes.default.bool,\n headers: _propTypes.default.object,\n locale: _propTypes.default.any,\n listType: _propTypes.default.oneOf(['text', 'picture-text', 'picture']),\n shouldQueueUpdate: _propTypes.default.func,\n shouldUpload: _propTypes.default.func,\n onChange: _propTypes.default.func,\n onUpload: _propTypes.default.func,\n onReupload: _propTypes.default.func,\n onPreview: _propTypes.default.func,\n onError: _propTypes.default.func,\n onSuccess: _propTypes.default.func,\n onProgress: _propTypes.default.func,\n onRemove: _propTypes.default.func,\n maxPreviewFileSize: _propTypes.default.number,\n method: _propTypes.default.string,\n style: _propTypes.default.object,\n renderFileInfo: _propTypes.default.func,\n renderThumbnail: _propTypes.default.func,\n removable: _propTypes.default.bool,\n fileListVisible: _propTypes.default.bool,\n draggable: _propTypes.default.bool,\n disableMultipart: _propTypes.default.bool\n};\nvar _default = Uploader;\nexports.default = _default;\n\n//# sourceURL=webpack://rsuite/./src/Uploader/Uploader.tsx?");
|
|
5063
5063
|
|
|
5064
5064
|
/***/ }),
|
|
5065
5065
|
|
|
@@ -9398,7 +9398,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
|
9398
9398
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9399
9399
|
|
|
9400
9400
|
"use strict";
|
|
9401
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var dom_lib_DOMMouseMoveTracker__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/DOMMouseMoveTracker */ \"./node_modules/dom-lib/esm/DOMMouseMoveTracker.js\");\n/* harmony import */ var dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dom-lib/addStyle */ \"./node_modules/dom-lib/esm/addStyle.js\");\n/* harmony import */ var dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! dom-lib/getOffset */ \"./node_modules/dom-lib/esm/getOffset.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ \"./node_modules/rsuite-table/es/utils/index.js\");\n/* harmony import */ var _TableContext__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TableContext */ \"./node_modules/rsuite-table/es/TableContext.js\");\n\n\nvar _excluded = [\"length\", \"scrollLength\", \"classPrefix\", \"vertical\", \"className\", \"tableId\", \"onMouseDown\", \"onScroll\"];\n\n\n\n\n\n\n\nvar Scrollbar = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().forwardRef(function (props, ref) {\n var _barRef$current, _styles;\n\n var _props$length = props.length,\n length = _props$length === void 0 ? 1 : _props$length,\n _props$scrollLength = props.scrollLength,\n scrollLength = _props$scrollLength === void 0 ? 1 : _props$scrollLength,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'scrollbar' : _props$classPrefix,\n vertical = props.vertical,\n className = props.className,\n tableId = props.tableId,\n onMouseDown = props.onMouseDown,\n onScroll = props.onScroll,\n rest = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__.default)(props, _excluded);\n\n var _React$useContext = react__WEBPACK_IMPORTED_MODULE_2___default().useContext(_TableContext__WEBPACK_IMPORTED_MODULE_8__.default),\n translateDOMPositionXY = _React$useContext.translateDOMPositionXY;\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false),\n handlePressed = _useState[0],\n setHandlePressed = _useState[1];\n\n var _useState2 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)({\n top: 0,\n left: 0\n }),\n barOffset = _useState2[0],\n setBarOffset = _useState2[1];\n\n var scrollOffset = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(0);\n var scrollRange = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(scrollLength);\n var barRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var handleRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var mouseMoveTracker = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)();\n\n var _useClassNames = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.useClassNames)(classPrefix),\n withClassPrefix = _useClassNames.withClassPrefix,\n merge = _useClassNames.merge,\n prefix = _useClassNames.prefix;\n\n var classes = merge(className, withClassPrefix({\n vertical: vertical,\n horizontal: !vertical,\n pressed: handlePressed\n }), // keep the 'fixed' class name if it has already been given by useAffix hook\n ((_barRef$current = barRef.current) === null || _barRef$current === void 0 ? void 0 : _barRef$current.classList.contains('fixed')) && 'fixed');\n var width = length / scrollLength * 100;\n var styles = (_styles = {}, _styles[vertical ? 'height' : 'width'] = width + \"%\", _styles[vertical ? 'minHeight' : 'minWidth'] = _constants__WEBPACK_IMPORTED_MODULE_6__.SCROLLBAR_MIN_WIDTH, _styles);\n var valuenow = scrollOffset.current / length * 100 + width;\n (0,_utils__WEBPACK_IMPORTED_MODULE_7__.useMount)(function () {\n setTimeout(function () {\n if (barRef.current) {\n setBarOffset((0,dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_5__.default)(barRef.current));\n }\n }, 1);\n return function () {\n releaseMouseMoves();\n };\n });\n (0,_utils__WEBPACK_IMPORTED_MODULE_7__.useUpdateEffect)(function () {\n if (scrollOffset.current) {\n // Update the position of the scroll bar when the height of the table content area changes.\n scrollOffset.current = scrollRange.current / scrollLength * scrollOffset.current;\n updateScrollBarPosition(0);\n }\n\n scrollRange.current = scrollLength;\n }, [scrollLength]);\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useImperativeHandle)(ref, function () {\n return {\n get root() {\n return barRef.current;\n },\n\n get handle() {\n return handleRef.current;\n },\n\n onWheelScroll: function onWheelScroll(delta, momentum) {\n var nextDelta = delta / (scrollLength / length);\n updateScrollBarPosition(nextDelta, undefined, momentum);\n },\n resetScrollBarPosition: function resetScrollBarPosition(forceDelta) {\n if (forceDelta === void 0) {\n forceDelta = 0;\n }\n\n scrollOffset.current = 0;\n updateScrollBarPosition(0, forceDelta);\n }\n };\n });\n var updateScrollBarPosition = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (delta, forceDelta, momentum) {\n var max = scrollLength && length ? length - Math.max(length / scrollLength * length, _constants__WEBPACK_IMPORTED_MODULE_6__.SCROLLBAR_MIN_WIDTH + 2) : 0;\n var styles = momentum ? {\n 'transition-duration': _constants__WEBPACK_IMPORTED_MODULE_6__.TRANSITION_DURATION + \"ms\",\n 'transition-timing-function': _constants__WEBPACK_IMPORTED_MODULE_6__.BEZIER\n } : {};\n\n if (typeof forceDelta === 'undefined') {\n scrollOffset.current += delta;\n scrollOffset.current = Math.max(scrollOffset.current, 0);\n scrollOffset.current = Math.min(scrollOffset.current, max);\n } else {\n scrollOffset.current = forceDelta || 0;\n }\n\n if (vertical) {\n translateDOMPositionXY === null || translateDOMPositionXY === void 0 ? void 0 : translateDOMPositionXY(styles, 0, scrollOffset.current);\n } else {\n translateDOMPositionXY === null || translateDOMPositionXY === void 0 ? void 0 : translateDOMPositionXY(styles, scrollOffset.current, 0);\n }\n\n if (handleRef.current) {\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_4__.default)(handleRef.current, styles);\n }\n }, [length, scrollLength, translateDOMPositionXY, vertical]);\n var handleScroll = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (delta, event) {\n var scrollDelta = delta * (scrollLength / length);\n updateScrollBarPosition(delta);\n onScroll === null || onScroll === void 0 ? void 0 : onScroll(scrollDelta, event);\n }, [length, onScroll, scrollLength, updateScrollBarPosition]);\n var handleClick = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (event) {\n var _handleRef$current;\n\n if (handleRef.current && (_handleRef$current = handleRef.current) !== null && _handleRef$current !== void 0 && _handleRef$current.contains(event.target)) {\n return;\n }\n\n if (typeof (barOffset === null || barOffset === void 0 ? void 0 : barOffset.top) !== 'number' || typeof (barOffset === null || barOffset === void 0 ? void 0 : barOffset.left) !== 'number') {\n return;\n }\n\n var offset = vertical ? event.pageY - (barOffset === null || barOffset === void 0 ? void 0 : barOffset.top) : event.pageX - barOffset.left;\n var handleWidth = length / scrollLength * length;\n var delta = offset - handleWidth;\n var nextDelta = offset > scrollOffset.current ? delta - scrollOffset.current : offset - scrollOffset.current;\n handleScroll(nextDelta, event);\n }, [barOffset, handleScroll, length, scrollLength, vertical]);\n var releaseMouseMoves = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {\n var _mouseMoveTracker$cur, _mouseMoveTracker$cur2;\n\n (_mouseMoveTracker$cur = mouseMoveTracker.current) === null || _mouseMoveTracker$cur === void 0 ? void 0 : (_mouseMoveTracker$cur2 = _mouseMoveTracker$cur.releaseMouseMoves) === null || _mouseMoveTracker$cur2 === void 0 ? void 0 : _mouseMoveTracker$cur2.call(_mouseMoveTracker$cur);\n mouseMoveTracker.current = null;\n }, []);\n var handleDragMove = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (deltaX, deltaY, event) {\n var _window, _window$event;\n\n if (!mouseMoveTracker.current || !mouseMoveTracker.current.isDragging()) {\n return;\n }\n\n if ((event === null || event === void 0 ? void 0 : event.buttons) === 0 || ((_window = window) === null || _window === void 0 ? void 0 : (_window$event = _window.event) === null || _window$event === void 0 ? void 0 : _window$event['buttons']) === 0) {\n releaseMouseMoves();\n return;\n }\n\n handleScroll(vertical ? deltaY : deltaX, event);\n }, [handleScroll, releaseMouseMoves, vertical]);\n var handleDragEnd = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {\n releaseMouseMoves();\n setHandlePressed(false);\n }, [releaseMouseMoves]);\n var getMouseMoveTracker = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {\n return mouseMoveTracker.current || new dom_lib_DOMMouseMoveTracker__WEBPACK_IMPORTED_MODULE_3__.default(handleDragMove, handleDragEnd, document.body);\n }, [handleDragEnd, handleDragMove]);\n var handleMouseDown = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (event) {\n var _mouseMoveTracker$cur3;\n\n mouseMoveTracker.current = getMouseMoveTracker();\n mouseMoveTracker === null || mouseMoveTracker === void 0 ? void 0 : (_mouseMoveTracker$cur3 = mouseMoveTracker.current) === null || _mouseMoveTracker$cur3 === void 0 ? void 0 : _mouseMoveTracker$cur3.captureMouseMoves(event);\n setHandlePressed(true);\n onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);\n }, [getMouseMoveTracker, onMouseDown]);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({\n role: \"scrollbar\",\n \"aria-controls\": tableId,\n \"aria-valuemax\": 100,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": valuenow,\n \"aria-orientation\": vertical ? 'vertical' : 'horizontal'\n }, rest, {\n ref: barRef,\n className: classes,\n onClick: handleClick\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n ref: handleRef,\n className: prefix('handle'),\n style: styles,\n onMouseDown: handleMouseDown,\n role: \"button\",\n tabIndex: -1\n }));\n});\nScrollbar.displayName = 'Table.Scrollbar';\n/* harmony default export */ __webpack_exports__[\"default\"] = (Scrollbar);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/Scrollbar.js?");
|
|
9401
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var dom_lib_DOMMouseMoveTracker__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/DOMMouseMoveTracker */ \"./node_modules/dom-lib/esm/DOMMouseMoveTracker.js\");\n/* harmony import */ var dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dom-lib/addStyle */ \"./node_modules/dom-lib/esm/addStyle.js\");\n/* harmony import */ var dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! dom-lib/getOffset */ \"./node_modules/dom-lib/esm/getOffset.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ \"./node_modules/rsuite-table/es/utils/index.js\");\n/* harmony import */ var _TableContext__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TableContext */ \"./node_modules/rsuite-table/es/TableContext.js\");\n\n\nvar _excluded = [\"length\", \"scrollLength\", \"classPrefix\", \"vertical\", \"className\", \"tableId\", \"onMouseDown\", \"onScroll\"];\n\n\n\n\n\n\n\nvar Scrollbar = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().forwardRef(function (props, ref) {\n var _barRef$current, _styles;\n\n var _props$length = props.length,\n length = _props$length === void 0 ? 1 : _props$length,\n _props$scrollLength = props.scrollLength,\n scrollLength = _props$scrollLength === void 0 ? 1 : _props$scrollLength,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'scrollbar' : _props$classPrefix,\n vertical = props.vertical,\n className = props.className,\n tableId = props.tableId,\n onMouseDown = props.onMouseDown,\n onScroll = props.onScroll,\n rest = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__.default)(props, _excluded);\n\n var _React$useContext = react__WEBPACK_IMPORTED_MODULE_2___default().useContext(_TableContext__WEBPACK_IMPORTED_MODULE_8__.default),\n translateDOMPositionXY = _React$useContext.translateDOMPositionXY;\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false),\n handlePressed = _useState[0],\n setHandlePressed = _useState[1];\n\n var _useState2 = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)({\n top: 0,\n left: 0\n }),\n barOffset = _useState2[0],\n setBarOffset = _useState2[1];\n\n var scrollOffset = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(0);\n var scrollRange = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(scrollLength);\n var barRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var handleRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var mouseMoveTracker = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)();\n\n var _useClassNames = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.useClassNames)(classPrefix),\n withClassPrefix = _useClassNames.withClassPrefix,\n merge = _useClassNames.merge,\n prefix = _useClassNames.prefix;\n\n var classes = merge(className, withClassPrefix({\n vertical: vertical,\n horizontal: !vertical,\n pressed: handlePressed\n }), // keep the 'fixed' class name if it has already been given by useAffix hook\n ((_barRef$current = barRef.current) === null || _barRef$current === void 0 ? void 0 : _barRef$current.classList.contains('fixed')) && 'fixed');\n var width = length / scrollLength * 100;\n var styles = (_styles = {}, _styles[vertical ? 'height' : 'width'] = width + \"%\", _styles[vertical ? 'minHeight' : 'minWidth'] = _constants__WEBPACK_IMPORTED_MODULE_6__.SCROLLBAR_MIN_WIDTH, _styles);\n var valuenow = scrollOffset.current / length * 100 + width;\n (0,_utils__WEBPACK_IMPORTED_MODULE_7__.useMount)(function () {\n setTimeout(function () {\n if (barRef.current) {\n setBarOffset((0,dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_5__.default)(barRef.current));\n }\n }, 1);\n return function () {\n releaseMouseMoves();\n };\n });\n (0,_utils__WEBPACK_IMPORTED_MODULE_7__.useUpdateEffect)(function () {\n if (scrollOffset.current) {\n // Update the position of the scroll bar when the height of the table content area changes.\n scrollOffset.current = scrollRange.current / scrollLength * scrollOffset.current;\n updateScrollBarPosition(0);\n }\n\n scrollRange.current = scrollLength;\n }, [scrollLength]);\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useImperativeHandle)(ref, function () {\n return {\n get root() {\n return barRef.current;\n },\n\n get handle() {\n return handleRef.current;\n },\n\n onWheelScroll: function onWheelScroll(delta, momentum) {\n var nextDelta = delta / (scrollLength / length);\n updateScrollBarPosition(nextDelta, undefined, momentum);\n },\n resetScrollBarPosition: function resetScrollBarPosition(forceDelta) {\n if (forceDelta === void 0) {\n forceDelta = 0;\n }\n\n scrollOffset.current = 0;\n updateScrollBarPosition(0, forceDelta);\n }\n };\n });\n var updateScrollBarPosition = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (delta, forceDelta, momentum) {\n var max = scrollLength && length ? length - Math.max(length / scrollLength * length, _constants__WEBPACK_IMPORTED_MODULE_6__.SCROLLBAR_MIN_WIDTH + 2) : 0;\n var styles = momentum ? {\n 'transition-duration': _constants__WEBPACK_IMPORTED_MODULE_6__.TRANSITION_DURATION + \"ms\",\n 'transition-timing-function': _constants__WEBPACK_IMPORTED_MODULE_6__.BEZIER\n } : {};\n\n var getSafeValue = function getSafeValue(value) {\n if (value === void 0) {\n value = 0;\n }\n\n return Math.min(Math.max(value, 0), max);\n };\n\n if (typeof forceDelta === 'undefined') {\n scrollOffset.current += delta;\n scrollOffset.current = getSafeValue(scrollOffset.current);\n } else {\n scrollOffset.current = getSafeValue(forceDelta);\n }\n\n if (vertical) {\n translateDOMPositionXY === null || translateDOMPositionXY === void 0 ? void 0 : translateDOMPositionXY(styles, 0, scrollOffset.current);\n } else {\n translateDOMPositionXY === null || translateDOMPositionXY === void 0 ? void 0 : translateDOMPositionXY(styles, scrollOffset.current, 0);\n }\n\n if (handleRef.current) {\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_4__.default)(handleRef.current, styles);\n }\n }, [length, scrollLength, translateDOMPositionXY, vertical]);\n var handleScroll = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (delta, event) {\n var scrollDelta = delta * (scrollLength / length);\n updateScrollBarPosition(delta);\n onScroll === null || onScroll === void 0 ? void 0 : onScroll(scrollDelta, event);\n }, [length, onScroll, scrollLength, updateScrollBarPosition]);\n var handleClick = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (event) {\n var _handleRef$current;\n\n if (handleRef.current && (_handleRef$current = handleRef.current) !== null && _handleRef$current !== void 0 && _handleRef$current.contains(event.target)) {\n return;\n }\n\n if (typeof (barOffset === null || barOffset === void 0 ? void 0 : barOffset.top) !== 'number' || typeof (barOffset === null || barOffset === void 0 ? void 0 : barOffset.left) !== 'number') {\n return;\n }\n\n var offset = vertical ? event.pageY - (barOffset === null || barOffset === void 0 ? void 0 : barOffset.top) : event.pageX - barOffset.left;\n var handleWidth = length / scrollLength * length;\n var delta = offset - handleWidth;\n var nextDelta = offset > scrollOffset.current ? delta - scrollOffset.current : offset - scrollOffset.current;\n handleScroll(nextDelta, event);\n }, [barOffset, handleScroll, length, scrollLength, vertical]);\n var releaseMouseMoves = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {\n var _mouseMoveTracker$cur, _mouseMoveTracker$cur2;\n\n (_mouseMoveTracker$cur = mouseMoveTracker.current) === null || _mouseMoveTracker$cur === void 0 ? void 0 : (_mouseMoveTracker$cur2 = _mouseMoveTracker$cur.releaseMouseMoves) === null || _mouseMoveTracker$cur2 === void 0 ? void 0 : _mouseMoveTracker$cur2.call(_mouseMoveTracker$cur);\n mouseMoveTracker.current = null;\n }, []);\n var handleDragMove = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (deltaX, deltaY, event) {\n var _window, _window$event;\n\n if (!mouseMoveTracker.current || !mouseMoveTracker.current.isDragging()) {\n return;\n }\n\n if ((event === null || event === void 0 ? void 0 : event.buttons) === 0 || ((_window = window) === null || _window === void 0 ? void 0 : (_window$event = _window.event) === null || _window$event === void 0 ? void 0 : _window$event['buttons']) === 0) {\n releaseMouseMoves();\n return;\n }\n\n handleScroll(vertical ? deltaY : deltaX, event);\n }, [handleScroll, releaseMouseMoves, vertical]);\n var handleDragEnd = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {\n releaseMouseMoves();\n setHandlePressed(false);\n }, [releaseMouseMoves]);\n var getMouseMoveTracker = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function () {\n return mouseMoveTracker.current || new dom_lib_DOMMouseMoveTracker__WEBPACK_IMPORTED_MODULE_3__.default(handleDragMove, handleDragEnd, document.body);\n }, [handleDragEnd, handleDragMove]);\n var handleMouseDown = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (event) {\n var _mouseMoveTracker$cur3;\n\n mouseMoveTracker.current = getMouseMoveTracker();\n mouseMoveTracker === null || mouseMoveTracker === void 0 ? void 0 : (_mouseMoveTracker$cur3 = mouseMoveTracker.current) === null || _mouseMoveTracker$cur3 === void 0 ? void 0 : _mouseMoveTracker$cur3.captureMouseMoves(event);\n setHandlePressed(true);\n onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);\n }, [getMouseMoveTracker, onMouseDown]);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({\n role: \"scrollbar\",\n \"aria-controls\": tableId,\n \"aria-valuemax\": 100,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": valuenow,\n \"aria-orientation\": vertical ? 'vertical' : 'horizontal'\n }, rest, {\n ref: barRef,\n className: classes,\n onClick: handleClick\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n ref: handleRef,\n className: prefix('handle'),\n style: styles,\n onMouseDown: handleMouseDown,\n role: \"button\",\n tabIndex: -1\n }));\n});\nScrollbar.displayName = 'Table.Scrollbar';\n/* harmony default export */ __webpack_exports__[\"default\"] = (Scrollbar);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/Scrollbar.js?");
|
|
9402
9402
|
|
|
9403
9403
|
/***/ }),
|
|
9404
9404
|
|
|
@@ -9409,7 +9409,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab
|
|
|
9409
9409
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9410
9410
|
|
|
9411
9411
|
"use strict";
|
|
9412
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var dom_lib_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/translateDOMPositionXY */ \"./node_modules/dom-lib/esm/translateDOMPositionXY.js\");\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 lodash_isFunction__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\");\n/* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/flatten */ \"./node_modules/lodash/flatten.js\");\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_flatten__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _Row__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Row */ \"./node_modules/rsuite-table/es/Row.js\");\n/* harmony import */ var _CellGroup__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./CellGroup */ \"./node_modules/rsuite-table/es/CellGroup.js\");\n/* harmony import */ var _Scrollbar__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Scrollbar */ \"./node_modules/rsuite-table/es/Scrollbar.js\");\n/* harmony import */ var _MouseArea__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./MouseArea */ \"./node_modules/rsuite-table/es/MouseArea.js\");\n/* harmony import */ var _Loader__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Loader */ \"./node_modules/rsuite-table/es/Loader.js\");\n/* harmony import */ var _EmptyMessage__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./EmptyMessage */ \"./node_modules/rsuite-table/es/EmptyMessage.js\");\n/* harmony import */ var _TableContext__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./TableContext */ \"./node_modules/rsuite-table/es/TableContext.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils */ \"./node_modules/rsuite-table/es/utils/index.js\");\n\n\nvar _excluded = [\"affixHeader\", \"children\", \"classPrefix\", \"className\", \"data\", \"defaultSortType\", \"width\", \"expandedRowKeys\", \"defaultExpandAllRows\", \"defaultExpandedRowKeys\", \"style\", \"id\", \"isTree\", \"hover\", \"bordered\", \"cellBordered\", \"wordWrap\", \"loading\", \"locale\", \"showHeader\", \"sortColumn\", \"rowHeight\", \"sortType\", \"headerHeight\", \"minHeight\", \"height\", \"autoHeight\", \"fillHeight\", \"rtl\", \"translate3d\", \"rowKey\", \"virtualized\", \"rowClassName\", \"rowExpandedHeight\", \"disabledScroll\", \"affixHorizontalScrollbar\", \"loadAnimation\", \"shouldUpdateScroll\", \"renderRow\", \"renderRowExpanded\", \"renderLoading\", \"renderEmpty\", \"onSortColumn\", \"onScroll\", \"renderTreeToggle\", \"onRowClick\", \"onRowContextMenu\", \"onExpandChange\", \"onTouchStart\", \"onTouchMove\", \"onTouchEnd\"],\n _excluded2 = [\"depth\"];\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Filter those expanded nodes.\n * @param data\n * @param expandedRowKeys\n * @param rowKey\n * @returns\n */\nvar filterTreeData = function filterTreeData(data, expandedRowKeys, rowKey) {\n return (0,_utils__WEBPACK_IMPORTED_MODULE_16__.flattenData)(data).filter(function (rowData) {\n if (rowKey) {\n var parents = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.findAllParents)(rowData, rowKey);\n\n var _expanded = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.shouldShowRowByExpanded)(expandedRowKeys, parents);\n\n rowData[_constants__WEBPACK_IMPORTED_MODULE_15__.EXPANDED_KEY] = _expanded;\n rowData[_constants__WEBPACK_IMPORTED_MODULE_15__.TREE_DEPTH] = parents.length;\n return _expanded;\n }\n });\n};\n\nvar DATA_PLACEHOLDER = [];\nvar Table = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().forwardRef(function (props, ref) {\n var affixHeader = props.affixHeader,\n children = props.children,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'rs-table' : _props$classPrefix,\n className = props.className,\n _props$data = props.data,\n dataProp = _props$data === void 0 ? DATA_PLACEHOLDER : _props$data,\n _props$defaultSortTyp = props.defaultSortType,\n defaultSortType = _props$defaultSortTyp === void 0 ? _constants__WEBPACK_IMPORTED_MODULE_15__.SORT_TYPE.DESC : _props$defaultSortTyp,\n widthProp = props.width,\n expandedRowKeysProp = props.expandedRowKeys,\n defaultExpandAllRows = props.defaultExpandAllRows,\n defaultExpandedRowKeys = props.defaultExpandedRowKeys,\n style = props.style,\n id = props.id,\n isTree = props.isTree,\n _props$hover = props.hover,\n hover = _props$hover === void 0 ? true : _props$hover,\n bordered = props.bordered,\n cellBordered = props.cellBordered,\n wordWrap = props.wordWrap,\n loading = props.loading,\n _props$locale = props.locale,\n locale = _props$locale === void 0 ? {\n emptyMessage: 'No data found',\n loading: 'Loading...'\n } : _props$locale,\n _props$showHeader = props.showHeader,\n showHeader = _props$showHeader === void 0 ? true : _props$showHeader,\n sortColumn = props.sortColumn,\n _props$rowHeight = props.rowHeight,\n rowHeight = _props$rowHeight === void 0 ? 46 : _props$rowHeight,\n sortTypeProp = props.sortType,\n _props$headerHeight = props.headerHeight,\n headerHeightProp = _props$headerHeight === void 0 ? 40 : _props$headerHeight,\n _props$minHeight = props.minHeight,\n minHeight = _props$minHeight === void 0 ? 0 : _props$minHeight,\n _props$height = props.height,\n height = _props$height === void 0 ? 200 : _props$height,\n autoHeight = props.autoHeight,\n fillHeight = props.fillHeight,\n rtlProp = props.rtl,\n _props$translate3d = props.translate3d,\n translate3d = _props$translate3d === void 0 ? true : _props$translate3d,\n rowKey = props.rowKey,\n virtualized = props.virtualized,\n rowClassName = props.rowClassName,\n _props$rowExpandedHei = props.rowExpandedHeight,\n rowExpandedHeight = _props$rowExpandedHei === void 0 ? 100 : _props$rowExpandedHei,\n disabledScroll = props.disabledScroll,\n affixHorizontalScrollbar = props.affixHorizontalScrollbar,\n loadAnimation = props.loadAnimation,\n _props$shouldUpdateSc = props.shouldUpdateScroll,\n shouldUpdateScroll = _props$shouldUpdateSc === void 0 ? true : _props$shouldUpdateSc,\n renderRowProp = props.renderRow,\n renderRowExpandedProp = props.renderRowExpanded,\n renderLoading = props.renderLoading,\n renderEmpty = props.renderEmpty,\n onSortColumn = props.onSortColumn,\n onScroll = props.onScroll,\n renderTreeToggle = props.renderTreeToggle,\n onRowClick = props.onRowClick,\n onRowContextMenu = props.onRowContextMenu,\n onExpandChange = props.onExpandChange,\n onTouchStart = props.onTouchStart,\n onTouchMove = props.onTouchMove,\n onTouchEnd = props.onTouchEnd,\n rest = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__.default)(props, _excluded);\n\n if (isTree && !rowKey) {\n throw new Error('The `rowKey` is required when set isTree');\n }\n\n var _useClassNames = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useClassNames)(classPrefix, typeof classPrefix !== 'undefined'),\n withClassPrefix = _useClassNames.withClassPrefix,\n mergeCls = _useClassNames.merge,\n prefix = _useClassNames.prefix; // Use `forceUpdate` to force the component to re-render after manipulating the DOM.\n\n\n var _useReducer = (0,react__WEBPACK_IMPORTED_MODULE_2__.useReducer)(function (x) {\n return x + 1;\n }, 0),\n forceUpdate = _useReducer[1];\n\n var _useControlled = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useControlled)(expandedRowKeysProp, defaultExpandAllRows ? (0,_utils__WEBPACK_IMPORTED_MODULE_16__.findRowKeys)(dataProp, rowKey, lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(renderRowExpandedProp)) : defaultExpandedRowKeys || []),\n expandedRowKeys = _useControlled[0],\n setExpandedRowKeys = _useControlled[1];\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(function () {\n return isTree ? filterTreeData(dataProp, expandedRowKeys, rowKey) : dataProp;\n }),\n data = _useState[0],\n setData = _useState[1];\n\n var _useTableRows = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useTableRows)({\n data: dataProp,\n expandedRowKeys: expandedRowKeys,\n wordWrap: wordWrap,\n prefix: prefix\n }),\n tableRowsMaxHeight = _useTableRows.tableRowsMaxHeight,\n bindTableRowsRef = _useTableRows.bindTableRowsRef;\n\n var headerHeight = showHeader ? headerHeightProp : 0;\n var rtl = rtlProp || (0,_utils__WEBPACK_IMPORTED_MODULE_16__.isRTL)();\n\n var getRowHeight = function getRowHeight(rowData) {\n if (rowData === void 0) {\n rowData = {};\n }\n\n return typeof rowHeight === 'function' ? rowHeight(rowData) : rowHeight;\n };\n\n var translateDOMPositionXY = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)((0,dom_lib_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_3__.getTranslateDOMPositionXY)({\n forceUseTransform: true,\n enable3DTransform: translate3d\n })); // Check for the existence of fixed columns in all column properties.\n\n var shouldFixedColumn = Array.from(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()(children)).some(function (child) {\n var _child$props;\n\n return child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.fixed;\n }); // Check all column properties for the existence of rowSpan.\n\n var shouldRowSpanColumn = Array.from(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()(children)).some(function (child) {\n var _child$props2;\n\n return child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.rowSpan;\n });\n var visibleRows = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)([]);\n var mouseAreaRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var tableRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var tableHeaderRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var affixHeaderWrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var headerWrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var tableBodyRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var wheelWrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var scrollbarXRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var scrollbarYRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n\n var handleTableResizeChange = function handleTableResizeChange(_prevSize, event) {\n forceUpdate();\n /**\n * Reset the position of the scroll bar after the table size changes.\n */\n\n if (typeof shouldUpdateScroll === 'function') {\n onScrollTo(shouldUpdateScroll(event));\n } else if (shouldUpdateScroll) {\n var vertical = event === 'bodyHeightChanged';\n vertical ? onScrollTop(0) : onScrollLeft(0);\n }\n };\n\n var _useTableDimension = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useTableDimension)({\n data: dataProp,\n width: widthProp,\n rowHeight: rowHeight,\n tableRef: tableRef,\n headerWrapperRef: headerWrapperRef,\n prefix: prefix,\n affixHeader: affixHeader,\n affixHorizontalScrollbar: affixHorizontalScrollbar,\n headerHeight: headerHeight,\n height: height,\n minHeight: minHeight,\n autoHeight: autoHeight,\n fillHeight: fillHeight,\n children: children,\n expandedRowKeys: expandedRowKeys,\n onTableScroll: lodash_debounce__WEBPACK_IMPORTED_MODULE_7___default()(function (coords) {\n return onScrollTo(coords);\n }, 100),\n onTableResizeChange: handleTableResizeChange\n }),\n contentHeight = _useTableDimension.contentHeight,\n contentWidth = _useTableDimension.contentWidth,\n minScrollY = _useTableDimension.minScrollY,\n minScrollX = _useTableDimension.minScrollX,\n scrollY = _useTableDimension.scrollY,\n scrollX = _useTableDimension.scrollX,\n tableWidth = _useTableDimension.tableWidth,\n tableOffset = _useTableDimension.tableOffset,\n headerOffset = _useTableDimension.headerOffset,\n setScrollY = _useTableDimension.setScrollY,\n setScrollX = _useTableDimension.setScrollX,\n getTableHeight = _useTableDimension.getTableHeight;\n\n (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useAffix)({\n getTableHeight: getTableHeight,\n contentHeight: contentHeight,\n affixHorizontalScrollbar: affixHorizontalScrollbar,\n affixHeader: affixHeader,\n tableOffset: tableOffset,\n headerOffset: headerOffset,\n headerHeight: headerHeight,\n scrollbarXRef: scrollbarXRef,\n affixHeaderWrapperRef: affixHeaderWrapperRef\n });\n\n var _usePosition = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.usePosition)({\n data: dataProp,\n height: height,\n tableWidth: tableWidth,\n tableRef: tableRef,\n prefix: prefix,\n translateDOMPositionXY: translateDOMPositionXY,\n wheelWrapperRef: wheelWrapperRef,\n headerWrapperRef: headerWrapperRef,\n affixHeaderWrapperRef: affixHeaderWrapperRef,\n tableHeaderRef: tableHeaderRef,\n scrollX: scrollX,\n scrollY: scrollY,\n contentWidth: contentWidth,\n shouldFixedColumn: shouldFixedColumn\n }),\n forceUpdatePosition = _usePosition.forceUpdatePosition;\n\n var _useScrollListener = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useScrollListener)({\n rtl: rtl,\n data: dataProp,\n height: height,\n virtualized: virtualized,\n getTableHeight: getTableHeight,\n contentHeight: contentHeight,\n headerHeight: headerHeight,\n autoHeight: autoHeight,\n tableBodyRef: tableBodyRef,\n scrollbarXRef: scrollbarXRef,\n scrollbarYRef: scrollbarYRef,\n disabledScroll: disabledScroll,\n loading: loading,\n tableRef: tableRef,\n contentWidth: contentWidth,\n tableWidth: tableWidth,\n scrollY: scrollY,\n minScrollY: minScrollY,\n minScrollX: minScrollX,\n scrollX: scrollX,\n setScrollX: setScrollX,\n setScrollY: setScrollY,\n forceUpdatePosition: forceUpdatePosition,\n onScroll: onScroll,\n onTouchStart: onTouchStart,\n onTouchMove: onTouchMove,\n onTouchEnd: onTouchEnd\n }),\n isScrolling = _useScrollListener.isScrolling,\n onScrollHorizontal = _useScrollListener.onScrollHorizontal,\n onScrollVertical = _useScrollListener.onScrollVertical,\n onScrollBody = _useScrollListener.onScrollBody,\n onScrollTop = _useScrollListener.onScrollTop,\n onScrollLeft = _useScrollListener.onScrollLeft,\n onScrollTo = _useScrollListener.onScrollTo;\n\n var _useCellDescriptor = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useCellDescriptor)({\n children: children,\n rtl: rtl,\n mouseAreaRef: mouseAreaRef,\n tableRef: tableRef,\n minScrollX: minScrollX,\n scrollX: scrollX,\n tableWidth: tableWidth,\n headerHeight: headerHeight,\n showHeader: showHeader,\n sortType: sortTypeProp,\n defaultSortType: defaultSortType,\n sortColumn: sortColumn,\n prefix: prefix,\n onSortColumn: onSortColumn,\n // Force table update after column width change, so scrollbar re-renders.\n onHeaderCellResize: forceUpdate,\n rowHeight: rowHeight\n }),\n headerCells = _useCellDescriptor.headerCells,\n bodyCells = _useCellDescriptor.bodyCells,\n allColumnsWidth = _useCellDescriptor.allColumnsWidth,\n hasCustomTreeCol = _useCellDescriptor.hasCustomTreeCol;\n\n var colCounts = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)((headerCells === null || headerCells === void 0 ? void 0 : headerCells.length) || 0);\n (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useUpdateEffect)(function () {\n setData(isTree ? filterTreeData(dataProp, expandedRowKeys, rowKey) : dataProp);\n }, [dataProp, expandedRowKeys, rowKey, isTree]);\n (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useUpdateEffect)(function () {\n if ((headerCells === null || headerCells === void 0 ? void 0 : headerCells.length) !== colCounts.current) {\n onScrollLeft(0);\n colCounts.current = (headerCells === null || headerCells === void 0 ? void 0 : headerCells.length) || 0;\n }\n }, [children]);\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useImperativeHandle)(ref, function () {\n return {\n get root() {\n return tableRef.current;\n },\n\n get body() {\n return wheelWrapperRef.current;\n },\n\n scrollTop: onScrollTop,\n scrollLeft: onScrollLeft\n };\n });\n var rowWidth = allColumnsWidth > tableWidth.current ? allColumnsWidth : tableWidth.current; // Whether to show vertical scroll bar\n\n var hasVerticalScrollbar = !autoHeight && contentHeight.current > getTableHeight() - headerHeight; // Whether to show the horizontal scroll bar\n\n var hasHorizontalScrollbar = contentWidth.current > tableWidth.current;\n var classes = mergeCls(className, withClassPrefix({\n bordered: bordered,\n hover: hover && !shouldRowSpanColumn,\n loading: loading,\n treetable: isTree,\n 'word-wrap': wordWrap,\n 'cell-bordered': cellBordered\n }));\n\n var styles = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({\n width: widthProp || 'auto',\n height: getTableHeight()\n }, style);\n\n var renderRowExpanded = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (rowData) {\n var styles = {\n height: rowExpandedHeight\n };\n\n if (typeof renderRowExpandedProp === 'function') {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n className: prefix('row-expanded'),\n style: styles\n }, renderRowExpandedProp(rowData));\n }\n\n return null;\n }, [prefix, renderRowExpandedProp, rowExpandedHeight]);\n\n var renderRow = function renderRow(props, cells, shouldRenderExpandedRow, rowData) {\n var depth = props.depth,\n restRowProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__.default)(props, _excluded2);\n\n if (typeof rowClassName === 'function') {\n restRowProps.className = rowClassName(rowData);\n } else {\n restRowProps.className = rowClassName;\n }\n\n var rowStyles = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, props === null || props === void 0 ? void 0 : props.style);\n\n var rowRight = 0;\n\n if (rtl && contentWidth.current > tableWidth.current) {\n rowRight = tableWidth.current - contentWidth.current;\n rowStyles.right = rowRight;\n }\n\n var rowNode = null; // IF there are fixed columns, add a fixed group\n\n if (shouldFixedColumn && contentWidth.current > tableWidth.current) {\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 width = _cell$props.width;\n var isFixedStart = fixed === 'left' || fixed === true;\n var isFixedEnd = fixed === 'right';\n\n if (rtl) {\n isFixedStart = fixed === 'right';\n isFixedEnd = fixed === 'left' || fixed === true;\n }\n\n if (isFixedStart) {\n fixedLeftCells.push(cell);\n fixedLeftCellGroupWidth += width;\n } else if (isFixedEnd) {\n fixedRightCells.push(cell);\n fixedRightCellGroupWidth += width;\n } else {\n scrollCells.push(cell);\n }\n }\n\n if (hasVerticalScrollbar && fixedRightCellGroupWidth) {\n fixedRightCellGroupWidth += _constants__WEBPACK_IMPORTED_MODULE_15__.SCROLLBAR_WIDTH;\n }\n\n rowNode = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement((react__WEBPACK_IMPORTED_MODULE_2___default().Fragment), null, fixedLeftCellGroupWidth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CellGroup__WEBPACK_IMPORTED_MODULE_9__.default, {\n fixed: \"left\",\n height: props.isHeaderRow ? props.headerHeight : props.height,\n width: fixedLeftCellGroupWidth,\n style: rtl ? {\n right: tableWidth.current - fixedLeftCellGroupWidth - rowRight\n } : undefined\n }, (0,_utils__WEBPACK_IMPORTED_MODULE_16__.mergeCells)((0,_utils__WEBPACK_IMPORTED_MODULE_16__.resetLeftForCells)(fixedLeftCells))) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CellGroup__WEBPACK_IMPORTED_MODULE_9__.default, null, (0,_utils__WEBPACK_IMPORTED_MODULE_16__.mergeCells)(scrollCells)), fixedRightCellGroupWidth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CellGroup__WEBPACK_IMPORTED_MODULE_9__.default, {\n fixed: \"right\",\n style: rtl ? {\n right: 0 - rowRight\n } : {\n left: tableWidth.current - fixedRightCellGroupWidth\n },\n height: props.isHeaderRow ? props.headerHeight : props.height,\n width: fixedRightCellGroupWidth\n }, (0,_utils__WEBPACK_IMPORTED_MODULE_16__.mergeCells)((0,_utils__WEBPACK_IMPORTED_MODULE_16__.resetLeftForCells)(fixedRightCells, hasVerticalScrollbar ? _constants__WEBPACK_IMPORTED_MODULE_15__.SCROLLBAR_WIDTH : 0))) : null, shouldRenderExpandedRow && renderRowExpanded(rowData));\n } else {\n rowNode = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement((react__WEBPACK_IMPORTED_MODULE_2___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CellGroup__WEBPACK_IMPORTED_MODULE_9__.default, null, (0,_utils__WEBPACK_IMPORTED_MODULE_16__.mergeCells)(cells)), shouldRenderExpandedRow && renderRowExpanded(rowData));\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Row__WEBPACK_IMPORTED_MODULE_8__.default, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, restRowProps, {\n \"data-depth\": depth,\n style: rowStyles\n }), renderRowProp ? renderRowProp(rowNode, rowData) : rowNode);\n };\n\n var renderTableHeader = function renderTableHeader(headerCells, rowWidth) {\n var top = typeof affixHeader === 'number' ? affixHeader : 0;\n var rowProps = {\n 'aria-rowindex': 1,\n rowRef: tableHeaderRef,\n width: rowWidth,\n height: getRowHeight(),\n headerHeight: headerHeight,\n isHeaderRow: true,\n top: 0\n };\n var fixedStyle = {\n position: 'fixed',\n overflow: 'hidden',\n height: headerHeight,\n width: tableWidth.current,\n top: top\n }; // Affix header\n\n var header = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n className: prefix('affix-header'),\n style: fixedStyle,\n ref: affixHeaderWrapperRef\n }, renderRow(rowProps, headerCells));\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement((react__WEBPACK_IMPORTED_MODULE_2___default().Fragment), null, (affixHeader === 0 || affixHeader) && header, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n role: \"rowgroup\",\n className: prefix('header-row-wrapper'),\n ref: headerWrapperRef\n }, renderRow(rowProps, headerCells)));\n };\n\n var shouldRenderExpandedRow = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (rowData) {\n if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(renderRowExpandedProp) && !isTree && rowKey && expandedRowKeys.some(function (key) {\n return key === rowData[rowKey];\n })) {\n return true;\n }\n\n return false;\n }, [expandedRowKeys, isTree, renderRowExpandedProp, rowKey]);\n var bindRowClick = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (rowData) {\n return function (event) {\n onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(rowData, event);\n };\n }, [onRowClick]);\n var bindRowContextMenu = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (rowData) {\n return function (event) {\n onRowContextMenu === null || onRowContextMenu === void 0 ? void 0 : onRowContextMenu(rowData, event);\n };\n }, [onRowContextMenu]);\n var handleTreeToggle = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (treeRowKey, _rowIndex, rowData) {\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 === treeRowKey) {\n open = true;\n } else {\n nextExpandedRowKeys.push(key);\n }\n }\n\n if (!open) {\n nextExpandedRowKeys.push(treeRowKey);\n }\n\n setExpandedRowKeys(nextExpandedRowKeys);\n onExpandChange === null || onExpandChange === void 0 ? void 0 : onExpandChange(!open, rowData);\n }, [expandedRowKeys, onExpandChange, setExpandedRowKeys]);\n /**\n * Records the status of merged rows.\n * { cellKey: [count,index]}\n */\n\n var rowSpanState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)({});\n\n var renderRowData = function renderRowData(bodyCells, rowData, props, shouldRenderExpandedRow) {\n var hasChildren = isTree && rowData.children && Array.isArray(rowData.children);\n var nextRowKey = rowKey && typeof rowData[rowKey] !== 'undefined' ? rowData[rowKey] : props.key;\n\n var rowProps = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, props, {\n key: nextRowKey,\n 'aria-rowindex': props.key + 2,\n rowRef: bindTableRowsRef(props.key, rowData),\n onClick: bindRowClick(rowData),\n onContextMenu: bindRowContextMenu(rowData)\n });\n\n var expanded = expandedRowKeys.some(function (key) {\n return rowKey && key === rowData[rowKey];\n });\n var cells = [];\n\n for (var i = 0; i < bodyCells.length; i++) {\n var _cell$props2, _cell$props2$rowSpan, _rowSpanState$current, _cell$props3, _rowSpanState$current2;\n\n var cell = bodyCells[i];\n var rowSpan = (_cell$props2 = cell.props) === null || _cell$props2 === void 0 ? void 0 : (_cell$props2$rowSpan = _cell$props2.rowSpan) === null || _cell$props2$rowSpan === void 0 ? void 0 : _cell$props2$rowSpan.call(_cell$props2, rowData);\n\n var _rowHeight = rowSpan ? rowSpan * (props.height || 46) : props.height;\n\n var _cellKey = cell.props.dataKey || i; // Record the cell state of the merged row\n\n\n if (((_rowSpanState$current = rowSpanState.current[_cellKey]) === null || _rowSpanState$current === void 0 ? void 0 : _rowSpanState$current[1]) > 0) {\n rowSpanState.current[_cellKey][1] -= 1; // Restart counting when merged to the last cell.\n\n if (rowSpanState.current[_cellKey][1] === 0) {\n rowSpanState.current[_cellKey][0] = 0;\n }\n }\n\n if (rowSpan) {\n // The state of the initial merged cell\n rowSpanState.current[_cellKey] = [rowSpan, rowSpan];\n rowProps.rowSpan = rowSpan;\n rowProps.style = {\n overflow: 'inherit'\n };\n } // Cells marked as deleted when checking for merged cell.\n\n\n var removedCell = (_cell$props3 = cell.props) !== null && _cell$props3 !== void 0 && _cell$props3.rowSpan && !rowSpan && ((_rowSpanState$current2 = rowSpanState.current[_cellKey]) === null || _rowSpanState$current2 === void 0 ? void 0 : _rowSpanState$current2[0]) !== 0 ? true : false;\n cells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cell, {\n hasChildren: hasChildren,\n rowData: rowData,\n wordWrap: wordWrap,\n height: _rowHeight,\n rowIndex: props.key,\n depth: props.depth,\n renderTreeToggle: renderTreeToggle,\n onTreeToggle: handleTreeToggle,\n rowKey: nextRowKey,\n expanded: expanded,\n rowSpan: rowSpan,\n removed: removedCell\n }));\n }\n\n return renderRow(rowProps, cells, shouldRenderExpandedRow, rowData);\n };\n\n var renderScrollbar = function renderScrollbar() {\n var height = getTableHeight();\n\n if (disabledScroll) {\n return null;\n }\n\n var scrollbars = [];\n\n if (hasHorizontalScrollbar) {\n scrollbars.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Scrollbar__WEBPACK_IMPORTED_MODULE_10__.default, {\n key: \"scrollbar\",\n tableId: id,\n style: {\n width: tableWidth.current\n },\n length: tableWidth.current,\n onScroll: onScrollHorizontal,\n scrollLength: contentWidth.current,\n ref: scrollbarXRef\n }));\n }\n\n if (hasVerticalScrollbar) {\n scrollbars.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Scrollbar__WEBPACK_IMPORTED_MODULE_10__.default, {\n vertical: true,\n key: \"vertical-scrollbar\",\n tableId: id,\n length: height - headerHeight,\n onScroll: onScrollVertical,\n scrollLength: contentHeight.current,\n ref: scrollbarYRef\n }));\n }\n\n return scrollbars;\n };\n\n var renderTableBody = function renderTableBody(bodyCells, rowWidth) {\n var _visibleRows$current;\n\n var height = 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 visibleRows.current = [];\n\n if (data) {\n var top = 0; // Row position\n\n var minTop = Math.abs(scrollY.current);\n var maxTop = minTop + height + rowExpandedHeight;\n var isCustomRowHeight = typeof rowHeight === 'function';\n var isUncertainHeight = !!renderRowExpandedProp || isCustomRowHeight || wordWrap; // If virtualized is enabled and the row height in the Table is variable,\n // you need to loop through the data to get the height of each row.\n\n if (isUncertainHeight && virtualized || !virtualized) {\n // Avoid white screens on the top and bottom of the table when touching and scrolling on the mobile terminal.\n // So supplement the display data row.\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_16__.isSupportTouchEvent)()) {\n var coveredHeight = height * 3;\n minTop = Math.max(minTop - coveredHeight, 0);\n maxTop = maxTop + coveredHeight;\n }\n\n for (var index = 0; index < data.length; index++) {\n var _rowData = data[index];\n var maxHeight = tableRowsMaxHeight[index];\n var shouldRender = shouldRenderExpandedRow(_rowData);\n var nextRowHeight = 0;\n\n if (typeof rowHeight === 'function') {\n nextRowHeight = rowHeight(_rowData);\n } else {\n nextRowHeight = maxHeight ? Math.max(maxHeight + _constants__WEBPACK_IMPORTED_MODULE_15__.CELL_PADDING_HEIGHT, rowHeight) : rowHeight;\n\n if (shouldRender) {\n nextRowHeight += rowExpandedHeight;\n }\n }\n\n contentHeight += nextRowHeight;\n var rowProps = {\n key: index,\n top: top,\n width: rowWidth,\n depth: _rowData[_constants__WEBPACK_IMPORTED_MODULE_15__.TREE_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 visibleRows.current.push(renderRowData(bodyCells, _rowData, rowProps, shouldRender));\n }\n } else {\n /** virtualized */\n // If the row height of the Table is fixed, it is directly calculated by the row height and the number of rows,\n // thereby reducing the performance cost of traversing all data.\n var _nextRowHeight = getRowHeight();\n\n var startIndex = Math.max(Math.floor(minTop / _nextRowHeight), 0);\n var endIndex = Math.min(startIndex + Math.ceil(bodyHeight / _nextRowHeight) + 5, data.length); // Avoid white screens on the top and bottom of the table when touching and scrolling on the mobile terminal.\n // So supplement the display data row.\n\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_16__.isSupportTouchEvent)()) {\n var coveredCount = Math.floor(height / _nextRowHeight * 3);\n startIndex = Math.max(startIndex - coveredCount, 0);\n endIndex = Math.min(endIndex + coveredCount, data.length);\n }\n\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 _rowData2 = data[_index];\n var _rowProps = {\n key: _index,\n depth: _rowData2[_constants__WEBPACK_IMPORTED_MODULE_15__.TREE_DEPTH],\n top: _index * _nextRowHeight,\n width: rowWidth,\n height: _nextRowHeight\n };\n visibleRows.current.push(renderRowData(bodyCells, _rowData2, _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_2___default().createElement(\"div\", {\n ref: tableBodyRef,\n role: \"rowgroup\",\n className: prefix('body-row-wrapper'),\n style: bodyStyles,\n onScroll: onScrollBody\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n style: wheelStyles,\n className: prefix('body-wheel-area'),\n ref: wheelWrapperRef\n }, topHideHeight ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Row__WEBPACK_IMPORTED_MODULE_8__.default, {\n style: topRowStyles,\n className: \"virtualized\"\n }) : null, visibleRows.current, bottomHideHeight ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Row__WEBPACK_IMPORTED_MODULE_8__.default, {\n style: bottomRowStyles,\n className: \"virtualized\"\n }) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_EmptyMessage__WEBPACK_IMPORTED_MODULE_13__.default, {\n locale: locale,\n renderEmpty: renderEmpty,\n addPrefix: prefix,\n loading: !!((_visibleRows$current = visibleRows.current) !== null && _visibleRows$current !== void 0 && _visibleRows$current.length) || loading\n }), renderScrollbar(), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Loader__WEBPACK_IMPORTED_MODULE_12__.default, {\n locale: locale,\n loadAnimation: loadAnimation,\n loading: loading,\n addPrefix: prefix,\n renderLoading: renderLoading\n }));\n };\n\n var contextValue = react__WEBPACK_IMPORTED_MODULE_2___default().useMemo(function () {\n return {\n classPrefix: classPrefix,\n translateDOMPositionXY: translateDOMPositionXY.current,\n rtl: rtl,\n isTree: isTree,\n hasCustomTreeCol: hasCustomTreeCol\n };\n }, [classPrefix, hasCustomTreeCol, isTree, rtl]);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_TableContext__WEBPACK_IMPORTED_MODULE_14__.default.Provider, {\n value: contextValue\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.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\": colCounts.current,\n \"aria-busy\": loading\n }, rest, {\n className: classes,\n style: styles,\n ref: tableRef\n }), showHeader && renderTableHeader(headerCells, rowWidth), children && renderTableBody(bodyCells, rowWidth), showHeader && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_MouseArea__WEBPACK_IMPORTED_MODULE_11__.default, {\n ref: mouseAreaRef,\n addPrefix: prefix,\n headerHeight: headerHeight,\n height: getTableHeight()\n })));\n});\nTable.displayName = 'Table';\nTable.propTypes = {\n autoHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n fillHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n affixHeader: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number)]),\n affixHorizontalScrollbar: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number)]),\n bordered: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n className: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().string),\n classPrefix: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().string),\n children: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().any),\n cellBordered: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n data: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().array),\n defaultExpandAllRows: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n defaultExpandedRowKeys: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().array),\n defaultSortType: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().any),\n disabledScroll: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n expandedRowKeys: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().array),\n hover: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n height: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n headerHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n locale: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().object),\n loading: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n loadAnimation: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n minHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n rowKey: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().string), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number)]),\n rowHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().number), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func)]),\n renderTreeToggle: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n renderRowExpanded: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n renderRow: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n rowExpandedHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n renderEmpty: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n renderLoading: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n rowClassName: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().func), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().string)]),\n rtl: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n style: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().object),\n sortColumn: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().string),\n sortType: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().any),\n showHeader: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n shouldUpdateScroll: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().func), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool)]),\n translate3d: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n wordWrap: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().any),\n width: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n virtualized: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n isTree: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n onRowClick: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onRowContextMenu: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onScroll: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onSortColumn: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onExpandChange: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onTouchStart: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onTouchMove: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onTouchEnd: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func)\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (Table);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/Table.js?");
|
|
9412
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var dom_lib_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/translateDOMPositionXY */ \"./node_modules/dom-lib/esm/translateDOMPositionXY.js\");\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 lodash_isFunction__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/isFunction */ \"./node_modules/lodash/isFunction.js\");\n/* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/flatten */ \"./node_modules/lodash/flatten.js\");\n/* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_flatten__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n/* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _Row__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Row */ \"./node_modules/rsuite-table/es/Row.js\");\n/* harmony import */ var _CellGroup__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./CellGroup */ \"./node_modules/rsuite-table/es/CellGroup.js\");\n/* harmony import */ var _Scrollbar__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Scrollbar */ \"./node_modules/rsuite-table/es/Scrollbar.js\");\n/* harmony import */ var _MouseArea__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./MouseArea */ \"./node_modules/rsuite-table/es/MouseArea.js\");\n/* harmony import */ var _Loader__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Loader */ \"./node_modules/rsuite-table/es/Loader.js\");\n/* harmony import */ var _EmptyMessage__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./EmptyMessage */ \"./node_modules/rsuite-table/es/EmptyMessage.js\");\n/* harmony import */ var _TableContext__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./TableContext */ \"./node_modules/rsuite-table/es/TableContext.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils */ \"./node_modules/rsuite-table/es/utils/index.js\");\n\n\nvar _excluded = [\"affixHeader\", \"children\", \"classPrefix\", \"className\", \"data\", \"defaultSortType\", \"width\", \"expandedRowKeys\", \"defaultExpandAllRows\", \"defaultExpandedRowKeys\", \"style\", \"id\", \"isTree\", \"hover\", \"bordered\", \"cellBordered\", \"wordWrap\", \"loading\", \"locale\", \"showHeader\", \"sortColumn\", \"rowHeight\", \"sortType\", \"headerHeight\", \"minHeight\", \"height\", \"autoHeight\", \"fillHeight\", \"rtl\", \"translate3d\", \"rowKey\", \"virtualized\", \"rowClassName\", \"rowExpandedHeight\", \"disabledScroll\", \"affixHorizontalScrollbar\", \"loadAnimation\", \"shouldUpdateScroll\", \"renderRow\", \"renderRowExpanded\", \"renderLoading\", \"renderEmpty\", \"onSortColumn\", \"onScroll\", \"renderTreeToggle\", \"onRowClick\", \"onRowContextMenu\", \"onExpandChange\", \"onTouchStart\", \"onTouchMove\", \"onTouchEnd\"],\n _excluded2 = [\"depth\"];\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Filter those expanded nodes.\n * @param data\n * @param expandedRowKeys\n * @param rowKey\n * @returns\n */\nvar filterTreeData = function filterTreeData(data, expandedRowKeys, rowKey) {\n return (0,_utils__WEBPACK_IMPORTED_MODULE_16__.flattenData)(data).filter(function (rowData) {\n if (rowKey) {\n var parents = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.findAllParents)(rowData, rowKey);\n\n var _expanded = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.shouldShowRowByExpanded)(expandedRowKeys, parents);\n\n rowData[_constants__WEBPACK_IMPORTED_MODULE_15__.EXPANDED_KEY] = _expanded;\n rowData[_constants__WEBPACK_IMPORTED_MODULE_15__.TREE_DEPTH] = parents.length;\n return _expanded;\n }\n });\n};\n\nvar DATA_PLACEHOLDER = [];\nvar Table = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().forwardRef(function (props, ref) {\n var affixHeader = props.affixHeader,\n children = props.children,\n _props$classPrefix = props.classPrefix,\n classPrefix = _props$classPrefix === void 0 ? 'rs-table' : _props$classPrefix,\n className = props.className,\n _props$data = props.data,\n dataProp = _props$data === void 0 ? DATA_PLACEHOLDER : _props$data,\n _props$defaultSortTyp = props.defaultSortType,\n defaultSortType = _props$defaultSortTyp === void 0 ? _constants__WEBPACK_IMPORTED_MODULE_15__.SORT_TYPE.DESC : _props$defaultSortTyp,\n widthProp = props.width,\n expandedRowKeysProp = props.expandedRowKeys,\n defaultExpandAllRows = props.defaultExpandAllRows,\n defaultExpandedRowKeys = props.defaultExpandedRowKeys,\n style = props.style,\n id = props.id,\n isTree = props.isTree,\n _props$hover = props.hover,\n hover = _props$hover === void 0 ? true : _props$hover,\n bordered = props.bordered,\n cellBordered = props.cellBordered,\n wordWrap = props.wordWrap,\n loading = props.loading,\n _props$locale = props.locale,\n locale = _props$locale === void 0 ? {\n emptyMessage: 'No data found',\n loading: 'Loading...'\n } : _props$locale,\n _props$showHeader = props.showHeader,\n showHeader = _props$showHeader === void 0 ? true : _props$showHeader,\n sortColumn = props.sortColumn,\n _props$rowHeight = props.rowHeight,\n rowHeight = _props$rowHeight === void 0 ? 46 : _props$rowHeight,\n sortTypeProp = props.sortType,\n _props$headerHeight = props.headerHeight,\n headerHeightProp = _props$headerHeight === void 0 ? 40 : _props$headerHeight,\n _props$minHeight = props.minHeight,\n minHeight = _props$minHeight === void 0 ? 0 : _props$minHeight,\n _props$height = props.height,\n height = _props$height === void 0 ? 200 : _props$height,\n autoHeight = props.autoHeight,\n fillHeight = props.fillHeight,\n rtlProp = props.rtl,\n _props$translate3d = props.translate3d,\n translate3d = _props$translate3d === void 0 ? true : _props$translate3d,\n rowKey = props.rowKey,\n virtualized = props.virtualized,\n rowClassName = props.rowClassName,\n _props$rowExpandedHei = props.rowExpandedHeight,\n rowExpandedHeight = _props$rowExpandedHei === void 0 ? 100 : _props$rowExpandedHei,\n disabledScroll = props.disabledScroll,\n affixHorizontalScrollbar = props.affixHorizontalScrollbar,\n loadAnimation = props.loadAnimation,\n _props$shouldUpdateSc = props.shouldUpdateScroll,\n shouldUpdateScroll = _props$shouldUpdateSc === void 0 ? true : _props$shouldUpdateSc,\n renderRowProp = props.renderRow,\n renderRowExpandedProp = props.renderRowExpanded,\n renderLoading = props.renderLoading,\n renderEmpty = props.renderEmpty,\n onSortColumn = props.onSortColumn,\n onScroll = props.onScroll,\n renderTreeToggle = props.renderTreeToggle,\n onRowClick = props.onRowClick,\n onRowContextMenu = props.onRowContextMenu,\n onExpandChange = props.onExpandChange,\n onTouchStart = props.onTouchStart,\n onTouchMove = props.onTouchMove,\n onTouchEnd = props.onTouchEnd,\n rest = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__.default)(props, _excluded);\n\n if (isTree && !rowKey) {\n throw new Error('The `rowKey` is required when set isTree');\n }\n\n var _useClassNames = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useClassNames)(classPrefix, typeof classPrefix !== 'undefined'),\n withClassPrefix = _useClassNames.withClassPrefix,\n mergeCls = _useClassNames.merge,\n prefix = _useClassNames.prefix; // Use `forceUpdate` to force the component to re-render after manipulating the DOM.\n\n\n var _useReducer = (0,react__WEBPACK_IMPORTED_MODULE_2__.useReducer)(function (x) {\n return x + 1;\n }, 0),\n forceUpdate = _useReducer[1];\n\n var _useControlled = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useControlled)(expandedRowKeysProp, defaultExpandAllRows ? (0,_utils__WEBPACK_IMPORTED_MODULE_16__.findRowKeys)(dataProp, rowKey, lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(renderRowExpandedProp)) : defaultExpandedRowKeys || []),\n expandedRowKeys = _useControlled[0],\n setExpandedRowKeys = _useControlled[1];\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(function () {\n return isTree ? filterTreeData(dataProp, expandedRowKeys, rowKey) : dataProp;\n }),\n data = _useState[0],\n setData = _useState[1];\n\n var _useTableRows = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useTableRows)({\n data: dataProp,\n expandedRowKeys: expandedRowKeys,\n wordWrap: wordWrap,\n prefix: prefix\n }),\n tableRowsMaxHeight = _useTableRows.tableRowsMaxHeight,\n bindTableRowsRef = _useTableRows.bindTableRowsRef;\n\n var headerHeight = showHeader ? headerHeightProp : 0;\n var rtl = rtlProp || (0,_utils__WEBPACK_IMPORTED_MODULE_16__.isRTL)();\n\n var getRowHeight = function getRowHeight(rowData) {\n if (rowData === void 0) {\n rowData = {};\n }\n\n return typeof rowHeight === 'function' ? rowHeight(rowData) : rowHeight;\n };\n\n var translateDOMPositionXY = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)((0,dom_lib_translateDOMPositionXY__WEBPACK_IMPORTED_MODULE_3__.getTranslateDOMPositionXY)({\n forceUseTransform: true,\n enable3DTransform: translate3d\n })); // Check for the existence of fixed columns in all column properties.\n\n var shouldFixedColumn = Array.from(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()(children)).some(function (child) {\n var _child$props;\n\n return child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.fixed;\n }); // Check all column properties for the existence of rowSpan.\n\n var shouldRowSpanColumn = Array.from(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()(children)).some(function (child) {\n var _child$props2;\n\n return child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.rowSpan;\n });\n var visibleRows = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)([]);\n var mouseAreaRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var tableRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var tableHeaderRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var affixHeaderWrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var headerWrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var tableBodyRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var wheelWrapperRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var scrollbarXRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n var scrollbarYRef = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)(null);\n\n var handleTableResizeChange = function handleTableResizeChange(_prevSize, event) {\n forceUpdate();\n /**\n * Reset the position of the scroll bar after the table size changes.\n */\n\n if (typeof shouldUpdateScroll === 'function') {\n onScrollTo(shouldUpdateScroll(event));\n } else if (shouldUpdateScroll) {\n var vertical = event === 'bodyHeightChanged';\n vertical ? onScrollTop(0) : onScrollLeft(0);\n }\n };\n\n var _useTableDimension = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useTableDimension)({\n data: dataProp,\n width: widthProp,\n rowHeight: rowHeight,\n tableRef: tableRef,\n headerWrapperRef: headerWrapperRef,\n prefix: prefix,\n affixHeader: affixHeader,\n affixHorizontalScrollbar: affixHorizontalScrollbar,\n headerHeight: headerHeight,\n height: height,\n minHeight: minHeight,\n autoHeight: autoHeight,\n fillHeight: fillHeight,\n children: children,\n expandedRowKeys: expandedRowKeys,\n showHeader: showHeader,\n onTableScroll: lodash_debounce__WEBPACK_IMPORTED_MODULE_7___default()(function (coords) {\n return onScrollTo(coords);\n }, 100),\n onTableResizeChange: handleTableResizeChange\n }),\n contentHeight = _useTableDimension.contentHeight,\n contentWidth = _useTableDimension.contentWidth,\n minScrollY = _useTableDimension.minScrollY,\n minScrollX = _useTableDimension.minScrollX,\n scrollY = _useTableDimension.scrollY,\n scrollX = _useTableDimension.scrollX,\n tableWidth = _useTableDimension.tableWidth,\n tableOffset = _useTableDimension.tableOffset,\n headerOffset = _useTableDimension.headerOffset,\n setScrollY = _useTableDimension.setScrollY,\n setScrollX = _useTableDimension.setScrollX,\n getTableHeight = _useTableDimension.getTableHeight;\n\n (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useAffix)({\n getTableHeight: getTableHeight,\n contentHeight: contentHeight,\n affixHorizontalScrollbar: affixHorizontalScrollbar,\n affixHeader: affixHeader,\n tableOffset: tableOffset,\n headerOffset: headerOffset,\n headerHeight: headerHeight,\n scrollbarXRef: scrollbarXRef,\n affixHeaderWrapperRef: affixHeaderWrapperRef\n });\n\n var _usePosition = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.usePosition)({\n data: dataProp,\n height: height,\n tableWidth: tableWidth,\n tableRef: tableRef,\n prefix: prefix,\n translateDOMPositionXY: translateDOMPositionXY,\n wheelWrapperRef: wheelWrapperRef,\n headerWrapperRef: headerWrapperRef,\n affixHeaderWrapperRef: affixHeaderWrapperRef,\n tableHeaderRef: tableHeaderRef,\n scrollX: scrollX,\n scrollY: scrollY,\n contentWidth: contentWidth,\n shouldFixedColumn: shouldFixedColumn\n }),\n forceUpdatePosition = _usePosition.forceUpdatePosition;\n\n var _useScrollListener = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useScrollListener)({\n rtl: rtl,\n data: dataProp,\n height: height,\n virtualized: virtualized,\n getTableHeight: getTableHeight,\n contentHeight: contentHeight,\n headerHeight: headerHeight,\n autoHeight: autoHeight,\n tableBodyRef: tableBodyRef,\n scrollbarXRef: scrollbarXRef,\n scrollbarYRef: scrollbarYRef,\n disabledScroll: disabledScroll,\n loading: loading,\n tableRef: tableRef,\n contentWidth: contentWidth,\n tableWidth: tableWidth,\n scrollY: scrollY,\n minScrollY: minScrollY,\n minScrollX: minScrollX,\n scrollX: scrollX,\n setScrollX: setScrollX,\n setScrollY: setScrollY,\n forceUpdatePosition: forceUpdatePosition,\n onScroll: onScroll,\n onTouchStart: onTouchStart,\n onTouchMove: onTouchMove,\n onTouchEnd: onTouchEnd\n }),\n isScrolling = _useScrollListener.isScrolling,\n onScrollHorizontal = _useScrollListener.onScrollHorizontal,\n onScrollVertical = _useScrollListener.onScrollVertical,\n onScrollBody = _useScrollListener.onScrollBody,\n onScrollTop = _useScrollListener.onScrollTop,\n onScrollLeft = _useScrollListener.onScrollLeft,\n onScrollTo = _useScrollListener.onScrollTo;\n\n var _useCellDescriptor = (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useCellDescriptor)({\n children: children,\n rtl: rtl,\n mouseAreaRef: mouseAreaRef,\n tableRef: tableRef,\n minScrollX: minScrollX,\n scrollX: scrollX,\n tableWidth: tableWidth,\n headerHeight: headerHeight,\n showHeader: showHeader,\n sortType: sortTypeProp,\n defaultSortType: defaultSortType,\n sortColumn: sortColumn,\n prefix: prefix,\n onSortColumn: onSortColumn,\n // Force table update after column width change, so scrollbar re-renders.\n onHeaderCellResize: forceUpdate,\n rowHeight: rowHeight\n }),\n headerCells = _useCellDescriptor.headerCells,\n bodyCells = _useCellDescriptor.bodyCells,\n allColumnsWidth = _useCellDescriptor.allColumnsWidth,\n hasCustomTreeCol = _useCellDescriptor.hasCustomTreeCol;\n\n var colCounts = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)((headerCells === null || headerCells === void 0 ? void 0 : headerCells.length) || 0);\n (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useUpdateEffect)(function () {\n setData(isTree ? filterTreeData(dataProp, expandedRowKeys, rowKey) : dataProp);\n }, [dataProp, expandedRowKeys, rowKey, isTree]);\n (0,_utils__WEBPACK_IMPORTED_MODULE_16__.useUpdateEffect)(function () {\n if ((headerCells === null || headerCells === void 0 ? void 0 : headerCells.length) !== colCounts.current) {\n onScrollLeft(0);\n colCounts.current = (headerCells === null || headerCells === void 0 ? void 0 : headerCells.length) || 0;\n }\n }, [children]);\n (0,react__WEBPACK_IMPORTED_MODULE_2__.useImperativeHandle)(ref, function () {\n return {\n get root() {\n return tableRef.current;\n },\n\n get body() {\n return wheelWrapperRef.current;\n },\n\n scrollTop: onScrollTop,\n scrollLeft: onScrollLeft\n };\n });\n var rowWidth = allColumnsWidth > tableWidth.current ? allColumnsWidth : tableWidth.current; // Whether to show vertical scroll bar\n\n var hasVerticalScrollbar = !autoHeight && contentHeight.current > getTableHeight() - headerHeight; // Whether to show the horizontal scroll bar\n\n var hasHorizontalScrollbar = contentWidth.current > tableWidth.current;\n var classes = mergeCls(className, withClassPrefix({\n bordered: bordered,\n hover: hover && !shouldRowSpanColumn,\n loading: loading,\n treetable: isTree,\n 'word-wrap': wordWrap,\n 'cell-bordered': cellBordered\n }));\n\n var styles = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({\n width: widthProp || 'auto',\n height: getTableHeight()\n }, style);\n\n var renderRowExpanded = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (rowData) {\n var styles = {\n height: rowExpandedHeight\n };\n\n if (typeof renderRowExpandedProp === 'function') {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n className: prefix('row-expanded'),\n style: styles\n }, renderRowExpandedProp(rowData));\n }\n\n return null;\n }, [prefix, renderRowExpandedProp, rowExpandedHeight]);\n\n var renderRow = function renderRow(props, cells, shouldRenderExpandedRow, rowData) {\n var depth = props.depth,\n restRowProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__.default)(props, _excluded2);\n\n if (typeof rowClassName === 'function') {\n restRowProps.className = rowClassName(rowData);\n } else {\n restRowProps.className = rowClassName;\n }\n\n var rowStyles = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, props === null || props === void 0 ? void 0 : props.style);\n\n var rowRight = 0;\n\n if (rtl && contentWidth.current > tableWidth.current) {\n rowRight = tableWidth.current - contentWidth.current;\n rowStyles.right = rowRight;\n }\n\n var rowNode = null; // IF there are fixed columns, add a fixed group\n\n if (shouldFixedColumn && contentWidth.current > tableWidth.current) {\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 width = _cell$props.width;\n var isFixedStart = fixed === 'left' || fixed === true;\n var isFixedEnd = fixed === 'right';\n\n if (rtl) {\n isFixedStart = fixed === 'right';\n isFixedEnd = fixed === 'left' || fixed === true;\n }\n\n if (isFixedStart) {\n fixedLeftCells.push(cell);\n fixedLeftCellGroupWidth += width;\n } else if (isFixedEnd) {\n fixedRightCells.push(cell);\n fixedRightCellGroupWidth += width;\n } else {\n scrollCells.push(cell);\n }\n }\n\n if (hasVerticalScrollbar && fixedRightCellGroupWidth) {\n fixedRightCellGroupWidth += _constants__WEBPACK_IMPORTED_MODULE_15__.SCROLLBAR_WIDTH;\n }\n\n rowNode = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement((react__WEBPACK_IMPORTED_MODULE_2___default().Fragment), null, fixedLeftCellGroupWidth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CellGroup__WEBPACK_IMPORTED_MODULE_9__.default, {\n fixed: \"left\",\n height: props.isHeaderRow ? props.headerHeight : props.height,\n width: fixedLeftCellGroupWidth,\n style: rtl ? {\n right: tableWidth.current - fixedLeftCellGroupWidth - rowRight\n } : undefined\n }, (0,_utils__WEBPACK_IMPORTED_MODULE_16__.mergeCells)((0,_utils__WEBPACK_IMPORTED_MODULE_16__.resetLeftForCells)(fixedLeftCells))) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CellGroup__WEBPACK_IMPORTED_MODULE_9__.default, null, (0,_utils__WEBPACK_IMPORTED_MODULE_16__.mergeCells)(scrollCells)), fixedRightCellGroupWidth ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CellGroup__WEBPACK_IMPORTED_MODULE_9__.default, {\n fixed: \"right\",\n style: rtl ? {\n right: 0 - rowRight\n } : {\n left: tableWidth.current - fixedRightCellGroupWidth\n },\n height: props.isHeaderRow ? props.headerHeight : props.height,\n width: fixedRightCellGroupWidth\n }, (0,_utils__WEBPACK_IMPORTED_MODULE_16__.mergeCells)((0,_utils__WEBPACK_IMPORTED_MODULE_16__.resetLeftForCells)(fixedRightCells, hasVerticalScrollbar ? _constants__WEBPACK_IMPORTED_MODULE_15__.SCROLLBAR_WIDTH : 0))) : null, shouldRenderExpandedRow && renderRowExpanded(rowData));\n } else {\n rowNode = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement((react__WEBPACK_IMPORTED_MODULE_2___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_CellGroup__WEBPACK_IMPORTED_MODULE_9__.default, null, (0,_utils__WEBPACK_IMPORTED_MODULE_16__.mergeCells)(cells)), shouldRenderExpandedRow && renderRowExpanded(rowData));\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Row__WEBPACK_IMPORTED_MODULE_8__.default, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, restRowProps, {\n \"data-depth\": depth,\n style: rowStyles\n }), renderRowProp ? renderRowProp(rowNode, rowData) : rowNode);\n };\n\n var renderTableHeader = function renderTableHeader(headerCells, rowWidth) {\n var top = typeof affixHeader === 'number' ? affixHeader : 0;\n var rowProps = {\n 'aria-rowindex': 1,\n rowRef: tableHeaderRef,\n width: rowWidth,\n height: getRowHeight(),\n headerHeight: headerHeight,\n isHeaderRow: true,\n top: 0\n };\n var fixedStyle = {\n position: 'fixed',\n overflow: 'hidden',\n height: headerHeight,\n width: tableWidth.current,\n top: top\n }; // Affix header\n\n var header = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n className: prefix('affix-header'),\n style: fixedStyle,\n ref: affixHeaderWrapperRef\n }, renderRow(rowProps, headerCells));\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement((react__WEBPACK_IMPORTED_MODULE_2___default().Fragment), null, (affixHeader === 0 || affixHeader) && header, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n role: \"rowgroup\",\n className: prefix('header-row-wrapper'),\n ref: headerWrapperRef\n }, renderRow(rowProps, headerCells)));\n };\n\n var shouldRenderExpandedRow = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (rowData) {\n if (lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(renderRowExpandedProp) && !isTree && rowKey && expandedRowKeys.some(function (key) {\n return key === rowData[rowKey];\n })) {\n return true;\n }\n\n return false;\n }, [expandedRowKeys, isTree, renderRowExpandedProp, rowKey]);\n var bindRowClick = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (rowData) {\n return function (event) {\n onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(rowData, event);\n };\n }, [onRowClick]);\n var bindRowContextMenu = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (rowData) {\n return function (event) {\n onRowContextMenu === null || onRowContextMenu === void 0 ? void 0 : onRowContextMenu(rowData, event);\n };\n }, [onRowContextMenu]);\n var handleTreeToggle = (0,react__WEBPACK_IMPORTED_MODULE_2__.useCallback)(function (treeRowKey, _rowIndex, rowData) {\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 === treeRowKey) {\n open = true;\n } else {\n nextExpandedRowKeys.push(key);\n }\n }\n\n if (!open) {\n nextExpandedRowKeys.push(treeRowKey);\n }\n\n setExpandedRowKeys(nextExpandedRowKeys);\n onExpandChange === null || onExpandChange === void 0 ? void 0 : onExpandChange(!open, rowData);\n }, [expandedRowKeys, onExpandChange, setExpandedRowKeys]);\n /**\n * Records the status of merged rows.\n * { cellKey: [count,index]}\n */\n\n var rowSpanState = (0,react__WEBPACK_IMPORTED_MODULE_2__.useRef)({});\n\n var renderRowData = function renderRowData(bodyCells, rowData, props, shouldRenderExpandedRow) {\n var hasChildren = isTree && rowData.children && Array.isArray(rowData.children);\n var nextRowKey = rowKey && typeof rowData[rowKey] !== 'undefined' ? rowData[rowKey] : props.key;\n\n var rowProps = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, props, {\n key: nextRowKey,\n 'aria-rowindex': props.key + 2,\n rowRef: bindTableRowsRef(props.key, rowData),\n onClick: bindRowClick(rowData),\n onContextMenu: bindRowContextMenu(rowData)\n });\n\n var expanded = expandedRowKeys.some(function (key) {\n return rowKey && key === rowData[rowKey];\n });\n var cells = [];\n\n for (var i = 0; i < bodyCells.length; i++) {\n var _cell$props2, _cell$props2$rowSpan, _rowSpanState$current, _cell$props3, _rowSpanState$current2;\n\n var cell = bodyCells[i];\n var rowSpan = (_cell$props2 = cell.props) === null || _cell$props2 === void 0 ? void 0 : (_cell$props2$rowSpan = _cell$props2.rowSpan) === null || _cell$props2$rowSpan === void 0 ? void 0 : _cell$props2$rowSpan.call(_cell$props2, rowData);\n\n var _rowHeight = rowSpan ? rowSpan * (props.height || 46) : props.height;\n\n var _cellKey = cell.props.dataKey || i; // Record the cell state of the merged row\n\n\n if (((_rowSpanState$current = rowSpanState.current[_cellKey]) === null || _rowSpanState$current === void 0 ? void 0 : _rowSpanState$current[1]) > 0) {\n rowSpanState.current[_cellKey][1] -= 1; // Restart counting when merged to the last cell.\n\n if (rowSpanState.current[_cellKey][1] === 0) {\n rowSpanState.current[_cellKey][0] = 0;\n }\n }\n\n if (rowSpan) {\n // The state of the initial merged cell\n rowSpanState.current[_cellKey] = [rowSpan, rowSpan];\n rowProps.rowSpan = rowSpan;\n rowProps.style = {\n overflow: 'inherit'\n };\n } // Cells marked as deleted when checking for merged cell.\n\n\n var removedCell = (_cell$props3 = cell.props) !== null && _cell$props3 !== void 0 && _cell$props3.rowSpan && !rowSpan && ((_rowSpanState$current2 = rowSpanState.current[_cellKey]) === null || _rowSpanState$current2 === void 0 ? void 0 : _rowSpanState$current2[0]) !== 0 ? true : false;\n cells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(cell, {\n hasChildren: hasChildren,\n rowData: rowData,\n wordWrap: wordWrap,\n height: _rowHeight,\n rowIndex: props.key,\n depth: props.depth,\n renderTreeToggle: renderTreeToggle,\n onTreeToggle: handleTreeToggle,\n rowKey: nextRowKey,\n expanded: expanded,\n rowSpan: rowSpan,\n removed: removedCell\n }));\n }\n\n return renderRow(rowProps, cells, shouldRenderExpandedRow, rowData);\n };\n\n var renderScrollbar = function renderScrollbar() {\n var height = getTableHeight();\n\n if (disabledScroll) {\n return null;\n }\n\n var scrollbars = [];\n\n if (hasHorizontalScrollbar) {\n scrollbars.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Scrollbar__WEBPACK_IMPORTED_MODULE_10__.default, {\n key: \"scrollbar\",\n tableId: id,\n style: {\n width: tableWidth.current\n },\n length: tableWidth.current,\n onScroll: onScrollHorizontal,\n scrollLength: contentWidth.current,\n ref: scrollbarXRef\n }));\n }\n\n if (hasVerticalScrollbar) {\n scrollbars.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Scrollbar__WEBPACK_IMPORTED_MODULE_10__.default, {\n vertical: true,\n key: \"vertical-scrollbar\",\n tableId: id,\n length: height - headerHeight,\n onScroll: onScrollVertical,\n scrollLength: contentHeight.current,\n ref: scrollbarYRef\n }));\n }\n\n return scrollbars;\n };\n\n var renderTableBody = function renderTableBody(bodyCells, rowWidth) {\n var _visibleRows$current;\n\n var height = 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 visibleRows.current = [];\n\n if (data) {\n var top = 0; // Row position\n\n var minTop = Math.abs(scrollY.current);\n var maxTop = minTop + height + rowExpandedHeight;\n var isCustomRowHeight = typeof rowHeight === 'function';\n var isUncertainHeight = !!renderRowExpandedProp || isCustomRowHeight || wordWrap; // If virtualized is enabled and the row height in the Table is variable,\n // you need to loop through the data to get the height of each row.\n\n if (isUncertainHeight && virtualized || !virtualized) {\n // Avoid white screens on the top and bottom of the table when touching and scrolling on the mobile terminal.\n // So supplement the display data row.\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_16__.isSupportTouchEvent)()) {\n var coveredHeight = height * 3;\n minTop = Math.max(minTop - coveredHeight, 0);\n maxTop = maxTop + coveredHeight;\n }\n\n for (var index = 0; index < data.length; index++) {\n var _rowData = data[index];\n var maxHeight = tableRowsMaxHeight[index];\n var shouldRender = shouldRenderExpandedRow(_rowData);\n var nextRowHeight = 0;\n\n if (typeof rowHeight === 'function') {\n nextRowHeight = rowHeight(_rowData);\n } else {\n nextRowHeight = maxHeight ? Math.max(maxHeight + _constants__WEBPACK_IMPORTED_MODULE_15__.CELL_PADDING_HEIGHT, rowHeight) : rowHeight;\n\n if (shouldRender) {\n nextRowHeight += rowExpandedHeight;\n }\n }\n\n contentHeight += nextRowHeight;\n var rowProps = {\n key: index,\n top: top,\n width: rowWidth,\n depth: _rowData[_constants__WEBPACK_IMPORTED_MODULE_15__.TREE_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 visibleRows.current.push(renderRowData(bodyCells, _rowData, rowProps, shouldRender));\n }\n } else {\n /** virtualized */\n // If the row height of the Table is fixed, it is directly calculated by the row height and the number of rows,\n // thereby reducing the performance cost of traversing all data.\n var _nextRowHeight = getRowHeight();\n\n var startIndex = Math.max(Math.floor(minTop / _nextRowHeight), 0);\n var endIndex = Math.min(startIndex + Math.ceil(bodyHeight / _nextRowHeight) + 5, data.length); // Avoid white screens on the top and bottom of the table when touching and scrolling on the mobile terminal.\n // So supplement the display data row.\n\n if ((0,_utils__WEBPACK_IMPORTED_MODULE_16__.isSupportTouchEvent)()) {\n var coveredCount = Math.floor(height / _nextRowHeight * 3);\n startIndex = Math.max(startIndex - coveredCount, 0);\n endIndex = Math.min(endIndex + coveredCount, data.length);\n }\n\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 _rowData2 = data[_index];\n var _rowProps = {\n key: _index,\n depth: _rowData2[_constants__WEBPACK_IMPORTED_MODULE_15__.TREE_DEPTH],\n top: _index * _nextRowHeight,\n width: rowWidth,\n height: _nextRowHeight\n };\n visibleRows.current.push(renderRowData(bodyCells, _rowData2, _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_2___default().createElement(\"div\", {\n ref: tableBodyRef,\n role: \"rowgroup\",\n className: prefix('body-row-wrapper'),\n style: bodyStyles,\n onScroll: onScrollBody\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", {\n style: wheelStyles,\n className: prefix('body-wheel-area'),\n ref: wheelWrapperRef\n }, topHideHeight ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Row__WEBPACK_IMPORTED_MODULE_8__.default, {\n style: topRowStyles,\n className: \"virtualized\"\n }) : null, visibleRows.current, bottomHideHeight ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Row__WEBPACK_IMPORTED_MODULE_8__.default, {\n style: bottomRowStyles,\n className: \"virtualized\"\n }) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_EmptyMessage__WEBPACK_IMPORTED_MODULE_13__.default, {\n locale: locale,\n renderEmpty: renderEmpty,\n addPrefix: prefix,\n loading: !!((_visibleRows$current = visibleRows.current) !== null && _visibleRows$current !== void 0 && _visibleRows$current.length) || loading\n }), renderScrollbar(), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_Loader__WEBPACK_IMPORTED_MODULE_12__.default, {\n locale: locale,\n loadAnimation: loadAnimation,\n loading: loading,\n addPrefix: prefix,\n renderLoading: renderLoading\n }));\n };\n\n var contextValue = react__WEBPACK_IMPORTED_MODULE_2___default().useMemo(function () {\n return {\n classPrefix: classPrefix,\n translateDOMPositionXY: translateDOMPositionXY.current,\n rtl: rtl,\n isTree: isTree,\n hasCustomTreeCol: hasCustomTreeCol\n };\n }, [classPrefix, hasCustomTreeCol, isTree, rtl]);\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_TableContext__WEBPACK_IMPORTED_MODULE_14__.default.Provider, {\n value: contextValue\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(\"div\", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.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\": colCounts.current,\n \"aria-busy\": loading\n }, rest, {\n className: classes,\n style: styles,\n ref: tableRef\n }), showHeader && renderTableHeader(headerCells, rowWidth), children && renderTableBody(bodyCells, rowWidth), showHeader && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement(_MouseArea__WEBPACK_IMPORTED_MODULE_11__.default, {\n ref: mouseAreaRef,\n addPrefix: prefix,\n headerHeight: headerHeight,\n height: getTableHeight()\n })));\n});\nTable.displayName = 'Table';\nTable.propTypes = {\n autoHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n fillHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n affixHeader: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number)]),\n affixHorizontalScrollbar: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number)]),\n bordered: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n className: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().string),\n classPrefix: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().string),\n children: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().any),\n cellBordered: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n data: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().array),\n defaultExpandAllRows: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n defaultExpandedRowKeys: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().array),\n defaultSortType: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().any),\n disabledScroll: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n expandedRowKeys: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().array),\n hover: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n height: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n headerHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n locale: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().object),\n loading: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n loadAnimation: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n minHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n rowKey: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().string), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number)]),\n rowHeight: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().number), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func)]),\n renderTreeToggle: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n renderRowExpanded: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n renderRow: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n rowExpandedHeight: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n renderEmpty: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n renderLoading: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n rowClassName: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().func), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().string)]),\n rtl: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n style: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().object),\n sortColumn: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().string),\n sortType: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().any),\n showHeader: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n shouldUpdateScroll: prop_types__WEBPACK_IMPORTED_MODULE_4___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_4___default().func), (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool)]),\n translate3d: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n wordWrap: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().any),\n width: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().number),\n virtualized: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n isTree: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().bool),\n onRowClick: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onRowContextMenu: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onScroll: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onSortColumn: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onExpandChange: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onTouchStart: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onTouchMove: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func),\n onTouchEnd: (prop_types__WEBPACK_IMPORTED_MODULE_4___default().func)\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (Table);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/Table.js?");
|
|
9413
9413
|
|
|
9414
9414
|
/***/ }),
|
|
9415
9415
|
|
|
@@ -9673,7 +9673,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac
|
|
|
9673
9673
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9674
9674
|
|
|
9675
9675
|
"use strict";
|
|
9676
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dom-lib/addStyle */ \"./node_modules/dom-lib/esm/addStyle.js\");\n/* harmony import */ var dom_lib_addClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/addClass */ \"./node_modules/dom-lib/esm/addClass.js\");\n/* harmony import */ var dom_lib_removeClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dom-lib/removeClass */ \"./node_modules/dom-lib/esm/removeClass.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _useControlled__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./useControlled */ \"./node_modules/rsuite-table/es/utils/useControlled.js\");\n/* harmony import */ var _getTableColumns__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./getTableColumns */ \"./node_modules/rsuite-table/es/utils/getTableColumns.js\");\n/* harmony import */ var _getTotalByColumns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./getTotalByColumns */ \"./node_modules/rsuite-table/es/utils/getTotalByColumns.js\");\n/* harmony import */ var _useUpdateEffect__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./useUpdateEffect */ \"./node_modules/rsuite-table/es/utils/useUpdateEffect.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Attach rendering-related attributes to all cells of the form and cache them.\n * @param props\n * @returns\n */\nvar useCellDescriptor = function useCellDescriptor(props) {\n var children = props.children,\n rtl = props.rtl,\n mouseAreaRef = props.mouseAreaRef,\n tableRef = props.tableRef,\n minScrollX = props.minScrollX,\n scrollX = props.scrollX,\n tableWidth = props.tableWidth,\n headerHeight = props.headerHeight,\n showHeader = props.showHeader,\n sortTypeProp = props.sortType,\n defaultSortType = props.defaultSortType,\n sortColumn = props.sortColumn,\n rowHeight = props.rowHeight,\n onSortColumn = props.onSortColumn,\n onHeaderCellResize = props.onHeaderCellResize,\n prefix = props.prefix;\n\n var _useControlled = (0,_useControlled__WEBPACK_IMPORTED_MODULE_8__.default)(sortTypeProp, defaultSortType),\n sortType = _useControlled[0],\n setSortType = _useControlled[1];\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(),\n cacheData = _useState[0],\n setCacheData = _useState[1];\n\n var clearCache = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {\n setCacheData(null);\n }, []);\n var setColumnResizing = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (resizing) {\n if (!tableRef.current) {\n return;\n }\n\n if (resizing) {\n (0,dom_lib_addClass__WEBPACK_IMPORTED_MODULE_3__.default)(tableRef.current, prefix('column-resizing'));\n } else {\n (0,dom_lib_removeClass__WEBPACK_IMPORTED_MODULE_4__.default)(tableRef.current, prefix('column-resizing'));\n }\n }, [prefix, tableRef]);\n var columnWidths = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)({});\n (0,_useUpdateEffect__WEBPACK_IMPORTED_MODULE_11__.default)(function () {\n clearCache();\n }, [children, sortColumn, sortType, tableWidth.current, scrollX.current, minScrollX.current]);\n var handleColumnResizeEnd = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (columnWidth, _cursorDelta, dataKey, index) {\n columnWidths.current[dataKey + \"_\" + index + \"_width\"] = columnWidth;\n setColumnResizing(false);\n\n if (mouseAreaRef.current) {\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__.default)(mouseAreaRef.current, {\n display: 'none'\n });\n }\n\n clearCache();\n onHeaderCellResize === null || onHeaderCellResize === void 0 ? void 0 : onHeaderCellResize(columnWidth, dataKey);\n }, [clearCache, mouseAreaRef, onHeaderCellResize, setColumnResizing]);\n var handleColumnResizeMove = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (width, left, fixed) {\n var mouseAreaLeft = width + left;\n var x = mouseAreaLeft;\n var dir = 'left';\n\n if (rtl) {\n mouseAreaLeft += minScrollX.current + _constants__WEBPACK_IMPORTED_MODULE_7__.SCROLLBAR_WIDTH;\n dir = 'right';\n }\n\n if (!fixed) {\n x = mouseAreaLeft + (rtl ? -scrollX.current : scrollX.current);\n }\n\n if (mouseAreaRef.current) {\n var _addStyle;\n\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__.default)(mouseAreaRef.current, (_addStyle = {\n display: 'block'\n }, _addStyle[dir] = x + \"px\", _addStyle));\n }\n }, [minScrollX, mouseAreaRef, rtl, scrollX]);\n var handleColumnResizeStart = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (width, left, fixed) {\n setColumnResizing(true);\n handleColumnResizeMove(width, left, fixed);\n }, [handleColumnResizeMove, setColumnResizing]);\n var handleSortColumn = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (dataKey) {\n var nextSortType = sortType;\n\n if (sortColumn === dataKey) {\n nextSortType = sortType === _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.ASC ? _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.DESC : _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.ASC;\n setSortType(nextSortType);\n }\n\n onSortColumn === null || onSortColumn === void 0 ? void 0 : onSortColumn(dataKey, nextSortType);\n }, [onSortColumn, setSortType, sortColumn, sortType]);\n\n if (cacheData) {\n return cacheData;\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 if (!children) {\n var _cacheCell = {\n columns: [],\n headerCells: headerCells,\n bodyCells: bodyCells,\n hasCustomTreeCol: hasCustomTreeCol,\n allColumnsWidth: left\n };\n setCacheData(_cacheCell);\n return _cacheCell;\n }\n\n var columns = (0,_getTableColumns__WEBPACK_IMPORTED_MODULE_9__.default)(children);\n var count = columns.length;\n\n var _getTotalByColumns = (0,_getTotalByColumns__WEBPACK_IMPORTED_MODULE_10__.default)(columns),\n totalFlexGrow = _getTotalByColumns.totalFlexGrow,\n totalWidth = _getTotalByColumns.totalWidth;\n\n react__WEBPACK_IMPORTED_MODULE_1___default().Children.forEach(columns, function (column, index) {\n if ( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().isValidElement(column)) {\n var _columnWidths$current;\n\n var columnChildren = column.props.children;\n var _column$props = column.props,\n _width = _column$props.width,\n resizable = _column$props.resizable,\n flexGrow = _column$props.flexGrow,\n minWidth = _column$props.minWidth,\n onResize = _column$props.onResize,\n treeCol = _column$props.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 headerCell = columnChildren[0];\n var cell = columnChildren[1];\n var cellWidth = ((_columnWidths$current = columnWidths.current) === null || _columnWidths$current === void 0 ? void 0 : _columnWidths$current[cell.props.dataKey + \"_\" + index + \"_width\"]) || _width || 0;\n\n if (tableWidth.current && flexGrow && totalFlexGrow) {\n cellWidth = Math.max((tableWidth.current - totalWidth) / totalFlexGrow * flexGrow, minWidth || 60);\n }\n\n var cellProps = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, lodash_omit__WEBPACK_IMPORTED_MODULE_5___default()(column.props, ['children']), {\n 'aria-colindex': index + 1,\n left: left,\n headerHeight: headerHeight,\n key: index,\n width: cellWidth,\n height: typeof rowHeight === 'function' ? rowHeight() : rowHeight,\n firstColumn: index === 0,\n lastColumn: index === count - 1\n });\n\n if (showHeader && headerHeight) {\n var headerCellProps = {\n // Resizable column\n // `index` is used to define the serial number when dragging the column width\n index: index,\n dataKey: cell.props.dataKey,\n isHeaderCell: true,\n minWidth: column.props.minWidth,\n sortable: column.props.sortable,\n onSortColumn: handleSortColumn,\n sortType: sortType,\n sortColumn: sortColumn,\n flexGrow: flexGrow\n };\n\n if (resizable) {\n lodash_merge__WEBPACK_IMPORTED_MODULE_6___default()(headerCellProps, {\n onResize: onResize,\n onColumnResizeEnd: handleColumnResizeEnd,\n onColumnResizeStart: handleColumnResizeStart,\n onColumnResizeMove: handleColumnResizeMove\n });\n }\n\n headerCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(headerCell, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, cellProps, headerCellProps)));\n }\n\n bodyCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(cell, cellProps));\n left += cellWidth;\n }\n });\n var cacheCell = {\n columns: columns,\n headerCells: headerCells,\n bodyCells: bodyCells,\n allColumnsWidth: left,\n hasCustomTreeCol: hasCustomTreeCol\n };\n setCacheData(cacheCell);\n return cacheCell;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (useCellDescriptor);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/utils/useCellDescriptor.js?");
|
|
9676
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dom-lib/addStyle */ \"./node_modules/dom-lib/esm/addStyle.js\");\n/* harmony import */ var dom_lib_addClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/addClass */ \"./node_modules/dom-lib/esm/addClass.js\");\n/* harmony import */ var dom_lib_removeClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! dom-lib/removeClass */ \"./node_modules/dom-lib/esm/removeClass.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/omit */ \"./node_modules/lodash/omit.js\");\n/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/merge */ \"./node_modules/lodash/merge.js\");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _useControlled__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./useControlled */ \"./node_modules/rsuite-table/es/utils/useControlled.js\");\n/* harmony import */ var _getTableColumns__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./getTableColumns */ \"./node_modules/rsuite-table/es/utils/getTableColumns.js\");\n/* harmony import */ var _getTotalByColumns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./getTotalByColumns */ \"./node_modules/rsuite-table/es/utils/getTotalByColumns.js\");\n/* harmony import */ var _useUpdateEffect__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./useUpdateEffect */ \"./node_modules/rsuite-table/es/utils/useUpdateEffect.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Attach rendering-related attributes to all cells of the form and cache them.\n * @param props\n * @returns\n */\nvar useCellDescriptor = function useCellDescriptor(props) {\n var children = props.children,\n rtl = props.rtl,\n mouseAreaRef = props.mouseAreaRef,\n tableRef = props.tableRef,\n minScrollX = props.minScrollX,\n scrollX = props.scrollX,\n tableWidth = props.tableWidth,\n headerHeight = props.headerHeight,\n showHeader = props.showHeader,\n sortTypeProp = props.sortType,\n defaultSortType = props.defaultSortType,\n sortColumn = props.sortColumn,\n rowHeight = props.rowHeight,\n onSortColumn = props.onSortColumn,\n onHeaderCellResize = props.onHeaderCellResize,\n prefix = props.prefix;\n\n var _useControlled = (0,_useControlled__WEBPACK_IMPORTED_MODULE_8__.default)(sortTypeProp, defaultSortType),\n sortType = _useControlled[0],\n setSortType = _useControlled[1];\n\n var _useState = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(),\n cacheData = _useState[0],\n setCacheData = _useState[1];\n\n var clearCache = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function () {\n setCacheData(null);\n }, []);\n var setColumnResizing = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (resizing) {\n if (!tableRef.current) {\n return;\n }\n\n if (resizing) {\n (0,dom_lib_addClass__WEBPACK_IMPORTED_MODULE_3__.default)(tableRef.current, prefix('column-resizing'));\n } else {\n (0,dom_lib_removeClass__WEBPACK_IMPORTED_MODULE_4__.default)(tableRef.current, prefix('column-resizing'));\n }\n }, [prefix, tableRef]);\n var columnWidths = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)({});\n (0,_useUpdateEffect__WEBPACK_IMPORTED_MODULE_11__.default)(function () {\n clearCache();\n }, [children, sortColumn, sortType, tableWidth.current, scrollX.current, minScrollX.current]);\n (0,_useUpdateEffect__WEBPACK_IMPORTED_MODULE_11__.default)(function () {\n columnWidths.current = {};\n }, [children]);\n var handleColumnResizeEnd = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (columnWidth, _cursorDelta, dataKey, index) {\n columnWidths.current[dataKey + \"_\" + index + \"_width\"] = columnWidth;\n setColumnResizing(false);\n\n if (mouseAreaRef.current) {\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__.default)(mouseAreaRef.current, {\n display: 'none'\n });\n }\n\n clearCache();\n onHeaderCellResize === null || onHeaderCellResize === void 0 ? void 0 : onHeaderCellResize(columnWidth, dataKey);\n }, [clearCache, mouseAreaRef, onHeaderCellResize, setColumnResizing]);\n var handleColumnResizeMove = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (width, left, fixed) {\n var mouseAreaLeft = width + left;\n var x = mouseAreaLeft;\n var dir = 'left';\n\n if (rtl) {\n mouseAreaLeft += minScrollX.current + _constants__WEBPACK_IMPORTED_MODULE_7__.SCROLLBAR_WIDTH;\n dir = 'right';\n }\n\n if (!fixed) {\n x = mouseAreaLeft + (rtl ? -scrollX.current : scrollX.current);\n }\n\n if (mouseAreaRef.current) {\n var _addStyle;\n\n (0,dom_lib_addStyle__WEBPACK_IMPORTED_MODULE_2__.default)(mouseAreaRef.current, (_addStyle = {\n display: 'block'\n }, _addStyle[dir] = x + \"px\", _addStyle));\n }\n }, [minScrollX, mouseAreaRef, rtl, scrollX]);\n var handleColumnResizeStart = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (width, left, fixed) {\n setColumnResizing(true);\n handleColumnResizeMove(width, left, fixed);\n }, [handleColumnResizeMove, setColumnResizing]);\n var handleSortColumn = (0,react__WEBPACK_IMPORTED_MODULE_1__.useCallback)(function (dataKey) {\n var nextSortType = sortType;\n\n if (sortColumn === dataKey) {\n nextSortType = sortType === _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.ASC ? _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.DESC : _constants__WEBPACK_IMPORTED_MODULE_7__.SORT_TYPE.ASC;\n setSortType(nextSortType);\n }\n\n onSortColumn === null || onSortColumn === void 0 ? void 0 : onSortColumn(dataKey, nextSortType);\n }, [onSortColumn, setSortType, sortColumn, sortType]);\n\n if (cacheData) {\n return cacheData;\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 if (!children) {\n var _cacheCell = {\n columns: [],\n headerCells: headerCells,\n bodyCells: bodyCells,\n hasCustomTreeCol: hasCustomTreeCol,\n allColumnsWidth: left\n };\n setCacheData(_cacheCell);\n return _cacheCell;\n }\n\n var columns = (0,_getTableColumns__WEBPACK_IMPORTED_MODULE_9__.default)(children);\n var count = columns.length;\n\n var _getTotalByColumns = (0,_getTotalByColumns__WEBPACK_IMPORTED_MODULE_10__.default)(columns),\n totalFlexGrow = _getTotalByColumns.totalFlexGrow,\n totalWidth = _getTotalByColumns.totalWidth;\n\n react__WEBPACK_IMPORTED_MODULE_1___default().Children.forEach(columns, function (column, index) {\n if ( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().isValidElement(column)) {\n var _columnWidths$current;\n\n var columnChildren = column.props.children;\n var _column$props = column.props,\n _width = _column$props.width,\n resizable = _column$props.resizable,\n flexGrow = _column$props.flexGrow,\n minWidth = _column$props.minWidth,\n onResize = _column$props.onResize,\n treeCol = _column$props.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 headerCell = columnChildren[0];\n var cell = columnChildren[1];\n var cellWidth = ((_columnWidths$current = columnWidths.current) === null || _columnWidths$current === void 0 ? void 0 : _columnWidths$current[cell.props.dataKey + \"_\" + index + \"_width\"]) || _width || 0;\n\n if (tableWidth.current && flexGrow && totalFlexGrow) {\n cellWidth = Math.max((tableWidth.current - totalWidth) / totalFlexGrow * flexGrow, minWidth || 60);\n }\n\n var cellProps = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, lodash_omit__WEBPACK_IMPORTED_MODULE_5___default()(column.props, ['children']), {\n 'aria-colindex': index + 1,\n left: left,\n headerHeight: headerHeight,\n key: index,\n width: cellWidth,\n height: typeof rowHeight === 'function' ? rowHeight() : rowHeight,\n firstColumn: index === 0,\n lastColumn: index === count - 1\n });\n\n if (showHeader && headerHeight) {\n var headerCellProps = {\n // Resizable column\n // `index` is used to define the serial number when dragging the column width\n index: index,\n dataKey: cell.props.dataKey,\n isHeaderCell: true,\n minWidth: column.props.minWidth,\n sortable: column.props.sortable,\n onSortColumn: handleSortColumn,\n sortType: sortType,\n sortColumn: sortColumn,\n flexGrow: flexGrow\n };\n\n if (resizable) {\n lodash_merge__WEBPACK_IMPORTED_MODULE_6___default()(headerCellProps, {\n onResize: onResize,\n onColumnResizeEnd: handleColumnResizeEnd,\n onColumnResizeStart: handleColumnResizeStart,\n onColumnResizeMove: handleColumnResizeMove\n });\n }\n\n headerCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(headerCell, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__.default)({}, cellProps, headerCellProps)));\n }\n\n bodyCells.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(cell, cellProps));\n left += cellWidth;\n }\n });\n var cacheCell = {\n columns: columns,\n headerCells: headerCells,\n bodyCells: bodyCells,\n allColumnsWidth: left,\n hasCustomTreeCol: hasCustomTreeCol\n };\n setCacheData(cacheCell);\n return cacheCell;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (useCellDescriptor);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/utils/useCellDescriptor.js?");
|
|
9677
9677
|
|
|
9678
9678
|
/***/ }),
|
|
9679
9679
|
|
|
@@ -9750,7 +9750,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var reac
|
|
|
9750
9750
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
9751
9751
|
|
|
9752
9752
|
"use strict";
|
|
9753
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var dom_lib_getWidth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dom-lib/getWidth */ \"./node_modules/dom-lib/esm/getWidth.js\");\n/* harmony import */ var dom_lib_getHeight__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dom-lib/getHeight */ \"./node_modules/dom-lib/esm/getHeight.js\");\n/* harmony import */ var dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/getOffset */ \"./node_modules/dom-lib/esm/getOffset.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _juggle_resize_observer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @juggle/resize-observer */ \"./node_modules/@juggle/resize-observer/lib/exports/resize-observer.js\");\n/* harmony import */ var _useMount__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./useMount */ \"./node_modules/rsuite-table/es/utils/useMount.js\");\n/* harmony import */ var _useUpdateLayoutEffect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./useUpdateLayoutEffect */ \"./node_modules/rsuite-table/es/utils/useUpdateLayoutEffect.js\");\n/* harmony import */ var _isNumberOrTrue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./isNumberOrTrue */ \"./node_modules/rsuite-table/es/utils/isNumberOrTrue.js\");\n\n\n\n\n\n\n\n\n\n\n/**\n * The dimension information of the table,\n * including the height, width, scrollable distance and the coordinates of the scroll handle, etc.\n * @param props\n * @returns\n */\nvar useTableDimension = function useTableDimension(props) {\n var data = props.data,\n rowHeight = props.rowHeight,\n tableRef = props.tableRef,\n headerWrapperRef = props.headerWrapperRef,\n prefix = props.prefix,\n widthProp = props.width,\n affixHeader = props.affixHeader,\n affixHorizontalScrollbar = props.affixHorizontalScrollbar,\n headerHeight = props.headerHeight,\n heightProp = props.height,\n autoHeight = props.autoHeight,\n minHeight = props.minHeight,\n fillHeight = props.fillHeight,\n children = props.children,\n expandedRowKeys = props.expandedRowKeys,\n onTableResizeChange = props.onTableResizeChange,\n onTableScroll = props.onTableScroll;\n var contentHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var contentWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var minScrollY = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var scrollY = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var scrollX = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var minScrollX = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var tableWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(widthProp || 0);\n var tableHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(heightProp || 0);\n var columnCount = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var resizeObserver = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();\n var containerResizeObserver = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();\n var headerOffset = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);\n var tableOffset = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);\n var getRowHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (rowData) {\n if (rowData === void 0) {\n rowData = {};\n }\n\n return typeof rowHeight === 'function' ? rowHeight(rowData) : rowHeight;\n }, [rowHeight]);\n var calculateTableContextHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {\n var prevContentHeight = contentHeight.current;\n var table = tableRef === null || tableRef === void 0 ? void 0 : tableRef.current;\n var rows = (table === null || table === void 0 ? void 0 : table.querySelectorAll(\".\" + (prefix === null || prefix === void 0 ? void 0 : prefix('row')))) || [];\n var nextContentHeight = rows.length ? Array.from(rows).map(function (row, index) {\n return (0,dom_lib_getHeight__WEBPACK_IMPORTED_MODULE_2__.default)(row) || getRowHeight(data === null || data === void 0 ? void 0 : data[index]);\n }).reduce(function (x, y) {\n return x + y;\n }) : 0; // After setting the affixHeader property, the height of the two headers should be subtracted.\n\n contentHeight.current = Math.round(nextContentHeight - (affixHeader ? headerHeight * 2 : headerHeight)); // Whether to show the horizontal scroll bar\n\n var hasHorizontalScrollbar = contentWidth.current > tableWidth.current; // The height of the table content area should be added to the height occupied by the horizontal scroll bar when autoHeight is set.\n\n if (autoHeight && hasHorizontalScrollbar) {\n contentHeight.current += _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH;\n }\n\n var height = fillHeight ? tableHeight.current : heightProp;\n\n if (!autoHeight) {\n /**\n * The purpose of subtracting SCROLLBAR_WIDTH is to keep the scroll bar from blocking the content part.\n * But it will only be calculated when there is a horizontal scroll bar (contentWidth > tableWidth).\n */\n minScrollY.current = -(nextContentHeight - height) - (hasHorizontalScrollbar ? _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH : 0);\n } // If the height of the content area is less than the height of the table, the vertical scroll bar is reset.\n\n\n if (nextContentHeight < height) {\n onTableScroll === null || onTableScroll === void 0 ? void 0 : onTableScroll({\n y: 0\n });\n } // If the value of scrollTop is greater than the scrollable range, the vertical scroll bar is reset.\n // When Table is set to virtualized, the logic will be entered every time the wheel event is triggered\n // to avoid resetting the scroll bar after scrolling to the bottom, so add the SCROLLBAR_WIDTH value.\n\n\n if (Math.abs(scrollY.current) + height - headerHeight > nextContentHeight + _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH) {\n onTableScroll === null || onTableScroll === void 0 ? void 0 : onTableScroll({\n y: scrollY.current\n });\n }\n\n if (prevContentHeight !== contentHeight.current) {\n onTableResizeChange === null || onTableResizeChange === void 0 ? void 0 : onTableResizeChange(prevContentHeight, 'bodyHeightChanged');\n }\n }, [tableRef, prefix, affixHeader, headerHeight, fillHeight, heightProp, autoHeight, getRowHeight, data, onTableScroll, onTableResizeChange]);\n var setOffsetByAffix = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {\n var headerNode = headerWrapperRef === null || headerWrapperRef === void 0 ? void 0 : headerWrapperRef.current;\n\n if ((0,_isNumberOrTrue__WEBPACK_IMPORTED_MODULE_8__.default)(affixHeader) && headerNode) {\n headerOffset.current = (0,dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_3__.default)(headerNode);\n }\n\n if ((0,_isNumberOrTrue__WEBPACK_IMPORTED_MODULE_8__.default)(affixHorizontalScrollbar) && tableRef !== null && tableRef !== void 0 && tableRef.current) {\n tableOffset.current = (0,dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_3__.default)(tableRef === null || tableRef === void 0 ? void 0 : tableRef.current);\n }\n }, [affixHeader, affixHorizontalScrollbar, headerWrapperRef, tableRef]);\n var calculateTableContentWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {\n var prevWidth = contentWidth.current;\n var prevColumnCount = columnCount.current;\n var table = tableRef === null || tableRef === void 0 ? void 0 : tableRef.current;\n var row = table === null || table === void 0 ? void 0 : table.querySelector(\".\" + prefix('row') + \":not(.virtualized)\");\n var nextContentWidth = row ? (0,dom_lib_getWidth__WEBPACK_IMPORTED_MODULE_1__.default)(row) : 0;\n contentWidth.current = nextContentWidth - (autoHeight ? _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH : 0);\n columnCount.current = (row === null || row === void 0 ? void 0 : row.querySelectorAll(\".\" + prefix('cell')).length) || 0; // The value of SCROLLBAR_WIDTH is subtracted so that the scroll bar does not block the content part.\n // There is no vertical scroll bar after autoHeight.\n\n minScrollX.current = -(nextContentWidth - tableWidth.current) - (autoHeight ? 0 : _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH);\n /**\n * If the width of the content area and the number of columns change,\n * the horizontal scroll bar is reset.\n * fix: https://github.com/rsuite/rsuite/issues/2039\n */\n\n if (prevWidth > 0 && prevWidth !== contentWidth.current && prevColumnCount > 0 && prevColumnCount !== columnCount.current) {\n onTableResizeChange === null || onTableResizeChange === void 0 ? void 0 : onTableResizeChange(prevWidth, 'bodyWidthChanged');\n }\n }, [autoHeight, onTableResizeChange, prefix, tableRef]);\n var calculateTableWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (nextWidth) {\n var prevWidth = tableWidth.current;\n\n if (tableRef !== null && tableRef !== void 0 && tableRef.current) {\n tableWidth.current = nextWidth || (0,dom_lib_getWidth__WEBPACK_IMPORTED_MODULE_1__.default)(tableRef === null || tableRef === void 0 ? void 0 : tableRef.current);\n }\n\n if (prevWidth && prevWidth !== tableWidth.current) {\n scrollX.current = 0;\n onTableResizeChange === null || onTableResizeChange === void 0 ? void 0 : onTableResizeChange(prevWidth, 'widthChanged');\n }\n\n setOffsetByAffix();\n }, [onTableResizeChange, setOffsetByAffix, tableRef]);\n var calculateTableHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (nextHeight) {\n var prevHeight = tableHeight.current;\n\n if (nextHeight) {\n tableHeight.current = nextHeight;\n } else if (tableRef !== null && tableRef !== void 0 && tableRef.current) {\n tableHeight.current = (0,dom_lib_getHeight__WEBPACK_IMPORTED_MODULE_2__.default)(tableRef.current.parentNode);\n }\n\n if (prevHeight && prevHeight !== tableHeight.current) {\n onTableResizeChange === null || onTableResizeChange === void 0 ? void 0 : onTableResizeChange(prevHeight, 'heightChanged');\n }\n }, [onTableResizeChange, tableRef]);\n (0,_useMount__WEBPACK_IMPORTED_MODULE_6__.default)(function () {\n var _tableRef$current;\n\n calculateTableContextHeight();\n calculateTableContentWidth();\n calculateTableWidth();\n calculateTableHeight();\n setOffsetByAffix();\n containerResizeObserver.current = new _juggle_resize_observer__WEBPACK_IMPORTED_MODULE_5__.ResizeObserver(function (entries) {\n calculateTableHeight(entries[0].contentRect.height);\n });\n containerResizeObserver.current.observe(tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.parentNode);\n resizeObserver.current = new _juggle_resize_observer__WEBPACK_IMPORTED_MODULE_5__.ResizeObserver(function (entries) {\n calculateTableWidth(entries[0].contentRect.width);\n });\n resizeObserver.current.observe(tableRef === null || tableRef === void 0 ? void 0 : tableRef.current);\n return function () {\n var _resizeObserver$curre, _containerResizeObser;\n\n (_resizeObserver$curre = resizeObserver.current) === null || _resizeObserver$curre === void 0 ? void 0 : _resizeObserver$curre.disconnect();\n (_containerResizeObser = containerResizeObserver.current) === null || _containerResizeObser === void 0 ? void 0 : _containerResizeObser.disconnect();\n };\n });\n (0,_useUpdateLayoutEffect__WEBPACK_IMPORTED_MODULE_7__.default)(function () {\n calculateTableHeight();\n calculateTableContextHeight();\n }, [fillHeight]);\n (0,_useUpdateLayoutEffect__WEBPACK_IMPORTED_MODULE_7__.default)(function () {\n calculateTableWidth();\n calculateTableContextHeight();\n calculateTableContentWidth();\n }, [data, heightProp, contentHeight, expandedRowKeys, children, calculateTableContextHeight, calculateTableContentWidth]);\n var setScrollY = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (value) {\n scrollY.current = value;\n }, []);\n var setScrollX = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (value) {\n scrollX.current = value;\n }, []);\n\n var getTableHeight = function getTableHeight() {\n if (fillHeight) {\n return tableHeight.current;\n }\n\n if ((data === null || data === void 0 ? void 0 : data.length) === 0 && autoHeight) {\n return heightProp;\n }\n\n return autoHeight ? Math.max(headerHeight + contentHeight.current, minHeight) : heightProp;\n };\n\n return {\n contentHeight: contentHeight,\n contentWidth: contentWidth,\n minScrollY: minScrollY,\n minScrollX: minScrollX,\n scrollY: scrollY,\n scrollX: scrollX,\n tableWidth: tableWidth,\n headerOffset: headerOffset,\n tableOffset: tableOffset,\n getTableHeight: getTableHeight,\n setScrollY: setScrollY,\n setScrollX: setScrollX\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (useTableDimension);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/utils/useTableDimension.js?");
|
|
9753
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var dom_lib_getWidth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dom-lib/getWidth */ \"./node_modules/dom-lib/esm/getWidth.js\");\n/* harmony import */ var dom_lib_getHeight__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dom-lib/getHeight */ \"./node_modules/dom-lib/esm/getHeight.js\");\n/* harmony import */ var dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dom-lib/getOffset */ \"./node_modules/dom-lib/esm/getOffset.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants */ \"./node_modules/rsuite-table/es/constants.js\");\n/* harmony import */ var _juggle_resize_observer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @juggle/resize-observer */ \"./node_modules/@juggle/resize-observer/lib/exports/resize-observer.js\");\n/* harmony import */ var _useMount__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./useMount */ \"./node_modules/rsuite-table/es/utils/useMount.js\");\n/* harmony import */ var _useUpdateLayoutEffect__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./useUpdateLayoutEffect */ \"./node_modules/rsuite-table/es/utils/useUpdateLayoutEffect.js\");\n/* harmony import */ var _isNumberOrTrue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./isNumberOrTrue */ \"./node_modules/rsuite-table/es/utils/isNumberOrTrue.js\");\n\n\n\n\n\n\n\n\n\n\n/**\n * The dimension information of the table,\n * including the height, width, scrollable distance and the coordinates of the scroll handle, etc.\n * @param props\n * @returns\n */\nvar useTableDimension = function useTableDimension(props) {\n var data = props.data,\n rowHeight = props.rowHeight,\n tableRef = props.tableRef,\n headerWrapperRef = props.headerWrapperRef,\n prefix = props.prefix,\n widthProp = props.width,\n affixHeader = props.affixHeader,\n affixHorizontalScrollbar = props.affixHorizontalScrollbar,\n headerHeight = props.headerHeight,\n heightProp = props.height,\n autoHeight = props.autoHeight,\n minHeight = props.minHeight,\n fillHeight = props.fillHeight,\n children = props.children,\n expandedRowKeys = props.expandedRowKeys,\n showHeader = props.showHeader,\n onTableResizeChange = props.onTableResizeChange,\n onTableScroll = props.onTableScroll;\n var contentHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var contentWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var minScrollY = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var scrollY = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var scrollX = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var minScrollX = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var tableWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(widthProp || 0);\n var tableHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(heightProp || 0);\n var columnCount = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);\n var resizeObserver = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();\n var containerResizeObserver = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();\n var headerOffset = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);\n var tableOffset = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);\n var getRowHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (rowData) {\n if (rowData === void 0) {\n rowData = {};\n }\n\n return typeof rowHeight === 'function' ? rowHeight(rowData) : rowHeight;\n }, [rowHeight]);\n var calculateTableContextHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {\n var _table$querySelectorA;\n\n var prevContentHeight = contentHeight.current;\n var table = tableRef === null || tableRef === void 0 ? void 0 : tableRef.current;\n var rows = (table === null || table === void 0 ? void 0 : table.querySelectorAll(\".\" + (prefix === null || prefix === void 0 ? void 0 : prefix('row')))) || [];\n var virtualized = (table === null || table === void 0 ? void 0 : (_table$querySelectorA = table.querySelectorAll('.virtualized')) === null || _table$querySelectorA === void 0 ? void 0 : _table$querySelectorA.length) > 0;\n var nextContentHeight = rows.length ? Array.from(rows).map(function (row, index) {\n return (0,dom_lib_getHeight__WEBPACK_IMPORTED_MODULE_2__.default)(row) || getRowHeight(data === null || data === void 0 ? void 0 : data[index]);\n }).reduce(function (x, y) {\n return x + y;\n }) : 0; // After setting the affixHeader property, the height of the two headers should be subtracted.\n\n contentHeight.current = Math.round(nextContentHeight - (affixHeader ? headerHeight * 2 : headerHeight)); // Whether to show the horizontal scroll bar\n\n var hasHorizontalScrollbar = contentWidth.current > tableWidth.current; // The height of the table content area should be added to the height occupied by the horizontal scroll bar when autoHeight is set.\n\n if (autoHeight && hasHorizontalScrollbar) {\n contentHeight.current += _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH;\n }\n\n var height = fillHeight ? tableHeight.current : heightProp;\n var tableBodyHeight = showHeader ? height - headerHeight : height;\n\n if (!autoHeight) {\n /**\n * The purpose of subtracting SCROLLBAR_WIDTH is to keep the scroll bar from blocking the content part.\n * But it will only be calculated when there is a horizontal scroll bar (contentWidth > tableWidth).\n */\n minScrollY.current = -(nextContentHeight - height) - (hasHorizontalScrollbar ? _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH : 0);\n } // If the height of the content area is less than the height of the table, the vertical scroll bar is reset.\n\n\n if (nextContentHeight < height) {\n onTableScroll === null || onTableScroll === void 0 ? void 0 : onTableScroll({\n y: 0\n });\n }\n\n var currentScrollTop = Math.abs(scrollY.current); // When Table is set to virtualized, the logic will be entered every time the wheel event is\n // triggered to avoid resetting the scroll bar after scrolling to the bottom, so add the SCROLLBAR_WIDTH value.\n\n var maxScrollTop = nextContentHeight + _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH - tableBodyHeight; // If the top value of the current scroll is greater than the scrollable range,\n // keep the vertical scroll bar at the bottom.\n\n if (maxScrollTop > 0 && currentScrollTop > maxScrollTop) {\n if (virtualized) {\n onTableScroll === null || onTableScroll === void 0 ? void 0 : onTableScroll({\n y: ((data === null || data === void 0 ? void 0 : data.length) || 0) * getRowHeight() - tableBodyHeight\n });\n } else {\n onTableScroll === null || onTableScroll === void 0 ? void 0 : onTableScroll({\n y: maxScrollTop\n });\n }\n }\n\n if (prevContentHeight !== contentHeight.current) {\n onTableResizeChange === null || onTableResizeChange === void 0 ? void 0 : onTableResizeChange(prevContentHeight, 'bodyHeightChanged');\n }\n }, [tableRef, prefix, affixHeader, headerHeight, autoHeight, fillHeight, heightProp, showHeader, getRowHeight, data, onTableScroll, onTableResizeChange]);\n var setOffsetByAffix = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {\n var headerNode = headerWrapperRef === null || headerWrapperRef === void 0 ? void 0 : headerWrapperRef.current;\n\n if ((0,_isNumberOrTrue__WEBPACK_IMPORTED_MODULE_8__.default)(affixHeader) && headerNode) {\n headerOffset.current = (0,dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_3__.default)(headerNode);\n }\n\n if ((0,_isNumberOrTrue__WEBPACK_IMPORTED_MODULE_8__.default)(affixHorizontalScrollbar) && tableRef !== null && tableRef !== void 0 && tableRef.current) {\n tableOffset.current = (0,dom_lib_getOffset__WEBPACK_IMPORTED_MODULE_3__.default)(tableRef === null || tableRef === void 0 ? void 0 : tableRef.current);\n }\n }, [affixHeader, affixHorizontalScrollbar, headerWrapperRef, tableRef]);\n var calculateTableContentWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {\n var prevWidth = contentWidth.current;\n var prevColumnCount = columnCount.current;\n var table = tableRef === null || tableRef === void 0 ? void 0 : tableRef.current;\n var row = table === null || table === void 0 ? void 0 : table.querySelector(\".\" + prefix('row') + \":not(.virtualized)\");\n var nextContentWidth = row ? (0,dom_lib_getWidth__WEBPACK_IMPORTED_MODULE_1__.default)(row) : 0;\n contentWidth.current = nextContentWidth - (autoHeight ? _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH : 0);\n columnCount.current = (row === null || row === void 0 ? void 0 : row.querySelectorAll(\".\" + prefix('cell')).length) || 0; // The value of SCROLLBAR_WIDTH is subtracted so that the scroll bar does not block the content part.\n // There is no vertical scroll bar after autoHeight.\n\n minScrollX.current = -(nextContentWidth - tableWidth.current) - (autoHeight ? 0 : _constants__WEBPACK_IMPORTED_MODULE_4__.SCROLLBAR_WIDTH);\n /**\n * If the width of the content area and the number of columns change,\n * the horizontal scroll bar is reset.\n * fix: https://github.com/rsuite/rsuite/issues/2039\n */\n\n if (prevWidth > 0 && prevWidth !== contentWidth.current && prevColumnCount > 0 && prevColumnCount !== columnCount.current) {\n onTableResizeChange === null || onTableResizeChange === void 0 ? void 0 : onTableResizeChange(prevWidth, 'bodyWidthChanged');\n }\n }, [autoHeight, onTableResizeChange, prefix, tableRef]);\n var calculateTableWidth = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (nextWidth) {\n var prevWidth = tableWidth.current;\n\n if (tableRef !== null && tableRef !== void 0 && tableRef.current) {\n tableWidth.current = nextWidth || (0,dom_lib_getWidth__WEBPACK_IMPORTED_MODULE_1__.default)(tableRef === null || tableRef === void 0 ? void 0 : tableRef.current);\n }\n\n if (prevWidth && prevWidth !== tableWidth.current) {\n scrollX.current = 0;\n onTableResizeChange === null || onTableResizeChange === void 0 ? void 0 : onTableResizeChange(prevWidth, 'widthChanged');\n }\n\n setOffsetByAffix();\n }, [onTableResizeChange, setOffsetByAffix, tableRef]);\n var calculateTableHeight = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (nextHeight) {\n var prevHeight = tableHeight.current;\n\n if (nextHeight) {\n tableHeight.current = nextHeight;\n } else if (tableRef !== null && tableRef !== void 0 && tableRef.current) {\n tableHeight.current = (0,dom_lib_getHeight__WEBPACK_IMPORTED_MODULE_2__.default)(tableRef.current.parentNode);\n }\n\n if (prevHeight && prevHeight !== tableHeight.current) {\n onTableResizeChange === null || onTableResizeChange === void 0 ? void 0 : onTableResizeChange(prevHeight, 'heightChanged');\n }\n }, [onTableResizeChange, tableRef]);\n (0,_useMount__WEBPACK_IMPORTED_MODULE_6__.default)(function () {\n var _tableRef$current;\n\n calculateTableContextHeight();\n calculateTableContentWidth();\n calculateTableWidth();\n calculateTableHeight();\n setOffsetByAffix();\n containerResizeObserver.current = new _juggle_resize_observer__WEBPACK_IMPORTED_MODULE_5__.ResizeObserver(function (entries) {\n calculateTableHeight(entries[0].contentRect.height);\n });\n containerResizeObserver.current.observe(tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.parentNode);\n resizeObserver.current = new _juggle_resize_observer__WEBPACK_IMPORTED_MODULE_5__.ResizeObserver(function (entries) {\n calculateTableWidth(entries[0].contentRect.width);\n });\n resizeObserver.current.observe(tableRef === null || tableRef === void 0 ? void 0 : tableRef.current);\n return function () {\n var _resizeObserver$curre, _containerResizeObser;\n\n (_resizeObserver$curre = resizeObserver.current) === null || _resizeObserver$curre === void 0 ? void 0 : _resizeObserver$curre.disconnect();\n (_containerResizeObser = containerResizeObserver.current) === null || _containerResizeObser === void 0 ? void 0 : _containerResizeObser.disconnect();\n };\n });\n (0,_useUpdateLayoutEffect__WEBPACK_IMPORTED_MODULE_7__.default)(function () {\n calculateTableHeight();\n calculateTableContextHeight();\n }, [fillHeight]);\n (0,_useUpdateLayoutEffect__WEBPACK_IMPORTED_MODULE_7__.default)(function () {\n calculateTableWidth();\n calculateTableContentWidth();\n calculateTableContextHeight();\n }, [data, heightProp, contentHeight.current, expandedRowKeys, children, calculateTableContextHeight, calculateTableContentWidth]);\n var setScrollY = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (value) {\n scrollY.current = value;\n }, []);\n var setScrollX = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (value) {\n scrollX.current = value;\n }, []);\n\n var getTableHeight = function getTableHeight() {\n if (fillHeight) {\n return tableHeight.current;\n }\n\n if ((data === null || data === void 0 ? void 0 : data.length) === 0 && autoHeight) {\n return heightProp;\n }\n\n return autoHeight ? Math.max(headerHeight + contentHeight.current, minHeight) : heightProp;\n };\n\n return {\n contentHeight: contentHeight,\n contentWidth: contentWidth,\n minScrollY: minScrollY,\n minScrollX: minScrollX,\n scrollY: scrollY,\n scrollX: scrollX,\n tableWidth: tableWidth,\n headerOffset: headerOffset,\n tableOffset: tableOffset,\n getTableHeight: getTableHeight,\n setScrollY: setScrollY,\n setScrollX: setScrollX\n };\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (useTableDimension);\n\n//# sourceURL=webpack://rsuite/./node_modules/rsuite-table/es/utils/useTableDimension.js?");
|
|
9754
9754
|
|
|
9755
9755
|
/***/ }),
|
|
9756
9756
|
|