UNPKG

5.96 kBTypeScriptView Raw
1import { ChangeDetectorRef, ElementRef, EventEmitter, NgZone, AfterContentInit, OnDestroy, QueryList, Renderer2, SimpleChanges } from '@angular/core';
2import { Placement, PlacementArray } from '../util/positioning';
3import { NgbDropdownConfig } from './dropdown-config';
4export declare class NgbNavbar {
5}
6/**
7 * A directive you should put on a dropdown item to enable keyboard navigation.
8 * Arrow keys will move focus between items marked with this directive.
9 *
10 * @since 4.1.0
11 */
12export declare class NgbDropdownItem {
13 elementRef: ElementRef<HTMLElement>;
14 static ngAcceptInputType_disabled: boolean | '';
15 private _disabled;
16 set disabled(value: boolean);
17 get disabled(): boolean;
18 constructor(elementRef: ElementRef<HTMLElement>);
19}
20/**
21 * A directive that wraps dropdown menu content and dropdown items.
22 */
23export declare class NgbDropdownMenu {
24 dropdown: any;
25 nativeElement: HTMLElement;
26 placement: Placement | null;
27 isOpen: boolean;
28 menuItems: QueryList<NgbDropdownItem>;
29 constructor(dropdown: any, _elementRef: ElementRef<HTMLElement>);
30}
31/**
32 * A directive to mark an element to which dropdown menu will be anchored.
33 *
34 * This is a simple version of the `NgbDropdownToggle` directive.
35 * It plays the same role, but doesn't listen to click events to toggle dropdown menu thus enabling support
36 * for events other than click.
37 *
38 * @since 1.1.0
39 */
40export declare class NgbDropdownAnchor {
41 dropdown: any;
42 nativeElement: HTMLElement;
43 constructor(dropdown: any, _elementRef: ElementRef<HTMLElement>);
44}
45/**
46 * A directive to mark an element that will toggle dropdown via the `click` event.
47 *
48 * You can also use `NgbDropdownAnchor` as an alternative.
49 */
50export declare class NgbDropdownToggle extends NgbDropdownAnchor {
51 constructor(dropdown: any, elementRef: ElementRef<HTMLElement>);
52}
53/**
54 * A directive that provides contextual overlays for displaying lists of links and more.
55 */
56export declare class NgbDropdown implements AfterContentInit, OnDestroy {
57 private _changeDetector;
58 private _document;
59 private _ngZone;
60 private _elementRef;
61 private _renderer;
62 static ngAcceptInputType_autoClose: boolean | string;
63 static ngAcceptInputType_display: string;
64 private _closed$;
65 private _zoneSubscription;
66 private _bodyContainer;
67 private _menu;
68 private _anchor;
69 /**
70 * Indicates whether the dropdown should be closed when clicking one of dropdown items or pressing ESC.
71 *
72 * * `true` - the dropdown will close on both outside and inside (menu) clicks.
73 * * `false` - the dropdown can only be closed manually via `close()` or `toggle()` methods.
74 * * `"inside"` - the dropdown will close on inside menu clicks, but not outside clicks.
75 * * `"outside"` - the dropdown will close only on the outside clicks and not on menu clicks.
76 */
77 autoClose: boolean | 'outside' | 'inside';
78 /**
79 * A custom class that is applied only to the `ngbDropdownMenu` parent element.
80 * * In case of the inline dropdown it will be the `<div ngbDropdown>`
81 * * In case of the dropdown with `container="body"` it will be the `<div class="dropdown">` attached to the `<body>`
82 *
83 * Useful mainly when dropdown is attached to the body.
84 * If the dropdown is inline just use `<div ngbDropdown class="custom-class">` instead.
85 *
86 * @since 9.1.0
87 */
88 dropdownClass: string;
89 /**
90 * Defines whether or not the dropdown menu is opened initially.
91 */
92 _open: boolean;
93 /**
94 * The preferred placement of the dropdown.
95 *
96 * Possible values are `"top"`, `"top-left"`, `"top-right"`, `"bottom"`, `"bottom-left"`,
97 * `"bottom-right"`, `"left"`, `"left-top"`, `"left-bottom"`, `"right"`, `"right-top"`,
98 * `"right-bottom"`
99 *
100 * Accepts an array of strings or a string with space separated possible values.
101 *
102 * The default order of preference is `"bottom-left bottom-right top-left top-right"`
103 *
104 * Please see the [positioning overview](#/positioning) for more details.
105 */
106 placement: PlacementArray;
107 /**
108 * A selector specifying the element the dropdown should be appended to.
109 * Currently only supports "body".
110 *
111 * @since 4.1.0
112 */
113 container: null | 'body';
114 /**
115 * Enable or disable the dynamic positioning. The default value is dynamic unless the dropdown is used
116 * inside a Bootstrap navbar. If you need custom placement for a dropdown in a navbar, set it to
117 * dynamic explicitly. See the [positioning of dropdown](#/positioning#dropdown)
118 * and the [navbar demo](/#/components/dropdown/examples#navbar) for more details.
119 *
120 * @since 4.2.0
121 */
122 display: 'dynamic' | 'static';
123 /**
124 * An event fired when the dropdown is opened or closed.
125 *
126 * The event payload is a `boolean`:
127 * * `true` - the dropdown was opened
128 * * `false` - the dropdown was closed
129 */
130 openChange: EventEmitter<boolean>;
131 constructor(_changeDetector: ChangeDetectorRef, config: NgbDropdownConfig, _document: any, _ngZone: NgZone, _elementRef: ElementRef<HTMLElement>, _renderer: Renderer2, ngbNavbar: NgbNavbar);
132 ngAfterContentInit(): void;
133 ngOnChanges(changes: SimpleChanges): void;
134 /**
135 * Checks if the dropdown menu is open.
136 */
137 isOpen(): boolean;
138 /**
139 * Opens the dropdown menu.
140 */
141 open(): void;
142 private _setCloseHandlers;
143 /**
144 * Closes the dropdown menu.
145 */
146 close(): void;
147 /**
148 * Toggles the dropdown menu.
149 */
150 toggle(): void;
151 ngOnDestroy(): void;
152 onKeyDown(event: KeyboardEvent): void;
153 private _isDropup;
154 private _isEventFromToggle;
155 private _getMenuElements;
156 private _positionMenu;
157 private _getFirstPlacement;
158 private _resetContainer;
159 private _applyContainer;
160 private _applyCustomDropdownClass;
161 private _applyPlacementClasses;
162}