2019-01-12 11:33:27 +08:00
|
|
|
function isPointsEq(a1, a2, isAlignPoint) {
|
2018-09-05 21:28:54 +08:00
|
|
|
if (isAlignPoint) {
|
2019-01-12 11:33:27 +08:00
|
|
|
return a1[0] === a2[0];
|
2018-09-05 21:28:54 +08:00
|
|
|
}
|
2019-01-12 11:33:27 +08:00
|
|
|
return a1[0] === a2[0] && a1[1] === a2[1];
|
2017-12-22 18:43:28 +08:00
|
|
|
}
|
|
|
|
|
2019-01-12 11:33:27 +08:00
|
|
|
export function getAlignFromPlacement(builtinPlacements, placementStr, align) {
|
|
|
|
const baseAlign = builtinPlacements[placementStr] || {};
|
2017-12-22 18:43:28 +08:00
|
|
|
return {
|
|
|
|
...baseAlign,
|
|
|
|
...align,
|
2019-01-12 11:33:27 +08:00
|
|
|
};
|
2017-12-22 18:43:28 +08:00
|
|
|
}
|
|
|
|
|
2019-01-12 11:33:27 +08:00
|
|
|
export function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
|
|
|
const points = align.points;
|
2017-12-22 18:43:28 +08:00
|
|
|
for (const placement in builtinPlacements) {
|
|
|
|
if (builtinPlacements.hasOwnProperty(placement)) {
|
2018-09-05 21:28:54 +08:00
|
|
|
if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
|
2019-01-12 11:33:27 +08:00
|
|
|
return `${prefixCls}-placement-${placement}`;
|
2017-12-22 18:43:28 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-01-12 11:33:27 +08:00
|
|
|
return '';
|
2017-12-22 18:43:28 +08:00
|
|
|
}
|
2019-01-12 11:33:27 +08:00
|
|
|
export function noop() {}
|
2020-06-29 18:43:43 +08:00
|
|
|
|
|
|
|
export function saveRef(name, component) {
|
|
|
|
this[name] = component;
|
|
|
|
}
|