"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormatColumnRuleWizardSection = FormatColumnRuleWizardSection;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock"));
function FormatColumnRuleWizardSection(props) {
    const { data, api, moduleInfo } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
    if (data.Target && data.Target === 'columnHeader') {
        return (React.createElement(HelpBlock_1.default, { className: "twa:mt-3" }, "Conditions cannot be applied if the Target of the Format Column is Column Header"));
    }
    return (React.createElement(EntityRulesEditor_1.EntityRulesEditor, { module: moduleInfo.ModuleName, defaultPredicateId: props.defaultPredicateId, 
        // TODO see what is this
        predicateDefs: api.formatColumnApi.internalApi.getFormatColumnDefsForScope(data.Scope), getPredicateDefsForColId: (colId) => api.formatColumnApi.internalApi.getFormatColumnDefsForScope({ ColumnIds: [colId] }), showNoRule: true, showBoolean: true, showAggregation: false, showObservable: false, showQueryBuilder: true, showPredicate: !api.columnScopeApi.scopeIsAll(data.Scope), data: data, onChange: (formatColumn) => props.onChange(formatColumn), descriptions: {
            selectPredicate: 'Create a Format Column Rule - to be applied when data changes',
            useBooleanQuery: (React.createElement(React.Fragment, null,
                "Use an BooleanQuery if ",
                React.createElement("i", null, "Scope"),
                " is 'All Columns' - so any data change may be evaluated in a complex BooleanExpression")),
            useObservableQuery: (React.createElement(React.Fragment, null,
                "Use an ObservableQuery if ",
                React.createElement("i", null, "Scope"),
                " is 'All Columns' - so any data change may be evaluated in a complex ObservableExpression")),
            useAggregationQuery: (React.createElement(React.Fragment, null,
                "Use an AggregatedBooleanQuery if ",
                React.createElement("i", null, "Scope"),
                " is 'All Columns' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
        } }));
}
