nav.d.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import { AfterContentChecked, AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, OnInit, QueryList, TemplateRef } from '@angular/core';
  2. import { NgbNavConfig } from './nav-config';
  3. /**
  4. * Context passed to the nav content template.
  5. *
  6. * See [this demo](#/components/nav/examples#keep-content) as the example.
  7. *
  8. * @since 5.2.0
  9. */
  10. export interface NgbNavContentContext {
  11. /**
  12. * If `true`, current nav content is visible and active
  13. */
  14. $implicit: boolean;
  15. }
  16. /**
  17. * This directive must be used to wrap content to be displayed in the nav.
  18. *
  19. * @since 5.2.0
  20. */
  21. export declare class NgbNavContent {
  22. templateRef: TemplateRef<any>;
  23. constructor(templateRef: TemplateRef<any>);
  24. }
  25. /**
  26. * The directive used to group nav link and related nav content. As well as set nav identifier and some options.
  27. *
  28. * @since 5.2.0
  29. */
  30. export declare class NgbNavItem implements AfterContentChecked, OnInit {
  31. elementRef: ElementRef<any>;
  32. private _nav;
  33. /**
  34. * If `true`, non-active current nav item content will be removed from DOM
  35. * Otherwise it will just be hidden
  36. */
  37. destroyOnHide: any;
  38. /**
  39. * If `true`, the current nav item is disabled and can't be toggled by user.
  40. *
  41. * Nevertheless disabled nav can be selected programmatically via the `.select()` method and the `[activeId]` binding.
  42. */
  43. disabled: boolean;
  44. /**
  45. * The id used for the DOM elements.
  46. * Must be unique inside the document in case you have multiple `ngbNav`s on the page.
  47. *
  48. * Autogenerated as `ngb-nav-XXX` if not provided.
  49. */
  50. domId: string;
  51. /**
  52. * The id used as a model for active nav.
  53. * It can be anything, but must be unique inside one `ngbNav`.
  54. *
  55. * The only limitation is that it is not possible to have the `''` (empty string) as id,
  56. * because ` ngbNavItem `, `ngbNavItem=''` and `[ngbNavItem]="''"` are indistinguishable
  57. */
  58. _id: any;
  59. contentTpl: NgbNavContent | null;
  60. contentTpls: QueryList<NgbNavContent>;
  61. constructor(nav: any, elementRef: ElementRef<any>);
  62. ngAfterContentChecked(): void;
  63. ngOnInit(): void;
  64. readonly active: boolean;
  65. readonly id: any;
  66. readonly panelDomId: string;
  67. isPanelInDom(): boolean;
  68. }
  69. /**
  70. * A nav directive that helps with implementing tabbed navigation components.
  71. *
  72. * @since 5.2.0
  73. */
  74. export declare class NgbNav implements AfterContentInit {
  75. role: string;
  76. private _cd;
  77. /**
  78. * The id of the nav that should be active
  79. *
  80. * You could also use the `.select()` method and the `(navChange)` event
  81. */
  82. activeId: any;
  83. /**
  84. * The event emitted after the active nav changes
  85. * The payload of the event is the newly active nav id
  86. *
  87. * If you want to prevent nav change, you should use `(navChange)` event
  88. */
  89. activeIdChange: EventEmitter<any>;
  90. /**
  91. * If `true`, non-active nav content will be removed from DOM
  92. * Otherwise it will just be hidden
  93. */
  94. destroyOnHide: any;
  95. /**
  96. * The orientation of navs.
  97. *
  98. * Using `vertical` will also add the `aria-orientation` attribute
  99. */
  100. orientation: 'horizontal' | 'vertical';
  101. /**
  102. * Role attribute generating strategy:
  103. * - `false` - no role attributes will be generated
  104. * - `'tablist'` - 'tablist', 'tab' and 'tabpanel' will be generated (default)
  105. */
  106. roles: 'tablist' | false;
  107. items: QueryList<NgbNavItem>;
  108. constructor(role: string, config: NgbNavConfig, _cd: ChangeDetectorRef);
  109. /**
  110. * The nav change event emitted right before the nav change happens on user click.
  111. *
  112. * This event won't be emitted if nav is changed programmatically via `[activeId]` or `.select()`.
  113. *
  114. * See [`NgbNavChangeEvent`](#/components/nav/api#NgbNavChangeEvent) for payload details.
  115. */
  116. navChange: EventEmitter<NgbNavChangeEvent>;
  117. click(item: NgbNavItem): void;
  118. /**
  119. * Selects the nav with the given id and shows its associated pane.
  120. * Any other nav that was previously selected becomes unselected and its associated pane is hidden.
  121. */
  122. select(id: any): void;
  123. ngAfterContentInit(): void;
  124. private _updateActiveId;
  125. }
  126. /**
  127. * A directive to put on the nav link.
  128. *
  129. * @since 5.2.0
  130. */
  131. export declare class NgbNavLink {
  132. role: string;
  133. navItem: NgbNavItem;
  134. nav: NgbNav;
  135. constructor(role: string, navItem: NgbNavItem, nav: NgbNav);
  136. hasNavItemClass(): boolean;
  137. }
  138. /**
  139. * The payload of the change event emitted right before the nav change happens on user click.
  140. *
  141. * This event won't be emitted if nav is changed programmatically via `[activeId]` or `.select()`.
  142. *
  143. * @since 5.2.0
  144. */
  145. export interface NgbNavChangeEvent {
  146. /**
  147. * Id of the currently active nav.
  148. */
  149. activeId: any;
  150. /**
  151. * Id of the newly selected nav.
  152. */
  153. nextId: any;
  154. /**
  155. * Function that will prevent nav change if called.
  156. */
  157. preventDefault: () => void;
  158. }