sk-antd
Version:
ShaneKing for AntD
69 lines (53 loc) • 3.56 kB
JavaScript
import "antd/es/menu/style";
import _Menu from "antd/es/menu";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
import PropTypes from 'prop-types';
import { SK } from 'sk-js';
import OriginMenu from './OriginMenu';
import AntdComp from '../AntdComp';
var Item = _Menu.Item;
Item.defaultProps = SK.extends(true, {}, {
disabled: false
}, OriginMenu.defaultProps, Item.defaultProps, {});
Item.propTypes = SK.extends(true, {
//https://github.com/react-component/menu/blob/master/src/MenuItem.jsx#L21
onItemHover: PropTypes.func
}, {
//https://ant.design/components/menu-cn/#Menu.Item
disabled: PropTypes.bool,
//key: PropTypes.string,//Warning: SKMenuItem: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)
//https://github.com/react-component/menu#menuitem-props
eventKey: PropTypes.string,
onMouseEnter: PropTypes.func,
onMouseLeave: PropTypes.func
}, OriginMenu.propTypes, Item.propTypes, {});
Item.NON_SK_COMP_NAME = 'MenuItem';
var SKMenuItem =
/*#__PURE__*/
function (_AntdComp) {
_inherits(SKMenuItem, _AntdComp);
function SKMenuItem() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, SKMenuItem);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SKMenuItem)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this.SK_COMP_NAME = SKMenuItem.SK_COMP_NAME;
return _this;
}
return SKMenuItem;
}(AntdComp);
SKMenuItem.SK_COMP_NAME = 'SKMenuItem';
SKMenuItem.defaultProps = SK.extends(true, {}, AntdComp.defaultProps, Item.defaultProps, {
compTag: _Menu.Item
});
SKMenuItem.propTypes = SK.extends(true, {}, AntdComp.propTypes, Item.propTypes, {});
export { SKMenuItem as default };