"use strict";
/**
 * @desc 自定义表头
 * @author 周克文
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const antd_1 = require("antd");
const icons_1 = require("@ant-design/icons");
const styled_components_1 = __importDefault(require("styled-components"));
const StyledTooltipCell = styled_components_1.default.div `
  width: 100%;
`;
const StyledHelpWraper = styled_components_1.default.div `
  display: inline-block;
`;
const StyledTooltip = styled_components_1.default(antd_1.Tooltip) `
  margin: 0 5px;

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