/**
 * @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";
var _c0 = ["nz-pagination-item", ""];
function NzPaginationItemComponent_ng_template_0_a_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "a");
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var page_r2660 = i0.ɵɵnextContext().page;
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(page_r2660);
} }
function NzPaginationItemComponent_ng_template_0_ng_container_2_i_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 9);
} }
function NzPaginationItemComponent_ng_template_0_ng_container_2_i_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 10);
} }
function NzPaginationItemComponent_ng_template_0_ng_container_2_div_4_i_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 15);
} }
function NzPaginationItemComponent_ng_template_0_ng_container_2_div_4_i_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 16);
} }
function NzPaginationItemComponent_ng_template_0_ng_container_2_div_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 11);
    i0.ɵɵelementContainerStart(1, 2);
    i0.ɵɵtemplate(2, NzPaginationItemComponent_ng_template_0_ng_container_2_div_4_i_2_Template, 1, 0, "i", 12);
    i0.ɵɵtemplate(3, NzPaginationItemComponent_ng_template_0_ng_container_2_div_4_i_3_Template, 1, 0, "i", 13);
    i0.ɵɵelementContainerEnd();
    i0.ɵɵelementStart(4, "span", 14);
    i0.ɵɵtext(5, "\u2022\u2022\u2022");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var type_r2659 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitch", type_r2659);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "prev_5");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "next_5");
} }
function NzPaginationItemComponent_ng_template_0_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "a", 5);
    i0.ɵɵtemplate(2, NzPaginationItemComponent_ng_template_0_ng_container_2_i_2_Template, 1, 0, "i", 6);
    i0.ɵɵtemplate(3, NzPaginationItemComponent_ng_template_0_ng_container_2_i_3_Template, 1, 0, "i", 7);
    i0.ɵɵtemplate(4, NzPaginationItemComponent_ng_template_0_ng_container_2_div_4_Template, 6, 3, "div", 8);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var type_r2659 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitch", type_r2659);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "prev");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "next");
} }
function NzPaginationItemComponent_ng_template_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0, 2);
    i0.ɵɵtemplate(1, NzPaginationItemComponent_ng_template_0_a_1_Template, 2, 1, "a", 3);
    i0.ɵɵtemplate(2, NzPaginationItemComponent_ng_template_0_ng_container_2_Template, 5, 3, "ng-container", 4);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var type_r2659 = ctx.$implicit;
    i0.ɵɵproperty("ngSwitch", type_r2659);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "page");
} }
function NzPaginationItemComponent_ng_template_2_Template(rf, ctx) { }
var _c1 = function (a0, a1) { return { $implicit: a0, page: a1 }; };
var NzPaginationItemComponent = /** @class */ (function () {
    function NzPaginationItemComponent() {
        this.active = false;
        this.locale = {};
        this.index = null;
        this.disabled = false;
        this.type = null;
        this.itemRender = null;
        this.diffIndex = new EventEmitter();
        this.gotoIndex = new EventEmitter();
        this.title = null;
    }
    NzPaginationItemComponent.prototype.clickItem = function () {
        if (!this.disabled) {
            if (this.type === 'page') {
                this.gotoIndex.emit(this.index);
            }
            else {
                this.diffIndex.emit({
                    next: 1,
                    prev: -1,
                    prev_5: -5,
                    next_5: 5
                }[this.type]);
            }
        }
    };
    NzPaginationItemComponent.prototype.ngOnChanges = function (changes) {
        var locale = changes.locale, index = changes.index, type = changes.type;
        if (locale || index || type) {
            this.title = {
                page: "" + this.index,
                next: this.locale.next_page,
                prev: this.locale.prev_page,
                prev_5: this.locale.prev_5,
                next_5: this.locale.next_5
            }[this.type];
        }
    };
    /** @nocollapse */ NzPaginationItemComponent.ɵfac = function NzPaginationItemComponent_Factory(t) { return new (t || NzPaginationItemComponent)(); };
    /** @nocollapse */ NzPaginationItemComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NzPaginationItemComponent, selectors: [["li", "nz-pagination-item", ""]], hostVars: 19, hostBindings: function NzPaginationItemComponent_HostBindings(rf, ctx) { if (rf & 1) {
            i0.ɵɵlistener("click", function NzPaginationItemComponent_click_HostBindingHandler() { return ctx.clickItem(); });
        } if (rf & 2) {
            i0.ɵɵattribute("title", ctx.title);
            i0.ɵɵclassProp("ant-pagination-prev", ctx.type === "prev")("ant-pagination-next", ctx.type === "next")("ant-pagination-item", ctx.type === "page")("ant-pagination-jump-prev", ctx.type === "prev_5")("ant-pagination-jump-prev-custom-icon", ctx.type === "prev_5")("ant-pagination-jump-next", ctx.type === "next_5")("ant-pagination-jump-next-custom-icon", ctx.type === "next_5")("ant-pagination-disabled", ctx.disabled)("ant-pagination-item-active", ctx.active);
        } }, inputs: { active: "active", locale: "locale", index: "index", disabled: "disabled", type: "type", itemRender: "itemRender" }, outputs: { diffIndex: "diffIndex", gotoIndex: "gotoIndex" }, features: [i0.ɵɵNgOnChangesFeature], attrs: _c0, decls: 3, vars: 5, consts: [["renderItemTemplate", ""], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], [3, "ngSwitch"], [4, "ngSwitchCase"], [4, "ngSwitchDefault"], [1, "ant-pagination-item-link", 3, "ngSwitch"], ["nz-icon", "", "nzType", "left", 4, "ngSwitchCase"], ["nz-icon", "", "nzType", "right", 4, "ngSwitchCase"], ["class", "ant-pagination-item-container", 4, "ngSwitchDefault"], ["nz-icon", "", "nzType", "left"], ["nz-icon", "", "nzType", "right"], [1, "ant-pagination-item-container"], ["nz-icon", "", "nzType", "double-left", "class", "ant-pagination-item-link-icon", 4, "ngSwitchCase"], ["nz-icon", "", "nzType", "double-right", "class", "ant-pagination-item-link-icon", 4, "ngSwitchCase"], [1, "ant-pagination-item-ellipsis"], ["nz-icon", "", "nzType", "double-left", 1, "ant-pagination-item-link-icon"], ["nz-icon", "", "nzType", "double-right", 1, "ant-pagination-item-link-icon"]], template: function NzPaginationItemComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtemplate(0, NzPaginationItemComponent_ng_template_0_Template, 3, 2, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
            i0.ɵɵtemplate(2, NzPaginationItemComponent_ng_template_2_Template, 0, 0, "ng-template", 1);
        } if (rf & 2) {
            var _r2656 = i0.ɵɵreference(1);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngTemplateOutlet", ctx.itemRender || _r2656)("ngTemplateOutletContext", i0.ɵɵpureFunction2(2, _c1, ctx.type, ctx.index));
        } }, directives: [i1.NgTemplateOutlet, i1.NgSwitch, i1.NgSwitchCase, i1.NgSwitchDefault, i2.NzIconDirective], encapsulation: 2, changeDetection: 0 });
    return NzPaginationItemComponent;
}());
export { NzPaginationItemComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(NzPaginationItemComponent, [{
        type: Component,
        args: [{
                selector: 'li[nz-pagination-item]',
                preserveWhitespaces: false,
                encapsulation: ViewEncapsulation.None,
                changeDetection: ChangeDetectionStrategy.OnPush,
                template: "\n    <ng-template #renderItemTemplate let-type let-page=\"page\">\n      <ng-container [ngSwitch]=\"type\">\n        <a *ngSwitchCase=\"'page'\">{{ page }}</a>\n        <ng-container *ngSwitchDefault>\n          <a class=\"ant-pagination-item-link\" [ngSwitch]=\"type\">\n            <i nz-icon nzType=\"left\" *ngSwitchCase=\"'prev'\"></i>\n            <i nz-icon nzType=\"right\" *ngSwitchCase=\"'next'\"></i>\n            <div class=\"ant-pagination-item-container\" *ngSwitchDefault>\n              <ng-container [ngSwitch]=\"type\">\n                <i *ngSwitchCase=\"'prev_5'\" nz-icon nzType=\"double-left\" class=\"ant-pagination-item-link-icon\"></i>\n                <i *ngSwitchCase=\"'next_5'\" nz-icon nzType=\"double-right\" class=\"ant-pagination-item-link-icon\"></i>\n              </ng-container>\n              <span class=\"ant-pagination-item-ellipsis\">\u2022\u2022\u2022</span>\n            </div>\n          </a>\n        </ng-container>\n      </ng-container>\n    </ng-template>\n    <ng-template\n      [ngTemplateOutlet]=\"itemRender || renderItemTemplate\"\n      [ngTemplateOutletContext]=\"{ $implicit: type, page: index }\"\n    ></ng-template>\n  ",
                host: {
                    '[class.ant-pagination-prev]': "type === 'prev'",
                    '[class.ant-pagination-next]': "type === 'next'",
                    '[class.ant-pagination-item]': "type === 'page'",
                    '[class.ant-pagination-jump-prev]': "type === 'prev_5'",
                    '[class.ant-pagination-jump-prev-custom-icon]': "type === 'prev_5'",
                    '[class.ant-pagination-jump-next]': "type === 'next_5'",
                    '[class.ant-pagination-jump-next-custom-icon]': "type === 'next_5'",
                    '[class.ant-pagination-disabled]': 'disabled',
                    '[class.ant-pagination-item-active]]': 'active',
                    '[attr.title]': 'title',
                    '(click)': 'clickItem()'
                }
            }]
    }], null, { active: [{
            type: Input
        }], locale: [{
            type: Input
        }], index: [{
            type: Input
        }], disabled: [{
            type: Input
        }], type: [{
            type: Input
        }], itemRender: [{
            type: Input
        }], diffIndex: [{
            type: Output
        }], gotoIndex: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 