"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StyledColumnBadgeRowsSection = exports.renderStyledColumnBadgeRowsSummary = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const CheckBox_1 = require("../../../components/CheckBox");
const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
const Tabs_1 = require("../../../components/Tabs");
const Tag_1 = require("../../../components/Tag");
const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
const Flex_1 = require("../../../components/Flex");
const renderStyledColumnBadgeRowsSummary = (data) => {
    const badgeStyle = 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, badgeStyle.RowScope?.ExcludeDataRows ? 'no' : 'yes')),
        ' ',
        React.createElement(Flex_1.Box, { className: "twa:mt-3" },
            "Group Rows ",
            React.createElement(Tag_1.Tag, null, badgeStyle.RowScope?.ExcludeGroupRows ? 'no' : 'yes')),
        React.createElement(Flex_1.Box, { className: "twa:mt-3" },
            "Summary Rows ",
            React.createElement(Tag_1.Tag, null, badgeStyle.RowScope?.ExcludeSummaryRows ? 'no' : 'yes')),
        React.createElement(Flex_1.Box, { className: "twa:mt-3" },
            "Total Rows ",
            React.createElement(Tag_1.Tag, null, badgeStyle.RowScope?.ExcludeTotalRows ? 'no' : 'yes'))));
};
exports.renderStyledColumnBadgeRowsSummary = renderStyledColumnBadgeRowsSummary;
const StyledColumnBadgeRowsSection = (props) => {
    const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
    const onExcludeDataRowsChanged = (includeDataRows) => {
        props.onChange({
            ...data,
            BadgeStyle: {
                ...data.BadgeStyle,
                RowScope: {
                    ...data.BadgeStyle.RowScope,
                    ExcludeDataRows: !includeDataRows,
                },
            },
        });
    };
    const onExcludeGroupedRowsChanged = (includeGroupedRows) => {
        props.onChange({
            ...data,
            BadgeStyle: {
                ...data.BadgeStyle,
                RowScope: {
                    ...data.BadgeStyle.RowScope,
                    ExcludeGroupRows: !includeGroupedRows,
                },
            },
        });
    };
    const onExcludeSummaryRowsChanged = (includeSummaryRows) => {
        props.onChange({
            ...data,
            BadgeStyle: {
                ...data.BadgeStyle,
                RowScope: {
                    ...data.BadgeStyle.RowScope,
                    ExcludeSummaryRows: !includeSummaryRows,
                },
            },
        });
    };
    const onExcludeTotalRowsChanged = (includeTotalRows) => {
        props.onChange({
            ...data,
            BadgeStyle: {
                ...data.BadgeStyle,
                RowScope: {
                    ...data.BadgeStyle.RowScope,
                    ExcludeTotalRows: !includeTotalRows,
                },
            },
        });
    };
    return (React.createElement(Tabs_1.Tabs, null,
        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,
                    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": "exclude-data-rows-checkbox", className: "twa:mr-2", checked: 
                                // @ts-ignore
                                !data.BadgeStyle.RowScope?.ExcludeDataRows, onChange: onExcludeDataRowsChanged }))),
                    React.createElement(FormLayout_1.FormRow, { label: "Group Rows:" },
                        React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:ml-2" },
                            React.createElement(CheckBox_1.CheckBox, { className: "twa:mr-2", "data-name": "exclude-grouped-rows-checkbox", checked: 
                                // @ts-ignore
                                !data.BadgeStyle.RowScope?.ExcludeGroupRows, onChange: onExcludeGroupedRowsChanged }))),
                    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": "exclude-summary-rows-checkbox", className: "twa:mr-2", checked: 
                                // @ts-ignore
                                !data.BadgeStyle.RowScope?.ExcludeSummaryRows, onChange: onExcludeSummaryRowsChanged }))),
                    ' ',
                    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": "exclude-total-rows-checkbox", className: "twa:mr-2", checked: 
                                // @ts-ignore
                                !data.BadgeStyle.RowScope?.ExcludeTotalRows, onChange: onExcludeTotalRowsChanged }))))))));
};
exports.StyledColumnBadgeRowsSection = StyledColumnBadgeRowsSection;
