igniteui-angular 22.2.0 → 22.2.1

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.
@@ -748,15 +748,6 @@ class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirective {
748
748
  ref.instance.validators = col.validators;
749
749
  return ref;
750
750
  }
751
- getGridsForIsland(rowIslandID) {
752
- return this.gridAPI.getChildGridsForRowIsland(rowIslandID);
753
- }
754
- getChildGrid(path) {
755
- if (!path) {
756
- return;
757
- }
758
- return this.gridAPI.getChildGrid(path);
759
- }
760
751
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: IgxHierarchicalGridBaseDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
761
752
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "22.2.0", type: IgxHierarchicalGridBaseDirective, isStandalone: true, inputs: { hasChildrenKey: "hasChildrenKey", showExpandAll: ["showExpandAll", "showExpandAll", booleanAttribute] }, outputs: { dataPreLoad: "dataPreLoad" }, usesInheritance: true, ngImport: i0 }); }
762
753
  }
@@ -783,7 +774,6 @@ const flatten = (arr) => {
783
774
 
784
775
  class IgxRowIslandAPIService {
785
776
  constructor() {
786
- this.change = new Subject();
787
777
  this.state = new Map();
788
778
  this.destroyMap = new Map();
789
779
  this.childRowIslands = new Map();
@@ -867,6 +857,11 @@ class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective {
867
857
  super(...arguments);
868
858
  /* blazorSuppress */
869
859
  this.rowIslandAPI = inject(IgxRowIslandAPIService);
860
+ /**
861
+ * The row island this one is declared in. Resolved through the injector, since row islands
862
+ * rendered conditionally are initialized before their parent updates its children.
863
+ */
864
+ this.declaringIsland = inject(IgxRowIslandComponent, { optional: true, skipSelf: true });
870
865
  /**
871
866
  * @hidden
872
867
  */
@@ -944,7 +939,7 @@ class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective {
944
939
  this.updateGridsResources();
945
940
  }
946
941
  get resourceStrings() {
947
- return super.resourceStrings ?? this.rootGrid.resourceStrings;
942
+ return this._resourceStrings || !this.rootGrid ? super.resourceStrings : this.rootGrid.resourceStrings;
948
943
  }
949
944
  /* csSuppress */
950
945
  /**
@@ -1033,9 +1028,9 @@ class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective {
1033
1028
  set expandChildren(value) {
1034
1029
  this._defaultExpandState = value;
1035
1030
  this.rowIslandAPI.getChildGrids().forEach((grid) => {
1031
+ grid.expandChildren = value;
1036
1032
  if (this.document.body.contains(grid.nativeElement)) {
1037
1033
  // Detect changes right away if the grid is visible
1038
- grid.expandChildren = value;
1039
1034
  grid.cdr.detectChanges();
1040
1035
  }
1041
1036
  else {
@@ -1084,6 +1079,10 @@ class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective {
1084
1079
  * @hidden
1085
1080
  */
1086
1081
  ngOnInit() {
1082
+ // islands of a grid declared in a row island template resolve that row island too, but belong to another grid
1083
+ if (this.declaringIsland?.gridAPI === this.gridAPI) {
1084
+ this.parentIsland ??= this.declaringIsland;
1085
+ }
1087
1086
  this.filteringService.grid = this;
1088
1087
  this.rootGrid = this.gridAPI.grid;
1089
1088
  this.rowIslandAPI.rowIsland = this;
@@ -1175,7 +1174,8 @@ class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective {
1175
1174
  this._destroyed = true;
1176
1175
  this.rowIslandAPI.unset(this.id);
1177
1176
  if (this.parentIsland) {
1178
- this.getGridsForIsland(this.key).forEach(grid => {
1177
+ // the grids rendering this row island are the ones created from its parent row island
1178
+ this.parentIsland.rowIslandAPI.getChildGrids().forEach(grid => {
1179
1179
  this.cleanGridState(grid);
1180
1180
  grid.gridAPI.unsetChildRowIsland(this);
1181
1181
  });
@@ -1220,9 +1220,6 @@ class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective {
1220
1220
  });
1221
1221
  }
1222
1222
  updateChildren() {
1223
- if (this.children.first === this) {
1224
- this.children.reset(this.children.toArray().slice(1));
1225
- }
1226
1223
  this.children.forEach(child => {
1227
1224
  child.parentIsland = this;
1228
1225
  });
@@ -1300,7 +1297,7 @@ class IgxGridHierarchicalPipe {
1300
1297
  constructor() {
1301
1298
  this.grid = inject(IGX_GRID_BASE);
1302
1299
  }
1303
- transform(collection, state = new Map(), _id, primaryKey, childKeys, _pipeTrigger) {
1300
+ transform(collection, state, _id, primaryKey, childKeys, _pipeTrigger) {
1304
1301
  if (childKeys.length === 0) {
1305
1302
  return collection;
1306
1303
  }
@@ -1346,7 +1343,7 @@ class IgxGridHierarchicalPagingPipe {
1346
1343
  constructor() {
1347
1344
  this.grid = inject(IGX_GRID_BASE);
1348
1345
  }
1349
- transform(collection, enabled, page = 0, perPage = 15, _id, _pipeTrigger) {
1346
+ transform(collection, enabled, page, perPage, _id, _pipeTrigger) {
1350
1347
  if (!enabled || this.grid.pagingMode !== 'local') {
1351
1348
  return collection;
1352
1349
  }
@@ -1506,8 +1503,6 @@ class IgxHierarchicalRowComponent extends IgxRowDirective {
1506
1503
  if (this.added) {
1507
1504
  return;
1508
1505
  }
1509
- // K.D. 28 Feb, 2022 #10634 Don't trigger endEdit/commit upon row expansion state change
1510
- // this.endEdit(this.grid.rootGrid);
1511
1506
  this.grid.gridAPI.set_row_expansion_state(this.key, !this.expanded);
1512
1507
  this.grid.cdr.detectChanges();
1513
1508
  }
@@ -1529,17 +1524,6 @@ class IgxHierarchicalRowComponent extends IgxRowDirective {
1529
1524
  return this.grid.rowCollapsedIndicatorTemplate || this.defaultCollapsedTemplate;
1530
1525
  }
1531
1526
  }
1532
- // TODO: consider moving into CRUD
1533
- endEdit(grid) {
1534
- if (grid.gridAPI.crudService.cellInEditMode) {
1535
- grid.gridAPI.crudService.endEdit();
1536
- }
1537
- grid.gridAPI.getChildGrids(true).forEach(g => {
1538
- if (g.gridAPI.crudService.cellInEditMode) {
1539
- g.gridAPI.crudService.endEdit();
1540
- }
1541
- });
1542
- }
1543
1527
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: IgxHierarchicalRowComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1544
1528
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: IgxHierarchicalRowComponent, isStandalone: true, selector: "igx-hierarchical-grid-row", host: { properties: { "class.igx-grid__tr--expanded": "this.expandedClass", "class.igx-grid__tr--highlighted": "this.highlighted" } }, providers: [{ provide: IgxRowDirective, useExisting: forwardRef(() => IgxHierarchicalRowComponent) }], viewQueries: [{ propertyName: "expander", first: true, predicate: ["expander"], descendants: true, read: ElementRef }, { propertyName: "defaultExpandedTemplate", first: true, predicate: ["defaultExpandedTemplate"], descendants: true, read: TemplateRef, static: true }, { propertyName: "defaultEmptyTemplate", first: true, predicate: ["defaultEmptyTemplate"], descendants: true, read: TemplateRef, static: true }, { propertyName: "defaultCollapsedTemplate", first: true, predicate: ["defaultCollapsedTemplate"], descendants: true, read: TemplateRef, static: true }, { propertyName: "_cells", predicate: i0.forwardRef(() => IgxHierarchicalGridCellComponent), descendants: true, read: IgxHierarchicalGridCellComponent }], usesInheritance: true, ngImport: i0, template: "<ng-container\n *ngTemplateOutlet=\"addRowUI ? addTemp : defaultTemp\"\n></ng-container>\n<ng-template #defaultExpandedTemplate>\n <igx-icon family=\"default\" name=\"tree_collapse\" [active]=\"!added\"></igx-icon>\n</ng-template>\n\n<ng-template #defaultCollapsedTemplate>\n <igx-icon family=\"default\" name=\"tree_expand\" [active]=\"!added\"></igx-icon>\n</ng-template>\n\n<ng-template #defaultEmptyTemplate>\n <!-- Empty icon used as spacer for size matching-->\n <igx-icon></igx-icon>\n</ng-template>\n\n<ng-template #addTemp>\n <div\n class=\"igx-grid__tr--inner\"\n [class.igx-grid__tr--add-animate]=\"triggerAddAnimationClass\"\n (animationend)=\"animationEndHandler()\"\n >\n <ng-container *ngTemplateOutlet=\"defaultTemp\"></ng-container>\n </div>\n</ng-template>\n<ng-template #defaultTemp>\n <!-- Drag indicator -->\n @if (rowDraggable) {\n <div\n [class]=\"resolveDragIndicatorClasses\"\n role=\"gridcell\"\n [igxRowDrag]=\"this\"\n (click)=\"$event.stopPropagation()\"\n [ghostTemplate]=\"this.grid.getDragGhostCustomTemplate()!\"\n (pointerdown)=\"$event.preventDefault()\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n this.grid.dragIndicatorIconTemplate\n ? this.grid.dragIndicatorIconTemplate\n : this.grid.dragIndicatorIconBase\n \"\n ></ng-container>\n </div>\n }\n\n <!-- Select Row -->\n @if (showRowSelectors) {\n <div\n class=\"igx-grid__cbx-selection igx-grid__tr-action\"\n role=\"gridcell\"\n (click)=\"onRowSelectorClick($event)\"\n (pointerdown)=\"$event.preventDefault()\"\n >\n <ng-template\n *ngTemplateOutlet=\"\n this.grid.rowSelectorTemplate\n ? this.grid.rowSelectorTemplate\n : rowSelectorBaseTemplate;\n context: {\n $implicit: {\n index: viewIndex,\n rowID: key,\n key,\n selected: selected,\n select: select,\n deselect: deselect,\n },\n }\n \"\n >\n </ng-template>\n </div>\n }\n\n <!-- Row Expander -->\n @if (hasChildren) {\n <div\n (click)=\"expanderClick($event)\"\n (mousedown)=\"$event.preventDefault()\"\n [ngClass]=\"expanderClassResolved\"\n #expander\n >\n <ng-container\n *ngTemplateOutlet=\"iconTemplate; context: { $implicit: this }\"\n >\n </ng-container>\n </div>\n }\n\n @if (pinnedStartColumns.length > 0) {\n <ng-template\n *ngTemplateOutlet=\"\n pinnedCellsTemplate;\n context: { $implicit: this, columns: pinnedStartColumns }\n \"\n ></ng-template>\n }\n\n <ng-template\n igxGridFor\n let-col\n [igxGridForOf]=\"unpinnedColumns | igxNotGrouped\"\n [igxForScrollContainer]=\"grid.parentVirtDir\"\n let-colIndex=\"index\"\n [igxForSizePropName]=\"'calcPixelWidth'\"\n [igxForScrollOrientation]=\"'horizontal'\"\n [igxForContainerSize]=\"grid.unpinnedWidth\"\n [igxForTrackBy]=\"grid.trackColumnChanges\"\n #igxDirRef\n >\n @if (this.hasMergedCells) {\n <div\n [style.height.px]=\"\n this.metaData?.cellMergeMeta.get(col.field)?.rowSpan > 1\n ? getRowHeight()\n : null\n \"\n class=\"igx-grid__mrl-block\"\n [style.visibility]=\"\n this.metaData?.cellMergeMeta.get(col.field)?.root\n ? 'hidden'\n : 'visible'\n \"\n [ngStyle]=\"{\n 'grid-template-rows':\n this.metaData?.cellMergeMeta.get(col.field)?.rowSpan > 1\n ? this.getMergeCellSpan(col)\n : null,\n }\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n cellTemplate;\n context: { $implicit: this, column: col }\n \"\n ></ng-container>\n </div>\n } @else {\n <ng-container\n *ngTemplateOutlet=\"\n cellTemplate;\n context: { $implicit: this, column: col }\n \"\n ></ng-container>\n }\n </ng-template>\n\n @if (pinnedEndColumns.length > 0) {\n <ng-template\n *ngTemplateOutlet=\"\n pinnedCellsTemplate;\n context: { $implicit: this, columns: pinnedEndColumns }\n \"\n ></ng-template>\n }\n\n <ng-template #rowSelectorBaseTemplate>\n <div class=\"igx-grid__cbx-padding\">\n <igx-checkbox\n [tabindex]=\"-1\"\n [readonly]=\"true\"\n [checked]=\"selected\"\n [disableRipple]=\"true\"\n [disabled]=\"deleted\"\n [disableTransitions]=\"grid.disableTransitions\"\n [aria-label]=\"rowCheckboxAriaLabel\"\n >\n </igx-checkbox>\n </div>\n </ng-template>\n\n <ng-template #pinnedCellsTemplate let-col let-columns=\"columns\">\n @for (col of columns | igxNotGrouped; track trackPinnedColumn(col)) {\n <igx-hierarchical-grid-cell\n class=\"igx-grid__td igx-grid__td--fw igx-grid__td--pinned\"\n [class.igx-grid__td--edited]=\"\n key\n | transactionState\n : col.field\n : grid.rowEditable\n : grid.transactions\n : grid.pipeTrigger\n : grid.gridAPI.crudService.cell\n : grid.gridAPI.crudService.row\n \"\n [class.igx-grid__td--number]=\"\n col.dataType === 'number' ||\n col.dataType === 'percent' ||\n col.dataType === 'currency'\n \"\n [ngClass]=\"\n col.cellClasses\n | igxCellStyleClasses\n : data[col.field]\n : data\n : col.field\n : viewIndex\n : grid.pipeTrigger\n \"\n [ngStyle]=\"\n col.cellStyles\n | igxCellStyles\n : data[col.field]\n : data\n : col.field\n : viewIndex\n : grid.pipeTrigger\n \"\n [editMode]=\"\n col.editable && this.grid.crudService.targetInEdit(index, col.index)\n \"\n [column]=\"col\"\n [formatter]=\"col.formatter\"\n [intRow]=\"this\"\n [active]=\"isCellActive(col.visibleIndex)\"\n [firstPinned]=\"col.isFirstPinned\"\n [lastPinned]=\"col.isLastPinned\"\n [rowData]=\"data\"\n [style.min-width]=\"col.resolvedWidth\"\n [style.max-width]=\"col.resolvedWidth\"\n [style.flex-basis]=\"col.resolvedWidth\"\n [width]=\"col.getCellWidth()\"\n [visibleColumnIndex]=\"col.visibleIndex\"\n [value]=\"\n data\n | dataMapper\n : col.field\n : grid.pipeTrigger\n : data[col.field]\n : col.hasNestedPath\n \"\n [cellTemplate]=\"col.bodyTemplate\"\n [cellValidationErrorTemplate]=\"col.errorTemplate\"\n [lastSearchInfo]=\"grid.lastSearchInfo\"\n [cellSelectionMode]=\"grid.cellSelection\"\n [displayPinnedChip]=\"shouldDisplayPinnedChip(col)\"\n >\n </igx-hierarchical-grid-cell>\n }\n </ng-template>\n</ng-template>\n\n<ng-template #cellTemplate let-col=\"column\">\n <igx-hierarchical-grid-cell\n [class.igx-grid__td--merged]=\"\n metaData?.cellMergeMeta.get(col.field)?.rowSpan > 1\n \"\n [isMerged]=\"\n $safeNavigationMigration(\n metaData?.cellMergeMeta.get(col.field)?.rowSpan\n ) > 1\n \"\n [isPlaceholder]=\"!!this.metaData?.cellMergeMeta.get(col.field)?.root\"\n [class.igx-grid__td--merged-selected]=\"isSelectionRoot(col)\"\n [class.igx-grid__td--merged-hovered]=\"isHoveredRoot(col)\"\n class=\"igx-grid__td igx-grid__td--fw\"\n [class.igx-grid__td--edited]=\"\n key\n | transactionState\n : col.field\n : grid.rowEditable\n : grid.transactions\n : grid.pipeTrigger\n : grid.gridAPI.crudService.cell\n : grid.gridAPI.crudService.row\n \"\n [class.igx-grid__td--number]=\"\n col.dataType === 'number' ||\n col.dataType === 'percent' ||\n col.dataType === 'currency'\n \"\n [class.igx-grid__td--bool]=\"col.dataType === 'boolean'\"\n [ngClass]=\"\n col.cellClasses\n | igxCellStyleClasses\n : data[col.field]\n : data\n : col.field\n : viewIndex\n : grid.pipeTrigger\n \"\n [ngStyle]=\"\n col.cellStyles\n | igxCellStyles\n : data[col.field]\n : data\n : col.field\n : viewIndex\n : grid.pipeTrigger\n \"\n [editMode]=\"\n col.editable && this.grid.crudService.targetInEdit(index, col.index)\n \"\n [column]=\"col\"\n [formatter]=\"col.formatter\"\n [intRow]=\"this\"\n [active]=\"isCellActive(col.visibleIndex)\"\n [rowData]=\"data\"\n [style.min-width]=\"col.resolvedWidth\"\n [style.max-width]=\"col.resolvedWidth\"\n [style.flex-basis]=\"col.resolvedWidth\"\n [width]=\"col.getCellWidth()\"\n [visibleColumnIndex]=\"col.visibleIndex\"\n [value]=\"\n data\n | dataMapper\n : col.field\n : grid.pipeTrigger\n : data[col.field]\n : col.hasNestedPath\n \"\n [cellTemplate]=\"col.bodyTemplate\"\n [cellValidationErrorTemplate]=\"col.errorTemplate\"\n [lastSearchInfo]=\"grid.lastSearchInfo\"\n [cellSelectionMode]=\"grid.cellSelection\"\n [displayPinnedChip]=\"shouldDisplayPinnedChip(col)\"\n >\n </igx-hierarchical-grid-cell>\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IgxIconComponent, selector: "igx-icon", inputs: ["ariaHidden", "family", "name", "active"] }, { kind: "directive", type: IgxRowDragDirective, selector: "[igxRowDrag]", inputs: ["igxRowDrag"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: IgxGridForOfDirective, selector: "[igxGridFor][igxGridForOf]", inputs: ["igxGridForOf", "igxGridForOfUniqueSizeCache", "igxGridForOfVariableSizes"], outputs: ["dataChanging"] }, { kind: "component", type: IgxHierarchicalGridCellComponent, selector: "igx-hierarchical-grid-cell" }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: IgxCheckboxComponent, selector: "igx-checkbox", inputs: ["indeterminate", "checked", "disabled", "invalid", "readonly", "disableTransitions"] }, { kind: "pipe", type: IgxGridNotGroupedPipe, name: "igxNotGrouped" }, { kind: "pipe", type: IgxGridCellStylesPipe, name: "igxCellStyles" }, { kind: "pipe", type: IgxGridCellStyleClassesPipe, name: "igxCellStyleClasses" }, { kind: "pipe", type: IgxGridDataMapperPipe, name: "dataMapper" }, { kind: "pipe", type: IgxGridTransactionStatePipe, name: "transactionState" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1545
1529
  }
@@ -2498,21 +2482,14 @@ class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirective {
2498
2482
  return keys.indexOf(field) === -1;
2499
2483
  });
2500
2484
  }
2501
- resizeNotifyHandler() {
2502
- // do not trigger reflow if element is detached or if it is child grid.
2503
- if (this.nativeElement?.isConnected && !this.parent) {
2504
- this.notifyChanges(true);
2505
- }
2506
- }
2507
2485
  /**
2508
2486
  * @hidden
2509
2487
  */
2510
2488
  initColumns(collection, cb = null) {
2511
- if (this.hasColumnLayouts) {
2489
+ if (collection.some((col) => col.columnLayout)) {
2512
2490
  // invalid configuration - hierarchical grid should not allow column layouts
2513
2491
  // remove column layouts
2514
- const nonColumnLayoutColumns = this.columns.filter((col) => !col.columnLayout && !col.columnLayoutChild);
2515
- this.updateColumns(nonColumnLayoutColumns);
2492
+ collection = collection.filter((col) => !col.columnLayout && !col.columnLayoutChild);
2516
2493
  }
2517
2494
  super.initColumns(collection, cb);
2518
2495
  }
@@ -2620,7 +2597,7 @@ class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirective {
2620
2597
  if (!firstRowData) {
2621
2598
  return null;
2622
2599
  }
2623
- const childFirstRowData = firstRowData.length > 0 && firstRowData[childRowIsland.key]?.length > 0 ?
2600
+ const childFirstRowData = firstRowData[childRowIsland.key]?.length > 0 ?
2624
2601
  firstRowData[childRowIsland.key][0] : null;
2625
2602
  return acc.concat(this.generateChildEntity(childRowIsland, childFirstRowData));
2626
2603
  }, []);