@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,6 +1,6 @@
1
- import { InjectionToken, TemplateRef, Injectable, Inject, PLATFORM_ID, Injector, NgZone, Optional, EventEmitter, isDevMode, ErrorHandler, Pipe, ChangeDetectorRef, Input, Output, HostBinding, HostListener, Directive, ElementRef, Renderer2, ViewContainerRef, Component, ContentChildren, ViewChild, ContentChild, APP_INITIALIZER, NgModule } from '@angular/core';
1
+ import { InjectionToken, TemplateRef, Injectable, Inject, PLATFORM_ID, Injector, NgZone, Optional, EventEmitter, isDevMode, ErrorHandler, Pipe, ChangeDetectorRef, Directive, Input, Output, HostBinding, HostListener, ElementRef, Renderer2, ViewContainerRef, Component, ContentChildren, ViewChild, ContentChild, APP_INITIALIZER, NgModule } from '@angular/core';
2
2
  import 'reflect-metadata';
3
- import { utc } from 'moment';
3
+ import moment from 'moment';
4
4
  import { first, skipWhile, mergeMap, timeout, map } from 'rxjs/operators';
5
5
  import { Subject, BehaviorSubject, Observable, Subscription, from, TimeoutError, combineLatest } from 'rxjs';
6
6
  import { Invokable } from 'invokable';
@@ -15,8 +15,8 @@ import { FormsModule } from '@angular/forms';
15
15
 
16
16
  const defaultPredicate = () => true;
17
17
  const ɵ0 = defaultPredicate;
18
- const hasBlob = typeof Blob !== "undefined";
19
- const hasFile = typeof File !== "undefined";
18
+ const hasBlob = typeof Blob !== "undefined" && !!Blob;
19
+ const hasFile = typeof File !== "undefined" && !!File;
20
20
  class ObjectUtils {
21
21
  static compare(a, b) {
22
22
  if ((a === null || b === null) || (typeof a != typeof b)) {
@@ -472,21 +472,22 @@ AjaxRequestHandler.isOverridden = false;
472
472
 
473
473
  class DateUtils {
474
474
  static isHoliday(date) {
475
- return utc(date).isoWeekday() > 5;
475
+ return moment(date).isoWeekday() > 5;
476
476
  }
477
477
  static isBusinessDay(date) {
478
- return utc(date).isoWeekday() < 6;
478
+ return moment(date).isoWeekday() < 6;
479
479
  }
480
480
  static add(date, amount, unit) {
481
- return utc(date).add(amount, unit).toDate();
481
+ return moment(date).add(amount, unit).toDate();
482
482
  }
483
- static businessAdd(date, amount, unit) {
483
+ static businessAdd(date, amount, unit, freeDays = []) {
484
484
  const signal = amount < 0 ? -1 : 1;
485
+ const freeMoments = freeDays.map(d => moment(d));
485
486
  let remaining = Math.abs(amount);
486
487
  let day = date;
487
488
  while (remaining) {
488
489
  day = DateUtils.add(day, signal, unit);
489
- if (DateUtils.isBusinessDay(day)) {
490
+ if (DateUtils.isBusinessDay(day) && !freeMoments.some(m => m.isSame(day, "day"))) {
490
491
  remaining--;
491
492
  }
492
493
  }
@@ -1273,7 +1274,7 @@ class UniversalService {
1273
1274
  this.platformId = platformId;
1274
1275
  this.dds = dds;
1275
1276
  const info = this.dds.getDeviceInfo();
1276
- this.crawler = /(bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|lighthouse|angular-universal|PTST)/gi.test(info.userAgent);
1277
+ this.crawler = /(bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|lighthouse|angular-universal|PTST|PostmanRuntime)/gi.test(info.userAgent);
1277
1278
  }
1278
1279
  get isBrowser() {
1279
1280
  return isPlatformBrowser(this.platformId);
@@ -3705,7 +3706,7 @@ RemapPipe.decorators = [
3705
3706
 
3706
3707
  class ReplacePipe {
3707
3708
  transform(value, from, to) {
3708
- return value ? value.replace(from, to) : value;
3709
+ return ObjectUtils.isDefined(value) ? `${value}`.replace(from, to) : ``;
3709
3710
  }
3710
3711
  }
3711
3712
  ReplacePipe.decorators = [
@@ -3907,6 +3908,9 @@ class AsyncMethodBase {
3907
3908
  get isLoading() {
3908
3909
  return this.loading;
3909
3910
  }
3911
+ getMethod() {
3912
+ return null;
3913
+ }
3910
3914
  click() {
3911
3915
  if (this.disabled)
3912
3916
  return;
@@ -3938,6 +3942,14 @@ class AsyncMethodBase {
3938
3942
  return true;
3939
3943
  }
3940
3944
  }
3945
+ AsyncMethodBase.decorators = [
3946
+ { type: Directive, args: [{
3947
+ selector: "[_abstract_asyncMethodBase]"
3948
+ },] }
3949
+ ];
3950
+ AsyncMethodBase.ctorParameters = () => [
3951
+ { type: undefined, decorators: [{ type: Inject, args: [TOASTER_SERVICE,] }] }
3952
+ ];
3941
3953
  AsyncMethodBase.propDecorators = {
3942
3954
  disabled: [{ type: Input }],
3943
3955
  context: [{ type: Input }],
@@ -3949,9 +3961,6 @@ AsyncMethodBase.propDecorators = {
3949
3961
  };
3950
3962
 
3951
3963
  class AsyncMethodDirective extends AsyncMethodBase {
3952
- constructor(toaster) {
3953
- super(toaster);
3954
- }
3955
3964
  getMethod() {
3956
3965
  return this.method;
3957
3966
  }
@@ -3962,9 +3971,6 @@ AsyncMethodDirective.decorators = [
3962
3971
  exportAs: "async-method"
3963
3972
  },] }
3964
3973
  ];
3965
- AsyncMethodDirective.ctorParameters = () => [
3966
- { type: undefined, decorators: [{ type: Inject, args: [TOASTER_SERVICE,] }] }
3967
- ];
3968
3974
  AsyncMethodDirective.propDecorators = {
3969
3975
  method: [{ type: Input, args: ["async-method",] }]
3970
3976
  };
@@ -4397,6 +4403,39 @@ StickyDirective.propDecorators = {
4397
4403
  updateSticky: [{ type: HostListener, args: ["window:resize",] }, { type: HostListener, args: ["window:scroll",] }]
4398
4404
  };
4399
4405
 
4406
+ class StickyClassDirective {
4407
+ constructor(events, element, renderer) {
4408
+ this.events = events;
4409
+ this.element = element;
4410
+ this.renderer = renderer;
4411
+ }
4412
+ ngOnInit() {
4413
+ this.stickyUpdated = this.events.stickyUpdated.subscribe(() => {
4414
+ if (this.events.isSticky) {
4415
+ this.renderer.addClass(this.element.nativeElement, this.stickyClass || "sticky-sibling");
4416
+ return;
4417
+ }
4418
+ this.renderer.removeClass(this.element.nativeElement, this.stickyClass || "sticky-sibling");
4419
+ });
4420
+ }
4421
+ ngOnDestroy() {
4422
+ this.stickyUpdated.unsubscribe();
4423
+ }
4424
+ }
4425
+ StickyClassDirective.decorators = [
4426
+ { type: Directive, args: [{
4427
+ selector: "[stickyClass]"
4428
+ },] }
4429
+ ];
4430
+ StickyClassDirective.ctorParameters = () => [
4431
+ { type: EventsService },
4432
+ { type: ElementRef },
4433
+ { type: Renderer2 }
4434
+ ];
4435
+ StickyClassDirective.propDecorators = {
4436
+ stickyClass: [{ type: Input }]
4437
+ };
4438
+
4400
4439
  class UnorderedListItemDirective {
4401
4440
  constructor(elementRef, renderer, viewContainer) {
4402
4441
  this.elementRef = elementRef;
@@ -4762,39 +4801,6 @@ PaginationMenuComponent.propDecorators = {
4762
4801
  boundaryLinks: [{ type: Input }]
4763
4802
  };
4764
4803
 
4765
- class StickyClassDirective {
4766
- constructor(events, element, renderer) {
4767
- this.events = events;
4768
- this.element = element;
4769
- this.renderer = renderer;
4770
- }
4771
- ngOnInit() {
4772
- this.stickyUpdated = this.events.stickyUpdated.subscribe(() => {
4773
- if (this.events.isSticky) {
4774
- this.renderer.addClass(this.element.nativeElement, this.stickyClass || "sticky-sibling");
4775
- return;
4776
- }
4777
- this.renderer.removeClass(this.element.nativeElement, this.stickyClass || "sticky-sibling");
4778
- });
4779
- }
4780
- ngOnDestroy() {
4781
- this.stickyUpdated.unsubscribe();
4782
- }
4783
- }
4784
- StickyClassDirective.decorators = [
4785
- { type: Directive, args: [{
4786
- selector: "[stickyClass]"
4787
- },] }
4788
- ];
4789
- StickyClassDirective.ctorParameters = () => [
4790
- { type: EventsService },
4791
- { type: ElementRef },
4792
- { type: Renderer2 }
4793
- ];
4794
- StickyClassDirective.propDecorators = {
4795
- stickyClass: [{ type: Input }]
4796
- };
4797
-
4798
4804
  // --- Pipes ---
4799
4805
  const pipes = [
4800
4806
  ChunkPipe,
@@ -4827,6 +4833,7 @@ const pipes = [
4827
4833
  ];
4828
4834
  // --- Directives ---
4829
4835
  const directives = [
4836
+ AsyncMethodBase,
4830
4837
  AsyncMethodDirective,
4831
4838
  BackgroundDirective,
4832
4839
  DynamicTableTemplateDirective,
@@ -4970,5 +4977,5 @@ NgxUtilsModule.decorators = [
4970
4977
  * Generated bundle index. Do not edit.
4971
4978
  */
4972
4979
 
4973
- export { API_SERVICE, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileSystemEntry, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GLOBAL_TEMPLATES, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UnorederedListTemplate, ValuedPromise, ValuesPipe, Vector, pipes as ɵa, directives as ɵb, components as ɵc, providers as ɵd, loadConfig as ɵe, StickyClassDirective as ɵf };
4980
+ export { API_SERVICE, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileSystemEntry, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GLOBAL_TEMPLATES, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UnorederedListTemplate, ValuedPromise, ValuesPipe, Vector, pipes as ɵa, directives as ɵb, components as ɵc, providers as ɵd, loadConfig as ɵe };
4974
4981
  //# sourceMappingURL=stemy-ngx-utils.js.map