stream-chat-angular 4.37.0 → 4.38.0

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.
@@ -1 +1 @@
1
- export declare const version = "4.37.0";
1
+ export declare const version = "4.38.0";
@@ -356,7 +356,7 @@
356
356
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
357
357
  }
358
358
 
359
- var version = '4.37.0';
359
+ var version = '4.38.0';
360
360
 
361
361
  /**
362
362
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -3132,8 +3132,10 @@
3132
3132
  * The `AvatarPlaceholder` component displays the [default avatar](./AvatarComponent.mdx) unless a [custom template](../services/CustomTemplatesService.mdx) is provided. This component is used by the SDK internally, you likely won't need to use it.
3133
3133
  */
3134
3134
  var AvatarPlaceholderComponent = /** @class */ (function () {
3135
- function AvatarPlaceholderComponent(customTemplatesService) {
3135
+ function AvatarPlaceholderComponent(customTemplatesService, hostElement, cdRef) {
3136
3136
  this.customTemplatesService = customTemplatesService;
3137
+ this.hostElement = hostElement;
3138
+ this.cdRef = cdRef;
3137
3139
  /**
3138
3140
  * The size in pixels of the avatar image.
3139
3141
  */
@@ -3152,7 +3154,28 @@
3152
3154
  type: undefined,
3153
3155
  initialsType: undefined,
3154
3156
  };
3157
+ this.isVisible = true;
3155
3158
  }
3159
+ AvatarPlaceholderComponent.prototype.ngAfterViewInit = function () {
3160
+ var _this = this;
3161
+ var _a, _b;
3162
+ if (this.location !== 'message-sender') {
3163
+ this.isVisible = true;
3164
+ this.cdRef.detectChanges();
3165
+ return;
3166
+ }
3167
+ this.checkIfVisible();
3168
+ var elementToObserve = (_b = (_a = this.hostElement.nativeElement.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement;
3169
+ if (!elementToObserve) {
3170
+ return;
3171
+ }
3172
+ this.mutationObserver = new MutationObserver(function () {
3173
+ _this.checkIfVisible();
3174
+ });
3175
+ this.mutationObserver.observe(elementToObserve, {
3176
+ attributeFilter: ['class'],
3177
+ });
3178
+ };
3156
3179
  AvatarPlaceholderComponent.prototype.ngOnChanges = function () {
3157
3180
  this.context = {
3158
3181
  name: this.name,
@@ -3165,10 +3188,21 @@
3165
3188
  initialsType: this.initialsType,
3166
3189
  };
3167
3190
  };
3191
+ AvatarPlaceholderComponent.prototype.ngOnDestroy = function () {
3192
+ var _a;
3193
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
3194
+ };
3195
+ AvatarPlaceholderComponent.prototype.checkIfVisible = function () {
3196
+ var isVisible = getComputedStyle(this.hostElement.nativeElement).getPropertyValue('visibility') === 'visible';
3197
+ if (isVisible !== this.isVisible) {
3198
+ this.isVisible = isVisible;
3199
+ this.cdRef.detectChanges();
3200
+ }
3201
+ };
3168
3202
  return AvatarPlaceholderComponent;
3169
3203
  }());
3170
- AvatarPlaceholderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarPlaceholderComponent, deps: [{ token: CustomTemplatesService }], target: i0__namespace.ɵɵFactoryTarget.Component });
3171
- AvatarPlaceholderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: AvatarPlaceholderComponent, selector: "stream-avatar-placeholder", inputs: { name: "name", imageUrl: "imageUrl", size: "size", location: "location", channel: "channel", user: "user", type: "type", initialsType: "initialsType" }, usesOnChanges: true, ngImport: i0__namespace, template: "<ng-template\n #defaultAvatar\n let-name=\"name\"\n let-imageUrl=\"imageUrl\"\n let-size=\"size\"\n let-type=\"type\"\n let-channel=\"channel\"\n let-user=\"user\"\n let-location=\"location\"\n let-initialsType=\"initialsType\"\n>\n <stream-avatar\n [name]=\"name\"\n [imageUrl]=\"imageUrl\"\n [size]=\"size\"\n [type]=\"type\"\n [channel]=\"channel\"\n [user]=\"user\"\n [location]=\"location\"\n [initialsType]=\"initialsType\"\n ></stream-avatar>\n</ng-template>\n<ng-container\n *ngTemplateOutlet=\"\n (customTemplatesService.avatarTemplate$ | async) || defaultAvatar;\n context: context\n \"\n></ng-container>\n", components: [{ type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size", "location", "channel", "user", "type", "showOnlineIndicator", "initialsType"] }], directives: [{ type: i5__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i5__namespace.AsyncPipe } });
3204
+ AvatarPlaceholderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarPlaceholderComponent, deps: [{ token: CustomTemplatesService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
3205
+ AvatarPlaceholderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: AvatarPlaceholderComponent, selector: "stream-avatar-placeholder", inputs: { name: "name", imageUrl: "imageUrl", size: "size", location: "location", channel: "channel", user: "user", type: "type", initialsType: "initialsType" }, usesOnChanges: true, ngImport: i0__namespace, template: "<ng-template\n #defaultAvatar\n let-name=\"name\"\n let-imageUrl=\"imageUrl\"\n let-size=\"size\"\n let-type=\"type\"\n let-channel=\"channel\"\n let-user=\"user\"\n let-location=\"location\"\n let-initialsType=\"initialsType\"\n>\n <stream-avatar\n [name]=\"name\"\n [imageUrl]=\"imageUrl\"\n [size]=\"size\"\n [type]=\"type\"\n [channel]=\"channel\"\n [user]=\"user\"\n [location]=\"location\"\n [initialsType]=\"initialsType\"\n ></stream-avatar>\n</ng-template>\n<ng-container *ngIf=\"isVisible; else emptyPlaceholder\">\n <ng-container\n *ngTemplateOutlet=\"\n (customTemplatesService.avatarTemplate$ | async) || defaultAvatar;\n context: context\n \"\n ></ng-container>\n</ng-container>\n<ng-template #emptyPlaceholder>\n <div\n class=\"str-chat__avatar\"\n [ngStyle]=\"{\n width: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')',\n height: 'calc(var(--str-chat__spacing-px, 1px) * ' + size + ')'\n }\"\n ></div>\n</ng-template>\n", components: [{ type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size", "location", "channel", "user", "type", "showOnlineIndicator", "initialsType"] }], directives: [{ type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i5__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], pipes: { "async": i5__namespace.AsyncPipe } });
3172
3206
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: AvatarPlaceholderComponent, decorators: [{
3173
3207
  type: i0.Component,
3174
3208
  args: [{
@@ -3176,7 +3210,7 @@
3176
3210
  templateUrl: './avatar-placeholder.component.html',
3177
3211
  styles: [],
3178
3212
  }]
3179
- }], ctorParameters: function () { return [{ type: CustomTemplatesService }]; }, propDecorators: { name: [{
3213
+ }], ctorParameters: function () { return [{ type: CustomTemplatesService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { name: [{
3180
3214
  type: i0.Input
3181
3215
  }], imageUrl: [{
3182
3216
  type: i0.Input