UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

33 lines (32 loc) 2.78 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import * as React from 'react'; import { NewScopeComponent } from '../../Components/NewScopeComponent'; import { useOnePageAdaptableWizardContext } from '../../Wizard/OnePageAdaptableWizard'; import { Box, Flex } from '../../../components/Flex'; import { isScopeColumnIds } from '../../../AdaptableState/Common/ColumnScope'; export const FlashingAlertScopeWizardSection = (props) => { const { data, api } = useOnePageAdaptableWizardContext(); const availableColumns = React.useMemo(() => api.columnApi .getUIAvailableColumns() .filter((column) => !column.isActionColumn && !api.columnApi.isFdc3Column(column.columnId)), [api]); return (_jsxs(Flex, { flexDirection: "column", className: "twa:h-full", children: [_jsxs(Flex, { flexDirection: "row", alignItems: "center", className: "twa:p-2 twa:gap-3 twa:border-b twa:mb-2 twa:border-b-foreground/20", children: [_jsx(Box, { className: "twa:text-5 twa:font-medium", children: "Columns" }), _jsx(Box, { className: "twa:text-xs twa:opacity-70 twa:max-w-[520px]", children: "Specify which data changes should trigger cell flashing" })] }), _jsx(Box, { className: "twa:flex-1 twa:min-h-0 twa:overflow-auto twa:p-2", children: _jsx(NewScopeComponent, { descriptions: { rowScope: 'Changes anywhere in the row will trigger a Flashing Cell', columnScope: 'Changes in selected columns will trigger a Flashing Cell', dataTypeScope: 'Changes in columns with these Data Types will trigger a Flashing Cell', }, scopeColumns: availableColumns, scope: data.Scope, updateScope: (Scope) => { const newData = { ...data, Scope }; if (newData.Rule.Predicates) { const validPredicateIds = new Set(api.flashingCellApi.getFlashingCellPredicateDefsForScope(Scope).map((def) => def.id)); newData.Rule = { Predicates: newData.Rule.Predicates.filter((p) => validPredicateIds.has(p.PredicateId)).filter((predicate) => { if (isScopeColumnIds(Scope) && Scope.ColumnIds.length > 1) { return predicate.PredicateId !== 'In' && predicate.PredicateId !== 'NotIn'; } return true; }), }; } props.onChange(newData); } }) })] })); }; export { FlashingCellScopeSummaryContent, FlashingCellScopeSummaryView, renderFlashingCellScopeSummary, } from './FlashingCellScopeSummary';