/**
 * 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';
let PaginationComponent = class PaginationComponent {
    constructor() {
        this.isSubmit = true;
        this.visiblePageNumberMaxCount = 5;
        this.pageChange = new EventEmitter();
        this.iconType = IconType;
    }
    onPageChange(page) {
        this.pageChange.emit(page);
        this.scrollLayoutToTop();
        this.page = page;
    }
    scrollLayoutToTop() {
        const layout = document.getElementsByClassName('layout-content').item(0);
        if (layout) {
            layout.scrollTop = 0;
        }
    }
    isFirstPage() {
        return this.page === 1;
    }
    isLastPage() {
        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);
export { PaginationComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFnaW5hdGlvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AbWVkcmVjb3JkL3VpLWNvbXBvbmVudHMvIiwic291cmNlcyI6WyJsaWIvc2hhcmVkL2NvbXBvbmVudHMvcGFnaW5hdGlvbi9wYWdpbmF0aW9uLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7O0dBU0c7O0FBRUgsT0FBTyxFQUFDLFNBQVMsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxpQkFBaUIsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUN4RixPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sY0FBYyxDQUFDO0FBUXRDLElBQWEsbUJBQW1CLEdBQWhDLE1BQWEsbU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