/**
 * @license
 * Copyright Alibaba.com All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "ng-zorro-antd/icon";
function NzOptionItemComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtext(1);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var ctx_r1247 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r1247.label);
} }
function NzOptionItemComponent_div_2_i_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 5);
} }
function NzOptionItemComponent_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 3);
    i0.ɵɵtemplate(1, NzOptionItemComponent_div_2_i_1_Template, 1, 0, "i", 4);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r1248 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !ctx_r1248.icon)("ngIfElse", ctx_r1248.icon);
} }
var NzOptionItemComponent = /** @class */ (function () {
    function NzOptionItemComponent() {
        this.selected = false;
        this.activated = false;
        this.grouped = false;
        this.customContent = false;
        this.template = null;
        this.disabled = false;
        this.showState = false;
        this.label = null;
        this.value = null;
        this.activatedValue = null;
        this.listOfSelectedValue = [];
        this.icon = null;
        this.itemClick = new EventEmitter();
        this.itemHover = new EventEmitter();
    }
    NzOptionItemComponent.prototype.onHostMouseEnter = function () {
        if (!this.disabled) {
            this.itemHover.next(this.value);
        }
    };
    NzOptionItemComponent.prototype.onHostClick = function () {
        if (!this.disabled) {
            this.itemClick.next(this.value);
        }
    };
    NzOptionItemComponent.prototype.ngOnChanges = function (changes) {
        var _this = this;
        var value = changes.value, activatedValue = changes.activatedValue, listOfSelectedValue = changes.listOfSelectedValue;
        if (value || listOfSelectedValue) {
            this.selected = this.listOfSelectedValue.find(function (v) { return _this.compareWith(v, _this.value); });
        }
        if (value || activatedValue) {
            this.activated = this.compareWith(this.activatedValue, this.value);
        }
    };
    /** @nocollapse */ NzOptionItemComponent.ɵfac = function NzOptionItemComponent_Factory(t) { return new (t || NzOptionItemComponent)(); };
    /** @nocollapse */ NzOptionItemComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NzOptionItemComponent, selectors: [["nz-option-item"]], hostVars: 12, hostBindings: function NzOptionItemComponent_HostBindings(rf, ctx) { if (rf & 1) {
            i0.ɵɵlistener("mouseenter", function NzOptionItemComponent_mouseenter_HostBindingHandler() { return ctx.onHostMouseEnter(); })("click", function NzOptionItemComponent_click_HostBindingHandler() { return ctx.onHostClick(); });
        } if (rf & 2) {
            i0.ɵɵclassProp("ant-select-item", true)("ant-select-item-option", true)("ant-select-item-option-grouped", ctx.grouped)("ant-select-item-option-selected", ctx.selected && !ctx.disabled)("ant-select-item-option-disabled", ctx.disabled)("ant-select-item-option-active", ctx.activated && !ctx.disabled);
        } }, inputs: { grouped: "grouped", customContent: "customContent", template: "template", disabled: "disabled", showState: "showState", label: "label", value: "value", activatedValue: "activatedValue", listOfSelectedValue: "listOfSelectedValue", icon: "icon", compareWith: "compareWith" }, outputs: { itemClick: "itemClick", itemHover: "itemHover" }, features: [i0.ɵɵNgOnChangesFeature], decls: 3, vars: 3, consts: [[1, "ant-select-item-option-content"], [4, "ngIf", "ngIfElse"], ["class", "ant-select-item-option-state", "style", "user-select: none", "unselectable", "on", 4, "ngIf"], ["unselectable", "on", 1, "ant-select-item-option-state", 2, "user-select", "none"], ["nz-icon", "", "nzType", "check", "class", "ant-select-selected-icon", 4, "ngIf", "ngIfElse"], ["nz-icon", "", "nzType", "check", 1, "ant-select-selected-icon"]], template: function NzOptionItemComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0);
            i0.ɵɵtemplate(1, NzOptionItemComponent_ng_container_1_Template, 2, 1, "ng-container", 1);
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(2, NzOptionItemComponent_div_2_Template, 2, 2, "div", 2);
        } if (rf & 2) {
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", !ctx.customContent)("ngIfElse", ctx.template);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", ctx.showState && ctx.selected);
        } }, directives: [i1.NgIf, i2.NzIconDirective], encapsulation: 2, changeDetection: 0 });
    return NzOptionItemComponent;
}());
export { NzOptionItemComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(NzOptionItemComponent, [{
        type: Component,
        args: [{
                selector: 'nz-option-item',
                template: "\n    <div class=\"ant-select-item-option-content\">\n      <ng-container *ngIf=\"!customContent; else template\">{{ label }}</ng-container>\n    </div>\n    <div *ngIf=\"showState && selected\" class=\"ant-select-item-option-state\" style=\"user-select: none\" unselectable=\"on\">\n      <i nz-icon nzType=\"check\" class=\"ant-select-selected-icon\" *ngIf=\"!icon; else icon\"></i>\n    </div>\n  ",
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
                host: {
                    '[class.ant-select-item]': 'true',
                    '[class.ant-select-item-option]': 'true',
                    '[class.ant-select-item-option-grouped]': 'grouped',
                    '[class.ant-select-item-option-selected]': 'selected && !disabled',
                    '[class.ant-select-item-option-disabled]': 'disabled',
                    '[class.ant-select-item-option-active]': 'activated && !disabled',
                    '(mouseenter)': 'onHostMouseEnter()',
                    '(click)': 'onHostClick()'
                }
            }]
    }], null, { grouped: [{
            type: Input
        }], customContent: [{
            type: Input
        }], template: [{
            type: Input
        }], disabled: [{
            type: Input
        }], showState: [{
            type: Input
        }], label: [{
            type: Input
        }], value: [{
            type: Input
        }], activatedValue: [{
            type: Input
        }], listOfSelectedValue: [{
            type: Input
        }], icon: [{
            type: Input
        }], compareWith: [{
            type: Input
        }], itemClick: [{
            type: Output
        }], itemHover: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 