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
a4d36973
Commit
a4d36973
authored
Jun 04, 2020
by
zhangwenshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update showIndex
parent
74d527ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
14 deletions
+29
-14
Table.tsx
components/apolloTable/component/Table.tsx
+29
-14
No files found.
components/apolloTable/component/Table.tsx
View file @
a4d36973
...
@@ -162,7 +162,10 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -162,7 +162,10 @@ export default class AirTable extends Component<TableProps, TableState> {
};
};
// 获取每列的宽度
// 获取每列的宽度
getColumnWidth
=
(
columns
:
ColumnProps
[],
{
index
}:
{
index
:
number
})
=>
{
getColumnWidth
=
(
{
columns
,
showColumns
}:
{
columns
:
ColumnProps
[];
showColumns
:
ColumnProps
[]
},
{
index
}:
{
index
:
number
},
)
=>
{
const
{
tableWidth
=
0
}
=
this
.
state
;
const
{
tableWidth
=
0
}
=
this
.
state
;
const
{
totalWidth
,
configWidth
,
defaultWidthLen
}
=
this
.
memoizeTotalWidth
(
columns
);
const
{
totalWidth
,
configWidth
,
defaultWidthLen
}
=
this
.
memoizeTotalWidth
(
columns
);
const
{
columnWidth
}
=
this
.
config
;
const
{
columnWidth
}
=
this
.
config
;
...
@@ -170,7 +173,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -170,7 +173,7 @@ export default class AirTable extends Component<TableProps, TableState> {
if
(
totalWidth
<
tableWidth
)
{
if
(
totalWidth
<
tableWidth
)
{
colWidth
=
_
.
floor
((
tableWidth
-
configWidth
)
/
defaultWidthLen
);
colWidth
=
_
.
floor
((
tableWidth
-
configWidth
)
/
defaultWidthLen
);
}
}
const
columnObj
=
c
olumns
[
index
];
const
columnObj
=
showC
olumns
[
index
];
if
(
columnObj
&&
columnObj
.
width
)
{
if
(
columnObj
&&
columnObj
.
width
)
{
return
columnObj
.
width
;
return
columnObj
.
width
;
}
}
...
@@ -229,7 +232,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -229,7 +232,7 @@ export default class AirTable extends Component<TableProps, TableState> {
sortFlag=
{
sortFlag
}
sortFlag=
{
sortFlag
}
sortConfig=
{
sortConfig
}
sortConfig=
{
sortConfig
}
columnIndex=
{
columnIndex
}
columnIndex=
{
columnIndex
}
showIndex=
{
showIndex
}
showIndex=
{
position
===
'right'
?
false
:
showIndex
}
questionText=
{
questionText
}
questionText=
{
questionText
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
dataSource=
{
dataSource
}
dataSource=
{
dataSource
}
...
@@ -331,7 +334,7 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -331,7 +334,7 @@ export default class AirTable extends Component<TableProps, TableState> {
cellStyle=
{
cellStyle
}
cellStyle=
{
cellStyle
}
columns=
{
columns
}
columns=
{
columns
}
paginationConfig=
{
paginationConfig
}
paginationConfig=
{
paginationConfig
}
showIndex=
{
showIndex
}
showIndex=
{
position
===
'right'
?
false
:
showIndex
}
emptyPlaceholder=
{
emptyPlaceholder
}
emptyPlaceholder=
{
emptyPlaceholder
}
cellEditable=
{
cellEditable
}
cellEditable=
{
cellEditable
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
rowSelection=
{
position
===
'right'
?
false
:
rowSelection
}
...
@@ -404,7 +407,10 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -404,7 +407,10 @@ export default class AirTable extends Component<TableProps, TableState> {
this
.
grid1
=
dom
;
this
.
grid1
=
dom
;
}
}
}
}
className=
{
styles
.
headerGrid
}
className=
{
styles
.
headerGrid
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
showColumns
)
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
{
columns
:
showColumns
,
showColumns
:
leftColumns
,
})
}
columnCount=
{
leftCount
}
columnCount=
{
leftCount
}
width=
{
leftWidth
}
width=
{
leftWidth
}
rowHeight=
{
headerHeight
}
rowHeight=
{
headerHeight
}
...
@@ -435,7 +441,10 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -435,7 +441,10 @@ export default class AirTable extends Component<TableProps, TableState> {
showColumns
:
leftColumns
,
showColumns
:
leftColumns
,
showData
:
leftData
,
showData
:
leftData
,
})
}
})
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
showColumns
)
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
{
columns
:
showColumns
,
showColumns
:
leftColumns
,
})
}
columnCount=
{
leftCount
}
columnCount=
{
leftCount
}
width=
{
leftWidth
}
width=
{
leftWidth
}
rowHeight=
{
rowHeight
}
rowHeight=
{
rowHeight
}
...
@@ -467,10 +476,10 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -467,10 +476,10 @@ export default class AirTable extends Component<TableProps, TableState> {
}
}
}
}
className=
{
styles
.
headerGrid
}
className=
{
styles
.
headerGrid
}
overscanColumnCount=
{
overscanColumnCount
}
overscanColumnCount=
{
overscanColumnCount
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
{
thi
s
,
columns
:
showColumn
s
,
showColumns
,
showColumns
,
)
}
}
)
}
columnCount=
{
columnCount
}
columnCount=
{
columnCount
}
width=
{
width
}
width=
{
width
}
rowHeight=
{
headerHeight
}
rowHeight=
{
headerHeight
}
...
@@ -504,10 +513,10 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -504,10 +513,10 @@ export default class AirTable extends Component<TableProps, TableState> {
className=
{
styles
.
centerGrid
}
className=
{
styles
.
centerGrid
}
overscanColumnCount=
{
overscanColumnCount
}
overscanColumnCount=
{
overscanColumnCount
}
overscanRowCount=
{
overscanRowCount
}
overscanRowCount=
{
overscanRowCount
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
{
thi
s
,
columns
:
showColumn
s
,
showColumns
,
showColumns
,
)
}
}
)
}
columnCount=
{
columnCount
}
columnCount=
{
columnCount
}
width=
{
realWidth
}
width=
{
realWidth
}
rowHeight=
{
rowHeight
}
rowHeight=
{
rowHeight
}
...
@@ -561,7 +570,10 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -561,7 +570,10 @@ export default class AirTable extends Component<TableProps, TableState> {
this
.
grid5
=
dom
;
this
.
grid5
=
dom
;
}
}
}
}
className=
{
styles
.
headerGrid
}
className=
{
styles
.
headerGrid
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
showColumns
)
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
{
columns
:
showColumns
,
showColumns
:
rightColumns
,
})
}
columnCount=
{
rightCount
}
columnCount=
{
rightCount
}
width=
{
rightWidth
}
width=
{
rightWidth
}
rowHeight=
{
headerHeight
}
rowHeight=
{
headerHeight
}
...
@@ -595,7 +607,10 @@ export default class AirTable extends Component<TableProps, TableState> {
...
@@ -595,7 +607,10 @@ export default class AirTable extends Component<TableProps, TableState> {
showData
:
rightData
,
showData
:
rightData
,
position
:
'right'
,
position
:
'right'
,
})
}
})
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
showColumns
)
}
columnWidth=
{
this
.
getColumnWidth
.
bind
(
this
,
{
columns
:
showColumns
,
showColumns
:
rightColumns
,
})
}
columnCount=
{
rightCount
}
columnCount=
{
rightCount
}
width=
{
rightWidth
}
width=
{
rightWidth
}
rowHeight=
{
rowHeight
}
rowHeight=
{
rowHeight
}
...
...
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