chrv-components 1.12.131 → 1.12.133
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
|
|
4024
|
-
this.isTargetHovered$ = new
|
|
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,22 @@ 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([
|
|
4068
|
-
.
|
|
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.isInsideHost(hostHovered.position?.x, hostHovered.position.y) ||
|
|
4082
|
+
this.isInsideTarget(targetHovered.position?.x, targetHovered.position.y)), switchMap((isInside) => {
|
|
4069
4083
|
if (isInside) {
|
|
4070
4084
|
return of(true);
|
|
4071
4085
|
}
|
|
@@ -4089,7 +4103,10 @@ class ChrPopoverDirective {
|
|
|
4089
4103
|
this.setupHostListeners = () => {
|
|
4090
4104
|
this.renderer.listen(this.hostElement(), 'mouseenter', (event) => {
|
|
4091
4105
|
// this.isInsidePopover$.next(true);
|
|
4092
|
-
this.isHostHovered$.next(
|
|
4106
|
+
this.isHostHovered$.next({
|
|
4107
|
+
hover: true,
|
|
4108
|
+
position: { x: event.clientX, y: event.clientY },
|
|
4109
|
+
});
|
|
4093
4110
|
// if (!this.isOpen()) {
|
|
4094
4111
|
// this.showPopover();
|
|
4095
4112
|
// }
|
|
@@ -4102,17 +4119,23 @@ class ChrPopoverDirective {
|
|
|
4102
4119
|
// }
|
|
4103
4120
|
// }, 100);
|
|
4104
4121
|
// this.isInsidePopover$.next(false);
|
|
4105
|
-
if (this.isPointerInsideElements(event)) {
|
|
4106
|
-
|
|
4107
|
-
}
|
|
4108
|
-
this.isHostHovered$.next(
|
|
4122
|
+
// if (this.isPointerInsideElements(event)) {
|
|
4123
|
+
// return;
|
|
4124
|
+
// }
|
|
4125
|
+
this.isHostHovered$.next({
|
|
4126
|
+
hover: false,
|
|
4127
|
+
position: { x: event.clientX, y: event.clientY },
|
|
4128
|
+
});
|
|
4109
4129
|
});
|
|
4110
4130
|
};
|
|
4111
4131
|
this.setupTargetListeners = () => {
|
|
4112
4132
|
this.renderer.listen(this.targetElement(), 'mouseenter', (event) => {
|
|
4113
4133
|
// this.isInsideTarget.set(true);
|
|
4114
4134
|
// this.shopPopover();
|
|
4115
|
-
this.isTargetHovered$.next(
|
|
4135
|
+
this.isTargetHovered$.next({
|
|
4136
|
+
hover: true,
|
|
4137
|
+
position: { x: event.clientX, y: event.clientY },
|
|
4138
|
+
});
|
|
4116
4139
|
// this.isInsidePopover$.next(true);
|
|
4117
4140
|
});
|
|
4118
4141
|
this.renderer.listen(this.targetElement(), 'mouseleave', (event) => {
|
|
@@ -4121,7 +4144,10 @@ class ChrPopoverDirective {
|
|
|
4121
4144
|
// if (this.isPointerInsideElements(event)) {
|
|
4122
4145
|
// return;
|
|
4123
4146
|
// }
|
|
4124
|
-
this.isTargetHovered$.next(
|
|
4147
|
+
this.isTargetHovered$.next({
|
|
4148
|
+
hover: false,
|
|
4149
|
+
position: { x: event.clientX, y: event.clientY },
|
|
4150
|
+
});
|
|
4125
4151
|
// setTimeout(() => {
|
|
4126
4152
|
// if (!this.isInsideHost() && !this.isInsideTargetBoundingBox(event))
|
|
4127
4153
|
// this.hidePopover();
|
|
@@ -4138,15 +4164,27 @@ class ChrPopoverDirective {
|
|
|
4138
4164
|
// this.isInsidePopover$.next(false);
|
|
4139
4165
|
this.targetElement().hidePopover();
|
|
4140
4166
|
};
|
|
4141
|
-
this.
|
|
4167
|
+
this.isEventInsideRect = (event, rect) => {
|
|
4142
4168
|
const x = event.clientX;
|
|
4143
4169
|
const y = event.clientY;
|
|
4170
|
+
return this.isInsideRect(x, y, rect);
|
|
4171
|
+
};
|
|
4172
|
+
this.isInsideRect = (x, y, rect) => {
|
|
4144
4173
|
return (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom);
|
|
4145
4174
|
};
|
|
4146
|
-
this.
|
|
4175
|
+
this.isInsideHost = (x, y) => {
|
|
4176
|
+
const rect = this.hostElement().getBoundingClientRect();
|
|
4177
|
+
return this.isInsideRect(x, y, rect);
|
|
4178
|
+
};
|
|
4179
|
+
this.isInsideTarget = (x, y) => {
|
|
4180
|
+
const rect = this.targetElement().getBoundingClientRect();
|
|
4181
|
+
return this.isInsideRect(x, y, rect);
|
|
4182
|
+
};
|
|
4183
|
+
this.isPointerInsideElements = (x, y) => {
|
|
4184
|
+
// private isPointerInsideElements = (event: MouseEvent): boolean => {
|
|
4147
4185
|
const hostRect = this.hostElement().getBoundingClientRect();
|
|
4148
4186
|
const targetRect = this.targetElement().getBoundingClientRect();
|
|
4149
|
-
return (this.isInsideRect(
|
|
4187
|
+
return (this.isInsideRect(x, y, hostRect) || this.isInsideRect(x, y, targetRect));
|
|
4150
4188
|
};
|
|
4151
4189
|
}
|
|
4152
4190
|
ngOnInit() {
|
|
@@ -4179,7 +4217,7 @@ class ChrPopoverDirective {
|
|
|
4179
4217
|
this.renderer.setStyle(this.targetElement(), 'border', 'none');
|
|
4180
4218
|
}
|
|
4181
4219
|
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 }); }
|
|
4220
|
+
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
4221
|
}
|
|
4184
4222
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ChrPopoverDirective, decorators: [{
|
|
4185
4223
|
type: Directive,
|
|
@@ -4187,6 +4225,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
4187
4225
|
selector: '[chrPopover]',
|
|
4188
4226
|
host: {
|
|
4189
4227
|
'(keyup.escape)': 'hidePopover()',
|
|
4228
|
+
'window:mousemove': 'updaeMousePosition($event)',
|
|
4190
4229
|
},
|
|
4191
4230
|
}]
|
|
4192
4231
|
}], 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 }] }] } });
|