Skip to content

Commit a167120

Browse files
✨ [feature] Added an option (isPopup) [(#2)](#2)
1 parent eab6e29 commit a167120

File tree

6 files changed

+52
-39
lines changed

6 files changed

+52
-39
lines changed

CHANGELOG.md

+31-33
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
v3.0.1 - Sun, 18 Sep 2016 09:37:34 GMT
22
--------------------------------------
33

4-
-
4+
-
55

66

77
v3.0.0 - Sun, 18 Sep 2016 09:28:28 GMT
@@ -13,19 +13,19 @@ v3.0.0 - Sun, 18 Sep 2016 09:28:28 GMT
1313
v2.0.7 - Tue, 13 Sep 2016 04:44:41 GMT
1414
--------------------------------------
1515

16-
-
16+
-
1717

1818

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

22-
-
22+
-
2323

2424

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

28-
-
28+
-
2929

3030

3131
v2.0.5 - Sat, 10 Sep 2016 10:16:55 GMT
@@ -37,31 +37,31 @@ v2.0.5 - Sat, 10 Sep 2016 10:16:55 GMT
3737
v2.0.4 - Tue, 12 Jul 2016 09:16:42 GMT
3838
--------------------------------------
3939

40-
-
40+
-
4141

4242

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

46-
-
46+
-
4747

4848

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

52-
-
52+
-
5353

5454

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

58-
-
58+
-
5959

6060

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

64-
-
64+
-
6565

6666

6767
v1.0.16 - Mon, 27 Jun 2016 09:08:47 GMT
@@ -73,7 +73,7 @@ v1.0.16 - Mon, 27 Jun 2016 09:08:47 GMT
7373
v1.0.15 - Sun, 26 Jun 2016 04:09:49 GMT
7474
---------------------------------------
7575

76-
-
76+
-
7777

7878

7979
v1.0.14 - Sun, 26 Jun 2016 03:38:28 GMT
@@ -85,7 +85,7 @@ v1.0.14 - Sun, 26 Jun 2016 03:38:28 GMT
8585
v1.0.13 - Sun, 26 Jun 2016 03:20:53 GMT
8686
---------------------------------------
8787

88-
-
88+
-
8989

9090

9191
v1.0.12 - Sun, 26 Jun 2016 02:20:39 GMT
@@ -97,7 +97,7 @@ v1.0.12 - Sun, 26 Jun 2016 02:20:39 GMT
9797
v1.0.11 - Fri, 24 Jun 2016 02:35:43 GMT
9898
---------------------------------------
9999

100-
-
100+
-
101101

102102

103103
v1.0.10 - Fri, 24 Jun 2016 01:55:02 GMT
@@ -109,13 +109,13 @@ v1.0.10 - Fri, 24 Jun 2016 01:55:02 GMT
109109
v1.0.9 - Fri, 24 Jun 2016 01:33:47 GMT
110110
--------------------------------------
111111

112-
-
112+
-
113113

114114

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

118-
-
118+
-
119119

120120

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

136-
-
136+
-
137137

138138

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

142-
-
142+
-
143143

144144

145145
v1.0.3 - Thu, 23 Jun 2016 13:22:13 GMT
@@ -151,43 +151,43 @@ v1.0.3 - Thu, 23 Jun 2016 13:22:13 GMT
151151
v1.0.2 - Thu, 23 Jun 2016 13:12:08 GMT
152152
--------------------------------------
153153

154-
-
154+
-
155155

156156

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

160-
-
160+
-
161161

162162

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

166-
-
166+
-
167167

168168

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

172-
-
172+
-
173173

174174

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

178-
-
178+
-
179179

180180

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

184-
-
184+
-
185185

186186

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

190-
-
190+
-
191191

192192

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

214-
-
214+
-
215215

216216

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

220-
-
220+
-
221221

222222

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

226-
-
226+
-
227227

228228

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

232-
-
232+
-
233233

234234

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

238-
-
238+
-
239239

240240

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

244-
-
244+
-
245245

246246

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

250-
-
250+
-
251251

252252

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

256-
-
257-
258-
256+
-

LICENSE.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The MIT License (MIT)
2+
Copyright (c) 2016 rainie, Inc.
3+
4+
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:
5+
6+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
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.

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ ReactDOM.render(<App />, document.getElementById('react-box'));
105105
## PropTypes
106106

107107
| Property | Type | Default | Description |
108-
|:------------- |:------------- |:-------------- |:---------- |
108+
|:------------- |:------------- |:-------------- |:---------- |
109+
| isPopup | Boolean | true | whether as popup add a overlay |
109110
| isOpen | Boolean | false | whether to open datepicker |
110111
| theme | String | default | theme of datepicker, include 'default', 'dark', 'ios', 'android', 'android-dark' |
111112
| dateFormat | Array | ['YYYY', 'M', 'D'] | according to year, month, day format specified display text. E.g ['YYYY年', 'MM月', 'DD日']|

examples/basic/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import './main.css';
22
import React from 'react';
33
import ReactDOM from 'react-dom';
44
import { convertDate } from '../../lib/time.js';
5-
// import DatePicker from '../../lib/index';
6-
import DatePicker from '../../dist/react-mobile-datepicker.js';
5+
import DatePicker from '../../lib/index';
6+
// import DatePicker from '../../dist/react-mobile-datepicker.js';
77

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

lib/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ function EnhanceDatePicker({ isOpen, ...props }) {
2222
}
2323

2424

25-
function ModalDatePicker(props) {
25+
function ModalDatePicker({ isPopup, ...props }) {
26+
if (!isPopup) {
27+
return <DatePicker {...props} />;
28+
}
29+
2630
return (
2731
<Modal {...props}>
2832
<EnhanceDatePicker />
@@ -31,6 +35,7 @@ function ModalDatePicker(props) {
3135
}
3236

3337
ModalDatePicker.propTypes = {
38+
isPopup: PropTypes.bool,
3439
isOpen: PropTypes.bool,
3540
theme: PropTypes.string,
3641
value: PropTypes.object,
@@ -42,6 +47,7 @@ ModalDatePicker.propTypes = {
4247
};
4348

4449
ModalDatePicker.defaultProps = {
50+
isPopup: true,
4551
isOpen: false,
4652
theme: 'default',
4753
value: new Date(),

lib/pureRender.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ export function shallowEqual(prev, next) {
33
const prevKeys = Object.keys(prev);
44
const nextKeys = Object.keys(next);
55

6-
if (prevKeys !== nextKeys) return false;
6+
if (prevKeys.length !== nextKeys.length) return false;
77

88
return prevKeys.every((key) => {
9-
return prevKeys.hasOwnProperty(key) && prevKeys[key] === nextKeys[key];
9+
return prev.hasOwnProperty(key) && prev[key] === next[key];
1010
});
1111
}
1212

0 commit comments

Comments
 (0)