@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
33 lines (32 loc) • 1.8 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import { useAdaptable } from '../../../AdaptableContext';
import { OnePageAdaptableWizard } from '../../../Wizard/OnePageAdaptableWizard';
import { isSettingsValid, SettingsSection } from './SettingsSection';
import { ObjectTagsWizardSection, renderObjectTagsSummary, } from '../../../Wizard/ObjectTagsWizardSection';
import { Box } from '../../../../components/Flex';
export const AgChargingWizard = (props) => {
const adaptable = useAdaptable();
const [chartDefinition, setChartDefinition] = React.useState(() => {
return props.data ?? props.popupParams?.value;
});
const handleFinish = React.useCallback(() => {
adaptable.api.chartingApi.editChartDefinition(chartDefinition);
props.onFinishWizard(chartDefinition);
}, [chartDefinition]);
return (_jsx(OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: chartDefinition, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
{
title: 'Chart',
details: 'Configure chart properties and preview the result',
isValid: isSettingsValid,
render: () => (_jsx(SettingsSection, { chartDefinition: chartDefinition, onChange: setChartDefinition })),
},
{
details: 'Select Chart Tags',
title: 'Tags',
isVisible: () => adaptable.api.internalApi.shouldDisplayTagSections(),
render: () => (_jsx(Box, { className: "twa:p-2", children: _jsx(ObjectTagsWizardSection, { onChange: setChartDefinition }) })),
renderSummary: renderObjectTagsSummary,
},
] }));
};