@everymatrix/stage-mm-verification-report 1.0.43 → 1.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/main.js +17 -7
  2. package/main.js.map +1 -1
  3. package/package.json +1 -1
package/main.js CHANGED
@@ -23419,21 +23419,31 @@ var DmRangeDatePickerLibComponent = class _DmRangeDatePickerLibComponent {
23419
23419
  const popEl = this.popover.container;
23420
23420
  const parentEl = popEl.parentElement;
23421
23421
  this.popoverOpened = true;
23422
- if (popEl) {
23422
+ if (popEl && parentEl) {
23423
23423
  popEl.style.left = "0px";
23424
- popEl.style.top = "0px";
23425
- if (parentEl) {
23424
+ popEl.style.top = `${parentEl.offsetHeight}px`;
23425
+ popEl.style.bottom = "";
23426
+ requestAnimationFrame(() => {
23426
23427
  const rect = popEl.getBoundingClientRect();
23427
23428
  const parentRect = parentEl.getBoundingClientRect();
23428
- const isClippedRight = rect.right > window.innerWidth;
23429
+ const popoverHeight = popEl.offsetHeight;
23430
+ const viewportHeight = window.innerHeight;
23431
+ const viewportWidth = window.innerWidth;
23432
+ const isClippedRight = rect.right > viewportWidth;
23433
+ const isClippedBottom = rect.bottom > viewportHeight;
23434
+ const spaceAbove = parentRect.top;
23429
23435
  if (isClippedRight) {
23430
23436
  popEl.style.left = `-${rect.width - parentRect.width}px`;
23431
23437
  }
23432
- const isClippedBottom = rect.bottom > window.innerHeight;
23433
23438
  if (isClippedBottom) {
23434
- popEl.style.top = `-${rect.height - parentRect.height}px`;
23439
+ if (spaceAbove >= popoverHeight) {
23440
+ popEl.style.top = "";
23441
+ popEl.style.bottom = `${parentEl.offsetHeight}px`;
23442
+ } else {
23443
+ popEl.style.top = `-${(viewportHeight - (viewportHeight - popoverHeight)) / 2}px`;
23444
+ }
23435
23445
  }
23436
- }
23446
+ });
23437
23447
  }
23438
23448
  }
23439
23449
  onPopoverClose() {