@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
17 lines (16 loc) • 1.88 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { validateChartName } from '../../../../Utilities/Helpers/ChartHelper';
import { Box, Flex } from '../../../../components/Flex';
import { Card } from '../../../../components/Card';
import Input from '../../../../components/Input';
import { PreviewChartSection } from './PreviewChartSection';
export const isSettingsValid = (chartDefinition, api) => {
return validateChartName(api, chartDefinition.Name, chartDefinition.Uuid);
};
export const SettingsSection = (props) => {
const { chartDefinition, onChange, showPreview } = props;
return (_jsxs(Flex, { flexDirection: "column", className: "twa:gap-3 twa:p-3 twa:h-full twa:min-h-0", children: [_jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Name" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Provide a unique name for the chart" })] }), _jsx(Card.Body, { className: "twa:p-1", children: _jsx(Input, { "data-name": "chart-name", className: "twa:max-w-[300px] twa:w-full", value: chartDefinition.Name ?? '', placeholder: "Enter chart name", onChange: (event) => onChange({
...chartDefinition,
Name: event.target.value,
}) }) })] }), showPreview ? (_jsxs(Card, { shadow: false, className: "twa:flex-1 twa:min-h-0", children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: "Preview" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: "Live preview of the external chart" })] }), _jsx(Card.Body, { className: "twa:flex-1 twa:min-h-[280px]", children: _jsx(PreviewChartSection, { chartDefinition: chartDefinition }) })] })) : null] }));
};