diff --git a/components/timepicker/demo/basic.md b/components/timepicker/demo/basic.md
index 5cf74726ca..78c1318b7b 100644
--- a/components/timepicker/demo/basic.md
+++ b/components/timepicker/demo/basic.md
@@ -1,5 +1,4 @@
-基本
-====
+# 基本
- order: 0
diff --git a/components/timepicker/demo/disabled.md b/components/timepicker/demo/disabled.md
index c8f6263367..dc348cb2bd 100644
--- a/components/timepicker/demo/disabled.md
+++ b/components/timepicker/demo/disabled.md
@@ -1,5 +1,4 @@
-禁用
-====
+# 禁用
- order: 4
diff --git a/components/timepicker/demo/no-default-value.md b/components/timepicker/demo/no-default-value.md
index d2006ef903..a539e8ae5d 100644
--- a/components/timepicker/demo/no-default-value.md
+++ b/components/timepicker/demo/no-default-value.md
@@ -1,5 +1,4 @@
-无默认值
-====
+# 无默认值
- order: 5
diff --git a/components/timepicker/demo/size.md b/components/timepicker/demo/size.md
new file mode 100644
index 0000000000..051ad53237
--- /dev/null
+++ b/components/timepicker/demo/size.md
@@ -0,0 +1,19 @@
+# 三种大小
+
+- order: 6
+
+三种大小的输入框,大的用在表单中,中的为默认。
+
+---
+
+````jsx
+import { Timepicker } from 'antd';
+
+ReactDOM.render(
+
+
+
+
+
+, document.getElementById('components-timepicker-demo-size'));
+````
diff --git a/components/timepicker/demo/special-minutes.md b/components/timepicker/demo/special-minutes.md
index 1baa1298a9..42b76c2599 100644
--- a/components/timepicker/demo/special-minutes.md
+++ b/components/timepicker/demo/special-minutes.md
@@ -1,5 +1,4 @@
-特定选项
-====
+# 特定选项
- order: 3
diff --git a/components/timepicker/demo/without-seconds.md b/components/timepicker/demo/without-seconds.md
index 9c61f48f09..7767e651e9 100644
--- a/components/timepicker/demo/without-seconds.md
+++ b/components/timepicker/demo/without-seconds.md
@@ -1,5 +1,4 @@
-不展示秒
-====
+# 不展示秒
- order: 2
diff --git a/components/timepicker/index.jsx b/components/timepicker/index.jsx
index d015140dcd..c3f92d9179 100644
--- a/components/timepicker/index.jsx
+++ b/components/timepicker/index.jsx
@@ -14,31 +14,67 @@ const AntTimepicker = React.createClass({
onChange() {}, // onChange 可用于 Validator
locale: {},
align: {
- offset: [0, -8],
+ offset: [0, -1],
},
open: false,
disabled: false,
hourOptions: undefined,
minuteOptions: undefined,
secondOptions: undefined,
+ size: '',
+ placement: 'bottomLeft',
+ transitionName: 'slide-up',
};
},
- render() {
- const { defaultValue, format, placeholder, align, disabled, hourOptions, minuteOptions, secondOptions } = this.props;
- const prefixCls = 'ant-timepicker';
- const formatter = new DateTimeFormat(format);
+ /**
+ * 获得输入框的 className
+ */
+ getSizeClass() {
+ let sizeClass = '';
+ if (this.props.size === 'large') {
+ sizeClass = ' ant-input-lg';
+ } else if (this.props.size === 'small') {
+ sizeClass = ' ant-input-sm';
+ }
+ return sizeClass;
+ },
- let showValue = undefined;
+ /**
+ * 获得输入框的默认值
+ */
+ getDefaultValue(formatter) {
+ const defaultValue = this.props.defaultValue;
if (defaultValue) {
- showValue = formatter.parse(defaultValue, {
+ return formatter.parse(defaultValue, {
locale: defaultValue.locale,
obeyCount: true,
});
}
+ return undefined;
+ },
+
+ render() {
+ const { format, placeholder, align, disabled, hourOptions, minuteOptions, secondOptions, placement, transitionName } = this.props;
+ const prefixCls = 'ant-timepicker';
+ const formatter = new DateTimeFormat(format);
return (
-
+
);
}
diff --git a/components/timepicker/index.md b/components/timepicker/index.md
index fa08e75724..2776d84622 100644
--- a/components/timepicker/index.md
+++ b/components/timepicker/index.md
@@ -1,5 +1,4 @@
-Timepicker
-==========
+# Timepicker
- category: Components
- chinese: 时间选择框
@@ -30,5 +29,8 @@ API
| hourOptions | 特定可选择的小时 | array | 0 到 24 组成的数组 |
| minuteOptions | 特定可选择的分钟 | array | 0 到 60 组成的数组 |
| secondOptions | 特定可选择的秒 | array | 0 到 60 组成的数组 |
+| inputClassName | 输入框的样式 | string | |
+| placement | 显示位置 | string | bottomLeft |
+| transitionName | 显示动画 | string | slide-up |
diff --git a/package.json b/package.json
index cf89fc828b..b27f9d19a5 100644
--- a/package.json
+++ b/package.json
@@ -57,7 +57,7 @@
"rc-switch": "~1.3.1",
"rc-table": "~3.6.1",
"rc-tabs": "~5.5.0",
- "rc-time-picker": "~0.5.2",
+ "rc-time-picker": "~0.5.4",
"rc-tooltip": "~3.2.0",
"rc-tree": "~0.19.0",
"rc-trigger": "~1.0.6",
diff --git a/style/components/datepicker/Picker.less b/style/components/datepicker/Picker.less
index a63b30f950..3e773d2015 100644
--- a/style/components/datepicker/Picker.less
+++ b/style/components/datepicker/Picker.less
@@ -1,4 +1,4 @@
-.@{calendar-prefix-cls}-picker-container {
+.@{calendar-prefix-cls}-picker-container {
position: absolute;
z-index: 1070;
diff --git a/style/components/timepicker.less b/style/components/timepicker.less
index 393f4ee611..84a5821b5a 100644
--- a/style/components/timepicker.less
+++ b/style/components/timepicker.less
@@ -1,7 +1,6 @@
@timepicker-prefix-cls: ant-timepicker;
.@{timepicker-prefix-cls} {
- display: inline;
box-sizing: border-box;
* {
box-sizing: border-box;
@@ -9,6 +8,6 @@
}
@import "timepicker/Picker";
-@import "timepicker/TimePanel";
+@import "timepicker/Panel";
@import "timepicker/Header";
@import "timepicker/Select";
diff --git a/style/components/timepicker/TimePanel.less b/style/components/timepicker/Panel.less
similarity index 100%
rename from style/components/timepicker/TimePanel.less
rename to style/components/timepicker/Panel.less
diff --git a/style/components/timepicker/Picker.less b/style/components/timepicker/Picker.less
index 078ce8c579..a64abba94c 100644
--- a/style/components/timepicker/Picker.less
+++ b/style/components/timepicker/Picker.less
@@ -1,3 +1,32 @@
+.@{timepicker-prefix-cls}-picker-container {
+ z-index: 1070;
+ position: absolute;
+
+ &.slide-up-enter.slide-up-enter-active&-placement-topLeft,
+ &.slide-up-enter.slide-up-enter-active&-placement-topRight,
+ &.slide-up-appear.slide-up-appear-active&-placement-topLeft,
+ &.slide-up-appear.slide-up-appear-active&-placement-topRight {
+ animation-name: antSlideDownIn;
+ }
+
+ &.slide-up-enter.slide-up-enter-active&-placement-bottomLeft,
+ &.slide-up-enter.slide-up-enter-active&-placement-bottomRight,
+ &.slide-up-appear.slide-up-appear-active&-placement-bottomLeft,
+ &.slide-up-appear.slide-up-appear-active&-placement-bottomRight {
+ animation-name: antSlideUpIn;
+ }
+
+ &.slide-up-leave.slide-up-leave-active&-placement-topLeft,
+ &.slide-up-leave.slide-up-leave-active&-placement-topRight {
+ animation-name: antSlideDownOut;
+ }
+
+ &.slide-up-leave.slide-up-leave-active&-placement-bottomLeft,
+ &.slide-up-leave.slide-up-leave-active&-placement-bottomRight {
+ animation-name: antSlideUpOut;
+ }
+}
+
.@{timepicker-prefix-cls}-picker {
position: relative;
display: inline-block;
@@ -6,7 +35,6 @@
transition: opacity 0.3s ease;
> input {
- .ant-input;
width: 100px;
}
@@ -26,7 +54,7 @@
top: 50%;
margin-top: -6px;
&:after {
- content: "\e642";
+ content: "\e643";
font-family: "anticon";
font-size: 12px;
color: #999;
diff --git a/style/components/timepicker/Select.less b/style/components/timepicker/Select.less
index 6471213fcb..b7c8dd0991 100644
--- a/style/components/timepicker/Select.less
+++ b/style/components/timepicker/Select.less
@@ -45,6 +45,7 @@
&:hover {
background: tint(@primary-color, 90%);
+ transition: background 0.3s ease;
}
}
}