Skip to content

Commit 9505f6b

Browse files
authored
Merge branch '13.0.x' into rkaraivanov/column-moving-grid-prop
2 parents 418dcdf + 6507d5b commit 9505f6b

File tree

7 files changed

+49
-41
lines changed

7 files changed

+49
-41
lines changed

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@
982982
top: 0;
983983
#{$right}: 0;
984984
background: var-get($theme, 'header-background');
985-
border-#{$left}: 1px solid var-get($theme, 'header-border-color');
985+
border-#{$left}: 1px solid igx-color($palette, 'grays', 300);
986986
}
987987

988988
%grid-tbody-scrollbar {

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
826826
*/
827827
public pointerenter = (event: PointerEvent) => {
828828
const isHierarchicalGrid = this.grid.nativeElement.tagName.toLowerCase() === 'igx-hierarchical-grid';
829-
if (isHierarchicalGrid && (!this.grid.navigation.activeNode.gridID || this.grid.navigation.activeNode.gridID !== this.gridID)) {
829+
if (isHierarchicalGrid && (!this.grid.navigation?.activeNode?.gridID || this.grid.navigation.activeNode.gridID !== this.gridID)) {
830830
return;
831831
}
832832
const dragMode = this.selectionService.pointerEnter(this.selectionNode, event);
@@ -841,7 +841,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
841841
*/
842842
public pointerup = (event: PointerEvent) => {
843843
const isHierarchicalGrid = this.grid.nativeElement.tagName.toLowerCase() === 'igx-hierarchical-grid';
844-
if (!this.platformUtil.isLeftClick(event) || (isHierarchicalGrid && (!this.grid.navigation.activeNode.gridID ||
844+
if (!this.platformUtil.isLeftClick(event) || (isHierarchicalGrid && (!this.grid.navigation?.activeNode?.gridID ||
845845
this.grid.navigation.activeNode.gridID !== this.gridID))) {
846846
return;
847847
}

projects/igniteui-angular/src/lib/grids/columns/column-group.component.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,6 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
371371
});
372372
}
373373
}
374-
// constructor(public gridAPI: GridBaseAPIService<IgxGridBaseDirective & IGridDataBindable>, public cdr: ChangeDetectorRef) {
375-
// // D.P. constructor duplication due to es6 compilation, might be obsolete in the future
376-
// super(gridAPI, cdr);
377-
// }
378374

379375
/**
380376
* @hidden

projects/igniteui-angular/src/lib/grids/common/pipes.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,19 @@ export class IgxHasVisibleColumnsPipe implements PipeTransform {
233233

234234
}
235235

236+
/** @hidden @internal */
237+
function buildDataView(): MethodDecorator {
238+
return function (_target: unknown, _propertyKey: string, descriptor: PropertyDescriptor) {
239+
const original = descriptor.value;
240+
descriptor.value = function (...args: unknown[]) {
241+
const result = original.apply(this, args);
242+
this.grid.buildDataView();
243+
return result;
244+
}
245+
return descriptor;
246+
}
247+
}
248+
236249
/**
237250
* @hidden
238251
*/
@@ -241,6 +254,7 @@ export class IgxGridRowPinningPipe implements PipeTransform {
241254

242255
constructor(@Inject(IGX_GRID_BASE) private grid: GridType) { }
243256

257+
@buildDataView()
244258
public transform(collection: any[], id: string, isPinned = false, _pipeTrigger: number) {
245259

246260
if (this.grid.hasPinnedRecords && isPinned) {

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
11661166
}
11671167

11681168
public get headerSelectorContainer() {
1169-
return this.theadRow?.headerSelectorContainer;
1169+
return this.theadRow?.headerSelectorContainer;
11701170
}
11711171

11721172
public get headerDragContainer() {
@@ -2768,6 +2768,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
27682768
private _visibleColumns = [];
27692769
private _columnGroups = false;
27702770
private _autoGeneratedCols = [];
2771+
private _dataView = [];
27712772

27722773
private _columnWidth: string;
27732774

@@ -3244,7 +3245,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
32443245
this.onDensityChanged.pipe(destructor).subscribe(() => {
32453246
this.crudService.endEdit(false);
32463247
if (this._summaryRowHeight === 0) {
3247-
this.summaryService.summaryHeight = 0;
3248+
this.summaryService.summaryHeight = 0;
32483249
}
32493250
this.notifyChanges(true);
32503251
});
@@ -3437,18 +3438,21 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
34373438
*/
34383439
public setFilteredSortedData(data, pinned: boolean) {
34393440
data = data || [];
3440-
if (this.pinnedRecordsCount > 0 && pinned) {
3441-
this._filteredSortedPinnedData = data;
3442-
this.pinnedRecords = data;
3443-
this._filteredSortedData = this.isRowPinningToTop ? [... this._filteredSortedPinnedData, ... this._filteredSortedUnpinnedData] :
3444-
[... this._filteredSortedUnpinnedData, ... this._filteredSortedPinnedData];
3445-
this.refreshSearch(true, false);
3446-
} else if (this.pinnedRecordsCount > 0 && !pinned) {
3447-
this._filteredSortedUnpinnedData = data;
3441+
if (this.pinnedRecordsCount > 0) {
3442+
if (pinned) {
3443+
this._filteredSortedPinnedData = data;
3444+
this.pinnedRecords = data;
3445+
this._filteredSortedData = this.isRowPinningToTop ? [... this._filteredSortedPinnedData, ... this._filteredSortedUnpinnedData] :
3446+
[... this._filteredSortedUnpinnedData, ... this._filteredSortedPinnedData];
3447+
this.refreshSearch(true, false);
3448+
} else {
3449+
this._filteredSortedUnpinnedData = data;
3450+
}
34483451
} else {
34493452
this._filteredSortedData = data;
34503453
this.refreshSearch(true, false);
34513454
}
3455+
this.buildDataView();
34523456
}
34533457

34543458
/**
@@ -5125,10 +5129,8 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
51255129
* const dataView = this.grid.dataView;
51265130
* ```
51275131
*/
5128-
public get dataView(): any[] {
5129-
return this.isRowPinningToTop ?
5130-
[...this.pinnedDataView, ...this.unpinnedDataView] :
5131-
[...this.unpinnedDataView, ...this.pinnedDataView];
5132+
public get dataView() {
5133+
return this._dataView;
51325134
}
51335135

51345136
/**
@@ -6921,6 +6923,12 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
69216923
column.resetCaches();
69226924
}
69236925

6926+
private buildDataView() {
6927+
this._dataView = this.isRowPinningToTop ?
6928+
[...this.pinnedDataView, ...this.unpinnedDataView] :
6929+
[...this.unpinnedDataView, ...this.pinnedDataView];
6930+
}
6931+
69246932
private _applyWidthHostBinding() {
69256933
let width = this._width;
69266934
if (width === null) {

projects/igniteui-angular/src/lib/grids/grid/grid.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<div class="igx-grid__row-indentation igx-grid__row-indentation--level-{{groupingExpressions.length}}"></div>
125125
</ng-container>
126126
<ng-template
127-
[ngTemplateOutlet]='detailTemplate'
127+
[ngTemplateOutlet]='detailTemplate.first'
128128
[ngTemplateOutletContext]='getDetailsContext(rowData, rowIndex)'>
129129
</ng-template>
130130
</div>

projects/igniteui-angular/src/lib/grids/grid/grid.component.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
150150
/**
151151
* @hidden @internal
152152
*/
153-
@ContentChild(IgxGridDetailTemplateDirective, { read: TemplateRef, static: false })
154-
public detailTemplate: TemplateRef<any> = null;
153+
@ContentChildren(IgxGridDetailTemplateDirective, { read: TemplateRef })
154+
public detailTemplate: QueryList<TemplateRef<any>> = new QueryList();
155155

156156
/**
157157
* @hidden @internal
@@ -200,12 +200,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
200200
@ContentChild(IgxGroupByRowTemplateDirective, { read: IgxGroupByRowTemplateDirective })
201201
protected groupTemplate: IgxGroupByRowTemplateDirective;
202202

203-
/**
204-
* @hidden @internal
205-
*/
206-
@ContentChild(IgxGridDetailTemplateDirective, { read: IgxGridDetailTemplateDirective, static: false })
207-
protected gridDetailsTemplate: IgxGridDetailTemplateDirective;
208-
209203
/**
210204
* @hidden
211205
* @internal
@@ -555,16 +549,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
555549
};
556550
}
557551

558-
/**
559-
* @hidden @internal
560-
*/
561-
public trackChanges(index, rec) {
562-
if (rec && rec.detailsData !== undefined) {
563-
return rec.detailsData;
564-
}
565-
return rec;
566-
}
567-
568552
/**
569553
* @hidden @internal
570554
*/
@@ -576,7 +560,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
576560
* @hidden @internal
577561
*/
578562
public get hasDetails() {
579-
return !!this.gridDetailsTemplate;
563+
return !!this.detailTemplate.length;
580564
}
581565

582566
/**
@@ -645,6 +629,9 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
645629
this.notifyChanges();
646630
}
647631

632+
/** @hidden @internal */
633+
public trackChanges: (index, rec) => any;
634+
648635
/**
649636
* Groups by a new `IgxColumnComponent` based on the provided expression, or modifies an existing one.
650637
*
@@ -938,6 +925,9 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
938925
this._groupRowTemplate = this.groupTemplate.template;
939926
}
940927

928+
this.detailTemplate.changes.subscribe(() =>
929+
this.trackChanges = (_, rec) => (rec?.detailsData !== undefined ? rec.detailsData : rec));
930+
941931
if (this.hideGroupedColumns && this.columnList && this.groupingExpressions) {
942932
this._setGroupColsVisibility(this.hideGroupedColumns);
943933
}

0 commit comments

Comments
 (0)