Skip to content

Commit 15e6c41

Browse files
authored
Merge branch 'master' into dmdimitrov/query-builder-improvements
2 parents d0cd054 + 5ac407d commit 15e6c41

File tree

15 files changed

+178
-94
lines changed

15 files changed

+178
-94
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,15 +1202,15 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12021202
this.searchValue = '';
12031203
if (!e.event) {
12041204
this.comboInput?.nativeElement.focus();
1205+
} else {
1206+
this._onTouchedCallback();
1207+
this.updateValidity();
12051208
}
12061209
}
12071210

12081211
/** @hidden @internal */
12091212
public handleClosed() {
12101213
this.closed.emit({ owner: this });
1211-
if(this.comboInput.nativeElement !== this.document.activeElement){
1212-
this.validateComboState();
1213-
}
12141214
}
12151215

12161216
/** @hidden @internal */
@@ -1250,15 +1250,10 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12501250
public onBlur() {
12511251
if (this.collapsed) {
12521252
this._onTouchedCallback();
1253-
this.validateComboState();
1253+
this.updateValidity();
12541254
}
12551255
}
12561256

1257-
/** @hidden @internal */
1258-
public onFocus(): void {
1259-
this._onTouchedCallback();
1260-
}
1261-
12621257
/** @hidden @internal */
12631258
public setActiveDescendant(): void {
12641259
this.activeDescendant = this.dropdown.focusedItem?.id || '';
@@ -1283,7 +1278,7 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12831278
this.manageRequiredAsterisk();
12841279
};
12851280

1286-
private validateComboState() {
1281+
private updateValidity() {
12871282
if (this.ngControl && this.ngControl.invalid) {
12881283
this.valid = IgxInputState.INVALID;
12891284
} 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
@@ -22,15 +22,17 @@ export declare interface IFilteringExpressionsTree extends IBaseEventArgs, IExpr
2222
/* alternateName: treeType */
2323
type?: FilteringExpressionsTreeType;
2424

25+
/* blazorSuppress */
2526
/**
2627
* @deprecated in version 18.2.0. Use `ExpressionsTreeUtil.find` instead.
2728
*/
28-
find(fieldName: string): IFilteringExpressionsTree | IFilteringExpression;
29+
find?: (fieldName: string) => IFilteringExpressionsTree | IFilteringExpression;
2930

31+
/* blazorSuppress */
3032
/**
3133
* @deprecated in version 18.2.0. Use `ExpressionsTreeUtil.findIndex` instead.
3234
*/
33-
findIndex(fieldName: string): number;
35+
findIndex?: (fieldName: string) => number;
3436
}
3537

3638
/* marshalByValue */
@@ -142,6 +144,7 @@ export class FilteringExpressionsTree implements IFilteringExpressionsTree {
142144
return !expressionTree || !expressionTree.filteringOperands || !expressionTree.filteringOperands.length;
143145
}
144146

147+
/* blazorSuppress */
145148
/**
146149
* Returns the filtering expression for a column with the provided fieldName.
147150
* ```typescript
@@ -155,6 +158,7 @@ export class FilteringExpressionsTree implements IFilteringExpressionsTree {
155158
return ExpressionsTreeUtil.find(this, fieldName);
156159
}
157160

161+
/* blazorSuppress */
158162
/**
159163
* Returns the index of the filtering expression for a column with the provided fieldName.
160164
* ```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
@@ -2759,6 +2759,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
27592759

27602760
GridFunctions.clickFilterCellChip(fix, 'AnotherField');
27612761
fix.detectChanges();
2762+
grid.cdr.detectChanges();
27622763

27632764
// check if it is positioned at the bottom of the thead.
27642765
const theadWrapper = grid.theadRow.nativeElement.firstElementChild;
@@ -5841,6 +5842,32 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
58415842
expect(gridCellValues).toEqual(listItems);
58425843
}));
58435844

5845+
it('Should filter grid correctly with case insensitive duplicates', fakeAsync(() => {
5846+
grid.data = SampleTestData.excelFilteringDataDuplicateValues();
5847+
fix.detectChanges();
5848+
// Open excel style custom filtering dialog.
5849+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'AnotherField');
5850+
5851+
// Type string in search box.
5852+
const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix);
5853+
const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent);
5854+
UIInteractions.clickAndSendInputElementValue(inputNativeElement, 'cust', fix);
5855+
tick(100);
5856+
fix.detectChanges();
5857+
5858+
// Click 'apply' button to apply filter.
5859+
GridFunctions.clickApplyExcelStyleFiltering(fix);
5860+
tick(100);
5861+
fix.detectChanges();
5862+
5863+
// Get the results and verify their count.
5864+
const gridCellValues = GridFunctions.getColumnCells(fix, 'AnotherField')
5865+
.map(c => c.nativeElement.innerText)
5866+
.sort();
5867+
5868+
expect(gridCellValues.length).toEqual(5);
5869+
}));
5870+
58445871
it('Should disable the apply button when there are no results.', fakeAsync(() => {
58455872
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'Downloads');
58465873

0 commit comments

Comments
 (0)