From b0b43525c3e6684316af4482878cb8b5a3e01cd9 Mon Sep 17 00:00:00 2001 From: zhanglei66 <38252062+zhanglei66@users.noreply.github.com> Date: Thu, 17 Mar 2022 11:34:04 +0800 Subject: [PATCH] Zl/v4.18.9 sync antd (#57) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Missing Catalan (ca_ES) translation key: Form.optional #33280 (#33377) Co-authored-by: zengguhao.zgh * docs: fixing document issues (#33259) * test: Demo check popup content (#33378) * auto demo * chore: update demo snapshot * fix: trigger mock ref logic * chore: try 2 test case * chore: more snapshot * chore: update snapshot * chore: fix ts * chore: split test * test: Update test case * chore: fix test order * fix: Descriptions default overflow value (#33392) close #33316 * chore: Internal Menu interface for ProLayout usage (#33399) * test: Update snapshot * chore: disable tooltip * chore: rename * fix: Skeleton missing style (#33405) * chore(deps): update dependency scrollama to v3 (#33418) Co-authored-by: Renovate Bot * docs: Update practical-projects.zh-CN.md (#33419) * test: update snapshot * chore: 4.18.0 changelog (#33424) * fix: not allow setState in Popconfirm if unmounted * Docs: fix fieldNames options typo (#33241) * docs: tree-select fieldNames error * docs: fix docs error * fix: docs typo * docs: fix fieldNames * fix: The current change of pagination triggers onChange (#33411) * fix: table pagination onChange error (#33374) * test: add test case for this (#33374) * docs: Update use-in-typescript.zh-CN.md (#33434) 这里有点不对 /* src/App.ts */ 应该是 /* src/App.tsx */ 执行npx create-react-app my-project-name --template typescript后也只有App.tsx文件 * docs: fix version error (#33443) Co-authored-by: machixian * fix: Dropdown button destroyPopupOnHide prop not working #33433 (#33442) Co-authored-by: zengguhao.zgh * docs: update changelog * test: Update snapshot * feat: add useMountedRef hook * chore: revert import order change * fix(Divider): with text dashed border color error (#33452) * test: add test for react memory leak warning in Popconfirm * fix: input not support number value (#33462) * docs: Update index.en-US.md (#33464) provide correct hash link for row selection docs to selection config anchor tag * refactor: refactor useMountedRef to useMounted * refactor: refactor useMounted to useDestroyed * docs: 4.18.1 changelog (#33476) * docs: 4.18.1 changelog * Update CHANGELOG.zh-CN.md Co-authored-by: afc163 Co-authored-by: afc163 * docs: improve Cascader API documentation (#33484) close #33477 * docs: improve changelog * Revert "fix: The current change of pagination triggers onChange (#33411)" (#33489) This reverts commit 629caccaae797af67dadbce60e9b2ff9ec3215b3. * docs: release 4.18.2 (#33491) * test: add test case for #33487 (#33492) * feat: Merge TimePicker disabledXXX into disabledTime (#33503) * feat: merge disabledXXX into disabledTime * chore: fix ts * chore: remove whitespace * fix: Form should have default validateMessages in en locale (#33511) * fix missing words in commets (#33514) Lol * chore(deps): update dependency eslint-plugin-unicorn to v40 (#33520) Co-authored-by: Renovate Bot * fix: image demo test in argo-ci (#33523) close #33512 * Update README-sp_MX.md (#33535) The other title doesn't make sense. "Medio ambiente" is the environment, as in environmental pollution, nothing to do with computers. * fix: Select tag margin issue when using tagRender (#33539) close #33531 * docs: update upload-png-only demo (#33544) [[English Template / 英文模板](https://github.com/ant-design/ant-design/blob/master/.github/PULL_REQUEST_TEMPLATE.md)] ### 🤔 这个变动的性质是? - [ ] 新特性提交 - [ ] 日常 bug 修复 - [ ] 站点、文档改进 - [x] 演示代码改进 - [ ] 组件样式/交互改进 - [ ] TypeScript 定义更新 - [ ] 包体积优化 - [ ] 性能优化 - [ ] 功能增强 - [ ] 国际化改进 - [ ] 重构 - [ ] 代码风格优化 - [ ] 测试用例 - [ ] 分支合并 - [ ] 其他改动(是关于什么的改动?) ### 🔗 相关 Issue 无 ### 💡 需求背景和解决方案 无 ### 📝 更新日志 | 语言 | 更新描述 | | ------- | -------- | | 🇺🇸 英文 | | | 🇨🇳 中文 | | ### ☑️ 请求合并前的自查清单 ⚠️ 请自检并全部**勾选全部选项**。⚠️ - [x] 文档已补充或无须补充 - [x] 代码演示已提供或无须提供 - [x] TypeScript 定义已补充或无须补充 - [x] Changelog 已提供或无须提供 * docs: fix update demo * docs: correct react-router usage for breadcrumb (#33551) * ci: update verify-files-modify (#33552) * docs: correct semicolon in upload demo (#33544) (#33553) * fix: PageHeader state update error (#33546) * fix: Avoid mutating Event properties that are supposed to be getters (#33536) * Avoid mutating Event properties that are supposed to be getters React's synthetic Event objects have mutable `target` and `currentTarget` properties. These are an incorrect emulation of the corresponding DOM Event properties, which are _getters_ and cannot be assigned-to. AntD's input handling attempts to assign to these getters, which fails in Preact because it uses native Event objects. The solution is to replace the simple property assignments with property definitions, which is likely smaller anyway due to the existing use of `Object.create()` to construct a prototypal facade of Event objects. * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: afc163 * perf: upgrade rc-table (#33554) * fix: Upload types for pass generic (#33543) * fix: Upload types for pass generic * fix: Upload type * refactor: Upload type * feat: add Upload type test case * fix: CardGridProps should expose Div Properties like onClick #33264 (#33563) Co-authored-by: zengguhao.zgh * style: remove svg reset styles (#33579) see reason: https://github.com/necolas/normalize.css/commit/004d58b2f2e0ac3d03d075f8de46ce7c8234742f close #33573 * chore: classnames now provides its own type definitions, so we do not need a stub types definition (#33612) * chore(deps): update dependency concurrently to v7 (#33630) Co-authored-by: Renovate Bot * fix: Table emptynode fixed display (#33610) * docs(TreeSelect): add one missing field (#33619) * fix: table tree hover error #33453 (#33638) * fix: fix the table tree hover error #33453 * Update package.json Co-authored-by: afc163 Co-authored-by: zengguhao.zgh Co-authored-by: xrkffgg Co-authored-by: afc163 * feat: menu support home & end key (#33642) * fix: Form.Item shaking when `help` is empty string (#33644) * fix: empty help takes the line * test: test case * docs: add changelog 4.18.3 (#33639) * docs: add changelog 4.18.3 * docs: add * docs: add * docs: add user * Update CHANGELOG.en-US.md Co-authored-by: afc163 * Update CHANGELOG.zh-CN.md * docs: add Co-authored-by: afc163 * feat: support custom Space children key (#33607) close #33331 Co-authored-by: 秦缘斌 * docs: add ProComponents cards (#33647) * merge * merge * docs: add ProComponents cards Co-authored-by: 期贤 * docs: fix changelog page build issue * docs: improve changelog of 4.18.3 (#33668) * refactor: opt for typography Tooltip perf (#33669) * fix: Warning: Encountered two children with the same key, 'seperator' (#33649) * fix: Warning: Encountered two children with the same key, 'seperator' #33183 * eslint-disable-next-line react/no-array-index-key Co-authored-by: dimbslmh * feat: resolves issue 33572 re aria-sort on tables (#33603) * feat: resolves issue 33572 re aria-sort on tables * fixing snapshots * removing code that can't be hit anyway * feat: add skeleton input block (#33672) * feat: add skeleton input block * update: skeleton shapshot * test: improve layout demo (#33653) * test: improve layout demo * test: improve layout demo * update snapshot * fix: checkbox group support options other than string (#33678) * fix: checkbox group support options other than string * docs: update checkbox docs * fix: radio group support value other than string * fix: only support number and string * docs: update group options type * fix: Image 图片底部空白 #30825 (#33631) * fix: remove input showCount attribute from parent component (#33686) * ci: simple files check actions * ci: preview-deploy download add run_id (#33680) * feat: dropdown support arrow pointing at center (#33658) * feat: add pointAtCenter prop for dropdown * feat: dropdown support arrow pointing at center * chore: code clean * chore: use getPlacements in tooltip * feat: dropdown support 'top' and 'bottom' * chore: update snapshot * chore: move placements to util folder * feat: make 'topCenter' and 'bottomCenter' in Dropdown deprecated * test: update snapshot * test: add test for topCenter and bottomCenter * fix: Form validateMessages in nested ConfigProvider (#33705) close #33691 * fix: Input can not be hidden when prefix is set (#33706) * fix: Input can not be hidden when prefix is set * test: jest case for #33692 Co-authored-by: hydraZty * fix: align issue (#33709) * fix: align issue close #33703 * update snapshot * fix: Steps tail shouldn't show when type is navigation and labelPlacement is vertical (fix #33681) (#33716) * Steps tail shouldn't show when type is navigation and labelPlacement is vertical (fix #33681) * fix: Steps tail shouldn't show when type is navigation and labelPlacement is vertical close #33681 * fix: Steps tail shouldn't show when type is navigation and labelPlacement is vertical close #33681 * fix: shake issue. (#33726) * docs: add controlled preview demo for Image (#33727) * docs: add controlled preview demo for Image * test: update snapshot * test: fix lint error * fix: Invalid memoized context value in LocaleProvider (#33723) * fix: Invalid memoized context value in LocaleProvider * Add button type in test case. * fix: Invalid memoized context value in Anchor * docs(table): upgrade react-sortable-hoc usage (#33729) Co-authored-by: 亦逊 * fix Input及相关组件设置 hidden 时展示问题 (#33735) * fix: Image 图片底部空白 #30825 * feat: Input、Input.search、Input.Textarea、Input.password 设置 hidden 时 所有 prefix or suffix or showCount or allowClear or addonBefore or addonAfter 都应该隐藏 * fix: lint * fix: test * fix: test ui * fix: some incorrect translation for km_KH (#33738) * Add km_KH locale to component * Add test and docs * Fix typo * Add test snapshot * Fix translation * Add test * docs: remove v4 release qrcode * test: fix lint * fix: Typography error on context ellipsis (#33725) * chore: init measure * chore: out of space * refactor: Multiple render * chore: auto cut * feat: render split * fix: ellipsis logic of suffix * fix: ref missing * fix: Tooltip missing * test: snapshot * chore: opt for textarea * test: back part of ellipsis * chore: back of ellipsis logic * ellipsis logic * fix: init ellipsis measure * fix: ellipsis event * chore: clean up * test: Update snapshot * fix: test * test: Update snapshot * chore: lazy ellipsis * fix: check css ellipsis logic * test: Update snapshot * test: back of coverage * chore: clean up * test: ignore else * test: clean up * feat: border color with transparency (#33506) * feat: border color with transparency * feat: update progess remain color with rgba(0, 0, 0, 0.06) * feat: progress remaining color * fix: TreeSelect not show hightlight with keyboard (#33755) * docs: add changelog 4.18.4 (#33748) Co-authored-by: afc163 * docs: guide of theme dev (#33756) * chore: update Cacasder demo and remove array-tree-filter (#33754) * chore: upgrade rc-cacasder * update snapshot * chore: Add DingDing release bot * chore: conch script (#33766) * fix: Tag color in dark theme (#33751) * docs: update dark theme doc * fix: dark tag theme * docs: ✏️ add note comment (#33771) Co-authored-by: dengqing * fix: update prevValue of checkbox if value changed (#33753) * fix: Cascader auto placement & scroll (#33777) * fix: Cascader auto placement & scroll * chore: bump rc-tree-select * chore: try to find safe version (#33783) * feat: Select/DatePicker/TimePicker/TreeSelect support placement (#33541) * feat: select components add placement api * feat: select components add placement api * fix: delete placement * fix: change md demo and delete export * feat: cascader and tree-select add placement * feat: datapicker add placement api * fix: change repeat static declaration to single * test: updata test units * doc: change doc * fix: delete merge message & delete decalare ts * test: fix unit test * fix: add transName in select & treeSelect & cascader * fix: change common api in utils * fix: change useless if block to only * fix: change placement string to enum * fix: lint done Co-authored-by: 礼检 * fix: Get ref of Card component #33730 (#33784) * fix: Get ref of Card component #33730 * add test to the card ref Co-authored-by: zengguhao.zgh * fix(checkbox): disabled checkbox should works well with tooltip (#33772) Co-authored-by: wanghao * style: Cascader loading icon (#33799) * test: fix cascader test coverage (#33802) * chore: i18n contributing docs improve (#33760) * chore: i18n contributing docs improve * update * Update docs/react/i18n.zh-CN.md Co-authored-by: afc163 * update * update * fix name * 空格 * fix name * update * Update docs/react/i18n.zh-CN.md Co-authored-by: afc163 * update * update * update * 添加英文版本 * update * the * update * update * fix list * Revert "fix list" This reverts commit c6f3e2c699d133f74e0f4ce0424c1fd4ad43dcbf. * fix list * 指向源文件 Co-authored-by: afc163 * fix: Invalid hook dependency array in Sider and Row (#33804) * chore(deps): update dependency simple-git to v3 (#33817) Co-authored-by: Renovate Bot * docs: update sentence structure in the FAQ section (#33816) * docs: add Plasmic for Ant (#33758) * Add Plasmic for Ant * Point Plasmic link to dedicated Ant page * test: fix lint * docs(:sparkles:): release 4.18.5 (#33822) * docs(:sparkles:): release 4.18.5 * update changelog * fix: upload button position flashes when it changes from hidden to displayed (#33820) * fix: fix upload button position flashes when it changes from hidden to displayed (#33819) * fix: typo in upload Co-authored-by: chenqiufan * fix: Clear timer of delayed loading after Button is unmounted (#33858) * fix: Clear delay loading timer after Button is unmounted * [CodeFactor] Apply fixes to commit 16cfb89 [ci skip] [skip ci] * Change arrow function style in test case Co-authored-by: codefactor-io * feat: notification placement support 'top'/'bottom' (#33871) * fix: tooltip should work with loading switch (#33860) * fix: tooltip should work with loading switch * fix: only works for switch * chore: code clean * fix: block not work when small size (#33878) https://github.com/vueComponent/ant-design-vue/issues/5219 * fix: ellipsis should display tooltip if rows larger than 1 (#33875) * fix: ellipsis should display tooltip if rows larger than 1 * test: add test case * fix: update dropdown version to 3.2.5 (#33895) * fix: update dropdown version to 3.2.5 * test: update snapshot * revert: Revert "Merge branch 'feature' into master" (#33903) This reverts commit 40433f357da9129f4434f6846195abb517a2db7e, reversing changes made to 27a498e021891b44730303939d13d3cc401e24ed. * Revert "revert: Revert "Merge branch 'feature' into master" (#33903)" This reverts commit 6b1a48d5edaca3d10380568f8ca1a6a867cb599e. * chore(deps): update dependency eslint-plugin-jest to v26 (#33899) Co-authored-by: Renovate Bot * chore(deps): update dependency @types/jest-environment-puppeteer to v5 (#33898) Co-authored-by: Renovate Bot * types: export DatePickRef and RangePickerRef (close #33417) (#33901) * fix(popover): fix the problem that popover display when the props'content is empty (#33835) * fix(popover): fix the problem that popover display when the props'content is empty * refactor(popover): 更新代码判断逻辑 * test(popover): 添加popover的test * feat(popover): 更新snapshot * feat(popover): 更新剩余的snapshot * feat: optimize dropdown accessbility (#33893) * feat: optimize dropdown accessbility * chore: bump rc-dropdown version * docs(✨): release 4.18.6 (#33948) * docs(✨): release 4.18.6 * chore: update version * docs: add date * fix: custom color should work on antd icons (#33951) * feat: tooltip round arrow (#33710) * feat: tooltip round arrow * chore: update demo * docs: update docs * feat: rounded arrow in Tooltip/Popover/Popconfirm/Dropdown/RangePicker * chore: code clean * fix: fill gap * chore: code clean * chore: raise css bundle size * fix: arrow style * feat: use full path * test: update snapshot * perf: hack firefox * perf: more magic position * perf: RangePicker's arrow position * chore: bump rc-picker version * fix: arrow position * chore(deps): update dependency react-dnd-html5-backend to v15 (#33941) Co-authored-by: Renovate Bot * feat: inputNumber controls support customize upIcon/downIcon (#33914) * feat: inputNumber controls support customize upIcon/downIcon * feat: 修改代码格式问题 * feat: 更新snapshot,修改代码开启prettier * feat: 更新snapshot,order 属性修改 * feat: upIcon/downIcon写法调整 * feat: 更新snapshot * fix: Exception in enter key callback on editable or copyable Paragraph (#33976) * fix: Exception on enter key callback * Move spyOn position * docs: 4.18.6 changelog optimization (#33990) * fix: class names of Row and Col components when using custom prefix (#33969) * feat: Exposes additional props for pagination component on transfer (#33954) * Exposes additional props for pagination component on transfer * feat: Improve transfer pagination customization * feat: Improve transfer pagination customization * fix: Typography copyable add stopPropagation (#33998) * fix: Typography copyable add stopPropagation * add test * chore(deps): update dependency react-dnd to v15 (#33940) * chore(deps): update dependency react-dnd to v15 * fix: Tabs demo * fix: demo Co-authored-by: Renovate Bot Co-authored-by: afc163 * fix: Pagination and Rate style bug in Safari (#34002) * fix: Pagination and Rate style bug in safari close #33965 * fix style * docs: fix missing @/services/product (#34003) * docs: fix missing @/services/product close #33952 * update data * docs: improve Select dropdownRender demo style (#34004) * chore: remove unused interface file (#34011) * style: improve Menu :focus-visible style (#34008) * style: improve Menu :focus-visible style ref #34005 * style: darken :focus-visible style * fix: typography ellipsis check in transform (#34007) * fix: typography ellipsis check in transform * test: Update snapshot * chore: btn default provide default cls (#34013) * fix: cascader's onChange ts adapts to single and multiple (#33947) * fix to: cascader's multiple determines the declaration of onChange * fix: cascader's onChange ts adapts to single and multiple * test: fix * docs: more acurrate description about Menu overflowedIndicator prop (#34022) * docs: add info about Menu overflowedIndicator prop close #34016 * fix doc * fix textarea maxlength issue (#33910) * fix: textarea maxlength * refactor: delete some useless code * refactor: fix ci * refactor and fix test case fall * update snapshot * add testcase * refactor type defined * fix: min/max validators in pl_PL locale returning undefined (#34024) Co-authored-by: Michał Podeszwa <178679-michalpodeszwa@users.noreply.gitlab.com> * fix: useLayoutEffect to useIsomorphicLayoutEffect (#33818) * fix: useLayoutEffect to useIsomorphicLayoutEffect * chore: change to rc-util/lib/hooks/useLayoutEffect * ci: files modify cancel failed * feat: Add ability to overwrite Menu theme at Menu.SubMenu level. (#33971) * Add theme support to Menu.SubMenu * Tidy up docs * Tidy up docs * Update components/menu/index.en-US.md * Update components/menu/index.en-US.md Co-authored-by: Amumu * Add Chinese lang docs * Extend menu theme demo to additionally demonstrate Sub-menu theming * Add submenu theme demo * Revert "Extend menu theme demo to additionally demonstrate Sub-menu theming" This reverts commit 642a2b5b72322eb5f6d06d6eb644f877e7f6119c. * Add tests * Correct typo * Make demo vertical so absolutely positioned popover doesn't overflow * Make demo functional component * Update components/menu/index.en-US.md Co-authored-by: afc163 * Update components/menu/index.zh-CN.md Co-authored-by: Amumu * Update components/menu/demo/submenu-theme.md Co-authored-by: MadCcc <1075746765@qq.com> Co-authored-by: Amumu Co-authored-by: afc163 Co-authored-by: MadCcc <1075746765@qq.com> * docs: 4.18.7 changelog (#34041) * feat: Input support status (#33995) * feat: remove form status style && input support status * test: update snapshot * feat: update status prop in config provider * fix: form item validateStatus support * chore: code clean * feat: status classname change * test: update snapshot * refactor: move formItemStatusContext to form folder * refactor: merge utils * refactor: rename statusUtils * chore: code clean * test: fix coverage * chore: remove status prop of Form.Item * chore: code clean * docs: update demo * test: fix lint * feat: status only success and warning * test: fix lint * docs: update deamo * test: Udpate test for rc-util@latest * docs: Patch adjust changelog desc * chore: update snapshot * chore: script update (#34060) * chore(deps): update dependency stylelint-config-standard to v25 (#34028) * chore(deps): update dependency stylelint-config-standard to v25 * fix stylelint lint Co-authored-by: Renovate Bot Co-authored-by: tanghui * chore: Update sk_SK locales (#34061) * chore: Update sk_SK locales * Disable eslint rule, based on defaults (EN) * feat: inputNumber support status (#34042) * feat: inputNumber support status * test: fix test * feat: custom status first * refactor: getMergedStatus pass status in params * ci: add MadCcc assign * perf: OPT table render perf (#34075) * fix: Typography copyable in clipboard incorrect (#34034) Co-authored-by: chenxq * docs: fix procomponents links * test: skip layout demo which failed a lot in argoci * docs: improve Umi documentation * feat: mentions support status (#34071) * test: skip form deps-lint * perf: remove useless has-feedback classname * test: raise test coverage * style: recover import arrangement * feat: DatePicker and TimePicker support status (#34073) * feat: DatePicker and TimePicker support status * docs: demo add version * chore: code clean * feat: select support status (#34084) * feat: select support status * test: fix lint * fix: update quarter picker placeholder for RangePicker (#34089) * feat: cascader support status (#34086) * feat: cascader support status * chore: code clean * chore: raise bundle size limitation * chore: code clean * feat: TreeSelect support status (#34093) * feat: TreeSelect support status * chore: code clean * docs: add demo version * feat: AutoComplete support status (#34096) * feat: AutoComplete support status * test: update snapshot * feat: transfer support status (#34098) * feat: transfer support status * docs: update demo * fix: Table render twice on first mount (#34106) * fix: Table render twice * chore: clean up * test: Fix test case * fix: remove duplicated style (#34101) * fix: remove duplicated style * chore: reduce bundle size limitation * chore: raise bundle size * docs: Multiple displayRender support (#34116) * fix: Form layout when Select has long text (#34117) * fix: Form layout when Select has long text close #33773 * chore: update snapshot * fix: not crash ConfigProvider.config on server side (#34118) * fix: Invalid memoized context value in Menu (#34121) * chore(deps): update dependency eslint-plugin-unicorn to v41 (#34133) Co-authored-by: Renovate Bot * chore(deps): update actions-cool/issues-helper action to v3 (#34132) Co-authored-by: Renovate Bot * docs: fix grammar error (#34138) in customize-theme-variable.zh-CN.md * fix: del messageInstance when configuring getContainer (#34123) * fix: del messageInstance when configuring getContainer * test: move the new test to the bottom of the test lists * fix: Layout component SiderProps type not exported (#34137) * perf: Improve Components render perfermance when it's not reponsive (#34122) * perf: Improve List render perfermance when grid is undefined https://github.com/ant-design/ant-design/pull/34106/files#diff-9e016ea02fe7dd0ea42d8774d29d45e1a10b8dd108de9c89d50c828c74b993b8R146-R151 * chore: do not export useBreakpoint param Co-authored-by: zombiej * docs: 4.18.8 changelog (#34146) * chore: bump version to 4.18.8 * docs: 4.18.8 changelog * docs: update changelog * docs: update changelog * docs: update changelog * fix: form initial values get modified (#34153) * chore: fix ts error in site * chore: fix Chinese expression about "的地得" (#34173) close #34167 * fix(upload): onChange params type err (#34161) * fix(upload): onChange params type err * test(upload): check onChange params type * fix: Dropdown item style when text is long (#34177) close #34176 * fix: issue #34015 cascader document of option less isleaf param (#34174) * fix: issue #34015 cascader document of option less isleaf param * fix: add comment * fix: comment change Co-authored-by: zengguhao.zgh * fix: Overview page EditableProTable link error (#34181) * docs: add MasterGo to design assets (#34055) * docs: add MasterGo to design assets * chore: update mastergo links * feat: table FilterDropdown support `clearFilters({ confirm: false, closeDropdown: false })` (#34120) * feat: table FilterDropdown support `clearFilters({ confirm: boolean })` * feat: update `clearFilters` and `confirm` * feat: add FilterRestProps,update document * feat: update onReset params order * feat: add test case * feat: table filterSearch supports function (#34085) * feat: table filterSearch supports function * feat: update for test * feat: update document * test: disabled react/jsx-key * chore: lock eslint-plugin-react (#34214) * Revert "test: disabled react/jsx-key" This reverts commit 7d64967d637ce1043467abd7802b872cfe8cc09d. * chore: lock eslint-plugin-react@7.28.0 * feat: add variable for aliyun theme of drawer (#34188) Co-authored-by: zhaohonghai * feat: add variable for aliyun theme of dropdown (#34189) Co-authored-by: zhaohonghai * fix: remove lock for eslint-plugin-react (#34220) * feat: add variable for aliyun theme of modal (#34191) Co-authored-by: zhaohonghai * feat: add variable for aliyun theme of divider (#34187) Co-authored-by: zhaohonghai * feat: add variable for aliyun theme of radio (#34194) Co-authored-by: zhaohonghai * docs: update maintainer for changelog script * docs: add changelog 4.18.9 (#34236) * docs: add changelog 4.18.9 * docs: update * docs: update * Update CHANGELOG.zh-CN.md * feat: introduce rc-input (#34206) * feat: introduce rc-input * fix: export InputRef alias * docs: fix demo * chore: code clean * test: fix lint * test: test coverage * chore: code clean * chore: code clean * test: update snapshot * refactor: Update rc-slider (#34234) * chore: Update rc-slider version * chore: bump * chore: update sty;e * fix: style * test: update snapshot * test: all fixed * fix lint * docs: update links of mastergo (#34242) * feat: add utm to mastergo's links (#34248) * chore(deps-dev): bump typescript from 4.5.5 to 4.6.2 (#34249) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.5 to 4.6.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.5.5...v4.6.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * refactor: change usecontext of divider prepare for v5 (#34246) Co-authored-by: zengguhao.zgh * refactor: Wrap affix with FC (#34254) * test: fix * chore: ts fix * chore: update ts def * test: fix test * fix: Form doc "resetFields" args type (#34262) * style: remove overriding !important from input border right width styles (#34178) * docs: add description about onClear prop in AutoComplete doc (#34292) * fix: editable Typography.Title should match font size while editing (#34169) * feat: editable Typography.Title should match font size while editing * feat: update style * feat: update style * feat: update style * feat: style lint * feat: update style * Update components/typography/style/index.less * Update components/typography/Editable.tsx * feat: reorganize css * feat: style lint * feat: update snap Co-authored-by: afc163 * fix: limit input class due to rc-input won't override input class (#34294) * fix: limit input class due to rc-input won't override input class * fix: add feedback into affix judgement * fix: Tree filter select all behavior (#34295) ref https://github.com/ant-design/ant-design/issues/34280 * fix: typography title margin issue (#34302) * fix: modify README.md Co-authored-by: guhao.zeng <45565100+ZzGGitter@users.noreply.github.com> Co-authored-by: zengguhao.zgh Co-authored-by: binyellow <571704908@qq.com> Co-authored-by: 二货机器人 Co-authored-by: afc163 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot Co-authored-by: Nmaxwiver <9283555+hxmwr@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: MadCcc <1075746765@qq.com> Co-authored-by: dengqing <1247748612@qq.com> Co-authored-by: 2724635499 <2724635499@qq.com> Co-authored-by: 麦谷 <1141453778@qq.com> Co-authored-by: WeijieChen Co-authored-by: machixian Co-authored-by: chen-jingjie <35401187+chen-jingjie@users.noreply.github.com> Co-authored-by: Garrick Crouch Co-authored-by: Xi Ming <46511237+seki2020@users.noreply.github.com> Co-authored-by: Pablo Recalde Co-authored-by: Ryan Lee Co-authored-by: Peach Co-authored-by: xrkffgg Co-authored-by: Wuif <5678318+wuifdesign@users.noreply.github.com> Co-authored-by: Jason Miller Co-authored-by: uchanlee Co-authored-by: Long Hao (龙濠) <45565100+LongHaoo@users.noreply.github.com> Co-authored-by: Amumu Co-authored-by: NothingToDo <49073282+hemengke1997@users.noreply.github.com> Co-authored-by: Shanjie Chen Co-authored-by: xrkffgg Co-authored-by: qin20 <10720918+qin20@users.noreply.github.com> Co-authored-by: 秦缘斌 Co-authored-by: 陈帅 Co-authored-by: 期贤 Co-authored-by: dimbslmh <745635+dimbslmh@users.noreply.github.com> Co-authored-by: dimbslmh Co-authored-by: Dan Greene <14020024+dgreene1@users.noreply.github.com> Co-authored-by: zhenfan.yu Co-authored-by: whwangms Co-authored-by: ZhouZhen <503633021@qq.com> Co-authored-by: hydraZty <670688667@qq.com> Co-authored-by: hydraZty Co-authored-by: toSayNothing <91143836+toSayNothing@users.noreply.github.com> Co-authored-by: PlayerWho Co-authored-by: Di Wu Co-authored-by: yanm1ng <644169721@qq.com> Co-authored-by: 亦逊 Co-authored-by: VIREAK KEOSOKVIBOL <46261326+vireakkeosokvibol@users.noreply.github.com> Co-authored-by: vagusX Co-authored-by: dengqing Co-authored-by: Cat-XHS <1349021570@qq.com> Co-authored-by: 礼检 Co-authored-by: 王浩 Co-authored-by: wanghao Co-authored-by: Eliot Sanford Co-authored-by: Yang Zhang <7129+yang@users.noreply.github.com> Co-authored-by: Cole Co-authored-by: chenqiufan Co-authored-by: codefactor-io Co-authored-by: 黑雨 Co-authored-by: tangjinzhou <415800467@qq.com> Co-authored-by: Amour1688 Co-authored-by: Dawnlck Co-authored-by: mic-web <4804412+mic-web@users.noreply.github.com> Co-authored-by: Jase Owens Co-authored-by: linxianxi <47104575+linxianxi@users.noreply.github.com> Co-authored-by: babycannotsay <335658202@qq.com> Co-authored-by: chenyizhongx <31769726+chenyizhongx@users.noreply.github.com> Co-authored-by: Michał Podeszwa Co-authored-by: Michał Podeszwa <178679-michalpodeszwa@users.noreply.gitlab.com> Co-authored-by: soso Co-authored-by: David <97387061+david-cord@users.noreply.github.com> Co-authored-by: Filip Seman Co-authored-by: opopeieie Co-authored-by: chenxq Co-authored-by: stefango Co-authored-by: TrickyPi <33021497+TrickyPi@users.noreply.github.com> Co-authored-by: Picsong <312465087@qq.com> Co-authored-by: Dave Co-authored-by: 李瀚 <44010674+lihansir@users.noreply.github.com> Co-authored-by: KaKaHuoLuoTe <99702968+KaKaHuoLuoTe@users.noreply.github.com> Co-authored-by: qdzhaoxiaodao <32627250+qdzhaoxiaodao@users.noreply.github.com> Co-authored-by: zhaohonghai Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Zach Bird <546439325@qq.com> Co-authored-by: aghArdeshir Co-authored-by: Karott Schu Co-authored-by: zhang lay --- .github/ISSUE_TEMPLATE/config.yml | 8 + .../template-1-bug-report.yml.close | 99 + .../template-2-feature-request.yml.close | 50 + .github/workflows/issue-check-inactive.yml | 2 +- .github/workflows/issue-close-require.yml | 4 +- .github/workflows/issue-labeled.yml | 12 +- .github/workflows/issue-open-check.yml | 14 +- .github/workflows/issue-remove-inactive.yml | 2 +- .github/workflows/pr-check-ci.yml | 2 +- .github/workflows/pr-check-merge.yml | 2 +- .github/workflows/release-helper.yml | 4 +- .github/workflows/verify-files-modify.yml | 3 +- .stylelintrc.json | 19 + CHANGELOG.en-US.md | 95 + CHANGELOG.zh-CN.md | 96 + README.md | 2 +- components/_util/motion.tsx | 13 +- components/{tooltip => _util}/placements.tsx | 3 +- components/_util/statusUtils.tsx | 44 + components/affix/__tests__/Affix.test.tsx | 10 +- .../__snapshots__/demo-extend.test.ts.snap | 2 +- .../__tests__/__snapshots__/demo.test.ts.snap | 2 +- components/affix/index.tsx | 8 +- components/affix/utils.ts | 7 +- .../__snapshots__/demo-extend.test.ts.snap | 4 +- .../__tests__/__snapshots__/demo.test.ts.snap | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 111 +- .../__tests__/__snapshots__/demo.test.js.snap | 83 +- components/auto-complete/demo/status.md | 42 + components/auto-complete/index.en-US.md | 10 +- components/auto-complete/index.tsx | 2 + components/auto-complete/index.zh-CN.md | 10 +- .../__snapshots__/demo-extend.test.ts.snap | 10 +- .../__tests__/__snapshots__/demo.test.js.snap | 10 +- components/avatar/avatar.tsx | 5 +- .../__snapshots__/demo-extend.test.ts.snap | 6 +- .../__tests__/__snapshots__/demo.test.js.snap | 6 +- components/badge/style/ribbon.less | 6 +- components/badge/style/rtl.less | 8 +- components/breadcrumb/BreadcrumbItem.tsx | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 66 +- .../__tests__/__snapshots__/demo.test.ts.snap | 66 +- .../__snapshots__/index.test.tsx.snap | 36 +- .../button/__tests__/delay-timer.test.tsx | 89 + components/button/button.tsx | 20 +- components/button/style/index.less | 4 +- components/button/style/mixin.less | 2 +- .../__snapshots__/index.test.js.snap | 2 +- components/card/__tests__/index.test.js | 18 + components/card/index.tsx | 8 +- .../__snapshots__/demo-extend.test.ts.snap | 543 +- .../__tests__/__snapshots__/demo.test.js.snap | 267 +- components/cascader/__tests__/index.test.js | 29 +- components/cascader/__tests__/type.test.tsx | 14 + components/cascader/demo/multiple.md | 28 +- components/cascader/demo/placement.md | 77 + components/cascader/demo/status.md | 28 + components/cascader/index.en-US.md | 9 +- components/cascader/index.tsx | 61 +- components/cascader/index.zh-CN.md | 8 +- components/cascader/style/index.tsx | 2 + components/checkbox/Checkbox.tsx | 1 + components/checkbox/__tests__/group.test.js | 39 +- components/checkbox/style/mixin.less | 1 + .../__snapshots__/components.test.js.snap | 216 +- .../config-provider/__tests__/index.test.js | 6 +- .../config-provider/__tests__/theme.test.ts | 39 +- components/config-provider/cssVariables.tsx | 14 +- .../date-picker/__tests__/DatePicker.test.js | 32 + .../date-picker/__tests__/RangePicker.test.js | 7 + .../__snapshots__/demo-extend.test.ts.snap | 6285 +++++++++++++---- .../__tests__/__snapshots__/demo.test.js.snap | 393 ++ .../date-picker/__tests__/type.test.tsx | 34 + components/date-picker/demo/placement.md | 47 + components/date-picker/demo/range-picker.md | 1 + components/date-picker/demo/status.md | 28 + .../generatePicker/generateRangePicker.tsx | 4 +- .../generatePicker/generateSinglePicker.tsx | 98 +- .../date-picker/generatePicker/index.tsx | 16 +- .../date-picker/generatePicker/interface.tsx | 9 +- components/date-picker/index.en-US.md | 2 + components/date-picker/index.zh-CN.md | 2 + components/date-picker/locale/en_GB.tsx | 1 + components/date-picker/locale/en_US.tsx | 1 + components/date-picker/locale/zh_CN.tsx | 1 + components/date-picker/locale/zh_TW.tsx | 1 + components/date-picker/style/index.less | 36 +- components/date-picker/style/index.tsx | 2 + components/date-picker/style/panel.less | 4 +- components/date-picker/style/status.less | 52 + components/date-picker/util.ts | 58 + components/divider/index.tsx | 98 +- components/divider/style/index.less | 2 +- .../__snapshots__/DrawerEvent.test.js.snap | 2 +- components/drawer/style/drawer.less | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 1338 +++- .../__tests__/__snapshots__/demo.test.js.snap | 108 +- .../dropdown-button.test.js.snap | 8 +- .../__snapshots__/index.test.js.snap | 4 +- components/dropdown/__tests__/index.test.js | 20 + components/dropdown/demo/arrow-center.md | 75 + components/dropdown/demo/arrow.md | 8 +- components/dropdown/demo/dropdown-button.md | 2 +- components/dropdown/demo/placement.md | 8 +- components/dropdown/dropdown.tsx | 33 +- components/dropdown/index.en-US.md | 6 +- components/dropdown/index.zh-CN.md | 6 +- components/dropdown/style/index.less | 53 +- components/form/FormItem.tsx | 49 +- components/form/FormItemInput.tsx | 28 - .../__snapshots__/demo-extend.test.ts.snap | 1534 ++-- .../__tests__/__snapshots__/demo.test.js.snap | 1303 ++-- components/form/context.tsx | 7 + components/form/demo/advanced-search.md | 15 +- components/form/demo/validate-static.md | 23 +- components/form/index.en-US.md | 2 +- components/form/index.zh-CN.md | 2 +- components/form/style/horizontal.less | 7 + components/form/style/mixin.less | 30 - components/form/style/status.less | 268 - .../__snapshots__/demo-extend.test.ts.snap | 90 +- .../__tests__/__snapshots__/demo.test.js.snap | 90 +- .../__tests__/cached-row-context.test.tsx | 48 + components/grid/hooks/useBreakpoint.tsx | 15 +- components/grid/index.tsx | 7 +- components/grid/row.tsx | 12 +- components/grid/style/index.less | 23 +- components/index.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 467 ++ .../__tests__/__snapshots__/demo.test.js.snap | 467 ++ .../__snapshots__/index.test.js.snap | 178 + .../input-number/__tests__/index.test.js | 38 + components/input-number/demo/controls.md | 25 + components/input-number/demo/status.md | 31 + components/input-number/index.en-US.md | 3 +- components/input-number/index.tsx | 77 +- components/input-number/index.zh-CN.md | 3 +- components/input-number/style/affix.less | 23 +- components/input-number/style/index.less | 1 + components/input-number/style/index.tsx | 2 + components/input-number/style/status.less | 45 + components/input/ClearableLabeledInput.tsx | 159 +- components/input/Input.tsx | 463 +- components/input/Password.tsx | 4 +- components/input/Search.tsx | 10 +- components/input/TextArea.tsx | 89 +- components/input/__tests__/Password.test.js | 2 +- .../__snapshots__/Password.test.js.snap | 6 +- .../__snapshots__/Search.test.js.snap | 16 +- .../__snapshots__/demo-extend.test.ts.snap | 519 +- .../__tests__/__snapshots__/demo.test.js.snap | 519 +- .../__snapshots__/index.test.js.snap | 264 +- components/input/__tests__/focus.test.tsx | 10 +- components/input/__tests__/index.test.js | 20 +- components/input/__tests__/textarea.test.js | 81 + components/input/demo/status.md | 31 + components/input/demo/textarea.md | 10 +- components/input/demo/tip.md | 29 - components/input/index.en-US.md | 1 + components/input/index.tsx | 15 +- components/input/index.zh-CN.md | 3 +- components/input/style/affix.less | 4 + components/input/style/allow-clear.less | 2 +- components/input/style/index.less | 1 + components/input/style/index.tsx | 1 + components/input/style/mixin.less | 54 +- components/input/style/status.less | 82 + components/input/utils.ts | 20 +- components/layout/Sider.tsx | 2 +- .../__tests__/dynamic-breakpoint.test.tsx | 47 + components/layout/__tests__/image.test.ts | 2 +- components/list/index.tsx | 5 +- components/list/index.zh-CN.md | 2 +- .../__snapshots__/index.test.js.snap | 5666 ++++++++------- components/locale-provider/index.tsx | 7 +- components/locale/km_KH.tsx | 8 +- components/locale/pl_PL.tsx | 4 +- components/locale/sk_SK.tsx | 77 +- .../__snapshots__/demo-extend.test.ts.snap | 38 +- .../__tests__/__snapshots__/demo.test.js.snap | 38 +- components/mentions/demo/status.md | 51 + components/mentions/index.en-US.md | 47 +- components/mentions/index.tsx | 33 +- components/mentions/index.zh-CN.md | 53 +- components/mentions/style/index.less | 1 + components/mentions/style/index.tsx | 2 + components/mentions/style/status.less | 43 + components/menu/SubMenu.tsx | 11 +- .../__snapshots__/demo-extend.test.ts.snap | 363 + .../__tests__/__snapshots__/demo.test.js.snap | 97 + .../menu/__tests__/cached-context.test.tsx | 55 + components/menu/__tests__/index.test.js | 26 + components/menu/demo/submenu-theme.md | 65 + components/menu/demo/switch-mode.md | 2 +- components/menu/index.en-US.md | 5 +- components/menu/index.tsx | 36 +- components/menu/index.zh-CN.md | 5 +- components/menu/style/dark.less | 15 + components/menu/style/index.less | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 14 +- .../__tests__/__snapshots__/demo.test.js.snap | 14 +- components/message/__tests__/config.test.js | 31 + components/message/index.tsx | 1 + .../__snapshots__/Modal.test.js.snap | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 28 +- .../__tests__/__snapshots__/demo.test.js.snap | 28 +- components/modal/style/confirm.less | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 79 +- .../__tests__/__snapshots__/demo.test.js.snap | 79 +- .../notification/__tests__/placement.test.js | 32 + components/notification/demo/placement.md | 13 + components/notification/index.tsx | 24 +- components/notification/index.zh-CN.md | 2 +- components/notification/style/index.less | 14 + .../__snapshots__/demo-extend.test.ts.snap | 22 +- .../__tests__/__snapshots__/demo.test.js.snap | 22 +- components/pagination/Pagination.tsx | 5 +- components/pagination/style/index.less | 48 +- .../__snapshots__/demo-extend.test.ts.snap | 60 +- .../__tests__/__snapshots__/demo.test.js.snap | 24 +- .../__snapshots__/index.test.js.snap | 6 +- .../__snapshots__/demo-extend.test.ts.snap | 36 +- .../__tests__/__snapshots__/demo.test.js.snap | 36 +- .../__snapshots__/index.test.js.snap | 2 - components/popover/__tests__/index.test.js | 18 +- components/popover/index.tsx | 15 +- components/popover/style/index.less | 13 +- .../__snapshots__/demo-extend.test.ts.snap | 8 +- .../__tests__/__snapshots__/demo.test.js.snap | 8 +- components/radio/style/index.less | 2 +- components/rate/style/index.less | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 676 +- .../__tests__/__snapshots__/demo.test.js.snap | 283 +- .../select/demo/custom-dropdown-menu.md | 84 +- components/select/demo/placement.md | 53 + components/select/demo/status.md | 34 + components/select/index.en-US.md | 4 +- components/select/index.tsx | 40 +- components/select/index.zh-CN.md | 4 +- components/select/style/index.less | 4 +- components/select/style/index.tsx | 2 + components/select/style/status.less | 80 + components/select/utils/iconUtil.tsx | 21 +- components/skeleton/Input.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 16 +- .../__tests__/__snapshots__/demo.test.js.snap | 16 +- components/skeleton/demo/element.md | 9 +- components/skeleton/style/index.less | 9 +- .../__snapshots__/demo-extend.test.ts.snap | 279 +- .../__tests__/__snapshots__/demo.test.js.snap | 270 +- .../__snapshots__/index.test.js.snap | 16 +- components/slider/__tests__/index.test.js | 8 +- components/slider/index.tsx | 120 +- components/slider/style/index.less | 22 +- components/slider/style/rtl.less | 21 - .../__snapshots__/demo-extend.test.ts.snap | 69 +- .../__tests__/__snapshots__/demo.test.js.snap | 63 +- components/space/index.tsx | 6 +- .../__snapshots__/demo-extend.test.ts.snap | 14 +- .../__tests__/__snapshots__/demo.test.js.snap | 14 +- components/steps/index.tsx | 8 +- components/style/mixins/iconfont.less | 2 +- components/style/mixins/index.less | 1 + components/style/mixins/rounded-arrow.less | 37 + components/style/themes/dark.less | 11 + components/style/themes/default.less | 6 + components/style/themes/variable.less | 8 +- components/table/Table.tsx | 16 +- .../table/__tests__/Table.filter.test.js | 465 +- .../table/__tests__/Table.sorter.test.js | 95 +- .../__snapshots__/Table.filter.test.js.snap | 560 +- .../__snapshots__/Table.sorter.test.js.snap | 1 + .../__snapshots__/demo-extend.test.ts.snap | 840 ++- .../__tests__/__snapshots__/demo.test.js.snap | 352 +- components/table/demo/custom-filter-panel.md | 4 +- components/table/demo/edit-cell.md | 4 +- components/table/demo/filter-search.md | 99 + .../table/hooks/useFilter/FilterDropdown.tsx | 45 +- .../table/hooks/useFilter/FilterSearch.tsx | 4 +- components/table/hooks/useSelection.tsx | 6 +- components/table/hooks/useSorter.tsx | 9 + components/table/index.en-US.md | 2 +- components/table/index.zh-CN.md | 2 +- components/table/interface.tsx | 1 + components/table/style/index.less | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 59 +- .../__tests__/__snapshots__/demo.test.js.snap | 59 +- components/tabs/demo/custom-tab-bar-node.md | 88 +- components/tabs/style/index.less | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 2830 ++++++++ .../__tests__/__snapshots__/demo.test.js.snap | 100 + components/time-picker/demo/status.md | 28 + components/time-picker/index.en-US.md | 38 +- components/time-picker/index.tsx | 2 + components/time-picker/index.zh-CN.md | 46 +- components/timeline/TimelineItem.tsx | 7 +- .../__snapshots__/demo-extend.test.ts.snap | 40 +- .../__tests__/__snapshots__/demo.test.js.snap | 40 +- components/timeline/demo/color.md | 4 + .../__snapshots__/demo-extend.test.ts.snap | 74 +- .../__tests__/__snapshots__/demo.test.js.snap | 66 +- .../__snapshots__/tooltip.test.js.snap | 28 +- components/tooltip/__tests__/tooltip.test.js | 20 +- components/tooltip/index.tsx | 24 +- components/tooltip/style/index.less | 21 +- components/transfer/ListBody.tsx | 7 +- .../__snapshots__/demo-extend.test.ts.snap | 1404 +++- .../__tests__/__snapshots__/demo.test.js.snap | 888 ++- .../__snapshots__/search.test.js.snap | 66 +- components/transfer/demo/status.md | 29 + components/transfer/index.en-US.md | 3 +- components/transfer/index.tsx | 222 +- components/transfer/index.zh-CN.md | 3 +- components/transfer/interface.ts | 3 + components/transfer/style/index.less | 1 + components/transfer/style/index.tsx | 2 + components/transfer/style/status.less | 31 + .../__snapshots__/demo-extend.test.ts.snap | 706 ++ .../__tests__/__snapshots__/demo.test.js.snap | 265 + components/tree-select/demo/placement.md | 64 + components/tree-select/demo/status.md | 33 + components/tree-select/index.en-US.md | 2 + components/tree-select/index.tsx | 37 +- components/tree-select/index.zh-CN.md | 2 + components/tree-select/style/index.tsx | 2 +- .../__snapshots__/demo-extend.test.ts.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 +- components/typography/Base.tsx | 602 -- components/typography/Base/Ellipsis.tsx | 212 + .../typography/Base/EllipsisTooltip.tsx | 32 + components/typography/Base/index.tsx | 511 ++ components/typography/Editable.tsx | 6 + components/typography/Link.tsx | 4 +- .../__snapshots__/demo-extend.test.ts.snap | 594 +- .../__tests__/__snapshots__/demo.test.js.snap | 402 +- components/typography/__tests__/copy.test.tsx | 43 + .../typography/__tests__/ellipsis.test.js | 310 + .../__tests__/enter-key-callback.test.tsx | 32 + components/typography/__tests__/index.test.js | 215 +- components/typography/demo/ellipsis-debug.md | 12 +- components/typography/demo/interactive.md | 18 +- .../typography/hooks/useMergedConfig.ts | 18 + .../typography/hooks/useUpdatedEffect.ts | 14 + components/typography/index.en-US.md | 2 + components/typography/index.zh-CN.md | 2 + components/typography/style/index.less | 14 + components/typography/util.tsx | 249 - components/upload/Upload.tsx | 11 +- components/upload/UploadList/index.tsx | 6 +- .../__snapshots__/demo-extend.test.ts.snap | 32 +- .../__tests__/__snapshots__/demo.test.js.snap | 32 +- components/upload/__tests__/type.test.tsx | 14 + components/upload/__tests__/upload.test.js | 22 + components/upload/index.en-US.md | 8 +- components/upload/interface.tsx | 3 +- docs/react/contributing.en-US.md | 10 + docs/react/contributing.zh-CN.md | 10 + docs/react/customize-theme-variable.zh-CN.md | 2 +- docs/react/i18n.en-US.md | 26 + docs/react/i18n.zh-CN.md | 26 + docs/react/practical-projects.en-US.md | 53 +- docs/react/practical-projects.zh-CN.md | 53 +- docs/resources.en-US.md | 8 + docs/resources.zh-CN.md | 4 + docs/spec/copywriting.zh-CN.md | 6 +- package.json | 51 +- scripts/notice-seaTalk.js | 2 + scripts/post-script.js | 88 + scripts/print-changelog.js | 1 + site/bisheng.config.js | 4 +- site/theme/en-US.js | 3 - site/theme/template/Content/MainContent.jsx | 4 +- site/theme/template/Home/Banner/index.tsx | 48 +- .../template/Layout/Header/SearchBar.tsx | 1 + site/theme/zh-CN.js | 3 - tests/shared/focusTest.tsx | 42 +- 380 files changed, 32020 insertions(+), 10268 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/template-1-bug-report.yml.close create mode 100644 .github/ISSUE_TEMPLATE/template-2-feature-request.yml.close rename components/{tooltip => _util}/placements.tsx (97%) create mode 100644 components/_util/statusUtils.tsx create mode 100644 components/auto-complete/demo/status.md create mode 100644 components/button/__tests__/delay-timer.test.tsx create mode 100644 components/cascader/demo/placement.md create mode 100644 components/cascader/demo/status.md create mode 100644 components/date-picker/demo/placement.md create mode 100644 components/date-picker/demo/status.md create mode 100644 components/date-picker/style/status.less create mode 100644 components/dropdown/demo/arrow-center.md create mode 100644 components/grid/__tests__/cached-row-context.test.tsx create mode 100644 components/input-number/demo/controls.md create mode 100644 components/input-number/demo/status.md create mode 100644 components/input-number/style/status.less create mode 100644 components/input/demo/status.md delete mode 100644 components/input/demo/tip.md create mode 100644 components/input/style/status.less create mode 100644 components/layout/__tests__/dynamic-breakpoint.test.tsx create mode 100644 components/mentions/demo/status.md create mode 100644 components/mentions/style/status.less create mode 100644 components/menu/__tests__/cached-context.test.tsx create mode 100755 components/menu/demo/submenu-theme.md create mode 100644 components/select/demo/placement.md create mode 100644 components/select/demo/status.md create mode 100644 components/select/style/status.less create mode 100644 components/style/mixins/rounded-arrow.less create mode 100644 components/table/demo/filter-search.md create mode 100644 components/time-picker/demo/status.md create mode 100644 components/transfer/demo/status.md create mode 100644 components/transfer/style/status.less create mode 100644 components/tree-select/demo/placement.md create mode 100644 components/tree-select/demo/status.md delete mode 100644 components/typography/Base.tsx create mode 100644 components/typography/Base/Ellipsis.tsx create mode 100644 components/typography/Base/EllipsisTooltip.tsx create mode 100644 components/typography/Base/index.tsx create mode 100644 components/typography/__tests__/ellipsis.test.js create mode 100644 components/typography/__tests__/enter-key-callback.test.tsx create mode 100644 components/typography/hooks/useMergedConfig.ts create mode 100644 components/typography/hooks/useUpdatedEffect.ts delete mode 100644 components/typography/util.tsx create mode 100644 scripts/post-script.js diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000000..10f81b3670c8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: true +contact_links: + - name: 🆕 Create new issue + url: http://new-issue.ant.design + about: The issue which is not created via http://new-issue.ant.design will be closed immediately. + - name: 🆕 创建一个新 Issue + url: http://new-issue.ant.design + about: 不是用 http://new-issue.ant.design 创建的 issue 会被机器人自动关闭。另外『如何使用...』类问题建议使用讨论区 https://github.com/ant-design/ant-design/discussions diff --git a/.github/ISSUE_TEMPLATE/template-1-bug-report.yml.close b/.github/ISSUE_TEMPLATE/template-1-bug-report.yml.close new file mode 100644 index 000000000000..005df9e64953 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/template-1-bug-report.yml.close @@ -0,0 +1,99 @@ +name: 🇨🇳 报告缺陷(beta) +description: 使用中文 Bug 报告模板提交一个缺陷,当然你也可以用 https://new-issue.ant.design +title: "[Bug] 请替换成合适的标题" +labels: ["🐛+Bug"] +body: + - type: markdown + attributes: + value: | + 除了此表单,你也可以使用 [Ant Design Issue Helper](https://new-issue.ant.design/) 来新建 issue。 + + Ant Design 的 issue 列表只接受 [Bug 报告](https://github.com/ant-design/ant-design/issues/new?assignees=&labels=%F0%9F%90%9B+Bug&template=template-1-bug-report.yml&title=%5BBug%5D+) 或是 [新功能请求](https://github.com/ant-design/ant-design/issues/new?assignees=&labels=%F0%9F%92%A1%2BFeature%2BRequest&template=template-2-feature-request.yml&title=%5BFeature+Request%5D+) (Feature Request)。这意味着我们不接受用法问题(How to 类问题)。如果你开的 issue 不符合规定,它将会被立刻关闭。[为什么要这么严格?](https://github.com/ant-design/antd-issue-helper/blob/master/src/locales/zh/introModal.md) + + 对于使用中遇到的问题,请使用以下资源: + + - 将用法类问题发到 [GitHub 讨论区](https://github.com/ant-design/ant-design/discussions) 而不是 Issue。 + - 仔细阅读 [使用文档](https://ant.design/docs/react/introduce-cn) 和 [组件文档](https://ant.design/components/overview-cn/)。 + - 提问前确保你在 [常见问题](https://ant.design/docs/react/faq-cn) 和 [更新日志](https://ant.design/changelog-cn) 中搜索过。 + - 在 [StackOverflow](https://stackoverflow.com/questions/tagged/antd) (英文) 或是 [SegmentFault](https://segmentfault.com/t/antd)(中文)搜索和提问。 + + 最后,在开 issue 前,可以先搜索一下以往的旧 issue - 你遇到的问题可能已经有人提了,也可能已经在最新版本中被修正。注意:如果你发现一个已经关闭的旧 issue 在最新版本中仍然存在,请不要在旧 issue 下面留言,而应该用下面的表单开一个新的 issue。 + + --- + - type: input + id: reproduce + attributes: + label: 重现链接 + description: 请提供一个尽可能精简的 [codesandbox](https://u.ant.design/codesandbox-repro) 或 [GitHub 仓库](https://github.com/ant-design/create-react-app-antd/) 的链接。[什么是最小化重现,为什么这是必需的?](https://github.com/ant-design/antd-issue-helper/blob/master/src/locales/zh/reproModal.md) + validations: + required: true + - type: input + id: version + attributes: + label: antd 版本 + description: 你正在使用的 antd 版本是多少?(注意不是 package.json 里的版本,而是 node_modules/antd 里实际安装的版本) + placeholder: 如 4.16.13 + validations: + required: true + - type: textarea + id: reproduce-steps + attributes: + label: 重现步骤 + description: 请提供一个傻瓜式的操作步骤,方便我们无脑重现问题。 + placeholder: | + 比如: + 1. 点击重现链接里的主按钮 + 2. 等待五秒钟 + 3. 观察按钮的边框 + validations: + required: true + - type: textarea + id: expected + attributes: + label: 期望的结果是什么? + placeholder: 比如:按钮样式正常,边框一直存在 + validations: + required: true + - type: textarea + id: reality + attributes: + label: 实际的结果是什么? + placeholder: 比如:按钮样式异常,边框突然丢失 + validations: + required: true + - type: dropdown + id: browsers + attributes: + label: 浏览器 + description: 在哪些浏览器上能重现这个问题? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Edge + - Internet Explorer + - Others + - type: input + id: browsers-version + attributes: + label: 浏览器版本 + placeholder: 如:版本 95.0.4638.69(正式版本) (x86_64) + - type: dropdown + id: os + attributes: + label: 操作系统 + description: 使用的操作系统是? + options: + - Windows + - MacOS + - iOS + - Android + - Others + - type: input + id: hidden-tag + attributes: + label: 其他 + description: 不要删除预填内容,否则 issue 会被自动关闭。 + value: + diff --git a/.github/ISSUE_TEMPLATE/template-2-feature-request.yml.close b/.github/ISSUE_TEMPLATE/template-2-feature-request.yml.close new file mode 100644 index 000000000000..b9e18c2028aa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/template-2-feature-request.yml.close @@ -0,0 +1,50 @@ +name: 🇨🇳 功能需求(beta) +description: 使用中文 Bug 报告模板提交一个功能需求,当然你也可以用 https://new-issue.ant.design +title: "[Feature Request] 请替换成合适的标题" +labels: ["💡+Feature+Request"] +body: + - type: markdown + attributes: + value: | + 除了此表单,你也可以使用 [Ant Design Issue Helper](https://new-issue.ant.design/) 来新建 issue。 + + Ant Design 的 issue 列表只接受 [Bug 报告](https://github.com/ant-design/ant-design/issues/new?assignees=&labels=%F0%9F%90%9B+Bug&template=template-1-bug-report.yml&title=%5BBug%5D+) 或是 [新功能请求](https://github.com/ant-design/ant-design/issues/new?assignees=&labels=%F0%9F%92%A1%2BFeature%2BRequest&template=template-2-feature-request.yml&title=%5BFeature+Request%5D+) (Feature Request)。这意味着我们不接受用法问题(How to 类问题)。如果你开的 issue 不符合规定,它将会被立刻关闭。[为什么要这么严格?](https://github.com/ant-design/antd-issue-helper/blob/master/src/locales/zh/introModal.md) + + 对于使用中遇到的问题,请使用以下资源: + + - 将用法类问题发到 [GitHub 讨论区](https://github.com/ant-design/ant-design/discussions) 而不是 Issue。 + - 仔细阅读 [使用文档](https://ant.design/docs/react/introduce-cn) 和 [组件文档](https://ant.design/components/overview-cn/)。 + - 提问前确保你在 [常见问题](https://ant.design/docs/react/faq-cn) 和 [更新日志](https://ant.design/changelog-cn) 中搜索过。 + - 在 [StackOverflow](https://stackoverflow.com/questions/tagged/antd) (英文) 或是 [SegmentFault](https://segmentfault.com/t/antd)(中文)搜索和提问。 + + 最后,在开 issue 前,可以先搜索一下以往的旧 issue - 你遇到的问题可能已经有人提了,也可能已经在最新版本中被修正。注意:如果你发现一个已经关闭的旧 issue 在最新版本中仍然存在,请不要在旧 issue 下面留言,而应该用下面的表单开一个新的 issue。 + + --- + - type: textarea + id: needs + attributes: + label: 这个功能解决了什么问题? + description: | + 请尽可能详尽地说明这个需求的用例和场景。最重要的是:解释清楚是怎样的用户体验需求催生了这个功能上的需求。 + Ant Design 的一个重要设计原则是保持 API 的简洁和直接。通常来说,我们只考虑添加在现有的 API 下无法轻松实现的功能。新功能的用例也应当足够常见。 + validations: + required: true + - type: textarea + id: api + attributes: + label: 你期望的 API 是怎样的? + description: | + 描述一下你期望这个新功能的 API 是如何使用的,并提供一些代码示例。请用 Markdown 格式化你的代码片段。 + 如果有新的 UI 界面,最好截图展示你期望的界面是什么样的? + placeholder: | + ```jsx + } {...props} /> + ``` + validations: + required: true + - type: input + id: hidden-tag + attributes: + label: 其他 + description: 不要删除预填内容,否则 issue 会被自动关闭。 + value: diff --git a/.github/workflows/issue-check-inactive.yml b/.github/workflows/issue-check-inactive.yml index 6ca5f9f3e8c3..df05004109a9 100644 --- a/.github/workflows/issue-check-inactive.yml +++ b/.github/workflows/issue-check-inactive.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-inactive - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'check-inactive' inactive-label: 'Inactive' diff --git a/.github/workflows/issue-close-require.yml b/.github/workflows/issue-close-require.yml index 24c129200095..31074703267a 100644 --- a/.github/workflows/issue-close-require.yml +++ b/.github/workflows/issue-close-require.yml @@ -9,14 +9,14 @@ jobs: runs-on: ubuntu-latest steps: - name: need reproduce - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'close-issues' labels: '🤔 Need Reproduce' inactive-day: 3 - name: needs more info - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'close-issues' labels: 'needs-more-info' diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index e3effb710b61..a6699fa1df14 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -12,7 +12,7 @@ jobs: steps: - name: help wanted if: github.event.label.name == 'help wanted' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -26,7 +26,7 @@ jobs: - name: 🤔 Need Reproduce if: github.event.label.name == '🤔 Need Reproduce' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -40,7 +40,7 @@ jobs: - name: Usage if: github.event.label.name == 'Usage' || github.event.label.name == 'Question' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -52,7 +52,7 @@ jobs: - name: 3.x if: github.event.label.name == '3.x' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -64,7 +64,7 @@ jobs: - name: invalid if: github.event.label.name == 'Invalid' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -76,7 +76,7 @@ jobs: - name: rtl if: github.event.label.name == 'rtl' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'add-assignees' assignees: 'xrkffgg' diff --git a/.github/workflows/issue-open-check.yml b/.github/workflows/issue-open-check.yml index 183d44acf94f..1f2112592fd0 100644 --- a/.github/workflows/issue-open-check.yml +++ b/.github/workflows/issue-open-check.yml @@ -16,7 +16,7 @@ jobs: - name: check invalid if: (contains(github.event.issue.body, 'ant-design-issue-helper') == false) && (steps.checkUser.outputs.result == 'false') - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,add-labels,close-issue' issue-number: ${{ github.event.issue.number }} @@ -27,7 +27,7 @@ jobs: 你好 @${{ github.event.issue.user.login }},为了能够进行高效沟通,我们对 issue 有一定的格式要求,你的 issue 因为不符合要求而被自动关闭。你可以通过 [issue 助手](http://new-issue.ant.design) 来创建 issue 以方便我们定位错误。谢谢配合! - name: check website - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 id: checkid with: actions: 'check-issue' @@ -37,7 +37,7 @@ jobs: - name: deal website if: steps.checkid.outputs.check-result == 'true' - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment,close-issue' issue-number: ${{ github.event.issue.number }} @@ -59,11 +59,11 @@ jobs: * Infra Design Pro: http://ant-design-pro.gitee.io * Infra Design Mobile: http://antd-mobile.gitee.io * Ant Motion: http://ant-motion.gitee.io - * Infra Design Pro Preview : https://prosite.z23.web.core.windows.net - + * Ant Design Pro Preview : https://prosite.z23.web.core.windows.net + - name: check ie if: contains(github.event.issue.body, 'ant-design-issue-helper') == true && contains(github.event.issue.title, 'IE9') == true || contains(github.event.issue.title, 'IE 9') == true || contains(github.event.issue.title, 'IE10') == true || contains(github.event.issue.title, 'IE 10') == true || contains(github.event.issue.title, 'IE11') == true || contains(github.event.issue.title, 'IE 11') == true || contains(github.event.issue.title, 'Internet Explorer') == true || contains(github.event.issue.body, 'IE9') == true || contains(github.event.issue.body, 'IE 9') == true || contains(github.event.issue.body, 'IE10') == true || contains(github.event.issue.body, 'IE 10') == true || contains(github.event.issue.body, 'IE11') == true || contains(github.event.issue.body, 'IE 11') == true || contains(github.event.issue.body, 'Internet Explorer') == true - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'add-labels' issue-number: ${{ github.event.issue.number }} @@ -71,7 +71,7 @@ jobs: - name: check ie if: contains(github.event.issue.body, 'ant-design-issue-helper') == true && contains(github.event.issue.title, 'IE9') == true || contains(github.event.issue.title, 'IE 9') == true || contains(github.event.issue.title, 'IE10') == true || contains(github.event.issue.title, 'IE 10') == true || contains(github.event.issue.title, 'IE11') == true || contains(github.event.issue.title, 'IE 11') == true || contains(github.event.issue.title, 'Internet Explorer') == true || contains(github.event.issue.body, 'IE9') == true || contains(github.event.issue.body, 'IE 9') == true || contains(github.event.issue.body, 'IE10') == true || contains(github.event.issue.body, 'IE 10') == true - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'create-comment, close-issue' issue-number: ${{ github.event.issue.number }} diff --git a/.github/workflows/issue-remove-inactive.yml b/.github/workflows/issue-remove-inactive.yml index f6634e88c863..90556c416dbd 100644 --- a/.github/workflows/issue-remove-inactive.yml +++ b/.github/workflows/issue-remove-inactive.yml @@ -12,7 +12,7 @@ jobs: steps: - name: remove inactive if: github.event.issue.state == 'open' && github.actor == github.event.issue.user.login - uses: actions-cool/issues-helper@v2 + uses: actions-cool/issues-helper@v3 with: actions: 'remove-labels' issue-number: ${{ github.event.issue.number }} diff --git a/.github/workflows/pr-check-ci.yml b/.github/workflows/pr-check-ci.yml index a8d492dd5f4b..d9599590a57c 100644 --- a/.github/workflows/pr-check-ci.yml +++ b/.github/workflows/pr-check-ci.yml @@ -13,7 +13,7 @@ jobs: with: filter-label: 'BranchAutoMerge' filter-creator-authority: 'write' - filter-head-ref: 'master, feature, master-merge-feature, feature-merge-master' + filter-head-ref: 'master, feature, next, master-merge-feature, feature-merge-master, next-merge-master' filter-support-fork: false skip-run-names: 'deploy preview, pr-check-ci, build preview failed, suggest-related-links' conflict-review-body: '😅 This branch has conflicts that must be resolved!' diff --git a/.github/workflows/pr-check-merge.yml b/.github/workflows/pr-check-merge.yml index 1d35c970dd27..c2ff3d4e10f9 100644 --- a/.github/workflows/pr-check-merge.yml +++ b/.github/workflows/pr-check-merge.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest if: (github.event.pull_request.head.ref == 'feature' || github.event.pull_request.head.ref == 'master') && github.event.pull_request.head.user.login == 'ant-design' steps: - - uses: actions-cool/issues-helper@v2 + - uses: actions-cool/issues-helper@v3 with: actions: 'create-comment' issue-number: ${{ github.event.number }} diff --git a/.github/workflows/release-helper.yml b/.github/workflows/release-helper.yml index d53ea4b21a65..05ee24a92742 100644 --- a/.github/workflows/release-helper.yml +++ b/.github/workflows/release-helper.yml @@ -16,12 +16,12 @@ jobs: runs-on: ubuntu-latest steps: - name: make release - uses: actions-cool/release-helper@v1 + uses: actions-cool/release-helper@v2 with: triger: 'tag' changelogs: 'CHANGELOG.en-US.md, CHANGELOG.zh-CN.md' branch: 'master' - dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }} + dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }} ${{ secrets.DINGDING_BOT_BIGFISH_TOKEN }} dingding-msg: 'CHANGELOG.zh-CN.md' msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ' msg-footer: '💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志' diff --git a/.github/workflows/verify-files-modify.yml b/.github/workflows/verify-files-modify.yml index e536da38fa48..d76777352fef 100644 --- a/.github/workflows/verify-files-modify.yml +++ b/.github/workflows/verify-files-modify.yml @@ -14,10 +14,11 @@ jobs: forbid-paths: '.github/, scripts/' forbid-files: 'CHANGELOG.zh-CN.md, CHANGELOG.en-US.md, LICENSE' skip-verify-authority: 'write' - assignees: 'afc163, zombieJ, xrkffgg' + assignees: 'afc163, zombieJ, xrkffgg, MadCcc' comment: | Hi @${{ github.event.pull_request.user.login }}. Thanks for your contribution. The path `.github/` or `scripts/` and `CHANGELOG` `package.json` is only maintained by team members. This current PR will be closed and team members will help on this. close: true + set-failed: false - name: verify-less uses: actions-cool/verify-files-modify@v1 diff --git a/.stylelintrc.json b/.stylelintrc.json index 5a03e7f8aa26..b5af6dd10a45 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -8,6 +8,25 @@ "plugins": ["stylelint-declaration-block-no-ignored-properties"], "rules": { "function-name-case": ["lower", { "ignoreFunctions": ["/colorPalette/"] }], + "function-no-unknown": [ + true, + { + "ignoreFunctions": [ + "fade", + "tint", + "darken", + "ceil", + "fadein", + "floor", + "unit", + "shade", + "lighten", + "percentage", + "-", + "~`colorPalette" + ] + } + ], "no-descending-specificity": null, "no-invalid-position-at-import-rule": null, "declaration-empty-line-before": null, diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index da9a8b5037aa..8afd236a8210 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -9,6 +9,7 @@ timeline: true | infrad version | antd version | update content | time | | --- | --- | --- | --- | +| 4.18.9 | 4.18.9 | Synchronize the update of antd 4.18.9 version | 2022-03-08 | | 4.18.5 | 4.18.3 | Roll back some components, details can be [View](https://docs.google.com/spreadsheets/d/1TvmnH4gNNt52CCLTn1GCuPlPDfjIQVHfbtauUOX3hdw/edit#gid=0) | 2022-02-25 | | 4.18.4 | 4.18.3 | fix error-color difference | 2022-01-17 | | 4.18.3 | 4.18.3 | Synchronize the update of antd 4.18.3 version | 2022-01-17 | @@ -28,6 +29,100 @@ if you have some problem, welcome to connect `taofeng.yang@shopee.com` or `lay.z --- +## 4.18.9 + +`2022-02-28` + +- 🆕 New theme less variable for Radio, Divider, Modal, Dropdown, Drawer. [#34194](https://github.com/ant-design/ant-design/pull/34194) [#34187](https://github.com/ant-design/ant-design/pull/34187) [#34191](https://github.com/ant-design/ant-design/pull/34191) [#34189](https://github.com/ant-design/ant-design/pull/34189) [#34188](https://github.com/ant-design/ant-design/pull/34188) [@qdzhaoxiaodao](https://github.com/qdzhaoxiaodao) +- 💄 Fix Dropdown item wrap style when text is too long. [#34177](https://github.com/ant-design/ant-design/pull/34177) +- TypeScript + - 🐞 Fix Upload `onChange` parameter generic passing. [#34161](https://github.com/ant-design/ant-design/pull/34161) [@wangcch](https://github.com/wangcch) + +## 4.18.8 + +`2022-02-21` + +- 🐞 Fix `getContainer` config not working bug when called multi-times via `message.config`. [#34123](https://github.com/ant-design/ant-design/pull/34123) [@TrickyPi](https://github.com/TrickyPi) +- 🐞 Fix invalid context value cache in Menu component. [#34121](https://github.com/ant-design/ant-design/pull/34121) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 Fix ConfigProvider config theme on server side crash, and warning for useless in SSR instead. [#34118](https://github.com/ant-design/ant-design/pull/34118) +- Table + - ⚡️ Fix Table render twice on first mount. [#34106](https://github.com/ant-design/ant-design/pull/34106) + - ⚡️ Optimized Table rendering performance, now will skip useless rendering when deprecated `column.render: () => { children, props }` method is not used. [#34075](https://github.com/ant-design/ant-design/pull/34075) +- 🐞 Fix incorrect copy text of Typography after children is updated when enable `copyable`. [#34034](https://github.com/ant-design/ant-design/pull/34034) [@opopeieie](https://github.com/opopeieie) +- ⚡️ Optimize Avatar, List, Pagination, Steps to avoid additional render on mount if unnecessary. [34122](https://github.com/ant-design/ant-design/pull/34122) +- 💄 Fix Form broken style when Select item is too long in horizontal layout. [#34117](https://github.com/ant-design/ant-design/pull/34117) +- 🇸🇰 Improve texts for Table, Form and Modal in `sk_SK`. [#34061](https://github.com/ant-design/ant-design/pull/34061) [@xseman](https://github.com/xseman) +- TypeScript + - 🤖 Export `SiderProps` type from Layout component. [#34137](https://github.com/ant-design/ant-design/pull/34137) [@Picsong](https://github.com/Picsong) + +## 4.18.7 + +`2022-02-14` + +- Typography + - 🛠 Fix Typography `useLayoutEffect` warning in SSR. [#33818](https://github.com/ant-design/ant-design/pull/33818) [@SoYoung210](https://github.com/SoYoung210) + - 🐞 Fix Typography with `ellipsis` makes screen show the scroll bar in some case. [#34007](https://github.com/ant-design/ant-design/pull/34007) + - 🐞 Typography copy click event is now `stopPropagation` by default. [#33998](https://github.com/ant-design/ant-design/pull/33998) [@linxianxi](https://github.com/linxianxi) + - 🐞 Fix Typography edit & copy button not trigger by enter key. [#33976](https://github.com/ant-design/ant-design/pull/33976) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 Fix Form `undefined` text of min/max validators in pl_PL locale. [#34024](https://github.com/ant-design/ant-design/pull/34024) [@MichalPodeszwa](https://github.com/MichalPodeszwa) +- 🐞 Fix Input.TextArea cut text logic when `maxLength` configured. [#33910](https://github.com/ant-design/ant-design/pull/33910) [@chenyizhongx](https://github.com/chenyizhongx) +- 💄 Button with `type=default` will provide `.ant-btn-default` className. [#34013](https://github.com/ant-design/ant-design/pull/34013) +- 💄 Improve Menu `:focus-visible` style. [#34008](https://github.com/ant-design/ant-design/pull/34008) +- 💄 Fix Pagination and Rate style problem in Safari. [#34002](https://github.com/ant-design/ant-design/pull/34002) +- 💄 Fix Row and Col component styles when using prefixCls. [#33969](https://github.com/ant-design/ant-design/pull/33969) [@mic-web](https://github.com/mic-web) +- 🐞 Fix Timeline icons with custom color not working. [#33951](https://github.com/ant-design/ant-design/pull/33951) [@MadCcc](https://github.com/MadCcc) +- TypeScript + - 🤖 Optimize Cascader `onChange` definition with `multiple` prop. [#33947](https://github.com/ant-design/ant-design/pull/33947) [@babycannotsay](https://github.com/babycannotsay) + +## 4.18.6 + +`2022-02-07` + +- 🐞 Fix the empty Popover displayed when `content` and `title` is undefined or null. [#33835](https://github.com/ant-design/ant-design/pull/33835) [@DawnLck](https://github.com/DawnLck) +- 🐞 Fix the problem that Tooltip didn't show on `ellipsis` with rows larger than 1. [#33875](https://github.com/ant-design/ant-design/pull/33875) +- Button + - 🐞 Fix the issue that `block` of Button not work when small size. [#33878](https://github.com/ant-design/ant-design/pull/33878) [@tangjinzhou](https://github.com/tangjinzhou) + - 🐞 Fix the issue that `loading.delay` of Button cause React memory leak warning [#33858](https://github.com/ant-design/ant-design/pull/33858) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 Fix the problem that Tooltip cannot be displayed when it is used with Switch in `loading` state. [#33860](https://github.com/ant-design/ant-design/pull/33860) +- 🐞 Fix the Upload button sometimes flashes after changed from hidden to display when the Upload component is a `picture-card` type. [#33820](https://github.com/ant-design/ant-design/pull/33820) [@credred](https://github.com/credred) +- TypeScript + - 🤖 Fix DatePicker `ref` TypeScript definition. [#33901](https://github.com/ant-design/ant-design/pull/33901) [@Amour1688](https://github.com/Amour1688) + +## 4.18.5 + +`2022-01-24` + +- Cascader + - 💄 Fix Cascader loading icon. [#33799](https://github.com/ant-design/ant-design/pull/33799) + - 🐞 Fix Cascader not auto offset placement when popup is out of screen and fix active option out of screen not scroll. [#33777](https://github.com/ant-design/ant-design/pull/33777) +- 💄 Fix Tag style in dark theme. [#33751](https://github.com/ant-design/ant-design/pull/33751) +- 💄 Fix disabled Checkbox inside Tooltip dom structure. [#33772](https://github.com/ant-design/ant-design/pull/33772) [@boomler](https://github.com/boomler) +- ⚡️ Fix invalid hook dependency array in Row and Layout.Sider components. [#33804](https://github.com/ant-design/ant-design/pull/33804) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 Fix Card `ref` not working. [#33784](https://github.com/ant-design/ant-design/pull/33784) [@LongHaoo](https://github.com/LongHaoo) +- 🐞 Fix a Checkbox problem that `onChange` could not correctly pass in the modified value when dynamically modifying `value` property. [#33753](https://github.com/ant-design/ant-design/pull/33753) + +## 4.18.4 + +`2022-01-18` + +- Typography + - ⚡️ Optimize Typography to use native css ellipsis when `tooltip` is configured. [#33669](https://github.com/ant-design/ant-design/pull/33669) + - 🐞 Refactor Typography `ellipsis` logic to fix error when `children` use Context content. [#33725](https://github.com/ant-design/ant-design/pull/33725) +- Icon + - 🐞 Fix `` and `` not aligned. (https://github.com/ant-design/ant-design/pull/33709) + - 🐞 Fix `` shake. [#33726](https://github.com/ant-design/ant-design/pull/33726) [@JX-Zhuang](https://github.com/JX-Zhuang) +- Input + - 🐞 Fix the display effect for Input related components with `hidden`. [#33735](https://github.com/ant-design/ant-design/pull/33735) [@fanerge](https://github.com/fanerge) [#33706](https://github.com/ant-design/ant-design/pull/33706) [@hydraZty](https://github.com/hydraZty) + - 🐞 Fix the warning in console for Input with `showCount`. [#33686](https://github.com/ant-design/ant-design/pull/33686) [@whwangms](https://github.com/whwangms) +- ⚡️ Fix ConfigProvider and Anchor rerender unexpectedly. [#33723](https://github.com/ant-design/ant-design/pull/33723) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 Fix the duplicate keys warning in console for Cascader. [#33649](https://github.com/ant-design/ant-design/pull/33649) [@dimbslmh](https://github.com/dimbslmh) +- 🐞 Checkbox.Group support number and boolean as options element. [#33678](https://github.com/ant-design/ant-design/pull/33678) +- 🐞 Fix Form `validateMessages` bug in multiple ConfigProvider. [#33705](https://github.com/ant-design/ant-design/pull/33705) +- 🐞 Fix Steps the tail part would be hidden when type is navigation and labelPlacement is vertical. [#33716](https://github.com/ant-design/ant-design/pull/33716) [@toSayNothing](https://github.com/toSayNothing) +- 🐞 Fix Image has bottom blank style. [#33631](https://github.com/ant-design/ant-design/pull/33631) [@fanerge](https://github.com/fanerge) +- 🐞 Fix TreeSelect with keyboard operation missing highlight issue. [#33755](https://github.com/ant-design/ant-design/pull/33755) +- 🇰🇭 Fix some translations for Khmer (km_KH). [#33738](https://github.com/ant-design/ant-design/pull/33738) [@vireakkeosokvibol](https://github.com/vireakkeosokvibol) + ## 4.18.3 `2022-01-10` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 5c09c112e671..0171e1927980 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -9,6 +9,7 @@ timeline: true | infrad 版本号 | 对应 antd 版本号 | 更新内容 | 时间 | | --- | --- | --- | --- | +| 4.18.9 | 4.18.9 | 同步 antd 4.18.9 版本的更新 | 2022-03-08 | | 4.18.5 | 4.18.3 | 回滚部分组件,详情可[查看](https://docs.google.com/spreadsheets/d/1TvmnH4gNNt52CCLTn1GCuPlPDfjIQVHfbtauUOX3hdw/edit#gid=0) | 2022-02-25 | | 4.18.4 | 4.18.3 | 修复 error-color 颜色差异问题 | 2022-01-18 | | 4.18.3 | 4.18.3 | 同步 antd 4.18.3 版本的更新 | 2022-01-17 | @@ -28,6 +29,101 @@ timeline: true --- +## 4.18.9 + +`2022-02-28` + +- 🆕 新增 Radio、Divider、Modal、Dropdown、Drawer 主题变量。[#34194](https://github.com/ant-design/ant-design/pull/34194) [#34187](https://github.com/ant-design/ant-design/pull/34187) [#34191](https://github.com/ant-design/ant-design/pull/34191) [#34189](https://github.com/ant-design/ant-design/pull/34189) [#34188](https://github.com/ant-design/ant-design/pull/34188) [@qdzhaoxiaodao](https://github.com/qdzhaoxiaodao) +- 🐞 修复 Form 组件当 `preserve` 为 `false` 时 `initialValues` 会被更改的问题。[#34153](https://github.com/ant-design/ant-design/pull/34153) +- 💄 修复 Dropdown 菜单项文本太长没有换行的问题。[#34177](https://github.com/ant-design/ant-design/pull/3417) +- TypeScript + - 🐞 修复 Upload `onChange` 参数泛型传递。[#34161](https://github.com/ant-design/ant-design/pull/34161) [@wangcch](https://github.com/wangcch) + +## 4.18.8 + +`2022-02-21` + +- 🐞 修复 `message.config` 多次配置 `getContainer` 时无法生效的问题。[#34123](https://github.com/ant-design/ant-design/pull/34123) [@TrickyPi](https://github.com/TrickyPi) +- 🐞 修复 Menu 组件中无效的缓存逻辑。[#34121](https://github.com/ant-design/ant-design/pull/34121) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 修复 ConfigProvider 在服务端配置主题会崩溃的问题,同时现在会提示动态主题于 SSR 上无效。[#34118](https://github.com/ant-design/ant-design/pull/34118) +- Table + - ⚡️ 修复 Table 在首次加载时会渲染两次的问题。[#34106](https://github.com/ant-design/ant-design/pull/34106) + - ⚡️ 优化 Table 渲染性能,现在不使用废弃 `column.render: () => { children, props }` 方法时默认会跳过无用渲染。[#34075](https://github.com/ant-design/ant-design/pull/34075) +- 🐞 修复 Typography 启用 `copyable` 时 `children` 内容变化后复制内容没变的问题。[#34034](https://github.com/ant-design/ant-design/pull/34034) [@opopeieie](https://github.com/opopeieie) +- ⚡️ 优化 Avatar、List、Pagination、Steps 以防止初始化时非必要的额外渲染。[34122](https://github.com/ant-design/ant-design/pull/34122) +- 💄 修复 Form 下 Select 内容太长导致布局换行的问题。[#34117](https://github.com/ant-design/ant-design/pull/34117) +- 🇸🇰 完善 `sk-SK` 中 Table、Form、Modal 的文案。[#34061](https://github.com/ant-design/ant-design/pull/34061) [@xseman](https://github.com/xseman) +- TypeScript + - 🤖 导出 Layout 组件的 `SiderProps` 类型。[#34137](https://github.com/ant-design/ant-design/pull/34137) [@Picsong](https://github.com/Picsong) + +## 4.18.7 + +`2022-02-14` + +- Typography + - 🛠 修复 Typography 在 SSR 渲染时警告 `useLayoutEffect` 的问题。[#33818](https://github.com/ant-design/ant-design/pull/33818) [@SoYoung210](https://github.com/SoYoung210) + - 🐞 修复 Typography 配置 `ellipsis` 后在某些情况下会出现滚动条的问题。[#34007](https://github.com/ant-design/ant-design/pull/34007) + - 🐞 Typography 复制按钮点击事件不在冒泡。[#33998](https://github.com/ant-design/ant-design/pull/33998) [@linxianxi](https://github.com/linxianxi) + - 🐞 修复 Typography 中编辑和拷贝按钮无法响应 Enter 按键的问题。[#33976](https://github.com/ant-design/ant-design/pull/33976) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 修复 Form 波兰语中表单校验部分文案未定义的问题。[#34024](https://github.com/ant-design/ant-design/pull/34024) [@MichalPodeszwa](https://github.com/MichalPodeszwa) +- 🐞 修复 Input.TextArea 设置 `maxLength` 时光标位置会影响超出部分截取的问题。[#33910](https://github.com/ant-design/ant-design/pull/33910) [@chenyizhongx](https://github.com/chenyizhongx) +- 💄 Button 对于 `type=default` 也会提供 `.ant-btn-default` 的样式类名。[#34013](https://github.com/ant-design/ant-design/pull/34013) +- 💄 优化 Menu `:focus-visible` 的样式。[#34008](https://github.com/ant-design/ant-design/pull/34008) +- 💄 修复 Pagination 和 Rate 在 Safari 下部分样式丢失的问题,比如分页按钮禁用样式失效。[#34002](https://github.com/ant-design/ant-design/pull/34002) +- 💄 修复 Row 与 Col 在配置 `prefixCls` 的样式问题。[#33969](https://github.com/ant-design/ant-design/pull/33969) [@mic-web](https://github.com/mic-web) +- 🐞 修复 Timeline 的自定义图标颜色无效的问题。[#33951](https://github.com/ant-design/ant-design/pull/33951) [@MadCcc](https://github.com/MadCcc) +- TypeScript + - 🤖 优化 Cascader `multiple` 属性对应的 `onChange` 类型推断。[#33947](https://github.com/ant-design/ant-design/pull/33947) [@babycannotsay](https://github.com/babycannotsay) + +## 4.18.6 + +`2022-02-07` + +- 🐞 修复当传入的内容参数和标题参数都为空时,Popover 仍旧会渲染空气泡的问题。[#33835](https://github.com/ant-design/ant-design/pull/33835) [@DawnLck](https://github.com/DawnLck) +- 🐞 修复 Typography `ellipsis` 行数大于 1 时 Tooltip 不显示的问题。[#33875](https://github.com/ant-design/ant-design/pull/33875) +- Button + - 🐞 修复小尺寸下 Button 组件 `block` 属性无效的问题[#33878](https://github.com/ant-design/ant-design/pull/33878) [@tangjinzhou](https://github.com/tangjinzhou) + - 🐞 修复 Button 组件 `loading.delay` 定时器未清除导致的内存泄漏警告[#33858](https://github.com/ant-design/ant-design/pull/33858) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 修复 Tooltip 套在 `loading` 状态的 Switch 上时无法正常显示的问题。[#33860](https://github.com/ant-design/ant-design/pull/33860) +- 🐞 修复 Upload 组件为 `picture-card` 类型时,由隐藏上传按钮改为显示后,上传按钮有时会闪烁的问题。[#33820](https://github.com/ant-design/ant-design/pull/33820) [@credred](https://github.com/credred) +- Typescript + - 🤖 修复 DatePicker `ref` TypeScript 定义。[#33901](https://github.com/ant-design/ant-design/pull/33901) [@Amour1688](https://github.com/Amour1688) + +## 4.18.5 + +`2022-01-24` + +- Cascader + - 🐞 修复 Cascader 弹层超出屏幕时不会自动偏移以及激活选项不会自动滚动到正确位置的问题。[#33777](https://github.com/ant-design/ant-design/pull/33777) + - 💄 修复 Cascader 加载中图标。[#33799](https://github.com/ant-design/ant-design/pull/33799) +- 💄 修复 Tag 在暗黑主题下的样式。[#33751](https://github.com/ant-design/ant-design/pull/33751) +- 💄 修复 Tooltip 的子元素含有禁用态的 CheckBox 时可能引起的行为和样式异常。[#33772](https://github.com/ant-design/ant-design/pull/33772) [@boomler](https://github.com/boomler) +- ⚡️ 优化 Row 和 Layout.Sider 的 hooks 依赖数组。[#33804](https://github.com/ant-design/ant-design/pull/33804) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 修复 Card `ref` 不生效的问题。[#33784](https://github.com/ant-design/ant-design/pull/33784) [@LongHaoo](https://github.com/LongHaoo) +- 🐞 修复动态修改 Checkbox 的 `value` 时 `onChange` 不能正确传入修改后的值的问题。[#33753](https://github.com/ant-design/ant-design/pull/33753) + +## 4.18.4 + +`2022-01-18` + +- Typography + - ⚡️ 优化 Typography 在配置 `tooltip` 时优先使用原生省略样式以提升性能。[#33669](https://github.com/ant-design/ant-design/pull/33669) + - 🐞 重构 Typography `ellipsis` 逻辑以修复 `children` 如果消费上游 Context 会报错的问题。 [#33725](https://github.com/ant-design/ant-design/pull/33725) +- Icon + - 🐞 修复 `` 和 `` 不对齐的问题。[#33709](https://github.com/ant-design/ant-design/pull/33709) + - 🐞 修复 `` 抖动的问题。[#33726](https://github.com/ant-design/ant-design/pull/33726) [@JX-Zhuang](https://github.com/JX-Zhuang) +- Input + - 🐞 修复 Input 相关组件设置 `hidden` 时的展示问题。[#33735](https://github.com/ant-design/ant-design/pull/33735) [@fanerge](https://github.com/fanerge),[#33706](https://github.com/ant-design/ant-design/pull/33706) [@hydraZty](https://github.com/hydraZty) + - 🐞 修复 Input 传入 `showCount` 时控制台 warning 问题。[#33686](https://github.com/ant-design/ant-design/pull/33686) [@whwangms](https://github.com/whwangms) +- ⚡️ 修复 ConfigProvider 和 Anchor 的渲染函数多次运行的问题。[#33723](https://github.com/ant-design/ant-design/pull/33723) [@mrwd2009](https://github.com/mrwd2009) +- 🐞 修复 Cascader 组件中出现重复 key 的控制台 warning 问题。[#33649](https://github.com/ant-design/ant-design/pull/33649) [@dimbslmh](https://github.com/dimbslmh) +- 🐞 Checkbox.Group 的 `options` 支持数组中直接传入 number 和 boolean 类型。[#33678](https://github.com/ant-design/ant-design/pull/33678) +- 🐞 修复 Form `validateMessages` 在多个 ConfigProvider 内错乱的问题。[#33705](https://github.com/ant-design/ant-design/pull/33705) +- 🐞 修复 Steps 组件在 `type` 为 navigation 和 `labelPlacement` 为 vertical 时,tail 部分不会显示的问题。[#33716](https://github.com/ant-design/ant-design/pull/33716) [@toSayNothing](https://github.com/toSayNothing) +- 🐞 修复 Image 底部留白问题。[#33631](https://github.com/ant-design/ant-design/pull/33631) [@fanerge](https://github.com/fanerge) +- 🐞 修复 TreeSelect 键盘操作时,激活项不会高亮的问题。[#33755](https://github.com/ant-design/ant-design/pull/33755) +- 🇰🇭 修正高棉语 (km_KH) 语言包中部分翻译。[#33738](https://github.com/ant-design/ant-design/pull/33738) [@vireakkeosokvibol](https://github.com/vireakkeosokvibol) + ## 4.18.3 `2022-01-10` diff --git a/README.md b/README.md index a7ad23471ba6..98afad9aa698 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ ### Infra Design -Based on [Infra Design](https://github.com/ant-design/ant-design) +Based on [Ant Design](https://github.com/ant-design/ant-design) diff --git a/components/_util/motion.tsx b/components/_util/motion.tsx index 1c69a9f05a11..edac9ccda166 100644 --- a/components/_util/motion.tsx +++ b/components/_util/motion.tsx @@ -1,5 +1,6 @@ import { CSSMotionProps, MotionEventHandler, MotionEndEventHandler } from 'rc-motion'; import { MotionEvent } from 'rc-motion/lib/interface'; +import { tuple } from './type'; // ================== Collapse Motion ================== const getCollapsedHeight: MotionEventHandler = () => ({ height: 0, opacity: 0 }); @@ -25,11 +26,21 @@ const collapseMotion: CSSMotionProps = { motionDeadline: 500, }; +const SelectPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight'); +export type SelectCommonPlacement = typeof SelectPlacements[number]; + +const getTransitionDirection = (placement: SelectCommonPlacement | undefined) => { + if (placement !== undefined && (placement === 'topLeft' || placement === 'topRight')) { + return `slide-down`; + } + return `slide-up`; +}; + const getTransitionName = (rootPrefixCls: string, motion: string, transitionName?: string) => { if (transitionName !== undefined) { return transitionName; } return `${rootPrefixCls}-${motion}`; }; -export { getTransitionName }; +export { getTransitionName, getTransitionDirection }; export default collapseMotion; diff --git a/components/tooltip/placements.tsx b/components/_util/placements.tsx similarity index 97% rename from components/tooltip/placements.tsx rename to components/_util/placements.tsx index 3fc9152268ce..eb4dead8a872 100644 --- a/components/tooltip/placements.tsx +++ b/components/_util/placements.tsx @@ -42,6 +42,7 @@ export default function getPlacements(config: PlacementsConfig) { horizontalArrowShift = 16, verticalArrowShift = 8, autoAdjustOverflow, + arrowPointAtCenter, } = config; const placementMap: BuildInPlacements = { left: { @@ -94,7 +95,7 @@ export default function getPlacements(config: PlacementsConfig) { }, }; Object.keys(placementMap).forEach(key => { - placementMap[key] = config.arrowPointAtCenter + placementMap[key] = arrowPointAtCenter ? { ...placementMap[key], overflow: getOverflowOptions(autoAdjustOverflow), diff --git a/components/_util/statusUtils.tsx b/components/_util/statusUtils.tsx new file mode 100644 index 000000000000..25153ba93fdc --- /dev/null +++ b/components/_util/statusUtils.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled'; +import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; +import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; +import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; +import classNames from 'classnames'; +import { ValidateStatus } from '../form/FormItem'; +import { tuple } from './type'; + +const InputStatuses = tuple('warning', 'error', ''); +export type InputStatus = typeof InputStatuses[number]; + +const iconMap = { + success: CheckCircleFilled, + warning: ExclamationCircleFilled, + error: CloseCircleFilled, + validating: LoadingOutlined, +}; + +export const getFeedbackIcon = (prefixCls: string, status?: ValidateStatus) => { + const IconNode = status && iconMap[status]; + return IconNode ? ( + + + + ) : null; +}; + +export function getStatusClassNames( + prefixCls: string, + status?: ValidateStatus, + hasFeedback?: boolean, +) { + return classNames({ + [`${prefixCls}-status-success`]: status === 'success', + [`${prefixCls}-status-warning`]: status === 'warning', + [`${prefixCls}-status-error`]: status === 'error', + [`${prefixCls}-status-validating`]: status === 'validating', + [`${prefixCls}-has-feedback`]: hasFeedback, + }); +} + +export const getMergedStatus = (contextStatus?: ValidateStatus, customStatus?: InputStatus) => + customStatus || contextStatus; diff --git a/components/affix/__tests__/Affix.test.tsx b/components/affix/__tests__/Affix.test.tsx index e67833cbbb8d..5c47a383f47b 100644 --- a/components/affix/__tests__/Affix.test.tsx +++ b/components/affix/__tests__/Affix.test.tsx @@ -17,7 +17,7 @@ class AffixMounter extends React.Component<{ }> { private container: HTMLDivElement; - public affix: Affix; + public affix: React.Component; componentDidMount() { this.container.addEventListener = jest @@ -58,7 +58,7 @@ describe('Affix Render', () => { const domMock = jest.spyOn(HTMLElement.prototype, 'getBoundingClientRect'); let affixMounterWrapper: ReactWrapper; - let affixWrapper: ReactWrapper; + let affixWrapper: ReactWrapper>; const classRect: Record = { container: { @@ -157,9 +157,9 @@ describe('Affix Render', () => { const getTarget = () => container; affixWrapper = mount({null}); affixWrapper.setProps({ target: () => null }); - expect(affixWrapper.instance().state.status).toBe(0); - expect(affixWrapper.instance().state.affixStyle).toBe(undefined); - expect(affixWrapper.instance().state.placeholderStyle).toBe(undefined); + expect(affixWrapper.find('Affix').last().state().status).toBe(0); + expect(affixWrapper.find('Affix').last().state().affixStyle).toBe(undefined); + expect(affixWrapper.find('Affix').last().state().placeholderStyle).toBe(undefined); }); it('instance change', async () => { diff --git a/components/affix/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/affix/__tests__/__snapshots__/demo-extend.test.ts.snap index 82f95baa2dff..a77adba2535f 100644 --- a/components/affix/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/affix/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -71,7 +71,7 @@ exports[`renders ./components/affix/demo/on-change.md extend context correctly 1 class="" > , , , , , , , , , ,
, , ,
, , , , , ,
, , , ,
, , , , , , , , ,
, , ,
, , , , , , , ,
,
, , , , , , ,
, , , , , + + {visible && + +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
+ Su + + Mo + + Tu + + We + + Th + + Fr + + Sa +
+
+ 30 +
+
- - - - - -
+ 1 +
+
- - +
- 2016 - -
-
- - - - - - -
- + 5 + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-
- Su - - Mo - - Tu - - We - - Th - - Fr - - Sa -
-
+ 6 +
+
+
+ 7 +
+
+
+ 8 +
+
+
+ 9 +
+
+
+ 10 +
+
+
+ 11 +
+
+
+ 12 +
+
+
+ 13 +
+
+
+ 14 +
+
+
+ 15 +
+
+
+ 16 +
+
+
+ 17 +
+
+
+ 18 +
+
+
+ 19 +
+
+
+ 20 +
+
+
+ 21 +
+
+
+ 22 +
+
+
+ 23 +
+
+
+ 24 +
+
+
+ 25 +
+
+
+ 26 +
+
+
+ 27 +
+
+
+ 28 +
+
+
+ 29 +
+
+
+ 30 +
+
+
+ 1 +
+
+
+ 2 +
+
+
+ 3 +
+
+
+ 4 +
+
+
+ 5 +
+
+
+ 6 +
+
+
+ 7 +
+
+
+ 8 +
+
+
+ 9 +
+
+
+ 10 +
+
+
+ + + + + + , +
, +
, +
+
+ +
+
+ + + + + +
+
+ +
+
+ + + + + +
, +
+
+
+
+
+
+
+
+
+ + +
+ + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Su + + Mo + + Tu + + We + + Th + + Fr + + Sa +
+
+ 30 +
+
+
+ 31 +
+
+
+ 1 +
+
+
+ 2 +
+
+
+ 3 +
+
+
+ 4 +
+
+
+ 5 +
+
+
+ 6 +
+
+
+ 7 +
+
+
+ 8 +
+
+
+ 9 +
+
+
+ 10 +
+
+
+ 11 +
+
+
+ 12 +
+
+
+ 13 +
+
+
+ 14 +
+
+
+ 15 +
+
+
+ 16 +
+
+
+ 17 +
+
+
+ 18 +
+
+
+ 19 +
+
+
+ 20 +
+
+
+ 21 +
+
+
+ 22 +
+
+
+ 23 +
+
+
+ 24 +
+
+
+ 25 +
+
+
+ 26 +
+
+
+ 27 +
+
+
+ 28 +
+
+
+ 29 +
+
+
+ 30 +
+
+
+ 1 +
+
+
+ 2 +
+
+
+ 3 +
+
+
+ 4 +
+
+
+ 5 +
+
+
+ 6 +
+
+
+ 7 +
+
+
+ 8 +
+
+
+ 9 +
+
+
+ 10 +
+
+
+
+
+
+
+
+ + +
+ + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Su + + Mo + + Tu + + We + + Th + + Fr + + Sa +
+
+ 27 +
+
+
+ 28 +
+
+
+ 29 +
+
+
+ 30 +
+
+
+ 1 +
+
+
+ 2 +
+
+
+ 3 +
+
+
+ 4 +
+
+
+ 5 +
+
+
+ 6 +
+
+
+ 7 +
+
+
+ 8 +
+
+
+ 9 +
+
+
+ 10 +
+
+
+ 11 +
+
+
+ 12 +
+
+
+ 13 +
+
+
+ 14 +
+
+
+ 15 +
+
+
+ 16 +
+
+
+ 17 +
+
+
+ 18 +
+
+
+ 19 +
+
+
+ 20 +
+
+
+ 21 +
+
+
+ 22 +
+
+
+ 23 +
+
+
+ 24 +
+
+
+ 25 +
+
+
+ 26 +
+
+
+ 27 +
+
+
+ 28 +
+
+
+ 29 +
+
+
+ 30 +
+
+
+ 31 +
+
+
+ 1 +
+
+
+ 2 +
+
+
+ 3 +
+
+
+ 4 +
+
+
+ 5 +
+
+
+ 6 +
+
+
+ 7 +
+
+
+
+
+
+
+
+
+
, +] +`; + +exports[`renders ./components/date-picker/demo/presetted-ranges.md extend context correctly 1`] = ` +
+
+
+
+ +
+
+ + + + + +
+
+ +
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+ + +
+ + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -35500,76 +37598,76 @@ exports[`renders ./components/date-picker/demo/range-picker.md extend context co @@ -35579,155 +37677,262 @@ exports[`renders ./components/date-picker/demo/range-picker.md extend context co + +
+ Su + + Mo + + Tu + + We + + Th + + Fr + + Sa +
+
30
@@ -35490,7 +37351,244 @@ exports[`renders ./components/date-picker/demo/range-picker.md extend context co
- 5 + 5 +
+
+ 46 + +
+ 6 +
+
+
+ 7 +
+
+
+ 8 +
+
+
+ 9 +
+
+
+ 10 +
+
+
+ 11 +
+
+
+ 12 +
+
+ 47 + +
+ 13 +
+
+
+ 14 +
+
+
+ 15 +
+
+
+ 16 +
+
+
+ 17 +
+
+
+ 18 +
+
+
+ 19 +
+
+ 48 + +
+ 20 +
+
+
+ 21 +
+
+
+ 22 +
+
+
+ 23 +
+
+
+ 24 +
+
+
+ 25 +
+
+
+ 26
- 46 + 49
- 6 + 27
- 7 + 28
- 8 + 29
- 9 + 30
- 10 + 1
- 11 + 2
- 12 + 3
- 47 + 50
- 13 + 4
- 14 + 5
- 15 + 6
- 16 + 7
- 17 + 8
- 18 + 9
- 19 + 10
+
+
+
+
+
+
+ + +
+ + +
+ + +
+
+ + + + + + + + + + + + + @@ -35737,76 +37942,76 @@ exports[`renders ./components/date-picker/demo/range-picker.md extend context co @@ -35816,262 +38021,155 @@ exports[`renders ./components/date-picker/demo/range-picker.md extend context co - -
+ + Su + + Mo + + Tu + + We + + Th + + Fr + + Sa +
- 48 + 49
- 20 + 27
- 21 + 28
- 22 + 29
- 23 + 30
- 24 + 1
- 25 + 2
- 26 + 3
- 49 + 50
- 27 + 4
- 28 + 5
- 29 + 6
- 30 + 7
- 1 + 8
- 2 + 9
- 3 + 10
- 50 + 51
- 4 + 11
- 5 + 12
- 6 + 13
- 7 + 14
- 8 + 15
- 9 + 16
- 10 + 17
-
-
-
-
-
-
- - -
- - -
- - -
-
- - - - - - - - - - - - - @@ -36081,392 +38179,626 @@ exports[`renders ./components/date-picker/demo/range-picker.md extend context co + + + + + - - - + + +
- - Su - - Mo - - Tu - - We - - Th - - Fr - - Sa -
- 49 + 52
- 27 + 18
- 28 + 19
- 29 + 20
- 30 + 21
- 1 + 22
- 2 + 23
- 3 + 24
- 50 + 53
- 4 + 25
- 5 + 26
- 6 + 27
- 7 + 28
- 8 + 29
+
+ 30 +
+
+
+ 31 +
+
+ 1 +
- 9 + 1
- 10 + 2
- 51 -
- 11 + 3
- 12 + 4
- 13 + 5
- 14 + 6
- 15 + 7
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ + + + + +
+
+ +
+
+ + + + + +
+
+
+
+
+
+
+
+
+
+ +
+ +
+ +
+
+ + + - - - + + + + - - + + + +
- 16 + Jan
- 17 + Feb
- 52 -
- 18 + Mar
- 19 + Apr
- 20 + May
- 21 + Jun
- 22 + Jul
- 23 + Aug
- 24 + Sep
- 53 -
- 25 + Oct
- 26 + Nov
- 27 + Dec
+
+
+
+
+
+
+ +
+ +
+ +
+
+ + + + + - - + + + + @@ -36493,7 +38825,7 @@ exports[`renders ./components/date-picker/demo/range-picker.md extend context co >
-
-
- 28 + Jan
- 29 + Feb
- 30 + Mar
- 31 + Apr
- 1 +
+ May +
- 1 + Jun
- 2 + Jul
- 3 + Aug
- 4 + Sep
- 5 + Oct
- 6 + Nov
- 7 + Dec
- - - - - - - - - - - - - - +
+
-
- Jan -
-
-
- Feb -
-
-
- Mar -
-
-
- Apr -
-
-
- May -
-
-
- Jun -
-
-
- Jul -
-
-
- Aug -
-
+ + - - @@ -36771,7 +39017,7 @@ exports[`renders ./components/date-picker/demo/range-picker.md extend context co tabindex="-1" >
- - - - - - - - - - - - - - @@ -43880,12 +46040,778 @@ exports[`renders ./components/date-picker/demo/start-end.md extend context corre
-   -
- -
+   +
+ +
+
    +
  • +
    + 00 +
    +
  • +
  • +
    + 01 +
    +
  • +
  • +
    + 02 +
    +
  • +
  • +
    + 03 +
    +
  • +
  • +
    + 04 +
    +
  • +
  • +
    + 05 +
    +
  • +
  • +
    + 06 +
    +
  • +
  • +
    + 07 +
    +
  • +
  • +
    + 08 +
    +
  • +
  • +
    + 09 +
    +
  • +
  • +
    + 10 +
    +
  • +
  • +
    + 11 +
    +
  • +
  • +
    + 12 +
    +
  • +
  • +
    + 13 +
    +
  • +
  • +
    + 14 +
    +
  • +
  • +
    + 15 +
    +
  • +
  • +
    + 16 +
    +
  • +
  • +
    + 17 +
    +
  • +
  • +
    + 18 +
    +
  • +
  • +
    + 19 +
    +
  • +
  • +
    + 20 +
    +
  • +
  • +
    + 21 +
    +
  • +
  • +
    + 22 +
    +
  • +
  • +
    + 23 +
    +
  • +
+
    +
  • +
    + 00 +
    +
  • +
  • +
    + 01 +
    +
  • +
  • +
    + 02 +
    +
  • +
  • +
    + 03 +
    +
  • +
  • +
    + 04 +
    +
  • +
  • +
    + 05 +
    +
  • +
  • +
    + 06 +
    +
  • +
  • +
    + 07 +
    +
  • +
  • +
    + 08 +
    +
  • +
  • +
    + 09 +
    +
  • +
  • +
    + 10 +
    +
  • +
  • +
    + 11 +
    +
  • +
  • +
    + 12 +
    +
  • +
  • +
    + 13 +
    +
  • +
  • +
    + 14 +
    +
  • +
  • +
    + 15 +
    +
  • +
  • +
    + 16 +
    +
  • +
  • +
    + 17 +
    +
  • +
  • +
    + 18 +
    +
  • +
  • +
    + 19 +
    +
  • +
  • +
    + 20 +
    +
  • +
  • +
    + 21 +
    +
  • +
  • +
    + 22 +
    +
  • +
  • +
    + 23 +
    +
  • +
  • +
    + 24 +
    +
  • +
  • +
    + 25 +
    +
  • +
  • +
    + 26 +
    +
  • +
  • +
    + 27 +
    +
  • +
  • +
    + 28 +
    +
  • +
  • +
    + 29 +
    +
  • +
  • +
    + 30 +
    +
  • +
  • +
    + 31 +
    +
  • +
  • +
    + 32 +
    +
  • +
  • +
    + 33 +
    +
  • +
  • +
    + 34 +
    +
  • +
  • +
    + 35 +
    +
  • +
  • +
    + 36 +
    +
  • +
  • +
    + 37 +
    +
  • +
  • +
    + 38 +
    +
  • +
  • +
    + 39 +
    +
  • +
  • +
    + 40 +
    +
  • +
  • +
    + 41 +
    +
  • +
  • +
    + 42 +
    +
  • +
  • +
    + 43 +
    +
  • +
  • +
    + 44 +
    +
  • +
  • +
    + 45 +
    +
  • +
  • +
    + 46 +
    +
  • +
  • +
    + 47 +
    +
  • +
  • +
    + 48 +
    +
  • +
  • +
    + 49 +
    +
  • +
  • +
    + 50 +
    +
  • +
  • +
    + 51 +
    +
  • +
  • +
    + 52 +
    +
  • +
  • +
    + 53 +
    +
  • +
  • +
    + 54 +
    +
  • +
  • +
    + 55 +
    +
  • +
  • +
    + 56 +
    +
  • +
  • +
    + 57 +
    +
  • +
  • +
    + 58 +
    +
  • +
  • +
    + 59 +
    +
  • +
    -
-
    -
  • -
    - 00 -
    -
  • - 01 + 24
  • - 02 + 25
  • - 03 + 26
  • - 04 + 27
  • - 05 + 28
  • - 06 + 29
  • - 07 + 30
  • - 08 + 31
  • - 09 + 32
  • - 10 + 33
  • - 11 + 34
  • - 12 + 35
  • - 13 + 36
  • - 14 + 37
  • - 15 + 38
  • - 16 + 39
  • - 17 + 40
  • - 18 + 41
  • - 19 + 42
  • - 20 + 43
  • - 21 + 44
  • - 22 + 45
  • - 23 + 46
  • - 24 + 47
  • - 25 + 48
  • - 26 + 49
  • - 27 + 50
  • - 28 + 51
  • - 29 + 52
  • - 30 + 53
  • - 31 + 54
  • - 32 + 55
  • - 33 + 56
  • - 34 + 57
  • - 35 + 58
  • - 36 + 59
  • -
  • -
    +
    + + + + + + + + + +`; + +exports[`renders ./components/date-picker/demo/status.md extend context correctly 1`] = ` +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + + +
    + + +
    + + +
    +
    +
  • - Sep + Q1
    - Oct + Q2
    - Nov + Q3
    - Dec + Q4
    -
    - Jan -
    -
    -
    - Feb -
    -
    -
    - Mar -
    -
    -
    - Apr -
    -
    -
    - May -
    -
    -
    - Jun -
    -
    -
    - Jul -
    -
    -
    - Aug -
    -
    - Sep + Q1
    - Oct + Q2
    - Nov + Q3
    - Dec + Q4
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Su + + Mo + + Tu + + We + + Th + + Fr + + Sa +
    - 37 - - -
  • -
    + 30 +
    +
  • - 38 - - -
  • -
    + 31 +
    +
  • - 39 - - -
  • -
    + 1 +
    +
  • - 40 - - -
  • -
    + 2 +
    +
  • - 41 - - -
  • -
    + 3 +
    +
  • - 42 - - -
  • -
    + 4 +
    +
  • - 43 - - -
  • -
    + 5 +
    +
  • - 44 - - -
  • -
    + 6 +
    +
  • - 45 - - -
  • -
    + 7 +
    +
  • - 46 - - -
  • -
    + 8 +
    +
  • - 47 - - -
  • -
    + 9 +
    +
  • - 48 - - -
  • -
    + 10 +
    +
  • - 49 - - -
  • -
    + 11 +
    +
  • - 50 - - -
  • -
    + 12 +
    +
  • - 51 - - -
  • -
    + 13 +
    +
  • - 52 - - -
  • -
    + 14 +
    +
  • - 53 - - -
  • -
    + 15 +
    +
  • - 54 - - -
  • -
    + 16 +
    +
  • - 55 - - -
  • -
    + 17 +
    +
  • - 56 - - -
  • -
    + 18 +
    +
  • - 57 - - -
  • -
    + 19 +
    +
  • - 58 - - -
  • -
    + 20 +
    +
  • - 59 - - - -
      -
    • -
      + 21 +
      +
    - 00 - - -
  • -
    + 22 +
    +
  • - 01 - - -
  • -
    + 23 +
    +
  • - 02 - - -
  • -
    + 24 +
    +
  • - 03 - - -
  • -
    + 25 +
    +
  • - 04 - - -
  • -
    + 26 +
    +
  • - 05 - - -
  • -
    + 27 +
    +
  • - 06 - - -
  • -
    + 28 +
    +
  • - 07 - - -
  • -
    + 29 +
    +
  • - 08 - - -
  • -
    + 30 +
    +
  • - 09 - - -
  • -
    + 1 +
    +
  • - 10 - - -
  • -
    + 2 +
    +
  • - 11 - - -
  • -
    + 3 +
    +
  • +
    + 4 +
    +
    - 12 - - -
  • -
    + 5 +
    +
  • - 13 - - -
  • -
    + 6 +
    +
  • - 14 - - -
  • -
    + 7 +
    +
  • - 15 - - -
  • -
    + 8 +
    +
  • - 16 - - -
  • -
    + 9 +
    +
  • - 17 - - -
  • -
    + 10 +
    +
  • +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + + +
    + + +
    + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Su + + Mo + + Tu + + We + + Th + + Fr + + Sa +
    - 18 - - -
  • -
    + 30 +
    +
  • - 19 - - -
  • -
    + 31 +
    +
  • - 20 - - -
  • -
    + 1 +
    +
  • - 21 - - -
  • -
    + 2 +
    +
  • - 22 - - -
  • -
    + 3 +
    +
  • - 23 - - -
  • -
    + 4 +
    +
  • - 24 - - -
  • -
    + 5 +
    +
  • - 25 - - -
  • -
    + 6 +
    +
  • - 26 - - -
  • -
    + 7 +
    +
  • - 27 - - -
  • -
    + 8 +
    +
  • - 28 - - -
  • -
    + 9 +
    +
  • - 29 - - -
  • -
    + 10 +
    +
  • - 30 - - -
  • -
    + 11 +
    +
  • - 31 - - -
  • -
    + 12 +
    +
  • - 32 - - -
  • -
    + 13 +
    +
  • - 33 - - -
  • -
    + 14 +
    +
  • - 34 - - -
  • -
    + 15 +
    +
  • - 35 - - -
  • -
    + 16 +
    +
  • - 36 - - -
  • -
    + 17 +
    +
  • - 37 - - -
  • -
    + 18 +
    +
  • - 38 - - -
  • -
    + 19 +
    +
  • - 39 - - -
  • -
    + 20 +
    +
  • - 40 - - -
  • -
    + 21 +
    +
  • - 41 - - -
  • -
    + 22 +
    +
  • - 42 - - -
  • -
    + 23 +
    +
  • - 43 - - -
  • -
    + 24 +
    +
  • - 44 - - -
  • -
    + 25 +
    +
  • - 45 - - -
  • -
    + 26 +
    +
  • - 46 - - -
  • -
    + 27 +
    +
  • - 47 - - -
  • -
    + 28 +
    +
  • - 48 - - -
  • -
    + 29 +
    +
  • - 49 - - -
  • -
    + 30 +
    +
  • - 50 - - -
  • -
    + 1 +
    +
  • - 51 - - -
  • -
    + 2 +
    +
  • - 52 - - -
  • -
    + 3 +
    +
  • - 53 - - -
  • -
    + 4 +
    +
  • - 54 - - -
  • -
    + 5 +
    +
  • - 55 - - -
  • -
    + 6 +
    +
  • - 56 - - -
  • -
    + 7 +
    +
  • - 57 - - -
  • -
    + 8 +
    +
  • - 58 - - -
  • -
    + 9 +
    +
  • - 59 - - - - +
    + 10 +
    +
    diff --git a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap index a8c220b6cb43..6e0dc91b0fc2 100644 --- a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap @@ -2349,6 +2349,216 @@ exports[`renders ./components/date-picker/demo/mode.md correctly 1`] = `
    `; +exports[`renders ./components/date-picker/demo/placement.md correctly 1`] = ` +Array [ +
    + + + + +
    , +
    , +
    , +
    +
    + + + + + + +
    +
    , +
    , +
    , +
    +
    + +
    +
    + + + + + +
    +
    + +
    +
    + + + + + +
    , +] +`; + exports[`renders ./components/date-picker/demo/presetted-ranges.md correctly 1`] = `
    +
    +
    +
    + +
    +
    + + + + + +
    +
    + +
    +
    + + + + + +
    +
    @@ -3432,6 +3728,103 @@ exports[`renders ./components/date-picker/demo/start-end.md correctly 1`] = `
    `; +exports[`renders ./components/date-picker/demo/status.md correctly 1`] = ` +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    +`; + exports[`renders ./components/date-picker/demo/suffix.md correctly 1`] = `
    { it('DatePicker ref methods', () => { @@ -13,6 +15,23 @@ describe('DatePicker.typescript', () => { ); expect(datePicker).toBeTruthy(); }); + + // https://github.com/ant-design/ant-design/issues/33417 + it('DatePicker ref methods with forwardRef', () => { + const MyDatePicker = React.forwardRef((props, ref: DatePickRef) => ( + + )); + const datePicker = ( + { + picker?.focus(); + picker?.blur(); + }} + /> + ); + expect(datePicker).toBeTruthy(); + }); + it('RangePicker ref methods', () => { const rangePicker = ( { ); expect(rangePicker).toBeTruthy(); }); + + it('RangePicker ref methods with forwardRef', () => { + const MyRangePicker = React.forwardRef((props, ref: RangePickerRef) => ( + + )); + const datePicker = ( + { + picker?.focus(); + picker?.blur(); + }} + /> + ); + expect(datePicker).toBeTruthy(); + }); }); diff --git a/components/date-picker/demo/placement.md b/components/date-picker/demo/placement.md new file mode 100644 index 000000000000..b878b80cf830 --- /dev/null +++ b/components/date-picker/demo/placement.md @@ -0,0 +1,47 @@ +--- +order: 28 +title: + zh-CN: 基本 + en-US: Basic +--- + +## zh-CN + +可以通过 `placement` 手动指定弹出的位置。 + +## en-US + +You can manually specify the position of the popup via `placement`. + +```jsx +import { DatePicker, Space, Radio } from 'infrad'; + +const { RangePicker } = DatePicker; + +const SetPlacementDemo = () => { + const [placement, SetPlacement] = React.useState('topLeft'); + + const placementChange = e => { + SetPlacement(e.target.value); + }; + + return ( + <> + + topLeft + topRight + bottomLeft + bottomRight + +
    +
    + +
    +
    + + + ); +}; + +ReactDOM.render(, mountNode); +``` diff --git a/components/date-picker/demo/range-picker.md b/components/date-picker/demo/range-picker.md index 67ea108c6c88..7e7f09f6141a 100644 --- a/components/date-picker/demo/range-picker.md +++ b/components/date-picker/demo/range-picker.md @@ -24,6 +24,7 @@ ReactDOM.render( + , mountNode, diff --git a/components/date-picker/demo/status.md b/components/date-picker/demo/status.md new file mode 100644 index 000000000000..7a75ecd7bafa --- /dev/null +++ b/components/date-picker/demo/status.md @@ -0,0 +1,28 @@ +--- +order: 19 +version: 4.19.0 +title: + zh-CN: 自定义状态 + en-US: Status +--- + +## zh-CN + +使用 `status` 为 DatePicker 添加状态,可选 `error` 或者 `warning`。 + +## en-US + +Add status to DatePicker with `status`, which could be `error` or `warning`. + +```tsx +import { DatePicker, Space } from 'infrad'; + +const Status: React.FC = () => ( + + + + +); + +ReactDOM.render(, mountNode); +``` diff --git a/components/date-picker/generatePicker/generateRangePicker.tsx b/components/date-picker/generatePicker/generateRangePicker.tsx index ad3cb8e25b0d..b22466ffa80a 100644 --- a/components/date-picker/generatePicker/generateRangePicker.tsx +++ b/components/date-picker/generatePicker/generateRangePicker.tsx @@ -12,7 +12,7 @@ import enUS from '../locale/en_US'; import { ConfigContext, ConfigConsumerProps } from '../../config-provider'; import SizeContext from '../../config-provider/SizeContext'; import LocaleReceiver from '../../locale-provider/LocaleReceiver'; -import { getRangePlaceholder } from '../util'; +import { getRangePlaceholder, transPlacement2DropdownAlign } from '../util'; import { RangePickerProps, PickerLocale, getTimeProps, Components } from '.'; import { PickerComponentClass } from './interface'; @@ -45,6 +45,7 @@ export default function generateRangePicker( prefixCls: customizePrefixCls, getPopupContainer: customGetPopupContainer, className, + placement, size: customizeSize, bordered = true, placeholder, @@ -75,6 +76,7 @@ export default function generateRangePicker( } ref={this.pickerRef} + dropdownAlign={transPlacement2DropdownAlign(direction, placement)} placeholder={getRangePlaceholder(picker, locale, placeholder)} suffixIcon={picker === 'time' ? : } clearIcon={} diff --git a/components/date-picker/generatePicker/generateSinglePicker.tsx b/components/date-picker/generatePicker/generateSinglePicker.tsx index d86f254201c6..2a8e13e2a4d7 100644 --- a/components/date-picker/generatePicker/generateSinglePicker.tsx +++ b/components/date-picker/generatePicker/generateSinglePicker.tsx @@ -5,7 +5,7 @@ import RCPicker from 'rc-picker'; import { PickerMode } from 'rc-picker/lib/interface'; import { GenerateConfig } from 'rc-picker/lib/generate/index'; import enUS from '../locale/en_US'; -import { getPlaceholder } from '../util'; +import { getPlaceholder, transPlacement2DropdownAlign } from '../util'; import devWarning from '../../_util/devWarning'; import { ConfigContext, ConfigConsumerProps } from '../../config-provider'; import LocaleReceiver from '../../locale-provider/LocaleReceiver'; @@ -19,9 +19,18 @@ import { Components, } from '.'; import { PickerComponentClass } from './interface'; +import { FormItemStatusContext } from '../../form/context'; +import { + getFeedbackIcon, + getMergedStatus, + getStatusClassNames, + InputStatus, +} from '../../_util/statusUtils'; export default function generatePicker(generateConfig: GenerateConfig) { - type DatePickerProps = PickerProps; + type DatePickerProps = PickerProps & { + status?: InputStatus; + }; function getPicker( picker?: PickerMode, @@ -57,6 +66,23 @@ export default function generatePicker(generateConfig: GenerateConfig< } }; + renderFeedback = (prefixCls: string) => ( + + {({ hasFeedback, status: contextStatus }) => { + const { status: customStatus } = this.props; + const status = getMergedStatus(contextStatus, customStatus); + return hasFeedback && getFeedbackIcon(prefixCls, status); + }} + + ); + + renderSuffix = (prefixCls: string, mergedPicker?: PickerMode) => ( + <> + {mergedPicker === 'time' ? : } + {this.renderFeedback(prefixCls)} + + ); + renderPicker = (contextLocale: PickerLocale) => { const locale = { ...contextLocale, ...this.props.locale }; const { getPrefixCls, direction, getPopupContainer } = this.context; @@ -66,7 +92,9 @@ export default function generatePicker(generateConfig: GenerateConfig< className, size: customizeSize, bordered = true, + placement, placeholder, + status: customStatus, ...restProps } = this.props; const { format, showTime } = this.props as any; @@ -97,36 +125,44 @@ export default function generatePicker(generateConfig: GenerateConfig< const mergedSize = customizeSize || size; return ( - - ref={this.pickerRef} - placeholder={getPlaceholder(mergedPicker, locale, placeholder)} - suffixIcon={ - mergedPicker === 'time' ? : - } - clearIcon={} - prevIcon={} - nextIcon={} - superPrevIcon={} - superNextIcon={} - allowClear - transitionName={`${rootPrefixCls}-slide-up`} - {...additionalProps} - {...restProps} - {...additionalOverrideProps} - locale={locale!.lang} - className={classNames( - { - [`${prefixCls}-${mergedSize}`]: mergedSize, - [`${prefixCls}-borderless`]: !bordered, - }, - className, + + {({ hasFeedback, status: contextStatus }) => ( + + ref={this.pickerRef} + placeholder={getPlaceholder(mergedPicker, locale, placeholder)} + suffixIcon={this.renderSuffix(prefixCls, mergedPicker)} + dropdownAlign={transPlacement2DropdownAlign(direction, placement)} + clearIcon={} + prevIcon={} + nextIcon={} + superPrevIcon={} + superNextIcon={} + allowClear + transitionName={`${rootPrefixCls}-slide-up`} + {...additionalProps} + {...restProps} + {...additionalOverrideProps} + locale={locale!.lang} + className={classNames( + { + [`${prefixCls}-${mergedSize}`]: mergedSize, + [`${prefixCls}-borderless`]: !bordered, + }, + getStatusClassNames( + prefixCls, + getMergedStatus(contextStatus, customStatus), + hasFeedback, + ), + className, + )} + prefixCls={prefixCls} + getPopupContainer={customizeGetPopupContainer || getPopupContainer} + generateConfig={generateConfig} + components={Components} + direction={direction} + /> )} - prefixCls={prefixCls} - getPopupContainer={customizeGetPopupContainer || getPopupContainer} - generateConfig={generateConfig} - components={Components} - direction={direction} - /> + ); }} diff --git a/components/date-picker/generatePicker/index.tsx b/components/date-picker/generatePicker/index.tsx index adf7476f5b10..f6341c972408 100644 --- a/components/date-picker/generatePicker/index.tsx +++ b/components/date-picker/generatePicker/index.tsx @@ -19,6 +19,7 @@ import { TimePickerLocale } from '../../time-picker'; import generateSinglePicker from './generateSinglePicker'; import generateRangePicker from './generateRangePicker'; import { QuickPicker, IQuickDatePicker } from './QuickPicker'; +import { tuple } from '../../_util/type'; export const Components = { button: PickerButton, rangeItem: PickerTag }; @@ -29,13 +30,18 @@ function toArray(list: T | T[]): T[] { return Array.isArray(list) ? list : [list]; } -export function getTimeProps( - props: { format?: string; picker?: PickerMode } & SharedTimeProps, +export function getTimeProps( + props: { format?: string; picker?: PickerMode } & Omit< + SharedTimeProps, + 'disabledTime' + > & { + disabledTime?: DisabledTime; + }, ) { const { format, picker, showHour, showMinute, showSecond, use12Hours } = props; const firstFormat = toArray(format)[0]; - const showTimeObj: SharedTimeProps = { ...props }; + const showTimeObj = { ...props }; if (firstFormat && typeof firstFormat === 'string') { if (!firstFormat.includes('s') && showSecond === undefined) { @@ -66,6 +72,8 @@ export function getTimeProps( showTime: showTimeObj, }; } +const DataPickerPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight'); +type DataPickerPlacement = typeof DataPickerPlacements[number]; type InjectDefaultProps = Omit< Props, @@ -73,6 +81,7 @@ type InjectDefaultProps = Omit< > & { locale?: PickerLocale; size?: SizeType; + placement?: DataPickerPlacement; bordered?: boolean; }; @@ -95,6 +104,7 @@ export type AdditionalPickerLocaleLangProps = { monthPlaceholder?: string; weekPlaceholder?: string; rangeYearPlaceholder?: [string, string]; + rangeQuarterPlaceholder?: [string, string]; rangeMonthPlaceholder?: [string, string]; rangeWeekPlaceholder?: [string, string]; rangePlaceholder?: [string, string]; diff --git a/components/date-picker/generatePicker/interface.tsx b/components/date-picker/generatePicker/interface.tsx index 2daf343d66a0..c0771f2e0cac 100644 --- a/components/date-picker/generatePicker/interface.tsx +++ b/components/date-picker/generatePicker/interface.tsx @@ -1,4 +1,5 @@ -import { ComponentClass } from 'react'; +import type { ComponentClass, ForwardedRef, Component } from 'react'; +import { PickerProps, RangePickerProps } from '.'; export interface CommonPickerMethods { focus: () => void; @@ -9,3 +10,9 @@ export interface PickerComponentClass

    extends ComponentClas new (...args: ConstructorParameters>): InstanceType> & CommonPickerMethods; } + +export type PickerRef

    = ForwardedRef & CommonPickerMethods>; + +export type DatePickRef = PickerRef>; + +export type RangePickerRef = PickerRef>; diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index 0a93414b4797..648ef673f1c0 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -69,9 +69,11 @@ The following APIs are shared by DatePicker, RangePicker. | panelRender | Customize panel render | (panelNode) => ReactNode | - | 4.5.0 | | picker | Set picker type | `date` \| `week` \| `month` \| `quarter` \| `year` | `date` | `quarter`: 4.1.0 | | placeholder | The placeholder of date input | string \| \[string,string] | - | | +| placement | The position where the selection box pops up | `bottomLeft` `bottomRight` `topLeft` `topRight` | bottomLeft | | | popupStyle | To customize the style of the popup calendar | CSSProperties | {} | | | prevIcon | The custom prev icon | ReactNode | - | 4.17.0 | | size | To determine the size of the input box, the height of `large` and `small`, are 40px and 24px respectively, while default size is 32px | `large` \| `middle` \| `small` | - | | +| status | Set validation status | 'error' \| 'warning' | - | 4.19.0 | | style | To customize the style of the input box | CSSProperties | {} | | | suffixIcon | The custom suffix icon | ReactNode | - | | | superNextIcon | The custom super next icon | ReactNode | - | 4.17.0 | diff --git a/components/date-picker/index.zh-CN.md b/components/date-picker/index.zh-CN.md index a65f3d4431e5..e2780b3e5ee3 100644 --- a/components/date-picker/index.zh-CN.md +++ b/components/date-picker/index.zh-CN.md @@ -71,9 +71,11 @@ import locale from 'infrad/lib/locale/zh_CN'; | panelRender | 自定义渲染面板 | (panelNode) => ReactNode | - | 4.5.0 | | picker | 设置选择器类型 | `date` \| `week` \| `month` \| `quarter` \| `year` | `date` | `quarter`: 4.1.0 | | placeholder | 输入框提示文字 | string \| \[string, string] | - | | +| placement | 选择框弹出的位置 | `bottomLeft` `bottomRight` `topLeft` `topRight` | bottomLeft | | | popupStyle | 额外的弹出日历样式 | CSSProperties | {} | | | prevIcon | 自定义上一个图标 | ReactNode | - | 4.17.0 | | size | 输入框大小,`large` 高度为 40px,`small` 为 24px,默认是 32px | `large` \| `middle` \| `small` | - | | +| status | 设置校验状态 | 'error' \| 'warning' | - | 4.19.0 | | style | 自定义输入框样式 | CSSProperties | {} | | | suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | | | superNextIcon | 自定义 `<<` 切换图标 | ReactNode | - | 4.17.0 | diff --git a/components/date-picker/locale/en_GB.tsx b/components/date-picker/locale/en_GB.tsx index 15cb6161b257..5e278f58c032 100644 --- a/components/date-picker/locale/en_GB.tsx +++ b/components/date-picker/locale/en_GB.tsx @@ -12,6 +12,7 @@ const locale: PickerLocale = { weekPlaceholder: 'Select week', rangePlaceholder: ['Start date', 'End date'], rangeYearPlaceholder: ['Start year', 'End year'], + rangeQuarterPlaceholder: ['Start quarter', 'End quarter'], rangeMonthPlaceholder: ['Start month', 'End month'], rangeWeekPlaceholder: ['Start week', 'End week'], ...CalendarLocale, diff --git a/components/date-picker/locale/en_US.tsx b/components/date-picker/locale/en_US.tsx index 47b57b9eeb24..358216edd786 100644 --- a/components/date-picker/locale/en_US.tsx +++ b/components/date-picker/locale/en_US.tsx @@ -12,6 +12,7 @@ const locale: PickerLocale = { weekPlaceholder: 'Select week', rangePlaceholder: ['Start date', 'End date'], rangeYearPlaceholder: ['Start year', 'End year'], + rangeQuarterPlaceholder: ['Start quarter', 'End quarter'], rangeMonthPlaceholder: ['Start month', 'End month'], rangeWeekPlaceholder: ['Start week', 'End week'], ...CalendarLocale, diff --git a/components/date-picker/locale/zh_CN.tsx b/components/date-picker/locale/zh_CN.tsx index bb3181123d8b..41df329de639 100644 --- a/components/date-picker/locale/zh_CN.tsx +++ b/components/date-picker/locale/zh_CN.tsx @@ -13,6 +13,7 @@ const locale: PickerLocale = { rangePlaceholder: ['开始日期', '结束日期'], rangeYearPlaceholder: ['开始年份', '结束年份'], rangeMonthPlaceholder: ['开始月份', '结束月份'], + rangeQuarterPlaceholder: ['开始季度', '结束季度'], rangeWeekPlaceholder: ['开始周', '结束周'], ...CalendarLocale, }, diff --git a/components/date-picker/locale/zh_TW.tsx b/components/date-picker/locale/zh_TW.tsx index 663e94380282..f0bcf20c1e34 100644 --- a/components/date-picker/locale/zh_TW.tsx +++ b/components/date-picker/locale/zh_TW.tsx @@ -13,6 +13,7 @@ const locale: PickerLocale = { rangePlaceholder: ['開始日期', '結束日期'], rangeYearPlaceholder: ['開始年份', '結束年份'], rangeMonthPlaceholder: ['開始月份', '結束月份'], + rangeQuarterPlaceholder: ['開始季度', '結束季度'], rangeWeekPlaceholder: ['開始周', '結束周'], ...CalendarLocale, }, diff --git a/components/date-picker/style/index.less b/components/date-picker/style/index.less index fe07cffcaf71..c0f0a2d88bb3 100644 --- a/components/date-picker/style/index.less +++ b/components/date-picker/style/index.less @@ -1,6 +1,7 @@ @import '../../style/themes/index'; @import '../../style/mixins/index'; @import '../../input/style/mixin'; +@import './status'; @picker-prefix-cls: ~'@{ant-prefix}-picker'; @@ -13,7 +14,7 @@ } .@{picker-prefix-cls} { - @arrow-size: 10px; + @arrow-size: @popover-arrow-width; .reset-component(); .picker-padding(@input-height-base, @font-size-base, @input-padding-horizontal-base); @@ -106,6 +107,8 @@ } &-suffix { + display: flex; + flex: none; align-self: center; margin-left: (@padding-xs / 2); color: @disabled-color; @@ -114,6 +117,10 @@ > * { vertical-align: top; + + &:not(:last-child) { + margin-right: 8px; + } } } @@ -221,17 +228,17 @@ &-placement-bottomLeft { .@{picker-prefix-cls}-range-arrow { - top: (@arrow-size / 2) - (@arrow-size / 3); + top: (@arrow-size / 2) - (@arrow-size / 3) + 0.7px; display: block; - transform: rotate(-45deg); + transform: rotate(-135deg) translateY(1px); } } &-placement-topLeft { .@{picker-prefix-cls}-range-arrow { - bottom: (@arrow-size / 2) - (@arrow-size / 3); + bottom: (@arrow-size / 2) - (@arrow-size / 3) + 0.7px; display: block; - transform: rotate(135deg); + transform: rotate(45deg); } } @@ -311,19 +318,14 @@ width: @arrow-size; height: @arrow-size; margin-left: @input-padding-horizontal-base * 1.5; - box-shadow: 2px -2px 6px fade(@black, 6%); + background: linear-gradient( + 135deg, + transparent 40%, + @calendar-bg 40% + ); // Use linear-gradient to prevent arrow from covering text + box-shadow: 2px 2px 6px -2px fade(@black, 10%); // use spread radius to hide shadow over popover transition: left @animation-duration-slow ease-out; - - &::after { - position: absolute; - top: @border-width-base; - right: @border-width-base; - width: @arrow-size; - height: @arrow-size; - border: (@arrow-size / 2) solid @border-color-split; - border-color: @calendar-bg @calendar-bg transparent transparent; - content: ''; - } + .roundedArrow(@arrow-size, 5px, @calendar-bg); } &-panel-container { diff --git a/components/date-picker/style/index.tsx b/components/date-picker/style/index.tsx index cc4424295a44..18447e360f85 100644 --- a/components/date-picker/style/index.tsx +++ b/components/date-picker/style/index.tsx @@ -3,3 +3,5 @@ import './index.less'; // style dependencies import '../../tag/style'; import '../../button/style'; + +// deps-lint-skip: form diff --git a/components/date-picker/style/panel.less b/components/date-picker/style/panel.less index 5c6ee0a4f0e8..fec6899f38c7 100644 --- a/components/date-picker/style/panel.less +++ b/components/date-picker/style/panel.less @@ -101,7 +101,7 @@ display: inline-block; width: @picker-arrow-size; height: @picker-arrow-size; - border: 0 solid currentColor; + border: 0 solid currentcolor; border-width: 1.5px 0 0 1.5px; content: ''; } @@ -116,7 +116,7 @@ display: inline-block; width: @picker-arrow-size; height: @picker-arrow-size; - border: 0 solid currentColor; + border: 0 solid currentcolor; border-width: 1.5px 0 0 1.5px; content: ''; } diff --git a/components/date-picker/style/status.less b/components/date-picker/style/status.less new file mode 100644 index 000000000000..be3adba330e3 --- /dev/null +++ b/components/date-picker/style/status.less @@ -0,0 +1,52 @@ +@import '../../input/style/mixin'; + +@picker-prefix-cls: ~'@{ant-prefix}-picker'; + +.picker-status-color( + @text-color: @input-color; + @border-color: @input-border-color; + @background-color: @input-bg; + @hoverBorderColor: @primary-color-hover; + @outlineColor: @primary-color-outline; +) { + &.@{picker-prefix-cls} { + &, + &:not([disabled]):hover { + background-color: @background-color; + border-color: @border-color; + } + + &-focused, + &:focus { + .active(@text-color, @hoverBorderColor, @outlineColor); + } + } + + .@{picker-prefix-cls}-feedback-icon { + color: @text-color; + } +} + +.@{picker-prefix-cls} { + &-status-error { + .picker-status-color(@error-color, @error-color, @input-bg, @error-color-hover, @error-color-outline); + } + + &-status-warning { + .picker-status-color(@warning-color, @warning-color, @input-bg, @warning-color-hover, @warning-color-outline); + } + + &-status-validating { + .@{picker-prefix-cls}-feedback-icon { + display: inline-block; + color: @primary-color; + } + } + + &-status-success { + .@{picker-prefix-cls}-feedback-icon { + color: @success-color; + animation-name: diffZoomIn1 !important; + } + } +} diff --git a/components/date-picker/util.ts b/components/date-picker/util.ts index 0643a0842a16..c2dbc6c50132 100644 --- a/components/date-picker/util.ts +++ b/components/date-picker/util.ts @@ -1,4 +1,6 @@ import { PickerMode } from 'rc-picker/lib/interface'; +import { DirectionType } from '../config-provider'; +import { SelectCommonPlacement } from '../_util/motion'; import { PickerLocale } from './generatePicker'; export function getPlaceholder( @@ -40,6 +42,9 @@ export function getRangePlaceholder( if (picker === 'year' && locale.lang.yearPlaceholder) { return locale.lang.rangeYearPlaceholder; } + if (picker === 'quarter' && locale.lang.quarterPlaceholder) { + return locale.lang.rangeQuarterPlaceholder; + } if (picker === 'month' && locale.lang.monthPlaceholder) { return locale.lang.rangeMonthPlaceholder; } @@ -51,3 +56,56 @@ export function getRangePlaceholder( } return locale.lang.rangePlaceholder; } + +export function transPlacement2DropdownAlign( + direction: DirectionType, + placement?: SelectCommonPlacement, +) { + const overflow = { + adjustX: 1, + adjustY: 1, + }; + switch (placement) { + case 'bottomLeft': { + return { + points: ['tl', 'bl'], + offset: [0, 4], + overflow, + }; + } + case 'bottomRight': { + return { + points: ['tr', 'br'], + offset: [0, 4], + overflow, + }; + } + case 'topLeft': { + return { + points: ['bl', 'tl'], + offset: [0, -4], + overflow, + }; + } + case 'topRight': { + return { + points: ['br', 'tr'], + offset: [0, -4], + overflow, + }; + } + default: { + return direction === 'rtl' + ? { + points: ['tr', 'br'], + offset: [0, 4], + overflow, + } + : { + points: ['tl', 'bl'], + offset: [0, 4], + overflow, + }; + } + } +} diff --git a/components/divider/index.tsx b/components/divider/index.tsx index e45e8a9e60ea..aa52bdd74d74 100644 --- a/components/divider/index.tsx +++ b/components/divider/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import classNames from 'classnames'; -import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; +import { ConfigContext } from '../config-provider'; export interface DividerProps { prefixCls?: string; @@ -14,56 +14,54 @@ export interface DividerProps { plain?: boolean; } -const Divider: React.FC = props => ( - - {({ getPrefixCls, direction }: ConfigConsumerProps) => { - const { - prefixCls: customizePrefixCls, - type = 'horizontal', - orientation = 'center', - orientationMargin, - className, - children, - dashed, - plain, - ...restProps - } = props; - const prefixCls = getPrefixCls('divider', customizePrefixCls); - const orientationPrefix = orientation.length > 0 ? `-${orientation}` : orientation; - const hasChildren = !!children; - const hasCustomMarginLeft = orientation === 'left' && orientationMargin != null; - const hasCustomMarginRight = orientation === 'right' && orientationMargin != null; - const classString = classNames( - prefixCls, - `${prefixCls}-${type}`, - { - [`${prefixCls}-with-text`]: hasChildren, - [`${prefixCls}-with-text${orientationPrefix}`]: hasChildren, - [`${prefixCls}-dashed`]: !!dashed, - [`${prefixCls}-plain`]: !!plain, - [`${prefixCls}-rtl`]: direction === 'rtl', - [`${prefixCls}-no-default-orientation-margin-left`]: hasCustomMarginLeft, - [`${prefixCls}-no-default-orientation-margin-right`]: hasCustomMarginRight, - }, - className, - ); +const Divider: React.FC = props => { + const { getPrefixCls, direction } = React.useContext(ConfigContext); - const innerStyle = { - ...(hasCustomMarginLeft && { marginLeft: orientationMargin }), - ...(hasCustomMarginRight && { marginRight: orientationMargin }), - }; + const { + prefixCls: customizePrefixCls, + type = 'horizontal', + orientation = 'center', + orientationMargin, + className, + children, + dashed, + plain, + ...restProps + } = props; + const prefixCls = getPrefixCls('divider', customizePrefixCls); + const orientationPrefix = orientation.length > 0 ? `-${orientation}` : orientation; + const hasChildren = !!children; + const hasCustomMarginLeft = orientation === 'left' && orientationMargin != null; + const hasCustomMarginRight = orientation === 'right' && orientationMargin != null; + const classString = classNames( + prefixCls, + `${prefixCls}-${type}`, + { + [`${prefixCls}-with-text`]: hasChildren, + [`${prefixCls}-with-text${orientationPrefix}`]: hasChildren, + [`${prefixCls}-dashed`]: !!dashed, + [`${prefixCls}-plain`]: !!plain, + [`${prefixCls}-rtl`]: direction === 'rtl', + [`${prefixCls}-no-default-orientation-margin-left`]: hasCustomMarginLeft, + [`${prefixCls}-no-default-orientation-margin-right`]: hasCustomMarginRight, + }, + className, + ); - return ( -

    - {children && ( - - {children} - - )} -
    - ); - }} - -); + const innerStyle = { + ...(hasCustomMarginLeft && { marginLeft: orientationMargin }), + ...(hasCustomMarginRight && { marginRight: orientationMargin }), + }; + + return ( +
    + {children && ( + + {children} + + )} +
    + ); +}; export default Divider; diff --git a/components/divider/style/index.less b/components/divider/style/index.less index ba271e05397e..ff7e932ef09d 100644 --- a/components/divider/style/index.less +++ b/components/divider/style/index.less @@ -13,7 +13,7 @@ top: -0.06em; display: inline-block; height: 0.9em; - margin: 0 8px; + margin: 0 @divider-vertical-gutter; vertical-align: middle; border-top: 0; border-left: @border-width-base solid @divider-color; diff --git a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap index 944ad8b1aa4b..5b0680e6b11c 100644 --- a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap @@ -3,7 +3,7 @@ exports[`Drawer render correctly 1`] = `
    , ,
    @@ -429,7 +429,7 @@ Array [
    ,
    ,
    ,
    , ,
    @@ -1069,7 +1069,1291 @@ Array [
    , , +
    +
    +
    + +
    @@ -16960,7 +17296,7 @@ exports[`renders ./components/form/demo/validate-static.md extend context correc class="ant-form-item-control-input-content" >
    + + + + +
    @@ -18368,29 +18727,6 @@ exports[`renders ./components/form/demo/validate-static.md extend context correc
    - - - - -
    @@ -18417,7 +18753,7 @@ exports[`renders ./components/form/demo/validate-static.md extend context correc class="ant-form-item-control-input-content" >
    + > + I'm Select +
    - +
    +
    +
    +
    + +
    +
    +
    +
    - - + + + + + I'm Cascader + +
    +
    +
    +
    +
    + +
    +
    +
    +
    + - + + + + +
    +
    +
    +
    +
    + > + I'm TreeSelect +
    -
    - +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    @@ -18707,38 +19194,15 @@ exports[`renders ./components/form/demo/validate-static.md extend context correc
    - - - - -
    @@ -18780,7 +19244,7 @@ exports[`renders ./components/form/demo/validate-static.md extend context correc class="ant-form-item-control-input-content" >
    +
    + + + + + + + + + + +
    +
    + +
    +
    + + +
    +
    +
    + + +
    +
    + +
    +
    +
    +
    + + + -
    -
    - -
    -
    -
    - - - + + + + + + - +
    + + + + +
    - - - - -
    + + + + + + + + + +
    - - - - -
    @@ -20306,9 +20895,9 @@ exports[`renders ./components/form/demo/validate-static.md extend context correc >
    - - +
    + +
    +
    +
    +
    + +
    +
    + +`; diff --git a/components/mentions/__tests__/__snapshots__/demo.test.js.snap b/components/mentions/__tests__/__snapshots__/demo.test.js.snap index cbc74049399c..e794c84dca76 100644 --- a/components/mentions/__tests__/__snapshots__/demo.test.js.snap +++ b/components/mentions/__tests__/__snapshots__/demo.test.js.snap @@ -137,7 +137,7 @@ exports[`renders ./components/mentions/demo/form.md correctly 1`] = `     , +
    , +
    , + , + "`; +exports[`Popconfirm should show overlay when trigger is clicked 1`] = `"
    code
    "`; -exports[`Popconfirm should show overlay when trigger is clicked 2`] = `"
    code
    "`; +exports[`Popconfirm should show overlay when trigger is clicked 2`] = `"
    code
    "`; -exports[`Popconfirm shows content for render functions 1`] = `"
    some-title
    "`; +exports[`Popconfirm shows content for render functions 1`] = `"
    some-title
    "`; diff --git a/components/popover/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/popover/__tests__/__snapshots__/demo-extend.test.ts.snap index 6c0d229581a4..d7d0a3d0d69b 100644 --- a/components/popover/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/popover/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -3,7 +3,7 @@ exports[`renders ./components/popover/demo/arrow-point-at-center.md extend context correctly 1`] = ` Array [ , , , , , , , , , , , , ,
    `; +exports[`renders ./components/table/demo/filter-search.md extend context correctly 1`] = ` +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + Name + + + + + + +
    +
    +
    + +
    + +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    +
    + + Age + + + + + + + + + + + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + + Address + + + + + + +
    +
    +
    + + + +
    +
    +
    + John Brown + + 32 + + New York No. 1 Lake Park +
    + Jim Green + + 42 + + London No. 1 Lake Park +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    + Jim Red + + 32 + + London No. 2 Lake Park +
    +
    +
    +
    +
      +
    • + +
    • +
    • + + 1 + +
    • +
    • + +
    • +
    +
    +
    +
    +`; + exports[`renders ./components/table/demo/fixed-columns.md extend context correctly 1`] = `
    `; +exports[`renders ./components/table/demo/filter-search.md correctly 1`] = ` +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + Name + + + + + + +
    +
    +
    + + Age + + + + + + + + + + + +
    +
    +
    + + Address + + + + + + +
    +
    + John Brown + + 32 + + New York No. 1 Lake Park +
    + Jim Green + + 42 + + London No. 1 Lake Park +
    + Joe Black + + 32 + + Sidney No. 1 Lake Park +
    + Jim Red + + 32 + + London No. 2 Lake Park +
    +
    +
    +
    +
      +
    • + +
    • +
    • + + 1 + +
    • +
    • + +
    • +
    +
    +
    +
    +`; + exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = `