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

refactor: New Picker interactive #46685

Merged
merged 92 commits into from Jan 15, 2024
Merged

refactor: New Picker interactive #46685

merged 92 commits into from Jan 15, 2024

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Dec 28, 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 【到 issue 中复制】
🇨🇳 Chinese 【到 issue 中复制】

Chinese

  • 🔥 重构 DatePicker 组件
    • ⚡️ 优化 disabledDate 检查逻辑,现在会提供 info.type 告知当前面板信息。
    • 🆕 DatePicker 新增 multiple 支持多选能力。
    • 🆕 新增配套 pickerValuedefaultPickerValue 属性用于受控管理展开面板所在日期。
      • defaultPickerValue 现在会在每次面板展开时都进行重置。
    • 🐞 修复输入框功能按键会唤起弹出框的问题,现在只有在交互按键、以及输入内容变化时唤起。
    • 🆕 新增 preserveInvalidOnBlur 属性用于无障碍时失去焦点需要保留输入内容的场景。
    • 🆕 format 支持 align 属性,允许通过掩码模式输入内容。
    • 🆕 支持 required 属性。
    • 🆕 RangePicker 下的 id 属性支持分别设置 startend 输入框的 id
    • 🆕 RangePicker 的 onFocusonBlur 事件会额外提供一个 info.range 告知当前的焦点来自于哪个输入框。
    • 🆕 时间面板支持 scrollOnChange 设置滚动时间时自动选择对应的时间。
    • 🆕 添加 needConfirm 属性,允许设置需要确认、或者不确认的提交模式。
    • 🆕 添加 cmponents 属性,允许自定义部分面板。
    • 🆕 面板中所有的日期相关信息都会允许通过 locale 进行配置。
    • 🆕 format 支持 LTLTS 日期格式。
    • 🆕 新增 minDatemaxDate 用于设置面板切换范围。
    • 🆕 RangePicker 支持 order 属性。
    • 🆕 DatePicker 支持 showWeek 属性。
    • 🐞 通过输入框输入日期后失去焦点会提交变更,而不是丢失输入内容(即不再强制需要按下回车提交)。
    • 🐞 修复 use12Hours 下,disabledTime 获取的 hour 也会被裁剪成 0~12 的问题。
    • 🐞 修复某些交互下,禁用日期没有生效依然可以提交的问题。
    • 🛠 allowClear 触发事件从 onMouseDown 切换为 onClick
    • 🛠 移除键盘对面板交互,它需要基于无障碍重新设计。
    • 🛠 废弃 onKetDownpreventDefault 参数,请直接通过 event.preventDefault 进行调用。
    • 💄 移除 RangePicker 的虚线样式,减少视觉干扰。
    • 💄 移除 RangePicker 在选择开始或者结束时间时的禁用范围,优化交互体验。

☑️ 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

Copy link

stackblitz bot commented Dec 28, 2023

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

Copy link
Contributor

github-actions bot commented Dec 28, 2023

Visual Regression Report for PR #46685 Failed ❌

Target branch: feature (5f7323a)
View Full Report


image name expected actual diff
date-picker-basic.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-basic.css-var.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-cell-render.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-cell-render.css-var.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-component-token.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-component-token.css-var.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-disabled-date.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-disabled-date.css-var.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-disabled.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff
date-picker-disabled.css-var.png feature: 5f7323a3d13e93b1d583d3e40346d22154bd1393 current: pr-46685 diff

Check Full Report for details

Copy link
Contributor

github-actions bot commented Dec 28, 2023

Preview Is ready

Copy link

socket-security bot commented Dec 28, 2023

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

Packages Version New capabilities Transitives Size Publisher
rc-picker 4.0.0-alpha.35 None +0 885 kB

Copy link
Contributor

github-actions bot commented Dec 28, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 332.51 KB (+1.47 KB 🔺)
./dist/antd-with-locales.min.js 378.5 KB (+1.53 KB 🔺)

Copy link

codecov bot commented Dec 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5f7323a) 100.00% compared to head (4a467f9) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #46685   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          732       734    +2     
  Lines        12548     12531   -17     
  Branches      3291      3272   -19     
=========================================
- Hits         12548     12531   -17     

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

@zombieJ zombieJ marked this pull request as ready for review January 11, 2024 09:45
@afc163
Copy link
Member

afc163 commented Jan 11, 2024

先在 feature 吧所有浮层的 image test 都加上,这样这里能直接比较 diff,稳一点。

@zombieJ
Copy link
Member Author

zombieJ commented Jan 12, 2024

先在 feature 吧所有浮层的 image test 都加上,这样这里能直接比较 diff,稳一点。

直接展开浮层会叠在一起,要把每个 Demo 都做一遍就过于重复了。看起来要先去做一个浮层单独对比的能力。

@zombieJ zombieJ merged commit fe31458 into feature Jan 15, 2024
104 of 105 checks passed
@zombieJ zombieJ deleted the picker branch January 15, 2024 07:41
Copy link
Contributor

🎉 Thank you for your contribution! If you have not yet joined our DingTalk community group, please feel free to join us (when joining, please provide the link to this PR).

🎉 感谢您的贡献!如果您还没有加入钉钉社区群,请扫描下方二维码加入我们(加群时请提供此 PR 链接)。

@@ -16,7 +19,7 @@ import Select from '../../select';
import Header, { type CalendarHeaderProps } from '../Header';

const ref: {
calendarProps?: PickerPanelProps<unknown>;
calendarProps?: PickerPanelProps<any>;
Copy link
Member

Choose a reason for hiding this comment

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

rc-picker 里的 PickerPanelProps 是不是 PickerPanelProps<T = any> 这个泛型是必填的吗

@@ -30,7 +34,7 @@ describe('RangePicker', () => {
it('should not throw error when value is reset to `[]`', () => {
const birthday = dayjs('2000-01-01', 'YYYY-MM-DD');
const wrapper1 = render(<RangePicker value={[birthday, birthday]} open />);
const wrapper2 = render(<RangePicker value={[] as unknown as null} open />);
const wrapper2 = render(<RangePicker value={[] as unknown as RangeValue<dayjs.Dayjs>} open />);
Copy link
Member

Choose a reason for hiding this comment

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

value 不能直接传 [] 吗

.add(token.controlPaddingHorizontal)
.equal(),
},
// [`
Copy link
Member

Choose a reason for hiding this comment

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

没有删掉

```

注意:`align` 定义为 `5.13.0` 新增。
Copy link
Member

Choose a reason for hiding this comment

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

13 不是要改成 14 吗

@afc163
Copy link
Member

afc163 commented Jan 15, 2024

blur 输入框后浮层经常不会消失。

Jan-15-2024 16-06-37

@afc163
Copy link
Member

afc163 commented Jan 15, 2024

还有 footer 的高度也不一致。

@afc163
Copy link
Member

afc163 commented Jan 15, 2024

maxDate、minDate、order、required 等属性貌似没有在 API 文档中出现。

maxDate、minDate 最好替换掉原来的 disabled 范围的演示。

@zombieJ zombieJ restored the picker branch January 15, 2024 08:20
@afc163 afc163 deleted the picker branch February 8, 2024 05:13
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

6 participants