This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, ElementRef, EventEmitter, HostListener, Input, Output } from '@angular/core'; | |
export interface ZoomEvent { | |
direction: 'in' | 'out'; | |
delta: number; | |
scrollLeft?: number; | |
scrollTop?: number; | |
} | |
export interface ZoomOptions { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { addDays, getHours, isAfter, isBefore, parse, setHours, startOfDay, subDays } from 'date-fns'; | |
export class dateUtil { | |
/** | |
* Find the correct date format, by comparing two consecutive days. | |
* | |
* @param date The date string to find the format for | |
* @param refDate The date string to compare. This should be either the next or previous day. | |
* This is only needed to determine if the day is before or after the month in the format. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, HostListener, signal } from '@angular/core'; | |
@Directive({ selector: '[flxInput]', standalone: true }) | |
export class PreventZoomDirective { | |
zoomDisabled = signal(false); | |
hasFocus = signal(false); | |
get meta() { | |
return Array.from(document.getElementsByTagName('meta') || []).find(m => m?.getAttribute('name') === 'viewport'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Debounce function decorator | |
* | |
* @param delay | |
* @param immediate | |
* @returns the function debounced | |
*/ | |
export function Debouncer(delay = 200, immediate = false): MethodDecorator { | |
return function (target: Record<string, unknown>, propertyKey: string | symbol, descriptor: PropertyDescriptor) { | |
const map = new WeakMap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, EventEmitter } from '@angular/core'; | |
import { HttpInterceptor, HttpRequest, HttpHandler, HttpSentEvent, HttpHeaderResponse, HttpProgressEvent, HttpResponse, HttpUserEvent, HttpClient } from '@angular/common/http'; | |
import { Observable, Observer, Subscription, throwError, timer } from 'rxjs'; | |
import { retryWhen, mergeMap, finalize } from 'rxjs/operators'; | |
@Injectable() | |
export class NetworkQueueInterceptor implements HttpInterceptor { | |
onChanges = new EventEmitter<boolean>(); | |
private lastValue = this.isOnline(); |