aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Panel.jsx
diff options
context:
space:
mode:
authoryiminghe <yiminghe@gmail.com>2016-10-25 17:34:50 +0800
committerGitHub <noreply@github.com>2016-10-25 17:34:50 +0800
commit5d0443410afb55ab320db946e626f621b64f43b1 (patch)
tree16cdd2ca2bb19b0a898b2b90b313f96a86f8fe79 /src/Panel.jsx
parent9c01af6e34f7d63843bacfcffb8c7ad45d6866cf (diff)
parentb86fe1d16a4ad06951bba9ac2990ec3e4563637a (diff)
downloadtime-picker-5d0443410afb55ab320db946e626f621b64f43b1.tar.gz
time-picker-5d0443410afb55ab320db946e626f621b64f43b1.tar.zst
time-picker-5d0443410afb55ab320db946e626f621b64f43b1.zip
Merge pull request #24 from artemv/addon
feat: 'addon' property support
Diffstat (limited to 'src/Panel.jsx')
-rw-r--r--src/Panel.jsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Panel.jsx b/src/Panel.jsx
index 9066b03..0ed60e9 100644
--- a/src/Panel.jsx
+++ b/src/Panel.jsx
@@ -36,6 +36,7 @@ const Panel = React.createClass({
36 showHour: PropTypes.bool, 36 showHour: PropTypes.bool,
37 showSecond: PropTypes.bool, 37 showSecond: PropTypes.bool,
38 onClear: PropTypes.func, 38 onClear: PropTypes.func,
39 addon: PropTypes.func,
39 }, 40 },
40 41
41 getDefaultProps() { 42 getDefaultProps() {
@@ -47,6 +48,7 @@ const Panel = React.createClass({
47 disabledMinutes: noop, 48 disabledMinutes: noop,
48 disabledSeconds: noop, 49 disabledSeconds: noop,
49 defaultOpenValue: moment(), 50 defaultOpenValue: moment(),
51 addon: noop,
50 }; 52 };
51 }, 53 },
52 54
@@ -79,11 +81,15 @@ const Panel = React.createClass({
79 this.setState({ currentSelectPanel }); 81 this.setState({ currentSelectPanel });
80 }, 82 },
81 83
84 close() {
85 this.props.onEsc();
86 },
87
82 render() { 88 render() {
83 const { 89 const {
84 prefixCls, className, placeholder, disabledHours, disabledMinutes, 90 prefixCls, className, placeholder, disabledHours, disabledMinutes,
85 disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond, 91 disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond,
86 format, defaultOpenValue, clearText, onEsc, 92 format, defaultOpenValue, clearText, onEsc, addon,
87 } = this.props; 93 } = this.props;
88 const { 94 const {
89 value, currentSelectPanel, 95 value, currentSelectPanel,
@@ -133,6 +139,7 @@ const Panel = React.createClass({
133 disabledSeconds={disabledSeconds} 139 disabledSeconds={disabledSeconds}
134 onCurrentSelectPanelChange={this.onCurrentSelectPanelChange} 140 onCurrentSelectPanelChange={this.onCurrentSelectPanelChange}
135 /> 141 />
142 {addon(this)}
136 </div> 143 </div>
137 ); 144 );
138 }, 145 },