Skip to content

Commit c728aa7

Browse files
PlamenaMitevaLipata
authored andcommitted
fix(grid): аdd contentChild decorator to dragIndicatorIconTemplate in HGrid #4769 (#6295)
1 parent 9f8460a commit c728aa7

File tree

5 files changed

+23
-64
lines changed

5 files changed

+23
-64
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ import { IgxGridToolbarCustomContentDirective } from './toolbar/toolbar.directiv
132132
import { IgxColumnComponent } from './columns/column.component';
133133
import { IgxColumnGroupComponent } from './columns/column-group.component';
134134
import { IGridSortingStrategy } from '../data-operations/sorting-strategy';
135-
import { IgxRowDragGhostDirective } from './row-drag.directive';
135+
import { IgxRowDragGhostDirective, IgxDragIndicatorIconDirective } from './row-drag.directive';
136136

137137
const MINIMUM_COLUMN_WIDTH = 136;
138138
const FILTER_ROW_HEIGHT = 50;
@@ -154,6 +154,7 @@ export const IgxGridTransaction = new InjectionToken<string>('IgxGridTransaction
154154
export class IgxGridBaseDirective extends DisplayDensityBase implements
155155
OnInit, DoCheck, OnDestroy, AfterContentInit, AfterViewInit {
156156
private _scrollWidth: number;
157+
private _customDragIndicatorIconTemplate: TemplateRef<any>;
157158
protected _init = true;
158159
private _cdrRequests = false;
159160
protected _cdrRequestRepaint = false;
@@ -2089,6 +2090,24 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
20892090
@ContentChild(IgxHeaderCollapseIndicatorDirective, { read: TemplateRef })
20902091
public headerCollapseIndicatorTemplate: TemplateRef<any> = null;
20912092

2093+
/**
2094+
* @hidden
2095+
* @internal
2096+
*/
2097+
@ContentChildren(IgxDragIndicatorIconDirective, { read: TemplateRef, descendants: false })
2098+
public dragIndicatorIconTemplates: QueryList<TemplateRef<any>>;
2099+
2100+
/**
2101+
* The custom template, if any, that should be used when rendering the row drag indicator icon
2102+
*/
2103+
public get dragIndicatorIconTemplate(): TemplateRef<any> {
2104+
return this._customDragIndicatorIconTemplate || this.dragIndicatorIconTemplates.first;
2105+
}
2106+
2107+
public set dragIndicatorIconTemplate(val: TemplateRef<any>) {
2108+
this._customDragIndicatorIconTemplate = val;
2109+
}
2110+
20922111
/**
20932112
* @hidden
20942113
*/

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -480,27 +480,6 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
480480
@ContentChild(IgxGridDetailTemplateDirective, { read: IgxGridDetailTemplateDirective, static: false })
481481
protected gridDetailsTemplate: IgxGridDetailTemplateDirective;
482482

483-
/**
484-
* The custom template, if any, that should be used when rendering the row drag indicator icon
485-
*
486-
* ```typescript
487-
* // Set in typescript
488-
* const myCustomTemplate: TemplateRef<any> = myComponent.customTemplate;
489-
* myComponent.dragIndicatorIconTemplate = myCustomTemplate;
490-
* ```
491-
* ```html
492-
* <!-- Set in markup -->
493-
* <igx-grid #grid>
494-
* ...
495-
* <ng-template igxDragIndicatorIcon>
496-
* <igx-icon fontSet="material">info</igx-icon>
497-
* </ng-template>
498-
* </igx-grid>
499-
* ```
500-
*/
501-
@ContentChild(IgxDragIndicatorIconDirective, { read: TemplateRef })
502-
public dragIndicatorIconTemplate: TemplateRef<any> = null;
503-
504483
@ViewChildren(IgxGridGroupByRowComponent, { read: IgxGridGroupByRowComponent })
505484
private _groupsRowList: QueryList<IgxGridGroupByRowComponent>;
506485

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,6 @@ export class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirective {
100100
@ViewChild('dragIndicatorIconBase', { read: TemplateRef, static: true })
101101
public dragIndicatorIconBase: TemplateRef<any>;
102102

103-
104-
/**
105-
* The custom template, if any, that should be used when rendering the row drag indicator icon
106-
*
107-
* ```typescript
108-
* // Set in typescript
109-
* const myCustomTemplate: TemplateRef<any> = myComponent.customTemplate;
110-
* myComponent.dragIndicatorIconTemplate = myCustomTemplate;
111-
* ```
112-
* ```html
113-
* <!-- Set in markup -->
114-
* <igx-grid #grid>
115-
* ...
116-
* <ng-template igxDragIndicatorIcon>
117-
* <igx-icon fontSet="material">info</igx-icon>
118-
* </ng-template>
119-
* </igx-grid>
120-
* ```
121-
*/
122-
public dragIndicatorIconTemplate: TemplateRef<any> = null;
123-
124103
constructor(
125104
public selectionService: IgxGridSelectionService,
126105
crudService: IgxGridCRUDService,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
366366
this.rowSelectorsTemplates = this.parentIsland ?
367367
this.parentIsland.rowSelectorsTemplates :
368368
this.rowSelectorsTemplates;
369+
this.dragIndicatorIconTemplate = this.parentIsland ?
370+
this.parentIsland.dragIndicatorIconTemplate :
371+
this.dragIndicatorIconTemplate;
369372
this.rowExpandedIndicatorTemplate = this.rootGrid.rowExpandedIndicatorTemplate;
370373
this.rowCollapsedIndicatorTemplate = this.rootGrid.rowCollapsedIndicatorTemplate;
371374
this.headerCollapseIndicatorTemplate = this.rootGrid.headerCollapseIndicatorTemplate;

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -314,27 +314,6 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
314314
@ContentChild(IgxRowLoadingIndicatorTemplateDirective, { read: IgxRowLoadingIndicatorTemplateDirective })
315315
protected rowLoadingTemplate: IgxRowLoadingIndicatorTemplateDirective;
316316

317-
/**
318-
* The custom template, if any, that should be used when rendering the row drag indicator icon
319-
*
320-
* ```typescript
321-
* // Set in typescript
322-
* const myCustomTemplate: TemplateRef<any> = myComponent.customTemplate;
323-
* myComponent.dragIndicatorIconTemplate = myCustomTemplate;
324-
* ```
325-
* ```html
326-
* <!-- Set in markup -->
327-
* <igx-grid #grid>
328-
* ...
329-
* <ng-template igxDragIndicatorIcon>
330-
* <igx-icon fontSet="material">info</igx-icon>
331-
* </ng-template>
332-
* </igx-grid>
333-
* ```
334-
*/
335-
@ContentChild(IgxDragIndicatorIconDirective, { read: TemplateRef })
336-
public dragIndicatorIconTemplate: TemplateRef<any> = null;
337-
338317
/**
339318
* An @Input property that provides a template for the row loading indicator when load on demand is enabled.
340319
* ```html

0 commit comments

Comments
 (0)