@energycap/components 0.26.2 → 0.26.3-ECAPID-284-App-Bar-Error.20211111-1342

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.
@@ -5424,29 +5424,37 @@
5424
5424
  * username as a last ditch effort.
5425
5425
  */
5426
5426
  AvatarComponent.prototype.updateLabel = function () {
5427
+ var _this = this;
5427
5428
  if (this.user) {
5429
+ var userMenuTitle_1 = undefined;
5428
5430
  var trimmedUser = this.trimUser(this.user);
5429
5431
  if (trimmedUser.firstName || trimmedUser.lastName) {
5430
5432
  if (trimmedUser.firstName) {
5431
5433
  this.label = trimmedUser.firstName.slice(0, 1);
5432
- this.user.userMenuTitle = trimmedUser.firstName;
5434
+ userMenuTitle_1 = trimmedUser.firstName;
5433
5435
  if (trimmedUser.lastName) {
5434
- this.user.userMenuTitle += " " + trimmedUser.lastName;
5436
+ userMenuTitle_1 += " " + trimmedUser.lastName;
5435
5437
  }
5436
5438
  }
5437
5439
  else {
5438
5440
  this.label = trimmedUser.lastName.slice(0, 1);
5439
- this.user.userMenuTitle = trimmedUser.lastName;
5441
+ userMenuTitle_1 = trimmedUser.lastName;
5440
5442
  }
5441
5443
  }
5442
5444
  else if (trimmedUser.email) {
5443
5445
  this.label = trimmedUser.email.slice(0, 1);
5444
- this.user.userMenuTitle = trimmedUser.email;
5446
+ userMenuTitle_1 = trimmedUser.email;
5445
5447
  }
5446
5448
  else if (trimmedUser.username) {
5447
5449
  this.label = trimmedUser.username.slice(0, 1);
5448
- this.user.userMenuTitle = trimmedUser.username;
5450
+ userMenuTitle_1 = trimmedUser.username;
5449
5451
  }
5452
+ // Modifying the user that was passed in from the hosting component during the page lifecycle can cause an
5453
+ // "ExpressionChangedAfterItHasBeenCheckedError" error since the value of the input is being changed before the prior page detection
5454
+ // has completed. Using a setTimeout to wait and then set the menu title.
5455
+ setTimeout(function () {
5456
+ _this.user.userMenuTitle = userMenuTitle_1;
5457
+ });
5450
5458
  }
5451
5459
  };
5452
5460
  /** Return a new user object that has all of the properties of the existing user
@@ -7881,6 +7889,45 @@
7881
7889
  subTitle: [{ type: i0.Input }]
7882
7890
  };
7883
7891
 
7892
+ /**
7893
+ * Format a time to the user's preference for display
7894
+ */
7895
+ var TimeDisplayPipe = /** @class */ (function () {
7896
+ function TimeDisplayPipe(userPreferenceService) {
7897
+ this.userPreferenceService = userPreferenceService;
7898
+ this.lastFormatString = 'HH:mm:ss';
7899
+ }
7900
+ /**
7901
+ * Format a time for display, accounting for user's display preferences.
7902
+ */
7903
+ TimeDisplayPipe.prototype.transform = function (time, showSeconds) {
7904
+ var _this = this;
7905
+ var display = '';
7906
+ var formatString = '';
7907
+ // use user-preferred formats
7908
+ this.userPreferenceService.getPreferences().subscribe(function (result) {
7909
+ //if preferences exist then format time to users preference
7910
+ //otherwise use the last user preference
7911
+ if (result.preference) {
7912
+ formatString = result.preference.timeFormat;
7913
+ if (!showSeconds) {
7914
+ formatString = formatString.replace(':ss', '');
7915
+ }
7916
+ _this.lastFormatString = formatString;
7917
+ }
7918
+ });
7919
+ display = moment__default['default'](time).format(this.lastFormatString);
7920
+ return display;
7921
+ };
7922
+ return TimeDisplayPipe;
7923
+ }());
7924
+ TimeDisplayPipe.decorators = [
7925
+ { type: i0.Pipe, args: [{ name: 'timeDisplay' },] }
7926
+ ];
7927
+ TimeDisplayPipe.ctorParameters = function () { return [
7928
+ { type: UserPreferenceService }
7929
+ ]; };
7930
+
7884
7931
  var ComponentsModule = /** @class */ (function () {
7885
7932
  function ComponentsModule() {
7886
7933
  }
@@ -7920,6 +7967,7 @@
7920
7967
  ConfirmComponent,
7921
7968
  DialogComponent,
7922
7969
  DateDisplayPipe,
7970
+ TimeDisplayPipe,
7923
7971
  MockDateDisplayPipe,
7924
7972
  RadioButtonComponent,
7925
7973
  CheckboxComponent,
@@ -7967,6 +8015,7 @@
7967
8015
  FormGroupHelper,
7968
8016
  DialogService,
7969
8017
  DateDisplayPipe,
8018
+ TimeDisplayPipe,
7970
8019
  MockDateDisplayPipe,
7971
8020
  RowCountPipe
7972
8021
  ],
@@ -7988,6 +8037,7 @@
7988
8037
  ConfirmComponent,
7989
8038
  DialogComponent,
7990
8039
  DateDisplayPipe,
8040
+ TimeDisplayPipe,
7991
8041
  RadioButtonComponent,
7992
8042
  CheckboxComponent,
7993
8043
  NumericboxComponent,
@@ -8704,6 +8754,7 @@
8704
8754
  exports.TagsComponent = TagsComponent;
8705
8755
  exports.TelemetryBaseService = TelemetryBaseService;
8706
8756
  exports.TextboxComponent = TextboxComponent;
8757
+ exports.TimeDisplayPipe = TimeDisplayPipe;
8707
8758
  exports.ToastComponent = ToastComponent;
8708
8759
  exports.ToastEvent = ToastEvent;
8709
8760
  exports.ToastService = ToastService;