From 4018170d6f037c4e6fdcc92d7f793885cd6f871f Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Tue, 12 Jan 2016 17:15:48 -0500 Subject: [PATCH] rebuild --- dist/react-widgets-moment.js | 2 +- dist/react-widgets.js | 48 ++++++++++++++++++++++------------- lib/DateTimePicker.js | 2 +- lib/Popup.js | 4 +-- lib/localizers/moment.js | 2 +- lib/mixins/DataFilterMixin.js | 2 +- lib/mixins/TimeoutMixin.js | 7 +++-- lib/util/_.js | 2 +- 8 files changed, 42 insertions(+), 27 deletions(-) diff --git a/dist/react-widgets-moment.js b/dist/react-widgets-moment.js index fb2bee242..b32a5c2fd 100644 --- a/dist/react-widgets-moment.js +++ b/dist/react-widgets-moment.js @@ -116,7 +116,7 @@ }, parse: function parse(value, format, culture) { - return getMoment(culture, value, format).toDate(); + return value ? getMoment(culture, value, format).toDate() : null; }, format: function format(value, _format, culture) { diff --git a/dist/react-widgets.js b/dist/react-widgets.js index 3dd7c5104..731be74aa 100644 --- a/dist/react-widgets.js +++ b/dist/react-widgets.js @@ -1,4 +1,4 @@ -/*! (c) 2015 Jason Quense | https://github.com/jquense/react-widgets/blob/master/License.txt */ +/*! (c) 2016 Jason Quense | https://github.com/jquense/react-widgets/blob/master/License.txt */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react"), require("react-dom")); @@ -933,8 +933,6 @@ return /******/ (function(modules) { // webpackBootstrap * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule invariant */ 'use strict'; @@ -968,9 +966,9 @@ return /******/ (function(modules) { // webpackBootstrap var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error( - 'Invariant Violation: ' + format.replace(/%s/g, function() { return args[argIndex++]; }) ); + error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame @@ -1041,7 +1039,7 @@ return /******/ (function(modules) { // webpackBootstrap var result; if (Array.isArray(arr)) { arr.every(function (val, idx) { - if (cb.call(thisArg, val, idx, arr)) return (result = val, false); + if (cb.call(thisArg, val, idx, arr)) return result = val, false; return true; }); return result; @@ -1670,7 +1668,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2015 Jed Watson. + Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ @@ -1682,7 +1680,7 @@ return /******/ (function(modules) { // webpackBootstrap var hasOwn = {}.hasOwnProperty; function classNames () { - var classes = ''; + var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; @@ -1691,19 +1689,19 @@ return /******/ (function(modules) { // webpackBootstrap var argType = typeof arg; if (argType === 'string' || argType === 'number') { - classes += ' ' + arg; + classes.push(arg); } else if (Array.isArray(arg)) { - classes += ' ' + classNames.apply(null, arg); + classes.push(classNames.apply(null, arg)); } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { - classes += ' ' + key; + classes.push(key); } } } } - return classes.substr(1); + return classes.join(' '); } if (typeof module !== 'undefined' && module.exports) { @@ -1762,9 +1760,9 @@ return /******/ (function(modules) { // webpackBootstrap var TRANSLATION_MAP = _utilConfiguration2['default'].animate.TRANSLATION_MAP; - if (TRANSLATION_MAP && TRANSLATION_MAP[prop]) return (_ref = {}, _ref[transform] = TRANSLATION_MAP[prop] + '(' + value + ')', _ref); + if (TRANSLATION_MAP && TRANSLATION_MAP[prop]) return _ref = {}, _ref[transform] = TRANSLATION_MAP[prop] + '(' + value + ')', _ref; - return (_ref2 = {}, _ref2[prop] = value, _ref2); + return _ref2 = {}, _ref2[prop] = value, _ref2; } var PopupContent = _react2['default'].createClass({ @@ -3187,7 +3185,8 @@ return /******/ (function(modules) { // webpackBootstrap } component._values[propName] = value; - component.forceUpdate(); + + if (component.isMounted()) component.forceUpdate(); } exports['default'] = _createUncontrollable2['default']([mixin], set); @@ -3308,6 +3307,16 @@ return /******/ (function(modules) { // webpackBootstrap component.ControlledComponent = Component; + /** + * useful when wrapping a Component and you want to control + * everything + */ + component.deferControlTo = function (newComponent, additions, nextMethods) { + if (additions === undefined) additions = {}; + + return uncontrollable(newComponent, _extends({}, controlledValues, additions), nextMethods); + }; + return component; function setAndNotify(propName, value) { @@ -3471,14 +3480,17 @@ return /******/ (function(modules) { // webpackBootstrap }, setTimeout: function setTimeout(key, cb, duration) { + var _this = this; + var timers = this._timers || (this._timers = Object.create(null)); if (this._unmounted) return; clearTimeout(timers[key]); - timers[key] = window.setTimeout(cb, duration); + timers[key] = window.setTimeout(function () { + if (!_this._unmounted) cb(); + }, duration); } - }; /***/ }, @@ -3546,7 +3558,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!searchTerm || !searchTerm.trim() || this.props.filter && searchTerm.length < (this.props.minLength || 1)) return -1; items.every(function (item, i) { - if (matches(item, searchTerm, i)) return (idx = i, false); + if (matches(item, searchTerm, i)) return idx = i, false; return true; }); @@ -6680,7 +6692,7 @@ return /******/ (function(modules) { // webpackBootstrap var calIsActive = open === popups.CALENDAR && key === 'calendar'; var timeIsActive = open === popups.TIME && key === 'timelist'; - if (!current || (timeIsActive || calIsActive)) return id; + if (!current || timeIsActive || calIsActive) return id; })]; } }, { diff --git a/lib/DateTimePicker.js b/lib/DateTimePicker.js index 99f264175..e4a61ac2c 100644 --- a/lib/DateTimePicker.js +++ b/lib/DateTimePicker.js @@ -146,7 +146,7 @@ var DateTimePicker = _react2['default'].createClass(babelHelpers.createDecorated var calIsActive = open === popups.CALENDAR && key === 'calendar'; var timeIsActive = open === popups.TIME && key === 'timelist'; - if (!current || (timeIsActive || calIsActive)) return id; + if (!current || timeIsActive || calIsActive) return id; })]; } }, { diff --git a/lib/Popup.js b/lib/Popup.js index 00705c692..bdcc62826 100644 --- a/lib/Popup.js +++ b/lib/Popup.js @@ -37,9 +37,9 @@ function properties(prop, value) { var TRANSLATION_MAP = _utilConfiguration2['default'].animate.TRANSLATION_MAP; - if (TRANSLATION_MAP && TRANSLATION_MAP[prop]) return (_ref = {}, _ref[transform] = TRANSLATION_MAP[prop] + '(' + value + ')', _ref); + if (TRANSLATION_MAP && TRANSLATION_MAP[prop]) return _ref = {}, _ref[transform] = TRANSLATION_MAP[prop] + '(' + value + ')', _ref; - return (_ref2 = {}, _ref2[prop] = value, _ref2); + return _ref2 = {}, _ref2[prop] = value, _ref2; } var PopupContent = _react2['default'].createClass({ diff --git a/lib/localizers/moment.js b/lib/localizers/moment.js index 58275d3ea..2d9c4e2d4 100644 --- a/lib/localizers/moment.js +++ b/lib/localizers/moment.js @@ -54,7 +54,7 @@ exports['default'] = function (moment) { }, parse: function parse(value, format, culture) { - return getMoment(culture, value, format).toDate(); + return value ? getMoment(culture, value, format).toDate() : null; }, format: function format(value, _format, culture) { diff --git a/lib/mixins/DataFilterMixin.js b/lib/mixins/DataFilterMixin.js index 36e785629..6dfda247d 100644 --- a/lib/mixins/DataFilterMixin.js +++ b/lib/mixins/DataFilterMixin.js @@ -44,7 +44,7 @@ module.exports = { if (!searchTerm || !searchTerm.trim() || this.props.filter && searchTerm.length < (this.props.minLength || 1)) return -1; items.every(function (item, i) { - if (matches(item, searchTerm, i)) return (idx = i, false); + if (matches(item, searchTerm, i)) return idx = i, false; return true; }); diff --git a/lib/mixins/TimeoutMixin.js b/lib/mixins/TimeoutMixin.js index 6c31e2f67..7f1d35a19 100644 --- a/lib/mixins/TimeoutMixin.js +++ b/lib/mixins/TimeoutMixin.js @@ -15,12 +15,15 @@ module.exports = { }, setTimeout: function setTimeout(key, cb, duration) { + var _this = this; + var timers = this._timers || (this._timers = Object.create(null)); if (this._unmounted) return; clearTimeout(timers[key]); - timers[key] = window.setTimeout(cb, duration); + timers[key] = window.setTimeout(function () { + if (!_this._unmounted) cb(); + }, duration); } - }; \ No newline at end of file diff --git a/lib/util/_.js b/lib/util/_.js index 932cf2d83..6d0d0bb1a 100644 --- a/lib/util/_.js +++ b/lib/util/_.js @@ -53,7 +53,7 @@ var _ = module.exports = { var result; if (Array.isArray(arr)) { arr.every(function (val, idx) { - if (cb.call(thisArg, val, idx, arr)) return (result = val, false); + if (cb.call(thisArg, val, idx, arr)) return result = val, false; return true; }); return result;