chrv-components 1.12.129 → 1.12.130

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.
Binary file
@@ -4065,15 +4065,11 @@ class ChrPopoverDirective {
4065
4065
  // };
4066
4066
  this.setupSubject = () => {
4067
4067
  combineLatest([this.isHostHovered$, this.isTargetHovered$])
4068
- .pipe(map(([hostHovered, targetHovered]) => hostHovered || targetHovered),
4069
- // 3. switchMap gère le délai d'attente à la fermeture
4070
- switchMap((isInside) => {
4068
+ .pipe(map(([hostHovered, targetHovered]) => hostHovered || targetHovered), switchMap((isInside) => {
4071
4069
  if (isInside) {
4072
- // Entrée immédiate : annule toute temporisation précédente
4073
4070
  return of(true);
4074
4071
  }
4075
4072
  else {
4076
- // Sortie : temporise de 100ms avant d'émettre false
4077
4073
  return timer(100).pipe(map(() => false));
4078
4074
  }
4079
4075
  }), takeUntilDestroyed(this.destroyRef))
@@ -4106,6 +4102,9 @@ class ChrPopoverDirective {
4106
4102
  // }
4107
4103
  // }, 100);
4108
4104
  // this.isInsidePopover$.next(false);
4105
+ if (this.isPointerInsideElements(event)) {
4106
+ return;
4107
+ }
4109
4108
  this.isHostHovered$.next(false);
4110
4109
  });
4111
4110
  };
@@ -4119,6 +4118,9 @@ class ChrPopoverDirective {
4119
4118
  this.renderer.listen(this.targetElement(), 'mouseleave', (event) => {
4120
4119
  // this.isInsideTarget.set(false);
4121
4120
  // this.isInsidePopover$.next(false);
4121
+ if (this.isPointerInsideElements(event)) {
4122
+ return;
4123
+ }
4122
4124
  this.isTargetHovered$.next(false);
4123
4125
  // setTimeout(() => {
4124
4126
  // if (!this.isInsideHost() && !this.isInsideTargetBoundingBox(event))
@@ -4136,6 +4138,16 @@ class ChrPopoverDirective {
4136
4138
  // this.isInsidePopover$.next(false);
4137
4139
  this.targetElement().hidePopover();
4138
4140
  };
4141
+ this.isInsideRect = (event, rect) => {
4142
+ const x = event.clientX;
4143
+ const y = event.clientY;
4144
+ return (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom);
4145
+ };
4146
+ this.isPointerInsideElements = (event) => {
4147
+ const hostRect = this.hostElement().getBoundingClientRect();
4148
+ const targetRect = this.targetElement().getBoundingClientRect();
4149
+ return (this.isInsideRect(event, hostRect) || this.isInsideRect(event, targetRect));
4150
+ };
4139
4151
  }
4140
4152
  ngOnInit() {
4141
4153
  const maybeTemplate = this.chrPopover();