@energycap/components 0.27.1 → 0.27.2-ECAPID-379-searchable-table-card-view.20220118-1509

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.
@@ -6748,6 +6748,8 @@
6748
6748
  this.additionalCountText = '';
6749
6749
  /** Enables table row selection and row highlighting styles when true */
6750
6750
  this.selectable = false;
6751
+ /** When false, removes the card styles from around the content. Only set to false when providing a customContentTemplate. Default is true. */
6752
+ this.isCardContent = true;
6751
6753
  /**
6752
6754
  * Text displayed in the footer.
6753
6755
  * Sometimes `noDataMessage`, sometimes `noSearchResultsMessage`
@@ -6897,8 +6899,8 @@
6897
6899
  SearchableTableComponent.decorators = [
6898
6900
  { type: i0.Component, args: [{
6899
6901
  selector: 'ec-searchable-table',
6900
- 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>",
6901
- 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}"]
6902
+ 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\"\r\n [ngClass]=\"{'is-translucent': status.status !== 'error', 'has-mask': status.status !== 'hasData', 'card m-0 bg-content': isCardContent, 'bg-body': !isCardContent}\"\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]=\"isCardContent\">\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 && isCardContent}\">\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>",
6903
+ 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}"]
6902
6904
  },] }
6903
6905
  ];
6904
6906
  SearchableTableComponent.ctorParameters = function () { return [
@@ -6939,7 +6941,9 @@
6939
6941
  selectionToolbarTemplate: [{ type: i0.Input }],
6940
6942
  resizableColumns: [{ type: i0.ContentChildren, args: [ResizableColumnComponent, { descendants: true },] }],
6941
6943
  additionalCountText: [{ type: i0.Input }],
6942
- selectable: [{ type: i0.Input }]
6944
+ selectable: [{ type: i0.Input }],
6945
+ customContentTemplate: [{ type: i0.Input }],
6946
+ isCardContent: [{ type: i0.Input }]
6943
6947
  };
6944
6948
 
6945
6949
  var TableDetailRowComponent = /** @class */ (function () {
@@ -8132,6 +8136,51 @@
8132
8136
  { type: UserPreferenceService }
8133
8137
  ]; };
8134
8138
 
8139
+ var RelativeDatePipe = /** @class */ (function () {
8140
+ function RelativeDatePipe(dateDisplayPipe, timeDisplayPipe, translateService) {
8141
+ this.dateDisplayPipe = dateDisplayPipe;
8142
+ this.timeDisplayPipe = timeDisplayPipe;
8143
+ this.translateService = translateService;
8144
+ }
8145
+ /**
8146
+ * If dateOnly is true, returns timeSelected formatted according to the user's date preference.
8147
+ * If timeOnly is true, returns timeSelected formatted according to the user's time preference.
8148
+ * If any of todayLabel, yesterdayLabel is supplied, use the supplied label.
8149
+ * If dateOnly and timeOnly are both false, returns timeSelected formatted according to the user's date plus time preference.
8150
+ */
8151
+ RelativeDatePipe.prototype.transform = function (timeSelected, options) {
8152
+ var selected = moment__default['default'](timeSelected);
8153
+ var today = moment__default['default']();
8154
+ var yesterday = moment__default['default']().subtract(1, 'day');
8155
+ var timeDisplay = (options === null || options === void 0 ? void 0 : options.dateOnly) ? "" : " " + this.timeDisplayPipe.transform(timeSelected);
8156
+ var displayValue = null;
8157
+ if (selected.isSame(today, 'day') && !(options === null || options === void 0 ? void 0 : options.showTimeForToday)) {
8158
+ displayValue = this.translateService.instant((options === null || options === void 0 ? void 0 : options.todayLabel) ? options === null || options === void 0 ? void 0 : options.todayLabel : 'today');
8159
+ }
8160
+ else if (selected.isSame(today, 'day') && (options === null || options === void 0 ? void 0 : options.showTimeForToday) && !timeDisplay) {
8161
+ displayValue = this.timeDisplayPipe.transform(timeSelected);
8162
+ }
8163
+ else if (selected.isSame(yesterday, 'day')) {
8164
+ displayValue = this.translateService.instant((options === null || options === void 0 ? void 0 : options.yesterdayLabel) ? options === null || options === void 0 ? void 0 : options.yesterdayLabel : 'yesterday');
8165
+ }
8166
+ else {
8167
+ displayValue = this.dateDisplayPipe.transform(timeSelected);
8168
+ }
8169
+ return "" + displayValue + timeDisplay;
8170
+ };
8171
+ return RelativeDatePipe;
8172
+ }());
8173
+ RelativeDatePipe.decorators = [
8174
+ { type: i0.Pipe, args: [{
8175
+ name: 'relativeDate'
8176
+ },] }
8177
+ ];
8178
+ RelativeDatePipe.ctorParameters = function () { return [
8179
+ { type: DateDisplayPipe },
8180
+ { type: TimeDisplayPipe },
8181
+ { type: i1.TranslateService }
8182
+ ]; };
8183
+
8135
8184
  var PageTitleComponent = /** @class */ (function () {
8136
8185
  function PageTitleComponent() {
8137
8186
  }
@@ -8530,6 +8579,7 @@
8530
8579
  WizardButtonsComponent,
8531
8580
  HierarchyTreeComponent,
8532
8581
  TreeComponent,
8582
+ RelativeDatePipe,
8533
8583
  ResizableComponent
8534
8584
  ],
8535
8585
  imports: [
@@ -8547,7 +8597,8 @@
8547
8597
  DateDisplayPipe,
8548
8598
  TimeDisplayPipe,
8549
8599
  MockDateDisplayPipe,
8550
- RowCountPipe
8600
+ RowCountPipe,
8601
+ RelativeDatePipe
8551
8602
  ],
8552
8603
  exports: [
8553
8604
  ButtonComponent,
@@ -8601,6 +8652,7 @@
8601
8652
  WizardButtonsComponent,
8602
8653
  HierarchyTreeComponent,
8603
8654
  TreeComponent,
8655
+ RelativeDatePipe,
8604
8656
  ResizableComponent
8605
8657
  ]
8606
8658
  },] }
@@ -9811,6 +9863,7 @@
9811
9863
  exports.PopupContainerDirective = PopupContainerDirective;
9812
9864
  exports.RadioButtonComponent = RadioButtonComponent;
9813
9865
  exports.RadioButtonOption = RadioButtonOption;
9866
+ exports.RelativeDatePipe = RelativeDatePipe;
9814
9867
  exports.ResizableBase = ResizableBase;
9815
9868
  exports.ResizableColumnComponent = ResizableColumnComponent;
9816
9869
  exports.ResizableComponent = ResizableComponent;