UNPKG

angular2-datatable-pagination

Version:
41 lines 4.81 kB
"use strict"; 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); }; var core_1 = require("@angular/core"); var NG2DataTable_1 = require("./NG2DataTable"); var _ = require("lodash"); var NG2BootstrapPaginator = (function () { function NG2BootstrapPaginator() { this.rowsOnPageSet = []; this.minRowsOnPage = 0; } NG2BootstrapPaginator.prototype.ngOnChanges = function (changes) { if (changes.rowsOnPageSet) { this.minRowsOnPage = _.min(this.rowsOnPageSet); } }; return NG2BootstrapPaginator; }()); __decorate([ core_1.Input("rowsOnPageSet"), __metadata("design:type", Object) ], NG2BootstrapPaginator.prototype, "rowsOnPageSet", void 0); __decorate([ core_1.Input("mfTable"), __metadata("design:type", NG2DataTable_1.NG2DataTable) ], NG2BootstrapPaginator.prototype, "mfTable", void 0); NG2BootstrapPaginator = __decorate([ core_1.Component({ selector: "mfBootstrapPaginator", template: "\n <mfPaginator #p [mfTable]=\"mfTable\">\n <ul class=\"pagination\" *ngIf=\"p.dataLength > p.rowsOnPage\">\n <li class=\"page-item\" [class.disabled]=\"p.activePage <= 1\" (click)=\"p.setPage(1)\">\n <a class=\"page-link\" style=\"cursor: pointer\">&laquo;</a>\n </li>\n <li class=\"page-item\" *ngIf=\"p.activePage > 4 && p.activePage + 1 > p.lastPage\" (click)=\"p.setPage(p.activePage - 4)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage-4}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"p.activePage > 3 && p.activePage + 2 > p.lastPage\" (click)=\"p.setPage(p.activePage - 3)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage-3}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"p.activePage > 2\" (click)=\"p.setPage(p.activePage - 2)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage-2}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"p.activePage > 1\" (click)=\"p.setPage(p.activePage - 1)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage-1}}</a>\n </li>\n <li class=\"page-item active\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"p.activePage + 1 <= p.lastPage\" (click)=\"p.setPage(p.activePage + 1)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage+1}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"p.activePage + 2 <= p.lastPage\" (click)=\"p.setPage(p.activePage + 2)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage+2}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"p.activePage + 3 <= p.lastPage && p.activePage < 3\" (click)=\"p.setPage(p.activePage + 3)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage+3}}</a>\n </li>\n <li class=\"page-item\" *ngIf=\"p.activePage + 4 <= p.lastPage && p.activePage < 2\" (click)=\"p.setPage(p.activePage + 4)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{p.activePage+4}}</a>\n </li>\n <li class=\"page-item\" [class.disabled]=\"p.activePage >= p.lastPage\" (click)=\"p.setPage(p.lastPage)\">\n <a class=\"page-link\" style=\"cursor: pointer\">&raquo;</a>\n </li>\n </ul>\n <ul class=\"pagination pull-right float-sm-right\" *ngIf=\"p.dataLength > minRowsOnPage\">\n <li class=\"page-item\" *ngFor=\"let rows of rowsOnPageSet\" [class.active]=\"p.rowsOnPage===rows\" (click)=\"p.setRowsOnPage(rows)\">\n <a class=\"page-link\" style=\"cursor: pointer\">{{rows}}</a>\n </li>\n </ul>\n </mfPaginator>\n " }) ], NG2BootstrapPaginator); exports.NG2BootstrapPaginator = NG2BootstrapPaginator; //# sourceMappingURL=NG2BootstrapPaginator.js.map