"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShortcutScopeWizardSection = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
const ShortcutScopeWizardSection = (props) => {
    const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
    const availableColumns = React.useMemo(() => api.columnApi.getNumericColumns(), []);
    return (React.createElement(NewScopeComponent_1.NewScopeComponent, { availableDataTypes: ['number'], scopeColumns: availableColumns, scope: data.Scope, descriptions: {
            rowScope: 'All Numeric Columns will have the Shortcut applied',
            columnScope: 'Selected Columns will have the Shortcut applied',
        }, updateScope: (Scope) => {
            let preparedScope = Scope;
            if (Scope && 'DataTypes' in Scope && Scope.DataTypes.length === 0) {
                // default to checked
                preparedScope = {
                    ...Scope,
                    DataTypes: ['number'],
                };
            }
            props.onChange({
                ...data,
                Scope: preparedScope,
            });
        } }));
};
exports.ShortcutScopeWizardSection = ShortcutScopeWizardSection;
