/**
 * @desc 自定义表头
 * @author 周克文
 */
import React, { useRef } from 'react';
import { Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import styled from 'styled-components';
const StyledTooltipCell = styled.div `
  width: 100%;
`;
const StyledHelpWraper = styled.div `
  display: inline-block;
`;
const StyledTooltip = styled(Tooltip) `
  margin: 0 5px;

  color: ${props => props.theme.main};
`;
export default function TooltipHeader(props) {
    const refButton = useRef(null);
    const onMenuClicked = () => {
        props.showColumnMenu(refButton.current);
    };
    let menu = null;
    if (props.enableMenu) {
        menu = (React.createElement("div", { ref: refButton, className: "ag-header-icon ag-header-cell-menu-button", onClick: () => onMenuClicked() },
            React.createElement("i", { className: "ag-icon ag-icon-menu" })));
    }
    return (React.createElement(StyledTooltipCell, null,
        menu,
        React.createElement("div", { className: "ag-header-cell-label", role: "presentation" },
            React.createElement("span", { className: "ag-header-cell-text", role: "columnheader", unselectable: "on" },
                props.title || props.displayName,
                props.tooltip && (React.createElement(StyledHelpWraper, null,
                    React.createElement(StyledTooltip, { autoAdjustOverflow: true, placement: "topRight", arrowPointAtCenter: true, title: props.tooltip },
                        React.createElement(QuestionCircleOutlined, null))))))));
}
