"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 rebass_1 = require("rebass");
const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
const FlashingAlertScopeWizardSection = (props) => {
    const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
    const availableColumns = React.useMemo(() => api.columnApi.getNonSpecialColumns(), []);
    return (React.createElement(rebass_1.Flex, { flexDirection: "column", style: { height: '100%' }, padding: 2 },
        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 = Object.assign(Object.assign({}, 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;
