@ibragim-dev-org/ui-forge-library 1.2.7 → 1.2.9
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.
|
@@ -239,21 +239,22 @@ class LazyImgDirective {
|
|
|
239
239
|
lazySrc;
|
|
240
240
|
loadError = new EventEmitter();
|
|
241
241
|
observer;
|
|
242
|
+
onError = () => {
|
|
243
|
+
this.loadError.emit();
|
|
244
|
+
};
|
|
242
245
|
constructor(el, lazyService) {
|
|
243
246
|
this.el = el;
|
|
244
247
|
this.lazyService = lazyService;
|
|
245
248
|
}
|
|
246
|
-
onError() {
|
|
247
|
-
this.loadError.emit();
|
|
248
|
-
}
|
|
249
249
|
ngOnInit() {
|
|
250
250
|
const img = this.el.nativeElement;
|
|
251
|
-
|
|
251
|
+
const lazySrc = this.lazySrc?.trim() ?? '';
|
|
252
|
+
if (lazySrc.length === 0 || /(?:^|\/)null(?:[?#].*)?$/i.test(lazySrc)) {
|
|
252
253
|
this.loadError.emit();
|
|
253
254
|
return;
|
|
254
255
|
}
|
|
255
256
|
img.addEventListener('error', this.onError);
|
|
256
|
-
img.setAttribute('data-src',
|
|
257
|
+
img.setAttribute('data-src', lazySrc);
|
|
257
258
|
this.observer = this.lazyService.getObserver();
|
|
258
259
|
this.observer.observe(img);
|
|
259
260
|
}
|
|
@@ -1110,14 +1111,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
1110
1111
|
}]
|
|
1111
1112
|
}], ctorParameters: () => [{ type: i1.Overlay }, { type: i2$1.Router }] });
|
|
1112
1113
|
|
|
1114
|
+
const avatarSizes = ['small', 'medium', 'large'];
|
|
1113
1115
|
class UiAvatarDirective {
|
|
1114
|
-
|
|
1116
|
+
elementRef;
|
|
1117
|
+
renderer;
|
|
1118
|
+
$size = input('medium', ...(ngDevMode ? [{ debugName: "$size" }] : []));
|
|
1119
|
+
$isRounded = input(false, ...(ngDevMode ? [{ debugName: "$isRounded" }] : []));
|
|
1115
1120
|
$src = input.required(...(ngDevMode ? [{ debugName: "$src" }] : []));
|
|
1116
1121
|
$acronym = input.required(...(ngDevMode ? [{ debugName: "$acronym" }] : []));
|
|
1117
|
-
$backgroundColor = signal('', ...(ngDevMode ? [{ debugName: "$backgroundColor" }] : []));
|
|
1118
1122
|
$text = signal('', ...(ngDevMode ? [{ debugName: "$text" }] : []));
|
|
1119
1123
|
$canShowAvatar = signal(true, ...(ngDevMode ? [{ debugName: "$canShowAvatar" }] : []));
|
|
1120
|
-
constructor() {
|
|
1124
|
+
constructor(elementRef, renderer) {
|
|
1125
|
+
this.elementRef = elementRef;
|
|
1126
|
+
this.renderer = renderer;
|
|
1121
1127
|
effect(() => {
|
|
1122
1128
|
let acronym = '';
|
|
1123
1129
|
this.$acronym()
|
|
@@ -1125,19 +1131,34 @@ class UiAvatarDirective {
|
|
|
1125
1131
|
.forEach((v) => {
|
|
1126
1132
|
acronym = acronym + v[0];
|
|
1127
1133
|
});
|
|
1128
|
-
this
|
|
1134
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'background-color', stringToHslColor(acronym[0]));
|
|
1129
1135
|
this.$text.set(acronym);
|
|
1130
1136
|
});
|
|
1137
|
+
effect(() => {
|
|
1138
|
+
if (this.$isRounded()) {
|
|
1139
|
+
this.renderer.addClass(this.elementRef.nativeElement, 'rounded');
|
|
1140
|
+
}
|
|
1141
|
+
else {
|
|
1142
|
+
this.renderer.removeClass(this.elementRef.nativeElement, 'rounded');
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
effect(() => {
|
|
1146
|
+
avatarSizes.forEach((size) => {
|
|
1147
|
+
this.renderer.removeClass(this.elementRef.nativeElement, size);
|
|
1148
|
+
});
|
|
1149
|
+
const size = this.$size();
|
|
1150
|
+
this.renderer.addClass(this.elementRef.nativeElement, size);
|
|
1151
|
+
});
|
|
1131
1152
|
}
|
|
1132
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAvatarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1133
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: UiAvatarDirective, isStandalone: true, selector: "app-ui-avatar", inputs: { $
|
|
1153
|
+
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 });
|
|
1154
|
+
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 } }, ngImport: i0 });
|
|
1134
1155
|
}
|
|
1135
1156
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAvatarDirective, decorators: [{
|
|
1136
1157
|
type: Directive,
|
|
1137
1158
|
args: [{
|
|
1138
1159
|
selector: 'app-ui-avatar',
|
|
1139
1160
|
}]
|
|
1140
|
-
}], ctorParameters: () => [], propDecorators: { $
|
|
1161
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { $size: [{ type: i0.Input, args: [{ isSignal: true, alias: "$size", required: false }] }], $isRounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "$isRounded", required: false }] }], $src: [{ type: i0.Input, args: [{ isSignal: true, alias: "$src", required: true }] }], $acronym: [{ type: i0.Input, args: [{ isSignal: true, alias: "$acronym", required: true }] }] } });
|
|
1141
1162
|
|
|
1142
1163
|
class UiDailyCalendarDirective {
|
|
1143
1164
|
weekDaysEuropean = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|