import * as i0 from '@angular/core'; import { OnInit, OnDestroy, InjectionToken } from '@angular/core'; interface ExpandableItem { id: string; expanded: boolean; collapse(): void; expand(): void; toggle(): void; addChild(container: ExpandableContainer): void; removeChild(container: ExpandableContainer): void; } interface ExpandableContainer { multiple: boolean; collapseAll(): void; collapse(item: ExpandableItem): void; expand(item: ExpandableItem): void; toggle(item: ExpandableItem): void; isExpanded(item: ExpandableItem): boolean; hasExpandedItem(): boolean; } /** * `ExpandableContainerDirective` provides a container for managing a group of expandable items, * allowing them to expand or collapse. It supports the functionality to either allow multiple * items to be expanded simultaneously or restrict to a single item at a time. * * This directive uses Angular's dependency injection to optionally inject a parent `ExpandableItem` or `ExpandableContainer`, * enabling nested expandable structures. The `multiple` property can be set to dictate the expand/collapse behavior. */ declare class ExpandableContainerDirective implements ExpandableContainer, OnInit, OnDestroy { private readonly expandedItems; private readonly parentItem; private readonly parentContainer; /** * Determines whether multiple items can be expanded within the container. * * @type {boolean} * @default false */ multiple: boolean; ngOnInit(): void; ngOnDestroy(): void; /** * Collapses all the expanded items within the expandable container. */ collapseAll(): void; /** * Collapses the specified item. * * @param {ExpandableItem} item - The item to collapse. */ collapse(item: ExpandableItem): void; /** * Expands the specified item. * If `multiple` is set to `false`, it collapses all other items before expanding the specified item. * @param {ExpandableItem} item - The item to expand. */ expand(item: ExpandableItem): void; /** * Toggles the expansion state of the specified item. * If `forceState` is provided, it will set the expansion state to the specified value. * If `forceState` is not provided, it will toggle the expansion state of the item. * * @param {ExpandableItem} item - The item to toggle the expansion state for. * @param {boolean} forceState - Optional. The desired expansion state to set for the item. */ toggle(item: ExpandableItem, forceState?: boolean): void; /** * Checks if the specified item is expanded. * @param {ExpandableItem} item - The item to check. * @returns `true` if the item is expanded, `false` otherwise. */ isExpanded(item: ExpandableItem): boolean; /** * Checks if there is any expanded item. * * @returns {boolean} True if there is at least one expanded item, false otherwise. */ hasExpandedItem(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_multiple: unknown; } /** * `ExpandableItemDirective` allows you to manage the expansion state of an item within an expandable container, such as an accordion or a nested list. It provides methods to expand, collapse, and toggle the item, and automatically registers itself with a parent expandable container if one is available. * * You can control the expanded state programmatically by binding to the `expanded` property. */ declare class ExpandableItemDirective implements ExpandableItem { private readonly changeDetectorRef; private readonly childContainers; private _expanded; /** * Container which can be set manually. */ container: ExpandableContainer | null; /** Unique identifier for the expandable item. * * @type {string} */ id: string; /** * Controls the expanded state of the item. * * @param {boolean} value - When `true`, expands the item; when `false`, collapses the item. * * @example * Bind to the expanded state: * ```html *
* ``` */ set expanded(value: boolean); /** * Gets a value indicating whether the item is expanded. * If the item is contained within a container, it checks the container's `isExpanded` method. * Otherwise, it returns the value of the `_expanded` property. * * @type {boolean} `true` if the item is expanded; otherwise, `false`. */ get expanded(): boolean; /** * Toggles the expansion state of the item, optionally forcing a specific state. * * @param {boolean} forceState - When provided, forces the expansion state to the specified value. */ toggle(forceState?: boolean): void; /** Expands the item. * * @returns {void} */ expand(): void; /** Collapses the item. * * @returns {void} */ collapse(): void; /** Adds a child container to the item. * * @param {ExpandableContainer} container - The child container to add. * @returns {void} */ addChild(container: ExpandableContainer): void; /** Removes a child container from the item. * * @param {ExpandableContainer} container - The child container to remove. * @returns {void} */ removeChild(container: ExpandableContainer): void; private closeAllChildren; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_expanded: unknown; } declare class ExpandableModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const ODX_EXPANDABLE_CONTAINER: InjectionToken; declare const ODX_EXPANDABLE_ITEM: InjectionToken; export { ExpandableContainerDirective, ExpandableItemDirective, ExpandableModule, ODX_EXPANDABLE_CONTAINER, ODX_EXPANDABLE_ITEM }; export type { ExpandableContainer, ExpandableItem };