Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-mobile-datepicker

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-mobile-datepicker - npm Package Compare versions

Comparing version 3.0.6 to 3.0.7

.storybook/config.js

9

CHANGELOG.md

@@ -0,1 +1,10 @@

[3.0.7](../../releases/tag/3.0.7) 2017-10-12 08:11:11
---------------------------------------------------------
- [9155be0](../../commit/9155be0) ✨ [feature] update some depend packages(https://github.com/lanjingling0510/react-mobile-datepicker/issues/15)
- [1feaa24](../../commit/1feaa24) 🔧 [config] add react storybook.
- [81dd701](../../commit/81dd701) 🔧 [config] add package-lock.json file.
- [e925080](../../commit/e925080) 📚 [document] edit readme document.
[3.0.6](../../releases/tag/3.0.6) 2017-07-08 20:21:30

@@ -2,0 +11,0 @@ ---------------------------------------------------------

2

config.js

@@ -1,3 +0,3 @@

module.exports = {
module.exports = {
name: 'mobile-datepicker',
};
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('react-dom')) :
typeof define === 'function' && define.amd ? define(['react', 'react-dom'], factory) :
(global.reactMobileDatePicker = factory(global.React,global.ReactDOM));
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('react-dom')) :
typeof define === 'function' && define.amd ? define(['react', 'react-dom'], factory) :
(global.reactMobileDatePicker = factory(global.React,global.ReactDOM));
}(this, (function (React,ReactDOM) { 'use strict';

@@ -15,2 +15,4 @@

style.type = 'text/css';
head.appendChild(style);
if (style.styleSheet){

@@ -21,9 +23,9 @@ style.styleSheet.cssText = css;

}
head.appendChild(style);
return returnValue;
}
var React__default = 'default' in React ? React['default'] : React;
ReactDOM = 'default' in ReactDOM ? ReactDOM['default'] : ReactDOM;
ReactDOM = ReactDOM && ReactDOM.hasOwnProperty('default') ? ReactDOM['default'] : ReactDOM;
__$styleInject(".datepicker-modal {\n position: fixed;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0,0,0,.6);\n z-index: 999;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.datepicker {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n z-index: 1;\n height: 266px;\n font-size: 16px;\n text-align: center;\n font-family: arial,verdana,sans-serif;\n box-sizing: content-box;\n -webkit-font-smoothing: antialiased;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.datepicker .datepicker-header {\n padding: 0 .5em;\n min-height: 2em;\n line-height: 2em;\n font-size: 1.125em;\n display: none;\n}\n\n.datepicker .datepicker-navbar {\n padding: 0 .5em .5em .5em;\n overflow: hidden;\n}\n\n.datepicker .datepicker-navbar-btn {\n height: 2.5em;\n line-height: 2.5em;\n float: right;\n padding: 0 1em;\n cursor: pointer;\n}\n\n.datepicker .datepicker-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n padding: .5em .25em;\n}\n\n.datepicker .datepicker-col-1 {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n margin: 0 .25em;\n}\n\n.datepicker .datepicker-viewport {\n height: 200px;\n position: relative;\n overflow: hidden\n}\n\n.datepicker .datepicker-viewport::after {\n content: '';\n position: absolute;\n z-index: 2;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}\n\n.datepicker .datepicker-wheel {\n position: absolute;\n height: 40px;\n top: 50%;\n margin-top: -20px;\n width: 100%;\n}\n\n.datepicker .datepicker-scroll {\n list-style-type: none\n}\n\n.datepicker .datepicker-scroll>li {\n height: 40px;\n line-height: 40px;\n font-size: 1.375em;\n cursor: pointer;\n}\n\n.datepicker {\n\n /* default */\n\n /* dark */\n\n /* ios */\n\n\n /* android */\n\n /* android-dark */\n}\n\n.datepicker.default {\n background-color: #f7f7f7;\n}\n\n.datepicker.default .datepicker-wheel {\n border-top: 1px solid #4eccc4;\n border-bottom: 1px solid #4eccc4;\n}\n\n.datepicker.default .datepicker-scroll li {\n color: rgb(59, 59, 59);\n}\n\n.datepicker.default .datepicker-scroll li.disabled {\n color: rgb(191, 191, 191);\n}\n\n.datepicker.default .datepicker-navbar-btn {\n color: #4eccc4;\n}\n\n.datepicker.dark {\n background-color: #263238;\n}\n\n.datepicker.dark .datepicker-wheel {\n border-top: 1px solid #50ccc4;\n border-bottom: 1px solid #50ccc4;\n}\n\n.datepicker.dark .datepicker-scroll li {\n color: rgb(201, 203, 204);\n}\n\n.datepicker.dark .datepicker-scroll li.disabled {\n color: rgb(87, 96, 100);\n}\n\n.datepicker.dark .datepicker-navbar-btn {\n color: #50ccc4;\n}\n\n.datepicker.ios {\n background-color: #f7f7f7;\n}\n\n.datepicker.ios .datepicker-col-1 {\n margin: 0;\n}\n\n.datepicker.ios .datepicker-viewport {}\n\n.datepicker.ios .datepicker-viewport::after {\n background: -webkit-linear-gradient(#f7f7f7,rgba(245,245,245,0)52%,rgba(245,245,245,0)48%,#f7f7f7);\n background: linear-gradient(#f7f7f7,rgba(245,245,245,0)52%,rgba(245,245,245,0)48%,#f7f7f7);\n}\n\n.datepicker.ios .datepicker-wheel {\n border-top: 1px solid #dbdbdb;\n border-bottom: 1px solid #dbdbdb;\n}\n\n.datepicker.ios .datepicker-scroll li {\n color: rgb(59, 59, 59);\n}\n\n.datepicker.ios .datepicker-scroll li.disabled {\n color: rgb(191, 191, 191);\n}\n\n.datepicker.ios .datepicker-navbar {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n padding: 0;\n border-bottom: 1px solid #acacac;\n}\n\n.datepicker.ios .datepicker-navbar-btn {\n color: #007aff;\n}\n\n.datepicker.ios .datepicker-navbar-btn:nth-child(2) {\n float: left;\n}\n\n.datepicker.ios .datepicker-content {\n padding-top: 48px;\n}\n\n.datepicker.android, .datepicker.android-dark {\n height: 294px;\n background-color: #f5f5f5;\n}\n\n.datepicker.android .datepicker-header, .datepicker.android-dark .datepicker-header {\n color: #31b6e7;\n border-bottom: 2px solid #31b6e7;\n display: block;\n}\n\n.datepicker.android .datepicker-col-1, .datepicker.android-dark .datepicker-col-1 {\n margin: 0 .625em;\n}\n\n.datepicker.android .datepicker-viewport, .datepicker.android-dark .datepicker-viewport {}\n\n.datepicker.android .datepicker-viewport::after, .datepicker.android-dark .datepicker-viewport::after {\n background-image: -webkit-linear-gradient(#f5f5f5,rgba(245,245,245,0)52%,rgba(245,245,245,0)48%,#f5f5f5);\n background-image: linear-gradient(#f5f5f5,rgba(245,245,245,0)52%,rgba(245,245,245,0)48%,#f5f5f5);\n}\n\n.datepicker.android .datepicker-wheel, .datepicker.android-dark .datepicker-wheel {\n border-top: 2px solid #31b6e7;\n border-bottom: 2px solid #31b6e7;\n}\n\n.datepicker.android .datepicker-scroll li, .datepicker.android-dark .datepicker-scroll li {\n font-size: 1.125em;\n color: rgb(56, 56, 56);\n}\n\n.datepicker.android .datepicker-scroll li.disabled, .datepicker.android-dark .datepicker-scroll li.disabled {\n color: rgb(188, 188, 188);\n}\n\n.datepicker.android .datepicker-navbar, .datepicker.android-dark .datepicker-navbar {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n border-top: 1px solid #d9d4d4;\n padding: 0;\n}\n\n.datepicker.android .datepicker-navbar-btn, .datepicker.android-dark .datepicker-navbar-btn {\n padding: 0;\n color: #000;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n\n.datepicker.android .datepicker-navbar-btn:nth-child(2), .datepicker.android-dark .datepicker-navbar-btn:nth-child(2) {\n border-left: 1px solid #d9d4d4;\n}\n\n.datepicker.android-dark {\n background-color: #292829;\n}\n\n.datepicker.android-dark .datepicker-viewport {}\n\n.datepicker.android-dark .datepicker-viewport::after {\n background-image: -webkit-linear-gradient(#282828,rgba(40,40,40,0)52%,rgba(40,40,40,0)48%,#282828);\n background-image: linear-gradient(#282828,rgba(40,40,40,0)52%,rgba(40,40,40,0)48%,#282828);\n}\n\n.datepicker.android-dark .datepicker-scroll li {\n color: rgb(199, 199, 199);\n}\n\n.datepicker.android-dark .datepicker-scroll li.disabled {\n color: rgb(88, 88, 88);\n}\n\n.datepicker.android-dark .datepicker-navbar {\n border-color: #424542;\n}\n\n.datepicker.android-dark .datepicker-navbar-btn {\n color: #fff;\n}\n\n.datepicker.android-dark .datepicker-navbar-btn:nth-child(2) {\n border-color: #424542;\n}\n", undefined);
__$styleInject(".datepicker-modal {\n position: fixed;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, .6);\n z-index: 999;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.datepicker {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n z-index: 1;\n height: 266px;\n font-size: 16px;\n text-align: center;\n font-family: arial,verdana,sans-serif;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n -webkit-font-smoothing: antialiased;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.datepicker .datepicker-header {\n padding: 0 .5em;\n min-height: 2em;\n line-height: 2em;\n font-size: 1.125em;\n display: none;\n }\n\n.datepicker .datepicker-navbar {\n padding: 0 .5em .5em .5em;\n overflow: hidden;\n }\n\n.datepicker .datepicker-navbar-btn {\n height: 2.5em;\n line-height: 2.5em;\n float: right;\n padding: 0 1em;\n cursor: pointer;\n }\n\n.datepicker .datepicker-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n padding: .5em .25em;\n }\n\n.datepicker .datepicker-col-1 {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n margin: 0 .25em;\n }\n\n.datepicker .datepicker-viewport {\n height: 200px;\n position: relative;\n overflow: hidden\n }\n\n.datepicker .datepicker-viewport::after {\n content: '';\n position: absolute;\n z-index: 2;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}\n\n.datepicker .datepicker-wheel {\n position: absolute;\n height: 40px;\n top: 50%;\n margin-top: -20px;\n width: 100%;\n }\n\n.datepicker .datepicker-scroll {\n list-style-type: none;\n padding: 0\n }\n\n.datepicker .datepicker-scroll>li {\n height: 40px;\n line-height: 40px;\n font-size: 1.375em;\n cursor: pointer;\n}\n\n.datepicker {\n\n /* default */\n}\n\n.datepicker.default {\n background-color: #f7f7f7;\n}\n\n.datepicker.default .datepicker-wheel {\n border-top: 1px solid #4eccc4;\n border-bottom: 1px solid #4eccc4;\n}\n\n.datepicker.default .datepicker-scroll li {\n color: rgb(59, 59, 59);\n }\n\n.datepicker.default .datepicker-scroll li.disabled {\n color: rgb(191, 191, 191);\n }\n\n.datepicker.default .datepicker-navbar-btn {\n color: #4eccc4;\n}\n\n.datepicker {\n\n /* dark */\n}\n\n.datepicker.dark {\n background-color: #263238;\n}\n\n.datepicker.dark .datepicker-wheel {\n border-top: 1px solid #50ccc4;\n border-bottom: 1px solid #50ccc4;\n}\n\n.datepicker.dark .datepicker-scroll li {\n color: rgb(201, 203, 204);\n }\n\n.datepicker.dark .datepicker-scroll li.disabled {\n color: rgb(87, 96, 100);\n }\n\n.datepicker.dark .datepicker-navbar-btn {\n color: #50ccc4;\n}\n\n.datepicker {\n\n /* ios */\n}\n\n.datepicker.ios {\n background-color: #f7f7f7;\n}\n\n.datepicker.ios .datepicker-col-1 {margin: 0;\n}\n\n.datepicker.ios .datepicker-viewport::after {\n background: -webkit-gradient(linear,left top, left bottom,from(#f7f7f7),color-stop(52%, rgba(245, 245, 245, 0)),color-stop(48%, rgba(245, 245, 245, 0)),to(#f7f7f7));\n background: linear-gradient(#f7f7f7,rgba(245, 245, 245, 0)52%,rgba(245, 245, 245, 0)48%,#f7f7f7);\n}\n\n.datepicker.ios .datepicker-wheel {\n border-top: 1px solid #dbdbdb;\n border-bottom: 1px solid #dbdbdb;\n}\n\n.datepicker.ios .datepicker-scroll li {\n color: rgb(59, 59, 59);\n }\n\n.datepicker.ios .datepicker-scroll li.disabled {\n color: rgb(191, 191, 191);\n }\n\n.datepicker.ios .datepicker-navbar {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n padding: 0;\n border-bottom: 1px solid #acacac;\n}\n\n.datepicker.ios .datepicker-navbar-btn {\n color: #007aff;\n}\n\n.datepicker.ios .datepicker-navbar-btn:nth-child(2) {\n float: left;\n}\n\n.datepicker.ios .datepicker-content {\n padding-top: 48px;\n}\n\n.datepicker {\n\n /* android */\n}\n\n.datepicker.android, .datepicker.android-dark {\n height: 294px;\n background-color: #f5f5f5;\n}\n\n.datepicker.android .datepicker-header, .datepicker.android-dark .datepicker-header {\n color: #31b6e7;\n border-bottom: 2px solid #31b6e7;\n display: block;\n}\n\n.datepicker.android .datepicker-col-1, .datepicker.android-dark .datepicker-col-1 {margin: 0 .625em;\n}\n\n.datepicker.android .datepicker-viewport::after, .datepicker.android-dark .datepicker-viewport::after {\n background-image: -webkit-gradient(linear,left top, left bottom,from(#f5f5f5),color-stop(52%, rgba(245, 245, 245, 0)),color-stop(48%, rgba(245, 245, 245, 0)),to(#f5f5f5));\n background-image: linear-gradient(#f5f5f5,rgba(245, 245, 245, 0)52%,rgba(245, 245, 245, 0)48%,#f5f5f5);\n}\n\n.datepicker.android .datepicker-wheel, .datepicker.android-dark .datepicker-wheel {\n border-top: 2px solid #31b6e7;\n border-bottom: 2px solid #31b6e7;\n}\n\n.datepicker.android .datepicker-scroll li, .datepicker.android-dark .datepicker-scroll li {\n font-size: 1.125em;\n color: rgb(56, 56, 56);\n }\n\n.datepicker.android .datepicker-scroll li.disabled, .datepicker.android-dark .datepicker-scroll li.disabled {\n color: rgb(188, 188, 188);\n }\n\n.datepicker.android .datepicker-navbar, .datepicker.android-dark .datepicker-navbar {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n border-top: 1px solid #d9d4d4;\n padding: 0;\n}\n\n.datepicker.android .datepicker-navbar-btn, .datepicker.android-dark .datepicker-navbar-btn {\n padding: 0;\n color: #000;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n\n.datepicker.android .datepicker-navbar-btn:nth-child(2), .datepicker.android-dark .datepicker-navbar-btn:nth-child(2) {\n border-left: 1px solid #d9d4d4;\n}\n\n.datepicker {\n\n /* android-dark */\n}\n\n.datepicker.android-dark {\n background-color: #292829;\n}\n\n.datepicker.android-dark .datepicker-viewport::after {\n background-image: -webkit-gradient(linear,left top, left bottom,from(#282828),color-stop(52%, rgba(40, 40, 40, 0)),color-stop(48%, rgba(40, 40, 40, 0)),to(#282828));\n background-image: linear-gradient(#282828,rgba(40, 40, 40, 0)52%,rgba(40, 40, 40, 0)48%,#282828);\n}\n\n.datepicker.android-dark .datepicker-scroll li {\n color: rgb(199, 199, 199);\n }\n\n.datepicker.android-dark .datepicker-scroll li.disabled {\n color: rgb(88, 88, 88);\n }\n\n.datepicker.android-dark .datepicker-navbar { border-color: #424542;\n}\n\n.datepicker.android-dark .datepicker-navbar-btn {\n color: #fff;\n}\n\n.datepicker.android-dark .datepicker-navbar-btn:nth-child(2) {\n border-color: #424542;\n}\n", undefined);

@@ -78,3 +80,3 @@ /**

function nextYear(now) {
var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

@@ -87,3 +89,3 @@ throwIfInvalidDate(now);

function nextMonth(now) {
var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

@@ -99,3 +101,3 @@ throwIfInvalidDate(now);

function nextDate(now) {
var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

@@ -108,3 +110,3 @@ throwIfInvalidDate(now);

function nextHour(now) {
var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

@@ -117,3 +119,3 @@ throwIfInvalidDate(now);

function nextMinute(now) {
var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

@@ -126,3 +128,3 @@ throwIfInvalidDate(now);

function nextSecond(now) {
var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

@@ -135,9 +137,9 @@ throwIfInvalidDate(now);

var TimeUtil = Object.freeze({
convertDate: convertDate,
nextYear: nextYear,
nextMonth: nextMonth,
nextDate: nextDate,
nextHour: nextHour,
nextMinute: nextMinute,
nextSecond: nextSecond
convertDate: convertDate,
nextYear: nextYear,
nextMonth: nextMonth,
nextDate: nextDate,
nextHour: nextHour,
nextMinute: nextMinute,
nextSecond: nextSecond
});

@@ -157,4 +159,4 @@

function PureRender(Component) {
Component.prototype.shouldComponentUpdate = function (nextProps, nextState) {
function PureRender(Component$$1) {
Component$$1.prototype.shouldComponentUpdate = function (nextProps, nextState) {
return PureRender.shouldComponentUpdate(nextProps, nextState, this.props, this.state);

@@ -224,2 +226,119 @@ };

var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
function AsyncGenerator(gen) {
var front, back;
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}
function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
}
} catch (err) {
settle("throw", err);
}
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}
this._invoke = send;
if (typeof gen.return !== "function") {
this.return = undefined;
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
}
};
}();
var classCallCheck = function (instance, Constructor) {

@@ -231,2 +350,26 @@ if (!(instance instanceof Constructor)) {

var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var _extends = Object.assign || function (target) {

@@ -246,2 +389,4 @@ for (var i = 1; i < arguments.length; i++) {

var inherits = function (subClass, superClass) {

@@ -263,2 +408,10 @@ if (typeof superClass !== "function" && superClass !== null) {

var objectWithoutProperties = function (obj, keys) {

@@ -284,2 +437,30 @@ var target = {};

var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
/**

@@ -293,3 +474,3 @@ * @module Date组件

var isUndefined = function (val) {
var isUndefined = function isUndefined(val) {
return typeof val === 'undefined';

@@ -303,3 +484,3 @@ };

*/
var getTimeType = function (format) {
var getTimeType = function getTimeType(format) {
var typeMap = {

@@ -329,3 +510,2 @@ Y: 'Year',

*/
var DatePickerItem = function (_Component) {

@@ -337,3 +517,3 @@ inherits(DatePickerItem, _Component);

var _this = possibleConstructorReturn(this, _Component.call(this, props));
var _this = possibleConstructorReturn(this, (DatePickerItem.__proto__ || Object.getPrototypeOf(DatePickerItem)).call(this, props));

@@ -360,286 +540,299 @@ _this.animating = false; // 判断是否在transition过渡动画之中

DatePickerItem.prototype.componentWillMount = function componentWillMount() {
this._iniDates(this.props.value);
};
DatePickerItem.prototype.componentDidMount = function componentDidMount() {
var viewport = this.viewport;
viewport.addEventListener('touchstart', this.handleContentTouch, false);
viewport.addEventListener('touchmove', this.handleContentTouch, false);
viewport.addEventListener('touchend', this.handleContentTouch, false);
viewport.addEventListener('mousedown', this.handleContentMouseDown, false);
};
DatePickerItem.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.value.getTime() === this.props.value.getTime()) {
return;
createClass(DatePickerItem, [{
key: 'componentWillMount',
value: function componentWillMount() {
this._iniDates(this.props.value);
}
this._iniDates(nextProps.value);
this.currentIndex = MIDDLE_INDEX;
this.setState({
translateY: MIDDLE_Y,
marginTop: (this.currentIndex - MIDDLE_INDEX) * DATE_HEIGHT
});
};
/**
* Optimization component, Prevents unnecessary rendering
* Only value or state change should re-rendering
*
* @param {Object} nextProps next props
* @param {Object} nextState next state
* @return {Boolean} Whether re-rendering
*/
DatePickerItem.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
return nextProps.value.getTime() !== this.props.value.getTime() || !shallowEqual(nextState, this.state);
};
DatePickerItem.prototype.componentWillUnmount = function componentWillUnmount() {
var viewport = this.viewport;
viewport.removeEventListener('touchstart', this.handleContentTouch, false);
viewport.removeEventListener('touchmove', this.handleContentTouch, false);
viewport.removeEventListener('touchend', this.handleContentTouch, false);
viewport.removeEventListener('mousedown', this.handleContentMouseDown, false);
};
DatePickerItem.prototype._iniDates = function _iniDates(date) {
var typeName = this.typeName;
var dates = Array.apply(undefined, Array(DATE_LENGTH)).map(function (value, index) {
return TimeUtil['next' + typeName](date, index - MIDDLE_INDEX);
});
this.setState({ dates: dates });
};
DatePickerItem.prototype._updateDates = function _updateDates(direction) {
var typeName = this.typeName;
var dates = this.state.dates;
if (direction === 1) {
this.currentIndex++;
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var viewport = this.viewport;
viewport.addEventListener('touchstart', this.handleContentTouch, false);
viewport.addEventListener('touchmove', this.handleContentTouch, false);
viewport.addEventListener('touchend', this.handleContentTouch, false);
viewport.addEventListener('mousedown', this.handleContentMouseDown, false);
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (nextProps.value.getTime() === this.props.value.getTime()) {
return;
}
this._iniDates(nextProps.value);
this.currentIndex = MIDDLE_INDEX;
this.setState({
dates: [].concat(dates.slice(1), [TimeUtil['next' + typeName](dates[dates.length - 1], 1)]),
translateY: MIDDLE_Y,
marginTop: (this.currentIndex - MIDDLE_INDEX) * DATE_HEIGHT
});
} else {
this.currentIndex--;
this.setState({
dates: [TimeUtil['next' + typeName](dates[0], -1)].concat(dates.slice(0, dates.length - 1)),
marginTop: (this.currentIndex - MIDDLE_INDEX) * DATE_HEIGHT
}
/**
* Optimization component, Prevents unnecessary rendering
* Only value or state change should re-rendering
*
* @param {Object} nextProps next props
* @param {Object} nextState next state
* @return {Boolean} Whether re-rendering
*/
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return nextProps.value.getTime() !== this.props.value.getTime() || !shallowEqual(nextState, this.state);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var viewport = this.viewport;
viewport.removeEventListener('touchstart', this.handleContentTouch, false);
viewport.removeEventListener('touchmove', this.handleContentTouch, false);
viewport.removeEventListener('touchend', this.handleContentTouch, false);
viewport.removeEventListener('mousedown', this.handleContentMouseDown, false);
}
}, {
key: '_iniDates',
value: function _iniDates(date) {
var typeName = this.typeName;
var dates = Array.apply(undefined, toConsumableArray(Array(DATE_LENGTH))).map(function (value, index) {
return TimeUtil['next' + typeName](date, index - MIDDLE_INDEX);
});
this.setState({ dates: dates });
}
};
}, {
key: '_updateDates',
value: function _updateDates(direction) {
var typeName = this.typeName;
var dates = this.state.dates;
DatePickerItem.prototype._checkIsUpdateDates = function _checkIsUpdateDates(direction, translateY) {
return direction === 1 ? this.currentIndex * DATE_HEIGHT + DATE_HEIGHT / 2 < -translateY : this.currentIndex * DATE_HEIGHT - DATE_HEIGHT / 2 > -translateY;
};
if (direction === 1) {
this.currentIndex++;
this.setState({
dates: [].concat(toConsumableArray(dates.slice(1)), [TimeUtil['next' + typeName](dates[dates.length - 1], 1)]),
marginTop: (this.currentIndex - MIDDLE_INDEX) * DATE_HEIGHT
});
} else {
this.currentIndex--;
this.setState({
dates: [TimeUtil['next' + typeName](dates[0], -1)].concat(toConsumableArray(dates.slice(0, dates.length - 1))),
marginTop: (this.currentIndex - MIDDLE_INDEX) * DATE_HEIGHT
});
}
}
}, {
key: '_checkIsUpdateDates',
value: function _checkIsUpdateDates(direction, translateY) {
return direction === 1 ? this.currentIndex * DATE_HEIGHT + DATE_HEIGHT / 2 < -translateY : this.currentIndex * DATE_HEIGHT - DATE_HEIGHT / 2 > -translateY;
}
/**
* 清除对象的transition样式
* @param {Dom} obj 指定的对象
* @return {undefined}
*/
/**
* 清除对象的transition样式
* @param {Dom} obj 指定的对象
* @return {undefined}
*/
}, {
key: '_clearTransition',
value: function _clearTransition(obj) {
addPrefixCss(obj, { transition: '' });
}
DatePickerItem.prototype._clearTransition = function _clearTransition(obj) {
addPrefixCss(obj, { transition: '' });
};
/**
* 滑动到下一日期
* @param {number} direction 滑动方向
* @return {undefined}
*/
/**
* 滑动到下一日期
* @param {number} direction 滑动方向
* @return {undefined}
*/
}, {
key: '_moveToNext',
value: function _moveToNext(direction) {
var date = this.state.dates[MIDDLE_INDEX];
var _props = this.props,
max = _props.max,
min = _props.min;
if (direction === -1 && date.getTime() < min.getTime()) {
this._updateDates(1);
} else if (direction === 1 && date.getTime() > max.getTime()) {
this._updateDates(-1);
}
DatePickerItem.prototype._moveToNext = function _moveToNext(direction) {
var date = this.state.dates[MIDDLE_INDEX];
var _props = this.props;
var max = _props.max;
var min = _props.min;
if (direction === -1 && date.getTime() < min.getTime()) {
this._updateDates(1);
} else if (direction === 1 && date.getTime() > max.getTime()) {
this._updateDates(-1);
this._moveTo(this.refs.scroll, this.currentIndex);
}
this._moveTo(this.refs.scroll, this.currentIndex);
};
/**
* 添加滑动动画
* @param {DOM} obj DOM对象
* @param {number} angle 角度
* @return {undefined}
*/
/**
* 添加滑动动画
* @param {DOM} obj DOM对象
* @param {number} angle 角度
* @return {undefined}
*/
}, {
key: '_moveTo',
value: function _moveTo(obj, currentIndex) {
var _this2 = this;
this.animating = true;
DatePickerItem.prototype._moveTo = function _moveTo(obj, currentIndex) {
var _this2 = this;
addPrefixCss(obj, { transition: 'transform .2s ease-out' });
this.animating = true;
this.setState({
translateY: -currentIndex * DATE_HEIGHT
});
addPrefixCss(obj, { transition: 'transform .2s ease-out' });
// NOTE: There is no transitionend, setTimeout is used instead.
setTimeout(function () {
_this2.animating = false;
_this2.props.onSelect(_this2.state.dates[MIDDLE_INDEX]);
_this2._clearTransition(_this2.refs.scroll);
}, 200);
}
}, {
key: 'handleStart',
value: function handleStart(event) {
this.touchY = !isUndefined(event.targetTouches) && !isUndefined(event.targetTouches[0]) ? event.targetTouches[0].pageY : event.pageY;
this.setState({
translateY: -currentIndex * DATE_HEIGHT
});
this.translateY = this.state.translateY;
}
}, {
key: 'handleMove',
value: function handleMove(event) {
var touchY = !isUndefined(event.targetTouches) && !isUndefined(event.targetTouches[0]) ? event.targetTouches[0].pageY : event.pageY;
// NOTE: There is no transitionend, setTimeout is used instead.
setTimeout(function () {
_this2.animating = false;
_this2.props.onSelect(_this2.state.dates[MIDDLE_INDEX]);
_this2._clearTransition(_this2.refs.scroll);
}, 200);
};
var dir = touchY - this.touchY;
var translateY = this.translateY + dir;
var direction = dir > 0 ? -1 : 1;
DatePickerItem.prototype.handleStart = function handleStart(event) {
this.touchY = !isUndefined(event.targetTouches) && !isUndefined(event.targetTouches[0]) ? event.targetTouches[0].pageY : event.pageY;
// 日期最小值,最大值限制
var date = this.state.dates[MIDDLE_INDEX];
var _props2 = this.props,
max = _props2.max,
min = _props2.min;
this.translateY = this.state.translateY;
};
if (date.getTime() < min.getTime() || date.getTime() > max.getTime()) {
return;
}
DatePickerItem.prototype.handleMove = function handleMove(event) {
var touchY = !isUndefined(event.targetTouches) && !isUndefined(event.targetTouches[0]) ? event.targetTouches[0].pageY : event.pageY;
// 检测是否更新日期列表
if (this._checkIsUpdateDates(direction, translateY)) {
this._updateDates(direction);
}
var dir = touchY - this.touchY;
var translateY = this.translateY + dir;
var direction = dir > 0 ? -1 : 1;
// 日期最小值,最大值限制
var date = this.state.dates[MIDDLE_INDEX];
var _props2 = this.props;
var max = _props2.max;
var min = _props2.min;
if (date.getTime() < min.getTime() || date.getTime() > max.getTime()) {
return;
this.setState({ translateY: translateY });
}
// 检测是否更新日期列表
if (this._checkIsUpdateDates(direction, translateY)) {
this._updateDates(direction);
}, {
key: 'handleEnd',
value: function handleEnd(event) {
var touchY = event.pageY || event.changedTouches[0].pageY;
var dir = touchY - this.touchY;
var direction = dir > 0 ? -1 : 1;
this._moveToNext(direction);
}
this.setState({ translateY: translateY });
};
/**
* 滑动日期选择器触屏事件
* @param {Object} event 事件对象
* @return {undefined}
*/
DatePickerItem.prototype.handleEnd = function handleEnd(event) {
var touchY = event.pageY || event.changedTouches[0].pageY;
var dir = touchY - this.touchY;
var direction = dir > 0 ? -1 : 1;
this._moveToNext(direction);
};
}, {
key: 'handleContentTouch',
value: function handleContentTouch(event) {
event.preventDefault();
if (this.animating) return;
if (event.type === 'touchstart') {
this.handleStart(event);
} else if (event.type === 'touchmove') {
this.handleMove(event);
} else if (event.type === 'touchend') {
this.handleEnd(event);
}
}
/**
* 滑动日期选择器触屏事件
* @param {Object} event 事件对象
* @return {undefined}
*/
/**
* 滑动日期选择器鼠标事件
* @param {Object} event 事件对象
* @return {undefined}
*/
DatePickerItem.prototype.handleContentTouch = function handleContentTouch(event) {
event.preventDefault();
if (this.animating) return;
if (event.type === 'touchstart') {
}, {
key: 'handleContentMouseDown',
value: function handleContentMouseDown(event) {
if (this.animating) return;
this.handleStart(event);
} else if (event.type === 'touchmove') {
document.addEventListener('mousemove', this.handleContentMouseMove);
document.addEventListener('mouseup', this.handleContentMouseUp);
}
}, {
key: 'handleContentMouseMove',
value: function handleContentMouseMove(event) {
if (this.animating) return;
this.handleMove(event);
} else if (event.type === 'touchend') {
}
}, {
key: 'handleContentMouseUp',
value: function handleContentMouseUp(event) {
if (this.animating) return;
this.handleEnd(event);
document.removeEventListener('mousemove', this.handleContentMouseMove);
document.removeEventListener('mouseup', this.handleContentMouseUp);
}
};
/**
* 滑动日期选择器鼠标事件
* @param {Object} event 事件对象
* @return {undefined}
*/
/**
* 渲染一个日期DOM对象
* @param {Object} date date数据
* @return {Object} JSX对象
*/
}, {
key: 'renderDatepickerItem',
value: function renderDatepickerItem(date, index) {
var className = date < this.props.min || date > this.props.max ? 'disabled' : '';
DatePickerItem.prototype.handleContentMouseDown = function handleContentMouseDown(event) {
if (this.animating) return;
this.handleStart(event);
document.addEventListener('mousemove', this.handleContentMouseMove);
document.addEventListener('mouseup', this.handleContentMouseUp);
};
return React__default.createElement(
'li',
{
key: index,
className: className },
convertDate(date, this.props.format)
);
}
}, {
key: 'render',
value: function render() {
var _this3 = this;
DatePickerItem.prototype.handleContentMouseMove = function handleContentMouseMove(event) {
if (this.animating) return;
this.handleMove(event);
};
var scrollStyle = formatCss({
transform: 'translateY(' + this.state.translateY + 'px)',
marginTop: this.state.marginTop
});
DatePickerItem.prototype.handleContentMouseUp = function handleContentMouseUp(event) {
if (this.animating) return;
this.handleEnd(event);
document.removeEventListener('mousemove', this.handleContentMouseMove);
document.removeEventListener('mouseup', this.handleContentMouseUp);
};
/**
* 渲染一个日期DOM对象
* @param {Object} date date数据
* @return {Object} JSX对象
*/
DatePickerItem.prototype.renderDatepickerItem = function renderDatepickerItem(date, index) {
var className = date < this.props.min || date > this.props.max ? 'disabled' : '';
return React__default.createElement(
'li',
{
key: index,
className: className },
convertDate(date, this.props.format)
);
};
DatePickerItem.prototype.render = function render() {
var _this3 = this;
var scrollStyle = formatCss({
transform: 'translateY(' + this.state.translateY + 'px)',
marginTop: this.state.marginTop
});
return React__default.createElement(
'div',
{ className: 'datepicker-col-1' },
React__default.createElement(
return React__default.createElement(
'div',
{
ref: function (viewport) {
return _this3.viewport = viewport;
} // eslint-disable-line
, className: 'datepicker-viewport' },
{ className: 'datepicker-col-1' },
React__default.createElement(
'div',
{ className: 'datepicker-wheel' },
{
ref: function ref(viewport) {
return _this3.viewport = viewport;
} // eslint-disable-line
, className: 'datepicker-viewport' },
React__default.createElement(
'ul',
{
ref: 'scroll',
className: 'datepicker-scroll',
style: scrollStyle },
this.state.dates.map(this.renderDatepickerItem)
'div',
{ className: 'datepicker-wheel' },
React__default.createElement(
'ul',
{
ref: 'scroll',
className: 'datepicker-scroll',
style: scrollStyle },
this.state.dates.map(this.renderDatepickerItem)
)
)
)
)
);
};
);
}
}]);
return DatePickerItem;
}(React.Component);
DatePickerItem.propTypes = {
value: React.PropTypes.object,
min: React.PropTypes.object,
max: React.PropTypes.object,
format: React.PropTypes.string,
onSelect: React.PropTypes.func
};
/**

@@ -653,3 +846,2 @@ * @module DatePicker Component

*/
var DatePicker = function (_Component) {

@@ -661,3 +853,3 @@ inherits(DatePicker, _Component);

var _this = possibleConstructorReturn(this, _Component.call(this, props));
var _this = possibleConstructorReturn(this, (DatePicker.__proto__ || Object.getPrototypeOf(DatePicker)).call(this, props));

@@ -673,125 +865,118 @@ _this.state = {

DatePicker.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
// update value of state
var date = nextDate(nextProps.value);
if (date.getTime() !== this.state.value.getTime()) {
this.setState({ value: date });
createClass(DatePicker, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
// update value of state
var date = nextDate(nextProps.value);
if (date.getTime() !== this.state.value.getTime()) {
this.setState({ value: date });
}
}
};
/**
* Optimization component, Prevents unnecessary rendering
* Only props or state change or value before re-rendering
*
* @param {Object} nextProps next props
* @param {Object} nextState next state
* @return {Boolean} Whether re-rendering
*/
/**
* Optimization component, Prevents unnecessary rendering
* Only props or state change or value before re-rendering
*
* @param {Object} nextProps next props
* @param {Object} nextState next state
* @return {Boolean} Whether re-rendering
*/
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
var date = nextDate(nextState.value);
return date.getTime() !== this.state.value.getTime() || PureRender.shouldComponentUpdate(nextProps, nextState, this.props, this.state);
}
DatePicker.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
var date = nextDate(nextState.value);
return date.getTime() !== this.state.value.getTime() || PureRender.shouldComponentUpdate(nextProps, nextState, this.props, this.state);
};
/**
* 点击完成按钮事件
* @return {undefined}
*/
/**
* 点击完成按钮事件
* @return {undefined}
*/
}, {
key: 'handleFinishBtnClick',
value: function handleFinishBtnClick() {
this.props.onSelect(this.state.value);
}
/**
* 选择下一个日期
* @return {undefined}
*/
DatePicker.prototype.handleFinishBtnClick = function handleFinishBtnClick() {
this.props.onSelect(this.state.value);
};
}, {
key: 'handleDateSelect',
value: function handleDateSelect(value) {
this.setState({ value: value });
}
/**
* 选择下一个日期
* @return {undefined}
*/
/**
* render函数
* @return {Object} JSX对象
*/
}, {
key: 'render',
value: function render() {
var _this2 = this;
DatePicker.prototype.handleDateSelect = function handleDateSelect(value) {
this.setState({ value: value });
};
var _props = this.props,
min = _props.min,
max = _props.max,
theme = _props.theme,
dateFormat = _props.dateFormat,
confirmText = _props.confirmText,
cancelText = _props.cancelText,
showFormat = _props.showFormat;
/**
* render函数
* @return {Object} JSX对象
*/
var value = this.state.value;
var themeClassName = ['default', 'dark', 'ios', 'android', 'android-dark'].indexOf(theme) === -1 ? 'default' : theme;
DatePicker.prototype.render = function render() {
var _this2 = this;
var _props = this.props;
var min = _props.min;
var max = _props.max;
var theme = _props.theme;
var dateFormat = _props.dateFormat;
var confirmText = _props.confirmText;
var cancelText = _props.cancelText;
var showFormat = _props.showFormat;
var value = this.state.value;
var themeClassName = ['default', 'dark', 'ios', 'android', 'android-dark'].indexOf(theme) === -1 ? 'default' : theme;
return React__default.createElement(
'div',
{
className: 'datepicker ' + themeClassName },
React__default.createElement(
return React__default.createElement(
'div',
{ className: 'datepicker-header' },
convertDate(value, showFormat)
),
React__default.createElement(
'div',
{ className: 'datepicker-content' },
dateFormat.map(function (format, index) {
return React__default.createElement(DatePickerItem, {
key: index,
value: value,
min: min,
max: max,
format: format,
onSelect: _this2.handleDateSelect });
})
),
React__default.createElement(
'div',
{ className: 'datepicker-navbar' },
{
className: 'datepicker ' + themeClassName },
React__default.createElement(
'a',
{
className: 'datepicker-navbar-btn',
onClick: this.handleFinishBtnClick },
confirmText
'div',
{ className: 'datepicker-header' },
convertDate(value, showFormat)
),
React__default.createElement(
'a',
{
className: 'datepicker-navbar-btn',
onClick: this.props.onCancel },
cancelText
'div',
{ className: 'datepicker-content' },
dateFormat.map(function (format, index) {
return React__default.createElement(DatePickerItem, {
key: index,
value: value,
min: min,
max: max,
format: format,
onSelect: _this2.handleDateSelect });
})
),
React__default.createElement(
'div',
{ className: 'datepicker-navbar' },
React__default.createElement(
'a',
{
className: 'datepicker-navbar-btn',
onClick: this.handleFinishBtnClick },
confirmText
),
React__default.createElement(
'a',
{
className: 'datepicker-navbar-btn',
onClick: this.props.onCancel },
cancelText
)
)
)
);
};
);
}
}]);
return DatePicker;
}(React.Component);
DatePicker.propTypes = {
theme: React.PropTypes.string,
value: React.PropTypes.object,
min: React.PropTypes.object,
max: React.PropTypes.object,
dateFormat: React.PropTypes.array,
showFormat: React.PropTypes.string,
confirmText: React.PropTypes.string,
cancelText: React.PropTypes.string,
onSelect: React.PropTypes.func,
onCancel: React.PropTypes.func
};
var renderSubtreeIntoContainer = ReactDOM.unstable_renderSubtreeIntoContainer;

@@ -804,38 +989,40 @@

classCallCheck(this, Modal);
return possibleConstructorReturn(this, _Component.apply(this, arguments));
return possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).apply(this, arguments));
}
Modal.prototype.componentDidMount = function componentDidMount() {
this._div = document.createElement('div');
this._div.classList.add('Modal-Portal');
document.body.appendChild(this._div);
this.renderPortal(this.props);
};
createClass(Modal, [{
key: 'componentDidMount',
value: function componentDidMount() {
this._div = document.createElement('div');
this._div.classList.add('Modal-Portal');
document.body.appendChild(this._div);
this.renderPortal(this.props);
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(newProps) {
this.renderPortal(newProps);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
ReactDOM.unmountComponentAtNode(this._div);
this._div.parentNode.removeChild(this._div);
}
}, {
key: 'renderPortal',
value: function renderPortal(props) {
var portal = React__default.cloneElement(this.props.children, _extends({}, props, { key: 'portal' }), null);
Modal.prototype.componentWillReceiveProps = function componentWillReceiveProps(newProps) {
this.renderPortal(newProps);
};
Modal.prototype.componentWillUnmount = function componentWillUnmount() {
ReactDOM.unmountComponentAtNode(this._div);
this._div.parentNode.removeChild(this._div);
};
Modal.prototype.renderPortal = function renderPortal(props) {
var portal = React__default.cloneElement(this.props.children, _extends({}, props, { key: 'portal' }), null);
this.portal = renderSubtreeIntoContainer(this, portal, this._div);
};
Modal.prototype.render = function render() {
return React__default.createElement('noscript', null);
};
this.portal = renderSubtreeIntoContainer(this, portal, this._div);
}
}, {
key: 'render',
value: function render() {
return React__default.createElement('noscript', null);
}
}]);
return Modal;
}(React.Component);
Modal.propTypes = {
children: React.PropTypes.node,
isOpen: React.PropTypes.bool
};
Modal.defaultProps = {

@@ -846,4 +1033,4 @@ isOpen: false

function EnhanceDatePicker(_ref) {
var isOpen = _ref.isOpen;
var props = objectWithoutProperties(_ref, ['isOpen']);
var isOpen = _ref.isOpen,
props = objectWithoutProperties(_ref, ['isOpen']);

@@ -867,4 +1054,4 @@ function onModalClose(event) {

function ModalDatePicker(_ref2) {
var isPopup = _ref2.isPopup;
var props = objectWithoutProperties(_ref2, ['isPopup']);
var isPopup = _ref2.isPopup,
props = objectWithoutProperties(_ref2, ['isPopup']);

@@ -882,16 +1069,2 @@ if (!isPopup) {

ModalDatePicker.propTypes = {
isPopup: React.PropTypes.bool,
isOpen: React.PropTypes.bool,
theme: React.PropTypes.string,
value: React.PropTypes.object,
min: React.PropTypes.object,
max: React.PropTypes.object,
dateFormat: React.PropTypes.array,
confirmText: React.PropTypes.string,
cancelText: React.PropTypes.string,
onSelect: React.PropTypes.func,
onCancel: React.PropTypes.func
};
ModalDatePicker.defaultProps = {

@@ -908,4 +1081,4 @@ isPopup: true,

cancelText: '取消',
onSelect: function () {},
onCancel: function () {}
onSelect: function onSelect() {},
onCancel: function onCancel() {}
};

@@ -912,0 +1085,0 @@

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):e.reactMobileDatePicker=t(e.React,e.ReactDOM)}(this,function(e,t){"use strict";function n(e,t){if("undefined"==typeof document)return t;e=e||"";var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");return r.type="text/css",r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e)),n.appendChild(r),t}function r(e){if("[object Date]"!==Object.prototype.toString.call(e,null))throw new Error("参数类型不对")}function o(e,t){return new Date(e,t+1,0).getDate()}function a(e,t){var n=t,r={"M+":e.getMonth()+1,"D+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds()};/(Y+)/.test(t)&&(n=n.replace(RegExp.$1,e.getFullYear().toString().substr(4-RegExp.$1.length)));for(var o in r)new RegExp("("+o+")").test(t)&&(n=n.replace(RegExp.$1,1===RegExp.$1.length?r[o]:("00"+r[o]).substr(r[o].toString().length)));return n}function i(e){var t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];r(e);var n=new Date(e.getFullYear()+t,e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds());return n}function d(e){var t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];r(e);var n=e.getFullYear(),a=e.getMonth()+t,i=Math.min(e.getDate(),o(n,a)),d=new Date(n,a,i,e.getHours(),e.getMinutes(),e.getSeconds());return d}function c(e){var t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];r(e);var n=new Date(e.getTime()+24*t*60*60*1e3);return n}function p(e){var t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];r(e);var n=new Date(e.getTime()+60*t*60*1e3);return n}function s(e){var t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];r(e);var n=new Date(e.getTime()+60*t*1e3);return n}function l(e){var t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];r(e);var n=new Date(e.getTime()+1e3*t);return n}function u(e,t){if(e===t)return!0;var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(function(n){return e.hasOwnProperty(n)&&e[n]===t[n]})}function h(e){e.prototype.shouldComponentUpdate=function(e,t){return h.shouldComponentUpdate(e,t,this.props,this.state)}}function m(e){return e.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()}).replace("-","")}function f(e){var t=["-webkit-","-moz-","-ms-"],n={},r=/transform|transition/;for(var o in e)if(e.hasOwnProperty(o)){var a=e[o];if(r.test(o))for(var i=0;i<t.length;i++){var d=m(t[i]+o);n[d]=a.replace(r,t[i]+"$&")}n[o]=a}return n}function k(e,t){var n=f(t);for(var r in n)n.hasOwnProperty(r)&&(e.style[r]=n[r])}function b(e){function t(e){e.target===e.currentTarget&&r.onCancel()}var n=e.isOpen,r=C(e,["isOpen"]);return v.createElement("div",{style:{display:n?"":"none"},onClick:t,className:"datepicker-modal"},v.createElement(j,r))}function g(e){var t=e.isPopup,n=C(e,["isPopup"]);return t?v.createElement(I,n,v.createElement(b,null)):v.createElement(j,n)}var v="default"in e?e.default:e;t="default"in t?t.default:t,n(".datepicker-modal {\n position: fixed;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0,0,0,.6);\n z-index: 999;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.datepicker {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n z-index: 1;\n height: 266px;\n font-size: 16px;\n text-align: center;\n font-family: arial,verdana,sans-serif;\n box-sizing: content-box;\n -webkit-font-smoothing: antialiased;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.datepicker .datepicker-header {\n padding: 0 .5em;\n min-height: 2em;\n line-height: 2em;\n font-size: 1.125em;\n display: none;\n}\n\n.datepicker .datepicker-navbar {\n padding: 0 .5em .5em .5em;\n overflow: hidden;\n}\n\n.datepicker .datepicker-navbar-btn {\n height: 2.5em;\n line-height: 2.5em;\n float: right;\n padding: 0 1em;\n cursor: pointer;\n}\n\n.datepicker .datepicker-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n padding: .5em .25em;\n}\n\n.datepicker .datepicker-col-1 {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n margin: 0 .25em;\n}\n\n.datepicker .datepicker-viewport {\n height: 200px;\n position: relative;\n overflow: hidden\n}\n\n.datepicker .datepicker-viewport::after {\n content: '';\n position: absolute;\n z-index: 2;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}\n\n.datepicker .datepicker-wheel {\n position: absolute;\n height: 40px;\n top: 50%;\n margin-top: -20px;\n width: 100%;\n}\n\n.datepicker .datepicker-scroll {\n list-style-type: none\n}\n\n.datepicker .datepicker-scroll>li {\n height: 40px;\n line-height: 40px;\n font-size: 1.375em;\n cursor: pointer;\n}\n\n.datepicker {\n\n /* default */\n\n /* dark */\n\n /* ios */\n\n\n /* android */\n\n /* android-dark */\n}\n\n.datepicker.default {\n background-color: #f7f7f7;\n}\n\n.datepicker.default .datepicker-wheel {\n border-top: 1px solid #4eccc4;\n border-bottom: 1px solid #4eccc4;\n}\n\n.datepicker.default .datepicker-scroll li {\n color: rgb(59, 59, 59);\n}\n\n.datepicker.default .datepicker-scroll li.disabled {\n color: rgb(191, 191, 191);\n}\n\n.datepicker.default .datepicker-navbar-btn {\n color: #4eccc4;\n}\n\n.datepicker.dark {\n background-color: #263238;\n}\n\n.datepicker.dark .datepicker-wheel {\n border-top: 1px solid #50ccc4;\n border-bottom: 1px solid #50ccc4;\n}\n\n.datepicker.dark .datepicker-scroll li {\n color: rgb(201, 203, 204);\n}\n\n.datepicker.dark .datepicker-scroll li.disabled {\n color: rgb(87, 96, 100);\n}\n\n.datepicker.dark .datepicker-navbar-btn {\n color: #50ccc4;\n}\n\n.datepicker.ios {\n background-color: #f7f7f7;\n}\n\n.datepicker.ios .datepicker-col-1 {\n margin: 0;\n}\n\n.datepicker.ios .datepicker-viewport {}\n\n.datepicker.ios .datepicker-viewport::after {\n background: -webkit-linear-gradient(#f7f7f7,rgba(245,245,245,0)52%,rgba(245,245,245,0)48%,#f7f7f7);\n background: linear-gradient(#f7f7f7,rgba(245,245,245,0)52%,rgba(245,245,245,0)48%,#f7f7f7);\n}\n\n.datepicker.ios .datepicker-wheel {\n border-top: 1px solid #dbdbdb;\n border-bottom: 1px solid #dbdbdb;\n}\n\n.datepicker.ios .datepicker-scroll li {\n color: rgb(59, 59, 59);\n}\n\n.datepicker.ios .datepicker-scroll li.disabled {\n color: rgb(191, 191, 191);\n}\n\n.datepicker.ios .datepicker-navbar {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n padding: 0;\n border-bottom: 1px solid #acacac;\n}\n\n.datepicker.ios .datepicker-navbar-btn {\n color: #007aff;\n}\n\n.datepicker.ios .datepicker-navbar-btn:nth-child(2) {\n float: left;\n}\n\n.datepicker.ios .datepicker-content {\n padding-top: 48px;\n}\n\n.datepicker.android, .datepicker.android-dark {\n height: 294px;\n background-color: #f5f5f5;\n}\n\n.datepicker.android .datepicker-header, .datepicker.android-dark .datepicker-header {\n color: #31b6e7;\n border-bottom: 2px solid #31b6e7;\n display: block;\n}\n\n.datepicker.android .datepicker-col-1, .datepicker.android-dark .datepicker-col-1 {\n margin: 0 .625em;\n}\n\n.datepicker.android .datepicker-viewport, .datepicker.android-dark .datepicker-viewport {}\n\n.datepicker.android .datepicker-viewport::after, .datepicker.android-dark .datepicker-viewport::after {\n background-image: -webkit-linear-gradient(#f5f5f5,rgba(245,245,245,0)52%,rgba(245,245,245,0)48%,#f5f5f5);\n background-image: linear-gradient(#f5f5f5,rgba(245,245,245,0)52%,rgba(245,245,245,0)48%,#f5f5f5);\n}\n\n.datepicker.android .datepicker-wheel, .datepicker.android-dark .datepicker-wheel {\n border-top: 2px solid #31b6e7;\n border-bottom: 2px solid #31b6e7;\n}\n\n.datepicker.android .datepicker-scroll li, .datepicker.android-dark .datepicker-scroll li {\n font-size: 1.125em;\n color: rgb(56, 56, 56);\n}\n\n.datepicker.android .datepicker-scroll li.disabled, .datepicker.android-dark .datepicker-scroll li.disabled {\n color: rgb(188, 188, 188);\n}\n\n.datepicker.android .datepicker-navbar, .datepicker.android-dark .datepicker-navbar {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n border-top: 1px solid #d9d4d4;\n padding: 0;\n}\n\n.datepicker.android .datepicker-navbar-btn, .datepicker.android-dark .datepicker-navbar-btn {\n padding: 0;\n color: #000;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n\n.datepicker.android .datepicker-navbar-btn:nth-child(2), .datepicker.android-dark .datepicker-navbar-btn:nth-child(2) {\n border-left: 1px solid #d9d4d4;\n}\n\n.datepicker.android-dark {\n background-color: #292829;\n}\n\n.datepicker.android-dark .datepicker-viewport {}\n\n.datepicker.android-dark .datepicker-viewport::after {\n background-image: -webkit-linear-gradient(#282828,rgba(40,40,40,0)52%,rgba(40,40,40,0)48%,#282828);\n background-image: linear-gradient(#282828,rgba(40,40,40,0)52%,rgba(40,40,40,0)48%,#282828);\n}\n\n.datepicker.android-dark .datepicker-scroll li {\n color: rgb(199, 199, 199);\n}\n\n.datepicker.android-dark .datepicker-scroll li.disabled {\n color: rgb(88, 88, 88);\n}\n\n.datepicker.android-dark .datepicker-navbar {\n border-color: #424542;\n}\n\n.datepicker.android-dark .datepicker-navbar-btn {\n color: #fff;\n}\n\n.datepicker.android-dark .datepicker-navbar-btn:nth-child(2) {\n border-color: #424542;\n}\n",void 0);var y=Object.freeze({convertDate:a,nextYear:i,nextMonth:d,nextDate:c,nextHour:p,nextMinute:s,nextSecond:l});h.shouldComponentUpdate=function(e,t,n,r){return!u(n,e)||!u(r,t)};var x=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},C=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},D=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},P=40,E=10,M=Math.floor(E/2),Y=-P*M,S=function(e){return"undefined"==typeof e},O=function(e){var t={Y:"Year",M:"Month",D:"Date",h:"Hour",m:"Minute",s:"Second"};for(var n in t)if(t.hasOwnProperty(n)&&~e.indexOf(n))return t[n];throw new Error("时间格式必须包含 Y, M, D, h, m 或 s字母")},_=function(e){function t(n){x(this,t);var r=D(this,e.call(this,n));return r.animating=!1,r.touchY=0,r.translateY=0,r.currentIndex=M,r.state={translateY:Y,marginTop:(r.currentIndex-M)*P},r.typeName=O(n.format),r.renderDatepickerItem=r.renderDatepickerItem.bind(r),r.handleContentTouch=r.handleContentTouch.bind(r),r.handleContentMouseDown=r.handleContentMouseDown.bind(r),r.handleContentMouseMove=r.handleContentMouseMove.bind(r),r.handleContentMouseUp=r.handleContentMouseUp.bind(r),r}return w(t,e),t.prototype.componentWillMount=function(){this._iniDates(this.props.value)},t.prototype.componentDidMount=function(){var e=this.viewport;e.addEventListener("touchstart",this.handleContentTouch,!1),e.addEventListener("touchmove",this.handleContentTouch,!1),e.addEventListener("touchend",this.handleContentTouch,!1),e.addEventListener("mousedown",this.handleContentMouseDown,!1)},t.prototype.componentWillReceiveProps=function(e){e.value.getTime()!==this.props.value.getTime()&&(this._iniDates(e.value),this.currentIndex=M,this.setState({translateY:Y,marginTop:(this.currentIndex-M)*P}))},t.prototype.shouldComponentUpdate=function(e,t){return e.value.getTime()!==this.props.value.getTime()||!u(t,this.state)},t.prototype.componentWillUnmount=function(){var e=this.viewport;e.removeEventListener("touchstart",this.handleContentTouch,!1),e.removeEventListener("touchmove",this.handleContentTouch,!1),e.removeEventListener("touchend",this.handleContentTouch,!1),e.removeEventListener("mousedown",this.handleContentMouseDown,!1)},t.prototype._iniDates=function(e){var t=this.typeName,n=Array.apply(void 0,Array(E)).map(function(n,r){return y["next"+t](e,r-M)});this.setState({dates:n})},t.prototype._updateDates=function(e){var t=this.typeName,n=this.state.dates;1===e?(this.currentIndex++,this.setState({dates:[].concat(n.slice(1),[y["next"+t](n[n.length-1],1)]),marginTop:(this.currentIndex-M)*P})):(this.currentIndex--,this.setState({dates:[y["next"+t](n[0],-1)].concat(n.slice(0,n.length-1)),marginTop:(this.currentIndex-M)*P}))},t.prototype._checkIsUpdateDates=function(e,t){return 1===e?this.currentIndex*P+P/2<-t:this.currentIndex*P-P/2>-t},t.prototype._clearTransition=function(e){k(e,{transition:""})},t.prototype._moveToNext=function(e){var t=this.state.dates[M],n=this.props,r=n.max,o=n.min;e===-1&&t.getTime()<o.getTime()?this._updateDates(1):1===e&&t.getTime()>r.getTime()&&this._updateDates(-1),this._moveTo(this.refs.scroll,this.currentIndex)},t.prototype._moveTo=function(e,t){var n=this;this.animating=!0,k(e,{transition:"transform .2s ease-out"}),this.setState({translateY:-t*P}),setTimeout(function(){n.animating=!1,n.props.onSelect(n.state.dates[M]),n._clearTransition(n.refs.scroll)},200)},t.prototype.handleStart=function(e){this.touchY=S(e.targetTouches)||S(e.targetTouches[0])?e.pageY:e.targetTouches[0].pageY,this.translateY=this.state.translateY},t.prototype.handleMove=function(e){var t=S(e.targetTouches)||S(e.targetTouches[0])?e.pageY:e.targetTouches[0].pageY,n=t-this.touchY,r=this.translateY+n,o=n>0?-1:1,a=this.state.dates[M],i=this.props,d=i.max,c=i.min;a.getTime()<c.getTime()||a.getTime()>d.getTime()||(this._checkIsUpdateDates(o,r)&&this._updateDates(o),this.setState({translateY:r}))},t.prototype.handleEnd=function(e){var t=e.pageY||e.changedTouches[0].pageY,n=t-this.touchY,r=n>0?-1:1;this._moveToNext(r)},t.prototype.handleContentTouch=function(e){e.preventDefault(),this.animating||("touchstart"===e.type?this.handleStart(e):"touchmove"===e.type?this.handleMove(e):"touchend"===e.type&&this.handleEnd(e))},t.prototype.handleContentMouseDown=function(e){this.animating||(this.handleStart(e),document.addEventListener("mousemove",this.handleContentMouseMove),document.addEventListener("mouseup",this.handleContentMouseUp))},t.prototype.handleContentMouseMove=function(e){this.animating||this.handleMove(e)},t.prototype.handleContentMouseUp=function(e){this.animating||(this.handleEnd(e),document.removeEventListener("mousemove",this.handleContentMouseMove),document.removeEventListener("mouseup",this.handleContentMouseUp))},t.prototype.renderDatepickerItem=function(e,t){var n=e<this.props.min||e>this.props.max?"disabled":"";return v.createElement("li",{key:t,className:n},a(e,this.props.format))},t.prototype.render=function(){var e=this,t=f({transform:"translateY("+this.state.translateY+"px)",marginTop:this.state.marginTop});return v.createElement("div",{className:"datepicker-col-1"},v.createElement("div",{ref:function(t){return e.viewport=t},className:"datepicker-viewport"},v.createElement("div",{className:"datepicker-wheel"},v.createElement("ul",{ref:"scroll",className:"datepicker-scroll",style:t},this.state.dates.map(this.renderDatepickerItem)))))},t}(e.Component);_.propTypes={value:e.PropTypes.object,min:e.PropTypes.object,max:e.PropTypes.object,format:e.PropTypes.string,onSelect:e.PropTypes.func};var j=function(e){function t(n){x(this,t);var r=D(this,e.call(this,n));return r.state={value:c(r.props.value)},r.handleFinishBtnClick=r.handleFinishBtnClick.bind(r),r.handleDateSelect=r.handleDateSelect.bind(r),r}return w(t,e),t.prototype.componentWillReceiveProps=function(e){var t=c(e.value);t.getTime()!==this.state.value.getTime()&&this.setState({value:t})},t.prototype.shouldComponentUpdate=function(e,t){var n=c(t.value);return n.getTime()!==this.state.value.getTime()||h.shouldComponentUpdate(e,t,this.props,this.state)},t.prototype.handleFinishBtnClick=function(){this.props.onSelect(this.state.value)},t.prototype.handleDateSelect=function(e){this.setState({value:e})},t.prototype.render=function(){var e=this,t=this.props,n=t.min,r=t.max,o=t.theme,i=t.dateFormat,d=t.confirmText,c=t.cancelText,p=t.showFormat,s=this.state.value,l=["default","dark","ios","android","android-dark"].indexOf(o)===-1?"default":o;return v.createElement("div",{className:"datepicker "+l},v.createElement("div",{className:"datepicker-header"},a(s,p)),v.createElement("div",{className:"datepicker-content"},i.map(function(t,o){return v.createElement(_,{key:o,value:s,min:n,max:r,format:t,onSelect:e.handleDateSelect})})),v.createElement("div",{className:"datepicker-navbar"},v.createElement("a",{className:"datepicker-navbar-btn",onClick:this.handleFinishBtnClick},d),v.createElement("a",{className:"datepicker-navbar-btn",onClick:this.props.onCancel},c)))},t}(e.Component);j.propTypes={theme:e.PropTypes.string,value:e.PropTypes.object,min:e.PropTypes.object,max:e.PropTypes.object,dateFormat:e.PropTypes.array,showFormat:e.PropTypes.string,confirmText:e.PropTypes.string,cancelText:e.PropTypes.string,onSelect:e.PropTypes.func,onCancel:e.PropTypes.func};var N=t.unstable_renderSubtreeIntoContainer,I=function(e){function n(){return x(this,n),D(this,e.apply(this,arguments))}return w(n,e),n.prototype.componentDidMount=function(){this._div=document.createElement("div"),this._div.classList.add("Modal-Portal"),document.body.appendChild(this._div),this.renderPortal(this.props)},n.prototype.componentWillReceiveProps=function(e){this.renderPortal(e)},n.prototype.componentWillUnmount=function(){t.unmountComponentAtNode(this._div),this._div.parentNode.removeChild(this._div)},n.prototype.renderPortal=function(e){var t=v.cloneElement(this.props.children,T({},e,{key:"portal"}),null);this.portal=N(this,t,this._div)},n.prototype.render=function(){return v.createElement("noscript",null)},n}(e.Component);return I.propTypes={children:e.PropTypes.node,isOpen:e.PropTypes.bool},I.defaultProps={isOpen:!1},g.propTypes={isPopup:e.PropTypes.bool,isOpen:e.PropTypes.bool,theme:e.PropTypes.string,value:e.PropTypes.object,min:e.PropTypes.object,max:e.PropTypes.object,dateFormat:e.PropTypes.array,confirmText:e.PropTypes.string,cancelText:e.PropTypes.string,onSelect:e.PropTypes.func,onCancel:e.PropTypes.func},g.defaultProps={isPopup:!0,isOpen:!1,theme:"default",value:new Date,min:new Date(1970,0,1),max:new Date(2050,0,1),dateFormat:["YYYY","M","D"],showFormat:"YYYY/MM/DD",confirmText:"完成",cancelText:"取消",onSelect:function(){},onCancel:function(){}},g});
//# sourceMappingURL=react-mobile-datepicker.min.js.map
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):e.reactMobileDatePicker=t(e.React,e.ReactDOM)}(this,function(e,t){"use strict";function n(e){if("[object Date]"!==Object.prototype.toString.call(e,null))throw new Error("参数类型不对")}function r(e,t){return new Date(e,t+1,0).getDate()}function a(e,t){var n=t,r={"M+":e.getMonth()+1,"D+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds()};/(Y+)/.test(t)&&(n=n.replace(RegExp.$1,e.getFullYear().toString().substr(4-RegExp.$1.length)));for(var a in r)new RegExp("("+a+")").test(t)&&(n=n.replace(RegExp.$1,1===RegExp.$1.length?r[a]:("00"+r[a]).substr(r[a].toString().length)));return n}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return n(e),new Date(e.getTime()+24*t*60*60*1e3)}function i(e,t){if(e===t)return!0;var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(function(n){return e.hasOwnProperty(n)&&e[n]===t[n]})}function d(e){e.prototype.shouldComponentUpdate=function(e,t){return d.shouldComponentUpdate(e,t,this.props,this.state)}}function c(e){return e.replace(/-([a-z])/g,function(e,t){return t.toUpperCase()}).replace("-","")}function l(e){var t=["-webkit-","-moz-","-ms-"],n={},r=/transform|transition/;for(var a in e)if(e.hasOwnProperty(a)){var o=e[a];if(r.test(a))for(var i=0;i<t.length;i++)n[c(t[i]+a)]=o.replace(r,t[i]+"$&");n[a]=o}return n}function s(e,t){var n=l(t);for(var r in n)n.hasOwnProperty(r)&&(e.style[r]=n[r])}function p(e){var t=e.isOpen,n=g(e,["isOpen"]);return h.createElement("div",{style:{display:t?"":"none"},onClick:function(e){e.target===e.currentTarget&&n.onCancel()},className:"datepicker-modal"},h.createElement(_,n))}function u(e){var t=e.isPopup,n=g(e,["isPopup"]);return t?h.createElement(O,n,h.createElement(p,null)):h.createElement(_,n)}var h="default"in e?e.default:e;t=t&&t.hasOwnProperty("default")?t.default:t,function(e,t){if("undefined"==typeof document)return t;e=e||"";var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}(".datepicker-modal {\n position: fixed;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, .6);\n z-index: 999;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n\n.datepicker {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n z-index: 1;\n height: 266px;\n font-size: 16px;\n text-align: center;\n font-family: arial,verdana,sans-serif;\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n -webkit-font-smoothing: antialiased;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.datepicker .datepicker-header {\n padding: 0 .5em;\n min-height: 2em;\n line-height: 2em;\n font-size: 1.125em;\n display: none;\n }\n\n.datepicker .datepicker-navbar {\n padding: 0 .5em .5em .5em;\n overflow: hidden;\n }\n\n.datepicker .datepicker-navbar-btn {\n height: 2.5em;\n line-height: 2.5em;\n float: right;\n padding: 0 1em;\n cursor: pointer;\n }\n\n.datepicker .datepicker-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n padding: .5em .25em;\n }\n\n.datepicker .datepicker-col-1 {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n margin: 0 .25em;\n }\n\n.datepicker .datepicker-viewport {\n height: 200px;\n position: relative;\n overflow: hidden\n }\n\n.datepicker .datepicker-viewport::after {\n content: '';\n position: absolute;\n z-index: 2;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}\n\n.datepicker .datepicker-wheel {\n position: absolute;\n height: 40px;\n top: 50%;\n margin-top: -20px;\n width: 100%;\n }\n\n.datepicker .datepicker-scroll {\n list-style-type: none;\n padding: 0\n }\n\n.datepicker .datepicker-scroll>li {\n height: 40px;\n line-height: 40px;\n font-size: 1.375em;\n cursor: pointer;\n}\n\n.datepicker {\n\n /* default */\n}\n\n.datepicker.default {\n background-color: #f7f7f7;\n}\n\n.datepicker.default .datepicker-wheel {\n border-top: 1px solid #4eccc4;\n border-bottom: 1px solid #4eccc4;\n}\n\n.datepicker.default .datepicker-scroll li {\n color: rgb(59, 59, 59);\n }\n\n.datepicker.default .datepicker-scroll li.disabled {\n color: rgb(191, 191, 191);\n }\n\n.datepicker.default .datepicker-navbar-btn {\n color: #4eccc4;\n}\n\n.datepicker {\n\n /* dark */\n}\n\n.datepicker.dark {\n background-color: #263238;\n}\n\n.datepicker.dark .datepicker-wheel {\n border-top: 1px solid #50ccc4;\n border-bottom: 1px solid #50ccc4;\n}\n\n.datepicker.dark .datepicker-scroll li {\n color: rgb(201, 203, 204);\n }\n\n.datepicker.dark .datepicker-scroll li.disabled {\n color: rgb(87, 96, 100);\n }\n\n.datepicker.dark .datepicker-navbar-btn {\n color: #50ccc4;\n}\n\n.datepicker {\n\n /* ios */\n}\n\n.datepicker.ios {\n background-color: #f7f7f7;\n}\n\n.datepicker.ios .datepicker-col-1 {margin: 0;\n}\n\n.datepicker.ios .datepicker-viewport::after {\n background: -webkit-gradient(linear,left top, left bottom,from(#f7f7f7),color-stop(52%, rgba(245, 245, 245, 0)),color-stop(48%, rgba(245, 245, 245, 0)),to(#f7f7f7));\n background: linear-gradient(#f7f7f7,rgba(245, 245, 245, 0)52%,rgba(245, 245, 245, 0)48%,#f7f7f7);\n}\n\n.datepicker.ios .datepicker-wheel {\n border-top: 1px solid #dbdbdb;\n border-bottom: 1px solid #dbdbdb;\n}\n\n.datepicker.ios .datepicker-scroll li {\n color: rgb(59, 59, 59);\n }\n\n.datepicker.ios .datepicker-scroll li.disabled {\n color: rgb(191, 191, 191);\n }\n\n.datepicker.ios .datepicker-navbar {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n padding: 0;\n border-bottom: 1px solid #acacac;\n}\n\n.datepicker.ios .datepicker-navbar-btn {\n color: #007aff;\n}\n\n.datepicker.ios .datepicker-navbar-btn:nth-child(2) {\n float: left;\n}\n\n.datepicker.ios .datepicker-content {\n padding-top: 48px;\n}\n\n.datepicker {\n\n /* android */\n}\n\n.datepicker.android, .datepicker.android-dark {\n height: 294px;\n background-color: #f5f5f5;\n}\n\n.datepicker.android .datepicker-header, .datepicker.android-dark .datepicker-header {\n color: #31b6e7;\n border-bottom: 2px solid #31b6e7;\n display: block;\n}\n\n.datepicker.android .datepicker-col-1, .datepicker.android-dark .datepicker-col-1 {margin: 0 .625em;\n}\n\n.datepicker.android .datepicker-viewport::after, .datepicker.android-dark .datepicker-viewport::after {\n background-image: -webkit-gradient(linear,left top, left bottom,from(#f5f5f5),color-stop(52%, rgba(245, 245, 245, 0)),color-stop(48%, rgba(245, 245, 245, 0)),to(#f5f5f5));\n background-image: linear-gradient(#f5f5f5,rgba(245, 245, 245, 0)52%,rgba(245, 245, 245, 0)48%,#f5f5f5);\n}\n\n.datepicker.android .datepicker-wheel, .datepicker.android-dark .datepicker-wheel {\n border-top: 2px solid #31b6e7;\n border-bottom: 2px solid #31b6e7;\n}\n\n.datepicker.android .datepicker-scroll li, .datepicker.android-dark .datepicker-scroll li {\n font-size: 1.125em;\n color: rgb(56, 56, 56);\n }\n\n.datepicker.android .datepicker-scroll li.disabled, .datepicker.android-dark .datepicker-scroll li.disabled {\n color: rgb(188, 188, 188);\n }\n\n.datepicker.android .datepicker-navbar, .datepicker.android-dark .datepicker-navbar {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n border-top: 1px solid #d9d4d4;\n padding: 0;\n}\n\n.datepicker.android .datepicker-navbar-btn, .datepicker.android-dark .datepicker-navbar-btn {\n padding: 0;\n color: #000;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n\n.datepicker.android .datepicker-navbar-btn:nth-child(2), .datepicker.android-dark .datepicker-navbar-btn:nth-child(2) {\n border-left: 1px solid #d9d4d4;\n}\n\n.datepicker {\n\n /* android-dark */\n}\n\n.datepicker.android-dark {\n background-color: #292829;\n}\n\n.datepicker.android-dark .datepicker-viewport::after {\n background-image: -webkit-gradient(linear,left top, left bottom,from(#282828),color-stop(52%, rgba(40, 40, 40, 0)),color-stop(48%, rgba(40, 40, 40, 0)),to(#282828));\n background-image: linear-gradient(#282828,rgba(40, 40, 40, 0)52%,rgba(40, 40, 40, 0)48%,#282828);\n}\n\n.datepicker.android-dark .datepicker-scroll li {\n color: rgb(199, 199, 199);\n }\n\n.datepicker.android-dark .datepicker-scroll li.disabled {\n color: rgb(88, 88, 88);\n }\n\n.datepicker.android-dark .datepicker-navbar { border-color: #424542;\n}\n\n.datepicker.android-dark .datepicker-navbar-btn {\n color: #fff;\n}\n\n.datepicker.android-dark .datepicker-navbar-btn:nth-child(2) {\n border-color: #424542;\n}\n",void 0);var f=Object.freeze({convertDate:a,nextYear:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return n(e),new Date(e.getFullYear()+t,e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds())},nextMonth:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;n(e);var a=e.getFullYear(),o=e.getMonth()+t,i=Math.min(e.getDate(),r(a,o));return new Date(a,o,i,e.getHours(),e.getMinutes(),e.getSeconds())},nextDate:o,nextHour:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return n(e),new Date(e.getTime()+60*t*60*1e3)},nextMinute:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return n(e),new Date(e.getTime()+60*t*1e3)},nextSecond:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return n(e),new Date(e.getTime()+1e3*t)}});d.shouldComponentUpdate=function(e,t,n,r){return!i(n,e)||!i(r,t)};!function(){function e(e){this.value=e}function t(t){function n(a,o){try{var i=t[a](o),d=i.value;d instanceof e?Promise.resolve(d.value).then(function(e){n("next",e)},function(e){n("throw",e)}):r(i.done?"return":"normal",i.value)}catch(e){r("throw",e)}}function r(e,t){switch(e){case"return":a.resolve({value:t,done:!0});break;case"throw":a.reject(t);break;default:a.resolve({value:t,done:!1})}(a=a.next)?n(a.key,a.arg):o=null}var a,o;this._invoke=function(e,t){return new Promise(function(r,i){var d={key:e,arg:t,resolve:r,reject:i,next:null};o?o=o.next=d:(a=o=d,n(e,t))})},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}();var k=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},b=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},g=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},y=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},x=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},w=40,T=Math.floor(5),C=-w*T,D=function(e){return void 0===e},E=function(e){var t={Y:"Year",M:"Month",D:"Date",h:"Hour",m:"Minute",s:"Second"};for(var n in t)if(t.hasOwnProperty(n)&&~e.indexOf(n))return t[n];throw new Error("时间格式必须包含 Y, M, D, h, m 或 s字母")},M=function(e){function t(e){k(this,t);var n=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.animating=!1,n.touchY=0,n.translateY=0,n.currentIndex=T,n.state={translateY:C,marginTop:(n.currentIndex-T)*w},n.typeName=E(e.format),n.renderDatepickerItem=n.renderDatepickerItem.bind(n),n.handleContentTouch=n.handleContentTouch.bind(n),n.handleContentMouseDown=n.handleContentMouseDown.bind(n),n.handleContentMouseMove=n.handleContentMouseMove.bind(n),n.handleContentMouseUp=n.handleContentMouseUp.bind(n),n}return b(t,e),m(t,[{key:"componentWillMount",value:function(){this._iniDates(this.props.value)}},{key:"componentDidMount",value:function(){var e=this.viewport;e.addEventListener("touchstart",this.handleContentTouch,!1),e.addEventListener("touchmove",this.handleContentTouch,!1),e.addEventListener("touchend",this.handleContentTouch,!1),e.addEventListener("mousedown",this.handleContentMouseDown,!1)}},{key:"componentWillReceiveProps",value:function(e){e.value.getTime()!==this.props.value.getTime()&&(this._iniDates(e.value),this.currentIndex=T,this.setState({translateY:C,marginTop:(this.currentIndex-T)*w}))}},{key:"shouldComponentUpdate",value:function(e,t){return e.value.getTime()!==this.props.value.getTime()||!i(t,this.state)}},{key:"componentWillUnmount",value:function(){var e=this.viewport;e.removeEventListener("touchstart",this.handleContentTouch,!1),e.removeEventListener("touchmove",this.handleContentTouch,!1),e.removeEventListener("touchend",this.handleContentTouch,!1),e.removeEventListener("mousedown",this.handleContentMouseDown,!1)}},{key:"_iniDates",value:function(e){var t=this.typeName,n=Array.apply(void 0,x(Array(10))).map(function(n,r){return f["next"+t](e,r-T)});this.setState({dates:n})}},{key:"_updateDates",value:function(e){var t=this.typeName,n=this.state.dates;1===e?(this.currentIndex++,this.setState({dates:[].concat(x(n.slice(1)),[f["next"+t](n[n.length-1],1)]),marginTop:(this.currentIndex-T)*w})):(this.currentIndex--,this.setState({dates:[f["next"+t](n[0],-1)].concat(x(n.slice(0,n.length-1))),marginTop:(this.currentIndex-T)*w}))}},{key:"_checkIsUpdateDates",value:function(e,t){return 1===e?this.currentIndex*w+w/2<-t:this.currentIndex*w-w/2>-t}},{key:"_clearTransition",value:function(e){s(e,{transition:""})}},{key:"_moveToNext",value:function(e){var t=this.state.dates[T],n=this.props,r=n.max,a=n.min;-1===e&&t.getTime()<a.getTime()?this._updateDates(1):1===e&&t.getTime()>r.getTime()&&this._updateDates(-1),this._moveTo(this.refs.scroll,this.currentIndex)}},{key:"_moveTo",value:function(e,t){var n=this;this.animating=!0,s(e,{transition:"transform .2s ease-out"}),this.setState({translateY:-t*w}),setTimeout(function(){n.animating=!1,n.props.onSelect(n.state.dates[T]),n._clearTransition(n.refs.scroll)},200)}},{key:"handleStart",value:function(e){this.touchY=D(e.targetTouches)||D(e.targetTouches[0])?e.pageY:e.targetTouches[0].pageY,this.translateY=this.state.translateY}},{key:"handleMove",value:function(e){var t=(D(e.targetTouches)||D(e.targetTouches[0])?e.pageY:e.targetTouches[0].pageY)-this.touchY,n=this.translateY+t,r=t>0?-1:1,a=this.state.dates[T],o=this.props,i=o.max,d=o.min;a.getTime()<d.getTime()||a.getTime()>i.getTime()||(this._checkIsUpdateDates(r,n)&&this._updateDates(r),this.setState({translateY:n}))}},{key:"handleEnd",value:function(e){var t=(e.pageY||e.changedTouches[0].pageY)-this.touchY>0?-1:1;this._moveToNext(t)}},{key:"handleContentTouch",value:function(e){e.preventDefault(),this.animating||("touchstart"===e.type?this.handleStart(e):"touchmove"===e.type?this.handleMove(e):"touchend"===e.type&&this.handleEnd(e))}},{key:"handleContentMouseDown",value:function(e){this.animating||(this.handleStart(e),document.addEventListener("mousemove",this.handleContentMouseMove),document.addEventListener("mouseup",this.handleContentMouseUp))}},{key:"handleContentMouseMove",value:function(e){this.animating||this.handleMove(e)}},{key:"handleContentMouseUp",value:function(e){this.animating||(this.handleEnd(e),document.removeEventListener("mousemove",this.handleContentMouseMove),document.removeEventListener("mouseup",this.handleContentMouseUp))}},{key:"renderDatepickerItem",value:function(e,t){var n=e<this.props.min||e>this.props.max?"disabled":"";return h.createElement("li",{key:t,className:n},a(e,this.props.format))}},{key:"render",value:function(){var e=this,t=l({transform:"translateY("+this.state.translateY+"px)",marginTop:this.state.marginTop});return h.createElement("div",{className:"datepicker-col-1"},h.createElement("div",{ref:function(t){return e.viewport=t},className:"datepicker-viewport"},h.createElement("div",{className:"datepicker-wheel"},h.createElement("ul",{ref:"scroll",className:"datepicker-scroll",style:t},this.state.dates.map(this.renderDatepickerItem)))))}}]),t}(e.Component),_=function(e){function t(e){k(this,t);var n=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={value:o(n.props.value)},n.handleFinishBtnClick=n.handleFinishBtnClick.bind(n),n.handleDateSelect=n.handleDateSelect.bind(n),n}return b(t,e),m(t,[{key:"componentWillReceiveProps",value:function(e){var t=o(e.value);t.getTime()!==this.state.value.getTime()&&this.setState({value:t})}},{key:"shouldComponentUpdate",value:function(e,t){return o(t.value).getTime()!==this.state.value.getTime()||d.shouldComponentUpdate(e,t,this.props,this.state)}},{key:"handleFinishBtnClick",value:function(){this.props.onSelect(this.state.value)}},{key:"handleDateSelect",value:function(e){this.setState({value:e})}},{key:"render",value:function(){var e=this,t=this.props,n=t.min,r=t.max,o=t.theme,i=t.dateFormat,d=t.confirmText,c=t.cancelText,l=t.showFormat,s=this.state.value,p=-1===["default","dark","ios","android","android-dark"].indexOf(o)?"default":o;return h.createElement("div",{className:"datepicker "+p},h.createElement("div",{className:"datepicker-header"},a(s,l)),h.createElement("div",{className:"datepicker-content"},i.map(function(t,a){return h.createElement(M,{key:a,value:s,min:n,max:r,format:t,onSelect:e.handleDateSelect})})),h.createElement("div",{className:"datepicker-navbar"},h.createElement("a",{className:"datepicker-navbar-btn",onClick:this.handleFinishBtnClick},d),h.createElement("a",{className:"datepicker-navbar-btn",onClick:this.props.onCancel},c)))}}]),t}(e.Component),Y=t.unstable_renderSubtreeIntoContainer,O=function(e){function n(){return k(this,n),y(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return b(n,e),m(n,[{key:"componentDidMount",value:function(){this._div=document.createElement("div"),this._div.classList.add("Modal-Portal"),document.body.appendChild(this._div),this.renderPortal(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.renderPortal(e)}},{key:"componentWillUnmount",value:function(){t.unmountComponentAtNode(this._div),this._div.parentNode.removeChild(this._div)}},{key:"renderPortal",value:function(e){var t=h.cloneElement(this.props.children,v({},e,{key:"portal"}),null);this.portal=Y(this,t,this._div)}},{key:"render",value:function(){return h.createElement("noscript",null)}}]),n}(e.Component);return O.defaultProps={isOpen:!1},u.defaultProps={isPopup:!0,isOpen:!1,theme:"default",value:new Date,min:new Date(1970,0,1),max:new Date(2050,0,1),dateFormat:["YYYY","M","D"],showFormat:"YYYY/MM/DD",confirmText:"完成",cancelText:"取消",onSelect:function(){},onCancel:function(){}},u});
//# sourceMappingURL=dist/react-mobile-datepicker.min.js.map

@@ -5,3 +5,3 @@ /**

import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import DatePickerItem from './DatePickerItem.js';

@@ -11,2 +11,19 @@ import PureRender from './pureRender.js';

type Props = {
theme: string,
value: Object,
min: Object,
max: Object,
dateFormat: Array<*>,
showFormat: string,
confirmText: string,
cancelText: string,
onSelect: Function,
onCancel: Function,
}
type State = {
value: Date,
}
/**

@@ -16,3 +33,3 @@ * Class DatePicker Component Class

*/
class DatePicker extends Component {
class DatePicker extends Component<void, Props, State> {
constructor(props) {

@@ -105,15 +122,2 @@ super(props);

DatePicker.propTypes = {
theme: PropTypes.string,
value: PropTypes.object,
min: PropTypes.object,
max: PropTypes.object,
dateFormat: PropTypes.array,
showFormat: PropTypes.string,
confirmText: PropTypes.string,
cancelText: PropTypes.string,
onSelect: PropTypes.func,
onCancel: PropTypes.func,
};
export default DatePicker;

@@ -5,3 +5,3 @@

*/
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import * as TimeUtil from './time.js';

@@ -44,3 +44,15 @@ import { shallowEqual } from './pureRender.js';

type Props = {
value: Object,
min: Object,
max: Object,
format: string,
onSelect: Function,
}
type State = {
translateY: number,
marginTop: number,
}
/**

@@ -50,3 +62,3 @@ * Class Date组件类

*/
class DatePickerItem extends Component {
class DatePickerItem extends Component<void, Props, State> {
constructor(props) {

@@ -335,10 +347,2 @@ super(props);

DatePickerItem.propTypes = {
value: PropTypes.object,
min: PropTypes.object,
max: PropTypes.object,
format: PropTypes.string,
onSelect: PropTypes.func,
};
export default DatePickerItem;
import './index.css';
import React, { PropTypes } from 'react';
import React from 'react';
import DatePicker from './DatePicker.js';
import Modal from './Modal.js';
type EnhanceDatePickerProps<T> = T & {
isOpen: boolean,
}
function EnhanceDatePicker({ isOpen, ...props }) {
function EnhanceDatePicker<T: *>({ isOpen, ...props }: EnhanceDatePickerProps<T>) {
function onModalClose(event) {

@@ -24,4 +27,7 @@ if (event.target === event.currentTarget) {

type ModalDatePickerProps<T> = T & {
isPopup: boolean,
}
function ModalDatePicker({ isPopup, ...props }) {
function ModalDatePicker<T: *>({ isPopup, ...props }: ModalDatePickerProps<T>) {
if (!isPopup) {

@@ -38,16 +44,2 @@ return <DatePicker {...props} />;

ModalDatePicker.propTypes = {
isPopup: PropTypes.bool,
isOpen: PropTypes.bool,
theme: PropTypes.string,
value: PropTypes.object,
min: PropTypes.object,
max: PropTypes.object,
dateFormat: PropTypes.array,
confirmText: PropTypes.string,
cancelText: PropTypes.string,
onSelect: PropTypes.func,
onCancel: PropTypes.func,
};
ModalDatePicker.defaultProps = {

@@ -54,0 +46,0 @@ isPopup: true,

@@ -1,12 +0,16 @@

import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
const renderSubtreeIntoContainer = ReactDOM.unstable_renderSubtreeIntoContainer;
type Props = {
children: React.Element<*>,
isOpen: boolean,
}
class Modal extends Component {
static propTypes = {
children: PropTypes.node,
isOpen: PropTypes.bool,
}
type DefaultProps = {
isOpen: boolean,
}
class Modal extends Component<DefaultProps, Props, void> {
static defaultProps = {

@@ -13,0 +17,0 @@ isOpen: false,

{
"name": "react-mobile-datepicker",
"version": "3.0.6",
"version": "3.0.7",
"description": "一个移动端时间选择器react组件",

@@ -23,20 +23,22 @@ "main": "./dist/react-mobile-datepicker.js",

"transpile": "rollup -c rollup.config.js -m ${npm_package_main}.map -f umd -n $npm_package_amdName -o $npm_package_main",
"minify": "uglifyjs $npm_package_main -cm -o $npm_package_minified_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_minified_main}.map",
"size": "size=$(gzip-size $npm_package_minified_main | pretty-bytes) && echo \"gzip size: $size\"",
"minify": "uglifyjs $npm_package_main -cm -o $npm_package_minified_main --source-map \"root='${npm_package_main}.map',url='${npm_package_minified_main}.map'\"",
"size": "size=$(gzip-size $npm_package_minified_main) && echo \"gzip size: $size\"",
"start": "webpack-dev-server",
"release": "scripts/release",
"preview-release": "scripts/preview-release",
"mocha": "./node_modules/.bin/mocha --compilers js:babel-core/register --require ./test/helper.js --recursive",
"test": "./node_modules/.bin/nyc npm run mocha",
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls"
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"author": "rainie",
"devDependencies": {
"autoprefixer": "^6.3.6",
"@storybook/addon-info": "^3.2.12",
"@storybook/react": "^3.2.12",
"autoprefixer": "^7.1.5",
"babel-core": "^6.9.0",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.4",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-minimal-rollup": "^2.0.0",
"babel-preset-es2015-rollup": "^3.0.0",
"babel-preset-react": "^6.5.0",

@@ -48,3 +50,4 @@ "babel-preset-stage-0": "^6.5.0",

"cssnext": "^1.8.4",
"enzyme": "^2.3.0",
"enzyme": "^3.1.0",
"enzyme-adapter-react-15": "^1.0.1",
"eslint": "^2.10.2",

@@ -55,4 +58,3 @@ "eslint-config-airbnb": "9.0.1",

"eslint-plugin-react": "^5.1.1",
"extract-text-webpack-plugin": "^1.0.1",
"gzip-size-cli": "^1.0.0",
"gzip-size-cli": "^2.1.0",
"html-webpack-plugin": "^2.21.0",

@@ -64,27 +66,28 @@ "jsdom": "^9.8.3",

"nyc": "^6.6.1",
"postcss": "^5.1.2",
"postcss-cssnext": "^2.8.0",
"postcss-import": "^8.1.2",
"postcss-loader": "^0.10.1",
"postcss-mixins": "^5.2.0",
"postcss-nested": "^1.0.0",
"postcss-url": "^5.1.2",
"pretty-bytes-cli": "^2.0.0",
"react": "^15.3.1",
"react-addons-perf": "^15.3.1",
"react-addons-test-utils": "^15.1.0",
"react-dom": "^15.3.1",
"rf-release": "^0.4.0",
"rollup": "^0.34.13",
"postcss": "^6.0.13",
"postcss-cssnext": "^3.0.2",
"postcss-import": "^10.0.0",
"postcss-loader": "^2.0.6",
"postcss-mixins": "^6.0.1",
"postcss-nested": "^2.0.4",
"postcss-url": "^7.0.0",
"react": "^0.14 || ^15.5.4",
"react-dom": "^0.14 || ^15.5.4",
"react-test-renderer": "^15.6.1",
"rollup": "^0.50.0",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-json": "^2.0.1",
"rollup-plugin-memory": "^2.0.0",
"rollup-plugin-postcss": "^0.2.0",
"rollup-plugin-postcss": "^0.5.5",
"sinon": "^1.17.4",
"style-loader": "^0.13.1",
"uglify-js": "^2.7.3",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
"uglify-js": "^3.1.3",
"webpack": "^3.3.0",
"webpack-dev-server": "^2.5.1"
},
"peerDependencies": {
"react": ">=0.14",
"react-dom": ">=0.14"
},
"license": "ISC"
}

@@ -7,3 +7,3 @@ # react-mobile-datepicker

react-mobile-datepicker provides a component that can set year, month and day by sliding up or down.
react-mobile-datepicker provides a component that can set year, month, day, hour, minute and second by sliding up or down.

@@ -10,0 +10,0 @@ ## Features

@@ -10,11 +10,16 @@ import babel from 'rollup-plugin-babel';

export default {
entry: 'lib/index.js',
input: './lib/index.js',
exports: 'default',
globals: {
'react': 'React',
'react-dom': 'ReactDOM'
},
plugins: [
postcss({
plugins: [
require("postcss-url")(),
require("postcss-cssnext")(),
require("postcss-mixins"),
require("postcss-nested")(),
require('postcss-import')(),
require('postcss-url')(),
require('postcss-cssnext')(),
require('postcss-mixins'),
require('postcss-nested')(),
],

@@ -30,3 +35,3 @@ extensions: ['.css'],

babelrc: false,
presets: ['es2015-minimal-rollup'].concat(babelRc.presets.slice(1)),
presets: ['es2015-rollup'].concat(babelRc.presets.slice(1)),
plugins: babelRc.plugins,

@@ -33,0 +38,0 @@ exclude: 'node_modules/**',

@@ -1,2 +0,1 @@

/* eslint-disable */

@@ -13,13 +12,13 @@ var path = require('path');

var EXAMPLES_DIR = path.resolve(__dirname, 'examples');
const ROOT_PATH = process.cwd();
module.exports = {
entry: buildEntries(),
output: {
path: 'examples/__build__',
path: ROOT_PATH + '/examples/__build__',
publicPath: '/',
filename: '[name].js',
chunkFilename: "[name].chunk.min.js"
chunkFilename: '[name].chunk.min.js',
},
devTool: 'eval-source-map',
devtool: 'eval-source-map',
devServer: {

@@ -29,31 +28,36 @@ historyApiFallback: true,

inline: true,
progress: true,
host: '0.0.0.0',
},
resolve: {
extensions: ['', '.js', '.jsx']
extensions: ['.json', '.js', '.jsx', '.css'],
},
resolveLoader: {
moduleExtensions: ['-loader'],
},
performance: {
hints: false,
},
module: {
loaders: [{
test: /\.jsx?$/,
loaders: ['babel'],
exclude: /node_modules/,
}, {
test: /\.css$/,
loader: 'style!css!postcss'
}]
rules: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
},
{
test: /\.css$/,
use: [
{loader: 'style'},
{loader: 'css'},
{
loader: 'postcss',
options: {config: {path: path.join(__dirname, 'postcss.config.js')}},
},
],
},
],
},
postcss: function (webpack) {
return [
require("postcss-import")({
onImport: function (files) {
files.forEach(this.addDependency);
}.bind(this),
}),
require("postcss-url")(),
require("postcss-cssnext")(),
require("postcss-mixins"),
require("postcss-nested")(),
];
},
plugins: [

@@ -63,14 +67,19 @@ new HtmlWebpackPlugin({

template: 'examples/index.html', // Load a custom template
inject: 'body' // Inject all scripts into the body
inject: 'body', // Inject all scripts into the body
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"development"'
'process.env.NODE_ENV': '"development"',
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
]
new webpack.optimize.CommonsChunkPlugin({
name: [
'vendor',
], // vendor libs + extracted manifest
minChunks: Infinity
}),
],
};
function buildEntries() {
return fs.readdirSync(EXAMPLES_DIR).reduce(function (a, b) {
return fs.readdirSync(EXAMPLES_DIR).reduce(function(a, b) {
if (b === '__build__') {

@@ -90,5 +99,4 @@ return a;

function isDirectory(dir) {
return fs.lstatSync(dir).isDirectory();
return fs.lstatSync(dir).isDirectory();
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc