| | |
| | | /* |
| | | react-datetime v2.8.11 |
| | | react-datetime v2.15.0 |
| | | https://github.com/YouCanBookMe/react-datetime |
| | | MIT: https://github.com/YouCanBookMe/react-datetime/raw/master/LICENSE |
| | | */ |
| | |
| | | exports["Datetime"] = factory(require("React"), require("moment"), require("ReactDOM")); |
| | | else |
| | | root["Datetime"] = factory(root["React"], root["moment"], root["ReactDOM"]); |
| | | })(this, function(__WEBPACK_EXTERNAL_MODULE_12__, __WEBPACK_EXTERNAL_MODULE_16__, __WEBPACK_EXTERNAL_MODULE_20__) { |
| | | })(this, function(__WEBPACK_EXTERNAL_MODULE_12__, __WEBPACK_EXTERNAL_MODULE_15__, __WEBPACK_EXTERNAL_MODULE_19__) { |
| | | return /******/ (function(modules) { // webpackBootstrap |
| | | /******/ // The module cache |
| | | /******/ var installedModules = {}; |
| | |
| | | |
| | | var assign = __webpack_require__(1), |
| | | PropTypes = __webpack_require__(2), |
| | | createClass = __webpack_require__(11), |
| | | moment = __webpack_require__(16), |
| | | createClass = __webpack_require__(11), |
| | | moment = __webpack_require__(15), |
| | | React = __webpack_require__(12), |
| | | CalendarContainer = __webpack_require__(17) |
| | | ; |
| | | CalendarContainer = __webpack_require__(16) |
| | | ; |
| | | |
| | | var viewModes = Object.freeze({ |
| | | YEARS: 'years', |
| | | MONTHS: 'months', |
| | | DAYS: 'days', |
| | | TIME: 'time', |
| | | }); |
| | | |
| | | var TYPES = PropTypes; |
| | | var Datetime = createClass({ |
| | | displayName: 'DateTime', |
| | | propTypes: { |
| | | // value: TYPES.object | TYPES.string, |
| | | // defaultValue: TYPES.object | TYPES.string, |
| | | // viewDate: TYPES.object | TYPES.string, |
| | | onFocus: TYPES.func, |
| | | onBlur: TYPES.func, |
| | | onChange: TYPES.func, |
| | | onViewModeChange: TYPES.func, |
| | | onNavigateBack: TYPES.func, |
| | | onNavigateForward: TYPES.func, |
| | | locale: TYPES.string, |
| | | utc: TYPES.bool, |
| | | input: TYPES.bool, |
| | |
| | | // timeFormat: TYPES.string | TYPES.bool, |
| | | inputProps: TYPES.object, |
| | | timeConstraints: TYPES.object, |
| | | viewMode: TYPES.oneOf(['years', 'months', 'days', 'time']), |
| | | viewMode: TYPES.oneOf([viewModes.YEARS, viewModes.MONTHS, viewModes.DAYS, viewModes.TIME]), |
| | | isValidDate: TYPES.func, |
| | | open: TYPES.bool, |
| | | strictParsing: TYPES.bool, |
| | | closeOnSelect: TYPES.bool, |
| | | closeOnTab: TYPES.bool |
| | | }, |
| | | |
| | | getDefaultProps: function() { |
| | | var nof = function() {}; |
| | | return { |
| | | className: '', |
| | | defaultValue: '', |
| | | inputProps: {}, |
| | | input: true, |
| | | onFocus: nof, |
| | | onBlur: nof, |
| | | onChange: nof, |
| | | onViewModeChange: nof, |
| | | timeFormat: true, |
| | | timeConstraints: {}, |
| | | dateFormat: true, |
| | | strictParsing: true, |
| | | closeOnSelect: false, |
| | | closeOnTab: true, |
| | | utc: false |
| | | }; |
| | | }, |
| | | |
| | | getInitialState: function() { |
| | |
| | | if ( state.open === undefined ) |
| | | state.open = !this.props.input; |
| | | |
| | | state.currentView = this.props.dateFormat ? (this.props.viewMode || state.updateOn || 'days') : 'time'; |
| | | state.currentView = this.props.dateFormat ? |
| | | (this.props.viewMode || state.updateOn || viewModes.DAYS) : viewModes.TIME; |
| | | |
| | | return state; |
| | | }, |
| | | |
| | | parseDate: function (date, formats) { |
| | | var parsedDate; |
| | | |
| | | if (date && typeof date === 'string') |
| | | parsedDate = this.localMoment(date, formats.datetime); |
| | | else if (date) |
| | | parsedDate = this.localMoment(date); |
| | | |
| | | if (parsedDate && !parsedDate.isValid()) |
| | | parsedDate = null; |
| | | |
| | | return parsedDate; |
| | | }, |
| | | |
| | | getStateFromProps: function( props ) { |
| | | var formats = this.getFormats( props ), |
| | | date = props.value || props.defaultValue, |
| | | selectedDate, viewDate, updateOn, inputValue |
| | | ; |
| | | ; |
| | | |
| | | if ( date && typeof date === 'string' ) |
| | | selectedDate = this.localMoment( date, formats.datetime ); |
| | | else if ( date ) |
| | | selectedDate = this.localMoment( date ); |
| | | selectedDate = this.parseDate(date, formats); |
| | | |
| | | if ( selectedDate && !selectedDate.isValid() ) |
| | | selectedDate = null; |
| | | viewDate = this.parseDate(props.viewDate, formats); |
| | | |
| | | viewDate = selectedDate ? |
| | | selectedDate.clone().startOf('month') : |
| | | this.localMoment().startOf('month') |
| | | ; |
| | | viewDate ? viewDate.clone().startOf('month') : this.localMoment().startOf('month'); |
| | | |
| | | updateOn = this.getUpdateOn(formats); |
| | | |
| | |
| | | }, |
| | | |
| | | getUpdateOn: function( formats ) { |
| | | if ( formats.date.match(/[lLD]/) ) { |
| | | return 'days'; |
| | | if ( formats.date.match(/[lLD]/) ) { |
| | | return viewModes.DAYS; |
| | | } else if ( formats.date.indexOf('M') !== -1 ) { |
| | | return 'months'; |
| | | return viewModes.MONTHS; |
| | | } else if ( formats.date.indexOf('Y') !== -1 ) { |
| | | return 'years'; |
| | | return viewModes.YEARS; |
| | | } |
| | | |
| | | return 'days'; |
| | | return viewModes.DAYS; |
| | | }, |
| | | |
| | | getFormats: function( props ) { |
| | |
| | | time: props.timeFormat || '' |
| | | }, |
| | | locale = this.localMoment( props.date, null, props ).localeData() |
| | | ; |
| | | ; |
| | | |
| | | if ( formats.date === true ) { |
| | | formats.date = locale.longDateFormat('L'); |
| | | } |
| | | else if ( this.getUpdateOn(formats) !== 'days' ) { |
| | | else if ( this.getUpdateOn(formats) !== viewModes.DAYS ) { |
| | | formats.time = ''; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if ( updatedState.open === undefined ) { |
| | | if ( this.props.closeOnSelect && this.state.currentView !== 'time' ) { |
| | | if ( typeof nextProps.open !== 'undefined' ) { |
| | | updatedState.open = nextProps.open; |
| | | } else if ( this.props.closeOnSelect && this.state.currentView !== viewModes.TIME ) { |
| | | updatedState.open = false; |
| | | } else { |
| | | updatedState.open = this.state.open; |
| | |
| | | } |
| | | } |
| | | |
| | | if ( nextProps.viewDate !== this.props.viewDate ) { |
| | | updatedState.viewDate = moment(nextProps.viewDate); |
| | | } |
| | | //we should only show a valid date if we are provided a isValidDate function. Removed in 2.10.3 |
| | | /*if (this.props.isValidDate) { |
| | | updatedState.viewDate = updatedState.viewDate || this.state.viewDate; |
| | | while (!this.props.isValidDate(updatedState.viewDate)) { |
| | | updatedState.viewDate = updatedState.viewDate.add(1, 'day'); |
| | | } |
| | | }*/ |
| | | this.setState( updatedState ); |
| | | }, |
| | | |
| | |
| | | var value = e.target === null ? e : e.target.value, |
| | | localMoment = this.localMoment( value, this.state.inputFormat ), |
| | | update = { inputValue: value } |
| | | ; |
| | | ; |
| | | |
| | | if ( localMoment.isValid() && !this.props.value ) { |
| | | update.selectedDate = localMoment; |
| | |
| | | setDate: function( type ) { |
| | | var me = this, |
| | | nextViews = { |
| | | month: 'days', |
| | | year: 'months' |
| | | month: viewModes.DAYS, |
| | | year: viewModes.MONTHS, |
| | | } |
| | | ; |
| | | return function( e ) { |
| | |
| | | }; |
| | | }, |
| | | |
| | | addTime: function( amount, type, toSelected ) { |
| | | return this.updateTime( 'add', amount, type, toSelected ); |
| | | subtractTime: function( amount, type, toSelected ) { |
| | | var me = this; |
| | | return function() { |
| | | me.props.onNavigateBack( amount, type ); |
| | | me.updateTime( 'subtract', amount, type, toSelected ); |
| | | }; |
| | | }, |
| | | |
| | | subtractTime: function( amount, type, toSelected ) { |
| | | return this.updateTime( 'subtract', amount, type, toSelected ); |
| | | addTime: function( amount, type, toSelected ) { |
| | | var me = this; |
| | | return function() { |
| | | me.props.onNavigateForward( amount, type ); |
| | | me.updateTime( 'add', amount, type, toSelected ); |
| | | }; |
| | | }, |
| | | |
| | | updateTime: function( op, amount, type, toSelected ) { |
| | | var me = this; |
| | | var update = {}, |
| | | date = toSelected ? 'selectedDate' : 'viewDate'; |
| | | |
| | | return function() { |
| | | var update = {}, |
| | | date = toSelected ? 'selectedDate' : 'viewDate' |
| | | ; |
| | | update[ date ] = this.state[ date ].clone()[ op ]( amount, type ); |
| | | |
| | | update[ date ] = me.state[ date ].clone()[ op ]( amount, type ); |
| | | |
| | | me.setState( update ); |
| | | }; |
| | | this.setState( update ); |
| | | }, |
| | | |
| | | allowedSetTime: ['hours', 'minutes', 'seconds', 'milliseconds'], |
| | |
| | | state = this.state, |
| | | date = (state.selectedDate || state.viewDate).clone(), |
| | | nextType |
| | | ; |
| | | ; |
| | | |
| | | // It is needed to set all the time properties |
| | | // to not to reset the time |
| | |
| | | viewDate = this.state.viewDate, |
| | | currentDate = this.state.selectedDate || viewDate, |
| | | date |
| | | ; |
| | | ; |
| | | |
| | | if (target.className.indexOf('rdtDay') !== -1) { |
| | | if (target.className.indexOf('rdtNew') !== -1) |
| | |
| | | this.props.onChange( date ); |
| | | }, |
| | | |
| | | openCalendar: function() { |
| | | if (!this.state.open) { |
| | | openCalendar: function( e ) { |
| | | if ( !this.state.open ) { |
| | | this.setState({ open: true }, function() { |
| | | this.props.onFocus(); |
| | | this.props.onFocus( e ); |
| | | }); |
| | | } |
| | | }, |
| | |
| | | }, |
| | | |
| | | handleClickOutside: function() { |
| | | if ( this.props.input && this.state.open && !this.props.open ) { |
| | | if ( this.props.input && this.state.open && !this.props.open && !this.props.disableOnClickOutside ) { |
| | | this.setState({ open: false }, function() { |
| | | this.props.onBlur( this.state.selectedDate || this.state.inputValue ); |
| | | }); |
| | |
| | | var me = this, |
| | | formats = this.getFormats( this.props ), |
| | | props = {dateFormat: formats.date, timeFormat: formats.time} |
| | | ; |
| | | ; |
| | | |
| | | this.componentProps.fromProps.forEach( function( name ) { |
| | | props[ name ] = me.props[ name ]; |
| | |
| | | }, |
| | | |
| | | render: function() { |
| | | // TODO: Make a function or clean up this code, |
| | | // logic right now is really hard to follow |
| | | var className = 'rdt' + (this.props.className ? |
| | | ( Array.isArray( this.props.className ) ? |
| | | ' ' + this.props.className.join( ' ' ) : ' ' + this.props.className) : ''), |
| | | children = [] |
| | | ; |
| | | children = []; |
| | | |
| | | if ( this.props.input ) { |
| | | children = [ React.createElement('input', assign({ |
| | | key: 'i', |
| | | var finalInputProps = assign({ |
| | | type: 'text', |
| | | className: 'form-control', |
| | | onClick: this.openCalendar, |
| | | onFocus: this.openCalendar, |
| | | onChange: this.onInputChange, |
| | | onKeyDown: this.onInputKey, |
| | | value: this.state.inputValue |
| | | }, this.props.inputProps ))]; |
| | | value: this.state.inputValue, |
| | | }, this.props.inputProps); |
| | | if ( this.props.renderInput ) { |
| | | children = [ React.createElement('div', { key: 'i' }, this.props.renderInput( finalInputProps, this.openCalendar, this.closeCalendar )) ]; |
| | | } else { |
| | | children = [ React.createElement('input', assign({ key: 'i' }, finalInputProps ))]; |
| | | } |
| | | } else { |
| | | className += ' rdtStatic'; |
| | | } |
| | |
| | | if ( this.state.open ) |
| | | className += ' rdtOpen'; |
| | | |
| | | return React.createElement('div', {className: className}, children.concat( |
| | | React.createElement('div', |
| | | return React.createElement( 'div', { className: className }, children.concat( |
| | | React.createElement( 'div', |
| | | { key: 'dt', className: 'rdtPicker' }, |
| | | React.createElement( CalendarContainer, {view: this.state.currentView, viewProps: this.getComponentProps(), onClickOutside: this.handleClickOutside }) |
| | | React.createElement( CalendarContainer, { view: this.state.currentView, viewProps: this.getComponentProps(), onClickOutside: this.handleClickOutside }) |
| | | ) |
| | | )); |
| | | } |
| | | }); |
| | | |
| | | Datetime.defaultProps = { |
| | | className: '', |
| | | defaultValue: '', |
| | | inputProps: {}, |
| | | input: true, |
| | | onFocus: function() {}, |
| | | onBlur: function() {}, |
| | | onChange: function() {}, |
| | | onViewModeChange: function() {}, |
| | | onNavigateBack: function() {}, |
| | | onNavigateForward: function() {}, |
| | | timeFormat: true, |
| | | timeConstraints: {}, |
| | | dateFormat: true, |
| | | strictParsing: true, |
| | | closeOnSelect: false, |
| | | closeOnTab: true, |
| | | utc: false |
| | | }; |
| | | |
| | | // Make moment accessible through the Datetime class |
| | | Datetime.moment = moment; |
| | |
| | | var warning = emptyFunction; |
| | | |
| | | if (process.env.NODE_ENV !== 'production') { |
| | | var printWarning = function printWarning(format) { |
| | | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
| | | args[_key - 1] = arguments[_key]; |
| | | } |
| | | |
| | | var argIndex = 0; |
| | | var message = 'Warning: ' + format.replace(/%s/g, function () { |
| | | return args[argIndex++]; |
| | | }); |
| | | if (typeof console !== 'undefined') { |
| | | console.error(message); |
| | | } |
| | | try { |
| | | // --- Welcome to debugging React --- |
| | | // This error was thrown as a convenience so that you can use this stack |
| | | // to find the callsite that caused this warning to fire. |
| | | throw new Error(message); |
| | | } catch (x) {} |
| | | }; |
| | | |
| | | warning = function warning(condition, format) { |
| | | if (format === undefined) { |
| | | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); |
| | | } |
| | | |
| | | if (format.indexOf('Failed Composite propType: ') === 0) { |
| | | return; // Ignore CompositeComponent proptype check. |
| | | } |
| | | |
| | | if (!condition) { |
| | | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { |
| | | args[_key2 - 2] = arguments[_key2]; |
| | | (function () { |
| | | var printWarning = function printWarning(format) { |
| | | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
| | | args[_key - 1] = arguments[_key]; |
| | | } |
| | | |
| | | printWarning.apply(undefined, [format].concat(args)); |
| | | } |
| | | }; |
| | | var argIndex = 0; |
| | | var message = 'Warning: ' + format.replace(/%s/g, function () { |
| | | return args[argIndex++]; |
| | | }); |
| | | if (typeof console !== 'undefined') { |
| | | console.error(message); |
| | | } |
| | | try { |
| | | // --- Welcome to debugging React --- |
| | | // This error was thrown as a convenience so that you can use this stack |
| | | // to find the callsite that caused this warning to fire. |
| | | throw new Error(message); |
| | | } catch (x) {} |
| | | }; |
| | | |
| | | warning = function warning(condition, format) { |
| | | if (format === undefined) { |
| | | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); |
| | | } |
| | | |
| | | if (format.indexOf('Failed Composite propType: ') === 0) { |
| | | return; // Ignore CompositeComponent proptype check. |
| | | } |
| | | |
| | | if (!condition) { |
| | | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { |
| | | args[_key2 - 2] = arguments[_key2]; |
| | | } |
| | | |
| | | printWarning.apply(undefined, [format].concat(args)); |
| | | } |
| | | }; |
| | | })(); |
| | | } |
| | | |
| | | module.exports = warning; |
| | |
| | | |
| | | 'use strict'; |
| | | |
| | | var _assign = __webpack_require__(14); |
| | | var _assign = __webpack_require__(1); |
| | | |
| | | var emptyObject = __webpack_require__(15); |
| | | var emptyObject = __webpack_require__(14); |
| | | var _invariant = __webpack_require__(6); |
| | | |
| | | if (process.env.NODE_ENV !== 'production') { |
| | |
| | | |
| | | /***/ }), |
| | | /* 14 */ |
| | | /***/ (function(module, exports) { |
| | | |
| | | /* |
| | | object-assign |
| | | (c) Sindre Sorhus |
| | | @license MIT |
| | | */ |
| | | |
| | | 'use strict'; |
| | | /* eslint-disable no-unused-vars */ |
| | | var getOwnPropertySymbols = Object.getOwnPropertySymbols; |
| | | var hasOwnProperty = Object.prototype.hasOwnProperty; |
| | | var propIsEnumerable = Object.prototype.propertyIsEnumerable; |
| | | |
| | | function toObject(val) { |
| | | if (val === null || val === undefined) { |
| | | throw new TypeError('Object.assign cannot be called with null or undefined'); |
| | | } |
| | | |
| | | return Object(val); |
| | | } |
| | | |
| | | function shouldUseNative() { |
| | | try { |
| | | if (!Object.assign) { |
| | | return false; |
| | | } |
| | | |
| | | // Detect buggy property enumeration order in older V8 versions. |
| | | |
| | | // https://bugs.chromium.org/p/v8/issues/detail?id=4118 |
| | | var test1 = new String('abc'); // eslint-disable-line no-new-wrappers |
| | | test1[5] = 'de'; |
| | | if (Object.getOwnPropertyNames(test1)[0] === '5') { |
| | | return false; |
| | | } |
| | | |
| | | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 |
| | | var test2 = {}; |
| | | for (var i = 0; i < 10; i++) { |
| | | test2['_' + String.fromCharCode(i)] = i; |
| | | } |
| | | var order2 = Object.getOwnPropertyNames(test2).map(function (n) { |
| | | return test2[n]; |
| | | }); |
| | | if (order2.join('') !== '0123456789') { |
| | | return false; |
| | | } |
| | | |
| | | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 |
| | | var test3 = {}; |
| | | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { |
| | | test3[letter] = letter; |
| | | }); |
| | | if (Object.keys(Object.assign({}, test3)).join('') !== |
| | | 'abcdefghijklmnopqrst') { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } catch (err) { |
| | | // We don't expect any of the above to throw, but better to be safe. |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | module.exports = shouldUseNative() ? Object.assign : function (target, source) { |
| | | var from; |
| | | var to = toObject(target); |
| | | var symbols; |
| | | |
| | | for (var s = 1; s < arguments.length; s++) { |
| | | from = Object(arguments[s]); |
| | | |
| | | for (var key in from) { |
| | | if (hasOwnProperty.call(from, key)) { |
| | | to[key] = from[key]; |
| | | } |
| | | } |
| | | |
| | | if (getOwnPropertySymbols) { |
| | | symbols = getOwnPropertySymbols(from); |
| | | for (var i = 0; i < symbols.length; i++) { |
| | | if (propIsEnumerable.call(from, symbols[i])) { |
| | | to[symbols[i]] = from[symbols[i]]; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return to; |
| | | }; |
| | | |
| | | |
| | | /***/ }), |
| | | /* 15 */ |
| | | /***/ (function(module, exports, __webpack_require__) { |
| | | |
| | | /* WEBPACK VAR INJECTION */(function(process) {/** |
| | |
| | | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) |
| | | |
| | | /***/ }), |
| | | /* 16 */ |
| | | /* 15 */ |
| | | /***/ (function(module, exports) { |
| | | |
| | | module.exports = __WEBPACK_EXTERNAL_MODULE_16__; |
| | | module.exports = __WEBPACK_EXTERNAL_MODULE_15__; |
| | | |
| | | /***/ }), |
| | | /* 17 */ |
| | | /* 16 */ |
| | | /***/ (function(module, exports, __webpack_require__) { |
| | | |
| | | 'use strict'; |
| | | |
| | | var React = __webpack_require__(12), |
| | | createClass = __webpack_require__(11), |
| | | DaysView = __webpack_require__(18), |
| | | MonthsView = __webpack_require__(21), |
| | | YearsView = __webpack_require__(22), |
| | | TimeView = __webpack_require__(23) |
| | | ; |
| | | createClass = __webpack_require__(11), |
| | | DaysView = __webpack_require__(17), |
| | | MonthsView = __webpack_require__(21), |
| | | YearsView = __webpack_require__(22), |
| | | TimeView = __webpack_require__(23) |
| | | ; |
| | | |
| | | var CalendarContainer = createClass({ |
| | | viewComponents: { |
| | |
| | | time: TimeView |
| | | }, |
| | | |
| | | render: function() { |
| | | return React.createElement( this.viewComponents[ this.props.view ], this.props.viewProps ); |
| | | } |
| | | render: function() { |
| | | return React.createElement( this.viewComponents[ this.props.view ], this.props.viewProps ); |
| | | } |
| | | }); |
| | | |
| | | module.exports = CalendarContainer; |
| | | |
| | | |
| | | /***/ }), |
| | | /* 18 */ |
| | | /* 17 */ |
| | | /***/ (function(module, exports, __webpack_require__) { |
| | | |
| | | 'use strict'; |
| | | |
| | | var React = __webpack_require__(12), |
| | | createClass = __webpack_require__(11), |
| | | moment = __webpack_require__(16), |
| | | onClickOutside = __webpack_require__(19) |
| | | ; |
| | | createClass = __webpack_require__(11), |
| | | moment = __webpack_require__(15), |
| | | onClickOutside = __webpack_require__(18).default |
| | | ; |
| | | |
| | | var DateTimePickerDays = onClickOutside( createClass({ |
| | | render: function() { |
| | |
| | | date = this.props.viewDate, |
| | | locale = date.localeData(), |
| | | tableChildren |
| | | ; |
| | | ; |
| | | |
| | | tableChildren = [ |
| | | React.createElement('thead', { key: 'th' }, [ |
| | |
| | | first = locale.firstDayOfWeek(), |
| | | dow = [], |
| | | i = 0 |
| | | ; |
| | | ; |
| | | |
| | | days.forEach( function( day ) { |
| | | dow[ (7 + ( i++ ) - first) % 7 ] = day; |
| | |
| | | renderer = this.props.renderDay || this.renderDay, |
| | | isValid = this.props.isValidDate || this.alwaysValidDate, |
| | | classes, isDisabled, dayProps, currentDate |
| | | ; |
| | | ; |
| | | |
| | | // Go to the last week of the previous month |
| | | prevMonth.date( prevMonth.daysInMonth() ).startOf( 'week' ); |
| | |
| | | return 1; |
| | | }, |
| | | |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | })); |
| | | |
| | | module.exports = DateTimePickerDays; |
| | | |
| | | |
| | | /***/ }), |
| | | /* 19 */ |
| | | /* 18 */ |
| | | /***/ (function(module, exports, __webpack_require__) { |
| | | |
| | | var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** |
| | | 'use strict'; |
| | | |
| | | exports.__esModule = true; |
| | | exports.IGNORE_CLASS_NAME = undefined; |
| | | exports.default = onClickOutsideHOC; |
| | | |
| | | var _react = __webpack_require__(12); |
| | | |
| | | var _reactDom = __webpack_require__(19); |
| | | |
| | | var _generateOutsideCheck = __webpack_require__(20); |
| | | |
| | | var _generateOutsideCheck2 = _interopRequireDefault(_generateOutsideCheck); |
| | | |
| | | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
| | | |
| | | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
| | | |
| | | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } |
| | | |
| | | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
| | | |
| | | /** |
| | | * A higher-order-component for handling onClickOutside for React components. |
| | | */ |
| | | (function(root) { |
| | | var registeredComponents = []; |
| | | var handlers = []; |
| | | |
| | | // administrative |
| | | var registeredComponents = []; |
| | | var handlers = []; |
| | | var IGNORE_CLASS = 'ignore-react-onclickoutside'; |
| | | var DEFAULT_EVENTS = ['mousedown', 'touchstart']; |
| | | var touchEvents = ['touchstart', 'touchmove']; |
| | | var IGNORE_CLASS_NAME = exports.IGNORE_CLASS_NAME = 'ignore-react-onclickoutside'; |
| | | |
| | | /** |
| | | * 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); |
| | | }; |
| | | /** |
| | | * 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 onClickOutsideHOC(WrappedComponent, config) { |
| | | var _class, _temp2; |
| | | |
| | | /** |
| | | * 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; |
| | | } |
| | | return _temp2 = _class = function (_Component) { |
| | | _inherits(onClickOutside, _Component); |
| | | |
| | | // 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; |
| | | function onClickOutside() { |
| | | var _temp, _this, _ret; |
| | | |
| | | _classCallCheck(this, onClickOutside); |
| | | |
| | | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { |
| | | args[_key] = arguments[_key]; |
| | | } |
| | | current = current.parentNode; |
| | | |
| | | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.__outsideClickHandler = null, _this.enableOnClickOutside = function () { |
| | | var fn = _this.__outsideClickHandler; |
| | | if (fn && typeof document !== 'undefined') { |
| | | var events = _this.props.eventTypes; |
| | | if (!events.forEach) { |
| | | events = [events]; |
| | | } |
| | | |
| | | events.forEach(function (eventName) { |
| | | var handlerOptions = null; |
| | | var isTouchEvent = touchEvents.indexOf(eventName) !== -1; |
| | | |
| | | if (isTouchEvent) { |
| | | handlerOptions = { passive: !_this.props.preventDefault }; |
| | | } |
| | | |
| | | document.addEventListener(eventName, fn, handlerOptions); |
| | | }); |
| | | } |
| | | }, _this.disableOnClickOutside = function () { |
| | | var fn = _this.__outsideClickHandler; |
| | | if (fn && typeof document !== 'undefined') { |
| | | var events = _this.props.eventTypes; |
| | | if (!events.forEach) { |
| | | events = [events]; |
| | | } |
| | | events.forEach(function (eventName) { |
| | | return document.removeEventListener(eventName, fn); |
| | | }); |
| | | } |
| | | }, _this.getRef = function (ref) { |
| | | return _this.instanceRef = ref; |
| | | }, _temp), _possibleConstructorReturn(_this, _ret); |
| | | } |
| | | return current; |
| | | }; |
| | | |
| | | /** |
| | | * Check if the browser scrollbar was clicked |
| | | */ |
| | | var clickedScrollbar = function(evt) { |
| | | return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY; |
| | | }; |
| | | /** |
| | | * Access the WrappedComponent's instance. |
| | | */ |
| | | onClickOutside.prototype.getInstance = function getInstance() { |
| | | if (!WrappedComponent.prototype.isReactComponent) { |
| | | return this; |
| | | } |
| | | var ref = this.instanceRef; |
| | | return ref.getInstance ? ref.getInstance() : ref; |
| | | }; |
| | | |
| | | /** |
| | | * 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)) { |
| | | // this is given meaning in componentDidMount/componentDidUpdate |
| | | |
| | | |
| | | /** |
| | | * Add click listeners to the current document, |
| | | * linked to this component's state. |
| | | */ |
| | | onClickOutside.prototype.componentDidMount = function componentDidMount() { |
| | | // 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; |
| | | } |
| | | 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, createReactClass) { |
| | | var instance = this.getInstance(); |
| | | |
| | | // The actual Component-wrapping HOC: |
| | | return function onClickOutsideHOC(Component, config) { |
| | | var wrapComponentWithOnClickOutsideHandling = createReactClass({ |
| | | 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() {}, |
| | | |
| | | getDefaultProps: function() { |
| | | return { |
| | | excludeScrollbar: config && config.excludeScrollbar |
| | | }; |
| | | }, |
| | | |
| | | /** |
| | | * 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, // fallback not needed, prop always exists because of getDefaultProps |
| | | 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); |
| | | if (config && typeof config.handleClickOutside === 'function') { |
| | | this.__clickOutsideHandlerProp = config.handleClickOutside(instance); |
| | | if (typeof this.__clickOutsideHandlerProp !== 'function') { |
| | | throw new Error('WrappedComponent 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)) { |
| | | this.__clickOutsideHandlerProp = instance.handleClickOutside.bind(instance); |
| | | } else { |
| | | this.__clickOutsideHandlerProp = instance.handleClickOutside; |
| | | } |
| | | } else if (typeof instance.props.handleClickOutside === 'function') { |
| | | this.__clickOutsideHandlerProp = instance.props.handleClickOutside; |
| | | } else { |
| | | throw new Error('WrappedComponent lacks a handleClickOutside(event) function for processing outside click events.'); |
| | | } |
| | | |
| | | // Add display name for React devtools |
| | | (function bindWrappedComponentName(c, wrapper) { |
| | | var componentName = c.displayName || c.name || 'Component'; |
| | | wrapper.displayName = 'OnClickOutside(' + componentName + ')'; |
| | | }(Component, wrapComponentWithOnClickOutsideHandling)); |
| | | // TODO: try to get rid of this, could be done with function ref, might be problematic for SFC though, they do not expose refs |
| | | if ((0, _reactDom.findDOMNode)(instance) === null) { |
| | | return; |
| | | } |
| | | |
| | | return wrapComponentWithOnClickOutsideHandling; |
| | | this.addOutsideClickHandler(); |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * 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__(12),__webpack_require__(20),__webpack_require__(11)], __WEBPACK_AMD_DEFINE_RESULT__ = function(React, ReactDom, createReactClass) { |
| | | if (!createReactClass) createReactClass = React.createClass; |
| | | return factory(root, React, ReactDom, createReactClass); |
| | | }.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'), require('create-react-class')); |
| | | } else { |
| | | // Browser globals (root is window) |
| | | var createReactClass = React.createClass ? React.createClass : window.createReactClass; |
| | | root.onClickOutside = factory(root, React, ReactDOM, createReactClass); |
| | | } |
| | | } |
| | | /** |
| | | * Track for disableOnClickOutside props changes and enable/disable click outside |
| | | */ |
| | | |
| | | // Make it all happen |
| | | setupBinding(root, setupHOC); |
| | | |
| | | }(this)); |
| | | onClickOutside.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { |
| | | if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { |
| | | this.enableOnClickOutside(); |
| | | } else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { |
| | | this.disableOnClickOutside(); |
| | | } |
| | | }; |
| | | |
| | | onClickOutside.prototype.componentDidUpdate = function componentDidUpdate() { |
| | | var componentNode = (0, _reactDom.findDOMNode)(this.getInstance()); |
| | | |
| | | if (componentNode === null && this.__outsideClickHandler) { |
| | | this.removeOutsideClickHandler(); |
| | | return; |
| | | } |
| | | |
| | | if (componentNode !== null && !this.__outsideClickHandler) { |
| | | this.addOutsideClickHandler(); |
| | | return; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * Remove all document's event listeners for this component |
| | | */ |
| | | |
| | | |
| | | onClickOutside.prototype.componentWillUnmount = function componentWillUnmount() { |
| | | this.removeOutsideClickHandler(); |
| | | }; |
| | | |
| | | /** |
| | | * Can be called to explicitly enable event listening |
| | | * for clicks and touches outside of this element. |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Can be called to explicitly disable event listening |
| | | * for clicks and touches outside of this element. |
| | | */ |
| | | |
| | | |
| | | onClickOutside.prototype.addOutsideClickHandler = function addOutsideClickHandler() { |
| | | var fn = this.__outsideClickHandler = (0, _generateOutsideCheck2.default)((0, _reactDom.findDOMNode)(this.getInstance()), this.__clickOutsideHandlerProp, this.props.outsideClickIgnoreClass, this.props.excludeScrollbar, this.props.preventDefault, this.props.stopPropagation); |
| | | |
| | | 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(); |
| | | } |
| | | }; |
| | | |
| | | onClickOutside.prototype.removeOutsideClickHandler = function removeOutsideClickHandler() { |
| | | 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); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * Pass-through render |
| | | */ |
| | | onClickOutside.prototype.render = function render() { |
| | | var _this2 = this; |
| | | |
| | | var props = Object.keys(this.props).filter(function (prop) { |
| | | return prop !== 'excludeScrollbar'; |
| | | }).reduce(function (props, prop) { |
| | | props[prop] = _this2.props[prop]; |
| | | return props; |
| | | }, {}); |
| | | |
| | | if (WrappedComponent.prototype.isReactComponent) { |
| | | props.ref = this.getRef; |
| | | } else { |
| | | props.wrappedRef = this.getRef; |
| | | } |
| | | |
| | | props.disableOnClickOutside = this.disableOnClickOutside; |
| | | props.enableOnClickOutside = this.enableOnClickOutside; |
| | | |
| | | return (0, _react.createElement)(WrappedComponent, props); |
| | | }; |
| | | |
| | | return onClickOutside; |
| | | }(_react.Component), _class.displayName = 'OnClickOutside(' + (WrappedComponent.displayName || WrappedComponent.name || 'Component') + ')', _class.defaultProps = { |
| | | eventTypes: ['mousedown', 'touchstart'], |
| | | excludeScrollbar: config && config.excludeScrollbar || false, |
| | | outsideClickIgnoreClass: IGNORE_CLASS_NAME, |
| | | preventDefault: false, |
| | | stopPropagation: false |
| | | }, _class.getClass = function () { |
| | | return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent; |
| | | }, _temp2; |
| | | } |
| | | |
| | | /***/ }), |
| | | /* 19 */ |
| | | /***/ (function(module, exports) { |
| | | |
| | | module.exports = __WEBPACK_EXTERNAL_MODULE_19__; |
| | | |
| | | /***/ }), |
| | | /* 20 */ |
| | | /***/ (function(module, exports) { |
| | | |
| | | module.exports = __WEBPACK_EXTERNAL_MODULE_20__; |
| | | "use strict"; |
| | | |
| | | exports.__esModule = true; |
| | | exports.default = generateOutsideCheck; |
| | | /** |
| | | * Check whether some DOM node is our Component's node. |
| | | */ |
| | | function isNodeFound(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 node if our node is not found in the path up. |
| | | */ |
| | | function findHighest(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 |
| | | */ |
| | | function clickedScrollbar(evt) { |
| | | return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY; |
| | | } |
| | | |
| | | /** |
| | | * Generate the event handler that checks whether a clicked DOM node |
| | | * is inside of, or lives outside of, our Component's node tree. |
| | | */ |
| | | function generateOutsideCheck(componentNode, 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); |
| | | }; |
| | | } |
| | | |
| | | /***/ }), |
| | | /* 21 */ |
| | |
| | | 'use strict'; |
| | | |
| | | var React = __webpack_require__(12), |
| | | createClass = __webpack_require__(11), |
| | | onClickOutside = __webpack_require__(19) |
| | | ; |
| | | createClass = __webpack_require__(11), |
| | | onClickOutside = __webpack_require__(18).default |
| | | ; |
| | | |
| | | var DateTimePickerMonths = onClickOutside( createClass({ |
| | | render: function() { |
| | |
| | | classes, props, currentMonth, isDisabled, noOfDaysInMonth, daysInMonth, validDay, |
| | | // Date is irrelevant because we're only interested in month |
| | | irrelevantDate = 1 |
| | | ; |
| | | ; |
| | | |
| | | while (i < 12) { |
| | | classes = 'rdtMonth'; |
| | |
| | | return 1; |
| | | }, |
| | | |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | })); |
| | | |
| | | function capitalize( str ) { |
| | |
| | | 'use strict'; |
| | | |
| | | var React = __webpack_require__(12), |
| | | createClass = __webpack_require__(11), |
| | | onClickOutside = __webpack_require__(19) |
| | | ; |
| | | createClass = __webpack_require__(11), |
| | | onClickOutside = __webpack_require__(18).default |
| | | ; |
| | | |
| | | var DateTimePickerYears = onClickOutside( createClass({ |
| | | render: function() { |
| | |
| | | React.createElement('th', { key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime( 10, 'years' )}, React.createElement('span', {}, '‹' )), |
| | | React.createElement('th', { key: 'year', className: 'rdtSwitch', onClick: this.props.showView( 'years' ), colSpan: 2 }, year + '-' + ( year + 9 ) ), |
| | | React.createElement('th', { key: 'next', className: 'rdtNext', onClick: this.props.addTime( 10, 'years' )}, React.createElement('span', {}, '›' )) |
| | | ]))), |
| | | ]))), |
| | | React.createElement('table', { key: 'years' }, React.createElement('tbody', {}, this.renderYears( year ))) |
| | | ]); |
| | | }, |
| | |
| | | // we're only interested in the year |
| | | irrelevantMonth = 0, |
| | | irrelevantDate = 1 |
| | | ; |
| | | ; |
| | | |
| | | year--; |
| | | while (i < 11) { |
| | |
| | | return 1; |
| | | }, |
| | | |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | })); |
| | | |
| | | module.exports = DateTimePickerYears; |
| | |
| | | 'use strict'; |
| | | |
| | | var React = __webpack_require__(12), |
| | | createClass = __webpack_require__(11), |
| | | createClass = __webpack_require__(11), |
| | | assign = __webpack_require__(1), |
| | | onClickOutside = __webpack_require__(19) |
| | | ; |
| | | onClickOutside = __webpack_require__(18).default |
| | | ; |
| | | |
| | | var DateTimePickerTime = onClickOutside( createClass({ |
| | | getInitialState: function() { |
| | |
| | | var date = props.selectedDate || props.viewDate, |
| | | format = props.timeFormat, |
| | | counters = [] |
| | | ; |
| | | ; |
| | | |
| | | if ( format.toLowerCase().indexOf('h') !== -1 ) { |
| | | counters.push('hours'); |
| | |
| | | } |
| | | } |
| | | |
| | | var hours = date.format( 'H' ); |
| | | |
| | | var daypart = false; |
| | | if ( this.state !== null && this.props.timeFormat.toLowerCase().indexOf( ' a' ) !== -1 ) { |
| | | if ( this.props.timeFormat.indexOf( ' A' ) !== -1 ) { |
| | | daypart = ( this.state.hours >= 12 ) ? 'PM' : 'AM'; |
| | | daypart = ( hours >= 12 ) ? 'PM' : 'AM'; |
| | | } else { |
| | | daypart = ( this.state.hours >= 12 ) ? 'pm' : 'am'; |
| | | daypart = ( hours >= 12 ) ? 'pm' : 'am'; |
| | | } |
| | | } |
| | | |
| | | return { |
| | | hours: date.format( 'H' ), |
| | | hours: hours, |
| | | minutes: date.format( 'mm' ), |
| | | seconds: date.format( 'ss' ), |
| | | milliseconds: date.format( 'SSS' ), |
| | |
| | | } |
| | | } |
| | | return React.createElement('div', { key: type, className: 'rdtCounter' }, [ |
| | | React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ) }, '▲' ), |
| | | React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ), onContextMenu: this.disableContextMenu }, '▲' ), |
| | | React.createElement('div', { key: 'c', className: 'rdtCount' }, value ), |
| | | React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '▼' ) |
| | | React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ), onContextMenu: this.disableContextMenu }, '▼' ) |
| | | ]); |
| | | } |
| | | return ''; |
| | |
| | | |
| | | renderDayPart: function() { |
| | | return React.createElement('div', { key: 'dayPart', className: 'rdtCounter' }, [ |
| | | React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours') }, '▲' ), |
| | | React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '▲' ), |
| | | React.createElement('div', { key: this.state.daypart, className: 'rdtCount' }, this.state.daypart ), |
| | | React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours') }, '▼' ) |
| | | React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '▼' ) |
| | | ]); |
| | | }, |
| | | |
| | |
| | | clearInterval( me.increaseTimer ); |
| | | me.props.setTime( type, me.state[ type ] ); |
| | | document.body.removeEventListener( 'mouseup', me.mouseUpListener ); |
| | | document.body.removeEventListener( 'touchend', me.mouseUpListener ); |
| | | }; |
| | | |
| | | document.body.addEventListener( 'mouseup', me.mouseUpListener ); |
| | | document.body.addEventListener( 'touchend', me.mouseUpListener ); |
| | | }; |
| | | }, |
| | | |
| | | disableContextMenu: function( event ) { |
| | | event.preventDefault(); |
| | | return false; |
| | | }, |
| | | |
| | | padValues: { |
| | |
| | | return str; |
| | | }, |
| | | |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | })); |
| | | |
| | | module.exports = DateTimePickerTime; |