ant-design-vue
Version:
An enterprise-class UI design language and Vue-based implementation
31 lines (26 loc) • 1.16 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function isPointsEq(a1, a2, isAlignPoint) {
if (isAlignPoint) {
return a1[0] === a2[0];
}
return a1[0] === a2[0] && a1[1] === a2[1];
}
export function getAlignFromPlacement(builtinPlacements, placementStr, align) {
var baseAlign = builtinPlacements[placementStr] || {};
return _extends(_extends({}, baseAlign), align);
}
export function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
var points = align.points;
for (var placement in builtinPlacements) {
if (builtinPlacements.hasOwnProperty(placement)) {
if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
return "".concat(prefixCls, "-placement-").concat(placement);
}
}
}
return '';
}
export function noop() {}
export function saveRef(name, component) {
this[name] = component;
}