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

feat(collapse): collaspe support to specify grow attr #188

Merged
merged 3 commits into from
Jun 22, 2021
Merged

Conversation

mortalYoung
Copy link
Collaborator

简介

  • collapse 支持设置 grow 属性来指明如何分配 explorer 的剩余空间,行为模式类似于 flex-grow,但有所不同
    • grow 的默认值为 1,所有 panel 都不设置时,活跃且不为空的 panel 平分剩余空间
    • 如果有一个设置了 2,其余均不设置,则该 panel 占剩余空间的 2 份,其余各占 1 份
    • 如果有一个设置了 0,则表示不占用剩余空间,将会按照自身 content 的高度来占用空间,若自身 content 的高度大于最大高度,则用最大高度来占用空间,此时剩余空间重新计算,将会把当前 panel 的所占用的高度去除后得出新的剩余空间用来为其他非 grow 为 0 的 panel 分配空间
  • 修复选中文件 editorTree 没有更新的问题
  • 修复切换 panel 显示后高度没有重新计算的问题

主要变更

  • collapse 的 data 支持 _config 属性,_config 属性可拓展,目前仅支持 grow
  • 重新优化 calcPosition 算法,具体思路上面已经提到了,优化了注释

src/components/collapse/index.tsx Outdated Show resolved Hide resolved
src/components/collapse/index.tsx Outdated Show resolved Hide resolved
@wewoor wewoor added this to the 0.9.0-alpha.3 milestone Jun 22, 2021
@wewoor wewoor added the enhancement New feature or request label Jun 22, 2021
@wewoor wewoor merged commit d5dca2e into main Jun 22, 2021
@wewoor wewoor deleted the feat/collapse branch June 22, 2021 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants