"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlashingAlertScopeWizardSection = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
const Flex_1 = require("../../../components/Flex");
const FlashingAlertScopeWizardSection = (props) => {
    const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
    const availableColumns = React.useMemo(() => api.columnApi.getNonSpecialColumns(), []);
    return (React.createElement(Flex_1.Flex, { flexDirection: "column", className: "twa:p-2 twa:h-full" },
        React.createElement(NewScopeComponent_1.NewScopeComponent, { descriptions: {
                rowScope: 'Changes anywhere in the row will trigger an Flashing Cell',
                columnScope: 'Changes in selected columns will trigger an Flashing Cell',
            }, scopeColumns: availableColumns, scope: data.Scope, updateScope: (Scope) => {
                const newData = { ...data, Scope };
                if (newData.Rule.Predicates) {
                    // when scope is changed, reset the rule to predicate of AnyChange
                    // if it was set to a predicate before
                    newData.Rule = {
                        Predicates: [{ PredicateId: 'AnyChange' }],
                    };
                }
                props.onChange(newData);
            } })));
};
exports.FlashingAlertScopeWizardSection = FlashingAlertScopeWizardSection;
