UNPKG

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