UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

32 lines (31 loc) 2.36 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import * as DashboardRedux from '../../Redux/ActionsReducers/DashboardRedux'; import * as React from 'react'; import { CheckBox } from '../../components/CheckBox'; import { connect } from 'react-redux'; import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions'; import { Flex } from '../../components/Flex'; class DashboardViewPanelComponent extends React.Component { constructor(props) { super(props); } render() { const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel'; return (_jsxs(Flex, { flexDirection: "row", className: `ab-${elementType}__Dashboard__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap', children: [' ', ArrayExtensions.IsNotNullOrEmpty(this.props.api.dashboardApi.getDashboardState().Tabs) && (_jsx(CheckBox, { className: `ab-${elementType}__Dashboard__collapsed-check twa:mt-0 twa:text-2 twa:p-1`, checked: this.props.IsCollapsed, onChange: (checked) => this.props.onSetDashboardCollapsed(checked), children: "Collapse" })), '', this.props.api.optionsApi.getDashboardOptions().canFloat && (_jsx(CheckBox, { className: `ab-${elementType}__Dashboard__collapsed-check twa:mt-0 twa:text-2 twa:p-1`, checked: this.props.IsFloating, onChange: (checked) => this.props.onSetDashboardFloating(checked), children: "Float" })), ' ', _jsx(CheckBox, { className: `ab-${elementType}__Dashboard__hidden-check twa:mt-0 twa:text-2 twa:p-1`, checked: this.props.IsHidden, onChange: (checked) => this.props.onSetDashboardHidden(checked), children: "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)), }; } export let DashboardViewPanelControl = connect(mapStateToProps, mapDispatchToProps)(DashboardViewPanelComponent);