@energycap/components 0.26.2 → 0.26.3

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.
@@ -7881,6 +7881,45 @@
7881
7881
  subTitle: [{ type: i0.Input }]
7882
7882
  };
7883
7883
 
7884
+ /**
7885
+ * Format a time to the user's preference for display
7886
+ */
7887
+ var TimeDisplayPipe = /** @class */ (function () {
7888
+ function TimeDisplayPipe(userPreferenceService) {
7889
+ this.userPreferenceService = userPreferenceService;
7890
+ this.lastFormatString = 'HH:mm:ss';
7891
+ }
7892
+ /**
7893
+ * Format a time for display, accounting for user's display preferences.
7894
+ */
7895
+ TimeDisplayPipe.prototype.transform = function (time, showSeconds) {
7896
+ var _this = this;
7897
+ var display = '';
7898
+ var formatString = '';
7899
+ // use user-preferred formats
7900
+ this.userPreferenceService.getPreferences().subscribe(function (result) {
7901
+ //if preferences exist then format time to users preference
7902
+ //otherwise use the last user preference
7903
+ if (result.preference) {
7904
+ formatString = result.preference.timeFormat;
7905
+ if (!showSeconds) {
7906
+ formatString = formatString.replace(':ss', '');
7907
+ }
7908
+ _this.lastFormatString = formatString;
7909
+ }
7910
+ });
7911
+ display = moment__default['default'](time).format(this.lastFormatString);
7912
+ return display;
7913
+ };
7914
+ return TimeDisplayPipe;
7915
+ }());
7916
+ TimeDisplayPipe.decorators = [
7917
+ { type: i0.Pipe, args: [{ name: 'timeDisplay' },] }
7918
+ ];
7919
+ TimeDisplayPipe.ctorParameters = function () { return [
7920
+ { type: UserPreferenceService }
7921
+ ]; };
7922
+
7884
7923
  var ComponentsModule = /** @class */ (function () {
7885
7924
  function ComponentsModule() {
7886
7925
  }
@@ -7920,6 +7959,7 @@
7920
7959
  ConfirmComponent,
7921
7960
  DialogComponent,
7922
7961
  DateDisplayPipe,
7962
+ TimeDisplayPipe,
7923
7963
  MockDateDisplayPipe,
7924
7964
  RadioButtonComponent,
7925
7965
  CheckboxComponent,
@@ -7967,6 +8007,7 @@
7967
8007
  FormGroupHelper,
7968
8008
  DialogService,
7969
8009
  DateDisplayPipe,
8010
+ TimeDisplayPipe,
7970
8011
  MockDateDisplayPipe,
7971
8012
  RowCountPipe
7972
8013
  ],
@@ -7988,6 +8029,7 @@
7988
8029
  ConfirmComponent,
7989
8030
  DialogComponent,
7990
8031
  DateDisplayPipe,
8032
+ TimeDisplayPipe,
7991
8033
  RadioButtonComponent,
7992
8034
  CheckboxComponent,
7993
8035
  NumericboxComponent,
@@ -8704,6 +8746,7 @@
8704
8746
  exports.TagsComponent = TagsComponent;
8705
8747
  exports.TelemetryBaseService = TelemetryBaseService;
8706
8748
  exports.TextboxComponent = TextboxComponent;
8749
+ exports.TimeDisplayPipe = TimeDisplayPipe;
8707
8750
  exports.ToastComponent = ToastComponent;
8708
8751
  exports.ToastEvent = ToastEvent;
8709
8752
  exports.ToastService = ToastService;