mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-02 20:18:22 +08:00
32 lines
829 B
JavaScript
32 lines
829 B
JavaScript
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) {
|
|
const baseAlign = builtinPlacements[placementStr] || {};
|
|
return {
|
|
...baseAlign,
|
|
...align,
|
|
};
|
|
}
|
|
|
|
export function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
|
|
const points = align.points;
|
|
for (const placement in builtinPlacements) {
|
|
if (builtinPlacements.hasOwnProperty(placement)) {
|
|
if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
|
|
return `${prefixCls}-placement-${placement}`;
|
|
}
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
export function noop() {}
|
|
|
|
export function saveRef(name, component) {
|
|
this[name] = component;
|
|
}
|