@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.
- package/bundles/energycap-components.umd.js +102 -47
- package/bundles/energycap-components.umd.js.map +1 -1
- package/bundles/energycap-components.umd.min.js +1 -1
- package/bundles/energycap-components.umd.min.js.map +1 -1
- package/energycap-components.d.ts +3 -2
- package/energycap-components.metadata.json +1 -1
- package/esm2015/energycap-components.js +4 -3
- package/esm2015/lib/controls/textbox/textbox.component.js +17 -4
- package/esm2015/lib/display/app-bar/app-bar.component.js +13 -3
- package/esm2015/lib/display/avatar/avatar.component.js +9 -41
- package/esm2015/lib/display/avatar/avatar.service.js +62 -0
- package/fesm2015/energycap-components.js +95 -46
- package/fesm2015/energycap-components.js.map +1 -1
- package/lib/controls/textbox/textbox.component.d.ts +12 -6
- package/lib/display/app-bar/app-bar.component.d.ts +7 -1
- package/lib/display/avatar/avatar.component.d.ts +5 -10
- package/lib/display/avatar/avatar.service.d.ts +21 -0
- package/package.json +1 -1
|
@@ -3969,6 +3969,8 @@
|
|
|
3969
3969
|
}
|
|
3970
3970
|
};
|
|
3971
3971
|
};
|
|
3972
|
+
var phoneNumberValidationPattern = '^\\s*(?:\\+?(\\d{1,3}))?[-. (]*(\\d{3})[-. )]*(\\d{3})[-. ]*(\\d{4})(?: *x(\\d+))?\\s*$';
|
|
3973
|
+
var urlValidationPattern = '([A-Za-z])+(:\/\/)+[^\\s]*';
|
|
3972
3974
|
var TextboxComponent = /** @class */ (function (_super) {
|
|
3973
3975
|
__extends(TextboxComponent, _super);
|
|
3974
3976
|
function TextboxComponent(validationMessageService, formGroupHelper, translate) {
|
|
@@ -3985,7 +3987,7 @@
|
|
|
3985
3987
|
*/
|
|
3986
3988
|
_this.type = "text";
|
|
3987
3989
|
/**
|
|
3988
|
-
* The value of the rows
|
|
3990
|
+
* The value of the rows attribute for a textarea. Only applies to multi-line type
|
|
3989
3991
|
*/
|
|
3990
3992
|
_this.rows = 3;
|
|
3991
3993
|
/**
|
|
@@ -3997,6 +3999,10 @@
|
|
|
3997
3999
|
* If set to true, we will upper case on focus out
|
|
3998
4000
|
*/
|
|
3999
4001
|
_this.upperCase = false;
|
|
4002
|
+
/**
|
|
4003
|
+
* Validation pattern for the input. This is determined on the input type specified
|
|
4004
|
+
*/
|
|
4005
|
+
_this.validationPattern = '';
|
|
4000
4006
|
return _this;
|
|
4001
4007
|
}
|
|
4002
4008
|
TextboxComponent.prototype.ngOnChanges = function (changes) {
|
|
@@ -4008,6 +4014,13 @@
|
|
|
4008
4014
|
TextboxComponent.prototype.ngOnInit = function () {
|
|
4009
4015
|
var _this = this;
|
|
4010
4016
|
_super.prototype.ngOnInit.call(this);
|
|
4017
|
+
this.validationPattern = '';
|
|
4018
|
+
if (this.type === 'tel') {
|
|
4019
|
+
this.validationPattern = phoneNumberValidationPattern;
|
|
4020
|
+
}
|
|
4021
|
+
else if (this.type === 'url') {
|
|
4022
|
+
this.validationPattern = urlValidationPattern;
|
|
4023
|
+
}
|
|
4011
4024
|
if (this.placeholder) {
|
|
4012
4025
|
this.translate.get(this.placeholder)
|
|
4013
4026
|
.subscribe(function (translated) {
|
|
@@ -4024,7 +4037,7 @@
|
|
|
4024
4037
|
}
|
|
4025
4038
|
};
|
|
4026
4039
|
/**
|
|
4027
|
-
* Function to set focus on an input
|
|
4040
|
+
* Function to set focus on an input programmatically after the page
|
|
4028
4041
|
* had been rendered. The highlight text flag will select the text
|
|
4029
4042
|
* within the input if passed in and true
|
|
4030
4043
|
*/
|
|
@@ -4048,7 +4061,7 @@
|
|
|
4048
4061
|
TextboxComponent.decorators = [
|
|
4049
4062
|
{ type: i0.Component, args: [{
|
|
4050
4063
|
selector: 'ec-textbox',
|
|
4051
|
-
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=\"{{
|
|
4064
|
+
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>",
|
|
4052
4065
|
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}"]
|
|
4053
4066
|
},] }
|
|
4054
4067
|
];
|
|
@@ -5390,10 +5403,74 @@
|
|
|
5390
5403
|
textboxInput: [{ type: i0.ViewChild, args: ['textbox', { static: true },] }]
|
|
5391
5404
|
};
|
|
5392
5405
|
|
|
5406
|
+
var AvatarService = /** @class */ (function () {
|
|
5407
|
+
function AvatarService() {
|
|
5408
|
+
}
|
|
5409
|
+
/**
|
|
5410
|
+
* 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
|
|
5411
|
+
* either a combination of the first and last name, or the first two characters of the name that is defined. If the user does
|
|
5412
|
+
* not have a first or last name, trying using the first two characters of the email, or the first two characters of the
|
|
5413
|
+
* username as a last ditch effort.
|
|
5414
|
+
* @param user
|
|
5415
|
+
* @returns
|
|
5416
|
+
*/
|
|
5417
|
+
AvatarService.prototype.getAvatarLabels = function (user) {
|
|
5418
|
+
var full = undefined;
|
|
5419
|
+
var abbreviation = 'HI';
|
|
5420
|
+
var trimmedUser = this.trimUser(user);
|
|
5421
|
+
if (trimmedUser.firstName || trimmedUser.lastName) {
|
|
5422
|
+
if (trimmedUser.firstName) {
|
|
5423
|
+
abbreviation = trimmedUser.firstName.slice(0, 1);
|
|
5424
|
+
full = trimmedUser.firstName;
|
|
5425
|
+
if (trimmedUser.lastName) {
|
|
5426
|
+
full += " " + trimmedUser.lastName;
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
else {
|
|
5430
|
+
abbreviation = trimmedUser.lastName.slice(0, 1);
|
|
5431
|
+
full = trimmedUser.lastName;
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5434
|
+
else if (trimmedUser.email) {
|
|
5435
|
+
abbreviation = trimmedUser.email.slice(0, 1);
|
|
5436
|
+
full = trimmedUser.email;
|
|
5437
|
+
}
|
|
5438
|
+
else if (trimmedUser.username) {
|
|
5439
|
+
abbreviation = trimmedUser.username.slice(0, 1);
|
|
5440
|
+
full = trimmedUser.username;
|
|
5441
|
+
}
|
|
5442
|
+
return {
|
|
5443
|
+
abbreviation: abbreviation,
|
|
5444
|
+
full: full
|
|
5445
|
+
};
|
|
5446
|
+
};
|
|
5447
|
+
/**
|
|
5448
|
+
* Return a new user object that has all of the properties of the existing user
|
|
5449
|
+
* with any null, undefined, or whitespace values removed
|
|
5450
|
+
*/
|
|
5451
|
+
AvatarService.prototype.trimUser = function (user) {
|
|
5452
|
+
var trimmedUser = {
|
|
5453
|
+
email: (user.email || '').trim(),
|
|
5454
|
+
firstName: (user.firstName || '').trim(),
|
|
5455
|
+
lastName: (user.lastName || '').trim(),
|
|
5456
|
+
username: (user.username || '').trim()
|
|
5457
|
+
};
|
|
5458
|
+
return trimmedUser;
|
|
5459
|
+
};
|
|
5460
|
+
return AvatarService;
|
|
5461
|
+
}());
|
|
5462
|
+
AvatarService.ɵprov = i0.ɵɵdefineInjectable({ factory: function AvatarService_Factory() { return new AvatarService(); }, token: AvatarService, providedIn: "root" });
|
|
5463
|
+
AvatarService.decorators = [
|
|
5464
|
+
{ type: i0.Injectable, args: [{
|
|
5465
|
+
providedIn: 'root'
|
|
5466
|
+
},] }
|
|
5467
|
+
];
|
|
5468
|
+
|
|
5393
5469
|
var AvatarComponent = /** @class */ (function () {
|
|
5394
|
-
function AvatarComponent(el, renderer) {
|
|
5470
|
+
function AvatarComponent(el, renderer, avatarService) {
|
|
5395
5471
|
this.el = el;
|
|
5396
5472
|
this.renderer = renderer;
|
|
5473
|
+
this.avatarService = avatarService;
|
|
5397
5474
|
/** Color map base on the first let of the label */
|
|
5398
5475
|
this.colors = {
|
|
5399
5476
|
abcde01: 'red',
|
|
@@ -5416,49 +5493,14 @@
|
|
|
5416
5493
|
this.updateColor();
|
|
5417
5494
|
};
|
|
5418
5495
|
/**
|
|
5419
|
-
* Update the Avatar label
|
|
5420
|
-
*
|
|
5421
|
-
* not have a first or last name, trying using the first two characters of the email, or the first two characters of the
|
|
5422
|
-
* username as a last ditch effort.
|
|
5496
|
+
* Update the Avatar label
|
|
5497
|
+
*
|
|
5423
5498
|
*/
|
|
5424
5499
|
AvatarComponent.prototype.updateLabel = function () {
|
|
5425
5500
|
if (this.user) {
|
|
5426
|
-
|
|
5427
|
-
if (trimmedUser.firstName || trimmedUser.lastName) {
|
|
5428
|
-
if (trimmedUser.firstName) {
|
|
5429
|
-
this.label = trimmedUser.firstName.slice(0, 1);
|
|
5430
|
-
this.user.userMenuTitle = trimmedUser.firstName;
|
|
5431
|
-
if (trimmedUser.lastName) {
|
|
5432
|
-
this.user.userMenuTitle += " " + trimmedUser.lastName;
|
|
5433
|
-
}
|
|
5434
|
-
}
|
|
5435
|
-
else {
|
|
5436
|
-
this.label = trimmedUser.lastName.slice(0, 1);
|
|
5437
|
-
this.user.userMenuTitle = trimmedUser.lastName;
|
|
5438
|
-
}
|
|
5439
|
-
}
|
|
5440
|
-
else if (trimmedUser.email) {
|
|
5441
|
-
this.label = trimmedUser.email.slice(0, 1);
|
|
5442
|
-
this.user.userMenuTitle = trimmedUser.email;
|
|
5443
|
-
}
|
|
5444
|
-
else if (trimmedUser.username) {
|
|
5445
|
-
this.label = trimmedUser.username.slice(0, 1);
|
|
5446
|
-
this.user.userMenuTitle = trimmedUser.username;
|
|
5447
|
-
}
|
|
5501
|
+
this.label = this.avatarService.getAvatarLabels(this.user).abbreviation;
|
|
5448
5502
|
}
|
|
5449
5503
|
};
|
|
5450
|
-
/** Return a new user object that has all of the properties of the existing user
|
|
5451
|
-
* with any null, undefined, or whitespace values removed
|
|
5452
|
-
*/
|
|
5453
|
-
AvatarComponent.prototype.trimUser = function (user) {
|
|
5454
|
-
var trimmedUser = {
|
|
5455
|
-
email: (user.email || '').trim(),
|
|
5456
|
-
firstName: (user.firstName || '').trim(),
|
|
5457
|
-
lastName: (user.lastName || '').trim(),
|
|
5458
|
-
username: (user.username || '').trim()
|
|
5459
|
-
};
|
|
5460
|
-
return trimmedUser;
|
|
5461
|
-
};
|
|
5462
5504
|
/**
|
|
5463
5505
|
* Sets the color of the Avatar based on the first letter of the label. If the label is HI or is not
|
|
5464
5506
|
* a letter, default to gray.
|
|
@@ -5489,14 +5531,16 @@
|
|
|
5489
5531
|
];
|
|
5490
5532
|
AvatarComponent.ctorParameters = function () { return [
|
|
5491
5533
|
{ type: i0.ElementRef },
|
|
5492
|
-
{ type: i0.Renderer2 }
|
|
5534
|
+
{ type: i0.Renderer2 },
|
|
5535
|
+
{ type: AvatarService }
|
|
5493
5536
|
]; };
|
|
5494
5537
|
AvatarComponent.propDecorators = {
|
|
5495
5538
|
user: [{ type: i0.Input }]
|
|
5496
5539
|
};
|
|
5497
5540
|
|
|
5498
5541
|
var AppBarComponent = /** @class */ (function () {
|
|
5499
|
-
function AppBarComponent() {
|
|
5542
|
+
function AppBarComponent(avatarService) {
|
|
5543
|
+
this.avatarService = avatarService;
|
|
5500
5544
|
this.user = {};
|
|
5501
5545
|
this.userMenuItems = [];
|
|
5502
5546
|
this.userMenuWidth = 0;
|
|
@@ -5504,15 +5548,23 @@
|
|
|
5504
5548
|
this.userMenuTabindex = 0;
|
|
5505
5549
|
this.iconPath = '/assets/images/icon.svg';
|
|
5506
5550
|
}
|
|
5551
|
+
AppBarComponent.prototype.ngOnChanges = function () {
|
|
5552
|
+
if (this.user) {
|
|
5553
|
+
this.userMenuTitle = this.avatarService.getAvatarLabels(this.user).full;
|
|
5554
|
+
}
|
|
5555
|
+
};
|
|
5507
5556
|
return AppBarComponent;
|
|
5508
5557
|
}());
|
|
5509
5558
|
AppBarComponent.decorators = [
|
|
5510
5559
|
{ type: i0.Component, args: [{
|
|
5511
5560
|
selector: 'ec-app-bar',
|
|
5512
|
-
template: "<section class=\"logo-container\">\r\n <img src=\"{{iconPath}}\"
|
|
5561
|
+
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>",
|
|
5513
5562
|
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}"]
|
|
5514
5563
|
},] }
|
|
5515
5564
|
];
|
|
5565
|
+
AppBarComponent.ctorParameters = function () { return [
|
|
5566
|
+
{ type: AvatarService }
|
|
5567
|
+
]; };
|
|
5516
5568
|
AppBarComponent.propDecorators = {
|
|
5517
5569
|
user: [{ type: i0.Input }],
|
|
5518
5570
|
userMenuItems: [{ type: i0.Input }],
|
|
@@ -8859,14 +8911,17 @@
|
|
|
8859
8911
|
exports.numericboxValidation = numericboxValidation;
|
|
8860
8912
|
exports.orderByIgnoreCase = orderByIgnoreCase;
|
|
8861
8913
|
exports.otherZipCodeRegex = otherZipCodeRegex;
|
|
8914
|
+
exports.phoneNumberValidationPattern = phoneNumberValidationPattern;
|
|
8862
8915
|
exports.sortByIgnoreCase = sortByIgnoreCase;
|
|
8863
8916
|
exports.textboxValidation = textboxValidation;
|
|
8864
8917
|
exports.unitedStatesZipCodeRegex = unitedStatesZipCodeRegex;
|
|
8918
|
+
exports.urlValidationPattern = urlValidationPattern;
|
|
8865
8919
|
exports.validateFormGroupValuesAreUnique = validateFormGroupValuesAreUnique;
|
|
8866
8920
|
exports.ɵa = ResizableTableDirective;
|
|
8867
8921
|
exports.ɵb = ResizableBase;
|
|
8868
|
-
exports.ɵc =
|
|
8869
|
-
exports.ɵd =
|
|
8922
|
+
exports.ɵc = AvatarService;
|
|
8923
|
+
exports.ɵd = TableDetailRowComponent;
|
|
8924
|
+
exports.ɵe = TelemetryService;
|
|
8870
8925
|
|
|
8871
8926
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8872
8927
|
|