@energycap/components 0.26.9 → 0.26.10

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.
@@ -1736,6 +1736,8 @@ const textboxValidation = (validatorParams) => {
1736
1736
  }
1737
1737
  };
1738
1738
  };
1739
+ const phoneNumberValidationPattern = '^\\s*(?:\\+?(\\d{1,3}))?[-. (]*(\\d{3})[-. )]*(\\d{3})[-. ]*(\\d{4})(?: *x(\\d+))?\\s*$';
1740
+ const urlValidationPattern = '([A-Za-z])+(:\/\/)+[^\\s]*';
1739
1741
  class TextboxComponent extends FormControlBase {
1740
1742
  constructor(validationMessageService, formGroupHelper, translate) {
1741
1743
  super(validationMessageService, formGroupHelper);
@@ -1751,7 +1753,7 @@ class TextboxComponent extends FormControlBase {
1751
1753
  */
1752
1754
  this.type = "text";
1753
1755
  /**
1754
- * The value of the rows attiribute for a textarea. Only applies to multi-line type
1756
+ * The value of the rows attribute for a textarea. Only applies to multi-line type
1755
1757
  */
1756
1758
  this.rows = 3;
1757
1759
  /**
@@ -1763,6 +1765,10 @@ class TextboxComponent extends FormControlBase {
1763
1765
  * If set to true, we will upper case on focus out
1764
1766
  */
1765
1767
  this.upperCase = false;
1768
+ /**
1769
+ * Validation pattern for the input. This is determined on the input type specified
1770
+ */
1771
+ this.validationPattern = '';
1766
1772
  }
1767
1773
  ngOnChanges(changes) {
1768
1774
  super.ngOnChanges(changes);
@@ -1772,6 +1778,13 @@ class TextboxComponent extends FormControlBase {
1772
1778
  */
1773
1779
  ngOnInit() {
1774
1780
  super.ngOnInit();
1781
+ this.validationPattern = '';
1782
+ if (this.type === 'tel') {
1783
+ this.validationPattern = phoneNumberValidationPattern;
1784
+ }
1785
+ else if (this.type === 'url') {
1786
+ this.validationPattern = urlValidationPattern;
1787
+ }
1775
1788
  if (this.placeholder) {
1776
1789
  this.translate.get(this.placeholder)
1777
1790
  .subscribe((translated) => {
@@ -1788,7 +1801,7 @@ class TextboxComponent extends FormControlBase {
1788
1801
  }
1789
1802
  }
1790
1803
  /**
1791
- * Function to set focus on an input programatically after the page
1804
+ * Function to set focus on an input programmatically after the page
1792
1805
  * had been rendered. The highlight text flag will select the text
1793
1806
  * within the input if passed in and true
1794
1807
  */
@@ -1811,7 +1824,7 @@ class TextboxComponent extends FormControlBase {
1811
1824
  TextboxComponent.decorators = [
1812
1825
  { type: Component, args: [{
1813
1826
  selector: 'ec-textbox',
1814
- template: "<div class=\"control control-label-{{labelPosition}}\"\r\n [ngClass]=\"{'is-readonly': readonly}\">\r\n <label *ngIf=\"label\" ngPreserveWhitespaces>\r\n\r\n <span>{{label | translate}}</span>\r\n\r\n <span *ngIf=\"validationErrors.length > 0 && formModel.touched && formModel.invalid\">{{validationErrors | translate}}</span>\r\n </label>\r\n <div class=\"input-wrapper control-input\">\r\n <input *ngIf=\"type !== 'multi_line'\"\r\n #textboxInput\r\n email=\"{{type === 'email' ? true : false}}\"\r\n pattern=\"{{type === 'url' ? '([A-Za-z])+(:\\/\\/)+[^\\\\s]*' : ''}}\"\r\n type=\"{{type}}\"\r\n tabindex=\"{{tabindex}}\"\r\n title=\"{{tooltip}}\"\r\n [attr.id]=\"inputId\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.placeholder]=\"placeholder\"\r\n [attr.maxlength]=\"maxlength\"\r\n [attr.minlength]=\"minlength\"\r\n [attr.required]=\"required ? required : null\"\r\n [formControl]=\"formModel\"\r\n [ngClass]=\"{'is-empty': !formModel?.value, 'is-pending': pending, 'is-uppercase': upperCase}\"\r\n (focusout)=\"focusOutEvent()\"\r\n [attr.cdkFocusInitial]=\"autofocus || null\">\r\n\r\n <textarea *ngIf=\"type === 'multi_line'\"\r\n [attr.rows]=\"rows\"\r\n #textboxInput\r\n tabindex=\"{{tabindex}}\"\r\n [attr.id]=\"inputId\"\r\n [attr.placeholder]=\"placeholder\"\r\n [attr.maxlength]=\"maxlength\"\r\n [attr.minlength]=\"minlength\"\r\n [attr.required]=\"required ? required : null\"\r\n [formControl]=\"formModel\"\r\n [ngClass]=\"{'is-empty': formModel?.value === '', 'is-pending': pending}\"\r\n [attr.cdkFocusInitial]=\"autofocus || null\">\r\n </textarea>\r\n </div>\r\n</div>",
1827
+ template: "<div class=\"control control-label-{{labelPosition}}\"\r\n [ngClass]=\"{'is-readonly': readonly}\">\r\n <label *ngIf=\"label\" ngPreserveWhitespaces>\r\n\r\n <span>{{label | translate}}</span>\r\n\r\n <span *ngIf=\"validationErrors.length > 0 && formModel.touched && formModel.invalid\">{{validationErrors | translate}}</span>\r\n </label>\r\n <div class=\"input-wrapper control-input\">\r\n <input *ngIf=\"type !== 'multi_line'\"\r\n #textboxInput\r\n email=\"{{type === 'email' ? true : false}}\"\r\n pattern=\"{{validationPattern}}\"\r\n type=\"{{type}}\"\r\n tabindex=\"{{tabindex}}\"\r\n title=\"{{tooltip}}\"\r\n [attr.id]=\"inputId\"\r\n [attr.autocomplete]=\"autocomplete\"\r\n [attr.placeholder]=\"placeholder\"\r\n [attr.maxlength]=\"maxlength\"\r\n [attr.minlength]=\"minlength\"\r\n [attr.required]=\"required ? required : null\"\r\n [formControl]=\"formModel\"\r\n [ngClass]=\"{'is-empty': !formModel?.value, 'is-pending': pending, 'is-uppercase': upperCase}\"\r\n (focusout)=\"focusOutEvent()\"\r\n [attr.cdkFocusInitial]=\"autofocus || null\">\r\n\r\n <textarea *ngIf=\"type === 'multi_line'\"\r\n [attr.rows]=\"rows\"\r\n #textboxInput\r\n tabindex=\"{{tabindex}}\"\r\n [attr.id]=\"inputId\"\r\n [attr.placeholder]=\"placeholder\"\r\n [attr.maxlength]=\"maxlength\"\r\n [attr.minlength]=\"minlength\"\r\n [attr.required]=\"required ? required : null\"\r\n [formControl]=\"formModel\"\r\n [ngClass]=\"{'is-empty': formModel?.value === '', 'is-pending': pending}\"\r\n [attr.cdkFocusInitial]=\"autofocus || null\">\r\n </textarea>\r\n </div>\r\n</div>",
1815
1828
  styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}:host{color:#1a1a23;display:block;font-family:Roboto,-apple-system,BlinkMacSystemFont,Segoe UI,Oxygen,Ubuntu,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:1rem;margin-bottom:1rem;width:100%}:host :host-context(.form-condensed){margin-bottom:.5rem}:host .control{display:flex;flex-direction:column;width:100%}:host .control.control-label-bottom{flex-direction:column-reverse}:host .control.control-label-left{flex-direction:row}:host .control.control-label-left label{margin-right:.25rem}:host .control.control-label-right{flex-direction:row-reverse}:host .control.control-label-right label{margin-left:.25rem}:host .control.control-label-left,:host .control.control-label-right{align-items:center}:host .control.control-label-left label,:host .control.control-label-right label{flex:1 1;margin-bottom:0;margin-top:0}:host .control.control-label-left .control-input,:host .control.control-label-right .control-input{flex:2 2}:host .control.is-readonly input,:host .control.is-readonly select{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;background-clip:border-box;background-color:rgba(26,26,35,.12);background-image:none;border-color:transparent;color:#1a1a23;opacity:1;overflow:hidden;pointer-events:none;user-select:none;white-space:nowrap}:host .control.invalid .textbox-group-input ::ng-deep .control input.ng-invalid,:host .control.invalid .textbox-group-input ::ng-deep .control input.ng-valid{background-color:#fff8cc;background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"><path fill=\"rgba(26, 26, 35, 0.66)\" d=\"M20.21 20.21h-8.42L10.95 0h10.1l-.84 20.21zm-8.42 3.37h8.42V32h-8.42z\"/></svg>');background-position:.25em;background-repeat:no-repeat;background-size:1em 1em;padding-left:1.5em}:host .control.invalid .textbox-group-input ::ng-deep .control input.ng-invalid:not(:focus),:host .control.invalid .textbox-group-input ::ng-deep .control input.ng-valid:not(:focus){border-color:#ffe433}:host .control.invalid:not(.open) .textbox-group-btn-right ::ng-deep button{background-color:#fff8cc}:host .control.invalid:not(.open) .textbox-group-btn-right ::ng-deep button:not(:focus){border-color:#ffe433}:host .textbox-group{display:flex;position:relative}:host input:focus,:host select:focus,:host textarea:focus{outline:none}:host label{color:rgba(26,26,35,.66);display:block;font-size:.75rem;line-height:1;margin:.375rem 0}:host input{background-clip:padding-box;background-color:#fff;background-image:none;border:.0625rem solid #d2d7d9;border-radius:0;height:2rem;line-height:1.25;padding:.3125em .5em;width:100%}:host input::-moz-selection{background-color:#0084a9;color:#fff}:host input::selection{background-color:#0084a9;color:#fff}:host input::-webkit-input-placeholder{color:rgba(26,26,35,.38)}:host input::-moz-placeholder{color:rgba(26,26,35,.38);opacity:1}:host input:-ms-input-placeholder{color:rgba(26,26,35,.38)}:host input:-moz-placeholder{color:rgba(26,26,35,.38);opacity:1}:host input:required.is-empty{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"><path fill=\"%23ffe433\" d=\"M31.32 21.69l-.09.18-2.48 4.35c-.36.54-.77.62-1.25.27-.12 0-.2 0-.2-.09L19.53 22v9.37a1.26 1.26 0 0 1-.72.67h-5.26c-.59 0-.83-.3-.83-.89 0-.12.15-.21.15-.27V22l-8 4.71h-.12c-.42.66-.8.21-1.16-.27L1 21.82a.82.82 0 0 1 .35-1.26l.18-.1L9 16 .87 11.47v-.09c0-.36-.39-.74-.09-1.16l2.75-4.35v-.09c0-.42.82-.54 1.29-.36l8 4.62V.89c0-.59.18-.89.77-.89h5c.65 0 .91.3.91.89V10l7.94-4.53c.48-.29.72-.21 1.08.27l2.32 4.35v.09c.66.48.45.89-.08 1.25L23 16l7.91 4.53v.09c-.04.18.53.54.41 1.07z\"/></svg>');border-color:#d2d7d9}:host input.ng-invalid.ng-touched,:host input:required.is-empty{background-position:.25em;background-repeat:no-repeat;background-size:1em 1em;padding-left:1.5em}:host input.ng-invalid.ng-touched{background-color:#fff8cc;background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"><path fill=\"rgba(26, 26, 35, 0.66)\" d=\"M20.21 20.21h-8.42L10.95 0h10.1l-.84 20.21zm-8.42 3.37h8.42V32h-8.42z\"/></svg>')}:host input.ng-invalid.ng-touched:not(:focus){border-color:#ffe433}:host input.is-pending.ng-invalid,:host input.is-pending.ng-pending,:host input.is-pending.ng-valid{background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 50 50\"><path fill=\"%230084a9\" d=\"M43.935 25.145c0-10.318-8.364-18.683-18.683-18.683-10.318 0-18.683 8.365-18.683 18.683h4.068c0-8.071 6.543-14.615 14.615-14.615s14.615 6.543 14.615 14.615h4.068z\"><animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 25 25\" to=\"360 25 25\" dur=\"0.8s\" repeatCount=\"indefinite\"/></path></svg>');background-position:.25em;background-repeat:no-repeat;background-size:1em 1em;padding-left:1.5em}:host input:focus,:host input:focus.is-empty{border-color:#0084a9;box-shadow:0 0 0 1px #0084a9;position:relative;z-index:1}:host input:disabled{background-color:rgba(26,26,35,.1);border-color:#d2d7d9;color:rgba(26,26,35,.66);opacity:.65}:host input:disabled:required,:host input:disabled:required.is-empty{background-color:rgba(26,26,35,.1);background-image:none;border-color:#d2d7d9;padding-left:.5em}:host input.is-uppercase:not(.is-empty){text-transform:uppercase}:host textarea{background-clip:padding-box;background-color:#fff;background-image:none;border:.0625rem solid #d2d7d9;border-radius:0;display:block;height:auto;line-height:1.25;padding:.3125em .5em;resize:none;width:100%}:host textarea::-moz-selection{background-color:#0084a9;color:#fff}:host textarea::selection{background-color:#0084a9;color:#fff}:host textarea::-webkit-input-placeholder{color:rgba(26,26,35,.38)}:host textarea::-moz-placeholder{color:rgba(26,26,35,.38);opacity:1}:host textarea:-ms-input-placeholder{color:rgba(26,26,35,.38)}:host textarea:-moz-placeholder{color:rgba(26,26,35,.38);opacity:1}:host textarea:required.is-empty{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"><path fill=\"%23ffe433\" d=\"M31.32 21.69l-.09.18-2.48 4.35c-.36.54-.77.62-1.25.27-.12 0-.2 0-.2-.09L19.53 22v9.37a1.26 1.26 0 0 1-.72.67h-5.26c-.59 0-.83-.3-.83-.89 0-.12.15-.21.15-.27V22l-8 4.71h-.12c-.42.66-.8.21-1.16-.27L1 21.82a.82.82 0 0 1 .35-1.26l.18-.1L9 16 .87 11.47v-.09c0-.36-.39-.74-.09-1.16l2.75-4.35v-.09c0-.42.82-.54 1.29-.36l8 4.62V.89c0-.59.18-.89.77-.89h5c.65 0 .91.3.91.89V10l7.94-4.53c.48-.29.72-.21 1.08.27l2.32 4.35v.09c.66.48.45.89-.08 1.25L23 16l7.91 4.53v.09c-.04.18.53.54.41 1.07z\"/></svg>');border-color:#d2d7d9}:host textarea.ng-invalid.ng-touched,:host textarea:required.is-empty{background-position:.25em .5rem;background-repeat:no-repeat;background-size:1em 1em;padding-left:1.5em}:host textarea.ng-invalid.ng-touched{background-color:#fff8cc;background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"><path fill=\"rgba(26, 26, 35, 0.66)\" d=\"M20.21 20.21h-8.42L10.95 0h10.1l-.84 20.21zm-8.42 3.37h8.42V32h-8.42z\"/></svg>')}:host textarea.ng-invalid.ng-touched:not(:focus){border-color:#ffe433}:host textarea.is-pending.ng-invalid,:host textarea.is-pending.ng-pending,:host textarea.is-pending.ng-valid{background-image:url('data:image/svg+xml;charset=utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"40\" height=\"40\" viewBox=\"0 0 50 50\"><path fill=\"%230084a9\" d=\"M43.935 25.145c0-10.318-8.364-18.683-18.683-18.683-10.318 0-18.683 8.365-18.683 18.683h4.068c0-8.071 6.543-14.615 14.615-14.615s14.615 6.543 14.615 14.615h4.068z\"><animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 25 25\" to=\"360 25 25\" dur=\"0.8s\" repeatCount=\"indefinite\"/></path></svg>');background-position:.25em .5rem;background-repeat:no-repeat;background-size:1em 1em;padding-left:1.5em}:host textarea:focus,:host textarea:focus.is-empty{border-color:#0084a9;box-shadow:0 0 0 1px #0084a9;position:relative;z-index:1}:host textarea:disabled{background-color:rgba(26,26,35,.1);border-color:#d2d7d9;color:rgba(26,26,35,.66);opacity:.65}:host textarea:disabled:required,:host textarea:disabled:required.is-empty{background-color:rgba(26,26,35,.1);background-image:none;border-color:#d2d7d9;padding-left:.5em}:host textarea.is-uppercase:not(.is-empty){text-transform:uppercase}:host(.textbox-group-input:not(:last-child)){flex:1 1 0%;width:1px}:host(.textbox-group-input:not(:last-child)) .control{margin-bottom:0}:host(.textbox-group-input:not(:last-child)) .control.is-readonly input{border-right-width:.0625rem}:host(.textbox-group-input:not(:last-child)) input{border-bottom-right-radius:0;border-right-width:0;border-top-right-radius:0}:host(.textbox-group-input:not(:last-child)) input:focus{border-right-width:.0625rem;position:relative;z-index:1}:host(.text-truncate) input{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.is-monospace) input,:host(.is-monospace) textarea,:host-context(.is-monospace) input,:host-context(.is-monospace) textarea{font-family:Consolas,Andale Mono WT,Andale Mono,Lucida Console,Lucida Sans Typewriter,DejaVu Sans Mono,Bitstream Vera Sans Mono,Liberation Mono,Nimbus Mono L,Monaco,Courier New,Courier,monospace}"]
1816
1829
  },] }
1817
1830
  ];
@@ -5075,10 +5088,71 @@ NumericboxComponent.propDecorators = {
5075
5088
  textboxInput: [{ type: ViewChild, args: ['textbox', { static: true },] }]
5076
5089
  };
5077
5090
 
5091
+ class AvatarService {
5092
+ /**
5093
+ * Return the full and abbreviated labels based on the users first name, email, or username. If the user has a first or last name use
5094
+ * either a combination of the first and last name, or the first two characters of the name that is defined. If the user does
5095
+ * not have a first or last name, trying using the first two characters of the email, or the first two characters of the
5096
+ * username as a last ditch effort.
5097
+ * @param user
5098
+ * @returns
5099
+ */
5100
+ getAvatarLabels(user) {
5101
+ let full = undefined;
5102
+ let abbreviation = 'HI';
5103
+ let trimmedUser = this.trimUser(user);
5104
+ if (trimmedUser.firstName || trimmedUser.lastName) {
5105
+ if (trimmedUser.firstName) {
5106
+ abbreviation = trimmedUser.firstName.slice(0, 1);
5107
+ full = trimmedUser.firstName;
5108
+ if (trimmedUser.lastName) {
5109
+ full += ` ${trimmedUser.lastName}`;
5110
+ }
5111
+ }
5112
+ else {
5113
+ abbreviation = trimmedUser.lastName.slice(0, 1);
5114
+ full = trimmedUser.lastName;
5115
+ }
5116
+ }
5117
+ else if (trimmedUser.email) {
5118
+ abbreviation = trimmedUser.email.slice(0, 1);
5119
+ full = trimmedUser.email;
5120
+ }
5121
+ else if (trimmedUser.username) {
5122
+ abbreviation = trimmedUser.username.slice(0, 1);
5123
+ full = trimmedUser.username;
5124
+ }
5125
+ return {
5126
+ abbreviation: abbreviation,
5127
+ full: full
5128
+ };
5129
+ }
5130
+ /**
5131
+ * Return a new user object that has all of the properties of the existing user
5132
+ * with any null, undefined, or whitespace values removed
5133
+ */
5134
+ trimUser(user) {
5135
+ let trimmedUser = {
5136
+ email: (user.email || '').trim(),
5137
+ firstName: (user.firstName || '').trim(),
5138
+ lastName: (user.lastName || '').trim(),
5139
+ username: (user.username || '').trim()
5140
+ };
5141
+ return trimmedUser;
5142
+ }
5143
+ }
5144
+ AvatarService.ɵprov = ɵɵdefineInjectable({ factory: function AvatarService_Factory() { return new AvatarService(); }, token: AvatarService, providedIn: "root" });
5145
+ AvatarService.decorators = [
5146
+ { type: Injectable, args: [{
5147
+ providedIn: 'root'
5148
+ },] }
5149
+ ];
5150
+
5078
5151
  class AvatarComponent {
5079
- constructor(el, renderer) {
5152
+ constructor(el, renderer, avatarService) {
5080
5153
  this.el = el;
5081
5154
  this.renderer = renderer;
5155
+ this.avatarService = avatarService;
5082
5156
  /** Color map base on the first let of the label */
5083
5157
  this.colors = {
5084
5158
  abcde01: 'red',
@@ -5101,49 +5175,14 @@ class AvatarComponent {
5101
5175
  this.updateColor();
5102
5176
  }
5103
5177
  /**
5104
- * Update the Avatar label based on the users first name, email, or username. If the user has a first or last name use
5105
- * either a combination of the first and last name, or the first two characters of the name that is defined. If the user does
5106
- * not have a first or last name, trying using the first two characters of the email, or the first two characters of the
5107
- * username as a last ditch effort.
5178
+ * Update the Avatar label
5179
+ *
5108
5180
  */
5109
5181
  updateLabel() {
5110
5182
  if (this.user) {
5111
- let trimmedUser = this.trimUser(this.user);
5112
- if (trimmedUser.firstName || trimmedUser.lastName) {
5113
- if (trimmedUser.firstName) {
5114
- this.label = trimmedUser.firstName.slice(0, 1);
5115
- this.user.userMenuTitle = trimmedUser.firstName;
5116
- if (trimmedUser.lastName) {
5117
- this.user.userMenuTitle += ` ${trimmedUser.lastName}`;
5118
- }
5119
- }
5120
- else {
5121
- this.label = trimmedUser.lastName.slice(0, 1);
5122
- this.user.userMenuTitle = trimmedUser.lastName;
5123
- }
5124
- }
5125
- else if (trimmedUser.email) {
5126
- this.label = trimmedUser.email.slice(0, 1);
5127
- this.user.userMenuTitle = trimmedUser.email;
5128
- }
5129
- else if (trimmedUser.username) {
5130
- this.label = trimmedUser.username.slice(0, 1);
5131
- this.user.userMenuTitle = trimmedUser.username;
5132
- }
5183
+ this.label = this.avatarService.getAvatarLabels(this.user).abbreviation;
5133
5184
  }
5134
5185
  }
5135
- /** Return a new user object that has all of the properties of the existing user
5136
- * with any null, undefined, or whitespace values removed
5137
- */
5138
- trimUser(user) {
5139
- let trimmedUser = {
5140
- email: (user.email || '').trim(),
5141
- firstName: (user.firstName || '').trim(),
5142
- lastName: (user.lastName || '').trim(),
5143
- username: (user.username || '').trim()
5144
- };
5145
- return trimmedUser;
5146
- }
5147
5186
  /**
5148
5187
  * Sets the color of the Avatar based on the first letter of the label. If the label is HI or is not
5149
5188
  * a letter, default to gray.
@@ -5173,14 +5212,16 @@ AvatarComponent.decorators = [
5173
5212
  ];
5174
5213
  AvatarComponent.ctorParameters = () => [
5175
5214
  { type: ElementRef },
5176
- { type: Renderer2 }
5215
+ { type: Renderer2 },
5216
+ { type: AvatarService }
5177
5217
  ];
5178
5218
  AvatarComponent.propDecorators = {
5179
5219
  user: [{ type: Input }]
5180
5220
  };
5181
5221
 
5182
5222
  class AppBarComponent {
5183
- constructor() {
5223
+ constructor(avatarService) {
5224
+ this.avatarService = avatarService;
5184
5225
  this.user = {};
5185
5226
  this.userMenuItems = [];
5186
5227
  this.userMenuWidth = 0;
@@ -5188,14 +5229,22 @@ class AppBarComponent {
5188
5229
  this.userMenuTabindex = 0;
5189
5230
  this.iconPath = '/assets/images/icon.svg';
5190
5231
  }
5232
+ ngOnChanges() {
5233
+ if (this.user) {
5234
+ this.userMenuTitle = this.avatarService.getAvatarLabels(this.user).full;
5235
+ }
5236
+ }
5191
5237
  }
5192
5238
  AppBarComponent.decorators = [
5193
5239
  { type: Component, args: [{
5194
5240
  selector: 'ec-app-bar',
5195
- template: "<section class=\"logo-container\">\r\n <img src=\"{{iconPath}}\" alt=\"EnergyCAP Platform\">\r\n</section>\r\n\r\n<section class=\"title-container\">\r\n <ng-content select=\".app-bar-title\"></ng-content>\r\n</section>\r\n\r\n<section class=\"actions-container\">\r\n <ng-content select=\".app-bar-actions\"></ng-content>\r\n <ec-dropdown id=\"AppBarUserMenu\"\r\n *ngIf=\"userMenuItems.length; else avatar\"\r\n [menuTitle]=\"user?.userMenuTitle\"\r\n [items]=\"userMenuItems\"\r\n [buttonCustomTemplate]=\"avatar\"\r\n [showArrow]=\"false\"\r\n [menuWidth]=\"userMenuWidth\"\r\n [menuMinWidth]=\"userMenuMinWidth\"\r\n [tabindex]=\"userMenuTabindex\"></ec-dropdown>\r\n</section>\r\n\r\n<ng-template #avatar>\r\n <div class=\"p-1\">\r\n <ec-avatar [user]=\"user\"></ec-avatar>\r\n </div>\r\n</ng-template>",
5241
+ template: "<section class=\"logo-container\">\r\n <img src=\"{{iconPath}}\"\r\n alt=\"EnergyCAP Platform\">\r\n</section>\r\n\r\n<section class=\"title-container\">\r\n <ng-content select=\".app-bar-title\"></ng-content>\r\n</section>\r\n\r\n<section class=\"actions-container\">\r\n <ng-content select=\".app-bar-actions\"></ng-content>\r\n <ec-dropdown id=\"AppBarUserMenu\"\r\n *ngIf=\"userMenuItems.length; else avatar\"\r\n [menuTitle]=\"userMenuTitle\"\r\n [items]=\"userMenuItems\"\r\n [buttonCustomTemplate]=\"avatar\"\r\n [showArrow]=\"false\"\r\n [menuWidth]=\"userMenuWidth\"\r\n [menuMinWidth]=\"userMenuMinWidth\"\r\n [tabindex]=\"userMenuTabindex\"></ec-dropdown>\r\n</section>\r\n\r\n<ng-template #avatar>\r\n <div class=\"p-1\">\r\n <ec-avatar [user]=\"user\"></ec-avatar>\r\n </div>\r\n</ng-template>",
5196
5242
  styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}:host{align-items:center;background-color:#fff;display:flex;height:3rem;padding:0 .75rem 0 1rem;position:relative;width:100%;z-index:40}:host ::ng-deep .app-bar-actions{align-items:center;display:flex;justify-content:flex-end;margin-right:.25rem}section{flex:1 1}.logo-container img{height:2rem;width:2rem}.title-container{text-align:center}.actions-container{display:flex;justify-content:flex-end}"]
5197
5243
  },] }
5198
5244
  ];
5245
+ AppBarComponent.ctorParameters = () => [
5246
+ { type: AvatarService }
5247
+ ];
5199
5248
  AppBarComponent.propDecorators = {
5200
5249
  user: [{ type: Input }],
5201
5250
  userMenuItems: [{ type: Input }],
@@ -8006,5 +8055,5 @@ PageBaseComponentTestInjectorFactory.ComponentProviders = [
8006
8055
  * Generated bundle index. Do not edit.
8007
8056
  */
8008
8057
 
8009
- export { AppBarComponent, AvatarComponent, BannerComponent, ButtonComponent, CacheService, CheckboxComponent, ClickAreaForDirective, CollapsibleToggleComponent, ComboboxComponent, ComponentsModule, ConfirmComponent, ConfirmDialogContext, CopyButtonDirective, CustomValidators, DateDisplayPipe, DateTimeHelper, DialogCloseDuration, DialogCloseEvent, DialogCloseLatestEvent, DialogComponent, DialogEvent, DialogGroupComponent, DialogOpenDuration, DialogOpenEndEvent, DialogOpenStartEvent, DialogResult, DialogService, DropdownComponent, ErrorService, FileTypeExtensions, FileUploadComponent, FormControlBase, FormControlComponent, FormGroupComponent, FormGroupHelper, IfViewportWidthDirective, ItemDisplayComponent, JsonDisplayComponent, JsonHelper, MenuComponent, MockActivatedRoute, MockDateDisplayPipe, MockDialog, MockDialogContent, MockTranslateService, MockTranslationHelperService, NavGroup, NavItemActiveDirective, NumericboxComponent, Overlay, PageBaseComponent, PageBaseComponentTestHelper, PageBaseComponentTestInjectorFactory, PageInitResult, PageTitleComponent, PageViewComponent, PanelCloseDuration, PanelOpenDuration, PopoverComponent, PopupContainerDirective, RadioButtonComponent, RadioButtonOption, ResizableColumnComponent, RowCountPipe, ScrollService, SearchableTableComponent, SelectComponent, SpinnerComponent, SplashComponent, SplashService, SpyFactory, TableComponent, TableLockedColumnComponent, TableMasterHeaderRowComponent, TableMasterRowComponent, TablePaginationComponent, TableSelectableRowComponent, TableSelectableRowContext, TabsComponent, Tag, TagsComponent, TelemetryBaseService, TextboxComponent, TimeDisplayPipe, ToastComponent, ToastEvent, ToastService, ToasterComponent, UnicodeStrings, UserPreferenceService, ValidationMessageService, ViewOverlayComponent, WindowService, canadianPostalCodeRegex, clickEvent, dateInputFormatRegex, findAllSpacesPattern, forEachFormControl, getApiError, getControlValue, getDecimalPattern, integerPattern, isApiError, menuAnimationSpeed, mockRouterFactory, numericboxValidation, orderByIgnoreCase, otherZipCodeRegex, sortByIgnoreCase, textboxValidation, unitedStatesZipCodeRegex, validateFormGroupValuesAreUnique, ResizableTableDirective as ɵa, ResizableBase as ɵb, TableDetailRowComponent as ɵc, TelemetryService as ɵd };
8058
+ export { AppBarComponent, AvatarComponent, BannerComponent, ButtonComponent, CacheService, CheckboxComponent, ClickAreaForDirective, CollapsibleToggleComponent, ComboboxComponent, ComponentsModule, ConfirmComponent, ConfirmDialogContext, CopyButtonDirective, CustomValidators, DateDisplayPipe, DateTimeHelper, DialogCloseDuration, DialogCloseEvent, DialogCloseLatestEvent, DialogComponent, DialogEvent, DialogGroupComponent, DialogOpenDuration, DialogOpenEndEvent, DialogOpenStartEvent, DialogResult, DialogService, DropdownComponent, ErrorService, FileTypeExtensions, FileUploadComponent, FormControlBase, FormControlComponent, FormGroupComponent, FormGroupHelper, IfViewportWidthDirective, ItemDisplayComponent, JsonDisplayComponent, JsonHelper, MenuComponent, MockActivatedRoute, MockDateDisplayPipe, MockDialog, MockDialogContent, MockTranslateService, MockTranslationHelperService, NavGroup, NavItemActiveDirective, NumericboxComponent, Overlay, PageBaseComponent, PageBaseComponentTestHelper, PageBaseComponentTestInjectorFactory, PageInitResult, PageTitleComponent, PageViewComponent, PanelCloseDuration, PanelOpenDuration, PopoverComponent, PopupContainerDirective, RadioButtonComponent, RadioButtonOption, ResizableColumnComponent, RowCountPipe, ScrollService, SearchableTableComponent, SelectComponent, SpinnerComponent, SplashComponent, SplashService, SpyFactory, TableComponent, TableLockedColumnComponent, TableMasterHeaderRowComponent, TableMasterRowComponent, TablePaginationComponent, TableSelectableRowComponent, TableSelectableRowContext, TabsComponent, Tag, TagsComponent, TelemetryBaseService, TextboxComponent, TimeDisplayPipe, ToastComponent, ToastEvent, ToastService, ToasterComponent, UnicodeStrings, UserPreferenceService, ValidationMessageService, ViewOverlayComponent, WindowService, canadianPostalCodeRegex, clickEvent, dateInputFormatRegex, findAllSpacesPattern, forEachFormControl, getApiError, getControlValue, getDecimalPattern, integerPattern, isApiError, menuAnimationSpeed, mockRouterFactory, numericboxValidation, orderByIgnoreCase, otherZipCodeRegex, phoneNumberValidationPattern, sortByIgnoreCase, textboxValidation, unitedStatesZipCodeRegex, urlValidationPattern, validateFormGroupValuesAreUnique, ResizableTableDirective as ɵa, ResizableBase as ɵb, AvatarService as ɵc, TableDetailRowComponent as ɵd, TelemetryService as ɵe };
8010
8059
  //# sourceMappingURL=energycap-components.js.map