Skip to content

Commit 1723224

Browse files
Merge branch '9.0.x' into dmdimitrov/issue4158-9.0.x
2 parents 26c1f7e + e9942fb commit 1723224

10 files changed

+312
-79
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { IBaseChipEventArgs, IgxChipsAreaComponent, IgxChipComponent } from '../
2424
import { ExpressionUI } from '../grid-filtering.service';
2525
import { IgxDropDownItemComponent } from '../../../drop-down/drop-down-item.component';
2626
import { IgxFilteringService } from '../grid-filtering.service';
27-
import { KEYS, isEdge } from '../../../core/utils';
27+
import { KEYS, isEdge, isIE } from '../../../core/utils';
2828
import { AbsoluteScrollStrategy } from '../../../services/overlay/scroll';
2929

3030
/**
@@ -281,8 +281,11 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
281281
public onInput(eventArgs) {
282282
// The 'iskeyPressed' flag is needed for a case in IE, because the input event is fired on focus and for some reason,
283283
// when you have a japanese character as a placeholder, on init the value here is empty string .
284-
if (isEdge() || this.isKeyPressed || eventArgs.target.value) {
285-
this.value = eventArgs.target.value;
284+
// There is no need to reset the value on every invalid number input.
285+
// The invalid value is converted to empty string input type="number"
286+
const target = eventArgs.target;
287+
if (isEdge() && target.type !== 'number' || this.isKeyPressed && isIE() || target.value) {
288+
this.value = target.value;
286289
}
287290
}
288291

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@
3131
[indeterminate]="item.indeterminate"
3232
[disableTransitions]="true"
3333
(change)="onCheckboxChange($event)">
34-
{{ column.formatter && !item.isSpecial ? column.formatter(item.label) : column.dataType === 'number' ? (item.label | igxdecimal:
35-
column.grid.locale) : column.dataType === 'date' ? (item.label | igxdate: column.grid.locale) : item.label }}
34+
{{ item.label }}
3635
</igx-checkbox>
3736
</igx-list-item>
3837
</div>
3938

40-
<ng-template igxDataLoading>
39+
<ng-template igxDataLoading>
4140
<div class="igx-excel-filter__loading">
4241
<ng-container *ngTemplateOutlet="valuesLoadingTemplate">
4342
</ng-container>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ export class IgxExcelStyleSearchFilterPipe implements PipeTransform {
2020

2121
searchText = searchText.toLowerCase();
2222
const result = items.filter((it, i) => (i === 0 && it.isSpecial) ||
23-
(it.value !== null && it.value !== undefined) &&
24-
it.value.toString().toLowerCase().indexOf(searchText) > -1);
23+
(it.label !== null && it.label !== undefined) &&
24+
!it.isBlanks &&
25+
it.label.toString().toLowerCase().indexOf(searchText) > -1);
2526

2627
// If 'result' contains the 'Select All' item and at least one more - we use it, otherwise we use an empty array.
2728
return result.length > 1 ? result : [];

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { ISelectionEventArgs, IgxDropDownComponent } from '../../../drop-down';
4040
import { IgxColumnComponent } from '../../columns/column.component';
4141
import { IgxGridBaseDirective } from '../../grid-base.directive';
4242
import { DisplayDensity } from '../../../core/density';
43+
import { IgxDecimalPipeComponent, IgxDatePipeComponent } from '../../common/pipes';
4344

4445
/**
4546
*@hidden
@@ -50,6 +51,7 @@ export class FilterListItem {
5051
public isSelected: boolean;
5152
public indeterminate: boolean;
5253
public isSpecial = false;
54+
public isBlanks = false;
5355
}
5456

5557
@Directive({
@@ -672,6 +674,10 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
672674
private addItems(shouldUpdateSelection: boolean) {
673675
this.selectAllSelected = true;
674676
this.selectAllIndeterminate = false;
677+
678+
const numberPipe = new IgxDecimalPipeComponent(this.column.grid.locale);
679+
const datePipe = new IgxDatePipeComponent(this.column.grid.locale);
680+
675681
this.uniqueValues.forEach(element => {
676682
if (element !== undefined && element !== null && element !== '') {
677683
const filterListItem = new FilterListItem();
@@ -691,12 +697,29 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
691697
filterListItem.isSelected = true;
692698
}
693699
if (this.column.dataType === DataType.Date) {
694-
filterListItem.value = new Date(element);
695-
filterListItem.label = new Date(element);
700+
const date = new Date(element);
701+
702+
filterListItem.value = date;
703+
704+
filterListItem.label = this.column.formatter ?
705+
this.column.formatter(date) :
706+
datePipe.transform(date, this.column.grid.locale);
707+
708+
} else if (this.column.dataType === DataType.Number) {
709+
filterListItem.value = element;
710+
711+
filterListItem.label = this.column.formatter ?
712+
this.column.formatter(element) :
713+
numberPipe.transform(element, this.column.grid.locale);
714+
696715
} else {
697716
filterListItem.value = element;
698-
filterListItem.label = element;
717+
718+
filterListItem.label = this.column.formatter ?
719+
this.column.formatter(element) :
720+
element;
699721
}
722+
700723
filterListItem.indeterminate = false;
701724
this.listData.push(filterListItem);
702725
} else {
@@ -732,6 +755,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
732755
blanks.label = this.grid.resourceStrings.igx_grid_excel_blanks;
733756
blanks.indeterminate = false;
734757
blanks.isSpecial = true;
758+
blanks.isBlanks = true;
735759
this.listData.unshift(blanks);
736760
}
737761

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,13 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
229229

230230
expect(grid.rowList.length).toEqual(3);
231231
verifyFilterRowUI(input, close, reset, false);
232+
233+
// greater than or equal to with invalid value should not reset filter
234+
GridFunctions.openFilterDDAndSelectCondition(fix, 4);
235+
GridFunctions.typeValueInFilterRowInput('254..', fix, input);
236+
237+
expect(grid.rowList.length).toEqual(3);
238+
verifyFilterRowUI(input, close, reset, false);
232239
}));
233240

234241
// UI tests boolean column
@@ -4175,6 +4182,34 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
41754182
excelMenu = GridFunctions.getExcelStyleFilteringComponent(fix);
41764183
expect(excelMenu).toBeNull();
41774184
}));
4185+
4186+
it('Should filter date by input string', fakeAsync(() => {
4187+
GridFunctions.clickExcelFilterIcon(fix, 'ReleaseDate');
4188+
tick(100);
4189+
fix.detectChanges();
4190+
4191+
const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix);
4192+
let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent);
4193+
const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent);
4194+
4195+
const todayDateFull = SampleTestData.today;
4196+
const todayDate = todayDateFull.getDate().toString();
4197+
const dayOfWeek = todayDateFull.toString().substring(0, 3);
4198+
4199+
UIInteractions.sendInputElementValue(inputNativeElement, todayDate, fix);
4200+
tick(100);
4201+
fix.detectChanges();
4202+
4203+
listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent);
4204+
expect(listItems.length).toBe(4, 'incorrect rendered list items count');
4205+
4206+
UIInteractions.sendInputElementValue(inputNativeElement, dayOfWeek, fix);
4207+
tick(100);
4208+
fix.detectChanges();
4209+
4210+
listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent);
4211+
expect(listItems.length).toBe(0, 'incorrect rendered list items count');
4212+
}));
41784213
});
41794214

41804215
describe(null, () => {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Injectable } from '@angular/core';
2+
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
3+
4+
@Injectable()
5+
export class BottomNavRoutingTestGuard implements CanActivate {
6+
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
7+
if (state.url === '/view5') {
8+
return false;
9+
} else {
10+
return true;
11+
}
12+
}
13+
}

projects/igniteui-angular/src/lib/tabbar/routing-view-components.spec.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,26 @@ export class BottomNavRoutingView2Component {
1818
export class BottomNavRoutingView3Component {
1919
}
2020

21+
@Component({
22+
template: `This is a content from view component # 4`
23+
})
24+
export class BottomNavRoutingView4Component {
25+
}
26+
27+
@Component({
28+
template: `This is a content from view component # 5`
29+
})
30+
export class BottomNavRoutingView5Component {
31+
}
32+
2133
/**
2234
* @hidden
2335
*/
2436
@NgModule({
25-
declarations: [BottomNavRoutingView1Component, BottomNavRoutingView2Component, BottomNavRoutingView3Component],
26-
exports: [BottomNavRoutingView1Component, BottomNavRoutingView2Component, BottomNavRoutingView3Component],
37+
declarations: [BottomNavRoutingView1Component, BottomNavRoutingView2Component, BottomNavRoutingView3Component,
38+
BottomNavRoutingView4Component, BottomNavRoutingView5Component],
39+
exports: [BottomNavRoutingView1Component, BottomNavRoutingView2Component, BottomNavRoutingView3Component,
40+
BottomNavRoutingView4Component, BottomNavRoutingView5Component]
2741
})
2842
export class BottomNavRoutingViewComponentsModule {
2943
}

projects/igniteui-angular/src/lib/tabbar/tab-bar-content.component.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
<ng-content></ng-content>
33
</div>
44
<div #tablist class="{{itemStyle}}__menu {{itemStyle}}__menu--bottom" role="tablist" aria-orientation="horizontal">
5-
<ng-container *ngIf="!hasContentTabs">
6-
<igx-tab *ngFor="let panel of panels" [relatedPanel]="panel">
5+
<ng-container *ngIf="!hasContentTabs">
6+
<igx-tab *ngFor="let panel of panels; let i = index"
7+
[relatedPanel]="panel"
8+
[autoGenerated]="true"
9+
[id]="getTabId(i)"
10+
[attr.aria-controls]="getTabPanelId(i)">>
711
</igx-tab>
812
</ng-container>
913
<ng-content select="igx-tab"></ng-content>
10-
</div>
14+
</div>

0 commit comments

Comments
 (0)