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: Cascader.Panel support #45089

Merged
merged 13 commits into from Sep 26, 2023
Merged

feat: Cascader.Panel support #45089

merged 13 commits into from Sep 26, 2023

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Sep 26, 2023

[中文版模板 / 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

📝 Changelog

Language Changelog
🇺🇸 English Cascader support Cascader.Panel component for inline usage.
🇨🇳 Chinese Cascader 支持 Cascader.Panel 组件供内联使用。

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at 3a65190

This pull request adds a new CascaderPanel component that can be used as a standalone cascader panel for inline view cases. It also refactors the cascader style logic and the checkable logic by using custom hooks and extracting reusable functions. It updates the documentation and the dependency for the cascader component.

🔍 Walkthrough

🤖 Generated by Copilot at 3a65190

  • Add a new CascaderPanel component that provides a standalone cascader panel for inline view cases (link, link, link, link)
  • Add documentation and code examples for the CascaderPanel component in both Chinese and English (link, link, link, link)
  • Extract the logic of rendering the checkbox element based on the multiple prop to a custom hook useCheckable and reuse it in both Cascader and CascaderPanel components (link, link)
  • Extract the logic of generating the CSS style for the cascader columns based on the component token to a function getColumnsStyle and reuse it in both Cascader and CascaderPanel components (link, link, link, link)
  • Export the function prepareComponentToken that prepares the component token for the cascader style logic and reuse it in the panel style logic (link, link)
  • Remove the redundant style logic for the checkbox element and the unused variables from the Cascader style logic (link, link)
  • Update the version of the rc-cascader dependency that supports the Panel component (link)

@stackblitz
Copy link

stackblitz bot commented Sep 26, 2023

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

@github-actions
Copy link
Contributor

github-actions bot commented Sep 26, 2023

@socket-security
Copy link

New dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
rc-cascader 3.18.1 None +0 194 kB

usePanelStyle(cascaderPrefixCls);

// ===================== Empty =====================
const mergedNotFoundContent = notFoundContent || renderEmpty?.('Cascader') || (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样如果传 null 或者是 false 是不是没办法隐藏 NotFoundContent

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

内联空必须要要有个占位,否则会留一个空的框,会很怪异。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但个人感觉,使用者如果明确传了一个 null 或者是 false 过来,就是明确不想要这个东西,而是想用其他方式提示,既然类型上支持 null 和 false 的话,是不是不应该打破这个规则呢

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false 有需求的话可以支持一下,但是这一版我还是想先坚持一下不做这个处理。

@@ -0,0 +1,7 @@
## zh-CN

`5.10.0` 新增,适用于一些需要内嵌适用的场景。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是可以在后面的 <code version="5.10.0"> 增加版本角标吗?这里是不是不需要额外加?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

666,我都忘记这个了。

@@ -36,6 +36,7 @@ Cascade selection box.
<code src="./demo/custom-dropdown.tsx">Custom dropdown</code>
<code src="./demo/placement.tsx">Placement</code>
<code src="./demo/status.tsx">Status</code>
<code src="./demo/panel.tsx">Panel</code>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<code src="./demo/panel.tsx">Panel</code>
<code src="./demo/panel.tsx" version="5.10.0">Panel</code>

@@ -37,6 +37,7 @@ demo:
<code src="./demo/custom-dropdown.tsx">扩展菜单</code>
<code src="./demo/placement.tsx">弹出位置</code>
<code src="./demo/status.tsx">自定义状态</code>
<code src="./demo/panel.tsx">面板使用</code>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<code src="./demo/panel.tsx">面板使用</code>
<code src="./demo/panel.tsx" version="5.10.0">面板使用</code>

@github-actions
Copy link
Contributor

github-actions bot commented Sep 26, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 397.66 KB (+899 B 🔺)
./dist/antd-with-locales.min.js 456.93 KB (+937 B 🔺)

@argos-ci
Copy link

argos-ci bot commented Sep 26, 2023

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 6 changes Sep 26, 2023, 9:14 AM

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (69d0487) 100.00% compared to head (12cbb09) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #45089   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          687       693    +6     
  Lines        11655     11683   +28     
  Branches      3119      3121    +2     
=========================================
+ Hits         11655     11683   +28     
Files Coverage Δ
components/cascader/Panel.tsx 100.00% <100.00%> (ø)
components/cascader/hooks/useBase.ts 100.00% <100.00%> (ø)
components/cascader/hooks/useCheckable.tsx 100.00% <100.00%> (ø)
components/cascader/hooks/useColumnIcons.tsx 100.00% <100.00%> (ø)
components/cascader/index.tsx 100.00% <100.00%> (ø)
components/cascader/style/columns.ts 100.00% <100.00%> (ø)
components/cascader/style/index.ts 100.00% <100.00%> (ø)
components/cascader/style/panel.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zombieJ zombieJ merged commit 7e692ad into feature Sep 26, 2023
86 checks passed
@zombieJ zombieJ deleted the cascader branch September 26, 2023 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants