react-datetime
Advanced tools
Comparing version
Changelog | ||
========= | ||
## 2.8.8 | ||
* Fixes issues introduced in v2.8.7 recognizing any calendar view as clickingOutside trigger | ||
## 2.8.7 | ||
@@ -4,0 +7,0 @@ * Update react-onclickoutside dependency. That should fix most of the problems about closeOnSelect. |
@@ -379,3 +379,3 @@ 'use strict'; | ||
fromState: ['viewDate', 'selectedDate', 'updateOn'], | ||
fromThis: ['setDate', 'setTime', 'showView', 'addTime', 'subtractTime', 'updateSelectedDate', 'localMoment'] | ||
fromThis: ['setDate', 'setTime', 'showView', 'addTime', 'subtractTime', 'updateSelectedDate', 'localMoment', 'handleClickOutside'] | ||
}, | ||
@@ -382,0 +382,0 @@ |
/* | ||
react-datetime v2.8.7 | ||
react-datetime v2.8.8 | ||
https://github.com/YouCanBookMe/react-datetime | ||
@@ -15,3 +15,3 @@ MIT: https://github.com/YouCanBookMe/react-datetime/raw/master/LICENSE | ||
root["Datetime"] = factory(root["moment"], root["React"], root["ReactDOM"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_10__) { | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_7__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
@@ -441,3 +441,3 @@ /******/ // The module cache | ||
fromState: ['viewDate', 'selectedDate', 'updateOn'], | ||
fromThis: ['setDate', 'setTime', 'showView', 'addTime', 'subtractTime', 'updateSelectedDate', 'localMoment'] | ||
fromThis: ['setDate', 'setTime', 'showView', 'addTime', 'subtractTime', 'updateSelectedDate', 'localMoment', 'handleClickOutside'] | ||
}, | ||
@@ -567,9 +567,8 @@ | ||
DaysView = __webpack_require__(5), | ||
MonthsView = __webpack_require__(6), | ||
YearsView = __webpack_require__(7), | ||
TimeView = __webpack_require__(8), | ||
onClickOutside = __webpack_require__(9) | ||
MonthsView = __webpack_require__(8), | ||
YearsView = __webpack_require__(9), | ||
TimeView = __webpack_require__(10) | ||
; | ||
var CalendarContainer = onClickOutside( React.createClass({ | ||
var CalendarContainer = React.createClass({ | ||
viewComponents: { | ||
@@ -584,8 +583,4 @@ days: DaysView, | ||
return React.createElement( this.viewComponents[ this.props.view ], this.props.viewProps ); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.onClickOutside(); | ||
} | ||
})); | ||
}); | ||
@@ -602,7 +597,8 @@ module.exports = CalendarContainer; | ||
var React = __webpack_require__(3), | ||
moment = __webpack_require__(2) | ||
moment = __webpack_require__(2), | ||
onClickOutside = __webpack_require__(6) | ||
; | ||
var DOM = React.DOM; | ||
var DateTimePickerDays = React.createClass({ | ||
var DateTimePickerDays = onClickOutside( React.createClass({ | ||
render: function() { | ||
@@ -735,5 +731,9 @@ var footer = this.renderFooter(), | ||
return 1; | ||
} | ||
}); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.handleClickOutside(); | ||
} | ||
})); | ||
module.exports = DateTimePickerDays; | ||
@@ -746,8 +746,323 @@ | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** | ||
* A higher-order-component for handling onClickOutside for React components. | ||
*/ | ||
(function(root) { | ||
// administrative | ||
var registeredComponents = []; | ||
var handlers = []; | ||
var IGNORE_CLASS = 'ignore-react-onclickoutside'; | ||
var DEFAULT_EVENTS = ['mousedown', 'touchstart']; | ||
/** | ||
* Check whether some DOM node is our Component's node. | ||
*/ | ||
var isNodeFound = function(current, componentNode, ignoreClass) { | ||
if (current === componentNode) { | ||
return true; | ||
} | ||
// SVG <use/> elements do not technically reside in the rendered DOM, so | ||
// they do not have classList directly, but they offer a link to their | ||
// corresponding element, which can have classList. This extra check is for | ||
// that case. | ||
// See: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement | ||
// Discussion: https://github.com/Pomax/react-onclickoutside/pull/17 | ||
if (current.correspondingElement) { | ||
return current.correspondingElement.classList.contains(ignoreClass); | ||
} | ||
return current.classList.contains(ignoreClass); | ||
}; | ||
/** | ||
* Try to find our node in a hierarchy of nodes, returning the document | ||
* node as highest noode if our node is not found in the path up. | ||
*/ | ||
var findHighest = function(current, componentNode, ignoreClass) { | ||
if (current === componentNode) { | ||
return true; | ||
} | ||
// If source=local then this event came from 'somewhere' | ||
// inside and should be ignored. We could handle this with | ||
// a layered approach, too, but that requires going back to | ||
// thinking in terms of Dom node nesting, running counter | ||
// to React's 'you shouldn't care about the DOM' philosophy. | ||
while(current.parentNode) { | ||
if (isNodeFound(current, componentNode, ignoreClass)) { | ||
return true; | ||
} | ||
current = current.parentNode; | ||
} | ||
return current; | ||
}; | ||
/** | ||
* Check if the browser scrollbar was clicked | ||
*/ | ||
var clickedScrollbar = function(evt) { | ||
return document.documentElement.clientWidth <= evt.clientX; | ||
}; | ||
/** | ||
* Generate the event handler that checks whether a clicked DOM node | ||
* is inside of, or lives outside of, our Component's node tree. | ||
*/ | ||
var generateOutsideCheck = function(componentNode, componentInstance, eventHandler, ignoreClass, excludeScrollbar, preventDefault, stopPropagation) { | ||
return function(evt) { | ||
if (preventDefault) { | ||
evt.preventDefault(); | ||
} | ||
if (stopPropagation) { | ||
evt.stopPropagation(); | ||
} | ||
var current = evt.target; | ||
if((excludeScrollbar && clickedScrollbar(evt)) || (findHighest(current, componentNode, ignoreClass) !== document)) { | ||
return; | ||
} | ||
eventHandler(evt); | ||
}; | ||
}; | ||
/** | ||
* This function generates the HOC function that you'll use | ||
* in order to impart onOutsideClick listening to an | ||
* arbitrary component. It gets called at the end of the | ||
* bootstrapping code to yield an instance of the | ||
* onClickOutsideHOC function defined inside setupHOC(). | ||
*/ | ||
function setupHOC(root, React, ReactDOM) { | ||
// The actual Component-wrapping HOC: | ||
return function onClickOutsideHOC(Component, config) { | ||
var wrapComponentWithOnClickOutsideHandling = React.createClass({ | ||
statics: { | ||
/** | ||
* Access the wrapped Component's class. | ||
*/ | ||
getClass: function() { | ||
if (Component.getClass) { | ||
return Component.getClass(); | ||
} | ||
return Component; | ||
} | ||
}, | ||
/** | ||
* Access the wrapped Component's instance. | ||
*/ | ||
getInstance: function() { | ||
return Component.prototype.isReactComponent ? this.refs.instance : this; | ||
}, | ||
// this is given meaning in componentDidMount | ||
__outsideClickHandler: function() {}, | ||
/** | ||
* Add click listeners to the current document, | ||
* linked to this component's state. | ||
*/ | ||
componentDidMount: function() { | ||
// If we are in an environment without a DOM such | ||
// as shallow rendering or snapshots then we exit | ||
// early to prevent any unhandled errors being thrown. | ||
if (typeof document === 'undefined' || !document.createElement){ | ||
return; | ||
} | ||
var instance = this.getInstance(); | ||
var clickOutsideHandler; | ||
if(config && typeof config.handleClickOutside === 'function') { | ||
clickOutsideHandler = config.handleClickOutside(instance); | ||
if(typeof clickOutsideHandler !== 'function') { | ||
throw new Error('Component lacks a function for processing outside click events specified by the handleClickOutside config option.'); | ||
} | ||
} else if(typeof instance.handleClickOutside === 'function') { | ||
if (React.Component.prototype.isPrototypeOf(instance)) { | ||
clickOutsideHandler = instance.handleClickOutside.bind(instance); | ||
} else { | ||
clickOutsideHandler = instance.handleClickOutside; | ||
} | ||
} else if(typeof instance.props.handleClickOutside === 'function') { | ||
clickOutsideHandler = instance.props.handleClickOutside; | ||
} else { | ||
throw new Error('Component lacks a handleClickOutside(event) function for processing outside click events.'); | ||
} | ||
var componentNode = ReactDOM.findDOMNode(instance); | ||
if (componentNode === null) { | ||
console.warn('Antipattern warning: there was no DOM node associated with the component that is being wrapped by outsideClick.'); | ||
console.warn([ | ||
'This is typically caused by having a component that starts life with a render function that', | ||
'returns `null` (due to a state or props value), so that the component \'exist\' in the React', | ||
'chain of components, but not in the DOM.\n\nInstead, you need to refactor your code so that the', | ||
'decision of whether or not to show your component is handled by the parent, in their render()', | ||
'function.\n\nIn code, rather than:\n\n A{render(){return check? <.../> : null;}\n B{render(){<A check=... />}\n\nmake sure that you', | ||
'use:\n\n A{render(){return <.../>}\n B{render(){return <...>{ check ? <A/> : null }<...>}}\n\nThat is:', | ||
'the parent is always responsible for deciding whether or not to render any of its children.', | ||
'It is not the child\'s responsibility to decide whether a render instruction from above should', | ||
'get ignored or not by returning `null`.\n\nWhen any component gets its render() function called,', | ||
'that is the signal that it should be rendering its part of the UI. It may in turn decide not to', | ||
'render all of *its* children, but it should never return `null` for itself. It is not responsible', | ||
'for that decision.' | ||
].join(' ')); | ||
} | ||
var fn = this.__outsideClickHandler = generateOutsideCheck( | ||
componentNode, | ||
instance, | ||
clickOutsideHandler, | ||
this.props.outsideClickIgnoreClass || IGNORE_CLASS, | ||
this.props.excludeScrollbar || false, | ||
this.props.preventDefault || false, | ||
this.props.stopPropagation || false | ||
); | ||
var pos = registeredComponents.length; | ||
registeredComponents.push(this); | ||
handlers[pos] = fn; | ||
// If there is a truthy disableOnClickOutside property for this | ||
// component, don't immediately start listening for outside events. | ||
if (!this.props.disableOnClickOutside) { | ||
this.enableOnClickOutside(); | ||
} | ||
}, | ||
/** | ||
* Track for disableOnClickOutside props changes and enable/disable click outside | ||
*/ | ||
componentWillReceiveProps: function(nextProps) { | ||
if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { | ||
this.enableOnClickOutside(); | ||
} else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { | ||
this.disableOnClickOutside(); | ||
} | ||
}, | ||
/** | ||
* Remove the document's event listeners | ||
*/ | ||
componentWillUnmount: function() { | ||
this.disableOnClickOutside(); | ||
this.__outsideClickHandler = false; | ||
var pos = registeredComponents.indexOf(this); | ||
if( pos>-1) { | ||
// clean up so we don't leak memory | ||
if (handlers[pos]) { handlers.splice(pos, 1); } | ||
registeredComponents.splice(pos, 1); | ||
} | ||
}, | ||
/** | ||
* Can be called to explicitly enable event listening | ||
* for clicks and touches outside of this element. | ||
*/ | ||
enableOnClickOutside: function() { | ||
var fn = this.__outsideClickHandler; | ||
if (typeof document !== 'undefined') { | ||
var events = this.props.eventTypes || DEFAULT_EVENTS; | ||
if (!events.forEach) { | ||
events = [events]; | ||
} | ||
events.forEach(function (eventName) { | ||
document.addEventListener(eventName, fn); | ||
}); | ||
} | ||
}, | ||
/** | ||
* Can be called to explicitly disable event listening | ||
* for clicks and touches outside of this element. | ||
*/ | ||
disableOnClickOutside: function() { | ||
var fn = this.__outsideClickHandler; | ||
if (typeof document !== 'undefined') { | ||
var events = this.props.eventTypes || DEFAULT_EVENTS; | ||
if (!events.forEach) { | ||
events = [events]; | ||
} | ||
events.forEach(function (eventName) { | ||
document.removeEventListener(eventName, fn); | ||
}); | ||
} | ||
}, | ||
/** | ||
* Pass-through render | ||
*/ | ||
render: function() { | ||
var passedProps = this.props; | ||
var props = {}; | ||
Object.keys(this.props).forEach(function(key) { | ||
if (key !== 'excludeScrollbar') { | ||
props[key] = passedProps[key]; | ||
} | ||
}); | ||
if (Component.prototype.isReactComponent) { | ||
props.ref = 'instance'; | ||
} | ||
props.disableOnClickOutside = this.disableOnClickOutside; | ||
props.enableOnClickOutside = this.enableOnClickOutside; | ||
return React.createElement(Component, props); | ||
} | ||
}); | ||
// Add display name for React devtools | ||
(function bindWrappedComponentName(c, wrapper) { | ||
var componentName = c.displayName || c.name || 'Component'; | ||
wrapper.displayName = 'OnClickOutside(' + componentName + ')'; | ||
}(Component, wrapComponentWithOnClickOutsideHandling)); | ||
return wrapComponentWithOnClickOutsideHandling; | ||
}; | ||
} | ||
/** | ||
* This function sets up the library in ways that | ||
* work with the various modulde loading solutions | ||
* used in JavaScript land today. | ||
*/ | ||
function setupBinding(root, factory) { | ||
if (true) { | ||
// AMD. Register as an anonymous module. | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3),__webpack_require__(7)], __WEBPACK_AMD_DEFINE_RESULT__ = function(React, ReactDom) { | ||
return factory(root, React, ReactDom); | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
} else if (typeof exports === 'object') { | ||
// Node. Note that this does not work with strict | ||
// CommonJS, but only CommonJS-like environments | ||
// that support module.exports | ||
module.exports = factory(root, require('react'), require('react-dom')); | ||
} else { | ||
// Browser globals (root is window) | ||
root.onClickOutside = factory(root, React, ReactDOM); | ||
} | ||
} | ||
// Make it all happen | ||
setupBinding(root, setupHOC); | ||
}(this)); | ||
/***/ }, | ||
/* 7 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_7__; | ||
/***/ }, | ||
/* 8 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var React = __webpack_require__(3); | ||
var React = __webpack_require__(3), | ||
onClickOutside = __webpack_require__(6) | ||
; | ||
var DOM = React.DOM; | ||
var DateTimePickerMonths = React.createClass({ | ||
var DateTimePickerMonths = onClickOutside( React.createClass({ | ||
render: function() { | ||
@@ -825,3 +1140,3 @@ return DOM.div({ className: 'rdtMonths' }, [ | ||
updateSelectedMonth: function( event ) { | ||
this.props.updateSelectedDate( event, true ); | ||
this.props.updateSelectedDate( event ); | ||
}, | ||
@@ -841,5 +1156,9 @@ | ||
return 1; | ||
} | ||
}); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.handleClickOutside(); | ||
} | ||
})); | ||
function capitalize( str ) { | ||
@@ -853,3 +1172,3 @@ return str.charAt( 0 ).toUpperCase() + str.slice( 1 ); | ||
/***/ }, | ||
/* 7 */ | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -859,6 +1178,8 @@ | ||
var React = __webpack_require__(3); | ||
var React = __webpack_require__(3), | ||
onClickOutside = __webpack_require__(6) | ||
; | ||
var DOM = React.DOM; | ||
var DateTimePickerYears = React.createClass({ | ||
var DateTimePickerYears = onClickOutside( React.createClass({ | ||
render: function() { | ||
@@ -944,3 +1265,3 @@ var year = parseInt( this.props.viewDate.year() / 10, 10 ) * 10; | ||
updateSelectedYear: function( event ) { | ||
this.props.updateSelectedDate( event, true ); | ||
this.props.updateSelectedDate( event ); | ||
}, | ||
@@ -954,5 +1275,9 @@ | ||
return 1; | ||
} | ||
}); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.handleClickOutside(); | ||
} | ||
})); | ||
module.exports = DateTimePickerYears; | ||
@@ -962,3 +1287,3 @@ | ||
/***/ }, | ||
/* 8 */ | ||
/* 10 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -969,7 +1294,8 @@ | ||
var React = __webpack_require__(3), | ||
assign = __webpack_require__(1) | ||
assign = __webpack_require__(1), | ||
onClickOutside = __webpack_require__(6) | ||
; | ||
var DOM = React.DOM; | ||
var DateTimePickerTime = React.createClass({ | ||
var DateTimePickerTime = onClickOutside( React.createClass({ | ||
getInitialState: function() { | ||
@@ -1186,321 +1512,12 @@ return this.calculateState( this.props ); | ||
return str; | ||
} | ||
}); | ||
}, | ||
module.exports = DateTimePickerTime; | ||
/***/ }, | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** | ||
* A higher-order-component for handling onClickOutside for React components. | ||
*/ | ||
(function(root) { | ||
// administrative | ||
var registeredComponents = []; | ||
var handlers = []; | ||
var IGNORE_CLASS = 'ignore-react-onclickoutside'; | ||
var DEFAULT_EVENTS = ['mousedown', 'touchstart']; | ||
/** | ||
* Check whether some DOM node is our Component's node. | ||
*/ | ||
var isNodeFound = function(current, componentNode, ignoreClass) { | ||
if (current === componentNode) { | ||
return true; | ||
} | ||
// SVG <use/> elements do not technically reside in the rendered DOM, so | ||
// they do not have classList directly, but they offer a link to their | ||
// corresponding element, which can have classList. This extra check is for | ||
// that case. | ||
// See: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement | ||
// Discussion: https://github.com/Pomax/react-onclickoutside/pull/17 | ||
if (current.correspondingElement) { | ||
return current.correspondingElement.classList.contains(ignoreClass); | ||
} | ||
return current.classList.contains(ignoreClass); | ||
}; | ||
/** | ||
* Try to find our node in a hierarchy of nodes, returning the document | ||
* node as highest noode if our node is not found in the path up. | ||
*/ | ||
var findHighest = function(current, componentNode, ignoreClass) { | ||
if (current === componentNode) { | ||
return true; | ||
} | ||
// If source=local then this event came from 'somewhere' | ||
// inside and should be ignored. We could handle this with | ||
// a layered approach, too, but that requires going back to | ||
// thinking in terms of Dom node nesting, running counter | ||
// to React's 'you shouldn't care about the DOM' philosophy. | ||
while(current.parentNode) { | ||
if (isNodeFound(current, componentNode, ignoreClass)) { | ||
return true; | ||
} | ||
current = current.parentNode; | ||
} | ||
return current; | ||
}; | ||
/** | ||
* Check if the browser scrollbar was clicked | ||
*/ | ||
var clickedScrollbar = function(evt) { | ||
return document.documentElement.clientWidth <= evt.clientX; | ||
}; | ||
/** | ||
* Generate the event handler that checks whether a clicked DOM node | ||
* is inside of, or lives outside of, our Component's node tree. | ||
*/ | ||
var generateOutsideCheck = function(componentNode, componentInstance, eventHandler, ignoreClass, excludeScrollbar, preventDefault, stopPropagation) { | ||
return function(evt) { | ||
if (preventDefault) { | ||
evt.preventDefault(); | ||
} | ||
if (stopPropagation) { | ||
evt.stopPropagation(); | ||
} | ||
var current = evt.target; | ||
if((excludeScrollbar && clickedScrollbar(evt)) || (findHighest(current, componentNode, ignoreClass) !== document)) { | ||
return; | ||
} | ||
eventHandler(evt); | ||
}; | ||
}; | ||
/** | ||
* This function generates the HOC function that you'll use | ||
* in order to impart onOutsideClick listening to an | ||
* arbitrary component. It gets called at the end of the | ||
* bootstrapping code to yield an instance of the | ||
* onClickOutsideHOC function defined inside setupHOC(). | ||
*/ | ||
function setupHOC(root, React, ReactDOM) { | ||
// The actual Component-wrapping HOC: | ||
return function onClickOutsideHOC(Component, config) { | ||
var wrapComponentWithOnClickOutsideHandling = React.createClass({ | ||
statics: { | ||
/** | ||
* Access the wrapped Component's class. | ||
*/ | ||
getClass: function() { | ||
if (Component.getClass) { | ||
return Component.getClass(); | ||
} | ||
return Component; | ||
} | ||
}, | ||
/** | ||
* Access the wrapped Component's instance. | ||
*/ | ||
getInstance: function() { | ||
return Component.prototype.isReactComponent ? this.refs.instance : this; | ||
}, | ||
// this is given meaning in componentDidMount | ||
__outsideClickHandler: function() {}, | ||
/** | ||
* Add click listeners to the current document, | ||
* linked to this component's state. | ||
*/ | ||
componentDidMount: function() { | ||
// If we are in an environment without a DOM such | ||
// as shallow rendering or snapshots then we exit | ||
// early to prevent any unhandled errors being thrown. | ||
if (typeof document === 'undefined' || !document.createElement){ | ||
return; | ||
} | ||
var instance = this.getInstance(); | ||
var clickOutsideHandler; | ||
if(config && typeof config.handleClickOutside === 'function') { | ||
clickOutsideHandler = config.handleClickOutside(instance); | ||
if(typeof clickOutsideHandler !== 'function') { | ||
throw new Error('Component lacks a function for processing outside click events specified by the handleClickOutside config option.'); | ||
} | ||
} else if(typeof instance.handleClickOutside === 'function') { | ||
if (React.Component.prototype.isPrototypeOf(instance)) { | ||
clickOutsideHandler = instance.handleClickOutside.bind(instance); | ||
} else { | ||
clickOutsideHandler = instance.handleClickOutside; | ||
} | ||
} else if(typeof instance.props.handleClickOutside === 'function') { | ||
clickOutsideHandler = instance.props.handleClickOutside; | ||
} else { | ||
throw new Error('Component lacks a handleClickOutside(event) function for processing outside click events.'); | ||
} | ||
var componentNode = ReactDOM.findDOMNode(instance); | ||
if (componentNode === null) { | ||
console.warn('Antipattern warning: there was no DOM node associated with the component that is being wrapped by outsideClick.'); | ||
console.warn([ | ||
'This is typically caused by having a component that starts life with a render function that', | ||
'returns `null` (due to a state or props value), so that the component \'exist\' in the React', | ||
'chain of components, but not in the DOM.\n\nInstead, you need to refactor your code so that the', | ||
'decision of whether or not to show your component is handled by the parent, in their render()', | ||
'function.\n\nIn code, rather than:\n\n A{render(){return check? <.../> : null;}\n B{render(){<A check=... />}\n\nmake sure that you', | ||
'use:\n\n A{render(){return <.../>}\n B{render(){return <...>{ check ? <A/> : null }<...>}}\n\nThat is:', | ||
'the parent is always responsible for deciding whether or not to render any of its children.', | ||
'It is not the child\'s responsibility to decide whether a render instruction from above should', | ||
'get ignored or not by returning `null`.\n\nWhen any component gets its render() function called,', | ||
'that is the signal that it should be rendering its part of the UI. It may in turn decide not to', | ||
'render all of *its* children, but it should never return `null` for itself. It is not responsible', | ||
'for that decision.' | ||
].join(' ')); | ||
} | ||
var fn = this.__outsideClickHandler = generateOutsideCheck( | ||
componentNode, | ||
instance, | ||
clickOutsideHandler, | ||
this.props.outsideClickIgnoreClass || IGNORE_CLASS, | ||
this.props.excludeScrollbar || false, | ||
this.props.preventDefault || false, | ||
this.props.stopPropagation || false | ||
); | ||
var pos = registeredComponents.length; | ||
registeredComponents.push(this); | ||
handlers[pos] = fn; | ||
// If there is a truthy disableOnClickOutside property for this | ||
// component, don't immediately start listening for outside events. | ||
if (!this.props.disableOnClickOutside) { | ||
this.enableOnClickOutside(); | ||
} | ||
}, | ||
/** | ||
* Track for disableOnClickOutside props changes and enable/disable click outside | ||
*/ | ||
componentWillReceiveProps: function(nextProps) { | ||
if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { | ||
this.enableOnClickOutside(); | ||
} else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { | ||
this.disableOnClickOutside(); | ||
} | ||
}, | ||
/** | ||
* Remove the document's event listeners | ||
*/ | ||
componentWillUnmount: function() { | ||
this.disableOnClickOutside(); | ||
this.__outsideClickHandler = false; | ||
var pos = registeredComponents.indexOf(this); | ||
if( pos>-1) { | ||
// clean up so we don't leak memory | ||
if (handlers[pos]) { handlers.splice(pos, 1); } | ||
registeredComponents.splice(pos, 1); | ||
} | ||
}, | ||
/** | ||
* Can be called to explicitly enable event listening | ||
* for clicks and touches outside of this element. | ||
*/ | ||
enableOnClickOutside: function() { | ||
var fn = this.__outsideClickHandler; | ||
if (typeof document !== 'undefined') { | ||
var events = this.props.eventTypes || DEFAULT_EVENTS; | ||
if (!events.forEach) { | ||
events = [events]; | ||
} | ||
events.forEach(function (eventName) { | ||
document.addEventListener(eventName, fn); | ||
}); | ||
} | ||
}, | ||
/** | ||
* Can be called to explicitly disable event listening | ||
* for clicks and touches outside of this element. | ||
*/ | ||
disableOnClickOutside: function() { | ||
var fn = this.__outsideClickHandler; | ||
if (typeof document !== 'undefined') { | ||
var events = this.props.eventTypes || DEFAULT_EVENTS; | ||
if (!events.forEach) { | ||
events = [events]; | ||
} | ||
events.forEach(function (eventName) { | ||
document.removeEventListener(eventName, fn); | ||
}); | ||
} | ||
}, | ||
/** | ||
* Pass-through render | ||
*/ | ||
render: function() { | ||
var passedProps = this.props; | ||
var props = {}; | ||
Object.keys(this.props).forEach(function(key) { | ||
if (key !== 'excludeScrollbar') { | ||
props[key] = passedProps[key]; | ||
} | ||
}); | ||
if (Component.prototype.isReactComponent) { | ||
props.ref = 'instance'; | ||
} | ||
props.disableOnClickOutside = this.disableOnClickOutside; | ||
props.enableOnClickOutside = this.enableOnClickOutside; | ||
return React.createElement(Component, props); | ||
} | ||
}); | ||
// Add display name for React devtools | ||
(function bindWrappedComponentName(c, wrapper) { | ||
var componentName = c.displayName || c.name || 'Component'; | ||
wrapper.displayName = 'OnClickOutside(' + componentName + ')'; | ||
}(Component, wrapComponentWithOnClickOutsideHandling)); | ||
return wrapComponentWithOnClickOutsideHandling; | ||
}; | ||
handleClickOutside: function() { | ||
this.props.handleClickOutside(); | ||
} | ||
})); | ||
/** | ||
* This function sets up the library in ways that | ||
* work with the various modulde loading solutions | ||
* used in JavaScript land today. | ||
*/ | ||
function setupBinding(root, factory) { | ||
if (true) { | ||
// AMD. Register as an anonymous module. | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3),__webpack_require__(10)], __WEBPACK_AMD_DEFINE_RESULT__ = function(React, ReactDom) { | ||
return factory(root, React, ReactDom); | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
} else if (typeof exports === 'object') { | ||
// Node. Note that this does not work with strict | ||
// CommonJS, but only CommonJS-like environments | ||
// that support module.exports | ||
module.exports = factory(root, require('react'), require('react-dom')); | ||
} else { | ||
// Browser globals (root is window) | ||
root.onClickOutside = factory(root, React, ReactDOM); | ||
} | ||
} | ||
module.exports = DateTimePickerTime; | ||
// Make it all happen | ||
setupBinding(root, setupHOC); | ||
}(this)); | ||
/***/ }, | ||
/* 10 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_10__; | ||
/***/ } | ||
@@ -1507,0 +1524,0 @@ /******/ ]) |
/* | ||
react-datetime v2.8.7 | ||
react-datetime v2.8.8 | ||
https://github.com/YouCanBookMe/react-datetime | ||
MIT: https://github.com/YouCanBookMe/react-datetime/raw/master/LICENSE | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment"),require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["moment","React","ReactDOM"],e):"object"==typeof exports?exports.Datetime=e(require("moment"),require("React"),require("ReactDOM")):t.Datetime=e(t.moment,t.React,t.ReactDOM)}(this,function(t,e,s){return function(t){function e(n){if(s[n])return s[n].exports;var a=s[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){"use strict";var n=s(1),a=s(2),i=s(3),r=s(4),o=i.PropTypes,c=i.createClass({propTypes:{onFocus:o.func,onBlur:o.func,onChange:o.func,locale:o.string,utc:o.bool,input:o.bool,inputProps:o.object,timeConstraints:o.object,viewMode:o.oneOf(["years","months","days","time"]),isValidDate:o.func,open:o.bool,strictParsing:o.bool,closeOnSelect:o.bool,closeOnTab:o.bool},getDefaultProps:function(){var t=function(){};return{className:"",defaultValue:"",inputProps:{},input:!0,onFocus:t,onBlur:t,onChange:t,timeFormat:!0,timeConstraints:{},dateFormat:!0,strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,utc:!1}},getInitialState:function(){var t=this.getStateFromProps(this.props);return void 0===t.open&&(t.open=!this.props.input),t.currentView=this.props.dateFormat?this.props.viewMode||t.updateOn||"days":"time",t},getStateFromProps:function(t){var e,s,n,a,i=this.getFormats(t),r=t.value||t.defaultValue;return r&&"string"==typeof r?e=this.localMoment(r,i.datetime):r&&(e=this.localMoment(r)),e&&!e.isValid()&&(e=null),s=e?e.clone().startOf("month"):this.localMoment().startOf("month"),n=this.getUpdateOn(i),a=e?e.format(i.datetime):r.isValid&&!r.isValid()?"":r||"",{updateOn:n,inputFormat:i.datetime,viewDate:s,selectedDate:e,inputValue:a,open:t.open}},getUpdateOn:function(t){return t.date.match(/[lLD]/)?"days":t.date.indexOf("M")!==-1?"months":t.date.indexOf("Y")!==-1?"years":"days"},getFormats:function(t){var e={date:t.dateFormat||"",time:t.timeFormat||""},s=this.localMoment(t.date,null,t).localeData();return e.date===!0?e.date=s.longDateFormat("L"):"days"!==this.getUpdateOn(e)&&(e.time=""),e.time===!0&&(e.time=s.longDateFormat("LT")),e.datetime=e.date&&e.time?e.date+" "+e.time:e.date||e.time,e},componentWillReceiveProps:function(t){var e=this.getFormats(t),s={};if(t.value===this.props.value&&e.datetime===this.getFormats(this.props).datetime||(s=this.getStateFromProps(t)),void 0===s.open&&(this.props.closeOnSelect&&"time"!==this.state.currentView?s.open=!1:s.open=this.state.open),t.viewMode!==this.props.viewMode&&(s.currentView=t.viewMode),t.locale!==this.props.locale){if(this.state.viewDate){var n=this.state.viewDate.clone().locale(t.locale);s.viewDate=n}if(this.state.selectedDate){var a=this.state.selectedDate.clone().locale(t.locale);s.selectedDate=a,s.inputValue=a.format(e.datetime)}}t.utc!==this.props.utc&&(t.utc?(this.state.viewDate&&(s.viewDate=this.state.viewDate.clone().utc()),this.state.selectedDate&&(s.selectedDate=this.state.selectedDate.clone().utc(),s.inputValue=s.selectedDate.format(e.datetime))):(this.state.viewDate&&(s.viewDate=this.state.viewDate.clone().local()),this.state.selectedDate&&(s.selectedDate=this.state.selectedDate.clone().local(),s.inputValue=s.selectedDate.format(e.datetime)))),this.setState(s)},onInputChange:function(t){var e=null===t.target?t:t.target.value,s=this.localMoment(e,this.state.inputFormat),n={inputValue:e};return s.isValid()&&!this.props.value?(n.selectedDate=s,n.viewDate=s.clone().startOf("month")):n.selectedDate=null,this.setState(n,function(){return this.props.onChange(s.isValid()?s:this.state.inputValue)})},onInputKey:function(t){9===t.which&&this.props.closeOnTab&&this.closeCalendar()},showView:function(t){var e=this;return function(){e.setState({currentView:t})}},setDate:function(t){var e=this,s={month:"days",year:"months"};return function(n){e.setState({viewDate:e.state.viewDate.clone()[t](parseInt(n.target.getAttribute("data-value"),10)).startOf(t),currentView:s[t]})}},addTime:function(t,e,s){return this.updateTime("add",t,e,s)},subtractTime:function(t,e,s){return this.updateTime("subtract",t,e,s)},updateTime:function(t,e,s,n){var a=this;return function(){var i={},r=n?"selectedDate":"viewDate";i[r]=a.state[r].clone()[t](e,s),a.setState(i)}},allowedSetTime:["hours","minutes","seconds","milliseconds"],setTime:function(t,e){var s,n=this.allowedSetTime.indexOf(t)+1,a=this.state,i=(a.selectedDate||a.viewDate).clone();for(i[t](e);n<this.allowedSetTime.length;n++)s=this.allowedSetTime[n],i[s](i[s]());this.props.value||this.setState({selectedDate:i,inputValue:i.format(a.inputFormat)}),this.props.onChange(i)},updateSelectedDate:function(t,e){var s,n=t.target,a=0,i=this.state.viewDate,r=this.state.selectedDate||i;if(n.className.indexOf("rdtDay")!==-1?(n.className.indexOf("rdtNew")!==-1?a=1:n.className.indexOf("rdtOld")!==-1&&(a=-1),s=i.clone().month(i.month()+a).date(parseInt(n.getAttribute("data-value"),10))):n.className.indexOf("rdtMonth")!==-1?s=i.clone().month(parseInt(n.getAttribute("data-value"),10)).date(r.date()):n.className.indexOf("rdtYear")!==-1&&(s=i.clone().month(r.month()).date(r.date()).year(parseInt(n.getAttribute("data-value"),10))),s.hours(r.hours()).minutes(r.minutes()).seconds(r.seconds()).milliseconds(r.milliseconds()),this.props.value)this.props.closeOnSelect&&e&&this.closeCalendar();else{var o=!(this.props.closeOnSelect&&e);o||this.props.onBlur(s),this.setState({selectedDate:s,viewDate:s.clone().startOf("month"),inputValue:s.format(this.state.inputFormat),open:o})}this.props.onChange(s)},openCalendar:function(){this.state.open||this.setState({open:!0},function(){this.props.onFocus()})},closeCalendar:function(){this.setState({open:!1},function(){this.props.onBlur(this.state.selectedDate||this.state.inputValue)})},handleClickOutside:function(){this.props.input&&this.state.open&&!this.props.open&&this.setState({open:!1},function(){this.props.onBlur(this.state.selectedDate||this.state.inputValue)})},localMoment:function(t,e,s){s=s||this.props;var n=s.utc?a.utc:a,i=n(t,e,s.strictParsing);return s.locale&&i.locale(s.locale),i},componentProps:{fromProps:["value","isValidDate","renderDay","renderMonth","renderYear","timeConstraints"],fromState:["viewDate","selectedDate","updateOn"],fromThis:["setDate","setTime","showView","addTime","subtractTime","updateSelectedDate","localMoment"]},getComponentProps:function(){var t=this,e=this.getFormats(this.props),s={dateFormat:e.date,timeFormat:e.time};return this.componentProps.fromProps.forEach(function(e){s[e]=t.props[e]}),this.componentProps.fromState.forEach(function(e){s[e]=t.state[e]}),this.componentProps.fromThis.forEach(function(e){s[e]=t[e]}),s},render:function(){var t=i.DOM,e="rdt"+(this.props.className?Array.isArray(this.props.className)?" "+this.props.className.join(" "):" "+this.props.className:""),s=[];return this.props.input?s=[t.input(n({key:"i",type:"text",className:"form-control",onFocus:this.openCalendar,onChange:this.onInputChange,onKeyDown:this.onInputKey,value:this.state.inputValue},this.props.inputProps))]:e+=" rdtStatic",this.state.open&&(e+=" rdtOpen"),t.div({className:e},s.concat(t.div({key:"dt",className:"rdtPicker"},i.createElement(r,{view:this.state.currentView,viewProps:this.getComponentProps(),onClickOutside:this.handleClickOutside}))))}});c.moment=a,t.exports=c},function(t,e){"use strict";function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function n(t){var e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(t))),e.filter(function(e){return a.call(t,e)})}var a=Object.prototype.propertyIsEnumerable;t.exports=Object.assign||function(t,e){for(var a,i,r=s(t),o=1;o<arguments.length;o++){a=arguments[o],i=n(Object(a));for(var c=0;c<i.length;c++)r[i[c]]=a[i[c]]}return r}},function(e,s){e.exports=t},function(t,s){t.exports=e},function(t,e,s){var n=s(3),a=s(5),i=s(6),r=s(7),o=s(8),c=s(9),l=c(n.createClass({viewComponents:{days:a,months:i,years:r,time:o},render:function(){return n.createElement(this.viewComponents[this.props.view],this.props.viewProps)},handleClickOutside:function(){this.props.onClickOutside()}}));t.exports=l},function(t,e,s){"use strict";var n=s(3),a=s(2),i=n.DOM,r=n.createClass({render:function(){var t,e=this.renderFooter(),s=this.props.viewDate,n=s.localeData();return t=[i.thead({key:"th"},[i.tr({key:"h"},[i.th({key:"p",className:"rdtPrev"},i.span({onClick:this.props.subtractTime(1,"months")},"‹")),i.th({key:"s",className:"rdtSwitch",onClick:this.props.showView("months"),colSpan:5,"data-value":this.props.viewDate.month()},n.months(s)+" "+s.year()),i.th({key:"n",className:"rdtNext"},i.span({onClick:this.props.addTime(1,"months")},"›"))]),i.tr({key:"d"},this.getDaysOfWeek(n).map(function(t,e){return i.th({key:t+e,className:"dow"},t)}))]),i.tbody({key:"tb"},this.renderDays())],e&&t.push(e),i.div({className:"rdtDays"},i.table({},t))},getDaysOfWeek:function(t){var e=t._weekdaysMin,s=t.firstDayOfWeek(),n=[],a=0;return e.forEach(function(t){n[(7+a++-s)%7]=t}),n},renderDays:function(){var t,e,s,n,r=this.props.viewDate,o=this.props.selectedDate&&this.props.selectedDate.clone(),c=r.clone().subtract(1,"months"),l=r.year(),u=r.month(),d=[],p=[],h=this.props.renderDay||this.renderDay,m=this.props.isValidDate||this.alwaysValidDate;c.date(c.daysInMonth()).startOf("week");for(var f=c.clone().add(42,"d");c.isBefore(f);)t="rdtDay",n=c.clone(),c.year()===l&&c.month()<u||c.year()<l?t+=" rdtOld":(c.year()===l&&c.month()>u||c.year()>l)&&(t+=" rdtNew"),o&&c.isSame(o,"day")&&(t+=" rdtActive"),c.isSame(a(),"day")&&(t+=" rdtToday"),e=!m(n,o),e&&(t+=" rdtDisabled"),s={key:c.format("M_D"),"data-value":c.date(),className:t},e||(s.onClick=this.updateSelectedDate),p.push(h(s,n,o)),7===p.length&&(d.push(i.tr({key:c.format("M_D")},p)),p=[]),c.add(1,"d");return d},updateSelectedDate:function(t){this.props.updateSelectedDate(t,!0)},renderDay:function(t,e){return i.td(t,e.date())},renderFooter:function(){if(!this.props.timeFormat)return"";var t=this.props.selectedDate||this.props.viewDate;return i.tfoot({key:"tf"},i.tr({},i.td({onClick:this.props.showView("time"),colSpan:7,className:"rdtTimeToggle"},t.format(this.props.timeFormat))))},alwaysValidDate:function(){return 1}});t.exports=r},function(t,e,s){"use strict";function n(t){return t.charAt(0).toUpperCase()+t.slice(1)}var a=s(3),i=a.DOM,r=a.createClass({render:function(){return i.div({className:"rdtMonths"},[i.table({key:"a"},i.thead({},i.tr({},[i.th({key:"prev",className:"rdtPrev"},i.span({onClick:this.props.subtractTime(1,"years")},"‹")),i.th({key:"year",className:"rdtSwitch",onClick:this.props.showView("years"),colSpan:2,"data-value":this.props.viewDate.year()},this.props.viewDate.year()),i.th({key:"next",className:"rdtNext"},i.span({onClick:this.props.addTime(1,"years")},"›"))]))),i.table({key:"months"},i.tbody({key:"b"},this.renderMonths()))])},renderMonths:function(){for(var t,e,s,n,a,r,o,c=this.props.selectedDate,l=this.props.viewDate.month(),u=this.props.viewDate.year(),d=[],p=0,h=[],m=this.props.renderMonth||this.renderMonth,f=this.props.isValidDate||this.alwaysValidDate,v=1;p<12;)t="rdtMonth",s=this.props.viewDate.clone().set({year:u,month:p,date:v}),a=s.endOf("month").format("D"),r=Array.from({length:a},function(t,e){return e+1}),o=r.find(function(t){var e=s.clone().set("date",t);return f(e)}),n=void 0===o,n&&(t+=" rdtDisabled"),c&&p===l&&u===c.year()&&(t+=" rdtActive"),e={key:p,"data-value":p,className:t},n||(e.onClick="months"===this.props.updateOn?this.updateSelectedMonth:this.props.setDate("month")),h.push(m(e,p,u,c&&c.clone())),4===h.length&&(d.push(i.tr({key:l+"_"+d.length},h)),h=[]),p++;return d},updateSelectedMonth:function(t){this.props.updateSelectedDate(t,!0)},renderMonth:function(t,e){var s=this.props.viewDate,a=s.localeData().monthsShort(s.month(e)),r=3,o=a.substring(0,r);return i.td(t,n(o))},alwaysValidDate:function(){return 1}});t.exports=r},function(t,e,s){"use strict";var n=s(3),a=n.DOM,i=n.createClass({render:function(){var t=10*parseInt(this.props.viewDate.year()/10,10);return a.div({className:"rdtYears"},[a.table({key:"a"},a.thead({},a.tr({},[a.th({key:"prev",className:"rdtPrev"},a.span({onClick:this.props.subtractTime(10,"years")},"‹")),a.th({key:"year",className:"rdtSwitch",onClick:this.props.showView("years"),colSpan:2},t+"-"+(t+9)),a.th({key:"next",className:"rdtNext"},a.span({onClick:this.props.addTime(10,"years")},"›"))]))),a.table({key:"years"},a.tbody({},this.renderYears(t)))])},renderYears:function(t){var e,s,n,i,r,o,c,l=[],u=-1,d=[],p=this.props.renderYear||this.renderYear,h=this.props.selectedDate,m=this.props.isValidDate||this.alwaysValidDate,f=0,v=1;for(t--;u<11;)e="rdtYear",n=this.props.viewDate.clone().set({year:t,month:f,date:v}),r=n.endOf("year").format("DDD"),o=Array.from({length:r},function(t,e){return e+1}),c=o.find(function(t){var e=n.clone().dayOfYear(t);return m(e)}),i=void 0===c,i&&(e+=" rdtDisabled"),h&&h.year()===t&&(e+=" rdtActive"),s={key:t,"data-value":t,className:e},i||(s.onClick="years"===this.props.updateOn?this.updateSelectedYear:this.props.setDate("year")),l.push(p(s,t,h&&h.clone())),4===l.length&&(d.push(a.tr({key:u},l)),l=[]),t++,u++;return d},updateSelectedYear:function(t){this.props.updateSelectedDate(t,!0)},renderYear:function(t,e){return a.td(t,e)},alwaysValidDate:function(){return 1}});t.exports=i},function(t,e,s){"use strict";var n=s(3),a=s(1),i=n.DOM,r=n.createClass({getInitialState:function(){return this.calculateState(this.props)},calculateState:function(t){var e=t.selectedDate||t.viewDate,s=t.timeFormat,n=[];s.toLowerCase().indexOf("h")!==-1&&(n.push("hours"),s.indexOf("m")!==-1&&(n.push("minutes"),s.indexOf("s")!==-1&&n.push("seconds")));var a=!1;return null!==this.state&&this.props.timeFormat.toLowerCase().indexOf(" a")!==-1&&(a=this.props.timeFormat.indexOf(" A")!==-1?this.state.hours>=12?"PM":"AM":this.state.hours>=12?"pm":"am"),{hours:e.format("H"),minutes:e.format("mm"),seconds:e.format("ss"),milliseconds:e.format("SSS"),daypart:a,counters:n}},renderCounter:function(t){if("daypart"!==t){var e=this.state[t];return"hours"===t&&this.props.timeFormat.toLowerCase().indexOf(" a")!==-1&&(e=(e-1)%12+1,0===e&&(e=12)),i.div({key:t,className:"rdtCounter"},[i.span({key:"up",className:"rdtBtn",onMouseDown:this.onStartClicking("increase",t)},"▲"),i.div({key:"c",className:"rdtCount"},e),i.span({key:"do",className:"rdtBtn",onMouseDown:this.onStartClicking("decrease",t)},"▼")])}return""},renderDayPart:function(){return i.div({key:"dayPart",className:"rdtCounter"},[i.span({key:"up",className:"rdtBtn",onMouseDown:this.onStartClicking("toggleDayPart","hours")},"▲"),i.div({key:this.state.daypart,className:"rdtCount"},this.state.daypart),i.span({key:"do",className:"rdtBtn",onMouseDown:this.onStartClicking("toggleDayPart","hours")},"▼")])},render:function(){var t=this,e=[];return this.state.counters.forEach(function(s){e.length&&e.push(i.div({key:"sep"+e.length,className:"rdtCounterSeparator"},":")),e.push(t.renderCounter(s))}),this.state.daypart!==!1&&e.push(t.renderDayPart()),3===this.state.counters.length&&this.props.timeFormat.indexOf("S")!==-1&&(e.push(i.div({className:"rdtCounterSeparator",key:"sep5"},":")),e.push(i.div({className:"rdtCounter rdtMilli",key:"m"},i.input({value:this.state.milliseconds,type:"text",onChange:this.updateMilli})))),i.div({className:"rdtTime"},i.table({},[this.renderHeader(),i.tbody({key:"b"},i.tr({},i.td({},i.div({className:"rdtCounters"},e))))]))},componentWillMount:function(){var t=this;t.timeConstraints={hours:{min:0,max:23,step:1},minutes:{min:0,max:59,step:1},seconds:{min:0,max:59,step:1},milliseconds:{min:0,max:999,step:1}},["hours","minutes","seconds","milliseconds"].forEach(function(e){a(t.timeConstraints[e],t.props.timeConstraints[e])}),this.setState(this.calculateState(this.props))},componentWillReceiveProps:function(t){this.setState(this.calculateState(t))},updateMilli:function(t){var e=parseInt(t.target.value,10);e===t.target.value&&e>=0&&e<1e3&&(this.props.setTime("milliseconds",e),this.setState({milliseconds:e}))},renderHeader:function(){if(!this.props.dateFormat)return null;var t=this.props.selectedDate||this.props.viewDate;return i.thead({key:"h"},i.tr({},i.th({className:"rdtSwitch",colSpan:4,onClick:this.props.showView("days")},t.format(this.props.dateFormat))))},onStartClicking:function(t,e){var s=this;return function(){var n={};n[e]=s[t](e),s.setState(n),s.timer=setTimeout(function(){s.increaseTimer=setInterval(function(){n[e]=s[t](e),s.setState(n)},70)},500),s.mouseUpListener=function(){clearTimeout(s.timer),clearInterval(s.increaseTimer),s.props.setTime(e,s.state[e]),document.body.removeEventListener("mouseup",s.mouseUpListener)},document.body.addEventListener("mouseup",s.mouseUpListener)}},padValues:{hours:1,minutes:2,seconds:2,milliseconds:3},toggleDayPart:function(t){var e=parseInt(this.state[t],10)+12;return e>this.timeConstraints[t].max&&(e=this.timeConstraints[t].min+(e-(this.timeConstraints[t].max+1))),this.pad(t,e)},increase:function(t){var e=parseInt(this.state[t],10)+this.timeConstraints[t].step;return e>this.timeConstraints[t].max&&(e=this.timeConstraints[t].min+(e-(this.timeConstraints[t].max+1))),this.pad(t,e)},decrease:function(t){var e=parseInt(this.state[t],10)-this.timeConstraints[t].step;return e<this.timeConstraints[t].min&&(e=this.timeConstraints[t].max+1-(this.timeConstraints[t].min-e)),this.pad(t,e)},pad:function(t,e){for(var s=e+"";s.length<this.padValues[t];)s="0"+s;return s}});t.exports=r},function(t,e,s){var n,a;!function(i){function r(t,e,s){return function(t,n){var a=e.createClass({statics:{getClass:function(){return t.getClass?t.getClass():t}},getInstance:function(){return t.prototype.isReactComponent?this.refs.instance:this},__outsideClickHandler:function(){},componentDidMount:function(){if("undefined"!=typeof document&&document.createElement){var t,a=this.getInstance();if(n&&"function"==typeof n.handleClickOutside){if(t=n.handleClickOutside(a),"function"!=typeof t)throw new Error("Component lacks a function for processing outside click events specified by the handleClickOutside config option.")}else if("function"==typeof a.handleClickOutside)t=e.Component.prototype.isPrototypeOf(a)?a.handleClickOutside.bind(a):a.handleClickOutside;else{if("function"!=typeof a.props.handleClickOutside)throw new Error("Component lacks a handleClickOutside(event) function for processing outside click events.");t=a.props.handleClickOutside}var i=s.findDOMNode(a);null===i&&(console.warn("Antipattern warning: there was no DOM node associated with the component that is being wrapped by outsideClick."),console.warn(["This is typically caused by having a component that starts life with a render function that","returns `null` (due to a state or props value), so that the component 'exist' in the React","chain of components, but not in the DOM.\n\nInstead, you need to refactor your code so that the","decision of whether or not to show your component is handled by the parent, in their render()","function.\n\nIn code, rather than:\n\n A{render(){return check? <.../> : null;}\n B{render(){<A check=... />}\n\nmake sure that you","use:\n\n A{render(){return <.../>}\n B{render(){return <...>{ check ? <A/> : null }<...>}}\n\nThat is:","the parent is always responsible for deciding whether or not to render any of its children.","It is not the child's responsibility to decide whether a render instruction from above should","get ignored or not by returning `null`.\n\nWhen any component gets its render() function called,","that is the signal that it should be rendering its part of the UI. It may in turn decide not to","render all of *its* children, but it should never return `null` for itself. It is not responsible","for that decision."].join(" ")));var r=this.__outsideClickHandler=f(i,a,t,this.props.outsideClickIgnoreClass||u,this.props.excludeScrollbar||!1,this.props.preventDefault||!1,this.props.stopPropagation||!1),o=c.length;c.push(this),l[o]=r,this.props.disableOnClickOutside||this.enableOnClickOutside()}},componentWillReceiveProps:function(t){this.props.disableOnClickOutside&&!t.disableOnClickOutside?this.enableOnClickOutside():!this.props.disableOnClickOutside&&t.disableOnClickOutside&&this.disableOnClickOutside()},componentWillUnmount:function(){this.disableOnClickOutside(),this.__outsideClickHandler=!1;var t=c.indexOf(this);t>-1&&(l[t]&&l.splice(t,1),c.splice(t,1))},enableOnClickOutside:function(){var t=this.__outsideClickHandler;if("undefined"!=typeof document){var e=this.props.eventTypes||d;e.forEach||(e=[e]),e.forEach(function(e){document.addEventListener(e,t)})}},disableOnClickOutside:function(){var t=this.__outsideClickHandler;if("undefined"!=typeof document){var e=this.props.eventTypes||d;e.forEach||(e=[e]),e.forEach(function(e){document.removeEventListener(e,t)})}},render:function(){var s=this.props,n={};return Object.keys(this.props).forEach(function(t){"excludeScrollbar"!==t&&(n[t]=s[t])}),t.prototype.isReactComponent&&(n.ref="instance"),n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,e.createElement(t,n)}});return function(t,e){var s=t.displayName||t.name||"Component";e.displayName="OnClickOutside("+s+")"}(t,a),a}}function o(i,r){n=[s(3),s(10)],a=function(t,e){return r(i,t,e)}.apply(e,n),!(void 0!==a&&(t.exports=a))}var c=[],l=[],u="ignore-react-onclickoutside",d=["mousedown","touchstart"],p=function(t,e,s){return t===e||(t.correspondingElement?t.correspondingElement.classList.contains(s):t.classList.contains(s))},h=function(t,e,s){if(t===e)return!0;for(;t.parentNode;){if(p(t,e,s))return!0;t=t.parentNode}return t},m=function(t){return document.documentElement.clientWidth<=t.clientX},f=function(t,e,s,n,a,i,r){return function(e){i&&e.preventDefault(),r&&e.stopPropagation();var o=e.target;a&&m(e)||h(o,t,n)!==document||s(e)}};o(i,r)}(this)},function(t,e){t.exports=s}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment"),require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["moment","React","ReactDOM"],e):"object"==typeof exports?exports.Datetime=e(require("moment"),require("React"),require("ReactDOM")):t.Datetime=e(t.moment,t.React,t.ReactDOM)}(this,function(t,e,s){return function(t){function e(n){if(s[n])return s[n].exports;var i=s[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){"use strict";var n=s(1),i=s(2),a=s(3),r=s(4),o=a.PropTypes,c=a.createClass({propTypes:{onFocus:o.func,onBlur:o.func,onChange:o.func,locale:o.string,utc:o.bool,input:o.bool,inputProps:o.object,timeConstraints:o.object,viewMode:o.oneOf(["years","months","days","time"]),isValidDate:o.func,open:o.bool,strictParsing:o.bool,closeOnSelect:o.bool,closeOnTab:o.bool},getDefaultProps:function(){var t=function(){};return{className:"",defaultValue:"",inputProps:{},input:!0,onFocus:t,onBlur:t,onChange:t,timeFormat:!0,timeConstraints:{},dateFormat:!0,strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,utc:!1}},getInitialState:function(){var t=this.getStateFromProps(this.props);return void 0===t.open&&(t.open=!this.props.input),t.currentView=this.props.dateFormat?this.props.viewMode||t.updateOn||"days":"time",t},getStateFromProps:function(t){var e,s,n,i,a=this.getFormats(t),r=t.value||t.defaultValue;return r&&"string"==typeof r?e=this.localMoment(r,a.datetime):r&&(e=this.localMoment(r)),e&&!e.isValid()&&(e=null),s=e?e.clone().startOf("month"):this.localMoment().startOf("month"),n=this.getUpdateOn(a),i=e?e.format(a.datetime):r.isValid&&!r.isValid()?"":r||"",{updateOn:n,inputFormat:a.datetime,viewDate:s,selectedDate:e,inputValue:i,open:t.open}},getUpdateOn:function(t){return t.date.match(/[lLD]/)?"days":t.date.indexOf("M")!==-1?"months":t.date.indexOf("Y")!==-1?"years":"days"},getFormats:function(t){var e={date:t.dateFormat||"",time:t.timeFormat||""},s=this.localMoment(t.date,null,t).localeData();return e.date===!0?e.date=s.longDateFormat("L"):"days"!==this.getUpdateOn(e)&&(e.time=""),e.time===!0&&(e.time=s.longDateFormat("LT")),e.datetime=e.date&&e.time?e.date+" "+e.time:e.date||e.time,e},componentWillReceiveProps:function(t){var e=this.getFormats(t),s={};if(t.value===this.props.value&&e.datetime===this.getFormats(this.props).datetime||(s=this.getStateFromProps(t)),void 0===s.open&&(this.props.closeOnSelect&&"time"!==this.state.currentView?s.open=!1:s.open=this.state.open),t.viewMode!==this.props.viewMode&&(s.currentView=t.viewMode),t.locale!==this.props.locale){if(this.state.viewDate){var n=this.state.viewDate.clone().locale(t.locale);s.viewDate=n}if(this.state.selectedDate){var i=this.state.selectedDate.clone().locale(t.locale);s.selectedDate=i,s.inputValue=i.format(e.datetime)}}t.utc!==this.props.utc&&(t.utc?(this.state.viewDate&&(s.viewDate=this.state.viewDate.clone().utc()),this.state.selectedDate&&(s.selectedDate=this.state.selectedDate.clone().utc(),s.inputValue=s.selectedDate.format(e.datetime))):(this.state.viewDate&&(s.viewDate=this.state.viewDate.clone().local()),this.state.selectedDate&&(s.selectedDate=this.state.selectedDate.clone().local(),s.inputValue=s.selectedDate.format(e.datetime)))),this.setState(s)},onInputChange:function(t){var e=null===t.target?t:t.target.value,s=this.localMoment(e,this.state.inputFormat),n={inputValue:e};return s.isValid()&&!this.props.value?(n.selectedDate=s,n.viewDate=s.clone().startOf("month")):n.selectedDate=null,this.setState(n,function(){return this.props.onChange(s.isValid()?s:this.state.inputValue)})},onInputKey:function(t){9===t.which&&this.props.closeOnTab&&this.closeCalendar()},showView:function(t){var e=this;return function(){e.setState({currentView:t})}},setDate:function(t){var e=this,s={month:"days",year:"months"};return function(n){e.setState({viewDate:e.state.viewDate.clone()[t](parseInt(n.target.getAttribute("data-value"),10)).startOf(t),currentView:s[t]})}},addTime:function(t,e,s){return this.updateTime("add",t,e,s)},subtractTime:function(t,e,s){return this.updateTime("subtract",t,e,s)},updateTime:function(t,e,s,n){var i=this;return function(){var a={},r=n?"selectedDate":"viewDate";a[r]=i.state[r].clone()[t](e,s),i.setState(a)}},allowedSetTime:["hours","minutes","seconds","milliseconds"],setTime:function(t,e){var s,n=this.allowedSetTime.indexOf(t)+1,i=this.state,a=(i.selectedDate||i.viewDate).clone();for(a[t](e);n<this.allowedSetTime.length;n++)s=this.allowedSetTime[n],a[s](a[s]());this.props.value||this.setState({selectedDate:a,inputValue:a.format(i.inputFormat)}),this.props.onChange(a)},updateSelectedDate:function(t,e){var s,n=t.target,i=0,a=this.state.viewDate,r=this.state.selectedDate||a;if(n.className.indexOf("rdtDay")!==-1?(n.className.indexOf("rdtNew")!==-1?i=1:n.className.indexOf("rdtOld")!==-1&&(i=-1),s=a.clone().month(a.month()+i).date(parseInt(n.getAttribute("data-value"),10))):n.className.indexOf("rdtMonth")!==-1?s=a.clone().month(parseInt(n.getAttribute("data-value"),10)).date(r.date()):n.className.indexOf("rdtYear")!==-1&&(s=a.clone().month(r.month()).date(r.date()).year(parseInt(n.getAttribute("data-value"),10))),s.hours(r.hours()).minutes(r.minutes()).seconds(r.seconds()).milliseconds(r.milliseconds()),this.props.value)this.props.closeOnSelect&&e&&this.closeCalendar();else{var o=!(this.props.closeOnSelect&&e);o||this.props.onBlur(s),this.setState({selectedDate:s,viewDate:s.clone().startOf("month"),inputValue:s.format(this.state.inputFormat),open:o})}this.props.onChange(s)},openCalendar:function(){this.state.open||this.setState({open:!0},function(){this.props.onFocus()})},closeCalendar:function(){this.setState({open:!1},function(){this.props.onBlur(this.state.selectedDate||this.state.inputValue)})},handleClickOutside:function(){this.props.input&&this.state.open&&!this.props.open&&this.setState({open:!1},function(){this.props.onBlur(this.state.selectedDate||this.state.inputValue)})},localMoment:function(t,e,s){s=s||this.props;var n=s.utc?i.utc:i,a=n(t,e,s.strictParsing);return s.locale&&a.locale(s.locale),a},componentProps:{fromProps:["value","isValidDate","renderDay","renderMonth","renderYear","timeConstraints"],fromState:["viewDate","selectedDate","updateOn"],fromThis:["setDate","setTime","showView","addTime","subtractTime","updateSelectedDate","localMoment","handleClickOutside"]},getComponentProps:function(){var t=this,e=this.getFormats(this.props),s={dateFormat:e.date,timeFormat:e.time};return this.componentProps.fromProps.forEach(function(e){s[e]=t.props[e]}),this.componentProps.fromState.forEach(function(e){s[e]=t.state[e]}),this.componentProps.fromThis.forEach(function(e){s[e]=t[e]}),s},render:function(){var t=a.DOM,e="rdt"+(this.props.className?Array.isArray(this.props.className)?" "+this.props.className.join(" "):" "+this.props.className:""),s=[];return this.props.input?s=[t.input(n({key:"i",type:"text",className:"form-control",onFocus:this.openCalendar,onChange:this.onInputChange,onKeyDown:this.onInputKey,value:this.state.inputValue},this.props.inputProps))]:e+=" rdtStatic",this.state.open&&(e+=" rdtOpen"),t.div({className:e},s.concat(t.div({key:"dt",className:"rdtPicker"},a.createElement(r,{view:this.state.currentView,viewProps:this.getComponentProps(),onClickOutside:this.handleClickOutside}))))}});c.moment=i,t.exports=c},function(t,e){"use strict";function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function n(t){var e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(t))),e.filter(function(e){return i.call(t,e)})}var i=Object.prototype.propertyIsEnumerable;t.exports=Object.assign||function(t,e){for(var i,a,r=s(t),o=1;o<arguments.length;o++){i=arguments[o],a=n(Object(i));for(var c=0;c<a.length;c++)r[a[c]]=i[a[c]]}return r}},function(e,s){e.exports=t},function(t,s){t.exports=e},function(t,e,s){var n=s(3),i=s(5),a=s(8),r=s(9),o=s(10),c=n.createClass({viewComponents:{days:i,months:a,years:r,time:o},render:function(){return n.createElement(this.viewComponents[this.props.view],this.props.viewProps)}});t.exports=c},function(t,e,s){"use strict";var n=s(3),i=s(2),a=s(6),r=n.DOM,o=a(n.createClass({render:function(){var t,e=this.renderFooter(),s=this.props.viewDate,n=s.localeData();return t=[r.thead({key:"th"},[r.tr({key:"h"},[r.th({key:"p",className:"rdtPrev"},r.span({onClick:this.props.subtractTime(1,"months")},"‹")),r.th({key:"s",className:"rdtSwitch",onClick:this.props.showView("months"),colSpan:5,"data-value":this.props.viewDate.month()},n.months(s)+" "+s.year()),r.th({key:"n",className:"rdtNext"},r.span({onClick:this.props.addTime(1,"months")},"›"))]),r.tr({key:"d"},this.getDaysOfWeek(n).map(function(t,e){return r.th({key:t+e,className:"dow"},t)}))]),r.tbody({key:"tb"},this.renderDays())],e&&t.push(e),r.div({className:"rdtDays"},r.table({},t))},getDaysOfWeek:function(t){var e=t._weekdaysMin,s=t.firstDayOfWeek(),n=[],i=0;return e.forEach(function(t){n[(7+i++-s)%7]=t}),n},renderDays:function(){var t,e,s,n,a=this.props.viewDate,o=this.props.selectedDate&&this.props.selectedDate.clone(),c=a.clone().subtract(1,"months"),l=a.year(),d=a.month(),u=[],p=[],h=this.props.renderDay||this.renderDay,m=this.props.isValidDate||this.alwaysValidDate;c.date(c.daysInMonth()).startOf("week");for(var f=c.clone().add(42,"d");c.isBefore(f);)t="rdtDay",n=c.clone(),c.year()===l&&c.month()<d||c.year()<l?t+=" rdtOld":(c.year()===l&&c.month()>d||c.year()>l)&&(t+=" rdtNew"),o&&c.isSame(o,"day")&&(t+=" rdtActive"),c.isSame(i(),"day")&&(t+=" rdtToday"),e=!m(n,o),e&&(t+=" rdtDisabled"),s={key:c.format("M_D"),"data-value":c.date(),className:t},e||(s.onClick=this.updateSelectedDate),p.push(h(s,n,o)),7===p.length&&(u.push(r.tr({key:c.format("M_D")},p)),p=[]),c.add(1,"d");return u},updateSelectedDate:function(t){this.props.updateSelectedDate(t,!0)},renderDay:function(t,e){return r.td(t,e.date())},renderFooter:function(){if(!this.props.timeFormat)return"";var t=this.props.selectedDate||this.props.viewDate;return r.tfoot({key:"tf"},r.tr({},r.td({onClick:this.props.showView("time"),colSpan:7,className:"rdtTimeToggle"},t.format(this.props.timeFormat))))},alwaysValidDate:function(){return 1},handleClickOutside:function(){this.props.handleClickOutside()}}));t.exports=o},function(t,e,s){var n,i;!function(a){function r(t,e,s){return function(t,n){var i=e.createClass({statics:{getClass:function(){return t.getClass?t.getClass():t}},getInstance:function(){return t.prototype.isReactComponent?this.refs.instance:this},__outsideClickHandler:function(){},componentDidMount:function(){if("undefined"!=typeof document&&document.createElement){var t,i=this.getInstance();if(n&&"function"==typeof n.handleClickOutside){if(t=n.handleClickOutside(i),"function"!=typeof t)throw new Error("Component lacks a function for processing outside click events specified by the handleClickOutside config option.")}else if("function"==typeof i.handleClickOutside)t=e.Component.prototype.isPrototypeOf(i)?i.handleClickOutside.bind(i):i.handleClickOutside;else{if("function"!=typeof i.props.handleClickOutside)throw new Error("Component lacks a handleClickOutside(event) function for processing outside click events.");t=i.props.handleClickOutside}var a=s.findDOMNode(i);null===a&&(console.warn("Antipattern warning: there was no DOM node associated with the component that is being wrapped by outsideClick."),console.warn(["This is typically caused by having a component that starts life with a render function that","returns `null` (due to a state or props value), so that the component 'exist' in the React","chain of components, but not in the DOM.\n\nInstead, you need to refactor your code so that the","decision of whether or not to show your component is handled by the parent, in their render()","function.\n\nIn code, rather than:\n\n A{render(){return check? <.../> : null;}\n B{render(){<A check=... />}\n\nmake sure that you","use:\n\n A{render(){return <.../>}\n B{render(){return <...>{ check ? <A/> : null }<...>}}\n\nThat is:","the parent is always responsible for deciding whether or not to render any of its children.","It is not the child's responsibility to decide whether a render instruction from above should","get ignored or not by returning `null`.\n\nWhen any component gets its render() function called,","that is the signal that it should be rendering its part of the UI. It may in turn decide not to","render all of *its* children, but it should never return `null` for itself. It is not responsible","for that decision."].join(" ")));var r=this.__outsideClickHandler=f(a,i,t,this.props.outsideClickIgnoreClass||d,this.props.excludeScrollbar||!1,this.props.preventDefault||!1,this.props.stopPropagation||!1),o=c.length;c.push(this),l[o]=r,this.props.disableOnClickOutside||this.enableOnClickOutside()}},componentWillReceiveProps:function(t){this.props.disableOnClickOutside&&!t.disableOnClickOutside?this.enableOnClickOutside():!this.props.disableOnClickOutside&&t.disableOnClickOutside&&this.disableOnClickOutside()},componentWillUnmount:function(){this.disableOnClickOutside(),this.__outsideClickHandler=!1;var t=c.indexOf(this);t>-1&&(l[t]&&l.splice(t,1),c.splice(t,1))},enableOnClickOutside:function(){var t=this.__outsideClickHandler;if("undefined"!=typeof document){var e=this.props.eventTypes||u;e.forEach||(e=[e]),e.forEach(function(e){document.addEventListener(e,t)})}},disableOnClickOutside:function(){var t=this.__outsideClickHandler;if("undefined"!=typeof document){var e=this.props.eventTypes||u;e.forEach||(e=[e]),e.forEach(function(e){document.removeEventListener(e,t)})}},render:function(){var s=this.props,n={};return Object.keys(this.props).forEach(function(t){"excludeScrollbar"!==t&&(n[t]=s[t])}),t.prototype.isReactComponent&&(n.ref="instance"),n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,e.createElement(t,n)}});return function(t,e){var s=t.displayName||t.name||"Component";e.displayName="OnClickOutside("+s+")"}(t,i),i}}function o(a,r){n=[s(3),s(7)],i=function(t,e){return r(a,t,e)}.apply(e,n),!(void 0!==i&&(t.exports=i))}var c=[],l=[],d="ignore-react-onclickoutside",u=["mousedown","touchstart"],p=function(t,e,s){return t===e||(t.correspondingElement?t.correspondingElement.classList.contains(s):t.classList.contains(s))},h=function(t,e,s){if(t===e)return!0;for(;t.parentNode;){if(p(t,e,s))return!0;t=t.parentNode}return t},m=function(t){return document.documentElement.clientWidth<=t.clientX},f=function(t,e,s,n,i,a,r){return function(e){a&&e.preventDefault(),r&&e.stopPropagation();var o=e.target;i&&m(e)||h(o,t,n)!==document||s(e)}};o(a,r)}(this)},function(t,e){t.exports=s},function(t,e,s){"use strict";function n(t){return t.charAt(0).toUpperCase()+t.slice(1)}var i=s(3),a=s(6),r=i.DOM,o=a(i.createClass({render:function(){return r.div({className:"rdtMonths"},[r.table({key:"a"},r.thead({},r.tr({},[r.th({key:"prev",className:"rdtPrev"},r.span({onClick:this.props.subtractTime(1,"years")},"‹")),r.th({key:"year",className:"rdtSwitch",onClick:this.props.showView("years"),colSpan:2,"data-value":this.props.viewDate.year()},this.props.viewDate.year()),r.th({key:"next",className:"rdtNext"},r.span({onClick:this.props.addTime(1,"years")},"›"))]))),r.table({key:"months"},r.tbody({key:"b"},this.renderMonths()))])},renderMonths:function(){for(var t,e,s,n,i,a,o,c=this.props.selectedDate,l=this.props.viewDate.month(),d=this.props.viewDate.year(),u=[],p=0,h=[],m=this.props.renderMonth||this.renderMonth,f=this.props.isValidDate||this.alwaysValidDate,v=1;p<12;)t="rdtMonth",s=this.props.viewDate.clone().set({year:d,month:p,date:v}),i=s.endOf("month").format("D"),a=Array.from({length:i},function(t,e){return e+1}),o=a.find(function(t){var e=s.clone().set("date",t);return f(e)}),n=void 0===o,n&&(t+=" rdtDisabled"),c&&p===l&&d===c.year()&&(t+=" rdtActive"),e={key:p,"data-value":p,className:t},n||(e.onClick="months"===this.props.updateOn?this.updateSelectedMonth:this.props.setDate("month")),h.push(m(e,p,d,c&&c.clone())),4===h.length&&(u.push(r.tr({key:l+"_"+u.length},h)),h=[]),p++;return u},updateSelectedMonth:function(t){this.props.updateSelectedDate(t)},renderMonth:function(t,e){var s=this.props.viewDate,i=s.localeData().monthsShort(s.month(e)),a=3,o=i.substring(0,a);return r.td(t,n(o))},alwaysValidDate:function(){return 1},handleClickOutside:function(){this.props.handleClickOutside()}}));t.exports=o},function(t,e,s){"use strict";var n=s(3),i=s(6),a=n.DOM,r=i(n.createClass({render:function(){var t=10*parseInt(this.props.viewDate.year()/10,10);return a.div({className:"rdtYears"},[a.table({key:"a"},a.thead({},a.tr({},[a.th({key:"prev",className:"rdtPrev"},a.span({onClick:this.props.subtractTime(10,"years")},"‹")),a.th({key:"year",className:"rdtSwitch",onClick:this.props.showView("years"),colSpan:2},t+"-"+(t+9)),a.th({key:"next",className:"rdtNext"},a.span({onClick:this.props.addTime(10,"years")},"›"))]))),a.table({key:"years"},a.tbody({},this.renderYears(t)))])},renderYears:function(t){var e,s,n,i,r,o,c,l=[],d=-1,u=[],p=this.props.renderYear||this.renderYear,h=this.props.selectedDate,m=this.props.isValidDate||this.alwaysValidDate,f=0,v=1;for(t--;d<11;)e="rdtYear",n=this.props.viewDate.clone().set({year:t,month:f,date:v}),r=n.endOf("year").format("DDD"),o=Array.from({length:r},function(t,e){return e+1}),c=o.find(function(t){var e=n.clone().dayOfYear(t);return m(e)}),i=void 0===c,i&&(e+=" rdtDisabled"),h&&h.year()===t&&(e+=" rdtActive"),s={key:t,"data-value":t,className:e},i||(s.onClick="years"===this.props.updateOn?this.updateSelectedYear:this.props.setDate("year")),l.push(p(s,t,h&&h.clone())),4===l.length&&(u.push(a.tr({key:d},l)),l=[]),t++,d++;return u},updateSelectedYear:function(t){this.props.updateSelectedDate(t)},renderYear:function(t,e){return a.td(t,e)},alwaysValidDate:function(){return 1},handleClickOutside:function(){this.props.handleClickOutside()}}));t.exports=r},function(t,e,s){"use strict";var n=s(3),i=s(1),a=s(6),r=n.DOM,o=a(n.createClass({getInitialState:function(){return this.calculateState(this.props)},calculateState:function(t){var e=t.selectedDate||t.viewDate,s=t.timeFormat,n=[];s.toLowerCase().indexOf("h")!==-1&&(n.push("hours"),s.indexOf("m")!==-1&&(n.push("minutes"),s.indexOf("s")!==-1&&n.push("seconds")));var i=!1;return null!==this.state&&this.props.timeFormat.toLowerCase().indexOf(" a")!==-1&&(i=this.props.timeFormat.indexOf(" A")!==-1?this.state.hours>=12?"PM":"AM":this.state.hours>=12?"pm":"am"),{hours:e.format("H"),minutes:e.format("mm"),seconds:e.format("ss"),milliseconds:e.format("SSS"),daypart:i,counters:n}},renderCounter:function(t){if("daypart"!==t){var e=this.state[t];return"hours"===t&&this.props.timeFormat.toLowerCase().indexOf(" a")!==-1&&(e=(e-1)%12+1,0===e&&(e=12)),r.div({key:t,className:"rdtCounter"},[r.span({key:"up",className:"rdtBtn",onMouseDown:this.onStartClicking("increase",t)},"▲"),r.div({key:"c",className:"rdtCount"},e),r.span({key:"do",className:"rdtBtn",onMouseDown:this.onStartClicking("decrease",t)},"▼")])}return""},renderDayPart:function(){return r.div({key:"dayPart",className:"rdtCounter"},[r.span({key:"up",className:"rdtBtn",onMouseDown:this.onStartClicking("toggleDayPart","hours")},"▲"),r.div({key:this.state.daypart,className:"rdtCount"},this.state.daypart),r.span({key:"do",className:"rdtBtn",onMouseDown:this.onStartClicking("toggleDayPart","hours")},"▼")])},render:function(){var t=this,e=[];return this.state.counters.forEach(function(s){e.length&&e.push(r.div({key:"sep"+e.length,className:"rdtCounterSeparator"},":")),e.push(t.renderCounter(s))}),this.state.daypart!==!1&&e.push(t.renderDayPart()),3===this.state.counters.length&&this.props.timeFormat.indexOf("S")!==-1&&(e.push(r.div({className:"rdtCounterSeparator",key:"sep5"},":")),e.push(r.div({className:"rdtCounter rdtMilli",key:"m"},r.input({value:this.state.milliseconds,type:"text",onChange:this.updateMilli})))),r.div({className:"rdtTime"},r.table({},[this.renderHeader(),r.tbody({key:"b"},r.tr({},r.td({},r.div({className:"rdtCounters"},e))))]))},componentWillMount:function(){var t=this;t.timeConstraints={hours:{min:0,max:23,step:1},minutes:{min:0,max:59,step:1},seconds:{min:0,max:59,step:1},milliseconds:{min:0,max:999,step:1}},["hours","minutes","seconds","milliseconds"].forEach(function(e){i(t.timeConstraints[e],t.props.timeConstraints[e])}),this.setState(this.calculateState(this.props))},componentWillReceiveProps:function(t){this.setState(this.calculateState(t))},updateMilli:function(t){var e=parseInt(t.target.value,10);e===t.target.value&&e>=0&&e<1e3&&(this.props.setTime("milliseconds",e),this.setState({milliseconds:e}))},renderHeader:function(){if(!this.props.dateFormat)return null;var t=this.props.selectedDate||this.props.viewDate;return r.thead({key:"h"},r.tr({},r.th({className:"rdtSwitch",colSpan:4,onClick:this.props.showView("days")},t.format(this.props.dateFormat))))},onStartClicking:function(t,e){var s=this;return function(){var n={};n[e]=s[t](e),s.setState(n),s.timer=setTimeout(function(){s.increaseTimer=setInterval(function(){n[e]=s[t](e),s.setState(n)},70)},500),s.mouseUpListener=function(){clearTimeout(s.timer),clearInterval(s.increaseTimer),s.props.setTime(e,s.state[e]),document.body.removeEventListener("mouseup",s.mouseUpListener)},document.body.addEventListener("mouseup",s.mouseUpListener)}},padValues:{hours:1,minutes:2,seconds:2,milliseconds:3},toggleDayPart:function(t){var e=parseInt(this.state[t],10)+12;return e>this.timeConstraints[t].max&&(e=this.timeConstraints[t].min+(e-(this.timeConstraints[t].max+1))),this.pad(t,e)},increase:function(t){var e=parseInt(this.state[t],10)+this.timeConstraints[t].step;return e>this.timeConstraints[t].max&&(e=this.timeConstraints[t].min+(e-(this.timeConstraints[t].max+1))),this.pad(t,e)},decrease:function(t){var e=parseInt(this.state[t],10)-this.timeConstraints[t].step;return e<this.timeConstraints[t].min&&(e=this.timeConstraints[t].max+1-(this.timeConstraints[t].min-e)),this.pad(t,e)},pad:function(t,e){for(var s=e+"";s.length<this.padValues[t];)s="0"+s;return s},handleClickOutside:function(){this.props.handleClickOutside()}}));t.exports=o}])}); | ||
//# sourceMappingURL=react-datetime.min.js.map |
{ | ||
"name": "react-datetime", | ||
"version": "2.8.7", | ||
"version": "2.8.8", | ||
"description": "A lightweight but complete datetime picker React.js component.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/YouCanBookMe/react-datetime", |
@@ -5,7 +5,6 @@ var React = require('react'), | ||
YearsView = require('./YearsView'), | ||
TimeView = require('./TimeView'), | ||
onClickOutside = require('react-onclickoutside') | ||
TimeView = require('./TimeView') | ||
; | ||
var CalendarContainer = onClickOutside( React.createClass({ | ||
var CalendarContainer = React.createClass({ | ||
viewComponents: { | ||
@@ -20,9 +19,5 @@ days: DaysView, | ||
return React.createElement( this.viewComponents[ this.props.view ], this.props.viewProps ); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.onClickOutside(); | ||
} | ||
})); | ||
}); | ||
module.exports = CalendarContainer; |
'use strict'; | ||
var React = require('react'), | ||
moment = require('moment') | ||
moment = require('moment'), | ||
onClickOutside = require('react-onclickoutside') | ||
; | ||
var DOM = React.DOM; | ||
var DateTimePickerDays = React.createClass({ | ||
var DateTimePickerDays = onClickOutside( React.createClass({ | ||
render: function() { | ||
@@ -136,5 +137,9 @@ var footer = this.renderFooter(), | ||
return 1; | ||
} | ||
}); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.handleClickOutside(); | ||
} | ||
})); | ||
module.exports = DateTimePickerDays; |
'use strict'; | ||
var React = require('react'); | ||
var React = require('react'), | ||
onClickOutside = require('react-onclickoutside') | ||
; | ||
var DOM = React.DOM; | ||
var DateTimePickerMonths = React.createClass({ | ||
var DateTimePickerMonths = onClickOutside( React.createClass({ | ||
render: function() { | ||
@@ -79,3 +81,3 @@ return DOM.div({ className: 'rdtMonths' }, [ | ||
updateSelectedMonth: function( event ) { | ||
this.props.updateSelectedDate( event, true ); | ||
this.props.updateSelectedDate( event ); | ||
}, | ||
@@ -95,5 +97,9 @@ | ||
return 1; | ||
} | ||
}); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.handleClickOutside(); | ||
} | ||
})); | ||
function capitalize( str ) { | ||
@@ -100,0 +106,0 @@ return str.charAt( 0 ).toUpperCase() + str.slice( 1 ); |
'use strict'; | ||
var React = require('react'), | ||
assign = require('object-assign') | ||
assign = require('object-assign'), | ||
onClickOutside = require('react-onclickoutside') | ||
; | ||
var DOM = React.DOM; | ||
var DateTimePickerTime = React.createClass({ | ||
var DateTimePickerTime = onClickOutside( React.createClass({ | ||
getInitialState: function() { | ||
@@ -220,5 +221,9 @@ return this.calculateState( this.props ); | ||
return str; | ||
} | ||
}); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.handleClickOutside(); | ||
} | ||
})); | ||
module.exports = DateTimePickerTime; |
'use strict'; | ||
var React = require('react'); | ||
var React = require('react'), | ||
onClickOutside = require('react-onclickoutside') | ||
; | ||
var DOM = React.DOM; | ||
var DateTimePickerYears = React.createClass({ | ||
var DateTimePickerYears = onClickOutside( React.createClass({ | ||
render: function() { | ||
@@ -87,3 +89,3 @@ var year = parseInt( this.props.viewDate.year() / 10, 10 ) * 10; | ||
updateSelectedYear: function( event ) { | ||
this.props.updateSelectedDate( event, true ); | ||
this.props.updateSelectedDate( event ); | ||
}, | ||
@@ -97,5 +99,9 @@ | ||
return 1; | ||
} | ||
}); | ||
}, | ||
handleClickOutside: function() { | ||
this.props.handleClickOutside(); | ||
} | ||
})); | ||
module.exports = DateTimePickerYears; |
Sorry, the diff of this file is not supported yet
256340
0.93%2712
1.08%