Skip to content

Commit 18aa02e

Browse files
committed
refactor(material/sort): explicit sort direction
1 parent dd59b4a commit 18aa02e

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')
@@ -203,7 +203,7 @@ export class MatSort
203203
}
204204

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

tools/public_api_guard/material/sort.md

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

8888
// @public
@@ -139,7 +139,7 @@ export class MatSortHeader extends _MatSortHeaderBase implements CanDisable, Mat
139139
_sort: MatSort;
140140
get sortActionDescription(): string;
141141
set sortActionDescription(value: string);
142-
start: 'asc' | 'desc';
142+
start: SortDirection;
143143
_toggleOnInteraction(): void;
144144
_updateArrowDirection(): void;
145145
_viewState: ArrowViewStateTransition;

0 commit comments

Comments
 (0)