/**
 * @file PopupCalculation vendor
 * @author liangxiaojun(liangxiaojun@derbysoft.com)
 */

function topVerticalBottom(triggerEl, triggerOffset) {
    return triggerOffset.top + triggerEl.offsetHeight;
}

function topVerticalTop(triggerOffset, popupEl) {
    return triggerOffset.top - popupEl.offsetHeight
        - parseInt(getComputedStyle(popupEl).marginTop)
        - parseInt(getComputedStyle(popupEl).marginBottom);
}

function topHorizontalTop(triggerOffset) {
    return triggerOffset.top;
}

function topHorizontalMiddle(triggerEl, triggerOffset, popupEl) {
    return triggerOffset.top + triggerEl.offsetHeight / 2 - popupEl.offsetHeight / 2;
}

function topHorizontalBottom(triggerEl, triggerOffset, popupEl) {
    return triggerOffset.top + triggerEl.offsetHeight - popupEl.offsetHeight;
}

function leftVerticalLeft(triggerOffset) {
    return triggerOffset.left;
}

function leftVerticalCenter(triggerEl, triggerOffset, popupEl) {
    return triggerOffset.left + triggerEl.offsetWidth / 2 - popupEl.offsetWidth / 2;
}

function leftVerticalRight(triggerEl, triggerOffset, popupEl) {
    return triggerOffset.left - (popupEl.offsetWidth - triggerEl.offsetWidth);
}

function leftHorizontalLeft(triggerOffset, popupEl) {
    return triggerOffset.left - popupEl.offsetWidth
        - parseInt(getComputedStyle(popupEl).marginLeft)
        - parseInt(getComputedStyle(popupEl).marginRight);
}

function leftHorizontalRight(triggerEl, triggerOffset) {
    return triggerOffset.left + triggerEl.offsetWidth;
}

export default {
    topVerticalBottom,
    topVerticalTop,
    topHorizontalTop,
    topHorizontalMiddle,
    topHorizontalBottom,
    leftVerticalLeft,
    leftVerticalCenter,
    leftVerticalRight,
    leftHorizontalLeft,
    leftHorizontalRight
};
@@ -87,16 +87,87 @@
 m)%0A */%0A%0A
+import Dom from './Dom';%0Aimport Position from '../_statics/Position';%0A%0A
 function
@@ -1586,16 +1586,2559 @@
 dth;%0A%7D%0A%0A
+function getStyle(triggerEl, popupEl, position) %7B%0A%0A    if (!triggerEl %7C%7C !popupEl) %7B%0A        return;%0A    %7D%0A%0A    const triggerOffset = Dom.getOffset(triggerEl);%0A    let left, top;%0A%0A    switch (position) %7B%0A        case Position.TOP_LEFT: %7B%0A            left = leftVerticalLeft(triggerOffset);%0A            top = topVerticalTop(triggerOffset, popupEl);%0A            break;%0A        %7D%0A        case Position.TOP: %7B%0A            left = leftVerticalCenter(triggerEl, triggerOffset, popupEl);%0A            top = topVerticalTop(triggerOffset, popupEl);%0A            break;%0A        %7D%0A        case Position.TOP_RIGHT: %7B%0A            left = leftVerticalRight(triggerEl, triggerOffset, popupEl);%0A            top = topVerticalTop(triggerOffset, popupEl);%0A            break;%0A        %7D%0A        case Position.BOTTOM_LEFT: %7B%0A            left = leftVerticalLeft(triggerOffset);%0A            top = topVerticalBottom(triggerEl, triggerOffset);%0A            break;%0A        %7D%0A        case Position.BOTTOM: %7B%0A            left = leftVerticalCenter(triggerEl, triggerOffset, popupEl);%0A            top = topVerticalBottom(triggerEl, triggerOffset);%0A            break;%0A        %7D%0A        case Position.BOTTOM_RIGHT: %7B%0A            left = leftVerticalRight(triggerEl, triggerOffset, popupEl);%0A            top = topVerticalBottom(triggerEl, triggerOffset);%0A            break;%0A        %7D%0A        case Position.LEFT_TOP: %7B%0A            left = leftHorizontalLeft(triggerOffset, popupEl);%0A            top = topHorizontalTop(triggerOffset);%0A            break;%0A        %7D%0A        case Position.LEFT: %7B%0A            left = leftHorizontalLeft(triggerOffset, popupEl);%0A            top = topHorizontalMiddle(triggerEl, triggerOffset, popupEl);%0A            break;%0A        %7D%0A        case Position.LEFT_BOTTOM: %7B%0A            left = leftHorizontalLeft(triggerOffset, popupEl);%0A            top = topHorizontalBottom(triggerEl, triggerOffset, popupEl);%0A            break;%0A        %7D%0A        case Position.RIGHT_TOP: %7B%0A            left = leftHorizontalRight(triggerEl, triggerOffset);%0A            top = topHorizontalTop(triggerOffset);%0A            break;%0A        %7D%0A        case Position.RIGHT: %7B%0A            left = leftHorizontalRight(triggerEl, triggerOffset);%0A            top = topHorizontalMiddle(triggerEl, triggerOffset, popupEl);%0A            break;%0A        %7D%0A        case Position.RIGHT_BOTTOM: %7B%0A            left = leftHorizontalRight(triggerEl, triggerOffset);%0A            top = topHorizontalBottom(triggerEl, triggerOffset, popupEl);%0A            break;%0A        %7D%0A    %7D%0A%0A    return %7Bleft, top%7D;%0A%0A%7D%0A%0A
 export d
@@ -4346,32 +4346,32 @@
 HorizontalLeft,%0A
-
     leftHorizont
@@ -4377,11 +4377,25 @@
 talRight
+,%0A    getStyle
 %0A%7D;

update PopupCalculation