"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EditCurrentLayoutButton = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
const AdaptableContext_1 = require("../AdaptableContext");
const isPivotLayout_1 = require("../../Utilities/isPivotLayout");
const EditCurrentLayoutButton = () => {
    const adaptable = (0, AdaptableContext_1.useAdaptable)();
    const handleClick = React.useCallback(() => {
        const currentLayout = adaptable.api.layoutApi.getCurrentLayout();
        const layoutName = currentLayout.Name;
        const type = (0, isPivotLayout_1.isPivotLayout)(currentLayout) ? 'pivot' : 'table';
        adaptable.api.layoutApi.showLayoutEditor(layoutName, type, 'Edit');
    }, []);
    return (React.createElement(SimpleButton_1.default, { className: "twa:ml-1", variant: "text", iconSize: 15, icon: "edit", onClick: handleClick }));
};
exports.EditCurrentLayoutButton = EditCurrentLayoutButton;
