@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
47 lines (46 loc) • 2.58 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgChargingWizard = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const rebass_1 = require("rebass");
const AdaptableContext_1 = require("../../../AdaptableContext");
const OnePageAdaptableWizard_1 = require("../../../Wizard/OnePageAdaptableWizard");
const PreviewChartSection_1 = require("./PreviewChartSection");
const SettingsSection_1 = require("./SettingsSection");
const ObjectTagsWizardSection_1 = require("../../../Wizard/ObjectTagsWizardSection");
const AgChargingWizard = (props) => {
const adaptable = (0, AdaptableContext_1.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 (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: chartDefinition, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
{
title: 'Settings',
details: 'Chart Settings',
isValid: SettingsSection_1.isSettingsValid,
render: () => (React.createElement(rebass_1.Box, { padding: 2 },
React.createElement(SettingsSection_1.SettingsSection, { chartDefinition: chartDefinition, onChange: setChartDefinition }))),
},
{
details: 'Select Chart Tags',
title: 'Tags',
isVisible: () => adaptable.api.internalApi.shouldDisplayTagSections(),
render: () => (React.createElement(rebass_1.Box, { padding: 2 },
React.createElement(ObjectTagsWizardSection_1.ObjectTagsWizardSection, { onChange: setChartDefinition }))),
renderSummary: ObjectTagsWizardSection_1.renderObjectTagsSummary,
},
'-',
{
title: 'Preview Chart',
details: 'Chart Preview',
render: () => (React.createElement(rebass_1.Box, { p: 2 },
React.createElement(PreviewChartSection_1.PreviewChartSection, { chartDefinition: chartDefinition, onChange: setChartDefinition }))),
},
] }));
};
exports.AgChargingWizard = AgChargingWizard;