import { ApiBase } from './ApiBase';
import { MENU_SEPARATOR } from '../../Utilities/Constants/GeneralConstants';
export class ContextMenuApiImpl extends ApiBase {
    constructor(adaptable) {
        super(adaptable);
    }
    hideContextMenu() {
        this.getAgGridApi().hidePopupMenu();
    }
    getContextMenuItemsByCategory(category, context) {
        return context.defaultAdaptableMenuItems.filter((item) => item.category === category);
    }
    getContextMenuItemsByCategories(categories, context) {
        return context.defaultAdaptableMenuItems.filter((item) => categories.includes(item.category));
    }
    createDefaultMenuStructure(context) {
        const test = [
            ...context.defaultAgGridMenuStructure,
            MENU_SEPARATOR,
            ...context.defaultAdaptableMenuStructure,
        ];
        return test;
    }
    getContextMenuItemByName(menuItemName, context) {
        const openSettingsPanelMenuItem = context.defaultAdaptableMenuItems.find((item) => item.name === menuItemName);
        return openSettingsPanelMenuItem;
    }
    getContextMenuItemsByNames(menuItemNames, context) {
        const menuItems = context.defaultAdaptableMenuItems.filter((item) => menuItemNames.includes(item.name));
        return menuItems;
    }
    getContextMenuItemByLabel(label, context) {
        const menuItem = context.defaultAdaptableMenuItems.find((item) => item.label === label);
        return menuItem;
    }
    getContextMenuItemsByLabels(labels, context) {
        const menuItems = context.defaultAdaptableMenuItems.filter((item) => labels.includes(item.label));
        return menuItems;
    }
    removeAdaptableContextMenuItemByName(menuItemName, context) {
        const filteredMenuItems = context.defaultAdaptableMenuStructure.filter((item) => item !== '-' && item.name !== menuItemName);
        return filteredMenuItems;
    }
    removeAdaptableContextMenuItemsByNames(menuItemNames, context) {
        const filteredMenuItems = context.defaultAdaptableMenuStructure.filter((item) => item !== '-' && !menuItemNames.includes(item.name));
        return filteredMenuItems;
    }
    createGroupMenu(label, subMenuItems, disabled, icon) {
        return {
            menuType: 'Group',
            label: label,
            subMenuItems: subMenuItems,
            disabled: disabled,
            icon: icon,
        };
    }
}
