UNPKG

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