From 9e856aaf1891206264896ca3186f1cf2176909f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Mon, 17 May 2021 10:41:06 +0800 Subject: [PATCH] chore: alpha Menu fix merge (#30546) * chore: Update script * bump alpha version * chore: Update script desc * chore: bump rc-tabs & rc-mentions * chore: Adjust style * chore: 4.16.0-alpha.1 * test: Fix mention test case * fix: sider of layout width style * chore: bump 4.16.0-alpha.2 --- components/date-picker/index.en-US.md | 8 ++++---- .../dropdown/__tests__/dropdown-button.test.js | 4 +++- components/dropdown/dropdown-button.tsx | 8 +++++--- components/layout/style/index.less | 5 +++++ components/mentions/__tests__/index.test.js | 4 ++-- components/menu/style/index.less | 14 ++++++++------ package.json | 6 +++--- scripts/check-commit.js | 4 +++- 8 files changed, 33 insertions(+), 20 deletions(-) diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index e9efe64e36..8a17970716 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -77,10 +77,10 @@ The following APIs are shared by DatePicker, RangePicker. ### Common Methods -| Name | Description | Version | -| --- | --- | --- | -| blur() | Remove focus | | -| focus() | Get focus | | +| Name | Description | Version | +| ------- | ------------ | ------- | +| blur() | Remove focus | | +| focus() | Get focus | | ### DatePicker diff --git a/components/dropdown/__tests__/dropdown-button.test.js b/components/dropdown/__tests__/dropdown-button.test.js index 80ed2586f4..8ddf1e4117 100644 --- a/components/dropdown/__tests__/dropdown-button.test.js +++ b/components/dropdown/__tests__/dropdown-button.test.js @@ -71,7 +71,9 @@ describe('DropdownButton', () => { foo ); - const wrapper = mount(); + const wrapper = mount( + , + ); expect(wrapper.find('Dropdown').props().mouseEnterDelay).toBe(1); expect(wrapper.find('Dropdown').props().mouseLeaveDelay).toBe(2); }); diff --git a/components/dropdown/dropdown-button.tsx b/components/dropdown/dropdown-button.tsx index 3d2f902baf..3a7ea15b5a 100644 --- a/components/dropdown/dropdown-button.tsx +++ b/components/dropdown/dropdown-button.tsx @@ -29,9 +29,11 @@ interface DropdownButtonInterface extends React.FC { } const DropdownButton: DropdownButtonInterface = props => { - const { getPopupContainer: getContextPopupContainer, getPrefixCls, direction } = React.useContext( - ConfigContext, - ); + const { + getPopupContainer: getContextPopupContainer, + getPrefixCls, + direction, + } = React.useContext(ConfigContext); const { prefixCls: customizePrefixCls, diff --git a/components/layout/style/index.less b/components/layout/style/index.less index 75b91938e2..86a912e70a 100644 --- a/components/layout/style/index.less +++ b/components/layout/style/index.less @@ -2,6 +2,7 @@ @import '../../style/mixins/index'; @layout-prefix-cls: ~'@{ant-prefix}-layout'; +@layout-menu-prefix-cls: ~'@{ant-prefix}-menu'; .@{layout-prefix-cls} { display: flex; @@ -66,6 +67,10 @@ // https://github.com/ant-design/ant-design/issues/7967 // solution from https://stackoverflow.com/a/33132624/3040605 padding-top: 0.1px; + + .@{layout-menu-prefix-cls}.@{layout-menu-prefix-cls}-inline-collapsed { + width: auto; + } } &-has-trigger { diff --git a/components/mentions/__tests__/index.test.js b/components/mentions/__tests__/index.test.js index 1139fce34f..d95963881c 100644 --- a/components/mentions/__tests__/index.test.js +++ b/components/mentions/__tests__/index.test.js @@ -81,14 +81,14 @@ describe('Mentions', () => { it('loading', () => { const wrapper = mount(); simulateInput(wrapper, '@'); - expect(wrapper.find('.ant-mentions-dropdown-menu-item').length).toBe(1); + expect(wrapper.find('li.ant-mentions-dropdown-menu-item').length).toBe(1); expect(wrapper.find('.ant-spin').length).toBeTruthy(); }); it('notFoundContent', () => { const wrapper = mount(} />); simulateInput(wrapper, '@'); - expect(wrapper.find('.ant-mentions-dropdown-menu-item').length).toBe(1); + expect(wrapper.find('li.ant-mentions-dropdown-menu-item').length).toBe(1); expect(wrapper.find('.bamboo-light').length).toBeTruthy(); }); }); diff --git a/components/menu/style/index.less b/components/menu/style/index.less index 785b9bcbb4..b8956d2fc0 100644 --- a/components/menu/style/index.less +++ b/components/menu/style/index.less @@ -293,6 +293,7 @@ } &-arrow { + // → &::before, &::after { position: absolute; @@ -318,7 +319,9 @@ color: @menu-highlight-color; } + .@{menu-prefix-cls}-inline-collapsed &-arrow, &-inline &-arrow { + // ↓ &::before { transform: rotate(-45deg) translateX(2.5px); } @@ -332,6 +335,7 @@ } &-open&-inline > &-title > &-arrow { + // ↑ transform: translateY(-2px); &::after { transform: rotate(-45deg) translateX(-2.5px); @@ -509,10 +513,8 @@ } } - &-inline-collapsed { - &:not(.@{ant-prefix}-layout-sider-children > ul) { - width: @menu-collapsed-width; - } + &&-inline-collapsed { + width: @menu-collapsed-width; > .@{menu-prefix-cls}-item, > .@{menu-prefix-cls}-item-group @@ -526,8 +528,9 @@ left: 0; padding: 0 ~'calc(50% - @{menu-icon-size-lg} / 2)'; text-overflow: clip; + .@{menu-prefix-cls}-submenu-arrow { - display: none; + opacity: 0; } .@{menu-prefix-cls}-item-icon, @@ -537,7 +540,6 @@ line-height: @menu-item-height; + span { display: inline-block; - // max-width: 0; opacity: 0; } } diff --git a/package.json b/package.json index 9fd46d96fb..fdd3ba51cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "4.15.5", + "version": "4.16.0-alpha.2", "description": "An enterprise-class UI design language and React components implementation", "title": "Ant Design", "keywords": [ @@ -125,7 +125,7 @@ "rc-field-form": "~1.20.0", "rc-image": "~5.2.4", "rc-input-number": "~7.1.0", - "rc-mentions": "~1.5.0", + "rc-mentions": "~1.6.0", "rc-menu": "~9.0.0-alpha.6", "rc-motion": "^2.4.0", "rc-notification": "~4.5.2", @@ -139,7 +139,7 @@ "rc-steps": "~4.1.0", "rc-switch": "~3.2.0", "rc-table": "~7.14.0", - "rc-tabs": "~11.7.0", + "rc-tabs": "~11.8.0", "rc-textarea": "~0.3.0", "rc-tooltip": "~5.1.1", "rc-tree": "~4.1.0", diff --git a/scripts/check-commit.js b/scripts/check-commit.js index 494f24c64a..71577cd333 100755 --- a/scripts/check-commit.js +++ b/scripts/check-commit.js @@ -24,7 +24,9 @@ async function checkVersion() { } async function checkBranch({ current }) { - if (current !== 'master' && current !== '4.0-prepare') { + if (version.includes('-alpha.')) { + console.log(chalk.cyan('😃 Alpha version. Skip branch check.')); + } else if (current !== 'master' && current !== '4.0-prepare') { console.log(chalk.yellow('🤔 You are not in the master branch!')); exitProcess(); }