"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateManagementPopup = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const PopupPanel_1 = require("../Components/Popups/AdaptablePopup/PopupPanel");
const HelpBlock_1 = tslib_1.__importDefault(require("../../components/HelpBlock"));
const LoadButton_1 = require("./components/LoadButton");
const ClearButton_1 = require("./components/ClearButton");
const ExportDropdown_1 = require("./components/ExportDropdown");
const Panel_1 = tslib_1.__importDefault(require("../../components/Panel"));
const StateManagementPopup = (props) => {
    const baseClassName = 'ab-ManageState';
    return (React.createElement(PopupPanel_1.PopupPanel, { className: baseClassName, headerText: props.moduleInfo.FriendlyName, glyphicon: props.moduleInfo.Glyph, infoLink: props.moduleInfo.HelpPage, infoLinkDisabled: !props.api.internalApi.isDocumentationLinksDisplayed() },
        React.createElement(Panel_1.default, { className: `${baseClassName}__panel twa:mr-2 twa:mb-2 twa:h-auto twa:rounded-none`, "data-name": "user-state", header: 'User State', variant: "default" },
            React.createElement(HelpBlock_1.default, { className: "twa:mb-2" }, 'Clear all current user state that has been persisted'),
            React.createElement(HelpBlock_1.default, { style: { color: 'var(--ab-color-warn)' } }, 'This will cause this window to close and any State you have previously created will be lost, and the Initial Adaptable State will be reapplied'),
            React.createElement(ClearButton_1.ClearButton, { "data-name": "clear-user-state-button", tone: "info", variant: "raised", className: "twa:mt-2", accessLevel: props.accessLevel, onClick: () => props.api.stateApi.reloadInitialState() }, "Clear User State")),
        React.createElement(Panel_1.default, { className: `${baseClassName}__panel twa:mt-3 twa:mr-2 twa:mb-2 twa:h-auto twa:rounded-none`, "data-name": "initial-state", header: 'Initial Adaptable State', variant: "default" },
            React.createElement(HelpBlock_1.default, { className: "twa:mt-2" }, 'Load Initial Adaptable State (from a .json file) - this will cause this window to close'),
            ' ',
            React.createElement(LoadButton_1.LoadButton, { tone: "info", variant: "raised", className: "twa:mt-2", accessLevel: props.accessLevel, onLoad: (json) => props.api.stateApi.reloadInitialState(json), "data-name": "load-initial-state-button" }, "Load Initial Adaptable State")),
        React.createElement(Panel_1.default, { className: `${baseClassName}__panel twa:mt-3 twa:mr-2 twa:mb-2 twa:h-auto twa:rounded-none`, "data-name": "adaptable-state", header: 'Export Adaptable State' },
            React.createElement(HelpBlock_1.default, { className: "twa:my-2" }, 'Exports the currently persisted Adaptable State'),
            ' ',
            React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "adaptableState", className: "twa:mr-3 twa:flex-1 twa:max-w-none", columns: ['label'], "data-name": "export-adaptable-state-dropdown" }, "Select Export Destination")),
        React.createElement(Panel_1.default, { className: `${baseClassName}__panel twa:mt-3 twa:mr-2 twa:mb-2 twa:h-auto twa:rounded-none`, "data-name": "initial-state", header: 'Export Initial Adaptable State', variant: "default" },
            React.createElement(HelpBlock_1.default, { className: "twa:my-2" }, 'Exports the Initial Adaptable State which was provided at design time'),
            ' ',
            React.createElement(ExportDropdown_1.ExportDropdown, { api: props.api, type: "initialState", className: "twa:mr-3 twa:flex-1 twa:max-w-none", columns: ['label'], "data-name": "export-initial-state-dropdown" }, "Select Export Destination"))));
};
exports.StateManagementPopup = StateManagementPopup;
