chrv-components 1.12.75 → 1.12.76

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
@@ -6765,6 +6765,9 @@ class ChrHoverDirective {
6765
6765
  this.chrHoverContext = input({}, ...(ngDevMode ? [{ debugName: "chrHoverContext" }] : []));
6766
6766
  this.chrHoverSnap = input(false, ...(ngDevMode ? [{ debugName: "chrHoverSnap" }] : []));
6767
6767
  this.chrHoverPosition = input('right', ...(ngDevMode ? [{ debugName: "chrHoverPosition" }] : []));
6768
+ this.chrHoverCloseDelay = input(100, ...(ngDevMode ? [{ debugName: "chrHoverCloseDelay" }] : []));
6769
+ this.closeTimeout = null;
6770
+ this.overlayEventListeners = [];
6768
6771
  this.mousePositionStrategy = (mousemove) => {
6769
6772
  const positionOffset = { left: mousemove.clientX, top: mousemove.clientY };
6770
6773
  const componentSize = this.overlayRef?.overlayElement.getBoundingClientRect();
@@ -6872,11 +6875,12 @@ class ChrHoverDirective {
6872
6875
  });
6873
6876
  }
6874
6877
  ngOnInit() {
6875
- this.eventListeners.push(this.renderer.listen(this.el.nativeElement, 'mouseenter', (event) => {
6878
+ this.eventListeners.push(this.renderer.listen(this.el.nativeElement, 'mouseenter', () => {
6879
+ this.clearCloseTimeout();
6876
6880
  this.open();
6877
6881
  }));
6878
- this.eventListeners.push(this.renderer.listen(this.el.nativeElement, 'mouseleave', (event) => {
6879
- this.close();
6882
+ this.eventListeners.push(this.renderer.listen(this.el.nativeElement, 'mouseleave', () => {
6883
+ this.startCloseTimeout();
6880
6884
  }));
6881
6885
  this.eventListeners.push(this.renderer.listen(this.el.nativeElement, 'mousemove', (event) => {
6882
6886
  if (!this.chrHoverSnap()) {
@@ -6886,6 +6890,8 @@ class ChrHoverDirective {
6886
6890
  }));
6887
6891
  }
6888
6892
  ngOnDestroy() {
6893
+ this.clearCloseTimeout();
6894
+ this.clearOverlayListeners();
6889
6895
  this.overlayRef.dispose();
6890
6896
  this.removeEventListeners();
6891
6897
  }
@@ -6893,19 +6899,44 @@ class ChrHoverDirective {
6893
6899
  this.eventListeners.forEach((unlisten) => unlisten());
6894
6900
  this.eventListeners = [];
6895
6901
  }
6902
+ startCloseTimeout() {
6903
+ this.clearCloseTimeout();
6904
+ this.closeTimeout = window.setTimeout(() => this.close(), this.chrHoverCloseDelay());
6905
+ }
6906
+ clearCloseTimeout() {
6907
+ if (this.closeTimeout != null) {
6908
+ clearTimeout(this.closeTimeout);
6909
+ this.closeTimeout = null;
6910
+ }
6911
+ }
6912
+ clearOverlayListeners() {
6913
+ this.overlayEventListeners.forEach((u) => u());
6914
+ this.overlayEventListeners = [];
6915
+ }
6896
6916
  open() {
6897
6917
  if (!this.overlayRef.hasAttached()) {
6898
6918
  if (!this.portal) {
6899
6919
  this.portal = new TemplatePortal(this.template, this.vcr, this.chrHoverContext());
6900
6920
  }
6901
6921
  const ref = this.overlayRef.attach(this.portal);
6922
+ // keep overlay open when overlay itself is hovered
6923
+ const overlayEl = this.overlayRef.overlayElement;
6924
+ this.clearOverlayListeners();
6925
+ this.overlayEventListeners.push(this.renderer.listen(overlayEl, 'mouseenter', () => {
6926
+ this.clearCloseTimeout();
6927
+ }));
6928
+ this.overlayEventListeners.push(this.renderer.listen(overlayEl, 'mouseleave', () => {
6929
+ this.startCloseTimeout();
6930
+ }));
6902
6931
  }
6903
6932
  }
6904
6933
  close() {
6934
+ this.clearCloseTimeout();
6935
+ this.clearOverlayListeners();
6905
6936
  this.overlayRef.detach();
6906
6937
  }
6907
6938
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ChrHoverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
6908
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.8", type: ChrHoverDirective, isStandalone: true, selector: "[chrHover]", inputs: { template: { classPropertyName: "template", publicName: "chrHover", isSignal: false, isRequired: false, transformFunction: null }, chrHoverContext: { classPropertyName: "chrHoverContext", publicName: "chrHoverContext", isSignal: true, isRequired: false, transformFunction: null }, chrHoverSnap: { classPropertyName: "chrHoverSnap", publicName: "chrHoverSnap", isSignal: true, isRequired: false, transformFunction: null }, chrHoverPosition: { classPropertyName: "chrHoverPosition", publicName: "chrHoverPosition", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
6939
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.8", type: ChrHoverDirective, isStandalone: true, selector: "[chrHover]", inputs: { template: { classPropertyName: "template", publicName: "chrHover", isSignal: false, isRequired: false, transformFunction: null }, chrHoverContext: { classPropertyName: "chrHoverContext", publicName: "chrHoverContext", isSignal: true, isRequired: false, transformFunction: null }, chrHoverSnap: { classPropertyName: "chrHoverSnap", publicName: "chrHoverSnap", isSignal: true, isRequired: false, transformFunction: null }, chrHoverPosition: { classPropertyName: "chrHoverPosition", publicName: "chrHoverPosition", isSignal: true, isRequired: false, transformFunction: null }, chrHoverCloseDelay: { classPropertyName: "chrHoverCloseDelay", publicName: "chrHoverCloseDelay", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
6909
6940
  }
6910
6941
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: ChrHoverDirective, decorators: [{
6911
6942
  type: Directive,
@@ -6915,7 +6946,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
6915
6946
  }], ctorParameters: () => [], propDecorators: { template: [{
6916
6947
  type: Input,
6917
6948
  args: ['chrHover']
6918
- }], chrHoverContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrHoverContext", required: false }] }], chrHoverSnap: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrHoverSnap", required: false }] }], chrHoverPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrHoverPosition", required: false }] }] } });
6949
+ }], chrHoverContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrHoverContext", required: false }] }], chrHoverSnap: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrHoverSnap", required: false }] }], chrHoverPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrHoverPosition", required: false }] }], chrHoverCloseDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "chrHoverCloseDelay", required: false }] }] } });
6919
6950
 
6920
6951
  class CsvExporter {
6921
6952
  export(data, columns) {