@energycap/components 0.27.1 → 0.27.2

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.
@@ -8132,6 +8132,51 @@
8132
8132
  { type: UserPreferenceService }
8133
8133
  ]; };
8134
8134
 
8135
+ var RelativeDatePipe = /** @class */ (function () {
8136
+ function RelativeDatePipe(dateDisplayPipe, timeDisplayPipe, translateService) {
8137
+ this.dateDisplayPipe = dateDisplayPipe;
8138
+ this.timeDisplayPipe = timeDisplayPipe;
8139
+ this.translateService = translateService;
8140
+ }
8141
+ /**
8142
+ * If dateOnly is true, returns timeSelected formatted according to the user's date preference.
8143
+ * If timeOnly is true, returns timeSelected formatted according to the user's time preference.
8144
+ * If any of todayLabel, yesterdayLabel is supplied, use the supplied label.
8145
+ * If dateOnly and timeOnly are both false, returns timeSelected formatted according to the user's date plus time preference.
8146
+ */
8147
+ RelativeDatePipe.prototype.transform = function (timeSelected, options) {
8148
+ var selected = moment__default['default'](timeSelected);
8149
+ var today = moment__default['default']();
8150
+ var yesterday = moment__default['default']().subtract(1, 'day');
8151
+ var timeDisplay = (options === null || options === void 0 ? void 0 : options.dateOnly) ? "" : " " + this.timeDisplayPipe.transform(timeSelected);
8152
+ var displayValue = null;
8153
+ if (selected.isSame(today, 'day') && !(options === null || options === void 0 ? void 0 : options.showTimeForToday)) {
8154
+ displayValue = this.translateService.instant((options === null || options === void 0 ? void 0 : options.todayLabel) ? options === null || options === void 0 ? void 0 : options.todayLabel : 'today');
8155
+ }
8156
+ else if (selected.isSame(today, 'day') && (options === null || options === void 0 ? void 0 : options.showTimeForToday) && !timeDisplay) {
8157
+ displayValue = this.timeDisplayPipe.transform(timeSelected);
8158
+ }
8159
+ else if (selected.isSame(yesterday, 'day')) {
8160
+ displayValue = this.translateService.instant((options === null || options === void 0 ? void 0 : options.yesterdayLabel) ? options === null || options === void 0 ? void 0 : options.yesterdayLabel : 'yesterday');
8161
+ }
8162
+ else {
8163
+ displayValue = this.dateDisplayPipe.transform(timeSelected);
8164
+ }
8165
+ return "" + displayValue + timeDisplay;
8166
+ };
8167
+ return RelativeDatePipe;
8168
+ }());
8169
+ RelativeDatePipe.decorators = [
8170
+ { type: i0.Pipe, args: [{
8171
+ name: 'relativeDate'
8172
+ },] }
8173
+ ];
8174
+ RelativeDatePipe.ctorParameters = function () { return [
8175
+ { type: DateDisplayPipe },
8176
+ { type: TimeDisplayPipe },
8177
+ { type: i1.TranslateService }
8178
+ ]; };
8179
+
8135
8180
  var PageTitleComponent = /** @class */ (function () {
8136
8181
  function PageTitleComponent() {
8137
8182
  }
@@ -8530,6 +8575,7 @@
8530
8575
  WizardButtonsComponent,
8531
8576
  HierarchyTreeComponent,
8532
8577
  TreeComponent,
8578
+ RelativeDatePipe,
8533
8579
  ResizableComponent
8534
8580
  ],
8535
8581
  imports: [
@@ -8547,7 +8593,8 @@
8547
8593
  DateDisplayPipe,
8548
8594
  TimeDisplayPipe,
8549
8595
  MockDateDisplayPipe,
8550
- RowCountPipe
8596
+ RowCountPipe,
8597
+ RelativeDatePipe
8551
8598
  ],
8552
8599
  exports: [
8553
8600
  ButtonComponent,
@@ -8601,6 +8648,7 @@
8601
8648
  WizardButtonsComponent,
8602
8649
  HierarchyTreeComponent,
8603
8650
  TreeComponent,
8651
+ RelativeDatePipe,
8604
8652
  ResizableComponent
8605
8653
  ]
8606
8654
  },] }
@@ -9811,6 +9859,7 @@
9811
9859
  exports.PopupContainerDirective = PopupContainerDirective;
9812
9860
  exports.RadioButtonComponent = RadioButtonComponent;
9813
9861
  exports.RadioButtonOption = RadioButtonOption;
9862
+ exports.RelativeDatePipe = RelativeDatePipe;
9814
9863
  exports.ResizableBase = ResizableBase;
9815
9864
  exports.ResizableColumnComponent = ResizableColumnComponent;
9816
9865
  exports.ResizableComponent = ResizableComponent;