1 line
24 KiB
JSON
1 line
24 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport { forwardRef } from 'react';\nimport EllipsisOutlined from \"@ant-design/icons/es/icons/EllipsisOutlined\";\nimport classNames from 'classnames';\nimport RcMenu from 'rc-menu';\nimport { useEvent } from 'rc-util';\nimport omit from \"rc-util/es/omit\";\nimport initCollapseMotion from '../_util/motion';\nimport { cloneElement } from '../_util/reactNode';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport MenuContext from './MenuContext';\nimport Divider from './MenuDivider';\nimport MenuItem from './MenuItem';\nimport OverrideContext from './OverrideContext';\nimport useStyle from './style';\nimport SubMenu from './SubMenu';\nfunction isEmptyIcon(icon) {\n return icon === null || icon === false;\n}\nconst MENU_COMPONENTS = {\n item: MenuItem,\n submenu: SubMenu,\n divider: Divider\n};\nconst InternalMenu = /*#__PURE__*/forwardRef((props, ref) => {\n var _a;\n const override = React.useContext(OverrideContext);\n const overrideObj = override || {};\n const {\n getPrefixCls,\n getPopupContainer,\n direction,\n menu\n } = React.useContext(ConfigContext);\n const rootPrefixCls = getPrefixCls();\n const {\n prefixCls: customizePrefixCls,\n className,\n style,\n theme = 'light',\n expandIcon,\n _internalDisableMenuItemTitleTooltip,\n inlineCollapsed,\n siderCollapsed,\n rootClassName,\n mode,\n selectable,\n onClick,\n overflowedIndicatorPopupClassName\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"className\", \"style\", \"theme\", \"expandIcon\", \"_internalDisableMenuItemTitleTooltip\", \"inlineCollapsed\", \"siderCollapsed\", \"rootClassName\", \"mode\", \"selectable\", \"onClick\", \"overflowedIndicatorPopupClassName\"]);\n const passedProps = omit(restProps, ['collapsedWidth']);\n // ======================== Warning ==========================\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Menu');\n process.env.NODE_ENV !== \"production\" ? warning(!('inlineCollapsed' in props && mode !== 'inline'), 'usage', '`inlineCollapsed` should only be used when `mode` is inline.') : void 0;\n process.env.NODE_ENV !== \"production\" ? warning(!(props.siderCollapsed !== undefined && 'inlineCollapsed' in props), 'usage', '`inlineCollapsed` not control Menu under Sider. Should set `collapsed` on Sider instead.') : void 0;\n warning.deprecated('items' in props && !props.children, 'children', 'items');\n }\n (_a = overrideObj.validator) === null || _a === void 0 ? void 0 : _a.call(overrideObj, {\n mode\n });\n // ========================== Click ==========================\n // Tell dropdown that item clicked\n const onItemClick = useEvent(function () {\n var _a;\n onClick === null || onClick === void 0 ? void 0 : onClick.apply(void 0, arguments);\n (_a = overrideObj.onClick) === null || _a === void 0 ? void 0 : _a.call(overrideObj);\n });\n // ========================== Mode ===========================\n const mergedMode = overrideObj.mode || mode;\n // ======================= Selectable ========================\n const mergedSelectable = selectable !== null && selectable !== void 0 ? selectable : overrideObj.selectable;\n // ======================== Collapsed ========================\n // Inline Collapsed\n const mergedInlineCollapsed = React.useMemo(() => {\n if (siderCollapsed !== undefined) {\n return siderCol
|