mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-08 01:53:34 +08:00
Merge branch 'master' into feature-3.8.0
This commit is contained in:
commit
6199340b5f
221
.circleci/config.yml
Normal file
221
.circleci/config.yml
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
references:
|
||||||
|
container_config: &container_config
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:8
|
||||||
|
working_directory: ~/ant-design
|
||||||
|
|
||||||
|
attach_workspace: &attach_workspace
|
||||||
|
attach_workspace:
|
||||||
|
at: ~/ant-design
|
||||||
|
|
||||||
|
install_react: &install_react
|
||||||
|
run: REACT=15 ./scripts/install-react.sh
|
||||||
|
|
||||||
|
react_15: &react_15
|
||||||
|
environment:
|
||||||
|
REACT: 15
|
||||||
|
|
||||||
|
react_16: &react_16
|
||||||
|
environment:
|
||||||
|
REACT: 16
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
<<: *container_config
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: node -v
|
||||||
|
- run: npm -v
|
||||||
|
- run: npm install
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
set +eo
|
||||||
|
npm ls
|
||||||
|
true
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: ~/ant-design
|
||||||
|
paths:
|
||||||
|
- node_modules
|
||||||
|
|
||||||
|
dist:
|
||||||
|
<<: *container_config
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- run: npm run dist
|
||||||
|
- run: node ./tests/dekko/dist.test.js
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: ~/ant-design
|
||||||
|
paths:
|
||||||
|
- dist
|
||||||
|
|
||||||
|
compile:
|
||||||
|
<<: *container_config
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- run: npm run compile
|
||||||
|
- run: node ./tests/dekko/lib.test.js
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: ~/ant-design
|
||||||
|
paths:
|
||||||
|
- lib
|
||||||
|
- es
|
||||||
|
|
||||||
|
lint:
|
||||||
|
<<: *container_config
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- run: npm run lint
|
||||||
|
|
||||||
|
test_dist:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_16
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- run:
|
||||||
|
command: npm test -- -w 2
|
||||||
|
environment:
|
||||||
|
LIB_DIR: dist
|
||||||
|
|
||||||
|
test_lib:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_16
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- run:
|
||||||
|
command: npm test -- -w 2
|
||||||
|
environment:
|
||||||
|
LIB_DIR: lib
|
||||||
|
|
||||||
|
test_es:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_16
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- run:
|
||||||
|
command: npm test -- -w 2
|
||||||
|
environment:
|
||||||
|
LIB_DIR: es
|
||||||
|
|
||||||
|
test_dom:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_16
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- run: npm test -- -w 2 --coverage
|
||||||
|
- run: bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
|
test_node:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_16
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- run: npm run test-node -- -w 2
|
||||||
|
|
||||||
|
test_dist_15:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_15
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- *install_react
|
||||||
|
- run:
|
||||||
|
command: npm test -- -w 2 -u
|
||||||
|
environment:
|
||||||
|
LIB_DIR: dist
|
||||||
|
|
||||||
|
test_lib_15:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_15
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- *install_react
|
||||||
|
- run:
|
||||||
|
command: npm test -- -w 2 -u
|
||||||
|
environment:
|
||||||
|
LIB_DIR: lib
|
||||||
|
|
||||||
|
test_es_15:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_15
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- *install_react
|
||||||
|
- run:
|
||||||
|
command: npm test -- -w 2 -u
|
||||||
|
environment:
|
||||||
|
LIB_DIR: es
|
||||||
|
|
||||||
|
test_dom_15:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_15
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- *install_react
|
||||||
|
- run: npm test -- -w 2 -u
|
||||||
|
|
||||||
|
test_node_15:
|
||||||
|
<<: *container_config
|
||||||
|
<<: *react_15
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- *attach_workspace
|
||||||
|
- *install_react
|
||||||
|
- run: npm run test-node -- -w 2 -u
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
build-test:
|
||||||
|
jobs:
|
||||||
|
- setup
|
||||||
|
- dist:
|
||||||
|
requires:
|
||||||
|
- setup
|
||||||
|
- compile:
|
||||||
|
requires:
|
||||||
|
- setup
|
||||||
|
- lint:
|
||||||
|
requires:
|
||||||
|
- setup
|
||||||
|
- test_dist:
|
||||||
|
requires:
|
||||||
|
- dist
|
||||||
|
- test_lib:
|
||||||
|
requires:
|
||||||
|
- compile
|
||||||
|
- test_es:
|
||||||
|
requires:
|
||||||
|
- compile
|
||||||
|
- test_dom:
|
||||||
|
requires:
|
||||||
|
- setup
|
||||||
|
- test_node:
|
||||||
|
requires:
|
||||||
|
- setup
|
||||||
|
- test_dist_15:
|
||||||
|
requires:
|
||||||
|
- dist
|
||||||
|
- test_lib_15:
|
||||||
|
requires:
|
||||||
|
- compile
|
||||||
|
- test_es_15:
|
||||||
|
requires:
|
||||||
|
- compile
|
||||||
|
- test_dom_15:
|
||||||
|
requires:
|
||||||
|
- setup
|
||||||
|
- test_node_15:
|
||||||
|
requires:
|
||||||
|
- setup
|
@ -8,7 +8,6 @@ node_js:
|
|||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.npm
|
- $HOME/.npm
|
||||||
- node_modules
|
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
@ -15,6 +15,18 @@ timeline: true
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 3.7.1
|
||||||
|
|
||||||
|
`2018-07-21`
|
||||||
|
|
||||||
|
- 🐞 Fix popup content can't display in Drawer component.[#11304](https://github.com/ant-design/ant-design/issues/11304)
|
||||||
|
- 🐞 Card using `tabList` support `disabled` prop.[#11212](https://github.com/ant-design/ant-design/issues/11212)
|
||||||
|
- 🐞 Fix Link of Anchor not sync when `href` update.[#11287](https://github.com/ant-design/ant-design/pull/11287/files) [@tangjinzhou](https://github.com/tangjinzhou)
|
||||||
|
- 🐞 Fix Menu component style.[#11299](https://github.com/ant-design/ant-design/issues/11299)
|
||||||
|
- 🐞 Fix Drawer component don't have animation when `destroyOnClose` is set.[#11307](https://github.com/ant-design/ant-design/issues/11307)
|
||||||
|
- 🐞 Fix DirectoryTree can't expand when `expandedKeys` is in control.[#11366](https://github.com/ant-design/ant-design/issues/11366)
|
||||||
|
- 🐞 Fix Button with Tooltip under ButtonGroup style issue when Button is `disabled`.[11321](https://github.com/ant-design/ant-design/pull/11321) [@tangjinzhou](https://github.com/tangjinzhou)
|
||||||
|
|
||||||
## 3.7.0
|
## 3.7.0
|
||||||
|
|
||||||
3.7.0 is a heavy update that brings a lot of exciting changes and new features.
|
3.7.0 is a heavy update that brings a lot of exciting changes and new features.
|
||||||
|
@ -15,6 +15,18 @@ timeline: true
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 3.7.1
|
||||||
|
|
||||||
|
`2018-07-21`
|
||||||
|
|
||||||
|
- 🐞 修复 Drawer 内无法显示弹层组件的问题。[#11304](https://github.com/ant-design/ant-design/issues/11304)
|
||||||
|
- 🐞 带页签的卡片页签支持 disabled 属性。[#11212](https://github.com/ant-design/ant-design/issues/11212)
|
||||||
|
- 🐞 修复锚点链接组件 href 改变不更新的问题。 [#11287](https://github.com/ant-design/ant-design/pull/11287/files) [@tangjinzhou](https://github.com/tangjinzhou)
|
||||||
|
- 🐞 修复 Menu 样式细节问题。[#11299](https://github.com/ant-design/ant-design/issues/11299)
|
||||||
|
- 🐞 修复 Drawer 组件设置 `destroyOnClose` 后关闭动画消失。[#11307](https://github.com/ant-design/ant-design/issues/11307)
|
||||||
|
- 🐞 修复 DirectoryTree 在 `expandedKeys` 属性可控时点击无法展开的问题。[#11366](https://github.com/ant-design/ant-design/issues/11366)
|
||||||
|
- 🐞 修复 ButtonGroup 中使用 Tooltip 的 Button 在 `disabled` 时样式不正确的问题。[11321](https://github.com/ant-design/ant-design/pull/11321) [@tangjinzhou](https://github.com/tangjinzhou)
|
||||||
|
|
||||||
## 3.7.0
|
## 3.7.0
|
||||||
|
|
||||||
3.7.0是一个重磅更新,带来了很多激动人心的变化和新特性。
|
3.7.0是一个重磅更新,带来了很多激动人心的变化和新特性。
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
[](https://travis-ci.org/ant-design/ant-design)
|
[](https://travis-ci.org/ant-design/ant-design)
|
||||||
[](https://codecov.io/gh/ant-design/ant-design/branch/master)
|
[](https://codecov.io/gh/ant-design/ant-design/branch/master)
|
||||||
[](https://david-dm.org/ant-design/ant-design)
|
[](https://david-dm.org/ant-design/ant-design)
|
||||||
[](https://david-dm.org/ant-design/ant-design#info=devDependencies&view=list)
|
[](https://david-dm.org/ant-design/ant-design?type=dev)
|
||||||
|
|
||||||
[](https://www.npmjs.org/package/antd)
|
[](https://www.npmjs.org/package/antd)
|
||||||
[](http://www.npmtrends.com/antd)
|
[](http://www.npmtrends.com/antd)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
[](https://travis-ci.org/ant-design/ant-design)
|
[](https://travis-ci.org/ant-design/ant-design)
|
||||||
[](https://codecov.io/gh/ant-design/ant-design/branch/master)
|
[](https://codecov.io/gh/ant-design/ant-design/branch/master)
|
||||||
[](https://david-dm.org/ant-design/ant-design)
|
[](https://david-dm.org/ant-design/ant-design)
|
||||||
[](https://david-dm.org/ant-design/ant-design#info=devDependencies&view=list)
|
[](https://david-dm.org/ant-design/ant-design?type=dev)
|
||||||
|
|
||||||
[](https://www.npmjs.org/package/antd)
|
[](https://www.npmjs.org/package/antd)
|
||||||
[](http://www.npmtrends.com/antd)
|
[](http://www.npmtrends.com/antd)
|
||||||
|
@ -3,7 +3,7 @@ import { createElement, Component } from 'react';
|
|||||||
import omit from 'omit.js';
|
import omit from 'omit.js';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
function getNumberArray(num: string | number | undefined) {
|
function getNumberArray(num: string | number | undefined | null) {
|
||||||
return num ?
|
return num ?
|
||||||
num.toString()
|
num.toString()
|
||||||
.split('')
|
.split('')
|
||||||
@ -14,16 +14,16 @@ function getNumberArray(num: string | number | undefined) {
|
|||||||
export interface ScrollNumberProps {
|
export interface ScrollNumberProps {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
count?: string | number;
|
count?: string | number | null;
|
||||||
component?: string;
|
component?: string;
|
||||||
onAnimated?: Function;
|
onAnimated?: Function;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
title?: string | number;
|
title?: string | number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScrollNumberState {
|
export interface ScrollNumberState {
|
||||||
animateStarted?: boolean;
|
animateStarted?: boolean;
|
||||||
count?: string | number;
|
count?: string | number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class ScrollNumber extends Component<ScrollNumberProps, ScrollNumberState> {
|
export default class ScrollNumber extends Component<ScrollNumberProps, ScrollNumberState> {
|
||||||
|
@ -8,7 +8,7 @@ export { ScrollNumberProps } from './ScrollNumber';
|
|||||||
|
|
||||||
export interface BadgeProps {
|
export interface BadgeProps {
|
||||||
/** Number to show in badge */
|
/** Number to show in badge */
|
||||||
count?: number | string;
|
count?: number | string | null;
|
||||||
showZero?: boolean;
|
showZero?: boolean;
|
||||||
/** Max count to show */
|
/** Max count to show */
|
||||||
overflowCount?: number;
|
overflowCount?: number;
|
||||||
|
@ -109,7 +109,8 @@
|
|||||||
.button-group-base(@btnClassName) {
|
.button-group-base(@btnClassName) {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
> .@{btnClassName} {
|
> .@{btnClassName},
|
||||||
|
> span > .@{btnClassName} {
|
||||||
position: relative;
|
position: relative;
|
||||||
line-height: @btn-height-base - 2px;
|
line-height: @btn-height-base - 2px;
|
||||||
|
|
||||||
@ -126,13 +127,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// size
|
// size
|
||||||
&-lg > .@{btnClassName} {
|
&-lg > .@{btnClassName},
|
||||||
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; @btn-border-radius-base);
|
&-lg > span > .@{btnClassName} {
|
||||||
|
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; 0);
|
||||||
line-height: @btn-height-lg - 2px;
|
line-height: @btn-height-lg - 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-sm > .@{btnClassName} {
|
&-sm > .@{btnClassName},
|
||||||
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; @btn-border-radius-sm);
|
&-sm > span > .@{btnClassName} {
|
||||||
|
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; 0);
|
||||||
line-height: @btn-height-sm - 2px;
|
line-height: @btn-height-sm - 2px;
|
||||||
> .@{iconfont-css-prefix} {
|
> .@{iconfont-css-prefix} {
|
||||||
font-size: @font-size-base;
|
font-size: @font-size-base;
|
||||||
@ -260,7 +263,7 @@
|
|||||||
border-left-color: transparent;
|
border-left-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.@{btnClassName}:not(:first-child):not(:last-child) {
|
.@{btnClassName} {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,17 +271,42 @@
|
|||||||
> span:first-child > .@{btnClassName} {
|
> span:first-child > .@{btnClassName} {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
> .@{btnClassName}:only-child {
|
||||||
|
border-radius: @btn-border-radius-base;
|
||||||
|
}
|
||||||
|
> span:only-child > .@{btnClassName} {
|
||||||
|
border-radius: @btn-border-radius-base;
|
||||||
|
}
|
||||||
|
|
||||||
> .@{btnClassName}:first-child:not(:last-child),
|
> .@{btnClassName}:first-child:not(:last-child),
|
||||||
> span:first-child:not(:last-child) > .@{btnClassName} {
|
> span:first-child:not(:last-child) > .@{btnClassName} {
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-left-radius: @btn-border-radius-base;
|
||||||
border-top-right-radius: 0;
|
border-top-left-radius: @btn-border-radius-base;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .@{btnClassName}:last-child:not(:first-child),
|
> .@{btnClassName}:last-child:not(:first-child),
|
||||||
> span:last-child:not(:first-child) > .@{btnClassName} {
|
> span:last-child:not(:first-child) > .@{btnClassName} {
|
||||||
border-bottom-left-radius: 0;
|
border-bottom-right-radius: @btn-border-radius-base;
|
||||||
border-top-left-radius: 0;
|
border-top-right-radius: @btn-border-radius-base;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-sm {
|
||||||
|
> .@{btnClassName}:only-child {
|
||||||
|
border-radius: @btn-border-radius-sm;
|
||||||
|
}
|
||||||
|
> span:only-child > .@{btnClassName} {
|
||||||
|
border-radius: @btn-border-radius-sm;
|
||||||
|
}
|
||||||
|
> .@{btnClassName}:first-child:not(:last-child),
|
||||||
|
> span:first-child:not(:last-child) > .@{btnClassName} {
|
||||||
|
border-bottom-left-radius: @btn-border-radius-sm;
|
||||||
|
border-top-left-radius: @btn-border-radius-sm;
|
||||||
|
}
|
||||||
|
> .@{btnClassName}:last-child:not(:first-child),
|
||||||
|
> span:last-child:not(:first-child) > .@{btnClassName} {
|
||||||
|
border-bottom-right-radius: @btn-border-radius-sm;
|
||||||
|
border-top-right-radius: @btn-border-radius-sm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& > & {
|
& > & {
|
||||||
|
@ -4,7 +4,7 @@ type: Data Entry
|
|||||||
title: Checkbox
|
title: Checkbox
|
||||||
---
|
---
|
||||||
|
|
||||||
Checkbox.
|
Checkbox component.
|
||||||
|
|
||||||
## When To Use
|
## When To Use
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
|
|||||||
showDate: nextProps.value,
|
showDate: nextProps.value,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private input: any;
|
private input: any;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { render } from 'enzyme';
|
||||||
import Drawer from '..';
|
import Drawer from '..';
|
||||||
|
|
||||||
describe('Drawer', () => {
|
describe('Drawer', () => {
|
||||||
it('render correctly', () => {
|
it('render correctly', () => {
|
||||||
const wrapper = mount(
|
const wrapper = render(
|
||||||
<Drawer
|
<Drawer
|
||||||
visible
|
visible
|
||||||
width={400}
|
width={400}
|
||||||
@ -13,11 +13,11 @@ describe('Drawer', () => {
|
|||||||
Here is content of Drawer
|
Here is content of Drawer
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
expect(wrapper.render()).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('have a title', () => {
|
it('have a title', () => {
|
||||||
const wrapper = mount(
|
const wrapper = render(
|
||||||
<Drawer
|
<Drawer
|
||||||
visible
|
visible
|
||||||
title="Test Title"
|
title="Test Title"
|
||||||
@ -26,11 +26,11 @@ describe('Drawer', () => {
|
|||||||
Here is content of Drawer
|
Here is content of Drawer
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
expect(wrapper.render()).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('closable is false', () => {
|
it('closable is false', () => {
|
||||||
const wrapper = mount(
|
const wrapper = render(
|
||||||
<Drawer
|
<Drawer
|
||||||
visible
|
visible
|
||||||
closable={false}
|
closable={false}
|
||||||
@ -39,11 +39,11 @@ describe('Drawer', () => {
|
|||||||
Here is content of Drawer
|
Here is content of Drawer
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
expect(wrapper.render()).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('destroyOnClose is true', () => {
|
it('destroyOnClose is true', () => {
|
||||||
const wrapper = mount(
|
const wrapper = render(
|
||||||
<Drawer
|
<Drawer
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
visible={false}
|
visible={false}
|
||||||
@ -52,6 +52,20 @@ describe('Drawer', () => {
|
|||||||
Here is content of Drawer
|
Here is content of Drawer
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
expect(wrapper.render()).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('wrapClassName is test_drawer', () => {
|
||||||
|
const wrapper = render(
|
||||||
|
<Drawer
|
||||||
|
destroyOnClose
|
||||||
|
visible={false}
|
||||||
|
wrapClassName="test_drawer"
|
||||||
|
getContainer={false}
|
||||||
|
>
|
||||||
|
Here is content of Drawer
|
||||||
|
</Drawer>
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -33,7 +33,6 @@ class DrawerEventTester extends React.Component {
|
|||||||
<Drawer
|
<Drawer
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onClose={this.onClose}
|
onClose={this.onClose}
|
||||||
destroyOnClose
|
|
||||||
getContainer={false}
|
getContainer={false}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
>
|
>
|
||||||
@ -88,4 +87,26 @@ describe('Drawer', () => {
|
|||||||
wrapper.find('.ant-drawer-mask').simulate('click');
|
wrapper.find('.ant-drawer-mask').simulate('click');
|
||||||
expect(wrapper.instance().state.visible).toBe(true);
|
expect(wrapper.instance().state.visible).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('destroyOnClose is true onClose', () => {
|
||||||
|
const wrapper = mount(<DrawerEventTester destroyOnClose />);
|
||||||
|
wrapper.find('button.ant-btn').simulate('click');
|
||||||
|
expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(true);
|
||||||
|
|
||||||
|
wrapper.setState({
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
wrapper.find('.ant-drawer-wrapper-body').simulate('transitionend');
|
||||||
|
expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('no mask and no closable', () => {
|
||||||
|
const wrapper = mount(<DrawerEventTester destroyOnClose />);
|
||||||
|
|
||||||
|
wrapper.find('button.ant-btn').simulate('click');
|
||||||
|
expect(wrapper.instance().state.visible).toBe(true);
|
||||||
|
|
||||||
|
wrapper.find('.ant-drawer-close').simulate('click');
|
||||||
|
expect(wrapper.instance().state.visible).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
116
components/drawer/__tests__/MultiDrawer.test.js
Normal file
116
components/drawer/__tests__/MultiDrawer.test.js
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
import Drawer from '..';
|
||||||
|
import Button from '../../button';
|
||||||
|
|
||||||
|
class MultiDrawer extends React.Component {
|
||||||
|
state = { visible: false, childrenDrawer: false };
|
||||||
|
|
||||||
|
showDrawer = () => {
|
||||||
|
this.setState({
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onClose = () => {
|
||||||
|
this.setState({
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
showChildrenDrawer = () => {
|
||||||
|
this.setState({
|
||||||
|
childrenDrawer: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onChildrenDrawerClose = () => {
|
||||||
|
this.setState({
|
||||||
|
childrenDrawer: false,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { childrenDrawer, visible } = this.state;
|
||||||
|
const { placement } = this.props;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Button type="primary" id="open_drawer" onClick={this.showDrawer}>
|
||||||
|
Open drawer
|
||||||
|
</Button>
|
||||||
|
<Drawer
|
||||||
|
title="Multi-level drawer"
|
||||||
|
wrapClassName="test_drawer"
|
||||||
|
width={520}
|
||||||
|
closable={false}
|
||||||
|
onClose={this.onClose}
|
||||||
|
getContainer={false}
|
||||||
|
placement={placement}
|
||||||
|
visible={visible}
|
||||||
|
>
|
||||||
|
<Button type="primary" id="open_two_drawer" onClick={this.showChildrenDrawer}>
|
||||||
|
Two-level drawer
|
||||||
|
</Button>
|
||||||
|
<Drawer
|
||||||
|
title="Two-level Drawer"
|
||||||
|
width={320}
|
||||||
|
closable={false}
|
||||||
|
getContainer={false}
|
||||||
|
placement={placement}
|
||||||
|
onClose={this.onChildrenDrawerClose}
|
||||||
|
visible={childrenDrawer}
|
||||||
|
>
|
||||||
|
<div id="two_drawer_text">
|
||||||
|
This is two-level drawer
|
||||||
|
</div>
|
||||||
|
</Drawer>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 0,
|
||||||
|
width: '100%',
|
||||||
|
borderTop: '1px solid #e8e8e8',
|
||||||
|
padding: '10px 16px',
|
||||||
|
textAlign: 'right',
|
||||||
|
left: 0,
|
||||||
|
background: '#fff',
|
||||||
|
borderRadius: '0 0 4px 4px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
style={{
|
||||||
|
marginRight: 8,
|
||||||
|
}}
|
||||||
|
onClick={this.onClose}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button onClick={this.onClose} type="primary">
|
||||||
|
Submit
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Drawer>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Drawer', () => {
|
||||||
|
it('render right MultiDrawer', () => {
|
||||||
|
const wrapper = mount(<MultiDrawer placement="right" />);
|
||||||
|
wrapper.find('button#open_drawer').simulate('click');
|
||||||
|
wrapper.find('button#open_two_drawer').simulate('click');
|
||||||
|
const translateX = wrapper.find('.ant-drawer.test_drawer').get(0).props.style.transform;
|
||||||
|
expect(translateX).toEqual('translateX(-180px)');
|
||||||
|
expect(wrapper.find('#two_drawer_text').exists()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('render right MultiDrawer', () => {
|
||||||
|
const wrapper = mount(<MultiDrawer placement="left" />);
|
||||||
|
wrapper.find('button#open_drawer').simulate('click');
|
||||||
|
wrapper.find('button#open_two_drawer').simulate('click');
|
||||||
|
const translateX = wrapper.find('.ant-drawer.test_drawer').get(0).props.style.transform;
|
||||||
|
expect(translateX).toEqual('translateX(180px)');
|
||||||
|
expect(wrapper.find('#two_drawer_text').exists()).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
@ -1,21 +1,25 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`Drawer closable is false 1`] = `
|
exports[`Drawer closable is false 1`] = `
|
||||||
<div>
|
<div
|
||||||
|
class=""
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer ant-drawer-right ant-drawer-open"
|
class="ant-drawer ant-drawer-right"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-mask"
|
class="ant-drawer-mask"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content-wrapper"
|
class="ant-drawer-content-wrapper"
|
||||||
|
style="transform:translateX(100%);width:256px"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content"
|
class="ant-drawer-content"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="overflow: auto; height: 100%; width: 256px;"
|
class="ant-drawer-wrapper-body"
|
||||||
|
style="overflow:auto;height:100%"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-body"
|
class="ant-drawer-body"
|
||||||
@ -30,7 +34,9 @@ exports[`Drawer closable is false 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Drawer destroyOnClose is true 1`] = `
|
exports[`Drawer destroyOnClose is true 1`] = `
|
||||||
<div>
|
<div
|
||||||
|
class=""
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer ant-drawer-right"
|
class="ant-drawer ant-drawer-right"
|
||||||
>
|
>
|
||||||
@ -39,13 +45,29 @@ exports[`Drawer destroyOnClose is true 1`] = `
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content-wrapper"
|
class="ant-drawer-content-wrapper"
|
||||||
|
style="transform:translateX(100%);width:256px"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content"
|
class="ant-drawer-content"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="overflow: auto; height: 100%; width: 256px;"
|
class="ant-drawer-wrapper-body"
|
||||||
|
style="overflow:auto;height:100%;opacity:0;transition:opacity .3s"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-label="Close"
|
||||||
|
class="ant-drawer-close"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-drawer-close-x"
|
||||||
/>
|
/>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="ant-drawer-body"
|
||||||
|
>
|
||||||
|
Here is content of Drawer
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -53,21 +75,25 @@ exports[`Drawer destroyOnClose is true 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Drawer have a title 1`] = `
|
exports[`Drawer have a title 1`] = `
|
||||||
<div>
|
<div
|
||||||
|
class=""
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer ant-drawer-right ant-drawer-open"
|
class="ant-drawer ant-drawer-right"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-mask"
|
class="ant-drawer-mask"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content-wrapper"
|
class="ant-drawer-content-wrapper"
|
||||||
|
style="transform:translateX(100%);width:256px"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content"
|
class="ant-drawer-content"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="overflow: auto; height: 100%; width: 256px;"
|
class="ant-drawer-wrapper-body"
|
||||||
|
style="overflow:auto;height:100%"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-header"
|
class="ant-drawer-header"
|
||||||
@ -99,21 +125,66 @@ exports[`Drawer have a title 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Drawer render correctly 1`] = `
|
exports[`Drawer render correctly 1`] = `
|
||||||
<div>
|
<div
|
||||||
|
class=""
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer ant-drawer-right ant-drawer-open"
|
class="ant-drawer ant-drawer-right"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-mask"
|
class="ant-drawer-mask"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content-wrapper"
|
class="ant-drawer-content-wrapper"
|
||||||
|
style="transform:translateX(100%);width:400px"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content"
|
class="ant-drawer-content"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="overflow: auto; height: 100%; width: 400px;"
|
class="ant-drawer-wrapper-body"
|
||||||
|
style="overflow:auto;height:100%"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
aria-label="Close"
|
||||||
|
class="ant-drawer-close"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-drawer-close-x"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
<div
|
||||||
|
class="ant-drawer-body"
|
||||||
|
>
|
||||||
|
Here is content of Drawer
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`Drawer wrapClassName is test_drawer 1`] = `
|
||||||
|
<div
|
||||||
|
class=""
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-drawer ant-drawer-right test_drawer"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-drawer-mask"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="ant-drawer-content-wrapper"
|
||||||
|
style="transform:translateX(100%);width:256px"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-drawer-content"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-drawer-wrapper-body"
|
||||||
|
style="overflow:auto;height:100%;opacity:0;transition:opacity .3s"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
|
@ -10,7 +10,9 @@ exports[`Drawer render correctly 1`] = `
|
|||||||
open
|
open
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<div>
|
<div
|
||||||
|
class=""
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer ant-drawer-right ant-drawer-open"
|
class="ant-drawer ant-drawer-right ant-drawer-open"
|
||||||
>
|
>
|
||||||
@ -19,12 +21,14 @@ exports[`Drawer render correctly 1`] = `
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content-wrapper"
|
class="ant-drawer-content-wrapper"
|
||||||
|
style="width: 256px;"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="ant-drawer-content"
|
class="ant-drawer-content"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="overflow: auto; height: 100%; width: 256px;"
|
class="ant-drawer-wrapper-body"
|
||||||
|
style="overflow: auto; height: 100%;"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
|
@ -52,16 +52,16 @@ class App extends React.Component {
|
|||||||
<Drawer
|
<Drawer
|
||||||
title="Multi-level drawer"
|
title="Multi-level drawer"
|
||||||
width={520}
|
width={520}
|
||||||
|
wrapClassName="test_drawer"
|
||||||
closable={false}
|
closable={false}
|
||||||
onClose={this.onClose}
|
onClose={this.onClose}
|
||||||
visible={this.state.visible}
|
visible={this.state.visible}
|
||||||
push={this.state.childrenDrawer}
|
|
||||||
>
|
>
|
||||||
<Button type="primary" onClick={this.showChildrenDrawer}>
|
<Button type="primary" onClick={this.showChildrenDrawer}>
|
||||||
Two-level drawer
|
Two-level drawer
|
||||||
</Button>
|
</Button>
|
||||||
<Drawer
|
<Drawer
|
||||||
title="Food"
|
title="Two-level Drawer"
|
||||||
width={320}
|
width={320}
|
||||||
closable={false}
|
closable={false}
|
||||||
onClose={this.onChildrenDrawerClose}
|
onClose={this.onChildrenDrawerClose}
|
||||||
|
@ -2,7 +2,6 @@ import * as React from 'react';
|
|||||||
import RcDrawer from 'rc-drawer';
|
import RcDrawer from 'rc-drawer';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import createReactContext, { Context } from 'create-react-context';
|
import createReactContext, { Context } from 'create-react-context';
|
||||||
import isNumeric from '../_util/isNumeric';
|
|
||||||
|
|
||||||
const DrawerContext: Context<Drawer | null> = createReactContext(null);
|
const DrawerContext: Context<Drawer | null> = createReactContext(null);
|
||||||
|
|
||||||
@ -73,6 +72,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
praentDrawer: Drawer;
|
praentDrawer: Drawer;
|
||||||
|
destoryClose: boolean;
|
||||||
public componentDidUpdate(preProps: DrawerProps) {
|
public componentDidUpdate(preProps: DrawerProps) {
|
||||||
if (preProps.visible !== this.props.visible && this.praentDrawer) {
|
if (preProps.visible !== this.props.visible && this.praentDrawer) {
|
||||||
if (this.props.visible) {
|
if (this.props.visible) {
|
||||||
@ -106,18 +106,37 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
|
|||||||
push: false,
|
push: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
onDestoryTransitionEnd = () => {
|
||||||
|
const isDestroyOnClose = this.getDestoryOnClose();
|
||||||
|
if (!isDestroyOnClose) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.props.visible) {
|
||||||
|
this.destoryClose = true;
|
||||||
|
this.forceUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getDestoryOnClose = () => (this.props.destroyOnClose && !this.props.visible);
|
||||||
|
|
||||||
renderBody = () => {
|
renderBody = () => {
|
||||||
const { destroyOnClose, visible, width, placement } = this.props;
|
if (this.destoryClose && !this.props.visible) {
|
||||||
let containerStyle: React.CSSProperties = { width };
|
return null;
|
||||||
if (placement === 'left' || placement === 'right') {
|
}
|
||||||
containerStyle = {
|
this.destoryClose = false;
|
||||||
|
const { placement } = this.props;
|
||||||
|
|
||||||
|
const containerStyle: React.CSSProperties = placement === 'left'
|
||||||
|
|| placement === 'right' ? {
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
width,
|
} : {};
|
||||||
};
|
|
||||||
}
|
const isDestroyOnClose = this.getDestoryOnClose();
|
||||||
if (destroyOnClose && !visible) {
|
if (isDestroyOnClose) {
|
||||||
return <div style={containerStyle}/>;
|
// Increase the opacity transition, delete children after closing.
|
||||||
|
containerStyle.opacity = 0;
|
||||||
|
containerStyle.transition = 'opacity .3s';
|
||||||
}
|
}
|
||||||
const { prefixCls, title, closable } = this.props;
|
const { prefixCls, title, closable } = this.props;
|
||||||
let header;
|
let header;
|
||||||
@ -142,7 +161,11 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={containerStyle}>
|
<div
|
||||||
|
className={`${prefixCls}-wrapper-body`}
|
||||||
|
style={containerStyle}
|
||||||
|
onTransitionEnd={this.onDestoryTransitionEnd}
|
||||||
|
>
|
||||||
{header}
|
{header}
|
||||||
{closer}
|
{closer}
|
||||||
<div className={`${prefixCls}-body`} style={this.props.style}>
|
<div className={`${prefixCls}-body`} style={this.props.style}>
|
||||||
@ -152,10 +175,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
renderProvider = (value: Drawer) => {
|
renderProvider = (value: Drawer) => {
|
||||||
let { width, zIndex, style, placement, ...rest } = this.props;
|
let { zIndex, style, placement, ...rest } = this.props;
|
||||||
if (isNumeric(width)) {
|
|
||||||
width = `${width}px`;
|
|
||||||
}
|
|
||||||
const RcDrawerStyle = this.state.push
|
const RcDrawerStyle = this.state.push
|
||||||
? {
|
? {
|
||||||
zIndex,
|
zIndex,
|
||||||
@ -173,7 +193,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
|
|||||||
showMask={this.props.mask}
|
showMask={this.props.mask}
|
||||||
placement={placement}
|
placement={placement}
|
||||||
style={RcDrawerStyle}
|
style={RcDrawerStyle}
|
||||||
class={this.props.wrapClassName}
|
className={this.props.wrapClassName}
|
||||||
>
|
>
|
||||||
{this.renderBody()}
|
{this.renderBody()}
|
||||||
</RcDrawer>
|
</RcDrawer>
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: @zindex-modal;
|
z-index: @zindex-modal;
|
||||||
transition: transform .3s @ease-in-out-circ;
|
transition: transform 0.3s @ease-in-out-circ;
|
||||||
>* {
|
> * {
|
||||||
transition: transform .3s @ease-in-out-circ;
|
transition: transform 0.3s @ease-in-out-circ;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-content-wrapper {
|
&-content-wrapper {
|
||||||
@ -27,10 +27,8 @@
|
|||||||
}
|
}
|
||||||
&-left {
|
&-left {
|
||||||
&.@{dawer-prefix-cls}-open {
|
&.@{dawer-prefix-cls}-open {
|
||||||
.@{dawer-prefix-cls} {
|
.@{dawer-prefix-cls}-content-wrapper {
|
||||||
&-wrapper {
|
box-shadow: @shadow-1-right;
|
||||||
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,10 +39,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
&.@{dawer-prefix-cls}-open {
|
&.@{dawer-prefix-cls}-open {
|
||||||
& .@{dawer-prefix-cls} {
|
.@{dawer-prefix-cls}-content-wrapper {
|
||||||
&-wrapper {
|
box-shadow: @shadow-1-left;
|
||||||
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +136,7 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
background-color: @modal-mask-bg;
|
background-color: @modal-mask-bg;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
transition: opacity .3s @ease-in-out-circ;
|
transition: opacity 0.3s @ease-in-out-circ;
|
||||||
filter: ~"alpha(opacity=50)";
|
filter: ~"alpha(opacity=50)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,4 +147,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,9 +236,14 @@ form {
|
|||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.@{ant-prefix}-input-number + .@{form-prefix-cls}-text {
|
.@{ant-prefix}-input-number {
|
||||||
|
+ .@{form-prefix-cls}-text {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
&-handler-wrap {
|
||||||
|
z-index: 2; // https://github.com/ant-design/ant-design/issues/6289
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.@{ant-prefix}-select,
|
.@{ant-prefix}-select,
|
||||||
.@{ant-prefix}-cascader-picker {
|
.@{ant-prefix}-cascader-picker {
|
||||||
|
@ -109,7 +109,6 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
border-radius: 0 @border-radius-base @border-radius-base 0;
|
border-radius: 0 @border-radius-base @border-radius-base 0;
|
||||||
transition: opacity 0.24s linear 0.1s;
|
transition: opacity 0.24s linear 0.1s;
|
||||||
z-index: 2; // https://github.com/ant-design/ant-design/issues/6289
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-handler-wrap:hover &-handler {
|
&-handler-wrap:hover &-handler {
|
||||||
|
@ -19,6 +19,7 @@ import classNames from 'classnames';
|
|||||||
import omit from 'omit.js';
|
import omit from 'omit.js';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
|
import isNumeric from '../_util/isNumeric';
|
||||||
|
|
||||||
const dimensionMap = {
|
const dimensionMap = {
|
||||||
xs: '480px',
|
xs: '480px',
|
||||||
@ -66,10 +67,6 @@ const generateId = (() => {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const isNumeric = (n: any) => {
|
|
||||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class Sider extends React.Component<SiderProps, SiderState> {
|
export default class Sider extends React.Component<SiderProps, SiderState> {
|
||||||
static __ANT_LAYOUT_SIDER: any = true;
|
static __ANT_LAYOUT_SIDER: any = true;
|
||||||
|
|
||||||
|
@ -10,20 +10,21 @@ export interface MentionProps {
|
|||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
suggestionStyle?: React.CSSProperties;
|
suggestionStyle?: React.CSSProperties;
|
||||||
suggestions?: Array<any>;
|
suggestions?: Array<any>;
|
||||||
onSearchChange?: Function;
|
onSearchChange?: (value: string, trigger: string) => any;
|
||||||
onChange?: Function;
|
onChange?: (contentState: any) => any;
|
||||||
notFoundContent?: any;
|
notFoundContent?: any;
|
||||||
loading?: Boolean;
|
loading?: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
defaultValue?: any;
|
defaultValue?: any;
|
||||||
value?: any;
|
value?: any;
|
||||||
className?: string;
|
className?: string;
|
||||||
multiLines?: Boolean;
|
multiLines?: boolean;
|
||||||
prefix?: string;
|
prefix?: string | string[];
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
getSuggestionContainer?: (triggerNode: Element) => HTMLElement;
|
getSuggestionContainer?: (triggerNode: Element) => HTMLElement;
|
||||||
onFocus?: React.FocusEventHandler<HTMLElement>;
|
onFocus?: React.FocusEventHandler<HTMLElement>;
|
||||||
onBlur?: React.FocusEventHandler<HTMLElement>;
|
onBlur?: React.FocusEventHandler<HTMLElement>;
|
||||||
|
onSelect?: (suggestion: string, data?: any) => any;
|
||||||
readOnly?: boolean;
|
readOnly?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
placement?: MentionPlacement;
|
placement?: MentionPlacement;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
border-color: @menu-dark-bg;
|
border-color: @menu-dark-bg;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-dark&-horizontal > &-item > a:before {
|
&-dark&-horizontal > &-item > a:before {
|
||||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import shallowEqual from 'shallowequal';
|
import shallowEqual from 'shallowequal';
|
||||||
import Radio from './radio';
|
import Radio from './radio';
|
||||||
import { RadioGroupProps, RadioGroupState, RadioChangeEvent } from './interface';
|
import { RadioGroupProps, RadioGroupState, RadioChangeEvent, RadioGroupButtonStyle } from './interface';
|
||||||
|
|
||||||
function getCheckedValue(children: React.ReactNode) {
|
function getCheckedValue(children: React.ReactNode) {
|
||||||
let value = null;
|
let value = null;
|
||||||
@ -21,7 +21,7 @@ export default class RadioGroup extends React.Component<RadioGroupProps, RadioGr
|
|||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
prefixCls: 'ant-radio',
|
prefixCls: 'ant-radio',
|
||||||
buttonStyle: 'outline',
|
buttonStyle: 'outline' as RadioGroupButtonStyle,
|
||||||
};
|
};
|
||||||
|
|
||||||
static childContextTypes = {
|
static childContextTypes = {
|
||||||
|
@ -2,6 +2,8 @@ import * as React from 'react';
|
|||||||
import { AbstractCheckboxGroupProps } from '../checkbox/Group';
|
import { AbstractCheckboxGroupProps } from '../checkbox/Group';
|
||||||
import { AbstractCheckboxProps } from '../checkbox/Checkbox';
|
import { AbstractCheckboxProps } from '../checkbox/Checkbox';
|
||||||
|
|
||||||
|
export type RadioGroupButtonStyle = 'outline' | 'solid';
|
||||||
|
|
||||||
export interface RadioGroupProps extends AbstractCheckboxGroupProps {
|
export interface RadioGroupProps extends AbstractCheckboxGroupProps {
|
||||||
defaultValue?: any;
|
defaultValue?: any;
|
||||||
value?: any;
|
value?: any;
|
||||||
@ -12,7 +14,7 @@ export interface RadioGroupProps extends AbstractCheckboxGroupProps {
|
|||||||
name?: string;
|
name?: string;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
id?: string;
|
id?: string;
|
||||||
buttonStyle?: 'outline' | 'solid';
|
buttonStyle?: RadioGroupButtonStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RadioGroupState {
|
export interface RadioGroupState {
|
||||||
|
@ -26,7 +26,7 @@ Select component to select value from options.
|
|||||||
| allowClear | Show clear button. | boolean | false |
|
| allowClear | Show clear button. | boolean | false |
|
||||||
| autoFocus | Get focus by default | boolean | false |
|
| autoFocus | Get focus by default | boolean | false |
|
||||||
| defaultActiveFirstOption | Whether active first option by default | boolean | true |
|
| defaultActiveFirstOption | Whether active first option by default | boolean | true |
|
||||||
| defaultValue | Initial selected option. | string\|number\|string\[]\|number\[] | - |
|
| defaultValue | Initial selected option. | string\|string\[]<br />number\|number\[] | - |
|
||||||
| disabled | Whether disabled select | boolean | false |
|
| disabled | Whether disabled select | boolean | false |
|
||||||
| dropdownClassName | className of dropdown menu | string | - |
|
| dropdownClassName | className of dropdown menu | string | - |
|
||||||
| dropdownMatchSelectWidth | Whether dropdown's width is same with select. | boolean | true |
|
| dropdownMatchSelectWidth | Whether dropdown's width is same with select. | boolean | true |
|
||||||
|
@ -27,7 +27,7 @@ title: Select
|
|||||||
| allowClear | 支持清除 | boolean | false |
|
| allowClear | 支持清除 | boolean | false |
|
||||||
| autoFocus | 默认获取焦点 | boolean | false |
|
| autoFocus | 默认获取焦点 | boolean | false |
|
||||||
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true |
|
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true |
|
||||||
| defaultValue | 指定默认选中的条目 | string\|string\[]\|number\|number\[] | - |
|
| defaultValue | 指定默认选中的条目 | string\|string\[]<br />number\|number\[] | - |
|
||||||
| disabled | 是否禁用 | boolean | false |
|
| disabled | 是否禁用 | boolean | false |
|
||||||
| dropdownClassName | 下拉菜单的 className 属性 | string | - |
|
| dropdownClassName | 下拉菜单的 className 属性 | string | - |
|
||||||
| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true |
|
| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true |
|
||||||
|
@ -481,6 +481,11 @@
|
|||||||
font-size: @font-size-sm;
|
font-size: @font-size-sm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-item-group-list &-item:first-child:not(:last-child),
|
||||||
|
&-item-group:not(:last-child) &-item-group-list &-item:last-child {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
&-item {
|
&-item {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -223,6 +223,16 @@ describe('Table.filter', () => {
|
|||||||
expect(handleChange).toBeCalledWith({}, { name: ['boy'] }, {});
|
expect(handleChange).toBeCalledWith({}, { name: ['boy'] }, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not fire change event on close filterDropdown without changing anything', () => {
|
||||||
|
const handleChange = jest.fn();
|
||||||
|
const wrapper = mount(createTable({ onChange: handleChange }));
|
||||||
|
const dropdownWrapper = mount(wrapper.find('Trigger').instance().getComponent());
|
||||||
|
|
||||||
|
dropdownWrapper.find('.clear').simulate('click');
|
||||||
|
|
||||||
|
expect(handleChange).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it('three levels menu', () => {
|
it('three levels menu', () => {
|
||||||
const filters = [
|
const filters = [
|
||||||
{ text: 'Upper', value: 'Upper' },
|
{ text: 'Upper', value: 'Upper' },
|
||||||
|
@ -109,6 +109,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
|||||||
>
|
>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="0"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-column-has-filters"
|
class="ant-table-column-has-filters"
|
||||||
@ -122,6 +123,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="1"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-column-has-filters"
|
class="ant-table-column-has-filters"
|
||||||
@ -135,6 +137,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="2"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-column-has-filters"
|
class="ant-table-column-has-filters"
|
||||||
@ -148,6 +151,7 @@ exports[`Table.filter renders filter correctly 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="3"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-column-has-filters"
|
class="ant-table-column-has-filters"
|
||||||
|
@ -43,6 +43,7 @@ exports[`Table.pagination renders pagination correctly 1`] = `
|
|||||||
>
|
>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="0"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class=""
|
class=""
|
||||||
@ -56,6 +57,7 @@ exports[`Table.pagination renders pagination correctly 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="1"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class=""
|
class=""
|
||||||
|
@ -72,6 +72,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
|||||||
>
|
>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="0"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-fixed-columns-in-body ant-table-selection-column"
|
class="ant-table-fixed-columns-in-body ant-table-selection-column"
|
||||||
@ -106,6 +107,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="1"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-fixed-columns-in-body ant-table-selection-column"
|
class="ant-table-fixed-columns-in-body ant-table-selection-column"
|
||||||
@ -140,6 +142,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="2"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-fixed-columns-in-body ant-table-selection-column"
|
class="ant-table-fixed-columns-in-body ant-table-selection-column"
|
||||||
@ -174,6 +177,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="3"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-fixed-columns-in-body ant-table-selection-column"
|
class="ant-table-fixed-columns-in-body ant-table-selection-column"
|
||||||
@ -262,6 +266,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
|||||||
>
|
>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="0"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-selection-column"
|
class="ant-table-selection-column"
|
||||||
@ -287,6 +292,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="1"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-selection-column"
|
class="ant-table-selection-column"
|
||||||
@ -312,6 +318,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="2"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-selection-column"
|
class="ant-table-selection-column"
|
||||||
@ -337,6 +344,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="3"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class="ant-table-selection-column"
|
class="ant-table-selection-column"
|
||||||
|
@ -70,6 +70,7 @@ exports[`Table renders JSX correctly 1`] = `
|
|||||||
>
|
>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="1"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class=""
|
class=""
|
||||||
@ -93,6 +94,7 @@ exports[`Table renders JSX correctly 1`] = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
class="ant-table-row ant-table-row-level-0"
|
class="ant-table-row ant-table-row-level-0"
|
||||||
|
data-row-key="2"
|
||||||
>
|
>
|
||||||
<td
|
<td
|
||||||
class=""
|
class=""
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -108,8 +108,10 @@ export default class FilterMenu<T> extends React.Component<FilterMenuProps<T>, F
|
|||||||
}
|
}
|
||||||
|
|
||||||
confirmFilter() {
|
confirmFilter() {
|
||||||
if (this.state.selectedKeys !== this.props.selectedKeys) {
|
const { selectedKeys } = this.state;
|
||||||
this.props.confirmFilter(this.props.column, this.state.selectedKeys);
|
|
||||||
|
if (!shallowequal(selectedKeys, this.props.selectedKeys)) {
|
||||||
|
this.props.confirmFilter(this.props.column, selectedKeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ const columns = [{
|
|||||||
| selectedRowKeys | 指定选中项的 key 数组,需要和 onChange 进行配合 | string\[] | \[] |
|
| selectedRowKeys | 指定选中项的 key 数组,需要和 onChange 进行配合 | string\[] | \[] |
|
||||||
| selections | 自定义选择项 [配置项](#selection), 设为 `true` 时使用默认选择项 | object\[]\|boolean | true |
|
| selections | 自定义选择项 [配置项](#selection), 设为 `true` 时使用默认选择项 | object\[]\|boolean | true |
|
||||||
| type | 多选/单选,`checkbox` or `radio` | string | `checkbox` |
|
| type | 多选/单选,`checkbox` or `radio` | string | `checkbox` |
|
||||||
| onChange | 选中项发生变化的时的回调 | Function(selectedRowKeys, selectedRows) | - |
|
| onChange | 选中项发生变化时的回调 | Function(selectedRowKeys, selectedRows) | - |
|
||||||
| onSelect | 用户手动选择/取消选择某列的回调 | Function(record, selected, selectedRows, nativeEvent) | - |
|
| onSelect | 用户手动选择/取消选择某列的回调 | Function(record, selected, selectedRows, nativeEvent) | - |
|
||||||
| onSelectAll | 用户手动选择/取消选择所有列的回调 | Function(selected, selectedRows, changeRows) | - |
|
| onSelectAll | 用户手动选择/取消选择所有列的回调 | Function(selected, selectedRows, changeRows) | - |
|
||||||
| onSelectInvert | 用户手动选择反选的回调 | Function(selectedRows) | - |
|
| onSelectInvert | 用户手动选择反选的回调 | Function(selectedRows) | - |
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
border-radius: @border-radius-base;
|
border-radius: @border-radius-base;
|
||||||
box-shadow: @box-shadow-base;
|
box-shadow: @box-shadow-base;
|
||||||
min-height: 32px;
|
min-height: 32px;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arrows
|
// Arrows
|
||||||
|
10
package.json
10
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "antd",
|
"name": "antd",
|
||||||
"version": "3.7.0",
|
"version": "3.7.1",
|
||||||
"title": "Ant Design",
|
"title": "Ant Design",
|
||||||
"description": "An enterprise-class UI design language and React-based implementation",
|
"description": "An enterprise-class UI design language and React-based implementation",
|
||||||
"homepage": "http://ant.design/",
|
"homepage": "http://ant.design/",
|
||||||
@ -59,7 +59,7 @@
|
|||||||
"rc-checkbox": "~2.1.5",
|
"rc-checkbox": "~2.1.5",
|
||||||
"rc-collapse": "~1.9.0",
|
"rc-collapse": "~1.9.0",
|
||||||
"rc-dialog": "~7.1.0",
|
"rc-dialog": "~7.1.0",
|
||||||
"rc-drawer": "~1.5.9",
|
"rc-drawer": "~1.6.2",
|
||||||
"rc-dropdown": "~2.2.0",
|
"rc-dropdown": "~2.2.0",
|
||||||
"rc-editor-mention": "^1.0.2",
|
"rc-editor-mention": "^1.0.2",
|
||||||
"rc-form": "^2.1.0",
|
"rc-form": "^2.1.0",
|
||||||
@ -105,7 +105,7 @@
|
|||||||
"babel-preset-react": "^6.16.0",
|
"babel-preset-react": "^6.16.0",
|
||||||
"babel-preset-stage-0": "^6.16.0",
|
"babel-preset-stage-0": "^6.16.0",
|
||||||
"bezier-easing": "^2.0.3",
|
"bezier-easing": "^2.0.3",
|
||||||
"bisheng": "^0.29.0",
|
"bisheng": "^0.28.0",
|
||||||
"bisheng-plugin-antd": "^0.16.0",
|
"bisheng-plugin-antd": "^0.16.0",
|
||||||
"bisheng-plugin-description": "^0.1.1",
|
"bisheng-plugin-description": "^0.1.1",
|
||||||
"bisheng-plugin-react": "^0.6.0",
|
"bisheng-plugin-react": "^0.6.0",
|
||||||
@ -151,8 +151,8 @@
|
|||||||
"react": "^16.3.2",
|
"react": "^16.3.2",
|
||||||
"react-color": "^2.11.7",
|
"react-color": "^2.11.7",
|
||||||
"react-copy-to-clipboard": "^5.0.0",
|
"react-copy-to-clipboard": "^5.0.0",
|
||||||
"react-dnd": "^3.0.2",
|
"react-dnd": "^5.0.0",
|
||||||
"react-dnd-html5-backend": "^3.0.2",
|
"react-dnd-html5-backend": "^5.0.1",
|
||||||
"react-document-title": "^2.0.1",
|
"react-document-title": "^2.0.1",
|
||||||
"react-dom": "^16.3.2",
|
"react-dom": "^16.3.2",
|
||||||
"react-github-button": "^0.1.1",
|
"react-github-button": "^0.1.1",
|
||||||
|
@ -24,7 +24,7 @@ module.exports = {
|
|||||||
'app.demo.codepen': 'Open in CodePen',
|
'app.demo.codepen': 'Open in CodePen',
|
||||||
'app.demo.codesandbox': 'Open in CodeSandbox',
|
'app.demo.codesandbox': 'Open in CodeSandbox',
|
||||||
'app.demo.riddle': 'Open in Riddle',
|
'app.demo.riddle': 'Open in Riddle',
|
||||||
'app.home.slogan': 'A UI Design Language',
|
'app.home.slogan': 'The world\'s second most popular React UI framework',
|
||||||
'app.home.introduce': 'A design system with values of Nature and Determinacy for better user experience of enterprise applications',
|
'app.home.introduce': 'A design system with values of Nature and Determinacy for better user experience of enterprise applications',
|
||||||
'app.home.design-language': 'Design Language',
|
'app.home.design-language': 'Design Language',
|
||||||
'app.home.solution': 'Solution',
|
'app.home.solution': 'Solution',
|
||||||
|
@ -202,20 +202,31 @@
|
|||||||
.markdown.api-container table {
|
.markdown.api-container table {
|
||||||
font-size: @font-size-base;
|
font-size: @font-size-base;
|
||||||
line-height: @line-height-base;
|
line-height: @line-height-base;
|
||||||
|
font-family: @code-family;
|
||||||
|
border-width: 0;
|
||||||
|
margin: 2em 0;
|
||||||
|
th, td {
|
||||||
|
padding: 14px 16px;
|
||||||
|
border-width: 1px 0;
|
||||||
|
border-color: @border-color-split;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
border-width: 0 0 2px 0;
|
||||||
|
}
|
||||||
td:first-child {
|
td:first-child {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
width: 20%;
|
width: 20%;
|
||||||
font-family: "Lucida Console", Consolas, Menlo, Courier, monospace;
|
color: @blue-9;
|
||||||
}
|
}
|
||||||
td:nth-child(3) {
|
td:nth-child(3) {
|
||||||
width: 22%;
|
width: 22%;
|
||||||
font-size: 12px;
|
font-size: @font-size-base - 1px;
|
||||||
font-family: "Lucida Console", Consolas, Menlo, Courier, monospace;
|
color: @magenta-7;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
td:last-child {
|
td:last-child {
|
||||||
width: 13%;
|
width: 13%;
|
||||||
font-size: 12px;
|
font-size: @font-size-base - 1px;
|
||||||
font-family: "Lucida Console", Consolas, Menlo, Courier, monospace;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
tests/__mocks__/react.js
vendored
17
tests/__mocks__/react.js
vendored
@ -1,11 +1,18 @@
|
|||||||
|
import createReactContext from 'create-react-context/lib/implementation';
|
||||||
|
|
||||||
const React = require.requireActual('react');
|
const React = require.requireActual('react');
|
||||||
|
|
||||||
if (!React.createContext) {
|
if (!React.createContext) {
|
||||||
React.createContext = () => {
|
React.createContext = createReactContext;
|
||||||
const Provider = ({ children }) => children;
|
}
|
||||||
const Consumer = ({ children }) => children();
|
|
||||||
return { Provider, Consumer };
|
if (!React.createRef) {
|
||||||
|
React.createRef = () => {
|
||||||
|
const ref = function setRef(node) {
|
||||||
|
ref.current = node;
|
||||||
|
};
|
||||||
|
return ref;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = React;
|
Object.assign(module.exports, React);
|
||||||
|
Loading…
Reference in New Issue
Block a user