reactive-di
Advanced tools
Comparing version 5.0.3 to 5.0.4
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="5.0.4"></a> | ||
## [5.0.4](https://github.com/zerkalica/reactive-di/compare/v5.0.3...v5.0.4) (2017-11-06) | ||
<a name="5.0.3"></a> | ||
@@ -7,0 +12,0 @@ ## [5.0.3](https://github.com/zerkalica/reactive-di/compare/v5.0.2...v5.0.3) (2017-11-06) |
@@ -455,3 +455,3 @@ function _defineProperties(target, props) { | ||
function createReactWrapper(BaseComponent, defaultFromError, detached, rootInjector) { | ||
function createReactWrapper(BaseComponent, ErrorComponent, detached, rootInjector, isFullEqual) { | ||
var _class, _class2, _temp; | ||
@@ -463,2 +463,6 @@ | ||
if (isFullEqual === void 0) { | ||
isFullEqual = false; | ||
} | ||
var AtomizedComponent = (_class = (_temp = _class2 = | ||
@@ -479,3 +483,4 @@ /*#__PURE__*/ | ||
_this._el = undefined; | ||
_this._keys = props ? Object.keys(props) : undefined; | ||
var keys = undefined; | ||
_this._keys = props && (keys = Object.keys(props)).length > 0 ? keys : undefined; | ||
var cns = _this.constructor; | ||
@@ -495,5 +500,5 @@ _this._render = cns.render; | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(props) { | ||
if (this._keys === undefined) return false; | ||
var oldProps = this.props; | ||
var keys = this._keys; | ||
if (!keys) return false; | ||
var oldProps = this.props; | ||
@@ -510,2 +515,8 @@ for (var i = 0, l = keys.length; i < l; i++) { | ||
if (this.constructor.isFullEqual === true) { | ||
this._keys = Object.keys(props); | ||
this._propsChanged = keys.length !== this._keys.length; | ||
return this._propsChanged; | ||
} | ||
return false; | ||
@@ -539,3 +550,3 @@ }; | ||
} catch (error) { | ||
data = this._injector.invokeWithProps(render.onError || defaultFromError, { | ||
data = this._injector.invokeWithProps(render.onError || ErrorComponent, { | ||
error: error | ||
@@ -569,6 +580,4 @@ }); | ||
return AtomizedComponent; | ||
}(BaseComponent), _class2.displayName = void 0, _class2.render = void 0, _class2.instance = void 0, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
}(BaseComponent), _class2.displayName = void 0, _class2.render = void 0, _class2.instance = void 0, _class2.isFullEqual = isFullEqual, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
return function reactWrapper(render) { | ||
var displayName = render.displayName || render.name; | ||
var WrappedComponent = function WrappedComponent(props, context) { | ||
@@ -580,2 +589,3 @@ AtomizedComponent.call(this, props, context); | ||
WrappedComponent.render = render; | ||
WrappedComponent.isFullEqual = render.isFullEqual || isFullEqual; | ||
WrappedComponent.displayName = render.displayName || render.name; | ||
@@ -582,0 +592,0 @@ WrappedComponent.prototype = Object.create(AtomizedComponent.prototype); |
@@ -459,3 +459,3 @@ 'use strict'; | ||
function createReactWrapper(BaseComponent, defaultFromError, detached, rootInjector) { | ||
function createReactWrapper(BaseComponent, ErrorComponent, detached, rootInjector, isFullEqual) { | ||
var _class, _class2, _temp; | ||
@@ -467,2 +467,6 @@ | ||
if (isFullEqual === void 0) { | ||
isFullEqual = false; | ||
} | ||
var AtomizedComponent = (_class = (_temp = _class2 = | ||
@@ -483,3 +487,4 @@ /*#__PURE__*/ | ||
_this._el = undefined; | ||
_this._keys = props ? Object.keys(props) : undefined; | ||
var keys = undefined; | ||
_this._keys = props && (keys = Object.keys(props)).length > 0 ? keys : undefined; | ||
var cns = _this.constructor; | ||
@@ -499,5 +504,5 @@ _this._render = cns.render; | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(props) { | ||
if (this._keys === undefined) return false; | ||
var oldProps = this.props; | ||
var keys = this._keys; | ||
if (!keys) return false; | ||
var oldProps = this.props; | ||
@@ -514,2 +519,8 @@ for (var i = 0, l = keys.length; i < l; i++) { | ||
if (this.constructor.isFullEqual === true) { | ||
this._keys = Object.keys(props); | ||
this._propsChanged = keys.length !== this._keys.length; | ||
return this._propsChanged; | ||
} | ||
return false; | ||
@@ -543,3 +554,3 @@ }; | ||
} catch (error) { | ||
data = this._injector.invokeWithProps(render.onError || defaultFromError, { | ||
data = this._injector.invokeWithProps(render.onError || ErrorComponent, { | ||
error: error | ||
@@ -573,6 +584,4 @@ }); | ||
return AtomizedComponent; | ||
}(BaseComponent), _class2.displayName = void 0, _class2.render = void 0, _class2.instance = void 0, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
}(BaseComponent), _class2.displayName = void 0, _class2.render = void 0, _class2.instance = void 0, _class2.isFullEqual = isFullEqual, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
return function reactWrapper(render) { | ||
var displayName = render.displayName || render.name; | ||
var WrappedComponent = function WrappedComponent(props, context) { | ||
@@ -584,2 +593,3 @@ AtomizedComponent.call(this, props, context); | ||
WrappedComponent.render = render; | ||
WrappedComponent.isFullEqual = render.isFullEqual || isFullEqual; | ||
WrappedComponent.displayName = render.displayName || render.name; | ||
@@ -586,0 +596,0 @@ WrappedComponent.prototype = Object.create(AtomizedComponent.prototype); |
@@ -461,3 +461,3 @@ (function (global, factory) { | ||
function createReactWrapper(BaseComponent, defaultFromError, detached, rootInjector) { | ||
function createReactWrapper(BaseComponent, ErrorComponent, detached, rootInjector, isFullEqual) { | ||
var _class, _class2, _temp; | ||
@@ -469,2 +469,6 @@ | ||
if (isFullEqual === void 0) { | ||
isFullEqual = false; | ||
} | ||
var AtomizedComponent = (_class = (_temp = _class2 = | ||
@@ -485,3 +489,4 @@ /*#__PURE__*/ | ||
_this._el = undefined; | ||
_this._keys = props ? Object.keys(props) : undefined; | ||
var keys = undefined; | ||
_this._keys = props && (keys = Object.keys(props)).length > 0 ? keys : undefined; | ||
var cns = _this.constructor; | ||
@@ -501,5 +506,5 @@ _this._render = cns.render; | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(props) { | ||
if (this._keys === undefined) return false; | ||
var oldProps = this.props; | ||
var keys = this._keys; | ||
if (!keys) return false; | ||
var oldProps = this.props; | ||
@@ -516,2 +521,8 @@ for (var i = 0, l = keys.length; i < l; i++) { | ||
if (this.constructor.isFullEqual === true) { | ||
this._keys = Object.keys(props); | ||
this._propsChanged = keys.length !== this._keys.length; | ||
return this._propsChanged; | ||
} | ||
return false; | ||
@@ -545,3 +556,3 @@ }; | ||
} catch (error) { | ||
data = this._injector.invokeWithProps(render.onError || defaultFromError, { | ||
data = this._injector.invokeWithProps(render.onError || ErrorComponent, { | ||
error: error | ||
@@ -575,6 +586,4 @@ }); | ||
return AtomizedComponent; | ||
}(BaseComponent), _class2.displayName = void 0, _class2.render = void 0, _class2.instance = void 0, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
}(BaseComponent), _class2.displayName = void 0, _class2.render = void 0, _class2.instance = void 0, _class2.isFullEqual = isFullEqual, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
return function reactWrapper(render) { | ||
var displayName = render.displayName || render.name; | ||
var WrappedComponent = function WrappedComponent(props, context) { | ||
@@ -586,2 +595,3 @@ AtomizedComponent.call(this, props, context); | ||
WrappedComponent.render = render; | ||
WrappedComponent.isFullEqual = render.isFullEqual || isFullEqual; | ||
WrappedComponent.displayName = render.displayName || render.name; | ||
@@ -588,0 +598,0 @@ WrappedComponent.prototype = Object.create(AtomizedComponent.prototype); |
{ | ||
"name": "reactive-di", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "Reactive dependency injection", | ||
@@ -65,3 +65,3 @@ "publishConfig": { | ||
"flow-bin": "^0.58.0", | ||
"lom_atom": "^2.0.7", | ||
"lom_atom": "^2.0.8", | ||
"mobx": "^3.3.1", | ||
@@ -68,0 +68,0 @@ "mocha": "^4.0.1", |
@@ -11,5 +11,6 @@ // @flow | ||
BaseComponent: Class<*>, | ||
defaultFromError: IFromError<IElement>, | ||
ErrorComponent: IFromError<IElement>, | ||
detached: DetachedDecorator<Object, any>, | ||
rootInjector?: Injector = new Injector() | ||
rootInjector?: Injector = new Injector(), | ||
isFullEqual?: boolean = false | ||
): IAtomize<IElement, *> { | ||
@@ -24,2 +25,3 @@ class AtomizedComponent<State> extends BaseComponent { | ||
static instance: number | ||
static isFullEqual = isFullEqual | ||
@@ -34,3 +36,6 @@ _keys: string[] | void | ||
super(props, reactContext) | ||
this._keys = props ? Object.keys(props) : undefined | ||
let keys: string[] | void = undefined | ||
this._keys = (props && (keys = Object.keys(props)).length > 0) | ||
? keys | ||
: undefined | ||
const cns = this.constructor | ||
@@ -55,5 +60,5 @@ this._render = cns.render | ||
shouldComponentUpdate(props: IPropsWithContext) { | ||
if (this._keys === undefined) return false | ||
const oldProps = this.props | ||
const keys = this._keys | ||
if (!keys) return false | ||
const oldProps = this.props | ||
for (let i = 0, l = keys.length; i < l; i++) { // eslint-disable-line | ||
@@ -66,2 +71,7 @@ const k = keys[i] | ||
} | ||
if (this.constructor.isFullEqual === true) { | ||
this._keys = Object.keys(props) | ||
this._propsChanged = keys.length !== this._keys.length | ||
return this._propsChanged | ||
} | ||
return false | ||
@@ -94,3 +104,3 @@ } | ||
} catch (error) { | ||
data = this._injector.invokeWithProps(render.onError || defaultFromError, {error}) | ||
data = this._injector.invokeWithProps(render.onError || ErrorComponent, {error}) | ||
error[renderedKey] = true | ||
@@ -120,3 +130,2 @@ } | ||
): Class<IReactComponent<IElement>> { | ||
const displayName = render.displayName || render.name | ||
const WrappedComponent = function(props: IPropsWithContext, context?: Object) { | ||
@@ -127,2 +136,3 @@ AtomizedComponent.call(this, props, context) | ||
WrappedComponent.render = render | ||
WrappedComponent.isFullEqual = render.isFullEqual || isFullEqual | ||
WrappedComponent.displayName = render.displayName || render.name | ||
@@ -129,0 +139,0 @@ WrappedComponent.prototype = Object.create(AtomizedComponent.prototype) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
308847
2749