From 698186d5049c5087978cff02c4ec552260407489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Junges?= Date: Tue, 26 Jan 2016 22:41:27 -0200 Subject: [PATCH] [DatePicker] Added disabled property and example --- .../pages/components/DatePicker/ExampleSimple.jsx | 1 + src/date-picker/date-picker.jsx | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/src/app/components/pages/components/DatePicker/ExampleSimple.jsx b/docs/src/app/components/pages/components/DatePicker/ExampleSimple.jsx index 27bf7e9bda09fd..c4cb0bc4082934 100644 --- a/docs/src/app/components/pages/components/DatePicker/ExampleSimple.jsx +++ b/docs/src/app/components/pages/components/DatePicker/ExampleSimple.jsx @@ -5,6 +5,7 @@ const DatePickerExampleSimple = () => (
+
); diff --git a/src/date-picker/date-picker.jsx b/src/date-picker/date-picker.jsx index 46562797562142..9e40c8c7cb8a6d 100644 --- a/src/date-picker/date-picker.jsx +++ b/src/date-picker/date-picker.jsx @@ -41,6 +41,11 @@ const DatePicker = React.createClass({ */ disableYearSelection: React.PropTypes.bool, + /** + * Disables the DatePicker. + */ + disabled: React.PropTypes.bool, + /** * Used to change the first day of week. It drastically varies from * Saturday to Monday (could even be Friday) between different locales. @@ -163,6 +168,7 @@ const DatePicker = React.createClass({ formatDate: DateTime.format, autoOk: false, disableYearSelection: false, + disabled: false, style: {}, firstDayOfWeek: 0, }; @@ -248,9 +254,10 @@ const DatePicker = React.createClass({ _handleInputTouchTap: function _handleInputTouchTap(event) { if (this.props.onTouchTap) this.props.onTouchTap(event); - setTimeout(() => { - this.openDialog(); - }, 0); + if (!this.props.disabled) + setTimeout(() => { + this.openDialog(); + }, 0); }, _handleWindowKeyUp() {