UNPKG

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