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
2c82bb10
Commit
2c82bb10
authored
Jun 02, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add expand
parent
602ab98f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
25 deletions
+48
-25
Cell.less
components/apolloTable/component/Cell.less
+17
-0
Cell.tsx
components/apolloTable/component/Cell.tsx
+20
-17
Table.less
components/apolloTable/component/Table.less
+5
-5
Table.tsx
components/apolloTable/component/Table.tsx
+2
-2
utils.tsx
components/apolloTable/utils/utils.tsx
+4
-1
No files found.
components/apolloTable/component/Cell.less
View file @
2c82bb10
...
...
@@ -21,6 +21,23 @@
.checkbox {
margin-right: 10px;
}
.expand{
text-align: center;
width: 20px;
border-radius: 50%;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
margin-right: @marginSm;
cursor: pointer;
&:hover{
background: #d0f0fd;
}
.expandIcon{
width: 16px;
}
}
.content {
flex: 1;
overflow: hidden;
...
...
components/apolloTable/component/Cell.tsx
View file @
2c82bb10
...
...
@@ -9,6 +9,7 @@ import FormHelper from '../utils/formHelper';
import
firstIcon
from
'../assets/first.png'
;
import
secondIcon
from
'../assets/second.png'
;
import
thirdIcon
from
'../assets/third.png'
;
import
expandIcon
from
'../assets/extend.png'
;
import
{
transferAttr
}
from
'./base/_utils/transferAttr'
;
const
Cell
=
(
props
:
CellProps
)
=>
{
...
...
@@ -36,6 +37,7 @@ const Cell = (props: CellProps) => {
renderEditCell
,
cellRenderProps
,
readOnlyFlag
,
showExpand
,
}
=
columnConfig
;
const
[
status
,
setStatus
]
=
useState
(
'detail'
);
...
...
@@ -111,23 +113,23 @@ const Cell = (props: CellProps) => {
const
{
current
=
1
,
pageSize
=
20
}
=
paginationConfig
||
{};
const
getIndex
=
()
=>
{
if
(
current
===
1
)
{
let
src
=
''
;
switch
(
rowIndex
)
{
case
0
:
src
=
firstIcon
;
break
;
case
1
:
src
=
secondIcon
;
break
;
case
2
:
src
=
thirdIcon
;
break
;
default
:
return
rowIndex
+
1
;
}
return
<
img
className=
{
s
.
icon
}
alt=
""
src=
{
src
}
/>;
}
//
if (current === 1) {
//
let src = '';
//
switch (rowIndex) {
//
case 0:
//
src = firstIcon;
//
break;
//
case 1:
//
src = secondIcon;
//
break;
//
case 2:
//
src = thirdIcon;
//
break;
//
default:
//
return rowIndex + 1;
//
}
//
return <img className={s.icon} alt="" src={src} />;
//
}
return
(
current
-
1
)
*
pageSize
+
rowIndex
+
1
;
};
const
getCheckbox
=
()
=>
{
...
...
@@ -160,6 +162,7 @@ const Cell = (props: CellProps) => {
>
{
rowSelection
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
checkbox
}
>
{
getCheckbox
()
}
</
div
>
}
{
showIndex
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
num
}
>
{
getIndex
()
}
</
div
>
}
{
showExpand
&&
columnIndex
===
0
&&
<
div
className=
{
s
.
expand
}
><
img
onClick=
{
showExpand
.
bind
(
null
,{
rowId
:
record
.
id
})
}
className=
{
s
.
expandIcon
}
alt=
""
src=
{
expandIcon
}
/></
div
>
}
{
empty
?
(
emptyPlaceholder
||
'-'
)
:
(
...
...
components/apolloTable/component/Table.less
View file @
2c82bb10
...
...
@@ -44,15 +44,15 @@
.sideGrid {
overflow: hidden !important;
outline: none;
.bodyCell {
font-size: 20px;
color: @textGeneralColor;
font-weight: @weightRegular;
}
}
.centerGrid {
outline: none;
}
.bodyCell {
font-size: 20px;
color: @textGeneralColor;
font-weight: @weightRegular;
}
.headerGrid {
width: 100%;
...
...
components/apolloTable/component/Table.tsx
View file @
2c82bb10
...
...
@@ -278,8 +278,8 @@ export default class AirTable extends Component<TableProps, TableState> {
)
=>
{
const
columnConfig
=
showColumns
[
columnIndex
];
const
{
cellClassName
,
cellStyle
}
=
columnConfig
;
const
className
=
getMergeClassName
(
rowClassName
,
cellClassName
,
{
columnIndex
});
const
mergedCellStyle
=
getMergeStyle
(
rowStyle
,
cellStyle
,
{
columnIndex
});
const
className
=
getMergeClassName
(
rowClassName
,
cellClassName
,
{
columnIndex
,
columnConfig
});
const
mergedCellStyle
=
getMergeStyle
(
rowStyle
,
cellStyle
,
{
columnIndex
,
columnConfig
});
return
this
.
renderBodyCell
(
{
showColumns
,
showData
,
position
},
{
...
...
components/apolloTable/utils/utils.tsx
View file @
2c82bb10
...
...
@@ -93,7 +93,10 @@ export function getMergeClassName(
mergeClassName
=
''
;
}
if
(
typeof
mergeClassName
===
'function'
)
{
className
=
`
${
className
}
${
mergeClassName
(
mergeData
)}
`
;
const
mergeClass
=
mergeClassName
(
mergeData
);
if
(
mergeClass
)
{
className
=
`
${
className
}
${
mergeClass
}
`
;
}
}
else
{
className
=
`
${
className
}
${
mergeClassName
}
`
;
}
...
...
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