-
Notifications
You must be signed in to change notification settings - Fork 6.7k
/
sort-header-intl.ts
34 lines (30 loc) · 1.05 KB
/
sort-header-intl.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Injectable} from '@angular/core';
import {Subject} from 'rxjs/Subject';
import {SortDirection} from './sort-direction';
/**
* To modify the labels and text displayed, create a new instance of MdSortHeaderIntl and
* include it in a custom provider.
*/
@Injectable()
export class MdSortHeaderIntl {
/**
* Stream that emits whenever the labels here are changed. Use this to notify
* components if the labels have changed after initialization.
*/
changes: Subject<void> = new Subject<void>();
/** ARIA label for the sorting button. */
sortButtonLabel = (id: string) => {
return `Change sorting for ${id}`;
}
/** A label to describe the current sort (visible only to screenreaders). */
sortDescriptionLabel = (id: string, direction: SortDirection) => {
return `Sorted by ${id} ${direction == 'asc' ? 'ascending' : 'descending'}`;
}
}