@alicloud/console-components
Version:
Alibaba Cloud React Components
22 lines (21 loc) • 886 B
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import React, { forwardRef, } from 'react';
import hoist from '../utils/hoist';
// 弹层类组件高阶组件,默认向下 4px 弹出
export default function hocPopup(WrappedComponents) {
var Wrapper = forwardRef(function (props, ref) {
var popupProps = __assign({ align: 'tl bl', offset: [0, 4] }, props.popupProps);
return React.createElement(WrappedComponents, __assign({ ref: ref }, props, { popupProps: popupProps }));
});
return hoist(Wrapper, WrappedComponents);
}