Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
d8dd114a
Commit
d8dd114a
authored
Oct 18, 2017
by
lirilsu
Committed by
杨奕
Oct 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Table: Fix error in cacluating hidden in `table-header` and `table-body`
parent
ba3315a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
12 deletions
+43
-12
packages/table/src/table-body.js
packages/table/src/table-body.js
+11
-3
packages/table/src/table-header.js
packages/table/src/table-header.js
+16
-7
packages/table/src/table-store.js
packages/table/src/table-store.js
+16
-2
No files found.
packages/table/src/table-body.js
View file @
d8dd114a
...
...
@@ -136,6 +136,14 @@ export default {
return
this
.
store
.
states
.
columns
.
length
;
},
leftFixedLeafCount
()
{
return
this
.
store
.
states
.
fixedLeafColumnsLength
;
},
rightFixedLeafCount
()
{
return
this
.
store
.
states
.
rightFixedLeafColumnsLength
;
},
leftFixedCount
()
{
return
this
.
store
.
states
.
fixedColumns
.
length
;
},
...
...
@@ -170,11 +178,11 @@ export default {
isColumnHidden
(
index
)
{
if
(
this
.
fixed
===
true
||
this
.
fixed
===
'
left
'
)
{
return
index
>=
this
.
leftFixedCount
;
return
index
>=
this
.
leftFixed
Leaf
Count
;
}
else
if
(
this
.
fixed
===
'
right
'
)
{
return
index
<
this
.
columnsCount
-
this
.
rightFixedCount
;
return
index
<
this
.
columnsCount
-
this
.
rightFixed
Leaf
Count
;
}
else
{
return
(
index
<
this
.
leftFixed
Count
)
||
(
index
>=
this
.
columnsCount
-
this
.
rightFixed
Count
);
return
(
index
<
this
.
leftFixed
LeafCount
)
||
(
index
>=
this
.
columnsCount
-
this
.
rightFixedLeaf
Count
);
}
},
...
...
packages/table/src/table-header.js
View file @
d8dd114a
...
...
@@ -188,6 +188,14 @@ export default {
return
this
.
store
.
states
.
rightFixedColumns
.
length
;
},
leftFixedLeafCount
()
{
return
this
.
store
.
states
.
fixedLeafColumnsLength
;
},
rightFixedLeafCount
()
{
return
this
.
store
.
states
.
rightFixedLeafColumnsLength
;
},
columns
()
{
return
this
.
store
.
states
.
columns
;
},
...
...
@@ -234,16 +242,17 @@ export default {
methods
:
{
isCellHidden
(
index
,
columns
)
{
let
start
=
0
;
for
(
let
i
=
0
;
i
<
index
;
i
++
)
{
start
+=
columns
[
i
].
colSpan
;
}
const
after
=
start
+
columns
[
index
].
colSpan
-
1
;
if
(
this
.
fixed
===
true
||
this
.
fixed
===
'
left
'
)
{
return
index
>=
this
.
leftFixed
Count
;
return
after
>=
this
.
leftFixedLeaf
Count
;
}
else
if
(
this
.
fixed
===
'
right
'
)
{
let
before
=
0
;
for
(
let
i
=
0
;
i
<
index
;
i
++
)
{
before
+=
columns
[
i
].
colSpan
;
}
return
before
<
this
.
columnsCount
-
this
.
rightFixedCount
;
return
start
<
this
.
columnsCount
-
this
.
rightFixedLeafCount
;
}
else
{
return
(
index
<
this
.
leftFixedCount
)
||
(
index
>=
this
.
columnsCount
-
this
.
rightFixed
Count
);
return
(
after
<
this
.
leftFixedLeafCount
)
||
(
start
>=
this
.
columnsCount
-
this
.
rightFixedLeaf
Count
);
}
},
...
...
packages/table/src/table-store.js
View file @
d8dd114a
...
...
@@ -56,6 +56,9 @@ const TableStore = function(table, initialState = {}) {
columns
:
[],
fixedColumns
:
[],
rightFixedColumns
:
[],
leafColumns
:
[],
fixedLeafColumns
:
[],
rightFixedLeafColumns
:
[],
isComplex
:
false
,
_data
:
null
,
filteredData
:
null
,
...
...
@@ -322,8 +325,19 @@ TableStore.prototype.updateColumns = function() {
_columns
[
0
].
fixed
=
true
;
states
.
fixedColumns
.
unshift
(
_columns
[
0
]);
}
states
.
originColumns
=
[].
concat
(
states
.
fixedColumns
).
concat
(
_columns
.
filter
((
column
)
=>
!
column
.
fixed
)).
concat
(
states
.
rightFixedColumns
);
states
.
columns
=
doFlattenColumns
(
states
.
originColumns
);
const
notFixedColumns
=
_columns
.
filter
(
column
=>
!
column
.
fixed
);
states
.
originColumns
=
[].
concat
(
states
.
fixedColumns
).
concat
(
notFixedColumns
).
concat
(
states
.
rightFixedColumns
);
const
leafColumns
=
doFlattenColumns
(
notFixedColumns
);
const
fixedLeafColumns
=
doFlattenColumns
(
states
.
fixedColumns
);
const
rightFixedLeafColumns
=
doFlattenColumns
(
states
.
rightFixedColumns
);
states
.
leafColumnsLength
=
leafColumns
.
length
;
states
.
fixedLeafColumnsLength
=
fixedLeafColumns
.
length
;
states
.
rightFixedLeafColumnsLength
=
rightFixedLeafColumns
.
length
;
states
.
columns
=
[].
concat
(
fixedLeafColumns
).
concat
(
leafColumns
).
concat
(
rightFixedLeafColumns
);
states
.
isComplex
=
states
.
fixedColumns
.
length
>
0
||
states
.
rightFixedColumns
.
length
>
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