igniteui-angular 17.2.26 → 17.2.27

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,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, Directive, Input, HostListener, isDevMode, PLATFORM_ID, Inject, EventEmitter, ViewContainerRef, ElementRef, InjectionToken, Optional, Output, HostBinding, Self, booleanAttribute, SecurityContext, TemplateRef, Component, ViewChild, ContentChildren, ContentChild, RendererStyleFlags2, Pipe, inject, LOCALE_ID, forwardRef, Host, QueryList, ViewChildren, ChangeDetectionStrategy, SimpleChange, SkipSelf, createComponent, CUSTOM_ELEMENTS_SCHEMA, reflectComponentType, NgModule } from '@angular/core';
3
3
  import * as i4 from '@angular/forms';
4
4
  import { NgModel, NgControl, FormControlName, NG_VALUE_ACCESSOR, Validators, NG_VALIDATORS, FormGroup, FormsModule, RequiredValidator, MinValidator, MaxValidator, EmailValidator, MinLengthValidator, MaxLengthValidator, PatternValidator, FormControl, ReactiveFormsModule } from '@angular/forms';
5
- import { Observable, Subject, fromEvent, interval, animationFrameScheduler, noop, merge, Subscription, timer, pipe } from 'rxjs';
5
+ import { Observable, NEVER, Subject, fromEvent, interval, animationFrameScheduler, noop, merge, Subscription, timer, takeUntil as takeUntil$1, pipe } from 'rxjs';
6
6
  import { takeUntil, filter, first as first$2, throttle, throttleTime, startWith, take, debounce, tap, switchMap, skipLast, debounceTime, map, shareReplay, takeWhile, pluck } from 'rxjs/operators';
7
7
  import { isPlatformBrowser, formatDate as formatDate$1, CurrencyPipe, formatPercent, formatNumber, getLocaleCurrencyCode, DatePipe, getLocaleDateFormat, FormatWidth, getLocaleDateTimeFormat, DOCUMENT, NgTemplateOutlet, NgIf, NgClass, NgSwitch, NgSwitchCase, NgSwitchDefault, NgFor, TitleCasePipe, getLocaleFirstDayOfWeek, NgStyle, getLocaleCurrencySymbol, formatCurrency as formatCurrency$1, getLocaleNumberFormat, NumberFormatStyle, DecimalPipe, PercentPipe, getCurrencySymbol, AsyncPipe } from '@angular/common';
8
8
  import { mergeWith, isEqual as isEqual$1 } from 'lodash-es';
@@ -359,7 +359,9 @@ const isObject = (value) => !!(value && value.toString() === '[object Object]');
359
359
  * @returns true if provided variable is Date
360
360
  * @hidden
361
361
  */
362
- const isDate = (value) => value instanceof Date;
362
+ const isDate = (value) => {
363
+ return Object.prototype.toString.call(value) === "[object Date]";
364
+ };
363
365
  /**
364
366
  * Checks if the two passed arguments are equal
365
367
  * Currently supports date objects
@@ -554,14 +556,24 @@ const HEADER_KEYS = new Set([...Array.from(NAVIGATION_KEYS), 'escape', 'esc', 'l
554
556
  * Run the resizeObservable outside angular zone, because it patches the MutationObserver which causes an infinite loop.
555
557
  * Related issue: https://github.com/angular/angular/issues/31712
556
558
  */
557
- const resizeObservable = (target) => new Observable((observer) => {
558
- const instance = new (getResizeObserver())((entries) => {
559
- observer.next(entries);
560
- });
561
- instance.observe(target);
562
- const unsubscribe = () => instance.disconnect();
563
- return unsubscribe;
564
- });
559
+ const resizeObservable = (target) => {
560
+ const resizeObserver = getResizeObserver();
561
+ // check whether we are on server env or client env
562
+ if (resizeObserver) {
563
+ return new Observable((observer) => {
564
+ const instance = new resizeObserver((entries) => {
565
+ observer.next(entries);
566
+ });
567
+ instance.observe(target);
568
+ const unsubscribe = () => instance.disconnect();
569
+ return unsubscribe;
570
+ });
571
+ }
572
+ else {
573
+ // if on a server env return a empty observable that does not complete immediately
574
+ return NEVER;
575
+ }
576
+ };
565
577
  /**
566
578
  * @hidden
567
579
  * @internal
@@ -4693,7 +4705,9 @@ class IgxAngularAnimationPlayer {
4693
4705
  // To workaround this we are getting the positions from the inner player.
4694
4706
  // This is logged in Angular here - https://github.com/angular/angular/issues/18891
4695
4707
  // As soon as this is resolved we can remove this hack
4696
- this._innerPlayer = innerRenderer.engine.players[innerRenderer.engine.players.length - 1];
4708
+ const rendererEngine = innerRenderer.engine || innerRenderer.delegate.engine;
4709
+ // A workaround because of Angular SSR is using some delegation.
4710
+ this._innerPlayer = rendererEngine.players[rendererEngine.players.length - 1];
4697
4711
  }
4698
4712
  init() {
4699
4713
  this.internalPlayer.init();
@@ -10619,9 +10633,7 @@ class IgxDragDirective {
10619
10633
  fromEvent(document.defaultView, 'mouseup').pipe(takeUntil(this._destroy))
10620
10634
  .subscribe((res) => this.onPointerUp(res));
10621
10635
  }
10622
- this.element.nativeElement.addEventListener('transitionend', (args) => {
10623
- this.onTransitionEnd(args);
10624
- });
10636
+ this.element.nativeElement.addEventListener('transitionend', this.onTransitionEnd.bind(this));
10625
10637
  });
10626
10638
  // Set transition duration to 0s. This also helps with setting `visibility: hidden` to the base to not lag.
10627
10639
  this.element.nativeElement.style.transitionDuration = '0.0s';
@@ -10640,6 +10652,7 @@ class IgxDragDirective {
10640
10652
  this._dynamicGhostRef = null;
10641
10653
  }
10642
10654
  }
10655
+ this.element.nativeElement.removeEventListener('transitionend', this.onTransitionEnd);
10643
10656
  if (this._containerScrollIntervalId) {
10644
10657
  clearInterval(this._containerScrollIntervalId);
10645
10658
  this._containerScrollIntervalId = null;
@@ -11024,12 +11037,7 @@ class IgxDragDirective {
11024
11037
  if (ghostDestroyArgs.cancel) {
11025
11038
  return;
11026
11039
  }
11027
- this.ghostElement.remove();
11028
- this.ghostElement = null;
11029
- if (this._dynamicGhostRef) {
11030
- this._dynamicGhostRef.destroy();
11031
- this._dynamicGhostRef = null;
11032
- }
11040
+ this.clearGhost();
11033
11041
  }
11034
11042
  else if (!this.ghost) {
11035
11043
  this.element.nativeElement.style.transitionProperty = '';
@@ -11051,6 +11059,18 @@ class IgxDragDirective {
11051
11059
  });
11052
11060
  });
11053
11061
  }
11062
+ clearGhost() {
11063
+ this.ghostElement.removeEventListener('pointermove', this.onPointerMove);
11064
+ this.ghostElement.removeEventListener('pointerup', this.onPointerUp);
11065
+ this.ghostElement.removeEventListener('lostpointercapture', this.onPointerLost);
11066
+ this.ghostElement.removeEventListener('transitionend', this.onTransitionEnd);
11067
+ this.ghostElement.remove();
11068
+ this.ghostElement = null;
11069
+ if (this._dynamicGhostRef) {
11070
+ this._dynamicGhostRef.destroy();
11071
+ this._dynamicGhostRef = null;
11072
+ }
11073
+ }
11054
11074
  /**
11055
11075
  * @hidden
11056
11076
  * Create ghost element - if a Node object is provided it creates a clone of that node,
@@ -11120,20 +11140,12 @@ class IgxDragDirective {
11120
11140
  if (this._pointerDownId !== null) {
11121
11141
  this.ghostElement.setPointerCapture(this._pointerDownId);
11122
11142
  }
11123
- this.ghostElement.addEventListener('pointermove', (args) => {
11124
- this.onPointerMove(args);
11125
- });
11126
- this.ghostElement.addEventListener('pointerup', (args) => {
11127
- this.onPointerUp(args);
11128
- });
11129
- this.ghostElement.addEventListener('lostpointercapture', (args) => {
11130
- this.onPointerLost(args);
11131
- });
11143
+ this.ghostElement.addEventListener('pointermove', this.onPointerMove.bind(this));
11144
+ this.ghostElement.addEventListener('pointerup', this.onPointerUp.bind(this));
11145
+ this.ghostElement.addEventListener('lostpointercapture', this.onPointerLost.bind(this));
11132
11146
  }
11133
11147
  // Transition animation when the ghostElement is released and it returns to it's original position.
11134
- this.ghostElement.addEventListener('transitionend', (args) => {
11135
- this.onTransitionEnd(args);
11136
- });
11148
+ this.ghostElement.addEventListener('transitionend', this.onTransitionEnd.bind(this));
11137
11149
  this.cdr.detectChanges();
11138
11150
  }
11139
11151
  /**
@@ -13175,8 +13187,10 @@ class IgxForOfDirective extends IgxForOfToken {
13175
13187
  ngAfterViewInit() {
13176
13188
  if (this.igxForScrollOrientation === 'vertical') {
13177
13189
  this._zone.runOutsideAngular(() => {
13178
- this.contentObserver = new (getResizeObserver())(() => this.contentResizeNotify.next());
13179
- this.contentObserver.observe(this.dc.instance._viewContainer.element.nativeElement);
13190
+ if (this.platformUtil.isBrowser) {
13191
+ this.contentObserver = new (getResizeObserver())(() => this.contentResizeNotify.next());
13192
+ this.contentObserver.observe(this.dc.instance._viewContainer.element.nativeElement);
13193
+ }
13180
13194
  });
13181
13195
  }
13182
13196
  }
@@ -28044,7 +28058,7 @@ const IGX_BUTTON_GROUP_DIRECTIVES = [
28044
28058
  const daysInWeek = 7;
28045
28059
  const millisecondsInDay = 86400000;
28046
28060
  function toCalendarDay(date) {
28047
- return date instanceof Date ? CalendarDay.from(date) : date;
28061
+ return isDate(date) ? CalendarDay.from(date) : date;
28048
28062
  }
28049
28063
  function checkRollover(original, modified) {
28050
28064
  return original.date !== modified.date
@@ -28671,7 +28685,7 @@ class IgxCalendarViewDirective {
28671
28685
  * @memberof IgxYearsViewComponent
28672
28686
  */
28673
28687
  set date(value) {
28674
- if (!(value instanceof Date))
28688
+ if (!isDate(value))
28675
28689
  return;
28676
28690
  this._date = value;
28677
28691
  }
@@ -53876,7 +53890,7 @@ class IgxColumnMovingDragDirective extends IgxDragDirective {
53876
53890
  source: this.column
53877
53891
  };
53878
53892
  this.column.grid.columnMovingStart.emit(movingStartArgs);
53879
- this.subscription$ = fromEvent(this.column.grid.document.defaultView, 'keydown').subscribe((ev) => {
53893
+ this.subscription$ = fromEvent(this.column.grid.document.defaultView, 'keydown').pipe(takeUntil$1(this._destroy)).subscribe((ev) => {
53880
53894
  if (ev.key === this.platformUtil.KEYMAP.ESCAPE) {
53881
53895
  this.onEscape(ev);
53882
53896
  }
@@ -63285,7 +63299,7 @@ class IgxGridBaseDirective extends DisplayDensityBase {
63285
63299
  .subscribe((change) => {
63286
63300
  this.onPinnedRowsChanged(change);
63287
63301
  });
63288
- this.addRowSnackbar?.clicked.subscribe(() => {
63302
+ this.addRowSnackbar?.clicked.pipe(takeUntil(this.destroy$)).subscribe(() => {
63289
63303
  const rec = this.filteredSortedData[this.lastAddedRowIndex];
63290
63304
  this.scrollTo(rec, 0);
63291
63305
  this.addRowSnackbar.close();
@@ -86153,9 +86167,10 @@ class IgxTabsComponent extends IgxTabsDirective {
86153
86167
  this.realignSelectedIndicator();
86154
86168
  });
86155
86169
  }
86156
- constructor(animationService, cdr, ngZone, dir) {
86170
+ constructor(animationService, cdr, ngZone, platform, dir) {
86157
86171
  super(animationService, cdr, dir);
86158
86172
  this.ngZone = ngZone;
86173
+ this.platform = platform;
86159
86174
  /** @hidden */
86160
86175
  this.defaultClass = true;
86161
86176
  /** @hidden */
@@ -86168,12 +86183,14 @@ class IgxTabsComponent extends IgxTabsDirective {
86168
86183
  ngAfterViewInit() {
86169
86184
  super.ngAfterViewInit();
86170
86185
  this.ngZone.runOutsideAngular(() => {
86171
- this._resizeObserver = new (getResizeObserver())(() => {
86172
- this.updateScrollButtons();
86173
- this.realignSelectedIndicator();
86174
- });
86175
- this._resizeObserver.observe(this.headerContainer.nativeElement);
86176
- this._resizeObserver.observe(this.viewPort.nativeElement);
86186
+ if (this.platform.isBrowser) {
86187
+ this._resizeObserver = new (getResizeObserver())(() => {
86188
+ this.updateScrollButtons();
86189
+ this.realignSelectedIndicator();
86190
+ });
86191
+ this._resizeObserver.observe(this.headerContainer.nativeElement);
86192
+ this._resizeObserver.observe(this.viewPort.nativeElement);
86193
+ }
86177
86194
  });
86178
86195
  }
86179
86196
  /** @hidden @internal */
@@ -86345,7 +86362,7 @@ class IgxTabsComponent extends IgxTabsDirective {
86345
86362
  getElementOffset(element) {
86346
86363
  return this.dir.rtl ? this.itemsWrapper.nativeElement.offsetWidth - element.offsetLeft - element.offsetWidth : element.offsetLeft;
86347
86364
  }
86348
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: IgxTabsComponent, deps: [{ token: IgxAngularAnimationService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: IgxDirectionality }], target: i0.ɵɵFactoryTarget.Component }); }
86365
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: IgxTabsComponent, deps: [{ token: IgxAngularAnimationService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: PlatformUtil }, { token: IgxDirectionality }], target: i0.ɵɵFactoryTarget.Component }); }
86349
86366
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: IgxTabsComponent, isStandalone: true, selector: "igx-tabs", inputs: { tabAlignment: "tabAlignment" }, host: { properties: { "class.igx-tabs": "this.defaultClass" } }, providers: [{ provide: IgxTabsBase, useExisting: IgxTabsComponent }], viewQueries: [{ propertyName: "headerContainer", first: true, predicate: ["headerContainer"], descendants: true, static: true }, { propertyName: "viewPort", first: true, predicate: ["viewPort"], descendants: true, static: true }, { propertyName: "itemsWrapper", first: true, predicate: ["itemsWrapper"], descendants: true, static: true }, { propertyName: "itemsContainer", first: true, predicate: ["itemsContainer"], descendants: true, static: true }, { propertyName: "selectedIndicator", first: true, predicate: ["selectedIndicator"], descendants: true }, { propertyName: "scrollPrevButton", first: true, predicate: ["scrollPrevButton"], descendants: true }, { propertyName: "scrollNextButton", first: true, predicate: ["scrollNextButton"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #headerContainer class=\"igx-tabs__header\">\n <button #scrollPrevButton type=\"button\" igxIconButton=\"flat\" igxRipple class=\"igx-tabs__header-button\" (click)=\"scrollPrev()\">\n <igx-icon>navigate_before</igx-icon>\n </button>\n <div #viewPort class=\"igx-tabs__header-content\">\n <div #itemsWrapper class=\"igx-tabs__header-wrapper\" role=\"tablist\">\n <div #itemsContainer class=\"igx-tabs__header-scroll\" [ngClass]=\"resolveHeaderScrollClasses()\">\n <ng-container *ngFor=\"let tab of items; let i = index\">\n <ng-container *ngTemplateOutlet=\"tab.headerTemplate\"></ng-container>\n </ng-container>\n </div>\n <div #selectedIndicator *ngIf=\"items.length > 0\" class=\"igx-tabs__header-active-indicator\">\n </div>\n </div>\n </div>\n <button #scrollNextButton type=\"button\" igxIconButton=\"flat\" igxRipple class=\"igx-tabs__header-button\" (click)=\"scrollNext()\">\n <igx-icon>navigate_next</igx-icon>\n </button>\n</div>\n<div class=\"igx-tabs__panels\">\n <ng-container *ngFor=\"let tab of items; let i = index\">\n <ng-container *ngTemplateOutlet=\"tab.panelTemplate\"></ng-container>\n </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: IgxRippleDirective, selector: "[igxRipple]", inputs: ["igxRippleTarget", "igxRipple", "igxRippleDuration", "igxRippleCentered", "igxRippleDisabled"] }, { kind: "component", type: IgxIconComponent, selector: "igx-icon", inputs: ["family", "active", "name"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
86350
86367
  }
86351
86368
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: IgxTabsComponent, decorators: [{
@@ -86354,7 +86371,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
86354
86371
  }], ctorParameters: () => [{ type: undefined, decorators: [{
86355
86372
  type: Inject,
86356
86373
  args: [IgxAngularAnimationService]
86357
- }] }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: IgxDirectionality }], propDecorators: { tabAlignment: [{
86374
+ }] }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: PlatformUtil }, { type: IgxDirectionality }], propDecorators: { tabAlignment: [{
86358
86375
  type: Input
86359
86376
  }], headerContainer: [{
86360
86377
  type: ViewChild,
@@ -86455,10 +86472,12 @@ class IgxTabHeaderComponent extends IgxTabHeaderDirective {
86455
86472
  /** @hidden @internal */
86456
86473
  ngAfterViewInit() {
86457
86474
  this.ngZone.runOutsideAngular(() => {
86458
- this._resizeObserver = new (getResizeObserver())(() => {
86459
- this.tabs.realignSelectedIndicator();
86460
- });
86461
- this._resizeObserver.observe(this.nativeElement);
86475
+ if (this.platform.isBrowser) {
86476
+ this._resizeObserver = new (getResizeObserver())(() => {
86477
+ this.tabs.realignSelectedIndicator();
86478
+ });
86479
+ this._resizeObserver.observe(this.nativeElement);
86480
+ }
86462
86481
  });
86463
86482
  }
86464
86483
  /** @hidden @internal */