@colijnit/corecomponents_v12 12.0.51 → 12.0.52

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.
@@ -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; })
@@ -9811,18 +9811,30 @@
9811
9811
 
9812
9812
  var PaginationBarComponent = /** @class */ (function () {
9813
9813
  function PaginationBarComponent() {
9814
- this.pages = [];
9815
9814
  this.directionLinks = true;
9816
9815
  this.previousLabel = 'Vorige pagina';
9817
9816
  this.nextLabel = 'Volgende pagina';
9818
9817
  this.currentPage = 1;
9818
+ this.itemsPerPage = 20;
9819
+ this.totalItems = 1;
9820
+ this.paginationRange = 8;
9819
9821
  this.previousClick = new core.EventEmitter();
9820
9822
  this.nextClick = new core.EventEmitter();
9821
9823
  this.pageClick = new core.EventEmitter();
9824
+ this.pages = [];
9822
9825
  }
9823
9826
  PaginationBarComponent.prototype.showClass = function () {
9824
9827
  return true;
9825
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
+ };
9826
9838
  PaginationBarComponent.prototype.isOnFirstPage = function () {
9827
9839
  return this.currentPage === 1;
9828
9840
  };
@@ -9839,6 +9851,60 @@
9839
9851
  this.currentPage = value;
9840
9852
  this.pageClick.emit(value);
9841
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
+ };
9842
9908
  return PaginationBarComponent;
9843
9909
  }());
9844
9910
  PaginationBarComponent.decorators = [
@@ -9849,11 +9915,13 @@
9849
9915
  },] }
9850
9916
  ];
9851
9917
  PaginationBarComponent.propDecorators = {
9852
- pages: [{ type: core.Input }],
9853
9918
  directionLinks: [{ type: core.Input }],
9854
9919
  previousLabel: [{ type: core.Input }],
9855
9920
  nextLabel: [{ type: core.Input }],
9856
9921
  currentPage: [{ type: core.Input }],
9922
+ itemsPerPage: [{ type: core.Input }],
9923
+ totalItems: [{ type: core.Input }],
9924
+ paginationRange: [{ type: core.Input }],
9857
9925
  previousClick: [{ type: core.Output }],
9858
9926
  nextClick: [{ type: core.Output }],
9859
9927
  pageClick: [{ type: core.Output }],
@@ -10087,7 +10155,8 @@
10087
10155
  // Emits the new page number.
10088
10156
  this.pageChange = new core.EventEmitter();
10089
10157
  this.showClass = true;
10090
- this.pages = [];
10158
+ this.totalItems = 1;
10159
+ this.itemsPerPage = 20;
10091
10160
  this.changeSub = this._paginationService.change.subscribe(function (id) {
10092
10161
  if (_this.id === id) {
10093
10162
  _this._updatePageLinks();
@@ -10146,11 +10215,12 @@
10146
10215
  */
10147
10216
  PaginationComponent.prototype._updatePageLinks = function () {
10148
10217
  var paginationInstance = this._paginationService.getInstance(this.id);
10149
- this.pages = this.createPageArray(paginationInstance.currentPage, paginationInstance.itemsPerPage, paginationInstance.totalItems, this.maxSize);
10150
10218
  var correctedCurrentPage = this.outOfBoundCorrection(paginationInstance);
10151
10219
  if (correctedCurrentPage !== paginationInstance.currentPage) {
10152
10220
  this.setCurrentPage(correctedCurrentPage);
10153
10221
  }
10222
+ this.totalItems = paginationInstance.totalItems;
10223
+ this.itemsPerPage = paginationInstance.itemsPerPage;
10154
10224
  };
10155
10225
  PaginationComponent.prototype.getCurrentPage = function () {
10156
10226
  return this._paginationService.getCurrentPage(this.id);
@@ -10173,67 +10243,12 @@
10173
10243
  }
10174
10244
  return instance.currentPage;
10175
10245
  };
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
10246
  return PaginationComponent;
10232
10247
  }());
10233
10248
  PaginationComponent.decorators = [
10234
10249
  { type: core.Component, args: [{
10235
10250
  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 [pages]=\"pages\"\n [directionLinks]=\"directionLinks\"\n [previousLabel]=\"previousLabel\"\n [nextLabel]=\"nextLabel\"\n [currentPage]=\"getCurrentPage()\"\n (previousClick)=\"goToPreviousPage()\"\n (nextClick)=\"goToNextPage()\"\n (pageClick)=\"setCurrentPage($event)\"\n ></co-pagination-bar>\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 ",
10237
10252
  encapsulation: core.ViewEncapsulation.None
10238
10253
  },] }
10239
10254
  ];