"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColumnMenuApiImpl = void 0;
const ApiBase_1 = require("./ApiBase");
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
class ColumnMenuApiImpl extends ApiBase_1.ApiBase {
    constructor(adaptable) {
        super(adaptable);
    }
    showColumnMenu(columnKey) {
        this.getAgGridApi().showColumnMenu(columnKey);
    }
    hideColumnMenu() {
        this.getAgGridApi().hidePopupMenu();
    }
    getColumnMenuItemsByCategory(category, context) {
        return context.defaultAdaptableMenuItems.filter((item) => item.category === category);
    }
    getColumnMenuItemsByCategories(categories, context) {
        return context.defaultAdaptableMenuItems.filter((item) => categories.includes(item.category));
    }
    createDefaultMenuStructure(context) {
        const test = [
            ...context.defaultAgGridMenuStructure,
            GeneralConstants_1.MENU_SEPARATOR,
            ...context.defaultAdaptableMenuStructure,
        ];
        return test;
    }
    getColumnMenuItemByName(menuItemName, context) {
        const openSettingsPanelMenuItem = context.defaultAdaptableMenuItems.find((item) => item.name === menuItemName);
        return openSettingsPanelMenuItem;
    }
    getColumnMenuItemsByNames(menuItemNames, context) {
        const menuItems = context.defaultAdaptableMenuItems.filter((item) => menuItemNames.includes(item.name));
        return menuItems;
    }
    getColumnMenuItemByLabel(label, context) {
        const menuItem = context.defaultAdaptableMenuItems.find((item) => item.label === label);
        return menuItem;
    }
    getColumnMenuItemsByLabels(labels, context) {
        const menuItems = context.defaultAdaptableMenuItems.filter((item) => labels.includes(item.label));
        return menuItems;
    }
    removeAdaptableColumnMenuItemByName(menuItemName, context) {
        const filteredMenuItems = context.defaultAdaptableMenuStructure.filter((item) => item !== '-' && item.name !== menuItemName);
        return filteredMenuItems;
    }
    removeAdaptableColumnMenuItemsByNames(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,
        };
    }
}
exports.ColumnMenuApiImpl = ColumnMenuApiImpl;
