@energycap/components 0.27.3 → 0.27.4

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.
@@ -6518,6 +6518,52 @@
6518
6518
  ];
6519
6519
  ErrorService.ctorParameters = function () { return []; };
6520
6520
 
6521
+ var RowCountPipe = /** @class */ (function () {
6522
+ function RowCountPipe(translateService) {
6523
+ this.translateService = translateService;
6524
+ }
6525
+ /**
6526
+ * Get the formatted row count for the results.
6527
+ *
6528
+ * Provide maxItemCount if the normal row count is needed.
6529
+ * Provide pagingInfo if the paged row count is needed.
6530
+ */
6531
+ //Note that totalPagedItemCount is not necessarily equal to pagingInfo.pageSize since the last page could have less than pageSize rows.
6532
+ RowCountPipe.prototype.transform = function (results, objectType, maxItemCount, pagingInfo) {
6533
+ var translated = this.translateService.instant(objectType || 'results');
6534
+ if (maxItemCount !== undefined) {
6535
+ return this.getResultsCount(results, translated, maxItemCount);
6536
+ }
6537
+ else if (pagingInfo) {
6538
+ return this.getPagedResultsCount(results, translated, pagingInfo);
6539
+ }
6540
+ return '';
6541
+ };
6542
+ RowCountPipe.prototype.getResultsCount = function (results, objectType, maxItemCount) {
6543
+ // If the filtered results count of rows is greater than the maximum number
6544
+ // of results we want to show, we have already pared the results down,
6545
+ // so tell user we are displaying the first `maxItemCount` results out of the total
6546
+ // count of filtered results.
6547
+ if (results.totalItems > maxItemCount) {
6548
+ return maxItemCount + " " + this.translateService.instant('of') + " " + results.totalItems;
6549
+ }
6550
+ return results.totalItems + " " + objectType;
6551
+ };
6552
+ RowCountPipe.prototype.getPagedResultsCount = function (results, objectType, pagingInfo) {
6553
+ var prefix = "" + (pagingInfo.skip + 1) + (results.totalItems > 1 ? "-" + (pagingInfo.skip + results.totalItems) + " " : ' ');
6554
+ return prefix + (this.translateService.instant('of') + " " + results.totalItemsBeforePaging + " " + objectType);
6555
+ };
6556
+ return RowCountPipe;
6557
+ }());
6558
+ RowCountPipe.decorators = [
6559
+ { type: i0.Pipe, args: [{
6560
+ name: 'rowCount'
6561
+ },] }
6562
+ ];
6563
+ RowCountPipe.ctorParameters = function () { return [
6564
+ { type: i1.TranslateService }
6565
+ ]; };
6566
+
6521
6567
  var TablePaginationComponent = /** @class */ (function () {
6522
6568
  function TablePaginationComponent(el) {
6523
6569
  this.el = el;
@@ -6668,52 +6714,6 @@
6668
6714
  pageChanged: [{ type: i0.Output }]
6669
6715
  };
6670
6716
 
6671
- var RowCountPipe = /** @class */ (function () {
6672
- function RowCountPipe(translateService) {
6673
- this.translateService = translateService;
6674
- }
6675
- /**
6676
- * Get the formatted row count for the results.
6677
- *
6678
- * Provide maxItemCount if the normal row count is needed.
6679
- * Provide pagingInfo if the paged row count is needed.
6680
- */
6681
- //Note that totalPagedItemCount is not necessarily equal to pagingInfo.pageSize since the last page could have less than pageSize rows.
6682
- RowCountPipe.prototype.transform = function (results, objectType, maxItemCount, pagingInfo) {
6683
- var translated = this.translateService.instant(objectType || 'results');
6684
- if (maxItemCount !== undefined) {
6685
- return this.getResultsCount(results, translated, maxItemCount);
6686
- }
6687
- else if (pagingInfo) {
6688
- return this.getPagedResultsCount(results, translated, pagingInfo);
6689
- }
6690
- return '';
6691
- };
6692
- RowCountPipe.prototype.getResultsCount = function (results, objectType, maxItemCount) {
6693
- // If the filtered results count of rows is greater than the maximum number
6694
- // of results we want to show, we have already pared the results down,
6695
- // so tell user we are displaying the first `maxItemCount` results out of the total
6696
- // count of filtered results.
6697
- if (results.totalItems > maxItemCount) {
6698
- return maxItemCount + " " + this.translateService.instant('of') + " " + results.totalItems;
6699
- }
6700
- return results.totalItems + " " + objectType;
6701
- };
6702
- RowCountPipe.prototype.getPagedResultsCount = function (results, objectType, pagingInfo) {
6703
- var prefix = "" + (pagingInfo.skip + 1) + (results.totalItems > 1 ? "-" + (pagingInfo.skip + results.totalItems) + " " : ' ');
6704
- return prefix + (this.translateService.instant('of') + " " + results.totalItemsBeforePaging + " " + objectType);
6705
- };
6706
- return RowCountPipe;
6707
- }());
6708
- RowCountPipe.decorators = [
6709
- { type: i0.Pipe, args: [{
6710
- name: 'rowCount'
6711
- },] }
6712
- ];
6713
- RowCountPipe.ctorParameters = function () { return [
6714
- { type: i1.TranslateService }
6715
- ]; };
6716
-
6717
6717
  var SearchableTableComponent = /** @class */ (function () {
6718
6718
  function SearchableTableComponent(errorService, translateService, rowCountPipe) {
6719
6719
  this.errorService = errorService;
@@ -6828,6 +6828,13 @@
6828
6828
  enumerable: false,
6829
6829
  configurable: true
6830
6830
  });
6831
+ SearchableTableComponent.prototype.ngOnChanges = function (changes) {
6832
+ if (changes.pageSize && !changes.pageSize.firstChange && this.pageable) {
6833
+ // If the pageSize changes, reset to the first page and refresh.
6834
+ this.pageInfo = TablePaginationComponent.getPagingInfo(1, this.pageSize);
6835
+ this.onPageChange(this.pageInfo);
6836
+ }
6837
+ };
6831
6838
  SearchableTableComponent.prototype.ngOnInit = function () {
6832
6839
  var _this = this;
6833
6840
  this.status.setStatus('pending', 'Loading');
@@ -6950,8 +6957,8 @@
6950
6957
  SearchableTableComponent.decorators = [
6951
6958
  { type: i0.Component, args: [{
6952
6959
  selector: 'ec-searchable-table',
6953
- template: "<header *ngIf=\"!hideHeader\"\r\n class=\"d-flex flex-shrink align-items-center mb-3\">\r\n <ec-textbox id=\"{{id}}_searchbox\"\r\n *ngIf=\"!hideSearchControl\"\r\n class=\"mb-0 flex-grow mr-2\"\r\n [autofocus]=\"autofocus\"\r\n [formModel]=\"searchModel\"\r\n [tabindex]=\"searchboxTabIndex\"\r\n [placeholder]=\"searchboxPlaceholder\"\r\n [readonly]=\"searchboxReadonly\"></ec-textbox>\r\n <div class=\"flex-grow\">\r\n <ng-content select=\".searchable-table-controls\"></ng-content>\r\n </div>\r\n</header>\r\n<section id=\"{{id}}_card\"\r\n class=\"card m-0 d-flex flex-column bg-content\"\r\n [class.is-translucent]=\"status.status !== 'error'\"\r\n [class.has-mask]=\"status.status !== 'hasData'\"\r\n ecOverlay\r\n [status]=\"status.status\"\r\n [message]=\"status.message\"\r\n [displayAsMask]=\"true\">\r\n <ng-content select=\".card-header\"></ng-content>\r\n <ec-table id=\"{{id}}_table\"\r\n class=\"flex-shrink-max {{tableClasses}}\"\r\n [class.is-fixed]=\"tableLayoutFixed\"\r\n [sortable]=\"sortable\"\r\n [sort]=\"sort\"\r\n (sortChange)=\"onSortChange($event)\"\r\n [resizable]=\"resizable\"\r\n [scrollable]=\"true\"\r\n [selectable]=\"selectable\"\r\n [selectionContext]=\"selectionContext\"\r\n [selectionToolbarTemplate]=\"selectionToolbarTemplate\"\r\n [resizableColumns]=\"resizableColumns\">\r\n <ng-content></ng-content>\r\n </ec-table>\r\n\r\n <!-- pagination footer visible if table is page-able and there are more than one page of results -->\r\n <footer *ngIf=\"!hideFooter && pageable && searchResults.totalItemsBeforePaging! > pageSize!\" class=\"d-flex flex-shrink align-items-center border-top\">\r\n <ec-table-pagination id=\"{{id}}_pager\"\r\n class=\"font-color-primary\"\r\n [totalItems]=\"searchResults.totalItemsBeforePaging\"\r\n [pageSize]=\"pageSize\"\r\n [maxTabs]=\"maxTabs\"\r\n [pageNumber]=\"pageInfo?.pageNumber\"\r\n (pageChanged)=\"onPageChange($event)\">\r\n </ec-table-pagination>\r\n <div id=\"resultsCount\"\r\n *ngIf=\"searchResults?.items?.length\"\r\n class=\"ml-auto mr-2 font-color-hint text-truncate\" \r\n title=\"{{resultsCount}} {{additionalCountText}}\">{{resultsCount}} {{additionalCountText}}</div>\r\n </footer>\r\n\r\n <!-- default footer: visible if hideFooter is false and table is not page-able or there are only one page of results (always shows if there is a caption to indicate no results) -->\r\n <footer *ngIf=\"(!hideFooter && (!pageable || searchResults.totalItemsBeforePaging! <= pageSize!)) || tableCaption\"\r\n class=\"p-2 d-flex\"\r\n [class.has-results]=\"searchResults?.items?.length\">\r\n <ng-content *ngIf=\"!tableCaption\"\r\n select=\".searchable-table-footer\"></ng-content>\r\n <div id=\"tableCaption\"\r\n *ngIf=\"tableCaption\"\r\n [innerHTML]=\"tableCaption\"></div>\r\n <div id=\"resultsCount\"\r\n *ngIf=\"searchResults?.items?.length\"\r\n class=\"ml-auto text-truncate\"\r\n title=\"{{resultsCount}} {{additionalCountText}}\">{{resultsCount}} {{additionalCountText}}</div>\r\n </footer>\r\n</section>",
6954
- styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}:host{display:flex;flex:1 1;flex-direction:column;min-height:0}:host ::ng-deep .card-header+ec-table.is-selectable th{height:2.5rem;padding-bottom:.9375rem}:host ::ng-deep .card-header+ec-table.is-selectable th.is-resizable .handle{padding-top:.5rem}:host ::ng-deep .card-header+ec-table.is-selectable th.is-resizable .handle:before{top:.5rem}:host ::ng-deep .card-header+ec-table.is-selectable .selectable-table-toolbar{height:2.5rem;padding-bottom:.5rem}footer{font-size:.75rem;line-height:1rem}footer.has-results{border-top:1px solid rgba(26,26,35,.18);color:rgba(26,26,35,.38);text-align:right}.card.has-mask{min-height:15rem}"]
6960
+ template: "<header *ngIf=\"!hideHeader\"\r\n class=\"d-flex flex-shrink align-items-center mb-3\">\r\n <ec-textbox id=\"{{id}}_searchbox\"\r\n *ngIf=\"!hideSearchControl\"\r\n class=\"mb-0 flex-grow mr-2\"\r\n [autofocus]=\"autofocus\"\r\n [formModel]=\"searchModel\"\r\n [tabindex]=\"searchboxTabIndex\"\r\n [placeholder]=\"searchboxPlaceholder\"\r\n [readonly]=\"searchboxReadonly\"></ec-textbox>\r\n <div class=\"flex-grow\">\r\n <ng-content select=\".searchable-table-controls\"></ng-content>\r\n </div>\r\n</header>\r\n<section id=\"{{id}}_card\"\r\n class=\"d-flex flex-column flex-grow\"\r\n [ngClass]=\"{'is-translucent': status.status !== 'error', 'has-mask': status.status !== 'hasData', 'card m-0 bg-content': !customContentTemplate, 'bg-body': customContentTemplate}\"\r\n ecOverlay\r\n [status]=\"status.status\"\r\n [message]=\"status.message\"\r\n [displayAsMask]=\"true\">\r\n <ng-content select=\".card-header\"></ng-content>\r\n <ng-container *ngTemplateOutlet=\"customContentTemplate || defaultContentTemplate\">\r\n </ng-container>\r\n\r\n <!-- the default template is an ec-table with proxied-over searchable table inputs. \r\n If that doesn't work for you then you can specify a customContentTemplate to use instead\r\n and still retain all the event handling, header, footer pagination, etc support -->\r\n <ng-template #defaultContentTemplate>\r\n <ec-table id=\"{{id}}_table\"\r\n class=\"flex-shrink-max {{tableClasses}}\"\r\n [class.is-fixed]=\"tableLayoutFixed\"\r\n [sortable]=\"sortable\"\r\n [sort]=\"sort\"\r\n (sortChange)=\"onSortChange($event)\"\r\n [resizable]=\"resizable\"\r\n [scrollable]=\"true\"\r\n [selectable]=\"selectable\"\r\n [selectionContext]=\"selectionContext\"\r\n [selectionToolbarTemplate]=\"selectionToolbarTemplate\"\r\n [resizableColumns]=\"resizableColumns\">\r\n <ng-content></ng-content>\r\n </ec-table>\r\n </ng-template>\r\n\r\n <!-- pagination footer visible if table is page-able and there are more than one page of results -->\r\n <footer *ngIf=\"!hideFooter && pageable && searchResults.totalItemsBeforePaging! > pageSize!\"\r\n class=\"d-flex flex-shrink align-items-center\"\r\n [class.border-top]=\"!customContentTemplate\">\r\n <ec-table-pagination id=\"{{id}}_pager\"\r\n class=\"font-color-primary\"\r\n [totalItems]=\"searchResults.totalItemsBeforePaging\"\r\n [pageSize]=\"pageSize\"\r\n [maxTabs]=\"maxTabs\"\r\n [pageNumber]=\"pageInfo?.pageNumber\"\r\n (pageChanged)=\"onPageChange($event)\">\r\n </ec-table-pagination>\r\n <div id=\"resultsCount\"\r\n *ngIf=\"searchResults?.items?.length\"\r\n class=\"ml-auto mr-2 font-color-hint text-truncate\" \r\n title=\"{{resultsCount}} {{additionalCountText}}\">{{resultsCount}} {{additionalCountText}}</div>\r\n </footer>\r\n\r\n <!-- default footer: visible if hideFooter is false and table is not page-able or there are only one page of results (always shows if there is a caption to indicate no results) -->\r\n <footer *ngIf=\"(!hideFooter && (!pageable || searchResults.totalItemsBeforePaging! <= pageSize!)) || tableCaption\"\r\n class=\"p-2 d-flex\"\r\n [ngClass]=\"{'has-results': searchResults?.items?.length, 'border-top': searchResults?.items?.length && !customContentTemplate}\">\r\n <ng-content *ngIf=\"!tableCaption\"\r\n select=\".searchable-table-footer\"></ng-content>\r\n <div id=\"tableCaption\"\r\n *ngIf=\"tableCaption\"\r\n [innerHTML]=\"tableCaption\"></div>\r\n <div id=\"resultsCount\"\r\n *ngIf=\"searchResults?.items?.length\"\r\n class=\"ml-auto text-truncate\"\r\n title=\"{{resultsCount}} {{additionalCountText}}\">{{resultsCount}} {{additionalCountText}}</div>\r\n </footer>\r\n</section>",
6961
+ styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}:host{display:flex;flex:1 1;flex-direction:column;min-height:0}:host ::ng-deep .card-header+ec-table.is-selectable th{height:2.5rem;padding-bottom:.9375rem}:host ::ng-deep .card-header+ec-table.is-selectable th.is-resizable .handle{padding-top:.5rem}:host ::ng-deep .card-header+ec-table.is-selectable th.is-resizable .handle:before{top:.5rem}:host ::ng-deep .card-header+ec-table.is-selectable .selectable-table-toolbar{height:2.5rem;padding-bottom:.5rem}footer{font-size:.75rem;line-height:1rem}footer.has-results{color:rgba(26,26,35,.38);text-align:right}.card.has-mask{min-height:15rem}"]
6955
6962
  },] }
6956
6963
  ];
6957
6964
  SearchableTableComponent.ctorParameters = function () { return [
@@ -6992,7 +6999,8 @@
6992
6999
  selectionToolbarTemplate: [{ type: i0.Input }],
6993
7000
  resizableColumns: [{ type: i0.ContentChildren, args: [ResizableColumnComponent, { descendants: true },] }],
6994
7001
  additionalCountText: [{ type: i0.Input }],
6995
- selectable: [{ type: i0.Input }]
7002
+ selectable: [{ type: i0.Input }],
7003
+ customContentTemplate: [{ type: i0.Input }]
6996
7004
  };
6997
7005
 
6998
7006
  var TableDetailRowComponent = /** @class */ (function () {