@colijnit/corecomponents_v12 12.0.54 → 12.0.57

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.
@@ -9792,7 +9792,7 @@
9792
9792
  SimpleGridComponent.decorators = [
9793
9793
  { type: core.Component, args: [{
9794
9794
  selector: 'co-simple-grid',
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 || '&nbsp;'\"\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 ",
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 || '&nbsp;'\"\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 [autoHide]=\"true\"\n (previousClick)=\"goToPreviousPage()\"\n (nextClick)=\"goToNextPage()\"\n (pageClick)=\"setCurrentPage($event)\"\n ></co-pagination-bar>\n ",
9796
9796
  providers: [
9797
9797
  FormMasterService
9798
9798
  ],
@@ -9821,24 +9821,33 @@
9821
9821
  this.nextLabel = 'Volgende pagina';
9822
9822
  this.currentPage = 1;
9823
9823
  this.itemsPerPage = 20;
9824
- this.totalItems = 1;
9825
9824
  this.paginationRange = 8;
9825
+ this.autoHide = false;
9826
9826
  this.previousClick = new core.EventEmitter();
9827
9827
  this.nextClick = new core.EventEmitter();
9828
9828
  this.pageClick = new core.EventEmitter();
9829
+ this._totalItems = 20;
9829
9830
  this.pages = [];
9830
9831
  }
9832
+ Object.defineProperty(PaginationBarComponent.prototype, "totalItems", {
9833
+ get: function () {
9834
+ return this._totalItems;
9835
+ },
9836
+ set: function (value) {
9837
+ this._totalItems = value;
9838
+ this.totalPages = Math.ceil(this.totalItems / this.itemsPerPage);
9839
+ },
9840
+ enumerable: false,
9841
+ configurable: true
9842
+ });
9831
9843
  PaginationBarComponent.prototype.showClass = function () {
9832
9844
  return true;
9833
9845
  };
9834
9846
  PaginationBarComponent.prototype.ngOnInit = function () {
9835
- this.totalPages = Math.ceil(this.totalItems / this.itemsPerPage);
9836
9847
  this.pages = this._createPageArray();
9837
9848
  };
9838
9849
  PaginationBarComponent.prototype.ngOnChanges = function (changes) {
9839
- if (changes['currentPage'].currentValue !== changes['currentPage'].previousValue) {
9840
- this.pages = this._createPageArray();
9841
- }
9850
+ this.pages = this._createPageArray();
9842
9851
  };
9843
9852
  PaginationBarComponent.prototype.isOnFirstPage = function () {
9844
9853
  return this.currentPage === 1;
@@ -9860,6 +9869,14 @@
9860
9869
  this.currentPage = value;
9861
9870
  this.pageClick.emit(value);
9862
9871
  };
9872
+ PaginationBarComponent.prototype.shouldBeHidden = function () {
9873
+ if (!this.autoHide) {
9874
+ return false;
9875
+ }
9876
+ else {
9877
+ return (this.totalItems <= this.itemsPerPage);
9878
+ }
9879
+ };
9863
9880
  // Returns an array of IPage objects to use in the pagination controls.
9864
9881
  PaginationBarComponent.prototype._createPageArray = function () {
9865
9882
  // paginationRange could be a string if passed from attribute, so cast to number.
@@ -9919,7 +9936,7 @@
9919
9936
  PaginationBarComponent.decorators = [
9920
9937
  { type: core.Component, args: [{
9921
9938
  selector: "co-pagination-bar",
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 ",
9939
+ template: "\n <ul class=\"pagination\" *ngIf=\"!shouldBeHidden()\">\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 ",
9923
9940
  encapsulation: core.ViewEncapsulation.None
9924
9941
  },] }
9925
9942
  ];
@@ -9931,6 +9948,7 @@
9931
9948
  itemsPerPage: [{ type: core.Input }],
9932
9949
  totalItems: [{ type: core.Input }],
9933
9950
  paginationRange: [{ type: core.Input }],
9951
+ autoHide: [{ type: core.Input }],
9934
9952
  previousClick: [{ type: core.Output }],
9935
9953
  nextClick: [{ type: core.Output }],
9936
9954
  pageClick: [{ type: core.Output }],
@@ -10185,29 +10203,17 @@
10185
10203
  this.changeSub.unsubscribe();
10186
10204
  };
10187
10205
  PaginationComponent.prototype.goToFirstPage = function () {
10188
- if (!this.isOnFirstPage()) {
10189
- this.setCurrentPage(1);
10190
- }
10206
+ this.setCurrentPage(1);
10191
10207
  };
10192
10208
  PaginationComponent.prototype.goToPreviousPage = function () {
10193
- if (!this.isOnFirstPage()) {
10194
- this.setCurrentPage(this.getCurrentPage() - 1);
10195
- }
10209
+ this.setCurrentPage(this.getCurrentPage() - 1);
10196
10210
  };
10197
10211
  PaginationComponent.prototype.goToNextPage = function () {
10198
- if (!this.isOnLastPage()) {
10199
- this.setCurrentPage(this.getCurrentPage() + 1);
10200
- }
10212
+ this.setCurrentPage(this.getCurrentPage() + 1);
10201
10213
  };
10202
10214
  PaginationComponent.prototype.setCurrentPage = function (page) {
10203
10215
  this.pageChange.emit(page);
10204
10216
  };
10205
- PaginationComponent.prototype.isOnFirstPage = function () {
10206
- return this.getCurrentPage() === 1;
10207
- };
10208
- PaginationComponent.prototype.isOnLastPage = function () {
10209
- return this.getLastPage() === this.getCurrentPage();
10210
- };
10211
10217
  PaginationComponent.prototype.shouldBeHidden = function () {
10212
10218
  if (!this.autoHide) {
10213
10219
  return false;
@@ -10234,10 +10240,6 @@
10234
10240
  PaginationComponent.prototype.getCurrentPage = function () {
10235
10241
  return this._paginationService.getCurrentPage(this.id);
10236
10242
  };
10237
- PaginationComponent.prototype.getLastPage = function () {
10238
- var instance = this._paginationService.getInstance(this.id);
10239
- return Math.ceil(instance.totalItems / instance.itemsPerPage);
10240
- };
10241
10243
  /**
10242
10244
  * Checks that the instance.currentPage property is within bounds for the current page range.
10243
10245
  * If not, return a correct value for currentPage, or the current value if OK.