40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _extends2 = require('babel-runtime/helpers/extends');
|
|
|
|
var _extends3 = _interopRequireDefault(_extends2);
|
|
|
|
exports.getAlignFromPlacement = getAlignFromPlacement;
|
|
exports.getAlignPopupClassName = getAlignPopupClassName;
|
|
exports.noop = noop;
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
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, _extends3['default'])({}, baseAlign, align);
|
|
}
|
|
|
|
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 prefixCls + '-placement-' + placement;
|
|
}
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
function noop() {} |