Skip to content

Commit 2684fc2

Browse files
Merge branch '8.2.x' into astaev/issue6260-8.2.x
2 parents 7d5195f + 80011a3 commit 2684fc2

25 files changed

+322
-120
lines changed

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"web-animations-js": "^2.3.2"
8080
},
8181
"devDependencies": {
82-
"igniteui-cli": "~4.2.0"
82+
"igniteui-cli": "~4.3.0"
8383
},
8484
"ng-update": {
8585
"migrations": "./migrations/migration-collection.json"

projects/igniteui-angular/src/lib/carousel/carousel.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
Output
1313
} from '@angular/core';
1414
import { IgxIconModule } from '../icon/index';
15-
import { IBaseEventArgs } from '../core/utils';
15+
import { IBaseEventArgs, PlatformUtil } from '../core/utils';
1616

1717
let NEXT_ID = 0;
1818

@@ -202,7 +202,7 @@ export class IgxCarouselComponent implements OnDestroy {
202202
private _destroyed: boolean;
203203
private _total = 0;
204204

205-
constructor(private element: ElementRef) { }
205+
constructor(private element: ElementRef, private platformUtil: PlatformUtil) { }
206206
/**
207207
*@hidden
208208
*/
@@ -465,7 +465,7 @@ export class IgxCarouselComponent implements OnDestroy {
465465
private _restartInterval() {
466466
this._resetInterval();
467467

468-
if (!isNaN(this.interval) && this.interval > 0) {
468+
if (!isNaN(this.interval) && this.interval > 0 && this.platformUtil.isBrowser) {
469469
this._lastInterval = setInterval(() => {
470470
const tick = +this.interval;
471471
if (this._playing && this.total && !isNaN(tick) && tick > 0) {

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/directives/for-of/for_of.directive.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
181181
@Output()
182182
public onChunkLoad = new EventEmitter<IForOfState>();
183183

184+
/**
185+
* @hidden @internal
186+
* An event that is emitted when scrollbar visibility has changed.
187+
*/
188+
@Output()
189+
public onScrollbarVisibilityChanged = new EventEmitter<any>();
190+
184191
/**
185192
* An event that is emitted after the rendered content size of the igxForOf has been changed.
186193
*/
@@ -1155,10 +1162,11 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
11551162
protected _recalcScrollBarSize() {
11561163
const count = this.isRemote ? this.totalItemCount : (this.igxForOf ? this.igxForOf.length : 0);
11571164
this.dc.instance.notVirtual = !(this.igxForContainerSize && this.dc && this.state.chunkSize < count);
1165+
const scrollable = this.isScrollable();
11581166
if (this.igxForScrollOrientation === 'horizontal') {
11591167
const totalWidth = this.igxForContainerSize ? this.initSizesCache(this.igxForOf) : 0;
11601168
this.scrollComponent.nativeElement.style.width = this.igxForContainerSize + 'px';
1161-
this.scrollComponent.nativeElement.children[0].style.width = totalWidth + 'px';
1169+
this.scrollComponent.size = totalWidth;
11621170
if (totalWidth <= parseInt(this.igxForContainerSize, 10)) {
11631171
this.scrollPosition = 0;
11641172
}
@@ -1170,6 +1178,10 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
11701178
this.scrollPosition = 0;
11711179
}
11721180
}
1181+
if (scrollable !== this.isScrollable()) {
1182+
// scrollbar visibility has changed
1183+
this.onScrollbarVisibilityChanged.emit();
1184+
}
11731185
}
11741186

11751187
protected _calcHeight(): number {

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: 30 additions & 3 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
*/
@@ -3017,9 +3034,19 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
30173034
});
30183035

30193036
this.verticalScrollContainer.onDataChanging.pipe(destructor, filter(() => !this._init)).subscribe(($event) => {
3020-
this.calculateGridHeight();
3021-
$event.containerSize = this.calcHeight;
3037+
const shouldRecalcSize = this.isPercentHeight &&
3038+
( !this.calcHeight || this.calcHeight === this.getDataBasedBodyHeight() ||
3039+
this.calcHeight === this.renderedRowHeight * this._defaultTargetRecordNumber);
3040+
if (shouldRecalcSize) {
3041+
this.calculateGridHeight();
3042+
$event.containerSize = this.calcHeight;
3043+
}
30223044
this.evaluateLoadingState();
3045+
});
3046+
3047+
this.verticalScrollContainer.onScrollbarVisibilityChanged.pipe(destructor, filter(() => !this._init)).subscribe(() => {
3048+
// called to recalc all widths that may have changes as a result of
3049+
// the vert. scrollbar showing/hiding
30233050
this.notifyChanges(true);
30243051
});
30253052

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

Lines changed: 48 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';
@@ -2388,6 +2429,9 @@ describe('IgxGrid - Advanced Filtering', () => {
23882429
// and verify that the root group and all of its children become selected.
23892430
let rootOperatorLine = GridFunctions.getAdvancedFilteringTreeRootGroupOperatorLine(fix);
23902431
UIInteractions.simulateKeyDownEvent(rootOperatorLine, 'Enter');
2432+
fix.detectChanges();
2433+
await wait(200);
2434+
fix.detectChanges();
23912435
await wait(200);
23922436
fix.detectChanges();
23932437
verifyChildrenSelection(GridFunctions.getAdvancedFilteringExpressionsContainer(fix), true);
@@ -2397,6 +2441,9 @@ describe('IgxGrid - Advanced Filtering', () => {
23972441
// and verify that the root group and all of its children become unselected.
23982442
rootOperatorLine = GridFunctions.getAdvancedFilteringTreeRootGroupOperatorLine(fix);
23992443
UIInteractions.simulateKeyDownEvent(rootOperatorLine, 'Enter');
2444+
fix.detectChanges();
2445+
await wait(200);
2446+
fix.detectChanges();
24002447
await wait(200);
24012448
fix.detectChanges();
24022449
verifyChildrenSelection(GridFunctions.getAdvancedFilteringExpressionsContainer(fix), false);

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

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,14 +1251,15 @@ describe('IgxGrid - Filtering actions #grid', () => {
12511251
fix.detectChanges();
12521252

12531253
const firstMonth = calendar.querySelector('.igx-calendar__month');
1254+
const firstMonthText = (firstMonth as HTMLElement).innerText;
12541255
firstMonth.dispatchEvent(new Event('click'));
12551256
tick();
12561257
fix.detectChanges();
12571258

12581259
calendar = outlet.getElementsByClassName('igx-calendar')[0];
12591260
const month = calendar.querySelector('.igx-calendar-picker__date');
12601261

1261-
expect(month.innerHTML.trim()).toEqual('Jan');
1262+
expect(month.innerHTML.trim()).toEqual(firstMonthText);
12621263
}));
12631264

12641265
it('Should correctly select year from year view datepicker/calendar component', fakeAsync(() => {
@@ -3319,23 +3320,30 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
33193320
fix.detectChanges();
33203321

33213322
GridFunctions.applyFilter('a', fix);
3322-
await wait(16);
3323+
fix.detectChanges();
3324+
await wait(300);
3325+
fix.detectChanges();
33233326
GridFunctions.applyFilter('e', fix);
3324-
await wait(16);
3327+
fix.detectChanges();
3328+
await wait(300);
3329+
fix.detectChanges();
33253330
GridFunctions.applyFilter('i', fix);
3326-
await wait(16);
3331+
fix.detectChanges();
3332+
await wait(300);
3333+
fix.detectChanges();
33273334
GridFunctions.applyFilter('o', fix);
33283335
// wait for chip to be scrolled in view
3329-
await wait(200);
33303336
fix.detectChanges();
3331-
await wait(100);
3337+
await wait(300);
3338+
fix.detectChanges();
33323339
verifyMultipleChipsVisibility(fix, [false, false, false, true]);
33333340

33343341
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
33353342
GridFunctions.removeFilterChipByIndex(3, filterUIRow);
33363343
// wait for chip to be scrolled in view
33373344
fix.detectChanges();
3338-
await wait(200);
3345+
await wait(300);
3346+
fix.detectChanges();
33393347

33403348
verifyMultipleChipsVisibility(fix, [false, true, false]);
33413349
let chips = filterUIRow.queryAll(By.directive(IgxChipComponent));
@@ -3344,7 +3352,8 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
33443352
GridFunctions.removeFilterChipByIndex(2, filterUIRow);
33453353
// wait for chip to be scrolled in view
33463354
fix.detectChanges();
3347-
await wait(200);
3355+
await wait(300);
3356+
fix.detectChanges();
33483357

33493358
verifyMultipleChipsVisibility(fix, [true, false]);
33503359
chips = filterUIRow.queryAll(By.directive(IgxChipComponent));

0 commit comments

Comments
 (0)