UNPKG

tdesign-react

Version:
57 lines (53 loc) 2.26 kB
/** * tdesign v1.15.1 * (c) 2025 tdesign * @license MIT */ import { _ as _defineProperty } from '../../_chunks/dep-cb0a3966.js'; import React from 'react'; import classNames from 'classnames'; import { ChevronLeftIcon, ChevronRightIcon } from 'tdesign-icons-react'; import useConfig from '../../hooks/useConfig.js'; import useGlobalIcon from '../../hooks/useGlobalIcon.js'; import '../../_chunks/dep-eca3a3de.js'; import '../../config-provider/ConfigContext.js'; import 'lodash-es'; import '../../_chunks/dep-f97636ce.js'; import '../../_chunks/dep-9dbbf468.js'; import 'dayjs'; function usePrevNextJumper(props) { var _useConfig = useConfig(), classPrefix = _useConfig.classPrefix; var _useGlobalIcon = useGlobalIcon({ ChevronLeftIcon: ChevronLeftIcon, ChevronRightIcon: ChevronRightIcon }), ChevronLeftIcon$1 = _useGlobalIcon.ChevronLeftIcon, ChevronRightIcon$1 = _useGlobalIcon.ChevronRightIcon; var name = "".concat(classPrefix, "-pagination"); var showPreviousAndNextBtn = props.showPreviousAndNextBtn, disabled = props.disabled, current = props.current, pageCount = props.pageCount, changeCurrent = props.changeCurrent; var prevJumper = showPreviousAndNextBtn && /* @__PURE__ */React.createElement("div", { className: classNames("".concat(name, "__btn"), "".concat(name, "__btn-prev"), _defineProperty({}, "".concat(classPrefix, "-is-disabled"), disabled || current === 1)), onClick: function onClick() { if (disabled || current === 1) return; changeCurrent(current - 1); } }, /* @__PURE__ */React.createElement(ChevronLeftIcon$1, null)); var nextJumper = showPreviousAndNextBtn && /* @__PURE__ */React.createElement("div", { className: classNames("".concat(name, "__btn"), "".concat(name, "__btn-next"), _defineProperty({}, "".concat(classPrefix, "-is-disabled"), disabled || current === pageCount)), onClick: function onClick() { if (disabled || current === pageCount) return; changeCurrent(current + 1); } }, /* @__PURE__ */React.createElement(ChevronRightIcon$1, null)); return { prevJumper: prevJumper, nextJumper: nextJumper }; } export { usePrevNextJumper as default }; //# sourceMappingURL=usePrevNextJumper.js.map