rc-notification
Advanced tools
Comparing version 4.5.1 to 4.5.2
@@ -11,3 +11,3 @@ import React, { Component } from 'react'; | ||
children?: React.ReactNode; | ||
update?: boolean; | ||
updateMark?: string; | ||
closeIcon?: React.ReactNode; | ||
@@ -14,0 +14,0 @@ closable?: boolean; |
@@ -63,3 +63,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
value: function componentDidUpdate(prevProps) { | ||
if (this.props.duration !== prevProps.duration || this.props.update) { | ||
if (this.props.duration !== prevProps.duration || this.props.updateMark !== prevProps.updateMark) { | ||
this.restartCloseTimer(); | ||
@@ -66,0 +66,0 @@ } |
@@ -6,3 +6,3 @@ import React, { Component, ReactText } from 'react'; | ||
key?: React.Key; | ||
updateKey?: React.Key; | ||
updateMark?: string; | ||
content?: React.ReactNode; | ||
@@ -51,3 +51,3 @@ } | ||
getTransitionName(): string; | ||
add: (notice: NoticeContent, holderCallback?: HolderReadyCallback) => void; | ||
add: (originNotice: NoticeContent, holderCallback?: HolderReadyCallback) => void; | ||
remove: (key: React.Key) => void; | ||
@@ -54,0 +54,0 @@ noticePropsMap: Record<React.Key, { |
@@ -39,6 +39,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
_this.add = function (notice, holderCallback) { | ||
// eslint-disable-next-line no-param-reassign | ||
notice.key = notice.key || getUuid(); | ||
var key = notice.key; | ||
_this.add = function (originNotice, holderCallback) { | ||
var key = originNotice.key || getUuid(); | ||
var notice = _objectSpread(_objectSpread({}, originNotice), {}, { | ||
key: key | ||
}); | ||
var maxCount = _this.props.maxCount; | ||
@@ -64,3 +67,7 @@ | ||
// eslint-disable-next-line no-param-reassign | ||
notice.updateKey = updatedNotices[0].notice.updateKey || updatedNotices[0].notice.key; | ||
// zombieJ: Not know why use `updateKey`. This makes Notice infinite loop in jest. | ||
// Change to `updateMark` for compare instead. | ||
// https://github.com/react-component/notification/commit/32299e6be396f94040bfa82517eea940db947ece | ||
notice.key = updatedNotices[0].notice.key; | ||
notice.updateMark = getUuid(); | ||
updatedNotices.shift(); | ||
@@ -126,5 +133,5 @@ } | ||
holderCallback = _ref3.holderCallback; | ||
var update = Boolean(index === notices.length - 1 && notice.updateKey); | ||
var key = notice.updateKey ? notice.updateKey : notice.key; | ||
var onClose = createChainedFunction(_this2.remove.bind(_this2, notice.key), notice.onClose); | ||
var updateMark = index === notices.length - 1 ? notice.updateMark : undefined; | ||
var key = notice.key; | ||
var onClose = createChainedFunction(_this2.remove.bind(_this2, key), notice.onClose); | ||
@@ -136,3 +143,3 @@ var noticeProps = _objectSpread(_objectSpread(_objectSpread({ | ||
key: key, | ||
update: update, | ||
updateMark: updateMark, | ||
onClose: onClose, | ||
@@ -139,0 +146,0 @@ onClick: notice.onClick, |
@@ -11,3 +11,3 @@ import React, { Component } from 'react'; | ||
children?: React.ReactNode; | ||
update?: boolean; | ||
updateMark?: string; | ||
closeIcon?: React.ReactNode; | ||
@@ -14,0 +14,0 @@ closable?: boolean; |
@@ -80,3 +80,3 @@ "use strict"; | ||
value: function componentDidUpdate(prevProps) { | ||
if (this.props.duration !== prevProps.duration || this.props.update) { | ||
if (this.props.duration !== prevProps.duration || this.props.updateMark !== prevProps.updateMark) { | ||
this.restartCloseTimer(); | ||
@@ -83,0 +83,0 @@ } |
@@ -6,3 +6,3 @@ import React, { Component, ReactText } from 'react'; | ||
key?: React.Key; | ||
updateKey?: React.Key; | ||
updateMark?: string; | ||
content?: React.ReactNode; | ||
@@ -51,3 +51,3 @@ } | ||
getTransitionName(): string; | ||
add: (notice: NoticeContent, holderCallback?: HolderReadyCallback) => void; | ||
add: (originNotice: NoticeContent, holderCallback?: HolderReadyCallback) => void; | ||
remove: (key: React.Key) => void; | ||
@@ -54,0 +54,0 @@ noticePropsMap: Record<React.Key, { |
@@ -62,6 +62,7 @@ "use strict"; | ||
_this.add = function (notice, holderCallback) { | ||
// eslint-disable-next-line no-param-reassign | ||
notice.key = notice.key || getUuid(); | ||
var key = notice.key; | ||
_this.add = function (originNotice, holderCallback) { | ||
var key = originNotice.key || getUuid(); | ||
var notice = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, originNotice), {}, { | ||
key: key | ||
}); | ||
var maxCount = _this.props.maxCount; | ||
@@ -87,3 +88,7 @@ | ||
// eslint-disable-next-line no-param-reassign | ||
notice.updateKey = updatedNotices[0].notice.updateKey || updatedNotices[0].notice.key; | ||
// zombieJ: Not know why use `updateKey`. This makes Notice infinite loop in jest. | ||
// Change to `updateMark` for compare instead. | ||
// https://github.com/react-component/notification/commit/32299e6be396f94040bfa82517eea940db947ece | ||
notice.key = updatedNotices[0].notice.key; | ||
notice.updateMark = getUuid(); | ||
updatedNotices.shift(); | ||
@@ -149,5 +154,5 @@ } | ||
holderCallback = _ref3.holderCallback; | ||
var update = Boolean(index === notices.length - 1 && notice.updateKey); | ||
var key = notice.updateKey ? notice.updateKey : notice.key; | ||
var onClose = (0, _createChainedFunction.default)(_this2.remove.bind(_this2, notice.key), notice.onClose); | ||
var updateMark = index === notices.length - 1 ? notice.updateMark : undefined; | ||
var key = notice.key; | ||
var onClose = (0, _createChainedFunction.default)(_this2.remove.bind(_this2, key), notice.onClose); | ||
var noticeProps = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({ | ||
@@ -158,3 +163,3 @@ prefixCls: prefixCls, | ||
key: key, | ||
update: update, | ||
updateMark: updateMark, | ||
onClose: onClose, | ||
@@ -161,0 +166,0 @@ onClick: notice.onClick, |
{ | ||
"name": "rc-notification", | ||
"version": "4.5.1", | ||
"version": "4.5.2", | ||
"description": "notification ui component for react", | ||
@@ -5,0 +5,0 @@ "engines": { |
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
48516
1047