/*!
 * Copyright 2020-2021 VMware, Inc.
 * SPDX-License-Identifier: BSD-2-Clause
 */
import { EventEmitter, OnDestroy, TrackByFunction } from '@angular/core';
import { isObservable, Observable, Subscription } from 'rxjs';
import { ActionDisplayConfig, ActionItem, ActionStyling, ActionType, BaseActionItem } from '../common/interfaces';
import { lastAvailabilityValue } from '../constants';
import * as i0 from "@angular/core";
/**
 * To add default values to configs if they are not provided by the caller in the input config
 */
export declare function getDefaultActionDisplayConfig(cfg?: ActionDisplayConfig): ActionDisplayConfig;
/**
 * We internally convert the callbacks to booleans to avoid calling the callbacks all the time from template. However, we don't want to
 * allow callers to assign boolean variables to availability as there is no way to know when those variables can get updated from outside.
 */
interface ActionItemInternal<R, T> extends BaseActionItem<R, T> {
    /**
     * Used for determining where in the action menu this action gets displayed
     */
    actionType?: ActionType;
    /**
     * Condition whether or not the action is available.
     */
    availability?: Observable<boolean> | boolean;
    /**
     * Stores the last emitted value from availability observable of an action item. Used to show or hide that action item.
     */
    [lastAvailabilityValue]?: boolean;
}
/**
 * Renders actions in screens containing grids, cards and details container screens
 * R is the type of selected entity on which the action will be performed
 * T is the type of custom data passed to action handler methods
 */
export declare class ActionMenuComponent<R, T> implements OnDestroy {
    /**
     * To access the private key lastAvailabilityValue from the template
     */
    lastAvailabilityValue: symbol;
    /**
     * Stores all the subscriptions of availability observables. Used for un-subscribing from subscriptions that are not needed
     */
    lastAvailabilitySubscriptions: Subscription[];
    /**
     * Emits when the actions have been updated.
     * Then one can get the actual actions from {@link staticActions} and {@link contextualActions} property.
     */
    actionsUpdate: EventEmitter<void>;
    /**
     * List of actions containing both static and contextual that are given by the calling component
     */
    set actions(actions: ActionItem<R, T>[]);
    /**
     * Original actions as provided to this component without any modifications
     */
    private _originalActions;
    /**
     * Access modifier is public in order to access this property in unit tests
     */
    _actions: ActionItemInternal<R, T>[];
    private _actionDisplayConfig;
    /**
     * Display configuration of both static and contextual actions
     * If null or undefined is passed, default config {@link _actionDisplayConfig} is used
     */
    set actionDisplayConfig(config: ActionDisplayConfig);
    get actionDisplayConfig(): ActionDisplayConfig;
    /**
     * Copy of actions passed with their availability call backs. This is because, when the selected entities get updated, we need to use
     * those CBs to calculate the availability again
     */
    private actionsWithAvailabilityCb;
    /**
     * When there are no nested actions and if all of the contextual actions are marked to be featured, there is no need to show
     * the contextual actions dropdown in the inline actions container
     */
    shouldDisplayContextualActionsDropdownInline: boolean;
    /**
     * Text Content of the action menu dropdown trigger button. Used when {@link #actionDisplayConfig} styling is
     * {@link ActionStyling.DROPDOWN}
     */
    dropdownTriggerBtnText: string;
    /**
     * Text Content of the action menu dropdown trigger button inside the .inline-actions-container
     */
    inlineDropdownTriggerBtnText: string;
    /**
     * Icon of the action menu dropdown trigger button. Used when {@link #actionDisplayConfig} styling is
     * {@link ActionStyling.DROPDOWN}
     */
    dropdownTriggerBtnIcon: string;
    /**
     * Used for disabling the menu bar or menu dropdown
     */
    disabled: boolean;
    /**
     * The direction with respect to the root dropdown trigger button in which the root drop down should open
     * {@link DropdownComponent.dropdownPosition}
     */
    dropdownPosition: string;
    /**
     * The direction in which the nested drop downs open. {@link DropdownComponent.nestedDropdownPosition}
     */
    nestedDropdownPosition: string;
    /**
     * If a icon should be displayed inside contextual buttons
     */
    shouldShowIcon: boolean;
    /**
     * If a text should be displayed inside contextual buttons
     */
    shouldShowText: boolean;
    /**
     * If the contextual buttons with icons should have a tooltip
     */
    shouldShowTooltip: boolean;
    /**
     * Used in the html template
     */
    actionStyling: typeof ActionStyling;
    /**
     * List of actions that are marked as {@link ActionType.STATIC_FEATURED} only
     */
    staticFeaturedActions: ActionItemInternal<R, T>[];
    /**
     * Actions that depend on selected entities and belong to main menu list. The returned list length is less than or
     * equal to the configured featured count in {@link actionDisplayConfig}
     */
    contextualFeaturedActions: ActionItemInternal<R, T>[];
    /**
     * All the actions that depend on selected entities
     */
    contextualActions: ActionItemInternal<R, T>[];
    /**
     * List containing all the static actions. It has static featured actions in the beginning of the list followed by
     * non-featured static actions as children of grouped action called 'vcd.cc.action.menu.all.actions'
     */
    staticDropdownActions: ActionItemInternal<R, T>[] | object;
    /**
     * List of only the actions that are marked as {@link ActionType.STATIC}
     */
    staticActions: ActionItemInternal<R, T>[];
    /**
     * To show or hide the container elements containing inline and also dropdown actions
     */
    shouldDisplayActionsInline: boolean;
    /**
     * To show or hide {@link ActionType.CONTEXTUAL} and {@link ActionType.CONTEXTUAL_FEATURED} actions in inline
     * action container
     */
    shouldDisplayContextualActionsInline: boolean;
    /**
     * To show or hide {@link ActionType.STATIC_FEATURED} actions in inline action container
     */
    shouldDisplayStaticFeaturedActionsInline: boolean;
    /**
     * To show or hide {@link ActionType.STATIC} actions in inline action container
     */
    shouldDisplayStaticActionsInline: boolean;
    /**
     * To show or hide {@link ActionType.STATIC_FEATURED} and {@link ActionType.STATIC} actions in a dropdown
     */
    shouldDisplayStaticAndStaticFeaturedActionsDropdown: boolean;
    /**
     * To show or hide {@link ActionType.CONTEXTUAL} and {@link ActionType.CONTEXTUAL_FEATURED} actions in a dropdown
     */
    shouldDisplayContextualActionsDropdown: boolean;
    /**
     * Used for deciding if the availability has to be passed through an Async pipe in the template
     */
    isObservable: typeof isObservable;
    /**
     * The list of entities selected on which contextualActions are performed. As they are also used for calculating the
     * availability of actions, action lists are updated when the input is updated
     * @param val Is an array in case of batch selection and is a single item for example in the case of data grids with single selection
     */
    set selectedEntities(val: R[] | R);
    private _selectedEntities;
    /**
     * Returns the selected entities
     * Note: This is not a getter because its matching setter can accept an array or a single item but this method always returns an array.
     */
    getSelectedEntities(): R[];
    /**
     * The visibility of actions is dependent on their availability call back responses and in VCD application, some of the actions
     * availability call back response is dependent on closure variables. However, we don't call those call backs every time those closure
     * variables are updated, for example by asynchronous requests. This has a side effect of actions visibility not getting updated when
     * those closure variables are updated. So, this convenience method is to make it clear for the user that such side effect exists and
     * this method will re-trigger the availability call backs of actions
     */
    updateDisplayedActions(): void;
    private refreshActions;
    private markUnmarkedActions;
    /**
     * Executes the availability call backs and updates them to booleans. Also, Subscribes to availability of actions that are observables
     * and adds a magic property called {@link lastAvailabilityValue} that stores the last emitted value from those observables.
     */
    private changeAvailabilityCallbacks;
    private clearLastAvailabilitySubs;
    private updateActionListsAndDisplayFlags;
    private updateActionDisplayFlags;
    /**
     * Used only for actions that don't have their availability as Observables.
     * An action whose availability is false but has the disabled state set to true is still shown on the screen in
     * disabled mode
     */
    private isActionAvailable;
    private getStaticFeaturedActions;
    private getContextualFeaturedActions;
    private getStaticActions;
    private getStaticDropdownActions;
    private getContextualActions;
    /**
     * Extracts the nested actions that are marked as featured and returns them as part of a flat list
     */
    private getFlattenedActionList;
    /**
     * Action click handler
     */
    runActionHandler(action: ActionItem<R, T>): void;
    /**
     * To disable a displayed action
     */
    isActionDisabled(action: ActionItem<R, T> | ActionItemInternal<R, T>): boolean;
    /**
     * Used as {@link ngForTrackBy} input value when iterating over action lists {@link DropdownComponent.trackByFunction}
     * Without this method as input for ngForTrackBy, the dropdown gets rendered off screen
     */
    actionsTrackBy: TrackByFunction<ActionItem<R, T>>;
    private getShouldDisplayActionsInline;
    private shouldDisplayStaticFeaturedActions;
    private shouldDisplayStaticActions;
    private shouldDisplayContextualActions;
    /**
     * Performance optimization function to do shallow comparison of two arrays.
     * @param arr1
     * @param arr2
     */
    private isShallowEqual;
    ngOnDestroy(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<ActionMenuComponent<any, any>, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<ActionMenuComponent<any, any>, "vcd-action-menu", never, { "actions": "actions"; "actionDisplayConfig": "actionDisplayConfig"; "dropdownTriggerBtnText": "dropdownTriggerBtnText"; "dropdownTriggerBtnIcon": "dropdownTriggerBtnIcon"; "disabled": "disabled"; "dropdownPosition": "dropdownPosition"; "nestedDropdownPosition": "nestedDropdownPosition"; "selectedEntities": "selectedEntities"; }, { "actionsUpdate": "actionsUpdate"; }, never, never, false, never>;
}
export {};
