Skip to content

Commit cf8046e

Browse files
committed
chore(*): using an already existing enum
1 parent f7f26e4 commit cf8046e

File tree

5 files changed

+24
-25
lines changed

5 files changed

+24
-25
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ All notable changes for each version of this project will be documented in this
77
### New Features
88
- `IgxCsvExporterService`, `IgxExcelExporterService`
99
- Exporter services are no longer required to be provided in the application since they are now injected on a root level.
10+
- `IgxGridToolbarPinningComponent`, `IgxGridToolbarHidingComponent`
11+
- Exposed new input `buttonText` which sets the text that is displayed inside the dropdown button in the toolbar.
1012
- `IgxCombo`
11-
- Added `groupsSortingDirection` input, which allows you to set groups sorting order.
13+
- Added `groupSortingDirection` input, which allows you to set groups sorting order.
1214

1315
### General
1416

@@ -3650,3 +3652,4 @@ export class IgxCustomFilteringOperand extends IgxFilteringOperand {
36503652
- `IgxDraggableDirective` moved inside `../directives/dragdrop/` folder
36513653
- `IgxRippleDirective` moved inside `../directives/ripple/` folder
36523654
- Folder `"./navigation/nav-service"` renamed to `"./navigation/nav.service"`
3655+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
[tabindex]="dropdown.collapsed ? -1 : 0" role="listbox" [attr.id]="dropdown.id">
5353
<igx-combo-item role="option" [itemHeight]='itemHeight' *igxFor="let item of data
5454
| comboFiltering:filterValue:displayKey:filterable:filteringOptions
55-
| comboGrouping:groupKey:valueKey:groupsSortingDirection;
55+
| comboGrouping:groupKey:valueKey:groupSortingDirection;
5656
index as rowIndex; containerSize: itemsMaxHeight; scrollOrientation: 'vertical'; itemSize: itemHeight"
5757
[value]="item" [isHeader]="item.isHeader" [index]="rowIndex">
5858
<ng-container *ngIf="item.isHeader">

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { AbsoluteScrollStrategy, ConnectedPositioningStrategy } from '../service
2828
import { IgxSelectionAPIService } from '../core/selection';
2929
import { IgxIconService } from '../icon/public_api';
3030
import { IBaseCancelableBrowserEventArgs } from '../core/utils';
31+
import { SortingDirection } from '../data-operations/sorting-expression.interface';
3132

3233
const CSS_CLASS_COMBO = 'igx-combo';
3334
const CSS_CLASS_COMBO_DROPDOWN = 'igx-combo__drop-down';
@@ -2173,12 +2174,12 @@ describe('igxCombo', () => {
21732174
expect(combo.dropdown.headers[0].element.nativeElement.innerText).toEqual(fallBackGroup);
21742175
});
21752176
it('should sort groups correctly', () => {
2176-
combo.groupsSortingDirection = 'ascending';
2177+
combo.groupSortingDirection = SortingDirection.Asc;
21772178
combo.toggle();
21782179
fixture.detectChanges();
21792180
expect(combo.dropdown.headers[0].element.nativeElement.innerText).toEqual('East North Central');
21802181

2181-
combo.groupsSortingDirection = 'descending';
2182+
combo.groupSortingDirection = SortingDirection.Desc;
21822183
combo.toggle();
21832184
fixture.detectChanges();
21842185
expect(combo.dropdown.headers[0].element.nativeElement.innerText).toEqual('West South Cent');

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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { EditorProvider } from '../core/edit-provider';
4242
import { IgxInputState, IgxInputDirective } from '../directives/input/input.directive';
4343
import { IgxInputGroupType, IGX_INPUT_GROUP_TYPE } from '../input-group/public_api';
4444
import { caseSensitive } from '@igniteui/material-icons-extended';
45+
import { SortingDirection } from '../data-operations/sorting-expression.interface';
4546

4647
/**
4748
* @hidden
@@ -69,16 +70,6 @@ const ItemHeights = {
6970
*/
7071
const itemsInContainer = 10;
7172

72-
/**
73-
* @hidden
74-
*/
75-
export const GroupsSortingDirection = mkenum({
76-
ascending: 'ascending',
77-
descending: 'descending'
78-
});
79-
80-
export type GroupsSortingDirection = (typeof GroupsSortingDirection)[keyof typeof GroupsSortingDirection];
81-
8273
export enum IgxComboState {
8374
/**
8475
* Combo with initial state.
@@ -787,17 +778,22 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
787778
public filterable = true;
788779

789780
/**
790-
* An @Input property that sets groups sorting order. The default is `ascending`.
781+
* An @Input property that sets groups sorting order.
782+
*
783+
* @example
791784
* ```html
792-
* <igx-combo [groupsSortingDirection]="'ascending'">
785+
* <igx-combo [groupSortingDirection]="groupSortingDirection"></igx-combo>
786+
* ```
787+
* ```typescript
788+
* public groupSortingDirection = SortingDirection.Asc;
793789
* ```
794790
*/
795791
@Input()
796-
public get groupsSortingDirection() {
797-
return this._groupsSortingDirection;
792+
public get groupSortingDirection(): SortingDirection {
793+
return this._groupSortingDirection;
798794
}
799-
public set groupsSortingDirection(val: GroupsSortingDirection) {
800-
this._groupsSortingDirection = val;
795+
public set groupSortingDirection(val: SortingDirection) {
796+
this._groupSortingDirection = val;
801797
}
802798

803799
/**
@@ -932,7 +928,7 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
932928
private _overlaySettings: OverlaySettings;
933929
private _value = '';
934930
private _valid = IgxComboState.INITIAL;
935-
private _groupsSortingDirection: GroupsSortingDirection = GroupsSortingDirection.ascending;
931+
private _groupSortingDirection: SortingDirection = SortingDirection.Asc;
936932

937933
constructor(
938934
protected elementRef: ElementRef,

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { DataUtil } from '../data-operations/data-util';
44
import { SortingDirection } from '../data-operations/sorting-expression.interface';
55
import { IGX_COMBO_COMPONENT, IgxComboBase } from './combo.common';
66
import { DefaultSortingStrategy } from '../data-operations/sorting-strategy';
7-
import { IComboFilteringOptions, GroupsSortingDirection } from './combo.component';
7+
import { IComboFilteringOptions } from './combo.component';
88

99

1010
/**
@@ -44,15 +44,14 @@ export class IgxComboGroupingPipe implements PipeTransform {
4444

4545
constructor(@Inject(IGX_COMBO_COMPONENT) public combo: IgxComboBase) { }
4646

47-
public transform(collection: any[], groupKey: any, valueKey: any, sortingDirection: GroupsSortingDirection) {
47+
public transform(collection: any[], groupKey: any, valueKey: any, sortingDirection: SortingDirection) {
4848
this.combo.filteredData = collection;
4949
if ((!groupKey && groupKey !== 0) || !collection.length) {
5050
return collection;
5151
}
52-
const dir: SortingDirection = sortingDirection === 'ascending' ? SortingDirection.Asc : SortingDirection.Desc;
5352
const sorted = DataUtil.sort(cloneArray(collection), [{
5453
fieldName: groupKey,
55-
dir,
54+
dir: sortingDirection,
5655
ignoreCase: true,
5756
strategy: DefaultSortingStrategy.instance()
5857
}]);

0 commit comments

Comments
 (0)