/** Core */ import { CoreComponent } from "cmf.core/src/core"; /** Nested components */ import { DropdownElement as BaseDropdownElement } from "cmf.core.controls/src/components/dropdown/dropdown"; /** Angular2 */ import * as ng from "@angular/core"; export interface DropdownElement { index: number; value: string; selected?: boolean; } /** * SelectDropdown Business component. * * Used to display a simple dropdown with some options (text only supported) to select. * It accepts multi-selection mode and a custom layout. * Title can be always the same (for options dropdown) or change to the active/selected option when in single mode. * * It uses the Dropdown component to display the dropdown. * * ## Inputs * * mainTitle: the title of the dropdown to show * * showItemInTitle: when activated, if the dropdown is in single selection mode, it will show the selected item in the title; * otherwise, show the title * * items: array of strings (text) of options to show * * selectedItems: selected items by default. If they change during execution, the existing selection will use the new value * * multiSelection: enable or disable multi selection mode. When multi selection mode is ON, it is possible to have 0 items selected; * otherwise, it must exist always 1 option selected * * joinTitleAndValue: if true, join mainTitle with the current selected value on title when multiSelection is false * * ## Outputs * * selectedItemsChange: dispatch an event with the selected options (Array) * * ## Example * * Assume this HTML Template * * ```html * * * ``` * * @class SelectDropdown */ export declare class SelectDropdown extends CoreComponent implements ng.OnChanges, ng.AfterViewInit { /** * Title to be rended by this component */ _title: string; /** * Title to show in the dropdown */ mainTitle: string; /** * Deprecated title input */ title: string; /** * Show the selected item in the title when available */ showItemInTitle: boolean; /** * Items to be rendered by this component */ _items: Array; /** * Items received by component */ items: Array; /** * Selected items by default */ selectedItems: Array; /** * Set if this dropdown is multi or single selection. * False by default. */ multiSelection: boolean; /** * The value change event, so the component can inform the upper components that the value has changed */ selectedItemsChange: ng.EventEmitter>; /** * Joins mainTitle and value in component title */ joinTitleAndValue: boolean; /** * On changes method * Update items - rebuild internal index for best display * Update selected value */ ngOnChanges(changes: any): void; /** * After view init method * Update the title using the settings for this component */ ngAfterViewInit(): void; /** * Update the title * Why do this instead of a get function for title property? * Just because Angular dirty-check-mode would be much less efficient that way, * so we can just update this value only and only when needed :) * Updates the title to the selected item when in single selection mode. */ private _updateTitle; _onItemSelect(selectedItem: BaseDropdownElement): void; } export declare class SelectDropdownModule { }