"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vue_1 = require("vue");
const _utils_1 = require("../../_utils");
const Dropdown_1 = require("./Dropdown");
const DropdownMenu_1 = require("./DropdownMenu");
exports.default = vue_1.defineComponent({
    name: 'DropdownGroupHeader',
    props: {
        clsPrefix: {
            type: String,
            required: true
        },
        tmNode: {
            type: Object,
            required: true
        }
    },
    setup(props) {
        const { showIconRef, hasSubmenuRef
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         } = vue_1.inject(DropdownMenu_1.dropdownMenuInjectionKey);
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
        const { renderLabelRef } = vue_1.inject(Dropdown_1.dropdownInjectionKey);
        return {
            showIcon: showIconRef,
            hasSubmenu: hasSubmenuRef,
            renderLabel: renderLabelRef
        };
    },
    render() {
        var _a;
        const { clsPrefix, hasSubmenu, showIcon, renderLabel } = this;
        const { rawNode } = this.tmNode;
        return (vue_1.h("div", { class: `${clsPrefix}-dropdown-option` },
            vue_1.h("div", { class: `${clsPrefix}-dropdown-option-body ${clsPrefix}-dropdown-option-body--group` },
                vue_1.h("div", { "__dropdown-option": true, class: [
                        `${clsPrefix}-dropdown-option-body__prefix`,
                        showIcon && `${clsPrefix}-dropdown-option-body__prefix--show-icon`
                    ] }, _utils_1.render(rawNode.icon)),
                vue_1.h("div", { class: `${clsPrefix}-dropdown-option-body__label`, "__dropdown-option": true }, renderLabel
                    ? renderLabel(rawNode)
                    : _utils_1.render((_a = rawNode.label) !== null && _a !== void 0 ? _a : rawNode.title)),
                vue_1.h("div", { class: [
                        `${clsPrefix}-dropdown-option-body__suffix`,
                        hasSubmenu &&
                            `${clsPrefix}-dropdown-option-body__suffix--has-submenu`
                    ], "__dropdown-option": true }))));
    }
});
