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
a408bf47
Commit
a408bf47
authored
Jul 20, 2017
by
Dreamacro
Committed by
杨奕
Jul 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tree: tree expend once when checked
parent
527f3bdb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
packages/tree/src/model/node.js
packages/tree/src/model/node.js
+20
-3
No files found.
packages/tree/src/model/node.js
View file @
a408bf47
...
...
@@ -42,6 +42,22 @@ const reInitChecked = function(node) {
}
};
const
initLazyLoadChild
=
node
=>
{
const
childNodes
=
node
.
childNodes
;
if
(
node
.
checked
)
{
for
(
let
i
=
0
,
j
=
childNodes
.
length
;
i
<
j
;
i
++
)
{
const
child
=
childNodes
[
i
];
if
(
!
child
.
disabled
)
{
child
.
checked
=
true
;
}
}
}
const
parent
=
node
.
parent
;
if
(
!
parent
||
parent
.
level
===
0
)
return
;
reInitChecked
(
parent
);
};
const
getPropertyFromData
=
function
(
node
,
prop
)
{
const
props
=
node
.
store
.
props
;
const
data
=
node
.
data
||
{};
...
...
@@ -245,6 +261,7 @@ export default class Node {
if
(
this
.
shouldLoadData
())
{
this
.
loadData
((
data
)
=>
{
if
(
data
instanceof
Array
)
{
initLazyLoadChild
(
this
);
done
();
}
});
...
...
@@ -290,8 +307,8 @@ export default class Node {
value
=
false
;
}
const
handleDescendants
=
()
=>
{
if
(
deep
)
{
const
handleDescendants
=
(
lazy
)
=>
{
if
(
deep
&&
!
lazy
)
{
const
childNodes
=
this
.
childNodes
;
for
(
let
i
=
0
,
j
=
childNodes
.
length
;
i
<
j
;
i
++
)
{
const
child
=
childNodes
[
i
];
...
...
@@ -310,7 +327,7 @@ export default class Node {
if
(
!
this
.
store
.
checkStrictly
&&
this
.
shouldLoadData
())
{
// Only work on lazy load data.
this
.
loadData
(()
=>
{
handleDescendants
();
handleDescendants
(
true
);
},
{
checked
:
value
!==
false
});
...
...
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