From 6fa835161fcb7bb293435f0df78c6cc23738766f Mon Sep 17 00:00:00 2001 From: wangxueliang Date: Sat, 15 Dec 2018 15:22:33 +0800 Subject: [PATCH] feat: update dropdown --- .../__tests__/__snapshots__/demo.test.js.snap | 22 ++- components/dropdown/demo/context-menu.md | 4 +- components/dropdown/dropdown-button.jsx | 6 +- components/dropdown/dropdown.jsx | 10 ++ .../__snapshots__/index.test.js.snap | 140 +++++++++--------- .../__tests__/__snapshots__/demo.test.js.snap | 120 ++++++++++----- .../__snapshots__/index.test.js.snap | 10 +- 7 files changed, 194 insertions(+), 118 deletions(-) diff --git a/components/card/__tests__/__snapshots__/demo.test.js.snap b/components/card/__tests__/__snapshots__/demo.test.js.snap index 3f3031211..bcf9e12f0 100644 --- a/components/card/__tests__/__snapshots__/demo.test.js.snap +++ b/components/card/__tests__/__snapshots__/demo.test.js.snap @@ -262,7 +262,7 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
More
-
+
@@ -278,10 +278,15 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
-
-
+
+
+
+
+
+
+
@@ -292,7 +297,7 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
-
+
@@ -308,11 +313,16 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
-
+
+
-
+
+
+
+
+
diff --git a/components/dropdown/demo/context-menu.md b/components/dropdown/demo/context-menu.md index 68268dc84..f605f852c 100644 --- a/components/dropdown/demo/context-menu.md +++ b/components/dropdown/demo/context-menu.md @@ -1,11 +1,11 @@ #### 右键菜单 -默认是移入触发菜单,可以鼠标右键触发。 +默认是移入触发菜单,可以点击鼠标右键触发。 #### Context Menu -The default trigger mode is `hover`, you can change it to `right click`. +The default trigger mode is `hover`, you can change it to `contextMenu`. ```html diff --git a/components/dropdown/dropdown-button.jsx b/components/dropdown/dropdown-button.jsx index 9264a2ea0..85aa140d6 100644 --- a/components/dropdown/dropdown-button.jsx +++ b/components/dropdown/dropdown-button.jsx @@ -1,16 +1,19 @@ import Button from '../button' +import buttonTypes from '../button/buttonTypes' import { ButtonGroupProps } from '../button/button-group' import Dropdown from './dropdown' import PropTypes from '../_util/vue-types' import { hasProp, getComponentFromProp } from '../_util/props-util' import getDropdownProps from './getDropdownProps' +const ButtonTypesProps = buttonTypes() const DropdownProps = getDropdownProps() const ButtonGroup = Button.Group const DropdownButtonProps = { ...ButtonGroupProps, ...DropdownProps, type: PropTypes.oneOf(['primary', 'ghost', 'dashed', 'danger', 'default']).def('default'), + htmlType: ButtonTypesProps.htmlType, disabled: PropTypes.bool, prefixCls: PropTypes.string.def('ant-dropdown-button'), placement: DropdownProps.placement.def('bottomRight'), @@ -33,7 +36,7 @@ export default { }, render () { const { - type, disabled, + type, disabled, htmlType, prefixCls, trigger, align, visible, placement, getPopupContainer, ...restProps @@ -64,6 +67,7 @@ export default { type={type} disabled={disabled} onClick={this.onClick} + htmlType={htmlType} > {this.$slots.default} diff --git a/components/dropdown/dropdown.jsx b/components/dropdown/dropdown.jsx index 8fb5d6771..84b012d3b 100644 --- a/components/dropdown/dropdown.jsx +++ b/components/dropdown/dropdown.jsx @@ -5,6 +5,8 @@ import PropTypes from '../_util/vue-types' import { cloneElement } from '../_util/vnode' import { getOptionProps, getPropsData } from '../_util/props-util' import getDropdownProps from './getDropdownProps' +import Icon from '../icon' + const DropdownProps = getDropdownProps() const Dropdown = { name: 'ADropdown', @@ -43,11 +45,19 @@ const Dropdown = { // menu should be focusable in dropdown defaultly const overlayProps = overlay && getPropsData(overlay) const { selectable = false, focusable = true } = overlayProps || {} + + const expandIcon = ( + + + + ) + const fixedModeOverlay = overlay && overlay.componentOptions ? cloneElement(overlay, { props: { mode: 'vertical', selectable, focusable, + expandIcon, }, }) : overlay const triggerActions = disabled ? [] : trigger diff --git a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap index 43332fdab..a30dedb42 100644 --- a/components/locale-provider/__tests__/__snapshots__/index.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/index.test.js.snap @@ -7212,7 +7212,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
-
ئەیلوول
+
9月
@@ -7223,279 +7223,279 @@ exports[`Locale Provider should display the text as ku-iq 1`] = ` - - - - - - - + + + + + + + - - - - - - - - - - - - + + - - - - - - - - - + + - - - - - - - - - + + - - - - - - - - - + + - - - - - - - - - + + - - - - + +
شیدسچپه
-
-
26
-
-
-
-
-
27
-
-
-
+
28
+
29
+
30
+
31
+
01
+
02
+
03
+
04
+
05
+
06
+
07
+
08
+
09
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
01
+
02
+
03
+
04
+
05
+
06
+
+
07
+
+
+
+
+
08
+
+
+
diff --git a/components/tabs/__tests__/__snapshots__/demo.test.js.snap b/components/tabs/__tests__/__snapshots__/demo.test.js.snap index f5923ec85..dad2040bc 100644 --- a/components/tabs/__tests__/__snapshots__/demo.test.js.snap +++ b/components/tabs/__tests__/__snapshots__/demo.test.js.snap @@ -3,7 +3,7 @@ exports[`renders ./components/tabs/demo/basic.md correctly 1`] = `
-
+
@@ -19,18 +19,22 @@ exports[`renders ./components/tabs/demo/basic.md correctly 1`] = `
-
-
Content of Tab Pane 1
+
+
+
+
Content of Tab Pane 1
+
+
`; exports[`renders ./components/tabs/demo/card.md correctly 1`] = ` -
-
+
+
@@ -46,18 +50,22 @@ exports[`renders ./components/tabs/demo/card.md correctly 1`] = `
-
-
Content of Tab Pane 1
+
+
+
+
Content of Tab Pane 1
+
+
`; exports[`renders ./components/tabs/demo/card-top.md correctly 1`] = `
-
-
+
+
@@ -73,15 +81,19 @@ exports[`renders ./components/tabs/demo/card-top.md correctly 1`] = `
-
+
+
+

Content of Tab Pane 1

Content of Tab Pane 1

Content of Tab Pane 1

+
+
`; @@ -89,8 +101,8 @@ exports[`renders ./components/tabs/demo/card-top.md correctly 1`] = ` exports[`renders ./components/tabs/demo/custom-add-trigger.md correctly 1`] = `
-
-
+
+
@@ -113,12 +125,16 @@ exports[`renders ./components/tabs/demo/custom-add-trigger.md correctly 1`] = `
-
+
+
+
Content of Tab 1 +
+
`; @@ -126,7 +142,7 @@ exports[`renders ./components/tabs/demo/custom-add-trigger.md correctly 1`] = ` exports[`renders ./components/tabs/demo/custom-tab-bar.md correctly 1`] = `
-
+
@@ -142,18 +158,22 @@ exports[`renders ./components/tabs/demo/custom-tab-bar.md correctly 1`] = `
-
-
Content of Tab Pane 1
+
+
+
+
Content of Tab Pane 1
+
+
`; exports[`renders ./components/tabs/demo/disabled.md correctly 1`] = `
-
+
@@ -169,17 +189,21 @@ exports[`renders ./components/tabs/demo/disabled.md correctly 1`] = `
-
-
Tab 1
+
+
+
+
Tab 1
+
+
`; exports[`renders ./components/tabs/demo/editable-card.md correctly 1`] = ` -
-
+
+
@@ -206,19 +230,23 @@ exports[`renders ./components/tabs/demo/editable-card.md correctly 1`] = `
-
+
+
+
Content of Tab 1 +
+
`; exports[`renders ./components/tabs/demo/extra.md correctly 1`] = `
-
+
@@ -235,17 +263,21 @@ exports[`renders ./components/tabs/demo/extra.md correctly 1`] = `
-
-
Content of tab 1
+
+
+
+
Content of tab 1
+
+
`; exports[`renders ./components/tabs/demo/icon.md correctly 1`] = `
-
+
@@ -264,12 +296,16 @@ exports[`renders ./components/tabs/demo/icon.md correctly 1`] = `
-
+
+
+
Tab 2 +
+
`; @@ -277,7 +313,7 @@ exports[`renders ./components/tabs/demo/position.md correctly 1`] = `
-
+
@@ -293,11 +329,15 @@ exports[`renders ./components/tabs/demo/position.md correctly 1`] = `
-
-
Content of Tab 1
+
+
+
+
Content of Tab 1
+
+
`; @@ -306,7 +346,7 @@ exports[`renders ./components/tabs/demo/size.md correctly 1`] = `
-
+
@@ -322,11 +362,15 @@ exports[`renders ./components/tabs/demo/size.md correctly 1`] = `
-
+
+
-
Content of tab 2
+
+
Content of tab 2
+
+
`; @@ -335,7 +379,7 @@ exports[`renders ./components/tabs/demo/slide.md correctly 1`] = `
-
+
@@ -359,8 +403,11 @@ exports[`renders ./components/tabs/demo/slide.md correctly 1`] = `
-
-
Content of tab 1
+
+
+
+
Content of tab 1
+
@@ -372,6 +419,7 @@ exports[`renders ./components/tabs/demo/slide.md correctly 1`] = `
+
`; diff --git a/components/tabs/__tests__/__snapshots__/index.test.js.snap b/components/tabs/__tests__/__snapshots__/index.test.js.snap index c51ecb9bd..61d3f9bd7 100644 --- a/components/tabs/__tests__/__snapshots__/index.test.js.snap +++ b/components/tabs/__tests__/__snapshots__/index.test.js.snap @@ -2,7 +2,7 @@ exports[`Tabs tabPosition remove card 1`] = `
-
+
@@ -17,8 +17,12 @@ exports[`Tabs tabPosition remove card 1`] = `
xxx
-
-
foo
+
+
+
+
foo
+
+
`;