UNPKG

@nova-ui/bits

Version:

SolarWinds Nova Framework

66 lines (65 loc) 3.22 kB
import { TrackByFunction } from "@angular/core"; import { SelectionType } from "./public-api"; import { LoggerService } from "../../services/log-service"; import { ISelection, ISelectorState } from "../../services/public-api"; import { RepeatSelectionMode } from "../repeat/types"; import * as i0 from "@angular/core"; /** * @ignore */ export declare class SelectorService { private logger?; /** * Map if SelectionType to internationalized selector options */ i18nTitleMap: Record<string, string>; constructor(logger?: LoggerService | undefined); /** * Allows to react on changes of a selector component. * If user has selected one of the options in a selector (Select all items pages, Select all items on all pages), * the new selection object should be created. * @param {ISelection} currentSelection * @param {any[]} currentItems Items on current page * @param {SelectionType} selectorValue * @param {number} totalItems * @param trackBy * @param {boolean} virtualScroll Enables virtual scroll selection behavior * @returns {ISelection} New selection object */ applySelector(currentSelection: ISelection, currentItems: any[], selectorValue: SelectionType, totalItems: number, trackBy?: TrackByFunction<any>, virtualScroll?: boolean): ISelection; /** * You may need to obtain the set of items that are selected given selection object and some set of items. * @param {ISelection} selection * @param {any[]} items * @param comparator * @returns {any[]} Set of items */ getSelectedItems(selection: ISelection, items: any[], comparator?: (a: any, b: any) => boolean): any[]; /** * Allows to react on changes of selected items (for selector). * If user selects some items directly in a list, selector state may change * @param {ISelection} currentSelection * @param {number} totalOnCurrentPage * @param {number} selectedOnCurrentPage * @param totalItems * @param selectedOnAllPages * @param {boolean} virtualScroll Enables virtual scroll selection behavior * @returns {ISelectorState} */ getSelectorState(currentSelection: ISelection, totalOnCurrentPage: number, selectedOnCurrentPage: number, totalItems?: number, selectedOnAllPages?: number, virtualScroll?: boolean): ISelectorState; /** * Allows to react on selection. * @param {ISelection} prevSelection Previous selection * @param {any[]} selectedItems Selected items on the current page * @param {any[]} items Items on the current page * @param {RepeatSelectionMode} selectionMode One of possible repeater selection modes * @param {number} totalItems Deprecated in v9 - Unused - Removal: NUI-5809 * @returns {ISelection} New selection */ selectItems(prevSelection: ISelection, selectedItems: any[], items: any[], selectionMode: RepeatSelectionMode, totalItems?: number): ISelection; private getIncludedItems; private getExcludedItems; private getFlatSelectorItems; static ɵfac: i0.ɵɵFactoryDeclaration<SelectorService, [{ optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<SelectorService>; }