diff options
-rw-r--r-- | HISTORY.md | 13 | ||||
-rw-r--r-- | README.md | 36 | ||||
-rw-r--r-- | assets/index/Picker.less | 29 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/TimePicker.jsx | 7 | ||||
-rw-r--r-- | src/util/placements.js | 8 |
6 files changed, 69 insertions, 26 deletions
@@ -1,8 +1,17 @@ | |||
1 | History | 1 | # History |
2 | ======= | ||
3 | 2 | ||
4 | --- | 3 | --- |
5 | 4 | ||
5 | 0.5.4 / 2015-11-19 | ||
6 | ------------------ | ||
7 | |||
8 | `update` change value prop to defaultValue. | ||
9 | |||
10 | 0.5.2 / 2015-11-19 | ||
11 | ------------------ | ||
12 | |||
13 | `update` renew placements config. | ||
14 | |||
6 | 0.5.1 / 2015-11-19 | 15 | 0.5.1 / 2015-11-19 |
7 | ------------------ | 16 | ------------------ |
8 | 17 | ||
@@ -1,5 +1,4 @@ | |||
1 | TimePicker | 1 | # TimePicker |
2 | ========== | ||
3 | 2 | ||
4 | React TimePicker | 3 | React TimePicker |
5 | 4 | ||
@@ -25,21 +24,24 @@ API | |||
25 | 24 | ||
26 | ### TimePicker | 25 | ### TimePicker |
27 | 26 | ||
28 | | Name | Type | Default | Description | | 27 | | Name | Type | Default | Description | |
29 | |---------------|----------------------------|-----------------------------------------------|-----------------------------------------------| | 28 | |----------------|----------------------------|-----------------------------------------------|--------------------------------------------------------------------------------------------| |
30 | | prefixCls | String | | prefixCls of this component | | 29 | | prefixCls | String | | prefixCls of this component | |
31 | | locale | Object | import from 'rc-time-picker/lib/locale/en_US' | | | 30 | | locale | Object | import from 'rc-time-picker/lib/locale/en_US' | | |
32 | | disabled | Boolean | false | whether picker is disabled | | 31 | | disabled | Boolean | false | whether picker is disabled | |
33 | | open | Boolean | false | current open state of picker. controlled prop | | 32 | | open | Boolean | false | current open state of picker. controlled prop | |
34 | | value | GregorianCalendar | null | current value like input's value | | 33 | | defaultValue | GregorianCalendar | null | current value like input's value | |
35 | | placeholder | String | '' | time input's placeholder | | 34 | | placeholder | String | '' | time input's placeholder | |
36 | | formatter | GregorianCalendarFormatter | HH:mm:ss or HH:mm or mm:ss | | | 35 | | formatter | GregorianCalendarFormatter | HH:mm:ss or HH:mm or mm:ss | | |
37 | | hourOptions | Array<String> | hour options | | | 36 | | hourOptions | Array<String> | hour options | | |
38 | | minuteOptions | Array<String> | minute options | | | 37 | | minuteOptions | Array<String> | minute options | | |
39 | | secondOptions | Array<String> | second options | | | 38 | | secondOptions | Array<String> | second options | | |
40 | | onChange | Function | null | called when select a different value | | 39 | | onChange | Function | null | called when select a different value | |
41 | | onOpen | Function | null | called when open picker | | 40 | | onOpen | Function | null | called when open picker | |
42 | | onClose | Function | null | called when close picker | | 41 | | onClose | Function | null | called when close picker | |
42 | | inputClassName | String | '' | | | ||
43 | | placement | String | bottomLeft | one of ['left','right','top','bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'] | | ||
44 | | transitionName | String | '' | | | ||
43 | 45 | ||
44 | License | 46 | License |
45 | ------- | 47 | ------- |
diff --git a/assets/index/Picker.less b/assets/index/Picker.less index 769c4b7..507121f 100644 --- a/assets/index/Picker.less +++ b/assets/index/Picker.less | |||
@@ -1,3 +1,32 @@ | |||
1 | .@{prefixClass}-picker-container { | ||
2 | z-index: 1070; | ||
3 | position: absolute; | ||
4 | |||
5 | &.slide-up-enter.slide-up-enter-active&-placement-topLeft, | ||
6 | &.slide-up-enter.slide-up-enter-active&-placement-topRight, | ||
7 | &.slide-up-appear.slide-up-appear-active&-placement-topLeft, | ||
8 | &.slide-up-appear.slide-up-appear-active&-placement-topRight { | ||
9 | animation-name: antSlideDownIn; | ||
10 | } | ||
11 | |||
12 | &.slide-up-enter.slide-up-enter-active&-placement-bottomLeft, | ||
13 | &.slide-up-enter.slide-up-enter-active&-placement-bottomRight, | ||
14 | &.slide-up-appear.slide-up-appear-active&-placement-bottomLeft, | ||
15 | &.slide-up-appear.slide-up-appear-active&-placement-bottomRight { | ||
16 | animation-name: antSlideUpIn; | ||
17 | } | ||
18 | |||
19 | &.slide-up-leave.slide-up-leave-active&-placement-topLeft, | ||
20 | &.slide-up-leave.slide-up-leave-active&-placement-topRight { | ||
21 | animation-name: antSlideDownOut; | ||
22 | } | ||
23 | |||
24 | &.slide-up-leave.slide-up-leave-active&-placement-bottomLeft, | ||
25 | &.slide-up-leave.slide-up-leave-active&-placement-bottomRight { | ||
26 | animation-name: antSlideUpOut; | ||
27 | } | ||
28 | } | ||
29 | |||
1 | .@{prefixClass} { | 30 | .@{prefixClass} { |
2 | &-picker { | 31 | &-picker { |
3 | } | 32 | } |
diff --git a/package.json b/package.json index 437d9b1..563eb5d 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": "0.5.1", | 3 | "version": "0.5.4", |
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 a6ea7a9..98a1754 100644 --- a/src/TimePicker.jsx +++ b/src/TimePicker.jsx | |||
@@ -50,8 +50,11 @@ const Picker = React.createClass({ | |||
50 | 50 | ||
51 | getInitialState() { | 51 | getInitialState() { |
52 | this.savePanelRef = refFn.bind(this, 'panelInstance'); | 52 | this.savePanelRef = refFn.bind(this, 'panelInstance'); |
53 | const { open, value } = this.props; | 53 | const { open, defaultValue } = this.props; |
54 | return { open, value }; | 54 | return { |
55 | open: open, | ||
56 | value: defaultValue, | ||
57 | }; | ||
55 | }, | 58 | }, |
56 | 59 | ||
57 | componentWillReceiveProps(nextProps) { | 60 | componentWillReceiveProps(nextProps) { |
diff --git a/src/util/placements.js b/src/util/placements.js index 2574da1..6760286 100644 --- a/src/util/placements.js +++ b/src/util/placements.js | |||
@@ -6,25 +6,25 @@ const autoAdjustOverflow = { | |||
6 | const targetOffset = [0, 0]; | 6 | const targetOffset = [0, 0]; |
7 | 7 | ||
8 | const placements = { | 8 | const placements = { |
9 | topLeft: { | 9 | bottomLeft: { |
10 | points: ['tl', 'tl'], | 10 | points: ['tl', 'tl'], |
11 | overflow: autoAdjustOverflow, | 11 | overflow: autoAdjustOverflow, |
12 | offset: [0, -3], | 12 | offset: [0, -3], |
13 | targetOffset, | 13 | targetOffset, |
14 | }, | 14 | }, |
15 | topRight: { | 15 | bottomRight: { |
16 | points: ['tr', 'tr'], | 16 | points: ['tr', 'tr'], |
17 | overflow: autoAdjustOverflow, | 17 | overflow: autoAdjustOverflow, |
18 | offset: [0, -3], | 18 | offset: [0, -3], |
19 | targetOffset, | 19 | targetOffset, |
20 | }, | 20 | }, |
21 | bottomRight: { | 21 | topRight: { |
22 | points: ['br', 'br'], | 22 | points: ['br', 'br'], |
23 | overflow: autoAdjustOverflow, | 23 | overflow: autoAdjustOverflow, |
24 | offset: [0, 3], | 24 | offset: [0, 3], |
25 | targetOffset, | 25 | targetOffset, |
26 | }, | 26 | }, |
27 | bottomLeft: { | 27 | topLeft: { |
28 | points: ['bl', 'bl'], | 28 | points: ['bl', 'bl'], |
29 | overflow: autoAdjustOverflow, | 29 | overflow: autoAdjustOverflow, |
30 | offset: [0, 3], | 30 | offset: [0, 3], |