Skip to content

Commit

Permalink
✨ [feature] Added an option (isPopup) [(#2)](lanjingling0510#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanjingling0510 committed Dec 18, 2016
1 parent eab6e29 commit a167120
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 39 deletions.
64 changes: 31 additions & 33 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
v3.0.1 - Sun, 18 Sep 2016 09:37:34 GMT
--------------------------------------

-
-


v3.0.0 - Sun, 18 Sep 2016 09:28:28 GMT
Expand All @@ -13,19 +13,19 @@ v3.0.0 - Sun, 18 Sep 2016 09:28:28 GMT
v2.0.7 - Tue, 13 Sep 2016 04:44:41 GMT
--------------------------------------

-
-


v2.0.7 - Sat, 10 Sep 2016 15:52:02 GMT
--------------------------------------

-
-


v2.0.6 - Sat, 10 Sep 2016 10:23:41 GMT
--------------------------------------

-
-


v2.0.5 - Sat, 10 Sep 2016 10:16:55 GMT
Expand All @@ -37,31 +37,31 @@ v2.0.5 - Sat, 10 Sep 2016 10:16:55 GMT
v2.0.4 - Tue, 12 Jul 2016 09:16:42 GMT
--------------------------------------

-
-


v2.0.3 - Tue, 12 Jul 2016 09:15:00 GMT
--------------------------------------

-
-


v2.0.2 - Tue, 05 Jul 2016 00:48:26 GMT
--------------------------------------

-
-


v2.0.1 - Mon, 04 Jul 2016 14:45:41 GMT
--------------------------------------

-
-


v2.0.0 - Mon, 04 Jul 2016 10:48:22 GMT
--------------------------------------

-
-


v1.0.16 - Mon, 27 Jun 2016 09:08:47 GMT
Expand All @@ -73,7 +73,7 @@ v1.0.16 - Mon, 27 Jun 2016 09:08:47 GMT
v1.0.15 - Sun, 26 Jun 2016 04:09:49 GMT
---------------------------------------

-
-


v1.0.14 - Sun, 26 Jun 2016 03:38:28 GMT
Expand All @@ -85,7 +85,7 @@ v1.0.14 - Sun, 26 Jun 2016 03:38:28 GMT
v1.0.13 - Sun, 26 Jun 2016 03:20:53 GMT
---------------------------------------

-
-


v1.0.12 - Sun, 26 Jun 2016 02:20:39 GMT
Expand All @@ -97,7 +97,7 @@ v1.0.12 - Sun, 26 Jun 2016 02:20:39 GMT
v1.0.11 - Fri, 24 Jun 2016 02:35:43 GMT
---------------------------------------

-
-


v1.0.10 - Fri, 24 Jun 2016 01:55:02 GMT
Expand All @@ -109,13 +109,13 @@ v1.0.10 - Fri, 24 Jun 2016 01:55:02 GMT
v1.0.9 - Fri, 24 Jun 2016 01:33:47 GMT
--------------------------------------

-
-


v1.0.8 - Fri, 24 Jun 2016 01:32:53 GMT
--------------------------------------

-
-


v1.0.7 - Fri, 24 Jun 2016 01:29:41 GMT
Expand All @@ -133,13 +133,13 @@ v1.0.6 - Fri, 24 Jun 2016 01:25:40 GMT
v1.0.5 - Thu, 23 Jun 2016 13:37:16 GMT
--------------------------------------

-
-


v1.0.4 - Thu, 23 Jun 2016 13:34:36 GMT
--------------------------------------

-
-


v1.0.3 - Thu, 23 Jun 2016 13:22:13 GMT
Expand All @@ -151,43 +151,43 @@ v1.0.3 - Thu, 23 Jun 2016 13:22:13 GMT
v1.0.2 - Thu, 23 Jun 2016 13:12:08 GMT
--------------------------------------

-
-


v1.0.14 - Fri, 17 Jun 2016 07:30:27 GMT
---------------------------------------

-
-


v1.0.13 - Fri, 17 Jun 2016 06:26:17 GMT
---------------------------------------

-
-


v1.0.12 - Thu, 16 Jun 2016 15:42:47 GMT
---------------------------------------

-
-


v1.0.11 - Thu, 16 Jun 2016 14:15:13 GMT
---------------------------------------

-
-


v1.0.9 - Thu, 16 Jun 2016 12:47:16 GMT
--------------------------------------

-
-


v1.0.8 - Thu, 16 Jun 2016 12:10:32 GMT
--------------------------------------

-
-


v1.0.7 - Thu, 16 Jun 2016 09:09:24 GMT
Expand All @@ -211,48 +211,46 @@ v1.0.5 - Thu, 16 Jun 2016 08:01:06 GMT
v1.0.4 - Thu, 16 Jun 2016 07:40:50 GMT
--------------------------------------

-
-


v1.0.3 - Thu, 16 Jun 2016 07:40:47 GMT
--------------------------------------

-
-


1.0.3 - Thu, 16 Jun 2016 07:40:35 GMT
-------------------------------------

-
-


v1.0.4 - Thu, 16 Jun 2016 07:21:51 GMT
--------------------------------------

-
-


v1.0.3 - Thu, 16 Jun 2016 06:20:24 GMT
--------------------------------------

-
-


v1.0.2 - Thu, 16 Jun 2016 06:20:14 GMT
--------------------------------------

-
-


v1.0.2 - Thu, 16 Jun 2016 01:29:56 GMT
--------------------------------------

-
-


v1.0.1 - Thu, 16 Jun 2016 01:12:11 GMT
--------------------------------------

-


-
8 changes: 8 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2016 rainie, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ ReactDOM.render(<App />, document.getElementById('react-box'));
## PropTypes

| Property | Type | Default | Description |
|:------------- |:------------- |:-------------- |:---------- |
|:------------- |:------------- |:-------------- |:---------- |
| isPopup | Boolean | true | whether as popup add a overlay |
| isOpen | Boolean | false | whether to open datepicker |
| theme | String | default | theme of datepicker, include 'default', 'dark', 'ios', 'android', 'android-dark' |
| dateFormat | Array | ['YYYY', 'M', 'D'] | according to year, month, day format specified display text. E.g ['YYYY年', 'MM月', 'DD日']|
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import './main.css';
import React from 'react';
import ReactDOM from 'react-dom';
import { convertDate } from '../../lib/time.js';
// import DatePicker from '../../lib/index';
import DatePicker from '../../dist/react-mobile-datepicker.js';
import DatePicker from '../../lib/index';
// import DatePicker from '../../dist/react-mobile-datepicker.js';

window.Perf = require('react-addons-perf');

Expand Down
8 changes: 7 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ function EnhanceDatePicker({ isOpen, ...props }) {
}


function ModalDatePicker(props) {
function ModalDatePicker({ isPopup, ...props }) {
if (!isPopup) {
return <DatePicker {...props} />;
}

return (
<Modal {...props}>
<EnhanceDatePicker />
Expand All @@ -31,6 +35,7 @@ function ModalDatePicker(props) {
}

ModalDatePicker.propTypes = {
isPopup: PropTypes.bool,
isOpen: PropTypes.bool,
theme: PropTypes.string,
value: PropTypes.object,
Expand All @@ -42,6 +47,7 @@ ModalDatePicker.propTypes = {
};

ModalDatePicker.defaultProps = {
isPopup: true,
isOpen: false,
theme: 'default',
value: new Date(),
Expand Down
4 changes: 2 additions & 2 deletions lib/pureRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ export function shallowEqual(prev, next) {
const prevKeys = Object.keys(prev);
const nextKeys = Object.keys(next);

if (prevKeys !== nextKeys) return false;
if (prevKeys.length !== nextKeys.length) return false;

return prevKeys.every((key) => {
return prevKeys.hasOwnProperty(key) && prevKeys[key] === nextKeys[key];
return prev.hasOwnProperty(key) && prev[key] === next[key];
});
}

Expand Down

0 comments on commit a167120

Please sign in to comment.