rc-notification
Advanced tools
Comparing version 5.2.0-3 to 5.2.0-4
@@ -52,3 +52,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
useEffect(function () { | ||
if (hoverKeys.length > 1) { | ||
if (stack && hoverKeys.length > 1) { | ||
setHoverKeys(function (prev) { | ||
@@ -63,3 +63,12 @@ return prev.filter(function (key) { | ||
} | ||
}, [hoverKeys, keys]); | ||
}, [hoverKeys, keys, stack]); | ||
// Force update latest notice | ||
useEffect(function () { | ||
var _keys; | ||
if (stack && dictRef.current[(_keys = keys[keys.length - 1]) === null || _keys === void 0 ? void 0 : _keys.key]) { | ||
var _keys2; | ||
setLatestNotice(dictRef.current[(_keys2 = keys[keys.length - 1]) === null || _keys2 === void 0 ? void 0 : _keys2.key]); | ||
} | ||
}, [keys, stack]); | ||
return /*#__PURE__*/React.createElement(CSSMotionList, _extends({ | ||
@@ -74,7 +83,2 @@ key: placement, | ||
onAllNoticeRemoved(placement); | ||
}, | ||
onAppearPrepare: function onAppearPrepare(element) { | ||
if (element.parentNode.lastElementChild === element) { | ||
setLatestNotice(element); | ||
} | ||
} | ||
@@ -98,6 +102,6 @@ }), function (_ref2, nodeRef) { | ||
// Should minus (motionIndex - 1) to get the correct index because keys.length is not the same as dom length | ||
var index = keys.length - 1 - (dataIndex > -1 ? dataIndex : motionIndex - 1); | ||
var transformX = placement === 'top' || placement === 'bottom' ? '-50%' : '0'; | ||
var stackStyle = {}; | ||
if (stack) { | ||
var index = keys.length - 1 - (dataIndex > -1 ? dataIndex : motionIndex - 1); | ||
var transformX = placement === 'top' || placement === 'bottom' ? '-50%' : '0'; | ||
if (index > 0) { | ||
@@ -150,3 +154,3 @@ var _dictRef$current$key, _dictRef$current$key2, _dictRef$current$key3; | ||
onNoticeClose: onNoticeClose, | ||
hovering: hoverKeys.length > 0 | ||
hovering: stack && hoverKeys.length > 0 | ||
}))); | ||
@@ -153,0 +157,0 @@ }); |
@@ -62,3 +62,3 @@ "use strict"; | ||
(0, _react.useEffect)(function () { | ||
if (hoverKeys.length > 1) { | ||
if (stack && hoverKeys.length > 1) { | ||
setHoverKeys(function (prev) { | ||
@@ -73,3 +73,12 @@ return prev.filter(function (key) { | ||
} | ||
}, [hoverKeys, keys]); | ||
}, [hoverKeys, keys, stack]); | ||
// Force update latest notice | ||
(0, _react.useEffect)(function () { | ||
var _keys; | ||
if (stack && dictRef.current[(_keys = keys[keys.length - 1]) === null || _keys === void 0 ? void 0 : _keys.key]) { | ||
var _keys2; | ||
setLatestNotice(dictRef.current[(_keys2 = keys[keys.length - 1]) === null || _keys2 === void 0 ? void 0 : _keys2.key]); | ||
} | ||
}, [keys, stack]); | ||
return /*#__PURE__*/_react.default.createElement(_rcMotion.CSSMotionList, (0, _extends2.default)({ | ||
@@ -84,7 +93,2 @@ key: placement, | ||
onAllNoticeRemoved(placement); | ||
}, | ||
onAppearPrepare: function onAppearPrepare(element) { | ||
if (element.parentNode.lastElementChild === element) { | ||
setLatestNotice(element); | ||
} | ||
} | ||
@@ -108,6 +112,6 @@ }), function (_ref2, nodeRef) { | ||
// Should minus (motionIndex - 1) to get the correct index because keys.length is not the same as dom length | ||
var index = keys.length - 1 - (dataIndex > -1 ? dataIndex : motionIndex - 1); | ||
var transformX = placement === 'top' || placement === 'bottom' ? '-50%' : '0'; | ||
var stackStyle = {}; | ||
if (stack) { | ||
var index = keys.length - 1 - (dataIndex > -1 ? dataIndex : motionIndex - 1); | ||
var transformX = placement === 'top' || placement === 'bottom' ? '-50%' : '0'; | ||
if (index > 0) { | ||
@@ -160,3 +164,3 @@ var _dictRef$current$key, _dictRef$current$key2, _dictRef$current$key3; | ||
onNoticeClose: onNoticeClose, | ||
hovering: hoverKeys.length > 0 | ||
hovering: stack && hoverKeys.length > 0 | ||
}))); | ||
@@ -163,0 +167,0 @@ }); |
{ | ||
"name": "rc-notification", | ||
"version": "5.2.0-3", | ||
"version": "5.2.0-4", | ||
"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
81090
1614