import { OnChanges, OnDestroy, OnInit, TemplateRef } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { Observable, Subject } from 'rxjs';
import { TableSearchResults } from '../../display/table/searchable-table.component';
import { PagingInfo } from '../../display/table/table-pagination.component';
import { TableSelectableRowContext } from '../../display/table/table-selectable-row.component';
import { Overlay } from '../../display/view-overlay/view-overlay.component';
import { MenuItem } from '../menu/menu.component';
import { TranslateService } from '@ngx-translate/core';
import * as i0 from "@angular/core";
export interface PickerItem<TValue = any, SItems = any> extends MenuItem {
    id: string;
    /** When set to true the available item will be automatically added to the selected list */
    defaultSelected?: boolean;
    /** When set to true, the item will not be allowed to be removed from the selected list */
    preventRemove?: boolean;
    /** Redefining to get the typing */
    value: TValue;
}
export declare class ItemPickerSelectableContext<T> extends TableSelectableRowContext {
    /** id/value map of the selected items. Used for keeping track of what is selected */
    selectedItemsMap: Map<string, PickerItem<T>>;
    /**
     * Gives a way to tell the picker component that the map was modified externally and to update
     * the available/selected lists
     */
    selectedItemsMapChanged: Subject<void>;
    /**
     * AdvancedRowClickBehavior is disabled for ItemPicker.
     */
    readonly disableAdvancedRowClickBehavior: boolean;
    /** When true the user has opted to select all items across all pages. Due to api pagination
     *  we don't have all of the items locally, so the host will need to tell the API to operate on all
     *  via api filters or other means.
     */
    isSelectingAllItems: boolean;
}
export declare class ItemPickerComponent<T> implements OnInit, OnChanges, OnDestroy {
    private translateService;
    /** Identifier for the component. This will be added to the beginning of all internal action elements */
    id?: string;
    /** Title displayed above the available items table */
    availableTitle: string;
    /** Help popover next to the available title. If supplied will show, otherwise is hidden */
    availableTitleHelpPopover: string;
    /** Title displayed above the selected items list */
    selectedTitle: string;
    /** The type of item being selected. Ex. Meters, Addresses */
    itemName: string;
    /** Form group that is given to the internal Searchable Table */
    formModel?: UntypedFormGroup;
    /** Template for when a custom header is needed for the available items table */
    customAvailableHeaderTemplate?: TemplateRef<any>;
    /** Template for when a custom available item is needed. Default template is a label only */
    customAvailableItemTemplate?: TemplateRef<any>;
    /** Template for when a custom selected item is needed. Default template is a label only */
    customSelectedItemTemplate?: TemplateRef<any>;
    /** Used by the internal Searchable Table to know when the page is ready */
    ready?: Observable<void>;
    /** Used by Searchable Table to retrieve the available items */
    getItems?: (search?: string, pageChangeInfo?: PagingInfo) => Observable<TableSearchResults>;
    /** Used to maintain the available items checkbox selection as well as the selected items list */
    selectionContext: ItemPickerSelectableContext<T>;
    /** Used by the internal Searchable Table when there is no available items to choose from based on the getItems results. Do not supply
     *  to inherit the default message.
     */
    noDataMessage: string;
    /**
     * Used to override the default no selected items message. If provided this will be used, otherwise the default message with the item name
     * interpolation will be used.
     */
    noSelectedItemsMessage?: string;
    /** Used to enable select all items across pages. When true the button to select all items will be visible in the available items header when
     *  the header checkbox is checked and there are multiple pages of results
     */
    enableSelectAllItems: boolean;
    /** Used to display a message in the selected items table when the select all items button is clicked */
    selectAllItemsMessage: string;
    /** List of available items to pick from */
    availableItems: PickerItem[];
    /**
     * Selected items array. Created from the selected items map. Binding to the
     * map iterate values caused angular "expression changed" errors so after a map
     * update this gets set to the values
     */
    selectedItems: PickerItem[];
    /** True if there are selected items and at least one can be removed */
    selectedItemsClearable: boolean;
    /** Track by used for the searchable table rows */
    trackByIndex: (index: number) => number;
    tableStatus: Overlay;
    /** Text to display next to the checkbox in the available items header. Used to dislay how many items are
     *  selected when select all items is enabled
     */
    availableCheckboxText: string;
    /** When set to true the select all items button will show in the available items header. This is
     *  shown when the user has enabled select all for the item picker and the user selects the header checkbox
     *  with more than one page of results.
     */
    showSelectAllItemsButton: boolean;
    /** The total number of items returned from the api across all pages */
    totalItemsBeforePaging?: number;
    /** Passed to the searchable table control. Used to disable the pagination controls */
    disablePaginationControls?: boolean;
    /**
     * Template used to display the available and selected items as well as the available item header.
     * This will be set to the default template if a custom is not provided
     */
    internalizedAvailableHeaderTemplate: TemplateRef<any>;
    internalizedAvailableItemTemplate: TemplateRef<any>;
    internalizedSelectedItemTemplate: TemplateRef<any>;
    /** Default templates used if a custom template is not provided */
    private defaultAvailableHeaderTemplate;
    private defaultAvailableItemTemplate;
    private defaultSelectedItemTemplate;
    /** Used to shut down our subscriptions when the component is destroyed */
    private destroyed;
    constructor(translateService: TranslateService);
    ngOnInit(): void;
    /**
     * Watch for changes and react if the custom item template value changes
     */
    ngOnChanges(): void;
    ngOnDestroy(): void;
    /**
     * Called by the searchable table when a new set of items are returned from the getItems call.
     * If any of the items have `preventRemove` set, their indices are added to the context.
     */
    onItemsChange(results: TableSearchResults): void;
    /**
     * Called when the clear selection link button is clicked
     */
    onClearSelectionClick(): void;
    /**
     * Called when the remove item button is clicked for a selected item
     * @param removeItem
     */
    removeSelectedItem(removeItem: PickerItem): void;
    /**
     * Click handler for the select all items button
     */
    selectAllItems(): void;
    /**
     * Removes all items from the selected items map. This was split from the onClearSelectionClick function to allow
     * selectAllItems to call this function but keep the row checkbox values in place. This was needed because when you are
     * selecting all items across all pages we want the current page of items to remain checked.
     *
     */
    private clearSelectedItemsMap;
    /**
     * Watch for changes to the row checkboxes form array and update the selected items
     * list
     */
    private setupRowCheckboxesWatcher;
    private updateAvailableCheckboxText;
    /**
     * Watch to be told if changes to the map were made outside of the component and if so update
     * the array displayed in the selected list and select checkboxes for visible available items
     */
    private setupSelectedItemsChangedWatcher;
    private setInternalizedTemplates;
    static ɵfac: i0.ɵɵFactoryDeclaration<ItemPickerComponent<any>, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<ItemPickerComponent<any>, "ec-item-picker", never, { "id": { "alias": "id"; "required": false; }; "availableTitle": { "alias": "availableTitle"; "required": false; }; "availableTitleHelpPopover": { "alias": "availableTitleHelpPopover"; "required": false; }; "selectedTitle": { "alias": "selectedTitle"; "required": false; }; "itemName": { "alias": "itemName"; "required": false; }; "formModel": { "alias": "formModel"; "required": false; }; "customAvailableHeaderTemplate": { "alias": "customAvailableHeaderTemplate"; "required": false; }; "customAvailableItemTemplate": { "alias": "customAvailableItemTemplate"; "required": false; }; "customSelectedItemTemplate": { "alias": "customSelectedItemTemplate"; "required": false; }; "ready": { "alias": "ready"; "required": false; }; "getItems": { "alias": "getItems"; "required": false; }; "selectionContext": { "alias": "selectionContext"; "required": false; }; "noDataMessage": { "alias": "noDataMessage"; "required": false; }; "noSelectedItemsMessage": { "alias": "noSelectedItemsMessage"; "required": false; }; "enableSelectAllItems": { "alias": "enableSelectAllItems"; "required": false; }; "selectAllItemsMessage": { "alias": "selectAllItemsMessage"; "required": false; }; }, {}, never, never, false, never>;
}
