Latest updates from IceHrmPro
This commit is contained in:
39
web/node_modules/rc-menu/es/DOMWrap.d.ts
generated
vendored
Normal file
39
web/node_modules/rc-menu/es/DOMWrap.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import React from 'react';
|
||||
import { MenuMode } from './interface';
|
||||
interface DOMWrapProps {
|
||||
className?: string;
|
||||
children?: React.ReactElement[];
|
||||
mode?: MenuMode;
|
||||
prefixCls?: string;
|
||||
level?: number;
|
||||
theme?: string;
|
||||
overflowedIndicator?: React.ReactNode;
|
||||
visible?: boolean;
|
||||
tag?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
interface DOMWrapState {
|
||||
lastVisibleIndex: number;
|
||||
}
|
||||
declare class DOMWrap extends React.Component<DOMWrapProps, DOMWrapState> {
|
||||
static defaultProps: {
|
||||
tag: string;
|
||||
className: string;
|
||||
};
|
||||
overflowedIndicatorWidth: number;
|
||||
resizeObserver: any;
|
||||
mutationObserver: any;
|
||||
originalTotalWidth: number;
|
||||
overflowedItems: React.ReactElement[];
|
||||
menuItemSizes: number[];
|
||||
state: DOMWrapState;
|
||||
componentDidMount(): void;
|
||||
componentWillUnmount(): void;
|
||||
getMenuItemNodes: () => HTMLElement[];
|
||||
getOverflowedSubMenuItem: (keyPrefix: string, overflowedItems: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>[], renderPlaceholder?: boolean) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
|
||||
setChildrenWidthAndResize: () => void;
|
||||
handleResize: () => void;
|
||||
renderChildren(children: React.ReactElement[]): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>[];
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default DOMWrap;
|
||||
370
web/node_modules/rc-menu/es/DOMWrap.js
generated
vendored
Normal file
370
web/node_modules/rc-menu/es/DOMWrap.js
generated
vendored
Normal file
@@ -0,0 +1,370 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; 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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
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; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
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 React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ResizeObserver from 'resize-observer-polyfill';
|
||||
import SubMenu from './SubMenu';
|
||||
import { getWidth, setStyle, menuAllProps } from './util';
|
||||
var MENUITEM_OVERFLOWED_CLASSNAME = 'menuitem-overflowed';
|
||||
var FLOAT_PRECISION_ADJUST = 0.5;
|
||||
|
||||
var DOMWrap = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(DOMWrap, _React$Component);
|
||||
|
||||
var _super = _createSuper(DOMWrap);
|
||||
|
||||
function DOMWrap() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, DOMWrap);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
_this.resizeObserver = null;
|
||||
_this.mutationObserver = null; // original scroll size of the list
|
||||
|
||||
_this.originalTotalWidth = 0; // copy of overflowed items
|
||||
|
||||
_this.overflowedItems = []; // cache item of the original items (so we can track the size and order)
|
||||
|
||||
_this.menuItemSizes = [];
|
||||
_this.state = {
|
||||
lastVisibleIndex: undefined
|
||||
}; // get all valid menuItem nodes
|
||||
|
||||
_this.getMenuItemNodes = function () {
|
||||
var prefixCls = _this.props.prefixCls;
|
||||
var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
||||
|
||||
if (!ul) {
|
||||
return [];
|
||||
} // filter out all overflowed indicator placeholder
|
||||
|
||||
|
||||
return [].slice.call(ul.children).filter(function (node) {
|
||||
return node.className.split(' ').indexOf("".concat(prefixCls, "-overflowed-submenu")) < 0;
|
||||
});
|
||||
};
|
||||
|
||||
_this.getOverflowedSubMenuItem = function (keyPrefix, overflowedItems, renderPlaceholder) {
|
||||
var _this$props = _this.props,
|
||||
overflowedIndicator = _this$props.overflowedIndicator,
|
||||
level = _this$props.level,
|
||||
mode = _this$props.mode,
|
||||
prefixCls = _this$props.prefixCls,
|
||||
theme = _this$props.theme;
|
||||
|
||||
if (level !== 1 || mode !== 'horizontal') {
|
||||
return null;
|
||||
} // put all the overflowed item inside a submenu
|
||||
// with a title of overflow indicator ('...')
|
||||
|
||||
|
||||
var copy = _this.props.children[0];
|
||||
|
||||
var _copy$props = copy.props,
|
||||
throwAway = _copy$props.children,
|
||||
title = _copy$props.title,
|
||||
propStyle = _copy$props.style,
|
||||
rest = _objectWithoutProperties(_copy$props, ["children", "title", "style"]);
|
||||
|
||||
var style = _objectSpread({}, propStyle);
|
||||
|
||||
var key = "".concat(keyPrefix, "-overflowed-indicator");
|
||||
var eventKey = "".concat(keyPrefix, "-overflowed-indicator");
|
||||
|
||||
if (overflowedItems.length === 0 && renderPlaceholder !== true) {
|
||||
style = _objectSpread({}, style, {
|
||||
display: 'none'
|
||||
});
|
||||
} else if (renderPlaceholder) {
|
||||
style = _objectSpread({}, style, {
|
||||
visibility: 'hidden',
|
||||
// prevent from taking normal dom space
|
||||
position: 'absolute'
|
||||
});
|
||||
key = "".concat(key, "-placeholder");
|
||||
eventKey = "".concat(eventKey, "-placeholder");
|
||||
}
|
||||
|
||||
var popupClassName = theme ? "".concat(prefixCls, "-").concat(theme) : '';
|
||||
var props = {};
|
||||
menuAllProps.forEach(function (k) {
|
||||
if (rest[k] !== undefined) {
|
||||
props[k] = rest[k];
|
||||
}
|
||||
});
|
||||
return React.createElement(SubMenu, Object.assign({
|
||||
title: overflowedIndicator,
|
||||
className: "".concat(prefixCls, "-overflowed-submenu"),
|
||||
popupClassName: popupClassName
|
||||
}, props, {
|
||||
key: key,
|
||||
eventKey: eventKey,
|
||||
disabled: false,
|
||||
style: style
|
||||
}), overflowedItems);
|
||||
}; // memorize rendered menuSize
|
||||
|
||||
|
||||
_this.setChildrenWidthAndResize = function () {
|
||||
if (_this.props.mode !== 'horizontal') {
|
||||
return;
|
||||
}
|
||||
|
||||
var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
||||
|
||||
if (!ul) {
|
||||
return;
|
||||
}
|
||||
|
||||
var ulChildrenNodes = ul.children;
|
||||
|
||||
if (!ulChildrenNodes || ulChildrenNodes.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var lastOverflowedIndicatorPlaceholder = ul.children[ulChildrenNodes.length - 1]; // need last overflowed indicator for calculating length;
|
||||
|
||||
setStyle(lastOverflowedIndicatorPlaceholder, 'display', 'inline-block');
|
||||
|
||||
var menuItemNodes = _this.getMenuItemNodes(); // reset display attribute for all hidden elements caused by overflow to calculate updated width
|
||||
// and then reset to original state after width calculation
|
||||
|
||||
|
||||
var overflowedItems = menuItemNodes.filter(function (c) {
|
||||
return c.className.split(' ').indexOf(MENUITEM_OVERFLOWED_CLASSNAME) >= 0;
|
||||
});
|
||||
overflowedItems.forEach(function (c) {
|
||||
setStyle(c, 'display', 'inline-block');
|
||||
});
|
||||
_this.menuItemSizes = menuItemNodes.map(function (c) {
|
||||
return getWidth(c);
|
||||
});
|
||||
overflowedItems.forEach(function (c) {
|
||||
setStyle(c, 'display', 'none');
|
||||
});
|
||||
_this.overflowedIndicatorWidth = getWidth(ul.children[ul.children.length - 1]);
|
||||
_this.originalTotalWidth = _this.menuItemSizes.reduce(function (acc, cur) {
|
||||
return acc + cur;
|
||||
}, 0);
|
||||
|
||||
_this.handleResize(); // prevent the overflowed indicator from taking space;
|
||||
|
||||
|
||||
setStyle(lastOverflowedIndicatorPlaceholder, 'display', 'none');
|
||||
};
|
||||
|
||||
_this.handleResize = function () {
|
||||
if (_this.props.mode !== 'horizontal') {
|
||||
return;
|
||||
}
|
||||
|
||||
var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
||||
|
||||
if (!ul) {
|
||||
return;
|
||||
}
|
||||
|
||||
var width = getWidth(ul);
|
||||
_this.overflowedItems = [];
|
||||
var currentSumWidth = 0; // index for last visible child in horizontal mode
|
||||
|
||||
var lastVisibleIndex; // float number comparison could be problematic
|
||||
// e.g. 0.1 + 0.2 > 0.3 =====> true
|
||||
// thus using FLOAT_PRECISION_ADJUST as buffer to help the situation
|
||||
|
||||
if (_this.originalTotalWidth > width + FLOAT_PRECISION_ADJUST) {
|
||||
lastVisibleIndex = -1;
|
||||
|
||||
_this.menuItemSizes.forEach(function (liWidth) {
|
||||
currentSumWidth += liWidth;
|
||||
|
||||
if (currentSumWidth + _this.overflowedIndicatorWidth <= width) {
|
||||
lastVisibleIndex += 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_this.setState({
|
||||
lastVisibleIndex: lastVisibleIndex
|
||||
});
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(DOMWrap, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this2 = this;
|
||||
|
||||
this.setChildrenWidthAndResize();
|
||||
|
||||
if (this.props.level === 1 && this.props.mode === 'horizontal') {
|
||||
var menuUl = ReactDOM.findDOMNode(this);
|
||||
|
||||
if (!menuUl) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.resizeObserver = new ResizeObserver(function (entries) {
|
||||
entries.forEach(_this2.setChildrenWidthAndResize);
|
||||
});
|
||||
[].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {
|
||||
_this2.resizeObserver.observe(el);
|
||||
});
|
||||
|
||||
if (typeof MutationObserver !== 'undefined') {
|
||||
this.mutationObserver = new MutationObserver(function () {
|
||||
_this2.resizeObserver.disconnect();
|
||||
|
||||
[].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {
|
||||
_this2.resizeObserver.observe(el);
|
||||
});
|
||||
|
||||
_this2.setChildrenWidthAndResize();
|
||||
});
|
||||
this.mutationObserver.observe(menuUl, {
|
||||
attributes: false,
|
||||
childList: true,
|
||||
subTree: false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
if (this.resizeObserver) {
|
||||
this.resizeObserver.disconnect();
|
||||
}
|
||||
|
||||
if (this.mutationObserver) {
|
||||
this.mutationObserver.disconnect();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "renderChildren",
|
||||
value: function renderChildren(children) {
|
||||
var _this3 = this;
|
||||
|
||||
// need to take care of overflowed items in horizontal mode
|
||||
var lastVisibleIndex = this.state.lastVisibleIndex;
|
||||
return (children || []).reduce(function (acc, childNode, index) {
|
||||
var item = childNode;
|
||||
|
||||
if (_this3.props.mode === 'horizontal') {
|
||||
var overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, []);
|
||||
|
||||
if (lastVisibleIndex !== undefined && _this3.props.className.indexOf("".concat(_this3.props.prefixCls, "-root")) !== -1) {
|
||||
if (index > lastVisibleIndex) {
|
||||
item = React.cloneElement(childNode, // 这里修改 eventKey 是为了防止隐藏状态下还会触发 openkeys 事件
|
||||
{
|
||||
style: {
|
||||
display: 'none'
|
||||
},
|
||||
eventKey: "".concat(childNode.props.eventKey, "-hidden"),
|
||||
|
||||
/**
|
||||
* Legacy code. Here `className` never used:
|
||||
* https://github.com/react-component/menu/commit/4cd6b49fce9d116726f4ea00dda85325d6f26500#diff-e2fa48f75c2dd2318295cde428556a76R240
|
||||
*/
|
||||
className: "".concat(MENUITEM_OVERFLOWED_CLASSNAME)
|
||||
});
|
||||
}
|
||||
|
||||
if (index === lastVisibleIndex + 1) {
|
||||
_this3.overflowedItems = children.slice(lastVisibleIndex + 1).map(function (c) {
|
||||
return React.cloneElement(c, // children[index].key will become '.$key' in clone by default,
|
||||
// we have to overwrite with the correct key explicitly
|
||||
{
|
||||
key: c.props.eventKey,
|
||||
mode: 'vertical-left'
|
||||
});
|
||||
});
|
||||
overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, _this3.overflowedItems);
|
||||
}
|
||||
}
|
||||
|
||||
var ret = [].concat(_toConsumableArray(acc), [overflowed, item]);
|
||||
|
||||
if (index === children.length - 1) {
|
||||
// need a placeholder for calculating overflowed indicator width
|
||||
ret.push(_this3.getOverflowedSubMenuItem(childNode.props.eventKey, [], true));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return [].concat(_toConsumableArray(acc), [item]);
|
||||
}, []);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props2 = this.props,
|
||||
visible = _this$props2.visible,
|
||||
prefixCls = _this$props2.prefixCls,
|
||||
overflowedIndicator = _this$props2.overflowedIndicator,
|
||||
mode = _this$props2.mode,
|
||||
level = _this$props2.level,
|
||||
tag = _this$props2.tag,
|
||||
children = _this$props2.children,
|
||||
theme = _this$props2.theme,
|
||||
rest = _objectWithoutProperties(_this$props2, ["visible", "prefixCls", "overflowedIndicator", "mode", "level", "tag", "children", "theme"]);
|
||||
|
||||
var Tag = tag;
|
||||
return React.createElement(Tag, Object.assign({}, rest), this.renderChildren(children));
|
||||
}
|
||||
}]);
|
||||
|
||||
return DOMWrap;
|
||||
}(React.Component);
|
||||
|
||||
DOMWrap.defaultProps = {
|
||||
tag: 'div',
|
||||
className: ''
|
||||
};
|
||||
export default DOMWrap;
|
||||
9
web/node_modules/rc-menu/es/Divider.d.ts
generated
vendored
Normal file
9
web/node_modules/rc-menu/es/Divider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
export interface DividerProps {
|
||||
className?: string;
|
||||
rootPrefixCls?: string;
|
||||
style?: React.CSSProperties;
|
||||
disabled?: boolean;
|
||||
}
|
||||
declare const Divider: React.FC<DividerProps>;
|
||||
export default Divider;
|
||||
19
web/node_modules/rc-menu/es/Divider.js
generated
vendored
Normal file
19
web/node_modules/rc-menu/es/Divider.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
|
||||
var Divider = function Divider(_ref) {
|
||||
var className = _ref.className,
|
||||
rootPrefixCls = _ref.rootPrefixCls,
|
||||
style = _ref.style;
|
||||
return React.createElement("li", {
|
||||
className: "".concat(className, " ").concat(rootPrefixCls, "-item-divider"),
|
||||
style: style
|
||||
});
|
||||
};
|
||||
|
||||
Divider.defaultProps = {
|
||||
// To fix keyboard UX.
|
||||
disabled: true,
|
||||
className: '',
|
||||
style: {}
|
||||
};
|
||||
export default Divider;
|
||||
75
web/node_modules/rc-menu/es/Menu.d.ts
generated
vendored
Normal file
75
web/node_modules/rc-menu/es/Menu.d.ts
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
import React from 'react';
|
||||
import SubPopupMenu from './SubPopupMenu';
|
||||
import { noop } from './util';
|
||||
import { RenderIconType, SelectInfo, SelectEventHandler, DestroyEventHandler, MenuMode, OpenEventHandler, OpenAnimation, MiniStore, BuiltinPlacements, TriggerSubMenuAction, MenuClickEventHandler, MotionType } from './interface';
|
||||
export interface MenuProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onSelect'> {
|
||||
defaultSelectedKeys?: string[];
|
||||
defaultActiveFirst?: boolean;
|
||||
selectedKeys?: string[];
|
||||
defaultOpenKeys?: string[];
|
||||
openKeys?: string[];
|
||||
mode?: MenuMode;
|
||||
getPopupContainer?: (node: HTMLElement) => HTMLElement;
|
||||
onClick?: MenuClickEventHandler;
|
||||
onSelect?: SelectEventHandler;
|
||||
onOpenChange?: OpenEventHandler;
|
||||
onDeselect?: SelectEventHandler;
|
||||
onDestroy?: DestroyEventHandler;
|
||||
subMenuOpenDelay?: number;
|
||||
subMenuCloseDelay?: number;
|
||||
forceSubMenuRender?: boolean;
|
||||
triggerSubMenuAction?: TriggerSubMenuAction;
|
||||
level?: number;
|
||||
selectable?: boolean;
|
||||
multiple?: boolean;
|
||||
activeKey?: string;
|
||||
prefixCls?: string;
|
||||
builtinPlacements?: BuiltinPlacements;
|
||||
itemIcon?: RenderIconType;
|
||||
expandIcon?: RenderIconType;
|
||||
overflowedIndicator?: React.ReactNode;
|
||||
/** Menu motion define */
|
||||
motion?: MotionType;
|
||||
/** @deprecated Please use `motion` instead */
|
||||
openTransitionName?: string;
|
||||
/** @deprecated Please use `motion` instead */
|
||||
openAnimation?: OpenAnimation;
|
||||
/** direction of menu */
|
||||
direction?: 'ltr' | 'rtl';
|
||||
}
|
||||
declare class Menu extends React.Component<MenuProps> {
|
||||
static defaultProps: {
|
||||
selectable: boolean;
|
||||
onClick: typeof noop;
|
||||
onSelect: typeof noop;
|
||||
onOpenChange: typeof noop;
|
||||
onDeselect: typeof noop;
|
||||
defaultSelectedKeys: any[];
|
||||
defaultOpenKeys: any[];
|
||||
subMenuOpenDelay: number;
|
||||
subMenuCloseDelay: number;
|
||||
triggerSubMenuAction: string;
|
||||
prefixCls: string;
|
||||
className: string;
|
||||
mode: string;
|
||||
style: {};
|
||||
builtinPlacements: {};
|
||||
overflowedIndicator: JSX.Element;
|
||||
};
|
||||
constructor(props: MenuProps);
|
||||
isRootMenu: boolean;
|
||||
store: MiniStore;
|
||||
innerMenu: typeof SubPopupMenu;
|
||||
componentDidMount(): void;
|
||||
componentDidUpdate(): void;
|
||||
onSelect: (selectInfo: SelectInfo) => void;
|
||||
onClick: MenuClickEventHandler;
|
||||
onKeyDown: (e: React.KeyboardEvent<HTMLElement>, callback: any) => void;
|
||||
onOpenChange: (event: any) => void;
|
||||
onDeselect: (selectInfo: SelectInfo) => void;
|
||||
getOpenTransitionName: () => string;
|
||||
setInnerMenu: (node: any) => void;
|
||||
updateMiniStore(): void;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default Menu;
|
||||
276
web/node_modules/rc-menu/es/Menu.js
generated
vendored
Normal file
276
web/node_modules/rc-menu/es/Menu.js
generated
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; 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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
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 React from 'react';
|
||||
import { Provider, create } from 'mini-store';
|
||||
import SubPopupMenu, { getActiveKey } from './SubPopupMenu';
|
||||
import { noop } from './util';
|
||||
import { getMotion } from './utils/legacyUtil';
|
||||
|
||||
var Menu = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(Menu, _React$Component);
|
||||
|
||||
var _super = _createSuper(Menu);
|
||||
|
||||
function Menu(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Menu);
|
||||
|
||||
_this = _super.call(this, props);
|
||||
|
||||
_this.onSelect = function (selectInfo) {
|
||||
var _assertThisInitialize = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize.props;
|
||||
|
||||
if (props.selectable) {
|
||||
// root menu
|
||||
var _this$store$getState = _this.store.getState(),
|
||||
_selectedKeys = _this$store$getState.selectedKeys;
|
||||
|
||||
var selectedKey = selectInfo.key;
|
||||
|
||||
if (props.multiple) {
|
||||
_selectedKeys = _selectedKeys.concat([selectedKey]);
|
||||
} else {
|
||||
_selectedKeys = [selectedKey];
|
||||
}
|
||||
|
||||
if (!('selectedKeys' in props)) {
|
||||
_this.store.setState({
|
||||
selectedKeys: _selectedKeys
|
||||
});
|
||||
}
|
||||
|
||||
props.onSelect(_objectSpread({}, selectInfo, {
|
||||
selectedKeys: _selectedKeys
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
_this.onClick = function (e) {
|
||||
_this.props.onClick(e);
|
||||
}; // onKeyDown needs to be exposed as a instance method
|
||||
// e.g., in rc-select, we need to navigate menu item while
|
||||
// current active item is rc-select input box rather than the menu itself
|
||||
|
||||
|
||||
_this.onKeyDown = function (e, callback) {
|
||||
_this.innerMenu.getWrappedInstance().onKeyDown(e, callback);
|
||||
};
|
||||
|
||||
_this.onOpenChange = function (event) {
|
||||
var _assertThisInitialize2 = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize2.props;
|
||||
|
||||
var openKeys = _this.store.getState().openKeys.concat();
|
||||
|
||||
var changed = false;
|
||||
|
||||
var processSingle = function processSingle(e) {
|
||||
var oneChanged = false;
|
||||
|
||||
if (e.open) {
|
||||
oneChanged = openKeys.indexOf(e.key) === -1;
|
||||
|
||||
if (oneChanged) {
|
||||
openKeys.push(e.key);
|
||||
}
|
||||
} else {
|
||||
var index = openKeys.indexOf(e.key);
|
||||
oneChanged = index !== -1;
|
||||
|
||||
if (oneChanged) {
|
||||
openKeys.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
changed = changed || oneChanged;
|
||||
};
|
||||
|
||||
if (Array.isArray(event)) {
|
||||
// batch change call
|
||||
event.forEach(processSingle);
|
||||
} else {
|
||||
processSingle(event);
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
if (!('openKeys' in _this.props)) {
|
||||
_this.store.setState({
|
||||
openKeys: openKeys
|
||||
});
|
||||
}
|
||||
|
||||
props.onOpenChange(openKeys);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onDeselect = function (selectInfo) {
|
||||
var _assertThisInitialize3 = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize3.props;
|
||||
|
||||
if (props.selectable) {
|
||||
var _selectedKeys2 = _this.store.getState().selectedKeys.concat();
|
||||
|
||||
var selectedKey = selectInfo.key;
|
||||
|
||||
var index = _selectedKeys2.indexOf(selectedKey);
|
||||
|
||||
if (index !== -1) {
|
||||
_selectedKeys2.splice(index, 1);
|
||||
}
|
||||
|
||||
if (!('selectedKeys' in props)) {
|
||||
_this.store.setState({
|
||||
selectedKeys: _selectedKeys2
|
||||
});
|
||||
}
|
||||
|
||||
props.onDeselect(_objectSpread({}, selectInfo, {
|
||||
selectedKeys: _selectedKeys2
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
_this.getOpenTransitionName = function () {
|
||||
var _assertThisInitialize4 = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize4.props;
|
||||
|
||||
var transitionName = props.openTransitionName;
|
||||
var animationName = props.openAnimation;
|
||||
|
||||
if (!transitionName && typeof animationName === 'string') {
|
||||
transitionName = "".concat(props.prefixCls, "-open-").concat(animationName);
|
||||
}
|
||||
|
||||
return transitionName;
|
||||
};
|
||||
|
||||
_this.setInnerMenu = function (node) {
|
||||
_this.innerMenu = node;
|
||||
};
|
||||
|
||||
_this.isRootMenu = true;
|
||||
var selectedKeys = props.defaultSelectedKeys;
|
||||
var openKeys = props.defaultOpenKeys;
|
||||
|
||||
if ('selectedKeys' in props) {
|
||||
selectedKeys = props.selectedKeys || [];
|
||||
}
|
||||
|
||||
if ('openKeys' in props) {
|
||||
openKeys = props.openKeys || [];
|
||||
}
|
||||
|
||||
_this.store = create({
|
||||
selectedKeys: selectedKeys,
|
||||
openKeys: openKeys,
|
||||
activeKey: {
|
||||
'0-menu-': getActiveKey(props, props.activeKey)
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Menu, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.updateMiniStore();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
this.updateMiniStore();
|
||||
}
|
||||
}, {
|
||||
key: "updateMiniStore",
|
||||
value: function updateMiniStore() {
|
||||
if ('selectedKeys' in this.props) {
|
||||
this.store.setState({
|
||||
selectedKeys: this.props.selectedKeys || []
|
||||
});
|
||||
}
|
||||
|
||||
if ('openKeys' in this.props) {
|
||||
this.store.setState({
|
||||
openKeys: this.props.openKeys || []
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var props = _objectSpread({}, this.props);
|
||||
|
||||
props.className += " ".concat(props.prefixCls, "-root");
|
||||
|
||||
if (props.direction === 'rtl') {
|
||||
props.className += " ".concat(props.prefixCls, "-rtl");
|
||||
}
|
||||
|
||||
props = _objectSpread({}, props, {
|
||||
onClick: this.onClick,
|
||||
onOpenChange: this.onOpenChange,
|
||||
onDeselect: this.onDeselect,
|
||||
onSelect: this.onSelect,
|
||||
parentMenu: this,
|
||||
motion: getMotion(this.props)
|
||||
});
|
||||
delete props.openAnimation;
|
||||
delete props.openTransitionName;
|
||||
return React.createElement(Provider, {
|
||||
store: this.store
|
||||
}, React.createElement(SubPopupMenu, Object.assign({}, props, {
|
||||
ref: this.setInnerMenu
|
||||
}), this.props.children));
|
||||
}
|
||||
}]);
|
||||
|
||||
return Menu;
|
||||
}(React.Component);
|
||||
|
||||
Menu.defaultProps = {
|
||||
selectable: true,
|
||||
onClick: noop,
|
||||
onSelect: noop,
|
||||
onOpenChange: noop,
|
||||
onDeselect: noop,
|
||||
defaultSelectedKeys: [],
|
||||
defaultOpenKeys: [],
|
||||
subMenuOpenDelay: 0.1,
|
||||
subMenuCloseDelay: 0.1,
|
||||
triggerSubMenuAction: 'hover',
|
||||
prefixCls: 'rc-menu',
|
||||
className: '',
|
||||
mode: 'vertical',
|
||||
style: {},
|
||||
builtinPlacements: {},
|
||||
overflowedIndicator: React.createElement("span", null, "\xB7\xB7\xB7")
|
||||
};
|
||||
export default Menu;
|
||||
59
web/node_modules/rc-menu/es/MenuItem.d.ts
generated
vendored
Normal file
59
web/node_modules/rc-menu/es/MenuItem.d.ts
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import React from 'react';
|
||||
import { noop } from './util';
|
||||
import { SelectEventHandler, HoverEventHandler, DestroyEventHandler, RenderIconType, MenuHoverEventHandler, MenuClickEventHandler, MenuMode, LegacyFunctionRef } from './interface';
|
||||
export interface MenuItemProps {
|
||||
/** @deprecated No place to use this. Should remove */
|
||||
attribute?: Record<string, string>;
|
||||
rootPrefixCls?: string;
|
||||
eventKey?: React.Key;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
active?: boolean;
|
||||
children?: React.ReactNode;
|
||||
selectedKeys?: string[];
|
||||
disabled?: boolean;
|
||||
title?: string;
|
||||
onItemHover?: HoverEventHandler;
|
||||
onSelect?: SelectEventHandler;
|
||||
onClick?: MenuClickEventHandler;
|
||||
onDeselect?: SelectEventHandler;
|
||||
parentMenu?: React.ReactInstance;
|
||||
onDestroy?: DestroyEventHandler;
|
||||
onMouseEnter?: MenuHoverEventHandler;
|
||||
onMouseLeave?: MenuHoverEventHandler;
|
||||
multiple?: boolean;
|
||||
isSelected?: boolean;
|
||||
manualRef?: LegacyFunctionRef;
|
||||
itemIcon?: RenderIconType;
|
||||
role?: string;
|
||||
mode?: MenuMode;
|
||||
inlineIndent?: number;
|
||||
level?: number;
|
||||
direction?: 'ltr' | 'rtl';
|
||||
}
|
||||
export declare class MenuItem extends React.Component<MenuItemProps> {
|
||||
static isMenuItem: boolean;
|
||||
static defaultProps: {
|
||||
onSelect: typeof noop;
|
||||
onMouseEnter: typeof noop;
|
||||
onMouseLeave: typeof noop;
|
||||
manualRef: typeof noop;
|
||||
};
|
||||
node: HTMLLIElement;
|
||||
componentDidMount(): void;
|
||||
componentDidUpdate(prevProps: MenuItemProps): void;
|
||||
componentWillUnmount(): void;
|
||||
onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => boolean;
|
||||
onMouseLeave: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseEnter: React.MouseEventHandler<HTMLElement>;
|
||||
onClick: React.MouseEventHandler<HTMLElement>;
|
||||
getPrefixCls(): string;
|
||||
getActiveClassName(): string;
|
||||
getSelectedClassName(): string;
|
||||
getDisabledClassName(): string;
|
||||
saveNode: (node: HTMLLIElement) => void;
|
||||
callRef(): void;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
declare const connected: any;
|
||||
export default connected;
|
||||
277
web/node_modules/rc-menu/es/MenuItem.js
generated
vendored
Normal file
277
web/node_modules/rc-menu/es/MenuItem.js
generated
vendored
Normal file
@@ -0,0 +1,277 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; 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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
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 React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
import classNames from 'classnames';
|
||||
import scrollIntoView from 'scroll-into-view-if-needed';
|
||||
import { connect } from 'mini-store';
|
||||
import { noop, menuAllProps } from './util';
|
||||
export var MenuItem = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(MenuItem, _React$Component);
|
||||
|
||||
var _super = _createSuper(MenuItem);
|
||||
|
||||
function MenuItem() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, MenuItem);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
|
||||
_this.onKeyDown = function (e) {
|
||||
var keyCode = e.keyCode;
|
||||
|
||||
if (keyCode === KeyCode.ENTER) {
|
||||
_this.onClick(e);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
_this.onMouseLeave = function (e) {
|
||||
var _this$props = _this.props,
|
||||
eventKey = _this$props.eventKey,
|
||||
onItemHover = _this$props.onItemHover,
|
||||
onMouseLeave = _this$props.onMouseLeave;
|
||||
onItemHover({
|
||||
key: eventKey,
|
||||
hover: false
|
||||
});
|
||||
onMouseLeave({
|
||||
key: eventKey,
|
||||
domEvent: e
|
||||
});
|
||||
};
|
||||
|
||||
_this.onMouseEnter = function (e) {
|
||||
var _this$props2 = _this.props,
|
||||
eventKey = _this$props2.eventKey,
|
||||
onItemHover = _this$props2.onItemHover,
|
||||
onMouseEnter = _this$props2.onMouseEnter;
|
||||
onItemHover({
|
||||
key: eventKey,
|
||||
hover: true
|
||||
});
|
||||
onMouseEnter({
|
||||
key: eventKey,
|
||||
domEvent: e
|
||||
});
|
||||
};
|
||||
|
||||
_this.onClick = function (e) {
|
||||
var _this$props3 = _this.props,
|
||||
eventKey = _this$props3.eventKey,
|
||||
multiple = _this$props3.multiple,
|
||||
onClick = _this$props3.onClick,
|
||||
onSelect = _this$props3.onSelect,
|
||||
onDeselect = _this$props3.onDeselect,
|
||||
isSelected = _this$props3.isSelected;
|
||||
var info = {
|
||||
key: eventKey,
|
||||
keyPath: [eventKey],
|
||||
item: _assertThisInitialized(_this),
|
||||
domEvent: e
|
||||
};
|
||||
onClick(info);
|
||||
|
||||
if (multiple) {
|
||||
if (isSelected) {
|
||||
onDeselect(info);
|
||||
} else {
|
||||
onSelect(info);
|
||||
}
|
||||
} else if (!isSelected) {
|
||||
onSelect(info);
|
||||
}
|
||||
};
|
||||
|
||||
_this.saveNode = function (node) {
|
||||
_this.node = node;
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(MenuItem, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
// invoke customized ref to expose component to mixin
|
||||
this.callRef();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
var _this$props4 = this.props,
|
||||
active = _this$props4.active,
|
||||
parentMenu = _this$props4.parentMenu,
|
||||
eventKey = _this$props4.eventKey; // 在 parentMenu 上层保存滚动状态,避免重复的 MenuItem key 导致滚动跳动
|
||||
// https://github.com/ant-design/ant-design/issues/16181
|
||||
|
||||
if (!prevProps.active && active && (!parentMenu || !parentMenu["scrolled-".concat(eventKey)])) {
|
||||
if (this.node) {
|
||||
scrollIntoView(this.node, {
|
||||
scrollMode: 'if-needed',
|
||||
// eslint-disable-next-line react/no-find-dom-node
|
||||
boundary: ReactDOM.findDOMNode(parentMenu),
|
||||
block: 'nearest'
|
||||
});
|
||||
parentMenu["scrolled-".concat(eventKey)] = true;
|
||||
}
|
||||
} else if (parentMenu && parentMenu["scrolled-".concat(eventKey)]) {
|
||||
delete parentMenu["scrolled-".concat(eventKey)];
|
||||
}
|
||||
|
||||
this.callRef();
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
var props = this.props;
|
||||
|
||||
if (props.onDestroy) {
|
||||
props.onDestroy(props.eventKey);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "getPrefixCls",
|
||||
value: function getPrefixCls() {
|
||||
return "".concat(this.props.rootPrefixCls, "-item");
|
||||
}
|
||||
}, {
|
||||
key: "getActiveClassName",
|
||||
value: function getActiveClassName() {
|
||||
return "".concat(this.getPrefixCls(), "-active");
|
||||
}
|
||||
}, {
|
||||
key: "getSelectedClassName",
|
||||
value: function getSelectedClassName() {
|
||||
return "".concat(this.getPrefixCls(), "-selected");
|
||||
}
|
||||
}, {
|
||||
key: "getDisabledClassName",
|
||||
value: function getDisabledClassName() {
|
||||
return "".concat(this.getPrefixCls(), "-disabled");
|
||||
}
|
||||
}, {
|
||||
key: "callRef",
|
||||
value: function callRef() {
|
||||
if (this.props.manualRef) {
|
||||
this.props.manualRef(this);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _classNames;
|
||||
|
||||
var props = _objectSpread({}, this.props);
|
||||
|
||||
var className = classNames(this.getPrefixCls(), props.className, (_classNames = {}, _defineProperty(_classNames, this.getActiveClassName(), !props.disabled && props.active), _defineProperty(_classNames, this.getSelectedClassName(), props.isSelected), _defineProperty(_classNames, this.getDisabledClassName(), props.disabled), _classNames));
|
||||
|
||||
var attrs = _objectSpread({}, props.attribute, {
|
||||
title: props.title,
|
||||
className: className,
|
||||
// set to menuitem by default
|
||||
role: props.role || 'menuitem',
|
||||
'aria-disabled': props.disabled
|
||||
});
|
||||
|
||||
if (props.role === 'option') {
|
||||
// overwrite to option
|
||||
attrs = _objectSpread({}, attrs, {
|
||||
role: 'option',
|
||||
'aria-selected': props.isSelected
|
||||
});
|
||||
} else if (props.role === null || props.role === 'none') {
|
||||
// sometimes we want to specify role inside <li/> element
|
||||
// <li><a role='menuitem'>Link</a></li> would be a good example
|
||||
// in this case the role on <li/> should be "none" to
|
||||
// remove the implied listitem role.
|
||||
// https://www.w3.org/TR/wai-aria-practices-1.1/examples/menubar/menubar-1/menubar-1.html
|
||||
attrs.role = 'none';
|
||||
} // In case that onClick/onMouseLeave/onMouseEnter is passed down from owner
|
||||
|
||||
|
||||
var mouseEvent = {
|
||||
onClick: props.disabled ? null : this.onClick,
|
||||
onMouseLeave: props.disabled ? null : this.onMouseLeave,
|
||||
onMouseEnter: props.disabled ? null : this.onMouseEnter
|
||||
};
|
||||
|
||||
var style = _objectSpread({}, props.style);
|
||||
|
||||
if (props.mode === 'inline') {
|
||||
if (props.direction === 'rtl') {
|
||||
style.paddingRight = props.inlineIndent * props.level;
|
||||
} else {
|
||||
style.paddingLeft = props.inlineIndent * props.level;
|
||||
}
|
||||
}
|
||||
|
||||
menuAllProps.forEach(function (key) {
|
||||
return delete props[key];
|
||||
});
|
||||
delete props.direction;
|
||||
var icon = this.props.itemIcon;
|
||||
|
||||
if (typeof this.props.itemIcon === 'function') {
|
||||
// TODO: This is a bug which should fixed after TS refactor
|
||||
icon = React.createElement(this.props.itemIcon, this.props);
|
||||
}
|
||||
|
||||
return React.createElement("li", Object.assign({}, props, attrs, mouseEvent, {
|
||||
style: style,
|
||||
ref: this.saveNode
|
||||
}), props.children, icon);
|
||||
}
|
||||
}]);
|
||||
|
||||
return MenuItem;
|
||||
}(React.Component);
|
||||
MenuItem.isMenuItem = true;
|
||||
MenuItem.defaultProps = {
|
||||
onSelect: noop,
|
||||
onMouseEnter: noop,
|
||||
onMouseLeave: noop,
|
||||
manualRef: noop
|
||||
};
|
||||
var connected = connect(function (_ref, _ref2) {
|
||||
var activeKey = _ref.activeKey,
|
||||
selectedKeys = _ref.selectedKeys;
|
||||
var eventKey = _ref2.eventKey,
|
||||
subMenuKey = _ref2.subMenuKey;
|
||||
return {
|
||||
active: activeKey[subMenuKey] === eventKey,
|
||||
isSelected: selectedKeys.indexOf(eventKey) !== -1
|
||||
};
|
||||
})(MenuItem);
|
||||
export default connected;
|
||||
22
web/node_modules/rc-menu/es/MenuItemGroup.d.ts
generated
vendored
Normal file
22
web/node_modules/rc-menu/es/MenuItemGroup.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import React from 'react';
|
||||
import { MenuClickEventHandler } from './interface';
|
||||
export interface MenuItemGroupProps {
|
||||
disabled?: boolean;
|
||||
renderMenuItem?: (item: React.ReactElement, index: number, key: string) => React.ReactElement;
|
||||
index?: number;
|
||||
className?: string;
|
||||
subMenuKey?: string;
|
||||
rootPrefixCls?: string;
|
||||
title?: React.ReactNode;
|
||||
onClick?: MenuClickEventHandler;
|
||||
direction?: 'ltr' | 'rtl';
|
||||
}
|
||||
declare class MenuItemGroup extends React.Component<MenuItemGroupProps> {
|
||||
static isMenuItemGroup: boolean;
|
||||
static defaultProps: {
|
||||
disabled: boolean;
|
||||
};
|
||||
renderInnerMenuItem: (item: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
export default MenuItemGroup;
|
||||
86
web/node_modules/rc-menu/es/MenuItemGroup.js
generated
vendored
Normal file
86
web/node_modules/rc-menu/es/MenuItemGroup.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; 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 _extends() { _extends = Object.assign || 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
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 React from 'react';
|
||||
import { menuAllProps } from './util';
|
||||
|
||||
var MenuItemGroup = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(MenuItemGroup, _React$Component);
|
||||
|
||||
var _super = _createSuper(MenuItemGroup);
|
||||
|
||||
function MenuItemGroup() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, MenuItemGroup);
|
||||
|
||||
_this = _super.apply(this, arguments);
|
||||
|
||||
_this.renderInnerMenuItem = function (item) {
|
||||
var _this$props = _this.props,
|
||||
renderMenuItem = _this$props.renderMenuItem,
|
||||
index = _this$props.index;
|
||||
return renderMenuItem(item, index, _this.props.subMenuKey);
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(MenuItemGroup, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var props = _extends({}, this.props);
|
||||
|
||||
var _props$className = props.className,
|
||||
className = _props$className === void 0 ? '' : _props$className,
|
||||
rootPrefixCls = props.rootPrefixCls;
|
||||
var titleClassName = "".concat(rootPrefixCls, "-item-group-title");
|
||||
var listClassName = "".concat(rootPrefixCls, "-item-group-list");
|
||||
var title = props.title,
|
||||
children = props.children;
|
||||
menuAllProps.forEach(function (key) {
|
||||
return delete props[key];
|
||||
}); // Set onClick to null, to ignore propagated onClick event
|
||||
|
||||
delete props.onClick;
|
||||
delete props.direction;
|
||||
return React.createElement("li", Object.assign({}, props, {
|
||||
className: "".concat(className, " ").concat(rootPrefixCls, "-item-group")
|
||||
}), React.createElement("div", {
|
||||
className: titleClassName,
|
||||
title: typeof title === 'string' ? title : undefined
|
||||
}, title), React.createElement("ul", {
|
||||
className: listClassName
|
||||
}, React.Children.map(children, this.renderInnerMenuItem)));
|
||||
}
|
||||
}]);
|
||||
|
||||
return MenuItemGroup;
|
||||
}(React.Component);
|
||||
|
||||
MenuItemGroup.isMenuItemGroup = true;
|
||||
MenuItemGroup.defaultProps = {
|
||||
disabled: true
|
||||
};
|
||||
export default MenuItemGroup;
|
||||
121
web/node_modules/rc-menu/es/SubMenu.d.ts
generated
vendored
Normal file
121
web/node_modules/rc-menu/es/SubMenu.d.ts
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
import React from 'react';
|
||||
import { SubPopupMenuProps } from './SubPopupMenu';
|
||||
import { noop } from './util';
|
||||
import { MiniStore, RenderIconType, LegacyFunctionRef, MenuMode, OpenEventHandler, SelectEventHandler, DestroyEventHandler, MenuHoverEventHandler, MenuClickEventHandler, MenuInfo, BuiltinPlacements, TriggerSubMenuAction, HoverEventHandler, MotionType } from './interface';
|
||||
import { MenuItem } from './MenuItem';
|
||||
export interface SubMenuProps {
|
||||
parentMenu?: React.ReactElement & {
|
||||
isRootMenu: boolean;
|
||||
subMenuInstance: React.ReactInstance;
|
||||
};
|
||||
title?: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
selectedKeys?: string[];
|
||||
openKeys?: string[];
|
||||
onClick?: MenuClickEventHandler;
|
||||
onOpenChange?: OpenEventHandler;
|
||||
rootPrefixCls?: string;
|
||||
eventKey?: string;
|
||||
multiple?: boolean;
|
||||
active?: boolean;
|
||||
onItemHover?: HoverEventHandler;
|
||||
onSelect?: SelectEventHandler;
|
||||
triggerSubMenuAction?: TriggerSubMenuAction;
|
||||
onDeselect?: SelectEventHandler;
|
||||
onDestroy?: DestroyEventHandler;
|
||||
onMouseEnter?: MenuHoverEventHandler;
|
||||
onMouseLeave?: MenuHoverEventHandler;
|
||||
onTitleMouseEnter?: MenuHoverEventHandler;
|
||||
onTitleMouseLeave?: MenuHoverEventHandler;
|
||||
onTitleClick?: (info: {
|
||||
key: React.Key;
|
||||
domEvent: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
|
||||
}) => void;
|
||||
popupOffset?: number[];
|
||||
isOpen?: boolean;
|
||||
store?: MiniStore;
|
||||
mode?: MenuMode;
|
||||
manualRef?: LegacyFunctionRef;
|
||||
itemIcon?: RenderIconType;
|
||||
expandIcon?: RenderIconType;
|
||||
inlineIndent?: number;
|
||||
level?: number;
|
||||
subMenuOpenDelay?: number;
|
||||
subMenuCloseDelay?: number;
|
||||
forceSubMenuRender?: boolean;
|
||||
builtinPlacements?: BuiltinPlacements;
|
||||
disabled?: boolean;
|
||||
className?: string;
|
||||
popupClassName?: string;
|
||||
motion?: MotionType;
|
||||
direction?: 'ltr' | 'rtl';
|
||||
}
|
||||
export declare class SubMenu extends React.Component<SubMenuProps> {
|
||||
static defaultProps: {
|
||||
onMouseEnter: typeof noop;
|
||||
onMouseLeave: typeof noop;
|
||||
onTitleMouseEnter: typeof noop;
|
||||
onTitleMouseLeave: typeof noop;
|
||||
onTitleClick: typeof noop;
|
||||
manualRef: typeof noop;
|
||||
mode: string;
|
||||
title: string;
|
||||
};
|
||||
constructor(props: SubMenuProps);
|
||||
isRootMenu: boolean;
|
||||
menuInstance: MenuItem;
|
||||
subMenuTitle: HTMLElement;
|
||||
internalMenuId: string;
|
||||
haveRendered: boolean;
|
||||
haveOpened: boolean;
|
||||
/**
|
||||
* Follow timeout should be `number`.
|
||||
* Current is only convert code into TS,
|
||||
* we not use `window.setTimeout` instead of `setTimeout`.
|
||||
*/
|
||||
minWidthTimeout: any;
|
||||
mouseenterTimeout: any;
|
||||
componentDidMount(): void;
|
||||
componentDidUpdate(): void;
|
||||
componentWillUnmount(): void;
|
||||
onDestroy: (key: string) => void;
|
||||
/**
|
||||
* note:
|
||||
* This legacy code that `onKeyDown` is called by parent instead of dom self.
|
||||
* which need return code to check if this event is handled
|
||||
*/
|
||||
onKeyDown: React.KeyboardEventHandler<HTMLElement>;
|
||||
onOpenChange: OpenEventHandler;
|
||||
onPopupVisibleChange: (visible: boolean) => void;
|
||||
onMouseEnter: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseLeave: React.MouseEventHandler<HTMLElement>;
|
||||
onTitleMouseEnter: React.MouseEventHandler<HTMLElement>;
|
||||
onTitleMouseLeave: React.MouseEventHandler<HTMLElement>;
|
||||
onTitleClick: (e: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement>) => void;
|
||||
onSubMenuClick: (info: MenuInfo) => void;
|
||||
onSelect: SelectEventHandler;
|
||||
onDeselect: SelectEventHandler;
|
||||
getPrefixCls: () => string;
|
||||
getActiveClassName: () => string;
|
||||
getDisabledClassName: () => string;
|
||||
getSelectedClassName: () => string;
|
||||
getOpenClassName: () => string;
|
||||
saveMenuInstance: (c: MenuItem) => void;
|
||||
addKeyPath: (info: MenuInfo) => {
|
||||
keyPath: (string | number)[];
|
||||
key: string | number;
|
||||
item: React.ReactInstance;
|
||||
domEvent: React.MouseEvent<HTMLElement, MouseEvent>;
|
||||
};
|
||||
triggerOpenChange: (open: boolean, type?: string) => void;
|
||||
isChildrenSelected: () => boolean;
|
||||
isOpen: () => boolean;
|
||||
adjustWidth: () => void;
|
||||
saveSubMenuTitle: (subMenuTitle: HTMLElement) => void;
|
||||
getBaseProps: () => SubPopupMenuProps;
|
||||
getMotion: (mode: MenuMode, visible: boolean) => MotionType;
|
||||
renderChildren(children: React.ReactNode): JSX.Element;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
declare const connected: any;
|
||||
export default connected;
|
||||
618
web/node_modules/rc-menu/es/SubMenu.js
generated
vendored
Normal file
618
web/node_modules/rc-menu/es/SubMenu.js
generated
vendored
Normal file
@@ -0,0 +1,618 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; 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 _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
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); }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Trigger from 'rc-trigger';
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
import CSSMotion from "rc-animate/es/CSSMotion";
|
||||
import classNames from 'classnames';
|
||||
import { connect } from 'mini-store';
|
||||
import SubPopupMenu from './SubPopupMenu';
|
||||
import { placements, placementsRtl } from './placements';
|
||||
import { noop, loopMenuItemRecursively, getMenuIdFromSubMenuEventKey, menuAllProps } from './util';
|
||||
var guid = 0;
|
||||
var popupPlacementMap = {
|
||||
horizontal: 'bottomLeft',
|
||||
vertical: 'rightTop',
|
||||
'vertical-left': 'rightTop',
|
||||
'vertical-right': 'leftTop'
|
||||
};
|
||||
|
||||
var updateDefaultActiveFirst = function updateDefaultActiveFirst(store, eventKey, defaultActiveFirst) {
|
||||
var menuId = getMenuIdFromSubMenuEventKey(eventKey);
|
||||
var state = store.getState();
|
||||
store.setState({
|
||||
defaultActiveFirst: _objectSpread({}, state.defaultActiveFirst, _defineProperty({}, menuId, defaultActiveFirst))
|
||||
});
|
||||
};
|
||||
|
||||
export var SubMenu = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(SubMenu, _React$Component);
|
||||
|
||||
var _super = _createSuper(SubMenu);
|
||||
|
||||
function SubMenu(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, SubMenu);
|
||||
|
||||
_this = _super.call(this, props);
|
||||
|
||||
_this.onDestroy = function (key) {
|
||||
_this.props.onDestroy(key);
|
||||
};
|
||||
/**
|
||||
* note:
|
||||
* This legacy code that `onKeyDown` is called by parent instead of dom self.
|
||||
* which need return code to check if this event is handled
|
||||
*/
|
||||
|
||||
|
||||
_this.onKeyDown = function (e) {
|
||||
var keyCode = e.keyCode;
|
||||
var menu = _this.menuInstance;
|
||||
var _this$props = _this.props,
|
||||
isOpen = _this$props.isOpen,
|
||||
store = _this$props.store;
|
||||
|
||||
if (keyCode === KeyCode.ENTER) {
|
||||
_this.onTitleClick(e);
|
||||
|
||||
updateDefaultActiveFirst(store, _this.props.eventKey, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keyCode === KeyCode.RIGHT) {
|
||||
if (isOpen) {
|
||||
menu.onKeyDown(e);
|
||||
} else {
|
||||
_this.triggerOpenChange(true); // need to update current menu's defaultActiveFirst value
|
||||
|
||||
|
||||
updateDefaultActiveFirst(store, _this.props.eventKey, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keyCode === KeyCode.LEFT) {
|
||||
var handled;
|
||||
|
||||
if (isOpen) {
|
||||
handled = menu.onKeyDown(e);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
_this.triggerOpenChange(false);
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
if (isOpen && (keyCode === KeyCode.UP || keyCode === KeyCode.DOWN)) {
|
||||
return menu.onKeyDown(e);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
_this.onOpenChange = function (e) {
|
||||
_this.props.onOpenChange(e);
|
||||
};
|
||||
|
||||
_this.onPopupVisibleChange = function (visible) {
|
||||
_this.triggerOpenChange(visible, visible ? 'mouseenter' : 'mouseleave');
|
||||
};
|
||||
|
||||
_this.onMouseEnter = function (e) {
|
||||
var _this$props2 = _this.props,
|
||||
key = _this$props2.eventKey,
|
||||
onMouseEnter = _this$props2.onMouseEnter,
|
||||
store = _this$props2.store;
|
||||
updateDefaultActiveFirst(store, _this.props.eventKey, false);
|
||||
onMouseEnter({
|
||||
key: key,
|
||||
domEvent: e
|
||||
});
|
||||
};
|
||||
|
||||
_this.onMouseLeave = function (e) {
|
||||
var _this$props3 = _this.props,
|
||||
parentMenu = _this$props3.parentMenu,
|
||||
eventKey = _this$props3.eventKey,
|
||||
onMouseLeave = _this$props3.onMouseLeave;
|
||||
parentMenu.subMenuInstance = _assertThisInitialized(_this);
|
||||
onMouseLeave({
|
||||
key: eventKey,
|
||||
domEvent: e
|
||||
});
|
||||
};
|
||||
|
||||
_this.onTitleMouseEnter = function (domEvent) {
|
||||
var _this$props4 = _this.props,
|
||||
key = _this$props4.eventKey,
|
||||
onItemHover = _this$props4.onItemHover,
|
||||
onTitleMouseEnter = _this$props4.onTitleMouseEnter;
|
||||
onItemHover({
|
||||
key: key,
|
||||
hover: true
|
||||
});
|
||||
onTitleMouseEnter({
|
||||
key: key,
|
||||
domEvent: domEvent
|
||||
});
|
||||
};
|
||||
|
||||
_this.onTitleMouseLeave = function (e) {
|
||||
var _this$props5 = _this.props,
|
||||
parentMenu = _this$props5.parentMenu,
|
||||
eventKey = _this$props5.eventKey,
|
||||
onItemHover = _this$props5.onItemHover,
|
||||
onTitleMouseLeave = _this$props5.onTitleMouseLeave;
|
||||
parentMenu.subMenuInstance = _assertThisInitialized(_this);
|
||||
onItemHover({
|
||||
key: eventKey,
|
||||
hover: false
|
||||
});
|
||||
onTitleMouseLeave({
|
||||
key: eventKey,
|
||||
domEvent: e
|
||||
});
|
||||
};
|
||||
|
||||
_this.onTitleClick = function (e) {
|
||||
var _assertThisInitialize = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize.props;
|
||||
|
||||
props.onTitleClick({
|
||||
key: props.eventKey,
|
||||
domEvent: e
|
||||
});
|
||||
|
||||
if (props.triggerSubMenuAction === 'hover') {
|
||||
return;
|
||||
}
|
||||
|
||||
_this.triggerOpenChange(!props.isOpen, 'click');
|
||||
|
||||
updateDefaultActiveFirst(props.store, _this.props.eventKey, false);
|
||||
};
|
||||
|
||||
_this.onSubMenuClick = function (info) {
|
||||
// in the case of overflowed submenu
|
||||
// onClick is not copied over
|
||||
if (typeof _this.props.onClick === 'function') {
|
||||
_this.props.onClick(_this.addKeyPath(info));
|
||||
}
|
||||
};
|
||||
|
||||
_this.onSelect = function (info) {
|
||||
_this.props.onSelect(info);
|
||||
};
|
||||
|
||||
_this.onDeselect = function (info) {
|
||||
_this.props.onDeselect(info);
|
||||
};
|
||||
|
||||
_this.getPrefixCls = function () {
|
||||
return "".concat(_this.props.rootPrefixCls, "-submenu");
|
||||
};
|
||||
|
||||
_this.getActiveClassName = function () {
|
||||
return "".concat(_this.getPrefixCls(), "-active");
|
||||
};
|
||||
|
||||
_this.getDisabledClassName = function () {
|
||||
return "".concat(_this.getPrefixCls(), "-disabled");
|
||||
};
|
||||
|
||||
_this.getSelectedClassName = function () {
|
||||
return "".concat(_this.getPrefixCls(), "-selected");
|
||||
};
|
||||
|
||||
_this.getOpenClassName = function () {
|
||||
return "".concat(_this.props.rootPrefixCls, "-submenu-open");
|
||||
};
|
||||
|
||||
_this.saveMenuInstance = function (c) {
|
||||
// children menu instance
|
||||
_this.menuInstance = c;
|
||||
};
|
||||
|
||||
_this.addKeyPath = function (info) {
|
||||
return _objectSpread({}, info, {
|
||||
keyPath: (info.keyPath || []).concat(_this.props.eventKey)
|
||||
});
|
||||
};
|
||||
|
||||
_this.triggerOpenChange = function (open, type) {
|
||||
var key = _this.props.eventKey;
|
||||
|
||||
var openChange = function openChange() {
|
||||
_this.onOpenChange({
|
||||
key: key,
|
||||
item: _assertThisInitialized(_this),
|
||||
trigger: type,
|
||||
open: open
|
||||
});
|
||||
};
|
||||
|
||||
if (type === 'mouseenter') {
|
||||
// make sure mouseenter happen after other menu item's mouseleave
|
||||
_this.mouseenterTimeout = setTimeout(function () {
|
||||
openChange();
|
||||
}, 0);
|
||||
} else {
|
||||
openChange();
|
||||
}
|
||||
};
|
||||
|
||||
_this.isChildrenSelected = function () {
|
||||
var ret = {
|
||||
find: false
|
||||
};
|
||||
loopMenuItemRecursively(_this.props.children, _this.props.selectedKeys, ret);
|
||||
return ret.find;
|
||||
};
|
||||
|
||||
_this.isOpen = function () {
|
||||
return _this.props.openKeys.indexOf(_this.props.eventKey) !== -1;
|
||||
};
|
||||
|
||||
_this.adjustWidth = function () {
|
||||
/* istanbul ignore if */
|
||||
if (!_this.subMenuTitle || !_this.menuInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
var popupMenu = ReactDOM.findDOMNode(_this.menuInstance);
|
||||
|
||||
if (popupMenu.offsetWidth >= _this.subMenuTitle.offsetWidth) {
|
||||
return;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
|
||||
|
||||
popupMenu.style.minWidth = "".concat(_this.subMenuTitle.offsetWidth, "px");
|
||||
};
|
||||
|
||||
_this.saveSubMenuTitle = function (subMenuTitle) {
|
||||
_this.subMenuTitle = subMenuTitle;
|
||||
};
|
||||
|
||||
_this.getBaseProps = function () {
|
||||
var _assertThisInitialize2 = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize2.props;
|
||||
|
||||
return {
|
||||
mode: props.mode === 'horizontal' ? 'vertical' : props.mode,
|
||||
visible: _this.props.isOpen,
|
||||
level: props.level + 1,
|
||||
inlineIndent: props.inlineIndent,
|
||||
focusable: false,
|
||||
onClick: _this.onSubMenuClick,
|
||||
onSelect: _this.onSelect,
|
||||
onDeselect: _this.onDeselect,
|
||||
onDestroy: _this.onDestroy,
|
||||
selectedKeys: props.selectedKeys,
|
||||
eventKey: "".concat(props.eventKey, "-menu-"),
|
||||
openKeys: props.openKeys,
|
||||
motion: props.motion,
|
||||
onOpenChange: _this.onOpenChange,
|
||||
subMenuOpenDelay: props.subMenuOpenDelay,
|
||||
parentMenu: _assertThisInitialized(_this),
|
||||
subMenuCloseDelay: props.subMenuCloseDelay,
|
||||
forceSubMenuRender: props.forceSubMenuRender,
|
||||
triggerSubMenuAction: props.triggerSubMenuAction,
|
||||
builtinPlacements: props.builtinPlacements,
|
||||
defaultActiveFirst: props.store.getState().defaultActiveFirst[getMenuIdFromSubMenuEventKey(props.eventKey)],
|
||||
multiple: props.multiple,
|
||||
prefixCls: props.rootPrefixCls,
|
||||
id: _this.internalMenuId,
|
||||
manualRef: _this.saveMenuInstance,
|
||||
itemIcon: props.itemIcon,
|
||||
expandIcon: props.expandIcon,
|
||||
direction: props.direction
|
||||
};
|
||||
};
|
||||
|
||||
_this.getMotion = function (mode, visible) {
|
||||
var _assertThisInitialize3 = _assertThisInitialized(_this),
|
||||
haveRendered = _assertThisInitialize3.haveRendered;
|
||||
|
||||
var _this$props6 = _this.props,
|
||||
motion = _this$props6.motion,
|
||||
rootPrefixCls = _this$props6.rootPrefixCls; // don't show transition on first rendering (no animation for opened menu)
|
||||
// show appear transition if it's not visible (not sure why)
|
||||
// show appear transition if it's not inline mode
|
||||
|
||||
var mergedMotion = _objectSpread({}, motion, {
|
||||
leavedClassName: "".concat(rootPrefixCls, "-hidden"),
|
||||
removeOnLeave: false,
|
||||
motionAppear: haveRendered || !visible || mode !== 'inline'
|
||||
});
|
||||
|
||||
return mergedMotion;
|
||||
};
|
||||
|
||||
var store = props.store,
|
||||
eventKey = props.eventKey;
|
||||
|
||||
var _store$getState = store.getState(),
|
||||
defaultActiveFirst = _store$getState.defaultActiveFirst;
|
||||
|
||||
_this.isRootMenu = false;
|
||||
var value = false;
|
||||
|
||||
if (defaultActiveFirst) {
|
||||
value = defaultActiveFirst[eventKey];
|
||||
}
|
||||
|
||||
updateDefaultActiveFirst(store, eventKey, value);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(SubMenu, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.componentDidUpdate();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
var _this2 = this;
|
||||
|
||||
var _this$props7 = this.props,
|
||||
mode = _this$props7.mode,
|
||||
parentMenu = _this$props7.parentMenu,
|
||||
manualRef = _this$props7.manualRef; // invoke customized ref to expose component to mixin
|
||||
|
||||
if (manualRef) {
|
||||
manualRef(this);
|
||||
}
|
||||
|
||||
if (mode !== 'horizontal' || !parentMenu.isRootMenu || !this.props.isOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.minWidthTimeout = setTimeout(function () {
|
||||
return _this2.adjustWidth();
|
||||
}, 0);
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
var _this$props8 = this.props,
|
||||
onDestroy = _this$props8.onDestroy,
|
||||
eventKey = _this$props8.eventKey;
|
||||
|
||||
if (onDestroy) {
|
||||
onDestroy(eventKey);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
|
||||
|
||||
if (this.minWidthTimeout) {
|
||||
clearTimeout(this.minWidthTimeout);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
|
||||
|
||||
if (this.mouseenterTimeout) {
|
||||
clearTimeout(this.mouseenterTimeout);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "renderChildren",
|
||||
value: function renderChildren(children) {
|
||||
var _this3 = this;
|
||||
|
||||
var baseProps = this.getBaseProps(); // [Legacy] getMotion must be called before `haveRendered`
|
||||
|
||||
var mergedMotion = this.getMotion(baseProps.mode, baseProps.visible);
|
||||
this.haveRendered = true;
|
||||
this.haveOpened = this.haveOpened || baseProps.visible || baseProps.forceSubMenuRender; // never rendered not planning to, don't render
|
||||
|
||||
if (!this.haveOpened) {
|
||||
return React.createElement("div", null);
|
||||
}
|
||||
|
||||
var direction = baseProps.direction;
|
||||
return React.createElement(CSSMotion, Object.assign({
|
||||
visible: baseProps.visible
|
||||
}, mergedMotion), function (_ref) {
|
||||
var className = _ref.className,
|
||||
style = _ref.style;
|
||||
var mergedClassName = classNames("".concat(baseProps.prefixCls, "-sub"), className, _defineProperty({}, "".concat(baseProps.prefixCls, "-rtl"), direction === 'rtl'));
|
||||
return React.createElement(SubPopupMenu, Object.assign({}, baseProps, {
|
||||
id: _this3.internalMenuId,
|
||||
className: mergedClassName,
|
||||
style: style
|
||||
}), children);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _classNames2;
|
||||
|
||||
var props = _objectSpread({}, this.props);
|
||||
|
||||
var isOpen = props.isOpen;
|
||||
var prefixCls = this.getPrefixCls();
|
||||
var isInlineMode = props.mode === 'inline';
|
||||
var className = classNames(prefixCls, "".concat(prefixCls, "-").concat(props.mode), (_classNames2 = {}, _defineProperty(_classNames2, props.className, !!props.className), _defineProperty(_classNames2, this.getOpenClassName(), isOpen), _defineProperty(_classNames2, this.getActiveClassName(), props.active || isOpen && !isInlineMode), _defineProperty(_classNames2, this.getDisabledClassName(), props.disabled), _defineProperty(_classNames2, this.getSelectedClassName(), this.isChildrenSelected()), _classNames2));
|
||||
|
||||
if (!this.internalMenuId) {
|
||||
if (props.eventKey) {
|
||||
this.internalMenuId = "".concat(props.eventKey, "$Menu");
|
||||
} else {
|
||||
guid += 1;
|
||||
this.internalMenuId = "$__$".concat(guid, "$Menu");
|
||||
}
|
||||
}
|
||||
|
||||
var mouseEvents = {};
|
||||
var titleClickEvents = {};
|
||||
var titleMouseEvents = {};
|
||||
|
||||
if (!props.disabled) {
|
||||
mouseEvents = {
|
||||
onMouseLeave: this.onMouseLeave,
|
||||
onMouseEnter: this.onMouseEnter
|
||||
}; // only works in title, not outer li
|
||||
|
||||
titleClickEvents = {
|
||||
onClick: this.onTitleClick
|
||||
};
|
||||
titleMouseEvents = {
|
||||
onMouseEnter: this.onTitleMouseEnter,
|
||||
onMouseLeave: this.onTitleMouseLeave
|
||||
};
|
||||
}
|
||||
|
||||
var style = {};
|
||||
var direction = props.direction;
|
||||
|
||||
if (isInlineMode) {
|
||||
if (direction === 'rtl') {
|
||||
style.paddingRight = props.inlineIndent * props.level;
|
||||
} else {
|
||||
style.paddingLeft = props.inlineIndent * props.level;
|
||||
}
|
||||
}
|
||||
|
||||
var ariaOwns = {}; // only set aria-owns when menu is open
|
||||
// otherwise it would be an invalid aria-owns value
|
||||
// since corresponding node cannot be found
|
||||
|
||||
if (this.props.isOpen) {
|
||||
ariaOwns = {
|
||||
'aria-owns': this.internalMenuId
|
||||
};
|
||||
} // expand custom icon should NOT be displayed in menu with horizontal mode.
|
||||
|
||||
|
||||
var icon = null;
|
||||
|
||||
if (props.mode !== 'horizontal') {
|
||||
icon = this.props.expandIcon; // ReactNode
|
||||
|
||||
if (typeof this.props.expandIcon === 'function') {
|
||||
icon = React.createElement(this.props.expandIcon, _objectSpread({}, this.props));
|
||||
}
|
||||
}
|
||||
|
||||
var title = React.createElement("div", Object.assign({
|
||||
ref: this.saveSubMenuTitle,
|
||||
style: style,
|
||||
className: "".concat(prefixCls, "-title"),
|
||||
role: "button"
|
||||
}, titleMouseEvents, titleClickEvents, {
|
||||
"aria-expanded": isOpen
|
||||
}, ariaOwns, {
|
||||
"aria-haspopup": "true",
|
||||
title: typeof props.title === 'string' ? props.title : undefined
|
||||
}), props.title, icon || React.createElement("i", {
|
||||
className: "".concat(prefixCls, "-arrow")
|
||||
}));
|
||||
var children = this.renderChildren(props.children);
|
||||
var getPopupContainer = props.parentMenu.isRootMenu ? props.parentMenu.props.getPopupContainer : function (triggerNode) {
|
||||
return triggerNode.parentNode;
|
||||
};
|
||||
var popupPlacement = popupPlacementMap[props.mode];
|
||||
var popupAlign = props.popupOffset ? {
|
||||
offset: props.popupOffset
|
||||
} : {};
|
||||
var popupClassName = props.mode === 'inline' ? '' : props.popupClassName;
|
||||
popupClassName += direction === 'rtl' ? " ".concat(prefixCls, "-rtl") : '';
|
||||
var disabled = props.disabled,
|
||||
triggerSubMenuAction = props.triggerSubMenuAction,
|
||||
subMenuOpenDelay = props.subMenuOpenDelay,
|
||||
forceSubMenuRender = props.forceSubMenuRender,
|
||||
subMenuCloseDelay = props.subMenuCloseDelay,
|
||||
builtinPlacements = props.builtinPlacements;
|
||||
menuAllProps.forEach(function (key) {
|
||||
return delete props[key];
|
||||
}); // Set onClick to null, to ignore propagated onClick event
|
||||
|
||||
delete props.onClick;
|
||||
var placement = direction === 'rtl' ? Object.assign({}, placementsRtl, builtinPlacements) : Object.assign({}, placements, builtinPlacements);
|
||||
delete props.direction;
|
||||
return React.createElement("li", Object.assign({}, props, mouseEvents, {
|
||||
className: className,
|
||||
role: "menuitem"
|
||||
}), isInlineMode && title, isInlineMode && children, !isInlineMode && React.createElement(Trigger, {
|
||||
prefixCls: prefixCls,
|
||||
popupClassName: classNames("".concat(prefixCls, "-popup"), popupClassName),
|
||||
getPopupContainer: getPopupContainer,
|
||||
builtinPlacements: placement,
|
||||
popupPlacement: popupPlacement,
|
||||
popupVisible: isOpen,
|
||||
popupAlign: popupAlign,
|
||||
popup: children,
|
||||
action: disabled ? [] : [triggerSubMenuAction],
|
||||
mouseEnterDelay: subMenuOpenDelay,
|
||||
mouseLeaveDelay: subMenuCloseDelay,
|
||||
onPopupVisibleChange: this.onPopupVisibleChange,
|
||||
forceRender: forceSubMenuRender
|
||||
}, title));
|
||||
}
|
||||
}]);
|
||||
|
||||
return SubMenu;
|
||||
}(React.Component);
|
||||
SubMenu.defaultProps = {
|
||||
onMouseEnter: noop,
|
||||
onMouseLeave: noop,
|
||||
onTitleMouseEnter: noop,
|
||||
onTitleMouseLeave: noop,
|
||||
onTitleClick: noop,
|
||||
manualRef: noop,
|
||||
mode: 'vertical',
|
||||
title: ''
|
||||
};
|
||||
var connected = connect(function (_ref2, _ref3) {
|
||||
var openKeys = _ref2.openKeys,
|
||||
activeKey = _ref2.activeKey,
|
||||
selectedKeys = _ref2.selectedKeys;
|
||||
var eventKey = _ref3.eventKey,
|
||||
subMenuKey = _ref3.subMenuKey;
|
||||
return {
|
||||
isOpen: openKeys.indexOf(eventKey) > -1,
|
||||
active: activeKey[subMenuKey] === eventKey,
|
||||
selectedKeys: selectedKeys
|
||||
};
|
||||
})(SubMenu);
|
||||
connected.isSubMenu = true;
|
||||
export default connected;
|
||||
91
web/node_modules/rc-menu/es/SubPopupMenu.d.ts
generated
vendored
Normal file
91
web/node_modules/rc-menu/es/SubPopupMenu.d.ts
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
import React from 'react';
|
||||
import { noop } from './util';
|
||||
import { SelectEventHandler, OpenEventHandler, DestroyEventHandler, MiniStore, MenuMode, LegacyFunctionRef, RenderIconType, HoverEventHandler, BuiltinPlacements, MenuClickEventHandler, TriggerSubMenuAction, MotionType } from './interface';
|
||||
import { MenuItem, MenuItemProps } from './MenuItem';
|
||||
export declare function getActiveKey(props: {
|
||||
children?: React.ReactNode;
|
||||
eventKey?: React.Key;
|
||||
defaultActiveFirst?: boolean;
|
||||
}, originalActiveKey: string): string | number;
|
||||
export declare function saveRef(c: React.ReactInstance): void;
|
||||
export interface SubPopupMenuProps {
|
||||
onSelect?: SelectEventHandler;
|
||||
onClick?: MenuClickEventHandler;
|
||||
onDeselect?: SelectEventHandler;
|
||||
onOpenChange?: OpenEventHandler;
|
||||
onDestroy?: DestroyEventHandler;
|
||||
openKeys?: string[];
|
||||
visible?: boolean;
|
||||
children?: React.ReactNode;
|
||||
parentMenu?: React.ReactInstance;
|
||||
eventKey?: React.Key;
|
||||
store?: MiniStore;
|
||||
prefixCls?: string;
|
||||
focusable?: boolean;
|
||||
multiple?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
defaultActiveFirst?: boolean;
|
||||
activeKey?: string;
|
||||
selectedKeys?: string[];
|
||||
defaultSelectedKeys?: string[];
|
||||
defaultOpenKeys?: string[];
|
||||
level?: number;
|
||||
mode?: MenuMode;
|
||||
triggerSubMenuAction?: TriggerSubMenuAction;
|
||||
inlineIndent?: number;
|
||||
manualRef?: LegacyFunctionRef;
|
||||
itemIcon?: RenderIconType;
|
||||
expandIcon?: RenderIconType;
|
||||
subMenuOpenDelay?: number;
|
||||
subMenuCloseDelay?: number;
|
||||
forceSubMenuRender?: boolean;
|
||||
builtinPlacements?: BuiltinPlacements;
|
||||
role?: string;
|
||||
id?: string;
|
||||
overflowedIndicator?: React.ReactNode;
|
||||
theme?: string;
|
||||
motion?: MotionType;
|
||||
direction?: 'ltr' | 'rtl';
|
||||
}
|
||||
export declare class SubPopupMenu extends React.Component<SubPopupMenuProps> {
|
||||
static defaultProps: {
|
||||
prefixCls: string;
|
||||
className: string;
|
||||
mode: string;
|
||||
level: number;
|
||||
inlineIndent: number;
|
||||
visible: boolean;
|
||||
focusable: boolean;
|
||||
style: {};
|
||||
manualRef: typeof noop;
|
||||
};
|
||||
constructor(props: SubPopupMenuProps);
|
||||
instanceArray: MenuItem[];
|
||||
componentDidMount(): void;
|
||||
shouldComponentUpdate(nextProps: SubPopupMenuProps): boolean;
|
||||
componentDidUpdate(prevProps: SubPopupMenuProps): void;
|
||||
/**
|
||||
* all keyboard events callbacks run from here at first
|
||||
*
|
||||
* note:
|
||||
* This legacy code that `onKeyDown` is called by parent instead of dom self.
|
||||
* which need return code to check if this event is handled
|
||||
*/
|
||||
onKeyDown: (e: React.KeyboardEvent<HTMLElement>, callback: (item: MenuItem) => void) => number;
|
||||
onItemHover: HoverEventHandler;
|
||||
onDeselect: SelectEventHandler;
|
||||
onSelect: SelectEventHandler;
|
||||
onClick: MenuClickEventHandler;
|
||||
onOpenChange: OpenEventHandler;
|
||||
onDestroy: DestroyEventHandler;
|
||||
getFlatInstanceArray: () => MenuItem[];
|
||||
step: (direction: number) => MenuItem;
|
||||
renderCommonMenuItem: (child: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>, i: number, extraProps: MenuItemProps) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
|
||||
renderMenuItem: (c: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>, i: number, subMenuKey: string | number) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
|
||||
render(): JSX.Element;
|
||||
}
|
||||
declare const connected: React.ComponentClass<SubPopupMenuProps, any> & {
|
||||
getWrappedInstance: () => SubPopupMenu;
|
||||
};
|
||||
export default connected;
|
||||
412
web/node_modules/rc-menu/es/SubPopupMenu.js
generated
vendored
Normal file
412
web/node_modules/rc-menu/es/SubPopupMenu.js
generated
vendored
Normal file
@@ -0,0 +1,412 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; 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 _extends() { _extends = Object.assign || 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
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); }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'mini-store';
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
import createChainedFunction from "rc-util/es/createChainedFunction";
|
||||
import shallowEqual from 'shallowequal';
|
||||
import classNames from 'classnames';
|
||||
import { getKeyFromChildrenIndex, loopMenuItem, noop, menuAllProps, isMobileDevice } from './util';
|
||||
import DOMWrap from './DOMWrap';
|
||||
|
||||
function allDisabled(arr) {
|
||||
if (!arr.length) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return arr.every(function (c) {
|
||||
return !!c.props.disabled;
|
||||
});
|
||||
}
|
||||
|
||||
function updateActiveKey(store, menuId, activeKey) {
|
||||
var state = store.getState();
|
||||
store.setState({
|
||||
activeKey: _objectSpread({}, state.activeKey, _defineProperty({}, menuId, activeKey))
|
||||
});
|
||||
}
|
||||
|
||||
function getEventKey(props) {
|
||||
// when eventKey not available ,it's menu and return menu id '0-menu-'
|
||||
return props.eventKey || '0-menu-';
|
||||
}
|
||||
|
||||
export function getActiveKey(props, originalActiveKey) {
|
||||
var activeKey = originalActiveKey;
|
||||
var children = props.children,
|
||||
eventKey = props.eventKey;
|
||||
|
||||
if (activeKey) {
|
||||
var found;
|
||||
loopMenuItem(children, function (c, i) {
|
||||
if (c && c.props && !c.props.disabled && activeKey === getKeyFromChildrenIndex(c, eventKey, i)) {
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (found) {
|
||||
return activeKey;
|
||||
}
|
||||
}
|
||||
|
||||
activeKey = null;
|
||||
|
||||
if (props.defaultActiveFirst) {
|
||||
loopMenuItem(children, function (c, i) {
|
||||
if (!activeKey && c && !c.props.disabled) {
|
||||
activeKey = getKeyFromChildrenIndex(c, eventKey, i);
|
||||
}
|
||||
});
|
||||
return activeKey;
|
||||
}
|
||||
|
||||
return activeKey;
|
||||
}
|
||||
export function saveRef(c) {
|
||||
if (c) {
|
||||
var index = this.instanceArray.indexOf(c);
|
||||
|
||||
if (index !== -1) {
|
||||
// update component if it's already inside instanceArray
|
||||
this.instanceArray[index] = c;
|
||||
} else {
|
||||
// add component if it's not in instanceArray yet;
|
||||
this.instanceArray.push(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
export var SubPopupMenu = /*#__PURE__*/function (_React$Component) {
|
||||
_inherits(SubPopupMenu, _React$Component);
|
||||
|
||||
var _super = _createSuper(SubPopupMenu);
|
||||
|
||||
function SubPopupMenu(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, SubPopupMenu);
|
||||
|
||||
_this = _super.call(this, props);
|
||||
/**
|
||||
* all keyboard events callbacks run from here at first
|
||||
*
|
||||
* note:
|
||||
* This legacy code that `onKeyDown` is called by parent instead of dom self.
|
||||
* which need return code to check if this event is handled
|
||||
*/
|
||||
|
||||
_this.onKeyDown = function (e, callback) {
|
||||
var keyCode = e.keyCode;
|
||||
var handled;
|
||||
|
||||
_this.getFlatInstanceArray().forEach(function (obj) {
|
||||
if (obj && obj.props.active && obj.onKeyDown) {
|
||||
handled = obj.onKeyDown(e);
|
||||
}
|
||||
});
|
||||
|
||||
if (handled) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var activeItem = null;
|
||||
|
||||
if (keyCode === KeyCode.UP || keyCode === KeyCode.DOWN) {
|
||||
activeItem = _this.step(keyCode === KeyCode.UP ? -1 : 1);
|
||||
}
|
||||
|
||||
if (activeItem) {
|
||||
e.preventDefault();
|
||||
updateActiveKey(_this.props.store, getEventKey(_this.props), activeItem.props.eventKey);
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
callback(activeItem);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
_this.onItemHover = function (e) {
|
||||
var key = e.key,
|
||||
hover = e.hover;
|
||||
updateActiveKey(_this.props.store, getEventKey(_this.props), hover ? key : null);
|
||||
};
|
||||
|
||||
_this.onDeselect = function (selectInfo) {
|
||||
_this.props.onDeselect(selectInfo);
|
||||
};
|
||||
|
||||
_this.onSelect = function (selectInfo) {
|
||||
_this.props.onSelect(selectInfo);
|
||||
};
|
||||
|
||||
_this.onClick = function (e) {
|
||||
_this.props.onClick(e);
|
||||
};
|
||||
|
||||
_this.onOpenChange = function (e) {
|
||||
_this.props.onOpenChange(e);
|
||||
};
|
||||
|
||||
_this.onDestroy = function (key) {
|
||||
/* istanbul ignore next */
|
||||
_this.props.onDestroy(key);
|
||||
};
|
||||
|
||||
_this.getFlatInstanceArray = function () {
|
||||
return _this.instanceArray;
|
||||
};
|
||||
|
||||
_this.step = function (direction) {
|
||||
var children = _this.getFlatInstanceArray();
|
||||
|
||||
var activeKey = _this.props.store.getState().activeKey[getEventKey(_this.props)];
|
||||
|
||||
var len = children.length;
|
||||
|
||||
if (!len) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (direction < 0) {
|
||||
children = children.concat().reverse();
|
||||
} // find current activeIndex
|
||||
|
||||
|
||||
var activeIndex = -1;
|
||||
children.every(function (c, ci) {
|
||||
if (c && c.props.eventKey === activeKey) {
|
||||
activeIndex = ci;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!_this.props.defaultActiveFirst && activeIndex !== -1 && allDisabled(children.slice(activeIndex, len - 1))) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var start = (activeIndex + 1) % len;
|
||||
var i = start;
|
||||
|
||||
do {
|
||||
var child = children[i];
|
||||
|
||||
if (!child || child.props.disabled) {
|
||||
i = (i + 1) % len;
|
||||
} else {
|
||||
return child;
|
||||
}
|
||||
} while (i !== start);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
_this.renderCommonMenuItem = function (child, i, extraProps) {
|
||||
var state = _this.props.store.getState();
|
||||
|
||||
var _assertThisInitialize = _assertThisInitialized(_this),
|
||||
props = _assertThisInitialize.props;
|
||||
|
||||
var key = getKeyFromChildrenIndex(child, props.eventKey, i);
|
||||
var childProps = child.props; // https://github.com/ant-design/ant-design/issues/11517#issuecomment-477403055
|
||||
|
||||
if (!childProps || typeof child.type === 'string') {
|
||||
return child;
|
||||
}
|
||||
|
||||
var isActive = key === state.activeKey;
|
||||
|
||||
var newChildProps = _objectSpread({
|
||||
mode: childProps.mode || props.mode,
|
||||
level: props.level,
|
||||
inlineIndent: props.inlineIndent,
|
||||
renderMenuItem: _this.renderMenuItem,
|
||||
rootPrefixCls: props.prefixCls,
|
||||
index: i,
|
||||
parentMenu: props.parentMenu,
|
||||
// customized ref function, need to be invoked manually in child's componentDidMount
|
||||
manualRef: childProps.disabled ? undefined : createChainedFunction(child.ref, saveRef.bind(_assertThisInitialized(_this))),
|
||||
eventKey: key,
|
||||
active: !childProps.disabled && isActive,
|
||||
multiple: props.multiple,
|
||||
onClick: function onClick(e) {
|
||||
(childProps.onClick || noop)(e);
|
||||
|
||||
_this.onClick(e);
|
||||
},
|
||||
onItemHover: _this.onItemHover,
|
||||
motion: props.motion,
|
||||
subMenuOpenDelay: props.subMenuOpenDelay,
|
||||
subMenuCloseDelay: props.subMenuCloseDelay,
|
||||
forceSubMenuRender: props.forceSubMenuRender,
|
||||
onOpenChange: _this.onOpenChange,
|
||||
onDeselect: _this.onDeselect,
|
||||
onSelect: _this.onSelect,
|
||||
builtinPlacements: props.builtinPlacements,
|
||||
itemIcon: childProps.itemIcon || _this.props.itemIcon,
|
||||
expandIcon: childProps.expandIcon || _this.props.expandIcon
|
||||
}, extraProps, {
|
||||
direction: props.direction
|
||||
}); // ref: https://github.com/ant-design/ant-design/issues/13943
|
||||
|
||||
|
||||
if (props.mode === 'inline' || isMobileDevice()) {
|
||||
newChildProps.triggerSubMenuAction = 'click';
|
||||
}
|
||||
|
||||
return React.cloneElement(child, newChildProps);
|
||||
};
|
||||
|
||||
_this.renderMenuItem = function (c, i, subMenuKey) {
|
||||
/* istanbul ignore if */
|
||||
if (!c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var state = _this.props.store.getState();
|
||||
|
||||
var extraProps = {
|
||||
openKeys: state.openKeys,
|
||||
selectedKeys: state.selectedKeys,
|
||||
triggerSubMenuAction: _this.props.triggerSubMenuAction,
|
||||
subMenuKey: subMenuKey
|
||||
};
|
||||
return _this.renderCommonMenuItem(c, i, extraProps);
|
||||
};
|
||||
|
||||
props.store.setState({
|
||||
activeKey: _objectSpread({}, props.store.getState().activeKey, _defineProperty({}, props.eventKey, getActiveKey(props, props.activeKey)))
|
||||
});
|
||||
_this.instanceArray = [];
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(SubPopupMenu, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
// invoke customized ref to expose component to mixin
|
||||
if (this.props.manualRef) {
|
||||
this.props.manualRef(this);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(nextProps) {
|
||||
return this.props.visible || nextProps.visible || this.props.className !== nextProps.className || !shallowEqual(this.props.style, nextProps.style);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate(prevProps) {
|
||||
var props = this.props;
|
||||
var originalActiveKey = 'activeKey' in props ? props.activeKey : props.store.getState().activeKey[getEventKey(props)];
|
||||
var activeKey = getActiveKey(props, originalActiveKey);
|
||||
|
||||
if (activeKey !== originalActiveKey) {
|
||||
updateActiveKey(props.store, getEventKey(props), activeKey);
|
||||
} else if ('activeKey' in prevProps) {
|
||||
// If prev activeKey is not same as current activeKey,
|
||||
// we should set it.
|
||||
var prevActiveKey = getActiveKey(prevProps, prevProps.activeKey);
|
||||
|
||||
if (activeKey !== prevActiveKey) {
|
||||
updateActiveKey(props.store, getEventKey(props), activeKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var props = _extends({}, this.props);
|
||||
|
||||
this.instanceArray = [];
|
||||
var className = classNames(props.prefixCls, props.className, "".concat(props.prefixCls, "-").concat(props.mode));
|
||||
var domProps = {
|
||||
className: className,
|
||||
// role could be 'select' and by default set to menu
|
||||
role: props.role || 'menu'
|
||||
};
|
||||
|
||||
if (props.id) {
|
||||
domProps.id = props.id;
|
||||
}
|
||||
|
||||
if (props.focusable) {
|
||||
domProps.tabIndex = 0;
|
||||
domProps.onKeyDown = this.onKeyDown;
|
||||
}
|
||||
|
||||
var prefixCls = props.prefixCls,
|
||||
eventKey = props.eventKey,
|
||||
visible = props.visible,
|
||||
level = props.level,
|
||||
mode = props.mode,
|
||||
overflowedIndicator = props.overflowedIndicator,
|
||||
theme = props.theme;
|
||||
menuAllProps.forEach(function (key) {
|
||||
return delete props[key];
|
||||
}); // Otherwise, the propagated click event will trigger another onClick
|
||||
|
||||
delete props.onClick;
|
||||
return React.createElement(DOMWrap, Object.assign({}, props, {
|
||||
prefixCls: prefixCls,
|
||||
mode: mode,
|
||||
tag: "ul",
|
||||
level: level,
|
||||
theme: theme,
|
||||
visible: visible,
|
||||
overflowedIndicator: overflowedIndicator
|
||||
}, domProps), React.Children.map(props.children, function (c, i) {
|
||||
return _this2.renderMenuItem(c, i, eventKey || '0-menu-');
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
|
||||
return SubPopupMenu;
|
||||
}(React.Component);
|
||||
SubPopupMenu.defaultProps = {
|
||||
prefixCls: 'rc-menu',
|
||||
className: '',
|
||||
mode: 'vertical',
|
||||
level: 1,
|
||||
inlineIndent: 24,
|
||||
visible: true,
|
||||
focusable: true,
|
||||
style: {},
|
||||
manualRef: noop
|
||||
};
|
||||
var connected = connect()(SubPopupMenu);
|
||||
export default connected;
|
||||
7
web/node_modules/rc-menu/es/index.d.ts
generated
vendored
Normal file
7
web/node_modules/rc-menu/es/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import Menu from './Menu';
|
||||
import SubMenu from './SubMenu';
|
||||
import MenuItem from './MenuItem';
|
||||
import MenuItemGroup from './MenuItemGroup';
|
||||
import Divider from './Divider';
|
||||
export { SubMenu, MenuItem as Item, MenuItem, MenuItemGroup, MenuItemGroup as ItemGroup, Divider, };
|
||||
export default Menu;
|
||||
7
web/node_modules/rc-menu/es/index.js
generated
vendored
Normal file
7
web/node_modules/rc-menu/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import Menu from './Menu';
|
||||
import SubMenu from './SubMenu';
|
||||
import MenuItem from './MenuItem';
|
||||
import MenuItemGroup from './MenuItemGroup';
|
||||
import Divider from './Divider';
|
||||
export { SubMenu, MenuItem as Item, MenuItem, MenuItemGroup, MenuItemGroup as ItemGroup, Divider };
|
||||
export default Menu;
|
||||
39
web/node_modules/rc-menu/es/interface.d.ts
generated
vendored
Normal file
39
web/node_modules/rc-menu/es/interface.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/// <reference types="react" />
|
||||
import { TransitionNameType, MotionType } from 'rc-trigger/lib/interface';
|
||||
export declare type RenderIconType = React.ReactNode | ((props: any) => React.ReactNode);
|
||||
export interface MenuInfo {
|
||||
key: React.Key;
|
||||
keyPath: React.Key[];
|
||||
item: React.ReactInstance;
|
||||
domEvent: React.MouseEvent<HTMLElement>;
|
||||
}
|
||||
export interface SelectInfo extends MenuInfo {
|
||||
selectedKeys?: React.Key[];
|
||||
}
|
||||
export declare type SelectEventHandler = (info: SelectInfo) => void;
|
||||
export declare type HoverEventHandler = (info: {
|
||||
key: React.Key;
|
||||
hover: boolean;
|
||||
}) => void;
|
||||
export declare type MenuHoverEventHandler = (info: {
|
||||
key: React.Key;
|
||||
domEvent: React.MouseEvent<HTMLElement>;
|
||||
}) => void;
|
||||
export declare type MenuClickEventHandler = (info: MenuInfo) => void;
|
||||
export declare type DestroyEventHandler = (key: React.Key) => void;
|
||||
export declare type OpenEventHandler = (keys: React.Key[] | {
|
||||
key: React.Key;
|
||||
item: React.ReactInstance;
|
||||
trigger: string;
|
||||
open: boolean;
|
||||
}) => void;
|
||||
export declare type MenuMode = 'horizontal' | 'vertical' | 'vertical-left' | 'vertical-right' | 'inline';
|
||||
export declare type OpenAnimation = string | Record<string, any>;
|
||||
export interface MiniStore {
|
||||
getState: () => any;
|
||||
setState: (state: any) => void;
|
||||
}
|
||||
export declare type LegacyFunctionRef = (node: React.ReactInstance) => void;
|
||||
export declare type BuiltinPlacements = Record<string, any>;
|
||||
export declare type TriggerSubMenuAction = 'click' | 'hover';
|
||||
export { TransitionNameType, MotionType };
|
||||
0
web/node_modules/rc-menu/es/interface.js
generated
vendored
Normal file
0
web/node_modules/rc-menu/es/interface.js
generated
vendored
Normal file
69
web/node_modules/rc-menu/es/placements.d.ts
generated
vendored
Normal file
69
web/node_modules/rc-menu/es/placements.d.ts
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
export declare const placements: {
|
||||
topLeft: {
|
||||
points: string[];
|
||||
overflow: {
|
||||
adjustX: number;
|
||||
adjustY: number;
|
||||
};
|
||||
offset: number[];
|
||||
};
|
||||
bottomLeft: {
|
||||
points: string[];
|
||||
overflow: {
|
||||
adjustX: number;
|
||||
adjustY: number;
|
||||
};
|
||||
offset: number[];
|
||||
};
|
||||
leftTop: {
|
||||
points: string[];
|
||||
overflow: {
|
||||
adjustX: number;
|
||||
adjustY: number;
|
||||
};
|
||||
offset: number[];
|
||||
};
|
||||
rightTop: {
|
||||
points: string[];
|
||||
overflow: {
|
||||
adjustX: number;
|
||||
adjustY: number;
|
||||
};
|
||||
offset: number[];
|
||||
};
|
||||
};
|
||||
export declare const placementsRtl: {
|
||||
topLeft: {
|
||||
points: string[];
|
||||
overflow: {
|
||||
adjustX: number;
|
||||
adjustY: number;
|
||||
};
|
||||
offset: number[];
|
||||
};
|
||||
bottomLeft: {
|
||||
points: string[];
|
||||
overflow: {
|
||||
adjustX: number;
|
||||
adjustY: number;
|
||||
};
|
||||
offset: number[];
|
||||
};
|
||||
rightTop: {
|
||||
points: string[];
|
||||
overflow: {
|
||||
adjustX: number;
|
||||
adjustY: number;
|
||||
};
|
||||
offset: number[];
|
||||
};
|
||||
leftTop: {
|
||||
points: string[];
|
||||
overflow: {
|
||||
adjustX: number;
|
||||
adjustY: number;
|
||||
};
|
||||
offset: number[];
|
||||
};
|
||||
};
|
||||
export default placements;
|
||||
49
web/node_modules/rc-menu/es/placements.js
generated
vendored
Normal file
49
web/node_modules/rc-menu/es/placements.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
var autoAdjustOverflow = {
|
||||
adjustX: 1,
|
||||
adjustY: 1
|
||||
};
|
||||
export var placements = {
|
||||
topLeft: {
|
||||
points: ['bl', 'tl'],
|
||||
overflow: autoAdjustOverflow,
|
||||
offset: [0, -7]
|
||||
},
|
||||
bottomLeft: {
|
||||
points: ['tl', 'bl'],
|
||||
overflow: autoAdjustOverflow,
|
||||
offset: [0, 7]
|
||||
},
|
||||
leftTop: {
|
||||
points: ['tr', 'tl'],
|
||||
overflow: autoAdjustOverflow,
|
||||
offset: [-4, 0]
|
||||
},
|
||||
rightTop: {
|
||||
points: ['tl', 'tr'],
|
||||
overflow: autoAdjustOverflow,
|
||||
offset: [4, 0]
|
||||
}
|
||||
};
|
||||
export var placementsRtl = {
|
||||
topLeft: {
|
||||
points: ['bl', 'tl'],
|
||||
overflow: autoAdjustOverflow,
|
||||
offset: [0, -7]
|
||||
},
|
||||
bottomLeft: {
|
||||
points: ['tl', 'bl'],
|
||||
overflow: autoAdjustOverflow,
|
||||
offset: [0, 7]
|
||||
},
|
||||
rightTop: {
|
||||
points: ['tr', 'tl'],
|
||||
overflow: autoAdjustOverflow,
|
||||
offset: [-4, 0]
|
||||
},
|
||||
leftTop: {
|
||||
points: ['tl', 'tr'],
|
||||
overflow: autoAdjustOverflow,
|
||||
offset: [4, 0]
|
||||
}
|
||||
};
|
||||
export default placements;
|
||||
12
web/node_modules/rc-menu/es/util.d.ts
generated
vendored
Normal file
12
web/node_modules/rc-menu/es/util.d.ts
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
73
web/node_modules/rc-menu/es/util.js
generated
vendored
Normal file
73
web/node_modules/rc-menu/es/util.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; 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); }
|
||||
|
||||
import React from 'react';
|
||||
import isMobile from './utils/isMobile';
|
||||
export function noop() {}
|
||||
export function getKeyFromChildrenIndex(child, menuEventKey, index) {
|
||||
var prefix = menuEventKey || '';
|
||||
return child.key || "".concat(prefix, "item_").concat(index);
|
||||
}
|
||||
export function getMenuIdFromSubMenuEventKey(eventKey) {
|
||||
return "".concat(eventKey, "-menu-");
|
||||
}
|
||||
export function loopMenuItem(children, cb) {
|
||||
var index = -1;
|
||||
React.Children.forEach(children, function (c) {
|
||||
index += 1;
|
||||
|
||||
if (c && c.type && c.type.isMenuItemGroup) {
|
||||
React.Children.forEach(c.props.children, function (c2) {
|
||||
index += 1;
|
||||
cb(c2, index);
|
||||
});
|
||||
} else {
|
||||
cb(c, index);
|
||||
}
|
||||
});
|
||||
}
|
||||
export function loopMenuItemRecursively(children, keys, ret) {
|
||||
/* istanbul ignore if */
|
||||
if (!children || ret.find) {
|
||||
return;
|
||||
}
|
||||
|
||||
React.Children.forEach(children, function (c) {
|
||||
if (c) {
|
||||
var construct = c.type;
|
||||
|
||||
if (!construct || !(construct.isSubMenu || construct.isMenuItem || construct.isMenuItemGroup)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (keys.indexOf(c.key) !== -1) {
|
||||
ret.find = true;
|
||||
} else if (c.props.children) {
|
||||
loopMenuItemRecursively(c.props.children, keys, ret);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
export var menuAllProps = ['defaultSelectedKeys', 'selectedKeys', 'defaultOpenKeys', 'openKeys', 'mode', 'getPopupContainer', 'onSelect', 'onDeselect', 'onDestroy', 'openTransitionName', 'openAnimation', 'subMenuOpenDelay', 'subMenuCloseDelay', 'forceSubMenuRender', 'triggerSubMenuAction', 'level', 'selectable', 'multiple', 'onOpenChange', 'visible', 'focusable', 'defaultActiveFirst', 'prefixCls', 'inlineIndent', 'parentMenu', 'title', 'rootPrefixCls', 'eventKey', 'active', 'onItemHover', 'onTitleMouseEnter', 'onTitleMouseLeave', 'onTitleClick', 'popupAlign', 'popupOffset', 'isOpen', 'renderMenuItem', 'manualRef', 'subMenuKey', 'disabled', 'index', 'isSelected', 'store', 'activeKey', 'builtinPlacements', 'overflowedIndicator', 'motion', // the following keys found need to be removed from test regression
|
||||
'attribute', 'value', 'popupClassName', 'inlineCollapsed', 'menu', 'theme', 'itemIcon', 'expandIcon']; // ref: https://github.com/ant-design/ant-design/issues/14007
|
||||
// ref: https://bugs.chromium.org/p/chromium/issues/detail?id=360889
|
||||
// getBoundingClientRect return the full precision value, which is
|
||||
// not the same behavior as on chrome. Set the precision to 6 to
|
||||
// unify their behavior
|
||||
|
||||
export var getWidth = function getWidth(elem) {
|
||||
var width = elem && typeof elem.getBoundingClientRect === 'function' && elem.getBoundingClientRect().width;
|
||||
|
||||
if (width) {
|
||||
width = +width.toFixed(6);
|
||||
}
|
||||
|
||||
return width || 0;
|
||||
};
|
||||
export var setStyle = function setStyle(elem, styleProperty, value) {
|
||||
if (elem && _typeof(elem.style) === 'object') {
|
||||
elem.style[styleProperty] = value;
|
||||
}
|
||||
};
|
||||
export var isMobileDevice = function isMobileDevice() {
|
||||
return isMobile.any;
|
||||
};
|
||||
70
web/node_modules/rc-menu/es/utils/isMobile.d.ts
generated
vendored
Normal file
70
web/node_modules/rc-menu/es/utils/isMobile.d.ts
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
declare function isMobile(userAgent?: string): {
|
||||
apple: {
|
||||
phone: boolean;
|
||||
ipod: any;
|
||||
tablet: boolean;
|
||||
device: boolean;
|
||||
};
|
||||
amazon: {
|
||||
phone: any;
|
||||
tablet: any;
|
||||
device: any;
|
||||
};
|
||||
android: {
|
||||
phone: any;
|
||||
tablet: any;
|
||||
device: any;
|
||||
};
|
||||
windows: {
|
||||
phone: any;
|
||||
tablet: any;
|
||||
device: any;
|
||||
};
|
||||
other: {
|
||||
blackberry: any;
|
||||
blackberry10: any;
|
||||
opera: any;
|
||||
firefox: any;
|
||||
chrome: any;
|
||||
device: any;
|
||||
};
|
||||
any: any;
|
||||
phone: any;
|
||||
tablet: any;
|
||||
};
|
||||
declare const defaultResult: {
|
||||
isMobile: typeof isMobile;
|
||||
apple: {
|
||||
phone: boolean;
|
||||
ipod: any;
|
||||
tablet: boolean;
|
||||
device: boolean;
|
||||
};
|
||||
amazon: {
|
||||
phone: any;
|
||||
tablet: any;
|
||||
device: any;
|
||||
};
|
||||
android: {
|
||||
phone: any;
|
||||
tablet: any;
|
||||
device: any;
|
||||
};
|
||||
windows: {
|
||||
phone: any;
|
||||
tablet: any;
|
||||
device: any;
|
||||
};
|
||||
other: {
|
||||
blackberry: any;
|
||||
blackberry10: any;
|
||||
opera: any;
|
||||
firefox: any;
|
||||
chrome: any;
|
||||
device: any;
|
||||
};
|
||||
any: any;
|
||||
phone: any;
|
||||
tablet: any;
|
||||
};
|
||||
export default defaultResult;
|
||||
114
web/node_modules/rc-menu/es/utils/isMobile.js
generated
vendored
Normal file
114
web/node_modules/rc-menu/es/utils/isMobile.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
// MIT License from https://github.com/kaimallea/isMobile
|
||||
var applePhone = /iPhone/i;
|
||||
var appleIpod = /iPod/i;
|
||||
var appleTablet = /iPad/i;
|
||||
var androidPhone = /\bAndroid(?:.+)Mobile\b/i; // Match 'Android' AND 'Mobile'
|
||||
|
||||
var androidTablet = /Android/i;
|
||||
var amazonPhone = /\bAndroid(?:.+)SD4930UR\b/i;
|
||||
var amazonTablet = /\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i;
|
||||
var windowsPhone = /Windows Phone/i;
|
||||
var windowsTablet = /\bWindows(?:.+)ARM\b/i; // Match 'Windows' AND 'ARM'
|
||||
|
||||
var otherBlackberry = /BlackBerry/i;
|
||||
var otherBlackberry10 = /BB10/i;
|
||||
var otherOpera = /Opera Mini/i;
|
||||
var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i;
|
||||
var otherFirefox = /Mobile(?:.+)Firefox\b/i; // Match 'Mobile' AND 'Firefox'
|
||||
|
||||
function match(regex, userAgent) {
|
||||
return regex.test(userAgent);
|
||||
}
|
||||
|
||||
function isMobile(userAgent) {
|
||||
var ua = userAgent || (typeof navigator !== 'undefined' ? navigator.userAgent : ''); // Facebook mobile app's integrated browser adds a bunch of strings that
|
||||
// match everything. Strip it out if it exists.
|
||||
|
||||
var tmp = ua.split('[FBAN');
|
||||
|
||||
if (typeof tmp[1] !== 'undefined') {
|
||||
var _tmp = tmp;
|
||||
|
||||
var _tmp2 = _slicedToArray(_tmp, 1);
|
||||
|
||||
ua = _tmp2[0];
|
||||
} // Twitter mobile app's integrated browser on iPad adds a "Twitter for
|
||||
// iPhone" string. Same probably happens on other tablet platforms.
|
||||
// This will confuse detection so strip it out if it exists.
|
||||
|
||||
|
||||
tmp = ua.split('Twitter');
|
||||
|
||||
if (typeof tmp[1] !== 'undefined') {
|
||||
var _tmp3 = tmp;
|
||||
|
||||
var _tmp4 = _slicedToArray(_tmp3, 1);
|
||||
|
||||
ua = _tmp4[0];
|
||||
}
|
||||
|
||||
var result = {
|
||||
apple: {
|
||||
phone: match(applePhone, ua) && !match(windowsPhone, ua),
|
||||
ipod: match(appleIpod, ua),
|
||||
tablet: !match(applePhone, ua) && match(appleTablet, ua) && !match(windowsPhone, ua),
|
||||
device: (match(applePhone, ua) || match(appleIpod, ua) || match(appleTablet, ua)) && !match(windowsPhone, ua)
|
||||
},
|
||||
amazon: {
|
||||
phone: match(amazonPhone, ua),
|
||||
tablet: !match(amazonPhone, ua) && match(amazonTablet, ua),
|
||||
device: match(amazonPhone, ua) || match(amazonTablet, ua)
|
||||
},
|
||||
android: {
|
||||
phone: !match(windowsPhone, ua) && match(amazonPhone, ua) || !match(windowsPhone, ua) && match(androidPhone, ua),
|
||||
tablet: !match(windowsPhone, ua) && !match(amazonPhone, ua) && !match(androidPhone, ua) && (match(amazonTablet, ua) || match(androidTablet, ua)),
|
||||
device: !match(windowsPhone, ua) && (match(amazonPhone, ua) || match(amazonTablet, ua) || match(androidPhone, ua) || match(androidTablet, ua)) || match(/\bokhttp\b/i, ua)
|
||||
},
|
||||
windows: {
|
||||
phone: match(windowsPhone, ua),
|
||||
tablet: match(windowsTablet, ua),
|
||||
device: match(windowsPhone, ua) || match(windowsTablet, ua)
|
||||
},
|
||||
other: {
|
||||
blackberry: match(otherBlackberry, ua),
|
||||
blackberry10: match(otherBlackberry10, ua),
|
||||
opera: match(otherOpera, ua),
|
||||
firefox: match(otherFirefox, ua),
|
||||
chrome: match(otherChrome, ua),
|
||||
device: match(otherBlackberry, ua) || match(otherBlackberry10, ua) || match(otherOpera, ua) || match(otherFirefox, ua) || match(otherChrome, ua)
|
||||
},
|
||||
// Additional
|
||||
any: null,
|
||||
phone: null,
|
||||
tablet: null
|
||||
};
|
||||
result.any = result.apple.device || result.android.device || result.windows.device || result.other.device; // excludes 'other' devices and ipods, targeting touchscreen phones
|
||||
|
||||
result.phone = result.apple.phone || result.android.phone || result.windows.phone;
|
||||
result.tablet = result.apple.tablet || result.android.tablet || result.windows.tablet;
|
||||
return result;
|
||||
}
|
||||
|
||||
var defaultResult = _objectSpread({}, isMobile(), {
|
||||
isMobile: isMobile
|
||||
});
|
||||
|
||||
export default defaultResult;
|
||||
9
web/node_modules/rc-menu/es/utils/legacyUtil.d.ts
generated
vendored
Normal file
9
web/node_modules/rc-menu/es/utils/legacyUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { MotionType, TransitionNameType, OpenAnimation } from '../interface';
|
||||
interface GetMotionProps {
|
||||
motion?: MotionType;
|
||||
openAnimation?: OpenAnimation;
|
||||
openTransitionName?: TransitionNameType;
|
||||
prefixCls?: string;
|
||||
}
|
||||
export declare function getMotion({ prefixCls, motion, openAnimation, openTransitionName, }: GetMotionProps): MotionType;
|
||||
export {};
|
||||
29
web/node_modules/rc-menu/es/utils/legacyUtil.js
generated
vendored
Normal file
29
web/node_modules/rc-menu/es/utils/legacyUtil.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; 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); }
|
||||
|
||||
import warning from "rc-util/es/warning";
|
||||
export function getMotion(_ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
motion = _ref.motion,
|
||||
openAnimation = _ref.openAnimation,
|
||||
openTransitionName = _ref.openTransitionName;
|
||||
|
||||
if (motion) {
|
||||
return motion;
|
||||
}
|
||||
|
||||
if (_typeof(openAnimation) === 'object' && openAnimation) {
|
||||
warning(false, 'Object type of `openAnimation` is removed. Please use `motion` instead.');
|
||||
} else if (typeof openAnimation === 'string') {
|
||||
return {
|
||||
motionName: "".concat(prefixCls, "-open-").concat(openAnimation)
|
||||
};
|
||||
}
|
||||
|
||||
if (openTransitionName) {
|
||||
return {
|
||||
motionName: openTransitionName
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user