Skip to content

Commit f797bff

Browse files
authored
Merge branch '8.2.x' into mkirova/fix-4970-8.2.x
2 parents 8056ea9 + 973a750 commit f797bff

File tree

10 files changed

+85
-91
lines changed

10 files changed

+85
-91
lines changed

projects/igniteui-angular/src/lib/data-operations/data-util.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ export class DataUtil {
210210
return data;
211211
}
212212

213+
public static parseValue(dataType: DataType, value: any): any {
214+
if (dataType === DataType.Number) {
215+
value = parseFloat(value);
216+
}
217+
218+
return value;
219+
}
220+
213221
private static findParentFromPath(data: any[], primaryKey: any, childDataKey: any, path: any[]): any {
214222
let collection: any[] = data;
215223
let result: any;

projects/igniteui-angular/src/lib/grids/filtering/advanced-filtering/advanced-filtering-dialog.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { takeUntil, first } from 'rxjs/operators';
1818
import { Subject } from 'rxjs';
1919
import { KEYS } from '../../../core/utils';
2020
import { AbsoluteScrollStrategy, AutoPositionStrategy } from '../../../services/index';
21+
import { DataUtil } from './../../../data-operations/data-util';
2122

2223
/**
2324
*@hidden
@@ -301,7 +302,7 @@ export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDes
301302
if (this.editedExpression) {
302303
this.editedExpression.expression.fieldName = this.selectedColumn.field;
303304
this.editedExpression.expression.condition = this.selectedColumn.filters.condition(this.selectedCondition);
304-
this.editedExpression.expression.searchVal = this.searchValue;
305+
this.editedExpression.expression.searchVal = DataUtil.parseValue(this.selectedColumn.dataType, this.searchValue);
305306

306307
this.editedExpression.inEditMode = false;
307308
this.editedExpression = null;

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-default-expression.component.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ExpressionUI } from '../grid-filtering.service';
1313
import { IgxButtonGroupComponent } from '../../../buttonGroup/buttonGroup.component';
1414
import { IgxDropDownItemComponent, IgxDropDownComponent } from '../../../drop-down/index';
1515
import { IgxInputGroupComponent, IgxInputDirective } from '../../../input-group/index';
16-
import { DataType } from '../../../data-operations/data-util';
16+
import { DataType, DataUtil } from '../../../data-operations/data-util';
1717
import { IFilteringOperation } from '../../../data-operations/filtering-condition';
1818
import { OverlaySettings, ConnectedPositioningStrategy, CloseScrollStrategy } from '../../../services/index';
1919
import { KEYS, IBaseEventArgs } from '../../../core/utils';
@@ -167,7 +167,7 @@ export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
167167
}
168168

169169
public onValuesInput(eventArgs) {
170-
this.expressionUI.expression.searchVal = this.transformValue(eventArgs.target.value);
170+
this.expressionUI.expression.searchVal = DataUtil.parseValue(this.column.dataType, eventArgs.target.value);
171171
}
172172

173173
public onLogicOperatorButtonClicked(eventArgs, buttonIndex: number) {
@@ -207,14 +207,4 @@ export class IgxExcelStyleDefaultExpressionComponent implements AfterViewInit {
207207

208208
event.stopPropagation();
209209
}
210-
211-
private transformValue(value): any {
212-
if (this.column.dataType === DataType.Number) {
213-
value = parseFloat(value);
214-
} else if (this.column.dataType === DataType.Boolean) {
215-
value = Boolean(value);
216-
}
217-
218-
return value;
219-
}
220210
}

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
ChangeDetectionStrategy,
1414
ViewRef
1515
} from '@angular/core';
16-
import { DataType } from '../../data-operations/data-util';
16+
import { DataType, DataUtil } from '../../data-operations/data-util';
1717
import { IgxColumnComponent } from '../column.component';
1818
import { IgxDropDownComponent, ISelectionEventArgs } from '../../drop-down/index';
1919
import { IFilteringOperation } from '../../data-operations/filtering-condition';
@@ -100,7 +100,7 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
100100
this.expression.searchVal = null;
101101
this.showHideArrowButtons();
102102
} else {
103-
this.expression.searchVal = this.transformValue(val);
103+
this.expression.searchVal = DataUtil.parseValue(this.column.dataType, val);
104104
if (this.expressionsList.find(item => item.expression === this.expression) === undefined) {
105105
this.addExpression(true);
106106
}
@@ -659,16 +659,6 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
659659
});
660660
}
661661

662-
private transformValue(value): any {
663-
if (this.column.dataType === DataType.Number) {
664-
value = parseFloat(value);
665-
} else if (this.column.dataType === DataType.Boolean) {
666-
value = Boolean(value);
667-
}
668-
669-
return value;
670-
}
671-
672662
private addExpression(isSelected: boolean) {
673663
const exprUI = new ExpressionUI();
674664
exprUI.expression = this.expression;

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ import { DeprecateProperty } from '../core/deprecateDecorators';
103103
import { IFilteringStrategy } from '../data-operations/filtering-strategy';
104104
import { IgxRowExpandedIndicatorDirective, IgxRowCollapsedIndicatorDirective,
105105
IgxHeaderExpandIndicatorDirective, IgxHeaderCollapseIndicatorDirective } from './grid/grid.directives';
106-
import { IgxRowDragGhostDirective } from './row-drag.directive';
106+
import { IgxRowDragGhostDirective, IgxDragIndicatorIconDirective } from './row-drag.directive';
107107
import { GridKeydownTargetType, GridSelectionMode, GridSummaryPosition, GridSummaryCalculationMode, FilterMode } from './common/enums';
108108

109109
const MINIMUM_COLUMN_WIDTH = 136;
@@ -229,6 +229,7 @@ export interface IRowDragStartEventArgs extends CancelableEventArgs, IBaseEventA
229229
export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
230230
OnInit, DoCheck, OnDestroy, AfterContentInit, AfterViewInit {
231231
private _scrollWidth: number;
232+
private _customDragIndicatorIconTemplate: TemplateRef<any>;
232233
protected _init = true;
233234
private _tick;
234235
private _cdrRequests = false;
@@ -1945,6 +1946,22 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
19451946
@ContentChildren(IgxRowDragGhostDirective, { read: TemplateRef, descendants: false })
19461947
public dragGhostCustomTemplates: QueryList<TemplateRef<any>>;
19471948

1949+
/**
1950+
* @hidden
1951+
* @internal
1952+
*/
1953+
@ContentChildren(IgxDragIndicatorIconDirective, { read: TemplateRef, descendants: false })
1954+
public dragIndicatorIconTemplates: QueryList<TemplateRef<any>>;
1955+
/**
1956+
* The custom template, if any, that should be used when rendering the row drag indicator icon
1957+
*/
1958+
public get dragIndicatorIconTemplate(): TemplateRef<any> {
1959+
return this._customDragIndicatorIconTemplate || this.dragIndicatorIconTemplates.first;
1960+
}
1961+
1962+
public set dragIndicatorIconTemplate(val: TemplateRef<any>) {
1963+
this._customDragIndicatorIconTemplate = val;
1964+
}
19481965
/**
19491966
* @hidden
19501967
*/
@@ -2055,7 +2072,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
20552072
* @hidden
20562073
*/
20572074
public get parentRowOutletDirective() {
2058-
return this.outletDirective;
2075+
return null;
20592076
}
20602077

20612078
/**

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-advanced.spec.ts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ describe('IgxGrid - Advanced Filtering', () => {
419419
expect(GridFunctions.getCurrentCellFromGrid(grid, 1, 1).value).toBe('Ignite UI for Angular');
420420
}));
421421

422-
it('Should correctly filter by a \'number\' column through UI.', fakeAsync(() => {
422+
it('Should correctly filter by a \'Greater Than\' with \'number\' column through UI.', fakeAsync(() => {
423423
// Test prerequisites
424424
grid.height = '800px';
425425
fix.detectChanges();
@@ -461,6 +461,47 @@ describe('IgxGrid - Advanced Filtering', () => {
461461
expect(GridFunctions.getCurrentCellFromGrid(grid, 1, 1).value).toBe('NetAdvantage');
462462
}));
463463

464+
it('Should correctly filter by a \'Equals\' with \'number\' column through UI.', fakeAsync(() => {
465+
// Test prerequisites
466+
grid.height = '800px';
467+
fix.detectChanges();
468+
tick(50);
469+
470+
// Verify no filters are present.
471+
expect(grid.filteredData).toBeNull();
472+
expect(grid.rowList.length).toBe(8);
473+
expect(GridFunctions.getCurrentCellFromGrid(grid, 0, 1).value).toBe('Ignite UI for JavaScript');
474+
expect(GridFunctions.getCurrentCellFromGrid(grid, 1, 1).value).toBe('NetAdvantage');
475+
476+
// Open Advanced Filtering dialog.
477+
GridFunctions.clickAdvancedFilteringButton(fix);
478+
fix.detectChanges();
479+
480+
// Click the initial 'Add And Group' button.
481+
const addAndGroupButton = GridFunctions.getAdvancedFilteringInitialAddGroupButtons(fix)[0];
482+
addAndGroupButton.click();
483+
tick(100);
484+
fix.detectChanges();
485+
486+
selectColumnInEditModeExpression(fix, 2); // Select 'Downloads' column.
487+
selectOperatorInEditModeExpression(fix, 0); // Select 'Equals' operator.
488+
const input = GridFunctions.getAdvancedFilteringValueInput(fix).querySelector('input');
489+
sendInputNativeElement(fix, input, '127'); // Type filter value.
490+
491+
// Commit the populated expression.
492+
GridFunctions.clickAdvancedFilteringExpressionCommitButton(fix);
493+
fix.detectChanges();
494+
495+
// Apply the filters.
496+
GridFunctions.clickAdvancedFilteringApplyButton(fix);
497+
fix.detectChanges();
498+
499+
// Verify the filter results.
500+
expect(grid.filteredData.length).toEqual(1);
501+
expect(grid.rowList.length).toBe(1);
502+
expect(GridFunctions.getCurrentCellFromGrid(grid, 0, 1).value).toBe('NetAdvantage');
503+
}));
504+
464505
it('Should correctly filter by a \'boolean\' column through UI.', fakeAsync(() => {
465506
// Test prerequisites
466507
grid.height = '800px';

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -471,27 +471,6 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
471471
@ContentChild(IgxGroupByRowTemplateDirective, { read: IgxGroupByRowTemplateDirective, static: false })
472472
protected groupTemplate: IgxGroupByRowTemplateDirective;
473473

474-
/**
475-
* The custom template, if any, that should be used when rendering the row drag indicator icon
476-
*
477-
* ```typescript
478-
* // Set in typescript
479-
* const myCustomTemplate: TemplateRef<any> = myComponent.customTemplate;
480-
* myComponent.dragIndicatorIconTemplate = myCustomTemplate;
481-
* ```
482-
* ```html
483-
* <!-- Set in markup -->
484-
* <igx-grid #grid>
485-
* ...
486-
* <ng-template igxDragIndicatorIcon>
487-
* <igx-icon fontSet="material">info</igx-icon>
488-
* </ng-template>
489-
* </igx-grid>
490-
* ```
491-
*/
492-
@ContentChild(IgxDragIndicatorIconDirective, { read: TemplateRef, static: false })
493-
public dragIndicatorIconTemplate: TemplateRef<any> = null;
494-
495474
@ViewChildren(IgxGridGroupByRowComponent, { read: IgxGridGroupByRowComponent })
496475
private _groupsRowList: QueryList<IgxGridGroupByRowComponent>;
497476

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -94,27 +94,6 @@ export abstract class IgxHierarchicalGridBaseComponent extends IgxGridBaseCompon
9494
@ViewChild('dragIndicatorIconBase', { read: TemplateRef, static: true })
9595
public dragIndicatorIconBase: TemplateRef<any>;
9696

97-
98-
/**
99-
* The custom template, if any, that should be used when rendering the row drag indicator icon
100-
*
101-
* ```typescript
102-
* // Set in typescript
103-
* const myCustomTemplate: TemplateRef<any> = myComponent.customTemplate;
104-
* myComponent.dragIndicatorIconTemplate = myCustomTemplate;
105-
* ```
106-
* ```html
107-
* <!-- Set in markup -->
108-
* <igx-grid #grid>
109-
* ...
110-
* <ng-template igxDragIndicatorIcon>
111-
* <igx-icon fontSet="material">info</igx-icon>
112-
* </ng-template>
113-
* </igx-grid>
114-
* ```
115-
*/
116-
public dragIndicatorIconTemplate: TemplateRef<any> = null;
117-
11897
constructor(
11998
public selectionService: IgxGridSelectionService,
12099
crudService: IgxGridCRUDService,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseCompone
411411
this.rowSelectorsTemplates = this.parentIsland ?
412412
this.parentIsland.rowSelectorsTemplates :
413413
this.rowSelectorsTemplates;
414+
this.dragIndicatorIconTemplate = this.parentIsland ?
415+
this.parentIsland.dragIndicatorIconTemplate :
416+
this.dragIndicatorIconTemplate;
414417
this.rowExpandedIndicatorTemplate = this.rootGrid.rowExpandedIndicatorTemplate;
415418
this.rowCollapsedIndicatorTemplate = this.rootGrid.rowCollapsedIndicatorTemplate;
416419
this.headerCollapseIndicatorTemplate = this.rootGrid.headerCollapseIndicatorTemplate;
@@ -443,6 +446,13 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseCompone
443446
return this.rootGrid._outletDirective;
444447
}
445448

449+
/**
450+
* @hidden
451+
*/
452+
public get parentRowOutletDirective() {
453+
return this === this.rootGrid ? null : this.rootGrid.rowEditingOutletDirective;
454+
}
455+
446456
/**
447457
* @hidden
448458
*/

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
@@ -313,27 +313,6 @@ export class IgxTreeGridComponent extends IgxGridBaseComponent implements IGridD
313313
@ContentChild(IgxRowLoadingIndicatorTemplateDirective, { read: IgxRowLoadingIndicatorTemplateDirective, static: false })
314314
protected rowLoadingTemplate: IgxRowLoadingIndicatorTemplateDirective;
315315

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

0 commit comments

Comments
 (0)