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
52eb141b
Commit
52eb141b
authored
Dec 21, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a3356272
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
14 deletions
+25
-14
Cell.tsx
components/apolloTable/component/Cell.tsx
+1
-1
Column.less
components/apolloTable/component/Column.less
+1
-0
DragSorted.tsx
components/apolloTable/component/DragSorted.tsx
+6
-2
Table.tsx
components/apolloTable/component/Table.tsx
+15
-11
index.tsx
components/apolloTable/component/index.tsx
+2
-0
No files found.
components/apolloTable/component/Cell.tsx
View file @
52eb141b
...
...
@@ -456,7 +456,7 @@ const Cell = (props: CellProps) => {
>
{
columnIndex
===
0
&&
position
!==
'right'
&&
record
.
groupConfig
[
3
]
&&
record
.
groupConfig
[
2
]
&&
`${record.groupConfig[2].colChsName}:${record.groupTextArr[2]}`
}
</
div
>
)
}
...
...
components/apolloTable/component/Column.less
View file @
52eb141b
...
...
@@ -24,6 +24,7 @@
width: @textFontGen;
color: @textPrimaryColor;
margin-right: 5px;
user-select: none;
}
.colTitle {
...
...
components/apolloTable/component/DragSorted.tsx
View file @
52eb141b
...
...
@@ -135,8 +135,8 @@ const DragSorted = (props: any) => {
const
dropMove
=
dropCol
.
current
&&
dropCol
.
current
.
move
;
// 清理操作
clean
();
// 没有列信息
if
(
!
dragColumn
||
!
dropColumn
)
{
// 没有列信息
或没有移动位置
if
(
!
dragColumn
||
!
dropColumn
||
dragColumn
===
dropColumn
)
{
return
;
}
// 拖动回调
...
...
@@ -217,6 +217,10 @@ const DragSorted = (props: any) => {
// 表格初始位置x点
const
originLeft
=
container
.
getBoundingClientRect
().
x
||
0
;
// 拖动列矩形
if
(
!
e
.
target
.
offsetParent
)
{
// 兼容处理
return
;
}
const
targetRect
=
e
.
target
.
offsetParent
.
getBoundingClientRect
();
const
curX
=
e
.
clientX
;
// 影子div显示
...
...
components/apolloTable/component/Table.tsx
View file @
52eb141b
...
...
@@ -61,7 +61,7 @@ export default class AirTable extends Component<TableProps, TableState> {
memoizeTotalHeight
:
Function
;
static
getDerivedStateFromProps
(
nextProps
:
TableProps
,
prevState
:
TableState
)
{
const
{
columns
,
dataSource
,
groupConfig
}
=
prevState
;
const
{
columns
,
dataSource
}
=
prevState
;
const
nextState
:
TableState
=
{
...
prevState
,
};
...
...
@@ -71,19 +71,15 @@ export default class AirTable extends Component<TableProps, TableState> {
if
(
JSON
.
stringify
(
columns
)
!==
JSON
.
stringify
(
nextProps
.
columns
))
{
nextState
.
columns
=
nextProps
.
columns
;
}
if
(
JSON
.
stringify
(
groupConfig
)
!==
JSON
.
stringify
(
nextProps
.
groupConfig
))
{
nextState
.
groupConfig
=
nextProps
.
groupConfig
;
}
return
nextState
;
}
constructor
(
props
:
TableProps
)
{
super
(
props
);
const
{
columns
,
dataSource
,
groupConfig
,
width
,
height
}
=
props
;
const
{
columns
,
dataSource
,
width
,
height
}
=
props
;
this
.
state
=
{
columns
,
dataSource
,
groupConfig
,
tableWidth
:
width
||
0
,
tableHeight
:
height
||
0
,
};
...
...
@@ -98,8 +94,10 @@ export default class AirTable extends Component<TableProps, TableState> {
this
.
memoizeData
=
memoizeOne
(
this
.
filterData
);
}
componentWillReceiveProps
(
prevProps
:
Readonly
<
TableProps
>
,
prevState
:
Readonly
<
TableState
>
,
snapshot
?:
any
):
void
{
if
(
JSON
.
stringify
(
prevState
.
groupConfig
)
!==
JSON
.
stringify
(
this
.
state
.
groupConfig
))
{
componentDidUpdate
(
prevProps
:
Readonly
<
TableProps
>
):
void
{
if
(
JSON
.
stringify
(
this
.
props
.
dataSource
)
!==
JSON
.
stringify
(
prevProps
.
dataSource
)
)
{
this
.
recomputeGridSize
();
}
}
...
...
@@ -539,7 +537,10 @@ export default class AirTable extends Component<TableProps, TableState> {
}
}
columnCount=
{
leftCount
}
width=
{
leftWidth
+
scrollbarWidth
}
rowHeight=
{
getRowHeight
.
bind
(
null
,
{
dataSource
,
rowHeight
})
}
rowHeight=
{
getRowHeight
.
bind
(
this
,
{
dataSource
,
rowHeight
,
})
}
rowCount=
{
rowCount
}
height=
{
tableBodyHeight
-
scrollbarWidth
}
scrollTop=
{
scrollTop
}
...
...
@@ -622,7 +623,7 @@ export default class AirTable extends Component<TableProps, TableState> {
})
}
columnCount=
{
columnCount
}
width=
{
realWidth
}
rowHeight=
{
getRowHeight
.
bind
(
null
,
{
rowHeight=
{
getRowHeight
.
bind
(
this
,
{
dataSource
,
rowHeight
,
})
}
...
...
@@ -743,7 +744,10 @@ export default class AirTable extends Component<TableProps, TableState> {
}
}
columnCount=
{
rightCount
}
width=
{
rightWidth
+
scrollbarWidth
}
rowHeight=
{
getRowHeight
.
bind
(
null
,
{
dataSource
,
rowHeight
})
}
rowHeight=
{
getRowHeight
.
bind
(
this
,
{
dataSource
,
rowHeight
,
})
}
rowCount=
{
rowCount
}
height=
{
tableBodyHeight
-
scrollbarWidth
}
scrollTop=
{
scrollTop
}
...
...
components/apolloTable/component/index.tsx
View file @
52eb141b
...
...
@@ -73,6 +73,8 @@ const formatData = (config: string[], dataSource: any[]) => {
groupTextArr
[
2
]
=
group3Cell
.
text
;
}
});
// 先清空之前的
delete
row
.
classList
;
if
(
groupKeyArr
[
0
])
{
const
group1Key
=
groupKeyArr
[
0
];
const
group1Text
=
groupTextArr
[
0
];
...
...
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