From ff25efe185a282c381218c45f104d534137d2899 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Wed, 5 Sep 2018 21:28:54 +0800 Subject: [PATCH] update to antd3.8.3 (#159) * refactor: align * feat: update align to 2.4.3 * feat: update trigger 2.5.4 * feat: update tooltip 3.7.2 * fix: align * feat: update vc-calendar to 9.6.2 * feat: update vc-checkbox to 2.1.5 * feat: update vc-dialog to 7.1.8 * feat: update vc-from to 2.2.1 * feat: update vc-notification to 3.1.1 * test: update snapshots * feat: update vc-tree to 1.12.6 * feat: update vc-table to 6.2.8 * feat: update vc-upload to 2.5.1 * feat: update vc-input-number to 4.0.12 * feat: update vc-tabs to 9.2.6 * refactor: vc-menu * refactor: update vc-menu to 7.0.5 * style: remove unused * feat: update pagination to 1.16.5 * feat: add vc-progress 2.2.5 tag * feat: add vc-rate 2.4.0 tag * feat: update vc-slider to 8.6.1 * fix: tooltip error * style: delete conosle * feat: update vc-steps to 3.1.1 * add vc-switch tag 1.6.0 * feat: update upload to 2.5.1 * fix: update vc-menu * fix: update store * fix: add ref dir * fix: trigger mock shouldComponentUpdate * fix: update vc-select * revert: trigger lazyrenderbox * fix: update vc-select * fix: update vc-select * fix: update vc-select * fix: update vc-menu * fix: update vc-slick ref * update style to 3.8.2 * test: update snapshots * update vc-select * update util & affix * feat: add drawer * fix: support title add slot mode * test: update affix test * update alert * update anchor * update snapshots * fix: doc and vc-drawer * update select & auto-complete * update back-top & grid * feractor: avatar * test: add drawer test * update badge * update button * update card * update divider * feat: update vc-tabs to 9.3.6 and tabs * add afterEnter callback * update form * fix: update drawer * test: update snapshots * update modal & notification * test: update snapshots * update message * update locale-provider * update dropdown * update layout popconfirm popover * update time-picker * update menu * update date-picker * docs: update input docs * update input * update snapshots * update table * update test snapshots * feat: update progress * update checkbox * feat: update spin * update radio * docs: slider steps timeline * update list * update transfer * update collapse * update cascader * update upload --- .eslintignore | 1 + components/_util/BaseMixin.js | 21 +- components/_util/antRefDirective.js | 4 +- components/_util/getTransitionProps.js | 3 +- components/_util/isNumeric.js | 4 + components/_util/openAnimation.js | 10 +- components/_util/proxyComponent.jsx | 47 + components/_util/store/Provider.jsx | 2 +- components/_util/store/connect.jsx | 22 +- components/_util/throttleByAnimationFrame.js | 8 +- components/_util/wave.jsx | 101 + components/affix/__tests__/index.test.js | 57 +- components/affix/demo/basic.md | 19 +- components/affix/index.jsx | 23 +- components/affix/style/index.js | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 58 +- components/alert/__tests__/index.test.js | 69 + components/alert/demo/index.vue | 6 +- components/alert/demo/smooth-closed.md | 37 + components/alert/index.en-US.md | 2 +- components/alert/index.jsx | 2 +- components/alert/index.zh-CN.md | 4 +- components/alert/style/index.js | 4 +- components/alert/style/index.less | 5 +- components/align/Align.jsx | 82 +- components/align/demo/point.vue | 45 + components/align/demo/simple.vue | 21 +- components/align/index.js | 2 +- components/align/isWindow.js | 5 - components/align/util.js | 38 + components/anchor/Anchor.jsx | 10 +- components/anchor/AnchorLink.jsx | 4 +- components/anchor/__tests__/Anchor.test.js | 78 +- components/anchor/index.en-US.md | 2 +- components/anchor/style/index.js | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 26 +- components/auto-complete/index.en-US.md | 8 +- components/auto-complete/index.jsx | 4 +- components/auto-complete/index.zh-CN.md | 8 +- components/auto-complete/style/index.js | 6 +- components/avatar/Avatar.jsx | 172 +- components/avatar/__tests__/Avatar.test.js | 63 + .../__tests__/__snapshots__/demo.test.js.snap | 21 +- components/avatar/demo/badge.md | 8 +- components/avatar/demo/basic.md | 2 + components/avatar/demo/dynamic.md | 4 +- components/avatar/index.en-US.md | 5 +- components/avatar/index.zh-CN.md | 5 +- components/avatar/style/index.js | 4 +- components/avatar/style/index.less | 7 +- components/back-top/index.jsx | 11 +- components/back-top/style/index.js | 4 +- components/badge/Badge.jsx | 9 +- components/badge/ScrollNumber.jsx | 6 +- .../__tests__/__snapshots__/demo.test.js.snap | 24 +- .../__snapshots__/index.test.js.snap | 167 + components/badge/__tests__/index.test.js | 71 +- components/badge/demo/index.vue | 2 + components/badge/demo/title.md | 31 + components/badge/index.en_US.md | 1 + components/badge/index.zh-CN.md | 1 + components/badge/style/index.js | 4 +- components/badge/style/index.less | 14 +- components/breadcrumb/style/index.js | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 24 +- .../__snapshots__/index.test.js.snap | 17 +- components/button/__tests__/index.test.js | 66 +- components/button/button.jsx | 67 +- components/button/buttonTypes.js | 1 + components/button/demo/block.md | 22 + components/button/demo/disabled.md | 7 +- components/button/demo/index.vue | 4 +- components/button/index.en-US.md | 5 +- components/button/index.zh-CN.md | 2 + components/button/style/index.js | 4 +- components/button/style/index.less | 29 +- .../__tests__/__snapshots__/demo.test.js.snap | 56 +- components/calendar/style/index.js | 8 +- components/calendar/style/index.less | 2 +- components/card/Card.jsx | 119 +- components/card/Grid.jsx | 1 + .../__tests__/__snapshots__/demo.test.js.snap | 228 +- .../__snapshots__/index.test.js.snap | 61 + components/card/__tests__/index.test.js | 8 + .../card/demo/{noBorder.md => border-less.md} | 0 .../card/demo/{grid.md => grid-card.md} | 0 .../card/demo/{colRowCard.md => in-column.md} | 0 components/card/demo/index.vue | 42 +- components/card/demo/{inline.md => inner.md} | 8 +- .../card/demo/{moreConfigs.md => meta.md} | 10 +- components/card/demo/simple.md | 19 + components/card/demo/{tabsCard.md => tabs.md} | 1 + components/card/index.en-US.md | 8 +- components/card/index.zh-CN.md | 8 +- components/card/style/index.js | 6 +- components/card/style/index.less | 11 +- components/carousel/demo/index.vue | 6 +- components/carousel/style/index.js | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 8 +- components/cascader/demo/fields-name.md | 54 + components/cascader/demo/index.vue | 4 +- components/cascader/index.en-US.md | 1 + components/cascader/index.jsx | 93 +- components/cascader/index.zh-CN.md | 1 + components/cascader/style/index.js | 6 +- components/cascader/style/index.less | 11 +- components/checkbox/Checkbox.jsx | 137 +- components/checkbox/Group.jsx | 39 +- .../__tests__/__snapshots__/demo.test.js.snap | 50 +- .../__snapshots__/group.test.js.snap | 8 + .../checkbox/__tests__/checkbox.test.js | 1 - components/checkbox/__tests__/group.test.js | 41 + components/checkbox/demo/index.vue | 2 +- components/checkbox/index.en-US.md | 15 +- components/checkbox/index.zh-CN.md | 16 +- components/checkbox/style/index.js | 4 +- components/checkbox/style/mixin.less | 35 +- components/col/style/index.js | 4 +- components/collapse/Collapse.jsx | 19 +- components/collapse/CollapsePanel.jsx | 15 +- .../__tests__/__snapshots__/demo.test.js.snap | 44 +- components/collapse/index.en-US.md | 4 + components/collapse/index.zh-CN.md | 3 +- components/collapse/src/index.js | 6 - components/collapse/style/index.js | 4 +- components/collapse/style/index.less | 15 +- components/date-picker/RangePicker.jsx | 32 +- components/date-picker/WeekPicker.jsx | 2 +- .../date-picker/__tests__/RangePicker.test.js | 15 +- .../__snapshots__/RangePicker.test.js.snap | 6 +- .../__tests__/__snapshots__/demo.test.js.snap | 8 +- .../__snapshots__/other.test.js.snap | 80 +- components/date-picker/createPicker.js | 8 + .../date-picker/demo/presetted-ranges.md | 2 +- components/date-picker/interface.js | 1 + components/date-picker/style/Calendar.less | 14 +- components/date-picker/style/Picker.less | 2 +- components/date-picker/style/RangePicker.less | 9 +- components/date-picker/style/TimePicker.less | 2 +- components/date-picker/style/index.js | 9 +- components/date-picker/wrapPicker.js | 10 + components/divider/index.en-US.md | 2 +- components/divider/index.jsx | 2 +- components/divider/index.zh-CN.md | 2 +- components/divider/style/index.js | 4 +- components/divider/style/index.less | 86 +- components/drawer/__tests__/Drawer.test.js | 126 + .../drawer/__tests__/DrawerEvent.test.js | 154 + .../drawer/__tests__/MultiDrawer.test.js | 160 + .../__snapshots__/Drawer.test.js.snap | 82 + .../__snapshots__/DrawerEvent.test.js.snap | 20 + .../__tests__/__snapshots__/demo.test.js.snap | 66 + components/drawer/__tests__/demo.test.js | 3 + components/drawer/demo/basic-left.md | 47 + components/drawer/demo/basic-right.md | 47 + components/drawer/demo/descriptionItem.vue | 22 + components/drawer/demo/from-drawer.md | 131 + components/drawer/demo/index.vue | 56 + components/drawer/demo/multi-level-drawer.md | 88 + components/drawer/demo/user-profile.md | 160 + components/drawer/index.en-US.md | 25 + components/drawer/index.jsx | 182 + components/drawer/index.zh-CN.md | 23 + components/drawer/style/drawer.less | 149 + components/drawer/style/index.js | 5 + components/drawer/style/index.less | 4 + .../__tests__/__snapshots__/demo.test.js.snap | 4 +- components/dropdown/demo/dropdown-button.md | 18 +- components/dropdown/dropdown-button.jsx | 4 +- components/dropdown/dropdown.jsx | 22 +- components/dropdown/style/index.js | 6 +- components/dropdown/style/index.less | 37 +- components/form/Form.jsx | 1 + components/form/FormItem.jsx | 37 +- .../__tests__/__snapshots__/demo.test.js.snap | 38 +- .../__snapshots__/message.test.js.snap | 31 + components/form/__tests__/message.test.js | 63 + components/form/index.en-US.md | 34 + components/form/index.zh-CN.md | 35 + components/form/style/index.js | 6 +- components/form/style/index.less | 16 +- components/grid/demo/index.vue | 2 +- components/grid/demo/responsive.md | 4 +- components/grid/style/index.js | 4 +- components/icon/style/index.js | 2 +- components/index.js | 4 + components/input-number/index.en-US.md | 2 +- components/input-number/style/index.js | 4 +- components/input-number/style/index.less | 10 +- components/input/Group.jsx | 3 +- components/input/Input.jsx | 27 +- components/input/Search.jsx | 55 +- components/input/__tests__/Search.test.js | 2 +- .../__snapshots__/Search.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 22 +- components/input/__tests__/index.test.js | 2 +- components/input/demo/size.md | 2 - components/input/index.en-US.md | 4 +- components/input/index.zh-CN.md | 2 +- components/input/style/index.js | 7 +- components/input/style/mixin.less | 19 +- components/input/style/search-input.less | 6 +- components/layout/Sider.jsx | 24 +- .../__tests__/__snapshots__/demo.test.js.snap | 118 +- components/layout/demo/fixed-sider.md | 2 +- components/layout/demo/fixed.md | 4 +- components/layout/demo/responsive.md | 6 +- components/layout/demo/side.md | 4 +- components/layout/demo/top-side.md | 2 +- components/layout/demo/top.md | 2 +- components/layout/index.en-US.md | 4 +- components/layout/index.zh-CN.md | 4 +- components/layout/style/index.js | 4 +- components/layout/style/index.less | 2 + components/layout/style/light.less | 15 + .../__tests__/__snapshots__/demo.test.js.snap | 26 +- components/list/demo/infinite-load.md | 14 +- .../list/demo/infinite-virtualized-load.md | 4 +- components/list/demo/vertical.md | 17 +- components/list/index.en-US.md | 11 + components/list/index.jsx | 8 +- components/list/index.zh-CN.md | 11 + components/list/style/index.js | 10 +- components/list/style/index.less | 5 +- .../__tests__/__snapshots__/demo.test.js.snap | 38 +- .../__snapshots__/index.test.js.snap | 1156 ++--- .../locale-provider/__tests__/index.test.js | 2 +- components/locale-provider/demo/basic.md | 8 +- components/locale-provider/index.jsx | 2 +- components/locale-provider/ko_KR.js | 2 + components/locale-provider/ru_RU.js | 4 +- components/locale-provider/style/index.js | 2 +- components/menu/MenuItem.jsx | 22 +- .../__tests__/__snapshots__/demo.test.js.snap | 116 +- components/menu/__tests__/index.test.js | 47 +- components/menu/index.jsx | 1 + components/menu/style/dark.less | 14 +- components/menu/style/index.js | 6 +- components/menu/style/index.less | 11 + .../__tests__/__snapshots__/demo.test.js.snap | 2 + components/message/__tests__/index.test.js | 25 +- components/message/demo/index.vue | 2 + components/message/demo/thenable.md | 28 + components/message/index.en-US.md | 10 + components/message/index.js | 47 +- components/message/index.zh-CN.md | 10 + components/message/style/index.js | 4 +- components/message/style/index.less | 2 +- components/modal/ConfirmDialog.jsx | 4 +- components/modal/Modal.jsx | 34 +- .../__snapshots__/Modal.test.js.snap | 64 +- .../__tests__/__snapshots__/demo.test.js.snap | 7 + components/modal/__tests__/confirm.test.js | 18 +- components/modal/demo/button-props.md | 52 + components/modal/demo/index.vue | 4 +- components/modal/demo/position.md | 41 +- components/modal/index.en-US.md | 6 +- components/modal/index.zh-CN.md | 7 +- components/modal/style/confirm.less | 4 +- components/modal/style/index.js | 6 +- components/modal/style/modal.less | 30 +- .../__tests__/__snapshots__/demo.test.js.snap | 4 +- components/notification/demo/index.vue | 3 + components/notification/demo/update.md | 38 + components/notification/index.en-US.md | 1 + components/notification/index.zh-CN.md | 1 + components/notification/style/index.js | 4 +- components/notification/style/index.less | 2 +- components/pagination/Pagination.jsx | 12 +- .../__tests__/__snapshots__/demo.test.js.snap | 12 +- components/pagination/demo/index.vue | 2 +- components/pagination/index.js | 2 +- components/pagination/style/index.js | 8 +- .../__tests__/__snapshots__/demo.test.js.snap | 4 +- components/popconfirm/demo/icon.md | 18 + components/popconfirm/demo/index.vue | 7 +- components/popconfirm/demo/local.md | 2 +- components/popconfirm/demo/placement.md | 51 +- components/popconfirm/index.en-US.md | 1 + components/popconfirm/index.jsx | 4 +- components/popconfirm/index.zh-CN.md | 1 + components/popconfirm/style/index.js | 6 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 + components/popover/demo/hover-with-click.md | 59 + components/popover/demo/index.vue | 2 + components/popover/style/index.js | 4 +- components/popover/style/index.less | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 59 +- .../__snapshots__/index.test.js.snap | 58 + components/progress/__tests__/index.test.js | 64 + components/progress/demo/format.md | 2 +- components/progress/demo/index.vue | 7 +- components/progress/demo/linecap.md | 20 + components/progress/index.en-US.md | 6 +- components/progress/index.zh-CN.md | 6 +- components/progress/progress.jsx | 48 +- components/progress/style/index.js | 4 +- components/progress/style/index.less | 2 +- components/radio/Group.jsx | 98 +- components/radio/Radio.jsx | 139 +- components/radio/RadioButton.jsx | 31 + .../__tests__/__snapshots__/demo.test.js.snap | 142 +- .../__snapshots__/group.test.js.snap | 31 +- .../__snapshots__/radio.test.js.snap | 2 +- components/radio/__tests__/group.test.js | 14 + components/radio/demo/index.vue | 5 +- components/radio/demo/radioButton-solid.md | 32 + components/radio/demo/radioButton.md | 7 +- components/radio/index.en-US.md | 32 +- components/radio/index.js | 12 +- components/radio/index.zh-CN.md | 12 +- components/radio/style/index.js | 4 +- components/radio/style/index.less | 59 +- components/rate/style/index.js | 4 +- components/rate/style/index.less | 7 +- components/row/style/index.js | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 97 +- components/select/__tests__/index.test.js | 4 +- components/select/demo/basic.md | 2 +- components/select/demo/combobox.md | 41 - components/select/demo/index.vue | 2 - components/select/demo/search-box.md | 15 +- components/select/demo/size.md | 12 - components/select/index.en-US.md | 8 +- components/select/index.jsx | 53 +- components/select/index.zh-CN.md | 2 +- components/select/style/index.js | 6 +- components/select/style/index.less | 16 +- .../__tests__/__snapshots__/demo.test.js.snap | 20 +- components/slider/demo/index.vue | 2 +- components/slider/demo/input-number.md | 2 +- components/slider/demo/tip-formatter.md | 2 +- components/slider/style/index.js | 6 +- components/spin/Spin.jsx | 80 +- .../__tests__/__snapshots__/demo.test.js.snap | 15 +- components/spin/__tests__/index.test.js | 29 + components/spin/demo/custom-indicator.md | 10 + components/spin/index.en-US.md | 22 + components/spin/index.js | 4 +- components/spin/index.zh-CN.md | 23 +- components/spin/style/index.js | 4 +- components/spin/style/index.less | 7 +- components/steps/index.en-US.md | 3 +- components/steps/index.zh-CN.md | 3 +- components/steps/style/index.js | 4 +- components/steps/style/index.less | 4 +- components/steps/style/label-placement.less | 6 +- components/steps/style/progress-dot.less | 3 + components/style.js | 1 + components/style/color/bezierEasing.less | 213 +- components/style/color/tinyColor.less | 2 +- components/style/core/base.less | 8 +- components/style/core/iconfont.less | 3 +- components/style/core/motion/other.less | 36 +- components/style/index.js | 2 +- components/style/mixins/clearfix.less | 5 +- components/style/mixins/reset.less | 1 + .../style/themes/default.deperated.less | 14 + components/style/themes/default.less | 92 +- components/style/v2-compatible-reset.js | 2 +- components/switch/demo/index.vue | 6 +- components/switch/index.jsx | 15 +- components/switch/style/index.js | 4 +- components/switch/style/index.less | 19 +- components/table/SelectionCheckboxAll.jsx | 16 +- components/table/Table.jsx | 130 +- .../__snapshots__/Table.filter.test.js.snap | 30 +- .../Table.pagination.test.js.snap | 6 +- .../Table.rowSelection.test.js.snap | 38 +- .../__snapshots__/Table.test.js.snap | 6 +- .../__tests__/__snapshots__/demo.test.js.snap | 745 +-- .../__snapshots__/empty.test.js.snap | 14 +- components/table/demo/ajax.md | 2 +- components/table/demo/basic.md | 19 +- components/table/demo/bordered.md | 2 +- components/table/demo/colspan-rowspan.md | 12 +- components/table/demo/custom-filter-panel.md | 143 +- components/table/demo/edit-cell.md | 2 +- components/table/demo/expand.md | 2 +- components/table/demo/fixed-columns-header.md | 2 +- components/table/demo/fixed-columns.md | 2 +- components/table/demo/grouping-columns.md | 2 +- components/table/demo/head.md | 4 +- components/table/demo/nested-table.md | 8 +- components/table/demo/row-selection.md | 2 +- components/table/demo/template.md | 22 +- components/table/filterDropdown.jsx | 82 +- components/table/index.en-US.md | 14 +- components/table/index.zh-CN.md | 16 +- components/table/interface.js | 7 +- components/table/style/index.js | 14 +- components/table/style/index.less | 28 +- components/table/style/size.less | 11 + .../__tests__/__snapshots__/demo.test.js.snap | 165 +- .../__snapshots__/index.test.js.snap | 4 +- components/tabs/demo/custom-add-trigger.md | 4 +- components/tabs/demo/editable-card.md | 3 +- components/tabs/demo/slide.md | 2 +- components/tabs/style/index.js | 4 +- components/tabs/style/index.less | 3 + components/tabs/tabs.jsx | 198 +- components/tag/style/index.js | 4 +- .../__snapshots__/index.test.js.snap | 2 +- .../time-picker/__tests__/index.test.js | 3 +- components/time-picker/style/index.js | 6 +- components/time-picker/style/index.less | 3 +- components/timeline/TimelineItem.jsx | 7 +- .../__tests__/__snapshots__/demo.test.js.snap | 8 +- components/timeline/index.en-US.md | 2 +- components/timeline/index.zh-CN.md | 2 +- components/timeline/style/index.js | 4 +- components/timeline/style/index.less | 72 +- components/tooltip/Tooltip.jsx | 13 +- components/tooltip/style/index.js | 4 +- components/tooltip/style/index.less | 3 +- .../__tests__/__snapshots__/demo.test.js.snap | 4246 ++++++++--------- .../__snapshots__/index.test.js.snap | 22 +- .../__tests__/__snapshots__/list.test.js.snap | 3 +- components/transfer/__tests__/index.test.js | 50 +- components/transfer/index.jsx | 21 +- components/transfer/item.jsx | 5 +- components/transfer/list.jsx | 80 +- components/transfer/operation.jsx | 18 +- components/transfer/style/index.js | 10 +- components/transfer/style/index.less | 6 +- components/tree-select/style/index.js | 8 +- .../__tests__/__snapshots__/demo.test.js.snap | 84 +- components/tree/style/directory.less | 95 + components/tree/style/index.js | 6 +- components/tree/style/index.less | 69 +- components/trigger/LazyRenderBox.jsx | 13 +- components/trigger/Popup.jsx | 160 +- components/trigger/Trigger.jsx | 91 +- components/trigger/demo/point.less | 3 + components/trigger/demo/point.vue | 88 + components/trigger/index.js | 2 +- components/trigger/utils.js | 9 +- components/upload/Upload.jsx | 7 +- components/upload/UploadList.jsx | 28 +- .../__tests__/__snapshots__/demo.test.js.snap | 2 + .../__snapshots__/uploadlist.test.js.snap | 12 +- components/upload/demo/avatar.md | 2 +- components/upload/demo/defaultFileList.md | 10 +- components/upload/demo/directory.md | 20 + components/upload/demo/fileList.md | 2 +- components/upload/demo/index.vue | 12 +- components/upload/demo/picture-card.md | 2 +- components/upload/demo/picture-style.md | 4 +- components/upload/index.en-US.md | 5 +- components/upload/index.zh-CN.md | 5 +- components/upload/interface.jsx | 3 +- components/upload/style/index.js | 8 +- components/upload/style/index.less | 14 +- components/upload/utils.jsx | 5 +- components/vc-calendar/index.js | 1 + components/vc-calendar/src/Calendar.jsx | 63 +- components/vc-calendar/src/RangeCalendar.jsx | 130 +- components/vc-calendar/src/locale/en_US.js | 5 +- components/vc-calendar/src/locale/fr_FR.js | 2 +- components/vc-calendar/src/locale/zh_CN.js | 1 + .../src/range-calendar/CalendarPart.jsx | 1 + components/vc-calendar/src/util/toTime.js | 15 + components/vc-cascader/Cascader.jsx | 48 +- components/vc-cascader/Menus.jsx | 26 +- .../vc-cascader/demo/custom-field-name.vue | 73 + components/vc-cascader/index.js | 2 +- components/vc-checkbox/assets/index.less | 157 + components/vc-checkbox/demo/simple.js | 83 + components/vc-checkbox/index.js | 1 + components/vc-checkbox/src/Checkbox.jsx | 66 +- components/vc-checkbox/src/index.js | 1 + components/vc-collapse/index.js | 9 + .../src/Collapse.jsx | 21 +- .../{collapse => vc-collapse}/src/Panel.jsx | 37 +- .../src/PanelContent.jsx | 10 +- .../src/commonProps.js | 24 +- .../src/openAnimationFactory.js | 0 components/vc-dialog/Dialog.jsx | 14 +- components/vc-dialog/DialogWrap.jsx | 10 +- components/vc-dialog/demo/ant-design.vue | 5 +- components/vc-dialog/index.js | 2 +- components/vc-drawer/assets/index.less | 203 + components/vc-drawer/demo/change-remove.jsx | 96 + components/vc-drawer/demo/change.jsx | 103 + components/vc-drawer/demo/getContainer.jsx | 83 + components/vc-drawer/demo/level.jsx | 82 + components/vc-drawer/demo/multiple.jsx | 91 + components/vc-drawer/demo/placement.jsx | 104 + components/vc-drawer/src/Drawer.js | 589 +++ components/vc-drawer/src/drawerProps.js | 20 + components/vc-drawer/src/index.js | 5 + components/vc-drawer/src/utils.js | 56 + components/vc-form/index.js | 2 +- components/vc-form/src/createDOMForm.jsx | 2 +- components/vc-form/src/utils.js | 2 +- components/vc-input-number/assets/index.less | 1 + components/vc-input-number/demo/decimal.jsx | 44 + components/vc-input-number/demo/formatter.jsx | 62 + components/vc-input-number/demo/index.vue | 20 + components/vc-input-number/src/index.js | 152 +- components/vc-lazy-load/src/LazyLoad.jsx | 16 +- components/vc-menu/DOMWrap.jsx | 2 +- components/vc-menu/Menu.jsx | 196 +- components/vc-menu/MenuItem.jsx | 90 +- components/vc-menu/MenuItemGroup.jsx | 20 +- components/vc-menu/MenuMixin.js | 262 - components/vc-menu/SubMenu.jsx | 310 +- components/vc-menu/SubPopupMenu.jsx | 345 +- components/vc-menu/commonPropsType.js | 2 +- components/vc-menu/index.js | 1 + components/vc-menu/util.js | 66 +- components/vc-notification/Notice.jsx | 15 + components/vc-notification/Notification.jsx | 30 +- components/vc-notification/assets/index.less | 96 + components/vc-notification/demo/simple.jsx | 97 + components/vc-notification/index.js | 1 + components/vc-pagination/Options.jsx | 8 +- components/vc-pagination/Pagination.jsx | 5 + components/vc-pagination/index.js | 1 + components/vc-progress/index.js | 1 + components/vc-rate/index.js | 2 +- components/vc-select/DropdownMenu.jsx | 40 +- components/vc-select/Select.jsx | 1090 +++-- components/vc-select/SelectTrigger.jsx | 24 +- components/vc-select/demo/optgroup.vue | 10 +- components/vc-select/demo/single.vue | 3 +- components/vc-select/demo/suggest.vue | 4 +- components/vc-select/index.js | 8 +- components/vc-select/util.js | 39 +- components/vc-slick/src/arrows.js | 1 - components/vc-slick/src/inner-slider.js | 46 +- components/vc-slick/src/slider.js | 2 +- components/vc-slider/index.js | 2 +- components/vc-slider/src/Handle.jsx | 50 +- components/vc-slider/src/Range.jsx | 73 +- components/vc-slider/src/Slider.jsx | 4 +- components/vc-slider/src/common/Marks.jsx | 2 - .../vc-slider/src/common/createSlider.jsx | 23 +- .../vc-slider/src/createSliderWithTooltip.jsx | 14 +- components/vc-slider/src/utils.js | 2 - components/vc-steps/index.js | 2 +- components/vc-switch/index.js | 1 + components/vc-table/assets/index.less | 8 +- components/vc-table/demo/className.js | 4 +- components/vc-table/demo/colspan-rowspan.js | 166 +- components/vc-table/demo/column-resize.js | 2 +- components/vc-table/demo/expandedRowRender.js | 9 +- components/vc-table/index.js | 2 +- components/vc-table/src/BaseTable.jsx | 57 +- components/vc-table/src/BodyTable.jsx | 6 +- components/vc-table/src/ColGroup.jsx | 13 +- components/vc-table/src/ColumnManager.jsx | 2 +- components/vc-table/src/ExpandableTable.jsx | 47 +- components/vc-table/src/Table.jsx | 54 +- components/vc-table/src/TableCell.jsx | 15 +- components/vc-table/src/TableHeaderRow.jsx | 2 +- components/vc-table/src/TableRow.jsx | 37 +- components/vc-table/src/utils.js | 11 +- components/vc-tabs/src/InkTabBar.jsx | 32 +- .../{InkTabBarMixin.js => InkTabBarNode.jsx} | 59 +- components/vc-tabs/src/SaveRef.jsx | 27 + .../vc-tabs/src/ScrollableInkTabBar.jsx | 33 +- components/vc-tabs/src/ScrollableTabBar.jsx | 25 +- ...abBarMixin.js => ScrollableTabBarNode.jsx} | 188 +- components/vc-tabs/src/TabBar.jsx | 35 +- components/vc-tabs/src/TabBarMixin.js | 128 - components/vc-tabs/src/TabBarRootNode.jsx | 61 + components/vc-tabs/src/TabBarTabsNode.jsx | 70 + components/vc-tabs/src/TabContent.jsx | 31 +- components/vc-tabs/src/TabPane.jsx | 64 +- components/vc-tabs/src/Tabs.jsx | 249 +- components/vc-tabs/src/index.js | 7 + components/vc-tooltip/Content.jsx | 23 + components/vc-tooltip/Tooltip.jsx | 14 +- components/vc-tooltip/index.js | 1 + components/vc-tree/demo/basic.jsx | 11 +- components/vc-tree/index.js | 1 + components/vc-tree/src/Tree.jsx | 85 +- components/vc-tree/src/TreeNode.jsx | 125 +- components/vc-tree/src/util.js | 24 +- components/vc-upload/demo/asyncAction.jsx | 30 + components/vc-upload/demo/beforeUpload.jsx | 10 +- components/vc-upload/demo/customRequest.js | 81 + components/vc-upload/demo/directoryUpload.js | 35 + components/vc-upload/demo/drag.jsx | 12 +- components/vc-upload/demo/index.vue | 23 + components/vc-upload/demo/simple.jsx | 22 +- components/vc-upload/index.js | 1 + components/vc-upload/src/AjaxUploader.jsx | 86 +- components/vc-upload/src/IframeUploader.jsx | 22 +- components/vc-upload/src/Upload.jsx | 6 +- components/vc-upload/src/index.js | 1 + components/vc-upload/src/traverseFileTree.js | 25 + components/version/style/index.js | 2 +- package.json | 13 +- scripts/syncStyleFromAntd.js | 69 + site/components.js | 2 + site/demo.js | 6 + site/demoRoutes.js | 8 + site/dev.js | 2 +- tests/__snapshots__/index.test.js.snap | 1 + tests/setup.js | 2 + 602 files changed, 16211 insertions(+), 8236 deletions(-) create mode 100644 components/_util/isNumeric.js create mode 100644 components/_util/proxyComponent.jsx create mode 100644 components/_util/wave.jsx create mode 100644 components/alert/__tests__/index.test.js create mode 100644 components/alert/demo/smooth-closed.md create mode 100644 components/align/demo/point.vue delete mode 100644 components/align/isWindow.js create mode 100644 components/align/util.js create mode 100644 components/badge/__tests__/__snapshots__/index.test.js.snap create mode 100644 components/badge/demo/title.md create mode 100644 components/button/demo/block.md create mode 100644 components/card/__tests__/__snapshots__/index.test.js.snap rename components/card/demo/{noBorder.md => border-less.md} (100%) rename components/card/demo/{grid.md => grid-card.md} (100%) rename components/card/demo/{colRowCard.md => in-column.md} (100%) rename components/card/demo/{inline.md => inner.md} (84%) rename components/card/demo/{moreConfigs.md => meta.md} (72%) create mode 100644 components/card/demo/simple.md rename components/card/demo/{tabsCard.md => tabs.md} (98%) create mode 100644 components/cascader/demo/fields-name.md create mode 100644 components/checkbox/__tests__/__snapshots__/group.test.js.snap delete mode 100644 components/collapse/src/index.js create mode 100644 components/drawer/__tests__/Drawer.test.js create mode 100644 components/drawer/__tests__/DrawerEvent.test.js create mode 100644 components/drawer/__tests__/MultiDrawer.test.js create mode 100644 components/drawer/__tests__/__snapshots__/Drawer.test.js.snap create mode 100644 components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap create mode 100644 components/drawer/__tests__/__snapshots__/demo.test.js.snap create mode 100644 components/drawer/__tests__/demo.test.js create mode 100644 components/drawer/demo/basic-left.md create mode 100644 components/drawer/demo/basic-right.md create mode 100644 components/drawer/demo/descriptionItem.vue create mode 100644 components/drawer/demo/from-drawer.md create mode 100644 components/drawer/demo/index.vue create mode 100644 components/drawer/demo/multi-level-drawer.md create mode 100644 components/drawer/demo/user-profile.md create mode 100644 components/drawer/index.en-US.md create mode 100644 components/drawer/index.jsx create mode 100644 components/drawer/index.zh-CN.md create mode 100644 components/drawer/style/drawer.less create mode 100644 components/drawer/style/index.js create mode 100644 components/drawer/style/index.less create mode 100644 components/form/__tests__/__snapshots__/message.test.js.snap create mode 100644 components/form/__tests__/message.test.js create mode 100644 components/layout/style/light.less create mode 100644 components/message/demo/thenable.md create mode 100644 components/modal/demo/button-props.md create mode 100644 components/notification/demo/update.md create mode 100644 components/popconfirm/demo/icon.md create mode 100644 components/popover/demo/hover-with-click.md create mode 100644 components/progress/__tests__/__snapshots__/index.test.js.snap create mode 100644 components/progress/demo/linecap.md create mode 100644 components/radio/RadioButton.jsx create mode 100644 components/radio/demo/radioButton-solid.md delete mode 100644 components/select/demo/combobox.md create mode 100644 components/style/themes/default.deperated.less create mode 100644 components/tree/style/directory.less create mode 100644 components/trigger/demo/point.less create mode 100644 components/trigger/demo/point.vue create mode 100644 components/upload/demo/directory.md create mode 100644 components/vc-calendar/src/util/toTime.js create mode 100644 components/vc-cascader/demo/custom-field-name.vue create mode 100644 components/vc-checkbox/assets/index.less create mode 100644 components/vc-checkbox/demo/simple.js create mode 100644 components/vc-collapse/index.js rename components/{collapse => vc-collapse}/src/Collapse.jsx (86%) rename components/{collapse => vc-collapse}/src/Panel.jsx (58%) rename components/{collapse => vc-collapse}/src/PanelContent.jsx (67%) rename components/{collapse => vc-collapse}/src/commonProps.js (50%) rename components/{collapse => vc-collapse}/src/openAnimationFactory.js (100%) create mode 100644 components/vc-drawer/assets/index.less create mode 100644 components/vc-drawer/demo/change-remove.jsx create mode 100644 components/vc-drawer/demo/change.jsx create mode 100644 components/vc-drawer/demo/getContainer.jsx create mode 100644 components/vc-drawer/demo/level.jsx create mode 100644 components/vc-drawer/demo/multiple.jsx create mode 100644 components/vc-drawer/demo/placement.jsx create mode 100644 components/vc-drawer/src/Drawer.js create mode 100644 components/vc-drawer/src/drawerProps.js create mode 100644 components/vc-drawer/src/index.js create mode 100644 components/vc-drawer/src/utils.js create mode 100644 components/vc-input-number/demo/decimal.jsx create mode 100644 components/vc-input-number/demo/formatter.jsx create mode 100644 components/vc-input-number/demo/index.vue delete mode 100644 components/vc-menu/MenuMixin.js create mode 100644 components/vc-notification/assets/index.less create mode 100644 components/vc-notification/demo/simple.jsx rename components/vc-tabs/src/{InkTabBarMixin.js => InkTabBarNode.jsx} (78%) create mode 100644 components/vc-tabs/src/SaveRef.jsx rename components/vc-tabs/src/{ScrollableTabBarMixin.js => ScrollableTabBarNode.jsx} (61%) delete mode 100644 components/vc-tabs/src/TabBarMixin.js create mode 100644 components/vc-tabs/src/TabBarRootNode.jsx create mode 100644 components/vc-tabs/src/TabBarTabsNode.jsx create mode 100755 components/vc-tabs/src/index.js create mode 100644 components/vc-tooltip/Content.jsx create mode 100644 components/vc-upload/demo/asyncAction.jsx create mode 100644 components/vc-upload/demo/customRequest.js create mode 100644 components/vc-upload/demo/directoryUpload.js create mode 100644 components/vc-upload/demo/index.vue create mode 100644 components/vc-upload/src/traverseFileTree.js create mode 100644 scripts/syncStyleFromAntd.js diff --git a/.eslintignore b/.eslintignore index 393d5170e..59ce4f4f6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ node_modules/ **/*.spec.* +**/style/ diff --git a/components/_util/BaseMixin.js b/components/_util/BaseMixin.js index 52d853735..cdbd3fd87 100644 --- a/components/_util/BaseMixin.js +++ b/components/_util/BaseMixin.js @@ -1,7 +1,26 @@ +import { getOptionProps } from './props-util' + export default { + directives: { + ref: { + bind: function (el, binding, vnode) { + binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm) + }, + update: function (el, binding, vnode) { + binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm) + }, + unbind: function (el, binding, vnode) { + binding.value(null) + }, + }, + }, methods: { setState (state, callback) { - Object.assign(this.$data, typeof state === 'function' ? state(this.$data) : state) + const newState = typeof state === 'function' ? state(this.$data) : state + if (this.getDerivedStateFromProps) { + Object.assign(newState, this.getDerivedStateFromProps(getOptionProps(this), this.$data, true) || {}) + } + Object.assign(this.$data, newState) this.$nextTick(() => { callback && callback() }) diff --git a/components/_util/antRefDirective.js b/components/_util/antRefDirective.js index e2120aeea..c7e3b7425 100644 --- a/components/_util/antRefDirective.js +++ b/components/_util/antRefDirective.js @@ -2,10 +2,10 @@ export default { install: (Vue, options) => { Vue.directive('ant-ref', { bind: function (el, binding, vnode) { - binding.value(vnode) + binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm) }, update: function (el, binding, vnode) { - binding.value(vnode) + binding.value(vnode.componentInstance ? vnode.componentInstance : vnode.elm) }, unbind: function (el, binding, vnode) { binding.value(null) diff --git a/components/_util/getTransitionProps.js b/components/_util/getTransitionProps.js index 369971cd5..e450ced99 100644 --- a/components/_util/getTransitionProps.js +++ b/components/_util/getTransitionProps.js @@ -1,7 +1,7 @@ import animate from './css-animation' const noop = () => {} const getTransitionProps = (transitionName, opt = {}) => { - const { beforeEnter, enter, leave, afterLeave, appear = true, tag } = opt + const { beforeEnter, enter, afterEnter, leave, afterLeave, appear = true, tag } = opt const transitionProps = { props: { appear, @@ -12,6 +12,7 @@ const getTransitionProps = (transitionName, opt = {}) => { enter: enter || ((el, done) => { animate(el, `${transitionName}-enter`, done) }), + afterEnter: afterEnter || noop, leave: leave || ((el, done) => { animate(el, `${transitionName}-leave`, done) }), diff --git a/components/_util/isNumeric.js b/components/_util/isNumeric.js new file mode 100644 index 000000000..d29361315 --- /dev/null +++ b/components/_util/isNumeric.js @@ -0,0 +1,4 @@ +const isNumeric = (value) => { + return !isNaN(parseFloat(value)) && isFinite(value) +} +export default isNumeric diff --git a/components/_util/openAnimation.js b/components/_util/openAnimation.js index 655629630..63c867c92 100644 --- a/components/_util/openAnimation.js +++ b/components/_util/openAnimation.js @@ -1,7 +1,5 @@ import cssAnimation from './css-animation' -import getRequestAnimationFrame, { cancelRequestAnimationFrame } from './getRequestAnimationFrame' - -const reqAnimFrame = getRequestAnimationFrame() +import raf from 'raf' function animate (node, show, done) { let height @@ -19,16 +17,16 @@ function animate (node, show, done) { }, active () { if (requestAnimationFrameId) { - cancelRequestAnimationFrame(requestAnimationFrameId) + raf.cancel(requestAnimationFrameId) } - requestAnimationFrameId = reqAnimFrame(() => { + requestAnimationFrameId = raf(() => { node.style.height = `${show ? height : 0}px` node.style.opacity = show ? 1 : 0 }) }, end () { if (requestAnimationFrameId) { - cancelRequestAnimationFrame(requestAnimationFrameId) + raf.cancel(requestAnimationFrameId) } node.style.height = '' node.style.opacity = '' diff --git a/components/_util/proxyComponent.jsx b/components/_util/proxyComponent.jsx new file mode 100644 index 000000000..8ef8998a3 --- /dev/null +++ b/components/_util/proxyComponent.jsx @@ -0,0 +1,47 @@ + +import PropTypes from './vue-types' +import { getOptionProps } from './props-util' + +function getDisplayName (WrappedComponent) { + return WrappedComponent.name || 'Component' +} +export default function wrapWithConnect (WrappedComponent) { + const tempProps = WrappedComponent.props || {} + const methods = WrappedComponent.methods || {} + const props = {} + Object.keys(tempProps).forEach(k => { props[k] = PropTypes.any }) + WrappedComponent.props.__propsSymbol__ = PropTypes.any + WrappedComponent.props.children = PropTypes.array.def([]) + const ProxyWrappedComponent = { + props, + model: WrappedComponent.model, + name: `Proxy_${getDisplayName(WrappedComponent)}`, + methods: { + getProxyWrappedInstance () { + return this.$refs.wrappedInstance + }, + }, + render () { + const { $listeners, $slots = {}, $attrs } = this + const props = getOptionProps(this) + const wrapProps = { + props: { + ...props, + __propsSymbol__: Symbol(), + children: $slots.default || [], + }, + on: $listeners, + attrs: $attrs, + } + return ( + + ) + }, + } + Object.keys(methods).map(m => { + ProxyWrappedComponent.methods[m] = function () { + this.getProxyWrappedInstance()[m](...arguments) + } + }) + return ProxyWrappedComponent +} diff --git a/components/_util/store/Provider.jsx b/components/_util/store/Provider.jsx index 0b01a3397..cdf97b99f 100644 --- a/components/_util/store/Provider.jsx +++ b/components/_util/store/Provider.jsx @@ -7,7 +7,7 @@ export default { }, provide () { return { - _store: this.$props, + storeContext: this.$props, } }, render () { diff --git a/components/_util/store/connect.jsx b/components/_util/store/connect.jsx index 40296f406..5ce0cab5f 100644 --- a/components/_util/store/connect.jsx +++ b/components/_util/store/connect.jsx @@ -19,13 +19,16 @@ export default function connect (mapStateToProps) { name: `Connect_${getDisplayName(WrappedComponent)}`, props, inject: { - _store: { default: {}}, + storeContext: { default: {}}, }, data () { - this.store = this._store.store + this.store = this.storeContext.store return { subscribed: finnalMapStateToProps(this.store.getState(), this.$props), } + }, + watch: { + }, mounted () { this.trySubscribe() @@ -41,8 +44,7 @@ export default function connect (mapStateToProps) { } const nextState = finnalMapStateToProps(this.store.getState(), this.$props) - if (!shallowEqual(this.nextState, nextState)) { - this.nextState = nextState + if (!shallowEqual(this.subscribed, nextState)) { this.subscribed = nextState } }, @@ -60,9 +62,12 @@ export default function connect (mapStateToProps) { this.unsubscribe = null } }, + getWrappedInstance () { + return this.$refs.wrappedInstance + }, }, render () { - const { $listeners, $slots, $attrs, $scopedSlots, subscribed, store } = this + const { $listeners, $slots = {}, $attrs, $scopedSlots, subscribed, store } = this const props = getOptionProps(this) const wrapProps = { props: { @@ -72,11 +77,14 @@ export default function connect (mapStateToProps) { }, on: $listeners, attrs: $attrs, - slots: $slots, scopedSlots: $scopedSlots, } return ( - + + {Object.keys($slots).map(name => { + return + })} + ) }, } diff --git a/components/_util/throttleByAnimationFrame.js b/components/_util/throttleByAnimationFrame.js index bf0e63236..15d5a86fc 100644 --- a/components/_util/throttleByAnimationFrame.js +++ b/components/_util/throttleByAnimationFrame.js @@ -1,6 +1,4 @@ -import getRequestAnimationFrame, { cancelRequestAnimationFrame } from '../_util/getRequestAnimationFrame' - -const reqAnimFrame = getRequestAnimationFrame() +import raf from 'raf' export default function throttleByAnimationFrame (fn) { let requestId @@ -12,11 +10,11 @@ export default function throttleByAnimationFrame (fn) { const throttled = (...args) => { if (requestId == null) { - requestId = reqAnimFrame(later(args)) + requestId = raf(later(args)) } } - throttled.cancel = () => cancelRequestAnimationFrame(requestId) + throttled.cancel = () => raf.cancel(requestId) return throttled } diff --git a/components/_util/wave.jsx b/components/_util/wave.jsx new file mode 100644 index 000000000..849b0c24e --- /dev/null +++ b/components/_util/wave.jsx @@ -0,0 +1,101 @@ + +import TransitionEvents from './css-animation/Event' + +export default { + name: 'Wave', + props: ['insertExtraNode'], + mounted () { + this.$nextTick(() => { + this.instance = this.bindAnimationEvent(this.$el) + }) + }, + + beforeDestroy () { + if (this.instance) { + this.instance.cancel() + } + }, + methods: { + isNotGrey (color) { + const match = (color || '').match(/rgba?\((\d*), (\d*), (\d*)(, [\.\d]*)?\)/) + if (match && match[1] && match[2] && match[3]) { + return !(match[1] === match[2] && match[2] === match[3]) + } + return true + }, + + onClick (node) { + if (node.className.indexOf('-leave') >= 0) { + return + } + this.removeExtraStyleNode() + const { insertExtraNode } = this.$props + const extraNode = document.createElement('div') + extraNode.className = 'ant-click-animating-node' + const attributeName = insertExtraNode ? 'ant-click-animating' : 'ant-click-animating-without-extra-node' + node.removeAttribute(attributeName) + node.setAttribute(attributeName, 'true') + // Get wave color from target + const waveColor = + getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible + getComputedStyle(node).getPropertyValue('border-color') || + getComputedStyle(node).getPropertyValue('background-color') + // Not white or transparnt or grey + if (waveColor && + waveColor !== '#ffffff' && + waveColor !== 'rgb(255, 255, 255)' && + this.isNotGrey(waveColor) && + !/rgba\(\d*, \d*, \d*, 0\)/.test(waveColor) && // any transparent rgba color + waveColor !== 'transparent') { + extraNode.style.borderColor = waveColor + this.styleForPesudo = document.createElement('style') + this.styleForPesudo.innerHTML = + `[ant-click-animating-without-extra-node]:after { border-color: ${waveColor}; }` + document.body.appendChild(this.styleForPesudo) + } + if (insertExtraNode) { + node.appendChild(extraNode) + } + const transitionEnd = () => { + node.removeAttribute(attributeName) + this.removeExtraStyleNode() + if (insertExtraNode) { + node.removeChild(extraNode) + } + TransitionEvents.removeEndEventListener(node, transitionEnd) + } + TransitionEvents.addEndEventListener(node, transitionEnd) + }, + + bindAnimationEvent (node) { + if (node.getAttribute('disabled') || + node.className.indexOf('disabled') >= 0) { + return + } + const onClick = (e) => { + // Fix radio button click twice + if (e.target.tagName === 'INPUT') { + return + } + setTimeout(() => this.onClick(node), 0) + } + node.addEventListener('click', onClick, true) + return { + cancel: () => { + node.removeEventListener('click', onClick, true) + }, + } + }, + + removeExtraStyleNode () { + if (this.styleForPesudo && document.body.contains(this.styleForPesudo)) { + document.body.removeChild(this.styleForPesudo) + this.styleForPesudo = null + } + }, + }, + + render () { + return this.$slots.default && this.$slots.default[0] + }, +} diff --git a/components/affix/__tests__/index.test.js b/components/affix/__tests__/index.test.js index 5bb0ffb90..585e285e7 100644 --- a/components/affix/__tests__/index.test.js +++ b/components/affix/__tests__/index.test.js @@ -4,8 +4,8 @@ import { mount } from '@vue/test-utils' const events = {} const AffixMounter = { + props: ['offsetBottom', 'offsetTop'], mounted () { - this.$refs.container.scrollTop = 100 this.$refs.container.addEventListener = jest.fn().mockImplementation((event, cb) => { events[event] = cb }) @@ -35,6 +35,7 @@ const AffixMounter = { this.$refs.container} ref='affix' + {...{ props: this.$props }} > + + + + +`; + exports[`renders ./components/button/demo/button-group.md correctly 1`] = `

Basic

@@ -56,11 +65,12 @@ exports[`renders ./components/button/demo/disabled.md correctly 1`] = `
- - -
+
+ + +
`; @@ -131,10 +141,10 @@ exports[`renders ./components/button/demo/multiple.md correctly 1`] = ` exports[`renders ./components/button/demo/size.md correctly 1`] = `
-
- - - +
+ + +


diff --git a/components/button/__tests__/__snapshots__/index.test.js.snap b/components/button/__tests__/__snapshots__/index.test.js.snap index 8714c1f5e..5feb7d4f6 100644 --- a/components/button/__tests__/__snapshots__/index.test.js.snap +++ b/components/button/__tests__/__snapshots__/index.test.js.snap @@ -16,6 +16,21 @@ exports[`Button renders Chinese characters correctly 2`] = ` 按钮 `; +exports[`Button renders Chinese characters correctly 3`] = ` + +`; + +exports[`Button renders Chinese characters correctly 4`] = ` + +`; + +exports[`Button renders Chinese characters correctly 5`] = ` + +`; + exports[`Button renders correctly 1`] = ``; -exports[`Button should support link button 1`] = ``; +exports[`Button should support link button 1`] = `link button`; diff --git a/components/button/__tests__/index.test.js b/components/button/__tests__/index.test.js index 5f6626cff..ca29d4395 100644 --- a/components/button/__tests__/index.test.js +++ b/components/button/__tests__/index.test.js @@ -1,17 +1,17 @@ import Button from '../index' import Icon from '../../icon' import { mount } from '@vue/test-utils' -import { renderToString } from '@vue/server-test-utils' import Vue from 'vue' +import { asyncExpect } from '@/tests/utils' describe('Button', () => { it('renders correctly', () => { - const wrapper = renderToString({ + const wrapper = mount({ render () { return }, }) - expect(wrapper).toMatchSnapshot() + expect(wrapper.html()).toMatchSnapshot() }) it('create primary button', () => { @@ -33,25 +33,52 @@ describe('Button', () => { ) expect(wrapper.text()).toBe('按 钮') - const wrapper1 = renderToString( + const wrapper1 = mount( { render (h) { return }, } ) - expect(wrapper1).toMatchSnapshot() - const wrapper2 = renderToString( + expect(wrapper1.html()).toMatchSnapshot() + + const wrapper2 = mount( { render (h) { return }, } ) - expect(wrapper2).toMatchSnapshot() - + expect(wrapper2.html()).toMatchSnapshot() + // should not insert space when there is icon const wrapper3 = mount( + { + render (h) { + return + }, + } + ) + expect(wrapper3.html()).toMatchSnapshot() + // should not insert space when there is icon while loading + const wrapper4 = mount( + { + render (h) { + return + }, + } + ) + expect(wrapper4.html()).toMatchSnapshot() + // should insert space while loading + const wrapper5 = mount( + { + render (h) { + return + }, + } + ) + expect(wrapper5.html()).toMatchSnapshot() + const wrapper6 = mount( { render (h) { return @@ -59,11 +86,11 @@ describe('Button', () => { } ) Vue.nextTick(() => { - expect(wrapper3.find('.ant-btn').contains('.ant-btn-two-chinese-chars')).toBe(true) + expect(wrapper6.find('.ant-btn').contains('.ant-btn-two-chinese-chars')).toBe(true) done() }) }) - it('should change loading state instantly by default', () => { + it('should change loading state instantly by default', async () => { const DefaultButton = { data () { return { @@ -80,14 +107,16 @@ describe('Button', () => { return }, } - const wrapper = mount(DefaultButton) - wrapper.trigger('click') - Vue.nextTick(() => { + const wrapper = mount(DefaultButton, { sync: false }) + await asyncExpect(() => { + wrapper.trigger('click') + }) + await asyncExpect(() => { expect(wrapper.findAll('.ant-btn-loading').length).toBe(1) }) }) - it('should change loading state with delay', (done) => { + it('should change loading state with delay', async () => { const DefaultButton = { data () { return { @@ -104,11 +133,12 @@ describe('Button', () => { return }, } - const wrapper = mount(DefaultButton) - wrapper.trigger('click') - Vue.nextTick(() => { + const wrapper = mount(DefaultButton, { sync: false }) + await asyncExpect(() => { + wrapper.trigger('click') + }) + await asyncExpect(() => { expect(wrapper.contains('.ant-btn-loading')).toBe(false) - done() }) }) diff --git a/components/button/button.jsx b/components/button/button.jsx index 327d5a1a0..6722b79d8 100644 --- a/components/button/button.jsx +++ b/components/button/button.jsx @@ -1,4 +1,4 @@ - +import Wave from '../_util/wave' import Icon from '../icon' const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/ const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar) @@ -16,7 +16,7 @@ export default { large: 'lg', small: 'sm', }, - clicked: false, + // clicked: false, sLoading: !!this.loading, hasTwoCNChar: false, } @@ -27,6 +27,14 @@ export default { updated () { this.fixTwoCNChar() }, + beforeDestroy () { + // if (this.timeout) { + // clearTimeout(this.timeout) + // } + if (this.delayTimeout) { + clearTimeout(this.delayTimeout) + } + }, watch: { loading (val) { clearTimeout(this.delayTimeout) @@ -40,7 +48,7 @@ export default { computed: { classes () { const { prefixCls, type, shape, size, hasTwoCNChar, - sLoading, ghost, clicked, sizeMap } = this + sLoading, ghost, block, sizeMap } = this const sizeCls = sizeMap[size] || '' return { [`${prefixCls}`]: true, @@ -48,15 +56,11 @@ export default { [`${prefixCls}-${shape}`]: shape, [`${prefixCls}-${sizeCls}`]: sizeCls, [`${prefixCls}-loading`]: sLoading, - [`${prefixCls}-clicked`]: clicked, [`${prefixCls}-background-ghost`]: ghost || type === 'ghost', [`${prefixCls}-two-chinese-chars`]: hasTwoCNChar, + [`${prefixCls}-block`]: block, } }, - iconType () { - const { sLoading, icon } = this - return sLoading ? 'loading' : icon - }, }, methods: { fixTwoCNChar () { @@ -72,9 +76,9 @@ export default { } }, handleClick (event) { - this.clicked = true - clearTimeout(this.timeout) - this.timeout = setTimeout(() => (this.clicked = false), 500) + // this.clicked = true + // clearTimeout(this.timeout) + // this.timeout = setTimeout(() => (this.clicked = false), 500) this.$emit('click', event) }, insertSpace (child, needInserted) { @@ -89,15 +93,14 @@ export default { return child }, isNeedInserted () { - const { loading, icon, $slots } = this - const iconType = loading ? 'loading' : icon - return $slots.default && $slots.default.length === 1 && (!iconType || iconType === 'loading') + const { icon, $slots } = this + return $slots.default && $slots.default.length === 1 && !icon }, }, render () { - const { htmlType, classes, - disabled, handleClick, iconType, - $slots, $attrs, $listeners } = this + const { htmlType, classes, icon, + disabled, handleClick, + sLoading, $slots, $attrs, $listeners } = this const buttonProps = { props: { }, @@ -112,21 +115,25 @@ export default { click: handleClick, }, } + const iconType = sLoading ? 'loading' : icon + const iconNode = iconType ? : null const kids = $slots.default && $slots.default.length === 1 ? this.insertSpace($slots.default[0], this.isNeedInserted()) : $slots.default - return ( - - ) - }, - beforeDestroy () { - if (this.timeout) { - clearTimeout(this.timeout) - } - if (this.delayTimeout) { - clearTimeout(this.delayTimeout) + if ('href' in $attrs) { + return ( + + {iconNode}{kids} + + ) + } else { + return ( + + + + ) } }, + } diff --git a/components/button/buttonTypes.js b/components/button/buttonTypes.js index 478fac2c6..a396f3b60 100644 --- a/components/button/buttonTypes.js +++ b/components/button/buttonTypes.js @@ -9,4 +9,5 @@ export default () => ({ loading: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), disabled: PropTypes.bool, ghost: PropTypes.bool, + block: PropTypes.bool, }) diff --git a/components/button/demo/block.md b/components/button/demo/block.md new file mode 100644 index 000000000..cca46a225 --- /dev/null +++ b/components/button/demo/block.md @@ -0,0 +1,22 @@ + + +#### block 按钮 +`block`属性将使按钮适合其父宽度。 + + + +#### block Button +`block` property will make the button fit to its parent width. + + +```html + +``` + diff --git a/components/button/demo/disabled.md b/components/button/demo/disabled.md index 081e3e83f..dcf66a99a 100644 --- a/components/button/demo/disabled.md +++ b/components/button/demo/disabled.md @@ -18,11 +18,12 @@ To mark a button as disabled, add the `disabled` property to the `Button`. Default Default(disabled)
- Ghost - Ghost(disabled) -
Dashed Dashed(disabled) +
+ Ghost + Ghost(disabled) +
``` diff --git a/components/button/demo/index.vue b/components/button/demo/index.vue index 97da1eb91..a39748f17 100644 --- a/components/button/demo/index.vue +++ b/components/button/demo/index.vue @@ -7,6 +7,7 @@ import Icon from './icon' import Loading from './loading' import Multiple from './multiple' import Size from './size' +import Block from './block' import CN from '../index.zh-CN.md' import US from '../index.en-US.md' const md = { @@ -19,7 +20,7 @@ const md = { To trigger an operation. ## When To Use A button means an operation (or a series of operations). Clicking a button will trigger corresponding business logic. - ## Examples + ## Examples `, } export default { @@ -39,6 +40,7 @@ export default { + diff --git a/components/button/index.en-US.md b/components/button/index.en-US.md index ce51eecaf..01844a0d4 100644 --- a/components/button/index.en-US.md +++ b/components/button/index.en-US.md @@ -4,6 +4,7 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`. | Property | Description | Type | Default | | -------- | ----------- | ---- | ------- | +| disabled | disabled state of button | boolean | `false` | | ghost | make background transparent and invert text and border colors, added in 2.7 | boolean | false | | htmlType | set the original html `type` of `button`, see: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` | | icon | set the icon of button, see: Icon component | string | - | @@ -11,12 +12,12 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`. | shape | can be set to `circle` or omitted | string | - | | size | can be set to `small` `large` or omitted | string | `default` | | type | can be set to `primary` `ghost` `dashed` `danger`(added in 2.7) or omitted (meaning `default`) | string | `default` | -| onClick | set the handler to handle `click` event | function | - | +| block | option to fit button width to its parent width | boolean | `false` | ### events | Events Name | Description | Arguments | | --- | --- | --- | -| click | handle `click` event | function(e) | +| click | set the handler to handle `click` event | function(e) | `` will be rendered into ``, and all the properties which are not listed above will be transferred to the ` + + Here is content of Drawer + +
+ ) + }, +} + +describe('Drawer', () => { + it('render correctly', async () => { + const wrapper = mount(DrawerEventTester, { + sync: false, + }) + await asyncExpect(() => { + const body = wrapper.find('.ant-drawer-body').exists() + expect(body).toBe(true) + wrapper.find('button.ant-btn').trigger('click') + const content = wrapper.find('.ant-drawer-body').vnode.elm.innerHTML + expect(content).toBe('Here is content of Drawer') + + expect(wrapper.html()).toMatchSnapshot() + }) + }, 1000) + + it('mask trigger onClose', async () => { + const wrapper = mount(DrawerEventTester, { + sync: false, + }) + + await asyncExpect(() => { + wrapper.find('button.ant-btn').trigger('click') + expect(wrapper.vm.visible).toBe(true) + + wrapper.find('.ant-drawer-mask').trigger('click') + expect(wrapper.vm.visible).toBe(false) + }) + }) + + it('close button trigger onClose', async () => { + const wrapper = mount(DrawerEventTester, { + sync: false, + }) + await asyncExpect(() => { + wrapper.find('button.ant-btn').trigger('click') + expect(wrapper.vm.visible).toBe(true) + + wrapper.find('.ant-drawer-close').trigger('click') + expect(wrapper.vm.visible).toBe(false) + }) + }) + + it('maskClosable no trigger onClose', async () => { + const wrapper = mount(DrawerEventTester, { + propsData: { + maskClosable: false, + }, + sync: false, + }) + await asyncExpect(() => { + wrapper.find('button.ant-btn').trigger('click') + expect(wrapper.vm.visible).toBe(true) + + wrapper.find('.ant-drawer-mask').trigger('click') + expect(wrapper.vm.visible).toBe(true) + }) + }) + + it('destroyOnClose is true onClose', async () => { + const wrapper = mount(DrawerEventTester, { + propsData: { + destroyOnClose: true, + }, + sync: false, + }) + await asyncExpect(() => { + wrapper.find('button.ant-btn').trigger('click') + expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(true) + + wrapper.setData({ + visible: false, + }) + wrapper.find('.ant-drawer-wrapper-body').trigger('transitionend') + }) + await asyncExpect(() => { + expect(wrapper.find('.ant-drawer-wrapper-body').exists()).toBe(false) + }) + }) + + it('no mask and no closable', async () => { + const wrapper = mount(DrawerEventTester, { + propsData: { + destroyOnClose: true, + }, + sync: false, + }) + await asyncExpect(() => { + wrapper.find('button.ant-btn').trigger('click') + expect(wrapper.vm.visible).toBe(true) + + wrapper.find('.ant-drawer-close').trigger('click') + expect(wrapper.vm.visible).toBe(false) + }) + }) +}) diff --git a/components/drawer/__tests__/MultiDrawer.test.js b/components/drawer/__tests__/MultiDrawer.test.js new file mode 100644 index 000000000..8346e776f --- /dev/null +++ b/components/drawer/__tests__/MultiDrawer.test.js @@ -0,0 +1,160 @@ +import { mount } from '@vue/test-utils' +import Drawer from '..' +import Button from '../../button' +import { asyncExpect } from '@/tests/utils' + +const MultiDrawer = { + props: { + placement: { + type: String, + default: 'right', + }, + }, + data () { + return { + visible: false, + childrenDrawer: false, + } + }, + methods: { + showDrawer () { + this.visible = true + }, + onClose () { + this.visible = false + }, + showChildrenDrawer () { + this.childrenDrawer = true + }, + onChildrenDrawerClose () { + this.childrenDrawer = false + }, + }, + render () { + const drawerProps = { + props: { + title: 'Multi-level drawer', + width: 520, + closable: false, + visible: this.visible, + getContainer: false, + wrapClassName: 'test_drawer', + placement: this.placement, + }, + on: { + close: this.onClose, + }, + } + const childrenDrawerProps = { + props: { + title: 'Two-level Drawer', + width: 320, + closable: false, + visible: this.childrenDrawer, + getContainer: false, + placement: this.placement, + }, + on: { + close: this.onChildrenDrawerClose, + }, + } + const buttonProps = { + props: { + type: 'primary', + }, + attrs: { + id: 'open_drawer', + }, + on: { + click: this.showDrawer, + }, + } + return ( +
+ + + + +
+ This is two-level drawer +
+
+
+ + +
+
+
+ ) + }, +} + +describe('Drawer', () => { + it('render right MultiDrawer', async () => { + const wrapper = mount(MultiDrawer, { + propsData: { + placement: 'right', + }, + sync: false, + }) + await asyncExpect(() => { + wrapper.find('#open_drawer').trigger('click') + }, 0) + await asyncExpect(() => { + wrapper.find('#open_two_drawer').trigger('click') + }, 0) + await asyncExpect(() => { + const translateX = wrapper.find('.ant-drawer.test_drawer').element.parentElement.style.transform + expect(translateX).toEqual('translateX(-180px)') + expect(wrapper.find('#two_drawer_text').exists()).toBe(true) + }, 1000) + }) + + it('render right MultiDrawer', async () => { + document.body.innerHTML = '' + const wrapper = mount(MultiDrawer, { + propsData: { + placement: 'left', + }, + sync: false, + }) + await asyncExpect(() => { + wrapper.find('#open_drawer').trigger('click') + }, 0) + await asyncExpect(() => { + wrapper.find('#open_two_drawer').trigger('click') + }, 0) + await asyncExpect(() => { + const translateX = wrapper.find('.ant-drawer.test_drawer').element.parentElement.style.transform + expect(translateX).toEqual('translateX(180px)') + expect(wrapper.find('#two_drawer_text').exists()).toBe(true) + }, 1000) + }) +}) diff --git a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap new file mode 100644 index 000000000..2fe01266f --- /dev/null +++ b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Drawer class is test_drawer 1`] = ` +
+
+
+
+
+
+ +
Here is content of Drawer
+
+
+
+
+
+`; + +exports[`Drawer closable is false 1`] = ` +
+
+
+
+
+
+
Here is content of Drawer
+
+
+
+
+
+`; + +exports[`Drawer destroyOnClose is true 1`] = ` +
+
+
+
+
+
+
Here is content of Drawer
+
+
+
+
+
+`; + +exports[`Drawer have a title 1`] = ` +
+
+
+
+
+
+
+
Test Title
+
+ +
Here is content of Drawer
+
+
+
+
+
+`; + +exports[`Drawer render correctly 1`] = ` +
+
+
+
+
+
+ +
Here is content of Drawer
+
+
+
+
+
+`; diff --git a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap new file mode 100644 index 000000000..0c6c187f8 --- /dev/null +++ b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap @@ -0,0 +1,20 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Drawer render correctly 1`] = ` +
+ +
+
+
+
+
+
+ +
Here is content of Drawer
+
+
+
+
+
+
+`; diff --git a/components/drawer/__tests__/__snapshots__/demo.test.js.snap b/components/drawer/__tests__/__snapshots__/demo.test.js.snap new file mode 100644 index 000000000..aa2c2fe69 --- /dev/null +++ b/components/drawer/__tests__/__snapshots__/demo.test.js.snap @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders ./components/drawer/demo/basic-left.md correctly 1`] = ` +
+ + +
+`; + +exports[`renders ./components/drawer/demo/basic-right.md correctly 1`] = ` +
+ + +
+`; + +exports[`renders ./components/drawer/demo/multi-level-drawer.md correctly 1`] = ` +
+ + +
+`; + +exports[`renders ./components/drawer/demo/user-profile.md correctly 1`] = ` +
+
+
+
+
+
+
+
+

+ Lily +

+
Progresser AFX
+
+
+ +
+
+
+
+
+

+ Lily +

+
Progresser AFX
+
+
+ +
+
+
+
+ +
+`; diff --git a/components/drawer/__tests__/demo.test.js b/components/drawer/__tests__/demo.test.js new file mode 100644 index 000000000..975152a9a --- /dev/null +++ b/components/drawer/__tests__/demo.test.js @@ -0,0 +1,3 @@ +import demoTest from '../../../tests/shared/demoTest' + +demoTest('drawer', { skip: ['from-drawer.md'] }) diff --git a/components/drawer/demo/basic-left.md b/components/drawer/demo/basic-left.md new file mode 100644 index 000000000..57b192f6a --- /dev/null +++ b/components/drawer/demo/basic-left.md @@ -0,0 +1,47 @@ + +#### 左侧滑出 +基础抽屉,点击触发按钮抽屉从左滑出,点击遮罩区关闭 + + + +#### Left Slider +Basic drawer. + + +```html + + +``` diff --git a/components/drawer/demo/basic-right.md b/components/drawer/demo/basic-right.md new file mode 100644 index 000000000..c172d5952 --- /dev/null +++ b/components/drawer/demo/basic-right.md @@ -0,0 +1,47 @@ + +#### 基础抽屉 +基础抽屉,点击触发按钮抽屉从右滑出,点击遮罩区关闭 + + + +#### Basic +Basic drawer. + + +```html + + +``` diff --git a/components/drawer/demo/descriptionItem.vue b/components/drawer/demo/descriptionItem.vue new file mode 100644 index 000000000..5af502302 --- /dev/null +++ b/components/drawer/demo/descriptionItem.vue @@ -0,0 +1,22 @@ + + + diff --git a/components/drawer/demo/from-drawer.md b/components/drawer/demo/from-drawer.md new file mode 100644 index 000000000..ffcf698c7 --- /dev/null +++ b/components/drawer/demo/from-drawer.md @@ -0,0 +1,131 @@ + +#### 对象编辑 +用于承载编辑相关操作,需要点击关闭按钮关闭。 + + + +#### Edit item in drawer +A drawer containing an editable form which needs to be collapsed by clicking the close button. + + +```html + + +``` diff --git a/components/drawer/demo/index.vue b/components/drawer/demo/index.vue new file mode 100644 index 000000000..c726fb74a --- /dev/null +++ b/components/drawer/demo/index.vue @@ -0,0 +1,56 @@ + diff --git a/components/drawer/demo/multi-level-drawer.md b/components/drawer/demo/multi-level-drawer.md new file mode 100644 index 000000000..704c90f4e --- /dev/null +++ b/components/drawer/demo/multi-level-drawer.md @@ -0,0 +1,88 @@ + +#### 多层抽屉 +在抽屉内打开新的抽屉,用以解决多分支任务的复杂状况。 + + + +#### Multi-level drawer +Open a new drawer on top of an existing drawer to handle multi branch tasks + + +```html + + +``` diff --git a/components/drawer/demo/user-profile.md b/components/drawer/demo/user-profile.md new file mode 100644 index 000000000..98216f740 --- /dev/null +++ b/components/drawer/demo/user-profile.md @@ -0,0 +1,160 @@ + +#### 信息预览抽屉 +需要快速预览对象概要时使用,点击遮罩区关闭。 + + + +#### Preview drawer +Use when you need to quickly preview the outline of the object. Such as list item preview. + + +```html + + +``` diff --git a/components/drawer/index.en-US.md b/components/drawer/index.en-US.md new file mode 100644 index 000000000..47c1944dd --- /dev/null +++ b/components/drawer/index.en-US.md @@ -0,0 +1,25 @@ +## API + +| Property | Description | Type | Default | +| -------- | ----------- | ---- | ------- | +| Props | Description | Type | Default | +| --- | --- | --- | --- | +| closable | Whether a close (x) button is visible on top right of the Drawer dialog or not. | boolean | true | +| destroyOnClose | Whether to unmount child components on closing drawer or not. | boolean | false | +| getContainer | Return the mounted node for Drawer. | HTMLElement \| `() => HTMLElement` \| selectors  | 'body' | +| mask | Whether to show mask or not. | Boolean | true | +| maskClosable | Clicking on the mask (area outside the Drawer) to close the Drawer or not. | boolean | true | +| maskStyle | Style for Drawer's mask element. | object | {} | +| title | The title for Drawer. | string\|slot | - | +| visible | Whether the Drawer dialog is visible or not. | boolean | false | +| width | Width of the Drawer dialog. | string\|number | 256 | +| wrapClassName | The class name of the container of the Drawer dialog. | string | - | +| zIndex | The `z-index` of the Drawer. | Number | 1000 | +| placement | The placement of the Drawer. | 'left' \| 'right' | 'right' + + +## Methods + +| Name | Description | Type | Default | +| ---- | ----------- | ---- | ------- | +| close | Specify a callback that will be called when a user clicks mask, close button or Cancel button. | function(e) | - | diff --git a/components/drawer/index.jsx b/components/drawer/index.jsx new file mode 100644 index 000000000..b99f525b6 --- /dev/null +++ b/components/drawer/index.jsx @@ -0,0 +1,182 @@ +import VcDrawer from '../vc-drawer/src' +import PropTypes from '../_util/vue-types' +import BaseMixin from '../_util/BaseMixin' +import { getComponentFromProp, getOptionProps } from '../_util/props-util' + +export default { + name: 'ADrawer', + props: { + closable: PropTypes.bool.def(true), + destroyOnClose: PropTypes.bool, + getContainer: PropTypes.any, + maskClosable: PropTypes.bool.def(true), + mask: PropTypes.bool, + maskStyle: PropTypes.object, + title: PropTypes.any, + visible: PropTypes.bool, + width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def(256), + zIndex: PropTypes.number, + prefixCls: PropTypes.string.def('ant-drawer'), + placement: PropTypes.string.def('right'), + level: PropTypes.any.def(null), + wrapClassName: PropTypes.string, + }, + mixins: [BaseMixin], + data () { + this.destoryClose = false + this.preVisible = this.$props.visible + return { + _push: false, + } + }, + inject: { + parentDrawer: { + default: null, + }, + }, + provide () { + return { + parentDrawer: this, + } + }, + updated () { + this.$nextTick(() => { + if (this.preVisible !== this.visible && this.parentDrawer) { + if (this.visible) { + this.parentDrawer.push() + } else { + this.parentDrawer.pull() + } + } + this.preVisible = this.visible + }) + }, + methods: { + close (e) { + if (this.visible !== undefined) { + this.$emit('close', e) + return + } + }, + onMaskClick (e) { + if (!this.maskClosable) { + return + } + this.close(e) + }, + push () { + this.setState({ + _push: true, + }) + }, + pull () { + this.setState({ + _push: false, + }) + }, + onDestoryTransitionEnd () { + const isDestroyOnClose = this.getDestoryOnClose() + if (!isDestroyOnClose) { + return + } + if (!this.visible) { + this.destoryClose = true + this.$forceUpdate() + } + }, + + getDestoryOnClose () { + return this.destroyOnClose && !this.visible + }, + + renderBody () { + if (this.destoryClose && !this.visible) { + return null + } + this.destoryClose = false + const { placement, bodyStyle } = this.$props + + const containerStyle = 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, closable } = this.$props + const title = getComponentFromProp(this, 'title') + let header + if (title) { + header = ( +
+
{title}
+
+ ) + } + let closer + if (closable) { + closer = ( + + ) + } + + return ( +
+ {header} + {closer} +
+ {this.$slots.default} +
+
+ ) + }, + }, + render () { + const props = getOptionProps(this) + const { zIndex, visible, placement, mask, wrapClassName, ...rest } = props + const vcDrawerStyle = this.$data._push + ? { + zIndex, + transform: `translateX(${placement === 'left' ? 180 : -180}px)`, + } + : { zIndex } + const vcDrawerProps = { + props: { + handler: false, + open: visible, + showMask: mask, + placement, + wrapClassName, + ...rest, + }, + on: { + maskClick: this.onMaskClick, + ...this.$listeners, + }, + style: vcDrawerStyle, + + } + return ( + + {this.renderBody()} + + ) + }, +} diff --git a/components/drawer/index.zh-CN.md b/components/drawer/index.zh-CN.md new file mode 100644 index 000000000..45aa18fe8 --- /dev/null +++ b/components/drawer/index.zh-CN.md @@ -0,0 +1,23 @@ +## API + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| closable | 是否显示右上角的关闭按钮 | boolean | true | +| destroyOnClose | 关闭时销毁 Drawer 里的子元素 | boolean | false | +| getContainer | 指定 Drawer 挂载的 HTML 节点 | HTMLElement \| `() => HTMLElement` \| selectors  | 'body' | +| maskClosable | 点击蒙层是否允许关闭 | boolean | true | +| mask | 是否展示遮罩 | Boolean | true | +| maskStyle | 遮罩样式 | object | {} | +| title | 标题 | string \| slot | - | +| visible | Drawer 是否可见 | boolean | - | +| width | 宽度 | string \| number | 256 | +| wrapClassName | 对话框外层容器的类名 | string | - | +| zIndex | 设置 Drawer 的 `z-index` | Number | 1000 | +| placement | 抽屉的方向 | 'left' \| 'right' | 'right' + +## 方法 + +| 名称 | 描述 | 类型 | 默认值 | +| --- | --- | --- | --- | +| close | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | 无 | + diff --git a/components/drawer/style/drawer.less b/components/drawer/style/drawer.less new file mode 100644 index 000000000..aac8ada9f --- /dev/null +++ b/components/drawer/style/drawer.less @@ -0,0 +1,149 @@ +@import "../../style/themes/default"; + +@dawer-prefix-cls: ~"@{ant-prefix}-drawer"; + +.@{dawer-prefix-cls} { + position: fixed; + top: 0; + width: 100%; + height: 100%; + pointer-events: none; + z-index: @zindex-modal; + transition: transform 0.3s @ease-in-out-circ; + > * { + transition: transform 0.3s @ease-in-out-circ; + } + + &-content-wrapper { + position: absolute; + } + + &-left, + &-right { + .@{dawer-prefix-cls}-content-wrapper, + .@{dawer-prefix-cls}-content { + height: 100%; + } + } + &-left { + &.@{dawer-prefix-cls}-open { + .@{dawer-prefix-cls}-content-wrapper { + box-shadow: @shadow-1-right; + } + } + } + &-right { + .@{dawer-prefix-cls} { + &-content-wrapper { + right: 0; + } + } + &.@{dawer-prefix-cls}-open { + .@{dawer-prefix-cls}-content-wrapper { + box-shadow: @shadow-1-left; + } + } + } + &.@{dawer-prefix-cls}-open { + > * { + pointer-events: auto; + } + .@{dawer-prefix-cls} { + &-mask { + opacity: 0.3; + } + } + } + + &-title { + margin: 0; + font-size: @font-size-lg; + line-height: 22px; + font-weight: 500; + color: @heading-color; + } + + &-content { + position: relative; + background-color: @component-background; + border: 0; + background-clip: padding-box; + z-index: 1; + } + + &-close { + cursor: pointer; + border: 0; + background: transparent; + position: absolute; + right: 0; + top: 0; + z-index: 10; + font-weight: 700; + line-height: 1; + text-decoration: none; + transition: color 0.3s; + color: @text-color-secondary; + outline: 0; + padding: 0; + + &-x { + display: block; + font-style: normal; + text-align: center; + text-transform: none; + text-rendering: auto; + width: 56px; + height: 56px; + line-height: 56px; + font-size: @font-size-lg; + + &:before { + content: "\e633"; + display: block; + font-family: "anticon" !important; + } + } + + &:focus, + &:hover { + color: #444; + text-decoration: none; + } + } + + &-header { + padding: 16px 24px; + border-radius: @border-radius-base @border-radius-base 0 0; + background: @component-background; + color: @text-color; + border-bottom: @border-width-base @border-style-base @border-color-split; + } + + &-body { + padding: 24px; + font-size: @font-size-base; + line-height: @line-height-base; + word-wrap: break-word; + } + + &-mask { + position: fixed; + top: 0; + right: 0; + left: 0; + bottom: 0; + opacity: 0; + background-color: @modal-mask-bg; + height: 100%; + transition: opacity 0.3s @ease-in-out-circ; + filter: ~"alpha(opacity=50)"; + } + + &-open { + overflow: hidden; + &-content { + box-shadow: @shadow-2; + } + } +} diff --git a/components/drawer/style/index.js b/components/drawer/style/index.js new file mode 100644 index 000000000..81f6a07af --- /dev/null +++ b/components/drawer/style/index.js @@ -0,0 +1,5 @@ +import '../../style/index.less' +import './index.less' + +// style dependencies +import '../../button/style' diff --git a/components/drawer/style/index.less b/components/drawer/style/index.less new file mode 100644 index 000000000..303b8ee83 --- /dev/null +++ b/components/drawer/style/index.less @@ -0,0 +1,4 @@ +@import "../../style/themes/default"; +@import "../../style/mixins/index"; +@import "./drawer"; + diff --git a/components/dropdown/__tests__/__snapshots__/demo.test.js.snap b/components/dropdown/__tests__/__snapshots__/demo.test.js.snap index 9a914b41a..f7772f54d 100644 --- a/components/dropdown/__tests__/__snapshots__/demo.test.js.snap +++ b/components/dropdown/__tests__/__snapshots__/demo.test.js.snap @@ -14,13 +14,13 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
+ Or @@ -476,7 +476,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
-
+
+86
@@ -492,7 +492,7 @@ exports[`renders ./components/form/demo/register.vue correctly 1`] = `
-
-
+
- + class="ant-radio-wrapper">item 2 +
@@ -732,10 +732,10 @@ exports[`renders ./components/form/demo/validate-other.vue correctly 1`] = `
-
+
- + class="ant-radio-button-wrapper">item 2 +
@@ -875,7 +875,7 @@ exports[`renders ./components/form/demo/validate-static.vue correctly 1`] = `
-
+
Option 1
diff --git a/components/form/__tests__/__snapshots__/message.test.js.snap b/components/form/__tests__/__snapshots__/message.test.js.snap new file mode 100644 index 000000000..66dfe6591 --- /dev/null +++ b/components/form/__tests__/__snapshots__/message.test.js.snap @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Form should display custom message 1`] = ` +
+
+
+ +
+
+
+
Account does not exist, Forgot account?
+
+
+
+
+`; + +exports[`Form should display two message 1`] = ` +
+
+
+ +
+
+
+
Error message 1 Error message 2
+
+
+
+
+`; diff --git a/components/form/__tests__/message.test.js b/components/form/__tests__/message.test.js new file mode 100644 index 000000000..63f1b2a85 --- /dev/null +++ b/components/form/__tests__/message.test.js @@ -0,0 +1,63 @@ +import { mount } from '@vue/test-utils' +import Form from '..' + +describe('Form', () => { + it('should display two message', () => { + const rules = [{ + pattern: /^\w+$/, + message: 'Error message 1', + }, { + pattern: /^\w+$/, + message: 'Error message 2', + }] + let myForm + const Form1 = Form.create()({ + render () { + return ( +
+ + {this.form.getFieldDecorator('account', { initialValue: '+=-/', rules })()} + +
+ ) + }, + }) + + const wrapper = mount(Form1, { propsData: { + wrappedComponentRef: (inst) => { myForm = inst.form }, + }}) + myForm.validateFields() + + wrapper.vm.$forceUpdate() + expect(wrapper.html()).toMatchSnapshot() + }) + + it('should display custom message', () => { + let myForm + const Form1 = Form.create()({ + created () { + myForm = this.form + }, + render () { + const rules = [{ + pattern: /^$/, + message: Account does not exist, Forgot account?, + }] + return ( +
+ + {this.form.getFieldDecorator('account', { initialValue: 'antd', rules })()} + +
+ ) + }, + }) + + const wrapper = mount(Form1) + myForm.validateFields() + + wrapper.vm.$forceUpdate() + expect(wrapper.html()).toMatchSnapshot() + }) +}) + diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index d03c55e0d..80196adc8 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -93,6 +93,40 @@ If the form has been decorated by `Form.create` then it has `this.form` property | options.force | Should validate validated field again when `validateTrigger` is been triggered again | boolean | false | | options.scroll | Config scroll behavior of `validateFieldsAndScroll`, more: [dom-scroll-into-view's config](https://github.com/yiminghe/dom-scroll-into-view#function-parameter) | Object | {} | +#### Callback arguments example of validateFields + +- `errors`: + + ```js + { + "userName": { + "errors": [ + { + "message": "Please input your username!", + "field": "userName" + } + ] + }, + "password": { + "errors": [ + { + "message": "Please input your Password!", + "field": "password" + } + ] + } + } + ``` + +- `values`: + + ```js + { + "userName": "username", + "password": "password", + } + ``` + ### Form.createFormField To mark the returned fields data in `mapPropsToFields`, [demo](#components-form-demo-global-state). diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index 70d018538..93a57b181 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -92,6 +92,41 @@ CustomizedForm = Form.create({})(CustomizedForm); | options.force | 对已经校验过的表单域,在 validateTrigger 再次被触发时是否再次校验 | boolean | false | | options.scroll | 定义 validateFieldsAndScroll 的滚动行为,详细配置见 [dom-scroll-into-view config](https://github.com/yiminghe/dom-scroll-into-view#function-parameter) | Object | {} | +#### validateFields 的 callback 参数示例 + +- `errors`: + + ```js + { + "userName": { + "errors": [ + { + "message": "Please input your username!", + "field": "userName" + } + ] + }, + "password": { + "errors": [ + { + "message": "Please input your Password!", + "field": "password" + } + ] + } + } + ``` + +- `values`: + + ```js + { + "userName": "username", + "password": "password", + } + ``` + + ### Form.createFormField 用于标记 `mapPropsToFields` 返回的表单域数据,[例子](#components-form-demo-global-state)。 diff --git a/components/form/style/index.js b/components/form/style/index.js index 753451010..30c84ff81 100644 --- a/components/form/style/index.js +++ b/components/form/style/index.js @@ -1,5 +1,5 @@ -import '../../style/index.less' -import './index.less' +import '../../style/index.less'; +import './index.less'; // style dependencies -import '../../grid/style' +import '../../grid/style'; diff --git a/components/form/style/index.less b/components/form/style/index.less index a26e07c2c..8b4797358 100644 --- a/components/form/style/index.less +++ b/components/form/style/index.less @@ -132,8 +132,9 @@ input[type="checkbox"] { .@{form-prefix-cls}-extra { color: @text-color-secondary; line-height: @line-height-base; - transition: color .15s @ease-out; + transition: color .3s @ease-out; // sync input color transition margin-top: @form-help-margin-top; + clear: both; } .@{form-prefix-cls}-extra { @@ -235,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, @@ -251,7 +257,9 @@ form { } // fix input with addon position. https://github.com/ant-design/ant-design/issues/8243 + :not(.@{ant-prefix}-input-group-wrapper) > .@{ant-prefix}-input-group, .@{ant-prefix}-input-group-wrapper { + display: inline-block; vertical-align: middle; position: relative; top: -1px; @@ -574,7 +582,7 @@ form { } } -.show-help-motion(show-help, antShowHelp, 0.15s); +.show-help-motion(show-help, antShowHelp, 0.3s); @keyframes antShowHelpIn { 0% { diff --git a/components/grid/demo/index.vue b/components/grid/demo/index.vue index b2dd1d080..f798fb931 100644 --- a/components/grid/demo/index.vue +++ b/components/grid/demo/index.vue @@ -32,7 +32,7 @@ const md2 = { - 如果一个\`row\`中的\`col\`总和超过 24,那么多余的\`col\`会作为一个整体另起一行排列 ## Flex 布局 我们的栅格化系统支持 Flex 布局,允许子元素在父节点内的水平对齐方式 - 居左、居中、居右、等宽排列、分散排列。子元素与子元素之间,支持顶部对齐、垂直居中对齐、底部对齐的方式。同时,支持使用 order 来定义元素的排列顺序。 -Flex 布局是基于 24 栅格来定义每一个『盒子』的宽度,但排版则不拘泥于栅格。 +Flex 布局是基于 24 栅格来定义每一个『盒子』的宽度,但不拘泥于栅格。 ## 代码演示 `, us: ` diff --git a/components/grid/demo/responsive.md b/components/grid/demo/responsive.md index 2c0f075d1..35f840e7f 100644 --- a/components/grid/demo/responsive.md +++ b/components/grid/demo/responsive.md @@ -1,11 +1,11 @@ #### 响应式布局 -参照 Bootstrap 的 [响应式设计](http://getbootstrap.com/css/#grid-media-queries),预设五个响应尺寸:`xs` `sm` `md` `lg` `xl` `xxl`。 +参照 Bootstrap 的 [响应式设计](http://getbootstrap.com/css/#grid-media-queries),预设六个响应尺寸:`xs` `sm` `md` `lg` `xl` `xxl`。 #### 响应式布局 -Referring to the Bootstrap [responsive design] (http://getbootstrap.com/css/#grid-media-queries), here preset five dimensions: `xs` `sm` `md` `lg` `xl`. +Referring to the Bootstrap [responsive design] (http://getbootstrap.com/css/#grid-media-queries), here preset six dimensions: `xs` `sm` `md` `lg` `xl`. ```html diff --git a/components/grid/style/index.js b/components/grid/style/index.js index cf31ed80f..3a3ab0de5 100644 --- a/components/grid/style/index.js +++ b/components/grid/style/index.js @@ -1,2 +1,2 @@ -import '../../style/index.less' -import './index.less' +import '../../style/index.less'; +import './index.less'; diff --git a/components/icon/style/index.js b/components/icon/style/index.js index 40aaf01c1..2eab1f8ca 100644 --- a/components/icon/style/index.js +++ b/components/icon/style/index.js @@ -1 +1 @@ -import '../../style/index.less' +import '../../style/index.less'; diff --git a/components/index.js b/components/index.js index e8a5d4a2c..424219c94 100644 --- a/components/index.js +++ b/components/index.js @@ -120,6 +120,8 @@ import { default as Upload } from './upload' import { default as version } from './version' +import { default as Drawer } from './drawer' + const components = [ Affix, Anchor, @@ -209,6 +211,7 @@ const components = [ Tooltip, Upload, Upload.Dragger, + Drawer, ] const install = function (Vue) { @@ -280,6 +283,7 @@ export { Timeline, Tooltip, Upload, + Drawer, } export default { diff --git a/components/input-number/index.en-US.md b/components/input-number/index.en-US.md index 5d0e71229..3a3daa9c9 100644 --- a/components/input-number/index.en-US.md +++ b/components/input-number/index.en-US.md @@ -6,7 +6,7 @@ | defaultValue | initial value | number | | | disabled | disable the input | boolean | false | | formatter | Specifies the format of the value presented | function(value: number \| string): string | - | -| max | max vale | number | Infinity | +| max | max value | number | Infinity | | min | min value | number | -Infinity | | parser | Specifies the value extracted from formatter | function( string): number | - | | precision | precision of input value | number | - | diff --git a/components/input-number/style/index.js b/components/input-number/style/index.js index cf31ed80f..3a3ab0de5 100644 --- a/components/input-number/style/index.js +++ b/components/input-number/style/index.js @@ -1,2 +1,2 @@ -import '../../style/index.less' -import './index.less' +import '../../style/index.less'; +import './index.less'; diff --git a/components/input-number/style/index.less b/components/input-number/style/index.less index f865df881..538721bc1 100644 --- a/components/input-number/style/index.less +++ b/components/input-number/style/index.less @@ -60,7 +60,6 @@ .disabled(); .@{input-number-prefix-cls}-input { cursor: not-allowed; - background-color: @disabled-bg; } .@{input-number-prefix-cls}-handler-wrap { display: none; @@ -74,17 +73,11 @@ -moz-appearance: textfield; height: @input-height-base - 2px; transition: all 0.3s linear; - color: @input-color; - background-color: @input-bg; + background-color: transparent; border: 0; border-radius: @border-radius-base; padding: 0 @control-padding-horizontal - 1px; - display: block; .placeholder(); - - &[disabled] { - .disabled(); - } } &-lg { @@ -116,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 { diff --git a/components/input/Group.jsx b/components/input/Group.jsx index e25683749..866700a1f 100644 --- a/components/input/Group.jsx +++ b/components/input/Group.jsx @@ -27,8 +27,9 @@ export default { methods: { }, render () { + const { $listeners } = this return ( - + {filterEmpty(this.$slots.default)} ) diff --git a/components/input/Input.jsx b/components/input/Input.jsx index c1c7c9861..e06fec3e2 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -113,25 +113,16 @@ export default { [`${props.prefixCls}-group-wrapper-sm`]: props.size === 'small', [`${props.prefixCls}-group-wrapper-lg`]: props.size === 'large', }) - if (addonBefore || addonAfter) { - return ( - - - {addonBefore} - {children} - {addonAfter} - - - ) - } return ( - - {addonBefore} - {children} - {addonAfter} + + + {addonBefore} + {children} + {addonAfter} + ) }, diff --git a/components/input/Search.jsx b/components/input/Search.jsx index f62f07bcf..80b3e0720 100644 --- a/components/input/Search.jsx +++ b/components/input/Search.jsx @@ -28,7 +28,7 @@ export default { }, methods: { onSearch (e) { - this.$emit('search', this.$refs.input.stateValue) + this.$emit('search', this.$refs.input.stateValue, e) this.$refs.input.focus() }, focus () { @@ -39,38 +39,35 @@ export default { this.$refs.input.blur() }, getButtonOrIcon () { - const { prefixCls, size } = this + const { prefixCls, size, disabled } = this const enterButton = getComponentFromProp(this, 'enterButton') - if (!enterButton) { - return - } const enterButtonAsElement = Array.isArray(enterButton) ? enterButton[0] : enterButton - if (enterButtonAsElement.componentOptions && enterButtonAsElement.componentOptions.Ctor.extendOptions.__ANT_BUTTON) { - return cloneElement(enterButtonAsElement, { + let node + if (!enterButton) { + node = + } else if (enterButtonAsElement.tag === 'button' || (enterButtonAsElement.componentOptions && enterButtonAsElement.componentOptions.Ctor.extendOptions.__ANT_BUTTON)) { + node = cloneElement(enterButtonAsElement, { class: `${prefixCls}-button`, props: { size }, - on: { - click: this.onSearch, - }, - }) - } else if (enterButtonAsElement.tag === 'button') { - return cloneElement(enterButtonAsElement, { - on: { - click: this.onSearch, - }, }) + } else { + node = ( + + ) } - return ( - - ) + return cloneElement(node, { + on: { + click: this.onSearch, + }, + }) }, }, render () { @@ -84,6 +81,8 @@ export default { [`${prefixCls}-enter-button`]: !!enterButton, [`${prefixCls}-${size}`]: !!size, }) + const on = { ...this.$listeners } + delete on.search const inputProps = { props: { ...others, @@ -93,8 +92,8 @@ export default { }, attrs: this.$attrs, on: { - ...this.$listeners, pressEnter: this.onSearch, + ...on, }, } return ( diff --git a/components/input/__tests__/Search.test.js b/components/input/__tests__/Search.test.js index e17c538ed..e3e654145 100644 --- a/components/input/__tests__/Search.test.js +++ b/components/input/__tests__/Search.test.js @@ -11,7 +11,7 @@ describe('Input.Search', () => { it('should support custom button', async () => { const wrapper = mount({ render () { - return ok} /> + return ok} /> }, }, { sync: false }) await asyncExpect(() => { diff --git a/components/input/__tests__/__snapshots__/Search.test.js.snap b/components/input/__tests__/__snapshots__/Search.test.js.snap index d3ab8cd48..dae944191 100644 --- a/components/input/__tests__/__snapshots__/Search.test.js.snap +++ b/components/input/__tests__/__snapshots__/Search.test.js.snap @@ -6,4 +6,4 @@ exports[`Input.Search should support custom Button 1`] = ` `; -exports[`Input.Search should support custom button 1`] = ``; +exports[`Input.Search should support custom button 1`] = ``; diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index 1a563a1b1..ffbd984bd 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -6,10 +6,10 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = ` .com
-
+
Http://
-
+
.com
@@ -34,38 +34,38 @@ exports[`renders ./components/input/demo/basic.md correctly 1`] = `

-
+
Zhejiang
-
+
Option1

-
+
Option1-1
- -
+
Between
-
+
Sign Up