Skip to content

Commit 70122d3

Browse files
authored
Merge branch 'master' into izhostov/issue-10233
2 parents 240e8e6 + ea07dd4 commit 70122d3

17 files changed

+334
-110
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ All notable changes for each version of this project will be documented in this
4848
- Exposed new input `buttonText` which sets the text that is displayed inside the dropdown button in the toolbar.
4949
- `IgxCombo`
5050
- Added `groupSortingDirection` input, which allows you to set groups sorting order.
51+
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
52+
- Added new directives for re-templating header sorting indicators - `IgxSortHeaderIconDirective`, `IgxSortAscendingHeaderIconDirective` and `IgxSortDescendingHeaderIconDirective`.
5153
- `IgxDialog`
5254
- Added `focusTrap` input to set whether the Tab key focus is trapped within the dialog when opened. Defaults to `true`.
5355

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { IgxSelectionAPIService } from '../core/selection';
1111
import { CancelableBrowserEventArgs, cloneArray, IBaseCancelableBrowserEventArgs, IBaseEventArgs } from '../core/utils';
1212
import { SortingDirection } from '../data-operations/sorting-expression.interface';
1313
import { IForOfState, IgxForOfDirective } from '../directives/for-of/for_of.directive';
14-
import { ISelectionEventArgs } from '../drop-down/public_api';
1514
import { IgxIconService } from '../icon/public_api';
1615
import { IgxInputGroupType, IGX_INPUT_GROUP_TYPE } from '../input-group/inputGroupType';
1716
import { IgxInputDirective, IgxInputGroupComponent, IgxInputState } from '../input-group/public_api';
@@ -23,8 +22,7 @@ import {
2322
IgxComboFooterDirective, IgxComboHeaderDirective, IgxComboHeaderItemDirective, IgxComboItemDirective, IgxComboToggleIconDirective
2423
} from './combo.directives';
2524
import {
26-
IComboFilteringOptions, IComboItemAdditionEvent, IComboSearchInputEventArgs,
27-
IComboSelectionChangingEventArgs
25+
IComboFilteringOptions, IComboItemAdditionEvent, IComboSearchInputEventArgs
2826
} from './public_api';
2927

3028
export const IGX_COMBO_COMPONENT = new InjectionToken<IgxComboBase>('IgxComboComponentToken');
@@ -100,6 +98,22 @@ export enum IgxComboState {
10098
@Directive()
10199
export abstract class IgxComboBaseDirective extends DisplayDensityBase implements IgxComboBase, OnInit, DoCheck,
102100
AfterViewInit, OnDestroy, ControlValueAccessor {
101+
/**
102+
* Defines whether the caseSensitive icon should be shown in the search input
103+
*
104+
* ```typescript
105+
* // get
106+
* let myComboShowSearchCaseIcon = this.combo.showSearchCaseIcon;
107+
* ```
108+
*
109+
* ```html
110+
* <!--set-->
111+
* <igx-combo [showSearchCaseIcon]='true'></igx-combo>
112+
* ```
113+
*/
114+
@Input()
115+
public showSearchCaseIcon = false;
116+
103117
/**
104118
* Set custom overlay settings that control how the combo's list of items is displayed.
105119
* Set:
@@ -414,17 +428,6 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement
414428
this._type = val;
415429
}
416430

417-
/**
418-
* Emitted when item selection is changing, before the selection completes
419-
*
420-
* ```html
421-
* <igx-combo (selectionChanging)='handleSelection()'></igx-combo>
422-
* ```
423-
*/
424-
// TODO: any for old/new selection?
425-
@Output()
426-
public selectionChanging = new EventEmitter<IComboSelectionChangingEventArgs | ISelectionEventArgs>();
427-
428431
/**
429432
* Emitted before the dropdown is opened
430433
*
@@ -865,6 +868,8 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement
865868

866869
public abstract dropdown: IgxComboDropDownComponent;
867870

871+
public abstract selectionChanging: EventEmitter<any>;
872+
868873
constructor(
869874
protected elementRef: ElementRef,
870875
protected cdr: ChangeDetectorRef,
@@ -1125,6 +1130,11 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement
11251130
}
11261131
}
11271132

1133+
/** @hidden @internal */
1134+
public toggleCaseSensitive() {
1135+
this.filteringOptions = { caseSensitive: !this.filteringOptions.caseSensitive };
1136+
}
1137+
11281138
protected onStatusChanged = () => {
11291139
if ((this.ngControl.control.touched || this.ngControl.control.dirty) &&
11301140
(this.ngControl.control.validator || this.ngControl.control.asyncValidator)) {

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

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CommonModule } from '@angular/common';
22
import {
3-
AfterViewInit, ChangeDetectorRef, Component, ElementRef, NgModule, OnInit, OnDestroy, Optional, Inject, Injector, ViewChild, Input
3+
AfterViewInit, ChangeDetectorRef, Component, ElementRef, NgModule, OnInit, OnDestroy,
4+
Optional, Inject, Injector, ViewChild, Input, Output, EventEmitter
45
} from '@angular/core';
56
import {
67
IgxComboItemDirective,
@@ -18,7 +19,7 @@ import { IgxSelectionAPIService } from '../core/selection';
1819
import { IBaseEventArgs, IBaseCancelableEventArgs, CancelableEventArgs } from '../core/utils';
1920
import { IgxStringFilteringOperand, IgxBooleanFilteringOperand } from '../data-operations/filtering-condition';
2021
import { FilteringLogic } from '../data-operations/filtering-expression.interface';
21-
import { IgxForOfModule, IForOfState } from '../directives/for-of/for_of.directive';
22+
import { IgxForOfModule } from '../directives/for-of/for_of.directive';
2223
import { IgxIconModule, IgxIconService } from '../icon/public_api';
2324
import { IgxRippleModule } from '../directives/ripple/ripple.directive';
2425
import { IgxToggleModule } from '../directives/toggle/toggle.directive';
@@ -114,22 +115,6 @@ const diffInSets = (set1: Set<any>, set2: Set<any>): any[] => {
114115
})
115116
export class IgxComboComponent extends IgxComboBaseDirective implements AfterViewInit, ControlValueAccessor, OnInit,
116117
OnDestroy, EditorProvider {
117-
/**
118-
* Defines whether the caseSensitive icon should be shown in the search input
119-
*
120-
* ```typescript
121-
* // get
122-
* let myComboShowSearchCaseIcon = this.combo.showSearchCaseIcon;
123-
* ```
124-
*
125-
* ```html
126-
* <!--set-->
127-
* <igx-combo [showSearchCaseIcon]='true'></igx-combo>
128-
* ```
129-
*/
130-
@Input()
131-
public showSearchCaseIcon = false;
132-
133118
/**
134119
* An @Input property that controls whether the combo's search box
135120
* should be focused after the `opened` event is called
@@ -163,6 +148,16 @@ export class IgxComboComponent extends IgxComboBaseDirective implements AfterVie
163148
@Input()
164149
public searchPlaceholder = 'Enter a Search Term';
165150

151+
/**
152+
* Emitted when item selection is changing, before the selection completes
153+
*
154+
* ```html
155+
* <igx-combo (selectionChanging)='handleSelection()'></igx-combo>
156+
* ```
157+
*/
158+
@Output()
159+
public selectionChanging = new EventEmitter<IComboSelectionChangingEventArgs>();
160+
166161
/** @hidden @internal */
167162
@ViewChild(IgxComboDropDownComponent, { static: true })
168163
public dropdown: IgxComboDropDownComponent;
@@ -369,13 +364,6 @@ export class IgxComboComponent extends IgxComboBaseDirective implements AfterVie
369364
}
370365
}
371366

372-
/**
373-
* @hidden @internal
374-
*/
375-
public toggleCaseSensitive() {
376-
this.filteringOptions = { caseSensitive: !this.filteringOptions.caseSensitive };
377-
}
378-
379367
/** @hidden @internal */
380368
public handleOpened() {
381369
this.triggerCheck();

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,11 +1603,14 @@
16031603
}
16041604

16051605
.sort-icon {
1606-
width: rem(15px);
1607-
height: rem(15px);
1608-
min-width: rem(15px); /* yeah IE, it really needs to be 15px wide... */
1609-
font-size: rem(15px);
16101606
position: relative;
1607+
display: flex;
1608+
1609+
igx-icon {
1610+
width: rem(15px);
1611+
height: rem(15px);
1612+
font-size: rem(15px);
1613+
}
16111614

16121615
&::after {
16131616
content: attr(data-sortIndex);

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

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ import { CharSeparatedValueData } from '../services/csv/char-separated-value-dat
9393
import { IgxColumnResizingService } from './resizing/resizing.service';
9494
import { IFilteringStrategy } from '../data-operations/filtering-strategy';
9595
import {
96-
IgxRowExpandedIndicatorDirective, IgxRowCollapsedIndicatorDirective,
97-
IgxHeaderExpandIndicatorDirective, IgxHeaderCollapseIndicatorDirective, IgxExcelStyleHeaderIconDirective
96+
IgxRowExpandedIndicatorDirective, IgxRowCollapsedIndicatorDirective, IgxHeaderExpandIndicatorDirective,
97+
IgxHeaderCollapseIndicatorDirective, IgxExcelStyleHeaderIconDirective, IgxSortAscendingHeaderIconDirective,
98+
IgxSortDescendingHeaderIconDirective, IgxSortHeaderIconDirective
9899
} from './grid/grid.directives';
99100
import {
100101
GridKeydownTargetType,
@@ -765,8 +766,8 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
765766
* <igx-grid #grid [data]="localData" (rowAdd)="rowAdd($event)" [height]="'305px'" [autoGenerate]="true"></igx-grid>
766767
* ```
767768
*/
768-
@Output()
769-
public rowAdd = new EventEmitter<IGridEditEventArgs>();
769+
@Output()
770+
public rowAdd = new EventEmitter<IGridEditEventArgs>();
770771

771772
/**
772773
* Emitted after column is resized.
@@ -1252,6 +1253,24 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
12521253
@ContentChild(IgxExcelStyleHeaderIconDirective, { read: TemplateRef })
12531254
public excelStyleHeaderIconTemplate: TemplateRef<any> = null;
12541255

1256+
/**
1257+
* The custom template, if any, that should be used when rendering a header sorting indicator when columns are sorted in asc order.
1258+
*/
1259+
@ContentChild(IgxSortAscendingHeaderIconDirective, { read: TemplateRef })
1260+
public sortAscendingHeaderIconTemplate: TemplateRef<any> = null;
1261+
1262+
/**
1263+
* The custom template, if any, that should be used when rendering a header sorting indicator when columns are sorted in desc order.
1264+
*/
1265+
@ContentChild(IgxSortDescendingHeaderIconDirective, { read: TemplateRef })
1266+
public sortDescendingHeaderIconTemplate: TemplateRef<any> = null;
1267+
1268+
/**
1269+
* The custom template, if any, that should be used when rendering a header sorting indicator when columns are not sorted.
1270+
*/
1271+
@ContentChild(IgxSortHeaderIconDirective, { read: TemplateRef })
1272+
public sortHeaderIconTemplate: TemplateRef<any> = null;
1273+
12551274
/**
12561275
* @hidden
12571276
* @internal
@@ -3437,26 +3456,26 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
34373456
public setUpPaginator() {
34383457
if (this.paginator) {
34393458
this.paginator.pageChange.pipe(takeWhile(() => !!this.paginator), filter(() => !this._init))
3440-
.subscribe((page: number) => {
3441-
this.pageChange.emit(page);
3442-
});
3459+
.subscribe((page: number) => {
3460+
this.pageChange.emit(page);
3461+
});
34433462
this.paginator.pagingDone.pipe(takeWhile(() => !!this.paginator), filter(() => !this._init))
3444-
.subscribe((args: IPageEventArgs) => {
3445-
this.selectionService.clear(true);
3446-
this.pagingDone.emit({ previous: args.previous, current: args.current });
3447-
this.crudService.endEdit(false);
3448-
this.pipeTrigger++;
3449-
this.navigateTo(0);
3450-
this.notifyChanges();
3451-
});
3463+
.subscribe((args: IPageEventArgs) => {
3464+
this.selectionService.clear(true);
3465+
this.pagingDone.emit({ previous: args.previous, current: args.current });
3466+
this.crudService.endEdit(false);
3467+
this.pipeTrigger++;
3468+
this.navigateTo(0);
3469+
this.notifyChanges();
3470+
});
34523471
this.paginator.perPageChange.pipe(takeWhile(() => !!this.paginator), filter(() => !this._init))
3453-
.subscribe((perPage: number) => {
3454-
this.selectionService.clear(true);
3455-
this.perPageChange.emit(perPage);
3456-
this.paginator.page = 0;
3457-
this.crudService.endEdit(false);
3458-
this.notifyChanges();
3459-
});
3472+
.subscribe((perPage: number) => {
3473+
this.selectionService.clear(true);
3474+
this.perPageChange.emit(perPage);
3475+
this.paginator.page = 0;
3476+
this.crudService.endEdit(false);
3477+
this.notifyChanges();
3478+
});
34603479
} else {
34613480
this.markForCheck();
34623481
}
@@ -3927,7 +3946,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
39273946
* ```
39283947
*/
39293948
public get columnsCollection(): IgxColumnComponent[] {
3930-
return this._rendered ? this._columns : [];
3949+
return this._rendered ? this._columns : [];
39313950
}
39323951

39333952
/**
@@ -5479,7 +5498,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
54795498
const selectedColumns = this.gridAPI.grid.selectedColumns();
54805499
const columnData = this.getSelectedColumnsData(this.clipboardOptions.copyFormatters, this.clipboardOptions.copyHeaders);
54815500
let selectedData;
5482-
if (event.type === 'copy'){
5501+
if (event.type === 'copy') {
54835502
selectedData = this.getSelectedData(this.clipboardOptions.copyFormatters, this.clipboardOptions.copyHeaders);
54845503
};
54855504

@@ -5981,8 +6000,8 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
59816000

59826001
protected subscribeToTransactions(): void {
59836002
this.transactionChange$.next();
5984-
this.transactions.onStateUpdate.pipe(takeUntil(merge(this.destroy$,this.transactionChange$)))
5985-
.subscribe(this.transactionStatusUpdate.bind(this));
6003+
this.transactions.onStateUpdate.pipe(takeUntil(merge(this.destroy$, this.transactionChange$)))
6004+
.subscribe(this.transactionStatusUpdate.bind(this));
59866005
}
59876006

59886007
protected transactionStatusUpdate(event: StateUpdateEvent) {
@@ -6742,10 +6761,10 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
67426761
let selectionMap;
67436762
if (this.nativeElement.tagName.toLowerCase() === 'igx-hierarchical-grid' && selectionCollection.size > 0) {
67446763
selectionMap = isRemote ? Array.from(selectionCollection) :
6745-
Array.from(selectionCollection).filter((tuple) => tuple[0] < source.length);
6746-
}else {
6764+
Array.from(selectionCollection).filter((tuple) => tuple[0] < source.length);
6765+
} else {
67476766
selectionMap = isRemote ? Array.from(this.selectionService.selection) :
6748-
Array.from(this.selectionService.selection).filter((tuple) => tuple[0] < source.length);
6767+
Array.from(this.selectionService.selection).filter((tuple) => tuple[0] < source.length);
67496768
}
67506769

67516770
if (this.cellSelection === GridSelectionMode.single && activeEl) {

projects/igniteui-angular/src/lib/grids/grid-common.module.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import { IgxGridFilteringModule } from './filtering/base/filtering.module';
2929
import { IgxRowDirective } from './row.directive';
3030
import {
3131
IgxExcelStyleHeaderIconDirective,
32+
IgxSortAscendingHeaderIconDirective,
33+
IgxSortDescendingHeaderIconDirective,
34+
IgxSortHeaderIconDirective,
3235
IgxGroupAreaDropDirective,
3336
IgxHeaderCollapseIndicatorDirective,
3437
IgxHeaderExpandIndicatorDirective,
@@ -58,6 +61,9 @@ import { IgxGroupByMetaPipe } from './grouping/group-by-area.directive';
5861
IgxHeaderExpandIndicatorDirective,
5962
IgxHeaderCollapseIndicatorDirective,
6063
IgxExcelStyleHeaderIconDirective,
64+
IgxSortAscendingHeaderIconDirective,
65+
IgxSortDescendingHeaderIconDirective,
66+
IgxSortHeaderIconDirective,
6167
IgxGroupAreaDropDirective,
6268
IgxGroupByMetaPipe
6369
],
@@ -93,6 +99,9 @@ import { IgxGroupByMetaPipe } from './grouping/group-by-area.directive';
9399
IgxHeaderExpandIndicatorDirective,
94100
IgxHeaderCollapseIndicatorDirective,
95101
IgxExcelStyleHeaderIconDirective,
102+
IgxSortAscendingHeaderIconDirective,
103+
IgxSortDescendingHeaderIconDirective,
104+
IgxSortHeaderIconDirective,
96105
IgxGroupAreaDropDirective,
97106
IgxGroupByMetaPipe
98107
],

projects/igniteui-angular/src/lib/grids/grid/grid.directives.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,33 @@ export class IgxHeaderCollapseIndicatorDirective {
7272
export class IgxExcelStyleHeaderIconDirective {
7373
}
7474

75+
/**
76+
* @hidden
77+
*/
78+
@Directive({
79+
selector: '[igxSortHeaderIcon]'
80+
})
81+
export class IgxSortHeaderIconDirective {
82+
}
83+
84+
/**
85+
* @hidden
86+
*/
87+
@Directive({
88+
selector: '[igxSortAscendingHeaderIcon]'
89+
})
90+
export class IgxSortAscendingHeaderIconDirective {
91+
}
92+
93+
/**
94+
* @hidden
95+
*/
96+
@Directive({
97+
selector: '[igxSortDescendingHeaderIcon]'
98+
})
99+
export class IgxSortDescendingHeaderIconDirective {
100+
}
101+
75102
/**
76103
* @hidden
77104
*/

0 commit comments

Comments
 (0)