From a50b2e9ea2b998d0d2e7052bef6ce72ea7679a1f Mon Sep 17 00:00:00 2001 From: Gerald Leenerts <gerald.leenerts@gmail.com> Date: Thu, 27 Jul 2017 22:27:07 +0200 Subject: [PATCH] Remove React.DOM references --- dist/react-datetime.js | 416 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 305 insertions(+), 111 deletions(-) diff --git a/dist/react-datetime.js b/dist/react-datetime.js index 4a8a387..9300051 100644 --- a/dist/react-datetime.js +++ b/dist/react-datetime.js @@ -462,15 +462,14 @@ }, render: function() { - var DOM = React.DOM, - className = 'rdt' + (this.props.className ? + var className = 'rdt' + (this.props.className ? ( Array.isArray( this.props.className ) ? ' ' + this.props.className.join( ' ' ) : ' ' + this.props.className) : ''), children = [] ; if ( this.props.input ) { - children = [ DOM.input( assign({ + children = [ React.createElement('input', assign({ key: 'i', type: 'text', className: 'form-control', @@ -486,8 +485,8 @@ if ( this.state.open ) className += ' rdtOpen'; - return DOM.div({className: className}, children.concat( - DOM.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 }) ) @@ -757,6 +756,10 @@ process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; + process.prependListener = noop; + process.prependOnceListener = noop; + + process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); @@ -1095,6 +1098,20 @@ return emptyFunction.thatReturnsNull; } + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + warning( + false, + 'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + + 'received %s at index %s.', + getPostfixForTypeWarning(checker), + i + ); + return emptyFunction.thatReturnsNull; + } + } + function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; @@ -1227,6 +1244,9 @@ // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { @@ -1236,6 +1256,23 @@ } } return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } } // Returns class name of the object, if any. @@ -1535,11 +1572,14 @@ var emptyFunction = __webpack_require__(5); var invariant = __webpack_require__(6); + var ReactPropTypesSecret = __webpack_require__(8); module.exports = function() { - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - function shim() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } invariant( false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + @@ -1551,6 +1591,8 @@ function getShim() { return shim; }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bool: shim, @@ -1596,6 +1638,13 @@ var React = __webpack_require__(12); var factory = __webpack_require__(13); + + if (typeof React === 'undefined') { + throw Error( + 'create-react-class could not find the React object. If you are using script tags, ' + + 'make sure that React is being loaded before create-react-class.' + ); + } // Hack to grab NoopUpdateQueue from isomorphic React var ReactNoopUpdateQueue = new React.Component().updater; @@ -1651,7 +1700,7 @@ ReactPropTypeLocationNames = { prop: 'prop', context: 'context', - childContext: 'child context', + childContext: 'child context' }; } else { ReactPropTypeLocationNames = {}; @@ -1661,7 +1710,6 @@ /** * Policies that describe methods in `ReactClassInterface`. */ - var injectedMixins = []; @@ -1688,7 +1736,6 @@ * @internal */ var ReactClassInterface = { - /** * An array of Mixin objects to include when defining your component. * @@ -1779,7 +1826,6 @@ * } * * @return {ReactComponent} - * @nosideeffects * @required */ render: 'DEFINE_ONCE', @@ -1907,7 +1953,6 @@ * @overridable */ updateComponent: 'OVERRIDE_BASE' - }; /** @@ -1920,71 +1965,106 @@ * which all other static methods are defined. */ var RESERVED_SPEC_KEYS = { - displayName: function (Constructor, displayName) { + displayName: function(Constructor, displayName) { Constructor.displayName = displayName; }, - mixins: function (Constructor, mixins) { + mixins: function(Constructor, mixins) { if (mixins) { for (var i = 0; i < mixins.length; i++) { mixSpecIntoComponent(Constructor, mixins[i]); } } }, - childContextTypes: function (Constructor, childContextTypes) { + childContextTypes: function(Constructor, childContextTypes) { if (process.env.NODE_ENV !== 'production') { validateTypeDef(Constructor, childContextTypes, 'childContext'); } - Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); + Constructor.childContextTypes = _assign( + {}, + Constructor.childContextTypes, + childContextTypes + ); }, - contextTypes: function (Constructor, contextTypes) { + contextTypes: function(Constructor, contextTypes) { if (process.env.NODE_ENV !== 'production') { validateTypeDef(Constructor, contextTypes, 'context'); } - Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); + Constructor.contextTypes = _assign( + {}, + Constructor.contextTypes, + contextTypes + ); }, /** * Special case getDefaultProps which should move into statics but requires * automatic merging. */ - getDefaultProps: function (Constructor, getDefaultProps) { + getDefaultProps: function(Constructor, getDefaultProps) { if (Constructor.getDefaultProps) { - Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); + Constructor.getDefaultProps = createMergedResultFunction( + Constructor.getDefaultProps, + getDefaultProps + ); } else { Constructor.getDefaultProps = getDefaultProps; } }, - propTypes: function (Constructor, propTypes) { + propTypes: function(Constructor, propTypes) { if (process.env.NODE_ENV !== 'production') { validateTypeDef(Constructor, propTypes, 'prop'); } Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); }, - statics: function (Constructor, statics) { + statics: function(Constructor, statics) { mixStaticSpecIntoComponent(Constructor, statics); }, - autobind: function () {} }; + autobind: function() {} + }; function validateTypeDef(Constructor, typeDef, location) { for (var propName in typeDef) { if (typeDef.hasOwnProperty(propName)) { // use a warning instead of an _invariant so components // don't show up in prod but only in __DEV__ - process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0; + if (process.env.NODE_ENV !== 'production') { + warning( + typeof typeDef[propName] === 'function', + '%s: %s type `%s` is invalid; it must be a function, usually from ' + + 'React.PropTypes.', + Constructor.displayName || 'ReactClass', + ReactPropTypeLocationNames[location], + propName + ); + } } } } function validateMethodOverride(isAlreadyDefined, name) { - var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; + var specPolicy = ReactClassInterface.hasOwnProperty(name) + ? ReactClassInterface[name] + : null; // Disallow overriding of base class methods unless explicitly allowed. if (ReactClassMixin.hasOwnProperty(name)) { - _invariant(specPolicy === 'OVERRIDE_BASE', 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name); + _invariant( + specPolicy === 'OVERRIDE_BASE', + 'ReactClassInterface: You are attempting to override ' + + '`%s` from your class specification. Ensure that your method names ' + + 'do not overlap with React methods.', + name + ); } // Disallow defining methods more than once unless explicitly allowed. if (isAlreadyDefined) { - _invariant(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name); + _invariant( + specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', + 'ReactClassInterface: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be due ' + + 'to a mixin.', + name + ); } } @@ -1998,14 +2078,33 @@ var typeofSpec = typeof spec; var isMixinValid = typeofSpec === 'object' && spec !== null; - process.env.NODE_ENV !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; + if (process.env.NODE_ENV !== 'production') { + warning( + isMixinValid, + "%s: You're attempting to include a mixin that is either null " + + 'or not an object. Check the mixins included by the component, ' + + 'as well as any mixins they include themselves. ' + + 'Expected object but got %s.', + Constructor.displayName || 'ReactClass', + spec === null ? null : typeofSpec + ); + } } return; } - _invariant(typeof spec !== 'function', 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.'); - _invariant(!isValidElement(spec), 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.'); + _invariant( + typeof spec !== 'function', + "ReactClass: You're attempting to " + + 'use a component class or function as a mixin. Instead, just use a ' + + 'regular object.' + ); + _invariant( + !isValidElement(spec), + "ReactClass: You're attempting to " + + 'use a component as a mixin. Instead, just use a regular object.' + ); var proto = Constructor.prototype; var autoBindPairs = proto.__reactAutoBindPairs; @@ -2040,7 +2139,11 @@ // 2. Overridden methods (that were mixed in). var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); var isFunction = typeof property === 'function'; - var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; + var shouldAutoBind = + isFunction && + !isReactClassMethod && + !isAlreadyDefined && + spec.autobind !== false; if (shouldAutoBind) { autoBindPairs.push(name, property); @@ -2050,7 +2153,15 @@ var specPolicy = ReactClassInterface[name]; // These cases should already be caught by validateMethodOverride. - _invariant(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name); + _invariant( + isReactClassMethod && + (specPolicy === 'DEFINE_MANY_MERGED' || + specPolicy === 'DEFINE_MANY'), + 'ReactClass: Unexpected spec policy %s for key %s ' + + 'when mixing in component specs.', + specPolicy, + name + ); // For methods which are defined more than once, call the existing // methods before calling the new property, merging if appropriate. @@ -2085,10 +2196,23 @@ } var isReserved = name in RESERVED_SPEC_KEYS; - _invariant(!isReserved, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name); + _invariant( + !isReserved, + 'ReactClass: You are attempting to define a reserved ' + + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + + 'as an instance property instead; it will still be accessible on the ' + + 'constructor.', + name + ); var isInherited = name in Constructor; - _invariant(!isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name); + _invariant( + !isInherited, + 'ReactClass: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be ' + + 'due to a mixin.', + name + ); Constructor[name] = property; } } @@ -2101,11 +2225,22 @@ * @return {object} one after it has been mutated to contain everything in two. */ function mergeIntoWithNoDuplicateKeys(one, two) { - _invariant(one && two && typeof one === 'object' && typeof two === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'); + _invariant( + one && two && typeof one === 'object' && typeof two === 'object', + 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.' + ); for (var key in two) { if (two.hasOwnProperty(key)) { - _invariant(one[key] === undefined, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key); + _invariant( + one[key] === undefined, + 'mergeIntoWithNoDuplicateKeys(): ' + + 'Tried to merge two objects with the same key: `%s`. This conflict ' + + 'may be due to a mixin; in particular, this may be caused by two ' + + 'getInitialState() or getDefaultProps() methods returning objects ' + + 'with clashing keys.', + key + ); one[key] = two[key]; } } @@ -2166,8 +2301,14 @@ boundMethod.__reactBoundArguments = null; var componentName = component.constructor.displayName; var _bind = boundMethod.bind; - boundMethod.bind = function (newThis) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + boundMethod.bind = function(newThis) { + for ( + var _len = arguments.length, + args = Array(_len > 1 ? _len - 1 : 0), + _key = 1; + _key < _len; + _key++ + ) { args[_key - 1] = arguments[_key]; } @@ -2175,9 +2316,24 @@ // ignore the value of "this" that the user is trying to use, so // let's warn. if (newThis !== component && newThis !== null) { - process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; + if (process.env.NODE_ENV !== 'production') { + warning( + false, + 'bind(): React component methods may only be bound to the ' + + 'component instance. See %s', + componentName + ); + } } else if (!args.length) { - process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0; + if (process.env.NODE_ENV !== 'production') { + warning( + false, + 'bind(): You are binding a component method to the component. ' + + 'React does this for you automatically in a high-performance ' + + 'way, so you can safely remove this call. See %s', + componentName + ); + } return boundMethod; } var reboundMethod = _bind.apply(boundMethod, arguments); @@ -2204,11 +2360,14 @@ } } - var IsMountedMixin = { - componentDidMount: function () { + var IsMountedPreMixin = { + componentDidMount: function() { this.__isMounted = true; - }, - componentWillUnmount: function () { + } + }; + + var IsMountedPostMixin = { + componentWillUnmount: function() { this.__isMounted = false; } }; @@ -2218,12 +2377,11 @@ * therefore not already part of the modern ReactComponent. */ var ReactClassMixin = { - /** * TODO: This will be deprecated because state should always keep a consistent * type signature and the only use case for this, is to avoid that. */ - replaceState: function (newState, callback) { + replaceState: function(newState, callback) { this.updater.enqueueReplaceState(this, newState, callback); }, @@ -2233,17 +2391,29 @@ * @protected * @final */ - isMounted: function () { + isMounted: function() { if (process.env.NODE_ENV !== 'production') { - process.env.NODE_ENV !== 'production' ? warning(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component') : void 0; + warning( + this.__didWarnIsMounted, + '%s: isMounted is deprecated. Instead, make sure to clean up ' + + 'subscriptions and pending requests in componentWillUnmount to ' + + 'prevent memory leaks.', + (this.constructor && this.constructor.displayName) || + this.name || + 'Component' + ); this.__didWarnIsMounted = true; } return !!this.__isMounted; } }; - var ReactClassComponent = function () {}; - _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); + var ReactClassComponent = function() {}; + _assign( + ReactClassComponent.prototype, + ReactComponent.prototype, + ReactClassMixin + ); /** * Creates a composite component class given a class specification. @@ -2257,12 +2427,16 @@ // To keep our warnings more understandable, we'll use a little hack here to // ensure that Constructor.name !== 'Constructor'. This makes sure we don't // unnecessarily identify a class without displayName as 'Constructor'. - var Constructor = identity(function (props, context, updater) { + var Constructor = identity(function(props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { - process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; + warning( + this instanceof Constructor, + 'Something is calling a React component directly. Use a factory or ' + + 'JSX instead. See: https://fb.me/react-legacyfactory' + ); } // Wire up auto-binding @@ -2283,13 +2457,20 @@ var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. - if (initialState === undefined && this.getInitialState._isMockFunction) { + if ( + initialState === undefined && + this.getInitialState._isMockFunction + ) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } - _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent'); + _invariant( + typeof initialState === 'object' && !Array.isArray(initialState), + '%s.getInitialState(): must return an object or null', + Constructor.displayName || 'ReactCompositeComponent' + ); this.state = initialState; }); @@ -2299,8 +2480,9 @@ injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); - mixSpecIntoComponent(Constructor, IsMountedMixin); + mixSpecIntoComponent(Constructor, IsMountedPreMixin); mixSpecIntoComponent(Constructor, spec); + mixSpecIntoComponent(Constructor, IsMountedPostMixin); // Initialize the defaultProps property after all mixins have been merged. if (Constructor.getDefaultProps) { @@ -2320,11 +2502,26 @@ } } - _invariant(Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.'); + _invariant( + Constructor.prototype.render, + 'createClass(...): Class specification must implement a `render` method.' + ); if (process.env.NODE_ENV !== 'production') { - process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0; - process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; + warning( + !Constructor.prototype.componentShouldUpdate, + '%s has a method called ' + + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + + 'The name is phrased as a question because the function is ' + + 'expected to return a value.', + spec.displayName || 'A component' + ); + warning( + !Constructor.prototype.componentWillRecieveProps, + '%s has a method called ' + + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', + spec.displayName || 'A component' + ); } // Reduce time spent doing lookups by setting these on the prototype. @@ -2511,7 +2708,6 @@ onClickOutside = __webpack_require__(19) ; - var DOM = React.DOM; var DateTimePickerDays = onClickOutside( createClass({ render: function() { var footer = this.renderFooter(), @@ -2521,22 +2717,22 @@ ; tableChildren = [ - DOM.thead({ key: 'th' }, [ - DOM.tr({ key: 'h' }, [ - DOM.th({ key: 'p', className: 'rdtPrev', onClick: this.props.subtractTime( 1, 'months' )}, DOM.span({}, '���' )), - DOM.th({ key: 's', className: 'rdtSwitch', onClick: this.props.showView( 'months' ), colSpan: 5, 'data-value': this.props.viewDate.month() }, locale.months( date ) + ' ' + date.year() ), - DOM.th({ key: 'n', className: 'rdtNext', onClick: this.props.addTime( 1, 'months' )}, DOM.span({}, '���' )) + React.createElement('thead', { key: 'th' }, [ + React.createElement('tr', { key: 'h' }, [ + React.createElement('th', { key: 'p', className: 'rdtPrev', onClick: this.props.subtractTime( 1, 'months' )}, React.createElement('span', {}, '���' )), + React.createElement('th', { key: 's', className: 'rdtSwitch', onClick: this.props.showView( 'months' ), colSpan: 5, 'data-value': this.props.viewDate.month() }, locale.months( date ) + ' ' + date.year() ), + React.createElement('th', { key: 'n', className: 'rdtNext', onClick: this.props.addTime( 1, 'months' )}, React.createElement('span', {}, '���' )) ]), - DOM.tr({ key: 'd'}, this.getDaysOfWeek( locale ).map( function( day, index ) { return DOM.th({ key: day + index, className: 'dow'}, day ); }) ) + React.createElement('tr', { key: 'd'}, this.getDaysOfWeek( locale ).map( function( day, index ) { return React.createElement('th', { key: day + index, className: 'dow'}, day ); }) ) ]), - DOM.tbody({ key: 'tb' }, this.renderDays()) + React.createElement('tbody', { key: 'tb' }, this.renderDays()) ]; if ( footer ) tableChildren.push( footer ); - return DOM.div({ className: 'rdtDays' }, - DOM.table({}, tableChildren ) + return React.createElement('div', { className: 'rdtDays' }, + React.createElement('table', {}, tableChildren ) ); }, @@ -2607,7 +2803,7 @@ days.push( renderer( dayProps, currentDate, selected ) ); if ( days.length === 7 ) { - weeks.push( DOM.tr({ key: prevMonth.format( 'M_D' )}, days ) ); + weeks.push( React.createElement('tr', { key: prevMonth.format( 'M_D' )}, days ) ); days = []; } @@ -2622,7 +2818,7 @@ }, renderDay: function( props, currentDate ) { - return DOM.td( props, currentDate.date() ); + return React.createElement('td', props, currentDate.date() ); }, renderFooter: function() { @@ -2631,9 +2827,9 @@ var date = this.props.selectedDate || this.props.viewDate; - return DOM.tfoot({ key: 'tf'}, - DOM.tr({}, - DOM.td({ onClick: this.props.showView( 'time' ), colSpan: 7, className: 'rdtTimeToggle' }, date.format( this.props.timeFormat )) + return React.createElement('tfoot', { key: 'tf'}, + React.createElement('tr', {}, + React.createElement('td', { onClick: this.props.showView( 'time' ), colSpan: 7, className: 'rdtTimeToggle' }, date.format( this.props.timeFormat )) ) ); }, @@ -2982,16 +3178,15 @@ onClickOutside = __webpack_require__(19) ; - var DOM = React.DOM; var DateTimePickerMonths = onClickOutside( createClass({ render: function() { - return DOM.div({ className: 'rdtMonths' }, [ - DOM.table({ key: 'a' }, DOM.thead( {}, DOM.tr( {}, [ - DOM.th({ key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime( 1, 'years' )}, DOM.span({}, '���' )), - DOM.th({ key: 'year', className: 'rdtSwitch', onClick: this.props.showView( 'years' ), colSpan: 2, 'data-value': this.props.viewDate.year() }, this.props.viewDate.year() ), - DOM.th({ key: 'next', className: 'rdtNext', onClick: this.props.addTime( 1, 'years' )}, DOM.span({}, '���' )) + return React.createElement('div', { className: 'rdtMonths' }, [ + React.createElement('table', { key: 'a' }, React.createElement('thead', {}, React.createElement('tr', {}, [ + React.createElement('th', { key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime( 1, 'years' )}, React.createElement('span', {}, '���' )), + React.createElement('th', { key: 'year', className: 'rdtSwitch', onClick: this.props.showView( 'years' ), colSpan: 2, 'data-value': this.props.viewDate.year() }, this.props.viewDate.year() ), + React.createElement('th', { key: 'next', className: 'rdtNext', onClick: this.props.addTime( 1, 'years' )}, React.createElement('span', {}, '���' )) ]))), - DOM.table({ key: 'months' }, DOM.tbody({ key: 'b' }, this.renderMonths())) + React.createElement('table', { key: 'months' }, React.createElement('tbody', { key: 'b' }, this.renderMonths())) ]); }, @@ -3045,7 +3240,7 @@ months.push( renderer( props, i, year, date && date.clone() ) ); if ( months.length === 4 ) { - rows.push( DOM.tr({ key: month + '_' + rows.length }, months ) ); + rows.push( React.createElement('tr', { key: month + '_' + rows.length }, months ) ); months = []; } @@ -3066,7 +3261,7 @@ // Because some months are up to 5 characters long, we want to // use a fixed string length for consistency var monthStrFixedLength = monthStr.substring( 0, strLength ); - return DOM.td( props, capitalize( monthStrFixedLength ) ); + return React.createElement('td', props, capitalize( monthStrFixedLength ) ); }, alwaysValidDate: function() { @@ -3096,18 +3291,18 @@ onClickOutside = __webpack_require__(19) ; - var DOM = React.DOM; + var DateTimePickerYears = onClickOutside( createClass({ render: function() { var year = parseInt( this.props.viewDate.year() / 10, 10 ) * 10; - return DOM.div({ className: 'rdtYears' }, [ - DOM.table({ key: 'a' }, DOM.thead({}, DOM.tr({}, [ - DOM.th({ key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime( 10, 'years' )}, DOM.span({}, '���' )), - DOM.th({ key: 'year', className: 'rdtSwitch', onClick: this.props.showView( 'years' ), colSpan: 2 }, year + '-' + ( year + 9 ) ), - DOM.th({ key: 'next', className: 'rdtNext', onClick: this.props.addTime( 10, 'years' )}, DOM.span({}, '���' )) + return React.createElement('div', { className: 'rdtYears' }, [ + React.createElement('table', { key: 'a' }, React.createElement('thead', {}, React.createElement('tr', {}, [ + 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', {}, '���' )) ]))), - DOM.table({ key: 'years' }, DOM.tbody( {}, this.renderYears( year ))) + React.createElement('table', { key: 'years' }, React.createElement('tbody', {}, this.renderYears( year ))) ]); }, @@ -3166,7 +3361,7 @@ years.push( renderer( props, year, selectedDate && selectedDate.clone() )); if ( years.length === 4 ) { - rows.push( DOM.tr({ key: i }, years ) ); + rows.push( React.createElement('tr', { key: i }, years ) ); years = []; } @@ -3182,7 +3377,7 @@ }, renderYear: function( props, year ) { - return DOM.td( props, year ); + return React.createElement('td', props, year ); }, alwaysValidDate: function() { @@ -3209,7 +3404,6 @@ onClickOutside = __webpack_require__(19) ; - var DOM = React.DOM; var DateTimePickerTime = onClickOutside( createClass({ getInitialState: function() { return this.calculateState( this.props ); @@ -3260,20 +3454,20 @@ value = 12; } } - return DOM.div({ key: type, className: 'rdtCounter' }, [ - DOM.span({ key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ) }, '���' ), - DOM.div({ key: 'c', className: 'rdtCount' }, value ), - DOM.span({ key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '���' ) + return React.createElement('div', { key: type, className: 'rdtCounter' }, [ + React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ) }, '���' ), + React.createElement('div', { key: 'c', className: 'rdtCount' }, value ), + React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '���' ) ]); } return ''; }, renderDayPart: function() { - return DOM.div({ key: 'dayPart', className: 'rdtCounter' }, [ - DOM.span({ key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours') }, '���' ), - DOM.div({ key: this.state.daypart, className: 'rdtCount' }, this.state.daypart ), - DOM.span({ key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours') }, '���' ) + return React.createElement('div', { key: 'dayPart', className: 'rdtCounter' }, [ + React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours') }, '���' ), + React.createElement('div', { key: this.state.daypart, className: 'rdtCount' }, this.state.daypart ), + React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours') }, '���' ) ]); }, @@ -3284,7 +3478,7 @@ this.state.counters.forEach( function( c ) { if ( counters.length ) - counters.push( DOM.div({ key: 'sep' + counters.length, className: 'rdtCounterSeparator' }, ':' ) ); + counters.push( React.createElement('div', { key: 'sep' + counters.length, className: 'rdtCounterSeparator' }, ':' ) ); counters.push( me.renderCounter( c ) ); }); @@ -3293,19 +3487,19 @@ } if ( this.state.counters.length === 3 && this.props.timeFormat.indexOf( 'S' ) !== -1 ) { - counters.push( DOM.div({ className: 'rdtCounterSeparator', key: 'sep5' }, ':' ) ); + counters.push( React.createElement('div', { className: 'rdtCounterSeparator', key: 'sep5' }, ':' ) ); counters.push( - DOM.div({ className: 'rdtCounter rdtMilli', key: 'm' }, - DOM.input({ value: this.state.milliseconds, type: 'text', onChange: this.updateMilli } ) + React.createElement('div', { className: 'rdtCounter rdtMilli', key: 'm' }, + React.createElement('input', { value: this.state.milliseconds, type: 'text', onChange: this.updateMilli } ) ) ); } - return DOM.div({ className: 'rdtTime' }, - DOM.table({}, [ + return React.createElement('div', { className: 'rdtTime' }, + React.createElement('table', {}, [ this.renderHeader(), - DOM.tbody({ key: 'b'}, DOM.tr({}, DOM.td({}, - DOM.div({ className: 'rdtCounters' }, counters ) + React.createElement('tbody', { key: 'b'}, React.createElement('tr', {}, React.createElement('td', {}, + React.createElement('div', { className: 'rdtCounters' }, counters ) ))) ]) ); @@ -3358,8 +3552,8 @@ return null; var date = this.props.selectedDate || this.props.viewDate; - return DOM.thead({ key: 'h' }, DOM.tr({}, - DOM.th({ className: 'rdtSwitch', colSpan: 4, onClick: this.props.showView( 'days' ) }, date.format( this.props.dateFormat ) ) + return React.createElement('thead', { key: 'h' }, React.createElement('tr', {}, + React.createElement('th', { className: 'rdtSwitch', colSpan: 4, onClick: this.props.showView( 'days' ) }, date.format( this.props.dateFormat ) ) )); }, -- Gitblit v1.9.3