diff --git a/components/_util/getDataOrAriaProps.ts b/components/_util/getDataOrAriaProps.ts index ee4e271ec6..1984714db6 100644 --- a/components/_util/getDataOrAriaProps.ts +++ b/components/_util/getDataOrAriaProps.ts @@ -1,8 +1,8 @@ export default function getDataOrAriaProps(props: any) { return Object.keys(props).reduce((prev: any, key: string) => { if ( - (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') && - key.substr(0, 7) !== 'data-__' + (key.startsWith('data-') || key.startsWith('aria-') || key === 'role') && + !key.startsWith('data-__') ) { prev[key] = props[key]; } diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index 7d4b3db0fa..487d7e9a69 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -21043,6 +21043,7 @@ exports[`ConfigProvider components Select configProvider 1`] = ` >
grp
@@ -21170,6 +21171,7 @@ exports[`ConfigProvider components Select configProvider componentSize large 1`] >
grp
@@ -21297,6 +21299,7 @@ exports[`ConfigProvider components Select configProvider componentSize middle 1` >
grp
@@ -21424,6 +21427,7 @@ exports[`ConfigProvider components Select configProvider virtual and dropdownMat >
grp
@@ -21551,6 +21555,7 @@ exports[`ConfigProvider components Select normal 1`] = ` >
grp
@@ -21678,6 +21683,7 @@ exports[`ConfigProvider components Select prefixCls 1`] = ` >
grp
diff --git a/components/select/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/select/__tests__/__snapshots__/demo-extend.test.ts.snap index 466c0ddbb7..828b8fa6b0 100644 --- a/components/select/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/select/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -3815,6 +3815,7 @@ exports[`renders ./components/select/demo/optgroup.md extend context correctly 1 >
Manager
@@ -3854,6 +3855,7 @@ exports[`renders ./components/select/demo/optgroup.md extend context correctly 1
Engineer
diff --git a/components/select/demo/custom-dropdown-menu.md b/components/select/demo/custom-dropdown-menu.md index e0ed7a91be..3b8e6e9ea8 100644 --- a/components/select/demo/custom-dropdown-menu.md +++ b/components/select/demo/custom-dropdown-menu.md @@ -7,11 +7,11 @@ title: ## zh-CN -使用 `dropdownRender` 对下拉菜单进行自由扩展。 +使用 `dropdownRender` 对下拉菜单进行自由扩展。自定义内容点击时会关闭浮层,如果不喜欢关闭,可以添加 `onMouseDown={e => e.preventDefault()}` 进行阻止(更多详情见 [#13448](https://github.com/ant-design/ant-design/issues/13448))。 ## en-US -Customize the dropdown menu via `dropdownRender`. +Customize the dropdown menu via `dropdownRender`. Dropdown menu will be closed if click `dropdownRender` area, you can prevent it by wrapping `onMouseDown={e => e.preventDefault()}` (see more at [#13448](https://github.com/ant-design/ant-design/issues/13448)). ```jsx import React, { useState } from 'react'; diff --git a/components/select/index.en-US.md b/components/select/index.en-US.md index 71961722a0..5638cf67d0 100644 --- a/components/select/index.en-US.md +++ b/components/select/index.en-US.md @@ -113,7 +113,7 @@ It's caused by option with different `label` and `value`. You can use `optionFil ### The dropdown is closed when click `dropdownRender` area? -See the instruction in [dropdownRender example](#components-select-demo-custom-dropdown-menu). +Dropdown menu will be closed if click `dropdownRender` area, you can prevent it by wrapping `onMouseDown={e => e.preventDefault()}` (see more at [#13448](https://github.com/ant-design/ant-design/issues/13448)). ### Why sometime customize Option cause scroll break? diff --git a/components/select/index.zh-CN.md b/components/select/index.zh-CN.md index a441cf1297..91cb942bf1 100644 --- a/components/select/index.zh-CN.md +++ b/components/select/index.zh-CN.md @@ -114,7 +114,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_0XzgOis7/Select.svg ### 点击 `dropdownRender` 里的内容浮层关闭怎么办? -看下 [dropdownRender 例子](#components-select-demo-custom-dropdown-menu) 里的说明。 +自定义内容点击时会关闭浮层,如果不喜欢关闭,可以添加 `onMouseDown={e => e.preventDefault()}` 进行阻止(更多详情见 [#13448](https://github.com/ant-design/ant-design/issues/13448))。 ### 自定义 Option 样式导致滚动异常怎么办? diff --git a/components/tree/demo/search.md b/components/tree/demo/search.md index df8151d567..180e8cc483 100644 --- a/components/tree/demo/search.md +++ b/components/tree/demo/search.md @@ -110,8 +110,8 @@ class SearchTree extends React.Component { const loop = data => data.map(item => { const index = item.title.indexOf(searchValue); - const beforeStr = item.title.substr(0, index); - const afterStr = item.title.substr(index + searchValue.length); + const beforeStr = item.title.substring(0, index); + const afterStr = item.title.slice(index + searchValue.length); const title = index > -1 ? ( diff --git a/components/upload/demo/file-type.md b/components/upload/demo/file-type.md index 5ec7214cf1..4cae73ee9e 100644 --- a/components/upload/demo/file-type.md +++ b/components/upload/demo/file-type.md @@ -102,7 +102,7 @@ class PicturesWall extends React.Component { icon = ; // or icon = 'uploading...'; } else { fileSufIconList.forEach(item => { - if (item.suf.includes(file.name.substr(file.name.lastIndexOf('.')))) { + if (item.suf.includes(file.name.slice(file.name.lastIndexOf('.')))) { icon = item.type; } }); diff --git a/site/theme/template/Layout/Header/index.tsx b/site/theme/template/Layout/Header/index.tsx index 05942539a4..6b7fe8a183 100644 --- a/site/theme/template/Layout/Header/index.tsx +++ b/site/theme/template/Layout/Header/index.tsx @@ -192,7 +192,7 @@ class Header extends React.Component { location: { pathname, query }, } = this.props; const currentProtocol = `${window.location.protocol}//`; - const currentHref = window.location.href.substr(currentProtocol.length); + const currentHref = window.location.href.slice(currentProtocol.length); if (utils.isLocalStorageNameSupported()) { localStorage.setItem('locale', utils.isZhCN(pathname) ? 'en-US' : 'zh-CN');