@stemy/ngx-utils 13.2.0 → 13.2.2

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, TemplateRef, PLATFORM_ID, Injectable, Inject, Optional, Injector, EventEmitter, isDevMode, ErrorHandler, NgZone, Pipe, Directive, Input, Output, HostBinding, HostListener, Component, ContentChildren, ViewChild, ContentChild, APP_INITIALIZER, NgModule } from '@angular/core';
3
3
  import 'reflect-metadata';
4
- import { utc } from 'moment';
4
+ import moment from 'moment';
5
5
  import { first, skipWhile, mergeMap, timeout, map } from 'rxjs/operators';
6
6
  import { Subject, BehaviorSubject, Observable, Subscription, from, TimeoutError, combineLatest } from 'rxjs';
7
7
  import { Invokable } from 'invokable';
@@ -17,13 +17,13 @@ import { HttpClient, HttpHeaders, HttpParams, HttpUrlEncodingCodec, HttpEventTyp
17
17
  import * as JSON5 from 'json5';
18
18
  import * as i1$2 from '@angular/platform-browser';
19
19
  import { ɵDomEventsPlugin, EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
20
- import { addListener, removeListener } from 'resize-detector';
20
+ import * as detector from 'resize-detector';
21
21
  import * as i4 from '@angular/forms';
22
22
  import { FormsModule } from '@angular/forms';
23
23
 
24
24
  const defaultPredicate = () => true;
25
- const hasBlob = typeof Blob !== "undefined";
26
- const hasFile = typeof File !== "undefined";
25
+ const hasBlob = typeof Blob !== "undefined" && !!Blob;
26
+ const hasFile = typeof File !== "undefined" && !!File;
27
27
  class ObjectUtils {
28
28
  static compare(a, b) {
29
29
  if ((a === null || b === null) || (typeof a != typeof b)) {
@@ -480,21 +480,22 @@ AjaxRequestHandler.isOverridden = false;
480
480
 
481
481
  class DateUtils {
482
482
  static isHoliday(date) {
483
- return utc(date).isoWeekday() > 5;
483
+ return moment(date).isoWeekday() > 5;
484
484
  }
485
485
  static isBusinessDay(date) {
486
- return utc(date).isoWeekday() < 6;
486
+ return moment(date).isoWeekday() < 6;
487
487
  }
488
488
  static add(date, amount, unit) {
489
- return utc(date).add(amount, unit).toDate();
489
+ return moment(date).add(amount, unit).toDate();
490
490
  }
491
- static businessAdd(date, amount, unit) {
491
+ static businessAdd(date, amount, unit, freeDays = []) {
492
492
  const signal = amount < 0 ? -1 : 1;
493
+ const freeMoments = freeDays.map(d => moment(d));
493
494
  let remaining = Math.abs(amount);
494
495
  let day = date;
495
496
  while (remaining) {
496
497
  day = DateUtils.add(day, signal, unit);
497
- if (DateUtils.isBusinessDay(day)) {
498
+ if (DateUtils.isBusinessDay(day) && !freeMoments.some(m => m.isSame(day, "day"))) {
498
499
  remaining--;
499
500
  }
500
501
  }
@@ -1281,7 +1282,7 @@ class UniversalService {
1281
1282
  this.platformId = platformId;
1282
1283
  this.dds = dds;
1283
1284
  const info = this.dds.getDeviceInfo();
1284
- this.crawler = /(bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|lighthouse|angular-universal|PTST)/gi.test(info.userAgent);
1285
+ this.crawler = /(bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|lighthouse|angular-universal|PTST|PostmanRuntime)/gi.test(info.userAgent);
1285
1286
  }
1286
1287
  get isBrowser() {
1287
1288
  return isPlatformBrowser(this.platformId);
@@ -3364,7 +3365,7 @@ class ResizeEventPlugin extends ɵDomEventsPlugin {
3364
3365
  element.addEventListener(eventName, cb);
3365
3366
  }
3366
3367
  else {
3367
- addListener(element, cb);
3368
+ detector.addListener(element, cb);
3368
3369
  }
3369
3370
  return () => {
3370
3371
  try {
@@ -3372,7 +3373,7 @@ class ResizeEventPlugin extends ɵDomEventsPlugin {
3372
3373
  element.removeEventListener(eventName, cb);
3373
3374
  }
3374
3375
  else {
3375
- removeListener(element, cb);
3376
+ detector.removeListener(element, cb);
3376
3377
  }
3377
3378
  }
3378
3379
  catch (e) {
@@ -3869,7 +3870,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
3869
3870
 
3870
3871
  class ReplacePipe {
3871
3872
  transform(value, from, to) {
3872
- return value ? value.replace(from, to) : value;
3873
+ return ObjectUtils.isDefined(value) ? `${value}`.replace(from, to) : ``;
3873
3874
  }
3874
3875
  }
3875
3876
  ReplacePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: ReplacePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });