"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DashboardViewPanelControl = void 0;
const tslib_1 = require("tslib");
const DashboardRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/DashboardRedux"));
const React = tslib_1.__importStar(require("react"));
const CheckBox_1 = require("../../components/CheckBox");
const react_redux_1 = require("react-redux");
const rebass_1 = require("rebass");
const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
class DashboardViewPanelComponent extends React.Component {
    constructor(props) {
        super(props);
    }
    render() {
        const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
        return (React.createElement(rebass_1.Flex, { flexDirection: "row", className: `ab-${elementType}__Dashboard__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
            ' ',
            ArrayExtensions_1.default.IsNotNullOrEmpty(this.props.api.dashboardApi.getDashboardState().Tabs) && (React.createElement(CheckBox_1.CheckBox, { className: `ab-${elementType}__Dashboard__collapsed-check`, marginTop: 0, fontSize: 2, padding: 1, checked: this.props.IsCollapsed, onChange: (checked) => this.props.onSetDashboardCollapsed(checked) }, "Collapse")),
            '',
            this.props.api.optionsApi.getDashboardOptions().canFloat && (React.createElement(CheckBox_1.CheckBox, { className: `ab-${elementType}__Dashboard__collapsed-check`, marginTop: 0, fontSize: 2, padding: 1, checked: this.props.IsFloating, onChange: (checked) => this.props.onSetDashboardFloating(checked) }, "Float")),
            ' ',
            React.createElement(CheckBox_1.CheckBox, { className: `ab-${elementType}__Dashboard__hidden-check`, marginTop: 0, fontSize: 2, padding: 1, checked: this.props.IsHidden, onChange: (checked) => this.props.onSetDashboardHidden(checked) }, "Hidden")));
    }
}
function mapStateToProps(state, ownProps) {
    return {
        IsCollapsed: state.Dashboard.IsCollapsed,
        IsHidden: state.Dashboard.IsHidden,
        IsFloating: state.Dashboard.IsFloating,
    };
}
function mapDispatchToProps(dispatch) {
    return {
        onSetDashboardCollapsed: (isCollapsed) => dispatch(DashboardRedux.DashboardSetIsCollapsed(isCollapsed)),
        onSetDashboardHidden: (isHidden) => dispatch(DashboardRedux.DashboardSetIsHidden(isHidden)),
        onSetDashboardFloating: (isFloating) => dispatch(DashboardRedux.DashboardSetIsFloating(isFloating)),
    };
}
exports.DashboardViewPanelControl = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(DashboardViewPanelComponent);
