Skip to content

Commit f4afcb1

Browse files
Merge branch 'master' into dmdimitrov/issue4158-master
2 parents 589b8bd + d884a84 commit f4afcb1

File tree

15 files changed

+302
-181
lines changed

15 files changed

+302
-181
lines changed

projects/igniteui-angular/src/lib/core/styles/components/splitter/_splitter-theme.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
align-items: center;
9494
background: $splitter-color;
9595
border: 1px solid $splitter-color;
96-
cursor: row-resize;
9796
z-index: 99;
9897
opacity: .68;
9998
transition: opacity .15s $ease-out-quad !important;
@@ -123,7 +122,6 @@
123122
%igx-splitter-bar--vertical {
124123
flex-direction: column;
125124
height: 100%;
126-
cursor: col-resize;
127125

128126
&::before {
129127
@extend %handle-area--vertical;

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
@@ -30,13 +30,12 @@
3030
[indeterminate]="item.indeterminate"
3131
[disableTransitions]="true"
3232
(change)="onCheckboxChange($event)">
33-
{{ column.formatter && !item.isSpecial ? column.formatter(item.label) : column.dataType === 'number' ? (item.label | igxdecimal:
34-
column.grid.locale) : column.dataType === 'date' ? (item.label | igxdate: column.grid.locale) : item.label }}
33+
{{ item.label }}
3534
</igx-checkbox>
3635
</igx-list-item>
3736
</div>
3837

39-
<ng-template igxDataLoading>
38+
<ng-template igxDataLoading>
4039
<div class="igx-excel-filter__loading">
4140
<ng-container *ngTemplateOutlet="valuesLoadingTemplate">
4241
</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
@@ -41,6 +41,7 @@ import { IgxColumnComponent } from '../../columns/column.component';
4141
import { IgxGridBaseDirective } from '../../grid-base.directive';
4242
import { DisplayDensity } from '../../../core/density';
4343
import { GridSelectionMode } from '../../common/enums';
44+
import { IgxDecimalPipeComponent, IgxDatePipeComponent } from '../../common/pipes';
4445

4546
/**
4647
* @hidden
@@ -51,6 +52,7 @@ export class FilterListItem {
5152
public isSelected: boolean;
5253
public indeterminate: boolean;
5354
public isSpecial = false;
55+
public isBlanks = false;
5456
}
5557

5658
@Directive({
@@ -712,6 +714,10 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
712714
private addItems(shouldUpdateSelection: boolean) {
713715
this.selectAllSelected = true;
714716
this.selectAllIndeterminate = false;
717+
718+
const numberPipe = new IgxDecimalPipeComponent(this.column.grid.locale);
719+
const datePipe = new IgxDatePipeComponent(this.column.grid.locale);
720+
715721
this.uniqueValues.forEach(element => {
716722
if (element !== undefined && element !== null && element !== '') {
717723
const filterListItem = new FilterListItem();
@@ -731,12 +737,29 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
731737
filterListItem.isSelected = true;
732738
}
733739
if (this.column.dataType === DataType.Date) {
734-
filterListItem.value = new Date(element);
735-
filterListItem.label = new Date(element);
740+
const date = new Date(element);
741+
742+
filterListItem.value = date;
743+
744+
filterListItem.label = this.column.formatter ?
745+
this.column.formatter(date) :
746+
datePipe.transform(date, this.column.grid.locale);
747+
748+
} else if (this.column.dataType === DataType.Number) {
749+
filterListItem.value = element;
750+
751+
filterListItem.label = this.column.formatter ?
752+
this.column.formatter(element) :
753+
numberPipe.transform(element, this.column.grid.locale);
754+
736755
} else {
737756
filterListItem.value = element;
738-
filterListItem.label = element;
757+
758+
filterListItem.label = this.column.formatter ?
759+
this.column.formatter(element) :
760+
element;
739761
}
762+
740763
filterListItem.indeterminate = false;
741764
this.listData.push(filterListItem);
742765
} else {
@@ -772,6 +795,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
772795
blanks.label = this.grid.resourceStrings.igx_grid_excel_blanks;
773796
blanks.indeterminate = false;
774797
blanks.isSpecial = true;
798+
blanks.isBlanks = true;
775799
this.listData.unshift(blanks);
776800
}
777801

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4264,6 +4264,34 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
42644264
excelMenu = GridFunctions.getExcelStyleFilteringComponent(fix);
42654265
expect(excelMenu).toBeNull();
42664266
}));
4267+
4268+
it('Should filter date by input string', fakeAsync(() => {
4269+
GridFunctions.clickExcelFilterIcon(fix, 'ReleaseDate');
4270+
tick(100);
4271+
fix.detectChanges();
4272+
4273+
const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix);
4274+
let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent);
4275+
const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent);
4276+
4277+
const todayDateFull = SampleTestData.today;
4278+
const todayDate = todayDateFull.getDate().toString();
4279+
const dayOfWeek = todayDateFull.toString().substring(0, 3);
4280+
4281+
UIInteractions.sendInputElementValue(inputNativeElement, todayDate, fix);
4282+
tick(100);
4283+
fix.detectChanges();
4284+
4285+
listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent);
4286+
expect(listItems.length).toBe(4, 'incorrect rendered list items count');
4287+
4288+
UIInteractions.sendInputElementValue(inputNativeElement, dayOfWeek, fix);
4289+
tick(100);
4290+
fix.detectChanges();
4291+
4292+
listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent);
4293+
expect(listItems.length).toBe(0, 'incorrect rendered list items count');
4294+
}));
42674295
});
42684296

42694297
describe(null, () => {

projects/igniteui-angular/src/lib/splitter/splitter-bar/splitter-bar.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div class="igx-splitter-bar"
22
[class.igx-splitter-bar--vertical]='type === 0'
3+
[style.cursor]='cursor'
34
igxDrag
45
[ghost]="false"
56
[dragDirection]='dragDir'

projects/igniteui-angular/src/lib/splitter/splitter-bar/splitter-bar.component.ts

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ import {DragDirection, IDragMoveEventArgs, IDragStartEventArgs} from '../../dire
77
export const SPLITTER_INTERACTION_KEYS = new Set('right down left up arrowright arrowdown arrowleft arrowup'.split(' '));
88

99
/**
10-
* Provides reference to `SplitBarComponent` component.
11-
* Represents the draggable gripper that visually separates panes and allows for changing their sizes.
12-
* @export
13-
* @class SplitBarComponent
10+
* @hidden @internal
11+
* Represents the draggable bar that visually separates panes and allows for changing their sizes.
1412
*/
1513
@Component({
1614
selector: 'igx-splitter-bar',
@@ -24,15 +22,13 @@ export class IgxSplitBarComponent {
2422
public cssClass = 'igx-splitter-bar-host';
2523

2624
/**
27-
* Sets/gets `IgxSplitBarComponent` orientation.
28-
* @type SplitterType
25+
* Gets/Sets the orientation.
2926
*/
3027
@Input()
31-
public type: SplitterType = SplitterType.Vertical;
28+
public type: SplitterType = SplitterType.Horizontal;
3229

3330
/**
34-
* Sets/gets `IgxSplitBarComponent` element order.
35-
* @type SplitterType
31+
* Sets/gets the element order.
3632
*/
3733
@HostBinding('style.order')
3834
@Input()
@@ -43,7 +39,29 @@ export class IgxSplitBarComponent {
4339
* @internal
4440
*/
4541
@HostBinding('attr.tabindex')
46-
public tabindex = 0;
42+
public get tabindex() {
43+
return this.resizeDisallowed ? null : 0;
44+
}
45+
46+
/**
47+
* @hidden
48+
* @internal
49+
*/
50+
@HostBinding('attr.aria-orientation')
51+
public get orientation() {
52+
return this.type === SplitterType.Horizontal ? 'horizontal' : 'vertical';
53+
}
54+
55+
/**
56+
* @hidden
57+
* @internal
58+
*/
59+
public get cursor() {
60+
if (this.resizeDisallowed) {
61+
return '';
62+
}
63+
return this.type === SplitterType.Horizontal ? 'col-resize' : 'row-resize';
64+
}
4765

4866
/**
4967
* Sets/gets the `SplitPaneComponent` associated with the current `SplitBarComponent`.
@@ -60,35 +78,26 @@ export class IgxSplitBarComponent {
6078

6179
/**
6280
* An event that is emitted whenever we start dragging the current `SplitBarComponent`.
63-
* @memberof SplitBarComponent
6481
*/
6582
@Output()
6683
public moveStart = new EventEmitter<IgxSplitterPaneComponent>();
6784

6885
/**
6986
* An event that is emitted while we are dragging the current `SplitBarComponent`.
70-
* @memberof SplitBarComponent
7187
*/
7288
@Output()
7389
public moving = new EventEmitter<number>();
7490

75-
/**
76-
* An event that is emitted when collapsing the pane
77-
*/
78-
@Output()
79-
public togglePane = new EventEmitter<IgxSplitterPaneComponent>();
8091
/**
8192
* A temporary holder for the pointer coordinates.
82-
* @private
83-
* @memberof SplitBarComponent
8493
*/
8594
private startPoint!: number;
8695

8796
/**
8897
* @hidden @internal
8998
*/
9099
public get prevButtonHidden() {
91-
return this.siblings[0].hidden && !this.siblings[1].hidden;
100+
return this.siblings[0].collapsed && !this.siblings[1].collapsed;
92101
}
93102

94103
/**
@@ -175,9 +184,12 @@ export class IgxSplitBarComponent {
175184
* @hidden @internal
176185
*/
177186
public get nextButtonHidden() {
178-
return this.siblings[1].hidden && !this.siblings[0].hidden;
187+
return this.siblings[1].collapsed && !this.siblings[0].collapsed;
179188
}
180189

190+
/**
191+
* @hidden @internal
192+
*/
181193
public onDragStart(event: IDragStartEventArgs) {
182194
if (this.resizeDisallowed) {
183195
event.cancel = true;
@@ -187,6 +199,9 @@ export class IgxSplitBarComponent {
187199
this.moveStart.emit(this.pane);
188200
}
189201

202+
/**
203+
* @hidden @internal
204+
*/
190205
public onDragMove(event: IDragMoveEventArgs) {
191206
const isHorizontal = this.type === SplitterType.Horizontal;
192207
const curr = isHorizontal ? event.pageX : event.pageY;
@@ -200,20 +215,23 @@ export class IgxSplitBarComponent {
200215

201216
protected get resizeDisallowed() {
202217
const relatedTabs = this.siblings;
203-
return !!relatedTabs.find(x => x.resizable === false);
218+
return !!relatedTabs.find(x => x.resizable === false || x.collapsed === true);
204219
}
205220

221+
/**
222+
* @hidden @internal
223+
*/
206224
public onCollapsing(next: boolean) {
207225
const prevSibling = this.siblings[0];
208226
const nextSibling = this.siblings[1];
209227
let target;
210228
if (next) {
211229
// if next is clicked when prev pane is hidden, show prev pane, else hide next pane.
212-
target = prevSibling.hidden ? prevSibling : nextSibling;
230+
target = prevSibling.collapsed ? prevSibling : nextSibling;
213231
} else {
214232
// if prev is clicked when next pane is hidden, show next pane, else hide prev pane.
215-
target = nextSibling.hidden ? nextSibling : prevSibling;
233+
target = nextSibling.collapsed ? nextSibling : prevSibling;
216234
}
217-
this.togglePane.emit(target);
235+
target.toggle();
218236
}
219237
}

0 commit comments

Comments
 (0)