/** Angular */ import * as ng from "@angular/core"; /** Core */ import { CoreComponent } from "cmf.core/src/core"; /** * Defines an item to be added to the dropdown */ export interface DropdownItem { /** * The item identifier */ id: string; /** * The text of the element */ template: string; /** * If defined, the item will be place in a group with the same name */ group?: string; /** * cssClass to be appended to the element */ cssClass?: string; /** * icon to be appended to the item before the text */ iconClass?: string; /** * If element is enabled (defaults to true) */ enabled?: boolean; /** * If defined, the element will hold sub elements and so on */ items?: DropdownItem[]; /** * Attached object */ tag?: any; /** * If set to true, this item won't have applied almost all of the predefined item's style, such as coloring, hover styles and size */ customContent?: boolean; } /** * @whatItDoes * Renders a dropdown menu with items that are able to have sub menus. * * @howToUse * Use this component by supplying the data and through template projection, insert an element in the component template to be used as the anchor * for the 1st-level menu. * This component works completely outisde the angular zone, so, bare that in mind when subscribing to the 'itemSelect' output. * This component is used with the inputs and outputs mentioned below. * * ### Inputs * * `DropdownItem[]` : **data** - The data to fill the dropdown * * `boolean` : **"showInactiveActions"** - If inactive actions are to be displayed by default. Defaults to true. * * `string` : **noActiveItemsLabel** - Label to be shown when the menu has no active actions * * ### Outputs * * `ng.EventEmitter` : **itemSelect** - The item selected in the dropdown * * ### Example * To use the component, assume the following HTML Templates as examples: * * ```HTML * * *
*
* ``` * * ### Dependencies * * * #### Components * _This component does not depend on any component_ * * #### Services * _This component does not depend on any service_ * * #### Directives * _This component does not depend on any directive_ * * @class DropdownMenu */ export declare class DropdownMenu extends CoreComponent implements ng.AfterViewInit, ng.OnChanges, ng.OnDestroy { private _elementRef; private _ngZone; /** * The data source for the kendo menu. */ private _kendoMenuDataSource; /** * The data in the flattened array to ease the output process. */ private _flattenedData; /** * Indicates if the view has been initialized */ private _isViewInited; /** * Dropdown items grouped by their gorup name */ private _itemsbyGroup; /** * Indicates whether there are no active items */ private _noActiveItems; /** * Indicates whether the disabled items are or aren't visible. */ private _areDisabledItemsVisible; /** * Used to know if the hide/show toggle was the last selected item */ private _hideShowInactiveActionsToggleSelected; /** * Used to know if a custom item was the last selected item */ private _customContentItemSelected; /** * The data to fill the dropdown */ data: DropdownItem[]; /** * Indicates whether the dropdown menu displays the inactive actions or not. */ showInactiveActions: boolean; /** * Emits the clicked item data. */ itemSelect: ng.EventEmitter; /** * Label to show when no active items are visible. */ noActiveItemsLabel: string; /** * Controls if the group separator name is displayed or not */ showGroupSeparatorName: boolean; /** * DropdownMenu component constructor * @param _elementRef The element ref of this component */ constructor(_elementRef: ng.ElementRef, _ngZone: ng.NgZone); /** * Flattens the dropdown items to a 1-level array * @param data the dropdown item array */ private flattenData; /** * Handles menu item selection. */ private onMenuItemSelect; /** * Builds the kendo menu items recursivly given the dropdown items * @param items the dropdown items to be transformed to kendo menu items */ private buildKendoMenuItems; /** * Builds the kendo menu data source */ private buildKendoMenuDataSource; /** * Resets the max height for the main dropdown */ private resizeMainDropdown; /** * Creates the kendo menu. */ private buildKendoMenu; /** * Sets the text label for the toggle element and sets a click event to change the appearance. * @param label The label to be inserted in the element. */ private setShowHideActionsTextAndBinding; /** * Removes the kendo menu from the DOM. */ private removeKendoMenu; /** * Hide/Show inactive actions display toggle * @param e click event */ private onToggleClick; /** * Handles AfterViewInit Angular lifecycle event. * Creates the first kendo menu */ ngAfterViewInit(): void; /** * Handles OnChanges Angular lifecycle event. * Handles the component's inputs changes. * @param changes the changes to the inputs */ ngOnChanges(changes: ng.SimpleChanges): void; /** * Handles onDestroy Angular lifecycle event. * Removes the kendo menu from the dom. */ ngOnDestroy(): void; } export declare class DropdownMenuModule { }