import { __decorate, __extends, __metadata } from "tslib";
import { Component, Prop } from 'vue-property-decorator';
import BaseComponent from '../BaseComponent';
import { Icon } from '../Icon';
import { classNamesFunction } from '@uifabric-vue/utilities';
var getClassNames = classNamesFunction();
var ContextualMenuItemBase = /** @class */ (function (_super) {
    __extends(ContextualMenuItemBase, _super);
    function ContextualMenuItemBase() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.openSubMenu = function () {
            var _a = _this, item = _a.item, openSubMenu = _a.openSubMenu;
            // if (getSubmenuTarget) {
            //   const submenuTarget = getSubmenuTarget()
            //   // if (hasSubmenu(item) && openSubMenu && submenuTarget) {
            //   //   openSubMenu(item, submenuTarget)
            //   // }
            // }
        };
        return _this;
    }
    Object.defineProperty(ContextualMenuItemBase.prototype, "classNames", {
        get: function () {
            return getClassNames(this.styles, {
                theme: this.theme,
            });
        },
        enumerable: false,
        configurable: true
    });
    ContextualMenuItemBase.prototype.render = function () {
        var h = this.$createElement;
        var _a = this, item = _a.item, classNames = _a.classNames;
        return h('button', { class: classNames.root }, [
            h('div', { class: item.split ? classNames.linkContentMenu : classNames.linkContent }, [
                this.renderCheckMarkIcon(this),
                this.renderItemIcon(this),
                this.renderItemName(this),
                this.renderSecondaryText(this),
                this.renderSubMenuIcon(this),
            ]),
        ]);
    };
    ContextualMenuItemBase.prototype.dismissSubMenu = function () {
        // const { item, dismissSubMenu } = this
        // if (hasSubmenu(item) && dismissSubMenu) {
        //   dismissSubMenu()
        // }
    };
    ;
    ContextualMenuItemBase.prototype.dismissMenu = function (dismissAll) {
        // const { dismissMenu } = this.props
        // if (dismissMenu) {
        //   dismissMenu(undefined /* ev */, dismissAll)
        // }
    };
    ;
    ContextualMenuItemBase.prototype.renderItemIcon = function (props) {
        var h = this.$createElement;
        var item = props.item, hasIcons = props.hasIcons, classNames = props.classNames;
        var iconProps = item.iconProps;
        if (!hasIcons) {
            return null;
        }
        if (item.onRenderIcon) {
            return item.onRenderIcon(props);
        }
        return h(Icon, {
            class: classNames.icon,
            props: iconProps,
        });
    };
    ContextualMenuItemBase.prototype.renderCheckMarkIcon = function (_a) {
        var onCheckmarkClick = _a.onCheckmarkClick, item = _a.item, classNames = _a.classNames;
        var h = this.$createElement;
        var isItemChecked = false; // getIsChecked(item)
        if (onCheckmarkClick) {
            // Ensures that the item is passed as the first argument to the checkmark click callback.
            var onClick = function (e) { return onCheckmarkClick(item, e); };
            return h(Icon, {
                class: classNames.checkmarkIcon,
                attrs: {
                    iconName: item.canCheck !== false && isItemChecked ? 'CheckMark' : '',
                },
                on: {
                    click: onClick,
                },
            });
        }
        return null;
    };
    ContextualMenuItemBase.prototype.renderItemName = function (_a) {
        var item = _a.item, classNames = _a.classNames;
        var h = this.$createElement;
        if (item.text || item.name) {
            return h('span', { class: classNames.label }, item.text || item.name);
        }
        return null;
    };
    ContextualMenuItemBase.prototype.renderSecondaryText = function (_a) {
        var item = _a.item, classNames = _a.classNames;
        var h = this.$createElement;
        if (item.secondaryText) {
            return h('span', { class: classNames.secondaryText }, item.secondaryText);
        }
        return null;
    };
    ContextualMenuItemBase.prototype.renderSubMenuIcon = function (_a) {
        var item = _a.item, classNames = _a.classNames, theme = _a.theme;
        // if (hasSubmenu(item)) {
        //   return <Icon iconName={getRTL(theme) ? 'ChevronLeft' : 'ChevronRight'} {...item.submenuIconProps} class={classNames.subMenuIcon} />
        // }
        return null;
    };
    __decorate([
        Prop({ type: Object, default: function () { } }),
        __metadata("design:type", Object)
    ], ContextualMenuItemBase.prototype, "item", void 0);
    ContextualMenuItemBase = __decorate([
        Component({
            components: {},
        })
    ], ContextualMenuItemBase);
    return ContextualMenuItemBase;
}(BaseComponent));
export { ContextualMenuItemBase };
//# sourceMappingURL=ContextualMenuItem.base.js.map