UNPKG

2.5 kBTypeScriptView Raw
1import { EventEmitter, TemplateRef } from '@angular/core';
2import { NbBooleanInput, NbNullableInput } from '../helpers';
3/** Column definition associated with a `NbSortHeaderDirective`. */
4interface NbSortHeaderColumnDef {
5 name: string;
6}
7export interface NbSortRequest {
8 column: string;
9 direction: NbSortDirection;
10}
11export interface NbSortable {
12 sort(sortRequest: NbSortRequest): any;
13}
14export declare type NbSortDirectionValues = 'asc' | 'desc' | '';
15export declare enum NbSortDirection {
16 ASCENDING = "asc",
17 DESCENDING = "desc",
18 NONE = ""
19}
20/**
21 * Directive triggers sort method of passed object when sort header changes direction
22 */
23export declare class NbSortDirective {
24 sortable: NbSortable;
25 static ngAcceptInputType_sortable: NbSortable | NbNullableInput;
26 sort: EventEmitter<NbSortRequest>;
27 emitSort(sortRequest: NbSortRequest): void;
28}
29export interface NbSortHeaderIconDirectiveContext {
30 $implicit: NbSortDirection;
31 isAscending: boolean;
32 isDescending: boolean;
33 isNone: boolean;
34}
35/**
36 * Directive for headers sort icons. Mark you icon implementation with this structural directive and
37 * it'll set template's implicit context with current direction. Context also has `isAscending`,
38 * `isDescending` and `isNone` properties.
39 */
40export declare class NbSortHeaderIconDirective {
41}
42export declare class NbSortIconComponent {
43 direction: NbSortDirection;
44 isAscending(): boolean;
45 isDescending(): boolean;
46 isDirectionSet(): boolean;
47}
48/**
49 * Marks header as sort header so it emitting sort event when clicked.
50 */
51export declare class NbSortHeaderComponent {
52 private sort;
53 private columnDef;
54 sortIcon: TemplateRef<NbSortHeaderIconDirectiveContext>;
55 /**
56 * Current sort direction. Possible values: `asc`, `desc`, ``(none)
57 * @type {NbSortDirection}
58 */
59 direction: NbSortDirection;
60 static ngAcceptInputType_direction: NbSortDirectionValues;
61 private disabledValue;
62 /**
63 * Disable sort header
64 */
65 set disabled(value: boolean);
66 get disabled(): boolean;
67 static ngAcceptInputType_disabled: NbBooleanInput;
68 sortIfEnabled(): void;
69 constructor(sort: NbSortDirective, columnDef: NbSortHeaderColumnDef);
70 isAscending(): boolean;
71 isDescending(): boolean;
72 sortData(): void;
73 getIconContext(): NbSortHeaderIconDirectiveContext;
74 getDisabledAttributeValue(): '' | null;
75 private createSortRequest;
76 private getNextDirection;
77}
78export {};