UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

36 lines (35 loc) 1.31 kB
import * as React from 'react'; import DropdownButton from '../../../components/DropdownButton'; import { handleExportState } from '../handleExportState'; export const ExportDropdown = (props) => { const handleChange = (destination) => { switch (props.type) { case 'adaptableState': const adaptableState = props.api.stateApi.getPersistedState(); handleExportState(destination, 'adaptableState', adaptableState); break; case 'initialState': const initialState = props.api.stateApi.getInitialState(); handleExportState(destination, 'initialState', initialState); 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, { className: "ab-StateManagement__Export-Dropdown", ...props, items: destinationOptions, value: undefined })); };