"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateManagementViewPanel = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const join_1 = tslib_1.__importDefault(require("../../components/utils/join"));
const GeneralConstants = tslib_1.__importStar(require("../../Utilities/Constants/GeneralConstants"));
const LoadButton_1 = require("./components/LoadButton");
const ClearButton_1 = require("./components/ClearButton");
const rebass_1 = require("rebass");
const ExportDropdown_1 = require("./components/ExportDropdown");
const StateManagementViewPanel = (props) => {
    const isToolbar = props.viewType === 'Toolbar';
    const elementType = isToolbar ? 'DashboardToolbar' : 'ToolPanel';
    return (React.createElement(rebass_1.Flex, { flexDirection: isToolbar ? 'row' : 'column', className: (0, join_1.default)(props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__StateManagement__wrap`) },
        React.createElement(rebass_1.Flex, { flexDirection: "row" },
            React.createElement(LoadButton_1.LoadButton, { tooltip: "Load Predefined Config", variant: "text", icon: "upload", onLoad: (json) => props.api.configApi.reloadPredefinedConfig(json), accessLevel: props.accessLevel }, !isToolbar && 'Load'),
            React.createElement(ClearButton_1.ClearButton, { icon: "delete", tooltip: "Clear User State", variant: "text", onClick: () => props.api.configApi.reloadPredefinedConfig(), accessLevel: props.accessLevel }, !isToolbar && 'Clear')),
        React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "adaptableState" }, "All State"),
        React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "predefinedConfig" }, "Predefined Config")));
};
exports.StateManagementViewPanel = StateManagementViewPanel;
