chrv-components 1.12.130 → 1.12.132

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
@@ -4020,8 +4020,9 @@ class ChrPopoverDirective {
4020
4020
  this.viewContainerRef = inject(ViewContainerRef);
4021
4021
  this.hostElement = computed(() => this.hostElementRef.nativeElement, /* @ts-ignore */
4022
4022
  ...(ngDevMode ? [{ debugName: "hostElement" }] : /* istanbul ignore next */ []));
4023
- this.isHostHovered$ = new BehaviorSubject(false);
4024
- this.isTargetHovered$ = new BehaviorSubject(false);
4023
+ this.isHostHovered$ = new Subject();
4024
+ this.isTargetHovered$ = new Subject();
4025
+ this.lastKnowMousePosition = new Subject();
4025
4026
  // private readonly isInsidePopover$ = new BehaviorSubject<boolean>(false);
4026
4027
  this.destroyRef = inject(DestroyRef);
4027
4028
  // private readonly isInsideHost = signal(false);
@@ -4063,9 +4064,21 @@ class ChrPopoverDirective {
4063
4064
  // if (y < rect.top || y >= rect.bottom) return false;
4064
4065
  // return true;
4065
4066
  // };
4067
+ this.updateMousePosition = (event) => {
4068
+ this.lastKnowMousePosition.next({
4069
+ x: event.clientX,
4070
+ y: event.clientY,
4071
+ });
4072
+ };
4066
4073
  this.setupSubject = () => {
4067
- combineLatest([this.isHostHovered$, this.isTargetHovered$])
4068
- .pipe(map(([hostHovered, targetHovered]) => hostHovered || targetHovered), switchMap((isInside) => {
4074
+ combineLatest([
4075
+ this.isHostHovered$,
4076
+ this.isTargetHovered$,
4077
+ this.lastKnowMousePosition,
4078
+ ])
4079
+ .pipe(map(([hostHovered, targetHovered, mouse]) => hostHovered.hover ||
4080
+ targetHovered.hover ||
4081
+ this.isPointerInsideElements(mouse.x, mouse.y)), switchMap((isInside) => {
4069
4082
  if (isInside) {
4070
4083
  return of(true);
4071
4084
  }
@@ -4089,7 +4102,10 @@ class ChrPopoverDirective {
4089
4102
  this.setupHostListeners = () => {
4090
4103
  this.renderer.listen(this.hostElement(), 'mouseenter', (event) => {
4091
4104
  // this.isInsidePopover$.next(true);
4092
- this.isHostHovered$.next(true);
4105
+ this.isHostHovered$.next({
4106
+ hover: true,
4107
+ position: { x: event.clientX, y: event.clientY },
4108
+ });
4093
4109
  // if (!this.isOpen()) {
4094
4110
  // this.showPopover();
4095
4111
  // }
@@ -4102,26 +4118,35 @@ class ChrPopoverDirective {
4102
4118
  // }
4103
4119
  // }, 100);
4104
4120
  // this.isInsidePopover$.next(false);
4105
- if (this.isPointerInsideElements(event)) {
4106
- return;
4107
- }
4108
- this.isHostHovered$.next(false);
4121
+ // if (this.isPointerInsideElements(event)) {
4122
+ // return;
4123
+ // }
4124
+ this.isHostHovered$.next({
4125
+ hover: false,
4126
+ position: { x: event.clientX, y: event.clientY },
4127
+ });
4109
4128
  });
4110
4129
  };
4111
4130
  this.setupTargetListeners = () => {
4112
4131
  this.renderer.listen(this.targetElement(), 'mouseenter', (event) => {
4113
4132
  // this.isInsideTarget.set(true);
4114
4133
  // this.shopPopover();
4115
- this.isTargetHovered$.next(true);
4134
+ this.isTargetHovered$.next({
4135
+ hover: true,
4136
+ position: { x: event.clientX, y: event.clientY },
4137
+ });
4116
4138
  // this.isInsidePopover$.next(true);
4117
4139
  });
4118
4140
  this.renderer.listen(this.targetElement(), 'mouseleave', (event) => {
4119
4141
  // this.isInsideTarget.set(false);
4120
4142
  // this.isInsidePopover$.next(false);
4121
- if (this.isPointerInsideElements(event)) {
4122
- return;
4123
- }
4124
- this.isTargetHovered$.next(false);
4143
+ // if (this.isPointerInsideElements(event)) {
4144
+ // return;
4145
+ // }
4146
+ this.isTargetHovered$.next({
4147
+ hover: false,
4148
+ position: { x: event.clientX, y: event.clientY },
4149
+ });
4125
4150
  // setTimeout(() => {
4126
4151
  // if (!this.isInsideHost() && !this.isInsideTargetBoundingBox(event))
4127
4152
  // this.hidePopover();
@@ -4138,15 +4163,19 @@ class ChrPopoverDirective {
4138
4163
  // this.isInsidePopover$.next(false);
4139
4164
  this.targetElement().hidePopover();
4140
4165
  };
4141
- this.isInsideRect = (event, rect) => {
4166
+ this.isEventInsideRect = (event, rect) => {
4142
4167
  const x = event.clientX;
4143
4168
  const y = event.clientY;
4169
+ return this.isInsideRect(x, y, rect);
4170
+ };
4171
+ this.isInsideRect = (x, y, rect) => {
4144
4172
  return (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom);
4145
4173
  };
4146
- this.isPointerInsideElements = (event) => {
4174
+ this.isPointerInsideElements = (x, y) => {
4175
+ // private isPointerInsideElements = (event: MouseEvent): boolean => {
4147
4176
  const hostRect = this.hostElement().getBoundingClientRect();
4148
4177
  const targetRect = this.targetElement().getBoundingClientRect();
4149
- return (this.isInsideRect(event, hostRect) || this.isInsideRect(event, targetRect));
4178
+ return (this.isInsideRect(x, y, hostRect) || this.isInsideRect(x, y, targetRect));
4150
4179
  };
4151
4180
  }
4152
4181
  ngOnInit() {
@@ -4179,7 +4208,7 @@ class ChrPopoverDirective {
4179
4208
  this.renderer.setStyle(this.targetElement(), 'border', 'none');
4180
4209
  }
4181
4210
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ChrPopoverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
4182
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: ChrPopoverDirective, isStandalone: true, selector: "[chrPopover]", inputs: { chrPopover: { classPropertyName: "chrPopover", publicName: "chrPopover", isSignal: true, isRequired: true, transformFunction: null }, chrPopoverPosition: { classPropertyName: "chrPopoverPosition", publicName: "chrPopoverPosition", isSignal: true, isRequired: false, transformFunction: null }, chrPopoverData: { classPropertyName: "chrPopoverData", publicName: "chrPopoverData", isSignal: true, isRequired: false, transformFunction: null }, chrPopoverOnHover: { classPropertyName: "chrPopoverOnHover", publicName: "chrPopoverOnHover", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keyup.escape": "hidePopover()" } }, ngImport: i0 }); }
4211
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: ChrPopoverDirective, isStandalone: true, selector: "[chrPopover]", inputs: { chrPopover: { classPropertyName: "chrPopover", publicName: "chrPopover", isSignal: true, isRequired: true, transformFunction: null }, chrPopoverPosition: { classPropertyName: "chrPopoverPosition", publicName: "chrPopoverPosition", isSignal: true, isRequired: false, transformFunction: null }, chrPopoverData: { classPropertyName: "chrPopoverData", publicName: "chrPopoverData", isSignal: true, isRequired: false, transformFunction: null }, chrPopoverOnHover: { classPropertyName: "chrPopoverOnHover", publicName: "chrPopoverOnHover", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "window:mousemove": "updaeMousePosition($event)" }, listeners: { "keyup.escape": "hidePopover()" } }, ngImport: i0 }); }
4183
4212
  }
4184
4213
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ChrPopoverDirective, decorators: [{
4185
4214
  type: Directive,
@@ -4187,6 +4216,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
4187
4216
  selector: '[chrPopover]',
4188
4217
  host: {
4189
4218
  '(keyup.escape)': 'hidePopover()',
4219
+ 'window:mousemove': 'updaeMousePosition($event)',
4190
4220
  },
4191
4221
  }]
4192
4222
  }], propDecorators: { chrPopover: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrPopover", required: true }] }], chrPopoverPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrPopoverPosition", required: false }] }], chrPopoverData: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrPopoverData", required: false }] }], chrPopoverOnHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrPopoverOnHover", required: false }] }] } });