var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { bindable, containerless, customElement, inlineView, processContent } from "aurelia-framework";
import { UIInternal } from "../../utils/ui-internal";
export var MenuItem = (function () {
    function MenuItem() {
        this.noitemsLabel = "No Menu";
    }
    MenuItem.prototype.bind = function (context, overrideContext) {
        context.dropEl = null;
    };
    MenuItem.prototype.onClick = function ($event, args) {
        if (this.item.disabled != null && (typeof this.item.disabled === 'function' ? this.item.disabled() : this.item.disabled)) {
            $event.stopPropagation();
            return false;
        }
        if (this.item.items) {
            $event.stopPropagation();
        }
        if (this.item.handler) {
            this.item.handler(args);
            UIInternal.broadcast(UIInternal.EVT_VIEWPORT_CLICK, $event.target);
        }
        return true;
    };
    __decorate([
        bindable(),
        __metadata("design:type", Object)
    ], MenuItem.prototype, "item", void 0);
    __decorate([
        bindable(),
        __metadata("design:type", String)
    ], MenuItem.prototype, "noitemsLabel", void 0);
    MenuItem = __decorate([
        containerless(),
        customElement("menu-item"),
        inlineView("<template>\n  <template if.bind=\"item.group\">\n    <ui-menu-group label.bind=\"item.group\" hidden-label.bind=\"item.hiddenLabel\">\n      <menu-item repeat.for=\"groupItem of item.items\" item.bind=\"groupItem\"></menu-item>\n    </ui-menu-group>\n  </template>\n  <template if.bind=\"item.label\">\n    <ui-menu-item label.bind=\"item.label\" href.bind=\"item.href\"\n    icon.bind=\"item.icon\" color.bind=\"item.color\" icon-color.bind=\"item.iconColor\" ui-badge=\"value.bind:item.badge; theme.bind:item.badgeTheme;\"\n    disabled.bind=\"typeof item.disabled === 'function' ? item.disabled() : item.disabled\"\n    active.bind=\"typeof item.active === 'function' ? item.active() : item.active\"\n    hide.bind=\"typeof item.hidden === 'function' ? item.hidden() : item.hidden\"\n    click.delegate=\"onClick($event, current)\">\n      <ui-drop view-model.ref=\"dropEl\" if.bind=\"item.items\" auto-open.bind=\"false\">\n        <ui-menu if.bind=\"dropEl.isOpen\" menu-items.bind=\"item.items\" noitems-label.bind=\"noitemsLabel\"></ui-menu>\n      </ui-drop>\n    </ui-menu-item>\n  </template>\n  <template if.bind=\"item === '-'\">\n    <ui-divider></ui-divider>\n  </template>\n</template>"),
        processContent(function (compiler, resources, node, instruction) {
            instruction.inheritBindingContext = true;
            return true;
        })
    ], MenuItem);
    return MenuItem;
}());

//# sourceMappingURL=menu-item.js.map
