UNPKG

9.95 kBTypeScriptView Raw
1import { AfterContentChecked, AfterContentInit, EventEmitter, OnDestroy } from '@angular/core';
2import { NgbCollapse } from '../collapse/collapse';
3import * as i0 from "@angular/core";
4import * as i1 from "../collapse/collapse";
5/**
6 * A directive that wraps the content of an accordion item's collapsible body.
7 *
8 * The actual content is provided in a child `ng-template` element.
9 * Depending on the state of the accordion, the template will be either inserted or removed from the DOM.
10 *
11 * @since 14.1.0
12 */
13export declare class NgbAccordionBody implements AfterContentChecked, OnDestroy {
14 private _vcr;
15 private _element;
16 private _item;
17 private _viewRef;
18 private _bodyTpl;
19 ngAfterContentChecked(): void;
20 ngOnDestroy(): void;
21 private _destroyViewIfExists;
22 private _createViewIfNotExists;
23 static ɵfac: i0.ɵɵFactoryDeclaration<NgbAccordionBody, never>;
24 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbAccordionBody, "[ngbAccordionBody]", never, {}, {}, ["_bodyTpl"], never, true, never>;
25}
26/**
27 * A directive that wraps the collapsible item's content of the accordion.
28 *
29 * Internally it reuses the [`NgbCollapse` directive](#/components/collapse)
30 *
31 * @since 14.1.0
32 */
33export declare class NgbAccordionCollapse {
34 item: NgbAccordionItem;
35 ngbCollapse: NgbCollapse;
36 static ɵfac: i0.ɵɵFactoryDeclaration<NgbAccordionCollapse, never>;
37 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbAccordionCollapse, "[ngbAccordionCollapse]", ["ngbAccordionCollapse"], {}, {}, never, never, true, [{ directive: typeof i1.NgbCollapse; inputs: {}; outputs: {}; }]>;
38}
39/**
40 * A directive to put on a toggling element inside the accordion item's header.
41 * It will register click handlers that toggle the associated panel and will handle accessibility attributes.
42 *
43 * This directive is used internally by the [`NgbAccordionButton` directive](#/components/accordion/api#NgbAccordionButton).
44 *
45 * @since 14.1.0
46 */
47export declare class NgbAccordionToggle {
48 item: NgbAccordionItem;
49 accordion: NgbAccordionDirective;
50 static ɵfac: i0.ɵɵFactoryDeclaration<NgbAccordionToggle, never>;
51 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbAccordionToggle, "[ngbAccordionToggle]", never, {}, {}, never, never, true, never>;
52}
53/**
54 * A directive to put on a button element inside an accordion item's header.
55 *
56 * If you want a custom markup for the header, you can also use the [`NgbAccordionToggle` directive](#/components/accordion/api#NgbAccordionToggle).
57 *
58 * @since 14.1.0
59 */
60export declare class NgbAccordionButton {
61 item: NgbAccordionItem;
62 static ɵfac: i0.ɵɵFactoryDeclaration<NgbAccordionButton, never>;
63 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbAccordionButton, "button[ngbAccordionButton]", never, {}, {}, never, never, true, [{ directive: typeof NgbAccordionToggle; inputs: {}; outputs: {}; }]>;
64}
65/**
66 * A directive that wraps an accordion item's header.
67 *
68 * @since 14.1.0
69 */
70export declare class NgbAccordionHeader {
71 item: NgbAccordionItem;
72 static ɵfac: i0.ɵɵFactoryDeclaration<NgbAccordionHeader, never>;
73 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbAccordionHeader, "[ngbAccordionHeader]", never, {}, {}, never, never, true, never>;
74}
75/**
76 * A directive that wraps an accordion item: a toggleable header + body that collapses.
77 *
78 * You can get hold of the `NgbAccordionItem` instance in the template with `#item="ngbAccordionItem"`.
79 * It allows to check if the item is collapsed or not, toggle the collapse state, etc.
80 *
81 * Every accordion item has a string ID that is automatically generated in the `ngb-accordion-item-XX` format, unless provided explicitly.
82 *
83 * @since 14.1.0
84 */
85export declare class NgbAccordionItem implements AfterContentInit {
86 private _accordion;
87 private _cd;
88 private _destroyRef;
89 private _collapsed;
90 private _id;
91 private _destroyOnHide;
92 private _collapseAnimationRunning;
93 private _collapse;
94 /**
95 * Sets the custom ID of the accordion item. It must be unique for the document.
96 *
97 * @param id The ID of the accordion item, must be a non-empty string
98 */
99 set id(id: string);
100 /**
101 * If `true`, the content of the accordion item's body will be removed from the DOM. It will be just hidden otherwise.
102 *
103 * This property can also be set up on the parent [`NgbAccordion` directive](#/components/accordion/api#NgbAccordionDirective).
104 */
105 set destroyOnHide(destroyOnHide: boolean);
106 get destroyOnHide(): boolean;
107 /**
108 * If `true`, the accordion item will be disabled.
109 * It won't react to user's clicks, but still will be toggelable programmatically.
110 */
111 disabled: boolean;
112 /**
113 * If `true`, the accordion item will be collapsed. Otherwise, it will be expanded.
114 *
115 * @param collapsed New state of the accordion item.
116 */
117 set collapsed(collapsed: boolean);
118 /**
119 * Event emitted before the expanding animation starts. It has no payload.
120 *
121 * @since 15.1.0
122 */
123 show: EventEmitter<void>;
124 /**
125 * Event emitted when the expanding animation is finished. It has no payload.
126 */
127 shown: EventEmitter<void>;
128 /**
129 * Event emitted before the collapsing animation starts. It has no payload.
130 *
131 * @since 15.1.0
132 */
133 hide: EventEmitter<void>;
134 /**
135 * Event emitted when the collapsing animation is finished and before the content is removed from DOM.
136 * It has no payload.
137 */
138 hidden: EventEmitter<void>;
139 get collapsed(): boolean;
140 get id(): string;
141 get toggleId(): string;
142 get collapseId(): string;
143 get _shouldBeInDOM(): boolean;
144 ngAfterContentInit(): void;
145 /**
146 * Toggles an accordion item.
147 */
148 toggle(): void;
149 /**
150 * Expands an accordion item.
151 */
152 expand(): void;
153 /**
154 * Collapses an accordion item.
155 */
156 collapse(): void;
157 static ɵfac: i0.ɵɵFactoryDeclaration<NgbAccordionItem, never>;
158 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbAccordionItem, "[ngbAccordionItem]", ["ngbAccordionItem"], { "id": { "alias": "ngbAccordionItem"; "required": false; }; "destroyOnHide": { "alias": "destroyOnHide"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "collapsed": { "alias": "collapsed"; "required": false; }; }, { "show": "show"; "shown": "shown"; "hide": "hide"; "hidden": "hidden"; }, ["_collapse"], never, true, never>;
159}
160/**
161 * Accordion is a stack of cards that have a header and collapsible body.
162 *
163 * This directive is a container for these items and provides an API to handle them.
164 *
165 * @since 14.1.0
166 */
167export declare class NgbAccordionDirective {
168 private _config;
169 private _anItemWasAlreadyExpandedDuringInitialisation;
170 private _items?;
171 /**
172 * If `true`, accordion will be animated.
173 */
174 animation: boolean;
175 /**
176 * If `true`, only one item at the time can stay open.
177 */
178 closeOthers: boolean;
179 /**
180 * If `true`, the content of the accordion items body will be removed from the DOM. It will be just hidden otherwise.
181 *
182 * This property can be overwritten at the [`NgbAccordionItem`](#/components/accordion/api#NgbAccordionItem) level
183 */
184 destroyOnHide: boolean;
185 /**
186 * Event emitted before expanding animation starts. The payload is the id of shown accordion item.
187 *
188 * @since 15.1.0
189 */
190 show: EventEmitter<string>;
191 /**
192 * Event emitted when the expanding animation is finished. The payload is the id of shown accordion item.
193 */
194 shown: EventEmitter<string>;
195 /**
196 * Event emitted before the collapsing animation starts. The payload is the id of hidden accordion item.
197 *
198 * @since 15.1.0
199 */
200 hide: EventEmitter<string>;
201 /**
202 * Event emitted when the collapsing animation is finished and before the content is removed from DOM.
203 * The payload is the id of hidden accordion item.
204 */
205 hidden: EventEmitter<string>;
206 /**
207 * Toggles an item with the given id.
208 *
209 * It will toggle an item, even if it is disabled.
210 *
211 * @param itemId The id of the item to toggle.
212 */
213 toggle(itemId: string): void;
214 /**
215 * Expands an item with the given id.
216 *
217 * If `closeOthers` is `true`, it will collapse other panels.
218 *
219 * @param itemId The id of the item to expand.
220 */
221 expand(itemId: string): void;
222 /**
223 * Expands all items.
224 *
225 * If `closeOthers` is `true` and all items are closed, it will open the first one. Otherwise, it will keep the opened one.
226 */
227 expandAll(): void;
228 /**
229 * Collapses an item with the given id.
230 *
231 * Has no effect if the `itemId` does not correspond to any item.
232 *
233 * @param itemId The id of the item to collapse.
234 */
235 collapse(itemId: string): void;
236 /**
237 * Collapses all items.
238 */
239 collapseAll(): void;
240 /**
241 * Checks if an item with the given id is expanded.
242 *
243 * If the `itemId` does not correspond to any item, it returns `false`.
244 *
245 * @param itemId The id of the item to check.
246 */
247 isExpanded(itemId: string): boolean;
248 /**
249 * It checks, if the item can be expanded in the current state of the accordion.
250 * With `closeOthers` there can be only one expanded item at a time.
251 *
252 * @internal
253 */
254 _ensureCanExpand(toExpand: NgbAccordionItem): boolean;
255 private _getItem;
256 static ɵfac: i0.ɵɵFactoryDeclaration<NgbAccordionDirective, never>;
257 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbAccordionDirective, "[ngbAccordion]", ["ngbAccordion"], { "animation": { "alias": "animation"; "required": false; }; "closeOthers": { "alias": "closeOthers"; "required": false; }; "destroyOnHide": { "alias": "destroyOnHide"; "required": false; }; }, { "show": "show"; "shown": "shown"; "hide": "hide"; "hidden": "hidden"; }, ["_items"], never, true, never>;
258}