|
|
"use strict";
|
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[81263],{
|
|
|
|
|
|
/***/ 81263:
|
|
|
/*!**********************************************************!*\
|
|
|
!*** ./node_modules/rc-trigger/es/index.js + 15 modules ***!
|
|
|
\**********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
// EXPORTS
|
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
|
"Z": function() { return /* binding */ rc_trigger_es; }
|
|
|
});
|
|
|
|
|
|
// UNUSED EXPORTS: generateTrigger
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js
|
|
|
var objectSpread2 = __webpack_require__(1413);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
|
var esm_extends = __webpack_require__(87462);
|
|
|
// 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/assertThisInitialized.js
|
|
|
var assertThisInitialized = __webpack_require__(97326);
|
|
|
// 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/@babel/runtime/helpers/esm/defineProperty.js
|
|
|
var defineProperty = __webpack_require__(4942);
|
|
|
// EXTERNAL MODULE: ./node_modules/react/index.js
|
|
|
var react = __webpack_require__(67294);
|
|
|
// 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);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/contains.js
|
|
|
var contains = __webpack_require__(94999);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/findDOMNode.js
|
|
|
var findDOMNode = __webpack_require__(34203);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/ref.js
|
|
|
var es_ref = __webpack_require__(42550);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/addEventListener.js
|
|
|
var addEventListener = __webpack_require__(64019);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/canUseDom.js
|
|
|
var canUseDom = __webpack_require__(98924);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-util/es/Portal.js
|
|
|
|
|
|
|
|
|
|
|
|
var Portal = /*#__PURE__*/(0,react.forwardRef)(function (props, ref) {
|
|
|
var didUpdate = props.didUpdate,
|
|
|
getContainer = props.getContainer,
|
|
|
children = props.children;
|
|
|
var parentRef = (0,react.useRef)();
|
|
|
var containerRef = (0,react.useRef)();
|
|
|
|
|
|
// Ref return nothing, only for wrapper check exist
|
|
|
(0,react.useImperativeHandle)(ref, function () {
|
|
|
return {};
|
|
|
});
|
|
|
|
|
|
// Create container in client side with sync to avoid useEffect not get ref
|
|
|
var initRef = (0,react.useRef)(false);
|
|
|
if (!initRef.current && (0,canUseDom/* default */.Z)()) {
|
|
|
containerRef.current = getContainer();
|
|
|
parentRef.current = containerRef.current.parentNode;
|
|
|
initRef.current = true;
|
|
|
}
|
|
|
|
|
|
// [Legacy] Used by `rc-trigger`
|
|
|
(0,react.useEffect)(function () {
|
|
|
didUpdate === null || didUpdate === void 0 ? void 0 : didUpdate(props);
|
|
|
});
|
|
|
(0,react.useEffect)(function () {
|
|
|
// Restore container to original place
|
|
|
// React 18 StrictMode will unmount first and mount back for effect test:
|
|
|
// https://reactjs.org/blog/2022/03/29/react-v18.html#new-strict-mode-behaviors
|
|
|
if (containerRef.current.parentNode === null && parentRef.current !== null) {
|
|
|
parentRef.current.appendChild(containerRef.current);
|
|
|
}
|
|
|
return function () {
|
|
|
var _containerRef$current, _containerRef$current2;
|
|
|
// [Legacy] This should not be handle by Portal but parent PortalWrapper instead.
|
|
|
// Since some component use `Portal` directly, we have to keep the logic here.
|
|
|
(_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.parentNode) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.removeChild(containerRef.current);
|
|
|
};
|
|
|
}, []);
|
|
|
return containerRef.current ? /*#__PURE__*/react_dom.createPortal(children, containerRef.current) : null;
|
|
|
});
|
|
|
/* harmony default export */ var es_Portal = (Portal);
|
|
|
// EXTERNAL MODULE: ./node_modules/classnames/index.js
|
|
|
var classnames = __webpack_require__(94184);
|
|
|
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/utils/alignUtil.js
|
|
|
|
|
|
|
|
|
function isPointsEq(a1, a2, isAlignPoint) {
|
|
|
if (isAlignPoint) {
|
|
|
return a1[0] === a2[0];
|
|
|
}
|
|
|
|
|
|
return a1[0] === a2[0] && a1[1] === a2[1];
|
|
|
}
|
|
|
|
|
|
function getAlignFromPlacement(builtinPlacements, placementStr, align) {
|
|
|
var baseAlign = builtinPlacements[placementStr] || {};
|
|
|
return (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, baseAlign), align);
|
|
|
}
|
|
|
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 placement = placements[i];
|
|
|
|
|
|
if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
|
|
|
return "".concat(prefixCls, "-placement-").concat(placement);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return '';
|
|
|
}
|
|
|
// 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/rc-util/es/isMobile.js
|
|
|
var isMobile = __webpack_require__(53334);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-motion/es/index.js + 11 modules
|
|
|
var es = __webpack_require__(62874);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/utils/legacyUtil.js
|
|
|
function getMotion(_ref) {
|
|
|
var prefixCls = _ref.prefixCls,
|
|
|
motion = _ref.motion,
|
|
|
animation = _ref.animation,
|
|
|
transitionName = _ref.transitionName;
|
|
|
|
|
|
if (motion) {
|
|
|
return motion;
|
|
|
}
|
|
|
|
|
|
if (animation) {
|
|
|
return {
|
|
|
motionName: "".concat(prefixCls, "-").concat(animation)
|
|
|
};
|
|
|
}
|
|
|
|
|
|
if (transitionName) {
|
|
|
return {
|
|
|
motionName: transitionName
|
|
|
};
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/Popup/Mask.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Mask(props) {
|
|
|
var prefixCls = props.prefixCls,
|
|
|
visible = props.visible,
|
|
|
zIndex = props.zIndex,
|
|
|
mask = props.mask,
|
|
|
maskMotion = props.maskMotion,
|
|
|
maskAnimation = props.maskAnimation,
|
|
|
maskTransitionName = props.maskTransitionName;
|
|
|
|
|
|
if (!mask) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
var motion = {};
|
|
|
|
|
|
if (maskMotion || maskTransitionName || maskAnimation) {
|
|
|
motion = (0,objectSpread2/* default */.Z)({
|
|
|
motionAppear: true
|
|
|
}, getMotion({
|
|
|
motion: maskMotion,
|
|
|
prefixCls: prefixCls,
|
|
|
transitionName: maskTransitionName,
|
|
|
animation: maskAnimation
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
return /*#__PURE__*/react.createElement(es["default"], (0,esm_extends/* default */.Z)({}, motion, {
|
|
|
visible: visible,
|
|
|
removeOnLeave: true
|
|
|
}), function (_ref) {
|
|
|
var className = _ref.className;
|
|
|
return /*#__PURE__*/react.createElement("div", {
|
|
|
style: {
|
|
|
zIndex: zIndex
|
|
|
},
|
|
|
className: classnames_default()("".concat(prefixCls, "-mask"), className)
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
|
var esm_typeof = __webpack_require__(71002);
|
|
|
;// CONCATENATED MODULE: ./node_modules/dom-align/dist-web/index.js
|
|
|
function 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(target) {
|
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
|
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
|
_defineProperty(target, key, source[key]);
|
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
|
});
|
|
|
}
|
|
|
return target;
|
|
|
}
|
|
|
function _typeof(obj) {
|
|
|
"@babel/helpers - typeof";
|
|
|
|
|
|
return _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(obj);
|
|
|
}
|
|
|
function _defineProperty(obj, key, value) {
|
|
|
if (key in obj) {
|
|
|
Object.defineProperty(obj, key, {
|
|
|
value: value,
|
|
|
enumerable: true,
|
|
|
configurable: true,
|
|
|
writable: true
|
|
|
});
|
|
|
} else {
|
|
|
obj[key] = value;
|
|
|
}
|
|
|
return obj;
|
|
|
}
|
|
|
|
|
|
var vendorPrefix;
|
|
|
var jsCssMap = {
|
|
|
Webkit: '-webkit-',
|
|
|
Moz: '-moz-',
|
|
|
// IE did it wrong again ...
|
|
|
ms: '-ms-',
|
|
|
O: '-o-'
|
|
|
};
|
|
|
function getVendorPrefix() {
|
|
|
if (vendorPrefix !== undefined) {
|
|
|
return vendorPrefix;
|
|
|
}
|
|
|
vendorPrefix = '';
|
|
|
var style = document.createElement('p').style;
|
|
|
var testProp = 'Transform';
|
|
|
for (var key in jsCssMap) {
|
|
|
if (key + testProp in style) {
|
|
|
vendorPrefix = key;
|
|
|
}
|
|
|
}
|
|
|
return vendorPrefix;
|
|
|
}
|
|
|
function getTransitionName() {
|
|
|
return getVendorPrefix() ? "".concat(getVendorPrefix(), "TransitionProperty") : 'transitionProperty';
|
|
|
}
|
|
|
function getTransformName() {
|
|
|
return getVendorPrefix() ? "".concat(getVendorPrefix(), "Transform") : 'transform';
|
|
|
}
|
|
|
function setTransitionProperty(node, value) {
|
|
|
var name = getTransitionName();
|
|
|
if (name) {
|
|
|
node.style[name] = value;
|
|
|
if (name !== 'transitionProperty') {
|
|
|
node.style.transitionProperty = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
function setTransform(node, value) {
|
|
|
var name = getTransformName();
|
|
|
if (name) {
|
|
|
node.style[name] = value;
|
|
|
if (name !== 'transform') {
|
|
|
node.style.transform = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
function getTransitionProperty(node) {
|
|
|
return node.style.transitionProperty || node.style[getTransitionName()];
|
|
|
}
|
|
|
function getTransformXY(node) {
|
|
|
var style = window.getComputedStyle(node, null);
|
|
|
var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
|
|
if (transform && transform !== 'none') {
|
|
|
var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
|
|
|
return {
|
|
|
x: parseFloat(matrix[12] || matrix[4], 0),
|
|
|
y: parseFloat(matrix[13] || matrix[5], 0)
|
|
|
};
|
|
|
}
|
|
|
return {
|
|
|
x: 0,
|
|
|
y: 0
|
|
|
};
|
|
|
}
|
|
|
var matrix2d = /matrix\((.*)\)/;
|
|
|
var matrix3d = /matrix3d\((.*)\)/;
|
|
|
function setTransformXY(node, xy) {
|
|
|
var style = window.getComputedStyle(node, null);
|
|
|
var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
|
|
|
if (transform && transform !== 'none') {
|
|
|
var arr;
|
|
|
var match2d = transform.match(matrix2d);
|
|
|
if (match2d) {
|
|
|
match2d = match2d[1];
|
|
|
arr = match2d.split(',').map(function (item) {
|
|
|
return parseFloat(item, 10);
|
|
|
});
|
|
|
arr[4] = xy.x;
|
|
|
arr[5] = xy.y;
|
|
|
setTransform(node, "matrix(".concat(arr.join(','), ")"));
|
|
|
} else {
|
|
|
var match3d = transform.match(matrix3d)[1];
|
|
|
arr = match3d.split(',').map(function (item) {
|
|
|
return parseFloat(item, 10);
|
|
|
});
|
|
|
arr[12] = xy.x;
|
|
|
arr[13] = xy.y;
|
|
|
setTransform(node, "matrix3d(".concat(arr.join(','), ")"));
|
|
|
}
|
|
|
} else {
|
|
|
setTransform(node, "translateX(".concat(xy.x, "px) translateY(").concat(xy.y, "px) translateZ(0)"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
|
|
|
var getComputedStyleX;
|
|
|
|
|
|
// https://stackoverflow.com/a/3485654/3040605
|
|
|
function forceRelayout(elem) {
|
|
|
var originalStyle = elem.style.display;
|
|
|
elem.style.display = 'none';
|
|
|
elem.offsetHeight; // eslint-disable-line
|
|
|
elem.style.display = originalStyle;
|
|
|
}
|
|
|
function css(el, name, v) {
|
|
|
var value = v;
|
|
|
if (_typeof(name) === 'object') {
|
|
|
for (var i in name) {
|
|
|
if (name.hasOwnProperty(i)) {
|
|
|
css(el, i, name[i]);
|
|
|
}
|
|
|
}
|
|
|
return undefined;
|
|
|
}
|
|
|
if (typeof value !== 'undefined') {
|
|
|
if (typeof value === 'number') {
|
|
|
value = "".concat(value, "px");
|
|
|
}
|
|
|
el.style[name] = value;
|
|
|
return undefined;
|
|
|
}
|
|
|
return getComputedStyleX(el, name);
|
|
|
}
|
|
|
function getClientPosition(elem) {
|
|
|
var box;
|
|
|
var x;
|
|
|
var y;
|
|
|
var doc = elem.ownerDocument;
|
|
|
var body = doc.body;
|
|
|
var docElem = doc && doc.documentElement;
|
|
|
// 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
|
|
|
box = elem.getBoundingClientRect();
|
|
|
|
|
|
// 注:jQuery 还考虑减去 docElem.clientLeft/clientTop
|
|
|
// 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
|
|
|
// 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin
|
|
|
|
|
|
x = Math.floor(box.left);
|
|
|
y = Math.floor(box.top);
|
|
|
|
|
|
// In IE, most of the time, 2 extra pixels are added to the top and left
|
|
|
// due to the implicit 2-pixel inset border. In IE6/7 quirks mode and
|
|
|
// IE6 standards mode, this border can be overridden by setting the
|
|
|
// document element's border to zero -- thus, we cannot rely on the
|
|
|
// offset always being 2 pixels.
|
|
|
|
|
|
// In quirks mode, the offset can be determined by querying the body's
|
|
|
// clientLeft/clientTop, but in standards mode, it is found by querying
|
|
|
// the document element's clientLeft/clientTop. Since we already called
|
|
|
// getClientBoundingRect we have already forced a reflow, so it is not
|
|
|
// too expensive just to query them all.
|
|
|
|
|
|
// ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
|
|
|
// 窗口边框标准是设 documentElement ,quirks 时设置 body
|
|
|
// 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
|
|
|
// 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置
|
|
|
// 标准 ie 下 docElem.clientTop 就是 border-top
|
|
|
// ie7 html 即窗口边框改变不了。永远为 2
|
|
|
// 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0
|
|
|
|
|
|
x -= docElem.clientLeft || body.clientLeft || 0;
|
|
|
y -= docElem.clientTop || body.clientTop || 0;
|
|
|
return {
|
|
|
left: x,
|
|
|
top: y
|
|
|
};
|
|
|
}
|
|
|
function getScroll(w, top) {
|
|
|
var ret = w["page".concat(top ? 'Y' : 'X', "Offset")];
|
|
|
var method = "scroll".concat(top ? 'Top' : 'Left');
|
|
|
if (typeof ret !== 'number') {
|
|
|
var d = w.document;
|
|
|
// ie6,7,8 standard mode
|
|
|
ret = d.documentElement[method];
|
|
|
if (typeof ret !== 'number') {
|
|
|
// quirks mode
|
|
|
ret = d.body[method];
|
|
|
}
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
function getScrollLeft(w) {
|
|
|
return getScroll(w);
|
|
|
}
|
|
|
function getScrollTop(w) {
|
|
|
return getScroll(w, true);
|
|
|
}
|
|
|
function getOffset(el) {
|
|
|
var pos = getClientPosition(el);
|
|
|
var doc = el.ownerDocument;
|
|
|
var w = doc.defaultView || doc.parentWindow;
|
|
|
pos.left += getScrollLeft(w);
|
|
|
pos.top += getScrollTop(w);
|
|
|
return pos;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* A crude way of determining if an object is a window
|
|
|
* @member util
|
|
|
*/
|
|
|
function isWindow(obj) {
|
|
|
// must use == for ie8
|
|
|
/* eslint eqeqeq:0 */
|
|
|
return obj !== null && obj !== undefined && obj == obj.window;
|
|
|
}
|
|
|
function getDocument(node) {
|
|
|
if (isWindow(node)) {
|
|
|
return node.document;
|
|
|
}
|
|
|
if (node.nodeType === 9) {
|
|
|
return node;
|
|
|
}
|
|
|
return node.ownerDocument;
|
|
|
}
|
|
|
function _getComputedStyle(elem, name, cs) {
|
|
|
var computedStyle = cs;
|
|
|
var val = '';
|
|
|
var d = getDocument(elem);
|
|
|
computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
|
|
|
|
|
|
// https://github.com/kissyteam/kissy/issues/61
|
|
|
if (computedStyle) {
|
|
|
val = computedStyle.getPropertyValue(name) || computedStyle[name];
|
|
|
}
|
|
|
return val;
|
|
|
}
|
|
|
var _RE_NUM_NO_PX = new RegExp("^(".concat(RE_NUM, ")(?!px)[a-z%]+$"), 'i');
|
|
|
var RE_POS = /^(top|right|bottom|left)$/;
|
|
|
var CURRENT_STYLE = 'currentStyle';
|
|
|
var RUNTIME_STYLE = 'runtimeStyle';
|
|
|
var LEFT = 'left';
|
|
|
var PX = 'px';
|
|
|
function _getComputedStyleIE(elem, name) {
|
|
|
// currentStyle maybe null
|
|
|
// http://msdn.microsoft.com/en-us/library/ms535231.aspx
|
|
|
var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
|
|
|
|
|
|
// 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
|
|
|
// 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
|
|
|
// 在 ie 下不对,需要直接用 offset 方式
|
|
|
// borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
|
|
|
|
|
|
// From the awesome hack by Dean Edwards
|
|
|
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
|
|
// If we're not dealing with a regular pixel number
|
|
|
// but a number that has a weird ending, we need to convert it to pixels
|
|
|
// exclude left right for relativity
|
|
|
if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
|
|
|
// Remember the original values
|
|
|
var style = elem.style;
|
|
|
var left = style[LEFT];
|
|
|
var rsLeft = elem[RUNTIME_STYLE][LEFT];
|
|
|
|
|
|
// prevent flashing of content
|
|
|
elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
|
|
|
|
|
|
// Put in the new values to get a computed value out
|
|
|
style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
|
|
|
ret = style.pixelLeft + PX;
|
|
|
|
|
|
// Revert the changed values
|
|
|
style[LEFT] = left;
|
|
|
elem[RUNTIME_STYLE][LEFT] = rsLeft;
|
|
|
}
|
|
|
return ret === '' ? 'auto' : ret;
|
|
|
}
|
|
|
if (typeof window !== 'undefined') {
|
|
|
getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
|
|
|
}
|
|
|
function getOffsetDirection(dir, option) {
|
|
|
if (dir === 'left') {
|
|
|
return option.useCssRight ? 'right' : dir;
|
|
|
}
|
|
|
return option.useCssBottom ? 'bottom' : dir;
|
|
|
}
|
|
|
function oppositeOffsetDirection(dir) {
|
|
|
if (dir === 'left') {
|
|
|
return 'right';
|
|
|
} else if (dir === 'right') {
|
|
|
return 'left';
|
|
|
} else if (dir === 'top') {
|
|
|
return 'bottom';
|
|
|
} else if (dir === 'bottom') {
|
|
|
return 'top';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 设置 elem 相对 elem.ownerDocument 的坐标
|
|
|
function setLeftTop(elem, offset, option) {
|
|
|
// set position first, in-case top/left are set even on static elem
|
|
|
if (css(elem, 'position') === 'static') {
|
|
|
elem.style.position = 'relative';
|
|
|
}
|
|
|
var presetH = -999;
|
|
|
var presetV = -999;
|
|
|
var horizontalProperty = getOffsetDirection('left', option);
|
|
|
var verticalProperty = getOffsetDirection('top', option);
|
|
|
var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
|
|
|
var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
|
|
|
if (horizontalProperty !== 'left') {
|
|
|
presetH = 999;
|
|
|
}
|
|
|
if (verticalProperty !== 'top') {
|
|
|
presetV = 999;
|
|
|
}
|
|
|
var originalTransition = '';
|
|
|
var originalOffset = getOffset(elem);
|
|
|
if ('left' in offset || 'top' in offset) {
|
|
|
originalTransition = getTransitionProperty(elem) || '';
|
|
|
setTransitionProperty(elem, 'none');
|
|
|
}
|
|
|
if ('left' in offset) {
|
|
|
elem.style[oppositeHorizontalProperty] = '';
|
|
|
elem.style[horizontalProperty] = "".concat(presetH, "px");
|
|
|
}
|
|
|
if ('top' in offset) {
|
|
|
elem.style[oppositeVerticalProperty] = '';
|
|
|
elem.style[verticalProperty] = "".concat(presetV, "px");
|
|
|
}
|
|
|
// force relayout
|
|
|
forceRelayout(elem);
|
|
|
var old = getOffset(elem);
|
|
|
var originalStyle = {};
|
|
|
for (var key in offset) {
|
|
|
if (offset.hasOwnProperty(key)) {
|
|
|
var dir = getOffsetDirection(key, option);
|
|
|
var preset = key === 'left' ? presetH : presetV;
|
|
|
var off = originalOffset[key] - old[key];
|
|
|
if (dir === key) {
|
|
|
originalStyle[dir] = preset + off;
|
|
|
} else {
|
|
|
originalStyle[dir] = preset - off;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
css(elem, originalStyle);
|
|
|
// force relayout
|
|
|
forceRelayout(elem);
|
|
|
if ('left' in offset || 'top' in offset) {
|
|
|
setTransitionProperty(elem, originalTransition);
|
|
|
}
|
|
|
var ret = {};
|
|
|
for (var _key in offset) {
|
|
|
if (offset.hasOwnProperty(_key)) {
|
|
|
var _dir = getOffsetDirection(_key, option);
|
|
|
var _off = offset[_key] - originalOffset[_key];
|
|
|
if (_key === _dir) {
|
|
|
ret[_dir] = originalStyle[_dir] + _off;
|
|
|
} else {
|
|
|
ret[_dir] = originalStyle[_dir] - _off;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
css(elem, ret);
|
|
|
}
|
|
|
function setTransform$1(elem, offset) {
|
|
|
var originalOffset = getOffset(elem);
|
|
|
var originalXY = getTransformXY(elem);
|
|
|
var resultXY = {
|
|
|
x: originalXY.x,
|
|
|
y: originalXY.y
|
|
|
};
|
|
|
if ('left' in offset) {
|
|
|
resultXY.x = originalXY.x + offset.left - originalOffset.left;
|
|
|
}
|
|
|
if ('top' in offset) {
|
|
|
resultXY.y = originalXY.y + offset.top - originalOffset.top;
|
|
|
}
|
|
|
setTransformXY(elem, resultXY);
|
|
|
}
|
|
|
function setOffset(elem, offset, option) {
|
|
|
if (option.ignoreShake) {
|
|
|
var oriOffset = getOffset(elem);
|
|
|
var oLeft = oriOffset.left.toFixed(0);
|
|
|
var oTop = oriOffset.top.toFixed(0);
|
|
|
var tLeft = offset.left.toFixed(0);
|
|
|
var tTop = offset.top.toFixed(0);
|
|
|
if (oLeft === tLeft && oTop === tTop) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if (option.useCssRight || option.useCssBottom) {
|
|
|
setLeftTop(elem, offset, option);
|
|
|
} else if (option.useCssTransform && getTransformName() in document.body.style) {
|
|
|
setTransform$1(elem, offset);
|
|
|
} else {
|
|
|
setLeftTop(elem, offset, option);
|
|
|
}
|
|
|
}
|
|
|
function each(arr, fn) {
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
fn(arr[i]);
|
|
|
}
|
|
|
}
|
|
|
function isBorderBoxFn(elem) {
|
|
|
return getComputedStyleX(elem, 'boxSizing') === 'border-box';
|
|
|
}
|
|
|
var BOX_MODELS = ['margin', 'border', 'padding'];
|
|
|
var CONTENT_INDEX = -1;
|
|
|
var PADDING_INDEX = 2;
|
|
|
var BORDER_INDEX = 1;
|
|
|
var MARGIN_INDEX = 0;
|
|
|
function swap(elem, options, callback) {
|
|
|
var old = {};
|
|
|
var style = elem.style;
|
|
|
var name;
|
|
|
|
|
|
// Remember the old values, and insert the new ones
|
|
|
for (name in options) {
|
|
|
if (options.hasOwnProperty(name)) {
|
|
|
old[name] = style[name];
|
|
|
style[name] = options[name];
|
|
|
}
|
|
|
}
|
|
|
callback.call(elem);
|
|
|
|
|
|
// Revert the old values
|
|
|
for (name in options) {
|
|
|
if (options.hasOwnProperty(name)) {
|
|
|
style[name] = old[name];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
function getPBMWidth(elem, props, which) {
|
|
|
var value = 0;
|
|
|
var prop;
|
|
|
var j;
|
|
|
var i;
|
|
|
for (j = 0; j < props.length; j++) {
|
|
|
prop = props[j];
|
|
|
if (prop) {
|
|
|
for (i = 0; i < which.length; i++) {
|
|
|
var cssProp = void 0;
|
|
|
if (prop === 'border') {
|
|
|
cssProp = "".concat(prop).concat(which[i], "Width");
|
|
|
} else {
|
|
|
cssProp = prop + which[i];
|
|
|
}
|
|
|
value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
var domUtils = {
|
|
|
getParent: function getParent(element) {
|
|
|
var parent = element;
|
|
|
do {
|
|
|
if (parent.nodeType === 11 && parent.host) {
|
|
|
parent = parent.host;
|
|
|
} else {
|
|
|
parent = parent.parentNode;
|
|
|
}
|
|
|
} while (parent && parent.nodeType !== 1 && parent.nodeType !== 9);
|
|
|
return parent;
|
|
|
}
|
|
|
};
|
|
|
each(['Width', 'Height'], function (name) {
|
|
|
domUtils["doc".concat(name)] = function (refWin) {
|
|
|
var d = refWin.document;
|
|
|
return Math.max(
|
|
|
// firefox chrome documentElement.scrollHeight< body.scrollHeight
|
|
|
// ie standard mode : documentElement.scrollHeight> body.scrollHeight
|
|
|
d.documentElement["scroll".concat(name)],
|
|
|
// quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
|
|
|
d.body["scroll".concat(name)], domUtils["viewport".concat(name)](d));
|
|
|
};
|
|
|
domUtils["viewport".concat(name)] = function (win) {
|
|
|
// pc browser includes scrollbar in window.innerWidth
|
|
|
var prop = "client".concat(name);
|
|
|
var doc = win.document;
|
|
|
var body = doc.body;
|
|
|
var documentElement = doc.documentElement;
|
|
|
var documentElementProp = documentElement[prop];
|
|
|
// 标准模式取 documentElement
|
|
|
// backcompat 取 body
|
|
|
return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
|
|
|
};
|
|
|
});
|
|
|
|
|
|
/*
|
|
|
得到元素的大小信息
|
|
|
@param elem
|
|
|
@param name
|
|
|
@param {String} [extra] 'padding' : (css width) + padding
|
|
|
'border' : (css width) + padding + border
|
|
|
'margin' : (css width) + padding + border + margin
|
|
|
*/
|
|
|
function getWH(elem, name, ex) {
|
|
|
var extra = ex;
|
|
|
if (isWindow(elem)) {
|
|
|
return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
|
|
|
} else if (elem.nodeType === 9) {
|
|
|
return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
|
|
|
}
|
|
|
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
|
|
var borderBoxValue = name === 'width' ? Math.floor(elem.getBoundingClientRect().width) : Math.floor(elem.getBoundingClientRect().height);
|
|
|
var isBorderBox = isBorderBoxFn(elem);
|
|
|
var cssBoxValue = 0;
|
|
|
if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
|
|
|
borderBoxValue = undefined;
|
|
|
// Fall back to computed then un computed css if necessary
|
|
|
cssBoxValue = getComputedStyleX(elem, name);
|
|
|
if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
|
|
|
cssBoxValue = elem.style[name] || 0;
|
|
|
}
|
|
|
// Normalize '', auto, and prepare for extra
|
|
|
cssBoxValue = Math.floor(parseFloat(cssBoxValue)) || 0;
|
|
|
}
|
|
|
if (extra === undefined) {
|
|
|
extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
|
|
|
}
|
|
|
var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
|
|
|
var val = borderBoxValue || cssBoxValue;
|
|
|
if (extra === CONTENT_INDEX) {
|
|
|
if (borderBoxValueOrIsBorderBox) {
|
|
|
return val - getPBMWidth(elem, ['border', 'padding'], which);
|
|
|
}
|
|
|
return cssBoxValue;
|
|
|
} else if (borderBoxValueOrIsBorderBox) {
|
|
|
if (extra === BORDER_INDEX) {
|
|
|
return val;
|
|
|
}
|
|
|
return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which) : getPBMWidth(elem, ['margin'], which));
|
|
|
}
|
|
|
return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which);
|
|
|
}
|
|
|
var cssShow = {
|
|
|
position: 'absolute',
|
|
|
visibility: 'hidden',
|
|
|
display: 'block'
|
|
|
};
|
|
|
|
|
|
// fix #119 : https://github.com/kissyteam/kissy/issues/119
|
|
|
function getWHIgnoreDisplay() {
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
|
args[_key2] = arguments[_key2];
|
|
|
}
|
|
|
var val;
|
|
|
var elem = args[0];
|
|
|
// in case elem is window
|
|
|
// elem.offsetWidth === undefined
|
|
|
if (elem.offsetWidth !== 0) {
|
|
|
val = getWH.apply(undefined, args);
|
|
|
} else {
|
|
|
swap(elem, cssShow, function () {
|
|
|
val = getWH.apply(undefined, args);
|
|
|
});
|
|
|
}
|
|
|
return val;
|
|
|
}
|
|
|
each(['width', 'height'], function (name) {
|
|
|
var first = name.charAt(0).toUpperCase() + name.slice(1);
|
|
|
domUtils["outer".concat(first)] = function (el, includeMargin) {
|
|
|
return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
|
|
|
};
|
|
|
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
|
|
|
domUtils[name] = function (elem, v) {
|
|
|
var val = v;
|
|
|
if (val !== undefined) {
|
|
|
if (elem) {
|
|
|
var isBorderBox = isBorderBoxFn(elem);
|
|
|
if (isBorderBox) {
|
|
|
val += getPBMWidth(elem, ['padding', 'border'], which);
|
|
|
}
|
|
|
return css(elem, name, val);
|
|
|
}
|
|
|
return undefined;
|
|
|
}
|
|
|
return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
|
|
|
};
|
|
|
});
|
|
|
function mix(to, from) {
|
|
|
for (var i in from) {
|
|
|
if (from.hasOwnProperty(i)) {
|
|
|
to[i] = from[i];
|
|
|
}
|
|
|
}
|
|
|
return to;
|
|
|
}
|
|
|
var utils = {
|
|
|
getWindow: function getWindow(node) {
|
|
|
if (node && node.document && node.setTimeout) {
|
|
|
return node;
|
|
|
}
|
|
|
var doc = node.ownerDocument || node;
|
|
|
return doc.defaultView || doc.parentWindow;
|
|
|
},
|
|
|
getDocument: getDocument,
|
|
|
offset: function offset(el, value, option) {
|
|
|
if (typeof value !== 'undefined') {
|
|
|
setOffset(el, value, option || {});
|
|
|
} else {
|
|
|
return getOffset(el);
|
|
|
}
|
|
|
},
|
|
|
isWindow: isWindow,
|
|
|
each: each,
|
|
|
css: css,
|
|
|
clone: function clone(obj) {
|
|
|
var i;
|
|
|
var ret = {};
|
|
|
for (i in obj) {
|
|
|
if (obj.hasOwnProperty(i)) {
|
|
|
ret[i] = obj[i];
|
|
|
}
|
|
|
}
|
|
|
var overflow = obj.overflow;
|
|
|
if (overflow) {
|
|
|
for (i in obj) {
|
|
|
if (obj.hasOwnProperty(i)) {
|
|
|
ret.overflow[i] = obj.overflow[i];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return ret;
|
|
|
},
|
|
|
mix: mix,
|
|
|
getWindowScrollLeft: function getWindowScrollLeft(w) {
|
|
|
return getScrollLeft(w);
|
|
|
},
|
|
|
getWindowScrollTop: function getWindowScrollTop(w) {
|
|
|
return getScrollTop(w);
|
|
|
},
|
|
|
merge: function merge() {
|
|
|
var ret = {};
|
|
|
for (var i = 0; i < arguments.length; i++) {
|
|
|
utils.mix(ret, i < 0 || arguments.length <= i ? undefined : arguments[i]);
|
|
|
}
|
|
|
return ret;
|
|
|
},
|
|
|
viewportWidth: 0,
|
|
|
viewportHeight: 0
|
|
|
};
|
|
|
mix(utils, domUtils);
|
|
|
|
|
|
/**
|
|
|
* 得到会导致元素显示不全的祖先元素
|
|
|
*/
|
|
|
var getParent = utils.getParent;
|
|
|
function getOffsetParent(element) {
|
|
|
if (utils.isWindow(element) || element.nodeType === 9) {
|
|
|
return null;
|
|
|
}
|
|
|
// ie 这个也不是完全可行
|
|
|
/*
|
|
|
<div style="width: 50px;height: 100px;overflow: hidden">
|
|
|
<div style="width: 50px;height: 100px;position: relative;" id="d6">
|
|
|
元素 6 高 100px 宽 50px<br/>
|
|
|
</div>
|
|
|
</div>
|
|
|
*/
|
|
|
// element.offsetParent does the right thing in ie7 and below. Return parent with layout!
|
|
|
// In other browsers it only includes elements with position absolute, relative or
|
|
|
// fixed, not elements with overflow set to auto or scroll.
|
|
|
// if (UA.ie && ieMode < 8) {
|
|
|
// return element.offsetParent;
|
|
|
// }
|
|
|
// 统一的 offsetParent 方法
|
|
|
var doc = utils.getDocument(element);
|
|
|
var body = doc.body;
|
|
|
var parent;
|
|
|
var positionStyle = utils.css(element, 'position');
|
|
|
var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
|
|
|
if (!skipStatic) {
|
|
|
return element.nodeName.toLowerCase() === 'html' ? null : getParent(element);
|
|
|
}
|
|
|
for (parent = getParent(element); parent && parent !== body && parent.nodeType !== 9; parent = getParent(parent)) {
|
|
|
positionStyle = utils.css(parent, 'position');
|
|
|
if (positionStyle !== 'static') {
|
|
|
return parent;
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
var getParent$1 = utils.getParent;
|
|
|
function isAncestorFixed(element) {
|
|
|
if (utils.isWindow(element) || element.nodeType === 9) {
|
|
|
return false;
|
|
|
}
|
|
|
var doc = utils.getDocument(element);
|
|
|
var body = doc.body;
|
|
|
var parent = null;
|
|
|
for (parent = getParent$1(element);
|
|
|
// 修复元素位于 document.documentElement 下导致崩溃问题
|
|
|
parent && parent !== body && parent !== doc; parent = getParent$1(parent)) {
|
|
|
var positionStyle = utils.css(parent, 'position');
|
|
|
if (positionStyle === 'fixed') {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得元素的显示部分的区域
|
|
|
*/
|
|
|
function getVisibleRectForElement(element, alwaysByViewport) {
|
|
|
var visibleRect = {
|
|
|
left: 0,
|
|
|
right: Infinity,
|
|
|
top: 0,
|
|
|
bottom: Infinity
|
|
|
};
|
|
|
var el = getOffsetParent(element);
|
|
|
var doc = utils.getDocument(element);
|
|
|
var win = doc.defaultView || doc.parentWindow;
|
|
|
var body = doc.body;
|
|
|
var documentElement = doc.documentElement;
|
|
|
|
|
|
// Determine the size of the visible rect by climbing the dom accounting for
|
|
|
// all scrollable containers.
|
|
|
while (el) {
|
|
|
// clientWidth is zero for inline block elements in ie.
|
|
|
if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
|
|
|
// body may have overflow set on it, yet we still get the entire
|
|
|
// viewport. In some browsers, el.offsetParent may be
|
|
|
// document.documentElement, so check for that too.
|
|
|
el !== body && el !== documentElement && utils.css(el, 'overflow') !== 'visible') {
|
|
|
var pos = utils.offset(el);
|
|
|
// add border
|
|
|
pos.left += el.clientLeft;
|
|
|
pos.top += el.clientTop;
|
|
|
visibleRect.top = Math.max(visibleRect.top, pos.top);
|
|
|
visibleRect.right = Math.min(visibleRect.right,
|
|
|
// consider area without scrollBar
|
|
|
pos.left + el.clientWidth);
|
|
|
visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
|
|
|
visibleRect.left = Math.max(visibleRect.left, pos.left);
|
|
|
} else if (el === body || el === documentElement) {
|
|
|
break;
|
|
|
}
|
|
|
el = getOffsetParent(el);
|
|
|
}
|
|
|
|
|
|
// Set element position to fixed
|
|
|
// make sure absolute element itself don't affect it's visible area
|
|
|
// https://github.com/ant-design/ant-design/issues/7601
|
|
|
var originalPosition = null;
|
|
|
if (!utils.isWindow(element) && element.nodeType !== 9) {
|
|
|
originalPosition = element.style.position;
|
|
|
var position = utils.css(element, 'position');
|
|
|
if (position === 'absolute') {
|
|
|
element.style.position = 'fixed';
|
|
|
}
|
|
|
}
|
|
|
var scrollX = utils.getWindowScrollLeft(win);
|
|
|
var scrollY = utils.getWindowScrollTop(win);
|
|
|
var viewportWidth = utils.viewportWidth(win);
|
|
|
var viewportHeight = utils.viewportHeight(win);
|
|
|
var documentWidth = documentElement.scrollWidth;
|
|
|
var documentHeight = documentElement.scrollHeight;
|
|
|
|
|
|
// scrollXXX on html is sync with body which means overflow: hidden on body gets wrong scrollXXX.
|
|
|
// We should cut this ourself.
|
|
|
var bodyStyle = window.getComputedStyle(body);
|
|
|
if (bodyStyle.overflowX === 'hidden') {
|
|
|
documentWidth = win.innerWidth;
|
|
|
}
|
|
|
if (bodyStyle.overflowY === 'hidden') {
|
|
|
documentHeight = win.innerHeight;
|
|
|
}
|
|
|
|
|
|
// Reset element position after calculate the visible area
|
|
|
if (element.style) {
|
|
|
element.style.position = originalPosition;
|
|
|
}
|
|
|
if (alwaysByViewport || isAncestorFixed(element)) {
|
|
|
// Clip by viewport's size.
|
|
|
visibleRect.left = Math.max(visibleRect.left, scrollX);
|
|
|
visibleRect.top = Math.max(visibleRect.top, scrollY);
|
|
|
visibleRect.right = Math.min(visibleRect.right, scrollX + viewportWidth);
|
|
|
visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + viewportHeight);
|
|
|
} else {
|
|
|
// Clip by document's size.
|
|
|
var maxVisibleWidth = Math.max(documentWidth, scrollX + viewportWidth);
|
|
|
visibleRect.right = Math.min(visibleRect.right, maxVisibleWidth);
|
|
|
var maxVisibleHeight = Math.max(documentHeight, scrollY + viewportHeight);
|
|
|
visibleRect.bottom = Math.min(visibleRect.bottom, maxVisibleHeight);
|
|
|
}
|
|
|
return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
|
|
|
}
|
|
|
|
|
|
function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
|
|
|
var pos = utils.clone(elFuturePos);
|
|
|
var size = {
|
|
|
width: elRegion.width,
|
|
|
height: elRegion.height
|
|
|
};
|
|
|
if (overflow.adjustX && pos.left < visibleRect.left) {
|
|
|
pos.left = visibleRect.left;
|
|
|
}
|
|
|
|
|
|
// Left edge inside and right edge outside viewport, try to resize it.
|
|
|
if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
|
|
|
size.width -= pos.left + size.width - visibleRect.right;
|
|
|
}
|
|
|
|
|
|
// Right edge outside viewport, try to move it.
|
|
|
if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
|
|
|
// 保证左边界和可视区域左边界对齐
|
|
|
pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
|
|
|
}
|
|
|
|
|
|
// Top edge outside viewport, try to move it.
|
|
|
if (overflow.adjustY && pos.top < visibleRect.top) {
|
|
|
pos.top = visibleRect.top;
|
|
|
}
|
|
|
|
|
|
// Top edge inside and bottom edge outside viewport, try to resize it.
|
|
|
if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
|
|
|
size.height -= pos.top + size.height - visibleRect.bottom;
|
|
|
}
|
|
|
|
|
|
// Bottom edge outside viewport, try to move it.
|
|
|
if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
|
|
|
// 保证上边界和可视区域上边界对齐
|
|
|
pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
|
|
|
}
|
|
|
return utils.mix(pos, size);
|
|
|
}
|
|
|
|
|
|
function getRegion(node) {
|
|
|
var offset;
|
|
|
var w;
|
|
|
var h;
|
|
|
if (!utils.isWindow(node) && node.nodeType !== 9) {
|
|
|
offset = utils.offset(node);
|
|
|
w = utils.outerWidth(node);
|
|
|
h = utils.outerHeight(node);
|
|
|
} else {
|
|
|
var win = utils.getWindow(node);
|
|
|
offset = {
|
|
|
left: utils.getWindowScrollLeft(win),
|
|
|
top: utils.getWindowScrollTop(win)
|
|
|
};
|
|
|
w = utils.viewportWidth(win);
|
|
|
h = utils.viewportHeight(win);
|
|
|
}
|
|
|
offset.width = w;
|
|
|
offset.height = h;
|
|
|
return offset;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取 node 上的 align 对齐点 相对于页面的坐标
|
|
|
*/
|
|
|
|
|
|
function getAlignOffset(region, align) {
|
|
|
var V = align.charAt(0);
|
|
|
var H = align.charAt(1);
|
|
|
var w = region.width;
|
|
|
var h = region.height;
|
|
|
var x = region.left;
|
|
|
var y = region.top;
|
|
|
if (V === 'c') {
|
|
|
y += h / 2;
|
|
|
} else if (V === 'b') {
|
|
|
y += h;
|
|
|
}
|
|
|
if (H === 'c') {
|
|
|
x += w / 2;
|
|
|
} else if (H === 'r') {
|
|
|
x += w;
|
|
|
}
|
|
|
return {
|
|
|
left: x,
|
|
|
top: y
|
|
|
};
|
|
|
}
|
|
|
|
|
|
function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
|
|
|
var p1 = getAlignOffset(refNodeRegion, points[1]);
|
|
|
var p2 = getAlignOffset(elRegion, points[0]);
|
|
|
var diff = [p2.left - p1.left, p2.top - p1.top];
|
|
|
return {
|
|
|
left: Math.round(elRegion.left - diff[0] + offset[0] - targetOffset[0]),
|
|
|
top: Math.round(elRegion.top - diff[1] + offset[1] - targetOffset[1])
|
|
|
};
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* align dom node flexibly
|
|
|
* @author yiminghe@gmail.com
|
|
|
*/
|
|
|
|
|
|
// http://yiminghe.iteye.com/blog/1124720
|
|
|
|
|
|
function isFailX(elFuturePos, elRegion, visibleRect) {
|
|
|
return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
|
|
|
}
|
|
|
function isFailY(elFuturePos, elRegion, visibleRect) {
|
|
|
return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
|
|
|
}
|
|
|
function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
|
|
|
return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
|
|
|
}
|
|
|
function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
|
|
|
return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
|
|
|
}
|
|
|
function flip(points, reg, map) {
|
|
|
var ret = [];
|
|
|
utils.each(points, function (p) {
|
|
|
ret.push(p.replace(reg, function (m) {
|
|
|
return map[m];
|
|
|
}));
|
|
|
});
|
|
|
return ret;
|
|
|
}
|
|
|
function flipOffset(offset, index) {
|
|
|
offset[index] = -offset[index];
|
|
|
return offset;
|
|
|
}
|
|
|
function convertOffset(str, offsetLen) {
|
|
|
var n;
|
|
|
if (/%$/.test(str)) {
|
|
|
n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
|
|
|
} else {
|
|
|
n = parseInt(str, 10);
|
|
|
}
|
|
|
return n || 0;
|
|
|
}
|
|
|
function normalizeOffset(offset, el) {
|
|
|
offset[0] = convertOffset(offset[0], el.width);
|
|
|
offset[1] = convertOffset(offset[1], el.height);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param el
|
|
|
* @param tgtRegion 参照节点所占的区域: { left, top, width, height }
|
|
|
* @param align
|
|
|
*/
|
|
|
function doAlign(el, tgtRegion, align, isTgtRegionVisible) {
|
|
|
var points = align.points;
|
|
|
var offset = align.offset || [0, 0];
|
|
|
var targetOffset = align.targetOffset || [0, 0];
|
|
|
var overflow = align.overflow;
|
|
|
var source = align.source || el;
|
|
|
offset = [].concat(offset);
|
|
|
targetOffset = [].concat(targetOffset);
|
|
|
overflow = overflow || {};
|
|
|
var newOverflowCfg = {};
|
|
|
var fail = 0;
|
|
|
var alwaysByViewport = !!(overflow && overflow.alwaysByViewport);
|
|
|
// 当前节点可以被放置的显示区域
|
|
|
var visibleRect = getVisibleRectForElement(source, alwaysByViewport);
|
|
|
// 当前节点所占的区域, left/top/width/height
|
|
|
var elRegion = getRegion(source);
|
|
|
// 将 offset 转换成数值,支持百分比
|
|
|
normalizeOffset(offset, elRegion);
|
|
|
normalizeOffset(targetOffset, tgtRegion);
|
|
|
// 当前节点将要被放置的位置
|
|
|
var elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset, targetOffset);
|
|
|
// 当前节点将要所处的区域
|
|
|
var newElRegion = utils.merge(elRegion, elFuturePos);
|
|
|
|
|
|
// 如果可视区域不能完全放置当前节点时允许调整
|
|
|
if (visibleRect && (overflow.adjustX || overflow.adjustY) && isTgtRegionVisible) {
|
|
|
if (overflow.adjustX) {
|
|
|
// 如果横向不能放下
|
|
|
if (isFailX(elFuturePos, elRegion, visibleRect)) {
|
|
|
// 对齐位置反下
|
|
|
var newPoints = flip(points, /[lr]/gi, {
|
|
|
l: 'r',
|
|
|
r: 'l'
|
|
|
});
|
|
|
// 偏移量也反下
|
|
|
var newOffset = flipOffset(offset, 0);
|
|
|
var newTargetOffset = flipOffset(targetOffset, 0);
|
|
|
var newElFuturePos = getElFuturePos(elRegion, tgtRegion, newPoints, newOffset, newTargetOffset);
|
|
|
if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
|
|
|
fail = 1;
|
|
|
points = newPoints;
|
|
|
offset = newOffset;
|
|
|
targetOffset = newTargetOffset;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (overflow.adjustY) {
|
|
|
// 如果纵向不能放下
|
|
|
if (isFailY(elFuturePos, elRegion, visibleRect)) {
|
|
|
// 对齐位置反下
|
|
|
var _newPoints = flip(points, /[tb]/gi, {
|
|
|
t: 'b',
|
|
|
b: 't'
|
|
|
});
|
|
|
// 偏移量也反下
|
|
|
var _newOffset = flipOffset(offset, 1);
|
|
|
var _newTargetOffset = flipOffset(targetOffset, 1);
|
|
|
var _newElFuturePos = getElFuturePos(elRegion, tgtRegion, _newPoints, _newOffset, _newTargetOffset);
|
|
|
if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
|
|
|
fail = 1;
|
|
|
points = _newPoints;
|
|
|
offset = _newOffset;
|
|
|
targetOffset = _newTargetOffset;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 如果失败,重新计算当前节点将要被放置的位置
|
|
|
if (fail) {
|
|
|
elFuturePos = getElFuturePos(elRegion, tgtRegion, points, offset, targetOffset);
|
|
|
utils.mix(newElRegion, elFuturePos);
|
|
|
}
|
|
|
var isStillFailX = isFailX(elFuturePos, elRegion, visibleRect);
|
|
|
var isStillFailY = isFailY(elFuturePos, elRegion, visibleRect);
|
|
|
// 检查反下后的位置是否可以放下了,如果仍然放不下:
|
|
|
// 1. 复原修改过的定位参数
|
|
|
if (isStillFailX || isStillFailY) {
|
|
|
var _newPoints2 = points;
|
|
|
|
|
|
// 重置对应部分的翻转逻辑
|
|
|
if (isStillFailX) {
|
|
|
_newPoints2 = flip(points, /[lr]/gi, {
|
|
|
l: 'r',
|
|
|
r: 'l'
|
|
|
});
|
|
|
}
|
|
|
if (isStillFailY) {
|
|
|
_newPoints2 = flip(points, /[tb]/gi, {
|
|
|
t: 'b',
|
|
|
b: 't'
|
|
|
});
|
|
|
}
|
|
|
points = _newPoints2;
|
|
|
offset = align.offset || [0, 0];
|
|
|
targetOffset = align.targetOffset || [0, 0];
|
|
|
}
|
|
|
// 2. 只有指定了可以调整当前方向才调整
|
|
|
newOverflowCfg.adjustX = overflow.adjustX && isStillFailX;
|
|
|
newOverflowCfg.adjustY = overflow.adjustY && isStillFailY;
|
|
|
|
|
|
// 确实要调整,甚至可能会调整高度宽度
|
|
|
if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) {
|
|
|
newElRegion = adjustForViewport(elFuturePos, elRegion, visibleRect, newOverflowCfg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// need judge to in case set fixed with in css on height auto element
|
|
|
if (newElRegion.width !== elRegion.width) {
|
|
|
utils.css(source, 'width', utils.width(source) + newElRegion.width - elRegion.width);
|
|
|
}
|
|
|
if (newElRegion.height !== elRegion.height) {
|
|
|
utils.css(source, 'height', utils.height(source) + newElRegion.height - elRegion.height);
|
|
|
}
|
|
|
|
|
|
// https://github.com/kissyteam/kissy/issues/190
|
|
|
// 相对于屏幕位置没变,而 left/top 变了
|
|
|
// 例如 <div 'relative'><el absolute></div>
|
|
|
utils.offset(source, {
|
|
|
left: newElRegion.left,
|
|
|
top: newElRegion.top
|
|
|
}, {
|
|
|
useCssRight: align.useCssRight,
|
|
|
useCssBottom: align.useCssBottom,
|
|
|
useCssTransform: align.useCssTransform,
|
|
|
ignoreShake: align.ignoreShake
|
|
|
});
|
|
|
return {
|
|
|
points: points,
|
|
|
offset: offset,
|
|
|
targetOffset: targetOffset,
|
|
|
overflow: newOverflowCfg
|
|
|
};
|
|
|
}
|
|
|
/**
|
|
|
* 2012-04-26 yiminghe@gmail.com
|
|
|
* - 优化智能对齐算法
|
|
|
* - 慎用 resizeXX
|
|
|
*
|
|
|
* 2011-07-13 yiminghe@gmail.com note:
|
|
|
* - 增加智能对齐,以及大小调整选项
|
|
|
**/
|
|
|
|
|
|
function isOutOfVisibleRect(target, alwaysByViewport) {
|
|
|
var visibleRect = getVisibleRectForElement(target, alwaysByViewport);
|
|
|
var targetRegion = getRegion(target);
|
|
|
return !visibleRect || targetRegion.left + targetRegion.width <= visibleRect.left || targetRegion.top + targetRegion.height <= visibleRect.top || targetRegion.left >= visibleRect.right || targetRegion.top >= visibleRect.bottom;
|
|
|
}
|
|
|
function alignElement(el, refNode, align) {
|
|
|
var target = align.target || refNode;
|
|
|
var refNodeRegion = getRegion(target);
|
|
|
var isTargetNotOutOfVisible = !isOutOfVisibleRect(target, align.overflow && align.overflow.alwaysByViewport);
|
|
|
return doAlign(el, refNodeRegion, align, isTargetNotOutOfVisible);
|
|
|
}
|
|
|
alignElement.__getOffsetParent = getOffsetParent;
|
|
|
alignElement.__getVisibleRectForElement = getVisibleRectForElement;
|
|
|
|
|
|
/**
|
|
|
* `tgtPoint`: { pageX, pageY } or { clientX, clientY }.
|
|
|
* If client position provided, will internal convert to page position.
|
|
|
*/
|
|
|
|
|
|
function alignPoint(el, tgtPoint, align) {
|
|
|
var pageX;
|
|
|
var pageY;
|
|
|
var doc = utils.getDocument(el);
|
|
|
var win = doc.defaultView || doc.parentWindow;
|
|
|
var scrollX = utils.getWindowScrollLeft(win);
|
|
|
var scrollY = utils.getWindowScrollTop(win);
|
|
|
var viewportWidth = utils.viewportWidth(win);
|
|
|
var viewportHeight = utils.viewportHeight(win);
|
|
|
if ('pageX' in tgtPoint) {
|
|
|
pageX = tgtPoint.pageX;
|
|
|
} else {
|
|
|
pageX = scrollX + tgtPoint.clientX;
|
|
|
}
|
|
|
if ('pageY' in tgtPoint) {
|
|
|
pageY = tgtPoint.pageY;
|
|
|
} else {
|
|
|
pageY = scrollY + tgtPoint.clientY;
|
|
|
}
|
|
|
var tgtRegion = {
|
|
|
left: pageX,
|
|
|
top: pageY,
|
|
|
width: 0,
|
|
|
height: 0
|
|
|
};
|
|
|
var pointInView = pageX >= 0 && pageX <= scrollX + viewportWidth && pageY >= 0 && pageY <= scrollY + viewportHeight;
|
|
|
|
|
|
// Provide default target point
|
|
|
var points = [align.points[0], 'cc'];
|
|
|
return doAlign(el, tgtRegion, _objectSpread2(_objectSpread2({}, align), {}, {
|
|
|
points: points
|
|
|
}), pointInView);
|
|
|
}
|
|
|
|
|
|
/* harmony default export */ var dist_web = ((/* unused pure expression or super */ null && (alignElement)));
|
|
|
|
|
|
//# sourceMappingURL=index.js.map
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/isEqual.js
|
|
|
var isEqual = __webpack_require__(91881);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/Dom/isVisible.js
|
|
|
var isVisible = __webpack_require__(5110);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useLayoutEffect.js
|
|
|
var useLayoutEffect = __webpack_require__(8410);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-align/es/hooks/useBuffer.js
|
|
|
|
|
|
/* harmony default export */ var useBuffer = (function (callback, buffer) {
|
|
|
var calledRef = react.useRef(false);
|
|
|
var timeoutRef = react.useRef(null);
|
|
|
|
|
|
function cancelTrigger() {
|
|
|
window.clearTimeout(timeoutRef.current);
|
|
|
}
|
|
|
|
|
|
function trigger(force) {
|
|
|
cancelTrigger();
|
|
|
|
|
|
if (!calledRef.current || force === true) {
|
|
|
if (callback(force) === false) {
|
|
|
// Not delay since callback cancelled self
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
calledRef.current = true;
|
|
|
timeoutRef.current = window.setTimeout(function () {
|
|
|
calledRef.current = false;
|
|
|
}, buffer);
|
|
|
} else {
|
|
|
timeoutRef.current = window.setTimeout(function () {
|
|
|
calledRef.current = false;
|
|
|
trigger();
|
|
|
}, buffer);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return [trigger, function () {
|
|
|
calledRef.current = false;
|
|
|
cancelTrigger();
|
|
|
}];
|
|
|
});
|
|
|
// EXTERNAL MODULE: ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js
|
|
|
var ResizeObserver_es = __webpack_require__(91033);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-align/es/util.js
|
|
|
|
|
|
|
|
|
|
|
|
function isSamePoint(prev, next) {
|
|
|
if (prev === next) return true;
|
|
|
if (!prev || !next) return false;
|
|
|
|
|
|
if ('pageX' in next && 'pageY' in next) {
|
|
|
return prev.pageX === next.pageX && prev.pageY === next.pageY;
|
|
|
}
|
|
|
|
|
|
if ('clientX' in next && 'clientY' in next) {
|
|
|
return prev.clientX === next.clientX && prev.clientY === next.clientY;
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
function restoreFocus(activeElement, container) {
|
|
|
// Focus back if is in the container
|
|
|
if (activeElement !== document.activeElement && (0,contains/* default */.Z)(container, activeElement) && typeof activeElement.focus === 'function') {
|
|
|
activeElement.focus();
|
|
|
}
|
|
|
}
|
|
|
function monitorResize(element, callback) {
|
|
|
var prevWidth = null;
|
|
|
var prevHeight = null;
|
|
|
|
|
|
function onResize(_ref) {
|
|
|
var _ref2 = (0,slicedToArray/* default */.Z)(_ref, 1),
|
|
|
target = _ref2[0].target;
|
|
|
|
|
|
if (!document.documentElement.contains(target)) return;
|
|
|
|
|
|
var _target$getBoundingCl = target.getBoundingClientRect(),
|
|
|
width = _target$getBoundingCl.width,
|
|
|
height = _target$getBoundingCl.height;
|
|
|
|
|
|
var fixedWidth = Math.floor(width);
|
|
|
var fixedHeight = Math.floor(height);
|
|
|
|
|
|
if (prevWidth !== fixedWidth || prevHeight !== fixedHeight) {
|
|
|
// https://webkit.org/blog/9997/resizeobserver-in-webkit/
|
|
|
Promise.resolve().then(function () {
|
|
|
callback({
|
|
|
width: fixedWidth,
|
|
|
height: fixedHeight
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
prevWidth = fixedWidth;
|
|
|
prevHeight = fixedHeight;
|
|
|
}
|
|
|
|
|
|
var resizeObserver = new ResizeObserver_es/* default */.Z(onResize);
|
|
|
|
|
|
if (element) {
|
|
|
resizeObserver.observe(element);
|
|
|
}
|
|
|
|
|
|
return function () {
|
|
|
resizeObserver.disconnect();
|
|
|
};
|
|
|
}
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-align/es/Align.js
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Removed props:
|
|
|
* - childrenProps
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getElement(func) {
|
|
|
if (typeof func !== 'function') return null;
|
|
|
return func();
|
|
|
}
|
|
|
|
|
|
function getPoint(point) {
|
|
|
if ((0,esm_typeof/* default */.Z)(point) !== 'object' || !point) return null;
|
|
|
return point;
|
|
|
}
|
|
|
|
|
|
var Align = function Align(_ref, ref) {
|
|
|
var children = _ref.children,
|
|
|
disabled = _ref.disabled,
|
|
|
target = _ref.target,
|
|
|
align = _ref.align,
|
|
|
onAlign = _ref.onAlign,
|
|
|
monitorWindowResize = _ref.monitorWindowResize,
|
|
|
_ref$monitorBufferTim = _ref.monitorBufferTime,
|
|
|
monitorBufferTime = _ref$monitorBufferTim === void 0 ? 0 : _ref$monitorBufferTim;
|
|
|
var cacheRef = react.useRef({});
|
|
|
/** Popup node ref */
|
|
|
|
|
|
var nodeRef = react.useRef();
|
|
|
var childNode = react.Children.only(children); // ===================== Align ======================
|
|
|
// We save the props here to avoid closure makes props ood
|
|
|
|
|
|
var forceAlignPropsRef = react.useRef({});
|
|
|
forceAlignPropsRef.current.disabled = disabled;
|
|
|
forceAlignPropsRef.current.target = target;
|
|
|
forceAlignPropsRef.current.align = align;
|
|
|
forceAlignPropsRef.current.onAlign = onAlign;
|
|
|
|
|
|
var _useBuffer = useBuffer(function () {
|
|
|
var _forceAlignPropsRef$c = forceAlignPropsRef.current,
|
|
|
latestDisabled = _forceAlignPropsRef$c.disabled,
|
|
|
latestTarget = _forceAlignPropsRef$c.target,
|
|
|
latestAlign = _forceAlignPropsRef$c.align,
|
|
|
latestOnAlign = _forceAlignPropsRef$c.onAlign;
|
|
|
var source = nodeRef.current;
|
|
|
|
|
|
if (!latestDisabled && latestTarget && source) {
|
|
|
var _result;
|
|
|
|
|
|
var _element = getElement(latestTarget);
|
|
|
|
|
|
var _point = getPoint(latestTarget);
|
|
|
|
|
|
cacheRef.current.element = _element;
|
|
|
cacheRef.current.point = _point;
|
|
|
cacheRef.current.align = latestAlign; // IE lose focus after element realign
|
|
|
// We should record activeElement and restore later
|
|
|
|
|
|
var _document = document,
|
|
|
activeElement = _document.activeElement; // We only align when element is visible
|
|
|
|
|
|
if (_element && (0,isVisible/* default */.Z)(_element)) {
|
|
|
_result = alignElement(source, _element, latestAlign);
|
|
|
} else if (_point) {
|
|
|
_result = alignPoint(source, _point, latestAlign);
|
|
|
}
|
|
|
|
|
|
restoreFocus(activeElement, source);
|
|
|
|
|
|
if (latestOnAlign && _result) {
|
|
|
latestOnAlign(source, _result);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}, monitorBufferTime),
|
|
|
_useBuffer2 = (0,slicedToArray/* default */.Z)(_useBuffer, 2),
|
|
|
_forceAlign = _useBuffer2[0],
|
|
|
cancelForceAlign = _useBuffer2[1]; // ===================== Effect =====================
|
|
|
// Handle props change
|
|
|
|
|
|
|
|
|
var _React$useState = react.useState(),
|
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
|
element = _React$useState2[0],
|
|
|
setElement = _React$useState2[1];
|
|
|
|
|
|
var _React$useState3 = react.useState(),
|
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
|
point = _React$useState4[0],
|
|
|
setPoint = _React$useState4[1];
|
|
|
|
|
|
(0,useLayoutEffect/* default */.Z)(function () {
|
|
|
setElement(getElement(target));
|
|
|
setPoint(getPoint(target));
|
|
|
});
|
|
|
react.useEffect(function () {
|
|
|
if (cacheRef.current.element !== element || !isSamePoint(cacheRef.current.point, point) || !(0,isEqual/* default */.Z)(cacheRef.current.align, align)) {
|
|
|
_forceAlign();
|
|
|
}
|
|
|
}); // Watch popup element resize
|
|
|
|
|
|
react.useEffect(function () {
|
|
|
var cancelFn = monitorResize(nodeRef.current, _forceAlign);
|
|
|
return cancelFn;
|
|
|
}, [nodeRef.current]); // Watch target element resize
|
|
|
|
|
|
react.useEffect(function () {
|
|
|
var cancelFn = monitorResize(element, _forceAlign);
|
|
|
return cancelFn;
|
|
|
}, [element]); // Listen for disabled change
|
|
|
|
|
|
react.useEffect(function () {
|
|
|
if (!disabled) {
|
|
|
_forceAlign();
|
|
|
} else {
|
|
|
cancelForceAlign();
|
|
|
}
|
|
|
}, [disabled]); // Listen for window resize
|
|
|
|
|
|
react.useEffect(function () {
|
|
|
if (monitorWindowResize) {
|
|
|
var cancelFn = (0,addEventListener/* default */.Z)(window, 'resize', _forceAlign);
|
|
|
return cancelFn.remove;
|
|
|
}
|
|
|
}, [monitorWindowResize]); // Clear all if unmount
|
|
|
|
|
|
react.useEffect(function () {
|
|
|
return function () {
|
|
|
cancelForceAlign();
|
|
|
};
|
|
|
}, []); // ====================== Ref =======================
|
|
|
|
|
|
react.useImperativeHandle(ref, function () {
|
|
|
return {
|
|
|
forceAlign: function forceAlign() {
|
|
|
return _forceAlign(true);
|
|
|
}
|
|
|
};
|
|
|
}); // ===================== Render =====================
|
|
|
|
|
|
if ( /*#__PURE__*/react.isValidElement(childNode)) {
|
|
|
childNode = /*#__PURE__*/react.cloneElement(childNode, {
|
|
|
ref: (0,es_ref/* composeRef */.sQ)(childNode.ref, nodeRef)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return childNode;
|
|
|
};
|
|
|
|
|
|
var RcAlign = /*#__PURE__*/react.forwardRef(Align);
|
|
|
RcAlign.displayName = 'Align';
|
|
|
/* harmony default export */ var es_Align = (RcAlign);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-align/es/index.js
|
|
|
// export this package's api
|
|
|
|
|
|
/* harmony default export */ var rc_align_es = (es_Align);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js
|
|
|
var regeneratorRuntime = __webpack_require__(74165);
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
|
|
|
var asyncToGenerator = __webpack_require__(15861);
|
|
|
// EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useState.js
|
|
|
var useState = __webpack_require__(30470);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/Popup/useVisibleStatus.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Popup should follow the steps for each component work correctly:
|
|
|
* measure - check for the current stretch size
|
|
|
* align - let component align the position
|
|
|
* aligned - re-align again in case additional className changed the size
|
|
|
* afterAlign - choice next step is trigger motion or finished
|
|
|
* beforeMotion - should reset motion to invisible so that CSSMotion can do normal motion
|
|
|
* motion - play the motion
|
|
|
* stable - everything is done
|
|
|
*/
|
|
|
|
|
|
var StatusQueue = ['measure', 'alignPre', 'align', null, 'motion'];
|
|
|
/* harmony default export */ var useVisibleStatus = (function (visible, doMeasure) {
|
|
|
var _useState = (0,useState/* default */.Z)(null),
|
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
|
status = _useState2[0],
|
|
|
setInternalStatus = _useState2[1];
|
|
|
|
|
|
var rafRef = (0,react.useRef)();
|
|
|
|
|
|
function setStatus(nextStatus) {
|
|
|
setInternalStatus(nextStatus, true);
|
|
|
}
|
|
|
|
|
|
function cancelRaf() {
|
|
|
raf/* default.cancel */.Z.cancel(rafRef.current);
|
|
|
}
|
|
|
|
|
|
function goNextStatus(callback) {
|
|
|
cancelRaf();
|
|
|
rafRef.current = (0,raf/* default */.Z)(function () {
|
|
|
// Only align should be manually trigger
|
|
|
setStatus(function (prev) {
|
|
|
switch (status) {
|
|
|
case 'align':
|
|
|
return 'motion';
|
|
|
|
|
|
case 'motion':
|
|
|
return 'stable';
|
|
|
|
|
|
default:
|
|
|
}
|
|
|
|
|
|
return prev;
|
|
|
});
|
|
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
|
});
|
|
|
} // Init status
|
|
|
|
|
|
|
|
|
(0,react.useEffect)(function () {
|
|
|
setStatus('measure');
|
|
|
}, [visible]); // Go next status
|
|
|
|
|
|
(0,react.useEffect)(function () {
|
|
|
switch (status) {
|
|
|
case 'measure':
|
|
|
doMeasure();
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
}
|
|
|
|
|
|
if (status) {
|
|
|
rafRef.current = (0,raf/* default */.Z)( /*#__PURE__*/(0,asyncToGenerator/* default */.Z)( /*#__PURE__*/(0,regeneratorRuntime/* default */.Z)().mark(function _callee() {
|
|
|
var index, nextStatus;
|
|
|
return (0,regeneratorRuntime/* default */.Z)().wrap(function _callee$(_context) {
|
|
|
while (1) {
|
|
|
switch (_context.prev = _context.next) {
|
|
|
case 0:
|
|
|
index = StatusQueue.indexOf(status);
|
|
|
nextStatus = StatusQueue[index + 1];
|
|
|
|
|
|
if (nextStatus && index !== -1) {
|
|
|
setStatus(nextStatus);
|
|
|
}
|
|
|
|
|
|
case 3:
|
|
|
case "end":
|
|
|
return _context.stop();
|
|
|
}
|
|
|
}
|
|
|
}, _callee);
|
|
|
})));
|
|
|
}
|
|
|
}, [status]);
|
|
|
(0,react.useEffect)(function () {
|
|
|
return function () {
|
|
|
cancelRaf();
|
|
|
};
|
|
|
}, []);
|
|
|
return [status, goNextStatus];
|
|
|
});
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/Popup/useStretchStyle.js
|
|
|
|
|
|
|
|
|
/* harmony default export */ var useStretchStyle = (function (stretch) {
|
|
|
var _React$useState = react.useState({
|
|
|
width: 0,
|
|
|
height: 0
|
|
|
}),
|
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
|
targetSize = _React$useState2[0],
|
|
|
setTargetSize = _React$useState2[1];
|
|
|
|
|
|
function measureStretch(element) {
|
|
|
var tgtWidth = element.offsetWidth,
|
|
|
tgtHeight = element.offsetHeight;
|
|
|
|
|
|
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
|
width = _element$getBoundingC.width,
|
|
|
height = _element$getBoundingC.height; // Rect is more accurate than offset, use if near
|
|
|
|
|
|
|
|
|
if (Math.abs(tgtWidth - width) < 1 && Math.abs(tgtHeight - height) < 1) {
|
|
|
tgtWidth = width;
|
|
|
tgtHeight = height;
|
|
|
}
|
|
|
|
|
|
setTargetSize({
|
|
|
width: tgtWidth,
|
|
|
height: tgtHeight
|
|
|
});
|
|
|
} // Merge stretch style
|
|
|
|
|
|
|
|
|
var style = react.useMemo(function () {
|
|
|
var sizeStyle = {};
|
|
|
|
|
|
if (stretch) {
|
|
|
var width = targetSize.width,
|
|
|
height = targetSize.height; // Stretch with target
|
|
|
|
|
|
if (stretch.indexOf('height') !== -1 && height) {
|
|
|
sizeStyle.height = height;
|
|
|
} else if (stretch.indexOf('minHeight') !== -1 && height) {
|
|
|
sizeStyle.minHeight = height;
|
|
|
}
|
|
|
|
|
|
if (stretch.indexOf('width') !== -1 && width) {
|
|
|
sizeStyle.width = width;
|
|
|
} else if (stretch.indexOf('minWidth') !== -1 && width) {
|
|
|
sizeStyle.minWidth = width;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return sizeStyle;
|
|
|
}, [stretch, targetSize]);
|
|
|
return [style, measureStretch];
|
|
|
});
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/Popup/PopupInner.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var PopupInner = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
|
var visible = props.visible,
|
|
|
prefixCls = props.prefixCls,
|
|
|
className = props.className,
|
|
|
style = props.style,
|
|
|
children = props.children,
|
|
|
zIndex = props.zIndex,
|
|
|
stretch = props.stretch,
|
|
|
destroyPopupOnHide = props.destroyPopupOnHide,
|
|
|
forceRender = props.forceRender,
|
|
|
align = props.align,
|
|
|
point = props.point,
|
|
|
getRootDomNode = props.getRootDomNode,
|
|
|
getClassNameFromAlign = props.getClassNameFromAlign,
|
|
|
onAlign = props.onAlign,
|
|
|
onMouseEnter = props.onMouseEnter,
|
|
|
onMouseLeave = props.onMouseLeave,
|
|
|
onMouseDown = props.onMouseDown,
|
|
|
onTouchStart = props.onTouchStart,
|
|
|
onClick = props.onClick;
|
|
|
var alignRef = (0,react.useRef)();
|
|
|
var elementRef = (0,react.useRef)();
|
|
|
|
|
|
var _useState = (0,react.useState)(),
|
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
|
alignedClassName = _useState2[0],
|
|
|
setAlignedClassName = _useState2[1]; // ======================= Measure ========================
|
|
|
|
|
|
|
|
|
var _useStretchStyle = useStretchStyle(stretch),
|
|
|
_useStretchStyle2 = (0,slicedToArray/* default */.Z)(_useStretchStyle, 2),
|
|
|
stretchStyle = _useStretchStyle2[0],
|
|
|
measureStretchStyle = _useStretchStyle2[1];
|
|
|
|
|
|
function doMeasure() {
|
|
|
if (stretch) {
|
|
|
measureStretchStyle(getRootDomNode());
|
|
|
}
|
|
|
} // ======================== Status ========================
|
|
|
|
|
|
|
|
|
var _useVisibleStatus = useVisibleStatus(visible, doMeasure),
|
|
|
_useVisibleStatus2 = (0,slicedToArray/* default */.Z)(_useVisibleStatus, 2),
|
|
|
status = _useVisibleStatus2[0],
|
|
|
goNextStatus = _useVisibleStatus2[1]; // ======================== Aligns ========================
|
|
|
|
|
|
/**
|
|
|
* `alignedClassName` may modify `source` size,
|
|
|
* which means one time align may not move to the correct position at once.
|
|
|
*
|
|
|
* We will reset `alignTimes` for each status switch to `alignPre`
|
|
|
* and let `rc-align` to align for multiple times to ensure get final stable place.
|
|
|
* Currently we mark `alignTimes < 2` repeat align, it will increase if user report for align issue.
|
|
|
*
|
|
|
* Update:
|
|
|
* In React 18. `rc-align` effect of align may faster than ref called trigger `forceAlign`.
|
|
|
* We adjust this to `alignTimes < 2`.
|
|
|
* We need refactor `rc-align` to support mark of `forceAlign` call if this still happen.
|
|
|
*/
|
|
|
|
|
|
|
|
|
var _useState3 = (0,react.useState)(0),
|
|
|
_useState4 = (0,slicedToArray/* default */.Z)(_useState3, 2),
|
|
|
alignTimes = _useState4[0],
|
|
|
setAlignTimes = _useState4[1];
|
|
|
|
|
|
var prepareResolveRef = (0,react.useRef)();
|
|
|
(0,useLayoutEffect/* default */.Z)(function () {
|
|
|
if (status === 'alignPre') {
|
|
|
setAlignTimes(0);
|
|
|
}
|
|
|
}, [status]); // `target` on `rc-align` can accept as a function to get the bind element or a point.
|
|
|
// ref: https://www.npmjs.com/package/rc-align
|
|
|
|
|
|
function getAlignTarget() {
|
|
|
if (point) {
|
|
|
return point;
|
|
|
}
|
|
|
|
|
|
return getRootDomNode;
|
|
|
}
|
|
|
|
|
|
function forceAlign() {
|
|
|
var _alignRef$current;
|
|
|
|
|
|
(_alignRef$current = alignRef.current) === null || _alignRef$current === void 0 ? void 0 : _alignRef$current.forceAlign();
|
|
|
}
|
|
|
|
|
|
function onInternalAlign(popupDomNode, matchAlign) {
|
|
|
var nextAlignedClassName = getClassNameFromAlign(matchAlign);
|
|
|
|
|
|
if (alignedClassName !== nextAlignedClassName) {
|
|
|
setAlignedClassName(nextAlignedClassName);
|
|
|
} // We will retry multi times to make sure that the element has been align in the right position.
|
|
|
|
|
|
|
|
|
setAlignTimes(function (val) {
|
|
|
return val + 1;
|
|
|
});
|
|
|
|
|
|
if (status === 'align') {
|
|
|
onAlign === null || onAlign === void 0 ? void 0 : onAlign(popupDomNode, matchAlign);
|
|
|
}
|
|
|
} // Delay to go to next status
|
|
|
|
|
|
|
|
|
(0,useLayoutEffect/* default */.Z)(function () {
|
|
|
if (status === 'align') {
|
|
|
// Repeat until not more align needed
|
|
|
if (alignTimes < 3) {
|
|
|
forceAlign();
|
|
|
} else {
|
|
|
goNextStatus(function () {
|
|
|
var _prepareResolveRef$cu;
|
|
|
|
|
|
(_prepareResolveRef$cu = prepareResolveRef.current) === null || _prepareResolveRef$cu === void 0 ? void 0 : _prepareResolveRef$cu.call(prepareResolveRef);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}, [alignTimes]); // ======================== Motion ========================
|
|
|
|
|
|
var motion = (0,objectSpread2/* default */.Z)({}, getMotion(props));
|
|
|
|
|
|
['onAppearEnd', 'onEnterEnd', 'onLeaveEnd'].forEach(function (eventName) {
|
|
|
var originHandler = motion[eventName];
|
|
|
|
|
|
motion[eventName] = function (element, event) {
|
|
|
goNextStatus();
|
|
|
return originHandler === null || originHandler === void 0 ? void 0 : originHandler(element, event);
|
|
|
};
|
|
|
});
|
|
|
|
|
|
function onShowPrepare() {
|
|
|
return new Promise(function (resolve) {
|
|
|
prepareResolveRef.current = resolve;
|
|
|
});
|
|
|
} // Go to stable directly when motion not provided
|
|
|
|
|
|
|
|
|
react.useEffect(function () {
|
|
|
if (!motion.motionName && status === 'motion') {
|
|
|
goNextStatus();
|
|
|
}
|
|
|
}, [motion.motionName, status]); // ========================= Refs =========================
|
|
|
|
|
|
react.useImperativeHandle(ref, function () {
|
|
|
return {
|
|
|
forceAlign: forceAlign,
|
|
|
getElement: function getElement() {
|
|
|
return elementRef.current;
|
|
|
}
|
|
|
};
|
|
|
}); // ======================== Render ========================
|
|
|
|
|
|
var mergedStyle = (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, stretchStyle), {}, {
|
|
|
zIndex: zIndex,
|
|
|
opacity: status === 'motion' || status === 'stable' || !visible ? undefined : 0,
|
|
|
// Cannot interact with disappearing elements
|
|
|
// https://github.com/ant-design/ant-design/issues/35051#issuecomment-1101340714
|
|
|
pointerEvents: !visible && status !== 'stable' ? 'none' : undefined
|
|
|
}, style); // Align status
|
|
|
|
|
|
|
|
|
var alignDisabled = true;
|
|
|
|
|
|
if (align !== null && align !== void 0 && align.points && (status === 'align' || status === 'stable')) {
|
|
|
alignDisabled = false;
|
|
|
}
|
|
|
|
|
|
var childNode = children; // Wrapper when multiple children
|
|
|
|
|
|
if (react.Children.count(children) > 1) {
|
|
|
childNode = /*#__PURE__*/react.createElement("div", {
|
|
|
className: "".concat(prefixCls, "-content")
|
|
|
}, children);
|
|
|
}
|
|
|
|
|
|
return /*#__PURE__*/react.createElement(es["default"], (0,esm_extends/* default */.Z)({
|
|
|
visible: visible,
|
|
|
ref: elementRef,
|
|
|
leavedClassName: "".concat(prefixCls, "-hidden")
|
|
|
}, motion, {
|
|
|
onAppearPrepare: onShowPrepare,
|
|
|
onEnterPrepare: onShowPrepare,
|
|
|
removeOnLeave: destroyPopupOnHide,
|
|
|
forceRender: forceRender
|
|
|
}), function (_ref, motionRef) {
|
|
|
var motionClassName = _ref.className,
|
|
|
motionStyle = _ref.style;
|
|
|
var mergedClassName = classnames_default()(prefixCls, className, alignedClassName, motionClassName);
|
|
|
return /*#__PURE__*/react.createElement(rc_align_es, {
|
|
|
target: getAlignTarget(),
|
|
|
key: "popup",
|
|
|
ref: alignRef,
|
|
|
monitorWindowResize: true,
|
|
|
disabled: alignDisabled,
|
|
|
align: align,
|
|
|
onAlign: onInternalAlign
|
|
|
}, /*#__PURE__*/react.createElement("div", {
|
|
|
ref: motionRef,
|
|
|
className: mergedClassName,
|
|
|
onMouseEnter: onMouseEnter,
|
|
|
onMouseLeave: onMouseLeave,
|
|
|
onMouseDownCapture: onMouseDown,
|
|
|
onTouchStartCapture: onTouchStart,
|
|
|
onClick: onClick,
|
|
|
style: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, motionStyle), mergedStyle)
|
|
|
}, childNode));
|
|
|
});
|
|
|
});
|
|
|
PopupInner.displayName = 'PopupInner';
|
|
|
/* harmony default export */ var Popup_PopupInner = (PopupInner);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/Popup/MobilePopupInner.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MobilePopupInner = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
|
var prefixCls = props.prefixCls,
|
|
|
visible = props.visible,
|
|
|
zIndex = props.zIndex,
|
|
|
children = props.children,
|
|
|
_props$mobile = props.mobile;
|
|
|
_props$mobile = _props$mobile === void 0 ? {} : _props$mobile;
|
|
|
var popupClassName = _props$mobile.popupClassName,
|
|
|
popupStyle = _props$mobile.popupStyle,
|
|
|
_props$mobile$popupMo = _props$mobile.popupMotion,
|
|
|
popupMotion = _props$mobile$popupMo === void 0 ? {} : _props$mobile$popupMo,
|
|
|
popupRender = _props$mobile.popupRender,
|
|
|
onClick = props.onClick;
|
|
|
var elementRef = react.useRef(); // ========================= Refs =========================
|
|
|
|
|
|
react.useImperativeHandle(ref, function () {
|
|
|
return {
|
|
|
forceAlign: function forceAlign() {},
|
|
|
getElement: function getElement() {
|
|
|
return elementRef.current;
|
|
|
}
|
|
|
};
|
|
|
}); // ======================== Render ========================
|
|
|
|
|
|
var mergedStyle = (0,objectSpread2/* default */.Z)({
|
|
|
zIndex: zIndex
|
|
|
}, popupStyle);
|
|
|
|
|
|
var childNode = children; // Wrapper when multiple children
|
|
|
|
|
|
if (react.Children.count(children) > 1) {
|
|
|
childNode = /*#__PURE__*/react.createElement("div", {
|
|
|
className: "".concat(prefixCls, "-content")
|
|
|
}, children);
|
|
|
} // Mobile support additional render
|
|
|
|
|
|
|
|
|
if (popupRender) {
|
|
|
childNode = popupRender(childNode);
|
|
|
}
|
|
|
|
|
|
return /*#__PURE__*/react.createElement(es["default"], (0,esm_extends/* default */.Z)({
|
|
|
visible: visible,
|
|
|
ref: elementRef,
|
|
|
removeOnLeave: true
|
|
|
}, popupMotion), function (_ref, motionRef) {
|
|
|
var motionClassName = _ref.className,
|
|
|
motionStyle = _ref.style;
|
|
|
var mergedClassName = classnames_default()(prefixCls, popupClassName, motionClassName);
|
|
|
return /*#__PURE__*/react.createElement("div", {
|
|
|
ref: motionRef,
|
|
|
className: mergedClassName,
|
|
|
onClick: onClick,
|
|
|
style: (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, motionStyle), mergedStyle)
|
|
|
}, childNode);
|
|
|
});
|
|
|
});
|
|
|
MobilePopupInner.displayName = 'MobilePopupInner';
|
|
|
/* harmony default export */ var Popup_MobilePopupInner = (MobilePopupInner);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/Popup/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["visible", "mobile"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Popup = /*#__PURE__*/react.forwardRef(function (_ref, ref) {
|
|
|
var visible = _ref.visible,
|
|
|
mobile = _ref.mobile,
|
|
|
props = (0,objectWithoutProperties/* default */.Z)(_ref, _excluded);
|
|
|
|
|
|
var _useState = (0,react.useState)(visible),
|
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
|
innerVisible = _useState2[0],
|
|
|
serInnerVisible = _useState2[1];
|
|
|
|
|
|
var _useState3 = (0,react.useState)(false),
|
|
|
_useState4 = (0,slicedToArray/* default */.Z)(_useState3, 2),
|
|
|
inMobile = _useState4[0],
|
|
|
setInMobile = _useState4[1];
|
|
|
|
|
|
var cloneProps = (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, props), {}, {
|
|
|
visible: innerVisible
|
|
|
}); // We check mobile in visible changed here.
|
|
|
// And this also delay set `innerVisible` to avoid popup component render flash
|
|
|
|
|
|
|
|
|
(0,react.useEffect)(function () {
|
|
|
serInnerVisible(visible);
|
|
|
|
|
|
if (visible && mobile) {
|
|
|
setInMobile((0,isMobile/* default */.Z)());
|
|
|
}
|
|
|
}, [visible, mobile]);
|
|
|
var popupNode = inMobile ? /*#__PURE__*/react.createElement(Popup_MobilePopupInner, (0,esm_extends/* default */.Z)({}, cloneProps, {
|
|
|
mobile: mobile,
|
|
|
ref: ref
|
|
|
})) : /*#__PURE__*/react.createElement(Popup_PopupInner, (0,esm_extends/* default */.Z)({}, cloneProps, {
|
|
|
ref: ref
|
|
|
})); // We can use fragment directly but this may failed some selector usage. Keep as origin logic
|
|
|
|
|
|
return /*#__PURE__*/react.createElement("div", null, /*#__PURE__*/react.createElement(Mask, cloneProps), popupNode);
|
|
|
});
|
|
|
Popup.displayName = 'Popup';
|
|
|
/* harmony default export */ var es_Popup = (Popup);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/context.js
|
|
|
|
|
|
var TriggerContext = /*#__PURE__*/react.createContext(null);
|
|
|
/* harmony default export */ var context = (TriggerContext);
|
|
|
;// CONCATENATED MODULE: ./node_modules/rc-trigger/es/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function noop() {}
|
|
|
|
|
|
function returnEmptyString() {
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
function returnDocument(element) {
|
|
|
if (element) {
|
|
|
return element.ownerDocument;
|
|
|
}
|
|
|
|
|
|
return window.document;
|
|
|
}
|
|
|
|
|
|
var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur', 'onContextMenu'];
|
|
|
|
|
|
/**
|
|
|
* Internal usage. Do not use in your code since this will be removed.
|
|
|
*/
|
|
|
function generateTrigger(PortalComponent) {
|
|
|
var Trigger = /*#__PURE__*/function (_React$Component) {
|
|
|
(0,inherits/* default */.Z)(Trigger, _React$Component);
|
|
|
|
|
|
var _super = (0,createSuper/* default */.Z)(Trigger);
|
|
|
|
|
|
// ensure `getContainer` will be called only once
|
|
|
function Trigger(props) {
|
|
|
var _this;
|
|
|
|
|
|
(0,classCallCheck/* default */.Z)(this, Trigger);
|
|
|
|
|
|
_this = _super.call(this, props);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "popupRef", /*#__PURE__*/react.createRef());
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "triggerRef", /*#__PURE__*/react.createRef());
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "portalContainer", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "attachId", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "clickOutsideHandler", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "touchOutsideHandler", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "contextMenuOutsideHandler1", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "contextMenuOutsideHandler2", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "mouseDownTimeout", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "focusTime", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "preClickTime", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "preTouchTime", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "delayTimer", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "hasPopupMouseDown", void 0);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onMouseEnter", function (e) {
|
|
|
var mouseEnterDelay = _this.props.mouseEnterDelay;
|
|
|
|
|
|
_this.fireEvents('onMouseEnter', e);
|
|
|
|
|
|
_this.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e);
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onMouseMove", function (e) {
|
|
|
_this.fireEvents('onMouseMove', e);
|
|
|
|
|
|
_this.setPoint(e);
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onMouseLeave", function (e) {
|
|
|
_this.fireEvents('onMouseLeave', e);
|
|
|
|
|
|
_this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onPopupMouseEnter", function () {
|
|
|
_this.clearDelayTimer();
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onPopupMouseLeave", function (e) {
|
|
|
var _this$popupRef$curren;
|
|
|
|
|
|
// https://github.com/react-component/trigger/pull/13
|
|
|
// react bug?
|
|
|
if (e.relatedTarget && !e.relatedTarget.setTimeout && (0,contains/* default */.Z)((_this$popupRef$curren = _this.popupRef.current) === null || _this$popupRef$curren === void 0 ? void 0 : _this$popupRef$curren.getElement(), e.relatedTarget)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
_this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onFocus", function (e) {
|
|
|
_this.fireEvents('onFocus', e); // incase focusin and focusout
|
|
|
|
|
|
|
|
|
_this.clearDelayTimer();
|
|
|
|
|
|
if (_this.isFocusToShow()) {
|
|
|
_this.focusTime = Date.now();
|
|
|
|
|
|
_this.delaySetPopupVisible(true, _this.props.focusDelay);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onMouseDown", function (e) {
|
|
|
_this.fireEvents('onMouseDown', e);
|
|
|
|
|
|
_this.preClickTime = Date.now();
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onTouchStart", function (e) {
|
|
|
_this.fireEvents('onTouchStart', e);
|
|
|
|
|
|
_this.preTouchTime = Date.now();
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onBlur", function (e) {
|
|
|
_this.fireEvents('onBlur', e);
|
|
|
|
|
|
_this.clearDelayTimer();
|
|
|
|
|
|
if (_this.isBlurToHide()) {
|
|
|
_this.delaySetPopupVisible(false, _this.props.blurDelay);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onContextMenu", function (e) {
|
|
|
e.preventDefault();
|
|
|
|
|
|
_this.fireEvents('onContextMenu', e);
|
|
|
|
|
|
_this.setPopupVisible(true, e);
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onContextMenuClose", function () {
|
|
|
if (_this.isContextMenuToShow()) {
|
|
|
_this.close();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onClick", function (event) {
|
|
|
_this.fireEvents('onClick', event); // focus will trigger click
|
|
|
|
|
|
|
|
|
if (_this.focusTime) {
|
|
|
var preTime;
|
|
|
|
|
|
if (_this.preClickTime && _this.preTouchTime) {
|
|
|
preTime = Math.min(_this.preClickTime, _this.preTouchTime);
|
|
|
} else if (_this.preClickTime) {
|
|
|
preTime = _this.preClickTime;
|
|
|
} else if (_this.preTouchTime) {
|
|
|
preTime = _this.preTouchTime;
|
|
|
}
|
|
|
|
|
|
if (Math.abs(preTime - _this.focusTime) < 20) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
_this.focusTime = 0;
|
|
|
}
|
|
|
|
|
|
_this.preClickTime = 0;
|
|
|
_this.preTouchTime = 0; // Only prevent default when all the action is click.
|
|
|
// https://github.com/ant-design/ant-design/issues/17043
|
|
|
// https://github.com/ant-design/ant-design/issues/17291
|
|
|
|
|
|
if (_this.isClickToShow() && (_this.isClickToHide() || _this.isBlurToHide()) && event && event.preventDefault) {
|
|
|
event.preventDefault();
|
|
|
}
|
|
|
|
|
|
var nextVisible = !_this.state.popupVisible;
|
|
|
|
|
|
if (_this.isClickToHide() && !nextVisible || nextVisible && _this.isClickToShow()) {
|
|
|
_this.setPopupVisible(!_this.state.popupVisible, event);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onPopupMouseDown", function () {
|
|
|
_this.hasPopupMouseDown = true;
|
|
|
clearTimeout(_this.mouseDownTimeout);
|
|
|
_this.mouseDownTimeout = window.setTimeout(function () {
|
|
|
_this.hasPopupMouseDown = false;
|
|
|
}, 0);
|
|
|
|
|
|
if (_this.context) {
|
|
|
var _this$context;
|
|
|
|
|
|
(_this$context = _this.context).onPopupMouseDown.apply(_this$context, arguments);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "onDocumentClick", function (event) {
|
|
|
if (_this.props.mask && !_this.props.maskClosable) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var target = event.target;
|
|
|
|
|
|
var root = _this.getRootDomNode();
|
|
|
|
|
|
var popupNode = _this.getPopupDomNode();
|
|
|
|
|
|
if ( // mousedown on the target should also close popup when action is contextMenu.
|
|
|
// https://github.com/ant-design/ant-design/issues/29853
|
|
|
(!(0,contains/* default */.Z)(root, target) || _this.isContextMenuOnly()) && !(0,contains/* default */.Z)(popupNode, target) && !_this.hasPopupMouseDown) {
|
|
|
_this.close();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "getRootDomNode", function () {
|
|
|
var getTriggerDOMNode = _this.props.getTriggerDOMNode;
|
|
|
|
|
|
if (getTriggerDOMNode) {
|
|
|
return getTriggerDOMNode(_this.triggerRef.current);
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
var domNode = (0,findDOMNode/* default */.Z)(_this.triggerRef.current);
|
|
|
|
|
|
if (domNode) {
|
|
|
return domNode;
|
|
|
}
|
|
|
} catch (err) {// Do nothing
|
|
|
}
|
|
|
|
|
|
return react_dom.findDOMNode((0,assertThisInitialized/* default */.Z)(_this));
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "getPopupClassNameFromAlign", function (align) {
|
|
|
var className = [];
|
|
|
var _this$props = _this.props,
|
|
|
popupPlacement = _this$props.popupPlacement,
|
|
|
builtinPlacements = _this$props.builtinPlacements,
|
|
|
prefixCls = _this$props.prefixCls,
|
|
|
alignPoint = _this$props.alignPoint,
|
|
|
getPopupClassNameFromAlign = _this$props.getPopupClassNameFromAlign;
|
|
|
|
|
|
if (popupPlacement && builtinPlacements) {
|
|
|
className.push(getAlignPopupClassName(builtinPlacements, prefixCls, align, alignPoint));
|
|
|
}
|
|
|
|
|
|
if (getPopupClassNameFromAlign) {
|
|
|
className.push(getPopupClassNameFromAlign(align));
|
|
|
}
|
|
|
|
|
|
return className.join(' ');
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "getComponent", function () {
|
|
|
var _this$props2 = _this.props,
|
|
|
prefixCls = _this$props2.prefixCls,
|
|
|
destroyPopupOnHide = _this$props2.destroyPopupOnHide,
|
|
|
popupClassName = _this$props2.popupClassName,
|
|
|
onPopupAlign = _this$props2.onPopupAlign,
|
|
|
popupMotion = _this$props2.popupMotion,
|
|
|
popupAnimation = _this$props2.popupAnimation,
|
|
|
popupTransitionName = _this$props2.popupTransitionName,
|
|
|
popupStyle = _this$props2.popupStyle,
|
|
|
mask = _this$props2.mask,
|
|
|
maskAnimation = _this$props2.maskAnimation,
|
|
|
maskTransitionName = _this$props2.maskTransitionName,
|
|
|
maskMotion = _this$props2.maskMotion,
|
|
|
zIndex = _this$props2.zIndex,
|
|
|
popup = _this$props2.popup,
|
|
|
stretch = _this$props2.stretch,
|
|
|
alignPoint = _this$props2.alignPoint,
|
|
|
mobile = _this$props2.mobile,
|
|
|
forceRender = _this$props2.forceRender,
|
|
|
onPopupClick = _this$props2.onPopupClick;
|
|
|
var _this$state = _this.state,
|
|
|
popupVisible = _this$state.popupVisible,
|
|
|
point = _this$state.point;
|
|
|
|
|
|
var align = _this.getPopupAlign();
|
|
|
|
|
|
var mouseProps = {};
|
|
|
|
|
|
if (_this.isMouseEnterToShow()) {
|
|
|
mouseProps.onMouseEnter = _this.onPopupMouseEnter;
|
|
|
}
|
|
|
|
|
|
if (_this.isMouseLeaveToHide()) {
|
|
|
mouseProps.onMouseLeave = _this.onPopupMouseLeave;
|
|
|
}
|
|
|
|
|
|
mouseProps.onMouseDown = _this.onPopupMouseDown;
|
|
|
mouseProps.onTouchStart = _this.onPopupMouseDown;
|
|
|
return /*#__PURE__*/react.createElement(es_Popup, (0,esm_extends/* default */.Z)({
|
|
|
prefixCls: prefixCls,
|
|
|
destroyPopupOnHide: destroyPopupOnHide,
|
|
|
visible: popupVisible,
|
|
|
point: alignPoint && point,
|
|
|
className: popupClassName,
|
|
|
align: align,
|
|
|
onAlign: onPopupAlign,
|
|
|
animation: popupAnimation,
|
|
|
getClassNameFromAlign: _this.getPopupClassNameFromAlign
|
|
|
}, mouseProps, {
|
|
|
stretch: stretch,
|
|
|
getRootDomNode: _this.getRootDomNode,
|
|
|
style: popupStyle,
|
|
|
mask: mask,
|
|
|
zIndex: zIndex,
|
|
|
transitionName: popupTransitionName,
|
|
|
maskAnimation: maskAnimation,
|
|
|
maskTransitionName: maskTransitionName,
|
|
|
maskMotion: maskMotion,
|
|
|
ref: _this.popupRef,
|
|
|
motion: popupMotion,
|
|
|
mobile: mobile,
|
|
|
forceRender: forceRender,
|
|
|
onClick: onPopupClick
|
|
|
}), typeof popup === 'function' ? popup() : popup);
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "attachParent", function (popupContainer) {
|
|
|
raf/* default.cancel */.Z.cancel(_this.attachId);
|
|
|
var _this$props3 = _this.props,
|
|
|
getPopupContainer = _this$props3.getPopupContainer,
|
|
|
getDocument = _this$props3.getDocument;
|
|
|
|
|
|
var domNode = _this.getRootDomNode();
|
|
|
|
|
|
var mountNode;
|
|
|
|
|
|
if (!getPopupContainer) {
|
|
|
mountNode = getDocument(_this.getRootDomNode()).body;
|
|
|
} else if (domNode || getPopupContainer.length === 0) {
|
|
|
// Compatible for legacy getPopupContainer with domNode argument.
|
|
|
// If no need `domNode` argument, will call directly.
|
|
|
// https://codesandbox.io/s/eloquent-mclean-ss93m?file=/src/App.js
|
|
|
mountNode = getPopupContainer(domNode);
|
|
|
}
|
|
|
|
|
|
if (mountNode) {
|
|
|
mountNode.appendChild(popupContainer);
|
|
|
} else {
|
|
|
// Retry after frame render in case parent not ready
|
|
|
_this.attachId = (0,raf/* default */.Z)(function () {
|
|
|
_this.attachParent(popupContainer);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "getContainer", function () {
|
|
|
if (!_this.portalContainer) {
|
|
|
// In React.StrictMode component will call render multiple time in first mount.
|
|
|
// When you want to refactor with FC, useRef will also init multiple time and
|
|
|
// point to different useRef instance which will create multiple element
|
|
|
// (This multiple render will not trigger effect so you can not clean up this
|
|
|
// in effect). But this is safe with class component since it always point to same class instance.
|
|
|
var getDocument = _this.props.getDocument;
|
|
|
var popupContainer = getDocument(_this.getRootDomNode()).createElement('div'); // Make sure default popup container will never cause scrollbar appearing
|
|
|
// https://github.com/react-component/trigger/issues/41
|
|
|
|
|
|
popupContainer.style.position = 'absolute';
|
|
|
popupContainer.style.top = '0';
|
|
|
popupContainer.style.left = '0';
|
|
|
popupContainer.style.width = '100%';
|
|
|
_this.portalContainer = popupContainer;
|
|
|
}
|
|
|
|
|
|
_this.attachParent(_this.portalContainer);
|
|
|
|
|
|
return _this.portalContainer;
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "setPoint", function (point) {
|
|
|
var alignPoint = _this.props.alignPoint;
|
|
|
if (!alignPoint || !point) return;
|
|
|
|
|
|
_this.setState({
|
|
|
point: {
|
|
|
pageX: point.pageX,
|
|
|
pageY: point.pageY
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "handlePortalUpdate", function () {
|
|
|
if (_this.state.prevPopupVisible !== _this.state.popupVisible) {
|
|
|
_this.props.afterPopupVisibleChange(_this.state.popupVisible);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
(0,defineProperty/* default */.Z)((0,assertThisInitialized/* default */.Z)(_this), "triggerContextValue", {
|
|
|
onPopupMouseDown: _this.onPopupMouseDown
|
|
|
});
|
|
|
|
|
|
var _popupVisible;
|
|
|
|
|
|
if ('popupVisible' in props) {
|
|
|
_popupVisible = !!props.popupVisible;
|
|
|
} else {
|
|
|
_popupVisible = !!props.defaultPopupVisible;
|
|
|
}
|
|
|
|
|
|
_this.state = {
|
|
|
prevPopupVisible: _popupVisible,
|
|
|
popupVisible: _popupVisible
|
|
|
};
|
|
|
ALL_HANDLERS.forEach(function (h) {
|
|
|
_this["fire".concat(h)] = function (e) {
|
|
|
_this.fireEvents(h, e);
|
|
|
};
|
|
|
});
|
|
|
return _this;
|
|
|
}
|
|
|
|
|
|
(0,createClass/* default */.Z)(Trigger, [{
|
|
|
key: "componentDidMount",
|
|
|
value: function componentDidMount() {
|
|
|
this.componentDidUpdate();
|
|
|
}
|
|
|
}, {
|
|
|
key: "componentDidUpdate",
|
|
|
value: function componentDidUpdate() {
|
|
|
var props = this.props;
|
|
|
var state = this.state; // We must listen to `mousedown` or `touchstart`, edge case:
|
|
|
// https://github.com/ant-design/ant-design/issues/5804
|
|
|
// https://github.com/react-component/calendar/issues/250
|
|
|
// https://github.com/react-component/trigger/issues/50
|
|
|
|
|
|
if (state.popupVisible) {
|
|
|
var currentDocument;
|
|
|
|
|
|
if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextMenuToShow())) {
|
|
|
currentDocument = props.getDocument(this.getRootDomNode());
|
|
|
this.clickOutsideHandler = (0,addEventListener/* default */.Z)(currentDocument, 'mousedown', this.onDocumentClick);
|
|
|
} // always hide on mobile
|
|
|
|
|
|
|
|
|
if (!this.touchOutsideHandler) {
|
|
|
currentDocument = currentDocument || props.getDocument(this.getRootDomNode());
|
|
|
this.touchOutsideHandler = (0,addEventListener/* default */.Z)(currentDocument, 'touchstart', this.onDocumentClick);
|
|
|
} // close popup when trigger type contains 'onContextMenu' and document is scrolling.
|
|
|
|
|
|
|
|
|
if (!this.contextMenuOutsideHandler1 && this.isContextMenuToShow()) {
|
|
|
currentDocument = currentDocument || props.getDocument(this.getRootDomNode());
|
|
|
this.contextMenuOutsideHandler1 = (0,addEventListener/* default */.Z)(currentDocument, 'scroll', this.onContextMenuClose);
|
|
|
} // close popup when trigger type contains 'onContextMenu' and window is blur.
|
|
|
|
|
|
|
|
|
if (!this.contextMenuOutsideHandler2 && this.isContextMenuToShow()) {
|
|
|
this.contextMenuOutsideHandler2 = (0,addEventListener/* default */.Z)(window, 'blur', this.onContextMenuClose);
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.clearOutsideHandler();
|
|
|
}
|
|
|
}, {
|
|
|
key: "componentWillUnmount",
|
|
|
value: function componentWillUnmount() {
|
|
|
this.clearDelayTimer();
|
|
|
this.clearOutsideHandler();
|
|
|
clearTimeout(this.mouseDownTimeout);
|
|
|
raf/* default.cancel */.Z.cancel(this.attachId);
|
|
|
}
|
|
|
}, {
|
|
|
key: "getPopupDomNode",
|
|
|
value: function getPopupDomNode() {
|
|
|
var _this$popupRef$curren2;
|
|
|
|
|
|
// for test
|
|
|
return ((_this$popupRef$curren2 = this.popupRef.current) === null || _this$popupRef$curren2 === void 0 ? void 0 : _this$popupRef$curren2.getElement()) || null;
|
|
|
}
|
|
|
}, {
|
|
|
key: "getPopupAlign",
|
|
|
value: function getPopupAlign() {
|
|
|
var props = this.props;
|
|
|
var popupPlacement = props.popupPlacement,
|
|
|
popupAlign = props.popupAlign,
|
|
|
builtinPlacements = props.builtinPlacements;
|
|
|
|
|
|
if (popupPlacement && builtinPlacements) {
|
|
|
return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign);
|
|
|
}
|
|
|
|
|
|
return popupAlign;
|
|
|
}
|
|
|
}, {
|
|
|
key: "setPopupVisible",
|
|
|
value:
|
|
|
/**
|
|
|
* @param popupVisible Show or not the popup element
|
|
|
* @param event SyntheticEvent, used for `pointAlign`
|
|
|
*/
|
|
|
function setPopupVisible(popupVisible, event) {
|
|
|
var alignPoint = this.props.alignPoint;
|
|
|
var prevPopupVisible = this.state.popupVisible;
|
|
|
this.clearDelayTimer();
|
|
|
|
|
|
if (prevPopupVisible !== popupVisible) {
|
|
|
if (!('popupVisible' in this.props)) {
|
|
|
this.setState({
|
|
|
popupVisible: popupVisible,
|
|
|
prevPopupVisible: prevPopupVisible
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.props.onPopupVisibleChange(popupVisible);
|
|
|
} // Always record the point position since mouseEnterDelay will delay the show
|
|
|
|
|
|
|
|
|
if (alignPoint && event && popupVisible) {
|
|
|
this.setPoint(event);
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
key: "delaySetPopupVisible",
|
|
|
value: function delaySetPopupVisible(visible, delayS, event) {
|
|
|
var _this2 = this;
|
|
|
|
|
|
var delay = delayS * 1000;
|
|
|
this.clearDelayTimer();
|
|
|
|
|
|
if (delay) {
|
|
|
var point = event ? {
|
|
|
pageX: event.pageX,
|
|
|
pageY: event.pageY
|
|
|
} : null;
|
|
|
this.delayTimer = window.setTimeout(function () {
|
|
|
_this2.setPopupVisible(visible, point);
|
|
|
|
|
|
_this2.clearDelayTimer();
|
|
|
}, delay);
|
|
|
} else {
|
|
|
this.setPopupVisible(visible, event);
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
key: "clearDelayTimer",
|
|
|
value: function clearDelayTimer() {
|
|
|
if (this.delayTimer) {
|
|
|
clearTimeout(this.delayTimer);
|
|
|
this.delayTimer = null;
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
key: "clearOutsideHandler",
|
|
|
value: function clearOutsideHandler() {
|
|
|
if (this.clickOutsideHandler) {
|
|
|
this.clickOutsideHandler.remove();
|
|
|
this.clickOutsideHandler = null;
|
|
|
}
|
|
|
|
|
|
if (this.contextMenuOutsideHandler1) {
|
|
|
this.contextMenuOutsideHandler1.remove();
|
|
|
this.contextMenuOutsideHandler1 = null;
|
|
|
}
|
|
|
|
|
|
if (this.contextMenuOutsideHandler2) {
|
|
|
this.contextMenuOutsideHandler2.remove();
|
|
|
this.contextMenuOutsideHandler2 = null;
|
|
|
}
|
|
|
|
|
|
if (this.touchOutsideHandler) {
|
|
|
this.touchOutsideHandler.remove();
|
|
|
this.touchOutsideHandler = null;
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
key: "createTwoChains",
|
|
|
value: function createTwoChains(event) {
|
|
|
var childPros = this.props.children.props;
|
|
|
var props = this.props;
|
|
|
|
|
|
if (childPros[event] && props[event]) {
|
|
|
return this["fire".concat(event)];
|
|
|
}
|
|
|
|
|
|
return childPros[event] || props[event];
|
|
|
}
|
|
|
}, {
|
|
|
key: "isClickToShow",
|
|
|
value: function isClickToShow() {
|
|
|
var _this$props4 = this.props,
|
|
|
action = _this$props4.action,
|
|
|
showAction = _this$props4.showAction;
|
|
|
return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;
|
|
|
}
|
|
|
}, {
|
|
|
key: "isContextMenuOnly",
|
|
|
value: function isContextMenuOnly() {
|
|
|
var action = this.props.action;
|
|
|
return action === 'contextMenu' || action.length === 1 && action[0] === 'contextMenu';
|
|
|
}
|
|
|
}, {
|
|
|
key: "isContextMenuToShow",
|
|
|
value: function isContextMenuToShow() {
|
|
|
var _this$props5 = this.props,
|
|
|
action = _this$props5.action,
|
|
|
showAction = _this$props5.showAction;
|
|
|
return action.indexOf('contextMenu') !== -1 || showAction.indexOf('contextMenu') !== -1;
|
|
|
}
|
|
|
}, {
|
|
|
key: "isClickToHide",
|
|
|
value: function isClickToHide() {
|
|
|
var _this$props6 = this.props,
|
|
|
action = _this$props6.action,
|
|
|
hideAction = _this$props6.hideAction;
|
|
|
return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;
|
|
|
}
|
|
|
}, {
|
|
|
key: "isMouseEnterToShow",
|
|
|
value: function isMouseEnterToShow() {
|
|
|
var _this$props7 = this.props,
|
|
|
action = _this$props7.action,
|
|
|
showAction = _this$props7.showAction;
|
|
|
return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;
|
|
|
}
|
|
|
}, {
|
|
|
key: "isMouseLeaveToHide",
|
|
|
value: function isMouseLeaveToHide() {
|
|
|
var _this$props8 = this.props,
|
|
|
action = _this$props8.action,
|
|
|
hideAction = _this$props8.hideAction;
|
|
|
return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;
|
|
|
}
|
|
|
}, {
|
|
|
key: "isFocusToShow",
|
|
|
value: function isFocusToShow() {
|
|
|
var _this$props9 = this.props,
|
|
|
action = _this$props9.action,
|
|
|
showAction = _this$props9.showAction;
|
|
|
return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;
|
|
|
}
|
|
|
}, {
|
|
|
key: "isBlurToHide",
|
|
|
value: function isBlurToHide() {
|
|
|
var _this$props10 = this.props,
|
|
|
action = _this$props10.action,
|
|
|
hideAction = _this$props10.hideAction;
|
|
|
return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1;
|
|
|
}
|
|
|
}, {
|
|
|
key: "forcePopupAlign",
|
|
|
value: function forcePopupAlign() {
|
|
|
if (this.state.popupVisible) {
|
|
|
var _this$popupRef$curren3;
|
|
|
|
|
|
(_this$popupRef$curren3 = this.popupRef.current) === null || _this$popupRef$curren3 === void 0 ? void 0 : _this$popupRef$curren3.forceAlign();
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
key: "fireEvents",
|
|
|
value: function fireEvents(type, e) {
|
|
|
var childCallback = this.props.children.props[type];
|
|
|
|
|
|
if (childCallback) {
|
|
|
childCallback(e);
|
|
|
}
|
|
|
|
|
|
var callback = this.props[type];
|
|
|
|
|
|
if (callback) {
|
|
|
callback(e);
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
key: "close",
|
|
|
value: function close() {
|
|
|
this.setPopupVisible(false);
|
|
|
}
|
|
|
}, {
|
|
|
key: "render",
|
|
|
value: function render() {
|
|
|
var popupVisible = this.state.popupVisible;
|
|
|
var _this$props11 = this.props,
|
|
|
children = _this$props11.children,
|
|
|
forceRender = _this$props11.forceRender,
|
|
|
alignPoint = _this$props11.alignPoint,
|
|
|
className = _this$props11.className,
|
|
|
autoDestroy = _this$props11.autoDestroy;
|
|
|
var child = react.Children.only(children);
|
|
|
var newChildProps = {
|
|
|
key: 'trigger'
|
|
|
}; // ============================== Visible Handlers ==============================
|
|
|
// >>> ContextMenu
|
|
|
|
|
|
if (this.isContextMenuToShow()) {
|
|
|
newChildProps.onContextMenu = this.onContextMenu;
|
|
|
} else {
|
|
|
newChildProps.onContextMenu = this.createTwoChains('onContextMenu');
|
|
|
} // >>> Click
|
|
|
|
|
|
|
|
|
if (this.isClickToHide() || this.isClickToShow()) {
|
|
|
newChildProps.onClick = this.onClick;
|
|
|
newChildProps.onMouseDown = this.onMouseDown;
|
|
|
newChildProps.onTouchStart = this.onTouchStart;
|
|
|
} else {
|
|
|
newChildProps.onClick = this.createTwoChains('onClick');
|
|
|
newChildProps.onMouseDown = this.createTwoChains('onMouseDown');
|
|
|
newChildProps.onTouchStart = this.createTwoChains('onTouchStart');
|
|
|
} // >>> Hover(enter)
|
|
|
|
|
|
|
|
|
if (this.isMouseEnterToShow()) {
|
|
|
newChildProps.onMouseEnter = this.onMouseEnter; // Point align
|
|
|
|
|
|
if (alignPoint) {
|
|
|
newChildProps.onMouseMove = this.onMouseMove;
|
|
|
}
|
|
|
} else {
|
|
|
newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter');
|
|
|
} // >>> Hover(leave)
|
|
|
|
|
|
|
|
|
if (this.isMouseLeaveToHide()) {
|
|
|
newChildProps.onMouseLeave = this.onMouseLeave;
|
|
|
} else {
|
|
|
newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave');
|
|
|
} // >>> Focus
|
|
|
|
|
|
|
|
|
if (this.isFocusToShow() || this.isBlurToHide()) {
|
|
|
newChildProps.onFocus = this.onFocus;
|
|
|
newChildProps.onBlur = this.onBlur;
|
|
|
} else {
|
|
|
newChildProps.onFocus = this.createTwoChains('onFocus');
|
|
|
newChildProps.onBlur = this.createTwoChains('onBlur');
|
|
|
} // =================================== Render ===================================
|
|
|
|
|
|
|
|
|
var childrenClassName = classnames_default()(child && child.props && child.props.className, className);
|
|
|
|
|
|
if (childrenClassName) {
|
|
|
newChildProps.className = childrenClassName;
|
|
|
}
|
|
|
|
|
|
var cloneProps = (0,objectSpread2/* default */.Z)({}, newChildProps);
|
|
|
|
|
|
if ((0,es_ref/* supportRef */.Yr)(child)) {
|
|
|
cloneProps.ref = (0,es_ref/* composeRef */.sQ)(this.triggerRef, child.ref);
|
|
|
}
|
|
|
|
|
|
var trigger = /*#__PURE__*/react.cloneElement(child, cloneProps);
|
|
|
var portal; // prevent unmounting after it's rendered
|
|
|
|
|
|
if (popupVisible || this.popupRef.current || forceRender) {
|
|
|
portal = /*#__PURE__*/react.createElement(PortalComponent, {
|
|
|
key: "portal",
|
|
|
getContainer: this.getContainer,
|
|
|
didUpdate: this.handlePortalUpdate
|
|
|
}, this.getComponent());
|
|
|
}
|
|
|
|
|
|
if (!popupVisible && autoDestroy) {
|
|
|
portal = null;
|
|
|
}
|
|
|
|
|
|
return /*#__PURE__*/react.createElement(context.Provider, {
|
|
|
value: this.triggerContextValue
|
|
|
}, trigger, portal);
|
|
|
}
|
|
|
}], [{
|
|
|
key: "getDerivedStateFromProps",
|
|
|
value: function getDerivedStateFromProps(_ref, prevState) {
|
|
|
var popupVisible = _ref.popupVisible;
|
|
|
var newState = {};
|
|
|
|
|
|
if (popupVisible !== undefined && prevState.popupVisible !== popupVisible) {
|
|
|
newState.popupVisible = popupVisible;
|
|
|
newState.prevPopupVisible = prevState.popupVisible;
|
|
|
}
|
|
|
|
|
|
return newState;
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
return Trigger;
|
|
|
}(react.Component);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)(Trigger, "contextType", context);
|
|
|
|
|
|
(0,defineProperty/* default */.Z)(Trigger, "defaultProps", {
|
|
|
prefixCls: 'rc-trigger-popup',
|
|
|
getPopupClassNameFromAlign: returnEmptyString,
|
|
|
getDocument: returnDocument,
|
|
|
onPopupVisibleChange: noop,
|
|
|
afterPopupVisibleChange: noop,
|
|
|
onPopupAlign: noop,
|
|
|
popupClassName: '',
|
|
|
mouseEnterDelay: 0,
|
|
|
mouseLeaveDelay: 0.1,
|
|
|
focusDelay: 0,
|
|
|
blurDelay: 0.15,
|
|
|
popupStyle: {},
|
|
|
destroyPopupOnHide: false,
|
|
|
popupAlign: {},
|
|
|
defaultPopupVisible: false,
|
|
|
mask: false,
|
|
|
maskClosable: true,
|
|
|
action: [],
|
|
|
showAction: [],
|
|
|
hideAction: [],
|
|
|
autoDestroy: false
|
|
|
});
|
|
|
|
|
|
return Trigger;
|
|
|
}
|
|
|
/* harmony default export */ var rc_trigger_es = (generateTrigger(es_Portal));
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 64019:
|
|
|
/*!*********************************************************!*\
|
|
|
!*** ./node_modules/rc-util/es/Dom/addEventListener.js ***!
|
|
|
\*********************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
|
/* harmony export */ "Z": function() { return /* binding */ addEventListenerWrap; }
|
|
|
/* harmony export */ });
|
|
|
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-dom */ 73935);
|
|
|
|
|
|
function addEventListenerWrap(target, eventType, cb, option) {
|
|
|
/* eslint camelcase: 2 */
|
|
|
var callback = react_dom__WEBPACK_IMPORTED_MODULE_0__.unstable_batchedUpdates ? function run(e) {
|
|
|
react_dom__WEBPACK_IMPORTED_MODULE_0__.unstable_batchedUpdates(cb, e);
|
|
|
} : cb;
|
|
|
if (target.addEventListener) {
|
|
|
target.addEventListener(eventType, callback, option);
|
|
|
}
|
|
|
return {
|
|
|
remove: function remove() {
|
|
|
if (target.removeEventListener) {
|
|
|
target.removeEventListener(eventType, callback, option);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 5110:
|
|
|
/*!**************************************************!*\
|
|
|
!*** ./node_modules/rc-util/es/Dom/isVisible.js ***!
|
|
|
\**************************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["Z"] = (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;
|
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 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);
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
/***/ 53334:
|
|
|
/*!*********************************************!*\
|
|
|
!*** ./node_modules/rc-util/es/isMobile.js ***!
|
|
|
\*********************************************/
|
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__) {
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["Z"] = (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));
|
|
|
});
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}]); |