/** Core */ import { CoreComponent } from "cmf.core/src/core"; /** Nested components */ import { DropdownElement, ComparisonMode } from "cmf.core.controls/src/components/dropdown/dropdown"; import { OnValidate, OnValidateArgs } from "cmf.core.controls/src/directives/validator/validator"; /** Angular2 */ import * as ng from "@angular/core"; export interface EnumDropdownElement { key: number; name: string; } /** * EnumDropDown business component. Used to select an item of a given enum * Option to add a custom element to the selectable items * * ## Inputs * * enum: the Enum reference type. It will be loaded on component init * * value: default value or values to be used * * customItemName: custom element to display on the top (ie. "All") of the list * * itemsToIgnore: list of items that should be ignored from the given enum * * placeholder: It should be the "title" of the dropDown * * secondaryPlaceholder: text to show as subtitle of the dropdown * * search: If set to true, a search box will appear for the user to filter the items in the dropdown. Defaults to false * * multiSelection: If enabled, will allow the selection of multiple enums * * disabled: If set to true, will disable the selection. defaults to false * * required: If set to true will trigger the validation of the value (has to be different than null) * * `ComparisonMode` : **comparisonMode** - Comparison mode used for selection, by default is Strict meaning that === string is used * * ## Outputs * * valueChange: dispatch an event every time a selection occurs (EnumDropDownElement). * Emits an enum or an array depending on multiSelection input. Emits null if custom item is selected or none in case of multi select * * ## Example * * Assume this HTML Template * * ```html * * * ``` * * @class EnumDropdown */ export declare class EnumDropdown extends CoreComponent implements ng.OnChanges, OnValidate { /** * Enum obj */ private _enum; /** * Enum reference name. Default is "". */ private _enumReferenceName; /** * The data collection, used to populate the nested dropdown component. */ _componentData: Array; /** * Component current value - Currently selected enum value */ private _value; /** * Component dropdown title */ _placeholder: string; /** * value being displayed indicating the item selected */ _placeholderValue: string; /** * Items to preselect on the multi selection */ _multiSelectItems: string[]; /** * Inner value of the dropdown component */ private _innerValue; /** * Component custom element for enum */ customItemName: string; /** * Defines the component placeholder - overriding the default component placeholder (enum name) */ placeholder: string; /** * Defines the component sub placeholder - subtitle to be used on the dropdown */ secondaryPlaceholder: string; /** * If set to true, a search box will appear for the user to filter the items in the dropdown. Defaults to false */ search: boolean; /** * If enabled, will allow the selection of multiple enums */ multiSelection: boolean; /** * If set to true, will disable the selection */ disabled: boolean; /** * If set to true will trigger the validation of the value (has to be different than null) */ required: boolean; /** * Mobile filter dropdown */ mobileFilterDropdown: boolean; /** * Property _enumObj getter * * @return {any} current enum object */ /** * Property enum setter. Will set both _enumReferenceName and _enumObj */ enum: any; /** * value held by the enum dropdown */ value: any; /** * An array of items to ignore. The items of the array will be compared with both keys and values of the enum */ itemsToIgnore: string[]; /** * Comparison mode used for selection, by default is Relaxed meaning that %string% is used, * in the next major default will be changed to Strict meaning that === will be used. */ comparisonMode: ComparisonMode; /** * The value change event, so the component can inform the upper components that the value has changed */ valueChanged: ng.EventEmitter; constructor(); /** * Based on reference name - set placeholder */ private _setPlaceHolder; /** * Based on the currently enum object, updates the items (array of objects) that populate the nested dropdown */ private _setComponentData; /** * Convert value from enum into a dropdown element */ private toEnumDropdown; /** * Internal validation will trigger false when the value is required but is currently set to null */ private internalValidation; /** * On changes method - update property viewer value field */ ngOnChanges(changes: any): void; onSelectItem(item: DropdownElement | DropdownElement[], emitEvent?: boolean): void; /** * Validation function * @param context ValidationContext */ onValidate(context: OnValidateArgs): Promise; } export declare class EnumDropdownModule { }