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.
5659 lines
205 KiB
5659 lines
205 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[93821],{
|
|
|
|
/***/ 67771:
|
|
/*!****************************************************!*\
|
|
!*** ./node_modules/antd/es/style/motion/slide.js ***!
|
|
\****************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "Qt": function() { return /* binding */ slideDownIn; },
|
|
/* harmony export */ "Uw": function() { return /* binding */ slideUpOut; },
|
|
/* harmony export */ "fJ": function() { return /* binding */ slideUpIn; },
|
|
/* harmony export */ "ly": function() { return /* binding */ slideDownOut; },
|
|
/* harmony export */ "oN": function() { return /* binding */ initSlideMotion; }
|
|
/* harmony export */ });
|
|
/* unused harmony exports slideLeftIn, slideLeftOut, slideRightIn, slideRightOut */
|
|
/* harmony import */ var _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ant-design/cssinjs */ 45930);
|
|
/* harmony import */ var _motion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./motion */ 53038);
|
|
|
|
|
|
const slideUpIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideUpIn', {
|
|
'0%': {
|
|
transform: 'scaleY(0.8)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 0
|
|
},
|
|
'100%': {
|
|
transform: 'scaleY(1)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 1
|
|
}
|
|
});
|
|
const slideUpOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideUpOut', {
|
|
'0%': {
|
|
transform: 'scaleY(1)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 1
|
|
},
|
|
'100%': {
|
|
transform: 'scaleY(0.8)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 0
|
|
}
|
|
});
|
|
const slideDownIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideDownIn', {
|
|
'0%': {
|
|
transform: 'scaleY(0.8)',
|
|
transformOrigin: '100% 100%',
|
|
opacity: 0
|
|
},
|
|
'100%': {
|
|
transform: 'scaleY(1)',
|
|
transformOrigin: '100% 100%',
|
|
opacity: 1
|
|
}
|
|
});
|
|
const slideDownOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideDownOut', {
|
|
'0%': {
|
|
transform: 'scaleY(1)',
|
|
transformOrigin: '100% 100%',
|
|
opacity: 1
|
|
},
|
|
'100%': {
|
|
transform: 'scaleY(0.8)',
|
|
transformOrigin: '100% 100%',
|
|
opacity: 0
|
|
}
|
|
});
|
|
const slideLeftIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideLeftIn', {
|
|
'0%': {
|
|
transform: 'scaleX(0.8)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 0
|
|
},
|
|
'100%': {
|
|
transform: 'scaleX(1)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 1
|
|
}
|
|
});
|
|
const slideLeftOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideLeftOut', {
|
|
'0%': {
|
|
transform: 'scaleX(1)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 1
|
|
},
|
|
'100%': {
|
|
transform: 'scaleX(0.8)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 0
|
|
}
|
|
});
|
|
const slideRightIn = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideRightIn', {
|
|
'0%': {
|
|
transform: 'scaleX(0.8)',
|
|
transformOrigin: '100% 0%',
|
|
opacity: 0
|
|
},
|
|
'100%': {
|
|
transform: 'scaleX(1)',
|
|
transformOrigin: '100% 0%',
|
|
opacity: 1
|
|
}
|
|
});
|
|
const slideRightOut = new _ant_design_cssinjs__WEBPACK_IMPORTED_MODULE_0__.Keyframes('antSlideRightOut', {
|
|
'0%': {
|
|
transform: 'scaleX(1)',
|
|
transformOrigin: '100% 0%',
|
|
opacity: 1
|
|
},
|
|
'100%': {
|
|
transform: 'scaleX(0.8)',
|
|
transformOrigin: '100% 0%',
|
|
opacity: 0
|
|
}
|
|
});
|
|
const slideMotion = {
|
|
'slide-up': {
|
|
inKeyframes: slideUpIn,
|
|
outKeyframes: slideUpOut
|
|
},
|
|
'slide-down': {
|
|
inKeyframes: slideDownIn,
|
|
outKeyframes: slideDownOut
|
|
},
|
|
'slide-left': {
|
|
inKeyframes: slideLeftIn,
|
|
outKeyframes: slideLeftOut
|
|
},
|
|
'slide-right': {
|
|
inKeyframes: slideRightIn,
|
|
outKeyframes: slideRightOut
|
|
}
|
|
};
|
|
const initSlideMotion = (token, motionName) => {
|
|
const {
|
|
antCls
|
|
} = token;
|
|
const motionCls = `${antCls}-${motionName}`;
|
|
const {
|
|
inKeyframes,
|
|
outKeyframes
|
|
} = slideMotion[motionName];
|
|
return [(0,_motion__WEBPACK_IMPORTED_MODULE_1__/* .initMotion */ .R)(motionCls, inKeyframes, outKeyframes, token.motionDurationMid), {
|
|
[`
|
|
${motionCls}-enter,
|
|
${motionCls}-appear
|
|
`]: {
|
|
transform: 'scale(0)',
|
|
transformOrigin: '0% 0%',
|
|
opacity: 0,
|
|
animationTimingFunction: token.motionEaseOutQuint,
|
|
[`&-prepare`]: {
|
|
transform: 'scale(1)'
|
|
}
|
|
},
|
|
[`${motionCls}-leave`]: {
|
|
animationTimingFunction: token.motionEaseInQuint
|
|
}
|
|
}];
|
|
};
|
|
|
|
/***/ }),
|
|
|
|
/***/ 64582:
|
|
/*!***************************************************************************************************!*\
|
|
!*** ./node_modules/antd/node_modules/@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/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(87462);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/node_modules/@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/antd/node_modules/@ant-design/icons/es/components/AntdIcon.js + 8 modules
|
|
var AntdIcon = __webpack_require__(44327);
|
|
;// CONCATENATED MODULE: ./node_modules/antd/node_modules/@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.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_EllipsisOutlined
|
|
}));
|
|
};
|
|
if (false) {}
|
|
/* harmony default export */ var icons_EllipsisOutlined = (/*#__PURE__*/react.forwardRef(EllipsisOutlined_EllipsisOutlined));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 64034:
|
|
/*!*******************************************************!*\
|
|
!*** ./node_modules/rc-menu/es/index.js + 94 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_es; },
|
|
"Xl": function() { return /* reexport */ useFullPath; }
|
|
});
|
|
|
|
// UNUSED EXPORTS: MenuItemGroup
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(87462);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(4942);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(1413);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__(74902);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__(97685);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(45987);
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
var classnames = __webpack_require__(94184);
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
var react = __webpack_require__(67294);
|
|
var react_namespaceObject = /*#__PURE__*/__webpack_require__.t(react, 2);
|
|
// EXTERNAL MODULE: ./node_modules/rc-resize-observer/es/index.js + 4 modules
|
|
var es = __webpack_require__(48555);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useLayoutEffect.js
|
|
var useLayoutEffect = __webpack_require__(8410);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/rc-overflow/es/Item.js
|
|
|
|
|
|
|
|
var _excluded = ["prefixCls", "invalidate", "item", "renderItem", "responsive", "responsiveDisabled", "registerSize", "itemKey", "className", "style", "children", "display", "order", "component"];
|
|
|
|
|
|
|
|
// Use shared variable to save bundle size
|
|
var UNDEFINED = undefined;
|
|
function InternalItem(props, ref) {
|
|
var prefixCls = props.prefixCls,
|
|
invalidate = props.invalidate,
|
|
item = props.item,
|
|
renderItem = props.renderItem,
|
|
responsive = props.responsive,
|
|
responsiveDisabled = props.responsiveDisabled,
|
|
registerSize = props.registerSize,
|
|
itemKey = props.itemKey,
|
|
className = props.className,
|
|
style = props.style,
|
|
children = props.children,
|
|
display = props.display,
|
|
order = props.order,
|
|
_props$component = props.component,
|
|
Component = _props$component === void 0 ? 'div' : _props$component,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, _excluded);
|
|
var mergedHidden = responsive && !display;
|
|
// ================================ Effect ================================
|
|
function internalRegisterSize(width) {
|
|
registerSize(itemKey, width);
|
|
}
|
|
react.useEffect(function () {
|
|
return function () {
|
|
internalRegisterSize(null);
|
|
};
|
|
}, []);
|
|
// ================================ Render ================================
|
|
var childNode = renderItem && item !== UNDEFINED ? renderItem(item) : children;
|
|
var overflowStyle;
|
|
if (!invalidate) {
|
|
overflowStyle = {
|
|
opacity: mergedHidden ? 0 : 1,
|
|
height: mergedHidden ? 0 : UNDEFINED,
|
|
overflowY: mergedHidden ? 'hidden' : UNDEFINED,
|
|
order: responsive ? order : UNDEFINED,
|
|
pointerEvents: mergedHidden ? 'none' : UNDEFINED,
|
|
position: mergedHidden ? 'absolute' : UNDEFINED
|
|
};
|
|
}
|
|
var overflowProps = {};
|
|
if (mergedHidden) {
|
|
overflowProps['aria-hidden'] = true;
|
|
}
|
|
var itemNode = /*#__PURE__*/react.createElement(Component, (0,esm_extends/* default */.Z)({
|
|
className: classnames_default()(!invalidate && prefixCls, className),
|
|
style: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, overflowStyle), style)
|
|
}, overflowProps, restProps, {
|
|
ref: ref
|
|
}), childNode);
|
|
if (responsive) {
|
|
itemNode = /*#__PURE__*/react.createElement(es/* default */.Z, {
|
|
onResize: function onResize(_ref) {
|
|
var offsetWidth = _ref.offsetWidth;
|
|
internalRegisterSize(offsetWidth);
|
|
},
|
|
disabled: responsiveDisabled
|
|
}, itemNode);
|
|
}
|
|
return itemNode;
|
|
}
|
|
var Item = /*#__PURE__*/react.forwardRef(InternalItem);
|
|
Item.displayName = 'Item';
|
|
/* harmony default export */ var es_Item = (Item);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useEvent.js
|
|
var useEvent = __webpack_require__(66680);
|
|
// EXTERNAL MODULE: ./node_modules/react-dom/index.js
|
|
var react_dom = __webpack_require__(73935);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/raf.js
|
|
var raf = __webpack_require__(75164);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/rc-overflow/es/hooks/channelUpdate.js
|
|
|
|
function channelUpdate(callback) {
|
|
if (typeof MessageChannel === 'undefined') {
|
|
(0,raf/* default */.Z)(callback);
|
|
} else {
|
|
var channel = new MessageChannel();
|
|
channel.port1.onmessage = function () {
|
|
return callback();
|
|
};
|
|
channel.port2.postMessage(undefined);
|
|
}
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/rc-overflow/es/hooks/useEffectState.js
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Batcher for record any `useEffectState` need update.
|
|
*/
|
|
function useBatcher() {
|
|
// Updater Trigger
|
|
var updateFuncRef = react.useRef(null);
|
|
// Notify update
|
|
var notifyEffectUpdate = function notifyEffectUpdate(callback) {
|
|
if (!updateFuncRef.current) {
|
|
updateFuncRef.current = [];
|
|
channelUpdate(function () {
|
|
(0,react_dom.unstable_batchedUpdates)(function () {
|
|
updateFuncRef.current.forEach(function (fn) {
|
|
fn();
|
|
});
|
|
updateFuncRef.current = null;
|
|
});
|
|
});
|
|
}
|
|
updateFuncRef.current.push(callback);
|
|
};
|
|
return notifyEffectUpdate;
|
|
}
|
|
/**
|
|
* Trigger state update by `useLayoutEffect` to save perf.
|
|
*/
|
|
function useEffectState(notifyEffectUpdate, defaultValue) {
|
|
// Value
|
|
var _React$useState = react.useState(defaultValue),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
stateValue = _React$useState2[0],
|
|
setStateValue = _React$useState2[1];
|
|
// Set State
|
|
var setEffectVal = (0,useEvent/* default */.Z)(function (nextValue) {
|
|
notifyEffectUpdate(function () {
|
|
setStateValue(nextValue);
|
|
});
|
|
});
|
|
return [stateValue, setEffectVal];
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/rc-overflow/es/context.js
|
|
|
|
var OverflowContext = /*#__PURE__*/react.createContext(null);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/rc-overflow/es/RawItem.js
|
|
|
|
|
|
var RawItem_excluded = ["component"],
|
|
_excluded2 = ["className"],
|
|
_excluded3 = ["className"];
|
|
|
|
|
|
|
|
|
|
var InternalRawItem = function InternalRawItem(props, ref) {
|
|
var context = react.useContext(OverflowContext);
|
|
// Render directly when context not provided
|
|
if (!context) {
|
|
var _props$component = props.component,
|
|
Component = _props$component === void 0 ? 'div' : _props$component,
|
|
_restProps = (0,objectWithoutProperties/* default */.Z)(props, RawItem_excluded);
|
|
return /*#__PURE__*/react.createElement(Component, (0,esm_extends/* default */.Z)({}, _restProps, {
|
|
ref: ref
|
|
}));
|
|
}
|
|
var contextClassName = context.className,
|
|
restContext = (0,objectWithoutProperties/* default */.Z)(context, _excluded2);
|
|
var className = props.className,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, _excluded3);
|
|
// Do not pass context to sub item to avoid multiple measure
|
|
return /*#__PURE__*/react.createElement(OverflowContext.Provider, {
|
|
value: null
|
|
}, /*#__PURE__*/react.createElement(es_Item, (0,esm_extends/* default */.Z)({
|
|
ref: ref,
|
|
className: classnames_default()(contextClassName, className)
|
|
}, restContext, restProps)));
|
|
};
|
|
var RawItem = /*#__PURE__*/react.forwardRef(InternalRawItem);
|
|
RawItem.displayName = 'RawItem';
|
|
/* harmony default export */ var es_RawItem = (RawItem);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/rc-overflow/es/Overflow.js
|
|
|
|
|
|
|
|
|
|
var Overflow_excluded = ["prefixCls", "data", "renderItem", "renderRawItem", "itemKey", "itemWidth", "ssr", "style", "className", "maxCount", "renderRest", "renderRawRest", "suffix", "component", "itemComponent", "onVisibleChange"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var RESPONSIVE = 'responsive';
|
|
var INVALIDATE = 'invalidate';
|
|
|
|
function defaultRenderRest(omittedItems) {
|
|
return "+ ".concat(omittedItems.length, " ...");
|
|
}
|
|
function Overflow(props, ref) {
|
|
var _props$prefixCls = props.prefixCls,
|
|
prefixCls = _props$prefixCls === void 0 ? 'rc-overflow' : _props$prefixCls,
|
|
_props$data = props.data,
|
|
data = _props$data === void 0 ? [] : _props$data,
|
|
renderItem = props.renderItem,
|
|
renderRawItem = props.renderRawItem,
|
|
itemKey = props.itemKey,
|
|
_props$itemWidth = props.itemWidth,
|
|
itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth,
|
|
ssr = props.ssr,
|
|
style = props.style,
|
|
className = props.className,
|
|
maxCount = props.maxCount,
|
|
renderRest = props.renderRest,
|
|
renderRawRest = props.renderRawRest,
|
|
suffix = props.suffix,
|
|
_props$component = props.component,
|
|
Component = _props$component === void 0 ? 'div' : _props$component,
|
|
itemComponent = props.itemComponent,
|
|
onVisibleChange = props.onVisibleChange,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, Overflow_excluded);
|
|
var fullySSR = ssr === 'full';
|
|
var notifyEffectUpdate = useBatcher();
|
|
var _useEffectState = useEffectState(notifyEffectUpdate, null),
|
|
_useEffectState2 = (0,slicedToArray/* default */.Z)(_useEffectState, 2),
|
|
containerWidth = _useEffectState2[0],
|
|
setContainerWidth = _useEffectState2[1];
|
|
var mergedContainerWidth = containerWidth || 0;
|
|
var _useEffectState3 = useEffectState(notifyEffectUpdate, new Map()),
|
|
_useEffectState4 = (0,slicedToArray/* default */.Z)(_useEffectState3, 2),
|
|
itemWidths = _useEffectState4[0],
|
|
setItemWidths = _useEffectState4[1];
|
|
var _useEffectState5 = useEffectState(notifyEffectUpdate, 0),
|
|
_useEffectState6 = (0,slicedToArray/* default */.Z)(_useEffectState5, 2),
|
|
prevRestWidth = _useEffectState6[0],
|
|
setPrevRestWidth = _useEffectState6[1];
|
|
var _useEffectState7 = useEffectState(notifyEffectUpdate, 0),
|
|
_useEffectState8 = (0,slicedToArray/* default */.Z)(_useEffectState7, 2),
|
|
restWidth = _useEffectState8[0],
|
|
setRestWidth = _useEffectState8[1];
|
|
var _useEffectState9 = useEffectState(notifyEffectUpdate, 0),
|
|
_useEffectState10 = (0,slicedToArray/* default */.Z)(_useEffectState9, 2),
|
|
suffixWidth = _useEffectState10[0],
|
|
setSuffixWidth = _useEffectState10[1];
|
|
var _useState = (0,react.useState)(null),
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
suffixFixedStart = _useState2[0],
|
|
setSuffixFixedStart = _useState2[1];
|
|
var _useState3 = (0,react.useState)(null),
|
|
_useState4 = (0,slicedToArray/* default */.Z)(_useState3, 2),
|
|
displayCount = _useState4[0],
|
|
setDisplayCount = _useState4[1];
|
|
var mergedDisplayCount = react.useMemo(function () {
|
|
if (displayCount === null && fullySSR) {
|
|
return Number.MAX_SAFE_INTEGER;
|
|
}
|
|
return displayCount || 0;
|
|
}, [displayCount, containerWidth]);
|
|
var _useState5 = (0,react.useState)(false),
|
|
_useState6 = (0,slicedToArray/* default */.Z)(_useState5, 2),
|
|
restReady = _useState6[0],
|
|
setRestReady = _useState6[1];
|
|
var itemPrefixCls = "".concat(prefixCls, "-item");
|
|
// Always use the max width to avoid blink
|
|
var mergedRestWidth = Math.max(prevRestWidth, restWidth);
|
|
// ================================= Data =================================
|
|
var isResponsive = maxCount === RESPONSIVE;
|
|
var shouldResponsive = data.length && isResponsive;
|
|
var invalidate = maxCount === INVALIDATE;
|
|
/**
|
|
* When is `responsive`, we will always render rest node to get the real width of it for calculation
|
|
*/
|
|
var showRest = shouldResponsive || typeof maxCount === 'number' && data.length > maxCount;
|
|
var mergedData = (0,react.useMemo)(function () {
|
|
var items = data;
|
|
if (shouldResponsive) {
|
|
if (containerWidth === null && fullySSR) {
|
|
items = data;
|
|
} else {
|
|
items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth));
|
|
}
|
|
} else if (typeof maxCount === 'number') {
|
|
items = data.slice(0, maxCount);
|
|
}
|
|
return items;
|
|
}, [data, itemWidth, containerWidth, maxCount, shouldResponsive]);
|
|
var omittedItems = (0,react.useMemo)(function () {
|
|
if (shouldResponsive) {
|
|
return data.slice(mergedDisplayCount + 1);
|
|
}
|
|
return data.slice(mergedData.length);
|
|
}, [data, mergedData, shouldResponsive, mergedDisplayCount]);
|
|
// ================================= Item =================================
|
|
var getKey = (0,react.useCallback)(function (item, index) {
|
|
var _ref;
|
|
if (typeof itemKey === 'function') {
|
|
return itemKey(item);
|
|
}
|
|
return (_ref = itemKey && (item === null || item === void 0 ? void 0 : item[itemKey])) !== null && _ref !== void 0 ? _ref : index;
|
|
}, [itemKey]);
|
|
var mergedRenderItem = (0,react.useCallback)(renderItem || function (item) {
|
|
return item;
|
|
}, [renderItem]);
|
|
function updateDisplayCount(count, suffixFixedStartVal, notReady) {
|
|
// React 18 will sync render even when the value is same in some case.
|
|
// We take `mergedData` as deps which may cause dead loop if it's dynamic generate.
|
|
// ref: https://github.com/ant-design/ant-design/issues/36559
|
|
if (displayCount === count && (suffixFixedStartVal === undefined || suffixFixedStartVal === suffixFixedStart)) {
|
|
return;
|
|
}
|
|
setDisplayCount(count);
|
|
if (!notReady) {
|
|
setRestReady(count < data.length - 1);
|
|
onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(count);
|
|
}
|
|
if (suffixFixedStartVal !== undefined) {
|
|
setSuffixFixedStart(suffixFixedStartVal);
|
|
}
|
|
}
|
|
// ================================= Size =================================
|
|
function onOverflowResize(_, element) {
|
|
setContainerWidth(element.clientWidth);
|
|
}
|
|
function registerSize(key, width) {
|
|
setItemWidths(function (origin) {
|
|
var clone = new Map(origin);
|
|
if (width === null) {
|
|
clone.delete(key);
|
|
} else {
|
|
clone.set(key, width);
|
|
}
|
|
return clone;
|
|
});
|
|
}
|
|
function registerOverflowSize(_, width) {
|
|
setRestWidth(width);
|
|
setPrevRestWidth(restWidth);
|
|
}
|
|
function registerSuffixSize(_, width) {
|
|
setSuffixWidth(width);
|
|
}
|
|
// ================================ Effect ================================
|
|
function getItemWidth(index) {
|
|
return itemWidths.get(getKey(mergedData[index], index));
|
|
}
|
|
(0,useLayoutEffect/* default */.Z)(function () {
|
|
if (mergedContainerWidth && typeof mergedRestWidth === 'number' && mergedData) {
|
|
var totalWidth = suffixWidth;
|
|
var len = mergedData.length;
|
|
var lastIndex = len - 1;
|
|
// When data count change to 0, reset this since not loop will reach
|
|
if (!len) {
|
|
updateDisplayCount(0, null);
|
|
return;
|
|
}
|
|
for (var i = 0; i < len; i += 1) {
|
|
var currentItemWidth = getItemWidth(i);
|
|
// Fully will always render
|
|
if (fullySSR) {
|
|
currentItemWidth = currentItemWidth || 0;
|
|
}
|
|
// Break since data not ready
|
|
if (currentItemWidth === undefined) {
|
|
updateDisplayCount(i - 1, undefined, true);
|
|
break;
|
|
}
|
|
// Find best match
|
|
totalWidth += currentItemWidth;
|
|
if (
|
|
// Only one means `totalWidth` is the final width
|
|
lastIndex === 0 && totalWidth <= mergedContainerWidth ||
|
|
// Last two width will be the final width
|
|
i === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth) {
|
|
// Additional check if match the end
|
|
updateDisplayCount(lastIndex, null);
|
|
break;
|
|
} else if (totalWidth + mergedRestWidth > mergedContainerWidth) {
|
|
// Can not hold all the content to show rest
|
|
updateDisplayCount(i - 1, totalWidth - currentItemWidth - suffixWidth + restWidth);
|
|
break;
|
|
}
|
|
}
|
|
if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) {
|
|
setSuffixFixedStart(null);
|
|
}
|
|
}
|
|
}, [mergedContainerWidth, itemWidths, restWidth, suffixWidth, getKey, mergedData]);
|
|
// ================================ Render ================================
|
|
var displayRest = restReady && !!omittedItems.length;
|
|
var suffixStyle = {};
|
|
if (suffixFixedStart !== null && shouldResponsive) {
|
|
suffixStyle = {
|
|
position: 'absolute',
|
|
left: suffixFixedStart,
|
|
top: 0
|
|
};
|
|
}
|
|
var itemSharedProps = {
|
|
prefixCls: itemPrefixCls,
|
|
responsive: shouldResponsive,
|
|
component: itemComponent,
|
|
invalidate: invalidate
|
|
};
|
|
// >>>>> Choice render fun by `renderRawItem`
|
|
var internalRenderItemNode = renderRawItem ? function (item, index) {
|
|
var key = getKey(item, index);
|
|
return /*#__PURE__*/react.createElement(OverflowContext.Provider, {
|
|
key: key,
|
|
value: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, itemSharedProps), {}, {
|
|
order: index,
|
|
item: item,
|
|
itemKey: key,
|
|
registerSize: registerSize,
|
|
display: index <= mergedDisplayCount
|
|
})
|
|
}, renderRawItem(item, index));
|
|
} : function (item, index) {
|
|
var key = getKey(item, index);
|
|
return /*#__PURE__*/react.createElement(es_Item, (0,esm_extends/* default */.Z)({}, itemSharedProps, {
|
|
order: index,
|
|
key: key,
|
|
item: item,
|
|
renderItem: mergedRenderItem,
|
|
itemKey: key,
|
|
registerSize: registerSize,
|
|
display: index <= mergedDisplayCount
|
|
}));
|
|
};
|
|
// >>>>> Rest node
|
|
var restNode;
|
|
var restContextProps = {
|
|
order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER,
|
|
className: "".concat(itemPrefixCls, "-rest"),
|
|
registerSize: registerOverflowSize,
|
|
display: displayRest
|
|
};
|
|
if (!renderRawRest) {
|
|
var mergedRenderRest = renderRest || defaultRenderRest;
|
|
restNode = /*#__PURE__*/react.createElement(es_Item, (0,esm_extends/* default */.Z)({}, itemSharedProps, restContextProps), typeof mergedRenderRest === 'function' ? mergedRenderRest(omittedItems) : mergedRenderRest);
|
|
} else if (renderRawRest) {
|
|
restNode = /*#__PURE__*/react.createElement(OverflowContext.Provider, {
|
|
value: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, itemSharedProps), restContextProps)
|
|
}, renderRawRest(omittedItems));
|
|
}
|
|
var overflowNode = /*#__PURE__*/react.createElement(Component, (0,esm_extends/* default */.Z)({
|
|
className: classnames_default()(!invalidate && prefixCls, className),
|
|
style: style,
|
|
ref: ref
|
|
}, restProps), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /*#__PURE__*/react.createElement(es_Item, (0,esm_extends/* default */.Z)({}, itemSharedProps, {
|
|
responsive: isResponsive,
|
|
responsiveDisabled: !shouldResponsive,
|
|
order: mergedDisplayCount,
|
|
className: "".concat(itemPrefixCls, "-suffix"),
|
|
registerSize: registerSuffixSize,
|
|
display: true,
|
|
style: suffixStyle
|
|
}), suffix));
|
|
if (isResponsive) {
|
|
overflowNode = /*#__PURE__*/react.createElement(es/* default */.Z, {
|
|
onResize: onOverflowResize,
|
|
disabled: !shouldResponsive
|
|
}, overflowNode);
|
|
}
|
|
return overflowNode;
|
|
}
|
|
var ForwardOverflow = /*#__PURE__*/react.forwardRef(Overflow);
|
|
ForwardOverflow.displayName = 'Overflow';
|
|
ForwardOverflow.Item = es_RawItem;
|
|
ForwardOverflow.RESPONSIVE = RESPONSIVE;
|
|
ForwardOverflow.INVALIDATE = INVALIDATE;
|
|
// Convert to generic type
|
|
/* harmony default export */ var es_Overflow = (ForwardOverflow);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/rc-overflow/es/index.js
|
|
|
|
/* harmony default export */ var rc_overflow_es = (es_Overflow);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useMergedState.js
|
|
var useMergedState = __webpack_require__(21770);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js
|
|
var warning = __webpack_require__(80334);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/isEqual.js
|
|
var isEqual = __webpack_require__(91881);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/context/IdContext.js
|
|
|
|
var IdContext = /*#__PURE__*/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.useContext(IdContext);
|
|
return getMenuId(id, eventKey);
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useMemo.js
|
|
var useMemo = __webpack_require__(56982);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/context/MenuContext.js
|
|
|
|
|
|
var MenuContext_excluded = ["children", "locked"];
|
|
|
|
|
|
|
|
var MenuContext = /*#__PURE__*/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, MenuContext_excluded);
|
|
var context = 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.createElement(MenuContext.Provider, {
|
|
value: inheritableContext
|
|
}, children);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/context/PathContext.js
|
|
|
|
|
|
var EmptyList = [];
|
|
|
|
// ========================= Path Register =========================
|
|
|
|
var PathRegisterContext = /*#__PURE__*/react.createContext(null);
|
|
function useMeasure() {
|
|
return react.useContext(PathRegisterContext);
|
|
}
|
|
|
|
// ========================= Path Tracker ==========================
|
|
var PathTrackerContext = /*#__PURE__*/react.createContext(EmptyList);
|
|
function useFullPath(eventKey) {
|
|
var parentKeyPath = react.useContext(PathTrackerContext);
|
|
return react.useMemo(function () {
|
|
return eventKey !== undefined ? [].concat((0,toConsumableArray/* default */.Z)(parentKeyPath), [eventKey]) : parentKeyPath;
|
|
}, [parentKeyPath, eventKey]);
|
|
}
|
|
|
|
// =========================== Path User ===========================
|
|
|
|
var PathUserContext = /*#__PURE__*/react.createContext(null);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/context/PrivateContext.js
|
|
|
|
var PrivateContext = /*#__PURE__*/react.createContext({});
|
|
/* harmony default export */ var context_PrivateContext = (PrivateContext);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__(15105);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-util/es/Dom/isVisible.js
|
|
/* harmony default export */ var isVisible = (function (element) {
|
|
if (!element) {
|
|
return false;
|
|
}
|
|
if (element instanceof Element) {
|
|
if (element.offsetParent) {
|
|
return true;
|
|
}
|
|
if (element.getBBox) {
|
|
var _getBBox = element.getBBox(),
|
|
width = _getBBox.width,
|
|
height = _getBBox.height;
|
|
if (width || height) {
|
|
return true;
|
|
}
|
|
}
|
|
if (element.getBoundingClientRect) {
|
|
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
_width = _element$getBoundingC.width,
|
|
_height = _element$getBoundingC.height;
|
|
if (_width || _height) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
;// CONCATENATED MODULE: ./node_modules/rc-util/es/Dom/focus.js
|
|
|
|
|
|
function focusable(node) {
|
|
var includePositive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
if (isVisible(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();
|
|
}
|
|
}
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/hooks/useAccessibility.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// destruct to reduce minify size
|
|
var LEFT = KeyCode/* default.LEFT */.Z.LEFT,
|
|
RIGHT = KeyCode/* default.RIGHT */.Z.RIGHT,
|
|
UP = KeyCode/* default.UP */.Z.UP,
|
|
DOWN = KeyCode/* default.DOWN */.Z.DOWN,
|
|
ENTER = KeyCode/* default.ENTER */.Z.ENTER,
|
|
ESC = KeyCode/* default.ESC */.Z.ESC,
|
|
HOME = KeyCode/* default.HOME */.Z.HOME,
|
|
END = KeyCode/* default.END */.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];
|
|
}
|
|
function useAccessibility(mode, activeKey, isRtl, id, containerRef, getKeys, getKeyPath, triggerActiveKey, triggerAccessibilityOpen, originOnKeyDown) {
|
|
var rafRef = react.useRef();
|
|
var activeRef = react.useRef();
|
|
activeRef.current = activeKey;
|
|
var cleanRaf = function cleanRaf() {
|
|
raf/* default.cancel */.Z.cancel(rafRef.current);
|
|
};
|
|
react.useEffect(function () {
|
|
return function () {
|
|
cleanRaf();
|
|
};
|
|
}, []);
|
|
return function (e) {
|
|
var which = e.which;
|
|
if ([].concat(ArrowKeys, [ENTER, ESC, HOME, END]).includes(which)) {
|
|
// Convert key to elements
|
|
var elements;
|
|
var key2element;
|
|
var element2key;
|
|
|
|
// >>> Wrap as function since we use raf for some case
|
|
var refreshElements = function refreshElements() {
|
|
elements = new Set();
|
|
key2element = new Map();
|
|
element2key = new Map();
|
|
var keys = getKeys();
|
|
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;
|
|
};
|
|
refreshElements();
|
|
|
|
// 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
|
|
refreshElements();
|
|
var controlId = focusMenuElement.getAttribute('aria-controls');
|
|
var subQueryContainer = document.getElementById(controlId);
|
|
|
|
// Get sub focusable menu item
|
|
var targetElement = getNextFocusElement(subQueryContainer, 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 ? void 0 : originOnKeyDown(e);
|
|
};
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/utils/timeUtil.js
|
|
function nextSlice(callback) {
|
|
/* istanbul ignore next */
|
|
Promise.resolve().then(callback);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/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.useState({}),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
internalForceUpdate = _React$useState2[1];
|
|
var key2pathRef = (0,react.useRef)(new Map());
|
|
var path2keyRef = (0,react.useRef)(new Map());
|
|
var _React$useState3 = react.useState([]),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
overflowKeys = _React$useState4[0],
|
|
setOverflowKeys = _React$useState4[1];
|
|
var updateRef = (0,react.useRef)(0);
|
|
var destroyRef = (0,react.useRef)(false);
|
|
var forceUpdate = function forceUpdate() {
|
|
if (!destroyRef.current) {
|
|
internalForceUpdate({});
|
|
}
|
|
};
|
|
var registerPath = (0,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.useCallback)(function (key, keyPath) {
|
|
var connectedPath = getPathStr(keyPath);
|
|
path2keyRef.current.delete(connectedPath);
|
|
key2pathRef.current.delete(key);
|
|
}, []);
|
|
var refreshOverflowKeys = (0,react.useCallback)(function (keys) {
|
|
setOverflowKeys(keys);
|
|
}, []);
|
|
var getKeyPath = (0,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.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.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.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/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.useRef(func);
|
|
funRef.current = func;
|
|
var callback = 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/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.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/helpers/esm/classCallCheck.js
|
|
var classCallCheck = __webpack_require__(15671);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
var createClass = __webpack_require__(43144);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
var inherits = __webpack_require__(60136);
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules
|
|
var createSuper = __webpack_require__(51630);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/omit.js
|
|
var omit = __webpack_require__(98423);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/ref.js
|
|
var es_ref = __webpack_require__(42550);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/hooks/useActive.js
|
|
|
|
|
|
function useActive(eventKey, disabled, onMouseEnter, onMouseLeave) {
|
|
var _React$useContext = 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 ? void 0 : onMouseEnter({
|
|
key: eventKey,
|
|
domEvent: domEvent
|
|
});
|
|
onActive(eventKey);
|
|
};
|
|
ret.onMouseLeave = function (domEvent) {
|
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({
|
|
key: eventKey,
|
|
domEvent: domEvent
|
|
});
|
|
onInactive(eventKey);
|
|
};
|
|
}
|
|
return ret;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/hooks/useDirectionStyle.js
|
|
|
|
|
|
function useDirectionStyle(level) {
|
|
var _React$useContext = 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/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.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/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/es/MenuItem.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MenuItem_excluded = ["title", "attribute", "elementRef"],
|
|
MenuItem_excluded2 = ["style", "className", "eventKey", "warnKey", "disabled", "itemIcon", "children", "role", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "onFocus"],
|
|
MenuItem_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.createElement(rc_overflow_es.Item, (0,esm_extends/* default */.Z)({}, attribute, {
|
|
title: typeof title === 'string' ? title : undefined
|
|
}, passedProps, {
|
|
ref: elementRef
|
|
}));
|
|
}
|
|
}]);
|
|
return LegacyMenuItem;
|
|
}(react.Component);
|
|
/**
|
|
* Real Menu Item component
|
|
*/
|
|
var InternalMenuItem = /*#__PURE__*/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, MenuItem_excluded2);
|
|
var domDataId = useMenuId(eventKey);
|
|
var _React$useContext = 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.useContext(context_PrivateContext),
|
|
_internalRenderMenuItem = _React$useContext2._internalRenderMenuItem;
|
|
var itemCls = "".concat(prefixCls, "-item");
|
|
var legacyMenuItemRef = react.useRef();
|
|
var elementRef = 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, MenuItem_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 ? void 0 : onClick(warnItemProp(info));
|
|
onItemClick(info);
|
|
};
|
|
var onInternalKeyDown = function onInternalKeyDown(e) {
|
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
if (e.which === KeyCode/* default.ENTER */.Z.ENTER) {
|
|
var info = getEventInfo(e);
|
|
|
|
// Legacy. Key will also trigger click event
|
|
onClick === null || onClick === void 0 ? 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 ? void 0 : onFocus(e);
|
|
};
|
|
|
|
// ============================ Render ============================
|
|
var optionRoleProps = {};
|
|
if (props.role === 'option') {
|
|
optionRoleProps['aria-selected'] = selected;
|
|
}
|
|
var renderNode = /*#__PURE__*/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_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.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.useEffect(function () {
|
|
if (measure) {
|
|
measure.registerPath(eventKey, connectedKeyPath);
|
|
return function () {
|
|
measure.unregisterPath(eventKey, connectedKeyPath);
|
|
};
|
|
}
|
|
}, [connectedKeyPath]);
|
|
if (measure) {
|
|
return null;
|
|
}
|
|
|
|
// ======================== Render ========================
|
|
return /*#__PURE__*/react.createElement(InternalMenuItem, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref
|
|
}));
|
|
}
|
|
/* harmony default export */ var es_MenuItem = (/*#__PURE__*/react.forwardRef(MenuItem));
|
|
;// CONCATENATED MODULE: ./node_modules/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.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls,
|
|
mode = _React$useContext.mode,
|
|
rtl = _React$useContext.rtl;
|
|
return /*#__PURE__*/react.createElement("ul", (0,esm_extends/* default */.Z)({
|
|
className: 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.forwardRef(InternalSubMenuList);
|
|
SubMenuList.displayName = 'SubMenuList';
|
|
/* harmony default export */ var SubMenu_SubMenuList = (SubMenuList);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js
|
|
var toArray = __webpack_require__(50344);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/utils/commonUtil.js
|
|
|
|
|
|
|
|
function parseChildren(children, keyPath) {
|
|
return (0,toArray/* default */.Z)(children).map(function (child, index) {
|
|
if ( /*#__PURE__*/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.cloneElement(child, cloneProps);
|
|
}
|
|
return child;
|
|
});
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
function _typeof(o) {
|
|
"@babel/helpers - typeof";
|
|
|
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
return typeof o;
|
|
} : function (o) {
|
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
}, _typeof(o);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
|
|
function _toPrimitive(input, hint) {
|
|
if (_typeof(input) !== "object" || input === null) return input;
|
|
var prim = input[Symbol.toPrimitive];
|
|
if (prim !== undefined) {
|
|
var res = prim.call(input, hint || "default");
|
|
if (_typeof(res) !== "object") return res;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
return (hint === "string" ? String : Number)(input);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
|
|
|
|
function _toPropertyKey(arg) {
|
|
var key = _toPrimitive(arg, "string");
|
|
return _typeof(key) === "symbol" ? key : String(key);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
|
|
function _defineProperty(obj, key, value) {
|
|
key = _toPropertyKey(key);
|
|
if (key in obj) {
|
|
Object.defineProperty(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
return obj;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
|
|
function ownKeys(e, r) {
|
|
var t = Object.keys(e);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var o = Object.getOwnPropertySymbols(e);
|
|
r && (o = o.filter(function (r) {
|
|
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
})), t.push.apply(t, o);
|
|
}
|
|
return t;
|
|
}
|
|
function _objectSpread2(e) {
|
|
for (var r = 1; r < arguments.length; r++) {
|
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
_defineProperty(e, r, t[r]);
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
});
|
|
}
|
|
return e;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
function _arrayWithHoles(arr) {
|
|
if (Array.isArray(arr)) return arr;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
function _iterableToArrayLimit(r, l) {
|
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
if (null != t) {
|
|
var e,
|
|
n,
|
|
i,
|
|
u,
|
|
a = [],
|
|
f = !0,
|
|
o = !1;
|
|
try {
|
|
if (i = (t = t.call(r)).next, 0 === l) {
|
|
if (Object(t) !== t) return;
|
|
f = !1;
|
|
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
} catch (r) {
|
|
o = !0, n = r;
|
|
} finally {
|
|
try {
|
|
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
} finally {
|
|
if (o) throw n;
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
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;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
|
|
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(o);
|
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
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.");
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
|
|
|
|
|
|
|
|
function _slicedToArray(arr, i) {
|
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
|
|
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;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
|
|
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;
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/canUseDom.js
|
|
var canUseDom = __webpack_require__(98924);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/portal/es/Context.js
|
|
|
|
var OrderContext = /*#__PURE__*/react.createContext(null);
|
|
/* harmony default export */ var Context = (OrderContext);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/portal/es/useDom.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var EMPTY_LIST = [];
|
|
|
|
/**
|
|
* Will add `div` to document. Nest call will keep order
|
|
* @param render Render DOM in document
|
|
*/
|
|
function useDom(render, debug) {
|
|
var _React$useState = react.useState(function () {
|
|
if (!(0,canUseDom/* default */.Z)()) {
|
|
return null;
|
|
}
|
|
var defaultEle = document.createElement('div');
|
|
if (false) {}
|
|
return defaultEle;
|
|
}),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 1),
|
|
ele = _React$useState2[0];
|
|
|
|
// ========================== Order ==========================
|
|
var appendedRef = react.useRef(false);
|
|
var queueCreate = react.useContext(Context);
|
|
var _React$useState3 = react.useState(EMPTY_LIST),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
queue = _React$useState4[0],
|
|
setQueue = _React$useState4[1];
|
|
var mergedQueueCreate = queueCreate || (appendedRef.current ? undefined : function (appendFn) {
|
|
setQueue(function (origin) {
|
|
var newQueue = [appendFn].concat((0,toConsumableArray/* default */.Z)(origin));
|
|
return newQueue;
|
|
});
|
|
});
|
|
|
|
// =========================== DOM ===========================
|
|
function append() {
|
|
if (!ele.parentElement) {
|
|
document.body.appendChild(ele);
|
|
}
|
|
appendedRef.current = true;
|
|
}
|
|
function cleanup() {
|
|
var _ele$parentElement;
|
|
(_ele$parentElement = ele.parentElement) === null || _ele$parentElement === void 0 ? void 0 : _ele$parentElement.removeChild(ele);
|
|
appendedRef.current = false;
|
|
}
|
|
(0,useLayoutEffect/* default */.Z)(function () {
|
|
if (render) {
|
|
if (queueCreate) {
|
|
queueCreate(append);
|
|
} else {
|
|
append();
|
|
}
|
|
} else {
|
|
cleanup();
|
|
}
|
|
return cleanup;
|
|
}, [render]);
|
|
(0,useLayoutEffect/* default */.Z)(function () {
|
|
if (queue.length) {
|
|
queue.forEach(function (appendFn) {
|
|
return appendFn();
|
|
});
|
|
setQueue(EMPTY_LIST);
|
|
}
|
|
}, [queue]);
|
|
return [ele, mergedQueueCreate];
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/dynamicCSS.js + 1 modules
|
|
var dynamicCSS = __webpack_require__(48981);
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/getScrollBarSize.js
|
|
var getScrollBarSize = __webpack_require__(74204);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/portal/es/util.js
|
|
/**
|
|
* Test usage export. Do not use in your production
|
|
*/
|
|
function isBodyOverflowing() {
|
|
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/portal/es/useScrollLocker.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var UNIQUE_ID = "rc-util-locker-".concat(Date.now());
|
|
var uuid = 0;
|
|
function useScrollLocker(lock) {
|
|
var mergedLock = !!lock;
|
|
var _React$useState = react.useState(function () {
|
|
uuid += 1;
|
|
return "".concat(UNIQUE_ID, "_").concat(uuid);
|
|
}),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 1),
|
|
id = _React$useState2[0];
|
|
(0,useLayoutEffect/* default */.Z)(function () {
|
|
if (mergedLock) {
|
|
var scrollbarSize = (0,getScrollBarSize/* getTargetScrollBarSize */.o)(document.body).width;
|
|
var isOverflow = isBodyOverflowing();
|
|
(0,dynamicCSS/* updateCSS */.hq)("\nhtml body {\n overflow-y: hidden;\n ".concat(isOverflow ? "width: calc(100% - ".concat(scrollbarSize, "px);") : '', "\n}"), id);
|
|
} else {
|
|
(0,dynamicCSS/* removeCSS */.jL)(id);
|
|
}
|
|
return function () {
|
|
(0,dynamicCSS/* removeCSS */.jL)(id);
|
|
};
|
|
}, [mergedLock, id]);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/portal/es/mock.js
|
|
var inline = false;
|
|
function inlineMock(nextInline) {
|
|
if (typeof nextInline === 'boolean') {
|
|
inline = nextInline;
|
|
}
|
|
return inline;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/portal/es/Portal.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getPortalContainer = function getPortalContainer(getContainer) {
|
|
if (getContainer === false) {
|
|
return false;
|
|
}
|
|
if (!(0,canUseDom/* default */.Z)() || !getContainer) {
|
|
return null;
|
|
}
|
|
if (typeof getContainer === 'string') {
|
|
return document.querySelector(getContainer);
|
|
}
|
|
if (typeof getContainer === 'function') {
|
|
return getContainer();
|
|
}
|
|
return getContainer;
|
|
};
|
|
var Portal = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
var open = props.open,
|
|
autoLock = props.autoLock,
|
|
getContainer = props.getContainer,
|
|
debug = props.debug,
|
|
_props$autoDestroy = props.autoDestroy,
|
|
autoDestroy = _props$autoDestroy === void 0 ? true : _props$autoDestroy,
|
|
children = props.children;
|
|
var _React$useState = react.useState(open),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
shouldRender = _React$useState2[0],
|
|
setShouldRender = _React$useState2[1];
|
|
var mergedRender = shouldRender || open;
|
|
|
|
// ========================= Warning =========================
|
|
if (false) {}
|
|
|
|
// ====================== Should Render ======================
|
|
react.useEffect(function () {
|
|
if (autoDestroy || open) {
|
|
setShouldRender(open);
|
|
}
|
|
}, [open, autoDestroy]);
|
|
|
|
// ======================== Container ========================
|
|
var _React$useState3 = react.useState(function () {
|
|
return getPortalContainer(getContainer);
|
|
}),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
innerContainer = _React$useState4[0],
|
|
setInnerContainer = _React$useState4[1];
|
|
react.useEffect(function () {
|
|
var customizeContainer = getPortalContainer(getContainer);
|
|
|
|
// Tell component that we check this in effect which is safe to be `null`
|
|
setInnerContainer(customizeContainer !== null && customizeContainer !== void 0 ? customizeContainer : null);
|
|
});
|
|
var _useDom = useDom(mergedRender && !innerContainer, debug),
|
|
_useDom2 = (0,slicedToArray/* default */.Z)(_useDom, 2),
|
|
defaultContainer = _useDom2[0],
|
|
queueCreate = _useDom2[1];
|
|
var mergedContainer = innerContainer !== null && innerContainer !== void 0 ? innerContainer : defaultContainer;
|
|
|
|
// ========================= Locker ==========================
|
|
useScrollLocker(autoLock && open && (0,canUseDom/* default */.Z)() && (mergedContainer === defaultContainer || mergedContainer === document.body));
|
|
|
|
// =========================== Ref ===========================
|
|
var childRef = null;
|
|
if (children && (0,es_ref/* supportRef */.Yr)(children) && ref) {
|
|
var _ref = children;
|
|
childRef = _ref.ref;
|
|
}
|
|
var mergedRef = (0,es_ref/* useComposeRef */.x1)(childRef, ref);
|
|
|
|
// ========================= Render ==========================
|
|
// Do not render when nothing need render
|
|
// When innerContainer is `undefined`, it may not ready since user use ref in the same render
|
|
if (!mergedRender || !(0,canUseDom/* default */.Z)() || innerContainer === undefined) {
|
|
return null;
|
|
}
|
|
|
|
// Render inline
|
|
var renderInline = mergedContainer === false || inlineMock();
|
|
var reffedChildren = children;
|
|
if (ref) {
|
|
reffedChildren = /*#__PURE__*/react.cloneElement(children, {
|
|
ref: mergedRef
|
|
});
|
|
}
|
|
return /*#__PURE__*/react.createElement(Context.Provider, {
|
|
value: queueCreate
|
|
}, renderInline ? reffedChildren : /*#__PURE__*/(0,react_dom.createPortal)(reffedChildren, mergedContainer));
|
|
});
|
|
if (false) {}
|
|
/* harmony default export */ var es_Portal = (Portal);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/portal/es/index.js
|
|
|
|
|
|
|
|
/* harmony default export */ var portal_es = (es_Portal);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/Dom/findDOMNode.js
|
|
|
|
|
|
function isDOM(node) {
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/Element
|
|
// Since XULElement is also subclass of Element, we only need HTMLElement and SVGElement
|
|
return node instanceof HTMLElement || node instanceof SVGElement;
|
|
}
|
|
|
|
/**
|
|
* Return if a node is a DOM node. Else will return by `findDOMNode`
|
|
*/
|
|
function findDOMNode(node) {
|
|
if (isDOM(node)) {
|
|
return node;
|
|
}
|
|
if (node instanceof React.Component) {
|
|
return ReactDOM.findDOMNode(node);
|
|
}
|
|
return null;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/Dom/shadow.js
|
|
function getRoot(ele) {
|
|
var _ele$getRootNode;
|
|
return ele === null || ele === void 0 ? void 0 : (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
|
|
}
|
|
|
|
/**
|
|
* Check if is in shadowRoot
|
|
*/
|
|
function inShadow(ele) {
|
|
return getRoot(ele) instanceof ShadowRoot;
|
|
}
|
|
|
|
/**
|
|
* Return shadowRoot if possible
|
|
*/
|
|
function getShadowRoot(ele) {
|
|
return inShadow(ele) ? getRoot(ele) : null;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/hooks/useEvent.js
|
|
|
|
function useEvent_useEvent(callback) {
|
|
var fnRef = react.useRef();
|
|
fnRef.current = callback;
|
|
var memoFn = react.useCallback(function () {
|
|
var _fnRef$current;
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
|
|
}, []);
|
|
return memoFn;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
function arrayWithHoles_arrayWithHoles(arr) {
|
|
if (Array.isArray(arr)) return arr;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
|
function iterableToArrayLimit_iterableToArrayLimit(arr, i) {
|
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
if (null != _i) {
|
|
var _s,
|
|
_e,
|
|
_x,
|
|
_r,
|
|
_arr = [],
|
|
_n = !0,
|
|
_d = !1;
|
|
try {
|
|
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
if (Object(_i) !== _i) return;
|
|
_n = !1;
|
|
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
} catch (err) {
|
|
_d = !0, _e = err;
|
|
} finally {
|
|
try {
|
|
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
} finally {
|
|
if (_d) throw _e;
|
|
}
|
|
}
|
|
return _arr;
|
|
}
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
|
function arrayLikeToArray_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;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
|
|
|
function unsupportedIterableToArray_unsupportedIterableToArray(o, minLen) {
|
|
if (!o) return;
|
|
if (typeof o === "string") return arrayLikeToArray_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(o);
|
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray_arrayLikeToArray(o, minLen);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
|
function nonIterableRest_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.");
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
|
|
|
|
|
|
|
|
|
function slicedToArray_slicedToArray(arr, i) {
|
|
return arrayWithHoles_arrayWithHoles(arr) || iterableToArrayLimit_iterableToArrayLimit(arr, i) || unsupportedIterableToArray_unsupportedIterableToArray(arr, i) || nonIterableRest_nonIterableRest();
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
function typeof_typeof(obj) {
|
|
"@babel/helpers - typeof";
|
|
|
|
return typeof_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
return typeof obj;
|
|
} : function (obj) {
|
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
}, typeof_typeof(obj);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
|
|
function toPrimitive_toPrimitive(input, hint) {
|
|
if (typeof_typeof(input) !== "object" || input === null) return input;
|
|
var prim = input[Symbol.toPrimitive];
|
|
if (prim !== undefined) {
|
|
var res = prim.call(input, hint || "default");
|
|
if (typeof_typeof(res) !== "object") return res;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
return (hint === "string" ? String : Number)(input);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
|
|
|
|
function toPropertyKey_toPropertyKey(arg) {
|
|
var key = toPrimitive_toPrimitive(arg, "string");
|
|
return typeof_typeof(key) === "symbol" ? key : String(key);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
|
|
function defineProperty_defineProperty(obj, key, value) {
|
|
key = toPropertyKey_toPropertyKey(key);
|
|
if (key in obj) {
|
|
Object.defineProperty(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
return obj;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
|
|
function objectSpread2_ownKeys(object, enumerableOnly) {
|
|
var keys = Object.keys(object);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
})), keys.push.apply(keys, symbols);
|
|
}
|
|
return keys;
|
|
}
|
|
function objectSpread2_objectSpread2(target) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
i % 2 ? objectSpread2_ownKeys(Object(source), !0).forEach(function (key) {
|
|
defineProperty_defineProperty(target, key, source[key]);
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : objectSpread2_ownKeys(Object(source)).forEach(function (key) {
|
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
});
|
|
}
|
|
return target;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/hooks/useId.js
|
|
|
|
|
|
|
|
function getUseId() {
|
|
// We need fully clone React function here to avoid webpack warning React 17 do not export `useId`
|
|
var fullClone = objectSpread2_objectSpread2({}, react_namespaceObject);
|
|
return fullClone.useId;
|
|
}
|
|
var useId_uuid = 0;
|
|
|
|
/** @private Note only worked in develop env. Not work in production. */
|
|
function resetUuid() {
|
|
if (false) {}
|
|
}
|
|
var useOriginId = getUseId();
|
|
/* harmony default export */ var useId = (useOriginId ?
|
|
// Use React `useId`
|
|
function useId(id) {
|
|
var reactId = useOriginId();
|
|
|
|
// Developer passed id is single source of truth
|
|
if (id) {
|
|
return id;
|
|
}
|
|
|
|
// Test env always return mock id
|
|
if (false) {}
|
|
return reactId;
|
|
} :
|
|
// Use compatible of `useId`
|
|
function useCompatId(id) {
|
|
// Inner id for accessibility usage. Only work in client side
|
|
var _React$useState = react.useState('ssr-id'),
|
|
_React$useState2 = slicedToArray_slicedToArray(_React$useState, 2),
|
|
innerId = _React$useState2[0],
|
|
setInnerId = _React$useState2[1];
|
|
react.useEffect(function () {
|
|
var nextId = useId_uuid;
|
|
useId_uuid += 1;
|
|
setInnerId("rc_unique_".concat(nextId));
|
|
}, []);
|
|
|
|
// Developer passed id is single source of truth
|
|
if (id) {
|
|
return id;
|
|
}
|
|
|
|
// Test env always return mock id
|
|
if (false) {}
|
|
|
|
// Return react native id or inner id
|
|
return innerId;
|
|
});
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/Dom/canUseDom.js
|
|
function canUseDom_canUseDom() {
|
|
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/hooks/useLayoutEffect.js
|
|
|
|
|
|
|
|
/**
|
|
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
|
*/
|
|
var useInternalLayoutEffect = true && canUseDom_canUseDom() ? react.useLayoutEffect : react.useEffect;
|
|
var useLayoutEffect_useLayoutEffect = function useLayoutEffect(callback, deps) {
|
|
var firstMountRef = react.useRef(true);
|
|
useInternalLayoutEffect(function () {
|
|
return callback(firstMountRef.current);
|
|
}, deps);
|
|
|
|
// We tell react that first mount has passed
|
|
useInternalLayoutEffect(function () {
|
|
firstMountRef.current = false;
|
|
return function () {
|
|
firstMountRef.current = true;
|
|
};
|
|
}, []);
|
|
};
|
|
var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) {
|
|
useLayoutEffect_useLayoutEffect(function (firstMount) {
|
|
if (!firstMount) {
|
|
return callback();
|
|
}
|
|
}, deps);
|
|
};
|
|
/* harmony default export */ var hooks_useLayoutEffect = (useLayoutEffect_useLayoutEffect);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/isMobile.js
|
|
/* harmony default export */ var isMobile = (function () {
|
|
if (typeof navigator === 'undefined' || typeof window === 'undefined') {
|
|
return false;
|
|
}
|
|
var agent = navigator.userAgent || navigator.vendor || window.opera;
|
|
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(agent === null || agent === void 0 ? void 0 : agent.substr(0, 4));
|
|
});
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/extends.js
|
|
function _extends() {
|
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
var source = arguments[i];
|
|
for (var key in source) {
|
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
}
|
|
return target;
|
|
};
|
|
return _extends.apply(this, arguments);
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/rc-motion/es/index.js + 11 modules
|
|
var rc_motion_es = __webpack_require__(62874);
|
|
// EXTERNAL MODULE: ./node_modules/rc-menu/node_modules/react-is/index.js
|
|
var react_is = __webpack_require__(8399);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/hooks/useMemo.js
|
|
|
|
function useMemo_useMemo(getValue, condition, shouldUpdate) {
|
|
var cacheRef = react.useRef({});
|
|
if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
cacheRef.current.value = getValue();
|
|
cacheRef.current.condition = condition;
|
|
}
|
|
return cacheRef.current.value;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/ref.js
|
|
|
|
/* eslint-disable no-param-reassign */
|
|
|
|
|
|
|
|
|
|
function fillRef(ref, node) {
|
|
if (typeof ref === 'function') {
|
|
ref(node);
|
|
} else if (typeof_typeof(ref) === 'object' && ref && 'current' in ref) {
|
|
ref.current = node;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Merge refs into one ref function to support ref passing.
|
|
*/
|
|
function composeRef() {
|
|
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
refs[_key] = arguments[_key];
|
|
}
|
|
var refList = refs.filter(function (ref) {
|
|
return ref;
|
|
});
|
|
if (refList.length <= 1) {
|
|
return refList[0];
|
|
}
|
|
return function (node) {
|
|
refs.forEach(function (ref) {
|
|
fillRef(ref, node);
|
|
});
|
|
};
|
|
}
|
|
function useComposeRef() {
|
|
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
refs[_key2] = arguments[_key2];
|
|
}
|
|
return useMemo_useMemo(function () {
|
|
return composeRef.apply(void 0, refs);
|
|
}, refs, function (prev, next) {
|
|
return prev.length !== next.length || prev.every(function (ref, i) {
|
|
return ref !== next[i];
|
|
});
|
|
});
|
|
}
|
|
function supportRef(nodeOrComponent) {
|
|
var _type$prototype, _nodeOrComponent$prot;
|
|
var type = (0,react_is.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
|
|
|
|
// Function component node
|
|
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
|
|
return false;
|
|
}
|
|
|
|
// Class component
|
|
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function supportNodeRef(node) {
|
|
if (! /*#__PURE__*/isValidElement(node)) {
|
|
return false;
|
|
}
|
|
if (isFragment(node)) {
|
|
return false;
|
|
}
|
|
return supportRef(node);
|
|
}
|
|
/* eslint-enable */
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/Popup/Arrow.js
|
|
|
|
|
|
function Arrow(props) {
|
|
var prefixCls = props.prefixCls,
|
|
align = props.align,
|
|
arrow = props.arrow,
|
|
arrowPos = props.arrowPos;
|
|
var _ref = arrow || {},
|
|
className = _ref.className,
|
|
content = _ref.content;
|
|
var _arrowPos$x = arrowPos.x,
|
|
x = _arrowPos$x === void 0 ? 0 : _arrowPos$x,
|
|
_arrowPos$y = arrowPos.y,
|
|
y = _arrowPos$y === void 0 ? 0 : _arrowPos$y;
|
|
var arrowRef = react.useRef();
|
|
|
|
// Skip if no align
|
|
if (!align || !align.points) {
|
|
return null;
|
|
}
|
|
var alignStyle = {
|
|
position: 'absolute'
|
|
};
|
|
|
|
// Skip if no need to align
|
|
if (align.autoArrow !== false) {
|
|
var popupPoints = align.points[0];
|
|
var targetPoints = align.points[1];
|
|
var popupTB = popupPoints[0];
|
|
var popupLR = popupPoints[1];
|
|
var targetTB = targetPoints[0];
|
|
var targetLR = targetPoints[1];
|
|
|
|
// Top & Bottom
|
|
if (popupTB === targetTB || !['t', 'b'].includes(popupTB)) {
|
|
alignStyle.top = y;
|
|
} else if (popupTB === 't') {
|
|
alignStyle.top = 0;
|
|
} else {
|
|
alignStyle.bottom = 0;
|
|
}
|
|
|
|
// Left & Right
|
|
if (popupLR === targetLR || !['l', 'r'].includes(popupLR)) {
|
|
alignStyle.left = x;
|
|
} else if (popupLR === 'l') {
|
|
alignStyle.left = 0;
|
|
} else {
|
|
alignStyle.right = 0;
|
|
}
|
|
}
|
|
return /*#__PURE__*/react.createElement("div", {
|
|
ref: arrowRef,
|
|
className: classnames_default()("".concat(prefixCls, "-arrow"), className),
|
|
style: alignStyle
|
|
}, content);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/Popup/Mask.js
|
|
|
|
|
|
|
|
|
|
function Mask(props) {
|
|
var prefixCls = props.prefixCls,
|
|
open = props.open,
|
|
zIndex = props.zIndex,
|
|
mask = props.mask,
|
|
motion = props.motion;
|
|
if (!mask) {
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/react.createElement(rc_motion_es/* default */.Z, _extends({}, motion, {
|
|
motionAppear: true,
|
|
visible: open,
|
|
removeOnLeave: true
|
|
}), function (_ref) {
|
|
var className = _ref.className;
|
|
return /*#__PURE__*/react.createElement("div", {
|
|
style: {
|
|
zIndex: zIndex
|
|
},
|
|
className: classnames_default()("".concat(prefixCls, "-mask"), className)
|
|
});
|
|
});
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/Popup/PopupContent.js
|
|
|
|
var PopupContent = /*#__PURE__*/react.memo(function (_ref) {
|
|
var children = _ref.children;
|
|
return children;
|
|
}, function (_, next) {
|
|
return next.cache;
|
|
});
|
|
if (false) {}
|
|
/* harmony default export */ var Popup_PopupContent = (PopupContent);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/Popup/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Popup = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
var popup = props.popup,
|
|
className = props.className,
|
|
prefixCls = props.prefixCls,
|
|
style = props.style,
|
|
target = props.target,
|
|
_onVisibleChanged = props.onVisibleChanged,
|
|
open = props.open,
|
|
keepDom = props.keepDom,
|
|
fresh = props.fresh,
|
|
onClick = props.onClick,
|
|
mask = props.mask,
|
|
arrow = props.arrow,
|
|
arrowPos = props.arrowPos,
|
|
align = props.align,
|
|
motion = props.motion,
|
|
maskMotion = props.maskMotion,
|
|
forceRender = props.forceRender,
|
|
getPopupContainer = props.getPopupContainer,
|
|
autoDestroy = props.autoDestroy,
|
|
Portal = props.portal,
|
|
zIndex = props.zIndex,
|
|
onMouseEnter = props.onMouseEnter,
|
|
onMouseLeave = props.onMouseLeave,
|
|
onPointerEnter = props.onPointerEnter,
|
|
ready = props.ready,
|
|
offsetX = props.offsetX,
|
|
offsetY = props.offsetY,
|
|
offsetR = props.offsetR,
|
|
offsetB = props.offsetB,
|
|
onAlign = props.onAlign,
|
|
onPrepare = props.onPrepare,
|
|
stretch = props.stretch,
|
|
targetWidth = props.targetWidth,
|
|
targetHeight = props.targetHeight;
|
|
var childNode = typeof popup === 'function' ? popup() : popup;
|
|
|
|
// We can not remove holder only when motion finished.
|
|
var isNodeVisible = open || keepDom;
|
|
|
|
// ======================= Container ========================
|
|
var getPopupContainerNeedParams = (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.length) > 0;
|
|
var _React$useState = react.useState(!getPopupContainer || !getPopupContainerNeedParams),
|
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
show = _React$useState2[0],
|
|
setShow = _React$useState2[1];
|
|
|
|
// Delay to show since `getPopupContainer` need target element
|
|
hooks_useLayoutEffect(function () {
|
|
if (!show && getPopupContainerNeedParams && target) {
|
|
setShow(true);
|
|
}
|
|
}, [show, getPopupContainerNeedParams, target]);
|
|
|
|
// ========================= Render =========================
|
|
if (!show) {
|
|
return null;
|
|
}
|
|
|
|
// >>>>> Offset
|
|
var AUTO = 'auto';
|
|
var offsetStyle = {
|
|
left: '-1000vw',
|
|
top: '-1000vh',
|
|
right: AUTO,
|
|
bottom: AUTO
|
|
};
|
|
|
|
// Set align style
|
|
if (ready || !open) {
|
|
var _experimental;
|
|
var points = align.points;
|
|
var dynamicInset = align.dynamicInset || ((_experimental = align._experimental) === null || _experimental === void 0 ? void 0 : _experimental.dynamicInset);
|
|
var alignRight = dynamicInset && points[0][1] === 'r';
|
|
var alignBottom = dynamicInset && points[0][0] === 'b';
|
|
if (alignRight) {
|
|
offsetStyle.right = offsetR;
|
|
offsetStyle.left = AUTO;
|
|
} else {
|
|
offsetStyle.left = offsetX;
|
|
offsetStyle.right = AUTO;
|
|
}
|
|
if (alignBottom) {
|
|
offsetStyle.bottom = offsetB;
|
|
offsetStyle.top = AUTO;
|
|
} else {
|
|
offsetStyle.top = offsetY;
|
|
offsetStyle.bottom = AUTO;
|
|
}
|
|
}
|
|
|
|
// >>>>> Misc
|
|
var miscStyle = {};
|
|
if (stretch) {
|
|
if (stretch.includes('height') && targetHeight) {
|
|
miscStyle.height = targetHeight;
|
|
} else if (stretch.includes('minHeight') && targetHeight) {
|
|
miscStyle.minHeight = targetHeight;
|
|
}
|
|
if (stretch.includes('width') && targetWidth) {
|
|
miscStyle.width = targetWidth;
|
|
} else if (stretch.includes('minWidth') && targetWidth) {
|
|
miscStyle.minWidth = targetWidth;
|
|
}
|
|
}
|
|
if (!open) {
|
|
miscStyle.pointerEvents = 'none';
|
|
}
|
|
return /*#__PURE__*/react.createElement(Portal, {
|
|
open: forceRender || isNodeVisible,
|
|
getContainer: getPopupContainer && function () {
|
|
return getPopupContainer(target);
|
|
},
|
|
autoDestroy: autoDestroy
|
|
}, /*#__PURE__*/react.createElement(Mask, {
|
|
prefixCls: prefixCls,
|
|
open: open,
|
|
zIndex: zIndex,
|
|
mask: mask,
|
|
motion: maskMotion
|
|
}), /*#__PURE__*/react.createElement(es/* default */.Z, {
|
|
onResize: onAlign,
|
|
disabled: !open
|
|
}, function (resizeObserverRef) {
|
|
return /*#__PURE__*/react.createElement(rc_motion_es/* default */.Z, _extends({
|
|
motionAppear: true,
|
|
motionEnter: true,
|
|
motionLeave: true,
|
|
removeOnLeave: false,
|
|
forceRender: forceRender,
|
|
leavedClassName: "".concat(prefixCls, "-hidden")
|
|
}, motion, {
|
|
onAppearPrepare: onPrepare,
|
|
onEnterPrepare: onPrepare,
|
|
visible: open,
|
|
onVisibleChanged: function onVisibleChanged(nextVisible) {
|
|
var _motion$onVisibleChan;
|
|
motion === null || motion === void 0 || (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 || _motion$onVisibleChan.call(motion, nextVisible);
|
|
_onVisibleChanged(nextVisible);
|
|
}
|
|
}), function (_ref, motionRef) {
|
|
var motionClassName = _ref.className,
|
|
motionStyle = _ref.style;
|
|
var cls = classnames_default()(prefixCls, motionClassName, className);
|
|
return /*#__PURE__*/react.createElement("div", {
|
|
ref: composeRef(resizeObserverRef, ref, motionRef),
|
|
className: cls,
|
|
style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
'--arrow-x': "".concat(arrowPos.x || 0, "px"),
|
|
'--arrow-y': "".concat(arrowPos.y || 0, "px")
|
|
}, offsetStyle), miscStyle), motionStyle), {}, {
|
|
boxSizing: 'border-box',
|
|
zIndex: zIndex
|
|
}, style),
|
|
onMouseEnter: onMouseEnter,
|
|
onMouseLeave: onMouseLeave,
|
|
onPointerEnter: onPointerEnter,
|
|
onClick: onClick
|
|
}, arrow && /*#__PURE__*/react.createElement(Arrow, {
|
|
prefixCls: prefixCls,
|
|
arrow: arrow,
|
|
arrowPos: arrowPos,
|
|
align: align
|
|
}), /*#__PURE__*/react.createElement(Popup_PopupContent, {
|
|
cache: !open && !fresh
|
|
}, childNode));
|
|
});
|
|
}));
|
|
});
|
|
if (false) {}
|
|
/* harmony default export */ var es_Popup = (Popup);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/TriggerWrapper.js
|
|
|
|
|
|
var TriggerWrapper = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
var children = props.children,
|
|
getTriggerDOMNode = props.getTriggerDOMNode;
|
|
var canUseRef = supportRef(children);
|
|
|
|
// When use `getTriggerDOMNode`, we should do additional work to get the real dom
|
|
var setRef = react.useCallback(function (node) {
|
|
fillRef(ref, getTriggerDOMNode ? getTriggerDOMNode(node) : node);
|
|
}, [getTriggerDOMNode]);
|
|
var mergedRef = useComposeRef(setRef, children.ref);
|
|
return canUseRef ? /*#__PURE__*/react.cloneElement(children, {
|
|
ref: mergedRef
|
|
}) : children;
|
|
});
|
|
if (false) {}
|
|
/* harmony default export */ var es_TriggerWrapper = (TriggerWrapper);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/context.js
|
|
|
|
var TriggerContext = /*#__PURE__*/react.createContext(null);
|
|
/* harmony default export */ var es_context = (TriggerContext);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/hooks/useAction.js
|
|
|
|
function useAction_toArray(val) {
|
|
return val ? Array.isArray(val) ? val : [val] : [];
|
|
}
|
|
function useAction(mobile, action, showAction, hideAction) {
|
|
return react.useMemo(function () {
|
|
var mergedShowAction = useAction_toArray(showAction !== null && showAction !== void 0 ? showAction : action);
|
|
var mergedHideAction = useAction_toArray(hideAction !== null && hideAction !== void 0 ? hideAction : action);
|
|
var showActionSet = new Set(mergedShowAction);
|
|
var hideActionSet = new Set(mergedHideAction);
|
|
if (mobile) {
|
|
if (showActionSet.has('hover')) {
|
|
showActionSet.delete('hover');
|
|
showActionSet.add('click');
|
|
}
|
|
if (hideActionSet.has('hover')) {
|
|
hideActionSet.delete('hover');
|
|
hideActionSet.add('click');
|
|
}
|
|
}
|
|
return [showActionSet, hideActionSet];
|
|
}, [mobile, action, showAction, hideAction]);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/Dom/isVisible.js
|
|
/* harmony default export */ var Dom_isVisible = (function (element) {
|
|
if (!element) {
|
|
return false;
|
|
}
|
|
if (element instanceof Element) {
|
|
if (element.offsetParent) {
|
|
return true;
|
|
}
|
|
if (element.getBBox) {
|
|
var _getBBox = element.getBBox(),
|
|
width = _getBBox.width,
|
|
height = _getBBox.height;
|
|
if (width || height) {
|
|
return true;
|
|
}
|
|
}
|
|
if (element.getBoundingClientRect) {
|
|
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
_width = _element$getBoundingC.width,
|
|
_height = _element$getBoundingC.height;
|
|
if (_width || _height) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/util.js
|
|
|
|
function isPointsEq() {
|
|
var a1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
var a2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
var isAlignPoint = arguments.length > 2 ? arguments[2] : undefined;
|
|
if (isAlignPoint) {
|
|
return a1[0] === a2[0];
|
|
}
|
|
return a1[0] === a2[0] && a1[1] === a2[1];
|
|
}
|
|
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
|
var points = align.points;
|
|
var placements = Object.keys(builtinPlacements);
|
|
for (var i = 0; i < placements.length; i += 1) {
|
|
var _builtinPlacements$pl;
|
|
var placement = placements[i];
|
|
if (isPointsEq((_builtinPlacements$pl = builtinPlacements[placement]) === null || _builtinPlacements$pl === void 0 ? void 0 : _builtinPlacements$pl.points, points, isAlignPoint)) {
|
|
return "".concat(prefixCls, "-placement-").concat(placement);
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
/** @deprecated We should not use this if we can refactor all deps */
|
|
function getMotion(prefixCls, motion, animation, transitionName) {
|
|
if (motion) {
|
|
return motion;
|
|
}
|
|
if (animation) {
|
|
return {
|
|
motionName: "".concat(prefixCls, "-").concat(animation)
|
|
};
|
|
}
|
|
if (transitionName) {
|
|
return {
|
|
motionName: transitionName
|
|
};
|
|
}
|
|
return null;
|
|
}
|
|
function getWin(ele) {
|
|
return ele.ownerDocument.defaultView;
|
|
}
|
|
|
|
/**
|
|
* Get all the scrollable parent elements of the element
|
|
* @param ele The element to be detected
|
|
* @param areaOnly Only return the parent which will cut visible area
|
|
*/
|
|
function collectScroller(ele) {
|
|
var scrollerList = [];
|
|
var current = ele === null || ele === void 0 ? void 0 : ele.parentElement;
|
|
var scrollStyle = ['hidden', 'scroll', 'clip', 'auto'];
|
|
while (current) {
|
|
var _getWin$getComputedSt = getWin(current).getComputedStyle(current),
|
|
overflowX = _getWin$getComputedSt.overflowX,
|
|
overflowY = _getWin$getComputedSt.overflowY,
|
|
overflow = _getWin$getComputedSt.overflow;
|
|
if ([overflowX, overflowY, overflow].some(function (o) {
|
|
return scrollStyle.includes(o);
|
|
})) {
|
|
scrollerList.push(current);
|
|
}
|
|
current = current.parentElement;
|
|
}
|
|
return scrollerList;
|
|
}
|
|
function toNum(num) {
|
|
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
return Number.isNaN(num) ? defaultValue : num;
|
|
}
|
|
function getPxValue(val) {
|
|
return toNum(parseFloat(val), 0);
|
|
}
|
|
/**
|
|
*
|
|
*
|
|
* **************************************
|
|
* * Border *
|
|
* * ************************** *
|
|
* * * * * *
|
|
* * B * * S * B *
|
|
* * o * * c * o *
|
|
* * r * Content * r * r *
|
|
* * d * * o * d *
|
|
* * e * * l * e *
|
|
* * r ******************** l * r *
|
|
* * * Scroll * *
|
|
* * ************************** *
|
|
* * Border *
|
|
* **************************************
|
|
*
|
|
*/
|
|
/**
|
|
* Get visible area of element
|
|
*/
|
|
function getVisibleArea(initArea, scrollerList) {
|
|
var visibleArea = _objectSpread2({}, initArea);
|
|
(scrollerList || []).forEach(function (ele) {
|
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) {
|
|
return;
|
|
}
|
|
|
|
// Skip if static position which will not affect visible area
|
|
var _getWin$getComputedSt2 = getWin(ele).getComputedStyle(ele),
|
|
overflow = _getWin$getComputedSt2.overflow,
|
|
overflowClipMargin = _getWin$getComputedSt2.overflowClipMargin,
|
|
borderTopWidth = _getWin$getComputedSt2.borderTopWidth,
|
|
borderBottomWidth = _getWin$getComputedSt2.borderBottomWidth,
|
|
borderLeftWidth = _getWin$getComputedSt2.borderLeftWidth,
|
|
borderRightWidth = _getWin$getComputedSt2.borderRightWidth;
|
|
var eleRect = ele.getBoundingClientRect();
|
|
var eleOutHeight = ele.offsetHeight,
|
|
eleInnerHeight = ele.clientHeight,
|
|
eleOutWidth = ele.offsetWidth,
|
|
eleInnerWidth = ele.clientWidth;
|
|
var borderTopNum = getPxValue(borderTopWidth);
|
|
var borderBottomNum = getPxValue(borderBottomWidth);
|
|
var borderLeftNum = getPxValue(borderLeftWidth);
|
|
var borderRightNum = getPxValue(borderRightWidth);
|
|
var scaleX = toNum(Math.round(eleRect.width / eleOutWidth * 1000) / 1000);
|
|
var scaleY = toNum(Math.round(eleRect.height / eleOutHeight * 1000) / 1000);
|
|
|
|
// Original visible area
|
|
var eleScrollWidth = (eleOutWidth - eleInnerWidth - borderLeftNum - borderRightNum) * scaleX;
|
|
var eleScrollHeight = (eleOutHeight - eleInnerHeight - borderTopNum - borderBottomNum) * scaleY;
|
|
|
|
// Cut border size
|
|
var scaledBorderTopWidth = borderTopNum * scaleY;
|
|
var scaledBorderBottomWidth = borderBottomNum * scaleY;
|
|
var scaledBorderLeftWidth = borderLeftNum * scaleX;
|
|
var scaledBorderRightWidth = borderRightNum * scaleX;
|
|
|
|
// Clip margin
|
|
var clipMarginWidth = 0;
|
|
var clipMarginHeight = 0;
|
|
if (overflow === 'clip') {
|
|
var clipNum = getPxValue(overflowClipMargin);
|
|
clipMarginWidth = clipNum * scaleX;
|
|
clipMarginHeight = clipNum * scaleY;
|
|
}
|
|
|
|
// Region
|
|
var eleLeft = eleRect.x + scaledBorderLeftWidth - clipMarginWidth;
|
|
var eleTop = eleRect.y + scaledBorderTopWidth - clipMarginHeight;
|
|
var eleRight = eleLeft + eleRect.width + 2 * clipMarginWidth - scaledBorderLeftWidth - scaledBorderRightWidth - eleScrollWidth;
|
|
var eleBottom = eleTop + eleRect.height + 2 * clipMarginHeight - scaledBorderTopWidth - scaledBorderBottomWidth - eleScrollHeight;
|
|
visibleArea.left = Math.max(visibleArea.left, eleLeft);
|
|
visibleArea.top = Math.max(visibleArea.top, eleTop);
|
|
visibleArea.right = Math.min(visibleArea.right, eleRight);
|
|
visibleArea.bottom = Math.min(visibleArea.bottom, eleBottom);
|
|
});
|
|
return visibleArea;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/hooks/useAlign.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getUnitOffset(size) {
|
|
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
var offsetStr = "".concat(offset);
|
|
var cells = offsetStr.match(/^(.*)\%$/);
|
|
if (cells) {
|
|
return size * (parseFloat(cells[1]) / 100);
|
|
}
|
|
return parseFloat(offsetStr);
|
|
}
|
|
function getNumberOffset(rect, offset) {
|
|
var _ref = offset || [],
|
|
_ref2 = _slicedToArray(_ref, 2),
|
|
offsetX = _ref2[0],
|
|
offsetY = _ref2[1];
|
|
return [getUnitOffset(rect.width, offsetX), getUnitOffset(rect.height, offsetY)];
|
|
}
|
|
function splitPoints() {
|
|
var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
return [points[0], points[1]];
|
|
}
|
|
function getAlignPoint(rect, points) {
|
|
var topBottom = points[0];
|
|
var leftRight = points[1];
|
|
var x;
|
|
var y;
|
|
|
|
// Top & Bottom
|
|
if (topBottom === 't') {
|
|
y = rect.y;
|
|
} else if (topBottom === 'b') {
|
|
y = rect.y + rect.height;
|
|
} else {
|
|
y = rect.y + rect.height / 2;
|
|
}
|
|
|
|
// Left & Right
|
|
if (leftRight === 'l') {
|
|
x = rect.x;
|
|
} else if (leftRight === 'r') {
|
|
x = rect.x + rect.width;
|
|
} else {
|
|
x = rect.x + rect.width / 2;
|
|
}
|
|
return {
|
|
x: x,
|
|
y: y
|
|
};
|
|
}
|
|
function reversePoints(points, index) {
|
|
var reverseMap = {
|
|
t: 'b',
|
|
b: 't',
|
|
l: 'r',
|
|
r: 'l'
|
|
};
|
|
return points.map(function (point, i) {
|
|
if (i === index) {
|
|
return reverseMap[point] || 'c';
|
|
}
|
|
return point;
|
|
}).join('');
|
|
}
|
|
function useAlign(open, popupEle, target, placement, builtinPlacements, popupAlign, onPopupAlign) {
|
|
var _React$useState = react.useState({
|
|
ready: false,
|
|
offsetX: 0,
|
|
offsetY: 0,
|
|
offsetR: 0,
|
|
offsetB: 0,
|
|
arrowX: 0,
|
|
arrowY: 0,
|
|
scaleX: 1,
|
|
scaleY: 1,
|
|
align: builtinPlacements[placement] || {}
|
|
}),
|
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
offsetInfo = _React$useState2[0],
|
|
setOffsetInfo = _React$useState2[1];
|
|
var alignCountRef = react.useRef(0);
|
|
var scrollerList = react.useMemo(function () {
|
|
if (!popupEle) {
|
|
return [];
|
|
}
|
|
return collectScroller(popupEle);
|
|
}, [popupEle]);
|
|
|
|
// ========================= Flip ==========================
|
|
// We will memo flip info.
|
|
// If size change to make flip, it will memo the flip info and use it in next align.
|
|
var prevFlipRef = react.useRef({});
|
|
var resetFlipCache = function resetFlipCache() {
|
|
prevFlipRef.current = {};
|
|
};
|
|
if (!open) {
|
|
resetFlipCache();
|
|
}
|
|
|
|
// ========================= Align =========================
|
|
var onAlign = useEvent_useEvent(function () {
|
|
if (popupEle && target && open) {
|
|
var _popupElement$parentE, _popupElement$parentE2;
|
|
var popupElement = popupEle;
|
|
var doc = popupElement.ownerDocument;
|
|
var win = getWin(popupElement);
|
|
var _win$getComputedStyle = win.getComputedStyle(popupElement),
|
|
width = _win$getComputedStyle.width,
|
|
height = _win$getComputedStyle.height,
|
|
popupPosition = _win$getComputedStyle.position;
|
|
var originLeft = popupElement.style.left;
|
|
var originTop = popupElement.style.top;
|
|
var originRight = popupElement.style.right;
|
|
var originBottom = popupElement.style.bottom;
|
|
|
|
// Placement
|
|
var placementInfo = _objectSpread2(_objectSpread2({}, builtinPlacements[placement]), popupAlign);
|
|
|
|
// placeholder element
|
|
var placeholderElement = doc.createElement('div');
|
|
(_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 || _popupElement$parentE.appendChild(placeholderElement);
|
|
placeholderElement.style.left = "".concat(popupElement.offsetLeft, "px");
|
|
placeholderElement.style.top = "".concat(popupElement.offsetTop, "px");
|
|
placeholderElement.style.position = popupPosition;
|
|
placeholderElement.style.height = "".concat(popupElement.offsetHeight, "px");
|
|
placeholderElement.style.width = "".concat(popupElement.offsetWidth, "px");
|
|
|
|
// Reset first
|
|
popupElement.style.left = '0';
|
|
popupElement.style.top = '0';
|
|
popupElement.style.right = 'auto';
|
|
popupElement.style.bottom = 'auto';
|
|
|
|
// Calculate align style, we should consider `transform` case
|
|
var targetRect;
|
|
if (Array.isArray(target)) {
|
|
targetRect = {
|
|
x: target[0],
|
|
y: target[1],
|
|
width: 0,
|
|
height: 0
|
|
};
|
|
} else {
|
|
var rect = target.getBoundingClientRect();
|
|
targetRect = {
|
|
x: rect.x,
|
|
y: rect.y,
|
|
width: rect.width,
|
|
height: rect.height
|
|
};
|
|
}
|
|
var popupRect = popupElement.getBoundingClientRect();
|
|
var _doc$documentElement = doc.documentElement,
|
|
clientWidth = _doc$documentElement.clientWidth,
|
|
clientHeight = _doc$documentElement.clientHeight,
|
|
scrollWidth = _doc$documentElement.scrollWidth,
|
|
scrollHeight = _doc$documentElement.scrollHeight,
|
|
scrollTop = _doc$documentElement.scrollTop,
|
|
scrollLeft = _doc$documentElement.scrollLeft;
|
|
var popupHeight = popupRect.height;
|
|
var popupWidth = popupRect.width;
|
|
var targetHeight = targetRect.height;
|
|
var targetWidth = targetRect.width;
|
|
|
|
// Get bounding of visible area
|
|
var visibleRegion = {
|
|
left: 0,
|
|
top: 0,
|
|
right: clientWidth,
|
|
bottom: clientHeight
|
|
};
|
|
var scrollRegion = {
|
|
left: -scrollLeft,
|
|
top: -scrollTop,
|
|
right: scrollWidth - scrollLeft,
|
|
bottom: scrollHeight - scrollTop
|
|
};
|
|
var htmlRegion = placementInfo.htmlRegion;
|
|
var VISIBLE = 'visible';
|
|
var VISIBLE_FIRST = 'visibleFirst';
|
|
if (htmlRegion !== 'scroll' && htmlRegion !== VISIBLE_FIRST) {
|
|
htmlRegion = VISIBLE;
|
|
}
|
|
var isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
var scrollRegionArea = getVisibleArea(scrollRegion, scrollerList);
|
|
var visibleRegionArea = getVisibleArea(visibleRegion, scrollerList);
|
|
var visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
|
|
// When set to `visibleFirst`,
|
|
// the check `adjust` logic will use `visibleRegion` for check first.
|
|
var adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
|
|
// Record right & bottom align data
|
|
popupElement.style.left = 'auto';
|
|
popupElement.style.top = 'auto';
|
|
popupElement.style.right = '0';
|
|
popupElement.style.bottom = '0';
|
|
var popupMirrorRect = popupElement.getBoundingClientRect();
|
|
|
|
// Reset back
|
|
popupElement.style.left = originLeft;
|
|
popupElement.style.top = originTop;
|
|
popupElement.style.right = originRight;
|
|
popupElement.style.bottom = originBottom;
|
|
(_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
|
|
|
|
// Calculate scale
|
|
var _scaleX = toNum(Math.round(popupWidth / parseFloat(width) * 1000) / 1000);
|
|
var _scaleY = toNum(Math.round(popupHeight / parseFloat(height) * 1000) / 1000);
|
|
|
|
// No need to align since it's not visible in view
|
|
if (_scaleX === 0 || _scaleY === 0 || isDOM(target) && !Dom_isVisible(target)) {
|
|
return;
|
|
}
|
|
|
|
// Offset
|
|
var offset = placementInfo.offset,
|
|
targetOffset = placementInfo.targetOffset;
|
|
var _getNumberOffset = getNumberOffset(popupRect, offset),
|
|
_getNumberOffset2 = _slicedToArray(_getNumberOffset, 2),
|
|
popupOffsetX = _getNumberOffset2[0],
|
|
popupOffsetY = _getNumberOffset2[1];
|
|
var _getNumberOffset3 = getNumberOffset(targetRect, targetOffset),
|
|
_getNumberOffset4 = _slicedToArray(_getNumberOffset3, 2),
|
|
targetOffsetX = _getNumberOffset4[0],
|
|
targetOffsetY = _getNumberOffset4[1];
|
|
targetRect.x -= targetOffsetX;
|
|
targetRect.y -= targetOffsetY;
|
|
|
|
// Points
|
|
var _ref3 = placementInfo.points || [],
|
|
_ref4 = _slicedToArray(_ref3, 2),
|
|
popupPoint = _ref4[0],
|
|
targetPoint = _ref4[1];
|
|
var targetPoints = splitPoints(targetPoint);
|
|
var popupPoints = splitPoints(popupPoint);
|
|
var targetAlignPoint = getAlignPoint(targetRect, targetPoints);
|
|
var popupAlignPoint = getAlignPoint(popupRect, popupPoints);
|
|
|
|
// Real align info may not same as origin one
|
|
var nextAlignInfo = _objectSpread2({}, placementInfo);
|
|
|
|
// Next Offset
|
|
var nextOffsetX = targetAlignPoint.x - popupAlignPoint.x + popupOffsetX;
|
|
var nextOffsetY = targetAlignPoint.y - popupAlignPoint.y + popupOffsetY;
|
|
|
|
// ============== Intersection ===============
|
|
// Get area by position. Used for check if flip area is better
|
|
function getIntersectionVisibleArea(offsetX, offsetY) {
|
|
var area = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : visibleArea;
|
|
var l = popupRect.x + offsetX;
|
|
var t = popupRect.y + offsetY;
|
|
var r = l + popupWidth;
|
|
var b = t + popupHeight;
|
|
var visibleL = Math.max(l, area.left);
|
|
var visibleT = Math.max(t, area.top);
|
|
var visibleR = Math.min(r, area.right);
|
|
var visibleB = Math.min(b, area.bottom);
|
|
return Math.max(0, (visibleR - visibleL) * (visibleB - visibleT));
|
|
}
|
|
var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
|
|
|
|
// As `visibleFirst`, we prepare this for check
|
|
var originIntersectionRecommendArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY, visibleRegionArea);
|
|
|
|
// ========================== Overflow ===========================
|
|
var targetAlignPointTL = getAlignPoint(targetRect, ['t', 'l']);
|
|
var popupAlignPointTL = getAlignPoint(popupRect, ['t', 'l']);
|
|
var targetAlignPointBR = getAlignPoint(targetRect, ['b', 'r']);
|
|
var popupAlignPointBR = getAlignPoint(popupRect, ['b', 'r']);
|
|
var overflow = placementInfo.overflow || {};
|
|
var adjustX = overflow.adjustX,
|
|
adjustY = overflow.adjustY,
|
|
shiftX = overflow.shiftX,
|
|
shiftY = overflow.shiftY;
|
|
var supportAdjust = function supportAdjust(val) {
|
|
if (typeof val === 'boolean') {
|
|
return val;
|
|
}
|
|
return val >= 0;
|
|
};
|
|
|
|
// Prepare position
|
|
var nextPopupY;
|
|
var nextPopupBottom;
|
|
var nextPopupX;
|
|
var nextPopupRight;
|
|
function syncNextPopupPosition() {
|
|
nextPopupY = popupRect.y + nextOffsetY;
|
|
nextPopupBottom = nextPopupY + popupHeight;
|
|
nextPopupX = popupRect.x + nextOffsetX;
|
|
nextPopupRight = nextPopupX + popupWidth;
|
|
}
|
|
syncNextPopupPosition();
|
|
|
|
// >>>>>>>>>> Top & Bottom
|
|
var needAdjustY = supportAdjust(adjustY);
|
|
var sameTB = popupPoints[0] === targetPoints[0];
|
|
|
|
// Bottom to Top
|
|
if (needAdjustY && popupPoints[0] === 't' && (nextPopupBottom > adjustCheckVisibleArea.bottom || prevFlipRef.current.bt)) {
|
|
var tmpNextOffsetY = nextOffsetY;
|
|
if (sameTB) {
|
|
tmpNextOffsetY -= popupHeight - targetHeight;
|
|
} else {
|
|
tmpNextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY;
|
|
}
|
|
var newVisibleArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY);
|
|
var newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY, visibleRegionArea);
|
|
if (
|
|
// Of course use larger one
|
|
newVisibleArea > originIntersectionVisibleArea || newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst ||
|
|
// Choose recommend one
|
|
newVisibleRecommendArea >= originIntersectionRecommendArea)) {
|
|
prevFlipRef.current.bt = true;
|
|
nextOffsetY = tmpNextOffsetY;
|
|
popupOffsetY = -popupOffsetY;
|
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
} else {
|
|
prevFlipRef.current.bt = false;
|
|
}
|
|
}
|
|
|
|
// Top to Bottom
|
|
if (needAdjustY && popupPoints[0] === 'b' && (nextPopupY < adjustCheckVisibleArea.top || prevFlipRef.current.tb)) {
|
|
var _tmpNextOffsetY = nextOffsetY;
|
|
if (sameTB) {
|
|
_tmpNextOffsetY += popupHeight - targetHeight;
|
|
} else {
|
|
_tmpNextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY;
|
|
}
|
|
var _newVisibleArea = getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY);
|
|
var _newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY, visibleRegionArea);
|
|
if (
|
|
// Of course use larger one
|
|
_newVisibleArea > originIntersectionVisibleArea || _newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst ||
|
|
// Choose recommend one
|
|
_newVisibleRecommendArea >= originIntersectionRecommendArea)) {
|
|
prevFlipRef.current.tb = true;
|
|
nextOffsetY = _tmpNextOffsetY;
|
|
popupOffsetY = -popupOffsetY;
|
|
nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
|
|
} else {
|
|
prevFlipRef.current.tb = false;
|
|
}
|
|
}
|
|
|
|
// >>>>>>>>>> Left & Right
|
|
var needAdjustX = supportAdjust(adjustX);
|
|
|
|
// >>>>> Flip
|
|
var sameLR = popupPoints[1] === targetPoints[1];
|
|
|
|
// Right to Left
|
|
if (needAdjustX && popupPoints[1] === 'l' && (nextPopupRight > adjustCheckVisibleArea.right || prevFlipRef.current.rl)) {
|
|
var tmpNextOffsetX = nextOffsetX;
|
|
if (sameLR) {
|
|
tmpNextOffsetX -= popupWidth - targetWidth;
|
|
} else {
|
|
tmpNextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX;
|
|
}
|
|
var _newVisibleArea2 = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY);
|
|
var _newVisibleRecommendArea2 = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY, visibleRegionArea);
|
|
if (
|
|
// Of course use larger one
|
|
_newVisibleArea2 > originIntersectionVisibleArea || _newVisibleArea2 === originIntersectionVisibleArea && (!isVisibleFirst ||
|
|
// Choose recommend one
|
|
_newVisibleRecommendArea2 >= originIntersectionRecommendArea)) {
|
|
prevFlipRef.current.rl = true;
|
|
nextOffsetX = tmpNextOffsetX;
|
|
popupOffsetX = -popupOffsetX;
|
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
} else {
|
|
prevFlipRef.current.rl = false;
|
|
}
|
|
}
|
|
|
|
// Left to Right
|
|
if (needAdjustX && popupPoints[1] === 'r' && (nextPopupX < adjustCheckVisibleArea.left || prevFlipRef.current.lr)) {
|
|
var _tmpNextOffsetX = nextOffsetX;
|
|
if (sameLR) {
|
|
_tmpNextOffsetX += popupWidth - targetWidth;
|
|
} else {
|
|
_tmpNextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX;
|
|
}
|
|
var _newVisibleArea3 = getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY);
|
|
var _newVisibleRecommendArea3 = getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY, visibleRegionArea);
|
|
if (
|
|
// Of course use larger one
|
|
_newVisibleArea3 > originIntersectionVisibleArea || _newVisibleArea3 === originIntersectionVisibleArea && (!isVisibleFirst ||
|
|
// Choose recommend one
|
|
_newVisibleRecommendArea3 >= originIntersectionRecommendArea)) {
|
|
prevFlipRef.current.lr = true;
|
|
nextOffsetX = _tmpNextOffsetX;
|
|
popupOffsetX = -popupOffsetX;
|
|
nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
|
|
} else {
|
|
prevFlipRef.current.lr = false;
|
|
}
|
|
}
|
|
|
|
// ============================ Shift ============================
|
|
syncNextPopupPosition();
|
|
var numShiftX = shiftX === true ? 0 : shiftX;
|
|
if (typeof numShiftX === 'number') {
|
|
// Left
|
|
if (nextPopupX < visibleRegionArea.left) {
|
|
nextOffsetX -= nextPopupX - visibleRegionArea.left - popupOffsetX;
|
|
if (targetRect.x + targetWidth < visibleRegionArea.left + numShiftX) {
|
|
nextOffsetX += targetRect.x - visibleRegionArea.left + targetWidth - numShiftX;
|
|
}
|
|
}
|
|
|
|
// Right
|
|
if (nextPopupRight > visibleRegionArea.right) {
|
|
nextOffsetX -= nextPopupRight - visibleRegionArea.right - popupOffsetX;
|
|
if (targetRect.x > visibleRegionArea.right - numShiftX) {
|
|
nextOffsetX += targetRect.x - visibleRegionArea.right + numShiftX;
|
|
}
|
|
}
|
|
}
|
|
var numShiftY = shiftY === true ? 0 : shiftY;
|
|
if (typeof numShiftY === 'number') {
|
|
// Top
|
|
if (nextPopupY < visibleRegionArea.top) {
|
|
nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
|
|
|
|
// When target if far away from visible area
|
|
// Stop shift
|
|
if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
|
|
nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
|
|
}
|
|
}
|
|
|
|
// Bottom
|
|
if (nextPopupBottom > visibleRegionArea.bottom) {
|
|
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
|
|
if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
|
|
nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
|
|
}
|
|
}
|
|
}
|
|
|
|
// ============================ Arrow ============================
|
|
// Arrow center align
|
|
var popupLeft = popupRect.x + nextOffsetX;
|
|
var popupRight = popupLeft + popupWidth;
|
|
var popupTop = popupRect.y + nextOffsetY;
|
|
var popupBottom = popupTop + popupHeight;
|
|
var targetLeft = targetRect.x;
|
|
var targetRight = targetLeft + targetWidth;
|
|
var targetTop = targetRect.y;
|
|
var targetBottom = targetTop + targetHeight;
|
|
var maxLeft = Math.max(popupLeft, targetLeft);
|
|
var minRight = Math.min(popupRight, targetRight);
|
|
var xCenter = (maxLeft + minRight) / 2;
|
|
var nextArrowX = xCenter - popupLeft;
|
|
var maxTop = Math.max(popupTop, targetTop);
|
|
var minBottom = Math.min(popupBottom, targetBottom);
|
|
var yCenter = (maxTop + minBottom) / 2;
|
|
var nextArrowY = yCenter - popupTop;
|
|
onPopupAlign === null || onPopupAlign === void 0 || onPopupAlign(popupEle, nextAlignInfo);
|
|
|
|
// Additional calculate right & bottom position
|
|
var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
|
|
var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
|
|
setOffsetInfo({
|
|
ready: true,
|
|
offsetX: nextOffsetX / _scaleX,
|
|
offsetY: nextOffsetY / _scaleY,
|
|
offsetR: offsetX4Right / _scaleX,
|
|
offsetB: offsetY4Bottom / _scaleY,
|
|
arrowX: nextArrowX / _scaleX,
|
|
arrowY: nextArrowY / _scaleY,
|
|
scaleX: _scaleX,
|
|
scaleY: _scaleY,
|
|
align: nextAlignInfo
|
|
});
|
|
}
|
|
});
|
|
var triggerAlign = function triggerAlign() {
|
|
alignCountRef.current += 1;
|
|
var id = alignCountRef.current;
|
|
|
|
// Merge all align requirement into one frame
|
|
Promise.resolve().then(function () {
|
|
if (alignCountRef.current === id) {
|
|
onAlign();
|
|
}
|
|
});
|
|
};
|
|
|
|
// Reset ready status when placement & open changed
|
|
var resetReady = function resetReady() {
|
|
setOffsetInfo(function (ori) {
|
|
return _objectSpread2(_objectSpread2({}, ori), {}, {
|
|
ready: false
|
|
});
|
|
});
|
|
};
|
|
hooks_useLayoutEffect(resetReady, [placement]);
|
|
hooks_useLayoutEffect(function () {
|
|
if (!open) {
|
|
resetReady();
|
|
}
|
|
}, [open]);
|
|
return [offsetInfo.ready, offsetInfo.offsetX, offsetInfo.offsetY, offsetInfo.offsetR, offsetInfo.offsetB, offsetInfo.arrowX, offsetInfo.arrowY, offsetInfo.scaleX, offsetInfo.scaleY, offsetInfo.align, triggerAlign];
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
|
|
function _arrayWithoutHoles(arr) {
|
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
|
function _iterableToArray(iter) {
|
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
|
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.");
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
|
|
|
|
|
|
|
|
|
function _toConsumableArray(arr) {
|
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/hooks/useWatch.js
|
|
|
|
|
|
|
|
function useWatch(open, target, popup, onAlign, onScroll) {
|
|
hooks_useLayoutEffect(function () {
|
|
if (open && target && popup) {
|
|
var targetElement = target;
|
|
var popupElement = popup;
|
|
var targetScrollList = collectScroller(targetElement);
|
|
var popupScrollList = collectScroller(popupElement);
|
|
var win = getWin(popupElement);
|
|
var mergedList = new Set([win].concat(_toConsumableArray(targetScrollList), _toConsumableArray(popupScrollList)));
|
|
function notifyScroll() {
|
|
onAlign();
|
|
onScroll();
|
|
}
|
|
mergedList.forEach(function (scroller) {
|
|
scroller.addEventListener('scroll', notifyScroll, {
|
|
passive: true
|
|
});
|
|
});
|
|
win.addEventListener('resize', notifyScroll, {
|
|
passive: true
|
|
});
|
|
|
|
// First time always do align
|
|
onAlign();
|
|
return function () {
|
|
mergedList.forEach(function (scroller) {
|
|
scroller.removeEventListener('scroll', notifyScroll);
|
|
win.removeEventListener('resize', notifyScroll);
|
|
});
|
|
};
|
|
}
|
|
}, [open, target, popup]);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/warning.js
|
|
/* eslint-disable no-console */
|
|
var warned = {};
|
|
var preWarningFns = [];
|
|
|
|
/**
|
|
* Pre warning enable you to parse content before console.error.
|
|
* Modify to null will prevent warning.
|
|
*/
|
|
var preMessage = function preMessage(fn) {
|
|
preWarningFns.push(fn);
|
|
};
|
|
function warning_warning(valid, message) {
|
|
// Support uglify
|
|
if (false) { var finalMessage; }
|
|
}
|
|
function note(valid, message) {
|
|
// Support uglify
|
|
if (false) { var finalMessage; }
|
|
}
|
|
function resetWarned() {
|
|
warned = {};
|
|
}
|
|
function call(method, valid, message) {
|
|
if (!valid && !warned[message]) {
|
|
method(false, message);
|
|
warned[message] = true;
|
|
}
|
|
}
|
|
function warningOnce(valid, message) {
|
|
call(warning_warning, valid, message);
|
|
}
|
|
function noteOnce(valid, message) {
|
|
call(note, valid, message);
|
|
}
|
|
warningOnce.preMessage = preMessage;
|
|
warningOnce.resetWarned = resetWarned;
|
|
warningOnce.noteOnce = noteOnce;
|
|
/* harmony default export */ var es_warning = ((/* unused pure expression or super */ null && (warningOnce)));
|
|
/* eslint-enable */
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/node_modules/rc-util/es/raf.js
|
|
var raf_raf = function raf(callback) {
|
|
return +setTimeout(callback, 16);
|
|
};
|
|
var caf = function caf(num) {
|
|
return clearTimeout(num);
|
|
};
|
|
if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
|
|
raf_raf = function raf(callback) {
|
|
return window.requestAnimationFrame(callback);
|
|
};
|
|
caf = function caf(handle) {
|
|
return window.cancelAnimationFrame(handle);
|
|
};
|
|
}
|
|
var rafUUID = 0;
|
|
var rafIds = new Map();
|
|
function cleanup(id) {
|
|
rafIds.delete(id);
|
|
}
|
|
var wrapperRaf = function wrapperRaf(callback) {
|
|
var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
rafUUID += 1;
|
|
var id = rafUUID;
|
|
function callRef(leftTimes) {
|
|
if (leftTimes === 0) {
|
|
// Clean up
|
|
cleanup(id);
|
|
|
|
// Trigger
|
|
callback();
|
|
} else {
|
|
// Next raf
|
|
var realId = raf_raf(function () {
|
|
callRef(leftTimes - 1);
|
|
});
|
|
|
|
// Bind real raf id
|
|
rafIds.set(id, realId);
|
|
}
|
|
}
|
|
callRef(times);
|
|
return id;
|
|
};
|
|
wrapperRaf.cancel = function (id) {
|
|
var realId = rafIds.get(id);
|
|
cleanup(realId);
|
|
return caf(realId);
|
|
};
|
|
/* harmony default export */ var es_raf = (wrapperRaf);
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/hooks/useWinClick.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
|
|
var openRef = react.useRef(open);
|
|
|
|
// Window click to hide should be lock to avoid trigger lock immediately
|
|
var lockRef = react.useRef(false);
|
|
if (openRef.current !== open) {
|
|
lockRef.current = true;
|
|
openRef.current = open;
|
|
}
|
|
react.useEffect(function () {
|
|
var id = es_raf(function () {
|
|
lockRef.current = false;
|
|
});
|
|
return function () {
|
|
es_raf.cancel(id);
|
|
};
|
|
}, [open]);
|
|
|
|
// Click to hide is special action since click popup element should not hide
|
|
react.useEffect(function () {
|
|
if (clickToHide && popupEle && (!mask || maskClosable)) {
|
|
var genClickEvents = function genClickEvents() {
|
|
var clickInside = false;
|
|
|
|
// User may mouseDown inside and drag out of popup and mouse up
|
|
// Record here to prevent close
|
|
var onWindowMouseDown = function onWindowMouseDown(_ref) {
|
|
var target = _ref.target;
|
|
clickInside = inPopupOrChild(target);
|
|
};
|
|
var onWindowClick = function onWindowClick(_ref2) {
|
|
var target = _ref2.target;
|
|
if (!lockRef.current && openRef.current && !clickInside && !inPopupOrChild(target)) {
|
|
triggerOpen(false);
|
|
}
|
|
};
|
|
return [onWindowMouseDown, onWindowClick];
|
|
};
|
|
|
|
// Events
|
|
var _genClickEvents = genClickEvents(),
|
|
_genClickEvents2 = _slicedToArray(_genClickEvents, 2),
|
|
onWinMouseDown = _genClickEvents2[0],
|
|
onWinClick = _genClickEvents2[1];
|
|
var _genClickEvents3 = genClickEvents(),
|
|
_genClickEvents4 = _slicedToArray(_genClickEvents3, 2),
|
|
onShadowMouseDown = _genClickEvents4[0],
|
|
onShadowClick = _genClickEvents4[1];
|
|
var win = getWin(popupEle);
|
|
win.addEventListener('mousedown', onWinMouseDown, true);
|
|
win.addEventListener('click', onWinClick, true);
|
|
win.addEventListener('contextmenu', onWinClick, true);
|
|
|
|
// shadow root
|
|
var targetShadowRoot = getShadowRoot(targetEle);
|
|
if (targetShadowRoot) {
|
|
targetShadowRoot.addEventListener('mousedown', onShadowMouseDown, true);
|
|
targetShadowRoot.addEventListener('click', onShadowClick, true);
|
|
targetShadowRoot.addEventListener('contextmenu', onShadowClick, true);
|
|
}
|
|
|
|
// Warning if target and popup not in same root
|
|
if (false) { var popupRoot, targetRoot, _targetEle$getRootNod, _popupEle$getRootNode; }
|
|
return function () {
|
|
win.removeEventListener('mousedown', onWinMouseDown, true);
|
|
win.removeEventListener('click', onWinClick, true);
|
|
win.removeEventListener('contextmenu', onWinClick, true);
|
|
if (targetShadowRoot) {
|
|
targetShadowRoot.removeEventListener('mousedown', onShadowMouseDown, true);
|
|
targetShadowRoot.removeEventListener('click', onShadowClick, true);
|
|
targetShadowRoot.removeEventListener('contextmenu', onShadowClick, true);
|
|
}
|
|
};
|
|
}
|
|
}, [clickToHide, targetEle, popupEle, mask, maskClosable]);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/node_modules/@rc-component/trigger/es/index.js
|
|
|
|
|
|
|
|
var es_excluded = ["prefixCls", "children", "action", "showAction", "hideAction", "popupVisible", "defaultPopupVisible", "onPopupVisibleChange", "afterPopupVisibleChange", "mouseEnterDelay", "mouseLeaveDelay", "focusDelay", "blurDelay", "mask", "maskClosable", "getPopupContainer", "forceRender", "autoDestroy", "destroyPopupOnHide", "popup", "popupClassName", "popupStyle", "popupPlacement", "builtinPlacements", "popupAlign", "zIndex", "stretch", "getPopupClassNameFromAlign", "fresh", "alignPoint", "onPopupClick", "onPopupAlign", "arrow", "popupMotion", "maskMotion", "popupTransitionName", "popupAnimation", "maskTransitionName", "maskAnimation", "className", "getTriggerDOMNode"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Removed Props List
|
|
// Seems this can be auto
|
|
// getDocument?: (element?: HTMLElement) => Document;
|
|
// New version will not wrap popup with `rc-trigger-popup-content` when multiple children
|
|
function generateTrigger() {
|
|
var PortalComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : portal_es;
|
|
var Trigger = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
var _props$prefixCls = props.prefixCls,
|
|
prefixCls = _props$prefixCls === void 0 ? 'rc-trigger-popup' : _props$prefixCls,
|
|
children = props.children,
|
|
_props$action = props.action,
|
|
action = _props$action === void 0 ? 'hover' : _props$action,
|
|
showAction = props.showAction,
|
|
hideAction = props.hideAction,
|
|
popupVisible = props.popupVisible,
|
|
defaultPopupVisible = props.defaultPopupVisible,
|
|
onPopupVisibleChange = props.onPopupVisibleChange,
|
|
afterPopupVisibleChange = props.afterPopupVisibleChange,
|
|
mouseEnterDelay = props.mouseEnterDelay,
|
|
_props$mouseLeaveDela = props.mouseLeaveDelay,
|
|
mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela,
|
|
focusDelay = props.focusDelay,
|
|
blurDelay = props.blurDelay,
|
|
mask = props.mask,
|
|
_props$maskClosable = props.maskClosable,
|
|
maskClosable = _props$maskClosable === void 0 ? true : _props$maskClosable,
|
|
getPopupContainer = props.getPopupContainer,
|
|
forceRender = props.forceRender,
|
|
autoDestroy = props.autoDestroy,
|
|
destroyPopupOnHide = props.destroyPopupOnHide,
|
|
popup = props.popup,
|
|
popupClassName = props.popupClassName,
|
|
popupStyle = props.popupStyle,
|
|
popupPlacement = props.popupPlacement,
|
|
_props$builtinPlaceme = props.builtinPlacements,
|
|
builtinPlacements = _props$builtinPlaceme === void 0 ? {} : _props$builtinPlaceme,
|
|
popupAlign = props.popupAlign,
|
|
zIndex = props.zIndex,
|
|
stretch = props.stretch,
|
|
getPopupClassNameFromAlign = props.getPopupClassNameFromAlign,
|
|
fresh = props.fresh,
|
|
alignPoint = props.alignPoint,
|
|
onPopupClick = props.onPopupClick,
|
|
onPopupAlign = props.onPopupAlign,
|
|
arrow = props.arrow,
|
|
popupMotion = props.popupMotion,
|
|
maskMotion = props.maskMotion,
|
|
popupTransitionName = props.popupTransitionName,
|
|
popupAnimation = props.popupAnimation,
|
|
maskTransitionName = props.maskTransitionName,
|
|
maskAnimation = props.maskAnimation,
|
|
className = props.className,
|
|
getTriggerDOMNode = props.getTriggerDOMNode,
|
|
restProps = _objectWithoutProperties(props, es_excluded);
|
|
var mergedAutoDestroy = autoDestroy || destroyPopupOnHide || false;
|
|
|
|
// =========================== Mobile ===========================
|
|
var _React$useState = react.useState(false),
|
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
mobile = _React$useState2[0],
|
|
setMobile = _React$useState2[1];
|
|
hooks_useLayoutEffect(function () {
|
|
setMobile(isMobile());
|
|
}, []);
|
|
|
|
// ========================== Context ===========================
|
|
var subPopupElements = react.useRef({});
|
|
var parentContext = react.useContext(es_context);
|
|
var context = react.useMemo(function () {
|
|
return {
|
|
registerSubPopup: function registerSubPopup(id, subPopupEle) {
|
|
subPopupElements.current[id] = subPopupEle;
|
|
parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, subPopupEle);
|
|
}
|
|
};
|
|
}, [parentContext]);
|
|
|
|
// =========================== Popup ============================
|
|
var id = useId();
|
|
var _React$useState3 = react.useState(null),
|
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
popupEle = _React$useState4[0],
|
|
setPopupEle = _React$useState4[1];
|
|
var setPopupRef = useEvent_useEvent(function (node) {
|
|
if (isDOM(node) && popupEle !== node) {
|
|
setPopupEle(node);
|
|
}
|
|
parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id, node);
|
|
});
|
|
|
|
// =========================== Target ===========================
|
|
// Use state to control here since `useRef` update not trigger render
|
|
var _React$useState5 = react.useState(null),
|
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
targetEle = _React$useState6[0],
|
|
setTargetEle = _React$useState6[1];
|
|
|
|
// Used for forwardRef target. Not use internal
|
|
var externalForwardRef = react.useRef(null);
|
|
var setTargetRef = useEvent_useEvent(function (node) {
|
|
if (isDOM(node) && targetEle !== node) {
|
|
setTargetEle(node);
|
|
externalForwardRef.current = node;
|
|
}
|
|
});
|
|
|
|
// ========================== Children ==========================
|
|
var child = react.Children.only(children);
|
|
var originChildProps = (child === null || child === void 0 ? void 0 : child.props) || {};
|
|
var cloneProps = {};
|
|
var inPopupOrChild = useEvent_useEvent(function (ele) {
|
|
var _getShadowRoot, _getShadowRoot2;
|
|
var childDOM = targetEle;
|
|
return (childDOM === null || childDOM === void 0 ? void 0 : childDOM.contains(ele)) || ((_getShadowRoot = getShadowRoot(childDOM)) === null || _getShadowRoot === void 0 ? void 0 : _getShadowRoot.host) === ele || ele === childDOM || (popupEle === null || popupEle === void 0 ? void 0 : popupEle.contains(ele)) || ((_getShadowRoot2 = getShadowRoot(popupEle)) === null || _getShadowRoot2 === void 0 ? void 0 : _getShadowRoot2.host) === ele || ele === popupEle || Object.values(subPopupElements.current).some(function (subPopupEle) {
|
|
return (subPopupEle === null || subPopupEle === void 0 ? void 0 : subPopupEle.contains(ele)) || ele === subPopupEle;
|
|
});
|
|
});
|
|
|
|
// =========================== Motion ===========================
|
|
var mergePopupMotion = getMotion(prefixCls, popupMotion, popupAnimation, popupTransitionName);
|
|
var mergeMaskMotion = getMotion(prefixCls, maskMotion, maskAnimation, maskTransitionName);
|
|
|
|
// ============================ Open ============================
|
|
var _React$useState7 = react.useState(defaultPopupVisible || false),
|
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
internalOpen = _React$useState8[0],
|
|
setInternalOpen = _React$useState8[1];
|
|
|
|
// Render still use props as first priority
|
|
var mergedOpen = popupVisible !== null && popupVisible !== void 0 ? popupVisible : internalOpen;
|
|
|
|
// We use effect sync here in case `popupVisible` back to `undefined`
|
|
var setMergedOpen = useEvent_useEvent(function (nextOpen) {
|
|
if (popupVisible === undefined) {
|
|
setInternalOpen(nextOpen);
|
|
}
|
|
});
|
|
hooks_useLayoutEffect(function () {
|
|
setInternalOpen(popupVisible || false);
|
|
}, [popupVisible]);
|
|
var openRef = react.useRef(mergedOpen);
|
|
openRef.current = mergedOpen;
|
|
var internalTriggerOpen = useEvent_useEvent(function (nextOpen) {
|
|
// Enter or Pointer will both trigger open state change
|
|
// We only need take one to avoid duplicated change event trigger
|
|
(0,react_dom.flushSync)(function () {
|
|
if (mergedOpen !== nextOpen) {
|
|
setMergedOpen(nextOpen);
|
|
onPopupVisibleChange === null || onPopupVisibleChange === void 0 || onPopupVisibleChange(nextOpen);
|
|
}
|
|
});
|
|
});
|
|
|
|
// Trigger for delay
|
|
var delayRef = react.useRef();
|
|
var clearDelay = function clearDelay() {
|
|
clearTimeout(delayRef.current);
|
|
};
|
|
var triggerOpen = function triggerOpen(nextOpen) {
|
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
clearDelay();
|
|
if (delay === 0) {
|
|
internalTriggerOpen(nextOpen);
|
|
} else {
|
|
delayRef.current = setTimeout(function () {
|
|
internalTriggerOpen(nextOpen);
|
|
}, delay * 1000);
|
|
}
|
|
};
|
|
react.useEffect(function () {
|
|
return clearDelay;
|
|
}, []);
|
|
|
|
// ========================== Motion ============================
|
|
var _React$useState9 = react.useState(false),
|
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
inMotion = _React$useState10[0],
|
|
setInMotion = _React$useState10[1];
|
|
hooks_useLayoutEffect(function (firstMount) {
|
|
if (!firstMount || mergedOpen) {
|
|
setInMotion(true);
|
|
}
|
|
}, [mergedOpen]);
|
|
var _React$useState11 = react.useState(null),
|
|
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
motionPrepareResolve = _React$useState12[0],
|
|
setMotionPrepareResolve = _React$useState12[1];
|
|
|
|
// =========================== Align ============================
|
|
var _React$useState13 = react.useState([0, 0]),
|
|
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
mousePos = _React$useState14[0],
|
|
setMousePos = _React$useState14[1];
|
|
var setMousePosByEvent = function setMousePosByEvent(event) {
|
|
setMousePos([event.clientX, event.clientY]);
|
|
};
|
|
var _useAlign = useAlign(mergedOpen, popupEle, alignPoint ? mousePos : targetEle, popupPlacement, builtinPlacements, popupAlign, onPopupAlign),
|
|
_useAlign2 = _slicedToArray(_useAlign, 11),
|
|
ready = _useAlign2[0],
|
|
offsetX = _useAlign2[1],
|
|
offsetY = _useAlign2[2],
|
|
offsetR = _useAlign2[3],
|
|
offsetB = _useAlign2[4],
|
|
arrowX = _useAlign2[5],
|
|
arrowY = _useAlign2[6],
|
|
scaleX = _useAlign2[7],
|
|
scaleY = _useAlign2[8],
|
|
alignInfo = _useAlign2[9],
|
|
onAlign = _useAlign2[10];
|
|
var _useAction = useAction(mobile, action, showAction, hideAction),
|
|
_useAction2 = _slicedToArray(_useAction, 2),
|
|
showActions = _useAction2[0],
|
|
hideActions = _useAction2[1];
|
|
var clickToShow = showActions.has('click');
|
|
var clickToHide = hideActions.has('click') || hideActions.has('contextMenu');
|
|
var triggerAlign = useEvent_useEvent(function () {
|
|
if (!inMotion) {
|
|
onAlign();
|
|
}
|
|
});
|
|
var onScroll = function onScroll() {
|
|
if (openRef.current && alignPoint && clickToHide) {
|
|
triggerOpen(false);
|
|
}
|
|
};
|
|
useWatch(mergedOpen, targetEle, popupEle, triggerAlign, onScroll);
|
|
hooks_useLayoutEffect(function () {
|
|
triggerAlign();
|
|
}, [mousePos, popupPlacement]);
|
|
|
|
// When no builtinPlacements and popupAlign changed
|
|
hooks_useLayoutEffect(function () {
|
|
if (mergedOpen && !(builtinPlacements !== null && builtinPlacements !== void 0 && builtinPlacements[popupPlacement])) {
|
|
triggerAlign();
|
|
}
|
|
}, [JSON.stringify(popupAlign)]);
|
|
var alignedClassName = react.useMemo(function () {
|
|
var baseClassName = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
|
|
return classnames_default()(baseClassName, getPopupClassNameFromAlign === null || getPopupClassNameFromAlign === void 0 ? void 0 : getPopupClassNameFromAlign(alignInfo));
|
|
}, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
|
|
|
|
// ============================ Refs ============================
|
|
react.useImperativeHandle(ref, function () {
|
|
return {
|
|
nativeElement: externalForwardRef.current,
|
|
forceAlign: triggerAlign
|
|
};
|
|
});
|
|
|
|
// ========================== Stretch ===========================
|
|
var _React$useState15 = react.useState(0),
|
|
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
targetWidth = _React$useState16[0],
|
|
setTargetWidth = _React$useState16[1];
|
|
var _React$useState17 = react.useState(0),
|
|
_React$useState18 = _slicedToArray(_React$useState17, 2),
|
|
targetHeight = _React$useState18[0],
|
|
setTargetHeight = _React$useState18[1];
|
|
var syncTargetSize = function syncTargetSize() {
|
|
if (stretch && targetEle) {
|
|
var rect = targetEle.getBoundingClientRect();
|
|
setTargetWidth(rect.width);
|
|
setTargetHeight(rect.height);
|
|
}
|
|
};
|
|
var onTargetResize = function onTargetResize() {
|
|
syncTargetSize();
|
|
triggerAlign();
|
|
};
|
|
|
|
// ========================== Motion ============================
|
|
var onVisibleChanged = function onVisibleChanged(visible) {
|
|
setInMotion(false);
|
|
onAlign();
|
|
afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 || afterPopupVisibleChange(visible);
|
|
};
|
|
|
|
// We will trigger align when motion is in prepare
|
|
var onPrepare = function onPrepare() {
|
|
return new Promise(function (resolve) {
|
|
syncTargetSize();
|
|
setMotionPrepareResolve(function () {
|
|
return resolve;
|
|
});
|
|
});
|
|
};
|
|
hooks_useLayoutEffect(function () {
|
|
if (motionPrepareResolve) {
|
|
onAlign();
|
|
motionPrepareResolve();
|
|
setMotionPrepareResolve(null);
|
|
}
|
|
}, [motionPrepareResolve]);
|
|
|
|
// =========================== Action ===========================
|
|
/**
|
|
* Util wrapper for trigger action
|
|
*/
|
|
function wrapperAction(eventName, nextOpen, delay, preEvent) {
|
|
cloneProps[eventName] = function (event) {
|
|
var _originChildProps$eve;
|
|
preEvent === null || preEvent === void 0 || preEvent(event);
|
|
triggerOpen(nextOpen, delay);
|
|
|
|
// Pass to origin
|
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
args[_key - 1] = arguments[_key];
|
|
}
|
|
(_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 || _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
|
|
};
|
|
}
|
|
|
|
// ======================= Action: Click ========================
|
|
if (clickToShow || clickToHide) {
|
|
cloneProps.onClick = function (event) {
|
|
var _originChildProps$onC;
|
|
if (openRef.current && clickToHide) {
|
|
triggerOpen(false);
|
|
} else if (!openRef.current && clickToShow) {
|
|
setMousePosByEvent(event);
|
|
triggerOpen(true);
|
|
}
|
|
|
|
// Pass to origin
|
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
args[_key2 - 1] = arguments[_key2];
|
|
}
|
|
(_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 || _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
|
|
};
|
|
}
|
|
|
|
// Click to hide is special action since click popup element should not hide
|
|
useWinClick(mergedOpen, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen);
|
|
|
|
// ======================= Action: Hover ========================
|
|
var hoverToShow = showActions.has('hover');
|
|
var hoverToHide = hideActions.has('hover');
|
|
var onPopupMouseEnter;
|
|
var onPopupMouseLeave;
|
|
if (hoverToShow) {
|
|
// Compatible with old browser which not support pointer event
|
|
wrapperAction('onMouseEnter', true, mouseEnterDelay, function (event) {
|
|
setMousePosByEvent(event);
|
|
});
|
|
wrapperAction('onPointerEnter', true, mouseEnterDelay, function (event) {
|
|
setMousePosByEvent(event);
|
|
});
|
|
onPopupMouseEnter = function onPopupMouseEnter() {
|
|
// Only trigger re-open when popup is visible
|
|
if (mergedOpen || inMotion) {
|
|
triggerOpen(true, mouseEnterDelay);
|
|
}
|
|
};
|
|
|
|
// Align Point
|
|
if (alignPoint) {
|
|
cloneProps.onMouseMove = function (event) {
|
|
var _originChildProps$onM;
|
|
// setMousePosByEvent(event);
|
|
(_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 || _originChildProps$onM.call(originChildProps, event);
|
|
};
|
|
}
|
|
}
|
|
if (hoverToHide) {
|
|
wrapperAction('onMouseLeave', false, mouseLeaveDelay);
|
|
wrapperAction('onPointerLeave', false, mouseLeaveDelay);
|
|
onPopupMouseLeave = function onPopupMouseLeave() {
|
|
triggerOpen(false, mouseLeaveDelay);
|
|
};
|
|
}
|
|
|
|
// ======================= Action: Focus ========================
|
|
if (showActions.has('focus')) {
|
|
wrapperAction('onFocus', true, focusDelay);
|
|
}
|
|
if (hideActions.has('focus')) {
|
|
wrapperAction('onBlur', false, blurDelay);
|
|
}
|
|
|
|
// ==================== Action: ContextMenu =====================
|
|
if (showActions.has('contextMenu')) {
|
|
cloneProps.onContextMenu = function (event) {
|
|
var _originChildProps$onC2;
|
|
if (openRef.current && hideActions.has('contextMenu')) {
|
|
triggerOpen(false);
|
|
} else {
|
|
setMousePosByEvent(event);
|
|
triggerOpen(true);
|
|
}
|
|
event.preventDefault();
|
|
|
|
// Pass to origin
|
|
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
args[_key3 - 1] = arguments[_key3];
|
|
}
|
|
(_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 || _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
|
|
};
|
|
}
|
|
|
|
// ========================= ClassName ==========================
|
|
if (className) {
|
|
cloneProps.className = classnames_default()(originChildProps.className, className);
|
|
}
|
|
|
|
// =========================== Render ===========================
|
|
var mergedChildrenProps = _objectSpread2(_objectSpread2({}, originChildProps), cloneProps);
|
|
|
|
// Pass props into cloneProps for nest usage
|
|
var passedProps = {};
|
|
var passedEventList = ['onContextMenu', 'onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur'];
|
|
passedEventList.forEach(function (eventName) {
|
|
if (restProps[eventName]) {
|
|
passedProps[eventName] = function () {
|
|
var _mergedChildrenProps$;
|
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
args[_key4] = arguments[_key4];
|
|
}
|
|
(_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 || _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
|
|
restProps[eventName].apply(restProps, args);
|
|
};
|
|
}
|
|
});
|
|
|
|
// Child Node
|
|
var triggerNode = /*#__PURE__*/react.cloneElement(child, _objectSpread2(_objectSpread2({}, mergedChildrenProps), passedProps));
|
|
var arrowPos = {
|
|
x: arrowX,
|
|
y: arrowY
|
|
};
|
|
var innerArrow = arrow ? _objectSpread2({}, arrow !== true ? arrow : {}) : null;
|
|
|
|
// Render
|
|
return /*#__PURE__*/react.createElement(react.Fragment, null, /*#__PURE__*/react.createElement(es/* default */.Z, {
|
|
disabled: !mergedOpen,
|
|
ref: setTargetRef,
|
|
onResize: onTargetResize
|
|
}, /*#__PURE__*/react.createElement(es_TriggerWrapper, {
|
|
getTriggerDOMNode: getTriggerDOMNode
|
|
}, triggerNode)), /*#__PURE__*/react.createElement(es_context.Provider, {
|
|
value: context
|
|
}, /*#__PURE__*/react.createElement(es_Popup, {
|
|
portal: PortalComponent,
|
|
ref: setPopupRef,
|
|
prefixCls: prefixCls,
|
|
popup: popup,
|
|
className: classnames_default()(popupClassName, alignedClassName),
|
|
style: popupStyle,
|
|
target: targetEle,
|
|
onMouseEnter: onPopupMouseEnter,
|
|
onMouseLeave: onPopupMouseLeave
|
|
// https://github.com/ant-design/ant-design/issues/43924
|
|
,
|
|
onPointerEnter: onPopupMouseEnter,
|
|
zIndex: zIndex
|
|
// Open
|
|
,
|
|
open: mergedOpen,
|
|
keepDom: inMotion,
|
|
fresh: fresh
|
|
// Click
|
|
,
|
|
onClick: onPopupClick
|
|
// Mask
|
|
,
|
|
mask: mask
|
|
// Motion
|
|
,
|
|
motion: mergePopupMotion,
|
|
maskMotion: mergeMaskMotion,
|
|
onVisibleChanged: onVisibleChanged,
|
|
onPrepare: onPrepare
|
|
// Portal
|
|
,
|
|
forceRender: forceRender,
|
|
autoDestroy: mergedAutoDestroy,
|
|
getPopupContainer: getPopupContainer
|
|
// Arrow
|
|
,
|
|
align: alignInfo,
|
|
arrow: innerArrow,
|
|
arrowPos: arrowPos
|
|
// Align
|
|
,
|
|
ready: ready,
|
|
offsetX: offsetX,
|
|
offsetY: offsetY,
|
|
offsetR: offsetR,
|
|
offsetB: offsetB,
|
|
onAlign: triggerAlign
|
|
// Stretch
|
|
,
|
|
stretch: stretch,
|
|
targetWidth: targetWidth / scaleX,
|
|
targetHeight: targetHeight / scaleY
|
|
})));
|
|
});
|
|
if (false) {}
|
|
return Trigger;
|
|
}
|
|
/* harmony default export */ var trigger_es = (generateTrigger(portal_es));
|
|
;// CONCATENATED MODULE: ./node_modules/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/es/utils/motionUtil.js
|
|
function motionUtil_getMotion(mode, motion, defaultMotions) {
|
|
if (motion) {
|
|
return motion;
|
|
}
|
|
if (defaultMotions) {
|
|
return defaultMotions[mode] || defaultMotions.other;
|
|
}
|
|
return undefined;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/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.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.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 = motionUtil_getMotion(mode, motion, defaultMotions);
|
|
var targetMotionRef = 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.useRef();
|
|
react.useEffect(function () {
|
|
visibleRef.current = (0,raf/* default */.Z)(function () {
|
|
setInnerVisible(visible);
|
|
});
|
|
return function () {
|
|
raf/* default.cancel */.Z.cancel(visibleRef.current);
|
|
};
|
|
}, [visible]);
|
|
return /*#__PURE__*/react.createElement(trigger_es, {
|
|
prefixCls: prefixCls,
|
|
popupClassName: 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);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/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.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.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.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.useEffect(function () {
|
|
if (sameModeRef.current) {
|
|
setDestroy(false);
|
|
}
|
|
}, [mode]);
|
|
|
|
// ================================= Render =================================
|
|
var mergedMotion = (0,objectSpread2/* default */.Z)({}, motionUtil_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.createElement(InheritableContextProvider, {
|
|
mode: fixedMode,
|
|
locked: !sameModeRef.current
|
|
}, /*#__PURE__*/react.createElement(rc_motion_es/* default */.Z, (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.createElement(SubMenu_SubMenuList, {
|
|
id: id,
|
|
className: motionClassName,
|
|
style: motionStyle
|
|
}, children);
|
|
}));
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/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.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.useContext(context_PrivateContext),
|
|
_internalRenderSubMenuItem = _React$useContext2._internalRenderSubMenuItem;
|
|
var _React$useContext3 = react.useContext(PathUserContext),
|
|
isSubPathKey = _React$useContext3.isSubPathKey;
|
|
var connectedPath = useFullPath();
|
|
var subMenuPrefixCls = "".concat(prefixCls, "-submenu");
|
|
var mergedDisabled = contextDisabled || disabled;
|
|
var elementRef = react.useRef();
|
|
var popupRef = 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.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 ? void 0 : onMouseEnter({
|
|
key: eventKey,
|
|
domEvent: domEvent
|
|
});
|
|
};
|
|
var onInternalMouseLeave = function onInternalMouseLeave(domEvent) {
|
|
triggerChildrenActive(false);
|
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave({
|
|
key: eventKey,
|
|
domEvent: domEvent
|
|
});
|
|
};
|
|
var mergedActive = 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 ? 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 ? 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.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.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.createElement("i", {
|
|
className: "".concat(subMenuPrefixCls, "-arrow")
|
|
})));
|
|
|
|
// Cache mode if it change to `inline` which do not have popup motion
|
|
var triggerModeRef = 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.createElement(PopupTrigger, {
|
|
mode: triggerMode,
|
|
prefixCls: subMenuPrefixCls,
|
|
visible: !internalPopupClose && open && mode !== 'inline',
|
|
popupClassName: popupClassName,
|
|
popupOffset: popupOffset,
|
|
popupStyle: popupStyle,
|
|
popup: /*#__PURE__*/react.createElement(InheritableContextProvider
|
|
// Special handle of horizontal mode
|
|
, {
|
|
mode: triggerMode === 'horizontal' ? 'vertical' : triggerMode
|
|
}, /*#__PURE__*/react.createElement(SubMenu_SubMenuList, {
|
|
id: popupId,
|
|
ref: popupRef
|
|
}, children)),
|
|
disabled: mergedDisabled,
|
|
onVisibleChange: onPopupVisibleChange
|
|
}, titleNode);
|
|
}
|
|
|
|
// >>>>> List node
|
|
var listNode = /*#__PURE__*/react.createElement(rc_overflow_es.Item, (0,esm_extends/* default */.Z)({
|
|
role: "none"
|
|
}, restProps, {
|
|
component: "li",
|
|
style: style,
|
|
className: 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.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.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.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.createElement(InternalSubMenu, props, childList);
|
|
}
|
|
return /*#__PURE__*/react.createElement(PathTrackerContext.Provider, {
|
|
value: connectedKeyPath
|
|
}, renderNode);
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
var esm_typeof = __webpack_require__(71002);
|
|
;// CONCATENATED MODULE: ./node_modules/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.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls;
|
|
var groupPrefixCls = "".concat(prefixCls, "-item-group");
|
|
return /*#__PURE__*/react.createElement("li", (0,esm_extends/* default */.Z)({
|
|
role: "presentation"
|
|
}, restProps, {
|
|
onClick: function onClick(e) {
|
|
return e.stopPropagation();
|
|
},
|
|
className: classnames_default()(groupPrefixCls, className)
|
|
}), /*#__PURE__*/react.createElement("div", {
|
|
role: "presentation",
|
|
className: "".concat(groupPrefixCls, "-title"),
|
|
title: typeof title === 'string' ? title : undefined
|
|
}, title), /*#__PURE__*/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.createElement(InternalMenuItemGroup, (0,omit/* default */.Z)(props, ['warnKey']), childList);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/rc-menu/es/Divider.js
|
|
|
|
|
|
|
|
|
|
function Divider(_ref) {
|
|
var className = _ref.className,
|
|
style = _ref.style;
|
|
var _React$useContext = react.useContext(MenuContext),
|
|
prefixCls = _React$useContext.prefixCls;
|
|
var measure = useMeasure();
|
|
if (measure) {
|
|
return null;
|
|
}
|
|
return /*#__PURE__*/react.createElement("li", {
|
|
role: "separator",
|
|
className: classnames_default()("".concat(prefixCls, "-item-divider"), className),
|
|
style: style
|
|
});
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/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.createElement(MenuItemGroup, (0,esm_extends/* default */.Z)({
|
|
key: mergedKey
|
|
}, restProps, {
|
|
title: label
|
|
}), convertItemsToNodes(children));
|
|
}
|
|
|
|
// Sub Menu
|
|
return /*#__PURE__*/react.createElement(SubMenu, (0,esm_extends/* default */.Z)({
|
|
key: mergedKey
|
|
}, restProps, {
|
|
title: label
|
|
}), convertItemsToNodes(children));
|
|
}
|
|
|
|
// MenuItem & Divider
|
|
if (type === 'divider') {
|
|
return /*#__PURE__*/react.createElement(Divider, (0,esm_extends/* default */.Z)({
|
|
key: mergedKey
|
|
}, restProps));
|
|
}
|
|
return /*#__PURE__*/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/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 Menu_EMPTY_LIST = [];
|
|
var Menu = /*#__PURE__*/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.useMemo(function () {
|
|
return parseItems(children, items, Menu_EMPTY_LIST);
|
|
}, [children, items]);
|
|
var _React$useState = react.useState(false),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
mounted = _React$useState2[0],
|
|
setMounted = _React$useState2[1];
|
|
var containerRef = 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 || Menu_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 ? void 0 : onOpenChange(keys);
|
|
}
|
|
if (forceFlush) {
|
|
(0,react_dom.flushSync)(doUpdate);
|
|
} else {
|
|
doUpdate();
|
|
}
|
|
};
|
|
|
|
// >>>>> Cache & Reset open keys when inlineCollapsed changed
|
|
var _React$useState3 = react.useState(mergedOpenKeys),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
inlineCacheOpenKeys = _React$useState4[0],
|
|
setInlineCacheOpenKeys = _React$useState4[1];
|
|
var mountRef = react.useRef(false);
|
|
|
|
// ========================= Mode =========================
|
|
var _React$useMemo = 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.useState(mergedMode),
|
|
_React$useState6 = (0,slicedToArray/* default */.Z)(_React$useState5, 2),
|
|
internalMode = _React$useState6[0],
|
|
setInternalMode = _React$useState6[1];
|
|
var _React$useState7 = react.useState(mergedInlineCollapsed),
|
|
_React$useState8 = (0,slicedToArray/* default */.Z)(_React$useState7, 2),
|
|
internalInlineCollapsed = _React$useState8[0],
|
|
setInternalInlineCollapsed = _React$useState8[1];
|
|
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(Menu_EMPTY_LIST);
|
|
}
|
|
}, [mergedMode, mergedInlineCollapsed]);
|
|
|
|
// ====================== Responsive ======================
|
|
var _React$useState9 = 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.useEffect(function () {
|
|
if (isInlineMode) {
|
|
setInlineCacheOpenKeys(mergedOpenKeys);
|
|
}
|
|
}, [mergedOpenKeys]);
|
|
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.useMemo(function () {
|
|
return {
|
|
registerPath: registerPath,
|
|
unregisterPath: unregisterPath
|
|
};
|
|
}, [registerPath, unregisterPath]);
|
|
var pathUserContext = react.useMemo(function () {
|
|
return {
|
|
isSubPathKey: isSubPathKey
|
|
};
|
|
}, [isSubPathKey]);
|
|
react.useEffect(function () {
|
|
refreshOverflowKeys(allVisible ? Menu_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.useImperativeHandle)(ref, function () {
|
|
return {
|
|
list: containerRef.current,
|
|
focus: function focus(options) {
|
|
var _childList$find;
|
|
var shouldFocusKey = mergedActiveKey !== null && mergedActiveKey !== void 0 ? mergedActiveKey : (_childList$find = childList.find(function (node) {
|
|
return !node.props.disabled;
|
|
})) === null || _childList$find === void 0 ? void 0 : _childList$find.key;
|
|
if (shouldFocusKey) {
|
|
var _containerRef$current, _containerRef$current2, _containerRef$current3;
|
|
(_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.querySelector("li[data-menu-id='".concat(getMenuId(uuid, shouldFocusKey), "']"))) === null || _containerRef$current2 === void 0 ? void 0 : (_containerRef$current3 = _containerRef$current2.focus) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.call(_containerRef$current2, 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 Menu_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 ? void 0 : onDeselect(selectInfo);
|
|
} else {
|
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectInfo);
|
|
}
|
|
}
|
|
|
|
// Whatever selectable, always close it
|
|
if (!multiple && mergedOpenKeys.length && internalMode !== 'inline') {
|
|
triggerOpenKeys(Menu_EMPTY_LIST);
|
|
}
|
|
};
|
|
|
|
// ========================= Open =========================
|
|
/**
|
|
* Click for item. SubMenu do not have selection status
|
|
*/
|
|
var onInternalClick = useMemoCallback(function (info) {
|
|
onClick === null || onClick === void 0 ? 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.useEffect(function () {
|
|
setMounted(true);
|
|
}, []);
|
|
|
|
// ======================= Context ========================
|
|
var privateContext = 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.createElement(InheritableContextProvider, {
|
|
key: child.key,
|
|
overflowDisabled: index > lastVisibleIndex
|
|
}, child)
|
|
);
|
|
});
|
|
|
|
// >>>>> Container
|
|
var container = /*#__PURE__*/react.createElement(rc_overflow_es, (0,esm_extends/* default */.Z)({
|
|
id: id,
|
|
ref: containerRef,
|
|
prefixCls: "".concat(prefixCls, "-overflow"),
|
|
component: "ul",
|
|
itemComponent: es_MenuItem,
|
|
className: 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.createElement(SubMenu, {
|
|
eventKey: OVERFLOW_KEY,
|
|
title: overflowedIndicator,
|
|
disabled: allVisible,
|
|
internalPopupClose: len === 0,
|
|
popupClassName: overflowedIndicatorPopupClassName
|
|
}, originOmitItems);
|
|
},
|
|
maxCount: internalMode !== 'horizontal' || disabledOverflow ? rc_overflow_es.INVALIDATE : rc_overflow_es.RESPONSIVE,
|
|
ssr: "full",
|
|
"data-menu-list": true,
|
|
onVisibleChange: function onVisibleChange(newLastIndex) {
|
|
setLastVisibleIndex(newLastIndex);
|
|
},
|
|
onKeyDown: onInternalKeyDown
|
|
}, restProps));
|
|
|
|
// >>>>> Render
|
|
return /*#__PURE__*/react.createElement(context_PrivateContext.Provider, {
|
|
value: privateContext
|
|
}, /*#__PURE__*/react.createElement(IdContext.Provider, {
|
|
value: uuid
|
|
}, /*#__PURE__*/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.createElement(PathUserContext.Provider, {
|
|
value: pathUserContext
|
|
}, container), /*#__PURE__*/react.createElement("div", {
|
|
style: {
|
|
display: 'none'
|
|
},
|
|
"aria-hidden": true
|
|
}, /*#__PURE__*/react.createElement(PathRegisterContext.Provider, {
|
|
value: registerPathContext
|
|
}, childList)))));
|
|
});
|
|
/* harmony default export */ var es_Menu = (Menu);
|
|
;// CONCATENATED MODULE: ./node_modules/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_es = (ExportMenu);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 99962:
|
|
/*!***********************************************************************************!*\
|
|
!*** ./node_modules/rc-menu/node_modules/react-is/cjs/react-is.production.min.js ***!
|
|
\***********************************************************************************/
|
|
/***/ (function(__unused_webpack_module, exports) {
|
|
|
|
var __webpack_unused_export__;
|
|
/**
|
|
* @license React
|
|
* react-is.production.min.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}__webpack_unused_export__=h;__webpack_unused_export__=g;__webpack_unused_export__=b;__webpack_unused_export__=l;__webpack_unused_export__=d;__webpack_unused_export__=q;__webpack_unused_export__=p;__webpack_unused_export__=c;__webpack_unused_export__=f;__webpack_unused_export__=e;__webpack_unused_export__=m;
|
|
__webpack_unused_export__=n;__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(a){return v(a)===h};__webpack_unused_export__=function(a){return v(a)===g};__webpack_unused_export__=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};__webpack_unused_export__=function(a){return v(a)===l};__webpack_unused_export__=function(a){return v(a)===d};__webpack_unused_export__=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};
|
|
__webpack_unused_export__=function(a){return v(a)===c};__webpack_unused_export__=function(a){return v(a)===f};__webpack_unused_export__=function(a){return v(a)===e};__webpack_unused_export__=function(a){return v(a)===m};__webpack_unused_export__=function(a){return v(a)===n};
|
|
__webpack_unused_export__=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};__webpack_unused_export__=v;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8399:
|
|
/*!*************************************************************!*\
|
|
!*** ./node_modules/rc-menu/node_modules/react-is/index.js ***!
|
|
\*************************************************************/
|
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
|
|
|
|
if (true) {
|
|
module.exports = __webpack_require__(/*! ./cjs/react-is.production.min.js */ 99962);
|
|
} else {}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 66680:
|
|
/*!***************************************************!*\
|
|
!*** ./node_modules/rc-util/es/hooks/useEvent.js ***!
|
|
\***************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "Z": function() { return /* binding */ useEvent; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 67294);
|
|
|
|
function useEvent(callback) {
|
|
var fnRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef();
|
|
fnRef.current = callback;
|
|
var memoFn = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function () {
|
|
var _fnRef$current;
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
|
|
}, []);
|
|
return memoFn;
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 21770:
|
|
/*!*********************************************************!*\
|
|
!*** ./node_modules/rc-util/es/hooks/useMergedState.js ***!
|
|
\*********************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "Z": function() { return /* binding */ useMergedState; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ 97685);
|
|
/* harmony import */ var _useEvent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./useEvent */ 66680);
|
|
/* harmony import */ var _useLayoutEffect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useLayoutEffect */ 8410);
|
|
/* harmony import */ var _useState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./useState */ 30470);
|
|
|
|
|
|
|
|
|
|
/** We only think `undefined` is empty */
|
|
function hasValue(value) {
|
|
return value !== undefined;
|
|
}
|
|
|
|
/**
|
|
* Similar to `useState` but will use props value if provided.
|
|
* Note that internal use rc-util `useState` hook.
|
|
*/
|
|
function useMergedState(defaultStateValue, option) {
|
|
var _ref = option || {},
|
|
defaultValue = _ref.defaultValue,
|
|
value = _ref.value,
|
|
onChange = _ref.onChange,
|
|
postState = _ref.postState;
|
|
|
|
// ======================= Init =======================
|
|
var _useState = (0,_useState__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(function () {
|
|
if (hasValue(value)) {
|
|
return value;
|
|
} else if (hasValue(defaultValue)) {
|
|
return typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
} else {
|
|
return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue;
|
|
}
|
|
}),
|
|
_useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_useState, 2),
|
|
innerValue = _useState2[0],
|
|
setInnerValue = _useState2[1];
|
|
var mergedValue = value !== undefined ? value : innerValue;
|
|
var postMergedValue = postState ? postState(mergedValue) : mergedValue;
|
|
|
|
// ====================== Change ======================
|
|
var onChangeFn = (0,_useEvent__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(onChange);
|
|
var _useState3 = (0,_useState__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)([mergedValue]),
|
|
_useState4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(_useState3, 2),
|
|
prevValue = _useState4[0],
|
|
setPrevValue = _useState4[1];
|
|
(0,_useLayoutEffect__WEBPACK_IMPORTED_MODULE_1__/* .useLayoutUpdateEffect */ .o)(function () {
|
|
var prev = prevValue[0];
|
|
if (innerValue !== prev) {
|
|
onChangeFn(innerValue, prev);
|
|
}
|
|
}, [prevValue]);
|
|
|
|
// Sync value back to `undefined` when it from control to un-control
|
|
(0,_useLayoutEffect__WEBPACK_IMPORTED_MODULE_1__/* .useLayoutUpdateEffect */ .o)(function () {
|
|
if (!hasValue(value)) {
|
|
setInnerValue(value);
|
|
}
|
|
}, [value]);
|
|
|
|
// ====================== Update ======================
|
|
var triggerChange = (0,_useEvent__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(function (updater, ignoreDestroy) {
|
|
setInnerValue(updater, ignoreDestroy);
|
|
setPrevValue([mergedValue], ignoreDestroy);
|
|
});
|
|
return [postMergedValue, triggerChange];
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 91881:
|
|
/*!********************************************!*\
|
|
!*** ./node_modules/rc-util/es/isEqual.js ***!
|
|
\********************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ 71002);
|
|
/* harmony import */ var _warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./warning */ 80334);
|
|
|
|
|
|
|
|
/**
|
|
* Deeply compares two object literals.
|
|
* @param obj1 object 1
|
|
* @param obj2 object 2
|
|
* @param shallow shallow compare
|
|
* @returns
|
|
*/
|
|
function isEqual(obj1, obj2) {
|
|
var shallow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
// https://github.com/mapbox/mapbox-gl-js/pull/5979/files#diff-fde7145050c47cc3a306856efd5f9c3016e86e859de9afbd02c879be5067e58f
|
|
var refSet = new Set();
|
|
function deepEqual(a, b) {
|
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
var circular = refSet.has(a);
|
|
(0,_warning__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .ZP)(!circular, 'Warning: There may be circular references');
|
|
if (circular) {
|
|
return false;
|
|
}
|
|
if (a === b) {
|
|
return true;
|
|
}
|
|
if (shallow && level > 1) {
|
|
return false;
|
|
}
|
|
refSet.add(a);
|
|
var newLevel = level + 1;
|
|
if (Array.isArray(a)) {
|
|
if (!Array.isArray(b) || a.length !== b.length) {
|
|
return false;
|
|
}
|
|
for (var i = 0; i < a.length; i++) {
|
|
if (!deepEqual(a[i], b[i], newLevel)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
if (a && b && (0,_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(a) === 'object' && (0,_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(b) === 'object') {
|
|
var keys = Object.keys(a);
|
|
if (keys.length !== Object.keys(b).length) {
|
|
return false;
|
|
}
|
|
return keys.every(function (key) {
|
|
return deepEqual(a[key], b[key], newLevel);
|
|
});
|
|
}
|
|
// other
|
|
return false;
|
|
}
|
|
return deepEqual(obj1, obj2);
|
|
}
|
|
/* harmony default export */ __webpack_exports__["Z"] = (isEqual);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 98423:
|
|
/*!*****************************************!*\
|
|
!*** ./node_modules/rc-util/es/omit.js ***!
|
|
\*****************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "Z": function() { return /* binding */ omit; }
|
|
/* harmony export */ });
|
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ 1413);
|
|
|
|
function omit(obj, fields) {
|
|
var clone = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)({}, obj);
|
|
if (Array.isArray(fields)) {
|
|
fields.forEach(function (key) {
|
|
delete clone[key];
|
|
});
|
|
}
|
|
return clone;
|
|
}
|
|
|
|
/***/ })
|
|
|
|
}]); |