25 lines
751 B
JavaScript
25 lines
751 B
JavaScript
import _extends from 'babel-runtime/helpers/extends';
|
|
function isPointsEq(a1, a2) {
|
|
return a1[0] === a2[0] && a1[1] === a2[1];
|
|
}
|
|
|
|
export function getAlignFromPlacement(builtinPlacements, placementStr, align) {
|
|
var baseAlign = builtinPlacements[placementStr] || {};
|
|
return _extends({}, baseAlign, align);
|
|
}
|
|
|
|
export function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) {
|
|
var points = align.points;
|
|
for (var placement in builtinPlacements) {
|
|
if (builtinPlacements.hasOwnProperty(placement)) {
|
|
if (isPointsEq(builtinPlacements[placement].points, points)) {
|
|
return prefixCls + '-placement-' + placement;
|
|
}
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
|
|
export function saveRef(name, component) {
|
|
this[name] = component;
|
|
} |