@colijnit/corecomponents_v12 12.0.50 → 12.0.53
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 +254 -166
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/input-date-picker/input-date-picker.component.js +2 -1
- package/esm2015/lib/components/input-date-range-picker/input-date-range-picker.component.js +4 -3
- package/esm2015/lib/components/pagination/pagination.component.js +17 -69
- package/esm2015/lib/components/pagination/pagination.module.js +6 -4
- package/esm2015/lib/components/pagination/pagination.service.js +1 -1
- package/esm2015/lib/components/pagination-bar/pagination-bar.component.js +131 -0
- package/esm2015/lib/components/pagination-bar/pagination-bar.module.js +19 -0
- package/esm2015/public-api.js +3 -1
- package/fesm2015/colijnit-corecomponents_v12.js +273 -176
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/pagination/pagination.component.d.ts +3 -8
- package/lib/components/pagination/style/_layout.scss +0 -70
- package/lib/components/pagination/style/material.scss +1 -0
- package/lib/components/pagination-bar/pagination-bar.component.d.ts +29 -0
- package/lib/components/pagination-bar/pagination-bar.module.d.ts +2 -0
- package/lib/components/pagination-bar/style/_layout.scss +67 -0
- package/lib/components/pagination-bar/style/_material-definition.scss +3 -0
- package/lib/components/pagination-bar/style/_theme.scss +24 -0
- package/lib/components/pagination-bar/style/material.scss +3 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -6352,7 +6352,7 @@
|
|
|
6352
6352
|
InputDatePickerComponent.decorators = [
|
|
6353
6353
|
{ type: core.Component, args: [{
|
|
6354
6354
|
selector: "co-input-date",
|
|
6355
|
-
template: "\n <ejs-datepicker #ejsDatePicker\n floatLabelType=\"Auto\"\n [format]=\"dateFormat\"\n [placeholder]=\"placeholder\"\n [ngModel]=\"model\"\n (ngModelChange)=\"modelChange.emit($event)\"\n ></ejs-datepicker>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
|
|
6355
|
+
template: "\n <ejs-datepicker #ejsDatePicker\n floatLabelType=\"Auto\"\n [format]=\"dateFormat\"\n [placeholder]=\"placeholder\"\n [ngModel]=\"model\"\n [readonly]=\"readonly\"\n (ngModelChange)=\"modelChange.emit($event)\"\n ></ejs-datepicker>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
|
|
6356
6356
|
providers: [{
|
|
6357
6357
|
provide: COMPONENT_INTERFACE_NAME, useExisting: core.forwardRef(function () { return InputDatePickerComponent; })
|
|
6358
6358
|
}, {
|
|
@@ -6434,7 +6434,7 @@
|
|
|
6434
6434
|
InputDateRangePickerComponent.decorators = [
|
|
6435
6435
|
{ type: core.Component, args: [{
|
|
6436
6436
|
selector: "co-input-date-range",
|
|
6437
|
-
template: "\n <ejs-daterangepicker\n [format]=\"dateFormat\"\n [placeholder]=\"placeholder\"\n [ngModel]=\"model\"\n (ngModelChange)=\"rangeChange()\"\n (close)=\"close.next($event)\"\n (select)=\"select.next($event)\"\n (cleared)=\"cleared.next($event)\"\n
|
|
6437
|
+
template: "\n <ejs-daterangepicker\n [format]=\"dateFormat\"\n [placeholder]=\"placeholder\"\n [ngModel]=\"model\"\n [(startDate)]=\"startDate\"\n [(endDate)]=\"endDate\"\n [readonly]=\"readonly\"\n (ngModelChange)=\"rangeChange()\"\n (close)=\"close.next($event)\"\n (select)=\"select.next($event)\"\n (cleared)=\"cleared.next($event)\"\n ></ejs-daterangepicker>\n <div class=\"required-indicator\"></div>\n <ng-template #validationError></ng-template>\n ",
|
|
6438
6438
|
encapsulation: core.ViewEncapsulation.None
|
|
6439
6439
|
},] }
|
|
6440
6440
|
];
|
|
@@ -9809,6 +9809,144 @@
|
|
|
9809
9809
|
handleKeyDown: [{ type: core.HostListener, args: ['keydown', ['$event'],] }]
|
|
9810
9810
|
};
|
|
9811
9811
|
|
|
9812
|
+
var PaginationBarComponent = /** @class */ (function () {
|
|
9813
|
+
function PaginationBarComponent() {
|
|
9814
|
+
this.directionLinks = true;
|
|
9815
|
+
this.previousLabel = 'Vorige pagina';
|
|
9816
|
+
this.nextLabel = 'Volgende pagina';
|
|
9817
|
+
this.currentPage = 1;
|
|
9818
|
+
this.itemsPerPage = 20;
|
|
9819
|
+
this.totalItems = 1;
|
|
9820
|
+
this.paginationRange = 8;
|
|
9821
|
+
this.previousClick = new core.EventEmitter();
|
|
9822
|
+
this.nextClick = new core.EventEmitter();
|
|
9823
|
+
this.pageClick = new core.EventEmitter();
|
|
9824
|
+
this.pages = [];
|
|
9825
|
+
}
|
|
9826
|
+
PaginationBarComponent.prototype.showClass = function () {
|
|
9827
|
+
return true;
|
|
9828
|
+
};
|
|
9829
|
+
PaginationBarComponent.prototype.ngOnInit = function () {
|
|
9830
|
+
this.totalPages = Math.ceil(this.totalItems / this.itemsPerPage);
|
|
9831
|
+
this.pages = this._createPageArray();
|
|
9832
|
+
};
|
|
9833
|
+
PaginationBarComponent.prototype.ngOnChanges = function (changes) {
|
|
9834
|
+
if (changes['currentPage'].currentValue !== changes['currentPage'].previousValue) {
|
|
9835
|
+
this.pages = this._createPageArray();
|
|
9836
|
+
}
|
|
9837
|
+
};
|
|
9838
|
+
PaginationBarComponent.prototype.isOnFirstPage = function () {
|
|
9839
|
+
return this.currentPage === 1;
|
|
9840
|
+
};
|
|
9841
|
+
PaginationBarComponent.prototype.isOnLastPage = function () {
|
|
9842
|
+
return this.pages.length === this.currentPage;
|
|
9843
|
+
};
|
|
9844
|
+
PaginationBarComponent.prototype.onPreviousClick = function () {
|
|
9845
|
+
this.previousClick.emit();
|
|
9846
|
+
};
|
|
9847
|
+
PaginationBarComponent.prototype.onNextClick = function () {
|
|
9848
|
+
this.nextClick.emit();
|
|
9849
|
+
};
|
|
9850
|
+
PaginationBarComponent.prototype.onPageClick = function (value) {
|
|
9851
|
+
this.currentPage = value;
|
|
9852
|
+
this.pageClick.emit(value);
|
|
9853
|
+
};
|
|
9854
|
+
// Returns an array of IPage objects to use in the pagination controls.
|
|
9855
|
+
PaginationBarComponent.prototype._createPageArray = function () {
|
|
9856
|
+
// paginationRange could be a string if passed from attribute, so cast to number.
|
|
9857
|
+
this.paginationRange = +this.paginationRange;
|
|
9858
|
+
var pages = [];
|
|
9859
|
+
var halfWay = Math.ceil(this.paginationRange / 2);
|
|
9860
|
+
var isStart = this.currentPage <= halfWay;
|
|
9861
|
+
var isEnd = this.totalPages - halfWay < this.currentPage;
|
|
9862
|
+
var isMiddle = !isStart && !isEnd;
|
|
9863
|
+
var ellipsesNeeded = this.paginationRange < this.totalPages;
|
|
9864
|
+
var i = 1;
|
|
9865
|
+
while (i <= this.totalPages && i <= this.paginationRange) {
|
|
9866
|
+
var label = void 0;
|
|
9867
|
+
var pageNumber = this._calculatePageNumber(i);
|
|
9868
|
+
var openingEllipsesNeeded = (i === 2 && (isMiddle || isEnd));
|
|
9869
|
+
var closingEllipsesNeeded = (i === this.paginationRange - 1 && (isMiddle || isStart));
|
|
9870
|
+
if (ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)) {
|
|
9871
|
+
label = '...';
|
|
9872
|
+
}
|
|
9873
|
+
else {
|
|
9874
|
+
label = '' + pageNumber;
|
|
9875
|
+
}
|
|
9876
|
+
pages.push({
|
|
9877
|
+
label: label,
|
|
9878
|
+
value: pageNumber
|
|
9879
|
+
});
|
|
9880
|
+
i++;
|
|
9881
|
+
}
|
|
9882
|
+
return pages;
|
|
9883
|
+
};
|
|
9884
|
+
// Given the position in the sequence of pagination links [i], figure out what page number corresponds to that position.
|
|
9885
|
+
PaginationBarComponent.prototype._calculatePageNumber = function (i) {
|
|
9886
|
+
var halfWay = Math.ceil(this.paginationRange / 2);
|
|
9887
|
+
if (i === this.paginationRange) {
|
|
9888
|
+
return this.totalPages;
|
|
9889
|
+
}
|
|
9890
|
+
else if (i === 1) {
|
|
9891
|
+
return i;
|
|
9892
|
+
}
|
|
9893
|
+
else if (this.paginationRange < this.totalPages) {
|
|
9894
|
+
if (this.totalPages - halfWay < this.currentPage) {
|
|
9895
|
+
return this.totalPages - this.paginationRange + i;
|
|
9896
|
+
}
|
|
9897
|
+
else if (halfWay < this.currentPage) {
|
|
9898
|
+
return this.currentPage - halfWay + i;
|
|
9899
|
+
}
|
|
9900
|
+
else {
|
|
9901
|
+
return i;
|
|
9902
|
+
}
|
|
9903
|
+
}
|
|
9904
|
+
else {
|
|
9905
|
+
return i;
|
|
9906
|
+
}
|
|
9907
|
+
};
|
|
9908
|
+
return PaginationBarComponent;
|
|
9909
|
+
}());
|
|
9910
|
+
PaginationBarComponent.decorators = [
|
|
9911
|
+
{ type: core.Component, args: [{
|
|
9912
|
+
selector: "co-pagination-bar",
|
|
9913
|
+
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 ",
|
|
9914
|
+
encapsulation: core.ViewEncapsulation.None
|
|
9915
|
+
},] }
|
|
9916
|
+
];
|
|
9917
|
+
PaginationBarComponent.propDecorators = {
|
|
9918
|
+
directionLinks: [{ type: core.Input }],
|
|
9919
|
+
previousLabel: [{ type: core.Input }],
|
|
9920
|
+
nextLabel: [{ type: core.Input }],
|
|
9921
|
+
currentPage: [{ type: core.Input }],
|
|
9922
|
+
itemsPerPage: [{ type: core.Input }],
|
|
9923
|
+
totalItems: [{ type: core.Input }],
|
|
9924
|
+
paginationRange: [{ type: core.Input }],
|
|
9925
|
+
previousClick: [{ type: core.Output }],
|
|
9926
|
+
nextClick: [{ type: core.Output }],
|
|
9927
|
+
pageClick: [{ type: core.Output }],
|
|
9928
|
+
showClass: [{ type: core.HostBinding, args: ["class.co-pagination-bar",] }]
|
|
9929
|
+
};
|
|
9930
|
+
|
|
9931
|
+
var PaginationBarModule = /** @class */ (function () {
|
|
9932
|
+
function PaginationBarModule() {
|
|
9933
|
+
}
|
|
9934
|
+
return PaginationBarModule;
|
|
9935
|
+
}());
|
|
9936
|
+
PaginationBarModule.decorators = [
|
|
9937
|
+
{ type: core.NgModule, args: [{
|
|
9938
|
+
imports: [
|
|
9939
|
+
common.CommonModule
|
|
9940
|
+
],
|
|
9941
|
+
declarations: [
|
|
9942
|
+
PaginationBarComponent
|
|
9943
|
+
],
|
|
9944
|
+
exports: [
|
|
9945
|
+
PaginationBarComponent
|
|
9946
|
+
]
|
|
9947
|
+
},] }
|
|
9948
|
+
];
|
|
9949
|
+
|
|
9812
9950
|
var PaginationService = /** @class */ (function () {
|
|
9813
9951
|
function PaginationService() {
|
|
9814
9952
|
this.change = new rxjs.Subject();
|
|
@@ -9900,6 +10038,111 @@
|
|
|
9900
10038
|
];
|
|
9901
10039
|
PaginationService.ctorParameters = function () { return []; };
|
|
9902
10040
|
|
|
10041
|
+
var LARGE_NUMBER = 999999999;
|
|
10042
|
+
var PaginatePipe = /** @class */ (function () {
|
|
10043
|
+
function PaginatePipe(paginateService) {
|
|
10044
|
+
this.paginateService = paginateService;
|
|
10045
|
+
// store the values from the last time the pipe
|
|
10046
|
+
this.state = {};
|
|
10047
|
+
}
|
|
10048
|
+
PaginatePipe.prototype.transform = function (collection, args) {
|
|
10049
|
+
// When an observable is passed through the AsyncPipe, it will output
|
|
10050
|
+
// `null` until the subscription resolves. In this case, we want to
|
|
10051
|
+
// use the cached data from the `state` object to prevent the NgFor
|
|
10052
|
+
// from flashing empty until the real values arrive.
|
|
10053
|
+
if (!(collection instanceof Array)) {
|
|
10054
|
+
var _id = args.id || this.paginateService.DEFAULT_ID;
|
|
10055
|
+
if (this.state[_id]) {
|
|
10056
|
+
return this.state[_id].slice;
|
|
10057
|
+
}
|
|
10058
|
+
else {
|
|
10059
|
+
return collection;
|
|
10060
|
+
}
|
|
10061
|
+
}
|
|
10062
|
+
var serverSideMode = args.totalItems !== undefined;
|
|
10063
|
+
var instance = this._createInstance(collection, args);
|
|
10064
|
+
var id = instance.id;
|
|
10065
|
+
var start;
|
|
10066
|
+
var end;
|
|
10067
|
+
var perPage = instance.itemsPerPage;
|
|
10068
|
+
this.paginateService.register(instance);
|
|
10069
|
+
if (!serverSideMode && collection instanceof Array) {
|
|
10070
|
+
perPage = perPage || LARGE_NUMBER;
|
|
10071
|
+
start = (instance.currentPage - 1) * perPage;
|
|
10072
|
+
end = start + perPage;
|
|
10073
|
+
var isIdentical = this._stateIsIdentical(id, collection, start, end);
|
|
10074
|
+
if (isIdentical) {
|
|
10075
|
+
return this.state[id].slice;
|
|
10076
|
+
}
|
|
10077
|
+
else {
|
|
10078
|
+
var slice = collection.slice(start, end);
|
|
10079
|
+
this._saveState(id, collection, slice, start, end);
|
|
10080
|
+
this.paginateService.change.next(id);
|
|
10081
|
+
return slice;
|
|
10082
|
+
}
|
|
10083
|
+
}
|
|
10084
|
+
// save the state for server-side collection to avoid null
|
|
10085
|
+
// flash as new data loads.
|
|
10086
|
+
this._saveState(id, collection, collection, start, end);
|
|
10087
|
+
return collection;
|
|
10088
|
+
};
|
|
10089
|
+
// Create an IPaginationInstance object, using defaults for any optional properties not supplied.
|
|
10090
|
+
PaginatePipe.prototype._createInstance = function (collection, args) {
|
|
10091
|
+
var config = args;
|
|
10092
|
+
this._checkConfig(config);
|
|
10093
|
+
return {
|
|
10094
|
+
id: config.id || this.paginateService.DEFAULT_ID,
|
|
10095
|
+
itemsPerPage: config.itemsPerPage || 0,
|
|
10096
|
+
currentPage: config.currentPage || 1,
|
|
10097
|
+
totalItems: config.totalItems || collection.length
|
|
10098
|
+
};
|
|
10099
|
+
};
|
|
10100
|
+
// Ensure the argument passed to the filter contains the required properties.
|
|
10101
|
+
PaginatePipe.prototype._checkConfig = function (config) {
|
|
10102
|
+
var required = ["itemsPerPage", "currentPage"];
|
|
10103
|
+
var missing = required.filter(function (prop) { return !config.hasOwnProperty(prop); });
|
|
10104
|
+
if (0 < missing.length) {
|
|
10105
|
+
throw new Error("PaginatePipe: Argument is missing the following required properties: " + missing.join(", "));
|
|
10106
|
+
}
|
|
10107
|
+
};
|
|
10108
|
+
/**
|
|
10109
|
+
* To avoid returning a brand new array each time the pipe is run, we store the state of the sliced
|
|
10110
|
+
* array for a given id. This means that the next time the pipe is run on this collection & id, we just
|
|
10111
|
+
* need to check that the collection, start and end points are all identical, and if so, return the
|
|
10112
|
+
* last sliced array.
|
|
10113
|
+
*/
|
|
10114
|
+
PaginatePipe.prototype._saveState = function (id, collection, slice, start, end) {
|
|
10115
|
+
this.state[id] = {
|
|
10116
|
+
collection: collection,
|
|
10117
|
+
size: collection.length,
|
|
10118
|
+
slice: slice,
|
|
10119
|
+
start: start,
|
|
10120
|
+
end: end
|
|
10121
|
+
};
|
|
10122
|
+
};
|
|
10123
|
+
// For a given id, returns true if the collection, size, start and end values are identical.
|
|
10124
|
+
PaginatePipe.prototype._stateIsIdentical = function (id, collection, start, end) {
|
|
10125
|
+
var state = this.state[id];
|
|
10126
|
+
if (!state) {
|
|
10127
|
+
return false;
|
|
10128
|
+
}
|
|
10129
|
+
return state.collection === collection &&
|
|
10130
|
+
state.size === collection.length &&
|
|
10131
|
+
state.start === start &&
|
|
10132
|
+
state.end === end;
|
|
10133
|
+
};
|
|
10134
|
+
return PaginatePipe;
|
|
10135
|
+
}());
|
|
10136
|
+
PaginatePipe.decorators = [
|
|
10137
|
+
{ type: core.Pipe, args: [{
|
|
10138
|
+
name: 'paginate',
|
|
10139
|
+
pure: false
|
|
10140
|
+
},] }
|
|
10141
|
+
];
|
|
10142
|
+
PaginatePipe.ctorParameters = function () { return [
|
|
10143
|
+
{ type: PaginationService }
|
|
10144
|
+
]; };
|
|
10145
|
+
|
|
9903
10146
|
var PaginationComponent = /** @class */ (function () {
|
|
9904
10147
|
function PaginationComponent(_paginationService) {
|
|
9905
10148
|
var _this = this;
|
|
@@ -9912,7 +10155,8 @@
|
|
|
9912
10155
|
// Emits the new page number.
|
|
9913
10156
|
this.pageChange = new core.EventEmitter();
|
|
9914
10157
|
this.showClass = true;
|
|
9915
|
-
this.
|
|
10158
|
+
this.totalItems = 1;
|
|
10159
|
+
this.itemsPerPage = 20;
|
|
9916
10160
|
this.changeSub = this._paginationService.change.subscribe(function (id) {
|
|
9917
10161
|
if (_this.id === id) {
|
|
9918
10162
|
_this._updatePageLinks();
|
|
@@ -9971,11 +10215,12 @@
|
|
|
9971
10215
|
*/
|
|
9972
10216
|
PaginationComponent.prototype._updatePageLinks = function () {
|
|
9973
10217
|
var paginationInstance = this._paginationService.getInstance(this.id);
|
|
9974
|
-
this.pages = this.createPageArray(paginationInstance.currentPage, paginationInstance.itemsPerPage, paginationInstance.totalItems, this.maxSize);
|
|
9975
10218
|
var correctedCurrentPage = this.outOfBoundCorrection(paginationInstance);
|
|
9976
10219
|
if (correctedCurrentPage !== paginationInstance.currentPage) {
|
|
9977
10220
|
this.setCurrentPage(correctedCurrentPage);
|
|
9978
10221
|
}
|
|
10222
|
+
this.totalItems = paginationInstance.totalItems;
|
|
10223
|
+
this.itemsPerPage = paginationInstance.itemsPerPage;
|
|
9979
10224
|
};
|
|
9980
10225
|
PaginationComponent.prototype.getCurrentPage = function () {
|
|
9981
10226
|
return this._paginationService.getCurrentPage(this.id);
|
|
@@ -9998,67 +10243,12 @@
|
|
|
9998
10243
|
}
|
|
9999
10244
|
return instance.currentPage;
|
|
10000
10245
|
};
|
|
10001
|
-
// Returns an array of IPage objects to use in the pagination controls.
|
|
10002
|
-
PaginationComponent.prototype.createPageArray = function (currentPage, itemsPerPage, totalItems, paginationRange) {
|
|
10003
|
-
// paginationRange could be a string if passed from attribute, so cast to number.
|
|
10004
|
-
paginationRange = +paginationRange;
|
|
10005
|
-
var pages = [];
|
|
10006
|
-
var totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
10007
|
-
var halfWay = Math.ceil(paginationRange / 2);
|
|
10008
|
-
var isStart = currentPage <= halfWay;
|
|
10009
|
-
var isEnd = totalPages - halfWay < currentPage;
|
|
10010
|
-
var isMiddle = !isStart && !isEnd;
|
|
10011
|
-
var ellipsesNeeded = paginationRange < totalPages;
|
|
10012
|
-
var i = 1;
|
|
10013
|
-
while (i <= totalPages && i <= paginationRange) {
|
|
10014
|
-
var label = void 0;
|
|
10015
|
-
var pageNumber = this.calculatePageNumber(i, currentPage, paginationRange, totalPages);
|
|
10016
|
-
var openingEllipsesNeeded = (i === 2 && (isMiddle || isEnd));
|
|
10017
|
-
var closingEllipsesNeeded = (i === paginationRange - 1 && (isMiddle || isStart));
|
|
10018
|
-
if (ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)) {
|
|
10019
|
-
label = '...';
|
|
10020
|
-
}
|
|
10021
|
-
else {
|
|
10022
|
-
label = '' + pageNumber;
|
|
10023
|
-
}
|
|
10024
|
-
pages.push({
|
|
10025
|
-
label: label,
|
|
10026
|
-
value: pageNumber
|
|
10027
|
-
});
|
|
10028
|
-
i++;
|
|
10029
|
-
}
|
|
10030
|
-
return pages;
|
|
10031
|
-
};
|
|
10032
|
-
// Given the position in the sequence of pagination links [i], figure out what page number corresponds to that position.
|
|
10033
|
-
PaginationComponent.prototype.calculatePageNumber = function (i, currentPage, paginationRange, totalPages) {
|
|
10034
|
-
var halfWay = Math.ceil(paginationRange / 2);
|
|
10035
|
-
if (i === paginationRange) {
|
|
10036
|
-
return totalPages;
|
|
10037
|
-
}
|
|
10038
|
-
else if (i === 1) {
|
|
10039
|
-
return i;
|
|
10040
|
-
}
|
|
10041
|
-
else if (paginationRange < totalPages) {
|
|
10042
|
-
if (totalPages - halfWay < currentPage) {
|
|
10043
|
-
return totalPages - paginationRange + i;
|
|
10044
|
-
}
|
|
10045
|
-
else if (halfWay < currentPage) {
|
|
10046
|
-
return currentPage - halfWay + i;
|
|
10047
|
-
}
|
|
10048
|
-
else {
|
|
10049
|
-
return i;
|
|
10050
|
-
}
|
|
10051
|
-
}
|
|
10052
|
-
else {
|
|
10053
|
-
return i;
|
|
10054
|
-
}
|
|
10055
|
-
};
|
|
10056
10246
|
return PaginationComponent;
|
|
10057
10247
|
}());
|
|
10058
10248
|
PaginationComponent.decorators = [
|
|
10059
10249
|
{ type: core.Component, args: [{
|
|
10060
10250
|
selector: 'co-pagination',
|
|
10061
|
-
template: "\n <div class=\"pagination-component-main-wrapper\" *ngIf=\"!shouldBeHidden()\">\n <div>\n <ng-content></ng-content>\n </div>\n <
|
|
10251
|
+
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 ",
|
|
10062
10252
|
encapsulation: core.ViewEncapsulation.None
|
|
10063
10253
|
},] }
|
|
10064
10254
|
];
|
|
@@ -10077,111 +10267,6 @@
|
|
|
10077
10267
|
showClass: [{ type: core.HostBinding, args: ['class.co-pagination',] }]
|
|
10078
10268
|
};
|
|
10079
10269
|
|
|
10080
|
-
var LARGE_NUMBER = 999999999;
|
|
10081
|
-
var PaginatePipe = /** @class */ (function () {
|
|
10082
|
-
function PaginatePipe(paginateService) {
|
|
10083
|
-
this.paginateService = paginateService;
|
|
10084
|
-
// store the values from the last time the pipe
|
|
10085
|
-
this.state = {};
|
|
10086
|
-
}
|
|
10087
|
-
PaginatePipe.prototype.transform = function (collection, args) {
|
|
10088
|
-
// When an observable is passed through the AsyncPipe, it will output
|
|
10089
|
-
// `null` until the subscription resolves. In this case, we want to
|
|
10090
|
-
// use the cached data from the `state` object to prevent the NgFor
|
|
10091
|
-
// from flashing empty until the real values arrive.
|
|
10092
|
-
if (!(collection instanceof Array)) {
|
|
10093
|
-
var _id = args.id || this.paginateService.DEFAULT_ID;
|
|
10094
|
-
if (this.state[_id]) {
|
|
10095
|
-
return this.state[_id].slice;
|
|
10096
|
-
}
|
|
10097
|
-
else {
|
|
10098
|
-
return collection;
|
|
10099
|
-
}
|
|
10100
|
-
}
|
|
10101
|
-
var serverSideMode = args.totalItems !== undefined;
|
|
10102
|
-
var instance = this._createInstance(collection, args);
|
|
10103
|
-
var id = instance.id;
|
|
10104
|
-
var start;
|
|
10105
|
-
var end;
|
|
10106
|
-
var perPage = instance.itemsPerPage;
|
|
10107
|
-
this.paginateService.register(instance);
|
|
10108
|
-
if (!serverSideMode && collection instanceof Array) {
|
|
10109
|
-
perPage = perPage || LARGE_NUMBER;
|
|
10110
|
-
start = (instance.currentPage - 1) * perPage;
|
|
10111
|
-
end = start + perPage;
|
|
10112
|
-
var isIdentical = this._stateIsIdentical(id, collection, start, end);
|
|
10113
|
-
if (isIdentical) {
|
|
10114
|
-
return this.state[id].slice;
|
|
10115
|
-
}
|
|
10116
|
-
else {
|
|
10117
|
-
var slice = collection.slice(start, end);
|
|
10118
|
-
this._saveState(id, collection, slice, start, end);
|
|
10119
|
-
this.paginateService.change.next(id);
|
|
10120
|
-
return slice;
|
|
10121
|
-
}
|
|
10122
|
-
}
|
|
10123
|
-
// save the state for server-side collection to avoid null
|
|
10124
|
-
// flash as new data loads.
|
|
10125
|
-
this._saveState(id, collection, collection, start, end);
|
|
10126
|
-
return collection;
|
|
10127
|
-
};
|
|
10128
|
-
// Create an IPaginationInstance object, using defaults for any optional properties not supplied.
|
|
10129
|
-
PaginatePipe.prototype._createInstance = function (collection, args) {
|
|
10130
|
-
var config = args;
|
|
10131
|
-
this._checkConfig(config);
|
|
10132
|
-
return {
|
|
10133
|
-
id: config.id || this.paginateService.DEFAULT_ID,
|
|
10134
|
-
itemsPerPage: config.itemsPerPage || 0,
|
|
10135
|
-
currentPage: config.currentPage || 1,
|
|
10136
|
-
totalItems: config.totalItems || collection.length
|
|
10137
|
-
};
|
|
10138
|
-
};
|
|
10139
|
-
// Ensure the argument passed to the filter contains the required properties.
|
|
10140
|
-
PaginatePipe.prototype._checkConfig = function (config) {
|
|
10141
|
-
var required = ["itemsPerPage", "currentPage"];
|
|
10142
|
-
var missing = required.filter(function (prop) { return !config.hasOwnProperty(prop); });
|
|
10143
|
-
if (0 < missing.length) {
|
|
10144
|
-
throw new Error("PaginatePipe: Argument is missing the following required properties: " + missing.join(", "));
|
|
10145
|
-
}
|
|
10146
|
-
};
|
|
10147
|
-
/**
|
|
10148
|
-
* To avoid returning a brand new array each time the pipe is run, we store the state of the sliced
|
|
10149
|
-
* array for a given id. This means that the next time the pipe is run on this collection & id, we just
|
|
10150
|
-
* need to check that the collection, start and end points are all identical, and if so, return the
|
|
10151
|
-
* last sliced array.
|
|
10152
|
-
*/
|
|
10153
|
-
PaginatePipe.prototype._saveState = function (id, collection, slice, start, end) {
|
|
10154
|
-
this.state[id] = {
|
|
10155
|
-
collection: collection,
|
|
10156
|
-
size: collection.length,
|
|
10157
|
-
slice: slice,
|
|
10158
|
-
start: start,
|
|
10159
|
-
end: end
|
|
10160
|
-
};
|
|
10161
|
-
};
|
|
10162
|
-
// For a given id, returns true if the collection, size, start and end values are identical.
|
|
10163
|
-
PaginatePipe.prototype._stateIsIdentical = function (id, collection, start, end) {
|
|
10164
|
-
var state = this.state[id];
|
|
10165
|
-
if (!state) {
|
|
10166
|
-
return false;
|
|
10167
|
-
}
|
|
10168
|
-
return state.collection === collection &&
|
|
10169
|
-
state.size === collection.length &&
|
|
10170
|
-
state.start === start &&
|
|
10171
|
-
state.end === end;
|
|
10172
|
-
};
|
|
10173
|
-
return PaginatePipe;
|
|
10174
|
-
}());
|
|
10175
|
-
PaginatePipe.decorators = [
|
|
10176
|
-
{ type: core.Pipe, args: [{
|
|
10177
|
-
name: 'paginate',
|
|
10178
|
-
pure: false
|
|
10179
|
-
},] }
|
|
10180
|
-
];
|
|
10181
|
-
PaginatePipe.ctorParameters = function () { return [
|
|
10182
|
-
{ type: PaginationService }
|
|
10183
|
-
]; };
|
|
10184
|
-
|
|
10185
10270
|
var PaginationModule = /** @class */ (function () {
|
|
10186
10271
|
function PaginationModule() {
|
|
10187
10272
|
}
|
|
@@ -10190,7 +10275,8 @@
|
|
|
10190
10275
|
PaginationModule.decorators = [
|
|
10191
10276
|
{ type: core.NgModule, args: [{
|
|
10192
10277
|
imports: [
|
|
10193
|
-
common.CommonModule
|
|
10278
|
+
common.CommonModule,
|
|
10279
|
+
PaginationBarModule
|
|
10194
10280
|
],
|
|
10195
10281
|
providers: [
|
|
10196
10282
|
PaginationService
|
|
@@ -11017,6 +11103,8 @@
|
|
|
11017
11103
|
exports.MultiSelectListComponent = MultiSelectListComponent;
|
|
11018
11104
|
exports.MultiSelectListModule = MultiSelectListModule;
|
|
11019
11105
|
exports.ObserveVisibilityModule = ObserveVisibilityModule;
|
|
11106
|
+
exports.PaginationBarComponent = PaginationBarComponent;
|
|
11107
|
+
exports.PaginationBarModule = PaginationBarModule;
|
|
11020
11108
|
exports.PaginationComponent = PaginationComponent;
|
|
11021
11109
|
exports.PaginationModule = PaginationModule;
|
|
11022
11110
|
exports.PopupButtonsComponent = PopupButtonsComponent;
|