UNPKG

tdesign-react

Version:
166 lines (162 loc) 5.67 kB
/** * tdesign v1.13.2 * (c) 2025 tdesign * @license MIT */ import { _ as _defineProperty } from '../_chunks/dep-8618a2f1.js'; import React, { forwardRef, useMemo } from 'react'; import classNames from 'classnames'; import { isObject } from 'lodash-es'; import { RoundIcon, ChevronUpIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'tdesign-icons-react'; import useConfig from '../hooks/useConfig.js'; import useGlobalIcon from '../hooks/useGlobalIcon.js'; import { Button } from '../button/index.js'; import { paginationMiniDefaultProps } from './defaultProps.js'; import noop from '../_util/noop.js'; import useDefaultProps from '../hooks/useDefaultProps.js'; import '../_chunks/dep-c37cc2fd.js'; import '../config-provider/ConfigContext.js'; import '../locale/zh_CN.js'; import '../_chunks/dep-ab140eb0.js'; import 'dayjs'; import '../_chunks/dep-95bd7102.js'; import '../button/Button.js'; import '../_chunks/dep-118954e6.js'; import '../_chunks/dep-61f5e3d1.js'; import '../_chunks/dep-30ed04a0.js'; import '../hooks/useDomRefCallback.js'; import '../hooks/useRipple.js'; import '../_chunks/dep-fab491d8.js'; import '../hooks/useAnimation.js'; import '../_chunks/dep-82b8abc2.js'; import '../loading/index.js'; import '../loading/Loading.js'; import '../common/Portal.js'; import 'react-dom'; import '../hooks/useLayoutEffect.js'; import '../loading/gradient.js'; import '../_chunks/dep-f213e3a9.js'; import '../_chunks/dep-132961ab.js'; import '../loading/defaultProps.js'; import '../loading/plugin.js'; import '../_util/react-render.js'; import '../_chunks/dep-1aea5672.js'; import '../common/PluginContainer.js'; import '../config-provider/index.js'; import '../config-provider/ConfigProvider.js'; import '../config-provider/type.js'; import '../loading/style/index.js'; import '../loading/type.js'; import '../button/defaultProps.js'; import '../_util/parseTNode.js'; import '../_chunks/dep-4e5b1475.js'; import '../_chunks/dep-d104053f.js'; import '../button/style/index.js'; import '../button/type.js'; var PaginationMini = /*#__PURE__*/forwardRef(function (props, ref) { var _useConfig = useConfig(), classPrefix = _useConfig.classPrefix; var _useGlobalIcon = useGlobalIcon({ RoundIcon: RoundIcon, ChevronUpIcon: ChevronUpIcon, ChevronDownIcon: ChevronDownIcon, ChevronLeftIcon: ChevronLeftIcon, ChevronRightIcon: ChevronRightIcon }), RoundIcon$1 = _useGlobalIcon.RoundIcon, ChevronUpIcon$1 = _useGlobalIcon.ChevronUpIcon, ChevronDownIcon$1 = _useGlobalIcon.ChevronDownIcon, ChevronLeftIcon$1 = _useGlobalIcon.ChevronLeftIcon, ChevronRightIcon$1 = _useGlobalIcon.ChevronRightIcon; var _useDefaultProps = useDefaultProps(props, paginationMiniDefaultProps), variant = _useDefaultProps.variant, tips = _useDefaultProps.tips, showCurrent = _useDefaultProps.showCurrent, disabled = _useDefaultProps.disabled, layout = _useDefaultProps.layout, size = _useDefaultProps.size, _useDefaultProps$onCh = _useDefaultProps.onChange, onChange = _useDefaultProps$onCh === void 0 ? noop : _useDefaultProps$onCh, className = _useDefaultProps.className, style = _useDefaultProps.style; var titleConfig = useMemo(function () { if (isObject(tips)) { return tips; } if (tips === true) { return { prev: "\u4E0A\u4E00\u9875", current: "\u5F53\u524D", next: "\u4E0B\u4E00\u9875" }; } return {}; }, [tips]); var disabledConfig = useMemo(function () { if (isObject(disabled)) { return disabled; } if (disabled === true) { return { prev: true, current: true, next: true }; } return { prev: false, current: false, next: false }; }, [disabled]); return /* @__PURE__ */React.createElement("div", { className: classNames("".concat(classPrefix, "-pagination-mini"), className, _defineProperty({}, "".concat(classPrefix, "-pagination-mini--outline"), variant === "outline")), ref: ref, style: style }, /* @__PURE__ */React.createElement(Button, { title: titleConfig.prev, variant: variant, size: size, shape: "square", onClick: function onClick(e) { return onChange({ e: e, trigger: "prev" }); }, icon: layout === "horizontal" ? /* @__PURE__ */React.createElement(ChevronLeftIcon$1, null) : /* @__PURE__ */React.createElement(ChevronUpIcon$1, null), className: "".concat(classPrefix, "-pagination-mini__prev"), disabled: disabledConfig.prev }), showCurrent && /* @__PURE__ */React.createElement(Button, { title: titleConfig.current, variant: variant, size: size, shape: "square", onClick: function onClick(e) { return onChange({ e: e, trigger: "current" }); }, icon: /* @__PURE__ */React.createElement(RoundIcon$1, null), className: "".concat(classPrefix, "-pagination-mini__current"), disabled: disabledConfig.current }), /* @__PURE__ */React.createElement(Button, { title: titleConfig.next, variant: variant, size: size, shape: "square", onClick: function onClick(e) { return onChange({ e: e, trigger: "next" }); }, icon: layout === "horizontal" ? /* @__PURE__ */React.createElement(ChevronRightIcon$1, null) : /* @__PURE__ */React.createElement(ChevronDownIcon$1, null), className: "".concat(classPrefix, "-pagination-mini__next"), disabled: disabledConfig.next })); }); PaginationMini.displayName = "PaginationMini"; export { PaginationMini as default }; //# sourceMappingURL=PaginationMini.js.map