var _excluded = ["className", "style", "mode", "theme", "defaultOpenKeys", "defaultSelectedKeys", "inlineCollapsed", "openKeys", "selectedKeys", "onOpenChange", "onSelect", "dataSource", "__designMode", "children", "other"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import { Menu as AntdMenu } from 'antd';
import React, { useMemo } from 'react';
import "./PisellMenu.less";
var PisellMenu = function PisellMenu(_ref) {
  var className = _ref.className,
    style = _ref.style,
    _ref$mode = _ref.mode,
    mode = _ref$mode === void 0 ? 'vertical' : _ref$mode,
    _ref$theme = _ref.theme,
    theme = _ref$theme === void 0 ? 'light' : _ref$theme,
    defaultOpenKeys = _ref.defaultOpenKeys,
    defaultSelectedKeys = _ref.defaultSelectedKeys,
    inlineCollapsed = _ref.inlineCollapsed,
    openKeys = _ref.openKeys,
    selectedKeys = _ref.selectedKeys,
    onOpenChange = _ref.onOpenChange,
    onSelect = _ref.onSelect,
    dataSource = _ref.dataSource,
    __designMode = _ref.__designMode,
    children = _ref.children,
    other = _ref.other,
    restProps = _objectWithoutProperties(_ref, _excluded);
  var _dataSource = useMemo(function () {
    if (Array.isArray(dataSource)) {
      return dataSource;
    }
    if (__designMode === 'design') {
      return [{
        label: '菜单项1',
        key: 'item-1',
        path: '/item-1'
      }, {
        label: '菜单项2',
        key: 'item-2',
        path: '/item-2'
      }];
    }
    return [];
  }, [dataSource]);
  return /*#__PURE__*/React.createElement(AntdMenu, _extends({
    className: "pisell-menu ".concat(className || ''),
    style: style,
    items: _dataSource,
    mode: mode,
    theme: theme,
    defaultOpenKeys: defaultOpenKeys,
    defaultSelectedKeys: defaultSelectedKeys,
    inlineCollapsed: inlineCollapsed,
    openKeys: openKeys,
    selectedKeys: selectedKeys,
    onOpenChange: onOpenChange,
    onSelect: onSelect
  }, restProps, other), children);
};
PisellMenu.Item = AntdMenu.Item;
PisellMenu.SubMenu = AntdMenu.SubMenu;
PisellMenu.ItemGroup = AntdMenu.ItemGroup;
export default PisellMenu;