Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
submodule
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web_component
submodule
Commits
1f449005
Commit
1f449005
authored
Jun 08, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update apolloTable date detail
parent
dc692ba3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
5 deletions
+34
-5
index.tsx
components/apolloTable/component/base/detail/date/index.tsx
+34
-5
No files found.
components/apolloTable/component/base/detail/date/index.tsx
View file @
1f449005
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
<
div
className=
{
s
.
text
}
>
{
valueStr
}
</
div
>;
return
(
<
div
className=
{
styles
.
container
}
ref=
{
container
}
>
{
dotVisible
?
(
<
Tooltip
title=
{
valueStr
}
>
<
div
className=
{
classNames
(
styles
.
text
,
className
)
}
>
{
valueStr
}
</
div
>
</
Tooltip
>
)
:
(
<
div
className=
{
classNames
(
styles
.
text
,
className
)
}
>
{
valueStr
}
</
div
>
)
}
<
div
className=
{
styles
.
itemBgTxt
}
ref=
{
dom
}
>
{
valueStr
}
</
div
>
</
div
>
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment