($elem, target, options = {})
| 548 | }; |
| 549 | |
| 550 | function renderPopover($elem, target, options = {}) { |
| 551 | // async microtask |
| 552 | queueMicrotask(() => { |
| 553 | |
| 554 | const containerRect = getRect(window); |
| 555 | const targetRect = getRect(target); |
| 556 | const elemRect = getRect($elem); |
| 557 | |
| 558 | const positionInfo = getBestPosition( |
| 559 | containerRect, |
| 560 | targetRect, |
| 561 | elemRect, |
| 562 | options.positions |
| 563 | ); |
| 564 | const style = getPositionStyle(positionInfo, { |
| 565 | bgColor: options.bgColor, |
| 566 | borderColor: options.borderColor, |
| 567 | borderRadius: options.borderRadius |
| 568 | }); |
| 569 | |
| 570 | $elem.style.top = positionInfo.top + "px"; |
| 571 | $elem.style.left = positionInfo.left + "px"; |
| 572 | $elem.style.background = style.background; |
| 573 | |
| 574 | }); |
| 575 | } |
| 576 | |
| 577 | let $popover; |
| 578 | export function hidePopover() { |
no test coverage detected