Use same tab indentiation in all JS files
| | |
| | | |
| | | var assign = require('object-assign'), |
| | | PropTypes = require('prop-types'), |
| | | createClass = require('create-react-class'), |
| | | createClass = require('create-react-class'), |
| | | moment = require('moment'), |
| | | React = require('react'), |
| | | CalendarContainer = require('./src/CalendarContainer') |
| | | ; |
| | | ; |
| | | |
| | | var TYPES = PropTypes; |
| | | var Datetime = createClass({ |
| | |
| | | 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 ); |
| | |
| | | }, |
| | | |
| | | getUpdateOn: function( formats ) { |
| | | if ( formats.date.match(/[lLD]/) ) { |
| | | if ( formats.date.match(/[lLD]/) ) { |
| | | return 'days'; |
| | | } else if ( formats.date.indexOf('M') !== -1 ) { |
| | | return 'months'; |
| | |
| | | time: props.timeFormat || '' |
| | | }, |
| | | locale = this.localMoment( props.date, null, props ).localeData() |
| | | ; |
| | | ; |
| | | |
| | | if ( formats.date === true ) { |
| | | formats.date = locale.longDateFormat('L'); |
| | |
| | | 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; |
| | |
| | | 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) |
| | |
| | | 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 ]; |
| | |
| | | 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({ |
| | |
| | | 'use strict'; |
| | | |
| | | var React = require('react'), |
| | | createClass = require('create-react-class'), |
| | | DaysView = require('./DaysView'), |
| | | MonthsView = require('./MonthsView'), |
| | | YearsView = require('./YearsView'), |
| | | TimeView = require('./TimeView') |
| | | ; |
| | | createClass = require('create-react-class'), |
| | | DaysView = require('./DaysView'), |
| | | MonthsView = require('./MonthsView'), |
| | | YearsView = require('./YearsView'), |
| | | TimeView = require('./TimeView') |
| | | ; |
| | | |
| | | 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; |
| | |
| | | 'use strict'; |
| | | |
| | | var React = require('react'), |
| | | createClass = require('create-react-class'), |
| | | createClass = require('create-react-class'), |
| | | moment = require('moment'), |
| | | onClickOutside = require('react-onclickoutside') |
| | | ; |
| | | ; |
| | | |
| | | 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; |
| | |
| | | 'use strict'; |
| | | |
| | | var React = require('react'), |
| | | createClass = require('create-react-class'), |
| | | createClass = require('create-react-class'), |
| | | onClickOutside = require('react-onclickoutside') |
| | | ; |
| | | ; |
| | | |
| | | 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 = require('react'), |
| | | createClass = require('create-react-class'), |
| | | createClass = require('create-react-class'), |
| | | assign = require('object-assign'), |
| | | onClickOutside = require('react-onclickoutside') |
| | | ; |
| | | onClickOutside = require('react-onclickoutside') |
| | | ; |
| | | |
| | | 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'); |
| | |
| | | return str; |
| | | }, |
| | | |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | handleClickOutside: function() { |
| | | this.props.handleClickOutside(); |
| | | } |
| | | })); |
| | | |
| | | module.exports = DateTimePickerTime; |
| | |
| | | 'use strict'; |
| | | |
| | | var React = require('react'), |
| | | createClass = require('create-react-class'), |
| | | createClass = require('create-react-class'), |
| | | onClickOutside = require('react-onclickoutside') |
| | | ; |
| | | ; |
| | | |
| | | 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; |