Compare commits

..

84 Commits
3.7.0 ... 3.7.2

Author SHA1 Message Date
Wei Zhu
ee1c726447 Bump 3.7.2 2018-07-25 17:43:39 +08:00
Wei Zhu
548c694c40 Add 3.7.2 changelog (#11455) 2018-07-25 17:42:31 +08:00
zombiej
f5652f8e57 make title & label as optional props in treeSelect 2018-07-25 17:06:44 +08:00
Wei Zhu
9f76f1c276 chore: add tests for b9992f4 2018-07-25 16:31:18 +08:00
Wei Zhu
b9992f4a08 fix: DatePicker can not change year/month when under control
React 16.4 call getDerivedStateFromProps on every render

close #11447
close #11440
close #11439
close #11416
close #11405
2018-07-25 15:42:48 +08:00
JribiBelhassen
36f396f86f Change label in TreeData interface to title, since label is deprecated (#11442) 2018-07-25 10:53:18 +08:00
afc163
fbf1a35249 Fix extra scrollbar style of Modal.confirm in Firefox, close #11432 2018-07-24 16:27:21 +08:00
Wei Zhu
611f6e1f8f chore: remove circleci cache 2018-07-24 12:13:03 +08:00
Andrzej Dybionka
968371b22a fix: table onChange event is fired every time when close filterDropdown
Close #11164
2018-07-24 12:02:01 +08:00
Will
e91f67b87c Update index.zh-CN.md (#11427)
First of all, thank you for your contribution! :-)

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

* [ ] Make sure that you propose PR to right branch: bugfix for `master`, feature for latest active branch `feature-x.x`.
* [ ] Make sure that you follow antd's [code convention](https://github.com/ant-design/ant-design/wiki/Code-convention-for-antd).
* [ ] Run `npm run lint` and fix those errors before submitting in order to keep consistent code style.
* [ ] Rebase before creating a PR to keep commit history clear.
* [ ] Add some descriptions and refer relative issues for you PR.

Extra checklist:

**if** *isBugFix* **:**

  * [ ] Make sure that you add at least one unit test for the bug which you had fixed.

**elif** *isNewFeature* **:**

  * [ ] Update API docs for the component.
  * [ ] Update/Add demo to demonstrate new feature.
  * [ ] Update TypeScript definition for the component.
  * [ ] Add unit tests for the feature.
2018-07-24 11:29:30 +08:00
zongzi531
e29a88b704 fix: badge type error. 2018-07-24 00:01:26 +08:00
Wei Zhu
0f503b50f7 chore: update circleci 2018-07-23 20:47:21 +08:00
afc163
6cb6f5c83e Fix select menu item radius style 2018-07-23 19:01:30 +08:00
Wei Zhu
67145a777e chore: fix job name 2018-07-23 18:25:18 +08:00
Wei Zhu
4c5d66228d chore: persist whole workspace 2018-07-23 18:23:55 +08:00
Wei Zhu
cc02ebf9d4 chore: dry circleci config 2018-07-23 18:20:55 +08:00
Wei Zhu
522b70e698 chore: tweak circleci 2018-07-23 18:01:59 +08:00
Wei Zhu
61284e2c9a chore: fix install react on circleci 2018-07-23 17:36:13 +08:00
Wei Zhu
691a98d25b Tweak circleci config 2018-07-23 17:34:16 +08:00
Wei Zhu
b95d8aedd2 introduce circle ci 2018-07-23 17:27:43 +08:00
Wei Zhu
91a7318999 test: fix react mock 2018-07-23 16:58:29 +08:00
Wei Zhu
435d793d60 test: fix React.createContext mock 2018-07-23 16:34:01 +08:00
Wei Zhu
c25e8de736 test: mock React.createRef 2018-07-23 16:12:36 +08:00
Wei Zhu
d87899784b Update .travis.yml 2018-07-23 15:50:39 +08:00
zombiej
6503bace42 move change log Drawer to first line 2018-07-23 15:33:50 +08:00
afc163
1c5f8f1901 update snapshots 2018-07-23 15:21:28 +08:00
afc163
66940db794 upgrade some devDeps 2018-07-23 15:18:22 +08:00
afc163
827da01e05 Fix badge url 2018-07-23 15:10:43 +08:00
afc163
101fdc7241 Fix InputNumber overlap in fixed columns table
close #11408

ref #6289
2018-07-23 15:10:43 +08:00
zombiej
0337b69893 update change log 2018-07-23 14:57:17 +08:00
Ed Moore
cd5cbafdf0 Fix types for Radio Group 2018-07-23 14:33:47 +08:00
zombiej
007c7d0ef7 adjust change log 2018-07-23 11:31:51 +08:00
Eager
c3e50c268d fix(Tooltip): fix text overflow the Tooltip 2018-07-22 15:52:02 +08:00
Eager Wei
c1daf5bad2 删除手误 2018-07-22 15:52:02 +08:00
Eager Wei
a29a0ff78d Update .codecov.yml 2018-07-22 15:52:02 +08:00
Amumu
f728fbe5ab getDerivedStateFromProp return null if not change
A valid state object (or null) must be returned. You have returned undefined.
2018-07-22 11:59:40 +08:00
hongxuWei
f796618a15 Fix the style of horizontal menu on dark theme 2018-07-22 11:58:33 +08:00
陈帅
d0c684e925 add wrapClassName and multi-level-drawer test 2018-07-22 11:55:46 +08:00
陈帅
cb961cdf01 remove snap in destroyOnClose test 2018-07-22 11:55:46 +08:00
陈帅
608f631b64 test: Perfect test 2018-07-22 11:55:46 +08:00
jljsj33
2cd863929a update drawer test 2018-07-22 11:55:46 +08:00
陈帅
57a2fc667e test: change moment to render 2018-07-22 11:55:46 +08:00
陈帅
88981fef22 style: Adjust the edge shadow 2018-07-22 11:55:46 +08:00
jljsj33
881cef5abf update drawer 2018-07-22 11:55:46 +08:00
zombiej
8c7dfe45c6 Bump 3.7.1 & update change log 2018-07-21 23:36:28 +08:00
tangjinzhou
430381f28f fix: ButtonGroup style bug when have disabled button #9296 (#11321)
* fix: ButtonGroup style bug when have disabled button #9296

* Update mixin.less
2018-07-21 22:11:57 +08:00
偏右
60c2860e09 Update package.json 2018-07-21 17:12:28 +08:00
afc163
6be189aa0f site: styling API Tables 2018-07-21 15:00:20 +08:00
afc163
18d85141e1 site: update document title in home page
Tribute to material-ui.com and 😉
2018-07-21 13:18:23 +08:00
Jake Richards
b4e0c48ed5 Strengthen Mention Component typings 2018-07-21 12:32:36 +08:00
偏右
2756d587d7 Update index.en-US.md 2018-07-20 23:22:40 +08:00
afc163
37ba3bcd7c fix rc-drawer version for strange ci fail 2018-07-20 19:48:26 +08:00
afc163
7dd5270831 fix snapshots 2018-07-20 19:37:42 +08:00
afc163
d441c815a9 fix snapshots 2018-07-20 18:17:18 +08:00
Fred-Shan
c045b79e62 Update index.zh-CN.md
there are two "theme" in the table
2018-07-20 17:38:33 +08:00
zombiej
2ad0bc0395 close #11380. Fix desciption of auto complete 2018-07-20 17:02:52 +08:00
afc163
361b94fb0f improve README.md 2018-07-20 14:05:59 +08:00
afc163
e2b9e5d832 update warning message 2018-07-20 12:10:43 +08:00
Wei Zhu
f22353cd2b Use npm package for offline-plugin
tnpm don't support git dependency
2018-07-20 11:53:49 +08:00
zombiej
ecc2293229 fix #11368. Clean outline style of treeSelect 2018-07-20 11:03:02 +08:00
zombiej
ed7630053e fix #11366. action trigger expand also trigger the onExpand 2018-07-20 10:50:20 +08:00
Leo Yin
96d8fc45f1 Fix edit-row.md 2018-07-19 11:28:44 +08:00
रोहन मल्होत्रा
12b99970f3 Migrated to new lifecycle method for datepiceker (#10309)
…picker

First of all, thank you for your contribution! :-)

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

* [x] Make sure that you propose PR to right branch: bugfix for `master`, feature for latest active branch `feature-x.x`.
* [x] Make sure that you follow antd's [code convention](https://github.com/ant-design/ant-design/wiki/Code-convention-for-antd).
* [x] Run `npm run lint` and fix those errors before submitting in order to keep consistent code style.
* [x] Rebase before creating a PR to keep commit history clear.
* [x] Add some descriptions and refer relative issues for you PR.

Extra checklist:

**if** *isBugFix* **:**

no
**elif** *isNewFeature* **:**

#9792
2018-07-19 11:26:47 +08:00
Bryan Berger
1d924300e7 add @message-notice-content-padding var to <Message /> 2018-07-18 22:17:12 +08:00
baozefeng
825d770254 bugfix: Chinese doc website date-picker demo link go to English website 2018-07-18 20:07:22 +08:00
afc163
782abe7bb6 demo: fix select showSearch demo placeholder, close #11325 2018-07-18 15:57:34 +08:00
陈帅
e7242f4924 fix #11307 Prop destroyOnClose prevents the closing animation of drawer 2018-07-18 15:53:06 +08:00
Wang Riwu
a2c4b03d45 add notification.open to API docs (#11281) 2018-07-18 14:55:47 +08:00
afc163
f7db1788df improve changelog 2018-07-18 12:46:24 +08:00
Jonathan Chen
fc7c64ce06 Docs: Fix spelling (#11316) 2018-07-18 09:43:40 +08:00
Daniel Zhang
308cb046e4 Add onMouseEnter and onMouseLeave to SelectProps (#11314) 2018-07-18 00:06:27 +08:00
Wei Zhu
c696757793 Revert "fix test"
This reverts commit f1570c01ea.

Follow f1570c01ea
2018-07-17 22:22:16 +08:00
Wei Zhu
e6c4c6667d Revert rc-menu upgrade
Revert "use default hover trigger for horizontal menu demo"

This reverts commit 159b09342d.

Revert "upgrade menu@7.2.0"

This reverts commit d4c9a1deea.

Revert "feat: prevent horizontal menu items wrapping"

This reverts commit 5c7f9feecb.
2018-07-17 21:59:16 +08:00
Eager Wei
9c792d52a8 fix table onChange pagination type (#11291)
Update interface.tsx TableProps onChange
2018-07-17 17:56:24 +08:00
陈帅
705e57f7e8 change drawer z-index to @zindex-modal 2018-07-17 17:34:20 +08:00
afc163
57c072d1b8 Fix dark menu small style issue, close #11299 2018-07-17 15:29:23 +08:00
Lyndon001
a0f5044189 Update visual.md 2018-07-17 14:09:36 +08:00
afc163
2cacfe78ea Fix switch overflow in certain situation, close #9928 2018-07-16 19:47:28 +08:00
afc163
152cae4d9f Fix Card tabs disable attribute, close #11212 2018-07-16 19:18:50 +08:00
tangjinzhou
14e0cc0161 fix: anchorLink href update 2018-07-16 17:31:32 +08:00
Wei Zhu
d2c34e32a1 fix: uniform divider font-size
close #11227
2018-07-16 16:48:42 +08:00
Hanz Luo
11f0f14cb2 Remove scrollbar on confirm Modal title 2018-07-16 10:44:14 +08:00
陈帅
f337d2f4e4 doc: Delete strange strings and adjust document description 2018-07-15 13:19:23 +08:00
付引
31b2517261 mport -> import 2018-07-15 12:54:23 +08:00
78 changed files with 1267 additions and 291 deletions

221
.circleci/config.yml Normal file
View 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

View File

@@ -8,7 +8,6 @@ node_js:
cache:
directories:
- $HOME/.npm
- node_modules
matrix:
fast_finish: true

View File

@@ -15,14 +15,46 @@ timeline: true
---
## 3.7.2
`2018-07-25`
- DatePicker
- 🐞 **Fix issue resulting in year and month can not be changed in control mode.** [b9992f4](https://github.com/ant-design/ant-design/commit/b9992f4a08574efb47b6e6cd80eb1e888b9a1ede)
- 🐞 Fix warning of `getDerivedStateFromProp`. [#11398](https://github.com/ant-design/ant-design/pull/11398) [@yoyo837](https://github.com/yoyo837)
- Drawer
- 🐞 Fix close animation when setting `destroyOnClose`. [#11307](https://github.com/ant-design/ant-design/issues/11307)
- 🐞 Fix display issue when using a `vw` value as `width`. [#11326](https://github.com/ant-design/ant-design/issues/11326)
- 🐞 Fix `wrapClassName` now working.
- 🐞 Fix text overflow of Tooltip. [#11402](https://github.com/ant-design/ant-design/pull/11402) [@weidapao](https://github.com/weidapao)
- 🐞 Fix style issue of dark theme Menu in Layout.Header. [#11400](https://github.com/ant-design/ant-design/pull/11400) [@hongxuWei](https://github.com/hongxuWei)
- 🐞 Fix the arrow buttons of InputNumber showing wrong positon in a fixed table. [#11408](https://github.com/ant-design/ant-design/issues/11408)
- 🐞 Fix issue resulting in Select.Option shows wrong border radius in Select.OptGroup. [6cb6f5c](https://github.com/ant-design/ant-design/commit/6cb6f5c83ed634e67d5b5d0816d11aa0788a74d8)
- 🐞 Fix issue resulting in `onChange` was trigged twice when click the filter icon of Table. [#11164](https://github.com/ant-design/ant-design/issues/11164) [@adybionka](https://github.com/adybionka)
- 🐞 Fix issue resulting title of Model.confirm shows scrollbar on Firefox. [#11432](https://github.com/ant-design/ant-design/issues/11432)
- TypeScript
- 🐞 Fix type definition of Radio.Group. [#11409](https://github.com/ant-design/ant-design/pull/11409) [@eddiemoore](https://github.com/eddiemoore)
- 🐞 Fix type definition of TreeSelect. [#11442](https://github.com/ant-design/ant-design/pull/11442) [@JribiBelhassen](https://github.com/JribiBelhassen)
- 🐞 Fix type definition of Badge. [#11421](https://github.com/ant-design/ant-design/pull/11421) [@zongzi531](https://github.com/zongzi531)
## 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 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.
Here are some highlights ✨:
- 🌟 Add drawer component : [Drawer](https://ant.design/components/drawer-cn/). [#10791](https://github.com/ant-design/ant-design/pull/10791)
- 🌟 Horizontal menu automatically collapses when there is no enough space. [#11234](https://github.com/ant-design/ant-design/pull/11234)
![demo](https://user-images.githubusercontent.com/1731837/42550555-0fef7878-8505-11e8-9d2f-f708fec66b44.gif)
- 🌟 Add `Tree.DirectoryTree` component as the built-in directory tree. [#7749](https://github.com/ant-design/ant-design/issues/7749)
Component Fixes / Enhancements:
@@ -33,8 +65,8 @@ Component Fixes / Enhancements:
- 🌟 Add `maxTagCount` prop to set the max count of visible tags. [fb96c9d](https://github.com/ant-design/ant-design/commit/fb96c9db351e44a202f64f780470c6319a8a9626)
- 🌟 Add `maxTagPlaceholder` prop to set the content when the tag is hidden. [fb96c9d](https://github.com/ant-design/ant-design/commit/fb96c9db351e44a202f64f780470c6319a8a9626)
- 🌟 Search input now supports case sensitive search. [#10990](https://github.com/ant-design/ant-design/issues/10990)
- 🗑 Remove `label` prop and use `title` prop instead in the `treeData`.
- Upgrade `rc-upload` to `2.5.0` for Upload.
- 🗑 Remove `label` prop and use `title` prop instead in the `treeData`.
- Upgrade `rc-upload` to `2.5.0` for Upload.
- 🌟 Add `directory` prop to support folder uploading. [#7315](https://github.com/ant-design/ant-design/issues/7315)
- 🌟 `action` prop supports to be the a function which returns a Promise object. [fd96967](https://github.com/ant-design/ant-design/commit/fd96967c872600b79bb608e9ddf9f8c38814a704)
- Dropdown

View File

@@ -15,14 +15,46 @@ timeline: true
---
## 3.7.2
`2018-07-25`
- DatePicker
- 🐞 **修复在受控模式下不能切换年月的问题。**[b9992f4](https://github.com/ant-design/ant-design/commit/b9992f4a08574efb47b6e6cd80eb1e888b9a1ede)
- 🐞 修复在 `getDerivedStateFromProp` 的警告。[#11398](https://github.com/ant-design/ant-design/pull/11398) [@yoyo837](https://github.com/yoyo837)
- Drawer
- 🐞 修复使用 `destroyOnClose` 时没有关闭动画的问题。[#11307](https://github.com/ant-design/ant-design/issues/11307)
- 🐞 修复 `width``vw` 为单位时的显示错误。[#11326](https://github.com/ant-design/ant-design/issues/11326)
- 🐞 修复 `wrapClassName` 属性无效的问题。
- 🐞 修复 Tooltip 文字溢出的问题。[#11402](https://github.com/ant-design/ant-design/pull/11402) [@weidapao](https://github.com/weidapao)
- 🐞 修复 Menu 在 `theme``dark` 是在 Layout.Header 里的样式问题。[#11400](https://github.com/ant-design/ant-design/pull/11400) [@hongxuWei](https://github.com/hongxuWei)
- 🐞 修复 InputNumber 的箭头按钮在使用了固定列的 Table 里显示错位的问题。[#11408](https://github.com/ant-design/ant-design/issues/11408)
- 🐞 修复 Select 使用分组时 Option 的圆角显示错误。[6cb6f5c](https://github.com/ant-design/ant-design/commit/6cb6f5c83ed634e67d5b5d0816d11aa0788a74d8)
- 🐞 修复 Table 第一次点击过滤按钮的时候 `onChange` 会被触发两次的问题。[#11164](https://github.com/ant-design/ant-design/issues/11164) [@adybionka](https://github.com/adybionka)
- 🐞 修复 Model.confirm 的标题在 Firefox 下会显示滚动条的问题。[#11432](https://github.com/ant-design/ant-design/issues/11432)
- TypeScript
- 🐞 修复 Radio.Group 类型定义。[#11409](https://github.com/ant-design/ant-design/pull/11409) [@eddiemoore](https://github.com/eddiemoore)
- 🐞 修复 TreeSelect 类型定义。[#11442](https://github.com/ant-design/ant-design/pull/11442) [@JribiBelhassen](https://github.com/JribiBelhassen)
- 🐞 修复 Badge 类型定义。[#11421](https://github.com/ant-design/ant-design/pull/11421) [@zongzi531](https://github.com/zongzi531)
## 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 是一个重磅更新,带来了很多激动人心的变化和新特性。
以下是一些亮点✨:
- 🔥 增加抽屉组件 : [`Drawer`](https://ant.design/components/drawer-cn/) [#10791](https://github.com/ant-design/ant-design/pull/10791)
- 🔥 Menu 增加一个横向菜单在空间不足时溢出部分自动收起的特性。[#11234](https://github.com/ant-design/ant-design/pull/11234)
![demo](https://user-images.githubusercontent.com/1731837/42550555-0fef7878-8505-11e8-9d2f-f708fec66b44.gif)
- 🔥 新增 `Tree.DirectoryTree` 组件,作为内置的目录树。[#7749](https://github.com/ant-design/ant-design/issues/7749)
组件修复/功能增强:
@@ -46,7 +78,7 @@ timeline: true
- 🌟 `filterIcon` 属性支持作为一个返回 `ReactNode` 的函数。[1af4392](https://github.com/ant-design/ant-design/commit/1af4392ae9fbdaa6fcfbf2f0de5413100ef4a84a)
- 🐞 修复在固定列时导致的行错位的问题。[#10392](https://github.com/ant-design/ant-design/issues/10392)
- 🐞 修复在组件中使用 `combobox` 模式的 `Select` 导致的重影问题。[#10828](https://github.com/ant-design/ant-design/issues/10828)
- 🐞 修复 Table 自定义组件不会更改。 [c380186](https://github.com/ant-design/ant-design/commit/c380186e794a7735ae91e992f25a313158ee4984)
- 🐞 修复 components 属性值不能变化的问题。[c380186](https://github.com/ant-design/ant-design/commit/c380186e794a7735ae91e992f25a313158ee4984)
- 🗑 Select 组件废弃了 `combobox` 模式,请使用 `AutoComplete` 组件代替。[53046a4](https://github.com/ant-design/ant-design/commit/53046a454ad83ca03dc313e63f56474ed1173002)
- 🌟 Alert 组件允许传递 `data-*``aria-*``role-*` 属性到组件内部。[f0b684d](https://github.com/ant-design/ant-design/commit/f0b684de6a7c422f0de56e1ef72aeb35ab25a858)
- 🌟 Avatar 组件新增 `alt` 属性,用于设置图像无法显示时的替代文本。[#10798](https://github.com/ant-design/ant-design/pull/10798)
@@ -63,8 +95,8 @@ timeline: true
- 🌟 新增 `onLoad` 属性,作为节点加载完毕时的回调函数。[c488aca](https://github.com/ant-design/ant-design/commit/c488aca05e11d942d77c1b6bff45d12bbb1a2bd6)
- 🌟 增加 `okButtonDisabled` and `cancelButtonDisabled` 属性用于禁用确定和取消按钮。[#10955](https://github.com/ant-design/ant-design/pull/10955)
- 🌟 Cascader 新增 fieldNames 并废弃拼写错误的 filedNames。 [#10896](https://github.com/ant-design/ant-design/issues/10896)
- 🐞 修复时间轴不能与`Tooltip`一起使用的问题。 [0e3b67e](https://github.com/ant-design/ant-design/commit/0e3b67e9999d867cc304f3be61a8a042a2ab92ee)
- 🐞 修复当 Avata 自定义大小时,圆角不改变的问题。[e1e6523](https://github.com/ant-design/ant-design/commit/e1e6523452286ba56f20b73abad762a58ea7d7bc)
- 🐞 修复时间轴不能与`Tooltip`一起使用的问题。 [0e3b67e](https://github.com/ant-design/ant-design/commit/0e3b67e9999d867cc304f3be61a8a042a2ab92ee)
- 🐞 修复当 Avatar 自定义大小时,圆角不改变的问题。[e1e6523](https://github.com/ant-design/ant-design/commit/e1e6523452286ba56f20b73abad762a58ea7d7bc)
## 3.6.6

View File

@@ -9,7 +9,7 @@
[![](https://img.shields.io/travis/ant-design/ant-design.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design)
[![Codecov](https://img.shields.io/codecov/c/github/ant-design/ant-design/master.svg?style=flat-square)](https://codecov.io/gh/ant-design/ant-design/branch/master)
[![Dependencies](https://img.shields.io/david/ant-design/ant-design.svg)](https://david-dm.org/ant-design/ant-design)
[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design.svg)](https://david-dm.org/ant-design/ant-design#info=devDependencies&view=list)
[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design.svg)](https://david-dm.org/ant-design/ant-design?type=dev)
[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
[![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](http://www.npmtrends.com/antd)
@@ -34,6 +34,10 @@
* 支持服务端渲染。
* [Electron](http://electron.atom.io/)
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Electron |
| --------- | --------- | --------- | --------- | --------- | --------- |
| IE9, IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions
## 参与共建 [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
请参考[贡献指南](https://ant.design/docs/react/contributing-cn).
@@ -94,7 +98,7 @@ $ npm install
$ npm start
```
打开浏览器访问 http://127.0.0.1:8001 ,更多本地开发文档参见: https://github.com/ant-design/ant-design/wiki/Development
打开浏览器访问 http://127.0.0.1:8001 ,更多[本地开发文档](https://github.com/ant-design/ant-design/wiki/Development)
## 如何贡献

View File

@@ -9,7 +9,7 @@
[![](https://img.shields.io/travis/ant-design/ant-design/master.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design)
[![Codecov](https://img.shields.io/codecov/c/github/ant-design/ant-design/master.svg?style=flat-square)](https://codecov.io/gh/ant-design/ant-design/branch/master)
[![Dependencies](https://img.shields.io/david/ant-design/ant-design.svg)](https://david-dm.org/ant-design/ant-design)
[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design.svg)](https://david-dm.org/ant-design/ant-design#info=devDependencies&view=list)
[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design.svg)](https://david-dm.org/ant-design/ant-design?type=dev)
[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
[![NPM downloads](http://img.shields.io/npm/dm/antd.svg?style=flat-square)](http://www.npmtrends.com/antd)
@@ -38,6 +38,10 @@ An enterprise-class UI design language and React-based implementation.
* Server-side Rendering
* [Electron](http://electron.atom.io/)
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Electron |
| --------- | --------- | --------- | --------- | --------- | --------- |
| IE9, IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions
## Let's build a better antd together [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
Read our [contributing guide](https://ant.design/docs/react/contributing).
@@ -67,7 +71,6 @@ Or [import components on demand](https://ant.design/docs/react/getting-started#I
See [Use in TypeScript](https://ant.design/docs/react/use-in-typescript)
## Internationalization
See [i18n](http://ant.design/docs/react/i18n).
@@ -98,7 +101,7 @@ $ npm install
$ npm start
```
Open your browser and visit http://127.0.0.1:8001 , see more at https://github.com/ant-design/ant-design/wiki/Development .
Open your browser and visit http://127.0.0.1:8001 , see more at [Development](https://github.com/ant-design/ant-design/wiki/Development).
## Contributing

View File

@@ -27,6 +27,14 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
this.context.antAnchor.registerLink(this.props.href);
}
componentWillReceiveProps(nextProps: AnchorLinkProps) {
const { href } = nextProps;
if (this.props.href !== href) {
this.context.antAnchor.unregisterLink(this.props.href);
this.context.antAnchor.registerLink(href);
}
}
componentWillUnmount() {
this.context.antAnchor.unregisterLink(this.props.href);
}

View File

@@ -90,4 +90,20 @@ describe('Anchor Render', () => {
wrapper.setProps({ children: null });
expect(wrapper.instance().links).toEqual([]);
});
it('should update links when link href update', async () => {
let anchorInstance = null;
function AnchorUpdate({ href }) {
return (
<Anchor ref={c => anchorInstance = c}>
<Link href={href} title="API" />
</Anchor>
);
}
const wrapper = mount(<AnchorUpdate href="#API" />);
expect(anchorInstance.links).toEqual(['#API']);
wrapper.setProps({ href: '#API_1' });
expect(anchorInstance.links).toEqual(['#API_1']);
});
});

View File

@@ -34,9 +34,9 @@ const dataSource = ['12345', '23456', '34567'];
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` |
| placeholder | 输入框提示 | string | - |
| value | 指定当前选中的条目 | string\|string\[]\|{ key: string, label: string\|ReactNode }\|Array&lt;{ key: string, label: string\|ReactNode }> | 无 |
| onBlur | 获取焦点时的回调 | function() | - |
| onBlur | 失去焦点时的回调 | function() | - |
| onChange | 选中 option或 input 的 value 变化时,调用此函数 | function(value) | 无 |
| onFocus | 失去焦点时的回调 | function() | - |
| onFocus | 获得焦点时的回调 | function() | - |
| onSearch | 搜索补全项的时候调用 | function(value) | 无 |
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 |

View File

@@ -3,7 +3,7 @@ import { createElement, Component } from 'react';
import omit from 'omit.js';
import classNames from 'classnames';
function getNumberArray(num: string | number | undefined) {
function getNumberArray(num: string | number | undefined | null) {
return num ?
num.toString()
.split('')
@@ -14,16 +14,16 @@ function getNumberArray(num: string | number | undefined) {
export interface ScrollNumberProps {
prefixCls?: string;
className?: string;
count?: string | number;
count?: string | number | null;
component?: string;
onAnimated?: Function;
style?: React.CSSProperties;
title?: string | number;
title?: string | number | null;
}
export interface ScrollNumberState {
animateStarted?: boolean;
count?: string | number;
count?: string | number | null;
}
export default class ScrollNumber extends Component<ScrollNumberProps, ScrollNumberState> {

View File

@@ -8,7 +8,7 @@ export { ScrollNumberProps } from './ScrollNumber';
export interface BadgeProps {
/** Number to show in badge */
count?: number | string;
count?: number | string | null;
showZero?: boolean;
/** Max count to show */
overflowCount?: number;

View File

@@ -109,7 +109,8 @@
.button-group-base(@btnClassName) {
position: relative;
display: inline-block;
> .@{btnClassName} {
> .@{btnClassName},
> span > .@{btnClassName} {
position: relative;
line-height: @btn-height-base - 2px;
@@ -126,13 +127,15 @@
}
// size
&-lg > .@{btnClassName} {
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; @btn-border-radius-base);
&-lg > .@{btnClassName},
&-lg > span > .@{btnClassName} {
.button-size(@btn-height-lg; @btn-padding-lg; @btn-font-size-lg; 0);
line-height: @btn-height-lg - 2px;
}
&-sm > .@{btnClassName} {
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; @btn-border-radius-sm);
&-sm > .@{btnClassName},
&-sm > span > .@{btnClassName} {
.button-size(@btn-height-sm; @btn-padding-sm; @font-size-base; 0);
line-height: @btn-height-sm - 2px;
> .@{iconfont-css-prefix} {
font-size: @font-size-base;
@@ -260,7 +263,7 @@
border-left-color: transparent;
}
.@{btnClassName}:not(:first-child):not(:last-child) {
.@{btnClassName} {
border-radius: 0;
}
@@ -268,17 +271,42 @@
> span:first-child > .@{btnClassName} {
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),
> span:first-child:not(:last-child) > .@{btnClassName} {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: @btn-border-radius-base;
border-top-left-radius: @btn-border-radius-base;
}
> .@{btnClassName}:last-child:not(:first-child),
> span:last-child:not(:first-child) > .@{btnClassName} {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
border-bottom-right-radius: @btn-border-radius-base;
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;
}
}
& > & {

View File

@@ -19,6 +19,7 @@ export type CardType = 'inner';
export interface CardTabListType {
key: string;
tab: React.ReactNode;
disabled?: boolean;
}
export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
@@ -225,7 +226,7 @@ export default class Card extends React.Component<CardProps, CardState> {
size="large"
onChange={this.onTabChange}
>
{tabList.map(item => <Tabs.TabPane tab={item.tab} key={item.key} />)}
{tabList.map(item => <Tabs.TabPane tab={item.tab} disabled={item.disabled} key={item.key} />)}
</Tabs>
) : null;
if (title || extra || tabs) {

View File

@@ -4,7 +4,7 @@ type: Data Entry
title: Checkbox
---
Checkbox.
Checkbox component.
## When To Use

View File

@@ -1,9 +1,11 @@
/* tslint:disable jsx-no-multiline-js */
import * as React from 'react';
import * as moment from 'moment';
import { polyfill } from 'react-lifecycles-compat';
import RangeCalendar from 'rc-calendar/lib/RangeCalendar';
import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames';
import shallowequal from 'shallowequal';
import Icon from '../icon';
import Tag from '../tag';
import warning from '../_util/warning';
@@ -63,13 +65,36 @@ function fixLocale(value: RangePickerValue | undefined, localeCode: string) {
}
}
export default class RangePicker extends React.Component<any, RangePickerState> {
class RangePicker extends React.Component<any, RangePickerState> {
static defaultProps = {
prefixCls: 'ant-calendar',
allowClear: true,
showToday: false,
};
static getDerivedStateFromProps(nextProps: any, prevState: any) {
let state = null;
if ('value' in nextProps) {
const value = nextProps.value || [];
state = {
value,
};
if (!shallowequal(nextProps.value, prevState.value)) {
state = {
...state,
showDate: getShowDateFromValue(value) || prevState.showDate,
};
}
}
if (('open' in nextProps) && prevState.open !== nextProps.open) {
state = {
...state,
open: nextProps.open,
};
}
return state;
}
private picker: HTMLSpanElement;
constructor(props: any) {
@@ -93,22 +118,6 @@ export default class RangePicker extends React.Component<any, RangePickerState>
};
}
componentWillReceiveProps(nextProps: any) {
if ('value' in nextProps) {
const state = this.state;
const value = nextProps.value || [];
this.setState({
value,
showDate: getShowDateFromValue(value) || state.showDate,
});
}
if ('open' in nextProps) {
this.setState({
open: nextProps.open,
});
}
}
clearSelection = (e: React.MouseEvent<HTMLElement>) => {
e.preventDefault();
e.stopPropagation();
@@ -366,3 +375,7 @@ export default class RangePicker extends React.Component<any, RangePickerState>
);
}
}
polyfill(RangePicker);
export default RangePicker;

View File

@@ -1,5 +1,6 @@
import * as React from 'react';
import * as moment from 'moment';
import { polyfill } from 'react-lifecycles-compat';
import Calendar from 'rc-calendar';
import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames';
@@ -10,12 +11,19 @@ function formatValue(value: moment.Moment | null, format: string): string {
return (value && value.format(format)) || '';
}
export default class WeekPicker extends React.Component<any, any> {
class WeekPicker extends React.Component<any, any> {
static defaultProps = {
format: 'gggg-wo',
allowClear: true,
};
static getDerivedStateFromProps(nextProps: any) {
if ('value' in nextProps) {
return { value: nextProps.value };
}
return null;
}
private input: any;
constructor(props: any) {
@@ -31,11 +39,6 @@ export default class WeekPicker extends React.Component<any, any> {
value,
};
}
componentWillReceiveProps(nextProps: any) {
if ('value' in nextProps) {
this.setState({ value: nextProps.value });
}
}
weekDateRender = (current: any) => {
const selectedValue = this.state.value;
const { prefixCls } = this.props;
@@ -149,3 +152,7 @@ export default class WeekPicker extends React.Component<any, any> {
);
}
}
polyfill(WeekPicker);
export default WeekPicker;

View File

@@ -165,4 +165,15 @@ describe('DatePicker', () => {
const input = wrapper.find('.ant-calendar-picker-input').getDOMNode();
expect(input.getAttribute('role')).toBe('search');
});
it('changes year/month when under control', () => {
const wrapper = mount(
<DatePicker value={moment('2018-07-01')} />
);
openPanel(wrapper);
expect(wrapper.find('.ant-calendar-my-select').text()).toBe('Jul2018');
wrapper.find('.ant-calendar-prev-year-btn').simulate('click');
wrapper.find('.ant-calendar-prev-month-btn').simulate('click');
expect(wrapper.find('.ant-calendar-my-select').text()).toBe('Jun2017');
});
});

View File

@@ -3,7 +3,7 @@ import { mount, render } from 'enzyme';
import moment from 'moment';
import DatePicker from '..';
import { setMockDate, resetMockDate } from '../../../tests/utils';
import { selectDate } from './utils';
import { selectDate, openPanel } from './utils';
import focusTest from '../../../tests/shared/focusTest';
const { RangePicker } = DatePicker;
@@ -215,4 +215,13 @@ describe('RangePicker', () => {
wrapper.find('.ant-calendar-input').at(1).simulate('change', { target: { value: '2016-01-01' } })
)).not.toThrow();
});
it('changes year/month when under control', () => {
const wrapper = mount(<RangePicker value={[moment('2018-07-01'), moment('2018-07-02')]} />);
openPanel(wrapper);
expect(wrapper.find('.ant-calendar-my-select').first().text()).toBe('Jul2018');
wrapper.find('.ant-calendar-prev-year-btn').first().simulate('click');
wrapper.find('.ant-calendar-prev-month-btn').first().simulate('click');
expect(wrapper.find('.ant-calendar-my-select').first().text()).toBe('Jun2017');
});
});

View File

@@ -1,5 +1,6 @@
import * as React from 'react';
import * as moment from 'moment';
import { polyfill } from 'react-lifecycles-compat';
import MonthCalendar from 'rc-calendar/lib/MonthCalendar';
import RcDatePicker from 'rc-calendar/lib/Picker';
import classNames from 'classnames';
@@ -15,13 +16,29 @@ export interface PickerProps {
}
export default function createPicker(TheCalendar: React.ComponentClass): any {
return class CalenderWrapper extends React.Component<any, any> {
class CalenderWrapper extends React.Component<any, any> {
static defaultProps = {
prefixCls: 'ant-calendar',
allowClear: true,
showToday: true,
};
static getDerivedStateFromProps(nextProps: PickerProps, prevState: any) {
let state = null;
if ('value' in nextProps) {
state = {
value: nextProps.value,
};
if (nextProps.value !== prevState.value) {
state = {
...state,
showDate: nextProps.value,
};
}
}
return state;
}
private input: any;
constructor(props: any) {
@@ -39,15 +56,6 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
};
}
componentWillReceiveProps(nextProps: PickerProps) {
if ('value' in nextProps) {
this.setState({
value: nextProps.value,
showDate: nextProps.value,
});
}
}
renderFooter = (...args: any[]) => {
const { prefixCls, renderExtraFooter } = this.props;
return renderExtraFooter ? (
@@ -195,5 +203,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any {
</span>
);
}
};
}
polyfill(CalenderWrapper);
return CalenderWrapper;
}

View File

@@ -81,7 +81,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" |
| renderExtraFooter | render extra footer in panel | () => React.ReactNode | - |
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
| showTime.defaultValue | to set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
| showToday | whether to show "Today" button | boolean | true |
| value | to set date | [moment](http://momentjs.com/) | - |
| onCalendarChange | a callback function, can be executed when the start time or the end time of the range is changing | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
@@ -118,7 +118,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke
| ranges | preseted ranges for quick selection | { \[range: string]: [moment](http://momentjs.com/)\[] } \| () => { \[range: string]: [moment](http://momentjs.com/)\[] } | - |
| renderExtraFooter | render extra footer in panel | () => React.ReactNode | - |
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] |
| showTime.defaultValue | to set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] |
| value | to set date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - |
| onChange | a callback function, can be executed when the selected time is changing | function(dates: [moment, moment], dateStrings: [string, string]) | - |
| onOk | callback when click ok button | function() | - |

View File

@@ -37,7 +37,7 @@ import locale from 'antd/lib/date-picker/locale/zh_CN';
```jsx
// 默认语言为 en-US如果你需要设置其他语言推荐在入口文件全局设置 locale
import moment from 'moment';
mport 'moment/locale/zh-cn';
import 'moment/locale/zh-cn';
<DatePicker defaultValue={moment('2015-01-01', 'YYYY-MM-DD')} />
```
@@ -81,7 +81,7 @@ mport 'moment/locale/zh-cn';
| mode | 日期面板的状态 | `time|date|month|year` | 'date' |
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - |
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() |
| showToday | 是否展示“今天”按钮 | boolean | true |
| value | 日期 | [moment](http://momentjs.com/) | 无 |
| onChange | 时间发生变化的回调 | function(date: moment, dateString: string) | 无 |
@@ -118,7 +118,7 @@ mport 'moment/locale/zh-cn';
| ranges       | 预设时间范围快捷选择 | { \[range: string]: [moment](http://momentjs.com/)\[] } \| () => { \[range: string]: [moment](http://momentjs.com/)\[] } | 无 |
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - |
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] |
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] |
| value | 日期 | [moment](http://momentjs.com/)\[] | 无 |
| onCalendarChange | 待选日期发生变化的回调 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |
| onChange | 日期范围发生变化的回调 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 |

View File

@@ -50,7 +50,6 @@
&-horizontal&-with-text-left,
&-horizontal&-with-text-right {
font-size: @font-size-base;
.@{divider-prefix-cls}-inner-text {
display: inline-block;
padding: 0 10px;

View File

@@ -1,10 +1,10 @@
import React from 'react';
import { mount } from 'enzyme';
import { render } from 'enzyme';
import Drawer from '..';
describe('Drawer', () => {
it('render correctly', () => {
const wrapper = mount(
const wrapper = render(
<Drawer
visible
width={400}
@@ -13,11 +13,11 @@ describe('Drawer', () => {
Here is content of Drawer
</Drawer>
);
expect(wrapper.render()).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
it('have a title', () => {
const wrapper = mount(
const wrapper = render(
<Drawer
visible
title="Test Title"
@@ -26,11 +26,11 @@ describe('Drawer', () => {
Here is content of Drawer
</Drawer>
);
expect(wrapper.render()).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
it('closable is false', () => {
const wrapper = mount(
const wrapper = render(
<Drawer
visible
closable={false}
@@ -39,11 +39,11 @@ describe('Drawer', () => {
Here is content of Drawer
</Drawer>
);
expect(wrapper.render()).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
it('destroyOnClose is true', () => {
const wrapper = mount(
const wrapper = render(
<Drawer
destroyOnClose
visible={false}
@@ -52,6 +52,20 @@ describe('Drawer', () => {
Here is content of 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();
});
});

View File

@@ -33,7 +33,6 @@ class DrawerEventTester extends React.Component {
<Drawer
visible={visible}
onClose={this.onClose}
destroyOnClose
getContainer={false}
{...this.props}
>
@@ -88,4 +87,26 @@ describe('Drawer', () => {
wrapper.find('.ant-drawer-mask').simulate('click');
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);
});
});

View 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);
});
});

View File

@@ -5,19 +5,21 @@ exports[`Drawer closable is false 1`] = `
class=""
>
<div
class="ant-drawer ant-drawer-right ant-drawer-open"
class="ant-drawer ant-drawer-right"
>
<div
class="ant-drawer-mask"
/>
<div
class="ant-drawer-content-wrapper"
style="transform:translateX(100%);width:256px"
>
<div
class="ant-drawer-content"
>
<div
style="overflow: auto; height: 100%; width: 256px;"
class="ant-drawer-wrapper-body"
style="overflow:auto;height:100%"
>
<div
class="ant-drawer-body"
@@ -43,10 +45,30 @@ exports[`Drawer destroyOnClose is true 1`] = `
/>
<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
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>
@@ -57,19 +79,21 @@ exports[`Drawer have a title 1`] = `
class=""
>
<div
class="ant-drawer ant-drawer-right ant-drawer-open"
class="ant-drawer ant-drawer-right"
>
<div
class="ant-drawer-mask"
/>
<div
class="ant-drawer-content-wrapper"
style="transform:translateX(100%);width:256px"
>
<div
class="ant-drawer-content"
>
<div
style="overflow: auto; height: 100%; width: 256px;"
class="ant-drawer-wrapper-body"
style="overflow:auto;height:100%"
>
<div
class="ant-drawer-header"
@@ -105,19 +129,62 @@ exports[`Drawer render correctly 1`] = `
class=""
>
<div
class="ant-drawer ant-drawer-right ant-drawer-open"
class="ant-drawer ant-drawer-right"
>
<div
class="ant-drawer-mask"
/>
<div
class="ant-drawer-content-wrapper"
style="transform:translateX(100%);width:400px"
>
<div
class="ant-drawer-content"
>
<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
aria-label="Close"

View File

@@ -21,12 +21,14 @@ exports[`Drawer render correctly 1`] = `
/>
<div
class="ant-drawer-content-wrapper"
style="width: 256px;"
>
<div
class="ant-drawer-content"
>
<div
style="overflow: auto; height: 100%; width: 256px;"
class="ant-drawer-wrapper-body"
style="overflow: auto; height: 100%;"
>
<button
aria-label="Close"

View File

@@ -52,16 +52,16 @@ class App extends React.Component {
<Drawer
title="Multi-level drawer"
width={520}
wrapClassName="test_drawer"
closable={false}
onClose={this.onClose}
visible={this.state.visible}
push={this.state.childrenDrawer}
>
<Button type="primary" onClick={this.showChildrenDrawer}>
Two-level drawer
</Button>
<Drawer
title="Food"
title="Two-level Drawer"
width={320}
closable={false}
onClose={this.onChildrenDrawerClose}

View File

@@ -2,7 +2,6 @@ import * as React from 'react';
import RcDrawer from 'rc-drawer';
import PropTypes from 'prop-types';
import createReactContext, { Context } from 'create-react-context';
import isNumeric from '../_util/isNumeric';
const DrawerContext: Context<Drawer | null> = createReactContext(null);
@@ -73,6 +72,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
};
praentDrawer: Drawer;
destoryClose: boolean;
public componentDidUpdate(preProps: DrawerProps) {
if (preProps.visible !== this.props.visible && this.praentDrawer) {
if (this.props.visible) {
@@ -106,11 +106,38 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
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 = () => {
const { destroyOnClose, visible, width, placement } = this.props;
if (destroyOnClose && !visible) {
if (this.destoryClose && !this.props.visible) {
return null;
}
this.destoryClose = false;
const { placement } = this.props;
const containerStyle: React.CSSProperties = placement === 'left'
|| placement === 'right' ? {
overflow: 'auto',
height: '100%',
} : {};
const isDestroyOnClose = this.getDestoryOnClose();
if (isDestroyOnClose) {
// Increase the opacity transition, delete children after closing.
containerStyle.opacity = 0;
containerStyle.transition = 'opacity .3s';
}
const { prefixCls, title, closable } = this.props;
let header;
if (title) {
@@ -132,16 +159,13 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
</button>
);
}
let containerStyle: React.CSSProperties = { width };
if (placement === 'left' || placement === 'right') {
containerStyle = {
overflow: 'auto',
height: '100%',
width,
};
}
return (
<div style={containerStyle}>
<div
className={`${prefixCls}-wrapper-body`}
style={containerStyle}
onTransitionEnd={this.onDestoryTransitionEnd}
>
{header}
{closer}
<div className={`${prefixCls}-body`} style={this.props.style}>
@@ -151,15 +175,12 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
);
}
renderProvider = (value: Drawer) => {
let { width, zIndex, style, placement, ...rest } = this.props;
if (isNumeric(width)) {
width = `${width}px`;
}
let { zIndex, style, placement, ...rest } = this.props;
const RcDrawerStyle = this.state.push
? {
zIndex,
transform: `translateX(${placement === 'left' ? 180 : -180}px)`,
}
zIndex,
transform: `translateX(${placement === 'left' ? 180 : -180}px)`,
}
: { zIndex };
this.praentDrawer = value;
return (
@@ -172,6 +193,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
showMask={this.props.mask}
placement={placement}
style={RcDrawerStyle}
className={this.props.wrapClassName}
>
{this.renderBody()}
</RcDrawer>

View File

@@ -8,10 +8,10 @@
width: 100%;
height: 100%;
pointer-events: none;
z-index: 99999;
transition: transform .3s @ease-in-out-circ;
>* {
transition: transform .3s @ease-in-out-circ;
z-index: @zindex-modal;
transition: transform 0.3s @ease-in-out-circ;
> * {
transition: transform 0.3s @ease-in-out-circ;
}
&-content-wrapper {
@@ -27,10 +27,8 @@
}
&-left {
&.@{dawer-prefix-cls}-open {
.@{dawer-prefix-cls} {
&-wrapper {
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}
.@{dawer-prefix-cls}-content-wrapper {
box-shadow: @shadow-1-right;
}
}
}
@@ -41,10 +39,8 @@
}
}
&.@{dawer-prefix-cls}-open {
& .@{dawer-prefix-cls} {
&-wrapper {
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
}
.@{dawer-prefix-cls}-content-wrapper {
box-shadow: @shadow-1-left;
}
}
}
@@ -140,7 +136,7 @@
opacity: 0;
background-color: @modal-mask-bg;
height: 100%;
transition: opacity .3s @ease-in-out-circ;
transition: opacity 0.3s @ease-in-out-circ;
filter: ~"alpha(opacity=50)";
}
@@ -151,4 +147,3 @@
}
}
}

View File

@@ -236,8 +236,13 @@ form {
margin-left: 0;
}
.@{ant-prefix}-input-number + .@{form-prefix-cls}-text {
margin-left: 8px;
.@{ant-prefix}-input-number {
+ .@{form-prefix-cls}-text {
margin-left: 8px;
}
&-handler-wrap {
z-index: 2; // https://github.com/ant-design/ant-design/issues/6289
}
}
.@{ant-prefix}-select,

View File

@@ -109,7 +109,6 @@
opacity: 0;
border-radius: 0 @border-radius-base @border-radius-base 0;
transition: opacity 0.24s linear 0.1s;
z-index: 2; // https://github.com/ant-design/ant-design/issues/6289
}
&-handler-wrap:hover &-handler {

View File

@@ -19,6 +19,7 @@ import classNames from 'classnames';
import omit from 'omit.js';
import PropTypes from 'prop-types';
import Icon from '../icon';
import isNumeric from '../_util/isNumeric';
const dimensionMap = {
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> {
static __ANT_LAYOUT_SIDER: any = true;

View File

@@ -100,7 +100,6 @@ title: Layout
| trigger | 自定义 trigger设置为 null 时隐藏 trigger | string\|ReactNode | - |
| width | 宽度 | number\|string | 200 |
| onCollapse | 展开-收起时的回调函数,有点击 trigger 以及响应式反馈两种方式可以触发 | (collapsed, type) => {} | - |
| theme | 主题颜色 | string: `light` `dark` | `dark` |
| onBreakpoint | 触发响应式布局[断点](/components/grid#api)时的回调 | (broken) => {} | - |
#### breakpoint width

View File

@@ -10,20 +10,21 @@ export interface MentionProps {
prefixCls?: string;
suggestionStyle?: React.CSSProperties;
suggestions?: Array<any>;
onSearchChange?: Function;
onChange?: Function;
onSearchChange?: (value: string, trigger: string) => any;
onChange?: (contentState: any) => any;
notFoundContent?: any;
loading?: Boolean;
loading?: boolean;
style?: React.CSSProperties;
defaultValue?: any;
value?: any;
className?: string;
multiLines?: Boolean;
prefix?: string;
multiLines?: boolean;
prefix?: string | string[];
placeholder?: string;
getSuggestionContainer?: (triggerNode: Element) => HTMLElement;
onFocus?: React.FocusEventHandler<HTMLElement>;
onBlur?: React.FocusEventHandler<HTMLElement>;
onSelect?: (suggestion: string, data?: any) => any;
readOnly?: boolean;
disabled?: boolean;
placement?: MentionPlacement;

View File

@@ -33,9 +33,7 @@ exports[`renders ./components/menu/demo/horizontal.md correctly 1`] = `
aria-haspopup="true"
class="ant-menu-submenu-title"
>
<span
class="submenu-title-wrapper"
>
<span>
<i
class="anticon anticon-setting"
/>

View File

@@ -85,7 +85,6 @@ describe('Menu', () => {
wrapper.update();
expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).toBe(true);
wrapper.setProps({ openKeys: ['1'] });
wrapper.update();
expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).not.toBe(true);
});
@@ -104,7 +103,6 @@ describe('Menu', () => {
wrapper.update();
expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).toBe(true);
wrapper.setProps({ openKeys: ['1'] });
wrapper.update();
expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).not.toBe(true);
});
@@ -123,7 +121,6 @@ describe('Menu', () => {
wrapper.update();
expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).toBe(true);
wrapper.setProps({ openKeys: ['1'] });
wrapper.update();
expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).not.toBe(true);
});

View File

@@ -44,7 +44,7 @@ class App extends React.Component {
<Menu.Item key="app" disabled>
<Icon type="appstore" />Navigation Two
</Menu.Item>
<SubMenu title={<span className="submenu-title-wrapper"><Icon type="setting" />Navigation Three - Submenu</span>}>
<SubMenu title={<span><Icon type="setting" />Navigation Three - Submenu</span>}>
<MenuItemGroup title="Item 1">
<Menu.Item key="setting:1">Option 1</Menu.Item>
<Menu.Item key="setting:2">Option 2</Menu.Item>

View File

@@ -24,13 +24,15 @@
}
&-dark&-horizontal {
border-bottom-color: @menu-dark-bg;
border-bottom: 0;
}
&-dark&-horizontal > &-item,
&-dark&-horizontal > &-submenu {
border-color: @menu-dark-bg;
border-bottom: 0;
top: 0;
margin-top: 0;
}
&-dark&-horizontal > &-item > a:before {

View File

@@ -179,10 +179,6 @@
position: absolute;
border-radius: @border-radius-base;
z-index: @zindex-dropdown;
.submenu-title-wrapper {
padding-right: 20px;
}
}
> .@{menu-prefix-cls} {
@@ -266,13 +262,12 @@
border-bottom: @border-width-base @border-style-base @border-color-split;
box-shadow: none;
line-height: 46px;
white-space: nowrap;
> .@{menu-prefix-cls}-item,
> .@{menu-prefix-cls}-submenu {
position: relative;
top: 1px;
display: inline-block;
float: left;
border-bottom: 2px solid transparent;
&:hover,

View File

@@ -21,7 +21,7 @@
}
&-notice-content {
padding: 10px 16px;
padding: @message-notice-content-padding;
border-radius: @border-radius-base;
box-shadow: @shadow-2;
background: @component-background;

View File

@@ -24,7 +24,7 @@
color: @heading-color;
font-weight: 500;
font-size: @font-size-lg;
line-height: 22px;
line-height: 1.4;
display: block;
// create BFC to avoid
// https://user-images.githubusercontent.com/507615/37702510-ba844e06-2d2d-11e8-9b67-8e19be57f445.png

View File

@@ -24,6 +24,7 @@ used in the following cases:
- `notification.info(config)`
- `notification.warning(config)`
- `notification.warn(config)`
- `notification.open(config)`
- `notification.close(key: String)`
- `notification.destroy()`

View File

@@ -23,6 +23,7 @@ subtitle: 通知提醒框
- `notification.info(config)`
- `notification.warning(config)`
- `notification.warn(config)`
- `notification.open(config)`
- `notification.close(key: String)`
- `notification.destroy()`

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import shallowEqual from 'shallowequal';
import Radio from './radio';
import { RadioGroupProps, RadioGroupState, RadioChangeEvent } from './interface';
import { RadioGroupProps, RadioGroupState, RadioChangeEvent, RadioGroupButtonStyle } from './interface';
function getCheckedValue(children: React.ReactNode) {
let value = null;
@@ -21,7 +21,7 @@ export default class RadioGroup extends React.Component<RadioGroupProps, RadioGr
static defaultProps = {
disabled: false,
prefixCls: 'ant-radio',
buttonStyle: 'outline',
buttonStyle: 'outline' as RadioGroupButtonStyle,
};
static childContextTypes = {

View File

@@ -2,6 +2,8 @@ import * as React from 'react';
import { AbstractCheckboxGroupProps } from '../checkbox/Group';
import { AbstractCheckboxProps } from '../checkbox/Checkbox';
export type RadioGroupButtonStyle = 'outline' | 'solid';
export interface RadioGroupProps extends AbstractCheckboxGroupProps {
defaultValue?: any;
value?: any;
@@ -12,7 +14,7 @@ export interface RadioGroupProps extends AbstractCheckboxGroupProps {
name?: string;
children?: React.ReactNode;
id?: string;
buttonStyle?: 'outline' | 'solid';
buttonStyle?: RadioGroupButtonStyle;
}
export interface RadioGroupState {

View File

@@ -407,16 +407,11 @@ exports[`renders ./components/select/demo/search-box.md correctly 1`] = `
>
<div
class="ant-select-selection__placeholder"
style="display:none;user-select:none;-webkit-user-select:none"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="on"
>
input search text
</div>
<div
class="ant-select-selection-selected-value"
style="display:block;opacity:1"
title=""
/>
<div
class="ant-select-search ant-select-search--inline"
style="display:none"

View File

@@ -58,7 +58,7 @@ function fetch(value, callback) {
class SearchInput extends React.Component {
state = {
data: [],
value: '',
value: undefined,
}
handleSearch = (value) => {

View File

@@ -26,7 +26,7 @@ Select component to select value from options.
| allowClear | Show clear button. | boolean | false |
| autoFocus | Get focus by default | boolean | false |
| 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 |
| dropdownClassName | className of dropdown menu | string | - |
| dropdownMatchSelectWidth | Whether dropdown's width is same with select. | boolean | true |

View File

@@ -49,6 +49,8 @@ export interface SelectProps extends AbstractSelectProps {
onFocus?: () => any;
onPopupScroll?: () => any;
onInputKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
onMouseEnter?: (e: React.MouseEvent<HTMLInputElement>) => any;
onMouseLeave?: (e: React.MouseEvent<HTMLInputElement>) => any;
maxTagCount?: number;
maxTagPlaceholder?: React.ReactNode | ((omittedValues: SelectValue[]) => React.ReactNode);
optionFilterProp?: string;

View File

@@ -27,7 +27,7 @@ title: Select
| allowClear | 支持清除 | boolean | false |
| autoFocus | 默认获取焦点 | boolean | false |
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true |
| defaultValue | 指定默认选中的条目 | string\|string\[]\|number\|number\[] | - |
| defaultValue | 指定默认选中的条目 | string\|string\[]<br />number\|number\[] | - |
| disabled | 是否禁用 | boolean | false |
| dropdownClassName | 下拉菜单的 className 属性 | string | - |
| dropdownMatchSelectWidth | 下拉菜单和选择器同宽 | boolean | true |

View File

@@ -38,6 +38,7 @@
.reset-component;
display: inline-block;
position: relative;
outline: 0;
ul,
ol {
@@ -480,6 +481,11 @@
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 {
position: relative;
display: block;

View File

@@ -482,4 +482,8 @@
@collapse-content-padding: @padding-md;
@collapse-content-bg: @component-background;
// Message
// ---
@message-notice-content-padding: 10px 16px;
@import "./default.deperated.less";

View File

@@ -104,23 +104,16 @@
}
&-small&-checked {
&:before,
&:after {
&:before {
left: 100%;
margin-left: @switch-sm-checked-margin-left;
}
.@{switch-prefix-cls}-inner {
margin-left: 3px;
margin-right: 18px;
}
}
&-small:active&-checked:before,
&-small:active&-checked:after {
margin-left: -16.5px;
}
&-small&-loading:before {
animation: AntSwitchSmallLoadingCircle 1s infinite linear;
font-weight: bold;
@@ -134,15 +127,15 @@
margin-right: 24px;
}
&:before,
&:after {
&:before {
left: 100%;
margin-left: -19px;
}
&:active:before,
&:active:after {
margin-left: -25px;
&:after {
left: 100%;
transform: translateX(-100%);
margin-left: -1px;
}
}

View File

@@ -626,7 +626,8 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
const recordKey = (typeof rowKey === 'function') ?
rowKey(record, index) : (record as any)[rowKey as string];
warning(recordKey !== undefined,
'Each record in dataSource of table should have a unique `key` prop, or set `rowKey` to an unique primary key,' +
'Each record in dataSource of table should have a unique `key` prop, ' +
'or set `rowKey` of Table to an unique primary key, ' +
'see https://u.ant.design/table-row-key',
);
return recordKey === undefined ? index : recordKey;

View File

@@ -223,6 +223,16 @@ describe('Table.filter', () => {
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', () => {
const filters = [
{ text: 'Upper', value: 'Upper' },

View File

@@ -109,6 +109,7 @@ exports[`Table.filter renders filter correctly 1`] = `
>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="0"
>
<td
class="ant-table-column-has-filters"
@@ -122,6 +123,7 @@ exports[`Table.filter renders filter correctly 1`] = `
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="1"
>
<td
class="ant-table-column-has-filters"
@@ -135,6 +137,7 @@ exports[`Table.filter renders filter correctly 1`] = `
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="2"
>
<td
class="ant-table-column-has-filters"
@@ -148,6 +151,7 @@ exports[`Table.filter renders filter correctly 1`] = `
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="3"
>
<td
class="ant-table-column-has-filters"

View File

@@ -43,6 +43,7 @@ exports[`Table.pagination renders pagination correctly 1`] = `
>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="0"
>
<td
class=""
@@ -56,6 +57,7 @@ exports[`Table.pagination renders pagination correctly 1`] = `
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="1"
>
<td
class=""

View File

@@ -72,6 +72,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="0"
>
<td
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
class="ant-table-row ant-table-row-level-0"
data-row-key="1"
>
<td
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
class="ant-table-row ant-table-row-level-0"
data-row-key="2"
>
<td
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
class="ant-table-row ant-table-row-level-0"
data-row-key="3"
>
<td
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
class="ant-table-row ant-table-row-level-0"
data-row-key="0"
>
<td
class="ant-table-selection-column"
@@ -287,6 +292,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="1"
>
<td
class="ant-table-selection-column"
@@ -312,6 +318,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="2"
>
<td
class="ant-table-selection-column"
@@ -337,6 +344,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="3"
>
<td
class="ant-table-selection-column"

View File

@@ -70,6 +70,7 @@ exports[`Table renders JSX correctly 1`] = `
>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="1"
>
<td
class=""
@@ -93,6 +94,7 @@ exports[`Table renders JSX correctly 1`] = `
</tr>
<tr
class="ant-table-row ant-table-row-level-0"
data-row-key="2"
>
<td
class=""

File diff suppressed because it is too large Load Diff

View File

@@ -162,7 +162,7 @@ class EditableTable extends React.Component {
});
this.setState({ data: newData, editingKey: '' });
} else {
newData.push(data);
newData.push(row);
this.setState({ data: newData, editingKey: '' });
}
});

View File

@@ -108,8 +108,10 @@ export default class FilterMenu<T> extends React.Component<FilterMenuProps<T>, F
}
confirmFilter() {
if (this.state.selectedKeys !== this.props.selectedKeys) {
this.props.confirmFilter(this.props.column, this.state.selectedKeys);
const { selectedKeys } = this.state;
if (!shallowequal(selectedKeys, this.props.selectedKeys)) {
this.props.confirmFilter(this.props.column, selectedKeys);
}
}

View File

@@ -160,7 +160,7 @@ const columns = [{
| selectedRowKeys | 指定选中项的 key 数组,需要和 onChange 进行配合 | string\[] | \[] |
| selections | 自定义选择项 [配置项](#selection), 设为 `true` 时使用默认选择项 | object\[]\|boolean | true |
| type | 多选/单选,`checkbox` or `radio` | string | `checkbox` |
| onChange | 选中项发生变化时的回调 | Function(selectedRowKeys, selectedRows) | - |
| onChange | 选中项发生变化时的回调 | Function(selectedRowKeys, selectedRows) | - |
| onSelect | 用户手动选择/取消选择某列的回调 | Function(record, selected, selectedRows, nativeEvent) | - |
| onSelectAll | 用户手动选择/取消选择所有列的回调 | Function(selected, selectedRows, changeRows) | - |
| onSelectInvert | 用户手动选择反选的回调 | Function(selectedRows) | - |

View File

@@ -106,7 +106,7 @@ export interface TableProps<T> {
onExpandedRowsChange?: (expandedRowKeys: string[] | number[]) => void;
onExpand?: (expanded: boolean, record: T) => void;
onChange?: (
pagination: PaginationConfig | boolean,
pagination: PaginationConfig,
filters: Record<keyof T, string[]>,
sorter: SorterResult<T>,
) => void;

View File

@@ -47,6 +47,7 @@
border-radius: @border-radius-base;
box-shadow: @box-shadow-base;
min-height: 32px;
word-break: break-all;
}
// Arrows

View File

@@ -4,7 +4,11 @@ import { AbstractSelectProps } from '../select';
export interface TreeData {
key: string;
value: string;
label: React.ReactNode;
/**
* @deprecated Please use `title` instead.
*/
label?: React.ReactNode;
title?: React.ReactNode;
children?: TreeData[];
}

View File

@@ -158,6 +158,7 @@ export default class DirectoryTree extends React.Component<DirectoryTreeProps, D
expandFolderNode = (event: React.MouseEvent<HTMLElement>, node: AntTreeNode) => {
const { expandedKeys = [] } = this.state;
const { onExpand } = this.props;
const { eventKey = '', expanded, isLeaf } = node.props;
if (isLeaf || event.shiftKey || event.metaKey || event.ctrlKey) {
@@ -176,6 +177,14 @@ export default class DirectoryTree extends React.Component<DirectoryTreeProps, D
this.setUncontrolledState({
expandedKeys: newExpandedKeys,
});
if (onExpand) {
onExpand(newExpandedKeys, {
expanded: !expanded,
node,
nativeEvent: event.nativeEvent,
});
}
}
setUncontrolledState = (state: DirectoryTreeState) => {

View File

@@ -664,6 +664,132 @@ exports[`Directory Tree expand double click 2`] = `
</ul>
`;
exports[`Directory Tree expand with state control click 1`] = `
<ul
class="ant-tree ant-tree-directory"
role="tree-node"
unselectable="on"
>
<li
class="ant-tree-treenode-switcher-open ant-tree-treenode-selected"
>
<span
class="ant-tree-switcher ant-tree-switcher_open"
/>
<span
class="ant-tree-node-content-wrapper ant-tree-node-content-wrapper-open ant-tree-node-selected"
title="parent"
>
<span
class="ant-tree-iconEle ant-tree-icon__customize"
>
<i
class="anticon anticon-folder-open"
/>
</span>
<span
class="ant-tree-title"
>
parent
</span>
</span>
<ul
class="ant-tree-child-tree ant-tree-child-tree-open"
data-expanded="true"
style=""
>
<li
class="ant-tree-treenode-switcher-close"
>
<span
class="ant-tree-switcher ant-tree-switcher-noop"
/>
<span
class="ant-tree-node-content-wrapper ant-tree-node-content-wrapper-normal"
title="children"
>
<span
class="ant-tree-iconEle ant-tree-icon__customize"
>
<i
class="anticon anticon-folder"
/>
</span>
<span
class="ant-tree-title"
>
children
</span>
</span>
</li>
</ul>
</li>
</ul>
`;
exports[`Directory Tree expand with state control doubleClick 1`] = `
<ul
class="ant-tree ant-tree-directory"
role="tree-node"
unselectable="on"
>
<li
class="ant-tree-treenode-switcher-open"
>
<span
class="ant-tree-switcher ant-tree-switcher_open"
/>
<span
class="ant-tree-node-content-wrapper ant-tree-node-content-wrapper-open"
title="parent"
>
<span
class="ant-tree-iconEle ant-tree-icon__customize"
>
<i
class="anticon anticon-folder-open"
/>
</span>
<span
class="ant-tree-title"
>
parent
</span>
</span>
<ul
class="ant-tree-child-tree ant-tree-child-tree-open"
data-expanded="true"
style=""
>
<li
class="ant-tree-treenode-switcher-close"
>
<span
class="ant-tree-switcher ant-tree-switcher-noop"
/>
<span
class="ant-tree-node-content-wrapper ant-tree-node-content-wrapper-normal"
title="children"
>
<span
class="ant-tree-iconEle ant-tree-icon__customize"
>
<i
class="anticon anticon-folder"
/>
</span>
<span
class="ant-tree-title"
>
children
</span>
</span>
</li>
</ul>
</li>
</ul>
`;
exports[`Directory Tree expandedKeys update 1`] = `
<ul
class="ant-tree ant-tree-directory"

View File

@@ -49,6 +49,42 @@ describe('Directory Tree', () => {
wrapper.find(TreeNode).find('.ant-tree-node-content-wrapper').at(0).simulate('doubleClick');
expect(wrapper.render()).toMatchSnapshot();
});
describe('with state control', () => {
class StateDirTree extends React.Component {
state = {
expandedKeys: [],
};
onExpand = (expandedKeys) => {
this.setState({ expandedKeys });
};
render() {
const { expandedKeys } = this.state;
return (
<DirectoryTree expandedKeys={expandedKeys} onExpand={this.onExpand} {...this.props}>
<TreeNode key="0-0" title="parent">
<TreeNode key="0-0-0" title="children" />
</TreeNode>
</DirectoryTree>
);
}
}
['click', 'doubleClick'].forEach((action) => {
it(action, () => {
const wrapper = mount(
<StateDirTree expandAction={action} />
);
wrapper.find(TreeNode).find('.ant-tree-node-content-wrapper').at(0).simulate(action);
jest.runAllTimers();
expect(wrapper.render()).toMatchSnapshot();
});
});
});
});
it('defaultExpandAll', () => {

View File

@@ -4,7 +4,7 @@ order: 1
title: Design Values
---
Ant Design provides a practical evaluation of better design for both designers of Ant Design and designers who are using it. At the same time, it build a foundation for design principles and design patterns which could provide guideline and general solutions for specified design goal.
Ant Design provides a practical evaluation of better design for both designers of Ant Design and designers who are using it. At the same time, it builds a foundation for design principles and design patterns which could provide guideline and general solutions for specified design goal.
<div>
<img src="https://gw.alipayobjects.com/zos/rmsportal/kEwBspjVFChYqhqafCiW.png" />

View File

@@ -7,7 +7,7 @@ title:
可视化语言是基于中台设计语言 Ant Design 衍生的一套具有数据可视化特性的设计指导原则,让数据表达更符合用户心理,帮助『设计者』孵化出更具业务特性的可视化解决方案以满足个性化设计需求,屏蔽不必要的设计差异和实现成本,从而解放『设计者』和前端的研发资源,实现全面提高数据图表的研发效率。
同时,这是一份动态更新的设计文档,你的阅读和反馈正是我们不断前进的动力,[Github 反馈地址](https://github.com/antvis/site/issues)。
同时,这是一份动态更新的设计文档,你的阅读和反馈正是我们不断前进的动力,[GitHub 反馈地址](https://github.com/antvis/site/issues)。
## 设计资源

View File

@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "3.7.0",
"version": "3.7.2",
"title": "Ant Design",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "http://ant.design/",
@@ -59,12 +59,12 @@
"rc-checkbox": "~2.1.5",
"rc-collapse": "~1.9.0",
"rc-dialog": "~7.1.0",
"rc-drawer": "~1.5.3",
"rc-drawer": "~1.6.2",
"rc-dropdown": "~2.2.0",
"rc-editor-mention": "^1.0.2",
"rc-form": "^2.1.0",
"rc-input-number": "~4.0.0",
"rc-menu": "~7.2.2",
"rc-menu": "~7.0.2",
"rc-notification": "~3.1.1",
"rc-pagination": "~1.16.1",
"rc-progress": "~2.2.2",
@@ -83,7 +83,7 @@
"rc-upload": "~2.5.0",
"rc-util": "^4.0.4",
"react-lazy-load": "^3.0.12",
"react-lifecycles-compat": "^3.0.4",
"react-lifecycles-compat": "^3.0.2",
"react-slick": "~0.23.1",
"shallowequal": "^1.0.1",
"warning": "~4.0.1"
@@ -92,6 +92,7 @@
"@babel/types": "7.0.0-beta.44",
"@types/react": "^16.0.0",
"@types/react-dom": "^16.0.0",
"@yesmeck/offline-plugin": "^5.0.5",
"ansi-styles": "^3.2.0",
"ant-design-palettes": "^1.0.0",
"antd-theme-generator": "1.0.7",
@@ -104,7 +105,7 @@
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"bezier-easing": "^2.0.3",
"bisheng": "^0.29.0",
"bisheng": "^0.28.0",
"bisheng-plugin-antd": "^0.16.0",
"bisheng-plugin-description": "^0.1.1",
"bisheng-plugin-react": "^0.6.0",
@@ -140,7 +141,6 @@
"majo": "^0.6.2",
"mockdate": "^2.0.1",
"moment-timezone": "^0.5.5",
"offline-plugin": "yesmeck/offline-plugin#fix-cache-key",
"pre-commit": "^1.2.2",
"preact": "^8.2.5",
"preact-compat": "^3.17.0",
@@ -151,8 +151,8 @@
"react": "^16.3.2",
"react-color": "^2.11.7",
"react-copy-to-clipboard": "^5.0.0",
"react-dnd": "^3.0.2",
"react-dnd-html5-backend": "^3.0.2",
"react-dnd": "^5.0.0",
"react-dnd-html5-backend": "^5.0.1",
"react-document-title": "^2.0.1",
"react-dom": "^16.3.2",
"react-github-button": "^0.1.1",

View File

@@ -1,6 +1,6 @@
const path = require('path');
const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default;
const OfflinePlugin = require('offline-plugin');
const OfflinePlugin = require('@yesmeck/offline-plugin');
const replaceLib = require('antd-tools/lib/replaceLib');
const getExternalResources = require('./getExternalResources');

View File

@@ -24,7 +24,7 @@ module.exports = {
'app.demo.codepen': 'Open in CodePen',
'app.demo.codesandbox': 'Open in CodeSandbox',
'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.design-language': 'Design Language',
'app.home.solution': 'Solution',

View File

@@ -202,20 +202,31 @@
.markdown.api-container table {
font-size: @font-size-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 {
font-weight: 500;
width: 20%;
font-family: "Lucida Console", Consolas, Menlo, Courier, monospace;
color: @blue-9;
}
td:nth-child(3) {
width: 22%;
font-size: 12px;
font-family: "Lucida Console", Consolas, Menlo, Courier, monospace;
font-size: @font-size-base - 1px;
color: @magenta-7;
word-break: break-all;
}
td:last-child {
width: 13%;
font-size: 12px;
font-family: "Lucida Console", Consolas, Menlo, Courier, monospace;
font-size: @font-size-base - 1px;
}
}

View File

@@ -6,7 +6,7 @@ import { addLocaleData, IntlProvider } from 'react-intl';
import 'moment/locale/zh-cn';
import { LocaleProvider } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';
import OfflineRuntime from 'offline-plugin/runtime';
import OfflineRuntime from '@yesmeck/offline-plugin/runtime';
import Header from './Header';
import Footer from './Footer';
import enLocale from '../../en-US';

View File

@@ -1,11 +1,18 @@
import createReactContext from 'create-react-context/lib/implementation';
const React = require.requireActual('react');
if (!React.createContext) {
React.createContext = () => {
const Provider = ({ children }) => children;
const Consumer = ({ children }) => children();
return { Provider, Consumer };
React.createContext = createReactContext;
}
if (!React.createRef) {
React.createRef = () => {
const ref = function setRef(node) {
ref.current = node;
};
return ref;
};
}
module.exports = React;
Object.assign(module.exports, React);