@ibragim-dev-org/ui-forge-library 1.4.64 → 1.4.67
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.
|
@@ -1733,23 +1733,26 @@ class UiAvatarDirective {
|
|
|
1733
1733
|
this.elementRef = elementRef;
|
|
1734
1734
|
this.renderer = renderer;
|
|
1735
1735
|
effect(() => {
|
|
1736
|
-
|
|
1737
|
-
const canShow = this.$canShowAvatar();
|
|
1738
|
-
const acronym = this.$acronym()
|
|
1739
|
-
.trim()
|
|
1740
|
-
.split(/\s+/)
|
|
1741
|
-
.slice(0, 2)
|
|
1742
|
-
.map((w) => w[0]?.toUpperCase() || '')
|
|
1743
|
-
.join('');
|
|
1744
|
-
this.$text.set(acronym);
|
|
1745
|
-
if (src && canShow) {
|
|
1746
|
-
this.renderer.removeStyle(this.elementRef.nativeElement, 'background');
|
|
1747
|
-
return;
|
|
1748
|
-
}
|
|
1749
|
-
const colorValue = this.$acronym();
|
|
1750
|
-
this.renderer.setStyle(this.elementRef.nativeElement, 'background', stringToColorGradient(colorValue));
|
|
1736
|
+
this.setStyleBackground();
|
|
1751
1737
|
});
|
|
1752
1738
|
}
|
|
1739
|
+
setStyleBackground() {
|
|
1740
|
+
const src = this.$src()?.trim();
|
|
1741
|
+
const canShow = this.$canShowAvatar();
|
|
1742
|
+
const acronym = this.$acronym()
|
|
1743
|
+
.trim()
|
|
1744
|
+
.split(/\s+/)
|
|
1745
|
+
.slice(0, 2)
|
|
1746
|
+
.map((w) => w[0]?.toUpperCase() || '')
|
|
1747
|
+
.join('');
|
|
1748
|
+
this.$text.set(acronym);
|
|
1749
|
+
if (src && canShow) {
|
|
1750
|
+
this.renderer.removeStyle(this.elementRef.nativeElement, 'background');
|
|
1751
|
+
return;
|
|
1752
|
+
}
|
|
1753
|
+
const colorValue = this.$acronym();
|
|
1754
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'background', stringToColorGradient(colorValue));
|
|
1755
|
+
}
|
|
1753
1756
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAvatarDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1754
1757
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: UiAvatarDirective, isStandalone: true, selector: "app-ui-avatar", inputs: { $size: { classPropertyName: "$size", publicName: "$size", isSignal: true, isRequired: false, transformFunction: null }, $isRounded: { classPropertyName: "$isRounded", publicName: "$isRounded", isSignal: true, isRequired: false, transformFunction: null }, $src: { classPropertyName: "$src", publicName: "$src", isSignal: true, isRequired: true, transformFunction: null }, $acronym: { classPropertyName: "$acronym", publicName: "$acronym", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.nano": "$size() === 'nano'", "class.micro": "$size() === 'micro'", "class.extra-small": "$size() === 'extra-small'", "class.small": "$size() === 'small'", "class.medium": "$size() === 'medium'", "class.large": "$size() === 'large'", "class.extra-large": "$size() === 'extra-large'", "class.xx-large": "$size() === 'xx-large'", "class.xxx-large": "$size() === 'xxx-large'", "class.rounded": "$isRounded()" } }, ngImport: i0 });
|
|
1755
1758
|
}
|