diff --git a/components/apolloTable/component/base/detail/date/index.tsx b/components/apolloTable/component/base/detail/date/index.tsx index 0e03fb15a6c51ae0369dda81550cff390ea924f4..b551e366273cb8700a92f8dfaf13679ac9b011fb 100644 --- a/components/apolloTable/component/base/detail/date/index.tsx +++ b/components/apolloTable/component/base/detail/date/index.tsx @@ -1,13 +1,29 @@ -import React from 'react'; +import React, { useEffect, useRef, useState } from 'react'; +import { Tooltip } from 'antd'; +import classNames from 'classnames'; import { formatStr } from '../../_utils/setFormatter'; -import s from '../input/index.less'; import { DateProps } from '../detailInterface'; +import styles from '../input/index.less'; + export const ApolloDateDetail = (props: DateProps) => { - const { value, formatter, componentAttr } = props; + const { value, formatter, componentAttr, className } = props; const formatValue = formatter ? formatter(value) : value; if (!formatValue) return null; - + const [dotVisible, setDotVisible] = useState(false); + const container = useRef(null); + const dom = useRef(null); + useEffect(() => { + const containerTarget: any = container.current; + const target: any = dom.current; + if (containerTarget && target) { + if (target.clientWidth > containerTarget.clientWidth) { + setDotVisible(true); + } else { + setDotVisible(false); + } + } + }, [value]); const { format = formatStr } = componentAttr || {}; let valueStr = ''; @@ -16,5 +32,18 @@ export const ApolloDateDetail = (props: DateProps) => { } else { valueStr = formatValue.format ? formatValue.format(format) : formatValue; } - return