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
d1a71d13
Commit
d1a71d13
authored
Jun 09, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update apolloTable textarea
parent
a0a4fe78
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
28 deletions
+102
-28
config.tsx
components/apolloTable/component/base/config.tsx
+1
-1
index.less
...nts/apolloTable/component/base/detail/textarea/index.less
+5
-1
index.tsx
...ents/apolloTable/component/base/detail/textarea/index.tsx
+2
-1
index.tsx
...onents/apolloTable/component/base/edit/textarea/index.tsx
+79
-20
styles.less
...ents/apolloTable/component/base/edit/textarea/styles.less
+13
-3
index.tsx
components/apolloTable/editForm/index.tsx
+1
-1
index.tsx
components/apolloTable/editFormV3/index.tsx
+1
-1
No files found.
components/apolloTable/component/base/config.tsx
View file @
d1a71d13
...
@@ -79,7 +79,7 @@ export const config: any = {
...
@@ -79,7 +79,7 @@ export const config: any = {
3
:
{
3
:
{
name
:
'多行文本'
,
name
:
'多行文本'
,
editComp
:
ApolloTextArea
,
editComp
:
ApolloTextArea
,
cellComp
:
CellContainer
(
ApolloTextArea
)
,
cellComp
:
ApolloTextArea
,
getFormatter
:
GetFormatter
.
TEXTAREA
,
getFormatter
:
GetFormatter
.
TEXTAREA
,
setFormatter
:
SetFormatter
.
TEXTAREA
,
setFormatter
:
SetFormatter
.
TEXTAREA
,
componentAttr
:
{
componentAttr
:
{
...
...
components/apolloTable/component/base/detail/textarea/index.less
View file @
d1a71d13
...
@@ -19,7 +19,11 @@
...
@@ -19,7 +19,11 @@
text-overflow: ellipsis;
text-overflow: ellipsis;
word-break: break-all;
word-break: break-all;
}
}
.tooltip {
.tooltip{
max-height: 300px;
overflow: auto;
}
.tooltipTitle {
//min-width: 500px;
//min-width: 500px;
.more {
.more {
margin-left: @marginGen;
margin-left: @marginGen;
...
...
components/apolloTable/component/base/detail/textarea/index.tsx
View file @
d1a71d13
...
@@ -44,8 +44,9 @@ export const ApolloTextAreaDetail = (props: TextAreaProps) => {
...
@@ -44,8 +44,9 @@ export const ApolloTextAreaDetail = (props: TextAreaProps) => {
<
div
className=
{
styles
.
container
}
ref=
{
container
}
>
<
div
className=
{
styles
.
container
}
ref=
{
container
}
>
{
dotVisible
?
(
{
dotVisible
?
(
<
Tooltip
<
Tooltip
overlayClassName=
{
styles
.
tooltip
}
title=
{
title=
{
<
div
className=
{
styles
.
tooltip
}
>
<
div
className=
{
styles
.
tooltip
Title
}
>
{
value
}
{
value
}
{
value
.
length
===
cutLength
&&
<
span
className=
{
styles
.
more
}
onClick=
{
getMore
}
>
查看更多
</
span
>
}
{
value
.
length
===
cutLength
&&
<
span
className=
{
styles
.
more
}
onClick=
{
getMore
}
>
查看更多
</
span
>
}
</
div
>
</
div
>
...
...
components/apolloTable/component/base/edit/textarea/index.tsx
View file @
d1a71d13
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Input
}
from
'antd'
;
import
{
Input
,
Modal
}
from
'antd'
;
import
styles
from
'./styles.less'
;
import
styles
from
'./styles.less'
;
import
{
antiAssign
}
from
'../../../../utils/utils'
;
import
{
antiAssign
}
from
'../../../../utils/utils'
;
import
{
ApolloTextAreaProps
}
from
'../editInterface'
;
import
{
ApolloTextAreaProps
}
from
'../editInterface'
;
import
{
Consumer
}
from
'../../../context'
;
import
{
Consumer
}
from
'../../../context'
;
export
const
ApolloTextArea
=
(
props
:
ApolloTextAreaProps
)
=>
{
export
const
ApolloTextArea
=
(
props
:
ApolloTextAreaProps
)
=>
{
const
{
maxLength
,
onChange
,
value
,
cutLength
,
getDetail
,
rowData
}
=
props
;
const
{
maxLength
,
onChange
,
value
,
cutLength
,
getDetail
,
rowData
,
onEmitChange
,
columnConfig
,
origin
}
=
props
;
const
selfProps
=
antiAssign
(
props
,
[
'columnConfig'
,
'onChange'
,
'value'
]);
const
{
columnChsName
}
=
columnConfig
;
const
selfProps
=
antiAssign
(
props
,
[
'columnConfig'
,
'onChange'
,
'value'
,
'cutLength'
,
'getDetail'
,
'rowData'
,
'onEmitChange'
]);
const
[
curValue
,
setCurValue
]
=
useState
(
value
);
const
[
curValue
,
setCurValue
]
=
useState
(
value
);
const
[
visible
,
setVisible
]
=
useState
(
false
);
useEffect
(()
=>
{
useEffect
(()
=>
{
setCurValue
(
value
);
if
(
origin
!==
'editForm'
)
{
},
[
value
]);
setCurValue
(
value
);
useEffect
(()
=>
{
if
(
value
&&
value
.
length
===
cutLength
)
{
getMore
();
getMore
();
}
}
},
[]);
},
[
value
]);
// useEffect(() => {
// if (value && value.length === cutLength) {
// getMore();
// }
// }, []);
const
changeValue
=
(
e
)
=>
{
const
changeValue
=
(
e
)
=>
{
if
(
typeof
onChange
===
'function'
)
{
if
(
typeof
onChange
===
'function'
)
{
...
@@ -24,30 +29,84 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => {
...
@@ -24,30 +29,84 @@ export const ApolloTextArea = (props: ApolloTextAreaProps) => {
}
}
};
};
const
changeCurValue
=
(
e
)
=>
{
if
(
typeof
onChange
===
'function'
)
{
setCurValue
(
e
.
target
.
value
);
}
};
const
hide
=
()
=>
{
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
value
);
}
setVisible
(
false
);
}
const
confirmChange
=
()
=>
{
if
(
typeof
onEmitChange
===
'function'
)
{
onEmitChange
(
curValue
);
}
setVisible
(
false
);
}
const
getMore
=
async
()
=>
{
const
getMore
=
async
()
=>
{
let
newValue
=
await
getDetail
({
rowId
:
rowData
.
id
});
if
(
getDetail
&&
rowData
)
{
if
(
newValue
)
{
let
newValue
=
await
getDetail
({
rowId
:
rowData
.
id
});
newValue
=
newValue
[
0
]
&&
newValue
[
0
].
value
;
if
(
newValue
)
{
setCurValue
(
newValue
);
newValue
=
newValue
[
0
]
&&
newValue
[
0
].
value
;
setCurValue
(
newValue
);
setVisible
(
true
);
}
}
}
};
};
if
(
origin
===
'editForm'
)
{
return
(
<
Consumer
>
{
({
locale
})
=>
{
return
(
<
div
className=
{
styles
.
container
}
>
<
Input
.
TextArea
className=
{
styles
.
inputForm
}
{
...
selfProps
}
value=
{
value
}
onChange=
{
changeValue
}
/>
{
!!
maxLength
&&
(
<
span
className=
{
styles
.
wordNumberForm
}
>
{
`${locale.alreadyInput} ${(value || '').length}/${maxLength}`
}
</
span
>
)
}
</
div
>
);
}
}
</
Consumer
>
)
}
return
(
return
(
<
Consumer
>
<
Consumer
>
{
({
locale
})
=>
{
{
({
locale
})
=>
{
return
(
return
(
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
container
}
>
<
Input
.
TextArea
<
Input
className=
{
styles
.
input
}
{
...
selfProps
}
{
...
selfProps
}
value=
{
curV
alue
}
value=
{
v
alue
}
onChange=
{
changeValue
}
onChange=
{
changeValue
}
/>
/>
{
!!
maxLength
&&
(
<
Modal
visible=
{
visible
}
title=
{
columnChsName
}
onCancel=
{
hide
}
onOk=
{
confirmChange
}
>
<
span
className=
{
styles
.
wordNumber
}
>
<
Input
.
TextArea
{
`${locale.alreadyInput} ${(curValue || '').length}/${maxLength}`
}
className=
{
styles
.
input
}
</
span
>
{
...
selfProps
}
)
}
value=
{
curValue
}
onChange=
{
changeCurValue
}
/>
{
!!
maxLength
&&
(
<
span
className=
{
styles
.
wordNumber
}
>
{
`${locale.alreadyInput} ${(curValue || '').length}/${maxLength}`
}
</
span
>
)
}
</
Modal
>
</
div
>
</
div
>
);
);
}
}
}
}
...
...
components/apolloTable/component/base/edit/textarea/styles.less
View file @
d1a71d13
...
@@ -2,11 +2,10 @@
...
@@ -2,11 +2,10 @@
position: relative;
position: relative;
top: 0;
top: 0;
left: 0;
left: 0;
.input
{
.input
Form
{
padding-bottom: 18px;
padding-bottom: 18px;
max-height: 500px !important;
}
}
.wordNumber {
.wordNumber
Form
{
position: absolute;
position: absolute;
right: 20px;
right: 20px;
bottom: 2px;
bottom: 2px;
...
@@ -14,3 +13,14 @@
...
@@ -14,3 +13,14 @@
font-size: 12px;
font-size: 12px;
}
}
}
}
.input {
padding-bottom: 18px;
max-height: 500px !important;
}
.wordNumber {
position: absolute;
right: 35px;
bottom: 80px;
color: #e1e1e1;
font-size: 12px;
}
\ No newline at end of file
components/apolloTable/editForm/index.tsx
View file @
d1a71d13
...
@@ -59,7 +59,7 @@ const EditForm = (props: any) => {
...
@@ -59,7 +59,7 @@ const EditForm = (props: any) => {
validateFirst=
{
validateFirst
}
validateFirst=
{
validateFirst
}
validateTrigger=
{
validateTrigger
}
validateTrigger=
{
validateTrigger
}
>
>
<
EditComp
{
...
transferColumn
}
columnConfig=
{
item
}
disabled=
{
readOnlyFlag
}
/>
<
EditComp
{
...
transferColumn
}
columnConfig=
{
item
}
disabled=
{
readOnlyFlag
}
origin=
"editForm"
/>
</
FormItem
>
</
FormItem
>
);
);
};
};
...
...
components/apolloTable/editFormV3/index.tsx
View file @
d1a71d13
...
@@ -116,7 +116,7 @@ class FormWrap extends Component {
...
@@ -116,7 +116,7 @@ class FormWrap extends Component {
validateTrigger
,
validateTrigger
,
rules
:
[{
required
:
!!
item
.
requiredFlag
,
message
:
'必填项不能为空'
},
...
rules
],
rules
:
[{
required
:
!!
item
.
requiredFlag
,
message
:
'必填项不能为空'
},
...
rules
],
initialValue
:
getFormat
(
detailConfig
,
item
,
value
),
initialValue
:
getFormat
(
detailConfig
,
item
,
value
),
})(<
EditComp
{
...
transferColumn
}
columnConfig=
{
item
}
disabled=
{
disabled
}
/>)
}
})(<
EditComp
{
...
transferColumn
}
columnConfig=
{
item
}
disabled=
{
disabled
}
origin=
"editForm"
/>)
}
</
FormItem
>
</
FormItem
>
);
);
};
};
...
...
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