ng-angular8-datatable
Version:
DataTable component for Angular framework
42 lines • 5.41 kB
JavaScript
"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);
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var DataTable_1 = require("./DataTable");
var _ = require("lodash");
var BootstrapPaginator = (function () {
function BootstrapPaginator() {
this.rowsOnPageSet = [];
this.minRowsOnPage = 0;
}
BootstrapPaginator.prototype.ngOnChanges = function (changes) {
if (changes.rowsOnPageSet) {
this.minRowsOnPage = _.min(this.rowsOnPageSet);
}
};
__decorate([
core_1.Input("rowsOnPageSet"),
__metadata("design:type", Object)
], BootstrapPaginator.prototype, "rowsOnPageSet", void 0);
__decorate([
core_1.Input("svTable"),
__metadata("design:type", DataTable_1.DataTable)
], BootstrapPaginator.prototype, "svTable", void 0);
BootstrapPaginator = __decorate([
core_1.Component({
selector: 'sv-bootstrap-paginator',
template: "\n <sv-paginator #p [svTable]=\"svTable\">\n <div class=\"row\">\n\n <div class=\"col-md-10\">\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\">«</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\">»</a>\n </li>\n </ul>\n </div>\n\n <div class=\"col-md-2 pull-right float-sm-right\">\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 </div>\n\n </div>\n </sv-paginator>\n "
})
], BootstrapPaginator);
return BootstrapPaginator;
}());
exports.BootstrapPaginator = BootstrapPaginator;
//# sourceMappingURL=BootstrapPaginator.js.map