@zanichelli/albe-web-components 2.33.3 → 2.33.4

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.
@@ -2551,9 +2551,11 @@ const ZPopover = class {
2551
2551
  /** [optional] Sets padding for Popover container */
2552
2552
  this.padding = "8px";
2553
2553
  this.isVisible = false;
2554
- this.defaultPosition = this.position;
2555
2554
  this.handleKeyDown = this.handleKeyDown.bind(this);
2556
2555
  }
2556
+ componentDidLoad() {
2557
+ this.checkSpaceAvailable();
2558
+ }
2557
2559
  closePopover() {
2558
2560
  this.isVisible = false;
2559
2561
  }
@@ -2581,16 +2583,13 @@ const ZPopover = class {
2581
2583
  }
2582
2584
  }
2583
2585
  checkSpaceAvailable() {
2584
- if (!this.isVisible) {
2585
- this.position = this.defaultPosition;
2586
- return;
2587
- }
2588
2586
  const width = document.body.clientWidth;
2589
2587
  const height = window.innerHeight;
2590
- const l = this.popoverElem.getBoundingClientRect().left;
2591
- const r = this.popoverElem.getBoundingClientRect().right;
2592
- const t = this.popoverElem.getBoundingClientRect().top;
2593
- const b = this.popoverElem.getBoundingClientRect().bottom;
2588
+ const rect = this.popoverElem.getBoundingClientRect();
2589
+ const l = rect.left;
2590
+ const r = rect.right;
2591
+ const t = rect.top;
2592
+ const b = rect.bottom;
2594
2593
  let firstSide = this.position.split("-")[0];
2595
2594
  let secondSide = this.position.split("-")[1];
2596
2595
  // If top is outside viewport
@@ -20,9 +20,11 @@ export class ZPopover {
20
20
  /** [optional] Sets padding for Popover container */
21
21
  this.padding = "8px";
22
22
  this.isVisible = false;
23
- this.defaultPosition = this.position;
24
23
  this.handleKeyDown = this.handleKeyDown.bind(this);
25
24
  }
25
+ componentDidLoad() {
26
+ this.checkSpaceAvailable();
27
+ }
26
28
  closePopover() {
27
29
  this.isVisible = false;
28
30
  }
@@ -50,16 +52,13 @@ export class ZPopover {
50
52
  }
51
53
  }
52
54
  checkSpaceAvailable() {
53
- if (!this.isVisible) {
54
- this.position = this.defaultPosition;
55
- return;
56
- }
57
55
  const width = document.body.clientWidth;
58
56
  const height = window.innerHeight;
59
- const l = this.popoverElem.getBoundingClientRect().left;
60
- const r = this.popoverElem.getBoundingClientRect().right;
61
- const t = this.popoverElem.getBoundingClientRect().top;
62
- const b = this.popoverElem.getBoundingClientRect().bottom;
57
+ const rect = this.popoverElem.getBoundingClientRect();
58
+ const l = rect.left;
59
+ const r = rect.right;
60
+ const t = rect.top;
61
+ const b = rect.bottom;
63
62
  let firstSide = this.position.split("-")[0];
64
63
  let secondSide = this.position.split("-")[1];
65
64
  // If top is outside viewport
@@ -2547,9 +2547,11 @@ const ZPopover = class {
2547
2547
  /** [optional] Sets padding for Popover container */
2548
2548
  this.padding = "8px";
2549
2549
  this.isVisible = false;
2550
- this.defaultPosition = this.position;
2551
2550
  this.handleKeyDown = this.handleKeyDown.bind(this);
2552
2551
  }
2552
+ componentDidLoad() {
2553
+ this.checkSpaceAvailable();
2554
+ }
2553
2555
  closePopover() {
2554
2556
  this.isVisible = false;
2555
2557
  }
@@ -2577,16 +2579,13 @@ const ZPopover = class {
2577
2579
  }
2578
2580
  }
2579
2581
  checkSpaceAvailable() {
2580
- if (!this.isVisible) {
2581
- this.position = this.defaultPosition;
2582
- return;
2583
- }
2584
2582
  const width = document.body.clientWidth;
2585
2583
  const height = window.innerHeight;
2586
- const l = this.popoverElem.getBoundingClientRect().left;
2587
- const r = this.popoverElem.getBoundingClientRect().right;
2588
- const t = this.popoverElem.getBoundingClientRect().top;
2589
- const b = this.popoverElem.getBoundingClientRect().bottom;
2584
+ const rect = this.popoverElem.getBoundingClientRect();
2585
+ const l = rect.left;
2586
+ const r = rect.right;
2587
+ const t = rect.top;
2588
+ const b = rect.bottom;
2590
2589
  let firstSide = this.position.split("-")[0];
2591
2590
  let secondSide = this.position.split("-")[1];
2592
2591
  // If top is outside viewport
@@ -14,11 +14,11 @@ export declare class ZPopover {
14
14
  padding?: string;
15
15
  isVisible: boolean;
16
16
  private popoverElem;
17
- private defaultPosition;
18
17
  /**
19
18
  * Constructor.
20
19
  */
21
20
  constructor();
21
+ componentDidLoad(): void;
22
22
  closePopover(): void;
23
23
  closePopoverWithKeyboard(e: any): void;
24
24
  handleClick(event: any): void;