Skip to content

Commit

Permalink
refactor(material/sort): explicit sort direction (#23632)
Browse files Browse the repository at this point in the history
  • Loading branch information
lekhmanrus authored Apr 22, 2022
1 parent 4e5e286 commit 37db2d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/material/sort/sort-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class MatSortHeader
@Input() arrowPosition: SortHeaderArrowPosition = 'after';

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

/**
* Description applied to MatSortHeader's button element with aria-describedby. This text should
Expand Down
6 changes: 3 additions & 3 deletions src/material/sort/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface MatSortable {
id: string;

/** Starting sort direction. */
start: 'asc' | 'desc';
start: SortDirection;

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

/** The sort direction of the currently active MatSortable. */
@Input('matSortDirection')
Expand Down Expand Up @@ -208,7 +208,7 @@ export class MatSort
}

/** Returns the sort direction cycle to use given the provided parameters of order and clear. */
function getSortDirectionCycle(start: 'asc' | 'desc', disableClear: boolean): SortDirection[] {
function getSortDirectionCycle(start: SortDirection, disableClear: boolean): SortDirection[] {
let sortOrder: SortDirection[] = ['asc', 'desc'];
if (start == 'desc') {
sortOrder.reverse();
Expand Down
6 changes: 3 additions & 3 deletions tools/public_api_guard/material/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class MatSort extends _MatSortBase implements CanDisable, HasInitialized,
sort(sortable: MatSortable): void;
sortables: Map<string, MatSortable>;
readonly sortChange: EventEmitter<Sort>;
start: 'asc' | 'desc';
start: SortDirection;
readonly _stateChanges: Subject<void>;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<MatSort, "[matSort]", ["matSort"], { "disabled": "matSortDisabled"; "active": "matSortActive"; "start": "matSortStart"; "direction": "matSortDirection"; "disableClear": "matSortDisableClear"; }, { "sortChange": "matSortChange"; }, never, never, false>;
Expand All @@ -82,7 +82,7 @@ export class MatSort extends _MatSortBase implements CanDisable, HasInitialized,
export interface MatSortable {
disableClear: boolean;
id: string;
start: 'asc' | 'desc';
start: SortDirection;
}

// @public
Expand Down Expand Up @@ -140,7 +140,7 @@ export class MatSortHeader extends _MatSortHeaderBase implements CanDisable, Mat
_sort: MatSort;
get sortActionDescription(): string;
set sortActionDescription(value: string);
start: 'asc' | 'desc';
start: SortDirection;
_toggleOnInteraction(): void;
_updateArrowDirection(): void;
_viewState: ArrowViewStateTransition;
Expand Down

0 comments on commit 37db2d5

Please sign in to comment.