ivue-material-plus
Version:
A high quality UI components Library with Vue.js
30 lines (26 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
function getTargetRect(target) {
return target !== window ? target.getBoundingClientRect() : { top: 0, bottom: window.innerHeight };
}
function getFixedTop(placeholderReact, targetRect, offsetTop) {
if (offsetTop !== void 0 && targetRect.top > placeholderReact.top - offsetTop) {
return offsetTop + targetRect.top;
}
return void 0;
}
function getFixedBottom(placeholderReact, targetRect, offsetBottom) {
if (offsetBottom !== void 0 && targetRect.bottom < placeholderReact.bottom + offsetBottom) {
const targetBottomOffset = window.innerHeight - targetRect.bottom;
return offsetBottom + targetBottomOffset;
}
return void 0;
}
function getDefaultTarget() {
return typeof window !== "undefined" ? window : null;
}
exports.getDefaultTarget = getDefaultTarget;
exports.getFixedBottom = getFixedBottom;
exports.getFixedTop = getFixedTop;
exports.getTargetRect = getTargetRect;
//# sourceMappingURL=utils.js.map