import { DropDownItem } from '../models/drop-down-item.interface'; import { BehaviorSubject } from 'rxjs'; import { DropDownSelectedState } from '../models/drop-down-selected-state.interface'; /** * Handle the selected item state. * we use it for * - mark the selected checkbox * - display the selected title in the trigger button */ export declare class SelectedItemsState { private isSingleSelection; private _state; get selectedState(): DropDownSelectedState; stateChanged$: BehaviorSubject; constructor(isSingleSelection: boolean); /** * override state * @param state */ overrideState(state: DropDownSelectedState): void; /** * update state with selectAll true */ selectAll(): void; /** * unselect all items by set new empty object. * return the unselected items */ unselectAllItems(): DropDownItem[]; /** * update selectedItemsMap object by get dropdown item. * the item will be added or removed depending on selected property * @param item */ updateSelectedItemsMap(item: DropDownItem): DropDownItem[]; /** * add item to selectedItemsMap * @param item * @param allowCallOnSelectedItemsMapChange set it to false when we dont want this * method to execute onSelectedItemsMapChange method. * We will want to use false in case we are call addToSelected inside a for loop and we want * to call it only once we done the loop. */ addToSelected(item: DropDownItem, allowCallOnSelectedItemsMapChange?: boolean): void; /** * remove item to selectedItemsMap * @param item */ removeFromSelected(item: DropDownItem): void; /** * add multiple items to selectedItemsMap * @param items */ addMultipleToSelected(items: DropDownItem[]): void; /** * add multiple items to selectedItemsMap if the selected property is true * @param items */ addMultipleIfSelected(items: DropDownItem[]): void; /** * check if item is selected. * item is considered as selected when -> the item is in selectedItemsMap * or the selectAll flag is true and the item is not in unselectedItemsMap * @param value */ isItemSelected(value: string): boolean; /** * get selected items */ getSelectedItems(): DropDownItem[]; /** * get the selected value as object. * Example of return object: * {"osType": true, "anotherValueId": true} * In case nothing selected and empty object will return. */ getSelectedValueRecordObject(): Record; /** * check if all items are selected. * isAllItemSelected returns true when selectAll flag is true + the unselectedItemsMap is an empty object */ isAllItemSelected(): boolean; /** * check if all items are unselected. * isAllItemsUnSelected returns true when unselectAll flag is true + the selectedItemsMap * is an empty object */ isAllItemsUnSelected(): boolean; /** * get selected names. * in case we get allowUseMultipleSelectionText as true + selectAll flag is true 'Multiple Selection' will return * allowUseMultipleSelectionText value calculate from is server side or useInfiniteScroll for client side * The reason to check if useInfiniteScroll is true is we want to support 100k items without affect performance. * the performance issue come from the *ngFor to show all selected items in the trigger placeholder. */ getSelectedNames(allowUseMultipleSelectionText: boolean): string[]; /** * we call this method for each time a change is done on selectedItemsMap. * stateChanged$ will get updated after each selectedItemsMap change */ onSelectedItemsMapChange(): void; /** * check if at least one item is selected. * NOTE: in case server side + user click on the select all and then unselect one by one all items * this method will return true despite it should return false. * we dont have a way to know that all items unselected. */ isAtListOneItemSelected(isServerSide: boolean): boolean; /** * check if select all is true * return true if selectAll is true */ isSelectAllFlagOn(): boolean; /** * check if unselect all is true * return true if unselectAll is true */ isUnselectAllFlagOn(): boolean; /** * return how many items are selected from selectedItemsMap. * NOTE: if selectAll is true this method will return 0. */ numOfSelectedItems(): number; /** * return how many items are unselected. * NOTE: if unselectAll is true this method will return 0. */ numOfUnSelectedItems(): number; } //# sourceMappingURL=selected-items-state.utils.d.ts.map