"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormatColumnRowScopeWizardSection = exports.renderFormatColumnRowScopeSummary = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
const CheckBox_1 = require("../../../components/CheckBox");
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
const Tag_1 = require("../../../components/Tag");
const Flex_1 = require("../../../components/Flex");
const Tabs_1 = require("../../../components/Tabs");
const renderFormatColumnRowScopeSummary = (data) => {
    return (React.createElement(Flex_1.Box, { className: "twa:p-2" },
        React.createElement(Flex_1.Box, { className: "twa:mt-3" },
            "Data Rows ",
            React.createElement(Tag_1.Tag, null, data.RowScope?.ExcludeDataRows ? 'no' : 'yes')),
        ' ',
        React.createElement(Flex_1.Box, { className: "twa:mt-3" },
            "Group Rows ",
            React.createElement(Tag_1.Tag, null, data.RowScope?.ExcludeGroupRows ? 'no' : 'yes')),
        React.createElement(Flex_1.Box, { className: "twa:mt-3" },
            "Summary Rows ",
            React.createElement(Tag_1.Tag, null, data.RowScope?.ExcludeSummaryRows ? 'no' : 'yes')),
        React.createElement(Flex_1.Box, { className: "twa:mt-3" },
            "Total Rows ",
            React.createElement(Tag_1.Tag, null, data.RowScope?.ExcludeTotalRows ? 'no' : 'yes'))));
};
exports.renderFormatColumnRowScopeSummary = renderFormatColumnRowScopeSummary;
const FormatColumnRowScopeWizardSection = (props) => {
    const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
    const onExcludeDataRowsChanged = (includeDataRows) => {
        props.onChange({
            ...data,
            RowScope: {
                ...data.RowScope,
                ExcludeDataRows: !includeDataRows,
            },
        });
    };
    const onExcludeGroupedRowsChanged = (includeGroupedRows) => {
        props.onChange({
            ...data,
            RowScope: {
                ...data.RowScope,
                ExcludeGroupRows: !includeGroupedRows,
            },
        });
    };
    const onExcludeSummaryRowsChanged = (includeSummaryRows) => {
        props.onChange({
            ...data,
            RowScope: {
                ...data.RowScope,
                ExcludeSummaryRows: !includeSummaryRows,
            },
        });
    };
    const onExcludeTotalRowsChanged = (includeTotalRows) => {
        props.onChange({
            ...data,
            RowScope: {
                ...data.RowScope,
                ExcludeTotalRows: !includeTotalRows,
            },
        });
    };
    return (React.createElement(Flex_1.Flex, { flexDirection: "column", style: { height: '100%' } },
        React.createElement(Tabs_1.Tabs, { className: "twa:mb-3" },
            React.createElement(Tabs_1.Tabs.Tab, null, "Row Types"),
            React.createElement(Tabs_1.Tabs.Content, null,
                React.createElement(Flex_1.Flex, { flexDirection: "row" },
                    React.createElement(FormLayout_1.default, null, data.Target === 'cell' && (React.createElement(React.Fragment, null,
                        React.createElement(FormLayout_1.FormRow, { label: "Data (leaf) Rows:" },
                            React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
                                React.createElement(CheckBox_1.CheckBox, { "data-name": "include-data-rows-checkbox", checked: !data.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged, className: "twa:mr-2" }))),
                        React.createElement(FormLayout_1.FormRow, { label: "Group Rows:" },
                            React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
                                React.createElement(CheckBox_1.CheckBox, { "data-name": "include-grouped-rows-checkbox", checked: !data.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged, className: "twa:mr-2" }))),
                        React.createElement(FormLayout_1.FormRow, { label: "Summary Rows:" },
                            React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
                                React.createElement(CheckBox_1.CheckBox, { "data-name": "include-summary-rows-checkbox", checked: !data.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged, className: "twa:mr-2" }))),
                        React.createElement(FormLayout_1.FormRow, { label: "Total Rows:" },
                            React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
                                React.createElement(CheckBox_1.CheckBox, { "data-name": "include-total-rows-checkbox", checked: !data.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged, className: "twa:mr-2" })))))))))));
};
exports.FormatColumnRowScopeWizardSection = FormatColumnRowScopeWizardSection;
