import { __extends, __decorate, __metadata } from 'tslib';
import { Prop, Component } from 'vue-property-decorator';
import BaseComponent from '../BaseComponent.js';
import { classNamesFunction } from '@uifabric-vue/utilities';
import { Icon } from '../Icon/Icon.js';

var getClassNames = classNamesFunction();
var ContextualMenuItemBase = function(_super) {
  __extends(ContextualMenuItemBase2, _super);
  function ContextualMenuItemBase2() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.openSubMenu = function() {
      var _a = _this; _a.item; _a.openSubMenu;
    };
    return _this;
  }
  Object.defineProperty(ContextualMenuItemBase2.prototype, "classNames", {
    get: function() {
      return getClassNames(this.styles, {
        theme: this.theme
      });
    },
    enumerable: false,
    configurable: true
  });
  ContextualMenuItemBase2.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)
      ])
    ]);
  };
  ContextualMenuItemBase2.prototype.dismissSubMenu = function() {
  };
  ContextualMenuItemBase2.prototype.dismissMenu = function(dismissAll) {
  };
  ContextualMenuItemBase2.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
    });
  };
  ContextualMenuItemBase2.prototype.renderCheckMarkIcon = function(_a) {
    var onCheckmarkClick = _a.onCheckmarkClick, item = _a.item, classNames = _a.classNames;
    var h = this.$createElement;
    var isItemChecked = false;
    if (onCheckmarkClick) {
      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;
  };
  ContextualMenuItemBase2.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;
  };
  ContextualMenuItemBase2.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;
  };
  ContextualMenuItemBase2.prototype.renderSubMenuIcon = function(_a) {
    _a.item; _a.classNames; _a.theme;
    return null;
  };
  __decorate([
    Prop({ type: Object, default: function() {
    } }),
    __metadata("design:type", Object)
  ], ContextualMenuItemBase2.prototype, "item", void 0);
  ContextualMenuItemBase2 = __decorate([
    Component({
      components: {}
    })
  ], ContextualMenuItemBase2);
  return ContextualMenuItemBase2;
}(BaseComponent);

export { ContextualMenuItemBase };
