mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
Merge pull request #31800 from ant-design/master-merge-feature
chore: sync master to feature
This commit is contained in:
commit
97fc1f52db
@ -22,7 +22,11 @@ function finalizeCompile() {
|
||||
fs.readdir(componentsPath, (err, files) => {
|
||||
files.forEach(file => {
|
||||
if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) {
|
||||
componentsLessContent += `@import "../${path.posix.join(file, 'style', 'index.less')}";\n`;
|
||||
componentsLessContent += `@import "../${path.posix.join(
|
||||
file,
|
||||
'style',
|
||||
'index.less',
|
||||
)}";\n`;
|
||||
}
|
||||
});
|
||||
fs.writeFileSync(
|
||||
@ -129,4 +133,5 @@ module.exports = {
|
||||
finalize: finalizeDist,
|
||||
},
|
||||
generateThemeFileContent,
|
||||
bail: true,
|
||||
};
|
||||
|
@ -15,6 +15,16 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 4.16.11
|
||||
|
||||
`2021-08-08`
|
||||
|
||||
- 🐞 Fix ConfigProvider rerender unexpectedly when switching some languages. [#31630](https://github.com/ant-design/ant-design/pull/31630) [@Map1en](https://github.com/Map1en)
|
||||
- 💄 Improve ghost button style rules, no more `!important`. [#31659](https://github.com/ant-design/ant-design/pull/31659)
|
||||
- 💄 Improve RangePicker range transition style. [#31645](https://github.com/ant-design/ant-design/pull/31645)
|
||||
- 🤖 Fix Dropdown `destroyPopupOnHide` TypeScript definition missing. [#31700](https://github.com/ant-design/ant-design/pull/31700) [@linxianxi](https://github.com/linxianxi)
|
||||
- 🤖 Remove useless Omit type which is built-in in TypeScript 3.5+. [#31661](https://github.com/ant-design/ant-design/pull/31661) [@Dreamerryao](https://github.com/Dreamerryao)
|
||||
|
||||
## 4.16.10
|
||||
|
||||
`2021-08-02`
|
||||
|
@ -15,6 +15,16 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 4.16.11
|
||||
|
||||
`2021-08-08`
|
||||
|
||||
- 🐞 修复 ConfigProvider 切换国际化时子组件 rerender 的问题。[#31630](https://github.com/ant-design/ant-design/pull/31630) [@Map1en](https://github.com/Map1en)
|
||||
- 💄 简化 ghost 按钮的样式代码,去掉 `!important` 样式规则。[#31659](https://github.com/ant-design/ant-design/pull/31659)
|
||||
- 💄 优化 RangePicker 的范围样式的 transition 效果。[#31645](https://github.com/ant-design/ant-design/pull/31645)
|
||||
- 🤖 修复 Dropdown `destroyPopupOnHide` TypeScript 定义丢失的问题。[#31700](https://github.com/ant-design/ant-design/pull/31700) [@linxianxi](https://github.com/linxianxi)
|
||||
- 🤖 移除多余的 Omit 类型定义。[#31661](https://github.com/ant-design/ant-design/pull/31661) [@Dreamerryao](https://github.com/Dreamerryao)
|
||||
|
||||
## 4.16.10
|
||||
|
||||
`2021-08-02`
|
||||
|
@ -1,4 +1,3 @@
|
||||
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
// https://stackoverflow.com/questions/46176165/ways-to-get-string-literal-type-of-array-values-without-enum-overhead
|
||||
export const tuple = <T extends string[]>(...args: T) => args;
|
||||
|
||||
|
@ -171,13 +171,13 @@ describe('Affix Render', () => {
|
||||
const originLength = getObserverLength();
|
||||
const getTarget = () => target;
|
||||
affixWrapper = mount(<Affix target={getTarget}>{null}</Affix>);
|
||||
await sleep(50);
|
||||
await sleep(100);
|
||||
|
||||
expect(getObserverLength()).toBe(originLength + 1);
|
||||
target = null;
|
||||
affixWrapper.setProps({});
|
||||
affixWrapper.update();
|
||||
await sleep(50);
|
||||
await sleep(100);
|
||||
expect(getObserverLength()).toBe(originLength);
|
||||
});
|
||||
});
|
||||
|
@ -6,7 +6,6 @@ import BreadcrumbSeparator from './BreadcrumbSeparator';
|
||||
import Menu from '../menu';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { Omit } from '../_util/type';
|
||||
import { cloneElement } from '../_util/reactNode';
|
||||
|
||||
export interface Route {
|
||||
|
@ -325,6 +325,14 @@ exports[`renders ./components/button/demo/ghost.md correctly 1`] = `
|
||||
Dashed
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-primary ant-btn-background-ghost ant-btn-dangerous"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Danger
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@ -543,6 +551,221 @@ Array [
|
||||
Search
|
||||
</span>
|
||||
</button>,
|
||||
<br />,
|
||||
<br />,
|
||||
<button
|
||||
class="ant-btn ant-btn-primary ant-btn-circle ant-btn-lg ant-btn-icon-only"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="search"
|
||||
class="anticon anticon-search"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="search"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-btn-primary ant-btn-circle ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
A
|
||||
</span>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-btn-primary ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="search"
|
||||
class="anticon anticon-search"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="search"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span>
|
||||
Search
|
||||
</span>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-btn-circle ant-btn-lg ant-btn-icon-only"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="search"
|
||||
class="anticon anticon-search"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="search"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="search"
|
||||
class="anticon anticon-search"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="search"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span>
|
||||
Search
|
||||
</span>
|
||||
</button>,
|
||||
<br />,
|
||||
<button
|
||||
class="ant-btn ant-btn-circle ant-btn-lg ant-btn-icon-only"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="search"
|
||||
class="anticon anticon-search"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="search"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="search"
|
||||
class="anticon anticon-search"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="search"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span>
|
||||
Search
|
||||
</span>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-btn-dashed ant-btn-circle ant-btn-lg ant-btn-icon-only"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="search"
|
||||
class="anticon anticon-search"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="search"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-btn-dashed ant-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
aria-label="search"
|
||||
class="anticon anticon-search"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="search"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span>
|
||||
Search
|
||||
</span>
|
||||
</button>,
|
||||
]
|
||||
`;
|
||||
|
||||
|
@ -6,7 +6,7 @@ import omit from 'rc-util/lib/omit';
|
||||
import Group from './button-group';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import Wave from '../_util/wave';
|
||||
import { Omit, tuple } from '../_util/type';
|
||||
import { tuple } from '../_util/type';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import SizeContext, { SizeType } from '../config-provider/SizeContext';
|
||||
import LoadingIcon from './LoadingIcon';
|
||||
|
@ -25,6 +25,9 @@ ReactDOM.render(
|
||||
<Button type="dashed" ghost>
|
||||
Dashed
|
||||
</Button>
|
||||
<Button type="primary" danger ghost>
|
||||
Danger
|
||||
</Button>
|
||||
</div>,
|
||||
mountNode,
|
||||
);
|
||||
|
@ -47,6 +47,36 @@ ReactDOM.render(
|
||||
<Button type="dashed" icon={<SearchOutlined />}>
|
||||
Search
|
||||
</Button>
|
||||
<br />
|
||||
<br />
|
||||
<Tooltip title="search">
|
||||
<Button type="primary" shape="circle" icon={<SearchOutlined />} size="large" />
|
||||
</Tooltip>
|
||||
<Button type="primary" shape="circle" size="large">
|
||||
A
|
||||
</Button>
|
||||
<Button type="primary" icon={<SearchOutlined />} size="large">
|
||||
Search
|
||||
</Button>
|
||||
<Tooltip title="search">
|
||||
<Button shape="circle" icon={<SearchOutlined />} size="large" />
|
||||
</Tooltip>
|
||||
<Button icon={<SearchOutlined />} size="large">
|
||||
Search
|
||||
</Button>
|
||||
<br />
|
||||
<Tooltip title="search">
|
||||
<Button shape="circle" icon={<SearchOutlined />} size="large" />
|
||||
</Tooltip>
|
||||
<Button icon={<SearchOutlined />} size="large">
|
||||
Search
|
||||
</Button>
|
||||
<Tooltip title="search">
|
||||
<Button type="dashed" shape="circle" icon={<SearchOutlined />} size="large" />
|
||||
</Tooltip>
|
||||
<Button type="dashed" icon={<SearchOutlined />} size="large">
|
||||
Search
|
||||
</Button>
|
||||
</>,
|
||||
mountNode,
|
||||
);
|
||||
|
@ -101,7 +101,12 @@
|
||||
|
||||
&-icon-only {
|
||||
.btn-square(@btn-prefix-cls);
|
||||
vertical-align: -1px;
|
||||
vertical-align: -3px;
|
||||
|
||||
> .@{iconfont-css-prefix} {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
&-round {
|
||||
@ -190,10 +195,15 @@
|
||||
margin-left: @margin-xs;
|
||||
}
|
||||
|
||||
&-background-ghost {
|
||||
&&-background-ghost {
|
||||
color: @btn-default-ghost-color;
|
||||
background: @btn-default-ghost-bg !important;
|
||||
border-color: @btn-default-ghost-border;
|
||||
&,
|
||||
&:hover,
|
||||
&:active,
|
||||
&:focus {
|
||||
background: @btn-default-ghost-bg;
|
||||
}
|
||||
}
|
||||
|
||||
&-background-ghost&-primary {
|
||||
|
@ -90,27 +90,27 @@
|
||||
.button-disabled();
|
||||
}
|
||||
.button-variant-ghost(@color; @border: @color) {
|
||||
.button-color(@color; transparent; @border);
|
||||
.button-color(@color; null; @border);
|
||||
text-shadow: none;
|
||||
&:hover,
|
||||
&:focus {
|
||||
& when (@border = transparent) {
|
||||
& when (@theme = dark) {
|
||||
.button-color(~`colorPalette('@{color}', 7) `; transparent; transparent);
|
||||
.button-color(~`colorPalette('@{color}', 7) `; null; transparent);
|
||||
}
|
||||
& when not (@theme = dark) {
|
||||
.button-color(~`colorPalette('@{color}', 5) `; transparent; transparent);
|
||||
.button-color(~`colorPalette('@{color}', 5) `; null; transparent);
|
||||
}
|
||||
}
|
||||
& when not (@border = transparent) {
|
||||
& when (@theme = dark) {
|
||||
.button-color(
|
||||
~`colorPalette('@{color}', 7) `; transparent; ~`colorPalette('@{color}', 7) `
|
||||
~`colorPalette('@{color}', 7) `; null; ~`colorPalette('@{color}', 7) `
|
||||
);
|
||||
}
|
||||
& when not (@theme = dark) {
|
||||
.button-color(
|
||||
~`colorPalette('@{color}', 5) `; transparent; ~`colorPalette('@{color}', 5) `
|
||||
~`colorPalette('@{color}', 5) `; null; ~`colorPalette('@{color}', 5) `
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -118,21 +118,21 @@
|
||||
&:active {
|
||||
& when (@border = transparent) {
|
||||
& when (@theme = dark) {
|
||||
.button-color(~`colorPalette('@{color}', 5) `; transparent; transparent);
|
||||
.button-color(~`colorPalette('@{color}', 5) `; null; transparent);
|
||||
}
|
||||
& when not (@theme = dark) {
|
||||
.button-color(~`colorPalette('@{color}', 7) `; transparent; transparent);
|
||||
.button-color(~`colorPalette('@{color}', 7) `; null; transparent);
|
||||
}
|
||||
}
|
||||
& when not(@border = transparent) {
|
||||
& when not (@border = transparent) {
|
||||
& when (@theme = dark) {
|
||||
.button-color(
|
||||
~`colorPalette('@{color}', 5) `; transparent; ~`colorPalette('@{color}', 5) `
|
||||
~`colorPalette('@{color}', 5) `; null; ~`colorPalette('@{color}', 5) `
|
||||
);
|
||||
}
|
||||
& when not (@theme = dark) {
|
||||
.button-color(
|
||||
~`colorPalette('@{color}', 7) `; transparent; ~`colorPalette('@{color}', 7) `
|
||||
~`colorPalette('@{color}', 7) `; null; ~`colorPalette('@{color}', 7) `
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -141,8 +141,10 @@
|
||||
}
|
||||
.button-color(@color; @background; @border) {
|
||||
color: @color;
|
||||
background: @background;
|
||||
border-color: @border; // a inside Button which only work in Chrome
|
||||
& when not(@background = null) {
|
||||
background: @background;
|
||||
}
|
||||
// http://stackoverflow.com/a/17253457
|
||||
> a:only-child {
|
||||
color: currentColor;
|
||||
|
@ -7,7 +7,6 @@ import Tabs, { TabsProps } from '../tabs';
|
||||
import Row from '../row';
|
||||
import Col from '../col';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import { Omit } from '../_util/type';
|
||||
import SizeContext from '../config-provider/SizeContext';
|
||||
|
||||
function getAction(actions: React.ReactNode[]) {
|
||||
|
@ -60,7 +60,9 @@
|
||||
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 22%;
|
||||
// https://github.com/ant-design/ant-design/pull/19452
|
||||
// https://github.com/ant-design/ant-design/pull/31726
|
||||
left: 21.5%;
|
||||
display: table;
|
||||
width: @check-width;
|
||||
height: @check-height;
|
||||
|
@ -16193,14 +16193,14 @@ exports[`ConfigProvider components Pagination configProvider 1`] = `
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="config-pagination-item config-pagination-item-0 config-pagination-disabled config-pagination-item-disabled"
|
||||
class="config-pagination-item config-pagination-item-1 config-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -16345,14 +16345,14 @@ exports[`ConfigProvider components Pagination configProvider 1`] = `
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="config-pagination-item config-pagination-item-0 config-pagination-disabled config-pagination-item-disabled"
|
||||
class="config-pagination-item config-pagination-item-1 config-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -16502,14 +16502,14 @@ exports[`ConfigProvider components Pagination configProvider componentSize large
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="config-pagination-item config-pagination-item-0 config-pagination-disabled config-pagination-item-disabled"
|
||||
class="config-pagination-item config-pagination-item-1 config-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -16654,14 +16654,14 @@ exports[`ConfigProvider components Pagination configProvider componentSize large
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="config-pagination-item config-pagination-item-0 config-pagination-disabled config-pagination-item-disabled"
|
||||
class="config-pagination-item config-pagination-item-1 config-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -16811,14 +16811,14 @@ exports[`ConfigProvider components Pagination configProvider componentSize middl
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="config-pagination-item config-pagination-item-0 config-pagination-disabled config-pagination-item-disabled"
|
||||
class="config-pagination-item config-pagination-item-1 config-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -16963,14 +16963,14 @@ exports[`ConfigProvider components Pagination configProvider componentSize middl
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="config-pagination-item config-pagination-item-0 config-pagination-disabled config-pagination-item-disabled"
|
||||
class="config-pagination-item config-pagination-item-1 config-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -17120,14 +17120,14 @@ exports[`ConfigProvider components Pagination configProvider virtual and dropdow
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-0 ant-pagination-disabled ant-pagination-item-disabled"
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -17272,14 +17272,14 @@ exports[`ConfigProvider components Pagination configProvider virtual and dropdow
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-0 ant-pagination-disabled ant-pagination-item-disabled"
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -17429,14 +17429,14 @@ exports[`ConfigProvider components Pagination normal 1`] = `
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-0 ant-pagination-disabled ant-pagination-item-disabled"
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -17581,14 +17581,14 @@ exports[`ConfigProvider components Pagination normal 1`] = `
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-0 ant-pagination-disabled ant-pagination-item-disabled"
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -17738,14 +17738,14 @@ exports[`ConfigProvider components Pagination prefixCls 1`] = `
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="prefix-Pagination-item prefix-Pagination-item-0 prefix-Pagination-disabled prefix-Pagination-item-disabled"
|
||||
class="prefix-Pagination-item prefix-Pagination-item-1 prefix-Pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
@ -17890,14 +17890,14 @@ exports[`ConfigProvider components Pagination prefixCls 1`] = `
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="prefix-Pagination-item prefix-Pagination-item-0 prefix-Pagination-disabled prefix-Pagination-item-disabled"
|
||||
class="prefix-Pagination-item prefix-Pagination-item-1 prefix-Pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
|
@ -18,6 +18,7 @@ exports[`ConfigProvider.Form form requiredMark set requiredMark optional 1`] = `
|
||||
年龄
|
||||
<span
|
||||
class="ant-form-item-optional"
|
||||
title=""
|
||||
>
|
||||
(optional)
|
||||
</span>
|
||||
|
@ -5,6 +5,9 @@ import LocaleProvider from '../../locale-provider';
|
||||
import zhCN from '../../locale/zh_CN';
|
||||
import enUS from '../../locale/en_US';
|
||||
import TimePicker from '../../time-picker';
|
||||
import DatePicker from '../../date-picker';
|
||||
import { openPicker, selectCell, closePicker } from '../../date-picker/__tests__/utils';
|
||||
import Pagination from '../../pagination';
|
||||
import Modal from '../../modal';
|
||||
|
||||
describe('ConfigProvider.Locale', () => {
|
||||
@ -64,6 +67,51 @@ describe('ConfigProvider.Locale', () => {
|
||||
expect($$('.ant-btn-primary')[0].textContent).toBe('OK');
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/31592
|
||||
it('should not reset the component state when switching locale', () => {
|
||||
class App extends React.Component {
|
||||
state = {
|
||||
locale: zhCN,
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<ConfigProvider locale={this.state.locale}>
|
||||
<DatePicker />
|
||||
<Pagination total={50} />
|
||||
</ConfigProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const wrapper = mount(<App />);
|
||||
|
||||
const datepickerInitProps = wrapper.find('.ant-picker-input input').props();
|
||||
expect(datepickerInitProps.value).toBe('');
|
||||
expect(datepickerInitProps.placeholder).toBe('请选择日期');
|
||||
expect(wrapper.find('.ant-pagination-item-1').props().className).toContain(
|
||||
'ant-pagination-item-active',
|
||||
);
|
||||
|
||||
openPicker(wrapper);
|
||||
selectCell(wrapper, 10);
|
||||
closePicker(wrapper);
|
||||
|
||||
expect(wrapper.find('.ant-picker-input input').props().value).not.toBe('');
|
||||
|
||||
wrapper.setState({ locale: {} });
|
||||
wrapper.find('.ant-pagination-item-3').simulate('click');
|
||||
|
||||
const datepickerProps = wrapper.find('.ant-picker-input input').props();
|
||||
expect(datepickerProps.placeholder).not.toBe('请选择日期');
|
||||
expect(datepickerProps.value).not.toBe('');
|
||||
expect(datepickerProps.value).toContain('-10');
|
||||
|
||||
expect(wrapper.find('.ant-pagination-item-3').props().className).toContain(
|
||||
'ant-pagination-item-active',
|
||||
);
|
||||
});
|
||||
|
||||
describe('support legacy LocaleProvider', () => {
|
||||
function testLocale(wrapper) {
|
||||
expect(wrapper.find('input').props().placeholder).toBe(zhCN.TimePicker.placeholder);
|
||||
|
@ -17,6 +17,7 @@ import SizeContext, { SizeContextProvider, SizeType } from './SizeContext';
|
||||
import message from '../message';
|
||||
import notification from '../notification';
|
||||
import { RequiredMark } from '../form/Form';
|
||||
import defaultLocale from '../locale/default';
|
||||
|
||||
export {
|
||||
RenderEmptyHandler,
|
||||
@ -209,8 +210,9 @@ const ProviderChildren: React.FC<ProviderChildrenProps> = props => {
|
||||
// Additional Form provider
|
||||
let validateMessages: ValidateMessages = {};
|
||||
|
||||
if (locale && locale.Form && locale.Form.defaultValidateMessages) {
|
||||
validateMessages = locale.Form.defaultValidateMessages;
|
||||
if (locale) {
|
||||
validateMessages =
|
||||
locale.Form?.defaultValidateMessages || defaultLocale.Form?.defaultValidateMessages || {};
|
||||
}
|
||||
if (form && form.validateMessages) {
|
||||
validateMessages = { ...validateMessages, ...form.validateMessages };
|
||||
|
@ -161,6 +161,7 @@
|
||||
z-index: 1;
|
||||
height: @picker-panel-cell-height;
|
||||
transform: translateY(-50%);
|
||||
transition: all @animation-duration-slow;
|
||||
content: '';
|
||||
}
|
||||
|
||||
@ -247,6 +248,7 @@
|
||||
border-top: @border-width-base dashed @picker-date-hover-range-border-color;
|
||||
border-bottom: @border-width-base dashed @picker-date-hover-range-border-color;
|
||||
transform: translateY(-50%);
|
||||
transition: all @animation-duration-slow;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
@ -292,6 +294,7 @@
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
background: @picker-date-hover-range-color;
|
||||
transition: all @animation-duration-slow;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ Commonly displayed on the details page.
|
||||
| bordered | Whether to display the border | boolean | false | |
|
||||
| colon | Change default props `colon` value of Descriptions.Item | boolean | true | |
|
||||
| column | The number of `DescriptionItems` in a row,could be a number or a object like `{ xs: 8, sm: 16, md: 24}`,(Only set `bordered={true}` to take effect) | number | 3 | |
|
||||
| contentStyle | Customize label style | CSSProperties | - | 4.10.0 |
|
||||
| contentStyle | Customize content style | CSSProperties | - | 4.10.0 |
|
||||
| extra | The action area of the description list, placed at the top-right | ReactNode | - | 4.5.0 |
|
||||
| labelStyle | Customize label style | CSSProperties | - | 4.10.0 |
|
||||
| layout | Define description layout | `horizontal` \| `vertical` | `horizontal` | |
|
||||
@ -32,7 +32,7 @@ Commonly displayed on the details page.
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| contentStyle | Customize label style | CSSProperties | - | 4.9.0 |
|
||||
| contentStyle | Customize content style | CSSProperties | - | 4.9.0 |
|
||||
| label | The description of the content | ReactNode | - | |
|
||||
| labelStyle | Customize label style | CSSProperties | - | 4.9.0 |
|
||||
| span | The number of columns included | number | 1 | |
|
||||
|
@ -41,6 +41,7 @@ export interface DropDownProps {
|
||||
onVisibleChange?: (visible: boolean) => void;
|
||||
visible?: boolean;
|
||||
disabled?: boolean;
|
||||
destroyPopupOnHide?: boolean;
|
||||
align?: Align;
|
||||
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
||||
prefixCls?: string;
|
||||
@ -60,9 +61,11 @@ interface DropdownInterface extends React.FC<DropDownProps> {
|
||||
}
|
||||
|
||||
const Dropdown: DropdownInterface = props => {
|
||||
const { getPopupContainer: getContextPopupContainer, getPrefixCls, direction } = React.useContext(
|
||||
ConfigContext,
|
||||
);
|
||||
const {
|
||||
getPopupContainer: getContextPopupContainer,
|
||||
getPrefixCls,
|
||||
direction,
|
||||
} = React.useContext(ConfigContext);
|
||||
|
||||
const getTransitionName = () => {
|
||||
const rootPrefixCls = getPrefixCls();
|
||||
|
@ -19,6 +19,7 @@ When there are more than a few options to choose from, you can wrap them in a `D
|
||||
| --- | --- | --- | --- | --- |
|
||||
| arrow | Whether the dropdown arrow should be visible | boolean | false | |
|
||||
| disabled | Whether the dropdown menu is disabled | boolean | - | |
|
||||
| destroyPopupOnHide | Whether destroy dropdown when hidden | boolean | false | |
|
||||
| getPopupContainer | To set the container of the dropdown menu. The default is to create a div element in body, but you can reset it to the scrolling area and make a relative reposition. [Example on CodePen](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | (triggerNode: HTMLElement) => HTMLElement | () => document.body | |
|
||||
| overlay | The dropdown menu | [Menu](/components/menu) \| () => Menu | - | |
|
||||
| overlayClassName | The class name of the dropdown root element | string | - | |
|
||||
|
@ -23,6 +23,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg
|
||||
| --- | --- | --- | --- | --- |
|
||||
| arrow | 下拉框箭头是否显示 | boolean | false | |
|
||||
| disabled | 菜单是否禁用 | boolean | - | |
|
||||
| destroyPopupOnHide | 关闭后是否销毁 Dropdown | boolean | false | |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | (triggerNode: HTMLElement) => HTMLElement | () => document.body | |
|
||||
| overlay | 菜单 | [Menu](/components/menu) \| () => Menu | - | |
|
||||
| overlayClassName | 下拉根元素的类名称 | string | - | |
|
||||
|
@ -88,7 +88,7 @@ const FormItemLabel: React.FC<FormItemLabelProps & { required?: boolean; prefixC
|
||||
const { icon = <QuestionCircleOutlined />, ...restTooltipProps } = tooltipProps;
|
||||
const tooltipNode = (
|
||||
<Tooltip {...restTooltipProps}>
|
||||
{React.cloneElement(icon, { className: `${prefixCls}-item-tooltip` })}
|
||||
{React.cloneElement(icon, { className: `${prefixCls}-item-tooltip`, title: '' })}
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
@ -105,7 +105,7 @@ const FormItemLabel: React.FC<FormItemLabelProps & { required?: boolean; prefixC
|
||||
labelChildren = (
|
||||
<>
|
||||
{labelChildren}
|
||||
<span className={`${prefixCls}-item-optional`}>
|
||||
<span className={`${prefixCls}-item-optional`} title="">
|
||||
{formLocale?.optional || defaultLocale.Form?.optional}
|
||||
</span>
|
||||
</>
|
||||
|
@ -3253,6 +3253,7 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
|
||||
aria-label="question-circle"
|
||||
class="anticon anticon-question-circle ant-form-item-tooltip"
|
||||
role="img"
|
||||
title=""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
@ -3773,6 +3774,7 @@ exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
|
||||
Required Mark
|
||||
<span
|
||||
class="ant-form-item-optional"
|
||||
title=""
|
||||
>
|
||||
(optional)
|
||||
</span>
|
||||
@ -3869,6 +3871,7 @@ exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
|
||||
aria-label="question-circle"
|
||||
class="anticon anticon-question-circle ant-form-item-tooltip"
|
||||
role="img"
|
||||
title=""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
@ -3923,6 +3926,7 @@ exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
|
||||
aria-label="info-circle"
|
||||
class="anticon anticon-info-circle ant-form-item-tooltip"
|
||||
role="img"
|
||||
title=""
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
@ -3943,6 +3947,7 @@ exports[`renders ./components/form/demo/required-mark.md correctly 1`] = `
|
||||
</span>
|
||||
<span
|
||||
class="ant-form-item-optional"
|
||||
title=""
|
||||
>
|
||||
(optional)
|
||||
</span>
|
||||
@ -7662,7 +7667,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
|
||||
>
|
||||
<span
|
||||
aria-label="close-circle"
|
||||
class="anticon anticon-close-circle ant-input-clear-icon-hidden ant-input-clear-icon"
|
||||
class="anticon anticon-close-circle ant-input-clear-icon-hidden ant-input-clear-icon-has-suffix ant-input-clear-icon"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
>
|
||||
|
@ -193,11 +193,11 @@ Note: You should not configure Form.Item `initialValue` under Form.List. It alwa
|
||||
|
||||
Some operator functions in render form of Form.List.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| add | add form item | (defaultValue?: any, insertIndex?: number) => void | insertIndex: 4.6.0 |
|
||||
| move | move form item | (from: number, to: number) => void | - |
|
||||
| remove | remove form item | (index: number \| number\[]) => void | number\[]: 4.5.0 |
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| add | add form item | (defaultValue?: any, insertIndex?: number) => void | insertIndex | 4.6.0 |
|
||||
| move | move form item | (from: number, to: number) => void | - | |
|
||||
| remove | remove form item | (index: number \| number\[]) => void | number\[] | 4.5.0 |
|
||||
|
||||
## Form.ErrorList
|
||||
|
||||
|
@ -192,11 +192,11 @@ Form 通过增量更新方式,只更新被修改的字段相关组件以达到
|
||||
|
||||
Form.List 渲染表单相关操作函数。
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| ------ | ---------- | -------------------------------------------------- | ------------------ |
|
||||
| add | 新增表单项 | (defaultValue?: any, insertIndex?: number) => void | insertIndex: 4.6.0 |
|
||||
| move | 移动表单项 | (from: number, to: number) => void | - |
|
||||
| remove | 删除表单项 | (index: number \| number\[]) => void | number\[]: 4.5.0 |
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| ------ | ---------- | -------------------------------------------------- | ----------- | ----- |
|
||||
| add | 新增表单项 | (defaultValue?: any, insertIndex?: number) => void | insertIndex | 4.6.0 |
|
||||
| move | 移动表单项 | (from: number, to: number) => void | - | |
|
||||
| remove | 删除表单项 | (index: number \| number\[]) => void | number\[] | 4.5.0 |
|
||||
|
||||
## Form.ErrorList
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
color: @text-color;
|
||||
}
|
||||
// 输入框的不同校验状态
|
||||
:not(.@{ant-prefix}-input-disabled).@{ant-prefix}-input,
|
||||
:not(.@{ant-prefix}-input-affix-wrapper-disabled).@{ant-prefix}-input-affix-wrapper {
|
||||
:not(.@{ant-prefix}-input-disabled):not(.@{ant-prefix}-input-borderless).@{ant-prefix}-input,
|
||||
:not(.@{ant-prefix}-input-affix-wrapper-disabled):not(.@{ant-prefix}-input-affix-wrapper-borderless).@{ant-prefix}-input-affix-wrapper {
|
||||
&,
|
||||
&:hover {
|
||||
background-color: @background-color;
|
||||
|
@ -5,7 +5,6 @@ import UpOutlined from '@ant-design/icons/UpOutlined';
|
||||
import DownOutlined from '@ant-design/icons/DownOutlined';
|
||||
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import { Omit } from '../_util/type';
|
||||
import SizeContext, { SizeType } from '../config-provider/SizeContext';
|
||||
|
||||
type ValueType = string | number;
|
||||
|
@ -56,7 +56,7 @@ class ClearableLabeledInput extends React.Component<ClearableInputProps> {
|
||||
};
|
||||
|
||||
renderClearIcon(prefixCls: string) {
|
||||
const { allowClear, value, disabled, readOnly, handleReset } = this.props;
|
||||
const { allowClear, value, disabled, readOnly, handleReset, suffix } = this.props;
|
||||
if (!allowClear) {
|
||||
return null;
|
||||
}
|
||||
@ -71,6 +71,7 @@ class ClearableLabeledInput extends React.Component<ClearableInputProps> {
|
||||
className={classNames(
|
||||
{
|
||||
[`${className}-hidden`]: !needClear,
|
||||
[`${className}-has-suffix`]: !!suffix,
|
||||
},
|
||||
className,
|
||||
)}
|
||||
|
@ -5,7 +5,7 @@ import Group from './Group';
|
||||
import Search from './Search';
|
||||
import TextArea from './TextArea';
|
||||
import Password from './Password';
|
||||
import { Omit, LiteralUnion } from '../_util/type';
|
||||
import { LiteralUnion } from '../_util/type';
|
||||
import ClearableLabeledInput, { hasPrefixSuffix } from './ClearableLabeledInput';
|
||||
import { ConfigConsumer, ConfigConsumerProps, DirectionType } from '../config-provider';
|
||||
import SizeContext, { SizeType } from '../config-provider/SizeContext';
|
||||
@ -67,9 +67,7 @@ export function resolveOnChange<E extends HTMLInputElement | HTMLTextAreaElement
|
||||
| React.ChangeEvent<E>
|
||||
| React.MouseEvent<HTMLElement, MouseEvent>
|
||||
| React.CompositionEvent<HTMLElement>,
|
||||
onChange:
|
||||
| undefined
|
||||
| ((event: React.ChangeEvent<E>) => void),
|
||||
onChange: undefined | ((event: React.ChangeEvent<E>) => void),
|
||||
targetValue?: string,
|
||||
) {
|
||||
if (!onChange) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
// ========================= Input =========================
|
||||
.@{iconfont-css-prefix}.@{ant-prefix}-input-clear-icon {
|
||||
margin: 0 @input-affix-margin;
|
||||
margin: 0;
|
||||
color: @disabled-color;
|
||||
font-size: @font-size-sm;
|
||||
vertical-align: -1px;
|
||||
@ -23,8 +23,8 @@
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
&-has-suffix {
|
||||
margin: 0 @input-affix-margin;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,8 @@
|
||||
.disabled() {
|
||||
color: @input-disabled-color;
|
||||
background-color: @input-disabled-bg;
|
||||
border-color: @input-border-color;
|
||||
box-shadow: none;
|
||||
cursor: not-allowed;
|
||||
opacity: 1;
|
||||
|
||||
@ -78,7 +80,7 @@
|
||||
.disabled();
|
||||
}
|
||||
|
||||
&&-borderless {
|
||||
&-borderless {
|
||||
&,
|
||||
&:hover,
|
||||
&:focus,
|
||||
|
@ -47,10 +47,10 @@
|
||||
|
||||
// allow-clear
|
||||
.@{ant-prefix}-input-clear-icon {
|
||||
&:last-child {
|
||||
&-has-suffix {
|
||||
.@{ant-prefix}-input-affix-wrapper-rtl & {
|
||||
margin-right: @input-affix-margin;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
margin-left: @input-affix-margin;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,14 +38,14 @@ exports[`Pagination rtl render component should be rendered correctly in RTL dir
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-0 ant-pagination-disabled ant-pagination-item-disabled"
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-disabled"
|
||||
tabindex="0"
|
||||
title="0"
|
||||
title="1"
|
||||
>
|
||||
<a
|
||||
rel="nofollow"
|
||||
>
|
||||
0
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
|
@ -17,7 +17,7 @@ Alternatively you can implement drag sorting with handler using [react-sortable-
|
||||
import { Table } from 'antd';
|
||||
import { sortableContainer, sortableElement, sortableHandle } from 'react-sortable-hoc';
|
||||
import { MenuOutlined } from '@ant-design/icons';
|
||||
import arrayMove from 'array-move';
|
||||
import { arrayMoveImmutable } from 'array-move';
|
||||
|
||||
const DragHandle = sortableHandle(() => <MenuOutlined style={{ cursor: 'grab', color: '#999' }} />);
|
||||
|
||||
|
@ -7,11 +7,11 @@ title:
|
||||
|
||||
## zh-CN
|
||||
|
||||
使用自定义元素,我们可以集成 react-dnd 来实现拖拽排序。
|
||||
使用自定义元素,我们可以集成 [react-dnd](https://github.com/react-dnd/react-dnd) 来实现拖拽排序。
|
||||
|
||||
## en-US
|
||||
|
||||
By using custom components, we can integrate table with react-dnd to implement drag sorting.
|
||||
By using `components`, we can integrate table with [react-dnd](https://github.com/react-dnd/react-dnd) to implement drag sorting function.
|
||||
|
||||
```jsx
|
||||
import React, { useState, useCallback, useRef } from 'react';
|
||||
|
@ -3,7 +3,6 @@ import * as React from 'react';
|
||||
import DatePicker from '../date-picker';
|
||||
import { PickerTimeProps, RangePickerTimeProps } from '../date-picker/generatePicker';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import { Omit } from '../_util/type';
|
||||
|
||||
const { TimePicker: InternalTimePicker, RangePicker: InternalRangePicker } = DatePicker;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { ElementOf, Omit, tuple } from '../_util/type';
|
||||
import { ElementOf, tuple } from '../_util/type';
|
||||
import Pagination from '../pagination';
|
||||
import { TransferListProps, RenderedItem } from './list';
|
||||
import ListItem from './ListItem';
|
||||
|
@ -3089,6 +3089,21 @@ Array [
|
||||
<div
|
||||
class="ant-transfer-list-header"
|
||||
>
|
||||
<label
|
||||
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
|
||||
>
|
||||
<span
|
||||
class="ant-checkbox"
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
/>
|
||||
</span>
|
||||
</label>
|
||||
<span
|
||||
aria-label="down"
|
||||
class="anticon anticon-down ant-dropdown-trigger ant-transfer-list-header-dropdown"
|
||||
@ -3791,6 +3806,21 @@ Array [
|
||||
<div
|
||||
class="ant-transfer-list-header"
|
||||
>
|
||||
<label
|
||||
class="ant-checkbox-wrapper ant-transfer-list-checkbox"
|
||||
>
|
||||
<span
|
||||
class="ant-checkbox"
|
||||
>
|
||||
<input
|
||||
class="ant-checkbox-input"
|
||||
type="checkbox"
|
||||
/>
|
||||
<span
|
||||
class="ant-checkbox-inner"
|
||||
/>
|
||||
</span>
|
||||
</label>
|
||||
<span
|
||||
aria-label="down"
|
||||
class="anticon anticon-down ant-dropdown-trigger ant-transfer-list-header-dropdown"
|
||||
@ -4200,25 +4230,6 @@ exports[`renders ./components/transfer/demo/tree-transfer.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-transfer-list-header"
|
||||
>
|
||||
<span
|
||||
aria-label="down"
|
||||
class="anticon anticon-down ant-dropdown-trigger ant-transfer-list-header-dropdown"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="down"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span
|
||||
class="ant-transfer-list-header-selected"
|
||||
>
|
||||
@ -4507,25 +4518,6 @@ exports[`renders ./components/transfer/demo/tree-transfer.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-transfer-list-header"
|
||||
>
|
||||
<span
|
||||
aria-label="down"
|
||||
class="anticon anticon-down ant-dropdown-trigger ant-transfer-list-header-dropdown"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
data-icon="down"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span
|
||||
class="ant-transfer-list-header-selected"
|
||||
>
|
||||
|
@ -72,6 +72,12 @@ describe('Transfer.Dropdown', () => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should hide checkbox and dropdown icon when showSelectAll={false}', () => {
|
||||
const wrapper = mount(<Transfer {...listProps} showSelectAll={false} />);
|
||||
expect(wrapper.find('.ant-transfer-list-header-dropdown').length).toBe(0);
|
||||
expect(wrapper.find('.ant-transfer-list-header .ant-transfer-list-checkbox').length).toBe(0);
|
||||
});
|
||||
|
||||
describe('select invert', () => {
|
||||
[
|
||||
{ name: 'with pagination', props: listProps, index: 2, keys: ['c', 'd'] },
|
||||
|
@ -19,7 +19,7 @@ import difference from 'lodash/difference';
|
||||
|
||||
// Customize Table Transfer
|
||||
const TableTransfer = ({ leftColumns, rightColumns, ...restProps }) => (
|
||||
<Transfer {...restProps} showSelectAll={false}>
|
||||
<Transfer {...restProps}>
|
||||
{({
|
||||
direction,
|
||||
filteredItems,
|
||||
|
@ -242,16 +242,20 @@ export default class TransferList<
|
||||
);
|
||||
}
|
||||
|
||||
getCheckBox(
|
||||
filteredItems: RecordType[],
|
||||
onItemSelectAll: (dataSource: string[], checkAll: boolean) => void,
|
||||
showSelectAll?: boolean,
|
||||
disabled?: boolean,
|
||||
prefixCls?: string,
|
||||
): false | JSX.Element {
|
||||
getCheckBox({
|
||||
filteredItems,
|
||||
onItemSelectAll,
|
||||
disabled,
|
||||
prefixCls,
|
||||
}: {
|
||||
filteredItems: RecordType[];
|
||||
onItemSelectAll: (dataSource: string[], checkAll: boolean) => void;
|
||||
disabled?: boolean;
|
||||
prefixCls?: string;
|
||||
}): false | JSX.Element {
|
||||
const checkStatus = this.getCheckStatus(filteredItems);
|
||||
const checkedAll = checkStatus === 'all';
|
||||
const checkAllCheckbox = showSelectAll !== false && (
|
||||
const checkAllCheckbox = (
|
||||
<Checkbox
|
||||
disabled={disabled}
|
||||
checked={checkedAll}
|
||||
@ -319,7 +323,7 @@ export default class TransferList<
|
||||
renderList,
|
||||
onItemSelectAll,
|
||||
onItemRemove,
|
||||
showSelectAll,
|
||||
showSelectAll = true,
|
||||
showRemove,
|
||||
pagination,
|
||||
direction,
|
||||
@ -359,7 +363,7 @@ export default class TransferList<
|
||||
const checkAllCheckbox =
|
||||
!showRemove &&
|
||||
!pagination &&
|
||||
this.getCheckBox(filteredItems, onItemSelectAll, showSelectAll, disabled, prefixCls);
|
||||
this.getCheckBox({ filteredItems, onItemSelectAll, disabled, prefixCls });
|
||||
|
||||
let menu: React.ReactElement | null = null;
|
||||
if (showRemove) {
|
||||
@ -454,8 +458,12 @@ export default class TransferList<
|
||||
<div className={listCls} style={style}>
|
||||
{/* Header */}
|
||||
<div className={`${prefixCls}-header`}>
|
||||
{checkAllCheckbox}
|
||||
{dropdown}
|
||||
{showSelectAll ? (
|
||||
<>
|
||||
{checkAllCheckbox}
|
||||
{dropdown}
|
||||
</>
|
||||
) : null}
|
||||
<span className={`${prefixCls}-header-selected`}>
|
||||
{this.getSelectAllLabel(checkedKeys.length, filteredItems.length)}
|
||||
</span>
|
||||
|
@ -17,6 +17,11 @@
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
|
||||
.@{table-prefix-cls}-selection-column {
|
||||
width: 40px;
|
||||
min-width: 40px;
|
||||
}
|
||||
|
||||
> .@{table-prefix-cls}-content {
|
||||
// Header background color
|
||||
> .@{table-prefix-cls}-body > table > .@{table-prefix-cls}-thead > tr > th {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import devWarning from '../_util/devWarning';
|
||||
import Base, { BlockProps } from './Base';
|
||||
import { tupleNum, Omit } from '../_util/type';
|
||||
import { tupleNum } from '../_util/type';
|
||||
|
||||
const TITLE_ELE_LIST = tupleNum(1, 2, 3, 4, 5);
|
||||
|
||||
|
@ -39,7 +39,6 @@ import { Dayjs } from 'dayjs';
|
||||
import * as React from 'react';
|
||||
import DatePicker from './DatePicker';
|
||||
import { PickerTimeProps } from 'antd/es/date-picker/generatePicker';
|
||||
import { Omit } from 'antd/es/_util/type';
|
||||
|
||||
export interface TimePickerProps extends Omit<PickerTimeProps<Dayjs>, 'picker'> {}
|
||||
|
||||
|
@ -39,7 +39,6 @@ import { Dayjs } from 'dayjs';
|
||||
import * as React from 'react';
|
||||
import DatePicker from './DatePicker';
|
||||
import { PickerTimeProps } from 'antd/es/date-picker/generatePicker';
|
||||
import { Omit } from 'antd/es/_util/type';
|
||||
|
||||
export interface TimePickerProps extends Omit<PickerTimeProps<Dayjs>, 'picker'> {}
|
||||
|
||||
|
33
package.json
33
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antd",
|
||||
"version": "4.16.10",
|
||||
"version": "4.16.11",
|
||||
"description": "An enterprise-class UI design language and React components implementation",
|
||||
"title": "Ant Design",
|
||||
"keywords": [
|
||||
@ -124,13 +124,13 @@
|
||||
"rc-drawer": "~4.3.0",
|
||||
"rc-dropdown": "~3.2.0",
|
||||
"rc-field-form": "~1.21.0-2",
|
||||
"rc-image": "~5.2.4",
|
||||
"rc-image": "~5.2.5",
|
||||
"rc-input-number": "~7.3.0",
|
||||
"rc-mentions": "~1.6.1",
|
||||
"rc-menu": "~9.0.12",
|
||||
"rc-motion": "^2.4.4",
|
||||
"rc-notification": "~4.5.7",
|
||||
"rc-pagination": "~3.1.7",
|
||||
"rc-pagination": "~3.1.9",
|
||||
"rc-picker": "~2.5.14",
|
||||
"rc-progress": "~3.1.0",
|
||||
"rc-rate": "~2.9.0",
|
||||
@ -145,23 +145,23 @@
|
||||
"rc-tooltip": "~5.1.1",
|
||||
"rc-tree": "~5.0.0",
|
||||
"rc-tree-select": "~4.3.0",
|
||||
"rc-trigger": "^5.2.1",
|
||||
"rc-trigger": "^5.2.10",
|
||||
"rc-upload": "~4.3.0",
|
||||
"rc-util": "^5.13.1",
|
||||
"scroll-into-view-if-needed": "^2.2.25",
|
||||
"warning": "^4.0.3"
|
||||
"scroll-into-view-if-needed": "^2.2.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ant-design/bisheng-plugin": "^2.3.0",
|
||||
"@ant-design/hitu": "^0.0.0-alpha.13",
|
||||
"@ant-design/tools": "^13.6.0",
|
||||
"@docsearch/react": "^3.0.0-alpha.37",
|
||||
"@ant-design/tools": "^13.6.2",
|
||||
"@docsearch/css": "^3.0.0-alpha.39",
|
||||
"@docsearch/react": "^3.0.0-alpha.39",
|
||||
"@qixian.cs/github-contributors-list": "^1.0.3",
|
||||
"@stackblitz/sdk": "^1.3.0",
|
||||
"@types/classnames": "^2.2.8",
|
||||
"@types/enzyme": "^3.10.5",
|
||||
"@types/gtag.js": "^0.0.7",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/jest": "^27.0.0",
|
||||
"@types/jest-environment-puppeteer": "^4.4.0",
|
||||
"@types/jest-image-snapshot": "^4.1.0",
|
||||
"@types/lodash": "^4.14.139",
|
||||
@ -179,7 +179,7 @@
|
||||
"antd-pro-merge-less": "^3.0.11",
|
||||
"antd-theme-generator": "^1.2.3",
|
||||
"argos-cli": "^0.3.0",
|
||||
"array-move": "^3.0.0",
|
||||
"array-move": "^4.0.0",
|
||||
"babel-plugin-add-react-displayname": "^0.0.5",
|
||||
"bisheng": "^3.0.0",
|
||||
"bisheng-plugin-description": "^0.1.4",
|
||||
@ -192,6 +192,7 @@
|
||||
"cross-env": "^7.0.0",
|
||||
"dekko": "^0.2.1",
|
||||
"docsearch.js": "^2.6.3",
|
||||
"duplicate-package-checker-webpack-plugin": "^3.0.0",
|
||||
"enquire-js": "^0.2.1",
|
||||
"enzyme": "^3.10.0",
|
||||
"enzyme-to-json": "^3.6.0",
|
||||
@ -207,12 +208,12 @@
|
||||
"eslint-plugin-markdown": "^2.0.0",
|
||||
"eslint-plugin-react": "^7.20.6",
|
||||
"eslint-plugin-react-hooks": "^4.1.2",
|
||||
"eslint-plugin-unicorn": "^34.0.0",
|
||||
"eslint-plugin-unicorn": "^35.0.0",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
"fs-extra": "^10.0.0",
|
||||
"full-icu": "^1.3.0",
|
||||
"glob": "^7.1.4",
|
||||
"http-server": "^0.12.0",
|
||||
"http-server": "^13.0.0",
|
||||
"husky": "^7.0.1",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"ignore-emit-webpack-plugin": "^2.0.6",
|
||||
@ -258,10 +259,10 @@
|
||||
"react-text-loop": "^2.3.0",
|
||||
"react-virtualized": "^9.22.0",
|
||||
"react-window": "^1.8.5",
|
||||
"remark": "^13.0.0",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-lint": "^8.0.0",
|
||||
"remark-preset-lint-recommended": "^5.0.0",
|
||||
"remark": "^14.0.1",
|
||||
"remark-cli": "^10.0.0",
|
||||
"remark-lint": "^9.0.0",
|
||||
"remark-preset-lint-recommended": "^6.0.0",
|
||||
"reqwest": "^2.0.5",
|
||||
"rimraf": "^3.0.0",
|
||||
"scrollama": "^2.0.0",
|
||||
|
@ -110,13 +110,6 @@ module.exports = {
|
||||
'app.footer.seeconf': 'Experience Tech Conference',
|
||||
'app.footer.xtech': 'Ant Financial Experience Tech',
|
||||
'app.footer.xtech.slogan': 'Experience The Beauty',
|
||||
'app.publish.title': 'antd@3.0.0 has been released! 🎉 🎉 🎉',
|
||||
'app.publish.greeting': 'Hello, ',
|
||||
'app.publish.intro': ' has been released, so please upgrade. ',
|
||||
'app.publish.old-version-guide':
|
||||
'If you need documentation for an older version, please visit ',
|
||||
'app.publish.old-version-tips':
|
||||
', or switch the version via the dropdown in the header nav bar.',
|
||||
'app.docs.color.pick-primary': 'Pick your primary color',
|
||||
'app.docs.color.pick-background': 'Pick your background color',
|
||||
'app.docs.components.icon.search.placeholder': 'Search icons here, click icon to copy code',
|
||||
|
@ -16,7 +16,6 @@
|
||||
@import './icons';
|
||||
@import './icon-pic-searcher';
|
||||
@import './mock-browser';
|
||||
@import './new-version-info-modal';
|
||||
@import './motion';
|
||||
@import './responsive';
|
||||
@import './theme';
|
||||
|
@ -1,24 +0,0 @@
|
||||
.new-version-info-modal {
|
||||
img {
|
||||
position: absolute;
|
||||
top: 36px;
|
||||
left: 34px;
|
||||
width: 100px;
|
||||
}
|
||||
p {
|
||||
margin-top: 1em;
|
||||
}
|
||||
.anticon {
|
||||
display: none;
|
||||
}
|
||||
.ant-confirm-body {
|
||||
.ant-confirm-title {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
margin-left: 120px;
|
||||
.ant-confirm-content {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage, injectIntl, WrappedComponentProps } from 'react-intl';
|
||||
import { Modal, message } from 'antd';
|
||||
import { Link } from 'bisheng/router';
|
||||
import { message } from 'antd';
|
||||
import RcFooter from 'rc-footer';
|
||||
import { Link } from 'bisheng/router';
|
||||
import { presetPalettes } from '@ant-design/colors';
|
||||
import { FormattedMessage, injectIntl, WrappedComponentProps } from 'react-intl';
|
||||
import {
|
||||
AntDesignOutlined,
|
||||
MediumOutlined,
|
||||
@ -17,8 +17,8 @@ import {
|
||||
IssuesCloseOutlined,
|
||||
QuestionCircleOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { isLocalStorageNameSupported, loadScript, getLocalizedPathname } from '../utils';
|
||||
import ColorPicker from '../Color/ColorPicker';
|
||||
import { loadScript, getLocalizedPathname } from '../utils';
|
||||
|
||||
class Footer extends React.Component<WrappedComponentProps & { location: any }> {
|
||||
lessLoaded = false;
|
||||
@ -27,23 +27,6 @@ class Footer extends React.Component<WrappedComponentProps & { location: any }>
|
||||
color: presetPalettes.blue.primary,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
// for some iOS
|
||||
// http://stackoverflow.com/a/14555361
|
||||
if (!isLocalStorageNameSupported()) {
|
||||
return;
|
||||
}
|
||||
// 大版本发布后全局弹窗提示
|
||||
// 1. 点击『知道了』之后不再提示
|
||||
// 2. 超过截止日期后不再提示
|
||||
if (
|
||||
localStorage.getItem('antd@3.0.0-notification-sent') !== 'true' &&
|
||||
Date.now() < new Date('2017/12/20').getTime()
|
||||
) {
|
||||
this.infoNewVersion();
|
||||
}
|
||||
}
|
||||
|
||||
getColumns() {
|
||||
const { intl, location } = this.props;
|
||||
|
||||
@ -372,39 +355,6 @@ class Footer extends React.Component<WrappedComponentProps & { location: any }>
|
||||
}
|
||||
};
|
||||
|
||||
infoNewVersion() {
|
||||
const {
|
||||
intl: { messages },
|
||||
} = this.props;
|
||||
Modal.info({
|
||||
title: messages['app.publish.title'],
|
||||
content: (
|
||||
<div>
|
||||
<img
|
||||
src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
|
||||
alt="Ant Design"
|
||||
/>
|
||||
<p>
|
||||
{messages['app.publish.greeting']}
|
||||
<a target="_blank" rel="noopener noreferrer" href="/changelog">
|
||||
antd@3.0.0
|
||||
</a>
|
||||
{messages['app.publish.intro']}
|
||||
{messages['app.publish.old-version-guide']}
|
||||
<a target="_blank" rel="noopener noreferrer" href="http://2x.ant.design">
|
||||
2x.ant.design
|
||||
</a>
|
||||
{messages['app.publish.old-version-tips']}
|
||||
</p>
|
||||
</div>
|
||||
),
|
||||
okText: 'OK',
|
||||
onOk: () => localStorage.setItem('antd@3.0.0-notification-sent', 'true'),
|
||||
className: 'new-version-info-modal',
|
||||
width: 470,
|
||||
});
|
||||
}
|
||||
|
||||
renderThemeChanger() {
|
||||
const { color } = this.state;
|
||||
const colors = Object.keys(presetPalettes).filter(item => item !== 'grey');
|
||||
|
@ -108,11 +108,6 @@ module.exports = {
|
||||
'app.footer.seeconf': '蚂蚁体验科技大会',
|
||||
'app.footer.xtech': '蚂蚁体验科技',
|
||||
'app.footer.xtech.slogan': '让用户体验美好',
|
||||
'app.publish.title': 'antd@3.0.0 发布!🎉 🎉 🎉',
|
||||
'app.publish.greeting': '你好,',
|
||||
'app.publish.intro': ' 已正式发布,欢迎升级。',
|
||||
'app.publish.old-version-guide': '如果您还需要使用旧版,请查阅 ',
|
||||
'app.publish.old-version-tips': ',也可通过页面右上角的文档版本选择框进行切换。',
|
||||
'app.docs.color.pick-primary': '选择你的主色',
|
||||
'app.docs.color.pick-background': '选择你的背景色',
|
||||
'app.docs.components.icon.search.placeholder': '在此搜索图标,点击图标可复制代码',
|
||||
|
@ -4,6 +4,7 @@ const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig');
|
||||
const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin');
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||
const { ESBuildMinifyPlugin } = require('esbuild-loader');
|
||||
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
|
||||
const darkVars = require('./scripts/dark-vars');
|
||||
const compactVars = require('./scripts/compact-vars');
|
||||
|
||||
@ -112,6 +113,13 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
|
||||
reportFilename: '../report.html',
|
||||
}),
|
||||
);
|
||||
|
||||
config.plugins.push(
|
||||
new DuplicatePackageCheckerPlugin({
|
||||
verbose: true,
|
||||
emitError: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
processWebpackThemeConfig(webpackDarkConfig, 'dark', darkVars);
|
||||
|
Loading…
Reference in New Issue
Block a user