Skip to content

Commit cb472c8

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

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
@@ -130,7 +130,7 @@ export class MatSortHeader extends _MatSortHeaderBase
130130
@Input() arrowPosition: 'before' | 'after' = 'after';
131131

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

135135
/** Overrides the disable clear value of the containing MatSort for this MatSortable. */
136136
@Input()

src/material/sort/sort.ts

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

4141
/** Starting sort direction. */
42-
start: 'asc' | 'desc';
42+
start: SortDirection;
4343

4444
/** Whether to disable clearing the sorting state. */
4545
disableClear: boolean;
@@ -91,7 +91,7 @@ export class MatSort extends _MatSortBase
9191
* The direction to set when an MatSortable is initially sorted.
9292
* May be overriden by the MatSortable's sort start.
9393
*/
94-
@Input('matSortStart') start: 'asc' | 'desc' = 'asc';
94+
@Input('matSortStart') start: SortDirection = 'asc';
9595

9696
/** The sort direction of the currently active MatSortable. */
9797
@Input('matSortDirection')
@@ -192,7 +192,7 @@ export class MatSort extends _MatSortBase
192192
}
193193

194194
/** Returns the sort direction cycle to use given the provided parameters of order and clear. */
195-
function getSortDirectionCycle(start: 'asc' | 'desc',
195+
function getSortDirectionCycle(start: SortDirection,
196196
disableClear: boolean): SortDirection[] {
197197
let sortOrder: SortDirection[] = ['asc', 'desc'];
198198
if (start == 'desc') { sortOrder.reverse(); }

tools/public_api_guard/material/sort.md

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

9191
// @public
@@ -143,7 +143,7 @@ export class MatSortHeader extends _MatSortHeaderBase implements CanDisable, Mat
143143
_showIndicatorHint: boolean;
144144
// (undocumented)
145145
_sort: MatSort;
146-
start: 'asc' | 'desc';
146+
start: SortDirection;
147147
_toggleOnInteraction(): void;
148148
_updateArrowDirection(): void;
149149
_viewState: ArrowViewStateTransition;

0 commit comments

Comments
 (0)