minishouyin/node_modules/antd/es/typography/hooks/useTooltipProps.js

22 lines
649 B
JavaScript
Raw Normal View History

2025-11-12 11:35:57 +08:00
import { isValidElement, useMemo } from 'react';
const useTooltipProps = (tooltip, editConfigText, children) => useMemo(() => {
if (tooltip === true) {
return {
title: editConfigText !== null && editConfigText !== void 0 ? editConfigText : children
};
}
if (/*#__PURE__*/isValidElement(tooltip)) {
return {
title: tooltip
};
}
if (typeof tooltip === 'object') {
return Object.assign({
title: editConfigText !== null && editConfigText !== void 0 ? editConfigText : children
}, tooltip);
}
return {
title: tooltip
};
}, [tooltip, editConfigText, children]);
export default useTooltipProps;