@nova-ui/bits
Version:
SolarWinds Nova Framework
38 lines (37 loc) • 1.84 kB
TypeScript
import * as i0 from "@angular/core";
/**
* @dynamic
* @ignore
*/
export declare class PositionService {
private document;
constructor(document: Document);
/**
* __Description:__
* Takes two HTMLElements (hostElement and targetElement) and calculates a position for the targetElement.
* @param hostElement If you want to display tooltip for some textbox, hostElement is textbox.
* @param targetElement Tooltip (or popover) element, for which position will be returned.
* @param placementAndAlign String in format "placement-align", e.g. "top-center".
* 'Placement' could be 'right', 'left', 'top' (default), 'bottom'. It defines how target will be placed
* to the host.
* 'Align' could be 'right', 'left', 'top', 'bottom' and 'center' (default). It defines whether one of the target's
* edges will be aligned to host's one. Be aware that horizontal placements need vertical alignment and vice verca.
* Possible values of 'placementAndAlign' could be: 'top' (the same as 'top-center'), 'top-right', 'left-bottom',
* 'bottom-left' etc.
* @param appendToBody Specifies whether target element is appended to the body.
* When not, service seeks for the first positioned parent of host.
* @returns Object literal { top:number, left:number } that contains
* coordinates for the top left corner of targetElement.
*/
getPosition(hostElement: HTMLElement, targetElement: HTMLElement, placementAndAlign: string, appendToBody?: boolean): {
top: number;
left: number;
};
private position;
private offset;
private getStyle;
private isStaticPositioned;
private parentOffsetEl;
static ɵfac: i0.ɵɵFactoryDeclaration<PositionService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PositionService>;
}