@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
41 lines (40 loc) • 1.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExportDropdown = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const DropdownButton_1 = tslib_1.__importDefault(require("../../../components/DropdownButton"));
const handleExportState_1 = require("../handleExportState");
const ExportDropdown = (props) => {
const handleChange = (destination) => {
switch (props.type) {
case 'adaptableState':
const adaptableState = props.api.stateApi.getPersistentState();
(0, handleExportState_1.handleExportState)(destination, 'adaptableState', adaptableState, props.api);
break;
case 'initialState':
const initialState = props.api.stateApi.getInitialState();
(0, handleExportState_1.handleExportState)(destination, 'initialState', initialState, props.api);
break;
}
};
const destinationOptions = [
{
value: 'Clipboard',
label: 'Clipboard',
onClick: () => handleChange('Clipboard'),
},
{
value: 'Console',
label: 'Console',
onClick: () => handleChange('Console'),
},
{
value: 'JSON',
label: 'JSON',
onClick: () => handleChange('JSON'),
},
];
return (React.createElement(DropdownButton_1.default, { className: "ab-StateManagement__Export-Dropdown", ...props, items: destinationOptions, value: undefined }));
};
exports.ExportDropdown = ExportDropdown;