mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 04:28:32 +08:00
nav 父节点的 unfolded 需要依赖子节点的 active (#1960)
Co-authored-by: cy <chenyi08@kuaishou.com>
This commit is contained in:
parent
bad661528a
commit
d94fbddeb3
@ -231,27 +231,32 @@ const ConditionBuilderWithRemoteOptions = withRemoteConfig({
|
|||||||
if (Array.isArray(links) && motivation !== 'toggle') {
|
if (Array.isArray(links) && motivation !== 'toggle') {
|
||||||
const {data, env, unfoldedField, foldedField} = props;
|
const {data, env, unfoldedField, foldedField} = props;
|
||||||
|
|
||||||
links = mapTree(links, (link: Link) => {
|
links = mapTree(
|
||||||
const item: any = {
|
links,
|
||||||
...link,
|
(link: Link) => {
|
||||||
...getExprProperties(link, data as object),
|
const item: any = {
|
||||||
active:
|
...link,
|
||||||
(motivation !== 'location-change' && link.active) ||
|
...getExprProperties(link, data as object),
|
||||||
(link.activeOn
|
active:
|
||||||
? evalExpression(link.activeOn as string, data)
|
(motivation !== 'location-change' && link.active) ||
|
||||||
: !!(
|
(link.activeOn
|
||||||
link.hasOwnProperty('to') &&
|
? evalExpression(link.activeOn as string, data)
|
||||||
env &&
|
: !!(
|
||||||
env.isCurrentUrl(filter(link.to as string, data))
|
link.hasOwnProperty('to') &&
|
||||||
))
|
env &&
|
||||||
};
|
env.isCurrentUrl(filter(link.to as string, data))
|
||||||
|
))
|
||||||
|
};
|
||||||
|
|
||||||
item.unfolded =
|
item.unfolded =
|
||||||
isUnfolded(item, {unfoldedField, foldedField}) ||
|
isUnfolded(item, {unfoldedField, foldedField}) ||
|
||||||
(link.children && link.children.some(link => !!link.active));
|
(link.children && link.children.some(link => !!link.active));
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
});
|
},
|
||||||
|
1,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return links;
|
return links;
|
||||||
|
Loading…
Reference in New Issue
Block a user