Skip to content

Comments

feat:🔥New Component: Splitter #50038

Merged
zombieJ merged 123 commits intoant-design:featurefrom
wanpan11:feat-splitPanel
Sep 9, 2024
Merged

feat:🔥New Component: Splitter #50038
zombieJ merged 123 commits intoant-design:featurefrom
wanpan11:feat-splitPanel

Conversation

@wanpan11
Copy link
Member

@wanpan11 wanpan11 commented Jul 24, 2024

中文版模板 / Chinese template

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

demo 预览 看看大家的想法:https://preview-50038-ant-design.surge.sh/components/splitter-cn

image

@zombieJ Update:

  • size 改成受控形式,并提供 defaultSize 进行初始化支持
  • 抽取 useSizes hooks 统一受控与非受控场景
  • 拖拽逻辑内聚至 SplitBar
  • number 类型值从 % 改为 px
  • onResize 第二个 index 参数暂时移除,因为它对应到 Panel 而是 SplitBar
  • 修复拖拽 SplitBar 出边界再返回时,坐标不正确的问题
  • 移除了 context 因为内聚后 Panel 不再需要消费
  • collapsible 支持与 min 组合使用,并且抽象 useResizable 聚合推导值
  • 移除了不在 RFC 中的 transition 属性
  • 添加 Demo Test、Image Test 以及一些边界场景的 Test,将 fakeTimer 统一至顶层
  • 去除了所有的状态更新 useEffect,改为推导值
  • Panel 属性都只和 Panel 相关,而不是既包含 Panel 又包含 SplitBar 属性(移除了对应的警告)。现在 SplitBar 属性将从 Panel 推导计算。

📝 Changelog

Language Changelog
🇺🇸 English New Component: SplitPanel
🇨🇳 Chinese 新组件:SplitPanel

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 24, 2024

Preview is ready

@github-actions
Copy link
Contributor

github-actions bot commented Jul 24, 2024

👁 Visual Regression Report for PR #50038 Failed ❌

🎯 Target branch: feature (c5f4c71)
📖 View Full Report ↗︎

Expected (Branch feature) Actual (Current PR) Diff
auto-complete-certain-category.compact.png auto-complete-certain-category.compact.png auto-complete-certain-category.compact.png auto-complete-certain-category.compact.png
auto-complete-certain-category.compact.png auto-complete-certain-category.compact.png auto-complete-certain-category.compact.css-var.png auto-complete-certain-category.compact.css-var.png
auto-complete-certain-category.dark.png auto-complete-certain-category.dark.png auto-complete-certain-category.dark.png auto-complete-certain-category.dark.png
auto-complete-certain-category.dark.png auto-complete-certain-category.dark.png auto-complete-certain-category.dark.css-var.png auto-complete-certain-category.dark.css-var.png
auto-complete-certain-category.default.png auto-complete-certain-category.default.png auto-complete-certain-category.default.png auto-complete-certain-category.default.png
auto-complete-certain-category.default.png auto-complete-certain-category.default.png auto-complete-certain-category.default.css-var.png auto-complete-certain-category.default.css-var.png
config-provider-size.compact.png config-provider-size.compact.png config-provider-size.compact.png config-provider-size.compact.png
config-provider-size.compact.png config-provider-size.compact.png config-provider-size.compact.css-var.png config-provider-size.compact.css-var.png
config-provider-size.dark.png config-provider-size.dark.png config-provider-size.dark.png config-provider-size.dark.png
config-provider-size.dark.png config-provider-size.dark.png config-provider-size.dark.css-var.png config-provider-size.dark.css-var.png

Check Full Report for details


If you think the visual diff is acceptable, please check:

  • Visual diff is acceptable

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jul 24, 2024

Open in Stackblitz

More templates

bun add https://pkg.pr.new/ant-design/ant-design/antd@50038

commit: 2ceaf4a

@li-jia-nan li-jia-nan changed the title [WIP]feat:🔥New Component: SplitPanel [WIP] feat:🔥New Component: SplitPanel Jul 26, 2024
@wanpan11 wanpan11 changed the title [WIP] feat:🔥New Component: SplitPanel [WIP] feat:🔥New Component: Splitter Jul 28, 2024
@zombieJ
Copy link
Member

zombieJ commented Sep 9, 2024

Demo 改圆角吧

圆角拉线到边缘的时候会超出来,否则就要加一下 overflow: hidden 但是这对 Splitter 组件来说就做过了。

@zombieJ zombieJ merged commit 742ce37 into ant-design:feature Sep 9, 2024
@wanpan11 wanpan11 deleted the feat-splitPanel branch September 9, 2024 11:43
coding-ice added a commit to coding-ice/ant-design that referenced this pull request Sep 13, 2024
* feat: SplitPanel init

* feat: SplitPanel update

* feat: SplitPanel update

* feat: splitPanel update useResize

* feat: SplitPanel update

* feat: splitPanel update useResize

* feat: SplitPanel update

* feat: splitPanel demo

* feat: splitPanel update

* feat: splitPanel support complicated combination

* feat: SplitPanel rename to Splitter

* feat: Splitter support onRize

* feat: support collapsible

* feat: support token and collapsible

* feat: update docs

* feat: size defaultSize support string

* feat: min max support string

* feat: update

* feat: support DOM structure

* feat: Optimize UI

* feat: Optimize Code

* fix: Add a default size during initialization to prevent failure to obtain container size

* feat: optimized code

* feat: optimized code

* feat: Optimize Code

* Update components/splitter/demo/layout.tsx

Co-authored-by: lijianan <[email protected]>
Signed-off-by: Wanpan <[email protected]>

* Update components/splitter/demo/multiple.tsx

Co-authored-by: lijianan <[email protected]>
Signed-off-by: Wanpan <[email protected]>

* docs: update

* feat: Modify the style and optimize the interface

* feat: use PropsWithChildren

* feat: support rtl

* feat: collapsible supports object types

* fix: when collapsible is boolean not work

* feat: Splitter add test

* feat: update

* test: update snapshots

* docs: update

* test: update snapshots

* test: update

* test: update

* test: update

* test: update

* fix: Removed invalid min and max restrictions when collapsible exists

* test: update

* test: update

* test: update

* test: test coverage

* Revert "test: test coverage"

This reverts commit d247193.

* test: test coverage

* feat: rename

* feat: optimized code

* ci: lint

* feat: optimized code

* feat: add useag tips

* feat: optimized code

* feat: Modify splitbar layout

* feat: optimized code

* feat: numerical precision

* feat: optimized code

* feat: Optimized trigger region

* feat: Support configuration animation

* fix: Fix Collapsible exception when using multiple panels

* fix: Fixed the issue of drag area overlapping when multiple panels are folded

* feat: optimized code

* feat: annotation

* feAt: optimized code

* fix: bgcolor

* fix: Modify the initial value calculation method

* test: update

* feat: add cover image

* chore: adjust logic

* chore: use items size

* chore: rtl

* chore: limit

* chore: controlled

* docs: update demo

* docs: adjust style

* chore: add split style

* chore: hor collapisble style

* chore: collapse icon

* chore: update warning

* chore: clean up

* chore: collapse logic

* chore: adjust demo

* chore: clean up

* test: adjust logic

* docs: update demo

* docs: rm useless demo

* docs: demo

* test: add demo test

* test: test of them

* test: 100% coverage

* chore: fix lint

* docs: update demo

* refactor: unique resize config

* docs: add demo

* fix: support virtual resiable

* chore: add cursor mask

* test: update snapshot

* test: add test case

* test: update snapshot

* chore: use px base

* chore: rm useless code

---------

Signed-off-by: Wanpan <[email protected]>
Co-authored-by: lijianan <[email protected]>
Co-authored-by: 二货机器人 <[email protected]>
Co-authored-by: ice <[email protected]>
@balboFK
Copy link

balboFK commented Oct 7, 2024

Hello guys! I dont know if this is the right place to ask about this, but since this is a commit about the new component i think it might be. Could we add the option to set a custom icon to the splitter component instead of only the little line that it does? I know that it is customizable via the design token, but adding icons would be even better for UI. I'm talking about this guy:

image

What do you think @li-jia-nan ?

@sheng-di
Copy link

这个支持 lazy 模式吗?
比如一些组件大小发生变化,就需要进行大量的计算。
能否有这样的功能:
用户拖动时,不实际进行 resize,等用户放下鼠标后,再触发 resize。

这样只会 resize 一次,性能会好一些。

拖动过程中,可以有一个临时的 splitter 移动的效果。

@wanpan11
Copy link
Member Author

这个支持 lazy 模式吗? 比如一些组件大小发生变化,就需要进行大量的计算。 能否有这样的功能: 用户拖动时,不实际进行

目前不支持这个,可以试试在你的组件外层加一层 div 然后定义一个 width ,当 onResizeEnd 触发式 在更新这个 width

@wanpan11
Copy link
Member Author

Hello guys! I dont know if this is the right place to ask about this, but since this is a commit about the new component i

Of course this is a good idea, I will add this feature later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants