"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 = (0, vue_1.defineComponent)({
    name: 'DropdownGroupHeader',
    props: {
        clsPrefix: {
            type: String,
            required: true
        },
        tmNode: {
            type: Object,
            required: true
        }
    },
    setup() {
        const { showIconRef, hasSubmenuRef
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
         } = (0, vue_1.inject)(DropdownMenu_1.dropdownMenuInjectionKey);
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
        const { renderLabelRef, labelFieldRef } = (0, vue_1.inject)(Dropdown_1.dropdownInjectionKey);
        return {
            labelField: labelFieldRef,
            showIcon: showIconRef,
            hasSubmenu: hasSubmenuRef,
            renderLabel: renderLabelRef
        };
    },
    render() {
        var _a;
        const { clsPrefix, hasSubmenu, showIcon, renderLabel } = this;
        const { rawNode } = this.tmNode;
        return ((0, vue_1.h)("div", { class: `${clsPrefix}-dropdown-option` },
            (0, vue_1.h)("div", { class: `${clsPrefix}-dropdown-option-body ${clsPrefix}-dropdown-option-body--group` },
                (0, vue_1.h)("div", { "__dropdown-option": true, class: [
                        `${clsPrefix}-dropdown-option-body__prefix`,
                        showIcon && `${clsPrefix}-dropdown-option-body__prefix--show-icon`
                    ] }, (0, _utils_1.render)(rawNode.icon)),
                (0, vue_1.h)("div", { class: `${clsPrefix}-dropdown-option-body__label`, "__dropdown-option": true }, renderLabel
                    ? renderLabel(rawNode)
                    : (0, _utils_1.render)((_a = rawNode.title) !== null && _a !== void 0 ? _a : rawNode[this.labelField])),
                (0, vue_1.h)("div", { class: [
                        `${clsPrefix}-dropdown-option-body__suffix`,
                        hasSubmenu &&
                            `${clsPrefix}-dropdown-option-body__suffix--has-submenu`
                    ], "__dropdown-option": true }))));
    }
});
