@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
24 lines (23 loc) • 2.61 kB
JavaScript
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import Input from '../../../../components/Input';
import { Tag } from '../../../../components/Tag';
import { TypeRadio } from '../../../Wizard/TypeRadio';
import { useOnePageAdaptableWizardContext } from '../../../Wizard/OnePageAdaptableWizard';
import { isPivotLayout } from '../../../../Utilities/isPivotLayout';
import { Box, Flex } from '../../../../components/Flex';
import { Card } from '../../../../components/Card';
export const SettingsSectionSummary = () => {
const { data: layout } = useOnePageAdaptableWizardContext();
const isPivot = isPivotLayout(layout);
return (_jsxs(Box, { children: [_jsxs(Tag, { className: "twa:mr-2", children: ["Layout Name: ", layout.Name] }), _jsxs(Tag, { className: "twa:mr-2", children: ["Layout Grid Type: ", isPivot ? 'Pivot' : 'Table'] }), _jsxs(Tag, { className: "twa:mr-2", children: ["Suppress Aggregation Function in Column Header:", ' ', layout.SuppressAggFuncInHeader ? 'Yes' : 'No'] })] }));
};
export const SettingsSection = (props) => {
const { data: layout } = useOnePageAdaptableWizardContext();
const onNameChange = (event) => {
props.onChange({
...layout,
Name: event.target.value,
});
};
return (_jsxs(Flex, { flexDirection: "column", className: "twa:gap-3 twa:p-3", 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 this Layout" })] }), _jsx(Card.Body, { className: "twa:p-1", children: _jsx(Input, { className: "twa:max-w-[300px] twa:w-full", "data-name": "layout-name", onChange: onNameChange, value: layout?.Name ?? '' }) })] }), _jsxs(Card, { shadow: false, children: [_jsx(Card.Title, { children: _jsx(Box, { className: "twa:font-medium", children: "Grid Type" }) }), _jsx(Card.Body, { className: "twa:p-1", children: _jsxs(Flex, { flexDirection: "column", className: "twa:gap-2", children: [_jsx(Box, { "data-name": "layout-type-table", children: _jsx(TypeRadio, { disabled: true, checked: !isPivotLayout(layout), text: "Table", description: "A flat layout \u2014 data is shown in standard rows and columns, one row per record" }) }), _jsx(Box, { "data-name": "layout-type-pivot", children: _jsx(TypeRadio, { disabled: true, checked: isPivotLayout(layout), text: "Pivot", description: "An aggregated layout \u2014 data is grouped and summarized by pivot columns" }) })] }) })] })] }));
};