UNPKG

@schema-render/search-table-react

Version:
19 lines (18 loc) 624 B
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { Tooltip } from "antd"; import { isEmpty } from "../utils/common"; const LongText = ({ value, options = {} })=>{ const text = isEmpty(value) ? '-' : String(value); const { maxLength = 10, ...tooltipProps } = options; return text.length > maxLength ? /*#__PURE__*/ _jsxs(Tooltip, { title: text, ...tooltipProps, children: [ text.slice(0, maxLength - 1), "..." ] }) : /*#__PURE__*/ _jsx(_Fragment, { children: text }); }; export default LongText;