@bizy/core 19.17.2 → 19.17.3

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.
@@ -2,8 +2,8 @@ import * as i0 from '@angular/core';
2
2
  import { EventEmitter, ChangeDetectorRef, Output, Input, Inject, ChangeDetectionStrategy, Component, NgModule, inject, Renderer2, ElementRef, Injectable, Directive, ViewChild, ContentChildren, ContentChild, Pipe, ViewContainerRef, TemplateRef, RendererFactory2, HostListener, Host } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule, DOCUMENT, registerLocaleData, DatePipe } from '@angular/common';
5
- import { Subject, Subscription, BehaviorSubject, filter, take, skip, auditTime, throttleTime, debounceTime as debounceTime$1, interval, fromEvent, merge, timer, of } from 'rxjs';
6
- import { debounceTime, distinctUntilChanged, takeUntil, map, filter as filter$1, switchMap, take as take$1 } from 'rxjs/operators';
5
+ import { Subject, Subscription, BehaviorSubject, filter, take, skip, auditTime, throttleTime, debounceTime as debounceTime$1, interval, fromEvent, merge } from 'rxjs';
6
+ import { debounceTime, distinctUntilChanged, takeUntil, map, filter as filter$1, take as take$1 } from 'rxjs/operators';
7
7
  import * as echarts from 'echarts';
8
8
  import html2canvas from 'html2canvas';
9
9
  import * as i2 from 'angular-calendar';
@@ -7623,40 +7623,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
7623
7623
  }] } });
7624
7624
 
7625
7625
  class BizyLongPressDirective {
7626
- #elementRef = inject(ElementRef);
7627
7626
  threshold = 500;
7628
7627
  bizyLongPress = new EventEmitter();
7629
- #event;
7630
- constructor() {
7631
- const mousedown = fromEvent(this.#elementRef.nativeElement, 'mousedown').pipe(filter$1((event) => event.button == 0), // Only allow left button (Primary button)
7632
- map(() => true) // turn on threshold counter
7633
- );
7634
- const touchstart = fromEvent(this.#elementRef.nativeElement, 'touchstart').pipe(map(() => true));
7635
- const touchEnd = fromEvent(this.#elementRef.nativeElement, 'touchend').pipe(map(() => false));
7636
- const mouseup = fromEvent(window, 'mouseup').pipe(filter$1((event) => event.button == 0), // Only allow left button (Primary button)
7637
- map(() => false) // reset threshold counter
7638
- );
7639
- this.#event = merge(mousedown, mouseup, touchstart, touchEnd)
7640
- .pipe(switchMap(state => (state ? timer(this.threshold, 100) : of(null))), filter$1(value => Boolean(value)))
7641
- .subscribe(() => this.bizyLongPress.emit());
7628
+ #pressTimeout = null;
7629
+ onPressStart(event) {
7630
+ this.clearTimeout(); // Clear any existing timeout
7631
+ this.#pressTimeout = setTimeout(() => {
7632
+ this.bizyLongPress.emit(event);
7633
+ }, this.threshold);
7642
7634
  }
7643
- ngOnDestroy() {
7644
- if (this.#event) {
7645
- this.#event.unsubscribe();
7635
+ onPressEnd() {
7636
+ this.clearTimeout();
7637
+ }
7638
+ clearTimeout() {
7639
+ if (this.#pressTimeout) {
7640
+ clearTimeout(this.#pressTimeout);
7641
+ this.#pressTimeout = null;
7646
7642
  }
7647
7643
  }
7644
+ ngOnDestroy() {
7645
+ this.clearTimeout();
7646
+ }
7648
7647
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyLongPressDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
7649
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: BizyLongPressDirective, isStandalone: true, selector: "[bizyLongPress]", inputs: { threshold: "threshold" }, outputs: { bizyLongPress: "bizyLongPress" }, ngImport: i0 });
7648
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: BizyLongPressDirective, isStandalone: true, selector: "[bizyLongPress]", inputs: { threshold: "threshold" }, outputs: { bizyLongPress: "bizyLongPress" }, host: { listeners: { "mousedown": "onPressStart($event)", "touchstart": "onPressStart($event)", "mouseup": "onPressEnd()", "mouseleave": "onPressEnd()", "touchend": "onPressEnd()", "touchcancel": "onPressEnd()" } }, ngImport: i0 });
7650
7649
  }
7651
7650
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: BizyLongPressDirective, decorators: [{
7652
7651
  type: Directive,
7653
7652
  args: [{
7654
7653
  selector: '[bizyLongPress]',
7655
7654
  }]
7656
- }], ctorParameters: () => [], propDecorators: { threshold: [{
7655
+ }], propDecorators: { threshold: [{
7657
7656
  type: Input
7658
7657
  }], bizyLongPress: [{
7659
7658
  type: Output
7659
+ }], onPressStart: [{
7660
+ type: HostListener,
7661
+ args: ['mousedown', ['$event']]
7662
+ }, {
7663
+ type: HostListener,
7664
+ args: ['touchstart', ['$event']]
7665
+ }], onPressEnd: [{
7666
+ type: HostListener,
7667
+ args: ['mouseup']
7668
+ }, {
7669
+ type: HostListener,
7670
+ args: ['mouseleave']
7671
+ }, {
7672
+ type: HostListener,
7673
+ args: ['touchend']
7674
+ }, {
7675
+ type: HostListener,
7676
+ args: ['touchcancel']
7660
7677
  }] } });
7661
7678
 
7662
7679
  class BizyOnlyNumbersDirective {