@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
32 lines (31 loc) • 1.8 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard';
import { StyleComponent } from '../../Components/StyleComponent';
import { Box, Flex } from '../../../components/Flex';
import { Card } from '../../../components/Card';
import { FlashingCellStyle } from '../FlashingCellStyle';
const FLASH_STYLE_CARDS = [
{
key: 'UpChangeStyle',
title: 'Up Change Style',
description: 'Style applied when a cell value increases',
},
{
key: 'DownChangeStyle',
title: 'Down Change Style',
description: 'Style applied when a cell value decreases',
},
{
key: 'NeutralChangeStyle',
title: 'Neutral Change Style',
description: 'Style applied when a cell value changes but not up or down (e.g. text edits)',
},
];
export const FlashingAlertStyleWizardSection = (props) => {
let { data: flashingAlert, api } = useOnePageAdaptableWizardContext();
flashingAlert = flashingAlert ?? props.flashingAlert;
return (_jsx(Flex, { flexDirection: "column", className: "twa:gap-3 twa:p-3", children: FLASH_STYLE_CARDS.map(({ key, title, description }) => (_jsxs(Card, { shadow: false, children: [_jsxs(Card.Title, { children: [_jsx(Box, { className: "twa:font-medium", children: title }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:font-normal twa:max-w-[520px]", children: description })] }), _jsx(Card.Body, { children: _jsx(StyleComponent, { headless: true, api: api, Style: flashingAlert[key] ?? {}, UpdateStyle: (style) => props.onStyleChange(key, style) }) })] }, key))) }));
};
export const renderFlashingAlertStyleSummary = (flashingAlert) => {
return _jsx(FlashingCellStyle, { data: flashingAlert });
};