Skip to content

Commit e54f1fc

Browse files
committed
refactor(material/sort): explicit sort direction
1 parent 7bbe68d commit e54f1fc

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/material/sort/sort-header.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class MatSortHeader
137137
@Input() arrowPosition: 'before' | 'after' = 'after';
138138

139139
/** Overrides the sort start value of the containing MatSort for this MatSortable. */
140-
@Input() start: 'asc' | 'desc';
140+
@Input() start: SortDirection;
141141

142142
/**
143143
* Description applied to MatSortHeader's button element with aria-describedby. This text should

src/material/sort/sort.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface MatSortable {
3434
id: string;
3535

3636
/** Starting sort direction. */
37-
start: 'asc' | 'desc';
37+
start: SortDirection;
3838

3939
/** Whether to disable clearing the sorting state. */
4040
disableClear: boolean;
@@ -88,7 +88,7 @@ export class MatSort
8888
* The direction to set when an MatSortable is initially sorted.
8989
* May be overriden by the MatSortable's sort start.
9090
*/
91-
@Input('matSortStart') start: 'asc' | 'desc' = 'asc';
91+
@Input('matSortStart') start: SortDirection = 'asc';
9292

9393
/** The sort direction of the currently active MatSortable. */
9494
@Input('matSortDirection')
@@ -206,7 +206,7 @@ export class MatSort
206206
}
207207

208208
/** Returns the sort direction cycle to use given the provided parameters of order and clear. */
209-
function getSortDirectionCycle(start: 'asc' | 'desc', disableClear: boolean): SortDirection[] {
209+
function getSortDirectionCycle(start: SortDirection, disableClear: boolean): SortDirection[] {
210210
let sortOrder: SortDirection[] = ['asc', 'desc'];
211211
if (start == 'desc') {
212212
sortOrder.reverse();

tools/public_api_guard/material/sort.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class MatSort extends _MatSortBase implements CanDisable, HasInitialized,
7474
sort(sortable: MatSortable): void;
7575
sortables: Map<string, MatSortable>;
7676
readonly sortChange: EventEmitter<Sort>;
77-
start: 'asc' | 'desc';
77+
start: SortDirection;
7878
readonly _stateChanges: Subject<void>;
7979
// (undocumented)
8080
static ɵdir: i0.ɵɵDirectiveDeclaration<MatSort, "[matSort]", ["matSort"], { "disabled": "matSortDisabled"; "active": "matSortActive"; "start": "matSortStart"; "direction": "matSortDirection"; "disableClear": "matSortDisableClear"; }, { "sortChange": "matSortChange"; }, never>;
@@ -86,7 +86,7 @@ export class MatSort extends _MatSortBase implements CanDisable, HasInitialized,
8686
export interface MatSortable {
8787
disableClear: boolean;
8888
id: string;
89-
start: 'asc' | 'desc';
89+
start: SortDirection;
9090
}
9191

9292
// @public
@@ -147,7 +147,7 @@ export class MatSortHeader extends _MatSortHeaderBase implements CanDisable, Mat
147147
_sort: MatSort;
148148
get sortActionDescription(): string;
149149
set sortActionDescription(value: string);
150-
start: 'asc' | 'desc';
150+
start: SortDirection;
151151
_toggleOnInteraction(): void;
152152
_updateArrowDirection(): void;
153153
_viewState: ArrowViewStateTransition;

0 commit comments

Comments
 (0)