"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterFormPanel = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const rebass_1 = require("rebass");
const Enums_1 = require("../../../PredefinedConfig/Common/Enums");
const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
class FilterFormPanel extends React.Component {
    render() {
        const header = (React.createElement(rebass_1.Flex, { alignItems: "center", flexDirection: "row", style: { width: '100%' } },
            this.props.IsAlwaysFilter ? (React.createElement(rebass_1.Flex, { flex: 6, marginRight: 2 }, "Filter")) : (React.createElement(rebass_1.Flex, { flex: 6, flexDirection: "column" },
                React.createElement(rebass_1.Flex, null,
                    React.createElement(rebass_1.Flex, { flex: 6 },
                        React.createElement(Radio_1.default, { value: "Menu", checked: this.props.ColumnMenuTab == Enums_1.ColumnMenuTab.Menu, onChange: () => this.onSelectMenu() }, "Menu")),
                    React.createElement(rebass_1.Flex, { flex: 6 },
                        React.createElement(Radio_1.default, { value: "Filter", checked: this.props.ColumnMenuTab == Enums_1.ColumnMenuTab.Filter, onChange: () => this.onSelectFilter() }, "Filter"))))),
            this.props.clearFilterButton &&
                this.props.ColumnMenuTab == Enums_1.ColumnMenuTab.Filter &&
                this.props.clearFilterButton,
            this.props.saveButton &&
                this.props.ColumnMenuTab == Enums_1.ColumnMenuTab.Filter &&
                this.props.saveButton));
        return (React.createElement(rebass_1.Flex, { flexDirection: "column" },
            React.createElement(Panel_1.default, { className: "ab-FilterFormPanel", header: header, headerProps: { padding: 1 }, style: Object.assign(Object.assign({}, this.props.style), { flex: 1 }), bodyProps: { padding: 0, style: { maxHeight: '50vh' } }, bodyScroll: true, borderRadius: 0, border: "none" }, this.props.children),
            this.props.autoApplyFilter ? null : (React.createElement(rebass_1.Flex, { flex: "none", flexDirection: "row", padding: 1, justifyContent: "flex-end" },
                React.createElement(SimpleButton_1.default, { variant: "raised", tone: "accent", disabled: this.props.applyFilterButtonDisabled, onClick: () => this.onApplyFilterClicked() }, "Apply Filter")))));
    }
    onApplyFilterClicked() {
        this.props.onColumnFilterApplied();
    }
    onSelectMenu() {
        this.props.ColumnMenuTabChanged(Enums_1.ColumnMenuTab.Menu);
    }
    onSelectFilter() {
        this.props.ColumnMenuTabChanged(Enums_1.ColumnMenuTab.Filter);
    }
}
exports.FilterFormPanel = FilterFormPanel;
