Skip to content

Commit eed5e15

Browse files
authored
Merge branch 'master' into ganastasov/feat-14905-master
2 parents 64a7260 + 5ac407d commit eed5e15

File tree

18 files changed

+220
-146
lines changed

18 files changed

+220
-146
lines changed

projects/igniteui-angular/src/lib/combo/combo.common.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,11 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
179179
return;
180180
}
181181
const selection = this.selectionService.get(this._id);
182+
this.selectionService.clear(this._id);
182183
this._id = value;
183184
if (selection) {
184185
this.selectionService.set(this._id, selection);
185186
}
186-
if (this.dropdown?.open) {
187-
this.dropdown.close();
188-
}
189-
if (this.inputGroup?.isFocused) {
190-
this.inputGroup.element.nativeElement.blur();
191-
this.inputGroup.isFocused = false;
192-
}
193187
}
194188

195189
/**
@@ -1208,15 +1202,15 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12081202
this.searchValue = '';
12091203
if (!e.event) {
12101204
this.comboInput?.nativeElement.focus();
1205+
} else {
1206+
this._onTouchedCallback();
1207+
this.updateValidity();
12111208
}
12121209
}
12131210

12141211
/** @hidden @internal */
12151212
public handleClosed() {
12161213
this.closed.emit({ owner: this });
1217-
if(this.comboInput.nativeElement !== this.document.activeElement){
1218-
this.validateComboState();
1219-
}
12201214
}
12211215

12221216
/** @hidden @internal */
@@ -1256,15 +1250,10 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12561250
public onBlur() {
12571251
if (this.collapsed) {
12581252
this._onTouchedCallback();
1259-
this.validateComboState();
1253+
this.updateValidity();
12601254
}
12611255
}
12621256

1263-
/** @hidden @internal */
1264-
public onFocus(): void {
1265-
this._onTouchedCallback();
1266-
}
1267-
12681257
/** @hidden @internal */
12691258
public setActiveDescendant(): void {
12701259
this.activeDescendant = this.dropdown.focusedItem?.id || '';
@@ -1289,7 +1278,7 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12891278
this.manageRequiredAsterisk();
12901279
};
12911280

1292-
private validateComboState() {
1281+
private updateValidity() {
12931282
if (this.ngControl && this.ngControl.invalid) {
12941283
this.valid = IgxInputState.INVALID;
12951284
} else {

projects/igniteui-angular/src/lib/combo/combo.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
role="combobox" aria-haspopup="listbox"
1414
[attr.aria-expanded]="!dropdown.collapsed" [attr.aria-controls]="dropdown.listId"
1515
[attr.aria-labelledby]="ariaLabelledBy || label?.id || placeholder"
16-
(blur)="onBlur()"
17-
(focus)="onFocus()" />
16+
(blur)="onBlur()" />
1817
<ng-container ngProjectAs="igx-suffix">
1918
<ng-content select="igx-suffix"></ng-content>
2019
</ng-container>

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3615,7 +3615,7 @@ describe('igxCombo', () => {
36153615
combo.open();
36163616
input.triggerEventHandler('focus', {});
36173617
fixture.detectChanges();
3618-
expect(ngModel.touched).toBeTrue();
3618+
expect(ngModel.touched).toBeFalse();
36193619
combo.searchInput.nativeElement.focus();
36203620
fixture.detectChanges();
36213621
const documentClickEvent = new MouseEvent('click', { bubbles: true });

projects/igniteui-angular/src/lib/core/styles/components/tabs/_tabs-theme.scss

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,6 @@
252252
flex: 0 0 auto;
253253
background: var-get($theme, 'item-background');
254254
z-index: 1;
255-
256-
@if $indigo-theme {
257-
[igxIconButton='flat'].igx-button--focused {
258-
box-shadow: none;
259-
260-
&::after {
261-
border: rem(3px) solid var(--nav-btn-border-color);
262-
263-
@if $theme-variant == 'dark' {
264-
border-color: contrast-color($color: 'gray', $variant: 50, $opacity: .2);
265-
}
266-
}
267-
}
268-
}
269255
}
270256

271257
%tabs-header-content {

projects/igniteui-angular/src/lib/data-operations/filtering-expressions-tree.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ export declare interface IFilteringExpressionsTree extends IBaseEventArgs, IExpr
2020
/* alternateName: treeType */
2121
type?: FilteringExpressionsTreeType;
2222

23+
/* blazorSuppress */
2324
/**
2425
* @deprecated in version 18.2.0. Use `ExpressionsTreeUtil.find` instead.
2526
*/
26-
find(fieldName: string): IFilteringExpressionsTree | IFilteringExpression;
27+
find?: (fieldName: string) => IFilteringExpressionsTree | IFilteringExpression;
2728

29+
/* blazorSuppress */
2830
/**
2931
* @deprecated in version 18.2.0. Use `ExpressionsTreeUtil.findIndex` instead.
3032
*/
31-
findIndex(fieldName: string): number;
33+
findIndex?: (fieldName: string) => number;
3234
}
3335

3436
/* marshalByValue */
@@ -112,6 +114,7 @@ export class FilteringExpressionsTree implements IFilteringExpressionsTree {
112114
return !expressionTree || !expressionTree.filteringOperands || !expressionTree.filteringOperands.length;
113115
}
114116

117+
/* blazorSuppress */
115118
/**
116119
* Returns the filtering expression for a column with the provided fieldName.
117120
* ```typescript
@@ -125,6 +128,7 @@ export class FilteringExpressionsTree implements IFilteringExpressionsTree {
125128
return ExpressionsTreeUtil.find(this, fieldName);
126129
}
127130

131+
/* blazorSuppress */
128132
/**
129133
* Returns the index of the filtering expression for a column with the provided fieldName.
130134
* ```typescript

projects/igniteui-angular/src/lib/directives/scroll-inertia/scroll_inertia.directive.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
6969
return;
7070
}
7171
const targetElem = this.parentElement;
72-
targetElem.addEventListener('wheel', this.onWheel.bind(this));
73-
targetElem.addEventListener('touchstart', this.onTouchStart.bind(this));
74-
targetElem.addEventListener('touchmove', this.onTouchMove.bind(this));
75-
targetElem.addEventListener('touchend', this.onTouchEnd.bind(this));
72+
targetElem.addEventListener('wheel', this.onWheel.bind(this), { passive: false });
73+
targetElem.addEventListener('touchstart', this.onTouchStart.bind(this), { passive: false });
74+
targetElem.addEventListener('touchmove', this.onTouchMove.bind(this), { passive: false });
75+
targetElem.addEventListener('touchend', this.onTouchEnd.bind(this), { passive: false });
7676
});
7777
}
7878

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

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ export class IgxGridExcelStyleFilteringComponent extends BaseFilteringComponent
221221

222222
/**
223223
* Gets the minimum height.
224-
*
225-
* Setting value in template:
224+
*
225+
* Setting value in template:
226226
* ```ts
227-
* [minHeight]="'<number><unit (px|rem|etc..)>'"
227+
* [minHeight]="'<number><unit (px|rem|etc..)>'"
228228
* ```
229-
*
230-
* Example for setting a value:
229+
*
230+
* Example for setting a value:
231231
* ```ts
232232
* [minHeight]="'700px'"
233233
* ```
@@ -258,13 +258,13 @@ export class IgxGridExcelStyleFilteringComponent extends BaseFilteringComponent
258258

259259
/**
260260
* Gets the maximum height.
261-
*
262-
* Setting value in template:
261+
*
262+
* Setting value in template:
263263
* ```ts
264-
* [maxHeight]="'<number><unit (px|rem|etc..)>'"
264+
* [maxHeight]="'<number><unit (px|rem|etc..)>'"
265265
* ```
266-
*
267-
* Example for setting a value:
266+
*
267+
* Example for setting a value:
268268
* ```ts
269269
* [maxHeight]="'700px'"
270270
* ```
@@ -509,6 +509,11 @@ export class IgxGridExcelStyleFilteringComponent extends BaseFilteringComponent
509509
private renderValues() {
510510
this.filterValues = this.generateFilterValues();
511511
this.generateListData();
512+
this.expressionsList.forEach(expr => {
513+
if (this.column.dataType === GridColumnDataType.String && this.column.filteringIgnoreCase && expr.expression.searchVal) {
514+
this.modifyExpression(expr);
515+
}
516+
});
512517
}
513518

514519
private generateFilterValues() {
@@ -539,6 +544,16 @@ export class IgxGridExcelStyleFilteringComponent extends BaseFilteringComponent
539544
return filterValues;
540545
}
541546

547+
private modifyExpression(expr: ExpressionUI) {
548+
const lowerCaseFilterValues = new Set(Array.from(expr.expression.searchVal).map((value: string) => value.toLowerCase()));
549+
550+
this.grid.data.forEach(item => {
551+
if (lowerCaseFilterValues.has(item[this.column.field]?.toLowerCase())) {
552+
expr.expression.searchVal.add(item[this.column.field]);
553+
}
554+
});
555+
}
556+
542557
private generateListData() {
543558
this.listData = new Array<FilterListItem>();
544559
const shouldUpdateSelection = this.areExpressionsSelectable();

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

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,9 +2277,6 @@ export abstract class IgxGridBaseDirective implements GridType,
22772277
this._allowFiltering = value;
22782278
this.filteringService.registerSVGIcons();
22792279

2280-
if (!this._init) {
2281-
this.calcGridHeadRow();
2282-
}
22832280

22842281
this.filteringService.isFilterRowVisible = false;
22852282
this.filteringService.filteredColumn = null;
@@ -6859,25 +6856,11 @@ export abstract class IgxGridBaseDirective implements GridType,
68596856
}
68606857
}
68616858

6862-
/**
6863-
* @hidden
6864-
* @internal
6865-
*/
6866-
protected calcGridHeadRow() {
6867-
if (this.maxLevelHeaderDepth) {
6868-
this._baseFontSize = parseFloat(getComputedStyle(this.document.documentElement).getPropertyValue('font-size'));
6869-
const hasFilterRow = this._allowFiltering && this._filterMode === FilterMode.quickFilter;
6870-
const minSize = (this.maxLevelHeaderDepth + 1 + (hasFilterRow ? 1 : 0)) * this.defaultRowHeight / this._baseFontSize;
6871-
this.theadRow.nativeElement.style.minHeight = `${minSize}rem`;
6872-
}
6873-
}
6874-
68756859
/**
68766860
* @hidden
68776861
* Sets TBODY height i.e. this.calcHeight
68786862
*/
68796863
protected calculateGridHeight() {
6880-
this.calcGridHeadRow();
68816864

68826865
this.calcHeight = this._calculateGridBodyHeight();
68836866
if (this.pinnedRowHeight && this.calcHeight) {
@@ -7805,7 +7788,7 @@ export abstract class IgxGridBaseDirective implements GridType,
78057788
} else {
78067789
this._shouldRecalcRowHeight = true;
78077790
}
7808-
}
7791+
}
78097792
}
78107793

78117794
// TODO: About to Move to CRUD

projects/igniteui-angular/src/lib/grids/grid/column-group.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ describe('IgxGrid - multi-column headers #grid', () => {
6767
expect(grid.getColumnByName('ContactName').level).toEqual(expectedLevel);
6868
});
6969

70+
it('should initialize a grid with correct header height', () => {
71+
fixture = TestBed.createComponent(ColumnGroupTestComponent);
72+
fixture.detectChanges();
73+
grid = fixture.componentInstance.grid;
74+
75+
const expectedGridHeaderHeight = 151;
76+
const headerHeight = grid.nativeElement
77+
.querySelector("igx-grid-header-row")
78+
.getBoundingClientRect().height;
79+
80+
expect(Math.round(headerHeight)).toEqual(expectedGridHeaderHeight);
81+
});
82+
7083
it('Should render column group headers correctly.', fakeAsync(() => {
7184
fixture = TestBed.createComponent(BlueWhaleGridComponent);
7285
fixture.detectChanges();

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2746,6 +2746,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
27462746

27472747
GridFunctions.clickFilterCellChip(fix, 'AnotherField');
27482748
fix.detectChanges();
2749+
grid.cdr.detectChanges();
27492750

27502751
// check if it is positioned at the bottom of the thead.
27512752
const theadWrapper = grid.theadRow.nativeElement.firstElementChild;
@@ -5828,6 +5829,32 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
58285829
expect(gridCellValues).toEqual(listItems);
58295830
}));
58305831

5832+
it('Should filter grid correctly with case insensitive duplicates', fakeAsync(() => {
5833+
grid.data = SampleTestData.excelFilteringDataDuplicateValues();
5834+
fix.detectChanges();
5835+
// Open excel style custom filtering dialog.
5836+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'AnotherField');
5837+
5838+
// Type string in search box.
5839+
const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix);
5840+
const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent);
5841+
UIInteractions.clickAndSendInputElementValue(inputNativeElement, 'cust', fix);
5842+
tick(100);
5843+
fix.detectChanges();
5844+
5845+
// Click 'apply' button to apply filter.
5846+
GridFunctions.clickApplyExcelStyleFiltering(fix);
5847+
tick(100);
5848+
fix.detectChanges();
5849+
5850+
// Get the results and verify their count.
5851+
const gridCellValues = GridFunctions.getColumnCells(fix, 'AnotherField')
5852+
.map(c => c.nativeElement.innerText)
5853+
.sort();
5854+
5855+
expect(gridCellValues.length).toEqual(5);
5856+
}));
5857+
58315858
it('Should disable the apply button when there are no results.', fakeAsync(() => {
58325859
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'Downloads');
58335860

0 commit comments

Comments
 (0)