igniteui-angular 21.2.11 → 21.2.13

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, inject, ElementRef, ChangeDetectorRef, TemplateRef, HostBinding, HostListener, ViewChild, Input, ChangeDetectionStrategy, Component, Pipe, DOCUMENT, forwardRef, InjectionToken, QueryList, NgZone, IterableDiffers, ViewContainerRef, Injector, EnvironmentInjector, LOCALE_ID, EventEmitter, createComponent, booleanAttribute, ViewChildren, ContentChildren, ContentChild, Output, Directive, CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
3
3
  import { NgTemplateOutlet, NgClass, NgStyle } from '@angular/common';
4
4
  import { GridBaseAPIService, IGX_GRID_BASE, IgxGridSelectionService, IgxFilteringService, GridSelectionMode, IgxColumnFormatterPipe, IgxGroupByAreaDirective, IgxGroupAreaDropDirective, IgxGroupByMetaPipe, GridSummaryPosition, RowPinningPosition, IgxGridCellComponent, IgxGridCellImageAltPipe, IgxStringReplacePipe, IgxRowDirective, IgxRowDragDirective, IgxGridNotGroupedPipe, IgxGridTopLevelColumns, IgxGridCellStylesPipe, IgxGridCellStyleClassesPipe, IgxGridDataMapperPipe, IgxGridTransactionStatePipe, FilterMode, GridCellMergeMode, IgxGridValidationService, IgxColumnResizingService, IGX_GRID_SERVICE_BASE, IgxGridNavigationService, IgxGridSummaryService, IgxGridTransaction, RowEditPositionStrategy, getUUID, IgxGridExcelStyleFilteringComponent, DropPosition, IgxCell, IgxEditRow, IgxColumnComponent, CharSeparatedValueData, IgxAdvancedFilteringDialogComponent, IgxColumnGroupComponent, IgxGridPinningActionsComponent, IgxGridColumnResizerComponent, IgxGridHeaderRowComponent, IgxGridBodyDirective, IgxRowEditTabStopDirective, IgxSummaryRowComponent, IgxExcelStyleLoadingValuesTemplateDirective, IgxRowAddTextDirective, IgxRowExpandedIndicatorDirective, IgxRowCollapsedIndicatorDirective, IgxHeaderExpandedIndicatorDirective, IgxHeaderCollapsedIndicatorDirective, IgxExcelStyleHeaderIconDirective, IgxSortAscendingHeaderIconDirective, IgxSortDescendingHeaderIconDirective, IgxSortHeaderIconDirective, IgxGridLoadingTemplateDirective, IgxGridEmptyTemplateDirective, IgxHeadSelectorDirective, IgxRowSelectorDirective, IgxRowDragGhostDirective, IgxRowEditTemplateDirective, IgxRowEditTextDirective, IgxRowEditActionsDirective, IgxDragIndicatorIconDirective, IgxToolbarToken, WatchChanges, IgxGridRow, IgxGridCell, IgxGroupByRow, IgxSummaryRow, IgxGridMRLNavigationService, IgxGridDragSelectDirective, IgxColumnMovingDropDirective, IgxGridTransactionPipe, IgxHasVisibleColumnsPipe, IgxGridRowPinningPipe, IgxGridAddRowPipe, IgxGridRowClassesPipe, IgxGridRowStylesPipe, IgxSummaryDataPipe, IgxGridDetailTemplateDirective, IgxGroupByRowTemplateDirective, IgxGroupByRowSelectorDirective, IgxGridCRUDService, IgxGridFooterComponent, IgxGridStateDirective, IgxGridEditingActionsComponent, IgxGridActionsBaseDirective, IgxGridActionButtonComponent, IgxGridHeaderComponent, IgxGridHeaderGroupComponent, IgxFilterCellTemplateDirective, IgxSummaryTemplateDirective, IgxCellTemplateDirective, IgxCellValidationErrorDirective, IgxCellHeaderTemplateDirective, IgxCellFooterTemplateDirective, IgxCellEditorTemplateDirective, IgxCollapsibleIndicatorTemplateDirective, IgxColumnLayoutComponent, IgxColumnActionsComponent, IgxColumnHidingDirective, IgxColumnPinningDirective, IgxCSVTextDirective, IgxExcelTextDirective, IgxGridToolbarActionsComponent, IgxGridToolbarAdvancedFilteringComponent, IgxGridToolbarComponent, IgxGridToolbarExporterComponent, IgxGridToolbarHidingComponent, IgxGridToolbarPinningComponent, IgxGridToolbarTitleComponent, IgxGridToolbarDirective, IgxExcelStyleHeaderComponent, IgxExcelStyleSortingComponent, IgxExcelStylePinningComponent, IgxExcelStyleHidingComponent, IgxExcelStyleSelectingComponent, IgxExcelStyleClearFiltersComponent, IgxExcelStyleConditionalFilterComponent, IgxExcelStyleMovingComponent, IgxExcelStyleSearchComponent, IgxExcelStyleColumnOperationsTemplateDirective, IgxExcelStyleFilterOperationsTemplateDirective, IgxColumnRequiredValidatorDirective, IgxColumnMinValidatorDirective, IgxColumnMaxValidatorDirective, IgxColumnEmailValidatorDirective, IgxColumnMinLengthValidatorDirective, IgxColumnMaxLengthValidatorDirective, IgxColumnPatternValidatorDirective } from 'igniteui-angular/grids/core';
5
- import { cloneArray, DataUtil, GridColumnDataType, IgxNumberFormatterPipe, IgxDateFormatterPipe, IgxPercentFormatterPipe, IgxCurrencyFormatterPipe, GridSummaryCalculationMode, FilteringExpressionsTree, FilterUtil, HammerGesturesManager, isTree, FilteringLogic, FilteringExpressionsTreeType, getCurrentResourceStrings, GridResourceStringsEN, isObject, TransactionType, IgxFlatTransactionFactory, IgxOverlayService, PlatformUtil, I18N_FORMATTER, DefaultMergeStrategy, FilteringStrategy, ColumnPinningPosition, VerticalAlignment, HorizontalAlignment, ConnectedPositioningStrategy, AbsoluteScrollStrategy, DefaultDataCloneStrategy, ɵSize as _Size, areEqualArrays, resizeObservable, compareMaps, TransactionEventOrigin, mergeObjects, ContainerPositionStrategy, resolveNestedPath, columnFieldPath, recreateTree, recreateTreeFromFields, DEFAULT_LOCALE, onResourceChangeHandle, IgxOverlayOutletDirective, IgxActionStripToken } from 'igniteui-angular/core';
5
+ import { cloneArray, DataUtil, GridColumnDataType, IgxNumberFormatterPipe, IgxDateFormatterPipe, IgxPercentFormatterPipe, IgxCurrencyFormatterPipe, GridSummaryCalculationMode, FilteringExpressionsTree, FilterUtil, HammerGesturesManager, isTree, FilteringLogic, FilteringExpressionsTreeType, getCurrentResourceStrings, GridResourceStringsEN, isObject, TransactionType, IgxFlatTransactionFactory, IgxOverlayService, PlatformUtil, I18N_FORMATTER, DefaultMergeStrategy, FilteringStrategy, ColumnPinningPosition, VerticalAlignment, HorizontalAlignment, ConnectedPositioningStrategy, AbsoluteScrollStrategy, DefaultDataCloneStrategy, ɵSize as _Size, areEqualArrays, runAfterRenderOnce, resizeObservable, compareMaps, TransactionEventOrigin, mergeObjects, ContainerPositionStrategy, resolveNestedPath, columnFieldPath, recreateTree, recreateTreeFromFields, DEFAULT_LOCALE, onResourceChangeHandle, IgxOverlayOutletDirective, IgxActionStripToken } from 'igniteui-angular/core';
6
6
  import { takeUntil, shareReplay, filter, throttle, take, switchMap, throttleTime, takeWhile, map, first } from 'rxjs/operators';
7
7
  import { Subject, BehaviorSubject, animationFrameScheduler, fromEvent, timer, pipe, merge } from 'rxjs';
8
8
  import { IgxIconComponent } from 'igniteui-angular/icon';
@@ -4095,9 +4095,7 @@ class IgxGridBaseDirective {
4095
4095
  if (this.hasColumnsToAutosize) {
4096
4096
  this.headerContainer?.dataChanged.pipe(takeUntil(this.destroy$)).subscribe(() => {
4097
4097
  this.cdr.detectChanges();
4098
- this.zone.onStable.pipe(first()).subscribe(() => {
4099
- this.autoSizeColumnsInView();
4100
- });
4098
+ runAfterRenderOnce(this.injector, () => this.autoSizeColumnsInView());
4101
4099
  });
4102
4100
  }
4103
4101
  // Window resize observer not needed because when you resize the window element the tbody container always resize so
@@ -4545,7 +4543,7 @@ class IgxGridBaseDirective {
4545
4543
  // reset auto-size and calculate it again.
4546
4544
  this._columns.forEach(x => x.autoSize = undefined);
4547
4545
  this.resetCaches();
4548
- this.zone.onStable.pipe(first()).subscribe(() => {
4546
+ runAfterRenderOnce(this.injector, () => {
4549
4547
  this.cdr.detectChanges();
4550
4548
  this.autoSizeColumnsInView();
4551
4549
  });
@@ -5407,6 +5405,15 @@ class IgxGridBaseDirective {
5407
5405
  if (!sumExistingWidths && !columnsToSize) {
5408
5406
  return '0px';
5409
5407
  }
5408
+ // When the grid has no measurable width, calculateGridWidth() falls back to the
5409
+ // sum of its column widths and sets isColumnWidthSum. If all visible columns
5410
+ // already have explicit or constrained widths, columnsToSize is 0 and
5411
+ // computedWidth equals sumExistingWidths, resulting in 0 / 0 = NaN.
5412
+ // Return the "0px" sentinel so _derivePossibleWidth() preserves the existing
5413
+ // valid column widths.
5414
+ if (columnsToSize <= 0 && this.isColumnWidthSum) {
5415
+ return '0px';
5416
+ }
5410
5417
  computedWidth -= this.featureColumnsWidth();
5411
5418
  const columnWidth = !Number.isFinite(sumExistingWidths) ?
5412
5419
  computedWidth / columnsToSize :
@@ -6078,7 +6085,7 @@ class IgxGridBaseDirective {
6078
6085
  const tmplId = args.context.templateID.type;
6079
6086
  const index = args.context.index;
6080
6087
  args.view.detectChanges();
6081
- this.zone.onStable.pipe(first()).subscribe(() => {
6088
+ runAfterRenderOnce(this.injector, () => {
6082
6089
  const row = tmplId === 'dataRow' ? this.gridAPI.get_row_by_index(index) : null;
6083
6090
  const summaryRow = tmplId === 'summaryRow' ? this.summariesRowList.find((sr) => sr.dataRowIndex === index) : null;
6084
6091
  if (row && row instanceof IgxRowDirective) {
@@ -6713,25 +6720,16 @@ class IgxGridBaseDirective {
6713
6720
  this.calculateGridWidth();
6714
6721
  this.cdr.detectChanges();
6715
6722
  }
6716
- if (this.zone.isStable) {
6723
+ runAfterRenderOnce(this.injector, () => {
6717
6724
  this.zone.run(() => {
6718
6725
  this._applyWidthHostBinding();
6719
6726
  this.cdr.detectChanges();
6720
6727
  });
6721
- }
6722
- else {
6723
- this.zone.onStable.pipe(first()).subscribe(() => {
6724
- this.zone.run(() => {
6725
- this._applyWidthHostBinding();
6726
- });
6727
- });
6728
- }
6728
+ });
6729
6729
  this.resetCaches(recalcFeatureWidth);
6730
6730
  if (this.hasColumnsToAutosize) {
6731
6731
  this.cdr.detectChanges();
6732
- this.zone.onStable.pipe(first()).subscribe(() => {
6733
- this._autoSizeColumnsNotify.next();
6734
- });
6732
+ runAfterRenderOnce(this.injector, () => this._autoSizeColumnsNotify.next());
6735
6733
  }
6736
6734
  // in case horizontal scrollbar has appeared recalc to size correctly.
6737
6735
  if (hasHScroll !== this.hasHorizontalScroll()) {
@@ -7343,13 +7341,7 @@ class IgxGridBaseDirective {
7343
7341
  this.changeRowEditingOverlayStateOnScroll(this.crudService.rowInEditMode);
7344
7342
  }
7345
7343
  };
7346
- if (this.isZonelessChangeDetection()) {
7347
- this.cdr.detectChanges();
7348
- callback();
7349
- }
7350
- else {
7351
- this.zone.onStable.pipe(first()).subscribe(callback);
7352
- }
7344
+ runAfterRenderOnce(this.injector, callback);
7353
7345
  this.disableTransitions = false;
7354
7346
  this.hideOverlays();
7355
7347
  const context = this.actionStrip?.context;
@@ -7370,9 +7362,6 @@ class IgxGridBaseDirective {
7370
7362
  };
7371
7363
  this.gridScroll.emit(args);
7372
7364
  }
7373
- isZonelessChangeDetection() {
7374
- return this.zone.constructor.name === 'NoopNgZone';
7375
- }
7376
7365
  hasMenuPinningActions() {
7377
7366
  const strip = this.actionStrip;
7378
7367
  const actionButtons = strip?.actionButtons;
@@ -7390,7 +7379,7 @@ class IgxGridBaseDirective {
7390
7379
  this._horizontalForOfs.forEach(vfor => vfor.onHScroll(scrollLeft));
7391
7380
  this.cdr.markForCheck();
7392
7381
  this.zone.run(() => {
7393
- this.zone.onStable.pipe(first()).subscribe(() => {
7382
+ runAfterRenderOnce(this.injector, () => {
7394
7383
  this.parentVirtDir.chunkLoad.emit(this.headerContainer.state);
7395
7384
  requestAnimationFrame(() => {
7396
7385
  this.autoSizeColumnsInView();