aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--HISTORY.md5
-rw-r--r--README.md2
-rw-r--r--package.json2
-rw-r--r--src/TimePicker.jsx35
4 files changed, 36 insertions, 8 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 2436cb8..e18638c 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -2,6 +2,11 @@
2 2
3--- 3---
4 4
52.4.0 / 2017-05-02
6---------------------------
7
8Add `popupClassName` prop.
9
52.3.0 / 2017-03-08 102.3.0 / 2017-03-08
6--------------------------- 11---------------------------
7 12
diff --git a/README.md b/README.md
index 1c44e76..a2758b9 100644
--- a/README.md
+++ b/README.md
@@ -59,6 +59,8 @@ API
59| defaultOpenValue | moment | moment() | default open panel value, used to set utcOffset,locale if value/defaultValue absent | 59| defaultOpenValue | moment | moment() | default open panel value, used to set utcOffset,locale if value/defaultValue absent |
60| value | moment | null | current value | 60| value | moment | null | current value |
61| placeholder | String | '' | time input's placeholder | 61| placeholder | String | '' | time input's placeholder |
62| className | String | '' | time picker className |
63| popupClassName | String | '' | time panel className |
62| showHour | Boolean | true | whether show hour | | 64| showHour | Boolean | true | whether show hour | |
63| showMinute | Boolean | true | whether show minute | 65| showMinute | Boolean | true | whether show minute |
64| showSecond | Boolean | true | whether show second | 66| showSecond | Boolean | true | whether show second |
diff --git a/package.json b/package.json
index fa956bf..d219fab 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
1{ 1{
2 "name": "rc-time-picker", 2 "name": "rc-time-picker",
3 "version": "2.3.5", 3 "version": "2.4.0",
4 "description": "React TimePicker", 4 "description": "React TimePicker",
5 "keywords": [ 5 "keywords": [
6 "react", 6 "react",
diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index 1a3516e..91745c6 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -34,6 +34,7 @@ class Picker extends Component {
34 showSecond: PropTypes.bool, 34 showSecond: PropTypes.bool,
35 style: PropTypes.object, 35 style: PropTypes.object,
36 className: PropTypes.string, 36 className: PropTypes.string,
37 popupClassName: PropTypes.string,
37 disabledHours: PropTypes.func, 38 disabledHours: PropTypes.func,
38 disabledMinutes: PropTypes.func, 39 disabledMinutes: PropTypes.func,
39 disabledSeconds: PropTypes.func, 40 disabledSeconds: PropTypes.func,
@@ -53,6 +54,7 @@ class Picker extends Component {
53 defaultOpen: false, 54 defaultOpen: false,
54 style: {}, 55 style: {},
55 className: '', 56 className: '',
57 popupClassName: '',
56 align: {}, 58 align: {},
57 defaultOpenValue: moment(), 59 defaultOpenValue: moment(),
58 allowEmpty: true, 60 allowEmpty: true,
@@ -183,6 +185,30 @@ class Picker extends Component {
183 ); 185 );
184 } 186 }
185 187
188 getPopupClassName() {
189 const { showHour, showMinute, showSecond, use12Hours, prefixCls } = this.props;
190 let popupClassName = this.props.popupClassName;
191 // Keep it for old compatibility
192 if ((!showHour || !showMinute || !showSecond) && !use12Hours) {
193 popupClassName += ` ${prefixCls}-panel-narrow`;
194 }
195 let selectColumnCount = 0;
196 if (showHour) {
197 selectColumnCount += 1;
198 }
199 if (showMinute) {
200 selectColumnCount += 1;
201 }
202 if (showSecond) {
203 selectColumnCount += 1;
204 }
205 if (use12Hours) {
206 selectColumnCount += 1;
207 }
208 popupClassName += ` ${prefixCls}-panel-column-${selectColumnCount}`;
209 return popupClassName;
210 }
211
186 setOpen(open) { 212 setOpen(open) {
187 const { onOpen, onClose } = this.props; 213 const { onOpen, onClose } = this.props;
188 if (this.state.open !== open) { 214 if (this.state.open !== open) {
@@ -204,15 +230,10 @@ class Picker extends Component {
204 render() { 230 render() {
205 const { 231 const {
206 prefixCls, placeholder, placement, align, 232 prefixCls, placeholder, placement, align,
207 disabled, transitionName, style, className, showHour, 233 disabled, transitionName, style, className, getPopupContainer, name, autoComplete,
208 showMinute, showSecond, getPopupContainer, name, autoComplete,
209 use12Hours,
210 } = this.props; 234 } = this.props;
211 const { open, value } = this.state; 235 const { open, value } = this.state;
212 let popupClassName; 236 const popupClassName = this.getPopupClassName();
213 if ((!showHour || !showMinute || !showSecond) && !use12Hours) {
214 popupClassName = `${prefixCls}-panel-narrow`;
215 }
216 return ( 237 return (
217 <Trigger 238 <Trigger
218 prefixCls={`${prefixCls}-panel`} 239 prefixCls={`${prefixCls}-panel`}