1 line
57 KiB
JSON
1 line
57 KiB
JSON
|
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport warning from \"rc-util/es/warning\";\nimport React, { useEffect } from 'react';\nimport zhCN from \"./locale/zh_CN\";\nimport Options from \"./Options\";\nimport Pager from \"./Pager\";\nvar defaultItemRender = function defaultItemRender(page, type, element) {\n return element;\n};\nfunction noop() {}\nfunction isInteger(v) {\n var value = Number(v);\n return typeof value === 'number' && !Number.isNaN(value) && isFinite(value) && Math.floor(value) === value;\n}\nfunction calculatePage(p, pageSize, total) {\n var _pageSize = typeof p === 'undefined' ? pageSize : p;\n return Math.floor((total - 1) / _pageSize) + 1;\n}\nvar Pagination = function Pagination(props) {\n var _classNames5;\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-pagination' : _props$prefixCls,\n _props$selectPrefixCl = props.selectPrefixCls,\n selectPrefixCls = _props$selectPrefixCl === void 0 ? 'rc-select' : _props$selectPrefixCl,\n className = props.className,\n selectComponentClass = props.selectComponentClass,\n currentProp = props.current,\n _props$defaultCurrent = props.defaultCurrent,\n defaultCurrent = _props$defaultCurrent === void 0 ? 1 : _props$defaultCurrent,\n _props$total = props.total,\n total = _props$total === void 0 ? 0 : _props$total,\n pageSizeProp = props.pageSize,\n _props$defaultPageSiz = props.defaultPageSize,\n defaultPageSize = _props$defaultPageSiz === void 0 ? 10 : _props$defaultPageSiz,\n _props$onChange = props.onChange,\n onChange = _props$onChange === void 0 ? noop : _props$onChange,\n hideOnSinglePage = props.hideOnSinglePage,\n align = props.align,\n _props$showPrevNextJu = props.showPrevNextJumpers,\n showPrevNextJumpers = _props$showPrevNextJu === void 0 ? true : _props$showPrevNextJu,\n showQuickJumper = props.showQuickJumper,\n showLessItems = props.showLessItems,\n _props$showTitle = props.showTitle,\n showTitle = _props$showTitle === void 0 ? true : _props$showTitle,\n _props$onShowSizeChan = props.onShowSizeChange,\n onShowSizeChange = _props$onShowSizeChan === void 0 ? noop : _props$onShowSizeChan,\n _props$locale = props.locale,\n locale = _props$locale === void 0 ? zhCN : _props$locale,\n style = props.style,\n _props$totalBoundaryS = props.totalBoundaryShowSizeChanger,\n totalBoundaryShowSizeChanger = _props$totalBoundaryS === void 0 ? 50 : _props$totalBoundaryS,\n disabled = props.disabled,\n simple = props.simple,\n showTotal = props.showTotal,\n showSizeChangerProp = props.showSizeChanger,\n pageSizeOptions = props.pageSizeOptions,\n _props$itemRender = props.itemRender,\n itemRender = _props$itemRender === void 0 ? defaultItemRender : _props$itemRender,\n jumpPrevIcon = props.jumpPrevIcon,\n jumpNextIcon = props.jumpNextIcon,\n prevIcon = props.prevIcon,\n nextIcon = props.nextIcon;\n var paginationRef = React.useRef(null);\n var _useMergedState = useMergedState(10, {\n value: pageSizeProp,\n defaultValue: defaultPageSize\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n pageSize = _useMergedState2[0],\n setPageSize = _useMergedState2[1];\n var _useMergedState3 = useMergedState(1, {\n value: currentProp,\n defaultValue: defaultCurrent,\n postState: function postState(c) {\n return Math.max(1, Math.min(c, calculatePage(undefined, pageSize, total)));\n }\n }),\n _useMergedState4 = _slicedToArray(_useMergedSta
|