/**
 * This file is part of the MedSafe application which is commercial software created by MedVision360 B.V.
 * The source code is proprietary and confidential.
 *
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 *
 * Copyright (c) by MedVision360 B.V. All rights reserved.
 *
 * For the application name: io.medrecord.medsafe
 */
import { __decorate } from "tslib";
import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { IconType } from '../../models';
var PaginationComponent = /** @class */ (function () {
    function PaginationComponent() {
        this.isSubmit = true;
        this.visiblePageNumberMaxCount = 5;
        this.pageChange = new EventEmitter();
        this.iconType = IconType;
    }
    PaginationComponent.prototype.onPageChange = function (page) {
        this.pageChange.emit(page);
        this.scrollLayoutToTop();
        this.page = page;
    };
    PaginationComponent.prototype.scrollLayoutToTop = function () {
        var layout = document.getElementsByClassName('layout-content').item(0);
        if (layout) {
            layout.scrollTop = 0;
        }
    };
    PaginationComponent.prototype.isFirstPage = function () {
        return this.page === 1;
    };
    PaginationComponent.prototype.isLastPage = function () {
        return this.collectionSize <= (this.itemsPerPage * this.page);
    };
    __decorate([
        Input()
    ], PaginationComponent.prototype, "isSubmit", void 0);
    __decorate([
        Input()
    ], PaginationComponent.prototype, "page", void 0);
    __decorate([
        Input()
    ], PaginationComponent.prototype, "collectionSize", void 0);
    __decorate([
        Input()
    ], PaginationComponent.prototype, "visiblePageNumberMaxCount", void 0);
    __decorate([
        Input()
    ], PaginationComponent.prototype, "itemsPerPage", void 0);
    __decorate([
        Output()
    ], PaginationComponent.prototype, "pageChange", void 0);
    PaginationComponent = __decorate([
        Component({
            selector: 'app-pagination',
            template: "<ngb-pagination [collectionSize]=\"collectionSize\"\n                [page]=\"page\"\n                [pageSize]=\"itemsPerPage\"\n                *ngIf=\"collectionSize > itemsPerPage\"\n                (pageChange)=\"onPageChange($event)\"\n                [maxSize]=\"visiblePageNumberMaxCount\">\n\n  <ng-template ngbPaginationPrevious>\n    <app-icon\n      *ngIf=\"!isFirstPage()\"\n      [icon]=\"iconType.arrowPaginationLeft\"\n    ></app-icon>\n  </ng-template>\n\n  <ng-template ngbPaginationNext>\n    <app-icon\n      *ngIf=\"!isLastPage()\"\n      [icon]=\"iconType.arrowPaginationRight\"\n    ></app-icon>\n  </ng-template>\n</ngb-pagination>\n",
            encapsulation: ViewEncapsulation.None,
            styles: ["/*!\n * This file is part of the MedSafe application which is commercial software created by MedVision360 B.V.\n *  The source code is proprietary and confidential.\n *\n *  Unauthorized copying of this file, via any medium is strictly prohibited.\n *\n *  Copyright (c) by MedVision360 B.V. All rights reserved.\n *\n *  For the application name: io.medrecord.medsafe\n */.pagination{padding:0;list-style-type:none;display:flex;justify-content:flex-end;margin:48px 0 0}.pagination .page-item{display:flex;justify-content:center;align-items:center;width:24px;height:24px;border-radius:20px;text-align:center;margin-right:3px}.pagination .page-item .page-link{display:flex;text-decoration:none;color:var(--primary-color);background-color:transparent;outline:0;text-align:center;border:none;margin:0}.pagination .page-item:hover{background-color:var(--white-hover-color)}.pagination .page-item.active{background-color:var(--primary-color);padding:0;text-align:center}.pagination .page-item.active:hover{background-color:var(--primary-hover-color)}.pagination .page-item.active .page-link{color:var(--white-color)}.pagination .sr-only{display:none}"]
        })
    ], PaginationComponent);
    return PaginationComponent;
}());
export { PaginationComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFnaW5hdGlvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AbWVkcmVjb3JkL3VpLWNvbXBvbmVudHMvIiwic291cmNlcyI6WyJsaWIvc2hhcmVkL2NvbXBvbmVudHMvcGFnaW5hdGlvbi9wYWdpbmF0aW9uLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7O0dBU0c7O0FBRUgsT0FBTyxFQUFDLFNBQVMsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxpQkFBaUIsRUFBQyxNQUFNLGVBQWUsQ0FB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