igniteui-angular 22.2.0-rc.2 → 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.
@@ -231,19 +231,6 @@ class IgxTreeGridAPIService extends GridBaseAPIService {
231
231
  }
232
232
  return records;
233
233
  }
234
- update_row_in_array(value, rowID, index) {
235
- const grid = this.grid;
236
- if (grid.primaryKey && grid.foreignKey) {
237
- super.update_row_in_array(value, rowID, index);
238
- }
239
- else {
240
- const record = grid.records.get(rowID);
241
- const childData = record.parent ? record.parent.data[grid.childDataKey] : grid.data;
242
- index = grid.primaryKey ? childData.map((c) => c[grid.primaryKey]).indexOf(rowID) :
243
- childData.indexOf(rowID);
244
- childData[index] = value;
245
- }
246
- }
247
234
  /**
248
235
  * Updates related row of provided grid's data source with provided new row value
249
236
  *
@@ -291,7 +278,7 @@ class IgxTreeGridAPIService extends GridBaseAPIService {
291
278
  }
292
279
  for (const record of records) {
293
280
  if (!record.isFilteredOutParent) {
294
- data.push(record);
281
+ data.push(record.data);
295
282
  }
296
283
  this.getFlatDataFromFilteredRecords(record.children, data);
297
284
  }
@@ -304,10 +291,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
304
291
  }] });
305
292
 
306
293
  /**
307
- * @hidden
294
+ * Marks an `ng-template` as the row loading indicator of an `igx-tree-grid` that loads its child rows on demand.
295
+ * The template is displayed in place of the expand indicator while the children of a row are being loaded.
296
+ *
297
+ * @example
298
+ * ```html
299
+ * <igx-tree-grid [data]="data" primaryKey="ID" foreignKey="ParentID" [loadChildrenOnDemand]="loadChildren">
300
+ * <ng-template igxRowLoadingIndicator>
301
+ * <igx-icon>loop</igx-icon>
302
+ * </ng-template>
303
+ * </igx-tree-grid>
304
+ * ```
308
305
  */
309
306
  class IgxRowLoadingIndicatorTemplateDirective {
310
307
  constructor() {
308
+ /**
309
+ * The template reference of the row loading indicator.
310
+ *
311
+ * @returns The `TemplateRef` of the `ng-template` the directive is applied to.
312
+ * @example
313
+ * ```typescript
314
+ * @ViewChild(IgxRowLoadingIndicatorTemplateDirective) public loadingIndicator: IgxRowLoadingIndicatorTemplateDirective;
315
+ * const template = this.loadingIndicator.template;
316
+ * ```
317
+ */
311
318
  this.template = inject(TemplateRef);
312
319
  }
313
320
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: IgxRowLoadingIndicatorTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
@@ -408,8 +415,8 @@ class IgxTreeGridSelectionService extends IgxGridSelectionService {
408
415
  return this.grid.selectionService;
409
416
  }
410
417
  emitCascadeRowSelectionEvent(newSelection, added, removed, event) {
411
- const currSelection = this.getSelectedRows();
412
- if (this.areEqualCollections(currSelection, newSelection)) {
418
+ // newSelection holds the rows' data, so compare it to the current selection by row IDs
419
+ if (this.areEqualCollections(this.getSelectedRows(), this.getRowIDs(newSelection))) {
413
420
  return;
414
421
  }
415
422
  const args = {
@@ -1697,15 +1704,15 @@ class IgxTreeGridComponent extends IgxGridBaseDirective {
1697
1704
  * @remarks
1698
1705
  * Accepted values for index are integers from 0 to this.grid.dataView.length
1699
1706
  * @remarks
1700
- * When adding the row as a child, the parent row is the specified row.
1707
+ * When adding the row as a child, the parent row is the row at the specified index.
1701
1708
  * @remarks
1702
- * To spawn the UI on top, call the function with index = null or a negative number.
1703
- * In this case trying to add this row as a child will result in error.
1709
+ * To spawn the UI on top, call the function with index = 0, null or a negative number.
1710
+ * Trying to add the row as a child with index = null or a negative number will result in error.
1704
1711
  * @example
1705
1712
  * ```typescript
1706
- * this.grid.beginAddRowByIndex(10);
1707
- * this.grid.beginAddRowByIndex(10, true);
1708
- * this.grid.beginAddRowByIndex(null);
1713
+ * this.grid.beginAddRowByIndex(10); // spawns the add row UI at index 10
1714
+ * this.grid.beginAddRowByIndex(10, true); // spawns the add row UI to add a child for the row at index 10
1715
+ * this.grid.beginAddRowByIndex(0); // spawns the add row UI as the first record
1709
1716
  * ```
1710
1717
  * @param index - The index to spawn the UI at. Accepts integers from 0 to this.grid.dataView.length
1711
1718
  * @param asChild - Whether the record should be added as a child. Only applicable to igxTreeGrid.
@@ -1714,7 +1721,13 @@ class IgxTreeGridComponent extends IgxGridBaseDirective {
1714
1721
  if (index === null || index < 0) {
1715
1722
  return this.beginAddRowById(null, asChild);
1716
1723
  }
1717
- return this._addRowForIndex(index - 1, asChild);
1724
+ if (asChild) {
1725
+ return this._addRowForIndex(index, asChild);
1726
+ }
1727
+ if (index === 0) {
1728
+ return this.beginAddRowById(null);
1729
+ }
1730
+ return this._addRowForIndex(index - 1);
1718
1731
  }
1719
1732
  /**
1720
1733
  * @hidden
@@ -2001,9 +2014,6 @@ class IgxTreeGridComponent extends IgxGridBaseDirective {
2001
2014
  }
2002
2015
  super.transactionStatusUpdate(event);
2003
2016
  }
2004
- findRecordIndexInView(rec) {
2005
- return this.dataView.findIndex(x => x.data[this.primaryKey] === rec[this.primaryKey]);
2006
- }
2007
2017
  /**
2008
2018
  * @hidden @internal
2009
2019
  */
@@ -2041,18 +2051,14 @@ class IgxTreeGridComponent extends IgxGridBaseDirective {
2041
2051
  }
2042
2052
  this.scrollToHorizontally(column);
2043
2053
  }
2044
- writeToData(rowIndex, value) {
2045
- mergeObjects(this.flatData[rowIndex], value);
2046
- }
2047
2054
  /**
2048
2055
  * @hidden
2049
2056
  */
2050
2057
  initColumns(collection, cb = null) {
2051
- if (this.hasColumnLayouts) {
2058
+ if (collection.some(col => col.columnLayout)) {
2052
2059
  // invalid configuration - tree grid should not allow column layouts
2053
2060
  // remove column layouts
2054
- const nonColumnLayoutColumns = this.columns.filter((col) => !col.columnLayout && !col.columnLayoutChild);
2055
- this.updateColumns(nonColumnLayoutColumns);
2061
+ collection = collection.filter((col) => !col.columnLayout && !col.columnLayoutChild);
2056
2062
  }
2057
2063
  super.initColumns(collection, cb);
2058
2064
  }
@@ -2374,6 +2380,7 @@ const IGX_TREE_GRID_DIRECTIVES = [
2374
2380
  IgxTreeGridComponent,
2375
2381
  IgxTreeGridGroupByAreaComponent,
2376
2382
  IgxTreeGridGroupingPipe,
2383
+ IgxRowLoadingIndicatorTemplateDirective,
2377
2384
  IgxRowAddTextDirective,
2378
2385
  IgxRowEditActionsDirective,
2379
2386
  IgxRowEditTextDirective,
@@ -2471,6 +2478,7 @@ class IgxTreeGridModule {
2471
2478
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.2.0", ngImport: i0, type: IgxTreeGridModule, imports: [IgxTreeGridComponent,
2472
2479
  IgxTreeGridGroupByAreaComponent,
2473
2480
  IgxTreeGridGroupingPipe,
2481
+ IgxRowLoadingIndicatorTemplateDirective,
2474
2482
  IgxRowAddTextDirective,
2475
2483
  IgxRowEditActionsDirective,
2476
2484
  IgxRowEditTextDirective,
@@ -2560,6 +2568,7 @@ class IgxTreeGridModule {
2560
2568
  IgxPaginatorDirective], exports: [IgxTreeGridComponent,
2561
2569
  IgxTreeGridGroupByAreaComponent,
2562
2570
  IgxTreeGridGroupingPipe,
2571
+ IgxRowLoadingIndicatorTemplateDirective,
2563
2572
  IgxRowAddTextDirective,
2564
2573
  IgxRowEditActionsDirective,
2565
2574
  IgxRowEditTextDirective,
@@ -2703,5 +2712,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
2703
2712
  * Generated bundle index. Do not edit.
2704
2713
  */
2705
2714
 
2706
- export { IGX_TREE_GRID_DIRECTIVES, ITreeGridAggregation, IgxGroupedTreeGridSorting, IgxTreeGridComponent, IgxTreeGridGroupByAreaComponent, IgxTreeGridGroupingPipe, IgxTreeGridModule };
2715
+ export { IGX_TREE_GRID_DIRECTIVES, ITreeGridAggregation, IgxGroupedTreeGridSorting, IgxRowLoadingIndicatorTemplateDirective, IgxTreeGridComponent, IgxTreeGridGroupByAreaComponent, IgxTreeGridGroupingPipe, IgxTreeGridModule };
2707
2716
  //# sourceMappingURL=igniteui-angular-grids-tree-grid.mjs.map