@dfnivo/recompose
Advanced tools
Comparing version 0.79.7 to 0.79.8
@@ -12,2 +12,16 @@ function _assertThisInitialized(self) { | ||
} | ||
function _defineProperties(target, props) { | ||
for(var i = 0; i < props.length; i++){ | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
function _getPrototypeOf(o) { | ||
@@ -87,10 +101,17 @@ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
} | ||
var _proto = ShouldUpdate.prototype; | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { | ||
// @ts-expect-error not type-able | ||
return test(this.props, nextProps); | ||
}; | ||
_proto.render = function render() { | ||
return factory(this.props); | ||
}; | ||
_createClass(ShouldUpdate, [ | ||
{ | ||
key: "shouldComponentUpdate", | ||
value: function shouldComponentUpdate(nextProps) { | ||
// @ts-expect-error not type-able | ||
return test(this.props, nextProps); | ||
} | ||
}, | ||
{ | ||
key: "render", | ||
value: function render() { | ||
return factory(this.props); | ||
} | ||
} | ||
]); | ||
return ShouldUpdate; | ||
@@ -97,0 +118,0 @@ }(Component); |
@@ -12,2 +12,16 @@ function _assertThisInitialized(self) { | ||
} | ||
function _defineProperties(target, props) { | ||
for(var i = 0; i < props.length; i++){ | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
@@ -121,23 +135,31 @@ if (key in obj) { | ||
_this = _super.apply(this, arguments); | ||
_this.state = { | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
computedProps: propsMapper(_this.props), | ||
prevProps: _this.props | ||
}; | ||
}); | ||
return _this; | ||
} | ||
var _proto = WithPropsOnChange.prototype; | ||
_proto.render = function render() { | ||
return factory(_objectSpread({}, this.props, this.state.computedProps)); | ||
}; | ||
WithPropsOnChange.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) { | ||
if (shouldMap(prevState.prevProps, nextProps)) { | ||
return { | ||
computedProps: propsMapper(nextProps), | ||
prevProps: nextProps | ||
}; | ||
_createClass(WithPropsOnChange, [ | ||
{ | ||
key: "render", | ||
value: function render() { | ||
return factory(_objectSpread({}, this.props, this.state.computedProps)); | ||
} | ||
} | ||
return { | ||
prevProps: nextProps | ||
}; | ||
}; | ||
], [ | ||
{ | ||
key: "getDerivedStateFromProps", | ||
value: function getDerivedStateFromProps(nextProps, prevState) { | ||
if (shouldMap(prevState.prevProps, nextProps)) { | ||
return { | ||
computedProps: propsMapper(nextProps), | ||
prevProps: nextProps | ||
}; | ||
} | ||
return { | ||
prevProps: nextProps | ||
}; | ||
} | ||
} | ||
]); | ||
return WithPropsOnChange; | ||
@@ -144,0 +166,0 @@ }(Component); |
@@ -12,2 +12,16 @@ function _assertThisInitialized(self) { | ||
} | ||
function _defineProperties(target, props) { | ||
for(var i = 0; i < props.length; i++){ | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
@@ -139,6 +153,6 @@ if (key in obj) { | ||
_this = _super.apply(this, arguments); | ||
_this.state = { | ||
_defineProperty(_assertThisInitialized(_this), "state", { | ||
stateValue: typeof initialState === "function" ? initialState(_this.props) : initialState | ||
}; | ||
_this.updateStateValue = function(updateFn, callback) { | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "updateStateValue", function(updateFn, callback) { | ||
return _this.setState(function(param) { | ||
@@ -150,10 +164,14 @@ var stateValue = param.stateValue; | ||
}, callback); | ||
}; | ||
}); | ||
return _this; | ||
} | ||
var _proto = WithState.prototype; | ||
_proto.render = function render() { | ||
var _obj; | ||
return factory(_objectSpreadProps(_objectSpread({}, this.props), (_obj = {}, _defineProperty(_obj, stateName, this.state.stateValue), _defineProperty(_obj, stateUpdaterName, this.updateStateValue), _obj))); | ||
}; | ||
_createClass(WithState, [ | ||
{ | ||
key: "render", | ||
value: function render() { | ||
var _obj; | ||
return factory(_objectSpreadProps(_objectSpread({}, this.props), (_obj = {}, _defineProperty(_obj, stateName, this.state.stateValue), _defineProperty(_obj, stateUpdaterName, this.updateStateValue), _obj))); | ||
} | ||
} | ||
]); | ||
return WithState; | ||
@@ -160,0 +178,0 @@ }(Component); |
{ | ||
"name": "@dfnivo/recompose", | ||
"version": "0.79.7", | ||
"version": "0.79.8", | ||
"keywords": [ | ||
@@ -39,3 +39,3 @@ "nivo", | ||
}, | ||
"gitHead": "873421a254eefa9d52e625b85541e2e69d24fb9e" | ||
"gitHead": "2eb9e452c7b3a2e403c42c5dbe3672650ed7d4b6" | ||
} |
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
115058
1596