Comparing version 9.14.1 to 9.15.0
@@ -18,3 +18,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
function getOffset(mode, isRootLevel, isRtl, which) { | ||
var _inline, _horizontal, _vertical, _offsets; | ||
var _offsets; | ||
var prev = 'prev'; | ||
@@ -31,5 +31,5 @@ var next = 'next'; | ||
} | ||
var inline = (_inline = {}, _defineProperty(_inline, UP, prev), _defineProperty(_inline, DOWN, next), _inline); | ||
var horizontal = (_horizontal = {}, _defineProperty(_horizontal, LEFT, isRtl ? next : prev), _defineProperty(_horizontal, RIGHT, isRtl ? prev : next), _defineProperty(_horizontal, DOWN, children), _defineProperty(_horizontal, ENTER, children), _horizontal); | ||
var vertical = (_vertical = {}, _defineProperty(_vertical, UP, prev), _defineProperty(_vertical, DOWN, next), _defineProperty(_vertical, ENTER, children), _defineProperty(_vertical, ESC, parent), _defineProperty(_vertical, LEFT, isRtl ? children : parent), _defineProperty(_vertical, RIGHT, isRtl ? parent : children), _vertical); | ||
var inline = _defineProperty(_defineProperty({}, UP, prev), DOWN, next); | ||
var horizontal = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, LEFT, isRtl ? next : prev), RIGHT, isRtl ? prev : next), DOWN, children), ENTER, children); | ||
var vertical = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, UP, prev), DOWN, next), ENTER, children), ESC, parent), LEFT, isRtl ? children : parent), RIGHT, isRtl ? parent : children); | ||
var offsets = { | ||
@@ -270,4 +270,4 @@ inline: inline, | ||
// Pass origin key down event | ||
originOnKeyDown === null || originOnKeyDown === void 0 ? void 0 : originOnKeyDown(e); | ||
originOnKeyDown === null || originOnKeyDown === void 0 || originOnKeyDown(e); | ||
}; | ||
} |
@@ -15,3 +15,3 @@ import * as React from 'react'; | ||
ret.onMouseEnter = function (domEvent) { | ||
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter({ | ||
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({ | ||
key: eventKey, | ||
@@ -23,3 +23,3 @@ domEvent: domEvent | ||
ret.onMouseLeave = function (domEvent) { | ||
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({ | ||
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({ | ||
key: eventKey, | ||
@@ -26,0 +26,0 @@ domEvent: domEvent |
@@ -31,2 +31,3 @@ import type * as React from 'react'; | ||
itemIcon?: RenderIconType; | ||
extra?: React.ReactNode; | ||
key: React.Key; | ||
@@ -33,0 +34,0 @@ onMouseEnter?: MenuHoverEventHandler; |
@@ -45,3 +45,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
var Menu = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _childList$, _classNames; | ||
var _childList$; | ||
var _ref = props, | ||
@@ -104,3 +104,3 @@ _ref$prefixCls = _ref.prefixCls, | ||
var _React$useMemo = React.useMemo(function () { | ||
return [parseItems(children, items, EMPTY_LIST, _internalComponents), parseItems(children, items, EMPTY_LIST, {})]; | ||
return [parseItems(children, items, EMPTY_LIST, _internalComponents, prefixCls), parseItems(children, items, EMPTY_LIST, {}, prefixCls)]; | ||
}, [children, items, _internalComponents]), | ||
@@ -140,3 +140,3 @@ _React$useMemo2 = _slicedToArray(_React$useMemo, 2), | ||
setMergedOpenKeys(keys); | ||
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(keys); | ||
onOpenChange === null || onOpenChange === void 0 || onOpenChange(keys); | ||
} | ||
@@ -267,3 +267,3 @@ if (forceFlush) { | ||
var _elementToFocus$focus; | ||
elementToFocus === null || elementToFocus === void 0 ? void 0 : (_elementToFocus$focus = elementToFocus.focus) === null || _elementToFocus$focus === void 0 ? void 0 : _elementToFocus$focus.call(elementToFocus, options); | ||
elementToFocus === null || elementToFocus === void 0 || (_elementToFocus$focus = elementToFocus.focus) === null || _elementToFocus$focus === void 0 || _elementToFocus$focus.call(elementToFocus, options); | ||
} | ||
@@ -318,5 +318,5 @@ } | ||
if (exist) { | ||
onDeselect === null || onDeselect === void 0 ? void 0 : onDeselect(selectInfo); | ||
onDeselect === null || onDeselect === void 0 || onDeselect(selectInfo); | ||
} else { | ||
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectInfo); | ||
onSelect === null || onSelect === void 0 || onSelect(selectInfo); | ||
} | ||
@@ -336,3 +336,3 @@ } | ||
var onInternalClick = useMemoCallback(function (info) { | ||
onClick === null || onClick === void 0 ? void 0 : onClick(warnItemProp(info)); | ||
onClick === null || onClick === void 0 || onClick(warnItemProp(info)); | ||
triggerSelection(info); | ||
@@ -401,3 +401,3 @@ }); | ||
itemComponent: MenuItem, | ||
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), | ||
className: classNames(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(internalMode), className, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-inline-collapsed"), internalInlineCollapsed), "".concat(prefixCls, "-rtl"), isRtl), rootClassName), | ||
dir: direction, | ||
@@ -404,0 +404,0 @@ style: style, |
@@ -66,3 +66,2 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
var InternalMenuItem = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _classNames; | ||
var style = props.style, | ||
@@ -136,7 +135,7 @@ className = props.className, | ||
var info = getEventInfo(e); | ||
onClick === null || onClick === void 0 ? void 0 : onClick(warnItemProp(info)); | ||
onClick === null || onClick === void 0 || onClick(warnItemProp(info)); | ||
onItemClick(info); | ||
}; | ||
var onInternalKeyDown = function onInternalKeyDown(e) { | ||
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e); | ||
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e); | ||
if (e.which === KeyCode.ENTER) { | ||
@@ -146,3 +145,3 @@ var info = getEventInfo(e); | ||
// Legacy. Key will also trigger click event | ||
onClick === null || onClick === void 0 ? void 0 : onClick(warnItemProp(info)); | ||
onClick === null || onClick === void 0 || onClick(warnItemProp(info)); | ||
onItemClick(info); | ||
@@ -158,3 +157,3 @@ } | ||
onActive(eventKey); | ||
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e); | ||
onFocus === null || onFocus === void 0 || onFocus(e); | ||
}; | ||
@@ -177,3 +176,3 @@ | ||
style: _objectSpread(_objectSpread({}, directionStyle), style), | ||
className: classNames(itemCls, (_classNames = {}, _defineProperty(_classNames, "".concat(itemCls, "-active"), active), _defineProperty(_classNames, "".concat(itemCls, "-selected"), selected), _defineProperty(_classNames, "".concat(itemCls, "-disabled"), mergedDisabled), _classNames), className), | ||
className: classNames(itemCls, _defineProperty(_defineProperty(_defineProperty({}, "".concat(itemCls, "-active"), active), "".concat(itemCls, "-selected"), selected), "".concat(itemCls, "-disabled"), mergedDisabled), className), | ||
onClick: onInternalClick, | ||
@@ -180,0 +179,0 @@ onKeyDown: onInternalKeyDown, |
@@ -11,3 +11,3 @@ import * as React from 'react'; | ||
} | ||
declare const MenuItemGroup: React.ForwardRefExoticComponent<Pick<MenuItemGroupProps, "children" | "style" | "className" | "title" | "eventKey" | "warnKey"> & React.RefAttributes<HTMLLIElement>>; | ||
declare const MenuItemGroup: React.ForwardRefExoticComponent<Omit<MenuItemGroupProps, "ref"> & React.RefAttributes<HTMLLIElement>>; | ||
export default MenuItemGroup; |
@@ -13,3 +13,3 @@ import * as React from 'react'; | ||
} | ||
declare const SubMenu: React.ForwardRefExoticComponent<Pick<SubMenuProps, "type" | "children" | "disabled" | "rootClassName" | "itemIcon" | "expandIcon" | "onMouseEnter" | "onMouseLeave" | "popupClassName" | "popupOffset" | "popupStyle" | "onClick" | "onTitleClick" | "onTitleMouseEnter" | "onTitleMouseLeave" | "style" | "className" | "title" | "internalPopupClose" | "eventKey" | "warnKey"> & React.RefAttributes<HTMLLIElement>>; | ||
declare const SubMenu: React.ForwardRefExoticComponent<Omit<SubMenuProps, "ref"> & React.RefAttributes<HTMLLIElement>>; | ||
export default SubMenu; |
@@ -26,3 +26,2 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
var InternalSubMenu = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _classNames; | ||
var style = props.style, | ||
@@ -105,3 +104,3 @@ className = props.className, | ||
triggerChildrenActive(true); | ||
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter({ | ||
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({ | ||
key: eventKey, | ||
@@ -113,3 +112,3 @@ domEvent: domEvent | ||
triggerChildrenActive(false); | ||
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({ | ||
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({ | ||
key: eventKey, | ||
@@ -139,3 +138,3 @@ domEvent: domEvent | ||
} | ||
onTitleClick === null || onTitleClick === void 0 ? void 0 : onTitleClick({ | ||
onTitleClick === null || onTitleClick === void 0 || onTitleClick({ | ||
key: eventKey, | ||
@@ -153,3 +152,3 @@ domEvent: e | ||
var onMergedItemClick = useMemoCallback(function (info) { | ||
onClick === null || onClick === void 0 ? void 0 : onClick(warnItemProp(info)); | ||
onClick === null || onClick === void 0 || onClick(warnItemProp(info)); | ||
onItemClick(info); | ||
@@ -241,3 +240,3 @@ }); | ||
style: style, | ||
className: classNames(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, (_classNames = {}, _defineProperty(_classNames, "".concat(subMenuPrefixCls, "-open"), open), _defineProperty(_classNames, "".concat(subMenuPrefixCls, "-active"), mergedActive), _defineProperty(_classNames, "".concat(subMenuPrefixCls, "-selected"), childrenSelected), _defineProperty(_classNames, "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled), _classNames)), | ||
className: classNames(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(subMenuPrefixCls, "-open"), open), "".concat(subMenuPrefixCls, "-active"), mergedActive), "".concat(subMenuPrefixCls, "-selected"), childrenSelected), "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled)), | ||
onMouseEnter: onInternalMouseEnter, | ||
@@ -244,0 +243,0 @@ onMouseLeave: onInternalMouseLeave |
import * as React from 'react'; | ||
import type { Components, ItemType } from '../interface'; | ||
export declare function parseItems(children: React.ReactNode | undefined, items: ItemType[] | undefined, keyPath: string[], components: Components): React.ReactElement<any, string | React.JSXElementConstructor<any>>[]; | ||
export declare function parseItems(children: React.ReactNode | undefined, items: ItemType[] | undefined, keyPath: string[], components: Components, prefixCls?: string): React.ReactElement<any, string | React.JSXElementConstructor<any>>[]; |
@@ -5,3 +5,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
var _excluded = ["label", "children", "key", "type"]; | ||
var _excluded = ["label", "children", "key", "type", "extra"]; | ||
import * as React from 'react'; | ||
@@ -13,3 +13,3 @@ import Divider from "../Divider"; | ||
import { parseChildren } from "./commonUtil"; | ||
function convertItemsToNodes(list, components) { | ||
function convertItemsToNodes(list, components, prefixCls) { | ||
var MergedMenuItem = components.item, | ||
@@ -26,2 +26,3 @@ MergedMenuItemGroup = components.group, | ||
type = _ref.type, | ||
extra = _ref.extra, | ||
restProps = _objectWithoutProperties(_ref, _excluded); | ||
@@ -57,3 +58,5 @@ var mergedKey = key !== null && key !== void 0 ? key : "tmp-".concat(index); | ||
key: mergedKey | ||
}, restProps), label); | ||
}, restProps), label, (!!extra || extra === 0) && /*#__PURE__*/React.createElement("span", { | ||
className: "".concat(prefixCls, "-extra") | ||
}, extra)); | ||
} | ||
@@ -65,3 +68,3 @@ return null; | ||
} | ||
export function parseItems(children, items, keyPath, components) { | ||
export function parseItems(children, items, keyPath, components, prefixCls) { | ||
var childNodes = children; | ||
@@ -75,5 +78,5 @@ var mergedComponents = _objectSpread({ | ||
if (items) { | ||
childNodes = convertItemsToNodes(items, mergedComponents); | ||
childNodes = convertItemsToNodes(items, mergedComponents, prefixCls); | ||
} | ||
return parseChildren(childNodes, keyPath); | ||
} |
@@ -11,6 +11,5 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var IdContext = /*#__PURE__*/React.createContext(null); | ||
exports.IdContext = IdContext; | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var IdContext = exports.IdContext = /*#__PURE__*/React.createContext(null); | ||
function getMenuId(uuid, eventKey) { | ||
@@ -17,0 +16,0 @@ if (uuid === undefined) { |
@@ -16,6 +16,5 @@ "use strict"; | ||
var _excluded = ["children", "locked"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var MenuContext = /*#__PURE__*/React.createContext(null); | ||
exports.MenuContext = MenuContext; | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var MenuContext = exports.MenuContext = /*#__PURE__*/React.createContext(null); | ||
function mergeProps(origin, target) { | ||
@@ -22,0 +21,0 @@ var clone = (0, _objectSpread2.default)({}, origin); |
@@ -13,4 +13,4 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var EmptyList = []; | ||
@@ -20,4 +20,3 @@ | ||
var PathRegisterContext = /*#__PURE__*/React.createContext(null); | ||
exports.PathRegisterContext = PathRegisterContext; | ||
var PathRegisterContext = exports.PathRegisterContext = /*#__PURE__*/React.createContext(null); | ||
function useMeasure() { | ||
@@ -28,4 +27,3 @@ return React.useContext(PathRegisterContext); | ||
// ========================= Path Tracker ========================== | ||
var PathTrackerContext = /*#__PURE__*/React.createContext(EmptyList); | ||
exports.PathTrackerContext = PathTrackerContext; | ||
var PathTrackerContext = exports.PathTrackerContext = /*#__PURE__*/React.createContext(EmptyList); | ||
function useFullPath(eventKey) { | ||
@@ -40,3 +38,2 @@ var parentKeyPath = React.useContext(PathTrackerContext); | ||
var PathUserContext = /*#__PURE__*/React.createContext(null); | ||
exports.PathUserContext = PathUserContext; | ||
var PathUserContext = exports.PathUserContext = /*#__PURE__*/React.createContext(null); |
@@ -9,6 +9,5 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var PrivateContext = /*#__PURE__*/React.createContext({}); | ||
var _default = PrivateContext; | ||
exports.default = _default; | ||
var _default = exports.default = PrivateContext; |
@@ -13,4 +13,4 @@ "use strict"; | ||
var _PathContext = require("./context/PathContext"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function Divider(_ref) { | ||
@@ -17,0 +17,0 @@ var className = _ref.className, |
@@ -17,4 +17,4 @@ "use strict"; | ||
var _IdContext = require("../context/IdContext"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
// destruct to reduce minify size | ||
@@ -31,3 +31,3 @@ var LEFT = _KeyCode.default.LEFT, | ||
function getOffset(mode, isRootLevel, isRtl, which) { | ||
var _inline, _horizontal, _vertical, _offsets; | ||
var _offsets; | ||
var prev = 'prev'; | ||
@@ -44,5 +44,5 @@ var next = 'next'; | ||
} | ||
var inline = (_inline = {}, (0, _defineProperty2.default)(_inline, UP, prev), (0, _defineProperty2.default)(_inline, DOWN, next), _inline); | ||
var horizontal = (_horizontal = {}, (0, _defineProperty2.default)(_horizontal, LEFT, isRtl ? next : prev), (0, _defineProperty2.default)(_horizontal, RIGHT, isRtl ? prev : next), (0, _defineProperty2.default)(_horizontal, DOWN, children), (0, _defineProperty2.default)(_horizontal, ENTER, children), _horizontal); | ||
var vertical = (_vertical = {}, (0, _defineProperty2.default)(_vertical, UP, prev), (0, _defineProperty2.default)(_vertical, DOWN, next), (0, _defineProperty2.default)(_vertical, ENTER, children), (0, _defineProperty2.default)(_vertical, ESC, parent), (0, _defineProperty2.default)(_vertical, LEFT, isRtl ? children : parent), (0, _defineProperty2.default)(_vertical, RIGHT, isRtl ? parent : children), _vertical); | ||
var inline = (0, _defineProperty2.default)((0, _defineProperty2.default)({}, UP, prev), DOWN, next); | ||
var horizontal = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, LEFT, isRtl ? next : prev), RIGHT, isRtl ? prev : next), DOWN, children), ENTER, children); | ||
var vertical = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, UP, prev), DOWN, next), ENTER, children), ESC, parent), LEFT, isRtl ? children : parent), RIGHT, isRtl ? parent : children); | ||
var offsets = { | ||
@@ -148,3 +148,3 @@ inline: inline, | ||
} | ||
var refreshElements = function refreshElements(keys, id) { | ||
var refreshElements = exports.refreshElements = function refreshElements(keys, id) { | ||
var elements = new Set(); | ||
@@ -167,3 +167,2 @@ var key2element = new Map(); | ||
}; | ||
exports.refreshElements = refreshElements; | ||
function useAccessibility(mode, activeKey, isRtl, id, containerRef, getKeys, getKeyPath, triggerActiveKey, triggerAccessibilityOpen, originOnKeyDown) { | ||
@@ -286,4 +285,4 @@ var rafRef = React.useRef(); | ||
// Pass origin key down event | ||
originOnKeyDown === null || originOnKeyDown === void 0 ? void 0 : originOnKeyDown(e); | ||
originOnKeyDown === null || originOnKeyDown === void 0 || originOnKeyDown(e); | ||
}; | ||
} |
@@ -10,4 +10,4 @@ "use strict"; | ||
var _MenuContext = require("../context/MenuContext"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function useActive(eventKey, disabled, onMouseEnter, onMouseLeave) { | ||
@@ -25,3 +25,3 @@ var _React$useContext = React.useContext(_MenuContext.MenuContext), | ||
ret.onMouseEnter = function (domEvent) { | ||
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter({ | ||
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({ | ||
key: eventKey, | ||
@@ -33,3 +33,3 @@ domEvent: domEvent | ||
ret.onMouseLeave = function (domEvent) { | ||
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({ | ||
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({ | ||
key: eventKey, | ||
@@ -36,0 +36,0 @@ domEvent: domEvent |
@@ -10,4 +10,4 @@ "use strict"; | ||
var _MenuContext = require("../context/MenuContext"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function useDirectionStyle(level) { | ||
@@ -14,0 +14,0 @@ var _React$useContext = React.useContext(_MenuContext.MenuContext), |
@@ -12,7 +12,8 @@ "use strict"; | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var React = _react; | ||
var _warning = _interopRequireDefault(require("rc-util/lib/warning")); | ||
var _timeUtil = require("../utils/timeUtil"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var PATH_SPLIT = '__RC_UTIL_PATH_SPLIT__'; | ||
@@ -25,4 +26,3 @@ var getPathStr = function getPathStr(keyPath) { | ||
}; | ||
var OVERFLOW_KEY = 'rc-menu-more'; | ||
exports.OVERFLOW_KEY = OVERFLOW_KEY; | ||
var OVERFLOW_KEY = exports.OVERFLOW_KEY = 'rc-menu-more'; | ||
function useKeyRecords() { | ||
@@ -32,4 +32,4 @@ var _React$useState = React.useState({}), | ||
internalForceUpdate = _React$useState2[1]; | ||
var key2pathRef = (0, React.useRef)(new Map()); | ||
var path2keyRef = (0, React.useRef)(new Map()); | ||
var key2pathRef = (0, _react.useRef)(new Map()); | ||
var path2keyRef = (0, _react.useRef)(new Map()); | ||
var _React$useState3 = React.useState([]), | ||
@@ -39,4 +39,4 @@ _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2), | ||
setOverflowKeys = _React$useState4[1]; | ||
var updateRef = (0, React.useRef)(0); | ||
var destroyRef = (0, React.useRef)(false); | ||
var updateRef = (0, _react.useRef)(0); | ||
var destroyRef = (0, _react.useRef)(false); | ||
var forceUpdate = function forceUpdate() { | ||
@@ -47,3 +47,3 @@ if (!destroyRef.current) { | ||
}; | ||
var registerPath = (0, React.useCallback)(function (key, keyPath) { | ||
var registerPath = (0, _react.useCallback)(function (key, keyPath) { | ||
// Warning for invalidate or duplicated `key` | ||
@@ -66,3 +66,3 @@ if (process.env.NODE_ENV !== 'production') { | ||
}, []); | ||
var unregisterPath = (0, React.useCallback)(function (key, keyPath) { | ||
var unregisterPath = (0, _react.useCallback)(function (key, keyPath) { | ||
var connectedPath = getPathStr(keyPath); | ||
@@ -72,6 +72,6 @@ path2keyRef.current.delete(connectedPath); | ||
}, []); | ||
var refreshOverflowKeys = (0, React.useCallback)(function (keys) { | ||
var refreshOverflowKeys = (0, _react.useCallback)(function (keys) { | ||
setOverflowKeys(keys); | ||
}, []); | ||
var getKeyPath = (0, React.useCallback)(function (eventKey, includeOverflow) { | ||
var getKeyPath = (0, _react.useCallback)(function (eventKey, includeOverflow) { | ||
var fullPath = key2pathRef.current.get(eventKey) || ''; | ||
@@ -84,3 +84,3 @@ var keys = getPathKeys(fullPath); | ||
}, [overflowKeys]); | ||
var isSubPathKey = (0, React.useCallback)(function (pathKeys, eventKey) { | ||
var isSubPathKey = (0, _react.useCallback)(function (pathKeys, eventKey) { | ||
return pathKeys.filter(function (item) { | ||
@@ -104,3 +104,3 @@ return item !== undefined; | ||
*/ | ||
var getSubPathKeys = (0, React.useCallback)(function (key) { | ||
var getSubPathKeys = (0, _react.useCallback)(function (key) { | ||
var connectedPath = "".concat(key2pathRef.current.get(key)).concat(PATH_SPLIT); | ||
@@ -107,0 +107,0 @@ var pathKeys = new Set(); |
@@ -9,4 +9,4 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
/** | ||
@@ -13,0 +13,0 @@ * Cache callback function that always return same ref instead. |
@@ -12,4 +12,4 @@ "use strict"; | ||
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var uniquePrefix = Math.random().toFixed(5).toString().slice(2); | ||
@@ -16,0 +16,0 @@ var internalId = 0; |
@@ -11,4 +11,4 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function Icon(_ref) { | ||
@@ -15,0 +15,0 @@ var icon = _ref.icon, |
@@ -61,3 +61,2 @@ "use strict"; | ||
ExportMenu.Divider = _Divider.default; | ||
var _default = ExportMenu; | ||
exports.default = _default; | ||
var _default = exports.default = ExportMenu; |
@@ -31,2 +31,3 @@ import type * as React from 'react'; | ||
itemIcon?: RenderIconType; | ||
extra?: React.ReactNode; | ||
key: React.Key; | ||
@@ -33,0 +34,0 @@ onMouseEnter?: MenuHoverEventHandler; |
@@ -20,3 +20,4 @@ "use strict"; | ||
var _warning = _interopRequireDefault(require("rc-util/lib/warning")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var React = _react; | ||
var _reactDom = require("react-dom"); | ||
@@ -36,4 +37,4 @@ var _IdContext = require("./context/IdContext"); | ||
var _excluded = ["prefixCls", "rootClassName", "style", "className", "tabIndex", "items", "children", "direction", "id", "mode", "inlineCollapsed", "disabled", "disabledOverflow", "subMenuOpenDelay", "subMenuCloseDelay", "forceSubMenuRender", "defaultOpenKeys", "openKeys", "activeKey", "defaultActiveFirst", "selectable", "multiple", "defaultSelectedKeys", "selectedKeys", "onSelect", "onDeselect", "inlineIndent", "motion", "defaultMotions", "triggerSubMenuAction", "builtinPlacements", "itemIcon", "expandIcon", "overflowedIndicator", "overflowedIndicatorPopupClassName", "getPopupContainer", "onClick", "onOpenChange", "onKeyDown", "openAnimation", "openTransitionName", "_internalRenderMenuItem", "_internalRenderSubMenuItem", "_internalComponents"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
/** | ||
@@ -50,6 +51,8 @@ * Menu modify after refactor: | ||
* - collapsedWidth: Seems this logic should be handle by antd Layout.Sider | ||
*/ // optimize for render | ||
*/ | ||
// optimize for render | ||
var EMPTY_LIST = []; | ||
var Menu = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _childList$, _classNames; | ||
var _childList$; | ||
var _ref = props, | ||
@@ -112,3 +115,3 @@ _ref$prefixCls = _ref.prefixCls, | ||
var _React$useMemo = React.useMemo(function () { | ||
return [(0, _nodeUtil.parseItems)(children, items, EMPTY_LIST, _internalComponents), (0, _nodeUtil.parseItems)(children, items, EMPTY_LIST, {})]; | ||
return [(0, _nodeUtil.parseItems)(children, items, EMPTY_LIST, _internalComponents, prefixCls), (0, _nodeUtil.parseItems)(children, items, EMPTY_LIST, {}, prefixCls)]; | ||
}, [children, items, _internalComponents]), | ||
@@ -148,3 +151,3 @@ _React$useMemo2 = (0, _slicedToArray2.default)(_React$useMemo, 2), | ||
setMergedOpenKeys(keys); | ||
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(keys); | ||
onOpenChange === null || onOpenChange === void 0 || onOpenChange(keys); | ||
} | ||
@@ -258,3 +261,3 @@ if (forceFlush) { | ||
}); | ||
(0, React.useImperativeHandle)(ref, function () { | ||
(0, _react.useImperativeHandle)(ref, function () { | ||
return { | ||
@@ -276,3 +279,3 @@ list: containerRef.current, | ||
var _elementToFocus$focus; | ||
elementToFocus === null || elementToFocus === void 0 ? void 0 : (_elementToFocus$focus = elementToFocus.focus) === null || _elementToFocus$focus === void 0 ? void 0 : _elementToFocus$focus.call(elementToFocus, options); | ||
elementToFocus === null || elementToFocus === void 0 || (_elementToFocus$focus = elementToFocus.focus) === null || _elementToFocus$focus === void 0 || _elementToFocus$focus.call(elementToFocus, options); | ||
} | ||
@@ -327,5 +330,5 @@ } | ||
if (exist) { | ||
onDeselect === null || onDeselect === void 0 ? void 0 : onDeselect(selectInfo); | ||
onDeselect === null || onDeselect === void 0 || onDeselect(selectInfo); | ||
} else { | ||
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectInfo); | ||
onSelect === null || onSelect === void 0 || onSelect(selectInfo); | ||
} | ||
@@ -345,3 +348,3 @@ } | ||
var onInternalClick = (0, _useMemoCallback.default)(function (info) { | ||
onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); | ||
onClick === null || onClick === void 0 || onClick((0, _warnUtil.warnItemProp)(info)); | ||
triggerSelection(info); | ||
@@ -410,3 +413,3 @@ }); | ||
itemComponent: _MenuItem.default, | ||
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), | ||
className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(internalMode), className, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-inline-collapsed"), internalInlineCollapsed), "".concat(prefixCls, "-rtl"), isRtl), rootClassName), | ||
dir: direction, | ||
@@ -497,3 +500,2 @@ style: style, | ||
}); | ||
var _default = Menu; | ||
exports.default = _default; | ||
var _default = exports.default = Menu; |
@@ -36,4 +36,4 @@ "use strict"; | ||
_excluded3 = ["active"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
// Since Menu event provide the `info.item` which point to the MenuItem node instance. | ||
@@ -77,3 +77,2 @@ // We have to use class component here. | ||
var InternalMenuItem = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _classNames; | ||
var style = props.style, | ||
@@ -147,7 +146,7 @@ className = props.className, | ||
var info = getEventInfo(e); | ||
onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); | ||
onClick === null || onClick === void 0 || onClick((0, _warnUtil.warnItemProp)(info)); | ||
onItemClick(info); | ||
}; | ||
var onInternalKeyDown = function onInternalKeyDown(e) { | ||
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e); | ||
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e); | ||
if (e.which === _KeyCode.default.ENTER) { | ||
@@ -157,3 +156,3 @@ var info = getEventInfo(e); | ||
// Legacy. Key will also trigger click event | ||
onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); | ||
onClick === null || onClick === void 0 || onClick((0, _warnUtil.warnItemProp)(info)); | ||
onItemClick(info); | ||
@@ -169,3 +168,3 @@ } | ||
onActive(eventKey); | ||
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e); | ||
onFocus === null || onFocus === void 0 || onFocus(e); | ||
}; | ||
@@ -188,3 +187,3 @@ | ||
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, directionStyle), style), | ||
className: (0, _classnames.default)(itemCls, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-active"), active), (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-selected"), selected), (0, _defineProperty2.default)(_classNames, "".concat(itemCls, "-disabled"), mergedDisabled), _classNames), className), | ||
className: (0, _classnames.default)(itemCls, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(itemCls, "-active"), active), "".concat(itemCls, "-selected"), selected), "".concat(itemCls, "-disabled"), mergedDisabled), className), | ||
onClick: onInternalClick, | ||
@@ -231,3 +230,2 @@ onKeyDown: onInternalKeyDown, | ||
} | ||
var _default = /*#__PURE__*/React.forwardRef(MenuItem); | ||
exports.default = _default; | ||
var _default = exports.default = /*#__PURE__*/React.forwardRef(MenuItem); |
@@ -11,3 +11,3 @@ import * as React from 'react'; | ||
} | ||
declare const MenuItemGroup: React.ForwardRefExoticComponent<Pick<MenuItemGroupProps, "children" | "style" | "className" | "title" | "eventKey" | "warnKey"> & React.RefAttributes<HTMLLIElement>>; | ||
declare const MenuItemGroup: React.ForwardRefExoticComponent<Omit<MenuItemGroupProps, "ref"> & React.RefAttributes<HTMLLIElement>>; | ||
export default MenuItemGroup; |
@@ -18,4 +18,4 @@ "use strict"; | ||
var _excluded = ["className", "title", "eventKey", "children"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var InternalMenuItemGroup = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
@@ -63,3 +63,2 @@ var className = props.className, | ||
} | ||
var _default = MenuItemGroup; | ||
exports.default = _default; | ||
var _default = exports.default = MenuItemGroup; |
@@ -11,3 +11,3 @@ "use strict"; | ||
}; | ||
var placements = { | ||
var placements = exports.placements = { | ||
topLeft: { | ||
@@ -46,4 +46,3 @@ points: ['bl', 'tl'], | ||
}; | ||
exports.placements = placements; | ||
var placementsRtl = { | ||
var placementsRtl = exports.placementsRtl = { | ||
topLeft: { | ||
@@ -82,4 +81,2 @@ points: ['bl', 'tl'], | ||
}; | ||
exports.placementsRtl = placementsRtl; | ||
var _default = placements; | ||
exports.default = _default; | ||
var _default = exports.default = placements; |
@@ -13,3 +13,3 @@ import * as React from 'react'; | ||
} | ||
declare const SubMenu: React.ForwardRefExoticComponent<Pick<SubMenuProps, "type" | "children" | "disabled" | "rootClassName" | "itemIcon" | "expandIcon" | "onMouseEnter" | "onMouseLeave" | "popupClassName" | "popupOffset" | "popupStyle" | "onClick" | "onTitleClick" | "onTitleMouseEnter" | "onTitleMouseLeave" | "style" | "className" | "title" | "internalPopupClose" | "eventKey" | "warnKey"> & React.RefAttributes<HTMLLIElement>>; | ||
declare const SubMenu: React.ForwardRefExoticComponent<Omit<SubMenuProps, "ref"> & React.RefAttributes<HTMLLIElement>>; | ||
export default SubMenu; |
@@ -33,6 +33,5 @@ "use strict"; | ||
_excluded2 = ["active"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var InternalSubMenu = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var _classNames; | ||
var style = props.style, | ||
@@ -115,3 +114,3 @@ className = props.className, | ||
triggerChildrenActive(true); | ||
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter({ | ||
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({ | ||
key: eventKey, | ||
@@ -123,3 +122,3 @@ domEvent: domEvent | ||
triggerChildrenActive(false); | ||
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({ | ||
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({ | ||
key: eventKey, | ||
@@ -149,3 +148,3 @@ domEvent: domEvent | ||
} | ||
onTitleClick === null || onTitleClick === void 0 ? void 0 : onTitleClick({ | ||
onTitleClick === null || onTitleClick === void 0 || onTitleClick({ | ||
key: eventKey, | ||
@@ -163,3 +162,3 @@ domEvent: e | ||
var onMergedItemClick = (0, _useMemoCallback.default)(function (info) { | ||
onClick === null || onClick === void 0 ? void 0 : onClick((0, _warnUtil.warnItemProp)(info)); | ||
onClick === null || onClick === void 0 || onClick((0, _warnUtil.warnItemProp)(info)); | ||
onItemClick(info); | ||
@@ -251,3 +250,3 @@ }); | ||
style: style, | ||
className: (0, _classnames.default)(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-open"), open), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-active"), mergedActive), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-selected"), childrenSelected), (0, _defineProperty2.default)(_classNames, "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled), _classNames)), | ||
className: (0, _classnames.default)(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(subMenuPrefixCls, "-open"), open), "".concat(subMenuPrefixCls, "-active"), mergedActive), "".concat(subMenuPrefixCls, "-selected"), childrenSelected), "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled)), | ||
onMouseEnter: onInternalMouseEnter, | ||
@@ -312,3 +311,2 @@ onMouseLeave: onInternalMouseLeave | ||
} | ||
var _default = SubMenu; | ||
exports.default = _default; | ||
var _default = exports.default = SubMenu; |
@@ -17,4 +17,4 @@ "use strict"; | ||
var _SubMenuList = _interopRequireDefault(require("./SubMenuList")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function InlineSubMenuList(_ref) { | ||
@@ -21,0 +21,0 @@ var id = _ref.id, |
@@ -19,4 +19,4 @@ "use strict"; | ||
var _motionUtil = require("../utils/motionUtil"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var popupPlacementMap = { | ||
@@ -23,0 +23,0 @@ horizontal: 'bottomLeft', |
@@ -15,4 +15,4 @@ "use strict"; | ||
var _excluded = ["className", "children"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var InternalSubMenuList = function InternalSubMenuList(_ref, ref) { | ||
@@ -36,3 +36,2 @@ var className = _ref.className, | ||
SubMenuList.displayName = 'SubMenuList'; | ||
var _default = SubMenuList; | ||
exports.default = _default; | ||
var _default = exports.default = SubMenuList; |
@@ -12,4 +12,4 @@ "use strict"; | ||
var React = _interopRequireWildcard(require("react")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function parseChildren(children, keyPath) { | ||
@@ -16,0 +16,0 @@ return (0, _toArray.default)(children).map(function (child, index) { |
import * as React from 'react'; | ||
import type { Components, ItemType } from '../interface'; | ||
export declare function parseItems(children: React.ReactNode | undefined, items: ItemType[] | undefined, keyPath: string[], components: Components): React.ReactElement<any, string | React.JSXElementConstructor<any>>[]; | ||
export declare function parseItems(children: React.ReactNode | undefined, items: ItemType[] | undefined, keyPath: string[], components: Components, prefixCls?: string): React.ReactElement<any, string | React.JSXElementConstructor<any>>[]; |
@@ -19,6 +19,6 @@ "use strict"; | ||
var _commonUtil = require("./commonUtil"); | ||
var _excluded = ["label", "children", "key", "type"]; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function convertItemsToNodes(list, components) { | ||
var _excluded = ["label", "children", "key", "type", "extra"]; | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
function convertItemsToNodes(list, components, prefixCls) { | ||
var MergedMenuItem = components.item, | ||
@@ -35,2 +35,3 @@ MergedMenuItemGroup = components.group, | ||
type = _ref.type, | ||
extra = _ref.extra, | ||
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded); | ||
@@ -66,3 +67,5 @@ var mergedKey = key !== null && key !== void 0 ? key : "tmp-".concat(index); | ||
key: mergedKey | ||
}, restProps), label); | ||
}, restProps), label, (!!extra || extra === 0) && /*#__PURE__*/React.createElement("span", { | ||
className: "".concat(prefixCls, "-extra") | ||
}, extra)); | ||
} | ||
@@ -74,3 +77,3 @@ return null; | ||
} | ||
function parseItems(children, items, keyPath, components) { | ||
function parseItems(children, items, keyPath, components, prefixCls) { | ||
var childNodes = children; | ||
@@ -84,5 +87,5 @@ var mergedComponents = (0, _objectSpread2.default)({ | ||
if (items) { | ||
childNodes = convertItemsToNodes(items, mergedComponents); | ||
childNodes = convertItemsToNodes(items, mergedComponents, prefixCls); | ||
} | ||
return (0, _commonUtil.parseChildren)(childNodes, keyPath); | ||
} |
{ | ||
"name": "rc-menu", | ||
"version": "9.14.1", | ||
"version": "9.15.0", | ||
"description": "menu ui component for react", | ||
@@ -58,2 +58,3 @@ "keywords": [ | ||
"@types/jest": "^29.5.2", | ||
"@types/node": "^22.3.0", | ||
"@types/react": "^18.2.14", | ||
@@ -60,0 +61,0 @@ "@types/react-dom": "^18.2.6", |
@@ -265,2 +265,8 @@ # rc-menu | ||
<tr> | ||
<td>extra</td> | ||
<td>React.ReactNode</td> | ||
<th></th> | ||
<td>Specify menu item extra node.</td> | ||
</tr> | ||
<tr> | ||
<td>key</td> | ||
@@ -267,0 +273,0 @@ <td>Object</td> |
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
255817
114
5469
470
22