Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collapse-expand does not take effect, version 5.0.24 #6412

Open
halaproliu opened this issue Oct 16, 2024 · 7 comments
Open

collapse-expand does not take effect, version 5.0.24 #6412

halaproliu opened this issue Oct 16, 2024 · 7 comments
Labels
behavior Issue about behaviors status: waiting for author Issue with insufficient information v5

Comments

@halaproliu
Copy link

Describe the bug / 问题描述

使用collapse-expand插件,展开收缩不生效

Reproduction link / 重现链接

https://stackblitz.com/edit/vitejs-vite-cnvaiy?file=src%2FApp.vue

Steps to Reproduce the Bug or Issue / 重现步骤

复现链接中有

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome

Additional context / 补充说明

麻烦帮忙看下

@github-actions github-actions bot changed the title collapse-expand不生效,5.0.24版本 collapse-expand does not take effect, version 5.0.24 Oct 16, 2024
@yvonneyx
Copy link
Contributor

collapse-expand 交互会去处理节点数据中的 children 字段,请先检查数据中是否包含此字段

interface NodeData {
    id: ID;
    type: string;
    data?: Record<string, unknown>;
    children?: ID[];
}

@halaproliu
Copy link
Author

collapse-expand 交互会去处理节点数据中的 children 字段,请先检查数据中是否包含此字段

interface NodeData {
    id: ID;
    type: string;
    data?: Record<string, unknown>;
    children?: ID[];
}

https://g6-next.antv.antgroup.com/zh/examples/scene-case/default#organization-chart组织架构图的这个demo数据是不含children字段的,所以这种图标是不能折叠展开的嘛

@yvonneyx
Copy link
Contributor

直接加交互肯定是没办法生效的呀,需要再处理一下数据~

@halaproliu
Copy link
Author

直接加交互肯定是没办法生效的呀,需要再处理一下数据~

其实相当于是,如果数据结构是带children的,插件会自动处理。但是如果没有带的话,需要自己通过onCollpse和onExpand函数去处理吧?

@yvonneyx
Copy link
Contributor

无论是使用内置的 collapse-expand 交互,还是使用 graph API expandElementcollapseElement,都需要消费 children 字段,以告知哪些元素需要被展开或收起。否则,从数据层面很难推断出需要展开或收起的元素。

@yvonneyx yvonneyx added v5 behavior Issue about behaviors labels Oct 24, 2024
@yvonneyx yvonneyx modified the milestone: Issue Oct 24, 2024
@halaproliu
Copy link
Author

无论是使用内置的 collapse-expand 交互,还是使用 graph API expandElementcollapseElement,都需要消费 children 字段,以告知哪些元素需要被展开或收起。否则,从数据层面很难推断出需要展开或收起的元素。

目前dagre布局,所使用的data结构是GraphData类型的,是否意味着这种布局无法使用collapse-expand组件?

@yvonneyx
Copy link
Contributor

yvonneyx commented Oct 24, 2024 via email

@yvonneyx yvonneyx added the status: waiting for author Issue with insufficient information label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behavior Issue about behaviors status: waiting for author Issue with insufficient information v5
Projects
None yet
Development

No branches or pull requests

2 participants