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
0e0a5061
Commit
0e0a5061
authored
Apr 23, 2019
by
ChenZhuoSteve
Committed by
hetech
Apr 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tree: improve performance (#14881)
parent
6ae9f083
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
4 deletions
+12
-4
packages/tree/src/model/node.js
packages/tree/src/model/node.js
+2
-0
packages/tree/src/model/tree-store.js
packages/tree/src/model/tree-store.js
+8
-3
packages/tree/src/tree-node.vue
packages/tree/src/tree-node.vue
+1
-1
types/tree.d.ts
types/tree.d.ts
+1
-0
No files found.
packages/tree/src/model/node.js
View file @
0e0a5061
...
@@ -71,6 +71,7 @@ export default class Node {
...
@@ -71,6 +71,7 @@ export default class Node {
this
.
expanded
=
false
;
this
.
expanded
=
false
;
this
.
parent
=
null
;
this
.
parent
=
null
;
this
.
visible
=
true
;
this
.
visible
=
true
;
this
.
isCurrent
=
false
;
for
(
let
name
in
options
)
{
for
(
let
name
in
options
)
{
if
(
options
.
hasOwnProperty
(
name
))
{
if
(
options
.
hasOwnProperty
(
name
))
{
...
@@ -123,6 +124,7 @@ export default class Node {
...
@@ -123,6 +124,7 @@ export default class Node {
if
(
key
&&
store
.
currentNodeKey
!==
undefined
&&
this
.
key
===
store
.
currentNodeKey
)
{
if
(
key
&&
store
.
currentNodeKey
!==
undefined
&&
this
.
key
===
store
.
currentNodeKey
)
{
store
.
currentNode
=
this
;
store
.
currentNode
=
this
;
store
.
currentNode
.
isCurrent
=
true
;
}
}
if
(
store
.
lazy
)
{
if
(
store
.
lazy
)
{
...
...
packages/tree/src/model/tree-store.js
View file @
0e0a5061
...
@@ -314,8 +314,13 @@ export default class TreeStore {
...
@@ -314,8 +314,13 @@ export default class TreeStore {
return
this
.
currentNode
;
return
this
.
currentNode
;
}
}
setCurrentNode
(
node
)
{
setCurrentNode
(
currentNode
)
{
this
.
currentNode
=
node
;
const
prevCurrentNode
=
this
.
currentNode
;
if
(
prevCurrentNode
)
{
prevCurrentNode
.
isCurrent
=
false
;
}
this
.
currentNode
=
currentNode
;
this
.
currentNode
.
isCurrent
=
true
;
}
}
setUserCurrentNode
(
node
)
{
setUserCurrentNode
(
node
)
{
...
@@ -331,7 +336,7 @@ export default class TreeStore {
...
@@ -331,7 +336,7 @@ export default class TreeStore {
}
}
const
node
=
this
.
getNode
(
key
);
const
node
=
this
.
getNode
(
key
);
if
(
node
)
{
if
(
node
)
{
this
.
currentNode
=
node
;
this
.
setCurrentNode
(
node
)
;
}
}
}
}
};
};
packages/tree/src/tree-node.vue
View file @
0e0a5061
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
v-show=
"node.visible"
v-show=
"node.visible"
:class=
"
{
:class=
"
{
'is-expanded': expanded,
'is-expanded': expanded,
'is-current':
tree.store.currentNode === node
,
'is-current':
node.isCurrent
,
'is-hidden': !node.visible,
'is-hidden': !node.visible,
'is-focusable': !node.disabled,
'is-focusable': !node.disabled,
'is-checked': !node.disabled
&&
node.checked
'is-checked': !node.disabled
&&
node.checked
...
...
types/tree.d.ts
View file @
0e0a5061
...
@@ -36,6 +36,7 @@ export interface TreeNode<K, D> {
...
@@ -36,6 +36,7 @@ export interface TreeNode<K, D> {
label
:
string
;
label
:
string
;
nextSibling
:
TreeNode
<
K
,
D
>
|
null
;
nextSibling
:
TreeNode
<
K
,
D
>
|
null
;
previousSibling
:
TreeNode
<
K
,
D
>
|
null
;
previousSibling
:
TreeNode
<
K
,
D
>
|
null
;
isCurrent
:
boolean
;
}
}
/** incomplete, you can convert to any to use other properties */
/** incomplete, you can convert to any to use other properties */
...
...
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