@colijnit/corecomponents_v12 12.0.51 → 12.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/colijnit-corecomponents_v12.umd.js +93 -68
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/input-combo-box/input-combo-box.component.js +2 -1
- package/esm2015/lib/components/pagination/pagination.component.js +8 -60
- package/esm2015/lib/components/pagination/pagination.service.js +1 -1
- package/esm2015/lib/components/pagination-bar/pagination-bar.component.js +79 -7
- package/esm2015/lib/components/simple-grid/simple-grid.component.js +16 -4
- package/esm2015/lib/components/simple-grid/simple-grid.module.js +4 -2
- package/fesm2015/colijnit-corecomponents_v12.js +103 -69
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/pagination/pagination.component.d.ts +2 -4
- package/lib/components/pagination-bar/pagination-bar.component.d.ts +11 -3
- package/lib/components/pagination-bar/style/_layout.scss +4 -0
- package/lib/components/pagination-bar/style/_material-definition.scss +2 -1
- package/lib/components/pagination-bar/style/_theme.scss +1 -1
- package/lib/components/simple-grid/simple-grid.component.d.ts +3 -1
- package/package.json +1 -1
|
@@ -6246,7 +6246,7 @@
|
|
|
6246
6246
|
InputComboBoxComponent.decorators = [
|
|
6247
6247
|
{ type: core.Component, args: [{
|
|
6248
6248
|
selector: "co-input-combo-box",
|
|
6249
|
-
template: "\n <ejs-combobox #combo [dataSource]=\"collection\"\n [fields]=\"fields\"\n [placeholder]=\"placeholder\"\n [autofill]=\"true\"\n [ngModel]=\"model\"\n (ngModelChange)=\"modelChange.emit($event)\"\n (valueChange)=\"valueChange.emit($event)\"\n (focus)=\"onFocus()\"\n showClearButton=\"true\"\n floatLabelType=\"Auto\"\n >\n </ejs-combobox>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
|
|
6249
|
+
template: "\n <ejs-combobox #combo [dataSource]=\"collection\"\n [fields]=\"fields\"\n [disabled]=\"readonly\"\n [placeholder]=\"placeholder\"\n [autofill]=\"true\"\n [ngModel]=\"model\"\n (ngModelChange)=\"modelChange.emit($event)\"\n (valueChange)=\"valueChange.emit($event)\"\n (focus)=\"onFocus()\"\n showClearButton=\"true\"\n floatLabelType=\"Auto\"\n >\n </ejs-combobox>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
|
|
6250
6250
|
providers: [{
|
|
6251
6251
|
provide: COMPONENT_INTERFACE_NAME,
|
|
6252
6252
|
useExisting: core.forwardRef(function () { return InputComboBoxComponent; })
|
|
@@ -9775,9 +9775,14 @@
|
|
|
9775
9775
|
}
|
|
9776
9776
|
this._detectChanges();
|
|
9777
9777
|
};
|
|
9778
|
-
SimpleGridComponent.prototype.
|
|
9778
|
+
SimpleGridComponent.prototype.goToPreviousPage = function () {
|
|
9779
|
+
this.currentPage -= 1;
|
|
9780
|
+
};
|
|
9781
|
+
SimpleGridComponent.prototype.goToNextPage = function () {
|
|
9782
|
+
this.currentPage += 1;
|
|
9783
|
+
};
|
|
9784
|
+
SimpleGridComponent.prototype.setCurrentPage = function (page) {
|
|
9779
9785
|
this.currentPage = page;
|
|
9780
|
-
//this.gridBody.nativeElement.scrollTop = 0;
|
|
9781
9786
|
};
|
|
9782
9787
|
SimpleGridComponent.prototype._detectChanges = function () {
|
|
9783
9788
|
this._changeDetection.detectChanges();
|
|
@@ -9787,7 +9792,7 @@
|
|
|
9787
9792
|
SimpleGridComponent.decorators = [
|
|
9788
9793
|
{ type: core.Component, args: [{
|
|
9789
9794
|
selector: 'co-simple-grid',
|
|
9790
|
-
template: "\n <co-grid-toolbar *ngIf=\"showToolbar\" [class.right]=\"rightToolbar\"\n [showEdit]=\"inlineEdit\"\n [showAdd]=\"showAdd\"\n [showDelete]=\"showDelete\"\n [deleteEnabled]=\"selectedRowIndex > -1\"\n (addClick)=\"addNewRow()\"\n (editClick)=\"editRow($event)\"\n (saveClick)=\"validateAndSave()\"\n (cancelClick)=\"cancelEditRow()\"\n (deleteClick)=\"removeRow()\"\n ></co-grid-toolbar>\n <table class=\"simple-grid-table\">\n <colgroup>\n <col *ngFor=\"let column of headerColumns; let index = index\"\n [class.simple-grid-column-auto-fit]=\"column.autoFit\"\n [style.width.px]=\"column.width\"\n [style.min-width.px]=\"MIN_COLUMN_WIDTH\">\n </colgroup>\n <thead>\n <tr>\n <th scope=\"col\" #headerCell class=\"simple-grid-column-header\" *ngFor=\"let column of headerColumns; let index = index\">\n <div class=\"simple-grid-column-header-wrapper\" [class.resizable]=\"resizable\"\n [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\">\n <ng-container *ngIf=\"column.headerTemplate; else noHeaderTemplate\">\n <ng-container [ngTemplateOutlet]=\"column.headerTemplate\"></ng-container>\n </ng-container>\n <ng-template #noHeaderTemplate>\n <div class=\"simple-grid-column-header-label\" [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\"\n [textContent]=\"column.headerText || ' '\"\n ></div>\n </ng-template>\n <div *ngIf=\"resizable && column.resizable\" class=\"simple-grid-column-sizer\"\n (mousedown)=\"handleSizerMouseDown($event, column)\"\n ></div>\n </div>\n </th>\n </tr>\n </thead>\n <tbody #dropList cdkDropList cdkDropListOrientation=\"vertical\"\n class=\"simple-grid-drag-drop-list\"\n [cdkDropListDisabled]=\"!dragDropEnabled\"\n [cdkDropListData]=\"data\"\n [cdkDropListEnterPredicate]=\"handleCanDragDrop\"\n (cdkDropListDropped)=\"handleDrop($event)\">\n <tr class=\"simple-grid-row\" [class.selected]=\"rowIndex === selectedRowIndex && !editing\" observeVisibility\n [class.editing]=\"rowIndex === editRowIndex\" *ngFor=\"let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index\" cdkDrag\n (click)=\"handleClickRow($event, rowIndex)\" (dblclick)=\"handleDblClickRow($event, rowIndex)\" (visible)=\"rowVisible.next(row)\">\n <co-form class=\"simple-grid-row-form\">\n <ng-container *ngIf=\"isSingleColumnRow(row)\">\n <td class=\"simple-grid-single-column-cell\" [attr.colspan]=\"headerColumns.length\">\n <co-simple-grid-cell\n [column]=\"columns[singleColumnIndex(row)]\"\n [row]=\"row\"\n [editMode]=\"false\"\n ></co-simple-grid-cell>\n </td>\n </ng-container>\n <ng-container *ngIf=\"!isSingleColumnRow(row)\">\n <ng-container *ngFor=\"let column of headerColumns; let columnIndex = index\">\n <td class=\"simple-grid-column-cell\" *ngIf=\"columnIndex !== singleColumnIndex(row)\">\n <co-simple-grid-cell\n [column]=\"column\"\n [row]=\"row\"\n [editMode]=\"inlineEdit && editing && rowIndex === editRowIndex\"\n [fieldEditMode]=\"editCellIndex === columnIndex\"\n (cellClick)=\"handleCellClick(columnIndex)\"\n ></co-simple-grid-cell>\n <div *ngIf=\"column.resizable\" class=\"simple-grid-column-sizer-placeholder\"></div>\n </td>\n </ng-container>\n </ng-container>\n </co-form>\n </tr>\n </tbody>\n </table>\n <co-pagination *ngIf=\"data?.length > rowsPerPage\"
|
|
9795
|
+
template: "\n <co-grid-toolbar *ngIf=\"showToolbar\" [class.right]=\"rightToolbar\"\n [showEdit]=\"inlineEdit\"\n [showAdd]=\"showAdd\"\n [showDelete]=\"showDelete\"\n [deleteEnabled]=\"selectedRowIndex > -1\"\n (addClick)=\"addNewRow()\"\n (editClick)=\"editRow($event)\"\n (saveClick)=\"validateAndSave()\"\n (cancelClick)=\"cancelEditRow()\"\n (deleteClick)=\"removeRow()\"\n ></co-grid-toolbar>\n <table class=\"simple-grid-table\">\n <colgroup>\n <col *ngFor=\"let column of headerColumns; let index = index\"\n [class.simple-grid-column-auto-fit]=\"column.autoFit\"\n [style.width.px]=\"column.width\"\n [style.min-width.px]=\"MIN_COLUMN_WIDTH\">\n </colgroup>\n <thead>\n <tr>\n <th scope=\"col\" #headerCell class=\"simple-grid-column-header\" *ngFor=\"let column of headerColumns; let index = index\">\n <div class=\"simple-grid-column-header-wrapper\" [class.resizable]=\"resizable\"\n [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\">\n <ng-container *ngIf=\"column.headerTemplate; else noHeaderTemplate\">\n <ng-container [ngTemplateOutlet]=\"column.headerTemplate\"></ng-container>\n </ng-container>\n <ng-template #noHeaderTemplate>\n <div class=\"simple-grid-column-header-label\" [ngClass]=\"column.textAlign ? column.textAlign : defaultTextAlign\"\n [textContent]=\"column.headerText || ' '\"\n ></div>\n </ng-template>\n <div *ngIf=\"resizable && column.resizable\" class=\"simple-grid-column-sizer\"\n (mousedown)=\"handleSizerMouseDown($event, column)\"\n ></div>\n </div>\n </th>\n </tr>\n </thead>\n <tbody #dropList cdkDropList cdkDropListOrientation=\"vertical\"\n class=\"simple-grid-drag-drop-list\"\n [cdkDropListDisabled]=\"!dragDropEnabled\"\n [cdkDropListData]=\"data\"\n [cdkDropListEnterPredicate]=\"handleCanDragDrop\"\n (cdkDropListDropped)=\"handleDrop($event)\">\n <tr class=\"simple-grid-row\" [class.selected]=\"rowIndex === selectedRowIndex && !editing\" observeVisibility\n [class.editing]=\"rowIndex === editRowIndex\" *ngFor=\"let row of (!!rowsPerPage ? (data | paginate: {itemsPerPage: rowsPerPage, currentPage: currentPage}) : data); last as last; let rowIndex = index\" cdkDrag\n (click)=\"handleClickRow($event, rowIndex)\" (dblclick)=\"handleDblClickRow($event, rowIndex)\" (visible)=\"rowVisible.next(row)\">\n <co-form class=\"simple-grid-row-form\">\n <ng-container *ngIf=\"isSingleColumnRow(row)\">\n <td class=\"simple-grid-single-column-cell\" [attr.colspan]=\"headerColumns.length\">\n <co-simple-grid-cell\n [column]=\"columns[singleColumnIndex(row)]\"\n [row]=\"row\"\n [editMode]=\"false\"\n ></co-simple-grid-cell>\n </td>\n </ng-container>\n <ng-container *ngIf=\"!isSingleColumnRow(row)\">\n <ng-container *ngFor=\"let column of headerColumns; let columnIndex = index\">\n <td class=\"simple-grid-column-cell\" *ngIf=\"columnIndex !== singleColumnIndex(row)\">\n <co-simple-grid-cell\n [column]=\"column\"\n [row]=\"row\"\n [editMode]=\"inlineEdit && editing && rowIndex === editRowIndex\"\n [fieldEditMode]=\"editCellIndex === columnIndex\"\n (cellClick)=\"handleCellClick(columnIndex)\"\n ></co-simple-grid-cell>\n <div *ngIf=\"column.resizable\" class=\"simple-grid-column-sizer-placeholder\"></div>\n </td>\n </ng-container>\n </ng-container>\n </co-form>\n </tr>\n </tbody>\n </table>\n <co-pagination-bar *ngIf=\"data?.length > rowsPerPage\"\n [itemsPerPage]=\"rowsPerPage\"\n [currentPage]=\"currentPage\"\n [totalItems]=\"data.length\"\n (previousClick)=\"goToPreviousPage()\"\n (nextClick)=\"goToNextPage()\"\n (pageClick)=\"setCurrentPage($event)\"\n ></co-pagination-bar>\n ",
|
|
9791
9796
|
providers: [
|
|
9792
9797
|
FormMasterService
|
|
9793
9798
|
],
|
|
@@ -9811,18 +9816,30 @@
|
|
|
9811
9816
|
|
|
9812
9817
|
var PaginationBarComponent = /** @class */ (function () {
|
|
9813
9818
|
function PaginationBarComponent() {
|
|
9814
|
-
this.pages = [];
|
|
9815
9819
|
this.directionLinks = true;
|
|
9816
9820
|
this.previousLabel = 'Vorige pagina';
|
|
9817
9821
|
this.nextLabel = 'Volgende pagina';
|
|
9818
9822
|
this.currentPage = 1;
|
|
9823
|
+
this.itemsPerPage = 20;
|
|
9824
|
+
this.totalItems = 1;
|
|
9825
|
+
this.paginationRange = 8;
|
|
9819
9826
|
this.previousClick = new core.EventEmitter();
|
|
9820
9827
|
this.nextClick = new core.EventEmitter();
|
|
9821
9828
|
this.pageClick = new core.EventEmitter();
|
|
9829
|
+
this.pages = [];
|
|
9822
9830
|
}
|
|
9823
9831
|
PaginationBarComponent.prototype.showClass = function () {
|
|
9824
9832
|
return true;
|
|
9825
9833
|
};
|
|
9834
|
+
PaginationBarComponent.prototype.ngOnInit = function () {
|
|
9835
|
+
this.totalPages = Math.ceil(this.totalItems / this.itemsPerPage);
|
|
9836
|
+
this.pages = this._createPageArray();
|
|
9837
|
+
};
|
|
9838
|
+
PaginationBarComponent.prototype.ngOnChanges = function (changes) {
|
|
9839
|
+
if (changes['currentPage'].currentValue !== changes['currentPage'].previousValue) {
|
|
9840
|
+
this.pages = this._createPageArray();
|
|
9841
|
+
}
|
|
9842
|
+
};
|
|
9826
9843
|
PaginationBarComponent.prototype.isOnFirstPage = function () {
|
|
9827
9844
|
return this.currentPage === 1;
|
|
9828
9845
|
};
|
|
@@ -9830,30 +9847,90 @@
|
|
|
9830
9847
|
return this.pages.length === this.currentPage;
|
|
9831
9848
|
};
|
|
9832
9849
|
PaginationBarComponent.prototype.onPreviousClick = function () {
|
|
9833
|
-
this.
|
|
9850
|
+
if (!this.isOnFirstPage()) {
|
|
9851
|
+
this.previousClick.emit();
|
|
9852
|
+
}
|
|
9834
9853
|
};
|
|
9835
9854
|
PaginationBarComponent.prototype.onNextClick = function () {
|
|
9836
|
-
this.
|
|
9855
|
+
if (!this.isOnLastPage()) {
|
|
9856
|
+
this.nextClick.emit();
|
|
9857
|
+
}
|
|
9837
9858
|
};
|
|
9838
9859
|
PaginationBarComponent.prototype.onPageClick = function (value) {
|
|
9839
9860
|
this.currentPage = value;
|
|
9840
9861
|
this.pageClick.emit(value);
|
|
9841
9862
|
};
|
|
9863
|
+
// Returns an array of IPage objects to use in the pagination controls.
|
|
9864
|
+
PaginationBarComponent.prototype._createPageArray = function () {
|
|
9865
|
+
// paginationRange could be a string if passed from attribute, so cast to number.
|
|
9866
|
+
this.paginationRange = +this.paginationRange;
|
|
9867
|
+
var pages = [];
|
|
9868
|
+
var halfWay = Math.ceil(this.paginationRange / 2);
|
|
9869
|
+
var isStart = this.currentPage <= halfWay;
|
|
9870
|
+
var isEnd = this.totalPages - halfWay < this.currentPage;
|
|
9871
|
+
var isMiddle = !isStart && !isEnd;
|
|
9872
|
+
var ellipsesNeeded = this.paginationRange < this.totalPages;
|
|
9873
|
+
var i = 1;
|
|
9874
|
+
while (i <= this.totalPages && i <= this.paginationRange) {
|
|
9875
|
+
var label = void 0;
|
|
9876
|
+
var pageNumber = this._calculatePageNumber(i);
|
|
9877
|
+
var openingEllipsesNeeded = (i === 2 && (isMiddle || isEnd));
|
|
9878
|
+
var closingEllipsesNeeded = (i === this.paginationRange - 1 && (isMiddle || isStart));
|
|
9879
|
+
if (ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)) {
|
|
9880
|
+
label = '...';
|
|
9881
|
+
}
|
|
9882
|
+
else {
|
|
9883
|
+
label = '' + pageNumber;
|
|
9884
|
+
}
|
|
9885
|
+
pages.push({
|
|
9886
|
+
label: label,
|
|
9887
|
+
value: pageNumber
|
|
9888
|
+
});
|
|
9889
|
+
i++;
|
|
9890
|
+
}
|
|
9891
|
+
return pages;
|
|
9892
|
+
};
|
|
9893
|
+
// Given the position in the sequence of pagination links [i], figure out what page number corresponds to that position.
|
|
9894
|
+
PaginationBarComponent.prototype._calculatePageNumber = function (i) {
|
|
9895
|
+
var halfWay = Math.ceil(this.paginationRange / 2);
|
|
9896
|
+
if (i === this.paginationRange) {
|
|
9897
|
+
return this.totalPages;
|
|
9898
|
+
}
|
|
9899
|
+
else if (i === 1) {
|
|
9900
|
+
return i;
|
|
9901
|
+
}
|
|
9902
|
+
else if (this.paginationRange < this.totalPages) {
|
|
9903
|
+
if (this.totalPages - halfWay < this.currentPage) {
|
|
9904
|
+
return this.totalPages - this.paginationRange + i;
|
|
9905
|
+
}
|
|
9906
|
+
else if (halfWay < this.currentPage) {
|
|
9907
|
+
return this.currentPage - halfWay + i;
|
|
9908
|
+
}
|
|
9909
|
+
else {
|
|
9910
|
+
return i;
|
|
9911
|
+
}
|
|
9912
|
+
}
|
|
9913
|
+
else {
|
|
9914
|
+
return i;
|
|
9915
|
+
}
|
|
9916
|
+
};
|
|
9842
9917
|
return PaginationBarComponent;
|
|
9843
9918
|
}());
|
|
9844
9919
|
PaginationBarComponent.decorators = [
|
|
9845
9920
|
{ type: core.Component, args: [{
|
|
9846
9921
|
selector: "co-pagination-bar",
|
|
9847
|
-
template: "\n <ul class=\"pagination\">\n <li *ngIf=\"directionLinks\" class=\"pagination-previous\">\n <a (click)=\"onPreviousClick()\" [class.disabled]=\"isOnFirstPage()\">{{ previousLabel }}</a>\n </li>\n <li *ngFor=\"let page of pages\" [class.current]=\"currentPage === page.value\" (click)=\"onPageClick(page.value)\">\n <span>{{page.label}}</span>\n </li>\n <li *ngIf=\"directionLinks\" class=\"pagination-next\">\n <a (click)=\"onNextClick()\" [class.disabled]=\"isOnLastPage()\">{{ nextLabel }}</a>\n </li>\n </ul>\n ",
|
|
9922
|
+
template: "\n <ul class=\"pagination\">\n <li *ngIf=\"directionLinks\" class=\"pagination-previous\" [class.disabled]=\"isOnFirstPage()\">\n <a (click)=\"onPreviousClick()\" [class.disabled]=\"isOnFirstPage()\">{{ previousLabel }}</a>\n </li>\n <li *ngFor=\"let page of pages\" [class.current]=\"currentPage === page.value\" (click)=\"onPageClick(page.value)\">\n <span>{{page.label}}</span>\n </li>\n <li *ngIf=\"directionLinks\" class=\"pagination-next\" [class.disabled]=\"isOnLastPage()\">\n <a (click)=\"onNextClick()\" [class.disabled]=\"isOnLastPage()\">{{ nextLabel }}</a>\n </li>\n </ul>\n ",
|
|
9848
9923
|
encapsulation: core.ViewEncapsulation.None
|
|
9849
9924
|
},] }
|
|
9850
9925
|
];
|
|
9851
9926
|
PaginationBarComponent.propDecorators = {
|
|
9852
|
-
pages: [{ type: core.Input }],
|
|
9853
9927
|
directionLinks: [{ type: core.Input }],
|
|
9854
9928
|
previousLabel: [{ type: core.Input }],
|
|
9855
9929
|
nextLabel: [{ type: core.Input }],
|
|
9856
9930
|
currentPage: [{ type: core.Input }],
|
|
9931
|
+
itemsPerPage: [{ type: core.Input }],
|
|
9932
|
+
totalItems: [{ type: core.Input }],
|
|
9933
|
+
paginationRange: [{ type: core.Input }],
|
|
9857
9934
|
previousClick: [{ type: core.Output }],
|
|
9858
9935
|
nextClick: [{ type: core.Output }],
|
|
9859
9936
|
pageClick: [{ type: core.Output }],
|
|
@@ -10087,7 +10164,8 @@
|
|
|
10087
10164
|
// Emits the new page number.
|
|
10088
10165
|
this.pageChange = new core.EventEmitter();
|
|
10089
10166
|
this.showClass = true;
|
|
10090
|
-
this.
|
|
10167
|
+
this.totalItems = 1;
|
|
10168
|
+
this.itemsPerPage = 20;
|
|
10091
10169
|
this.changeSub = this._paginationService.change.subscribe(function (id) {
|
|
10092
10170
|
if (_this.id === id) {
|
|
10093
10171
|
_this._updatePageLinks();
|
|
@@ -10146,11 +10224,12 @@
|
|
|
10146
10224
|
*/
|
|
10147
10225
|
PaginationComponent.prototype._updatePageLinks = function () {
|
|
10148
10226
|
var paginationInstance = this._paginationService.getInstance(this.id);
|
|
10149
|
-
this.pages = this.createPageArray(paginationInstance.currentPage, paginationInstance.itemsPerPage, paginationInstance.totalItems, this.maxSize);
|
|
10150
10227
|
var correctedCurrentPage = this.outOfBoundCorrection(paginationInstance);
|
|
10151
10228
|
if (correctedCurrentPage !== paginationInstance.currentPage) {
|
|
10152
10229
|
this.setCurrentPage(correctedCurrentPage);
|
|
10153
10230
|
}
|
|
10231
|
+
this.totalItems = paginationInstance.totalItems;
|
|
10232
|
+
this.itemsPerPage = paginationInstance.itemsPerPage;
|
|
10154
10233
|
};
|
|
10155
10234
|
PaginationComponent.prototype.getCurrentPage = function () {
|
|
10156
10235
|
return this._paginationService.getCurrentPage(this.id);
|
|
@@ -10173,67 +10252,12 @@
|
|
|
10173
10252
|
}
|
|
10174
10253
|
return instance.currentPage;
|
|
10175
10254
|
};
|
|
10176
|
-
// Returns an array of IPage objects to use in the pagination controls.
|
|
10177
|
-
PaginationComponent.prototype.createPageArray = function (currentPage, itemsPerPage, totalItems, paginationRange) {
|
|
10178
|
-
// paginationRange could be a string if passed from attribute, so cast to number.
|
|
10179
|
-
paginationRange = +paginationRange;
|
|
10180
|
-
var pages = [];
|
|
10181
|
-
var totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
10182
|
-
var halfWay = Math.ceil(paginationRange / 2);
|
|
10183
|
-
var isStart = currentPage <= halfWay;
|
|
10184
|
-
var isEnd = totalPages - halfWay < currentPage;
|
|
10185
|
-
var isMiddle = !isStart && !isEnd;
|
|
10186
|
-
var ellipsesNeeded = paginationRange < totalPages;
|
|
10187
|
-
var i = 1;
|
|
10188
|
-
while (i <= totalPages && i <= paginationRange) {
|
|
10189
|
-
var label = void 0;
|
|
10190
|
-
var pageNumber = this.calculatePageNumber(i, currentPage, paginationRange, totalPages);
|
|
10191
|
-
var openingEllipsesNeeded = (i === 2 && (isMiddle || isEnd));
|
|
10192
|
-
var closingEllipsesNeeded = (i === paginationRange - 1 && (isMiddle || isStart));
|
|
10193
|
-
if (ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)) {
|
|
10194
|
-
label = '...';
|
|
10195
|
-
}
|
|
10196
|
-
else {
|
|
10197
|
-
label = '' + pageNumber;
|
|
10198
|
-
}
|
|
10199
|
-
pages.push({
|
|
10200
|
-
label: label,
|
|
10201
|
-
value: pageNumber
|
|
10202
|
-
});
|
|
10203
|
-
i++;
|
|
10204
|
-
}
|
|
10205
|
-
return pages;
|
|
10206
|
-
};
|
|
10207
|
-
// Given the position in the sequence of pagination links [i], figure out what page number corresponds to that position.
|
|
10208
|
-
PaginationComponent.prototype.calculatePageNumber = function (i, currentPage, paginationRange, totalPages) {
|
|
10209
|
-
var halfWay = Math.ceil(paginationRange / 2);
|
|
10210
|
-
if (i === paginationRange) {
|
|
10211
|
-
return totalPages;
|
|
10212
|
-
}
|
|
10213
|
-
else if (i === 1) {
|
|
10214
|
-
return i;
|
|
10215
|
-
}
|
|
10216
|
-
else if (paginationRange < totalPages) {
|
|
10217
|
-
if (totalPages - halfWay < currentPage) {
|
|
10218
|
-
return totalPages - paginationRange + i;
|
|
10219
|
-
}
|
|
10220
|
-
else if (halfWay < currentPage) {
|
|
10221
|
-
return currentPage - halfWay + i;
|
|
10222
|
-
}
|
|
10223
|
-
else {
|
|
10224
|
-
return i;
|
|
10225
|
-
}
|
|
10226
|
-
}
|
|
10227
|
-
else {
|
|
10228
|
-
return i;
|
|
10229
|
-
}
|
|
10230
|
-
};
|
|
10231
10255
|
return PaginationComponent;
|
|
10232
10256
|
}());
|
|
10233
10257
|
PaginationComponent.decorators = [
|
|
10234
10258
|
{ type: core.Component, args: [{
|
|
10235
10259
|
selector: 'co-pagination',
|
|
10236
|
-
template: "\n <div class=\"pagination-component-main-wrapper\" *ngIf=\"!shouldBeHidden()\">\n <div>\n <ng-content></ng-content>\n </div>\n\n <co-pagination-bar\n [
|
|
10260
|
+
template: "\n <div class=\"pagination-component-main-wrapper\" *ngIf=\"!shouldBeHidden()\">\n <div>\n <ng-content></ng-content>\n </div>\n\n <co-pagination-bar\n [currentPage]=\"getCurrentPage()\"\n [totalItems]=\"totalItems\"\n [itemsPerPage]=\"itemsPerPage\"\n [directionLinks]=\"directionLinks\"\n [previousLabel]=\"previousLabel\"\n [nextLabel]=\"nextLabel\"\n (previousClick)=\"goToPreviousPage()\"\n (nextClick)=\"goToNextPage()\"\n (pageClick)=\"setCurrentPage($event)\"\n ></co-pagination-bar>\n </div>\n ",
|
|
10237
10261
|
encapsulation: core.ViewEncapsulation.None
|
|
10238
10262
|
},] }
|
|
10239
10263
|
];
|
|
@@ -10550,7 +10574,8 @@
|
|
|
10550
10574
|
InputTextModule,
|
|
10551
10575
|
FormModule,
|
|
10552
10576
|
ObserveVisibilityModule,
|
|
10553
|
-
PaginationModule
|
|
10577
|
+
PaginationModule,
|
|
10578
|
+
PaginationBarModule
|
|
10554
10579
|
],
|
|
10555
10580
|
declarations: [
|
|
10556
10581
|
SimpleGridComponent,
|