/// /// /** Core */ import { Generic } from "cmf.core/src/core"; /** Angular 2 */ import * as ng from "@angular/core"; import { DropdownElement, DropdownHighlight, DropdownPositions, DropdownMultiSelection, DropdownClearMultiSelection, ComparisonMode } from "./dropdownStructure"; export declare class DropdownService extends Generic { /** * Sets the items as disabled * @param items Items to disable, keys to use in the comparison * @param renderedItems Data items * @param searchPath Field of the data item to use in the comparison */ setDisabledItems(items: string[], renderedItems: DropdownElement[], searchPath: string, comparisonMode?: ComparisonMode): DropdownElement[]; /** * Hides checkbox and disables interaction of the desired items * @param items Items to disable interaction and hide checkbox, keys to use in the comparison * @param renderedItems Data items * @param searchPath Field of the data item to use in the comparison */ setNotSelectableItems(items: string[], renderedItems: DropdownElement[], searchPath: string, comparisonMode?: ComparisonMode): DropdownElement[]; /** * Sets the items as pre-selected or already selected if immediateSelection is true * @param items * @param renderedItems * @param searchPath * @param immediateSelection * @param comboboxAlike * @param selectedCount */ setSelectedItems(items: string[], renderedItems: DropdownElement[], searchPath: string, immediateSelection: boolean, comboboxAlike: boolean, selectedCount: number, compareFunction?: (targetItem: string, compareObj: any) => boolean, comparisonMode?: ComparisonMode): number; /** * Highlight a dropdown element and move dropdown to show item if hidden * @param itemValue * @param renderedItems * @param searchPath * @param dropdownElementAppendedToMain * @param dropdownMenu * @param ngZone * @param dropdownHighlight */ highlightItem(itemValue: string, renderedItems: DropdownElement[], searchPath: string, dropdownElementAppendedToMain: JQuery, dropdownMenu: ng.ElementRef, ngZone: ng.NgZone, dropdownHighlight: DropdownHighlight): DropdownHighlight; /** * Calculate dropdown width * @param isToggle * @param calculateDropdownLeft * @param dropdownMenu * @param toggleElement * @param ngZone * @param dropdownPositons */ calculateSize(isToggle: boolean, calculateDropdownLeft: boolean, dropdownMenu: ng.ElementRef, toggleElement: ng.ElementRef, ngZone: ng.NgZone, dropdownPositons: DropdownPositions): DropdownPositions; /** * Determines wether an event is inner to the dropdownMenu element * @param event * @param dropdownMenu */ isInnerEvent(event: Event, dropdownMenu: ng.ElementRef): boolean; /** * Apply search according to value filtering the items * @param value * @param filteredItems * @param renderedItems * @param searchPath */ filterByValue(value: string, renderedItems: DropdownElement[], searchPath: string): DropdownElement[]; /** * Confirm multi selection, close the dropdown and emit the event * @param multiSelection * @param immediateSelection * @param comboboxAlike * @param renderedItems */ confirmMultiSelection(multiSelection: boolean, immediateSelection: boolean, comboboxAlike: boolean, renderedItems: DropdownElement[]): DropdownMultiSelection; /** * Clears the items selected * @param renderedItems * @param forceClear if set to true clears also the preselected items otherwise keeps the previous configuration */ clearMultiSelection(renderedItems: DropdownElement[], forceClear?: boolean): DropdownClearMultiSelection; /** * Handle a click on the list item. * Dispatch an event to the parent with the selected item. * @param item * @param multiSelection * @param immediateSelection * @param items * @param renderedItems */ onItemSelect(item: DropdownElement, multiSelection: boolean, immediateSelection: boolean, items: any[], renderedItems: DropdownElement[]): DropdownElement | DropdownElement[]; }