import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnInit, OnDestroy, TemplateRef, Injector } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { IgxSelectionAPIService } from '../core/selection'; import { CancelableEventArgs, CancelableBrowserEventArgs, IBaseEventArgs } from '../core/utils'; import { IgxStringFilteringOperand, IgxBooleanFilteringOperand } from '../data-operations/filtering-condition'; import { FilteringLogic } from '../data-operations/filtering-expression.interface'; import { IForOfState, IgxForOfDirective } from '../directives/for-of/for_of.directive'; import { IgxInputGroupComponent } from '../input-group/input-group.component'; import { IgxComboDropDownComponent } from './combo-dropdown.component'; import { OverlaySettings } from '../services'; import { DisplayDensityBase, IDisplayDensityOptions } from '../core/density'; import { IgxComboBase } from './combo.common'; import { IgxComboAPIService } from './combo.api'; import { EditorProvider } from '../core/edit-provider'; import { IgxInputDirective } from '../directives/input/input.directive'; export declare enum IgxComboState { /** * Combo with initial state. */ INITIAL = 0, /** * Combo with valid state. */ VALID = 1, /** * Combo with invalid state. */ INVALID = 2 } /** Event emitted when an igx-combo's selection is changing */ export interface IComboSelectionChangeEventArgs extends CancelableEventArgs, IBaseEventArgs { /** An array containing the values that are currently selected */ oldSelection: any[]; /** An array containing the values that will be selected after this event */ newSelection: any[]; /** An array containing the values that will be added to the selection (if any) */ added: any[]; /** An array containing the values that will be removed from the selection (if any) */ removed: any[]; /** The user interaction that triggered the selection change */ event?: Event; } export interface IComboItemAdditionEvent extends IBaseEventArgs { oldCollection: any[]; addedItem: any; newCollection: any[]; } export declare class IgxComboComponent extends DisplayDensityBase implements IgxComboBase, AfterViewInit, ControlValueAccessor, OnInit, OnDestroy, EditorProvider { protected elementRef: ElementRef; protected cdr: ChangeDetectorRef; protected selection: IgxSelectionAPIService; protected comboAPI: IgxComboAPIService; protected _displayDensityOptions: IDisplayDensityOptions; private _injector; /** * @hidden @internal */ customValueFlag: boolean; /** * @hidden @internal */ defaultFallbackGroup: string; protected stringFilters: typeof IgxStringFilteringOperand; protected booleanFilters: typeof IgxBooleanFilteringOperand; protected _groupKey: string; protected _displayKey: string; protected _prevInputValue: string; private _dataType; private ngControl; private destroy$; private _data; private _filteredData; private _itemHeight; private _itemsMaxHeight; private _remoteSelection; private _onChangeCallback; private _overlaySettings; private _value; private _valid; constructor(elementRef: ElementRef, cdr: ChangeDetectorRef, selection: IgxSelectionAPIService, comboAPI: IgxComboAPIService, _displayDensityOptions: IDisplayDensityOptions, _injector: Injector); protected virtDir: IgxForOfDirective; /** * Set custom overlay settings that control how the combo's list of items is displayed. * Set: * ```html * * ``` * * ```typescript * const customSettings = { positionStrategy: { settings: { target: myTarget } } }; * combo.overlaySettings = customSettings; * ``` * Get any custom overlay settings used by the combo: * ```typescript * const comboOverlaySettings: OverlaySettings = myCombo.overlaySettings; * ``` */ overlaySettings: OverlaySettings; /** @hidden @internal */ inputGroup: IgxInputGroupComponent; /** @hidden @internal */ comboInput: IgxInputDirective; /** * @hidden @internal */ dropdown: IgxComboDropDownComponent; /** * @hidden @internal */ searchInput: ElementRef; /** * @hidden @internal */ readonly displaySearchInput: boolean; /** * The custom template, if any, that should be used when rendering ITEMS in the combo list * * ```typescript * // Set in typescript * const myCustomTemplate: TemplateRef = myComponent.customTemplate; * myComponent.combo.itemTemplate = myCustomTemplate; * ``` * ```html * * * ... * *
*
{{ item[key] }}
*
{{ item.cost }}
*
*
*
* ``` */ itemTemplate: TemplateRef; /** * The custom template, if any, that should be used when rendering the HEADER for the combo items list * * ```typescript * // Set in typescript * const myCustomTemplate: TemplateRef = myComponent.customTemplate; * myComponent.combo.headerTemplate = myCustomTemplate; * ``` * ```html * * * ... * *
* This is a custom header *
*
*
* ``` */ headerTemplate: TemplateRef; /** * The custom template, if any, that should be used when rendering the FOOTER for the combo items list * * ```typescript * // Set in typescript * const myCustomTemplate: TemplateRef = myComponent.customTemplate; * myComponent.combo.footerTemplate = myCustomTemplate; * ``` * ```html * * * ... * * * * * ``` */ footerTemplate: TemplateRef; /** * The custom template, if any, that should be used when rendering HEADER ITEMS for groups in the combo list * * ```typescript * // Set in typescript * const myCustomTemplate: TemplateRef = myComponent.customTemplate; * myComponent.combo.headerItemTemplate = myCustomTemplate; * ``` * ```html * * * ... * *
Group header for {{ item[key] }}
*
*
* ``` */ headerItemTemplate: TemplateRef; /** * The custom template, if any, that should be used when rendering the ADD BUTTON in the combo drop down * * ```typescript * // Set in typescript * const myCustomTemplate: TemplateRef = myComponent.customTemplate; * myComponent.combo.addItemTemplate = myCustomTemplate; * ``` * ```html * * * ... * * * * * ``` */ addItemTemplate: TemplateRef; /** * The custom template, if any, that should be used when rendering the ADD BUTTON in the combo drop down * * ```typescript * // Set in typescript * const myCustomTemplate: TemplateRef = myComponent.customTemplate; * myComponent.combo.emptyTemplate = myCustomTemplate; * ``` * ```html * * * ... * *
* There are no items to display *
*
*
* ``` */ emptyTemplate: TemplateRef; /** * The custom template, if any, that should be used when rendering the combo TOGGLE(open/close) button * * ```typescript * // Set in typescript * const myCustomTemplate: TemplateRef = myComponent.customTemplate; * myComponent.combo.toggleIconTemplate = myCustomTemplate; * ``` * ```html * * * ... * * {{ collapsed ? 'remove_circle' : 'remove_circle_outline'}} * * * ``` */ toggleIconTemplate: TemplateRef; /** * The custom template, if any, that should be used when rendering the combo CLEAR button * * ```typescript * // Set in typescript * const myCustomTemplate: TemplateRef = myComponent.customTemplate; * myComponent.combo.clearIconTemplate = myCustomTemplate; * ``` * ```html * * * ... * * clear * * * ``` */ clearIconTemplate: TemplateRef; protected primitiveTemplate: TemplateRef; protected complexTemplate: TemplateRef; /** * @hidden @internal */ virtualScrollContainer: IgxForOfDirective; protected dropdownContainer: ElementRef; /** * Emitted when item selection is changing, before the selection completes * * ```html * * ``` */ onSelectionChange: EventEmitter; /** * Emitted before the dropdown is opened * * ```html * * ``` */ onOpening: EventEmitter; /** * Emitted after the dropdown is opened * * ```html * * ``` */ onOpened: EventEmitter; /** * Emitted before the dropdown is closed * * ```html * * ``` */ onClosing: EventEmitter; /** * Emitted after the dropdown is closed * * ```html * * ``` */ onClosed: EventEmitter; /** * Emitted when an item is being added to the data collection * * ```html * * ``` */ onAddition: EventEmitter; /** * Emitted when the value of the search input changes (e.g. typing, pasting, clear, etc.) * * ```html * * ``` */ onSearchInput: EventEmitter; /** * Emitted when new chunk of data is loaded from the virtualization * * ```html * * ``` */ onDataPreLoad: EventEmitter; /** * Gets/gets combo id. * * ```typescript * // get * let id = this.combo.id; * ``` * * ```html * * * ``` */ id: string; /** * Sets the style width of the element * * ```typescript * // get * let myComboWidth = this.combo.width; * ``` * * ```html * * * ``` */ width: string; /** * @hidden @internal */ cssClass: string; /** * @hidden @internal */ role: string; /** * @hidden @internal */ readonly ariaExpanded: boolean; /** * @hidden @internal */ readonly hasPopUp: string; /** * @hidden @internal */ readonly ariaOwns: string; /** * Controls whether custom values can be added to the collection * * ```typescript * // get * let comboAllowsCustomValues = this.combo.allowCustomValues; * ``` * * ```html * * * ``` */ allowCustomValues: boolean; /** * Configures the drop down list height * * ```typescript * // get * let myComboItemsMaxHeight = this.combo.itemsMaxHeight; * ``` * * ```html * * * ``` */ itemsMaxHeight: number; /** * Configures the drop down list width * * ```typescript * // get * let myComboItemsWidth = this.combo.itemsWidth; * ``` * * ```html * * * ``` */ itemsWidth: string; /** * Configures the drop down list item height * * ```typescript * // get * let myComboItemHeight = this.combo.itemHeight; * ``` * * ```html * * * ``` */ itemHeight: number; /** * @hidden @internal */ filteringLogic: FilteringLogic; /** * Defines the placeholder value for the combo value field * * ```typescript * // get * let myComboPlaceholder = this.combo.placeholder; * ``` * * ```html * * * ``` */ placeholder: any; /** * @hidden @internal */ readonly inputEmpty: boolean; /** * Defines the placeholder value for the combo dropdown search field * * ```typescript * // get * let myComboSearchPlaceholder = this.combo.searchPlaceholder; * ``` * * ```html * * * ``` */ searchPlaceholder: string; /** * Combo data source. * * ```html * * * ``` */ data: any[]; /** * Combo value data source property. * * ```typescript * // get * let myComboValueKey = this.combo.valueKey; * ``` * * ```html * * * ``` */ valueKey: string; /** * Combo text data source property. * * ```typescript * // get * let myComboDisplayKey = this.combo.displayKey; * * // set * this.combo.displayKey = 'val'; * * ``` * * ```html * * * ``` */ displayKey: string; /** * The item property by which items should be grouped inside the items list. Not usable if data is not of type Object[]. * * ```html * * * ``` */ /** * The item property by which items should be grouped inside the items list. Not usable if data is not of type Object[]. * * ```typescript * // get * let currentGroupKey = this.combo.groupKey; * ``` */ groupKey: string; /** * An @Input property that enabled/disables filtering in the list. The default is `true`. * ```html * * ``` */ filterable: boolean; /** * An @Input property that set aria-labelledby attribute * ```html * * ``` */ ariaLabelledBy: string; /** * An @Input property that enabled/disables combo. The default is `false`. * ```html * * ``` */ disabled: boolean; /** * An @Input property that sets how the combo will be styled. * The allowed values are `line`, `box`, `border` and `search`. The default is `box`. * ```html * * ``` */ type: string; /** * Gets if control is valid, when used in a form * * ```typescript * // get * let valid = this.combo.valid; * ``` * */ /** * Sets if control is valid, when used in a form * * ```typescript * // set * this.combo.valid = IgxComboState.INVALID; * ``` */ valid: IgxComboState; /** * @hidden @internal */ searchValue: string; /** * @hidden @internal */ onArrowDown(event: Event): void; /** * @hidden @internal */ onInputClick(event: Event): void; /** * Defines the current state of the virtualized data. It contains `startIndex` and `chunkSize` * * ```typescript * // get * let state = this.combo.virtualizationState; * ``` */ /** * Sets the current state of the virtualized data. * * ```typescript * // set * this.combo.virtualizationState(state); * ``` */ virtualizationState: IForOfState; /** * Gets total count of the virtual data items, when using remote service. * * ```typescript * // get * let count = this.combo.totalItemCount; * ``` */ /** * Sets total count of the virtual data items, when using remote service. * * ```typescript * // set * this.combo.totalItemCount(remoteService.count); * ``` */ totalItemCount: number; /** * The text displayed in the combo input * * ```typescript * // get * let comboValue = this.combo.value; * ``` */ readonly value: string; /** * @hidden @internal */ /** * @hidden @internal */ filteredData: any[]; /** * @hidden @internal */ handleKeyUp(event: KeyboardEvent): void; /** * @hidden @internal */ handleKeyDown(event: KeyboardEvent): void; private checkMatch; /** * @hidden @internal */ handleInputChange(event?: string): void; /** * @hidden @internal */ readonly dataType: string; /** * @hidden @internal */ readonly isRemote: boolean; /** Contains key-value pairs of the selected valueKeys and their resp. displayKeys */ private registerRemoteEntries; /** For `id: any[]` returns a mapped `{ [combo.valueKey]: any, [combo.displayKey]: any }[]`*/ private getValueDisplayPairs; /** * Returns if the specified itemID is selected * @hidden * @internal */ isItemSelected(item: any): boolean; /** * Triggers change detection on the combo view */ triggerCheck(): void; /** * @hidden @internal */ isAddButtonVisible(): boolean; /** * @hidden @internal */ handleSelectAll(evt: any): void; /** * @hidden @internal */ addItemToCollection(): void; /** * @hidden @internal */ focusSearchInput(opening?: boolean): void; protected onStatusChanged: () => void; protected manageRequiredAsterisk(): void; /** * @hidden @internal */ onBlur(): void; /** * @hidden @internal */ ngOnInit(): void; /** * @hidden @internal */ ngAfterViewInit(): void; /** * @hidden @internal */ ngOnDestroy(): void; /** * @hidden @internal */ writeValue(value: any[]): void; /** * @hidden @internal */ registerOnChange(fn: any): void; /** * @hidden @internal */ registerOnTouched(fn: any): void; /** * @hidden @internal */ setDisabledState(isDisabled: boolean): void; /** * @hidden */ getEditElement(): HTMLElement; /** * @hidden @internal */ readonly template: TemplateRef; /** * @hidden @internal */ readonly context: any; /** * @hidden @internal */ handleClearItems(event: Event): void; /** * A method that opens/closes the combo. * *```html * * *``` */ toggle(): void; /** * A method that opens the combo. * *```html * * *``` */ open(): void; /** * A method that closes the combo. * *```html * * *``` */ close(): void; /** * Gets drop down state. * * ```typescript * let state = this.combo.collapsed; * ``` */ readonly collapsed: boolean; /** * Get current selection state * @returns Array of selected items * ```typescript * let selectedItems = this.combo.selectedItems(); * ``` */ selectedItems(): any[]; /** * Select defined items * @param newItems new items to be selected * @param clearCurrentSelection if true clear previous selected items * ```typescript * this.combo.selectItems(["New York", "New Jersey"]); * ``` */ selectItems(newItems: Array, clearCurrentSelection?: boolean, event?: Event): void; /** * Deselect defined items * @param items items to deselected * ```typescript * this.combo.deselectItems(["New York", "New Jersey"]); * ``` */ deselectItems(items: Array, event?: Event): void; /** * Select all (filtered) items * @param ignoreFilter if set to true, selects all items, otherwise selects only the filtered ones. * ```typescript * this.combo.selectAllItems(); * ``` */ selectAllItems(ignoreFilter?: boolean, event?: Event): void; /** * Deselect all (filtered) items * @param ignoreFilter if set to true, deselects all items, otherwise deselects only the filtered ones. * ```typescript * this.combo.deselectAllItems(); * ``` */ deselectAllItems(ignoreFilter?: boolean, event?: Event): void; /** * Selects/Deselects a single item * @param itemID the itemID of the specific item * @param select If the item should be selected (true) or deselected (false) * * Without specified valueKey; * ```typescript * this.combo.valueKey = null; * const items: { field: string, region: string}[] = data; * this.combo.setSelectedItem(items[0], true); * ``` * With specified valueKey; * ```typescript * this.combo.valueKey = 'field'; * const items: { field: string, region: string}[] = data; * this.combo.setSelectedItem('Connecticut', true); * ``` */ setSelectedItem(itemID: any, select?: boolean, event?: Event): void; protected setSelection(newSelection: Set, event?: Event): void; /** if there is a valueKey - map the keys to data items, else - just return the keys */ private convertKeysToItems; /** * Event handlers * @hidden * @internal */ handleOpening(event: CancelableEventArgs): void; /** * @hidden @internal */ handleOpened(): void; /** * @hidden @internal */ handleClosing(event: any): void; /** * @hidden @internal */ handleClosed(): void; } /** * @hidden */ export declare class IgxComboModule { }