react-keep-alive
Advanced tools
Comparing version
@@ -85,2 +85,3 @@ "use strict"; | ||
_this.forceUpdateChildren(); | ||
_this.props.onUpdate(); | ||
} | ||
@@ -87,0 +88,0 @@ }); |
@@ -6,4 +6,5 @@ import React from 'react'; | ||
disabled?: boolean; | ||
extra?: any; | ||
} | ||
declare const _default: React.ComponentType<IKeepAliveProps>; | ||
export default _default; |
@@ -85,3 +85,3 @@ "use strict"; | ||
var BindLifecycleHOC = withIdentificationContextConsumer_1.default(function (_a) { | ||
var forwardRef = _a.forwardRef, _b = _a._identificationContextProps, identification = _b.identification, eventEmitter = _b.eventEmitter, activated = _b.activated, keepAlive = _b.keepAlive, wrapperProps = __rest(_a, ["forwardRef", "_identificationContextProps"]); | ||
var forwardRef = _a.forwardRef, _b = _a._identificationContextProps, identification = _b.identification, eventEmitter = _b.eventEmitter, activated = _b.activated, keepAlive = _b.keepAlive, extra = _b.extra, wrapperProps = __rest(_a, ["forwardRef", "_identificationContextProps"]); | ||
if (!identification) { | ||
@@ -91,3 +91,3 @@ debug_1.warn('[React Keep Alive] You should not use bindLifecycle outside a <KeepAlive>.'); | ||
} | ||
return (react_1.default.createElement(Component, __assign({}, wrapperProps, { ref: forwardRef || noop_1.default, _container: { | ||
return (react_1.default.createElement(Component, __assign({}, extra, wrapperProps, { ref: forwardRef || noop_1.default, _container: { | ||
identification: identification, | ||
@@ -94,0 +94,0 @@ eventEmitter: eventEmitter, |
@@ -136,3 +136,3 @@ "use strict"; | ||
TriggerLifecycleContainer.prototype.render = function () { | ||
var _a = this.props, propKey = _a.propKey, keepAlive = _a.keepAlive, getCombinedKeepAlive = _a.getCombinedKeepAlive, _b = _a._keepAliveContextProps, isExisted = _b.isExisted, storeElement = _b.storeElement, cache = _b.cache, eventEmitter = _b.eventEmitter, setCache = _b.setCache, unactivate = _b.unactivate, providerIdentification = _b.providerIdentification, wrapperProps = __rest(_a, ["propKey", "keepAlive", "getCombinedKeepAlive", "_keepAliveContextProps"]); | ||
var _a = this.props, propKey = _a.propKey, keepAlive = _a.keepAlive, extra = _a.extra, getCombinedKeepAlive = _a.getCombinedKeepAlive, _b = _a._keepAliveContextProps, isExisted = _b.isExisted, storeElement = _b.storeElement, cache = _b.cache, eventEmitter = _b.eventEmitter, setCache = _b.setCache, unactivate = _b.unactivate, providerIdentification = _b.providerIdentification, wrapperProps = __rest(_a, ["propKey", "keepAlive", "extra", "getCombinedKeepAlive", "_keepAliveContextProps"]); | ||
if (!this.identification) { | ||
@@ -159,2 +159,3 @@ // We need to generate a corresponding unique identifier based on the information of the component. | ||
isExisted: isExisted, | ||
extra: extra, | ||
} }, | ||
@@ -161,0 +162,0 @@ react_1.default.createElement(Component, __assign({}, wrapperProps, { _container: { |
@@ -76,2 +76,3 @@ var __extends = (this && this.__extends) || (function () { | ||
_this.forceUpdateChildren(); | ||
_this.props.onUpdate(); | ||
} | ||
@@ -78,0 +79,0 @@ }); |
@@ -6,4 +6,5 @@ import React from 'react'; | ||
disabled?: boolean; | ||
extra?: any; | ||
} | ||
declare const _default: React.ComponentType<IKeepAliveProps>; | ||
export default _default; |
@@ -80,3 +80,3 @@ var __assign = (this && this.__assign) || function () { | ||
var BindLifecycleHOC = withIdentificationContextConsumer(function (_a) { | ||
var forwardRef = _a.forwardRef, _b = _a._identificationContextProps, identification = _b.identification, eventEmitter = _b.eventEmitter, activated = _b.activated, keepAlive = _b.keepAlive, wrapperProps = __rest(_a, ["forwardRef", "_identificationContextProps"]); | ||
var forwardRef = _a.forwardRef, _b = _a._identificationContextProps, identification = _b.identification, eventEmitter = _b.eventEmitter, activated = _b.activated, keepAlive = _b.keepAlive, extra = _b.extra, wrapperProps = __rest(_a, ["forwardRef", "_identificationContextProps"]); | ||
if (!identification) { | ||
@@ -86,3 +86,3 @@ warn('[React Keep Alive] You should not use bindLifecycle outside a <KeepAlive>.'); | ||
} | ||
return (React.createElement(Component, __assign({}, wrapperProps, { ref: forwardRef || noop, _container: { | ||
return (React.createElement(Component, __assign({}, extra, wrapperProps, { ref: forwardRef || noop, _container: { | ||
identification: identification, | ||
@@ -89,0 +89,0 @@ eventEmitter: eventEmitter, |
@@ -131,3 +131,3 @@ var __extends = (this && this.__extends) || (function () { | ||
TriggerLifecycleContainer.prototype.render = function () { | ||
var _a = this.props, propKey = _a.propKey, keepAlive = _a.keepAlive, getCombinedKeepAlive = _a.getCombinedKeepAlive, _b = _a._keepAliveContextProps, isExisted = _b.isExisted, storeElement = _b.storeElement, cache = _b.cache, eventEmitter = _b.eventEmitter, setCache = _b.setCache, unactivate = _b.unactivate, providerIdentification = _b.providerIdentification, wrapperProps = __rest(_a, ["propKey", "keepAlive", "getCombinedKeepAlive", "_keepAliveContextProps"]); | ||
var _a = this.props, propKey = _a.propKey, keepAlive = _a.keepAlive, extra = _a.extra, getCombinedKeepAlive = _a.getCombinedKeepAlive, _b = _a._keepAliveContextProps, isExisted = _b.isExisted, storeElement = _b.storeElement, cache = _b.cache, eventEmitter = _b.eventEmitter, setCache = _b.setCache, unactivate = _b.unactivate, providerIdentification = _b.providerIdentification, wrapperProps = __rest(_a, ["propKey", "keepAlive", "extra", "getCombinedKeepAlive", "_keepAliveContextProps"]); | ||
if (!this.identification) { | ||
@@ -154,2 +154,3 @@ // We need to generate a corresponding unique identifier based on the information of the component. | ||
isExisted: isExisted, | ||
extra: extra, | ||
} }, | ||
@@ -156,0 +157,0 @@ React.createElement(Component, __assign({}, wrapperProps, { _container: { |
{ | ||
"name": "react-keep-alive", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"description": "Package will allow components to maintain their status, to avoid repeated re-rendering.", | ||
@@ -30,2 +30,6 @@ "author": "Shen Chang", | ||
"build:cjs": "npm run clean:cjs && tsc --outDir cjs --module commonjs", | ||
"build:dist": "npm run build:es && npm run build:cjs", | ||
"publish:patch": "npm run build:dist && npm version patch && npm publish", | ||
"publish:minor": "npm run build:dist && npm version minor && npm publish", | ||
"publish:major": "npm run build:dist && npm version major && npm publish", | ||
"start:demo": "webpack-dev-server --hot --historyApiFallback", | ||
@@ -57,5 +61,7 @@ "start:es": "npm run clean:es && tsc -w -sourcemap --outDir es" | ||
"@types/react-dom": "^16.8.2", | ||
"animate.css": "^3.7.0", | ||
"babel": "^6.23.0", | ||
"babel-loader": "^8.0.5", | ||
"codecov": "^3.2.0", | ||
"css-loader": "^2.1.1", | ||
"cz-conventional-changelog": "^2.1.0", | ||
@@ -69,4 +75,8 @@ "enzyme": "^3.8.0", | ||
"react-dom": "^16.8.5", | ||
"react-redux": "^7.0.3", | ||
"react-router-dom": "^5.0.0", | ||
"react-transition-group": "^4.0.1", | ||
"redux": "^4.0.1", | ||
"rimraf": "^2.6.3", | ||
"style-loader": "^0.23.1", | ||
"ts-jest": "^23.10.5", | ||
@@ -73,0 +83,0 @@ "typescript": "^3.3.1", |
276343
0.28%2928
0.21%34
21.43%