Comparing version 9.7.2 to 9.8.0
@@ -116,24 +116,5 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
warning(!openAnimation && !openTransitionName, '`openAnimation` and `openTransitionName` is removed. Please use `motion` or `defaultMotion` instead.'); | ||
} // ========================= Mode ========================= | ||
} // ========================= Open ========================= | ||
var _React$useMemo = React.useMemo(function () { | ||
if ((mode === 'inline' || mode === 'vertical') && inlineCollapsed) { | ||
return ['vertical', inlineCollapsed]; | ||
} | ||
return [mode, false]; | ||
}, [mode, inlineCollapsed]), | ||
_React$useMemo2 = _slicedToArray(_React$useMemo, 2), | ||
mergedMode = _React$useMemo2[0], | ||
mergedInlineCollapsed = _React$useMemo2[1]; // ====================== Responsive ====================== | ||
var _React$useState3 = React.useState(0), | ||
_React$useState4 = _slicedToArray(_React$useState3, 2), | ||
lastVisibleIndex = _React$useState4[0], | ||
setLastVisibleIndex = _React$useState4[1]; | ||
var allVisible = lastVisibleIndex >= childList.length - 1 || mergedMode !== 'horizontal' || disabledOverflow; // ========================= Open ========================= | ||
var _useMergedState = useMergedState(defaultOpenKeys, { | ||
@@ -155,21 +136,41 @@ value: openKeys, | ||
var _React$useState5 = React.useState(mergedOpenKeys), | ||
_React$useState6 = _slicedToArray(_React$useState5, 2), | ||
inlineCacheOpenKeys = _React$useState6[0], | ||
setInlineCacheOpenKeys = _React$useState6[1]; | ||
var _React$useState3 = React.useState(mergedOpenKeys), | ||
_React$useState4 = _slicedToArray(_React$useState3, 2), | ||
inlineCacheOpenKeys = _React$useState4[0], | ||
setInlineCacheOpenKeys = _React$useState4[1]; | ||
var mountRef = React.useRef(false); // ========================= Mode ========================= | ||
var _React$useMemo = React.useMemo(function () { | ||
if ((mode === 'inline' || mode === 'vertical') && inlineCollapsed) { | ||
return ['vertical', inlineCollapsed]; | ||
} | ||
return [mode, false]; | ||
}, [mode, inlineCollapsed]), | ||
_React$useMemo2 = _slicedToArray(_React$useMemo, 2), | ||
mergedMode = _React$useMemo2[0], | ||
mergedInlineCollapsed = _React$useMemo2[1]; | ||
var isInlineMode = mergedMode === 'inline'; | ||
var mountRef = React.useRef(false); // Cache | ||
var _React$useState5 = React.useState(mergedMode), | ||
_React$useState6 = _slicedToArray(_React$useState5, 2), | ||
internalMode = _React$useState6[0], | ||
setInternalMode = _React$useState6[1]; | ||
var _React$useState7 = React.useState(mergedInlineCollapsed), | ||
_React$useState8 = _slicedToArray(_React$useState7, 2), | ||
internalInlineCollapsed = _React$useState8[0], | ||
setInternalInlineCollapsed = _React$useState8[1]; | ||
React.useEffect(function () { | ||
if (isInlineMode) { | ||
setInlineCacheOpenKeys(mergedOpenKeys); | ||
} | ||
}, [mergedOpenKeys]); // Restore | ||
setInternalMode(mergedMode); | ||
setInternalInlineCollapsed(mergedInlineCollapsed); | ||
React.useEffect(function () { | ||
if (!mountRef.current) { | ||
return; | ||
} | ||
} // Synchronously update MergedOpenKeys | ||
if (isInlineMode) { | ||
@@ -181,4 +182,17 @@ setMergedOpenKeys(inlineCacheOpenKeys); | ||
} | ||
}, [isInlineMode]); | ||
}, [mergedMode, mergedInlineCollapsed]); // ====================== Responsive ====================== | ||
var _React$useState9 = React.useState(0), | ||
_React$useState10 = _slicedToArray(_React$useState9, 2), | ||
lastVisibleIndex = _React$useState10[0], | ||
setLastVisibleIndex = _React$useState10[1]; | ||
var allVisible = lastVisibleIndex >= childList.length - 1 || internalMode !== 'horizontal' || disabledOverflow; // Cache | ||
React.useEffect(function () { | ||
if (isInlineMode) { | ||
setInlineCacheOpenKeys(mergedOpenKeys); | ||
} | ||
}, [mergedOpenKeys]); | ||
React.useEffect(function () { | ||
mountRef.current = true; | ||
@@ -302,3 +316,3 @@ return function () { | ||
if (!multiple && mergedOpenKeys.length && mergedMode !== 'inline') { | ||
if (!multiple && mergedOpenKeys.length && internalMode !== 'inline') { | ||
triggerOpenKeys(EMPTY_LIST); | ||
@@ -324,3 +338,3 @@ } | ||
newOpenKeys.push(key); | ||
} else if (mergedMode !== 'inline') { | ||
} else if (internalMode !== 'inline') { | ||
// We need find all related popup to close | ||
@@ -344,3 +358,3 @@ var subPathKeys = getSubPathKeys(key); | ||
var onInternalKeyDown = useAccessibility(mergedMode, mergedActiveKey, isRtl, uuid, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown); // ======================== Effect ======================== | ||
var onInternalKeyDown = useAccessibility(internalMode, mergedActiveKey, isRtl, uuid, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown); // ======================== Effect ======================== | ||
@@ -359,3 +373,3 @@ React.useEffect(function () { | ||
var wrappedChildList = mergedMode !== 'horizontal' || disabledOverflow ? childList : // Need wrap for overflow dropdown that do not response for open | ||
var wrappedChildList = internalMode !== 'horizontal' || disabledOverflow ? childList : // Need wrap for overflow dropdown that do not response for open | ||
childList.map(function (child, index) { | ||
@@ -378,3 +392,3 @@ return ( | ||
itemComponent: MenuItem, | ||
className: classNames(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(mergedMode), className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-inline-collapsed"), mergedInlineCollapsed), _defineProperty(_classNames, "".concat(prefixCls, "-rtl"), isRtl), _classNames), rootClassName), | ||
className: classNames(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(internalMode), className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-inline-collapsed"), internalInlineCollapsed), _defineProperty(_classNames, "".concat(prefixCls, "-rtl"), isRtl), _classNames), rootClassName), | ||
dir: direction, | ||
@@ -400,3 +414,3 @@ style: style, | ||
}, | ||
maxCount: mergedMode !== 'horizontal' || disabledOverflow ? Overflow.INVALIDATE : Overflow.RESPONSIVE, | ||
maxCount: internalMode !== 'horizontal' || disabledOverflow ? Overflow.INVALIDATE : Overflow.RESPONSIVE, | ||
ssr: "full", | ||
@@ -417,3 +431,3 @@ "data-menu-list": true, | ||
rootClassName: rootClassName, | ||
mode: mergedMode, | ||
mode: internalMode, | ||
openKeys: mergedOpenKeys, | ||
@@ -420,0 +434,0 @@ rtl: isRtl // Disabled |
@@ -153,24 +153,5 @@ "use strict"; | ||
(0, _warning.default)(!openAnimation && !openTransitionName, '`openAnimation` and `openTransitionName` is removed. Please use `motion` or `defaultMotion` instead.'); | ||
} // ========================= Mode ========================= | ||
} // ========================= Open ========================= | ||
var _React$useMemo = React.useMemo(function () { | ||
if ((mode === 'inline' || mode === 'vertical') && inlineCollapsed) { | ||
return ['vertical', inlineCollapsed]; | ||
} | ||
return [mode, false]; | ||
}, [mode, inlineCollapsed]), | ||
_React$useMemo2 = (0, _slicedToArray2.default)(_React$useMemo, 2), | ||
mergedMode = _React$useMemo2[0], | ||
mergedInlineCollapsed = _React$useMemo2[1]; // ====================== Responsive ====================== | ||
var _React$useState3 = React.useState(0), | ||
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2), | ||
lastVisibleIndex = _React$useState4[0], | ||
setLastVisibleIndex = _React$useState4[1]; | ||
var allVisible = lastVisibleIndex >= childList.length - 1 || mergedMode !== 'horizontal' || disabledOverflow; // ========================= Open ========================= | ||
var _useMergedState = (0, _useMergedState7.default)(defaultOpenKeys, { | ||
@@ -192,21 +173,41 @@ value: openKeys, | ||
var _React$useState5 = React.useState(mergedOpenKeys), | ||
_React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2), | ||
inlineCacheOpenKeys = _React$useState6[0], | ||
setInlineCacheOpenKeys = _React$useState6[1]; | ||
var _React$useState3 = React.useState(mergedOpenKeys), | ||
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2), | ||
inlineCacheOpenKeys = _React$useState4[0], | ||
setInlineCacheOpenKeys = _React$useState4[1]; | ||
var mountRef = React.useRef(false); // ========================= Mode ========================= | ||
var _React$useMemo = React.useMemo(function () { | ||
if ((mode === 'inline' || mode === 'vertical') && inlineCollapsed) { | ||
return ['vertical', inlineCollapsed]; | ||
} | ||
return [mode, false]; | ||
}, [mode, inlineCollapsed]), | ||
_React$useMemo2 = (0, _slicedToArray2.default)(_React$useMemo, 2), | ||
mergedMode = _React$useMemo2[0], | ||
mergedInlineCollapsed = _React$useMemo2[1]; | ||
var isInlineMode = mergedMode === 'inline'; | ||
var mountRef = React.useRef(false); // Cache | ||
var _React$useState5 = React.useState(mergedMode), | ||
_React$useState6 = (0, _slicedToArray2.default)(_React$useState5, 2), | ||
internalMode = _React$useState6[0], | ||
setInternalMode = _React$useState6[1]; | ||
var _React$useState7 = React.useState(mergedInlineCollapsed), | ||
_React$useState8 = (0, _slicedToArray2.default)(_React$useState7, 2), | ||
internalInlineCollapsed = _React$useState8[0], | ||
setInternalInlineCollapsed = _React$useState8[1]; | ||
React.useEffect(function () { | ||
if (isInlineMode) { | ||
setInlineCacheOpenKeys(mergedOpenKeys); | ||
} | ||
}, [mergedOpenKeys]); // Restore | ||
setInternalMode(mergedMode); | ||
setInternalInlineCollapsed(mergedInlineCollapsed); | ||
React.useEffect(function () { | ||
if (!mountRef.current) { | ||
return; | ||
} | ||
} // Synchronously update MergedOpenKeys | ||
if (isInlineMode) { | ||
@@ -218,4 +219,17 @@ setMergedOpenKeys(inlineCacheOpenKeys); | ||
} | ||
}, [isInlineMode]); | ||
}, [mergedMode, mergedInlineCollapsed]); // ====================== Responsive ====================== | ||
var _React$useState9 = React.useState(0), | ||
_React$useState10 = (0, _slicedToArray2.default)(_React$useState9, 2), | ||
lastVisibleIndex = _React$useState10[0], | ||
setLastVisibleIndex = _React$useState10[1]; | ||
var allVisible = lastVisibleIndex >= childList.length - 1 || internalMode !== 'horizontal' || disabledOverflow; // Cache | ||
React.useEffect(function () { | ||
if (isInlineMode) { | ||
setInlineCacheOpenKeys(mergedOpenKeys); | ||
} | ||
}, [mergedOpenKeys]); | ||
React.useEffect(function () { | ||
mountRef.current = true; | ||
@@ -339,3 +353,3 @@ return function () { | ||
if (!multiple && mergedOpenKeys.length && mergedMode !== 'inline') { | ||
if (!multiple && mergedOpenKeys.length && internalMode !== 'inline') { | ||
triggerOpenKeys(EMPTY_LIST); | ||
@@ -361,3 +375,3 @@ } | ||
newOpenKeys.push(key); | ||
} else if (mergedMode !== 'inline') { | ||
} else if (internalMode !== 'inline') { | ||
// We need find all related popup to close | ||
@@ -381,3 +395,3 @@ var subPathKeys = getSubPathKeys(key); | ||
var onInternalKeyDown = (0, _useAccessibility.default)(mergedMode, mergedActiveKey, isRtl, uuid, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown); // ======================== Effect ======================== | ||
var onInternalKeyDown = (0, _useAccessibility.default)(internalMode, mergedActiveKey, isRtl, uuid, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown); // ======================== Effect ======================== | ||
@@ -396,3 +410,3 @@ React.useEffect(function () { | ||
var wrappedChildList = mergedMode !== 'horizontal' || disabledOverflow ? childList : // Need wrap for overflow dropdown that do not response for open | ||
var wrappedChildList = internalMode !== 'horizontal' || disabledOverflow ? childList : // Need wrap for overflow dropdown that do not response for open | ||
childList.map(function (child, index) { | ||
@@ -415,3 +429,3 @@ return ( | ||
itemComponent: _MenuItem.default, | ||
className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(mergedMode), className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-inline-collapsed"), mergedInlineCollapsed), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-rtl"), isRtl), _classNames), rootClassName), | ||
className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(internalMode), className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-inline-collapsed"), internalInlineCollapsed), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-rtl"), isRtl), _classNames), rootClassName), | ||
dir: direction, | ||
@@ -437,3 +451,3 @@ style: style, | ||
}, | ||
maxCount: mergedMode !== 'horizontal' || disabledOverflow ? _rcOverflow.default.INVALIDATE : _rcOverflow.default.RESPONSIVE, | ||
maxCount: internalMode !== 'horizontal' || disabledOverflow ? _rcOverflow.default.INVALIDATE : _rcOverflow.default.RESPONSIVE, | ||
ssr: "full", | ||
@@ -454,3 +468,3 @@ "data-menu-list": true, | ||
rootClassName: rootClassName, | ||
mode: mergedMode, | ||
mode: internalMode, | ||
openKeys: mergedOpenKeys, | ||
@@ -457,0 +471,0 @@ rtl: isRtl // Disabled |
{ | ||
"name": "rc-menu", | ||
"version": "9.7.2", | ||
"version": "9.8.0", | ||
"description": "menu ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
249315
4949