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
1885c41c
Commit
1885c41c
authored
Jun 08, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update apolloTable textarea
parent
1f449005
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
2 deletions
+93
-2
index.less
...nts/apolloTable/component/base/detail/textarea/index.less
+28
-0
index.tsx
...ents/apolloTable/component/base/detail/textarea/index.tsx
+65
-2
No files found.
components/apolloTable/component/base/detail/textarea/index.less
0 → 100644
View file @
1885c41c
@import '../../../../common';
.container {
position: relative;
display: flex;
width: 100%;
height: 100%;
align-items: center;
.itemBgTxt {
position: absolute;
z-index: -1;
visibility: hidden;
}
}
.text {
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-all;
}
.tooltip {
//min-width: 500px;
.more {
margin-left: @marginGen;
color: @primaryColor;
}
}
components/apolloTable/component/base/detail/textarea/index.tsx
View file @
1885c41c
import
{
ApolloInputDetail
}
from
'../input'
;
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
;
import
classNames
from
'classnames'
;
import
{
Tooltip
}
from
'antd'
;
import
styles
from
'./index.less'
;
import
{
TextAreaProps
}
from
'../detailInterface'
;
export
const
ApolloTextAreaDetail
=
ApolloInputDetail
;
export
const
ApolloTextAreaDetail
=
(
props
:
TextAreaProps
)
=>
{
const
{
className
,
origin
,
componentAttr
,
rowData
,
formatter
}
=
props
;
const
formatValue
=
formatter
?
formatter
(
props
.
value
)
:
props
.
value
;
if
(
!
formatValue
)
{
return
null
;
}
const
[
value
,
setValue
]
=
useState
(
formatValue
);
const
{
cutLength
,
getDetail
}
=
componentAttr
;
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
getMore
=
async
()
=>
{
let
newValue
=
await
getDetail
({
rowId
:
rowData
.
id
});
if
(
newValue
)
{
newValue
=
formatter
?
formatter
(
newValue
)
:
newValue
;
setValue
(
newValue
);
}
};
if
(
origin
===
'detailForm'
)
{
return
<
div
className=
{
classNames
(
styles
.
text
,
className
)
}
>
{
value
}
</
div
>;
}
if
(
typeof
value
===
'string'
)
{
return
(
<
div
className=
{
styles
.
container
}
ref=
{
container
}
>
{
dotVisible
?
(
<
Tooltip
title=
{
<
div
className=
{
styles
.
tooltip
}
>
{
value
}
{
value
.
length
===
cutLength
&&
<
span
className=
{
styles
.
more
}
onClick=
{
getMore
}
>
查看更多
</
span
>
}
</
div
>
}
>
<
div
className=
{
classNames
(
styles
.
text
,
className
)
}
>
{
value
}
</
div
>
</
Tooltip
>
)
:
(
<
div
className=
{
classNames
(
styles
.
text
,
className
)
}
>
{
value
}
</
div
>
)
}
<
div
className=
{
styles
.
itemBgTxt
}
ref=
{
dom
}
>
{
value
}
</
div
>
</
div
>
);
}
return
'数据错误'
;
};
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