You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2226 lines
80 KiB
2226 lines
80 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[37229],{
|
|
|
|
/***/ 18785:
|
|
/*!**********************************************************************************************************!*\
|
|
!*** ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/EllipsisOutlined.js + 1 modules ***!
|
|
\**********************************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ icons_EllipsisOutlined; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(14809);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/EllipsisOutlined.js
|
|
// This icon file is generated automatically.
|
|
var EllipsisOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "ellipsis", "theme": "outlined" };
|
|
/* harmony default export */ var asn_EllipsisOutlined = (EllipsisOutlined);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(7657);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/EllipsisOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var EllipsisOutlined_EllipsisOutlined = function EllipsisOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_EllipsisOutlined
|
|
}));
|
|
};
|
|
|
|
/** */
|
|
var RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(EllipsisOutlined_EllipsisOutlined);
|
|
if (false) {}
|
|
/* harmony default export */ var icons_EllipsisOutlined = (RefIcon);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 15285:
|
|
/*!***********************************************************************!*\
|
|
!*** ./node_modules/_rc-menu@9.12.4@rc-menu/es/index.js + 26 modules ***!
|
|
\***********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
iz: function() { return /* reexport */ Divider; },
|
|
ck: function() { return /* reexport */ es_MenuItem; },
|
|
BW: function() { return /* reexport */ MenuItemGroup; },
|
|
sN: function() { return /* reexport */ es_MenuItem; },
|
|
Wd: function() { return /* reexport */ SubMenu; },
|
|
ZP: function() { return /* binding */ _rc_menu_9_12_4_rc_menu_es; },
|
|
Xl: function() { return /* reexport */ useFullPath; }
|
|
});
|
|
|
|
// UNUSED EXPORTS: MenuItemGroup
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(14809);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(4635);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(20439);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__(95190);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__(50298);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(62646);
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
|
|
var _classnames_2_5_1_classnames = __webpack_require__(92310);
|
|
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-overflow@1.4.1@rc-overflow/es/index.js + 6 modules
|
|
var es = __webpack_require__(11780);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/hooks/useMergedState.js
|
|
var useMergedState = __webpack_require__(18929);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/isEqual.js
|
|
var isEqual = __webpack_require__(13697);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/warning.js
|
|
var warning = __webpack_require__(48736);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_react-dom@17.0.2@react-dom/index.js
|
|
var _react_dom_17_0_2_react_dom = __webpack_require__(4676);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/context/IdContext.js
|
|
|
|
var IdContext = /*#__PURE__*/_react_17_0_2_react.createContext(null);
|
|
function getMenuId(uuid, eventKey) {
|
|
if (uuid === undefined) {
|
|
return null;
|
|
}
|
|
return "".concat(uuid, "-").concat(eventKey);
|
|
}
|
|
|
|
/**
|
|
* Get `data-menu-id`
|
|
*/
|
|
function useMenuId(eventKey) {
|
|
var id = _react_17_0_2_react.useContext(IdContext);
|
|
return getMenuId(id, eventKey);
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/hooks/useMemo.js
|
|
var useMemo = __webpack_require__(80547);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/context/MenuContext.js
|
|
|
|
|
|
var _excluded = ["children", "locked"];
|
|
|
|
|
|
|
|
var MenuContext = /*#__PURE__*/_react_17_0_2_react.createContext(null);
|
|
function mergeProps(origin, target) {
|
|
var clone = (0,objectSpread2/* default */.Z)({}, origin);
|
|
Object.keys(target).forEach(function (key) {
|
|
var value = target[key];
|
|
if (value !== undefined) {
|
|
clone[key] = value;
|
|
}
|
|
});
|
|
return clone;
|
|
}
|
|
function InheritableContextProvider(_ref) {
|
|
var children = _ref.children,
|
|
locked = _ref.locked,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(_ref, _excluded);
|
|
var context = _react_17_0_2_react.useContext(MenuContext);
|
|
var inheritableContext = (0,useMemo/* default */.Z)(function () {
|
|
return mergeProps(context, restProps);
|
|
}, [context, restProps], function (prev, next) {
|
|
return !locked && (prev[0] !== next[0] || !(0,isEqual/* default */.Z)(prev[1], next[1], true));
|
|
});
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(MenuContext.Provider, {
|
|
value: inheritableContext
|
|
}, children);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/context/PathContext.js
|
|
|
|
|
|
var EmptyList = [];
|
|
|
|
// ========================= Path Register =========================
|
|
|
|
var PathRegisterContext = /*#__PURE__*/_react_17_0_2_react.createContext(null);
|
|
function useMeasure() {
|
|
return _react_17_0_2_react.useContext(PathRegisterContext);
|
|
}
|
|
|
|
// ========================= Path Tracker ==========================
|
|
var PathTrackerContext = /*#__PURE__*/_react_17_0_2_react.createContext(EmptyList);
|
|
function useFullPath(eventKey) {
|
|
var parentKeyPath = _react_17_0_2_react.useContext(PathTrackerContext);
|
|
return _react_17_0_2_react.useMemo(function () {
|
|
return eventKey !== undefined ? [].concat((0,toConsumableArray/* default */.Z)(parentKeyPath), [eventKey]) : parentKeyPath;
|
|
}, [parentKeyPath, eventKey]);
|
|
}
|
|
|
|
// =========================== Path User ===========================
|
|
|
|
var PathUserContext = /*#__PURE__*/_react_17_0_2_react.createContext(null);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/context/PrivateContext.js
|
|
|
|
var PrivateContext = /*#__PURE__*/_react_17_0_2_react.createContext({});
|
|
/* harmony default export */ var context_PrivateContext = (PrivateContext);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/Dom/isVisible.js
|
|
var isVisible = __webpack_require__(29194);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/Dom/focus.js
|
|
|
|
|
|
function focusable(node) {
|
|
var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
if ((0,isVisible/* default */.Z)(node)) {
|
|
var nodeName = node.nodeName.toLowerCase();
|
|
var isFocusableElement =
|
|
// Focusable element
|
|
['input', 'select', 'textarea', 'button'].includes(nodeName) ||
|
|
// Editable element
|
|
node.isContentEditable ||
|
|
// Anchor with href element
|
|
nodeName === 'a' && !!node.getAttribute('href');
|
|
|
|
// Get tabIndex
|
|
var tabIndexAttr = node.getAttribute('tabindex');
|
|
var tabIndexNum = Number(tabIndexAttr);
|
|
|
|
// Parse as number if validate
|
|
var tabIndex = null;
|
|
if (tabIndexAttr && !Number.isNaN(tabIndexNum)) {
|
|
tabIndex = tabIndexNum;
|
|
} else if (isFocusableElement && tabIndex === null) {
|
|
tabIndex = 0;
|
|
}
|
|
|
|
// Block focusable if disabled
|
|
if (isFocusableElement && node.disabled) {
|
|
tabIndex = null;
|
|
}
|
|
return tabIndex !== null && (tabIndex >= 0 || includePositive && tabIndex < 0);
|
|
}
|
|
return false;
|
|
}
|
|
function getFocusNodeList(node) {
|
|
var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
var res = (0,toConsumableArray/* default */.Z)(node.querySelectorAll('*')).filter(function (child) {
|
|
return focusable(child, includePositive);
|
|
});
|
|
if (focusable(node, includePositive)) {
|
|
res.unshift(node);
|
|
}
|
|
return res;
|
|
}
|
|
var lastFocusElement = null;
|
|
|
|
/** @deprecated Do not use since this may failed when used in async */
|
|
function saveLastFocusNode() {
|
|
lastFocusElement = document.activeElement;
|
|
}
|
|
|
|
/** @deprecated Do not use since this may failed when used in async */
|
|
function clearLastFocusNode() {
|
|
lastFocusElement = null;
|
|
}
|
|
|
|
/** @deprecated Do not use since this may failed when used in async */
|
|
function backLastFocusNode() {
|
|
if (lastFocusElement) {
|
|
try {
|
|
// 元素可能已经被移动了
|
|
lastFocusElement.focus();
|
|
|
|
/* eslint-disable no-empty */
|
|
} catch (e) {
|
|
// empty
|
|
}
|
|
/* eslint-enable no-empty */
|
|
}
|
|
}
|
|
function limitTabRange(node, e) {
|
|
if (e.keyCode === 9) {
|
|
var tabNodeList = getFocusNodeList(node);
|
|
var lastTabNode = tabNodeList[e.shiftKey ? 0 : tabNodeList.length - 1];
|
|
var leavingTab = lastTabNode === document.activeElement || node === document.activeElement;
|
|
if (leavingTab) {
|
|
var target = tabNodeList[e.shiftKey ? tabNodeList.length - 1 : 0];
|
|
target.focus();
|
|
e.preventDefault();
|
|
}
|
|
}
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__(10228);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/raf.js
|
|
var raf = __webpack_require__(16089);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/hooks/useAccessibility.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// destruct to reduce minify size
|
|
var LEFT = KeyCode/* default */.Z.LEFT,
|
|
RIGHT = KeyCode/* default */.Z.RIGHT,
|
|
UP = KeyCode/* default */.Z.UP,
|
|
DOWN = KeyCode/* default */.Z.DOWN,
|
|
ENTER = KeyCode/* default */.Z.ENTER,
|
|
ESC = KeyCode/* default */.Z.ESC,
|
|
HOME = KeyCode/* default */.Z.HOME,
|
|
END = KeyCode/* default */.Z.END;
|
|
var ArrowKeys = [UP, DOWN, LEFT, RIGHT];
|
|
function getOffset(mode, isRootLevel, isRtl, which) {
|
|
var _inline, _horizontal, _vertical, _offsets;
|
|
var prev = 'prev';
|
|
var next = 'next';
|
|
var children = 'children';
|
|
var parent = 'parent';
|
|
|
|
// Inline enter is special that we use unique operation
|
|
if (mode === 'inline' && which === ENTER) {
|
|
return {
|
|
inlineTrigger: true
|
|
};
|
|
}
|
|
var inline = (_inline = {}, (0,defineProperty/* default */.Z)(_inline, UP, prev), (0,defineProperty/* default */.Z)(_inline, DOWN, next), _inline);
|
|
var horizontal = (_horizontal = {}, (0,defineProperty/* default */.Z)(_horizontal, LEFT, isRtl ? next : prev), (0,defineProperty/* default */.Z)(_horizontal, RIGHT, isRtl ? prev : next), (0,defineProperty/* default */.Z)(_horizontal, DOWN, children), (0,defineProperty/* default */.Z)(_horizontal, ENTER, children), _horizontal);
|
|
var vertical = (_vertical = {}, (0,defineProperty/* default */.Z)(_vertical, UP, prev), (0,defineProperty/* default */.Z)(_vertical, DOWN, next), (0,defineProperty/* default */.Z)(_vertical, ENTER, children), (0,defineProperty/* default */.Z)(_vertical, ESC, parent), (0,defineProperty/* default */.Z)(_vertical, LEFT, isRtl ? children : parent), (0,defineProperty/* default */.Z)(_vertical, RIGHT, isRtl ? parent : children), _vertical);
|
|
var offsets = {
|
|
inline: inline,
|
|
horizontal: horizontal,
|
|
vertical: vertical,
|
|
inlineSub: inline,
|
|
horizontalSub: vertical,
|
|
verticalSub: vertical
|
|
};
|
|
var type = (_offsets = offsets["".concat(mode).concat(isRootLevel ? '' : 'Sub')]) === null || _offsets === void 0 ? void 0 : _offsets[which];
|
|
switch (type) {
|
|
case prev:
|
|
return {
|
|
offset: -1,
|
|
sibling: true
|
|
};
|
|
case next:
|
|
return {
|
|
offset: 1,
|
|
sibling: true
|
|
};
|
|
case parent:
|
|
return {
|
|
offset: -1,
|
|
sibling: false
|
|
};
|
|
case children:
|
|
return {
|
|
offset: 1,
|
|
sibling: false
|
|
};
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
function findContainerUL(element) {
|
|
var current = element;
|
|
while (current) {
|
|
if (current.getAttribute('data-menu-list')) {
|
|
return current;
|
|
}
|
|
current = current.parentElement;
|
|
}
|
|
|
|
// Normally should not reach this line
|
|
/* istanbul ignore next */
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Find focused element within element set provided
|
|
*/
|
|
function getFocusElement(activeElement, elements) {
|
|
var current = activeElement || document.activeElement;
|
|
while (current) {
|
|
if (elements.has(current)) {
|
|
return current;
|
|
}
|
|
current = current.parentElement;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Get focusable elements from the element set under provided container
|
|
*/
|
|
function getFocusableElements(container, elements) {
|
|
var list = getFocusNodeList(container, true);
|
|
return list.filter(function (ele) {
|
|
return elements.has(ele);
|
|
});
|
|
}
|
|
function getNextFocusElement(parentQueryContainer, elements, focusMenuElement) {
|
|
var offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
// Key on the menu item will not get validate parent container
|
|
if (!parentQueryContainer) {
|
|
return null;
|
|
}
|
|
|
|
// List current level menu item elements
|
|
var sameLevelFocusableMenuElementList = getFocusableElements(parentQueryContainer, elements);
|
|
|
|
// Find next focus index
|
|
var count = sameLevelFocusableMenuElementList.length;
|
|
var focusIndex = sameLevelFocusableMenuElementList.findIndex(function (ele) {
|
|
return focusMenuElement === ele;
|
|
});
|
|
if (offset < 0) {
|
|
if (focusIndex === -1) {
|
|
focusIndex = count - 1;
|
|
} else {
|
|
focusIndex -= 1;
|
|
}
|
|
} else if (offset > 0) {
|
|
focusIndex += 1;
|
|
}
|
|
focusIndex = (focusIndex + count) % count;
|
|
|
|
// Focus menu item
|
|
return sameLevelFocusableMenuElementList[focusIndex];
|
|
}
|
|
var refreshElements = function refreshElements(keys, id) {
|
|
var elements = new Set();
|
|
var key2element = new Map();
|
|
var element2key = new Map();
|
|
keys.forEach(function (key) {
|
|
var element = document.querySelector("[data-menu-id='".concat(getMenuId(id, key), "']"));
|
|
if (element) {
|
|
elements.add(element);
|
|
element2key.set(element, key);
|
|
key2element.set(key, element);
|
|
}
|
|
});
|
|
return {
|
|
elements: elements,
|
|
key2element: key2element,
|
|
element2key: element2key
|
|
};
|
|
};
|
|
function useAccessibility(mode, activeKey, isRtl, id, containerRef, getKeys, getKeyPath, triggerActiveKey, triggerAccessibilityOpen, originOnKeyDown) {
|
|
var rafRef = _react_17_0_2_react.useRef();
|
|
var activeRef = _react_17_0_2_react.useRef();
|
|
activeRef.current = activeKey;
|
|
var cleanRaf = function cleanRaf() {
|
|
raf/* default */.Z.cancel(rafRef.current);
|
|
};
|
|
_react_17_0_2_react.useEffect(function () {
|
|
return function () {
|
|
cleanRaf();
|
|
};
|
|
}, []);
|
|
return function (e) {
|
|
var which = e.which;
|
|
if ([].concat(ArrowKeys, [ENTER, ESC, HOME, END]).includes(which)) {
|
|
var keys = getKeys();
|
|
var refreshedElements = refreshElements(keys, id);
|
|
var _refreshedElements = refreshedElements,
|
|
elements = _refreshedElements.elements,
|
|
key2element = _refreshedElements.key2element,
|
|
element2key = _refreshedElements.element2key;
|
|
|
|
// First we should find current focused MenuItem/SubMenu element
|
|
var activeElement = key2element.get(activeKey);
|
|
var focusMenuElement = getFocusElement(activeElement, elements);
|
|
var focusMenuKey = element2key.get(focusMenuElement);
|
|
var offsetObj = getOffset(mode, getKeyPath(focusMenuKey, true).length === 1, isRtl, which);
|
|
|
|
// Some mode do not have fully arrow operation like inline
|
|
if (!offsetObj && which !== HOME && which !== END) {
|
|
return;
|
|
}
|
|
|
|
// Arrow prevent default to avoid page scroll
|
|
if (ArrowKeys.includes(which) || [HOME, END].includes(which)) {
|
|
e.preventDefault();
|
|
}
|
|
var tryFocus = function tryFocus(menuElement) {
|
|
if (menuElement) {
|
|
var focusTargetElement = menuElement;
|
|
|
|
// Focus to link instead of menu item if possible
|
|
var link = menuElement.querySelector('a');
|
|
if (link !== null && link !== void 0 && link.getAttribute('href')) {
|
|
focusTargetElement = link;
|
|
}
|
|
var targetKey = element2key.get(menuElement);
|
|
triggerActiveKey(targetKey);
|
|
|
|
/**
|
|
* Do not `useEffect` here since `tryFocus` may trigger async
|
|
* which makes React sync update the `activeKey`
|
|
* that force render before `useRef` set the next activeKey
|
|
*/
|
|
cleanRaf();
|
|
rafRef.current = (0,raf/* default */.Z)(function () {
|
|
if (activeRef.current === targetKey) {
|
|
focusTargetElement.focus();
|
|
}
|
|
});
|
|
}
|
|
};
|
|
if ([HOME, END].includes(which) || offsetObj.sibling || !focusMenuElement) {
|
|
// ========================== Sibling ==========================
|
|
// Find walkable focus menu element container
|
|
var parentQueryContainer;
|
|
if (!focusMenuElement || mode === 'inline') {
|
|
parentQueryContainer = containerRef.current;
|
|
} else {
|
|
parentQueryContainer = findContainerUL(focusMenuElement);
|
|
}
|
|
|
|
// Get next focus element
|
|
var targetElement;
|
|
var focusableElements = getFocusableElements(parentQueryContainer, elements);
|
|
if (which === HOME) {
|
|
targetElement = focusableElements[0];
|
|
} else if (which === END) {
|
|
targetElement = focusableElements[focusableElements.length - 1];
|
|
} else {
|
|
targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset);
|
|
}
|
|
// Focus menu item
|
|
tryFocus(targetElement);
|
|
|
|
// ======================= InlineTrigger =======================
|
|
} else if (offsetObj.inlineTrigger) {
|
|
// Inline trigger no need switch to sub menu item
|
|
triggerAccessibilityOpen(focusMenuKey);
|
|
// =========================== Level ===========================
|
|
} else if (offsetObj.offset > 0) {
|
|
triggerAccessibilityOpen(focusMenuKey, true);
|
|
cleanRaf();
|
|
rafRef.current = (0,raf/* default */.Z)(function () {
|
|
// Async should resync elements
|
|
refreshedElements = refreshElements(keys, id);
|
|
var controlId = focusMenuElement.getAttribute('aria-controls');
|
|
var subQueryContainer = document.getElementById(controlId);
|
|
|
|
// Get sub focusable menu item
|
|
var targetElement = getNextFocusElement(subQueryContainer, refreshedElements.elements);
|
|
|
|
// Focus menu item
|
|
tryFocus(targetElement);
|
|
}, 5);
|
|
} else if (offsetObj.offset < 0) {
|
|
var keyPath = getKeyPath(focusMenuKey, true);
|
|
var parentKey = keyPath[keyPath.length - 2];
|
|
var parentMenuElement = key2element.get(parentKey);
|
|
|
|
// Focus menu item
|
|
triggerAccessibilityOpen(parentKey, false);
|
|
tryFocus(parentMenuElement);
|
|
}
|
|
}
|
|
|
|
// Pass origin key down event
|
|
originOnKeyDown === null || originOnKeyDown === void 0 || originOnKeyDown(e);
|
|
};
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/utils/timeUtil.js
|
|
function nextSlice(callback) {
|
|
/* istanbul ignore next */
|
|
Promise.resolve().then(callback);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/hooks/useKeyRecords.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var PATH_SPLIT = '__RC_UTIL_PATH_SPLIT__';
|
|
var getPathStr = function getPathStr(keyPath) {
|
|
return keyPath.join(PATH_SPLIT);
|
|
};
|
|
var getPathKeys = function getPathKeys(keyPathStr) {
|
|
return keyPathStr.split(PATH_SPLIT);
|
|
};
|
|
var OVERFLOW_KEY = 'rc-menu-more';
|
|
function useKeyRecords() {
|
|
var _React$useState = _react_17_0_2_react.useState({}),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
internalForceUpdate = _React$useState2[1];
|
|
var key2pathRef = (0,_react_17_0_2_react.useRef)(new Map());
|
|
var path2keyRef = (0,_react_17_0_2_react.useRef)(new Map());
|
|
var _React$useState3 = _react_17_0_2_react.useState([]),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
overflowKeys = _React$useState4[0],
|
|
setOverflowKeys = _React$useState4[1];
|
|
var updateRef = (0,_react_17_0_2_react.useRef)(0);
|
|
var destroyRef = (0,_react_17_0_2_react.useRef)(false);
|
|
var forceUpdate = function forceUpdate() {
|
|
if (!destroyRef.current) {
|
|
internalForceUpdate({});
|
|
}
|
|
};
|
|
var registerPath = (0,_react_17_0_2_react.useCallback)(function (key, keyPath) {
|
|
// Warning for invalidate or duplicated `key`
|
|
if (false) {}
|
|
|
|
// Fill map
|
|
var connectedPath = getPathStr(keyPath);
|
|
path2keyRef.current.set(connectedPath, key);
|
|
key2pathRef.current.set(key, connectedPath);
|
|
updateRef.current += 1;
|
|
var id = updateRef.current;
|
|
nextSlice(function () {
|
|
if (id === updateRef.current) {
|
|
forceUpdate();
|
|
}
|
|
});
|
|
}, []);
|
|
var unregisterPath = (0,_react_17_0_2_react.useCallback)(function (key, keyPath) {
|
|
var connectedPath = getPathStr(keyPath);
|
|
path2keyRef.current.delete(connectedPath);
|
|
key2pathRef.current.delete(key);
|
|
}, []);
|
|
var refreshOverflowKeys = (0,_react_17_0_2_react.useCallback)(function (keys) {
|
|
setOverflowKeys(keys);
|
|
}, []);
|
|
var getKeyPath = (0,_react_17_0_2_react.useCallback)(function (eventKey, includeOverflow) {
|
|
var fullPath = key2pathRef.current.get(eventKey) || '';
|
|
var keys = getPathKeys(fullPath);
|
|
if (includeOverflow && overflowKeys.includes(keys[0])) {
|
|
keys.unshift(OVERFLOW_KEY);
|
|
}
|
|
return keys;
|
|
}, [overflowKeys]);
|
|
var isSubPathKey = (0,_react_17_0_2_react.useCallback)(function (pathKeys, eventKey) {
|
|
return pathKeys.some(function (pathKey) {
|
|
var pathKeyList = getKeyPath(pathKey, true);
|
|
return pathKeyList.includes(eventKey);
|
|
});
|
|
}, [getKeyPath]);
|
|
var getKeys = function getKeys() {
|
|
var keys = (0,toConsumableArray/* default */.Z)(key2pathRef.current.keys());
|
|
if (overflowKeys.length) {
|
|
keys.push(OVERFLOW_KEY);
|
|
}
|
|
return keys;
|
|
};
|
|
|
|
/**
|
|
* Find current key related child path keys
|
|
*/
|
|
var getSubPathKeys = (0,_react_17_0_2_react.useCallback)(function (key) {
|
|
var connectedPath = "".concat(key2pathRef.current.get(key)).concat(PATH_SPLIT);
|
|
var pathKeys = new Set();
|
|
(0,toConsumableArray/* default */.Z)(path2keyRef.current.keys()).forEach(function (pathKey) {
|
|
if (pathKey.startsWith(connectedPath)) {
|
|
pathKeys.add(path2keyRef.current.get(pathKey));
|
|
}
|
|
});
|
|
return pathKeys;
|
|
}, []);
|
|
_react_17_0_2_react.useEffect(function () {
|
|
return function () {
|
|
destroyRef.current = true;
|
|
};
|
|
}, []);
|
|
return {
|
|
// Register
|
|
registerPath: registerPath,
|
|
unregisterPath: unregisterPath,
|
|
refreshOverflowKeys: refreshOverflowKeys,
|
|
// Util
|
|
isSubPathKey: isSubPathKey,
|
|
getKeyPath: getKeyPath,
|
|
getKeys: getKeys,
|
|
getSubPathKeys: getSubPathKeys
|
|
};
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/hooks/useMemoCallback.js
|
|
|
|
|
|
/**
|
|
* Cache callback function that always return same ref instead.
|
|
* This is used for context optimization.
|
|
*/
|
|
function useMemoCallback(func) {
|
|
var funRef = _react_17_0_2_react.useRef(func);
|
|
funRef.current = func;
|
|
var callback = _react_17_0_2_react.useCallback(function () {
|
|
var _funRef$current;
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
return (_funRef$current = funRef.current) === null || _funRef$current === void 0 ? void 0 : _funRef$current.call.apply(_funRef$current, [funRef].concat(args));
|
|
}, []);
|
|
return func ? callback : undefined;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/hooks/useUUID.js
|
|
|
|
|
|
|
|
var uniquePrefix = Math.random().toFixed(5).toString().slice(2);
|
|
var internalId = 0;
|
|
function useUUID(id) {
|
|
var _useMergedState = (0,useMergedState/* default */.Z)(id, {
|
|
value: id
|
|
}),
|
|
_useMergedState2 = (0,slicedToArray/* default */.Z)(_useMergedState, 2),
|
|
uuid = _useMergedState2[0],
|
|
setUUID = _useMergedState2[1];
|
|
_react_17_0_2_react.useEffect(function () {
|
|
internalId += 1;
|
|
var newId = false ? 0 : "".concat(uniquePrefix, "-").concat(internalId);
|
|
setUUID("rc-menu-uuid-".concat(newId));
|
|
}, []);
|
|
return uuid;
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__(99153);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__(84851);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__(19257);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__(73571);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/omit.js
|
|
var omit = __webpack_require__(2738);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/ref.js
|
|
var es_ref = __webpack_require__(8654);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/hooks/useActive.js
|
|
|
|
|
|
function useActive(eventKey, disabled, onMouseEnter, onMouseLeave) {
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
activeKey = _React$useContext.activeKey,
|
|
onActive = _React$useContext.onActive,
|
|
onInactive = _React$useContext.onInactive;
|
|
var ret = {
|
|
active: activeKey === eventKey
|
|
};
|
|
|
|
// Skip when disabled
|
|
if (!disabled) {
|
|
ret.onMouseEnter = function (domEvent) {
|
|
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
|
|
key: eventKey,
|
|
domEvent: domEvent
|
|
});
|
|
onActive(eventKey);
|
|
};
|
|
ret.onMouseLeave = function (domEvent) {
|
|
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
|
|
key: eventKey,
|
|
domEvent: domEvent
|
|
});
|
|
onInactive(eventKey);
|
|
};
|
|
}
|
|
return ret;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/hooks/useDirectionStyle.js
|
|
|
|
|
|
function useDirectionStyle(level) {
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
mode = _React$useContext.mode,
|
|
rtl = _React$useContext.rtl,
|
|
inlineIndent = _React$useContext.inlineIndent;
|
|
if (mode !== 'inline') {
|
|
return null;
|
|
}
|
|
var len = level;
|
|
return rtl ? {
|
|
paddingRight: len * inlineIndent
|
|
} : {
|
|
paddingLeft: len * inlineIndent
|
|
};
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/Icon.js
|
|
|
|
|
|
function Icon(_ref) {
|
|
var icon = _ref.icon,
|
|
props = _ref.props,
|
|
children = _ref.children;
|
|
var iconNode;
|
|
if (icon === null || icon === false) {
|
|
return null;
|
|
}
|
|
if (typeof icon === 'function') {
|
|
iconNode = /*#__PURE__*/_react_17_0_2_react.createElement(icon, (0,objectSpread2/* default */.Z)({}, props));
|
|
} else if (typeof icon !== "boolean") {
|
|
// Compatible for origin definition
|
|
iconNode = icon;
|
|
}
|
|
return iconNode || children || null;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/utils/warnUtil.js
|
|
|
|
var warnUtil_excluded = ["item"];
|
|
|
|
|
|
/**
|
|
* `onClick` event return `info.item` which point to react node directly.
|
|
* We should warning this since it will not work on FC.
|
|
*/
|
|
function warnItemProp(_ref) {
|
|
var item = _ref.item,
|
|
restInfo = (0,objectWithoutProperties/* default */.Z)(_ref, warnUtil_excluded);
|
|
Object.defineProperty(restInfo, 'item', {
|
|
get: function get() {
|
|
(0,warning/* default */.ZP)(false, '`info.item` is deprecated since we will move to function component that not provides React Node instance in future.');
|
|
return item;
|
|
}
|
|
});
|
|
return restInfo;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/MenuItem.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MenuItem_excluded = ["title", "attribute", "elementRef"],
|
|
_excluded2 = ["style", "className", "eventKey", "warnKey", "disabled", "itemIcon", "children", "role", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "onFocus"],
|
|
_excluded3 = ["active"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Since Menu event provide the `info.item` which point to the MenuItem node instance.
|
|
// We have to use class component here.
|
|
// This should be removed from doc & api in future.
|
|
var LegacyMenuItem = /*#__PURE__*/function (_React$Component) {
|
|
(0,inherits/* default */.Z)(LegacyMenuItem, _React$Component);
|
|
var _super = (0,createSuper/* default */.Z)(LegacyMenuItem);
|
|
function LegacyMenuItem() {
|
|
(0,classCallCheck/* default */.Z)(this, LegacyMenuItem);
|
|
return _super.apply(this, arguments);
|
|
}
|
|
(0,createClass/* default */.Z)(LegacyMenuItem, [{
|
|
key: "render",
|
|
value: function render() {
|
|
var _this$props = this.props,
|
|
title = _this$props.title,
|
|
attribute = _this$props.attribute,
|
|
elementRef = _this$props.elementRef,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(_this$props, MenuItem_excluded);
|
|
|
|
// Here the props are eventually passed to the DOM element.
|
|
// React does not recognize non-standard attributes.
|
|
// Therefore, remove the props that is not used here.
|
|
// ref: https://github.com/ant-design/ant-design/issues/41395
|
|
var passedProps = (0,omit/* default */.Z)(restProps, ['eventKey', 'popupClassName', 'popupOffset', 'onTitleClick']);
|
|
(0,warning/* default */.ZP)(!attribute, '`attribute` of Menu.Item is deprecated. Please pass attribute directly.');
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z.Item, (0,esm_extends/* default */.Z)({}, attribute, {
|
|
title: typeof title === 'string' ? title : undefined
|
|
}, passedProps, {
|
|
ref: elementRef
|
|
}));
|
|
}
|
|
}]);
|
|
return LegacyMenuItem;
|
|
}(_react_17_0_2_react.Component);
|
|
/**
|
|
* Real Menu Item component
|
|
*/
|
|
var InternalMenuItem = /*#__PURE__*/_react_17_0_2_react.forwardRef(function (props, ref) {
|
|
var _classNames;
|
|
var style = props.style,
|
|
className = props.className,
|
|
eventKey = props.eventKey,
|
|
warnKey = props.warnKey,
|
|
disabled = props.disabled,
|
|
itemIcon = props.itemIcon,
|
|
children = props.children,
|
|
role = props.role,
|
|
onMouseEnter = props.onMouseEnter,
|
|
onMouseLeave = props.onMouseLeave,
|
|
onClick = props.onClick,
|
|
onKeyDown = props.onKeyDown,
|
|
onFocus = props.onFocus,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, _excluded2);
|
|
var domDataId = useMenuId(eventKey);
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
onItemClick = _React$useContext.onItemClick,
|
|
contextDisabled = _React$useContext.disabled,
|
|
overflowDisabled = _React$useContext.overflowDisabled,
|
|
contextItemIcon = _React$useContext.itemIcon,
|
|
selectedKeys = _React$useContext.selectedKeys,
|
|
onActive = _React$useContext.onActive;
|
|
var _React$useContext2 = _react_17_0_2_react.useContext(context_PrivateContext),
|
|
_internalRenderMenuItem = _React$useContext2._internalRenderMenuItem;
|
|
var itemCls = "".concat(prefixCls, "-item");
|
|
var legacyMenuItemRef = _react_17_0_2_react.useRef();
|
|
var elementRef = _react_17_0_2_react.useRef();
|
|
var mergedDisabled = contextDisabled || disabled;
|
|
var mergedEleRef = (0,es_ref/* useComposeRef */.x1)(ref, elementRef);
|
|
var connectedKeys = useFullPath(eventKey);
|
|
|
|
// ================================ Warn ================================
|
|
if (false) {}
|
|
|
|
// ============================= Info =============================
|
|
var getEventInfo = function getEventInfo(e) {
|
|
return {
|
|
key: eventKey,
|
|
// Note: For legacy code is reversed which not like other antd component
|
|
keyPath: (0,toConsumableArray/* default */.Z)(connectedKeys).reverse(),
|
|
item: legacyMenuItemRef.current,
|
|
domEvent: e
|
|
};
|
|
};
|
|
|
|
// ============================= Icon =============================
|
|
var mergedItemIcon = itemIcon || contextItemIcon;
|
|
|
|
// ============================ Active ============================
|
|
var _useActive = useActive(eventKey, mergedDisabled, onMouseEnter, onMouseLeave),
|
|
active = _useActive.active,
|
|
activeProps = (0,objectWithoutProperties/* default */.Z)(_useActive, _excluded3);
|
|
|
|
// ============================ Select ============================
|
|
var selected = selectedKeys.includes(eventKey);
|
|
|
|
// ======================== DirectionStyle ========================
|
|
var directionStyle = useDirectionStyle(connectedKeys.length);
|
|
|
|
// ============================ Events ============================
|
|
var onInternalClick = function onInternalClick(e) {
|
|
if (mergedDisabled) {
|
|
return;
|
|
}
|
|
var info = getEventInfo(e);
|
|
onClick === null || onClick === void 0 || onClick(warnItemProp(info));
|
|
onItemClick(info);
|
|
};
|
|
var onInternalKeyDown = function onInternalKeyDown(e) {
|
|
onKeyDown === null || onKeyDown === void 0 || onKeyDown(e);
|
|
if (e.which === KeyCode/* default */.Z.ENTER) {
|
|
var info = getEventInfo(e);
|
|
|
|
// Legacy. Key will also trigger click event
|
|
onClick === null || onClick === void 0 || onClick(warnItemProp(info));
|
|
onItemClick(info);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Used for accessibility. Helper will focus element without key board.
|
|
* We should manually trigger an active
|
|
*/
|
|
var onInternalFocus = function onInternalFocus(e) {
|
|
onActive(eventKey);
|
|
onFocus === null || onFocus === void 0 || onFocus(e);
|
|
};
|
|
|
|
// ============================ Render ============================
|
|
var optionRoleProps = {};
|
|
if (props.role === 'option') {
|
|
optionRoleProps['aria-selected'] = selected;
|
|
}
|
|
var renderNode = /*#__PURE__*/_react_17_0_2_react.createElement(LegacyMenuItem, (0,esm_extends/* default */.Z)({
|
|
ref: legacyMenuItemRef,
|
|
elementRef: mergedEleRef,
|
|
role: role === null ? 'none' : role || 'menuitem',
|
|
tabIndex: disabled ? null : -1,
|
|
"data-menu-id": overflowDisabled && domDataId ? null : domDataId
|
|
}, restProps, activeProps, optionRoleProps, {
|
|
component: "li",
|
|
"aria-disabled": disabled,
|
|
style: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, directionStyle), style),
|
|
className: _classnames_2_5_1_classnames_default()(itemCls, (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(itemCls, "-active"), active), (0,defineProperty/* default */.Z)(_classNames, "".concat(itemCls, "-selected"), selected), (0,defineProperty/* default */.Z)(_classNames, "".concat(itemCls, "-disabled"), mergedDisabled), _classNames), className),
|
|
onClick: onInternalClick,
|
|
onKeyDown: onInternalKeyDown,
|
|
onFocus: onInternalFocus
|
|
}), children, /*#__PURE__*/_react_17_0_2_react.createElement(Icon, {
|
|
props: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, props), {}, {
|
|
isSelected: selected
|
|
}),
|
|
icon: mergedItemIcon
|
|
}));
|
|
if (_internalRenderMenuItem) {
|
|
renderNode = _internalRenderMenuItem(renderNode, props, {
|
|
selected: selected
|
|
});
|
|
}
|
|
return renderNode;
|
|
});
|
|
function MenuItem(props, ref) {
|
|
var eventKey = props.eventKey;
|
|
|
|
// ==================== Record KeyPath ====================
|
|
var measure = useMeasure();
|
|
var connectedKeyPath = useFullPath(eventKey);
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (measure) {
|
|
measure.registerPath(eventKey, connectedKeyPath);
|
|
return function () {
|
|
measure.unregisterPath(eventKey, connectedKeyPath);
|
|
};
|
|
}
|
|
}, [connectedKeyPath]);
|
|
if (measure) {
|
|
return null;
|
|
}
|
|
|
|
// ======================== Render ========================
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(InternalMenuItem, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref
|
|
}));
|
|
}
|
|
/* harmony default export */ var es_MenuItem = (/*#__PURE__*/_react_17_0_2_react.forwardRef(MenuItem));
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/SubMenu/SubMenuList.js
|
|
|
|
|
|
var SubMenuList_excluded = ["className", "children"];
|
|
|
|
|
|
|
|
var InternalSubMenuList = function InternalSubMenuList(_ref, ref) {
|
|
var className = _ref.className,
|
|
children = _ref.children,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(_ref, SubMenuList_excluded);
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
mode = _React$useContext.mode,
|
|
rtl = _React$useContext.rtl;
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("ul", (0,esm_extends/* default */.Z)({
|
|
className: _classnames_2_5_1_classnames_default()(prefixCls, rtl && "".concat(prefixCls, "-rtl"), "".concat(prefixCls, "-sub"), "".concat(prefixCls, "-").concat(mode === 'inline' ? 'inline' : 'vertical'), className),
|
|
role: "menu"
|
|
}, restProps, {
|
|
"data-menu-list": true,
|
|
ref: ref
|
|
}), children);
|
|
};
|
|
var SubMenuList = /*#__PURE__*/_react_17_0_2_react.forwardRef(InternalSubMenuList);
|
|
SubMenuList.displayName = 'SubMenuList';
|
|
/* harmony default export */ var SubMenu_SubMenuList = (SubMenuList);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__(11592);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/utils/commonUtil.js
|
|
|
|
|
|
|
|
function parseChildren(children, keyPath) {
|
|
return (0,toArray/* default */.Z)(children).map(function (child, index) {
|
|
if ( /*#__PURE__*/_react_17_0_2_react.isValidElement(child)) {
|
|
var _eventKey, _child$props;
|
|
var key = child.key;
|
|
var eventKey = (_eventKey = (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.eventKey) !== null && _eventKey !== void 0 ? _eventKey : key;
|
|
var emptyKey = eventKey === null || eventKey === undefined;
|
|
if (emptyKey) {
|
|
eventKey = "tmp_key-".concat([].concat((0,toConsumableArray/* default */.Z)(keyPath), [index]).join('-'));
|
|
}
|
|
var cloneProps = {
|
|
key: eventKey,
|
|
eventKey: eventKey
|
|
};
|
|
if (false) {}
|
|
return /*#__PURE__*/_react_17_0_2_react.cloneElement(child, cloneProps);
|
|
}
|
|
return child;
|
|
});
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_@rc-component_trigger@1.18.3@@rc-component/trigger/es/index.js + 11 modules
|
|
var trigger_es = __webpack_require__(35593);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/placements.js
|
|
var autoAdjustOverflow = {
|
|
adjustX: 1,
|
|
adjustY: 1
|
|
};
|
|
var placements = {
|
|
topLeft: {
|
|
points: ['bl', 'tl'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
topRight: {
|
|
points: ['br', 'tr'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
bottomLeft: {
|
|
points: ['tl', 'bl'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
bottomRight: {
|
|
points: ['tr', 'br'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
leftTop: {
|
|
points: ['tr', 'tl'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
leftBottom: {
|
|
points: ['br', 'bl'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
rightTop: {
|
|
points: ['tl', 'tr'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
rightBottom: {
|
|
points: ['bl', 'br'],
|
|
overflow: autoAdjustOverflow
|
|
}
|
|
};
|
|
var placementsRtl = {
|
|
topLeft: {
|
|
points: ['bl', 'tl'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
topRight: {
|
|
points: ['br', 'tr'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
bottomLeft: {
|
|
points: ['tl', 'bl'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
bottomRight: {
|
|
points: ['tr', 'br'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
rightTop: {
|
|
points: ['tr', 'tl'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
rightBottom: {
|
|
points: ['br', 'bl'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
leftTop: {
|
|
points: ['tl', 'tr'],
|
|
overflow: autoAdjustOverflow
|
|
},
|
|
leftBottom: {
|
|
points: ['bl', 'br'],
|
|
overflow: autoAdjustOverflow
|
|
}
|
|
};
|
|
/* harmony default export */ var es_placements = ((/* unused pure expression or super */ null && (placements)));
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/utils/motionUtil.js
|
|
function getMotion(mode, motion, defaultMotions) {
|
|
if (motion) {
|
|
return motion;
|
|
}
|
|
if (defaultMotions) {
|
|
return defaultMotions[mode] || defaultMotions.other;
|
|
}
|
|
return undefined;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/SubMenu/PopupTrigger.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var popupPlacementMap = {
|
|
horizontal: 'bottomLeft',
|
|
vertical: 'rightTop',
|
|
'vertical-left': 'rightTop',
|
|
'vertical-right': 'leftTop'
|
|
};
|
|
function PopupTrigger(_ref) {
|
|
var prefixCls = _ref.prefixCls,
|
|
visible = _ref.visible,
|
|
children = _ref.children,
|
|
popup = _ref.popup,
|
|
popupStyle = _ref.popupStyle,
|
|
popupClassName = _ref.popupClassName,
|
|
popupOffset = _ref.popupOffset,
|
|
disabled = _ref.disabled,
|
|
mode = _ref.mode,
|
|
onVisibleChange = _ref.onVisibleChange;
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
getPopupContainer = _React$useContext.getPopupContainer,
|
|
rtl = _React$useContext.rtl,
|
|
subMenuOpenDelay = _React$useContext.subMenuOpenDelay,
|
|
subMenuCloseDelay = _React$useContext.subMenuCloseDelay,
|
|
builtinPlacements = _React$useContext.builtinPlacements,
|
|
triggerSubMenuAction = _React$useContext.triggerSubMenuAction,
|
|
forceSubMenuRender = _React$useContext.forceSubMenuRender,
|
|
rootClassName = _React$useContext.rootClassName,
|
|
motion = _React$useContext.motion,
|
|
defaultMotions = _React$useContext.defaultMotions;
|
|
var _React$useState = _react_17_0_2_react.useState(false),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
innerVisible = _React$useState2[0],
|
|
setInnerVisible = _React$useState2[1];
|
|
var placement = rtl ? (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, placementsRtl), builtinPlacements) : (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, placements), builtinPlacements);
|
|
var popupPlacement = popupPlacementMap[mode];
|
|
var targetMotion = getMotion(mode, motion, defaultMotions);
|
|
var targetMotionRef = _react_17_0_2_react.useRef(targetMotion);
|
|
if (mode !== 'inline') {
|
|
/**
|
|
* PopupTrigger is only used for vertical and horizontal types.
|
|
* When collapsed is unfolded, the inline animation will destroy the vertical animation.
|
|
*/
|
|
targetMotionRef.current = targetMotion;
|
|
}
|
|
var mergedMotion = (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, targetMotionRef.current), {}, {
|
|
leavedClassName: "".concat(prefixCls, "-hidden"),
|
|
removeOnLeave: false,
|
|
motionAppear: true
|
|
});
|
|
|
|
// Delay to change visible
|
|
var visibleRef = _react_17_0_2_react.useRef();
|
|
_react_17_0_2_react.useEffect(function () {
|
|
visibleRef.current = (0,raf/* default */.Z)(function () {
|
|
setInnerVisible(visible);
|
|
});
|
|
return function () {
|
|
raf/* default */.Z.cancel(visibleRef.current);
|
|
};
|
|
}, [visible]);
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(trigger_es/* default */.Z, {
|
|
prefixCls: prefixCls,
|
|
popupClassName: _classnames_2_5_1_classnames_default()("".concat(prefixCls, "-popup"), (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-rtl"), rtl), popupClassName, rootClassName),
|
|
stretch: mode === 'horizontal' ? 'minWidth' : null,
|
|
getPopupContainer: getPopupContainer,
|
|
builtinPlacements: placement,
|
|
popupPlacement: popupPlacement,
|
|
popupVisible: innerVisible,
|
|
popup: popup,
|
|
popupStyle: popupStyle,
|
|
popupAlign: popupOffset && {
|
|
offset: popupOffset
|
|
},
|
|
action: disabled ? [] : [triggerSubMenuAction],
|
|
mouseEnterDelay: subMenuOpenDelay,
|
|
mouseLeaveDelay: subMenuCloseDelay,
|
|
onPopupVisibleChange: onVisibleChange,
|
|
forceRender: forceSubMenuRender,
|
|
popupMotion: mergedMotion,
|
|
fresh: true
|
|
}, children);
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_rc-motion@2.9.5@rc-motion/es/index.js + 13 modules
|
|
var _rc_motion_2_9_5_rc_motion_es = __webpack_require__(77900);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/SubMenu/InlineSubMenuList.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function InlineSubMenuList(_ref) {
|
|
var id = _ref.id,
|
|
open = _ref.open,
|
|
keyPath = _ref.keyPath,
|
|
children = _ref.children;
|
|
var fixedMode = 'inline';
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
forceSubMenuRender = _React$useContext.forceSubMenuRender,
|
|
motion = _React$useContext.motion,
|
|
defaultMotions = _React$useContext.defaultMotions,
|
|
mode = _React$useContext.mode;
|
|
|
|
// Always use latest mode check
|
|
var sameModeRef = _react_17_0_2_react.useRef(false);
|
|
sameModeRef.current = mode === fixedMode;
|
|
|
|
// We record `destroy` mark here since when mode change from `inline` to others.
|
|
// The inline list should remove when motion end.
|
|
var _React$useState = _react_17_0_2_react.useState(!sameModeRef.current),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
destroy = _React$useState2[0],
|
|
setDestroy = _React$useState2[1];
|
|
var mergedOpen = sameModeRef.current ? open : false;
|
|
|
|
// ================================= Effect =================================
|
|
// Reset destroy state when mode change back
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (sameModeRef.current) {
|
|
setDestroy(false);
|
|
}
|
|
}, [mode]);
|
|
|
|
// ================================= Render =================================
|
|
var mergedMotion = (0,objectSpread2/* default */.Z)({}, getMotion(fixedMode, motion, defaultMotions));
|
|
|
|
// No need appear since nest inlineCollapse changed
|
|
if (keyPath.length > 1) {
|
|
mergedMotion.motionAppear = false;
|
|
}
|
|
|
|
// Hide inline list when mode changed and motion end
|
|
var originOnVisibleChanged = mergedMotion.onVisibleChanged;
|
|
mergedMotion.onVisibleChanged = function (newVisible) {
|
|
if (!sameModeRef.current && !newVisible) {
|
|
setDestroy(true);
|
|
}
|
|
return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible);
|
|
};
|
|
if (destroy) {
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(InheritableContextProvider, {
|
|
mode: fixedMode,
|
|
locked: !sameModeRef.current
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(_rc_motion_2_9_5_rc_motion_es["default"], (0,esm_extends/* default */.Z)({
|
|
visible: mergedOpen
|
|
}, mergedMotion, {
|
|
forceRender: forceSubMenuRender,
|
|
removeOnLeave: false,
|
|
leavedClassName: "".concat(prefixCls, "-hidden")
|
|
}), function (_ref2) {
|
|
var motionClassName = _ref2.className,
|
|
motionStyle = _ref2.style;
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(SubMenu_SubMenuList, {
|
|
id: id,
|
|
className: motionClassName,
|
|
style: motionStyle
|
|
}, children);
|
|
}));
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/SubMenu/index.js
|
|
|
|
|
|
|
|
|
|
|
|
var SubMenu_excluded = ["style", "className", "title", "eventKey", "warnKey", "disabled", "internalPopupClose", "children", "itemIcon", "expandIcon", "popupClassName", "popupOffset", "popupStyle", "onClick", "onMouseEnter", "onMouseLeave", "onTitleClick", "onTitleMouseEnter", "onTitleMouseLeave"],
|
|
SubMenu_excluded2 = ["active"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var InternalSubMenu = function InternalSubMenu(props) {
|
|
var _classNames;
|
|
var style = props.style,
|
|
className = props.className,
|
|
title = props.title,
|
|
eventKey = props.eventKey,
|
|
warnKey = props.warnKey,
|
|
disabled = props.disabled,
|
|
internalPopupClose = props.internalPopupClose,
|
|
children = props.children,
|
|
itemIcon = props.itemIcon,
|
|
expandIcon = props.expandIcon,
|
|
popupClassName = props.popupClassName,
|
|
popupOffset = props.popupOffset,
|
|
popupStyle = props.popupStyle,
|
|
onClick = props.onClick,
|
|
onMouseEnter = props.onMouseEnter,
|
|
onMouseLeave = props.onMouseLeave,
|
|
onTitleClick = props.onTitleClick,
|
|
onTitleMouseEnter = props.onTitleMouseEnter,
|
|
onTitleMouseLeave = props.onTitleMouseLeave,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, SubMenu_excluded);
|
|
var domDataId = useMenuId(eventKey);
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
mode = _React$useContext.mode,
|
|
openKeys = _React$useContext.openKeys,
|
|
contextDisabled = _React$useContext.disabled,
|
|
overflowDisabled = _React$useContext.overflowDisabled,
|
|
activeKey = _React$useContext.activeKey,
|
|
selectedKeys = _React$useContext.selectedKeys,
|
|
contextItemIcon = _React$useContext.itemIcon,
|
|
contextExpandIcon = _React$useContext.expandIcon,
|
|
onItemClick = _React$useContext.onItemClick,
|
|
onOpenChange = _React$useContext.onOpenChange,
|
|
onActive = _React$useContext.onActive;
|
|
var _React$useContext2 = _react_17_0_2_react.useContext(context_PrivateContext),
|
|
_internalRenderSubMenuItem = _React$useContext2._internalRenderSubMenuItem;
|
|
var _React$useContext3 = _react_17_0_2_react.useContext(PathUserContext),
|
|
isSubPathKey = _React$useContext3.isSubPathKey;
|
|
var connectedPath = useFullPath();
|
|
var subMenuPrefixCls = "".concat(prefixCls, "-submenu");
|
|
var mergedDisabled = contextDisabled || disabled;
|
|
var elementRef = _react_17_0_2_react.useRef();
|
|
var popupRef = _react_17_0_2_react.useRef();
|
|
|
|
// ================================ Warn ================================
|
|
if (false) {}
|
|
|
|
// ================================ Icon ================================
|
|
var mergedItemIcon = itemIcon !== null && itemIcon !== void 0 ? itemIcon : contextItemIcon;
|
|
var mergedExpandIcon = expandIcon !== null && expandIcon !== void 0 ? expandIcon : contextExpandIcon;
|
|
|
|
// ================================ Open ================================
|
|
var originOpen = openKeys.includes(eventKey);
|
|
var open = !overflowDisabled && originOpen;
|
|
|
|
// =============================== Select ===============================
|
|
var childrenSelected = isSubPathKey(selectedKeys, eventKey);
|
|
|
|
// =============================== Active ===============================
|
|
var _useActive = useActive(eventKey, mergedDisabled, onTitleMouseEnter, onTitleMouseLeave),
|
|
active = _useActive.active,
|
|
activeProps = (0,objectWithoutProperties/* default */.Z)(_useActive, SubMenu_excluded2);
|
|
|
|
// Fallback of active check to avoid hover on menu title or disabled item
|
|
var _React$useState = _react_17_0_2_react.useState(false),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
childrenActive = _React$useState2[0],
|
|
setChildrenActive = _React$useState2[1];
|
|
var triggerChildrenActive = function triggerChildrenActive(newActive) {
|
|
if (!mergedDisabled) {
|
|
setChildrenActive(newActive);
|
|
}
|
|
};
|
|
var onInternalMouseEnter = function onInternalMouseEnter(domEvent) {
|
|
triggerChildrenActive(true);
|
|
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
|
|
key: eventKey,
|
|
domEvent: domEvent
|
|
});
|
|
};
|
|
var onInternalMouseLeave = function onInternalMouseLeave(domEvent) {
|
|
triggerChildrenActive(false);
|
|
onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
|
|
key: eventKey,
|
|
domEvent: domEvent
|
|
});
|
|
};
|
|
var mergedActive = _react_17_0_2_react.useMemo(function () {
|
|
if (active) {
|
|
return active;
|
|
}
|
|
if (mode !== 'inline') {
|
|
return childrenActive || isSubPathKey([activeKey], eventKey);
|
|
}
|
|
return false;
|
|
}, [mode, active, activeKey, childrenActive, eventKey, isSubPathKey]);
|
|
|
|
// ========================== DirectionStyle ==========================
|
|
var directionStyle = useDirectionStyle(connectedPath.length);
|
|
|
|
// =============================== Events ===============================
|
|
// >>>> Title click
|
|
var onInternalTitleClick = function onInternalTitleClick(e) {
|
|
// Skip if disabled
|
|
if (mergedDisabled) {
|
|
return;
|
|
}
|
|
onTitleClick === null || onTitleClick === void 0 || onTitleClick({
|
|
key: eventKey,
|
|
domEvent: e
|
|
});
|
|
|
|
// Trigger open by click when mode is `inline`
|
|
if (mode === 'inline') {
|
|
onOpenChange(eventKey, !originOpen);
|
|
}
|
|
};
|
|
|
|
// >>>> Context for children click
|
|
var onMergedItemClick = useMemoCallback(function (info) {
|
|
onClick === null || onClick === void 0 || onClick(warnItemProp(info));
|
|
onItemClick(info);
|
|
});
|
|
|
|
// >>>>> Visible change
|
|
var onPopupVisibleChange = function onPopupVisibleChange(newVisible) {
|
|
if (mode !== 'inline') {
|
|
onOpenChange(eventKey, newVisible);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Used for accessibility. Helper will focus element without key board.
|
|
* We should manually trigger an active
|
|
*/
|
|
var onInternalFocus = function onInternalFocus() {
|
|
onActive(eventKey);
|
|
};
|
|
|
|
// =============================== Render ===============================
|
|
var popupId = domDataId && "".concat(domDataId, "-popup");
|
|
|
|
// >>>>> Title
|
|
var titleNode = /*#__PURE__*/_react_17_0_2_react.createElement("div", (0,esm_extends/* default */.Z)({
|
|
role: "menuitem",
|
|
style: directionStyle,
|
|
className: "".concat(subMenuPrefixCls, "-title"),
|
|
tabIndex: mergedDisabled ? null : -1,
|
|
ref: elementRef,
|
|
title: typeof title === 'string' ? title : null,
|
|
"data-menu-id": overflowDisabled && domDataId ? null : domDataId,
|
|
"aria-expanded": open,
|
|
"aria-haspopup": true,
|
|
"aria-controls": popupId,
|
|
"aria-disabled": mergedDisabled,
|
|
onClick: onInternalTitleClick,
|
|
onFocus: onInternalFocus
|
|
}, activeProps), title, /*#__PURE__*/_react_17_0_2_react.createElement(Icon, {
|
|
icon: mode !== 'horizontal' ? mergedExpandIcon : undefined,
|
|
props: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, props), {}, {
|
|
isOpen: open,
|
|
// [Legacy] Not sure why need this mark
|
|
isSubMenu: true
|
|
})
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("i", {
|
|
className: "".concat(subMenuPrefixCls, "-arrow")
|
|
})));
|
|
|
|
// Cache mode if it change to `inline` which do not have popup motion
|
|
var triggerModeRef = _react_17_0_2_react.useRef(mode);
|
|
if (mode !== 'inline' && connectedPath.length > 1) {
|
|
triggerModeRef.current = 'vertical';
|
|
} else {
|
|
triggerModeRef.current = mode;
|
|
}
|
|
if (!overflowDisabled) {
|
|
var triggerMode = triggerModeRef.current;
|
|
|
|
// Still wrap with Trigger here since we need avoid react re-mount dom node
|
|
// Which makes motion failed
|
|
titleNode = /*#__PURE__*/_react_17_0_2_react.createElement(PopupTrigger, {
|
|
mode: triggerMode,
|
|
prefixCls: subMenuPrefixCls,
|
|
visible: !internalPopupClose && open && mode !== 'inline',
|
|
popupClassName: popupClassName,
|
|
popupOffset: popupOffset,
|
|
popupStyle: popupStyle,
|
|
popup: /*#__PURE__*/_react_17_0_2_react.createElement(InheritableContextProvider
|
|
// Special handle of horizontal mode
|
|
, {
|
|
mode: triggerMode === 'horizontal' ? 'vertical' : triggerMode
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(SubMenu_SubMenuList, {
|
|
id: popupId,
|
|
ref: popupRef
|
|
}, children)),
|
|
disabled: mergedDisabled,
|
|
onVisibleChange: onPopupVisibleChange
|
|
}, titleNode);
|
|
}
|
|
|
|
// >>>>> List node
|
|
var listNode = /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z.Item, (0,esm_extends/* default */.Z)({
|
|
role: "none"
|
|
}, restProps, {
|
|
component: "li",
|
|
style: style,
|
|
className: _classnames_2_5_1_classnames_default()(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(subMenuPrefixCls, "-open"), open), (0,defineProperty/* default */.Z)(_classNames, "".concat(subMenuPrefixCls, "-active"), mergedActive), (0,defineProperty/* default */.Z)(_classNames, "".concat(subMenuPrefixCls, "-selected"), childrenSelected), (0,defineProperty/* default */.Z)(_classNames, "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled), _classNames)),
|
|
onMouseEnter: onInternalMouseEnter,
|
|
onMouseLeave: onInternalMouseLeave
|
|
}), titleNode, !overflowDisabled && /*#__PURE__*/_react_17_0_2_react.createElement(InlineSubMenuList, {
|
|
id: popupId,
|
|
open: open,
|
|
keyPath: connectedPath
|
|
}, children));
|
|
if (_internalRenderSubMenuItem) {
|
|
listNode = _internalRenderSubMenuItem(listNode, props, {
|
|
selected: childrenSelected,
|
|
active: mergedActive,
|
|
open: open,
|
|
disabled: mergedDisabled
|
|
});
|
|
}
|
|
|
|
// >>>>> Render
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(InheritableContextProvider, {
|
|
onItemClick: onMergedItemClick,
|
|
mode: mode === 'horizontal' ? 'vertical' : mode,
|
|
itemIcon: mergedItemIcon,
|
|
expandIcon: mergedExpandIcon
|
|
}, listNode);
|
|
};
|
|
function SubMenu(props) {
|
|
var eventKey = props.eventKey,
|
|
children = props.children;
|
|
var connectedKeyPath = useFullPath(eventKey);
|
|
var childList = parseChildren(children, connectedKeyPath);
|
|
|
|
// ==================== Record KeyPath ====================
|
|
var measure = useMeasure();
|
|
|
|
// eslint-disable-next-line consistent-return
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (measure) {
|
|
measure.registerPath(eventKey, connectedKeyPath);
|
|
return function () {
|
|
measure.unregisterPath(eventKey, connectedKeyPath);
|
|
};
|
|
}
|
|
}, [connectedKeyPath]);
|
|
var renderNode;
|
|
|
|
// ======================== Render ========================
|
|
if (measure) {
|
|
renderNode = childList;
|
|
} else {
|
|
renderNode = /*#__PURE__*/_react_17_0_2_react.createElement(InternalSubMenu, props, childList);
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(PathTrackerContext.Provider, {
|
|
value: connectedKeyPath
|
|
}, renderNode);
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.6@@babel/runtime/helpers/esm/typeof.js
|
|
var esm_typeof = __webpack_require__(93664);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/MenuItemGroup.js
|
|
|
|
|
|
var MenuItemGroup_excluded = ["className", "title", "eventKey", "children"],
|
|
MenuItemGroup_excluded2 = ["children"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var InternalMenuItemGroup = function InternalMenuItemGroup(_ref) {
|
|
var className = _ref.className,
|
|
title = _ref.title,
|
|
eventKey = _ref.eventKey,
|
|
children = _ref.children,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(_ref, MenuItemGroup_excluded);
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls;
|
|
var groupPrefixCls = "".concat(prefixCls, "-item-group");
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("li", (0,esm_extends/* default */.Z)({
|
|
role: "presentation"
|
|
}, restProps, {
|
|
onClick: function onClick(e) {
|
|
return e.stopPropagation();
|
|
},
|
|
className: _classnames_2_5_1_classnames_default()(groupPrefixCls, className)
|
|
}), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
role: "presentation",
|
|
className: "".concat(groupPrefixCls, "-title"),
|
|
title: typeof title === 'string' ? title : undefined
|
|
}, title), /*#__PURE__*/_react_17_0_2_react.createElement("ul", {
|
|
role: "group",
|
|
className: "".concat(groupPrefixCls, "-list")
|
|
}, children));
|
|
};
|
|
function MenuItemGroup(_ref2) {
|
|
var children = _ref2.children,
|
|
props = (0,objectWithoutProperties/* default */.Z)(_ref2, MenuItemGroup_excluded2);
|
|
var connectedKeyPath = useFullPath(props.eventKey);
|
|
var childList = parseChildren(children, connectedKeyPath);
|
|
var measure = useMeasure();
|
|
if (measure) {
|
|
return childList;
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(InternalMenuItemGroup, (0,omit/* default */.Z)(props, ['warnKey']), childList);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/Divider.js
|
|
|
|
|
|
|
|
|
|
function Divider(_ref) {
|
|
var className = _ref.className,
|
|
style = _ref.style;
|
|
var _React$useContext = _react_17_0_2_react.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls;
|
|
var measure = useMeasure();
|
|
if (measure) {
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("li", {
|
|
role: "separator",
|
|
className: _classnames_2_5_1_classnames_default()("".concat(prefixCls, "-item-divider"), className),
|
|
style: style
|
|
});
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/utils/nodeUtil.js
|
|
|
|
|
|
|
|
var nodeUtil_excluded = ["label", "children", "key", "type"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function convertItemsToNodes(list) {
|
|
return (list || []).map(function (opt, index) {
|
|
if (opt && (0,esm_typeof/* default */.Z)(opt) === 'object') {
|
|
var _ref = opt,
|
|
label = _ref.label,
|
|
children = _ref.children,
|
|
key = _ref.key,
|
|
type = _ref.type,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(_ref, nodeUtil_excluded);
|
|
var mergedKey = key !== null && key !== void 0 ? key : "tmp-".concat(index);
|
|
|
|
// MenuItemGroup & SubMenuItem
|
|
if (children || type === 'group') {
|
|
if (type === 'group') {
|
|
// Group
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(MenuItemGroup, (0,esm_extends/* default */.Z)({
|
|
key: mergedKey
|
|
}, restProps, {
|
|
title: label
|
|
}), convertItemsToNodes(children));
|
|
}
|
|
|
|
// Sub Menu
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(SubMenu, (0,esm_extends/* default */.Z)({
|
|
key: mergedKey
|
|
}, restProps, {
|
|
title: label
|
|
}), convertItemsToNodes(children));
|
|
}
|
|
|
|
// MenuItem & Divider
|
|
if (type === 'divider') {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(Divider, (0,esm_extends/* default */.Z)({
|
|
key: mergedKey
|
|
}, restProps));
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(es_MenuItem, (0,esm_extends/* default */.Z)({
|
|
key: mergedKey
|
|
}, restProps), label);
|
|
}
|
|
return null;
|
|
}).filter(function (opt) {
|
|
return opt;
|
|
});
|
|
}
|
|
function parseItems(children, items, keyPath) {
|
|
var childNodes = children;
|
|
if (items) {
|
|
childNodes = convertItemsToNodes(items);
|
|
}
|
|
return parseChildren(childNodes, keyPath);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/Menu.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Menu_excluded = ["prefixCls", "rootClassName", "style", "className", "tabIndex", "items", "children", "direction", "id", "mode", "inlineCollapsed", "disabled", "disabledOverflow", "subMenuOpenDelay", "subMenuCloseDelay", "forceSubMenuRender", "defaultOpenKeys", "openKeys", "activeKey", "defaultActiveFirst", "selectable", "multiple", "defaultSelectedKeys", "selectedKeys", "onSelect", "onDeselect", "inlineIndent", "motion", "defaultMotions", "triggerSubMenuAction", "builtinPlacements", "itemIcon", "expandIcon", "overflowedIndicator", "overflowedIndicatorPopupClassName", "getPopupContainer", "onClick", "onOpenChange", "onKeyDown", "openAnimation", "openTransitionName", "_internalRenderMenuItem", "_internalRenderSubMenuItem"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Menu modify after refactor:
|
|
* ## Add
|
|
* - disabled
|
|
*
|
|
* ## Remove
|
|
* - openTransitionName
|
|
* - openAnimation
|
|
* - onDestroy
|
|
* - siderCollapsed: Seems antd do not use this prop (Need test in antd)
|
|
* - collapsedWidth: Seems this logic should be handle by antd Layout.Sider
|
|
*/
|
|
|
|
// optimize for render
|
|
var EMPTY_LIST = [];
|
|
var Menu = /*#__PURE__*/_react_17_0_2_react.forwardRef(function (props, ref) {
|
|
var _childList$, _classNames;
|
|
var _ref = props,
|
|
_ref$prefixCls = _ref.prefixCls,
|
|
prefixCls = _ref$prefixCls === void 0 ? 'rc-menu' : _ref$prefixCls,
|
|
rootClassName = _ref.rootClassName,
|
|
style = _ref.style,
|
|
className = _ref.className,
|
|
_ref$tabIndex = _ref.tabIndex,
|
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
items = _ref.items,
|
|
children = _ref.children,
|
|
direction = _ref.direction,
|
|
id = _ref.id,
|
|
_ref$mode = _ref.mode,
|
|
mode = _ref$mode === void 0 ? 'vertical' : _ref$mode,
|
|
inlineCollapsed = _ref.inlineCollapsed,
|
|
disabled = _ref.disabled,
|
|
disabledOverflow = _ref.disabledOverflow,
|
|
_ref$subMenuOpenDelay = _ref.subMenuOpenDelay,
|
|
subMenuOpenDelay = _ref$subMenuOpenDelay === void 0 ? 0.1 : _ref$subMenuOpenDelay,
|
|
_ref$subMenuCloseDela = _ref.subMenuCloseDelay,
|
|
subMenuCloseDelay = _ref$subMenuCloseDela === void 0 ? 0.1 : _ref$subMenuCloseDela,
|
|
forceSubMenuRender = _ref.forceSubMenuRender,
|
|
defaultOpenKeys = _ref.defaultOpenKeys,
|
|
openKeys = _ref.openKeys,
|
|
activeKey = _ref.activeKey,
|
|
defaultActiveFirst = _ref.defaultActiveFirst,
|
|
_ref$selectable = _ref.selectable,
|
|
selectable = _ref$selectable === void 0 ? true : _ref$selectable,
|
|
_ref$multiple = _ref.multiple,
|
|
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
defaultSelectedKeys = _ref.defaultSelectedKeys,
|
|
selectedKeys = _ref.selectedKeys,
|
|
onSelect = _ref.onSelect,
|
|
onDeselect = _ref.onDeselect,
|
|
_ref$inlineIndent = _ref.inlineIndent,
|
|
inlineIndent = _ref$inlineIndent === void 0 ? 24 : _ref$inlineIndent,
|
|
motion = _ref.motion,
|
|
defaultMotions = _ref.defaultMotions,
|
|
_ref$triggerSubMenuAc = _ref.triggerSubMenuAction,
|
|
triggerSubMenuAction = _ref$triggerSubMenuAc === void 0 ? 'hover' : _ref$triggerSubMenuAc,
|
|
builtinPlacements = _ref.builtinPlacements,
|
|
itemIcon = _ref.itemIcon,
|
|
expandIcon = _ref.expandIcon,
|
|
_ref$overflowedIndica = _ref.overflowedIndicator,
|
|
overflowedIndicator = _ref$overflowedIndica === void 0 ? '...' : _ref$overflowedIndica,
|
|
overflowedIndicatorPopupClassName = _ref.overflowedIndicatorPopupClassName,
|
|
getPopupContainer = _ref.getPopupContainer,
|
|
onClick = _ref.onClick,
|
|
onOpenChange = _ref.onOpenChange,
|
|
onKeyDown = _ref.onKeyDown,
|
|
openAnimation = _ref.openAnimation,
|
|
openTransitionName = _ref.openTransitionName,
|
|
_internalRenderMenuItem = _ref._internalRenderMenuItem,
|
|
_internalRenderSubMenuItem = _ref._internalRenderSubMenuItem,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(_ref, Menu_excluded);
|
|
var childList = _react_17_0_2_react.useMemo(function () {
|
|
return parseItems(children, items, EMPTY_LIST);
|
|
}, [children, items]);
|
|
var _React$useState = _react_17_0_2_react.useState(false),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
mounted = _React$useState2[0],
|
|
setMounted = _React$useState2[1];
|
|
var containerRef = _react_17_0_2_react.useRef();
|
|
var uuid = useUUID(id);
|
|
var isRtl = direction === 'rtl';
|
|
|
|
// ========================= Warn =========================
|
|
if (false) {}
|
|
|
|
// ========================= Open =========================
|
|
var _useMergedState = (0,useMergedState/* default */.Z)(defaultOpenKeys, {
|
|
value: openKeys,
|
|
postState: function postState(keys) {
|
|
return keys || EMPTY_LIST;
|
|
}
|
|
}),
|
|
_useMergedState2 = (0,slicedToArray/* default */.Z)(_useMergedState, 2),
|
|
mergedOpenKeys = _useMergedState2[0],
|
|
setMergedOpenKeys = _useMergedState2[1];
|
|
|
|
// React 18 will merge mouse event which means we open key will not sync
|
|
// ref: https://github.com/ant-design/ant-design/issues/38818
|
|
var triggerOpenKeys = function triggerOpenKeys(keys) {
|
|
var forceFlush = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
function doUpdate() {
|
|
setMergedOpenKeys(keys);
|
|
onOpenChange === null || onOpenChange === void 0 || onOpenChange(keys);
|
|
}
|
|
if (forceFlush) {
|
|
(0,_react_dom_17_0_2_react_dom.flushSync)(doUpdate);
|
|
} else {
|
|
doUpdate();
|
|
}
|
|
};
|
|
|
|
// >>>>> Cache & Reset open keys when inlineCollapsed changed
|
|
var _React$useState3 = _react_17_0_2_react.useState(mergedOpenKeys),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
inlineCacheOpenKeys = _React$useState4[0],
|
|
setInlineCacheOpenKeys = _React$useState4[1];
|
|
var mountRef = _react_17_0_2_react.useRef(false);
|
|
|
|
// ========================= Mode =========================
|
|
var _React$useMemo = _react_17_0_2_react.useMemo(function () {
|
|
if ((mode === 'inline' || mode === 'vertical') && inlineCollapsed) {
|
|
return ['vertical', inlineCollapsed];
|
|
}
|
|
return [mode, false];
|
|
}, [mode, inlineCollapsed]),
|
|
_React$useMemo2 = (0,slicedToArray/* default */.Z)(_React$useMemo, 2),
|
|
mergedMode = _React$useMemo2[0],
|
|
mergedInlineCollapsed = _React$useMemo2[1];
|
|
var isInlineMode = mergedMode === 'inline';
|
|
var _React$useState5 = _react_17_0_2_react.useState(mergedMode),
|
|
_React$useState6 = (0,slicedToArray/* default */.Z)(_React$useState5, 2),
|
|
internalMode = _React$useState6[0],
|
|
setInternalMode = _React$useState6[1];
|
|
var _React$useState7 = _react_17_0_2_react.useState(mergedInlineCollapsed),
|
|
_React$useState8 = (0,slicedToArray/* default */.Z)(_React$useState7, 2),
|
|
internalInlineCollapsed = _React$useState8[0],
|
|
setInternalInlineCollapsed = _React$useState8[1];
|
|
_react_17_0_2_react.useEffect(function () {
|
|
setInternalMode(mergedMode);
|
|
setInternalInlineCollapsed(mergedInlineCollapsed);
|
|
if (!mountRef.current) {
|
|
return;
|
|
}
|
|
// Synchronously update MergedOpenKeys
|
|
if (isInlineMode) {
|
|
setMergedOpenKeys(inlineCacheOpenKeys);
|
|
} else {
|
|
// Trigger open event in case its in control
|
|
triggerOpenKeys(EMPTY_LIST);
|
|
}
|
|
}, [mergedMode, mergedInlineCollapsed]);
|
|
|
|
// ====================== Responsive ======================
|
|
var _React$useState9 = _react_17_0_2_react.useState(0),
|
|
_React$useState10 = (0,slicedToArray/* default */.Z)(_React$useState9, 2),
|
|
lastVisibleIndex = _React$useState10[0],
|
|
setLastVisibleIndex = _React$useState10[1];
|
|
var allVisible = lastVisibleIndex >= childList.length - 1 || internalMode !== 'horizontal' || disabledOverflow;
|
|
|
|
// Cache
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (isInlineMode) {
|
|
setInlineCacheOpenKeys(mergedOpenKeys);
|
|
}
|
|
}, [mergedOpenKeys]);
|
|
_react_17_0_2_react.useEffect(function () {
|
|
mountRef.current = true;
|
|
return function () {
|
|
mountRef.current = false;
|
|
};
|
|
}, []);
|
|
|
|
// ========================= Path =========================
|
|
var _useKeyRecords = useKeyRecords(),
|
|
registerPath = _useKeyRecords.registerPath,
|
|
unregisterPath = _useKeyRecords.unregisterPath,
|
|
refreshOverflowKeys = _useKeyRecords.refreshOverflowKeys,
|
|
isSubPathKey = _useKeyRecords.isSubPathKey,
|
|
getKeyPath = _useKeyRecords.getKeyPath,
|
|
getKeys = _useKeyRecords.getKeys,
|
|
getSubPathKeys = _useKeyRecords.getSubPathKeys;
|
|
var registerPathContext = _react_17_0_2_react.useMemo(function () {
|
|
return {
|
|
registerPath: registerPath,
|
|
unregisterPath: unregisterPath
|
|
};
|
|
}, [registerPath, unregisterPath]);
|
|
var pathUserContext = _react_17_0_2_react.useMemo(function () {
|
|
return {
|
|
isSubPathKey: isSubPathKey
|
|
};
|
|
}, [isSubPathKey]);
|
|
_react_17_0_2_react.useEffect(function () {
|
|
refreshOverflowKeys(allVisible ? EMPTY_LIST : childList.slice(lastVisibleIndex + 1).map(function (child) {
|
|
return child.key;
|
|
}));
|
|
}, [lastVisibleIndex, allVisible]);
|
|
|
|
// ======================== Active ========================
|
|
var _useMergedState3 = (0,useMergedState/* default */.Z)(activeKey || defaultActiveFirst && ((_childList$ = childList[0]) === null || _childList$ === void 0 ? void 0 : _childList$.key), {
|
|
value: activeKey
|
|
}),
|
|
_useMergedState4 = (0,slicedToArray/* default */.Z)(_useMergedState3, 2),
|
|
mergedActiveKey = _useMergedState4[0],
|
|
setMergedActiveKey = _useMergedState4[1];
|
|
var onActive = useMemoCallback(function (key) {
|
|
setMergedActiveKey(key);
|
|
});
|
|
var onInactive = useMemoCallback(function () {
|
|
setMergedActiveKey(undefined);
|
|
});
|
|
(0,_react_17_0_2_react.useImperativeHandle)(ref, function () {
|
|
return {
|
|
list: containerRef.current,
|
|
focus: function focus(options) {
|
|
var _childList$find;
|
|
var keys = getKeys();
|
|
var _refreshElements = refreshElements(keys, uuid),
|
|
elements = _refreshElements.elements,
|
|
key2element = _refreshElements.key2element,
|
|
element2key = _refreshElements.element2key;
|
|
var focusableElements = getFocusableElements(containerRef.current, elements);
|
|
var shouldFocusKey = mergedActiveKey !== null && mergedActiveKey !== void 0 ? mergedActiveKey : focusableElements[0] ? element2key.get(focusableElements[0]) : (_childList$find = childList.find(function (node) {
|
|
return !node.props.disabled;
|
|
})) === null || _childList$find === void 0 ? void 0 : _childList$find.key;
|
|
var elementToFocus = key2element.get(shouldFocusKey);
|
|
if (shouldFocusKey && elementToFocus) {
|
|
var _elementToFocus$focus;
|
|
elementToFocus === null || elementToFocus === void 0 || (_elementToFocus$focus = elementToFocus.focus) === null || _elementToFocus$focus === void 0 || _elementToFocus$focus.call(elementToFocus, options);
|
|
}
|
|
}
|
|
};
|
|
});
|
|
|
|
// ======================== Select ========================
|
|
// >>>>> Select keys
|
|
var _useMergedState5 = (0,useMergedState/* default */.Z)(defaultSelectedKeys || [], {
|
|
value: selectedKeys,
|
|
// Legacy convert key to array
|
|
postState: function postState(keys) {
|
|
if (Array.isArray(keys)) {
|
|
return keys;
|
|
}
|
|
if (keys === null || keys === undefined) {
|
|
return EMPTY_LIST;
|
|
}
|
|
return [keys];
|
|
}
|
|
}),
|
|
_useMergedState6 = (0,slicedToArray/* default */.Z)(_useMergedState5, 2),
|
|
mergedSelectKeys = _useMergedState6[0],
|
|
setMergedSelectKeys = _useMergedState6[1];
|
|
|
|
// >>>>> Trigger select
|
|
var triggerSelection = function triggerSelection(info) {
|
|
if (selectable) {
|
|
// Insert or Remove
|
|
var targetKey = info.key;
|
|
var exist = mergedSelectKeys.includes(targetKey);
|
|
var newSelectKeys;
|
|
if (multiple) {
|
|
if (exist) {
|
|
newSelectKeys = mergedSelectKeys.filter(function (key) {
|
|
return key !== targetKey;
|
|
});
|
|
} else {
|
|
newSelectKeys = [].concat((0,toConsumableArray/* default */.Z)(mergedSelectKeys), [targetKey]);
|
|
}
|
|
} else {
|
|
newSelectKeys = [targetKey];
|
|
}
|
|
setMergedSelectKeys(newSelectKeys);
|
|
|
|
// Trigger event
|
|
var selectInfo = (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, info), {}, {
|
|
selectedKeys: newSelectKeys
|
|
});
|
|
if (exist) {
|
|
onDeselect === null || onDeselect === void 0 || onDeselect(selectInfo);
|
|
} else {
|
|
onSelect === null || onSelect === void 0 || onSelect(selectInfo);
|
|
}
|
|
}
|
|
|
|
// Whatever selectable, always close it
|
|
if (!multiple && mergedOpenKeys.length && internalMode !== 'inline') {
|
|
triggerOpenKeys(EMPTY_LIST);
|
|
}
|
|
};
|
|
|
|
// ========================= Open =========================
|
|
/**
|
|
* Click for item. SubMenu do not have selection status
|
|
*/
|
|
var onInternalClick = useMemoCallback(function (info) {
|
|
onClick === null || onClick === void 0 || onClick(warnItemProp(info));
|
|
triggerSelection(info);
|
|
});
|
|
var onInternalOpenChange = useMemoCallback(function (key, open) {
|
|
var newOpenKeys = mergedOpenKeys.filter(function (k) {
|
|
return k !== key;
|
|
});
|
|
if (open) {
|
|
newOpenKeys.push(key);
|
|
} else if (internalMode !== 'inline') {
|
|
// We need find all related popup to close
|
|
var subPathKeys = getSubPathKeys(key);
|
|
newOpenKeys = newOpenKeys.filter(function (k) {
|
|
return !subPathKeys.has(k);
|
|
});
|
|
}
|
|
if (!(0,isEqual/* default */.Z)(mergedOpenKeys, newOpenKeys, true)) {
|
|
triggerOpenKeys(newOpenKeys, true);
|
|
}
|
|
});
|
|
|
|
// ==================== Accessibility =====================
|
|
var triggerAccessibilityOpen = function triggerAccessibilityOpen(key, open) {
|
|
var nextOpen = open !== null && open !== void 0 ? open : !mergedOpenKeys.includes(key);
|
|
onInternalOpenChange(key, nextOpen);
|
|
};
|
|
var onInternalKeyDown = useAccessibility(internalMode, mergedActiveKey, isRtl, uuid, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown);
|
|
|
|
// ======================== Effect ========================
|
|
_react_17_0_2_react.useEffect(function () {
|
|
setMounted(true);
|
|
}, []);
|
|
|
|
// ======================= Context ========================
|
|
var privateContext = _react_17_0_2_react.useMemo(function () {
|
|
return {
|
|
_internalRenderMenuItem: _internalRenderMenuItem,
|
|
_internalRenderSubMenuItem: _internalRenderSubMenuItem
|
|
};
|
|
}, [_internalRenderMenuItem, _internalRenderSubMenuItem]);
|
|
|
|
// ======================== Render ========================
|
|
|
|
// >>>>> Children
|
|
var wrappedChildList = internalMode !== 'horizontal' || disabledOverflow ? childList :
|
|
// Need wrap for overflow dropdown that do not response for open
|
|
childList.map(function (child, index) {
|
|
return (
|
|
/*#__PURE__*/
|
|
// Always wrap provider to avoid sub node re-mount
|
|
_react_17_0_2_react.createElement(InheritableContextProvider, {
|
|
key: child.key,
|
|
overflowDisabled: index > lastVisibleIndex
|
|
}, child)
|
|
);
|
|
});
|
|
|
|
// >>>>> Container
|
|
var container = /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z, (0,esm_extends/* default */.Z)({
|
|
id: id,
|
|
ref: containerRef,
|
|
prefixCls: "".concat(prefixCls, "-overflow"),
|
|
component: "ul",
|
|
itemComponent: es_MenuItem,
|
|
className: _classnames_2_5_1_classnames_default()(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(internalMode), className, (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-inline-collapsed"), internalInlineCollapsed), (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-rtl"), isRtl), _classNames), rootClassName),
|
|
dir: direction,
|
|
style: style,
|
|
role: "menu",
|
|
tabIndex: tabIndex,
|
|
data: wrappedChildList,
|
|
renderRawItem: function renderRawItem(node) {
|
|
return node;
|
|
},
|
|
renderRawRest: function renderRawRest(omitItems) {
|
|
// We use origin list since wrapped list use context to prevent open
|
|
var len = omitItems.length;
|
|
var originOmitItems = len ? childList.slice(-len) : null;
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(SubMenu, {
|
|
eventKey: OVERFLOW_KEY,
|
|
title: overflowedIndicator,
|
|
disabled: allVisible,
|
|
internalPopupClose: len === 0,
|
|
popupClassName: overflowedIndicatorPopupClassName
|
|
}, originOmitItems);
|
|
},
|
|
maxCount: internalMode !== 'horizontal' || disabledOverflow ? es/* default */.Z.INVALIDATE : es/* default */.Z.RESPONSIVE,
|
|
ssr: "full",
|
|
"data-menu-list": true,
|
|
onVisibleChange: function onVisibleChange(newLastIndex) {
|
|
setLastVisibleIndex(newLastIndex);
|
|
},
|
|
onKeyDown: onInternalKeyDown
|
|
}, restProps));
|
|
|
|
// >>>>> Render
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(context_PrivateContext.Provider, {
|
|
value: privateContext
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(IdContext.Provider, {
|
|
value: uuid
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(InheritableContextProvider, {
|
|
prefixCls: prefixCls,
|
|
rootClassName: rootClassName,
|
|
mode: internalMode,
|
|
openKeys: mergedOpenKeys,
|
|
rtl: isRtl
|
|
// Disabled
|
|
,
|
|
disabled: disabled
|
|
// Motion
|
|
,
|
|
motion: mounted ? motion : null,
|
|
defaultMotions: mounted ? defaultMotions : null
|
|
// Active
|
|
,
|
|
activeKey: mergedActiveKey,
|
|
onActive: onActive,
|
|
onInactive: onInactive
|
|
// Selection
|
|
,
|
|
selectedKeys: mergedSelectKeys
|
|
// Level
|
|
,
|
|
inlineIndent: inlineIndent
|
|
// Popup
|
|
,
|
|
subMenuOpenDelay: subMenuOpenDelay,
|
|
subMenuCloseDelay: subMenuCloseDelay,
|
|
forceSubMenuRender: forceSubMenuRender,
|
|
builtinPlacements: builtinPlacements,
|
|
triggerSubMenuAction: triggerSubMenuAction,
|
|
getPopupContainer: getPopupContainer
|
|
// Icon
|
|
,
|
|
itemIcon: itemIcon,
|
|
expandIcon: expandIcon
|
|
// Events
|
|
,
|
|
onItemClick: onInternalClick,
|
|
onOpenChange: onInternalOpenChange
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(PathUserContext.Provider, {
|
|
value: pathUserContext
|
|
}, container), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
style: {
|
|
display: 'none'
|
|
},
|
|
"aria-hidden": true
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(PathRegisterContext.Provider, {
|
|
value: registerPathContext
|
|
}, childList)))));
|
|
});
|
|
/* harmony default export */ var es_Menu = (Menu);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-menu@9.12.4@rc-menu/es/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ExportMenu = es_Menu;
|
|
ExportMenu.Item = es_MenuItem;
|
|
ExportMenu.SubMenu = SubMenu;
|
|
ExportMenu.ItemGroup = MenuItemGroup;
|
|
ExportMenu.Divider = Divider;
|
|
/* harmony default export */ var _rc_menu_9_12_4_rc_menu_es = (ExportMenu);
|
|
|
|
/***/ })
|
|
|
|
}]); |